blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 132
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 28
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
352
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f3ee08b89e49514a8f1f46b36691e62058f71473
|
9e6b6222dd78584066512673760c4ba0d6cc61f9
|
/src/main/java/com/xxx/model/base/controller/DdEmailController.java
|
d34c9e9db18e4fe15c7cb5791ebcb36992a935ef
|
[] |
no_license
|
TimoYihao/duoduo
|
3ef043fedef4c54749ecd6605822339ff6839249
|
824149b30fd5c1c868b3d3020fd6029651f068dd
|
refs/heads/master
| 2020-04-14T11:42:15.320672
| 2019-01-02T09:32:48
| 2019-01-02T09:32:48
| 163,821,091
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,574
|
java
|
package com.xxx.model.base.controller;
import com.xxx.common.bean.Pager;
import com.xxx.common.bean.ResultData;
import com.xxx.common.framework.base.BaseController;
import com.xxx.common.interfaces.Permission;
import com.xxx.model.base.entity.DdEmail;
import com.xxx.model.base.service.DdEmailService;
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 org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
/**
* 邮件通知视图层
*/
@Controller
@RequestMapping("ddEmail")
public class DdEmailController extends BaseController {
@Resource
private DdEmailService ddEmailService;
@ModelAttribute
public DdEmail get(@RequestParam(required=false) Long id) {
if (id != null){
return ddEmailService.selectById(id);
}else{
return new DdEmail();
}
}
//分页列表
@Permission("base:ddEmail:view")
@RequestMapping("page")
public String page(DdEmail ddEmail, Pager<DdEmail> pager, Model model){
Pager<DdEmail> page = ddEmailService.selectPage(ddEmail, pager);
model.addAttribute("pager",page);
model.addAttribute("ddEmail",ddEmail);
return "base/ddEmail/ddEmailPage";
}
//跳转添加编辑页面
@Permission("base:ddEmail:view")
@GetMapping("saveFrom")
public String saveFrom(DdEmail ddEmail,Model model){
model.addAttribute("ddEmail",ddEmail);
return "base/ddEmail/ddEmailSave";
}
//添加编辑操作
@Permission("base:ddEmail:edit")
@ResponseBody
@PostMapping("save")
public ResultData<Object> save(DdEmail ddEmail){
try {
ddEmailService.save(ddEmail);
return success();
} catch (Exception e) {
e.printStackTrace();
return error();
}
}
//删除
@Permission("base:ddEmail:edit")
@ResponseBody
@PostMapping("delById")
public ResultData<Object> delById(Integer id){
try {
ddEmailService.delById(id);
ResultData<Object> success = success();
return success;
} catch (Exception e) {
e.printStackTrace();
return error();
}
}
}
|
[
"15306446382@163.com"
] |
15306446382@163.com
|
c3689097dfd94d6da4170311983b9f013618f21f
|
5991802ece60a70cce60d0fcd82bcdb8700b6438
|
/app/src/main/java/com/example/all_news/businessadapter.java
|
fd6fefc0eec4232fd3f43efeb23692946be2a7f0
|
[] |
no_license
|
sauravkumar-2002/the-news-app
|
37de01e9d63a7ccd2407af83ab686243681bea97
|
d0ebcb5c7f4fc087aaa2a8f4fef13e69ff0edee1
|
refs/heads/master
| 2023-07-09T21:42:10.606842
| 2021-08-09T15:52:26
| 2021-08-09T15:52:26
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,425
|
java
|
package com.example.all_news;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.List;
public class businessadapter extends RecyclerView.Adapter<businessadapter.viewholder> {
List<modelarticles> listnew;
Context context;
public businessadapter(List<modelarticles> listnew, Context context) {
this.listnew = listnew;
this.context = context;
}
@NonNull
@Override
public businessadapter.viewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v= LayoutInflater.from(context).inflate(R.layout.singlerow_general,parent,false);
return new businessadapter.viewholder(v);
}
@Override
public void onBindViewHolder(@NonNull businessadapter.viewholder holder, int position) {
holder.title.setText(listnew.get(position).getTitle());
holder.time.setText(listnew.get(position).getPublishedAt());
holder.author.setText(listnew.get(position).getAuthor());
Glide.with(context)
.load(listnew.get(position).urlToImage)
.into(holder.imageView);
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(context,webview.class);
intent.putExtra("url",listnew.get(position).getUrl());
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return listnew.size();
}
public class viewholder extends RecyclerView.ViewHolder {
TextView title,time,author;
ImageView imageView;
CardView cardView;
public viewholder(@NonNull View itemView) {
super(itemView);
time=itemView.findViewById(R.id.timepgeneral);
title=itemView.findViewById(R.id.titlegeneral);
author=itemView.findViewById(R.id.authorgeneral);
imageView=itemView.findViewById(R.id.img);
cardView=itemView.findViewById(R.id.cvgeneral);
}
}
}
|
[
"https://github.com/sauravkumar-2002/Health-Companion"
] |
https://github.com/sauravkumar-2002/Health-Companion
|
c9f901511994a7834843a7f44d504a2094c24f61
|
3cf01ecc5d511b9454918bf3a9f0b66a02b9f3e4
|
/jdk17/src/main/java/com/parthirecipes/apps/ImmutableTest.java
|
6b97c9ef54e3b65280a77633e4a4380ff39a0a0d
|
[] |
no_license
|
parthirecipes/jdk17
|
cdcc76dffe6cb644decd8df1ba12159de3190055
|
f028c96b3499914aa1a7330f9b904d6180c8dc00
|
refs/heads/master
| 2020-12-24T12:39:41.394064
| 2016-11-08T16:53:04
| 2016-11-08T16:53:04
| 72,970,222
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 458
|
java
|
package com.parthirecipes.apps;
public class ImmutableTest {
public static void main(String[] args) {
Immutable obj1 = new Immutable("Hello");
System.out.println("Immutable value : " + obj1.getName());
}
}
/**
* Immutable class should be
*
* 1. class should be final 2. No setter methods.
*/
final class Immutable {
private String name;
public Immutable(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
|
[
"parthippkn@gmail.com"
] |
parthippkn@gmail.com
|
85afaad87a51b7870671250cd05c6365dda43730
|
e5213d01474fd8dc75b746e34a97925990e8568c
|
/Decrypting a character/Main.java
|
6e3623f001ecce59358a1411f02aee9cc7fd286c
|
[] |
no_license
|
singhaman092/Playground
|
692f0c03d52bdf2aec53baaf0d753a60099a3fe2
|
f7eed4f81d1d74e32fc897a6b97ce9d203a5e102
|
refs/heads/master
| 2020-04-14T14:48:36.705416
| 2019-11-06T17:03:00
| 2019-11-06T17:03:00
| 163,907,639
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 594
|
java
|
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
// Type your code here
Scanner in = new Scanner(System.in);
char ch = in.next().charAt(0);
int key = in.nextInt();
int offset = 0;
if (Character.isUpperCase(ch)) {
offset = ch - 'A';
if (key>offset) ch = (char)(90-key+offset+1);
else ch = (char)(ch - key);
} else {
offset = ch - 'a';
if (key>offset) ch = (char)(122-key+offset+1);
else ch = (char)(ch - key);
}
System.out.println(ch);
}
}
|
[
"46333790+singhaman092@users.noreply.github.com"
] |
46333790+singhaman092@users.noreply.github.com
|
2093a04a3150d2d3dac107d64ab43b2608ef2720
|
22132fd803e28eba37a452b74a5915810525fe87
|
/IntelligentSdkAndriod/Vision/src/main/java/com/microsoft/projectoxford/vision/contract/FaceRectangle.java
|
798e83eeec4855794d1f1a323bbfa31e00211c43
|
[] |
no_license
|
ada-qijia/oxford-intelligent-sdk
|
c105d11a5a8260f70dc0fae965a8bd9b3a052ffa
|
dc945e8db428bda11c5b4fee0c0c6385a59ea045
|
refs/heads/master
| 2021-01-22T15:04:01.541144
| 2015-07-30T05:47:44
| 2015-07-30T05:47:44
| 39,886,177
| 1
| 0
| null | 2015-07-29T09:52:14
| 2015-07-29T09:52:14
| null |
UTF-8
|
Java
| false
| false
| 174
|
java
|
package com.microsoft.projectoxford.vision.contract;
public class FaceRectangle {
public int width;
public int height;
public int left;
public int top;
}
|
[
"zhuohu@microsoft.com"
] |
zhuohu@microsoft.com
|
cbff11ac4268c8138a885be75e283725074f9ab8
|
5ae62c18ae9767b02497eff0f075564b638e5110
|
/src/io/github/SebastianDanielFrenz/WorldEconomyPlugin/gui/guis/BankAccountsGUI.java
|
b61fc3ce3a6b822dd92dd2479ba13c1b1e9177d0
|
[] |
no_license
|
Gogolinolett/WorldEconomyPlugin
|
5288321947a9d88e58c4d8b3ac9bda42c411511c
|
f4e75f5dcc54a26039b3957eef312fceedaae682
|
refs/heads/master
| 2021-01-14T20:48:09.292127
| 2020-02-29T10:15:29
| 2020-02-29T10:15:29
| 242,754,665
| 0
| 0
| null | 2020-02-24T14:16:45
| 2020-02-24T14:16:44
| null |
WINDOWS-1252
|
Java
| false
| false
| 1,679
|
java
|
package io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.guis;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import io.github.SebastianDanielFrenz.WorldEconomyPlugin.WEDB;
import io.github.SebastianDanielFrenz.WorldEconomyPlugin.banking.BankAccount;
import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.BlockLib;
import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.GUIItem;
import io.github.SebastianDanielFrenz.WorldEconomyPlugin.gui.WEGUI;
public class BankAccountsGUI extends WEGUI {
public BankAccountsGUI(WEGUI parent, Player player) {
super(parent, new GUIItem[] {}, "Bank Accounts");
BankAccountsGUI out = this;
List<GUIItem> items = new ArrayList<GUIItem>();
int slot = 9;
items.add(new GUIItem(0, 4, mkItem(Material.OAK_SIGN, "Bank Accounts")) {
@Override
public void event(InventoryClickEvent event) {
}
});
try {
List<BankAccount> bank_accounts = WEDB.getAllBankAccounts(player);
for (BankAccount bank_account : bank_accounts) {
items.add(new GUIItem(slot,
mkItem(BlockLib.BANK_ACCOUNT, bank_account.getName(),
new String[] { "§f" + WEDB.getBank(bank_account.getBankID()).name,
String.valueOf(bank_account.getBalance()) })) {
@Override
public void event(InventoryClickEvent event) {
new BankAccountGUI(out, bank_account).openInventory((Player) event.getWhoClicked());
}
});
slot++;
}
setItems(convert(items));
} catch (SQLException e) {
e.printStackTrace();
setErrorGUI();
}
}
}
|
[
"crash.games.cr.mc.yt@gmail.com"
] |
crash.games.cr.mc.yt@gmail.com
|
4b04a87872e37229de97ed0217fba226062e4c69
|
5fff175cd026ac0b586e1ec6b91944fd3582510f
|
/src/main/java/com/cc/yhzt/service/IPlayersService.java
|
7ac91c0bf27a8b6cfee38b4fffab774ce171f2e1
|
[] |
no_license
|
fengyuan2020/YHZT
|
5ec69d4e7ab144d28a68a03e19c354eac417a119
|
5a4c78eb68bb692ef0a8e2e3f3e2b038eb843455
|
refs/heads/master
| 2021-02-23T12:24:57.060903
| 2020-07-01T23:56:37
| 2020-07-01T23:56:37
| 245,400,319
| 0
| 0
| null | 2020-03-06T11:17:10
| 2020-03-06T11:17:10
| null |
UTF-8
|
Java
| false
| false
| 266
|
java
|
package com.cc.yhzt.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.cc.yhzt.entity.Players;
/**
* <p>
* 服务类
* </p>
*
* @author CC
* @since 2019-05-16
*/
public interface IPlayersService extends IService<Players> {
}
|
[
"mc123@vip.qq.com"
] |
mc123@vip.qq.com
|
162b8937738ff516073027c93aca2fecbfd25554
|
224bb074aabf48782ce50a36769dfad1f5488f9c
|
/week8/hangman/hangman2/Hangman4.java
|
5e14c7d51f2fd2e55cf7c763923ba214a35643d8
|
[] |
no_license
|
cravenormality/Java---CSE110
|
cfc06e4f77a7b370860203eb64ebecab1e1fbce9
|
0f9bf63d2299a991225b8bb3582713027333ae4c
|
refs/heads/master
| 2020-07-23T19:32:39.188189
| 2019-12-19T19:40:10
| 2019-12-19T19:40:10
| 207,683,222
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,338
|
java
|
import java.util.Scanner;
import java.util.ArrayList;
import java.io.File;
import java.io.FileNotFoundException;
public class Hangman4 {
public static void main(String[] args) throws FileNotFoundException {
ArrayList<String> words = readWords();
String word = pickWord(words);
String guesses = "";
Scanner in = new Scanner(System.in);
System.out.println("\nHangman - E. Eckert");
do {
printWord(word, guesses);
guesses = guesses + getUniqueGuess(in, guesses);
} while (!guesses(word, guesses));
printWord(word, guesses);
System.out.println("\nYou guessed it in " + guesses.length() + " tries.");
in.close();
}
private static ArrayList<String> readWords() throws FileNotFoundException {
ArrayList<String> words = new ArrayList<String>();
File inputFile = new File("words.txt");
Scanner in = new Scanner(inputFile);
while (in.hasNext()) {
words.add(in.next());
}
System.out.println("I know " + words.size() + " words.");
in.close();
return words;
}
static String pickWord(ArrayList<String> list) {
int choice = (int) (Math.random() * list.size());
return list.get(choice).toUpperCase();
}
private static boolean guesses(String word, String guesses) {
int cnt = 0;
for (int i = 0; i < word.length(); i++) {
if (guesses.indexOf(word.charAt(i)) >= 0) {
cnt += 1;
}
}
if (cnt == word.length()) {
return true;
} else {
return false;
}
}
private static char getUniqueGuess(Scanner in, String guesses) {
char guess;
do {
System.out.print("Enter a letter");
guess = in.next().charAt(0);
} while (guesses.indexOf(guess) >= 0);
return Character.toUpperCase(guess);
}
private static void printWord(String word, String guesses) {
System.out.print("\n");
for (int i = 0; i < word.length(); i++) {
if (guesses.indexOf(word.charAt(i)) >= 0) {
System.out.print(word.toUpperCase().charAt(i));
} else {
System.out.print(guesses);
}
}
}
}
|
[
"cravenormality@gmail.com"
] |
cravenormality@gmail.com
|
83e125978e2861407928d0d0fbad9e5f7178e1f1
|
0d6ea46c83a6f28b9751ad3cf1ace7bb4e777a5d
|
/sibad_repo_cert_sibad/src/main/java/gob/osinergmin/sibad/domain/builder/UbigeoDPDBuilder.java
|
fa438182dfd7c29f56371b8109bfa9e7b627441b
|
[] |
no_license
|
stevecerdan/SIGUO
|
00c08830aaba7f60e11f208123deb77979b45093
|
6566ab0dbeeccd767536ecc40c9fdc7c3b5d7069
|
refs/heads/master
| 2020-03-08T06:23:28.151263
| 2018-07-15T02:39:23
| 2018-07-15T02:39:23
| 127,970,819
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,700
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gob.osinergmin.sibad.domain.builder;
import gob.osinergmin.sibad.domain.MdiUbigeoDPD;
import gob.osinergmin.sibad.domain.dto.UbigeodpdDTO;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author jpiro
*/
public class UbigeoDPDBuilder {
public static List<UbigeodpdDTO> toListUbigeoDPDDto(List<MdiUbigeoDPD> lista) {
UbigeodpdDTO registroDTO;
List<UbigeodpdDTO> retorno = new ArrayList<UbigeodpdDTO>();
if (lista != null) {
for (MdiUbigeoDPD maestro : lista) {
registroDTO = toUbigeoDPDDto(maestro);
retorno.add(registroDTO);
}
}
return retorno;
}
public static UbigeodpdDTO toUbigeoDPDDto(MdiUbigeoDPD registro) {
UbigeodpdDTO registroDTO = new UbigeodpdDTO();
registroDTO.setIdDepartamento(registro.getIdDepartamento());
registroDTO.setIdProvincia(registro.getIdProvincia());
registroDTO.setIdDistrito(registro.getIdDistrito());
registroDTO.setNombre(registro.getNombre());
return registroDTO;
}
public static MdiUbigeoDPD getUbigeoDPD(UbigeodpdDTO registroDTO) {
MdiUbigeoDPD registro = null;
if(registroDTO!=null){
registro=new MdiUbigeoDPD();
registro.setIdDepartamento(registroDTO.getIdDepartamento());
registro.setIdProvincia(registroDTO.getIdProvincia());
registro.setIdDistrito(registroDTO.getIdDistrito());
registro.setNombre(registroDTO.getNombre());
}
return registro;
}
}
|
[
"steve@steve-HP-Pavilion-g4-Notebook-PC"
] |
steve@steve-HP-Pavilion-g4-Notebook-PC
|
4831545fe3077cbd058c724860b54ccf23f7ac76
|
0f23f45c79cc334a57fd851eee17fc3159b54652
|
/wuyou-music-service/src/main/java/com/service/impl/SongListServiceImpl.java
|
afd75fd8659687bd4334efd28b8ef20f6b57c001
|
[] |
no_license
|
wuyou-Frank/wuyou-music
|
a4cf819a88927f3cf4606107ee6c198ef3cb8b20
|
63418e4fa8736a9f258794408ff0e618640ed3ca
|
refs/heads/master
| 2022-12-22T08:58:03.800769
| 2020-02-11T19:57:00
| 2020-02-11T19:57:00
| 224,414,926
| 1
| 0
| null | 2022-12-15T23:25:05
| 2019-11-27T11:27:14
|
Java
|
UTF-8
|
Java
| false
| false
| 1,286
|
java
|
package com.service.impl;
import com.dao.SongListDao;
import com.entity.SongListEntity;
import com.service.SongListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SongListServiceImpl implements SongListService {
@Autowired
private SongListDao songListDao;
@Override
public List<SongListEntity> getAll(int pageNum, int pageSize,int id) {
return songListDao.getAll(pageNum,pageSize,id);
}
@Override
public SongListEntity getById(int id){
return songListDao.getById(id);
}
@Override
public List<SongListEntity> getByNmae(int pageNum,int pageSize,String name) {
return songListDao.getByName(pageNum,pageSize,name);
}
@Override
public SongListEntity getSong( String slname, String sname, int slid) {
return songListDao.getSong( slname, sname, slid);
}
@Override
public void update(SongListEntity songListEntity) {
songListDao.update(songListEntity);
}
@Override
public void insert(SongListEntity songListEntity) {
songListDao.insert(songListEntity);
}
@Override
public void delete(int id) {
songListDao.delete(id);
}
}
|
[
"1337434971@qq.com"
] |
1337434971@qq.com
|
deb6f3863a47a219dc1758a53db2fb1e9b907817
|
ca115e90fea786d3ccf87cda3cf9fcafaf0c709a
|
/cascading-hadoop/src/main/shared/cascading/tap/hadoop/Dfs.java
|
3baa0c14de71e0723beea373067066dcd17a42f6
|
[
"Apache-2.0"
] |
permissive
|
tdyas/cascading
|
b82d8eebbbac2f071de6441de41ae872b7ef4b0b
|
05720bf78c05d80606f0f81c3e68cc37139b8bda
|
refs/heads/wip-3.0
| 2021-01-18T00:00:39.486664
| 2015-02-25T05:34:29
| 2015-02-25T05:34:29
| 31,339,199
| 0
| 0
| null | 2015-02-25T22:29:51
| 2015-02-25T22:29:51
| null |
UTF-8
|
Java
| false
| false
| 3,762
|
java
|
/*
* Copyright (c) 2007-2014 Concurrent, Inc. All Rights Reserved.
*
* Project and contact information: http://www.cascading.org/
*
* This file is part of the Cascading 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 cascading.tap.hadoop;
import java.beans.ConstructorProperties;
import java.io.IOException;
import java.net.URI;
import cascading.scheme.Scheme;
import cascading.tap.SinkMode;
import cascading.tap.TapException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
/**
* Class Dfs is a {@link cascading.tap.Tap} class that provides access to the Hadoop Distributed File System.
* <p/>
* Use the {@link URI} constructors to specify a different HDFS cluster than the default.
*/
public class Dfs extends Hfs
{
/**
* Constructor Dfs creates a new Dfs instance.
*
* @param scheme of type Scheme
* @param uri of type URI
*/
@ConstructorProperties( {"scheme", "uri"} )
public Dfs( Scheme scheme, URI uri )
{
super( scheme, uri.getPath() );
init( uri );
}
/**
* Constructor Dfs creates a new Dfs instance.
*
* @param scheme of type Scheme
* @param uri of type URI
* @param sinkMode of type SinkMode
*/
@ConstructorProperties( {"scheme", "uri", "sinkMode"} )
public Dfs( Scheme scheme, URI uri, SinkMode sinkMode )
{
super( scheme, uri.getPath(), sinkMode );
init( uri );
}
/**
* Constructor Dfs creates a new Dfs instance.
*
* @param scheme of type Scheme
* @param stringPath of type String
*/
@ConstructorProperties( {"scheme", "stringPath"} )
public Dfs( Scheme scheme, String stringPath )
{
super( scheme, stringPath );
}
/**
* Constructor Dfs creates a new Dfs instance.
*
* @param scheme of type Scheme
* @param stringPath of type String
* @param sinkMode of type SinkMode
*/
@ConstructorProperties( {"scheme", "stringPath", "sinkMode"} )
public Dfs( Scheme scheme, String stringPath, SinkMode sinkMode )
{
super( scheme, stringPath, sinkMode );
}
private void init( URI uri )
{
if( !uri.getScheme().equalsIgnoreCase( "hdfs" ) )
throw new IllegalArgumentException( "uri must use the hdfs scheme" );
setUriScheme( URI.create( uri.getScheme() + "://" + uri.getAuthority() ) );
}
protected void setStringPath( String stringPath )
{
if( stringPath.matches( ".*://.*" ) && !stringPath.startsWith( "hdfs://" ) )
throw new IllegalArgumentException( "uri must use the hdfs scheme" );
super.setStringPath( stringPath );
}
@Override
protected FileSystem getDefaultFileSystem( Configuration configuration )
{
String name = configuration.get( "fs.default.name", "hdfs://localhost:5001/" );
if( name.equals( "local" ) || name.matches( ".*://.*" ) && !name.startsWith( "hdfs://" ) )
name = "hdfs://localhost:5001/";
else if( name.indexOf( '/' ) == -1 )
name = "hdfs://" + name;
try
{
return FileSystem.get( URI.create( name ), configuration );
}
catch( IOException exception )
{
throw new TapException( "unable to get handle to get filesystem for: " + name, exception );
}
}
}
|
[
"chris@wensel.net"
] |
chris@wensel.net
|
d941953971c5cc79a4e8dd56bb83cc6b2877b78c
|
0c2ecc879948b47d549ce2c5c4bd848a0e8916db
|
/interview/src/main/java/practice/MoveZero.java
|
2429219d32a3d24ac0de9b70d29fee3bcd71fa5e
|
[] |
no_license
|
javaguruji/playground
|
bf6c1bb168a12a59ca77624d73ff0941fffe9400
|
909a0dd9e01d9edfcb49df49d1c5b1352431569f
|
refs/heads/master
| 2020-12-04T14:33:02.578192
| 2020-07-19T19:57:49
| 2020-07-19T19:57:49
| 231,801,901
| 0
| 0
| null | 2020-10-13T18:47:34
| 2020-01-04T17:27:37
|
Java
|
UTF-8
|
Java
| false
| false
| 939
|
java
|
package practice;
/**
* @author badrikant.soni
*/
public class MoveZero {
public static void main(String[] args) {
int[] arr = {0,1,0, 3, 12};
int[] moves = move(arr);
for(int move : moves){
System.out.print(move + ",");
}
}
private static int[] move(int[] arr) {
// iterate through the array.
// if you find non zero element, then move them in temp array with same new index
// if you find zero element, increase the counter by 1
// at last add the number zero in last.
int count = 0;
int temp = 0;
for(int i = 0; i < arr.length ; i++){
if(arr[i] != 0){
arr[temp] = arr[i];
temp++;
}else {
count++;
}
}
for(int j = 0; j < count; j++){
arr[temp] = 0;
temp++;
}
return arr;
}
}
|
[
"badrikant.soni@inmobi.com"
] |
badrikant.soni@inmobi.com
|
7f96b7194ded3aa76a268d0c644060d2d79a1043
|
63e6d8eb15a9aebbb085b1bff3466e5603d86d5d
|
/src/main/java/joy/todont/repository/TodoRepositoryCustom.java
|
82693f737d0954b9877b1b3de1b34de57d0b1962
|
[] |
no_license
|
firatgursoy/todont
|
ea031e47bccb5ba63107fa78d1e4c203c5aa77b7
|
c2d033e925624635511d15c1e8391287caccf7fd
|
refs/heads/master
| 2021-01-23T10:07:42.957496
| 2017-06-07T16:11:54
| 2017-06-07T16:11:54
| 93,040,096
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 148
|
java
|
package joy.todont.repository;
import joy.todont.domain.Todo;
/**
* = TodoRepositoryCustom
TODO
*
*/
public interface TodoRepositoryCustom {
}
|
[
"firatgursoy@gmail.com"
] |
firatgursoy@gmail.com
|
9fc61e39b6fdb0509725d9651b84b3781706f260
|
ebbf6f3ef6ce004d1f36bffef01cc747120fa93b
|
/src/main/java/com/stc/thamquan/entities/KetQuaKhaoSatCongTacVien.java
|
de5559186101a3862fdc2415cb1389a45438488d
|
[] |
no_license
|
minhuongquang/khoa-luan-tot-nghiep-be
|
59ad872c84ee90c71897675e16a69c0976c08d0d
|
e4ff09aaca1a499b4f135f41c5529b1809c35c40
|
refs/heads/master
| 2023-06-17T07:25:22.249247
| 2021-07-17T05:04:17
| 2021-07-17T05:04:17
| 386,841,668
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,511
|
java
|
package com.stc.thamquan.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.annotation.*;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
import java.util.List;
/**
* Created by: IntelliJ IDEA
* User : truc
* Date : 6/4/21
* Time : 14:54
* Filename : KetQuaKhaoSatCongTacVien
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Document(collection = "ket-qua-khao-sat-cong-tac-vien")
public class KetQuaKhaoSatCongTacVien {
@Id
private String id;
@DBRef
private ChuyenThamQuan chuyenThamQuan;
@DBRef
private CongTacVien userKhaoSat;
private CauHoiKhaoSatCongTacVien cauHoi; //Embedded
private Date thoiGianTraLoi; // now
private List<String> cauTraLoi;
// với câu chọn CHON_MOT hoặc NHAP_LIEU thì là 1 mảng có 1 phần tử
// với câu SAP_XEP: là mảng đươc sắp xếp theo thứ tự ưu tiên giảm dần (vị trí 0 là ưu tiên)
private boolean trangThai = true;
@JsonIgnore
@CreatedBy
private String createdBy;
@JsonIgnore
@LastModifiedBy
private String lastModifiedBy;
@JsonIgnore
@CreatedDate
private Date createdDate;
@JsonIgnore
@LastModifiedDate
private Date lastModifiedDate;
}
|
[
"uongquangminh1803@gmail.com"
] |
uongquangminh1803@gmail.com
|
c7051f7924078dfb42f297c667298fbb8b05cc33
|
6fbe9087bc1b0e7f6757209141e762bec91b21af
|
/app/src/test/java/com/rianer/secondapp/ExampleUnitTest.java
|
9415897ed76b170063fdc61093588a6f2d647e8a
|
[] |
no_license
|
RianerJacinto/SecondApp
|
7157c9390169292f662b8e4e7671f0175a015b6e
|
ba00760803d98cc0e970407b28cdf69ce440c5b0
|
refs/heads/master
| 2021-01-23T05:55:54.804320
| 2017-09-05T13:14:59
| 2017-09-05T13:14:59
| 102,483,134
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 398
|
java
|
package com.rianer.secondapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"2014070079@ust-ics.mygbiz.com"
] |
2014070079@ust-ics.mygbiz.com
|
a2c8381ff93eccad606acd2604f0fe0191f81f0b
|
9cf44473699b3bfd7c9d7ca7ecc49e315f59b362
|
/app/src/main/java/me/xiezefan/easyim/common/FriendHelper.java
|
993600eeab2e8c7eda5294222c4dcb1504bbb5e7
|
[] |
no_license
|
dlsyj/EasyIM-Android
|
a1595d65e1354dc1bbfb34ac662e5c49cde8a29d
|
a271fa3323682b06ea8b1bce5c96a5fa872e4ece
|
refs/heads/master
| 2021-01-18T12:36:42.513528
| 2015-07-16T13:49:17
| 2015-07-16T13:49:17
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 424
|
java
|
package me.xiezefan.easyim.common;
import android.text.TextUtils;
import me.xiezefan.easyim.dao.Friend;
/**
* Friend Entity Helper
* Created by xiezefan on 15/5/16.
*/
public class FriendHelper {
public String getDisplayName(Friend friend) {
if (TextUtils.isEmpty(friend.getNickname())) {
return friend.getUsername();
} else {
return friend.getNickname();
}
}
}
|
[
"xiezefan@126.com"
] |
xiezefan@126.com
|
6a37d7033ef1776d4b399e0a8445d17169fbfd4e
|
208af5d2219a18e2249178591e30f59dc9ade3d6
|
/src/test/java/com/cosium/vet/gerrit/DefaultPatchSetCommitMessageFactoryTest.java
|
42a655b5076fe990bd0b050d08818ccf53c9bb52
|
[
"MIT"
] |
permissive
|
morristech/vet
|
ccc646aa3e373c9c131613d4a8633594a0a67091
|
2aa297004b5f882195ba76e1612c3f9605f12d43
|
refs/heads/master
| 2020-03-22T09:05:29.984791
| 2018-06-30T11:05:28
| 2018-06-30T11:05:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,788
|
java
|
package com.cosium.vet.gerrit;
import com.cosium.vet.VetVersion;
import com.cosium.vet.git.CommitMessage;
import com.cosium.vet.git.GitClient;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/**
* Created on 08/05/18.
*
* @author Reda.Housni-Alaoui
*/
public class DefaultPatchSetCommitMessageFactoryTest {
private static final String HELLO_WORLD = "Hello World";
private static final String HELLO_WORLD_MULTI_LINES = "Hello\n\nWorld\n!";
private GitClient git;
private DefaultPatchSetCommitMessageFactory tested;
@Before
public void before() {
git = mock(GitClient.class);
tested = new DefaultPatchSetCommitMessageFactory(git);
}
@Test
public void
GIVEN_no_existing_changeid_WHEN_build_commitmessage_THEN_the_change_id_is_part_of_the_message() {
when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD));
CommitMessage commitMessage = tested.build(null);
String rawMessage = commitMessage.toString();
Pattern pattern = Pattern.compile(Pattern.compile("Change-Id: ") + "I(.*)");
Matcher matcher = pattern.matcher(rawMessage);
assertThat(matcher.find()).isTrue();
assertThat(matcher.group(1)).isNotBlank();
}
@Test
public void
WHEN_last_commit_message_hello_world_THEN_commit_message_should_contain_hello_world() {
when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD));
CommitMessage commitMessage = tested.build(null);
assertThat(commitMessage.toString()).contains(HELLO_WORLD);
}
@Test
public void GIVEN_existing_change_WHEN_existing_message_contains_blank_lines_THEN_the_new_message_should_preserve_them() {
when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD_MULTI_LINES));
CommitMessage commitMessage = tested.build(null);
assertThat(commitMessage.toString()).contains(HELLO_WORLD_MULTI_LINES);
}
@Test
public void WHEN_changeid_I1234_THEN_commit_message_should_end_with_I1234() {
Patch patch = mock(Patch.class);
when(patch.getCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD + "\nChange-Id: I1234"));
CommitMessage commitMessage = tested.build(patch);
assertThat(commitMessage.toString()).endsWith("\nChange-Id: I1234");
}
@Test
public void WHEN_existing_change_THEN_commit_message_contains_VET_VERSION() {
when(git.getLastCommitMessage()).thenReturn(CommitMessage.of(HELLO_WORLD));
CommitMessage commitMessage = tested.build(null);
assertThat(commitMessage.toString()).contains("\nVet-Version: " + VetVersion.getValue());
}
}
|
[
"reda.housnialaoui@gmail.com"
] |
reda.housnialaoui@gmail.com
|
e808a1f9aa2ecd98c95286c9aa2012a4ee44f233
|
1dafd0cf9f5ac87e56af1b10448e16c540aacbb5
|
/src/test/java/com/springboot/core/SumOfTwoNumbersApplicationTests.java
|
8a177578144d50f10e487789b62af51f2c5e3f93
|
[] |
no_license
|
dmvali/SumOfTwoNumbersWithSpringBoot
|
75ca1c25c927cd0299a686a5f54114be51ee5a71
|
fd928e0601c4d4875017e1c66184743910cd8de5
|
refs/heads/master
| 2022-04-16T15:45:53.242653
| 2020-04-10T18:39:11
| 2020-04-10T18:39:11
| 254,706,425
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 486
|
java
|
package com.springboot.core;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import com.springboot.core.beans.SumExample;
@SpringBootTest
class SumOfTwoNumbersApplicationTests {
@Autowired
private SumExample sumExample;
@Test
void testSumOfTwoNumbers() {
assertEquals(10, sumExample.add(5, 5));
}
}
|
[
"dmvaliedus@gmail.com"
] |
dmvaliedus@gmail.com
|
e9d90fa66540756cbade4b3d0f9803e2074fa931
|
3b1d9380af6b08a15c932b8aad0d5a34d78a8826
|
/src/main/java/com/brweber2/term/Numeric.java
|
59c2b6700ab1025f6f83fdca0790dd99f02f65a4
|
[] |
no_license
|
brweber2/naive-java-unification
|
55f6b9810f0b5ede779366f9d94cb055dbb21e7d
|
712b1370b9118dba72d603d5b1e80067d0539ec0
|
refs/heads/master
| 2020-06-02T08:36:52.946920
| 2012-01-28T21:01:16
| 2012-01-28T21:01:16
| 3,130,409
| 0
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 812
|
java
|
package com.brweber2.term;
/**
* @author brweber2
* Copyright: 2012
*/
public class Numeric implements Term {
private final String number;
public Numeric(String number) {
this.number = number;
}
@Override
public String prettyPrint() {
return number;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Numeric numeric = (Numeric) o;
if (!number.equals(numeric.number)) return false;
return true;
}
@Override
public int hashCode() {
return number.hashCode();
}
@Override
public String toString() {
return "Numeric{" +
"number='" + number + '\'' +
'}';
}
}
|
[
"brweber2@yahoo.com"
] |
brweber2@yahoo.com
|
bcd56713a227f2449f9b568649195218d359d93f
|
f7453885a521e776ec53a47f8c18e2509eb6578f
|
/src/com/ruslanito/Core/Core_Collection/ArrayListCopyToArrayList.java
|
9314ae89096025c2205a00867cb5658909613e3d
|
[] |
no_license
|
Ruslanito/JavaX
|
e22953b2e091c5f6835ea0baf32772f4c31ffd8e
|
c1598c30c13c08e9c1f950a76e2c334afc69fd86
|
refs/heads/master
| 2020-03-21T08:27:31.952745
| 2018-08-24T14:07:27
| 2018-08-24T14:07:27
| 138,344,964
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 821
|
java
|
package com.ruslanito.Core.Core_Collection;
import java.util.ArrayList;
import java.util.Collections;
public class ArrayListCopyToArrayList {
public static void main(String[] args) {
ArrayList<String> arrayList1 = new ArrayList<String>();
arrayList1.add("1");
arrayList1.add("2");
arrayList1.add("3");
ArrayList<String> arrayList2 = new ArrayList<String>();
arrayList2.add("One");
arrayList2.add("Two");
arrayList2.add("Three");
arrayList2.add("Four");
arrayList2.add("Five");
arrayList2.add("Six");
System.out.println("arrayList1: "+arrayList1);
System.out.println("arrayList2: "+arrayList2);
Collections.copy(arrayList2,arrayList1);
System.out.println("arrsyList2: "+ arrayList2);
}
}
|
[
"breitovo76@gmail.com"
] |
breitovo76@gmail.com
|
fab890c60d4e42609a1c97f1483c4880644de287
|
8238160ccf1059953ee026a387798ae92c40a5e2
|
/src/main/java/com/akos/sphero/common/internal/ids/RobotCommandId.java
|
79a592ca60e3dd71afd421d9bec52487900d11a9
|
[] |
no_license
|
eranor/bcpraca
|
65a38b9a24e186abd0c70982aa2edc36d9aeb86b
|
555f6f74bffe502aa2b847d217c6e1705e0ad9c4
|
refs/heads/master
| 2021-01-15T08:37:18.514461
| 2016-07-17T13:43:14
| 2016-07-17T13:43:14
| 59,164,353
| 0
| 0
| null | 2016-07-17T11:55:19
| 2016-05-19T01:39:20
|
Java
|
UTF-8
|
Java
| false
| false
| 1,660
|
java
|
package com.akos.sphero.common.internal.ids;
/**
* @author: Orbotix
* @author: Ákos Hervay(akoshervay@gmail.com) (modifier)
*/
public enum RobotCommandId implements Id {
CALIBRATE(1),
SET_HEADING(1),
STABILIZATION(2),
ROTATION_RATE(3),
GET_CHASSIS_ID(7),
SELF_LEVEL(9),
SET_DATA_STREAMING(17),
CONFIGURE_COLLISION_DETECTION(18),
CONFIGURE_LOCATOR(19),
READ_LOCATOR(21),
RGB_LED_OUTPUT(32),
BACK_LED_OUTPUT(33),
GET_LED_COLOR(34),
ROLL(48),
BOOST(49),
RAW_MOTOR(51),
SET_MOTION_TIMEOUT(52),
SET_OPTION_FLAGS(53),
GET_OPTION_FLAGS(54),
SET_TEMPORARY_OPTION_FLAGS(55),
GET_TEMPORARY_OPTION_FLAGS(56),
GET_SKU(58),
GET_CONFIGURATION_BLOCK(64),
COMMIT_RAM_TO_FLASH(65),
SET_DEVICE_MODE(66),
GET_DEVICE_MODE(68),
RUN_MACRO(80),
SAVE_TEMPORARY_MACRO(81),
SAVE_MACRO(82),
INIT_MACRO_EXECUTIVE(84),
ABORT_MACRO(85),
SAVE_TEMPORARY_MACRO_CHUNK(88),
ORB_BASIC_ERASE_STORAGE(96),
ORB_BASIC_APPEND_FRAGMENT(97),
ORB_BASIC_EXECUTE_PROGRAM(98),
ORB_BASIC_ABORT_PROGRAM(99),
SUBMIT_VALUE_TO_INPUT_STATEMENT(100),
APPEND_OVAL_COMPLETE(128),
RESET_OVM(129),
APPEND_OVAL_FRAGMENT(131),
GET_ODOMETER(117);
private byte value;
RobotCommandId(int value) {
this.value = (byte) value;
}
public byte getValue() {
return this.value;
}
public static RobotCommandId getRobotCommandId(int value) {
for (RobotCommandId id : values()) {
if (id.value == value) return id;
}
throw new RuntimeException("Illegal Argument - no such id");
}
}
|
[
"akoshervay@gmail.com"
] |
akoshervay@gmail.com
|
ebbf19582e9fbe6b354e5fa8d51715965854bdc2
|
71ed92aa367cec2c793d85f42d8be2031d1fedb9
|
/src/jp/archesporeadventure/main/controllers/ChaosStormController.java
|
cb9958519712934680b9c74a0bdf47545aa3f7ee
|
[] |
no_license
|
Archespore/ArchesporeAdventure
|
5086244ae6facc58050f722157f4ac96472afcbf
|
927fbb5d37440d399e535411fefe3987d8d1c667
|
refs/heads/master
| 2021-07-08T02:47:25.600374
| 2019-02-26T20:51:26
| 2019-02-26T20:51:26
| 141,615,079
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,482
|
java
|
package jp.archesporeadventure.main.controllers;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import jp.archesporeadventure.main.utils.ParticleUtil;
import jp.archesporeadventure.main.utils.PotionEffectUtil;
public class ChaosStormController {
//How many ticks per effect of chaos storm.
private final static int CHAOS_STORM_EFFECT_TICKS_CYCLE = 50;
//How many ticks per particle refresh.
private final static int CHAOS_STORM_PARTICLE_TICKS_CYCLE = 20;
//Chaos storm effect radius
private final static int CHAOS_STORM_EFFECT_RADIUS = 8;
private static Map<Location, Integer> chaosStormMap = new HashMap<>();
/**
* Adds a chaos storm in the world at the specified location for the specified duration.
* @param location the center of the storm.
* @param duration amount of times the effect should go
*/
public static void addStormEffect(Location location, int duration) {
chaosStormMap.put(location, duration);
}
/**
* Removes the chaos storm effect with the center at the specified location.
* @param location the center of the storm to remove.
*/
public static void removeStormEffect(Location location) {
chaosStormMap.remove(location);
}
/**
* Runs the chaos storm effects, creates particles and strikes lightning.
* @param tickCount Used to determine if effects should run.
*/
public static void stormEffect(int tickCount) {
if (tickCount % CHAOS_STORM_PARTICLE_TICKS_CYCLE == 0) {
chaosStormMap.forEach( (location, duration) -> {
for (int loopValue = 0; loopValue < 50; loopValue++) {
double particleAngle = Math.toRadians((360.0 / 50.0) * loopValue);
ParticleUtil.spawnWorldParticles(Particle.VILLAGER_ANGRY, location.clone().add(Math.cos(particleAngle) * CHAOS_STORM_EFFECT_RADIUS, 0, Math.sin(particleAngle) * CHAOS_STORM_EFFECT_RADIUS), 1, .1, 0, .1);
}
for (Entity entity : location.getWorld().getNearbyEntities(location, CHAOS_STORM_EFFECT_RADIUS, CHAOS_STORM_EFFECT_RADIUS, CHAOS_STORM_EFFECT_RADIUS)) {
if (entity instanceof LivingEntity && location.distance(entity.getLocation()) <= CHAOS_STORM_EFFECT_RADIUS) {
LivingEntity entityLiving = (LivingEntity) entity;
PotionEffect newPotionEffect = PotionEffectUtil.comparePotionEffect(new PotionEffect(PotionEffectType.SLOW, 30, 1), entityLiving);
entityLiving.addPotionEffect(newPotionEffect, true);
}
}
});
}
if (tickCount % CHAOS_STORM_EFFECT_TICKS_CYCLE == 0) {
chaosStormMap.forEach( (location, duration) -> {
double offsetAngle = Math.toRadians(ThreadLocalRandom.current().nextDouble(360));
double offsetLength = ThreadLocalRandom.current().nextDouble(CHAOS_STORM_EFFECT_RADIUS);
Location stormEffect = location.clone().add(Math.cos(offsetAngle) * offsetLength, 0, Math.sin(offsetAngle) * offsetLength);
World stormWorld = stormEffect.getWorld();
stormWorld.spigot().strikeLightning(stormEffect, true);
stormWorld.createExplosion(stormEffect.getX(), stormEffect.getY(), stormEffect.getZ(), 1.5f, false, false);
chaosStormMap.put(location, duration - 1);
});
chaosStormMap.entrySet().removeIf( entry -> entry.getValue() <= 0);
}
}
}
|
[
"Jarredhp@gmail.com"
] |
Jarredhp@gmail.com
|
f5af13e81ae8226c2fb3b3745badd2830a061f9d
|
96a24b3d53f0d6d3a95ec2db6a419f1828ee3ddf
|
/server/src/main/java/ru/hsHelper/api/services/impl/UserServiceImpl.java
|
b24c916e7dd18dd599caa15b24bba1c8f442a25e
|
[
"MIT"
] |
permissive
|
HSHelper/HSHelper
|
ae29fb82a6edc42f7d961f6373f8d75c5d94ba93
|
8ad2f5227325a4da263209b0fcd7ab6f89ae7780
|
refs/heads/main
| 2023-07-17T05:22:48.988453
| 2021-09-08T12:26:40
| 2021-09-08T12:26:40
| 344,596,407
| 2
| 5
|
MIT
| 2021-06-17T09:53:14
| 2021-03-04T20:09:31
|
Java
|
UTF-8
|
Java
| false
| false
| 17,465
|
java
|
package ru.hsHelper.api.services.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ru.hsHelper.api.entities.Course;
import ru.hsHelper.api.entities.CoursePart;
import ru.hsHelper.api.entities.Group;
import ru.hsHelper.api.entities.Notification;
import ru.hsHelper.api.entities.Partition;
import ru.hsHelper.api.entities.User;
import ru.hsHelper.api.entities.UserCoursePartRole;
import ru.hsHelper.api.entities.UserCourseRole;
import ru.hsHelper.api.entities.UserGroupRole;
import ru.hsHelper.api.entities.UserToPartition;
import ru.hsHelper.api.entities.UserWork;
import ru.hsHelper.api.entities.Work;
import ru.hsHelper.api.repositories.CoursePartRepository;
import ru.hsHelper.api.repositories.CourseRepository;
import ru.hsHelper.api.repositories.GroupRepository;
import ru.hsHelper.api.repositories.NotificationRepository;
import ru.hsHelper.api.repositories.PartitionRepository;
import ru.hsHelper.api.repositories.UserCoursePartRoleRepository;
import ru.hsHelper.api.repositories.UserCourseRoleRepository;
import ru.hsHelper.api.repositories.UserGroupRoleRepository;
import ru.hsHelper.api.repositories.UserRepository;
import ru.hsHelper.api.repositories.UserToPartitionRepository;
import ru.hsHelper.api.repositories.UserWorkRepository;
import ru.hsHelper.api.repositories.WorkRepository;
import ru.hsHelper.api.requests.update.UserUpdateRequest;
import ru.hsHelper.api.requests.update.UserWorkUpdateRequest;
import ru.hsHelper.api.services.UserService;
import ru.hsHelper.api.services.impl.util.UserCoursePartService;
import ru.hsHelper.api.services.impl.util.UserCourseService;
import ru.hsHelper.api.services.impl.util.UserGroupService;
import ru.hsHelper.api.services.impl.util.UserPartitionService;
import ru.hsHelper.api.services.impl.util.UserWorkService;
import java.util.Date;
import java.util.Set;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class UserServiceImpl implements UserService {
private final UserRepository userRepository;
private final GroupRepository groupRepository;
private final UserGroupRoleRepository userGroupRoleRepository;
private final PartitionRepository partitionRepository;
private final UserToPartitionRepository userToPartitionRepository;
private final CourseRepository courseRepository;
private final UserCourseRoleRepository userCourseRoleRepository;
private final CoursePartRepository coursePartRepository;
private final UserCoursePartRoleRepository userCoursePartRoleRepository;
private final WorkRepository workRepository;
private final UserWorkRepository userWorkRepository;
private final UserGroupService userGroupService;
private final UserCourseService userCourseService;
private final UserCoursePartService userCoursePartService;
private final UserPartitionService userPartitionService;
private final UserWorkService userWorkService;
private final NotificationRepository notificationRepository;
@Autowired
public UserServiceImpl(UserRepository userRepository, GroupRepository groupRepository,
UserGroupRoleRepository userGroupRoleRepository,
PartitionRepository partitionRepository,
UserToPartitionRepository userToPartitionRepository,
CourseRepository courseRepository, UserCourseRoleRepository userCourseRoleRepository,
CoursePartRepository coursePartRepository,
UserCoursePartRoleRepository userCoursePartRoleRepository, WorkRepository workRepository,
UserWorkRepository userWorkRepository, UserGroupService userGroupService,
UserCourseService userCourseService, UserCoursePartService userCoursePartService,
UserPartitionService userPartitionService, UserWorkService userWorkService, NotificationRepository notificationRepository) {
this.userRepository = userRepository;
this.groupRepository = groupRepository;
this.userGroupRoleRepository = userGroupRoleRepository;
this.userCoursePartService = userCoursePartService;
this.partitionRepository = partitionRepository;
this.userToPartitionRepository = userToPartitionRepository;
this.courseRepository = courseRepository;
this.userCourseRoleRepository = userCourseRoleRepository;
this.coursePartRepository = coursePartRepository;
this.userCoursePartRoleRepository = userCoursePartRoleRepository;
this.workRepository = workRepository;
this.userWorkRepository = userWorkRepository;
this.userGroupService = userGroupService;
this.userCourseService = userCourseService;
this.userPartitionService = userPartitionService;
this.userWorkService = userWorkService;
this.notificationRepository = notificationRepository;
}
@Transactional
@Override
public User createUser(User user) {
return userRepository.save(user);
}
@Transactional
@Override
public void deleteUser(long userId) {
User user = getUserById(userId);
Set<UserGroupRole> userGroupRoles = userGroupRoleRepository.findAllByUser(user);
for (UserGroupRole userGroupRole : userGroupRoles) {
userGroupRole.removeUserGroupAndRoles();
}
userGroupRoleRepository.deleteAllByUser(user);
Set<UserToPartition> userToPartitions = userToPartitionRepository.findAllByUser(user);
for (UserToPartition userToPartition : userToPartitions) {
userToPartition.removePartitionAndUser();
}
userToPartitionRepository.deleteAllByUser(user);
Set<UserCourseRole> userCourseRoles = userCourseRoleRepository.findAllByUser(user);
for (UserCourseRole userCourseRole : userCourseRoles) {
userCourseRole.removeUserCourseAndRoles();
}
userCourseRoleRepository.deleteAllByUser(user);
Set<UserCoursePartRole> userCoursePartRoles = userCoursePartRoleRepository.findAllByUser(user);
for (UserCoursePartRole userCoursePartRole : userCoursePartRoles) {
userCoursePartRole.removeUserCoursePartAndRoles();
}
userCoursePartRoleRepository.deleteAllByUser(user);
Set<UserWork> userWorks = userWorkRepository.findAllByUser(user);
for (UserWork userWork : userWorks) {
userWork.removeUserAndWork();
}
userWorkRepository.deleteAll(userWorks);
for (Notification notification : user.getNotifications()) {
notification.removeUser(user);
}
userRepository.delete(user);
}
@Transactional
@Override
public User updateUser(long userId, UserUpdateRequest updateRequest) {
User user = userRepository.findById(userId).orElseThrow(() ->
new IllegalArgumentException("No user with such id"));
user.setFirstName(updateRequest.getFirstName());
user.setLastName(updateRequest.getLastName());
user.setEmail(updateRequest.getEmail());
user.setFirebaseMessagingToken(updateRequest.getToken());
return userRepository.save(user);
}
@Transactional(readOnly = true)
@Override
public User getUserById(long userId) {
return userRepository.findById(userId).orElseThrow(() ->
new IllegalArgumentException("No user with such id"));
}
@Transactional
@Override
public User addGroups(long userId, Set<Long> groupIds, Map<Long, Set<Long>> roleIds) {
User user = getUserById(userId);
Set<Group> groups = groupRepository.findAllByIdIn(groupIds);
for (Group group : groups) {
userGroupService.createUserGroupRole(user, group, roleIds.get(group.getId()));
}
return user;
}
@Transactional
@Override
public User deleteGroups(long userId, Set<Long> groupIds) {
User user = getUserById(userId);
Set<Group> groups = groupRepository.findAllByIdIn(groupIds);
Set<UserGroupRole> userGroupRoles = userGroupRoleRepository.findAllByUserAndGroupIn(user, groups);
for (UserGroupRole userGroupRole : userGroupRoles) {
userGroupRole.removeUserGroupAndRoles();
}
userGroupRoleRepository.deleteAllByUserAndGroupIn(user, groups);
return user;
}
@Transactional
@Override
public User addToPartitions(long userId, Set<Long> partitionIds, Map<Long, Integer> userParts) {
User user = getUserById(userId);
Set<Partition> partitions = partitionRepository.findAllByIdIn(partitionIds);
for (Partition partition : partitions) {
UserToPartition userToPartition = userToPartitionRepository.save(
new UserToPartition(user, partition, userParts.get(partition.getId())));
partition.addUser(userToPartition);
user.addPartition(userToPartition);
}
return user;
}
@Transactional
@Override
public User deletePartitions(long userId, Set<Long> partitionIds) {
User user = getUserById(userId);
Set<Partition> partitions = partitionRepository.findAllByIdIn(partitionIds);
Set<UserToPartition> userToPartitions = userToPartitionRepository.findAllByUserAndPartitionIn(user, partitions);
for (UserToPartition userToPartition : userToPartitions) {
userToPartition.removePartitionAndUser();
}
userToPartitionRepository.deleteAllByUserAndPartitionIn(user, partitions);
return user;
}
@Transactional
@Override
public User addCourses(long userId, Set<Long> courseIds, Map<Long, Set<Long>> roleIds) {
User user = getUserById(userId);
Set<Course> courses = courseRepository.findAllByIdIn(courseIds);
for (Course course : courses) {
userCourseService.createUserCourseRole(user, course, roleIds.get(course.getId()));
}
return user;
}
@Transactional
@Override
public User deleteCourses(long userId, Set<Long> courseIds) {
User user = getUserById(userId);
Set<Course> courses = courseRepository.findAllByIdIn(courseIds);
Set<UserCourseRole> userCourseRoles = userCourseRoleRepository.findAllByUserAndCourseIn(user, courses);
for (UserCourseRole userCourseRole : userCourseRoles) {
userCourseRole.removeUserCourseAndRoles();
}
userCourseRoleRepository.deleteAllByUserAndCourseIn(user, courses);
return user;
}
@Transactional
@Override
public User addCourseParts(long userId, Set<Long> coursePartIds, Map<Long, Set<Long>> roleIds) {
User user = getUserById(userId);
Set<CoursePart> courseParts = coursePartRepository.findAllByIdIn(coursePartIds);
for (CoursePart coursePart : courseParts) {
userCoursePartService.createUserCoursePartRole(user, coursePart, roleIds.get(coursePart.getId()));
}
return user;
}
@Transactional
@Override
public User deleteCourseParts(long userId, Set<Long> coursePartIds) {
User user = getUserById(userId);
Set<CoursePart> coursesParts = coursePartRepository.findAllByIdIn(coursePartIds);
Set<UserCoursePartRole> userCoursePartRoles =
userCoursePartRoleRepository.findAllByUserAndCoursePartIn(user, coursesParts);
for (UserCoursePartRole userCoursePartRole : userCoursePartRoles) {
userCoursePartRole.removeUserCoursePartAndRoles();
}
userCoursePartRoleRepository.deleteAllByUserAndCoursePartIn(user, coursesParts);
return user;
}
@Transactional
@Override
public User addWorks(long userId, Set<Long> workIds, Map<Long, String> solutions) {
User user = getUserById(userId);
Set<Work> works = workRepository.findAllByIdIn(workIds);
for (Work work : works) {
UserWork userWork = userWorkRepository.save(new UserWork(user, work,
new Date(), solutions.get(work.getId())));
user.addWork(userWork);
work.addUser(userWork);
}
return user;
}
@Transactional
@Override
public User deleteWorks(long userId, Set<Long> workIds) {
User user = getUserById(userId);
Set<Work> works = workRepository.findAllByIdIn(workIds);
Set<UserWork> userWorks = userWorkRepository.findAllByUserAndWorkIn(user, works);
for (UserWork userWork : userWorks) {
userWork.removeUserAndWork();
}
userWorkRepository.deleteAll(userWorks);
return user;
}
@Transactional(readOnly = true)
@Override
public Set<User> getAllUsers() {
return userRepository.findAll();
}
@Transactional(readOnly = true)
@Override
public User getUserByEmail(String email) {
return userRepository.findByEmail(email).orElseThrow(
() -> new IllegalArgumentException("No user with such email")
);
}
@Transactional(readOnly = true)
@Override
public UserGroupRole getUserGroupRole(long userId, long groupId) {
return userGroupService.getUserGroupRole(userId, groupId);
}
@Transactional(readOnly = true)
@Override
public Set<UserGroupRole> getAllUserGroupRoles(long userId) {
return userGroupRoleRepository.findAllByUser(getUserById(userId));
}
@Transactional(readOnly = true)
@Override
public UserToPartition getUserToPartition(long userId, long partitionId) {
return userPartitionService.getUserToPartition(userId, partitionId);
}
@Transactional(readOnly = true)
@Override
public Set<UserToPartition> getAllUserToPartitions(long userId) {
return userToPartitionRepository.findAllByUser(getUserById(userId));
}
@Transactional(readOnly = true)
@Override
public UserCourseRole getUserCourseRole(long userId, long courseId) {
return userCourseService.getUserCourseRole(userId, courseId);
}
@Transactional(readOnly = true)
@Override
public Set<UserCourseRole> getAllUserCourseRoles(long userId) {
return userCourseRoleRepository.findAllByUser(getUserById(userId));
}
@Transactional(readOnly = true)
@Override
public UserCoursePartRole getUserCoursePartRole(long userId, long coursePartId) {
return userCoursePartService.getUserCoursePartRole(userId, coursePartId);
}
@Transactional(readOnly = true)
@Override
public Set<UserCoursePartRole> getAllUserCoursePartRoles(long userId) {
return userCoursePartRoleRepository.findAllByUser(getUserById(userId));
}
@Transactional(readOnly = true)
@Override
public UserWork getUserWork(long userId, long workId) {
return userWorkService.getUserWork(userId, workId);
}
@Transactional(readOnly = true)
@Override
public Set<UserWork> getAllUserWorks(long userId) {
return userWorkRepository.findAllByUser(getUserById(userId));
}
@Override
public UserWork updateUserWork(long userId, long workId, UserWorkUpdateRequest userWorkUpdateRequest) {
return userWorkService.updateUserWork(userId, workId, userWorkUpdateRequest);
}
@Transactional
@Override
public User addNotifications(long userId, Set<Long> notificationsIds) {
User user = getUserById(userId);
Set<Notification> notifications = notificationRepository.findAllByIdIn(notificationsIds);
for (Notification notification : notifications) {
notification.addUser(user);
user.addNotification(notification);
}
return user;
}
@Transactional
@Override
public User deleteNotifications(long userId, Set<Long> notificationIds) {
User user = getUserById(userId);
Set<Notification> notifications = notificationRepository.findAllByIdIn(notificationIds);
for (Notification notification : notifications) {
notification.removeUser(user);
user.removeNotification(notification);
}
return user;
}
@Transactional(readOnly = true)
@Override
public Set<Notification> getAllNotifications(long userId) {
return getUserById(userId).getNotifications();
}
@Transactional(readOnly = true)
@Override
public Set<UserWork> getAllUserWorksByGroup(long userId, long groupId) {
return getAllUserWorks(userId).stream().
filter(userWork -> userWork.getWork().getCoursePart().getCourse().getGroup().getId() == groupId).
collect(Collectors.toSet());
}
@Transactional(readOnly = true)
@Override
public Set<UserWork> getAllUserWorksByCourse(long userId, long courseId) {
return getAllUserWorks(userId).stream().
filter(userWork -> userWork.getWork().getCoursePart().getCourse().getId() == courseId).
collect(Collectors.toSet());
}
@Transactional(readOnly = true)
@Override
public Set<UserWork> getAllUserWorksByCoursePart(long userId, long coursePartId) {
return getAllUserWorks(userId).stream().
filter(userWork -> userWork.getWork().getCoursePart().getId() == coursePartId).
collect(Collectors.toSet());
}
}
|
[
"e2e4b6b7@gmail.com"
] |
e2e4b6b7@gmail.com
|
7805df93b6db942f1bdbb7a70ff37107ad1da0f2
|
71071f98d05549b67d4d6741e8202afdf6c87d45
|
/files/Spring_Data_Redis/DATAREDIS-314/src/main/java/org/springframework/data/redis/support/collections/DefaultRedisZSet.java
|
c900ecb78de680b11ac3522c8d072c4259df72d2
|
[] |
no_license
|
Sun940201/SpringSpider
|
0adcdff1ccfe9ce37ba27e31b22ca438f08937ad
|
ff2fc7cea41e8707389cb62eae33439ba033282d
|
refs/heads/master
| 2022-12-22T09:01:54.550976
| 2018-06-01T06:31:03
| 2018-06-01T06:31:03
| 128,649,779
| 1
| 0
| null | 2022-12-16T00:51:27
| 2018-04-08T14:30:30
|
Java
|
UTF-8
|
Java
| false
| false
| 6,720
|
java
|
/*
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.redis.support.collections;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;
import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.core.BoundZSetOperations;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.ZSetOperations.TypedTuple;
/**
* Default implementation for {@link RedisZSet}. Note that the collection support works only with normal,
* non-pipeline/multi-exec connections as it requires a reply to be sent right away.
*
* @author Costin Leau
*/
public class DefaultRedisZSet<E> extends AbstractRedisCollection<E> implements RedisZSet<E> {
private final BoundZSetOperations<String, E> boundZSetOps;
private double defaultScore = 1;
private class DefaultRedisSortedSetIterator extends RedisIterator<E> {
public DefaultRedisSortedSetIterator(Iterator<E> delegate) {
super(delegate);
}
protected void removeFromRedisStorage(E item) {
DefaultRedisZSet.this.remove(item);
}
}
/**
* Constructs a new <code>DefaultRedisZSet</code> instance with a default score of '1'.
*
* @param key
* @param operations
*/
public DefaultRedisZSet(String key, RedisOperations<String, E> operations) {
this(key, operations, 1);
}
/**
* Constructs a new <code>DefaultRedisSortedSet</code> instance.
*
* @param key
* @param operations
* @param defaultScore
*/
public DefaultRedisZSet(String key, RedisOperations<String, E> operations, double defaultScore) {
super(key, operations);
boundZSetOps = operations.boundZSetOps(key);
this.defaultScore = defaultScore;
}
/**
* Constructs a new <code>DefaultRedisZSet</code> instance with a default score of '1'.
*
* @param boundOps
*/
public DefaultRedisZSet(BoundZSetOperations<String, E> boundOps) {
this(boundOps, 1);
}
/**
* Constructs a new <code>DefaultRedisZSet</code> instance.
*
* @param boundOps
* @param defaultScore
*/
public DefaultRedisZSet(BoundZSetOperations<String, E> boundOps, double defaultScore) {
super(boundOps.getKey(), boundOps.getOperations());
this.boundZSetOps = boundOps;
this.defaultScore = defaultScore;
}
public RedisZSet<E> intersectAndStore(RedisZSet<?> set, String destKey) {
boundZSetOps.intersectAndStore(set.getKey(), destKey);
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
}
public RedisZSet<E> intersectAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) {
boundZSetOps.intersectAndStore(CollectionUtils.extractKeys(sets), destKey);
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
}
public Set<E> range(long start, long end) {
return boundZSetOps.range(start, end);
}
public Set<E> reverseRange(long start, long end) {
return boundZSetOps.reverseRange(start, end);
}
public Set<E> rangeByScore(double min, double max) {
return boundZSetOps.rangeByScore(min, max);
}
public Set<E> reverseRangeByScore(double min, double max) {
return boundZSetOps.reverseRangeByScore(min, max);
}
public Set<TypedTuple<E>> rangeByScoreWithScores(double min, double max) {
return boundZSetOps.rangeByScoreWithScores(min, max);
}
public Set<TypedTuple<E>> rangeWithScores(long start, long end) {
return boundZSetOps.rangeWithScores(start, end);
}
public Set<TypedTuple<E>> reverseRangeByScoreWithScores(double min, double max) {
return boundZSetOps.reverseRangeByScoreWithScores(min, max);
}
public Set<TypedTuple<E>> reverseRangeWithScores(long start, long end) {
return boundZSetOps.reverseRangeWithScores(start, end);
}
public RedisZSet<E> remove(long start, long end) {
boundZSetOps.removeRange(start, end);
return this;
}
public RedisZSet<E> removeByScore(double min, double max) {
boundZSetOps.removeRangeByScore(min, max);
return this;
}
public RedisZSet<E> unionAndStore(RedisZSet<?> set, String destKey) {
boundZSetOps.unionAndStore(set.getKey(), destKey);
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
}
public RedisZSet<E> unionAndStore(Collection<? extends RedisZSet<?>> sets, String destKey) {
boundZSetOps.unionAndStore(CollectionUtils.extractKeys(sets), destKey);
return new DefaultRedisZSet<E>(boundZSetOps.getOperations().boundZSetOps(destKey), getDefaultScore());
}
public boolean add(E e) {
Boolean result = add(e, getDefaultScore());
checkResult(result);
return result;
}
public boolean add(E e, double score) {
Boolean result = boundZSetOps.add(e, score);
checkResult(result);
return result;
}
public void clear() {
boundZSetOps.removeRange(0, -1);
}
public boolean contains(Object o) {
return (boundZSetOps.rank(o) != null);
}
public Iterator<E> iterator() {
Set<E> members = boundZSetOps.range(0, -1);
checkResult(members);
return new DefaultRedisSortedSetIterator(members.iterator());
}
public boolean remove(Object o) {
Long result = boundZSetOps.remove(o);
checkResult(result);
return result == 1;
}
public int size() {
Long result = boundZSetOps.size();
checkResult(result);
return result.intValue();
}
public Double getDefaultScore() {
return defaultScore;
}
public E first() {
Set<E> members = boundZSetOps.range(0, 0);
checkResult(members);
Iterator<E> iterator = members.iterator();
if (iterator.hasNext())
return iterator.next();
throw new NoSuchElementException();
}
public E last() {
Set<E> members = boundZSetOps.reverseRange(0, 0);
checkResult(members);
Iterator<E> iterator = members.iterator();
if (iterator.hasNext())
return iterator.next();
throw new NoSuchElementException();
}
public Long rank(Object o) {
return boundZSetOps.rank(o);
}
public Long reverseRank(Object o) {
return boundZSetOps.reverseRank(o);
}
public Double score(Object o) {
return boundZSetOps.score(o);
}
public DataType getType() {
return DataType.ZSET;
}
}
|
[
"527474541@qq.com"
] |
527474541@qq.com
|
3920c25769f6871541de2e7cfc5de552a06b8fb1
|
8dd0f424ba16b49518566e4982d2ceb6ded19ee3
|
/target/generated-sources/annotations/entity/MenuDelDia_.java
|
75ee7095e6f84b0a4ad1a8e99a77e600523a2e57
|
[] |
no_license
|
unabroder/RestauranteBongustaio
|
80fae8eb05dcb25daceafa02a35fcf5a554ba268
|
539392a9d7bad47f2cb0349f69f598c9537a8ee5
|
refs/heads/master
| 2022-07-14T02:59:39.778799
| 2020-01-16T19:08:14
| 2020-01-16T19:08:14
| 234,337,929
| 0
| 0
| null | 2022-06-30T20:22:40
| 2020-01-16T14:27:13
|
HTML
|
UTF-8
|
Java
| false
| false
| 648
|
java
|
package entity;
import entity.Plato_Completo;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2020-01-15T09:33:56")
@StaticMetamodel(MenuDelDia.class)
public class MenuDelDia_ {
public static volatile SingularAttribute<MenuDelDia, Integer> estado;
public static volatile SingularAttribute<MenuDelDia, Double> descuento;
public static volatile SingularAttribute<MenuDelDia, Integer> idmenu;
public static volatile SingularAttribute<MenuDelDia, Plato_Completo> plato_Completo;
}
|
[
"ag1961012015@unab.edu.sv"
] |
ag1961012015@unab.edu.sv
|
5e45c575e1673f4b968014e022daaf7edbd4b4af
|
2e9c822c22e48dee0d6a1f6f8d7759980b093b6c
|
/src/main/java/kr/or/ddit/payment/dao/IPaymentDao.java
|
a375df0d897e2f6f3a197e2cc3d1c9425210325b
|
[] |
no_license
|
RockPotato/EndoRPhin
|
631ff5233f05957f3602a9f0df6bc9161979e9cb
|
67c7651341517854a8216631f36716963bf42b14
|
refs/heads/master
| 2020-05-23T15:07:14.427856
| 2019-05-15T13:06:19
| 2019-05-15T13:06:19
| 186,819,659
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,133
|
java
|
package kr.or.ddit.payment.dao;
import java.util.List;
import java.util.Map;
import kr.or.ddit.payment.model.PaymentVo;
import kr.or.ddit.util.model.PageVo;
public interface IPaymentDao {
int insertPayment(PaymentVo paymentVo);
int updatePayment(PaymentVo paymentVo);
List<PaymentVo> getAllPayment();
PaymentVo selectPayment(String paycode);
int deletePayment(String paycode);
List<PaymentVo> getPayment_u(String userId);
List<PaymentVo> getPaymentList(PageVo pageVo);
List<PaymentVo> getPaymentListByUserNm(String usernm);
String getMaxPayment();
String searchPaymentDupl(PaymentVo paymentVo);
List<PaymentVo> selectTotalSalaryByDay(String payDay);
List<PaymentVo> selectPersonalPaymentList(Map<String, Object> payDay);
List<PaymentVo> selectYearPaymentList(Map<String, Object> payDay);
List<PaymentVo> selectYearPaymentListDetail(Map<String, Object> payDay);
String paycodeByIdnDay(PaymentVo paymentVo);
String selectincometax(String divsalary);
List<PaymentVo> selectDeptNPayment(String paydayMonth);
int getPaymentCnt();
List<PaymentVo> getPaymentForAdjust(String payDay);
}
|
[
"lubobo128@gmail.com"
] |
lubobo128@gmail.com
|
fd7a8f9296f1b6e223a1e018a64a82f5f15ac353
|
3fe0ddeae2eae9fcc06c9cfac4acf220f6222c48
|
/src/test/java/com/test/ip_test/IpTestApplicationTests.java
|
01ac87a83dd64f6dd83743f699340567e7b9590d
|
[] |
no_license
|
yangjiamu/ip_test
|
3356317c2bff2280ac8be14614ee4cbb173f564e
|
791c566d779f33973a1441d5a5849aa571690846
|
refs/heads/master
| 2020-03-19T11:25:07.715147
| 2018-06-07T09:51:48
| 2018-06-07T09:51:48
| 136,454,942
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 342
|
java
|
package com.test.ip_test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class IpTestApplicationTests {
@Test
public void contextLoads() {
}
}
|
[
"yang@yangwenjiedeMacBook-Pro.local"
] |
yang@yangwenjiedeMacBook-Pro.local
|
e32517b8b782c7d7320e808f3e00b92ee6f1ee74
|
fdbb904342397735024f130e1965b966cc3e7a01
|
/src/main/java/io/github/yutoeguma/app/LoginCheckAction.java
|
76044090d10b6cf62f1b18257beb0f8dda0e3532
|
[] |
no_license
|
YutoEguma/SampleWebbServer
|
fb4084fb1a8cdeca850ecdc449f207c3a7cc1fcb
|
ca61adb8944aee967ac9176b11d2158d6adc7b6f
|
refs/heads/master
| 2020-05-26T06:21:22.600585
| 2018-05-25T15:06:59
| 2018-05-25T15:08:30
| 82,468,268
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,723
|
java
|
package io.github.yutoeguma.app;
import io.github.yutoeguma.contents.ContentsLoader;
import io.github.yutoeguma.dummy.SessionStorage;
import io.github.yutoeguma.enums.HttpStatus;
import io.github.yutoeguma.http.message.HttpRequest;
import io.github.yutoeguma.http.message.HttpResponse;
import org.apache.log4j.Logger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author cabos
*/
public class LoginCheckAction {
private static final Logger logger = Logger.getLogger(LoginCheckAction.class);
private static ContentsLoader loader = ContentsLoader.get();
private static SessionStorage storage = SessionStorage.get();
static public HttpResponse check$get(HttpRequest request) {
logger.info(request);
String sessionId = getSessionId(request);
if (sessionId == null) {
return new HttpResponse(HttpStatus.BAD_REQUEST, loader.loadContents("/ng.html"));
}
return new HttpResponse(HttpStatus.OK, loader.loadContents("/ok.html"));
}
private static String getSessionId(HttpRequest request) {
String cookie = request.getRequestHeaderAttr().get("Cookie");
logger.info(cookie);
if (cookie == null) {
return null;
}
Map<String, String> map = new HashMap<>();
List<String> strings = Arrays.asList(cookie.split(";"));
strings.stream().map(c -> c.trim()).forEach(c -> {
List<String> cookieKeyValue = Arrays.asList(c.split("="));
if (cookieKeyValue.size() == 2) {
map.put(cookieKeyValue.get(0), cookieKeyValue.get(1));
}
});
return map.get("CABOSESSIONID");
}
}
|
[
"yuto.eguma@bizreach.co.jp"
] |
yuto.eguma@bizreach.co.jp
|
82a9d74153404157154237e8ce7dc1b14f6f1f7e
|
a8268f79846f6337884ba231b05051b02bc5e8ee
|
/ego-parent/egoparent/ego-order/src/main/java/com/ego/order/controller/OrderController.java
|
0227c45d825f9711b3e9604a48573636b8363ede
|
[] |
no_license
|
auberge/ego
|
cbee3314454a002af4ad7159677b1a3fc86fcf42
|
f781e6dd55fa008e44d178bda889129e2a5e96ef
|
refs/heads/master
| 2022-12-18T18:35:39.141145
| 2020-02-28T19:37:56
| 2020-02-28T19:37:56
| 240,576,262
| 0
| 0
| null | 2022-12-16T05:46:59
| 2020-02-14T18:43:01
|
CSS
|
UTF-8
|
Java
| false
| false
| 1,347
|
java
|
package com.ego.order.controller;
import com.ego.commons.pojo.EgoResult;
import com.ego.order.pojo.MyOrderParam;
import com.ego.order.service.TbOrderService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Controller
public class OrderController {
@Resource
private TbOrderService tbOrderServiceImpl;
/**
* 显示订单确认页面
*/
@RequestMapping("order/order-cart.html")
public String showOrder(@RequestParam("id") List<Long> ids, Model model, HttpServletRequest request) {
model.addAttribute("cartList", tbOrderServiceImpl.showOrderCart(ids, request));
return "order-cart";
}
/**
* 创建订单
*/
@RequestMapping("order/create.html")
public String createOrder(MyOrderParam param, HttpServletRequest request) {
EgoResult result = tbOrderServiceImpl.create(param, request);
if (result.getStatus() == 200) {
return "my-orders";
} else {
request.setAttribute("message", "订单创建失败!");
return "error/exception";
}
}
}
|
[
"761476328@qq.com"
] |
761476328@qq.com
|
96143b05f775256586f1b34563956732cf13f23f
|
addd4150ca62c6fee6834ec55469712c47f4fc50
|
/ctk-domain/src/main/java/org/ga4gh/ctk/testcategories/WIP.java
|
db989a401ebdca13087ad92a55b110878a012373
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
ga4gh/compliance
|
7813f02f9f1fdada5a855b9c071fb2881703b9f4
|
26a7643975ad5e7e307f4538bbdc53ab17132361
|
refs/heads/master
| 2020-04-03T21:28:33.296863
| 2018-01-24T11:00:29
| 2018-01-24T11:00:29
| 23,127,683
| 8
| 31
| null | 2017-10-03T11:50:13
| 2014-08-19T22:22:15
|
Java
|
UTF-8
|
Java
| false
| false
| 705
|
java
|
package org.ga4gh.ctk.testcategories;
/**
* <p>Marker interface for tests which are somehow "work in progress"
* (whether that's the test itself, or thing being tested, is up to you).</p>
* <p>This is a handy test-tag; when you're working on something, add
* the WIP category tag {@code @Categories(WIP.class)} to the test class or
* test method signature, and then the WIPTestSuite will pick up only your tagged tests.</p>
* <p>If no tests are WIP-categorized, you'll get a {@code NoTestsRemainException}
* from the WIPTestSuite execution</p>
*
* <h2>Remove this tag when all your tests pass!</h2>
*
* Created by Wayne Stidolph on 6/7/2015.
*/
public interface WIP { /* category marker */
}
|
[
"jellinek@newscenter.com"
] |
jellinek@newscenter.com
|
37761f0988288796d681f3c086efbf08b9388104
|
f445b28c950b29fa4ec13d3c2d53a67bce997dd3
|
/src/main/java/com/strongloop/android/loopback/Container.java
|
8eb6e9203eeb028c387adce5b6f52ef8674fa7f5
|
[
"MIT"
] |
permissive
|
gmxtian/loopback-android
|
7a015b9ec54acf825b8a466b0a3105ab5b2d6513
|
d52142cc1b1a274a9686afdf9c7e883462d5175b
|
refs/heads/master
| 2021-01-21T02:52:40.181534
| 2014-02-09T22:03:02
| 2014-02-09T22:03:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,091
|
java
|
package com.strongloop.android.loopback;
import org.json.JSONObject;
import com.strongloop.android.remoting.adapters.Adapter;
public class Container extends Model {
private String name;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void delete(final Callback callback) {
invokeMethod("remove", toMap(),
new Adapter.JsonObjectCallback() {
@Override
public void onError(Throwable t) {
callback.onError(t);
}
@Override
public void onSuccess(JSONObject response) {
callback.onSuccess();
}
});
}
public void getFile( String fileName, final FileRepository.FileCallback callback) {
ContainerRepository containerRepo = (ContainerRepository) getRepository();
FileRepository fileRepo = containerRepo.getFileRepository();
fileRepo.get(getName(), fileName, callback);
}
}
|
[
"mchristian@jovianminds.com"
] |
mchristian@jovianminds.com
|
d8b7fdd9fc7efd3969a408c450b885ecc7d535ab
|
a934ca8a86094e47b61893559b16eea38b0cd5e2
|
/S05D02/vjezbeTask2/Main.java
|
bafa1d31174c0cc4e259d5b8e44bb2193b8377a1
|
[] |
no_license
|
dinkohodzic/Zadace
|
bd56e8900c3161157352aaa2a2e7842fc7d5e6db
|
3e033fa03d9ce7ea8af36f85e56b5b6356995351
|
refs/heads/master
| 2016-08-03T22:18:21.752457
| 2015-06-16T21:38:46
| 2015-06-16T21:38:46
| 36,193,432
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 629
|
java
|
package ba.bitcamp.vjezbeTask2;
import java.io.ObjectInputStream.GetField;
public class Main {
public static void main(String[] args) {
Glass g1 = new Glass(100);
System.out.println("The current liquid is: "+g1.getLiquid());
System.out.println("The max capacity is: "+ g1.getMaxCapacity());
g1.addLiquid("Coca Cola", 35);
System.out.println("The current capacity is: " + g1.getCurrentCapacity());
g1.addLiquid("Coca Cola", 70);
System.out.println("The current capacity is: " + g1.getCurrentCapacity());
g1.emtyGlass();
System.out.println("The current capacity is: " + g1.getCurrentCapacity());
}
}
|
[
"dinko.hodzic@bitcamp.ba"
] |
dinko.hodzic@bitcamp.ba
|
de2ac57aec0ba861a0edbfcc8494a4d25e566c2d
|
1fadacc8af4519f825bb0ed99a61091572b8a3ed
|
/jdk8-features/src/com/msrm/jdk8/feature/ImprovedMapApp.java
|
41edec74f50790061cb1887ff6afc0c9f1c04e25
|
[] |
no_license
|
srirambtechit/java-technology
|
aeb60240659e2cf6d932c8769dfc63bae9562912
|
a6ad2530d8869b90f44dd6248df4aab0927d619d
|
refs/heads/master
| 2020-12-29T02:37:30.081557
| 2016-12-24T16:37:08
| 2016-12-24T16:37:08
| 44,532,533
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,500
|
java
|
package com.msrm.jdk8.feature;
import java.util.HashMap;
import java.util.Map;
public class ImprovedMapApp {
public static void main(String[] args) {
Map<String, String> oldMap = new HashMap<>();
oldMap.put("1", "one");
oldMap.put("2", "two");
oldMap.put("3", "three");
for (int i = 0; i < 10; i++) {
if (!oldMap.containsKey(String.valueOf(i)))
oldMap.put(String.valueOf(i), "val" + i);
}
System.out.println(oldMap);
System.out.println();
// 1. no need of checking key presents
Map<String, String> newMap = new HashMap<>();
newMap.put("1", "one");
newMap.put("2", "two");
newMap.put("3", "three");
for (int i = 0; i < 10; i++) {
newMap.putIfAbsent(String.valueOf(i), "val" + i);
}
System.out.println(newMap);
System.out.println();
// 2. compute logic on map based on presents of value
newMap.computeIfPresent("1", (k, v) -> v.concat(k));
// 3. compute logic on map if value not there
newMap.computeIfAbsent("10", v -> "ten");
// 4. always get value though value not there in map
// key "11" not in map
String foundValue = newMap.getOrDefault("11", "negative");
String defaultValue = newMap.getOrDefault("10", "negative");
System.out.println(foundValue);
System.out.println(defaultValue);
System.out.println();
// 5. merging values in map
newMap.merge("10", "_value", String::concat); // ten_value
// 4. printing map is so easy in lambda style
newMap.forEach((k, v) -> System.out.println(k + "=" + v));
}
}
|
[
"srirambtecit@gmail.com"
] |
srirambtecit@gmail.com
|
acfcd505475bb75d1f4a62e9c4621d931da48b84
|
5dfa02a3d2ba797f7fb4519464b77423480bca5d
|
/src/main/java/ml/bootcode/springrestsecurityjwt/bootstrap/InitialDataLoader.java
|
0c4a91637155b3f97ba072421d0b9b31b3a96275
|
[] |
no_license
|
sunnybatabyal/spring-rest-security-jwt
|
ecc2649a8c2054dfae29c57d8c088f1507336441
|
1d5080827908d96bb0beeb501c8a6a8244618bed
|
refs/heads/master
| 2023-04-13T09:49:45.667406
| 2023-04-04T17:57:52
| 2023-04-04T17:57:52
| 195,734,782
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,392
|
java
|
/**
*
*/
package ml.bootcode.springrestsecurityjwt.bootstrap;
import java.util.Arrays;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import ml.bootcode.springrestsecurityjwt.models.Authority;
import ml.bootcode.springrestsecurityjwt.models.Role;
import ml.bootcode.springrestsecurityjwt.models.User;
import ml.bootcode.springrestsecurityjwt.repositories.AuthorityRepository;
import ml.bootcode.springrestsecurityjwt.repositories.RoleRepository;
import ml.bootcode.springrestsecurityjwt.repositories.UserRepository;
/**
* @author sunnyb
*
*/
@Component
public class InitialDataLoader implements ApplicationListener<ContextRefreshedEvent> {
private boolean done = false;
private AuthorityRepository authorityRepository;
private RoleRepository roleRepository;
private UserRepository userRepository;
private PasswordEncoder passwordEncoder;
/**
* @param authorityRepository
* @param roleRepository
* @param userRepository
* @param passwordEncoder
*/
public InitialDataLoader(AuthorityRepository authorityRepository, RoleRepository roleRepository,
UserRepository userRepository, PasswordEncoder passwordEncoder) {
this.authorityRepository = authorityRepository;
this.roleRepository = roleRepository;
this.userRepository = userRepository;
this.passwordEncoder = passwordEncoder;
}
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (done)
return;
// Create authorities.
Authority viewAuthority = new Authority();
viewAuthority.setName("VIEW");
Authority downloadAuthority = new Authority();
downloadAuthority.setName("DOWNLOAD");
Authority editAuthority = new Authority();
editAuthority.setName("EDIT");
Authority uploadAuthority = new Authority();
uploadAuthority.setName("UPLOAD");
authorityRepository.save(viewAuthority);
authorityRepository.save(downloadAuthority);
authorityRepository.save(editAuthority);
authorityRepository.save(uploadAuthority);
// Create roles.
Role adminRole = new Role();
adminRole.setName("ADMIN");
adminRole.setAuthorities(Arrays.asList(viewAuthority, downloadAuthority, editAuthority, uploadAuthority));
Role userRole = new Role();
userRole.setName("USER");
userRole.setAuthorities(Arrays.asList(viewAuthority));
Role artistRole = new Role();
artistRole.setName("ARTIST");
artistRole.setAuthorities(Arrays.asList(viewAuthority, uploadAuthority));
Role customerRole = new Role();
customerRole.setName("CUSTOMER");
customerRole.setAuthorities(Arrays.asList(viewAuthority, downloadAuthority));
adminRole = roleRepository.save(adminRole);
userRole = roleRepository.save(userRole);
artistRole = roleRepository.save(artistRole);
customerRole = roleRepository.save(customerRole);
// Create users.
User adminUser = new User();
adminUser.setEmail("sunny");
adminUser.setPassword(passwordEncoder.encode("sunny"));
adminUser.setRoles(Arrays.asList(adminRole));
User testUser = new User();
testUser.setEmail("test");
testUser.setPassword(passwordEncoder.encode("test"));
testUser.setRoles(Arrays.asList(artistRole, customerRole));
adminUser = userRepository.save(adminUser);
testUser = userRepository.save(testUser);
}
}
|
[
"batabyalsunny@gmail.com"
] |
batabyalsunny@gmail.com
|
6fd427d5ef31a109a733406e143d140a5e4c796c
|
f410795b586b88d5e58e2e0e3f21e6dcefd7843b
|
/src/java/servlets/srv/buscar.java
|
9974eff79266dbad0b73e64a266dc4e94b5bb807
|
[] |
no_license
|
miguelfreelancer56577/SistemaControlEscolar
|
99fac5c30391fc2e6ff82db7f6e4bfc81bda05eb
|
e06bb3070db477a919acdec04ada2253d5a7875d
|
refs/heads/master
| 2021-01-09T20:09:33.064901
| 2016-07-19T15:18:50
| 2016-07-19T15:18:50
| 63,705,290
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,868
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package servlets.srv;
import beans.bean.operacion;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author ATENA
*/
@WebServlet(name="buscar", urlPatterns={"/buscar"})
public class buscar extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String opcion=request.getParameter("opcion");
if (opcion.equals("nombre")){
operacion registro=new operacion();
out.print(registro.busca(request.getParameter("texto")));
}
else{
operacion registro=new operacion();
out.print(registro.busca_matricula(request.getParameter("texto")));
}
//String tipo=registro.busca(matricula);
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
[
"mangel@gmail.com"
] |
mangel@gmail.com
|
6fa4abea9041dae53e2555580aa5e7c760c4f3f7
|
0e3e13b0577ef565c408783c82c43ada1217b08f
|
/StudentApi/src/main/java/com/student/soap/contract/scheduleservice/SoapCarRatingsAndCommentsRequest.java
|
26909b6cfa799ef45f937d46908d679013f52c88
|
[] |
no_license
|
MarkoMesel/XIWS-TimProj
|
13a9bb2aabc78a4b8fb54be613c22bd4c239ff62
|
5f9c8376a46fc9b7f9c8f6c6c8ea45d0d61611b1
|
refs/heads/master
| 2023-04-13T19:08:26.314610
| 2020-07-12T10:08:05
| 2020-07-12T10:08:05
| 265,536,586
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,574
|
java
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.07.06 at 07:41:59 PM BST
//
package com.student.soap.contract.scheduleservice;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"id"
})
@XmlRootElement(name = "soapCarRatingsAndCommentsRequest")
public class SoapCarRatingsAndCommentsRequest {
protected int id;
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(int value) {
this.id = value;
}
}
|
[
"cetko.ns@gmail.com"
] |
cetko.ns@gmail.com
|
5f330fe350b7cf34af3113c964ef857b61e88811
|
bcfd9f294e1f20d7f03e4d80d4e8086dcea1613f
|
/app/src/androidTest/java/com/example/masters/mytest_iba/ExampleInstrumentedTest.java
|
80d6b8db3da7432fc3d605d3dacef07bda8c1ec4
|
[] |
no_license
|
KimHyoungChul/MyTEST_IBA
|
e448603026f446677315b1de5b422ea95d119475
|
e83c9f93838d6cb83e1aef0ea06ab6bad20500b6
|
refs/heads/master
| 2020-06-29T18:49:35.768332
| 2018-03-02T06:42:40
| 2018-03-02T06:42:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 761
|
java
|
package com.example.masters.mytest_iba;
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.example.masters.mytest_iba", appContext.getPackageName());
}
}
|
[
"anusara.orm@gmail.com"
] |
anusara.orm@gmail.com
|
9c2900172e00809442d7d0229c5eaf80a2d55dc2
|
889877dd2129c9717bafc77a84408f287fbbdbc3
|
/src/main/java/bjl/core/enums/BankSegment.java
|
776daaff655bffecb4b21eb9e4c24e5f8afa2b94
|
[] |
no_license
|
zhouxhhn/voto
|
3cf1405045e81230398cb273cfeaf9ee95b86ac5
|
66fc84c1b6b536be51b84895aa2be316618d3d49
|
refs/heads/master
| 2020-03-26T23:08:11.746765
| 2018-08-21T05:54:02
| 2018-08-21T05:54:02
| 145,513,289
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,217
|
java
|
package bjl.core.enums;
import org.apache.commons.lang3.StringUtils;
/**
* 银行代号枚举
* Created by zhangjin on 2017/9/7.
*/
public enum BankSegment {
ICBC("工商银行", 1001),
ABC("农业银行", 1002),
BOC("中国银行", 1003),
CCB("建设银行", 1004),
BCM("交通银行", 1005),
PSBC("邮政储蓄银行",1006),
CNCB("中信银行", 1007),
CEB("光大银行", 1008),
HXB("华夏银行", 1009),
CMSB("民生银行", 1010),
PAB("平安银行", 1011),
CMBC("招商银行", 1012),
CIB("兴业银行", 1013),
SPDB("浦发银行", 1014),
GDB("广发银行", 1017);
private String name;
private int value;
public String getName() {
return name;
}
public int getValue() {
return value;
}
BankSegment(String name, int value) {
this.name = name;
this.value = value;
}
public static String getByValue(Integer value){
for(BankSegment bankSegment : BankSegment.values()){
if(value == bankSegment.value){
return bankSegment.name();
}
}
return null;
}
}
|
[
"joey.zhou@siyue.cn"
] |
joey.zhou@siyue.cn
|
f5ad7c2f2a4509068ae5781822d5893ed5db2982
|
d7159f4a42e2a56717e508f192b92dd3dff12843
|
/src/main/java/com/zhihui/order/partner/plateno/service/book/ArrayOfQuota.java
|
6512ecfdfd53e7381e80da023a50b58c99246a27
|
[] |
no_license
|
liangyongsheng/zhihui-order-partner-plateno
|
d431b8c3020a9ad01c0504cce826458b32849a96
|
40f95c81e67596398a4c39681945af97ba97cba2
|
refs/heads/master
| 2021-01-10T08:43:43.714565
| 2016-02-18T11:25:32
| 2016-02-18T11:25:32
| 52,002,050
| 0
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 1,882
|
java
|
package com.zhihui.order.partner.plateno.service.book;
import java.util.ArrayList;
import java.util.List;
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>ArrayOfQuota complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="ArrayOfQuota">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Quota" type="{http://www.7daysinn.cn/booking}Quota" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfQuota", propOrder = {
"quota"
})
public class ArrayOfQuota {
@XmlElement(name = "Quota", nillable = true)
protected List<Quota> quota;
/**
* Gets the value of the quota property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the quota property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getQuota().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Quota }
*
*
*/
public List<Quota> getQuota() {
if (quota == null) {
quota = new ArrayList<Quota>();
}
return this.quota;
}
}
|
[
"yongsheng_l@163.com"
] |
yongsheng_l@163.com
|
001fd74b20c6073083d2916c77677f2bc28c06af
|
7cb46edb61ef13a7e14798b1bcc7244e72834ced
|
/src/main/java/com/example/testdemo/UsersController.java
|
3de635a8fe038a22c3fab1d52072104ebdda09e6
|
[] |
no_license
|
ppolushkin/demo-test
|
7f0ae4df726e917029bb2ea2323f5112f9c52141
|
3a2a85b52c97213e23219fb535b66604656570cf
|
refs/heads/master
| 2021-06-26T10:09:50.402568
| 2017-09-14T02:27:20
| 2017-09-14T02:27:20
| 103,469,219
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 960
|
java
|
package com.example.testdemo;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Created by Pavel Polushkin
* 14.09.2017.
*/
@RestController
@RequestMapping("/users")
public class UsersController {
private final UsersRepository usersRepository;
public UsersController(UsersRepository usersRepository) {
this.usersRepository = usersRepository;
}
@GetMapping
public List<User> getAll() {
return usersRepository.getAll();
}
@GetMapping("/{id}")
public User getOne(@PathVariable Long id) {
return usersRepository.getById(id);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable Long id) {
usersRepository.delete(id);
}
@PostMapping
public void add(@RequestBody User user) {
usersRepository.add(user);
}
@PutMapping
public void modify(@RequestBody User user) {
usersRepository.modify(user);
}
}
|
[
"pavel.polushkin@sidenis.com"
] |
pavel.polushkin@sidenis.com
|
16e544d2b9b9c9ffd20f1c1faf27390b6bf17a44
|
c5ff7727d29d6a67d1f62998b21281eb3cdab4fe
|
/client/platforms/android/app/build/generated/source/buildConfig/debug/com/lab/turborrow/BuildConfig.java
|
8e95abcf7b7d2fde936af740c51b17114d2b248d
|
[] |
no_license
|
arenibProjects/turborrow
|
1ac0aa9c5d680e6cff1c00369dbf1ee2d1c0bf92
|
b34f07c393902f56bfc107b2b6962875fc46fee1
|
refs/heads/master
| 2020-03-12T08:58:41.204028
| 2018-04-22T07:40:07
| 2018-04-22T07:40:07
| 130,541,489
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 447
|
java
|
/**
* Automatically generated file. DO NOT MODIFY
*/
package com.lab.turborrow;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.lab.turborrow";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 10000;
public static final String VERSION_NAME = "1.0.0";
}
|
[
"titouan.baillon@gmail.com"
] |
titouan.baillon@gmail.com
|
11e2a2a7ced61da36b5347f6004f840722b2b4d7
|
5b1c4d465c104444297867003facee671d5bfb99
|
/app/src/main/java/mmu/edu/my/shift/data/model/LoggedInUser.java
|
0bb6176dca3d9e1aec2d3073449087b11efcf306
|
[] |
no_license
|
Spade497/ShiFT
|
ee259544bde88d13b3e7a87383f863a560c07600
|
e302cdc0bed1b0fb33fc78955dd6a7c2c4fec42b
|
refs/heads/master
| 2023-03-20T01:22:06.957370
| 2021-03-15T02:00:38
| 2021-03-15T02:00:38
| 332,679,567
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 503
|
java
|
package mmu.edu.my.shift.data.model;
/**
* Data class that captures user information for logged in users retrieved from LoginRepository
*/
public class LoggedInUser {
private String userId;
private String displayName;
public LoggedInUser(String userId, String displayName) {
this.userId = userId;
this.displayName = displayName;
}
public String getUserId() {
return userId;
}
public String getDisplayName() {
return displayName;
}
}
|
[
"1171101726@student.mmu.edu.my"
] |
1171101726@student.mmu.edu.my
|
b5d995b54ad10e9741f422868e60096dfcbd5320
|
b292097d67449381fcfe36cd21fbba477f0e1ae9
|
/src/test/java/store/CommonApplyTest.java
|
d569f02f72e2b6bd4fecbc09e7b7cf4939a18475
|
[] |
no_license
|
QM-Developers/interface-test
|
5860fe5bd4f2e925a02ead33bb6b39179cc9ea97
|
1a55b4a064fc775688b6c1ea7336c822f0a167ef
|
refs/heads/master
| 2021-07-25T12:00:16.635252
| 2017-11-03T10:13:00
| 2017-11-03T10:13:00
| 107,392,714
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,987
|
java
|
package store;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import constant.CoreConstant;
import okhttp3.*;
import util.IDGenerator;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class CommonApplyTest
{
private static String BASE_URL = CoreConstant.URL_BASE_LOCAL;
public static void main(String[] args)
{
try
{
// String result = findDepartmentList();
// String result = findMemberList();
// String result = saveCommonApply();
// String result = saveCommonApplyImage();
// String result = listCommonApplyByProposer();
// String result = listCommonApplyByApprove();
// String result = updateCommonApplyAccept();
// String result = updateCommonApplyRefuse();
String result = getCommonApply();
System.out.println(result);
} catch (IOException e)
{
e.printStackTrace();
}
}
private static String getCommonApply() throws IOException
{
String url = BASE_URL + "/s/getCommonApply" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("applyId", "af2b01d9792a4f9db1c6c4dd2e4a8505");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String updateCommonApplyRefuse() throws IOException
{
String url = BASE_URL + "/s/updateCommonApplyRefuse" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("applyId", "223b5684a88c4875a69291f38a3e3fa1");
params.put("approveAdvice", "建议");
params.put("approveSequence", "2");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String listCommonApplyByApprove() throws IOException
{
String url = BASE_URL + "/s/listCommonApplyByApprove" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "0420cb22c06b43a488c39967779eecec");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("pageNum", "1");
params.put("pageSize", "10");
// params.put("applyResult", "10");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String updateCommonApplyAccept() throws IOException
{
String url = BASE_URL + "/s/updateCommonApplyAccept" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "5a27d0f892cd48a482622f8b76fd239c");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("applyId", "223b5684a88c4875a69291f38a3e3fa1");
params.put("approveAdvice", "意见");
params.put("approveSequence", "1");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String listCommonApplyByProposer() throws IOException
{
String url = BASE_URL + "/s/listCommonApplyByProposer" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "89d9317fb3834353bcf2a507bee2eb82");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("pageNum", "1");
params.put("pageSize", "10");
params.put("applyResult", "13");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String saveCommonApplyImage() throws IOException
{
String url = BASE_URL + "/s/saveCommonApplyImage" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient();
File file = new File("C:\\Users\\Administrator\\Desktop\\temp\\wallhaven-513297.jpg");
JSONObject params = new JSONObject();
params.put("userId", "9f6bc79d769342f1b90ed0b532b870f2");
params.put("token", IDGenerator.generator());
params.put("myTeamId", "10001");
params.put("img", "图片");
System.out.println(params.toJSONString());
params.remove("img");
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
for (String key : params.keySet())
builder.addFormDataPart(key, params.get(key).toString());
builder.addFormDataPart("img", file.getName(), RequestBody.create(MediaType.parse("image/png"), file));
RequestBody requestBody = builder.build();
Request request = new Request.Builder().url(url).post(requestBody).build();
Response response = okHttpClient.newCall(request).execute();
return response.body().string();
}
private static String saveCommonApply() throws IOException
{
String url = BASE_URL + "/s/saveCommonApply" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
JSONArray approve = new JSONArray();
JSONArray img = new JSONArray();
JSONObject app1 = new JSONObject();
JSONObject app2 = new JSONObject();
JSONObject img1 = new JSONObject();
app1.put("approveId","5a27d0f892cd48a482622f8b76fd239c");
app1.put("approveName","王舞欣");
app1.put("approveSequence","1");
app2.put("approveId","9f6bc79d769342f1b90ed0b532b870f2");
app2.put("approveName","李思思");
app2.put("approveSequence","2");
img1.put("imageId","a3ad0592c5324e2b8f9fe46aa8047f31");
approve.add(app1);
approve.add(app2);
img.add(img1);
params.put("userId", "89d9317fb3834353bcf2a507bee2eb82");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("applyTitle", "1");
params.put("beginDate", "1");
params.put("endDate", "1");
params.put("applyReason", "1");
params.put("commonApplyApprove", approve.toJSONString());
params.put("commonApplyImage", img.toJSONString());
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String findMemberList() throws IOException
{
String url = BASE_URL + "/s/findMemberList" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "89d9317fb3834353bcf2a507bee2eb82");
params.put("myTeamId", "10001");
params.put("token", "1");
params.put("departmentId", "4bc0ec2d68a444e7a584b9f8d03cbc44");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
private static String findDepartmentList() throws IOException
{
String url = BASE_URL + "/s/findDepartmentList" + CoreConstant.URL_SUFFIX;
OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(1000, TimeUnit.SECONDS).build();
JSONObject params = new JSONObject();
params.put("userId", "89d9317fb3834353bcf2a507bee2eb82");
params.put("myTeamId", "10001");
params.put("token", "1");
System.out.println(params.toJSONString());
FormBody.Builder builder = new FormBody.Builder();
for (String key : params.keySet())
builder.add(key, params.get(key).toString());
Request request = new Request.Builder().post(builder.build()).url(url).build();
Call call = okHttpClient.newCall(request);
Response response = call.execute();
if (response.isSuccessful())
return response.body().string();
else
return String.valueOf(response.code());
}
}
|
[
"1109440800@qq.com"
] |
1109440800@qq.com
|
d8ea868e54d41cc6fa213acb12d6f5f0b2508bf3
|
7941d6ed6d1f87954de73876c6d70b2b4b9e8a8c
|
/src/PART_I_Core/Day16_Pbjects_and_Classes/copy/Dog.java
|
9db30cfa64ea0efbf4c6389be72a02757929d5c7
|
[] |
no_license
|
Isso-Chan/Java-b13
|
d91524f41788882b85b8fa7ba69b770cd0042a98
|
a8d3697c7b8d77aba197077880b9657190da34a0
|
refs/heads/master
| 2022-11-14T05:47:48.062951
| 2020-07-02T11:23:43
| 2020-07-02T11:23:43
| 276,617,741
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 452
|
java
|
package PART_I_Core.Day16_Pbjects_and_Classes.copy;
public class Dog {
// class is blueprint and has common properties and methods
String breed;
int age;
String color;
String name;
char veccination;
public void barking() {
System.out.println(name+ " is barking");
}
public void hungry() {
System.out.println(name+" is hungry");
}
public void speeping() {
System.out.println(name+" is sleeping");
}
}
|
[
"ismailozcan73@gmail.com"
] |
ismailozcan73@gmail.com
|
c500a5fcae025d5da3735dba78006840d0f12e70
|
6e423ba9f9a28796344c611350678fba2cb93baf
|
/im-common/src/main/java/com/huzhihui/im/common/dto/msg/PlatformImMessage.java
|
fcdacad89929e68a9cee1c69843eae522f144f03
|
[] |
no_license
|
zhihuihu/IM
|
1402040d866b2ff5f4332e22e7106805e4a221fd
|
6fc8e6e9a0a9454495e16420a6bc5e69ee8a3932
|
refs/heads/master
| 2023-03-29T14:51:11.608020
| 2021-04-03T11:07:33
| 2021-04-03T11:07:33
| 351,090,120
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 651
|
java
|
/**
* zhihuihu.github.io.
* Copyright (c) 2016-2019 All Rights Reserved.
*/
package com.huzhihui.im.common.dto.msg;
/**
* 平台通知消息
* @author huzhi
* @version $ v 0.1 2021/3/24 21:43 huzhi Exp $$
*/
public class PlatformImMessage extends BaseImMessage {
/** 接收者 */
private String toUserId;
/** 数据 */
private String data;
public String getToUserId() {
return toUserId;
}
public void setToUserId(String toUserId) {
this.toUserId = toUserId;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
|
[
"huzhihui_c@qq.com"
] |
huzhihui_c@qq.com
|
431725fc7592a39640ed7d13055c9c9f89fca7f3
|
32c2b65a40877e1090916b44f662d942f35cabec
|
/src/main/java/de/noriskclient/watermod/mixin/StructurePieceMixin.java
|
e8e279cc07c4545317e61af298f387c22cb4d32c
|
[
"CC0-1.0"
] |
permissive
|
copyandexecute/EverythingIsWater
|
c8ced1412d4986d67a3a9c1663f3c49046db90f2
|
a26891d2437c04c9497b16ff8632f7694d891afb
|
refs/heads/master
| 2023-02-08T11:43:07.934527
| 2020-12-27T15:43:20
| 2020-12-27T15:43:20
| 324,560,288
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,636
|
java
|
package de.noriskclient.watermod.mixin;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.structure.StructurePiece;
import net.minecraft.util.math.BlockBox;
import net.minecraft.world.WorldAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
@Mixin(StructurePiece.class)
public class StructurePieceMixin {
@ModifyVariable(method = "fillWithOutline(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockBox;IIIIIILnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Z)V", at = @At("HEAD"), ordinal = 0)
private BlockState injected(BlockState blockState) {
return blockState.equals(Blocks.AIR.getDefaultState()) || blockState.equals(Blocks.CAVE_AIR.getDefaultState()) ? Blocks.WATER.getDefaultState() : blockState;
}
@ModifyVariable(method = "fillWithOutline(Lnet/minecraft/world/WorldAccess;Lnet/minecraft/util/math/BlockBox;IIIIIILnet/minecraft/block/BlockState;Lnet/minecraft/block/BlockState;Z)V", at = @At("HEAD"), ordinal = 1)
private BlockState injected2(BlockState blockState) {
return blockState.equals(Blocks.AIR.getDefaultState()) || blockState.equals(Blocks.CAVE_AIR.getDefaultState()) ? Blocks.WATER.getDefaultState() : blockState;
}
@ModifyVariable(method = "addBlock", at = @At("HEAD"), ordinal = 0)
private BlockState modifyaddBlock( BlockState block) {
return block.getMaterial().equals(Material.AIR) ? Blocks.WATER.getDefaultState() : block;
}
}
|
[
"58366920+copyandexecute@users.noreply.github.com"
] |
58366920+copyandexecute@users.noreply.github.com
|
9955629a4891d91710abf87401c254cb3b3319cf
|
7a26d59d5f8292cf0b3ea762960bf3dbd3b861ca
|
/tests/robotests/src/com/android/settings/homepage/contextualcards/conditional/HotspotConditionControllerTest.java
|
8663d0bcbb5949418a3ad3819bf769075bb72c27
|
[
"Apache-2.0"
] |
permissive
|
ResurrectionRemix/Resurrection_packages_apps_Settings
|
bac0727c91db6d4d5d7f8f2b4ea01d8f4273853b
|
c65423981fe1f615b51dc534038110e6e86f88ad
|
refs/heads/Q
| 2021-12-15T14:52:54.291575
| 2021-09-19T11:36:02
| 2021-09-19T11:36:02
| 17,210,708
| 228
| 1,613
|
NOASSERTION
| 2023-01-02T18:18:06
| 2014-02-26T13:00:14
|
Java
|
UTF-8
|
Java
| false
| false
| 2,583
|
java
|
/*
* Copyright (C) 2019 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.android.settings.homepage.contextualcards.conditional;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import com.android.settings.homepage.contextualcards.ContextualCard;
import com.android.settings.testutils.shadow.ShadowWifiManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = {ShadowWifiManager.class})
public class HotspotConditionControllerTest {
private static final String WIFI_AP_SSID = "Test Hotspot";
@Mock
private ConditionManager mConditionManager;
private Context mContext;
private HotspotConditionController mController;
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mController = new HotspotConditionController(mContext, mConditionManager);
}
@Test
public void buildContextualCard_hasWifiAp_shouldHaveWifiApSsid() {
setupWifiApConfiguration();
final ContextualCard card = mController.buildContextualCard();
assertThat(card.getSummaryText()).isEqualTo(WIFI_AP_SSID);
}
@Test
public void buildContextualCard_noWifiAp_shouldHaveDefaultSsid() {
final ContextualCard card = mController.buildContextualCard();
assertThat(card.getSummaryText()).isEqualTo(
mContext.getText(com.android.internal.R.string.wifi_tether_configure_ssid_default));
}
private void setupWifiApConfiguration() {
final WifiConfiguration wifiApConfig = new WifiConfiguration();
wifiApConfig.SSID = WIFI_AP_SSID;
mContext.getSystemService(WifiManager.class).setWifiApConfiguration(wifiApConfig);
}
}
|
[
"yantingyang@google.com"
] |
yantingyang@google.com
|
fc153a4d9da3d3ac069cbad8818a29f1c576f2d3
|
1f4fd7b4009cffae138f7466e3c32667d34c82b6
|
/src/sga/gui/TelaClassApostadores.java
|
02a1e8bbb4e3b26df6c7d7a152e9d597d26e10a7
|
[] |
no_license
|
demisgomes/bolao_da_copa
|
5fb142fe998739d5f6f75ef0a738c86dfd54cbe1
|
ebffcdb1373aef3a804b34891f74f8a42ed41630
|
refs/heads/master
| 2021-01-10T11:57:39.604233
| 2016-01-09T00:43:28
| 2016-01-09T00:43:28
| 49,304,662
| 3
| 1
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 2,315
|
java
|
package sga.gui;
import java.awt.EventQueue;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.border.EmptyBorder;
import sga.dominio.aposta.Apostador;
import sga.dominio.aposta.GrupoApostadores;
/**
* Tela que mostra a classificação para os usuários
* @author Demis
*
*/
public class TelaClassApostadores extends JFrame {
private JPanel contentPane;
private JTable table;
private JTable table_1;
/**
* Create the frame.
*/
public TelaClassApostadores() {
setTitle("Classifica\u00E7\u00E3o dos Apostadores");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 245, 281);
contentPane = new JPanel();
contentPane.setForeground(SystemColor.activeCaption);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
//chama o método que gera a classificação
//na classe GrupoApostadores
GrupoApostadores.gerarClassificacaoApostadores();
JButton btnVoltar = new JButton("Voltar");
btnVoltar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new TelaInicial().setVisible(true);
TelaClassApostadores.this.dispose();
}
});
btnVoltar.setBounds(77, 201, 89, 23);
contentPane.add(btnVoltar);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(35, 11, 183, 166);
contentPane.add(scrollPane);
//método que o professor Gabriel fez
ArrayList<Apostador> classificacao = GrupoApostadores.getClassificacao();
//cria um objeto chamado dados
Object[][] dados = new Object[classificacao.size()][2];
int idx = 0;
//para cada apostador na classificação
for (Apostador apostador : classificacao) {
//o primeiro dado será o nome
//o segundo será os pontos
dados[idx][0] = apostador.getNome();
dados[idx][1] = apostador.getPontos();
idx++;
}
//Os nomes das colunas serão Nome e pontos
Object[] colunas = {"Nome","Pontos"};
table_1 = new JTable(dados,colunas);
//adiciona a JTable no scrollpane
scrollPane.setViewportView(table_1);
}
}
|
[
"Telascaviado24"
] |
Telascaviado24
|
61977c7b81f54b9113c7bb32bcf80d9e08c1d73a
|
8d7a8184ad1bdcbc58b007ee93ae38614a01eec7
|
/javaee/src/main/java/br/com/casadocodigo/loja/beans/Car.java
|
8e049041074a3beff16b6b444eac0bce7e1bd087
|
[] |
no_license
|
levycandido/java-jee
|
e375e4ef0640e1c3dfc5efd3293e6fc96957cd9b
|
3c9a12c9edf8d5a9cde9fed1395b499ab2682b8b
|
refs/heads/master
| 2022-12-09T19:25:49.551903
| 2019-07-05T03:09:20
| 2019-07-05T03:09:20
| 195,330,084
| 0
| 0
| null | 2022-11-24T04:24:53
| 2019-07-05T03:06:13
|
CSS
|
UTF-8
|
Java
| false
| false
| 2,629
|
java
|
/*
* Copyright 2009-2014 PrimeTek.
*
* 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 br.com.casadocodigo.loja.beans;
import java.io.Serializable;
public class Car implements Serializable {
public String id;
public String brand;
public int year;
public String color;
public int price;
public boolean sold;
public Car() {}
public Car(String id, String brand, int year, String color) {
this.id = id;
this.brand = brand;
this.year = year;
this.color = color;
}
public Car(String id, String brand, int year, String color, int price, boolean sold) {
this.id = id;
this.brand = brand;
this.year = year;
this.color = color;
this.price = price;
this.sold = sold;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public boolean isSold() {
return sold;
}
public void setSold(boolean sold) {
this.sold = sold;
}
@Override
public int hashCode() {
int hash = 7;
hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Car other = (Car) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
return true;
}
}
|
[
"levyjunior@plusoft.com.br"
] |
levyjunior@plusoft.com.br
|
aff154ab2429d7a03fd22c5ff6066715003c8bf8
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/5/5_891741aebbe3d5a8d2426a499e93b00afb93ba10/QueryTranslatorXQueryImpl/5_891741aebbe3d5a8d2426a499e93b00afb93ba10_QueryTranslatorXQueryImpl_s.java
|
cb31e6bc49c8ba2eb9c6a030487e2f44a4f962fc
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692
| 2023-06-22T07:55:56
| 2023-06-22T07:55:56
| 259,613,157
| 6
| 2
| null | 2023-06-22T07:55:57
| 2020-04-28T11:07:49
| null |
UTF-8
|
Java
| false
| false
| 8,297
|
java
|
/**
* Copyright (C) [2013] [The FURTHeR 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 edu.utah.further.ds.impl.service.query.logic;
import static edu.utah.further.core.api.constant.Constants.Scope.PROTOTYPE;
import static edu.utah.further.ds.api.util.AttributeName.META_DATA;
import static org.slf4j.LoggerFactory.getLogger;
import java.io.ByteArrayInputStream;
import java.lang.invoke.MethodHandles;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.apache.commons.lang.Validate;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import edu.utah.further.core.api.chain.AttributeContainerImpl;
import edu.utah.further.core.api.chain.ChainRequest;
import edu.utah.further.core.api.collections.CollectionUtil;
import edu.utah.further.core.api.exception.ApplicationError;
import edu.utah.further.core.api.exception.ApplicationException;
import edu.utah.further.core.api.exception.WsException;
import edu.utah.further.core.api.lang.ReflectionUtil;
import edu.utah.further.core.api.xml.XmlService;
import edu.utah.further.core.chain.ChainRequestImpl;
import edu.utah.further.core.query.domain.SearchQueryTo;
import edu.utah.further.core.xml.xquery.XQueryService;
import edu.utah.further.ds.api.service.query.logic.QueryTranslator;
import edu.utah.further.ds.api.util.AttributeName;
import edu.utah.further.fqe.ds.api.domain.DsMetaData;
import edu.utah.further.fqe.ds.api.domain.QueryContext;
import edu.utah.further.fqe.ds.api.util.FqeDsQueryContextUtil;
import edu.utah.further.mdr.ws.api.service.rest.AssetServiceRest;
/**
* Query translator implementation that utilizes XQuery to translate queries. Use of this
* class requires setting the location of the XQuery artifact in the
* {@link AttributeName#QUERY_TRANSLATION}
* <p>
* -----------------------------------------------------------------------------------<br>
* (c) 2008-2012 FURTHeR Project, Health Sciences IT, University of Utah<br>
* Contact: {@code <further@utah.edu>}<br>
* Biomedical Informatics, 26 South 2000 East<br>
* Room 5775 HSEB, Salt Lake City, UT 84112<br>
* Day Phone: 1-801-581-4080<br>
* -----------------------------------------------------------------------------------
*
* @author N. Dustin Schultz {@code <dustin.schultz@utah.edu>}
* @version Jul 30, 2013
*/
@Service("queryTranslatorXquery")
@Qualifier("impl")
@Scope(PROTOTYPE)
public class QueryTranslatorXQueryImpl implements QueryTranslator
{
// ========================= CONSTANTS =================================
/**
* A logger that helps identify this class' printouts.
*/
private static final Logger log = getLogger(MethodHandles.lookup().lookupClass());
/**
* The byte encoding to use with Strings
*/
private static final Charset UTF_8 = Charset.forName("UTF-8");
// ========================= FIELDS =====================================
// ========================= DEPENDENCIES ===========================
/**
* XQuery Service
*/
@Autowired
@Qualifier("xqueryService")
private XQueryService xqueryService;
/**
* Service for marshalling and unmarshalling to XML
*/
@Autowired
private XmlService xmlService;
/**
* MDR web service client.
*/
@Autowired
@Qualifier("mdrAssetServiceRestClient")
private AssetServiceRest assetServiceRest;
// ================== IMPL: QueryTranslatorXQueryImpl ===================
@SuppressWarnings("unchecked")
/*
* (non-Javadoc)
*
* @see
* edu.utah.further.ds.api.service.query.logic.QueryTranslator#translate(edu.utah.
* further.fqe.ds.api.domain.QueryContext)
*/
@Override
public <T> T translate(final QueryContext queryContext,
final Map<String, Object> attributes)
{
if (log.isTraceEnabled())
{
log.trace("Translating query " + queryContext.getQuery() + " ... ");
}
final ChainRequest request = new ChainRequestImpl(new AttributeContainerImpl(
attributes));
final String query = FqeDsQueryContextUtil.marshalSearchQuery(xmlService,
queryContext.getQuery());
final String pathToXquery = request.getAttribute(AttributeName.QUERY_TRANSLATION);
if (pathToXquery == null)
{
throw new ApplicationException(
AttributeName.QUERY_TRANSLATION.getLabel()
+ " label was not set; don't know where to search for xquery translation");
}
String xQuery;
try
{
xQuery = assetServiceRest.getActiveResourceContentByPath(pathToXquery);
}
catch (final WsException e)
{
throw new ApplicationException("Unable to find XQuery for query translation",
e);
}
final DsMetaData dsMetaData = request.getAttribute(META_DATA);
@SuppressWarnings("serial")
final Map<String, String> parameters = new HashMap<String, String>()
{
{
put("tgNmspcId", dsMetaData.getNamespaceId().toString());
put("tgNmspcName", dsMetaData.getName());
}
};
final String result = xqueryService.executeIntoString(new ByteArrayInputStream(
xQuery.getBytes(UTF_8)), new ByteArrayInputStream(query.getBytes(UTF_8)),
parameters);
if (log.isTraceEnabled())
{
log.trace("XQuery Translation result: " + result);
}
final Object unmarshalResult;
try
{
unmarshalResult = xmlService.unmarshal(
new ByteArrayInputStream(result.getBytes()), xmlService
.options()
.addClass(SearchQueryTo.class)
.addClass(ApplicationError.class)
.buildContext()
.setRootNamespaceUris(CollectionUtil.<String> newSet()));
}
catch (final JAXBException e)
{
throw new ApplicationException(
"Unable to unmarshal SearchQuery after query translation", e);
}
if (ReflectionUtil.instanceOf(unmarshalResult, ApplicationError.class))
{
final ApplicationError error = (ApplicationError) unmarshalResult;
log.error("Query translation returned error, translation failed");
throw new ApplicationException(error.getCode(), error.getMessage());
}
// Sanity check
Validate.isTrue(ReflectionUtil.instanceOf(unmarshalResult, SearchQueryTo.class));
return (T) unmarshalResult;
}
// ========================= GET/SET ===========================
/**
* Return the xqueryService property.
*
* @return the xqueryService
*/
public XQueryService getXqueryService()
{
return xqueryService;
}
/**
* Set a new value for the xqueryService property.
*
* @param xqueryService
* the xqueryService to set
*/
public void setXqueryService(final XQueryService xqueryService)
{
this.xqueryService = xqueryService;
}
/**
* Return the xmlService property.
*
* @return the xmlService
*/
public XmlService getXmlService()
{
return xmlService;
}
/**
* Set a new value for the xmlService property.
*
* @param xmlService
* the xmlService to set
*/
public void setXmlService(final XmlService xmlService)
{
this.xmlService = xmlService;
}
/**
* Return the assetServiceRest property.
*
* @return the assetServiceRest
*/
public AssetServiceRest getAssetServiceRest()
{
return assetServiceRest;
}
/**
* Set a new value for the assetServiceRest property.
*
* @param assetServiceRest
* the assetServiceRest to set
*/
public void setAssetServiceRest(final AssetServiceRest assetServiceRest)
{
this.assetServiceRest = assetServiceRest;
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
9738621f35e02773ee7c4e19451124013503118d
|
45673914cef5270318f85d438032187ec074260d
|
/TradeGame/src/tradegame/Guardian.java
|
6ce2ccadbbc0747567759aa6fbf7bbdac2014d84
|
[] |
no_license
|
BluebirdLyrase/Tradegame
|
dace1b35194f83b4781db7db13eb246b02f40a85
|
fc31144c48b86372ca654b8d5808dc6c0a1668ce
|
refs/heads/master
| 2020-03-10T12:56:15.604319
| 2018-04-20T17:06:45
| 2018-04-20T17:06:45
| 128,940,271
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 68
|
java
|
package tradegame;
interface Guardian {
void Report();
}//4
|
[
"pisitkeawfung@gmail.com"
] |
pisitkeawfung@gmail.com
|
38945a40bd23c6f3d230ef2a7ef9cb9e893221d9
|
decf86bcd14de7d105a33b8191dafc16a3e4580b
|
/10_Competition/src/competition/app/Runner.java
|
bfd29b5c9a02b2e9d2e304c8519b9d8451236ce6
|
[] |
no_license
|
MartinKonak/ALG2_online
|
08a08b217bfcb6dc425acaea05f997a89af0c722
|
fa0d4bfe10eb1263d987e936188aa7fe4a3ef85a
|
refs/heads/master
| 2021-05-26T04:43:05.804791
| 2020-06-04T17:22:30
| 2020-06-04T17:22:30
| 254,057,155
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,192
|
java
|
package competition.app;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
/**
*
* @author Martin Koňák
*/
public class Runner implements Comparable<Runner> {
private int number;
private String firstname;
private String lastname;
private LocalTime startTime;
private LocalTime finishTime;
public static DateTimeFormatter dtfstart = DateTimeFormatter.ofPattern("HH:mm:ss");
public static DateTimeFormatter dtffinish = DateTimeFormatter.ofPattern("HH:mm:ss:SSS");
public Runner(int number, String firstname, String lastname) {
this.number = number;
this.firstname = firstname;
this.lastname = lastname;
}
public void setStartTime(String startTime) {
this.startTime = LocalTime.parse(startTime, dtfstart);
}
public void setFinishTime(String finishTime) {
this.finishTime = LocalTime.parse(finishTime, dtffinish);
}
public LocalTime getStartTime() {
return startTime;
}
public LocalTime getFinishTime() {
return finishTime;
}
public String getStartTimeString(){
return startTime.format(dtfstart);
}
public String getFinishTimeString(){
return finishTime.format(dtffinish);
}
public int getNumber() {
return number;
}
public LocalTime runningTime(){
return LocalTime.ofNanoOfDay(finishTime.toNanoOfDay() - startTime.toNanoOfDay());
}
public String getFirstname() {
return firstname;
}
public String getLastname() {
return lastname;
}
@Override
public String toString() {
return String.format("%-4d%-10s%-10s%-15s%-15s%-15s", number, firstname, lastname, getStartTimeString(),
getFinishTimeString(), runningTime().format(dtffinish));
}
@Override
public int compareTo(Runner o) {
return this.runningTime().compareTo(o.runningTime());
}
/*public static void main(String[] args) {
Runner r = new Runner(101, "Alice", "Mala");
r.setStartTime("09:00:00");
r.setFinishTime("09:30:01:000");
System.out.println(r);
}*/
}
|
[
"martin.konak@tul.cz"
] |
martin.konak@tul.cz
|
6e9e2d4a50861c21b6ae870f22ad0cf538913895
|
f936a1c759e0ebcd4de9dc29857d8c6c25eae310
|
/src/main/java/day0828/SpringMvcSample.java
|
bd3259f8ce9c0c46e43e5e42c79a704f1054b83e
|
[] |
no_license
|
wwbaba/jtpStudy
|
6c06df89f017f883e4905ef95e6b2f40ca46c695
|
8d1332f8aa4ae9d11106f9d930a3921d69fa0491
|
refs/heads/master
| 2020-03-29T03:56:53.328954
| 2018-09-21T01:36:06
| 2018-09-21T01:36:06
| 149,508,425
| 0
| 0
| null | null | null | null |
GB18030
|
Java
| false
| false
| 947
|
java
|
package day0828;
/*
* springMvc开发总结:
* 1. 需要一个控制器,在web.xml中配置
* DispatcherServlet:
* 2. 需要一个spring的web配置文件
* [dispatch-servlet]-servlet.xml文件,在WEB-INF目录下,和web.xml同目录
* 3. 该spring配置文件中需要配置的选项:
* viewResolver:视图解析器
* 指定未来的jsp/html页面的解析方式/ jsp+model,构成需要返回的数据
* <mvc:default-servlet-handler />
* 针对非springmvc控制的内容,例如js/css/img等进行默认处理,配置适配器
*
* <context:component-scan base-package="day0827,day0828" />
* 指定了所有的controller类@Controller注解需要扫描的包路径,
* 扫描该包中的所有的类,如果有@Controller注解,则springMVC自动生成该类的实例并载入到springweb容器中
*
* src/applicationContext.xml配置
*
*
*/
public class SpringMvcSample {
}
|
[
"14525554@qq.com"
] |
14525554@qq.com
|
cc162a53420c14a8a17a3f8dfe76ab0fdd005b8d
|
7b1c85010663863ea8289e97f558b66772b63d11
|
/src/test/java/cn/hkxj/platform/service/GradeSearchServiceTest.java
|
e4526871488d509ac0beddfd937b9ad2d9e58969
|
[
"MIT"
] |
permissive
|
SyaEldon/hkxj
|
96de5cb241e163a452524311adbd5e9e9ef95f17
|
b924537447101a5fd761febd1f85f5dc22d5163c
|
refs/heads/master
| 2020-04-29T01:31:34.627095
| 2019-02-26T09:07:28
| 2019-02-26T09:07:28
| 140,158,480
| 0
| 0
|
MIT
| 2018-07-08T10:36:19
| 2018-07-08T10:36:19
| null |
UTF-8
|
Java
| false
| false
| 1,641
|
java
|
package cn.hkxj.platform.service;
import cn.hkxj.platform.pojo.GradeAndCourse;
import cn.hkxj.platform.pojo.Student;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
/**
* @author junrong.chen
* @date 2018/9/22
*/
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class GradeSearchServiceTest {
@Resource(name = "gradeSearchService")
private GradeSearchService gradeSearchService;
@Autowired
private WxMpService wxMpService;
@Test
public void getAccess_token() throws WxErrorException {
String accessToken = wxMpService.getAccessToken();
System.out.println(accessToken);
}
@Test
public void getCurrentTermGrade() {
Student student = new Student();
student.setAccount(2016023726);
student.setPassword("1");
long start = System.currentTimeMillis();
List<GradeAndCourse> currentTermGrade = gradeSearchService.getGradeFromSpiderAsync(student);
long end = System.currentTimeMillis();
long costtime = end - start;
System.out.println(CollectionUtils.isEmpty(currentTermGrade));
for (GradeAndCourse gradeAndCourse : currentTermGrade) {
log.info(gradeAndCourse.toString());
}
}
}
|
[
"jrchan02@gmail.com"
] |
jrchan02@gmail.com
|
caa6a8fb4056edef34df480d4e117f7ce1ebfce0
|
5f48ad619a3bc9a37dc892db85f942a88efd4fca
|
/activity/src/main/java/org/itzheng/and/activity/ItSwipeBackActivity.java
|
ea7e6db921d930d168031115b9f7a1798d65520c
|
[] |
no_license
|
itzheng/ActivityModule
|
88c9606aa53f411b655b7cf9bbfede75fa435401
|
9b2e4daf589b12bef9becb54a346dc7180e9be2d
|
refs/heads/master
| 2021-07-11T14:46:30.726772
| 2021-07-07T03:34:22
| 2021-07-07T03:34:22
| 124,034,771
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,689
|
java
|
package org.itzheng.and.activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import cn.bingoogolapple.swipebacklayout.BGASwipeBackHelper;
/**
* Title:侧滑返回,主要用于需要侧滑返回的界面<br>
* Description: <br>
* https://github.com/bingoogolapple/BGASwipeBackLayout-Android
* <p>
* 需要在 build.gradle 添加依赖
* implementation 'cn.bingoogolapple:bga-swipebacklayout:1.2.0@aar'
* <p>
* 在 Application 的 oncreate 初始化
* BGASwipeBackHelper.init(this, null);
*
* @email ItZheng@ZoHo.com
* Created by itzheng on 2019-10-21.
*/
public class ItSwipeBackActivity extends ItActivity implements BGASwipeBackHelper.Delegate {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
if (isSupportSwipeBack()) {
initSwipeBackFinish();
}
super.onCreate(savedInstanceState);
}
protected BGASwipeBackHelper mSwipeBackHelper;
/**
* 初始化滑动返回。在 super.onCreate(savedInstanceState) 之前调用该方法
*/
protected void initSwipeBackFinish() {
mSwipeBackHelper = new BGASwipeBackHelper(this, this);
// 「必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回」
// 下面几项可以不配置,这里只是为了讲述接口用法。
// 设置滑动返回是否可用。默认值为 true
mSwipeBackHelper.setSwipeBackEnable(true);
// 设置是否仅仅跟踪左侧边缘的滑动返回。默认值为 true
mSwipeBackHelper.setIsOnlyTrackingLeftEdge(true);
// 设置是否是微信滑动返回样式。默认值为 true
mSwipeBackHelper.setIsWeChatStyle(true);
// 设置阴影资源 id。默认值为 R.drawable.bga_sbl_shadow
mSwipeBackHelper.setShadowResId(R.drawable.bga_sbl_shadow);
// 设置是否显示滑动返回的阴影效果。默认值为 true
mSwipeBackHelper.setIsNeedShowShadow(true);
// 设置阴影区域的透明度是否根据滑动的距离渐变。默认值为 true
mSwipeBackHelper.setIsShadowAlphaGradient(true);
// 设置触发释放后自动滑动返回的阈值,默认值为 0.3f
mSwipeBackHelper.setSwipeBackThreshold(0.3f);
// 设置底部导航条是否悬浮在内容上,默认值为 false
mSwipeBackHelper.setIsNavigationBarOverlap(false);
}
/**
* 是否支持侧滑关闭
*
* @return
*/
@Override
public boolean isSupportSwipeBack() {
return true;
}
@Override
public void onSwipeBackLayoutSlide(float slideOffset) {
}
@Override
public void onSwipeBackLayoutCancel() {
}
/**
* 滑动返回执行完毕,销毁当前 Activity
*/
@Override
public void onSwipeBackLayoutExecuted() {
mSwipeBackHelper.swipeBackward();
}
/**
* 设置滑动返回是否可用。
*
* @param swipeBackEnable
* @return
*/
public void setSwipeBackEnable(boolean swipeBackEnable) {
if (mSwipeBackHelper != null) {
mSwipeBackHelper.setSwipeBackEnable(swipeBackEnable);
}
}
@Override
public void onBackPressed() {
if (mSwipeBackHelper != null && mSwipeBackHelper.isSliding()) {
//正在滑动的时候取消返回事件
return;
}
if (isSupportSwipeBack()) {
//如果支持滑动关闭则使用插件回调
mSwipeBackHelper.backward();
} else {
//不支持滑动关闭使用系统返回
super.onBackPressed();
}
}
}
|
[
"itzheng@zoho.com"
] |
itzheng@zoho.com
|
b39a25a6bf95bd38dbc8540d28130f92b0f54369
|
9efdb7d314e5dc90a2568ce1d613c0ff02ccfc4b
|
/app/src/main/java/com/yusong/community/ui/im/parse/UserProfileManager.java
|
2290e87d857d66a48e2e4b3fdb789ae9b3e543ec
|
[] |
no_license
|
feisher/community_huangshan2
|
1cdcb55e2b9c6394e7f0ac043b2d3c02fed04408
|
aa3fc8103a0e6be8de89d0c7d81d2869724c4443
|
refs/heads/master
| 2021-07-14T18:15:52.164494
| 2017-10-19T03:25:01
| 2017-10-19T03:25:01
| 106,365,007
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,874
|
java
|
package com.yusong.community.ui.im.parse;
import android.content.Context;
import com.hyphenate.EMValueCallBack;
import com.hyphenate.chat.EMClient;
import com.hyphenate.easeui.domain.EaseUser;
import com.yusong.community.ui.im.IMHelper;
import com.yusong.community.ui.im.IMHelper.DataSyncListener;
import com.yusong.community.ui.im.utils.PreferenceManager;
import java.util.ArrayList;
import java.util.List;
public class UserProfileManager {
/**
* application context
*/
protected Context appContext = null;
/**
* init flag: test if the sdk has been inited before, we don't need to init
* again
*/
private boolean sdkInited = false;
/**
* HuanXin sync contact nick and avatar listener
*/
private List<IMHelper.DataSyncListener> syncContactInfosListeners;
private boolean isSyncingContactInfosWithServer = false;
private EaseUser currentUser;
public UserProfileManager() {
}
public synchronized boolean init(Context context) {
if (sdkInited) {
return true;
}
ParseManager.getInstance().onInit(context);
syncContactInfosListeners = new ArrayList<DataSyncListener>();
sdkInited = true;
return true;
}
public void addSyncContactInfoListener(DataSyncListener listener) {
if (listener == null) {
return;
}
if (!syncContactInfosListeners.contains(listener)) {
syncContactInfosListeners.add(listener);
}
}
public void removeSyncContactInfoListener(DataSyncListener listener) {
if (listener == null) {
return;
}
if (syncContactInfosListeners.contains(listener)) {
syncContactInfosListeners.remove(listener);
}
}
public void asyncFetchContactInfosFromServer(List<String> usernames, final EMValueCallBack<List<EaseUser>> callback) {
if (isSyncingContactInfosWithServer) {
return;
}
isSyncingContactInfosWithServer = true;
// ParseManager.getInstance().getContactInfos(usernames, new EMValueCallBack<List<EaseUser>>() {
//
// @Override
// public void onSuccess(List<EaseUser> value) {
// isSyncingContactInfosWithServer = false;
// // in case that logout already before server returns,we should
// // return immediately
// if (!IMHelper.getInstance().isLoggedIn()) {
// return;
// }
// if (callback != null) {
// callback.onSuccess(value);
// }
// }
//
// @Override
// public void onError(int error, String errorMsg) {
// isSyncingContactInfosWithServer = false;
// if (callback != null) {
// callback.onError(error, errorMsg);
// }
// }
//
// });
}
public void notifyContactInfosSyncListener(boolean success) {
for (DataSyncListener listener : syncContactInfosListeners) {
listener.onSyncComplete(success);
}
}
public boolean isSyncingContactInfoWithServer() {
return isSyncingContactInfosWithServer;
}
public synchronized void reset() {
isSyncingContactInfosWithServer = false;
currentUser = null;
PreferenceManager.getInstance().removeCurrentUserInfo();
}
public synchronized EaseUser getCurrentUserInfo() {
if (currentUser == null) {
String username = EMClient.getInstance().getCurrentUser();
currentUser = new EaseUser(username);
String nick = getCurrentUserNick();
currentUser.setNick((nick != null) ? nick : username);
currentUser.setAvatar(getCurrentUserAvatar());
}
return currentUser;
}
public boolean updateCurrentUserNickName(final String nickname) {
boolean isSuccess = ParseManager.getInstance().updateParseNickName(nickname);
if (isSuccess) {
setCurrentUserNick(nickname);
}
return isSuccess;
}
public String uploadUserAvatar(byte[] data) {
String avatarUrl = ParseManager.getInstance().uploadParseAvatar(data);
if (avatarUrl != null) {
setCurrentUserAvatar(avatarUrl);
}
return avatarUrl;
}
//
// public void asyncGetCurrentUserInfo() {
// ParseManager.getInstance().asyncGetCurrentUserInfo(new EMValueCallBack<EaseUser>() {
//
// @Override
// public void onSuccess(EaseUser value) {
// if(value != null){
// setCurrentUserNick(value.getNick());
// setCurrentUserAvatar(value.getAvatar());
// }
// }
//
// @Override
// public void onError(int error, String errorMsg) {
//
// }
// });
//
// }
public void asyncGetUserInfo(final String username,final EMValueCallBack<EaseUser> callback){
ParseManager.getInstance().asyncGetUserInfo(username, callback);
}
private void setCurrentUserNick(String nickname) {
getCurrentUserInfo().setNick(nickname);
PreferenceManager.getInstance().setCurrentUserNick(nickname);
}
private void setCurrentUserAvatar(String avatar) {
getCurrentUserInfo().setAvatar(avatar);
PreferenceManager.getInstance().setCurrentUserAvatar(avatar);
}
private String getCurrentUserNick() {
return PreferenceManager.getInstance().getCurrentUserNick();
}
private String getCurrentUserAvatar() {
return PreferenceManager.getInstance().getCurrentUserAvatar();
}
}
|
[
"458079442@qq.com"
] |
458079442@qq.com
|
7b1a34f68715163099d06c7c0c24819b3ca88b21
|
c143976e0f89ec73cad243e692abe3f78fd46aef
|
/springmvc/src/test/slowvic/shiro/realm/SimpleRealm.java
|
907db64752cd629786f0b791ac9c086873a460c8
|
[] |
no_license
|
wusuoming/lyon
|
b746826780f719b1345acc29f6f331aa29ceef89
|
08d212447f65ca54846487f79c0d4d9dfefbfa1f
|
refs/heads/master
| 2021-01-10T01:53:06.021647
| 2014-07-23T10:28:37
| 2014-07-23T10:28:37
| 44,794,729
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,306
|
java
|
package test.slowvic.shiro.realm;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.realm.Realm;
public class SimpleRealm implements Realm {
@Override
public String getName() {
return "simpleRealm";
}
@Override
public boolean supports(AuthenticationToken token) {
return token instanceof UsernamePasswordToken;
}
@Override
public AuthenticationInfo getAuthenticationInfo(AuthenticationToken token)
throws AuthenticationException {
String userName = (String) token.getPrincipal();
String password = new String((char[]) (token.getCredentials()));
if (!"zhang".equals(userName)) {
throw new UnknownAccountException();
}
else if (!"123".equals(password)) {
throw new IncorrectCredentialsException();
}
return new SimpleAuthenticationInfo(token, userName, getName());
}
}
|
[
"steinyxu@gmail.com"
] |
steinyxu@gmail.com
|
7a913f798a02bdbd841af8eb9ba8e9d796e38053
|
29a861c79f1f218211c8e2be07232a94c35da66f
|
/src/javaprograms/Pattern5.java
|
e91a3e5f42bf0738a70d85a92668594b179f3ed4
|
[] |
no_license
|
shivamsharma24/Java-programs
|
fe7a8586c04e2b1d26c95841211889654c744a0c
|
6479f78070334d36f14fdcdc684a1e4260c8ac5d
|
refs/heads/master
| 2020-03-21T09:05:35.418911
| 2018-06-23T07:57:09
| 2018-06-23T07:57:09
| 138,382,779
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 300
|
java
|
package javaprograms;
public class Pattern5 {
/**
7 6 5 4 3 2 1
7 6 5 4 3 2
7 6 5 4 3
7 6 5 4
7 6 5
7 6
7
*/
public static void main(String[] args) {
for(int i=1;i<=7;i++)
{
for(int j=7;j>=i;j--)
{
System.out.print(j+" ");
}
System.out.println();
}
}
}
|
[
"shivamsharma2400@gmail.com"
] |
shivamsharma2400@gmail.com
|
19534c505731b7b576c42867eace316490891d3e
|
f123c92704e5aa15dfd2e3ab0ecb3c7dfb8b87f2
|
/LOTR/src/main/java/lotr/common/world/feature/LOTRWorldGenSimpleTrees.java
|
8348f74f75e6ae79dc66aa8b6a964dfe948d78de
|
[] |
no_license
|
Myrninvollo/LOTR-Minecraft-Mod
|
2dcaabb659bfc10b41332f975209f2f8cd7e3f55
|
97843fd05ae9fc7a7f61021fbe288db0f0b4298b
|
refs/heads/master
| 2020-12-30T22:58:22.274461
| 2014-10-12T19:06:55
| 2014-10-12T19:06:55
| 24,939,635
| 1
| 1
| null | 2014-10-12T19:06:55
| 2014-10-08T12:30:52
| null |
UTF-8
|
Java
| false
| false
| 6,696
|
java
|
package lotr.common.world.feature;
import java.util.Random;
import lotr.common.LOTRMod;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
public class LOTRWorldGenSimpleTrees extends WorldGenAbstractTree
{
private int minHeight;
private int maxHeight;
private Block woodID;
private int woodMeta;
private Block leafID;
private int leafMeta;
private int extraTrunkWidth;
private LOTRWorldGenSimpleTrees(boolean flag, int i, int j, Block k, int l, Block i1, int j1)
{
super(flag);
minHeight = i;
maxHeight = j;
woodID = k;
woodMeta = l;
leafID = i1;
leafMeta = j1;
}
public LOTRWorldGenSimpleTrees setTrunkWidth(int i)
{
extraTrunkWidth = i - 1;
return this;
}
public static LOTRWorldGenSimpleTrees newMallorn(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 9, 15, LOTRMod.wood, 1, LOTRMod.leaves, 1);
}
public static LOTRWorldGenSimpleTrees newApple(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 4, 7, LOTRMod.fruitWood, 0, LOTRMod.fruitLeaves, 0);
}
public static LOTRWorldGenSimpleTrees newPear(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 4, 5, LOTRMod.fruitWood, 1, LOTRMod.fruitLeaves, 1);
}
public static LOTRWorldGenSimpleTrees newCherry(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 4, 8, LOTRMod.fruitWood, 2, LOTRMod.fruitLeaves, 2);
}
public static LOTRWorldGenSimpleTrees newMango(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 4, 7, LOTRMod.fruitWood, 3, LOTRMod.fruitLeaves, 3);
}
public static LOTRWorldGenSimpleTrees newLebethron(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 5, 9, LOTRMod.wood2, 0, LOTRMod.leaves2, 0);
}
public static LOTRWorldGenSimpleTrees newLebethronLarge(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 11, 18, LOTRMod.wood2, 0, LOTRMod.leaves2, 0).setTrunkWidth(2);
}
public static LOTRWorldGenSimpleTrees newBeech(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 5, 9, LOTRMod.wood2, 1, LOTRMod.leaves2, 1);
}
public static LOTRWorldGenSimpleTrees newMaple(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 4, 8, LOTRMod.wood3, 0, LOTRMod.leaves3, 0);
}
public static LOTRWorldGenSimpleTrees newChestnut(boolean flag)
{
return new LOTRWorldGenSimpleTrees(flag, 5, 7, LOTRMod.wood4, 0, LOTRMod.leaves4, 0);
}
@Override
public boolean generate(World world, Random random, int i, int j, int k)
{
int height = MathHelper.getRandomIntegerInRange(random, minHeight, maxHeight);
boolean flag = true;
if (j >= 1 && j + height + 1 <= 256)
{
for (int j1 = j; j1 <= j + 1 + height; j1++)
{
int range = 1;
if (j1 == j)
{
range = 0;
}
if (j1 >= j + 1 + height - 2)
{
range = 2;
}
for (int i1 = i - range; i1 <= i + range + extraTrunkWidth && flag; i1++)
{
for (int k1 = k - range; k1 <= k + range + extraTrunkWidth && flag; k1++)
{
if (j1 >= 0 && j1 < 256)
{
Block block = world.getBlock(i1, j1, k1);
if (block.getMaterial() != Material.air && !block.isLeaves(world, i1, j1, k1) && block != Blocks.grass && block != Blocks.dirt && !block.isWood(world, i1, j1, k1))
{
flag = false;
}
}
else
{
flag = false;
}
}
}
}
if (!flag)
{
return false;
}
else
{
boolean flag1 = true;
for (int i1 = i; i1 <= i + extraTrunkWidth && flag1; i1++)
{
for (int k1 = k; k1 <= k + extraTrunkWidth && flag1; k1++)
{
Block block = world.getBlock(i1, j - 1, k1);
flag1 = ((block == Blocks.grass || block == Blocks.dirt) && j < 256 - height - 1);
}
}
if (flag1)
{
for (int i1 = i; i1 <= i + extraTrunkWidth; i1++)
{
for (int k1 = k; k1 <= k + extraTrunkWidth; k1++)
{
setBlockAndNotifyAdequately(world, i1, j - 1, k1, Blocks.dirt, 0);
}
}
byte leafStart = 3;
byte leafRangeMin = 0;
for (int j1 = j - leafStart + height; j1 <= j + height; j1++)
{
int j2 = j1 - (j + height);
int leafRange = leafRangeMin + 1 - j2 / 2;
for (int i1 = i - leafRange; i1 <= i + leafRange + extraTrunkWidth; i1++)
{
int i2 = i1 - i;
if (i2 > 0)
{
i2 -= extraTrunkWidth;
}
for (int k1 = k - leafRange; k1 <= k + leafRange + extraTrunkWidth; k1++)
{
int k2 = k1 - k;
if (k2 > 0)
{
k2 -= extraTrunkWidth;
}
Block block = world.getBlock(i1, j1, k1);
if ((Math.abs(i2) != leafRange || Math.abs(k2) != leafRange || random.nextInt(2) != 0 && j2 != 0) && block.canBeReplacedByLeaves(world, i1, j1, k1))
{
setBlockAndNotifyAdequately(world, i1, j1, k1, leafID, leafMeta);
}
}
}
}
for (int j1 = 0; j1 < height; j1++)
{
for (int i1 = i; i1 <= i + extraTrunkWidth; i1++)
{
for (int k1 = k; k1 <= k + extraTrunkWidth; k1++)
{
Block block = world.getBlock(i1, j + j1, k1);
if (block.getMaterial() == Material.air || block.isLeaves(world, i1, j + j1, k1))
{
setBlockAndNotifyAdequately(world, i1, j + j1, k1, woodID, woodMeta);
}
}
}
}
return true;
}
else
{
return false;
}
}
}
else
{
return false;
}
}
}
|
[
"jakegerzimbke@live.co.uk"
] |
jakegerzimbke@live.co.uk
|
2da35dc862ad7bfdd25bcee34aea7ce462119f9c
|
47f7651d1c631b8ba11f5cfdf92a7d63c8e015b4
|
/BWServer/dataService/initializeaccountdataService/InitializeAccountDataService_Stub.java
|
740ec2e1a0f882815fe03e823d05cd5d53f4b251
|
[] |
no_license
|
gsyqwe/SoftEngineering2
|
416e75f455ef27de3d7aaadbf58e418b1e201a28
|
7b8e89ec13446f031e7dfb25f84ee503b7d410ff
|
refs/heads/master
| 2020-04-06T15:31:55.513211
| 2018-11-15T17:53:54
| 2018-11-15T17:53:54
| 157,581,937
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 504
|
java
|
//package initializeaccountdataService;
//
//
//import java.util.ArrayList;
//
//import PO.InitializeAccountPO;
//import enums.ResultMessage;
//
//public class InitializeAccountDataService_Stub implements InitializeAccountDataService {
// @Override
// public ArrayList<InitializeAccountPO> getList() {
// // TODO Auto-generated method stub
// return null;
// }
//
// @Override
// public ResultMessage insert(InitializeAccountPO po) {
// // TODO Auto-generated method stub
// return null;
// }
//
//}
|
[
"576510673@qq.com"
] |
576510673@qq.com
|
2aae37eeb57dcd187402803be9aad57ed8000c15
|
358c4ceec836ff8de51e000f59031640ca9fbf8c
|
/作业10/Memento.java
|
4b265ee65138f1d73af3bead38b4403d67645b36
|
[] |
no_license
|
lucky-alt/design-mode
|
3c2a31e69864830faa4db2dd2afc27e1668a8564
|
b7b335a9ec83c3bcf44530e0e1b40e61d7aea82f
|
refs/heads/master
| 2023-05-12T09:16:56.833107
| 2021-06-06T06:55:18
| 2021-06-06T06:55:18
| 355,434,707
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 177
|
java
|
public class Memento {
private State state;
public Memento(State state) {
this.state = state;
}
public State getState() {
return state;
}
}
|
[
"2323187117@qq.com"
] |
2323187117@qq.com
|
62316dcfc54a73deedf00669ae8273e25beae89c
|
7bdc34b26fb1a5ad9d88c13abf1d4a2c7ffc6d26
|
/src/main/java/com/demo/supportportal/exceptions/UserNotFoundException.java
|
57d7f8304772d91685d7952e61fd248878f50563
|
[] |
no_license
|
pks9862728888/support-portal
|
46ee12728cfac3171a9f88aefc5cc371ae9fc972
|
a2201b2f254ca08c700ff27c6dbe3d9f47a577c8
|
refs/heads/master
| 2023-04-27T18:06:56.738416
| 2021-05-17T08:31:48
| 2021-05-17T08:31:48
| 364,759,306
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 184
|
java
|
package com.demo.supportportal.exceptions;
public class UserNotFoundException extends Exception {
public UserNotFoundException(String message) {
super(message);
}
}
|
[
"pks9862728888@gmail.com"
] |
pks9862728888@gmail.com
|
ac6ab929ec6502a5415a34cc40fc6d4475d62ffd
|
b4da726763e4690a3f6eeaad58b71176fdbf0c4f
|
/src/com/akjava/gwt/clothhair/client/hair/HairDataUtils.java
|
1916dcd195604e8db889a7be151a5c9fe5f15d09
|
[] |
no_license
|
akjava/GWTThreeClothHair
|
350cecaddfba1165baba270f0ff5cfc2d9aef0c7
|
b910e0605974e18f4ad3d1fe2e72ddb9dd02f0d9
|
refs/heads/master
| 2020-05-22T06:45:21.870888
| 2017-01-20T02:49:08
| 2017-01-20T02:49:08
| 60,046,406
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,187
|
java
|
package com.akjava.gwt.clothhair.client.hair;
import java.util.List;
import com.akjava.gwt.clothhair.client.hair.HairData.HairPin;
import com.akjava.gwt.clothhair.client.hair.HairPinDataFunctions.HairPinToVertex;
import com.akjava.gwt.three.client.js.math.Vector3;
import com.akjava.gwt.three.client.js.objects.Mesh;
import com.google.common.collect.FluentIterable;
public class HairDataUtils {
public static double getTotalVDistance(double uDistance,int uSize,int vSize){
return (double)vSize/(double)uSize*uDistance;
}
public static double getTotalPinDistance(List<HairPin> pins,Mesh mesh,boolean applymatrix){
double distance=0;
HairPinToVertex hairPinToVertex= new HairPinToVertex(mesh,applymatrix);
List<Vector3> vecs=FluentIterable.from(pins).filter(HairPinPredicates.NoTargetOnly()).transform(hairPinToVertex).toList();
for(int i=0;i<vecs.size()-1;i++){
double d=vecs.get(i).distanceTo(vecs.get(i+1));
distance+=d;
}
return distance;
}
public static double getTotalPinDistance(HairData hairData,Mesh mesh,boolean applymatrix){
return getTotalPinDistance(hairData.getHairPins(),mesh,applymatrix);
}
}
|
[
"akimisaki3@gmail.com"
] |
akimisaki3@gmail.com
|
d1481c1517df1b4018118c2b74e0ecb3283a82da
|
eb4e0658523bfd36cc0758cfc1d8a0b305a97c50
|
/src/java/com/bizosys/oneline/util/SqlValidator.java
|
d0ccab6251aa952b505a26e9b0d4c2a31ef1e781
|
[] |
no_license
|
bizosys/oneline-server
|
050e95977c211b41b62e63a5d37c3801d66f0647
|
ef8efca0e4f7dfa6a849858e2ae3f5e0fef67457
|
refs/heads/master
| 2021-01-10T14:09:38.473424
| 2015-11-05T10:37:30
| 2015-11-05T10:37:30
| 45,603,908
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,270
|
java
|
/**
* Copyright 2010 Bizosys Technologies Limited
*
* Licensed to the Bizosys Technologies Limited (Bizosys) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Bizosys licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bizosys.oneline.util;
import com.bizosys.oneline.sql.QueryDefinationFactory;
import com.foundationdb.sql.StandardException;
import com.foundationdb.sql.parser.SQLParser;
public class SqlValidator {
static SQLParser parser = new SQLParser();
public static String validateSql( String sql ) {
String message = "OK";
try {
String parsedQuery = QueryDefinationFactory.getVariables(sql, null, null);
if( parsedQuery.indexOf("__where") > 0 )
parsedQuery = parsedQuery.replace("__where", "1=1");
if( parsedQuery.indexOf("__sort") > 0 ){
parsedQuery = parsedQuery.replace("order by __sort", "");
parsedQuery = parsedQuery.replace("ORDER BY __sort", "");
}
if( parsedQuery.indexOf("__offset") > 0 ){
parsedQuery = parsedQuery.replace("offset __offset", "");
parsedQuery = parsedQuery.replace("OFFSET __offset", "");
}
if( parsedQuery.indexOf("__limit") > 0 ){
parsedQuery = parsedQuery.replace("limit __limit", "");
parsedQuery = parsedQuery.replace("LIMIT __limit", "");
}
parser.parseStatement(parsedQuery);
} catch (StandardException e) {
message = "Syntax error : " + e.getMessage().split("\n")[0];
}
return message;
}
public static void main(String[] args) {
String sql = "select id,name,class from test where id = @id $mywhere";
String message = SqlValidator.validateSql(sql);
System.out.println( message );
}
}
|
[
"shubhendu5shekhar@yahoo.co.in"
] |
shubhendu5shekhar@yahoo.co.in
|
f052ca6e98b7d7b6d4a6b40b976057267247aa2e
|
a2f6fa1bf2a45e9dbd1365f239bf833638ba83df
|
/项目练习/单机考试管理软件/老师的代码/step3/Exam/src/com/winstar/exam/test/Exam.java
|
bb87cf2061ed02fb45c8b98d656402485718d868
|
[] |
no_license
|
Follow-your-body/JavaLearnBasic
|
4f8a070dad347686e06c3bd7a106f98ddfe2f31c
|
cbe24213f6621870b9ac9a970ff15ab37c7f1146
|
refs/heads/master
| 2021-01-18T16:53:13.730346
| 2017-04-16T05:29:45
| 2017-04-16T05:29:45
| 86,778,360
| 0
| 0
| null | null | null | null |
ISO-8859-7
|
Java
| false
| false
| 673
|
java
|
package com.winstar.exam.test;
import com.winstar.exam.domain.Item;
import com.winstar.exam.service.ItemService;
import com.winstar.exam.view.ExamView;
public class Exam {
public static void main(String[] args) {
ItemService service = new ItemService();
// Item item = service.getItem(5);
// if (item == null) {
// System.out.println("ΜβΊΕ²»ΆΤ");
// } else {
// System.out.println(item);
// }
// char[] chs={'a','1','b'};
// service.saveAnswer(chs);
// char[] result=service.readAnswer();
// System.out.println(result);
// int n2 = 3;
// int m = 2;
// System.out.println(m + n2);
ExamView ev = new ExamView();
ev.testExam();
}
}
|
[
"dan___chen@163.com"
] |
dan___chen@163.com
|
8da2bdd55c3f4087597a6fd8808cec58867f7ad6
|
067f6b1acfe42fc7ae782a9e569690a3297125f9
|
/servlets-master/servlets/Servlet2/src/main/java/ru/javacourse/model/Address.java
|
7ac483bebc1fc0a5efdcc845e26741593bba4c87
|
[] |
no_license
|
VitaliiMaltsev/Servlets
|
7faaab5dbb0ba5afd0bad3f68ff3b5ce29c28ea8
|
5f4fab4c968bce22ea513b426af2f7fff66d1c02
|
refs/heads/master
| 2020-03-23T17:04:25.684052
| 2018-07-24T00:02:33
| 2018-07-24T00:02:33
| 141,841,378
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 918
|
java
|
package ru.javacourse.model;
public class Address {
private String country;
private String city;
private String street;
private int zip;
public Address() {
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public int getZip() {
return zip;
}
public void setZip(int zip) {
this.zip = zip;
}
public Address(String country, String city, String street, int zip) {
this.country = country;
this.city = city;
this.street = street;
this.zip = zip;
}
}
|
[
"ihbectop@gmail.com"
] |
ihbectop@gmail.com
|
2815f39b0a5f142559b1333575ca829a2a0c1c8a
|
9e8f28c189f2b98916a34865044e794989aff314
|
/6.PRO192x_Java/BeeGame_Assign 2/src/BeeGame/Main.java
|
a9e276729aa6527c0e3c5e25133cb73c38066cba
|
[] |
no_license
|
quyetdong/Funix-Projects
|
1831cf3006d24e707a9578d00cd68ff80cdd1470
|
f3329f0e35e1b6ab1a377631f3566fa15ecc73a4
|
refs/heads/master
| 2020-06-10T15:59:12.017019
| 2019-06-25T08:36:45
| 2019-06-25T08:36:45
| 193,667,528
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 617
|
java
|
package BeeGame;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Choose one of following options:");
System.out.println("1. Create a bee list: include 10 bees, each bee"
+ " is one of three types: Queen, Drone, Worker");
System.out.println("2. Attack bees in the list");
Scanner in = new Scanner(System.in);
Bee[] beeList = new Bee[10];
beeList = PlayBeeGame.startGame(in, beeList);
beeList = PlayBeeGame.attackBee(in, beeList);
System.out.println("You've won!");
PlayBeeGame.printBeeList(beeList);
in.close();
}
}
|
[
"quyet.dv@temando.com"
] |
quyet.dv@temando.com
|
f2b4b4da92e31f02f53c410dc17d582ab8075340
|
8ba86df142e19635197a3fda9cb45845bb250de6
|
/platforms/android/src/com/ionicframework/livefutsal400843/MainActivity.java
|
393dd730a2b6921d8e1ab53cbd71de3a1999600a
|
[] |
no_license
|
gallar12d/LiveFutsal
|
7577b9c7228186bcac0a4f45e71db9275f062d76
|
d1c337b4bc79046298df91e3f9bcfd983e046982
|
refs/heads/master
| 2020-04-06T07:06:59.542028
| 2016-08-31T17:04:58
| 2016-08-31T17:04:58
| 61,656,188
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,228
|
java
|
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.ionicframework.livefutsal400843;
import android.os.Bundle;
import org.apache.cordova.*;
public class MainActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
}
}
|
[
"hernanchelo1992@gmailcom"
] |
hernanchelo1992@gmailcom
|
b8d249149bb77bc7ef4081af146c6e7b3461a640
|
56161c48587b273caa45c54802c8fb9215e6fae2
|
/src/test/java/com/cheikh/invoice/security/DomainUserDetailsServiceIT.java
|
445dbdd456f4f4fc0fb0f478b53cbc4f6caeeff8
|
[] |
no_license
|
chawki008/invoice_project
|
528f55627e30f8aed678c8c5ed2b4ad1ad2d40c5
|
dc1a02b7349864f8a976838d19077828d94c5d29
|
refs/heads/master
| 2022-04-04T02:09:21.710619
| 2019-12-29T20:21:53
| 2019-12-29T20:21:53
| 205,734,743
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,714
|
java
|
package com.cheikh.invoice.security;
import com.cheikh.invoice.InvoiceProjectApp;
import com.cheikh.invoice.domain.User;
import com.cheikh.invoice.repository.UserRepository;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Transactional;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
/**
* Integrations tests for {@link DomainUserDetailsService}.
*/
@SpringBootTest(classes = InvoiceProjectApp.class)
@Transactional
public class DomainUserDetailsServiceIT {
private static final String USER_ONE_LOGIN = "test-user-one";
private static final String USER_ONE_EMAIL = "test-user-one@localhost";
private static final String USER_TWO_LOGIN = "test-user-two";
private static final String USER_TWO_EMAIL = "test-user-two@localhost";
private static final String USER_THREE_LOGIN = "test-user-three";
private static final String USER_THREE_EMAIL = "test-user-three@localhost";
@Autowired
private UserRepository userRepository;
@Autowired
private UserDetailsService domainUserDetailsService;
private User userOne;
private User userTwo;
private User userThree;
@BeforeEach
public void init() {
userOne = new User();
userOne.setLogin(USER_ONE_LOGIN);
userOne.setPassword(RandomStringUtils.random(60));
userOne.setActivated(true);
userOne.setEmail(USER_ONE_EMAIL);
userOne.setFirstName("userOne");
userOne.setLastName("doe");
userOne.setLangKey("en");
userRepository.save(userOne);
userTwo = new User();
userTwo.setLogin(USER_TWO_LOGIN);
userTwo.setPassword(RandomStringUtils.random(60));
userTwo.setActivated(true);
userTwo.setEmail(USER_TWO_EMAIL);
userTwo.setFirstName("userTwo");
userTwo.setLastName("doe");
userTwo.setLangKey("en");
userRepository.save(userTwo);
userThree = new User();
userThree.setLogin(USER_THREE_LOGIN);
userThree.setPassword(RandomStringUtils.random(60));
userThree.setActivated(false);
userThree.setEmail(USER_THREE_EMAIL);
userThree.setFirstName("userThree");
userThree.setLastName("doe");
userThree.setLangKey("en");
userRepository.save(userThree);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByLoginIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByEmail() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByEmailIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
@Transactional
public void assertThatEmailIsPrioritizedOverLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
@Transactional
public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() {
assertThatExceptionOfType(UserNotActivatedException.class).isThrownBy(
() -> domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN));
}
}
|
[
"cheikh.chawki@outlook.com"
] |
cheikh.chawki@outlook.com
|
1c0b570faa33061d9707a0771b298e8582ef456e
|
21765f2f6d0adc5798eac4798dca929a0f61b0d4
|
/app/src/main/java/com/example/place_travel2021/Activity_chitietdiadiem.java
|
840b20391f978c27548ebd461597f1f87d8fb885
|
[] |
no_license
|
Huang-Github20/demo2
|
209e38efb0146fbe32a4ab48a9068697fe31d2a0
|
e594153f0fe022c06be5eba54280c1eb77e82155
|
refs/heads/master
| 2023-04-01T06:11:25.362696
| 2021-04-16T10:40:19
| 2021-04-16T10:40:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,401
|
java
|
package com.example.place_travel2021;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.example.place_travel2021.fragment.Fragment_Home;
public class Activity_chitietdiadiem extends AppCompatActivity {
ImageView imagect;
Button btnbackct,btndattour;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chitietdiadiem);
btnbackct=(Button)findViewById(R.id.btn_back_ct);
btndattour=(Button)findViewById(R.id.btn_dattour);
btnbackct.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Activity_chitietdiadiem.this,MainActivity.class));
}
});
btndattour.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Activity_chitietdiadiem.this,Activivty_Dattour.class));
}
});
}
}
|
[
"luuviethoang357@gmail.com"
] |
luuviethoang357@gmail.com
|
e02809d87e60adeaaaecaa44b8ad8ac568f15191
|
37992a7083efea148c66381a2e7c988f59de712b
|
/cppk/app/src/main/java/ru/ppr/cppk/ui/activity/fineListManagement/FineListManagementPresenter.java
|
c04a814b540f994b0d7efcd358a093e74585be7f
|
[] |
no_license
|
RVC3/PTK
|
5ab897d6abee1f7f7be3ba49c893b97e719085e9
|
1052b2bfa8f565c96a85d5c5928ed6c938a20543
|
refs/heads/master
| 2022-12-22T22:11:40.231298
| 2020-07-01T09:45:38
| 2020-07-01T09:45:38
| 259,278,530
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,315
|
java
|
package ru.ppr.cppk.ui.activity.fineListManagement;
import android.support.annotation.NonNull;
import com.google.common.primitives.Longs;
import java.util.ArrayList;
import java.util.List;
import ru.ppr.core.ui.mvp.presenter.BaseMvpPresenter;
import ru.ppr.cppk.db.LocalDaoSession;
import ru.ppr.cppk.di.Dagger;
import ru.ppr.cppk.entity.settings.PrivateSettings;
import ru.ppr.cppk.managers.NsiVersionManager;
import ru.ppr.nsi.NsiDaoSession;
import ru.ppr.nsi.entity.Fine;
import ru.ppr.nsi.repository.FineRepository;
/**
* @author Dmitry Nevolin
*/
public class FineListManagementPresenter extends BaseMvpPresenter<FineListManagementView> {
private InteractionListener interactionListener;
private boolean initialized = false;
private LocalDaoSession localDaoSession;
private NsiDaoSession nsiDaoSession;
private PrivateSettings privateSettings;
private NsiVersionManager nsiVersionManager;
private FineRepository fineRepository;
/**
* Список кодов разрешенных штрафов
*/
private List<Long> allowedFineCodeList;
void initialize(@NonNull LocalDaoSession localDaoSession,
@NonNull NsiDaoSession nsiDaoSession,
@NonNull PrivateSettings privateSettings,
@NonNull NsiVersionManager nsiVersionManager,
@NonNull FineRepository fineRepository) {
if (!initialized) {
this.initialized = true;
this.localDaoSession = localDaoSession;
this.nsiDaoSession = nsiDaoSession;
this.privateSettings = privateSettings;
this.nsiVersionManager = nsiVersionManager;
this.allowedFineCodeList = new ArrayList<>();
this.fineRepository = fineRepository;
onInitialize();
}
}
void bindInteractionListener(@NonNull InteractionListener interactionListener) {
this.interactionListener = interactionListener;
}
void onFineChecked(@NonNull Fine fine, boolean isChecked) {
if (isChecked && !allowedFineCodeList.contains(fine.getCode())) {
allowedFineCodeList.add(fine.getCode());
} else if (!isChecked && allowedFineCodeList.contains(fine.getCode())) {
allowedFineCodeList.remove(fine.getCode());
}
privateSettings.setAllowedFineCodes(Longs.toArray(allowedFineCodeList));
Dagger.appComponent().privateSettingsRepository().savePrivateSettings(privateSettings);
}
void onFineListIsEmptyDialogDismiss() {
interactionListener.returnToPreviousScreen();
}
private void onInitialize() {
long[] allowedFineCodes = privateSettings.getAllowedFineCodes();
int nsiVersion = nsiVersionManager.getCurrentNsiVersionId();
List<Fine> fineList = fineRepository.loadAll(nsiVersion);
if (allowedFineCodes != null) {
allowedFineCodeList.addAll(Longs.asList(allowedFineCodes));
}
view.setAllowedFineCodeList(allowedFineCodeList);
view.setFineList(fineList);
view.setFineListIsEmptyDialogVisible(fineList.isEmpty());
}
/**
* Интерфейс обработки событий.
*/
public interface InteractionListener {
void returnToPreviousScreen();
}
}
|
[
"kopanevartem@mail.ru"
] |
kopanevartem@mail.ru
|
cef80d70a88aa1c022784a124fe1186e1311f478
|
411da3bc03a68746067a1d6f7c34b0b084f462bc
|
/commons-springtools/src/main/scala/com/shengpay/commons/springtools/annotation/ParamName.java
|
58a038d86874e4f23c944388dd6fe5f270ab03da
|
[] |
no_license
|
wulliam/commons
|
82d0da7d0835dc54ad7363edf84f9fb161b62b8a
|
c9e903b915eeb55d27b07252e49e67320212ed86
|
refs/heads/master
| 2021-01-15T11:13:44.312740
| 2014-07-02T02:40:19
| 2014-07-02T02:40:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 389
|
java
|
package com.shengpay.commons.springtools.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.PARAMETER })
@Documented
public @interface ParamName {
String value();
}
|
[
"lindongcheng@163.com"
] |
lindongcheng@163.com
|
dcf1de941c81106d3cc38739a80972b7979a21a4
|
d0b2e7a5886252cbbaad9f44599eac7e3576e7a8
|
/src/main/java/student_valerija_ionova/lesson_10/level_6/refactoring_methods_mot_more_than_3_strings/BookReaderImpl.java
|
15aa942733a6aa685bdb6971a9555e9a4af54181
|
[] |
no_license
|
Dmitryyyyo/java_1_tuesday_2020_online
|
ac1b44822a2aed40a6e12e6909e9b8c699e57d4c
|
7e3bba7ead444d0b2bf1b6715289b2fcc4d22c54
|
refs/heads/master
| 2023-01-02T11:21:40.223345
| 2020-10-21T18:02:55
| 2020-10-21T18:02:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,033
|
java
|
package student_valerija_ionova.lesson_10.level_6.refactoring_methods_mot_more_than_3_strings;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class BookReaderImpl implements BookReader{
private List<Book> bookDatabase;
BookReaderImpl (Book...books){
this.bookDatabase = new ArrayList<>(Arrays.asList(books));
}
public List <Book> getBookDatabase (){
return bookDatabase;
}
public boolean addBook (Book book){
if (!bookDatabase.contains(book) && isValidBook(book)){
bookDatabase.add(book);
return true;
}
return false;
}
public boolean deleteBook (Book book){
if (bookDatabase.contains(book)){
bookDatabase.remove(book);
return true;
}
return false;
}
@Override
public String[] getArrayOfBooks() {
return bookDatabase.stream()
.map(book -> addBookToArray(book))
.toArray(String [] :: new);
}
private String addBookToArray (Book book){
return book.getTitle() + " [" + book.getAuthor() + "]";
}
@Override
public List<Book> findBookByAuthor(String author) {
return bookDatabase.stream()
.filter (book -> matchAuthor(book, author))
.collect(Collectors.toList());
}
@Override
public List<Book> findBookByTitle(String title) {
return bookDatabase.stream()
.filter (book -> matchTitle(book, title))
.collect(Collectors.toList());
}
@Override
public boolean markAsRead(Book book) {
if (bookDatabase.contains(book)){
bookDatabase.get(bookDatabase.indexOf(book)).setRead(true);
}
return bookDatabase.contains(book);
}
@Override
public boolean markAsNotRead(Book book) {
if (bookDatabase.contains(book)){
bookDatabase.get(bookDatabase.indexOf(book)).setRead(false);
}
return bookDatabase.contains(book);
}
@Override
public String[] getArrayOfReadBooks() {
return bookDatabase.stream()
.filter(book -> book.getIsRead())
.map(book -> addBookToArray(book))
.toArray(String[]::new);
}
@Override
public String[] getArrayOfNotReadBooks() {
return bookDatabase.stream()
.filter(book -> !book.getIsRead())
.map(book -> addBookToArray(book))
.toArray(String[]::new);
}
private boolean matchAuthor (Book book, String author){
return book.getAuthor().startsWith(author);
}
private boolean matchTitle (Book book, String title){
return book.getTitle().startsWith(title);
}
private boolean isValidBook (Book book){
return (book.getTitle() != null) && (book.getAuthor() != null) &&
(book.getTitle().length() > 0) && (book.getAuthor().length() > 0);
}
}
|
[
"55547022+ValerijaI@users.noreply.github.com"
] |
55547022+ValerijaI@users.noreply.github.com
|
d8614c0bb36b64a2afed86e255097a3d665fd09a
|
ba84bb6c0c8ea79d5f4810c1fc96ad364c511276
|
/src/main/java/tools/tcpprint/TcpPrinter.java
|
47faf651e3b888dff74b462dfd12637d30ed46c7
|
[] |
no_license
|
jmcabrera/tools
|
977439ec3013aa59dedd20e684327910aeca0a4d
|
b6e9fa457dc0b459abe0edc54741db1fc1af8d58
|
refs/heads/master
| 2016-08-10T16:45:21.133815
| 2016-01-26T13:35:47
| 2016-01-26T13:35:47
| 50,430,143
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 923
|
java
|
/**
*
*/
package tools.tcpprint;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.ServerSocket;
import java.net.Socket;
/**
* @author a208220 - Juan Manuel CABRERA
*
*/
public class TcpPrinter {
static final int DEFAULT_PORT = 12345;
public static void main(String[] args) throws IOException {
int port = args.length > 0 ? Integer.parseInt(args[0]) : DEFAULT_PORT;
try (ServerSocket seso = new ServerSocket(port)) {
while (true) {
try {
Socket so = seso.accept();
try (Reader r = new InputStreamReader(so.getInputStream())) {
char c;
while (-1 != (c = (char) r.read())) {
System.out.print(c);
}
}
System.out.println("<end of connection>");
}
catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
|
[
"juanma.cabrera@gmail.com"
] |
juanma.cabrera@gmail.com
|
7b7b5a96824084818bcf39f433747bc16c541709
|
e254ed81382af531f05d69c3be5307b2d855196d
|
/src/net/aurore/datamanager/AuroreStatsJPAImpl.java
|
378c2f3545603ed2a38e8806a8c55261ed6372ab
|
[] |
no_license
|
Zeusu/Aurore-DOWN-
|
73dd3a9790483d4287454be7021c13d30ccffe76
|
8ac7888ec5079801942409f47aa48d1a65e7df79
|
refs/heads/master
| 2022-03-26T08:27:06.059404
| 2018-05-27T08:14:53
| 2018-05-27T08:14:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,720
|
java
|
package net.aurore.datamanager;
import org.hibernate.Session;
import org.hibernate.Query;
import net.aurore.entities.AuroreStats;
public class AuroreStatsJPAImpl implements AuroreStatsJPA {
private static final String PARAM_SUMMONER_ID = "summoner_id";
private static final String STATS_BY_SUMMONER_ID = "FROM AuroreStats WHERE " + PARAM_SUMMONER_ID + " = :" + PARAM_SUMMONER_ID;
private static final String GLOBAL_STATS = "FROM AuroreStats WHERE isGlobalStat = true AND " + PARAM_SUMMONER_ID + " IS NULL AND champion_focused IS NULL";
private Session sess;
private AuroreStats stats;
AuroreStatsJPAImpl(AuroreStats s, Session sess){
stats = s;
this.sess = sess;
}
@Override
public void save() {
try{
sess.beginTransaction();
AuroreStats s = null;
if(stats.getS() != null){
s = retrieve(stats.getS().getId());
}
if(s != null){
s.setAverageAssits(stats.getAverageAssits());
s.setAverageDeath(stats.getAverageDeath());
s.setAverageKill(stats.getAverageKill());
s.setKda(stats.getKda());
sess.update(s);
}else{
sess.save(stats);
}
sess.getTransaction().commit();
sess.clear();
}catch(Exception e){
e.printStackTrace();
}
}
@Override
public AuroreStats retrieve(long summonerId) {
Query query = sess.createQuery(STATS_BY_SUMMONER_ID);
query.setParameter(PARAM_SUMMONER_ID, summonerId);
Object o = query.uniqueResult();
if(o instanceof AuroreStats)
return (AuroreStats) o;
return null;
}
@Override
public AuroreStats retrieveGlobalStats() {
Query query = sess.createQuery(GLOBAL_STATS);
Object o = query.uniqueResult();
if(o instanceof AuroreStats) return (AuroreStats) o;
return null;
}
}
|
[
"pierre.md.grenier@gmail.com"
] |
pierre.md.grenier@gmail.com
|
4c92944ad8b240069e99dc0595fc0213e4143335
|
fb3f91fb6c18bb93c5d51b58d13e201203833994
|
/Desarrollo/Tools/GeneradorModel/V3/Sources/MybatisModelGenerator/src/main/java/pe/com/jrtotem/app/generator/service/IInfoDbConnectionCrudService.java
|
6b3b37ce5218739a87dc1e335f227f6fa21978ba
|
[] |
no_license
|
cgb-extjs-gwt/avgust-extjs-generator
|
d24241e594078eb8af8e33e99be64e56113a1c0c
|
30677d1fef4da73e2c72b6c6dfca85d492e1a385
|
refs/heads/master
| 2023-07-20T04:39:13.928605
| 2018-01-16T18:17:23
| 2018-01-16T18:17:23
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 614
|
java
|
package pe.com.jrtotem.app.generator.service;
import java.util.List;
import pe.com.jrtotem.app.generator.mybatis.domain.InfoDbConnection;
import pe.com.jrtotem.app.generator.mybatis.domain.InfoDbConnectionExample;
import pe.com.jrtotem.app.generator.util.IMybatisRepositoryHelper;
public interface IInfoDbConnectionCrudService extends IMybatisRepositoryHelper {
Integer create(InfoDbConnection model) throws Exception;
void save(InfoDbConnection model) throws Exception;
void remove(InfoDbConnection model) throws Exception;
List<InfoDbConnection> list(InfoDbConnectionExample example) throws Exception;
}
|
[
"raffo8924@gmail.com"
] |
raffo8924@gmail.com
|
4d39ed743d0e2b08c1017371509022ff80992aca
|
925d74b7caf5383aebb89739faa3868e28d3743e
|
/kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/food/FoodRepository.java
|
5de7b9aec4b303ccd50564afe5ac102031515e75
|
[] |
no_license
|
KrzysztofIT/6.1
|
9932d55ad6390dbeac601c4ed22b94aeb55fdf68
|
cc3e16c856aca32781ff4c35f93ac332b599c221
|
refs/heads/master
| 2020-03-16T11:23:18.266193
| 2018-09-25T19:12:45
| 2018-09-25T19:12:45
| 132,647,295
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 129
|
java
|
package com.kodilla.good.patterns.challenges.food;
public interface FoodRepository {
void createOrder(Provider provider);
}
|
[
"“krzysztofwasilewski.it@gmail.com"
] |
“krzysztofwasilewski.it@gmail.com
|
2a46ebe8ed18723442d45cc50f31b829d8ed1ed9
|
6db99455b6ea0a6e1119a6cbb3d72e5e2f94f86b
|
/416repo/416SemesterProject/src/data/ClassListMap.java
|
c462887e225365ab274c7eea52d154c0f71d4289
|
[] |
no_license
|
softwarekitty/InvestigationEngine
|
c19292b852de7027e47bae7fc90c4fa957cc34a9
|
6b94f794b2f2e240492e3b0628495d4eecdf3a25
|
refs/heads/master
| 2016-08-07T03:38:58.621242
| 2012-11-19T01:37:37
| 2012-11-19T01:37:37
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,850
|
java
|
package data;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
@SuppressWarnings("serial")
public class ClassListMap extends
HashMap<String, Pentuple<File, Integer, String, String,String>> {
public static final String[][] supportedLanguages = {
{ "java 1.6",
"/Users/carlchapman/Desktop/SE_416/japiSets/japi6.txt",
".java", "import","Java" },
{ "java 1.7",
"/Users/carlchapman/Desktop/SE_416/japiSets/japi7.txt",
".java", "import","Java" } };
public ClassListMap() {
for (String[] sa : supportedLanguages) {
try {
File f = new File(sa[1]);
put(sa[0], new Pentuple<File, Integer, String, String,String>(f,
countLines(f), sa[2], sa[3],sa[4]));
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static String[] getLanguages() {
String[] toReturn = new String[supportedLanguages.length];
for (int i = 0; i < supportedLanguages.length; i++) {
toReturn[i] = supportedLanguages[i][0];
}
return toReturn;
}
private static int countLines(File f) {
InputStream is = null;
try {
is = new BufferedInputStream(new FileInputStream(f));
byte[] c = new byte[1024];
int count = 0;
int readChars = 0;
boolean empty = true;
while ((readChars = is.read(c)) != -1) {
empty = false;
for (int i = 0; i < readChars; ++i) {
if (c[i] == '\n')
++count;
}
}
is.close();
return (count == 0 && !empty) ? 1 : count;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return 0;
}
}
|
[
"5star.venue@gmail.com"
] |
5star.venue@gmail.com
|
732fc9ebbf19b6fbb6df6fa35af0beb9f85cf162
|
ae69e30f8eb4ff2cd47e2336b2a2b31f271a3e5a
|
/Java/cses/range_queries/DynamicRangeMinimum.java
|
3bdb2f40ba8a0f6bfd26327cc850e868881a83e5
|
[] |
no_license
|
bdugersuren/CompetitiveProgramming
|
f35048ef8e5345c5219c992f2be8b84e1f7f1cb8
|
cd571222aabe3de952d90d6ddda055aa3b8c08d9
|
refs/heads/master
| 2023-05-12T00:45:15.065209
| 2021-05-14T13:24:53
| 2021-05-14T13:24:53
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,990
|
java
|
package cses.range_queries;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
public final class DynamicRangeMinimum {
private static class SegTree {
int leftMost, rightMost;
SegTree left, right;
int min;
SegTree(int leftMost, int rightMost, int[] arr) {
this.leftMost = leftMost;
this.rightMost = rightMost;
if (leftMost == rightMost) {
min = arr[leftMost];
} else {
final int mid = leftMost + rightMost >>> 1;
left = new SegTree(leftMost, mid, arr);
right = new SegTree(mid + 1, rightMost, arr);
recalc();
}
}
private void recalc() {
if (leftMost == rightMost) {
return;
}
min = Math.min(left.min, right.min);
}
private int query(int l, int r) {
if (r < leftMost || l > rightMost) {
return (int) 1e9;
}
if (l <= leftMost && rightMost <= r) {
return min;
}
return Math.min(left.query(l, r), right.query(l, r));
}
private void update(int idx, int val) {
if (leftMost == rightMost) {
min = val;
} else {
final int mid = leftMost + rightMost >>> 1;
if (idx <= mid) {
left.update(idx, val);
} else {
right.update(idx, val);
}
recalc();
}
}
}
public static void main(String[] args) throws IOException {
final FastReader fs = new FastReader();
final PrintWriter pw = new PrintWriter(System.out);
final int n = fs.nextInt();
final int q = fs.nextInt();
final int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = fs.nextInt();
}
final SegTree st = new SegTree(0, n - 1, arr);
for (int i = 0; i < q; i++) {
final int t = fs.nextInt();
if (t == 1) {
final int idx = fs.nextInt() - 1;
final int val = fs.nextInt();
st.update(idx, val);
} else {
final int l = fs.nextInt() - 1;
final int r = fs.nextInt() - 1;
pw.println(st.query(l, r));
}
}
pw.close();
}
static final class Utils {
private static class Shuffler {
private static void shuffle(int[] x) {
final Random r = new Random();
for (int i = 0; i <= x.length - 2; i++) {
final int j = i + r.nextInt(x.length - i);
swap(x, i, j);
}
}
private static void shuffle(long[] x) {
final Random r = new Random();
for (int i = 0; i <= x.length - 2; i++) {
final int j = i + r.nextInt(x.length - i);
swap(x, i, j);
}
}
private static void swap(int[] x, int i, int j) {
final int t = x[i];
x[i] = x[j];
x[j] = t;
}
private static void swap(long[] x, int i, int j) {
final long t = x[i];
x[i] = x[j];
x[j] = t;
}
}
public static void shuffleSort(int[] arr) {
Shuffler.shuffle(arr);
Arrays.sort(arr);
}
public static void shuffleSort(long[] arr) {
Shuffler.shuffle(arr);
Arrays.sort(arr);
}
private static int[][] packG(int[][] edges, int n) {
final int[][] g = new int[n][];
final int[] size = new int[n];
for (int[] edge : edges) {
++size[edge[0]];
}
for (int i = 0; i < n; i++) {
g[i] = new int[size[i]];
}
for (int[] edge : edges) {
g[edge[0]][--size[edge[0]]] = edge[1];
}
return g;
}
private static int[][][] packGW(int[][] edges, int n) {
final int[][][] g = new int[n][][];
final int[] size = new int[n];
for (int[] edge : edges) {
++size[edge[0]];
}
for (int i = 0; i < n; i++) {
g[i] = new int[size[i]][2];
}
for (int[] edge : edges) {
g[edge[0]][--size[edge[0]]] = new int[] { edge[1], edge[2] };
}
return g;
}
private Utils() {}
}
static class FastReader {
private static final int BUFFER_SIZE = 1 << 16;
private final DataInputStream din;
private final byte[] buffer;
private int bufferPointer, bytesRead;
FastReader() {
din = new DataInputStream(System.in);
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
FastReader(String file_name) throws IOException {
din = new DataInputStream(new FileInputStream(file_name));
buffer = new byte[BUFFER_SIZE];
bufferPointer = bytesRead = 0;
}
public String readLine() throws IOException {
final byte[] buf = new byte[1024]; // line length
int cnt = 0, c;
while ((c = read()) != -1) {
if (c == '\n') {
break;
}
buf[cnt++] = (byte) c;
}
return new String(buf, 0, cnt);
}
public int nextSign() throws IOException {
byte c = read();
while ('+' != c && '-' != c) {
c = read();
}
return '+' == c ? 0 : 1;
}
public int nextInt() throws IOException {
int ret = 0;
byte c = read();
while (c <= ' ') {
c = read();
}
final boolean neg = c == '-';
if (neg) { c = read(); }
do {
ret = ret * 10 + c - '0';
} while ((c = read()) >= '0' && c <= '9');
if (neg) { return -ret; }
return ret;
}
public long nextLong() throws IOException {
long ret = 0;
byte c = read();
while (c <= ' ') { c = read(); }
final boolean neg = c == '-';
if (neg) { c = read(); }
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (neg) { return -ret; }
return ret;
}
public double nextDouble() throws IOException {
double ret = 0, div = 1;
byte c = read();
while (c <= ' ') { c = read(); }
final boolean neg = c == '-';
if (neg) { c = read(); }
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg) { return -ret; }
return ret;
}
private void fillBuffer() throws IOException {
bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
if (bytesRead == -1) { buffer[0] = -1; }
}
private byte read() throws IOException {
if (bufferPointer == bytesRead) { fillBuffer(); }
return buffer[bufferPointer++];
}
public void close() throws IOException {
din.close();
}
}
}
|
[
"nirvana_rsc@yahoo.com"
] |
nirvana_rsc@yahoo.com
|
6f48e19cdc96fdd62c1ac7584fce750a0f5ca5f2
|
eb9c3dac0dca0ecd184df14b1fda62e61cc8c7d7
|
/google/api/serviceusage/v1/google-cloud-api-serviceusage-v1-java/grpc-google-cloud-api-serviceusage-v1-java/src/main/java/com/google/api/serviceusage/v1/ServiceUsageGrpc.java
|
39f9aeb1d527c13e1475269f32827cc399b78fed
|
[
"Apache-2.0"
] |
permissive
|
Tryweirder/googleapis-gen
|
2e5daf46574c3af3d448f1177eaebe809100c346
|
45d8e9377379f9d1d4e166e80415a8c1737f284d
|
refs/heads/master
| 2023-04-05T06:30:04.726589
| 2021-04-13T23:35:20
| 2021-04-13T23:35:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 38,700
|
java
|
package com.google.api.serviceusage.v1;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
* <pre>
* [Service Usage API](/service-usage/docs/overview)
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: google/api/serviceusage/v1/serviceusage.proto")
public final class ServiceUsageGrpc {
private ServiceUsageGrpc() {}
public static final String SERVICE_NAME = "google.api.serviceusage.v1.ServiceUsage";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.EnableServiceRequest,
com.google.longrunning.Operation> getEnableServiceMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "EnableService",
requestType = com.google.api.serviceusage.v1.EnableServiceRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.EnableServiceRequest,
com.google.longrunning.Operation> getEnableServiceMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.EnableServiceRequest, com.google.longrunning.Operation> getEnableServiceMethod;
if ((getEnableServiceMethod = ServiceUsageGrpc.getEnableServiceMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getEnableServiceMethod = ServiceUsageGrpc.getEnableServiceMethod) == null) {
ServiceUsageGrpc.getEnableServiceMethod = getEnableServiceMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.EnableServiceRequest, com.google.longrunning.Operation>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "EnableService"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.EnableServiceRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.Operation.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("EnableService"))
.build();
}
}
}
return getEnableServiceMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.DisableServiceRequest,
com.google.longrunning.Operation> getDisableServiceMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "DisableService",
requestType = com.google.api.serviceusage.v1.DisableServiceRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.DisableServiceRequest,
com.google.longrunning.Operation> getDisableServiceMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.DisableServiceRequest, com.google.longrunning.Operation> getDisableServiceMethod;
if ((getDisableServiceMethod = ServiceUsageGrpc.getDisableServiceMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getDisableServiceMethod = ServiceUsageGrpc.getDisableServiceMethod) == null) {
ServiceUsageGrpc.getDisableServiceMethod = getDisableServiceMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.DisableServiceRequest, com.google.longrunning.Operation>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "DisableService"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.DisableServiceRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.Operation.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("DisableService"))
.build();
}
}
}
return getDisableServiceMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.GetServiceRequest,
com.google.api.serviceusage.v1.Service> getGetServiceMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetService",
requestType = com.google.api.serviceusage.v1.GetServiceRequest.class,
responseType = com.google.api.serviceusage.v1.Service.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.GetServiceRequest,
com.google.api.serviceusage.v1.Service> getGetServiceMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.GetServiceRequest, com.google.api.serviceusage.v1.Service> getGetServiceMethod;
if ((getGetServiceMethod = ServiceUsageGrpc.getGetServiceMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getGetServiceMethod = ServiceUsageGrpc.getGetServiceMethod) == null) {
ServiceUsageGrpc.getGetServiceMethod = getGetServiceMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.GetServiceRequest, com.google.api.serviceusage.v1.Service>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetService"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.GetServiceRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.Service.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("GetService"))
.build();
}
}
}
return getGetServiceMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.ListServicesRequest,
com.google.api.serviceusage.v1.ListServicesResponse> getListServicesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ListServices",
requestType = com.google.api.serviceusage.v1.ListServicesRequest.class,
responseType = com.google.api.serviceusage.v1.ListServicesResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.ListServicesRequest,
com.google.api.serviceusage.v1.ListServicesResponse> getListServicesMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.ListServicesRequest, com.google.api.serviceusage.v1.ListServicesResponse> getListServicesMethod;
if ((getListServicesMethod = ServiceUsageGrpc.getListServicesMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getListServicesMethod = ServiceUsageGrpc.getListServicesMethod) == null) {
ServiceUsageGrpc.getListServicesMethod = getListServicesMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.ListServicesRequest, com.google.api.serviceusage.v1.ListServicesResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListServices"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.ListServicesRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.ListServicesResponse.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("ListServices"))
.build();
}
}
}
return getListServicesMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchEnableServicesRequest,
com.google.longrunning.Operation> getBatchEnableServicesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "BatchEnableServices",
requestType = com.google.api.serviceusage.v1.BatchEnableServicesRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchEnableServicesRequest,
com.google.longrunning.Operation> getBatchEnableServicesMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchEnableServicesRequest, com.google.longrunning.Operation> getBatchEnableServicesMethod;
if ((getBatchEnableServicesMethod = ServiceUsageGrpc.getBatchEnableServicesMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getBatchEnableServicesMethod = ServiceUsageGrpc.getBatchEnableServicesMethod) == null) {
ServiceUsageGrpc.getBatchEnableServicesMethod = getBatchEnableServicesMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.BatchEnableServicesRequest, com.google.longrunning.Operation>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "BatchEnableServices"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.BatchEnableServicesRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.Operation.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("BatchEnableServices"))
.build();
}
}
}
return getBatchEnableServicesMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchGetServicesRequest,
com.google.api.serviceusage.v1.BatchGetServicesResponse> getBatchGetServicesMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "BatchGetServices",
requestType = com.google.api.serviceusage.v1.BatchGetServicesRequest.class,
responseType = com.google.api.serviceusage.v1.BatchGetServicesResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchGetServicesRequest,
com.google.api.serviceusage.v1.BatchGetServicesResponse> getBatchGetServicesMethod() {
io.grpc.MethodDescriptor<com.google.api.serviceusage.v1.BatchGetServicesRequest, com.google.api.serviceusage.v1.BatchGetServicesResponse> getBatchGetServicesMethod;
if ((getBatchGetServicesMethod = ServiceUsageGrpc.getBatchGetServicesMethod) == null) {
synchronized (ServiceUsageGrpc.class) {
if ((getBatchGetServicesMethod = ServiceUsageGrpc.getBatchGetServicesMethod) == null) {
ServiceUsageGrpc.getBatchGetServicesMethod = getBatchGetServicesMethod =
io.grpc.MethodDescriptor.<com.google.api.serviceusage.v1.BatchGetServicesRequest, com.google.api.serviceusage.v1.BatchGetServicesResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "BatchGetServices"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.BatchGetServicesRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.api.serviceusage.v1.BatchGetServicesResponse.getDefaultInstance()))
.setSchemaDescriptor(new ServiceUsageMethodDescriptorSupplier("BatchGetServices"))
.build();
}
}
}
return getBatchGetServicesMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static ServiceUsageStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ServiceUsageStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ServiceUsageStub>() {
@java.lang.Override
public ServiceUsageStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageStub(channel, callOptions);
}
};
return ServiceUsageStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static ServiceUsageBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ServiceUsageBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ServiceUsageBlockingStub>() {
@java.lang.Override
public ServiceUsageBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageBlockingStub(channel, callOptions);
}
};
return ServiceUsageBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static ServiceUsageFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<ServiceUsageFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<ServiceUsageFutureStub>() {
@java.lang.Override
public ServiceUsageFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageFutureStub(channel, callOptions);
}
};
return ServiceUsageFutureStub.newStub(factory, channel);
}
/**
* <pre>
* [Service Usage API](/service-usage/docs/overview)
* </pre>
*/
public static abstract class ServiceUsageImplBase implements io.grpc.BindableService {
/**
* <pre>
* Enable a service so that it can be used with a project.
* </pre>
*/
public void enableService(com.google.api.serviceusage.v1.EnableServiceRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEnableServiceMethod(), responseObserver);
}
/**
* <pre>
* Disable a service so that it can no longer be used with a project.
* This prevents unintended usage that may cause unexpected billing
* charges or security leaks.
* It is not valid to call the disable method on a service that is not
* currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
* the target service is not currently enabled.
* </pre>
*/
public void disableService(com.google.api.serviceusage.v1.DisableServiceRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDisableServiceMethod(), responseObserver);
}
/**
* <pre>
* Returns the service configuration and enabled state for a given service.
* </pre>
*/
public void getService(com.google.api.serviceusage.v1.GetServiceRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.Service> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetServiceMethod(), responseObserver);
}
/**
* <pre>
* List all services available to the specified project, and the current
* state of those services with respect to the project. The list includes
* all public services, all services for which the calling user has the
* `servicemanagement.services.bind` permission, and all services that have
* already been enabled on the project. The list can be filtered to
* only include services in a specific state, for example to only include
* services enabled on the project.
* WARNING: If you need to query enabled services frequently or across
* an organization, you should use
* [Cloud Asset Inventory
* API](https://cloud.google.com/asset-inventory/docs/apis), which provides
* higher throughput and richer filtering capability.
* </pre>
*/
public void listServices(com.google.api.serviceusage.v1.ListServicesRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.ListServicesResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListServicesMethod(), responseObserver);
}
/**
* <pre>
* Enable multiple services on a project. The operation is atomic: if enabling
* any service fails, then the entire batch fails, and no state changes occur.
* To enable a single service, use the `EnableService` method instead.
* </pre>
*/
public void batchEnableServices(com.google.api.serviceusage.v1.BatchEnableServicesRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getBatchEnableServicesMethod(), responseObserver);
}
/**
* <pre>
* Returns the service configurations and enabled states for a given list of
* services.
* </pre>
*/
public void batchGetServices(com.google.api.serviceusage.v1.BatchGetServicesRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.BatchGetServicesResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getBatchGetServicesMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getEnableServiceMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.EnableServiceRequest,
com.google.longrunning.Operation>(
this, METHODID_ENABLE_SERVICE)))
.addMethod(
getDisableServiceMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.DisableServiceRequest,
com.google.longrunning.Operation>(
this, METHODID_DISABLE_SERVICE)))
.addMethod(
getGetServiceMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.GetServiceRequest,
com.google.api.serviceusage.v1.Service>(
this, METHODID_GET_SERVICE)))
.addMethod(
getListServicesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.ListServicesRequest,
com.google.api.serviceusage.v1.ListServicesResponse>(
this, METHODID_LIST_SERVICES)))
.addMethod(
getBatchEnableServicesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.BatchEnableServicesRequest,
com.google.longrunning.Operation>(
this, METHODID_BATCH_ENABLE_SERVICES)))
.addMethod(
getBatchGetServicesMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.google.api.serviceusage.v1.BatchGetServicesRequest,
com.google.api.serviceusage.v1.BatchGetServicesResponse>(
this, METHODID_BATCH_GET_SERVICES)))
.build();
}
}
/**
* <pre>
* [Service Usage API](/service-usage/docs/overview)
* </pre>
*/
public static final class ServiceUsageStub extends io.grpc.stub.AbstractAsyncStub<ServiceUsageStub> {
private ServiceUsageStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ServiceUsageStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageStub(channel, callOptions);
}
/**
* <pre>
* Enable a service so that it can be used with a project.
* </pre>
*/
public void enableService(com.google.api.serviceusage.v1.EnableServiceRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getEnableServiceMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Disable a service so that it can no longer be used with a project.
* This prevents unintended usage that may cause unexpected billing
* charges or security leaks.
* It is not valid to call the disable method on a service that is not
* currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
* the target service is not currently enabled.
* </pre>
*/
public void disableService(com.google.api.serviceusage.v1.DisableServiceRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getDisableServiceMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Returns the service configuration and enabled state for a given service.
* </pre>
*/
public void getService(com.google.api.serviceusage.v1.GetServiceRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.Service> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetServiceMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* List all services available to the specified project, and the current
* state of those services with respect to the project. The list includes
* all public services, all services for which the calling user has the
* `servicemanagement.services.bind` permission, and all services that have
* already been enabled on the project. The list can be filtered to
* only include services in a specific state, for example to only include
* services enabled on the project.
* WARNING: If you need to query enabled services frequently or across
* an organization, you should use
* [Cloud Asset Inventory
* API](https://cloud.google.com/asset-inventory/docs/apis), which provides
* higher throughput and richer filtering capability.
* </pre>
*/
public void listServices(com.google.api.serviceusage.v1.ListServicesRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.ListServicesResponse> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getListServicesMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Enable multiple services on a project. The operation is atomic: if enabling
* any service fails, then the entire batch fails, and no state changes occur.
* To enable a single service, use the `EnableService` method instead.
* </pre>
*/
public void batchEnableServices(com.google.api.serviceusage.v1.BatchEnableServicesRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getBatchEnableServicesMethod(), getCallOptions()), request, responseObserver);
}
/**
* <pre>
* Returns the service configurations and enabled states for a given list of
* services.
* </pre>
*/
public void batchGetServices(com.google.api.serviceusage.v1.BatchGetServicesRequest request,
io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.BatchGetServicesResponse> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getBatchGetServicesMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* [Service Usage API](/service-usage/docs/overview)
* </pre>
*/
public static final class ServiceUsageBlockingStub extends io.grpc.stub.AbstractBlockingStub<ServiceUsageBlockingStub> {
private ServiceUsageBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ServiceUsageBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageBlockingStub(channel, callOptions);
}
/**
* <pre>
* Enable a service so that it can be used with a project.
* </pre>
*/
public com.google.longrunning.Operation enableService(com.google.api.serviceusage.v1.EnableServiceRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getEnableServiceMethod(), getCallOptions(), request);
}
/**
* <pre>
* Disable a service so that it can no longer be used with a project.
* This prevents unintended usage that may cause unexpected billing
* charges or security leaks.
* It is not valid to call the disable method on a service that is not
* currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
* the target service is not currently enabled.
* </pre>
*/
public com.google.longrunning.Operation disableService(com.google.api.serviceusage.v1.DisableServiceRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getDisableServiceMethod(), getCallOptions(), request);
}
/**
* <pre>
* Returns the service configuration and enabled state for a given service.
* </pre>
*/
public com.google.api.serviceusage.v1.Service getService(com.google.api.serviceusage.v1.GetServiceRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetServiceMethod(), getCallOptions(), request);
}
/**
* <pre>
* List all services available to the specified project, and the current
* state of those services with respect to the project. The list includes
* all public services, all services for which the calling user has the
* `servicemanagement.services.bind` permission, and all services that have
* already been enabled on the project. The list can be filtered to
* only include services in a specific state, for example to only include
* services enabled on the project.
* WARNING: If you need to query enabled services frequently or across
* an organization, you should use
* [Cloud Asset Inventory
* API](https://cloud.google.com/asset-inventory/docs/apis), which provides
* higher throughput and richer filtering capability.
* </pre>
*/
public com.google.api.serviceusage.v1.ListServicesResponse listServices(com.google.api.serviceusage.v1.ListServicesRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getListServicesMethod(), getCallOptions(), request);
}
/**
* <pre>
* Enable multiple services on a project. The operation is atomic: if enabling
* any service fails, then the entire batch fails, and no state changes occur.
* To enable a single service, use the `EnableService` method instead.
* </pre>
*/
public com.google.longrunning.Operation batchEnableServices(com.google.api.serviceusage.v1.BatchEnableServicesRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getBatchEnableServicesMethod(), getCallOptions(), request);
}
/**
* <pre>
* Returns the service configurations and enabled states for a given list of
* services.
* </pre>
*/
public com.google.api.serviceusage.v1.BatchGetServicesResponse batchGetServices(com.google.api.serviceusage.v1.BatchGetServicesRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getBatchGetServicesMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* [Service Usage API](/service-usage/docs/overview)
* </pre>
*/
public static final class ServiceUsageFutureStub extends io.grpc.stub.AbstractFutureStub<ServiceUsageFutureStub> {
private ServiceUsageFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ServiceUsageFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ServiceUsageFutureStub(channel, callOptions);
}
/**
* <pre>
* Enable a service so that it can be used with a project.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> enableService(
com.google.api.serviceusage.v1.EnableServiceRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getEnableServiceMethod(), getCallOptions()), request);
}
/**
* <pre>
* Disable a service so that it can no longer be used with a project.
* This prevents unintended usage that may cause unexpected billing
* charges or security leaks.
* It is not valid to call the disable method on a service that is not
* currently enabled. Callers will receive a `FAILED_PRECONDITION` status if
* the target service is not currently enabled.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> disableService(
com.google.api.serviceusage.v1.DisableServiceRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getDisableServiceMethod(), getCallOptions()), request);
}
/**
* <pre>
* Returns the service configuration and enabled state for a given service.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.api.serviceusage.v1.Service> getService(
com.google.api.serviceusage.v1.GetServiceRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGetServiceMethod(), getCallOptions()), request);
}
/**
* <pre>
* List all services available to the specified project, and the current
* state of those services with respect to the project. The list includes
* all public services, all services for which the calling user has the
* `servicemanagement.services.bind` permission, and all services that have
* already been enabled on the project. The list can be filtered to
* only include services in a specific state, for example to only include
* services enabled on the project.
* WARNING: If you need to query enabled services frequently or across
* an organization, you should use
* [Cloud Asset Inventory
* API](https://cloud.google.com/asset-inventory/docs/apis), which provides
* higher throughput and richer filtering capability.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.api.serviceusage.v1.ListServicesResponse> listServices(
com.google.api.serviceusage.v1.ListServicesRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getListServicesMethod(), getCallOptions()), request);
}
/**
* <pre>
* Enable multiple services on a project. The operation is atomic: if enabling
* any service fails, then the entire batch fails, and no state changes occur.
* To enable a single service, use the `EnableService` method instead.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation> batchEnableServices(
com.google.api.serviceusage.v1.BatchEnableServicesRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getBatchEnableServicesMethod(), getCallOptions()), request);
}
/**
* <pre>
* Returns the service configurations and enabled states for a given list of
* services.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.api.serviceusage.v1.BatchGetServicesResponse> batchGetServices(
com.google.api.serviceusage.v1.BatchGetServicesRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getBatchGetServicesMethod(), getCallOptions()), request);
}
}
private static final int METHODID_ENABLE_SERVICE = 0;
private static final int METHODID_DISABLE_SERVICE = 1;
private static final int METHODID_GET_SERVICE = 2;
private static final int METHODID_LIST_SERVICES = 3;
private static final int METHODID_BATCH_ENABLE_SERVICES = 4;
private static final int METHODID_BATCH_GET_SERVICES = 5;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final ServiceUsageImplBase serviceImpl;
private final int methodId;
MethodHandlers(ServiceUsageImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_ENABLE_SERVICE:
serviceImpl.enableService((com.google.api.serviceusage.v1.EnableServiceRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
break;
case METHODID_DISABLE_SERVICE:
serviceImpl.disableService((com.google.api.serviceusage.v1.DisableServiceRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
break;
case METHODID_GET_SERVICE:
serviceImpl.getService((com.google.api.serviceusage.v1.GetServiceRequest) request,
(io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.Service>) responseObserver);
break;
case METHODID_LIST_SERVICES:
serviceImpl.listServices((com.google.api.serviceusage.v1.ListServicesRequest) request,
(io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.ListServicesResponse>) responseObserver);
break;
case METHODID_BATCH_ENABLE_SERVICES:
serviceImpl.batchEnableServices((com.google.api.serviceusage.v1.BatchEnableServicesRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
break;
case METHODID_BATCH_GET_SERVICES:
serviceImpl.batchGetServices((com.google.api.serviceusage.v1.BatchGetServicesRequest) request,
(io.grpc.stub.StreamObserver<com.google.api.serviceusage.v1.BatchGetServicesResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class ServiceUsageBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
ServiceUsageBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.google.api.serviceusage.v1.ServiceUsageProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("ServiceUsage");
}
}
private static final class ServiceUsageFileDescriptorSupplier
extends ServiceUsageBaseDescriptorSupplier {
ServiceUsageFileDescriptorSupplier() {}
}
private static final class ServiceUsageMethodDescriptorSupplier
extends ServiceUsageBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
ServiceUsageMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (ServiceUsageGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new ServiceUsageFileDescriptorSupplier())
.addMethod(getEnableServiceMethod())
.addMethod(getDisableServiceMethod())
.addMethod(getGetServiceMethod())
.addMethod(getListServicesMethod())
.addMethod(getBatchEnableServicesMethod())
.addMethod(getBatchGetServicesMethod())
.build();
}
}
}
return result;
}
}
|
[
"bazel-bot-development[bot]@users.noreply.github.com"
] |
bazel-bot-development[bot]@users.noreply.github.com
|
1351bf76dec63b6633a7020c1ad331cba5020864
|
cc6af79efb2edbbdbdc8e1baf926ff67e02ff06f
|
/app/src/main/java/com/ase/aseapp/BusProvider.java
|
90cbba079c027302438ff9ac688b090cf728fd57
|
[] |
no_license
|
anamariaradut/ASEApp
|
0598935ada799443fce9ea30989caa19af919463
|
bef148e9f5b7afcdd60b47994f674962183383f5
|
refs/heads/master
| 2021-01-09T06:34:03.125396
| 2017-02-05T15:34:48
| 2017-02-05T15:34:48
| 81,001,313
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 267
|
java
|
package com.ase.aseapp;
/**
* Created by alex on 31.01.17.
*/
import com.squareup.otto.Bus;
public class BusProvider {
private static final Bus BUS = new Bus();
public static Bus getInstance(){
return BUS;
}
public BusProvider(){}
}
|
[
"Ana-Maria Radut"
] |
Ana-Maria Radut
|
f579af1743e1c9440f9e8dab7e476d63c1881efc
|
bd4dfb439ac79cd4138058a5ee3f6f3ebc4eefa3
|
/src/main/java/io/atalisasowen/heartbeat/network/udp/HeartBeatUdpReceiver.java
|
12ff610d9f99e6384ea114cf34d4c8f44dc40750
|
[
"Apache-2.0"
] |
permissive
|
AtalisasOwen/heartbeat-java
|
df6d933c5a69078288b28fd99b71b6817452cc09
|
3fb8f80ab1d24dfd1e7f31104e93beb1f381562d
|
refs/heads/master
| 2022-12-20T11:40:12.057958
| 2020-10-10T06:43:21
| 2020-10-10T06:43:21
| 301,714,606
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,391
|
java
|
package io.atalisasowen.heartbeat.network.udp;
import io.atalisasowen.heartbeat.command.HeartBeatHandler;
import io.atalisasowen.heartbeat.codec.HeartBeatUdpDecoder;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;
import java.net.InetSocketAddress;
public class HeartBeatUdpReceiver {
private final EventLoopGroup group;
private final Bootstrap bootstrap;
public HeartBeatUdpReceiver(InetSocketAddress address){
group = new NioEventLoopGroup();
bootstrap = new Bootstrap();
bootstrap.group(group)
.channel(NioDatagramChannel.class)
.option(ChannelOption.SO_BROADCAST, true)
.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
ChannelPipeline pipeline = channel.pipeline();
pipeline.addLast(new HeartBeatUdpDecoder());
pipeline.addLast(new HeartBeatHandler(address));
}
}).localAddress(address);
}
public Channel bind(){
return bootstrap.bind().syncUninterruptibly().channel();
}
public void stop(){
group.shutdownGracefully();
}
}
|
[
"742137319@qq.com"
] |
742137319@qq.com
|
8ec0aeb663fbacfc6c91416bc4c23548d3043273
|
a73f191a93f479e0e406a300f9ccfddd2b135966
|
/src/com/twu/biblioteca/User.java
|
957d30a20173f557ebebda8a3546ea624b453966
|
[
"Apache-2.0"
] |
permissive
|
yi-jiayu/twu-biblioteca-jiayu
|
d1b782aa864659295617994fb49669415082113b
|
845b3a6923778dfe32ac299e4694d26cedf9bdf4
|
refs/heads/master
| 2020-03-27T21:30:04.572609
| 2018-09-11T15:57:35
| 2018-09-11T15:57:35
| 147,149,625
| 0
| 0
|
Apache-2.0
| 2018-09-11T03:02:23
| 2018-09-03T04:01:36
|
Java
|
UTF-8
|
Java
| false
| false
| 1,008
|
java
|
package com.twu.biblioteca;
public class User {
private LibraryNumber libraryNumber;
private PasswordHash passwordHash;
private String name;
private String email;
private String phone;
public User() {
}
// for creating new users internally without validation
User(String libraryNumber, String password, String name, String email, String phone) {
try {
this.libraryNumber = new LibraryNumber(libraryNumber);
} catch (InvalidLibraryNumberException ignored) {
}
this.passwordHash = new PasswordHash(password);
this.name = name;
this.email = email;
this.phone = phone;
}
LibraryNumber getLibraryNumber() {
return libraryNumber;
}
PasswordHash getPasswordHash() {
return passwordHash;
}
public String getName() {
return name;
}
public String getEmail() {
return email;
}
public String getPhone() {
return phone;
}
}
|
[
"yi-jiayu@users.noreply.github.com"
] |
yi-jiayu@users.noreply.github.com
|
cf70196a522170bf6d318b93f9a61dfd53afb059
|
de595f0126a6b88b67b361708a07c4088421a403
|
/src/main/java/com/tpCarRental/repositories/CarTypeRepository.java
|
07e00f48bb4fc4eed93d01f7b2280fa29d3dc1af
|
[] |
no_license
|
Ernst95/TP_Car_Rental
|
a03398b265f0076e2d8d2fc8089102ea15cfc56b
|
42a6ce24af30ffce758ec0fe459c0d05ae7e5422
|
refs/heads/master
| 2021-08-07T22:18:34.981574
| 2017-11-09T04:04:03
| 2017-11-09T04:04:03
| 109,504,554
| 0
| 5
| null | 2017-11-09T04:00:16
| 2017-11-04T15:04:45
|
Java
|
UTF-8
|
Java
| false
| false
| 219
|
java
|
package com.tpCarRental.repositories;
import com.tpCarRental.domain.CarType;
import org.springframework.data.repository.CrudRepository;
public interface CarTypeRepository extends CrudRepository<CarType, String>{
}
|
[
"mandisiblou@gmail.com"
] |
mandisiblou@gmail.com
|
c93c833fd6c30b8e1afd1bdde818ddf440a505f8
|
17431c02b726f51f69a96b13e7769d72b2052134
|
/app/src/main/java/autroid/business/adapter/ProfileProductStockAdapter.java
|
8c091da8c8131b437faf513dcaa92104b05e3d7c
|
[] |
no_license
|
bholaAutroid/Autroid
|
53f56dc0114d5e2dbe3c624b461657e074c0b207
|
d8bab8809b6b49d8f0c498b47ec961a05b942699
|
refs/heads/master
| 2023-06-26T10:12:31.062782
| 2021-07-30T05:03:04
| 2021-07-30T05:03:04
| 380,445,003
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,973
|
java
|
package autroid.business.adapter;
import android.content.Context;
import android.content.res.Resources;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import autroid.business.R;
import autroid.business.model.bean.ProductDetailBE;
/**
* Created by pranav.mittal on 06/14/17.
*/
public class ProfileProductStockAdapter extends RecyclerView.Adapter<ProfileProductStockAdapter.ProfileProductStockHolder> {
Context context;
public ArrayList<ProductDetailBE> mList;
Boolean isFullWidth;
public ProfileProductStockAdapter(Context context,ArrayList<ProductDetailBE> mList,Boolean isFullWidth){
this.context=context;
this.mList=mList;
this.isFullWidth=isFullWidth;
}
@Override
public ProfileProductStockHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.
from(context).
inflate(R.layout.row_profile_product_stock, parent, false);
return new ProfileProductStockHolder(itemView);
}
@Override
public void onBindViewHolder(ProfileProductStockHolder holder, int position) {
holder.mProductName.setText(mList.get(position).getTitle());
holder.mProductPrice.setText("₹ "+mList.get(position).getPrice());
// holder.mProductCode.setText(mList.get(position).getCategory().getCategory());
if(mList.get(position).getThumbnails().size()>0)
Picasso.with(context).load(mList.get(position).getThumbnails().get(0).getFile_address()).placeholder(R.drawable.placeholder_big).into(holder.mProductImage);
else
Picasso.with(context).load(R.drawable.placeholder_big).fit().placeholder(R.drawable.placeholder_big).into(holder.mProductImage);
}
@Override
public int getItemCount() {
return mList.size();
}
public class ProfileProductStockHolder extends RecyclerView.ViewHolder{
TextView mProductPrice,mProductName,mProductCode;
LinearLayout mMainLayout;
ImageView mProductImage;
public ProfileProductStockHolder(View itemView) {
super(itemView);
mProductPrice= (TextView) itemView.findViewById(R.id.product_price);
mProductName= (TextView) itemView.findViewById(R.id.product_name);
mProductCode= (TextView) itemView.findViewById(R.id.product_code);
mMainLayout=itemView.findViewById(R.id.main_layout);
mProductImage= (ImageView) itemView.findViewById(R.id.product_image);
if(isFullWidth){
int width= Resources.getSystem().getDisplayMetrics().widthPixels;
mMainLayout.getLayoutParams().width=width;
}
}
}
}
|
[
"bholakumar2298@gmail.com"
] |
bholakumar2298@gmail.com
|
e6ae57318f4dc72b983d73737016c6ca7eb882b3
|
312ce2354c4616300b1b408868e04b78aa259207
|
/Music/src/com/feebe/music/ArtistAlbumBrowserActivity.java
|
c1b9540e20462349e908bd1efd3075198d772ada
|
[] |
no_license
|
jq/zhong
|
473feff7043ff00355fe29097e9fc0b1e267ad4f
|
8c088fdea923ca94eff51b0a3375595a69862ff8
|
refs/heads/master
| 2020-04-14T08:13:51.357206
| 2011-05-11T13:47:39
| 2011-05-11T13:47:39
| 1,487,089
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 35,003
|
java
|
/*
* Copyright (C) 2007 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.feebe.music;
import com.feebe.music.QueryBrowserActivity.QueryListAdapter.QueryHandler;
import android.app.ExpandableListActivity;
import android.app.SearchManager;
import android.content.AsyncQueryHandler;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.CursorAdapter;
import android.widget.CursorTreeAdapter;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.SectionIndexer;
import android.widget.SimpleCursorTreeAdapter;
import android.widget.TextView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import java.text.Collator;
public class ArtistAlbumBrowserActivity extends ExpandableListActivity
implements View.OnCreateContextMenuListener, MusicUtils.Defs
{
private String mCurrentArtistId;
private String mCurrentArtistName;
private String mCurrentAlbumId;
private String mCurrentAlbumName;
private String mCurrentArtistNameForAlbum;
private ArtistAlbumListAdapter mAdapter;
private boolean mAdapterSent;
private boolean mAdapterDestroyed = false;
private final static int SEARCH = CHILD_MENU_BASE;
public ArtistAlbumBrowserActivity()
{
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
if (icicle != null) {
mCurrentAlbumId = icicle.getString("selectedalbum");
mCurrentAlbumName = icicle.getString("selectedalbumname");
mCurrentArtistId = icicle.getString("selectedartist");
mCurrentArtistName = icicle.getString("selectedartistname");
}
MusicUtils.bindToService(this);
IntentFilter f = new IntentFilter();
f.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
f.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
f.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
f.addDataScheme("file");
registerReceiver(mScanListener, f);
setContentView(R.layout.media_picker_activity_expanding);
ExpandableListView lv = getExpandableListView();
lv.setFastScrollEnabled(true);
lv.setOnCreateContextMenuListener(this);
lv.setTextFilterEnabled(true);
mAdapter = (ArtistAlbumListAdapter) getLastNonConfigurationInstance();
if (mAdapter == null) {
//Log.i("@@@", "starting query");
mAdapter = new ArtistAlbumListAdapter(
getApplication(),
this,
null, // cursor
R.layout.track_list_item_group,
new String[] {},
new int[] {},
R.layout.track_list_item_child,
new String[] {},
new int[] {});
setListAdapter(mAdapter);
setTitle(R.string.working_artists);
getArtistCursor(mAdapter.getQueryHandler(), null);
} else {
mAdapter.setActivity(this);
setListAdapter(mAdapter);
mArtistCursor = mAdapter.getCursor();
if (mArtistCursor != null) {
init(mArtistCursor);
} else {
getArtistCursor(mAdapter.getQueryHandler(), null);
}
}
}
@Override
public Object onRetainNonConfigurationInstance() {
mAdapterSent = true;
return mAdapter;
}
@Override
public void onSaveInstanceState(Bundle outcicle) {
// need to store the selected item so we don't lose it in case
// of an orientation switch. Otherwise we could lose it while
// in the middle of specifying a playlist to add the item to.
outcicle.putString("selectedalbum", mCurrentAlbumId);
outcicle.putString("selectedalbumname", mCurrentAlbumName);
outcicle.putString("selectedartist", mCurrentArtistId);
outcicle.putString("selectedartistname", mCurrentArtistName);
super.onSaveInstanceState(outcicle);
}
@Override
public void onDestroy() {
MusicUtils.unbindFromService(this);
if (!mAdapterSent) {
Cursor c = mAdapter.getCursor();
if (c != null) {
c.close();
}
}
if (mAdapter != null) {
mAdapter.getQueryHandler().removeCallbacksAndMessages(null);
}
mReScanHandler.removeCallbacksAndMessages(null);
// Because we pass the adapter to the next activity, we need to make
// sure it doesn't keep a reference to this activity. We can do this
// by clearing its DatasetObservers, which setListAdapter(null) does.
setListAdapter(null);
mAdapter = null;
mAdapterDestroyed = true;
unregisterReceiver(mScanListener);
super.onDestroy();
}
@Override
public void onResume() {
super.onResume();
IntentFilter f = new IntentFilter();
f.addAction(MediaPlaybackService.META_CHANGED);
f.addAction(MediaPlaybackService.QUEUE_CHANGED);
registerReceiver(mTrackListListener, f);
mTrackListListener.onReceive(null, null);
MusicUtils.setSpinnerState(this);
}
private BroadcastReceiver mTrackListListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
getExpandableListView().invalidateViews();
}
};
private BroadcastReceiver mScanListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
MusicUtils.setSpinnerState(ArtistAlbumBrowserActivity.this);
mReScanHandler.sendEmptyMessage(0);
if (intent.getAction().equals(Intent.ACTION_MEDIA_UNMOUNTED)) {
MusicUtils.clearAlbumArtCache();
}
}
};
private Handler mReScanHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
getArtistCursor(mAdapter.getQueryHandler(), null);
}
};
@Override
public void onPause() {
unregisterReceiver(mTrackListListener);
mReScanHandler.removeCallbacksAndMessages(null);
super.onPause();
}
public void init(Cursor c) {
if (mAdapterDestroyed)
return;
mAdapter.changeCursor(c); // also sets mArtistCursor
if (mArtistCursor == null) {
MusicUtils.displayDatabaseError(this);
closeContextMenu();
mReScanHandler.sendEmptyMessageDelayed(0, 1000);
return;
}
MusicUtils.hideDatabaseError(this);
setTitle();
}
private void setTitle() {
setTitle(R.string.artists_title);
}
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
mCurrentAlbumId = Long.valueOf(id).toString();
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setDataAndType(Uri.EMPTY, "vnd.android.cursor.dir/track");
intent.putExtra("album", mCurrentAlbumId);
Cursor c = (Cursor) getExpandableListAdapter().getChild(groupPosition, childPosition);
String album = c.getString(c.getColumnIndex(MediaStore.Audio.Albums.ALBUM));
if (album == null || album.equals(MediaFile.UNKNOWN_STRING)) {
// unknown album, so we should include the artist ID to limit the songs to songs only by that artist
mArtistCursor.moveToPosition(groupPosition);
mCurrentArtistId = mArtistCursor.getString(mArtistCursor.getColumnIndex(MediaStore.Audio.Artists._ID));
intent.putExtra("artist", mCurrentArtistId);
}
startActivity(intent);
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, GOTO_START, 0, R.string.goto_start).setIcon(R.drawable.ic_menu_music_library);
menu.add(0, GOTO_PLAYBACK, 0, R.string.goto_playback).setIcon(R.drawable.ic_menu_playback);
menu.add(0, SHUFFLE_ALL, 0, R.string.shuffle_all).setIcon(R.drawable.ic_menu_shuffle);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
menu.findItem(GOTO_PLAYBACK).setVisible(MusicUtils.isMusicLoaded());
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
Cursor cursor;
switch (item.getItemId()) {
case GOTO_START:
intent = new Intent();
intent.setClass(this, MusicBrowserActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
return true;
case GOTO_PLAYBACK:
intent = new Intent("com.android.music.PLAYBACK_VIEWER");
startActivity(intent);
return true;
case SHUFFLE_ALL:
cursor = MusicUtils.query(this, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
new String [] { MediaStore.Audio.Media._ID},
MediaStore.Audio.Media.IS_MUSIC + "=1", null,
MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
if (cursor != null) {
MusicUtils.shuffleAll(this, cursor);
cursor.close();
}
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfoIn) {
menu.add(0, PLAY_SELECTION, 0, R.string.play_selection);
SubMenu sub = menu.addSubMenu(0, ADD_TO_PLAYLIST, 0, R.string.add_to_playlist);
MusicUtils.makePlaylistMenu(this, sub);
menu.add(0, DELETE_ITEM, 0, R.string.delete_item);
menu.add(0, SEARCH, 0, R.string.search_title);
ExpandableListContextMenuInfo mi = (ExpandableListContextMenuInfo) menuInfoIn;
int itemtype = ExpandableListView.getPackedPositionType(mi.packedPosition);
int gpos = ExpandableListView.getPackedPositionGroup(mi.packedPosition);
int cpos = ExpandableListView.getPackedPositionChild(mi.packedPosition);
if (itemtype == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
if (gpos == -1) {
// this shouldn't happen
Log.d("Artist/Album", "no group");
return;
}
gpos = gpos - getExpandableListView().getHeaderViewsCount();
mArtistCursor.moveToPosition(gpos);
mCurrentArtistId = mArtistCursor.getString(mArtistCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists._ID));
mCurrentArtistName = mArtistCursor.getString(mArtistCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
mCurrentAlbumId = null;
if (mCurrentArtistName == null || mCurrentArtistName.equals(MediaFile.UNKNOWN_STRING)) {
menu.setHeaderTitle(getString(R.string.unknown_artist_name));
} else {
menu.setHeaderTitle(mCurrentArtistName);
}
return;
} else if (itemtype == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
if (cpos == -1) {
// this shouldn't happen
Log.d("Artist/Album", "no child");
return;
}
Cursor c = (Cursor) getExpandableListAdapter().getChild(gpos, cpos);
c.moveToPosition(cpos);
mCurrentArtistId = null;
mCurrentAlbumId = Long.valueOf(mi.id).toString();
mCurrentAlbumName = c.getString(c.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
gpos = gpos - getExpandableListView().getHeaderViewsCount();
mArtistCursor.moveToPosition(gpos);
mCurrentArtistNameForAlbum = mArtistCursor.getString(
mArtistCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
if (mCurrentAlbumName == null || mCurrentAlbumName.equals(MediaFile.UNKNOWN_STRING)) {
menu.setHeaderTitle(getString(R.string.unknown_album_name));
} else {
menu.setHeaderTitle(mCurrentAlbumName);
}
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case PLAY_SELECTION: {
// play everything by the selected artist
int [] list =
mCurrentArtistId != null ?
MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
: MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
MusicUtils.playAll(this, list, 0);
return true;
}
case QUEUE: {
int [] list =
mCurrentArtistId != null ?
MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
: MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
MusicUtils.addToCurrentPlaylist(this, list);
return true;
}
case NEW_PLAYLIST: {
Intent intent = new Intent();
intent.setClass(this, CreatePlaylist.class);
startActivityForResult(intent, NEW_PLAYLIST);
return true;
}
case PLAYLIST_SELECTED: {
int [] list =
mCurrentArtistId != null ?
MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId))
: MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
int playlist = item.getIntent().getIntExtra("playlist", 0);
MusicUtils.addToPlaylist(this, list, playlist);
return true;
}
case DELETE_ITEM: {
int [] list;
String desc;
if (mCurrentArtistId != null) {
list = MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId));
String f = getString(R.string.delete_artist_desc);
desc = String.format(f, mCurrentArtistName);
} else {
list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
String f = getString(R.string.delete_album_desc);
desc = String.format(f, mCurrentAlbumName);
}
Bundle b = new Bundle();
b.putString("description", desc);
b.putIntArray("items", list);
Intent intent = new Intent();
intent.setClass(this, DeleteItems.class);
intent.putExtras(b);
startActivityForResult(intent, -1);
return true;
}
case SEARCH:
doSearch();
return true;
}
return super.onContextItemSelected(item);
}
void doSearch() {
CharSequence title = null;
String query = null;
Intent i = new Intent();
i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (mCurrentArtistId != null) {
title = mCurrentArtistName;
query = mCurrentArtistName;
i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentArtistName);
i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Artists.ENTRY_CONTENT_TYPE);
} else {
title = mCurrentAlbumName;
query = mCurrentArtistNameForAlbum + " " + mCurrentAlbumName;
i.putExtra(MediaStore.EXTRA_MEDIA_ARTIST, mCurrentArtistNameForAlbum);
i.putExtra(MediaStore.EXTRA_MEDIA_ALBUM, mCurrentAlbumName);
i.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Albums.ENTRY_CONTENT_TYPE);
}
title = getString(R.string.mediasearch, title);
i.putExtra(SearchManager.QUERY, query);
startActivity(Intent.createChooser(i, title));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
switch (requestCode) {
case SCAN_DONE:
if (resultCode == RESULT_CANCELED) {
finish();
} else {
getArtistCursor(mAdapter.getQueryHandler(), null);
}
break;
case NEW_PLAYLIST:
if (resultCode == RESULT_OK) {
Uri uri = intent.getData();
if (uri != null) {
int [] list = null;
if (mCurrentArtistId != null) {
list = MusicUtils.getSongListForArtist(this, Integer.parseInt(mCurrentArtistId));
} else if (mCurrentAlbumId != null) {
list = MusicUtils.getSongListForAlbum(this, Integer.parseInt(mCurrentAlbumId));
}
MusicUtils.addToPlaylist(this, list, Integer.parseInt(uri.getLastPathSegment()));
}
}
break;
}
}
private Cursor getArtistCursor(AsyncQueryHandler async, String filter) {
StringBuilder where = new StringBuilder();
where.append(MediaStore.Audio.Artists.ARTIST + " != ''");
// Add in the filtering constraints
String [] keywords = null;
if (filter != null) {
String [] searchWords = filter.split(" ");
keywords = new String[searchWords.length];
Collator col = Collator.getInstance();
col.setStrength(Collator.PRIMARY);
for (int i = 0; i < searchWords.length; i++) {
keywords[i] = '%' + MediaStore.Audio.keyFor(searchWords[i]) + '%';
}
for (int i = 0; i < searchWords.length; i++) {
where.append(" AND ");
where.append(MediaStore.Audio.Media.ARTIST_KEY + " LIKE ?");
}
}
String whereclause = where.toString();
String[] cols = new String[] {
MediaStore.Audio.Artists._ID,
MediaStore.Audio.Artists.ARTIST,
MediaStore.Audio.Artists.NUMBER_OF_ALBUMS,
MediaStore.Audio.Artists.NUMBER_OF_TRACKS
};
Cursor ret = null;
if (async != null) {
async.startQuery(0, null, MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
cols, whereclause , keywords, MediaStore.Audio.Artists.ARTIST_KEY);
} else {
ret = MusicUtils.query(this, MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
cols, whereclause , keywords, MediaStore.Audio.Artists.ARTIST_KEY);
}
return ret;
}
static class ArtistAlbumListAdapter extends SimpleCursorTreeAdapter implements SectionIndexer {
private final Drawable mNowPlayingOverlay;
private final BitmapDrawable mDefaultAlbumIcon;
private int mGroupArtistIdIdx;
private int mGroupArtistIdx;
private int mGroupAlbumIdx;
private int mGroupSongIdx;
private final Context mContext;
private final Resources mResources;
private final String mAlbumSongSeparator;
private final String mUnknownAlbum;
private final String mUnknownArtist;
private final StringBuilder mBuffer = new StringBuilder();
private final Object[] mFormatArgs = new Object[1];
private final Object[] mFormatArgs3 = new Object[3];
private MusicAlphabetIndexer mIndexer;
private ArtistAlbumBrowserActivity mActivity;
private AsyncQueryHandler mQueryHandler;
private String mConstraint = null;
private boolean mConstraintIsValid = false;
private boolean mCursorInactive; // keep track of mCursor. Can be deactivated my mAdapter
static class ViewHolder {
TextView line1;
TextView line2;
ImageView play_indicator;
ImageView icon;
}
class QueryHandler extends AsyncQueryHandler {
QueryHandler(ContentResolver res) {
super(res);
}
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
//Log.i("@@@", "query complete");
mActivity.init(cursor);
}
}
ArtistAlbumListAdapter(Context context, ArtistAlbumBrowserActivity currentactivity,
Cursor cursor, int glayout, String[] gfrom, int[] gto,
int clayout, String[] cfrom, int[] cto) {
super(context, cursor, glayout, gfrom, gto, clayout, cfrom, cto);
mActivity = currentactivity;
mCursorInactive = false;
mQueryHandler = new QueryHandler(context.getContentResolver());
Resources r = context.getResources();
mNowPlayingOverlay = r.getDrawable(R.drawable.indicator_ic_mp_playing_list);
mDefaultAlbumIcon = (BitmapDrawable) r.getDrawable(R.drawable.albumart_mp_unknown_list);
// no filter or dither, it's a lot faster and we can't tell the difference
mDefaultAlbumIcon.setFilterBitmap(false);
mDefaultAlbumIcon.setDither(false);
mContext = context;
getColumnIndices(cursor);
mResources = context.getResources();
mAlbumSongSeparator = context.getString(R.string.albumsongseparator);
mUnknownAlbum = context.getString(R.string.unknown_album_name);
mUnknownArtist = context.getString(R.string.unknown_artist_name);
}
private void getColumnIndices(Cursor cursor) {
if (cursor != null) {
mGroupArtistIdIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists._ID);
mGroupArtistIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST);
mGroupAlbumIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.NUMBER_OF_ALBUMS);
mGroupSongIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.NUMBER_OF_TRACKS);
if (mIndexer != null) {
mIndexer.setCursor(cursor);
} else {
//mResources.getString(com.android.internal.R.string.fast_scroll_alphabet)
mIndexer = new MusicAlphabetIndexer(cursor, mGroupArtistIdx,"idx");
}
}
}
public void setActivity(ArtistAlbumBrowserActivity newactivity) {
mActivity = newactivity;
}
public AsyncQueryHandler getQueryHandler() {
return mQueryHandler;
}
@Override
public View newGroupView(Context context, Cursor cursor, boolean isExpanded, ViewGroup parent) {
View v = super.newGroupView(context, cursor, isExpanded, parent);
ImageView iv = (ImageView) v.findViewById(R.id.icon);
ViewGroup.LayoutParams p = iv.getLayoutParams();
p.width = ViewGroup.LayoutParams.WRAP_CONTENT;
p.height = ViewGroup.LayoutParams.WRAP_CONTENT;
ViewHolder vh = new ViewHolder();
vh.line1 = (TextView) v.findViewById(R.id.line1);
vh.line2 = (TextView) v.findViewById(R.id.line2);
vh.play_indicator = (ImageView) v.findViewById(R.id.play_indicator);
vh.icon = (ImageView) v.findViewById(R.id.icon);
vh.icon.setPadding(0, 0, 1, 0);
v.setTag(vh);
return v;
}
@Override
public View newChildView(Context context, Cursor cursor, boolean isLastChild,
ViewGroup parent) {
View v = super.newChildView(context, cursor, isLastChild, parent);
ViewHolder vh = new ViewHolder();
vh.line1 = (TextView) v.findViewById(R.id.line1);
vh.line2 = (TextView) v.findViewById(R.id.line2);
vh.play_indicator = (ImageView) v.findViewById(R.id.play_indicator);
vh.icon = (ImageView) v.findViewById(R.id.icon);
vh.icon.setBackgroundDrawable(mDefaultAlbumIcon);
vh.icon.setPadding(0, 0, 1, 0);
v.setTag(vh);
return v;
}
@Override
public void bindGroupView(View view, Context context, Cursor cursor, boolean isexpanded) {
ViewHolder vh = (ViewHolder) view.getTag();
String artist = cursor.getString(mGroupArtistIdx);
String displayartist = artist;
boolean unknown = artist == null || artist.equals(MediaFile.UNKNOWN_STRING);
if (unknown) {
displayartist = mUnknownArtist;
}
vh.line1.setText(displayartist);
int numalbums = cursor.getInt(mGroupAlbumIdx);
int numsongs = cursor.getInt(mGroupSongIdx);
String songs_albums = MusicUtils.makeAlbumsLabel(context,
numalbums, numsongs, unknown);
vh.line2.setText(songs_albums);
int currentartistid = MusicUtils.getCurrentArtistId();
int artistid = cursor.getInt(mGroupArtistIdIdx);
if (currentartistid == artistid && !isexpanded) {
vh.play_indicator.setImageDrawable(mNowPlayingOverlay);
} else {
vh.play_indicator.setImageDrawable(null);
}
}
@Override
public void bindChildView(View view, Context context, Cursor cursor, boolean islast) {
ViewHolder vh = (ViewHolder) view.getTag();
String name = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
String displayname = name;
boolean unknown = name == null || name.equals(MediaFile.UNKNOWN_STRING);
if (unknown) {
displayname = mUnknownAlbum;
}
vh.line1.setText(displayname);
int numsongs = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.NUMBER_OF_SONGS));
int numartistsongs = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.NUMBER_OF_SONGS_FOR_ARTIST));
final StringBuilder builder = mBuffer;
builder.delete(0, builder.length());
if (unknown) {
numsongs = numartistsongs;
}
if (numsongs == 1) {
builder.append(context.getString(R.string.onesong));
} else {
if (numsongs == numartistsongs) {
final Object[] args = mFormatArgs;
args[0] = numsongs;
builder.append(mResources.getQuantityString(R.plurals.Nsongs, numsongs, args));
} else {
final Object[] args = mFormatArgs3;
args[0] = numsongs;
args[1] = numartistsongs;
args[2] = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
builder.append(mResources.getQuantityString(R.plurals.Nsongscomp, numsongs, args));
}
}
vh.line2.setText(builder.toString());
ImageView iv = vh.icon;
// We don't actually need the path to the thumbnail file,
// we just use it to see if there is album art or not
String art = cursor.getString(cursor.getColumnIndexOrThrow(
MediaStore.Audio.Albums.ALBUM_ART));
if (unknown || art == null || art.length() == 0) {
iv.setBackgroundDrawable(mDefaultAlbumIcon);
iv.setImageDrawable(null);
} else {
int artIndex = cursor.getInt(0);
Drawable d = MusicUtils.getCachedArtwork(context, artIndex, mDefaultAlbumIcon);
iv.setImageDrawable(d);
}
int currentalbumid = MusicUtils.getCurrentAlbumId();
int aid = cursor.getInt(0);
iv = vh.play_indicator;
if (currentalbumid == aid) {
iv.setImageDrawable(mNowPlayingOverlay);
} else {
iv.setImageDrawable(null);
}
}
@Override
protected Cursor getChildrenCursor(Cursor groupCursor) {
int id = groupCursor.getInt(groupCursor.getColumnIndexOrThrow(MediaStore.Audio.Artists._ID));
String[] cols = new String[] {
MediaStore.Audio.Albums._ID,
MediaStore.Audio.Albums.ALBUM,
MediaStore.Audio.Albums.NUMBER_OF_SONGS,
MediaStore.Audio.Albums.NUMBER_OF_SONGS_FOR_ARTIST,
MediaStore.Audio.Albums.ALBUM_ART
};
Cursor c = MusicUtils.query(mActivity,
MediaStore.Audio.Artists.Albums.getContentUri("external", id),
cols, null, null, MediaStore.Audio.Albums.DEFAULT_SORT_ORDER);
class MyCursorWrapper extends CursorWrapper {
String mArtistName;
int mMagicColumnIdx;
MyCursorWrapper(Cursor c, String artist) {
super(c);
mArtistName = artist;
if (mArtistName == null || mArtistName.equals(MediaFile.UNKNOWN_STRING)) {
mArtistName = mUnknownArtist;
}
mMagicColumnIdx = c.getColumnCount();
}
@Override
public String getString(int columnIndex) {
if (columnIndex != mMagicColumnIdx) {
return super.getString(columnIndex);
}
return mArtistName;
}
@Override
public int getColumnIndexOrThrow(String name) {
if (MediaStore.Audio.Albums.ARTIST.equals(name)) {
return mMagicColumnIdx;
}
return super.getColumnIndexOrThrow(name);
}
@Override
public String getColumnName(int idx) {
if (idx != mMagicColumnIdx) {
return super.getColumnName(idx);
}
return MediaStore.Audio.Albums.ARTIST;
}
@Override
public int getColumnCount() {
return super.getColumnCount() + 1;
}
@Override
public void deactivate() {
synchronized (mActivity) {
mCursorInactive = true;
super.deactivate();
}
}
@Override
public boolean requery() {
synchronized (mActivity) {
mCursorInactive = !(super.requery()); // not ~ super()
return (mCursorInactive == false);
}
}
}
return new MyCursorWrapper(c, groupCursor.getString(mGroupArtistIdx));
}
@Override
public void changeCursor(Cursor cursor) {
if (cursor != null && cursor.isClosed()) {
return;
}
synchronized (mActivity) {
if ( mCursorInactive ) {
return;
}
if (cursor != mActivity.mArtistCursor) {
mActivity.mArtistCursor = cursor;
getColumnIndices(cursor);
super.changeCursor(cursor);
}
}
}
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
String s = constraint.toString();
if (mConstraintIsValid && (
(s == null && mConstraint == null) ||
(s != null && s.equals(mConstraint)))) {
return getCursor();
}
Cursor c = mActivity.getArtistCursor(null, s);
mConstraint = s;
mConstraintIsValid = true;
return c;
}
public Object[] getSections() {
return mIndexer.getSections();
}
public int getPositionForSection(int sectionIndex) {
return mIndexer.getPositionForSection(sectionIndex);
}
public int getSectionForPosition(int position) {
return 0;
}
}
private Cursor mArtistCursor;
}
|
[
"julian.qian@gmail.com"
] |
julian.qian@gmail.com
|
387404cca2e244723cdcc7362c6f097bacc60196
|
26c118d9951db463ea788a4099d0c8065a882284
|
/src/main/java/io/amecodelabs/Minesweeper/App.java
|
02548d2571b0d844052aeb1c115ad96caa15df9d
|
[
"MIT"
] |
permissive
|
amarqueze/Minesweeper
|
9f6ce1ff45d714a73a5f5c84b7dc3b1d2a8d702a
|
d4debe45c5b8fdd7cc436fa49f2ed20123b61def
|
refs/heads/master
| 2021-09-22T09:14:54.130872
| 2018-09-07T02:29:45
| 2018-09-07T02:29:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 293
|
java
|
package io.amecodelabs.Minesweeper;
import io.amecodelabs.Minesweeper.config.language.SystemLanguage;
import io.amecodelabs.Minesweeper.view.ConsoleView;
public class App
{
public static void main(String[] args)
{
new ConsoleView(SystemLanguage.newInstance()).run();
}
}
|
[
"alanmarquez@outlook.com"
] |
alanmarquez@outlook.com
|
ccf043ee686837ad2e98531f2e1aee2d2ff7d745
|
7c09956ab9be1d4aecc7e925051e3ea6aa2189ce
|
/payment-service/src/main/java/com/vinsguru/payment/config/PaymentConfig.java
|
32e23c3569dde5ba679e418d5e9bb2b03e7a80f8
|
[] |
no_license
|
eliasmichalczuk/choreography-saga-spring-kafka
|
65d0abba2e9f680df79c9356957c6ec21cf6883b
|
e0bfeed19cb68efbbb01eea474d91d277769da80
|
refs/heads/main
| 2023-06-11T03:49:16.497875
| 2021-07-03T23:45:40
| 2021-07-03T23:45:40
| 380,558,339
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,071
|
java
|
package com.vinsguru.payment.config;
import com.vinsguru.events.inventory.InventoryEvent;
import com.vinsguru.events.order.OrderEvent;
import com.vinsguru.events.order.OrderStatus;
import com.vinsguru.events.payment.PaymentEvent;
import com.vinsguru.events.shipping.ShippingEvent;
import com.vinsguru.payment.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.core.publisher.Sinks;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
@Configuration
public class PaymentConfig {
@Autowired
private PaymentService service;
// payment service não consome mais diretamento o do order service,
// após o investario ser reservado, o inventory service envia o evento,
// e esse é consumido pelo payment service, que envia outro evento para o shipping service,
// em caso de rollback, faz o rollback inicialmente para o invetory service
// @Bean
// public Function<Flux<OrderEvent>, Flux<PaymentEvent>> paymentProcessor() {
// return flux -> flux.flatMap(this::processPayment);
// }
//
// private Mono<PaymentEvent> processPayment(OrderEvent event){
// if(event.getOrderStatus().equals(OrderStatus.CREATED)){
// return Mono.fromSupplier(() -> this.service.newOrderEvent(event));
// }else{
// return Mono.fromRunnable(() -> this.service.cancelOrderEvent(event));
// }
// }
@Bean
public Sinks.Many<PaymentEvent> paymentSink(){
return Sinks.many().unicast().onBackpressureBuffer();
}
@Bean
public Supplier<Flux<PaymentEvent>> paymentSupplier(Sinks.Many<PaymentEvent> sink){
return sink::asFlux;
}
@Bean
public Consumer<InventoryEvent> inventoryEventConsumer(){
return inventoryEvent -> service.newOrderEvent(inventoryEvent);
}
}
|
[
"elias.silva@selbetti.com.br"
] |
elias.silva@selbetti.com.br
|
723fcb2bd6cfa6de5759768aec87b538d1734ae4
|
401979212a3eadaf245b21a2e97cd97d87af96e0
|
/java-in-action/mvnAction/src/main/java/model/uml/books.java
|
8c125bd224aebf1ac3a578030231954c245faa50
|
[] |
no_license
|
zuston/code-library
|
53f38979f8b43d7cee893ce77b5429da714ca4ec
|
5c5cdc29f9b49be97e112017f268dcf913513e0d
|
refs/heads/master
| 2021-05-04T09:28:29.827958
| 2016-12-23T04:53:27
| 2016-12-23T04:53:27
| 70,454,606
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,522
|
java
|
package model.uml;
import tool.ORM;
/**
* Created by zuston on 16/11/7.
*/
public class books extends ORM {
public String type;
public String title;
public int price;
public String author;
public int number;
public int broken;
public books(String type, String title, int price, String author, int number, int broken) {
this.type = type;
this.title = title;
this.price = price;
this.author = author;
this.number = number;
this.broken = broken;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public int getBroken() {
return broken;
}
public void setBroken(int broken) {
this.broken = broken;
}
public static void main(String[] args) throws IllegalAccessException {
books bk = new books("文学","风雨张居正",200,"张文君",30,1);
bk.save();
}
}
|
[
"zuston.shacha@gmail.com"
] |
zuston.shacha@gmail.com
|
a06bd3014cb936076b676ec5ce91c370eb6efc9a
|
f73b9e6b4b091a372ec8c6ddb341116556344608
|
/app/src/main/java/com/first/anew/PlayersDataAdapter.java
|
05b2e654444c59743d7d7571c518c83dcf7ff69d
|
[] |
no_license
|
Ivangrischenko/shifu-project1
|
61df271451c6cac748834fd40552dda72083b378
|
f54fd94222f0d353f36103b003d72c6025f96a42
|
refs/heads/master
| 2020-03-20T18:29:45.454079
| 2018-07-11T14:37:05
| 2018-07-11T14:37:05
| 137,590,654
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,786
|
java
|
package com.first.anew;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.first.anew.Players.Player;
import java.util.ArrayList;
import java.util.List;
import io.realm.RealmList;
import pl.fanfatal.swipecontrollerdemo.R;
public class PlayersDataAdapter extends RecyclerView.Adapter<PlayersDataAdapter.MyViewHolder> {
public List<Player> playerList;
Context context;
public PlayersDataAdapter(List<Player> playerList, Context context) {
this.playerList = playerList;
this.context = context;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_view, parent, false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
Player player = playerList.get(position);
holder.title.setText(player.getTitle());
holder.content.setText(player.getContent());
holder.link.setText(player.getLink());
}
@Override
public int getItemCount() {
return playerList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView content;
TextView link;
public MyViewHolder(View itemView) {
super(itemView);
title = itemView.findViewById(R.id.name);
content = itemView.findViewById(R.id.content);
link = itemView.findViewById(R.id.link);
}
}
}
|
[
"Ivangrischenko"
] |
Ivangrischenko
|
87a9faf8d59e6ed7cc1b2c197b1b0314fe0aeb93
|
f18c96dbd335aebfacc6553b190e5e37a00f1fc8
|
/java_project/MyProject/src/ch04/Member.java
|
aeb3a77fb028d0661ab3996c3e92bc7bb539bd00
|
[] |
no_license
|
flip1945/Java205
|
9f710156b344048faf3aaa925302c82e24fbb268
|
ea34da4a411fe7ab2ac938a48caa203a29d54b12
|
refs/heads/main
| 2023-07-13T20:28:59.633857
| 2021-09-01T11:27:13
| 2021-09-01T11:27:13
| 370,222,260
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,873
|
java
|
package ch04;
import java.util.Calendar;
import java.util.Scanner;
public class Member {
private int curYear = Calendar.getInstance().get(Calendar.YEAR);
public void checkFluVaccine(int birthYear) {
int age = curYear - birthYear + 1;
if (age < 15 || age >= 65) {
System.out.println("현재 나이 " + age + "살은");
System.out.println("무료예방접종이 가능합니다.");
} else {
System.out.println("현재 나이 " + age + "살은");
System.out.println("무료접종 대상이 아닙니다.");
}
}
public void checkMeicalCheck(int birthYear) {
int age = curYear - birthYear + 1;
if (age >= 20) {
if (curYear % 2 == birthYear % 2) {
System.out.println("현재 나이 " + age + "살은");
System.out.println("무료건강검진이 가능합니다.");
if (age >= 40) {
System.out.println("암 검사도 무료로 가능합니다.");
}
} else {
System.out.println("현재 나이 " + age + "살은");
System.out.println("무료건강검진 대상이 아닙니다.");
}
} else {
System.out.println("20세 이상만 무료로 건강검진이 가능합니다.");
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Member member = new Member();
while (true) {
System.out.print("태어난 연도를 입력해주세요(0 입력시 종료) : ");
int birthYear = scanner.nextInt();
if (birthYear == 0) {
break;
} else if (birthYear < 0) {
System.out.println("올바른 년도를 입력해주세요.");
continue;
}
System.out.println("---------독감예방 접종---------\n");
member.checkFluVaccine(birthYear);
System.out.println();
System.out.println("---------건강검진 대상---------\n");
member.checkMeicalCheck(birthYear);
System.out.println();
}
scanner.close();
}
}
|
[
"77256607+flip1945@users.noreply.github.com"
] |
77256607+flip1945@users.noreply.github.com
|
911b9392f0efbe8794c17869d50a3509d784a55c
|
f7503620250087ae9c8b064dd27e3253e4dbaf34
|
/android/content/pm/ServiceInfo.java
|
184789f3adf59ce6d0f0cf4ea439d9ba36f32f8f
|
[] |
no_license
|
d-yacenko/ClassDump
|
a23d25c952c250c8b5c201c7a86aefe14ebabd39
|
ccfbf8a187c1936c9aed0f3cefb869529ecb74d4
|
refs/heads/master
| 2021-01-19T02:19:16.615485
| 2017-04-05T09:09:10
| 2017-04-05T09:09:10
| 87,269,358
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,897
|
java
|
package android.content.pm;
import android.__Result__;
/*===================================*/
/* ServiceInfo */
/*===================================*/
public class ServiceInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
/*========fields=========*/
public static final android.os.Parcelable$Creator CREATOR=null;
public static final int FLAG_EXTERNAL_SERVICE=0;
public static final int FLAG_ISOLATED_PROCESS=0;
public static final int FLAG_SINGLE_USER=0;
public static final int FLAG_STOP_WITH_TASK=0;
public int flags;
public java.lang.String permission;
/*======constructors=====*/
public ServiceInfo (android.content.pm.ServiceInfo arg0) {__Result__.str+="|ServiceInfo|";}
public ServiceInfo () {__Result__.str+="|ServiceInfo|";}
/*========methods========*/
public void dump (android.util.Printer arg0,java.lang.String arg1) {__Result__.str+="|dump|"; return ;}
public void writeToParcel (android.os.Parcel arg0,int arg1) {__Result__.str+="|writeToParcel|"; return ;}
public int describeContents () {__Result__.str+="|describeContents|"; return 0;}
public java.lang.String toString () {__Result__.str+="|toString|"; return null;}
/*========inner classes========*/
import android.__Result__;
/*===================================*/
/* DisplayNameComparator */
/*===================================*/
public static class DisplayNameComparator implements java.util.Comparator<android.content.pm.PackageItemInfo> {
/*========fields=========*/
/*======constructors=====*/
public DisplayNameComparator (android.content.pm.PackageManager arg0) {__Result__.str+="|DisplayNameComparator|";}
/*========methods========*/
public final int compare (android.content.pm.PackageItemInfo arg0,android.content.pm.PackageItemInfo arg1) {__Result__.str+="|compare|"; return 0;}
/*========inner classes========*/
}
}
|
[
"d.yacenko@gmail.com"
] |
d.yacenko@gmail.com
|
a91c13a5b71347544b36f5cd978d9f1465dc872e
|
9e01f075074e9bde74c92a34753140177b6449f0
|
/src/zmarkdown/javaeditor/ZMarkdownJavaEditor.java
|
e40195d60f074cb88af262c1c0c092675fc4a2b7
|
[
"MIT"
] |
permissive
|
firm1/zmarkdown-editor
|
597ec70ec83a556b81329d66284f48be073bac79
|
25aad852e7971cec7a3f24e1d266e56f229369a0
|
refs/heads/master
| 2020-06-07T13:37:50.871194
| 2014-10-14T23:14:18
| 2014-10-14T23:14:18
| 22,770,925
| 2
| 1
| null | 2017-07-14T11:48:08
| 2014-08-08T20:39:51
|
Python
|
UTF-8
|
Java
| false
| false
| 805
|
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 zmarkdown.javaeditor;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import zmarkdown.javaeditor.ihm.Editor;
/**
*
* @author firm1
*/
public class ZMarkdownJavaEditor {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Editor edit = new Editor();
edit.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
edit.setExtendedState(JFrame.MAXIMIZED_BOTH);
edit.setVisible(true);
}
}
|
[
"firm1@github.com"
] |
firm1@github.com
|
3c2f393201a5ddf770be221b01f80e1b6d73c04e
|
0af3fb55c2b9b031dd2eb0efeb4297b0cce86a9f
|
/src/main/java/com/mycompany/app/ConnexionUnique.java
|
76ff62e6d8057007db678801c5da87a6358bb165
|
[] |
no_license
|
ynestacamille/YNESTA_TPJDBC
|
4d077726a75aac45ddcec2bd2b9148577b3fd0eb
|
0312199c1fd8d6ea988fb5b65ef6934aaf6f60d8
|
refs/heads/master
| 2021-01-12T10:45:19.134523
| 2016-11-02T21:04:29
| 2016-11-02T21:04:29
| 72,675,302
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 764
|
java
|
package com.mycompany.app;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnexionUnique {
private Connection connection;
private static ConnexionUnique instance;
private String CONNECT_URL = "jdbc:mysql://mysql-camilleynesta.alwaysdata.net:3306/camilleynesta_tutojdbc";;
public ConnexionUnique() throws SQLException{
connection = DriverManager.getConnection(CONNECT_URL, "128842", "linottexqxqi");
}
public Connection getConnection(){
return connection;
}
public static ConnexionUnique getInstance() throws SQLException{
if(instance == null)
instance = new ConnexionUnique();
return instance;
}
public void setConnection (Connection connect){
connection = connect;
}
}
|
[
"camille.ynesta@etu.univ-amu.fr"
] |
camille.ynesta@etu.univ-amu.fr
|
053a6c082be524e8ea44734769798f8f138b29b5
|
eca963fa3b666daea5537b2768a8b7881d41f442
|
/haxby/image/jcodec/codecs/mpeg12/MPEGPredQuad.java
|
f11428bf96821601d8622aba1900c0c086604218
|
[
"Apache-2.0"
] |
permissive
|
iedadata/geomapapp
|
1bee9fcbb686b9a932c467cb6d1e4511277d6a46
|
5368b21c425ff188a125939877f1db1eefb7ed9b
|
refs/heads/master
| 2023-08-17T08:47:13.342087
| 2023-08-15T20:20:25
| 2023-08-15T20:20:25
| 98,096,914
| 1
| 3
|
Apache-2.0
| 2023-08-15T20:20:27
| 2017-07-23T12:38:27
|
Java
|
UTF-8
|
Java
| false
| false
| 1,023
|
java
|
package haxby.image.jcodec.codecs.mpeg12;
/**
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
* under FreeBSD License
*
* MPEG 1/2 decoder interframe motion compensation routines.
*
* Quad subpixel interpolator which is just a sub-case of octal subpixel
* interpolator.
*
* @author The JCodec project
*
*/
public class MPEGPredQuad extends MPEGPredOct {
public MPEGPredQuad(MPEGPred other) {
super(other);
}
// TODO: This interpolation uses sinc at the very lowest (half-pel -- 1/8) level as opposed to linear as specified by the standard.
// this may be a result of color greening out in long GOPs.
@Override
public void predictPlane(byte[] ref, int refX, int refY, int refW, int refH, int refVertStep, int refVertOff,
int[] tgt, int tgtY, int tgtW, int tgtH, int tgtVertStep) {
super.predictPlane(ref, refX, refY, refW, refH, refVertStep, refVertOff, tgt, tgtY, tgtW << 1, tgtH << 1,
tgtVertStep);
}
}
|
[
"shanen314@gmail.com"
] |
shanen314@gmail.com
|
e36cf503a5ec670fae2f872e0374c3979f0198e0
|
2f51035e9e29c8e65876e82babb7e288a4565ed6
|
/3-Decorator/StarbuzzCoffeeWithSize/Mocha.java
|
b65636e304426e5f6d10f55ec864425b93cc78a8
|
[] |
no_license
|
rapirent/Java-Design-Patterns
|
876e4c61f582850e8526aa0c91a34dee1d0ee18d
|
43a3c9ca4253a6b157ef6a68cb6e3b133789e4d4
|
refs/heads/master
| 2023-04-18T13:25:17.537992
| 2021-05-03T05:19:26
| 2021-05-03T05:19:26
| 359,359,880
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 351
|
java
|
package starbuzzCoffeeWithSize;
public class Mocha extends CondimentDecorator {
Beverage beverage;
public Mocha(Beverage beverage) {
this.beverage = beverage;
}
public String getDescription() {
return beverage.getDescription() + ", Mocha";
}
public double cost() {
return beverage.cost() + .20;
}
}
|
[
"rapirent@gmail.com"
] |
rapirent@gmail.com
|
d14058092583e2249dd89a7e9cb21084302054f0
|
cc8db277ffcf142e6a81fa8d3f7a240cd3a879b2
|
/src/test/java/com/one/north/web/rest/JobHistoryResourceIT.java
|
254742f3f48593a185bf95d104066d799414a036
|
[] |
no_license
|
uscbsitric/oneAngularTest
|
3a75bb0c8cfcd431a2024199bf1e61d10679aa59
|
6e21bf445372de17254e7037ce4a19f0515e12b0
|
refs/heads/master
| 2021-07-06T20:51:12.222404
| 2019-05-19T09:49:51
| 2019-05-19T09:49:51
| 187,453,490
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 10,793
|
java
|
package com.one.north.web.rest;
import com.one.north.OneangularApp;
import com.one.north.domain.JobHistory;
import com.one.north.repository.JobHistoryRepository;
import com.one.north.service.JobHistoryService;
import com.one.north.web.rest.errors.ExceptionTranslator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import static com.one.north.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import com.one.north.domain.enumeration.Language;
/**
* Integration tests for the {@Link JobHistoryResource} REST controller.
*/
@SpringBootTest(classes = OneangularApp.class)
public class JobHistoryResourceIT {
private static final Instant DEFAULT_START_DATE = Instant.ofEpochMilli(0L);
private static final Instant UPDATED_START_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS);
private static final Instant DEFAULT_END_DATE = Instant.ofEpochMilli(0L);
private static final Instant UPDATED_END_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS);
private static final Language DEFAULT_LANGUAGE = Language.FRENCH;
private static final Language UPDATED_LANGUAGE = Language.ENGLISH;
@Autowired
private JobHistoryRepository jobHistoryRepository;
@Autowired
private JobHistoryService jobHistoryService;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private Validator validator;
private MockMvc restJobHistoryMockMvc;
private JobHistory jobHistory;
@BeforeEach
public void setup() {
MockitoAnnotations.initMocks(this);
final JobHistoryResource jobHistoryResource = new JobHistoryResource(jobHistoryService);
this.restJobHistoryMockMvc = MockMvcBuilders.standaloneSetup(jobHistoryResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter)
.setValidator(validator).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static JobHistory createEntity(EntityManager em) {
JobHistory jobHistory = new JobHistory()
.startDate(DEFAULT_START_DATE)
.endDate(DEFAULT_END_DATE)
.language(DEFAULT_LANGUAGE);
return jobHistory;
}
@BeforeEach
public void initTest() {
jobHistory = createEntity(em);
}
@Test
@Transactional
public void createJobHistory() throws Exception {
int databaseSizeBeforeCreate = jobHistoryRepository.findAll().size();
// Create the JobHistory
restJobHistoryMockMvc.perform(post("/api/job-histories")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobHistory)))
.andExpect(status().isCreated());
// Validate the JobHistory in the database
List<JobHistory> jobHistoryList = jobHistoryRepository.findAll();
assertThat(jobHistoryList).hasSize(databaseSizeBeforeCreate + 1);
JobHistory testJobHistory = jobHistoryList.get(jobHistoryList.size() - 1);
assertThat(testJobHistory.getStartDate()).isEqualTo(DEFAULT_START_DATE);
assertThat(testJobHistory.getEndDate()).isEqualTo(DEFAULT_END_DATE);
assertThat(testJobHistory.getLanguage()).isEqualTo(DEFAULT_LANGUAGE);
}
@Test
@Transactional
public void createJobHistoryWithExistingId() throws Exception {
int databaseSizeBeforeCreate = jobHistoryRepository.findAll().size();
// Create the JobHistory with an existing ID
jobHistory.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restJobHistoryMockMvc.perform(post("/api/job-histories")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobHistory)))
.andExpect(status().isBadRequest());
// Validate the JobHistory in the database
List<JobHistory> jobHistoryList = jobHistoryRepository.findAll();
assertThat(jobHistoryList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void getAllJobHistories() throws Exception {
// Initialize the database
jobHistoryRepository.saveAndFlush(jobHistory);
// Get all the jobHistoryList
restJobHistoryMockMvc.perform(get("/api/job-histories?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(jobHistory.getId().intValue())))
.andExpect(jsonPath("$.[*].startDate").value(hasItem(DEFAULT_START_DATE.toString())))
.andExpect(jsonPath("$.[*].endDate").value(hasItem(DEFAULT_END_DATE.toString())))
.andExpect(jsonPath("$.[*].language").value(hasItem(DEFAULT_LANGUAGE.toString())));
}
@Test
@Transactional
public void getJobHistory() throws Exception {
// Initialize the database
jobHistoryRepository.saveAndFlush(jobHistory);
// Get the jobHistory
restJobHistoryMockMvc.perform(get("/api/job-histories/{id}", jobHistory.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(jobHistory.getId().intValue()))
.andExpect(jsonPath("$.startDate").value(DEFAULT_START_DATE.toString()))
.andExpect(jsonPath("$.endDate").value(DEFAULT_END_DATE.toString()))
.andExpect(jsonPath("$.language").value(DEFAULT_LANGUAGE.toString()));
}
@Test
@Transactional
public void getNonExistingJobHistory() throws Exception {
// Get the jobHistory
restJobHistoryMockMvc.perform(get("/api/job-histories/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateJobHistory() throws Exception {
// Initialize the database
jobHistoryService.save(jobHistory);
int databaseSizeBeforeUpdate = jobHistoryRepository.findAll().size();
// Update the jobHistory
JobHistory updatedJobHistory = jobHistoryRepository.findById(jobHistory.getId()).get();
// Disconnect from session so that the updates on updatedJobHistory are not directly saved in db
em.detach(updatedJobHistory);
updatedJobHistory
.startDate(UPDATED_START_DATE)
.endDate(UPDATED_END_DATE)
.language(UPDATED_LANGUAGE);
restJobHistoryMockMvc.perform(put("/api/job-histories")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedJobHistory)))
.andExpect(status().isOk());
// Validate the JobHistory in the database
List<JobHistory> jobHistoryList = jobHistoryRepository.findAll();
assertThat(jobHistoryList).hasSize(databaseSizeBeforeUpdate);
JobHistory testJobHistory = jobHistoryList.get(jobHistoryList.size() - 1);
assertThat(testJobHistory.getStartDate()).isEqualTo(UPDATED_START_DATE);
assertThat(testJobHistory.getEndDate()).isEqualTo(UPDATED_END_DATE);
assertThat(testJobHistory.getLanguage()).isEqualTo(UPDATED_LANGUAGE);
}
@Test
@Transactional
public void updateNonExistingJobHistory() throws Exception {
int databaseSizeBeforeUpdate = jobHistoryRepository.findAll().size();
// Create the JobHistory
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restJobHistoryMockMvc.perform(put("/api/job-histories")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(jobHistory)))
.andExpect(status().isBadRequest());
// Validate the JobHistory in the database
List<JobHistory> jobHistoryList = jobHistoryRepository.findAll();
assertThat(jobHistoryList).hasSize(databaseSizeBeforeUpdate);
}
@Test
@Transactional
public void deleteJobHistory() throws Exception {
// Initialize the database
jobHistoryService.save(jobHistory);
int databaseSizeBeforeDelete = jobHistoryRepository.findAll().size();
// Delete the jobHistory
restJobHistoryMockMvc.perform(delete("/api/job-histories/{id}", jobHistory.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isNoContent());
// Validate the database is empty
List<JobHistory> jobHistoryList = jobHistoryRepository.findAll();
assertThat(jobHistoryList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(JobHistory.class);
JobHistory jobHistory1 = new JobHistory();
jobHistory1.setId(1L);
JobHistory jobHistory2 = new JobHistory();
jobHistory2.setId(jobHistory1.getId());
assertThat(jobHistory1).isEqualTo(jobHistory2);
jobHistory2.setId(2L);
assertThat(jobHistory1).isNotEqualTo(jobHistory2);
jobHistory1.setId(null);
assertThat(jobHistory1).isNotEqualTo(jobHistory2);
}
}
|
[
"uscbsitric@gmail.com"
] |
uscbsitric@gmail.com
|
f0820571b567ba061add46ee6399693ae89af5a0
|
02a8ce78f8874a301c31476df36196361f814fa8
|
/src/Main.java
|
a7378f4974c6783a0634cebe13ccddffbaac51a8
|
[] |
no_license
|
sergioceron/CFIE3
|
cb4c783aa12b2202e8d89af27e5e1ff6185446cb
|
fe626aac1f73cd42e8512085f2687eb1f62caeb7
|
refs/heads/master
| 2021-01-14T13:44:14.929909
| 2015-01-11T20:01:05
| 2015-01-11T20:01:05
| 29,103,984
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,410
|
java
|
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.metadata.ClassMetadata;
import java.util.Map;
/**
* User: sg
* Date: 16/09/12
* Time: 11:21 AM
*/
public class Main {
private static final SessionFactory ourSessionFactory;
static {
try {
ourSessionFactory = new AnnotationConfiguration().
configure("hibernate.cfg.xml").
buildSessionFactory();
} catch (Throwable ex) {
throw new ExceptionInInitializerError(ex);
}
}
public static Session getSession() throws HibernateException {
return ourSessionFactory.openSession();
}
public static void main(final String[] args) throws Exception {
final Session session = getSession();
try {
System.out.println("querying all the managed entities...");
final Map metadataMap = session.getSessionFactory().getAllClassMetadata();
for (Object key : metadataMap.keySet()) {
final ClassMetadata classMetadata = (ClassMetadata) metadataMap.get(key);
final String entityName = classMetadata.getEntityName();
final Query query = session.createQuery("from " + entityName);
System.out.println("executing: " + query.getQueryString());
for (Object o : query.list()) {
System.out.println(" " + o);
}
}
} finally {
session.close();
}
}
}
|
[
"sceronf@gmail.com"
] |
sceronf@gmail.com
|
aa490b1fe8ef1e43edb932271289ed0df9bac918
|
b5bbae9508c1e4ecaf53ec3315676401831aa4fe
|
/src/main/java/com/wangab/dao/EasemobDAO.java
|
f67d4b580c91ef07b7fb17dd9380c333ef10e822
|
[] |
no_license
|
Wangab/WeStarService
|
b24449af5473a8be9f3c9217b52676f3d089f39b
|
09d11d94f7be74c367724cc8e73ecea0aefe9531
|
refs/heads/master
| 2020-12-01T04:52:31.211859
| 2017-02-23T05:40:32
| 2017-02-23T05:40:32
| 67,204,052
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,414
|
java
|
package com.wangab.dao;
import com.wangab.entity.po.EasemobPO;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Repository;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
/**
* Created by wanganbang on 11/26/16.
*/
@Repository("easemobDAO")
public class EasemobDAO {
@Value("${application.easemob.user-url}")
private String addUserUrl;
@Value("${application.easemob.token-url}")
private String token_url;
@Value("${application.easemob.client-id}")
private String client_id;
@Value("${application.easemob.client-secret}")
private String client_secret;
@Autowired
private RestTemplate restTemplate;
public String getToken() throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
Map<String, Object> params = new HashMap<String, Object>();
params.put("grant_type", "client_credentials");
params.put("client_id", client_id);
params.put("client_secret", client_secret);
JSONObject jsonObject = new JSONObject(params);
HttpEntity<String> formEnty = new HttpEntity<>(jsonObject.toString(), headers);
URI url = new URI(token_url);
String result = restTemplate.postForObject(url, formEnty, String.class);
String accessToken = new JSONObject(result).getString("access_token");
return accessToken;
}
public String addUser(EasemobPO easemobPO) throws URISyntaxException {
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
JSONObject jsonObject = easemobPO.toJsonObject();
HttpEntity<String> formEnty = new HttpEntity<>(jsonObject.toString(), headers);
URI url = new URI(addUserUrl);
String result = restTemplate.postForObject(url, formEnty, String.class);
return result;
}
public String getAddUserUrl() {
return addUserUrl;
}
public void setAddUserUrl(String addUserUrl) {
this.addUserUrl = addUserUrl;
}
public String getToken_url() {
return token_url;
}
public void setToken_url(String token_url) {
this.token_url = token_url;
}
public String getClient_id() {
return client_id;
}
public void setClient_id(String client_id) {
this.client_id = client_id;
}
public String getClient_secret() {
return client_secret;
}
public void setClient_secret(String client_secret) {
this.client_secret = client_secret;
}
public RestTemplate getRestTemplate() {
return restTemplate;
}
public void setRestTemplate(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
}
|
[
"wanganbang@nationsky.com"
] |
wanganbang@nationsky.com
|
066d81741fa283091c6077675621c18db2bdfe4d
|
7257d88388b437d9c0ca672cdee99489228abc1d
|
/src/main/java/com/javaex/controller/UserController.java
|
03050c4193a447b6f54aa4c41ed7c75a3bd4bd3f
|
[] |
no_license
|
thunderkyg/jblog
|
407016374697a9e00256a83f5989d8512c2e6820
|
140cf17c8ea44c50cb494a163905b8b4ece12a37
|
refs/heads/master
| 2023-07-13T07:15:13.422028
| 2021-08-12T06:52:10
| 2021-08-12T06:52:10
| 394,178,239
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,705
|
java
|
package com.javaex.controller;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
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.javaex.service.UserService;
import com.javaex.vo.UserVo;
@Controller
@RequestMapping(value = "/user", method = { RequestMethod.GET, RequestMethod.POST })
public class UserController {
// AutoWired
@Autowired
private UserService userService;
// LoginForm
@RequestMapping(value = "/loginForm", method = { RequestMethod.GET, RequestMethod.POST })
public String loginForm() {
System.out.println("[UserController.loginForm()]");
return "user/loginForm";
}
// Login
@RequestMapping(value = "/login", method = { RequestMethod.GET, RequestMethod.POST })
public String login(@ModelAttribute UserVo userVo, HttpSession session) {
System.out.println("[UserController.login()]");
UserVo authUser = userService.getUser(userVo);
System.out.println(authUser);
if (authUser != null) {
System.out.println("로그인 성공함");
session.setAttribute("authUser", authUser);
return "/main/index";
} else {
System.out.println("로그인 실패함");
return "redirect:/user/loginForm?result=fail";
}
}
// Logout
@RequestMapping(value = "/logout", method = { RequestMethod.GET, RequestMethod.POST })
public String logout(HttpSession session) {
//Remove Session
session.removeAttribute("authUser");
session.invalidate();
return "redirect:/";
}
// JoinForm
@RequestMapping(value = "/joinForm", method = { RequestMethod.GET, RequestMethod.POST })
public String joinForm() {
System.out.println("[UserController.joinForm()]");
return "user/joinForm";
}
// Join
@RequestMapping(value = "/join", method = { RequestMethod.GET, RequestMethod.POST })
public String join(@ModelAttribute UserVo userVo) {
System.out.println("[UserController.join()]");
System.out.println(userVo);
userService.join(userVo);
return "user/joinSuccess";
}
//Ajax(ID 중복 체크)
@ResponseBody
@RequestMapping(value = "/checkId", method = { RequestMethod.GET, RequestMethod.POST })
public boolean checkId(String id) {
System.out.println("[UserController.checkId()]");
System.out.println(id);
return userService.checkId(id);
}
}
|
[
"thunderkyg@gmail.com"
] |
thunderkyg@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.