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
d505f4c6ce42917d273eedee14576ac73401da05
fdb57491f656e584527f9b5fdc1d6d1b73770764
/CODE/Client/src/view/LogInController.java
a26e217fc40135f9080dade50798b400612e0496
[]
no_license
PaulBalan1/Online-Bank-Simulation
e4e017d7bed1a4567a2dd02863540a64c6c5ec30
c2d60db3bb25a074b2aed2653462e98040f02903
refs/heads/master
2023-02-22T03:29:49.878402
2021-01-24T14:50:17
2021-01-24T14:50:17
332,474,601
0
0
null
null
null
null
UTF-8
Java
false
false
2,620
java
package view; import com.jfoenix.controls.JFXPasswordField; import com.jfoenix.controls.JFXTextField; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.input.KeyEvent; import javafx.scene.layout.Region; import viewModel.LogInViewModel; public class LogInController { @FXML private JFXTextField emailField; @FXML private JFXPasswordField passwordField; @FXML private Label errorLabel; private Region root; private LogInViewModel model; private ViewHandler viewHandler; public LogInController() { } public void init(ViewHandler viewHandler, LogInViewModel viewModel, Region root) { this.root = root; this.model = viewModel; this.viewHandler = viewHandler; this.emailField.textProperty().bindBidirectional(model.getEmailProperty()); this.passwordField.textProperty().bindBidirectional(model.getPasswordProperty()); this.errorLabel.textProperty().bindBidirectional(model.getErrorProperty()); viewModel.getOpenClientProperty().addListener((observable, oldValue, newValue) -> { if(newValue) { viewModel.setOpenClient(false); viewHandler.openView("client"); } } ); viewModel.getOpenStaffProperty().addListener((observable, oldValue, newValue) -> { if(newValue) { viewModel.setOpenStaff(false); viewHandler.openView("staff"); } } ); viewModel.getOpenRegisterProperty().addListener((observable, oldValue, newValue) -> { if(newValue) { viewModel.setOpenRegister(false); viewHandler.openView("register"); } } ); viewModel.getExitProgramProperty().addListener((observable, oldValue, newValue) -> { if(newValue) { viewHandler.closeView(); } } ); } public void reset() { model.resetFields(); } public Region getRoot() { return this.root; } public void loginButton() { model.login(); } public void registerButton() { model.registerButton(); } public void cancelButton() { model.exitApp(); } }
[ "56250869+PaulBalan1@users.noreply.github.com" ]
56250869+PaulBalan1@users.noreply.github.com
91478bea0893a19be7a33f5021fe61825f25dd33
4779c83baaa05d9dc9bdbc9c846240e89e338e1e
/lab7/cardemo/src/test/java/com/example/cardemo/controllers/CarControllerMockTest.java
e5b41924646ec9c567a4f100e3f603e9be438488
[]
no_license
MarioCSilva/TQS
7ffc34427187caf6cefc51e2972bc62023c49f5b
afec259ea325148470dfb758ee1066a8a4c72230
refs/heads/main
2023-04-21T01:59:40.749301
2021-05-16T16:16:28
2021-05-16T16:16:28
350,285,998
0
0
null
null
null
null
UTF-8
Java
false
false
3,128
java
package com.example.cardemo.controllers; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import com.example.cardemo.JsonUtil; import com.example.cardemo.entities.Car; import com.example.cardemo.services.CarManagerService; import java.util.Arrays; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.CoreMatchers.is; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @WebMvcTest(CarController.class) class CarControllerMockTest { @Autowired MockMvc mvc; @MockBean private CarManagerService carManagerService; @Test public void whenGetCar_thenReturnCar() throws Exception { when(carManagerService.getCarDetails(anyLong())).thenReturn( java.util.Optional.of( new Car("McLaren", "Senna")) ); mvc.perform(get("/api/v1/cars/1")) .andExpect(status().isOk()) .andExpect(jsonPath("$.maker", is("McLaren"))) .andExpect(jsonPath("$.model", is("Senna"))); } @Test public void whenGetCars_thenReturnAllCars() throws Exception { Car mclareen = new Car("McLaren", "Senna"); Car jaguar = new Car("Jaguar", "XJ 220"); Car lamborghini = new Car("Lamborghini", "Aventador SVJ"); when(carManagerService.getAllCars()).thenReturn(Arrays.asList(mclareen, jaguar, lamborghini)); mvc.perform(get("/api/v1/cars")) .andExpect(status().isOk()) .andExpect(jsonPath("$", hasSize(greaterThanOrEqualTo(3)))) .andExpect(jsonPath("$[0].maker", is("McLaren"))) .andExpect(jsonPath("$[0].model", is("Senna"))) .andExpect(jsonPath("$[1].maker", is("Jaguar"))) .andExpect(jsonPath("$[1].model", is("XJ 220"))) .andExpect(jsonPath("$[2].maker", is("Lamborghini"))) .andExpect(jsonPath("$[2].model", is("Aventador SVJ"))); } @Test public void whenPostCar_thenCreateCar() throws Exception { Car mclaren = new Car("McLaren", "Senna"); when(carManagerService.save(Mockito.any())).thenReturn(mclaren); mvc.perform(post("/api/v1/cars") .contentType(MediaType.APPLICATION_JSON).content(JsonUtil.toJson(mclaren))) .andExpect(status().isCreated()) .andExpect(jsonPath("$.maker", is("McLaren"))) .andExpect(jsonPath("$.model", is("Senna"))); verify(carManagerService, times(1)).save(Mockito.any()); } }
[ "mariosilva@ua.pt" ]
mariosilva@ua.pt
0234de796e09ba73e906676c414ee87fa910aabe
152ed2d9916d73d8d7a981af7f03c20ef059ea96
/src/main/java/com/example/demo/model/Player.java
a7a4696b11ffdea3dd0724148ad038bb1cfd7f8c
[]
no_license
idzia/GameDemo
eea575256423906ade1cf6aa5521c72464873ecb
de2f232e440a458605cac29f423bf83778da567a
refs/heads/master
2020-06-21T05:26:27.142802
2019-07-17T09:21:52
2019-07-17T09:21:52
197,355,384
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.example.demo.model; import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.Collections; import java.util.List; public class Player { private String name; private List<Card> palette; public Player() { } public Player(String name, List<Card> palette) { this.name = name; this.palette = palette; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Card> getPalette() { return palette; } public void setPalette(List<Card> palette) { this.palette = palette; } @JsonIgnore public Card getHighest() { Collections.sort(palette); return palette.get(palette.size()-1); } }
[ "ania.idzi@gmail.com" ]
ania.idzi@gmail.com
1f4bd86a42bce070c478aafea79a6613f0d6bb1d
d9bf69968d0edfc8ed102da7f9536997969cea7e
/app/src/main/java/utils/AESUtil2.java
797c0331ec1ba68a4b33ab2b58a82e04ca0006c2
[]
no_license
zgyanglinjie/CommenUtils
0f5dd47c1dd6121b68c6bd15d5b551fc425ce2eb
5b6820f0b1272a064414a1bff2eb8477b35f4517
refs/heads/master
2021-01-10T01:41:53.688380
2016-01-07T09:32:28
2016-01-07T09:32:28
45,167,549
0
0
null
null
null
null
UTF-8
Java
false
false
2,428
java
package utils; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; /** * Created by jh on 2015/8/6. */ public class AESUtil2 { static final public byte[] KEY_VI = { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8}; public static final String bm = "UTF-8"; public static String encrypt(String dataPassword, String cleartext) throws Exception { IvParameterSpec zeroIv = new IvParameterSpec(KEY_VI); SecretKeySpec key = new SecretKeySpec(dataPassword.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv); byte[] encryptedData = cipher.doFinal(cleartext.getBytes(bm)); return new String (parseByte2HexStr(encryptedData)); } public static String decrypt(String dataPassword, String encrypted) throws Exception { byte[] byteMi = parseHexStr2Byte(encrypted); IvParameterSpec zeroIv = new IvParameterSpec(KEY_VI); SecretKeySpec key = new SecretKeySpec(dataPassword.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, key, zeroIv); byte[] decryptedData = cipher.doFinal(byteMi); return new String(decryptedData,bm); } /** * 将16进制转换为二进制 * * @param hexStr * @return */ public static byte[] parseHexStr2Byte(String hexStr) { if (hexStr.length() < 1) { return null; } byte[] result = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length() / 2; i++) { int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); result[i] = (byte) (high * 16 + low); } return result; } /** * 将二进制转换成16进制 * * @param buf * @return */ public static String parseByte2HexStr(byte buf[]) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < buf.length; i++) { String hex = Integer.toHexString(buf[i] & 0xFF); if (hex.length() == 1) { hex = '0' + hex; } sb.append(hex.toUpperCase()); } return sb.toString(); } }
[ "2312945378@qq.com" ]
2312945378@qq.com
7267f8302b44d09284a7c86c8e85030c83926ca4
5e384938f407cf09b9f0d7561336dddb5d4599aa
/Projetos/ProjetoBaseLayoutMDI/src/projetobaselayoutmdi/FXMLMDI02Controller.java
570cc2ec1118a614bd5d1337867a683a35dc14d3
[]
no_license
Mardoniosc/java_udemy
2967d19dac4686ed6f6a421480388c55df2f790f
635d1b4ce3c56571adb19884e205e120f9cc46bd
refs/heads/master
2020-05-25T00:46:30.796173
2019-08-16T13:39:00
2019-08-16T13:39:00
187,537,838
0
0
null
null
null
null
UTF-8
Java
false
false
578
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 projetobaselayoutmdi; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; /** * FXML Controller class * * @author MVM */ public class FXMLMDI02Controller implements Initializable { /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { // TODO } }
[ "mardonio@live.com" ]
mardonio@live.com
60b8ec00e1bf5a09e0f4dece2ea09287db1ff576
d92785e28c87d5398306416f569fd50cb8dc00a0
/aoc2020/src/main/java/com/kimambo/aoc2020/Day6.java
7a510a7cedd2a709d5b4c38005ce0cacf449a35d
[]
no_license
maxkimambo/advent-of-code
54074fdc99a10bfaeff90de46dd942930dad1b3e
65b08a7e868f42074af19c67233776bb5b6631d4
refs/heads/main
2023-03-05T07:29:13.335939
2021-02-14T16:55:59
2021-02-14T16:55:59
336,588,985
1
1
null
2021-02-13T15:33:18
2021-02-06T16:59:32
Java
UTF-8
Java
false
false
3,509
java
package com.kimambo.aoc2020; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.stream.Collector; import java.util.stream.Collectors; public class Day6 { class Group { Collection<Character> answers = new HashSet<>(); List<HashSet<Character>> groupAnswers = new ArrayList<>(); int groupCount = 0; int groupCommon = 0; void addAnswers(char[] cs) { for (char c : cs) { if (answers.add(c)) { groupCount++; } } } int everyonesAnswers(List<String> answers) { for (String a : answers) { HashSet<Character> personAnswer = new HashSet<>(); for (char c : a.toCharArray()) { personAnswer.add(c); } this.groupAnswers.add(personAnswer); } // check what is the union for this group HashSet s1 = this.groupAnswers.get(0); for (int i = 1; i < this.groupAnswers.size(); i++) { s1.retainAll(this.groupAnswers.get(i)); } groupCommon = s1.size(); return s1.size(); } } private ResourceFileReader reader; private List<String> inputData; public Day6(ResourceFileReader fr) { reader = fr; try { inputData = reader.getContents(); } catch (IOException e) { e.printStackTrace(); } } private List<Group> parseAnswers(List<String> input, boolean isPart2) { List<String> groupAnswers = new ArrayList<>(); List<Group> answers = new ArrayList<>(); for (int i = 0; i < input.size(); i++) { String line = input.get(i); if (line.isEmpty()) { // parse group answers.add(parseGroupAnswers(groupAnswers, isPart2)); // create new instance groupAnswers = new ArrayList<>(); } else { groupAnswers.add(line); } if (i == input.size() - 1) { answers.add(parseGroupAnswers(groupAnswers, isPart2)); } } return answers; } private Group parseGroupAnswers(List<String> groupAnswers, boolean intersect) { Group g = new Group(); if (intersect) { g.everyonesAnswers(groupAnswers); } else { for (String userAnswer : groupAnswers) { g.addAnswers(userAnswer.toCharArray()); } } return g; } private int Solve1() { List<Group> groupAnswers = parseAnswers(inputData, false); int sumAnswers = 0; for (Group g : groupAnswers) { sumAnswers += g.groupCount; } return sumAnswers; } private int Solve2() { List<Group> groupAnswers = parseAnswers(inputData, true); int sumAnswers = 0; for (Group g : groupAnswers) { sumAnswers += g.groupCommon; } return sumAnswers; } public void Solve() { System.out.println("------------ Day 6 ---------------"); int result = Solve1(); System.out.println("Sum of answers " + result); int result2 = Solve2(); System.out.println("Sum of unique group answers " + result2); } }
[ "max@kimambo.de" ]
max@kimambo.de
9687d6a53b2238f7fc09914dc5a76f5311b6bf0c
c99733c9d33e951534f0e50324695c7fd74b7b69
/yugi/src/yugi/scraper/Scraper.java
81a9d3066e59caa3472c20d4f1f8e19e86c9e8d4
[]
no_license
codecypherz/yugi
751c4431815bd53762fb2abb0cadea7138be2a32
49490bd15324630fcd15228fd45ef33b1791d2f7
refs/heads/master
2016-09-08T05:10:03.360841
2013-01-28T23:09:40
2013-01-28T23:09:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,067
java
package yugi.scraper; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import yugi.model.Card; public class Scraper { public Scraper() { } public void scrape(String mainUrl) { // Parse all potential card links from the main URL. long start = System.currentTimeMillis(); System.out.println("Finding all card links..."); Set<String> cardLinks = new HashSet<String>(); try { cardLinks = getCardLinks(mainUrl); } catch (Exception e) { e.printStackTrace(); } long finish = System.currentTimeMillis(); System.out.println("Finished. Found " + cardLinks.size() + " card links in " + ((finish - start) / 1000.0) + " seconds."); try { CardProcessor cardProcessor = new CardProcessor(); Card card = cardProcessor.process( "file:///home/james/Downloads/yugioh.wikia.com/Arcana_Force_XIV_-_Temperance"); System.out.println("Here's the card:"); System.out.println(card.toString()); } catch (Exception e) { e.printStackTrace(); } // Try to create cards from all of the parsed links. List<Card> cards = new ArrayList<Card>(); for (String cardLink : cardLinks) { try { cards.add(scrapeCard(cardLink)); } catch (Exception e) { System.out.println("Failed to parse a card from this link: " + cardLink); e.printStackTrace(); } } // Upload the cards to appengine. for (Card card : cards) { try { uploadCard(card); } catch (Exception e) { System.out.println("Failed to upload this card: " + card.toString()); e.printStackTrace(); } } } /** * Recursively searches the web page at the given URL for card links. If it finds a link * to more card links, it will follow the link and continue searching. Only when all * potential links have been exhausted will this function return. * @param url * @return * @throws Exception */ private Set<String> getCardLinks(String url) { Set<String> cardLinks = new HashSet<String>(); String nextLink = url; while (nextLink != null) { // Don't actually follow live links in LOCAL mode. if (Main.LOCAL && nextLink.startsWith("http")) { System.out.println("Skipping this live link: " + nextLink); break; } if (!nextLink.startsWith(Main.HOST)) { nextLink = Main.HOST + nextLink; } CardLinksProcessor processor = new CardLinksProcessor(); try { processor.process(nextLink); } catch (Exception e) { e.printStackTrace(); } // Add to the full set of card links. cardLinks.addAll(processor.getCardLinks()); // Continue the loop until there are no more links to follow. nextLink = processor.getNextLink(); if (nextLink == null) { System.out.println("No further links to follow."); } } return cardLinks; } private Card scrapeCard(String cardLink) { Card card = new Card(); // TODO return card; } private void uploadCard(Card card) throws Exception { if (!card.isValid()) { throw new Exception("Card was not valid."); } // TODO } }
[ "james@taru" ]
james@taru
04c8f823cb432be02fa5f753ae44d4903c6346e8
641d33c69fa868126b0c9aa5176a13e339a1aa8b
/ecmoban/src/main/java/com/ecjia/hamster/activity/ForgetPasswordActivity.java
db2f97b32a31249f2ee6bbcc6cc5745e4a7ff7b9
[]
no_license
hackerlcg/SJQ_ECSHOP_ZG_NEW
8fea21000dad2e301d431d253dda68cbeeb63932
9b2e371484c28ad3dd7bea81de2c53d79ef13e99
refs/heads/master
2021-08-31T10:58:29.956044
2017-12-21T02:56:39
2017-12-21T02:56:39
114,960,183
1
0
null
null
null
null
UTF-8
Java
false
false
9,025
java
package com.ecjia.hamster.activity; import android.content.Intent; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.ecjia.base.BaseActivity; import com.ecjia.component.network.model.LoginModel; import com.ecjia.consts.ProtocolConst; import com.ecjia.component.view.MyCheckDialog; import com.ecjia.component.view.MyDialog; import com.ecjia.component.view.ToastView; import com.ecjia.consts.DBManager; import com.ecjia.hamster.adapter.ForgetCheckAdapter; import com.ecjia.hamster.model.DBUSER; import com.ecmoban.android.shopkeeper.sijiqing.R; import com.ecjia.hamster.model.HttpResponse; import com.ecjia.hamster.model.STATUS; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; public class ForgetPasswordActivity extends BaseActivity implements HttpResponse { private TextView top_view_text; private ImageView top_view_back; private Button btn_next; private ListView listView; private DBManager database; private SQLiteDatabase db; private ArrayList<DBUSER> dbusers; private ForgetCheckAdapter listAdapter; private LoginModel loginModel; private String name; private String pwd; private String api; public Handler Intenthandler; private MyCheckDialog myCDialog; private MyDialog myDialog; public ForgetPasswordActivity() { } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.forget_pwd); database = new DBManager(this); db = null; db = database.getReadableDatabase(); dbusers=new ArrayList<DBUSER>(); dbusers.addAll(database.selectAll(db)); loginModel = new LoginModel(ForgetPasswordActivity.this); loginModel.addResponseListener(this); initView(); } private void initView() { top_view_text = (TextView) findViewById(R.id.top_view_text); top_view_text.setText(res.getText(R.string.shop_check)); top_view_back = (ImageView) findViewById(R.id.top_view_back); btn_next = (Button) findViewById(R.id.btn_next); listView = (ListView) findViewById(R.id.shop_list); checkCheck(); btn_next.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String tips = res.getString(R.string.tips); String tips_content = res.getString(R.string.tips_content); myDialog = new MyDialog(ForgetPasswordActivity.this, tips, tips_content); myDialog.show(); myDialog.negative.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { myDialog.dismiss(); } }); myDialog.positive.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { database.deletNoCheck(db); dbusers.clear(); dbusers.addAll(database.selectAll(db)); if(dbusers.size()>0){ name=dbusers.get(0).getName(); pwd=dbusers.get(0).getPwd(); api=dbusers.get(0).getApi(); api=formatApi(api); loginModel.login(name, pwd,api); } myDialog.dismiss(); } }); } }); top_view_back.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(ForgetPasswordActivity.this,LockActivity.class); startActivity(intent); resetCheck(); finish(); } }); if (listAdapter == null) { listAdapter = new ForgetCheckAdapter(this, dbusers); } listAdapter.setOnCheckItemClickListener(new ForgetCheckAdapter.onCheckItemClickListener() { @Override public void onCheckItemClick(View v, int position) { final String checkpwd=dbusers.get(position).getPwd(); final String checkapi=dbusers.get(position).getApi(); String title = res.getString(R.string.enter_password); String edit = res.getString(R.string.shop_password); myCDialog = new MyCheckDialog(ForgetPasswordActivity.this, title, edit); myCDialog.show(); myCDialog.negative.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { myCDialog.dismiss(); } }); myCDialog.positive.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String enter=myCDialog.getEnter(); if(!TextUtils.isEmpty(enter)) { if (enter.equals(checkpwd)) { database.updateIsCheck(db, checkapi); dbusers.clear(); dbusers.addAll(database.selectAll(db)); listAdapter.notifyDataSetChanged(); checkCheck(); }else{ ToastView toast = new ToastView(ForgetPasswordActivity.this, res.getString(R.string.fgcheck_fail)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } myCDialog.dismiss(); }else{ ToastView toast = new ToastView(ForgetPasswordActivity.this, res.getString(R.string.password_cannot_be_empty)); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } } }); } }); listView.setAdapter(listAdapter); } private void checkCheck() { boolean check=false; for (int i=0;i<dbusers.size();i++){ if(dbusers.get(i).getIsCheck()==1){ check=true; break; }else{ check=false; } } if(check){ btn_next.setEnabled(true); }else{ btn_next.setEnabled(false); } } private void resetCheck(){ database.resetCheck(db); } @Override protected void onResume() { super.onResume(); } @Override public void onBackPressed() { super.onBackPressed(); Intent intent=new Intent(ForgetPasswordActivity.this,LockActivity.class); startActivity(intent); resetCheck(); finish(); } private String formatApi(String api) { if (!api.contains("http://")){ api="http://"+api; } return api; } @Override public void OnMessageResponse(String url, JSONObject jo, STATUS status) throws JSONException { String invalid = res.getString(R.string.login_invalid); String welcome = res.getString(R.string.login_welcome); if (url.equals(ProtocolConst.SIGNIN)) { if (status.getSucceed() == 1) { ToastView toast = new ToastView(ForgetPasswordActivity.this, welcome); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); boolean distinct=database.isDistinct(db,api); if(distinct){ database.updateDefault(db, api); }else{ DBUSER dbuser=new DBUSER(name, pwd,api,1,0); database.insertData(db,dbuser); } Intent intent = new Intent(ForgetPasswordActivity.this,SettingActivity.class); intent.putExtra("fromForget", true); startActivity(intent); resetCheck(); finish(); overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out); } else { ToastView toast = new ToastView(ForgetPasswordActivity.this, invalid); toast.setGravity(Gravity.CENTER, 0, 0); toast.show(); } } } }
[ "812405389@qq.com" ]
812405389@qq.com
7806dfe6185a23d46a808957c4d967d960fac66b
2c08dff5035278da94d967f70aca816a9895ddd8
/data/src/main/java/com/cop/huuba/data/source/local/SqliteFavouriteSong.java
f0467dcce91387e1a5dcb55952c2309d41ee617c
[]
no_license
banguyenht/SongLibarary
a0e0d6b39b318078fa0f11d070ca786c3a67e18f
1480052df019c08405e25dc0b2a7456a14c49517
refs/heads/master
2020-04-09T02:36:02.960115
2018-12-01T15:07:39
2018-12-01T15:07:39
159,946,489
0
0
null
null
null
null
UTF-8
Java
false
false
3,860
java
package com.cop.huuba.data.source.local; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.cop.huuba.data.model.Song; import java.util.ArrayList; import java.util.List; public class SqliteFavouriteSong extends SQLiteOpenHelper { public static final String DATABASE_NAME = "favotite"; private static final String TABLE_NAME = "favotiteMp3"; private static final String ID = "id"; private static final String mTitle = "title"; private static final String mArtworkUrl = "artwork_url"; private static final String mDownloadUrl = "download_url"; private static final String mUserFullName = "username"; private static final String mUri = "uri"; public SqliteFavouriteSong(Context context) { super(context, DATABASE_NAME, null, 1); } @Override public void onCreate(SQLiteDatabase db) { String sqlQuery = "CREATE TABLE " + TABLE_NAME + " (" + ID + " TEXT primary key, " + mTitle + " TEXT, " + mArtworkUrl + " TEXT, " + mDownloadUrl + " TEXT," + mUri + " TEXT, " + mUserFullName + " TEXT)"; db.execSQL(sqlQuery); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME); onCreate(db); } public void addSong(Song song) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(ID, song.getId()); values.put(mTitle, song.getTitle()); values.put(mUri , song.getUri()); values.put(mDownloadUrl, song.getDownloadUrl()); values.put(mArtworkUrl, song.getArtworkUrl()); values.put(mUserFullName, song.getUserFullName()); db.insert(TABLE_NAME, null, values); db.close(); } public List<Song> getAllSong() { List<Song> listStudent = new ArrayList<Song>(); String selectQuery = "SELECT * FROM " + TABLE_NAME; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { Song song = new Song(); song.setId(cursor.getString(0)); song.setTitle(cursor.getString(1)); song.setArtworkUrl(cursor.getString(2)); song.setDownloadUrl(cursor.getString(3)); song.setUri(cursor.getString(4)); song.setUserFullName(cursor.getString(5)); song.setIsIsFavourite(true); listStudent.add(song); } while (cursor.moveToNext()); } cursor.close(); db.close(); return listStudent; } public boolean getSongById(String id){ SQLiteDatabase db = this.getReadableDatabase(); String query = "SELECT * FROM "+ TABLE_NAME + " WHERE " + ID + " = '" + id + "'"; Cursor cursor = db.rawQuery(query, null); if (cursor == null) return false; cursor.moveToFirst(); if (cursor.getCount() > 0) return true; return false; } public void deleteSong(Song song) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_NAME, ID + " = ?", new String[] { String.valueOf(song.getId()) }); db.close(); } public int getSongCount() { String countQuery = "SELECT * FROM " + TABLE_NAME; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); int cout = cursor.getCount(); cursor.close(); return cout; } }
[ "ba199703" ]
ba199703
c452cec45d2993ac50d7d8df445bedf36ee15099
2b55dcd4074f9565c1f9ce997faba25c27d6759f
/src/tp_openclassroom_semaine2/GPS.java
1d439888e485f538e41ab14158fe702a88c6234b
[]
no_license
rlemattre/openclassroom_garage
952a0608b231e77ce4f46d9eebfa9e63243f5cdb
089686919707f01eaaafc1bf3400aa6694d36ed6
refs/heads/master
2020-03-09T10:05:04.328364
2018-04-09T06:56:45
2018-04-09T06:56:45
128,728,122
0
0
null
null
null
null
UTF-8
Java
false
false
869
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 tp_openclassroom_semaine2; import java.io.Serializable; /** * Classe permettant d'instancier des Option de type GPS, implementant Option * @author romua */ public class GPS implements Option, Serializable { /** * Permet de retourner le prix de l'option GPS * @return prix de l'option GPS */ @Override public Double getPrix(){ return 100.00; } /** * Cree et retourne une phrase avec les information de l'instance * @return la phrase constitue du nom de l'option (GPS) et de son prix */ @Override public String toString(){ return "GPS (" + getPrix() + "€)"; } }
[ "romua@Portable-Romu" ]
romua@Portable-Romu
1decc28c1e10e156ea97c4dbc0ec897657b32b4b
c2754713f57e17b784f3a23b0e0afb77998860ee
/src/main/java/com/colorit/backend/game/messages/handlers/ClientSnapshotHandler.java
8a06f0458658a0fb72666bb2bd9a026cbd5f9785
[]
no_license
HustonMmmavr/S.D.D.-02-2018
243fecddb931b187ef6eabba66677a6a576acfaa
8c65cd14e12e13faedb9ef4902d7b6295368caf0
refs/heads/master
2020-03-19T12:34:43.442157
2018-06-07T20:22:36
2018-06-07T20:22:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,362
java
package com.colorit.backend.game.messages.handlers; import com.colorit.backend.entities.Id; import com.colorit.backend.entities.db.UserEntity; import com.colorit.backend.game.mechanics.GameMechanics; import com.colorit.backend.game.messages.input.ClientSnapshot; import com.colorit.backend.websocket.MessageHandler; import com.colorit.backend.websocket.MessageHandlerContainer; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.validation.constraints.NotNull; @Service public class ClientSnapshotHandler extends MessageHandler<ClientSnapshot> { private final @NotNull GameMechanics gameMechanics; private final @NotNull MessageHandlerContainer messageHandlerContainer; public ClientSnapshotHandler(@NotNull GameMechanics gameMechanics, @NotNull MessageHandlerContainer messageHandlerContainer) { super(ClientSnapshot.class); this.messageHandlerContainer = messageHandlerContainer; this.gameMechanics = gameMechanics; } @PostConstruct private void init() { messageHandlerContainer.registerHandler(ClientSnapshot.class, this); } @Override public void handle(@NotNull ClientSnapshot clientSnapshot, @NotNull Id<UserEntity> forUser) { gameMechanics.addClientSnapshot(forUser, clientSnapshot); } }
[ "huston.mavr@gmail.com" ]
huston.mavr@gmail.com
f6f95c48cfe41068038e2c59b746307fb0d9d51d
5bf611b0fde8cdd8f4b815ca9ae22b6113c1a33d
/lib/src/us/kbase/reskesearchdemo/SearchObjectsOutput.java
b7a370c1c203095a0b0bee7d27ffd6a3985a2a31
[ "MIT" ]
permissive
kbaseapps/RESKESearchDemo
7f45dc2a72ea9a991d2f0380aa9245ecca22a56c
9140c6726e3ae26ae7ba20b3fdcfed96049393d5
refs/heads/master
2021-01-20T14:17:04.015289
2017-05-08T19:38:16
2017-05-08T19:38:16
90,585,041
0
0
null
null
null
null
UTF-8
Java
false
false
3,765
java
package us.kbase.reskesearchdemo; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Generated; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; /** * <p>Original spec-file type: SearchObjectsOutput</p> * * */ @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("com.googlecode.jsonschema2pojo") @JsonPropertyOrder({ "pagination", "sorting_rules", "objects", "total", "search_time" }) public class SearchObjectsOutput { /** * <p>Original spec-file type: Pagination</p> * * */ @JsonProperty("pagination") private Pagination pagination; @JsonProperty("sorting_rules") private List<SortingRule> sortingRules; @JsonProperty("objects") private List<ObjectData> objects; @JsonProperty("total") private Long total; @JsonProperty("search_time") private Long searchTime; private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** * <p>Original spec-file type: Pagination</p> * * */ @JsonProperty("pagination") public Pagination getPagination() { return pagination; } /** * <p>Original spec-file type: Pagination</p> * * */ @JsonProperty("pagination") public void setPagination(Pagination pagination) { this.pagination = pagination; } public SearchObjectsOutput withPagination(Pagination pagination) { this.pagination = pagination; return this; } @JsonProperty("sorting_rules") public List<SortingRule> getSortingRules() { return sortingRules; } @JsonProperty("sorting_rules") public void setSortingRules(List<SortingRule> sortingRules) { this.sortingRules = sortingRules; } public SearchObjectsOutput withSortingRules(List<SortingRule> sortingRules) { this.sortingRules = sortingRules; return this; } @JsonProperty("objects") public List<ObjectData> getObjects() { return objects; } @JsonProperty("objects") public void setObjects(List<ObjectData> objects) { this.objects = objects; } public SearchObjectsOutput withObjects(List<ObjectData> objects) { this.objects = objects; return this; } @JsonProperty("total") public Long getTotal() { return total; } @JsonProperty("total") public void setTotal(Long total) { this.total = total; } public SearchObjectsOutput withTotal(Long total) { this.total = total; return this; } @JsonProperty("search_time") public Long getSearchTime() { return searchTime; } @JsonProperty("search_time") public void setSearchTime(Long searchTime) { this.searchTime = searchTime; } public SearchObjectsOutput withSearchTime(Long searchTime) { this.searchTime = searchTime; return this; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperties(String name, Object value) { this.additionalProperties.put(name, value); } @Override public String toString() { return ((((((((((((("SearchObjectsOutput"+" [pagination=")+ pagination)+", sortingRules=")+ sortingRules)+", objects=")+ objects)+", total=")+ total)+", searchTime=")+ searchTime)+", additionalProperties=")+ additionalProperties)+"]"); } }
[ "rsutormin@lbl.gov" ]
rsutormin@lbl.gov
6a96c43abfd4c844d2288cc40519d23ca7317f37
5d5970fc35324fc99a67cb704d5f16454cccc148
/src/main/java/com/accenture/core/model/DataLayerException.java
452c10400ba7d52b5112955657066c4c19bd0289
[]
no_license
mjshoemake/HomeMgr
f635f778710631ecb1f15220bbfc0e006e8539be
f698cae04e18562a974a1d447952ca3544476f0d
refs/heads/master
2021-01-17T12:11:49.849651
2017-08-05T20:12:03
2017-08-06T12:17:23
15,365,404
0
0
null
null
null
null
UTF-8
Java
false
false
567
java
package com.accenture.core.model; /** * A DataLayerException is an CoreException used specifically for the * data access layer found in com.accenture.core.model. */ public class DataLayerException extends com.accenture.core.utils.CoreException { /** * Constructor. * * @param s */ public DataLayerException(String s) { super(s); } /** * Constructor. * * @param s * @param e */ public DataLayerException(String s, java.lang.Exception e) { super(s, e); } }
[ "Dad@SHOEMAKE-MAC-MINI.local" ]
Dad@SHOEMAKE-MAC-MINI.local
58214b7fee3d42102deb91be9aa6c12ca11b1a52
72a4469db6613c18a7518898aa7186a932b59cf0
/tinitron-forwarding/src/main/java/cf/infinitus/tinitron/forwarding/controller/ForwardingController.java
78b71ea2ca7cae6b58ef4cc09d502b8caf0d6052
[]
no_license
handeArpakus/Tinitron
a34cc93badb42248743b3fa9aca2528058ad4843
5c88cee79a2460fcfba5268bc79c8788fe8cc870
refs/heads/master
2022-07-04T03:18:21.002810
2020-05-11T16:25:31
2020-05-11T16:25:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,493
java
package cf.infinitus.tinitron.forwarding.controller; import cf.infinitus.tinitron.forwarding.model.Link; import cf.infinitus.tinitron.forwarding.service.ForwardingService; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; import java.net.URI; import static org.springframework.http.HttpStatus.NOT_FOUND; @Slf4j @RestController public class ForwardingController { private final ForwardingService forwardingService; public ForwardingController(ForwardingService forwardingService) { this.forwardingService = forwardingService; } @GetMapping("{shortURL}") public ResponseEntity<?> forward(@PathVariable String shortURL) { Link link = forwardingService.forward(shortURL); if (link == null) { throw new ResponseStatusException(NOT_FOUND, "The page you’re looking for can’t be found."); } HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setLocation(URI.create(link.getOriginalURL())); return new ResponseEntity<>(httpHeaders, HttpStatus.FOUND); // TODO: Update stats // TODO: Add password checker } }
[ "zeyneppp283@gmail.com" ]
zeyneppp283@gmail.com
8407fb7d0ca93c01e96d2ac1e65d75f6e8fce733
5037417cbde6677e3f7fe82b4c1dba28f521f8ca
/SMSApplication/app/src/androidTest/java/com/example/smsapplication/ExampleInstrumentedTest.java
47fca681fff29f359a3b4b7128c40729cfd5cc8a
[]
no_license
Hamza-Alam/SMSApplication
6298aa99879204fac09a32c98f0220fa62f61ab3
1c88f6f6ca69a9dacddc5896382439c236dc3787
refs/heads/master
2022-11-18T12:51:45.737184
2020-07-07T17:14:40
2020-07-07T17:14:40
244,666,586
0
0
null
null
null
null
UTF-8
Java
false
false
723
java
package com.example.smsapplication; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.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() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.smsapplication", appContext.getPackageName()); } }
[ "hamzaalam@linknbit.com" ]
hamzaalam@linknbit.com
762806e04aad4a5e46421fd5ae3cccf30e45c988
b94c1efa3606c0457354784498aeb886214a8f2d
/Book.java
6116778793fec46349884222175f90ddecc95606
[]
no_license
Rayivh/Chapter4-GIT
c1a56cc69385ec7d8aecbb03b5d837a42b8c0562
02267ace5826433dde1b1a8c3ac921e01c76458c
refs/heads/master
2021-08-08T06:55:32.229357
2017-11-09T20:10:02
2017-11-09T20:10:02
110,161,149
0
0
null
null
null
null
UTF-8
Java
false
false
457
java
public class Book { // instance variables - replace the example below with your own private Author bookAuthor; private String title; /** * Constructor for objects of class Book */ public Book(Author a, String tl) { // initialise instance variables this.bookAuthor = a; this.title = tl; } public String toString() { return "The book title is" + this.title + bookAuthor; } }
[ "rayivh@gmail.com" ]
rayivh@gmail.com
ed5c6f4c2a037cb047d7cb201959cb5d49df0434
89d57fdcb7d0065514263e2d50f196983713133c
/services/guest-service/guest-service-backend/src/test/java/de/m1well/spring/course/guestservice/api/service/GuestServiceTest.java
9b3252c926504a1524c4cc9f9097b66701f401fc
[]
no_license
m1well/java-spring-course-afterwork
3ea7bcb712422e370512c1d1b6a0f95e87c15de0
c8e8a7843fc4c7b0d1239cc39c7ae328051ccdb0
refs/heads/master
2021-07-04T00:14:37.497117
2017-09-25T17:25:46
2017-09-25T17:27:46
104,451,809
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package de.m1well.spring.course.guestservice.api.service; /** * author: Michael Wellner<br/> * date: 23.09.17<br/> */ public class GuestServiceTest { }
[ "michaelwellner@gmx.de" ]
michaelwellner@gmx.de
0da1113ee629fcc783212d371a6d116abbbdffba
b1a875643f6d43f8a0e5abe6c4a64db0cad8baf5
/src/test/java/org/clubrockisen/dao/mysql/MySQLTest.java
047473c5a2c3662723155aee57677aa055474a15
[]
no_license
Club-Rock-ISEN/EntryManager
8a05214b6b45bf17e658724776c0e78723a570b0
c0458e3ad04ee59f5e2390230c690fb691853b60
refs/heads/master
2020-05-31T15:13:50.706846
2015-07-21T20:28:37
2015-07-21T20:28:37
10,853,358
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package org.clubrockisen.dao.mysql; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; /** * Test suite for the package org.clubrockisen.dao.mysql * @author Alex */ @RunWith(Suite.class) @SuiteClasses({ MySQLParameterDAOTest.class, MySQLEntryMemberPartyDAOTest.class }) public class MySQLTest { }
[ "alexbarfety@free.fr" ]
alexbarfety@free.fr
f7e1ef25715d26483d881bec47d56b5486a58c00
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/smallest/346b1d3c1cdc3032d07222a8a5e0027a2abf95bb1697b9d367d7cca7db1af769d8298e232c56471a122f05e87e79f4bd965855c9c0f8b173ebc0ef5d0abebc7b/002/mutations/129/smallest_346b1d3c_002.java
99685ce42773005f69ed7f16e0648f27caa61730
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_346b1d3c_002 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_346b1d3c_002 mainClass = new smallest_346b1d3c_002 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj a = new IntObj (), b = new IntObj (), c = new IntObj (), d = new IntObj (), num_1 = new IntObj (), num_2 = new IntObj (), num_3 = new IntObj (), num_4 = new IntObj (); output += (String.format ("Please enter 4 numbers seperated by spaces > ")); num_1.value = scanner.nextInt (); num_2.value = scanner.nextInt (); num_3.value = scanner.nextInt (); num_4.value = scanner.nextInt (); a.value = (num_1.value); b.value = (num_2.value); c.value = (num_3.value); d.value = (num_4.value); if ((d.value) < (b.value) && a.value < d.value) { output += (String.format ("%d is the smallest\n", a.value)); } else if (b.value < a.value && b.value < c.value && b.value < d.value) { output += (String.format ("%d is the smalles\n", b.value)); } else if (c.value < a.value && c.value < b.value && c.value < d.value) { output += (String.format ("%d is the smallest\n", c.value)); } else if (d.value < a.value && d.value < b.value && d.value < c.value) { output += (String.format ("%d is the smallest\n", d.value)); } if (true) return;; } }
[ "justinwm@163.com" ]
justinwm@163.com
bd65170bb0d114df5e6e5069f862d6136d2930b2
2b522789a235f626561cfa42ad8f0f35b589318f
/App/app/src/main/java/com/example/jingbin/app/stickview/ptr/PtrFrameLayout.java
2c7dff47f4944a60e6eb8818bf79172db8ccf789
[]
no_license
rohitnotes/StickViewLayout
b3be42d660e0dcb803652b6396f5e4837a829dd5
fc41a18290ff0e82bc713d44fa32f0ca4b5b8998
refs/heads/master
2022-03-16T08:47:21.316173
2019-11-12T09:35:08
2019-11-12T09:35:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
33,541
java
package com.example.jingbin.app.stickview.ptr; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.widget.Scroller; import android.widget.TextView; import com.example.jingbin.app.R; /** * This layout view for "Pull to Refresh(Ptr)" support all of the view, you can contain everything you want. * support: pull to refresh / release to refresh / auto refresh / keep header view while refreshing / hide header view while refreshing * It defines {@link }, which allows you customize the UI easily. */ public class PtrFrameLayout extends ViewGroup { // status enum public final static byte PTR_STATUS_INIT = 1; private byte mStatus = PTR_STATUS_INIT; public final static byte PTR_STATUS_PREPARE = 2; public final static byte PTR_STATUS_LOADING = 3; public final static byte PTR_STATUS_COMPLETE = 4; private static final boolean DEBUG_LAYOUT = true; public static boolean DEBUG = false; private static int ID = 1; protected final String LOG_TAG = "ptr-frame-" + ++ID; // auto refresh status private static byte FLAG_AUTO_REFRESH_AT_ONCE = 0x01; private static byte FLAG_AUTO_REFRESH_BUT_LATER = 0x01 << 1; private static byte FLAG_ENABLE_NEXT_PTR_AT_ONCE = 0x01 << 2; private static byte FLAG_PIN_CONTENT = 0x01 << 3; private static byte MASK_AUTO_REFRESH = 0x03; protected View mContent; // optional config for define header and content in xml file private int mHeaderId = 0; private int mContainerId = 0; // config private int mDurationToClose = 200; private int mDurationToCloseHeader = 1000; private boolean mKeepHeaderWhenRefresh = true; private boolean mPullToRefresh = false; private View mHeaderView; private PtrUIHandlerHolder mPtrUIHandlerHolder = PtrUIHandlerHolder.create(); private PtrHandler mPtrHandler; // working parameters private ScrollChecker mScrollChecker; private int mPagingTouchSlop; private int mHeaderHeight; private boolean mDisableWhenHorizontalMove = false; private int mFlag = 0x00; // disable when detect moving horizontally private boolean mPreventForHorizontal = false; private MotionEvent mLastMoveEvent; private PtrUIHandlerHook mRefreshCompleteHook; private int mLoadingMinTime = 500; private long mLoadingStartTime = 0; private PtrIndicator mPtrIndicator; private boolean mHasSendCancelEvent = false; private Runnable mPerformRefreshCompleteDelay = new Runnable() { @Override public void run() { performRefreshComplete(); } }; public PtrFrameLayout(Context context) { this(context, null); } public PtrFrameLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public PtrFrameLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mPtrIndicator = new PtrIndicator(); TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.PtrFrameLayout, 0, 0); if (arr != null) { mHeaderId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_header, mHeaderId); mContainerId = arr.getResourceId(R.styleable.PtrFrameLayout_ptr_content, mContainerId); mPtrIndicator.setResistance( arr.getFloat(R.styleable.PtrFrameLayout_ptr_resistance, mPtrIndicator.getResistance())); mDurationToClose = arr.getInt(R.styleable.PtrFrameLayout_ptr_duration_to_close, mDurationToClose); mDurationToCloseHeader = arr.getInt(R.styleable.PtrFrameLayout_ptr_duration_to_close_header, mDurationToCloseHeader); float ratio = mPtrIndicator.getRatioOfHeaderToHeightRefresh(); ratio = arr.getFloat(R.styleable.PtrFrameLayout_ptr_ratio_of_header_height_to_refresh, ratio); mPtrIndicator.setRatioOfHeaderHeightToRefresh(ratio); mKeepHeaderWhenRefresh = arr.getBoolean(R.styleable.PtrFrameLayout_ptr_keep_header_when_refresh, mKeepHeaderWhenRefresh); mPullToRefresh = arr.getBoolean(R.styleable.PtrFrameLayout_ptr_pull_to_fresh, mPullToRefresh); arr.recycle(); } mScrollChecker = new ScrollChecker(); final ViewConfiguration conf = ViewConfiguration.get(getContext()); mPagingTouchSlop = conf.getScaledTouchSlop() * 2; } @Override protected void onFinishInflate() { final int childCount = getChildCount(); if (childCount > 2) { throw new IllegalStateException("PtrFrameLayout only can host 2 elements"); } else if (childCount == 2) { if (mHeaderId != 0 && mHeaderView == null) { mHeaderView = findViewById(mHeaderId); } if (mContainerId != 0 && mContent == null) { mContent = findViewById(mContainerId); } // not specify header or content if (mContent == null || mHeaderView == null) { View child1 = getChildAt(0); View child2 = getChildAt(1); if (child1 instanceof PtrUIHandler) { mHeaderView = child1; mContent = child2; } else if (child2 instanceof PtrUIHandler) { mHeaderView = child2; mContent = child1; } else { // both are not specified if (mContent == null && mHeaderView == null) { mHeaderView = child1; mContent = child2; } // only one is specified else { if (mHeaderView == null) { mHeaderView = mContent == child1 ? child2 : child1; } else { mContent = mHeaderView == child1 ? child2 : child1; } } } } } else if (childCount == 1) { mContent = getChildAt(0); } else { TextView errorView = new TextView(getContext()); errorView.setClickable(true); errorView.setTextColor(0xffff6600); errorView.setGravity(Gravity.CENTER); errorView.setTextSize(20); errorView.setText("The content view in PtrFrameLayout is empty. Do you forget to specify its id in xml layout file?"); mContent = errorView; addView(mContent); } if (mHeaderView != null) { mHeaderView.bringToFront(); } super.onFinishInflate(); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); if (mScrollChecker != null) { mScrollChecker.destroy(); } if (mPerformRefreshCompleteDelay != null) { removeCallbacks(mPerformRefreshCompleteDelay); } } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (DEBUG && DEBUG_LAYOUT) { // PtrCLog.d(LOG_TAG, "onMeasure frame: width: %s, height: %s, padding: %s %s %s %s", // getMeasuredHeight(), getMeasuredWidth(), // getPaddingLeft(), getPaddingRight(), getPaddingTop(), getPaddingBottom()); } if (mHeaderView != null) { measureChildWithMargins(mHeaderView, widthMeasureSpec, 0, heightMeasureSpec, 0); MarginLayoutParams lp = (MarginLayoutParams) mHeaderView.getLayoutParams(); mHeaderHeight = mHeaderView.getMeasuredHeight() + lp.topMargin + lp.bottomMargin; mPtrIndicator.setHeaderHeight(mHeaderHeight); } if (mContent != null) { measureContentView(mContent, widthMeasureSpec, heightMeasureSpec); if (DEBUG && DEBUG_LAYOUT) { // ViewGroup.MarginLayoutParams lp = (MarginLayoutParams) mContent.getLayoutParams(); // PtrCLog.d(LOG_TAG, "onMeasure content, width: %s, height: %s, margin: %s %s %s %s", // getMeasuredWidth(), getMeasuredHeight(), // lp.leftMargin, lp.topMargin, lp.rightMargin, lp.bottomMargin); // PtrCLog.d(LOG_TAG, "onMeasure, currentPos: %s, lastPos: %s, top: %s", // mPtrIndicator.getCurrentPosY(), mPtrIndicator.getLastPosY(), mContent.getTop()); } } } private void measureContentView(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams(); final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight() + lp.leftMargin + lp.rightMargin, lp.width); final int childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec, getPaddingTop() + getPaddingBottom() + lp.topMargin, lp.height); child.measure(childWidthMeasureSpec, childHeightMeasureSpec); } @Override protected void onLayout(boolean flag, int i, int j, int k, int l) { layoutChildren(); } private void layoutChildren() { int offsetX = mPtrIndicator.getCurrentPosY(); int paddingLeft = getPaddingLeft(); int paddingTop = getPaddingTop(); if (mHeaderView != null) { MarginLayoutParams lp = (MarginLayoutParams) mHeaderView.getLayoutParams(); final int left = paddingLeft + lp.leftMargin; final int top = paddingTop + lp.topMargin + offsetX - mHeaderHeight; final int right = left + mHeaderView.getMeasuredWidth(); final int bottom = top + mHeaderView.getMeasuredHeight(); mHeaderView.layout(left, top, right, bottom); } if (mContent != null) { if (isPinContent()) { offsetX = 0; } MarginLayoutParams lp = (MarginLayoutParams) mContent.getLayoutParams(); final int left = paddingLeft + lp.leftMargin; final int top = paddingTop + lp.topMargin + offsetX; final int right = left + mContent.getMeasuredWidth(); final int bottom = top + mContent.getMeasuredHeight(); mContent.layout(left, top, right, bottom); } } public boolean dispatchTouchEventSupper(MotionEvent e) { return super.dispatchTouchEvent(e); } @Override public boolean dispatchTouchEvent(MotionEvent e) { if (!isEnabled() || mContent == null || mHeaderView == null) { return dispatchTouchEventSupper(e); } int action = e.getAction(); switch (action) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mPtrIndicator.onRelease(); if (mPtrIndicator.hasLeftStartPosition()) { onRelease(false); if (mPtrIndicator.hasMovedAfterPressedDown()) { sendCancelEvent(); return true; } return dispatchTouchEventSupper(e); } else { return dispatchTouchEventSupper(e); } case MotionEvent.ACTION_DOWN: mHasSendCancelEvent = false; mPtrIndicator.onPressDown(e.getX(), e.getY()); mScrollChecker.abortIfWorking(); mPreventForHorizontal = false; // The cancel event will be sent once the position is moved. // So let the event pass to children. // fix #93, #102 dispatchTouchEventSupper(e); return true; case MotionEvent.ACTION_MOVE: mLastMoveEvent = e; mPtrIndicator.onMove(e.getX(), e.getY()); float offsetX = mPtrIndicator.getOffsetX(); float offsetY = mPtrIndicator.getOffsetY(); if (mDisableWhenHorizontalMove && !mPreventForHorizontal && (Math.abs(offsetX) > mPagingTouchSlop && Math.abs(offsetX) > Math.abs(offsetY))) { if (mPtrIndicator.isInStartPosition()) { mPreventForHorizontal = true; } } if (mPreventForHorizontal) { return dispatchTouchEventSupper(e); } boolean moveDown = offsetY > 0; boolean moveUp = !moveDown; boolean canMoveUp = mPtrIndicator.hasLeftStartPosition(); if (DEBUG) { boolean canMoveDown = mPtrHandler != null && mPtrHandler.checkCanDoRefresh(this, mContent, mHeaderView); // PtrCLog.v(LOG_TAG, "ACTION_MOVE: offsetY:%s, currentPos: %s, moveUp: %s, canMoveUp: %s, moveDown: %s: canMoveDown: %s", offsetY, mPtrIndicator.getCurrentPosY(), moveUp, canMoveUp, moveDown, canMoveDown); } // disable move when header not reach top if (moveDown && mPtrHandler != null && !mPtrHandler.checkCanDoRefresh(this, mContent, mHeaderView)) { return dispatchTouchEventSupper(e); } if ((moveUp && canMoveUp) || moveDown) { movePos(offsetY/2);//下拉header布局的高度 return true; } } return dispatchTouchEventSupper(e); } /** * if deltaY > 0, move the content down * * @param deltaY */ private void movePos(float deltaY) { // has reached the top if ((deltaY < 0 && mPtrIndicator.isInStartPosition())) { if (DEBUG) { // PtrCLog.e(LOG_TAG, String.format("has reached the top")); } return; } int to = mPtrIndicator.getCurrentPosY() + (int) deltaY; // over top if (mPtrIndicator.willOverTop(to)) { to = PtrIndicator.POS_START; } mPtrIndicator.setCurrentPos(to); int change = to - mPtrIndicator.getLastPosY(); updatePos(change); } private void updatePos(int change) { if (change == 0) { return; } boolean isUnderTouch = mPtrIndicator.isUnderTouch(); // once moved, cancel event will be sent to child if (isUnderTouch && !mHasSendCancelEvent && mPtrIndicator.hasMovedAfterPressedDown()) { mHasSendCancelEvent = true; sendCancelEvent(); } // leave initiated position or just refresh complete if ((mPtrIndicator.hasJustLeftStartPosition() && mStatus == PTR_STATUS_INIT) || (mPtrIndicator.goDownCrossFinishPosition() && mStatus == PTR_STATUS_COMPLETE && isEnabledNextPtrAtOnce())) { mStatus = PTR_STATUS_PREPARE; mPtrUIHandlerHolder.onUIRefreshPrepare(this); } // back to initiated position if (mPtrIndicator.hasJustBackToStartPosition()) { tryToNotifyReset(); // recover event to children if (isUnderTouch) { sendDownEvent(); } } // Pull to Refresh if (mStatus == PTR_STATUS_PREPARE) { // reach fresh height while moving from top to bottom if (isUnderTouch && !isAutoRefresh() && mPullToRefresh && mPtrIndicator.crossRefreshLineFromTopToBottom()) { tryToPerformRefresh(); } // reach header height while auto refresh if (performAutoRefreshButLater() && mPtrIndicator.hasJustReachedHeaderHeightFromTopToBottom()) { tryToPerformRefresh(); } } mHeaderView.offsetTopAndBottom(change); if (!isPinContent()) { mContent.offsetTopAndBottom(change); } invalidate(); if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIPositionChange(this, isUnderTouch, mStatus, mPtrIndicator); } onPositionChange(isUnderTouch, mStatus, mPtrIndicator); } protected void onPositionChange(boolean isInTouching, byte status, PtrIndicator mPtrIndicator) { } @SuppressWarnings("unused") public int getHeaderHeight() { return mHeaderHeight; } private void onRelease(boolean stayForLoading) { tryToPerformRefresh(); if (mStatus == PTR_STATUS_LOADING) { // keep header for fresh if (mKeepHeaderWhenRefresh) { // scroll header back if (mPtrIndicator.isOverOffsetToKeepHeaderWhileLoading() && !stayForLoading) { mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToKeepHeaderWhileLoading(), mDurationToClose); } else { // do nothing } } else { tryScrollBackToTopWhileLoading(); } } else { if (mStatus == PTR_STATUS_COMPLETE) { notifyUIRefreshComplete(false); } else { tryScrollBackToTopAbortRefresh(); } } } /** * please DO REMEMBER resume the hook * * @param hook */ public void setRefreshCompleteHook(PtrUIHandlerHook hook) { mRefreshCompleteHook = hook; hook.setResumeAction(new Runnable() { @Override public void run() { if (DEBUG) { // PtrCLog.d(LOG_TAG, "mRefreshCompleteHook resume."); } notifyUIRefreshComplete(true); } }); } /** * Scroll back to to if is not under touch */ private void tryScrollBackToTop() { if (!mPtrIndicator.isUnderTouch()) { mScrollChecker.tryToScrollTo(PtrIndicator.POS_START, mDurationToCloseHeader); } } /** * just make easier to understand */ private void tryScrollBackToTopWhileLoading() { tryScrollBackToTop(); } /** * just make easier to understand */ private void tryScrollBackToTopAfterComplete() { tryScrollBackToTop(); } /** * just make easier to understand */ private void tryScrollBackToTopAbortRefresh() { tryScrollBackToTop(); } private boolean tryToPerformRefresh() { if (mStatus != PTR_STATUS_PREPARE) { return false; } // if ((mPtrIndicator.isOverOffsetToKeepHeaderWhileLoading() && isAutoRefresh()) || mPtrIndicator.isOverOffsetToRefresh()) { mStatus = PTR_STATUS_LOADING; performRefresh(); } return false; } private void performRefresh() { mLoadingStartTime = System.currentTimeMillis(); if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIRefreshBegin(this); if (DEBUG) { // PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshBegin"); } } if (mPtrHandler != null) { mPtrHandler.onRefreshBegin(this); } } /** * If at the top and not in loading, reset */ private boolean tryToNotifyReset() { if ((mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE) && mPtrIndicator.isInStartPosition()) { if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIReset(this); if (DEBUG) { // PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIReset"); } } mStatus = PTR_STATUS_INIT; clearFlag(); return true; } return false; } protected void onPtrScrollAbort() { if (mPtrIndicator.hasLeftStartPosition() && isAutoRefresh()) { onRelease(true); } } protected void onPtrScrollFinish() { if (mPtrIndicator.hasLeftStartPosition() && isAutoRefresh()) { onRelease(true); } } /** * Detect whether is refreshing. * * @return */ public boolean isRefreshing() { return mStatus == PTR_STATUS_LOADING; } /** * Call this when data is loaded. * The UI will perform complete at once or after a delay, depends on the time elapsed is greater then {@link #mLoadingMinTime} or not. */ final public void refreshComplete() { if (mRefreshCompleteHook != null) { mRefreshCompleteHook.reset(); } int delay = (int) (mLoadingMinTime - (System.currentTimeMillis() - mLoadingStartTime)); if (delay <= 0) { performRefreshComplete(); } else { postDelayed(mPerformRefreshCompleteDelay, delay); } } /** * Do refresh complete work when time elapsed is greater than {@link #mLoadingMinTime} */ private void performRefreshComplete() { mStatus = PTR_STATUS_COMPLETE; // if is auto refresh do nothing, wait scroller stop if (mScrollChecker.mIsRunning && isAutoRefresh()) { // do nothing if (DEBUG) { // PtrCLog.d(LOG_TAG, "performRefreshComplete do nothing, scrolling: %s, auto refresh: %s", // mScrollChecker.mIsRunning, mFlag); } return; } notifyUIRefreshComplete(false); } /** * Do real refresh work. If there is a hook, execute the hook first. * * @param ignoreHook */ private void notifyUIRefreshComplete(boolean ignoreHook) { /** * After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook. */ if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) { mRefreshCompleteHook.takeOver(); return; } if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIRefreshComplete(this); } mPtrIndicator.onUIRefreshComplete(); tryScrollBackToTopAfterComplete(); tryToNotifyReset(); } public void autoRefresh() { autoRefresh(true, mDurationToCloseHeader); } public void autoRefresh(boolean atOnce) { autoRefresh(atOnce, mDurationToCloseHeader); } private void clearFlag() { // remove auto fresh flag mFlag = mFlag & ~MASK_AUTO_REFRESH; } public void autoRefresh(boolean atOnce, int duration) { if (mStatus != PTR_STATUS_INIT) { return; } mFlag |= atOnce ? FLAG_AUTO_REFRESH_AT_ONCE : FLAG_AUTO_REFRESH_BUT_LATER; mStatus = PTR_STATUS_PREPARE; if (mPtrUIHandlerHolder.hasHandler()) { mPtrUIHandlerHolder.onUIRefreshPrepare(this); if (DEBUG) { // PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag); } } mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToRefresh(), duration); if (atOnce) { mStatus = PTR_STATUS_LOADING; performRefresh(); } } public boolean isAutoRefresh() { return (mFlag & MASK_AUTO_REFRESH) > 0; } private boolean performAutoRefreshButLater() { return (mFlag & MASK_AUTO_REFRESH) == FLAG_AUTO_REFRESH_BUT_LATER; } public boolean isEnabledNextPtrAtOnce() { return (mFlag & FLAG_ENABLE_NEXT_PTR_AT_ONCE) > 0; } /** * If @param enable has been set to true. The user can perform next PTR at once. * * @param enable */ public void setEnabledNextPtrAtOnce(boolean enable) { if (enable) { mFlag = mFlag | FLAG_ENABLE_NEXT_PTR_AT_ONCE; } else { mFlag = mFlag & ~FLAG_ENABLE_NEXT_PTR_AT_ONCE; } } public boolean isPinContent() { return (mFlag & FLAG_PIN_CONTENT) > 0; } /** * The content view will now move when {@param pinContent} set to true. * * @param pinContent */ public void setPinContent(boolean pinContent) { if (pinContent) { mFlag = mFlag | FLAG_PIN_CONTENT; } else { mFlag = mFlag & ~FLAG_PIN_CONTENT; } } /** * It's useful when working with viewpager. * * @param disable */ public void disableWhenHorizontalMove(boolean disable) { mDisableWhenHorizontalMove = disable; } /** * loading will last at least for so long * * @param time */ public void setLoadingMinTime(int time) { mLoadingMinTime = time; } /** * Not necessary any longer. Once moved, cancel event will be sent to child. * * @param yes */ @Deprecated public void setInterceptEventWhileWorking(boolean yes) { } @SuppressWarnings({"unused"}) public View getContentView() { return mContent; } public void setPtrHandler(PtrHandler ptrHandler) { mPtrHandler = ptrHandler; } public void addPtrUIHandler(PtrUIHandler ptrUIHandler) { PtrUIHandlerHolder.addHandler(mPtrUIHandlerHolder, ptrUIHandler); } @SuppressWarnings({"unused"}) public void removePtrUIHandler(PtrUIHandler ptrUIHandler) { mPtrUIHandlerHolder = PtrUIHandlerHolder.removeHandler(mPtrUIHandlerHolder, ptrUIHandler); } public void setPtrIndicator(PtrIndicator slider) { if (mPtrIndicator != null && mPtrIndicator != slider) { slider.convertFrom(mPtrIndicator); } mPtrIndicator = slider; } @SuppressWarnings({"unused"}) public float getResistance() { return mPtrIndicator.getResistance(); } public void setResistance(float resistance) { mPtrIndicator.setResistance(resistance); } @SuppressWarnings({"unused"}) public float getDurationToClose() { return mDurationToClose; } /** * The duration to return back to the refresh position * * @param duration */ public void setDurationToClose(int duration) { mDurationToClose = duration; } @SuppressWarnings({"unused"}) public long getDurationToCloseHeader() { return mDurationToCloseHeader; } /** * The duration to close time * * @param duration */ public void setDurationToCloseHeader(int duration) { mDurationToCloseHeader = duration; } public void setRatioOfHeaderHeightToRefresh(float ratio) { mPtrIndicator.setRatioOfHeaderHeightToRefresh(ratio); } public int getOffsetToRefresh() { return mPtrIndicator.getOffsetToRefresh(); } @SuppressWarnings({"unused"}) public void setOffsetToRefresh(int offset) { mPtrIndicator.setOffsetToRefresh(offset); } @SuppressWarnings({"unused"}) public float getRatioOfHeaderToHeightRefresh() { return mPtrIndicator.getRatioOfHeaderToHeightRefresh(); } @SuppressWarnings({"unused"}) public int getOffsetToKeepHeaderWhileLoading() { return mPtrIndicator.getOffsetToKeepHeaderWhileLoading(); } @SuppressWarnings({"unused"}) public void setOffsetToKeepHeaderWhileLoading(int offset) { mPtrIndicator.setOffsetToKeepHeaderWhileLoading(offset); } @SuppressWarnings({"unused"}) public boolean isKeepHeaderWhenRefresh() { return mKeepHeaderWhenRefresh; } public void setKeepHeaderWhenRefresh(boolean keepOrNot) { mKeepHeaderWhenRefresh = keepOrNot; } public boolean isPullToRefresh() { return mPullToRefresh; } public void setPullToRefresh(boolean pullToRefresh) { mPullToRefresh = pullToRefresh; } @SuppressWarnings({"unused"}) public View getHeaderView() { return mHeaderView; } public void setHeaderView(View header) { if (mHeaderView != null && header != null && mHeaderView != header) { removeView(mHeaderView); } ViewGroup.LayoutParams lp = header.getLayoutParams(); if (lp == null) { lp = new LayoutParams(-1, -2); header.setLayoutParams(lp); } mHeaderView = header; addView(header); } @Override protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { return p instanceof LayoutParams; } @Override protected ViewGroup.LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } @Override protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return new LayoutParams(p); } @Override public ViewGroup.LayoutParams generateLayoutParams(AttributeSet attrs) { return new LayoutParams(getContext(), attrs); } private void sendCancelEvent() { if (DEBUG) { // PtrCLog.d(LOG_TAG, "send cancel event"); } // The ScrollChecker will update position and lead to send cancel event when mLastMoveEvent is null. // fix #104, #80, #92 if (mLastMoveEvent == null) { return; } MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime() + ViewConfiguration.getLongPressTimeout(), MotionEvent.ACTION_CANCEL, last.getX(), last.getY(), last.getMetaState()); dispatchTouchEventSupper(e); } private void sendDownEvent() { if (DEBUG) { // PtrCLog.d(LOG_TAG, "send down event"); } final MotionEvent last = mLastMoveEvent; MotionEvent e = MotionEvent.obtain(last.getDownTime(), last.getEventTime(), MotionEvent.ACTION_DOWN, last.getX(), last.getY(), last.getMetaState()); dispatchTouchEventSupper(e); } public static class LayoutParams extends MarginLayoutParams { public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); } public LayoutParams(int width, int height) { super(width, height); } @SuppressWarnings({"unused"}) public LayoutParams(MarginLayoutParams source) { super(source); } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } class ScrollChecker implements Runnable { private int mLastFlingY; private Scroller mScroller; private boolean mIsRunning = false; private int mStart; private int mTo; public ScrollChecker() { mScroller = new Scroller(getContext()); } public void run() { boolean finish = !mScroller.computeScrollOffset() || mScroller.isFinished(); int curY = mScroller.getCurrY(); int deltaY = curY - mLastFlingY; if (DEBUG) { if (deltaY != 0) { // PtrCLog.v(LOG_TAG, // "scroll: %s, start: %s, to: %s, currentPos: %s, current :%s, last: %s, delta: %s", // finish, mStart, mTo, mPtrIndicator.getCurrentPosY(), curY, mLastFlingY, deltaY); } } if (!finish) { mLastFlingY = curY; movePos(deltaY); post(this); } else { finish(); } } private void finish() { if (DEBUG) { // PtrCLog.v(LOG_TAG, "finish, currentPos:%s", mPtrIndicator.getCurrentPosY()); } reset(); onPtrScrollFinish(); } private void reset() { mIsRunning = false; mLastFlingY = 0; removeCallbacks(this); } private void destroy() { reset(); if (!mScroller.isFinished()) { mScroller.forceFinished(true); } } public void abortIfWorking() { if (mIsRunning) { if (!mScroller.isFinished()) { mScroller.forceFinished(true); } onPtrScrollAbort(); reset(); } } public void tryToScrollTo(int to, int duration) { if (mPtrIndicator.isAlreadyHere(to)) { return; } mStart = mPtrIndicator.getCurrentPosY(); mTo = to; int distance = to - mStart; if (DEBUG) { // PtrCLog.d(LOG_TAG, "tryToScrollTo: start: %s, distance:%s, to:%s", mStart, distance, to); } removeCallbacks(this); mLastFlingY = 0; // fix #47: Scroller should be reused, https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh/issues/47 if (!mScroller.isFinished()) { mScroller.forceFinished(true); } mScroller.startScroll(0, 0, 0, distance, duration); post(this); mIsRunning = true; } } }
[ "770413277@qq.com" ]
770413277@qq.com
a9f7709af29fa14838a54c87ad88f38e77ecad3e
ff1bebed20fff6889bdee0c7b90514bac7a0485d
/leetcode/127. Word Ladder/Solution_127_WordLadder.java
550afb3a84cdf2bf72577dfd3edd61b100a5a807
[]
no_license
seunghyukshin/study-note-algorithm
37e35ff9d0709f413f068ed54b50a7084653d2e1
6f3b0cfe16cd9a7603d90f8fbcd819392e6632ac
refs/heads/master
2022-10-23T05:35:16.957634
2022-10-09T02:34:19
2022-10-09T02:34:19
211,318,089
1
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
import java.util.*; public class Solution_127_WordLadder { public class Word { String s; int length; public Word(String s, int length) { super(); this.s = s; this.length = length; } @Override public String toString() { return "Word [s=" + s + ", length=" + length + "]"; } } public static void main(String[] args) { Solution_127_WordLadder sol = new Solution_127_WordLadder(); String beginWord = "hit"; String endWord = "cog"; String[] wordArray = { "hot", "dot", "dog", "lot", "log" }; List<String> wordList = Arrays.asList(wordArray); System.out.println(sol.ladderLength(beginWord, endWord, wordList)); } public int ladderLength(String beginWord, String endWord, List<String> wordList) { Queue<Word> queue = new LinkedList<>(); queue.add(new Word(beginWord, 1)); int min = Integer.MAX_VALUE; boolean[] visit = new boolean[wordList.size()]; while (!queue.isEmpty()) { Word w = queue.poll(); // System.out.println(w); if (w.length > min) break; for (int i = 0; i < wordList.size(); i++) { if (!visit[i] && isDistanceOne(w.s, wordList.get(i))) { if (wordList.get(i).equals(endWord)) { return w.length + 1; } else { visit[i] = true; queue.add(new Word(wordList.get(i), w.length + 1)); } } } } // return min == Integer.MAX_VALUE ? 0 : min; return 0; } private boolean isDistanceOne(String s1, String s2) { boolean flag = true; int count = 0; for (int i = 0; i < s1.length(); i++) { if (s1.charAt(i) != s2.charAt(i)) { count++; if (count >= 2) { flag = false; break; } } } return flag && count == 1; } }
[ "auseunghyuk@gmail.com" ]
auseunghyuk@gmail.com
ffe732c9d48a99387a3bae071c2a6d4566993cd0
c98f2853860f58c5f4738144ad33ddc94d20ae69
/src/Entities/ChiTietDonHang.java
26e85e221e88f02091e73022b85a7ddfbdf5a929
[]
no_license
VanKhanh1011/Web-Ban-My-Pham
617eb99e92631213e6ae25054e330dc6fdb15c83
a5a92203d5350bd7290016cd936cb597f7d02b20
refs/heads/master
2023-02-04T19:06:38.800372
2020-12-24T09:09:23
2020-12-24T09:09:23
324,113,845
0
0
null
null
null
null
UTF-8
Java
false
false
3,804
java
package Entities; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlRootElement; @Entity @Table(name = "ChiTietDonHang") @XmlRootElement @NamedQueries({ @NamedQuery(name = "ChiTietDonHang.findAll", query = "SELECT c FROM ChiTietDonHang c"), @NamedQuery(name = "ChiTietDonHang.findByMaChiTietDh", query = "SELECT c FROM ChiTietDonHang c WHERE c.maChiTietDh = :maChiTietDh"), @NamedQuery(name = "ChiTietDonHang.findBySoLuong", query = "SELECT c FROM ChiTietDonHang c WHERE c.soLuong = :soLuong"), @NamedQuery(name = "ChiTietDonHang.findByGiaTien", query = "SELECT c FROM ChiTietDonHang c WHERE c.giaTien = :giaTien"), @NamedQuery(name = "ChiTietDonHang.findByTrangThai", query = "SELECT c FROM ChiTietDonHang c WHERE c.trangThai = :trangThai")}) public class ChiTietDonHang implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "MaChiTietDh") private Integer maChiTietDh; @Column(name = "SoLuong") private Integer soLuong; // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation @Column(name = "GiaTien") private Double giaTien; @Column(name = "TrangThai") private Boolean trangThai; @JoinColumn(name = "MaDh", referencedColumnName = "MaDh") @ManyToOne private DonHang maDh; @JoinColumn(name = "MaSp", referencedColumnName = "MaSp") @ManyToOne private SanPham maSp; public ChiTietDonHang() { } public ChiTietDonHang(Integer maChiTietDh) { this.maChiTietDh = maChiTietDh; } public Integer getMaChiTietDh() { return maChiTietDh; } public void setMaChiTietDh(Integer maChiTietDh) { this.maChiTietDh = maChiTietDh; } public Integer getSoLuong() { return soLuong; } public void setSoLuong(Integer soLuong) { this.soLuong = soLuong; } public Double getGiaTien() { return giaTien; } public void setGiaTien(Double giaTien) { this.giaTien = giaTien; } public Boolean getTrangThai() { return trangThai; } public void setTrangThai(Boolean trangThai) { this.trangThai = trangThai; } public DonHang getMaDh() { return maDh; } public void setMaDh(DonHang maDh) { this.maDh = maDh; } public SanPham getMaSp() { return maSp; } public void setMaSp(SanPham maSp) { this.maSp = maSp; } @Override public int hashCode() { int hash = 0; hash += (maChiTietDh != null ? maChiTietDh.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ChiTietDonHang)) { return false; } ChiTietDonHang other = (ChiTietDonHang) object; if ((this.maChiTietDh == null && other.maChiTietDh != null) || (this.maChiTietDh != null && !this.maChiTietDh.equals(other.maChiTietDh))) { return false; } return true; } @Override public String toString() { return "Entities.ChiTietDonHang[ maChiTietDh=" + maChiTietDh + " ]"; } }
[ "nhoxkun94@gmail.com" ]
nhoxkun94@gmail.com
81e0553b4c0dc376855deb33a2f3396d7df7454e
e9d1fad8c4099c16df6c9b39a438ff8653ae1564
/app/src/main/java/com/samirk433/quotebook/model/Constant.java
e68fc767ab8110a9478530fa39697a96deb626ba
[]
no_license
meyasir/QuotBook-II
b6ef6df5743bee31b8abf1524dce52d05c76041f
50bba0ce359bc2b720c6df871540590f0993e29a
refs/heads/master
2020-03-12T21:38:49.836005
2018-05-28T18:45:31
2018-05-28T18:45:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
813
java
package com.samirk433.quotebook.model; public class Constant { public static String APP_URL = "https://play.google.com/store/apps/details?id=com.eajy.materialdesigndemo"; private static String DESIGNED_BY = "Designed by Sky developers"; public static String SHARE_CONTENT = "A beautiful app designed with Material Design:\n" + APP_URL + "\n- " + DESIGNED_BY; public static String EMAIL = "mailto:muhammadyasir.2551@gmail.com"; public static String GIT_HUB = "https://github.com"; public static String CHANNEL_ID = null; public static int notification_id = 0; public static String MATERIAL_DESIGN_COLOR_URL = "https://play.google.com/store/apps/details?id=com.eajy.materialdesigncolor"; public static String MATERIAL_DESIGN_COLOR_PACKAGE = "com.eajy.materialdesigncolor"; }
[ "muhammmadyasir.2551@gmail.com" ]
muhammmadyasir.2551@gmail.com
9339255ba5f30c0de499154964c30fa710cc3074
a1b688f11357f9a8c3111a131d17e4de51baaf02
/Tictactoe/app/src/main/java/zzvanhai81/gmail/com/tictactoe/MainActivity.java
eeac0458a05f8fcbe956a51899da92243dc37298
[]
no_license
VanHai88/Anroid
dd453eafff5546f4fd77520ba396b929fdb7e38f
33adccb637b114cced7fc28a6a5bd62d91a6ac98
refs/heads/master
2020-08-04T06:00:35.135949
2019-10-01T06:59:05
2019-10-01T06:59:05
212,030,842
0
0
null
null
null
null
UTF-8
Java
false
false
4,556
java
package zzvanhai81.gmail.com.tictactoe; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button[][] buttons = new Button[3][3]; private boolean player1Turn = true; private int roundCount; private int player1Points; private int player2Points; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { String buttonID = "button_" + i + j; int resID = getResources().getIdentifier(buttonID, "id", getPackageName()); buttons[i][j] = findViewById(resID); buttons[i][j].setOnClickListener(this); } } Button buttonReset = findViewById(R.id.button_newgame); buttonReset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { newGame(); } }); } @Override public void onClick(View v) { if (!((Button) v).getText().toString().equals("")) { return; } if (player1Turn) { ((Button) v).setText("X"); } else { ((Button) v).setText("O"); } roundCount++; if (checkForWin()) { if (player1Turn) { player1Wins(); } else { player2Wins(); } } else if (roundCount == 9) { draw(); } else { player1Turn = !player1Turn; } } private boolean checkForWin() { String[][] field = new String[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { field[i][j] = buttons[i][j].getText().toString(); } } for (int i = 0; i < 3; i++) { if (field[i][0].equals(field[i][1]) && field[i][0].equals(field[i][2]) && !field[i][0].equals("")) { return true; } } for (int i = 0; i < 3; i++) { if (field[0][i].equals(field[1][i]) && field[0][i].equals(field[2][i]) && !field[0][i].equals("")) { return true; } } if (field[0][0].equals(field[1][1]) && field[0][0].equals(field[2][2]) && !field[0][0].equals("")) { return true; } if (field[0][2].equals(field[1][1]) && field[0][2].equals(field[2][0]) && !field[0][2].equals("")) { return true; } return false; } private void player1Wins() { player1Points++; Toast.makeText(this, "Player 1 wins!", Toast.LENGTH_SHORT).show(); resetBoard(); } private void player2Wins() { player2Points++; Toast.makeText(this, "Player 2 wins!", Toast.LENGTH_SHORT).show(); resetBoard(); } private void draw() { Toast.makeText(this, "Draw!", Toast.LENGTH_SHORT).show(); resetBoard(); } private void resetBoard() { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { buttons[i][j].setText(""); } } roundCount = 0; player1Turn = true; } public void newGame(){ player1Points = 0; player2Points = 0; resetBoard(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("roundCount", roundCount); outState.putInt("player1Points", player1Points); outState.putInt("player2Points", player2Points); outState.putBoolean("player1Turn", player1Turn); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); roundCount = savedInstanceState.getInt("roundCount"); player1Points = savedInstanceState.getInt("player1Points"); player2Points = savedInstanceState.getInt("player2Points"); player1Turn = savedInstanceState.getBoolean("player1Turn"); } }
[ "zzvanhai81@gmail.com" ]
zzvanhai81@gmail.com
0a84b13468ed8d67a4058f29a5d58ccd48cd7cf5
4e04a2425ac0e1dff84f02b5ed0d01a020220ebd
/24-Swap-Nodes-in-Pairs/24. Swap Nodes in Pairs.java
004ccd68a3551e11f262d9d62e3fbaa05f527bd1
[]
no_license
HannibalCJH/Leetcode
13bd063bd49523899ffdaaa84843777113ab2261
0eda636b9aeb5b0ada1ed029175ae8b7d26b1b13
refs/heads/master
2020-05-21T14:58:49.946216
2016-09-17T20:32:37
2016-09-17T20:32:37
64,083,898
0
0
null
null
null
null
UTF-8
Java
false
false
951
java
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class Solution { // 我的算法 public ListNode swapPairs(ListNode head) { if(head == null || head.next == null) return head; ListNode dummy = new ListNode(-1); ListNode preNode = dummy; // 交换 while(head != null && head.next != null) { // 存第二个节点 ListNode temp = head.next; // 第一个节点指向第三个节点 head.next = temp.next; // 前驱节点指向第二个节点 preNode.next = temp; // 第二个节点指向第一个节点 temp.next = head; // 移到第三个节点进行下一步 preNode = head; head = head.next; } return dummy.next; } }
[ "hannibalcjh@gmail.com" ]
hannibalcjh@gmail.com
72f772230f0aca13382613497e5fc26d5828709c
eaca1aac2f678302f7521866a9a22b4b60184036
/app/src/main/java/com/example/Trainees/dataclass/NonScrollListView.java
e041cb8e3bcaef62799b434f5f0eed89643fb0fa
[]
no_license
Ndaigo/Trainees
944935f1da44dd39497308fb96118d8e69561b39
15b7e4f492c98e38d87a1fb6679054ca7aafed3e
refs/heads/main
2023-04-27T05:47:09.917740
2023-04-24T07:42:23
2023-04-24T07:42:23
318,152,244
0
0
null
null
null
null
UTF-8
Java
false
false
967
java
package com.example.Trainees.dataclass; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; public class NonScrollListView extends ListView { public NonScrollListView(Context context) { super(context); } public NonScrollListView(Context context, AttributeSet attrs) { super(context, attrs); } public NonScrollListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int heightMeasureSpec_custom = View.MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, View.MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); ViewGroup.LayoutParams params = getLayoutParams(); params.height = getMeasuredHeight(); } }
[ "tl181237@cis.fukuoka-u.ac.jp" ]
tl181237@cis.fukuoka-u.ac.jp
fb9bdab99ae034c2f618cdd4040f5620e8d05b5d
7fbb29124d8a8944bd76ff8a921d5e8a6273cf52
/src/main/java/com/future/function/qa/api/scoring/room/RoomAPI.java
d6c0747fabd25c82c8c399fb8f99bfebe3507ad0
[]
no_license
function-future/function-backend-qa
ad9d5aee45c18ccf2394dd3ffb051c0b646496cd
69acf1e9677be202cde30488bf7de4d5da1fdbfe
refs/heads/master
2021-07-09T02:07:15.785355
2020-02-10T12:44:12
2020-02-10T12:44:12
204,312,608
0
0
null
2020-10-13T15:45:41
2019-08-25T15:23:03
Java
UTF-8
Java
false
false
2,049
java
package com.future.function.qa.api.scoring.room; import com.future.function.qa.api.BaseAPI; import com.future.function.qa.model.request.scoring.room.RoomPointWebRequest; import com.future.function.qa.util.Path; import io.restassured.http.ContentType; import io.restassured.http.Cookie; import io.restassured.response.Response; import io.restassured.specification.RequestSpecification; import net.thucydides.core.annotations.Step; public class RoomAPI extends BaseAPI { public RequestSpecification prepare(String batchCode, String assignmentId, String studentId) { base = super.prepare() .basePath(String.format(Path.ROOM, batchCode, assignmentId, studentId)); return base; } @Step public Response getOrCreateRoom(Cookie cookie) { return doByCookiePresent(cookie, () -> getOrCreateWithCookie(cookie), this::getOrCreateWithoutCookie); } private Response getOrCreateWithCookie(Cookie cookie) { return base.cookie(cookie) .post(); } private Response getOrCreateWithoutCookie() { return base.post(); } @Step public Response updateRoomScore(RoomPointWebRequest request, Cookie cookie) { return doByCookiePresent(cookie, () -> updateScoreWithCookie(request, cookie), () -> updateScoreWithoutCookie(request)); } private Response updateScoreWithCookie(RoomPointWebRequest request, Cookie cookie) { return base.cookie(cookie) .contentType(ContentType.JSON) .body(request) .put(); } private Response updateScoreWithoutCookie(RoomPointWebRequest request) { return base .contentType(ContentType.JSON) .body(request) .put(); } @Step public Response deleteRoom(Cookie cookie) { return doByCookiePresent(cookie, () -> deleteWithCookie(cookie), this::deletewithoutCookie); } private Response deleteWithCookie(Cookie cookie) { return base.cookie(cookie) .delete(); } private Response deletewithoutCookie() { return base.delete(); } }
[ "oliver.kindy@gdn-commerce.com" ]
oliver.kindy@gdn-commerce.com
7dc70726ab82e5ec99a23c9626f2061f761075eb
92fb73a48ab09319b8df7cfc945667e3753d6f5f
/TTShop/taotao-portal/src/main/java/com/taotao/portal/service/impl/OrderServiceImpl.java
860401a9ac4fa85710dbb6b36a1869e6aae007dc
[]
no_license
JYZ-zhao/TTShop
09d3bb3e8c959eaa949384ced24fe437ae7f9009
c0665c1b336dd2081a3e4183c87f03aaa6ae63ad
refs/heads/master
2020-03-21T02:51:09.752675
2018-06-20T11:52:29
2018-06-20T12:03:04
138,024,029
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package com.taotao.portal.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.taotao.pojo.TaotaoResult; import com.taotao.portal.pojo.Order; import com.taotao.portal.service.OrderService; import com.taotao.utils.HttpClientUtil; import com.taotao.utils.JsonUtils; /** * 订单处理service * * @author lenovo * */ @Service public class OrderServiceImpl implements OrderService { @Value("${ORDER_BASE_URL}") private String ORDER_BASE_URL; @Value("${ORDER_CREATE_URL}") private String ORDER_CREATE_URL; /** * 创建订单 */ @Override public String createOrder(Order order) { // 创建订单服务之前补全用户信息 拦截器已经获得,可以在拦截器中把取到的用户信息放到reuqest对象中 // 在controller中取出,省去一次调用服务的过程 // 从cookie中获取TT_TOKEN,根据token换取用户信息 // 调用taotao-order的服务 // 调用taotao-order服务创建订单 String json = HttpClientUtil.doPostJson(ORDER_BASE_URL + ORDER_CREATE_URL, JsonUtils.objectToJson(order)); // 需要把json转换成taotaoresult TaotaoResult taotaoResult = TaotaoResult.format(json); if (taotaoResult.getStatus() == 200) { // 从taotaoResult中将数据取出 Object orderById = taotaoResult.getData(); return orderById.toString(); } // 如果status不为200,则返回空 return ""; } }
[ "541311283@qq.com" ]
541311283@qq.com
86b488b8b0ba98ca23b1f30e08997e3959462aa5
cefd1b040252cf90cfea78809bfc3af19eaa4f04
/src/main/java/pl/umk/mat/server/utils/exceptions/BadRequest.java
26c388cc0d60cc7a9278db27e46984995482353c
[]
no_license
sikor272/Game-Backend
34a5f04c29424a42b0e5732e43338cdd9ac51eb4
2fde472d1ed9e757b816505064f7d106c319a7de
refs/heads/master
2022-11-14T22:22:14.693800
2020-07-02T22:20:36
2020-07-02T22:20:36
276,728,896
0
0
null
null
null
null
UTF-8
Java
false
false
374
java
package pl.umk.mat.server.utils.exceptions; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.BAD_REQUEST) public class BadRequest extends RuntimeException { public BadRequest(String message) { super(message); } public BadRequest() { super(); } }
[ "dawidsikorski272@gmail.com" ]
dawidsikorski272@gmail.com
19b78a9794e32bd9c132bde390bca15d0db6da33
7d53d903c7955459b63380480f173317ddabb102
/src/com/thunisoft/sswy/mobile/activity/nrc/NrcWitnessListActivity.java
26bba4e39027a8023f7b1aa08574d4abb9e3a67b
[]
no_license
piaoxue85/helloyy2
94dc611fad74c0514babd2bd3d44c3f5c3b1023f
c6990d929b3cb1ff0b67f4f7f71e5dbd17cfeba9
refs/heads/master
2023-03-15T15:57:21.266363
2016-03-30T02:58:37
2016-03-30T02:58:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,211
java
package com.thunisoft.sswy.mobile.activity.nrc; import java.util.ArrayList; import java.util.List; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Click; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.ViewById; import android.content.Intent; import android.os.Bundle; import android.widget.ListView; import android.widget.TextView; import com.thunisoft.dzfy.mobile.R; import com.thunisoft.sswy.mobile.activity.BaseActivity; import com.thunisoft.sswy.mobile.adapter.nrc.NrcWitnessAdapter; import com.thunisoft.sswy.mobile.pojo.TLayyZr; import com.thunisoft.sswy.mobile.util.nrc.NrcEditData; /** * 网上立案_查看更多_证人列表 * */ @EActivity(R.layout.activity_nrc_litigant_list) public class NrcWitnessListActivity extends BaseActivity { @ViewById(R.id.nrc_litigant_add_tip) protected TextView addTipTV; /** * 证人 列表 */ @ViewById(R.id.nrc_litigant_list) protected ListView witnessListView; /** 证人 列表 adapter */ private NrcWitnessAdapter witnessAdapter; private List<TLayyZr> witnessList = new ArrayList<TLayyZr>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @AfterViews protected void onAfterView() { setBtnBack(); setTitle("证人"); addTipTV.setText("添加证人"); } @Override protected void onResume() { refreshWitnessList(); super.onResume(); } /** * 点击添加证人 */ @Click(R.id.nrc_litigant_add) protected void clickAdd() { Intent intent = new Intent(); intent.setClass(this, NrcAddWitnessActivity_.class); TLayyZr layyZr = new TLayyZr(); String layyId = NrcEditData.getLayy().getCId(); layyZr.setCLayyId(layyId); intent.putExtra(NrcAddWitnessActivity.K_WITNESS, layyZr); startActivity(intent); } /** * 刷新证人列表 */ private void refreshWitnessList() { witnessList.clear(); witnessList.addAll(NrcEditData.getWitnessList()); if (null == witnessAdapter) { witnessAdapter = new NrcWitnessAdapter(this, witnessList); witnessListView.setAdapter(witnessAdapter); } else { witnessAdapter.notifyDataSetChanged(); } } }
[ "yaozy861211@163.com" ]
yaozy861211@163.com
601074c3408be50f3c5dbd4248910cdd19f338cf
5e79747333758628159d16d66ba689469869d99d
/backend/src/main/java/dev/tuzserik/backend/services/TransactionService.java
1f070efe7b758c56b6c3ca090c435dc729d5e623
[]
no_license
TuzSeRik/information-systems-and-databases-coursework
d475a97b5fef2a77acc7a83e1ccec5b0333c2e64
9c8f3f523f3817973c254b641d87a8eff8d96998
refs/heads/main
2023-03-13T01:54:17.209766
2021-03-04T16:50:54
2021-03-04T16:50:54
333,408,953
0
0
null
null
null
null
UTF-8
Java
false
false
2,083
java
package dev.tuzserik.backend.services; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.time.ZonedDateTime; import java.util.Collection; import java.util.Optional; import java.util.UUID; import dev.tuzserik.backend.repositories.TransactionRepository; import dev.tuzserik.backend.repositories.CardRepository; import dev.tuzserik.backend.repositories.UserRepository; import dev.tuzserik.backend.model.Transaction; import dev.tuzserik.backend.model.Card; @AllArgsConstructor @Service public class TransactionService { private final TransactionRepository transactionRepository; private final CardRepository cardRepository; private final UserRepository userRepository; public Collection<Transaction> getPendingTransactions() { return transactionRepository.findAllByStatus("PENDING"); } public Transaction markTransaction(UUID id, String status) { Optional<Transaction> transaction = transactionRepository.findById(id); if (transaction.isPresent()) { transaction.get().setStatus(status); if (transaction.get().getStatus().equals("CANCELED")) transaction.get().getCard().setOwner(transaction.get().getPreviousOwner()); return transaction.get(); } else return null; } public Card transferCard(UUID cardId, UUID ownerId, UUID newOwnerId) { cardRepository.save( cardRepository.getOne(cardId) .setOwner(userRepository.getOne(newOwnerId))); transactionRepository.save(new Transaction( UUID.randomUUID(), cardRepository.getOne(cardId), userRepository.getOne(ownerId), userRepository.getOne(newOwnerId), ZonedDateTime.now(), "PENDING" )); return cardRepository.getOne(cardId); } }
[ "jokerbladeofstorme@gmail.com" ]
jokerbladeofstorme@gmail.com
007e5908c990fd6ca551f196e7d726639dacfdc0
f31405a75f521fee1f5ad7f7b87167bf4dd9f346
/src/main/java/model/userinfo/UserInfoRequestModel.java
5893bfb2112076cf151ea5c1b808025a97d0ef4d
[]
no_license
hua-1/tanke
39ca9edfa94021b3e5595c38a51ba0a52f5e379e
a7443c2c36d1a06d6713abd66c18b8ab0664a3ea
refs/heads/master
2020-03-18T17:12:58.750546
2018-06-09T03:17:12
2018-06-09T03:17:12
135,013,937
0
0
null
null
null
null
UTF-8
Java
false
false
1,710
java
package model.userinfo; import java.util.Date; public class UserInfoRequestModel { private Long id; private String userName; private String userAccount; private String password; private String mobilePhone; private String telephone; private Integer enabled; private String remark; private String roleIds; public String getRoleIds() { return roleIds; } public void setRoleIds(String roleIds) { this.roleIds = roleIds; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserAccount() { return userAccount; } public void setUserAccount(String userAccount) { this.userAccount = userAccount; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getMobilePhone() { return mobilePhone; } public void setMobilePhone(String mobilePhone) { this.mobilePhone = mobilePhone; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public Integer getEnabled() { return enabled; } public void setEnabled(Integer enabled) { this.enabled = enabled; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
[ "hn121907@163.com" ]
hn121907@163.com
0e87d2eb082bcb2abd518a1cb18c4c609fb9cd12
7c7cdbc8ac2d584c075cf2d1c42e471c3791cce9
/src/java/whowhere/logic/edittrip.java
c3bf1a74b9c049314312c26d27fbeb039d3c8ea7
[]
no_license
samskivert/whowhere
51f1f65efd4369166bc386793488cf4692c3c41c
60bc2f7add67b66a3872edeb7f3f50161a44050e
refs/heads/master
2023-06-23T20:19:03.188475
2003-10-13T18:20:06
2003-10-13T18:20:06
105,596,712
0
0
null
null
null
null
UTF-8
Java
false
false
3,013
java
// // $Id$ package whowhere.logic; import java.util.Date; import com.samskivert.servlet.user.*; import com.samskivert.servlet.util.DataValidationException; import com.samskivert.servlet.util.ParameterUtil; import com.samskivert.velocity.*; import whowhere.WhoWhere; import whowhere.data.*; public class edittrip implements Logic { public void invoke (Application app, InvocationContext ctx) throws Exception { UserManager usermgr = ((WhoWhere)app).getUserManager(); User user = usermgr.requireUser(ctx.getRequest()); String errmsg = null; // look up the specified trip int tripid = ParameterUtil.requireIntParameter( ctx.getRequest(), "tripid", "edittrip.error.missing_trip_id"); TripRepository rep = ((WhoWhere)app).getRepository(); Trip trip = rep.getTrip(tripid); if (trip == null) { throw new DataValidationException( "edittrip.error.no_such_trip"); } // make sure this user owns this trip if (user.userId != trip.travelerid) { throw new DataValidationException( "edittrip.error.not_owner_of_trip"); } // if we're submitting edits, modify the trip object and store it // back into the database if (ParameterUtil.parameterEquals( ctx.getRequest(), "action", "update")) { // insert the trip into the context so that it will be // displayed to the user ctx.put("trip", trip); // parse our updated fields trip.destination = ParameterUtil.requireParameter( ctx.getRequest(), "destination", "edittrip.error.missing_destination"); Date date = ParameterUtil.requireDateParameter( ctx.getRequest(), "begins", "edittrip.error.invalid_begins"); trip.begins = new java.sql.Date(date.getTime()); date = ParameterUtil.requireDateParameter( ctx.getRequest(), "ends", "edittrip.error.invalid_ends"); trip.ends = new java.sql.Date(date.getTime()); trip.description = ParameterUtil.getParameter( ctx.getRequest(), "description", false); // check those new dates for sense and sensibility if (trip.begins.compareTo(trip.ends) > 0) { throw new DataValidationException( "edittrip.error.ends_before_begins"); } // update the trip in the repository rep.updateTrip(trip); // let the user know we updated errmsg = "edittrip.message.trip_updated"; } else if (ParameterUtil.parameterEquals( ctx.getRequest(), "action", "delete")) { // remove the trip from the repository rep.deleteTrip(trip); // let the user know what we did errmsg = "edittrip.message.trip_deleted"; } else { // insert the trip into the context so that it will be // displayed to the user ctx.put("trip", trip); } // handle any message that was generated if (errmsg != null) { ctx.put("error", app.translate(ctx, errmsg)); } } }
[ "mdb@samskivert.com" ]
mdb@samskivert.com
ac374ae03c58e17875b66fdd8c8bdbfd6cb5a4b8
d298fc905e26019aa0d380a3c7c98f5266e55f33
/src/main/java/org/casbin/jcasbin/util/Util.java
aeb49acd53fc5f05b0db9614745ce7dfef57c13d
[ "Apache-2.0" ]
permissive
M-Razavi/jcasbin
457e1e9ccdb16cfe1074404a7cc3b2f18eb09dfa
a97e68cd05ad60a26d2070f49c054acefab86150
refs/heads/master
2021-10-09T09:09:28.221813
2021-10-06T11:22:38
2021-10-06T11:22:38
166,780,798
1
0
Apache-2.0
2021-10-06T11:22:39
2019-01-21T08:59:00
Java
UTF-8
Java
false
false
5,051
java
// Copyright 2018 The casbin Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // 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.casbin.jcasbin.util; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; public class Util { public static boolean enableLog = true; static Logger logger = Logger.getLogger("org.casbin.jcasbin"); /** * logPrint prints the log. * * @param v the log. */ public static void logPrint(String v) { if (enableLog) { logger.log(Level.INFO, v); } } /** * logPrintf prints the log with the format. * * @param format the format of the log. * @param v the log. */ public static void logPrintf(String format, String... v) { if (enableLog) { String tmp = String.format(format, (Object[]) v); logger.log(Level.INFO, tmp); } } /** * escapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names. * * @param s the value of the matcher and effect assertions. * @return the escaped value. */ public static String escapeAssertion(String s) { s = s.replace("r.", "r_"); s = s.replace("p.", "p_"); return s; } /** * removeComments removes the comments starting with # in the text. * * @param s a line in the model. * @return the line without comments. */ public static String removeComments(String s) { return s; } /** * arrayEquals determines whether two string arrays are identical. * * @param a the first array. * @param b the second array. * @return whether a equals to b. */ public static boolean arrayEquals(List<String> a, List<String> b) { if (a == null) { a = new ArrayList<>(); } if (b == null) { b = new ArrayList<>(); } if (a.size() != b.size()) { return false; } for (int i = 0; i < a.size(); i ++) { if (!a.get(i).equals(b.get(i))) { return false; } } return true; } /** * array2DEquals determines whether two 2-dimensional string arrays are identical. * * @param a the first 2-dimensional array. * @param b the second 2-dimensional array. * @return whether a equals to b. */ public static boolean array2DEquals(List<List<String>> a, List<List<String>> b) { if (a == null) { a = new ArrayList<>(); } if (b == null) { b = new ArrayList<>(); } if (a.size() != b.size()) { return false; } for (int i = 0; i < a.size(); i ++) { if (!arrayEquals(a.get(i), b.get(i))) { return false; } } return true; } /** * arrayRemoveDuplicates removes any duplicated elements in a string array. * * @param s the array. * @return the array without duplicates. */ public static boolean arrayRemoveDuplicates(List<String> s) { return true; } /** * arrayToString gets a printable string for a string array. * * @param s the array. * @return the string joined by the array elements. */ public static String arrayToString(List<String> s) { return String.join(", ", s); } /** * paramsToString gets a printable string for variable number of parameters. * * @param s the parameters. * @return the string joined by the parameters. */ public static String paramsToString(String[] s) { return String.join(", ", s); } /** * setEquals determines whether two string sets are identical. * * @param a the first set. * @param b the second set. * @return whether a equals to b. */ public static boolean setEquals(List<String> a, List<String> b) { if (a == null) { a = new ArrayList<>(); } if (b == null) { b = new ArrayList<>(); } if (a.size() != b.size()) { return false; } Collections.sort(a); Collections.sort(b); for (int i = 0; i < a.size(); i ++) { if (!a.get(i).equals(b.get(i))) { return false; } } return true; } }
[ "hsluoyz@qq.com" ]
hsluoyz@qq.com
6abc95923d68a411fbdc1591496cb2b5a0a30144
3936796ac7355654c56dc9904518289b50b2e70e
/src/main/java/com/example/assignment/repo/UserRepo.java
8e897c4fa2bafc5270631e7b5d96399f4a3f08e6
[]
no_license
sumanbanerjee4/assignmentmongo
ebcb92f555bafbd1f4d1ddb77b74e3aec8de8528
a991d8304b3eb6dc9e0039c3477d278f514e0d86
refs/heads/master
2020-05-22T09:00:26.000823
2019-05-29T18:41:32
2019-05-29T18:41:32
186,291,222
1
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.example.assignment.repo; import java.util.Optional; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; import com.example.assignment.model.User; public interface UserRepo extends MongoRepository<User, String>, UserRepoCustom{ public Optional<User> findByName(String name); /*@Query("{'$and':[{'name':?0},{'Device.name': ?1}]}") public User findAllContactsByDevice(String userName,String deviceName);*/ }
[ "saranyar.cute@gmail.com" ]
saranyar.cute@gmail.com
9ef555e1ce5bfe8dd9c62b71240080e26fe20a8e
93ee06fdf67da9c4a08b0d2372a3444eeb268172
/src/domain/CombustibleHome.java
dea14ea31978bdb180f4fda38813f887a3e6752c
[]
no_license
lfhernandezb/MarketPlaceJava
89c4506c2bb4a073a961950721178940b11abe0f
d648ffd77c1c1edcf97a7674167568d268f9cff2
refs/heads/master
2021-01-10T08:43:12.322658
2016-03-20T01:53:39
2016-03-20T01:53:39
53,456,949
0
0
null
null
null
null
UTF-8
Java
false
false
3,410
java
// default package // Generated Feb 21, 2016 1:29:40 PM by Hibernate Tools 3.4.0.CR1 import java.util.List; import javax.naming.InitialContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.LockMode; import org.hibernate.SessionFactory; import org.hibernate.criterion.Example; /** * Home object for domain model class Combustible. * @see .Combustible * @author Hibernate Tools */ public class CombustibleHome { private static final Log log = LogFactory.getLog(CombustibleHome.class); private final SessionFactory sessionFactory = getSessionFactory(); protected SessionFactory getSessionFactory() { try { return (SessionFactory) new InitialContext() .lookup("SessionFactory"); } catch (Exception e) { log.error("Could not locate SessionFactory in JNDI", e); throw new IllegalStateException( "Could not locate SessionFactory in JNDI"); } } public void persist(Combustible transientInstance) { log.debug("persisting Combustible instance"); try { sessionFactory.getCurrentSession().persist(transientInstance); log.debug("persist successful"); } catch (RuntimeException re) { log.error("persist failed", re); throw re; } } public void attachDirty(Combustible instance) { log.debug("attaching dirty Combustible instance"); try { sessionFactory.getCurrentSession().saveOrUpdate(instance); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void attachClean(Combustible instance) { log.debug("attaching clean Combustible instance"); try { sessionFactory.getCurrentSession().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } } public void delete(Combustible persistentInstance) { log.debug("deleting Combustible instance"); try { sessionFactory.getCurrentSession().delete(persistentInstance); log.debug("delete successful"); } catch (RuntimeException re) { log.error("delete failed", re); throw re; } } public Combustible merge(Combustible detachedInstance) { log.debug("merging Combustible instance"); try { Combustible result = (Combustible) sessionFactory .getCurrentSession().merge(detachedInstance); log.debug("merge successful"); return result; } catch (RuntimeException re) { log.error("merge failed", re); throw re; } } public Combustible findById(short id) { log.debug("getting Combustible instance with id: " + id); try { Combustible instance = (Combustible) sessionFactory .getCurrentSession().get("Combustible", id); if (instance == null) { log.debug("get successful, no instance found"); } else { log.debug("get successful, instance found"); } return instance; } catch (RuntimeException re) { log.error("get failed", re); throw re; } } public List findByExample(Combustible instance) { log.debug("finding Combustible instance by example"); try { List results = sessionFactory.getCurrentSession() .createCriteria("Combustible") .add(Example.create(instance)).list(); log.debug("find by example successful, result size: " + results.size()); return results; } catch (RuntimeException re) { log.error("find by example failed", re); throw re; } } }
[ "lfhernandezb@gmail.com" ]
lfhernandezb@gmail.com
5b5ba659f479b9cd89abc64a6b68eb6dc1b5c9ab
cdb8564b3ecc14375929bf94a7056c81aa5b7fc0
/DesertSSH/src/com/home/desert/pogo/OrderProduct.java
c4ceecebcca9668dd1ce685ae66dc4d630fb7915
[]
no_license
RockNJU/Deser_SSH
df09485dbb9215f56c7855f698f805d494d4f729
00f71d7585d66373d34522a0c9242ece031d9143
refs/heads/master
2021-01-20T19:09:16.306496
2016-06-27T04:38:37
2016-06-27T04:38:37
61,524,936
0
0
null
null
null
null
UTF-8
Java
false
false
2,812
java
package com.home.desert.pogo; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.Table; /** * @author zucewei * @see 表示订单 的实体bean * * */ @SuppressWarnings("serial") @Entity @Table(name="order_product") @NamedQuery(name="OrderProduct.findAll", query="SELECT op from OrderProduct op") public class OrderProduct implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; private String orderid; //购物车商品所属的用户编号 private int spid; //购买商品的商品编号 private String name; private String category; private String img; private String img2; private String img3; private double realPrice; //购买商品的实际价格。 private double discount; private double count; //购买的数量 private double summoney; //此次购买的商品的总价。 public OrderProduct(){ } public OrderProduct(String orderid,CartProduct p){ this.orderid=orderid; this.realPrice=p.getRealPrice(); this.count=p.getCount(); this.summoney=p.getSummoney(); this.spid=p.getSpid(); this.name=p.getName(); this.category=p.getCategory(); this.img=p.getImg(); this.img2=p.getImg2(); this.img3=p.getImg3(); this.discount=p.getDiscount(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getOrderid() { return orderid; } public void setOrderid(String orderid) { this.orderid = orderid; } public int getSpid() { return spid; } public void setSpid(int spid) { this.spid = spid; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getImg() { return img; } public void setImg(String img) { this.img = img; } public String getImg2() { return img2; } public void setImg2(String img2) { this.img2 = img2; } public String getImg3() { return img3; } public void setImg3(String img3) { this.img3 = img3; } public double getRealPrice() { return realPrice; } public void setRealPrice(double realPrice) { this.realPrice = realPrice; } public double getDiscount() { return discount; } public void setDiscount(double discount) { this.discount = discount; } public double getCount() { return count; } public void setCount(double count) { this.count = count; } public double getSummoney() { return summoney; } public void setSummoney(double summoney) { this.summoney = summoney; } }
[ "wzce2393147618" ]
wzce2393147618
c5bc0f482b235c6cc200b6db2f6f470c76d66f5d
0cfa4343f83eea4288bafeef64ad2f7cb7a499ba
/app/src/main/java/widget/adapters/AdapterWheel.java
80048415f2dde6c649b5c11781a83e0c248615d0
[]
no_license
wodejiusannian/HuiChuanYi
4a049b2a901d6b2dc868ccff5a7227c2462315f0
14aa2cc99ec1b0a1c1c085662d6fb324f3a714fc
refs/heads/master
2020-12-02T18:16:53.406731
2018-07-10T01:14:28
2018-07-10T01:14:28
81,194,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,554
java
/* * Copyright 2011 Yuri Kanivets * * 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 widget.adapters; import android.content.Context; import widget.WheelAdapter; /** * Adapter class for old wheel adapter (deprecated WheelAdapter class). * * @deprecated Will be removed soon */ public class AdapterWheel extends AbstractWheelTextAdapter { // Source adapter private WheelAdapter adapter; /** * Constructor * @param context the current context * @param adapter the source adapter */ public AdapterWheel(Context context, WheelAdapter adapter) { super(context); this.adapter = adapter; } /** * Gets original adapter * @return the original adapter */ public WheelAdapter getAdapter() { return adapter; } @Override public int getItemsCount() { return adapter.getItemsCount(); } @Override protected CharSequence getItemText(int index) { return adapter.getItem(index); } }
[ "752443668@qq.com" ]
752443668@qq.com
29047c485fb08a63d2b024e75ebc55300c0e1484
b36a85dd502904fc014f318e91a7ff5d67537905
/src/main/java/com/redxun/saweb/filter/FilterServletOutputStream.java
d69e5763888010229864129b7bac63cb299c9461
[]
no_license
clickear/jsaas
7c0819b4f21443c10845e549b521fa50c3a1c760
ddffd4c42ee40c8a2728d46e4c7009a95f7f801f
refs/heads/master
2020-03-16T09:00:40.649868
2018-04-18T12:13:50
2018-04-18T12:13:50
132,606,788
4
8
null
2018-05-08T12:37:25
2018-05-08T12:37:25
null
UTF-8
Java
false
false
1,369
java
package com.redxun.saweb.filter; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.servlet.ServletOutputStream; import javax.servlet.WriteListener; //import javax.servlet.WriteListener; /** * Servlet 输出流 * @author mansan * @Email chshxuan@163.com * @Copyright (c) 2014-2016 广州红迅软件有限公司(http://www.redxun.cn) * 本源代码受软件著作法保护,请在授权允许范围内使用 */ public class FilterServletOutputStream extends ServletOutputStream { private DataOutputStream stream; //private WriteListener writeListener; public FilterServletOutputStream(OutputStream output) { stream = new DataOutputStream(output); } public void write(int b) throws IOException { stream.write(b); } public void write(byte[] b) throws IOException { stream.write(b); } public void write(byte[] b, int off, int len) throws IOException { stream.write(b, off, len); } //public boolean isReady() { // // TODO Auto-generated method stub // return false; //} // // //public void setWriteListener(WriteListener arg0) { // // TODO Auto-generated method stub // //} // /*@Override public void setWriteListener(WriteListener writeListener) { this.writeListener = writeListener; } @Override public boolean isReady() { return true; }*/ }
[ "yijiang331" ]
yijiang331
009373b372e78bec54ba1d201945eb1bf3f06d7c
36cac255e3f3bb7760f44ed2f68a56178a2a3865
/src/main/java/com/reit/services/PopulationService.java
800f850546195ce200f11fa7c9ebeffbfa5f4df4
[]
no_license
Sudhamsh/BupoAPI2
c22c1d6b16d097c3293225a34588312bdda65ce0
8077ade15271bba808f5311bc5bd802e2e58670b
refs/heads/master
2023-04-02T17:31:27.308845
2021-04-05T15:47:08
2021-04-05T15:47:08
292,135,909
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package com.reit.services; import com.bupo.util.LogManager; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class PopulationService { private LogManager logger = LogManager.getLogger(this.getClass()); private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd").create(); }
[ "sbachu@apple.com" ]
sbachu@apple.com
ffeada995ca03d4f19c819711e2c6df6e45ca2ce
639bcdc2dab9846f619f4319e62307b4a6243a54
/src/main/java/com/dinghz/doclet/demo/TransInfo.java
36a2dfc1f6236cf5b6710df30eca1e872664882f
[]
no_license
craneding/doclet-demo
0816370ad05ade7ac33b1686400baa619fb0becc
6be00ec37c752b3699e988b1b69325aad9e03e59
refs/heads/master
2021-01-17T16:24:36.124192
2016-06-03T07:24:22
2016-06-03T07:24:22
60,325,316
2
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.dinghz.doclet.demo; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author craneding * @date 16/5/7 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface TransInfo { Class<?> requestClass(); }
[ "dinghz@dingxiaoyangdeMacBook-Pro.local" ]
dinghz@dingxiaoyangdeMacBook-Pro.local
66054e0bd30965c0dcee00f825c645674d9bfcc3
4a1c4ff1e9681f03ffab638badd6d48ce6340c7e
/src/test/java/com/raphaelbauer/lajolla/protein/manualexecution/RunTMAlignOnSet.java
3fb110c1d1148775b433f50e6d86b4431b670329
[]
no_license
raphaelbauer/lajolla
ec9c088c00f23bff39c990d6be34d9663fb686bb
773ba2883c1a7d54a394013e3be87549d3504fe7
refs/heads/master
2016-09-06T11:18:41.565607
2015-06-23T18:56:07
2015-06-23T18:56:07
16,508,418
1
0
null
null
null
null
UTF-8
Java
false
false
2,785
java
package com.raphaelbauer.lajolla.protein.manualexecution; import java.io.File; import junit.framework.TestCase; import com.raphaelbauer.lajolla.ngramto3dtranslators.INGramTo3DTranslator; import com.raphaelbauer.lajolla.ngramto3dtranslators.NGramToStringTranslatorBasedOnSingleMatchingNGramsManyResults; import com.raphaelbauer.lajolla.scoringfunctions.EScoringFunctionRelativeSettings; import com.raphaelbauer.lajolla.scoringfunctions.IScoringFunction; import com.raphaelbauer.lajolla.scoringfunctions.ScoreAccordingToScoringAtomDistanceOnlyIfNGramsAreSimilarFastNotIdealAndBasedOnTMSCORE; import com.raphaelbauer.lajolla.transformation.IFileToStringTranslator; import com.raphaelbauer.lajolla.transformation.IResidueToStringTransformer; import com.raphaelbauer.lajolla.transformation.protein.BetterOptimizedPhiPsiTranslator; import com.raphaelbauer.lajolla.transformation.protein.PDBProteinTranslator; import com.raphaelbauer.lajolla.transformation.protein.ProteinMatchRunner; import com.raphaelbauer.lajolla.utilities.DeleteDirRecursively; public class RunTMAlignOnSet extends TestCase { static IScoringFunction scoringFunction = new ScoreAccordingToScoringAtomDistanceOnlyIfNGramsAreSimilarFastNotIdealAndBasedOnTMSCORE( EScoringFunctionRelativeSettings.basedOnSizeOfQueryWhatIsTheTargetInTMSCORE); static INGramTo3DTranslator ngramTo3DTranslator = new NGramToStringTranslatorBasedOnSingleMatchingNGramsManyResults(); public void testAllAgainstAll() { int ngramSize = 5; String inputFiles = "/media/truecrypt1/benchmarking/datasets/tm-align/"; //String pathToQueryDirOrFile = "/home/ra/Desktop/dataset2/pdb/"; String outputFilePath = "/media/truecrypt1/benchmarking/results/tm-align/"; boolean dealOnlyWithFirstModel = true; IResidueToStringTransformer iResidueToStringTransformer = new BetterOptimizedPhiPsiTranslator(); IFileToStringTranslator iFileToStringTranslator = new PDBProteinTranslator( iResidueToStringTransformer, dealOnlyWithFirstModel, scoringFunction, ngramTo3DTranslator); double thresholdOfRefinementScoreUnderWichResultIsOmitted = 0.0000000000001; //set up and clean: DeleteDirRecursively.deleteDir(new File(outputFilePath)); ProteinMatchRunner.executeSearch( ngramSize, iFileToStringTranslator, iResidueToStringTransformer, inputFiles, inputFiles, outputFilePath, dealOnlyWithFirstModel, thresholdOfRefinementScoreUnderWichResultIsOmitted, 1); //check if there are two result dirs with 2 perfect matches each... //tear down and clean: //DeleteDirRecursively.deleteDir(new File(tempDir)); } }
[ "raphael.andre.bauer@gmail.com" ]
raphael.andre.bauer@gmail.com
8bbe7f6c486612fcd8b3dfa09f645c13e2488d70
6249f3eed3bb17819976b5031c4c8d77364a40be
/src/test/java/Utility/TestNGTestListener.java
9d71f543091f1077b2429dbcfc972d49262eb7ac
[]
no_license
PuneeshMotwani/Task1_SignUp
64690b31159ce0c23786b6bfa08171fc3f0c2d78
1665b5212428d6e76d705e7a146d982459b06565
refs/heads/master
2016-08-12T14:28:29.986222
2015-11-18T17:21:51
2015-11-18T17:21:51
43,428,288
0
0
null
null
null
null
UTF-8
Java
false
false
1,534
java
package Utility; import java.util.List; import org.testng.IInvokedMethod; import org.testng.IInvokedMethodListener; import org.testng.ITestResult; import org.testng.Reporter; public class TestNGTestListener implements IInvokedMethodListener{ public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { // TODO Auto-generated method stub } public void afterInvocation(IInvokedMethod method, ITestResult testResult) { // TODO Auto-generated method stub Reporter.setCurrentTestResult(testResult); if (method.isTestMethod()) { List<String> verificationFailures = SoftAssertor.getVerificationFailures(); int size = verificationFailures.size(); //if there are verification failures... if ( size > 0) { //set the test to failed testResult.setStatus(ITestResult.FAILURE); testResult.setAttribute("ErrorMsg ", verificationFailures.toString()); Reporter.log(verificationFailures.toString()); //if there is an assertion failure add it to verificationFailures if (testResult.getThrowable() != null) { verificationFailures.add(testResult.getThrowable().getMessage()); } StringBuffer failureMsg = new StringBuffer(); for(int i=0;i<size;i++) { failureMsg.append(verificationFailures.get(i)).append("\n"); } //set merged throwable Throwable merged = new Throwable(failureMsg.toString()); testResult.setThrowable(merged); } } } }
[ "akankshabhagwanani@Akanksha-Bhagwananis-MacBook-Pro.local" ]
akankshabhagwanani@Akanksha-Bhagwananis-MacBook-Pro.local
42937d2ffab5278f1308ca9da59d984cd30de42a
862c57d9b7a66bb75085d6d287e8a74d4782c8ba
/src/main/java/com/jt/lawfirm/controller/hr/HeWorkhistoryController.java
2a1c8959d550302d9da0f50ed47235657bf3f1e0
[]
no_license
evlidoer/sykj-xmsz-lawfirms
631afc5ea800c51e27158761d7475589b3bbf889
4b9361ae51be8238756258eaf7d207e17b8c9997
refs/heads/master
2020-05-23T22:34:47.547256
2019-05-17T04:04:03
2019-05-17T04:04:03
186,976,824
0
1
null
null
null
null
UTF-8
Java
false
false
2,815
java
package com.jt.lawfirm.controller.hr; import java.io.IOException; import java.util.List; /* * * @author代国繁 * */ import java.util.Map; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.jt.lawfirm.bean.hr.HrWorkhistory; import com.jt.lawfirm.service.hr.IHrEmpService; import com.jt.lawfirm.service.hr.IHrWorkhistoryService; import com.jt.lawfirm.util.HRBoolean; /** * @author 代 * */ @Controller @RequestMapping(value="/hr/work") public class HeWorkhistoryController { @Resource(name="workservice") private IHrWorkhistoryService hrWorkhistoryService; @Resource(name="hrempservice") private IHrEmpService empService; @ResponseBody @RequestMapping(value="/byworkselect/{id}",method=RequestMethod.GET) public Object show(@PathVariable("id") int id,Map<String, Object> map){ map.put("id", id); return hrWorkhistoryService.selectworkby(map); } @ResponseBody @RequestMapping(value="/byworkselectid/{id}",method=RequestMethod.GET) public Object select(@PathVariable("id") int id,Map<String, Object> map){ map.put("hr_emp_id", id); return hrWorkhistoryService.selectworkby(map); } @ResponseBody @RequestMapping(value="/byworkselectid",method=RequestMethod.GET) public Object showwork(Map<String, Object> map){ List<String> selectempid = empService.selectempid(); Integer id= Integer.valueOf(selectempid.get(0)); map.put("hr_emp_id", id+1); return hrWorkhistoryService.selectworkby(map); } @ResponseBody @RequestMapping(value="/updatework",method=RequestMethod.GET) public Object update(HrWorkhistory hrWorkhistory) throws IOException{ return HRBoolean.yesOrNo(hrWorkhistoryService.updatework(hrWorkhistory)); } @ResponseBody @RequestMapping(value="/workdeletebyid/{id}",method=RequestMethod.GET) public Object delete(@PathVariable("id") int id) throws IOException{ return HRBoolean.yesOrNo(hrWorkhistoryService.deletework(id)); } @ResponseBody @RequestMapping(value="/insertwork",method=RequestMethod.GET) public Object insert(HrWorkhistory hrWorkhistory){ List<String> selectempid = empService.selectempid(); Integer id= Integer.valueOf(selectempid.get(0))+1; hrWorkhistory.setHrEmpId(id); return HRBoolean.yesOrNo(hrWorkhistoryService.insertwork(hrWorkhistory)); } @ResponseBody @RequestMapping(value="/insertworkid/{id}",method=RequestMethod.GET) public Object insertwork(@PathVariable("id")int id,HrWorkhistory hrWorkhistory){ hrWorkhistory.setHrEmpId(id); return HRBoolean.yesOrNo(hrWorkhistoryService.insertwork(hrWorkhistory)); } }
[ "evlidoer@163.com" ]
evlidoer@163.com
a3ef6d2484577a1fa485aa50b7d4b2fd0dcf6f4f
89dd1c8014a168f189d6cda2baac06b4ba428d60
/app/src/main/java/com/mili/camera2api/AutoFitTextureView.java
ddf4a26044943707e2a420a9e07f1c045ab5c0fc
[]
no_license
manoj-mili/camera-2-basics
c5de28de596d3e5b8922a1739afd460335413f55
216a5530d6ad4cba51c5e34f1a875629d9242be5
refs/heads/master
2020-09-17T07:48:28.804119
2019-11-26T14:16:14
2019-11-26T14:16:14
224,041,918
6
0
null
null
null
null
UTF-8
Java
false
false
1,922
java
package com.mili.camera2api; import android.content.Context; import android.util.AttributeSet; import android.view.TextureView; public class AutoFitTextureView extends TextureView { private int mRatioWidth = 0; private int mRatioHeight = 0; public AutoFitTextureView(Context context) { this(context, null); } public AutoFitTextureView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } /** * Sets the aspect ratio for this view. The size of the view will be measured based on the ratio * calculated from the parameters. Note that the actual sizes of parameters don't matter, that * is, calling setAspectRatio(2, 3) and setAspectRatio(4, 6) make the same result. * * @param width Relative horizontal size * @param height Relative vertical size */ public void setAspectRatio(int width, int height) { if (width < 0 || height < 0) { throw new IllegalArgumentException("Size cannot be negative."); } mRatioWidth = width; mRatioHeight = height; requestLayout(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); if (0 == mRatioWidth || 0 == mRatioHeight) { setMeasuredDimension(width, height); } else { if (width < height * mRatioWidth / mRatioHeight) { setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); } else { setMeasuredDimension(height * mRatioWidth / mRatioHeight, height); } } } }
[ "manoj.mohanty@carnot.co.in" ]
manoj.mohanty@carnot.co.in
c4c484fd6be3c81aaed9d6e0c964ab32c22504cc
e82fb26b7dc9de70762e49a46d189fd0e379222b
/src/main/java/fr/anthonyrey/stats/StatsCodeGen.java
fb784132f4063cb0eecb0442f23961b95769dac5
[ "Unlicense" ]
permissive
ReyAnthony/DQloneStatsDSL
2684bd7966b104dfebe2bcdcc32744c5c582e521
511320d8e60e5bd1f45f9ef40596d97d2e9b508f
refs/heads/master
2020-03-30T19:54:15.243410
2019-02-02T23:03:11
2019-02-02T23:03:11
151,564,687
1
0
null
null
null
null
UTF-8
Java
false
false
10,945
java
package fr.anthonyrey.stats; import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CodePointCharStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ErrorNode; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.antlr.v4.runtime.tree.TerminalNode; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.nio.file.Path; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class StatsCodeGen implements statsDSLListener { private String filename; private Path savePath; private String input; private final Map<String, ClassData> classes; private String currentClass; private ClassData currentClassData; public StatsCodeGen(String filename, Path savePath, String input) { this.filename = filename; this.savePath = savePath; this.input = input; classes = new HashMap<>(); } public void start() { final CodePointCharStream input = CharStreams.fromString(this.input); final statsDSLLexer lexer = new statsDSLLexer(input); final CommonTokenStream tokenStream = new CommonTokenStream(lexer); final statsDSLParser parser = new statsDSLParser(tokenStream); final statsDSLParser.ProgramContext program = parser.program(); ParseTreeWalker.DEFAULT.walk(this, program); } @Override public void enterProgram(statsDSLParser.ProgramContext ctx) { System.out.println("Running DQloneStatsDSL codegen"); } @Override public void exitProgram(statsDSLParser.ProgramContext ctx) { final String cFile = savePath.toString() + "/" + filename + ".c"; final String hFile = savePath.toString() + "/" + filename + ".h"; try (PrintWriter c_file = new PrintWriter(cFile, "UTF-8"); PrintWriter h_file = new PrintWriter(hFile, "UTF-8")){ StringBuffer sb = new StringBuffer(); //codegen.h sb.append("//Code generated by DQloneStatsDSL on ").append(LocalDateTime.now()).append("\n"); sb.append("#ifndef STATS_ENGINE_CODEGEN_H\n"); sb.append("#define STATS_ENGINE_CODEGEN_H\n"); sb.append("#include \"types.h\"\n"); sb.append("#include \"assert.h\"\n"); sb.append("typedef enum {"); final Iterator<String> iterator = classes.keySet().iterator(); while(iterator.hasNext()) { sb.append(iterator.next()); if (iterator.hasNext()) { sb.append(","); } } sb.append("} class_t;").append("\n"); //TODO need something to define the existing types sb.append("typedef struct {\n" + " class_t class;\n" + " \n" + " uint_16 hp;\n" + " uint_16 agi;\n" + " uint_16 atk;\n" + " uint_16 def;\n" + " uint_16 mag;\n" + " \n" + " uint_32 xp; \n" + " uint_8 level;\n" + " \n" + "} stats_t;").append("\n"); sb.append("uint_32 get_nb_points_for_level(class_t class, uint_8 level);\n"); sb.append("void increase_stats(stats_t* stats);\n"); sb.append("#endif\n"); //System.out.println(sb.toString()); h_file.write(sb.toString()); System.out.println("Wrote " + hFile); //codegen.c sb.delete(0, sb.length()); sb.append("//Code generated by DQloneStatsDSL on ").append(LocalDateTime.now()).append("\n"); sb.append("#include ").append("\"stats_engine_codegen.h\"").append("\n"); sb.append("static void set_stats(stats_t* stats, uint_16 hp, uint_16 agi, uint_16 atk, uint_16 def, uint_16 mag);\n"); sb.append("static void set_stats(stats_t* stats, uint_16 hp, uint_16 agi, uint_16 atk, uint_16 def, uint_16 mag){\n"); sb.append(" "); sb.append("stats->hp = hp").append(";\n"); sb.append(" "); sb.append("stats->agi = agi").append(";\n"); sb.append(" "); sb.append("stats->atk = atk").append(";\n"); sb.append(" "); sb.append("stats->def = def").append(";\n"); sb.append(" "); sb.append("stats->mag = mag").append(";\n");; sb.append("}\n"); sb.append("uint_32 get_nb_points_for_level(class_t class, uint_8 level) {").append("\n"); sb.append(" ").append("assert(level > 0);\n"); classes.forEach( (c, classData) -> { sb.append(" "); sb.append("if (class == ").append(c).append("){\n"); classData.getStatsData().forEach(statsData -> { sb.append(" ").append(" "); sb.append("if (level == ").append(statsData.getForLevel()).append(") { "); sb.append("return ").append(statsData.getNeededXp()).append(";").append(" }\n"); }); sb.append(" ").append("}").append("\n"); }); sb.append(" ").append("return -1;").append("\n"); sb.append("}").append("\n"); sb.append("void increase_stats(stats_t* stats) {\n"); classes.forEach( (c, classData) -> { sb.append(" "); sb.append("if (stats->class == ").append(c).append("){\n"); classData.getStatsData().forEach(statsData -> { sb.append(" ").append(" "); sb.append("if (stats->level == ").append(statsData.getForLevel()).append(")").append(" { "); sb.append("set_stats(stats,"); sb.append(statsData.getHp()).append(","); sb.append(statsData.getAgi()).append(","); sb.append(statsData.getAtk()).append(","); sb.append(statsData.getDef()).append(","); sb.append(statsData.getMag()).append(");"); sb.append(" return; "); sb.append("}\n"); }); sb.append(" ").append("}").append("\n"); }); sb.append("}"); //System.out.println(sb.toString()); c_file.write(sb.toString()); System.out.println("Wrote " + cFile); System.out.println("Done."); } catch (FileNotFoundException | UnsupportedEncodingException e) { e.printStackTrace(); } } @Override public void enterClassDef(statsDSLParser.ClassDefContext ctx) { currentClass = ctx.ID().getText(); } @Override public void exitClassDef(statsDSLParser.ClassDefContext ctx) { if(!currentClassData.isValid()){ throw new RuntimeException("class definition " + ctx.ID().getSymbol().getText() + " is not valid"); } this.classes.put(currentClass, currentClassData); } @Override public void enterInnerClassDef(statsDSLParser.InnerClassDefContext ctx) { currentClassData = new ClassData(); } @Override public void exitInnerClassDef(statsDSLParser.InnerClassDefContext ctx) { classes.put(currentClass, currentClassData); } @Override public void enterInitStat(statsDSLParser.InitStatContext ctx) { final StatsData statsData = new StatsData(); ctx.statDef().forEach((statDefContext) -> { final String number = statDefContext.NUMBER().getText(); if (statDefContext.stat().AGI() != null) { statsData.setAgi(number); } else if (statDefContext.stat().ATK() != null) { statsData.setAtk(number); } else if (statDefContext.stat().DEF() != null) { statsData.setDef(number); } else if (statDefContext.stat().MAG() != null) { statsData.setMag(number); } else if (statDefContext.stat().HP() != null) { statsData.setHp(number); } }); statsData.setForLevel("1"); statsData.setNeededXp("0"); if(!statsData.isValid()) { throw new RuntimeException("Error in stats data at " + ctx.getText()); } currentClassData.addStatsData(statsData); } @Override public void exitInitStat(statsDSLParser.InitStatContext ctx) { } @Override public void enterInitLevel(statsDSLParser.InitLevelContext ctx) { //TODO remove duped code final StatsData statsData = new StatsData(); ctx.statDef().forEach((statDefContext) -> { final String number = statDefContext.NUMBER().getText(); if (statDefContext.stat().AGI() != null) { statsData.setAgi(number); } else if (statDefContext.stat().ATK() != null) { statsData.setAtk(number); } else if (statDefContext.stat().DEF() != null) { statsData.setDef(number); } else if (statDefContext.stat().MAG() != null) { statsData.setMag(number); } else if (statDefContext.stat().HP() != null) { statsData.setHp(number); } }); statsData.setForLevel(ctx.NUMBER().getText()); statsData.setNeededXp(ctx.xpDef().NUMBER().getText()); if(!statsData.isValid()) { throw new RuntimeException("Error in stats data at " + ctx.getText()); } currentClassData.addStatsData(statsData); } @Override public void exitInitLevel(statsDSLParser.InitLevelContext ctx) { } @Override public void enterXpDef(statsDSLParser.XpDefContext ctx) { } @Override public void exitXpDef(statsDSLParser.XpDefContext ctx) { } @Override public void enterStatDef(statsDSLParser.StatDefContext ctx) { } @Override public void exitStatDef(statsDSLParser.StatDefContext ctx) { } @Override public void enterStat(statsDSLParser.StatContext ctx) { } @Override public void exitStat(statsDSLParser.StatContext ctx) { } @Override public void visitTerminal(TerminalNode terminalNode) { } @Override public void visitErrorNode(ErrorNode errorNode) { } @Override public void enterEveryRule(ParserRuleContext parserRuleContext) { } @Override public void exitEveryRule(ParserRuleContext parserRuleContext) { } }
[ "anthony.rey5@gmail.com" ]
anthony.rey5@gmail.com
795782833b0cf535f5d0e2df91fecf8890db9428
5fa371af61c506e4efaab701be133fb60e4606b1
/JavaFxProject/src/fxml/ButtonController.java
8d08cc3bdc3a553eb28612b53cf7817f67aa81c3
[]
no_license
skckdgns34/javafx
391c762a17d9ee040992031f1dbad98c1b0be7dd
a327d24dafd34d300712fb937b68214b644e9fdf
refs/heads/master
2022-10-04T23:39:40.953283
2020-06-08T08:47:16
2020-06-08T08:47:16
267,451,748
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package fxml; import java.net.URL; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; public class ButtonController implements Initializable { @FXML Button btnNew,btnOpen,btnSave; @Override public void initialize(URL location, ResourceBundle resources) { Image img = new Image("/panes/icons/new.png"); btnNew.setGraphic(new ImageView(img)); Image img2 = new Image("/panes/icons/open.png"); btnOpen.setGraphic(new ImageView(img2)); Image img3 = new Image("/panes/icons/save.png"); btnSave.setGraphic(new ImageView(img3)); btnNew.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println("New Clicked.."); } }); btnOpen.setOnAction((event)->System.out.println("Open Clicked..")); } //end of initialize public void btnSaveAction(ActionEvent event) { System.out.println("Save Clicked.."); } } //end of class
[ "skckdgns34@naver.com" ]
skckdgns34@naver.com
3326830d73161e6136688ab595e0efd090c60875
4ec87d7d99b5791242faf93db894830d75371756
/dvdlibrary/src/main/java/com/ajs/dvdlibrary/ui/UserIOConsoleImpl.java
b99eda8318902d4049f2406b7a4948153928a06f
[]
no_license
The-Software-Guild/assessment-dvd-library-austinsmith28
db0807bb0cf34122989b961e3d45b1bb75f3521c
3a7ec8160a04a5b0855ee35ae9d1bae36f31d953
refs/heads/main
2023-07-15T16:04:17.734418
2021-08-29T16:41:39
2021-08-29T16:41:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,416
java
package com.ajs.dvdlibrary.ui; import java.util.Scanner; public class UserIOConsoleImpl implements UserIO { final private Scanner console = new Scanner(System.in); /** * * A very simple method that takes in a message to display on the console * and then waits for a integer answer from the user to return. * * @param msg - String of information to display to the user. * */ @Override public void print(String msg) { System.out.println(msg); } /** * * A simple method that takes in a message to display on the console, * and then waits for an answer from the user to return. * * @param msgPrompt - String explaining what information you want from the user. * @return the answer to the message as string */ @Override public String readString(String msgPrompt) { System.out.println(msgPrompt); return console.nextLine(); } /** * * A simple method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter an integer * to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @return the answer to the message as integer */ @Override public int readInt(String msgPrompt) { boolean invalidInput = true; int num = 0; while (invalidInput) { try { // print the message msgPrompt (ex: asking for the # of cats!) String stringValue = this.readString(msgPrompt); // Get the input line, and try and parse num = Integer.parseInt(stringValue); // if it's 'bob' it'll break invalidInput = false; // or you can use 'break;' } catch (NumberFormatException e) { // If it explodes, it'll go here and do this. this.print("Input error. Please try again."); } } return num; } /** * * A slightly more complex method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter an integer * within the specified min/max range to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @param min - minimum acceptable value for return * @param max - maximum acceptable value for return * @return an integer value as an answer to the message prompt within the min/max range */ @Override public int readInt(String msgPrompt, int min, int max) { int result; do { result = readInt(msgPrompt); } while (result < min || result > max); return result; } /** * * A simple method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a long * to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @return the answer to the message as long */ @Override public long readLong(String msgPrompt) { while (true) { try { return Long.parseLong(this.readString(msgPrompt)); } catch (NumberFormatException e) { this.print("Input error. Please try again."); } } } /** * A slightly more complex method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a double * within the specified min/max range to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @param min - minimum acceptable value for return * @param max - maximum acceptable value for return * @return an long value as an answer to the message prompt within the min/max range */ @Override public long readLong(String msgPrompt, long min, long max) { long result; do { result = readLong(msgPrompt); } while (result < min || result > max); return result; } /** * * A simple method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a float * to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @return the answer to the message as float */ @Override public float readFloat(String msgPrompt) { while (true) { try { return Float.parseFloat(this.readString(msgPrompt)); } catch (NumberFormatException e) { this.print("Input error. Please try again."); } } } /** * * A slightly more complex method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a float * within the specified min/max range to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @param min - minimum acceptable value for return * @param max - maximum acceptable value for return * @return an float value as an answer to the message prompt within the min/max range */ @Override public float readFloat(String msgPrompt, float min, float max) { float result; do { result = readFloat(msgPrompt); } while (result < min || result > max); return result; } /** * * A simple method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a double * to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @return the answer to the message as double */ @Override public double readDouble(String msgPrompt) { while (true) { try { return Double.parseDouble(this.readString(msgPrompt)); } catch (NumberFormatException e) { this.print("Input error. Please try again."); } } } /** * * A slightly more complex method that takes in a message to display on the console, * and continually reprompts the user with that message until they enter a double * within the specified min/max range to be returned as the answer to that message. * * @param msgPrompt - String explaining what information you want from the user. * @param min - minimum acceptable value for return * @param max - maximum acceptable value for return * @return an double value as an answer to the message prompt within the min/max range */ @Override public double readDouble(String msgPrompt, double min, double max) { double result; do { result = readDouble(msgPrompt); } while (result < min || result > max); return result; } }
[ "flubahdub@gmail.com" ]
flubahdub@gmail.com
e9134637c4811fb8a71b4a548ce216f846d9b11f
2ee6245eae5bc34e0d853b7636f21cdc644da8cb
/core/src/main/java/com/freiheit/fuava/ctprofiler/core/impl/ThreadStatisticsImpl.java
f89908835d0215b14db82fc829b435ae4d7f38b2
[ "Apache-2.0" ]
permissive
joblift/fuava_ctprofiler
13a6199989410e7a70ca4dca29b64ae33812037c
3ac29ebabfc1a90b8fe499d93ff674c268d8024e
refs/heads/master
2021-08-29T18:23:25.676112
2017-12-14T15:53:12
2017-12-14T15:53:12
108,310,330
0
0
null
2017-11-07T15:16:27
2017-10-25T18:35:47
Java
UTF-8
Java
false
false
5,946
java
/** * Copyright 2013 freiheit.com technologies gmbh * * 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.freiheit.fuava.ctprofiler.core.impl; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import com.freiheit.fuava.ctprofiler.core.Layer; import com.freiheit.fuava.ctprofiler.core.Layers; import com.freiheit.fuava.ctprofiler.core.NestedTimerPath; import com.freiheit.fuava.ctprofiler.core.Node; import com.freiheit.fuava.ctprofiler.core.Statistics; import com.freiheit.fuava.ctprofiler.core.TimerStatistics; class ThreadStatisticsImpl implements Statistics { private final long _threadId; private final String _threadName; private final Collection<Node> _roots; private static final class NodeImpl implements Node { private final Layer layer; private final NestedTimerPath path; private final TimerStatistics statistics; private final Collection<Node> children; public NodeImpl( final Layer layer, final NestedTimerPath path, final TimerStatistics statistics, final Collection<Node> children) { if (layer == null) { throw new NullPointerException(); } this.layer = layer; this.path = path; this.statistics = statistics; this.children = children; } @Override public Layer getLayer() { return layer; } @Override public Collection<Node> getChildren() { return children; } @Override public NestedTimerPath getPath() { return path; } @Override public TimerStatistics getTimerStatistics() { return statistics; } } private ThreadStatisticsImpl(final long threadId, final String threadName, final Map<PathWithLayer, TimerStatistics> paths) { _threadId = threadId; _threadName = threadName; _roots = getRoots(paths); } private Collection<Node> getRoots( final Map<PathWithLayer, TimerStatistics> paths) { // create a tree final Map<NestedTimerPath, List<PathValue>> pathsByParent = new HashMap<NestedTimerPath, List<PathValue>>(); for (final Map.Entry<PathWithLayer, TimerStatistics> keyValue : paths.entrySet()) { final PathWithLayer p = keyValue.getKey(); final NestedTimerPath parent = p.getPath().getParent(); List<PathValue> ps = pathsByParent.get(parent); if (ps == null) { ps = new ArrayList<PathValue>(); pathsByParent.put(parent, ps); } ps.add(new PathValue(p.getLayer(), p.getPath(), keyValue.getValue())); } final List<PathValue> roots = pathsByParent.get(PathImpl.ROOT); final List<Node> rootNodes = new ArrayList<Node>(); if (roots != null) { for (final PathValue pv : roots) { final Layer pvl = pv.getLayer(); final Layer l = pvl.equals(Layers.inherit()) ? Layers.DEFAULT: pvl; rootNodes.add(toNode(pathsByParent, l, pv.getPath(), pv.getCall())); } } return rootNodes; } private Node toNode(final Map<NestedTimerPath, List<PathValue>> pathsByParent, final Layer layer, final NestedTimerPath paths, final TimerStatistics statistics) { if (statistics == null) { throw new NullPointerException("statistics must not be null"); } if (paths == null) { throw new NullPointerException("path must not be null"); } final List<PathValue> pvs = pathsByParent.get(paths); final Collection<Node> children = new ArrayList<Node>(); if (pvs != null) { for (final PathValue pv : pvs) { final Layer pvl = pv.getLayer(); final Layer l = pvl.equals(Layers.inherit()) ? layer: pvl; children.add(toNode(pathsByParent, l, pv.getPath(), pv.getCall())); } } return new NodeImpl(layer, paths, statistics, children); } static Statistics getCurrentThreadInstance(final Map<PathWithLayer, Call> paths) { return getInstance(Thread.currentThread(), paths); } static Statistics getInstance(final Thread thread, final Map<PathWithLayer, Call> paths) { return getInstance(thread.getId(), thread.getName(), paths); } static Statistics getInstance(final long threadId, final String threadName, final Map<PathWithLayer, Call> paths) { final Map<PathWithLayer, TimerStatistics> m = new LinkedHashMap<PathWithLayer, TimerStatistics>(); for (final Map.Entry<PathWithLayer, Call> e : paths.entrySet()) { m.put(e.getKey(), e.getValue()); } return new ThreadStatisticsImpl(threadId, threadName, m); } @Override public long getThreadId() { return _threadId; } @Override public String getThreadName() { return _threadName; } @Override public Collection<Node> getRoots() { return _roots; } @Override public long getTotalNanos() { long r = 0; for (final Node n : _roots) { r += n.getTimerStatistics().getTotalNanos(); } return r; } }
[ "klas.kalass@freiheit.com" ]
klas.kalass@freiheit.com
e8387187310ff1b54395c79d3cb3a236608758e7
f7dd777cfed400efbafccfa45df8587eb09f9a11
/api-annotations/src/main/java/com/laynemobile/api/annotations/Module.java
33818af6a077606042d34809c6fd566259231a4c
[ "Apache-2.0" ]
permissive
LayneMobile/Api
fd617fdaba9200e9e1899f5368902baa6e206b6b
00e400f0e4e5bd0df45876ebef429c9873188b95
refs/heads/master
2021-01-17T19:19:56.652533
2016-06-22T05:37:59
2016-06-22T05:37:59
62,358,898
0
0
null
null
null
null
UTF-8
Java
false
false
1,159
java
/* * Copyright 2016 Layne Mobile, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.laynemobile.api.annotations; 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; import sourcerer.ExtensionClass; import static sourcerer.ExtensionClass.Kind.InstanceDelegate; @Documented @Retention(RetentionPolicy.SOURCE) @Target({ElementType.TYPE}) @ExtensionClass( kind = InstanceDelegate, packageName = "api", className = "ApiModule" ) public @interface Module {}
[ "layne@laynemobile.com" ]
layne@laynemobile.com
30babe46e8878043361453798b8b10a7043dc20f
0c65eead5b7076e042c1c4800ece7e61e99f2ba7
/Java/ch8_interface/src/project.java
8414c7f60225cf2ecc483a2e477c6d17bcee5985
[]
no_license
LeeSM0518/TIL
3826a432b73945ebea302eef6429a93b6baa1f4f
463d7e056b0083047f3e33d705d77f014947f982
refs/heads/master
2021-06-28T07:26:20.215835
2020-09-25T14:16:00
2020-09-25T14:16:00
149,553,733
3
3
null
2019-02-14T13:16:25
2018-09-20T05:00:06
Java
UTF-8
Java
false
false
2,670
java
abstract class Tool { abstract public void repair(); abstract public void function(); } interface Computer { void powerOn(); void powerOff(); default void usb(Mouse a){ System.out.println(a.name + " 을 연결했습니다."); } default void usb(KeyBoard a){ System.out.println(a.name + " 을 연결했습니다."); } default void blueTooth(Tool tool){ if(tool instanceof Mouse) { System.out.println(((Mouse) tool).name + " 을 블루투스로 연결 했습니다."); } else if(tool instanceof KeyBoard) { System.out.println(((KeyBoard)tool).name + " 을 블루투스로 연결 했습니다."); } } } class DeskTop implements Computer { public void powerOn(){ System.out.println("데스크탑 전원을 킨다."); } public void powerOff(){ System.out.println("데스크탑 전원을 끊다"); } } class NoteBook implements Computer { public void powerOn(){ System.out.println("노트북 전원을 킨다."); } public void powerOff(){ System.out.println("노트북 전원을 끊다"); } } class Tablet implements Computer { public void powerOn(){ System.out.println("테블릿 전원을 킨다."); } public void powerOff(){ System.out.println("테블릿 전원을 끊다"); } } class Mouse extends Tool{ public String name = "마우스"; @Override public void repair() { System.out.println(this.name + " 을 고친다."); } @Override public void function() { System.out.println("클릭"); } } class KeyBoard extends Tool{ public String name = "키보드"; @Override public void repair() { System.out.println(this.name + "을 고친다."); } @Override public void function() { System.out.println("타자"); } } class test { public static void main(String[] args) { Computer com = null; Tool tool = null; DeskTop deskTop = new DeskTop(); NoteBook noteBook = new NoteBook(); Tablet tablet = new Tablet(); Mouse mouse = new Mouse(); KeyBoard keyBoard = new KeyBoard(); com = deskTop; com.powerOn(); com.powerOff(); com.usb(mouse); com.usb(keyBoard); com = noteBook; com.powerOn(); com.powerOff(); com.usb(mouse); com.usb(keyBoard); com = tablet; com.powerOn(); com.powerOff(); com.blueTooth(mouse); com.blueTooth(keyBoard); mouse.function(); mouse.repair(); } }
[ "nalsm98@naver.com" ]
nalsm98@naver.com
c89e63df3d73f0e289b03513fd7d5d0aa5878e2f
896c9b6ee6c481cac51d6c8c1bdf2a562cd9ca50
/BugTracker/src/main/java/com/jtran98/BugTracker/MainBugTrackerInitializer.java
68a6b3e98088e8c41d48fc776732b620ccd53140
[]
no_license
jtran98/BugTracker
e69a57afeb6b85f2484682b2e4098c586dc4b0ae
8217adf336f8094a48e082f6b2305c07880bbf41
refs/heads/master
2023-04-19T05:51:45.797623
2021-05-06T17:55:49
2021-05-06T17:55:49
328,490,521
0
0
null
null
null
null
UTF-8
Java
false
false
1,345
java
package com.jtran98.BugTracker; import javax.servlet.MultipartConfigElement; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; import org.springframework.context.annotation.Bean; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.support.GenericWebApplicationContext; import org.springframework.web.multipart.support.StandardServletMultipartResolver; import org.springframework.web.servlet.DispatcherServlet; public class MainBugTrackerInitializer implements WebApplicationInitializer{ private String TMP_FOLDER = "/tmp"; private int MAX_UPLOAD_SIZE = 5 * 1024 * 1024; @Bean public StandardServletMultipartResolver multipartResolver() { return new StandardServletMultipartResolver(); } @Override public void onStartup(ServletContext sc) throws ServletException { ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext())); appServlet.setLoadOnStartup(1); MultipartConfigElement multipartConfigElement = new MultipartConfigElement(TMP_FOLDER, MAX_UPLOAD_SIZE, MAX_UPLOAD_SIZE * 2, MAX_UPLOAD_SIZE / 2); appServlet.setMultipartConfig(multipartConfigElement); } }
[ "jackytran98@gmail.com" ]
jackytran98@gmail.com
89d36d8acef81868b88d3d4404c0d6a8702643bc
4feea7252ac72d55616614e74fdcfd3dd54aaddb
/src/main/java/cn/zxf/self/designall/mediator/ConcreteColleagueB.java
4aaf500d4e6c18e94e58ddded6cad365ea39148b
[]
no_license
zhaoxuanfeng/designpattern
e130de027658bf9219742bbbb34fa9eb2d4da84b
6cff57fb3f30d855ece3231b409cddfef95a7039
refs/heads/master
2020-04-23T19:19:11.364782
2019-02-22T03:02:46
2019-02-22T03:02:46
171,399,095
0
0
null
2019-03-01T08:57:34
2019-02-19T03:34:01
null
UTF-8
Java
false
false
485
java
package cn.zxf.self.designall.mediator; /** * @ClassName ConcreteColleagueB * @Description TODO * @Author zxf * @DATE 2019/2/20 */ public class ConcreteColleagueB extends Colleague { public ConcreteColleagueB(Mediator mediator) { super(mediator); } @Override void send(String message) { mediator.send(message,this); } @Override void notifyOther(String message) { System.out.println("B收到消息"+message); } }
[ "523552524@qq.com" ]
523552524@qq.com
4099ac542b95ffab842b64168d8a37b87bf7abf8
8b5476c6a28573ea02b7c210fcff83b8a45494b8
/src/main/java/com/training/MvcWebApplicationInitializer.java
ac35898658d47f58934d7ab90e2ac8eb3fe56935
[]
no_license
saipraveen-a/Spring-Security-Java-Demo
2607e491cada1a27972f78a1eac42efb6bbca1e9
1f807a052866e72ffe5ccaae8961fe8dbee1ddb8
refs/heads/master
2021-09-13T05:08:07.556664
2018-04-25T09:39:33
2018-04-25T09:39:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package com.training; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; public class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class<?>[] getRootConfigClasses() { return new Class[]{WebSecurityConfig.class}; } @Override protected Class<?>[] getServletConfigClasses() { return null; } @Override protected String[] getServletMappings() { return new String[]{"/"}; } }
[ "saipraveen.anumukonda@jda.com" ]
saipraveen.anumukonda@jda.com
a1236e53e93620da9f00676a2fda20cf4a7c973b
4a2884dd8e264a6506c028be70e184c40752c40d
/fj21-tarefas/src/br/com/caelum/tarefa/jpa/GerarTabelas.java
44e4a618c6720ed10e788c452ba8b1402435dffa
[]
no_license
josuemoura/fj21-tarefas
181dfcca42507822eb79bf3080ca349f9eb8f30e
830211da23ceebdaf17bbaad5cde1e6ea1b118c5
refs/heads/master
2021-01-19T06:24:55.059920
2014-03-15T16:00:37
2014-03-15T16:00:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package br.com.caelum.tarefa.jpa; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class GerarTabelas { public static void main(String [] args) { EntityManagerFactory factory = Persistence.createEntityManagerFactory("tarefas"); factory.close(); } }
[ "josuepaulista@hotmail.com" ]
josuepaulista@hotmail.com
333bb08d084401a70ddb2bd806055956572ead96
6a9dcdea61e9f14d728b81bcc73fe69c4e8ee47d
/Booking/src/main/java/co/com/devco/certification/booking/exceptions/LoginException.java
d9b5469313abdc972d0e53d511410e9a34a8bfa3
[]
no_license
Julieth0594/RetoDevco
bc9bf566566357d302b1ed306dc5413998b8cbd6
d71f88c4f85b2bc6b6f770da462dc8f57decf0c7
refs/heads/master
2023-07-15T08:14:37.038845
2021-08-23T19:27:15
2021-08-23T19:27:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package co.com.devco.certification.booking.exceptions; @SuppressWarnings("serial") public class LoginException extends AssertionError { public LoginException(String message, Throwable cause) { super(message, cause); } }
[ "juan_becerra82132@elpoli.edu.co" ]
juan_becerra82132@elpoli.edu.co
d8edc848cc6de46cdf5e72fa4ddc8d0f4d6125c8
a74bec9727d40f52d3903889d654f6bea6c59b43
/eu.jgen.notes.dmw.lite/src-gen/eu/jgen/notes/dmw/lite/lang/impl/YNullImpl.java
ad104aa37bf385206d1cadf82bcd238e99cef46b
[]
no_license
JGen-Notes/DMW-Lite
a3458e2c940b1f50e645adc49951e7a2770c0b18
8c81b8f1cca717fe1c747567672a6b7db1a91c0a
refs/heads/master
2020-03-18T04:56:11.508556
2018-10-07T08:46:12
2018-10-07T08:46:12
134,136,254
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
/** * generated by Xtext 2.12.0 */ package eu.jgen.notes.dmw.lite.lang.impl; import eu.jgen.notes.dmw.lite.lang.LangPackage; import eu.jgen.notes.dmw.lite.lang.YNull; import org.eclipse.emf.ecore.EClass; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>YNull</b></em>'. * <!-- end-user-doc --> * * @generated */ public class YNullImpl extends YExpressionImpl implements YNull { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected YNullImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return LangPackage.Literals.YNULL; } } //YNullImpl
[ "ms@jgen.eu" ]
ms@jgen.eu
d11d030a1d69c3292410d7db925ac2016af8f9f4
f520d3184ffbb1859777b66fa7ff441c1e7e3819
/BinarySearchTreeA2/src/test/ReverseBSTOrderTest.java
a566f55c7a551a8b9cc96cb3fd8e5cd338c8bb53
[]
no_license
tushar2412/JavaPrograms
6549f8fecd37f6ece4986075df588b9876402b29
35c4f41e88fd273b0066fdec27ed8ebe99309576
refs/heads/master
2016-08-09T00:43:02.855835
2016-04-09T03:55:51
2016-04-09T03:55:51
55,816,564
0
0
null
null
null
null
UTF-8
Java
false
false
979
java
package test; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.Iterator; import org.junit.Test; import bst.BinarySearchTree; import bst.NormalBSTOrder; import bst.ReverseBSTOrder; import bst.VowelBSTDecorator; /* * @author - Tushar Sharma * * BinarySearchTreeTest Class created to test Binary Search Tree Implementation. */ public class ReverseBSTOrderTest { /* * testInsertNewNode to test successful insertion of not-null Strings. * and no insert operation for null strings. */ /*@Test public void testInsertNewNode() { NormalOrder no= new NormalOrder(); BinarySearchTree bst = new BinarySearchTree(no); assertEquals(true, bst.add("abc")); assertEquals(true, bst.add("def")); } */ @Test public void testOrderBy() { ReverseBSTOrder instance=new ReverseBSTOrder(); String expectedResult="eci"; String actualResult=instance.orderBy("ice"); assertEquals(expectedResult,actualResult); } }
[ "tushar.sks@gmail.com" ]
tushar.sks@gmail.com
d6926b553d6e2d24cbf2a31533a5ee4ae8179bdc
0b85e873533b87ad235934118b7c80429f5a913b
/basicJava/basicJavaPractice/src/day07_Random和ArrayList类/Student.java
b9c79190bcd3df43e3340ee3b87b0064e8fa3020
[]
no_license
lqt1401737962/Java-Notes
0eeed847d45957b0e8f5d2017287238eea910e62
9ceb16dd89fe9343fd80cf5a861fe6da5e502b07
refs/heads/master
2022-08-05T21:43:04.183997
2021-04-06T09:04:26
2021-04-06T09:04:26
228,815,761
0
0
null
2022-06-21T04:16:04
2019-12-18T10:28:35
Java
UTF-8
Java
false
false
534
java
package day07_Random和ArrayList类; import javax.lang.model.element.NestingKind; public class Student { private String name; private int age; public Student(String name, int age) { this.name = name; this.age = age; } public Student() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } }
[ "1401737962@qq.com" ]
1401737962@qq.com
b41fb9cc2db54bf0c5d0be2ee4841f62f60cf2da
ba2eef5e3c914673103afb944dd125a9e846b2f6
/AL-Game/src/com/aionemu/gameserver/model/templates/flyring/FlyRingPoint.java
0697d287449e6aa4fd718940334037b46c935111
[]
no_license
makifgokce/Aion-Server-4.6
519d1d113f483b3e6532d86659932a266d4da2f8
0a6716a7aac1f8fe88780aeed68a676b9524ff15
refs/heads/master
2022-10-07T11:32:43.716259
2020-06-10T20:14:47
2020-06-10T20:14:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,598
java
/** * This file is part of Aion-Lightning <aion-lightning.org>. * * Aion-Lightning is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Aion-Lightning is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Aion-Lightning. * If not, see <http://www.gnu.org/licenses/>. */ package com.aionemu.gameserver.model.templates.flyring; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import com.aionemu.gameserver.model.utils3d.Point3D; /** * @author M@xx */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "FlyRingPoint") public class FlyRingPoint { @XmlAttribute(name = "x") private float x; @XmlAttribute(name = "y") private float y; @XmlAttribute(name = "z") private float z; public float getX() { return x; } public float getY() { return y; } public float getZ() { return z; } public FlyRingPoint() { } public FlyRingPoint(Point3D p) { x = (float) p.x; y = (float) p.y; z = (float) p.z; } }
[ "Falke_34@080676fd-0f56-412f-822c-f8f0d7cea3b7" ]
Falke_34@080676fd-0f56-412f-822c-f8f0d7cea3b7
5c482a2fb9fe513b578e69d5c7e1ff4196a9addd
0da1dc87ac5eafa0d400c3cdca37ac9b0108880b
/app/src/test/java/com/kevin/resistorcalculator/ExampleUnitTest.java
57a031b6a2c5ee64bfc5f6ded84d7fb1a85b194d
[]
no_license
Evineit/Resistorcalculator
5daf182e91782364c067769faba40c28f565b8ee
30de563ec884bc992ef9c3175d0cd25a2b1e7839
refs/heads/master
2022-11-04T22:27:35.282575
2020-06-16T21:30:17
2020-06-16T21:30:17
273,286,663
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.kevin.resistorcalculator; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "seidaikevin@gmail.com" ]
seidaikevin@gmail.com
70146c7d9371b3c9a53c8f3f055c7f855ac7f05d
262aa767282c11b8b40a4f97c8f4713aaa91d840
/src/Tools/ProductSaver.java
7272615c8916105a9f80630979e29531e6af77a3
[]
no_license
busliksuslik/SPTVR19MyShop
cb08ee9f3c40666523fe727f9c1a0ba7c28be130
1f94c8d5d5593b4b5e25b43694e39c8045bff8c9
refs/heads/master
2022-12-26T06:59:37.440033
2020-10-09T08:17:10
2020-10-09T08:17:10
301,921,448
0
0
null
null
null
null
UTF-8
Java
false
false
1,809
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 Tools; import entities.Product; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; /** * * @author user */ public class ProductSaver { private final String fileName = "product"; public void saveStorage(Product[] products) { FileOutputStream fos; ObjectOutputStream oos; try { fos = new FileOutputStream(fileName); oos = new ObjectOutputStream(fos); oos.writeObject(products); oos.flush(); oos.close(); fos.close(); } catch (FileNotFoundException ex) { System.out.println("Не найден файл"); } catch (IOException ex) { System.out.println("Ошибка ввода/вывода"); } } public Product[] loadFile() { FileInputStream fis; ObjectInputStream ois; try { fis = new FileInputStream(fileName); ois = new ObjectInputStream(fis); return (Product[]) ois.readObject(); } catch (FileNotFoundException ex) { System.out.println("Не найден файл"); } catch (IOException ex) { System.out.println("Ошибка ввода/вывода"); } catch (ClassNotFoundException ex) { System.out.println("Ошибка: не найден класс"); } return new Product[100]; } }
[ "ella.gortsinskaja@ivkhk.ee" ]
ella.gortsinskaja@ivkhk.ee
8c5c97ec546c437d1e1a3de34a12b01b75621aa8
d2f290dc2f3efd93a81e3e30e3f0943e49d96edc
/android/app/src/main/java/com/example/flutter_xiecheng/MainActivity.java
c9d20185d94b4997b7302d8c0138e8c993becb18
[]
no_license
s1min/FlutterXieCheng
0239188a64138ef5f8b794661373614fc5cf6ef7
f8a1250cc17762c7939cc34f6113000058b0e69a
refs/heads/master
2020-07-08T06:20:37.533354
2019-08-21T13:28:29
2019-08-21T13:28:29
203,588,252
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.example.flutter_xiecheng; import android.os.Bundle; import io.flutter.app.FlutterActivity; import io.flutter.plugins.GeneratedPluginRegistrant; public class MainActivity extends FlutterActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GeneratedPluginRegistrant.registerWith(this); } }
[ "raohonghua@foxmail.com" ]
raohonghua@foxmail.com
79d04de0d3c336de3a9d64372fb05d7c20ce0642
4f2c40b3a78ea09a680ad2650e026ff4cb79dfdd
/app/src/main/java/com/romanenko/lew/testworkaxon/screens/randomUserList/ListAdapter.java
cdc68a7e17d0eb94ca1f1bed5a0b3772ad72cdfe
[]
no_license
Lewiy/TestWorkAxon
282f2542160ea845b54dc17c2452b7a619bb164e
03e80e95f8f86377fe0788cdd0d082b12b444abf
refs/heads/master
2020-04-12T10:35:21.774588
2019-01-23T20:23:16
2019-01-23T20:23:16
162,287,833
0
0
null
null
null
null
UTF-8
Java
false
false
3,261
java
package com.romanenko.lew.testworkaxon.screens.randomUserList; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.romanenko.lew.testworkaxon.R; import com.romanenko.lew.testworkaxon.model.requestPOJO.Result; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ListUsersViewHolder> { Context context; List<Result> listUsers = new ArrayList<>(); LayoutInflater lInflater; private RecyclerViewClickListener mListener; public ListAdapter(Context context, RecyclerViewClickListener listener) { this.context = context; this.mListener = listener; } public List<Result> getListUsers() { return listUsers; } @Override public ListUsersViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_user_item, parent, false); return new ListUsersViewHolder(view, mListener); } @Override public void onBindViewHolder(ListUsersViewHolder holder, int position) { holder.bind(listUsers.get(position), mListener); } @Override public int getItemCount() { return listUsers.size(); } public void setItems(List<Result> users) { listUsers.addAll(users); notifyDataSetChanged(); } public void setItem(Result celebrationVOS) { listUsers.add(celebrationVOS); notifyDataSetChanged(); } public void clearItems() { listUsers.clear(); notifyDataSetChanged(); } public Result getItem(int position) { return listUsers.get(position); } class ListUsersViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private ImageView userListImageView; private TextView name_surname; private RecyclerViewClickListener recyclerViewClickListener; public void bind(Result result, RecyclerViewClickListener recyclerViewClickListener) { this.recyclerViewClickListener = recyclerViewClickListener; this.name_surname.setText(result.getName().getFirst() + " " + result.getName().getLast()); Picasso.get().load(result.getPicture().getMedium()).into(this.userListImageView); } public ListUsersViewHolder (View itemView, RecyclerViewClickListener recyclerViewClickListener) { super(itemView); this.recyclerViewClickListener = recyclerViewClickListener; userListImageView = itemView.findViewById(R.id.users_list_image_view); name_surname = itemView.findViewById(R.id.name_surname); itemView.setOnClickListener(this); } @Override public void onClick(View view) { recyclerViewClickListener.onClick(view, getAdapterPosition(), getItem(getAdapterPosition())); } } public interface RecyclerViewClickListener { void onClick(View view, int position, Result result); } }
[ "romanenko.lew@gmail.com" ]
romanenko.lew@gmail.com
ef941760261fd93da907b7381bb541641120012f
c387d0f8bcba44e9612606c58ca351d8de73b93f
/src/main/java/pl/sii/it_conference/serviceImplementation/PrelectionServiceImpl.java
af30f7ce4332b6dd2f671bd2c68e791b7f77e7ea
[ "MIT" ]
permissive
adamos98/IT_Conference_project
8270f8184dc42c00c638c4e5c6975813e64cef87
6a1b9bba5589a0a00887692427f9cdff4eeaaf8a
refs/heads/master
2023-05-14T21:56:55.204179
2021-06-10T07:48:05
2021-06-10T07:48:05
372,537,372
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package pl.sii.it_conference.serviceImplementation; import lombok.AllArgsConstructor; import org.modelmapper.ModelMapper; import org.modelmapper.TypeToken; import org.springframework.stereotype.Service; import pl.sii.it_conference.constant.ErrorMessage; import pl.sii.it_conference.dto.PrelectionDto; import pl.sii.it_conference.dto.PrelectionWithIdDto; import pl.sii.it_conference.entity.Prelection; import pl.sii.it_conference.exceptions.NotFoundException; import pl.sii.it_conference.repository.PrelectionRepository; import pl.sii.it_conference.service.PrelectionService; import java.util.List; @Service @AllArgsConstructor public class PrelectionServiceImpl implements PrelectionService { private final PrelectionRepository prelectionRepository; private final ModelMapper modelMapper; @Override public List<PrelectionWithIdDto> getAllPrelections() { return modelMapper.map(prelectionRepository.findAll(),new TypeToken<List<PrelectionWithIdDto>>(){ }.getType()); } @Override public PrelectionDto addUserToPrelection(Long id) { Prelection prelection = prelectionRepository.findById(id).orElseThrow(() -> new NotFoundException(ErrorMessage.PRELECTION_NOT_FOUND_BY_ID + id)); prelection.setAmountOfUsers(prelection.getAmountOfUsers()+1); Prelection updated = prelectionRepository.save(prelection); return modelMapper.map(updated,PrelectionDto.class); } public boolean checkIfPrelectionIsNotFull(Prelection prelection){ return prelection.getAmountOfUsers() != 5; } }
[ "Zal.pl13579*" ]
Zal.pl13579*
859164887882b22d29e80c47f89022ef49ac7285
0a1a2e73404362f0c590b439bbdf96cc55eedaa8
/src/main/java/ru/artemiev/tstask1/Department.java
ca1dcfb8a33f93b8621b60f6cc7180d96db41cb2
[]
no_license
artbmstu/task1_emp
a9b38ae971dc4562e65f8f02e872edc89e4f9728
2ca20d117be978443d52bb929369fc5cb78ea048
refs/heads/master
2021-05-02T02:14:27.173646
2018-03-05T14:44:40
2018-03-05T14:44:40
120,881,356
0
0
null
null
null
null
UTF-8
Java
false
false
2,359
java
package ru.artemiev.tstask1; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; class Department { private String dep; private List<Employee> employees = new ArrayList<>(); Department(String dep){ this.dep = dep; } List<Employee> getEmployees() { return employees; } String getDep() { return dep; } BigDecimal averSalary(){ BigDecimal sum = BigDecimal.ZERO; try { for (Employee i: getEmployees()) { sum = i.getSalary().add(sum); } } catch (NullPointerException e) { System.out.println("Ошибка null зарплаты (рассчет средней зарплаты в департаменте)"); } return sum.divide(new BigDecimal(getEmployees().size()), 2, RoundingMode.HALF_UP); } void addEmployee(Employee employee){ getEmployees().add(employee); } List<int[]> variantsAver(){ List<int[]> aver = new ArrayList<>(); int temp; int[] mas; for (int i = 1; i <= getEmployees().size(); i++) { temp = i; mas = new int[temp]; recursion(aver,0, 0, temp, mas); } return aver; } private void recursion(List<int[]> aver, int pos, int maxUsed, int temporary, int[] mas){ if (pos == temporary) { int[] temp = mas.clone(); aver.add(temp); } else { for (int i = maxUsed + 1; i <= getEmployees().size(); i++) { mas[pos] = i; recursion(aver,pos + 1, i, temporary, mas); } } } BigDecimal averageCalculating(int i, List<int[]> averVariants){ BigDecimal sum = new BigDecimal(0); try { for (int j = 0; j < averVariants.get(i).length; j++) { sum = sum.add(getEmployees().get(averVariants.get(i)[j]-1).getSalary()); } } catch (NullPointerException e) { System.out.println("Ошибка. При рассчете используется зарплата null. Исправьте тип данных в исходном файле"); } return sum.divide((new BigDecimal(averVariants.get(i).length)), 2, RoundingMode.HALF_UP); } }
[ "aaartemyev@tsconsulting.ru" ]
aaartemyev@tsconsulting.ru
c20f6e8d44489390725310e2807c102ae34cb4ab
1439826238439a35ce176066ea17e59554f06ccf
/src/com/gamesbykevin/bubblebobble2/input/Input.java
f613feecd6737465dec852b72c1ee774608460df
[]
no_license
gamesbykevin/BubbleBobble2
8a5d24bd1f68cf4e6afb04a754be7d2db866b8fc
20fc79dcc89bf228caefedecd9cc65a5e83912f6
refs/heads/master
2021-01-10T20:50:32.017153
2015-07-13T03:46:33
2015-07-13T03:46:33
21,779,744
3
0
null
null
null
null
UTF-8
Java
false
false
3,855
java
package com.gamesbykevin.bubblebobble2.input; import com.gamesbykevin.framework.input.Keyboard; import com.gamesbykevin.bubblebobble2.character.Character; import com.gamesbykevin.bubblebobble2.resources.GameAudio; import com.gamesbykevin.bubblebobble2.resources.Resources; import java.awt.event.KeyEvent; /** * This class will handle the keyboard input for the object * @author GOD */ public final class Input { /** * The keys we will check for input */ public static final int KEY_LEFT = KeyEvent.VK_LEFT; public static final int KEY_RIGHT = KeyEvent.VK_RIGHT; public static final int KEY_DOWN = KeyEvent.VK_DOWN; public static final int KEY_JUMP = KeyEvent.VK_A; public static final int KEY_FIRE = KeyEvent.VK_S; /** * Manage the character based on keyboard input * @param character The character we want to manage * @param keyboard Object containing keyboard input */ public static void update(final Character character, final Keyboard keyboard, final Resources resources) { //if the character is starting don't check input yet if (character.isStarting() || character.isDead()) return; //can only press left or right if (keyboard.hasKeyPressed(KEY_LEFT)) { if (character.canWalk()) { character.setVelocityX(-character.getSpeedWalk()); character.setHorizontalFlip(true); if (!character.isJumping() && !character.isFalling()) character.setWalk(true); } } else if (keyboard.hasKeyPressed(KEY_RIGHT)) { if (character.canWalk()) { character.setVelocityX(character.getSpeedWalk()); character.setHorizontalFlip(false); if (!character.isJumping() && !character.isFalling()) character.setWalk(true); } } //determine which way to face the character if (keyboard.hasKeyReleased(KEY_LEFT)) { keyboard.removeKeyReleased(KEY_LEFT); character.resetVelocityX(); character.setWalk(false); if (!character.isAttacking()) { character.setHorizontalFlip(true); if (!character.isJumping() && !character.isFalling()) character.setIdle(true); } } else if (keyboard.hasKeyReleased(KEY_RIGHT)) { keyboard.removeKeyReleased(KEY_RIGHT); character.resetVelocityX(); character.setWalk(false); if (!character.isAttacking()) { character.setHorizontalFlip(false); if (!character.isJumping() && !character.isFalling()) character.setIdle(true); } } if (keyboard.hasKeyPressed(KEY_JUMP)) { if (character.canJump()) { character.setJump(true); character.setVelocityY(-Character.MAX_SPEED_JUMP); //play sound effect resources.playGameAudio(GameAudio.Keys.SoundJump); } } if (keyboard.hasKeyReleased(KEY_FIRE)) { if (character.canAttack()) { character.setAttack(true); character.addProjectile(); character.resetVelocityX(); } //stop firing keyboard.removeKeyReleased(KEY_FIRE); } } }
[ "GOD@192.168.0.109" ]
GOD@192.168.0.109
2f18b7d698658389b2ac981e3cc0469b93333601
16f7922e19077474ecf66d26282e93c5dd6fe42b
/01Code/01Code/com.tiuweb.family/com.tiuweb.family/com.tiuweb.family.service/src/main/java/com/tiuweb/family/plan/service/ITblPlanTransferTreatmentRecordService.java
029cd9e833a524d6855b25bfd7b9204dffad439a
[]
no_license
lanshitou/family
72427f076abd82160771467d20927a385aaa0d73
7a4e63a23d0d40dbe81b30ed153af7d40f62c227
refs/heads/master
2020-04-13T11:24:29.073145
2018-12-26T11:42:47
2018-12-26T11:42:47
163,173,424
0
0
null
null
null
null
UTF-8
Java
false
false
1,379
java
/* * @(#) ITblPlanTransferTreatmentRecordService 2017-08-07 10:38:53 * * Copyright 2003 by TiuWeb Corporation. * 51 zhangba six Road, xian, PRC 710065 // Replace with xian’s address * * All rights reserved. * * This software is the confidential and proprietary information of * TiuWeb Corporation. You * shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement * you entered into with TiuWeb. */ package com.tiuweb.family.plan.service; import com.tiuweb.climb.framework.commons.service.IBaseService; import com.tiuweb.climb.framework.commons.util.ServiceRunException; import com.tiuweb.family.plan.domain.TblPlanTransferTreatmentRecord; /** * * <p> * Title: 执行计划转诊记录 * </p> * <p> * Description: TODO 执行计划转诊记录Service层 * * @author tanggeliang * @version 1.00.00 创建时间:2017-08-07 10:38:53 * * <pre> * 修改记录: 版本号 修改人 修改日期 修改内容 * */ public interface ITblPlanTransferTreatmentRecordService extends IBaseService<TblPlanTransferTreatmentRecord> { /** * 新增转诊记录 * * @param tblPlanTransferTreatmentRecord * @return * @throws ServiceRunException */ int insertTransfer(TblPlanTransferTreatmentRecord tblPlanTransferTreatmentRecord) throws ServiceRunException; }
[ "444858933@qq.com" ]
444858933@qq.com
503a3703eadc9e3e7a58fd06d598f69c9a104687
9f2abebc76764260fc887e57cd0ae6233fce9ed5
/IntradayDownloader/src/HolidayList.java
52f6c64c1c62f6388e828ae2fa36a95c794ed426
[]
no_license
bikramaditya/stock
50fe5ac9fa2f7457e4da21b10c99f4bdf163f9c9
54e05fcdd90b5a15ef2faf58c0752bfb3e2555e0
refs/heads/master
2020-04-13T02:11:34.339128
2019-01-31T13:10:58
2019-01-31T13:10:58
162,896,260
0
0
null
null
null
null
UTF-8
Java
false
false
1,728
java
import java.util.Calendar; import java.util.GregorianCalendar; import java.util.HashSet; import java.util.Set; public class HolidayList { public static void main(String args[]) { Set<String> holidays = getHolidays(2018); DAO dao = new DAO(); dao.storeHolidays(holidays, "NSE"); } static Set<String> getHolidays(int thisYear) { Set<String> datesSet = new HashSet<String>(); int[] years = {thisYear}; int[] months = {0,1,2,3,4,5,6,7,8,9,10,11}; String[] mktHolidays = {"2018-01-26","2018-02-13","2018-03-02","2018-03-29","2018-03-30","2018-05-01","2018-08-15","2018-08-22","2018-09-13","2018-09-20","2018-10-02","2018-10-18","2018-11-07","2018-11-08","2018-11-23","2018-12-25"}; for(String holiday : mktHolidays) { datesSet.add(holiday); } for (int year : years) { for(int month : months) { Calendar cal = new GregorianCalendar(year, month, 1); do { // get the day of the week for the current day int day = cal.get(Calendar.DAY_OF_WEEK); // check if it is a Saturday or Sunday if (day == Calendar.SATURDAY || day == Calendar.SUNDAY) { String monthToPrint = (""+(month+1)); if(monthToPrint.length()==1) { monthToPrint = "0"+monthToPrint; } String dayToPrint = ""+cal.get(Calendar.DAY_OF_MONTH); if(dayToPrint.length()==1) { dayToPrint = "0"+dayToPrint; } String holiday = year+"-"+monthToPrint+"-"+dayToPrint; datesSet.add(holiday); } // advance to the next day cal.add(Calendar.DAY_OF_YEAR, 1); } while (cal.get(Calendar.MONTH) == month); } } return datesSet; } }
[ "bikramaditya@gmail.com" ]
bikramaditya@gmail.com
c124a8d0444e4f7b6921742037582d3db26a9f04
0c30cbc1be99e8852a4681384d2fb09e76530116
/src/SpriteCollection.java
34d314f63bb188a44dee227ca22774b8bdb692c4
[]
no_license
nirdun/ass3
c15864ce6bd3a91a412c964f33b22dbd9de29c4a
d36683e2d44ff1fc5522e34fca7cd93ee9b137fb
refs/heads/master
2021-01-10T05:43:37.024779
2016-04-03T13:51:41
2016-04-03T13:51:41
55,348,656
0
0
null
null
null
null
UTF-8
Java
false
false
797
java
import biuoop.DrawSurface; import java.util.ArrayList; import java.util.List; /** * A Ball class. * * @author Nir Dunetz and Haim Gil. */ public class SpriteCollection { private List spriteCollection; public SpriteCollection() { this.spriteCollection = new ArrayList(); } public void addSprite(Sprite s) { this.spriteCollection.add(s); } public void notifyAllTimePassed() { for (int i = 0; i < this.spriteCollection.size(); i++) { Sprite s = (Sprite) this.spriteCollection.get(i); s.timePassed(); } } public void drawAllOn(DrawSurface d) { for (int i = 0; i < spriteCollection.size(); i++) { Sprite s = (Sprite) spriteCollection.get(i); s.drawOn(d); } } }
[ "nirdunetz@h-MBP-sl-nir.home" ]
nirdunetz@h-MBP-sl-nir.home
a95c283d42df0f8becd80315c7ad3adaba1da7e6
336026115845bb723c038da4270a69be4341a296
/easymis-dap-catalog/src/main/java/org/easymis/dap/catalog/security/MyWebMvcConfigurerAdapter.java
e13eee626a57b0d2b3851a11f25a93bb2e3b1624
[]
no_license
zhangjianhrm/easymis-dap
5e9c6be475205edeeb4ed06d86dcbfad3602341f
2e510862fae4e2d000fcc15685154e2821a419b6
refs/heads/master
2020-07-07T18:16:33.576617
2019-06-12T14:28:08
2019-06-12T14:28:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
680
java
package org.easymis.dap.catalog.security; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration public class MyWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter { /** * 配置静态访问资源 * @param registry */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); super.addResourceHandlers(registry); } }
[ "13551259347@139.com" ]
13551259347@139.com
7ea340075459587b1f69605e92a10e2e365ad308
12ab70c7ce10133e451412c6418ca00c73c02663
/app/src/main/java/ee/voruvesi/voruvesi/LoginActivity.java
fce4d62c32d03e40c7d75107d723b7141f87fee9
[]
no_license
kristjanhk/androidDemo
144f04591d28fff3d459d8a49db5bfd78eab47af
ee38a89874a28474dcfab114c03edd899f020127
refs/heads/master
2021-01-20T12:41:01.760042
2017-06-11T11:08:45
2017-06-11T11:08:45
90,389,596
0
0
null
null
null
null
UTF-8
Java
false
false
3,048
java
package ee.voruvesi.voruvesi; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; //Sisselogimise/ kasutajanime sisestamise ekraan public class LoginActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); //final FirebaseAuth auth = FirebaseAuth.getInstance(); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); //salvestatud seaded String username = prefs.getString("username", null); //võtame seadetest kasutajanime if (username != null) { //kui see olemas -> oleme varem seda äppi jooksutanud /* auth.signInWithEmailAndPassword(username, username) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { changeActivity(); } else { Toast.makeText(LoginActivity.this, "LOGIN FAIL", Toast.LENGTH_SHORT).show(); } } });*/ changeActivity(); //läheme MainActivityle return; } final EditText userNameField = (EditText) findViewById(R.id.insert_username); //nime sisestamise väli final Button continueButton = (Button) findViewById(R.id.login_continue); //edasimineku nupp continueButton.setOnClickListener(new View.OnClickListener() { //kui nuppu vajutame @Override public void onClick(View v) { String username = userNameField.getText().toString(); //sisestatud kasutajanimi if (username == null || username.length() == 0) { //kui seda polnud Toast.makeText(LoginActivity.this, getString(R.string.invalid_username), Toast.LENGTH_SHORT).show(); //teade return; } prefs.edit().putString("username", username).apply(); // //auth.createUserWithEmailAndPassword(username, username); DatabaseReference database = FirebaseDatabase.getInstance().getReference(); database.child("Töötajad").child(username).setValue(true); changeActivity(); } }); } private void changeActivity() { Intent intent = new Intent(this, MainActivity.class); startActivity(intent); //vahetame MainActivityle finish(); //siia activityle tagasi enam ei tule (backiga) } }
[ "kristjankyngas@outlook.com" ]
kristjankyngas@outlook.com
42ae2c142e4a4e1ceb3c7189d36fd58b81ca35f3
5867b6048048d2f976a9d23f09637686e8053b3a
/yk-jindowin-sdk-start/src/main/java/com/youku/jindowin/cache/MyController.java
4a65379c9ef96ecf5ce1eeffb16ea9af3699b6bc
[]
no_license
wucongshuai758/cache
50d96d567db096566c01ef76abffc5d31cc4e78b
4625a2ecac7152631797013951560f53c1b2d2c3
refs/heads/master
2020-05-16T22:45:46.070227
2019-04-25T02:45:07
2019-04-25T02:45:07
183,344,075
0
1
null
null
null
null
UTF-8
Java
false
false
496
java
package com.youku.jindowin.cache; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author 吴聪帅 * @Description * @Date : 下午4:29 2019/4/23 Modifyby: **/ @RestController public class MyController { @Autowired MyService myService; @RequestMapping("/hello") public String hello() { return myService.test(); } }
[ "congshuai.wcs@alibaba-inc.com" ]
congshuai.wcs@alibaba-inc.com
01f7d1cc2bb055c9a047e87872be90b6980a3f74
4b159cbb203dbe0204013905707b798f4f6ac918
/Slides de Aula/Introdução a UML/dependencia/negocio/Sistema.java
0c3e5e97dec7907fcc253bbba20abdda48117d27
[]
no_license
andreFelipeHFuck/monitoriapoo
aad6bec5321b2ac6dac41a2926519db764da6912
e8f474a2dccd5cc8723b3626e1ecf7026271827a
refs/heads/master
2023-07-06T23:42:56.440318
2021-08-02T21:26:24
2021-08-02T21:26:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package negocio; import java.util.LinkedList; import dados.Pessoa; public class Sistema { private LinkedList<Pessoa> pessoas = new LinkedList<Pessoa>(); public void cadastrarPessoa(Pessoa p) { this.pessoas.add(p); } public LinkedList<Pessoa> mostrarPessoas() { return this.pessoas; } }
[ "vtkwki@gmail.com" ]
vtkwki@gmail.com
9d36659fb1f570d39bde9bb8b022f5acb4eb4ec4
1573036d7ad075e3d084f538877942ab6ac827a1
/src/main/java/com/yuan/house/service/impl/CommentServiceImpl.java
b59b0917a803cab91c2e35c93ca529c6d4875442
[]
no_license
luckyyuaner/house
efa11d4e8f3540d906e55d2553f5a9721b9364a1
81d116ca53e6164bb6afb6b9426b7d0df3b7b695
refs/heads/master
2023-03-30T04:38:05.134316
2019-06-13T07:06:01
2019-06-13T07:06:01
177,409,877
0
0
null
null
null
null
UTF-8
Java
false
false
3,220
java
package com.yuan.house.service.impl; import com.yuan.house.POJO.CommentPOJO; import com.yuan.house.constants.Constants; import com.yuan.house.dao.CommentDao; import com.yuan.house.dao.ContractDao; import com.yuan.house.dao.HouseDao; import com.yuan.house.model.Comment; import com.yuan.house.model.Contract; import com.yuan.house.model.User; import com.yuan.house.service.CommentService; import com.yuan.house.service.CommonService; import org.apache.shiro.SecurityUtils; import org.apache.shiro.session.Session; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service public class CommentServiceImpl implements CommentService { @Autowired private CommentDao commentDao; @Autowired private ContractDao contractDao; @Autowired private HouseDao houseDao; @Autowired private CommonService commonService; @Override @Transactional(rollbackFor=Exception.class) public void addCommentByTenant(Comment comment) { Session session = SecurityUtils.getSubject().getSession(); User user = (User) session.getAttribute(Constants.SESSION_CURR_USER); comment.setUserId(user.getUserId()); if(comment.getHouseGrade() != 0) { int count1= commentDao.queryHouseCommentCount(comment.getContractId()); commentDao.updateHouseGrade(comment.getContractId(), comment.getHouseGrade(), (double)count1); Long hid = contractDao.queryHouseIDByContract(comment.getContractId()); User landlord = houseDao.queryLandlordByHouse(hid); int count2 = commentDao.queryLandlordCommentCount(user.getUserId()); commentDao.updateLandlordGrade(comment.getHouseGrade(), (double)count2, user.getUserId()); } commentDao.addCommentByTenant(comment); } @Override @Transactional(rollbackFor=Exception.class) public void addCommentByLandlord(Comment comment) { Session session = SecurityUtils.getSubject().getSession(); User user = (User) session.getAttribute(Constants.SESSION_CURR_USER); comment.setUserId(user.getUserId()); if(comment.getUserGrade() != 0) { Long uid = contractDao.queryContractById(comment.getContractId()).getUserId(); int count = commentDao.queryTenantCommentCount(uid); commentDao.updateTenantGrade(comment.getUserGrade(),uid,count); } commentDao.addCommentByLandlord(comment); } @Override public int deleteComment(Long cid) { String key = "comment_" + cid; commonService.deleteRedis(key); commonService.deleteByPrex("comments"); return commentDao.deleteComment(cid); } @Override public List<CommentPOJO> queryCommentsByHouse(Long hid) { String key = "comments_hid_" + hid; Object rs = commonService.queryRedis(key); if(null != rs) { return (List<CommentPOJO>)rs; } List<CommentPOJO> comments = commentDao.queryCommentsByHouse(hid); commonService.insertRedis(key, comments); return comments; } }
[ "1326652059@qq.com" ]
1326652059@qq.com
44b2f6b121d76863d3ecd4706e8449739ae261df
a1d2782b6071f4d9dc16b2d6c34e4f79b08a3c89
/src/main/java/com/example/springbootbackend/service/ProjectService.java
5c3ee8c1a5b8262d1904ac4ee19dfe5200c86c70
[]
no_license
Isamyrat/Test-Application-Employee
41f1f024c111bf71d0ef5826c04a497fc87c0fce
21e62500dca3b2b37bb266af862396d48535e928
refs/heads/main
2023-08-01T00:11:06.067710
2021-09-22T04:11:11
2021-09-22T04:11:11
409,058,231
0
0
null
null
null
null
UTF-8
Java
false
false
2,065
java
package com.example.springbootbackend.service; import com.example.springbootbackend.exception.ResourceNotFoundException; import com.example.springbootbackend.model.Project; import com.example.springbootbackend.repository.ProjectRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.sql.Date; import java.util.*; @Service public class ProjectService { @Autowired private ProjectRepository projectRepository; public List<Project> getAll(){ return projectRepository.findAll(); } public List<Project> addProject(String name, Date startDate, Date endDate, float price) { Project project = new Project(name,startDate,endDate,price); projectRepository.save(project); return projectRepository.findAll(); } public Project findProjectById(Long id){ Project project = projectRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Employee not exist with id:" + id)); return project; } public Project updateProject(Long id, String name, Date startDate, Date endDate, float price){ Project project = projectRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Employee not exist with id:" + id)); project.setName(name); project.setStartDate(startDate); project.setEndDate(endDate); project.setPrice(price); Project updateProject = projectRepository.save(project); return updateProject; } public ResponseEntity<Map<String, Boolean>> deleteProject(Long id) { Project project = projectRepository.findById(id) .orElseThrow(() -> new ResourceNotFoundException("Employee not exist with id:" + id)); projectRepository.delete(project); Map<String, Boolean> response = new HashMap<>(); response.put("deleted", Boolean.TRUE); return ResponseEntity.ok(response); } }
[ "kurbanowisa07@gmail.com" ]
kurbanowisa07@gmail.com
6679e1279b486e9b4499cf9c132972f5df4ce7c5
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/54/org/apache/commons/math/linear/RealMatrix_walkInColumnOrder_637.java
bafe86c989d2d4b920502a9764b9dca4c2cd66b8
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
2,379
java
org apach common math linear interfac defin real valu matrix basic algebra oper matrix element index base code entri getentri code return element row column matrix version revis date real matrix realmatrix matrix anymatrix visit chang matrix entri column order column order start upper left iter element column top bottom topmost element column param visitor visitor process matrix entri org apach common math except math user except mathuserexcept visitor process entri walk row order walkinroword real matrix chang visitor realmatrixchangingvisitor walk row order walkinroword real matrix preserv visitor realmatrixpreservingvisitor walk row order walkinroword real matrix chang visitor realmatrixchangingvisitor walk row order walkinroword real matrix preserv visitor realmatrixpreservingvisitor walk column order walkincolumnord real matrix chang visitor realmatrixchangingvisitor walk column order walkincolumnord real matrix chang visitor realmatrixchangingvisitor walk column order walkincolumnord real matrix preserv visitor realmatrixpreservingvisitor walk optim order walkinoptimizedord real matrix chang visitor realmatrixchangingvisitor walk optim order walkinoptimizedord real matrix preserv visitor realmatrixpreservingvisitor walk optim order walkinoptimizedord real matrix chang visitor realmatrixchangingvisitor walk optim order walkinoptimizedord real matrix preserv visitor realmatrixpreservingvisitor return link real matrix preserv visitor realmatrixpreservingvisitor end end walk walk column order walkincolumnord real matrix preserv visitor realmatrixpreservingvisitor visitor
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
1c57556e294f5282ac7933afc7f1b925caf14f72
97a7e17cb2656512065af7d789eb15a0fe0991f2
/src/java/core/algoritmo/ReconhecimentoDeImagem.java
25c952af065ccf6b04b7d13049258992ed019b0f
[]
no_license
skatesham/tg-rec-img
73543ff5c80bed9a2b718cf35b44f65f0ffba1b0
b477cbea518cf2f59cc96c1e99e003fd9448723e
refs/heads/master
2020-04-04T19:52:59.602782
2018-11-15T15:25:29
2018-11-15T15:25:29
156,224,387
1
0
null
null
null
null
UTF-8
Java
false
false
8,470
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 core.algoritmo; import api.modelo.Resultado; import java.util.LinkedList; import java.util.List; import org.apache.commons.math3.stat.correlation.PearsonsCorrelation; /** * * @author shan */ public class ReconhecimentoDeImagem { private List<Resultado> resultados; private Resultado resultado; private Padrao amostra; private Padrao objeto; public ReconhecimentoDeImagem() { this.resultados = new LinkedList<>(); } /** * Classe de reconhecimento de padrão em imagem Entrada: Problema Saida: * Resposta * * Etapas de reconhecimento: Etapa 1 Aquisição Etapa 2 Segmentação Etapa 3 * Representação Etapa 4 Classificação * * @param amostra * @param objeto * @return */ public Resultado ReconhecerImagem(Padrao amostra, Padrao objeto) { /** * Etapa 1 - Aquisição de Imagem */ this.amostra = amostra; this.objeto = objeto; // Valores de limites int limiteY = objeto.getAltura() - amostra.getAltura(); int limiteX = objeto.getLargura() - amostra.getLargura(); //Valores de entrada de segmentação int altura = amostra.getAltura(); int largura = amostra.getLargura(); //Variaveis de entrada de Representação double[] listaObjeto; double[] listaAmostra = amostra.getLista(); /** * Etapa 2 - Segmentação */ for (int y = 0; y <= limiteY; y++) { for (int x = 0; x <= limiteX; x++) { /** * Etapa 2.1 - Segmentação Unitária */ listaObjeto = segmentarArea(y, x, altura, largura); /** * Etapa 3 - Representação */ representar(listaObjeto, listaAmostra, x, y); /** * Etapa 4 - Classificação */ classificar(); } } /** * MELHORAMENTO: Mostrar Contador de Resultado */ //System.out.println("Quantidade possibilidades: " + (limiteX * limiteY)); /** * Resultado do Problema */ if(resultado == null){ listaObjeto = objeto.getLista(); representar(listaObjeto, listaAmostra, 0, 0); } return this.resultado; } /** * Etapa 4 - Representação Função extrai os valores da área selecionada pela * segmentação. Retorna atributos da imagem. * * @param listaObjeto : double[] | Lista de valores da área segmentada * @param listaAmostra : double[] | lista de valores da área segmentada * @param x : int | Delta X * @param y : int | Delta Y * @return r : double | Resultado de correlação entre listas */ private double representar(double[] listaObjeto, double[] listaAmostra, int x, int y) { PearsonsCorrelation ps = new PearsonsCorrelation(); double r = ps.correlation(listaObjeto, listaAmostra); if (r == Double.NaN) { r = 0; } this.resultados.add(new Resultado(x, y, r)); return r; } /** * Etapa 2 - Processo Unitário de Segmentação * * @param xP : Local indice de X * @param yP : Local Indice de Y * @param deltaX : int | amostra.getAltura() * @param deltaY : int | amostra.getLargura() * @return list : double[] | lista dos valores da área da segmentação * selecionada */ private double[] segmentarArea(int xP, int yP, int deltaX, int deltaY) { double[] list = new double[deltaY * deltaX]; int count = 0; for (int x = xP; x < (xP + deltaX); x++) { for (int y = yP; y < (yP + deltaY); y++) { list[count] = this.objeto.getValorPixel(x, y); count++; } } return list; } /** * Etapa 5 - Classificação Função de classificar objetos representados. * Utiliza a lista de resultados obitidos para responder o problema. * * @return resultado : Resultado */ private Resultado classificar() { Resultado resultado = null; double maior = -1; for (Resultado r : this.resultados) { if (r.getResultado() >= maior) { resultado = r; maior = r.getResultado(); } } this.resultado = resultado; return resultado; } /** * SEGMENTAÇÃO MELHORADA Classe de reconhecimento de padrão em imagem * Entrada: Problema Saida: Resposta * * Etapas de reconhecimento: Etapa 1 Aquisição Etapa 2 Segmentação Etapa 3 * Representação Etapa 4 Classificação * * @param amostra * @param objeto * @return */ public Resultado ReconhecerImagemMelhorado(Padrao amostra, Padrao objeto) { /** * Etapa 1 - Aquisição de Imagem */ this.amostra = amostra; this.objeto = objeto; // Valores de limites int limiteY = objeto.getAltura() - amostra.getAltura(); int limiteX = objeto.getLargura() - amostra.getLargura(); //Valores de entrada de segmentação int altura = amostra.getAltura(); int largura = amostra.getLargura(); //Variaveis de entrada de Representação double[] listaObjeto; double[] listaAmostra = amostra.getLista(); /** * MELHORAMENTO: Conta processo de segmentação */ int contadorPassos = 0; /** * Etapa 2 - Segmentação */ int y = 0; int puloX = 10; double distanciaCima = 0.15; double distanciaBaixo = -0.15; boolean flagPuloX = false; boolean flagPuloY = false; while (y < limiteY) { int x = 0; while (x < limiteX) { contadorPassos++; /** * Etapa 2.1 - Segmentação Unitária */ listaObjeto = segmentarArea(y, x, altura, largura); /** * Etapa 3 - Representação */ double r = representar(listaObjeto, listaAmostra, x, y); if (r < distanciaCima && r > distanciaBaixo) { if (x + puloX < limiteX) { x += puloX; flagPuloX = true; } } else if (x - puloX > -1 && flagPuloX) { x -= puloX; flagPuloX = false; } /** * Etapa 4 - Classificação */ classificar(); /** * Contador do While X */ x++; } /** * Contador While Y */ y++; } /* For do metodo continuo for (int y = 0; y < limiteY; y++) { for (int x = 0; x < limiteX; x++) { } } */ /** * MELHORAMENTO: Mostrar Contador de Resultado */ //System.out.println("Quantidade de passos na segmentação: " + contadorPassos); //System.out.println("Quantidade possibilidades: " + (limiteX * limiteY)); /** * Resultado do Problema */ return this.resultado; } public Resultado getResultado() { return resultado; } public List<Resultado> getResultados() { return this.resultados; } public void addResultado(Resultado resultado) { resultados.add(resultado); } public void printResultados() { int count = 0; resultados.stream().forEach((r) -> { System.out.println(r.toString()); }); } public Resultado getMaior() { return null; } public Resultado getMenor() { return null; } public void testeThis() { double[] x = {0, 255}; double[] y = {255, 0}; PearsonsCorrelation ps = new PearsonsCorrelation(); System.out.println(ps.correlation(x, y)); } }
[ "sham.vincius@gmail.com" ]
sham.vincius@gmail.com
678b5c6613cfc0407ef0baa8b9be04d78c3f8f06
f70b716fbe8eed903cf842698c89bdf8b0ef43b6
/api/src/main/java/com/epam/pipeline/dao/pipeline/PipelineRunDao.java
8a5c048451d533eeeafaae98cbfd924551f21ee4
[ "Apache-2.0" ]
permissive
jaideepjoshi/cloud-pipeline
7e7d9cc9ff7912745ed1f9fd346b49a29769bdcd
2d5081c2f2ceb55213f92e8c6da242c80fff03fa
refs/heads/master
2022-12-04T18:42:46.212873
2019-03-26T11:23:17
2019-03-26T11:23:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
44,983
java
/* * Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.epam.pipeline.dao.pipeline; import com.epam.pipeline.config.JsonMapper; import com.epam.pipeline.controller.vo.PagingRunFilterVO; import com.epam.pipeline.controller.vo.PipelineRunFilterVO; import com.epam.pipeline.dao.DaoHelper; import com.epam.pipeline.entity.BaseEntity; import com.epam.pipeline.entity.pipeline.CommitStatus; import com.epam.pipeline.entity.pipeline.Pipeline; import com.epam.pipeline.entity.pipeline.PipelineRun; import com.epam.pipeline.entity.pipeline.RunInstance; import com.epam.pipeline.entity.pipeline.TaskStatus; import com.epam.pipeline.entity.pipeline.run.ExecutionPreferences; import com.epam.pipeline.entity.pipeline.run.parameter.RunSid; import com.epam.pipeline.entity.user.PipelineUser; import com.fasterxml.jackson.core.type.TypeReference; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Required; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcDaoSupport; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.sql.Array; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Pattern; import java.util.stream.Collectors; public class PipelineRunDao extends NamedParameterJdbcDaoSupport { private Pattern wherePattern = Pattern.compile("@WHERE@"); private static final String AND = " AND "; private static final String POSTGRE_TYPE_BIGINT = "BIGINT"; private static final int STRING_BUFFER_SIZE = 70; @Autowired private DaoHelper daoHelper; @Value("${run.pipeline.init.task.name?:InitializeEnvironment}") private String initTaskName; private TaskStatus initTaskStatus = TaskStatus.SUCCESS; private String pipelineRunSequence; private String createPipelineRunQuery; private String loadAllRunsByVersionIdQuery; private String loadRunByIdQuery; private String loadSshPasswordQuery; private String updateRunStatusQuery; private String updateRunCommitStatusQuery; private String loadAllRunsByPipelineIdQuery; private String loadAllRunsByPipelineIdAndVersionQuery; private String loadRunningAndTerminatedPipelineRunsQuery; private String loadRunningPipelineRunsQuery; private String loadActiveServicesQuery; private String countActiveServicesQuery; private String loadTerminatingPipelineRunsQuery; private String searchPipelineRunsBaseQuery; private String countFilteredPipelineRunsBaseQuery; private String loadPipelineRunsWithPipelineByIdsQuery; private String updateRunInstanceQuery; private String updatePodIPQuery; private String deleteRunsByPipelineQuery; private String updateServiceUrlQuery; private String loadRunsGroupingQuery; private String countRunGroupsQuery; private String createPipelineRunSidsQuery; private String deleteRunSidsByRunIdQuery; private String loadRunSidsQuery; private String updatePodStatusQuery; private String loadEnvVarsQuery; private String updateLastNotificationQuery; private String updateProlongedAtTimeAndLastIdleNotificationTimeQuery; private String updateRunQuery; private String loadRunByPrettyUrlQuery; // We put Propagation.REQUIRED here because this method can be called from non-transaction context // (see PipelineRunManager, it performs internal call for launchPipeline) @Transactional(propagation = Propagation.REQUIRED) public Long createRunId() { return daoHelper.createId(pipelineRunSequence); } // We put Propagation.REQUIRED here because this method can be called from non-transaction context // (see PipelineRunManager, it performs internal call for launchPipeline) @Transactional(propagation = Propagation.REQUIRED) public void createPipelineRun(PipelineRun run) { if (run.getId() == null) { run.setId(createRunId()); } getNamedParameterJdbcTemplate().update(createPipelineRunQuery, PipelineRunParameters.getParameters(run, getConnection())); createRunSids(run.getId(), run.getRunSids()); } @Transactional(propagation = Propagation.REQUIRED) public PipelineRun loadPipelineRun(Long id) { List<PipelineRun> items = getJdbcTemplate().query(loadRunByIdQuery, PipelineRunParameters.getExtendedRowMapper(), initTaskStatus.ordinal(), initTaskName, id); if (!items.isEmpty()) { PipelineRun pipelineRun = items.get(0); List<RunSid> runSids = getJdbcTemplate().query(loadRunSidsQuery, PipelineRunParameters.getRunSidsRowMapper(), id); pipelineRun.setRunSids(runSids); List<Map<String, String>> envVars = getJdbcTemplate().query(loadEnvVarsQuery, PipelineRunParameters.getEnvVarsRowMapper(), pipelineRun.getId()); pipelineRun.setEnvVars(CollectionUtils.isEmpty(envVars) ? null : envVars.get(0)); return pipelineRun; } else { return null; } } public String loadSshPassword(Long id) { List<String> items = getJdbcTemplate().query(loadSshPasswordQuery, PipelineRunParameters.getPasswordRowMapper(), id); return !items.isEmpty() ? items.get(0) : null; } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadPipelineRuns(List<Long> runIds) { if (runIds.isEmpty()) { return new ArrayList<>(); } MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("list", runIds); params.addValue(PipelineRunParameters.TASK_NAME.name(), initTaskName); params.addValue(PipelineRunParameters.TASK_STATUS.name(), initTaskStatus.ordinal()); return getNamedParameterJdbcTemplate().query(loadPipelineRunsWithPipelineByIdsQuery, params, PipelineRunParameters.getExtendedRowMapper()); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadAllRunsForVersion(String version) { return getJdbcTemplate().query(loadAllRunsByVersionIdQuery, PipelineRunParameters.getRowMapper(), version); } public List<PipelineRun> loadAllRunsForPipeline(Long pipelineId) { return getJdbcTemplate().query(loadAllRunsByPipelineIdQuery, PipelineRunParameters.getRowMapper(), pipelineId); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadAllRunsForPipeline(Long pipelineId, String version) { return getJdbcTemplate().query(loadAllRunsByPipelineIdAndVersionQuery, PipelineRunParameters.getRowMapper(), pipelineId, version); } @Transactional(propagation = Propagation.SUPPORTS) public Optional<PipelineRun> loadRunByPrettyUrl(String prettyUrl) { return getJdbcTemplate().query(loadRunByPrettyUrlQuery, PipelineRunParameters.getRowMapper(), prettyUrl).stream().findFirst(); } @Transactional(propagation = Propagation.REQUIRED) public void updateRun(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateRunQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.REQUIRED) public void updateRunStatus(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateRunStatusQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.MANDATORY) public void updateRunCommitStatus(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateRunCommitStatusQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.MANDATORY) public void updatePodStatus(PipelineRun run) { getNamedParameterJdbcTemplate().update(updatePodStatusQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.MANDATORY) public void updateRunInstance(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateRunInstanceQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.REQUIRED) public void updatePodIP(PipelineRun run) { getNamedParameterJdbcTemplate().update(updatePodIPQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.MANDATORY) public void updateRunLastNotification(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateLastNotificationQuery, PipelineRunParameters .getParameters(run, getConnection())); } @Transactional(propagation = Propagation.MANDATORY) public void updateRunsLastNotification(Collection<PipelineRun> runs) { if (CollectionUtils.isEmpty(runs)) { return; } MapSqlParameterSource[] params = runs.stream() .map(run -> PipelineRunParameters.getParameters(run, getConnection())) .toArray(MapSqlParameterSource[]::new); getNamedParameterJdbcTemplate().batchUpdate(updateLastNotificationQuery, params); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadRunningAndTerminatedPipelineRuns() { return getJdbcTemplate().query(loadRunningAndTerminatedPipelineRunsQuery, PipelineRunParameters.getExtendedRowMapper(true)); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadRunningPipelineRuns() { return getJdbcTemplate().query(loadRunningPipelineRunsQuery, PipelineRunParameters.getExtendedRowMapper()); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadActiveServices(PagingRunFilterVO filter, PipelineUser user) { MapSqlParameterSource params = getPagingParameters(filter); String query = wherePattern.matcher(loadActiveServicesQuery).replaceFirst(makeRunSidsCondition(user, params)); return getNamedParameterJdbcTemplate().query(query, params, PipelineRunParameters.getRowMapper()); } @Transactional(propagation = Propagation.SUPPORTS) public int countActiveServices(PipelineUser user) { MapSqlParameterSource params = new MapSqlParameterSource(); String query = wherePattern.matcher(countActiveServicesQuery).replaceFirst(makeRunSidsCondition(user, params)); return getNamedParameterJdbcTemplate().queryForObject(query, params, Integer.class); } @Transactional(propagation = Propagation.MANDATORY) public void deleteRunsByPipeline(Long id) { getJdbcTemplate().update(deleteRunsByPipelineQuery, id); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> loadTerminatingRuns() { return getJdbcTemplate().query(loadTerminatingPipelineRunsQuery, PipelineRunParameters.getRowMapper()); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> searchPipelineRuns(PagingRunFilterVO filter) { return searchPipelineRuns(filter, null); } @Transactional(propagation = Propagation.SUPPORTS) public List<PipelineRun> searchPipelineRuns(PagingRunFilterVO filter, PipelineRunFilterVO.ProjectFilter projectFilter) { MapSqlParameterSource params = getPagingParameters(filter); String query = wherePattern.matcher(searchPipelineRunsBaseQuery).replaceFirst(makeFilterCondition(filter, projectFilter, params, true)); return getNamedParameterJdbcTemplate().query(query, params, PipelineRunParameters.getExtendedRowMapper()); } public List<PipelineRun> searchPipelineGroups(PagingRunFilterVO filter, PipelineRunFilterVO.ProjectFilter projectFilter) { MapSqlParameterSource params = getPagingParameters(filter); String query = wherePattern.matcher(loadRunsGroupingQuery) .replaceFirst(makeFilterCondition(filter, projectFilter, params, false)); Collection<PipelineRun> runs = getNamedParameterJdbcTemplate() .query(query, params, PipelineRunParameters.getRunGroupExtractor()); return runs.stream() .filter(run -> run.getParentRunId() == null) .sorted(getPipelineRunComparator()) .collect(Collectors.toList()); } public Integer countRootRuns(PipelineRunFilterVO filter, PipelineRunFilterVO.ProjectFilter projectFilter) { MapSqlParameterSource params = new MapSqlParameterSource(); String query = wherePattern.matcher(countRunGroupsQuery).replaceFirst(makeFilterCondition(filter, projectFilter, params, false)); return getNamedParameterJdbcTemplate().queryForObject(query, params, Integer.class); } /** * Updates service url for the provided run in a database * @param run run with updated service url **/ @Transactional(propagation = Propagation.MANDATORY) public void updateServiceUrl(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateServiceUrlQuery, PipelineRunParameters .getParameters(run, getConnection())); } public int countFilteredPipelineRuns(PipelineRunFilterVO filter, PipelineRunFilterVO.ProjectFilter projectFilter) { MapSqlParameterSource params = new MapSqlParameterSource(); String query = wherePattern.matcher(countFilteredPipelineRunsBaseQuery).replaceFirst(makeFilterCondition(filter, projectFilter, params, true)); return getNamedParameterJdbcTemplate().queryForObject(query, params, Integer.class); } @Transactional(propagation = Propagation.MANDATORY) public void createRunSids(Long runId, List<RunSid> runSids) { if (CollectionUtils.isEmpty(runSids)) { return; } getNamedParameterJdbcTemplate().batchUpdate(createPipelineRunSidsQuery, PipelineRunParameters.getRunSidsParameters(runId, runSids)); } @Transactional(propagation = Propagation.MANDATORY) public void deleteRunSids(Long runId) { getJdbcTemplate().update(deleteRunSidsByRunIdQuery, runId); } private MapSqlParameterSource getPagingParameters(PagingRunFilterVO filter) { MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("LIMIT", filter.getPageSize()); params.addValue("OFFSET", (filter.getPage() - 1) * filter.getPageSize()); params.addValue(PipelineRunParameters.TASK_NAME.name(), initTaskName); params.addValue(PipelineRunParameters.TASK_STATUS.name(), initTaskStatus.ordinal()); return params; } private int addOwnerClause(MapSqlParameterSource params, StringBuilder whereBuilder, int clausesCount, List<String> owners) { if (!CollectionUtils.isEmpty(owners)) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" lower(r.owner) in (:") .append(PipelineRunParameters.OWNER.name()) .append(')'); params.addValue(PipelineRunParameters.OWNER.name(), owners.stream().map(String::toLowerCase).collect(Collectors.toList())); clausesCount++; } return clausesCount; } private String makeFilterCondition(PipelineRunFilterVO filter, PipelineRunFilterVO.ProjectFilter projectFilter, MapSqlParameterSource params, boolean firstCondition) { if (filter.isEmpty()) { return ""; } StringBuilder whereBuilder = new StringBuilder(); int clausesCount = firstCondition ? 0 : 1; if (firstCondition) { whereBuilder.append(" WHERE "); } if (CollectionUtils.isNotEmpty(filter.getVersions())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.version in (:") .append(PipelineRunParameters.VERSION.name()) .append(')'); params.addValue(PipelineRunParameters.VERSION.name(), filter.getVersions()); clausesCount++; } clausesCount = addOwnerClause(params, whereBuilder, clausesCount, filter.getOwners()); if (CollectionUtils.isNotEmpty(filter.getPipelineIds())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.pipeline_id in (:") .append(PipelineRunParameters.PIPELINE_ID.name()) .append(')'); params.addValue(PipelineRunParameters.PIPELINE_ID.name(), filter.getPipelineIds()); clausesCount++; } if (CollectionUtils.isNotEmpty(filter.getDockerImages())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.docker_image like any (array[ :") .append(PipelineRunParameters.DOCKER_IMAGE.name()) .append(" ])"); List<String> dockerImages = new ArrayList<>(); filter.getDockerImages().forEach(di -> { dockerImages.add(di); dockerImages.add(di + ":%"); }); params.addValue(PipelineRunParameters.DOCKER_IMAGE.name(), dockerImages); clausesCount++; } if (CollectionUtils.isNotEmpty(filter.getStatuses())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.status in (:") .append(PipelineRunParameters.STATUS.name()) .append(')'); params.addValue(PipelineRunParameters.STATUS.name(), filter.getStatuses() .stream().map(TaskStatus::getId).collect(Collectors.toList())); clausesCount++; } if (filter.getStartDateFrom() != null) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.start_date >= :").append(PipelineRunParameters.START_DATE_FROM.name()); params.addValue(PipelineRunParameters.START_DATE_FROM.name(), filter.getStartDateFrom()); clausesCount++; } if (filter.getEndDateTo() != null) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.end_date <= :").append(PipelineRunParameters.END_DATE_TO.name()); params.addValue(PipelineRunParameters.END_DATE_TO.name(), filter.getEndDateTo()); clausesCount++; } if (StringUtils.isNotBlank(filter.getPartialParameters())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(" r.parameters like :").append(PipelineRunParameters.PARAMETERS.name()); params.addValue(PipelineRunParameters.PARAMETERS.name(), String.format("%%%s%%", filter.getPartialParameters())); clausesCount++; } if (filter.getParentId() != null) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(String.format(" (r.parent_id = %d OR r.parameters = 'parent-id=%d' " + "OR r.parameters like " + "any(array['%%|parent-id=%d|%%','%%|parent-id=%d','parent-id=%d|%%', " + "'parent-id=%d=%%', '%%|parent-id=%d=%%']))", filter.getParentId(), filter.getParentId(), filter.getParentId(), filter.getParentId(), filter.getParentId(), filter.getParentId(), filter.getParentId())); clausesCount++; } if (CollectionUtils.isNotEmpty(filter.getEntitiesIds())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(String.format(" r.entities_ids && '%s'", mapListToSqlArray(filter.getEntitiesIds(), getConnection()))); clausesCount++; } if (CollectionUtils.isNotEmpty(filter.getConfigurationIds())) { appendAnd(whereBuilder, clausesCount); whereBuilder.append(String.format(" r.configuration_id IN (:%s)", PipelineRunParameters.CONFIGURATION_ID.name())); params.addValue(PipelineRunParameters.CONFIGURATION_ID.name(), filter.getConfigurationIds()); clausesCount++; } appendProjectFilter(projectFilter, params, whereBuilder, clausesCount); appendAclFilters(filter, params, whereBuilder, clausesCount); return whereBuilder.toString(); } private void appendAnd(StringBuilder whereBuilder, int clausesCount) { if (clausesCount > 0) { whereBuilder.append(AND); } } private void appendProjectFilter(PipelineRunFilterVO.ProjectFilter projectFilter, MapSqlParameterSource params, StringBuilder whereBuilder, int clausesCount) { if (projectFilter == null || projectFilter.isEmpty()) { return; } appendAnd(whereBuilder, clausesCount); whereBuilder.append('('); if (CollectionUtils.isNotEmpty(projectFilter.getPipelineIds())) { params.addValue(PipelineRunParameters.PROJECT_PIPELINES.name(), projectFilter.getPipelineIds()); whereBuilder.append( String.format(" r.pipeline_id in (:%s) ", PipelineRunParameters.PROJECT_PIPELINES.name())); if (CollectionUtils.isNotEmpty(projectFilter.getConfigurationIds())) { whereBuilder.append(" OR "); } } if (CollectionUtils.isNotEmpty(projectFilter.getConfigurationIds())) { params.addValue(PipelineRunParameters.PROJECT_CONFIGS.name(), projectFilter.getConfigurationIds()); whereBuilder.append(String.format(" r.configuration_id IN (:%s) ", PipelineRunParameters.PROJECT_CONFIGS.name())); } whereBuilder.append(')'); } private void appendAclFilters(PipelineRunFilterVO filter, MapSqlParameterSource params, StringBuilder whereBuilder, int clausesCount) { //ownership filter indicates that acl filtering is applied if (StringUtils.isNotBlank(filter.getOwnershipFilter())) { appendAnd(whereBuilder, clausesCount); params.addValue(PipelineRunParameters.OWNERSHIP.name(), filter.getOwnershipFilter().toLowerCase()); if (CollectionUtils.isNotEmpty(filter.getAllowedPipelines())) { whereBuilder.append(" (r.pipeline_id in (:") .append(PipelineRunParameters.PIPELINE_ALLOWED.name()) .append(") OR lower(r.owner) = :") .append(PipelineRunParameters.OWNERSHIP.name()).append(')'); params.addValue(PipelineRunParameters.PIPELINE_ALLOWED.name(), filter.getAllowedPipelines()); } else { whereBuilder.append(" lower(r.owner) = :").append(PipelineRunParameters.OWNERSHIP.name()); } } } private String makeRunSidsCondition(PipelineUser user, MapSqlParameterSource params) { StringBuilder whereBuilder = new StringBuilder(STRING_BUFFER_SIZE); whereBuilder.append(" WHERE "); if (StringUtils.isNotBlank(user.getUserName())) { whereBuilder.append("((is_principal = TRUE AND name = :") .append(PipelineRunParameters.NAME.name()).append(')'); params.addValue(PipelineRunParameters.NAME.name(), user.getUserName()); } if (CollectionUtils.isNotEmpty(user.getGroups())) { whereBuilder.append(" OR (is_principal = FALSE AND name IN (:USER_GROUPS))"); params.addValue("USER_GROUPS", user.getGroups()); } whereBuilder.append(')'); return whereBuilder.toString(); } public void updateProlongIdleRunAndLastIdleNotificationTime(PipelineRun run) { getNamedParameterJdbcTemplate().update(updateProlongedAtTimeAndLastIdleNotificationTimeQuery, PipelineRunParameters.getParameters(run, getConnection())); } public enum PipelineRunParameters { RUN_ID, PIPELINE_ID, VERSION, START_DATE, END_DATE, PARAMETERS, PARENT_ID, STATUS, COMMIT_STATUS, LAST_CHANGE_COMMIT_TIME, TERMINATING, POD_ID, PIPELINE_NAME, NODE_TYPE, NODE_IP, NODE_ID, NODE_DISK, NODE_IMAGE, NODE_NAME, NODE_AWS_REGION, DOCKER_IMAGE, CMD_TEMPLATE, ACTUAL_CMD, TIMEOUT, OWNER, SERVICE_URL, PIPELINE_ALLOWED, OWNERSHIP, POD_IP, SSH_PASSWORD, CONFIG_NAME, NODE_COUNT, START_DATE_FROM, END_DATE_TO, INITIALIZATION_FINISHED, TASK_NAME, TASK_STATUS, ENTITIES_IDS, IS_SPOT, CONFIGURATION_ID, NAME, IS_PRINCIPAL, POD_STATUS, ENV_VARS, LAST_NOTIFICATION_TIME, PROLONGED_AT_TIME, LAST_IDLE_NOTIFICATION_TIME, PROJECT_PIPELINES, PROJECT_CONFIGS, EXEC_PREFERENCES, PRETTY_URL, PRICE_PER_HOUR, STATE_REASON, NON_PAUSE, NODE_REAL_DISK; static MapSqlParameterSource getParameters(PipelineRun run, Connection connection) { MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue(RUN_ID.name(), run.getId()); params.addValue(PIPELINE_ID.name(), run.getPipelineId()); params.addValue(VERSION.name(), run.getVersion()); params.addValue(START_DATE.name(), run.getStartDate()); params.addValue(END_DATE.name(), run.getEndDate()); params.addValue(PARAMETERS.name(), run.getParams()); params.addValue(STATUS.name(), run.getStatus().getId()); params.addValue(COMMIT_STATUS.name(), run.getCommitStatus().getId()); params.addValue(LAST_CHANGE_COMMIT_TIME.name(), run.getLastChangeCommitTime()); params.addValue(TERMINATING.name(), run.isTerminating()); params.addValue(POD_ID.name(), run.getPodId()); params.addValue(TIMEOUT.name(), run.getTimeout()); params.addValue(DOCKER_IMAGE.name(), run.getDockerImage()); params.addValue(CMD_TEMPLATE.name(), run.getCmdTemplate()); params.addValue(ACTUAL_CMD.name(), run.getActualCmd()); params.addValue(OWNER.name(), run.getOwner()); params.addValue(SERVICE_URL.name(), run.getServiceUrl()); params.addValue(POD_IP.name(), run.getPodIP()); params.addValue(SSH_PASSWORD.name(), run.getSshPassword()); params.addValue(CONFIG_NAME.name(), run.getConfigName()); params.addValue(NODE_COUNT.name(), run.getNodeCount()); params.addValue(PARENT_ID.name(), run.getParentRunId()); params.addValue(ENTITIES_IDS.name(), mapListToSqlArray(run.getEntitiesIds(), connection)); params.addValue(CONFIGURATION_ID.name(), run.getConfigurationId()); params.addValue(POD_STATUS.name(), run.getPodStatus()); params.addValue(ENV_VARS.name(), JsonMapper.convertDataToJsonStringForQuery(run.getEnvVars())); params.addValue(PROLONGED_AT_TIME.name(), run.getProlongedAtTime()); params.addValue(LAST_NOTIFICATION_TIME.name(), run.getLastNotificationTime()); params.addValue(LAST_IDLE_NOTIFICATION_TIME.name(), run.getLastIdleNotificationTime()); params.addValue(EXEC_PREFERENCES.name(), JsonMapper.convertDataToJsonStringForQuery(run.getExecutionPreferences())); params.addValue(PRETTY_URL.name(), run.getPrettyUrl()); params.addValue(PRICE_PER_HOUR.name(), run.getPricePerHour()); params.addValue(STATE_REASON.name(), run.getStateReasonMessage()); params.addValue(NON_PAUSE.name(), run.isNonPause()); addInstanceFields(run, params); return params; } private static void addInstanceFields(PipelineRun run, MapSqlParameterSource params) { Optional<RunInstance> instance = Optional.ofNullable(run.getInstance()); params.addValue(NODE_TYPE.name(), instance.map(RunInstance::getNodeType).orElse(null)); params.addValue(NODE_IP.name(), instance.map(RunInstance::getNodeIP).orElse(null)); params.addValue(NODE_ID.name(), instance.map(RunInstance::getNodeId).orElse(null)); params.addValue(NODE_DISK.name(), instance.map(RunInstance::getNodeDisk).orElse(null)); params.addValue(NODE_IMAGE.name(), instance.map(RunInstance::getNodeImage).orElse(null)); params.addValue(NODE_NAME.name(), instance.map(RunInstance::getNodeName).orElse(null)); params.addValue(IS_SPOT.name(), instance.map(RunInstance::getSpot).orElse(null)); params.addValue(NODE_AWS_REGION.name(), instance.map(RunInstance::getAwsRegionId).orElse(null)); params.addValue(NODE_REAL_DISK.name(), instance.map(RunInstance::getEffectiveNodeDisk).orElse(null)); } static ResultSetExtractor<Collection<PipelineRun>> getRunGroupExtractor() { return (rs) -> { Map<Long, PipelineRun> runs = new HashMap<>(); Map<Long, List<PipelineRun>> childRuns = new HashMap<>(); while (rs.next()) { PipelineRun run = parsePipelineRun(rs); run.setPipelineName(rs.getString(PIPELINE_NAME.name())); run.setInitialized(rs.getBoolean(INITIALIZATION_FINISHED.name())); runs.put(run.getId(), run); if (run.getParentRunId() != null) { childRuns.putIfAbsent(run.getParentRunId(), new ArrayList<>()); childRuns.get(run.getParentRunId()).add(run); } } runs.values().forEach(run -> { if (childRuns.containsKey(run.getId())) { List<PipelineRun> children = childRuns.get(run.getId()); children.sort(getPipelineRunComparator()); run.setChildRuns(children); } }); return runs.values(); }; } static RowMapper<PipelineRun> getRowMapper() { return (rs, rowNum) -> parsePipelineRun(rs); } public static PipelineRun parsePipelineRun(ResultSet rs) throws SQLException { PipelineRun run = new PipelineRun(); run.setId(rs.getLong(RUN_ID.name())); long pipelineId = rs.getLong(PIPELINE_ID.name()); if (!rs.wasNull()) { run.setPipelineId(pipelineId); run.setParent(new Pipeline(pipelineId)); } run.setVersion(rs.getString(VERSION.name())); run.setStartDate(new Date(rs.getTimestamp(START_DATE.name()).getTime())); run.setParams(rs.getString(PARAMETERS.name())); run.setStatus(TaskStatus.getById(rs.getLong(STATUS.name()))); run.setCommitStatus(CommitStatus.getById(rs.getLong(COMMIT_STATUS.name()))); run.setLastChangeCommitTime(new Date(rs.getTimestamp(LAST_CHANGE_COMMIT_TIME.name()).getTime())); run.setTerminating(rs.getBoolean(TERMINATING.name())); run.setPodId(rs.getString(POD_ID.name())); run.setPodIP(rs.getString(POD_IP.name())); run.setOwner(rs.getString(OWNER.name())); run.setConfigName(rs.getString(CONFIG_NAME.name())); run.setNodeCount(rs.getInt(NODE_COUNT.name())); run.setExecutionPreferences(JsonMapper.parseData(rs.getString(EXEC_PREFERENCES.name()), new TypeReference<ExecutionPreferences>() {})); Timestamp end = rs.getTimestamp(END_DATE.name()); if (!rs.wasNull()) { run.setEndDate(new Date(end.getTime())); } run.setDockerImage(rs.getString(DOCKER_IMAGE.name())); run.setCmdTemplate(rs.getString(CMD_TEMPLATE.name())); run.setActualCmd(rs.getString(ACTUAL_CMD.name())); RunInstance instance = new RunInstance(); instance.setNodeDisk(rs.getInt(NODE_DISK.name())); instance.setEffectiveNodeDisk(rs.getInt(NODE_REAL_DISK.name())); instance.setNodeId(rs.getString(NODE_ID.name())); instance.setNodeIP(rs.getString(NODE_IP.name())); instance.setNodeType(rs.getString(NODE_TYPE.name())); instance.setNodeImage(rs.getString(NODE_IMAGE.name())); instance.setNodeName(rs.getString(NODE_NAME.name())); instance.setAwsRegionId(rs.getString(NODE_AWS_REGION.name())); boolean spot = rs.getBoolean(IS_SPOT.name()); if (!rs.wasNull()) { instance.setSpot(spot); } if (!instance.isEmpty()) { run.setInstance(instance); } run.setTimeout(rs.getLong(TIMEOUT.name())); run.setServiceUrl(rs.getString(SERVICE_URL.name())); Long parentRunId = rs.getLong(PARENT_ID.name()); if (!rs.wasNull()) { run.setParentRunId(parentRunId); } run.parseParameters(); Array entitiesIdsArray = rs.getArray(ENTITIES_IDS.name()); if (entitiesIdsArray != null) { List<Long> entitiesIds = Arrays.asList((Long[]) entitiesIdsArray.getArray()); run.setEntitiesIds(entitiesIds); } run.setConfigurationId(rs.getLong(CONFIGURATION_ID.name())); run.setPodStatus(rs.getString(POD_STATUS.name())); Timestamp lastNotificationTime = rs.getTimestamp(LAST_NOTIFICATION_TIME.name()); if (!rs.wasNull()) { run.setLastNotificationTime(new Date(lastNotificationTime.getTime())); } Timestamp lastIdleNotifiactionTime = rs.getTimestamp(LAST_IDLE_NOTIFICATION_TIME.name()); if (!rs.wasNull()) { run.setLastIdleNotificationTime(lastIdleNotifiactionTime.toLocalDateTime()); // convert to UTC } Timestamp idleNotificationStartingTime = rs.getTimestamp(PROLONGED_AT_TIME.name()); if (!rs.wasNull()) { run.setProlongedAtTime(idleNotificationStartingTime.toLocalDateTime()); } run.setPrettyUrl(rs.getString(PRETTY_URL.name())); run.setPricePerHour(rs.getBigDecimal(PRICE_PER_HOUR.name())); String stateReasonMessage = rs.getString(STATE_REASON.name()); if (!rs.wasNull()) { run.setStateReasonMessage(stateReasonMessage); } boolean nonPause = rs.getBoolean(NON_PAUSE.name()); if (!rs.wasNull()) { run.setNonPause(nonPause); } return run; } static RowMapper<PipelineRun> getExtendedRowMapper() { return getExtendedRowMapper(false); } static RowMapper<PipelineRun> getExtendedRowMapper(final boolean loadEnvVars) { return (rs, rowNum) -> { PipelineRun run = parsePipelineRun(rs); run.setPipelineName(rs.getString(PIPELINE_NAME.name())); run.setInitialized(rs.getBoolean(INITIALIZATION_FINISHED.name())); if (loadEnvVars) { run.setEnvVars(getEnvVarsRowMapper().mapRow(rs, rowNum)); } return run; }; } static RowMapper<String> getPasswordRowMapper() { return (rs, rowNum) -> rs.getString(SSH_PASSWORD.name()); } static MapSqlParameterSource[] getRunSidsParameters(Long runId, List<RunSid> runSids) { MapSqlParameterSource[] sqlParameterSource = new MapSqlParameterSource[runSids.size()]; for (int i = 0; i < runSids.size(); i++) { MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue(RUN_ID.name(), runId); params.addValue(NAME.name(), runSids.get(i).getName()); params.addValue(IS_PRINCIPAL.name(), runSids.get(i).getIsPrincipal()); sqlParameterSource[i] = params; } return sqlParameterSource; } static RowMapper<RunSid> getRunSidsRowMapper() { return (rs, rowNum) -> { RunSid runSid = new RunSid(); runSid.setName(rs.getString(NAME.name())); runSid.setIsPrincipal(rs.getBoolean(IS_PRINCIPAL.name())); return runSid; }; } static RowMapper<Map<String, String>> getEnvVarsRowMapper() { return (rs, rowNum) -> JsonMapper.parseData(rs.getString(ENV_VARS.name()), new TypeReference<Map<String, String>>() {}); } } private static Array mapListToSqlArray(List<Long> list, Connection connection) { Long[] emptyArray = new Long[0]; Long[] javaArray = list != null ? list.toArray(emptyArray) : emptyArray; Array sqlArray; try { sqlArray = connection.createArrayOf(POSTGRE_TYPE_BIGINT, javaArray); } catch (SQLException e) { throw new IllegalArgumentException("Cannot convert data to SQL Array"); } return sqlArray; } private static Comparator<BaseEntity> getPipelineRunComparator() { return Comparator.comparing(BaseEntity::getId).reversed(); } @Required public void setPipelineRunSequence(String pipelineRunSequence) { this.pipelineRunSequence = pipelineRunSequence; } @Required public void setCreatePipelineRunQuery(String createPipelineRunQuery) { this.createPipelineRunQuery = createPipelineRunQuery; } @Required public void setLoadAllRunsByVersionIdQuery(String loadAllRunsByVersionIdQuery) { this.loadAllRunsByVersionIdQuery = loadAllRunsByVersionIdQuery; } @Required public void setUpdateRunStatusQuery(String updateRunStatusQuery) { this.updateRunStatusQuery = updateRunStatusQuery; } @Required public void setUpdateRunCommitStatusQuery(String updateRunCommitStatusQuery) { this.updateRunCommitStatusQuery = updateRunCommitStatusQuery; } @Required public void setLoadRunByIdQuery(String loadRunByIdQuery) { this.loadRunByIdQuery = loadRunByIdQuery; } @Required public void setLoadPipelineRunsWithPipelineByIdsQuery(String loadPipelineRunsWithPipelineByIdsQuery) { this.loadPipelineRunsWithPipelineByIdsQuery = loadPipelineRunsWithPipelineByIdsQuery; } @Required public void setLoadAllRunsByPipelineIdQuery(String loadAllRunsByPipelineIdQuery) { this.loadAllRunsByPipelineIdQuery = loadAllRunsByPipelineIdQuery; } @Required public void setLoadAllRunsByPipelineIdAndVersionQuery(String loadAllRunsByPipelineIdAndVersionQuery) { this.loadAllRunsByPipelineIdAndVersionQuery = loadAllRunsByPipelineIdAndVersionQuery; } @Required public void setLoadRunningAndTerminatedPipelineRunsQuery(String loadRunningAndTerminatedPipelineRunsQuery) { this.loadRunningAndTerminatedPipelineRunsQuery = loadRunningAndTerminatedPipelineRunsQuery; } @Required public void setLoadActiveServicesQuery(String loadActiveServicesQuery) { this.loadActiveServicesQuery = loadActiveServicesQuery; } @Required public void setCountActiveServicesQuery(String countActiveServicesQuery) { this.countActiveServicesQuery = countActiveServicesQuery; } @Required public void setLoadTerminatingPipelineRunsQuery(String loadTerminatingPipelineRunsQuery) { this.loadTerminatingPipelineRunsQuery = loadTerminatingPipelineRunsQuery; } @Required public void setSearchPipelineRunsBaseQuery(String searchPipelineRunsBaseQuery) { this.searchPipelineRunsBaseQuery = searchPipelineRunsBaseQuery; } @Required public void setCountFilteredPipelineRunsBaseQuery(String countFilteredPipelineRunsBaseQuery) { this.countFilteredPipelineRunsBaseQuery = countFilteredPipelineRunsBaseQuery; } @Required public void setUpdateRunInstanceQuery(String updateRunInstanceQuery) { this.updateRunInstanceQuery = updateRunInstanceQuery; } @Required public void setDeleteRunsByPipelineQuery(String deleteRunsByPipelineQuery) { this.deleteRunsByPipelineQuery = deleteRunsByPipelineQuery; } @Required public void setUpdateServiceUrlQuery(String updateServiceUrlQuery) { this.updateServiceUrlQuery = updateServiceUrlQuery; } @Required public void setUpdatePodIPQuery(String updatePodIPQuery) { this.updatePodIPQuery = updatePodIPQuery; } @Required public void setLoadSshPasswordQuery(String loadSshPasswordQuery) { this.loadSshPasswordQuery = loadSshPasswordQuery; } @Required public void setLoadRunsGroupingQuery(String loadRunsGroupingQuery) { this.loadRunsGroupingQuery = loadRunsGroupingQuery; } @Required public void setCreatePipelineRunSidsQuery(String createPipelineRunSidsQuery) { this.createPipelineRunSidsQuery = createPipelineRunSidsQuery; } @Required public void setDeleteRunSidsByRunIdQuery(String deleteRunSidsByRunIdQuery) { this.deleteRunSidsByRunIdQuery = deleteRunSidsByRunIdQuery; } @Required public void setLoadRunSidsQuery(String loadRunSidsQuery) { this.loadRunSidsQuery = loadRunSidsQuery; } @Required public void setCountRunGroupsQuery(String countRunGroupsQuery) { this.countRunGroupsQuery = countRunGroupsQuery; } @Required public void setUpdatePodStatusQuery(String updatePodStatusQuery) { this.updatePodStatusQuery = updatePodStatusQuery; } @Required public void setUpdateProlongedAtTimeAndLastIdleNotificationTimeQuery( String updateProlongedAtTimeAndLastIdleNotificationTimeQuery) { this.updateProlongedAtTimeAndLastIdleNotificationTimeQuery = updateProlongedAtTimeAndLastIdleNotificationTimeQuery; } @Required public void setLoadEnvVarsQuery(String loadEnvVarsQuery) { this.loadEnvVarsQuery = loadEnvVarsQuery; } @Required public void setUpdateLastNotificationQuery(String updateLastNotificationQuery) { this.updateLastNotificationQuery = updateLastNotificationQuery; } @Required public void setUpdateRunQuery(String updateRunQuery) { this.updateRunQuery = updateRunQuery; } @Required public void setLoadRunByPrettyUrlQuery(String loadRunByPrettyUrlQuery) { this.loadRunByPrettyUrlQuery = loadRunByPrettyUrlQuery; } @Required public void setLoadRunningPipelineRunsQuery(String loadRunningPipelineRunsQuery) { this.loadRunningPipelineRunsQuery = loadRunningPipelineRunsQuery; } }
[ "aleksandr_sidoruk@epam.com" ]
aleksandr_sidoruk@epam.com
4032ddd14aaa953aa698a353d2bda40a658c642a
0b8feb2dee98c9eae90b39696fb0b43ab93d47af
/course-api/src/main/java/io/javabrains/springbootstarter/course/CourseService.java
801ea39047de566ee39eacf70929c3444a0902ff
[]
no_license
jkarvelis22/carparts-tools-and-extension
8493c0d32d612628762f8aec5e00ed32693471ba
0b263075ce95ee5df624ed0bc3cd22b99b76810e
refs/heads/master
2020-07-09T07:36:56.259631
2019-08-23T03:30:04
2019-08-23T03:30:04
203,916,825
0
1
null
null
null
null
UTF-8
Java
false
false
935
java
//package io.javabrains.springbootstarter.course; // //import java.util.ArrayList; //import java.util.Arrays; //import java.util.List; // //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.stereotype.Service; // //@Service //public class CourseService { // // @Autowired // private CourseRepository courseRepo; // // public List<Course> getAllCourses(String topicId){ // List<Course> topics = new ArrayList<>(); // courseRepo.findByTopicId(topicId) // .forEach(topics::add); // return topics; // } // // public Course getCourse(String id) { // return courseRepo.findOne(id); // } // // public void addCourse(Course topic) { // courseRepo.save(topic); // // } // // public void updateCourse(Course topic) { // courseRepo.save(topic); // } // // // public void deleteCourse(String id) { // //topics.removeIf(t -> t.getId().equals(id)); // courseRepo.delete(id); // // } //} //
[ "karvelis.josh@gmail.com" ]
karvelis.josh@gmail.com
f5f68c883e5d966487d97a1bd504cec99bc7fd69
4e9c06ff59fe91f0f69cb3dd80a128f466885aea
/src/o/ﮆ.java
95885aa5707782c981f919b3dd5382ab3058f364
[]
no_license
reverseengineeringer/com.eclipsim.gpsstatus2
5ab9959cc3280d2dc96f2247c1263d14c893fc93
800552a53c11742c6889836a25b688d43ae68c2e
refs/heads/master
2021-01-17T07:26:14.357187
2016-07-21T03:33:07
2016-07-21T03:33:07
63,834,134
0
0
null
null
null
null
UTF-8
Java
false
false
2,642
java
package o; import android.os.Build.VERSION; import android.view.View; import android.widget.PopupWindow; public final class ﮆ { static final aux bR = new ˋ(); static { int i = Build.VERSION.SDK_INT; if (i >= 23) { bR = new ˊ(); return; } if (i >= 21) { bR = new if(); return; } if (i >= 19) { bR = new ˏ(); return; } if (i >= 9) { bR = new ˎ(); return; } } public static void ˊ(PopupWindow paramPopupWindow, int paramInt) { bR.ˊ(paramPopupWindow, paramInt); } public static void ˊ(PopupWindow paramPopupWindow, View paramView, int paramInt1, int paramInt2, int paramInt3) { bR.ˊ(paramPopupWindow, paramView, paramInt1, paramInt2, paramInt3); } public static void ˊ(PopupWindow paramPopupWindow, boolean paramBoolean) { bR.ˊ(paramPopupWindow, paramBoolean); } static abstract interface aux { public abstract void ˊ(PopupWindow paramPopupWindow, int paramInt); public abstract void ˊ(PopupWindow paramPopupWindow, View paramView, int paramInt1, int paramInt2, int paramInt3); public abstract void ˊ(PopupWindow paramPopupWindow, boolean paramBoolean); } static class if extends ﮆ.ˏ { public void ˊ(PopupWindow paramPopupWindow, boolean paramBoolean) { ﹱ.ˊ(paramPopupWindow, paramBoolean); } } static class ˊ extends ﮆ.if { public void ˊ(PopupWindow paramPopupWindow, int paramInt) { ﺀ.ˊ(paramPopupWindow, paramInt); } public void ˊ(PopupWindow paramPopupWindow, boolean paramBoolean) { ﺀ.ˊ(paramPopupWindow, paramBoolean); } } static class ˋ implements ﮆ.aux { public void ˊ(PopupWindow paramPopupWindow, int paramInt) {} public void ˊ(PopupWindow paramPopupWindow, View paramView, int paramInt1, int paramInt2, int paramInt3) { paramPopupWindow.showAsDropDown(paramView, paramInt1, paramInt2); } public void ˊ(PopupWindow paramPopupWindow, boolean paramBoolean) {} } static class ˎ extends ﮆ.ˋ { public void ˊ(PopupWindow paramPopupWindow, int paramInt) { ﺪ.ˊ(paramPopupWindow, paramInt); } } static class ˏ extends ﮆ.ˎ { public void ˊ(PopupWindow paramPopupWindow, View paramView, int paramInt1, int paramInt2, int paramInt3) { ﺭ.ˊ(paramPopupWindow, paramView, paramInt1, paramInt2, paramInt3); } } } /* Location: * Qualified Name: o.ﮆ * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "reverseengineeringer@hackeradmin.com" ]
reverseengineeringer@hackeradmin.com
af1f05b4fbc6a068fc893ad6ad95b3afbdddd0c1
59dc2c5e7c2182f1d9e1209ec48db75ea1cebda2
/src/main/java/com/sample/security/acl/domain/AclObjectIdentity.java
6115b5768c8df1f1a6590a1c004cac98f5658ca6
[]
no_license
fmoriguchi/spring-acl-sample
e809626ee4099268c7e8666b8f261663f33752cc
046fdb3654dccf2f09bbd77babd0ba5e39849dc8
refs/heads/master
2021-08-31T08:24:30.081386
2017-12-20T19:39:39
2017-12-20T19:39:39
114,924,116
0
0
null
null
null
null
UTF-8
Java
false
false
2,605
java
/** * */ package com.sample.security.acl.domain; import java.util.Collection; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; /** * @author fabio.moriguchi * */ @Entity @Table(name = "acl_object_identity") public class AclObjectIdentity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "object_id_identity") private Long objectId; @Transient @ManyToOne @JoinColumn(name = "object_id_class") private AclClass clazz; @Transient @ManyToOne @JoinColumn(name = "owner_sid") private AclSid owner; @Transient @ManyToOne @JoinColumn(name = "parent_object") private AclObjectIdentity parent; @Transient @OneToMany(fetch=FetchType.EAGER) @JoinColumn(name = "ID") private Collection<AclEntry> entries; @Column(name = "entries_inheriting") private Boolean entriesInheriting; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public AclClass getClazz() { return clazz; } public void setClazz(AclClass clazz) { this.clazz = clazz; } public AclSid getOwner() { return owner; } public void setOwner(AclSid owner) { this.owner = owner; } public AclObjectIdentity getParent() { return parent; } public void setParent(AclObjectIdentity parent) { this.parent = parent; } public Boolean getEntriesInheriting() { return entriesInheriting; } public void setEntriesInheriting(Boolean entriesInheriting) { this.entriesInheriting = entriesInheriting; } public Long getObjectId() { return objectId; } public void setObjectId(Long objectId) { this.objectId = objectId; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AclObjectIdentity other = (AclObjectIdentity) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
[ "fabio.moriguchi@softexpert.com" ]
fabio.moriguchi@softexpert.com
05405c575649f338316845ef03a3c021cb4b84fa
caa8c77572d699993c09d2e7ef1a4082d40f033d
/flota_core/src/main/java/com/incloud/hcp/mapper/MtrTipoPescaMapper.java
f199682279cb85272a9451eeca93fe6c28cc01ef
[]
no_license
pavelprincipe1998/flotabackend
235633cde4091b3540b2d1c51e8c372a410091eb
f68afc97e3f2e55b7130b783c3c54ab28717b65d
refs/heads/master
2022-12-01T05:34:17.205277
2020-08-18T22:30:18
2020-08-18T22:30:18
288,448,222
0
0
null
null
null
null
UTF-8
Java
false
false
704
java
/* * Project home: https://github.com/jaxio/celerio-angular-quickstart * * Source code generated by Celerio, an Open Source code generator by Jaxio. * Documentation: http://www.jaxio.com/documentation/celerio/ * Modificado por CARLOS BAZALAR * Email: cbazalarlarosa@gmail.com * Template pack-angular:src/main/java/mapper/EntityMapper.java.e.vm */ package com.incloud.hcp.mapper; import com.incloud.hcp.domain.MtrTipoPesca; import com.incloud.hcp.repository._framework.JPACustomMapperMybatis; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @Mapper @Repository public interface MtrTipoPescaMapper extends JPACustomMapperMybatis<MtrTipoPesca> { }
[ "pprincipe.cons@gmail.com" ]
pprincipe.cons@gmail.com
ff31b639d37bf8f64e2ae986e6392dcec147827a
f73a90f1e84616934014404bbe4672363a1d74f7
/JavaImproving/simple digit/src/main/java/IsNotSimple.java
549a32a103d552df36d995dc69102908826f7701
[]
no_license
dashsofron/ExtraStudyingActivity
a437aebe23bf0cbe10165441b34f050ebb341954
d956e53152e95348fb1cc7bd78f3453aa8a78a82
refs/heads/master
2023-07-20T05:24:51.332405
2021-08-21T04:01:05
2021-08-21T04:01:05
336,486,813
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
import java.util.concurrent.Callable; public class IsNotSimple implements Callable<Boolean> { int i; IsNotSimple(int i){ this.i=i; } public Boolean call (){ for (int k = 2; k <= Math.sqrt(i); k++) { if (i % k == 0) return true; } return false; } }
[ "d.sofronova1@g.nsu.ru" ]
d.sofronova1@g.nsu.ru
ec519c08f4879fc3f267fbe1f6b758a4b2fa6e60
e6120d68d2b83e065c46d920ef1546812a9e1bc8
/src/main/java/sla/umbra/UmbraConfig.java
826628ff0fa764c1ef0c4760f6f2ea94edf39a2f
[]
no_license
ShadowLordAlpha/Umbra
c5cf055142be175dddfce84d27941c43c45271c0
eb70b0457b98960963c91b19e3221a9dd671e714
refs/heads/master
2020-06-26T02:07:17.794858
2016-11-24T21:00:06
2016-11-24T21:00:06
74,605,947
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package sla.umbra; public class UmbraConfig { public static final String MOD_ID = "umbra"; public static final String UPDATE_JSON = "https://raw.githubusercontent.com/ShadowLordAlpha/Umbra/master/update.json"; }
[ "shadow.alpha70@gmail.com" ]
shadow.alpha70@gmail.com
7db9f422152a2b84a7834de7086aea55dc5a48b1
ec56d04a53cccd2f1e2df2c4ef93688f145a3401
/app/src/main/java/com/grademojo/forex_2/Forex_Article_6.java
fbef0ff7e3f7b9532b7dd2047d21f0d0d36a9d5b
[]
no_license
manitkumar12/Forex_2
9c7a7f48df7ab254aecee418de4293d23c908a29
8630794a37122b762594656138c662fbe41012dc
refs/heads/master
2021-07-09T23:29:23.421279
2017-10-10T04:58:11
2017-10-10T04:58:11
103,223,704
0
0
null
null
null
null
UTF-8
Java
false
false
5,017
java
package com.grademojo.forex_2; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.TextView; import com.grademojo.forex.R; import java.util.ArrayList; import java.util.List; import java.util.Vector; /** * Created by sapling_a0 on 21/8/17. */ public class Forex_Article_6 extends Fragment { private RecyclerView recyclerView_4, recyclerView_5; private WebView webView; private TextView textView_hometask, textView_article; private My_Course_Forex_Adapter my_course_forex_adapter; private YouTube_Adapter_class youTube_adapter_class; private Vector<You_tube_Video> you_tube_videos= new Vector<You_tube_Video>(); private RecyclerView.LayoutManager mLayoutManager; private List<My_Course_Forex_Pojo> input; String frameVideo = "<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/e-EL0Mf4MTs?rel=0\" frameborder=\"0\" allowfullscreen></iframe>? autoplay = 1"; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.forex_video_6, container, false); recyclerView_4 = (RecyclerView) rootView.findViewById(R.id.recycler_view_4); // recyclerView_5 = (RecyclerView) rootView.findViewById(R.id.recycler_view_5); // // recyclerView_5.setLayoutManager(new LinearLayoutManager(getActivity())); // recyclerView_5.setHasFixedSize(true); webView = (WebView) rootView.findViewById(R.id.web); webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false; } }); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webView.loadData(frameVideo, "text/html", "utf-8"); // you_tube_videos.add(new You_tube_Video("<iframe width=\"100%\" height=\"100%\" src=\"https://www.youtube.com/embed/e-EL0Mf4MTs\" frameborder=\"0\" allowfullscreen></iframe> ? autoplay = 1")); // // // // youTube_adapter_class= new YouTube_Adapter_class(you_tube_videos); // // recyclerView_5.setAdapter(youTube_adapter_class); mLayoutManager = new LinearLayoutManager(getActivity()); recyclerView_4.setLayoutManager(mLayoutManager); input = new ArrayList<>(); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "What is Forex? ", R.color.grey,"3-min","5 points")); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon,"When can I trade Forex ?" , R.color.grey,"3-min","5 points" )); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "Why trade forex", R.color.grey,"4-min","5 points" )); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "Charting Basics " , R.color.grey,"3-min","5 points" )); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "Understanding Technical \n Analysis", R.color.grey,"3-min","5 points" )); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "Five Key Drivers of \nthe Forex Markets", R.color.grey,"5-min" ,"5 points" )); input.add(new My_Course_Forex_Pojo( R.drawable.grey_icon, "What Is Fundamental \n Analysis", R.color.grey,"4-min","5 points" )); // my_course_forex_adapter = new My_Course_Forex_Adapter(input, new My_Course_Forex_Adapter.AdapToParentListener() { @Override public void adapToParent(int position) { click(position); } }); recyclerView_4.setAdapter(my_course_forex_adapter); return rootView; } private void click(int position) { if (position==0) { Intent i = new Intent(getActivity(),Beginner_forex_video_first_question.class); startActivity(i); } if (position==1) { Intent i = new Intent(getActivity(),Beginner_forex_video_second_question.class); startActivity(i); } if (position==2) { Intent i = new Intent(getActivity(),Beginner_forex_video_third_question.class); startActivity(i); } } }
[ "ermanit007@gmail.com" ]
ermanit007@gmail.com
6eb4663e73087d3fca3bf911aab215d5b692deaa
d96880d3d3cb0aac81791dc15f2604bca48c54b3
/src/main/java/com/dongweirj/services/persist/PersistContext.java
3c398b5787a6dd0ad121b175abe1c0992c702729
[ "Apache-2.0" ]
permissive
firefly-uics/pi-dcp
8f142b54c89489763e1decad4f71d9227f3c8d0f
9e25e1672e00a8f1def00d834115b083af0d8764
refs/heads/master
2020-04-28T04:07:41.158207
2019-04-19T07:42:48
2019-04-19T07:42:48
174,965,809
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package com.dongweirj.services.persist; import com.alibaba.fastjson.JSONObject; /** * Created by dw on 2017/2/21. */ public class PersistContext { private Long dashboardId; private JSONObject data; public PersistContext(Long dashboardId) { this.dashboardId = dashboardId; } public Long getDashboardId() { return dashboardId; } public void setDashboardId(Long dashboardId) { this.dashboardId = dashboardId; } public JSONObject getData() { return data; } public void setData(JSONObject data) { this.data = data; } }
[ "bqw_5189@163.com" ]
bqw_5189@163.com
2d20cbb20e8b7bd1fd385866f12ac5296c7a1063
da5c6266e21c80bcfd84028e92a05ebafbf1f26f
/33state/com/css/state/player/State.java
ddc836144c1d5fb042ca7e99949146daccab32c4
[ "Apache-2.0" ]
permissive
lojack636/css-DesignPattern
a5be5f830eba0b132aeb5e48695efd2229f29c4b
212111f5b9c7d3bf54275edc78acccb115d6de44
refs/heads/main
2023-01-07T02:12:41.288107
2020-11-06T05:01:10
2020-11-06T05:01:10
315,516,314
1
0
Apache-2.0
2020-11-24T04:16:35
2020-11-24T04:16:27
null
UTF-8
Java
false
false
496
java
package com.css.state.player; /** * 状态工厂类 * * 中国软件与技术服务股份有限公司-设计模式培训(Java版) * * @author CSS. WangWeidong */ public class State { // 播放 public final static PlayState PLAY_STATE = new PlayState(); // 停止 public final static StopState STOP_STATE = new StopState(); // 快进 public final static SpeedState SPEED_STATE = new SpeedState(); // 暂停 public final static PauseState PAUSE_STATE = new PauseState(); }
[ "wangwd@css.com.cn" ]
wangwd@css.com.cn
3ea79edc177e94e2564395fd0f8ac85c99afd085
7cb4b416a77d618432b813d46f9fba1bf06a775a
/src/main/java/foutain/donald/atmproject/bettercopy/Tests/UserFactoryTests.java
1ef6ee68c55abf4a1a3261eac731afdba9047428
[]
no_license
blessed0886/ZCW-MacroLabs-OOP-ATM
c327482bec7a369f89a663e5efaf45331b40e9b5
7a047f3fe0e21cef1b1d943ee288927a6d87eb70
refs/heads/master
2021-05-08T02:33:38.963873
2017-10-25T23:32:05
2017-10-25T23:32:05
108,002,538
0
0
null
2017-10-23T15:38:29
2017-10-23T15:38:28
null
UTF-8
Java
false
false
1,383
java
package foutain.donald.atmproject.bettercopy.Tests; import foutain.donald.atmproject.bettercopy.UserFunctions.User; import foutain.donald.atmproject.bettercopy.UserFunctions.UserFactory; import org.junit.Assert; import org.junit.Test; public class UserFactoryTests { /*@Test public void createNewUserTest(){ //Given: UserFactory newUser = new UserFactory(); String expected = "Donald Fountain" + "Password"; //When; String password = "Password"; String userName = "Donald Fountain"; User expectedInput = newUser.createNewUser(userName, password); String outPut = expectedInput.getUserName() + expectedInput.getUserPassword(); //Then: Assert.assertEquals(expected, outPut); } */ @Test public void createNewUserTestLeon(){ //Given: UserFactory userCreator = new UserFactory(); String expectedUsername = "Donald Fountain"; String expectedPassword = "Password"; // : When User expectedUser = userCreator.createNewUser(expectedUsername, expectedPassword); String actualUsername = expectedUser.getUserName(); String actualPassword = expectedUser.getUserPassword(); // : Then Assert.assertEquals(expectedPassword, actualPassword); Assert.assertEquals(expectedUsername, actualUsername); } }
[ "donaldf@zipcoders-MacBook-Pro-4.local" ]
donaldf@zipcoders-MacBook-Pro-4.local
1c56fc60d6103d68440f18b7aa465c8cde220adb
2647cf87b547b7f1e1ea3718f744f1ad3fd6834d
/src/it/unitn/LODE/services/SlideImporter.java
05df3292c6fc9903c86581eea07a641a9c8f887c
[]
no_license
tizianolattisi/LODE_1.4_2.0_merge
abf48d35675661ddec2e734a13295a17acc449ef
95bf7054df857ec80a6f40ab77ab37bdfead30b7
refs/heads/master
2016-09-03T07:19:57.450901
2014-11-26T17:14:52
2014-11-26T17:14:52
28,686,493
0
0
null
null
null
null
UTF-8
Java
false
false
15,917
java
package it.unitn.LODE.services; /** * SlideImporter.java * */ import it.unitn.LODE.Controllers.ControllersManager; import it.unitn.LODE.MP.constants.LODEConstants; import it.unitn.LODE.Models.Lecture; import it.unitn.LODE.Models.ProgramState; import it.unitn.LODE.gui.AcquisitionWindow; import it.unitn.LODE.gui.InspectorWindow; import it.unitn.LODE.gui.ProgressBar; import it.unitn.LODE.services.slides.PDFParser; import it.unitn.LODE.services.slides.PPTParser; import it.unitn.LODE.MP.utils.CorrectPathFinder; import it.unitn.LODE.utils.FileSystemManager; import it.unitn.LODE.utils.Messanger; import java.io.File; import java.io.IOException; import javax.swing.JOptionPane; public class SlideImporter { // ========== SOLITON PATTERN ============================================== static SlideImporter instance=null; public static synchronized SlideImporter getInstance(){ if (instance==null) instance=new SlideImporter(); return instance; } private SlideImporter() { fileSystemManager=ControllersManager.getinstance().getFileSystemManager(); messanger=ControllersManager.getinstance().getMessanger(); } //========================================================================== FileSystemManager fileSystemManager; Messanger messanger; public static final int REPLACE=2; public static final int APPEND=1; public static final int DO_NOTHING=0; /** * Import images, titles and text from ppt or pdf files.<br> * Known issues: for pdf files text and title are not yet imported,<br> * The quality of the jpgs produced by pdf is much higher than that produced by ppt! * * @param lecture the lecture into which slides are imported * @param extension the type of file (only ppt and pdf are supported * - null if you want to import fake slades as placeholders) */ public final void importSlides(Lecture lecture,String extension){ // place where the slides should be imported AcquisitionWindow acquisitionWindow=ControllersManager.getinstance().getAcquisitionWindow(); String destinationPath=lecture.getAcquisitionPath()+LODEConstants.ACQUISITION_IMG_SUBDIR; File destinationDir=new File(destinationPath); // check if this lecture already has slides and find if you want to replace or append int mode=checkExistingSlides(); if (mode==DO_NOTHING) return; if (mode==REPLACE) { lecture.zapSlides(); fileSystemManager.recursiveDelete(destinationDir); } if (! destinationDir.exists()) fileSystemManager.createFolder(destinationDir); int slidesAlreadyPresent=lecture.getSlideCount(); // temporary place where we shall find the slides String slidesDirectoryPath=LODEConstants.TEMP_DIR+LODEConstants.SLIDES_PREFIX; //Import slides depending on extension //================================= FAKE SLIDES ======================== if (extension==null) {// null extension, import fake slides // in the distribution app, filename is file:/path/.../Java/LODE.jar... // throw away head and tail! slidesDirectoryPath=CorrectPathFinder.getPath(LODEConstants.SLIDES_RES_PREFIX); File sourceFolder = new File(slidesDirectoryPath); String[] sourceFiles = sourceFolder.list(); int NUM_IMAGES = sourceFiles.length; int n=0; for (int i = 1; i <= NUM_IMAGES; i++) { n=i+slidesAlreadyPresent; String source=slidesDirectoryPath+i+".jpg"; String destination=destinationPath+LODEConstants.FS+n+".jpg"; System.out.println(source+"->"+destination); try { fileSystemManager.copyFiles(new File(destination),new File(source)); } catch (IOException ex) { fileSystemManager.cannotCopyMessage (ex, destinationPath, slidesDirectoryPath); } lecture.addSlide(n," Slide "+n," Slide "+n,LODEConstants.SLIDES_RES_PREFIX + n + ".jpg"); //System.out.println("ADD < Slide "+n+"><"+LODEConstants.SLIDES_RES_PREFIX + n + ".jpg>"); } lecture.addSlidesGroup("#PLACEHOLDERS#", slidesAlreadyPresent+1, n); lecture.persistSlides(); if (acquisitionWindow!=null) acquisitionWindow.redrawElements(); return; //================================= JPG ================================ } else if (extension.equalsIgnoreCase("jpg")) {// jpg extension, as generated from ppt try { slidesDirectoryPath=fileSystemManager.selectAFolderForReading(LODEConstants.WORKING_DIR); } catch (Exception ex) {ex.printStackTrace(messanger.getLogger()); return;} File sourceFolder = new File(slidesDirectoryPath); String[] sourceFiles = sourceFolder.list(); int NUM_IMAGES = sourceFiles.length; int n=0; for (int i = 1; i <= NUM_IMAGES; i++) { n=i+slidesAlreadyPresent; String source=slidesDirectoryPath+"Slide"+i+".jpg"; String destination=destinationPath+LODEConstants.FS+n+".jpg"; System.out.println(source+"->"+destination); try { fileSystemManager.copyFiles(new File(destination),new File(source)); } catch (IOException ex) { fileSystemManager.cannotCopyMessage (ex, destinationPath, slidesDirectoryPath); } lecture.addSlide(n," Slide "+n," Slide "+n,LODEConstants.SLIDES_PREFIX + n + ".jpg"); //System.out.println("ADD < Slide "+n+"><"+LODEConstants.SLIDES_RES_PREFIX + n + ".jpg>"); } lecture.addSlidesGroup("#JPEG#"+slidesDirectoryPath, slidesAlreadyPresent+1, n); lecture.persistSlides(); if (acquisitionWindow!=null) acquisitionWindow.redrawElements(); return; //================================= NOSLIDES============================ } else if (extension.equalsIgnoreCase("noslides")) { slidesDirectoryPath=CorrectPathFinder.getPath(LODEConstants.NO_SLIDES_PREFIX); try { fileSystemManager.copyFiles(new File(destinationPath), new File(slidesDirectoryPath)); } catch (IOException ex) { fileSystemManager.cannotCopyMessage (ex, destinationPath, slidesDirectoryPath); } lecture.addSlide(1," Slide "+1," Slide "+1,LODEConstants.NO_SLIDES_PREFIX + 1 + ".jpg"); lecture.addSlidesGroup("#NOSLIDES#", 1, 1); //System.out.println("adding fake slide"); lecture.persistSlides(); if (acquisitionWindow!=null) acquisitionWindow.redrawElements(); return; //================================= OTHER TYPES ======================== } else { // select a file and import slides from it // select the file to be imported String pathOfFileToBeImported=null; try { pathOfFileToBeImported = fileSystemManager.selectAFile(LODEConstants.WORKING_DIR, extension); if (pathOfFileToBeImported==null) return; } catch (Exception ex) {ex.printStackTrace(messanger.getLogger()); return;} if (((pathOfFileToBeImported != null) && !pathOfFileToBeImported.equalsIgnoreCase("null/null")) ) { //============================================================== // make a copy of the selected file in Acquisition String filename=pathOfFileToBeImported; if (filename.lastIndexOf(File.separator)!=-1) filename=pathOfFileToBeImported.substring(1+filename.lastIndexOf(File.separator)); String sourcesDir=lecture.getAcquisitionPath()+LODEConstants.SLIDES_SOURCES_SUBDIR; try { fileSystemManager.createFolder(new File(sourcesDir)); fileSystemManager.copyFiles(new File(sourcesDir+filename), new File(pathOfFileToBeImported)); } catch (IOException ex) { messanger.w("CANNOT COPY SOURCE SLIDES! "+destinationPath+ " -> "+ pathOfFileToBeImported, LODEConstants.MSG_ERROR ); ex.printStackTrace(messanger.getLogger()); } //============================================================== //String command[]={"cp",pathOfFileToBeImported,lecture.getAcquisitionPath()+LODEConstants.SLIDES_SOURCES_SUBDIR+filename}; //final Process p=RunnableProcess.launch(command, false, false); /* try { destinationPath=lecture.getAcquisitionPath()+LODEConstants.SLIDES_SOURCES_SUBDIR+filename; System.err.println("COPYING "+destinationPath+" INTO "+destinationPath); fileSystemManager.copyFiles(new File(destinationPath), new File(destinationPath)); } catch (IOException ex) { fileSystemManager.cannotCopyMessage (ex, destinationPath, pathOfFileToBeImported); } /* */ // empty the buffer directory fileSystemManager.recursiveDelete(new File(slidesDirectoryPath)); //if (mode==REPLACE) lecture.zapSlides(); // deal with ODP, PPT and PDF files // in all cases, the generated imagesa are stored in the temporary buffer directory if (extension.equalsIgnoreCase("odp")) { JOptionPane.showMessageDialog(null, "Sorry, import from Open Office format is not supported yet!"); return; } else if (extension.equalsIgnoreCase("pdf")) { new PDFParser(pathOfFileToBeImported,slidesDirectoryPath+File.separator,ProgressBar.getProgressBar(),lecture); } else if (extension.equalsIgnoreCase("ppt")) { PPTParser parser=new PPTParser(); parser.prepareParser(pathOfFileToBeImported,slidesDirectoryPath); parser.extractImagesAndText(pathOfFileToBeImported,ProgressBar.getProgressBar(), lecture, mode); } } } // load the images from the slidesDirectoryPath boolean drawSlides=(extension!=null)&&(!extension.equalsIgnoreCase("noslides")); System.out.println("slidesDirectoryPath is"+slidesDirectoryPath); copySlidesFromFolder(slidesDirectoryPath,mode,lecture,drawSlides); // now the inspector window should show that the current lecture has slides InspectorWindow.getInstance().update(); } /** * Check if lecture already has slides. * If yes, ask user if they have to be kept, replaced, or if the operation should be aborted * @return REPLACE=2; APPEND=1; DO_NOTHING=0; */ private int checkExistingSlides(){ final InspectorWindow gui=InspectorWindow.getInstance(); File f = new File(ProgramState.getInstance().getCurrentLecture().getAcquisitionPath() +LODEConstants.SLIDES_PREFIX); if (! f.exists()) return REPLACE; Object[] options = {"Leave slides as they are", "Append after existing slides", "Replace existing slides"}; Thread.yield(); int choice = JOptionPane.showOptionDialog(null, "Slides already exist for this lecture. What would you like to do?", "Slides exist", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, LODEConstants.ICON_LODE, options, options[2]); return choice; } /** * * @param sourceFolderPath * @param choice REPLACE=2; APPEND=1; DO_NOTHING=0; * @param lecture * @param drawSlides */ private void copySlidesFromFolder (String sourceFolderPath,int choice, Lecture lecture, boolean drawSlides){ System.gc(); System.runFinalization(); String destinationFolderPath=ProgramState.getInstance().getCurrentLecture().getAcquisitionPath() +LODEConstants.FS+LODEConstants.SLIDES_PREFIX; File destinationFolder = new File(destinationFolderPath); if (! destinationFolder.exists()) fileSystemManager.createFolder(destinationFolder); int existing_files_number = 0; //number of file in the lecture folder switch (choice) { case REPLACE: //Replace existing slides, or add slides to empty set fileSystemManager.recursiveDelete(destinationFolder); if (! destinationFolder.exists()) fileSystemManager.createFolder(destinationFolder); break; case APPEND: //Append after existing slides existing_files_number = destinationFolder.list().length; //in the lecture folder break; case DO_NOTHING: return; } File sourceFolder = new File(sourceFolderPath); String[] sourceFiles = sourceFolder.list(); int nonjpegs=0; // LinkedList jpegsLot=new LinkedList<String>(); StringBuilder nonJpegList=new StringBuilder(); for (int i=0; i<sourceFiles.length; i++) { //get the last 3 chars String extension4=sourceFiles[i].substring(sourceFiles[i].length()-4).toLowerCase(); String extension5=sourceFiles[i].substring(sourceFiles[i].length()-5).toLowerCase(); boolean isJpg=(extension4.equals(".jpg"))||(extension5.equals(".jpeg")); if (isJpg) { // jpegsLot.add(sourceFiles[i]); } else { nonjpegs++; nonJpegList.append("<li>").append(sourceFiles[i]).append("</li>"); } } if (nonjpegs!=0) JOptionPane.showMessageDialog(InspectorWindow.getInstance(), "<html>Non-jpg files found - will be skipped:"+nonJpegList.toString(), "Non JPG file found", JOptionPane.ERROR_MESSAGE); /* ListIterator<String> iter=jpegsLot.listIterator(); while (iter.hasNext()) { System.out.println(iter.next()); } */ //int lastSlideNumber=0; for (int i=0; i<sourceFiles.length+1; i++) { // try with n.jpg and with SlideN.jpg File source=new File (sourceFolderPath+LODEConstants.FS+i+".jpg"); // the prfix Slide is generated when converting ppt into jpegs // TODO this code should be more general and capture any prefix if (! source.exists()) source=new File (sourceFolderPath+LODEConstants.FS+"Slide"+i+".jpg"); if (! source.exists()) continue; int newSequenceNumber=i+existing_files_number; try { fileSystemManager.copyFiles(new File(destinationFolderPath+LODEConstants.FS+newSequenceNumber+".jpg"), source); } catch (IOException ex) { fileSystemManager.cannotCopyMessage(ex, destinationFolderPath+LODEConstants.FS+newSequenceNumber+".jpg", source.getAbsolutePath()); } } // now draw the slides AcquisitionWindow acquisitionWindow=ControllersManager.getinstance().getAcquisitionWindow(); if (drawSlides && acquisitionWindow!=null) acquisitionWindow.redrawElements(); } }
[ "tiziano@axiastudio.it" ]
tiziano@axiastudio.it
f835c7c62707b96e9b969059045cea65559371ac
19dcf18f3f64436676e0801ff9e79bd3730c9422
/MultipleOfTwo/src/multipleoftwo/MultipleOfTwo.java
e4f24e966da30fa8000908f9ed968830da533c48
[]
no_license
alyssoneq/java_lessons
a965c604ebf94e2016810b2f473bf9e13eecd8d4
3a5d8d9123cd1d1409c047d83e427d1215646e72
refs/heads/main
2023-01-31T05:11:00.927146
2020-12-14T14:09:45
2020-12-14T14:09:45
316,099,549
0
0
null
null
null
null
UTF-8
Java
false
false
1,201
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 multipleoftwo; import java.util.Scanner; /** * * @author Alysson Bruno */ public class MultipleOfTwo { public static void main(String[] args) { // Instance of the scanner method Scanner userInput = new Scanner(System.in); // User input registration System.out.println("Please type 5 numbers"); System.out.println("Number 1: "); int n1 = userInput.nextInt(); System.out.println("Number 2: "); int n2 = userInput.nextInt(); System.out.println("Number 3: "); int n3 = userInput.nextInt(); System.out.println("Number 4: "); int n4 = userInput.nextInt(); System.out.println("Number 5: "); int n5 = userInput.nextInt(); // Test to identify if the sum of given numbers is a multiple of 2 int sumN = n1 + n2 + n3 + n4 + n5; if (sumN % 2 == 0){ System.out.println("The sum of given numbers is a multiple of 2"); }else{ System.out.println("The sum of given numbers is not a multiple of 2"); } } }
[ "alyssoneq@gmail.com" ]
alyssoneq@gmail.com
5239d49ba81d4181d8fc1dcf56ca5e227fca5d3d
94747c8422008bf197f3f6d61e0e92209b005647
/src/main/java/timmy/config/Bot.java
415b70a0debd2143ce92db81816fc5a08719a804
[]
no_license
aidanyon/AlmatySPK
2be85f13fb5176de996b91a7fc40844fc50ec1c3
7d3453443348568afb7b6e02231d21c53ab42c3f
refs/heads/master
2022-12-30T05:56:22.766072
2020-10-26T06:53:05
2020-10-26T06:53:05
307,281,210
0
0
null
null
null
null
UTF-8
Java
false
false
1,968
java
package timmy.config; import timmy.dao.DaoFactory; import timmy.dao.impl.PropertiesDao; import timmy.utils.Const; import timmy.utils.UpdateUtil; import lombok.extern.slf4j.Slf4j; import org.telegram.telegrambots.bots.TelegramLongPollingBot; import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.meta.exceptions.TelegramApiException; import java.util.HashMap; import java.util.Map; @Slf4j public class Bot extends TelegramLongPollingBot { private Map<Long, Conversation> conversations = new HashMap<>(); private DaoFactory daoFactory = DaoFactory.getInstance(); private PropertiesDao propertiesDao = daoFactory.getPropertiesDao(); private String tokenBot; private String nameBot; public void onUpdateReceived(Update update) { Conversation conversation = getConversation(update); try { conversation.handleUpdate(update, this); } catch (TelegramApiException e) { log.error("Error №" + e); } } private Conversation getConversation(Update update) { Long chatId = UpdateUtil.getChatId(update); Conversation conversation = conversations.get(chatId); if (conversation == null) { log.info("InitNormal new conversation for '{}'", chatId); conversation = new Conversation(); conversations.put(chatId, conversation); } return conversation; } public String getBotUsername() { if (nameBot == null || nameBot.isEmpty()) { nameBot = propertiesDao.getPropertiesValue(Const.BOT_NAME); } return nameBot; } public String getBotToken() { if (tokenBot == null || tokenBot.isEmpty()) { tokenBot = propertiesDao.getPropertiesValue(Const.BOT_TOKEN); } return tokenBot; } }
[ "aydana.lesbek.1999@gmail.com" ]
aydana.lesbek.1999@gmail.com
980dcfc7c1ff9326f3fac49b3a5badc2f009207a
2df0e6ab6b5360d11ccfcaaa633feacd9a53f832
/app/src/main/java/com/ryan/ryanapp/ui/ActivityDiscovery.java
df64826eb10dd20fc3dc64b7964fbd121559b6cf
[]
no_license
Ryan4GT/TianQin
708d2ef736a2b98054a7590e227a131f5fde2be3
57ec397d8e1ac2c661aae874793daa4a79e053e7
refs/heads/master
2020-12-24T15:41:20.703602
2015-03-05T10:43:17
2015-03-05T10:43:17
31,585,638
0
0
null
null
null
null
UTF-8
Java
false
false
924
java
package com.ryan.ryanapp.ui; import android.content.Intent; import android.os.Bundle; import com.ryan.ryanapp.R; public class ActivityDiscovery extends ActivityBase { public static final int FRIENDS_DYNAMIC_ID = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); int openingFragmentID = intent.getIntExtra(BEING_OPENED_FRAGMENT_ID, 0); FragmentBase beingOpendFragment = getBeingOpendFragment(openingFragmentID); addContentView(R.layout.activity_discovery); switchFragment(beingOpendFragment, R.id.activityDiscoveryContainer, false); } private FragmentBase getBeingOpendFragment(int openingFragmentID) { switch (openingFragmentID) { case FRIENDS_DYNAMIC_ID: return new FragmentFriendsDynamic(); } return null; } }
[ "yt18610998446@163.com" ]
yt18610998446@163.com
b1f01b4f16bf24545411c5ffd039e6b8ca07fe94
7b4096fc3f1c0a863be72bf43c31d7f2173f1a41
/src/main/java/edu/gatech/matcha/courseshop/server/controller/ProfessorController.java
d390cd7790f2b36ea137ed6726badbd8e63c5be5
[]
no_license
GatechMatchA/CourseShopServer
05fcc31a24b66f6a0acc0e50d1c08b01ee8ebc87
28a01cd132927f94192ff572984496a72ae0ffb0
refs/heads/master
2021-01-06T05:07:26.552184
2020-03-09T21:51:42
2020-03-09T21:51:42
241,218,663
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
package edu.gatech.matcha.courseshop.server.controller; import edu.gatech.matcha.courseshop.server.dto.ProfessorDto; import edu.gatech.matcha.courseshop.server.response.Response; import edu.gatech.matcha.courseshop.server.service.ProfessorService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("api/professors") public class ProfessorController { private final ProfessorService professorService; public ProfessorController(ProfessorService professorService) { this.professorService = professorService; } @RequestMapping(value = "/{id}", method = RequestMethod.GET) public ResponseEntity getProfessor(@PathVariable long id) { ProfessorDto professorDto = professorService.getProfessor(id); if (professorDto == null) { return Response.create(HttpStatus.NO_CONTENT, "There is no professor with the id <" + id + ">."); } return Response.create(HttpStatus.OK, professorDto); } }
[ "18326007+WilliamYuhangLee@users.noreply.github.com" ]
18326007+WilliamYuhangLee@users.noreply.github.com
7a90f6e21b48ae1a27e5756cc06d686c0dba62f8
d169e9b187dec5c004d3de8d7ffe972dd0020d54
/1.JavaSyntax/src/com/javarush/task/task05/task0514/Solution.java
355e527eaf15e4fbf54d52c3168a5bb5fc9e99c8
[]
no_license
smd-cmd/JR
efdb7c2a3eb28d857d516c98d1475b1ae1db212f
4e62d71fc18f9a2f7368999fae589e8de55badbb
refs/heads/master
2021-09-10T11:56:04.644070
2021-09-03T19:46:52
2021-09-03T19:46:52
228,458,632
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package com.javarush.task.task05.task0514; /* Программист создает человека */ public class Solution { public static void main(String[] args) { //напишите тут ваш код Person person = new Person(); person.initialize("Vasya", 20); } static class Person { //напишите тут ваш код public String name; public int age; public void initialize(String name, int age) { this.name = name; this.age = age; } } }
[ "jobsear@yandex.ru" ]
jobsear@yandex.ru
ab7e99c4c8c80923eef32799bf20f42311668988
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_6452577557dec9d9eb32450cabe3bfa833fd0de6/TARDISPoliceBoxPreset/4_6452577557dec9d9eb32450cabe3bfa833fd0de6_TARDISPoliceBoxPreset_s.java
4cbce34900784d53ac5ed83c8ea636b37ed7b47e
[]
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
2,416
java
/* * Copyright (C) 2013 eccentric_nz * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package me.eccentric_nz.TARDIS.chameleon; /** * A chameleon conversion is a repair procedure that technicians perform on * TARDIS chameleon circuits. The Fourth Doctor once said that the reason the * TARDIS' chameleon circuit was stuck was because he had "borrowed" it from * Gallifrey before the chameleon conversion was completed. * * @author eccentric_nz */ public class TARDISPoliceBoxPreset extends TARDISPreset { private final String blueprint_id = "[[35,35,35,0],[35,35,35,0],[35,35,35,0],[35,35,35,0],[35,35,35,0],[35,35,35,0],[35,35,35,0],[71,71,35,0],[0,0,35,50],[0,0,68,0]]"; private final String blueprint_data = "[[11,11,11,0],[11,11,11,0],[11,11,11,0],[11,11,11,0],[11,11,11,0],[11,11,11,0],[11,11,11,0],[0,8,11,0],[0,0,11,5],[0,0,4,0]]"; private final String stained_id = "[[95,95,95,0],[95,95,95,0],[95,95,95,0],[95,95,95,0],[95,95,95,0],[95,95,95,0],[95,95,95,0],[71,71,95,0],[0,0,95,0],[0,0,68,0]]"; private final String stained_data = "[[-1,-1,-1,0],[-1,-1,-1,0],[-1,-1,-1,0],[-1,-1,-1,0],[-1,-1,-1,0],[-1,-1,-1,0],[-1,-1,-1,0],[0,8,-1,0],[0,0,-1,0],[0,0,4,0]]"; private final String glass_id = "[[20,20,20,0],[20,20,20,0],[20,20,20,0],[20,20,20,0],[20,20,20,0],[20,20,20,0],[20,20,20,0],[71,71,20,0],[0,0,20,0],[0,0,68,0]]"; private final String glass_data = "[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,8,0,0],[0,0,0,0],[0,0,4,0]]"; public TARDISPoliceBoxPreset() { setBlueprint_id(blueprint_id); setBlueprint_data(blueprint_data); setStained_id(stained_id); setStained_data(stained_data); setGlass_id(glass_id); setGlass_data(glass_data); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
4cdafd4526b395fd05abd016344687c6e2fa75fb
57bccc9613f4d78acd0a6ede314509692f2d1361
/pbk-vis-lib/src/main/java/ru/armd/pbk/components/viss/gismgt/converters/GmStopStateConverter.java
b5d2c59531d48cb8603e498d8a742ebceb4e5da6
[]
no_license
mannyrobin/Omnecrome
70f27fd80a9150b89fe3284d5789e4348cba6a11
424d484a9858b30c11badae6951bccf15c2af9cb
refs/heads/master
2023-01-06T16:20:50.181849
2020-11-06T14:37:14
2020-11-06T14:37:14
310,620,098
0
0
null
null
null
null
UTF-8
Java
false
false
2,540
java
package ru.armd.pbk.components.viss.gismgt.converters; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import ru.armd.pbk.domain.viss.gismgt.GmStopState; import ru.armd.pbk.enums.core.VisAuditType; import ru.armd.pbk.gismgt.schema.ObjectMessage; import ru.armd.pbk.gismgt.schema.RStopState; import ru.armd.pbk.gismgt.schema.TStopState; import ru.armd.pbk.mappers.viss.gismgt.GmStopStateMapper; import ru.armd.pbk.mappers.viss.gismgt.IGmMapper; /** * Конвертор из TStopState в StopState. */ @Component public class GmStopStateConverter extends AbstractGmConverter<RStopState, GmStopState> { public static final Logger LOGGER = Logger.getLogger(GmStopStateConverter.class); @Autowired private GmStopStateMapper mapper; /** * Конструктор по умолчанию. */ public GmStopStateConverter() { super(VisAuditType.VIS_GISMGT_STOP_STATE); } @Override public Logger getLogger() { return LOGGER; } @Override protected IGmMapper<GmStopState> getMapper() { return mapper; } @Override protected GmStopState convert(RStopState gis) { TStopState body = gis.getBody(); GmStopState domain = new GmStopState(); domain.setAsduId(getAsduId(gis.getHeader().getIdentSet())); domain.setMuid(getLongValueFromString(body.getMuid())); domain.setIsDelete(getIntValue(body.getSignDeleted())); domain.setVersion(body.getVersion().intValue()); domain.setName(getStringValue(body.getName())); return domain; } @Override protected Boolean merge(GmStopState to, GmStopState from) { Boolean result = super.merge(to, from); if (from.getName() != null && !from.getName().equals(to.getName())) { result = true; to.setName(from.getName()); } return result; } @Override protected GmStopState fillMain(Long muid) { GmStopState domain = new GmStopState(); domain.setMuid(muid); domain.setIsDelete(0); domain.setVersion(0); return domain; } @Override protected RStopState toGis(ObjectMessage objectMessage) { RStopState gis = new RStopState(); RStopState.Header header = new RStopState.Header(); header.setIdentSet(objectMessage.getHeader().getIdentSet()); header.setObjectType(objectMessage.getHeader().getObjectType()); header.setOperation(objectMessage.getHeader().getOperation()); gis.setBody(objectMessage.getBody().getTStopState()); gis.setHeader(header); return gis; } }
[ "malike@hipcreativeinc.com" ]
malike@hipcreativeinc.com
636b26dac35555f163d462cb4c6e52dd1c532513
005d0edcc7eb0821143d887337c0b1c4d6576d4a
/src/entity/ServicePackage.java
58e4c53c87b6a34e1ae482cfaff6213cb36829f1
[]
no_license
yeTianty/Soso
168d38492da2c2057ef2dbbe8f7353a8df01b61e
f3d516133c6fc2189e6dbb57a633e4025a01ee2f
refs/heads/master
2023-01-28T09:13:34.940051
2020-11-25T09:57:13
2020-11-25T09:57:13
315,896,998
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package entity; public abstract class ServicePackage { protected double price; public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public abstract void showInfo(); }
[ "2768279789@qq.com" ]
2768279789@qq.com
d1c7ca8d68d963df917038172a70082c69877004
56feddb1af0507668ad228a6f36676bedb910cf2
/src/main/java/com/mkyong/async/models/EmployeeNames.java
6d22fac983bd5ea46bef5fc5125dca4bf5151ec1
[]
no_license
tejeswar/spring-data-jpa-mysql
08461f58697099b178221d73b66d74e5f3b93cb3
e01541e928217b114d44683a9fdf70829df6f8a1
refs/heads/master
2021-03-02T05:32:21.076732
2020-03-08T15:48:38
2020-03-08T15:48:38
245,841,452
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.mkyong.async.models; import java.util.List; public class EmployeeNames { private List<EmployeeName> employeeNameList; public List<EmployeeName> getEmployeeNameList() { return employeeNameList; } public void setEmployeeNameList(List<EmployeeName> employeeNameList) { this.employeeNameList = employeeNameList; } public EmployeeNames(List<EmployeeName> employeeNameList) { super(); this.employeeNameList = employeeNameList; } public EmployeeNames() { } }
[ "tsahu@altimetrik.com" ]
tsahu@altimetrik.com
d9663dfe49f3662996e693647d950e9b0cd2ab0e
4b0af2537bdd7644c0143ae795167a00cfd04608
/NavigationBottom/app/src/main/java/com/app/navigationbottom/MainActivity.java
acaaea254bff75205c4c264d4d5a191b09758209
[]
no_license
IwonGunawan/AndroidFundamental
3ecc225cfa2b5b21ccc58db5392cee28bc100f19
fd416f014b7cb04400d1bcc1974b682a6953b594
refs/heads/master
2022-12-04T06:39:42.220134
2020-08-13T04:23:42
2020-08-13T04:23:42
274,879,976
2
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
package com.app.navigationbottom; import android.os.Bundle; import com.google.android.material.bottomnavigation.BottomNavigationView; import androidx.appcompat.app.AppCompatActivity; import androidx.navigation.NavController; import androidx.navigation.Navigation; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomNavigationView navView = findViewById(R.id.nav_view); // Passing each menu ID as a set of Ids because each // menu should be considered as top level destinations. AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setupWithNavController(navView, navController); } }
[ "iwongunawan@gmail.com" ]
iwongunawan@gmail.com