blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
sequencelengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f9fc4548d6811b62066de783299755781ab79adc | 6dd00103fc14ecf789de6fd86df9dd3d7f40946f | /design-patterns/src/com/company/creational/abstractFactory/model/GPU.java | fd3f9c9caf74a70bf444b4571968cf968800792a | [] | no_license | 94PID/design-patterns | 06a8a9f4ee232b1391ab26c4fc4fdebd764ec237 | 3ddc23d7a9bb46be9f8abd4bdc35983df8b56d7e | refs/heads/main | 2023-08-02T07:46:22.523235 | 2021-10-04T16:43:24 | 2021-10-04T16:43:24 | 412,752,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 105 | java | package com.company.creational.abstractFactory.model;
public interface GPU {
public void run();
}
| [
"[email protected]"
] | |
349ecb6a50d0b3f5999ae67e43f8a08bafe54fec | 052856e87f515258b2055964cbc6d1b3b92b0ee4 | /src/main/java/br/com/starwars/service/IPlanetaService.java | 21659acacb88d62b97001065a0dca676ce3d98a8 | [] | no_license | filipeandrep/starwarsb2w | d43e35308a9bc3079c43f8ccbcea14f795d4c05c | 17ef68d226e531bf16a1e385109d54656abb20dc | refs/heads/master | 2020-05-22T19:52:32.668583 | 2019-05-14T18:38:39 | 2019-05-14T18:38:39 | 186,500,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package br.com.starwars.service;
import java.util.List;
import br.com.starwars.dto.PlanetaDto;
public interface IPlanetaService {
List<PlanetaDto> listar();
void inserir(PlanetaDto planetaDto);
List<PlanetaDto> buscarPorNome(String nome);
PlanetaDto obterPorId(String id);
void remover(String id);
Integer obterQuantidadeDeFilmesRest(Integer id);
}
| [
"[email protected]"
] | |
b484f2fa2fe62860b85324769e9be6a639001143 | 6b9d2e403070225c44cef1249678179fde967b9c | /demo01/src/main/java/com/huangshi/demo01/MainActivity.java | 5fa0016b78beef17c7b8b1e4330b99f90dcb6e13 | [] | no_license | huangshiFS/CrazyAndroid | 4bb5242f36e19eba061d94390cd5863d8f2f82a2 | cfd4404df571e779a9a8da8b99944b04bd955820 | refs/heads/master | 2023-05-13T08:02:51.999448 | 2021-05-17T15:06:33 | 2021-05-17T15:06:33 | 368,224,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.huangshi.demo01;
import androidx.appcompat.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]"
] | |
a54e4defefc76d651c7067d6069b889d7c2aca36 | 41fc7aa8caf67584721e19aeb51f50da5921c289 | /app/src/test/java/com/example/busbooking/ExampleUnitTest.java | ff8bb9f672100d7e8aa9bdff727a38d762b7952a | [] | no_license | sxxx5658s/busbooking | cd651e66f366f1c89cf80d9d025140aa4a80bdd6 | 3d0074ec6f24f4dc01a73140f2fd52713f7e242f | refs/heads/master | 2023-03-10T09:46:46.836662 | 2021-02-22T14:19:06 | 2021-02-22T14:19:06 | 341,133,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.example.busbooking;
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]"
] | |
21a45c96ccef7c0446509dde0cb23553eda17de3 | 5061f583bbea0b4ff25fbb8f53802efee3078587 | /src/test/java/master/equipment/EquipmentTest.java | 8e6596d7eebc93a43e0f8d1e1cc808859b1ef479 | [] | no_license | Daclas95/TOKYO | a3d0a72b1567123bcbaf37f6827f1bc088f36201 | 872888969f6d97cb9bee27209f2ff7529d75ec33 | refs/heads/master | 2023-05-12T06:09:47.325921 | 2020-08-01T04:01:21 | 2020-08-01T04:01:21 | 283,975,620 | 0 | 0 | null | 2023-05-09T18:28:22 | 2020-07-31T07:47:23 | Java | UTF-8 | Java | false | false | 1,468 | java | package master.equipment;
import com.test.qa.testdata.masterdata.EquipmentData;
import com.test.qa.tokyo.DisplayDashboard.master.equipmentNV.Equipment;
import com.test.qa.utils.TestBase;
import org.testng.annotations.Test;
import org.testng.asserts.SoftAssert;
/**
* Author Daclas
*/
public class EquipmentTest extends TestBase {
@Test(groups = {"Smoke" },priority = 1,dataProviderClass = EquipmentData.class,dataProvider = "plantequipmentdataprovider")
public void equipment(String EquiName,String Desc,String EditDesc) throws Exception {
softAssert = new SoftAssert();
Equipment.clickMasterPanel();
Equipment.clickequipmenttab();
Equipment.clickequipment();
softAssert.assertTrue(Equipment.isDisplayed(),"Sorry we could not find" );
Equipment.clickaddequipment();
Equipment.clicksavebtn();
//here check validation Message
softAssert.assertEquals(Equipment.getEquipmentName(),"Name can't be empty","there are not equal");
Equipment.setEquipment(EquiName);
Equipment.setDescription(Desc);
Equipment.selecttype();
Equipment.clicksavebtn();
// next line for Editing purpose
Equipment.clickEditButton();
Equipment.setDescription(EditDesc);
Equipment.clicksavebtn();
// this is for check the delete button
Equipment.ClickDeletebtn();
Equipment.dlt();
softAssert.assertAll();
}
}
| [
"[email protected]"
] | |
3493fe94e816a2d82b704961b2def229ddf08ea6 | a1ff49e26e665b07a77728c26945aba35590d923 | /src/main/java/com/example/demo/model/EntityMeta.java | 326c915349f96f6959566f12c4945a2220cc0584 | [] | no_license | mikdrob/PcAssembly | e4a1b5ff7209766b1e0eba655d7b96e0dcaee929 | f35c399353fdc49282be4854f25c99a1b7a7271e | refs/heads/main | 2023-06-26T08:55:46.348955 | 2021-07-24T18:00:32 | 2021-07-24T18:00:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,197 | java | package com.example.demo.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(
value = {"createdAt", "updatedAt"},
allowGetters = true
)
public abstract class EntityMeta implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "created_at", nullable = false, updatable = false)
@CreatedDate
private Date createdAt;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "updated_at", nullable = false)
@LastModifiedDate
private Date updatedAt;
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
}
| [
"[email protected]"
] | |
bce79b0dfed1a4cd38306b4d5a91874463c1f49e | 08e99cefdaaef80bc91afe7a8b907f89a39b0785 | /PopularMoviesStage2/app/src/main/java/lucagrazioli/popularmovies/MovieDetailActivity.java | 515852465b6ff1ff76c6806d649d4733daa91a10 | [] | no_license | Luke035/Popular-Movies-Stage-2 | 294dd18c619cceae6973d962e1d91bbd5a076606 | 6ae49c176aee51a6aa0737adf45b776223b7fe7a | refs/heads/master | 2021-01-10T16:58:16.872848 | 2015-12-12T13:01:04 | 2015-12-12T13:01:04 | 44,319,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,018 | java | package lucagrazioli.popularmovies;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MovieDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_movie_detail);
getSupportActionBar().setElevation(0.0f);
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
arguments.putParcelable(MovieDetailActivityFragment.DETAIL_URI, getIntent().getData());
MovieDetailActivityFragment fragment = new MovieDetailActivityFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.activity_poster_detail_conntainer, fragment)
.commit();
}
}
}
| [
"[email protected]"
] | |
afa490f42e018880b920ebab048060b00b7c660e | 72e1e90dd8e1e43bad4a6ba46a44d1f30aa76fe6 | /java/jee/murachs-java-servlets-jsp/murachs-java-servlets-jsp-chapter-20-how-work-filters/murachs-java-servlets-jsp-chapter20-part01-download/src/main/java/murach/util/CookieUtil.java | 10558a655c4a9d31bd0567f212f43e2812540e84 | [
"Apache-2.0"
] | permissive | fernando-romulo-silva/myStudies | bfdf9f02778d2f4993999f0ffc0ddd0066ec41b4 | aa8867cda5edd54348f59583555b1f8fff3cd6b3 | refs/heads/master | 2023-08-16T17:18:50.665674 | 2023-08-09T19:47:15 | 2023-08-09T19:47:15 | 230,160,136 | 3 | 0 | Apache-2.0 | 2023-02-08T19:49:02 | 2019-12-25T22:27:59 | null | UTF-8 | Java | false | false | 399 | java | package murach.util;
import jakarta.servlet.http.Cookie;
public class CookieUtil {
public static String getCookieValue(Cookie[] cookies, String cookieName) {
String cookieValue = "";
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
cookieValue = cookie.getValue();
}
}
}
return cookieValue;
}
}
| [
"[email protected]"
] | |
4a07ddcf42f70ed23001c38fff2f528c2a755239 | 7620c36a482a23eb2a046ccf86a23bca7ef41ba2 | /src/main/java/com/jhg/utils/dtgrid/model/Sort.java | 876c6faf863b48b53eae05fac69ec4420235b8e5 | [] | no_license | juhuiguang/qmv1 | 9bc4b043db7cbef9a01d01eac31ebb45a1c19cc9 | d663f1d3ae9616ebc9b54571d7950a3a26fb1c00 | refs/heads/master | 2021-07-09T17:50:15.662165 | 2017-10-13T07:19:06 | 2017-10-13T07:19:06 | 106,104,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.jhg.utils.dtgrid.model;
public class Sort {
/**
* 字段
*/
private String field;
/**
* 排序逻辑
*/
private String logic;
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getLogic() {
return logic;
}
public void setLogic(String logic) {
this.logic = logic;
}
}
| [
"lefov3697[]"
] | lefov3697[] |
4beb486f36e2c379b048c9aea5e3a44712fc6b19 | d8d1bdf14cae01b601aae9ce25dfcbf191018c7a | /src/test/java/me/sml/demooauth/config/OAuthConfigTest.java | 94cb470ff08a209d18e84669bbf800b428389617 | [] | no_license | Spring-Boot-Course/Spring-Boot-Oauth | 2783d0f24d7887063a47f20f096680f7528fcb29 | 86a3fe4f06b9f2899c4ecc90129e1a4afe128025 | refs/heads/master | 2020-04-17T23:06:19.381010 | 2019-01-24T14:30:48 | 2019-01-24T14:30:48 | 167,021,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package me.sml.demooauth.config;
import io.restassured.RestAssured;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
@TestPropertySource(properties = "spring.config.location=classpath:/google.yml")
public class OAuthConfigTest {
@Before
public void setup() {
RestAssured.baseURI = "http://localhost";
RestAssured.port = 8080;
}
@Test
public void google로그인_시도하면_OAuth인증창_등장한다 () throws Exception {
given()
.when()
.redirects().follow(false) // 리다이렉트 방지
.get("/login")
.then()
.statusCode(302)
.header("Location", containsString("https://accounts.google.com/o/oauth2/auth"));
}
}
| [
"[email protected]"
] | |
57d868b09b7243a9d11b4728ee4e0c858fd75548 | 3d8af9090a06d1c983dde1ed0f94637bc88d04ee | /src/main/java/demo/WatchMore.java | 68485b32010a02cd63f7a97f84fdb1a8cf37e36d | [] | no_license | clown121381/zookeeper | 83e9aff2513bfd50908496e7c63aab425ca142f8 | 12c4702fb8a32042f10b2440c500bb972aa4c32a | refs/heads/master | 2020-08-01T04:49:12.294632 | 2019-09-25T14:46:39 | 2019-09-25T14:46:39 | 210,869,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package demo;
import org.apache.zookeeper.*;
import org.apache.zookeeper.data.Stat;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
* watch 之监听永久并且通知给控制台
*/
public class WatchMore {
public final static String CONNECT_STRING = "192.168.44.131:2181";
public final static int SESSION_TIMEOUT = 50*1000;
private ZooKeeper zooKeeper;
private String oldValue;
public ZooKeeper startZK() throws IOException {
return new ZooKeeper(CONNECT_STRING, SESSION_TIMEOUT, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
}
});
}
public void stopZK() throws InterruptedException {
if(zooKeeper != null) {
zooKeeper.close();
}
}
public void createZnode(String nodePath,String nodeValue) throws KeeperException, InterruptedException {
zooKeeper.create(nodePath, nodeValue.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
public ZooKeeper getZooKeeper() {
return zooKeeper;
}
public void setZooKeeper(ZooKeeper zooKeeper) {
this.zooKeeper = zooKeeper;
}
//递归一次放一个监听
public String get(String path) throws KeeperException, InterruptedException {
return new String(zooKeeper.getData(path, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
try {
oldValue = get(path);
System.out.println(oldValue);
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}, new Stat()));
}
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
WatchMore watchMore = new WatchMore();
watchMore.setZooKeeper(watchMore.startZK());
String a = watchMore.get("/yang");
System.out.println(a);
TimeUnit.SECONDS.sleep(300);
}
}
| [
"[email protected]"
] | |
d734a3f59555222167fa48298c7bb8e53ef98caa | 61ae47a4b9730b7d05d0446ac332316cc17dd86e | /src/main/java/com/helix/security/UserNotActivatedException.java | 25a0911f19cd2506d69f39c76e776ba09f7c3321 | [] | no_license | ashismathew/HelixPro | bd6f64e40b9eeabe814d999a2fe5d10c48d6af6d | 63298fe33c34206c3a7a50f1e5b932b3e7a858f2 | refs/heads/master | 2021-01-22T09:04:17.921221 | 2015-08-18T13:23:10 | 2015-08-18T13:23:10 | 40,428,728 | 0 | 1 | null | 2020-09-18T06:56:58 | 2015-08-09T07:17:24 | Java | UTF-8 | Java | false | false | 450 | java | package com.helix.security;
import org.springframework.security.core.AuthenticationException;
/**
* This exception is throw in case of a not activated user trying to authenticate.
*/
public class UserNotActivatedException extends AuthenticationException {
public UserNotActivatedException(String message) {
super(message);
}
public UserNotActivatedException(String message, Throwable t) {
super(message, t);
}
}
| [
"[email protected]"
] | |
a45ece874f60d4b73098bbd54dfdea5ba02dd839 | 0802273e3230781f68deb8703214e3afa53f6d22 | /FalconNotify/app/src/main/java/app/techsol/falconnotify/SplashScreenActivity.java | 985433ec88e95f97bb1598ec65d3a4b4d274014e | [] | no_license | androidgeek077/FalconNotify | 6e1544bf12f815aa0ec2bcd16ac2de274d54cf34 | 394d3b6791baabce2176d71fe44c2052c6306aad | refs/heads/master | 2021-01-03T18:09:16.497514 | 2020-02-27T07:28:41 | 2020-02-27T07:28:41 | 240,185,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,698 | java | package app.techsol.falconnotify;
import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class SplashScreenActivity extends AppCompatActivity {
TextView appNameTV;
ImageView logoImg;
TextView mSlogenTV;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen);
appNameTV=findViewById(R.id.appNameTV);
mSlogenTV=findViewById(R.id.mSlogenTV);
logoImg=findViewById(R.id.logoImg);
Animation myanim = AnimationUtils.loadAnimation(this, R.anim.mytrans);
Animation myTwoanim = AnimationUtils.loadAnimation(this, R.anim.spin_in);
Animation myFirstanim = AnimationUtils.loadAnimation(this, R.anim.spineone);
logoImg.setAnimation(myFirstanim);
appNameTV.setAnimation(myanim);
mSlogenTV.setAnimation(myTwoanim);
gotoMainpage();
getSupportActionBar().hide();
}
private void gotoMainpage() {
new Thread(){
@Override
public void run() {
super.run();
try {
sleep(4000);
Intent mintent=new Intent(SplashScreenActivity.this,MainActivity.class);
startActivity(mintent);
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
}
}
| [
"[email protected]"
] | |
a95bbf09072abf1c0b9071f9d21639b9538b842d | f07946e772638403c47cc3e865fd8a5e976c0ce6 | /leetcode_java/src/1227.airplane-seat-assignment-probability.java | baf232eda27e14068d06da1a70f82d40a9b65108 | [] | no_license | yuan-fei/Coding | 2faf4f87c72694d56ac082778cfc81c6ff8ec793 | 2c64b53c5ec1926002d6e4236c4a41a676aa9472 | refs/heads/master | 2023-07-23T07:32:33.776398 | 2023-07-21T15:34:25 | 2023-07-21T15:34:25 | 113,255,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | /*
* @lc app=leetcode id=1227 lang=java
*
* [1227] Airplane Seat Assignment Probability
*
* https://leetcode.com/problems/airplane-seat-assignment-probability/description/
*
* algorithms
* Medium (69.52%)
* Total Accepted: 288
* Total Submissions: 419
* Testcase Example: '1'
*
* n passengers board an airplane with exactly n seats. The first passenger has
* lost the ticket and picks a seat randomly. But after that, the rest of
* passengers will:
*
*
* Take their own seat if it is still available,
* Pick other seats randomly when they find their seat occupied
*
*
* What is the probability that the n-th person can get his own seat?
*
*
* Example 1:
*
*
* Input: n = 1
* Output: 1.00000
* Explanation: The first person can only get the first seat.
*
* Example 2:
*
*
* Input: n = 2
* Output: 0.50000
* Explanation: The second person has a probability of 0.5 to get the second
* seat (when first person gets the first seat).
*
*
*
* Constraints:
*
*
* 1 <= n <= 10^5
*
*/
class Solution {
public double nthPersonGetsNthSeat(int n) {
// case 1: P(p1 seat in seat 1, pn seat in seat n) = 1/n
// case 2: P(p1 seat in seat x, px seat in sear 1, pn seat in seat n) = (n-2)/n * 1/2
// P(case 1) + P(case 2) = 0.5
return n==1?1:0.5;
}
}
| [
"[email protected]"
] | |
9dd0b05ab804fa223bb90478da6d0c95baabd934 | 1a870eff07c27476074f979d8e5abddde2646840 | /org/omg/IOP/TAG_ALTERNATE_IIOP_ADDRESS.java | 824ee14189abb6b78d3a995a6eb670559e606897 | [
"Apache-2.0"
] | permissive | zhenjunMa/JDK8Translation | ef6684e2292a6646129ba4206af136ffd292d0b0 | 0f9269a359b7ef2a778d89fb4e82ac4e47ea26e9 | refs/heads/master | 2021-06-07T18:59:11.037612 | 2020-09-18T02:49:43 | 2020-09-18T02:49:43 | 97,243,202 | 13 | 5 | null | 2020-09-18T02:49:44 | 2017-07-14T14:36:54 | Java | UTF-8 | Java | false | false | 1,536 | java | package org.omg.IOP;
/**
* org/omg/IOP/TAG_ALTERNATE_IIOP_ADDRESS.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u111/7883/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl
* Thursday, September 22, 2016 3:33:15 PM PDT
*/
public interface TAG_ALTERNATE_IIOP_ADDRESS
{
/**
* In cases where the same object key is used for more than one
* internet location, the following standard IOR Component is defined
* for support in IIOP version 1.2.
* <p>
* The <code>TAG_ALTERNATE_IIOP_ADDRESS</code> component has an
* associated value of type:
* <code>
* <pre>
* struct {
* string HostID,
* short Port
* };
* </pre>
* </code>
* encoded as a CDR encapsulation.
* <p>
* Zero or more instances of the <code>TAG_ALTERNATE_IIOP_ADDRESS</code>
* component type may be included in a version 1.2
* <code>TAG_INTERNET_IOP</code> Profile. Each of these alternative
* addresses may be used by the client orb, in addition to the host
* and port address expressed in the body of the Profile. In cases
* where one or more <code>TAG_ALTERNATE_IIOP_ADDRESS</code> components
* are present in a <code>TAG_INTERNET_IOP</code> Profile, no order of
* use is prescribed by Version 1.2 of IIOP.
*/
public static final int value = (int)(3L);
}
| [
"[email protected]"
] | |
55cbac4ef3d812939ed40a8fa4c26a97a9adff86 | a3fc0bf6b9087d7cf7c2502040c1ce0f936c97bc | /MyQueue.java | bd366d543f83a6f13c2744d1d8507cc63b2079e7 | [] | no_license | momoney1/DonationManager | f1080dece4fe23efa0e6c1295ca25a54676e8f7c | 00da44d359a41fe7d8d85e834c0ff5ea7749ba60 | refs/heads/master | 2022-12-17T21:39:54.921460 | 2020-09-23T03:52:28 | 2020-09-23T03:52:28 | 297,845,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,621 | java | package Assignment2;
import java.util.Arrays;
/**
* A generic class that implements a generic interface for a queue data structure
* @author Moe Diakite
*
* @param <T>
*/
public class MyQueue<T> implements QueueInterface<T> {
private static int DEFAULT_CAPACITY = 5;
private static int MAX_CAPACITY;
private T[] queue;
private int frontIndex;
private int lastIndex;
private T frontObject;
private T lastObject;
private int entries;
/**
* A no arg constructor that creates a new queue of default capacity
*/
public MyQueue() {
this(DEFAULT_CAPACITY);
}
/**
* A paramterized constructor that creates a new queue of specified capacity
* @param initialCapacity
*/
public MyQueue(int initialCapacity) {
@SuppressWarnings("unchecked")
T[] tQueue = (T[]) new Object[initialCapacity];
//check to ensure capacity
queue = tQueue;
}
/**
* Number of elements in the Queue
* @return the number of elements in the Queue
*/
public boolean isEmpty() {
return entries <= 0;
};
/**
* A bolean method that informs the client on whether or not the queue is full
* @return true or false
*/
public boolean isFull() {
return entries >= queue.length;
};
/**
* Deletes and returns the element at the front of the Queue
* @throws IllegalStateException
* @return the element at the front of the Queue
*/
public T dequeue() {
if(!isEmpty()) {
frontObject = queue[0];
for(int i = 0; i < entries - 1; i++) {
queue[i] = queue[i + 1];
}
entries--;
lastIndex--;
}
else {
throw new IllegalStateException("Attempt to remove an object from an empty queue");
}
return frontObject;
};
/**
* Number of elements in the Queue
* @return the number of elements in the Queue
*/
public int size() {
return entries;
};
/**
* Adds an element to the end of the Queue
* @param e the element to add to the end of the Queue
* @return true if the add was successful, false if not
*/
public boolean enqueue(T e) {
if(!isFull()) {
queue[lastIndex] = e;
lastIndex++;
entries++;
return true;
}
else {
return false;
}
}
/**
* Returns the elements of the Queue in an array, [0] is front of Queue, [1] is next in Queue, etc.
* @return an array of the Object elements in the Queue
*/
public T[] toArray() {
@SuppressWarnings("unchecked")
T[] result = (T[]) new Object[entries];
for(int i = 0; i < result.length; i++) {
result[i] = queue[i];
}
return result;
}
}
| [
"[email protected]"
] | |
935142ef0751c5126e938563dc943b152c8956d7 | 0d15530b411e02fa5324755be309aae87df15941 | /src/main/java/com/pdkj/jack_shop/service/ShopTypeService.java | ef04a4f5916a3787b7a37619472182eba5e752dc | [] | no_license | pdmall/jack_shop | b21c64b5b2319746d7c9a953d21b706835e432ed | b2022e62678031bfb20f480753ebb59868edefd1 | refs/heads/master | 2020-03-21T14:38:38.679963 | 2018-08-26T08:39:38 | 2018-08-26T08:39:38 | 138,667,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.pdkj.jack_shop.service;
import com.pdkj.jack_shop.model.ShopType;
import com.pdkj.jack_shop.model.ShopTypeRel;
import com.pdkj.jack_shop.service.BaseService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Created by CodeGenerator on 2018/06/26.
*/
@Service
public class ShopTypeService extends BaseService<ShopType> {
public List<Map<String, Object>> getAllShopType() {
return shopTypeDao.getAllShopType();
}
}
| [
"[email protected]"
] | |
a3c19a4e1212060af8fb640af82affe57941c6d1 | 3eb7c378d4633718de04533042bc8a102d23283b | /src/main/java/ru/alex/vic/client/vk/VkClient.java | a8e1891f15c612c5b2aa444c47a97c7cd0359bb2 | [] | no_license | x7FFFFFFF/hhtool2 | 8a7e41b682b8aba67078ab2a4240fcabbc36060a | ff9d12d1213cb4a1abcfff0fd3e63c708705d454 | refs/heads/master | 2020-04-20T00:41:38.908686 | 2019-02-16T05:51:37 | 2019-02-16T05:51:37 | 168,527,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,325 | java | package ru.alex.vic.client.vk;
import com.google.gson.*;
import com.google.gson.stream.JsonReader;
import ru.alex.vic.Utils;
import ru.alex.vic.client.HttpClient;
import ru.alex.vic.json.vk.*;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import java.util.ArrayList;
import java.util.List;
@Singleton
public class VkClient {
private final HttpClient httpClient;
private final Provider<VkUrlBuilder> urlBuilder;
private final int timeout;
@Inject
public VkClient(HttpClient httpClient, Provider<VkUrlBuilder> urlBuilder, @Named("vk.api.request_timeout.ms") int timeout) {
this.httpClient = httpClient;
this.urlBuilder = urlBuilder;
this.timeout = timeout;
}
public GetCountriesResponse getCountriesByCode(String... codes) {
final String url = urlBuilder.get().getCountries().code(codes).build();
return executeGet(url, GetCountriesResponse.class);
}
public GetRegionsResponse getRegionsByCountryCode(Integer code) {
final String url = urlBuilder.get().getRegions().countryId(code).build();
return executeGet(url, GetRegionsResponse.class);
}
public List<City> getCitiesByCountryAndRegion(Long countryId, Long regionId) {
int offset = 0;
final int count = 100;
final VkUrlBuilder urlBuilder = this.urlBuilder.get().getCities()
.countryId(countryId)
.regionId(regionId)
.needAll()
.offset(offset)
.count(count);
GetCitiesResponse response = executeGet(urlBuilder
.build(), GetCitiesResponse.class);
List<City> res = new ArrayList<>(response.getItems());
while (response.getItems().size() != 0) {
Utils.sleep(timeout);
offset += count;
urlBuilder.offset(offset);
response = executeGet(urlBuilder.build(), GetCitiesResponse.class);
res.addAll(response.getItems());
if (res.size() == response.getCount()) {
break;
}
}
return res;
}
private <T> T executeGet(String url, Class<T> responseClass) {
return httpClient.get(url, (gson, json) -> {
if (json.has("error")) {
JsonElement errorElement = json.get("error");
try {
if (errorElement.isJsonObject()) {
final JsonObject errorJson = errorElement.getAsJsonObject();
if (errorJson.has("error_msg")) {
throw new RuntimeException(errorJson.get("error_msg").getAsString() + " ; url=" + url);
}
}
} catch (JsonSyntaxException e) {
throw new RuntimeException(e);
}
throw new RuntimeException("url=" + url);
}
JsonElement response = json;
if (json.has("response")) {
response = json.get("response");
}
try {
return gson.fromJson(response, responseClass);
} catch (JsonSyntaxException e) {
throw new RuntimeException(e);
}
});
}
}
| [
"[email protected]"
] | |
ea433480b318a5caaf8c3a42dc2097a92573ce5d | 297cb5ca9ea81a73d77c8205978b85e7306bca80 | /app/src/main/java/app/app1uppro/modules/sendmessage/ISendMessageView.java | c595263aa794414db07b464d3272dc2c3d1296b2 | [] | no_license | Nitin0901/1UpPro | 7189a78a935d340d85d3efb60712b95e73b10bf5 | 73f1f3211ac837d001a23f45476f8e12896da4fe | refs/heads/master | 2020-04-04T13:15:10.686166 | 2018-11-03T06:35:44 | 2018-11-03T06:35:44 | 155,954,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 229 | java | package app.app1uppro.modules.sendmessage;
import app.app1uppro.apibase.modelclass.ChangePasswordModel;
import app.app1uppro.baseui.MvpView;
public interface ISendMessageView extends MvpView {
void updateUi(String msg);
}
| [
"[email protected]"
] | |
0597f4ed45f43465da7f65e3895c427978b41acb | 5f6d92b0db64e516910569d889a4f151c3c9b1e1 | /src/java/com/cafeform/dndtools/mbean/DiceToolsController.java | 850f1aa46726f249bba489c0650d2015ac5fe3cc | [] | no_license | kaizawa/dndtools35 | 47e609f2d20a4df3c85d1b6fb85cac4a5dde64a4 | e85967f022b6a0423d0ee36fa2be7e0edf4dfc9a | refs/heads/master | 2021-01-21T11:46:54.420247 | 2017-01-02T12:56:04 | 2017-01-02T12:56:04 | 3,248,179 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,660 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.cafeform.dndtools.mbean;
import com.cafeform.dndtools.entity.DiceMaster;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.inject.Inject;
import javax.enterprise.context.SessionScoped;
import javax.faces.component.html.HtmlDataTable;
import javax.inject.Named;
@Named
@SessionScoped
public class DiceToolsController implements Serializable {
//ダイスタイプ
private DiceMaster selectedDice = null;
public DiceMaster getSelectedDice() {
return selectedDice;
}
public void setSelectedDice(DiceMaster selectedDice) {
this.selectedDice = selectedDice;
}
// ダイス数
private Integer selectedDiceNumber = 0;
public Integer getSelectedDiceNumber() {
return selectedDiceNumber;
}
public void setSelectedDiceNumber(Integer selectedDiceNumber) {
this.selectedDiceNumber = selectedDiceNumber;
}
public HtmlDataTable getDiceTable() {
return diceTable;
}
public void setDiceTable(HtmlDataTable diceTable) {
this.diceTable = diceTable;
}
private HtmlDataTable diceTable = new HtmlDataTable();
public DiceToolsController() {
}
Integer getAverage(Integer dice){
int sum = 0;
int i;
for (i = 1 ; i > dice ; i++){
sum += i;
}
return sum / dice;
}
public Integer getRandomNumber(){
if(selectedDice == null){
return 0;
}
return new Random().nextInt(selectedDice.getType()) + 1;
}
public String getRandomNumberListText(){
StringBuilder sb = new StringBuilder();
Random rand = new Random();
Integer total = 0;
Integer num = 0;
if(selectedDice == null){
return "-";
}
for(int i = 0 ; i < selectedDiceNumber ; i ++){
num = rand.nextInt(selectedDice.getType()) + 1;
if(i != 0) {
sb.append(" + ");
}
total += num;
sb.append(num);
}
sb.append(" = " + total);
return sb.toString();
}
List<Integer> numberList = null;
public List<Integer> getNumberList(){
if( numberList == null){
numberList = new ArrayList<Integer>();
for(Integer i = 1 ; i < 21 ; i++){
numberList.add(i);
}
}
return numberList;
}
}
| [
"[email protected]"
] | |
7fae16898dabf8f125761426ea5c1c6e670f6427 | 1a6be6e85a9ab733d65725064f118a5d19e0375f | /novice/01-02/02-inheritance-overriding/BangunDatar.java | 8ee54af2bd01c8bb9c4f33e0d8a019bfd273ae39 | [] | no_license | mhaniffatur/praxis-academy | 1b5457e1571051aac69219c9f385300bef46adb1 | 7c78317dc3fd15b0a350a368fc4372de626976ac | refs/heads/master | 2020-12-23T05:23:16.344766 | 2020-03-19T14:35:05 | 2020-03-19T14:35:05 | 237,049,829 | 0 | 1 | null | 2020-03-07T15:07:12 | 2020-01-29T18:08:11 | Java | UTF-8 | Java | false | false | 326 | java | public class BangunDatar
{
Void test()
{
System.out.println("halo");
}
float luas()
{
System.out.println("Menghitung laus bangun datar");
return 0;
}
float keliling()
{
System.out.println("Menghitung keliling bangun datar");
return 0;
}
} | [
"[email protected]"
] | |
99e177a57ea6478b22c5d3b8b9f5bd4606cded20 | 4baa548867ddbcf6e6e567a8a7470602cc56b61f | /iotsys/.svn/pristine/df/df07df2abdab30fb81f6a95135a07521e12bd3db.svn-base | 1e144e44c6e33c2e8070a5ec48ba5192311d3658 | [] | no_license | yeshang5/myProject | 7269a07af85275fd56b2ada8eb38c997000011a0 | e4e43eae5ae67349d9dbd2b688aab788463897da | refs/heads/master | 2021-04-09T11:23:35.231204 | 2018-03-16T09:55:28 | 2018-03-16T09:55:28 | 125,497,651 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,955 | package com.ssm.action;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import com.ssm.beans.ApiDomain;
import com.ssm.beans.ProbeDefaultBean;
import com.ssm.service.impl.ProbeDefaultServiceImpl;
@Controller("apiProbeDefaultAction")
public class ProbeDefaultAction extends BaseAction{
@Resource
private ProbeDefaultServiceImpl probeDefaultService;
private Logger log = Logger.getLogger(this.getClass()); // Logger
public void findById() throws Exception{
log.info("-----------获取探测器类型信息接口开始---------【apiProbeDefaultAction_findById.do】");
ApiDomain domain=new ApiDomain();
ProbeDefaultBean probeDefault=new ProbeDefaultBean();
try{
String id=getRequest().getParameter("id");
probeDefault=probeDefaultService.findById(id);
domain.setData(probeDefault);
}catch(Exception e){
e.printStackTrace();
log.error("获取探测器类型信息发生异常:"+e.getMessage(),e);
}finally{
this.printObjectNoJsonp(domain);
}
log.info("-----------获取探测器类型信息接口结束--------------");
}
public void findAll() throws Exception{
log.info("-----------获取探测器类型全部信息接口开始---------【apiProbeDefaultAction_findAll.do】");
ApiDomain domain=new ApiDomain();
domain.setCode("000");
domain.setMsg("查询成功");
try{
List<ProbeDefaultBean> probeDefault=new ArrayList<ProbeDefaultBean>();
probeDefault=probeDefaultService.findAll();
domain.setData(probeDefault);
}catch(Exception e){
domain.setCode("001");
domain.setMsg("系统异常");
e.printStackTrace();
log.error("获取探测器类型全部信息接口发生异常:"+e.getMessage(),e);
}finally{
this.printObjectNoJsonp(domain);
}
log.info("-----------获取探测器类型全部信息接口结束--------------");
}
}
| [
"[email protected]"
] | ||
bc10955931896397046640f474cf5a55d44a497f | 008d39d0086380ca6cd8c20c868075be80a29b2c | /src/main/java/com/sofka/retovuelo/domain/genericvalues/Origen.java | b7f6f2c16142c3d24ce336a526ddb6171c90cb26 | [] | no_license | Danvar03/RetoDomainDrivenDesign | ae9605f6a240d970dbba53670a4d02923f111cbd | e915bb419f0d9f953ff2af4d525d13dbda4c9493 | refs/heads/master | 2023-08-02T13:04:29.431766 | 2021-10-02T04:57:26 | 2021-10-02T04:57:26 | 412,274,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package com.sofka.retovuelo.domain.genericvalues;
import co.com.sofka.domain.generic.ValueObject;
import java.util.Objects;
public class Origen implements ValueObject<String> {
private final String value;
public Origen(String value) {
this.value = Objects.requireNonNull(value);
if (this.value.isBlank()){
throw new IllegalArgumentException("El nombre del origen esta vacia");
}
}
public String value() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Origen origen = (Origen) o;
return Objects.equals(value, origen.value);
}
@Override
public int hashCode() {
return Objects.hash(value);
}
} | [
"[email protected]"
] | |
4071673b0c09977b4363704b4d1aeaf004084d3c | 2ee28fe3f56a2ea55dcf92920ba98fcbb5db06d2 | /app/src/androidTest/java/com/linkstar/app/guide/ExampleInstrumentedTest.java | 16bde77e8ee933afa0df19f5c3170ba42e178dfb | [] | no_license | luoye-xi/MallGuide | 6bfbf97b6c377a4730a26cc61619b314824c2f5c | a8ad7dce8761f22d078a11860adfeb6bb310dab4 | refs/heads/master | 2020-04-11T02:52:49.874632 | 2019-01-16T08:35:27 | 2019-01-16T08:35:27 | 161,459,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.linkstar.app.guide;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.linkstar.app.guide", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
b93ce67a5b8e5a7c608b6e3665cc499ddc4b0836 | 0562cecc4dfbf5ea09480a52b69ad187443f69d4 | /src/main/java/edu/cmu/cs/stage3/alice/authoringtool/Importer.java | f41e7a811c7449fd5454bd0fa288073be43eb6c3 | [
"BSD-2-Clause"
] | permissive | vorburger/Alice | 9f12b91200b53c12ee562aad88be4964c9911aa6 | af10b6edea7ecbf35bcba08d0853562fbe4a1837 | refs/heads/master | 2021-01-18T07:37:28.007447 | 2013-12-12T13:48:17 | 2013-12-12T13:48:17 | 3,757,745 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | /*
* Copyright (c) 1999-2003, Carnegie Mellon University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Products derived from the software may not be called "Alice",
* nor may "Alice" appear in their name, without prior written
* permission of Carnegie Mellon University.
*
* 4. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes software developed by Carnegie Mellon University"
*/
package edu.cmu.cs.stage3.alice.authoringtool;
public interface Importer {
public java.util.Map getExtensionMap();
public edu.cmu.cs.stage3.alice.core.Element load( String filename ) throws java.io.IOException;
public edu.cmu.cs.stage3.alice.core.Element load( java.io.File file ) throws java.io.IOException;
public edu.cmu.cs.stage3.alice.core.Element load( java.net.URL url ) throws java.io.IOException;
//public edu.cmu.cs.stage3.alice.core.Element load( java.io.InputStream istream, String ext ) throws java.io.IOException;
}
| [
"[email protected]"
] | |
904ba8cbed38e62be2fb7f6d8ff621616fbe9a8e | 6bac1a560bf008cb2d898438050d720653ce628a | /telekom/Siebel/gensrc/com/siebel/selfservice/common/user/id/UserId.java | 5740aeb5047b81b740c994d29f54988e2c725e39 | [] | no_license | vkscorpio3/TelekomPOC | 8ff40774bbbfc6868b4a3f84a971d972b9dc9ab7 | c437ef7c30e93ea24c1d8acc0110b985401d049b | refs/heads/master | 2020-03-08T16:54:42.639312 | 2017-08-26T22:25:25 | 2017-08-26T22:25:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,016 | java |
package com.siebel.selfservice.common.user.id;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for UserId complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UserId">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ModId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="ListOfSSUserResponsibility" type="{http://www.siebel.com/SelfService/Common/User/Id}ListOfSSUserResponsibilityId" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UserId", propOrder = {
"id",
"modId",
"listOfSSUserResponsibility"
})
public class UserId
implements Serializable
{
@XmlElement(name = "Id")
protected String id;
@XmlElement(name = "ModId")
protected String modId;
@XmlElement(name = "ListOfSSUserResponsibility")
protected ListOfSSUserResponsibilityId listOfSSUserResponsibility;
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the modId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModId() {
return modId;
}
/**
* Sets the value of the modId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModId(String value) {
this.modId = value;
}
/**
* Gets the value of the listOfSSUserResponsibility property.
*
* @return
* possible object is
* {@link ListOfSSUserResponsibilityId }
*
*/
public ListOfSSUserResponsibilityId getListOfSSUserResponsibility() {
return listOfSSUserResponsibility;
}
/**
* Sets the value of the listOfSSUserResponsibility property.
*
* @param value
* allowed object is
* {@link ListOfSSUserResponsibilityId }
*
*/
public void setListOfSSUserResponsibility(ListOfSSUserResponsibilityId value) {
this.listOfSSUserResponsibility = value;
}
}
| [
"[email protected]"
] | |
c2c1c2c01df2c65bdba48205c2d32690b5ac3ffe | 315c36d34c12b9c16536eb9428782aa457666f55 | /src/oncecenter/action/addlostelement/CompareRootAction.java | b8d0fefa90a3cdb3074ddfb0fe35e2f5748e3bf4 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | guzy/OnceCenter | 49e3a40f20a18529c8c42aa0293b48c0f7a03e43 | a82bfd693dda4829b3284374cf3003cd37843c92 | refs/heads/master | 2021-01-21T21:53:59.430115 | 2015-10-20T14:40:19 | 2015-10-20T14:40:19 | 37,455,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,847 | java | package oncecenter.action.addlostelement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import oncecenter.Constants;
import oncecenter.action.sr.AlarmDialog;
import oncecenter.util.AddServerUtil;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObject;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObjectHost;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObjectPool;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObjectRoot;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObjectVM;
import oncecenter.views.xenconnectiontreeview.elements.VMTreeObject.ItemState;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.once.xenapi.Connection;
import com.once.xenapi.Pool;
public class CompareRootAction extends Action {
VMTreeObjectRoot previousRoot;
VMTreeObjectRoot currentRoot;
ArrayList<VMTreeObjectHost> lostHosts = new ArrayList<VMTreeObjectHost>();
ArrayList<VMTreeObjectVM> lostVMs = new ArrayList<VMTreeObjectVM>();
AddLostHostDialog addLostHostDialog;
ShowLostVMDialog showLostVMDialog;
int returnCode;
public CompareRootAction(VMTreeObjectRoot previousRoot,VMTreeObjectRoot currentRoot){
this.previousRoot = previousRoot;
this.currentRoot = currentRoot;
}
public void run(){
if(previousRoot==null){
Constants.CONNECTIONS_TREE.addChild(currentRoot);
return;
}
List<VMTreeObjectHost> historyHosts = previousRoot.historyHosts;
List<String> currentUuids = new ArrayList<String>();
for(VMTreeObjectHost hostO:currentRoot.hostMap.values()){
if(hostO.getUuid()!=null)
currentUuids.add(hostO.getUuid());
}
if(historyHosts!=null){
for(VMTreeObjectHost host:historyHosts){
if(host.getUuid()!=null&&!currentUuids.contains(host.getUuid())){
lostHosts.add(host);
}
}
}
if(lostHosts.size()>0){
Display display = PlatformUI.getWorkbench().getDisplay();
if (!display.isDisposed()) {
Runnable runnable = new Runnable() {
public void run() {
addLostHostDialog = new AddLostHostDialog(new Shell(),lostHosts);
returnCode = addLostHostDialog.open();
if(Window.OK == returnCode){
ProgressMonitorDialog dialog = new ProgressMonitorDialog(new Shell());
try {
dialog.run(true, true, new IRunnableWithProgress(){
public void run(IProgressMonitor monitor) {
if(currentRoot instanceof VMTreeObjectHost){
try{
Pool.getAll(currentRoot.getConnection()).iterator().next()
.setNameLabel(currentRoot.getConnection(), "new pool");
}catch(Exception e){
e.printStackTrace();
}
}
for(VMTreeObjectHost lostHost : addLostHostDialog.lostHosts){
try{
Connection c = new Connection("http://"+lostHost.getIpAddress()+":9363"
,lostHost.getUsername(),lostHost.getPassword());
Pool.join(c, currentRoot.getIpAddress(), currentRoot.getUsername(), currentRoot.getPassword());
}catch(Exception e){
e.printStackTrace();
}
}
VMTreeObjectRoot root = AddServerUtil.ConnectByIp(currentRoot.getIpAddress(), currentRoot.getUsername(), currentRoot.getPassword());
if(root!=null){
currentRoot = root;
}
monitor.done();
}
});
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
};
display.syncExec(runnable);
}
}
// List<VMTreeObjectVM> historyVMs = previousRoot.historyVMs;
// currentUuids.clear();
// for(VMTreeObjectVM VMO:currentRoot.vmMap.values()){
// if(VMO.getUuid()!=null)
// currentUuids.add(VMO.getUuid());
// }
// if(historyVMs!=null){
// for(VMTreeObjectVM vm:historyVMs){
// if(vm.getUuid()!=null&&!currentUuids.contains(vm.getUuid())){
// lostVMs.add(vm);
// }
// }
// }
//
// if(lostVMs.size()>0){
// Display display = PlatformUI.getWorkbench().getDisplay();
// if (!display.isDisposed()) {
// Runnable runnable = new Runnable() {
// public void run() {
// showLostVMDialog = new ShowLostVMDialog(new Shell(),lostVMs);
// showLostVMDialog.open();
// }
// };
// display.syncExec(runnable);
// }
//
// }
Constants.CONNECTIONS_TREE.addChild(currentRoot);
}
}
| [
"[email protected]"
] | |
e7dcadd7e039b0a2f5fe547fa8214768bd0be55d | 420d18f501196d626d3d945bc8aaa06a5993f408 | /app/src/main/java/util/board/PointCluster.java | 40d7cb459e616324bc6caaf89c627d838d24ecfa | [] | no_license | asaf11108/Motorsequence | 3cd5bd131f058b305218b16bf3e3b5edcb77bea6 | ec9116a079d5f6f7b0b39ca64e74e588e7485ddb | refs/heads/master | 2021-01-01T18:25:45.724127 | 2018-05-31T07:03:35 | 2018-05-31T07:03:35 | 98,336,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | package util.board;
import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
/**
* Created by ASAF on 23/9/2017.
*/
public class PointCluster {
public static final int COLOR_RED = Color.RED;
public static final int COLOR_DARK_RED = Color.rgb(139, 0, 0);
public static final int COLOR_DEFULT = COLOR_DARK_RED;
public static final int POINT_CLUSTERS_SIZE = 4;
private final TextView pointName;
private final PointCircle pointCircle;
private int posX;
private int posY;
public PointCluster(Context context, RelativeLayout relativeLayout, String name, int cx, int cy) {
this.posX = cx + PointCircle.POINT_RADIUS;
this.posY = cy + PointCircle.POINT_RADIUS;
pointName = new TextView(context);
pointName.setText(name);
pointName.setTextColor(COLOR_DEFULT);
pointName.measure(0, 0);
RelativeLayout.LayoutParams paramLayout = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
paramLayout.leftMargin = cx + PointCircle.POINT_RADIUS - pointName.getMeasuredWidth()/2;
paramLayout.topMargin = cy - PointCircle.POINT_RADIUS;
relativeLayout.addView(pointName, paramLayout);
pointCircle = new PointCircle(context, PointCircle.POINT_RADIUS,
PointCircle.POINT_RADIUS);
paramLayout = new RelativeLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
paramLayout.leftMargin = cx;
paramLayout.topMargin = cy;
relativeLayout.addView(pointCircle, paramLayout);
}
public int getCx() {
return posX;
}
public int getCy() {
return posY;
}
public void setClusterColor(int circleColor)
{
pointName.setTextColor(circleColor);
pointCircle.setCircleColor(circleColor);
}
}
| [
"[email protected]"
] | |
bea51adcb1ee2e17c452fe3ca9e1f7ae6b25f389 | f17aa10d9448057f4dabb6c0aa7a3c7676875e65 | /src/main/java/hello/hellospring/controller/MemberController.java | 932e1d66510adc1bff74ca3772cb2f487bfd83fc | [] | no_license | irostub/learn-spring-framework | 632486241a3074561ad3f33f137bd7b6fd847430 | 730c8a9d837f353a132467badf5710e36d0047e8 | refs/heads/master | 2023-03-11T22:50:55.171433 | 2021-03-01T16:31:33 | 2021-03-01T16:31:33 | 330,069,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,272 | java | package hello.hellospring.controller;
import hello.hellospring.domain.Member;
import hello.hellospring.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@Controller
public class MemberController {
private final MemberService memberService;
@Autowired
public MemberController(MemberService memberService) {
this.memberService = memberService;
}
@GetMapping("/members/new")
public String createForm() {
return "members/createMemberForm";
}
@PostMapping("/members/new")
public String create(MemberForm form) {
Member member = new Member();
member.setName(form.getName());
System.out.println("member.getName() = " + member.getName());
memberService.join(member);
return "redirect:/";
}
@GetMapping("/members")
public String list(Model model) {
List<Member> members = memberService.findMembers();
model.addAttribute("members", members);
return "members/memberList";
}
}
| [
"[email protected]"
] | |
d5dd63d5d7785e10545e5bba595cd6a0db742e9b | e651bb2895f65b660b921160e429bb70b9124e16 | /src/oarlib/metrics/NumLinksMetric.java | 3729d7a422b39c76ea8440dcec201e00fa66b03b | [
"MIT"
] | permissive | ferterrazas/ArcRoutingLibrary | 092d904a2cb42134755a0ebac5bf62b013894c40 | db407dfa776977fd0ecede430c9d8f57efdf78cf | refs/heads/master | 2020-07-08T23:20:27.742481 | 2019-02-10T19:24:24 | 2019-02-10T19:24:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,823 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2013-2016 Oliver Lum
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
package oarlib.metrics;
import oarlib.core.Graph;
import oarlib.core.Link;
import oarlib.core.Route;
import oarlib.core.Vertex;
import java.util.Collection;
/**
* Created by oliverlum on 1/18/15.
*/
public class NumLinksMetric extends Metric {
private Graph mGraph;
public NumLinksMetric(Graph g) {
mGraph = g;
}
@Override
public <V extends Vertex, E extends Link<V>> double evaluate(Collection<? extends Route> routes) {
return mGraph.getEdges().size();
}
@Override
public Type getType() {
return Type.M;
}
@Override
public String toString() {
return "Num Links in Graph (M)";
}
}
| [
"[email protected]"
] | |
c08766f91d56805352a97ba3ceaf7c27a78ef7af | 334a8dd729f29c6ca65563edf0eb2f04aff17629 | /step5/app/src/main/java/edu/msu/bhushanj/cloudhatter/ColorSelectActivity.java | 0669a27afb6b37cb781d865eb746953ca271014a | [] | no_license | Ibair2/CSE-476 | 53e7d27126cbeabe4cd7f5398f068c1a17e71b6d | 4d408a3b41fdc484428eb87bd35a696c4c105b7b | refs/heads/master | 2020-03-30T22:24:13.509503 | 2017-01-26T12:19:55 | 2017-01-26T12:19:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,449 | java | package edu.msu.bhushanj.cloudhatter;
import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class ColorSelectActivity extends ActionBarActivity {
public static final String COLOR = "COLOR";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_color_select);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_color_select, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void selectColor(int color) {
Intent result = new Intent();
result.putExtra(COLOR, color);
setResult(Activity.RESULT_OK, result);
finish();
}
}
| [
"[email protected]"
] | |
e14e3f55b336894558dff73d3f5dd7a650d50541 | e88489010d621262a9a9f54617ab4c0d70f81cdb | /app/src/main/java/com/example/project_final/Admin/AdminCheckNewProductsActivity.java | 8da5bf5f5eaa7563481ada2d60a307c73e96169c | [] | no_license | SalmanMani86/Project | c9c0f502ed3ea13c15c5cab617ac7dd5e35cf158 | 10f425ba033be5a7f8d661ac453e454041907c9c | refs/heads/master | 2023-03-09T02:42:34.452144 | 2021-02-10T17:05:14 | 2021-02-10T17:05:14 | 331,020,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,355 | java | package com.example.project_final.Admin;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.example.project_final.Interface.ItemClickListner;
import com.example.project_final.Model.Products;
import com.example.project_final.R;
import com.example.project_final.ViewHolder.ProductViewHolder;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.squareup.picasso.Picasso;
public class AdminCheckNewProductsActivity extends AppCompatActivity {
private RecyclerView recyclerView;
RecyclerView.LayoutManager layoutManager;
private DatabaseReference unverifiedProductsRef;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_check_new_products);
recyclerView=findViewById(R.id.admin_products_checklist);
recyclerView.setHasFixedSize(true);
layoutManager=new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
unverifiedProductsRef = FirebaseDatabase.getInstance().getReference().child("Products");
}
@Override
protected void onStart() {
super.onStart();
FirebaseRecyclerOptions<Products> options =
new FirebaseRecyclerOptions.Builder<Products>()
.setQuery(unverifiedProductsRef.orderByChild("productState").equalTo("Not Approved"),Products.class)
.build();
FirebaseRecyclerAdapter<Products, ProductViewHolder> adapter=
new FirebaseRecyclerAdapter<Products,ProductViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull ProductViewHolder holder, int position, @NonNull Products model) {
holder.txtProductName.setText(model.getPname());
holder.txtProductDescription.setText(model.getDescription());
holder.txtProductPrice.setText("Price = " + model.getPrice() + "$");
Picasso.get().load(model.getImage()).into(holder.imageView);
final Products itemClick = model;
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String productID=model.getPid();
CharSequence options[]=new CharSequence[]
{
"Yes",
"No"
};
AlertDialog.Builder builder=new AlertDialog.Builder(AdminCheckNewProductsActivity.this);
builder.setTitle("Do you want to Approve This Product, Are you Sure?");
builder.setItems(options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int position) {
if(position==0){
ChangeProductState(productID);
}
if(position==1){
}
}
});
builder.show();
}
});
}
@NonNull
@Override
public ProductViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.product_items_layout, parent, false);
ProductViewHolder holder = new ProductViewHolder(view);
return holder;
}
};
recyclerView.setAdapter(adapter);
adapter.startListening();
}
private void ChangeProductState(String productID) {
unverifiedProductsRef.child(productID).child("productState").setValue("Approved")
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(AdminCheckNewProductsActivity.this, "That item Has been Approved and it is now available for Sale From the Seller", Toast.LENGTH_SHORT).show();
}
});
}
} | [
"[email protected]"
] | |
0ccc5c395f7d7bc39e655e497c9bae6f9dbff862 | 04e80a25d4cb0d783434d056ca2b6b37bf8c5729 | /CreditoGrupalUtilitario/src/main/java/utilitario/mensajes/originacion/aprobacion/PlanillaAprobacionRespuesta.java | 449cbd8eef2211988c61081f9c075ca0faef78c1 | [] | no_license | FyGIntegracionContinua/CIOFF | bfbd2040de503bacc44e376899bddcd4e3db9fd6 | 20c63dbc01fea60a426ebd49227efb7b8c413567 | refs/heads/master | 2021-01-15T11:03:31.184075 | 2017-08-18T20:12:05 | 2017-08-18T20:12:05 | 99,607,645 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | /**
*
*/
package utilitario.mensajes.originacion.aprobacion;
import utilitario.mensajes.comun.EncabezadoRespuesta;
import utilitario.mensajes.comun.ObjetoValor;
/**
* The Class PlanillaAprobacionRespuesta.
*
* @author out_oarias
*/
public class PlanillaAprobacionRespuesta extends ObjetoValor {
/**
* Instancia una nueva planilla aprobacion respuesta.
*/
public PlanillaAprobacionRespuesta() {
}
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The encabezado. */
private EncabezadoRespuesta encabezado;
/** The ofs. */
private String ofs;
/**
* Obtiene encabezado.
*
* @return the encabezado
*/
public EncabezadoRespuesta getEncabezado() {
return encabezado;
}
/**
* Establece encabezado.
*
* @param encabezado the encabezado to set
*/
public void setEncabezado(EncabezadoRespuesta encabezado) {
this.encabezado = encabezado;
}
/**
* Obtiene ofs.
*
* @return the ofs
*/
public String getOfs() {
return ofs;
}
/**
* Establece ofs.
*
* @param ofs the ofs to set
*/
public void setOfs(String ofs) {
this.ofs = ofs;
}
}
| [
"[email protected]"
] | |
41689d8c10a2f59313d1572f65580c191d707a46 | 2c2a411e3dee7c73d14627adcf2a215b81ce84d6 | /GeneticAlgorithms/src/GAFrame/Fitness.java | 7faf5f135bb968808f3c1898174482435ab6558d | [] | no_license | SummerShoohaw/INFO6205_202 | 9652b2ff43c07de013f1b9d09ae02a9da27ffec9 | 7ae31717fb46f24ed56820ae5800a7044a9e0196 | refs/heads/master | 2020-04-07T22:47:01.128792 | 2018-12-10T06:05:10 | 2018-12-10T06:05:10 | 158,784,679 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 76 | java | package GAFrame;
public abstract class Fitness implements Comparable {
}
| [
"[email protected]"
] | |
f351507de649882a2961226c4f092de0aea91685 | 4acdd67dfb358496c2398c3f70877a024cc507eb | /src/main/java/com/devil/domain/Bdg_eva.java | d48c282e6a34ac39f6f046676c9988660ed9e5ef | [] | no_license | procompiler/developer-village-admin | 96fddeb06b3856783e67ddf15b1fe9000862c346 | 12180df0a56c8e81a44fc8e8caf4d17dc5ac1680 | refs/heads/main | 2023-01-29T17:04:12.584158 | 2020-12-13T17:21:53 | 2020-12-13T17:21:53 | 321,115,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.devil.domain;
public class Bdg_eva {
private int beno;
private String bename;
public int getBeno() {
return beno;
}
public Bdg_eva setBeno(int beno) {
this.beno = beno;
return this;
}
public String getBename() {
return bename;
}
public Bdg_eva setBename(String bename) {
this.bename = bename;
return this;
}
}
| [
"[email protected]"
] | |
8ef68f28a1d312307d2771065de0a946521eb745 | 51445fa461b696c34d35ef9849f84e4c6a8da332 | /src/main/java/com/by/blcu/core/authentication/JWTFilter.java | 54f57aa5c2fd07aaa36b821a891c64885e1bea25 | [] | no_license | hanxiaochuang666/fxl | f540a4539875ab0ab6bdddd688a237adf7560af0 | 7382e756c237fda8de67015effb028feddfbbc0c | refs/heads/master | 2023-02-26T20:22:47.998630 | 2022-06-21T05:50:46 | 2022-06-21T05:50:46 | 200,995,419 | 0 | 1 | null | 2023-02-22T08:14:43 | 2019-08-07T07:20:41 | Java | UTF-8 | Java | false | false | 4,539 | java | package com.by.blcu.core.authentication;
import com.by.blcu.core.configurer.ShiroConfigurer;
import com.by.blcu.core.utils.ApplicationUtils;
import com.by.blcu.core.utils.SpringContextUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.UnauthorizedException;
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;
import org.springframework.http.HttpStatus;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@Slf4j
public class JWTFilter extends BasicHttpAuthenticationFilter {
public static final String TOKEN = "Authentication";
private AntPathMatcher pathMatcher = new AntPathMatcher();
@Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws UnauthorizedException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
ShiroConfigurer shiroProperties = SpringContextUtil.getBean(ShiroConfigurer.class);
String[] anonUrl = StringUtils.splitByWholeSeparatorPreserveAllTokens(shiroProperties.getAnonUrl(), ",");
boolean match = false;
for (String u : anonUrl) {
if (pathMatcher.match(u, httpServletRequest.getRequestURI()))
match = true;
}
if (match) return true;
if (isLoginAttempt(request, response)) {
return executeLogin(request, response);
}
return false;
}
@Override
protected boolean isLoginAttempt(ServletRequest request, ServletResponse response) {
HttpServletRequest req = (HttpServletRequest) request;
String token = req.getHeader(TOKEN);
return token != null;
}
@Override
protected boolean executeLogin(ServletRequest request, ServletResponse response) {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
String token = httpServletRequest.getHeader(TOKEN);
//token 二次解密
JWTToken jwtToken = new JWTToken(ApplicationUtils.decryptToken(token));
try {
getSubject(request, response).login(jwtToken);
return true;
} catch (Exception e) {
log.error(e.getMessage());
return false;
}
}
/**
* 对跨域提供支持
*/
@Override
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin"));
httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE");
httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers"));
httpServletResponse.setHeader("Access-Control-Allow-Credentials", "true");
// 跨域时会首先发送一个 option请求,这里我们给 option请求直接返回正常状态
if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {
httpServletResponse.setStatus(HttpStatus.OK.value());
return false;
}
return super.preHandle(request, response);
}
@Override
protected boolean sendChallenge(ServletRequest request, ServletResponse response) {
log.debug("Authentication required: sending 401 Authentication challenge response.");
HttpServletResponse httpResponse = WebUtils.toHttp(response);
httpResponse.setStatus(HttpStatus.UNAUTHORIZED.value());
httpResponse.setCharacterEncoding("utf-8");
httpResponse.setContentType("application/json; charset=utf-8");
final String message = "未认证,请在前端系统进行认证";
try (PrintWriter out = httpResponse.getWriter()) {
String responseJson = "{\"message\":\"" + message + "\"}";
out.print(responseJson);
} catch (IOException e) {
log.error("sendChallenge error:", e);
}
return false;
}
}
| [
"[email protected]"
] | |
178118d2638150d047398ccdedfed97ff655fa97 | 4a627a99cdf202019fa4088ca23316e9cc427e7b | /nyd-cash-pay/nyd-cash-pay-api/src/main/java/com/nyd/pay/api/enums/PayType.java | c3d9fcef09a77b034cc979bf0d01e201f92fbca9 | [] | no_license | P79N6A/zlqb | 4bdcc62db76f8b4fdd4176c06812c9bd8ac2148b | 66a8781e74216ead7ea4969d89972c16e9d45b54 | refs/heads/master | 2020-07-13T14:18:36.941485 | 2019-08-26T12:22:20 | 2019-08-26T12:22:20 | 205,096,175 | 0 | 1 | null | 2019-08-29T06:30:30 | 2019-08-29T06:30:30 | null | UTF-8 | Java | false | false | 122 | java | package com.nyd.pay.api.enums;
/**
* 支付类型
* Cong Yuxiang
* 2017/12/12
**/
public enum PayType {
}
| [
"hhh@d55a9f32-8471-450d-bba4-b89e090b5caa"
] | hhh@d55a9f32-8471-450d-bba4-b89e090b5caa |
90fea6e5321f5cc3eeb63e9dc2ed5ad43d7cb28c | 159a542bd6e519de16a053f10ab29bf6f3637ef9 | /MEIKCloud/meikcn/src/main/java/com/nuvomed/service/LicenseService.java | 1e72c8f8c49d8b3109aca4a0813ee2cf13b0a174 | [] | no_license | CampRay/MEIKCN | 8f1687f25aaac04574b600ecf00ef447b5775d71 | d6ff51d3a7e79586a0a1cb5fd90bb5f369366110 | refs/heads/master | 2022-12-23T10:28:59.385219 | 2021-10-26T14:59:32 | 2021-10-26T14:59:32 | 119,352,724 | 0 | 0 | null | 2022-12-16T04:02:54 | 2018-01-29T08:15:45 | C# | UTF-8 | Java | false | false | 584 | java | package com.nuvomed.service;
import com.nuvomed.dto.Tlicense;
import com.nuvomed.model.DataTableParamter;
import com.nuvomed.model.PagingData;
public interface LicenseService {
Tlicense getLicenseById(String license);
void createLicense(Tlicense license);
void updateLicense(Tlicense license);
void deleteLicense(Tlicense license);
void deleteLicenseById(String id);
void deleteLicenseByIds(String[] ids);
public PagingData loadLicenseList(DataTableParamter rdtp);
void activeLicenseByids(String[] ids);
void deactiveLicenseByids(String[] ids);
}
| [
"[email protected]"
] | |
a81a975c21ca27e9053da1cdd2d8e2c8750cae05 | 46bdf8f20ff5f62653c8cc7de7279ed2c3b28394 | /note/teacher/Java_Web/7-会话管理/day36_session/src/com/qianfeng/cookie/CookieServlet.java | e367e142bd54bce17d7a341499604cd7ca457598 | [
"MIT"
] | permissive | tony0511/java_note | 9ac86693347be019376bb8857af463262f3e7ebc | aa57b1384025f4aa4f65a7d31695efdf3002afa2 | refs/heads/master | 2023-03-06T14:01:30.681571 | 2020-03-07T04:51:05 | 2020-03-07T04:51:05 | 226,611,489 | 1 | 1 | MIT | 2023-02-22T06:49:06 | 2019-12-08T03:57:22 | HTML | UTF-8 | Java | false | false | 1,738 | java | package com.qianfeng.cookie;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class CookieServlet
*/
@WebServlet("/CookieServlet")
public class CookieServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public CookieServlet() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 创建 cookie 对象(注:cookie 数据不支持中文)
Cookie cookie = new Cookie("name", "zhangsan");
// 设置到期时间,单位秒
cookie.setMaxAge(60 * 60);
// 到期时间,设为负值,浏览器会话结束时
// cookie2.setMaxAge(-1);
// 设置路径,如果路径和应用的名字不同,不会自动发送某些 cookie,默认发送本应用下的 cookie 数据
// 路径设置为 / 后,相应站点下的任意 web 应用都可以共享某些 cookie
cookie.setPath("/");
// 将 cookie 发送给浏览器端
response.addCookie(cookie);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
5d3225b7cfce16b69bde72b982da448537628c25 | 04fe464ddd47420ad2c72a62ee017f4e2853af64 | /src/main/java/com/sigad/sigad/business/helpers/MapsHelper.java | a276a0443546852462c3e0b464bd27fa1916b0f3 | [
"WTFPL"
] | permissive | cfoch/SIGAD-business | d41ebf277419347d1f9fbb30c394492942d29141 | 049bd47e49db2488584e9ce253a73f255038c4a3 | refs/heads/master | 2020-03-14T20:51:28.772142 | 2018-07-03T21:13:05 | 2018-07-03T21:26:51 | 131,783,925 | 0 | 4 | WTFPL | 2018-07-03T20:11:37 | 2018-05-02T01:51:10 | Java | UTF-8 | Java | false | false | 3,460 | 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 com.sigad.sigad.business.helpers;
import com.google.maps.DistanceMatrixApi;
import com.google.maps.DistanceMatrixApiRequest;
import com.google.maps.GeoApiContext;
import com.google.maps.errors.ApiException;
import com.google.maps.model.DistanceMatrix;
import com.google.maps.model.LatLng;
import com.grupo1.simulated_annealing.Locacion;
import java.io.IOException;
/**
*
* @author cfoch
*/
public class MapsHelper {
private static final String API_KEY =
"AIzaSyBuwWY5-875b_CNPq45NX1id5BuVVItz0A";
private GeoApiContext context;
private MapsHelper() {
context = new GeoApiContext.Builder().apiKey(API_KEY).build();
}
public static String locacionToString(Locacion locacion) {
return String.format("%f,%f", locacion.getX(), locacion.getY());
}
public static String [] locacionesToArrayString(Locacion [] locaciones) {
String [] ret = new String[locaciones.length];
int i;
for (i = 0; i < locaciones.length; i++) {
ret[i] = locacionToString(locaciones[i]);
}
return ret;
}
public final LatLng locacionToLatLng(final Locacion locacion) {
LatLng st;
st = new LatLng(locacion.getX(), locacion.getY());
return st;
}
public final LatLng[] locacionesToArrayLatLng(
final Locacion [] locaciones) {
LatLng [] ret;
int i;
ret = new LatLng[locaciones.length];
for (i = 0; i < locaciones.length; i++) {
ret[i] = new LatLng(locaciones[i].getX(), locaciones[i].getY());
}
return ret;
}
public DistanceMatrix getDistanceMatrix(Locacion [] origins,
Locacion [] destinations) throws ApiException, InterruptedException, IOException {
LatLng [] originsLatLng;
LatLng [] destinationsLatLng;
DistanceMatrixApiRequest req;
DistanceMatrix matrix;
originsLatLng = locacionesToArrayLatLng(origins);
destinationsLatLng = locacionesToArrayLatLng(destinations);
req = DistanceMatrixApi.newRequest(context);
req = req.origins(originsLatLng).destinations(destinationsLatLng);
matrix = req.await();
return matrix;
}
public static double[][] distanceMatrixTo2DArray(
DistanceMatrix distanceMatrix, boolean average) {
int i, j;
double [][] ret = new double[distanceMatrix.rows.length][];
for (i = 0; i < distanceMatrix.rows.length; i++) {
ret[i] = new double[distanceMatrix.rows[i].elements.length];
for (j = 0; j < distanceMatrix.rows[i].elements.length; j++) {
double d1;
d1 = distanceMatrix.rows[i].elements[j].distance.inMeters;
if (!average) {
ret[i][j] = d1;
} else {
double d2;
d2 = distanceMatrix.rows[j].elements[i].distance.inMeters;
ret[i][j] = (d1 + d2) / 2;
}
}
}
return ret;
}
public static MapsHelper getInstance() {
return MapsHelperHolder.INSTANCE;
}
private static class MapsHelperHolder {
private static final MapsHelper INSTANCE = new MapsHelper();
}
}
| [
"[email protected]"
] | |
e7aac7d82361c229b16bd6f8202e9addf912e835 | 8b0ac3fab7cc61c098b2c2bd2936827f99bca448 | /RecalAppHibernate/src/entities/UsuarioEntity.java | 77bfa131666e7c93632829d68d1f7f65b1b92a39 | [] | no_license | AleArmengol/ReclamApp | 5294e94cae5ff8d152bd135632fa81a483ab6426 | e536a64e9cfa367917ff07abf36b190aa11e9e23 | refs/heads/master | 2021-07-07T14:41:55.926625 | 2020-11-09T03:14:00 | 2020-11-09T03:14:00 | 204,465,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package entities;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "usuarios")
public class UsuarioEntity {
@Id
private String idUsuario;
@OneToOne
@JoinColumn(name = "documento")
private PersonaEntity personaE;
private String clave;
public UsuarioEntity() {
}
public UsuarioEntity(String idUsuario, PersonaEntity personaE, String clave) {
this.idUsuario = idUsuario;
this.personaE = personaE;
this.clave = clave;
}
public String getIdUsuario() {
return idUsuario;
}
public void setIdUsuario(String idUsuario) {
this.idUsuario = idUsuario;
}
public PersonaEntity getPersonaE() {
return personaE;
}
public void setPersonaE(PersonaEntity personaE) {
this.personaE = personaE;
}
public String getClave() {
return clave;
}
public void setClave(String clave) {
this.clave = clave;
}
}
| [
"[email protected]"
] | |
3d12fadf5effc00e5573b51e1718174c2abaedd2 | c2974b1683a0e4c6640fd920a1eab314e12bf814 | /src/main/java/com/signore/timeplot/client/PlotInfo.java | 6b86b8c26ec204459af0a9ba2ce2af52e215be7b | [] | no_license | antoniosignore/gwt-simile-timeplot | aea4547902416fa5fc72250540a3232fea348c27 | 6f4be058123b26ac2332753723988ec6bc92e5b8 | refs/heads/master | 2020-05-17T19:39:47.509433 | 2015-01-17T18:21:40 | 2015-01-17T18:21:40 | 29,400,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package com.signore.timeplot.client;
/*
Copyright Antonio Signore ([email protected])
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import com.google.gwt.core.client.JavaScriptObject;
/**
* BandInfo
*
* @author [email protected]
*/
public class PlotInfo extends JavaScriptObject {
protected PlotInfo() {
super();
}
public static PlotInfo create(PlotOptions options) {
return PlotInfoImpl.create(options);
}
} | [
"[email protected]"
] | |
6224030881b4ba8210b8bfdfa648e1e138a1bda9 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/subapp/ui/openapi/ServiceAppUI$3.java | 60ad0697602c59bcffaacded7f4476c850f1a41f | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,635 | java | package com.tencent.mm.plugin.subapp.ui.openapi;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.g.c.s;
import com.tencent.mm.pluginsdk.model.app.f;
import com.tencent.mm.sdk.platformtools.ab;
final class ServiceAppUI$3
implements AdapterView.OnItemClickListener
{
ServiceAppUI$3(ServiceAppUI paramServiceAppUI)
{
}
public final void onItemClick(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong)
{
AppMethodBeat.i(25473);
if (ServiceAppUI.b(this.suP) == null)
{
ab.e("MicroMsg.ServiceAppUI", "biz onItemClick bizServicePref null");
AppMethodBeat.o(25473);
}
while (true)
{
return;
paramAdapterView = ServiceAppUI.b(this.suP).Fq(paramInt);
if (paramAdapterView == null)
{
ab.e("MicroMsg.ServiceAppUI", "biz onItemClick app is null");
AppMethodBeat.o(25473);
}
else
{
ab.i("MicroMsg.ServiceAppUI", "onItemClick, jumpType[%d], package[%s], appid[%s]", new Object[] { Integer.valueOf(paramAdapterView.dnv), paramAdapterView.field_packageName, paramAdapterView.field_appId });
ServiceAppUI.a(this.suP, paramAdapterView);
AppMethodBeat.o(25473);
}
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes7-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.subapp.ui.openapi.ServiceAppUI.3
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
c5a29dacbad60afaf4bedc5cda3a9691c8b8a908 | 446406cc9eacb1145b88efb29e22da44ae50b08d | /java/cn/xiewh/test/App.java | 08e3977ea17b5985c0710412d8f2b6c3055d14fe | [] | no_license | 504316589/test | 22788fc8e6b1e28711b57e089654627090e304a3 | dbb26d580eb472be9f83b91c45dd95d6354cd1d2 | refs/heads/master | 2021-07-06T18:31:21.380222 | 2019-07-10T09:56:16 | 2019-07-10T09:56:16 | 196,170,265 | 0 | 0 | null | 2020-10-13T14:29:26 | 2019-07-10T08:57:31 | Java | UTF-8 | Java | false | false | 156 | java | package cn.xiewh.test;
/**
* Hello world!
*
*/
public class App {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
| [
"[email protected]"
] | |
bf33d2a58d39b471ad97ac5c7d25747c941bd462 | 2f71385f877d8367ec9cd9320e7b32a7cb2c9171 | /hercules-partitioner/src/main/java/ru/kontur/vostok/hercules/partitioner/ShardingKey.java | e4f3237aa9504a8b355e8ffc2f38ff01c4559845 | [
"MIT"
] | permissive | Tsypaev/hercules | 863887eabc3dc55de43775ddb2d86fd1be309425 | 5610deeb56beb3183c63b8804568b44f47b3894d | refs/heads/master | 2020-05-15T11:46:15.876051 | 2019-04-22T11:37:47 | 2019-04-22T11:37:47 | 182,244,001 | 0 | 0 | MIT | 2019-04-19T09:58:45 | 2019-04-19T09:58:45 | null | UTF-8 | Java | false | false | 1,359 | java | package ru.kontur.vostok.hercules.partitioner;
/**
* @author Gregory Koshelev
*/
public class ShardingKey {
private static final ShardingKey EMPTY = new ShardingKey(new String[0][]);
private final String[][] keys;
private ShardingKey(String[][] keys) {
this.keys = keys;
}
public static ShardingKey fromKeyPaths(String... keyPaths) {
if (keyPaths == null || keyPaths.length == 0) {
return empty();
}
int size = keyPaths.length;
String[][] keys = new String[size][];
for (int i = 0; i < size; i++) {
keys[i] = keyPaths[i].split("\\.");
}
return new ShardingKey(keys);
}
public static ShardingKey fromTag(String tag) {
return new ShardingKey(new String[][]{{tag}});
}
public static ShardingKey fromTags(String[] tags) {
if (tags == null || tags.length == 0) {
return empty();
}
int size = tags.length;
String[][] keys = new String[size][1];
for (int i = 0; i < size; i++) {
keys[i][0] = tags[i];
}
return new ShardingKey(keys);
}
public static ShardingKey empty() {
return EMPTY;
}
public boolean isEmpty() {
return this == EMPTY;
}
public String[][] getKeys() {
return keys;
}
}
| [
"[email protected]"
] | |
dc2bc78ed8e1fe7cfbf8fc122a616f8fb219f118 | 83956fd4dc31e5c8c5623d9aad16899d84976c8a | /src/main/java/com/gdky/graduation/wx/dao/impl/OrderDaoImpl.java | af3d5b7f075995f8b6f341e593e8329e307137a8 | [] | no_license | zhenfeii/graduation | a5c0015871148e5220bb940163bde22dafb35489 | cf51a444063190098a4c559e7b8a45f0677f20ba | refs/heads/master | 2021-04-09T11:29:09.098343 | 2018-04-24T22:50:58 | 2018-04-24T22:50:58 | 125,448,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,905 | java | package com.gdky.graduation.wx.dao.impl;
import com.gdky.graduation.wx.dao.OrderDao;
import com.gdky.graduation.utils.TimeConverterUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by Administrator on 2018/3/12 0012.
*/
@Repository
public class OrderDaoImpl implements OrderDao {
//设置日期格式
final static SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Resource
private JdbcTemplate jdbcTemplate;
@Override
public void addOrder(Map<String, Object> params) {
String uuid = (String) params.get("uuid");
String username = (String) params.get("username");
String useravatar = (String) params.get("useravatar");
String openid = (String) params.get("openid");
Integer sellerid = Integer.parseInt(params.get("sellerid").toString());
String deliveryPrice = (String) params.get("deliveryPrice");
String totalPrice = params.get("totalPrice").toString();
//在order表新增一条数据
//order 是系统关键字,必须要用``
String orderSql = "INSERT INTO `order`(UUID,USERNAME,USERAVATAR,OPENID,SELLERID,DELIVERYPRICE,TOTALPRICE) " +
"VALUES(?,?,?,?,?,?,?)";
jdbcTemplate.update(orderSql, new Object[]{uuid, username, useravatar, openid, sellerid, deliveryPrice, totalPrice});
//处理购物车字符串
String cartArrayString = (String) params.get("cartArrayString");
JSONArray jsonArray = new JSONArray(cartArrayString);
jsonArray.get(0);
//遍历jsonArray数组
for (int i = 0; i < jsonArray.length(); i++) {
Object object = jsonArray.get(i);
object.toString();
String foodName = (String) ((JSONObject) object).opt("name");
String num = (String) ((JSONObject) object).opt("num").toString();
String price = (String) ((JSONObject) object).opt("price").toString();
//把订单食物详情新增到order_food数据表
jdbcTemplate.update("INSERT INTO `order_food`(UUID, FOODNAME, FOODNUM, PRICE) VALUES(?,?,?,?)",
new Object[]{uuid, foodName, num, price});
}
}
@Override
public List<Map<String, Object>> getOrderBySellerId(Integer sellerId) {
List<Map<String, Object>> orderList = new ArrayList<>();
String sql = "SELECT * FROM `order` WHERE SELLERID=?";
jdbcTemplate.query(sql, new Object[]{sellerId}, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
Map<String, Object> map = new HashMap<>();
//灵感: jdbcTemplate.queryForList 嫌弃它取字段是数据库的大写,
// 但mysql在查询的时候就支持改变列名的功能
map.put("uuid", rs.getString("UUID"));
map.put("username", rs.getString("USERNAME"));
map.put("totalprice", rs.getString("TOTALPRICE"));
map.put("createtime", rs.getString("CREATE_TIME"));
orderList.add(map);
}
});
return orderList;
}
@Override
public void deleteOrderById(Integer orderId) {
String sql = "DELETE FROM `order` WHERE id=?";
jdbcTemplate.update(sql, new Object[]{orderId});
}
@Override
public List<Map<String, Object>> getOrderFoodByUuid(String uuid) {
List<Map<String, Object>> resultList = new ArrayList<>();
String sql = "SELECT FOODNAME foodname,FOODNUM foodnum,PRICE price from order_food where UUID=?";
resultList = jdbcTemplate.queryForList(sql, new Object[]{uuid});
return resultList;
}
@Override
public void editOrder(Map<String, Object> map) {
String sql = "UPDATE order_food SET FOODNUM=?,PRICE=? WHERE UUID=? AND FOODNAME=?";
String uuid = map.get("uuid").toString();
//解析还原前台传来的food数组字符串
String foodArrayString = map.get("foodArrayString").toString();
JSONArray foodjsonArray = new JSONArray(foodArrayString);
float totalPrice = 0;
//遍历josn数组
for (int j = 0; j < foodjsonArray.length(); j++) {
JSONObject foodObject = foodjsonArray.getJSONObject(j);
String foodname = foodObject.opt("foodname").toString();
String foodnum = foodObject.opt("foodnum").toString();
String price = foodObject.opt("price").toString();
//计算总价钱
// string 转 float
totalPrice = totalPrice + Float.parseFloat(price) * Float.parseFloat(foodnum);
jdbcTemplate.update(sql, new Object[]{foodnum, price, uuid, foodname});
}
//把数据表的订单总价格也要修改
String totalPriceSql = "UPDATE `order` SET TOTALPRICE=? WHERE uuid=?";
//float 转 string
jdbcTemplate.update(totalPriceSql, new Object[]{String.valueOf(totalPrice), uuid});
}
@Override
public List<Map<String, Object>> getOrderByCondition(Map<String, Object> params) {
String initSql = "SELECT UUID uuid,USERNAME username,TOTALPRICE totalprice,CREATE_TIME createtime " +
"FROM `order` " +
"WHERE SELLERID=1";
StringBuffer sql = new StringBuffer(initSql);
List<Object> args = new ArrayList<Object>();
String lastSql = rebuildSqlByCondition(sql, params,args);
//小记,必须是args.toArray()
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(lastSql, args.toArray());
return resultList;
}
@Override
public List<Map<String, Object>> getOrderByOpenId(String opendId) {
List<Map<String, Object>> orderList = new ArrayList<>();
String sql = "SELECT UUID uuid,SELLERID sellerid,CREATE_TIME createtime,TOTALPRICE totalprice FROM `order` WHERE OPENID=?";
jdbcTemplate.query(sql, new Object[]{opendId}, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
//自封装数据集
Map<String,Object> map = new HashMap<>();
map.put("uuid",rs.getString("uuid"));
map.put("createtime",df.format(rs.getTimestamp("createtime")));
map.put("totalprice",rs.getString("totalprice"));
Integer sellerId = rs.getInt("sellerid");
final String[] name = {null};
//根据sellerId 找出 商家名称
jdbcTemplate.query("SELECT name from seller WHERE id=?", new Object[]{sellerId}, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
name[0] = rs.getString("name");
}
});
map.put("name",name[0]);
orderList.add(map);
}
});
return orderList;
}
@Override
public void deleteOrderByUuid(Map<String, Object> map) {
String uuid = map.get("uuid").toString();
String sql = "DELETE FROM `order` WHERE UUID=?";
jdbcTemplate.update(sql,new Object[]{uuid});
}
private String rebuildSqlByCondition(StringBuffer sql, Map<String, Object> params,List<Object> args) {
//根据查询条件,变化sql
String uuid = params.get("uuid").toString();
String username = params.get("username").toString();
String timeSUIC = params.get("timeS").toString();
String timeEUTC = params.get("timeE").toString();
//将UTC时间转北京时间
String timeS = TimeConverterUtil.utcTolocal(timeSUIC);
String timeE = TimeConverterUtil.utcTolocal(timeEUTC);
if (params.size() != 0) {
if (uuid != null && !"".equals(uuid)) {
sql.append(" and UUID like ? ");
args.add("%"+uuid+"%");
}
}
if (params.size() != 0) {
if (username != null && !"".equals(username)) {
sql.append(" and USERNAME like ? ");
args.add("%" + username + "%");
}
}
if (timeS != null) {
sql.append(" and CREATE_TIME>=? ");
args.add(timeS);
}
if (timeE != null) {
sql.append(" and CREATE_TIME>=? ");
args.add(timeE);
}
return sql.toString();
}
}
| [
"[email protected]"
] | |
1cae55043a9d228302359fb06fd949c2c214fca9 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/ExoPlayer/2018/12/CachedContentIndexTest.java | 6080f6eccd159a0c7570bf99036b12e3c11065f5 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 11,484 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer2.upstream.cache;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import android.net.Uri;
import android.util.SparseArray;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.Util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
/** Tests {@link CachedContentIndex}. */
@RunWith(RobolectricTestRunner.class)
public class CachedContentIndexTest {
private final byte[] testIndexV1File = {
0, 0, 0, 1, // version
0, 0, 0, 0, // flags
0, 0, 0, 2, // number_of_CachedContent
0, 0, 0, 5, // cache_id 5
0, 5, 65, 66, 67, 68, 69, // cache_key "ABCDE"
0, 0, 0, 0, 0, 0, 0, 10, // original_content_length
0, 0, 0, 2, // cache_id 2
0, 5, 75, 76, 77, 78, 79, // cache_key "KLMNO"
0, 0, 0, 0, 0, 0, 10, 0, // original_content_length
(byte) 0xF6, (byte) 0xFB, 0x50, 0x41 // hashcode_of_CachedContent_array
};
private final byte[] testIndexV2File = {
0, 0, 0, 2, // version
0, 0, 0, 0, // flags
0, 0, 0, 2, // number_of_CachedContent
0, 0, 0, 5, // cache_id 5
0, 5, 65, 66, 67, 68, 69, // cache_key "ABCDE"
0, 0, 0, 2, // metadata count
0, 9, 101, 120, 111, 95, 114, 101, 100, 105, 114, // "exo_redir"
0, 0, 0, 5, // value length
97, 98, 99, 100, 101, // Redirected Uri "abcde"
0, 7, 101, 120, 111, 95, 108, 101, 110, // "exo_len"
0, 0, 0, 8, // value length
0, 0, 0, 0, 0, 0, 0, 10, // original_content_length
0, 0, 0, 2, // cache_id 2
0, 5, 75, 76, 77, 78, 79, // cache_key "KLMNO"
0, 0, 0, 1, // metadata count
0, 7, 101, 120, 111, 95, 108, 101, 110, // "exo_len"
0, 0, 0, 8, // value length
0, 0, 0, 0, 0, 0, 10, 0, // original_content_length
0x12, 0x15, 0x66, (byte) 0x8A // hashcode_of_CachedContent_array
};
private CachedContentIndex index;
private File cacheDir;
@Before
public void setUp() throws Exception {
cacheDir =
Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
index = new CachedContentIndex(cacheDir);
}
@After
public void tearDown() {
Util.recursiveDelete(cacheDir);
}
@Test
public void testAddGetRemove() throws Exception {
final String key1 = "key1";
final String key2 = "key2";
final String key3 = "key3";
// Add two CachedContents with add methods
CachedContent cachedContent1 = index.getOrAdd(key1);
CachedContent cachedContent2 = index.getOrAdd(key2);
assertThat(cachedContent1.id != cachedContent2.id).isTrue();
// add a span
File cacheSpanFile =
SimpleCacheSpanTest.createCacheSpanFile(cacheDir, cachedContent1.id, 10, 20, 30);
SimpleCacheSpan span = SimpleCacheSpan.createCacheEntry(cacheSpanFile, index);
assertThat(span).isNotNull();
cachedContent1.addSpan(span);
// Check if they are added and get method returns null if the key isn't found
assertThat(index.get(key1)).isEqualTo(cachedContent1);
assertThat(index.get(key2)).isEqualTo(cachedContent2);
assertThat(index.get(key3)).isNull();
// test getAll()
Collection<CachedContent> cachedContents = index.getAll();
assertThat(cachedContents).containsExactly(cachedContent1, cachedContent2);
// test getKeys()
Set<String> keys = index.getKeys();
assertThat(keys).containsExactly(key1, key2);
// test getKeyForId()
assertThat(index.getKeyForId(cachedContent1.id)).isEqualTo(key1);
assertThat(index.getKeyForId(cachedContent2.id)).isEqualTo(key2);
// test remove()
index.maybeRemove(key2);
index.maybeRemove(key3);
assertThat(index.get(key1)).isEqualTo(cachedContent1);
assertThat(index.get(key2)).isNull();
assertThat(cacheSpanFile.exists()).isTrue();
// test removeEmpty()
index.getOrAdd(key2);
index.removeEmpty();
assertThat(index.get(key1)).isEqualTo(cachedContent1);
assertThat(index.get(key2)).isNull();
assertThat(cacheSpanFile.exists()).isTrue();
}
@Test
public void testStoreAndLoad() throws Exception {
assertStoredAndLoadedEqual(index, new CachedContentIndex(cacheDir));
}
@Test
public void testLoadV1() throws Exception {
FileOutputStream fos = new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME));
fos.write(testIndexV1File);
fos.close();
index.load();
assertThat(index.getAll()).hasSize(2);
assertThat(index.assignIdForKey("ABCDE")).isEqualTo(5);
ContentMetadata metadata = index.get("ABCDE").getMetadata();
assertThat(ContentMetadataInternal.getContentLength(metadata)).isEqualTo(10);
assertThat(index.assignIdForKey("KLMNO")).isEqualTo(2);
ContentMetadata metadata2 = index.get("KLMNO").getMetadata();
assertThat(ContentMetadataInternal.getContentLength(metadata2)).isEqualTo(2560);
}
@Test
public void testLoadV2() throws Exception {
FileOutputStream fos = new FileOutputStream(new File(cacheDir, CachedContentIndex.FILE_NAME));
fos.write(testIndexV2File);
fos.close();
index.load();
assertThat(index.getAll()).hasSize(2);
assertThat(index.assignIdForKey("ABCDE")).isEqualTo(5);
ContentMetadata metadata = index.get("ABCDE").getMetadata();
assertThat(ContentMetadataInternal.getContentLength(metadata)).isEqualTo(10);
assertThat(ContentMetadataInternal.getRedirectedUri(metadata)).isEqualTo(Uri.parse("abcde"));
assertThat(index.assignIdForKey("KLMNO")).isEqualTo(2);
ContentMetadata metadata2 = index.get("KLMNO").getMetadata();
assertThat(ContentMetadataInternal.getContentLength(metadata2)).isEqualTo(2560);
}
@Test
public void testAssignIdForKeyAndGetKeyForId() {
final String key1 = "key1";
final String key2 = "key2";
int id1 = index.assignIdForKey(key1);
int id2 = index.assignIdForKey(key2);
assertThat(index.getKeyForId(id1)).isEqualTo(key1);
assertThat(index.getKeyForId(id2)).isEqualTo(key2);
assertThat(id1 != id2).isTrue();
assertThat(index.assignIdForKey(key1)).isEqualTo(id1);
assertThat(index.assignIdForKey(key2)).isEqualTo(id2);
}
@Test
public void testGetNewId() {
SparseArray<String> idToKey = new SparseArray<>();
assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0);
idToKey.put(10, "");
assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(11);
idToKey.put(Integer.MAX_VALUE, "");
assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0);
idToKey.put(0, "");
assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(1);
}
@Test
public void testEncryption() throws Exception {
byte[] key = "Bar12345Bar12345".getBytes(C.UTF8_NAME); // 128 bit key
byte[] key2 = "Foo12345Foo12345".getBytes(C.UTF8_NAME); // 128 bit key
assertStoredAndLoadedEqual(
new CachedContentIndex(cacheDir, key), new CachedContentIndex(cacheDir, key));
// Rename the index file from the test above
File file1 = new File(cacheDir, CachedContentIndex.FILE_NAME);
File file2 = new File(cacheDir, "file2compare");
assertThat(file1.renameTo(file2)).isTrue();
// Write a new index file
assertStoredAndLoadedEqual(
new CachedContentIndex(cacheDir, key), new CachedContentIndex(cacheDir, key));
assertThat(file1.length()).isEqualTo(file2.length());
// Assert file content is different
FileInputStream fis1 = new FileInputStream(file1);
FileInputStream fis2 = new FileInputStream(file2);
for (int b; (b = fis1.read()) == fis2.read(); ) {
assertThat(b != -1).isTrue();
}
boolean threw = false;
try {
assertStoredAndLoadedEqual(
new CachedContentIndex(cacheDir, key), new CachedContentIndex(cacheDir, key2));
} catch (AssertionError e) {
threw = true;
}
assertWithMessage("Encrypted index file can not be read with different encryption key")
.that(threw)
.isTrue();
try {
assertStoredAndLoadedEqual(
new CachedContentIndex(cacheDir, key), new CachedContentIndex(cacheDir));
} catch (AssertionError e) {
threw = true;
}
assertWithMessage("Encrypted index file can not be read without encryption key")
.that(threw)
.isTrue();
// Non encrypted index file can be read even when encryption key provided.
assertStoredAndLoadedEqual(
new CachedContentIndex(cacheDir), new CachedContentIndex(cacheDir, key));
// Test multiple store() calls
CachedContentIndex index = new CachedContentIndex(cacheDir, key);
index.getOrAdd("key3");
index.store();
assertStoredAndLoadedEqual(index, new CachedContentIndex(cacheDir, key));
}
@Test
public void testRemoveEmptyNotLockedCachedContent() {
CachedContent cachedContent = index.getOrAdd("key1");
index.maybeRemove(cachedContent.key);
assertThat(index.get(cachedContent.key)).isNull();
}
@Test
public void testCantRemoveNotEmptyCachedContent() throws Exception {
CachedContent cachedContent = index.getOrAdd("key1");
File cacheSpanFile =
SimpleCacheSpanTest.createCacheSpanFile(cacheDir, cachedContent.id, 10, 20, 30);
SimpleCacheSpan span = SimpleCacheSpan.createCacheEntry(cacheSpanFile, index);
cachedContent.addSpan(span);
index.maybeRemove(cachedContent.key);
assertThat(index.get(cachedContent.key)).isNotNull();
}
@Test
public void testCantRemoveLockedCachedContent() {
CachedContent cachedContent = index.getOrAdd("key1");
cachedContent.setLocked(true);
index.maybeRemove(cachedContent.key);
assertThat(index.get(cachedContent.key)).isNotNull();
}
private void assertStoredAndLoadedEqual(CachedContentIndex index, CachedContentIndex index2)
throws IOException {
ContentMetadataMutations mutations1 = new ContentMetadataMutations();
ContentMetadataInternal.setContentLength(mutations1, 2560);
index.getOrAdd("KLMNO").applyMetadataMutations(mutations1);
ContentMetadataMutations mutations2 = new ContentMetadataMutations();
ContentMetadataInternal.setContentLength(mutations2, 10);
ContentMetadataInternal.setRedirectedUri(mutations2, Uri.parse("abcde"));
index.getOrAdd("ABCDE").applyMetadataMutations(mutations2);
index.store();
index2.load();
Set<String> keys = index.getKeys();
Set<String> keys2 = index2.getKeys();
assertThat(keys2).isEqualTo(keys);
for (String key : keys) {
assertThat(index2.get(key)).isEqualTo(index.get(key));
}
}
}
| [
"[email protected]"
] | |
d69546563ed0c267735c9518430af84e01e626d9 | b212058e37bc52985822597cf859100d70994305 | /StrategyPattern/Main.java | dd0790923faa213e50c6d0e306af951c95965da1 | [] | no_license | drjonesy/DesignPatterns | 7bf7b0973ce1d105ceaaa2e4d8e36687421cf6b1 | 0aa421e15fb11e20b0f4e3431cc709eaa1596cc1 | refs/heads/master | 2021-01-25T04:36:47.096661 | 2017-06-06T01:15:20 | 2017-06-06T01:15:20 | 93,460,335 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package StrategyPattern;
import StrategyPattern.composition.MedicalHealthy;
import StrategyPattern.composition.TailFalse;
import StrategyPattern.type.Animal;
import StrategyPattern.type.Rodent;
import StrategyPattern.type.Bird;
/**
* Ryan Jones
* Strategy Pattern
* How to use: Instantiate Animal as Order Type
* ex: Animal parrot = new Bird("Location","Breed", 'Gender', age, size);
* Using composition: you can change the MedicalBehavior.healthStatus(Health/Sick) String
* and TailBehavior.Tail(True/False) Boolean
*/
public class Main {
public static void main(String[] args){
//Two example will be used
Animal gundi = new Rodent("North Africa", "North African Gundi", 'F', 4, 16);
System.out.println(gundi.toString());
gundi.setTailInfo(new TailFalse());
System.out.println("\nNorth African Gundi - Update\nTail: "+gundi.getTailInfo());
Animal potoo = new Bird("South America", "Potoo", 'M', 2, 28);
System.out.println(potoo.toString());
potoo.setTailInfo(new TailFalse());
potoo.setHealthStatus(new MedicalHealthy());
System.out.println("\nPotoo Bird - Update");
System.out.println("Tail: " + potoo.getTailInfo());
System.out.println("Health Status: " + potoo.getHealthStatus());
// If you wish to see more examples then either use the animals created in order
// or create your own Animal Class and test the program out
}
}
| [
"[email protected]"
] | |
26e92493ef1366e73b29ba2ed1f925d565f7e02a | 5e53480c0684cd9750030c3b17f3b73d54989ea6 | /Server/WeatherSender/src/main/java/ru/func/weathersender/service/MailSender.java | 456ffdaa2aa7e15c369930ec43b937559ea16afd | [
"MIT"
] | permissive | AppLoidx/MeteoService | 29012a483e582658a07503e2bc25c6c04702b0a7 | 566d4c5273cad8bd1192ab96c5ef28d24c690e5d | refs/heads/master | 2020-12-20T22:55:17.464481 | 2020-01-25T17:45:56 | 2020-01-25T17:45:56 | 236,233,063 | 0 | 0 | MIT | 2020-01-25T21:35:40 | 2020-01-25T21:35:39 | null | UTF-8 | Java | false | false | 841 | java | package ru.func.weathersender.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;
/**
* @author func 11.01.2020
*/
@Service
public class MailSender {
@Autowired
private JavaMailSender mailSender;
@Value("${spring.mail.username}")
private String username;
void send(String emailTo, String subject, String message) {
SimpleMailMessage mailMessage = new SimpleMailMessage();
mailMessage.setFrom(username);
mailMessage.setTo(emailTo);
mailMessage.setSubject(subject);
mailMessage.setText(message);
mailSender.send(mailMessage);
}
} | [
"[email protected]"
] | |
d2dc109d8773dea79eaeecd66ad90c64372d73fc | a83215aa128babe0dc1f124f738dc6a818c40d92 | /Java/Alg/src/Offer/Q32_PrintBinaryTree/PrintTreeInLines.java | 81e982b55e976f6c8b3f39e0ca27b05730fd25d7 | [] | no_license | w1252675615/coding | a17672dd90303fceeaf1131cd7b569a4a6fd764b | 7063e14f5d99193d7ce4a2a4fbee57892919ceab | refs/heads/master | 2021-04-18T19:29:46.953045 | 2019-04-24T06:54:52 | 2019-04-24T06:54:52 | 126,181,184 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package Offer.Q32_PrintBinaryTree;
/*
按行从左到右打印二叉树
*/
import java.util.ArrayDeque;
import java.util.ArrayList;
public class PrintTreeInLines {
ArrayList<ArrayList<Integer>> Print(TreeNode pRoot) {
ArrayList<ArrayList<Integer>> result = new ArrayList<>();
ArrayList<Integer> temp = new ArrayList<>();
ArrayDeque<TreeNode> dequeTreeNode = new ArrayDeque<>();
TreeNode tempNode;
dequeTreeNode.offerLast(pRoot);
int tempLine = 1;
int nextLine = 0;
if (pRoot == null) return result;
while (!dequeTreeNode.isEmpty()) {
tempNode = dequeTreeNode.pollLast();
temp.add(tempNode.val);
--tempLine;
if(tempNode.left != null) {
++nextLine;
dequeTreeNode.offerLast(tempNode.left);
}
if(tempNode.right != null) {
++nextLine;
dequeTreeNode.offerLast(tempNode.right);
}
if (tempLine == 0) {
result.add(temp);
temp = new ArrayList<>();
tempLine = nextLine;
nextLine = 0;
}
}
return result;
}
}
| [
"[email protected]"
] | |
03f7efc09d5d7dc8e1593b654a7893619f3429e3 | 3e9a23209145406ea1a3033ce22506fb93f3ff04 | /src/main/java/DAOLayer/DBDaoImpl.java | 436c9af430b2adbe3085bd5220f13f34950ade79 | [] | no_license | jainsarthak3/eCFHackathonIceBreaker | 727f7adeb37cbe23a152613f100bcb37cc46fca9 | 1752b4ae7cea9a3fc4f9ae886482a12eaf88d9b3 | refs/heads/master | 2022-12-18T06:06:10.536592 | 2020-09-18T06:27:06 | 2020-09-18T06:27:06 | 296,445,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package DAOLayer;
import Database.ProfileData;
import Database.UserProfileDb;
import java.util.Map;
public class DBDaoImpl implements DBDao {
private static UserProfileDb userProfileDb = new UserProfileDb();
@Override
public Map<String, ProfileData> getUserPoolData() {
return userProfileDb.getUserPoolData();
}
@Override
public ProfileData getUserData(String profileId) {
return userProfileDb.getUserProfileData(profileId);
}
@Override
public void saveUserProfileData(ProfileData userProfileData) {
}
@Override
public void populateUserPoolData(Map<String, ProfileData> userPoolData) {
userProfileDb.populateUserPoolData(userPoolData);
}
}
| [
"[email protected]"
] | |
26155df7a00598c5a7baf79b155d258b24ad855b | 2e5888d6fab3e562187b41e6b3180c18a83a56ed | /HW2/app/src/main/java/com/example/zijia/hw2/MainActivity.java | 7361e51f2bfb62bcfb6a17bbd136638c9214e32c | [] | no_license | pronter/Android-Common | 51ec0a71b6f48a3ad6579c7ec28d8e5b3f1b0fd3 | 0b565c658aa28c2c5e3ba6910a0270b70e7166fd | refs/heads/master | 2021-01-15T10:07:23.097301 | 2016-01-10T15:42:55 | 2016-01-10T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,176 | java | package com.example.zijia.hw2;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private EditText named;
private EditText pass;
private ImageButton image;
private Button reset;
private String name,password;
private TextView message;
private Button jump;
protected Context mcontext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image = (ImageButton)findViewById(R.id.image);
//注册一个文本
reset = (Button)findViewById(R.id.reset);
//注册一个重置按钮
named = (EditText) findViewById(R.id.name);
//注册一个密码
pass = (EditText)findViewById(R.id.password);
// 得到数据
name = named.getText().toString();
password = pass.getText().toString();
//添加输入的监听事件
jump = (Button)findViewById(R.id.Jump);
//动态添加Textview
mcontext = this;
message = new TextView(mcontext);
message.setText("这是一个动态添加的Textview");
final LinearLayout layout = (LinearLayout)findViewById(R.id.main);
layout.addView(message);
named.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
name = named.getText().toString();
}
return false;
}
});
pass.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
password = pass.getText().toString();
}
return false;
}
});
//添加image的监听事件
image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//字符串匹配
if (name.equals("LeiBusi") && password.equals("Halo3Q")) {
//image.setImageDrawable(getResources().getDrawable(R.mipmap.state2));
image.setImageResource(R.drawable.state2);
//隐藏editText
named.setVisibility(View.GONE);
pass.setVisibility(View.GONE);
} else {
image.setImageResource(R.drawable.state1);//转化imageButton的图
pass.requestFocus();//获取焦点
pass.setText("");
pass.setHint("密码错误!");
}
}
});
image.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
TextView newtext = new TextView(v.getContext());
newtext.setText("这是长按添加的TextView");
layout.addView(newtext);
return false;
}
});
reset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
pass.setHint("请输入密码");
pass.setText("");
pass.setVisibility(View.VISIBLE);
named.setVisibility(View.VISIBLE);
named.setHint("请输入用户名");
named.setText("");
image.setImageResource(R.drawable.state1);
}
});
jump.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(MainActivity.this,Main2Activity.class);
startActivity(intent);
MainActivity.this.finish();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
3a01e9a5e8b7988b93035b2696d96f0962faf04f | 2aaf5cca177d8c782a8df6cd1bff0287ad9af9de | /Bai-Tap-Tuan/src/com/dhpm11/Tuan_3/Class/11DHPM2019/src/main/java/com/dhpm11/tuan3/DemoJFrameTinhToan.java | 9bd1f755077a5e03b366afd43abe4ab5f9e0f21f | [] | no_license | letranbaosuong/Java-Application | ed04e2188205ba6efaef33ac254b4a0391ebf010 | fa94874bf3079aa1a768f270be68ed3046506614 | refs/heads/master | 2020-07-23T19:29:10.371830 | 2019-10-26T12:31:05 | 2019-10-26T12:31:05 | 207,682,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,466 | 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 com.dhpm11.tuan3;
/**
*
* @author Suong
*/
public class DemoJFrameTinhToan extends javax.swing.JFrame {
/**
* Creates new form DemoJFrameTinhToan
*/
public DemoJFrameTinhToan() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
jPanel8 = new javax.swing.JPanel();
jPanel9 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
jPanel4 = new javax.swing.JPanel();
jPanel5 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jPanel6 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jRadioButton1 = new javax.swing.JRadioButton();
jRadioButton2 = new javax.swing.JRadioButton();
jRadioButton3 = new javax.swing.JRadioButton();
jRadioButton4 = new javax.swing.JRadioButton();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setLayout(new java.awt.BorderLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel1.setText("Cộng - Trừ - Nhân - Chia");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(72, 72, 72)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(197, 197, 197))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
jPanel1.add(jPanel2, java.awt.BorderLayout.PAGE_START);
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 490, Short.MAX_VALUE)
);
jPanel8Layout.setVerticalGroup(
jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1, Short.MAX_VALUE)
);
jPanel3.add(jPanel8);
javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
jPanel9.setLayout(jPanel9Layout);
jPanel9Layout.setHorizontalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 490, Short.MAX_VALUE)
);
jPanel9Layout.setVerticalGroup(
jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1, Short.MAX_VALUE)
);
jPanel3.add(jPanel9);
javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 490, Short.MAX_VALUE)
);
jPanel10Layout.setVerticalGroup(
jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1, Short.MAX_VALUE)
);
jPanel3.add(jPanel10);
jPanel1.add(jPanel3, java.awt.BorderLayout.PAGE_END);
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 51, 0)), "Tác vụ"));
jButton1.setText("Giải");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Xóa");
jButton3.setText("Thoát");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap(17, Short.MAX_VALUE)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton3)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Nhập 2 số a, b"));
jLabel2.setText("Nhập a:");
jLabel3.setText("Nhập b:");
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Chọn phép toán:"));
jPanel7.setLayout(new java.awt.GridLayout(2, 2));
buttonGroup1.add(jRadioButton1);
jRadioButton1.setText("Cộng");
jPanel7.add(jRadioButton1);
buttonGroup1.add(jRadioButton2);
jRadioButton2.setText("Trừ");
jPanel7.add(jRadioButton2);
buttonGroup1.add(jRadioButton3);
jRadioButton3.setText("Nhân");
jPanel7.add(jRadioButton3);
buttonGroup1.add(jRadioButton4);
jRadioButton4.setText("Chia");
jPanel7.add(jRadioButton4);
jLabel4.setText("Kết quả:");
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(102, 102, 102)
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 19, Short.MAX_VALUE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField1))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
jPanel1.add(jPanel4, java.awt.BorderLayout.CENTER);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(DemoJFrameTinhToan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(DemoJFrameTinhToan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(DemoJFrameTinhToan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(DemoJFrameTinhToan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DemoJFrameTinhToan().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JRadioButton jRadioButton4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
0dd3dd9825a388a359485cbe186109667a213054 | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Framework/mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089/system/runtime/interopservices/GuidAttribute.java | a84634f305bef6520dd085cb81f849c1d425544f | [
"MIT"
] | permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,757 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.runtime.interopservices;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.Attribute;
/**
* The base .NET class managing System.Runtime.InteropServices.GuidAttribute, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.Runtime.InteropServices.GuidAttribute" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.Runtime.InteropServices.GuidAttribute</a>
*/
public class GuidAttribute extends Attribute {
/**
* Fully assembly qualified name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: mscorlib
*/
public static final String assemblyShortName = "mscorlib";
/**
* Qualified class name: System.Runtime.InteropServices.GuidAttribute
*/
public static final String className = "System.Runtime.InteropServices.GuidAttribute";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public GuidAttribute(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link GuidAttribute}, a cast assert is made to check if types are compatible.
*/
public static GuidAttribute cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new GuidAttribute(from.getJCOInstance());
}
// Constructors section
public GuidAttribute() throws Throwable {
}
public GuidAttribute(java.lang.String guid) throws Throwable {
try {
// add reference to assemblyName.dll file
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(guid));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Methods section
// Properties section
public java.lang.String getValue() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (java.lang.String)classInstance.Get("Value");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
} | [
"[email protected]"
] | |
7a97f2ce4b8a1d9b2234c1a91680f5e1b92ebd1a | 5677f683943be31df1ff275b1fce8004b6669feb | /src/main/java/prest/common/data/ContextBuilder.java | cc3b6a27088647870102167ab4ad6246ad6e3b97 | [] | no_license | vrthra-forks/prest | 2736b4386fb71eeabe7698077a2d6e67d45a7091 | e0e839c1ce7e049b92ebf7a9045b9bf7ac62caaf | refs/heads/master | 2021-05-26T19:41:10.135164 | 2013-07-15T18:24:41 | 2013-07-15T18:24:41 | 11,318,628 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package prest.common.data;
/**
* @author secil.karagulle
* @author ovunc.bozcan
*/
public interface ContextBuilder {
/**
* @return TODO
*
*/
public DataContext store() throws Exception;
/**
* @param dataContext
* @throws UnsupportedDataContextException
*/
void load(DataContext dataContext) throws Exception;
}
| [
"[email protected]"
] | |
9a6ef7a92a311d354430b241753e2bc2bfbd5bce | 779af41651f901c059d3fa3e0d8f2de639b3c2c9 | /UnitTesting/app/src/test/java/ru/itis/lectures/unittesting/mocks/TestHolder.java | 583769abb4ff2394808756879db977155820cbaf | [] | no_license | Yasinaaa/AndroidLab | d6a5df1b69db39ee84a80f2cb5b1d6ec2a640527 | 63c4f8b282d94a04b4f19b43f51f918e3e7cecc0 | refs/heads/master | 2021-01-18T21:19:18.653095 | 2016-05-17T13:18:15 | 2016-05-17T13:18:15 | 51,688,061 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package ru.itis.lectures.unittesting.mocks;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* @author Artur Vasilov
*/
public class TestHolder extends RecyclerView.ViewHolder {
public TestHolder(View itemView) {
super(itemView);
}
}
| [
"[email protected]"
] | |
7484827e960dc264f373ceeb693459571c86bac5 | 14577db8af287689a157320973826d616db2c620 | /dp-ordm-webapp/src/main/java/com/zeusas/dp/ordm/controller/CmbcController.java | 974d94247a32e630ddf0424746a8d0c6a87cadc1 | [] | no_license | wonsaign/dp-ordm | 21f44f4ad542f34352eae1b01c0327cb1139789f | b234db95412344726f557f56eb9d938ce73f1fd2 | refs/heads/master | 2020-03-08T07:38:15.009836 | 2018-04-04T03:15:23 | 2018-04-04T03:15:23 | 127,999,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,570 | java | package com.zeusas.dp.ordm.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.zeusas.common.utils.DSResponse;
import com.zeusas.common.utils.Status;
import com.zeusas.core.utils.StringUtil;
import com.zeusas.dp.ordm.entity.CmbcPayRecord;
import com.zeusas.dp.ordm.entity.MonthPresent;
import com.zeusas.dp.ordm.entity.Order;
import com.zeusas.dp.ordm.service.CmbcPayRecordService;
import com.zeusas.dp.ordm.service.MonthPresentManager;
import com.zeusas.dp.ordm.service.OrderService;
import com.zeusas.epay.cmbc.utils.CmbcConfig;
import com.zeusas.epay.cmbc.utils.PackUtil;
import cfca.sadk.cmbc.tools.CMBCDecryptKit;
import cfca.sadk.cmbc.tools.DecryptKitException;
@Controller
@RequestMapping("/cmbc")
public class CmbcController {
//设置单独的日志付款日志
static Logger logger = LoggerFactory.getLogger(CmbcController.class);
@Autowired
private OrderService orderService;
@Autowired
private CmbcPayRecordService cmbcPayRecordService;
@Autowired
private MonthPresentManager monthPresentManager;
@RequestMapping(value = "/index" ,method=RequestMethod.GET)
public String index(@RequestParam(name="orderID",required=true)Long order_id,ModelMap mp){
try{
Order order = orderService.get(order_id);
if(order==null){
return "redirect:/ordm/index.do";
}
// 下述参数任意为空,订单无效,返回到首页。
mp.addAttribute("DSResponse",new DSResponse(order));
}catch (Exception e) {
logger.error("跳转到民生付失败",order_id,e);
}
return "cmbc/cmbc_index";
}
/**
*
* @param order_id 单号
* @param txAmt 金额
* @param channel 支付通道0:PC 2:WAP
* @param remark 备注
* @param request
* @return
* @throws IOException
*/
@RequestMapping(value = "/confirm" ,method=RequestMethod.POST)
public @ResponseBody DSResponse cmbcConfirm(@RequestParam(name="orderNo",required=false)String order_no,
@RequestParam(name="txAmt",required=false)String txAmt,
@RequestParam(name="channel",required=false)String channel,
@RequestParam(name="remark",required=false)String remark,
HttpServletRequest request) throws IOException{
CMBCDecryptKit userKit = new CMBCDecryptKit();
try{
Order order = orderService.getsingleOrder(order_no);
if(order==null){
return new DSResponse(Status.FAILURE,"订单为空");
}
String orderNo = order.getOrderNo();//订单号
Double total_fee = order.getPayable();//订单金额
//下述参数任意为空,订单无效,返回到首页。
if (StringUtil.isEmpty(orderNo)
|| StringUtil.isEmpty(total_fee)) {
return new DSResponse(Status.FAILURE,"无单号和总额");
}
request.setCharacterEncoding("utf-8");
PackUtil packUtil = new PackUtil();
userKit.Initialize(CmbcConfig.getProperties("cmbc_key"), CmbcConfig.getProperties("cmbc_password"),
CmbcConfig.getProperties("cmbc_veriSign"));
// 加入时间戳处理
String orderSign = packUtil.packReqBean(packJRNo(orderNo), txAmt, channel, remark);
String orderData = userKit.SignAndEncryptMessage(orderSign);
return new DSResponse(orderData);
}catch(Exception e){
logger.error("民生付支付失败! orderID:{}",order_no,e);
}finally {
// 密钥释放
try {
userKit.Uninitialize();
} catch (DecryptKitException e) {
logger.error("密钥反初始化失败",e);
}
}
return new DSResponse(Status.FAILURE,"出现异常");
}
/**
* 接收返回参数
* @param request
* @throws IOException
*/
@RequestMapping(value = "/notifypay",method=RequestMethod.GET)
public String getNotify(HttpServletRequest request) throws IOException {
request.setCharacterEncoding("utf-8");
String orderData = request.getParameter("payresult");
CMBCDecryptKit userKit = new CMBCDecryptKit();
try {
userKit.Initialize(CmbcConfig.getProperties("cmbc_key"), CmbcConfig.getProperties("cmbc_password"),
CmbcConfig.getProperties("cmbc_veriSign"));
String orderString = userKit.DecryptAndVerifyMessage(orderData);
Assert.notNull(orderString,"返回密文为空");
// 使用BASE64来解密
String result = new String(new Base64().decode(orderString));
// 2017070600001|1|01347|0.16|20170706|095634|0|null| 将结果进行差分比对
String[] ss = result.split("\\|",-1);
// 还原订单号
String orderNo = restoreOrder(ss[0]);
CmbcPayRecord cpr = new CmbcPayRecord();
cpr.setOrderNo(orderNo);//
cpr.setBankFlag(ss[1]);// 行内外标识 0:行内 1:跨行
cpr.setTxtAmt(ss[3]);// 金额
cpr.setDateTime(ss[4]+ss[5]);// 交易日期和时间
cpr.setBillStatus(ss[6]);// 交易状态 0:success
cpr.setRemark(ss[8]);// 备注
cpr.setNotifyTxt(orderData);
// 如果已经有凭证不再进行下面的操作
CmbcPayRecord cmbc = cmbcPayRecordService.getByOrderNo(orderNo);
boolean isSuccess = false;
if(cmbc == null){
// Step1:保存订单凭证到文档
cmbcPayRecordService.save(cpr);
// Step2:月度物料自动推单
Order order = orderService.getsingleOrder(orderNo);
// List<PresentContext> presentContexts = monthPresentManager.getUnexecutedByCounter(order.getCounterCode());
// if (presentContexts != null) {
// for (PresentContext presentContext : presentContexts) {
// // FIX ME:回滚
// monthPresentManager.excute(order.getOrderNo(), order.getCounterCode(), presentContext);
// }
// }
String counterCode = order.getCounterCode();
int yearmonth=monthPresentManager.getyearmonth();
MonthPresent monthPresent= monthPresentManager.findByMonthAndCode(yearmonth, counterCode);
if(monthPresent!=null){
monthPresentManager.excute(orderNo, monthPresent);
}
// step3: 订单中打欠产品添加到打欠记录中
orderService.saveReserveRecord(orderNo);
// step4: 添加预售活动随单执行的产品
if (LocalTime.now().getHour() < 12) {
orderService.addReserveRecord(orderNo);
}
// step5 : 添加自动追加礼包的
// orderService.AddAutoBigPackage(order);
// step6: 校验是否能支付
isSuccess = cmbcPayRecordService.checkSuccess(orderNo, ss[3], ss[6]);
}
//
if(isSuccess){
return "redirect:/order/index.do";
}
} catch (DecryptKitException e) {
logger.error("密钥反初始化失败", e);
} catch (Exception e) {
logger.error("接受返回参数失败", e);
}
return "redirect:/ordm/index.do";
}
/**
* 制作订单流水号,加入时间戳
* 20170911102252 , 2017090100001 -> 201709111022520001
* @return
*/
private String packJRNo(String orderNo) {
String timeStamp = new SimpleDateFormat("hhmmss").format(new Date());
return orderNo + timeStamp;
}
/**
* 订单流水号还原
* 201709111022520001 ->2017090100001
* @return
*/
private String restoreOrder(String JRNo) {
return JRNo.substring(0, JRNo.length() - 6);
}
}
| [
"[email protected]"
] | |
62246607ffca85c9d48aea6f5af0873c3edd2141 | 3c31e60ca61e2807dfe6f452e45d657bc4d4f369 | /src/main/java/com/each/cdl/controller/CustomAuthenticationProvider.java | 4a7d1f35e3be2e61d040834731881f49bf75a926 | [] | no_license | nogueirajuan/clube-do-livro | 814f8c230190992d30d315e114e6a007d55e1b84 | 1c3af98c365a000e9b21ae4094ef6edd29b61360 | refs/heads/master | 2021-08-19T04:41:08.634485 | 2017-11-24T20:16:37 | 2017-11-24T20:16:37 | 105,243,473 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,515 | 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 com.each.cdl.controller;
import com.each.cdl.integration.UserIntegration;
import com.each.cdl.integration.responses.LoginResponse;
import com.each.cdl.model.Usuario;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/**
* @author victorluni
*/
@Component
public class CustomAuthenticationProvider implements AuthenticationProvider {
private final String LOG_PREFIX = "[CUSTOM-AUTHENTICATION-PROVIDER]";
private static final Logger log = LoggerFactory.getLogger(CustomAuthenticationProvider.class);
@Autowired
UserIntegration userIntegration;
@Override
public Authentication authenticate(Authentication a) throws AuthenticationException {
Usuario u = new Usuario();
u.setUsername(a.getName());
u.setSenha(a.getCredentials().toString());
if (u.getUsername() == null || u.getSenha() == null || u.getSenha().equals("")) {
throw new BadCredentialsException("invalid login or password");
}
LoginResponse login = userIntegration.login(u);
if (login.getSucesso()) {
List<GrantedAuthority> granted = new ArrayList<>();
granted.add(new SimpleGrantedAuthority("leitor"));
return new UsernamePasswordAuthenticationToken(u.getUsername(), a.getCredentials().toString(), granted);
}else{
log.error(LOG_PREFIX + "[MESSAGE]-[{}]", "User not found");
throw new BadCredentialsException("User not found");
}
}
@Override
public boolean supports(Class<?> type) {
return true;
}
}
| [
"[email protected]"
] | |
38d0b9959e8e1e65c02ce5192aae163744968bb9 | bc8e3883dc4769ad221bd38b43689efb5342b81b | /src/com/icarus/tutorial/designpattern/factory/gof/SecureMySqlConnection.java | e1aa25531aab489c19a3f18e772cbffdac9976b7 | [] | no_license | Ic4rus/Tutorial-Java-DesignPattern | 0f8e2bab603d99ca67d17ceea81f408918e5876b | a59dcb4e5d04eb1c6e506959655c50c4a0bec35b | refs/heads/master | 2020-04-15T05:11:57.448225 | 2016-01-22T06:44:17 | 2016-01-22T06:44:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.icarus.tutorial.designpattern.factory.gof;
public class SecureMySqlConnection extends Connection {
public SecureMySqlConnection() {
}
public String description() {
return "MySQL secure";
}
}
| [
"[email protected]"
] | |
882837d6f1951af1ca6cb467ba7486761a2c952e | 8656517a9596fe40717320bf986d959dffd11c25 | /app/src/test/java/com/clivenspetit/bowlingscoring/app/BowlingScoringTest.java | 1c356522241797f0c5080c220fa213a6551fca92 | [] | no_license | peclevens/bowling-scoring | 90d3f2b2010e34292fdc13f38114868e0ca44cf2 | 356c7e797b8da1eee43b9a2ed8a21b4a75c9c21b | refs/heads/master | 2023-06-26T20:58:58.596524 | 2022-01-05T08:09:58 | 2022-01-05T08:09:58 | 205,708,526 | 2 | 0 | null | 2023-06-14T22:30:00 | 2019-09-01T17:16:47 | Java | UTF-8 | Java | false | false | 4,356 | java | package com.clivenspetit.bowlingscoring.app;
import com.clivenspetit.bowlingscoring.domain.game.AbstractScoreProcessor;
import com.clivenspetit.bowlingscoring.domain.game.Player;
import com.clivenspetit.bowlingscoring.domain.game.repository.BowlingRepository;
import com.clivenspetit.bowlingscoring.domain.utility.FileUtils;
import com.clivenspetit.bowlingscoring.domain.utility.StubFrame;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.*;
/**
* @author Clivens Petit <[email protected]>
*/
public class BowlingScoringTest {
private static final String SAMPLE_ALL_STRIKES_FILE_PATH = "stubs/sample_all_strikes_game.txt";
private BowlingRepository bowlingRepository;
private AbstractScoreProcessor scoreProcessor;
private Cache<String, String> gameResultCache;
private BowlingScoring bowlingScoring;
private String realPath;
private String allStrikeContent;
@Before
public void setUp() throws Exception {
bowlingRepository = mock(BowlingRepository.class);
scoreProcessor = mock(AbstractScoreProcessor.class);
gameResultCache = CacheBuilder.newBuilder()
.maximumSize(10)
.expireAfterWrite(60, TimeUnit.SECONDS)
.build();
bowlingScoring = new BowlingScoring(bowlingRepository, scoreProcessor, gameResultCache);
realPath = FileUtils.getAbsoluteFilePathForResource(this.getClass(), SAMPLE_ALL_STRIKES_FILE_PATH);
allStrikeContent = new String(Files.readAllBytes(Paths.get(realPath)), StandardCharsets.UTF_8);
when(bowlingRepository.loadGameResultFromFile(realPath))
.thenReturn(allStrikeContent);
when(scoreProcessor.process(allStrikeContent))
.thenReturn(buildStubAllStrikePlayer());
}
private List<Player> buildStubAllStrikePlayer() {
List<Player> players = new ArrayList<>();
Player player = new Player("Carl");
player.addFrame(0, new StubFrame('\0', 'X', '\0', 30));
player.addFrame(1, new StubFrame('\0', 'X', '\0', 60));
player.addFrame(2, new StubFrame('\0', 'X', '\0', 90));
player.addFrame(3, new StubFrame('\0', 'X', '\0', 120));
player.addFrame(4, new StubFrame('\0', 'X', '\0', 150));
player.addFrame(5, new StubFrame('\0', 'X', '\0', 180));
player.addFrame(6, new StubFrame('\0', 'X', '\0', 210));
player.addFrame(7, new StubFrame('\0', 'X', '\0', 240));
player.addFrame(8, new StubFrame('\0', 'X', '\0', 270));
player.addFrame(9, new StubFrame('X', 'X', 'X', 300));
players.add(player);
return players;
}
@After
public void tearDown() throws Exception {
bowlingRepository = null;
scoreProcessor = null;
gameResultCache = null;
bowlingScoring = null;
realPath = null;
allStrikeContent = null;
}
@Test(expected = NullPointerException.class)
public void printGameScore_nullArgumentPassed_throwException() throws Exception {
bowlingScoring.printGameScore(null);
}
@Test
public void printGameScore_validFilePassed_loadFileProcessResultPrintGameScore() throws Exception {
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
bowlingScoring.printGameScore(realPath);
verify(bowlingRepository, times(1))
.loadGameResultFromFile(argumentCaptor.capture());
verify(scoreProcessor, times(1))
.process(argumentCaptor.capture());
// Make sure that BowlingRepository#loadGameResultFromFile was called with the right path
assertThat(argumentCaptor.getAllValues().get(0), is(realPath));
// Make sure that AbstractScoreProcessor#process was called with the right content
assertThat(argumentCaptor.getAllValues().get(1), is(allStrikeContent));
}
}
| [
"[email protected]"
] | |
63be5549e65235129e743440722fc90897e3e5ce | ba521ca4278d1b9c6129dda07f2b0374bde4ce9d | /testStaff.java | 08dd7ca006e0dac8c7e56fd5b6a06382fc6e60e7 | [] | no_license | ducanh9797/ClassPerson-MiniClassOfPerson | 242d7ac90d8e7d6fc44060b33f1f523734f448ee | 04af557682914bdbf3415eb6041deef986cb3e07 | refs/heads/master | 2020-03-22T05:24:02.905164 | 2018-07-03T09:50:54 | 2018-07-03T09:50:54 | 139,563,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | public class testStaff {
public static void main(String[] args) {
Staff staff = new Staff("DucAnh", "VietNam", "Codygym", 200000);
System.out.println(staff.toString());
}
}
| [
"[email protected]"
] | |
533749840d3bdfcf660135fe37bb72b8e73465e9 | ddb15b80fd7823d16acb5aeb770089d82d7a15be | /document-parser/src/main/java/com/buildit/parser/Parser.java | 99925642a89a60b4894bf3fc5721c87adc386edf | [] | no_license | lorenzo-deepcode/buildit-all | 2bdd24efd4aff9b993098f7d153cd27690648ed3 | 30a02c0bc1c8253706964de6141a0cc806568916 | refs/heads/master | 2020-04-09T18:46:03.818625 | 2018-12-05T13:33:09 | 2018-12-05T13:33:09 | 160,523,196 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package com.buildit.parser;
import java.io.*;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.pdf.PDFParser;
import org.apache.tika.sax.BodyContentHandler;
import org.xml.sax.ContentHandler;
public class Parser {
public static String parse(InputStream is) throws Exception {
org.apache.tika.parser.Parser parser = new PDFParser();
StringWriter outputWriter = new StringWriter();
ContentHandler handler = new BodyContentHandler(outputWriter);
Metadata metadata = new Metadata();
parser.parse(is, handler, metadata, new ParseContext());
return outputWriter.toString();
}
}
| [
"[email protected]"
] | |
9862a60fb399198dd52f5d4924036379eb1764da | e378790b3fdffc6a6e54bff2d75baf07831d10e3 | /aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ResourceDataSyncS3Destination.java | 819735dc9856f4fead4392a861b295656af3aa5b | [
"Apache-2.0"
] | permissive | TejasPatel007/aws-sdk-java | b0a1703171a516115a719c1649a4dbc0b830ce9a | 31c764c2bedad45ed6b51799e77889fb8ec8684b | refs/heads/master | 2021-07-07T07:54:58.070264 | 2017-10-03T17:49:17 | 2017-10-03T17:49:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,521 | java | /*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.simplesystemsmanagement.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* Information about the target Amazon S3 bucket for the Resource Data Sync.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/ResourceDataSyncS3Destination" target="_top">AWS
* API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResourceDataSyncS3Destination implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The name of the Amazon S3 bucket where the aggregated data is stored.
* </p>
*/
private String bucketName;
/**
* <p>
* An Amazon S3 prefix for the bucket.
* </p>
*/
private String prefix;
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*/
private String syncFormat;
/**
* <p>
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
* </p>
*/
private String region;
/**
* <p>
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the destination
* Amazon S3 bucket.
* </p>
*/
private String aWSKMSKeyARN;
/**
* <p>
* The name of the Amazon S3 bucket where the aggregated data is stored.
* </p>
*
* @param bucketName
* The name of the Amazon S3 bucket where the aggregated data is stored.
*/
public void setBucketName(String bucketName) {
this.bucketName = bucketName;
}
/**
* <p>
* The name of the Amazon S3 bucket where the aggregated data is stored.
* </p>
*
* @return The name of the Amazon S3 bucket where the aggregated data is stored.
*/
public String getBucketName() {
return this.bucketName;
}
/**
* <p>
* The name of the Amazon S3 bucket where the aggregated data is stored.
* </p>
*
* @param bucketName
* The name of the Amazon S3 bucket where the aggregated data is stored.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceDataSyncS3Destination withBucketName(String bucketName) {
setBucketName(bucketName);
return this;
}
/**
* <p>
* An Amazon S3 prefix for the bucket.
* </p>
*
* @param prefix
* An Amazon S3 prefix for the bucket.
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
}
/**
* <p>
* An Amazon S3 prefix for the bucket.
* </p>
*
* @return An Amazon S3 prefix for the bucket.
*/
public String getPrefix() {
return this.prefix;
}
/**
* <p>
* An Amazon S3 prefix for the bucket.
* </p>
*
* @param prefix
* An Amazon S3 prefix for the bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceDataSyncS3Destination withPrefix(String prefix) {
setPrefix(prefix);
return this;
}
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*
* @param syncFormat
* A supported sync format. The following format is currently supported: JsonSerDe
* @see ResourceDataSyncS3Format
*/
public void setSyncFormat(String syncFormat) {
this.syncFormat = syncFormat;
}
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*
* @return A supported sync format. The following format is currently supported: JsonSerDe
* @see ResourceDataSyncS3Format
*/
@com.fasterxml.jackson.annotation.JsonProperty("syncFormat")
public String getSyncFormat() {
return this.syncFormat;
}
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*
* @param syncFormat
* A supported sync format. The following format is currently supported: JsonSerDe
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceDataSyncS3Format
*/
public ResourceDataSyncS3Destination withSyncFormat(String syncFormat) {
setSyncFormat(syncFormat);
return this;
}
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*
* @param syncFormat
* A supported sync format. The following format is currently supported: JsonSerDe
* @see ResourceDataSyncS3Format
*/
@com.fasterxml.jackson.annotation.JsonIgnore
public void setSyncFormat(ResourceDataSyncS3Format syncFormat) {
withSyncFormat(syncFormat);
}
/**
* <p>
* A supported sync format. The following format is currently supported: JsonSerDe
* </p>
*
* @param syncFormat
* A supported sync format. The following format is currently supported: JsonSerDe
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceDataSyncS3Format
*/
public ResourceDataSyncS3Destination withSyncFormat(ResourceDataSyncS3Format syncFormat) {
this.syncFormat = syncFormat.toString();
return this;
}
/**
* <p>
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
* </p>
*
* @param region
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
*/
public void setRegion(String region) {
this.region = region;
}
/**
* <p>
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
* </p>
*
* @return The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
*/
public String getRegion() {
return this.region;
}
/**
* <p>
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
* </p>
*
* @param region
* The AWS Region with the Amazon S3 bucket targeted by the Resource Data Sync.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceDataSyncS3Destination withRegion(String region) {
setRegion(region);
return this;
}
/**
* <p>
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the destination
* Amazon S3 bucket.
* </p>
*
* @param aWSKMSKeyARN
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the
* destination Amazon S3 bucket.
*/
public void setAWSKMSKeyARN(String aWSKMSKeyARN) {
this.aWSKMSKeyARN = aWSKMSKeyARN;
}
/**
* <p>
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the destination
* Amazon S3 bucket.
* </p>
*
* @return The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the
* destination Amazon S3 bucket.
*/
public String getAWSKMSKeyARN() {
return this.aWSKMSKeyARN;
}
/**
* <p>
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the destination
* Amazon S3 bucket.
* </p>
*
* @param aWSKMSKeyARN
* The ARN of an encryption key for a destination in Amazon S3. Must belong to the same region as the
* destination Amazon S3 bucket.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ResourceDataSyncS3Destination withAWSKMSKeyARN(String aWSKMSKeyARN) {
setAWSKMSKeyARN(aWSKMSKeyARN);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getBucketName() != null)
sb.append("BucketName: ").append(getBucketName()).append(",");
if (getPrefix() != null)
sb.append("Prefix: ").append(getPrefix()).append(",");
if (getSyncFormat() != null)
sb.append("SyncFormat: ").append(getSyncFormat()).append(",");
if (getRegion() != null)
sb.append("Region: ").append(getRegion()).append(",");
if (getAWSKMSKeyARN() != null)
sb.append("AWSKMSKeyARN: ").append(getAWSKMSKeyARN());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ResourceDataSyncS3Destination == false)
return false;
ResourceDataSyncS3Destination other = (ResourceDataSyncS3Destination) obj;
if (other.getBucketName() == null ^ this.getBucketName() == null)
return false;
if (other.getBucketName() != null && other.getBucketName().equals(this.getBucketName()) == false)
return false;
if (other.getPrefix() == null ^ this.getPrefix() == null)
return false;
if (other.getPrefix() != null && other.getPrefix().equals(this.getPrefix()) == false)
return false;
if (other.getSyncFormat() == null ^ this.getSyncFormat() == null)
return false;
if (other.getSyncFormat() != null && other.getSyncFormat().equals(this.getSyncFormat()) == false)
return false;
if (other.getRegion() == null ^ this.getRegion() == null)
return false;
if (other.getRegion() != null && other.getRegion().equals(this.getRegion()) == false)
return false;
if (other.getAWSKMSKeyARN() == null ^ this.getAWSKMSKeyARN() == null)
return false;
if (other.getAWSKMSKeyARN() != null && other.getAWSKMSKeyARN().equals(this.getAWSKMSKeyARN()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getBucketName() == null) ? 0 : getBucketName().hashCode());
hashCode = prime * hashCode + ((getPrefix() == null) ? 0 : getPrefix().hashCode());
hashCode = prime * hashCode + ((getSyncFormat() == null) ? 0 : getSyncFormat().hashCode());
hashCode = prime * hashCode + ((getRegion() == null) ? 0 : getRegion().hashCode());
hashCode = prime * hashCode + ((getAWSKMSKeyARN() == null) ? 0 : getAWSKMSKeyARN().hashCode());
return hashCode;
}
@Override
public ResourceDataSyncS3Destination clone() {
try {
return (ResourceDataSyncS3Destination) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.simplesystemsmanagement.model.transform.ResourceDataSyncS3DestinationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
2f9de5d98e0cf1ea121d5c1f34b5ea7e9765e6e0 | a44c0249cd2d5a485addc6716d566c8d38aa09bd | /later/src/main/java/com/baizhi/mapper/MenuMapper.java | 593dd1b7aae1fc38b5af840f7bd14e712a9a87ae | [] | no_license | youchengpeng/cmfz | 77dc48fa38ba4338787c5ed75d7c9d24d629215b | d3b3b4995ddc6b8582dc702a21a0848f69425c2c | refs/heads/master | 2020-04-13T19:40:01.048339 | 2018-12-28T11:34:45 | 2018-12-28T11:34:45 | 163,409,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | package com.baizhi.mapper;
import com.baizhi.entity.Menu;
import java.util.List;
public interface MenuMapper {
public List<Menu> queryAll();
}
| [
"[email protected]"
] | |
300499056780e9a36ece27106f33b72d92a328a5 | 087c88d4a358e6a1d4f280a961087d1ba25d3875 | /app/src/main/java/com/oliviercoue/nameless/components/chat/ChatManager.java | d77ec742b311ed8de937f9ddc280bb28f5d5b634 | [] | no_license | OlivierCoue/NamelessApp | 702091e18d9b216eb146ea121e1fb2206f430423 | bb2803559cf4d24712a2569492d190765ffc7186 | refs/heads/master | 2021-01-10T15:56:16.989642 | 2016-03-14T17:31:41 | 2016-03-14T17:31:41 | 51,267,318 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,084 | java | package com.oliviercoue.nameless.components.chat;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import com.github.nkzawa.emitter.Emitter;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.loopj.android.http.RequestParams;
import com.oliviercoue.nameless.components.ActivityManager;
import com.oliviercoue.nameless.components.ActivityManagerImp;
import com.oliviercoue.nameless.components.search.SearchActivity;
import com.oliviercoue.nameless.components.start.StartActivity;
import com.oliviercoue.nameless.models.User;
import com.oliviercoue.nameless.network.NamelessRestClient;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import cz.msebera.android.httpclient.Header;
/**
* Created by Olivier on 18/02/2016.
*
*/
public class ChatManager extends ActivityManager implements ActivityManagerImp{
private ChatManagerImp chatManagerImp;
private ChatImageHelper chatImageHelper;
private Context context;
private boolean canceling = false, friendUserHere = false;
private Bundle extras;
public ChatManager(ChatActivity chatActivity){
super(chatActivity);
context = chatActivity;
chatManagerImp = chatActivity;
chatImageHelper = new ChatImageHelper();
if(initExtrasOk())
initFriendUserHere();
getSocketManager().addSocketListener("friend_enter", getOnFriendEnterListener());
getSocketManager().addSocketListener("message_received", getOnMessageReceivedListener());
getSocketManager().addSocketListener("friend_quit", getOnFriendQuitListener());
}
private boolean initExtrasOk(){
extras = ((Activity)context).getIntent().getExtras();
if(!isExtrasValid(extras)) {
((Activity) context).finish();
return false;
}else
return true;
}
private boolean isExtrasValid(Bundle extras){
return extras != null && extras.containsKey("CURRENT_USER_ID") && extras.containsKey("FRIEND_USER_ID") && extras.containsKey("COMMING_FROM_CLASS_NAME");
}
private void initFriendUserHere(){
String commingFromClassName = extras.getString("COMMING_FROM_CLASS_NAME");
if(commingFromClassName!=null && commingFromClassName.equals(SearchActivity.class.getName())) {
friendUserHere = true;
postFriendEnterConversation();
}else
friendUserHere = false;
}
private void postFriendEnterConversation(){
HashMap<String, String> paramMap = new HashMap<>();
NamelessRestClient.post("chat/enter", new RequestParams(paramMap), new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
}
});
}
private Emitter.Listener getOnFriendEnterListener(){
return new Emitter.Listener() {
@Override
public void call(Object... args) {
friendUserHere = true;
chatManagerImp.onFriendEnter((JSONObject) args[0]);
}
};
}
private Emitter.Listener getOnMessageReceivedListener(){
return new Emitter.Listener() {
@Override
public void call(Object... args) {
chatManagerImp.onMessageReceived((JSONObject) args[0]);
}
};
}
private Emitter.Listener getOnFriendQuitListener(){
return new Emitter.Listener() {
@Override
public void call(Object... args) {
chatManagerImp.onFriendQuit((JSONObject) args[0]);
}
};
}
public void loadUsers() {
final User[] users = new User[2];
NamelessRestClient.get("users/" + extras.getInt("CURRENT_USER_ID"), null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
users[0] = User.fromJson(response.getJSONObject("data"));
chatManagerImp.onUsersLoaded(users);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
NamelessRestClient.get("users/" + extras.getInt("FRIEND_USER_ID"), null, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
users[1] = User.fromJson(response.getJSONObject("data"));
chatManagerImp.onUsersLoaded(users);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void sendMessage(String messageText){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("messageText", messageText);
NamelessRestClient.post("message", new RequestParams(paramMap), new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
}
});
}
public void sendImage(String filePath){
Bitmap thumbnailBM = chatImageHelper.getBitmap(filePath, 700);
Bitmap fullBM = chatImageHelper.getBitmap(filePath, 1440);
if(thumbnailBM!=null && fullBM !=null) {
chatManagerImp.onImageHandled(thumbnailBM);
ByteArrayInputStream thumbnailIS = chatImageHelper.toByteArray(thumbnailBM);
ByteArrayInputStream fullIS = chatImageHelper.toByteArray(fullBM);
RequestParams params = new RequestParams();
params.put("thumbnail", thumbnailIS, "thumbnail.jpeg");
params.put("full", fullIS, "thumbnail.jpeg");
NamelessRestClient.post("message/image", params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
}
});
}
}
public void changeUserState(final int state){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("state", String.valueOf(state));
RequestParams params = new RequestParams(paramMap);
NamelessRestClient.post("users/states", params, new JsonHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String s, Throwable t ){
chatManagerImp.onStateChanged(false, state);
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
chatManagerImp.onStateChanged(true, state);
}
});
}
public void next(){
friendUserHere = false;
NamelessRestClient.get("chat/next", null, new JsonHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String s, Throwable t ){
canceling = false;
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
try {
if (response.getBoolean("found")) {
User[] users = new User[2];
users[0] = User.fromJson(response.getJSONObject("currentUser").getJSONObject("data"));
users[1] = User.fromJson(response.getJSONObject("friend").getJSONObject("data"));
chatManagerImp.onNextUserFounded(users);
canceling = false;
} else {
search();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
public void search(){
if(!canceling) {
canceling = true;
Intent intentSearchAct = new Intent(context, SearchActivity.class);
context.startActivity(intentSearchAct);
((Activity) context).finish();
}
}
public void close(){
if(!canceling) {
NamelessRestClient.post("chat/stop", null, new JsonHttpResponseHandler() {
@Override
public void onFailure(int statusCode, Header[] headers, String s, Throwable t) {
canceling = false;
}
@Override
public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Intent intentMainAct = new Intent(context, StartActivity.class);
context.startActivity(intentMainAct);
((Activity) context).finish();
}
});
}
}
// TODO uncomment in next update
/*public boolean isFriendUserHere() {
return friendUserHere;
}*/
}
| [
"[email protected]"
] | |
05d1b70812fa2065e1c63133d17dc7eb35d596e1 | 15bd4c02a8e98f9953570ae82407e74adc4e8465 | /cubes-hackerrank/src/main/java/co/com/rappi/cubes/Solution.java | 2fa2c995f85b5a9980af98f161e2475454cdedf5 | [] | no_license | emirfredy/hackerrank | fa2e804763d315feb9a35de65ef3206582812566 | f7b9bed36673c1a2c9e17370c0e4c4e23859ef01 | refs/heads/master | 2021-01-20T02:37:16.025538 | 2017-03-05T03:58:56 | 2017-03-05T03:58:56 | 83,820,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,539 | java | package co.com.rappi.cubes;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import co.com.rappi.cubes.model.Coordinate;
import co.com.rappi.cubes.util.CoordinateUtil;
/**
* For this validation prototype everything will be in one file since
* hackerrank.com receives the source in one file
*
* @author <a href="[email protected]">Emir Cortes Trujillo</a>
*/
@SpringBootApplication
public class Solution {
/** The smallest coordinate that can be used in a cube */
private static final Coordinate MIN = new Coordinate(1, 1, 1);
/** The greatest coordinate that can be used in a cube */
private static final Coordinate MAX = new Coordinate(100, 100, 100);
/**
* Entry Point
*
* @param args
* The arguments sent from command line. Not used in this stage
*/
public static void main(String[] args) {
SpringApplication.run(Solution.class, args);
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
List<BigInteger> sums = new ArrayList<BigInteger>();
for (int i = 0; i < t; i++) {
scanner.nextInt();
Map<Coordinate, BigInteger> coordinateValues = new HashMap<>();
int m = scanner.nextInt();
for (int j = 0; j < m; j++) {
String operation = scanner.next();
if ("UPDATE".equalsIgnoreCase(operation)) {
int x = scanner.nextInt();
int y = scanner.nextInt();
int z = scanner.nextInt();
BigInteger w = new BigInteger(scanner.next());
Coordinate coordinate = new Coordinate(x, y, z);
if (CoordinateUtil.isCoordinateInRange(coordinate, MIN, MAX)) {
coordinateValues.put(coordinate, w);
}
} else if ("QUERY".equalsIgnoreCase(operation)) {
int x1 = scanner.nextInt();
int y1 = scanner.nextInt();
int z1 = scanner.nextInt();
int x2 = scanner.nextInt();
int y2 = scanner.nextInt();
int z2 = scanner.nextInt();
Coordinate c1 = new Coordinate(x1, y1, z1);
Coordinate c2 = new Coordinate(x2, y2, z2);
if (CoordinateUtil.isCoordinateInRange(c1, MIN, MAX)
&& CoordinateUtil.isCoordinateInRange(c2, MIN, MAX) && c1.lessOrEqualThan(c2)) {
BigInteger sum = CoordinateUtil.sumInRange(coordinateValues, c1, c2);
sums.add(sum);
}
}
}
}
for (BigInteger sum : sums) {
System.out.println(sum);
}
scanner.close();
}
}
| [
"emir@emir-XPS-L322X"
] | emir@emir-XPS-L322X |
3d49247fd0393556c19025c13c70e81ec3324781 | 374625b97c1f520f7b7a71e57fed8307a0b782ab | /com/hbm/inventory/gui/GUILaunchPadTier1.java | edf101b35d5f2c78cbd92f52b948de8bd9db8786 | [
"WTFPL"
] | permissive | yeyuluo123/Hbm-s-Nuclear-Tech-GIT | 6a05f45e305b03c36d2b1095ad187e4bcced98c3 | 011b6cf147389f255dc669249d7997ebd97e6e24 | refs/heads/master | 2021-06-13T16:03:10.829430 | 2020-08-13T04:05:56 | 2020-08-13T04:05:56 | 254,438,707 | 0 | 0 | null | 2020-08-05T08:29:01 | 2020-04-09T17:38:26 | Java | UTF-8 | Java | false | false | 2,588 | java | package com.hbm.inventory.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerLaunchPadTier1;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.bomb.TileEntityLaunchPad;
public class GUILaunchPadTier1 extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_launch_pad.png");
private TileEntityLaunchPad diFurnace;
public GUILaunchPadTier1(InventoryPlayer invPlayer, TileEntityLaunchPad tedf) {
super(new ContainerLaunchPadTier1(invPlayer, tedf));
diFurnace = tedf;
this.xSize = 176;
this.ySize = 166;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 53, 160, 16, diFurnace.power, diFurnace.maxPower);
String[] text = new String[] { "First Slot:",
" -Missile (no custom ones!)",
" -Carrier Rocket" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Second Slot:",
" -Target designator for missiles",
" -Satellite payload for the carrier rocket" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int j1 = (int)diFurnace.getPowerScaled(160);
drawTexturedModalRect(guiLeft + 8, guiTop + 53, 8, 166, j1, 16);
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
}
}
| [
"[email protected]"
] | |
d77838a0ca243c06d19107ac0edb56869881802b | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE400_Resource_Exhaustion/s02/CWE400_Resource_Exhaustion__sleep_console_readLine_74a.java | 5f1925bbe31834a1c51808d35df3cc61a894396d | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 7,727 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE400_Resource_Exhaustion__sleep_console_readLine_74a.java
Label Definition File: CWE400_Resource_Exhaustion__sleep.label.xml
Template File: sources-sinks-74a.tmpl.java
*/
/*
* @description
* CWE: 400 Resource Exhaustion
* BadSource: console_readLine Read count from the console using readLine
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks:
* GoodSink: Validate count before using it as a parameter in sleep function
* BadSink : Use count as the parameter for sleep withhout checking it's size first
* Flow Variant: 74 Data flow: data passed in a HashMap from one method to another in different source files in the same package
*
* */
package testcases.CWE400_Resource_Exhaustion.s02;
import testcasesupport.*;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.logging.Level;
public class CWE400_Resource_Exhaustion__sleep_console_readLine_74a extends AbstractTestCase
{
public void bad() throws Throwable
{
int count;
count = Integer.MIN_VALUE; /* Initialize count */
{
InputStreamReader readerInputStream = null;
BufferedReader readerBuffered = null;
/* read user input from console with readLine */
try
{
readerInputStream = new InputStreamReader(System.in, "UTF-8");
readerBuffered = new BufferedReader(readerInputStream);
/* POTENTIAL FLAW: Read count from the console using readLine */
String stringNumber = readerBuffered.readLine();
if (stringNumber != null) // avoid NPD incidental warnings
{
try
{
count = Integer.parseInt(stringNumber.trim());
}
catch(NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception parsing count from string", exceptNumberFormat);
}
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO);
}
finally
{
try
{
if (readerBuffered != null)
{
readerBuffered.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO);
}
try
{
if (readerInputStream != null)
{
readerInputStream.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO);
}
}
}
/* NOTE: Tools may report a flaw here because readerBuffered and readerInputStream are not closed. Unfortunately, closing those will close System.in, which will cause any future attempts to read from the console to fail and throw an exception */
HashMap<Integer,Integer> countHashMap = new HashMap<Integer,Integer>();
countHashMap.put(0, count);
countHashMap.put(1, count);
countHashMap.put(2, count);
(new CWE400_Resource_Exhaustion__sleep_console_readLine_74b()).badSink(countHashMap );
}
public void good() throws Throwable
{
goodG2B();
goodB2G();
}
/* goodG2B() - use GoodSource and BadSink */
private void goodG2B() throws Throwable
{
int count;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
count = 2;
HashMap<Integer,Integer> countHashMap = new HashMap<Integer,Integer>();
countHashMap.put(0, count);
countHashMap.put(1, count);
countHashMap.put(2, count);
(new CWE400_Resource_Exhaustion__sleep_console_readLine_74b()).goodG2BSink(countHashMap );
}
/* goodB2G() - use BadSource and GoodSink */
private void goodB2G() throws Throwable
{
int count;
count = Integer.MIN_VALUE; /* Initialize count */
{
InputStreamReader readerInputStream = null;
BufferedReader readerBuffered = null;
/* read user input from console with readLine */
try
{
readerInputStream = new InputStreamReader(System.in, "UTF-8");
readerBuffered = new BufferedReader(readerInputStream);
/* POTENTIAL FLAW: Read count from the console using readLine */
String stringNumber = readerBuffered.readLine();
if (stringNumber != null) // avoid NPD incidental warnings
{
try
{
count = Integer.parseInt(stringNumber.trim());
}
catch(NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception parsing count from string", exceptNumberFormat);
}
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO);
}
finally
{
try
{
if (readerBuffered != null)
{
readerBuffered.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO);
}
try
{
if (readerInputStream != null)
{
readerInputStream.close();
}
}
catch (IOException exceptIO)
{
IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO);
}
}
}
/* NOTE: Tools may report a flaw here because readerBuffered and readerInputStream are not closed. Unfortunately, closing those will close System.in, which will cause any future attempts to read from the console to fail and throw an exception */
HashMap<Integer,Integer> countHashMap = new HashMap<Integer,Integer>();
countHashMap.put(0, count);
countHashMap.put(1, count);
countHashMap.put(2, count);
(new CWE400_Resource_Exhaustion__sleep_console_readLine_74b()).goodB2GSink(countHashMap );
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"[email protected]"
] | |
5b3b241911fa7b83992a014de5faef322c02407b | 2653a33d0a3e90d53cee1b65884f4164c8bea14a | /library/src/main/java/per/zzch/library/listener/ClickListener.java | ef85b1de3d432926ed04b236a5dbc544f89d1449 | [] | no_license | zzch137160176/WanAndroid | b8fb08e8835c03dbcbff3408e55fd7ef98f40b51 | 7d4cbe5228df7ef2f621e3fcd08438a938594444 | refs/heads/master | 2020-09-05T02:10:30.543627 | 2019-11-12T05:40:45 | 2019-11-12T05:40:45 | 219,953,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package per.zzch.library.listener;
import android.view.View;
/**
* @author :曾佐丞
* @e-mail :[email protected]
* @date :2019/11/11
* @desc :
*/
public interface ClickListener {
/**
* 普通点击的监听
*
* @param v view
*/
void onClick(View v);
}
| [
"[email protected]"
] | |
7e178e1fab7b978e723666d1b69cefcbacde8e16 | abd8ee3afb8a36d046b47df429b91c386097d3ca | /src/Employee.java | 9dbfde010146137a92fb85b99e0f139efb8264df | [] | no_license | jacoob1406/java-booking-application | 7c2074046cba4d993b027c50b9156625fe45f005 | 86188a4de139734ac60a70f90158e48cf1f0409c | refs/heads/master | 2021-05-12T07:04:58.392592 | 2018-01-12T11:49:46 | 2018-01-12T11:49:46 | 117,235,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | import java.io.Serializable;
/**
* A class representing an employee with a first name
* @author Jakub Lemka
* @version 1.0
*/
public class Employee implements Serializable
{
private String name;
/**
* One-argument constructor.
* @param name the employee's name
*/
public Employee(String name)
{
this.name = name;
}
/**
* Gets the employee's name.
* @return the employee's name
*/
public String getName()
{
return name;
}
/**
* Sets the employee's name.
* @param name what the employee's name will be set to
*/
public void setName(String name)
{
this.name = name;
}
/**
* Compares name of two employees
* @param obj the object to compare with
* @return true if the given object is equal to this employee
*/
public boolean equals(Object obj)
{
if (!(obj instanceof Employee))
{
return false;
}
Employee other = (Employee) obj;
return name.equals(other.name);
}
/**
* Returns a string representation of the employee
* @return a string representation of the employee
*/
public String toString()
{
return "" + name;
}
}
| [
"[email protected]"
] | |
f2781a38af47291c71073607ca6ae4414ec45df9 | 2939349e2509fb55f824166dc0ee394bd0dd378c | /curso-java/exercicios/src/fundamentos/operadores/Aritmeticos.java | d39accc4f159e6cc108a70644c723d1ac4d23eb8 | [] | no_license | thiagofb84jp/coding-day-by-day | 5342fd5ab679c578d5fff171aca960a82c64b5ae | a0c9000b18fd4f8dfa70cf51f0c072c407a86a41 | refs/heads/master | 2022-12-26T07:07:53.165477 | 2020-08-31T11:58:15 | 2020-08-31T11:58:15 | 231,764,382 | 2 | 0 | null | 2022-12-11T01:51:35 | 2020-01-04T13:04:46 | HTML | UTF-8 | Java | false | false | 772 | java | package fundamentos.operadores;
public class Aritmeticos {
public static void main(String[] args) {
System.out.println(2 + 3);
double x = 34.56;
double y = 2.2;
System.out.println(x + y);
System.out.println(x - y);
System.out.println(x * y);
System.out.println(x / y + "\n");
int a = 8;
int b = 3;
System.out.println(a + b);
System.out.println(a - b);
System.out.println(a * b);
System.out.println(a / b);
System.out.println(a / (double) b); //Este tipo de operação também é possível, resultando em um double
System.out.println(a / (float) b); //Este tipo de operação também é possível, resultando em um float
System.out.println(a % b);
System.out.println(8 % 3);
System.out.println(x + y - a * b);
}
} | [
"[email protected]"
] | |
9fe732f31c156823cd5ff710a73b155c8bcf64e2 | ea681d4eae4f3603938d52a5e1bc9e5e230f5cab | /lcRound1/src/TwoSum.java | f95ee240bb821e4c0e3f342b1c10eec10e078447 | [] | no_license | ichappysky/eclipse | a71dfa2a13ecfb767ce56a83a07bef8afd8a84e5 | b994bdd1c22755b8062271e7a5365070ebfcc13d | refs/heads/master | 2016-09-08T01:27:22.484973 | 2013-12-16T00:55:02 | 2013-12-16T00:55:02 | 15,214,018 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | import java.util.HashMap;
import java.util.Map;
public class TwoSum {
public int[] twoSum(int[] numbers, int target) {
if (numbers == null || numbers.length < 2) {
return null;
}
Map<Integer, Integer> numToIndexMap = new HashMap<Integer, Integer>();
for (int i = 0; i < numbers.length; i++) {
if (numToIndexMap.containsKey(target - numbers[i])) {
return new int[] { numToIndexMap.get(target - numbers[i]),
i + 1 };
}
numToIndexMap.put(numbers[i], i + 1);
}
return null;
}
} | [
"[email protected]"
] | |
68ffe0a954b2142f58c91da5ad12b756e02e5fa8 | 323022ae8f0659cceb26b73e209c9d1a3d698894 | /app/src/main/java/com/example/giftio/MaleActivity.java | 03615a8986886d97e42f942c4fb2226e2a60c57f | [] | no_license | hibbamehmood/Giftio | b9b7754382266090463ec2f3a9494f0c73b378ab | 680341f7163b677029cdf5198ae46c3ffca84928 | refs/heads/master | 2022-11-18T12:28:19.347457 | 2020-07-15T10:32:36 | 2020-07-15T10:32:36 | 279,837,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,156 | java | package com.example.giftio;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
public class MaleActivity extends AppCompatActivity {
Timer timer;
private Button ready;
ImageView imageView;
Random r;
Integer [] maleimg={
R.drawable.shirt,
R.drawable.perfumeboy,
R.drawable.stud1,
R.drawable.t,
R.drawable.headphone,
R.drawable.boyphonecover,
R.drawable.boywactch,
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_male);
timer=new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
Intent intent=new Intent(MaleActivity.this,ThankyouActivity.class);
startActivity(intent);
finish();
}
} ,3000);
ready=(Button) findViewById(R.id.ready);
imageView=(ImageView) findViewById(R.id.image) ;
r=new Random();
ready.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Animation animation= AnimationUtils.loadAnimation(MaleActivity.this,R.anim.mixed_anim);
ready.startAnimation(animation);
imageView.setImageResource(maleimg[r.nextInt(maleimg.length)]);
// Intent intent = new Intent(MaleActivity.this, ThankyouActivity.class);
// startActivity(intent);
}
}
);
}
}
| [
"[email protected]"
] | |
7eb494cba25f2cc39461aefe2620bf5074ff59fe | 8c934cb7c3e2fbf7d5025b09f1257e5195288950 | /cmz-exercise/src/main/java/com/cmz/concurrent/CountDownLatchDemo.java | 40b01203f29b203bad01db0be7a1f6d131bdf843 | [] | no_license | cmzdandan/cmz-practice | 4529a0141c3c99748dbabac68b7d366bf5f533e4 | 77eb3c4759b560eb1a96bbcd694615c7be07d56a | refs/heads/master | 2021-07-18T15:29:42.297609 | 2019-11-08T10:49:24 | 2019-11-08T10:49:24 | 220,445,608 | 0 | 0 | null | 2020-10-13T17:19:32 | 2019-11-08T10:41:23 | Java | UTF-8 | Java | false | false | 765 | java | package com.cmz.concurrent;
import java.util.concurrent.CountDownLatch;
/**
* @author chen.mz
* @email [email protected]
* @nickname 陈梦洲
* @date 2019/9/9
* @description CountDownLatchDemo
*/
public class CountDownLatchDemo extends Thread {
static CountDownLatch countDownLatch = new CountDownLatch(1);
@Override
public void run() {
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("ThreadName:"+Thread.currentThread().getName());
}
public static void main(String[] args) {
for (int i = 0; i < 1000; i++) {
new CountDownLatchDemo().start();
}
countDownLatch.countDown();
}
}
| [
"[email protected]"
] | |
9ab119b686edae0fc893705144785c09366e1a3e | 017b6dd7d3a526ff1664c3f5734d7943c4a30815 | /src/main/java/com/bfsi/mfi/entity/InitConsole.java | 57e3441c1b117f0aa94e8c50df20e4956d8e9517 | [
"Apache-2.0"
] | permissive | ltphan/egalite-web-service | bfa3418cfecc750303a73c1234dbd237119bc3b1 | 8f47a544b5508a490ef18d45b62621857915c156 | refs/heads/develop | 2021-01-22T00:30:01.371799 | 2016-08-07T18:14:00 | 2016-08-07T18:14:00 | 63,091,292 | 0 | 0 | null | 2016-07-11T18:15:18 | 2016-07-11T18:15:17 | null | UTF-8 | Java | false | false | 4,947 | java | package com.bfsi.mfi.entity;
public class InitConsole extends MaintenanceEntity{
public InitConsole() {
}
private String tgrp1txt1;
private String tgrp1txt2;
private String tgrp1txt3;
private String tgrp1txt4;
private String tgrp1txt5;
private String tgrp1txt6;
private String tgrp2txt1;
private String tgrp2txt2;
private String tgrp2txt3;
private String tgrp2txt4;
private String tgrp3txt1;
private String tgrp3txt2;
private String tgrp3txt3;
private String tgrp3txt4;
private String tgrp4txt1;
private String tgrp4txt2;
private String tgrp4txt3;
private String tgrp4txt4;
private String tgrp5txt1;
private String tgrp5txt2;
private String tgrp5txt3;
private String tgrp5txt4;
private String tgrp6txt1;
private String tgrp6txt2;
private String tgrp6txt3;
private String tgrp6txt4;
private String tgrp7txt1;
private String tgrp7txt2;
private String tgrp7txt3;
private String tgrp7txt4;
public String getTgrp1txt1() {
return tgrp1txt1;
}
public void setTgrp1txt1(String tgrp1txt1) {
this.tgrp1txt1 = tgrp1txt1;
}
public String getTgrp1txt2() {
return tgrp1txt2;
}
public void setTgrp1txt2(String tgrp1txt2) {
this.tgrp1txt2 = tgrp1txt2;
}
public String getTgrp1txt3() {
return tgrp1txt3;
}
public void setTgrp1txt3(String tgrp1txt3) {
this.tgrp1txt3 = tgrp1txt3;
}
public String getTgrp1txt4() {
return tgrp1txt4;
}
public void setTgrp1txt4(String tgrp1txt4) {
this.tgrp1txt4 = tgrp1txt4;
}
public String getTgrp1txt5() {
return tgrp1txt5;
}
public void setTgrp1txt5(String tgrp1txt5) {
this.tgrp1txt5 = tgrp1txt5;
}
public String getTgrp1txt6() {
return tgrp1txt6;
}
public void setTgrp1txt6(String tgrp1txt6) {
this.tgrp1txt6 = tgrp1txt6;
}
public String getTgrp2txt1() {
return tgrp2txt1;
}
public void setTgrp2txt1(String tgrp2txt1) {
this.tgrp2txt1 = tgrp2txt1;
}
public String getTgrp2txt2() {
return tgrp2txt2;
}
public void setTgrp2txt2(String tgrp2txt2) {
this.tgrp2txt2 = tgrp2txt2;
}
public String getTgrp2txt3() {
return tgrp2txt3;
}
public void setTgrp2txt3(String tgrp2txt3) {
this.tgrp2txt3 = tgrp2txt3;
}
public String getTgrp2txt4() {
return tgrp2txt4;
}
public void setTgrp2txt4(String tgrp2txt4) {
this.tgrp2txt4 = tgrp2txt4;
}
public String getTgrp3txt1() {
return tgrp3txt1;
}
public void setTgrp3txt1(String tgrp3txt1) {
this.tgrp3txt1 = tgrp3txt1;
}
public String getTgrp3txt2() {
return tgrp3txt2;
}
public void setTgrp3txt2(String tgrp3txt2) {
this.tgrp3txt2 = tgrp3txt2;
}
public String getTgrp3txt3() {
return tgrp3txt3;
}
public void setTgrp3txt3(String tgrp3txt3) {
this.tgrp3txt3 = tgrp3txt3;
}
public String getTgrp3txt4() {
return tgrp3txt4;
}
public void setTgrp3txt4(String tgrp3txt4) {
this.tgrp3txt4 = tgrp3txt4;
}
public String getTgrp4txt1() {
return tgrp4txt1;
}
public void setTgrp4txt1(String tgrp4txt1) {
this.tgrp4txt1 = tgrp4txt1;
}
public String getTgrp4txt2() {
return tgrp4txt2;
}
public void setTgrp4txt2(String tgrp4txt2) {
this.tgrp4txt2 = tgrp4txt2;
}
public String getTgrp4txt3() {
return tgrp4txt3;
}
public void setTgrp4txt3(String tgrp4txt3) {
this.tgrp4txt3 = tgrp4txt3;
}
public String getTgrp4txt4() {
return tgrp4txt4;
}
public void setTgrp4txt4(String tgrp4txt4) {
this.tgrp4txt4 = tgrp4txt4;
}
public String getTgrp5txt1() {
return tgrp5txt1;
}
public void setTgrp5txt1(String tgrp5txt1) {
this.tgrp5txt1 = tgrp5txt1;
}
public String getTgrp5txt2() {
return tgrp5txt2;
}
public void setTgrp5txt2(String tgrp5txt2) {
this.tgrp5txt2 = tgrp5txt2;
}
public String getTgrp5txt3() {
return tgrp5txt3;
}
public void setTgrp5txt3(String tgrp5txt3) {
this.tgrp5txt3 = tgrp5txt3;
}
public String getTgrp5txt4() {
return tgrp5txt4;
}
public void setTgrp5txt4(String tgrp5txt4) {
this.tgrp5txt4 = tgrp5txt4;
}
public String getTgrp6txt1() {
return tgrp6txt1;
}
public void setTgrp6txt1(String tgrp6txt1) {
this.tgrp6txt1 = tgrp6txt1;
}
public String getTgrp6txt2() {
return tgrp6txt2;
}
public void setTgrp6txt2(String tgrp6txt2) {
this.tgrp6txt2 = tgrp6txt2;
}
public String getTgrp6txt3() {
return tgrp6txt3;
}
public void setTgrp6txt3(String tgrp6txt3) {
this.tgrp6txt3 = tgrp6txt3;
}
public String getTgrp6txt4() {
return tgrp6txt4;
}
public void setTgrp6txt4(String tgrp6txt4) {
this.tgrp6txt4 = tgrp6txt4;
}
public String getTgrp7txt1() {
return tgrp7txt1;
}
public void setTgrp7txt1(String tgrp7txt1) {
this.tgrp7txt1 = tgrp7txt1;
}
public String getTgrp7txt2() {
return tgrp7txt2;
}
public void setTgrp7txt2(String tgrp7txt2) {
this.tgrp7txt2 = tgrp7txt2;
}
public String getTgrp7txt3() {
return tgrp7txt3;
}
public void setTgrp7txt3(String tgrp7txt3) {
this.tgrp7txt3 = tgrp7txt3;
}
public String getTgrp7txt4() {
return tgrp7txt4;
}
public void setTgrp7txt4(String tgrp7txt4) {
this.tgrp7txt4 = tgrp7txt4;
}
}
| [
"[email protected]"
] | |
9be978b4b1b0f84b57b4726c97f34a5c5ad6eb8d | d4dddfeb4dfda19e2d56cb85a55e1009ac15e4cb | /src/main/java/com/nextgen/inventory/dto/ProductDto.java | a09e2800c3831bc82d2e2eddb24f048adc35b76a | [] | no_license | hitesh74/inventory | ceeeac37576ec27726b48aec64d88410a4abe75a | 37c73103a63b9393a8520febe7cb45903e841ca5 | refs/heads/master | 2020-04-05T23:02:51.652731 | 2017-02-23T12:33:22 | 2017-02-23T12:33:22 | 82,925,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package com.nextgen.inventory.dto;
import java.util.Date;
import java.util.List;
import com.nextgen.inventory.enums.ProductStatus;
public class ProductDto {
private Integer productId;
private String name;
private ProductStatus status;
private Date created;
private Date updated;
private List<ItemDto> itemDtos;
private ProductCategoryDto productCategoryDto;
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ProductStatus getStatus() {
return status;
}
public void setStatus(ProductStatus status) {
this.status = status;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public List<ItemDto> getItemDtos() {
return itemDtos;
}
public void setItemDtos(List<ItemDto> itemDtos) {
this.itemDtos = itemDtos;
}
public ProductCategoryDto getProductCategoryDto() {
return productCategoryDto;
}
public void setProductCategoryDto(ProductCategoryDto productCategoryDto) {
this.productCategoryDto = productCategoryDto;
}
}
| [
"[email protected]"
] | |
43245c89fb3873d1604bcfadc549afc60a90b65e | 62f57f013b35df7eaf02105fed90688f601cb118 | /src/main/java/in/nit/dao/IUomDao.java | c9bc23491890e9bd04dfa37e368c15865ff5fd5d | [] | no_license | KumarSantosh-Dev/MyProjectApp | 2cc03ae49fa44e7be1e052fc8483e75aef781335 | 084deb1e7868a6efedd8fd791fe6d752e066e4f8 | refs/heads/master | 2023-03-05T21:03:37.859526 | 2020-04-29T04:06:48 | 2020-04-29T04:06:48 | 243,733,618 | 0 | 0 | null | 2023-02-22T07:42:02 | 2020-02-28T10:13:30 | Java | UTF-8 | Java | false | false | 403 | java | package in.nit.dao;
import java.util.List;
import in.nit.model.Uom;
public interface IUomDao {
Integer saveUom(Uom u);
List<Uom> getAllUoms();
void removeUomById(Integer id);
Uom getOneUom(Integer id);
void updateUom(Uom ob);
List<Object[]> getUomTypeCount();
List<Object[]> getUomIdAndUomModel();
//Validation methods
boolean isUomModelExist(String uomModel);
}
| [
"rajesh@DESKTOP-M4KGAHT"
] | rajesh@DESKTOP-M4KGAHT |
3593326b605e8094ea55482a1dd4ca011c60b300 | d95591a56008df31ca499bb624c07a6f59c3e549 | /src/Strategy/implement/UserController.java | ad66df3e32fcb6f2e4e3e5325346580e41dee8dc | [] | no_license | Van-Do-Git/md2.bai23 | 06d0f818f74d81434bd5f240d595d628280b055f | 3e0b7a8cc3cf227a6b7aa888cbeb76d256ab0dca | refs/heads/master | 2023-07-11T01:16:30.127017 | 2021-08-08T09:31:00 | 2021-08-08T09:31:00 | 393,836,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package Strategy.implement;
public class UserController implements UserStorage {
UserStorage userStorage;
public void setUserStorage(UserStorage userStorage) {
this.userStorage = userStorage;
}
@Override
public void store(User user) {
userStorage.store(user);
}
}
| [
"[email protected]"
] | |
2843c2d74f97bb4d0c1d15f1c93bd435598b91e1 | f94709d63967f195409baf59abff99d59551ebea | /src/main/java/com/condata/conference/repositories/SpeakerRepository.java | d6ef0ce27d9cfb721ca3b4682465ddc8fc1b5de6 | [] | no_license | Aditya-Thakur-Dev/conference | 76c22639bc900b6b83465011960a8797918c7f05 | a0eaab4434306a692df818a7933d6d3eacdd2401 | refs/heads/main | 2023-06-18T13:07:32.189336 | 2021-07-14T10:30:36 | 2021-07-14T10:30:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.condata.conference.repositories;
import com.condata.conference.models.Speaker;
import org.springframework.data.jpa.repository.JpaRepository;
public interface SpeakerRepository extends JpaRepository<Speaker, Long> {
}
| [
"[email protected]"
] | |
83fe0fd84297572570dbd7c8bd106846b7a3ad6e | 1817c327aca5e0590efe81d5f4760daa7c3d7c96 | /src/net/highwayfrogs/editor/file/mof/poly_anim/MOFPartPolyAnimEntryList.java | 2da2b34a2db7b305a2d6651bd5aa623c48e7ea9b | [] | no_license | hellfire3d/FrogLord | 5353ebe17d7b050ee28428c6c42cde0636ef0a7c | 4a2976a13046909c9def93b530e831e3774e41c1 | refs/heads/master | 2022-12-05T22:03:57.630596 | 2019-03-03T10:58:03 | 2019-03-03T10:58:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | package net.highwayfrogs.editor.file.mof.poly_anim;
import lombok.Getter;
import net.highwayfrogs.editor.file.GameObject;
import net.highwayfrogs.editor.file.mof.MOFPart;
import net.highwayfrogs.editor.file.reader.DataReader;
import net.highwayfrogs.editor.file.writer.DataWriter;
import java.util.ArrayList;
import java.util.List;
/**
* Holds anim entries.
* Created by Kneesnap on 1/9/2019.
*/
@Getter
public class MOFPartPolyAnimEntryList extends GameObject {
private List<MOFPartPolyAnimEntry> entries = new ArrayList<>();
private transient int tempSavePointer;
private transient MOFPart parent;
public MOFPartPolyAnimEntryList(MOFPart parent) {
this.parent = parent;
}
@Override
public void load(DataReader reader) {
parent.getLoadAnimEntryListMap().put(reader.getIndex(), this);
parent.getPartPolyAnimLists().add(this);
int entryCount = reader.readInt();
for (int i = 0; i < entryCount; i++) {
MOFPartPolyAnimEntry entry = new MOFPartPolyAnimEntry();
entry.load(reader);
entries.add(entry);
}
}
@Override
public void save(DataWriter writer) {
this.tempSavePointer = writer.getIndex();
writer.writeInt(entries.size());
entries.forEach(entry -> entry.save(writer));
}
}
| [
"[email protected]"
] | |
26a1a5c785506a9ced2eb2d993a539b10fbd903a | 4a5cab4c38204fa97bf2e35b59cfbc1e7a54cdcb | /store/src/main/java/ro/microservices/store/config/OAuth2FeignRequestInterceptor.java | 4118c74fb4428cf5191dfafac0eee20e9df6a78a | [] | no_license | florinvistig/microservices-spring-netflix | 6e855d0500272f68730ce86434cc9589799e567b | 8a445b152bd9d204c7828512a7a4239498d3b45a | refs/heads/master | 2021-01-23T04:28:58.553635 | 2017-09-07T12:42:38 | 2017-09-07T12:42:38 | 102,447,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java | package ro.microservices.store.config;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2ClientContext;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
public class OAuth2FeignRequestInterceptor implements RequestInterceptor {
private static final Logger LOGGER = LoggerFactory.getLogger(OAuth2FeignRequestInterceptor.class);
private static final String AUTHORIZATION_HEADER = "Authorization";
public void apply(RequestTemplate template) {
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) SecurityContextHolder.getContext().getAuthentication().getDetails();
if (template.headers().containsKey(AUTHORIZATION_HEADER)) {
LOGGER.warn("The Authorization token has been already set");
} else if (details == null || details.getTokenValue() == null) {
LOGGER.warn("Can not obtain existing token for request, if it is a non secured request, ignore.");
} else {
LOGGER.debug("Constructing Header {} for Token {}", "Authorization", "Bearer");
template.header(AUTHORIZATION_HEADER, "Bearer " + details.getTokenValue());
}
}
}
| [
"[email protected]"
] | |
517073dedb2ff27e18e5fd708298226bf6ff01ce | 239fc6a332127e45456ec9311c41eca6be4a0d9f | /ssm-pos/src/main/java/com/s3s/ssm/view/printer/PrinterServiceImpl.java | 420b5234656d9eb9bf4ae08fd8ce116ab2e86282 | [] | no_license | hoanglt705/xcafe | b1d3baf30ce679f3e96a471a44e5deea5379832d | 2cc3caccd1be6253748cfface3b694f0fbd9ea82 | refs/heads/master | 2021-08-24T11:17:10.902456 | 2017-12-09T13:29:44 | 2017-12-09T13:29:44 | 111,182,797 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package com.s3s.ssm.view.printer;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import com.s3s.ssm.service.AbstractViewService;
public class PrinterServiceImpl extends AbstractViewService<PrinterDto> {
private static final String LOCAL_SETTING = "C:\\Users\\HoangLe\\address.ser";
@Override
public void saveOrUpdate(PrinterDto dto) {
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(LOCAL_SETTING));) {
oos.writeObject(dto);
} catch (IOException e) {
e.printStackTrace();
}
}
@SuppressWarnings("unused")
@Override
public PrinterDto findOne(Long id) {
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(LOCAL_SETTING))) {
return (PrinterDto) ois.readObject();
} catch (ClassNotFoundException | IOException e) {
return null;
}
}
}
| [
"[email protected]"
] | |
2056750c4659bebc6df83e6f20ed8076d60a4c59 | e6f7e97c89ac7dd4344bc667bcf863a38b834774 | /src/main/java/com/example/petagrama/pojo/Mascota.java | b4e1927895670aff41e99bdd624be80f4383c44e | [] | no_license | kninov/generando_persistencia_modulo_5 | d1e2e22cf90322635e18355820ae95dbbe59188e | aadf9e2af67def6547d7788eb4663cce27aec88e | refs/heads/master | 2022-12-02T22:31:13.081320 | 2020-08-16T04:13:08 | 2020-08-16T04:13:08 | 287,870,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package com.example.petagrama.pojo;
public class Mascota {
private int id ;
private String nombre ;
private int rating;
private int foto;
public Mascota(int foto, String nombre, int rating) {
this.nombre = nombre;
this.rating = rating;
this.foto = foto;
}
public Mascota(){
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
public int getFoto() {
return foto;
}
public void setFoto(int foto) {
this.foto = foto;
}
public int getId() { return id; }
public void setId(int id) { this.id = id; }
} | [
"[email protected]"
] | |
3286dc5556d5af0895686ecf06a5096440afa634 | af6bcbfebbb458e35804c9d62e7f172dadb45420 | /JAVA_BIO/src/format/clustal/ClustalW2Aln.java | 6f0451ee81ff5f3393289d3fc3d1e0e682267c48 | [] | no_license | axrt/JAVA_BIO | f56201916831553cdac5219e24e5fb3e2521fc8e | eba35edd749d19825a10c53a3bca8a8499eff86f | refs/heads/master | 2021-01-22T07:32:12.597597 | 2015-06-18T14:33:29 | 2015-06-18T14:33:29 | 7,707,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,499 | java | package format.clustal;
import java.io.*;
import java.util.*;
/**
* Java Bio is a free open source library for routine bioinformatics tasks.
* Copyright (C) 2013 Alexander Tuzhikov
*
* 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/>.
*/
/**
* A representation of an alignment, done by a ClustalW2
*/
public class ClustalW2Aln extends ClustalAln {
/**
* A header, can be found within the header of the file and indicated the version of the ClustalW2
*/
protected static String CLUSTAL = "CLUSTAL";
/**
* In case a consensus for a column can not be defined, an N gets returned
*/
protected static Character BLANK = 'N';
/**
* A ClustalW2 file format line length
*/
protected static int FORMATTER_LINE_LENGTH = 50;
/**
* Formatter string that separates the name from the sequence within an alignment
*/
protected static String FORMATTER = " ";
/**
* Constructor from field parameters
* @param header {@link String} header, most likely to be CLUSTAL [version]
* @param alignmentLines {@link List} of {@link ClustalAln.AlignmentLine}s that represent the alignment
*/
protected ClustalW2Aln(String header, List<ClustalAln.AlignmentLine> alignmentLines) {
super(header, alignmentLines);
}
/**
*
* @param cutoff {@code double}, a cutoff at which a most frequent
* letter in a column gets accepted as a consensus letter
* @return {@link String} representation of the consensus. In case a column consensus could not be reached, an N substitutes
*/
@Override
public String getConsensus(double cutoff) {
//TODO implement a way to track if a consensus has been calculated at a given cutoff or not so that a redundand recalculation won't occur
//Prepare a StringBuilder
StringBuilder stringBuilder = new StringBuilder();
//For every column within the alignment try finding a consensus
for (int i = 0; i < this.alignmentLines.get(0).getSequence().length(); i++) {
List<Character> column = new ArrayList<>(this.alignmentLines.size());
for (AlignmentLine alignmentLine : this.alignmentLines) {
column.add(alignmentLine.getSequence().charAt(i));
}
//..and appedn the consensus to the builder
stringBuilder.append(ClustalW2Aln.consensusCharAtCutoff(column,cutoff));
}
this.consensus=stringBuilder.toString();
return this.consensus;
}
/**
* Calculates a consensus character out of a given column
* @param characters {@link List} of {@link Character} that represents an alignment column
* @param cutoff {@code double}, if the frequency of a character within a column is over the cutoff,
* the character gets accepted
* @return {@link Character} consensus of it's frequency was over or equals the cutoff, otherwise - 'N'
*/
private static Character consensusCharAtCutoff(List<Character> characters, double cutoff) {
//Calculates a set of characters that occur within a column
Set<Character> characterSet = new HashSet<>(characters);
//Assign every character its frequency with a prepared TreeMap
Map<Double, Character> frequencies = new HashMap<>();
//For every character calculate a frequency
for (Character c : characterSet) {
frequencies.put((double) Collections.frequency(characters, c)/characters.size(), c);
}
//Determine the highest frequency
Double maxFrequency = Collections.max(frequencies.keySet());
//If the maximum frequency is over or equal the cutoff return the character that occurs with that frequency
if (maxFrequency*100 >= cutoff) {
return frequencies.get(maxFrequency);
} else {
//Otherwise return an 'N'
return ClustalW2Aln.BLANK;
}
}
/**
*
* @return {@link String} that is a formatted representation of the alignment
* (just as it is within the alignment file from ClustalW2)
*/
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(this.header);
stringBuilder.append("\n\n\n");
int position = 0;
while (position < this.alignmentLines.get(0).getSequence().length()) {
for (AlignmentLine alignmentLine : this.alignmentLines) {
stringBuilder.append(alignmentLine.getName());
stringBuilder.append(ClustalW2Aln.FORMATTER);
if (position + ClustalW2Aln.FORMATTER_LINE_LENGTH < alignmentLine.getSequence().length()) {
stringBuilder.append(alignmentLine.getSequence().substring(position, position + ClustalW2Aln.FORMATTER_LINE_LENGTH));
stringBuilder.append('\n');
} else {
stringBuilder.append(alignmentLine.getSequence().substring(position, alignmentLine.getSequence().length()));
stringBuilder.append('\n');
}
}
position += ClustalW2Aln.FORMATTER_LINE_LENGTH;
stringBuilder.append('\n');
}
return stringBuilder.substring(0, stringBuilder.length() - 2);
}
/**
* Static factory to get an new instance of an alignment from a ClustalW2 .aln file
* @param alnFile {@link File} that contains a ClustalW2 .aln file
* @return {@link ClustalW2Aln} from a given file
* @throws IOException in case an error occurs during the file read
* @throws AlignmentException in case the given file is corrupt or poorly formatted
*/
public static ClustalW2Aln newInstaceFromFile(File alnFile) throws IOException, AlignmentException {
String header;
String line;
String[] split;
List<String> names = new ArrayList<>();
List<AlignmentLine> alignmentLineList = new ArrayList<>();
List<StringBuilder> sequenceBuilders = new ArrayList<>();
BufferedReader bufferedReader = new BufferedReader(new FileReader(alnFile));
//Get the header
if (!(header = bufferedReader.readLine()).startsWith(ClustalW2Aln.CLUSTAL)) {
throw new AlignmentException("Bad start of aln file. Should contain "
+ "\"" + ClustalW2Aln.CLUSTAL + "\""
+ " Please check if the file was created with Clustal2W.");
}
//Scip the first two lines, which are empty anyways
for (int i = 0; i < 2; i++) {
if ((line = bufferedReader.readLine()).length() > 0) {
throw new AlignmentException("Bad aln file format, please check formatting.");
}
}
//Get a full list of names
while ((line = bufferedReader.readLine()).length() > 0) {
split = line.split(ClustalW2Aln.FORMATTER);
if (split.length >= 1&&!split[0].equals("")) {
names.add(split[0].trim());
sequenceBuilders.add(new StringBuilder(split[1].trim()));
}
}
//Get to the end of file assembling the sequences
int i = 0;
while ((line = bufferedReader.readLine()) != null) {
split = line.split(ClustalW2Aln.FORMATTER);
if (split.length >= 2&&!split[0].equals("")) {
sequenceBuilders.get(i).append(split[split.length-1].trim());
i++;
} else if (split[0].length() == 0) {
i = 0;
}
}
//Convert to AlignmentLines
for (i = 0; i < names.size(); i++) {
alignmentLineList.add(new ClustalAln.AlignmentLine(i, names.get(i), sequenceBuilders.get(i).toString()));
}
return new ClustalW2Aln(header, alignmentLineList);
}
}
| [
"[email protected]"
] | |
89644be191a8becad00d153981dc9edb3b00dee6 | 668dca3f31bd5aee7c6f3bbbd75e120025b79a8b | /entidade/src/main/java/br/com/welson/estoque/menu/entidade/Menu.java | a23f666bab7126c748604e6fb10c70887efa51f0 | [] | no_license | welsonlimawlsn/estoque | 5d3c29cefc358c4a5354c85d003e40bf8b0ce0f9 | 7a5f561d615b6cce443942c425facff63292a7b3 | refs/heads/master | 2023-01-10T23:14:41.803685 | 2020-03-28T19:55:58 | 2020-03-28T19:55:58 | 235,439,274 | 0 | 0 | null | 2023-01-07T16:28:17 | 2020-01-21T20:52:49 | Java | UTF-8 | Java | false | false | 1,488 | java | package br.com.welson.estoque.menu.entidade;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.util.List;
import br.com.welson.estoque.funcionalidade.entidade.Funcionalidade;
@Getter
@Setter
@Entity
@Table(name = "MENU")
@NamedQueries({
@NamedQuery(name = "buscaMenusPai", query = "SELECT m FROM Menu m WHERE menuPai is null"),
@NamedQuery(name = "buscaFilhosPorFuncionalidades",
query = "SELECT m FROM Menu m WHERE m.menuPai = :menuPai AND m.funcionalidade in (:funcionalidades)")
})
public class Menu {
@Id
@Column(name = "ID")
private String id;
@Column(name = "CAMINHO")
private String caminho;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FUNCIONALIDADE")
private Funcionalidade funcionalidade;
@Column(name = "NOME")
private String nome;
@Column(name = "DESCRICAO")
private String descricao;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "MENU_PAI")
private Menu menuPai;
@OneToMany(mappedBy = "menuPai", fetch = FetchType.EAGER)
private List<Menu> menusFilhos;
}
| [
"[email protected]"
] | |
ff5ef54764e92200da2907d0e53925faac10faad | a8fca6d1ea521bd31d50c536bcd40357778c65dd | /2.1_java-fundamentals-course/zhaw_exercises/2.1.007_getänkeautomat/src/com/publicept/edujava/getraenkeautomat/Getraenk.java | 1f3f5fde5b051c5e77d8cca116e08d2800e4f79c | [] | no_license | albiurs/edu_zhaw_java | 40b6c4293518a1987eab1066c977c3d9f86b671f | 8219bc10ec3604242283ce9f3cb97edb9856b688 | refs/heads/master | 2022-12-23T23:21:51.845284 | 2020-09-20T07:18:24 | 2020-09-20T07:18:24 | 269,969,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.publicept.edujava.getraenkeautomat;
/**
* Getänk.
*
* @author Urs Albisser
* @version 0.1
*/
public class Getraenk {
private String name; // Name des Getränks
public Getraenk(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
| [
"[email protected]"
] | |
1538dbb38435eedcae063fbb62f23922532e93b1 | 6db97ca305ccf3a5e243d4b6ad97dd9e4c45d10f | /src/main/java/se/school/ejb/EjbLanguageTable.java | a053b62e62fe8e277b93bb8ed65f94b3b4277b02 | [] | no_license | benols/school | ea4d3e9fb3a6d70e5c5a08e6f2b12c10d8fe48d7 | f75c14ae5aaf92815f90f1f4fa9226bd0c81c7b3 | refs/heads/master | 2020-07-23T15:47:08.774353 | 2016-09-27T12:08:26 | 2016-09-27T12:08:26 | 67,035,450 | 0 | 0 | null | 2016-09-22T13:50:46 | 2016-08-31T12:30:32 | Java | UTF-8 | Java | false | false | 782 | java | package se.school.ejb;
import se.school.classes.LanguageClass;
import se.school.jpa.LanguageTable;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.io.Serializable;
import java.util.List;
/**
* @author Benjamin Olsson
*/
@Stateless
public class EjbLanguageTable implements Serializable{
@PersistenceContext
private EntityManager entityManager;
public List<LanguageTable> getAllLanguages() {
return entityManager.createNamedQuery("selectAllLanguages").getResultList();
}
public void addLanguage(LanguageClass language){
LanguageTable lanTab = new LanguageTable();
lanTab.setLanguage(language.getLanguage());
entityManager.persist(lanTab);
}
}
| [
"[email protected]"
] | |
14c2d25876243a24c4543d8db338a1df8eca04c3 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2019/8/ExceptionDuringFlipKernelException.java | efceec3c08b93c8f1ed10c46e147cf8798a3375e | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 1,067 | java | /*
* Copyright (c) 2002-2019 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.api.exceptions.index;
public final class ExceptionDuringFlipKernelException extends FlipFailedKernelException
{
public ExceptionDuringFlipKernelException( Throwable cause )
{
super( cause, "Failed to transition index to new context: %s", cause.getMessage() );
}
}
| [
"[email protected]"
] | |
97221931991ef6d89de43436458e893db432fb8c | 8560a76650ca805587f48d6b3a616899b262a67c | /src/test/java/tests/day5/TestsForIdLocator.java | 4c948ae267130024e23c22561f73a38b5c751a33 | [] | no_license | naileB/Summer2019OnlineTestSeleniumProject | 01d6e6432557c2ef268d230466811299a855ffa3 | 46801119b23e89ab5ef88257ae2b422295aca3da | refs/heads/master | 2023-05-11T03:43:25.898972 | 2019-12-22T00:12:11 | 2019-12-22T00:12:11 | 229,498,540 | 0 | 0 | null | 2023-05-09T18:19:12 | 2019-12-22T00:11:24 | Java | UTF-8 | Java | false | false | 841 | java | package tests.day5;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import utils.BrowserFactory;
public class TestsForIdLocator {
public static void main(String[] args) {
WebDriver driver = BrowserFactory.getDriver("chrome");
driver.get("http://practice.cybertekschool.com/multiple_buttons");
//id="disappearing_button"
//refresh the page to see that button again
WebElement button = driver.findElement(By.id("disappearing_button"));
button.click();
//<p id="result" style="color:green">Now it's gone!</p>
WebElement result = driver.findElement(By.id("result"));
//Now it's gone!<--- text, .getText() will return this text
System.out.println(result.getText());
driver.quit();
}
}
| [
"[email protected]"
] | |
030fcdd47c1a2ef3af06a4329895846fd35a6bb2 | 3f3623cbe1f74510a8ac226319e44c414d6805ac | /ColorPicker/src/main/java/com/jackz314/colorpicker/slider/AbsCustomSlider.java | 8611f1598552f58ca8868ff841d1f5ad484d6a4f | [
"MIT"
] | permissive | jackz314/ToDo | 4fdeba1c1234f3984033c8edf55aa21456fb6c7a | e59b3c7cd97e83f3366d5b981b4721664e14f6e1 | refs/heads/master | 2021-06-11T06:08:51.326957 | 2020-05-20T21:09:13 | 2020-05-20T21:09:13 | 102,446,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,105 | java | package com.jackz314.colorpicker.slider;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.support.annotation.DimenRes;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.jackz314.colorpicker.R;
public abstract class AbsCustomSlider extends View {
protected Bitmap bitmap;
protected Canvas bitmapCanvas;
protected Bitmap bar;
protected Canvas barCanvas;
protected OnValueChangedListener onValueChangedListener;
protected int barOffsetX;
protected int handleRadius = 20;
protected int barHeight = 5;
protected float value = 1;
private boolean inVerticalOrientation = false;
public AbsCustomSlider(Context context) {
super(context);
init(context, null);
}
public AbsCustomSlider(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public AbsCustomSlider(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
TypedArray styledAttrs = context.getTheme().obtainStyledAttributes(
attrs, R.styleable.AbsCustomSlider, 0, 0);
try {
inVerticalOrientation = styledAttrs.getBoolean(
R.styleable.AbsCustomSlider_inVerticalOrientation, inVerticalOrientation);
} finally {
styledAttrs.recycle();
}
}
protected void updateBar() {
handleRadius = getDimension(R.dimen.default_slider_handler_radius);
barHeight = getDimension(R.dimen.default_slider_bar_height);
barOffsetX = handleRadius;
if (bar == null)
createBitmaps();
drawBar(barCanvas);
invalidate();
}
protected void createBitmaps() {
int width;
int height;
if (inVerticalOrientation) {
width = getHeight();
height = getWidth();
} else {
width = getWidth();
height = getHeight();
}
bar = Bitmap.createBitmap(width - barOffsetX * 2, barHeight, Bitmap.Config.ARGB_8888);
barCanvas = new Canvas(bar);
if (bitmap == null || bitmap.getWidth() != width || bitmap.getHeight() != height) {
if (bitmap != null) bitmap.recycle();
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmapCanvas = new Canvas(bitmap);
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int width;
int height;
if (inVerticalOrientation) {
width = getHeight();
height = getWidth();
canvas.rotate(-90);
canvas.translate(-width, 0);
} else {
width = getWidth();
height = getHeight();
}
if (bar != null && bitmapCanvas != null) {
bitmapCanvas.drawColor(0, PorterDuff.Mode.CLEAR);
bitmapCanvas.drawBitmap(bar, barOffsetX, (height - bar.getHeight()) / 2, null);
float x = handleRadius + value * (width - handleRadius * 2);
float y = height / 2f;
drawHandle(bitmapCanvas, x, y);
canvas.drawBitmap(bitmap, 0, 0, null);
}
}
protected abstract void drawBar(Canvas barCanvas);
protected abstract void onValueChanged(float value);
protected abstract void drawHandle(Canvas canvas, float x, float y);
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
updateBar();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int width = 0;
if (widthMode == MeasureSpec.UNSPECIFIED)
width = widthMeasureSpec;
else if (widthMode == MeasureSpec.AT_MOST)
width = MeasureSpec.getSize(widthMeasureSpec);
else if (widthMode == MeasureSpec.EXACTLY)
width = MeasureSpec.getSize(widthMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int height = 0;
if (heightMode == MeasureSpec.UNSPECIFIED)
height = heightMeasureSpec;
else if (heightMode == MeasureSpec.AT_MOST)
height = MeasureSpec.getSize(heightMeasureSpec);
else if (heightMode == MeasureSpec.EXACTLY)
height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_MOVE: {
if (bar != null) {
if (inVerticalOrientation) {
value = 1 - (event.getY() - barOffsetX) / bar.getWidth();
} else {
value = (event.getX() - barOffsetX) / bar.getWidth();
}
value = Math.max(0, Math.min(value, 1));
onValueChanged(value);
invalidate();
}
break;
}
case MotionEvent.ACTION_UP: {
onValueChanged(value);
if (onValueChangedListener != null)
onValueChangedListener.onValueChanged(value);
invalidate();
}
}
return true;
}
protected int getDimension(@DimenRes int id) {
return getResources().getDimensionPixelSize(id);
}
public void setOnValueChangedListener(OnValueChangedListener onValueChangedListener) {
this.onValueChangedListener = onValueChangedListener;
}
} | [
"[email protected]"
] | |
937d34fd3e4de34f259892426702568da15207f8 | c06d37d2f842c7f72f9a532fc393987dfcbb39dc | /refactoring/src/test/java/me/whiteship/refactoring/_08_shotgun_surgery/_29_inline_class/ShipmentTest.java | 862a41396aaf35c4a4f58e07a3cd01e602cdae94 | [] | no_license | YeongBinByeon/clone_coding | 1fa30abdcfd8c81491bf92115d2a43d8aa545545 | 09fc0c1855bcfbf278ecc350b5ade0797c7130a4 | refs/heads/master | 2023-07-31T03:31:07.727986 | 2023-07-27T19:46:11 | 2023-07-27T19:46:11 | 228,215,948 | 3 | 0 | null | 2023-03-03T21:18:36 | 2019-12-15T16:34:02 | Jupyter Notebook | UTF-8 | Java | false | false | 372 | java | package me.whiteship.refactoring._08_shotgun_surgery._29_inline_class;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class ShipmentTest {
@Test
void trackingInfo() {
Shipment shipment = new Shipment(new TrackingInformation("UPS", "12345"));
assertEquals("UPS: 12345", shipment.getTrackingInfo());
}
} | [
"[email protected]"
] | |
76712e77b5af3ab270c82087656e4bc92a90ce4a | 99ca33ca5270bcc7d6f17d012f202ac7075dce34 | /short-videos-dev/short-videos-dev-pojo/src/main/java/com/miyo/pojo/User.java | 4fe26b28506638adf93f5eeb026add1d47793508 | [] | no_license | loveztw/short-video | d95002aee919d9b3b4c6b579efc3746f39fa9577 | 3af347968fabf03420434ec52ee0fd0bae1658ce | refs/heads/master | 2020-03-22T00:42:13.462801 | 2018-07-07T15:02:11 | 2018-07-07T15:02:11 | 139,260,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,767 | java | package com.miyo.pojo;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Id;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value="用户对象", description="这是用户对象")
public class User {
@ApiModelProperty(hidden=true)
@Id
private String id;
@ApiModelProperty(value="用户名", name="username", example="Lee", required=true)
private String username;
@ApiModelProperty(value="密码", name="password", example="123456", required=true)
private String password;
@ApiModelProperty(value="头像地址", name="faceImage", example="/uid/face/faceimage.jpg")
@Column(name = "face_image")
private String faceImage;
@ApiModelProperty(value="昵称", name="nickname", example="米柚")
private String nickname;
@ApiModelProperty(hidden=true)
@Column(name = "fans_count")
private Integer fansCount;
@ApiModelProperty(hidden=true)
@Column(name = "follow_count")
private Integer followCount;
@ApiModelProperty(hidden=true)
@Column(name = "receive_like_count")
private Integer receiveLikeCount;
@ApiModelProperty(value="性别", name="sex", example="1")
private String sex;
@ApiModelProperty(value="生日", name="birthday", example="2011-01-02")
private Date birthday;
@ApiModelProperty(value="个性签名", name="signature", example="我很丑可是我很温柔")
private String signature;
@ApiModelProperty(hidden=true)
private Integer age;
@ApiModelProperty(hidden=true)
@Column(name = "constellation_id")
private Integer constellationId;
/**
* @return id
*/
public String getId() {
return id;
}
/**
* @param id
*/
public void setId(String id) {
this.id = id;
}
/**
* @return username
*/
public String getUsername() {
return username;
}
/**
* @param username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return password
*/
public String getPassword() {
return password;
}
/**
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return face_image
*/
public String getFaceImage() {
return faceImage;
}
/**
* @param faceImage
*/
public void setFaceImage(String faceImage) {
this.faceImage = faceImage;
}
/**
* @return nickname
*/
public String getNickname() {
return nickname;
}
/**
* @param nickname
*/
public void setNickname(String nickname) {
this.nickname = nickname;
}
/**
* @return fans_count
*/
public Integer getFansCount() {
return fansCount;
}
/**
* @param fansCount
*/
public void setFansCount(Integer fansCount) {
this.fansCount = fansCount;
}
/**
* @return follow_count
*/
public Integer getFollowCount() {
return followCount;
}
/**
* @param followCount
*/
public void setFollowCount(Integer followCount) {
this.followCount = followCount;
}
/**
* @return receive_like_count
*/
public Integer getReceiveLikeCount() {
return receiveLikeCount;
}
/**
* @param receiveLikeCount
*/
public void setReceiveLikeCount(Integer receiveLikeCount) {
this.receiveLikeCount = receiveLikeCount;
}
/**
* @return sex
*/
public String getSex() {
return sex;
}
/**
* @param sex
*/
public void setSex(String sex) {
this.sex = sex;
}
/**
* @return birthday
*/
public Date getBirthday() {
return birthday;
}
/**
* @param birthday
*/
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
/**
* @return signature
*/
public String getSignature() {
return signature;
}
/**
* @param signature
*/
public void setSignature(String signature) {
this.signature = signature;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getConstellationId() {
return constellationId;
}
public void setConstellationId(Integer constellationId) {
this.constellationId = constellationId;
}
} | [
"[email protected]"
] | |
fd4b80286d2ebb85a99743e9552d72f7c757c0cc | 570612b26e5703f38cd318d4774aa30b548d6fba | /lab/src/com/fiorano/testng/EmployeeLogic.java | e17c2f7b83c7a0daf94fce20608a6690d528b4f1 | [] | no_license | praveenvaranasi/lab | e494608ba40d03ab4eedfb5e6873ebaf7801f1d3 | 81ceedecff87856bd4ab9d0edc879935750ffab7 | refs/heads/master | 2020-04-06T05:01:22.912983 | 2018-08-23T11:17:35 | 2018-08-23T11:17:35 | 59,028,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.fiorano.testng;
/**
* Created by Praveen on 12/16/2016.
*/
import com.fiorano.testng.EmployeeDetails;
public class EmployeeLogic
{
public int number(EmployeeDetails employeeDetails)
{
int number=employeeDetails.getId();
return number;
}
public String fn(EmployeeDetails employeeDetails)
{
String fn=employeeDetails.getName();
return fn;
}
}
| [
"[email protected]"
] | |
818054c828dda085b624355667486cdf786b9b0e | 9ce0b43c876cd1a903a54698fc5a89bc021ae28e | /src/main/java/mainUI.java | 5b7b58c443b9ce37080153d256cf9e9a234bb648 | [] | no_license | boogates/WikipediaRevisionViewer | 1935f1ce8af592c4864031ee4e81b9083346da38 | f476b07c9566488ce80c357fd3d871db9d4cd742 | refs/heads/master | 2021-03-05T01:08:03.167381 | 2020-03-14T20:38:28 | 2020-03-14T20:38:28 | 246,082,723 | 0 | 0 | null | 2020-03-09T16:11:35 | 2020-03-09T16:11:35 | null | UTF-8 | Java | false | false | 2,461 | java | import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class mainUI extends JFrame implements ActionListener {
JLabel term;
JTextField input;
JButton fetch;
JLabel recent;
JLabel active;
public mainUI() {
super("Wikipedia Revision Viewer with Swing UI");
UIManager.put("Label.font", new FontUIResource(new Font("Dialog", Font.PLAIN, 20)));
UIManager.put("Button.font", new FontUIResource(new Font("Dialog", Font.PLAIN, 20)));
JPanel panel = new JPanel();
GridBagLayout gridBagLayout = new GridBagLayout();
panel.setLayout(gridBagLayout);
setContentPane(panel);
fetch = new JButton("Fetch");
var fetchConstraints = new GridBagConstraints(1, 0, 1, 1, .25, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 20, 20), 0, 0);
fetch.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
term.setText(input.getText());
}
});
panel.add(fetch, fetchConstraints);
term = new JLabel("");
var termConstraints = new GridBagConstraints(0, 1, 2, 1, 1, .25, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 20, 20), 0, 0);
panel.add(term, termConstraints);
input = new JTextField();
var inputConstraints = new GridBagConstraints(0, 0, 1, 1, 1.75, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 20, 20), 0, 0);
panel.add(input, inputConstraints);
recent = new JLabel("");
var recentConstraints = new GridBagConstraints(0, 3, 1, 2, 1, 1.75, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 20, 20), 0, 0);
panel.add(recent, recentConstraints);
active = new JLabel("");
var activeConstraints = new GridBagConstraints(1, 3, 1, 2, 1, 1.75, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 20, 20), 0, 0);
panel.add(active, activeConstraints);
setPreferredSize(new Dimension(1000, 600));
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setVisible(true);
}
public static void main(String[] args) {
new mainUI();
}
@Override
public void actionPerformed(ActionEvent e) {
}
}
| [
"[email protected]"
] | |
0df54eb28045aa2c3edfe7a0230cab3a4ed59e0e | d837d1e3183df15d2cf6998639af81fc66a91020 | /rabbitmq-demo/src/main/java/com/example/busdemo/rabitmqdemo/topic/SpringTopicEmailConsumer.java | 00a679117cbaebda38ed3e43f78117c2d5455be0 | [] | no_license | JackLijm/springcloud | c23e014ff7fea04635c819331cb2981b8d5c2fe8 | 8d7a6eb54ee4d7d13613325b9b933b0909bdb020 | refs/heads/master | 2022-07-06T09:21:05.120673 | 2020-06-18T10:25:29 | 2020-06-18T10:25:29 | 143,874,095 | 0 | 0 | null | 2022-05-20T21:44:38 | 2018-08-07T13:03:29 | Java | UTF-8 | Java | false | false | 1,504 | java | /**
* <p>文件名称: SpringEmailConsumer.java</p>
* <p>文件描述: </p>
* <p>版权所有: 版权所有(C)2016-</p>
* <p>内容摘要: </p>
* <p>其他说明: </p>
* <p>创建日期: 2020/6/7 10:08 </p>
* <p>完成日期:</p>
* <p>修改记录1:</p>
* <pre>
* 修改日期:
* 版 本 号:
* 修 改 人:
* 修改内容:
* </pre>
* <p>修改记录2:…</p>
*
* @version 1.0
* @author [email protected]
*/
package com.example.busdemo.rabitmqdemo.topic;
import com.example.busdemo.rabitmqdemo.constant.RabbitMqConstant;
import com.example.busdemo.rabitmqdemo.dto.EmailDTO;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
@Slf4j
public class SpringTopicEmailConsumer {
@Transactional(rollbackFor = Exception.class)
@RabbitListener(queues = RabbitMqConstant.TOPIC_EMAIL_QUEUE_NAME)
@RabbitHandler
public void sendEmail(@Payload String content) {
EmailDTO emailDTO = new Gson().fromJson(content,EmailDTO.class);
log.info("收到邮件" + emailDTO);
//剩余消费逻辑
}
}
| [
"[email protected]"
] | |
6d1387d41cfcb9cd8b6688bc613f61a08481fd57 | de514e258a6e368fea5de242ebaadb16b267c332 | /restfuldemo/restfulservicebyspringboot/src/main/java/com/art2cat/dev/restful/utils/AESUtils.java | 0ea1cd16910b6808cf57444f47f16717787de037 | [] | no_license | Art2Cat/JavaDemo | 09e1e10d4bbc13fb80f6afd92e56d4c4bfed3d51 | 08a8a45c3301bfba5856b7edeebf37ebd648111b | refs/heads/master | 2021-06-21T16:40:04.403603 | 2019-08-03T06:14:18 | 2019-08-03T06:14:18 | 104,846,429 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,988 | java | package com.art2cat.dev.restful.utils;
import com.sun.org.apache.xml.internal.security.utils.Base64;
import java.security.SecureRandom;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.SecretKeySpec;
import org.springframework.util.StringUtils;
/**
* Created by Rorschach on 1/14/17 7:49 PM.
*/
public class AESUtils {
private static final String HEX = "0123456789ABCDEF";
private static final String CBC_PKCS5_PADDING = "AES/CBC/PKCS5Padding";
private static final String AES = "AES";
private static final String PBKDF2WITHHMACSHA1 = "PBKDF2WithHmacSHA1";
private static final String ASCII = "ASCII";
private static final char[] HEX_ARRAY = HEX.toCharArray();
private static final int SALT_LENGTH = 32;
private static final int KEY_LENGTH = 128;
private static final int ITERATION_COUNT = 500;
/**
* 生成AES密钥
*
* @return 密钥
*/
public static String generateKey() {
SecureRandom localSecureRandom = new SecureRandom();
byte[] bytesKey = new byte[SALT_LENGTH];
localSecureRandom.nextBytes(bytesKey);
return byteArrayToHexString(bytesKey);
}
/**
* 针对随机生成的密钥进行处理
*
* @param key 密钥
* @return 处理后密钥
*/
private static SecretKeySpec getRawKey(char[] key) throws Exception {
byte[] salt = new byte[SALT_LENGTH];
KeySpec keySpec = new PBEKeySpec(key, salt,
ITERATION_COUNT, KEY_LENGTH);
SecretKeyFactory keyFactory = SecretKeyFactory
.getInstance(PBKDF2WITHHMACSHA1);
byte[] keyBytes = keyFactory.generateSecret(keySpec).getEncoded();
return new SecretKeySpec(keyBytes, AES);
}
/**
* AES加密外部函数
*
* @param key AES Key
* @param unencrypted 需要加密数据
* @return 加密后数据
*/
public synchronized static String encrypt(String key, String unencrypted) {
if (StringUtils.isEmpty(unencrypted)) {
return unencrypted;
}
try {
System.out.println(key + unencrypted);
byte[] result = encrypt(key, unencrypted.getBytes());
System.out.println(new String(result));
return Base64.encode(result);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* AES加密内部处理函数
*
* @param key AES Key
* @param bytes 需要加密的字节流
* @return 加密后的字节流
*/
private synchronized static byte[] encrypt(String key, byte[] bytes) throws Exception {
SecretKeySpec secretKeySpec = getRawKey(key.toCharArray());
Cipher cipher = Cipher.getInstance(CBC_PKCS5_PADDING);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec,
new IvParameterSpec(new byte[cipher.getBlockSize()]));
return cipher.doFinal(bytes);
}
/**
* AES解密外部函数
*
* @param key AES Key
* @param encrypted 已加密数据
* @return 未加密数据
*/
public synchronized static String decrypt(String key, String encrypted) {
if (StringUtils.isEmpty(encrypted)) {
return encrypted;
}
try {
byte[] enc = Base64.decode(encrypted);
byte[] result = decrypt(key, enc);
return new String(result);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* AES解密内部处理函数
*
* @param key AES Key
* @param bytes 需要解密的字节流
* @return 解密后的字节流
*/
private synchronized static byte[] decrypt(String key, byte[] bytes) throws Exception {
SecretKeySpec secretKeySpec = getRawKey(key.toCharArray());
Cipher cipher = Cipher.getInstance(CBC_PKCS5_PADDING);
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec,
new IvParameterSpec(new byte[cipher.getBlockSize()]));
return cipher.doFinal(bytes);
}
public static String byteArrayToHexString(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
String key = new String(hexChars);
return key;
}
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
}
return data;
}
}
| [
"[email protected]"
] | |
c69be51516b06dcce2b90a9a3ac5b35dd0537892 | a6fe6efaa2d110f08bef76ed49a712da2827239d | /1.JavaSyntax/src/com/javarush/task/task08/task0829/Solution.java | ae49fb612c6e6ee7057ef198bd7755fe954163b6 | [] | no_license | CentnerMan/JavaRushTasks | 49760f680035c2b45720ba5d84c7de722ad2e576 | 3c9d6491318de6072a492a2488bfeee2af727e5f | refs/heads/master | 2020-04-10T23:43:00.442604 | 2019-03-25T17:30:59 | 2019-03-25T17:30:59 | 161,362,097 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,540 | java | package com.javarush.task.task08.task0829;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Модернизация ПО
Задача: Программа определяет, какая семья (фамилию) живёт в доме с указанным номером.
Новая задача: Программа должна работать не с номерами домов, а с городами:
Пример ввода:
Москва
Ивановы
Киев
Петровы
Лондон
Абрамовичи
Лондон
Пример вывода:
Абрамовичи
Требования:
1. Программа должна выводить текст на экран.
2. Программа должна считывать значения с клавиатуры.
3. Класс Solution должен содержать один метод.
4. Программа должна вывести фамилию семьи по введенному городу.
*/
public class Solution {
public static void main(String[] args) throws IOException {
// BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//
// // List of addresses
// List<String> addresses = new ArrayList<>();
// while (true) {
// String family = reader.readLine();
// if (family.isEmpty()) break;
//
// addresses.add(family);
// }
//
// // Read the house number
// int houseNumber = Integer.parseInt(reader.readLine());
//
// if (0 <= houseNumber && houseNumber < addresses.size()) {
// String familyName = addresses.get(houseNumber);
// System.out.println(familyName);
// }
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// List of addresses
List<String> addresses = new ArrayList<>();
List<String> family = new ArrayList<>();
String strIn="", strOut="";
while (true) {
strIn = reader.readLine();
if (strIn.isEmpty()) break;
addresses.add(strIn);
strIn = reader.readLine();
if (strIn.isEmpty()) break;
family.add(strIn);
}
strIn = reader.readLine();
for (int i = 0; i < addresses.size(); i++) {
if (addresses.get(i).equals(strIn)) strOut = family.get(i);
}
System.out.println(strOut);
}
}
| [
"[email protected]"
] | |
87cc4170433912787dbcbd6d1f4e15df36217b68 | d0d748713d3ba3d3b27c3d2d0c1c1c07ca180eb8 | /PMDM/tema11_SqliteContentProviders/RecyclerCursor/app/src/test/java/com/example/recyclercursor/ExampleUnitTest.java | 210739f1778a20a045616b7f3a2b49246335b770 | [] | no_license | MahrozJawad/2-DAM | b08d9baf987cff4c1a3f567144d7af786ee3cdcd | 9bf039771f782d6055e39d4b25ff5a8e1b112f23 | refs/heads/master | 2022-04-01T17:13:49.820532 | 2020-02-11T13:15:09 | 2020-02-11T13:15:09 | 218,342,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.example.recyclercursor;
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]"
] | |
fb848f270b92e386acaa4f5ddfa1bd4ab79ccfc7 | b24818a948152b06c7d85ac442e9b37cb6becbbc | /src/main/java/com/ash/experiments/performance/whitespace/Class3586.java | 503b77bc64084da8d6fd8ca115157b9706e10c6c | [] | no_license | ajorpheus/whitespace-perf-test | d0797b6aa3eea1435eaa1032612f0874537c58b8 | d2b695aa09c6066fbba0aceb230fa4e308670b32 | refs/heads/master | 2020-04-17T23:38:39.420657 | 2014-06-02T09:27:17 | 2014-06-02T09:27:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41 | java | public class Class3586 {}
| [
"[email protected]"
] | |
0f9efc593ba3d6ddfb49c3616570f5a8536107b5 | 182ba51f61f881d3e4ae7b5b7599679c25cbe170 | /ProgQuadrado/src/progquadrado/Quadrado.java | a05bae3e2354fe8c907a9d1a06a653cf5928e3ec | [] | no_license | lucasrafael07/NetBeansProjects_LucasRafael | bf53bd417dfb386179cc111f93bc327744c76477 | a5ed74da8d5aadea4ff816296832f0620884be0a | refs/heads/master | 2020-06-01T13:36:18.600126 | 2015-07-04T23:28:14 | 2015-07-04T23:28:14 | 38,311,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | 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 progquadrado;
/**
*
* @author E11-PROF-101
*/
public class Quadrado {
private int lado;
private int area;
private int perim;
public Quadrado(int lado, int area, int perim) {
this.lado = lado;
this.area = area;
this.perim = perim;
}
public void calcularArea() {
this.area = lado * lado;
System.out.println("Área= " + area);
}
public void calcularPerim() {
this.perim = 4 * lado;
System.out.println("Perímetro= " + perim);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.