blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0f87dfbcf87c931b1a27961ba6f5bff5c70947c9 | 58fc5d683a81413e74116207181c7417974da6b8 | /dailyshareprice.zip_expanded/dailyshareprice/src/main/java/com/cognizant/dailyshareprice/service/StockService.java | d324d2e9ff6577ac142578318082228a9c42363a | [] | no_license | avanish10/Cognizant_Training | 2b42dfc09a29c15f8d7b5f37832502823155de33 | 2bfbbf10d76398d062334d59ec6cfccc9df2bbe1 | refs/heads/main | 2023-06-17T20:23:31.561312 | 2021-07-04T17:51:54 | 2021-07-04T17:51:54 | 382,912,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,323 | java | package com.cognizant.dailyshareprice.service;
import com.cognizant.dailyshareprice.feignclient.AuthClient;
import com.cognizant.dailyshareprice.exception.StockNotFoundException;
import com.cognizant.dailyshareprice.model.Stock;
import com.cognizant.dailyshareprice.repository.StockRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.transaction.Transactional;
import java.util.List;
@Service
public class StockService {
private static final Logger LOGGER = LoggerFactory.getLogger(StockService.class);
@Autowired
StockRepository repository;
@Autowired
AuthClient authClient;
/**
* @param Header
* @return false
*/
public Boolean AuthorizeUser(String Header) {
try{
return authClient.verify(Header);
}
catch(Exception e) {
return false;
}
}
/**
* @return repository.findAll()
*/
@Transactional
public List<Stock> getAllShares(){
LOGGER.info("Inside getAllShares");
LOGGER.info("End getAllShares");
return repository.findAll();
}
/**
* @param stockName
* @return repository.findByStockName(stockName)
* @throws StockNotFoundException
*/
@Transactional
public Stock getStockByName(String stockName) throws StockNotFoundException{
LOGGER.info("Inside getStockByName");
if(repository.findByStockName(stockName)==null)
throw new StockNotFoundException("Stock Not Found");
LOGGER.info("End getStockByName");
return repository.findByStockName(stockName);
}
/**
* @param stockId
* @return repository.findByStockId(stockId)
* @throws StockNotFoundException
*/
@Transactional
public Stock getShareById(String stockId) throws StockNotFoundException {
LOGGER.info("Inside getShareById");
if(repository.findByStockId(stockId)==null)
{
throw new StockNotFoundException("Stock Not Found");
}
LOGGER.info("End getShareById");
return repository.findByStockId(stockId);
}
/**
* @param stockId
* @return repository.findStockValueById(stockId)
*/
public double getSharePriceById(String stockId) {
LOGGER.info("Inside getSharePriceById");
//System.out.println(stockId);
LOGGER.info("End getSharePriceById");
return repository.findStockValueById(stockId);//stockValueList;
}
}
| [
"avanishsinghal149@gmail.com"
] | avanishsinghal149@gmail.com |
6753d542705a7bac636fdb3de7332e25dfe6cd90 | 7eeabd62f23d5f836d7df4b66088c6a4664b2715 | /app/src/main/java/com/example/acer/watch/util/AboutNetWorkUtil.java | 30a37e57164fdc871ffcfcff55fbf3481bd4589e | [
"Apache-2.0"
] | permissive | shyorange123/Watch | 91e94842c702c6e3b0a11a8651baaef5c25182df | 369207496da758d831d49e32f744477efa803356 | refs/heads/master | 2020-03-12T19:08:27.572898 | 2018-04-24T01:30:16 | 2018-04-24T01:30:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | package com.example.acer.watch.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by acer on 2018-04-03.
*
* 该类是用于获取与网络有关的一些信息
* 包括(网络是否连接,网络类型等)
*
* 后续可往里添加更多的关于网络的方法,比如:判WIFI是否可用,获取网络信息
* */
public class AboutNetWorkUtil {
/*
* 判断网络是否连接
* */
public static boolean isNetWorkConnected(Context context){
if(context!=null){
ConnectivityManager cm=(ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info=cm.getActiveNetworkInfo();
if(info!=null&&info.isAvailable()){
return true;
}else{
return false;
}
}
return false;
}
/*
* 判断网络类型
* 0表示:网络无连接
* 1表示:WIFI连接
* 2表示:数据连接
* */
public static int getNetWorkInfo(Context context){
if(context!=null){
ConnectivityManager cm=(ConnectivityManager)
context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info=cm.getActiveNetworkInfo();
if(info==null){
return 0;
}else if(info.getType()==ConnectivityManager.TYPE_WIFI){
return 1;
}else if(info.getType()==ConnectivityManager.TYPE_MOBILE){
return 2;
}
}
return 0;
}
}
| [
"2231360259@qq.com"
] | 2231360259@qq.com |
bb850c1b543a143a584f3507a7cb79d8baa0dd71 | 788e1dce10fc34fa5f42cfe0bbf20ae5fc664c47 | /sql-examples/SimpleConsoleApplication/src/main/java/com/revature/dao/TeamDAO.java | 01333b97784e3578720584a1083962f8aa52ff47 | [] | no_license | jhigherevature/roc_vinay_bach_jan-feb_2021 | 8571722b7e0d67f6fdce1c57c07da111a8fcab21 | 49c6523704b00bddde99ad7ce109116959376f4c | refs/heads/master | 2023-03-04T00:09:45.194705 | 2021-02-09T17:07:33 | 2021-02-09T17:07:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.revature.dao;
import java.sql.Connection;
import java.sql.SQLException;
import com.revature.models.Team;
public interface TeamDAO {
public int createTeam(Team team, Connection connection) throws SQLException;
}
| [
"bach.tran@revature.com"
] | bach.tran@revature.com |
40b5e3b4218bff41595941ce5114c58a25a21c76 | 5242383ec4c52d47d23e8d46fe6ea9c22c48e903 | /Cupsd/scripting/java/example/GLPprinters.java | 9a86a795072d2aa3c1b0f2eedf632b9d55cb4ddc | [] | no_license | syedaunnraza/work | 461905b3cb0b899b269c3eac41ccf75a4ea993a5 | c71f78faec3b8646b8b2b5e4386171141ab5e56a | refs/heads/master | 2021-01-23T22:15:55.113263 | 2011-08-31T22:39:37 | 2011-08-31T22:39:37 | 1,731,091 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,310 | java |
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import java.net.*;
import java.io.*;
import com.easysw.cups.*;
public class GLPprinters implements ActionListener
{
private Cups cups = null;
public String cupsServerName = "";
private JScrollPane scrollPane = null;
private JPanel mainPanel = null;
private JPanel serverPanel = null;
private JPanel maskPanel = null;
private GridBagLayout mainLayout = null;
private GridBagConstraints mainConst = null;
private GridBagLayout maskLayout = null;
private GridBagConstraints maskConst = null;
private JLabel serverLabel = null;
JTextField nameTextField = null;
protected static final String maskFieldString = "Printer Name:";
protected static final String maskButtonString = "Apply";
private String currentMask = "";
// Constructor
public GLPprinters()
{
cupsServerName = GLPvars.getServerName();
load();
}
public void load()
{
String[] printer_names;
String default_printer;
int num_printers = 0;
int y = 0, i = 0;
URL u;
CupsPrinter cp;
// -----------------------------------------------------------
//
// First get a list of printer names.
//
try
{
u = new URL("http://" + GLPvars.getServerName() + ":631/");
cups = new Cups(u);
// If authorization is required ....
cups.setUser(GLPvars.cupsUser);
cups.setPasswd(GLPvars.cupsPasswd);
printer_names = cups.cupsGetPrinters();
if (printer_names != null)
num_printers = printer_names.length;
else
num_printers = 0;
}
catch (IOException e)
{
mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setBackground(GLPcolors.backgroundColor);
JLabel errorLabel = new JLabel("Error loading printers from " +
GLPvars.getServerName());
errorLabel.setForeground(Color.red);
mainPanel.add( errorLabel, BorderLayout.CENTER );
scrollPane = new JScrollPane(mainPanel);
return;
}
// -----------------------------------------------------------
//
// Now get the printer objects
//
CupsPrinter[] printers = new CupsPrinter[num_printers];
for (i=0; i < num_printers; i++)
{
try
{
u = new URL("http://" + GLPvars.getServerName() +
":631/printers/" + printer_names[i] );
cups = new Cups(u);
// If authorization is required ....
cups.setUser(GLPvars.cupsUser);
cups.setPasswd(GLPvars.cupsPasswd);
printers[i] = new CupsPrinter( cups, printer_names[i] );
}
catch (IOException e)
{
// System.out.println("GLPprinters: IOException");
// return(null);
}
}
//
// Keep track in case it changes.
//
cupsServerName = GLPvars.getServerName();
if (printer_names != null)
num_printers = printer_names.length;
else
num_printers = 0;
// default_printer = c.cupsGetDefault();
// Create the main panel to contain the two sub panels.
mainPanel = new JPanel();
mainLayout = new GridBagLayout();
mainConst = new GridBagConstraints();
mainPanel.setLayout(mainLayout);
mainPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
mainPanel.setBackground(GLPcolors.backgroundColor);
// --------------------------------------------------------------
//
// Add the server name label
//
serverPanel = new JPanel();
serverPanel.setLayout( new BorderLayout());
serverPanel.setBackground(GLPcolors.backgroundColor);
serverLabel = new JLabel("Printers on " + GLPvars.getServerName());
serverLabel.setForeground(GLPcolors.foregroundColor);
serverPanel.add(serverLabel, BorderLayout.NORTH );
mainConst.gridwidth = GridBagConstraints.RELATIVE;
mainConst.gridx = 0;
mainConst.gridy = y++;
mainConst.fill = GridBagConstraints.BOTH;
mainConst.weightx = 0.0;
mainConst.weighty = 0.0;
mainConst.ipadx = 4;
mainConst.ipady = 4;
mainLayout.setConstraints( serverPanel, mainConst );
mainPanel.add(serverPanel);
// --------------------------------------------------------------
//
// Add the printer masking panel
//
maskPanel = new JPanel();
maskLayout = new GridBagLayout();
maskConst = new GridBagConstraints();
maskPanel.setLayout(maskLayout);
maskPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
maskPanel.setBackground(GLPcolors.backgroundColor);
JPanel localMaskPanel = buildMaskPanel();
maskConst.gridwidth = GridBagConstraints.RELATIVE;
maskConst.gridx = 0;
maskConst.gridy = 0;
maskConst.fill = GridBagConstraints.NONE;
maskConst.weightx = 0.0;
maskConst.weighty = 0.0;
maskConst.ipadx = 4;
maskConst.ipady = 4;
maskLayout.setConstraints( localMaskPanel, maskConst );
maskPanel.add(localMaskPanel);
//
// Add the masking panel to the main panel.
//
mainConst.gridwidth = GridBagConstraints.RELATIVE;
mainConst.gridx = 0;
mainConst.gridy = y++;
mainConst.fill = GridBagConstraints.BOTH;
mainConst.weightx = 0.0;
mainConst.weighty = 0.0;
mainConst.ipadx = 4;
mainConst.ipady = 4;
mainLayout.setConstraints( maskPanel, mainConst );
mainPanel.add(maskPanel);
// --------------------------------------------------------------
//
// Add the printers
//
double weight = 1.0 / (double)printers.length;
for (i=0; i < printers.length; i++)
{
JPanel subPanel = printerInfoPanel( printers[i] );
mainConst.gridwidth = GridBagConstraints.RELATIVE;
mainConst.gridx = 0;
mainConst.gridy = y++;
mainConst.fill = GridBagConstraints.BOTH;
mainConst.weightx = 1.0;
mainConst.weighty = weight;
mainConst.ipady = 4;
mainLayout.setConstraints( subPanel, mainConst );
mainPanel.add(subPanel);
}
// ------------------------------------------------
//
// Put the whole thing into a scroll pane.
//
scrollPane = new JScrollPane(mainPanel);
}
// -----------------------------------------------------------
//
// Build an info panel for an individual printer.
//
private JPanel printerInfoPanel( CupsPrinter cp )
{
JPanel printerPanel = new JPanel();
BoxLayout printerBox;
JPanel leftHeader = new JPanel();
JPanel rightHeader = new JPanel();
JPanel leftPane = new JPanel();
JPanel rightPane = new JPanel();
GridBagLayout leftLayout = new GridBagLayout();
GridBagLayout rightLayout = new GridBagLayout();
GridBagConstraints leftConst = new GridBagConstraints();
GridBagConstraints rightConst = new GridBagConstraints();
JLabel printerIconLabel = null;
JLabel printerInfoLabel = null;
JLabel printerNameLabel = null;
JLabel printerMakeLabel = null;
JTable printerStatusTable = null;
printerBox = new BoxLayout(printerPanel, BoxLayout.X_AXIS);
printerPanel.setLayout(printerBox);
printerPanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
printerPanel.setBackground(GLPcolors.backgroundColor);
// Add border around the panel.
// ------------------------------------------------------------
// Left pane
// ------------------------------------------------------------
leftPane.setLayout(leftLayout);
leftPane.setBackground(GLPcolors.backgroundColor);
leftHeader.setLayout(new BorderLayout());
leftHeader.setBackground(GLPcolors.highlightColor);
leftHeader.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
printerNameLabel = new JLabel(cp.getPrinterName());
printerNameLabel.setForeground(Color.black);
leftHeader.add( printerNameLabel, BorderLayout.WEST);
leftConst.gridwidth = GridBagConstraints.RELATIVE;
leftConst.gridx = 0;
leftConst.gridy = 0;
leftConst.fill = GridBagConstraints.HORIZONTAL;
leftConst.weightx = 0.0;
leftConst.weighty = 0.0;
leftConst.ipady = 4;
leftLayout.setConstraints( leftHeader, leftConst );
leftPane.add(leftHeader);
String imageName = "./images/printer-" + cp.getStateText() + ".gif";
URL iconURL = ClassLoader.getSystemResource(imageName);
ImageIcon icon = new ImageIcon(iconURL);
JButton printerButton = new JButton( "<html><center><b>" +
cp.getPrinterName() +
"</b></center></html>",
icon );
printerButton.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
printerButton.setBackground(GLPcolors.backgroundColor);
printerButton.setActionCommand( cp.getPrinterName() );
printerButton.addActionListener(this);
printerButton.setToolTipText("Click to go to " + cp.getPrinterName() +
"'s extended informtion page.");
leftConst.gridwidth = GridBagConstraints.REMAINDER;
leftConst.gridx = 0;
leftConst.gridy = 1;
leftConst.fill = GridBagConstraints.BOTH;
leftConst.weightx = 1.0;
leftConst.weighty = 1.0;
leftConst.ipady = 4;
leftLayout.setConstraints( printerButton, leftConst );
leftPane.add(printerButton);
// ------------------------------------------------------------
// Right pane
// ------------------------------------------------------------
rightPane.setLayout(rightLayout);
rightPane.setBackground(GLPcolors.backgroundColor);
rightHeader.setLayout(new BorderLayout());
rightHeader.setBackground(GLPcolors.highlightColor);
rightHeader.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
printerMakeLabel = new JLabel(cp.getMakeAndModel());
printerMakeLabel.setForeground(Color.black);
rightHeader.add( printerMakeLabel, BorderLayout.WEST);
rightConst.gridwidth = GridBagConstraints.RELATIVE;
rightConst.gridx = 0;
rightConst.gridy = 0;
rightConst.fill = GridBagConstraints.HORIZONTAL;
rightConst.weightx = 0.0;
rightConst.weighty = 0.0;
rightConst.ipady = 4;
rightLayout.setConstraints( rightHeader, rightConst );
rightPane.add(rightHeader);
Font labelFont = new Font("Serif",Font.BOLD, 12 );
// Font textFont = new Font("Serif", Font.NORMAL, 12 );
Font messageFont = new Font("Serif", Font.ITALIC, 12 );
JLabel pdNameLabel = new JLabel("Name");
JLabel pdLocationLabel = new JLabel("Location");
JLabel pdStatusLabel = new JLabel("Status");
JLabel pdMessageLabel = new JLabel("Message");
JLabel pdNameText = new JLabel(cp.getPrinterName());
JLabel pdLocationText = new JLabel(cp.getLocation());
JLabel pdStatusText = new JLabel(cp.getStateText());
JLabel pdMessageText = new JLabel(cp.getStateReasons());
pdNameLabel.setFont(labelFont);
pdLocationLabel.setFont(labelFont);
pdStatusLabel.setFont(labelFont);
pdMessageLabel.setFont(labelFont);
pdMessageText.setFont(messageFont);
pdNameLabel.setForeground(Color.black);
pdLocationLabel.setForeground(Color.black);
pdStatusLabel.setForeground(Color.black);
pdMessageLabel.setForeground(Color.black);
JPanel tablePane;
if ((cp.getStateReasons().length() > 0) &&
(!cp.getStateReasons().equals("none")))
{
tablePane = new JPanel(new GridLayout(4,2,2,2));
tablePane.add(pdNameLabel);
tablePane.add(pdNameText);
tablePane.add(pdLocationLabel);
tablePane.add(pdLocationText);
tablePane.add(pdStatusLabel);
tablePane.add(pdStatusText);
tablePane.add(pdMessageLabel);
tablePane.add(pdMessageText);
}
else
{
tablePane = new JPanel(new GridLayout(3,2,2,2));
tablePane.add(pdNameLabel);
tablePane.add(pdNameText);
tablePane.add(pdLocationLabel);
tablePane.add(pdLocationText);
tablePane.add(pdStatusLabel);
tablePane.add(pdStatusText);
}
tablePane.setBackground(GLPcolors.backgroundColor);
// printerStatusTable.setShowGrid(false);
rightConst.gridwidth = GridBagConstraints.REMAINDER;
rightConst.gridx = 0;
rightConst.gridy = 1;
rightConst.fill = GridBagConstraints.BOTH;
rightConst.weightx = 1.0;
rightConst.weighty = 1.0;
rightConst.ipady = 4;
rightLayout.setConstraints( tablePane, rightConst );
rightPane.add(tablePane);
printerPanel.add(leftPane);
printerPanel.add(rightPane);
return(printerPanel);
}
public JPanel buildMaskPanel()
{
// Create the main panel to contain the two sub panels.
JPanel namePanel = new JPanel();
GridBagLayout nameLayout = new GridBagLayout();
GridBagConstraints nameConst = new GridBagConstraints();
namePanel.setLayout(nameLayout);
namePanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
namePanel.setBackground(GLPcolors.backgroundColor);
//Create a regular text field.
nameTextField = new JTextField(16);
nameTextField.setActionCommand(maskFieldString);
nameTextField.addActionListener(this);
nameTextField.setText("");
//Create some labels for the fields.
JLabel nameFieldLabel = new JLabel(maskFieldString);
nameFieldLabel.setForeground(GLPcolors.foregroundColor);
nameFieldLabel.setLabelFor(nameTextField);
// Text
nameConst.gridwidth = GridBagConstraints.RELATIVE;
nameConst.gridx = 0;
nameConst.gridy = 0;
nameConst.fill = GridBagConstraints.HORIZONTAL;
nameConst.weightx = 0.0;
nameConst.weighty = 0.0;
nameConst.ipadx = 4;
nameConst.ipady = 4;
nameLayout.setConstraints( nameFieldLabel, nameConst );
namePanel.add(nameFieldLabel);
nameConst.gridwidth = GridBagConstraints.RELATIVE;
nameConst.gridx = 1;
nameConst.gridy = 0;
nameConst.fill = GridBagConstraints.HORIZONTAL;
nameConst.weightx = 0.0;
nameConst.weighty = 0.0;
nameConst.ipadx = 4;
nameConst.ipady = 4;
nameLayout.setConstraints( nameTextField, nameConst );
namePanel.add(nameTextField);
JButton applyButton = new JButton(maskButtonString);
applyButton.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(),
BorderFactory.createEmptyBorder(2,2,2,2)));
applyButton.setActionCommand(maskButtonString);
applyButton.addActionListener(this);
nameConst.gridx = 2;
nameConst.gridy = 0;
nameConst.fill = GridBagConstraints.NONE;
nameLayout.setConstraints( applyButton, nameConst );
nameConst.weightx = 0.0;
nameConst.weighty = 0.0;
nameConst.ipadx = 4;
nameConst.ipady = 4;
namePanel.add(applyButton);
return(namePanel);
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals(maskFieldString))
{
String s = nameTextField.getText();
if (s.length() > 1)
{
currentMask = s;
}
}
else if (e.getActionCommand().equals(maskButtonString))
{
String s = nameTextField.getText();
if (s.length() > 1)
{
currentMask = s;
}
}
else
{
GLPvars.selectedPrinterName = e.getActionCommand();
GLPvars.tabs.updateDetailPanel();
GLPvars.tabs.tabPanel.setSelectedIndex(2);
}
}
public JScrollPane getPanel()
{
return(scrollPane);
}
}
| [
"="
] | = |
9950ae04c0814c2890285c317dbe46ccbd8f4398 | c6919c8956636884cb967cfad44a6c2f644e02c2 | /Lessons/src/lesson150407/generics/Stack.java | f8803f763954bbb31c9debd188e6faefa4696e7c | [] | no_license | zstudent/ClassWork | d03ba30101e542bb899fc332cd81a282d7ea1949 | 9a3f74981deaa1f215c9d787750e7a446256832e | refs/heads/master | 2020-12-24T14:53:14.063013 | 2015-06-11T17:56:02 | 2015-06-11T17:56:02 | 31,549,204 | 1 | 12 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package lesson150407.generics;
public class Stack<T> {
private static final int INITIAL_CAPACITY = 10;
T[] items;
int tos; // top of stack
public Stack() {
items = (T[]) new Object[INITIAL_CAPACITY];
tos = -1;
}
public void push(final T item) {
if (tos == items.length - 1 ) {
changeItemsCapacity(items.length * 2);
}
items[++tos] = item;
}
private void changeItemsCapacity(final int capacity) {
System.out.println("change capacity to " + capacity);
T[] newItems = (T[]) new Object[capacity];
System.arraycopy(items, 0, newItems, 0, tos + 1);
items = newItems;
}
public T pop() {
if (items.length > INITIAL_CAPACITY && tos < items.length / 4) {
changeItemsCapacity(items.length / 2);
}
return isEmpty() ? null : items[tos--];
}
public T top() {
return isEmpty() ? null: items[tos];
}
public boolean isEmpty() {
return -1 == tos;
}
}
| [
"Zaal_Lyanov@epam.com"
] | Zaal_Lyanov@epam.com |
dbf232e9732dd8db5e992495db0b291356f93ae6 | 035054aae242b5f1615f4842c74e2f73825cba59 | /BBLish/src/com/bblish/InfoClass.java | d6b7280ca7c7c61b15cbdd959cb1f14efc65c4a2 | [] | no_license | jungcheol/BBLish | db7f0cdd6e5970238fc6b496bd58af5fd8f12f04 | a19da7374b22800fd90bb4eca985609ccfa1e259 | refs/heads/master | 2020-03-27T05:47:35.113367 | 2015-01-13T08:49:31 | 2015-01-13T08:49:31 | 25,679,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package com.bblish;
public class InfoClass {
private int id;
private String imgSrc;
private String place;
private String people;
private int beer;
private int soju;
private int malgoli;
private int whisky;
private int etc;
public InfoClass() {
super();
}
public InfoClass(int id, String imgSrc, String place, String people, int beer, int soju,
int malgoli, int whisky, int etc) {
super();
this.id = id;
this.imgSrc = imgSrc;
this.place = place;
this.people = people;
this.beer = beer;
this.soju = soju;
this.malgoli = malgoli;
this.whisky = whisky;
this.etc = etc;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImgSrc() {
return imgSrc;
}
public void setImgSrc(String imgSrc) {
this.imgSrc = imgSrc;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public String getPeople() {
return people;
}
public void setPeople(String people) {
this.people = people;
}
public int getBeer() {
return beer;
}
public void setBeer(int beer) {
this.beer = beer;
}
public int getSoju() {
return soju;
}
public void setSoju(int soju) {
this.soju = soju;
}
public int getMalgoli() {
return malgoli;
}
public void setMalgoli(int malgoli) {
this.malgoli = malgoli;
}
public int getWhisky() {
return whisky;
}
public void setWhisky(int whisky) {
this.whisky = whisky;
}
public int getEtc() {
return etc;
}
public void setEtc(int etc) {
this.etc = etc;
}
}
| [
"jungcheol@wemakeprice.com"
] | jungcheol@wemakeprice.com |
7d9baf4ef731f29b7fecbb36b9b1d355d6154477 | 5e99df625795e25918a3f45cf3b0ad4b9e484356 | /app/src/main/java/com/kitchensink/services/StopwatchService.java | 9587ec69e1633bb1e4437fc49158384cd0ab1f7f | [] | no_license | kolovos/mdad-kitchensink | 9fc39da6bbae43d346ba456e416af1358cee1dc5 | bd0fa434308f56ec7e9ffe3326ec826533f32bc9 | refs/heads/master | 2021-01-10T08:32:07.790037 | 2016-02-02T15:16:41 | 2016-02-02T15:16:41 | 49,779,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package com.kitchensink.services;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.widget.Toast;
public class StopwatchService extends Service {
@Override
public IBinder onBind(Intent intent) {
return new LocalBinder();
}
@Override
public void onCreate() {
Toast.makeText(this, "Created " + this, Toast.LENGTH_SHORT).show();
super.onCreate();
}
@Override
public void onDestroy() {
Toast.makeText(this, "Destroyed " + this, Toast.LENGTH_SHORT).show();
super.onDestroy();
}
public class LocalBinder extends Binder {
public StopwatchService getService() {
return StopwatchService.this;
}
}
}
| [
"dkolovos@cs.york.ac.uk"
] | dkolovos@cs.york.ac.uk |
505e9688ffd156a06df97112001cba497daf6c2b | 0232f38f447a5d9f79392b53168166d2d8182a7c | /src/main/java/com/will/demo/DemoApplication.java | aff51e609c01430884c361692781076eb0ea34cd | [] | no_license | vijayOL/demo | 3784b0a3d73975f6403edc7d369ee2af8e20c3f5 | 9618ee6841f0daffbfb106d61a4fb516a0f254b7 | refs/heads/master | 2021-09-08T21:30:27.633231 | 2018-03-12T11:11:11 | 2018-03-12T11:11:11 | 118,698,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.will.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
@ServletComponentScan
@EnableTransactionManagement
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"1491773894@qq.com"
] | 1491773894@qq.com |
bbf34ffb72bfd6214f04bc3cadd62be029f7d656 | 3ddec44f616d82bfccd33b5dd89813ab240aa58b | /src/main/java/com/cybermkd/route/valid/Validator.java | 8b3f40febb918ac62483b14fd74d96402391dfff | [
"Apache-2.0"
] | permissive | jhhe66/ICERest | 5eef85021b023da811ab940e54c5444b3ce59a6f | 9ca90f392c2738fe26990be7559631227d76f070 | refs/heads/master | 2020-05-01T13:34:21.645110 | 2018-06-08T06:34:49 | 2018-06-08T06:34:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 274 | java | package com.cybermkd.route.valid;
import com.cybermkd.route.core.Params;
import com.cybermkd.route.core.RouteMatch;
/**
* Created by ice on 15-1-26.
*/
public abstract class Validator {
public abstract ValidResult validate(Params params, RouteMatch routeMatch);
}
| [
"t-baby@besdlab.cn"
] | t-baby@besdlab.cn |
1de4b747be6a6f118a5b68cab54fa05dce1a44f7 | 19878dcf613fa264f2004dbf4aa334247ab87578 | /app/src/main/java/cn/feihutv/zhibofeihu/ui/live/pclive/LiveChatFragmentPresenter.java | 5b669816e930854d6d76f7561fe6ddd67c4b9350 | [] | no_license | hhyq520/feihuZhiboPro | 9a56babb5ea61d6440e537b83b8eaf1ef4a3f089 | a26e83f3bce73cfe98adef448ec08d25894000e7 | refs/heads/master | 2020-04-29T01:24:13.592995 | 2019-03-15T02:13:51 | 2019-03-15T02:13:51 | 175,728,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,883 | java | package cn.feihutv.zhibofeihu.ui.live.pclive;
import android.text.TextUtils;
import cn.feihutv.zhibofeihu.data.db.model.SysConfigBean;
import cn.feihutv.zhibofeihu.data.db.model.SysGiftNewBean;
import cn.feihutv.zhibofeihu.data.db.model.SysMountNewBean;
import cn.feihutv.zhibofeihu.data.local.model.SysbagBean;
import cn.feihutv.zhibofeihu.data.local.model.TCChatEntity;
import cn.feihutv.zhibofeihu.data.network.http.model.common.BuyGoodsRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.common.BuyGoodsResponce;
import cn.feihutv.zhibofeihu.data.network.http.model.common.LoadRoomRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.common.LoadRoomResponce;
import cn.feihutv.zhibofeihu.data.network.http.model.common.SendGiftRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.common.SendGiftResponce;
import cn.feihutv.zhibofeihu.data.network.http.model.liveroom.GetCurrMountRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.liveroom.GetCurrMountResponce;
import cn.feihutv.zhibofeihu.data.network.http.model.liveroom.SendLoudSpeakRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.liveroom.SendLoudSpeakResponce;
import cn.feihutv.zhibofeihu.data.network.http.model.user.BagRequest;
import cn.feihutv.zhibofeihu.data.network.http.model.user.BagResponse;
import cn.feihutv.zhibofeihu.data.network.socket.model.common.SendRoomMsgRequest;
import cn.feihutv.zhibofeihu.data.network.socket.model.common.SendRoomResponce;
import cn.feihutv.zhibofeihu.data.network.socket.model.live.LeaveRoomRequest;
import cn.feihutv.zhibofeihu.data.network.socket.model.live.LeaveRoomResponce;
import cn.feihutv.zhibofeihu.ui.base.BasePresenter;
import cn.feihutv.zhibofeihu.data.DataManager;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import cn.feihutv.zhibofeihu.utils.AppLogger;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
/**
* <pre>
* author : huang hao
* time :
* desc : p业务处理实现类
* version: 1.0
* </pre>
*/
public class LiveChatFragmentPresenter<V extends LiveChatFragmentMvpView> extends BasePresenter<V>
implements LiveChatFragmentMvpPresenter<V> {
@Inject
public LiveChatFragmentPresenter(DataManager dataManager, CompositeDisposable compositeDisposable) {
super(dataManager, compositeDisposable);
}
@Override
public void loadRoomById(String userId) {
getCompositeDisposable().
add(getDataManager().
doGetRoomDataApiCall(new LoadRoomRequest(userId))
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<LoadRoomResponce>() {
@Override
public void accept(@NonNull final LoadRoomResponce loadRoomResponce) throws Exception {
if (loadRoomResponce.getCode() == 0) {
getDataManager()
.doLoadLeaveRoomApiCall(new LeaveRoomRequest())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<LeaveRoomResponce>() {
@Override
public void accept(@NonNull LeaveRoomResponce response) throws Exception {
if(response.getCode()==0){
getMvpView().gotoRoom(loadRoomResponce.getLoadRoomData());
}else{
AppLogger.e("leaveRoom"+response.getErrMsg());
}
}
}, getConsumer());
} else {
AppLogger.e(loadRoomResponce.getErrMsg());
}
}
}, new Consumer<Throwable>() {
@Override
public void accept(@NonNull Throwable throwable) throws Exception {
}
}));
}
@Override
public void sendLoudspeaker(String msg) {
getCompositeDisposable().add(getDataManager()
.doSendLoudSpeakApiCall(new SendLoudSpeakRequest(msg))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<SendLoudSpeakResponce>() {
@Override
public void accept(@NonNull SendLoudSpeakResponce sendLoudSpeakResponce) throws Exception {
if(sendLoudSpeakResponce.getCode()==0){
getMvpView().onToast("发送全站消息成功");
}else{
if (sendLoudSpeakResponce.getCode() == 4602) {
getMvpView().onToast("您已被禁言");
} else if (sendLoudSpeakResponce.getCode() == 4009) {
getMvpView().onToast("内容太长");
} else if (sendLoudSpeakResponce.getCode() == 4202) {
getMvpView().onToast("余额不足");
} else if (sendLoudSpeakResponce.getCode() == 4025) {
getMvpView().onToast("您已被禁言");
}
AppLogger.e(sendLoudSpeakResponce.getErrMsg());
}
}
},getConsumer()));
}
@Override
public void sendRoomMsg(final TCChatEntity tcChatEntity, String msg) {
getDataManager()
.doSendRoomMsgApiCall(new SendRoomMsgRequest(msg))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<SendRoomResponce>() {
@Override
public void accept(@NonNull SendRoomResponce response) throws Exception {
if(response.getCode()==0){
getMvpView().notifyChatMsg(tcChatEntity);
}else{
if (response.getCode()== 4025) {
getMvpView().onToast("您已被禁言");
} else if (response.getCode()== 4009) {
getMvpView().onToast("内容太长");
} else if (response.getCode() == 4602) {
getMvpView().onToast("您已被禁言");
}
AppLogger.e("joinRoom"+response.getErrMsg());
}
}
}, getConsumer());
}
@Override
public void requestBagData() {
getCompositeDisposable().
add(getDataManager().
doGetUserBagDataApiCall(new BagRequest()).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<BagResponse>() {
@Override
public void accept(@NonNull BagResponse bagResponse) throws Exception {
List<SysbagBean> sysbagBeanList=new ArrayList<SysbagBean>();
if (bagResponse.getCode() == 0) {
if (bagResponse.getBagResponseData().size() > 0) {
for (BagResponse.BagResponseData info : bagResponse.getBagResponseData()) {
if(info.getCnt()>0) {
SysbagBean bag = new SysbagBean();
bag.setCnt(info.getCnt());
bag.setId(info.getId());
sysbagBeanList.add(bag);
}
}
}
} else {
AppLogger.i(bagResponse.getErrMsg());
}
getMvpView().showGiftDialog(sysbagBeanList);
}
}, new Consumer<Throwable>() {
@Override
public void accept(@NonNull Throwable throwable) throws Exception {
}
}));
}
@Override
public void dealBagSendGift(final List<SysbagBean> sysbagBeanList, final int id, final int count) {
SysGiftNewBean gift = getDataManager().getGiftBeanByID(String.valueOf(id));
if (gift == null) {
return;
}
if (isExistbag(sysbagBeanList,id)) {
for (final SysbagBean item : sysbagBeanList) {
if (item.getId() == id) {
if (item.getCnt() < count) {
final int needCount = count - item.getCnt();
final String gooId=getDataManager().getGoodIDByGiftID(String.valueOf(id));
if(!TextUtils.isEmpty(gooId)) {
getCompositeDisposable().add(getDataManager()
.doBuyGoodsApiCall(new BuyGoodsRequest(Integer.valueOf(gooId), needCount))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<BuyGoodsResponce>() {
@Override
public void accept(@NonNull BuyGoodsResponce responce) throws Exception {
if (responce.getCode() == 0) {
sendGift(sysbagBeanList, id, count);
} else {
sendGift(sysbagBeanList, id, item.getCnt());
if (responce.getCode() == 4202) {
getMvpView().onToast("余额不足,请充值");
} else if (responce.getCode() == 4203) {
getMvpView().onToast("礼物已下架");
}
}
}
}, getConsumer()));
}else{
getMvpView().onToast("礼物数量不足");
}
} else {
sendGift(sysbagBeanList,id, count);
}
break;
}
}
}
}
@Override
public void dealSendGift(final List<SysbagBean> sysbagBeanList, final int id, final int count) {
SysGiftNewBean gift = getDataManager().getGiftBeanByID(String.valueOf(id));
if (gift == null) {
return;
}
String gooId=getDataManager().getGoodIDByGiftID(String.valueOf(id));
if (isExistbag(sysbagBeanList,id)) {
for (final SysbagBean item : sysbagBeanList) {
if (item.getId() == id) {
if (item.getCnt() < count) {
int needCount = count - item.getCnt();
getCompositeDisposable().add(getDataManager()
.doBuyGoodsApiCall(new BuyGoodsRequest(Integer.valueOf(gooId), needCount))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<BuyGoodsResponce>() {
@Override
public void accept(@NonNull BuyGoodsResponce responce) throws Exception {
if(responce.getCode()==0){
sendGift(sysbagBeanList,id, count);
}else{
sendGift(sysbagBeanList,id, item.getCnt());
if (responce.getCode() == 4202) {
getMvpView().onToast("余额不足,请充值");
}else if (responce.getCode()== 4203) {
getMvpView().onToast("礼物已下架");
}
}
}
},getConsumer()));
} else {
sendGift(sysbagBeanList,id, count);
}
break;
}
}
} else {
if (gift != null) {
buyGoods(sysbagBeanList,Integer.valueOf(gooId), id, count);
}
}
}
@Override
public List<SysGiftNewBean> getSysGiftNewBean() {
return getDataManager().getSysGiftNew();
}
@Override
public SysGiftNewBean getGiftBeanByID(String id) {
return getDataManager().getGiftBeanByID(id);
}
@Override
public void getCurrMount(String roomId) {
getCompositeDisposable().add(getDataManager()
.doGetCurrMountApiCall(new GetCurrMountRequest(roomId))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<GetCurrMountResponce>() {
@Override
public void accept(@NonNull GetCurrMountResponce getCurrMountResponce) throws Exception {
if(getCurrMountResponce.getCode()==0){
getMvpView().notifyGetCurrMount(getCurrMountResponce.getCurrMountData());
}else{
AppLogger.e(getCurrMountResponce.getErrMsg());
}
}
},getConsumer()));
}
@Override
public SysMountNewBean getMountBeanByID(String id) {
return getDataManager().getMountBeanByID(id);
}
@Override
public SysConfigBean getSysConfigBean() {
return getDataManager().getSysConfig();
}
public void buyGoods(final List<SysbagBean> sysbagBeanList,int goodId, final int giftid, final int count) {
getCompositeDisposable().add(getDataManager()
.doBuyGoodsApiCall(new BuyGoodsRequest(goodId, count))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<BuyGoodsResponce>() {
@Override
public void accept(@NonNull BuyGoodsResponce responce) throws Exception {
if(responce.getCode()==0){
sendGift(sysbagBeanList,giftid, count);
}else{
if (responce.getCode() == 4202) {
getMvpView().onToast("余额不足,请充值");
}else if (responce.getCode()== 4203) {
getMvpView().onToast("礼物已下架");
}
AppLogger.e(responce.getErrMsg());
}
}
},getConsumer()));
}
public void sendGift(final List<SysbagBean> sysbagBeanList, final int id, final int count) {
getCompositeDisposable().add(getDataManager()
.doSendGiftApiCall(new SendGiftRequest(id, count))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<SendGiftResponce>() {
@Override
public void accept(@NonNull SendGiftResponce responce) throws Exception {
if(responce.getCode()==0){
getMvpView().sendGiftSuccess(sysbagBeanList,id,count);
}else{
if (responce.getCode() == 4023) {
getMvpView().onToast("你已掉线,请重新登录!");
} else {
getMvpView().onToast("赠送失败");
}
AppLogger.e(responce.getErrMsg());
}
}
},getConsumer()));
}
private boolean isExistbag(List<SysbagBean> sysbagBeanList,int id) {
boolean isExist = false;
for (SysbagBean item : sysbagBeanList) {
if (item.getId() == id) {
isExist = true;
break;
}
}
return isExist;
}
}
| [
"635702849@qq.com"
] | 635702849@qq.com |
9d97553469907d32288543d027fd2fb2befc038d | 65a5749dcf5cf3f8dbc3c2286aef15df6647ec0c | /src/L11_UnitTesting_Lab/P01_TestAxe/src/main/java/rpg_lab/interfaces/Target.java | 86c2d3fb240524e20fb4dc3c04c062ab7b415b17 | [] | no_license | tchenkov/SU-Java-OOP-Advanced | 0b780e609204b106bf022dad664cffbe22e3c2ca | 7ab286a04990df70e9c4931d8afe180cc78eb8ee | refs/heads/master | 2021-08-31T14:23:33.659181 | 2017-12-21T16:55:56 | 2017-12-21T16:55:56 | 110,743,711 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package rpg_lab.interfaces;
public interface Target {
public int getHealth();
public void takeAttack(int attackPoints);
public int giveExperience();
public boolean isDead();
}
| [
"joto_to@mail.bg"
] | joto_to@mail.bg |
23dfd2d1c77a75b582383dfabb22e709995bdc0b | 67894e9e0cc7f862472aaa7f525cf6adf9d9be0d | /fine/src/fine/community/training/controller/Training_UpdateInfo.java | 7e9b143762b32eee5481d9efcb19595ec9a368ea | [] | no_license | HyeonBongJeong/fine | 1dbe4e22a26435bec92d95f35befe47b5529b1be | 338eff1ae59acb48697e63920a98087da656282c | refs/heads/main | 2023-03-20T10:09:39.090062 | 2021-03-08T18:26:16 | 2021-03-08T18:26:16 | 317,069,180 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,086 | java | package fine.community.training.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
import com.oreilly.servlet.MultipartRequest;
import com.oreilly.servlet.multipart.DefaultFileRenamePolicy;
import fine.community.training.model.TrainingVO;
import fine.community.training.service.TrainingService;
/**
* Servlet implementation class Training_Write
*/
@WebServlet("/trainingUpdateInfo.do")
public class Training_UpdateInfo extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public Training_UpdateInfo() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
int no = Integer.parseInt(request.getParameter("no"));
System.out.println(no);
TrainingService tService = new TrainingService();
List<TrainingVO> list = new ArrayList<TrainingVO>();
list = tService.getTrainingInfo(no);
System.out.println(list);
request.setAttribute("list", list);
//response.sendRedirect("../training/fine_training_Dtail.jsp?trn_no="+no);
RequestDispatcher disp = request.getRequestDispatcher("/view/training/fine_training_Update.jsp?no="+no);
disp.forward(request, response);
}
}
| [
"you@example.com"
] | you@example.com |
0d6603b45d9c2a4a0fb932c09f9470e3b7f81247 | a2e2d02bcad03b4e95cae352053625fcabfc76ec | /maven-plugin/src/main/java/codes/writeonce/messages/maven/plugin/GenerateMojo.java | 01fb302437566eabcf870fbf854dac20e4d52f63 | [
"Apache-2.0"
] | permissive | trade-mate/messages | f276ebac8d1604179421d71a454a8136cc8a0ac0 | 803c07946b40f225dd8bd21da72a0a15646dd1de | refs/heads/main | 2023-02-26T13:20:10.497126 | 2020-12-30T20:05:04 | 2021-02-08T12:45:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,888 | java | package codes.writeonce.messages.maven.plugin;
import codes.writeonce.messages.schema.generator.SchemaGenerator;
import codes.writeonce.messages.schema.xml.reader.ParsingException;
import codes.writeonce.messages.schema.xml.reader.SchemaInfo;
import codes.writeonce.messages.schema.xml.reader.XmlSchemaReader;
import com.google.common.primitives.Longs;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.archiver.MavenArchiveConfiguration;
import org.apache.maven.archiver.MavenArchiver;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.archiver.Archiver;
import org.codehaus.plexus.archiver.jar.JarArchiver;
import org.codehaus.plexus.archiver.jar.ManifestException;
import org.xml.sax.InputSource;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES;
@Mojo(name = "generate", defaultPhase = GENERATE_SOURCES, threadSafe = true)
public class GenerateMojo extends AbstractMojo {
private static final String DIGEST_ALGORITHM = "SHA-256";
private static final Charset TEXT_DIGEST_CHARSET = UTF_8;
@Parameter(required = true, defaultValue = "${basedir}/src/main/messages")
protected File sourcesBaseDirectory;
@Parameter(required = true)
protected List<String> sources;
@Parameter(required = true, readonly = true, defaultValue = "${project}")
protected MavenProject project;
@Parameter(required = true, defaultValue = "${project.build.directory}/generated-sources/messages")
private File javaOutputDirectory;
@Parameter(defaultValue = "${project.build.sourceEncoding}")
private String javaOutputCharsetName;
@Parameter(required = true, readonly = true, defaultValue = "${mojoExecution}")
private MojoExecution execution;
@Parameter(required = true, readonly = true, defaultValue = "${project.build.directory}")
private File buildDirectory;
@Parameter(required = true, defaultValue = "${project.build.directory}/messages-maven-plugin-markers")
private File markersDirectory;
@Component(role = Archiver.class, hint = "jar")
private JarArchiver jarArchiver;
@Parameter(defaultValue = "${project.build.finalName}", readonly = true)
private String finalName;
@Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;
@Component
private MavenProjectHelper projectHelper;
@Override
public void execute() throws MojoExecutionException {
try {
process();
} catch (MojoExecutionException e) {
throw e;
} catch (Exception e) {
getLog().error(e.getMessage());
throw new MojoExecutionException("Failed to generate sources: " + e.getMessage(), e);
}
}
protected void process() throws Exception {
sourcesBaseDirectory = getSafePath(sourcesBaseDirectory);
javaOutputDirectory = getSafePath(javaOutputDirectory);
buildDirectory = getSafePath(buildDirectory);
markersDirectory = getSafePath(markersDirectory);
final List<Path> files = getSchemaFiles();
final String artifactFileName = finalName + "-messages.jar";
final byte[] sourceDigestBytes = getSourceDigestBytes();
final boolean changed = isChanged(sourceDigestBytes, artifactFileName);
if (changed) {
getLog().info("Generating Java code from schema configuration.");
generateJava(files, sourceDigestBytes, artifactFileName);
} else {
getLog().info("No changes detected. No Java code generated from schema configuration.");
}
project.addCompileSourceRoot(javaOutputDirectory.getPath());
}
private void generateJava(
List<Path> files,
byte[] sourceDigestBytes,
String artifactFileName
) throws IOException, NoSuchAlgorithmException, ParsingException, ManifestException,
DependencyResolutionRequiredException {
final Charset classSourceCharset;
if (StringUtils.isEmpty(javaOutputCharsetName)) {
classSourceCharset = Charset.defaultCharset();
getLog().warn("Using platform encoding (" + classSourceCharset.displayName() +
" actually) to generate sources, i.e. build is platform dependent!");
} else {
classSourceCharset = Charset.forName(javaOutputCharsetName);
}
FileUtils.deleteDirectory(javaOutputDirectory);
final List<SchemaInfo> schemaInfos = new ArrayList<>();
final XmlSchemaReader reader = new XmlSchemaReader();
final ClassLoader classLoader = getProjectClassLoader();
for (final Path file : files) {
try (InputStream inputStream = new FileInputStream(file.toFile())) {
schemaInfos.add(reader.read(new InputSource(inputStream), classLoader));
}
}
Files.createDirectories(javaOutputDirectory.toPath());
for (final SchemaInfo schemaInfo : schemaInfos) {
Files.createDirectories(getJavaSourceOutputPath(schemaInfo));
}
final SchemaGenerator generator = new SchemaGenerator();
for (final SchemaInfo schemaInfo : schemaInfos) {
generator.generate(schemaInfo, getJavaSourceOutputPath(schemaInfo), classSourceCharset);
}
final File jarFile = new File(buildDirectory, artifactFileName);
final MavenArchiver archiver = new MavenArchiver();
archiver.setArchiver(jarArchiver);
archiver.setOutputFile(jarFile);
for (final Path resource : files) {
final String destFileName = sourcesBaseDirectory.toPath().relativize(resource).toString();
archiver.getArchiver().addFile(resource.toFile(), destFileName);
}
archiver.createArchive(session, project, new MavenArchiveConfiguration());
projectHelper.attachArtifact(project, "jar", "messages", jarFile);
final byte[] targetDigestBytes = getGeneratedFilesDigest(artifactFileName);
final Path statusFilePath = getStatusFilePath();
Files.createDirectories(statusFilePath.getParent());
try (FileOutputStream out = new FileOutputStream(statusFilePath.toFile());
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(out, TEXT_DIGEST_CHARSET);
BufferedWriter writer = new BufferedWriter(outputStreamWriter)) {
writer.write(Hex.encodeHex(sourceDigestBytes));
writer.newLine();
writer.write(Hex.encodeHex(targetDigestBytes));
writer.newLine();
}
}
private ClassLoader getProjectClassLoader() throws MalformedURLException {
return URLClassLoader.newInstance(new URL[]{sourcesBaseDirectory.toURI().toURL()},
Thread.currentThread().getContextClassLoader());
}
protected List<Path> getSchemaFiles() throws MojoExecutionException {
final List<Path> schemaFiles = new ArrayList<>();
for (final String source : sources) {
final Path schemaFile = sourcesBaseDirectory.toPath().resolve(source);
if (!Files.isRegularFile(schemaFile)) {
throw new MojoExecutionException("Source does not exist: " + source);
}
schemaFiles.add(schemaFile);
}
return schemaFiles;
}
protected File getSafePath(File file) {
return project.getBasedir().toPath().resolve(file.toPath()).toFile();
}
private Path getJavaSourceOutputPath(SchemaInfo schemaInfo) {
final Path javaOutputPath = javaOutputDirectory.toPath();
final Path javaPackageSubpath =
javaOutputPath.getFileSystem().getPath("", schemaInfo.getPackageName().split("\\."));
return javaOutputPath.resolve(javaPackageSubpath);
}
private Path getStatusFilePath() throws NoSuchAlgorithmException {
final MessageDigest statusDigest = MessageDigest.getInstance(DIGEST_ALGORITHM);
statusDigest.update(execution.getExecutionId().getBytes(TEXT_DIGEST_CHARSET));
return markersDirectory.toPath().resolve(Hex.encodeHexString(statusDigest.digest()));
}
private boolean isChanged(byte[] sourceDigestBytes, String artifactFileName)
throws NoSuchAlgorithmException, IOException, DecoderException {
if (!javaOutputDirectory.exists()) {
return true;
}
if (!Files.exists(buildDirectory.toPath().resolve(artifactFileName))) {
return true;
}
final Path statusFilePath = getStatusFilePath();
if (!Files.exists(statusFilePath)) {
return true;
}
final byte[] targetDigestBytes = getGeneratedFilesDigest(artifactFileName);
try (FileInputStream in = new FileInputStream(statusFilePath.toFile());
InputStreamReader inputStreamReader = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(inputStreamReader)) {
return !Arrays.equals(sourceDigestBytes, Hex.decodeHex(reader.readLine().toCharArray())) ||
!Arrays.equals(targetDigestBytes, Hex.decodeHex(reader.readLine().toCharArray()));
}
}
private byte[] getSourceDigestBytes() throws NoSuchAlgorithmException, IOException {
final MessageDigest md = MessageDigest.getInstance(DIGEST_ALGORITHM);
for (final String resourcePath : sources) {
updateDigest(sourcesBaseDirectory.toPath(), md, Paths.get(resourcePath));
}
return md.digest();
}
private byte[] getGeneratedFilesDigest(String artifactFileName) throws IOException, NoSuchAlgorithmException {
final MessageDigest md = MessageDigest.getInstance(DIGEST_ALGORITHM);
updateDigest(buildDirectory.toPath(), md, Paths.get(artifactFileName));
final Path root = javaOutputDirectory.toPath();
final List<Path> files = Utils.getFilesFromSubtree(root);
Collections.sort(files);
for (final Path filePath : files) {
updateDigest(root, md, filePath);
}
return md.digest();
}
private static void updateDigest(Path root, MessageDigest md, Path filePath) throws IOException {
md.update(filePath.toString().getBytes(TEXT_DIGEST_CHARSET));
final Path resolvedFilePath = root.resolve(filePath);
md.update(Longs.toByteArray(Files.size(resolvedFilePath)));
md.update(Longs.toByteArray(Files.getLastModifiedTime(resolvedFilePath).toMillis()));
}
}
| [
"alexey.romenskiy@gmail.com"
] | alexey.romenskiy@gmail.com |
e94e1552414712b388aabf7d9a3bce2b2171a244 | 7484f8c5ff8f2d1e31d3190b733e5d522ac18573 | /product/src/main/java/dao/ProductRepository.java | ba0ee19f3cadf71b05e31d395477e14d80e68a00 | [] | no_license | dubilyer/YuvalInternetShop | e38fdb25fc35270029cb7e0630bff6db91e3e108 | 58511c8e653c14aa65ab4655d2f06d5a5413c44f | refs/heads/master | 2021-01-02T22:53:35.364778 | 2017-08-14T05:51:23 | 2017-08-14T05:51:23 | 99,414,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package dao;
import model.Product;
import java.util.List;
import java.util.NoSuchElementException;
public interface ProductRepository {
List<Product> getAllProducts();
void addProduct(Product product) throws NoSuchElementException;
void deleteProduct(long id) throws NoSuchElementException;
Product getProductById(long id) throws NoSuchElementException;
}
| [
"edaorik@gmail.com"
] | edaorik@gmail.com |
3e256cb653136c59c3cd909bf13dfad62ae8440f | dd79da2eefc0685cd98215ea18decf6611961ffb | /Classes and Objects/src/Calculator.java | 3904ce6c3e6783d81b908c7bba87a86fcb1c1f16 | [] | no_license | navin613/pblapp_Inheritance | 91f63aea81ff0bbbb41536c0fba5647404658d56 | f42b10fbb4996c87e9bf00b81f988c94d1963a7a | refs/heads/master | 2022-04-21T08:17:51.024247 | 2020-04-20T07:29:57 | 2020-04-20T07:29:57 | 257,203,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | public class Calculator {
public static double powerInt(int num1, int num2){
return Math.pow(num1,num2);
}
public static double powerDouble(double num1,int num2){
return Math.pow(num1,num2);
}
public static void main(String args[]){
System.out.println(Calculator.powerInt(5, 2));
System.out.println(Calculator.powerDouble(5.5, 2));
}
}
| [
"49487174+navin613@users.noreply.github.com"
] | 49487174+navin613@users.noreply.github.com |
d12b7e56d67764fc3fb98f16cb5da28387cff431 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_plaf_multi_MultiListUI_getClass.java | 42b014f34e5a3be910028dac1b598a555142187c | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | class javax_swing_plaf_multi_MultiListUI_getClass{ public static void function() {javax.swing.plaf.multi.MultiListUI obj = new javax.swing.plaf.multi.MultiListUI();obj.getClass();}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
d8e820376db2afffe443c1d4da65092c242339f1 | 76413f66c9f8527b2a891322e5ad8175442656d8 | /SpeedCarAloneRmiServer/src/GameEngineInterface.java | 8daad603cd63166fc7a4bab13cf1e8ab2cf7331d | [] | no_license | brascojoel/SpeedCarAloneRmiServer | efe3249a5bd81e255881776c4d24b227f1698653 | a1391a2749f19d50dd0e89e2b48e4f2223382df4 | refs/heads/master | 2021-05-08T14:25:04.986932 | 2018-02-17T16:45:38 | 2018-02-17T16:45:38 | 120,084,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java |
import java.awt.Color;
import java.rmi.RemoteException;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
public interface GameEngineInterface extends java.rmi.Remote {
/**
* quand le client se connecte pour la prmiere fois
*
* @param client
* @return
* @throws RemoteException
*/
public long connect(ClientInterface client) throws RemoteException;
/**
* Quand le client se déconnecte et quitte completement le jeu
*
* @param userId
* @throws RemoteException
*/
public void disconnect(long userId) throws RemoteException;
/**
* Pour démarrer une partie
*
* @param userId
* @return
* @throws RemoteException
*/
public boolean startGame(long userId) throws RemoteException;
/**
* Pour lancer une partie
*
* @param userId
* @throws RemoteException
*/
public void beginGame(long userId) throws RemoteException;
/**
* Initialisation de la grille
* @param userId
* @throws RemoteException
*/
public void newGrid(long userId) throws RemoteException;
/**
*
* @param userId
* @return
* @throws RemoteException
*/
public int getScoreClient(long userId) throws RemoteException;
/**
*
* @param userId
* @param choice
* @param flag
* @throws RemoteException
*/
public void moveCar(long userId, String choice, boolean flag) throws RemoteException;
} // end interface
| [
"brascojoel@yahoo.fr"
] | brascojoel@yahoo.fr |
d153222d1baa01a654532dc187b0780f2fdd0195 | 89ef7f766c0ca244c11ae686d0799956740150a7 | /KnowYourCostumer/KnowYourCostumer-ejb/src/main/java/ec/edu/espe/arquitectura/dao/TipoTelefonoFacade.java | 25028c84702fefff96493da790c86a76ba482ed0 | [] | no_license | jonx29/KnowYourCostumer | 2dfa1e02c914084bf46a318d315031093e4f6c76 | 6a2c00b165eb1529aebf44547b88c4d00c509fa3 | refs/heads/master | 2020-04-03T09:18:58.518368 | 2018-11-13T20:39:21 | 2018-11-13T20:39:21 | 155,131,865 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | 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 ec.edu.espe.arquitectura.dao;
import ec.edu.espe.arquitectura.model.TipoTelefono;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author jeffe
*/
@Stateless
public class TipoTelefonoFacade extends AbstractFacade<TipoTelefono> {
@PersistenceContext(unitName = "ec.edu.espe.arquitectura_KnowYourCostumer-ejb_ejb_1.0-SNAPSHOTPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public TipoTelefonoFacade() {
super(TipoTelefono.class);
}
}
| [
"jitambaco@espe.edu.ec"
] | jitambaco@espe.edu.ec |
0db9581ed0a192a0d5996132d6fe4a1418b2b0dc | 89fac4b6f7c7b1717353e5f4827e0b10616f016b | /back/src/main/java/fi/tampere/mustasaari/mikko/buttongame/NumberModel.java | 020d922a7f044100e8356d5c787efa0168b6e183 | [] | no_license | mustasaari/buttongame | f786f4ace35e47a53b876e422d2667c63e6b1dfb | b54368a24ff67ff587df2eb2b1cc0b14c1d2abfb | refs/heads/master | 2023-01-24T04:46:24.817854 | 2020-02-25T05:47:18 | 2020-02-25T05:47:18 | 236,181,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package fi.tampere.mustasaari.mikko.buttongame;
import javax.persistence.*;
@Entity
public class NumberModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private int theCurrentNumber;
public NumberModel() {
}
public NumberModel(int number) {
this.theCurrentNumber = number;
}
public int getNumber() {
return this.theCurrentNumber;
}
public void setNumber(int number) {
this.theCurrentNumber = number;
}
public void increaseNumber() {
this.theCurrentNumber++;
}
public Long getId() {
return id;
}
} | [
"mustasaari@gmail.com"
] | mustasaari@gmail.com |
a0d61c3665e0fc472b20a82ac7a49b91b238f784 | a1969698ce456c817a362e3f1847d836a9d47d80 | /src/main/java/com/blogspot/mikelaud/ibl/task/event/account_and_portfolio/OnUpdateAccountValue.java | 381be7bc6bd35e1c77dc573d281863f61c5d7a8b | [] | no_license | benalexau/interactive-brokers-library | 9eace4367289c3d54da95413030373b5cd7d0b0e | f78938f0acbb826a28490bcb943281d000cb13cd | refs/heads/master | 2021-01-18T05:48:57.509829 | 2015-11-27T05:16:38 | 2015-11-27T05:16:38 | 46,956,123 | 2 | 0 | null | 2015-11-27T02:42:39 | 2015-11-27T02:42:39 | null | UTF-8 | Java | false | false | 2,274 | java | package com.blogspot.mikelaud.ibl.task.event.account_and_portfolio;
import com.blogspot.mikelaud.ibl.Config;
import com.blogspot.mikelaud.ibl.connection.ConnectionContext;
import com.blogspot.mikelaud.ibl.task.Task;
import com.blogspot.mikelaud.ibl.task.TaskInnerObject;
import com.blogspot.mikelaud.ibl.task.event.EventTaskEx;
/**
* This event is called only when CallReqAccountUpdates call
* on the EClientSocket object has been called.
*/
public class OnUpdateAccountValue
extends EventTaskEx<OnUpdateAccountValue.Info>
{
//------------------------------------------------------------------------
public static class Info {
/**
* A string that indicates one type of account value.
* There is a long list of possible keys that can be sent,
* here are just a few examples:
* CashBalance - account cash balance
* DayTradesRemaining - number of day trades left
* EquityWithLoanValue - equity with Loan Value
* InitMarginReq - current initial margin requirement
* MaintMarginReq - current maintenance margin
* NetLiquidation - net liquidation value
*/
public final String KEY;
/**
* The value associated with the key.
*/
public final String VALUE;
/**
* Defines the currency type, in case the value is a currency type.
*/
public final String CURRENCY;
/**
* States the account the message applies to.
* Useful for Financial Advisor sub-account messages.
*/
public final String ACCOUNT_NAME;
public Info
( String aKey
, String aValue
, String aCurrency
, String aAccountName
) {
KEY = aKey;
VALUE = aValue;
CURRENCY = aCurrency;
ACCOUNT_NAME = aAccountName;
}
}
//------------------------------------------------------------------------
@Override
public int getRequestId() {
return Config.getNoRequestId();
}
@Override
protected Task onEvent() throws Exception {
return null;
}
@Override
public String toString() {
return String.format
( "%s(%s) { key=\"%s\" currency=\"%s\" accountName=\"%s\" }"
, super.toString()
, INFO.VALUE
, INFO.KEY
, INFO.CURRENCY
, INFO.ACCOUNT_NAME
);
}
public OnUpdateAccountValue(ConnectionContext aContext, Info aInfo) {
super(aContext, aInfo, new TaskInnerObject(){});
}
}
| [
"mmx.mmx@gmail.com"
] | mmx.mmx@gmail.com |
ddb8e2f3bf39481ff79ab1424bd41089929753cd | 8c714793258ef46b9e6409dd9ec867648afcd7ac | /src/main/java/com/gun3y/bayes/NaiveBayes.java | 8065e6855d05b25a37206477215e5242fefef53c | [
"Apache-2.0"
] | permissive | mguney/bayes-classifier | 860630d8abf2b92e3a3ad0579de5359728514530 | 003ef2f01fb3dccd557e56ac1910d775b9de7ca3 | refs/heads/master | 2021-01-01T18:27:55.004360 | 2013-11-15T18:13:35 | 2013-11-15T18:13:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,480 | java | package com.gun3y.bayes;
import java.util.List;
import java.util.Map.Entry;
import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
import com.google.common.base.Strings;
import com.gun3y.bayes.model.Attribute;
import com.gun3y.bayes.model.Instance;
import com.gun3y.bayes.model.TrainingSet;
public class NaiveBayes implements Classifier {
private TrainingSet trainingSet;
public NaiveBayes(TrainingSet trainingSet) {
super();
this.trainingSet = trainingSet;
}
public boolean train() {
return false;
}
public String classify(Instance instance) {
double bestProbality = 0.0;
String bestConcept = "";
if (trainingSet != null) {
for (Entry<String, List<Instance>> entry : trainingSet.getConcepts().entrySet()) {
double accP = getProbability(entry.getKey(), instance);
if (accP > bestProbality) {
bestProbality = accP;
bestConcept = entry.getKey();
}
}
}
return bestConcept;
}
private double getProbability(String conceptName, Instance testInstance) {
List<Instance> subConcepts = trainingSet.getConcepts().get(conceptName);
double prob = (double) subConcepts.size() / trainingSet.getInstanceSize();
for (Attribute att : trainingSet.getAttributes()) {
double[] values = getValuesFromAttibute(att.getName(), subConcepts);
prob *= calcGaussianProabality((Double) testInstance.getAttributeByName(att.getName()).getValue(), values);
}
return prob;
}
private double calcGaussianProabality(double num, double[] list) {
SummaryStatistics statistics = new SummaryStatistics();
for (double d : list) {
statistics.addValue(d);
}
double mean = statistics.getMean();
double std = statistics.getStandardDeviation();
double var = statistics.getVariance();
double result = Math.exp((-0.5) * Math.pow((num - mean) / std, 2)) / Math.sqrt(2 * Math.PI * var);
if (Double.isNaN(result))
result = Double.MIN_VALUE;
return result;
}
public double[] getValuesFromAttibute(String attName, List<Instance> ins) {
if (ins != null && !Strings.isNullOrEmpty(attName)) {
double[] vec = new double[ins.size()];
for (int i = 0; i < vec.length; i++) {
vec[i] = (Double) ins.get(i).getAttributeByName(attName).getValue();
}
return vec;
}
return new double[0];
}
public TrainingSet getTrainingSet() {
return trainingSet;
}
public void setTrainingSet(TrainingSet trainingSet) {
this.trainingSet = trainingSet;
}
}
| [
"mguney.cs@gmail.com"
] | mguney.cs@gmail.com |
44b2ab227b022428d1afa2cf35846d876069c39d | de63b18c874ef036b533785e111dcecbd58cb4ec | /Backend/src/main/java/com/app/pojos/ProjectMapping.java | 3cac8f93559d9e539e3a509f7417ebc050d3ac67 | [] | no_license | Pratiksha215/DacProject | 389a09cf8bd9a15082e2fc0f9d58895be45aabfe | 1fa47dc5677c4f644bdde8456957a3e6a1652600 | refs/heads/main | 2023-02-26T01:35:27.321945 | 2021-02-02T15:30:48 | 2021-02-02T15:30:48 | 315,560,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,727 | java | package com.app.pojos;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.annotation.JsonProperty;
@SuppressWarnings("serial")
@Embeddable
@Entity
@Table(name="projectMapping")
public class ProjectMapping implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer projectMappingid;
@OneToOne
@JoinColumn(name="projectId")
private Projects projects;
@OneToOne
@JoinColumn(name="personId")
private People people;
@Column(name = "startDate")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonProperty(value = "startDate")
private LocalDate startDate;
@Column(name = "endDate")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonProperty(value = "endDate")
private LocalDate endDate;
public ProjectMapping() {
System.out.println("in "+getClass().getName());
}
public ProjectMapping(Integer projectMappingid, Projects projects, People people, LocalDate startDate,
LocalDate endDate) {
super();
this.projectMappingid = projectMappingid;
this.projects = projects;
this.people = people;
this.startDate = startDate;
this.endDate = endDate;
}
public Integer getProjectMappingid() {
return projectMappingid;
}
public void setProjectMappingid(Integer projectMappingid) {
this.projectMappingid = projectMappingid;
}
public Projects getProjects() {
return projects;
}
public void setProjects(Projects projects) {
this.projects = projects;
}
public People getPeople() {
return people;
}
public void setPeople(People people) {
this.people = people;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
@Override
public String toString() {
return "ProjectMapping [projectMappingid=" + projectMappingid + ", projects=" + projects + ", people=" + people
+ ", startDate=" + startDate + ", endDate=" + endDate + "]";
}
} | [
"pratiksha12.p@gmail.com"
] | pratiksha12.p@gmail.com |
4e80b74981107c3aff6b33a4243d1e38fdaaa241 | 7ae72d4cbfb980b076abb68f5a0b831506345b02 | /zfinmine/dbmodel/build/gen/src/org/intermine/model/bio/SpliceDonorShadow.java | 43733525708bf75073edd4f5adbacdf50bd87552 | [] | no_license | sierramoxon/ZFINmine | 35fd3ba5e125c79f75152f4bda613cb595706c0c | 7b6ad8a06a4f90757c3d86f9cddeb0bd79a946ae | refs/heads/master | 2021-01-19T11:28:31.393353 | 2010-03-24T19:44:30 | 2010-03-24T19:44:30 | 576,326 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,097 | java | package org.intermine.model.bio;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.intermine.NotXmlParser;
import org.intermine.objectstore.intermine.NotXmlRenderer;
import org.intermine.objectstore.proxy.ProxyCollection;
import org.intermine.objectstore.proxy.ProxyReference;
import org.intermine.util.StringConstructor;
import org.intermine.util.StringUtil;
import org.intermine.util.TypeUtil;
import org.intermine.model.ShadowClass;
public class SpliceDonorShadow implements SpliceDonor, org.intermine.model.ShadowClass
{
public static final Class shadowOf = SpliceDonor.class;
// Col: org.intermine.model.bio.SpliceSite.primaryTranscripts
protected java.util.Set<org.intermine.model.bio.PrimaryTranscript> primaryTranscripts = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.PrimaryTranscript> getPrimaryTranscripts() { return primaryTranscripts; }
public void setPrimaryTranscripts(final java.util.Set<org.intermine.model.bio.PrimaryTranscript> primaryTranscripts) { this.primaryTranscripts = primaryTranscripts; }
public void addPrimaryTranscripts(final org.intermine.model.bio.PrimaryTranscript arg) { primaryTranscripts.add(arg); }
// Attr: org.intermine.model.bio.LocatedSequenceFeature.length
protected java.lang.Integer length;
public java.lang.Integer getLength() { return length; }
public void setLength(final java.lang.Integer length) { this.length = length; }
// Ref: org.intermine.model.bio.LocatedSequenceFeature.sequence
protected org.intermine.model.InterMineObject sequence;
public org.intermine.model.bio.Sequence getSequence() { if (sequence instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.Sequence) ((org.intermine.objectstore.proxy.ProxyReference) sequence).getObject()); }; return (org.intermine.model.bio.Sequence) sequence; }
public void setSequence(final org.intermine.model.bio.Sequence sequence) { this.sequence = sequence; }
public void proxySequence(final org.intermine.objectstore.proxy.ProxyReference sequence) { this.sequence = sequence; }
public org.intermine.model.InterMineObject proxGetSequence() { return sequence; }
// Ref: org.intermine.model.bio.LocatedSequenceFeature.chromosome
protected org.intermine.model.InterMineObject chromosome;
public org.intermine.model.bio.Chromosome getChromosome() { if (chromosome instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.Chromosome) ((org.intermine.objectstore.proxy.ProxyReference) chromosome).getObject()); }; return (org.intermine.model.bio.Chromosome) chromosome; }
public void setChromosome(final org.intermine.model.bio.Chromosome chromosome) { this.chromosome = chromosome; }
public void proxyChromosome(final org.intermine.objectstore.proxy.ProxyReference chromosome) { this.chromosome = chromosome; }
public org.intermine.model.InterMineObject proxGetChromosome() { return chromosome; }
// Ref: org.intermine.model.bio.LocatedSequenceFeature.chromosomeLocation
protected org.intermine.model.InterMineObject chromosomeLocation;
public org.intermine.model.bio.Location getChromosomeLocation() { if (chromosomeLocation instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.Location) ((org.intermine.objectstore.proxy.ProxyReference) chromosomeLocation).getObject()); }; return (org.intermine.model.bio.Location) chromosomeLocation; }
public void setChromosomeLocation(final org.intermine.model.bio.Location chromosomeLocation) { this.chromosomeLocation = chromosomeLocation; }
public void proxyChromosomeLocation(final org.intermine.objectstore.proxy.ProxyReference chromosomeLocation) { this.chromosomeLocation = chromosomeLocation; }
public org.intermine.model.InterMineObject proxGetChromosomeLocation() { return chromosomeLocation; }
// Col: org.intermine.model.bio.LocatedSequenceFeature.overlappingFeatures
protected java.util.Set<org.intermine.model.bio.LocatedSequenceFeature> overlappingFeatures = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.LocatedSequenceFeature> getOverlappingFeatures() { return overlappingFeatures; }
public void setOverlappingFeatures(final java.util.Set<org.intermine.model.bio.LocatedSequenceFeature> overlappingFeatures) { this.overlappingFeatures = overlappingFeatures; }
public void addOverlappingFeatures(final org.intermine.model.bio.LocatedSequenceFeature arg) { overlappingFeatures.add(arg); }
// Attr: org.intermine.model.bio.BioEntity.curated
protected java.lang.Boolean curated;
public java.lang.Boolean getCurated() { return curated; }
public void setCurated(final java.lang.Boolean curated) { this.curated = curated; }
// Attr: org.intermine.model.bio.BioEntity.secondaryIdentifier
protected java.lang.String secondaryIdentifier;
public java.lang.String getSecondaryIdentifier() { return secondaryIdentifier; }
public void setSecondaryIdentifier(final java.lang.String secondaryIdentifier) { this.secondaryIdentifier = secondaryIdentifier; }
// Attr: org.intermine.model.bio.BioEntity.name
protected java.lang.String name;
public java.lang.String getName() { return name; }
public void setName(final java.lang.String name) { this.name = name; }
// Attr: org.intermine.model.bio.BioEntity.primaryIdentifier
protected java.lang.String primaryIdentifier;
public java.lang.String getPrimaryIdentifier() { return primaryIdentifier; }
public void setPrimaryIdentifier(final java.lang.String primaryIdentifier) { this.primaryIdentifier = primaryIdentifier; }
// Ref: org.intermine.model.bio.BioEntity.organism
protected org.intermine.model.InterMineObject organism;
public org.intermine.model.bio.Organism getOrganism() { if (organism instanceof org.intermine.objectstore.proxy.ProxyReference) { return ((org.intermine.model.bio.Organism) ((org.intermine.objectstore.proxy.ProxyReference) organism).getObject()); }; return (org.intermine.model.bio.Organism) organism; }
public void setOrganism(final org.intermine.model.bio.Organism organism) { this.organism = organism; }
public void proxyOrganism(final org.intermine.objectstore.proxy.ProxyReference organism) { this.organism = organism; }
public org.intermine.model.InterMineObject proxGetOrganism() { return organism; }
// Col: org.intermine.model.bio.BioEntity.relations
protected java.util.Set<org.intermine.model.bio.SymmetricalRelation> relations = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.SymmetricalRelation> getRelations() { return relations; }
public void setRelations(final java.util.Set<org.intermine.model.bio.SymmetricalRelation> relations) { this.relations = relations; }
public void addRelations(final org.intermine.model.bio.SymmetricalRelation arg) { relations.add(arg); }
// Col: org.intermine.model.bio.BioEntity.subjects
protected java.util.Set<org.intermine.model.bio.Relation> subjects = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Relation> getSubjects() { return subjects; }
public void setSubjects(final java.util.Set<org.intermine.model.bio.Relation> subjects) { this.subjects = subjects; }
public void addSubjects(final org.intermine.model.bio.Relation arg) { subjects.add(arg); }
// Col: org.intermine.model.bio.BioEntity.objects
protected java.util.Set<org.intermine.model.bio.Relation> objects = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Relation> getObjects() { return objects; }
public void setObjects(final java.util.Set<org.intermine.model.bio.Relation> objects) { this.objects = objects; }
public void addObjects(final org.intermine.model.bio.Relation arg) { objects.add(arg); }
// Col: org.intermine.model.bio.BioEntity.annotations
protected java.util.Set<org.intermine.model.bio.Annotation> annotations = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Annotation> getAnnotations() { return annotations; }
public void setAnnotations(final java.util.Set<org.intermine.model.bio.Annotation> annotations) { this.annotations = annotations; }
public void addAnnotations(final org.intermine.model.bio.Annotation arg) { annotations.add(arg); }
// Col: org.intermine.model.bio.BioEntity.synonyms
protected java.util.Set<org.intermine.model.bio.Synonym> synonyms = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Synonym> getSynonyms() { return synonyms; }
public void setSynonyms(final java.util.Set<org.intermine.model.bio.Synonym> synonyms) { this.synonyms = synonyms; }
public void addSynonyms(final org.intermine.model.bio.Synonym arg) { synonyms.add(arg); }
// Col: org.intermine.model.bio.BioEntity.evidence
protected java.util.Set<org.intermine.model.bio.Evidence> evidence = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Evidence> getEvidence() { return evidence; }
public void setEvidence(final java.util.Set<org.intermine.model.bio.Evidence> evidence) { this.evidence = evidence; }
public void addEvidence(final org.intermine.model.bio.Evidence arg) { evidence.add(arg); }
// Col: org.intermine.model.bio.BioEntity.dataSets
protected java.util.Set<org.intermine.model.bio.DataSet> dataSets = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.DataSet> getDataSets() { return dataSets; }
public void setDataSets(final java.util.Set<org.intermine.model.bio.DataSet> dataSets) { this.dataSets = dataSets; }
public void addDataSets(final org.intermine.model.bio.DataSet arg) { dataSets.add(arg); }
// Col: org.intermine.model.bio.BioEntity.publications
protected java.util.Set<org.intermine.model.bio.Publication> publications = new java.util.HashSet();
public java.util.Set<org.intermine.model.bio.Publication> getPublications() { return publications; }
public void setPublications(final java.util.Set<org.intermine.model.bio.Publication> publications) { this.publications = publications; }
public void addPublications(final org.intermine.model.bio.Publication arg) { publications.add(arg); }
// Attr: org.intermine.model.InterMineObject.id
protected java.lang.Integer id;
public java.lang.Integer getId() { return id; }
public void setId(final java.lang.Integer id) { this.id = id; }
public boolean equals(Object o) { return (o instanceof SpliceDonor && id != null) ? id.equals(((SpliceDonor)o).getId()) : this == o; }
public int hashCode() { return (id != null) ? id.hashCode() : super.hashCode(); }
public String toString() { return "SpliceDonor [chromosome=" + (chromosome == null ? "null" : (chromosome.getId() == null ? "no id" : chromosome.getId().toString())) + ", chromosomeLocation=" + (chromosomeLocation == null ? "null" : (chromosomeLocation.getId() == null ? "no id" : chromosomeLocation.getId().toString())) + ", curated=\"" + curated + "\", id=\"" + id + "\", length=\"" + length + "\", name=\"" + name + "\", organism=" + (organism == null ? "null" : (organism.getId() == null ? "no id" : organism.getId().toString())) + ", primaryIdentifier=\"" + primaryIdentifier + "\", secondaryIdentifier=\"" + secondaryIdentifier + "\", sequence=" + (sequence == null ? "null" : (sequence.getId() == null ? "no id" : sequence.getId().toString())) + "]"; }
public Object getFieldValue(final String fieldName) throws IllegalAccessException {
if ("primaryTranscripts".equals(fieldName)) {
return primaryTranscripts;
}
if ("length".equals(fieldName)) {
return length;
}
if ("sequence".equals(fieldName)) {
if (sequence instanceof ProxyReference) {
return ((ProxyReference) sequence).getObject();
} else {
return sequence;
}
}
if ("chromosome".equals(fieldName)) {
if (chromosome instanceof ProxyReference) {
return ((ProxyReference) chromosome).getObject();
} else {
return chromosome;
}
}
if ("chromosomeLocation".equals(fieldName)) {
if (chromosomeLocation instanceof ProxyReference) {
return ((ProxyReference) chromosomeLocation).getObject();
} else {
return chromosomeLocation;
}
}
if ("overlappingFeatures".equals(fieldName)) {
return overlappingFeatures;
}
if ("curated".equals(fieldName)) {
return curated;
}
if ("secondaryIdentifier".equals(fieldName)) {
return secondaryIdentifier;
}
if ("name".equals(fieldName)) {
return name;
}
if ("primaryIdentifier".equals(fieldName)) {
return primaryIdentifier;
}
if ("organism".equals(fieldName)) {
if (organism instanceof ProxyReference) {
return ((ProxyReference) organism).getObject();
} else {
return organism;
}
}
if ("relations".equals(fieldName)) {
return relations;
}
if ("subjects".equals(fieldName)) {
return subjects;
}
if ("objects".equals(fieldName)) {
return objects;
}
if ("annotations".equals(fieldName)) {
return annotations;
}
if ("synonyms".equals(fieldName)) {
return synonyms;
}
if ("evidence".equals(fieldName)) {
return evidence;
}
if ("dataSets".equals(fieldName)) {
return dataSets;
}
if ("publications".equals(fieldName)) {
return publications;
}
if ("id".equals(fieldName)) {
return id;
}
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
return TypeUtil.getFieldValue(this, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public Object getFieldProxy(final String fieldName) throws IllegalAccessException {
if ("primaryTranscripts".equals(fieldName)) {
return primaryTranscripts;
}
if ("length".equals(fieldName)) {
return length;
}
if ("sequence".equals(fieldName)) {
return sequence;
}
if ("chromosome".equals(fieldName)) {
return chromosome;
}
if ("chromosomeLocation".equals(fieldName)) {
return chromosomeLocation;
}
if ("overlappingFeatures".equals(fieldName)) {
return overlappingFeatures;
}
if ("curated".equals(fieldName)) {
return curated;
}
if ("secondaryIdentifier".equals(fieldName)) {
return secondaryIdentifier;
}
if ("name".equals(fieldName)) {
return name;
}
if ("primaryIdentifier".equals(fieldName)) {
return primaryIdentifier;
}
if ("organism".equals(fieldName)) {
return organism;
}
if ("relations".equals(fieldName)) {
return relations;
}
if ("subjects".equals(fieldName)) {
return subjects;
}
if ("objects".equals(fieldName)) {
return objects;
}
if ("annotations".equals(fieldName)) {
return annotations;
}
if ("synonyms".equals(fieldName)) {
return synonyms;
}
if ("evidence".equals(fieldName)) {
return evidence;
}
if ("dataSets".equals(fieldName)) {
return dataSets;
}
if ("publications".equals(fieldName)) {
return publications;
}
if ("id".equals(fieldName)) {
return id;
}
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
return TypeUtil.getFieldProxy(this, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public void setFieldValue(final String fieldName, final Object value) {
if ("primaryTranscripts".equals(fieldName)) {
primaryTranscripts = (java.util.Set) value;
} else if ("length".equals(fieldName)) {
length = (java.lang.Integer) value;
} else if ("sequence".equals(fieldName)) {
sequence = (org.intermine.model.InterMineObject) value;
} else if ("chromosome".equals(fieldName)) {
chromosome = (org.intermine.model.InterMineObject) value;
} else if ("chromosomeLocation".equals(fieldName)) {
chromosomeLocation = (org.intermine.model.InterMineObject) value;
} else if ("overlappingFeatures".equals(fieldName)) {
overlappingFeatures = (java.util.Set) value;
} else if ("curated".equals(fieldName)) {
curated = (java.lang.Boolean) value;
} else if ("secondaryIdentifier".equals(fieldName)) {
secondaryIdentifier = (java.lang.String) value;
} else if ("name".equals(fieldName)) {
name = (java.lang.String) value;
} else if ("primaryIdentifier".equals(fieldName)) {
primaryIdentifier = (java.lang.String) value;
} else if ("organism".equals(fieldName)) {
organism = (org.intermine.model.InterMineObject) value;
} else if ("relations".equals(fieldName)) {
relations = (java.util.Set) value;
} else if ("subjects".equals(fieldName)) {
subjects = (java.util.Set) value;
} else if ("objects".equals(fieldName)) {
objects = (java.util.Set) value;
} else if ("annotations".equals(fieldName)) {
annotations = (java.util.Set) value;
} else if ("synonyms".equals(fieldName)) {
synonyms = (java.util.Set) value;
} else if ("evidence".equals(fieldName)) {
evidence = (java.util.Set) value;
} else if ("dataSets".equals(fieldName)) {
dataSets = (java.util.Set) value;
} else if ("publications".equals(fieldName)) {
publications = (java.util.Set) value;
} else if ("id".equals(fieldName)) {
id = (java.lang.Integer) value;
} else {
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
TypeUtil.setFieldValue(this, fieldName, value);
return;
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
}
public Class getFieldType(final String fieldName) {
if ("primaryTranscripts".equals(fieldName)) {
return java.util.Set.class;
}
if ("length".equals(fieldName)) {
return java.lang.Integer.class;
}
if ("sequence".equals(fieldName)) {
return org.intermine.model.bio.Sequence.class;
}
if ("chromosome".equals(fieldName)) {
return org.intermine.model.bio.Chromosome.class;
}
if ("chromosomeLocation".equals(fieldName)) {
return org.intermine.model.bio.Location.class;
}
if ("overlappingFeatures".equals(fieldName)) {
return java.util.Set.class;
}
if ("curated".equals(fieldName)) {
return java.lang.Boolean.class;
}
if ("secondaryIdentifier".equals(fieldName)) {
return java.lang.String.class;
}
if ("name".equals(fieldName)) {
return java.lang.String.class;
}
if ("primaryIdentifier".equals(fieldName)) {
return java.lang.String.class;
}
if ("organism".equals(fieldName)) {
return org.intermine.model.bio.Organism.class;
}
if ("relations".equals(fieldName)) {
return java.util.Set.class;
}
if ("subjects".equals(fieldName)) {
return java.util.Set.class;
}
if ("objects".equals(fieldName)) {
return java.util.Set.class;
}
if ("annotations".equals(fieldName)) {
return java.util.Set.class;
}
if ("synonyms".equals(fieldName)) {
return java.util.Set.class;
}
if ("evidence".equals(fieldName)) {
return java.util.Set.class;
}
if ("dataSets".equals(fieldName)) {
return java.util.Set.class;
}
if ("publications".equals(fieldName)) {
return java.util.Set.class;
}
if ("id".equals(fieldName)) {
return java.lang.Integer.class;
}
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
return TypeUtil.getFieldType(org.intermine.model.bio.SpliceDonor.class, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
public StringConstructor getoBJECT() {
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
return NotXmlRenderer.render(this);
}
StringConstructor sb = new StringConstructor();
sb.append("$_^org.intermine.model.bio.SpliceDonor");
if (length != null) {
sb.append("$_^alength$_^").append(length);
}
if (sequence != null) {
sb.append("$_^rsequence$_^").append(sequence.getId());
}
if (chromosome != null) {
sb.append("$_^rchromosome$_^").append(chromosome.getId());
}
if (chromosomeLocation != null) {
sb.append("$_^rchromosomeLocation$_^").append(chromosomeLocation.getId());
}
if (curated != null) {
sb.append("$_^acurated$_^").append(curated);
}
if (secondaryIdentifier != null) {
sb.append("$_^asecondaryIdentifier$_^");
String string = secondaryIdentifier;
while (string != null) {
int delimPosition = string.indexOf("$_^");
if (delimPosition == -1) {
sb.append(string);
string = null;
} else {
sb.append(string.substring(0, delimPosition + 3));
sb.append("d");
string = string.substring(delimPosition + 3);
}
}
}
if (name != null) {
sb.append("$_^aname$_^");
String string = name;
while (string != null) {
int delimPosition = string.indexOf("$_^");
if (delimPosition == -1) {
sb.append(string);
string = null;
} else {
sb.append(string.substring(0, delimPosition + 3));
sb.append("d");
string = string.substring(delimPosition + 3);
}
}
}
if (primaryIdentifier != null) {
sb.append("$_^aprimaryIdentifier$_^");
String string = primaryIdentifier;
while (string != null) {
int delimPosition = string.indexOf("$_^");
if (delimPosition == -1) {
sb.append(string);
string = null;
} else {
sb.append(string.substring(0, delimPosition + 3));
sb.append("d");
string = string.substring(delimPosition + 3);
}
}
}
if (organism != null) {
sb.append("$_^rorganism$_^").append(organism.getId());
}
if (id != null) {
sb.append("$_^aid$_^").append(id);
}
return sb;
}
public void setoBJECT(String notXml, ObjectStore os) {
setoBJECT(NotXmlParser.SPLITTER.split(notXml), os);
}
public void setoBJECT(final String[] notXml, final ObjectStore os) {
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
throw new IllegalStateException("Class " + getClass().getName() + " does not match code (org.intermine.model.bio.SpliceDonor)");
}
for (int i = 2; i < notXml.length;) {
int startI = i;
if ((i < notXml.length) && "alength".equals(notXml[i])) {
i++;
length = Integer.valueOf(notXml[i]);
i++;
}
if ((i < notXml.length) &&"rsequence".equals(notXml[i])) {
i++;
sequence = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.Sequence.class);
i++;
};
if ((i < notXml.length) &&"rchromosome".equals(notXml[i])) {
i++;
chromosome = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.Chromosome.class);
i++;
};
if ((i < notXml.length) &&"rchromosomeLocation".equals(notXml[i])) {
i++;
chromosomeLocation = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.Location.class);
i++;
};
if ((i < notXml.length) && "acurated".equals(notXml[i])) {
i++;
curated = Boolean.valueOf(notXml[i]);
i++;
}
if ((i < notXml.length) && "asecondaryIdentifier".equals(notXml[i])) {
i++;
StringBuilder string = null;
while ((i + 1 < notXml.length) && (notXml[i + 1].charAt(0) == 'd')) {
if (string == null) string = new StringBuilder(notXml[i]);
i++;
string.append("$_^").append(notXml[i].substring(1));
}
secondaryIdentifier = string == null ? notXml[i] : string.toString();
i++;
}
if ((i < notXml.length) && "aname".equals(notXml[i])) {
i++;
StringBuilder string = null;
while ((i + 1 < notXml.length) && (notXml[i + 1].charAt(0) == 'd')) {
if (string == null) string = new StringBuilder(notXml[i]);
i++;
string.append("$_^").append(notXml[i].substring(1));
}
name = string == null ? notXml[i] : string.toString();
i++;
}
if ((i < notXml.length) && "aprimaryIdentifier".equals(notXml[i])) {
i++;
StringBuilder string = null;
while ((i + 1 < notXml.length) && (notXml[i + 1].charAt(0) == 'd')) {
if (string == null) string = new StringBuilder(notXml[i]);
i++;
string.append("$_^").append(notXml[i].substring(1));
}
primaryIdentifier = string == null ? notXml[i] : string.toString();
i++;
}
if ((i < notXml.length) &&"rorganism".equals(notXml[i])) {
i++;
organism = new ProxyReference(os, Integer.valueOf(notXml[i]), org.intermine.model.bio.Organism.class);
i++;
};
if ((i < notXml.length) && "aid".equals(notXml[i])) {
i++;
id = Integer.valueOf(notXml[i]);
i++;
}
if (startI == i) {
throw new IllegalArgumentException("Unknown field " + notXml[i]);
}
}
primaryTranscripts = new ProxyCollection(os, this, "primaryTranscripts", org.intermine.model.bio.PrimaryTranscript.class);
overlappingFeatures = new ProxyCollection(os, this, "overlappingFeatures", org.intermine.model.bio.LocatedSequenceFeature.class);
relations = new ProxyCollection(os, this, "relations", org.intermine.model.bio.SymmetricalRelation.class);
subjects = new ProxyCollection(os, this, "subjects", org.intermine.model.bio.Relation.class);
objects = new ProxyCollection(os, this, "objects", org.intermine.model.bio.Relation.class);
annotations = new ProxyCollection(os, this, "annotations", org.intermine.model.bio.Annotation.class);
synonyms = new ProxyCollection(os, this, "synonyms", org.intermine.model.bio.Synonym.class);
evidence = new ProxyCollection(os, this, "evidence", org.intermine.model.bio.Evidence.class);
dataSets = new ProxyCollection(os, this, "dataSets", org.intermine.model.bio.DataSet.class);
publications = new ProxyCollection(os, this, "publications", org.intermine.model.bio.Publication.class);
}
public void addCollectionElement(final String fieldName, final org.intermine.model.InterMineObject element) {
if ("primaryTranscripts".equals(fieldName)) {
primaryTranscripts.add((org.intermine.model.bio.PrimaryTranscript) element);
} else if ("overlappingFeatures".equals(fieldName)) {
overlappingFeatures.add((org.intermine.model.bio.LocatedSequenceFeature) element);
} else if ("relations".equals(fieldName)) {
relations.add((org.intermine.model.bio.SymmetricalRelation) element);
} else if ("subjects".equals(fieldName)) {
subjects.add((org.intermine.model.bio.Relation) element);
} else if ("objects".equals(fieldName)) {
objects.add((org.intermine.model.bio.Relation) element);
} else if ("annotations".equals(fieldName)) {
annotations.add((org.intermine.model.bio.Annotation) element);
} else if ("synonyms".equals(fieldName)) {
synonyms.add((org.intermine.model.bio.Synonym) element);
} else if ("evidence".equals(fieldName)) {
evidence.add((org.intermine.model.bio.Evidence) element);
} else if ("dataSets".equals(fieldName)) {
dataSets.add((org.intermine.model.bio.DataSet) element);
} else if ("publications".equals(fieldName)) {
publications.add((org.intermine.model.bio.Publication) element);
} else {
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
TypeUtil.addCollectionElement(this, fieldName, element);
return;
}
throw new IllegalArgumentException("Unknown collection " + fieldName);
}
}
public Class getElementType(final String fieldName) {
if ("primaryTranscripts".equals(fieldName)) {
return org.intermine.model.bio.PrimaryTranscript.class;
}
if ("overlappingFeatures".equals(fieldName)) {
return org.intermine.model.bio.LocatedSequenceFeature.class;
}
if ("relations".equals(fieldName)) {
return org.intermine.model.bio.SymmetricalRelation.class;
}
if ("subjects".equals(fieldName)) {
return org.intermine.model.bio.Relation.class;
}
if ("objects".equals(fieldName)) {
return org.intermine.model.bio.Relation.class;
}
if ("annotations".equals(fieldName)) {
return org.intermine.model.bio.Annotation.class;
}
if ("synonyms".equals(fieldName)) {
return org.intermine.model.bio.Synonym.class;
}
if ("evidence".equals(fieldName)) {
return org.intermine.model.bio.Evidence.class;
}
if ("dataSets".equals(fieldName)) {
return org.intermine.model.bio.DataSet.class;
}
if ("publications".equals(fieldName)) {
return org.intermine.model.bio.Publication.class;
}
if (!org.intermine.model.bio.SpliceDonor.class.equals(getClass())) {
return TypeUtil.getElementType(org.intermine.model.bio.SpliceDonor.class, fieldName);
}
throw new IllegalArgumentException("Unknown field " + fieldName);
}
}
| [
"zfinadmn@zfin.org"
] | zfinadmn@zfin.org |
3363c63b29e9a1d02660c4ff4c0c9251105d0d1b | edbdd671d56fc32d7e49aa85100d4e5d59781678 | /src/cz/mg/compiler/tasks/writers/c/command/CReturnCommandWriterTask.java | 99bc3a7c67f4081a7ae336557335b834ce978e48 | [
"Unlicense"
] | permissive | Gekoncze/JMgCompiler | 8e2388ce0e18f3b20e164fdd1d8b4e4e9e413363 | 49b72634cf06f0e97d753a77dd7bbc57fa3b3177 | refs/heads/main | 2023-01-18T19:26:15.654742 | 2020-11-21T17:23:32 | 2020-11-21T17:23:32 | 312,845,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,583 | java | //package cz.mg.compiler.tasks.writers.c.command;
//
//import cz.mg.collections.list.List;
//import cz.mg.language.annotations.task.Input;
//import cz.mg.language.annotations.task.Output;
//import cz.mg.language.annotations.task.Subtask;
//import cz.mg.language.entities.c.logical.commands.CReturnCommand;
//import cz.mg.language.entities.text.linear.Line;
//import cz.mg.language.entities.text.linear.tokens.c.CKeywordToken;
//import cz.mg.language.entities.text.linear.tokens.c.CSeparatorToken;
//import cz.mg.compiler.tasks.writers.c.part.expression.CExpressionWriterTask;
//
//
//public class CReturnCommandWriterTask extends CCommandWriterTask {
// @Input
// private final CReturnCommand command;
//
// @Output
// private final List<Line> lines = new List<>();
//
// @Subtask
// private CExpressionWriterTask expressionWriterTask = null;
//
// public CReturnCommandWriterTask(CReturnCommand command) {
// this.command = command;
// }
//
// @Override
// public List<Line> getLines() {
// return lines;
// }
//
// @Override
// protected void onRun() {
// Line line = new Line();
// line.getTokens().addLast(CKeywordToken.RETURN);
// if(command.getExpression() != null){
// expressionWriterTask = CExpressionWriterTask.create(command.getExpression());
// expressionWriterTask.run();
// line.getTokens().addCollectionLast(expressionWriterTask.getTokens());
// }
// line.getTokens().addLast(CSeparatorToken.SEMICOLON);
// lines.addLast(line);
// }
//}
| [
"gekoncze@seznam.cz"
] | gekoncze@seznam.cz |
7b71a335dd71ef0473f629afec7b9e73a4eaba11 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_e5e76d7bfa3393db653d888d104e7ac4701391a5/ChunkSpaceMap/12_e5e76d7bfa3393db653d888d104e7ac4701391a5_ChunkSpaceMap_t.java | cc2f00f7c7dda939764c5cd93fa35ca2bb25779b | [] | 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 | 4,906 | java | package aether.repl;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
import java.nio.file.FileStore;
import java.nio.file.FileSystemException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.Logger;
import aether.cluster.ClusterMgr;
import aether.conf.ConfigMgr;
import aether.net.ControlMessage;
import aether.net.Message;
import aether.net.NetMgr;
/**
* Stores the information about how much
* memory is available at which node in the cluster.
*
* */
class ChunkSpaceMap implements Runnable{
ArrayList<NodeSpace> freeMemory;
int replPort;
NetMgr repl;
private static ChunkSpaceMap csm;
public static synchronized ChunkSpaceMap getInstance (){
if (csm == null) {
csm = new ChunkSpaceMap ();
}
return csm;
}
public ChunkSpaceMap (){
freeMemory = new ArrayList<NodeSpace> ();
this.init();
}
private static final Logger repllog = Logger.getLogger(ClusterMgr.class.getName());
/**
* Get the node address details in the cluster where
* space is still available. The first fit algorithm
* is used. If no such node exists in the cluster,
* it throws an exception that should be handled by
* the calling code by reporting it to the user.
* */
private synchronized void init () {
replPort = ConfigMgr.getReplPort();
try {
repl = new NetMgr (replPort);
repl.setTimeout(5000);
} catch (SocketException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
repllog.fine("Initialized ChunckSpaceMap");
}
public synchronized NodeSpace getStorageNode (long spaceRequired) throws NoSpaceAvailableException {
//iterate through the list and use the
//first node where space is available.
System.out.println("Space required for file = " + spaceRequired);
for (Iterator<NodeSpace> iter = freeMemory.iterator(); iter.hasNext() != false; ) {
NodeSpace ns = iter.next();
if (ns.getAvailableSpace() > spaceRequired) {
return ns;
}
}
throw new NoSpaceAvailableException ();
}
/**
* adds the metadata into the data structure
* */
public synchronized void put (InetAddress ipAddress, int port, long spaceAvailable) {
System.out.println("Free space "+ spaceAvailable + " at "+ipAddress);
freeMemory.add(new NodeSpace (ipAddress, port, spaceAvailable));
}
public synchronized void calculatefreeMemory()throws IOException {
InetAddress bAddr = NetMgr.getBroadcastAddr();
if (bAddr != null) {
ControlMessage freespacesearch = new ControlMessage('f',bAddr);
repl.send(freespacesearch);
}
}
private synchronized void processMemorySpaceRequired(Message m) throws IOException
{
long totalspace = 0;
for (Path root : FileSystems.getDefault().getRootDirectories())
{
try{
FileStore store = Files.getFileStore(root);
totalspace += store.getUsableSpace();
}
catch (FileSystemException e)
{
repllog.warning("error querying space");
}
}
try {
ControlMessage freespace = (ControlMessage) m;
InetAddress newNodeIp = freespace.getSourceIp();
ControlMessage space = new ControlMessage('s', newNodeIp,String.valueOf(totalspace));
repllog.fine("Sending freespace response 's'");
repl.send((Message)space);
} catch (IOException ex) {
repllog.warning("Could not send freespace");
}
}
private synchronized void UpdateFreespace(Message m){
ControlMessage freespace = (ControlMessage)m;
InetAddress nodeInContext = freespace.getSourceIp();
long spaceAvailable = Long.parseLong(freespace.parseAControl());
System.out.println("Updating space :" + nodeInContext + " has space " +spaceAvailable);
this.put(m.getSourceIp(), Replication.REPL_PORT_LISTENER, spaceAvailable);
}
private synchronized void processspacemessage(Message m) throws IOException{
repllog.fine("Processing space requirement message");
ControlMessage ctrl = (ControlMessage) m;
char ctrlType = ctrl.getMessageSubtype();
switch (ctrlType) {
case 'f': /*call for free memory space available */
processMemorySpaceRequired(m);
break;
case 's': /*updating the chunk space map */
UpdateFreespace(m);
break;
}
}
@Override
public void run() {
try {
Message spacerequest = repl.receive();
processspacemessage(spacerequest);
} catch (IOException e) {
repllog.warning("Did not receive the space Map messages");
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e1c4f6213cb76f83478409674353907b940baa38 | 128923b6f078341534ced03b36f18e72dc8ed9be | /src/main/java/com/greymax/vkplayer/ui/menu/Menu.java | c80c9bc15a42297bb5ec458ac03e344ce416c893 | [] | no_license | GreyMax/vk-player | cfa18538cbdebe37c7fd202a6beb0aa621adad32 | cecceb2fb1c432255d672b5dc7a1272a1f47b6f1 | refs/heads/master | 2020-04-25T16:43:16.480991 | 2013-12-21T19:38:23 | 2013-12-21T19:38:23 | 8,378,967 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.greymax.vkplayer.ui.menu;
import javax.swing.*;
public class Menu extends JMenuBar{
//TODO: extract name to Constants
public Menu() {
// File
JMenu menuFile = new MenuFile("menu.file");
// Settings
JMenu menuSettings = new MenuSettings("menu.settings");
// Help
JMenu menuHelp = new MenuHelp("menu.help");
// Add Menu to MenuBar
add(menuFile);
add(menuSettings);
add(menuHelp);
}
}
| [
"davidofik88@gmail.com"
] | davidofik88@gmail.com |
52d2c3862ac41805bc1b65cbb2c8b7ae3b921f0b | bf8b54de87c973160226dbc7779acb7fc1dc7c13 | /src/main/java/com/learning/springboot/ChangePassword.java | 79686961cb65a1bf6c651fa5d97234476951b6e5 | [] | no_license | nkcong206/springboot | 788f5000658115dfaced38ceea7a53ddf557034c | c7e4eabf90e838b0c6428bf48d3142d39f4c1960 | refs/heads/master | 2023-05-25T16:55:24.993739 | 2021-06-08T16:58:15 | 2021-06-08T16:58:15 | 373,912,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.learning.springboot;
public class ChangePassword {
private String username;
private String old_password;
private String new_password;
public String getNew_password() {
return new_password;
}
public String getOld_password() {
return old_password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void setOld_password(String old_password) {
this.old_password = old_password;
}
public void setNew_password(String new_password) {
this.new_password = new_password;
}
}
| [
"you@example.com"
] | you@example.com |
5829785e3f7dd439b75cd89752fa50d19c2567c4 | a0604d4b269f20bd06a995919316d3f1faeddd39 | /YouTube/youtube-connector/youtube-connector-1.0.0/org.wso2.carbon.connector/src/test/java/org/wso2/carbon/connector/integration/test/YouTube/Subscriptions/SubscriptionsIntegrationTest.java | 41a266dbd729cfd2dc06ddec002ce3f209b7dc82 | [] | no_license | rasikahettige/esb-connectors | 16fe111da92add0cc2548a01633f9cb0707adcc1 | f468c544acb0781dba3d63f76c130f53182a2965 | refs/heads/master | 2021-01-17T22:49:24.154659 | 2016-01-07T06:21:16 | 2016-01-07T06:21:16 | 39,179,367 | 2 | 10 | null | 2016-01-07T07:27:02 | 2015-07-16T06:03:48 | Java | UTF-8 | Java | false | false | 8,952 | java | /*
Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.wso2.carbon.connector.integration.test.YouTube;
import org.apache.axis2.context.ConfigurationContext;
import org.json.JSONObject;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.automation.api.clients.proxy.admin.ProxyServiceAdminClient;
import org.wso2.carbon.automation.api.clients.utils.AuthenticateStub;
import org.wso2.carbon.automation.utils.axis2client.ConfigurationContextProvider;
import org.wso2.carbon.connector.integration.test.common.ConnectorIntegrationUtil;
import org.wso2.carbon.esb.ESBIntegrationTest;
import org.wso2.carbon.mediation.library.stub.MediationLibraryAdminServiceStub;
import org.wso2.carbon.mediation.library.stub.upload.MediationLibraryUploaderStub;
import javax.activation.DataHandler;
import java.lang.System;
import java.net.URL;
import java.util.Properties;
public class SubscriptionsIntegrationTest extends ESBIntegrationTest {
private static final String CONNECTOR_NAME = "YouTube";
private MediationLibraryUploaderStub mediationLibUploadStub = null;
private MediationLibraryAdminServiceStub adminServiceStub = null;
private ProxyServiceAdminClient proxyAdmin;
private String repoLocation = null;
private String YouTubeConnectorFileName = CONNECTOR_NAME + ".zip";
private Properties YouTubeConnectorProperties = null;
private String pathToProxiesDirectory = null;
private String pathToRequestsDirectory = null;
private String myGroupId = null;
@BeforeClass(alwaysRun = true)
public void setEnvironment() throws Exception {
super.init();
ConfigurationContextProvider configurationContextProvider = ConfigurationContextProvider.getInstance();
ConfigurationContext cc = configurationContextProvider.getConfigurationContext();
mediationLibUploadStub = new MediationLibraryUploaderStub(cc, esbServer.getBackEndUrl() + "MediationLibraryUploader");
AuthenticateStub.authenticateStub("admin", "admin", mediationLibUploadStub);
adminServiceStub = new MediationLibraryAdminServiceStub(cc, esbServer.getBackEndUrl() + "MediationLibraryAdminService");
AuthenticateStub.authenticateStub("admin", "admin", adminServiceStub);
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
repoLocation = System.getProperty("connector_repo").replace("/", "\\");
} else {
repoLocation = System.getProperty("connector_repo").replace("/", "/");
}
proxyAdmin = new ProxyServiceAdminClient(esbServer.getBackEndUrl(), esbServer.getSessionCookie());
ConnectorIntegrationUtil.uploadConnector(repoLocation, mediationLibUploadStub, YouTubeConnectorFileName);
log.info("Sleeping for " + 30000 / 1000 + " seconds while waiting for synapse import");
Thread.sleep(30000);
adminServiceStub.updateStatus("{org.wso2.carbon.connector}" + CONNECTOR_NAME, CONNECTOR_NAME,
"org.wso2.carbon.connector", "enabled");
YouTubeConnectorProperties = ConnectorIntegrationUtil.getConnectorConfigProperties(CONNECTOR_NAME);
pathToProxiesDirectory = repoLocation + YouTubeConnectorProperties.getProperty("proxyDirectoryRelativePath");
pathToRequestsDirectory = repoLocation + YouTubeConnectorProperties.getProperty("requestDirectoryRelativePath");
}
@Override
protected void cleanup() {
axis2Client.destroy();
}
/*Test SubscriptionsList */
/*
@Test(groups = {"wso2.esb"}, description = "YouTube{SubscriptionsList} integration test.")
public void testSubscriptionsListWithMandatory() throws Exception {
String jsonRequestFilePath = pathToRequestsDirectory + "Subscriptions/SubscriptionsList.txt";
String methodName = "SubscriptionsList";
final String jsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath);
final String proxyFilePath = "file:///" + pathToProxiesDirectory + "Subscriptions/" + methodName + ".xml";
String modifiedJsonString = String.format(jsonString, YouTubeConnectorProperties.getProperty("apiUrl"),
YouTubeConnectorProperties.getProperty("client_id"),
YouTubeConnectorProperties.getProperty("client_secret"),
YouTubeConnectorProperties.getProperty("grant_type"),
YouTubeConnectorProperties.getProperty("refresh_token"),
YouTubeConnectorProperties.getProperty("Subscriptionspart"),
YouTubeConnectorProperties.getProperty("SubscriptionschannelId"),
YouTubeConnectorProperties.getProperty("SubscriptionsmaxResults"),
YouTubeConnectorProperties.getProperty("Subscriptionsorder"),
YouTubeConnectorProperties.getProperty("SubscriptionspageToken"));
proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath)));
try {
JSONObject jsonObject = ConnectorIntegrationUtil.sendRequest(getProxyServiceURL(methodName), modifiedJsonString);
Assert.assertEquals("youtube#searchListResponse", jsonObject.getString("kind"));
} finally {
proxyAdmin.deleteProxy(methodName);
}
}
/*Test SubscriptionsInsert */
/*
@Test(groups = {"wso2.esb"}, description = "YouTube{SubscriptionsInsert} integration test.")
public void testSubscriptionsInsertWithMandatory() throws Exception {
String jsonRequestFilePath = pathToRequestsDirectory + "Subscriptions/SubscriptionsInsert.txt";
String methodName = "SubscriptionsInsert";
final String jsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath);
final String proxyFilePath = "file:///" + pathToProxiesDirectory + "Subscriptions/" + methodName + ".xml";
String modifiedJsonString = String.format(jsonString, YouTubeConnectorProperties.getProperty("apiUrl"),
YouTubeConnectorProperties.getProperty("client_id"),
YouTubeConnectorProperties.getProperty("client_secret"),
YouTubeConnectorProperties.getProperty("grant_type"),
YouTubeConnectorProperties.getProperty("refresh_token"),
YouTubeConnectorProperties.getProperty("SubscriptionsInsertpart"),
YouTubeConnectorProperties.getProperty("SubscriptionsInsertchannelId"),
YouTubeConnectorProperties.getProperty("SubscriptionsInsertkind"));
proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath)));
try {
int responseHeader = ConnectorIntegrationUtil.sendRequestToRetriveHeaders(getProxyServiceURL(methodName), modifiedJsonString);
Assert.assertTrue(responseHeader == 200);
} finally {
proxyAdmin.deleteProxy(methodName);
}
}
/*Test SubscriptionsDelete */
@Test(groups = {"wso2.esb"}, description = "YouTube{SubscriptionsDelete} integration test.")
public void testSubscriptionsDeleteWithMandatory() throws Exception {
String jsonRequestFilePath = pathToRequestsDirectory + "Subscriptions/SubscriptionsDelete.txt";
String methodName = "SubscriptionsDelete";
final String jsonString = ConnectorIntegrationUtil.getFileContent(jsonRequestFilePath);
final String proxyFilePath = "file:///" + pathToProxiesDirectory + "Subscriptions/" + methodName + ".xml";
String modifiedJsonString = String.format(jsonString, YouTubeConnectorProperties.getProperty("apiUrl"),
YouTubeConnectorProperties.getProperty("client_id"),
YouTubeConnectorProperties.getProperty("client_secret"),
YouTubeConnectorProperties.getProperty("grant_type"),
YouTubeConnectorProperties.getProperty("refresh_token"),
YouTubeConnectorProperties.getProperty("SubscriptionsDeleteid"));
proxyAdmin.addProxyService(new DataHandler(new URL(proxyFilePath)));
try {
int responseHeader = ConnectorIntegrationUtil.sendRequestToRetriveHeaders(getProxyServiceURL(methodName), modifiedJsonString);
Assert.assertTrue(responseHeader == 204);
} finally {
proxyAdmin.deleteProxy(methodName);
}
}
}
| [
"vanjikumaran@gmail.com"
] | vanjikumaran@gmail.com |
2d22566ac8cef227e18b896701f58113f0fa66c6 | d252cb9f9817f8214339690f4c8362336b5ed997 | /companypref/src/main/java/com/maxcheung/demo/Application.java | dc3c9391e7ba48ee8343e6eddb495030b66dd934 | [] | no_license | mxcheung/fullhearts | 43b90683fbbd45099e128cabd1b5066bb582653d | 28163a357b856e1b2ab01bca8dedf99cecd6bf0d | refs/heads/master | 2021-01-23T08:24:37.239351 | 2017-08-20T12:53:26 | 2017-08-20T12:53:26 | 98,356,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | package com.maxcheung.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"maxcheung@optusnet.com.au"
] | maxcheung@optusnet.com.au |
cefa0910fad3671c118925871318b9c2392cc725 | 1d92da5c2dc8345f677db7a002b1758e9982a865 | /default-blog/src/main/java/com/cwz/blog/defaultblog/entity/Article.java | b67ebe8d9e271c621cceb8be76878f6420c9cdad | [] | no_license | wenz26/MyBlog | 67603fb7d1d06f9f47d2e241eb1329c79179137f | 9aa24103f9c203334c8a4adbe19aa3b63943888e | refs/heads/master | 2022-06-24T00:12:51.586863 | 2020-02-24T08:55:40 | 2020-02-24T08:55:40 | 228,024,912 | 2 | 0 | null | 2022-06-21T02:26:42 | 2019-12-14T13:09:53 | JavaScript | UTF-8 | Java | false | false | 5,244 | java | package com.cwz.blog.defaultblog.entity;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author: 陈文振
* @date: 2019/12/2
* @description: 文章
*/
@Table(name = "article")
public class Article {
/**
* 文章id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 用户id
*/
private Integer userId;
/**
* 文章作者
*/
// private String author;
/**
* 文章原作者
*/
private String originalAuthor;
/**
* 文章标题
*/
private String articleTitle;
/**
* 文章内容
*/
private String articleContent;
/**
* 文章类型(转载或原创)
*/
private String articleType;
/**
* 博客分类
*/
private Integer articleCategories;
/**
* 发布时间
*/
private LocalDateTime publishDate;
/**
* 最后一次修改时间
*/
private LocalDateTime updateDate;
/**
* 原文链接
* 转载:则是转载的链接
* 原创:则是在本博客中的链接
*/
private String articleUrl;
/**
* 文章图片url
*/
private String imageUrl;
/**
* 文章摘要
*/
private String articleTabloid;
/**
* 文章喜欢数
*/
private Integer likes = 0;
/**
* 文章收藏数
*/
private Integer favorites = 0;
/**
* 上一篇文章id
*/
private Integer lastArticleId = 0;
/**
* 下一篇文章id
*/
private Integer nextArticleId = 0;
/**
* 该文章为草稿还是已发布(1为已发布,0为草稿)
*/
private Integer draft;
/**
* 文章对应的标签名称
*/
private String tagName;
/**
* 文章对应的标签类
*/
private List<Tags> tags;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
/*public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}*/
public String getOriginalAuthor() {
return originalAuthor;
}
public void setOriginalAuthor(String originalAuthor) {
this.originalAuthor = originalAuthor;
}
public String getArticleTitle() {
return articleTitle;
}
public void setArticleTitle(String articleTitle) {
this.articleTitle = articleTitle;
}
public String getArticleContent() {
return articleContent;
}
public void setArticleContent(String articleContent) {
this.articleContent = articleContent;
}
public String getArticleType() {
return articleType;
}
public void setArticleType(String articleType) {
this.articleType = articleType;
}
public Integer getArticleCategories() {
return articleCategories;
}
public void setArticleCategories(Integer articleCategories) {
this.articleCategories = articleCategories;
}
public LocalDateTime getPublishDate() {
return publishDate;
}
public void setPublishDate(LocalDateTime publishDate) {
this.publishDate = publishDate;
}
public LocalDateTime getUpdateDate() {
return updateDate;
}
public void setUpdateDate(LocalDateTime updateDate) {
this.updateDate = updateDate;
}
public String getArticleUrl() {
return articleUrl;
}
public void setArticleUrl(String articleUrl) {
this.articleUrl = articleUrl;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getArticleTabloid() {
return articleTabloid;
}
public void setArticleTabloid(String articleTabloid) {
this.articleTabloid = articleTabloid;
}
public Integer getLikes() {
return likes;
}
public void setLikes(Integer likes) {
this.likes = likes;
}
public Integer getFavorites() {
return favorites;
}
public void setFavorites(Integer favorites) {
this.favorites = favorites;
}
public Integer getLastArticleId() {
return lastArticleId;
}
public void setLastArticleId(Integer lastArticleId) {
this.lastArticleId = lastArticleId;
}
public Integer getNextArticleId() {
return nextArticleId;
}
public void setNextArticleId(Integer nextArticleId) {
this.nextArticleId = nextArticleId;
}
public String getTagName() {
return tagName;
}
public void setTagName(String tagName) {
this.tagName = tagName;
}
public Integer getDraft() {
return draft;
}
public void setDraft(Integer draft) {
this.draft = draft;
}
public List<Tags> getTags() {
return tags;
}
public void setTags(List<Tags> tags) {
this.tags = tags;
}
}
| [
"948009390@qq.com"
] | 948009390@qq.com |
d3ac6c945a261bcb31996c29c0f0aea2b1ec4f0f | adcf37e10aa7ac186fc4a396e1570c3ec5960008 | /lib/src/us/kbase/genomeannotationapi/InputsGetMrnaByGene.java | aeb6793f8663c0eda36c976fb304c21f19f12bf9 | [
"MIT"
] | permissive | Tianhao-Gu/genome_annotation_api | a42eeb1079a233f67afb904eeb5ce1b2d5213231 | a8673eb2a69cb75d6c3f816be434d225b553f39c | refs/heads/master | 2021-08-30T16:27:50.714828 | 2017-10-25T18:45:33 | 2017-10-25T18:45:33 | 105,290,646 | 0 | 0 | null | 2017-09-29T15:52:48 | 2017-09-29T15:52:47 | null | UTF-8 | Java | false | false | 2,153 | java |
package us.kbase.genomeannotationapi;
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: inputs_get_mrna_by_gene</p>
* <pre>
* @optional gene_id_list
* </pre>
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
"ref",
"gene_id_list"
})
public class InputsGetMrnaByGene {
@JsonProperty("ref")
private java.lang.String ref;
@JsonProperty("gene_id_list")
private List<String> geneIdList;
private Map<java.lang.String, Object> additionalProperties = new HashMap<java.lang.String, Object>();
@JsonProperty("ref")
public java.lang.String getRef() {
return ref;
}
@JsonProperty("ref")
public void setRef(java.lang.String ref) {
this.ref = ref;
}
public InputsGetMrnaByGene withRef(java.lang.String ref) {
this.ref = ref;
return this;
}
@JsonProperty("gene_id_list")
public List<String> getGeneIdList() {
return geneIdList;
}
@JsonProperty("gene_id_list")
public void setGeneIdList(List<String> geneIdList) {
this.geneIdList = geneIdList;
}
public InputsGetMrnaByGene withGeneIdList(List<String> geneIdList) {
this.geneIdList = geneIdList;
return this;
}
@JsonAnyGetter
public Map<java.lang.String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(java.lang.String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public java.lang.String toString() {
return ((((((("InputsGetMrnaByGene"+" [ref=")+ ref)+", geneIdList=")+ geneIdList)+", additionalProperties=")+ additionalProperties)+"]");
}
}
| [
"mhenderson@lbl.gov"
] | mhenderson@lbl.gov |
fb622eb88c464708a0b106ec80ef6721c3e28dc2 | db3c5e38da92e698556342d9513e662ba26ea719 | /och05/src/och05/ConstrEx1.java | 1e04db0521345efa2cbe34caca2191d3372827e4 | [] | no_license | start0ys/Java | a1f88487f3c767906979ac870ced0e99302ce3d1 | a7fad295437b1e7c0d42c021420d4dce364f5ffc | refs/heads/main | 2023-04-17T05:29:37.151397 | 2021-04-27T08:40:54 | 2021-04-27T08:40:54 | 360,715,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | package och05;
// 이것을 생성자 OverLoading이라고 한다 - 다른것도 있나봄
class Sonata{
//기본 생성자 - 매개변수가 없는 생성자
Sonata(){ //class와 같은 이름 = 생성자
System.out.println("난 기본 ");
}Sonata(int a){
System.out.println("문의 수는 "+ a);
}Sonata(String str){
System.out.println("옶션 "+str);
}
}
public class ConstrEx1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Sonata s1 = new Sonata();
Sonata s2 = new Sonata(4);
Sonata s3 = new Sonata("에어백");
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0b302d14d7dc44a4716e686e66bafdf9eb54f831 | 3b174535c437bd3c8144fd3d6e8034765304f68e | /src/reservationsystem/Plane.java | 9259f0473689e8d14b1fb85ebd1e88c1cc8f85b0 | [] | no_license | Concordia-SSS/SSS | 77ee9fbfd505faec4a939f8e1b38cc54ad38379a | 7b9838295e380d831204abe926c4b2f01c0891a5 | refs/heads/master | 2020-06-02T23:52:16.790333 | 2013-11-28T20:09:29 | 2013-11-28T20:09:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,821 | java | /**
*/
package reservationsystem;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Plane</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link reservationsystem.Plane#getSpecificFlight <em>Specific Flight</em>}</li>
* <li>{@link reservationsystem.Plane#getId <em>Id</em>}</li>
* <li>{@link reservationsystem.Plane#getModel <em>Model</em>}</li>
* <li>{@link reservationsystem.Plane#getCrewNum <em>Crew Num</em>}</li>
* <li>{@link reservationsystem.Plane#getCapacity <em>Capacity</em>}</li>
* <li>{@link reservationsystem.Plane#getSeats <em>Seats</em>}</li>
* </ul>
* </p>
*
* @see reservationsystem.ReservationsystemPackage#getPlane()
* @model
* @generated
*/
public interface Plane extends EObject {
/**
* Returns the value of the '<em><b>Specific Flight</b></em>' reference list.
* The list contents are of type {@link reservationsystem.SpecificFlight}.
* It is bidirectional and its opposite is '{@link reservationsystem.SpecificFlight#getPlane <em>Plane</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Specific Flight</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Specific Flight</em>' reference list.
* @see reservationsystem.ReservationsystemPackage#getPlane_SpecificFlight()
* @see reservationsystem.SpecificFlight#getPlane
* @model opposite="plane"
* @generated
*/
EList<SpecificFlight> getSpecificFlight();
/**
* Returns the value of the '<em><b>Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Id</em>' attribute.
* @see #setId(String)
* @see reservationsystem.ReservationsystemPackage#getPlane_Id()
* @model
* @generated
*/
String getId();
/**
* Sets the value of the '{@link reservationsystem.Plane#getId <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Id</em>' attribute.
* @see #getId()
* @generated
*/
void setId(String value);
/**
* Returns the value of the '<em><b>Model</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Model</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Model</em>' attribute.
* @see #setModel(String)
* @see reservationsystem.ReservationsystemPackage#getPlane_Model()
* @model
* @generated
*/
String getModel();
/**
* Sets the value of the '{@link reservationsystem.Plane#getModel <em>Model</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Model</em>' attribute.
* @see #getModel()
* @generated
*/
void setModel(String value);
/**
* Returns the value of the '<em><b>Crew Num</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Crew Num</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Crew Num</em>' attribute.
* @see #setCrewNum(int)
* @see reservationsystem.ReservationsystemPackage#getPlane_CrewNum()
* @model
* @generated
*/
int getCrewNum();
/**
* Sets the value of the '{@link reservationsystem.Plane#getCrewNum <em>Crew Num</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Crew Num</em>' attribute.
* @see #getCrewNum()
* @generated
*/
void setCrewNum(int value);
/**
* Returns the value of the '<em><b>Capacity</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Capacity</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Capacity</em>' attribute.
* @see #setCapacity(int)
* @see reservationsystem.ReservationsystemPackage#getPlane_Capacity()
* @model
* @generated
*/
int getCapacity();
/**
* Sets the value of the '{@link reservationsystem.Plane#getCapacity <em>Capacity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Capacity</em>' attribute.
* @see #getCapacity()
* @generated
*/
void setCapacity(int value);
/**
* Returns the value of the '<em><b>Seats</b></em>' reference list.
* The list contents are of type {@link reservationsystem.Seat}.
* It is bidirectional and its opposite is '{@link reservationsystem.Seat#getPlane <em>Plane</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Seats</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Seats</em>' reference list.
* @see reservationsystem.ReservationsystemPackage#getPlane_Seats()
* @see reservationsystem.Seat#getPlane
* @model opposite="plane" required="true"
* @generated
*/
EList<Seat> getSeats();
} // Plane
| [
"xingwu.cs@gmail.com"
] | xingwu.cs@gmail.com |
6861088867beb2544980053ee07e4decf0785f4d | d13f101f429e912598f80f9b583b88967e8be039 | /src/test/java/trainer/mar06/SimpleMethodsTest.java | 8abe436b66197d8969f5acc0a2222ff856ca37dc | [] | no_license | egalli64/oved210 | 389751ae35f5a086a6eabcfc399c05e8cf4688b9 | 4a5d7078f46a3f4f6f4ad94d5975f000be14786d | refs/heads/master | 2020-04-24T15:27:51.175208 | 2019-06-14T10:48:36 | 2019-06-14T10:48:36 | 172,068,768 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,447 | java | package trainer.mar06;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.hamcrest.core.Is.*;
import org.junit.Test;
public class SimpleMethodsTest {
@Test
public void isUpperA() {
assertTrue(SimpleMethods.isUpper('A'));
}
@Test
public void isUpperLowerH() {
assertFalse(SimpleMethods.isUpper('h'));
}
@Test
public void isUpperNumber() {
assertFalse(SimpleMethods.isUpper('7'));
}
@Test
public void isAlphaA() {
assertTrue(SimpleMethods.isAlpha('A'));
}
@Test
public void isAlphaLowerC() {
assertTrue(SimpleMethods.isAlpha('c'));
}
@Test
public void isAlphaNumber() {
assertFalse(SimpleMethods.isAlpha('7'));
}
@Test
public void isAlphaBracket() {
assertFalse(SimpleMethods.isAlpha('{'));
}
@Test
public void toUpperA() {
assertThat(SimpleMethods.toUpper('A'), is('A'));
}
@Test
public void toUpperLowerX() {
assertThat(SimpleMethods.toUpper('x'), is('X'));
}
@Test
public void toUpperNumber() {
assertThat(SimpleMethods.toUpper('9'), is('9'));
}
@Test
public void smallestPlain() {
int[] data = { 1, 2, 5, -7 };
assertThat(SimpleMethods.smallest(data), is(-7));
}
@Test
public void smallestNull() {
int[] data = null;
assertThat(SimpleMethods.smallest(data), is(Integer.MAX_VALUE));
}
@Test
public void smallestEmpty() {
int[] data = {};
assertThat(SimpleMethods.smallest(data), is(Integer.MAX_VALUE));
}
@Test
public void firstSmallestIndexNull() {
int[] data = null;
assertThat(SimpleMethods.firstSmallestIndex(data), is(-1));
}
@Test
public void firstSmallestIndexEmpty() {
int[] data = {};
assertThat(SimpleMethods.firstSmallestIndex(data), is(-1));
}
@Test
public void firstSmallestIndexPlain() {
int[] data = { 1, 2, 5, -7 };
assertThat(SimpleMethods.firstSmallestIndex(data), is(3));
}
@Test
public void firstSmallestIndexDouble() {
int[] data = { -7, 2, 5, -7 };
assertThat(SimpleMethods.firstSmallestIndex(data), is(0));
}
@Test
public void lastSmallestIndexNull() {
int[] data = null;
assertThat(SimpleMethods.lastSmallestIndex(data), is(-1));
}
@Test
public void lastSmallestIndexEmpty() {
int[] data = {};
assertThat(SimpleMethods.lastSmallestIndex(data), is(-1));
}
@Test
public void lastSmallestIndexPlain() {
int[] data = { 1, 2, 5, -7 };
assertThat(SimpleMethods.lastSmallestIndex(data), is(3));
}
@Test
public void lastSmallestIndexDouble() {
int[] data = { -7, 2, 5, -7 };
assertThat(SimpleMethods.lastSmallestIndex(data), is(3));
}
@Test
public void findPositive() {
int[] data = {1, 2, 3};
int target = 2;
assertTrue(SimpleMethods.find(data, target));
}
@Test
public void findNegative() {
int[] data = {1, 2, 3};
int target = 7;
assertFalse(SimpleMethods.find(data, target));
}
@Test
public void findPosPositive() {
int[] data = {1, 2, 3};
int target = 2;
assertEquals(1, SimpleMethods.findPos(data, target));
}
@Test
public void findPosNegative() {
int[] data = {1, 2, 3};
int target = 7;
assertEquals(-1, SimpleMethods.findPos(data, target));
}
@Test
public void isPalindromeEvenPositive() {
assertTrue(SimpleMethods.isPalindrome("abba"));
}
@Test
public void isPalindromeEvenNegative() {
assertFalse(SimpleMethods.isPalindrome("abab"));
}
@Test
public void isPalindromeOddPositive() {
assertTrue(SimpleMethods.isPalindrome("aba"));
}
@Test
public void isPalindromeOddNegative() {
boolean result = SimpleMethods.isPalindrome("aab");
assertFalse(result);
}
@Test
public void isPalindromeNull() {
boolean result = SimpleMethods.isPalindrome(null);
assertFalse(result);
}
@Test
public void isPalindromeEmpty() {
boolean result = SimpleMethods.isPalindrome("");
assertTrue(result);
}
@Test
public void reverseReturnPlain() {
int[] data = { 1, 2, 3, 4, 5 };
int[] reverted = SimpleMethods.reverseReturn(data);
assertThat(reverted.length, is(data.length));
for(int i = 0; i < reverted.length; i++) {
assertThat(reverted[i], is(data[data.length - 1 - i]));
}
// assertThat(reverted[0], is(data[4]));
// assertThat(reverted[1], is(data[3]));
// assertThat(reverted[2], is(data[2]));
// assertThat(reverted[3], is(data[1]));
// assertThat(reverted[4], is(data[0]));
}
@Test
public void reverseSimple() {
int[] data = {1, 2, 3};
SimpleMethods.reverse(data);
assertThat(data.length, is(3));
assertThat(data[0], is(3));
assertThat(data[1], is(2));
assertThat(data[2], is(1));
}
@Test
public void reverse5() {
int[] data = {1, 2, 3, 4, 5};
SimpleMethods.reverse(data);
assertThat(data.length, is(5));
assertThat(data[0], is(5));
assertThat(data[1], is(4));
assertThat(data[2], is(3));
assertThat(data[3], is(2));
assertThat(data[4], is(1));
}
@Test
public void reverseNull() {
int[] data = null;
SimpleMethods.reverse(data);
assertNull(data);
}
@Test
public void reverseEmpty() {
int[] data = {};
SimpleMethods.reverse(data);
assertThat(data.length, is(0));
}
}
| [
"egalli64@gmail.com"
] | egalli64@gmail.com |
dbe9de3077e5d5313cee8a7800aceb5a145ab476 | e57083ea584d69bc9fb1b32f5ec86bdd4fca61c0 | /sample-project-5400/src/main/java/com/example/project/sample5400/other/sample1/Other1_95.java | b41b45fbfbb0f454ff8e08a752149b4d61851b79 | [] | no_license | snicoll-scratches/test-spring-components-index | 77e0ad58c8646c7eb1d1563bf31f51aa42a0636e | aa48681414a11bb704bdbc8acabe45fa5ef2fd2d | refs/heads/main | 2021-06-13T08:46:58.532850 | 2019-12-09T15:11:10 | 2019-12-09T15:11:10 | 65,806,297 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 83 | java | package com.example.project.sample5400.other.sample1;
public class Other1_95 {
}
| [
"snicoll@pivotal.io"
] | snicoll@pivotal.io |
880019d5cea7124d16ea63bfadb55c257a02d277 | 3d7ba01d680e48645578eb37c984171f66f572ca | /src/controller/AppActionListener.java | da27e5c9ce263c053639674d73a6cbe24d21b55f | [] | no_license | japc78/itt.dam.calculadora | 597516b3b024ef826e91a21d62047034c622c945 | ab5a1bb1feec86a0c05f40fb647e1f55f3123e43 | refs/heads/master | 2020-09-12T03:44:24.868144 | 2019-11-18T00:14:03 | 2019-11-18T00:14:03 | 222,292,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,064 | java | package controller;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import view.AppInterface;
/**
* AppEvents. Clase que recoge e implementa los eventos en botones.
* @author Juan Antonio Pavón Carmona
* @category ITT DAM Desarrollo de Interfaces
* @see ActionEvent
* @see ActionListener
* @see https://github.com/japc78/itt-dam2-ws_interface_java.git
* @version 1.0
*
*/
public class AppActionListener implements ActionListener {
private AppInterface i;
private double numberTmp;
private String result, history;
private char operation;
private boolean newOperation, newNumber, login;
public AppActionListener(AppInterface i) {
this.i = i;
}
// Se implementa en el método la lógica para el funcionamiento del programa.
@Override
public void actionPerformed(ActionEvent e) {
result = i.getPanelScreen().getScreen().getText();
history = i.getPanelScreen().getHistory().getText();
newOperation = i.getPanelScreen().isNewOperation();
operation = i.getPanelScreen().getOperation();
numberTmp = i.getPanelScreen().getNumberTmp();
newNumber = i.getPanelScreen().isNewNumber();
newOperation = i.getPanelScreen().isNewOperation();
login = i.getPanelScreen().isLogin();
switch (e.getActionCommand()) {
case "+":
operation('+');
break;
case "-":
operation('-');
break;
case "×":
operation('×');
break;
case "÷":
operation('/');
break;
case "±":
if (Double.parseDouble(result) > 0) {
result = "-" + result;
} else if (Double.parseDouble(result) != 0) {
result = result.substring(1);
}
i.getPanelScreen().getScreen().setText(result);
break;
case ",":
if (i.getPanelScreen().getResult().indexOf(".") == -1) {
System.out.println("Decimal");
result += ".";
i.getPanelScreen().getScreen().setText(result);;
}
break;
case "<":
if (!newNumber) {
result = (result.length() > 1)? result.substring(0, result.length()-1):"0";
i.getPanelScreen().getScreen().setText(result);
}
break;
case "CE":
reset();
// System.out.println("Reset NewNumber: " + i.getPanelScreen().isNewNumber());
// System.out.println("Reset NewOperatio: " + i.getPanelScreen().isNewOperation());
// System.out.println("Reset NewOperatio: " + i.getPanelScreen().getOperation());
break;
case "=":
// Asignación de operaciones a los botones (Sumar, Restar, Multiplicar, dividir)
if (operation != '0') {
history(operation);
try {
if (operation == '+') {
result = String.valueOf(numberTmp + Double.parseDouble(result));
} else if (operation == '-') {
result = String.valueOf(numberTmp - Double.parseDouble(result));
} else if (operation == '×') {
result = String.valueOf(numberTmp * Double.parseDouble(result));
} else if (operation == '/') {
// Se comprueba que si el segundo número es 0
result = (Double.parseDouble(result) != 0 )? String.valueOf(numberTmp/Double.parseDouble(result)):"Error / por 0";
// i.getPanelScreen().getHistory().setText(" ");
}
result = isInteger(result);
} catch (NullPointerException | NumberFormatException ex) {
result = "ERROR";
ex.printStackTrace();
}
i.getPanelScreen().getScreen().setText(result);
i.getPanelScreen().setOperation('0');
i.getPanelScreen().setNewOperation(true);
i.getPanelScreen().setNewNumber(true);
}
break;
default:
for (JButton btn : i.getPanelButtons().getBtns()) {
if (e.getSource().equals(btn)) {
if (newNumber) {
result = "";
i.getPanelScreen().getScreen().setText("");
i.getPanelScreen().setNewNumber(false);
}
i.getPanelScreen().getScreen().setText(result + btn.getText());
i.getPanelScreen().setNewOperation(true);
// System.out.println("Foreach JButton");
// System.out.println("Operation: " + i.getPanelScreen().getOperation());
// System.out.println("NewNumber: " + i.getPanelScreen().isNewNumber());
// System.out.println("NewOperation: " + i.getPanelScreen().isNewOperation());
// System.out.println("Pantalla: " + i.getPanelScreen().getScreen().getText());
// System.out.println("-----------");
}
}
break;
}
if (e.getSource().equals(i.getPanelButtons().getBtns().get(0))) {
if (login) {
final ImageIcon icon = new ImageIcon("resources/bender.png");
JOptionPane.showMessageDialog(null,"Usuario Bender", "user", JOptionPane.PLAIN_MESSAGE, icon);
} else {
JOptionPane.showMessageDialog(null,"Funcionalidad no disponible","Alert!",
JOptionPane.ERROR_MESSAGE);
}
reset();
}
if (e.getSource().equals(i.getLogin())) {
// Panel para la contraseña
JPanel panelLogin = new JPanel();
String pass = "bender";
Image userImg = new ImageIcon("resources/human.png").getImage();
JLabel lblImage = new JLabel(new ImageIcon(userImg.getScaledInstance(50, 50, Image.SCALE_SMOOTH)));
panelLogin.add(lblImage);
JLabel lblPass = new JLabel("Pass:");
panelLogin.add(lblPass);
JPasswordField inputPass = new JPasswordField(10);
panelLogin.add(inputPass);
String[] loginOption = new String[]{"OK", "Cancel"};
int option = JOptionPane.showOptionDialog(null, panelLogin, "Login", JOptionPane.NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, loginOption, loginOption[1]);
if (option == 0) {
char[] password = inputPass.getPassword();
if (pass.equals(String.valueOf(password))) {
System.out.println("pasa");
JOptionPane.showMessageDialog(null,"Bienvenido Bender", "Kraftwerk", JOptionPane.INFORMATION_MESSAGE);
i.setTitle("Robot: Bender");
i.getPanelScreen().setLogin(true);
} else {
JOptionPane.showMessageDialog(null,"Contraseña incorrecta", "Kraftwerk", JOptionPane.WARNING_MESSAGE);
}
}
}
}
/**
* Metodo para resertear la calculadora.
*/
private void reset() {
i.getPanelScreen().getScreen().setText("0");
i.getPanelScreen().setNumberTmp(0);
i.getPanelScreen().setOperation('0');
i.getPanelScreen().setNewOperation(false);
i.getPanelScreen().setNewNumber(true);
i.getPanelScreen().getHistory().setText(" ");
}
/**
* Metodo para comprobar si el numero es entero y no es necesario mostar los decimales
* @param result Se le pasa el resultado como cadena de Texto.
* @return Retorna el numero sin decimales si es entero.
*/
private String isInteger(String result) {
// Para quitar los decimales si el número es entero
String[] r = result.split("[.]");
// System.out.println("IsInteger splid: " + Arrays.toString(r));
// System.out.println("IsInteger splid length: " + r.length);
// Se comprueba que el resultado no sea un numero largo del tipo E(elevado), para que no salte la excepción al pasear con el Long.
if ((r.length > 1) && (result.indexOf("E") == -1)){
if (Long.parseLong(r[1]) == 0) result = r[0];
}
return result;
}
// Metodo de operaciones
/**
* Metodo para realizar las opraciones matematicas basicas, sele pasa por parametro la operacion a realizar.
* @param c Del tipo Char. Operacion matematica basica +,-,×,÷
*/
private void operation(char c) {
i.getPanelScreen().setOperation(c);
if ((operation == '0') && (newOperation)) history(c);
// System.out.println("numberTmp: " + numberTmp);
try {
if ((operation == '+') && (newOperation)) {
// System.out.println("Result: " + result);
history(c);
result = String.valueOf(numberTmp + Double.parseDouble(result));
// System.out.println("Resultado: " + result);
} else if ((operation == '-') && (newOperation)) {
history(c);
result = String.valueOf(numberTmp - Double.parseDouble(result));
} else if ((operation == '×') && (newOperation)) {
history(c);
result = String.valueOf(numberTmp * Double.parseDouble(result));
} else if ((operation == '/') && (newOperation)) {
history(c);
// Se comprueba que si el segundo número es 0
result = (Double.parseDouble(result) != 0 )? String.valueOf(numberTmp/Double.parseDouble(result)):"Error / por 0";
// i.getPanelScreen().getHistory().setText(" ");
}
result = isInteger(result);
} catch (NullPointerException | NumberFormatException ex) {
result = "ERROR";
ex.printStackTrace();
}
i.getPanelScreen().setNumberTmp(Double.parseDouble(result));
i.getPanelScreen().getScreen().setText(result);
i.getPanelScreen().setNewNumber(true);
i.getPanelScreen().setNewOperation(false);
// System.out.println("Operation: " + c);
// System.out.println("Result: " + result);
// System.out.println("newOperation: " + i.getPanelScreen().isNewOperation());
}
/**
* Metodo para mostrar el historial de operaciones. Se le pasa por parametro la opracion que se realiza.
* @param c Del tipo Char. Operacion matematica basica +,-,×,÷
*/
private void history(char c) {
history += result + c;
i.getPanelScreen().getHistory().setText(history);
}
} | [
"japc.grafico@gmail.com"
] | japc.grafico@gmail.com |
f303a5e1bdef2f56f287bfb977ec1f59021efc72 | 7b3830a17ea50ff54e503f4d30bb1a29ec97a8d7 | /org.xtext.example.mydsl.playlist.ide/src-gen/org/xtext/example/mydsl/ide/contentassist/antlr/internal/InternalPlaylistParser.java | a995dff6601b8385efd7a3ded578745bd9dcc9e5 | [] | no_license | FAMILIAR-project/VideoGen | d6c30a23efcaaf1b0df13fc709033870f2c56fc6 | 14441a7a41399ee28befa781bdf514ebf5d20a63 | refs/heads/master | 2021-05-04T10:02:02.130831 | 2017-02-13T10:25:10 | 2017-02-13T10:25:10 | 44,157,659 | 4 | 52 | null | 2017-02-13T11:04:02 | 2015-10-13T06:52:00 | HTML | UTF-8 | Java | false | false | 46,373 | java | package org.xtext.example.mydsl.ide.contentassist.antlr.internal;
import java.io.InputStream;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.DFA;
import org.xtext.example.mydsl.services.PlaylistGrammarAccess;
import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;
@SuppressWarnings("all")
public class InternalPlaylistParser extends AbstractInternalContentAssistParser {
public static final String[] tokenNames = new String[] {
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_LEFT_BRACKET", "RULE_RIGHT_BRACKET", "RULE_STRING", "RULE_FLOAT", "RULE_INT", "RULE_ID", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'Playlist'", "'mediafile'", "'id:'", "'path:'", "'duration:'"
};
public static final int RULE_ID=9;
public static final int RULE_WS=12;
public static final int RULE_STRING=6;
public static final int RULE_LEFT_BRACKET=4;
public static final int RULE_ANY_OTHER=13;
public static final int RULE_SL_COMMENT=11;
public static final int T__15=15;
public static final int RULE_RIGHT_BRACKET=5;
public static final int T__16=16;
public static final int T__17=17;
public static final int RULE_INT=8;
public static final int T__18=18;
public static final int RULE_ML_COMMENT=10;
public static final int RULE_FLOAT=7;
public static final int T__14=14;
public static final int EOF=-1;
// delegates
// delegators
public InternalPlaylistParser(TokenStream input) {
this(input, new RecognizerSharedState());
}
public InternalPlaylistParser(TokenStream input, RecognizerSharedState state) {
super(input, state);
}
public String[] getTokenNames() { return InternalPlaylistParser.tokenNames; }
public String getGrammarFileName() { return "InternalPlaylist.g"; }
private PlaylistGrammarAccess grammarAccess;
public void setGrammarAccess(PlaylistGrammarAccess grammarAccess) {
this.grammarAccess = grammarAccess;
}
@Override
protected Grammar getGrammar() {
return grammarAccess.getGrammar();
}
@Override
protected String getValueForTokenName(String tokenName) {
return tokenName;
}
// $ANTLR start "entryRulePlaylistGeneratorModel"
// InternalPlaylist.g:53:1: entryRulePlaylistGeneratorModel : rulePlaylistGeneratorModel EOF ;
public final void entryRulePlaylistGeneratorModel() throws RecognitionException {
try {
// InternalPlaylist.g:54:1: ( rulePlaylistGeneratorModel EOF )
// InternalPlaylist.g:55:1: rulePlaylistGeneratorModel EOF
{
before(grammarAccess.getPlaylistGeneratorModelRule());
pushFollow(FOLLOW_1);
rulePlaylistGeneratorModel();
state._fsp--;
after(grammarAccess.getPlaylistGeneratorModelRule());
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRulePlaylistGeneratorModel"
// $ANTLR start "rulePlaylistGeneratorModel"
// InternalPlaylist.g:62:1: rulePlaylistGeneratorModel : ( ( rule__PlaylistGeneratorModel__Group__0 ) ) ;
public final void rulePlaylistGeneratorModel() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:66:2: ( ( ( rule__PlaylistGeneratorModel__Group__0 ) ) )
// InternalPlaylist.g:67:2: ( ( rule__PlaylistGeneratorModel__Group__0 ) )
{
// InternalPlaylist.g:67:2: ( ( rule__PlaylistGeneratorModel__Group__0 ) )
// InternalPlaylist.g:68:3: ( rule__PlaylistGeneratorModel__Group__0 )
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getGroup());
// InternalPlaylist.g:69:3: ( rule__PlaylistGeneratorModel__Group__0 )
// InternalPlaylist.g:69:4: rule__PlaylistGeneratorModel__Group__0
{
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__0();
state._fsp--;
}
after(grammarAccess.getPlaylistGeneratorModelAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rulePlaylistGeneratorModel"
// $ANTLR start "entryRuleMediafile"
// InternalPlaylist.g:78:1: entryRuleMediafile : ruleMediafile EOF ;
public final void entryRuleMediafile() throws RecognitionException {
try {
// InternalPlaylist.g:79:1: ( ruleMediafile EOF )
// InternalPlaylist.g:80:1: ruleMediafile EOF
{
before(grammarAccess.getMediafileRule());
pushFollow(FOLLOW_1);
ruleMediafile();
state._fsp--;
after(grammarAccess.getMediafileRule());
match(input,EOF,FOLLOW_2);
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
}
return ;
}
// $ANTLR end "entryRuleMediafile"
// $ANTLR start "ruleMediafile"
// InternalPlaylist.g:87:1: ruleMediafile : ( ( rule__Mediafile__Group__0 ) ) ;
public final void ruleMediafile() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:91:2: ( ( ( rule__Mediafile__Group__0 ) ) )
// InternalPlaylist.g:92:2: ( ( rule__Mediafile__Group__0 ) )
{
// InternalPlaylist.g:92:2: ( ( rule__Mediafile__Group__0 ) )
// InternalPlaylist.g:93:3: ( rule__Mediafile__Group__0 )
{
before(grammarAccess.getMediafileAccess().getGroup());
// InternalPlaylist.g:94:3: ( rule__Mediafile__Group__0 )
// InternalPlaylist.g:94:4: rule__Mediafile__Group__0
{
pushFollow(FOLLOW_2);
rule__Mediafile__Group__0();
state._fsp--;
}
after(grammarAccess.getMediafileAccess().getGroup());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "ruleMediafile"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__0"
// InternalPlaylist.g:102:1: rule__PlaylistGeneratorModel__Group__0 : rule__PlaylistGeneratorModel__Group__0__Impl rule__PlaylistGeneratorModel__Group__1 ;
public final void rule__PlaylistGeneratorModel__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:106:1: ( rule__PlaylistGeneratorModel__Group__0__Impl rule__PlaylistGeneratorModel__Group__1 )
// InternalPlaylist.g:107:2: rule__PlaylistGeneratorModel__Group__0__Impl rule__PlaylistGeneratorModel__Group__1
{
pushFollow(FOLLOW_3);
rule__PlaylistGeneratorModel__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__0"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__0__Impl"
// InternalPlaylist.g:114:1: rule__PlaylistGeneratorModel__Group__0__Impl : ( () ) ;
public final void rule__PlaylistGeneratorModel__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:118:1: ( ( () ) )
// InternalPlaylist.g:119:1: ( () )
{
// InternalPlaylist.g:119:1: ( () )
// InternalPlaylist.g:120:2: ()
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getPlaylistGeneratorModelAction_0());
// InternalPlaylist.g:121:2: ()
// InternalPlaylist.g:121:3:
{
}
after(grammarAccess.getPlaylistGeneratorModelAccess().getPlaylistGeneratorModelAction_0());
}
}
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__0__Impl"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__1"
// InternalPlaylist.g:129:1: rule__PlaylistGeneratorModel__Group__1 : rule__PlaylistGeneratorModel__Group__1__Impl rule__PlaylistGeneratorModel__Group__2 ;
public final void rule__PlaylistGeneratorModel__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:133:1: ( rule__PlaylistGeneratorModel__Group__1__Impl rule__PlaylistGeneratorModel__Group__2 )
// InternalPlaylist.g:134:2: rule__PlaylistGeneratorModel__Group__1__Impl rule__PlaylistGeneratorModel__Group__2
{
pushFollow(FOLLOW_4);
rule__PlaylistGeneratorModel__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__1"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__1__Impl"
// InternalPlaylist.g:141:1: rule__PlaylistGeneratorModel__Group__1__Impl : ( 'Playlist' ) ;
public final void rule__PlaylistGeneratorModel__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:145:1: ( ( 'Playlist' ) )
// InternalPlaylist.g:146:1: ( 'Playlist' )
{
// InternalPlaylist.g:146:1: ( 'Playlist' )
// InternalPlaylist.g:147:2: 'Playlist'
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getPlaylistKeyword_1());
match(input,14,FOLLOW_2);
after(grammarAccess.getPlaylistGeneratorModelAccess().getPlaylistKeyword_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__1__Impl"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__2"
// InternalPlaylist.g:156:1: rule__PlaylistGeneratorModel__Group__2 : rule__PlaylistGeneratorModel__Group__2__Impl rule__PlaylistGeneratorModel__Group__3 ;
public final void rule__PlaylistGeneratorModel__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:160:1: ( rule__PlaylistGeneratorModel__Group__2__Impl rule__PlaylistGeneratorModel__Group__3 )
// InternalPlaylist.g:161:2: rule__PlaylistGeneratorModel__Group__2__Impl rule__PlaylistGeneratorModel__Group__3
{
pushFollow(FOLLOW_5);
rule__PlaylistGeneratorModel__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__2"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__2__Impl"
// InternalPlaylist.g:168:1: rule__PlaylistGeneratorModel__Group__2__Impl : ( RULE_LEFT_BRACKET ) ;
public final void rule__PlaylistGeneratorModel__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:172:1: ( ( RULE_LEFT_BRACKET ) )
// InternalPlaylist.g:173:1: ( RULE_LEFT_BRACKET )
{
// InternalPlaylist.g:173:1: ( RULE_LEFT_BRACKET )
// InternalPlaylist.g:174:2: RULE_LEFT_BRACKET
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getLEFT_BRACKETTerminalRuleCall_2());
match(input,RULE_LEFT_BRACKET,FOLLOW_2);
after(grammarAccess.getPlaylistGeneratorModelAccess().getLEFT_BRACKETTerminalRuleCall_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__2__Impl"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__3"
// InternalPlaylist.g:183:1: rule__PlaylistGeneratorModel__Group__3 : rule__PlaylistGeneratorModel__Group__3__Impl rule__PlaylistGeneratorModel__Group__4 ;
public final void rule__PlaylistGeneratorModel__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:187:1: ( rule__PlaylistGeneratorModel__Group__3__Impl rule__PlaylistGeneratorModel__Group__4 )
// InternalPlaylist.g:188:2: rule__PlaylistGeneratorModel__Group__3__Impl rule__PlaylistGeneratorModel__Group__4
{
pushFollow(FOLLOW_6);
rule__PlaylistGeneratorModel__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__3"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__3__Impl"
// InternalPlaylist.g:195:1: rule__PlaylistGeneratorModel__Group__3__Impl : ( ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) ) ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* ) ) ;
public final void rule__PlaylistGeneratorModel__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:199:1: ( ( ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) ) ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* ) ) )
// InternalPlaylist.g:200:1: ( ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) ) ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* ) )
{
// InternalPlaylist.g:200:1: ( ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) ) ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* ) )
// InternalPlaylist.g:201:2: ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) ) ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* )
{
// InternalPlaylist.g:201:2: ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 ) )
// InternalPlaylist.g:202:3: ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesAssignment_3());
// InternalPlaylist.g:203:3: ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )
// InternalPlaylist.g:203:4: rule__PlaylistGeneratorModel__MediafilesAssignment_3
{
pushFollow(FOLLOW_7);
rule__PlaylistGeneratorModel__MediafilesAssignment_3();
state._fsp--;
}
after(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesAssignment_3());
}
// InternalPlaylist.g:206:2: ( ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )* )
// InternalPlaylist.g:207:3: ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )*
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesAssignment_3());
// InternalPlaylist.g:208:3: ( rule__PlaylistGeneratorModel__MediafilesAssignment_3 )*
loop1:
do {
int alt1=2;
int LA1_0 = input.LA(1);
if ( (LA1_0==15) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// InternalPlaylist.g:208:4: rule__PlaylistGeneratorModel__MediafilesAssignment_3
{
pushFollow(FOLLOW_7);
rule__PlaylistGeneratorModel__MediafilesAssignment_3();
state._fsp--;
}
break;
default :
break loop1;
}
} while (true);
after(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesAssignment_3());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__3__Impl"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__4"
// InternalPlaylist.g:217:1: rule__PlaylistGeneratorModel__Group__4 : rule__PlaylistGeneratorModel__Group__4__Impl ;
public final void rule__PlaylistGeneratorModel__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:221:1: ( rule__PlaylistGeneratorModel__Group__4__Impl )
// InternalPlaylist.g:222:2: rule__PlaylistGeneratorModel__Group__4__Impl
{
pushFollow(FOLLOW_2);
rule__PlaylistGeneratorModel__Group__4__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__4"
// $ANTLR start "rule__PlaylistGeneratorModel__Group__4__Impl"
// InternalPlaylist.g:228:1: rule__PlaylistGeneratorModel__Group__4__Impl : ( RULE_RIGHT_BRACKET ) ;
public final void rule__PlaylistGeneratorModel__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:232:1: ( ( RULE_RIGHT_BRACKET ) )
// InternalPlaylist.g:233:1: ( RULE_RIGHT_BRACKET )
{
// InternalPlaylist.g:233:1: ( RULE_RIGHT_BRACKET )
// InternalPlaylist.g:234:2: RULE_RIGHT_BRACKET
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getRIGHT_BRACKETTerminalRuleCall_4());
match(input,RULE_RIGHT_BRACKET,FOLLOW_2);
after(grammarAccess.getPlaylistGeneratorModelAccess().getRIGHT_BRACKETTerminalRuleCall_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__Group__4__Impl"
// $ANTLR start "rule__Mediafile__Group__0"
// InternalPlaylist.g:244:1: rule__Mediafile__Group__0 : rule__Mediafile__Group__0__Impl rule__Mediafile__Group__1 ;
public final void rule__Mediafile__Group__0() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:248:1: ( rule__Mediafile__Group__0__Impl rule__Mediafile__Group__1 )
// InternalPlaylist.g:249:2: rule__Mediafile__Group__0__Impl rule__Mediafile__Group__1
{
pushFollow(FOLLOW_4);
rule__Mediafile__Group__0__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__1();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__0"
// $ANTLR start "rule__Mediafile__Group__0__Impl"
// InternalPlaylist.g:256:1: rule__Mediafile__Group__0__Impl : ( 'mediafile' ) ;
public final void rule__Mediafile__Group__0__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:260:1: ( ( 'mediafile' ) )
// InternalPlaylist.g:261:1: ( 'mediafile' )
{
// InternalPlaylist.g:261:1: ( 'mediafile' )
// InternalPlaylist.g:262:2: 'mediafile'
{
before(grammarAccess.getMediafileAccess().getMediafileKeyword_0());
match(input,15,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getMediafileKeyword_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__0__Impl"
// $ANTLR start "rule__Mediafile__Group__1"
// InternalPlaylist.g:271:1: rule__Mediafile__Group__1 : rule__Mediafile__Group__1__Impl rule__Mediafile__Group__2 ;
public final void rule__Mediafile__Group__1() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:275:1: ( rule__Mediafile__Group__1__Impl rule__Mediafile__Group__2 )
// InternalPlaylist.g:276:2: rule__Mediafile__Group__1__Impl rule__Mediafile__Group__2
{
pushFollow(FOLLOW_8);
rule__Mediafile__Group__1__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__2();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__1"
// $ANTLR start "rule__Mediafile__Group__1__Impl"
// InternalPlaylist.g:283:1: rule__Mediafile__Group__1__Impl : ( RULE_LEFT_BRACKET ) ;
public final void rule__Mediafile__Group__1__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:287:1: ( ( RULE_LEFT_BRACKET ) )
// InternalPlaylist.g:288:1: ( RULE_LEFT_BRACKET )
{
// InternalPlaylist.g:288:1: ( RULE_LEFT_BRACKET )
// InternalPlaylist.g:289:2: RULE_LEFT_BRACKET
{
before(grammarAccess.getMediafileAccess().getLEFT_BRACKETTerminalRuleCall_1());
match(input,RULE_LEFT_BRACKET,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getLEFT_BRACKETTerminalRuleCall_1());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__1__Impl"
// $ANTLR start "rule__Mediafile__Group__2"
// InternalPlaylist.g:298:1: rule__Mediafile__Group__2 : rule__Mediafile__Group__2__Impl rule__Mediafile__Group__3 ;
public final void rule__Mediafile__Group__2() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:302:1: ( rule__Mediafile__Group__2__Impl rule__Mediafile__Group__3 )
// InternalPlaylist.g:303:2: rule__Mediafile__Group__2__Impl rule__Mediafile__Group__3
{
pushFollow(FOLLOW_9);
rule__Mediafile__Group__2__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__3();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__2"
// $ANTLR start "rule__Mediafile__Group__2__Impl"
// InternalPlaylist.g:310:1: rule__Mediafile__Group__2__Impl : ( 'id:' ) ;
public final void rule__Mediafile__Group__2__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:314:1: ( ( 'id:' ) )
// InternalPlaylist.g:315:1: ( 'id:' )
{
// InternalPlaylist.g:315:1: ( 'id:' )
// InternalPlaylist.g:316:2: 'id:'
{
before(grammarAccess.getMediafileAccess().getIdKeyword_2());
match(input,16,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getIdKeyword_2());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__2__Impl"
// $ANTLR start "rule__Mediafile__Group__3"
// InternalPlaylist.g:325:1: rule__Mediafile__Group__3 : rule__Mediafile__Group__3__Impl rule__Mediafile__Group__4 ;
public final void rule__Mediafile__Group__3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:329:1: ( rule__Mediafile__Group__3__Impl rule__Mediafile__Group__4 )
// InternalPlaylist.g:330:2: rule__Mediafile__Group__3__Impl rule__Mediafile__Group__4
{
pushFollow(FOLLOW_10);
rule__Mediafile__Group__3__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__4();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__3"
// $ANTLR start "rule__Mediafile__Group__3__Impl"
// InternalPlaylist.g:337:1: rule__Mediafile__Group__3__Impl : ( ( rule__Mediafile__IdAssignment_3 ) ) ;
public final void rule__Mediafile__Group__3__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:341:1: ( ( ( rule__Mediafile__IdAssignment_3 ) ) )
// InternalPlaylist.g:342:1: ( ( rule__Mediafile__IdAssignment_3 ) )
{
// InternalPlaylist.g:342:1: ( ( rule__Mediafile__IdAssignment_3 ) )
// InternalPlaylist.g:343:2: ( rule__Mediafile__IdAssignment_3 )
{
before(grammarAccess.getMediafileAccess().getIdAssignment_3());
// InternalPlaylist.g:344:2: ( rule__Mediafile__IdAssignment_3 )
// InternalPlaylist.g:344:3: rule__Mediafile__IdAssignment_3
{
pushFollow(FOLLOW_2);
rule__Mediafile__IdAssignment_3();
state._fsp--;
}
after(grammarAccess.getMediafileAccess().getIdAssignment_3());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__3__Impl"
// $ANTLR start "rule__Mediafile__Group__4"
// InternalPlaylist.g:352:1: rule__Mediafile__Group__4 : rule__Mediafile__Group__4__Impl rule__Mediafile__Group__5 ;
public final void rule__Mediafile__Group__4() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:356:1: ( rule__Mediafile__Group__4__Impl rule__Mediafile__Group__5 )
// InternalPlaylist.g:357:2: rule__Mediafile__Group__4__Impl rule__Mediafile__Group__5
{
pushFollow(FOLLOW_9);
rule__Mediafile__Group__4__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__5();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__4"
// $ANTLR start "rule__Mediafile__Group__4__Impl"
// InternalPlaylist.g:364:1: rule__Mediafile__Group__4__Impl : ( 'path:' ) ;
public final void rule__Mediafile__Group__4__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:368:1: ( ( 'path:' ) )
// InternalPlaylist.g:369:1: ( 'path:' )
{
// InternalPlaylist.g:369:1: ( 'path:' )
// InternalPlaylist.g:370:2: 'path:'
{
before(grammarAccess.getMediafileAccess().getPathKeyword_4());
match(input,17,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getPathKeyword_4());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__4__Impl"
// $ANTLR start "rule__Mediafile__Group__5"
// InternalPlaylist.g:379:1: rule__Mediafile__Group__5 : rule__Mediafile__Group__5__Impl rule__Mediafile__Group__6 ;
public final void rule__Mediafile__Group__5() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:383:1: ( rule__Mediafile__Group__5__Impl rule__Mediafile__Group__6 )
// InternalPlaylist.g:384:2: rule__Mediafile__Group__5__Impl rule__Mediafile__Group__6
{
pushFollow(FOLLOW_11);
rule__Mediafile__Group__5__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__6();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__5"
// $ANTLR start "rule__Mediafile__Group__5__Impl"
// InternalPlaylist.g:391:1: rule__Mediafile__Group__5__Impl : ( ( rule__Mediafile__LocationAssignment_5 ) ) ;
public final void rule__Mediafile__Group__5__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:395:1: ( ( ( rule__Mediafile__LocationAssignment_5 ) ) )
// InternalPlaylist.g:396:1: ( ( rule__Mediafile__LocationAssignment_5 ) )
{
// InternalPlaylist.g:396:1: ( ( rule__Mediafile__LocationAssignment_5 ) )
// InternalPlaylist.g:397:2: ( rule__Mediafile__LocationAssignment_5 )
{
before(grammarAccess.getMediafileAccess().getLocationAssignment_5());
// InternalPlaylist.g:398:2: ( rule__Mediafile__LocationAssignment_5 )
// InternalPlaylist.g:398:3: rule__Mediafile__LocationAssignment_5
{
pushFollow(FOLLOW_2);
rule__Mediafile__LocationAssignment_5();
state._fsp--;
}
after(grammarAccess.getMediafileAccess().getLocationAssignment_5());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__5__Impl"
// $ANTLR start "rule__Mediafile__Group__6"
// InternalPlaylist.g:406:1: rule__Mediafile__Group__6 : rule__Mediafile__Group__6__Impl rule__Mediafile__Group__7 ;
public final void rule__Mediafile__Group__6() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:410:1: ( rule__Mediafile__Group__6__Impl rule__Mediafile__Group__7 )
// InternalPlaylist.g:411:2: rule__Mediafile__Group__6__Impl rule__Mediafile__Group__7
{
pushFollow(FOLLOW_12);
rule__Mediafile__Group__6__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__7();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__6"
// $ANTLR start "rule__Mediafile__Group__6__Impl"
// InternalPlaylist.g:418:1: rule__Mediafile__Group__6__Impl : ( 'duration:' ) ;
public final void rule__Mediafile__Group__6__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:422:1: ( ( 'duration:' ) )
// InternalPlaylist.g:423:1: ( 'duration:' )
{
// InternalPlaylist.g:423:1: ( 'duration:' )
// InternalPlaylist.g:424:2: 'duration:'
{
before(grammarAccess.getMediafileAccess().getDurationKeyword_6());
match(input,18,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getDurationKeyword_6());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__6__Impl"
// $ANTLR start "rule__Mediafile__Group__7"
// InternalPlaylist.g:433:1: rule__Mediafile__Group__7 : rule__Mediafile__Group__7__Impl rule__Mediafile__Group__8 ;
public final void rule__Mediafile__Group__7() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:437:1: ( rule__Mediafile__Group__7__Impl rule__Mediafile__Group__8 )
// InternalPlaylist.g:438:2: rule__Mediafile__Group__7__Impl rule__Mediafile__Group__8
{
pushFollow(FOLLOW_6);
rule__Mediafile__Group__7__Impl();
state._fsp--;
pushFollow(FOLLOW_2);
rule__Mediafile__Group__8();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__7"
// $ANTLR start "rule__Mediafile__Group__7__Impl"
// InternalPlaylist.g:445:1: rule__Mediafile__Group__7__Impl : ( ( rule__Mediafile__DurationAssignment_7 ) ) ;
public final void rule__Mediafile__Group__7__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:449:1: ( ( ( rule__Mediafile__DurationAssignment_7 ) ) )
// InternalPlaylist.g:450:1: ( ( rule__Mediafile__DurationAssignment_7 ) )
{
// InternalPlaylist.g:450:1: ( ( rule__Mediafile__DurationAssignment_7 ) )
// InternalPlaylist.g:451:2: ( rule__Mediafile__DurationAssignment_7 )
{
before(grammarAccess.getMediafileAccess().getDurationAssignment_7());
// InternalPlaylist.g:452:2: ( rule__Mediafile__DurationAssignment_7 )
// InternalPlaylist.g:452:3: rule__Mediafile__DurationAssignment_7
{
pushFollow(FOLLOW_2);
rule__Mediafile__DurationAssignment_7();
state._fsp--;
}
after(grammarAccess.getMediafileAccess().getDurationAssignment_7());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__7__Impl"
// $ANTLR start "rule__Mediafile__Group__8"
// InternalPlaylist.g:460:1: rule__Mediafile__Group__8 : rule__Mediafile__Group__8__Impl ;
public final void rule__Mediafile__Group__8() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:464:1: ( rule__Mediafile__Group__8__Impl )
// InternalPlaylist.g:465:2: rule__Mediafile__Group__8__Impl
{
pushFollow(FOLLOW_2);
rule__Mediafile__Group__8__Impl();
state._fsp--;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__8"
// $ANTLR start "rule__Mediafile__Group__8__Impl"
// InternalPlaylist.g:471:1: rule__Mediafile__Group__8__Impl : ( RULE_RIGHT_BRACKET ) ;
public final void rule__Mediafile__Group__8__Impl() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:475:1: ( ( RULE_RIGHT_BRACKET ) )
// InternalPlaylist.g:476:1: ( RULE_RIGHT_BRACKET )
{
// InternalPlaylist.g:476:1: ( RULE_RIGHT_BRACKET )
// InternalPlaylist.g:477:2: RULE_RIGHT_BRACKET
{
before(grammarAccess.getMediafileAccess().getRIGHT_BRACKETTerminalRuleCall_8());
match(input,RULE_RIGHT_BRACKET,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getRIGHT_BRACKETTerminalRuleCall_8());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__Group__8__Impl"
// $ANTLR start "rule__PlaylistGeneratorModel__MediafilesAssignment_3"
// InternalPlaylist.g:487:1: rule__PlaylistGeneratorModel__MediafilesAssignment_3 : ( ruleMediafile ) ;
public final void rule__PlaylistGeneratorModel__MediafilesAssignment_3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:491:1: ( ( ruleMediafile ) )
// InternalPlaylist.g:492:2: ( ruleMediafile )
{
// InternalPlaylist.g:492:2: ( ruleMediafile )
// InternalPlaylist.g:493:3: ruleMediafile
{
before(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesMediafileParserRuleCall_3_0());
pushFollow(FOLLOW_2);
ruleMediafile();
state._fsp--;
after(grammarAccess.getPlaylistGeneratorModelAccess().getMediafilesMediafileParserRuleCall_3_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__PlaylistGeneratorModel__MediafilesAssignment_3"
// $ANTLR start "rule__Mediafile__IdAssignment_3"
// InternalPlaylist.g:502:1: rule__Mediafile__IdAssignment_3 : ( RULE_STRING ) ;
public final void rule__Mediafile__IdAssignment_3() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:506:1: ( ( RULE_STRING ) )
// InternalPlaylist.g:507:2: ( RULE_STRING )
{
// InternalPlaylist.g:507:2: ( RULE_STRING )
// InternalPlaylist.g:508:3: RULE_STRING
{
before(grammarAccess.getMediafileAccess().getIdSTRINGTerminalRuleCall_3_0());
match(input,RULE_STRING,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getIdSTRINGTerminalRuleCall_3_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__IdAssignment_3"
// $ANTLR start "rule__Mediafile__LocationAssignment_5"
// InternalPlaylist.g:517:1: rule__Mediafile__LocationAssignment_5 : ( RULE_STRING ) ;
public final void rule__Mediafile__LocationAssignment_5() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:521:1: ( ( RULE_STRING ) )
// InternalPlaylist.g:522:2: ( RULE_STRING )
{
// InternalPlaylist.g:522:2: ( RULE_STRING )
// InternalPlaylist.g:523:3: RULE_STRING
{
before(grammarAccess.getMediafileAccess().getLocationSTRINGTerminalRuleCall_5_0());
match(input,RULE_STRING,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getLocationSTRINGTerminalRuleCall_5_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__LocationAssignment_5"
// $ANTLR start "rule__Mediafile__DurationAssignment_7"
// InternalPlaylist.g:532:1: rule__Mediafile__DurationAssignment_7 : ( RULE_FLOAT ) ;
public final void rule__Mediafile__DurationAssignment_7() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalPlaylist.g:536:1: ( ( RULE_FLOAT ) )
// InternalPlaylist.g:537:2: ( RULE_FLOAT )
{
// InternalPlaylist.g:537:2: ( RULE_FLOAT )
// InternalPlaylist.g:538:3: RULE_FLOAT
{
before(grammarAccess.getMediafileAccess().getDurationFLOATTerminalRuleCall_7_0());
match(input,RULE_FLOAT,FOLLOW_2);
after(grammarAccess.getMediafileAccess().getDurationFLOATTerminalRuleCall_7_0());
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
}
// $ANTLR end "rule__Mediafile__DurationAssignment_7"
// Delegated rules
public static final BitSet FOLLOW_1 = new BitSet(new long[]{0x0000000000000000L});
public static final BitSet FOLLOW_2 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_3 = new BitSet(new long[]{0x0000000000004000L});
public static final BitSet FOLLOW_4 = new BitSet(new long[]{0x0000000000000010L});
public static final BitSet FOLLOW_5 = new BitSet(new long[]{0x0000000000008000L});
public static final BitSet FOLLOW_6 = new BitSet(new long[]{0x0000000000000020L});
public static final BitSet FOLLOW_7 = new BitSet(new long[]{0x0000000000008002L});
public static final BitSet FOLLOW_8 = new BitSet(new long[]{0x0000000000010000L});
public static final BitSet FOLLOW_9 = new BitSet(new long[]{0x0000000000000040L});
public static final BitSet FOLLOW_10 = new BitSet(new long[]{0x0000000000020000L});
public static final BitSet FOLLOW_11 = new BitSet(new long[]{0x0000000000040000L});
public static final BitSet FOLLOW_12 = new BitSet(new long[]{0x0000000000000080L});
} | [
"aici.mahdi@gmail.com"
] | aici.mahdi@gmail.com |
1147fe9b845dca4e9231d579e7f4b492aa41e10f | 2cd7aaf12812391c94a278a2106ae11852e38610 | /app/src/main/java/com/example/jinyoon/a01sunshine/DetailActivityFragment.java | 5f86b4ca8035d117abf8cad6f73f3a357995ab4f | [] | no_license | jinyoon0124/01SunShine | 47dfab06cc84dfa173eb7bca9ed4f47dd1cd1d6c | be8910a6abeab6f2d7a574e06be557e750642c17 | refs/heads/master | 2021-01-01T03:37:23.753133 | 2017-01-27T03:06:36 | 2017-01-27T03:06:36 | 56,289,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,075 | java | package com.example.jinyoon.a01sunshine;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.ShareActionProvider;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.jinyoon.a01sunshine.data.WeatherContract;
/**
* A placeholder fragment containing a simple view.
*/
public class DetailActivityFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
private String detailForecastStr;
private static final String LOG_TAG=DetailActivityFragment.class.getSimpleName();
private static final String FORECAST_SHARE_HASHTAG=" #SunShineApp";
private static Uri mUri;
static final String DETAIL_URI = "URI";
private static final int DETAIL_LOADER_ID = 0;
private static final String[] FORECAST_COLUMNS = {
// In this case the id needs to be fully qualified with a table name, since
// the content provider joins the location & weather tables in the background
// (both have an _id column)
// On the one hand, that's annoying. On the other, you can search the weather table
// using the location set by the user, which is only in the Location table.
// So the convenience is worth it.
WeatherContract.WeatherEntry.TABLE_NAME + "." + WeatherContract.WeatherEntry._ID,
WeatherContract.WeatherEntry.COLUMN_DATE,
WeatherContract.WeatherEntry.COLUMN_SHORT_DESC,
WeatherContract.WeatherEntry.COLUMN_MAX_TEMP,
WeatherContract.WeatherEntry.COLUMN_MIN_TEMP,
WeatherContract.WeatherEntry.COLUMN_HUMIDITY,
WeatherContract.WeatherEntry.COLUMN_WIND_SPEED,
WeatherContract.WeatherEntry.COLUMN_DEGREES,
WeatherContract.WeatherEntry.COLUMN_PRESSURE,
WeatherContract.WeatherEntry.COLUMN_WEATHER_ID
};
// These indices are tied to FORECAST_COLUMNS. If FORECAST_COLUMNS changes, these
// must change.
static final int COL_WEATHER_ID = 0;
static final int COL_WEATHER_DATE = 1;
static final int COL_WEATHER_DESC = 2;
static final int COL_WEATHER_MAX_TEMP = 3;
static final int COL_WEATHER_MIN_TEMP = 4;
static final int COL_WEATHER_HUMIDITY = 5;
static final int COL_WEATHER_WIND_SPEED = 6;
static final int COL_WEATHER_DEGREES = 7;
static final int COL_WEATHER_PRESSURE = 8;
static final int COL_WEATHER_CONDITION_ID=9;
private ImageView mIconImageView;
private TextView mDayTextView;
private TextView mDateTextView;
private TextView mHighTextView;
private TextView mLowTextView;
private TextView mDescTextView;
private TextView mHumidityTextView;
private TextView mWindTextView;
private TextView mPressureTextView;
public DetailActivityFragment() {
}
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){
inflater.inflate(R.menu.detail_fragment, menu);
//Share Item!!!!
MenuItem item = menu.findItem(R.id.menu_item_share);
ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
if(mShareActionProvider!=null){
mShareActionProvider.setShareIntent(createShareForecastIntent());
}else{
Log.d(LOG_TAG, "Share Action Provider is null");
}
}
private Intent createShareForecastIntent(){
Intent shareIntent = new Intent(Intent.ACTION_SEND);
//it prevents the activity we are sharing to from being placed onto the activity stack
//When click on the icon later, we might end up being in different app
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT,detailForecastStr+ FORECAST_SHARE_HASHTAG);
return shareIntent;
}
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case R.id.action_settings:
Intent intent = new Intent(getActivity(), SettingsActivity.class);
startActivity(intent);
}
return true;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail, container, false);
mIconImageView = (ImageView) rootView.findViewById(R.id.detail_icon);
mDayTextView = (TextView) rootView.findViewById(R.id.detail_day_textview);
mDateTextView = (TextView) rootView.findViewById(R.id.detail_date_textview);
mHighTextView = (TextView) rootView.findViewById(R.id.detail_high_textview);
mLowTextView = (TextView) rootView.findViewById(R.id.detail_low_textview);
mDescTextView = (TextView) rootView.findViewById(R.id.detail_forecast_textview);
mHumidityTextView = (TextView) rootView.findViewById(R.id.detail_humidity_textview);
mWindTextView = (TextView) rootView.findViewById(R.id.detail_wind_textview);
mPressureTextView = (TextView) rootView.findViewById(R.id.detail_pressure_textview);
Bundle arguments = getArguments();
if(arguments!=null){
mUri=arguments.getParcelable(DETAIL_URI);
}
return rootView;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
getLoaderManager().initLoader(DETAIL_LOADER_ID, null, this);
super.onActivityCreated(savedInstanceState);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// Intent intent = getActivity().getIntent();
// if(intent==null || intent.getData()==null){
// return null;
// }
if(mUri!=null){
return new CursorLoader(
this.getContext(),
mUri,
FORECAST_COLUMNS,
null,
null,
null
);
}else{
return null;
}
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
cursor.moveToFirst();
int weatherId = cursor.getInt(COL_WEATHER_CONDITION_ID);
mIconImageView.setImageResource(Utility.getArtResourceForWeatherCondition(weatherId));
String dayString = Utility.getDayName(this.getActivity(), cursor.getLong(COL_WEATHER_DATE));
mDayTextView.setText(dayString);
String dateString = Utility.getFormattedMonthDay(this.getActivity(),cursor.getLong(COL_WEATHER_DATE));
mDateTextView.setText(dateString);
String maxTempString = Utility.formatTemperature(
this.getActivity(),cursor.getDouble(COL_WEATHER_MAX_TEMP), Utility.isMetric(getContext()));
mHighTextView.setText(maxTempString);
String minTempString = Utility.formatTemperature(
this.getActivity(),cursor.getDouble(COL_WEATHER_MIN_TEMP), Utility.isMetric(getContext()));
mLowTextView.setText(minTempString);
String descString = cursor.getString(COL_WEATHER_DESC);
mDescTextView.setText(descString);
mHumidityTextView.setText(
getString(R.string.format_humidity, cursor.getFloat(COL_WEATHER_HUMIDITY)));
mWindTextView.setText(Utility.getFormattedWind(
this.getActivity(), cursor.getFloat(COL_WEATHER_WIND_SPEED), cursor.getFloat(COL_WEATHER_DEGREES)));
mPressureTextView.setText(
getString(R.string.format_pressure, cursor.getFloat(COL_WEATHER_PRESSURE)));
detailForecastStr = String.format("%s - %s - %s/%s",dateString,descString,maxTempString,minTempString);
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
//Nothing to do here because there is no data that we are holdin onto
}
void onLocationChanged( String newLocation ) {
// replace the uri, since the location has changed
Uri uri = mUri;
if (null != uri) {
long date = WeatherContract.WeatherEntry.getDateFromUri(uri);
Uri updatedUri = WeatherContract.WeatherEntry.buildWeatherLocationWithDate(newLocation, date);
mUri = updatedUri;
getLoaderManager().restartLoader(DETAIL_LOADER_ID, null, this);
}
}
}
| [
"jinyoon0124@gmail.com"
] | jinyoon0124@gmail.com |
4b4f5a5aab85603cb7ca99bda7364c049f0b9e15 | 2ddda270b016b93305c4e3874f5252054a8ad869 | /src/Inventario/ModificarEmpresa.java | 5867919c8594cc14854a33616593b02f77f26439 | [] | no_license | JGuamanga93/Remision | 90308880e8fee39af4cf2d4683c23b40aabbb967 | bf29b7846e4b4bacaffa86ac0d32d15a95d61c21 | refs/heads/master | 2020-07-15T16:16:11.353356 | 2019-08-31T23:09:36 | 2019-08-31T23:09:36 | 205,605,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,970 | 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 Inventario;
import java.awt.Toolkit;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Ing.Ivan
*/
public class ModificarEmpresa extends javax.swing.JInternalFrame {
/**
* Creates new form ModificarProducto
*/
public ModificarEmpresa() {
initComponents();
setResizable(false);
DesactivarCampos();
txt_buscar.requestFocus();
}
public void DesactivarCampos() {
txtCodigo.setEnabled(false);
boxEmpresa.setEnabled(false);
txtRfc.setEnabled(false);
txtTelefono.setEnabled(false);
txtEmail.setEnabled(false);
txtCalle.setEnabled(false);
txtNumero.setEnabled(false);
txtColonia.setEnabled(false);
txtMunicipio.setEnabled(false);
boxEstado.setEnabled(false);
txtCp.setEnabled(false);
btn_guardar.setEnabled(false);
btncancelar.setEnabled(false);
}
//metodo donde crea la tabla de productos
DefaultTableModel m;
public void TablaEmpresa(String val) {//Realiza la consulta de los productos que tenemos en la base de datos
String titles[] = {"Id", "Empresa", "RFC", "Telefono", "Email", "Calle", "Numero", "Colonia", "Municipio", "Estado", "C.P"};
String reg[] = new String[11];
String sentence = "";
m = new DefaultTableModel(null, titles);
Connection con;
con = Conexion.Conexion.GetConnection();
sentence = "CALL SP_EmpresasSel('%" + val + "%')";
try {
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sentence);
while (rs.next()) {
reg[0] = rs.getString("idEmpresas");
reg[1] = rs.getString("Nombre");
reg[2] = rs.getString("RFC");
reg[3] = rs.getString("Telefono");
reg[4] = rs.getString("Email");
reg[5] = rs.getString("Calle");
reg[6] = rs.getString("Numero");
reg[7] = rs.getString("Colonia");
reg[8] = rs.getString("Municipio");
reg[9] = rs.getString("EntidadFederativa");
reg[10] = rs.getString("CP");
m.addRow(reg);//agrega el registro a la tabla
}
TablaSqlEmpresa.setModel(m);//asigna a la tabla el modelo creado
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
//metodo donde obtiene los datos de la tabla para despues modificarlos
String id_act = "";
public void Buscar_editar(String val) {
Connection con;
con = Conexion.Conexion.GetConnection();
String sentence = "";
String idr = "", nom = "", rfc = "", tel = "", ema = "", cal = "", num = "", col = "", mun = "", est = "", cp = "";
sentence = "CALL SP_ObtenerEmpresa(" + val + ")";
try {
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sentence);
while (rs.next()) {
idr = rs.getString("idEmpresas");
nom = rs.getString("Nombre");
rfc = rs.getString("RFC");
tel = rs.getString("Telefono");
ema = rs.getString("Email");
cal = rs.getString("Calle");
num = rs.getString("Numero");
col = rs.getString("Colonia");
mun = rs.getString("Municipio");
est = rs.getString("EntidadFederativa");
cp = rs.getString("CP");
txtCodigo.setText(idr);
boxEmpresa.addItem(nom);
txtRfc.setText(rfc);
txtTelefono.setText(tel);
txtEmail.setText(ema);
txtCalle.setText(cal);
txtNumero.setText(num);
txtColonia.setText(col);
txtMunicipio.setText(mun);
boxEstado.setSelectedItem(est);
txtCp.setText(cp);
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex);
}
}
//metodo donde llena los capos al seleccionar una fila
String action = "Insertar";
public void seleccionarfilamodificar() {
int filasel;
String id;
try {
filasel = TablaSqlEmpresa.getSelectedRow();
if (filasel == -1) {
JOptionPane.showMessageDialog(null, "No se ha seleccionado ninguna fila","Advertencia",JOptionPane.WARNING_MESSAGE);
txt_buscar.requestFocus();
} else {
//txtCodigo.setEnabled(true);
//boxEmpresa.setEnabled(true);
txtRfc.setEnabled(true);
txtTelefono.setEnabled(true);
txtEmail.setEnabled(true);
txtCalle.setEnabled(true);
txtNumero.setEnabled(true);
txtColonia.setEnabled(true);
txtMunicipio.setEnabled(true);
boxEstado.setEnabled(true);
txtCp.setEnabled(true);
btn_guardar.setEnabled(true);
btncancelar.setEnabled(true);
txt_buscar.setText("");
TablaSqlEmpresa.setVisible(false);
action = "Modificar";
m = (DefaultTableModel) TablaSqlEmpresa.getModel();
id = (String) m.getValueAt(filasel, 0);
Buscar_editar(id);
TablaEmpresa("");
txt_buscar.requestFocus();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error" + e.getMessage());
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
txt_buscar = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
TablaSqlEmpresa = new javax.swing.JTable(){
public boolean isCellEditable(int rowIndex, int colIndex) {
return false; //Disallow the editing of any cell
}
};
btnok = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txtRfc = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtNumero = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtColonia = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
btn_guardar = new javax.swing.JButton();
btncancelar = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
boxEmpresa = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
txtCodigo = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
txtTelefono = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
txtEmail = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
txtCalle = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
txtMunicipio = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
boxEstado = new javax.swing.JComboBox();
jLabel14 = new javax.swing.JLabel();
txtCp = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
setClosable(true);
setIconifiable(true);
setResizable(true);
setTitle("Modicar Empresa");
setToolTipText("");
setPreferredSize(new java.awt.Dimension(1127, 677));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(0, 102, 102), null, new java.awt.Color(0, 0, 0)), "Seleccionar empresa para modificar", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Sitka Subheading", 1, 14), new java.awt.Color(0, 0, 153))); // NOI18N
jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
jLabel10.setForeground(new java.awt.Color(0, 153, 204));
jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/Iconos40x40/40x40-BUSCAR.png"))); // NOI18N
jLabel10.setText(" BUSCAR ");
jLabel10.setBorder(javax.swing.BorderFactory.createMatteBorder(1, 1, 1, 1, new java.awt.Color(0, 102, 102)));
jPanel3.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 41, 140, 40));
txt_buscar.setBackground(new java.awt.Color(0, 0, 0));
txt_buscar.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
txt_buscar.setForeground(new java.awt.Color(0, 204, 204));
txt_buscar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
txt_buscar.setCaretColor(new java.awt.Color(0, 204, 204));
txt_buscar.setDisabledTextColor(new java.awt.Color(0, 204, 204));
txt_buscar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txt_buscarKeyReleased(evt);
}
});
jPanel3.add(txt_buscar, new org.netbeans.lib.awtextra.AbsoluteConstraints(156, 41, 570, 40));
TablaSqlEmpresa.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(153, 153, 153), null, new java.awt.Color(102, 102, 102)));
TablaSqlEmpresa.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
TablaSqlEmpresa.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Id", "Empresa", "RFC", "Telefono", "Email", "Calle", "Numero", "Colonia", "Municipio", "Estado", "C.P"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
TablaSqlEmpresa.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
TablaSqlEmpresa.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
TablaSqlEmpresa.setOpaque(false);
TablaSqlEmpresa.getTableHeader().setReorderingAllowed(false);
TablaSqlEmpresa.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
TablaSqlEmpresaMouseClicked(evt);
}
});
jScrollPane1.setViewportView(TablaSqlEmpresa);
jPanel3.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 97, 1059, 90));
btnok.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventario/aceptar.png"))); // NOI18N
btnok.setToolTipText("Eliminar Fila Seleccionada");
btnok.setBorderPainted(false);
btnok.setContentAreaFilled(false);
btnok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnokActionPerformed(evt);
}
});
jPanel3.add(btnok, new org.netbeans.lib.awtextra.AbsoluteConstraints(950, 200, 110, -1));
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, null, new java.awt.Color(0, 102, 102), null, new java.awt.Color(0, 0, 0)), "Modificar datos de la empresa", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Serif", 1, 14), new java.awt.Color(0, 0, 153))); // NOI18N
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel1.setText("Empresa:");
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 66, -1, -1));
txtRfc.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtRfc.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtRfcKeyReleased(evt);
}
});
jPanel1.add(txtRfc, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 94, 280, -1));
jLabel2.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel2.setText("Numero:");
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 221, 72, -1));
txtNumero.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtNumero.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtNumeroKeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNumeroKeyTyped(evt);
}
});
jPanel1.add(txtNumero, new org.netbeans.lib.awtextra.AbsoluteConstraints(92, 218, 81, -1));
jLabel3.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel3.setText("Colonia:");
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(254, 221, -1, -1));
txtColonia.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtColonia.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtColoniaKeyReleased(evt);
}
});
jPanel1.add(txtColonia, new org.netbeans.lib.awtextra.AbsoluteConstraints(321, 218, 240, -1));
jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventario/empresa.png"))); // NOI18N
jPanel1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 32, 245, 287));
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opciones", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Serif", 0, 12))); // NOI18N
btn_guardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/Iconos20x20/20x20-Guardar.png"))); // NOI18N
btn_guardar.setText("Guardar");
btn_guardar.setToolTipText("Guardar Modificaciones");
btn_guardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_guardarActionPerformed(evt);
}
});
btncancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/Iconos20x20/20X20-CANCEL.png"))); // NOI18N
btncancelar.setText("Cancelar");
btncancelar.setToolTipText("Cancelar | Limpiar");
btncancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btncancelarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btn_guardar, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btncancelar))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_guardar)
.addComponent(btncancelar))
);
jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(441, 280, -1, -1));
jLabel4.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel4.setText("RFC:");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(51, 97, -1, -1));
boxEmpresa.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jPanel1.add(boxEmpresa, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 63, 280, -1));
jLabel6.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel6.setText("Codigo:");
jPanel1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(32, 35, -1, -1));
txtCodigo.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jPanel1.add(txtCodigo, new org.netbeans.lib.awtextra.AbsoluteConstraints(93, 32, 150, -1));
jLabel7.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel7.setText("Telefono:");
jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 128, -1, -1));
txtTelefono.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtTelefono.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtTelefonoKeyReleased(evt);
}
});
jPanel1.add(txtTelefono, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 125, 280, -1));
jLabel8.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel8.setText("Email:");
jPanel1.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(38, 159, -1, -1));
txtEmail.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtEmail.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtEmailKeyReleased(evt);
}
});
jPanel1.add(txtEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 156, 280, -1));
jLabel9.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel9.setText("Calle:");
jPanel1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(44, 190, -1, -1));
txtCalle.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtCalle.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtCalleKeyReleased(evt);
}
});
jPanel1.add(txtCalle, new org.netbeans.lib.awtextra.AbsoluteConstraints(91, 187, 280, -1));
jLabel12.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel12.setText("Municipio:");
jPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 252, -1, -1));
txtMunicipio.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtMunicipio.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtMunicipioKeyReleased(evt);
}
});
jPanel1.add(txtMunicipio, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 249, 281, -1));
jLabel13.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel13.setText("Estado:");
jPanel1.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(29, 281, -1, -1));
boxEstado.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
boxEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Aguascalientes", "Baja California", "Baja California Sur", "Campeche", "Chiapas", "Chihuahua", "Coahuila", "Colima", "Distrito Federal", "Durango", "Estado de México", "Guanajuato", "Guerrero", "Hidalgo", "Jalisco", "Michoacán", "Morelos", "Nayarit", "Nuevo León", "Oaxaca", "Puebla", "Querétaro", "Quintana Roo", "San Luis Potosí", "Sinaloa", "Sonora", "Tabasco", "Tamaulipas", "Tlaxcala", "Veracruz", "Yucatán", "Zacatecas" }));
boxEstado.setMinimumSize(new java.awt.Dimension(56, 25));
jPanel1.add(boxEstado, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 280, 281, 25));
jLabel14.setFont(new java.awt.Font("Sitka Subheading", 1, 16)); // NOI18N
jLabel14.setText("C.P:");
jPanel1.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(57, 314, -1, -1));
txtCp.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
txtCp.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtCpKeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
txtCpKeyTyped(evt);
}
});
jPanel1.add(txtCp, new org.netbeans.lib.awtextra.AbsoluteConstraints(92, 311, 81, -1));
jPanel3.add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 193, -1, 370));
getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 58, 1091, 580));
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventario/bannermodempresa.jpg"))); // NOI18N
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1111, -1));
pack();
}// </editor-fold>//GEN-END:initComponents
private void btn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_guardarActionPerformed
//guarda los datos que se han modificado en los campos
Connection con;
con = Conexion.Conexion.GetConnection();
String sentence = "";
String msj = "";
String cod, nom, rfc, tel, ema, cal, num, col, mun, est, cp;
cod = txtCodigo.getText();
Object combo = boxEmpresa.getSelectedItem();
nom = String.valueOf(combo);
rfc = txtRfc.getText();
tel = txtTelefono.getText();
ema = txtEmail.getText();
cal = txtCalle.getText();
num = txtNumero.getText();
col = txtColonia.getText();
mun = txtMunicipio.getText();
Object combo2 = boxEstado.getSelectedItem();
est = String.valueOf(combo2);
cp = txtCp.getText();
//si los datos son diferentes de vacios
if (!cod.isEmpty() && !nom.isEmpty() && !rfc.isEmpty()
&& !tel.isEmpty() && !ema.isEmpty()
&& !cal.isEmpty() && !num.isEmpty()
&& !col.isEmpty() && !mun.isEmpty()
&& !est.isEmpty() && !cp.isEmpty()) {
int confirmado = JOptionPane.showConfirmDialog(null, "¿Esta seguro de modificar la empresa?", "Confirmación", JOptionPane.YES_OPTION);
if (JOptionPane.YES_OPTION == confirmado) {
sentence = "CALL SP_EmpresasUpd(" + cod + ",'" + nom + "',"
+ "'" + rfc + "','" + tel + "','" + ema + "','" + cal
+ "'," + num + ",'" + col + "','" + mun + "','" + est + "'," + cp + ")";
getToolkit().beep();
JOptionPane.showMessageDialog(null, "Empresa modificada correctamente", "Información", JOptionPane.INFORMATION_MESSAGE);
try {
PreparedStatement pst = con.prepareStatement(sentence);
pst.executeUpdate();
txtCodigo.setText("");
boxEmpresa.removeAllItems();
txtRfc.setText("");
txtTelefono.setText("");
txtEmail.setText("");
txtCalle.setText("");
txtNumero.setText("");
txtColonia.setText("");
txtMunicipio.setText("");
boxEstado.setSelectedIndex(0);
txtCp.setText("");
TablaEmpresa("");
txtCodigo.setEnabled(false);
boxEmpresa.setEnabled(false);
txtRfc.setEnabled(false);
txtTelefono.setEnabled(false);
txtEmail.setEnabled(false);
txtCalle.setEnabled(false);
txtNumero.setEnabled(false);
txtColonia.setEnabled(false);
txtMunicipio.setEnabled(false);
boxEstado.setEnabled(false);
txtCp.setEnabled(false);
btn_guardar.setEnabled(false);
btncancelar.setEnabled(false);
TablaSqlEmpresa.setVisible(false);
txt_buscar.setText("");
txt_buscar.requestFocus();
} catch (SQLException ex) {
ex.printStackTrace();
}
} else {
txt_buscar.setText("");
TablaEmpresa("");
JOptionPane.showMessageDialog(null, "Cancelado correctamente", "Mensaje", JOptionPane.ERROR_MESSAGE);
}
} else {
JOptionPane.showMessageDialog(null, "No dejar vacío ningun campo", "Advertencia", JOptionPane.WARNING_MESSAGE);
}
}//GEN-LAST:event_btn_guardarActionPerformed
public void Limpiar() {
txtCodigo.setText("");
boxEmpresa.removeAllItems();
txtRfc.setText("");
txtTelefono.setText("");
txtEmail.setText("");
txtCalle.setText("");
txtNumero.setText("");
txtColonia.setText("");
txtMunicipio.setText("");
boxEstado.setSelectedIndex(0);
txtCp.setText("");
txt_buscar.requestFocus();
txtCodigo.setEnabled(false);
boxEmpresa.setEnabled(false);
txtRfc.setEnabled(false);
txtTelefono.setEnabled(false);
txtEmail.setEnabled(false);
txtCalle.setEnabled(false);
txtNumero.setEnabled(false);
txtColonia.setEnabled(false);
txtMunicipio.setEnabled(false);
boxEstado.setEnabled(false);
txtCp.setEnabled(false);
}
private void btncancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncancelarActionPerformed
Limpiar();
}//GEN-LAST:event_btncancelarActionPerformed
private void txt_buscarKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_buscarKeyReleased
//actualiza la tabla conforme a la letra que teclea
if (txt_buscar.getText().trim().length() >= 1) {
String filtro = txt_buscar.getText();
TablaEmpresa(filtro);
TablaSqlEmpresa.setVisible(true);
} else {
TablaSqlEmpresa.setVisible(false);
}
}//GEN-LAST:event_txt_buscarKeyReleased
private void TablaSqlEmpresaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TablaSqlEmpresaMouseClicked
if (evt.getClickCount() == 2) {
seleccionarfilamodificar();
}
}//GEN-LAST:event_TablaSqlEmpresaMouseClicked
private void btnokActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnokActionPerformed
seleccionarfilamodificar();
}//GEN-LAST:event_btnokActionPerformed
private void txtRfcKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtRfcKeyReleased
int longitud = txtRfc.getText().length();
if (longitud > 20) {
txtRfc.setText(txtRfc.getText().substring(0, 21));
}
}//GEN-LAST:event_txtRfcKeyReleased
private void txtTelefonoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtTelefonoKeyReleased
int longitud = txtTelefono.getText().length();
if (longitud > 15) {
txtTelefono.setText(txtTelefono.getText().substring(0, 16));
}
}//GEN-LAST:event_txtTelefonoKeyReleased
private void txtEmailKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtEmailKeyReleased
int longitud = txtEmail.getText().length();
if (longitud > 45) {
txtEmail.setText(txtEmail.getText().substring(0, 46));
}
}//GEN-LAST:event_txtEmailKeyReleased
private void txtCalleKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCalleKeyReleased
int longitud = txtCalle.getText().length();
if (longitud > 60) {
txtCalle.setText(txtCalle.getText().substring(0, 61));
}
}//GEN-LAST:event_txtCalleKeyReleased
private void txtNumeroKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumeroKeyReleased
int longitud = txtNumero.getText().length();
if (longitud > 9) {
txtNumero.setText(txtNumero.getText().substring(0, 10));
}
}//GEN-LAST:event_txtNumeroKeyReleased
private void txtColoniaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtColoniaKeyReleased
int longitud = txtColonia.getText().length();
if (longitud > 45) {
txtColonia.setText(txtColonia.getText().substring(0, 46));
}
}//GEN-LAST:event_txtColoniaKeyReleased
private void txtMunicipioKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMunicipioKeyReleased
int longitud = txtMunicipio.getText().length();
if (longitud > 45) {
txtMunicipio.setText(txtMunicipio.getText().substring(0, 46));
}
}//GEN-LAST:event_txtMunicipioKeyReleased
private void txtCpKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCpKeyReleased
int longitud = txtCp.getText().length();
if (longitud > 9) {
txtCp.setText(txtCp.getText().substring(0, 10));
}
}//GEN-LAST:event_txtCpKeyReleased
private void txtNumeroKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumeroKeyTyped
if (!Character.isDigit(evt.getKeyChar())) {
Toolkit.getDefaultToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtNumeroKeyTyped
private void txtCpKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCpKeyTyped
if (!Character.isDigit(evt.getKeyChar())) {
Toolkit.getDefaultToolkit().beep();
evt.consume();
}
}//GEN-LAST:event_txtCpKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTable TablaSqlEmpresa;
private javax.swing.JComboBox boxEmpresa;
private javax.swing.JComboBox boxEstado;
private javax.swing.JButton btn_guardar;
private javax.swing.JButton btncancelar;
private javax.swing.JButton btnok;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField txtCalle;
private javax.swing.JTextField txtCodigo;
private javax.swing.JTextField txtColonia;
private javax.swing.JTextField txtCp;
private javax.swing.JTextField txtEmail;
private javax.swing.JTextField txtMunicipio;
private javax.swing.JTextField txtNumero;
private javax.swing.JTextField txtRfc;
private javax.swing.JTextField txtTelefono;
private javax.swing.JTextField txt_buscar;
// End of variables declaration//GEN-END:variables
}
| [
"jhon.guamanga@avaldigitallabs.com"
] | jhon.guamanga@avaldigitallabs.com |
cb4790093218764dfa9949c9de45a54eb8a1d11c | 3ef2295c45bff9bba0e7f9cd05ad4c9376f189f9 | /infix-postfix/src/homework2/InfixToPostfix.java | aadac5d31d652d0489a629e168fdcbfa72279f37 | [] | no_license | aelinadas/data-structure-algorithms | e415cd8dbe5e5df38c6ad016b5fbf6cd7ee0ba9b | 5ecd97427a1c077854978610b0208aa49f5f07bb | refs/heads/master | 2022-11-28T18:09:22.246446 | 2020-08-06T20:56:40 | 2020-08-06T20:56:40 | 285,669,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,262 | 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 homework2;
import java.util.Stack;
/**
* Question 5
* @author aelinadas
*/
public class InfixToPostfix {
private String infixExp;
private String postfixExp;
private Stack<Character> stack = null;
public InfixToPostfix(String infixExp){
this.infixExp= infixExp;
}
public int precedenceChk(char operator){
switch(operator){
case '+':
case '-':
return 1;
case '*':
case '/':
return 2;
case '^':
return 3;
}
return -1;
}
public void popFromStack(char ch){
if(ch == '('){
stack.push(ch);
}else if(ch == ')'){
while(!stack.empty() && stack.peek() != '('){
postfixExp = postfixExp + stack.pop();
}
if(stack.peek() == '('){
stack.pop();
}
}else{
while(!stack.isEmpty() && precedenceChk(ch) <= precedenceChk(stack.peek())){
postfixExp = postfixExp + stack.pop();
}
stack.push(ch);
}
}
public String finalExp(){
postfixExp = "";
stack = new Stack<>();
if(infixExp != null){
for(int i = 0; i < infixExp.length(); i++){
char charChk = infixExp.charAt(i);
if(Character.isLetterOrDigit(charChk)){
postfixExp = postfixExp + charChk;
}else if(infixExp.charAt(i) == ' '){
continue;
}else{
popFromStack(charChk);
}
}
}while(!stack.isEmpty()){
postfixExp = postfixExp + stack.pop();
}
return postfixExp;
}
public static void main(String[] args){
InfixToPostfix newExp = new InfixToPostfix("A*B/C+(D+E-(F*(G/H)))");
System.out.println("Postfix Expression: " + newExp.finalExp());
}
}
| [
"das.aelina@gmail.com"
] | das.aelina@gmail.com |
f07b1cc845910b84d6f29384edb54080d115c2d6 | efd1688dda0d5338e06a5e63fad16c143ec5f071 | /m8/m8/Faculty.java | 2ef88ade4eba79f915f5593a2bce369598ef12a5 | [] | no_license | simz089s/cs303f2017scratchpad | 5476d3b83b086c0a11172f4fbfe5759a5f49452c | dda9d52f0bf69279180803fae7f5d886055f4ef7 | refs/heads/master | 2021-08-30T18:53:00.567940 | 2017-12-19T02:16:18 | 2017-12-19T02:16:18 | 111,637,523 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package m8;
public class Faculty extends AbstractUnit
{
private final String aDean;
public Faculty(String pName, String pDean)
{
super(pName);
aDean = pDean;
}
public String getDean()
{
return aDean;
}
@Override
public void print(String pPrefix)
{
System.out.println(String.format("%s%s (%s)", pPrefix, name(), aDean));
super.print(pPrefix);
}
@Override
public void accept(UnitVisitor pVisitor)
{
pVisitor.visitFaculty(this);
}
}
| [
"simz97@outlook.com"
] | simz97@outlook.com |
88eb0ea10dee763c16275abd5d93340b97a48e47 | 7cacec9594e65e52e953085bcd7f873164568495 | /src/com/irandoo/xhep/base/model/Carousel.java | 0db5cb34c628523a7a7010d9cbb42e81a0ceee08 | [] | no_license | louluxi/wawa | 401d48c5126aea9ac61bb9909194b935d4bb3a86 | 65a9ec6458112471b14b48651c98bc037ad745b8 | refs/heads/master | 2021-05-01T17:50:01.227030 | 2018-02-10T08:22:36 | 2018-02-10T08:22:36 | 120,994,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,075 | java | package com.irandoo.xhep.base.model;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
public class Carousel implements Serializable{
private static final long serialVersionUID = -2055655441245047639L;
private Long id;
private String title;
private String icon_path;
private Integer order_num;
private String jump_path;
private Integer state;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date create_time;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Timestamp update_timestamp;
private String corp_code;
private String stateShow;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIcon_path() {
return icon_path;
}
public void setIcon_path(String icon_path) {
this.icon_path = icon_path;
}
public Integer getOrder_num() {
return order_num;
}
public void setOrder_num(Integer order_num) {
this.order_num = order_num;
}
public String getJump_path() {
return jump_path;
}
public void setJump_path(String jump_path) {
this.jump_path = jump_path;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Timestamp getUpdate_timestamp() {
return update_timestamp;
}
public void setUpdate_timestamp(Timestamp update_timestamp) {
this.update_timestamp = update_timestamp;
}
public String getCorp_code() {
return corp_code;
}
public void setCorp_code(String corp_code) {
this.corp_code = corp_code;
}
public String getStateShow() {
return stateShow;
}
public void setStateShow(String stateShow) {
this.stateShow = stateShow;
}
}
| [
"nuoxin@DESKTOP-159N79I"
] | nuoxin@DESKTOP-159N79I |
6d19d3361fc9d936891cba88517d6b69da479703 | 36876c65c982219d90aff999c861b97baeb6b454 | /BVS BGV_TEAM/Verification-Service/src/main/java/com/cg/iter/backgroundverification/controller/VerificationController.java | b44e826df267b940069f7de681b39b0a6c168306 | [] | no_license | pooja4001/Sprint2BVG | f0e5fdd3bf0db54d52eb641f1a804ca667e1c43e | 0efa920c74ad39ed3cb374eb1605fd5e391f265c | refs/heads/master | 2022-06-19T22:19:09.718236 | 2020-05-11T17:37:30 | 2020-05-11T17:37:30 | 262,111,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,814 | java | package com.capgemini.backgroundverification.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.capgemini.backgroundverification.entity.LoginData;
import com.capgemini.backgroundverification.entity.Verification;
import com.capgemini.backgroundverification.exception.IdNotFoundException;
import com.capgemini.backgroundverification.service.LoginService;
import com.capgemini.backgroundverification.service.VerificationService;
@RestController
@RequestMapping("/ver")
@CrossOrigin("http://localhost:4200")
public class VerificationController{
@Autowired
VerificationService serviceobj;
// Add user
@PostMapping("/addVer/{userId}")
public ResponseEntity<String> setStatus(@RequestBody Verification u, @PathVariable int userId) {
Verification e = serviceobj.setStatus(u,userId);
if (e == null) {
throw new IdNotFoundException("Enter Valid Id");
} else {
return new ResponseEntity<String>("Data entered successfully", new HttpHeaders(), HttpStatus.OK);
}
}
@GetMapping("/checkStatus/{userId}")
public Verification checkStatus(@PathVariable int userId)
{
Verification flag=serviceobj.checkStatus(userId);
return flag;
}
} | [
"noreply@github.com"
] | noreply@github.com |
09c7853f1f918cda9e056e6c5deb7285b4d156c8 | 303fc5afce3df984edbc7e477f474fd7aee3b48e | /fuentes/ucumari-commons/src/main/java/com/wildc/ucumari/custrequest/model/CustRequestWorkEffort.java | 0ca4376263b6f43ce2f17aa4c69cd236569f6a61 | [] | no_license | douit/erpventas | 3624cbd55cb68b6d91677a493d6ef1e410392127 | c53dc6648bd5a2effbff15e03315bab31e6db38b | refs/heads/master | 2022-03-29T22:06:06.060059 | 2014-04-21T12:53:13 | 2014-04-21T12:53:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,807 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.wildc.ucumari.custrequest.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.wildc.ucumari.client.modelo.WorkEffort;
/**
*
* @author Cristian
*/
@Entity
@Table(name = "cust_request_work_effort")
@NamedQueries({
@NamedQuery(name = "CustRequestWorkEffort.findAll", query = "SELECT c FROM CustRequestWorkEffort c")})
public class CustRequestWorkEffort implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected CustRequestWorkEffortPK custRequestWorkEffortPK;
@Column(name = "LAST_UPDATED_STAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdatedStamp;
@Column(name = "LAST_UPDATED_TX_STAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdatedTxStamp;
@Column(name = "CREATED_STAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date createdStamp;
@Column(name = "CREATED_TX_STAMP")
@Temporal(TemporalType.TIMESTAMP)
private Date createdTxStamp;
@JoinColumn(name = "WORK_EFFORT_ID", referencedColumnName = "WORK_EFFORT_ID", insertable = false, updatable = false)
@ManyToOne(optional = false)
private WorkEffort workEffort;
@JoinColumn(name = "CUST_REQUEST_ID", referencedColumnName = "CUST_REQUEST_ID", insertable = false, updatable = false)
@ManyToOne(optional = false)
private CustRequest custRequest;
public CustRequestWorkEffort() {
}
public CustRequestWorkEffort(CustRequestWorkEffortPK custRequestWorkEffortPK) {
this.custRequestWorkEffortPK = custRequestWorkEffortPK;
}
public CustRequestWorkEffort(String custRequestId, String workEffortId) {
this.custRequestWorkEffortPK = new CustRequestWorkEffortPK(custRequestId, workEffortId);
}
public CustRequestWorkEffortPK getCustRequestWorkEffortPK() {
return custRequestWorkEffortPK;
}
public void setCustRequestWorkEffortPK(CustRequestWorkEffortPK custRequestWorkEffortPK) {
this.custRequestWorkEffortPK = custRequestWorkEffortPK;
}
public Date getLastUpdatedStamp() {
return lastUpdatedStamp;
}
public void setLastUpdatedStamp(Date lastUpdatedStamp) {
this.lastUpdatedStamp = lastUpdatedStamp;
}
public Date getLastUpdatedTxStamp() {
return lastUpdatedTxStamp;
}
public void setLastUpdatedTxStamp(Date lastUpdatedTxStamp) {
this.lastUpdatedTxStamp = lastUpdatedTxStamp;
}
public Date getCreatedStamp() {
return createdStamp;
}
public void setCreatedStamp(Date createdStamp) {
this.createdStamp = createdStamp;
}
public Date getCreatedTxStamp() {
return createdTxStamp;
}
public void setCreatedTxStamp(Date createdTxStamp) {
this.createdTxStamp = createdTxStamp;
}
public WorkEffort getWorkEffort() {
return workEffort;
}
public void setWorkEffort(WorkEffort workEffort) {
this.workEffort = workEffort;
}
public CustRequest getCustRequest() {
return custRequest;
}
public void setCustRequest(CustRequest custRequest) {
this.custRequest = custRequest;
}
@Override
public int hashCode() {
int hash = 0;
hash += (custRequestWorkEffortPK != null ? custRequestWorkEffortPK.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 CustRequestWorkEffort)) {
return false;
}
CustRequestWorkEffort other = (CustRequestWorkEffort) object;
if ((this.custRequestWorkEffortPK == null && other.custRequestWorkEffortPK != null) || (this.custRequestWorkEffortPK != null && !this.custRequestWorkEffortPK.equals(other.custRequestWorkEffortPK))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.wildc.ucumari.client.modelo.CustRequestWorkEffort[ custRequestWorkEffortPK=" + custRequestWorkEffortPK + " ]";
}
}
| [
"cmontes375@gmail.com"
] | cmontes375@gmail.com |
b7935ff83d04e7d24d08441c7c1aa1985ae12eab | b3d68fab4c112df5511b1a7efdf9f7afac64f340 | /src/main/java/com/minsub/althorism/Multiples3to5.java | 85d773aa63721848a94693d352e279093e5d5049 | [] | no_license | Minsub/JavaStudyWithMaven | a1d5735f7ef0bd0d0cacb4ac381235faa8e0000d | 8273ab638cffbcaace00779edd21bb26e277235c | refs/heads/master | 2016-09-13T19:49:04.857433 | 2016-05-25T11:25:09 | 2016-05-25T11:25:09 | 59,412,467 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 823 | java | package com.minsub.althorism;
/**
* [문제] If we list all the natural numbers below 10 that are multiples of 3 or
* 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of
* all the multiples of 3 or 5 below 1000.
*
* [번역] 10미만의 자연수에서 3과 5의 배수를 구하면 3,5,6,9이다. 이들의 총합은 23이다.
* 1000미만의 자연수에서 3,5의 배수의 총합을 구하라.
*
* @author hmm1115222
*
*/
public class Multiples3to5 {
public static void main(String[] args) {
System.out.println(getSum3to5(1000));
}
static int getSum3to5(int max) {
int tmp = 0;
for (int i = 3; i < max; i += 3){
tmp += i;
}
for (int i = 5; i < max; i += 5){
tmp += i;
}
for (int i = 15; i < max; i += 15){
tmp -= i;
}
return tmp;
}
}
| [
"jiminsub@gmail.com"
] | jiminsub@gmail.com |
08e62fb2a67757c63acd19ebd0edb8fe42ca3d1a | f2e9037bd4d6e955ce27d373560dc58ccfb90100 | /app/src/androidTest/java/kwa/pumps/ndrapp/ExampleInstrumentedTest.java | 2b63693e224df1ebb4b5f2590a966cf3b5f679a4 | [] | no_license | Lekshmi07/ndrapp | f2a9fc9e6a30917efcc7b2319466f648e2f3f7b7 | 0a730204130b0bd3048b6d3b31eafc66d5a9ee83 | refs/heads/master | 2020-03-28T19:14:17.027522 | 2018-10-13T11:30:41 | 2018-10-13T11:30:41 | 148,957,500 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | package kwa.pumps.ndrapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("kwa.pumps.ndrapp", appContext.getPackageName());
}
}
| [
"rajalekshmi77277@gmail.com"
] | rajalekshmi77277@gmail.com |
7cf18508329e21a3b363f7b6459ecc181bc2e602 | 0e173b1b4066a34ef4c6cea2dd8609d83ed4e97d | /kodilla-stream/src/main/java/com/kodilla/stream/portfolio/User.java | 8ba38c69c4a7ca658ddda28f70c5e39b858fc0b9 | [] | no_license | agammkrawczyk/agnieszkakrawczyk | f33d968edbb9dd1d3ca007af31cad2d98a84a700 | e24562d9cef95cf1e0bb910442a88e855f6ed426 | refs/heads/master | 2020-03-17T07:36:08.125156 | 2018-12-15T20:00:55 | 2018-12-15T20:00:55 | 133,405,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 983 | java | package com.kodilla.stream.portfolio;
import java.util.Objects;
public final class User {
private final String username;
private final String realName;
public User(final String username, final String realName) {
this.username = username;
this.realName = realName;
}
public String getUsername() {
return username;
}
public String getRealName() {
return realName;
}
@Override
public String toString() {
return "User{" +
"username='" + username + '\'' +
", realName='" + realName + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return Objects.equals( username, user.username );
}
@Override
public int hashCode() {
return Objects.hash( username );
}
}
| [
"agammkrawczyk@gmail.com"
] | agammkrawczyk@gmail.com |
bbe3b0af16d975b0fbcfed28f44b834871018cd1 | 441922f2c1e141e574d0e75e2c9accbfbf84fdfd | /Life game/LifeModel.java | 764c344b823181c255b06c2c3db0b0ea0a314379 | [] | no_license | GitGreg228/MIPTStudent.Java | ae5f60cdc30b094e0e5c4d2c6f7f0de059ae9c43 | 5515f599bfd53ffe723e4e33afe30f4da0c50997 | refs/heads/master | 2020-03-13T07:23:29.034166 | 2018-04-25T15:25:04 | 2018-04-25T15:25:04 | 131,024,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,581 | java | import java.util.Arrays;
import java.util.Random;
/**
* Модель данных "Жизни".
* Поле завернуто в тороид, т.е. и левый и правый края, и верхний и нижний, являются замкнутыми.
* При симуляции используется принцип двойной буферизации: данные берутся из главного массива mainField, после расчета
* результат складывается во вспомогательный массив backField. По окончании расчета одного шага ссылки на эти массивы
* меняются местами.
* В массивах хранятся значения: 0, если клетка мертва, и 1, если жива.
*/
public class LifeModel {
private byte[] mainField = null;
private byte[] backField = null;
private int width, height;
private int[] neighborOffsets = null;
private int[][] neighborXYOffsets = null;
/**
* Инициализация модели.
*
* @param width ширина поля данных
* @param height высота поля данных
*/
public LifeModel(int width, int height) {
this.width = width;
this.height = height;
mainField = new byte[width * height];
backField = new byte[width * height];
neighborOffsets = new int[] {-width - 1, -width, -width + 1, -1, 1, width - 1, width, width + 1};
neighborXYOffsets = new int[][] { {-1, -1}, {0, -1}, {1, -1}, {-1, 0}, {1, 0}, {-1, 1}, {0, 1}, {1, 1}};
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public void clear() {
Arrays.fill(mainField, (byte) 0);
}
public void setCell(int x, int y, byte c) {
mainField[y * width + x] = c;
}
public void setRand() {
/*Random rnd = new Random(System.currentTimeMillis());
Arrays.fill(mainField, (byte) rnd.nextInt(2));*/
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
Random rnd = new Random(System.currentTimeMillis());
if (mainField[j * width + i] == 0) {
mainField[j * width + i] = (byte) rnd.nextInt(3);
System.out.println("x = " + i + ", y = " + j + ", cell = " + mainField[j * width + i]);
}
}
}
}
public byte getCell(int x, int y) {
return mainField[y * width + x];
}
/**
* Один шаг симуляции.
*/
public void simulate() {
// обрабатываем клетки, не касающиеся краев поля
for (int y = 1; y < height - 1; y++) {
for (int x = 1; x < width - 1; x++) {
int j = y * width + x;
byte n = countNeighbors(j);
backField[j] = simulateCell(mainField[j], n);
}
}
// обрабатываем граничные клетки
// верхняя и нижняя строки
for (int x = 0; x < width; x++) {
int j = width * (height - 1);
byte n = countBorderNeighbors(x, 0);
backField[x] = simulateCell(mainField[x], n);
n = countBorderNeighbors(x, height - 1);
backField[x + j] = simulateCell(mainField[x + j], n);
}
// крайние левый и правый столбцы
for (int y = 1; y < height - 1; y++) {
int j = width * y;
byte n = countBorderNeighbors(0, y);
backField[j] = simulateCell(mainField[j], n);
n = countBorderNeighbors(width - 1, y);
backField[j + width - 1] = simulateCell(mainField[j + width - 1], n);
}
// обмениваем поля местами
byte[] t = mainField;
mainField = backField;
backField = t;
}
/**
* Подсчет соседей для не касающихся краев клеток.
*
* @param j смещение клетки в массиве
* @return кол-во соседей
*/
private byte countNeighbors(int j) {
byte n = 0;
for (int i = 0; i < 8; i++) {
n += mainField[j + neighborOffsets[i]];
}
return n;
}
/**
* Подсчет соседей для граничных клеток.
*
* @param x
* @param y
* @return кол-во соседей
*/
private byte countBorderNeighbors(int x, int y) {
byte n = 0;
for (int i = 0; i < 8; i++) {
int bx = (x + neighborXYOffsets[i][0] + width) % width;
int by = (y + neighborXYOffsets[i][1] + height) % height;
n += mainField[by * width + bx];
}
return n;
}
/**
* Симуляция для одной клетки.
*
* @param self собственное состояние клетки: 0/1
* @param neighbors кол-во соседей
* @return новое состояние клетки: 0/1
*/
private byte simulateCell(byte self, byte neighbors) {
return (byte) (self == 0 ? (neighbors == 3 ? 1 : 0) : neighbors == 2 || neighbors == 3 ? 1 : 0);
}
} | [
"noreply@github.com"
] | noreply@github.com |
56cf845b030c594651017a5e65955d0bf48e3dbf | f456b2f1c6bdc6001db0a7d21affaca6791dcec8 | /GRUB Server/src/com/mobettertech/grub/service/catalog/dao/GroceryCatalogDataAccessException.java | 6ab0f866552da49a8ada4260792958164dbeb235 | [] | no_license | joelcurtisblack/MY_GRUB | 412904d85240e87b10bde241f676a541fc10cecb | 3183f5b70ea38cf4e853246210694133cec25f53 | refs/heads/master | 2016-09-16T00:02:01.704021 | 2013-12-31T21:22:29 | 2013-12-31T21:22:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | /**
* GroceryCatalogDataAccessException.java
*
* Copyright (c) 2013 Mo Better Tech, Co.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Mo Better Tech, Co.
*
*/
package com.mobettertech.grub.service.catalog.dao;
/**
* This class implements
*
* @author Joel Black
*
*/
public class GroceryCatalogDataAccessException extends Exception
{
/**
*
*/
public GroceryCatalogDataAccessException()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @param aMessage
* @param aCause
*/
public GroceryCatalogDataAccessException(String aMessage, Throwable aCause)
{
super(aMessage, aCause);
// TODO Auto-generated constructor stub
}
/**
* @param aMessage
*/
public GroceryCatalogDataAccessException(String aMessage)
{
super(aMessage);
// TODO Auto-generated constructor stub
}
/**
* @param aCause
*/
public GroceryCatalogDataAccessException(Throwable aCause)
{
super(aCause);
// TODO Auto-generated constructor stub
}
}
| [
"joel.black@mobettertech.com"
] | joel.black@mobettertech.com |
084202dbf1936631e171e180e0346daf910795e8 | 837492fe951fe993bb5f9b0bda311f3733b89a3a | /UISummerI/app/src/main/java/com/example/uisummeri/ui/first/FirstViewModel.java | 64cf042d0656a2ec25442d509052df4c4d71d8c9 | [] | no_license | Amrit-choudhary16/CS6392019 | e4c6717b0fab1747d01fa5d39eca4647c7d2b271 | c89f75691a34f59bda459a559307ab77875aaef5 | refs/heads/master | 2020-05-29T17:29:51.052257 | 2019-07-13T07:02:08 | 2019-07-13T07:02:08 | 189,278,200 | 0 | 1 | null | 2019-06-03T16:30:37 | 2019-05-29T18:27:54 | Java | UTF-8 | Java | false | false | 170 | java | package com.example.uisummeri.ui.first;
import android.arch.lifecycle.ViewModel;
public class FirstViewModel extends ViewModel {
// TODO: Implement the ViewModel
}
| [
"choudhary.amrit16@gmail.com"
] | choudhary.amrit16@gmail.com |
1c51b9b3112d48740f88507f8228eca29a42ab11 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /pre_compile/nonstatic_methods/methods/java_net_JarURLConnection_setUseCaches_boolean.java | 94b0a32420ab9bd585c4721d9198f24fefda5d54 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | class java_net_JarURLConnection_setUseCaches_boolean{ public static void function() {java.net.JarURLConnection obj = new java.net.JarURLConnection();obj.setUseCaches(false);}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
ae6f6a5bb3c6b2269b1f6d8ccf2a142e30c52017 | 17ffbba6a65c6221ae01aa6c592e65ce09765884 | /app/src/main/java/com/ela/wallet/sdk/didlibrary/widget/Indeterminate.java | 8a8245b1b5916db963e011f88ffe8a474a9606a7 | [
"Apache-2.0"
] | permissive | elastos/Elastos.App.DIDPlugin | 580728988c4c173f783c470c69c8c7d616dccd93 | d4ffdc4199dee7eb6722ccf491cc5496f3d92f90 | refs/heads/master | 2020-04-10T15:15:19.364976 | 2019-04-12T07:29:35 | 2019-04-12T08:06:02 | 161,102,963 | 2 | 2 | Apache-2.0 | 2019-04-03T09:16:11 | 2018-12-10T02:06:49 | Java | UTF-8 | Java | false | false | 1,058 | java | /*
* Copyright 2015 Kaopiz Software Co., Ltd.
*
* 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.ela.wallet.sdk.didlibrary.widget;
/**
* If a view implements this interface passed to the HUD as a custom view, its animation
* speed can be change by calling setAnimationSpeed() on the HUD.
* This interface only provides convenience, how animation speed work depends on the view implementation.
*/
public interface Indeterminate {
void setAnimationSpeed(float scale);
}
| [
"xiaokun.meng@qcast.cn"
] | xiaokun.meng@qcast.cn |
674e475a75cd29467e2c1756610e6dab161fe596 | 9419249ee66fc06f7fa389fe28ea5debc6362c6d | /src/main/java/com/wsk/cards/skill/PurpleNightmareCard.java | 382ae0b27cb981a2921f2b0748a3ef4580d7f43b | [
"MIT"
] | permissive | wsk1103/LagranYue | 0ee45ee3745ab444cff84e822f005056d91ff188 | 5da15ed6cce5a182585226b1c26fb159b5b4dc0d | refs/heads/master | 2022-09-17T00:13:41.248505 | 2022-08-14T12:28:30 | 2022-08-14T12:28:30 | 172,636,794 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,736 | java | package com.wsk.cards.skill;
import basemod.abstracts.CustomCard;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.wsk.actions.ActionUtil;
import com.wsk.patches.AbstractCardEnum;
import com.wsk.powers.base.ImprintPower;
import com.wsk.utils.CommonUtil;
/**
* @author wsk1103
* @date 2019/2/26
* @desc 紫宝石的噩梦
*/
public class PurpleNightmareCard extends CustomCard {
public static final String ID = "LagranYue:PurpleNightmareCard";
private static final String NAME;
private static final String DESCRIPTION;
private static final CardStrings cardStrings;
private static final String IMG = "cards/PurpleNightmareCard.png";
//例:img/cards/claw/attack/BloodSuckingClaw_Orange.png 详细情况请根据自己项目的路径布置进行填写。
private static final int COST = 0;
public PurpleNightmareCard() {
super(ID, NAME, CommonUtil.getResourcePath(IMG), COST, DESCRIPTION,
CardType.SKILL,
AbstractCardEnum.LagranYue,
CardRarity.UNCOMMON, CardTarget.ENEMY);
this.magicNumber = this.baseMagicNumber = 2;
this.exhaust = false;
}
//用于显示在卡牌一览里。同时也是诸多卡牌复制效果所需要调用的基本方法,用来获得一张该卡的原始模板修改后加入手牌/抽牌堆/弃牌堆/牌组。
public AbstractCard makeCopy() {
return new PurpleNightmareCard();
}
@Override
public void upgrade() {
if (!this.upgraded) {
this.upgradeName();
this.upgradeBaseCost(0);
}
}
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
if (m.hasPower(ImprintPower.POWER_ID)) {
int num = m.getPower(ImprintPower.POWER_ID).amount;
ActionUtil.imprintPower(p, m, num);
// AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p,
// new ImprintPower(m, p, num), num, true, AbstractGameAction.AttackEffect.POISON));
} else {
ActionUtil.imprintPower(p, m, this.magicNumber);
// AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(m, p,
// new ImprintPower(m, p, this.magicNumber), this.magicNumber, true, AbstractGameAction.AttackEffect.POISON));
}
}
static {
cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
NAME = cardStrings.NAME;
DESCRIPTION = cardStrings.DESCRIPTION;
}
}
| [
"1261709167@qq.com"
] | 1261709167@qq.com |
437731eae7d7d5e7ce8352983ab8e1efa0d7ba4e | 709fa8c8ab1ac8c46305a2e2668c538b63394206 | /org.semeru/src/org/semeru/model/I_SM_TemplateBasic.java | a415060ddbcfca553f696ad9ff1407735987f401 | [] | no_license | egaevanov/semeru-plugin | a64ac5a7bc20130a71e66677cbcf18b475b187ed | f8729228be679b2950ece8263f7dc0eea3705af1 | refs/heads/master | 2020-12-29T13:32:47.344928 | 2020-03-30T18:05:56 | 2020-03-30T18:05:56 | 238,623,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,881 | java | /******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
* This program is free software, you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. 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, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.semeru.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for SM_TemplateBasic
* @author iDempiere (generated)
* @version Release 6.2
*/
@SuppressWarnings("all")
public interface I_SM_TemplateBasic
{
/** TableName=SM_TemplateBasic */
public static final String Table_Name = "SM_TemplateBasic";
/** AD_Table_ID=1000047 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 4 - System
*/
BigDecimal accessLevel = BigDecimal.valueOf(4);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
/** Set Processed.
* The document has been processed
*/
public void setProcessed (boolean Processed);
/** Get Processed.
* The document has been processed
*/
public boolean isProcessed();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}
| [
"ega.evanov@gmail.com"
] | ega.evanov@gmail.com |
f3fe609f59264464abe0451fa7d1b36ffe866f44 | 033230cad6c09fb00a4f485ed6aa5c71455c3bd6 | /src/coureur/Coureur.java | ee75adcbe2f00b688de4f2c67e4ef9f239c0cebb | [] | no_license | Freeddy-Djiotsop/Coureur | e320c09ecf7f38281361692518c242a9aed68157 | 951e9fdaf89ad5767c6b0a879b0480058b06ac51 | refs/heads/main | 2023-02-22T18:19:21.472541 | 2021-01-21T01:40:47 | 2021-01-21T01:40:47 | 331,481,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,340 | java | package coureur;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;
public class Coureur extends Application {
Stage stage;
private Label titleLabel;
private Label statusLabel;
private Button addGirlfriendButton;
private Button removeGirlfriendButton;
private int GirlfriendsTotal = 1;
@Override
public void start(Stage s) throws Exception {
stage = s;
stage.setTitle("The Womanizer Best Friend");
Image likeImage = new Image(getClass().getResourceAsStream("/resources/images/like.png"));
stage.getIcons().add(likeImage);
VBox root = new VBox();
titleLabel = new Label("The Womanizer");
titleLabel.setId("titleLabel");
// Ich lade die Fonts
titleLabel.setFont(Font.loadFont(getClass().getResource("/resources/font/Pacifico.ttf").toString(), 10));
titleLabel.setFont(Font.loadFont(getClass().getResource("/resources/font/FrauncesItalic.ttf").toString(), 10));
statusLabel = new Label();
statusLabel.setId("statusLabel");
updateStatusLabel(GirlfriendsTotal);
HBox buttonsContainer = new HBox();
buttonsContainer.getStyleClass().add("hBox");// css class
addGirlfriendButton = new Button("Add Girlfriend".toUpperCase());
addGirlfriendButton.setOnAction(e -> updateStatusLabel(++GirlfriendsTotal));
removeGirlfriendButton = new Button("remove Girlfriend".toUpperCase());
removeGirlfriendButton.setOnAction(e -> {
if (GirlfriendsTotal > 0)
updateStatusLabel(--GirlfriendsTotal);
});
buttonsContainer.getChildren().addAll(addGirlfriendButton, removeGirlfriendButton);
root.getChildren().addAll(titleLabel, statusLabel, buttonsContainer);
Scene scene = new Scene(root);
// verbinde mit css Datei
scene.getStylesheets().add(getClass().getResource("/resources/style/main.css").toString());
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
private void updateStatusLabel(int z) {
if (z < 2)
statusLabel.setText("You have " + z + " girlfriend currently");
else
statusLabel.setText("You have " + z + " girlfriends currently");
}
public static void main(String[] args) {
launch(args);
}
}
| [
"75644155+Freeddy-Djiotsop@users.noreply.github.com"
] | 75644155+Freeddy-Djiotsop@users.noreply.github.com |
f8823bdd3dc558927129590aa52c6985aca4a4d7 | fdc5c96351aaaadfca1aade7cb3fe04c3829333c | /app/src/main/java/com/dat/barnaulzoopark/ui/videoalbumsdetail/VideoAlbumsDetailActivity.java | a43568b6b1656249feb581dfa1b9fed1b1565c22 | [] | no_license | jintoga/Barnaul-Zoopark | b5689058ab365961e63059d3f7f687d728ad2802 | a2280cc4e601afae92e391f68b5365a123423d2f | refs/heads/master | 2021-04-18T23:45:51.146694 | 2017-06-07T17:31:41 | 2017-06-07T17:31:41 | 50,792,159 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package com.dat.barnaulzoopark.ui.videoalbumsdetail;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import butterknife.Bind;
import butterknife.ButterKnife;
import com.dat.barnaulzoopark.R;
import com.dat.barnaulzoopark.model.VideoAlbum;
import com.dat.barnaulzoopark.ui.BaseActivity;
import com.dat.barnaulzoopark.utils.ConverterUtils;
import com.google.gson.Gson;
/**
* Created by DAT on 5/23/2017.
*/
public class VideoAlbumsDetailActivity extends BaseActivity {
@Bind(R.id.toolbar)
protected Toolbar toolbar;
private static final String EXTRA_VIDEO_ALBUM = "EXTRA_VIDEO_ALBUM";
public static void startActivity(Activity activity, @NonNull VideoAlbum videoAlbum) {
if (activity instanceof VideoAlbumsDetailActivity) {
return;
}
Intent intent = new Intent(activity, VideoAlbumsDetailActivity.class);
String photoAlbumJson = new Gson().toJson(videoAlbum);
intent.putExtra(EXTRA_VIDEO_ALBUM, photoAlbumJson);
activity.startActivity(intent);
activity.overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_albums_detail);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
String albumJson = getIntent().getStringExtra(EXTRA_VIDEO_ALBUM);
if (albumJson == null) {
finish();
return;
}
VideoAlbum videoAlbum = new Gson().fromJson(albumJson, VideoAlbum.class);
if (getSupportActionBar() != null) {
String name = String.format("%s\n%s", videoAlbum.getName(),
ConverterUtils.getConvertedTime(videoAlbum.getTime()));
getSupportActionBar().setTitle(name);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
VideoAlbumsDetailFragment fragment =
(VideoAlbumsDetailFragment) getSupportFragmentManager().findFragmentById(
R.id.fragmentVideoAlbum);
fragment.loadData(videoAlbum);
}
@Override
public void onBackPressed() {
super.onBackPressed();
finishWithTransition(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finishWithTransition(true);
break;
default:
return false;
}
return true;
}
}
| [
"jintoga123@yahoo.com"
] | jintoga123@yahoo.com |
66ff6e6b53d846f194b7c7a7a718fc6f95b86351 | 15f8668ddb8b3828b4be3f2bc6d6926488e9157d | /abi/src/main/java/fscoin/block/abi/datatypes/generated/Bytes23.java | d6c6799ffbdacb8e5dcd40348a9e150683514be7 | [] | no_license | GBSDFS/FS-coin | 5871b269d1abf800e01b134bd354dae982f57713 | e790a5c812973ad38152ab79c05c72510e596666 | refs/heads/main | 2023-02-05T18:55:22.593248 | 2020-12-29T10:06:28 | 2020-12-29T10:06:28 | 325,246,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package fscoin.block.abi.datatypes.generated;
import fscoin.block.abi.datatypes.Bytes;
public class Bytes23 extends Bytes {
public static final Bytes23 DEFAULT = new Bytes23(new byte[23]);
public Bytes23(byte[] value) {
super(23, value);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
bbc4eb4d66d20c538a8f4815c3c674792b43d8c1 | 196fc283b9959147ffba85bf806f279481044f34 | /MyApplication/app/src/main/java/com/example/faiz/cloudinary_testing/MainActivity.java | de40a7b874cce487e639db906ca5c64dc3313982 | [] | no_license | adnan94/AndroidApps | a57f2cefdb0858814ab93d18600946b8f8b8f9cd | 2e4392e30b8b00698bd73471871ef26872502f06 | refs/heads/master | 2020-06-16T16:06:21.992397 | 2016-10-04T10:29:01 | 2016-10-04T10:29:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,854 | java | package com.example.faiz.cloudinary_testing;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Environment;
import android.provider.MediaStore;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.cloudinary.Cloudinary;
import com.cloudinary.Util;
import com.cloudinary.android.Utils;
import com.cloudinary.utils.ObjectUtils;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;
import org.cloudinary.json.JSONObject;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
private static final int Browse_image = 1;
private String imgDecodableString;
ImageView img;
Bitmap bitmap;
String ImgUrl, selectedImagePath;
Cloudinary cloudinary;
Firebase firebase;
private static final int PICK_IMAGE = 1;
private static final int RESULT_CROP = 2;
JSONObject Result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Firebase.setAndroidContext(this);
// img = (ImageView) findViewById(R.id.imageView_user);
Button btn = (Button) findViewById(R.id.button_upload);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, Browse_image);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
// When an Image is picked
if (requestCode == Browse_image && resultCode == RESULT_OK
&& null != data) {
// Get the Image from data
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
// Get the cursor
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
// Move to first row
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.imageView_user);
// Set the Image in ImageView after decoding the String
imgView.setImageBitmap(BitmapFactory
.decodeFile(imgDecodableString));
} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)
.show();
}
}
}
| [
"faizkhanabid@yahoo.com"
] | faizkhanabid@yahoo.com |
80d3075b0cf870da6cb6bf9388bc39b6c1185909 | b21545e3763176592e308b3764cf87a9596ef31d | /Cinema/Cinema/src/main/java/edu/eci/arsw/cinema/persistence/impl/InMemoryCinemaPersistence.java | 435840fbca6c18a3ada0e28a95e4f9028a094027 | [] | no_license | heredikon/Lab5ARSW | 72ce3ebf04062831cf31747e9b2c8609f18c060e | a90ac6af9a18c199f37158463ff845a6c82b48a6 | refs/heads/master | 2020-04-23T00:14:26.442490 | 2019-02-14T23:58:14 | 2019-02-14T23:58:14 | 170,771,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,188 | 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 edu.eci.arsw.cinema.persistence.impl;
import edu.eci.arsw.cinema.model.Cinema;
import edu.eci.arsw.cinema.model.CinemaFunction;
import edu.eci.arsw.cinema.model.Movie;
import edu.eci.arsw.cinema.persistence.CinemaException;
import edu.eci.arsw.cinema.persistence.CinemaPersistenceException;
import edu.eci.arsw.cinema.persistence.CinemaPersitence;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author cristian
*/
public class InMemoryCinemaPersistence implements CinemaPersitence{
private final Map<String,Cinema> cinemas=new HashMap<>();
public InMemoryCinemaPersistence() {
//load stub data
String functionDate = "2018-12-18 15:30";
List<CinemaFunction> functions= new ArrayList<>();
CinemaFunction funct1 = new CinemaFunction(new Movie("SuperHeroes Movie","Action"),functionDate);
CinemaFunction funct2 = new CinemaFunction(new Movie("The Night","Horror"),functionDate);
functions.add(funct1);
functions.add(funct2);
Cinema c=new Cinema("cinemaX",functions);
cinemas.put("cinemaX", c);
}
@Override
public void buyTicket(int row, int col, String cinema, String date, String movieName) throws CinemaException {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<CinemaFunction> getFunctionsbyCinemaAndDate(String cinema, String date) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void saveCinema(Cinema c) throws CinemaPersistenceException {
if (cinemas.containsKey(c.getName())){
throw new CinemaPersistenceException("The given cinema already exists: "+c.getName());
}
else{
cinemas.put(c.getName(),c);
}
}
@Override
public Cinema getCinema(String name) throws CinemaPersistenceException {
return cinemas.get(name);
}
}
| [
"heredia800@gmail.com"
] | heredia800@gmail.com |
8b83acc46636b574cf1ad867f643e30b30befc33 | f3698795f174340106c66885bb57ac72134c58c8 | /unisecurity/idatrix-unisecurity-parent/idatrix-unisecurity-freeipa/src/main/java/com/idatrix/unisecurity/freeipa/msg/response/AddUserResponseVO.java | e40909c7c48412b66dbe4ff721b25b4daecfcbd1 | [] | no_license | ahandful/CloudETL | 6e5c195953a944cdc62702b100bd7bcd629b4aee | bb4be62e8117082cd656741ecae33e4262ad3fb5 | refs/heads/master | 2020-09-13T01:33:43.749781 | 2019-04-18T02:12:08 | 2019-04-18T02:13:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.idatrix.unisecurity.freeipa.msg.response;
import com.idatrix.unisecurity.freeipa.msg.response.addUser.LdapRtqAddUserResult;
public class AddUserResponseVO extends BasicResponse {
private LdapRtqAddUserResult result;
public LdapRtqAddUserResult getResult() {
return result;
}
public void setResult(LdapRtqAddUserResult result) {
this.result = result;
}
}
| [
"xionghan@gdbigdata.com"
] | xionghan@gdbigdata.com |
e9689da9a7b26df9a0b827ae36540c8effcf8aaa | 02cb74ec84860afd33e63ca9f1e1be683c0a5340 | /spring-security-cors-setup/src/main/java/com/mehmetozanguven/springsecuritycorssetup/config/SecurityConfiguration.java | 20798ae502db8882ac974335e534d7bf8e04d2c9 | [] | no_license | douglaskorgut/spring-security-examples | 19a0d470f9e250db0e53b8705d8253ab5771f08f | 4496736c344602f8fd985c83ecfa996c66a6ac9d | refs/heads/master | 2023-08-26T23:48:33.113879 | 2021-10-25T19:27:00 | 2021-10-25T19:27:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,025 | java | package com.mehmetozanguven.springsecuritycorssetup.config;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.stereotype.Component;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.time.Duration;
import java.util.Arrays;
@Component
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
// WARNING: Please don't enable corsFilter and corsConfigurer at the same time, use one of them.
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.setAllowedOrigins(Arrays.asList("*"));
corsConfiguration.setAllowedMethods(Arrays.asList("*"));
corsConfiguration.setMaxAge(Duration.ofMinutes(10));
source.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(source);
}
// @Bean
// public WebMvcConfigurer corsConfigurer() {
// return new WebMvcConfigurer() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**").allowedOrigins("*");
// }
// };
// }
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.authorizeRequests().anyRequest().permitAll();
http.cors();
}
}
| [
"mehmetozanguven@localhost.localdomain"
] | mehmetozanguven@localhost.localdomain |
ee38088d3a6cddcaf7e23024efde87aaedc6c5b7 | b36628c7b3d5165bbbdcb4a4ebead4bd3e687b21 | /Jicker/src/org/jicker/util/systemproperties/SysInfo.java | c165cff568d2dda953946da191eff43c53694ad7 | [] | no_license | stepborc/jicker | 506e04ca69f2b8dcac51ab6fd2d5ef9b30694f76 | 0d6805b7a415802ad5326d03b3d4b7282e23aa3f | refs/heads/master | 2016-09-06T13:33:02.710506 | 2015-03-13T10:56:01 | 2015-03-13T10:56:01 | 32,136,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | /*
*
*/
package org.jicker.util.systemproperties;
import java.awt.Container;
import java.awt.GridLayout;
import java.util.Enumeration;
import java.util.Properties;
import javax.swing.JFrame;
import javax.swing.JLabel;
// TODO: Auto-generated Javadoc
/**
* The Class SysInfo.
*/
@SuppressWarnings("serial")
public class SysInfo extends JFrame {
/**
* Instantiates a new sys info.
*/
public SysInfo(){
super("Ein einfacher Frame");
addWindowListener(new WindowClosingAdapter(true));
Properties sysprops = System.getProperties();
Enumeration propnames = sysprops.propertyNames();
Container cp = getContentPane();
cp.setLayout(new GridLayout(sysprops.size(),1));
String iProper;
while(propnames.hasMoreElements()){
String propname = (String)propnames.nextElement();
iProper = propname + " = " + System.getProperty(propname);
JLabel label = new JLabel(iProper);
label.setHorizontalAlignment(JLabel.LEFT);
cp.add(label);
}
}
/**
* The main method.
*
* @param args the args
*/
public static void main(String[] args) {
SysInfo sysinfo = new SysInfo();
sysinfo.setLocation(100, 100);
sysinfo.setSize(1024,768);
sysinfo.setVisible(true);
}
}
| [
"stepborc@e63418c4-c234-0410-a210-dd3f49822de1"
] | stepborc@e63418c4-c234-0410-a210-dd3f49822de1 |
8c960949db402f3e4c8e9e0851feb1c5a367778f | 31b3ac69c4c79f6b0740978b070458f60548e620 | /biz.aQute.bnd/src/aQute/bnd/plugin/Central.java | 3f128d078220f7a960d5beb51a187efa6fbf4b52 | [
"Apache-2.0"
] | permissive | herbyme/bnd | 9567d0920851676441d0c5aa013b5b9f0bc47614 | 0f6b8b40f98cffc19ab5fc5aab2886198673ad1d | refs/heads/master | 2021-01-21T17:13:30.561721 | 2010-05-15T11:51:45 | 2010-05-15T11:51:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,743 | java | package aQute.bnd.plugin;
import java.io.File;
import java.util.*;
import java.util.concurrent.*;
import org.eclipse.core.internal.resources.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.*;
import org.osgi.framework.*;
import aQute.bnd.build.Project;
import aQute.bnd.build.Workspace;
import aQute.bnd.classpath.*;
import aQute.bnd.service.*;
public class Central implements IResourceChangeListener {
static IWorkspace iworkspace;
final Map<IJavaProject, Project> javaProjectToModel = new HashMap<IJavaProject, Project>();
final List<ModelListener> listeners = new CopyOnWriteArrayList<ModelListener>();
static Workspace workspace;
final BundleContext context;
final Workspace ws;
Central(BundleContext context) throws Exception {
this.context = context;
// Add a resource change listener if this is
// the first project
iworkspace = ResourcesPlugin.getWorkspace();
iworkspace.addResourceChangeListener(this);
ws = getWorkspace();
context.registerService(Workspace.class.getName(), ws, null);
}
public Project getModel(IJavaProject project) {
try {
Project model = javaProjectToModel.get(project);
if (model == null) {
File projectDir = project.getProject().getLocation()
.makeAbsolute().toFile();
model = Workspace.getProject(projectDir);
if (workspace == null) {
model.getWorkspace();
}
if (model != null) {
javaProjectToModel.put(project, model);
}
}
return model;
} catch (Exception e) {
// TODO do something more useful here
throw new RuntimeException(e);
}
}
/**
* Implementation of the resource changed interface. We are checking in the
* POST_CHANGE phase if one of our tracked models needs to be updated.
*/
public synchronized void resourceChanged(IResourceChangeEvent event) {
if (event.getType() != IResourceChangeEvent.POST_CHANGE)
return;
IResourceDelta rootDelta = event.getDelta();
try {
final Set<Project> changed = new HashSet<Project>();
rootDelta.accept(new IResourceDeltaVisitor() {
public boolean visit(IResourceDelta delta) throws CoreException {
try {
IPath location = delta.getResource().getLocation();
if (location == null) {
System.out
.println("Cannot convert resource to file: "
+ delta.getResource());
} else {
File file = location.toFile();
File parent = file.getParentFile();
boolean parentIsWorkspace = parent
.equals(getWorkspace().getBase());
// file
// /development/osgi/svn/build/org.osgi.test.cases.distribution/bnd.bnd
// parent
// /development/osgi/svn/build/org.osgi.test.cases.distribution
// workspace /development/amf/workspaces/osgi
// false
if (parent != null && parentIsWorkspace) {
// We now are on project level, we do not go
// deeper
// because projects/workspaces should check for
// any
// changes.
// We are careful not to create unnecessary
// projects
// here.
if (file.getName().equals(Workspace.CNFDIR)) {
if (workspace.refresh()) {
changed.addAll(workspace
.getCurrentProjects());
}
return false;
}
if (workspace.isPresent(file.getName())) {
Project project = workspace.getProject(file
.getName());
changed.add(project);
} else {
; // Project not created yet, so we
// have
// no cached results
}
return false;
}
}
return true;
} catch (Exception e) {
e.printStackTrace();
throw new CoreException(new Status(Status.ERROR,
Activator.PLUGIN_ID,
"During checking project changes", e));
}
}
});
for (Project p : changed) {
p.refresh();
changed(p);
}
} catch (CoreException e) {
Activator.getDefault().error("While handling changes", e);
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static Workspace getWorkspace() throws Exception {
if (workspace != null)
return workspace;
IResource resource = iworkspace.getRoot().findMember("/cnf/build.bnd");
if (resource != null) {
IPath path = resource.getLocation();
if (path != null) {
File f = path.toFile();
workspace = Workspace.getWorkspace(f.getAbsoluteFile()
.getParentFile().getParentFile().getAbsoluteFile());
// workspace.setBundleContex(context);
return workspace;
}
}
workspace = Workspace.getWorkspace(iworkspace.getRoot().getLocation()
.toFile());
return workspace;
}
public void changed(Project model) {
model.setChanged();
for (ModelListener m : listeners)
try {
m.modelChanged(model);
} catch (Exception e) {
e.printStackTrace();
}
}
public void addModelListener(ModelListener m) {
if (!listeners.contains(m)) {
listeners.add(m);
}
}
public void removeModelListener(ModelListener m) {
listeners.remove(m);
}
public IJavaProject getJavaProject(Project model) {
for (IProject iproj : iworkspace.getRoot().getProjects()) {
if (iproj.getName().equals(model.getName())) {
IJavaProject ij = JavaCore.create(iproj);
if (ij != null && ij.exists()) {
return ij;
}
// current project is not a Java project
}
}
return null;
}
public static IPath toPath(Project project, File file) {
String path = file.getAbsolutePath();
String workspace = project.getWorkspace().getBase().getAbsolutePath();
if (path.startsWith(workspace))
path = path.substring(workspace.length());
else
return null;
IPath p = new Path(path);
return p;
}
public static void refresh(IPath path) {
try {
IResource r = ResourcesPlugin.getWorkspace().getRoot().findMember(
path);
if (r != null)
return;
IPath p = (IPath) path.clone();
while (p.segmentCount() > 0) {
p = p.removeLastSegments(1);
IResource resource = ResourcesPlugin.getWorkspace().getRoot()
.findMember(p);
if (resource != null) {
resource.refreshLocal(2, null);
return;
}
}
} catch( ResourceException re ) {
// TODO Ignore for now
}
catch (Exception e) {
Activator.getDefault().error("While refreshing path " + path, e);
}
}
public void refreshPlugins() throws Exception {
List<Refreshable> rps = getWorkspace().getPlugins(Refreshable.class);
for (Refreshable rp : rps) {
if (rp.refresh()) {
File dir = rp.getRoot();
refreshFile(dir);
}
}
}
public void refreshFile(File f) throws Exception {
String path = toLocal(f);
IResource r = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if (r != null) {
r.refreshLocal(IResource.DEPTH_INFINITE, null);
}
}
public void refresh(Project p) throws Exception {
IJavaProject jp = getJavaProject(p);
if (jp != null)
jp.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
}
private String toLocal(File f) throws Exception {
String root = getWorkspace().getBase().getAbsolutePath();
String path = f.getAbsolutePath().substring(root.length());
return path;
}
public void close() {
}
}
| [
"peter.kriens@aqute.biz"
] | peter.kriens@aqute.biz |
56d6cef30a40989be9826c68eb4a7f23c8b8e0ff | ef8a2affbee9bc5afe12685ffc42bbf55cde8109 | /app/src/test/java/org/glenda9/stationcountobservatory/ExampleUnitTest.java | cf02cc16c89063e7a2a10490ec008a5e25503058 | [] | no_license | enukane/StationCountObservatory | 528a2f02c2865269f079ea7c5372fb76ead1b628 | 0c0f207646b0d0a18b95261d0a05122bb3312b42 | refs/heads/master | 2022-09-18T04:02:43.883877 | 2022-09-08T14:11:02 | 2022-09-08T14:11:02 | 121,494,275 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package org.glenda9.stationcountobservatory;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"enukane@glenda9.org"
] | enukane@glenda9.org |
397d8ec45ec8778afede4272cbf15772884017ca | 75b8ce816026706db58eea8bb20e3dabc14207b0 | /GeoRecSys-ejb/src/main/java/sessionbeans/CorrelationFacade.java | 8e29218a5a2b1ef34af06d026e2ea6e1c9468186 | [] | no_license | JanoSoto/GeoRecommender | f97d52c30444c02c3dacc0c87da9db82f79010b9 | f3455270d12397193548caa295530197bec8b681 | refs/heads/master | 2020-09-15T22:59:29.285236 | 2016-08-23T06:20:24 | 2016-08-23T06:20:24 | 66,172,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,720 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sessionbeans;
import entities.Correlation;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
/**
*
* @author JAno
*/
@Stateless
public class CorrelationFacade extends AbstractFacade<Correlation> implements CorrelationFacadeLocal {
@PersistenceContext(unitName = "cl.usach_GeoRecSys-ejb_ejb_1.0-SNAPSHOTPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public CorrelationFacade() {
super(Correlation.class);
}
@Override
public List<Correlation> getTopFiveCorrelations(Long user_id) {
Query query = em.createNamedQuery("Correlation.getTopFiveCorrelations").setParameter("user_id", user_id);
query.setMaxResults(5);
try{
return (List<Correlation>) query.getResultList();
}
catch(NoResultException e){
return new ArrayList();
}
}
@Override
public double getCorrelationByUsers(Long user1_id, Long user2_id) {
Query query = em.createNamedQuery("Correlation.getCorrelationByUsers");
query.setParameter("user1_id", user1_id);
query.setParameter("user2_id", user2_id);
try{
return (double) query.getSingleResult();
}
catch(NoResultException e){
return -1;
}
}
}
| [
"alejandro.soto@usach.cl"
] | alejandro.soto@usach.cl |
8330e13730b17fac1d67000993098cbfaf6c24c8 | 036666f3484edb4fb5ddc5e1088437c437fc9672 | /src/main/java/psoft/backend/projeto/excecoes/CurtidaInexistenteException.java | 2f2eb22212ad0c73b1fa3a1ba63a9b7b05c297d1 | [] | no_license | aarthurguedes/psoft-projeto-back | 05b3aa952d08bc5e4711fbdeeb42aa2720cbba37 | c79b6e2b422f607fd723a866083a30c54748deef | refs/heads/master | 2020-08-24T21:46:56.089711 | 2019-12-16T23:32:55 | 2019-12-16T23:32:55 | 216,912,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package psoft.backend.projeto.excecoes;
public class CurtidaInexistenteException extends Exception{
private String msg;
public CurtidaInexistenteException(String msg) {
super(msg);
this.msg = msg;
}
public String getMessage() {
return msg;
}
}
| [
"arthur.guedes@ccc.ufcg.edu.br"
] | arthur.guedes@ccc.ufcg.edu.br |
c6df80f6192ecc4add3ac5537baf7a6005441840 | df68bd4b06c4237e9a2b853f7391eecd01b5f721 | /app/src/main/java/com/citycloud/androidweb/GuideActivity.java | fd5678c1d63616edd4d7ea62d05dd4c3b00f2776 | [] | no_license | Yc100/android-agent-web | 976dee696dd02be09d425033061689d0f2a06bdb | 3e28f5a6626eb9bd8ee5961798fd064e92a24af5 | refs/heads/master | 2023-01-30T10:34:24.204242 | 2020-08-26T10:26:04 | 2020-08-26T10:26:04 | 319,914,972 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,742 | java | package com.citycloud.androidweb;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.cardview.widget.CardView;
import com.facebook.drawee.view.SimpleDraweeView;
import cn.bingoogolapple.bgabanner.BGABanner;
import cn.bingoogolapple.bgabanner.BGALocalImageSize;
public class GuideActivity extends Activity {
private static final String TAG = GuideActivity.class.getSimpleName();
//private BGABanner BackgroundBanner;
private BGABanner mBackgroundBanner;
private BGABanner mForegroundBanner;
private CountDownTimer countDownTimer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
setListener();
processLogic();
}
private void initView() {
setContentView(R.layout.activity_guide);
//BackgroundBanner = findViewById(R.id.banner_guide_background);
mBackgroundBanner = findViewById(R.id.banner_guide_background);
mForegroundBanner = findViewById(R.id.banner_guide_foreground);
}
private void setListener() {
/**
* 设置进入按钮和跳过按钮控件资源 id 及其点击事件
* 如果进入按钮和跳过按钮有一个不存在的话就传 0
* 在 BGABanner 里已经帮开发者处理了防止重复点击事件
* 在 BGABanner 里已经帮开发者处理了「跳过按钮」和「进入按钮」的显示与隐藏
*/
mForegroundBanner.setEnterSkipViewIdAndDelegate(R.id.btn_guide_enter, R.id.tv_guide_skip, new BGABanner.GuideDelegate() {
@Override
public void onClickEnterOrSkip() {
//startActivity(new Intent(GuideActivity.this, MainActivity.class));
finish();
}
});
/*BackgroundBanner.setEnterSkipViewIdAndDelegate(R.id.btn_guide_enter, R.id.tv_guide_skip, new BGABanner.GuideDelegate() {
@Override
public void onClickEnterOrSkip() {
//startActivity(new Intent(GuideActivity.this, MainActivity.class));
finish();
}
});*/
mForegroundBanner.setDelegate(new BGABanner.Delegate<ImageView, String>() {
@Override
public void onBannerItemClick(BGABanner banner, ImageView itemView, String model, int position) {
//Toast.makeText(banner.getContext(), "点击了" + position, Toast.LENGTH_SHORT).show();
}
});
mForegroundBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {//监听轮播改变
@Override
public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
if(mForegroundBanner.getCurrentItem()+1==mForegroundBanner.getItemCount()){//最后一页停止自动轮播
mForegroundBanner.stopAutoPlay();
}
}
});
mBackgroundBanner.setAdapter(new BGABanner.Adapter<ImageView, String>() {//监听轮播改变
@Override
public void fillBannerItem(BGABanner banner, ImageView itemView, String model, int position) {
if(mBackgroundBanner.getCurrentItem()+1==mBackgroundBanner.getItemCount()){//最后一页停止自动轮播
mBackgroundBanner.stopAutoPlay();
}
}
});
//定义一个CountDownTimer,这个类是Android SDK提供用来进行倒计时的。CountDownTimer(long millisInFuture, long countDownInterval)有两个参数,第一个是计时的总时长,第二个是间隔。
countDownTimer = new CountDownTimer(10000,1000) {
@Override
public void onTick(long millisUntilFinished) {
//tvAds.setText("点击跳过"+(millisUntilFinished/1000)+"秒");
}
@Override
public void onFinish() {
finish();
}
}.start();
}
private void processLogic() {
// Bitmap 的宽高在 maxWidth maxHeight 和 minWidth minHeight 之间
BGALocalImageSize localImageSize = new BGALocalImageSize(720, 1280, 320, 640);
//BackgroundBanner.setAutoPlayAble(true);//自动轮播
// 设置数据源
/*BackgroundBanner.setData(localImageSize, ImageView.ScaleType.CENTER_CROP,
R.drawable.guide_1,
R.drawable.guide_2,
R.drawable.guide_3);*/
//BackgroundBanner.startAutoPlay();
/*原数据======================================================================*/
mBackgroundBanner.setAutoPlayAble(true);//自动轮播
mBackgroundBanner.setData(localImageSize, ImageView.ScaleType.CENTER_CROP,
R.drawable.uoko_guide_background_1,
R.drawable.uoko_guide_background_2,
R.drawable.uoko_guide_background_3);
mForegroundBanner.setAutoPlayAble(true);//自动轮播
mForegroundBanner.setData(localImageSize, ImageView.ScaleType.CENTER_CROP,
R.drawable.uoko_guide_foreground_1,
R.drawable.uoko_guide_foreground_2,
R.drawable.uoko_guide_foreground_3);
}
@Override
protected void onResume() {
super.onResume();
// 如果开发者的引导页主题是透明的,需要在界面可见时给背景 Banner 设置一个白色背景,避免滑动过程中两个 Banner 都设置透明度后能看到 Launcher
mBackgroundBanner.setBackgroundResource(android.R.color.white);
}
} | [
"1301760713@qq.com"
] | 1301760713@qq.com |
58c738a1774d8838557e7407e2328ad699b71154 | ec9dacd41c75346c05d836b4000a6eeadaa596e3 | /kernel/src/main/java/net/ytoec/kernel/service/RegionService.java | f6d771ece6404acbd515e4980610865671908840 | [] | no_license | Pd1r/eop | 08295a8c2543c3f96470965fc9db90fcb186335a | 0c43b484de6f08e57a64b5194fc1413db0fd78f4 | refs/heads/master | 2020-06-07T17:31:56.208813 | 2018-11-28T05:57:59 | 2018-11-28T05:57:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,403 | java | package net.ytoec.kernel.service;
import java.util.List;
/**
* 区域信息service接口
*
* @author Wangyong
* @param <T>
*/
public interface RegionService<T> {
/**
* 增加区域信息数据对象
*
* @param region
* @return @
*/
public boolean addRegion(T region);
/**
* 删除区域信息数据对象
*
* @param region
* @return @
*/
public boolean removeRegion(T region);
/**
* 更新区域信息数据对象
*
* @param region
* @return @
*/
public boolean editRegion(T region);
/**
* 根据id查询地市信息
*
* @param id
* @return @
*/
public T getRegionById(Integer id);
/**
* 根据id号查询属于该id下的地市信息列表
*
* @param parentId
* @return @
*/
public List<T> getRegionByParentId(Integer parentId);
/**
* 查询所有省级区域,用于在初始显示时显示全部省级区域或者直辖市、自治区等
*
* @return @
*/
public List<T> getProvinceRegion();
/**
* 获取所有地区(省,市,地区)
*
* @return
*/
public List<T> getAllRegion();
/**
* 查询所有的省份,除去港澳台
* @param list
* @return
*/
public List<T> getAllProvince(List<Integer> list);
}
| [
"caozhi_soft@163.com"
] | caozhi_soft@163.com |
9ae7189d228004320c0e2bb9d8e80388f2041339 | 1022794c1246343de80bc8a158e646dca281e85c | /modules/math/src/main/java/com/opengamma/strata/math/impl/rootfinding/NewtonRaphsonSingleRootFinder.java | d22fbbc03b65c3f19aba1a0df28b5f6f2bc1f2a5 | [
"Apache-2.0"
] | permissive | slusek/Strata | eb1652cca3aa6da5c15eb23e5160447184beb6db | e182dbed3578b4d66e69f7afe5b3d962c219aaac | refs/heads/master | 2020-04-05T23:42:47.477211 | 2015-12-18T17:09:39 | 2015-12-18T17:09:39 | 44,492,878 | 1 | 0 | null | 2015-10-18T19:30:00 | 2015-10-18T19:30:00 | null | UTF-8 | Java | false | false | 8,224 | java | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.strata.math.impl.rootfinding;
import java.util.function.Function;
import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.math.impl.MathException;
import com.opengamma.strata.math.impl.function.DoubleFunction1D;
/**
* Class for finding the real root of a function within a range of $x$-values using the one-dimensional version of Newton's method.
* <p>
* For a function $f(x)$, the Taylor series expansion is given by:
* $$
* \begin{align*}
* f(x + \delta) \approx f(x) + f'(x)\delta + \frac{f''(x)}{2}\delta^2 + \cdots
* \end{align*}
* $$
* As delta approaches zero (and if the function is well-behaved), this gives
* $$
* \begin{align*}
* \delta = -\frac{f(x)}{f'(x)}
* \end{align*}
* $$
* when $f(x + \delta) = 0$.
* <p>
* There are several well-known problems with Newton's method, in particular when the range of values given includes a local
* maximum or minimum. In this situation, the next iterative step can shoot off to $\pm\infty$. This implementation
* currently does not attempt to correct for this: if the value of $x$ goes beyond the initial range of values $x_{low}$
* and $x_{high}$, an exception is thrown.
* <p>
* If the function that is provided does not override the {@link com.opengamma.strata.math.impl.function.DoubleFunction1D#derivative()} method, then
* the derivative is approximated using finite difference. This is undesirable for several reasons: (i) the extra function evaluations will lead
* to slower convergence; and (ii) the choice of shift size is very important (too small and the result will be dominated by rounding errors, too large
* and convergence will be even slower). Use of another root-finder is recommended in this case.
*/
public class NewtonRaphsonSingleRootFinder extends RealSingleRootFinder {
private static final int MAX_ITER = 10000;
private final double _accuracy;
/**
* Default constructor. Sets accuracy to 1e-12.
*/
public NewtonRaphsonSingleRootFinder() {
this(1e-12);
}
/**
* Takes the accuracy of the root as a parameter - this is the maximum difference
* between the true root and the returned value that is allowed.
* If this is negative, then the absolute value is used.
*
* @param accuracy The accuracy
*/
public NewtonRaphsonSingleRootFinder(double accuracy) {
_accuracy = Math.abs(accuracy);
}
/**
* {@inheritDoc}
* @throws MathException If the root is not found in 1000 attempts; if the Newton
* step takes the estimate for the root outside the original bounds.
*/
@Override
public Double getRoot(Function<Double, Double> function, Double x1, Double x2) {
ArgChecker.notNull(function, "function");
return getRoot(DoubleFunction1D.from(function), x1, x2);
}
//-------------------------------------------------------------------------
public Double getRoot(Function<Double, Double> function, Double x) {
ArgChecker.notNull(function, "function");
ArgChecker.notNull(x, "x");
DoubleFunction1D f = DoubleFunction1D.from(function);
return getRoot(f, f.derivative(), x);
}
/**
* Uses the {@link DoubleFunction1D#derivative()} method. <i>x<sub>1</sub></i> and
* <i>x<sub>2</sub></i> do not have to be increasing.
*
* @param function The function, not null
* @param x1 The first bound of the root, not null
* @param x2 The second bound of the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts; if the Newton
* step takes the estimate for the root outside the original bounds.
*/
public Double getRoot(DoubleFunction1D function, Double x1, Double x2) {
ArgChecker.notNull(function, "function");
return getRoot(function, function.derivative(), x1, x2);
}
/**
* Uses the {@link DoubleFunction1D#derivative()} method. This method uses an initial
* guess for the root, rather than bounds.
*
* @param function The function, not null
* @param x The initial guess for the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts.
*/
public Double getRoot(DoubleFunction1D function, Double x) {
ArgChecker.notNull(function, "function");
return getRoot(function, function.derivative(), x);
}
/**
* Uses the function and its derivative.
* @param function The function, not null
* @param derivative The derivative, not null
* @param x1 The first bound of the root, not null
* @param x2 The second bound of the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts; if the Newton
* step takes the estimate for the root outside the original bounds.
*/
public Double getRoot(Function<Double, Double> function, Function<Double, Double> derivative, Double x1, Double x2) {
checkInputs(function, x1, x2);
ArgChecker.notNull(derivative, "derivative");
return getRoot(DoubleFunction1D.from(function), DoubleFunction1D.from(derivative), x1, x2);
}
/**
* Uses the function and its derivative. This method uses an initial guess for the root, rather than bounds.
* @param function The function, not null
* @param derivative The derivative, not null
* @param x The initial guess for the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts.
*/
public Double getRoot(Function<Double, Double> function, Function<Double, Double> derivative, Double x) {
return getRoot(DoubleFunction1D.from(function), DoubleFunction1D.from(derivative), x);
}
/**
* Uses the function and its derivative.
* @param function The function, not null
* @param derivative The derivative, not null
* @param x1 The first bound of the root, not null
* @param x2 The second bound of the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts; if the Newton
* step takes the estimate for the root outside the original bounds.
*/
public Double getRoot(DoubleFunction1D function, DoubleFunction1D derivative, Double x1, Double x2) {
checkInputs(function, x1, x2);
ArgChecker.notNull(derivative, "derivative function");
double y1 = function.applyAsDouble(x1);
if (Math.abs(y1) < _accuracy) {
return x1;
}
double y2 = function.applyAsDouble(x2);
if (Math.abs(y2) < _accuracy) {
return x2;
}
double x = (x1 + x2) / 2;
double x3 = y2 < 0 ? x2 : x1;
double x4 = y2 < 0 ? x1 : x2;
double xLower = x1 > x2 ? x2 : x1;
double xUpper = x1 > x2 ? x1 : x2;
for (int i = 0; i < MAX_ITER; i++) {
double y = function.applyAsDouble(x);
double dy = derivative.applyAsDouble(x);
double dx = -y / dy;
if (Math.abs(dx) <= _accuracy) {
return x + dx;
}
x += dx;
if (x < xLower || x > xUpper) {
dx = (x4 - x3) / 2;
x = x3 + dx;
}
if (y < 0) {
x3 = x;
} else {
x4 = x;
}
}
throw new MathException("Could not find root in " + MAX_ITER + " attempts");
}
/**
* Uses the function and its derivative. This method uses an initial guess for the root, rather than bounds.
* @param function The function, not null
* @param derivative The derivative, not null
* @param x The initial guess for the root, not null
* @return The root
* @throws MathException If the root is not found in 1000 attempts.
*/
public Double getRoot(DoubleFunction1D function, DoubleFunction1D derivative, Double x) {
ArgChecker.notNull(function, "function");
ArgChecker.notNull(derivative, "derivative function");
ArgChecker.notNull(x, "x");
double root = x;
for (int i = 0; i < MAX_ITER; i++) {
double y = function.applyAsDouble(root);
double dy = derivative.applyAsDouble(root);
double dx = y / dy;
if (Math.abs(dx) <= _accuracy) {
return root - dx;
}
root -= dx;
}
throw new MathException("Could not find root in " + MAX_ITER + " attempts");
}
}
| [
"stephen@opengamma.com"
] | stephen@opengamma.com |
66e5e0703d7766168fca2802202ac0708f20b5cf | 26f054011c066c6548e416e7fa2657351f730e67 | /src/application/Main.java | fdcd05263165099978faa66cf29c82814202f6fe | [] | no_license | KevinWorkSpace/ScrapingUtil | d14e9a6391625a9806f1cc45a918be878e6f910d | a5ca39365d1dfdddb154fc5b2b1a267f211a9071 | refs/heads/master | 2020-03-17T21:31:51.963769 | 2018-05-21T13:11:07 | 2018-05-21T13:11:07 | 133,963,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,957 | java | package application;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
public class Main extends Application {
private Statement stmt;
private Stage stage;
/**
* <b>得到Stage对象</b>
* @return Stage对象
*/
public Stage getStage() {
return stage;
}
/**
* <b>得到Statement对象</b>
* @return Statement对象
*/
public Statement getStatement() {
return stmt;
}
/**
* <b>初始化程序界面</b>
*/
@Override
public void start(Stage primaryStage) throws Exception {
Connection conn = null;
stage = primaryStage;
String url = "jdbc:mysql://localhost:3306/crashcourse?"
+ "user=root&password=Zhchming1&useUnicode=true&characterEncoding=UTF8";
try {
Class.forName("com.mysql.jdbc.Driver");// 动态加载mysql驱动
System.out.println("成功加载MySQL驱动程序");
conn = DriverManager.getConnection(url);
stmt = conn.createStatement();
stmt.execute("SET names 'utf8mb4'");
FXMLLoader loader = new FXMLLoader();
loader.setLocation(this.getClass().getResource("Scraping.fxml"));
BorderPane root = (BorderPane) loader.load();
ScrapingController scrapingController = loader.getController();
scrapingController.setMain(this);
Scene scene = new Scene(root);
primaryStage.setScene(scene);
primaryStage.show();
} catch (SQLException e) {
System.out.println("MySQL操作错误");
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* <b>程序主入口</b>
* @param args 参数
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"30995513+KevinWorkSpace@users.noreply.github.com"
] | 30995513+KevinWorkSpace@users.noreply.github.com |
e757f8a9c935064db0e8be7ecd84176a97cb9156 | 3b7f2ec02509c03624366c1ff0a9a1e8a49d1c6b | /src/main/java/com/sleepycat/je/rep/impl/networkRestore/FeederManager.java | 9bb977e5149157bb9fd1b1e6caa876a2dfc1fab5 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | andyglick/berkeley-db-java-edition | ae09295a6489ea61d23be346fe1676adc13d2b82 | 5b0b4a653a696ff415a388df3cbb0cbf7e85001f | refs/heads/master | 2023-01-30T16:40:31.198418 | 2020-12-09T03:12:15 | 2020-12-09T03:12:15 | 319,814,512 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 9,764 | java | /*-
* Copyright (C) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
*
* This file was distributed by Oracle as part of a version of Oracle Berkeley
* DB Java Edition made available at:
*
* http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html
*
* Please see the LICENSE file included in the top-level directory of the
* appropriate version of Oracle Berkeley DB Java Edition for a copy of the
* license and additional information.
*/
package com.sleepycat.je.rep.impl.networkRestore;
import java.util.ArrayList;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;
import com.sleepycat.je.EnvironmentFailureException;
import com.sleepycat.je.dbi.EnvironmentFailureReason;
import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.rep.impl.node.NameIdPair;
import com.sleepycat.je.rep.net.DataChannel;
import com.sleepycat.je.rep.utilint.RepUtils;
import com.sleepycat.je.rep.utilint.ServiceDispatcher;
import com.sleepycat.je.util.DbBackup;
import com.sleepycat.je.utilint.LoggerUtils;
import com.sleepycat.je.utilint.StoppableThread;
/**
* Manages the multiple log file feeders that may be servicing requests from
* multiple clients requesting log files.
*/
public class FeederManager extends StoppableThread {
/*
* The queue into which the ServiceDispatcher queues socket channels for
* new Feeder instances.
*/
private final BlockingQueue<DataChannel> channelQueue =
new LinkedBlockingQueue<>();
/*
* Map indexed by the client id. Each Feeder adds itself to the Map when
* its first created and removes itself when it exits.
*/
final Map<Integer, LogFileFeeder> feeders =
new ConcurrentHashMap<>();
/*
* Maps the client id to its Lease. Except for instantaneous overlaps,
* a client will have an entry in either the feeders map or the leases
* map, but not in both maps.
*/
final Map<Integer, Lease> leases = new ConcurrentHashMap<>();
/*
* A cache of StatResponses to try minimize the recomputation of SHA1
* hashes.
*/
final Map<String, Protocol.FileInfoResp> statResponses =
new ConcurrentHashMap<>();
/* Implements the timer used to maintain the leases. */
final Timer leaseTimer = new Timer(true);
/* This node's name and internal id */
final NameIdPair nameIdPair;
/* Counts the number of times the lease was renewed. */
public int leaseRenewalCount;
/* The duration of leases. */
long leaseDuration = DEFAULT_LEASE_DURATION;
final ServiceDispatcher serviceDispatcher;
/* Determines whether the feeder manager has been shutdown. */
final AtomicBoolean shutdown = new AtomicBoolean(false);
final Logger logger;
/* Wait indefinitely for somebody to request the service. */
private static long POLL_TIMEOUT = Long.MAX_VALUE;
/* Identifies the Feeder Service. */
public static final String FEEDER_SERVICE = "LogFileFeeder";
/*
* Default duration of lease on DbBackup associated with the client. It's
* five minutes.
*/
private static final long DEFAULT_LEASE_DURATION = 5 * 60 * 1000;
/**
* Creates a FeederManager but does not start it.
*
* @param serviceDispatcher The service dispatcher with which the
* FeederManager must register itself. It's null only in a test
* environment.
*
* @param nameIdPair The node name and id associated with the feeder
*
* @param envImpl the environment that will provide the log files
*/
public FeederManager(ServiceDispatcher serviceDispatcher,
EnvironmentImpl envImpl,
NameIdPair nameIdPair) {
super(envImpl, "Feeder Manager node: " + nameIdPair.getName());
this.serviceDispatcher = serviceDispatcher;
serviceDispatcher.register
(serviceDispatcher.new
LazyQueuingService(FEEDER_SERVICE, channelQueue, this));
this.nameIdPair = nameIdPair;
logger = LoggerUtils.getLogger(getClass());
}
EnvironmentImpl getEnvImpl() {
return envImpl;
}
/**
* Returns the number of times the lease was actually renewed.
*/
public int getLeaseRenewalCount() {
return leaseRenewalCount;
}
/**
* Returns the number of leases that are currently outstanding.
*/
public int getLeaseCount() {
return leases.size();
}
/**
* Returns the number of feeders that are currently active with this node.
* Note that active leases are included in this count, since it's expected
* that the clients will try to reconnect.
*/
public int getActiveFeederCount() {
return feeders.size() + getLeaseCount();
}
public long getLeaseDuration() {
return leaseDuration;
}
public void setLeaseDuration(long leaseDuration) {
this.leaseDuration = leaseDuration;
}
/**
* Clears the cached checksum for a file when it may be overwritten
* (e.g., entries may be erased).
*/
public void clearedCachedFileChecksum(String fileName) {
statResponses.remove(fileName);
}
/**
* The dispatcher method that starts up new log file feeders.
*/
@Override
public void run() {
try {
while (true) {
final DataChannel channel =
channelQueue.poll(POLL_TIMEOUT, TimeUnit.MILLISECONDS);
if (channel == RepUtils.CHANNEL_EOF_MARKER) {
LoggerUtils.info(logger, envImpl,
"Log file Feeder manager soft shutdown.");
return;
}
new LogFileFeeder(this, channel).start();
}
} catch (InterruptedException ie) {
LoggerUtils.info
(logger, envImpl, "Log file feeder manager interrupted");
} catch (Exception e) {
LoggerUtils.severe(logger, envImpl,
"unanticipated exception: " + e.getMessage());
throw new EnvironmentFailureException
(envImpl, EnvironmentFailureReason.UNCAUGHT_EXCEPTION, e);
} finally {
shutdown();
}
}
public void shutdown() {
LoggerUtils.fine
(logger, envImpl, "Shutting down log file feeder manager");
if (!shutdown.compareAndSet(false, true)) {
return;
}
shutdownThread(logger);
/* shutdown active feeder threads */
for (LogFileFeeder feeder :
new ArrayList<>(feeders.values())) {
feeder.shutdown();
}
leaseTimer.cancel();
/*
* Terminate any outstanding leases, and close their associated open
* dbbackups, so that the environment can be closed cleanly.
*/
for (Lease l : new ArrayList<>(leases.values())) {
DbBackup dbBackup = l.terminate();
if (dbBackup.backupIsOpen()) {
dbBackup.endBackup();
}
}
serviceDispatcher.cancel(FEEDER_SERVICE);
cleanup();
LoggerUtils.fine(logger, envImpl,
"Shut down log file feeder manager completed");
}
@Override
protected int initiateSoftShutdown() {
/* Shutdown invoked from a different thread. */
channelQueue.clear();
/* Add special entry so that the channelQueue.poll operation exits. */
channelQueue.add(RepUtils.CHANNEL_EOF_MARKER);
return 0;
}
/**
* Provides the lease mechanism used to maintain a handle to the DbBackup
* object across Server client disconnects.
*/
class Lease extends TimerTask {
private final int id;
private DbBackup dbBackup;
public Lease(int id, long duration, DbBackup dbbackup) {
super();
this.dbBackup = dbbackup;
this.id = id;
Lease oldLease = leases.put(id, this);
if (oldLease != null) {
throw EnvironmentFailureException.unexpectedState
("Found an old lease for node: " + id);
}
leaseTimer.schedule(this, duration);
}
@Override
/* The timer went off, expire the lease if it hasn't been terminated */
public synchronized void run() {
if (dbBackup == null) {
return;
}
dbBackup.endBackup();
terminate();
}
/**
* Fetches the leased DbBackup instance and terminates the lease.
*
* @return the dbBackup instance, if the lease hasn't already been
* terminated
*/
public synchronized DbBackup terminate() {
if (dbBackup == null) {
return null;
}
cancel();
Lease l = leases.remove(id);
assert(l == this);
DbBackup saveDbBackup = dbBackup;
dbBackup = null;
return saveDbBackup;
}
public synchronized DbBackup getOpenDbBackup() {
return (dbBackup != null) && dbBackup.backupIsOpen() ?
dbBackup :
null;
}
}
/**
* @see StoppableThread#getLogger
*/
@Override
protected Logger getLogger() {
return logger;
}
}
| [
"andyglick@gmail.com"
] | andyglick@gmail.com |
94262da4cee50a475264c2111e341a53738872df | 7c86862cbf2f54780ee5ee2d2d5898489b46a8ac | /app/src/main/java/com/zwp/mobilefacenet/mtcnn/Utils.java | 79fc46480f8a7b17fd718d5da73fd00fc2ae809b | [
"MIT"
] | permissive | TrangLeQuynh/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing | 994da0ae354ee21c48b34cfb50f65c4ac1a55f76 | d635649e711f5e16e6cd3dc06cbb329cd8d1d3b7 | refs/heads/master | 2023-05-12T14:38:24.621768 | 2020-08-18T00:47:16 | 2020-08-18T00:47:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,753 | java | package com.zwp.mobilefacenet.mtcnn;
/*
MTCNN For Android
by cjf@xmu 20180625
*/
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.Log;
import java.util.Vector;
import static java.lang.Math.max;
import static java.lang.Math.min;
public class Utils {
//复制图片,并设置isMutable=true
public static Bitmap copyBitmap(Bitmap bitmap){
return bitmap.copy(bitmap.getConfig(),true);
}
//在bitmap中画矩形
public static void drawRect(Bitmap bitmap,Rect rect,int thick){
try {
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
int r=255;//(int)(Math.random()*255);
int g=0;//(int)(Math.random()*255);
int b=0;//(int)(Math.random()*255);
paint.setColor(Color.rgb(r, g, b));
paint.setStrokeWidth(thick);
paint.setStyle(Paint.Style.STROKE);
canvas.drawRect(rect, paint);
//Log.i("Util","[*]draw rect");
}catch (Exception e){
Log.i("Utils","[*] error"+e);
}
}
//在图中画点
public static void drawPoints(Bitmap bitmap, Point[] landmark,int thick){
for (int i=0;i<landmark.length;i++){
int x=landmark[i].x;
int y=landmark[i].y;
//Log.i("Utils","[*] landmarkd "+x+ " "+y);
drawRect(bitmap,new Rect(x-1,y-1,x+1,y+1),thick);
}
}
public static void drawBox(Bitmap bitmap,Box box,int thick){
drawRect(bitmap,box.transform2Rect(),thick);
drawPoints(bitmap,box.landmark,thick);
}
//Flip alone diagonal
//对角线翻转。data大小原先为h*w*stride,翻转后变成w*h*stride
public static void flip_diag(float[]data,int h,int w,int stride){
float[] tmp=new float[w*h*stride];
for (int i=0;i<w*h*stride;i++) tmp[i]=data[i];
for (int y=0;y<h;y++)
for (int x=0;x<w;x++){
for (int z=0;z<stride;z++)
data[(x*h+y)*stride+z]=tmp[(y*w+x)*stride+z];
}
}
//src转为二维存放到dst中
public static void expand(float[] src,float[][]dst){
int idx=0;
for (int y=0;y<dst.length;y++)
for (int x=0;x<dst[0].length;x++)
dst[y][x]=src[idx++];
}
//src转为三维存放到dst中
public static void expand(float[] src,float[][][] dst){
int idx=0;
for (int y=0;y<dst.length;y++)
for (int x=0;x<dst[0].length;x++)
for (int c=0;c<dst[0][0].length;c++)
dst[y][x][c]=src[idx++];
}
//dst=src[:,:,1]
public static void expandProb(float[] src,float[][]dst){
int idx=0;
for (int y=0;y<dst.length;y++)
for (int x=0;x<dst[0].length;x++)
dst[y][x]=src[idx++*2+1];
}
//box转化为rect
public static Rect[] boxes2rects(Vector<Box> boxes){
int cnt=0;
for (int i=0;i<boxes.size();i++) if (!boxes.get(i).deleted) cnt++;
Rect[] r=new Rect[cnt];
int idx=0;
for (int i=0;i<boxes.size();i++)
if (!boxes.get(i).deleted)
r[idx++]=boxes.get(i).transform2Rect();
return r;
}
//删除做了delete标记的box
public static Vector<Box> updateBoxes(Vector<Box> boxes){
Vector<Box> b=new Vector<Box>();
for (int i=0;i<boxes.size();i++)
if (!boxes.get(i).deleted)
b.addElement(boxes.get(i));
return b;
}
//按照rect的大小裁剪出人脸
public static Bitmap crop(Bitmap bitmap,Rect rect){
Bitmap cropped=Bitmap.createBitmap(bitmap,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top);
return cropped;
}
//rect上下左右各扩展pixels个像素
public static void rectExtend(Bitmap bitmap,Rect rect,int pixels){
rect.left=max(0,rect.left-pixels);
rect.right=min(bitmap.getWidth()-1,rect.right+pixels);
rect.top=max(0,rect.top-pixels);
rect.bottom=min(bitmap.getHeight()-1,rect.bottom+pixels);
}
static public void showPixel(int v){
Log.i("MainActivity","[*]Pixel:R"+((v>>16)&0xff)+"G:"+((v>>8)&0xff)+ " B:"+(v&0xff));
}
static public Bitmap resize(Bitmap _bitmap,int new_width){
float scale=((float)new_width)/_bitmap.getWidth();
Matrix matrix=new Matrix();
matrix.postScale(scale,scale);
Bitmap bitmap=Bitmap.createBitmap(_bitmap,0,0,_bitmap.getWidth(),_bitmap.getHeight(),matrix,true);
return bitmap;
}
}
| [
"973731246@qq.com"
] | 973731246@qq.com |
6c1a5e318117798c1984a60df77acf51b84c98f0 | 2b2432ac5a2c6b8e3f975141e5c5fce497cdc465 | /HW08/src/model/MainModel.java | bad3316f6edd90c6227347b101205c5eb6839986 | [] | no_license | lanyangyang025/OOP | a94dfe20a74bde4c7ebcfffbef1ff9e992c68b4e | b9697f3698bdfeaadd5185e6075971b4194b9df2 | refs/heads/master | 2021-08-30T03:12:02.002721 | 2017-12-15T20:31:07 | 2017-12-15T20:31:07 | 114,409,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,869 | java | package model;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.Collection;
import java.util.function.Consumer;
import common.IChatRoom;
import common.IFailureStatusType;
import common.IUser;
import provided.rmiUtils.IRMIUtils;
import provided.rmiUtils.RMIUtils;
import view.ChatroomView;
/**
* Model for the chat application
*
*/
public class MainModel {
/**
* Adapter to the view
*/
IModel2ViewAdapter adapter;
/**
* Registry entries
*/
Registry registry;
String remoteHost;
IFailureStatusType failure;
private Consumer<String> outputCmd = (x) -> adapter.outputToTextArea(x + "\n");
private IRMIUtils rmi = new RMIUtils(outputCmd);
public MainModel(IModel2ViewAdapter adapter) {
this.adapter = adapter;
}
private IUser userStub;
private User user;
private String ip;
private int USER_BOUND_PORT = 2101;
private int SERVER_BOUND_PORT = 2000;
public void initUser(String name) {
USER_BOUND_PORT = adapter.getUserPort();
SERVER_BOUND_PORT = adapter.getServerPort();
rmi.startRMI(SERVER_BOUND_PORT);
try {
user = new User(name + "@" + rmi.getLocalAddress(), adapter);
ip = rmi.getLocalAddress();
adapter.setRemoteAdress(ip);
userStub = (IUser) UnicastRemoteObject.exportObject(user, USER_BOUND_PORT);
registry = rmi.getLocalRegistry();
registry.rebind(IUser.BOUND_NAME + name + "@" + rmi.getLocalAddress(), userStub);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public IUser getUser(String remoteHost, String name) {
try {
this.remoteHost = remoteHost;
registry = rmi.getRemoteRegistry(remoteHost);
IUser newUser = (IUser) registry.lookup(IUser.BOUND_NAME + name + "@" + remoteHost);
if (user.containUser(newUser)) {
return null;
}
userStub.connect(newUser);
newUser.connect(user);
return newUser;
} catch (RemoteException | NotBoundException e) {
e.printStackTrace();
return null;
}
}
public void createChatRoom(String s) {
ChatroomView temp_room = user.createChatRoom(s, USER_BOUND_PORT);
if (temp_room == null) {
} else {
adapter.addTab(temp_room);
}
}
public Collection<IChatRoom> getChatRoom(IUser iUser) {
// TODO Auto-generated method stub
try {
return iUser.getChatRooms();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
public void joinChatRoom(IChatRoom request_room) {
// TODO Auto-generated method stub
ChatroomView temp_room = user.joinChatRoom(request_room, USER_BOUND_PORT);
if (temp_room == null) {
} else {
adapter.addTab(temp_room);
}
}
public void leaveChatRoom(IChatRoom chatroom) {
// TODO Auto-generated method stub
user.leaveChatRoom(chatroom);
}
}
| [
"yl128@rice.edu"
] | yl128@rice.edu |
dd2c733c9e443b2cdbdaa1b8c5a5c4495b2bea61 | 78b0b911bfce1cf44f4eca6b3fd80fd33f9712e9 | /src/main/java/com/parsing/formullaDotBy/FormullaByAmino.java | 1ca89a8ef7d82dc8d61b3b2b591324dac62cb1ba | [] | no_license | Gorelko/parsingForFizcultPit | 1d63eb24811918b80f362a815428a47f8735610f | e189e43f4f9d6bdb4b53d74a35b055ddb34585bd | refs/heads/master | 2023-08-13T03:25:36.386068 | 2021-09-16T13:25:26 | 2021-09-16T13:25:26 | 407,157,935 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,437 | java | package com.parsing.formullaDotBy;
import com.parsing.csv.WriterForOut;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class FormullaByAmino {
public FormullaByAmino() throws IOException, InterruptedException {
SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//dd/MM/yyyy
Date nowTime = new Date();
String namePortal = "formulla.by";
String nameProductGroup = "Аминокислоты";
Document doc1 = null;
while (true) {
try {
String link = "https://formulla.by/nutrition/amino-acids/?limit=120";
doc1 = Jsoup.connect(link).get();
Thread.sleep(1000);
break;
}catch (Exception e){
System.out.println("Обрыв коннекта, подключаемся! Возможная причина - отсутствие интернета или сайт не работает!");
Thread.sleep(3000);
}
}
int countPage = 1;
try {
countPage = Integer.parseInt(String.valueOf(doc1.getElementsByAttributeValue("class","pagpages clearfix")).split("всего ")[1].split(" страниц")[0]);
}catch (Exception e){
}
for (int x = 1; x <= countPage; x++) {
Thread.sleep(1000);
Document doc = null;
while (true) {
try {
doc = Jsoup.connect("https://formulla.by/nutrition/amino-acids/?limit=120&page="+ x).get();
Thread.sleep(1000);
break;
}catch (Exception e){
System.out.println("Обрыв коннекта, подключаемся! Возможная причина - отсутствие интернета или сайт не работает!");
Thread.sleep(3000);
}
}
Thread.sleep(1000);
Elements product = doc.getElementsByAttributeValueStarting("class","product-thumb"); //.getElementsByAttributeValue("class","product-layout product-grid");
for (int i = 0; i < product.size(); i++) {
String nameBrand = "";
try {
String randomText = String.valueOf(product.get(i).getElementsByAttributeValue("class","dotted-line_title").get(0)).split("\">")[1].split("</span")[0].replaceAll("\n","");
if (randomText.equals("Производитель:")){
nameBrand = String.valueOf(product.get(i).getElementsByAttributeValue("class","dotted-line_right").get(0)).split("\">")[1].split("</span")[0].replaceAll("\n","");
}
}catch (Exception e) {
}
String discription = "";
try {
discription = String.valueOf(product.get(i).getElementsByAttributeValue("itemprop","name").get(0)).split("name\">")[1].split("</span")[0].replaceAll("\n","");
}catch (Exception e) {
}
String weight = "";
try {
Elements weightElements = product.get(i).getElementsByAttributeValue("class","dotted-line_title");
Elements weightElements2 = product.get(i).getElementsByAttributeValue("class","dotted-line_right");
for (int j = 0; j < weightElements.size(); j++) {
if (String.valueOf(weightElements.get(j)).split("dotted-line_title\">")[1].split("</span")[0].equals("Упаковка:")){
weight = String.valueOf(weightElements2.get(j)).split("dotted-line_right\">")[1].split("</span")[0];
}
}
}catch (Exception e) {
}
String stock = "В наличии";
try {
stock = String.valueOf(product.get(i).getElementsByAttributeValue("class","stiker_panel").get(0)).split("stiker_netu\">")[1].split("</span")[0];
}catch (Exception e) {
}
String price = "";
String priceDiscount = "";
try {
price = String.valueOf(product.get(i).getElementsByAttributeValue("itemprop","price")).split("content=\"")[1].split("\">")[0];
}catch (Exception e){
try {
price = String.valueOf(product.get(i).getElementsByAttributeValue("class","old-price")).split("old-price\">")[1].split(" руб.")[0];
priceDiscount = String.valueOf(product.get(i).getElementsByAttributeValue("class","special-price")).split("special-price\">")[1].split(" руб.")[0];
}catch (Exception n){
}
}
String image = "";
try {
image = String.valueOf(product.get(i).getElementsByAttributeValue("class","img-responsive ").get(0)).split("src=\"")[1].split("\" ")[0];
}catch (Exception e) {
}
String link = "";
try {
link = String.valueOf(product.get(i).getElementsByAttributeValue("class","image").get(0)).split("href=\"")[1].split("\">")[0];
}catch (Exception e) {
}
List<String> productList = new ArrayList<>();
productList.add(namePortal);
productList.add(nameProductGroup.replaceAll(",", "."));
productList.add(nameBrand.replaceAll(",", "."));
productList.add(discription.replaceAll(",", "."));
productList.add(weight.replaceAll(",", "."));
productList.add(stock);
productList.add(price.replaceAll(",", "."));
productList.add(priceDiscount);
productList.add(image.replaceAll(",", "."));
productList.add(link.replaceAll(",", "."));
productList.add(sdfDate.format(nowTime));
new WriterForOut().writeToFile(productList, "D:\\fizcult.csv");
}
}
}
}
| [
"gorelko90@gmail.com"
] | gorelko90@gmail.com |
cbe60b391ce35e13f9b4307887011171267308c7 | 26fce685009f7587b23dd90dc96edb69115dc756 | /src/main/java/com/turing/website/bean/RoleExample.java | 7985224ad0a2acd5881fc0dbc5d00e71fe767748 | [] | no_license | Look-Ahead8/turing_website | d0f88e18aa011db78015a372cdd7d5f8badeeb7a | 66ea79dcd2e42edbf547c2024fd3a2f3a6f18557 | refs/heads/master | 2022-07-16T12:57:33.810154 | 2019-09-12T06:55:10 | 2019-09-12T06:55:10 | 207,984,396 | 0 | 0 | null | 2022-06-21T01:51:36 | 2019-09-12T06:52:43 | Java | UTF-8 | Java | false | false | 9,501 | java | package com.turing.website.bean;
import java.util.ArrayList;
import java.util.List;
public class RoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Integer value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Integer value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Integer value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Integer value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Integer value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Integer value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Integer> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Integer> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Integer value1, Integer value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Integer value1, Integer value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleNameIsNull() {
addCriterion("role_name is null");
return (Criteria) this;
}
public Criteria andRoleNameIsNotNull() {
addCriterion("role_name is not null");
return (Criteria) this;
}
public Criteria andRoleNameEqualTo(String value) {
addCriterion("role_name =", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotEqualTo(String value) {
addCriterion("role_name <>", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameGreaterThan(String value) {
addCriterion("role_name >", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameGreaterThanOrEqualTo(String value) {
addCriterion("role_name >=", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLessThan(String value) {
addCriterion("role_name <", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLessThanOrEqualTo(String value) {
addCriterion("role_name <=", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameLike(String value) {
addCriterion("role_name like", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotLike(String value) {
addCriterion("role_name not like", value, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameIn(List<String> values) {
addCriterion("role_name in", values, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotIn(List<String> values) {
addCriterion("role_name not in", values, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameBetween(String value1, String value2) {
addCriterion("role_name between", value1, value2, "roleName");
return (Criteria) this;
}
public Criteria andRoleNameNotBetween(String value1, String value2) {
addCriterion("role_name not between", value1, value2, "roleName");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"1335189318@qq.com"
] | 1335189318@qq.com |
f36dba7f4106990777e1978dfd66f0af380faf69 | 96513bed0fb8e61ab038c4a1946f4b8641eaa448 | /sourcecode/Shreyams_Pattens/AllCards.java | a6933282af5bb7624ac090f9e37bbb05c8b9c8f5 | [] | no_license | bavudaia/202-Team-Project | 149ed5073a0b71eaa9a60a6a0a4a23be091ba5fe | 1e25c8f1655f355ae100f918e98b53456a7dfb51 | refs/heads/master | 2021-01-17T10:22:01.375831 | 2016-05-14T03:37:59 | 2016-05-14T03:37:59 | 55,469,589 | 0 | 1 | null | 2016-04-13T06:10:03 | 2016-04-05T05:16:31 | Java | UTF-8 | Java | false | false | 2,473 | java | import java.util.Map;
import java.util.HashMap;
/**
* Write a description of class AllCards here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class AllCards
{
public static Map<Integer,String> cardMap = new HashMap<>();
static {
cardMap.put(0,"ace_of_spades.png");
cardMap.put(1,"2_of_spades.png");
cardMap.put(2,"3_of_spades.png");
cardMap.put(3,"4_of_spades.png");
cardMap.put(4,"5_of_spades.png");
cardMap.put(5,"6_of_spades.png");
cardMap.put(6,"7_of_spades.png");
cardMap.put(7,"8_of_spades.png");
cardMap.put(8,"9_of_spades.png");
cardMap.put(9,"10_of_spades.png");
cardMap.put(10,"jack_of_spades.png");
cardMap.put(11,"queen_of_spades.png");
cardMap.put(12,"king_of_spades.png");
cardMap.put(13,"ace_of_clubs.png");
cardMap.put(14,"2_of_clubs.png");
cardMap.put(15,"3_of_clubs.png");
cardMap.put(16,"4_of_clubs.png");
cardMap.put(17,"5_of_clubs.png");
cardMap.put(18,"6_of_clubs.png");
cardMap.put(19,"7_of_clubs.png");
cardMap.put(20,"8_of_clubs.png");
cardMap.put(21,"9_of_clubs.png");
cardMap.put(22,"10_of_clubs.png");
cardMap.put(23,"jack_of_clubs.png");
cardMap.put(24,"queen_of_clubs.png");
cardMap.put(25,"king_of_clubs.png");
cardMap.put(26,"ace_of_diamonds.png");
cardMap.put(27,"2_of_diamonds.png");
cardMap.put(28,"3_of_diamonds.png");
cardMap.put(29,"4_of_diamonds.png");
cardMap.put(30,"5_of_diamonds.png");
cardMap.put(31,"6_of_diamonds.png");
cardMap.put(32,"7_of_diamonds.png");
cardMap.put(33,"8_of_diamonds.png");
cardMap.put(34,"9_of_diamonds.png");
cardMap.put(35,"10_of_diamonds.png");
cardMap.put(36,"jack_of_diamonds.png");
cardMap.put(37,"queen_of_diamonds.png");
cardMap.put(38,"king_of_diamonds.png");
cardMap.put(39,"ace_of_hearts.png");
cardMap.put(40,"2_of_hearts.png");
cardMap.put(41,"3_of_hearts.png");
cardMap.put(42,"4_of_hearts.png");
cardMap.put(43,"5_of_hearts.png");
cardMap.put(44,"6_of_hearts.png");
cardMap.put(45,"7_of_hearts.png");
cardMap.put(46,"8_of_hearts.png");
cardMap.put(47,"9_of_hearts.png");
cardMap.put(48,"10_of_hearts.png");
cardMap.put(49,"jack_of_hearts.png");
cardMap.put(50,"queen_of_hearts.png");
cardMap.put(51,"king_of_hearts.png");
}
public static String getCardImage(int i)
{
if(i<0 || i>51)
{
throw new IllegalArgumentException("Card Index out of bounds");
}
return (String)cardMap.get(i);
}
}
| [
"shreyams.jain@sjsu.edu"
] | shreyams.jain@sjsu.edu |
d0e486ff63aa7e9ee68041e9aff24fb1627f3ca9 | c83cd2c77fbc4b80da7b071e7258505ca7fc43b3 | /src/main/java/com/meltsan/pdfcreator/subreports/SubreportIndicadoresSin.java | 0b7233f57dcf58b3cce206d879585c43c5a2727c | [] | no_license | yairromero/PdfCreator | 51382d0f3bd3ae4490fae6ef2255ae1987b3c5cf | 2ed089d3404c0c08b58df1df8dbcbd368b6e965b | refs/heads/master | 2021-07-11T10:52:18.312453 | 2017-10-10T18:06:26 | 2017-10-10T18:06:26 | 103,680,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package com.meltsan.pdfcreator.subreports;
import static net.sf.dynamicreports.report.builder.DynamicReports.col;
import static net.sf.dynamicreports.report.builder.DynamicReports.report;
import static net.sf.dynamicreports.report.builder.DynamicReports.type;
import java.util.ArrayList;
import com.meltsan.pdfcreator.beans.values.IndicadoresSiniestroValues;
import com.meltsan.pdfcreator.util.Estilos;
import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;
import net.sf.dynamicreports.report.base.expression.AbstractSimpleExpression;
import net.sf.dynamicreports.report.definition.ReportParameters;
public class SubreportIndicadoresSin extends AbstractSimpleExpression<JasperReportBuilder> {
private static final long serialVersionUID = 1L;
@Override
public JasperReportBuilder evaluate(ReportParameters reportParameters) {
ArrayList<IndicadoresSiniestroValues> srt = reportParameters.getValue("columns");
JasperReportBuilder report = report();
report.setTemplate(Estilos.reportConditionalPorcentajeTemplate)
.addColumn(col.column("Vigencia", "vigencia", type.stringType()).setWidth(150));
for (IndicadoresSiniestroValues srp : srt) {
report.addColumn(col.column(srp.getPeriodo(), srp.getPeriodo(), type.stringType()));
}
return report;
}
}
| [
"yair.romero@meltsan.com"
] | yair.romero@meltsan.com |
71255df64cac444e43d4b3868c94b99faca01caa | 5c4a9567d4aec7fedf81ca8a5e67bd1fdfb503b0 | /src/main/java/com/jg/blog/vo/BlogVo.java | 063ab6f3aee1437c640a12e4eaacc90b2ee233f9 | [] | no_license | 13030830345/springboot-vue | ba00c3cf7ce3252f64350dbb3440cded5ff15421 | 16bc52a11cdba096c7702ae55f265f066dd836c7 | refs/heads/master | 2022-07-13T14:13:29.336561 | 2020-03-31T08:43:57 | 2020-03-31T08:43:57 | 251,265,762 | 4 | 0 | null | 2022-06-29T18:02:49 | 2020-03-30T09:58:29 | Java | UTF-8 | Java | false | false | 1,123 | java | package com.jg.blog.vo;
/**
* com.jg.blog.vo
* 76773:cl
* 2020/3/29
* blog
*/
import com.jg.blog.pojo.Type;
import lombok.Data;
import java.io.Serializable;
/**
* 展示给前端看得
* 文章分类
*/
@Data
public class BlogVo implements Serializable {
/**
* 帖子id
*/
private String blogId;
/**
* 标题
*/
private String blogTitle;
/**
* 封面
*/
private String blogImage;
/**
* 帖子内容
*/
private String blogContent;
/**
* 点赞数
*/
private Integer blogGoods;
/**
* 阅读数
*/
private Integer blogRead;
/**
* 收藏数
*/
private Integer blogCollection;
/**
* 博客分类
*/
private String typeName;
/**
* 简介
*/
private String blogRemark;
/**
* 评论数
*/
private Integer blogComment;
/**
* 文章来源(爬虫时使用)
*/
private String blogSource;
/**
* 创建时间
*/
private String createdTime;
/**
* 更新时间
*/
private String updateTime;
}
| [
"767735493@qq.com"
] | 767735493@qq.com |
83e04e80149956f47950b54e3d8911972c30eac1 | f91c611a8b4c7d9d8d3e7f7b599d8369495cf797 | /lss-pattern-decorator/src/com/lss/pattern/decorator/old/ResultMsg.java | 0aceeebefe417011f231b4a1b4b95a3439d2c786 | [] | no_license | firegoods/gupao | 0e20acf17eb83cd7bc48927a28ee0fe837570247 | 09dace5b3a9642877a58e906b3c02db8312863ed | refs/heads/master | 2020-04-11T02:52:48.152374 | 2018-06-24T07:10:32 | 2018-06-24T07:10:32 | 124,322,731 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 721 | java | package com.lss.pattern.decorator.old;
/**
* Created by liushaoshuai on 2018/3/23.
*/
public class ResultMsg {
private String code;
private String msg;
private Object data;
public ResultMsg(String code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
| [
"1337343005@qq.com"
] | 1337343005@qq.com |
1e6e1ab6b3b5f5925b875b94cc7b573295aaa7a5 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Chart/5/org/jfree/chart/StandardChartTheme_setLargeFont_372.java | e3ea6b6a81182a2170d355dc5104d034a99ca9a5 | [] | 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,184 | java |
org jfree chart
implement link chart theme chartthem
implement collect bunch chart attribut mimic
manual process appli attribut object
free chart jfreechart instanc eleg code work
standard chart theme standardchartthem chart theme chartthem cloneabl
set larg font theme
param font font code code permit
larg font getlargefont
set larg font setlargefont font font
larg font largefont font
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
3dd5bc24b96f81e511ba384a03eb9b70094cfddf | e078a1e58f535292b5cffb30cd7ca1d8434310fe | /src/ode/problema/cgd/KSolucaoDAOImpl.java | 8d4c0ba47d03ea6f1be2957feac654ea8621b1bb | [] | no_license | newbare/ode | 20b7a846bbce801147d4b3d8ef7b30792d06de59 | 9b06e6e5a0862cbebbf559ee2444838649a87f25 | refs/heads/master | 2021-01-17T22:55:00.152849 | 2015-03-04T18:50:51 | 2015-03-04T18:50:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 851 | java | package ode.problema.cgd;
import java.util.Collection;
import java.util.List;
import ode._infraestruturaCRUD.ciu.NucleoListbox;
import ode._infraestruturaBase.cgd.DAOBaseImpl;
import ode.problema.cdp.KCausa;
import ode.problema.cdp.KProblema;
import ode.problema.cdp.KSolucao;
import org.springframework.stereotype.Repository;
@Repository
public class KSolucaoDAOImpl extends DAOBaseImpl<KSolucao> implements KSolucaoDAO {
@Override
public Collection<KSolucao> recuperarSolucaoPorCausa(KCausa kcausa) {
Long idKCausa = kcausa.getId();
@SuppressWarnings("unchecked")
Collection<KSolucao> lista1 = entityManager.createQuery("from KSolucao solucao left outer join fetch solucao.KCausa as kp where kp.id=" +idKCausa+" order by solucao.nome").getResultList();
return lista1;
}
}
| [
"nicoli.ludimila@9a94fb9e-9367-8fd8-e54f-9d0b81a662fe"
] | nicoli.ludimila@9a94fb9e-9367-8fd8-e54f-9d0b81a662fe |
6c1655e1e179454e21a571b54243fefbfc2da1b0 | c334c14ca8b120670003ff23e59d2d3f22e61e07 | /platform-gen/src/main/java/com/platform/entity/ColumnEntity.java | 7063f94f1ae7fb2b557050553fd00a2abb0fe16b | [
"Apache-2.0"
] | permissive | SJshenjian/platform | 43178b1044c3aac516b26cb27dcf5d3830c662af | c5c0f72179dc7cadc569bff3e37027c91fc3c975 | refs/heads/master | 2018-11-02T20:43:48.714445 | 2018-08-25T13:53:12 | 2018-08-25T13:53:12 | 142,135,952 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,693 | java | package com.platform.entity;
/**
* 列的属性
*
* @author Jian Shen
* @email SJshenjian@outlook.com
* @date 2016年12月20日 上午12:01:45
*/
public class ColumnEntity {
//列名
private String columnName;
//列名类型
private String dataType;
//列名备注
private String comments;
//属性名称(第一个字母大写),如:user_name => UserName
private String attrName;
//属性名称(第一个字母小写),如:user_name => userName
private String attrname;
//属性类型
private String attrType;
//auto_increment
private String extra;
public String getColumnName() {
return columnName;
}
public void setColumnName(String columnName) {
this.columnName = columnName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getAttrname() {
return attrname;
}
public void setAttrname(String attrname) {
this.attrname = attrname;
}
public String getAttrName() {
return attrName;
}
public void setAttrName(String attrName) {
this.attrName = attrName;
}
public String getAttrType() {
return attrType;
}
public void setAttrType(String attrType) {
this.attrType = attrType;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
}
| [
"sjshenjian@outlook.com"
] | sjshenjian@outlook.com |
662da40e42290ea757d62196dbbe4726c20f0831 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/db1de9f67e016258671c4d1a1fe6fbee083aee9f/before/RenameMembersInplaceTest.java | db4c7ccf7c2cef9d46c6feb6bc76271f97966d36 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,854 | java | /*
* Copyright 2000-2017 JetBrains s.r.o.
*
* 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.intellij.java.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.TargetElementUtil;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateState;
import com.intellij.ide.DataManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.rename.JavaNameSuggestionProvider;
import com.intellij.refactoring.rename.inplace.MemberInplaceRenameHandler;
import com.intellij.testFramework.EditorTestUtil;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedHashSet;
import java.util.Set;
public class RenameMembersInplaceTest extends LightCodeInsightTestCase {
private static final String BASE_PATH = "/refactoring/renameInplace/";
@NotNull
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
public void testInnerClass() throws Exception {
doTestInplaceRename("NEW_NAME");
}
public void testClassWithConstructorReferenceInside() throws Exception {
doTestInplaceRename("NewName");
}
public void testIncomplete() throws Exception {
doTestInplaceRename("Klazz");
}
public void testConstructor() throws Exception {
doTestInplaceRename("Bar");
}
public void testSuperMethod() throws Exception {
doTestInplaceRename("xxx");
}
public void testSuperMethodAnonymousInheritor() throws Exception {
doTestInplaceRename("xxx");
}
public void testMultipleConstructors() throws Exception {
doTestInplaceRename("Bar");
}
public void testClassWithMultipleConstructors() throws Exception {
doTestInplaceRename("Bar");
}
public void testMethodWithJavadocRef() throws Exception {
doTestInplaceRename("bar");
}
public void testEnumConstructor() throws Exception {
doTestInplaceRename("Bar");
}
public void testMethodWithMethodRef() throws Exception {
doTestInplaceRename("bar");
}
public void testRenameFieldInIncompleteStatement() throws Exception {
doTestInplaceRename("bar");
}
public void testSameNamedMethodsInOneFile() throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
final PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.getInstance().getAllAccepted());
assertNotNull(element);
Editor editor = getEditor();
Project project = editor.getProject();
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
new MemberInplaceRenameHandler().doRename(element, editor, DataManager.getInstance().getDataContext(editor.getComponent()));
TemplateState state = TemplateManagerImpl.getTemplateState(editor);
assert state != null;
assertEquals(2, state.getSegmentsCount());
final TextRange range = state.getCurrentVariableRange();
assert range != null;
final Editor finalEditor = editor;
new WriteCommandAction.Simple(project) {
@Override
protected void run() throws Throwable {
finalEditor.getDocument().replaceString(range.getStartOffset(), range.getEndOffset(), "newDoSomething");
}
}.execute().throwException();
state = TemplateManagerImpl.getTemplateState(editor);
assert state != null;
state.gotoEnd(false);
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
public void testNameSuggestion() throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
final PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.getInstance().getAllAccepted());
assertNotNull(element);
final Set<String> result = new LinkedHashSet<>();
new JavaNameSuggestionProvider().getSuggestedNames(element, getFile(), result);
CodeInsightTestUtil.doInlineRename(new MemberInplaceRenameHandler(), result.iterator().next(), getEditor(), element);
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
public void testConflictingMethodName() throws Exception {
try {
doTestInplaceRename("bar");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
assertEquals("Method bar() is already defined in the class <b><code>Foo</code></b>", e.getMessage());
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
return;
}
fail("Conflict was not detected");
}
public void testNearParameterHint() throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
int originalCaretPosition = myEditor.getCaretModel().getOffset();
EditorTestUtil.addInlay(myEditor, originalCaretPosition);
// make sure caret is to the right of inlay initially
myEditor.getCaretModel().moveToLogicalPosition(myEditor.getCaretModel().getLogicalPosition().leanForward(true));
final PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.getInstance().getAllAccepted());
assertNotNull(element);
TemplateManagerImpl.setTemplateTesting(ourProject, getTestRootDisposable());
new MemberInplaceRenameHandler().doRename(element, myEditor, DataManager.getInstance().getDataContext(myEditor.getComponent()));
assertEquals(originalCaretPosition, myEditor.getCaretModel().getOffset());
assertTrue(myEditor.getCaretModel().getLogicalPosition().leansForward); // check caret is still to the right
}
private void doTestInplaceRename(final String newName) throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
final PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.getInstance().getAllAccepted());
assertNotNull(element);
CodeInsightTestUtil.doInlineRename(new MemberInplaceRenameHandler(), newName, getEditor(), element);
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
18f030de29583a3639bdc6f8a2833d6c0e4b2eb9 | d8e06fbcab34c81ed2ef75ce9893498627ae9a71 | /app/src/main/java/com/example/rincondelvergeles/model/Mesa.java | 2ad236aee23208f193c3207f23e5d7bdf0abd894 | [] | no_license | javiher99/ProyectoFinal | fe20d48d7501d7a72f6ba3ec4d4972fb170c50d1 | 6687005b9e041818720d11a1f6ebf157009a1135 | refs/heads/master | 2020-10-01T13:20:05.325548 | 2019-12-12T07:25:08 | 2019-12-12T07:25:08 | 227,545,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | package com.example.rincondelvergeles.model;
import android.os.Parcel;
import android.os.Parcelable;
public class Mesa implements Parcelable {
long id;
String mesa;
long ocupada;
public Mesa(long id, String mesa, long ocupada) {
this.id = id;
this.mesa = mesa;
this.ocupada = ocupada;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getMesa() {
return mesa;
}
public void setMesa(String mesa) {
this.mesa = mesa;
}
public long getOcupada() {
return ocupada;
}
public void setOcupada() {
this.ocupada = 1;
}
public void setLibre() {
this.ocupada = 0;
}
protected Mesa(Parcel in) {
id = in.readLong();
mesa = in.readString();
ocupada = in.readLong();
}
public static final Creator<Mesa> CREATOR = new Creator<Mesa>() {
@Override
public Mesa createFromParcel(Parcel in) {
return new Mesa(in);
}
@Override
public Mesa[] newArray(int size) {
return new Mesa[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
dest.writeString(mesa);
dest.writeLong(ocupada);
}
@Override
public String toString() {
return "Mesa{" +
"id=" + id +
", mesa='" + mesa + '\'' +
", ocupada=" + ocupada +
'}';
}
}
| [
"xavito99@hotmail.es"
] | xavito99@hotmail.es |
6ec9d0b40966234672212ef4785fb3944a6980c3 | 49086b79e0b691098a91f80bb2329109b4505162 | /src/main/java/com/example/springbootes/entity/es/EsVideo.java | 405e5f3833f8b7941b30032004d587e51c8afa8a | [] | no_license | skriser/sprintboot-es | 8f427cbbc95c3f9a6222a3be154b08e28a7853d0 | 23af2d4417625a803d75a93d28957be10fd4459e | refs/heads/master | 2022-12-06T02:21:02.523625 | 2020-08-20T13:12:24 | 2020-08-20T13:12:24 | 289,009,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,923 | java | package com.example.springbootes.entity.es;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
*
* Text,
* Integer,
* Long,
* Date,
* Float,
* Double,
* Boolean,
* Object,
* Auto,
* Nested,
* Ip,
* Attachment,
* Keyword;
*
*/
@Data
@Document(indexName = "test_video",type = "doc",useServerConfiguration = true,createIndex = false)
public class EsVideo {
@Id
private Integer id;
@Field(type = FieldType.Keyword)
private String title;
@Field(type = FieldType.Long)
private String author_id;
@Field(type = FieldType.Long)
private String author_type;
@Field(type = FieldType.Keyword)
private String category;
@Field(type = FieldType.Keyword)
private String sub_category;
@Field(type = FieldType.Keyword)
private List topics;
@Field(type = FieldType.Keyword)
private String festival;
@Field(type = FieldType.Long)
private String duration;
@Field(type = FieldType.Long)
private String quality_score;
@Field(type = FieldType.Float)
private Float score;
@Field(type = FieldType.Keyword)
private String country;
@Field(type = FieldType.Keyword)
private String province;
@Field(type = FieldType.Keyword)
private String city;
@Field(type = FieldType.Long)
private Long audit_at;
//@Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
@Field(type = FieldType.Long)
private Long created_at;
}
| [
"1360754033@qq.com"
] | 1360754033@qq.com |
f54dedae6144561f82a4fd3161b53bfbce40fe0b | f307f2f504f0dfca078843a0b6c67f46cd1717eb | /app/src/main/java/com/coolweather/android/gson/Now.java | 5e749970240c03f7c6120c3a87648b7315b47fa9 | [] | no_license | educode-jpg/CoolWeather | 8379f17785bfd5b5a3a2b65155279c196169f87f | 9e9170d8dbff97a68ca0972bce36cfd2c524d6ce | refs/heads/master | 2021-03-26T17:46:52.304503 | 2020-04-25T14:44:35 | 2020-04-25T14:44:35 | 247,728,175 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package com.coolweather.android.gson;
import com.google.gson.annotations.SerializedName;
public class Now {
@SerializedName("tmp")
public String temperature;
@SerializedName("cond")
public More more;
public class More{
public String info;
}
}
| [
"Csuperlemon@163.com"
] | Csuperlemon@163.com |
766a04bdef51b7ecf622daa08e18f6810554e908 | a6696a4b6d371e412c1ec7e257ef2199ac69758a | /src/it/pdm/AndroidMaps/DbManager.java | ba6dc0e8fc0692e9dc4cec978f933bd3978df9bb | [] | no_license | ninuxorg/Android-Mobile-App | 40bdd25e1979a48b9d2909c027592a62d118eeb7 | 9d9af6c8d5bc0d128c55843d5be08c3400b8d76e | refs/heads/master | 2021-01-15T21:08:22.413624 | 2012-05-24T17:37:19 | 2012-05-24T17:37:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,124 | java | package it.pdm.AndroidMaps;
import java.util.ArrayList;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.os.AsyncTask;
import android.util.Log;
class DbManager extends AsyncTask<Object,String,Object> {
private MapPoint mp; //
private ArrayList<MapPoint> map;
private DbHelper dbHelp;
private Context current;
DbManager(DbHelper helper,Context context){
this.mp=null;
this.map=null;
this.dbHelp=helper;
this.current=context;
}
//----------------GESTIONE DB ------------------------------------------//
/* setChoice(Integer doSomething)
0: getNodes();
1: getNodeByPosition(lat, lng, grade_lat, grade_lng);
2: getNodeByPosition(lat, lng);
3: getNodeByName(name);
4: insertNodes(map);
5: insertNode(mp);
6: getNodeById(id);
*/
@Override
protected Object doInBackground(Object... params) throws MapPointsException,PointException {
// TODO Auto-generated method stub
Integer lat;
Integer lng;
Integer grade_lat;
Integer grade_lng;
switch((Integer)params[0]){
case 0:
try {
ArrayList<MapPoint> m;
m = getNodes();
return m;
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
case 1:
lat=(Integer)params[1];
lng=(Integer)params[2];
grade_lat=(Integer)params[3];
grade_lng=(Integer)params[4];
try {
ArrayList<MapPoint> m;
m = getNodeByPosition(lat, lng, grade_lat, grade_lng);
return m;
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
case 2:
lat=(Integer)params[1];
lng=(Integer)params[2];
try {
return getNodeByPosition(lat, lng);
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
case 3:
String tosearch=(String)params[1];
try {
return getNodeByName(tosearch);
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
case 4:
if(map.equals(null)){
throw new MapPointsException();
}else{
try {
insertNodes(map);
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
}
break;
case 5:
if(mp.equals(null)){
throw new PointException();
}else{
try {
insertNode(mp);
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
}
break;
case 6:
try {
Integer id=(Integer)params[1];
return getNodesById(id);
} catch (DBOpenException e) {
Log.e("DB_ERROR - OPEN DATABASE",e.getMessage());
}
break;
default:
return null;
}
return null;
}
public SQLiteDatabase openDBW() throws DBOpenException{
SQLiteDatabase db;
try{
db=dbHelp.getWritableDatabase();
return db;
}catch (SQLiteException e) {
throw new DBOpenException();
}
}
public SQLiteDatabase openDBR() throws DBOpenException{
SQLiteDatabase db;
try{
db=dbHelp.getReadableDatabase();
return db;
}catch (SQLiteException e) {
throw new DBOpenException();
}
}
public void truncateTable(String table) throws DBOpenException{
SQLiteDatabase db=null;
db=openDBW();
db.execSQL("DELETE FROM "+table); //cancello il contenuto della tabella <table>
db.close();
}
public void deleteTable(String table) throws DBOpenException{
SQLiteDatabase db=null;
db=openDBW();
db.execSQL("DROP TABLE "+table); //cancello la tabella <table>
db.close();
}
public void setPoint(MapPoint point){
this.mp=point;
}
public void setListPoint(ArrayList<MapPoint> m){
this.map=m;
}
private void insertNodes(ArrayList<MapPoint> map) throws DBOpenException{
deleteNodes();
for(MapPoint point : map){
insertNode(point);
}
insertUpdate();
}
private ArrayList<MapPoint> getNodes() throws DBOpenException{
ArrayList<MapPoint> valori=new ArrayList<MapPoint>();
Cursor cursor;
SQLiteDatabase db=null;
db=openDBR();
//select * from Nodes
cursor= db.query(DbHelper.TABLE_NAME1, null, null, null, null, null, null); //ottengo un cursore che punta alle entry ottenute dalla query
cursor.moveToFirst();
do{
MapPoint node=new MapPoint();
node.setId(cursor.getInt(cursor.getColumnIndex("_id")));
node.setName(cursor.getString(cursor.getColumnIndex("name")));
node.setStatus(cursor.getString(cursor.getColumnIndex("status")));
node.setSlug(cursor.getString(cursor.getColumnIndex("slug")));
node.setLatitude(cursor.getInt(cursor.getColumnIndex("lat")));
node.setLongitude(cursor.getInt(cursor.getColumnIndex("lng")));
node.setJslug(cursor.getString(cursor.getColumnIndex("jslug")));
valori.add(node);
cursor.moveToNext();
}while(!cursor.isAfterLast());
cursor.close();
db.close();
return valori;
}
private ArrayList<MapPoint> getNodeByPosition(Integer lat, Integer lng, Integer grade_lat, Integer grade_lng) throws DBOpenException{
ArrayList<MapPoint> valori=new ArrayList<MapPoint>();
Cursor cursor;
SQLiteDatabase db=null;
Integer min_lat=lat-grade_lat;
Integer max_lat=lat+grade_lat;
Integer min_lng=lng-grade_lng;
Integer max_lng=lng+grade_lng;
db=openDBR();
//select * from Nodes where (lat between [min_lat] AND [max_lat]) and (lng between [min_lng] AND [max_lng]));
String sql="SELECT * FROM "+DbHelper.TABLE_NAME1+" WHERE (lat BETWEEN " +min_lat.toString()+ " AND "+max_lat.toString()+") " +
"AND (lng BETWEEN "+min_lng.toString()+ " AND "+max_lng.toString()+")";
cursor= db.rawQuery(sql,null); //ottengo un cursore che punta alle entry ottenute dalla query
cursor.moveToFirst();
do{
if(cursor!=null && cursor.getCount()>0){
MapPoint node=new MapPoint();
node.setId(cursor.getInt(cursor.getColumnIndex("_id")));
node.setName(cursor.getString(cursor.getColumnIndex("name")));
node.setStatus(cursor.getString(cursor.getColumnIndex("status")));
node.setSlug(cursor.getString(cursor.getColumnIndex("slug")));
node.setLatitude(cursor.getInt(cursor.getColumnIndex("lat")));
node.setLongitude(cursor.getInt(cursor.getColumnIndex("lng")));
node.setJslug(cursor.getString(cursor.getColumnIndex("jslug")));
valori.add(node);
cursor.moveToNext();
}
}while(!cursor.isAfterLast());
cursor.close();
db.close();
return valori;
}
private ArrayList<MapPoint> getNodeByPosition(Integer lat, Integer lng) throws DBOpenException{
ArrayList<MapPoint> valori=new ArrayList<MapPoint>();
Cursor cursor=null;
SQLiteDatabase db=null;
db=openDBR();
//select * from Nodes where lat=lat AND lng=lng //"SELECT * FROM Nodes WHERE (? = ?) AND (? = ?)";
String sql="(? = ?) AND (? = ?)";
String values[]=new String[]{"lat",lat.toString(),"lng",lng.toString()};
cursor= db.query(DbHelper.TABLE_NAME1, null, sql, values, null, null, null); //ottengo un cursore che punta alle entry ottenute dalla query
cursor.moveToFirst();
do{
MapPoint node=new MapPoint();
node.setId(cursor.getInt(cursor.getColumnIndex("_id")));
node.setName(cursor.getString(cursor.getColumnIndex("name")));
node.setStatus(cursor.getString(cursor.getColumnIndex("status")));
node.setSlug(cursor.getString(cursor.getColumnIndex("slug")));
node.setLatitude(cursor.getInt(cursor.getColumnIndex("lat")));
node.setLongitude(cursor.getInt(cursor.getColumnIndex("lng")));
node.setJslug(cursor.getString(cursor.getColumnIndex("jslug")));
valori.add(node);
cursor.moveToNext();
}while(!cursor.isAfterLast());
return valori;
}
private ArrayList<MapPoint> getNodeByName(String name) throws DBOpenException{
ArrayList<MapPoint> valori=new ArrayList<MapPoint>();
Cursor cursor;
SQLiteDatabase db=null;
db=openDBR();
//select * from Nodes where (lat between [min_lat] AND [max_lat]) and (lng between [min_lng] AND [max_lng]));
String sql="SELECT * FROM "+DbHelper.TABLE_NAME1+" WHERE name like '%"+name+"%'";
cursor= db.rawQuery(sql,null); //ottengo un cursore che punta alle entry ottenute dalla query
cursor.moveToFirst();
do{
if(cursor!=null && cursor.getCount()>0){
MapPoint node=new MapPoint();
node.setId(cursor.getInt(cursor.getColumnIndex("_id")));
node.setName(cursor.getString(cursor.getColumnIndex("name")));
node.setStatus(cursor.getString(cursor.getColumnIndex("status")));
node.setSlug(cursor.getString(cursor.getColumnIndex("slug")));
node.setLatitude(cursor.getInt(cursor.getColumnIndex("lat")));
node.setLongitude(cursor.getInt(cursor.getColumnIndex("lng")));
node.setJslug(cursor.getString(cursor.getColumnIndex("jslug")));
valori.add(node);
cursor.moveToNext();
}
}while(!cursor.isAfterLast());
cursor.close();
db.close();
return valori;
}
private ArrayList<MapPoint> getNodesById(Integer id) throws DBOpenException{
ArrayList<MapPoint> valori=new ArrayList<MapPoint>();
Cursor cursor;
SQLiteDatabase db=openDBR();
//String sql="SELECT * FROM "+DbHelper.TABLE_NAME1+" WHERE _id='"+id+"'";
//Log.v("Sql1", sql);
String sql="(_id = "+id+")";
String values[]=new String[]{"_id",""+id};
cursor= db.query(DbHelper.TABLE_NAME1,new String[]{"_id","name","status","lat","lng"}, sql, null, null, null, null);//ottengo un cursore che punta alle entry ottenute dalla query
Log.v("Current ID FOR DB:",""+id);
Log.v("Cursor: ",""+cursor.getCount());
cursor.moveToFirst();
do{
MapPoint node=new MapPoint();
node.setId(cursor.getInt(cursor.getColumnIndex("_id")));
node.setName(cursor.getString(cursor.getColumnIndex("name")));
node.setStatus(cursor.getString(cursor.getColumnIndex("status")));
node.setLatitude(cursor.getInt(cursor.getColumnIndex("lat")));
node.setLongitude(cursor.getInt(cursor.getColumnIndex("lng")));
valori.add(node);
cursor.moveToNext();
}while(!cursor.isAfterLast());
cursor.close();
db.close();
return valori;
}
public boolean isEmptyTableNodes() throws DBOpenException{
return isEmpty(DbHelper.TABLE_NAME1);
}
public boolean isEmptyTableUpdates() throws DBOpenException{
return isEmpty(DbHelper.TABLE_NAME2);
}
public int countRows(String tableName) throws DBOpenException{
SQLiteDatabase db;
db=openDBR();
Cursor iterator=db.rawQuery("SELECT COUNT(*) FROM "+tableName,null); //scandisco il contenuto della tabella passata in input
iterator.moveToFirst();
int count= iterator.getInt(0);
iterator.close();
db.close();
return count;
}
public boolean isEmpty(String tableName) throws DBOpenException{
int tot=countRows(tableName);
Log.v("Totale delle righe in "+tableName+" = ", ""+tot);
if(tot !=0){
return false;
}
else{
return true;
}
}
public void insertUpdate() throws DBOpenException{
SQLiteDatabase db=null;
db=openDBW();
String datetime=CalendarManager.getCurrentDateTime();
String forDatabase=CalendarManager.formatDateTimeForDatabase(datetime);
ContentValues values=new ContentValues();
values.put("number_nodes", map.size());
values.put("type", "automatic");
values.put("datetimeC",forDatabase);
db.insertOrThrow(DbHelper.TABLE_NAME2, null, values); //inserisco il messaggio nel DB
db.close();
}
public void deleteNodes() throws DBOpenException{
truncateTable(DbHelper.TABLE_NAME1);
}
private void insertNode(MapPoint mp) throws DBOpenException {
SQLiteDatabase db=null;
db=openDBW();
ContentValues values=new ContentValues();
values.put("_id", mp.getId());
values.put("name", mp.getName());
values.put("status", mp.getStatus());
values.put("slug", mp.getSlug());
values.put("lat", mp.getLatitude());
values.put("lng", mp.getLongitude());
values.put("jslug", mp.getJslug());
db.insertOrThrow(DbHelper.TABLE_NAME1, null, values); //inserisco il messaggio nel DB
db.close();
}
public String getLastUpdate() throws DBOpenException{
Cursor cursor=null;
SQLiteDatabase db=null;
if(isEmptyTableUpdates()){
return "0000/00/00 00:00:00";
}
try{
db=openDBR();
//select datetimeC from Updates order by datetimeC DESC limit 1
//ottengo un cursore che punta alle entry ottenute dalla query
cursor= db.rawQuery("SELECT datetimeC FROM "+DbHelper.TABLE_NAME2+" ORDER BY _id DESC LIMIT 1",null);
cursor.moveToFirst();
return cursor.getString(cursor.getColumnIndex("datetimeC"));
}catch(SQLException e){
Log.e("DB_ERROR - SELECT update","Impossibile trovare ultimo aggiornamento - "+e.getMessage());
}
finally{
cursor.close();
db.close();
}
return "";
}
}
| [
"komodo00155@gmail.com"
] | komodo00155@gmail.com |
fe08438f4e7a9822a9ca22bebcd9c07487ef532d | 670de7494d05791304adbcf99e1d2ccceb40fe24 | /ServiceRegistry/src/main/java/com/example/ServiceRegistry/ServiceRegistryApplication.java | 38f3a9ecaa626cd57e28f98cac7d91bfa36b6668 | [] | no_license | dragandulic/SEP19 | 415ef4cbffda927eb3a98ee52cf89ea4c5857d68 | 2137236ffd12220a617cf6bd27168a2fa8853e95 | refs/heads/master | 2020-04-13T17:07:50.574924 | 2019-02-10T06:15:58 | 2019-02-10T06:15:58 | 163,339,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.example.ServiceRegistry;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class ServiceRegistryApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceRegistryApplication.class, args);
}
}
| [
"35114903+dragandulic@users.noreply.github.com"
] | 35114903+dragandulic@users.noreply.github.com |
f87c56b9baec51367b1f1f37c07dc6f92c6f2daf | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/64/org/apache/commons/lang/text/StrSubstitutor_StrSubstitutor_241.java | 2cb1536db5c717b73e84627bb0d6162121bd2071 | [] | 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 | 3,091 | java |
org apach common lang text
substitut variabl string valu
take piec text substitut variabl
definit variabl code variabl variablenam code
prefix suffix chang constructor set method
variabl valu typic resolv map resolv
system properti suppli custom variabl resolv
simplest replac java system properti
pre
str substitutor strsubstitutor replac system properti replacesystemproperti
run java version java version
pre
typic usag pattern instanc creat
initi map valu variabl
prefix suffix variabl
set perform code replac code
method call pass sourc text interpol return
text variabl refer valu resolv
demonstr
pre
map valu map valuesmap hash map hashmap
valu map valuesmap put quot anim quot quot quick brown fox quot
valu map valuesmap put quot target quot quot lazi dog quot
string templat string templatestr quot anim jump target quot
str substitutor strsubstitutor str substitutor strsubstitutor valu map valuesmap
string resolv string resolvedstr replac templat string templatestr
pre
yield
pre
quick brown fox jump lazi dog
pre
addit usag pattern conveni method
cover common case method
manual creat instanc multipl replac oper
perform creat reus instanc effici
variabl replac work recurs variabl
variabl variabl replac cyclic replac
detect except thrown
interpolation' result variabl prefix
sourc text
pre
variabl
pre
variable' refer text replac result
text assum code code variabl code code
pre
variabl
pre
achiev effect possibl set prefix
suffix variabl conflict result text
produc possibl escap charact
charact variabl refer refer
replac
pre
variabl
pre
author oliv heger
author stephen colebourn
version
str substitutor strsubstitutor
creat instanc initi
param variabl resolv variableresolv variabl resolv
param prefix matcher prefixmatch prefix variabl
param suffix matcher suffixmatch suffix variabl
param escap escap charact
illeg argument except illegalargumentexcept prefix suffix
str substitutor strsubstitutor
str lookup strlookup variabl resolv variableresolv str matcher strmatcher prefix matcher prefixmatch str matcher strmatcher suffix matcher suffixmatch escap
set variabl resolv setvariableresolv variabl resolv variableresolv
set variabl prefix matcher setvariableprefixmatch prefix matcher prefixmatch
set variabl suffix matcher setvariablesuffixmatch suffix matcher suffixmatch
set escap char setescapechar escap
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
7dc5e75cc7055ec376df84ac6cf5688e3b7a9750 | 9050894d517a9c24f6c5f48777c66f13692e0031 | /Malmo/P1/TestProgP1x.java | 38581ade2601025de73df829deab934062b06900 | [] | no_license | h-kan/java | 76a5e67f471ec2b88b28ab6536a0a439c71f634f | 31cec9b6b9b971be078203c9548b8ec4c921db9c | refs/heads/master | 2016-08-08T02:33:37.694417 | 2009-03-16T20:29:55 | 2009-03-16T20:29:55 | 120,111 | 1 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,469 | java | /*
TestProgP1.java
Testprogram för metoderna i Programmeringsuppgift 1
Rolf Axelsson
*/
package p1;
import javax.swing.*;
public class TestProgP1x {
public void testUppX1(Prog1 prog1) {
// System.out.println("TEST AV: siffersumma");
// prog1.siffersumma(1827);
// prog1.siffersumma(2005);
// System.out.println();
}
public void testUppX2(Prog1 prog1) {
// System.out.println("TEST AV: summaN");
// prog1.summaN(20,100,210);
// prog1.summaN(7,1,100);
// prog1.summaN(7,100,1);
// System.out.println();
}
public void testUppX3(Prog1 prog1) {
// System.out.println("TEST AV: fakultet");
// prog1.fakultet(4);
// prog1.fakultet(7);
// System.out.println();
}
public void programLoop() {
Prog1 prog1 = new Prog1();
TestProgP1 tp1 = new TestProgP1();
String meny = "Välj den metod som ska anropas:\n\n" +
" 1. biljettpris\n" +
" 2. datum\n" +
" 3. udda\n" +
" 4. positivNegativ\n" +
" 5. serie7\n" +
" 6. multiplikationstabell\n" +
" 7. saldo\n" +
"-------------------------\n" +
" 8. siffersumma\n" +
" 9. summaN\n" +
" 10. fakultet\n" +
"-------------------------\n" +
" 0. Avsluta programmet\n\n" +
"Ange ditt val";
int val = Integer.parseInt( JOptionPane.showInputDialog( meny ) );
while(val!=0) {
switch(val) {
case 1 : tp1.testUppA(prog1); break;
case 2 : tp1.testUppB(prog1); break;
case 3 : tp1.testUppC(prog1); break;
case 4 : tp1.testUppD(prog1); break;
case 5 : tp1.testUppE(prog1); break;
case 6 : tp1.testUppF(prog1); break;
case 7 : tp1.testUppG(prog1); break;
case 8 : testUppX1(prog1); break;
case 9 : testUppX2(prog1); break;
case 10: testUppX3(prog1); break;
}
val = Integer.parseInt( JOptionPane.showInputDialog( meny ) );
}
}
public static void main(String[] args) {
TestProgP1x prog = new TestProgP1x();
prog.programLoop();
}
}
| [
"h-kan@h-kan.com"
] | h-kan@h-kan.com |
155ddae0d5b7e99d5d7c8d6d402bbcba18fe088e | 25b3bb3a1f1d74503c0ebd2f093f4f54d8cececc | /src/main/java/py/com/progress/scc/model/Proveedor.java | 5d106d9d9f1b8e8b83814ebad16fd91583fdba47 | [] | no_license | AviPower/scc | 4d126d7e46aedc878954e98702c85f0abd4eb6f2 | da93abbbf649397b6de72f0befff575188407456 | refs/heads/master | 2016-09-06T06:43:10.365873 | 2014-08-22T13:22:54 | 2014-08-22T13:22:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package py.com.progress.scc.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Proveedor implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "descripcion")
private String descripcion;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
}
| [
"carmenalarcon@winner.com.py"
] | carmenalarcon@winner.com.py |
51d81d1e18643f4ec6773cb0e47f73546343d33e | b5a67181afccb14a18b289b5e698bf160f4ed490 | /src/semina/mybatis/Select.java | 7826f8bd182ea38d34c82fd439401f97cb7e5ba9 | [] | no_license | yang-jihoon/sampleCodes | dd1707f4140a6a6b365345bd5330a6da4ed38849 | 2a99f0b1624976045e9bf1fe2309e773afa6c4fa | refs/heads/master | 2016-08-08T06:47:34.141196 | 2011-12-07T14:28:44 | 2011-12-07T14:28:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 260 | java | package semina.mybatis;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author need4spd, need4spd@cplanet.co.kr, 2011. 7. 9.
*
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface Select {
String query();
}
| [
"need4spd@gmail.com"
] | need4spd@gmail.com |
e389227ba1e2706eebdbf3bbb669c63f4f363219 | 00d82bed7b9ddcf83b5f1777b25422f6b778b528 | /Programmer Calculator/src/aboutPanel.java | 8cf3ae0ac1336951dac329485780f4ec972df9f8 | [] | no_license | Kion-Smith/advancedCalculator | b029d5e1739eeaeb8b1e0a1147d760940d1f5b60 | 12519c9f0263e936ac79a3b8207ba9d036fdc70a | refs/heads/master | 2021-08-23T06:45:31.059258 | 2017-12-04T00:19:26 | 2017-12-04T00:19:26 | 108,801,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
/*NAME: Kion Smith
* ID: kls160430
* CLASS: CS2336.502
*
*
* Display image in new jframe
*/
public class aboutPanel extends JPanel
{
BufferedImage image;// what holds the image
public aboutPanel()
{
//Initiate image if the file exists
try
{
//get image using the resouce folder inside this project
image = ImageIO.read(getClass().getResourceAsStream("/resources/help.png"));
}
catch (IOException e) {
e.printStackTrace();
}
}
public void paintComponent(Graphics g)
{
//use parent paint
super.paintComponents(g);
//draw image
g.drawImage(image, -5, -20, null);
}
}
| [
"kion_smith@hotmail.com"
] | kion_smith@hotmail.com |
cbf5623470d48fba88d362937e0e1838cdde7c67 | 736bcc68483c1df9cebcba483cf973e406ce60fb | /Rentable/src/Room.java | e2eac061cd00ee0a072b4df91f0c16cc80eb2c99 | [] | no_license | nntrn/dell-java | 5941b22ce2c5252f2bc64a425fbff115eaaa0ae6 | 857862aeaf6136e8a5857ecda3ce281d6f9e0460 | refs/heads/assignments | 2020-04-15T04:47:03.930762 | 2019-03-05T00:39:06 | 2019-03-05T00:39:06 | 161,844,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,009 | java | public class Room implements Rentable {
double rateMultiplier = 1;
double dailyRate = 100;
Room(double rate) {
dailyRate = rate * rateMultiplier;
}
@Override
public void setRate(double newRate) {
dailyRate = newRate * rateMultiplier;
}
@Override
public double getDailyRate() {
return dailyRate * rateMultiplier;
}
@Override
public double getPrice() {
return getDailyRate() * getDays();
}
}
class Condo extends Room implements Rentable {
// daily rates decrease for weekly bookings
static double rateMultiplier = .85;
double weeklyRate = getDailyRate() * rateMultiplier;
Condo(double rate) {
super(rate * rateMultiplier);
}
@Override
public double getDays() {
return 7;
}
}
class Tool extends Room implements Rentable {
// rates increase for hourly bookings
static double rateMultiplier = 1.5;
double hourlyRate = getDailyRate() * rateMultiplier;
Tool(double rate) {
super(rate * rateMultiplier);
}
@Override
public double getDays() {
return .042;
}
}
| [
"nntrn@me.com"
] | nntrn@me.com |
705e540e48d6dd46393e40db1f78041e4781091c | b6f58ef4f3f318e71f304859608fda17da0ea075 | /Prova2/src/model/Esportes.java | 646d2930319fd880c70e6c4de98afe6fe4ff4ffe | [] | no_license | uniceub-ltp1-201702/prova-p2-ltp1-201702-bsbsilva | 96858735bdeab85c723b8ffbe2171aabc15d6dcb | b668722b159733657284b31c2e4901c948b1937e | refs/heads/master | 2021-08-19T06:36:55.732945 | 2017-11-25T00:49:03 | 2017-11-25T00:49:03 | 111,958,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | package model;
public class Esportes {
// Atributos
private String esportes;
private String modalidade;
// Metodo ToString
@Override
public String toString() {
return "Esportes: " + esportes + " - " + "Modalidade: " + modalidade;
}
// Metodo Construtor
public Esportes(String esporte, String modalidade) {
super();
this.esportes = esportes;
this.modalidade = modalidade;
}
// gets e sets
public String getEsportes() {
return esportes;
}
public void setEsporte(String esporte) {
this.esportes = esportes;
}
public String getModalidade() {
return modalidade;
}
public void setModalidade(String modalidade) {
this.modalidade = modalidade;
}
}
| [
"RA21606013@AN0700114077504.dinfor.uniceub"
] | RA21606013@AN0700114077504.dinfor.uniceub |
7de66e0c7c8f648a20002bbaffed3cf5182d9722 | d3b9eb452f3f2cd60f7995a41ab408a0b240b611 | /src/factorial.java | 22645c6abbf03dcfa401cacb4848c53b8cd66be9 | [] | no_license | sapadoni/Java_Training | 541be3010616ebc16cf14667dc68c54f4b32bdd1 | c1d9e0b099e564f3479b4d3c764c885ac6e9674f | refs/heads/master | 2022-11-10T05:31:44.476322 | 2020-06-18T03:57:54 | 2020-06-18T03:57:54 | 272,069,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | import java.util.Scanner;
public class factorial {
public static void main(String[] args)
{
int num ;
Scanner scan = new Scanner(System.in);
System.out.println("Enter a number");
num = scan.nextInt();
System.out.println("Factorial of " + num + " is " + factorial(num));
}
static int factorial(int n)
{
int fact = 1, i;
for (i = 2; i <= n; i++)
fact *= i;
return fact;
}
}
| [
"saipadoni@gmail.com"
] | saipadoni@gmail.com |
5a82ae19b18e4ad86edbeec602b1646c6a44ae42 | acd83cad443cd1bb76ada3e0ca07acd405c9d058 | /src/main/java/com/lnsf/service/impl/ResourcesServiceImpl.java | ebc50928a4ccbe62edbe2140cf1e2b6069164e8d | [] | no_license | Andrewtao001/artsale | a9eb99f0caefe1336bda426599617009df2525dd | b10ca04385640a50fb526089f3974105fe63dcb8 | refs/heads/master | 2023-03-06T21:25:44.422585 | 2022-04-16T08:53:53 | 2022-04-16T08:53:53 | 193,368,545 | 0 | 0 | null | 2023-02-22T05:17:09 | 2019-06-23T16:04:43 | Java | UTF-8 | Java | false | false | 1,855 | java | package com.lnsf.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lnsf.dao.ResourcesMapper;
import com.lnsf.entities.Resources;
import com.lnsf.entities.ResourcesExample;
@Service
public class ResourcesServiceImpl implements com.lnsf.service.ResourcesService {
@Autowired
private ResourcesMapper resourcesMapper;
@Override
public int countByExample(ResourcesExample example) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int deleteByExample(ResourcesExample example) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int deleteByPrimaryKey(Integer rid) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int insert(Resources record) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int insertSelective(Resources record) {
// TODO Auto-generated method stub
return 0;
}
@Override
public List<Resources> selectByExample(ResourcesExample example) {
// TODO Auto-generated method stub
return null;
}
@Override
public Resources selectByPrimaryKey(Integer rid) {
// TODO Auto-generated method stub
return null;
}
@Override
public int updateByExampleSelective(Resources record, ResourcesExample example) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int updateByExample(Resources record, ResourcesExample example) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int updateByPrimaryKeySelective(Resources record) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int updateByPrimaryKey(Resources record) {
// TODO Auto-generated method stub
return 0;
}
}
| [
"1044973286@qq.com"
] | 1044973286@qq.com |
913f390dab835d55123ebce33b726157670219f8 | 9649f90f60f891b8832f679f5fc7006b0acf8a7f | /src/main/java/com/kgc/entity/Allserver.java | 3bba201e348fe967f4e1bc92f7d86a8be198e910 | [] | no_license | fan-god/spring-hibernate | 5cf8b82508d171f9c2b83ea237a44ad78dc4ad5f | 8190ed20b81d4a34da716f50d445781673c8723c | refs/heads/master | 2021-01-20T11:15:58.402426 | 2017-03-14T02:58:57 | 2017-03-14T02:58:57 | 83,946,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | java | package com.kgc.entity;
/**
* Created by 王帆 on 2017/3/6.
*/
public class Allserver {
private int sid;
private String name;
public int getSid() {
return sid;
}
public void setSid(int sid) {
this.sid = sid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Allserver allserver = (Allserver) o;
if (sid != allserver.sid) return false;
if (name != null ? !name.equals(allserver.name) : allserver.name != null) return false;
return true;
}
@Override
public int hashCode() {
int result = sid;
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
}
| [
"1129984165@qq.com"
] | 1129984165@qq.com |
00f85a5176c7b25f9561d87dc77b2dfc44a66d11 | 611e0544ff871e5df58f13a5f2898102f521ec8e | /streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/RackAwareTaskAssignor.java | 0c8f9492a3e6f862bd85eb9bb236386b15d3f265 | [
"Apache-2.0",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"W3C",
"CC0-1.0",
"GPL-1.0-or-later",
"CPL-1.0",
"GPL-2.0-or-later",
"LicenseRef-scancode-generic-export-compliance",
"LicenseRef-scancode-other-permissive",
"CC-PDDC",
"BSD-3-Clause",
"APSL-2.0",
"LicenseRef-scancode-free-... | permissive | confluentinc/kafka | 3b0830c0afd81bc84ff409fa9eff61418636d697 | cae0baef40b0d5d97af32256800492cb9d6471df | refs/heads/master | 2023-09-03T12:54:24.118935 | 2023-08-31T18:05:22 | 2023-08-31T18:05:22 | 37,555,321 | 216 | 235 | Apache-2.0 | 2023-09-14T12:05:20 | 2015-06-16T20:48:28 | Java | UTF-8 | Java | false | false | 29,350 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.streams.processor.internals.assignment;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.kafka.common.Cluster;
import org.apache.kafka.common.Node;
import org.apache.kafka.common.PartitionInfo;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.TopicPartitionInfo;
import org.apache.kafka.common.utils.Time;
import org.apache.kafka.streams.KeyValue;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.processor.TaskId;
import org.apache.kafka.streams.processor.internals.InternalTopicManager;
import org.apache.kafka.streams.processor.internals.TopologyMetadata.Subtopology;
import org.apache.kafka.streams.processor.internals.assignment.AssignorConfiguration.AssignmentConfigs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RackAwareTaskAssignor {
@FunctionalInterface
public interface MoveStandbyTaskPredicate {
boolean canMove(final ClientState source,
final ClientState destination,
final TaskId taskId,
final Map<UUID, ClientState> clientStateMap);
}
// For stateless tasks, it's ok to move them around. So we have 0 non_overlap_cost
public static final int STATELESS_TRAFFIC_COST = 1;
public static final int STATELESS_NON_OVERLAP_COST = 0;
private static final Logger log = LoggerFactory.getLogger(RackAwareTaskAssignor.class);
private static final int SOURCE_ID = -1;
// This is number is picked based on testing. Usually the optimization for standby assignment
// stops after 3 rounds
private static final int STANDBY_OPTIMIZER_MAX_ITERATION = 4;
private final Cluster fullMetadata;
private final Map<TaskId, Set<TopicPartition>> partitionsForTask;
private final Map<TaskId, Set<TopicPartition>> changelogPartitionsForTask;
private final AssignmentConfigs assignmentConfigs;
private final Map<TopicPartition, Set<String>> racksForPartition;
private final Map<UUID, String> racksForProcess;
private final InternalTopicManager internalTopicManager;
private final boolean validClientRack;
private final Time time;
private Boolean canEnable = null;
public RackAwareTaskAssignor(final Cluster fullMetadata,
final Map<TaskId, Set<TopicPartition>> partitionsForTask,
final Map<TaskId, Set<TopicPartition>> changelogPartitionsForTask,
final Map<Subtopology, Set<TaskId>> tasksForTopicGroup,
final Map<UUID, Map<String, Optional<String>>> racksForProcessConsumer,
final InternalTopicManager internalTopicManager,
final AssignmentConfigs assignmentConfigs,
final Time time) {
this.fullMetadata = fullMetadata;
this.partitionsForTask = partitionsForTask;
this.changelogPartitionsForTask = changelogPartitionsForTask;
this.internalTopicManager = internalTopicManager;
this.assignmentConfigs = assignmentConfigs;
this.racksForPartition = new HashMap<>();
this.racksForProcess = new HashMap<>();
this.time = Objects.requireNonNull(time, "Time was not specified");
validClientRack = validateClientRack(racksForProcessConsumer);
}
public boolean validClientRack() {
return validClientRack;
}
public synchronized boolean canEnableRackAwareAssignor() {
if (StreamsConfig.RACK_AWARE_ASSIGNMENT_STRATEGY_NONE.equals(assignmentConfigs.rackAwareAssignmentStrategy)) {
return false;
}
if (canEnable != null) {
return canEnable;
}
canEnable = validClientRack && validateTopicPartitionRack(false);
if (assignmentConfigs.numStandbyReplicas == 0 || !canEnable) {
return canEnable;
}
canEnable = validateTopicPartitionRack(true);
return canEnable;
}
// Visible for testing. This method also checks if all TopicPartitions exist in cluster
public boolean populateTopicsToDescribe(final Set<String> topicsToDescribe, final boolean changelog) {
if (changelog) {
// Changelog topics are not in metadata, we need to describe them
changelogPartitionsForTask.values().stream().flatMap(Collection::stream).forEach(tp -> topicsToDescribe.add(tp.topic()));
return true;
}
// Make sure rackId exist for all TopicPartitions needed
for (final Set<TopicPartition> topicPartitions : partitionsForTask.values()) {
for (final TopicPartition topicPartition : topicPartitions) {
final PartitionInfo partitionInfo = fullMetadata.partition(topicPartition);
if (partitionInfo == null) {
log.error("TopicPartition {} doesn't exist in cluster", topicPartition);
return false;
}
final Node[] replica = partitionInfo.replicas();
if (replica == null || replica.length == 0) {
topicsToDescribe.add(topicPartition.topic());
continue;
}
for (final Node node : replica) {
if (node.hasRack()) {
racksForPartition.computeIfAbsent(topicPartition, k -> new HashSet<>()).add(node.rack());
} else {
log.warn("Node {} for topic partition {} doesn't have rack", node, topicPartition);
return false;
}
}
}
}
return true;
}
private boolean validateTopicPartitionRack(final boolean changelogTopics) {
// Make sure rackId exist for all TopicPartitions needed
final Set<String> topicsToDescribe = new HashSet<>();
if (!populateTopicsToDescribe(topicsToDescribe, changelogTopics)) {
return false;
}
if (!topicsToDescribe.isEmpty()) {
log.info("Fetching PartitionInfo for topics {}", topicsToDescribe);
try {
final Map<String, List<TopicPartitionInfo>> topicPartitionInfo = internalTopicManager.getTopicPartitionInfo(topicsToDescribe);
if (topicsToDescribe.size() > topicPartitionInfo.size()) {
topicsToDescribe.removeAll(topicPartitionInfo.keySet());
log.error("Failed to describe topic for {}", topicsToDescribe);
return false;
}
for (final Map.Entry<String, List<TopicPartitionInfo>> entry : topicPartitionInfo.entrySet()) {
final List<TopicPartitionInfo> partitionInfos = entry.getValue();
for (final TopicPartitionInfo partitionInfo : partitionInfos) {
final int partition = partitionInfo.partition();
final List<Node> replicas = partitionInfo.replicas();
if (replicas == null || replicas.isEmpty()) {
log.error("No replicas found for topic partition {}: {}", entry.getKey(), partition);
return false;
}
final TopicPartition topicPartition = new TopicPartition(entry.getKey(), partition);
for (final Node node : replicas) {
if (node.hasRack()) {
racksForPartition.computeIfAbsent(topicPartition, k -> new HashSet<>()).add(node.rack());
} else {
return false;
}
}
}
}
} catch (final Exception e) {
log.error("Failed to describe topics {}", topicsToDescribe, e);
return false;
}
}
return true;
}
private boolean validateClientRack(final Map<UUID, Map<String, Optional<String>>> racksForProcessConsumer) {
if (racksForProcessConsumer == null) {
return false;
}
/*
* Check rack information is populated correctly in clients
* 1. RackId exist for all clients
* 2. Different consumerId for same process should have same rackId
*/
for (final Map.Entry<UUID, Map<String, Optional<String>>> entry : racksForProcessConsumer.entrySet()) {
final UUID processId = entry.getKey();
KeyValue<String, String> previousRackInfo = null;
for (final Map.Entry<String, Optional<String>> rackEntry : entry.getValue().entrySet()) {
if (!rackEntry.getValue().isPresent()) {
log.error(String.format("RackId doesn't exist for process %s and consumer %s",
processId, rackEntry.getKey()));
return false;
}
if (previousRackInfo == null) {
previousRackInfo = KeyValue.pair(rackEntry.getKey(), rackEntry.getValue().get());
} else if (!previousRackInfo.value.equals(rackEntry.getValue().get())) {
log.error(
String.format("Consumers %s and %s for same process %s has different rackId %s and %s. File a ticket for this bug",
previousRackInfo.key,
rackEntry.getKey(),
entry.getKey(),
previousRackInfo.value,
rackEntry.getValue().get()
)
);
return false;
}
}
if (previousRackInfo == null) {
log.error(String.format("RackId doesn't exist for process %s", processId));
return false;
}
racksForProcess.put(entry.getKey(), previousRackInfo.value);
}
return true;
}
public Map<UUID, String> racksForProcess() {
return Collections.unmodifiableMap(racksForProcess);
}
public Map<TopicPartition, Set<String>> racksForPartition() {
return Collections.unmodifiableMap(racksForPartition);
}
private int getCost(final TaskId taskId, final UUID processId, final boolean inCurrentAssignment, final int trafficCost, final int nonOverlapCost, final boolean isStandby) {
final String clientRack = racksForProcess.get(processId);
if (clientRack == null) {
throw new IllegalStateException("Client " + processId + " doesn't have rack configured. Maybe forgot to call canEnableRackAwareAssignor first");
}
final Set<TopicPartition> topicPartitions = isStandby ? changelogPartitionsForTask.get(taskId) : partitionsForTask.get(taskId);
if (topicPartitions == null || topicPartitions.isEmpty()) {
throw new IllegalStateException("Task " + taskId + " has no TopicPartitions");
}
int cost = 0;
for (final TopicPartition tp : topicPartitions) {
final Set<String> tpRacks = racksForPartition.get(tp);
if (tpRacks == null || tpRacks.isEmpty()) {
throw new IllegalStateException("TopicPartition " + tp + " has no rack information. Maybe forgot to call canEnableRackAwareAssignor first");
}
if (!tpRacks.contains(clientRack)) {
cost += trafficCost;
}
}
if (!inCurrentAssignment) {
cost += nonOverlapCost;
}
return cost;
}
private static int getSinkNodeID(final List<UUID> clientList, final List<TaskId> taskIdList) {
return clientList.size() + taskIdList.size();
}
private static int getClientNodeId(final List<TaskId> taskIdList, final int clientIndex) {
return clientIndex + taskIdList.size();
}
private static int getClientIndex(final List<TaskId> taskIdList, final int clientNodeId) {
return clientNodeId - taskIdList.size();
}
/**
* Compute the cost for the provided {@code activeTasks}. The passed in active tasks must be contained in {@code clientState}.
*/
long activeTasksCost(final SortedSet<TaskId> activeTasks,
final SortedMap<UUID, ClientState> clientStates,
final int trafficCost,
final int nonOverlapCost) {
return tasksCost(activeTasks, clientStates, trafficCost, nonOverlapCost, ClientState::hasActiveTask, false, false);
}
/**
* Compute the cost for the provided {@code standbyTasks}. The passed in standby tasks must be contained in {@code clientState}.
*/
long standByTasksCost(final SortedSet<TaskId> standbyTasks,
final SortedMap<UUID, ClientState> clientStates,
final int trafficCost,
final int nonOverlapCost) {
return tasksCost(standbyTasks, clientStates, trafficCost, nonOverlapCost, ClientState::hasStandbyTask, true, true);
}
private long tasksCost(final SortedSet<TaskId> tasks,
final SortedMap<UUID, ClientState> clientStates,
final int trafficCost,
final int nonOverlapCost,
final BiPredicate<ClientState, TaskId> hasAssignedTask,
final boolean hasReplica,
final boolean isStandby) {
if (tasks.isEmpty()) {
return 0;
}
final List<UUID> clientList = new ArrayList<>(clientStates.keySet());
final List<TaskId> taskIdList = new ArrayList<>(tasks);
final Graph<Integer> graph = constructTaskGraph(clientList, taskIdList,
clientStates, new HashMap<>(), new HashMap<>(), hasAssignedTask, trafficCost, nonOverlapCost, hasReplica, isStandby);
return graph.totalCost();
}
/**
* Optimize active task assignment for rack awareness. canEnableRackAwareAssignor must be called first.
* {@code trafficCost} and {@code nonOverlapCost} balance cross rack traffic optimization and task movement.
* If we set {@code trafficCost} to a larger number, we are more likely to compute an assignment with less
* cross rack traffic. However, tasks may be shuffled a lot across clients. If we set {@code nonOverlapCost}
* to a larger number, we are more likely to compute an assignment with similar to input assignment. However,
* cross rack traffic can be higher. In extreme case, if we set {@code nonOverlapCost} to 0 and @{code trafficCost}
* to a positive value, the computed assignment will be minimum for cross rack traffic. If we set {@code trafficCost} to 0,
* and {@code nonOverlapCost} to a positive value, the computed assignment should be the same as input
* @param activeTasks Tasks to reassign if needed. They must be assigned already in clientStates
* @param clientStates Client states
* @param trafficCost Cost of cross rack traffic for each TopicPartition
* @param nonOverlapCost Cost of assign a task to a different client
* @return Total cost after optimization
*/
public long optimizeActiveTasks(final SortedSet<TaskId> activeTasks,
final SortedMap<UUID, ClientState> clientStates,
final int trafficCost,
final int nonOverlapCost) {
if (activeTasks.isEmpty()) {
return 0;
}
log.info("Assignment before active task optimization is {}\n with cost {}", clientStates,
activeTasksCost(activeTasks, clientStates, trafficCost, nonOverlapCost));
final long startTime = time.milliseconds();
final List<UUID> clientList = new ArrayList<>(clientStates.keySet());
final List<TaskId> taskIdList = new ArrayList<>(activeTasks);
final Map<TaskId, UUID> taskClientMap = new HashMap<>();
final Map<UUID, Integer> originalAssignedTaskNumber = new HashMap<>();
final Graph<Integer> graph = constructTaskGraph(clientList, taskIdList,
clientStates, taskClientMap, originalAssignedTaskNumber, ClientState::hasActiveTask, trafficCost, nonOverlapCost, false, false);
graph.solveMinCostFlow();
final long cost = graph.totalCost();
assignTaskFromMinCostFlow(graph, clientList, taskIdList, clientStates, originalAssignedTaskNumber,
taskClientMap, ClientState::assignActive, ClientState::unassignActive, ClientState::hasActiveTask);
final long duration = time.milliseconds() - startTime;
log.info("Assignment after {} milliseconds for active task optimization is {}\n with cost {}", duration, clientStates, cost);
return cost;
}
public long optimizeStandbyTasks(final SortedMap<UUID, ClientState> clientStates,
final int trafficCost,
final int nonOverlapCost,
final MoveStandbyTaskPredicate moveStandbyTask) {
final BiFunction<ClientState, ClientState, List<TaskId>> getMovableTasks = (source, destination) -> source.standbyTasks().stream()
.filter(task -> !destination.hasAssignedTask(task))
.filter(task -> moveStandbyTask.canMove(source, destination, task, clientStates))
.sorted()
.collect(Collectors.toList());
final long startTime = time.milliseconds();
final List<UUID> clientList = new ArrayList<>(clientStates.keySet());
final SortedSet<TaskId> standbyTasks = new TreeSet<>();
clientStates.values().forEach(clientState -> standbyTasks.addAll(clientState.standbyTasks()));
log.info("Assignment before standby task optimization is {}\n with cost {}", clientStates,
standByTasksCost(standbyTasks, clientStates, trafficCost, nonOverlapCost));
boolean taskMoved = true;
int round = 0;
while (taskMoved && round < STANDBY_OPTIMIZER_MAX_ITERATION) {
taskMoved = false;
round++;
for (int i = 0; i < clientList.size(); i++) {
final ClientState clientState1 = clientStates.get(clientList.get(i));
for (int j = i + 1; j < clientList.size(); j++) {
final ClientState clientState2 = clientStates.get(clientList.get(j));
final String rack1 = racksForProcess.get(clientState1.processId());
final String rack2 = racksForProcess.get(clientState2.processId());
// Cross rack traffic can not be reduced if racks are the same
if (rack1.equals(rack2)) {
continue;
}
final List<TaskId> movable1 = getMovableTasks.apply(clientState1, clientState2);
final List<TaskId> movable2 = getMovableTasks.apply(clientState2, clientState1);
// There's no needed to optimize if one is empty because the optimization
// can only swap tasks to keep the client's load balanced
if (movable1.isEmpty() || movable2.isEmpty()) {
continue;
}
final List<TaskId> taskIdList = Stream.concat(movable1.stream(),
movable2.stream())
.sorted()
.collect(Collectors.toList());
final Map<TaskId, UUID> taskClientMap = new HashMap<>();
final List<UUID> clients = Stream.of(clientList.get(i), clientList.get(j))
.sorted().collect(
Collectors.toList());
final Map<UUID, Integer> originalAssignedTaskNumber = new HashMap<>();
final Graph<Integer> graph = constructTaskGraph(clients, taskIdList,
clientStates, taskClientMap, originalAssignedTaskNumber,
ClientState::hasStandbyTask, trafficCost, nonOverlapCost, true, true);
graph.solveMinCostFlow();
taskMoved |= assignTaskFromMinCostFlow(graph, clients, taskIdList, clientStates,
originalAssignedTaskNumber,
taskClientMap, ClientState::assignStandby, ClientState::unassignStandby,
ClientState::hasStandbyTask);
}
}
}
final long cost = standByTasksCost(standbyTasks, clientStates, trafficCost, nonOverlapCost);
final long duration = time.milliseconds() - startTime;
log.info("Assignment after {} rounds and {} milliseconds for standby task optimization is {}\n with cost {}", round, duration, clientStates, cost);
return cost;
}
private Graph<Integer> constructTaskGraph(final List<UUID> clientList,
final List<TaskId> taskIdList,
final Map<UUID, ClientState> clientStates,
final Map<TaskId, UUID> taskClientMap,
final Map<UUID, Integer> originalAssignedTaskNumber,
final BiPredicate<ClientState, TaskId> hasAssignedTask,
final int trafficCost,
final int nonOverlapCost,
final boolean hasReplica,
final boolean isStandby) {
final Graph<Integer> graph = new Graph<>();
for (final TaskId taskId : taskIdList) {
for (final Entry<UUID, ClientState> clientState : clientStates.entrySet()) {
if (hasAssignedTask.test(clientState.getValue(), taskId)) {
originalAssignedTaskNumber.merge(clientState.getKey(), 1, Integer::sum);
}
}
}
// Make task and client Node id in graph deterministic
for (int taskNodeId = 0; taskNodeId < taskIdList.size(); taskNodeId++) {
final TaskId taskId = taskIdList.get(taskNodeId);
for (int j = 0; j < clientList.size(); j++) {
final int clientNodeId = getClientNodeId(taskIdList, j);
final UUID processId = clientList.get(j);
final int flow = hasAssignedTask.test(clientStates.get(processId), taskId) ? 1 : 0;
final int cost = getCost(taskId, processId, flow == 1, trafficCost, nonOverlapCost, isStandby);
if (flow == 1) {
if (!hasReplica && taskClientMap.containsKey(taskId)) {
throw new IllegalArgumentException("Task " + taskId + " assigned to multiple clients "
+ processId + ", " + taskClientMap.get(taskId));
}
taskClientMap.put(taskId, processId);
}
graph.addEdge(taskNodeId, clientNodeId, 1, cost, flow);
}
if (!taskClientMap.containsKey(taskId)) {
throw new IllegalArgumentException("Task " + taskId + " not assigned to any client");
}
// Add edge from source to task
graph.addEdge(SOURCE_ID, taskNodeId, 1, 0, 1);
}
final int sinkId = getSinkNodeID(clientList, taskIdList);
// It's possible that some clients have 0 task assign. These clients will have 0 tasks assigned
// even though it may have higher traffic cost. This is to maintain the original assigned task count
for (int i = 0; i < clientList.size(); i++) {
final int clientNodeId = getClientNodeId(taskIdList, i);
final int capacity = originalAssignedTaskNumber.getOrDefault(clientList.get(i), 0);
// Flow equals to capacity for edges to sink
graph.addEdge(clientNodeId, sinkId, capacity, 0, capacity);
}
graph.setSourceNode(SOURCE_ID);
graph.setSinkNode(sinkId);
return graph;
}
private boolean assignTaskFromMinCostFlow(final Graph<Integer> graph,
final List<UUID> clientList,
final List<TaskId> taskIdList,
final Map<UUID, ClientState> clientStates,
final Map<UUID, Integer> originalAssignedTaskNumber,
final Map<TaskId, UUID> taskClientMap,
final BiConsumer<ClientState, TaskId> assignTask,
final BiConsumer<ClientState, TaskId> unAssignTask,
final BiPredicate<ClientState, TaskId> hasAssignedTask) {
int tasksAssigned = 0;
boolean taskMoved = false;
for (int taskNodeId = 0; taskNodeId < taskIdList.size(); taskNodeId++) {
final TaskId taskId = taskIdList.get(taskNodeId);
final Map<Integer, Graph<Integer>.Edge> edges = graph.edges(taskNodeId);
for (final Graph<Integer>.Edge edge : edges.values()) {
if (edge.flow > 0) {
tasksAssigned++;
final int clientIndex = getClientIndex(taskIdList, edge.destination);
final UUID processId = clientList.get(clientIndex);
final UUID originalProcessId = taskClientMap.get(taskId);
// Don't need to assign this task to other client
if (processId.equals(originalProcessId)) {
break;
}
unAssignTask.accept(clientStates.get(originalProcessId), taskId);
assignTask.accept(clientStates.get(processId), taskId);
taskMoved = true;
}
}
}
// Validate task assigned
if (tasksAssigned != taskIdList.size()) {
throw new IllegalStateException("Computed active task assignment number "
+ tasksAssigned + " is different size " + taskIdList.size());
}
// Validate original assigned task number matches
final Map<UUID, Integer> assignedTaskNumber = new HashMap<>();
for (final TaskId taskId : taskIdList) {
for (final Entry<UUID, ClientState> clientState : clientStates.entrySet()) {
if (hasAssignedTask.test(clientState.getValue(), taskId)) {
assignedTaskNumber.merge(clientState.getKey(), 1, Integer::sum);
}
}
}
if (originalAssignedTaskNumber.size() != assignedTaskNumber.size()) {
throw new IllegalStateException("There are " + originalAssignedTaskNumber.size() + " clients have "
+ " active tasks before assignment, but " + assignedTaskNumber.size() + " clients have"
+ " active tasks after assignment");
}
for (final Entry<UUID, Integer> originalCapacity : originalAssignedTaskNumber.entrySet()) {
final int capacity = assignedTaskNumber.getOrDefault(originalCapacity.getKey(), 0);
if (!Objects.equals(originalCapacity.getValue(), capacity)) {
throw new IllegalStateException("There are " + originalCapacity.getValue() + " tasks assigned to"
+ " client " + originalCapacity.getKey() + " before assignment, but " + capacity + " tasks "
+ " are assigned to it after assignment");
}
}
return taskMoved;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f0644fc26b4b682890a7f6aa05b1b08fc17f5c99 | e6cc14852bb171b49bc743344f6daf916b12d266 | /src/main/java/com/xjl/partten/xjl/designpattern/decoratorpattern/CarPayment.java | 065d0ab8f77365e5f048b064b336d88bf8bffb35 | [] | no_license | xiusan/xiao | 9671fc1ebd39ce845bdf83f9403a03d7d349b5f7 | 3fe8cf2c51c96f2122adb7e1c85e4898ab670b5c | refs/heads/master | 2022-11-25T19:54:10.158208 | 2020-08-29T12:28:27 | 2020-08-29T12:28:27 | 73,248,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package com.xjl.partten.xjl.designpattern.decoratorpattern;
/**
* @Auther: xiaojinlu1990@163.com
* @Date: 2020/7/16 22:27
* @Description:
*/
public class CarPayment implements Payment {
@Override
public void sellMoney() {
System.out.println("买了辆车");
}
}
| [
"xiaojinlu1990@163.com"
] | xiaojinlu1990@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.