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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d3730f2edc7930560e5f2fc44cffafe676099d60 | 39d6382ea53ee433cec3b131e0eb1fbbd3b2da23 | /final-framework-testng/tests/com/training/sanity/tests/LoginTests_RTTC039.java | a55b5da6604311d328ec3c1be45ee30472767eb1 | [] | no_license | sahabristy9593/MediumLevel_Testcases | b91189015398766c0cc63fc3581ae1763c67d919 | ad3fa90acf7dffc09481b4cb76609495e2d93e0d | refs/heads/master | 2020-04-15T16:10:55.225122 | 2019-01-09T09:19:22 | 2019-01-09T09:19:22 | 164,823,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | package com.training.sanity.tests;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.training.generics.ScreenShot;
import com.training.pom.LoginPOM;
import com.training.pom.LoginPOM_RTTC036;
import com.training.pom.LoginPOM_RTTC039;
import com.training.utility.DriverFactory;
import com.training.utility.DriverNames;
public class LoginTests_RTTC039 {
private WebDriver driver;
private String baseUrl;
private LoginPOM_RTTC039 loginPOM_RTTC039;
private static Properties properties;
private ScreenShot screenShot;
@BeforeClass
public static void setUpBeforeClass() throws IOException {
properties = new Properties();
FileInputStream inStream = new FileInputStream("./resources/others.properties");
properties.load(inStream);
}
@BeforeMethod
public void setUp() throws Exception {
driver = DriverFactory.getDriver(DriverNames.CHROME);
loginPOM_RTTC039 = new LoginPOM_RTTC039(driver);
baseUrl = properties.getProperty("http://retail.hommelle.com/admin");
screenShot = new ScreenShot(driver);
// open the browser
driver.get(baseUrl);
}
@AfterMethod
public void tearDown() throws Exception {
Thread.sleep(1000);
driver.quit();
}
@Test
public void changePassword() {
loginPOM_RTTC039.clickOncatalogIcon();
loginPOM_RTTC039.clickOnCategoriesLink();
loginPOM_RTTC039.clickOnEditIcon();
loginPOM_RTTC039.cleardata();
loginPOM_RTTC039.typeDescription();
loginPOM_RTTC039.saveChanges();
}
}
| [
"ibm@9.78.201.41"
] | ibm@9.78.201.41 |
857152568726c24ab81882279714c3e90ae53f28 | a1791bd72887d5bff7c31277c9fcc5ad71ffa765 | /src/com/attemper/emr/SkinBreakdownDialogFragment.java | 300a801f8ccea8bd54474b4109f7c024a6a788ad | [] | no_license | robertacosta/attemper-emr-android | ac191a617b154b1d51ee135ba94fe5742f02696c | 0d0a7aa699687034b205223dd962725cf4791b4b | refs/heads/master | 2021-05-03T22:35:36.005550 | 2015-03-22T15:30:28 | 2015-03-22T15:30:28 | 24,036,905 | 0 | 0 | null | 2014-09-30T04:52:03 | 2014-09-15T00:13:05 | Java | UTF-8 | Java | false | false | 4,210 | java | package com.attemper.emr;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import com.attemper.emr.assessment.Breakdown;
public class SkinBreakdownDialogFragment extends DialogFragment {
Breakdown breakdown;
final int position;
public SkinBreakdownDialogFragment() {
super();
this.position = -1;
}
public SkinBreakdownDialogFragment(Breakdown breakdown, int position) {
super();
this.breakdown = breakdown;
this.position = position;
}
/* The activity that creates an instance of this dialog fragment must
* implement this interface in order to receive event callbacks.
* Each method passes the DialogFragment in case the host needs to query it. */
public interface SkinBreakdownDialogListener {
public void onSkinBreakdownDialogPositiveClick(DialogFragment dialog, Breakdown breakdown, int position);
}
// Use this instance of the interface to deliver action events
SkinBreakdownDialogListener mListener;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Get the layout inflater
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_skin_breakdown, null);
final EditText site = (EditText) view.findViewById(R.id.txtSiteBreakdown);
final CheckBox drainage = (CheckBox) view.findViewById(R.id.chkDrainage);
final CheckBox redness = (CheckBox) view.findViewById(R.id.chkRednessBreakdown);
final CheckBox dressing = (CheckBox) view.findViewById(R.id.chkDressing);
final EditText stage = (EditText) view.findViewById(R.id.txtStage);
int addButtonText = R.string.add;
if(breakdown != null) {
site.setText(breakdown.getSite());
drainage.setChecked(breakdown.isDrainage());
redness.setChecked(breakdown.isRedness());
dressing.setChecked(breakdown.isDressing());
stage.setText(breakdown.getStage());
addButtonText = R.string.save;
}
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(view)
// Add action buttons
.setPositiveButton(addButtonText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
final Breakdown breakdown = new Breakdown(
site.getText().toString(),
drainage.isChecked(),
redness.isChecked(),
dressing.isChecked(),
stage.getText().toString()
);
// Send the positive button event back to the host activity
mListener.onSkinBreakdownDialogPositiveClick(SkinBreakdownDialogFragment.this, breakdown, position);
}
})
.setNegativeButton(R.string.cancel_title, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SkinBreakdownDialogFragment.this.getDialog().cancel();
}
});
return builder.create();
}
// Override the Fragment.onAttach() method to instantiate the NoticeDialogListener
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// Verify that the host activity implements the callback interface
try {
// Instantiate the NoticeDialogListener so we can send events to the host
mListener = (SkinBreakdownDialogListener) activity;
} catch (ClassCastException e) {
// The activity doesn't implement the interface, throw exception
throw new ClassCastException(activity.toString()
+ " must implement SkinBreakdownDialogListener");
}
}
} | [
"robert.j.acosta@gmail.com"
] | robert.j.acosta@gmail.com |
ae9966e775121cca66e2bf6a7c86478f6e7a16dc | 4099fb95bb56c0a1416478914224f5becfb654f5 | /server/src/main/java/com/huake/saas/supply/repository/SupplyDemandPhotoDao.java | cbc38078a516ed8f30ef258adb5bcac037ae0fa5 | [] | no_license | tyxing007/AppPortal | 9c43b90c7ac4bb2920c5cb830e9d43bfa3b58bc7 | 5c12486d1f2d99fceb0875608818e8dcadf7282b | refs/heads/master | 2020-12-25T09:46:56.418942 | 2015-02-12T09:13:10 | 2015-02-12T09:13:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package com.huake.saas.supply.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.huake.saas.supply.entity.SupplyDemandPhoto;
public interface SupplyDemandPhotoDao extends PagingAndSortingRepository<SupplyDemandPhoto, Long>, JpaSpecificationExecutor<SupplyDemandPhoto> {
public List<SupplyDemandPhoto> findBySupplyDemandIdAndImgType(Long id,String imgType);
}
| [
"wujiajun@my.com"
] | wujiajun@my.com |
7c37811e14f05bd71f4d0bfcc06fb814d0b11a9e | cd101970a0c991e244a3d73a9adc4542737a2626 | /src/main/java/com/wjx/jdk8/lesson14/MethodReferenceTest2.java | 19b4254b163aded38c857bb5f3e1836291aa5202 | [] | no_license | fengchuidaoguxiang/myjdk8 | ea484a395e6148a7c20ac5b9a20af3bdf4e8eab3 | 52cf9caa4aedd98c0da1fe0e756325ec094eb316 | refs/heads/master | 2020-06-24T21:27:43.310172 | 2019-11-18T12:13:38 | 2019-11-18T12:13:38 | 199,096,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | package com.wjx.jdk8.lesson14;
import com.wjx.jdk8.lesson13.MethodReferenceTest;
import com.wjx.jdk8.lesson13.Student;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.function.Supplier;
public class MethodReferenceTest2 {
public String getString(Supplier<String> supplier){
return supplier.get() + "test";
}
public String getString2(String str, Function<String, String> function){
return function.apply(str);
}
public static void main(String[] args) {
Student2 student1 = new Student2("zhangsan", 10);
Student2 student2 = new Student2("lisi", 90);
Student2 student3 = new Student2("wangmazi", 50);
Student2 student4 = new Student2("zhaoliu", 40);
List<Student2> students2 = Arrays.asList(student1,student2,student3,student4);
// students2.sort(Student2::compareByScore);
// students2.forEach(student -> System.out.println(student.getScore()));
// students2.sort(Student2::compareByName);
// students2.forEach(student -> System.out.println(student.getName()));
// List<String> cities = Arrays.asList("qingdao","chongqing","tianjin","beijing");
//// Collections.sort(cities,(city1,city2) -> city1.compareToIgnoreCase(city2));
//// cities.forEach(System.out::println);
// Collections.sort(cities,String::compareToIgnoreCase);
// cities.forEach(System.out::println);
MethodReferenceTest2 methodReferenceTest2 = new MethodReferenceTest2();
System.out.println(methodReferenceTest2.getString(String::new));
System.out.println(methodReferenceTest2.getString2("hello",String::new));
}
}
| [
"15049420781@163.com"
] | 15049420781@163.com |
458af640fb3c0787ba4ae11f4259c6aa2c9e5882 | b349571ef6689888e77145a484fd4272cd094589 | /src/main/java/queryanswering/QALabel.java | d4713ec14ae25c124e9d74429ac089ba00e8c5ee | [] | no_license | renxiangnan/kbqa.techno-proto | 88db988f5220f68a39bdacf7da829837d4c669a4 | 9543cc470d90fafee3a2a85052f46b7e5a2976c9 | refs/heads/master | 2020-07-10T12:14:34.644622 | 2019-08-25T07:20:09 | 2019-08-25T07:20:09 | 204,260,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package queryanswering;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public interface QALabel {
String PERSON = "Person";
String NATURAL_PERSON = "NaturalPerson";
String LOCATION = "Location";
String PLACE = "Place";
String ORGANISATION = "Organisation";
String ORGANIZATION = "Organization";
String WHO = "who";
String WHERE = "where";
String WHEN = "when";
String WHICH = "which";
String WHAT = "what";
}
| [
"xiangnanren@xiangnans-MacBook-Pro.local"
] | xiangnanren@xiangnans-MacBook-Pro.local |
5f36c2a57e47ccf82706a3237ce8e86ac1dd4a11 | 0ff19f4342f59c7f1b8bf3a45202d0e31efc84b4 | /src/main/java/edu/zju/corejava/v2ch06/tableCellRender/PlanetTableModel.java | 751520a557718c0e79c2c01e5f1f47ab60eeb392 | [] | no_license | coder-chenzhi/core-java | ef9dd7f41157ad161c74826fb000bdacb14b5473 | 230e43a932ea16fc3fb03cc4c75cbbabff642bae | refs/heads/master | 2021-06-20T08:54:11.622461 | 2017-07-11T11:51:03 | 2017-07-11T11:51:03 | 96,885,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,314 | java | package edu.zju.corejava.v2ch06.tableCellRender;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
/**
* The planet table model specifies the values, rendering and editing properties for the planet
* data.
*/
public class PlanetTableModel extends AbstractTableModel
{
public static final int PLANET_COLUMN = 0;
public static final int MOONS_COLUMN = 2;
public static final int GASEOUS_COLUMN = 3;
public static final int COLOR_COLUMN = 4;
private Object[][] cells = {
{ "Mercury", 2440.0, 0, false, Color.YELLOW,
new ImageIcon(getClass().getResource("Mercury.gif")) },
{ "Venus", 6052.0, 0, false, Color.YELLOW,
new ImageIcon(getClass().getResource("Venus.gif")) },
{ "Earth", 6378.0, 1, false, Color.BLUE,
new ImageIcon(getClass().getResource("Earth.gif")) },
{ "Mars", 3397.0, 2, false, Color.RED,
new ImageIcon(getClass().getResource("Mars.gif")) },
{ "Jupiter", 71492.0, 16, true, Color.ORANGE,
new ImageIcon(getClass().getResource("Jupiter.gif")) },
{ "Saturn", 60268.0, 18, true, Color.ORANGE,
new ImageIcon(getClass().getResource("Saturn.gif")) },
{ "Uranus", 25559.0, 17, true, Color.BLUE,
new ImageIcon(getClass().getResource("Uranus.gif")) },
{ "Neptune", 24766.0, 8, true, Color.BLUE,
new ImageIcon(getClass().getResource("Neptune.gif")) },
{ "Pluto", 1137.0, 1, false, Color.BLACK,
new ImageIcon(getClass().getResource("Pluto.gif")) } };
private String[] columnNames = { "Planet", "Radius", "Moons", "Gaseous", "Color", "Image" };
public String getColumnName(int c)
{
return columnNames[c];
}
public Class<?> getColumnClass(int c)
{
return cells[0][c].getClass();
}
public int getColumnCount()
{
return cells[0].length;
}
public int getRowCount()
{
return cells.length;
}
public Object getValueAt(int r, int c)
{
return cells[r][c];
}
public void setValueAt(Object obj, int r, int c)
{
cells[r][c] = obj;
}
public boolean isCellEditable(int r, int c)
{
return c == PLANET_COLUMN || c == MOONS_COLUMN || c == GASEOUS_COLUMN || c == COLOR_COLUMN;
}
} | [
"coder.chenzhi@gmail.com"
] | coder.chenzhi@gmail.com |
ae1cce631ef3f3570e103a8ec1fb17aed50904a8 | d305b3808d7001acfc52ba26287e401cea6ca58c | /app/src/main/java/com/filip/androidgames/framework/Music.java | 9077c68a399c6e5f5b17db8bc5cbd3794844c47c | [] | no_license | codexstudio/shooting-stars | 1adbf2e8b6cafd71e254d8d376f512cff00da6df | 557025276eb73a32b524e8022561ed29d0b0e11f | refs/heads/master | 2021-09-04T12:07:24.332268 | 2018-01-16T21:20:49 | 2018-01-16T21:20:49 | 106,869,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.filip.androidgames.framework;
public interface Music
{
void play();
void stop();
void pause();
void setLooping(boolean looping);
void setVolume(float volume);
boolean isPlaying();
boolean isStopped();
boolean isLooping();
void dispose();
}
| [
"zhao.terryy@gmail.com"
] | zhao.terryy@gmail.com |
7e045ba483cb5dae66f78e9c53b288f111567e94 | 914f0553d44ed68bfe5d6932e171a1f843414ef9 | /src/com/JUC2/day01/Demo1.java | 9cee3810b3864139f68780dcbeb455aafd07f753 | [] | no_license | xbwjml/Java_Test | 17de457b509b2afb9c7ce397ff8f7d8fc788f726 | 78b0d9082193d0227118b47702c49fa1e8b28411 | refs/heads/master | 2020-12-21T17:34:48.672614 | 2020-10-03T15:15:34 | 2020-10-03T15:15:34 | 236,505,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package com.JUC2.day01;
class ShareData {
private int num = 0;
public synchronized void incr() throws InterruptedException {
// 判断
if (num != 0) {
this.wait();
}
// 干活
num++;
System.out.println(Thread.currentThread().getName() + " \t :" + num);
// 通知
this.notifyAll();
}
public synchronized void decr() throws InterruptedException {
// 判断
if (num == 0 ) {
this.wait();
}
// 干活
num--;
System.out.println(Thread.currentThread().getName() + " \t :" + num);
// 通知
this.notifyAll();
}
}
public class Demo1 {
public static void main(String[] args) {
ShareData shareData = new ShareData();
new Thread( ()->{
for( int i=0; i<9; i++ ) {
try {
shareData.incr();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
},"AA" ).start();
new Thread( ()->{
for( int i=0; i<9; i++ ) {
try {
shareData.decr();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
},"BB" ).start();
}
}
| [
"Leeminjie1995@126.com"
] | Leeminjie1995@126.com |
6a70a6ee2cb124692667038365814da1a02d8b8b | 3b87942c439e1bb55227a0b0b55e25c2b00a2cc9 | /app/src/main/java/com/demotxt/myapp/myapplication/activities/GroupAddClass.java | c0dbc91373fccba7ebd774ae5415cf66ff93cbc3 | [] | no_license | Kuldeep28/TestCovde34-master | 7c0993c451e44625f14e35a41be8f80c6c087b5a | c15af08ea1c827dcf4c206315d5ef50f2cb4eb15 | refs/heads/master | 2020-05-16T09:16:38.838970 | 2019-04-23T06:26:55 | 2019-04-23T06:26:55 | 182,940,671 | 0 | 1 | null | 2019-04-23T06:26:56 | 2019-04-23T05:37:24 | Java | UTF-8 | Java | false | false | 449 | java | package com.demotxt.myapp.myapplication.activities;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import com.demotxt.myapp.myapplication.R;
public class GroupAddClass extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.addingroup);
}
}
| [
"kuldeep.parashar2817@gmail.com"
] | kuldeep.parashar2817@gmail.com |
dacd7fa520aa5e31d62c6aee087d4056d9192cbd | fba2092bf9c8df1fb6c053792c4932b6de017ceb | /wms/WEB-INF/src/jp/co/daifuku/wms/base/dbhandler/AccessNgShelfFinder.java | 7dcd574c4b349513b16af924bc9386e5d495cd07 | [] | no_license | FlashChenZhi/exercise | 419c55c40b2a353e098ce5695377158bd98975d3 | 51c5f76928e79a4b3e1f0d68fae66ba584681900 | refs/heads/master | 2020-04-04T03:23:44.912803 | 2018-11-01T12:36:21 | 2018-11-01T12:36:21 | 155,712,318 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,649 | java | // $Id: AccessNgShelfFinder.java 4122 2009-04-10 10:58:38Z ota $
// $LastChangedRevision: 4122 $
package jp.co.daifuku.wms.base.dbhandler;
/*
* Copyright 2000-2007 DAIFUKU Co.,Ltd. All Rights Reserved.
*
* This software is the proprietary information of DAIFUKU Co.,Ltd.
* Use is subject to license terms.
*/
import java.sql.Connection;
import jp.co.daifuku.wms.base.entity.AccessNgShelf;
import jp.co.daifuku.wms.handler.AbstractEntity;
import jp.co.daifuku.wms.handler.db.AbstractDBFinder;
/**
* データベースからAccessNgShelf表を検索してResultSetからEntity配列を
* 取得するためのクラスです。<br>
* 画面に検索結果を一覧表示する場合このクラスを使用します。
*
* @version $Revision: 4122 $, $Date: 2009-04-10 19:58:38 +0900 (金, 10 4 2009) $
* @author shimizu
* @author Last commit: $Author: ota $
*/
public class AccessNgShelfFinder
extends AbstractDBFinder
{
//------------------------------------------------------------
// class variables (prefix '$')
//------------------------------------------------------------
// private String $classVar ;
//------------------------------------------------------------
// fields (upper case only)
//------------------------------------------------------------
//------------------------------------------------------------
// instance variables (Prefix '_')
//------------------------------------------------------------
// private String _instanceVar ;
//------------------------------------------------------------
// constructors
//------------------------------------------------------------
/**
* データベースコネクションを指定してインスタンスを生成します。
* @param conn 接続済みのデータベースコネクション
*/
public AccessNgShelfFinder(Connection conn)
{
super(conn, AccessNgShelf.$storeMetaData) ;
}
//------------------------------------------------------------
// public methods
// use {@inheritDoc} in the comment, If the method is overridden.
//------------------------------------------------------------
//------------------------------------------------------------
// accessor methods
// use {@inheritDoc} in the comment, If the method is overridden.
//------------------------------------------------------------
//------------------------------------------------------------
// package methods
// use {@inheritDoc} in the comment, If the method is overridden.
//------------------------------------------------------------
//------------------------------------------------------------
// protected methods
// use {@inheritDoc} in the comment, If the method is overridden.
//------------------------------------------------------------
/**
* @see AbstractDBFinder#createEntity()
*/
@Override
protected AbstractEntity createEntity()
{
return (new AccessNgShelf()) ;
}
//------------------------------------------------------------
// private methods
//------------------------------------------------------------
//------------------------------------------------------------
// utility methods
//------------------------------------------------------------
/**
* このクラスのバージョンを返します。
* @return バージョンと日付
*/
public static String getVersion()
{
return ("$Revision: 4122 $,$Date: 2009-04-10 19:58:38 +0900 (金, 10 4 2009) $") ;
}
}
| [
"zhangming@worgsoft.com"
] | zhangming@worgsoft.com |
8af1c5ae323a0a5084ad2ddf3daac506e5d414a5 | 63d764b6acfb5073692fa1547e3c464548934e6c | /src/main/java/br/com/sistema/biblioteca/grupo2/modelo/entidade/Livro.java | 510ba035aaeb91ead04af1a74c9743370f6eaaba | [] | no_license | paroshe/sistema-biblioteca | f141b2cb9d45ff1f6a3f91dd3b3d4101b3e9f8fd | 928accec7eb10eac20509083332aa67bb8665f27 | refs/heads/master | 2023-06-12T03:04:13.051940 | 2021-07-24T02:35:32 | 2021-07-24T02:35:32 | 384,744,316 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,496 | java | package br.com.sistema.biblioteca.grupo2.modelo.entidade;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.Entity;
import javax.persistence.GenerationType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.ManyToMany;
import java.util.List;
@Entity
public class Livro {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private float valor;
private String titulo;
private String autor;
private String isbn;
@ManyToOne
private Categoria categoria;
public Categoria getCategoria() {
return categoria;
}
public void setCategoria(Categoria categoria) {
this.categoria = categoria;
}
@ManyToMany
@JsonIgnore
List<Editora> editoras;
public List<Editora> getEditoras() {
return editoras;
}
public void setEditoras(List<Editora> editoras) {
this.editoras = editoras;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public float getValor() {
return valor;
}
public void setValor(float valor) {
this.valor = valor;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
}
| [
"prshelena@restinga.ifrs.edu.br"
] | prshelena@restinga.ifrs.edu.br |
c653ff1d288c485cd7144a7c56504e4a0177fbc8 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i12035.java | d35e386b661844a99c82bddf15ede66a192868e5 | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i12035 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
c7a1d20320e1306f12933f507c0a0944e4cb47c0 | e67fb6cdaf97d4f26f74d8aba635d8d88d333386 | /src/com/android/camera/CameraHardwareException.java | f3323cd16da04b400acccd3b979fc6abbe36476e | [] | no_license | Victor556/Camera2 | b629c50a3c4a9f25874cbd94c4c7751a04afb1fa | 6f0ff18cd508027397d555b0da9fcb50a54eda8d | refs/heads/master | 2021-01-15T17:29:05.184727 | 2017-08-09T02:24:55 | 2017-08-09T02:24:55 | 99,755,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | /*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.camera;
/**
* This class represents the condition that we cannot open the camera hardware
* successfully. For example, another process is using the camera.
*/
public class CameraHardwareException extends Exception {
public CameraHardwareException(Throwable t) {
super(t);
}
}
| [
"liuheqianvictor@gmail.com"
] | liuheqianvictor@gmail.com |
504cbe7806e81c0a7b1b4987caff1a5386a55f8b | a551a7f9bf4c36c6ca01451b6d0fcf456b47f44f | /src/test/java/com/previsaotempo/app/service/ClimaCidadeServiceTest.java | e5c0a73eff0b29f9ccbd2314f68645728a0fbd50 | [] | no_license | Buzachero/previsao-tempo-app | eecd2220a82dfccc55399cb4d088a7bf22f62212 | f894bfd6c339576b49669bc817dabbd3c661fef3 | refs/heads/master | 2022-12-01T17:47:49.627135 | 2020-07-18T19:14:29 | 2020-07-18T19:14:29 | 214,870,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package com.previsaotempo.app.service;
public class ClimaCidadeServiceTest {
}
| [
"henrique_buzachero@hotmail.com"
] | henrique_buzachero@hotmail.com |
921e9885699ad9f4e2ce95a191824e638404dc1a | 69af23ae60fd9294483bd703a7720abc3682c98a | /common/src/main/java/com/instagram/common/json/annotation/JsonType.java | 6694de6db52dc882f58b014e7ec66d423c52748a | [
"BSD-3-Clause"
] | permissive | gaowen/ig-json-parser | 7726b1cf1c67f0bc4b2e5472d843d3908f8228f6 | 5aaefb034c6615eaf16ed8d0fdf5c68673d25923 | refs/heads/master | 2021-01-17T10:22:59.766953 | 2014-09-26T20:23:51 | 2014-09-26T20:23:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | // Copyright 2004-present Facebook. All Rights Reserved.
package com.instagram.common.json.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
/**
* This annotation is applied to any class for which a json parser should be automatically
* generated.
*/
@Retention(CLASS) @Target(TYPE)
public @interface JsonType {
public static final String POSTPROCESSING_METHOD_NAME = "postprocess";
/**
* This annotation specifies that a method with the name specified by
* {@link #POSTPROCESSING_METHOD_NAME} (currently "postprocess") on the class that is being
* generated that should be called once parsing is finished.
*/
boolean postprocessingEnabled() default false;
}
| [
"tonytung@merly.org"
] | tonytung@merly.org |
b49970cd68df1c3740068d66996fcc869f77e4c0 | 4efa22be0215436d285bb44007d6d936d9250f40 | /chapter_001/src/test/java/ru/job4j/condition/PointTest.java | 15c1782e3b0c91189b9654e8ac68ff5b3913ec84 | [
"Apache-2.0"
] | permissive | sergeykosenok/job4j | 671cf91d1a9ae1c78adc86f07c5b0cd3019a7312 | 58c5bf91f1560e5c4abb09befcec1be2f7dd303b | refs/heads/master | 2021-07-04T06:20:08.475384 | 2019-05-26T15:48:25 | 2019-05-26T15:48:25 | 182,383,087 | 0 | 0 | Apache-2.0 | 2020-10-13T13:03:43 | 2019-04-20T08:52:47 | Java | UTF-8 | Java | false | false | 345 | java | package ru.job4j.condition;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
public class PointTest {
@Test
public void whenZeroAndTenThenTen() {
Point point = new Point();
double result = point.distance(0, 0, 0, 10);
assertThat(result, is(10D));
}
} | [
"sergeykosenok@gmail.com"
] | sergeykosenok@gmail.com |
380b340a557b28cd8ef387d6b00fd52342691257 | 23ee2eb51283ec28e2f8e1917a1419e3c12882da | /ssm/.svn/pristine/a2/a203b6c00d922d63d8ea8ff650fcc016a0eb90e4.svn-base | 379e8c453d7dadd618337900cff15d175f9c3150 | [] | no_license | hz656765117/testredis | feb2467df7ffdbcb84d50ca0c1166ee403806b6b | eb9f9358b2ef20ef42a893d2ecdd0e3ece0b0e23 | refs/heads/master | 2021-01-02T08:19:47.101177 | 2017-01-11T01:47:31 | 2017-01-11T01:47:31 | 78,590,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,593 | package com.hz.business.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import com.google.gson.Gson;
import com.hz.base.Constants;
import com.hz.business.base.model.BaseModel;
import com.hz.business.base.pojo.Group;
import com.hz.business.base.pojo.GroupExample;
import com.hz.business.controller.BaseController;
import com.hz.business.service.DaoManager;
import com.hz.business.service.GroupService;
import com.hz.business.service.SignService;
import com.hz.business.service.UserService;
import com.hz.business.service.VerifyService;
/**
* 创建小组api
* @author HZBOX
* @since 2016-09-27
*/
@Controller
@RequestMapping("/sys")
public class LoginController extends BaseController {
@Resource UserService userService;
@Resource DaoManager manager;
@Resource VerifyService verifyService;
@Resource SignService signService;
@Resource GroupService groupService;
@RequestMapping("/doLogin")
public String doLogin(HttpServletRequest request ,HttpServletResponse response,@ModelAttribute("baseModel") BaseModel baseModel,Model model) throws IOException{
return "index";
}
}
| [
"656765117@qq.com"
] | 656765117@qq.com | |
875dd58458e16f8a77c5a1735a6f2aaba2eb0296 | 98772582999018d9bffa0fb6df113a4da4a278ba | /src/fr/resaLogement/beans/Disponibilite.java | 8e93f9bd3b1e37d15376df40a445d9ce14763c1e | [] | no_license | Didier4487/ProjetResaLogement | 9c5624512f480595caa16f568c40c5471ba48692 | 025d08de22c92ef5379bb55a041dfcfd4b424ba8 | refs/heads/master | 2021-01-23T00:24:46.998127 | 2017-04-11T19:05:20 | 2017-04-11T19:05:20 | 85,725,521 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package fr.resaLogement.beans;
public class Disponibilite {
private int idDisponibilite;
private String dateDispo;
private String disponibilite;
private String logement_idLogement;
private Adresse adresse;
private Proprietaire proprietaire;
private Logement logement;
public Logement getLogement() {
return logement;
}
public void setLogement(Logement logement) {
this.logement = logement;
}
public Adresse getAdresse() {
return adresse;
}
public void setAdresse(Adresse adresse) {
this.adresse = adresse;
}
public Proprietaire getProprietaire() {
return proprietaire;
}
public void setProprietaire(Proprietaire proprietaire) {
this.proprietaire = proprietaire;
}
public int getIdDisponibilite() {
return idDisponibilite;
}
public void setIdDisponibilite(int idDisponibilite) {
this.idDisponibilite = idDisponibilite;
}
public String getDateDispo() {
return dateDispo;
}
public void setDateDispo(String dateDispo) {
this.dateDispo = dateDispo;
}
public String getDisponibilite() {
return disponibilite;
}
public void setDisponibilite(String disponibilite) {
this.disponibilite = disponibilite;
}
public String getLogement_idLogement() {
return logement_idLogement;
}
public void setLogement_idLogement(String logement_idLogement) {
this.logement_idLogement = logement_idLogement;
}
}
| [
"Didier4487"
] | Didier4487 |
11eb2e2fb6ed18d6244d3cfc32b548ccf009c5d8 | 78348f3d385a2d1eddcf3d7bfee7eaf1259d3c6e | /examples/uml/fr.inria.diverse.puzzle.uml.interactions.metamodel/src/Interactions/Fragments/impl/FragmentsFactoryImpl.java | 0413846f12746da062721320a2eeb2298b2c0853 | [] | no_license | damenac/puzzle | 6ac0a2fba6eb531ccfa7bec3a5ecabf6abb5795e | f74b23fd14ed5d6024667bf5fbcfe0418dc696fa | refs/heads/master | 2021-06-14T21:23:05.874869 | 2017-03-27T10:24:31 | 2017-03-27T10:24:31 | 40,361,967 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,958 | java | /**
*/
package Interactions.Fragments.impl;
import Interactions.Fragments.*;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class FragmentsFactoryImpl extends EFactoryImpl implements FragmentsFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static FragmentsFactory init() {
try {
FragmentsFactory theFragmentsFactory = (FragmentsFactory)EPackage.Registry.INSTANCE.getEFactory(FragmentsPackage.eNS_URI);
if (theFragmentsFactory != null) {
return theFragmentsFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new FragmentsFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FragmentsFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case FragmentsPackage.INTERACTION_OPERAND: return createInteractionOperand();
case FragmentsPackage.COMBINED_FRAGMENT: return createCombinedFragment();
case FragmentsPackage.CONSIDER_IGNORE_FRAGMENT: return createConsiderIgnoreFragment();
case FragmentsPackage.CONTINUATION: return createContinuation();
case FragmentsPackage.INTERACTION_CONSTRAINT: return createInteractionConstraint();
case FragmentsPackage.GATE: return createGate();
case FragmentsPackage.INTERACTION_USE: return createInteractionUse();
case FragmentsPackage.PART_DECOMPOSITION: return createPartDecomposition();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object createFromString(EDataType eDataType, String initialValue) {
switch (eDataType.getClassifierID()) {
case FragmentsPackage.INTERACTION_OPERAND_KIND:
return createInteractionOperandKindFromString(eDataType, initialValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String convertToString(EDataType eDataType, Object instanceValue) {
switch (eDataType.getClassifierID()) {
case FragmentsPackage.INTERACTION_OPERAND_KIND:
return convertInteractionOperandKindToString(eDataType, instanceValue);
default:
throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InteractionOperand createInteractionOperand() {
InteractionOperandImpl interactionOperand = new InteractionOperandImpl();
return interactionOperand;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CombinedFragment createCombinedFragment() {
CombinedFragmentImpl combinedFragment = new CombinedFragmentImpl();
return combinedFragment;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ConsiderIgnoreFragment createConsiderIgnoreFragment() {
ConsiderIgnoreFragmentImpl considerIgnoreFragment = new ConsiderIgnoreFragmentImpl();
return considerIgnoreFragment;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Continuation createContinuation() {
ContinuationImpl continuation = new ContinuationImpl();
return continuation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InteractionConstraint createInteractionConstraint() {
InteractionConstraintImpl interactionConstraint = new InteractionConstraintImpl();
return interactionConstraint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Gate createGate() {
GateImpl gate = new GateImpl();
return gate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InteractionUse createInteractionUse() {
InteractionUseImpl interactionUse = new InteractionUseImpl();
return interactionUse;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PartDecomposition createPartDecomposition() {
PartDecompositionImpl partDecomposition = new PartDecompositionImpl();
return partDecomposition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InteractionOperandKind createInteractionOperandKindFromString(EDataType eDataType, String initialValue) {
InteractionOperandKind result = InteractionOperandKind.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String convertInteractionOperandKindToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FragmentsPackage getFragmentsPackage() {
return (FragmentsPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static FragmentsPackage getPackage() {
return FragmentsPackage.eINSTANCE;
}
} //FragmentsFactoryImpl
| [
"damenac@gmail.com"
] | damenac@gmail.com |
a5106e3ed76535373b97c5bb6d351394a35a069a | 342b228cb0bd5ac167c11db7cde3574b8e4d3d01 | /chess/src/Piece/Piece.java | 996bf81d86d20dbec45111566f1a056bfd0e3158 | [] | no_license | rk-rk1/chess | d79de4b30e3d09dd24f6bf10b61f0a8bd30f9e15 | 046005c2db4ee8902eff202cff3743eed18f2036 | refs/heads/main | 2023-02-15T22:22:46.075912 | 2021-01-12T11:06:51 | 2021-01-12T11:06:51 | 306,452,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package Piece;
public class Piece {
private final boolean iswhite;
private boolean ispiece, ismoved=false;
private String representation;
public boolean getIswhite(){ return iswhite; }
public boolean getIspiece(){
return ispiece;
}
public boolean getIsmoved(){ return ismoved; }
public String getRepresentation(){return representation;}
//change the methods to protected, so a piece can not be created?
public void setIspiece(boolean ispiece){ this.ispiece = ispiece; }
public void setIsmoved(){ // there is no way to revert back so it just a one time change
this.ismoved = true;
}
protected void setRepresentation(String repesantation){
this.representation =repesantation;
}
//constructors
protected Piece(boolean iswhite, boolean ispiece){
this.iswhite = iswhite;
setIspiece(ispiece);
}
protected Piece(){
this(false, false);
}
protected Piece(Piece copy){
this(copy.getIswhite(), copy.getIspiece());
}
public Point[] moves(){return null;}
}
| [
"noreply@github.com"
] | noreply@github.com |
c17076d63d123009f52b68a352f0833e8bbd09b1 | 26da0aea2ab0a2266bbee962d94a96d98a770e5f | /redhat/jee-migration-example/jee-migration-example-service/src/test/java/redhat/jee_migration_example/incoming/logEvent/LogEventListenerForJMSUnitTest.java | 97d8dd67f0f709d6f3f6812f62a7a93cbde85f2c | [
"Apache-2.0"
] | permissive | tfisher1226/ARIES | 1de2bc076cf83488703cf18f7e3f6e3c5ef1b40b | 814e3a4b4b48396bcd6d082e78f6519679ccaa01 | refs/heads/master | 2021-01-10T02:28:07.807313 | 2015-12-10T20:30:00 | 2015-12-10T20:30:00 | 44,076,313 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,109 | java | package redhat.jee_migration_example.incoming.logEvent;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.aries.tx.AbstractListenerForJMSUnitTest;
import org.aries.util.FieldUtil;
import org.aries.validate.util.CheckpointManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import redhat.jee_migration_example.Event;
import redhat.jee_migration_example.EventLoggerContext;
import redhat.jee_migration_example.util.JeeMigrationExampleFixture;
@RunWith(MockitoJUnitRunner.class)
public class LogEventListenerForJMSUnitTest extends AbstractListenerForJMSUnitTest {
private LogEventListenerForJMS fixture;
private LogEventHandler mockLogEventHandler;
private EventLoggerContext mockEventLoggerContext;
@Override
public String getServiceId() {
return LogEvent.ID;
}
@Override
public String getDomain() {
return "redhat";
}
@Override
public String getModule() {
return "jee-migration-example-service";
}
public EventLoggerContext getMockServiceContext() {
return mockEventLoggerContext;
}
@Before
public void setUp() throws Exception {
mockEventLoggerContext = new EventLoggerContext();
mockLogEventHandler = mock(LogEventHandler.class);
CheckpointManager.setJAXBSessionCache(getJAXBSessionCache());
CheckpointManager.addConfiguration("jee-migration-example-service-checks.xml");
super.setUp();
}
@After
public void tearDown() throws Exception {
mockEventLoggerContext = null;
mockLogEventHandler = null;
fixture = null;
super.tearDown();
}
protected LogEventListenerForJMS createFixture() throws Exception {
fixture = new LogEventListenerForJMS();
FieldUtil.setFieldValue(fixture, "eventLoggerContext", mockEventLoggerContext);
FieldUtil.setFieldValue(fixture, "logEventHandler", mockLogEventHandler);
initialize(fixture);
return fixture;
}
@Test
public void testExecute_logEvent_success() throws Exception {
Event event = JeeMigrationExampleFixture.create_Event();
runTestExecute_logEvent(event);
}
@Test
public void testExecute_logEvent_nullEvent() throws Exception {
setupForExpectedAssertionFailure("Event");
isExpectedValidationError = true;
runTestExecute_logEvent(null);
}
@Test
public void testExecute_logEvent_emptyEvent() throws Exception {
setupForExpectedAssertionFailure("Event");
Event event = JeeMigrationExampleFixture.createEmpty_Event();
isExpectedValidationError = true;
runTestExecute_logEvent(event);
}
@Test
public void testExecute_logEvent_nullEventDate() throws Exception {
setupForExpectedAssertionFailure("Event/date");
Event event = JeeMigrationExampleFixture.create_Event();
event.setDate(null);
isExpectedValidationError = true;
runTestExecute_logEvent(event);
}
@Test
public void testExecute_logEvent_nullEventMessage() throws Exception {
setupForExpectedAssertionFailure("Event/message");
Event event = JeeMigrationExampleFixture.create_Event();
event.setMessage(null);
isExpectedValidationError = true;
runTestExecute_logEvent(event);
}
@Test
public void testExecute_logEvent_emptyEventMessage() throws Exception {
setupForExpectedAssertionFailure("Event/message");
Event event = JeeMigrationExampleFixture.create_Event();
event.setMessage("");
isExpectedValidationError = true;
runTestExecute_logEvent(event);
}
public void runTestExecute_logEvent(Event event) throws Exception {
setupBeforeInvocation(event);
try {
fixture = createFixture();
fixture.onMessage(mockMessage);
validateAfterInvocation(event);
} catch (Throwable e) {
validateAfterException(e);
} finally {
validateAfterExecution();
}
}
public void setupBeforeInvocation(Event event) throws Exception {
when(mockMessage.getObject()).thenReturn(event);
}
public void validateAfterInvocation(Event event) throws Exception {
if (!isExpectedValidationError)
verify(mockLogEventHandler).logEvent(event);
}
}
| [
"tfisher@kattare.com"
] | tfisher@kattare.com |
f6b241ef7cd98865cd931c1dfb14bf7259d26a09 | 7a5501c38a82603c2b4e045d651ff5dad03bc196 | /app/src/main/java/com/tianyue/tv/Adapter/PrivateChatAdapter.java | 8d117c55412dc241cbe8f156f0419e4c1a9a2467 | [] | no_license | EvanEvil/tianyueTV | 30d89649616e70d8989d77f8d6ea6a968dec9073 | 93f6c7aa056b68303aeec128dff3da8320a880a0 | refs/heads/master | 2021-01-13T15:47:06.403347 | 2017-01-10T08:25:55 | 2017-01-10T08:25:55 | 76,843,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.tianyue.tv.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.tianyue.tv.R;
/**
* Created by hasee on 2016/8/15.
*/
public class PrivateChatAdapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
public PrivateChatAdapter(Context context){
this.context = context;
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return 10;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = inflater.inflate(R.layout.private_chat_item,null);
return convertView;
}
}
| [
"loabc24@163.com"
] | loabc24@163.com |
219f37353ace705ce9f2a7ecb56358ccc305733a | 0cf6c2bbdf7596eee96450a24d9eba698d946691 | /autofinanzierung-app-client/src/de/randomerror/autofinanzierung/Main.java | 54e489953d2f346d793fd82c06e23904e6d6f30b | [] | no_license | hesch/fh-componentware | 2ee1a5709a78da46fee80b60d02d798f42810087 | e8806ee55330a63894230edcd60eb34339d6bcc3 | refs/heads/master | 2021-08-23T11:35:41.984746 | 2017-12-04T18:34:07 | 2017-12-04T18:34:07 | 111,204,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | package de.randomerror.autofinanzierung;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World from Main");
}
}
| [
"henri@reschmi.de"
] | henri@reschmi.de |
546bba50eefb008db6ab4e9aed9945253cc13304 | a12488f895d792100f2f35f5ca07848751d7afae | /third_party/upb/third_party/protobuf/java/core/src/main/java/com/google/protobuf/TextFormat.java | 79962e08110db38c70417526e561e93efc7c35e1 | [
"BSD-3-Clause",
"LicenseRef-scancode-protobuf",
"Apache-2.0"
] | permissive | MajorityAttack/gRPC-1.18.0 | 9317d05eb95e746ac3b3df5c913218d9612f6dae | ee9e7f65f12639760943357f99331271d5d4b75e | refs/heads/master | 2022-11-07T06:41:11.944740 | 2019-02-13T08:40:41 | 2019-02-13T08:40:41 | 167,365,376 | 0 | 1 | Apache-2.0 | 2022-09-29T16:48:35 | 2019-01-24T12:38:21 | C++ | UTF-8 | Java | false | false | 75,488 | java | // Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.protobuf;
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.EnumDescriptor;
import com.google.protobuf.Descriptors.EnumValueDescriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Provide text parsing and formatting support for proto2 instances.
* The implementation largely follows google/protobuf/text_format.cc.
*
* @author wenboz@google.com Wenbo Zhu
* @author kenton@google.com Kenton Varda
*/
public final class TextFormat {
private TextFormat() {}
private static final Logger logger = Logger.getLogger(TextFormat.class.getName());
/**
* Outputs a textual representation of the Protocol Message supplied into
* the parameter output. (This representation is the new version of the
* classic "ProtocolPrinter" output from the original Protocol Buffer system)
*/
public static void print(
final MessageOrBuilder message, final Appendable output)
throws IOException {
Printer.DEFAULT.print(message, multiLineOutput(output));
}
/** Outputs a textual representation of {@code fields} to {@code output}. */
public static void print(final UnknownFieldSet fields,
final Appendable output)
throws IOException {
Printer.DEFAULT.printUnknownFields(fields, multiLineOutput(output));
}
/**
* Same as {@code print()}, except that non-ASCII characters are not
* escaped.
*/
public static void printUnicode(
final MessageOrBuilder message, final Appendable output)
throws IOException {
Printer.UNICODE.print(message, multiLineOutput(output));
}
/**
* Same as {@code print()}, except that non-ASCII characters are not
* escaped.
*/
public static void printUnicode(final UnknownFieldSet fields,
final Appendable output)
throws IOException {
Printer.UNICODE.printUnknownFields(fields, multiLineOutput(output));
}
/**
* Generates a human readable form of this message, useful for debugging and
* other purposes, with no newline characters.
*/
public static String shortDebugString(final MessageOrBuilder message) {
try {
final StringBuilder text = new StringBuilder();
Printer.DEFAULT.print(message, singleLineOutput(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Generates a human readable form of the field, useful for debugging
* and other purposes, with no newline characters.
*/
public static String shortDebugString(final FieldDescriptor field,
final Object value) {
try {
final StringBuilder text = new StringBuilder();
Printer.DEFAULT.printField(field, value, singleLineOutput(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Generates a human readable form of the unknown fields, useful for debugging
* and other purposes, with no newline characters.
*/
public static String shortDebugString(final UnknownFieldSet fields) {
try {
final StringBuilder text = new StringBuilder();
Printer.DEFAULT.printUnknownFields(fields, singleLineOutput(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Like {@code print()}, but writes directly to a {@code String} and
* returns it.
*/
public static String printToString(final MessageOrBuilder message) {
try {
final StringBuilder text = new StringBuilder();
print(message, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Like {@code print()}, but writes directly to a {@code String} and
* returns it.
*/
public static String printToString(final UnknownFieldSet fields) {
try {
final StringBuilder text = new StringBuilder();
print(fields, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Same as {@code printToString()}, except that non-ASCII characters
* in string type fields are not escaped in backslash+octals.
*/
public static String printToUnicodeString(final MessageOrBuilder message) {
try {
final StringBuilder text = new StringBuilder();
Printer.UNICODE.print(message, multiLineOutput(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Same as {@code printToString()}, except that non-ASCII characters
* in string type fields are not escaped in backslash+octals.
*/
public static String printToUnicodeString(final UnknownFieldSet fields) {
try {
final StringBuilder text = new StringBuilder();
Printer.UNICODE.printUnknownFields(fields, multiLineOutput(text));
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
public static void printField(final FieldDescriptor field,
final Object value,
final Appendable output)
throws IOException {
Printer.DEFAULT.printField(field, value, multiLineOutput(output));
}
public static String printFieldToString(final FieldDescriptor field,
final Object value) {
try {
final StringBuilder text = new StringBuilder();
printField(field, value, text);
return text.toString();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
/**
* Outputs a unicode textual representation of the value of given field value.
*
* <p>Same as {@code printFieldValue()}, except that non-ASCII characters in string type fields
* are not escaped in backslash+octals.
*
* @param field the descriptor of the field
* @param value the value of the field
* @param output the output to which to append the formatted value
* @throws ClassCastException if the value is not appropriate for the given field descriptor
* @throws IOException if there is an exception writing to the output
*/
public static void printUnicodeFieldValue(
final FieldDescriptor field, final Object value, final Appendable output) throws IOException {
Printer.UNICODE.printFieldValue(field, value, multiLineOutput(output));
}
/**
* Outputs a textual representation of the value of given field value.
*
* @param field the descriptor of the field
* @param value the value of the field
* @param output the output to which to append the formatted value
* @throws ClassCastException if the value is not appropriate for the
* given field descriptor
* @throws IOException if there is an exception writing to the output
*/
public static void printFieldValue(final FieldDescriptor field,
final Object value,
final Appendable output)
throws IOException {
Printer.DEFAULT.printFieldValue(field, value, multiLineOutput(output));
}
/**
* Outputs a textual representation of the value of an unknown field.
*
* @param tag the field's tag number
* @param value the value of the field
* @param output the output to which to append the formatted value
* @throws ClassCastException if the value is not appropriate for the
* given field descriptor
* @throws IOException if there is an exception writing to the output
*/
public static void printUnknownFieldValue(final int tag,
final Object value,
final Appendable output)
throws IOException {
printUnknownFieldValue(tag, value, multiLineOutput(output));
}
private static void printUnknownFieldValue(final int tag,
final Object value,
final TextGenerator generator)
throws IOException {
switch (WireFormat.getTagWireType(tag)) {
case WireFormat.WIRETYPE_VARINT:
generator.print(unsignedToString((Long) value));
break;
case WireFormat.WIRETYPE_FIXED32:
generator.print(
String.format((Locale) null, "0x%08x", (Integer) value));
break;
case WireFormat.WIRETYPE_FIXED64:
generator.print(String.format((Locale) null, "0x%016x", (Long) value));
break;
case WireFormat.WIRETYPE_LENGTH_DELIMITED:
try {
// Try to parse and print the field as an embedded message
UnknownFieldSet message = UnknownFieldSet.parseFrom((ByteString) value);
generator.print("{");
generator.eol();
generator.indent();
Printer.DEFAULT.printUnknownFields(message, generator);
generator.outdent();
generator.print("}");
} catch (InvalidProtocolBufferException e) {
// If not parseable as a message, print as a String
generator.print("\"");
generator.print(escapeBytes((ByteString) value));
generator.print("\"");
}
break;
case WireFormat.WIRETYPE_START_GROUP:
Printer.DEFAULT.printUnknownFields((UnknownFieldSet) value, generator);
break;
default:
throw new IllegalArgumentException("Bad tag: " + tag);
}
}
/** Helper class for converting protobufs to text. */
private static final class Printer {
// Printer instance which escapes non-ASCII characters.
static final Printer DEFAULT = new Printer(true);
// Printer instance which emits Unicode (it still escapes newlines and quotes in strings).
static final Printer UNICODE = new Printer(false);
/** Whether to escape non ASCII characters with backslash and octal. */
private final boolean escapeNonAscii;
private Printer(boolean escapeNonAscii) {
this.escapeNonAscii = escapeNonAscii;
}
private void print(
final MessageOrBuilder message, final TextGenerator generator)
throws IOException {
for (Map.Entry<FieldDescriptor, Object> field
: message.getAllFields().entrySet()) {
printField(field.getKey(), field.getValue(), generator);
}
printUnknownFields(message.getUnknownFields(), generator);
}
private void printField(final FieldDescriptor field, final Object value,
final TextGenerator generator) throws IOException {
if (field.isRepeated()) {
// Repeated field. Print each element.
for (Object element : (List<?>) value) {
printSingleField(field, element, generator);
}
} else {
printSingleField(field, value, generator);
}
}
private void printSingleField(final FieldDescriptor field,
final Object value,
final TextGenerator generator)
throws IOException {
if (field.isExtension()) {
generator.print("[");
// We special-case MessageSet elements for compatibility with proto1.
if (field.getContainingType().getOptions().getMessageSetWireFormat()
&& (field.getType() == FieldDescriptor.Type.MESSAGE)
&& (field.isOptional())
// object equality
&& (field.getExtensionScope() == field.getMessageType())) {
generator.print(field.getMessageType().getFullName());
} else {
generator.print(field.getFullName());
}
generator.print("]");
} else {
if (field.getType() == FieldDescriptor.Type.GROUP) {
// Groups must be serialized with their original capitalization.
generator.print(field.getMessageType().getName());
} else {
generator.print(field.getName());
}
}
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
generator.print(" {");
generator.eol();
generator.indent();
} else {
generator.print(": ");
}
printFieldValue(field, value, generator);
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
generator.outdent();
generator.print("}");
}
generator.eol();
}
private void printFieldValue(final FieldDescriptor field,
final Object value,
final TextGenerator generator)
throws IOException {
switch (field.getType()) {
case INT32:
case SINT32:
case SFIXED32:
generator.print(((Integer) value).toString());
break;
case INT64:
case SINT64:
case SFIXED64:
generator.print(((Long) value).toString());
break;
case BOOL:
generator.print(((Boolean) value).toString());
break;
case FLOAT:
generator.print(((Float) value).toString());
break;
case DOUBLE:
generator.print(((Double) value).toString());
break;
case UINT32:
case FIXED32:
generator.print(unsignedToString((Integer) value));
break;
case UINT64:
case FIXED64:
generator.print(unsignedToString((Long) value));
break;
case STRING:
generator.print("\"");
generator.print(escapeNonAscii
? TextFormatEscaper.escapeText((String) value)
: escapeDoubleQuotesAndBackslashes((String) value)
.replace("\n", "\\n"));
generator.print("\"");
break;
case BYTES:
generator.print("\"");
if (value instanceof ByteString) {
generator.print(escapeBytes((ByteString) value));
} else {
generator.print(escapeBytes((byte[]) value));
}
generator.print("\"");
break;
case ENUM:
generator.print(((EnumValueDescriptor) value).getName());
break;
case MESSAGE:
case GROUP:
print((Message) value, generator);
break;
}
}
private void printUnknownFields(final UnknownFieldSet unknownFields,
final TextGenerator generator)
throws IOException {
for (Map.Entry<Integer, UnknownFieldSet.Field> entry :
unknownFields.asMap().entrySet()) {
final int number = entry.getKey();
final UnknownFieldSet.Field field = entry.getValue();
printUnknownField(number, WireFormat.WIRETYPE_VARINT,
field.getVarintList(), generator);
printUnknownField(number, WireFormat.WIRETYPE_FIXED32,
field.getFixed32List(), generator);
printUnknownField(number, WireFormat.WIRETYPE_FIXED64,
field.getFixed64List(), generator);
printUnknownField(number, WireFormat.WIRETYPE_LENGTH_DELIMITED,
field.getLengthDelimitedList(), generator);
for (final UnknownFieldSet value : field.getGroupList()) {
generator.print(entry.getKey().toString());
generator.print(" {");
generator.eol();
generator.indent();
printUnknownFields(value, generator);
generator.outdent();
generator.print("}");
generator.eol();
}
}
}
private void printUnknownField(final int number,
final int wireType,
final List<?> values,
final TextGenerator generator)
throws IOException {
for (final Object value : values) {
generator.print(String.valueOf(number));
generator.print(": ");
printUnknownFieldValue(wireType, value, generator);
generator.eol();
}
}
}
/** Convert an unsigned 32-bit integer to a string. */
public static String unsignedToString(final int value) {
if (value >= 0) {
return Integer.toString(value);
} else {
return Long.toString(value & 0x00000000FFFFFFFFL);
}
}
/** Convert an unsigned 64-bit integer to a string. */
public static String unsignedToString(final long value) {
if (value >= 0) {
return Long.toString(value);
} else {
// Pull off the most-significant bit so that BigInteger doesn't think
// the number is negative, then set it again using setBit().
return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL)
.setBit(63).toString();
}
}
private static TextGenerator multiLineOutput(Appendable output) {
return new TextGenerator(output, false);
}
private static TextGenerator singleLineOutput(Appendable output) {
return new TextGenerator(output, true);
}
/**
* An inner class for writing text to the output stream.
*/
private static final class TextGenerator {
private final Appendable output;
private final StringBuilder indent = new StringBuilder();
private final boolean singleLineMode;
// While technically we are "at the start of a line" at the very beginning of the output, all
// we would do in response to this is emit the (zero length) indentation, so it has no effect.
// Setting it false here does however suppress an unwanted leading space in single-line mode.
private boolean atStartOfLine = false;
private TextGenerator(final Appendable output, boolean singleLineMode) {
this.output = output;
this.singleLineMode = singleLineMode;
}
/**
* Indent text by two spaces. After calling Indent(), two spaces will be
* inserted at the beginning of each line of text. Indent() may be called
* multiple times to produce deeper indents.
*/
public void indent() {
indent.append(" ");
}
/**
* Reduces the current indent level by two spaces, or crashes if the indent
* level is zero.
*/
public void outdent() {
final int length = indent.length();
if (length == 0) {
throw new IllegalArgumentException(
" Outdent() without matching Indent().");
}
indent.setLength(length - 2);
}
/**
* Print text to the output stream. Bare newlines are never expected to be passed to this
* method; to indicate the end of a line, call "eol()".
*/
public void print(final CharSequence text) throws IOException {
if (atStartOfLine) {
atStartOfLine = false;
output.append(singleLineMode ? " " : indent);
}
output.append(text);
}
/**
* Signifies reaching the "end of the current line" in the output. In single-line mode, this
* does not result in a newline being emitted, but ensures that a separating space is written
* before the next output.
*/
public void eol() throws IOException {
if (!singleLineMode) {
output.append("\n");
}
atStartOfLine = true;
}
}
// =================================================================
// Parsing
/**
* Represents a stream of tokens parsed from a {@code String}.
*
* <p>The Java standard library provides many classes that you might think
* would be useful for implementing this, but aren't. For example:
*
* <ul>
* <li>{@code java.io.StreamTokenizer}: This almost does what we want -- or,
* at least, something that would get us close to what we want -- except
* for one fatal flaw: It automatically un-escapes strings using Java
* escape sequences, which do not include all the escape sequences we
* need to support (e.g. '\x').
* <li>{@code java.util.Scanner}: This seems like a great way at least to
* parse regular expressions out of a stream (so we wouldn't have to load
* the entire input into a single string before parsing). Sadly,
* {@code Scanner} requires that tokens be delimited with some delimiter.
* Thus, although the text "foo:" should parse to two tokens ("foo" and
* ":"), {@code Scanner} would recognize it only as a single token.
* Furthermore, {@code Scanner} provides no way to inspect the contents
* of delimiters, making it impossible to keep track of line and column
* numbers.
* </ul>
*
* <p>Luckily, Java's regular expression support does manage to be useful to
* us. (Barely: We need {@code Matcher.usePattern()}, which is new in
* Java 1.5.) So, we can use that, at least. Unfortunately, this implies
* that we need to have the entire input in one contiguous string.
*/
private static final class Tokenizer {
private final CharSequence text;
private final Matcher matcher;
private String currentToken;
// The character index within this.text at which the current token begins.
private int pos = 0;
// The line and column numbers of the current token.
private int line = 0;
private int column = 0;
// The line and column numbers of the previous token (allows throwing
// errors *after* consuming).
private int previousLine = 0;
private int previousColumn = 0;
// We use possessive quantifiers (*+ and ++) because otherwise the Java
// regex matcher has stack overflows on large inputs.
private static final Pattern WHITESPACE =
Pattern.compile("(\\s|(#.*$))++", Pattern.MULTILINE);
private static final Pattern TOKEN = Pattern.compile(
"[a-zA-Z_][0-9a-zA-Z_+-]*+|" + // an identifier
"[.]?[0-9+-][0-9a-zA-Z_.+-]*+|" + // a number
"\"([^\"\n\\\\]|\\\\.)*+(\"|\\\\?$)|" + // a double-quoted string
"\'([^\'\n\\\\]|\\\\.)*+(\'|\\\\?$)", // a single-quoted string
Pattern.MULTILINE);
private static final Pattern DOUBLE_INFINITY = Pattern.compile(
"-?inf(inity)?",
Pattern.CASE_INSENSITIVE);
private static final Pattern FLOAT_INFINITY = Pattern.compile(
"-?inf(inity)?f?",
Pattern.CASE_INSENSITIVE);
private static final Pattern FLOAT_NAN = Pattern.compile(
"nanf?",
Pattern.CASE_INSENSITIVE);
/** Construct a tokenizer that parses tokens from the given text. */
private Tokenizer(final CharSequence text) {
this.text = text;
this.matcher = WHITESPACE.matcher(text);
skipWhitespace();
nextToken();
}
int getPreviousLine() {
return previousLine;
}
int getPreviousColumn() {
return previousColumn;
}
int getLine() {
return line;
}
int getColumn() {
return column;
}
/** Are we at the end of the input? */
public boolean atEnd() {
return currentToken.length() == 0;
}
/** Advance to the next token. */
public void nextToken() {
previousLine = line;
previousColumn = column;
// Advance the line counter to the current position.
while (pos < matcher.regionStart()) {
if (text.charAt(pos) == '\n') {
++line;
column = 0;
} else {
++column;
}
++pos;
}
// Match the next token.
if (matcher.regionStart() == matcher.regionEnd()) {
// EOF
currentToken = "";
} else {
matcher.usePattern(TOKEN);
if (matcher.lookingAt()) {
currentToken = matcher.group();
matcher.region(matcher.end(), matcher.regionEnd());
} else {
// Take one character.
currentToken = String.valueOf(text.charAt(pos));
matcher.region(pos + 1, matcher.regionEnd());
}
skipWhitespace();
}
}
/**
* Skip over any whitespace so that the matcher region starts at the next
* token.
*/
private void skipWhitespace() {
matcher.usePattern(WHITESPACE);
if (matcher.lookingAt()) {
matcher.region(matcher.end(), matcher.regionEnd());
}
}
/**
* If the next token exactly matches {@code token}, consume it and return
* {@code true}. Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsume(final String token) {
if (currentToken.equals(token)) {
nextToken();
return true;
} else {
return false;
}
}
/**
* If the next token exactly matches {@code token}, consume it. Otherwise,
* throw a {@link ParseException}.
*/
public void consume(final String token) throws ParseException {
if (!tryConsume(token)) {
throw parseException("Expected \"" + token + "\".");
}
}
/**
* Returns {@code true} if the next token is an integer, but does
* not consume it.
*/
public boolean lookingAtInteger() {
if (currentToken.length() == 0) {
return false;
}
final char c = currentToken.charAt(0);
return ('0' <= c && c <= '9')
|| c == '-' || c == '+';
}
/**
* Returns {@code true} if the current token's text is equal to that
* specified.
*/
public boolean lookingAt(String text) {
return currentToken.equals(text);
}
/**
* If the next token is an identifier, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public String consumeIdentifier() throws ParseException {
for (int i = 0; i < currentToken.length(); i++) {
final char c = currentToken.charAt(i);
if (('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
|| ('0' <= c && c <= '9')
|| (c == '_') || (c == '.')) {
// OK
} else {
throw parseException(
"Expected identifier. Found '" + currentToken + "'");
}
}
final String result = currentToken;
nextToken();
return result;
}
/**
* If the next token is an identifier, consume it and return {@code true}.
* Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsumeIdentifier() {
try {
consumeIdentifier();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a 32-bit signed integer, consume it and return its
* value. Otherwise, throw a {@link ParseException}.
*/
public int consumeInt32() throws ParseException {
try {
final int result = parseInt32(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 32-bit unsigned integer, consume it and return its
* value. Otherwise, throw a {@link ParseException}.
*/
public int consumeUInt32() throws ParseException {
try {
final int result = parseUInt32(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 64-bit signed integer, consume it and return its
* value. Otherwise, throw a {@link ParseException}.
*/
public long consumeInt64() throws ParseException {
try {
final long result = parseInt64(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 64-bit signed integer, consume it and return
* {@code true}. Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsumeInt64() {
try {
consumeInt64();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a 64-bit unsigned integer, consume it and return its
* value. Otherwise, throw a {@link ParseException}.
*/
public long consumeUInt64() throws ParseException {
try {
final long result = parseUInt64(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw integerParseException(e);
}
}
/**
* If the next token is a 64-bit unsigned integer, consume it and return
* {@code true}. Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsumeUInt64() {
try {
consumeUInt64();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a double, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public double consumeDouble() throws ParseException {
// We need to parse infinity and nan separately because
// Double.parseDouble() does not accept "inf", "infinity", or "nan".
if (DOUBLE_INFINITY.matcher(currentToken).matches()) {
final boolean negative = currentToken.startsWith("-");
nextToken();
return negative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
}
if (currentToken.equalsIgnoreCase("nan")) {
nextToken();
return Double.NaN;
}
try {
final double result = Double.parseDouble(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw floatParseException(e);
}
}
/**
* If the next token is a double, consume it and return {@code true}.
* Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsumeDouble() {
try {
consumeDouble();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a float, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public float consumeFloat() throws ParseException {
// We need to parse infinity and nan separately because
// Float.parseFloat() does not accept "inf", "infinity", or "nan".
if (FLOAT_INFINITY.matcher(currentToken).matches()) {
final boolean negative = currentToken.startsWith("-");
nextToken();
return negative ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
}
if (FLOAT_NAN.matcher(currentToken).matches()) {
nextToken();
return Float.NaN;
}
try {
final float result = Float.parseFloat(currentToken);
nextToken();
return result;
} catch (NumberFormatException e) {
throw floatParseException(e);
}
}
/**
* If the next token is a float, consume it and return {@code true}.
* Otherwise, return {@code false} without doing anything.
*/
public boolean tryConsumeFloat() {
try {
consumeFloat();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a boolean, consume it and return its value.
* Otherwise, throw a {@link ParseException}.
*/
public boolean consumeBoolean() throws ParseException {
if (currentToken.equals("true")
|| currentToken.equals("True")
|| currentToken.equals("t")
|| currentToken.equals("1")) {
nextToken();
return true;
} else if (currentToken.equals("false")
|| currentToken.equals("False")
|| currentToken.equals("f")
|| currentToken.equals("0")) {
nextToken();
return false;
} else {
throw parseException("Expected \"true\" or \"false\". Found \"" + currentToken + "\".");
}
}
/**
* If the next token is a string, consume it and return its (unescaped)
* value. Otherwise, throw a {@link ParseException}.
*/
public String consumeString() throws ParseException {
return consumeByteString().toStringUtf8();
}
/**
* If the next token is a string, consume it and return true. Otherwise,
* return false.
*/
public boolean tryConsumeString() {
try {
consumeString();
return true;
} catch (ParseException e) {
return false;
}
}
/**
* If the next token is a string, consume it, unescape it as a
* {@link ByteString}, and return it. Otherwise, throw a
* {@link ParseException}.
*/
public ByteString consumeByteString() throws ParseException {
List<ByteString> list = new ArrayList<ByteString>();
consumeByteString(list);
while (currentToken.startsWith("'") || currentToken.startsWith("\"")) {
consumeByteString(list);
}
return ByteString.copyFrom(list);
}
/**
* Like {@link #consumeByteString()} but adds each token of the string to
* the given list. String literals (whether bytes or text) may come in
* multiple adjacent tokens which are automatically concatenated, like in
* C or Python.
*/
private void consumeByteString(List<ByteString> list)
throws ParseException {
final char quote = currentToken.length() > 0
? currentToken.charAt(0)
: '\0';
if (quote != '\"' && quote != '\'') {
throw parseException("Expected string.");
}
if (currentToken.length() < 2
|| currentToken.charAt(currentToken.length() - 1) != quote) {
throw parseException("String missing ending quote.");
}
try {
final String escaped =
currentToken.substring(1, currentToken.length() - 1);
final ByteString result = unescapeBytes(escaped);
nextToken();
list.add(result);
} catch (InvalidEscapeSequenceException e) {
throw parseException(e.getMessage());
}
}
/**
* Returns a {@link ParseException} with the current line and column
* numbers in the description, suitable for throwing.
*/
public ParseException parseException(final String description) {
// Note: People generally prefer one-based line and column numbers.
return new ParseException(
line + 1, column + 1, description);
}
/**
* Returns a {@link ParseException} with the line and column numbers of
* the previous token in the description, suitable for throwing.
*/
public ParseException parseExceptionPreviousToken(
final String description) {
// Note: People generally prefer one-based line and column numbers.
return new ParseException(
previousLine + 1, previousColumn + 1, description);
}
/**
* Constructs an appropriate {@link ParseException} for the given
* {@code NumberFormatException} when trying to parse an integer.
*/
private ParseException integerParseException(
final NumberFormatException e) {
return parseException("Couldn't parse integer: " + e.getMessage());
}
/**
* Constructs an appropriate {@link ParseException} for the given
* {@code NumberFormatException} when trying to parse a float or double.
*/
private ParseException floatParseException(final NumberFormatException e) {
return parseException("Couldn't parse number: " + e.getMessage());
}
/**
* Returns a {@link UnknownFieldParseException} with the line and column
* numbers of the previous token in the description, and the unknown field
* name, suitable for throwing.
*/
public UnknownFieldParseException unknownFieldParseExceptionPreviousToken(
final String unknownField, final String description) {
// Note: People generally prefer one-based line and column numbers.
return new UnknownFieldParseException(
previousLine + 1, previousColumn + 1, unknownField, description);
}
}
/** Thrown when parsing an invalid text format message. */
public static class ParseException extends IOException {
private static final long serialVersionUID = 3196188060225107702L;
private final int line;
private final int column;
/** Create a new instance, with -1 as the line and column numbers. */
public ParseException(final String message) {
this(-1, -1, message);
}
/**
* Create a new instance
*
* @param line the line number where the parse error occurred,
* using 1-offset.
* @param column the column number where the parser error occurred,
* using 1-offset.
*/
public ParseException(final int line, final int column,
final String message) {
super(Integer.toString(line) + ":" + column + ": " + message);
this.line = line;
this.column = column;
}
/**
* Return the line where the parse exception occurred, or -1 when
* none is provided. The value is specified as 1-offset, so the first
* line is line 1.
*/
public int getLine() {
return line;
}
/**
* Return the column where the parse exception occurred, or -1 when
* none is provided. The value is specified as 1-offset, so the first
* line is line 1.
*/
public int getColumn() {
return column;
}
}
/**
* Thrown when encountering an unknown field while parsing
* a text format message.
*/
public static class UnknownFieldParseException extends ParseException {
private final String unknownField;
/**
* Create a new instance, with -1 as the line and column numbers, and an
* empty unknown field name.
*/
public UnknownFieldParseException(final String message) {
this(-1, -1, "", message);
}
/**
* Create a new instance
*
* @param line the line number where the parse error occurred,
* using 1-offset.
* @param column the column number where the parser error occurred,
* using 1-offset.
* @param unknownField the name of the unknown field found while parsing.
*/
public UnknownFieldParseException(final int line, final int column,
final String unknownField, final String message) {
super(line, column, message);
this.unknownField = unknownField;
}
/**
* Return the name of the unknown field encountered while parsing the
* protocol buffer string.
*/
public String getUnknownField() {
return unknownField;
}
}
private static final Parser PARSER = Parser.newBuilder().build();
/**
* Return a {@link Parser} instance which can parse text-format
* messages. The returned instance is thread-safe.
*/
public static Parser getParser() {
return PARSER;
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public static void merge(final Readable input,
final Message.Builder builder)
throws IOException {
PARSER.merge(input, builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public static void merge(final CharSequence input,
final Message.Builder builder)
throws ParseException {
PARSER.merge(input, builder);
}
/**
* Parse a text-format message from {@code input}.
*
* @return the parsed message, guaranteed initialized
*/
public static <T extends Message> T parse(final CharSequence input,
final Class<T> protoClass)
throws ParseException {
Message.Builder builder =
Internal.getDefaultInstance(protoClass).newBuilderForType();
merge(input, builder);
@SuppressWarnings("unchecked")
T output = (T) builder.build();
return output;
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public static void merge(final Readable input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder)
throws IOException {
PARSER.merge(input, extensionRegistry, builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public static void merge(final CharSequence input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder)
throws ParseException {
PARSER.merge(input, extensionRegistry, builder);
}
/**
* Parse a text-format message from {@code input}. Extensions will be
* recognized if they are registered in {@code extensionRegistry}.
*
* @return the parsed message, guaranteed initialized
*/
public static <T extends Message> T parse(
final CharSequence input,
final ExtensionRegistry extensionRegistry,
final Class<T> protoClass)
throws ParseException {
Message.Builder builder =
Internal.getDefaultInstance(protoClass).newBuilderForType();
merge(input, extensionRegistry, builder);
@SuppressWarnings("unchecked")
T output = (T) builder.build();
return output;
}
/**
* Parser for text-format proto2 instances. This class is thread-safe.
* The implementation largely follows google/protobuf/text_format.cc.
*
* <p>Use {@link TextFormat#getParser()} to obtain the default parser, or
* {@link Builder} to control the parser behavior.
*/
public static class Parser {
/**
* Determines if repeated values for non-repeated fields and
* oneofs are permitted. For example, given required/optional field "foo"
* and a oneof containing "baz" and "qux":
* <ul>
* <li>"foo: 1 foo: 2"
* <li>"baz: 1 qux: 2"
* <li>merging "foo: 2" into a proto in which foo is already set, or
* <li>merging "qux: 2" into a proto in which baz is already set.
* </ul>
*/
public enum SingularOverwritePolicy {
/** The last value is retained. */
ALLOW_SINGULAR_OVERWRITES,
/** An error is issued. */
FORBID_SINGULAR_OVERWRITES
}
private final boolean allowUnknownFields;
private final boolean allowUnknownEnumValues;
private final SingularOverwritePolicy singularOverwritePolicy;
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder;
private Parser(
boolean allowUnknownFields,
boolean allowUnknownEnumValues,
SingularOverwritePolicy singularOverwritePolicy,
TextFormatParseInfoTree.Builder parseInfoTreeBuilder) {
this.allowUnknownFields = allowUnknownFields;
this.allowUnknownEnumValues = allowUnknownEnumValues;
this.singularOverwritePolicy = singularOverwritePolicy;
this.parseInfoTreeBuilder = parseInfoTreeBuilder;
}
/**
* Returns a new instance of {@link Builder}.
*/
public static Builder newBuilder() {
return new Builder();
}
/**
* Builder that can be used to obtain new instances of {@link Parser}.
*/
public static class Builder {
private boolean allowUnknownFields = false;
private boolean allowUnknownEnumValues = false;
private SingularOverwritePolicy singularOverwritePolicy =
SingularOverwritePolicy.ALLOW_SINGULAR_OVERWRITES;
private TextFormatParseInfoTree.Builder parseInfoTreeBuilder = null;
/**
* Sets parser behavior when a non-repeated field appears more than once.
*/
public Builder setSingularOverwritePolicy(SingularOverwritePolicy p) {
this.singularOverwritePolicy = p;
return this;
}
public Builder setParseInfoTreeBuilder(
TextFormatParseInfoTree.Builder parseInfoTreeBuilder) {
this.parseInfoTreeBuilder = parseInfoTreeBuilder;
return this;
}
public Parser build() {
return new Parser(
allowUnknownFields,
allowUnknownEnumValues,
singularOverwritePolicy,
parseInfoTreeBuilder);
}
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public void merge(final Readable input,
final Message.Builder builder)
throws IOException {
merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}.
*/
public void merge(final CharSequence input,
final Message.Builder builder)
throws ParseException {
merge(input, ExtensionRegistry.getEmptyRegistry(), builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public void merge(final Readable input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder)
throws IOException {
// Read the entire input to a String then parse that.
// If StreamTokenizer were not quite so crippled, or if there were a kind
// of Reader that could read in chunks that match some particular regex,
// or if we wanted to write a custom Reader to tokenize our stream, then
// we would not have to read to one big String. Alas, none of these is
// the case. Oh well.
merge(toStringBuilder(input), extensionRegistry, builder);
}
private static final int BUFFER_SIZE = 4096;
// TODO(chrisn): See if working around java.io.Reader#read(CharBuffer)
// overhead is worthwhile
private static StringBuilder toStringBuilder(final Readable input)
throws IOException {
final StringBuilder text = new StringBuilder();
final CharBuffer buffer = CharBuffer.allocate(BUFFER_SIZE);
while (true) {
final int n = input.read(buffer);
if (n == -1) {
break;
}
buffer.flip();
text.append(buffer, 0, n);
}
return text;
}
// Check both unknown fields and unknown extensions and log warning messages
// or throw exceptions according to the flag.
private void checkUnknownFields(final List<String> unknownFields)
throws ParseException {
if (unknownFields.isEmpty()) {
return;
}
StringBuilder msg = new StringBuilder("Input contains unknown fields and/or extensions:");
for (String field : unknownFields) {
msg.append('\n').append(field);
}
if (allowUnknownFields) {
logger.warning(msg.toString());
} else {
String[] lineColumn = unknownFields.get(0).split(":");
throw new ParseException(
Integer.parseInt(lineColumn[0]), Integer.parseInt(lineColumn[1]), msg.toString());
}
}
/**
* Parse a text-format message from {@code input} and merge the contents
* into {@code builder}. Extensions will be recognized if they are
* registered in {@code extensionRegistry}.
*/
public void merge(final CharSequence input,
final ExtensionRegistry extensionRegistry,
final Message.Builder builder)
throws ParseException {
final Tokenizer tokenizer = new Tokenizer(input);
MessageReflection.BuilderAdapter target =
new MessageReflection.BuilderAdapter(builder);
List<String> unknownFields = new ArrayList<String>();
while (!tokenizer.atEnd()) {
mergeField(tokenizer, extensionRegistry, target, unknownFields);
}
checkUnknownFields(unknownFields);
}
/**
* Parse a single field from {@code tokenizer} and merge it into
* {@code builder}.
*/
private void mergeField(final Tokenizer tokenizer,
final ExtensionRegistry extensionRegistry,
final MessageReflection.MergeTarget target,
List<String> unknownFields)
throws ParseException {
mergeField(tokenizer, extensionRegistry, target, parseInfoTreeBuilder,
unknownFields);
}
/**
* Parse a single field from {@code tokenizer} and merge it into
* {@code target}.
*/
private void mergeField(final Tokenizer tokenizer,
final ExtensionRegistry extensionRegistry,
final MessageReflection.MergeTarget target,
TextFormatParseInfoTree.Builder parseTreeBuilder,
List<String> unknownFields)
throws ParseException {
FieldDescriptor field = null;
int startLine = tokenizer.getLine();
int startColumn = tokenizer.getColumn();
final Descriptor type = target.getDescriptorForType();
ExtensionRegistry.ExtensionInfo extension = null;
if (tokenizer.tryConsume("[")) {
// An extension.
final StringBuilder name =
new StringBuilder(tokenizer.consumeIdentifier());
while (tokenizer.tryConsume(".")) {
name.append('.');
name.append(tokenizer.consumeIdentifier());
}
extension = target.findExtensionByName(
extensionRegistry, name.toString());
if (extension == null) {
unknownFields.add(
(tokenizer.getPreviousLine() + 1)
+ ":"
+ (tokenizer.getPreviousColumn() + 1)
+ ":\t"
+ type.getFullName()
+ ".["
+ name
+ "]");
} else {
if (extension.descriptor.getContainingType() != type) {
throw tokenizer.parseExceptionPreviousToken(
"Extension \"" + name + "\" does not extend message type \""
+ type.getFullName() + "\".");
}
field = extension.descriptor;
}
tokenizer.consume("]");
} else {
final String name = tokenizer.consumeIdentifier();
field = type.findFieldByName(name);
// Group names are expected to be capitalized as they appear in the
// .proto file, which actually matches their type names, not their field
// names.
if (field == null) {
// Explicitly specify US locale so that this code does not break when
// executing in Turkey.
final String lowerName = name.toLowerCase(Locale.US);
field = type.findFieldByName(lowerName);
// If the case-insensitive match worked but the field is NOT a group,
if (field != null && field.getType() != FieldDescriptor.Type.GROUP) {
field = null;
}
}
// Again, special-case group names as described above.
if (field != null && field.getType() == FieldDescriptor.Type.GROUP
&& !field.getMessageType().getName().equals(name)) {
field = null;
}
if (field == null) {
unknownFields.add(
(tokenizer.getPreviousLine() + 1)
+ ":"
+ (tokenizer.getPreviousColumn() + 1)
+ ":\t"
+ type.getFullName()
+ "."
+ name);
}
}
// Skips unknown fields.
if (field == null) {
// Try to guess the type of this field.
// If this field is not a message, there should be a ":" between the
// field name and the field value and also the field value should not
// start with "{" or "<" which indicates the beginning of a message body.
// If there is no ":" or there is a "{" or "<" after ":", this field has
// to be a message or the input is ill-formed.
if (tokenizer.tryConsume(":")
&& !tokenizer.lookingAt("{")
&& !tokenizer.lookingAt("<")) {
skipFieldValue(tokenizer);
} else {
skipFieldMessage(tokenizer);
}
return;
}
// Handle potential ':'.
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
tokenizer.tryConsume(":"); // optional
if (parseTreeBuilder != null) {
TextFormatParseInfoTree.Builder childParseTreeBuilder =
parseTreeBuilder.getBuilderForSubMessageField(field);
consumeFieldValues(tokenizer, extensionRegistry, target, field, extension,
childParseTreeBuilder, unknownFields);
} else {
consumeFieldValues(tokenizer, extensionRegistry, target, field, extension,
parseTreeBuilder, unknownFields);
}
} else {
tokenizer.consume(":"); // required
consumeFieldValues(tokenizer, extensionRegistry, target, field,
extension, parseTreeBuilder, unknownFields);
}
if (parseTreeBuilder != null) {
parseTreeBuilder.setLocation(
field, TextFormatParseLocation.create(startLine, startColumn));
}
// For historical reasons, fields may optionally be separated by commas or
// semicolons.
if (!tokenizer.tryConsume(";")) {
tokenizer.tryConsume(",");
}
}
/**
* Parse a one or more field values from {@code tokenizer} and merge it into
* {@code builder}.
*/
private void consumeFieldValues(
final Tokenizer tokenizer,
final ExtensionRegistry extensionRegistry,
final MessageReflection.MergeTarget target,
final FieldDescriptor field,
final ExtensionRegistry.ExtensionInfo extension,
final TextFormatParseInfoTree.Builder parseTreeBuilder,
List<String> unknownFields)
throws ParseException {
// Support specifying repeated field values as a comma-separated list.
// Ex."foo: [1, 2, 3]"
if (field.isRepeated() && tokenizer.tryConsume("[")) {
if (!tokenizer.tryConsume("]")) { // Allow "foo: []" to be treated as empty.
while (true) {
consumeFieldValue(
tokenizer,
extensionRegistry,
target,
field,
extension,
parseTreeBuilder,
unknownFields);
if (tokenizer.tryConsume("]")) {
// End of list.
break;
}
tokenizer.consume(",");
}
}
} else {
consumeFieldValue(tokenizer, extensionRegistry, target, field,
extension, parseTreeBuilder, unknownFields);
}
}
/**
* Parse a single field value from {@code tokenizer} and merge it into
* {@code builder}.
*/
private void consumeFieldValue(
final Tokenizer tokenizer,
final ExtensionRegistry extensionRegistry,
final MessageReflection.MergeTarget target,
final FieldDescriptor field,
final ExtensionRegistry.ExtensionInfo extension,
final TextFormatParseInfoTree.Builder parseTreeBuilder,
List<String> unknownFields)
throws ParseException {
Object value = null;
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
final String endToken;
if (tokenizer.tryConsume("<")) {
endToken = ">";
} else {
tokenizer.consume("{");
endToken = "}";
}
final MessageReflection.MergeTarget subField;
subField = target.newMergeTargetForField(field,
(extension == null) ? null : extension.defaultInstance);
while (!tokenizer.tryConsume(endToken)) {
if (tokenizer.atEnd()) {
throw tokenizer.parseException(
"Expected \"" + endToken + "\".");
}
mergeField(tokenizer, extensionRegistry, subField, parseTreeBuilder,
unknownFields);
}
value = subField.finish();
} else {
switch (field.getType()) {
case INT32:
case SINT32:
case SFIXED32:
value = tokenizer.consumeInt32();
break;
case INT64:
case SINT64:
case SFIXED64:
value = tokenizer.consumeInt64();
break;
case UINT32:
case FIXED32:
value = tokenizer.consumeUInt32();
break;
case UINT64:
case FIXED64:
value = tokenizer.consumeUInt64();
break;
case FLOAT:
value = tokenizer.consumeFloat();
break;
case DOUBLE:
value = tokenizer.consumeDouble();
break;
case BOOL:
value = tokenizer.consumeBoolean();
break;
case STRING:
value = tokenizer.consumeString();
break;
case BYTES:
value = tokenizer.consumeByteString();
break;
case ENUM:
final EnumDescriptor enumType = field.getEnumType();
if (tokenizer.lookingAtInteger()) {
final int number = tokenizer.consumeInt32();
value = enumType.findValueByNumber(number);
if (value == null) {
String unknownValueMsg =
"Enum type \""
+ enumType.getFullName()
+ "\" has no value with number "
+ number
+ '.';
if (allowUnknownEnumValues) {
logger.warning(unknownValueMsg);
return;
} else {
throw tokenizer.parseExceptionPreviousToken(
"Enum type \""
+ enumType.getFullName()
+ "\" has no value with number "
+ number
+ '.');
}
}
} else {
final String id = tokenizer.consumeIdentifier();
value = enumType.findValueByName(id);
if (value == null) {
String unknownValueMsg =
"Enum type \""
+ enumType.getFullName()
+ "\" has no value named \""
+ id
+ "\".";
if (allowUnknownEnumValues) {
logger.warning(unknownValueMsg);
return;
} else {
throw tokenizer.parseExceptionPreviousToken(unknownValueMsg);
}
}
}
break;
case MESSAGE:
case GROUP:
throw new RuntimeException("Can't get here.");
}
}
if (field.isRepeated()) {
// TODO(b/29122459): If field.isMapField() and FORBID_SINGULAR_OVERWRITES mode,
// check for duplicate map keys here.
target.addRepeatedField(field, value);
} else if ((singularOverwritePolicy
== SingularOverwritePolicy.FORBID_SINGULAR_OVERWRITES)
&& target.hasField(field)) {
throw tokenizer.parseExceptionPreviousToken("Non-repeated field \""
+ field.getFullName() + "\" cannot be overwritten.");
} else if ((singularOverwritePolicy
== SingularOverwritePolicy.FORBID_SINGULAR_OVERWRITES)
&& field.getContainingOneof() != null
&& target.hasOneof(field.getContainingOneof())) {
Descriptors.OneofDescriptor oneof = field.getContainingOneof();
throw tokenizer.parseExceptionPreviousToken("Field \""
+ field.getFullName() + "\" is specified along with field \""
+ target.getOneofFieldDescriptor(oneof).getFullName()
+ "\", another member of oneof \"" + oneof.getName() + "\".");
} else {
target.setField(field, value);
}
}
/**
* Skips the next field including the field's name and value.
*/
private void skipField(Tokenizer tokenizer) throws ParseException {
if (tokenizer.tryConsume("[")) {
// Extension name.
do {
tokenizer.consumeIdentifier();
} while (tokenizer.tryConsume("."));
tokenizer.consume("]");
} else {
tokenizer.consumeIdentifier();
}
// Try to guess the type of this field.
// If this field is not a message, there should be a ":" between the
// field name and the field value and also the field value should not
// start with "{" or "<" which indicates the beginning of a message body.
// If there is no ":" or there is a "{" or "<" after ":", this field has
// to be a message or the input is ill-formed.
if (tokenizer.tryConsume(":")
&& !tokenizer.lookingAt("<")
&& !tokenizer.lookingAt("{")) {
skipFieldValue(tokenizer);
} else {
skipFieldMessage(tokenizer);
}
// For historical reasons, fields may optionally be separated by commas or
// semicolons.
if (!tokenizer.tryConsume(";")) {
tokenizer.tryConsume(",");
}
}
/**
* Skips the whole body of a message including the beginning delimiter and
* the ending delimiter.
*/
private void skipFieldMessage(Tokenizer tokenizer) throws ParseException {
final String delimiter;
if (tokenizer.tryConsume("<")) {
delimiter = ">";
} else {
tokenizer.consume("{");
delimiter = "}";
}
while (!tokenizer.lookingAt(">") && !tokenizer.lookingAt("}")) {
skipField(tokenizer);
}
tokenizer.consume(delimiter);
}
/**
* Skips a field value.
*/
private void skipFieldValue(Tokenizer tokenizer) throws ParseException {
if (tokenizer.tryConsumeString()) {
while (tokenizer.tryConsumeString()) {}
return;
}
if (!tokenizer.tryConsumeIdentifier() // includes enum & boolean
&& !tokenizer.tryConsumeInt64() // includes int32
&& !tokenizer.tryConsumeUInt64() // includes uint32
&& !tokenizer.tryConsumeDouble()
&& !tokenizer.tryConsumeFloat()) {
throw tokenizer.parseException(
"Invalid field value: " + tokenizer.currentToken);
}
}
}
// =================================================================
// Utility functions
//
// Some of these methods are package-private because Descriptors.java uses
// them.
/**
* Escapes bytes in the format used in protocol buffer text format, which
* is the same as the format used for C string literals. All bytes
* that are not printable 7-bit ASCII characters are escaped, as well as
* backslash, single-quote, and double-quote characters. Characters for
* which no defined short-hand escape sequence is defined will be escaped
* using 3-digit octal sequences.
*/
public static String escapeBytes(ByteString input) {
return TextFormatEscaper.escapeBytes(input);
}
/**
* Like {@link #escapeBytes(ByteString)}, but used for byte array.
*/
public static String escapeBytes(byte[] input) {
return TextFormatEscaper.escapeBytes(input);
}
/**
* Un-escape a byte sequence as escaped using
* {@link #escapeBytes(ByteString)}. Two-digit hex escapes (starting with
* "\x") are also recognized.
*/
public static ByteString unescapeBytes(final CharSequence charString)
throws InvalidEscapeSequenceException {
// First convert the Java character sequence to UTF-8 bytes.
ByteString input = ByteString.copyFromUtf8(charString.toString());
// Then unescape certain byte sequences introduced by ASCII '\\'. The valid
// escapes can all be expressed with ASCII characters, so it is safe to
// operate on bytes here.
//
// Unescaping the input byte array will result in a byte sequence that's no
// longer than the input. That's because each escape sequence is between
// two and four bytes long and stands for a single byte.
final byte[] result = new byte[input.size()];
int pos = 0;
for (int i = 0; i < input.size(); i++) {
byte c = input.byteAt(i);
if (c == '\\') {
if (i + 1 < input.size()) {
++i;
c = input.byteAt(i);
if (isOctal(c)) {
// Octal escape.
int code = digitValue(c);
if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
if (i + 1 < input.size() && isOctal(input.byteAt(i + 1))) {
++i;
code = code * 8 + digitValue(input.byteAt(i));
}
// TODO: Check that 0 <= code && code <= 0xFF.
result[pos++] = (byte) code;
} else {
switch (c) {
case 'a' : result[pos++] = 0x07; break;
case 'b' : result[pos++] = '\b'; break;
case 'f' : result[pos++] = '\f'; break;
case 'n' : result[pos++] = '\n'; break;
case 'r' : result[pos++] = '\r'; break;
case 't' : result[pos++] = '\t'; break;
case 'v' : result[pos++] = 0x0b; break;
case '\\': result[pos++] = '\\'; break;
case '\'': result[pos++] = '\''; break;
case '"' : result[pos++] = '\"'; break;
case 'x':
// hex escape
int code = 0;
if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) {
++i;
code = digitValue(input.byteAt(i));
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\x' with no digits");
}
if (i + 1 < input.size() && isHex(input.byteAt(i + 1))) {
++i;
code = code * 16 + digitValue(input.byteAt(i));
}
result[pos++] = (byte) code;
break;
default:
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\" + (char) c + '\'');
}
}
} else {
throw new InvalidEscapeSequenceException(
"Invalid escape sequence: '\\' at end of string.");
}
} else {
result[pos++] = c;
}
}
return result.length == pos
? ByteString.wrap(result) // This reference has not been out of our control.
: ByteString.copyFrom(result, 0, pos);
}
/**
* Thrown by {@link TextFormat#unescapeBytes} and
* {@link TextFormat#unescapeText} when an invalid escape sequence is seen.
*/
public static class InvalidEscapeSequenceException extends IOException {
private static final long serialVersionUID = -8164033650142593304L;
InvalidEscapeSequenceException(final String description) {
super(description);
}
}
/**
* Like {@link #escapeBytes(ByteString)}, but escapes a text string.
* Non-ASCII characters are first encoded as UTF-8, then each byte is escaped
* individually as a 3-digit octal escape. Yes, it's weird.
*/
static String escapeText(final String input) {
return escapeBytes(ByteString.copyFromUtf8(input));
}
/**
* Escape double quotes and backslashes in a String for unicode output of a message.
*/
public static String escapeDoubleQuotesAndBackslashes(final String input) {
return TextFormatEscaper.escapeDoubleQuotesAndBackslashes(input);
}
/**
* Un-escape a text string as escaped using {@link #escapeText(String)}.
* Two-digit hex escapes (starting with "\x") are also recognized.
*/
static String unescapeText(final String input)
throws InvalidEscapeSequenceException {
return unescapeBytes(input).toStringUtf8();
}
/** Is this an octal digit? */
private static boolean isOctal(final byte c) {
return '0' <= c && c <= '7';
}
/** Is this a hex digit? */
private static boolean isHex(final byte c) {
return ('0' <= c && c <= '9')
|| ('a' <= c && c <= 'f')
|| ('A' <= c && c <= 'F');
}
/**
* Interpret a character as a digit (in any base up to 36) and return the
* numeric value. This is like {@code Character.digit()} but we don't accept
* non-ASCII digits.
*/
private static int digitValue(final byte c) {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('a' <= c && c <= 'z') {
return c - 'a' + 10;
} else {
return c - 'A' + 10;
}
}
/**
* Parse a 32-bit signed integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively.
*/
static int parseInt32(final String text) throws NumberFormatException {
return (int) parseInteger(text, true, false);
}
/**
* Parse a 32-bit unsigned integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively. The
* result is coerced to a (signed) {@code int} when returned since Java has
* no unsigned integer type.
*/
static int parseUInt32(final String text) throws NumberFormatException {
return (int) parseInteger(text, false, false);
}
/**
* Parse a 64-bit signed integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively.
*/
static long parseInt64(final String text) throws NumberFormatException {
return parseInteger(text, true, true);
}
/**
* Parse a 64-bit unsigned integer from the text. Unlike the Java standard
* {@code Integer.parseInt()}, this function recognizes the prefixes "0x"
* and "0" to signify hexadecimal and octal numbers, respectively. The
* result is coerced to a (signed) {@code long} when returned since Java has
* no unsigned long type.
*/
static long parseUInt64(final String text) throws NumberFormatException {
return parseInteger(text, false, true);
}
private static long parseInteger(final String text,
final boolean isSigned,
final boolean isLong)
throws NumberFormatException {
int pos = 0;
boolean negative = false;
if (text.startsWith("-", pos)) {
if (!isSigned) {
throw new NumberFormatException("Number must be positive: " + text);
}
++pos;
negative = true;
}
int radix = 10;
if (text.startsWith("0x", pos)) {
pos += 2;
radix = 16;
} else if (text.startsWith("0", pos)) {
radix = 8;
}
final String numberText = text.substring(pos);
long result = 0;
if (numberText.length() < 16) {
// Can safely assume no overflow.
result = Long.parseLong(numberText, radix);
if (negative) {
result = -result;
}
// Check bounds.
// No need to check for 64-bit numbers since they'd have to be 16 chars
// or longer to overflow.
if (!isLong) {
if (isSigned) {
if (result > Integer.MAX_VALUE || result < Integer.MIN_VALUE) {
throw new NumberFormatException(
"Number out of range for 32-bit signed integer: " + text);
}
} else {
if (result >= (1L << 32) || result < 0) {
throw new NumberFormatException(
"Number out of range for 32-bit unsigned integer: " + text);
}
}
}
} else {
BigInteger bigValue = new BigInteger(numberText, radix);
if (negative) {
bigValue = bigValue.negate();
}
// Check bounds.
if (!isLong) {
if (isSigned) {
if (bigValue.bitLength() > 31) {
throw new NumberFormatException(
"Number out of range for 32-bit signed integer: " + text);
}
} else {
if (bigValue.bitLength() > 32) {
throw new NumberFormatException(
"Number out of range for 32-bit unsigned integer: " + text);
}
}
} else {
if (isSigned) {
if (bigValue.bitLength() > 63) {
throw new NumberFormatException(
"Number out of range for 64-bit signed integer: " + text);
}
} else {
if (bigValue.bitLength() > 64) {
throw new NumberFormatException(
"Number out of range for 64-bit unsigned integer: " + text);
}
}
}
result = bigValue.longValue();
}
return result;
}
}
| [
"majorityattack@gmail.com"
] | majorityattack@gmail.com |
280cb3d1080f1e45df3d69fa974efcf0915e58ff | 182eb5ce58c3a79f5d0df02c5e091565b3a1ff40 | /oldvers/MiniMiniMusicAppBackup.java | 5ba91284349c2cef8250f9ae3c6f04bd97776591 | [] | no_license | mudabirsadeed/MiniMusicApp | 7e89f1d12e8454d02170ac9ac359309a0ff3bd58 | 7702c03bf4cda475fc942f7d1432f86643d13bbe | refs/heads/master | 2020-05-31T08:45:14.581161 | 2019-06-04T17:52:49 | 2019-06-04T17:52:49 | 190,187,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,692 | java | import javax.sound.midi.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
public class MiniMiniMusicAppBackup {
static int c1time = 0;
static int c2time = 0;
static int c3time = 0;
static int c4time = 0;
static int c5time = 0;
static int c6time = 0;
static int c7time = 0;
static int c8time = 0;
static int c9time = 0;
static int time = 0;
static int currentChannel = 1;
static MiniMiniMusicAppBackup mini;
//static MiniMiniMusicAppBackup.MyAnimator animator;
static MiniMiniMusicAppBackup.MyWindowCreator windowCreator;
static JFrame frame;
static JPanel mainPanel;
Sequencer player;
Sequence seq;
Track track;
ArrayList<JCheckBox> checkboxList;
String[] instrumentNames = {"Bass Drum", "Closed Hi-Hat", "Open Hi-Hat", "Acoustic Snare", "Crash Cymbal",
"Hand Clap", "High Tom", "Hi Bongo", "Maracas", "Whistle","Low Conga","Cowbell", "Vibraslap",
"Low-mid Tom","High Agogo","Open Hi Conga"};
int[] instrumentsID = {35,42,46,38,49,39,50,60,70,72,64,56,58,47,67,63};
public static void main(String[] args){
mini = new MiniMiniMusicAppBackup();
windowCreator = new MiniMiniMusicAppBackup().new MyWindowCreator();
//animator = new MiniMiniMusicAppBackup().new MyAnimator();
windowCreator.createWindow();
}
public class MyWindowCreator{
public void createWindow(){
mini.setUpMidi();
frame = new JFrame("Beatbox");
BorderLayout layout = new BorderLayout();
JPanel background = new JPanel(layout);
background.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
checkboxList = new ArrayList<JCheckBox>();
Box buttonBox = new Box(BoxLayout.Y_AXIS);
JButton start = new JButton("Start");
start.addActionListener(new MyStartListener());
buttonBox.add(start);
JButton stop = new JButton("Stop");
start.addActionListener(new MyStopListener());
buttonBox.add(stop);
JButton upTempo = new JButton("Tempo Up");
start.addActionListener(new MyUpTempoListener());
buttonBox.add(upTempo);
JButton downTempo = new JButton("Tempo Down");
start.addActionListener(new MyDownTempoListener());
buttonBox.add(downTempo);
Box nameBox = new Box(BoxLayout.Y_AXIS);
for(int i = 0; i <16;i++){
nameBox.add(new Label(instrumentNames[i]));
}
background.add(BorderLayout.EAST, buttonBox);
background.add(BorderLayout.WEST, nameBox);
frame.getContentPane().add(background);
GridLayout grid = new GridLayout(16,16);
grid.setVgap(1);
grid.setHgap(2);
mainPanel = new JPanel(grid);
background.add(BorderLayout.CENTER,mainPanel);
for(int i=0;i<256;i++){
JCheckBox c = new JCheckBox();
c.setSelected(false);
checkboxList.add(c);
mainPanel.add(c);
}
/*frame.getContentPane().add(BorderLayout.CENTER,animator);*/
frame.setBounds(50,50,300,300);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
public class MyStartListener implements ActionListener {
public void actionPerformed(ActionEvent a){
buildTrackAndStart();
}
}
public class MyStopListener implements ActionListener {
public void actionPerformed(ActionEvent a){
player.stop();
}
}
public class MyUpTempoListener implements ActionListener {
public void actionPerformed(ActionEvent a){
float tempoFactor = player.getTempoFactor();
player.setTempoFactor((float)(tempoFactor*1.03));
}
}
public class MyDownTempoListener implements ActionListener {
public void actionPerformed(ActionEvent a){
float tempoFactor = player.getTempoFactor();
player.setTempoFactor((float)(tempoFactor*0.97));
}
}
public void buildTrackAndStart(){
int[] trackList;
seq.deleteTrack(track);
track=seq.createTrack();
changeChannel(9);
for(int i = 0;i<16;i++){
trackList = new int[16];
int instrumentID = instrumentsID[i];
for(int j = 0;j<16;j++){
JCheckBox jc = checkboxList.get(j+16*i);
if(jc.isSelected()){
trackList[j]=instrumentID;
}
else{
trackList[j]=1;
}
}
makeTrack(trackList);
}
try{
player.setSequence(seq);
player.setLoopCount(player.LOOP_CONTINUOUSLY);
player.start();
player.setTempoInBPM(120);
}
catch(Exception e){
e.printStackTrace();
}
}
public void makeTrack(int[] list){
//static int first = 0;
for(int i=0;i<16;i++){
int instrumentID = list[i];
if(instrumentID==1){
addNoteToTrack(1,1);
}
else if(instrumentID!=1){
addControl();
addNoteToTrack(instrumentID, 100);
}
}
time=0;
//first=1;
}
//sets up and open the player, sequence and track to be used in other parts of the program
public void setUpMidi(){
try{
int[] events = {127};
player = MidiSystem.getSequencer();
player.open();
player.addControllerEventListener(animator, events);
seq = new Sequence(Sequence.PPQ,4);
track = seq.createTrack();
player.setTempoInBPM(120);
}
catch (Exception ex){
ex.printStackTrace();
}
}
//a condensed note adding method, with integrated 'current time' rather than absolute time(eg. array[time+=length] as opposed to array[time])
public void addNoteToTrack(int note, int length, int velocity){
startNote(note, velocity);
time=time+length;
endNote(note, velocity);
}
public void addNoteToTrack(int note, int velocity){
addNoteToTrack(note, 1, velocity);
}
public void startNote(int note, int velocity){
doInstruction(144, note, velocity);
}
public void endNote(int note, int velocity){
doInstruction(128, note, velocity);
}
public void changeInstrument(int instrument){
doInstruction(192, instrument, 0);
}
//adds a controlEvent to the track at certain points so it can trigger other things, in this case controlChange in the animation inner class
public void addControl(){
doInstruction(176, 127, 0);
}
//a generalised MidiEvent creator, which also adds said event to the current track
public void doInstruction(int instruction, int noteOrInstrument, int velocity){
try{
ShortMessage a = new ShortMessage();
a.setMessage(instruction, currentChannel, noteOrInstrument, velocity);
MidiEvent noteOn = new MidiEvent (a, time);
track.add(noteOn);
}
catch (Exception ex){
ex.printStackTrace();
}
}
public void changeChannel(int newChannel){
if (newChannel<=9 && newChannel>=1){
saveCurrentChannelTime();
loadNewChannelTime(newChannel);
}
}
public void saveCurrentChannelTime(){
switch(currentChannel){
case 1:
c1time = time;
break;
case 2:
c2time = time;
break;
case 3:
c3time = time;
break;
case 4:
c4time = time;
break;
case 5:
c5time = time;
break;
case 6:
c6time = time;
break;
case 7:
c7time = time;
break;
case 8:
c8time = time;
break;
case 9:
c9time = time;
break;
}
}
public void loadNewChannelTime(int newChannel){
switch(newChannel){
case 1:
time = c1time;
break;
case 2:
time = c2time;
break;
case 3:
time = c3time;
break;
case 4:
time = c4time;
break;
case 5:
time = c5time;
break;
case 6:
time = c6time;
break;
case 7:
time = c7time;
break;
case 8:
time = c8time;
break;
case 9:
time = c9time;
break;
}
}
/*public class MyAnimator extends JPanel implements ControllerEventListener {
boolean msg = false;
public void controlChange(ShortMessage event){
msg = true;
repaint();
}
public void paintComponent(Graphics g1){
if(msg){
Graphics2D g2d = (Graphics2D) g1;
int r = (int) (Math.random()*256);
int g = (int) (Math.random()*256);
int b = (int) (Math.random()*256);
Color randomColor = new Color(r,g,b);
r = (int) (Math.random()*256);
g = (int) (Math.random()*256);
b = (int) (Math.random()*256);
Color randomColor2 = new Color(r,g,b);
int x = (int) ((Math.random()*100)+50);
int y = (int) ((Math.random()*100)+50);
int w = (int) ((Math.random()*50)+100);
int h = (int) ((Math.random()*50)+100);
//x1,y1 is startpos1, x2,y2 is size, ditto x3,y3 , x4,y4
GradientPaint gradient = new GradientPaint(x,y,randomColor,w,h, randomColor2);
g2d.setPaint(gradient);
g2d.fillOval(x,y,w,h);
msg = false;
}
}
}*/
/*
public void go(){
int[] events = {127};
this.play(events);
}
public void play(int[] events) {
try{
//makeMusic();
player.setSequence(seq);
player.start();
System.out.println("Playing Music");
}
catch (Exception ex){
ex.printStackTrace();
}
}
public void makeMusic(){
int length = 6;
int offset = 64;
changeInstrument(1);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset+6, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset+6, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset+6, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset+6, length, 100);
addNoteToTrack(offset-4, length, 100);
changeChannel(2);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+4, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+4, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+4, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset-4, length, 100);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset+4, length, 100);
addNoteToTrack(offset+9, length, 100);
addNoteToTrack(offset-4, length, 100);
changeChannel(3);
changeInstrument(12);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset+6, length, 80);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset+6, length, 80);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset+6, length, 80);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 100);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset+6, length, 80);
addNoteToTrack(offset, length, 1);
changeChannel(4);
changeInstrument(5);
addNoteToTrack(offset, length+2, 40);
addNoteToTrack(offset+10, length, 20);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 40);
addNoteToTrack(offset+10, length, 20);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 40);
addNoteToTrack(offset+10, length, 20);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 40);
addNoteToTrack(offset+10, length, 20);
addNoteToTrack(offset, length, 1);
addNoteToTrack(offset, length, 1);
changeChannel(1);
}*/
} | [
"Sadeed@Sadeeds-MBP.lan"
] | Sadeed@Sadeeds-MBP.lan |
c6b53160f7d83f6219b43463c0c5b8334373283b | e977c90e5db2cb333769ec575737113b6a8053e5 | /Java/ProjetoAula2-6/src/projetoAula2_6/ClasseAula2_6.java | 9f4c4557e21b2cbb4ca49ecd53111bf5e8de511f | [] | no_license | kirestein/bootcamp-igti | 001a9b393298565c3cec61b861ace78dc54ca328 | affc1feeda169830e444f5bbd8e9d8672881a7b3 | refs/heads/main | 2023-06-02T18:33:52.411946 | 2021-06-16T19:28:09 | 2021-06-16T19:28:09 | 369,653,315 | 0 | 0 | null | null | null | null | ISO-8859-3 | Java | false | false | 292 | java | package projetoAula2_6;
public class ClasseAula2_6 {
public static void main(String[] args) {
String nome = "Erik Johannes Steindorfer Proença";
String nome2 = "Cristhiane Buchmann Steindorfer Proença"
System.out.print("O " + nome + " é casado com a " + nome 2);
}
}
| [
"erik.proenca2011@gmail.com"
] | erik.proenca2011@gmail.com |
30c2adbdfbc624bad196cd56b3508d026549cf9c | 4f486700a190a671a2e3d5d31877bb9af2bf2291 | /app/src/main/java/com/example/daggerdemo/di/module/AppModule.java | 1c24ff78ce5188eba3286315195d5d61f5614817 | [] | no_license | kalyan4812/DaggerSecondPracticeProject | 78d3ed27dcee90d58dc9dcc30124fafa6b7a800d | eb98e22eacf496dc89637dddf09c2137d0bd4df7 | refs/heads/master | 2023-05-01T12:39:05.570878 | 2021-05-15T14:24:34 | 2021-05-15T14:24:34 | 367,651,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,494 | java | package com.example.daggerdemo.di.module;
import android.app.Application;
import android.content.Context;
import com.example.daggerdemo.BaseClasses.BaseScheduler;
import com.example.daggerdemo.DataManager;
import com.example.daggerdemo.SchedulerProvider;
import com.example.daggerdemo.data.Networksource.ApiSource;
import com.squareup.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
@Module(includes = {ViewModelModule.class})
public class AppModule {
//provide context
@Singleton
@Provides
Context getContext(Application application) {
return application;
}
//provide schedular
@Singleton
@Provides
BaseScheduler getSchedular() {
return new SchedulerProvider();
}
//provide ApiSource
@Singleton
@Provides
ApiSource getApiSource(Retrofit retrofit) {
return retrofit.create(ApiSource.class);
}
//provide datamanager
@Singleton
@Provides
DataManager getDataManager(ApiSource apiSource, BaseScheduler baseScheduler) {
return new DataManager(apiSource, baseScheduler);
}
@Singleton
@Provides
Picasso picasso(Context app, OkHttp3Downloader okHttp3Downloader) {
return new Picasso.Builder(app.getApplicationContext())
.downloader(okHttp3Downloader)
.loggingEnabled(true)
.build();
}
}
| [
"darojusaikalyan.civ18@itbhu.ac.in"
] | darojusaikalyan.civ18@itbhu.ac.in |
96e96091ef658e0c3afa0f3c778f4ad3f1dbf8fc | e9b7c2dae32413b926fe68ca4ed9c1b7b1890ed8 | /Lesson2/restservice/src/main/java/com/example/restservice/LoggingAspect.java | a4402eeed919bff317cfeb5774e1000527d790ba | [] | no_license | shockli/spring | eb3f7d67d9930f1496398d72270b671991714707 | ad252c032b9c119867e27af90b505682662916a2 | refs/heads/master | 2022-10-12T03:27:40.578992 | 2020-06-10T22:47:52 | 2020-06-10T22:47:52 | 269,460,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,681 | java | package com.example.restservice;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
@Component
@Aspect
public class LoggingAspect {
private Logger logger = Logger.getLogger(LoggingAspect.class.getName());
@Pointcut("within(com.example.restservice.GreetingController)")
public void stringProcessingMethods() {
};
@After("stringProcessingMethods()")
public void logMethodCall(JoinPoint jp) {
String methodName = jp.getSignature()
.getName();
logger.log(Level.INFO, "название метода: " + methodName);
}
//вот так почему то не стабатывает триггер
//AfterReturning(pointcut = "execution(public String com.example.restservice.GreetingController.*(..))", returning = "result")
@AfterReturning(pointcut = "stringProcessingMethods()", returning = "greeting")
public void logAfterReturning(JoinPoint joinPoint, Greeting greeting) {
logger.log(Level.INFO, "возвращенное значение: " + greeting.getContent());
}
@Around("@annotation(LogExecutionTime)")
public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.currentTimeMillis();
Object proceed = joinPoint.proceed();
long executionTime = System.currentTimeMillis() - start;
logger.log(Level.INFO, joinPoint.getSignature() + " выполнен за " + executionTime + "мс");
return proceed;
}
}
| [
"aleksandr.pautov@diasoft-platform.ru"
] | aleksandr.pautov@diasoft-platform.ru |
46048210db984bfc1600c048ecd98e5866b2e6ca | 261c9bf71b1f84486a30a79d7040aca3fd67908c | /homework/dima_kachenya/encoder/src/main/java/com/kachenya/Main.java | 116c5a4013c876fce34fed5647925eeb06cc14da | [] | no_license | javaGuruBY/JIS2 | 4b298bca9cd7695b6bb5c2c472277ffb127f08e5 | 842a7e9e5684eee3e95d90c9d380d396d00bfab3 | refs/heads/master | 2021-03-15T18:30:30.422719 | 2020-04-05T08:59:41 | 2020-04-05T08:59:41 | 246,871,824 | 0 | 1 | null | 2020-05-15T22:23:25 | 2020-03-12T15:42:42 | Java | UTF-8 | Java | false | false | 198 | java | package com.kachenya;
import com.kachenya.encoder.Encoder;
public class Main {
public static void main(String[] args) {
Encoder.code((short) 65);
Encoder.decoder('X');
}
}
| [
"noreply@github.com"
] | noreply@github.com |
eb38b53884c2591f3304ae2da5b148965b716955 | 43ccf1690b0b222414b6b707151d2ec86aab6f2e | /app/src/androidTest/java/com/example/hardware/ExampleInstrumentedTest.java | 8368134e2806e8f91d5d828fa2b3b1fdc7808c90 | [] | no_license | Bygaga63/android-hardware | 196f3499b5f7cb52d7d48a2abbf9dafe49d58bbe | 46973d523db85d6da23dd663a0131ada6e9050f6 | refs/heads/master | 2020-05-19T12:30:23.004715 | 2019-05-05T10:30:45 | 2019-05-05T10:30:45 | 185,016,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.example.hardware;
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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.hardware", appContext.getPackageName());
}
}
| [
"Bygaga63"
] | Bygaga63 |
d7fce0176c5c949c46d11a88dcafe46f54c3f54b | 450f00c8c4e2702307d94a57e3ad01a06cd17311 | /app/src/main/java/com/csci571/aditya/stockapp/network/StockAppClient.java | 945d5d654bc92036392749dc9ac216462dcf8bbc | [] | no_license | adityachandupatla/android-stock-frontend | 8921f5542a81b27347c106830335d9c8443c35bd | ed474928872a1098fb4f0294b80ba9c7110b58dc | refs/heads/master | 2023-01-21T12:41:36.319309 | 2020-12-02T07:31:53 | 2020-12-02T07:31:53 | 313,589,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,740 | java | package com.csci571.aditya.stockapp.network;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Layout;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.csci571.aditya.stockapp.R;
import com.csci571.aditya.stockapp.favorite.Favorite;
import com.csci571.aditya.stockapp.favorite.FavoriteSection;
import com.csci571.aditya.stockapp.localstorage.AppStorage;
import com.csci571.aditya.stockapp.localstorage.FavoriteStorageModel;
import com.csci571.aditya.stockapp.models.ArticleModel;
import com.csci571.aditya.stockapp.models.AutoSuggestModel;
import com.csci571.aditya.stockapp.models.DetailScreenWrapperModel;
import com.csci571.aditya.stockapp.models.NewsModel;
import com.csci571.aditya.stockapp.models.OutlookModel;
import com.csci571.aditya.stockapp.models.Suggestion;
import com.csci571.aditya.stockapp.models.SummaryModel;
import com.csci571.aditya.stockapp.models.SummaryWrapperModel;
import com.csci571.aditya.stockapp.news.NewsAdapter;
import com.csci571.aditya.stockapp.portfolio.Portfolio;
import com.csci571.aditya.stockapp.portfolio.PortfolioSection;
import com.csci571.aditya.stockapp.search.AutoSuggestAdapter;
import com.csci571.aditya.stockapp.utils.Constants;
import com.csci571.aditya.stockapp.utils.Parser;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import androidx.core.content.ContextCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter;
public class StockAppClient {
private static StockAppClient mInstance;
private static final String TAG = "com.csci571.aditya.stockapp.network.StockAppClient";
private final String host;
private StockAppClient() {
host = Constants.HOST;
}
public static synchronized StockAppClient getInstance() {
if (mInstance == null) {
mInstance = new StockAppClient();
}
return mInstance;
}
// Custom JSON Request Handler
private void makeRequest(final String url, final VolleyCallback callback, Context context) {
//Pass response to success callback
CustomJSONObjectRequest rq = new CustomJSONObjectRequest(Request.Method.GET,
url, null, result -> {
try {
callback.onSuccess(result);
} catch (JSONException e) {
e.printStackTrace();
}
}, error -> {
try {
callback.onError(error.toString());
} catch (Exception e) {
e.printStackTrace();
}
});
rq.setRetryPolicy(new DefaultRetryPolicy(50000, 5,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
// Request added to the RequestQueue
VolleyController.getInstance(context).addToRequestQueue(rq);
}
private void fillHomeScreen(ProgressBar progressBar, TextView loadingTextView, RecyclerView recyclerView,
SectionedRecyclerViewAdapter sectionAdapter, Map<String, Double> map, Context context) {
PortfolioSection portfolioSection = (PortfolioSection) sectionAdapter.getSection(Constants.PORTFOLIO_SECTION_TAG);
List<Portfolio> portfolioList = portfolioSection.getList();
double stockWorth = 0;
for (Portfolio portfolio: portfolioList) {
double currentStockPrice = 0;
if (map.containsKey(portfolio.getTicker())) {
currentStockPrice = map.get(portfolio.getTicker());
AppStorage.setPortfolioStockPrice(context, portfolio.getTicker(), currentStockPrice);
}
else {
Log.e(TAG, "Unable to get currentStockPrice for the ticker: "
+ portfolio.getTicker() + " using currentStockPrice as 0");
}
double averagePriceOfStockOwned = portfolio.getTotalAmountOwned() / portfolio.getShares();
double changePercentage = currentStockPrice - averagePriceOfStockOwned;
portfolio.setStockPrice(currentStockPrice);
portfolio.setChangePercentage(changePercentage);
stockWorth += currentStockPrice * portfolio.getShares();
}
double uninvestedCash = AppStorage.getUninvestedCash(context);
portfolioSection.setNetWorth(Parser.beautify(uninvestedCash + stockWorth));
FavoriteSection favoriteSection = (FavoriteSection) sectionAdapter.getSection(Constants.FAVORITE_SECTION_TAG);
List<Favorite> favoriteList = favoriteSection.getList();
for (Favorite favorite: favoriteList) {
double currentStockPrice = 0;
if (map.containsKey(favorite.getTicker())) {
currentStockPrice = map.get(favorite.getTicker());
AppStorage.setFavoriteStockPrice(context, favorite.getTicker(), currentStockPrice);
}
else {
Log.e(TAG, "Unable to get currentStockPrice for the ticker: "
+ favorite.getTicker() + " using currentStockPrice as 0");
}
double changePercentage = currentStockPrice - favorite.getLastPrice();
favorite.setStockPrice(currentStockPrice);
favorite.setChangePercentage(changePercentage);
}
sectionAdapter.notifyDataSetChanged();
if (progressBar.getVisibility() == View.VISIBLE) {
progressBar.setVisibility(View.INVISIBLE);
loadingTextView.setVisibility(View.INVISIBLE);
}
if (recyclerView.getVisibility() == View.INVISIBLE) {
recyclerView.setVisibility(View.VISIBLE);
}
}
@SuppressLint("SetJavaScriptEnabled")
private void fillDetailScreen(ProgressBar progressBar, TextView loadingTextView,
NestedScrollView nestedScrollView, NewsAdapter newsAdapter,
DetailScreenWrapperModel data, Context context) {
OutlookModel outlookModel = data.getOutlookModel();
if (outlookModel == null) {
outlookModel = new OutlookModel();
outlookModel.setCompanyName("No company");
outlookModel.setStockTickerSymbol("");
outlookModel.setDescription("No description");
}
SummaryModel summaryModel = data.getSummaryModel();
if (summaryModel == null) {
summaryModel = new SummaryModel();
}
NewsModel newsModel = data.getNewsModel();
String ticker = outlookModel.getStockTickerSymbol();
double currentStockPrice = summaryModel.getLastPrice();
TextView tickerTextView = nestedScrollView.findViewById(R.id.tickerTextView);
tickerTextView.setText(ticker);
TextView companyNameTextView = nestedScrollView.findViewById(R.id.companyNameTextView);
companyNameTextView.setText(outlookModel.getCompanyName());
TextView stockPriceTextView = nestedScrollView.findViewById(R.id.stockPriceTextView);
String stockPriceDisplayText = "$" + Parser.beautify(currentStockPrice);
stockPriceTextView.setText(stockPriceDisplayText);
TextView changeTextView = nestedScrollView.findViewById(R.id.changeTextView);
String changeDisplayText = "";
double change = summaryModel.getLastPrice() - summaryModel.getPreviousClosingPrice();
if (change > 0) {
changeDisplayText = "$" + Parser.beautify(change);
changeTextView.setTextColor(ContextCompat.getColor(context, R.color.positiveChange));
}
else if (change < 0) {
changeDisplayText = "-$" + Parser.beautify(-1 * change);
changeTextView.setTextColor(ContextCompat.getColor(context, R.color.negativeChange));
}
else {
changeDisplayText = "$0";
changeTextView.setTextColor(ContextCompat.getColor(context, R.color.noChange));
}
changeTextView.setText(changeDisplayText);
TextView sharesOwnedTextView = nestedScrollView.findViewById(R.id.sharesOwnedTextView);
TextView marketValueTextView = nestedScrollView.findViewById(R.id.marketValueTextView);
double sharesOwned = ticker.length() > 0 ? AppStorage.getSharesOwned(context, ticker) : 0;
String sharesOwnedDisplayText;
String marketValueDisplayText;
if (sharesOwned > 0) {
sharesOwnedDisplayText = "Shares Owned: " + Parser.beautify(sharesOwned);
marketValueDisplayText = "Market Value: $" + Parser.beautify(sharesOwned * currentStockPrice);
}
else {
sharesOwnedDisplayText = "You have 0 shares of " + ticker + ".";
marketValueDisplayText = "Start Trading!";
}
sharesOwnedTextView.setText(sharesOwnedDisplayText);
marketValueTextView.setText(marketValueDisplayText);
TextView currentPriceTextView = nestedScrollView.findViewById(R.id.currentPriceTextView);
String currentPriceDisplayText = "Current Price: " + Parser.beautify(summaryModel.getLastPrice());
currentPriceTextView.setText(currentPriceDisplayText);
TextView lowPriceTextView = nestedScrollView.findViewById(R.id.lowPriceTextView);
String lowPriceDisplayText = "Low: " + Parser.beautify(summaryModel.getLowPrice());
lowPriceTextView.setText(lowPriceDisplayText);
TextView bidPriceTextView = nestedScrollView.findViewById(R.id.bidPriceTextView);
String bidPriceDisplayText = "Bid Price: " + Parser.beautify(summaryModel.getBidPrice());
bidPriceTextView.setText(bidPriceDisplayText);
TextView openPriceTextView = nestedScrollView.findViewById(R.id.openPriceTextView);
String openPriceDisplaytext = "Open Price: " + Parser.beautify(summaryModel.getOpeningPrice());
openPriceTextView.setText(openPriceDisplaytext);
TextView midPriceTextView = nestedScrollView.findViewById(R.id.midPriceTextView);
String midPriceDisplayText = "Mid: " + Parser.beautify(summaryModel.getMidPrice());
midPriceTextView.setText(midPriceDisplayText);
TextView highPriceTextView = nestedScrollView.findViewById(R.id.highPriceTextView);
String highPriceDisplayText = "High: " + Parser.beautify(summaryModel.getHighPrice());
highPriceTextView.setText(highPriceDisplayText);
TextView volumeTextView = nestedScrollView.findViewById(R.id.volumeTextView);
String volumeDisplayText = "Volume: " + Parser.beautify(summaryModel.getVolume());
volumeTextView.setText(volumeDisplayText);
TextView aboutContentTextView = nestedScrollView.findViewById(R.id.aboutContentTextView);
aboutContentTextView.setText(outlookModel.getDescription());
TextView toggleAboutDescTextView = nestedScrollView.findViewById(R.id.toggleAboutDescTextView);
toggleAboutDescTextView.setOnClickListener(v -> {
if (v.getVisibility() == View.VISIBLE) {
TextView textView = ((TextView) v);
String message = textView.getText().toString();
if (message.equals(Constants.SHOW_MORE_MESSAGE)) {
aboutContentTextView.setMaxLines(Integer.MAX_VALUE);
textView.setText(Constants.SHOW_LESS_MESSAGE);
}
else {
aboutContentTextView.setMaxLines(2);
textView.setText(Constants.SHOW_MORE_MESSAGE);
}
}
});
ViewTreeObserver vto = aboutContentTextView.getViewTreeObserver();
vto.addOnGlobalLayoutListener(() -> {
Layout layout = aboutContentTextView.getLayout();
if(layout != null) {
int lines = layout.getLineCount();
if(lines > 0) {
int ellipsisCount = layout.getEllipsisCount(lines - 1);
if (ellipsisCount > 0) {
toggleAboutDescTextView.setText(Constants.SHOW_MORE_MESSAGE);
}
else {
if (lines > 2) {
toggleAboutDescTextView.setText(Constants.SHOW_LESS_MESSAGE);
}
else {
toggleAboutDescTextView.setVisibility(View.INVISIBLE);
}
}
}
}
});
if (ticker.length() > 0) {
WebView webview = nestedScrollView.findViewById(R.id.highcharts_webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.clearCache(true);
webview.getSettings().setDomStorageEnabled(true);
String historicalUrl = host + String.format(Constants.HISTORICAL_ENDPOINT_TEMPLATE, ticker);
String jsUrl = String.format(Constants.JS_FUNCTION_BUILDER_TEMPLATE, historicalUrl, ticker);
webview.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (url.equals(Constants.HIGHCHARTS_ASSET_PATH)) {
webview.loadUrl(jsUrl);
}
}
});
webview.loadUrl(Constants.HIGHCHARTS_ASSET_PATH);
}
if (newsModel != null && newsModel.getArticles() != null && newsModel.getArticles().size() > 0) {
newsAdapter.setArticles(newsModel.getArticles());
newsAdapter.notifyDataSetChanged();
}
progressBar.setVisibility(View.INVISIBLE);
loadingTextView.setVisibility(View.INVISIBLE);
nestedScrollView.setVisibility(View.VISIBLE);
}
public void fetchHomeScreenData(HashSet<String> tickerSet, ProgressBar progressBar,
TextView loadingTextView, RecyclerView recyclerView,
SectionedRecyclerViewAdapter sectionAdapter, Context context) {
Map<String, Double> map = new HashMap<>();
if (tickerSet.size() > 0) {
Log.i(TAG, "<<<<<<<<<<<< FETCHING HOME SCREEN DATA >>>>>>>>>>>>>");
String tickers = "";
for (String ticker: tickerSet) {
tickers += ticker + ",";
}
tickers.substring(0, tickers.length() - 1);
String url = host + String.format(Constants.SUMMARY_WRAPPER_ENDPOINT_TEMPLATE, tickers);
makeRequest(url, new VolleyCallback() {
@Override
public void onSuccess(JSONObject result) {
SummaryWrapperModel summaryWrapperModel;
try {
summaryWrapperModel = new Gson().fromJson(result.toString(), SummaryWrapperModel.class);
for (SummaryModel summaryModel: summaryWrapperModel.getData()) {
map.put(summaryModel.getStockTickerSymbol(), summaryModel.getLastPrice());
}
} catch(JsonSyntaxException e) {
Log.e(TAG, "Request: " + url + " returned: " + result.toString() +
" which is not parsable into ArrayList<SummaryModel>");
} finally {
fillHomeScreen(progressBar, loadingTextView, recyclerView, sectionAdapter, map, context);
}
}
@Override
public void onError(String result) {
Log.e(TAG, "Error occurred while making request: " + url + " to backend: ");
Log.e(TAG, result);
fillHomeScreen(progressBar, loadingTextView, recyclerView, sectionAdapter, map, context);
}
}, context);
}
else {
fillHomeScreen(progressBar, loadingTextView, recyclerView, sectionAdapter, map, context);
}
}
public void fetchAutoSuggestData(String searchString, AutoSuggestAdapter autoSuggestAdapter, Context context) {
String url = host + String.format(Constants.AUTOCOMPLETE_ENDPOINT_TEMPLATE, searchString);
makeRequest(url, new VolleyCallback() {
@Override
public void onSuccess(JSONObject result) {
AutoSuggestModel autoSuggestModel;
try {
autoSuggestModel = new Gson().fromJson(result.toString(), AutoSuggestModel.class);
if (autoSuggestModel.isSuccess() && autoSuggestModel.getData().size() > 0) {
List<String> data = new ArrayList<>();
for (Suggestion suggestion: autoSuggestModel.getData()) {
data.add(suggestion.getTicker() + " - " + suggestion.getName());
}
autoSuggestAdapter.setData(data);
autoSuggestAdapter.notifyDataSetChanged();
}
} catch (JsonSyntaxException e) {
Log.e(TAG, "Request: " + url + " returned: " + result.toString() +
" which is not parsable into AutoSuggestModel");
}
}
@Override
public void onError(String result) {
Log.e(TAG, "Error occurred while making request: " + url + " to backend: ");
Log.e(TAG, result);
}
}, context);
}
public void fetchDetailScreenData(String ticker, ProgressBar progressBar, TextView loadingTextView,
NestedScrollView nestedScrollView, NewsAdapter newsAdapter,
DetailScreenWrapperModel data, Context context) {
String detailsUrl = host + String.format(Constants.DETAILS_ENDPOINT_TEMPLATE, ticker);
makeRequest(detailsUrl, new VolleyCallback() {
@Override
public void onSuccess(JSONObject result) {
DetailScreenWrapperModel response;
try {
response = new Gson().fromJson(result.toString(), DetailScreenWrapperModel.class);
data.setSummaryModel(response.getSummaryModel());
data.setOutlookModel(response.getOutlookModel());
data.setNewsModel(response.getNewsModel());
} catch(JsonSyntaxException e) {
Log.e(TAG, "Request: " + detailsUrl + " returned: " + result.toString() +
" which is not parsable into DetailScreenWrapperModel");
} finally {
fillDetailScreen(progressBar, loadingTextView, nestedScrollView, newsAdapter, data, context);
}
}
@Override
public void onError(String result) {
Log.e(TAG, "Error occurred while making request: " + detailsUrl + " to backend: ");
Log.e(TAG, result);
fillDetailScreen(progressBar, loadingTextView, nestedScrollView, newsAdapter, data, context);
}
}, context);
}
}
| [
"ch.aditya1996@gmail.com"
] | ch.aditya1996@gmail.com |
e1d0d94558b3e8a57c72e0e3655e67cf253c9869 | 8042b730ac266813b18feb9972990e9bc54fdba2 | /Designs/KeukenDesign.java | 11e0aec69b5b94d80aea174b881831da6a510c18 | [] | no_license | biprom/TerwezeUpdate | a46d1d992ac7fe25dd7cfeaa78f697cedaefee79 | 65e8e7f320be866b82180cf774f9d67d856b50f2 | refs/heads/master | 2021-05-06T22:47:28.028988 | 2017-12-02T16:55:30 | 2017-12-02T16:55:30 | 112,859,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.biprom.terweze.Designs;
import com.vaadin.annotations.AutoGenerated;
import com.vaadin.annotations.DesignRoot;
import com.vaadin.ui.declarative.Design;
import com.vaadin.ui.VerticalLayout;
/**
* !! DO NOT EDIT THIS FILE !!
* <p>
* This class is generated by Vaadin Designer and will be overwritten.
* <p>
* Please make a subclass with logic and additional interfaces as needed,
* e.g class LoginView extends LoginDesign implements View { }
*/
@DesignRoot
@AutoGenerated
@SuppressWarnings("serial")
public class KeukenDesign extends VerticalLayout {
public KeukenDesign() {
Design.read(this);
}
}
| [
"bram@biprom.com"
] | bram@biprom.com |
31de669b0f40ed39d2cd7df22892d8ee91213a3c | 6b5faaeb1a70e478a3e31e66f01887f7e82380ce | /app/src/main/java/com/waygo/data/DataLayerBase.java | bfc8b2e8d05ff4b9b2d365171fe927d041837902 | [] | no_license | jaggernod/waygo | fa1bc24c9f73b674b8725e54adc3b617bc5af924 | f2bbca655a014fe97d1fc784b7a40b9d39def586 | refs/heads/develop | 2021-01-22T12:02:05.018938 | 2015-07-06T15:18:45 | 2015-07-06T15:18:45 | 38,487,797 | 0 | 1 | null | 2015-07-04T12:58:09 | 2015-07-03T10:44:06 | Java | UTF-8 | Java | false | false | 950 | java | package com.waygo.data;
import com.waygo.data.stores.FlightStatusStore;
import com.waygo.data.stores.NetworkRequestStatusStore;
import android.support.annotation.NonNull;
import rx.android.internal.Preconditions;
abstract public class DataLayerBase {
protected final NetworkRequestStatusStore networkRequestStatusStore;
protected final FlightStatusStore flightStatusStore;
public DataLayerBase(@NonNull NetworkRequestStatusStore networkRequestStatusStore,
@NonNull FlightStatusStore flightStatusStore) {
Preconditions.checkNotNull(networkRequestStatusStore,
"Network Request Status Store cannot be null.");
Preconditions.checkNotNull(flightStatusStore,
"Flight Status Store cannot be null.");
this.networkRequestStatusStore = networkRequestStatusStore;
this.flightStatusStore = flightStatusStore;
}
}
| [
"pawel.polanski@futurice.com"
] | pawel.polanski@futurice.com |
aa6ba0c531bd7d051edf4ac3104c70b29843cfc2 | 138152454684e60aea67b1f05618b27295827e4d | /lamp1.java | d9fc543b06ee627580abaeec397630cf185b36c4 | [] | no_license | timevgen713/javaforms | 3efc5390cf9717a0d99db37c042bbf057791ade7 | cf8971fab1c2c35c65bab389a2f6845184efd23f | refs/heads/master | 2020-09-24T18:10:42.938042 | 2019-12-11T13:56:30 | 2019-12-11T13:56:30 | 225,814,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,189 | java | import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.ActionEvent;
import java.lang.Math;
public class lamp1 extends JFrame {
private JPanel contentPane;
private JTextField length;
private JTextField width;
private JTextField lpanel;
private JTextField wpanel;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
lamp1 frame = new lamp1();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public lamp1() {
setTitle("\u041B\u0430\u043C\u0438\u043D\u0430\u0442");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 800, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("\u0414\u043B\u0438\u043D\u0430 \u043F\u043E\u043A\u0440\u044B\u0432\u0430\u0435\u043C\u043E\u0439 \u043F\u043E\u0432\u0435\u0440\u0445\u043D\u043E\u0441\u0442\u0438, \u0441\u043C");
lblNewLabel.setFont(new Font("Arial", Font.PLAIN, 24));
lblNewLabel.setBounds(23, 24, 438, 36);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("\u0428\u0438\u0440\u0438\u043D\u0430 \u043F\u043E\u043A\u0440\u044B\u0432\u0430\u0435\u043C\u043E\u0439 \u043F\u043E\u0432\u0435\u0440\u0445\u043D\u043E\u0441\u0442\u0438, \u0441\u043C");
lblNewLabel_1.setFont(new Font("Arial", Font.PLAIN, 24));
lblNewLabel_1.setBounds(23, 99, 444, 36);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("\u0414\u043B\u0438\u043D\u0430 \u043B\u0430\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438, \u0441\u043C");
lblNewLabel_2.setFont(new Font("Arial", Font.PLAIN, 24));
lblNewLabel_2.setBounds(23, 177, 450, 36);
contentPane.add(lblNewLabel_2);
JLabel lblNewLabel_3 = new JLabel("\u0428\u0438\u0440\u0438\u043D\u0430 \u043B\u0430\u043C\u0438\u043D\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u043E\u0439 \u043F\u0430\u043D\u0435\u043B\u0438, \u0441\u043C");
lblNewLabel_3.setFont(new Font("Arial", Font.PLAIN, 24));
lblNewLabel_3.setBounds(23, 252, 438, 36);
contentPane.add(lblNewLabel_3);
length = new JTextField();
length.setFont(new Font("Tahoma", Font.PLAIN, 18));
length.setBounds(477, 24, 165, 36);
contentPane.add(length);
length.setColumns(10);
width = new JTextField();
width.setFont(new Font("Tahoma", Font.PLAIN, 18));
width.setBounds(477, 99, 165, 36);
contentPane.add(width);
width.setColumns(10);
lpanel = new JTextField();
lpanel.setFont(new Font("Tahoma", Font.PLAIN, 18));
lpanel.setBounds(477, 177, 165, 36);
contentPane.add(lpanel);
lpanel.setColumns(10);
wpanel = new JTextField();
wpanel.setFont(new Font("Tahoma", Font.PLAIN, 18));
wpanel.setBounds(477, 252, 165, 36);
contentPane.add(wpanel);
wpanel.setColumns(10);
JButton btnNewButton = new JButton("\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044C");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String ls = length.getText().trim();
String ws = width.getText().trim();
String lpans = lpanel.getText().trim();
String wpans = wpanel.getText().trim();
if(!(ls.isEmpty() || ws.isEmpty() || lpans.isEmpty() || wpans.isEmpty())) {
try {
float A,B,a,b;
double N;
A = new Float(ls);
B = new Float(ws);
a = new Float(lpans);
b = new Float(wpans);
if (((A - 2) / a) == (int)((A - 2) / a) && ((B - 2) / b) == (int)((B - 2) / b)) {
N = ((A - 2)*(B - 2)) / (a*b);
}
else if (((A - 2) / a) != ((int)((A - 2) / a))) {
if (((B - 2) / b) != ((int)((B - 2) / b))) {
N = Math.ceil(((B - 2) / b) * Math.ceil((A - 2) / a));
}
else {
N = Math.ceil(((B - 2) / b) * Math.ceil((A - 2) / a));
}
}
else {
N = Math.ceil(((A - 2)*(B - 2)) / (a*b));
}
JOptionPane.showMessageDialog(null, "Вам потребуется ламинат в количестве "+(int)N+" шт","Результат",1);
}
catch(Exception w) {
JOptionPane.showMessageDialog(null, "Заполните все поля корректно","Ошибка",0);
}
}
else {
JOptionPane.showMessageDialog(null, "Заполните все поля","Ошибка",0);
}
}
});
btnNewButton.setFont(new Font("Arial", Font.PLAIN, 24));
btnNewButton.setBounds(290, 429, 171, 36);
contentPane.add(btnNewButton);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5cc404199f25d204d02f11dc060e9dfa1bbe050b | 80fa39f8da78fcfa57a9a1ad21e70aad4cc88098 | /Task8/exercise-04/src/Client1.java | f475cfac50d7531e2d120a3c8ed1aa22533c48e7 | [] | no_license | s19022/BYT | dfd7fd749e09c2887e063cf385d2b6d9b9c5a7dd | e55829aa387dd26dc213b3f377a78e9e6baa7f4d | refs/heads/master | 2023-02-28T22:51:26.268367 | 2021-02-05T07:12:48 | 2021-02-05T07:12:48 | 310,634,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java |
import java.io.*;
public class Client1 {
public static void printPerson(Writer out, Person person) throws IOException {
StringBuilder sb = new StringBuilder();
sb.append(person.getFirstName());
sb.append(" ");
if (person.getMiddleName() != null) {
sb.append(person.getMiddleName());
sb.append(" ");
}
sb.append(person.getLastName());
out.write(sb.toString());
}
}
| [
"s19022@pjwstk.edu.pl"
] | s19022@pjwstk.edu.pl |
8dc0cae4438fc5dfa6b8b7ddec85477acd3096c6 | f474f2d1690a9564c5d5d9be9bb333014e2cede8 | /removing_spaces/src/com/amalitech/removing_spaces/removing_spaces.java | 9876412f5fe91607083e4c319c37c61f14e46ec2 | [] | no_license | Joezy-Azashi/java-training | cd0994ed52d020650d942c9cbbbffe2f2ee44df3 | 8f5840cb96dba4132a385cca139f147946a31ba6 | refs/heads/master | 2022-06-16T23:25:45.356030 | 2020-05-07T18:59:31 | 2020-05-07T18:59:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.amalitech.removing_spaces;
import java.util.Scanner;
public class removing_spaces {
public static void main(String args[]) {
Scanner kybd = new Scanner(System.in);
System.out.println("Enter sentences");
String str = kybd.nextLine();
char ch[] = str.toCharArray();
char ch2 [] = new char[100];
int m=0;
for(int i=0; i<ch.length; i++) {
if(ch[i] != ' ') {
ch2[m++] = ch[i];
}
}
for(int j=0; j<ch2.length; j++) {
System.out.print(ch2[j]);
}
kybd.close();
}
}
| [
"Azashi@Azalia-PC"
] | Azashi@Azalia-PC |
74083320b757c9307a60173a4ab7477e77ee87b0 | ce61c4bf8976d2a7335f22adef542c3f13f16995 | /Fy_GUI/src/Main.java | 1d09eea9280a1c93fd3e77d47d754412259d0185 | [] | no_license | SeanMcgazza/FYProject | 9cca1f4b62d1a71b2fc17c44a07af2038a7059a4 | 358f1e4bf183bcd7b6d9893504d8527318757f61 | refs/heads/master | 2020-07-05T07:19:16.636904 | 2017-04-30T13:29:19 | 2017-04-30T13:29:19 | 74,122,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,755 | java | import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import net.miginfocom.swing.MigLayout;
import net.proteanit.sql.DbUtils;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JCheckBox;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.awt.event.ActionEvent;
import javax.swing.JTextArea;
import java.awt.TextField;
import java.awt.GridLayout;
import java.awt.TextArea;
public class Main {
private JFrame frame;
private JTextField Last_name;
private JTextField First_name;
private JTextField Date_of_birth;
private JTextField Address_1;
private JTextField Address_2;
private JTextField State;
private JTextField Injury;
private JTextField Progame;
private JTable table;
private static Connection connection;
private static Connection conn;
private static Statement myStmt;
private static final int portNumber = 8082;
private static final String hostname = "192.168.43.145" + "";
private String output;
public ServerSocket serverSocket;
public Socket socket;
public BufferedWriter bw;
public boolean flag_Disconnect = false;
private JTextField textField;
private JTable User_table;
private JTextField textField_1;
private JTable table_1;
private JTable Comment_table;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main window = new Main();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Main() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 599, 479);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new GridLayout(0, 1, 0, 0));
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
frame.getContentPane().add(tabbedPane);
JPanel Main = new JPanel();
tabbedPane.addTab("Main", null, Main, null);
Main.setLayout(new MigLayout("", "[][][][][][grow]", "[][grow][][][][]"));
JTextArea textArea = new JTextArea();
Main.add(textArea, "cell 5 1,grow");
///////////////////////////////////////////////////////////////////////////////////////
JButton Graph = new JButton("Graph");
Graph.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Graph g = new Graph();
g.Graph();
}
});
// panel.add(GraphEMG);
Main.add(Graph, "cell 5 3");
////////////////////////////////////////////////////////////////////////////////////////
JButton Knee_Gui = new JButton("Knee GUI");
Knee_Gui.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Knee_Gui kg = new Knee_Gui();
kg.Knee_gui();
}
});
// panel.add(AccMove);
Main.add(Knee_Gui, "cell 5 4");
JPanel DataBase = new JPanel();
tabbedPane.addTab("DataBase", null, DataBase, null);
DataBase.setLayout(new MigLayout("", "[][][][grow]", "[][][][][][][][][][][grow][][][][][grow]"));
try{
String driver = ("com.mysql.jdbc.Driver");
String url = ("jdbc:mysql://localhost:3306/fydatabase?user=root");
System.out.println("update driver");
Class.forName( driver );
connection = DriverManager.getConnection( url );
conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/userdb?user=root");
myStmt = connection.createStatement();
ResultSet myrs = myStmt.executeQuery("SELECT * FROM `fydatabase'");
while(myrs.next()){
System.out.println(myrs.getString("lastName") + "," + myrs.getString("firstName") + "Thats all folks");
}
}
catch(Exception e){
}
JLabel First_Name = new JLabel("First Name");
DataBase.add(First_Name, "cell 1 1");
First_name = new JTextField();
DataBase.add(First_name, "cell 3 1,growx");
First_name.setColumns(10);
JLabel Last_Name = new JLabel("Last Name");
DataBase.add(Last_Name, "cell 1 2");
Last_name = new JTextField();
DataBase.add(Last_name, "cell 3 2,growx");
Last_name.setColumns(10);
JLabel DOB = new JLabel("Date of Birth");
DataBase.add(DOB, "cell 1 3");
Date_of_birth = new JTextField();
DataBase.add(Date_of_birth, "cell 3 3,growx");
Date_of_birth.setColumns(10);
JLabel Address1 = new JLabel("Address");
DataBase.add(Address1, "cell 1 4");
Address_1 = new JTextField();
DataBase.add(Address_1, "cell 3 4,growx");
Address_1.setColumns(10);
JLabel Address2 = new JLabel("Address");
DataBase.add(Address2, "cell 1 5");
Address_2 = new JTextField();
DataBase.add(Address_2, "cell 3 5,growx");
Address_2.setColumns(10);
JLabel City = new JLabel("City/State");
DataBase.add(City, "cell 1 6");
State = new JTextField();
DataBase.add(State, "cell 3 6,growx");
State.setColumns(10);
JLabel Inj = new JLabel("Injury");
DataBase.add(Inj, "cell 1 7");
Injury = new JTextField();
DataBase.add(Injury, "cell 3 7,growx");
Injury.setColumns(10);
JLabel Prog = new JLabel("Programe");
DataBase.add(Prog, "cell 1 8");
Progame = new JTextField();
DataBase.add(Progame, "cell 3 8,growx");
Progame.setColumns(10);
////////////////////////////////////////////////////////////////////
JButton Update = new JButton("Update");
Update.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
Class.forName ("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/fydatabase?user=root");
PreparedStatement pst = con.prepareStatement("Insert Into data Values(?,?,?,?,?,?,?,?)");
pst.setString(1, First_name.getText());
pst.setString(2, Last_name.getText());
pst.setString(3, Date_of_birth.getText());
pst.setString(4, Address_1.getText());
pst.setString(5, Address_2.getText());
pst.setString(6, State.getText());
pst.setString(7, Injury.getText());
pst.setString(8, Progame.getText());
// pst.setString(7, "44");
System.out.println("In update database");
System.out.println("In update database"+First_name.getText()+Last_name.getText());
JOptionPane.showMessageDialog(null, "Data Saved");
//ResultSet rs = pst.executeQuery();
// myStmt.executeUpdate(sql);
pst.executeUpdate();
pst.close();
con.close();
}
catch(Exception e1){
}
}
});
DataBase.add(Update, "cell 1 10");
JScrollPane scrollPane = new JScrollPane();
DataBase.add(scrollPane, "cell 3 10 1 6,grow");
table = new JTable();
scrollPane.setViewportView(table);
//////////////////////////////////////////////////////////////////////
JButton Find_Person = new JButton("Find Person");
Find_Person.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String query = "SELECT * FROM data where firstName = ?";
PreparedStatement pst;
pst = connection.prepareStatement(query);
System.out.println("got here");
pst.setString(1,First_name.getText());
ResultSet rs1 = pst.executeQuery();
System.out.println(First_name.getText().toString());
table.setModel(DbUtils.resultSetToTableModel(rs1));
System.out.println("got here");
JOptionPane.showMessageDialog(null, "Data Found");
pst.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
DataBase.add(Find_Person, "cell 1 11");
//////////////////////////////////////////////////////////////////////
JButton Show_DB = new JButton("Show Database");
Show_DB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
String query = "SELECT * FROM data";
PreparedStatement pst = connection.prepareStatement(query);
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
DataBase.add(Show_DB, "cell 1 12");
//////////////////////////////////////////////////////////////////////
JButton Delete = new JButton("Delete");
Delete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
String query = "delete FROM data where firstName = ?";
PreparedStatement pst;
pst = connection.prepareStatement(query);
System.out.println("got here");
pst.setString(1,First_name.getText());
pst.execute();
// ResultSet rs1 = pst.executeQuery();
// System.out.println(First_name.getText().toString());
// table.setModel(DbUtils.resultSetToTableModel(rs1));
// System.out.println("got here");
JOptionPane.showMessageDialog(null, "Data Deleted");
pst.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
DataBase.add(Delete, "cell 1 13");
JPanel panel = new JPanel();
tabbedPane.addTab("Exercise UD", null, panel, null);
panel.setLayout(null);
TextArea Exer_textArea = new TextArea();
Exer_textArea.setBounds(10, 37, 558, 187);
panel.add(Exer_textArea);
JButton Update_Exer = new JButton("Update");
Update_Exer.setBounds(10, 306, 89, 23);
panel.add(Update_Exer);
textField_1 = new JTextField();
textField_1.setBounds(10, 260, 124, 20);
panel.add(textField_1);
textField_1.setColumns(10);
JLabel lblEnterClientsNames = new JLabel("Enter Clients UserName");
lblEnterClientsNames.setBounds(10, 241, 232, 14);
panel.add(lblEnterClientsNames);
JLabel lblUpdateClientsExercies = new JLabel("Update Clients Exercies");
lblUpdateClientsExercies.setBounds(10, 17, 170, 14);
panel.add(lblUpdateClientsExercies);
JScrollPane scrollPane_3 = new JScrollPane();
scrollPane_3.setBounds(164, 260, 404, 141);
panel.add(scrollPane_3);
Comment_table = new JTable();
scrollPane_3.setViewportView(Comment_table);
JButton btnComments = new JButton("Comments");
btnComments.setBounds(10, 343, 89, 23);
panel.add(btnComments);
btnComments.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Class.forName ("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/physio?user=root");
String query = "SELECT * FROM names";
PreparedStatement pst = conn.prepareStatement(query);
ResultSet rs = pst.executeQuery();
Comment_table.setModel(DbUtils.resultSetToTableModel(rs));
JOptionPane.showMessageDialog(null, "Comment table");
pst.execute();
pst.close();
conn.close();
} catch (ClassNotFoundException | SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
JPanel panel_1 = new JPanel();
tabbedPane.addTab("User Database", null, panel_1, null);
panel_1.setLayout(new MigLayout("", "[][][grow][][][][][][][][grow]", "[][][][][grow]"));
JButton Update_user_db = new JButton("Update Table");
panel_1.add(Update_user_db, "cell 1 0");
JButton btnUpdateAppTable = new JButton("Update App Table");
panel_1.add(btnUpdateAppTable, "cell 3 0");
btnUpdateAppTable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Class.forName ("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/logindb?user=root");
String query = "SELECT * FROM names";
PreparedStatement pst = conn.prepareStatement(query);
ResultSet rs = pst.executeQuery();
table_1.setModel(DbUtils.resultSetToTableModel(rs));
JOptionPane.showMessageDialog(null, "User Updated");
pst.execute();
pst.close();
conn.close();
} catch (ClassNotFoundException | SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
JButton Delete_Person = new JButton("Delete Person");
panel_1.add(Delete_Person, "cell 3 1");
JScrollPane scrollPane_1 = new JScrollPane();
panel_1.add(scrollPane_1, "cell 4 3 7 2,grow");
User_table = new JTable();
scrollPane_1.setViewportView(User_table);
JButton Find_user_db = new JButton("Find Person");
panel_1.add(Find_user_db, "cell 1 1");
textField = new JTextField();
panel_1.add(textField, "cell 2 1,growx");
textField.setColumns(10);
JScrollPane scrollPane_2 = new JScrollPane();
panel_1.add(scrollPane_2, "cell 1 3 3 2,grow");
table_1 = new JTable();
scrollPane_2.setViewportView(table_1);
Find_user_db.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
System.out.println("got here");
String query = "SELECT * FROM names where ID = ?";
PreparedStatement pst = conn.prepareStatement(query);
System.out.println("got here");
pst.setString(1,textField.getText());
ResultSet rs1 = pst.executeQuery();
System.out.println(textField.getText().toString());
User_table.setModel(DbUtils.resultSetToTableModel(rs1));
System.out.println("got here");
JOptionPane.showMessageDialog(null, "Table updated");
pst.close();
String query1 = "SELECT * FROM names where Name = ?";
Connection conn1 = DriverManager.getConnection("jdbc:mysql://localhost:3306/logindb?user=root");
PreparedStatement pst1 = conn1.prepareStatement(query1);
System.out.println("got here");
pst1.setString(1,textField.getText());
ResultSet rs2 = pst1.executeQuery();
System.out.println(textField.getText().toString());
table_1.setModel(DbUtils.resultSetToTableModel(rs2));
System.out.println("got here");
JOptionPane.showMessageDialog(null, "Table updated");
pst1.close();
System.out.println("got here");
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
Update_user_db.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
Class.forName ("com.mysql.jdbc.Driver");
String query = "SELECT * FROM names";
PreparedStatement pst = conn.prepareStatement(query);
ResultSet rs = pst.executeQuery();
User_table.setModel(DbUtils.resultSetToTableModel(rs));
JOptionPane.showMessageDialog(null, "User Updated");
pst.executeUpdate();
pst.close();
conn.close();
}
catch(Exception e1){
}
}
});
Update_Exer.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent arg0) {
String Exercise = Exer_textArea.getText();
try{
System.out.println("Got here");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/exercise_db?user=root");
// PreparedStatement pst = conn.prepareStatement("Insert Into names(ID,Exercise )" +" Values(?,?)");
// PreparedStatement pst = conn.prepareStatement("update names set Exercise = ? where ID = ?");
String name = textField_1.getText();
PreparedStatement pst1 = conn.prepareStatement("delete FROM names where ID = ?");
pst1.setString(1, name);
pst1.executeUpdate();
PreparedStatement pst2 = conn.prepareStatement("Insert Into names(ID,Exercise )" +" Values(?,?)");
pst2.setString(1, textField_1.getText());
pst2.setString(2, Exer_textArea.getText());
pst2.executeUpdate();
// PreparedStatement pst3 = conn.prepareStatement("Insert Into names(ID,Exercise )" +" Values(?,?)");
// pst3.setString(1, textField_1.getText());
// pst3.setString(2, Exer_textArea.getText());
// pst3.executeUpdate();
System.out.println("After Prepared statment");
//
// pst.setString(1, textField_1.getText());
// // pst.setString(2, Exer_textArea.getText());
// System.out.println("got here");
// int change = pst.executeUpdate();
//
// if(change == 1){
// System.out.println("update");
// }
//
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
}
}
| [
"noreply@github.com"
] | noreply@github.com |
34d3d50b4e2e6429757b5c5de50a52d399b43bfb | 74f434e593d4f612d8e952cc1a0804826ae389d3 | /src/test/java/io/github/rhildred/tddjunit/HSTCalculateTest.java | 33c532412143be2770e9db91c90d1d44fcfa60ae | [] | no_license | rhildred/tddjunit | 0d9a23264b624b9b7b166cd6ef9fa727ab164cbf | f2753b0f9ba93f63d2d4958f78279ae13c654695 | refs/heads/master | 2021-01-10T05:12:03.712784 | 2018-11-21T16:57:26 | 2018-11-21T16:57:26 | 52,756,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 867 | 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 io.github.rhildred.tddjunit;
import java.math.BigDecimal;
import junit.framework.TestCase;
import org.junit.Test;
/**
*
* @author 000382395
*/
public class HSTCalculateTest extends TestCase {
public HSTCalculateTest(String testName) {
super(testName);
}
@Test
public void testCalculate() throws Exception {
System.out.println("calculate");
BigDecimal nIn = null;
String sProv = "";
BigDecimal expResult = null;
BigDecimal result = HSTCalculate.calculate(nIn, sProv);
assertEquals(expResult, result);
fail("The test case is a prototype.");
}
}
| [
"rhildred@gmail.com"
] | rhildred@gmail.com |
86fd32d54923644a4576c96cc2bef033e9ac38bf | c457b8dac279f43aebbecdf1bf163f410b214cd5 | /src/main/java/guru/springframework/recipe/services/ImageService.java | 205df6261163a43ab5eda0ac2107fa219342313c | [] | no_license | DimaSanKiev/spring5-mongo-recipe-app | c999af7c684dc8dc4140c706156e052f7e0718f4 | 95968d302fc7752f3074245dc18f9cefa8ed4d76 | refs/heads/master | 2021-08-07T07:34:24.343115 | 2017-11-07T21:09:53 | 2017-11-07T21:09:53 | 105,572,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package guru.springframework.recipe.services;
import org.springframework.web.multipart.MultipartFile;
public interface ImageService {
void saveImageFile(String recipeId, MultipartFile file);
}
| [
"dmytro.burdyga@gmail.com"
] | dmytro.burdyga@gmail.com |
fc923b8f4cf71cf5af2a741af158f867e1fd39f4 | 77027d59ee5d4d7faaa05bc4f02d15a0faa1234b | /validator/src/main/java/net/zz/validator/constraints/SingleFileUpload.java | 8ebb1fdfaad8ebdaa18114b1673c0eec56c570ea | [] | no_license | freedream520/xlsUtils | 187ce5db85c405d7af068fc30331a173b3751091 | a4d46f788b25f322897ecd33e16e2e0837a95e07 | refs/heads/master | 2021-01-18T06:00:58.597156 | 2015-07-21T16:36:51 | 2015-07-21T16:36:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,615 | java | package net.zz.validator.constraints;
import net.zz.validator.constraintvalidators.SingleFileUploadValidate;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target( { METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@Constraint(validatedBy = SingleFileUploadValidate.class)
/**
* @author ZaoSheng
* 验证上传文件的正确性,可验证大小是否合适,文件格式是否正确等。
* 可直接设置参数值:size 和 contentTypes 两个参数
* size 单位为KB, 默认为 0 ,代表不限制,contentTypes 默认为空数组,代表不限制。
* 如:
* size = 1000000l
* contentTypes = {"image/png","image/jpg"}
*
* 也可以采用配置文件(useConfig),配置文件和size,contentTypes 为互斥,useConfig优先
*/
public @interface SingleFileUpload {
/**
* @return
*/
long size() default 0l;
String[] contentTypes() default {};
/**
* useConfig ,字符串类型,与配置文件参数名的前缀对应,
* 比如前缀foods ,那么对应的配置就是:
* foods_allow_size_kb
* foods_allow_content_type
* 这个配置文件在WEB-INF/classes 目录下
* @return
*/
String useConfig() default "";
boolean allowEmpty() default false;
String message() default "no pictrue you say jb";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
| [
"cnzhengzs@gmail.com"
] | cnzhengzs@gmail.com |
0af82e93f4961e8161835f8d0853b8a946355e31 | 020155578fc8722aaf394866f0f7f1c78bcf966b | /Lab4BankSolutionWithLayers/src/main/java/bank/web/AccountServiceController.java | 552594fbda00fbcd78fd32d6d9b85efdbce3f564 | [] | no_license | MerhawitTeshale/WAA | 7bd01caf18ced148f6a984099b4f96ba3535524a | 88f22a323774742630b762487be717306f55711a | refs/heads/main | 2023-07-29T10:02:55.610009 | 2021-09-05T22:56:44 | 2021-09-05T22:56:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,788 | java | package bank.web;
import java.util.*;
import bank.domain.Account;
import bank.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class AccountServiceController {
@Autowired
AccountService accountService;
@GetMapping("/accounts/{accountnumber}")
public ResponseEntity<?> getAccount(@PathVariable Long accountnumber) {
Account account = accountService.findByAccountNumber(accountnumber);
if (account == null) {
return new ResponseEntity<CustomErrorType>(new CustomErrorType("Account with number= " + accountnumber + " is not available"),HttpStatus.NOT_FOUND);
}
return new ResponseEntity<Account> (account, HttpStatus.OK);
}
@DeleteMapping("/accounts/{accountnumber}")
public ResponseEntity<?> deleteAccount(@PathVariable Long accountnumber) {
Account account = accountService.findByAccountNumber(accountnumber);
if (account == null) {
return new ResponseEntity<CustomErrorType>(new CustomErrorType("Account with number= " + accountnumber + " is not available"),HttpStatus.NOT_FOUND);
}
accountService.delete(accountnumber);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/accounts")
public ResponseEntity<?> handlePost(@RequestParam(value="operation", required = false, defaultValue = "") String operation,
@RequestParam(value="accountNumber", required = false) Long accountNumber,
@RequestParam(value="amount", required = false) Double amount,
@RequestParam(value="accountHolder", required = false) String accountHolder) {
Account account = new Account();
if (operation.equals("")){
//create account
if (accountNumber != 0 && accountHolder != null){
String accountHolderName = accountHolder.substring(1, accountHolder.length()-1); //strip quotes
account = new Account(accountNumber, accountHolderName);
accountService.add(account);
}
}
else{
String operationName = operation.substring(1, operation.length()-1); //strip quotes
if (operationName.equals("deposit")){
accountService.deposit(accountNumber,amount );
}
else if (operationName.equals("withdraw")){
accountService.withdraw(accountNumber,amount );
}
}
return new ResponseEntity<Account> (account, HttpStatus.OK);
}
}
| [
"81270389+haymanot12@users.noreply.github.com"
] | 81270389+haymanot12@users.noreply.github.com |
ec5755a37e69e064e0480c11ed3570439ada41b9 | 1c6a72be0eac640162a946a87c65a91734c32c0b | /demo-create/src/main/java/com/ysw/democreate/listener/HelloApplicationRunner.java | 7195e0bf603a5e74597555c82596d938173e67b9 | [] | no_license | confirmMe/springboot-test | 121b3f56d8e3c4ca3fb131e57bd4a84cbcd819fc | 4dc7d5c788d46644a3c74b8d3ef602e50260226d | refs/heads/master | 2020-08-14T12:41:16.138703 | 2019-10-15T00:28:37 | 2019-10-15T00:28:37 | 215,170,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.ysw.democreate.listener;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class HelloApplicationRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("ApplicationRunner...run....");
}
}
| [
"1693083039@qq.com"
] | 1693083039@qq.com |
356ff553fcf3d89f870123b2a657d4ee928ae6d3 | 5d1019372908d0ee04b5abfcc25bde19a9085765 | /app/src/main/java/com/example/mathpomo/alg.java | 8f86e776c8e6c9b2ca51ba8b8127a6c3e1d2e55f | [] | no_license | Eliza5506/Mathpomo | b596cb8e993fae98705c199232570c92e84245a1 | 47c3fc37b0ff3340b94b274a492d065af04f1803 | refs/heads/master | 2023-05-05T20:56:30.641514 | 2021-05-29T08:34:54 | 2021-05-29T08:34:54 | 366,100,183 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 312 | java | package com.example.mathpomo;
import android.os.Bundle;
import android.view.View;
public class alg extends MainActivity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alg);
}
public void alg(View view) {
}
}
| [
"baza20062006@mail.ru"
] | baza20062006@mail.ru |
84491712321a50b5c3514d77d1f425a3b86c7e26 | 3afe1ceece0c5cf361913661110a4310d06caae3 | /legacy/src/main/java/io/spring/lab/warehouse/item/StubItemRepository.java | 878e1049c93687451759aad3336c03cad5730795 | [] | no_license | kaczynskid/spring-io-lab18 | 0c7eaf9962ada71ea67f3fa06a967b60a1bf3960 | 30e409f81be4ca0a4aaf9115780725d3ddebe69a | refs/heads/master | 2020-05-25T02:43:40.702358 | 2019-05-24T13:44:38 | 2019-05-24T13:44:38 | 187,583,537 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | package io.spring.lab.warehouse.item;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;
import static java.util.Optional.ofNullable;
import static org.apache.commons.lang3.reflect.FieldUtils.writeField;
class StubItemRepository implements ItemRepository {
private final AtomicLong seq = new AtomicLong();
private final Map<Long, Item> db = new HashMap<>();
@Override
public Optional<Item> findOne(long id) {
return Optional.ofNullable(db.get(id));
}
@Override
public List<Item> findAll() {
return new ArrayList<>(db.values());
}
@Override
public Item save(Item item) {
long id = setAndGetNextId(item);
db.put(id, item);
return item;
}
private long setAndGetNextId(Item item) {
try {
long id = ofNullable(item.getId()).orElseGet(seq::incrementAndGet);
writeField(item, "id", id, true);
return id;
} catch (IllegalAccessException e) {
throw new RuntimeException("Unexpected error!", e);
}
}
}
| [
"kaczynskid@gmail.com"
] | kaczynskid@gmail.com |
42d19f407b619cc3b4ff2a974231680a04f917b0 | ba01a90dafb41b69bc35b7f671020672768b86fd | /src/lzf/webserver/core/ValveBase.java | 0d947af17a1a9d9258e04095e99689f44a130ba8 | [] | no_license | abc123lzf/webServer | 50c56134d9add503648333fbb12c572d5d7560d9 | 337aeaea8342b13dc812c9c6b7574d300de8ba5d | refs/heads/master | 2020-03-19T23:43:21.537590 | 2019-05-04T10:38:22 | 2019-05-04T10:38:22 | 137,017,065 | 2 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,030 | java | package lzf.webserver.core;
import java.io.IOException;
import javax.servlet.ServletException;
import lzf.webserver.Container;
import lzf.webserver.Valve;
import lzf.webserver.connector.Request;
import lzf.webserver.connector.Response;
import lzf.webserver.log.Log;
import lzf.webserver.log.LogFactory;
/**
* @author 李子帆
* @version 1.0
* @date 2018年7月12日 下午2:52:27
* @Description 阀门抽象类,阀门实现类应继承该抽象类
*/
public abstract class ValveBase implements Valve {
protected final Log log = LogFactory.getLog(ValveBase.class);
protected Valve next = null;
protected Container<?, ?> container = null;
/**
* 获取下一个管道
* @return Valve 下一个管道
*/
@Override
public Valve getNext() {
return next;
}
/**
* 设置下一个管道
* @param valve 下一个管道实例
*/
@Override
public void setNext(Valve valve) {
this.next = valve;
}
/**
* 获取该阀门所属的容器实例
* @return Container容器实例
*/
@Override
public Container<?, ?> getContainer() {
return container;
}
/**
* 设置该阀门所属的容器实例
* @param container Container容器实例
*/
@Override
public void setContainer(Container<?, ?> container) {
this.container = container;
}
/**
* 阀门具体的业务逻辑实现
* @param request 请求对象
* @param response 响应对象
*/
@Override
public abstract void invoke(Request request, Response response)
throws IOException, ServletException;
/**
* 包含这个管道的类名、容器的名称
* @return 类似lzf.webserver.valve[containerName]
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder(this.getClass().getName());
sb.append('[');
if(getContainer() == null) {
sb.append("Container is null");
} else {
sb.append(getContainer().getName());
}
sb.append(']');
return sb.toString();
}
}
| [
"695199262@qq.com"
] | 695199262@qq.com |
8095f5e3ce69f25ef75608c9754625955c02bf0c | 7769590a912ace8433daf7e838440d8b2c2cb005 | /src/test/java/com/controller/TestControllerTest.java | c4035bb0bd36ea702631ab58d1c80f1c69b7a445 | [] | no_license | qing-feng-hh/bootDemo | 61af87d45635a17c8ea14c1c85b5350d6b7dff94 | c0b4720ef094024e08213778ae2300e961bab6ba | refs/heads/master | 2020-07-11T10:54:47.955004 | 2019-08-26T16:46:38 | 2019-08-26T16:46:38 | 204,519,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.controller;
import com.bean.Person;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @author: hehui
* Date: 2019/8/27
* @Description:
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class TestControllerTest {
@Autowired
private TestController testController;
@Test
public void testAdd() {
Person person = new Person();
testController.testAdd(person);
}
@Test
public void testUpdate() {
Person person = new Person();
person.setName("1");
testController.testUpdate(person);
}
}
| [
"h675107964@163.com"
] | h675107964@163.com |
e21c3940f2cb4e9b84032028c498e8d638c2af18 | c205f88f7c2d8c45956bf5a4f2cf479b2d7f2794 | /Exercises/EjercicioProduccionComponentes/src/ejercicioproduccioncomponentes/EjercicioProduccionComponentes.java | f7d29b3dda566e63af23e4b17ae9721497a254ea | [] | no_license | lorenzofj/java-college | e836973dfd7635e4d78ed133effe1766fea5504b | aade74959a5b6ad1ac9c9dfff99b68d5bed8df35 | refs/heads/main | 2023-07-10T12:52:55.996764 | 2021-08-12T22:28:10 | 2021-08-12T22:28:10 | 395,456,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package ejercicioproduccioncomponentes;
import Vistas.VentanaPrincipal;
public class EjercicioProduccionComponentes {
public static void main(String[] args) {
VentanaPrincipal ventana = new VentanaPrincipal();
ventana.setVisible(true);
}
}
| [
"110830@tecnicatura.frc.utn.edu.ar"
] | 110830@tecnicatura.frc.utn.edu.ar |
bc300b13577ee497ee4a334a6de92ec7bfe68c68 | 440c767120d2ef53742d71eb5d3d5dba5e1e15c1 | /workspace/workspace/WisdomCity/src/main/java/com/web/entity/LightTeamRelation.java | 2c51557bf739297ca6aabdaa0e8a2ec7d096b100 | [] | no_license | SHHXWLWKJYXGS/Data | fac8d65e46629571f2e5b34a95664fe80c3a396f | 1ac70420383a9f87a789cfbef1f325483e28457a | refs/heads/master | 2023-08-03T15:08:08.772051 | 2020-07-06T02:54:06 | 2020-07-06T02:54:06 | 278,303,356 | 0 | 0 | null | 2023-07-15T05:12:31 | 2020-07-09T08:09:17 | JavaScript | UTF-8 | Java | false | false | 412 | java | package com.web.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@SuppressWarnings("serial")
@AllArgsConstructor
@NoArgsConstructor
@Data
@Accessors(chain = true)
public class LightTeamRelation implements Serializable {
private Integer id;
private Integer teamid;
private Integer lightid;
}
| [
"849248205@qq.com"
] | 849248205@qq.com |
6ab7bec63bea2aa5421de4036663d663b35e5a26 | bcaf64dc92e12f8695e33c1ef80215d4179bf039 | /Android/app/src/main/java/com/example/muscleup/SignUpActivity.java | 20aca53421aec03084bd6d7b7505fc4ff1958fab | [] | no_license | Muscle-Up/Muscle-Up-Android | fefb6d74c00bb047ff53919ee22a9bb0af930395 | 371633b69b0d735d4bd2fecd1a22088f68b80639 | refs/heads/main | 2023-03-10T21:15:51.280412 | 2020-11-24T00:19:09 | 2020-11-24T00:19:09 | 315,466,706 | 0 | 1 | null | 2021-01-20T11:08:12 | 2020-11-23T23:33:43 | Java | UTF-8 | Java | false | false | 618 | java | package com.example.muscleup;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class SignUpActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup);
}
public void backButton_Click(View view) {
this.finish();
}
public void nextButton_Click(View view) {
Intent intent = new Intent(this, SignUpActivity2.class);
startActivity(intent);
}
} | [
"youjmen15@gmail.com"
] | youjmen15@gmail.com |
ff9c988622621b7f7ff5c843cd79a4e32e83cd1c | 5630f1d7e15364e5ad3ce81b35f6830843c6e219 | /src/test/java/org/robolectric/shadows/LayoutAnimationControllerTest.java | c0be92e75d990e63d9e56d4b684132f4c7352d98 | [
"MIT"
] | permissive | qx/FullRobolectricTestSample | f0933149af29d37693db6e8da795a64c2e468159 | 53e79e4de84bbe4759a09a275d890b413ce757e7 | refs/heads/master | 2021-07-03T16:07:17.380802 | 2014-06-16T23:22:01 | 2014-06-16T23:22:01 | 20,903,797 | 2 | 3 | MIT | 2021-06-04T01:07:56 | 2014-06-16T23:20:19 | Java | UTF-8 | Java | false | false | 802 | java | package org.robolectric.shadows;
import android.view.animation.LayoutAnimationController;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.TestRunners;
import static org.fest.assertions.api.Assertions.assertThat;
@RunWith(TestRunners.WithDefaults.class)
public class LayoutAnimationControllerTest {
private ShadowLayoutAnimationController shadow;
@Before
public void setup() {
LayoutAnimationController controller = new LayoutAnimationController(Robolectric.application, null);
shadow = Robolectric.shadowOf(controller);
}
@Test
public void testResourceId() {
int id = 1;
shadow.setLoadedFromResourceId(1);
assertThat(shadow.getLoadedFromResourceId()).isEqualTo(id);
}
}
| [
"qx.ouyang@gmail.com"
] | qx.ouyang@gmail.com |
386581f886fd2c1ad7181cc0e1d226d3cd976500 | 34bb6be9f81d8a052d05318ab7cd63eadf4bf9c2 | /student-microservices/src/main/java/com/microservices/student/web/rest/errors/ParameterizedErrorVM.java | 674685c3fcc42520a55d29112238ac9ef6e6f425 | [] | no_license | jreyesromero/jhipster-microservices | 4a3786f22e44bb8c9dcecb737bf78d6e65bc9aaa | b809f19226487f5617f7915143542525624f994f | refs/heads/master | 2021-01-18T13:16:21.511903 | 2017-03-10T17:08:13 | 2017-03-10T17:08:13 | 80,745,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package com.microservices.student.web.rest.errors;
import java.io.Serializable;
/**
* View Model for sending a parameterized error message.
*/
public class ParameterizedErrorVM implements Serializable {
private static final long serialVersionUID = 1L;
private final String message;
private final String[] params;
public ParameterizedErrorVM(String message, String... params) {
this.message = message;
this.params = params;
}
public String getMessage() {
return message;
}
public String[] getParams() {
return params;
}
}
| [
"vagrant@vagrant.vm"
] | vagrant@vagrant.vm |
e0bcf0d7d12f008d5f2bcc186fbb0a2432c63576 | 51ed0f35df7b60829eb5cb8c9fc163b81745435d | /src/servidor/TCPServidor.java | 598547d94c7f7c405250e5d4b7260239f972e44e | [] | no_license | andersongomes/CLienteDeCorreio | 7246a8de74aae58d1283b1c8eca818bbb846b735 | fb6a37a5740ae0cf08d9665c37276e6fe8102c17 | refs/heads/master | 2021-01-23T00:15:10.496890 | 2012-10-08T16:27:57 | 2012-10-08T16:27:57 | 6,127,439 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | package servidor;
/**
*
* @author Anderson Gomes
*/
import java.io.IOException;
import java.io.PrintStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import utils.TrataCliente;
public class TCPServidor {
public static void main(String[] args) throws IOException {
// inicia o servidor
new TCPServidor(12345).executa();
}
private int porta;
private List<PrintStream> clientes;
public TCPServidor(int porta) {
this.porta = porta;
this.clientes = new ArrayList<PrintStream>();
}
public void executa() throws IOException {
ServerSocket servidor = new ServerSocket(this.porta);
System.out.println("Porta 12345 aberta!");
while (true) {
// aceita um cliente
Socket cliente = servidor.accept();
System.out.println("Nova conexão com o cliente "
+ cliente.getInetAddress().getHostAddress());
// adiciona saida do cliente a lista
PrintStream ps = new PrintStream(cliente.getOutputStream());
this.clientes.add(ps);
// cria tratador de cliente numa nova thread
TrataCliente tc = new TrataCliente(cliente.getInputStream(), this);
new Thread(tc).start();
}
}
public void distribuiMensagem(String msg) {
//envia mensagem para todo mundo
for(PrintStream cliente : this.clientes ){
cliente.println(msg);
}
}
}
| [
"anderson.uece@gmail.com"
] | anderson.uece@gmail.com |
86a429cd900b551730664e541c762957767ddf7e | 4eea31d47100db3260dc2ad970de7f2c8267fac8 | /Lab10/src/Bank.java | 042e73adaa586558b718603825e8fb3c2f2a760d | [] | no_license | LukeWong74/CSC2044-Practical-Lab | 5a6bd6eb40c898be3e12d0ad82575d4f51df63f1 | 78750b5482c5515d3dcf007cb6f1e983c3718777 | refs/heads/master | 2021-01-21T16:53:14.547591 | 2016-06-15T07:36:28 | 2016-06-15T07:36:28 | 56,135,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java |
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
public class Bank {
ReentrantLock lock = new ReentrantLock();
Condition condition = lock.newCondition();
AtomicInteger balance;
public Bank(int value){
this.balance = new AtomicInteger(value);
}
public int deposit(int value){
lock.lock();
try{
int value1 = balance.addAndGet(value);
condition.signalAll();
return value1;
} finally{
lock.unlock();
}
}
public int withdraw(int value) throws InterruptedException{
lock.lock();
try {
while(balance.get() < value){
System.out.println("The withdraw amount is greater than available balance.\n");
condition.await();
}
return balance.addAndGet(-value);
}
finally{
lock.unlock();
}
}
public int balance(){
return balance.get();
}
}
| [
"14070262@imail.sunway.edu.my"
] | 14070262@imail.sunway.edu.my |
f0c1ca77b035044e02179ffc541ee9ca30f5f487 | e55f5c452c9d39c744e92bd987388adf024d7cac | /dominoes-browser/src/test/java/org/jpires/dominoes/lib/MockWebGame.java | d3a5d1022f701ba8789f9d829183a1e91fc53c8c | [] | no_license | jppires91/dominoes | 053dcf203a44352ae77ccc9fa3af868271d8e278 | 2734ca6e2ada7b53cfb8fdada3ac2fdcf8af9e6f | refs/heads/master | 2023-03-04T03:50:24.344181 | 2021-01-30T11:34:23 | 2021-01-30T11:34:23 | 334,395,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package org.jpires.dominoes.lib;
import org.jpires.dominoes.lib.model.DominoPiece;
import org.jpires.dominoes.lib.model.WebPlayer;
import java.util.LinkedList;
import java.util.Queue;
/**
* @author Joao Pires (jppires91@gmail.com)
*/
public class MockWebGame extends WebGame {
public MockWebGame(final WebPlayer player1, final WebPlayer player2, final Queue<DominoPiece> stock, final LinkedList<DominoPiece> board) {
super(player1, player2, stock, board);
}
}
| [
"jppires91@gmail.com"
] | jppires91@gmail.com |
06953c85cde8e4a9ec4d3cc61d8681f34d034d4d | 09dae8d6988b400282cb485b0bab47ebece7f47b | /src/ㄆㄆ.java | d6bca07820de4e0243bdc7c354aaf606c97bd75d | [] | no_license | brianc5/Lab-3-CS125 | f226034cc46cc230bf5cd7112bee8f6440d86462 | b4b5660ea996ecd739d105e12448ad85531fd0e8 | refs/heads/master | 2020-03-29T04:04:22.169493 | 2018-09-19T21:00:06 | 2018-09-19T21:00:06 | 149,514,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 77 | java | public class ㄆㄆ {
public static void main(String[] args) {
}
}
| [
"brianc5@illinois.edu"
] | brianc5@illinois.edu |
317421f0b14b4cb0c0ebe1d1bed637329571bd64 | c4b69f265c95c07b7624f711f0911be1ab3fae8a | /app/src/main/java/com/group/creation/domisol/diary/Swipable.java | 9ccce3f730f5671e4fc4b9ed12e20e54c88a08e0 | [] | no_license | creation-group-domisol/diary | 5edbc5bde554af9d245c4c7be6e2a40bf15b2b47 | 08a35e280898d68ae97d1331b6a69130962a0c39 | refs/heads/master | 2020-12-31T07:34:18.047204 | 2017-04-03T13:00:01 | 2017-04-03T13:00:01 | 86,535,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 167 | java | package com.group.creation.domisol.diary;
/**
* Created by daumkakao on 2017. 4. 3..
*/
public interface Swipable {
void swipeLeft();
void swipeRight();
}
| [
"frank.park@kakaocorp.com"
] | frank.park@kakaocorp.com |
ae1bda6543ea2f1a7385e5cba19bb5722e4b4a99 | fc335d8caa2c88a88f20504f6a35a96bfe6e031c | /SimpleBoard/src/com/doheum/sb/Utils.java | ffee978808cf6423defd239cc339b6a780d30cd4 | [] | no_license | jiwon91/sbsSimpleBoard | 689ccbd6c0fb3e041c324e6c8acc6fb9b72886b6 | e71f706a0029c3a79d358c70bed02719bcd16d86 | refs/heads/master | 2020-09-06T14:56:26.663597 | 2019-11-02T02:18:32 | 2019-11-02T02:18:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.doheum.sb;
public class Utils {
public static int parseStringToInt(String v) {
int result = 0;
try {
result = Integer.parseInt(v);
}catch(Exception e) {
result = 0;
}
return result;
}
}
| [
"ggomee2323@gmail.com"
] | ggomee2323@gmail.com |
eaf542585af8442f0b938bf94753c37bc788f7b9 | 2eaf528080fa32b2a31640f40cf67465f22d7e3c | /app/src/main/java/com/example/getoutpolio/RegistredTeams.java | 64200f7c6d55b3e78c5f3b4b8eb9a51caa597a16 | [] | no_license | muhammadrashid123/GetoutPolio | 738d344b166fba5eb36152ebddab60274f98dac8 | 1ab89a73888f41027bc2b2337c828c7253891dcd | refs/heads/master | 2023-01-03T01:56:54.697377 | 2020-11-01T06:11:06 | 2020-11-01T06:11:06 | 260,453,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,509 | java | package com.example.getoutpolio;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class RegistredTeams extends AppCompatActivity {
private Button searchBtn,editBtn,deleteBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registred_teams);
searchBtn=findViewById(R.id.search_team_Btn_id);
editBtn=findViewById(R.id.edit_team_Btn_id);
deleteBtn=findViewById(R.id.delete_team_Btn_id);
searchBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(RegistredTeams.this,SearchTeamInfoActivity.class);
startActivity(intent);
}
});
editBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(RegistredTeams.this,EditTeamInfoActivity.class);
startActivity(intent);
}
});
deleteBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(RegistredTeams.this,DeleteTeamInfoActivity.class);
startActivity(intent);
}
});
}
}
| [
"mrashid6695@gmail.com"
] | mrashid6695@gmail.com |
6a6c387dc32e48e2c858f6844f0c800fd9563114 | 7c3f3524d379413bdb24316f024da2377ca9a5fe | /src/main/java/onbiz/controller/ErrorCtrl.java | 3a74635b354660d5e3a96540fbb3bae2a9106053 | [] | no_license | heyjinss/Pms_project_T | fcebdd5f64b5f1a25ecc0b756b52d338ed57936f | ac702cbb82b67739faacff8e195fd46a87998dc7 | refs/heads/main | 2023-08-28T08:50:33.015389 | 2021-11-16T17:00:14 | 2021-11-16T17:00:14 | 424,552,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package onbiz.controller;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@Component
@ControllerAdvice("onbiz")
public class ErrorCtrl {
@ExceptionHandler(Exception.class)
public String errorPage(Model model,Exception ex) {
//무슨 에러인지 확인하기 위해서 메세지 저장
model.addAttribute("error",ex.getMessage());
//error 디렉토리의 error.jsp 파일을 에러 페이지로 설정
return "error/error404";
}
}
| [
"heyjinss@naver.com"
] | heyjinss@naver.com |
948eec0af43dea8525f5ab8551620c0e5c02c49e | b661d742ac874319b31ff9f8452f5535d3458395 | /spider-flow/spider-flow-core/src/main/java/org/spiderflow/core/job/SpiderJob.java | 7c818b76f8851134a9570e595caf97b0dac1fd0e | [] | no_license | jinjin123/forexspider | b016438faebf0dafdbdc663730e438bb9dffec8a | 01b629e609795c2ba3f20c78d42103c86109c657 | refs/heads/master | 2022-12-12T15:44:11.088372 | 2020-02-08T11:02:47 | 2020-02-08T11:02:47 | 218,417,697 | 5 | 1 | null | 2022-12-10T07:08:04 | 2019-10-30T01:30:24 | JavaScript | UTF-8 | Java | false | false | 2,338 | java | package org.spiderflow.core.job;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.spiderflow.core.Spider;
import org.spiderflow.core.model.SpiderFlow;
import org.spiderflow.core.service.SpiderFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;
/**
* 爬虫定时执行
* @author Administrator
*
*/
@Component
public class SpiderJob extends QuartzJobBean{
private static Spider spider;
private static SpiderFlowService spiderFlowService;
@Value("${spider.job.enable:true}")
private boolean spiderJobEnable;
@Value("${spider.job.log.path:./}")
private String spiderLogPath;
@Override
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
if(!spiderJobEnable){
return;
}
JobDataMap dataMap = context.getMergedJobDataMap();
SpiderFlow spiderFlow = (SpiderFlow) dataMap.get(SpiderJobManager.JOB_PARAM_NAME);
run(spiderFlow,context.getNextFireTime());
}
public void run(String id){
run(spiderFlowService.getById(id),null);
}
public void run(SpiderFlow spiderFlow,Date nextExecuteTime){
Date now = new Date();
SpiderJobContext context = SpiderJobContext.create(this.spiderLogPath, spiderFlow.getId() + ".log");
try{
context.info("开始执行任务{}",spiderFlow.getName());
spider.run(spiderFlow,context);
context.info("执行任务{}完毕,下次执行时间:{}",spiderFlow.getName(),nextExecuteTime == null ? null: DateFormatUtils.format(nextExecuteTime, "yyyy-MM-dd HH:mm:ss"));
} catch (Exception e) {
context.error("执行任务{}出错",spiderFlow.getName(),e);
} finally{
context.close();
}
spiderFlowService.executeCountIncrement(spiderFlow.getId(), now, nextExecuteTime);
}
@Autowired
public void setSpider(Spider spider) {
SpiderJob.spider = spider;
}
@Autowired
public void setSpiderFlowService(SpiderFlowService spiderFlowService) {
SpiderJob.spiderFlowService = spiderFlowService;
}
}
| [
"1293813551@qq.com"
] | 1293813551@qq.com |
02b6c07ee4ea32392a586223af23fe8a6d90ff6d | 25b23739ab5bf01cf4e4686b58fb5a5dd8521994 | /Three.java | a29dde678fbf9929638f1753baf3e640ea4ebec6 | [] | no_license | Indranil27071997/Assignment-1 | 2169a7a30f9fc0f5c12a6138e14ff1c80cf03eb0 | 1eba12e3aaf269603bef3c120607d0dc9cc4923f | refs/heads/master | 2022-11-22T19:20:37.259383 | 2020-07-16T03:10:16 | 2020-07-16T03:10:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,316 | java | package indranil;
import java.util.Scanner;
public class Three {
public static void main(String[] strings) {
Scanner input = new Scanner(System.in);
int number_Of_DaysInMonth = 0;
String MonthOfName = "Unknown";
System.out.print("Input a month number: ");
int month = input.nextInt();
System.out.print("Input a year: ");
int year = input.nextInt();
switch (month) {
case 1:
MonthOfName = "January";
number_Of_DaysInMonth = 31;
break;
case 2:
MonthOfName = "February";
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
number_Of_DaysInMonth = 29;
} else {
number_Of_DaysInMonth = 28;
}
break;
case 3:
MonthOfName = "March";
number_Of_DaysInMonth = 31;
break;
case 4:
MonthOfName = "April";
number_Of_DaysInMonth = 30;
break;
case 5:
MonthOfName = "May";
number_Of_DaysInMonth = 31;
break;
case 6:
MonthOfName = "June";
number_Of_DaysInMonth = 30;
break;
case 7:
MonthOfName = "July";
number_Of_DaysInMonth = 31;
break;
case 8:
MonthOfName = "August";
number_Of_DaysInMonth = 31;
break;
case 9:
MonthOfName = "September";
number_Of_DaysInMonth = 30;
break;
case 10:
MonthOfName = "October";
number_Of_DaysInMonth = 31;
break;
case 11:
MonthOfName = "November";
number_Of_DaysInMonth = 30;
break;
case 12:
MonthOfName = "December";
number_Of_DaysInMonth = 31;
}
System.out.print(MonthOfName + " " + year + " has " + number_Of_DaysInMonth + " days\n");
}
} | [
"noreply@github.com"
] | noreply@github.com |
c7aa08a89e4725447bac3f21348c6bab127bdfbf | 3431cfe2082218157562c55de5d1d422bde1c9bf | /src/main/java/peaner/platform/sdk/api/alipay/pay/MobileTradeBizContentBean.java | 254a2b73aef6bbd10b68390bfdd0593859d63cdb | [] | no_license | peaner/platform-sdk | 34d9e44dbb043996e163f93c9f429f0dbcb495a3 | 376763708af115c32bf98f86111f66661344a4a5 | refs/heads/master | 2022-11-21T22:00:22.986303 | 2019-05-28T03:38:30 | 2019-05-28T03:38:30 | 140,825,092 | 0 | 0 | null | 2022-11-16T05:46:43 | 2018-07-13T09:13:26 | CSS | UTF-8 | Java | false | false | 3,727 | java | package peaner.platform.sdk.api.alipay.pay;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;
import peaner.platform.sdk.common.requestBean.extend.ExtUserInfo;
import peaner.platform.sdk.common.requestBean.extend.ExtendParams;
import peaner.platform.sdk.common.requestBean.extend.InvoiceInfo;
import peaner.platform.sdk.common.requestBean.extend.RoyaltyInfo;
import peaner.platform.sdk.common.requestBean.extend.SettleInfo;
import peaner.platform.sdk.common.requestBean.extend.SubMerchant;
/**
* @Author: lilongzhou
* @Description:
* @Date: Created in 18-7-5 下午6:30
**/
@Setter
@Getter
public class MobileTradeBizContentBean {
/**
* 订单描述
*/
private String body;
/**
* 订单标题
*/
private String subject;
/**
* 商户订单号
*/
@SerializedName("out_trade_no")
private String outTradeNo;
/**
* 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。
*/
@SerializedName("timeout_express")
private String timeoutExpress;
/**
* 绝对超时时间
*/
@SerializedName("time_expire")
private String timeExpire;
/**
* 订单总金额,单位为元,
*/
@SerializedName("total_amount")
private Double totalAmount;
/**
* 如果该值为空,则默认为商户签约账号对应的支付宝用户ID
*/
@SerializedName("seller_id")
private String sellerId;
/**
* 针对用户授权接口,获取用户相关数据时,用于标识用户授权关系
*/
@SerializedName("auth_token")
private String authToken;
/**
* 商品主类型 :0-虚拟类商品,1-实物类商品
*/
@SerializedName("goods_type")
private String goodsType;
/**
* 公用回传参数
*/
@SerializedName("passback_params")
private String passbackParams;
/**
* 用户付款中途退出返回商户网站的地址
*/
@SerializedName("quit_url")
private String quitUrl;
/**
* 销售产品码
*/
@SerializedName("product_code")
private String productCode;
/**
* 优惠参数
* 注:仅与支付宝协商后可用
*/
@SerializedName("promo_params")
private String promoParams;
/**
* 描述分账信息
*/
@SerializedName("royalty_info")
private RoyaltyInfo royaltyInfo;
/**
* 业务扩展参数
*/
@SerializedName("extend_params")
private ExtendParams extendParams;
/**
* 间连受理商户信息体
*/
@SerializedName("sub_merchant")
private SubMerchant subMerchant;
/**
* 可用渠道,用户只能在指定渠道范围内支付
*/
@SerializedName("enable_pay_channels")
private String enablePayChannels;
/**
* 禁用渠道,用户不可用指定渠道支付
*/
@SerializedName("disable_pay_channels")
private String disablePayChannels;
/**
* 商户门店编号
*/
@SerializedName("store_id")
private String storeId;
/**
* 描述结算信息
*/
@SerializedName("settle_info")
private SettleInfo settleInfo;
/**
* 开票信息
*/
@SerializedName("invoice_info")
private InvoiceInfo invoiceInfo;
/**
* 指定渠道,目前仅支持传入pcredit
*/
@SerializedName("specified_channel")
private String specifiedChannel;
/**
* 商户传入业务信息
*/
@SerializedName("business_params")
private String businessParams;
/**
* 外部指定买家
*/
@SerializedName("ext_user_info")
private ExtUserInfo extUserInfo;
}
| [
"3221861322@qq.com"
] | 3221861322@qq.com |
5b14e0698fb4289d0921af4418cfed1aa66feeed | 5ae3df3fc4b678f00e88c86d7ce6b1908acd4573 | /eitax-batch-core/src/main/java/com/eitax/recall/dao/RecallDAO.java | 7dadc493a264142753365b181ac0c4c6aa2061ca | [
"Apache-2.0"
] | permissive | shokoro3434/test2 | 88a8072f9a8ae4d1b0fdf522afeea84a357008d5 | 499ac8de93f3952bd9f2d81bf0f727ca18e522b3 | refs/heads/master | 2021-01-21T14:12:19.158142 | 2016-03-01T23:47:17 | 2016-03-01T23:47:17 | 41,813,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | package com.eitax.recall.dao;
import java.util.List;
import com.eitax.recall.model.Recall;
public interface RecallDAO {
public abstract List<Recall> findAll();
public abstract List<Recall> findByDelFlag(Integer delFlag);
public abstract List<Recall> findByEbayFlag(Integer ebayFlag);
public abstract int updateYahooPageCntByRecallId(Integer recallId,Integer available,Integer yahooAuctionPageCnt);
}
| [
"takahiro@ThinkPadX201"
] | takahiro@ThinkPadX201 |
bb9673e3390a9140f0e5fe404a494389458540a5 | 67d02364c1c0a781187ae1087be61e801444852e | /arrays/Guess The Maximum Cash.java | 67f4d5e8f7d22a203fe7ac5bfd34b80ad3247448 | [] | no_license | priyansh1114/prepbytes-solutions | 9e456a9aba78380aa126cc3fb1b53e4336ef39f1 | 1b6cb1a8f1529441fcf77d56db35ca112cd29b44 | refs/heads/master | 2023-05-08T10:10:31.943034 | 2021-06-03T15:18:35 | 2021-06-03T15:18:35 | 373,547,615 | 0 | 0 | null | 2021-06-03T15:03:08 | 2021-06-03T15:03:07 | null | UTF-8 | Java | false | false | 841 | java | import java.io.*;
import java.util.*;
class Main
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
int t=Integer.parseInt(bu.readLine());
while(t-->0)
{
String s[]=bu.readLine().split(" ");
int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),x=Integer.parseInt(s[2]),y=Integer.parseInt(s[3]);
int max=n*(y-1)+x;
int ans=1,i;
for(i=2;i*i<=max;i++)
if(max%i==0)
{
ans=i;
while(max%i==0)
max/=i;
}
if(max>=2) ans=Math.max(ans,max);
sb.append("$ "+ans+"\n");
}
System.out.print(sb);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
fd7ad73f5bcbecd190cd09e3c7a793c4c9c06fd9 | 024bc11966dfbd8049a10c306025fa6bbcdeba29 | /src/com/vincent/leetcode/BalancedBinaryTree110.java | 9a9f9326710e61488c54a52dea8c50ce36955839 | [] | no_license | ys588281/leetcode_practice | 5b8e4f8cca1519ff3d89d7d0b0d0c238c1cfb622 | 6f3ecdc18b95d906dc31d9e8faae3b4e6a9d8d29 | refs/heads/main | 2023-02-24T17:44:13.198698 | 2021-01-29T14:21:55 | 2021-01-29T14:21:55 | 334,167,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.vincent.leetcode;
public class BalancedBinaryTree110 {
public static void main(String[] args) {
}
public static boolean balancedBinaryTree(TreeNode root) {
if (root == null) return true;
int left = maxDepth(root.left);
int right = maxDepth(root.right);
return balancedBinaryTree(root.left) && balancedBinaryTree(root.right) && Math.abs(left - right) <= 1;
}
private static int maxDepth(TreeNode root) {
if (root == null) return 0;
return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
}
}
| [
"yuhsiang.wen@paypay-corp.co.jp"
] | yuhsiang.wen@paypay-corp.co.jp |
3bb8699b737cdb4654253b89f143426185463202 | 2b1821134bb02ec32f71ddbc63980d6e9c169b65 | /design-patterns/src/main/java/com/github/mdssjc/design_patterns/behavioral/state/ConcreteStateA.java | 1acc652cf004d6968abfe357ebcd9c1bbc7a5ab1 | [] | no_license | mdssjc/study | a52f8fd6eb1f97db0ad523131f45d5caf914f01b | 2ca51a968e254a01900bffdec76f1ead2acc8912 | refs/heads/master | 2023-04-04T18:24:06.091047 | 2023-03-17T00:55:50 | 2023-03-17T00:55:50 | 39,316,435 | 3 | 1 | null | 2023-03-04T00:50:33 | 2015-07-18T23:53:39 | Java | UTF-8 | Java | false | false | 261 | java | package com.github.mdssjc.design_patterns.behavioral.state;
/**
* Concrete State A.
*
* @author Marcelo dos Santos
*
*/
public class ConcreteStateA implements State {
@Override
public void handle() {
System.out.println("Concrete State A");
}
}
| [
"mdssjc@gmail.com"
] | mdssjc@gmail.com |
f7e9f020b82a1cd39ea00018666c6bd877b7bed6 | 6ddde1b5a917e39ce89185ffc91ac2a8b7e4d886 | /src/main/java/com/antelopeh/core/security/CustomAccessDeniedHandler.java | 96feea31de05551f3e79dc7eeecffa0afe13907d | [] | no_license | antelopeh/sky | 282fbdcbed73440f3abe45a5e53e2245998d0c30 | a57e2824654cd2d90d01014cdebf66eeec4b237a | refs/heads/master | 2023-04-19T15:14:12.023891 | 2021-05-05T06:02:48 | 2021-05-05T06:02:48 | 305,877,900 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,759 | java | package com.antelopeh.core.security;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandlerImpl;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 权限认证模块异常处理。
*
*
*/
public class CustomAccessDeniedHandler extends AccessDeniedHandlerImpl {
/**
* 添加override说明。
*
* @see org.springframework.security.web.access.AccessDeniedHandlerImpl#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.security.access.AccessDeniedException)
*/
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException {
boolean ajax = ajaxRequest(request);
if (ajax) {
RequestDispatcher dispatcher = request.getRequestDispatcher("/403");
dispatcher.forward(request, response);
super.handle(request, response, accessDeniedException);
} else if (!response.isCommitted()) {
super.handle(request, response, accessDeniedException);
}
}
/**
* 添加方法功能描述。
*
* @param request
* 请求参数
* @return 是否为AJAX请求
*
*/
private boolean ajaxRequest(HttpServletRequest request) {
String header = request.getHeader("X-Requested-With");
return StringUtils.equalsIgnoreCase("XMLHttpRequest", header);
}
}
| [
"12345678"
] | 12345678 |
f9a8adaa79ba60df581a8a0ec90c87b6ac178490 | c2a011627f71d4cc66832fbedc1fa5766e50dbcf | /target/classes/com/yixunlian/pojo/BackgroundPublishingJournalism.java | 14b12eba939fe8f5c5ed042d64db09dd503ff410 | [] | no_license | is-ZYL/yixunlian | b0a4b2505f48491939dfd3a6baca9a9781300932 | ffc1b3efc0c1a1908d5b067c7ea0158383f357dd | refs/heads/master | 2020-04-08T15:37:32.972815 | 2018-12-10T10:42:33 | 2018-12-10T10:42:33 | 159,485,977 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,031 | java | package com.yixunlian.pojo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* td_background_publishing_journalism
*/
@Table(name = "td_background_publishing_journalism")
public class BackgroundPublishingJournalism extends BasePojo {
/**
* 后台人员选择发送新闻发送到那个模块的新闻表
*/
@Id
private String backgroundJournalismTypeid;
/**
* 新闻类型
*/
private String journalismType;
/**
* 备注
*/
private String remark;
/**
* 备注
*
* @return remark
*/
public String getRemark() {
return remark;
}
/**
* 备注
*
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* 后台人员选择发送新闻发送到那个模块的新闻表
*
* @return background_journalism_typeid
*/
public String getBackgroundJournalismTypeid() {
return backgroundJournalismTypeid;
}
/**
* 后台人员选择发送新闻发送到那个模块的新闻表
*
* @param backgroundJournalismTypeid
*/
public void setBackgroundJournalismTypeid(String backgroundJournalismTypeid) {
this.backgroundJournalismTypeid = backgroundJournalismTypeid == null ? null : backgroundJournalismTypeid.trim();
}
/**
* 新闻类型
*
* @return journalism_type
*/
public String getJournalismType() {
return journalismType;
}
/**
* 新闻类型
*
* @param journalismType
*/
public void setJournalismType(String journalismType) {
this.journalismType = journalismType == null ? null : journalismType.trim();
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
} | [
"39947605+is-ZYL@users.noreply.github.com"
] | 39947605+is-ZYL@users.noreply.github.com |
002984ca7317b276426a556b2184f72f3192b778 | 094fa416c4c240dbc2e7ee891210dc427769241e | /src/main/java/com/automation/utils/BaseHTMLReporter.java | a1c47658267104680b7b707e32655116daa3bf18 | [] | no_license | almer335/AutomationHR | 289655ab1372c8c27e4526af253b5e90348adf02 | 1ccb51d5b15460047a575b4b74eb776b12aef798 | refs/heads/master | 2023-06-19T01:58:50.838210 | 2021-07-05T16:41:47 | 2021-07-05T16:41:47 | 383,185,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,388 | java | package com.automation.utils;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.markuputils.ExtentColor;
import com.aventstack.extentreports.markuputils.MarkupHelper;
import com.automation.webdriver.ExtendedWebDriver;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import java.io.File;
import java.io.IOException;
public class BaseHTMLReporter implements ITestListener {
private static final Logger LOGGER = LoggerFactory.getLogger(BaseHTMLReporter.class);
private static ExtentReports extent = ExtentManager.createInstance();
private static ExtentTest test;
private ExtendedWebDriver extendedWebDriver;
@Override
public synchronized void onTestStart(ITestResult result) {
LOGGER.info((result.getMethod().getMethodName() + " started!"));
extendedWebDriver = (ExtendedWebDriver) result.getAttribute("driver");
test = extent.createTest(result.getTestClass().getRealClass().getSimpleName() + " :: " + result.getMethod().getMethodName(),result.getMethod().getDescription());
test.assignCategory(result.getTestClass().getRealClass().getSimpleName());
}
@Override
public synchronized void onStart(ITestContext context) {
}
@Override
public synchronized void onFinish(ITestContext context) {
extent.flush();
}
@Override
public synchronized void onTestSuccess(ITestResult result) {
LOGGER.info((result.getMethod().getMethodName() + " passed!"));
test.log(Status.PASS, MarkupHelper.createLabel("Test Case PASSED", ExtentColor.GREEN));
}
@Override
public synchronized void onTestFailure(ITestResult result) {
String methodName = result.getMethod().getMethodName();
LOGGER.error(methodName + " failed!");
test.log(Status.FAIL, MarkupHelper.createLabel("Test case FAILED due to below issues:", ExtentColor.RED));
test.fail(result.getThrowable());
if (extendedWebDriver != null) {
WebDriver augmentedDriver = extendedWebDriver.getAugmentedDriver();
File source = ((TakesScreenshot)augmentedDriver).getScreenshotAs(OutputType.FILE);
File destination = new File("target/Extent/" + methodName + ".PNG");
try {
FileUtils.copyFile(source, destination);
test.addScreenCaptureFromPath(destination.getPath()).fail(result.getThrowable());
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public synchronized void onTestSkipped(ITestResult result) {
LOGGER.info((result.getMethod().getMethodName() + " skipped!"));
test.log(Status.SKIP, MarkupHelper.createLabel("Test Case SKIPPED", ExtentColor.ORANGE));
test.skip(result.getThrowable());
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult result) {
LOGGER.info(("onTestFailedButWithinSuccessPercentage for " + result.getMethod().getMethodName()));
}
}
| [
"almer.meza@fravega.com.ar"
] | almer.meza@fravega.com.ar |
f7cd5bdd27d5600e4c205ac44179ab0546a2ff92 | 7fe959689c9b38ed62850b66b4afe0b90dd53db2 | /2020b.integrative.mon0900/src/main/java/newdemo/hello/dummy/rest/DummyController.java | 22f5128e036a4a4d60dff0915079dd704abc4f58 | [] | no_license | benhalfon/recordy | 089e1c9c641ff4b70638e02ef556697a44942d0f | 3e168ff1cf53d1d8bf1ce8b186a9a68ddbf9f2c7 | refs/heads/master | 2022-11-17T10:18:20.906889 | 2020-07-04T11:39:41 | 2020-07-04T11:39:41 | 277,078,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,369 | java | package newdemo.hello.dummy.rest;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import newdemo.hello.dummy.logic.DummyNotFoundException;
import newdemo.hello.dummy.logic.EnhancedDummyService;
import newdemo.hello.dummy.rest.boudanries.DummyBoundary;
import newdemo.hello.dummy.rest.boudanries.Type;
//@RestController
public class DummyController {
private EnhancedDummyService dummyService;
@Autowired
public DummyController(EnhancedDummyService dummyService) {
super();
this.dummyService = dummyService;
}
// invoked by spring after singleton is created and after injections
@PostConstruct
public void init() {
System.err.println("***** " + this.dummyService.getProjectName().get("projectName"));
}
// invoked by spring when it is shutting down gracefully
@PreDestroy
public void byeBye() {
System.err.println("controller is about to be destroyed...");
}
/*
{
"projectName":"2020b.demo"
}
*/
@RequestMapping(path = "/dummy", method = RequestMethod.GET,
//produces = MediaType.TEXT_PLAIN_VALUE) // text/plain
produces = MediaType.APPLICATION_JSON_VALUE)
// public String dummy() {
public DummyBoundary[] getAllDummies(
@RequestParam (name = "size", required = false, defaultValue = "10") int size,
@RequestParam (name = "page", required = false, defaultValue = "0") int page) {
return this.dummyService
.getAllDummies(size, page)
.toArray(new DummyBoundary[0]);
// .getProjectName();
// .getGreeting("dummy");
// .getCurrentTime();
}
@RequestMapping(path="/dummy", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public DummyBoundary createNewDummy (
@RequestBody DummyBoundary newDummy) {
return this.dummyService
.createNewDummy (newDummy);
}
@RequestMapping(path = "/dummy", method = RequestMethod.DELETE)
public void deleteAll() {
this.dummyService
.deleteAll();
}
@RequestMapping(path="/dummy/{id}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public DummyBoundary getSpecificDummy (@PathVariable("id") String id) {
return this.dummyService
.getSpecificDummy(id);
}
@RequestMapping(path="/dummy/{id}", method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_VALUE)
public void updateDummy (
@PathVariable("id") String id,
@RequestBody DummyBoundary update) {
this.dummyService
.updateDummy(id, update);
}
@RequestMapping(
path="/dummy/{id}/responses",
method = RequestMethod.PUT,
consumes = MediaType.APPLICATION_JSON_VALUE)
public void connectDummies (
@PathVariable("id") String originId,
@RequestBody Map<String, String> responseIdWrapper) { // {"responseId":"123"}
this.dummyService
.connectDummies(originId, responseIdWrapper.get("responseId"));
}
@RequestMapping(
path="/dummy/{id}/responses",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public DummyBoundary[] getAllResponses(
@PathVariable("id") String originId,
@RequestParam (name = "size", required = false, defaultValue = "10") int size,
@RequestParam (name = "page", required = false, defaultValue = "0") int page){
return this.dummyService
.getAllResponses(originId, size, page)
.toArray(new DummyBoundary[0]);
}
@RequestMapping(
path="/dummy/{id}/origins",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public DummyBoundary[] getOrigin(
@PathVariable("id") String responseId,
@RequestParam (name = "size", required = false, defaultValue = "10") int size,
@RequestParam (name = "page", required = false, defaultValue = "0") int page){
return this.dummyService
.getOrigin(responseId, size, page)
.toArray(new DummyBoundary[0]);
}
@RequestMapping(
path="/dummy/byType/{type}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public DummyBoundary[] getDummiesByType (
@PathVariable("type") Type type,
@RequestParam(name = "size", required = false, defaultValue = "10") int size,
@RequestParam(name = "page", required = false, defaultValue = "0") int page) {
return this.dummyService
.getDummiesByType(type, size, page)
.stream()
.collect(Collectors.toList())
.toArray(new DummyBoundary[0]);
}
@ExceptionHandler
@ResponseStatus(code = HttpStatus.NOT_FOUND)
public Map<String, Object> handleException (DummyNotFoundException e){
return Collections.singletonMap("error",
(e.getMessage() == null)?
"Dummy was not found":
e.getMessage());
}
}
| [
"benhalfon1994@gmail.com"
] | benhalfon1994@gmail.com |
df0784d191b0a1233c51ac907706e3887fa9c8b7 | dfe1d13fa06cb249b125d3ddff8ac32d7fa4538c | /vtigerFrame/src/test/java/com/Vtiger/Test/TestCreateUsingSubject.java | dd320d4c9e032702a7c2b36082e97b4be52111d6 | [] | no_license | Ajaypatil7/vtigerframe | ef3f938211838244d43479cfabf2440ec7d0e0fc | 41802dc05894c9e22faf7be3347564ca1dfb35b4 | refs/heads/master | 2020-09-10T07:09:33.140083 | 2019-11-14T11:25:44 | 2019-11-14T11:25:44 | 221,680,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.Vtiger.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.PageFactory;
import org.testng.annotations.Test;
import com.Vtiger.Generic.BaseTest;
import com.Vtiger.Generic.Exel;
import com.Vtiger.Pom.Login;
import com.Vtiger.Pom.ServiceContract;
public class TestCreateUsingSubject extends BaseTest {
@Test
public static void testCreateUsingSubject()
{
String un = Exel.getData(XL_PATH,SHEET_NAME,1,0);
String pwd = Exel.getData(XL_PATH,SHEET_NAME,1,1);
Login l = new Login(driver);
l.inputUN(un);
l.inputPWD(pwd);
l.loginClick();
Actions a = new Actions(driver);
WebElement more= driver.findElement(By.xpath("//td[@class='tabUnSelected']/a[contains(.,'More')]"));
a.moveToElement(more).build().perform();
driver.findElement(By.xpath("//a[@name=\"Service Contracts\"]")).click();
String title =driver.getTitle();
System.out.println(title);
String subject = Exel.getData(XL_PATH,SHEET_NAME,1,3);
ServiceContract createS = new ServiceContract(driver);
createS.create();
createS.subject(subject);
createS.save();
createS.serCon();
System.out.println(driver.getTitle());
System.out.println("_________________________");
}
}
| [
"ADMIN@DESKTOP-9SUSLU9"
] | ADMIN@DESKTOP-9SUSLU9 |
014351e6f1b480c30675de9ab9fca4fd811258f0 | 9baa67efe3cee7b64691a9de0a618754942234eb | /ZFJD/src/com/ushine/dao/IBaseDao.java | 279e7221b1c51a49c75ad39fa6004feaf84cb072 | [] | no_license | wangbailin88/ZFJDDemo | 71ffbbd2ed4ac18db1809c223ffc74e85dc5d12e | cfd395c0e4fa5d211e80e01238100be61258ffcd | refs/heads/master | 2020-06-23T16:57:05.404646 | 2016-11-24T06:23:28 | 2016-11-24T06:23:28 | 74,643,770 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,290 | java | package com.ushine.dao;
import java.io.Serializable;
import java.util.List;
import org.hibernate.criterion.DetachedCriteria;
import com.ushine.ssh.model.BlackBoxStatusInfo;
/**
* 基础DAO支持接口v3.0,所有程序数据的CRUD都通过该接口操作(替换IBaseDaoSupport接口操作)
* com.hj.dao.impl.BaseDaoImpl实现方法不能满足业务需要时,需要自定义方法执行数据库操作时
* ,可以通过继承com.hj.dao.BaseDaoAdapter重新实现方法
*
* @author {HJ}Franklin
*
* @param <T>
* @param <id>
*/
public interface IBaseDao<T, id extends Serializable> {
/**
* 保持数据
* @param entityObject T 实体对象
* @throws Exception
*/
public void save(T entityObject) throws Exception;
/**
* 更新数据
* @param entityObject T 实体对象
* @throws Exception
*/
public void update(T entityObject) throws Exception;
/**
* 保持更新数据, 当数据库中没有数据时执行Save, 有数据时执行Update
* @param entityObject T 实体对象
* @throws Exception
*/
public void saveOrUpdate(T entityObject) throws Exception;
/**
* 删除实体对象相应的持久数据
* @param entityObject T 实体对象
* @throws Exception
*/
public void delete(T entityObject) throws Exception;
/**
* 根据ID批量删除持久数据, 该方法采用循环删除方法, 不能用于大数据删除
* @param entityClass Class<T> 实体类
* @param ids Serializable[] 数据ID
* @throws Exception
*/
public void deleteById(Class<T> entityClass, Serializable[] ids) throws Exception;
/**
* 根据id删除对象
* @param entityClass
* @param id
* @throws Exception
*/
public void deleteById(Class<T> entityClass, String id)throws Exception;
/**
* 删除符合指定属性条件的数据
* @param entityClass Class<T> 实体类
* @param propertyName String 属性名称
* @param value Object 比较的值
* @throws Exception
*/
public void deleteByProperty(Class<T> entityClass, String propertyName, Object value) throws Exception;
/**
* 删除指定类型的全部数据,该方法采用bulkUpdate方式,清除缓存数据(包括一级缓存和二级缓存)
* @param entityClass Class<T> 实体类
* @throws Exception
*/
public void deleteAll(Class<T> entityClass) throws Exception;
/**
* 通过ID查询指定数据
* @param entityClass
* @param id Serializable 数据ID
* @return T 数据对象
* @throws Exception
*/
public T findById(Class<T> entityClass, Serializable id) throws Exception;
/**
* 根据对象属性(字段)条件查询数据
* @param entityClass Class<T> 实体类
* @param propertyName String 属性名称
* @param value Object 比较的值
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findByProperty(Class<T> entityClass, String propertyName, Object value) throws Exception;
/**
* 根据DetachedCriteria条件查询数据
* @param criteria DetachedCriteria 动态条件
* ***************************************************************
| Restrictions.eq 等於
| Restrictions.allEq 使用Map,使用key/value進行多個等於的比對
| Restrictions.gt 大於 >
| Restrictions.ge 大於等於 >=
| Restrictions.lt 小於 <
| Restrictions.le 小於等於 <=
| Restrictions.between 對應SQL的BETWEEN子句
| Restrictions.like 對應SQL的LIKE子句
| Restrictions.in 對應SQL的in子句
| Restrictions.and AND關係
| Restrictions.or OR關係
| Restrictions.sqlRestriction SQL限定查詢
***************************************************************
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findByCriteria(DetachedCriteria criteria) throws Exception;
/**
* 查询指定类型的全部数据
* @param entityClass Class<T> 实体类
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findAll(Class<T> entityClass) throws Exception;
/**
* 根据HQL语句查询数据(当需要自定义查询条件时使用)
* (在BaseDaoImpl类中该方法实现返回null,如果有需要可以通过继承BaseDaoAdapter重新实现)
*
* @param hql String 指定的HQL语句
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findByHql(String hql) throws Exception;
/**
* 通过SQL语句查询数据, 必须按照指定标准格式, 否则抛出异常报错
* (在BaseDaoImpl类中该方法实现返回null,如果有需要可以通过继承BaseDaoAdapter重新实现)
*
* @param sql String SQL语句
* @return List<T> 数据对象集合
* @throws Exception
*/
public List findBySql(String sql) throws Exception;
public List findBySql(String sql,final Class<BlackBoxStatusInfo> entityClass) throws Exception;
/**
* 根据sql语句查询数据的总条数
* @param sql
* @return
* @throws Exception
*/
public Object getRows(String sql) throws Exception;
/**
* 分页查询指定类型的数据
* @param entityClass Class<T> 实体类
* @param sizePage int 单页数据量
* @param startRecord int 起始记录的序号
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findPaging(Class<T> entityClass, int sizePage, int startRecord) throws Exception;
/**
* 根据动态条件分页查询指定类型的数据
* @param criteria DetachedCriteria 动态条件
* @param sizePage int 单页数据量
* @param startRecord int 起始记录的序号
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findPagingByCriteria(DetachedCriteria criteria, int sizePage, int startRecord) throws Exception;
/**
* 根据HQL语句分页查询数据
* @param hql String 指定的HQL语句
* @param sizePage int 单页数据量
* @param startRecord int 起始记录的序号
* @return List<T> 数据对象集合
* @throws Exception
*/
public List<T> findPagingByHql(String hql, int sizePage, int startRecord) throws Exception;
/**
* 统计指定类型数据的记录总量
* @param entityClass Class<T> 实体类
* @return int 记录总条数
* @throws Exception
*/
public int getRowCount(Class<T> entityClass) throws Exception;
/**
* 根据动态条件统计指定类型数据的记录总量, 可以加入DetachedCriteria动态条件
* @param DetachedCriteria criteria
*******************************************************************
| Projections:
| avg(String propertyName):计算属性字段的平均值。
| count(String propertyName):统计一个属性在结果中出现的次数。
| countDistinct(String propertyName):统计属性包含的不重复值的数量。
| max(String propertyName):计算属性值的最大值。
| min(String propertyName):计算属性值的最小值。
| sum(String propertyName):计算属性值的总和。
*******************************************************************
* @return int 记录总条数
* @throws Exception
*/
public int getRowCount(DetachedCriteria criteria) throws Exception;
/**
* 执行指定的HQL语句(当需要自定义执行数据库操作时使用)
* (在BaseDaoImpl类中该方法实现返回null,如果有需要可以通过继承BaseDaoAdapter重新实现)
*
* @param hql String 指定的HQL语句
* @return Object 返回结果
* @throws Exception
*/
public Object executeHql(String hql) throws Exception;
/**
* 执行指定的SQL语句(当需要自定义执行数据库操作时使用)
* (在BaseDaoImpl类中该方法实现返回null,如果有需要可以通过继承BaseDaoAdapter重新实现)
*
* @param hql String 指定的HQL语句
* @return Object 返回结果
* @throws Exception
*/
public Object executeSql(String sql) throws Exception;
/**
* 执行指定的SQL语句(当需要自定义执行数据库操作时使用)
* (在BaseDaoImpl类中该方法实现返回null,如果有需要可以通过继承BaseDaoAdapter重新实现)
*
* @param hql String 指定的HQL语句
* @return Object 返回结果
* @throws Exception
*/
public Object executeSql1(String sql) throws Exception;
}
| [
"834829402@qq.com"
] | 834829402@qq.com |
8c4dcc47849f5d8b7f6f1b16c47dc9fcd68ecf0c | 26e716d18b49e761567bc93fb507e2cdf793d3cc | /array1223/src/array1223/Arr_7ex2.java | dc6c4efa466d4da8735da20367192c28f728fc20 | [] | no_license | qie8999/20201222 | 70a5e75d3371d0528a2bf5e1cbf0a48fba45332c | c707d94b8a4cf896e69ff9c8cad732b29ecf1af1 | refs/heads/main | 2023-02-05T05:21:14.601507 | 2020-12-23T07:39:09 | 2020-12-23T07:39:09 | 323,477,667 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,122 | java | package array1223;
import java.util.Random;
public class Arr_7ex2 {
public static void main(String[] args) {
// 배열 연습문제 7
System.out.println("--------------------------");
System.out.println(" 파일 제어 프로그램 v1.1");
System.out.println("--------------------------");
System.out.println("1. 이름 생성하여 파일에 저장하기");
System.out.println("2. 파일에서 이름 읽어오기");
System.out.println("3. 프로그램 종료");
System.out.println("--------------------------");
System.out.println("메뉴 선택 : ");
String last[] = {"김","박","이","최","장"};
String first[] = {"바","사","아","자","차"};
String mid[] = {"가","나","다","라","마"};
String name []= new String[50];
for(int i =0; i< name.length; i++) {
Random rand =new Random();
String la = (last[new Random().nextInt(last.length)]);
String fi = (first[new Random().nextInt(first.length)]);
String mi = (mid[new Random().nextInt(mid.length)]);
String fullname = la + fi + mi;
System.out.printf("%d.이름 [ %s ] \n",i+1,fullname);
}
}
}
| [
"qie8999@naver.com"
] | qie8999@naver.com |
9ba26f6dc126396fea2952a475c9e1efbde0c81f | 7ccf495229a1c643ed0b5b7b597b28fb9ac75255 | /src/main/java/jmc/skweb/ui/ws/ServiceArticuloWS.java | d25c61259e86d727dbedb0fbef034a53a64d98ab | [] | no_license | jmcarrascal/farmaweb | b2916697dc92cc87d36f9f0c57e7e92cccf0a991 | 5bb58fe5c253ac559730104f6b588d15249da4d1 | refs/heads/master | 2022-12-27T04:06:22.595082 | 2020-03-09T16:59:28 | 2020-03-09T16:59:28 | 16,493,956 | 0 | 0 | null | 2022-12-09T22:38:35 | 2014-02-03T21:43:26 | Java | UTF-8 | Java | false | false | 1,316 | java | package jmc.skweb.ui.ws;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebService;
import jmc.skweb.core.dao.FamDAO;
import jmc.skweb.core.dao.StockDAO;
import jmc.skweb.core.model.Fam;
import jmc.skweb.core.model.Stock;
import jmc.skweb.core.service.ArticuloManager;
@WebService
public class ServiceArticuloWS{
private ArticuloManager articuloManager;
private FamDAO extendedFamDAO;
@WebMethod(exclude=true)
public FamDAO getExtendedFamDAO() {
return extendedFamDAO;
}
@WebMethod(exclude=true)
public void setExtendedFamDAO(FamDAO extendedFamDAO) {
this.extendedFamDAO = extendedFamDAO;
}
@WebMethod(exclude=true)
public ArticuloManager getArticuloManager() {
return articuloManager;
}
@WebMethod(exclude=true)
public void setArticuloManager(ArticuloManager articuloManager) {
this.articuloManager = articuloManager;
}
@WebMethod(operationName="getArticuloPorNombre")
public String getArticuloPorNombre(String nombreArticulo) {
String articuloList = articuloManager.getListFam().get(0).getDesfam();
return articuloList;
}
@WebMethod(operationName="getAllFam")
public List<Fam> getAllFam() {
List<Fam> famList = articuloManager.getListFam();
return famList;
}
} | [
"jmcarrascal@gmail.com"
] | jmcarrascal@gmail.com |
6d70b39616a069f998749c5d231d2b03b4314aaf | 1b20675aa24c3b522650dd6ec6c496e0c7a2773f | /src/ejercicos_herencias1/Television.java | db450ed7c2088262b31c843e14a91674dc87870a | [] | no_license | ikertijero/Ejercicios | b947a1e7d27546cde0fb5785cc8d6afaca53bd8d | 73bbe5cf94c12596a3d1edcedb59d7c572617ec4 | refs/heads/master | 2023-01-28T00:55:46.429146 | 2020-11-25T07:33:30 | 2020-11-25T07:33:30 | 305,946,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package ejercicos_herencias1;
public class Television extends Electrodomestico {
private int pulgadas;
public Television() {
super();
}
public Television(String nombre, double precio, int pulgadas) {
super(nombre, precio);
this.pulgadas = pulgadas;
}
public int getPulgadas() {
return pulgadas;
}
public void setPulgadas(int pulgadas) {
this.pulgadas = pulgadas;
}
@Override
public String toString() {
return super.toString() + "pulgadas=" + pulgadas + ", ";
}
}
| [
"TiRii@DESKTOP-9N49JP0"
] | TiRii@DESKTOP-9N49JP0 |
94d805d17d7c36758b7a97eea04a6c12a0a01abf | 69bfe9c2c19b7aefc92bc35e4841c554af10cda1 | /src/minecraft/shadersmod/client/ShaderOption.java | cd88c1bcd861b0ab2045450a6b9f2c151665d8c7 | [] | no_license | Akuyuma/Kronos | 3b4984b2ca17b5616850eb569566fa586d3a1697 | bca9f954c8c9b2f9e03cce34b1d0ee557756297a | refs/heads/main | 2023-05-04T06:36:29.834874 | 2021-05-18T14:18:11 | 2021-05-18T14:18:11 | 368,555,118 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,720 | java | package shadersmod.client;
import java.util.Arrays;
import java.util.List;
import net.minecraft.src.Config;
import net.minecraft.src.StrUtils;
public abstract class ShaderOption
{
private String name = null;
private String description = null;
private String value = null;
private String[] values = null;
private String valueDefault = null;
private String[] paths = null;
private boolean enabled = true;
private boolean visible = true;
public static final String COLOR_GREEN = "\u00a7a";
public static final String COLOR_RED = "\u00a7c";
public static final String COLOR_BLUE = "\u00a79";
public ShaderOption(String name, String description, String value, String[] values, String valueDefault, String path)
{
this.name = name;
this.description = description;
this.value = value;
this.values = values;
this.valueDefault = valueDefault;
if (path != null)
{
this.paths = new String[] {path};
}
}
public String getName()
{
return this.name;
}
public String getDescription()
{
return this.description;
}
public String getDescriptionText()
{
String desc = Config.normalize(this.description);
desc = StrUtils.removePrefix(desc, "//");
desc = Shaders.translate("option." + this.getName() + ".comment", desc);
return desc;
}
public void setDescription(String description)
{
this.description = description;
}
public String getValue()
{
return this.value;
}
public boolean setValue(String value)
{
int index = getIndex(value, this.values);
if (index < 0)
{
return false;
}
else
{
this.value = value;
return true;
}
}
public String getValueDefault()
{
return this.valueDefault;
}
public void resetValue()
{
this.value = this.valueDefault;
}
public void nextValue()
{
int index = getIndex(this.value, this.values);
if (index >= 0)
{
index = (index + 1) % this.values.length;
this.value = this.values[index];
}
}
public void prevValue()
{
int index = getIndex(this.value, this.values);
if (index >= 0)
{
index = (index - 1 + this.values.length) % this.values.length;
this.value = this.values[index];
}
}
private static int getIndex(String str, String[] strs)
{
for (int i = 0; i < strs.length; ++i)
{
String s = strs[i];
if (s.equals(str))
{
return i;
}
}
return -1;
}
public String[] getPaths()
{
return this.paths;
}
public void addPaths(String[] newPaths)
{
List pathList = Arrays.asList(this.paths);
for (int i = 0; i < newPaths.length; ++i)
{
String newPath = newPaths[i];
if (!pathList.contains(newPath))
{
this.paths = (String[])((String[])Config.addObjectToArray(this.paths, newPath));
}
}
}
public boolean isEnabled()
{
return this.enabled;
}
public void setEnabled(boolean enabled)
{
this.enabled = enabled;
}
public boolean isChanged()
{
return !Config.equals(this.value, this.valueDefault);
}
public boolean isVisible()
{
return this.visible;
}
public void setVisible(boolean visible)
{
this.visible = visible;
}
public boolean isValidValue(String val)
{
return getIndex(val, this.values) >= 0;
}
public String getNameText()
{
return Shaders.translate("option." + this.name, this.name);
}
public String getValueText(String val)
{
return Shaders.translate("value." + this.name + "." + val, val);
}
public String getValueColor(String val)
{
return "";
}
public boolean matchesLine(String line)
{
return false;
}
public boolean checkUsed()
{
return false;
}
public boolean isUsedInLine(String line)
{
return false;
}
public String getSourceLine()
{
return null;
}
public String[] getValues()
{
return (String[])this.values.clone();
}
public String toString()
{
return "" + this.name + ", value: " + this.value + ", valueDefault: " + this.valueDefault + ", paths: " + Config.arrayToString((Object[])this.paths);
}
}
| [
"84385948+Akuyuma@users.noreply.github.com"
] | 84385948+Akuyuma@users.noreply.github.com |
fdecc8ec8059a725e08ef06e39999b366bc6954c | 7033053710cf2fd800e11ad609e9abbb57f1f17e | /cardayProject/carrental-common/src/main/java/com/cmdt/carrental/common/model/VehicleListForOrgDto.java | 7bfc5e29f35eed947a341ad31cde65bc3e88df6a | [] | no_license | chocoai/cardayforfjga | 731080f72c367c7d3b8e7844a1c3cd034cc11ee6 | 91d7c8314f44024825747e12a60324ffc3d43afb | refs/heads/master | 2020-04-29T02:14:07.834535 | 2018-04-02T09:51:07 | 2018-04-02T09:51:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,337 | java | package com.cmdt.carrental.common.model;
public class VehicleListForOrgDto {
private Long id; //id
private String vehicleNumber; //车牌号
private String vehicleType; //车辆类型
private String vehicleBrand; //车辆品牌
private String vehicleModel; //车辆型号
private Long vehicleFromId; //车辆来源id
private String vehicleFromName; //车辆来源名称
private String vehiclePurpose; //车辆用途
private Long deptId; //部门Id
private Long entId; //企业Id
private int currentPage;
private int numPerPage;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getVehicleNumber() {
return vehicleNumber;
}
public void setVehicleNumber(String vehicleNumber) {
this.vehicleNumber = vehicleNumber;
}
public String getVehicleType() {
return vehicleType;
}
public void setVehicleType(String vehicleType) {
this.vehicleType = vehicleType;
}
public String getVehicleBrand() {
return vehicleBrand;
}
public void setVehicleBrand(String vehicleBrand) {
this.vehicleBrand = vehicleBrand;
}
public String getVehicleModel() {
return vehicleModel;
}
public void setVehicleModel(String vehicleModel) {
this.vehicleModel = vehicleModel;
}
public Long getVehicleFromId() {
return vehicleFromId;
}
public void setVehicleFromId(Long vehicleFromId) {
this.vehicleFromId = vehicleFromId;
}
public String getVehiclePurpose() {
return vehiclePurpose;
}
public void setVehiclePurpose(String vehiclePurpose) {
this.vehiclePurpose = vehiclePurpose;
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(int numPerPage) {
this.numPerPage = numPerPage;
}
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
public Long getEntId() {
return entId;
}
public void setEntId(Long entId) {
this.entId = entId;
}
public String getVehicleFromName() {
return vehicleFromName;
}
public void setVehicleFromName(String vehicleFromName) {
this.vehicleFromName = vehicleFromName;
}
}
| [
"xiaoxing.zhou@cm-dt.com"
] | xiaoxing.zhou@cm-dt.com |
5b7efbb76dd50de1983758c51bb0e7b18b551a4d | 6f1b2fd68456a9f314f89cdcb987864b59b72be2 | /src/main/java/edu/khai/voloshyn/travelagency/entity/Tour.java | 6c9e4d066480f97aa8872518f183e44497cb3bfc | [] | no_license | TetianaIefimenko/TravelAgency | 69014f855902649a6f01c13e1529e881edc79db2 | 22405984aaf84dec84fb379a0164934430c28627 | refs/heads/master | 2023-03-09T09:37:06.944211 | 2021-02-28T20:46:29 | 2021-02-28T20:46:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,749 | java | package edu.khai.voloshyn.travelagency.entity;
import java.io.InputStream;
import java.io.Serializable;
import java.sql.Date;
import java.util.Objects;
import edu.khai.voloshyn.travelagency.entity.TourDiscount;
public class Tour implements Serializable {
private int tourId;
private String name;
private double cost;
private Date departureDate;
private int days;
private int places;
private TourType tourType;
private City city;
private City departureCity;
private Hotel hotel;
private Tourist tourist;
private TourStatus tourStatus;
private Transport transport;
private TourDiscount discount;
public Tour() {
discount = new TourDiscount();
}
public Tour(String name, double cost, Date departureDate,
int days, int places, TourType tourType, City city,
City departureCity, Hotel hotel, Tourist tourist, TourStatus tourStatus, Transport transport, TourDiscount discount) {
this.name = name;
this.cost = cost;
this.departureDate = departureDate;
this.days = days;
this.places = places;
this.tourType = tourType;
this.city = city;
this.departureCity = departureCity;
this.hotel = hotel;
this.tourist = tourist;
this.tourStatus = tourStatus;
this.transport = transport;
this.discount = new TourDiscount();
}
public Tour(int tourId, String name, Date departureDate) {
this.tourId = tourId;
this.name = name;
this.departureDate = departureDate;
discount = new TourDiscount();
}
public int getTourId() {
return tourId;
}
public void setTourId(int tourId) {
this.tourId = tourId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public Date getDepartureDate() {
return departureDate;
}
public void setDepartureDate(Date departureDate) {
this.departureDate = departureDate;
}
public int getDays() {
return days;
}
public void setDays(int days) {
this.days = days;
}
public int getPlaces() {
return places;
}
public void setPlaces(int places) {
this.places = places;
}
public TourType getTourType() {
return tourType;
}
public void setTourType(TourType tourType) {
this.tourType = tourType;
}
public City getCity() {
return city;
}
public void setCity(City city) {
this.city = city;
}
public City getDepartureCity() {
return departureCity;
}
public void setDepartureCity(City departureCity) {
this.departureCity = departureCity;
}
public Hotel getHotel() {
return hotel;
}
public void setHotel(Hotel hotel) {
this.hotel = hotel;
}
public Tourist getTourist() {
return tourist;
}
public void setTourist(Tourist tourist) {
this.tourist = tourist;
}
public TourStatus getTourStatus() {
return tourStatus;
}
public void setTourStatus(TourStatus tourStatus) {
this.tourStatus = tourStatus;
}
public Transport getTransport() {
return transport;
}
public void setTransport(Transport transport) {
this.transport = transport;
}
public TourDiscount getDiscount() {
return discount;
}
public void setDiscount(TourDiscount discount) {
this.discount = discount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Tour)) return false;
Tour tour = (Tour) o;
return getTourId() == tour.getTourId() &&
Double.compare(tour.getCost(), getCost()) == 0 &&
getDays() == tour.getDays() &&
getPlaces() == tour.getPlaces() &&
Objects.equals(getName(), tour.getName()) &&
Objects.equals(getDepartureDate(), tour.getDepartureDate()) &&
Objects.equals(getTourType(), tour.getTourType()) &&
Objects.equals(getCity(), tour.getCity()) &&
Objects.equals(getDepartureCity(), tour.getDepartureCity()) &&
Objects.equals(getHotel(), tour.getHotel()) &&
Objects.equals(getTourist(), tour.getTourist()) &&
Objects.equals(getTransport(), tour.getTransport()) &&
Objects.equals(getDiscount(), tour.getDiscount());
}
@Override
public int hashCode() {
return Objects.hash(getTourId(), getName(), getCost(),
getDepartureDate(), getDays(), getPlaces(), getTourType(),
getCity(), getDepartureCity(), getHotel(), getTourist(), getTransport(), getDiscount());
}
@Override
public String toString() {
return "Tour{" +
"tourId=" + tourId +
", name='" + name + '\'' +
", cost=" + cost +
", departureDate=" + departureDate +
", days=" + days +
", places=" + places +
", tourType=" + tourType +
", city=" + city +
", departureCity=" + departureCity +
", hotel=" + hotel +
", tourist=" + tourist +
", tourStatus=" + tourStatus +
", transport=" + transport +
", discount=" + discount.getDiscountSize() + '\'' +
"}\n";
}
}
| [
"34489048+LexXV@users.noreply.github.com"
] | 34489048+LexXV@users.noreply.github.com |
8e2101a3fd81e2eff5b8bfc5eafc7e1155b25da8 | 6dbae30c806f661bcdcbc5f5f6a366ad702b1eea | /Corpus/eclipse.pde.ui/1805.java | e8f1e669a881c3abaf789f67abe03eb21e58cf72 | [
"MIT"
] | permissive | SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | d3fd21745dfddb2979e8ac262588cfdfe471899f | 0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0 | refs/heads/master | 2020-03-31T15:52:01.005505 | 2018-10-01T23:38:50 | 2018-10-01T23:38:50 | 152,354,327 | 1 | 0 | MIT | 2018-10-10T02:57:02 | 2018-10-10T02:57:02 | null | UTF-8 | Java | false | false | 4,770 | java | /*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.pde.internal.ui.wizards.feature;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.*;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
import org.eclipse.pde.internal.ui.PDEPlugin;
import org.eclipse.pde.internal.ui.wizards.IProjectProvider;
import org.eclipse.pde.internal.ui.wizards.NewWizard;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
public abstract class AbstractNewFeatureWizard extends NewWizard implements IExecutableExtension {
//$NON-NLS-1$
public static final String DEF_PROJECT_NAME = "project-name";
//$NON-NLS-1$
public static final String DEF_FEATURE_ID = "feature-id";
//$NON-NLS-1$
public static final String DEF_FEATURE_NAME = "feature-name";
protected AbstractFeatureSpecPage fSpecPage;
protected PluginListPage fSecondPage;
protected FeaturePatchProvider fProvider;
private IConfigurationElement fConfig;
public class FeaturePatchProvider implements IProjectProvider {
public FeaturePatchProvider() {
super();
}
@Override
public String getProjectName() {
return fSpecPage.getProjectName();
}
@Override
public IProject getProject() {
return fSpecPage.getProjectHandle();
}
@Override
public IPath getLocationPath() {
return fSpecPage.getLocationPath();
}
public IFeatureModel getFeatureToPatch() {
return fSpecPage.getFeatureToPatch();
}
public FeatureData getFeatureData() {
return fSpecPage.getFeatureData();
}
public String getInstallHandlerLibrary() {
return fSpecPage.getInstallHandlerLibrary();
}
public IPluginBase[] getPluginListSelection() {
return fSecondPage != null ? fSecondPage.getSelectedPlugins() : null;
}
public ILaunchConfiguration getLaunchConfiguration() {
return fSecondPage != null ? fSecondPage.getSelectedLaunchConfiguration() : null;
}
}
public AbstractNewFeatureWizard() {
super();
setDialogSettings(PDEPlugin.getDefault().getDialogSettings());
setNeedsProgressMonitor(true);
}
@Override
public void addPages() {
fSpecPage = createFirstPage();
String pname = getDefaultValue(DEF_PROJECT_NAME);
if (pname != null)
fSpecPage.setInitialProjectName(pname);
fSpecPage.setInitialId(getDefaultValue(DEF_FEATURE_ID));
fSpecPage.setInitialName(getDefaultValue(DEF_FEATURE_NAME));
addPage(fSpecPage);
fProvider = new FeaturePatchProvider();
}
protected abstract AbstractFeatureSpecPage createFirstPage();
@Override
public boolean canFinish() {
IWizardPage page = getContainer().getCurrentPage();
return ((page == fSpecPage && page.isPageComplete()) || (page == fSecondPage && page.isPageComplete()));
}
// get creation operation
protected abstract IRunnableWithProgress getOperation();
@Override
public boolean performFinish() {
try {
IDialogSettings settings = getDialogSettings();
fSpecPage.saveSettings(settings);
if (settings != null && fSecondPage != null)
fSecondPage.saveSettings(settings);
getContainer().run(false, true, getOperation());
BasicNewProjectResourceWizard.updatePerspective(fConfig);
} catch (InvocationTargetException e) {
PDEPlugin.logException(e);
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}
@Override
public void setInitializationData(IConfigurationElement config, String property, Object data) throws CoreException {
this.fConfig = config;
}
}
| [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
85a368bd1dd82d92d2bee552a337c46b8060913c | 4192d19e5870c22042de946f211a11c932c325ec | /j-hi-20110703/src/org/hi/framework/web/taglib/component/builder/AnchorTagBuilder.java | a70673068e7256992c202fe705731f24ffc0e975 | [] | no_license | arthurxiaohz/ic-card | 1f635d459d60a66ebda272a09ba65e616d2e8b9e | 5c062faf976ebcffd7d0206ad650f493797373a4 | refs/heads/master | 2021-01-19T08:15:42.625340 | 2013-02-01T06:57:41 | 2013-02-01T06:57:41 | 39,082,049 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | /**
*
*/
package org.hi.framework.web.taglib.component.builder;
import org.hi.framework.web.taglib.component.TagBuilder;
import org.hi.framework.web.taglib.component.TagInfoBean;
/**
* @author wei.li
*
*/
public class AnchorTagBuilder implements TagBuilder {
/*
* (non-Javadoc)
*
* @see org.hi.framework.web.taglib.component.TagBuilder#build(org.hi.framework.web.taglib.component.TagInfoBean)
*/
public String build(TagInfoBean bean) {
// TODO Auto-generated method stub
String html = "<a href=\"" + bean.getUrl() + "\" >" + bean.getDefaultValue()
+ "</a> ";
return html;
}
}
| [
"Angi.Wang.AFE@gmail.com"
] | Angi.Wang.AFE@gmail.com |
75c9187be7bdd90db243b36c05941ad76c1f3c9e | 41b5011d5e7d3955f1b3a06a2dd5048dd0b26680 | /src/com/needhamsoftware/jstaticweb/Main.java | 2179b52cb23a94f4aaa08916f963294a60da43ff | [] | no_license | fsparv/jstaticweb | f28b3987e4ec207ca24d7172799c379776dcce9e | 1402aeea8cfb912dbe631e304df6775fbb3166ce | refs/heads/master | 2021-01-01T19:52:30.554917 | 2013-10-06T12:52:21 | 2013-10-06T12:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,684 | java | package com.needhamsoftware.jstaticweb;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* This class is meant to serve as a start point for a really really stupidly dumb web server. The whole point
* is to serve up pages with as little overhead as possible. All request headers are ignored, there is no support
* for virtual hosts, and no modified checking. You ask for the bytes, and we give em to you, with no fuss and
* no frills, no questions asked. Files are served from the current working directory, and below, but it should
* not be possible to request files above that point.
*/
public class Main {
public static void main(String[] args) throws IOException {
int port = 8008;
try {
if (args.length > 0 && args[0] != null) {
port = Integer.parseInt(args[0]);
}
} catch (NumberFormatException nfe) {
System.err.println("Could not parse port number " + args[0] + ".");
System.exit(1);
}
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(port);
} catch (IOException e) {
System.err.println("Could not listen on port: 8008.");
System.exit(1);
}
while (true) {
Socket clientSocket;
try {
clientSocket = serverSocket.accept();
new Http11Protocol(clientSocket).start();
} catch (IOException e) {
System.err.println("Accept failed.");
System.exit(1);
}
}
}
} | [
"gus@needhamsoftware.com"
] | gus@needhamsoftware.com |
1b03eec2e13727cc1da41a076fc1e7da81e6d90e | d0d8169917cbe685dda47324a2d4bc8e65928bcd | /adapters-2.0/src/main/java/com/flipkart/fdp/ml/utils/Constants.java | ce6a87e03fd207d366f4abe36a90ce48b6513956 | [
"Apache-2.0"
] | permissive | lc11535/spark-transformers | d1298d6afca203ecaec96bdb1af001c529f48374 | 66cbc60aaedbe0d2b73eb35808335272f17cc89b | refs/heads/master | 2020-09-11T22:54:10.081821 | 2017-12-15T10:03:06 | 2017-12-15T10:03:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package com.flipkart.fdp.ml.utils;
public class Constants {
public static final String SUPPORTED_SPARK_VERSION_PREFIX = "2.0";
public static final String LIBRARY_VERSION = "1.0";
}
| [
"akshay.us@flipkart.com"
] | akshay.us@flipkart.com |
ad5828aa61d3bd967c59732a4bbf59a5a2b03c72 | 194aeda32d95be4ab3a3fbe463baed12829029e8 | /INHERITANCE - EXERCISE/04. Mordor's Cruelty Plan/Gandalf.java | 0376ce355f166a9bbef58c482bcf7e673f55aff5 | [] | no_license | IvanBorislavovDimitrov/JavaOOPBasics | cc237dd025cebe99548a6ea825290ffa8e359ded | 38bdfca786ab00f8f52fe75a798f4ea2cc979e1a | refs/heads/master | 2020-03-20T02:07:15.390208 | 2018-07-08T14:35:15 | 2018-07-08T14:35:15 | 137,099,823 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | public class Gandalf {
private int points;
public Gandalf() {
}
public void eat(String food) {
switch (food.toLowerCase()) {
case "cram":
this.points += 2;
break;
case "lembas":
this.points += 3;
break;
case "apple":
this.points += 1;
break;
case "melon":
this.points += 1;
break;
case "honeycake":
this.points += 5;
break;
case "mushrooms":
this.points -= 10;
break;
default:
this.points -= 1;
}
}
public void eatAll(String[] food) {
for (String s : food) {
this.eat(s);
}
}
public String mood() {
if (this.points < -5) {
return "Angry";
}
if (this.points < 0) {
return "Sad";
}
if (this.points < 15) {
return "Happy";
}
return "JavaScript";
}
public int getPoints() {
return this.points;
}
}
| [
"starstrucks1997@gmail.com"
] | starstrucks1997@gmail.com |
3afcd33da40ab43d587e0b010db699420fa69cbb | 48b7e32aff5a84f7dfbc71df5c01d724eef42fb9 | /src/test/java/uk/co/brunella/qof/adapter/EnumerationAdapterTest.java | 0d85878dc600abcb10df959e16918e5dd87921ef | [] | no_license | renatobrunella/QueryObjectFactory | 1c111a2690b176eb80ef5fcccaf87166ff2c1022 | 0c0de6ff2355b12c631aad908e1cc91c5365ca40 | refs/heads/master | 2021-01-17T16:14:38.819823 | 2020-03-15T15:14:05 | 2020-03-15T15:14:05 | 71,715,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,353 | java | package uk.co.brunella.qof.adapter;
import org.junit.Before;
import org.junit.Test;
import uk.co.brunella.qof.BaseQuery;
import uk.co.brunella.qof.Call;
import uk.co.brunella.qof.Query;
import uk.co.brunella.qof.QueryObjectFactory;
import uk.co.brunella.qof.testtools.MockConnectionData;
import uk.co.brunella.qof.testtools.MockConnectionFactory;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class EnumerationAdapterTest {
private Connection connection;
private SelectQueries selectQueries;
private List<String> log;
@Before
public void setUp() {
EnumerationAdapter.register("my-enum", "getValue", "getEnum");
selectQueries = QueryObjectFactory.createQueryObject(SelectQueries.class);
QueryObjectFactory.unregisterMapper("my-enum");
connection = MockConnectionFactory.getConnection();
log = ((MockConnectionData) connection).getLog();
selectQueries.setConnection(connection);
selectQueries.setFetchSize(99);
}
@Test
public void testSelectEnum() throws SQLException {
List<Map<String, Object>> results = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
results.add(data);
data.put("value", "C");
((MockConnectionData) connection).setResultSetData(results);
assertEquals(MyEnum.C, selectQueries.selectEnum(MyEnum.A));
assertEquals(9, log.size());
int i = 0;
assertEquals("prepareStatement(select value from test where e = ? )", log.get(i++));
assertEquals("setFetchSize(2)", log.get(i++));
assertEquals("setString(1,A)", log.get(i++));
assertEquals("executeQuery()", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("getString(value)", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("close()", log.get(i++));
assertEquals("close()", log.get(i));
}
@Test
public void testSelectEnumConstructor() throws SQLException {
List<Map<String, Object>> results = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
results.add(data);
data.put("value", "C");
((MockConnectionData) connection).setResultSetData(results);
MyClass myClass = selectQueries.selectEnumConstructor(MyEnum.A);
assertNotNull(myClass);
assertEquals(MyEnum.C, myClass.getValue());
assertEquals(9, log.size());
int i = 0;
assertEquals("prepareStatement(select value from test where e = ? )", log.get(i++));
assertEquals("setFetchSize(2)", log.get(i++));
assertEquals("setString(1,A)", log.get(i++));
assertEquals("executeQuery()", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("getString(value)", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("close()", log.get(i++));
assertEquals("close()", log.get(i));
}
@Test
public void testSelectEnumMap() throws SQLException {
List<Map<String, Object>> results = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
results.add(data);
data.put("value", "C");
((MockConnectionData) connection).setResultSetData(results);
Map<MyEnum, MyEnum> map = selectQueries.selectEnumMap(MyEnum.A);
assertNotNull(map);
assertEquals(MyEnum.C, map.get(MyEnum.C));
assertEquals(10, log.size());
int i = 0;
assertEquals("prepareStatement(select value from test where e = ? )", log.get(i++));
assertEquals("setFetchSize(99)", log.get(i++));
assertEquals("setString(1,A)", log.get(i++));
assertEquals("executeQuery()", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("getString(value)", log.get(i++));
assertEquals("getString(value)", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("close()", log.get(i++));
assertEquals("close()", log.get(i));
}
@Test
public void testCallEnum() throws SQLException {
List<Object> results = new ArrayList<>();
results.add("C");
((MockConnectionData) connection).setResultData(results);
assertEquals(MyEnum.C, selectQueries.callEnum(MyEnum.A));
assertEquals(6, log.size());
int i = 0;
assertEquals("prepareCall({ ? = call proc( ? ) })", log.get(i++));
assertEquals("setString(2,A)", log.get(i++));
assertEquals("registerOutParameter(1,12)", log.get(i++));
assertEquals("execute()", log.get(i++));
assertEquals("getString(1)", log.get(i++));
assertEquals("close()", log.get(i));
}
@Test
public void testSelectEnum2() throws SQLException {
List<Map<String, Object>> results = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
results.add(data);
data.put("value", "c");
((MockConnectionData) connection).setResultSetData(results);
assertEquals(MyEnum.C, selectQueries.selectEnum2(MyEnum.A));
assertEquals(9, log.size());
int i = 0;
assertEquals("prepareStatement(select value from test where e = ? )", log.get(i++));
assertEquals("setFetchSize(2)", log.get(i++));
assertEquals("setString(1,a)", log.get(i++));
assertEquals("executeQuery()", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("getString(value)", log.get(i++));
assertEquals("next()", log.get(i++));
assertEquals("close()", log.get(i++));
assertEquals("close()", log.get(i));
}
public enum MyEnum {
A("a"),
B("b"),
C("c");
private final String value;
MyEnum(String value) {
this.value = value;
}
public static MyEnum getEnum(String value) {
for (MyEnum e : values()) {
if (e.getValue().equals(value)) {
return e;
}
}
return null;
}
public String getValue() {
return value;
}
}
public interface SelectQueries extends BaseQuery {
@Query(sql = "select value {enum%%} from test where e = {enum%1}")
MyEnum selectEnum(MyEnum e) throws SQLException;
@Query(sql = "select value {enum%%1} from test where e = {enum%1}")
MyClass selectEnumConstructor(MyEnum e) throws SQLException;
@Query(sql = "select value {enum%%*,enum%%} from test where e = {enum%1}")
Map<MyEnum, MyEnum> selectEnumMap(MyEnum e) throws SQLException;
@Call(sql = "{ {enum%%} = call proc( {enum%1} ) }")
MyEnum callEnum(MyEnum e) throws SQLException;
@Query(sql = "select value {my-enum%%} from test where e = {my-enum%1}")
MyEnum selectEnum2(MyEnum e) throws SQLException;
}
public static class MyClass {
private MyEnum value;
public MyClass(MyEnum value) {
this.value = value;
}
public MyEnum getValue() {
return value;
}
}
} | [
"renato@brunella.co.uk"
] | renato@brunella.co.uk |
bf3a7e283cabf1a1dc0beb4d0515ce5f5eef6f48 | ce122446cb0493e2f744e37a7e6c3b0d2bb06f44 | /fe/java-udf/src/main/java/org/apache/doris/udf/UdafExecutor.java | 7ce47b48373582096f16fcebedb91ed707408010 | [
"Apache-2.0",
"BSD-3-Clause",
"PSF-2.0",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"dtoa",
"MIT",
"LicenseRef-scancode-facebook-patent-rights-2",
"bzip2-1.0.6",
"OpenSSL"
] | permissive | yanghongkjxy/palo | 1ce1ae3602e88f4ea8246135e310fddf3ba0c98e | afed14ba3181d0f0949acf5b1eec93e99fa3cf88 | refs/heads/master | 2023-04-02T12:42:03.643847 | 2023-03-18T02:49:09 | 2023-03-18T02:49:09 | 143,609,059 | 0 | 0 | Apache-2.0 | 2018-09-26T09:01:47 | 2018-08-05T12:01:32 | C++ | UTF-8 | Java | false | false | 11,738 | 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.doris.udf;
import org.apache.doris.catalog.Type;
import org.apache.doris.common.Pair;
import org.apache.doris.thrift.TJavaUdfExecutorCtorParams;
import org.apache.doris.udf.UdfUtils.JavaUdfDataType;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import org.apache.log4j.Logger;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
/**
* udaf executor.
*/
public class UdafExecutor extends BaseExecutor {
private static final Logger LOG = Logger.getLogger(UdafExecutor.class);
private long inputPlacesPtr;
private HashMap<String, Method> allMethods;
private HashMap<Long, Object> stateObjMap;
private Class retClass;
/**
* Constructor to create an object.
*/
public UdafExecutor(byte[] thriftParams) throws Exception {
super(thriftParams);
}
/**
* close and invoke destroy function.
*/
@Override
public void close() {
allMethods = null;
super.close();
}
/**
* invoke add function, add row in loop [rowStart, rowEnd).
*/
public void add(boolean isSinglePlace, long rowStart, long rowEnd) throws UdfRuntimeException {
try {
long idx = rowStart;
do {
Long curPlace = UdfUtils.UNSAFE.getLong(null, UdfUtils.UNSAFE.getLong(null, inputPlacesPtr) + 8L * idx);
Object[] inputArgs = new Object[argTypes.length + 1];
stateObjMap.putIfAbsent(curPlace, createAggState());
inputArgs[0] = stateObjMap.get(curPlace);
do {
Object[] inputObjects = allocateInputObjects(idx, 1);
for (int i = 0; i < argTypes.length; ++i) {
inputArgs[i + 1] = inputObjects[i];
}
allMethods.get(UDAF_ADD_FUNCTION).invoke(udf, inputArgs);
idx++;
} while (isSinglePlace && idx < rowEnd);
} while (idx < rowEnd);
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to add: ", e);
}
}
/**
* invoke user create function to get obj.
*/
public Object createAggState() throws UdfRuntimeException {
try {
return allMethods.get(UDAF_CREATE_FUNCTION).invoke(udf, null);
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to create: ", e);
}
}
/**
* invoke destroy before colse. Here we destroy all data at once
*/
public void destroy() throws UdfRuntimeException {
try {
for (Object obj : stateObjMap.values()) {
allMethods.get(UDAF_DESTROY_FUNCTION).invoke(udf, obj);
}
stateObjMap.clear();
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to destroy: ", e);
}
}
/**
* invoke serialize function and return byte[] to backends.
*/
public byte[] serialize(long place) throws UdfRuntimeException {
try {
Object[] args = new Object[2];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
args[0] = stateObjMap.get((Long) place);
args[1] = new DataOutputStream(baos);
allMethods.get(UDAF_SERIALIZE_FUNCTION).invoke(udf, args);
return baos.toByteArray();
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to serialize: ", e);
}
}
/**
* invoke merge function and it's have done deserialze.
* here call deserialize first, and call merge.
*/
public void merge(long place, byte[] data) throws UdfRuntimeException {
try {
Object[] args = new Object[2];
ByteArrayInputStream bins = new ByteArrayInputStream(data);
args[0] = createAggState();
args[1] = new DataInputStream(bins);
allMethods.get(UDAF_DESERIALIZE_FUNCTION).invoke(udf, args);
args[1] = args[0];
Long curPlace = place;
stateObjMap.putIfAbsent(curPlace, createAggState());
args[0] = stateObjMap.get(curPlace);
allMethods.get(UDAF_MERGE_FUNCTION).invoke(udf, args);
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to merge: ", e);
}
}
/**
* invoke getValue to return finally result.
*/
public boolean getValue(long row, long place) throws UdfRuntimeException {
try {
return storeUdfResult(allMethods.get(UDAF_RESULT_FUNCTION).invoke(udf, stateObjMap.get((Long) place)),
row, retClass);
} catch (Exception e) {
throw new UdfRuntimeException("UDAF failed to result", e);
}
}
@Override
protected boolean storeUdfResult(Object obj, long row, Class retClass) throws UdfRuntimeException {
if (obj == null) {
// If result is null, return true directly when row == 0 as we have already inserted default value.
if (UdfUtils.UNSAFE.getLong(null, outputNullPtr) == -1) {
throw new UdfRuntimeException("UDAF failed to store null data to not null column");
}
return true;
}
return super.storeUdfResult(obj, row, retClass);
}
@Override
protected long getCurrentOutputOffset(long row, boolean isArrayType) {
if (isArrayType) {
return Integer.toUnsignedLong(
UdfUtils.UNSAFE.getInt(null, UdfUtils.UNSAFE.getLong(null, outputOffsetsPtr) + 8L * (row - 1)));
} else {
return Integer.toUnsignedLong(
UdfUtils.UNSAFE.getInt(null, UdfUtils.UNSAFE.getLong(null, outputOffsetsPtr) + 4L * (row - 1)));
}
}
@Override
protected void init(TJavaUdfExecutorCtorParams request, String jarPath, Type funcRetType,
Type... parameterTypes) throws UdfRuntimeException {
String className = request.fn.aggregate_fn.symbol;
inputPlacesPtr = request.input_places_ptr;
allMethods = new HashMap<>();
stateObjMap = new HashMap<>();
ArrayList<String> signatures = Lists.newArrayList();
try {
ClassLoader loader;
if (jarPath != null) {
ClassLoader parent = getClass().getClassLoader();
classLoader = UdfUtils.getClassLoader(jarPath, parent);
loader = classLoader;
} else {
// for test
loader = ClassLoader.getSystemClassLoader();
}
Class<?> c = Class.forName(className, true, loader);
Constructor<?> ctor = c.getConstructor();
udf = ctor.newInstance();
Method[] methods = c.getDeclaredMethods();
int idx = 0;
for (idx = 0; idx < methods.length; ++idx) {
signatures.add(methods[idx].toGenericString());
switch (methods[idx].getName()) {
case UDAF_DESTROY_FUNCTION:
case UDAF_CREATE_FUNCTION:
case UDAF_MERGE_FUNCTION:
case UDAF_SERIALIZE_FUNCTION:
case UDAF_DESERIALIZE_FUNCTION: {
allMethods.put(methods[idx].getName(), methods[idx]);
break;
}
case UDAF_RESULT_FUNCTION: {
allMethods.put(methods[idx].getName(), methods[idx]);
Pair<Boolean, JavaUdfDataType> returnType = UdfUtils.setReturnType(funcRetType,
methods[idx].getReturnType());
if (!returnType.first) {
LOG.debug("result function set return parameterTypes has error");
} else {
retType = returnType.second;
retClass = methods[idx].getReturnType();
}
break;
}
case UDAF_ADD_FUNCTION: {
allMethods.put(methods[idx].getName(), methods[idx]);
argClass = methods[idx].getParameterTypes();
if (argClass.length != parameterTypes.length + 1) {
LOG.debug("add function parameterTypes length not equal " + argClass.length + " "
+ parameterTypes.length + " " + methods[idx].getName());
}
if (!(parameterTypes.length == 0)) {
Pair<Boolean, JavaUdfDataType[]> inputType = UdfUtils.setArgTypes(parameterTypes,
argClass, true);
if (!inputType.first) {
LOG.debug("add function set arg parameterTypes has error");
} else {
argTypes = inputType.second;
}
} else {
// Special case where the UDF doesn't take any input args
argTypes = new JavaUdfDataType[0];
}
break;
}
default:
break;
}
}
if (idx == methods.length) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append("Unable to find evaluate function with the correct signature: ").append(className + ".evaluate(")
.append(Joiner.on(", ").join(parameterTypes)).append(")\n").append("UDF contains: \n ")
.append(Joiner.on("\n ").join(signatures));
throw new UdfRuntimeException(sb.toString());
} catch (MalformedURLException e) {
throw new UdfRuntimeException("Unable to load jar.", e);
} catch (SecurityException e) {
throw new UdfRuntimeException("Unable to load function.", e);
} catch (ClassNotFoundException e) {
throw new UdfRuntimeException("Unable to find class.", e);
} catch (NoSuchMethodException e) {
throw new UdfRuntimeException("Unable to find constructor with no arguments.", e);
} catch (IllegalArgumentException e) {
throw new UdfRuntimeException("Unable to call UDAF constructor with no arguments.", e);
} catch (Exception e) {
throw new UdfRuntimeException("Unable to call create UDAF instance.", e);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5372be5104ea86a873169445b3f32b1a3c564105 | e1c4d7afd59fb0e8eb5079a240da7171b665e163 | /src/test/java/com/lazerycode/selenium/page_objects/AbstractPage.java | 31efee1992c117d0e7a86a5726c14c26f89efa96 | [] | no_license | tirthb/robinhood_crawl | fef1c2ac27ae690b56a7702381e62f0c637290e5 | ad1698cd2a32547526af0f12fa9698943a0bdc39 | refs/heads/master | 2022-05-13T02:45:46.065696 | 2022-04-09T01:06:00 | 2022-04-09T01:06:00 | 203,474,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.lazerycode.selenium.page_objects;
import com.lazerycode.selenium.util.Query;
public abstract class AbstractPage {
public void sendKeys(Query q, String term) {
q.findWebElement().clear();
q.findWebElement().sendKeys(term);
}
}
| [
"tbhowmick@equilar.com"
] | tbhowmick@equilar.com |
197d64cdf2f0b1307f092027d8d3c8af647a656c | ab1be1b43edc31a969a4eba4344ddea2eb9219bb | /integracion/SNR/Datos_Basicos_Predio/Proyecto/srvIntConsultaDatosBasicosPredio/src/main/java/com/koghi/nodo/snr/WSDL/srvIntConsultarDatosBasicos/TipoTipoSociedad.java | 82d3e0d7a9f8de6d6c3fff64202dd61a2388e76f | [] | no_license | jarivera94/esb | ada170f09615de1efdd862e5e8b838b82d7f6fce | 0f8855d491e25a5b359a2867e7abfb189516ddc4 | refs/heads/master | 2020-04-05T00:42:22.636179 | 2018-11-06T15:45:35 | 2018-11-06T15:45:35 | 156,407,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,137 | java |
package com.koghi.nodo.snr.WSDL.srvIntConsultarDatosBasicos;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for tipoTipoSociedad complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="tipoTipoSociedad">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codTipoSociedad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="nomTipoSociedad" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tipoTipoSociedad", propOrder = {
"codTipoSociedad",
"nomTipoSociedad"
})
public class TipoTipoSociedad {
protected String codTipoSociedad;
protected String nomTipoSociedad;
/**
* Gets the value of the codTipoSociedad property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCodTipoSociedad() {
return codTipoSociedad;
}
/**
* Sets the value of the codTipoSociedad property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCodTipoSociedad(String value) {
this.codTipoSociedad = value;
}
/**
* Gets the value of the nomTipoSociedad property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNomTipoSociedad() {
return nomTipoSociedad;
}
/**
* Sets the value of the nomTipoSociedad property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNomTipoSociedad(String value) {
this.nomTipoSociedad = value;
}
}
| [
"jrivera@koghi.com"
] | jrivera@koghi.com |
3fa87a37497d92506132f44a141bc744b10af937 | 31243d1e39239d5b5888a07ed420a26943a5c761 | /main/java/bsz/service/strategies/TenthTicketStrategy.java | 2777c9ed61acffdb4b4325e53412c2b51d1e0fc7 | [] | no_license | szbwork/springhw | 782a0414d0acc3d0bc9fe009f9f32873e82a197a | 4afd42569358b255253b671ed0dc97540657b8d0 | refs/heads/master | 2020-04-05T00:45:50.986448 | 2018-11-08T19:37:42 | 2018-11-08T19:37:42 | 156,409,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | java | package bsz.service.strategies;
import bsz.domain.Event;
import bsz.domain.User;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.time.LocalDateTime;
public class TenthTicketStrategy implements DiscountStrategy {
@Override
public byte calculatePossibleDiscount(@Nullable User user, @Nonnull Event event, @Nonnull LocalDateTime airDateTime, long numberOfTickets) {
double fullPrice = event.getBasePrice()*numberOfTickets;
double discount = event.getBasePrice()*(int)(numberOfTickets/10)*0.05;
double totalPrice = fullPrice-discount;
return ((Double)((1-(totalPrice/fullPrice))*100)).byteValue();
}
}
| [
"szbwork@gmail.com"
] | szbwork@gmail.com |
e2b5f6d29ae1c462f3c8fe6e7dff72b08889d46d | 087b12cc9963b26e62ce5c3b2de7e99f65522749 | /TextAreaKeyListener.java | eefff52a3e0f9c3a86ecab631cdfa66ef5be265c | [] | no_license | bishosilwal/typeNepali | 279c43c3154baaf74939b99df03bd3e6ecebd8a9 | de5496bdda84cc484f0fdf18187dfc9e7dc5f9e3 | refs/heads/master | 2021-01-13T11:32:12.041274 | 2020-08-26T15:24:23 | 2020-08-26T15:24:23 | 82,372,007 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,026 | java | import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class TextAreaKeyListener extends KeyAdapter {
private KeyMap mapper;
private int tempIndex;
private String typedKey, temp;
private boolean actionKey;
private static String romanWord = "";
private static boolean space;
TextAreaKeyListener() {
mapper = new KeyMap();
actionKey = false;
space = false;
}
@Override
public void keyPressed(KeyEvent e) {
if (!Button.isROMANIZED()) {
if (e.isShiftDown()) {
if (KeyBoardButtonListener.isShiftKey()) {
KeyBoardButtonListener.setShiftKey(false);
KeyBoardButtonListener.setIcon(41, "unclick");
} else {
KeyBoardButtonListener.setIcon(41, "click");
KeyBoardButtonListener.setShiftKey(true);
}
} else if (Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)) {
return;
} else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
typedKey = mapper.getUnicode("space");
tempIndex = mapper.getImageIndex("space");
KeyBoardButtonListener.setIcon(tempIndex, "click");
DisplayNepali.setText(typedKey);
if (KeyBoardButtonListener.getTemp_prev_index() != -1
&& KeyBoardButtonListener.getTemp_prev_index() != tempIndex)
KeyBoardButtonListener.setIcon(KeyBoardButtonListener.getTemp_prev_index(), "unclick");
KeyBoardButtonListener.setTemp_prev_index(tempIndex);
actionKey = true;
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
tempIndex = mapper.getImageIndex("enter");
KeyBoardButtonListener.setIcon(tempIndex, "click");
if (KeyBoardButtonListener.getTemp_prev_index() != -1)
KeyBoardButtonListener.setIcon(KeyBoardButtonListener.getTemp_prev_index(), "unclick");
KeyBoardButtonListener.setTemp_prev_index(tempIndex);
actionKey = true;
}
} else {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
actionKey = true;
} else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
if (!space) {
if (mapper.getUnicode(romanWord) != null) {
typedKey = mapper.getUnicode(romanWord);
DisplayNepali.setText(typedKey);
space = true;
}
romanWord = "";
} else {
space = false;
}
actionKey = true;
return;
} else if (e.getKeyCode() == KeyEvent.VK_TAB) {
actionKey = true;
} else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
romanWord = "";
actionKey = true;
}
space = false;
}
}
@Override
public void keyTyped(KeyEvent e) {
if (actionKey) {
actionKey = false;
if (Button.isROMANIZED()) {
if (space) {
e.consume();
}
}
return;
}
char ch = e.getKeyChar();
if (Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)) {
ch = Character.toLowerCase(ch);
}
temp = Character.toString(ch);
e.consume();
if (!Button.isROMANIZED()) {
if (temp.equals("#")) {
tempIndex = mapper.getImageIndex("3");
typedKey = mapper.getUpperCode("3");
} else if (temp.equals("$")) {
tempIndex = mapper.getImageIndex("4");
typedKey = mapper.getUpperCode("4");
} else if (temp.equals("%")) {
tempIndex = mapper.getImageIndex("5");
typedKey = mapper.getUpperCode("5");
} else if (temp.equals("^")) {
tempIndex = mapper.getImageIndex("6");
typedKey = mapper.getUpperCode("6");
} else if (temp.equals("&")) {
tempIndex = mapper.getImageIndex("7");
typedKey = mapper.getUpperCode("7");
} else if (temp.equals(")")) {
tempIndex = mapper.getImageIndex("0");
typedKey = mapper.getUpperCode("0");
} else if (temp.equals("_")) {
tempIndex = mapper.getImageIndex("-");
typedKey = mapper.getUpperCode("-");
} else if (temp.equals("+")) {
tempIndex = mapper.getImageIndex("=");
typedKey = mapper.getUpperCode("=");
} else if (temp.equals("<")) {
tempIndex = mapper.getImageIndex(",");
typedKey = mapper.getUpperCode("<");
} else if (Character.isUpperCase(ch)) {
tempIndex = mapper.getImageIndex(temp.toLowerCase());
typedKey = mapper.getUpperCode(temp);
} else {
if (KeyBoardButtonListener.isShiftKey() || KeyBoardButtonListener.isCapsKey()) {
typedKey = mapper.getUpperCode(temp.toUpperCase());
} else {
typedKey = mapper.getLowerCode(temp);
}
tempIndex = mapper.getImageIndex(temp.toLowerCase());
}
if (KeyBoardButtonListener.isShiftKey()) {
KeyBoardButtonListener.setShiftKey(false);
KeyBoardButtonListener.setIcon(mapper.getImageIndex("lshift"), "unclick");
KeyBoardButtonListener.setIcon(mapper.getImageIndex("rshift"), "unclick");
}
if (KeyBoardButtonListener.getTemp_prev_index() != tempIndex) {
KeyBoardButtonListener.setIcon(tempIndex, "click");
if (KeyBoardButtonListener.getTemp_prev_index() != -1)
KeyBoardButtonListener.setIcon(KeyBoardButtonListener.getTemp_prev_index(), "unclick");
KeyBoardButtonListener.setTemp_prev_index(tempIndex);
}
DisplayNepali.setText(typedKey);
} else {
romanWord = romanWord + temp;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c4a57bf5494fc643f44c21fd304644f120975e69 | cd8fabc171de8c49345d87b5e64ad9e1885f91fa | /WearableSunshineRelease/app/src/main/java/com/coderbunker/android/sunshine/TestNodeActivity.java | 18b6cfdd8aa4e4f2279ce1d1f0fb7416579df861 | [] | no_license | Gelassen/android-wearable-samples | 403830beeda168e61f56ea4a9a77d3fbefb04619 | 54c51cc1ada98dafb933fc8f181d180cdb605729 | refs/heads/master | 2020-05-15T13:25:16.689808 | 2017-06-19T02:04:05 | 2017-06-19T02:04:05 | 42,582,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,544 | java | package com.coderbunker.android.sunshine;
import android.util.Log;
import com.coderbunker.android.sunshine.library.BaseActivity;
import com.google.android.gms.wearable.CapabilityApi;
import com.google.android.gms.wearable.CapabilityInfo;
import com.google.android.gms.wearable.MessageApi;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.Wearable;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class TestNodeActivity extends BaseActivity implements
MessageApi.MessageListener {
private static final String VOICE_TRANSCRIPTION_CAPABILITY_NAME = "msg";
@Override
public void subscribe() {
Log.d(App.TAG, "subscribe");
Wearable.MessageApi.addListener(googleApiClient, this);
setupVoiceTranscription();
}
@Override
public void unsubscribe() {
Log.d(App.TAG, "unsubscribe");
Wearable.MessageApi.removeListener(googleApiClient, this);
}
@Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.d(App.TAG, "onMessageReceived");
}
private void setupVoiceTranscription() {
Log.d(App.TAG, "setupVoiceTranscription");
Executor executor = Executors.newSingleThreadExecutor();
executor.execute(new Runnable() {
@Override
public void run() {
CapabilityApi.GetCapabilityResult result =
Wearable.CapabilityApi.getCapability(
googleApiClient, VOICE_TRANSCRIPTION_CAPABILITY_NAME,
CapabilityApi.FILTER_REACHABLE).await();
Log.d(App.TAG, "Nodes: " + result.getCapability().getNodes().size());
// updateTranscriptionCapability(result.getCapability());
CapabilityApi.CapabilityListener capabilityListener =
new CapabilityApi.CapabilityListener() {
@Override
public void onCapabilityChanged(CapabilityInfo capabilityInfo) {
// updateTranscriptionCapability(capabilityInfo);
Log.d(App.TAG, "onCapabilityChanged");
}
};
Wearable.CapabilityApi.addCapabilityListener(
googleApiClient,
capabilityListener,
VOICE_TRANSCRIPTION_CAPABILITY_NAME);
}
});
}
}
| [
"dmitrii.kazakov@gmail.com"
] | dmitrii.kazakov@gmail.com |
ad8e8feb022b2c21392096100fb593331a370da6 | 08f202d1c1b82f7d37e264370fd691fab33bde65 | /app/src/main/java/br/com/miller/farmaciaatendente/domain/Departament.java | 5e05c87c20f6a1a4e15eac108d39b214830163d7 | [] | no_license | miller00315/muck-up-bula-atendente | 998bac4dd8406a33ae9ca9403adc19d6b227e093 | be19f83bdea8ec6523f612899b53025812525822 | refs/heads/master | 2020-12-07T08:35:38.105156 | 2019-08-05T00:51:38 | 2019-08-05T00:51:38 | 232,685,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,962 | java | package br.com.miller.farmaciaatendente.domain;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class Departament implements Parcelable {
private String title;
private String id;
private String idStore;
private ArrayList<Offer> offers;
private String city;
public void setCity(String city) { this.city = city; }
public String getCity() { return city; }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getIdStore() {
return idStore;
}
public void setIdStore(String idStore) {
this.idStore = idStore;
}
public ArrayList<Offer> getOffers() {
return offers;
}
public void setOffers(ArrayList<Offer> offers) {
this.offers = offers;
}
public Departament(Object o){
if(o instanceof HashMap){
HashMap hashMap = (HashMap) o;
this.city = Objects.requireNonNull(hashMap.get("city")).toString();
if(hashMap.containsKey("idStore"))
this.idStore = Objects.requireNonNull(hashMap.get("idStore")).toString();
this.title = Objects.requireNonNull(hashMap.get("title")).toString();
this.id = Objects.requireNonNull(hashMap.get("id")).toString();
this.offers = new ArrayList<>();
if(hashMap.containsKey("offers")){
HashMap temp = (HashMap) hashMap.get("offers");
if(temp != null) {
for(Object offer : temp.values()){
offers.add(new Offer(offer));
}
}
}
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.title);
dest.writeString(this.id);
dest.writeString(this.idStore);
dest.writeTypedList(this.offers);
dest.writeString(this.city);
}
public Departament() {
}
protected Departament(Parcel in) {
this.title = in.readString();
this.id = in.readString();
this.idStore = in.readString();
this.offers = in.createTypedArrayList(Offer.CREATOR);
this.city = in.readString();
}
public static final Parcelable.Creator<Departament> CREATOR = new Parcelable.Creator<Departament>() {
@Override
public Departament createFromParcel(Parcel source) {
return new Departament(source);
}
@Override
public Departament[] newArray(int size) {
return new Departament[size];
}
};
}
| [
"miller00315@gmail.com"
] | miller00315@gmail.com |
b1c39489bab52668e192f27d66de5adf2bad476c | 5dd84e9ca419ed669e11c236a845b0c1645cf180 | /com/planet_ink/coffee_mud/MOBS/Doppleganger.java | f11581a21777533d0c8d9282636481c538d3776e | [
"Apache-2.0"
] | permissive | jmbflat/CoffeeMud | 0ab169f8d473f0aa3534ffe3c0ae82ed9a221ec8 | c6e48d89aa58332ae030904550442155e673488c | refs/heads/master | 2023-02-16T04:21:26.845481 | 2021-01-09T01:36:11 | 2021-01-09T01:36:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,618 | java | package com.planet_ink.coffee_mud.MOBS;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2001-2020 Bo Zimmerman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class Doppleganger extends StdMOB
{
@Override
public String ID()
{
return "Doppleganger";
}
protected MOB mimicing=null;
protected long ticksSinceMimicing=0;
public Doppleganger()
{
super();
revert();
}
protected void revert()
{
final Random randomizer = new Random(System.currentTimeMillis());
_name="a doppleganger";
setDescription("A formless biped creature, with wicked black eyes.");
setDisplayText("A formless biped stands here.");
setBasePhyStats((PhyStats)CMClass.getCommon("DefaultPhyStats"));
setBaseCharStats((CharStats)CMClass.getCommon("DefaultCharStats"));
setBaseState((CharState)CMClass.getCommon("DefaultCharState"));
CMLib.factions().setAlignment(this,Faction.Align.EVIL);
setMoney(250);
basePhyStats.setWeight(100 + Math.abs(randomizer.nextInt() % 101));
baseCharStats().setStat(CharStats.STAT_INTELLIGENCE,10 + Math.abs(randomizer.nextInt() % 6));
baseCharStats().setStat(CharStats.STAT_STRENGTH,12 + Math.abs(randomizer.nextInt() % 6));
baseCharStats().setStat(CharStats.STAT_DEXTERITY,9 + Math.abs(randomizer.nextInt() % 6));
basePhyStats().setDamage(7);
basePhyStats().setSpeed(2.0);
basePhyStats().setAbility(0);
basePhyStats().setLevel(6);
basePhyStats().setArmor(70);
baseState.setHitPoints(CMLib.dice().roll(basePhyStats().level(),20,basePhyStats().level()));
addBehavior(CMClass.getBehavior("Mobile"));
addBehavior(CMClass.getBehavior("MudChat"));
recoverMaxState();
resetToMaxState();
recoverPhyStats();
recoverCharStats();
}
@Override
public boolean tick(final Tickable ticking, final int tickID)
{
if((!amDead())&&(tickID==Tickable.TICKID_MOB))
{
if(mimicing!=null)
{
ticksSinceMimicing++;
if(ticksSinceMimicing>500)
{
revert();
}
}
}
return super.tick(ticking,tickID);
}
@Override
public DeadBody killMeDead(final boolean createBody)
{
revert();
return super.killMeDead(createBody);
}
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if((msg.amITarget(this))&&(CMath.bset(msg.targetMajor(),CMMsg.MASK_MALICIOUS)))
{
if(mimicing!=null)
{
if((mimicing.getVictim()!=null)&&(mimicing.getVictim()!=this))
mimicing=null;
else
if((mimicing.location()!=null)&&(mimicing.location()!=location()))
mimicing=null;
}
if((mimicing==null)&&(location()!=null))
{
location().show(this,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> take(s) on a new form!"));
mimicing=msg.source();
_name=mimicing.Name();
setDisplayText(mimicing.displayText());
setDescription(mimicing.description());
setBasePhyStats((PhyStats)mimicing.basePhyStats().copyOf());
setBaseCharStats((CharStats)mimicing.baseCharStats().copyOf());
setBaseState((CharState)mimicing.baseState().copyOf());
recoverPhyStats();
recoverCharStats();
recoverMaxState();
resetToMaxState();
ticksSinceMimicing=0;
}
}
return true;
}
}
| [
"bo@zimmers.net"
] | bo@zimmers.net |
51ea11166c42dda48dfe3b1b7d1d6dd2ceb3c8d5 | 226b3f8bcb1c229849e7bb0ea8aa4f5498167520 | /src/com/housie/util/TicketGenerator.java | 1699a3d763cb25f68825dcdf9b9dd750e03aacf0 | [] | no_license | sachingade20/housie | 23649edd4e88f52da805e2ff88190846735da79f | 6b37822cdb609c19d4313c2681e3ccb45aa0a1a6 | refs/heads/master | 2020-04-15T01:14:08.358592 | 2015-05-10T13:09:17 | 2015-05-10T13:09:17 | 35,371,125 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java | package com.housie.util;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Vector;
import com.housie.model.InputData;
import com.housie.model.Ticket;
public class TicketGenerator
{
public static PrintWriter generateSheets(InputData input, PrintWriter out) throws IOException
{
ExcelUtil.read();
TicketGeneratorAlgo ticketGenerator = new TicketGeneratorAlgo();
int numberOfPlayers = Integer.parseInt(input.getSheet());
HtmlUtils hu = new HtmlUtils();
out.print(hu.createHtmlHeader("--------------Tambola--------------------"));
Vector av = new Vector();
for (int player = 0; player < numberOfPlayers; player++)
{
Ticket ticket = ticketGenerator.generateTicket();
System.out.println(ticket);
out.print(hu.getTableHead("center", 1));
av = new Vector();
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
if (ticket.getNumbers()[i][j] == null)
{
av.addElement("------");
}
else
{
int index=Integer.parseInt(ticket.getNumbers()[i][j]);
av.addElement(ExcelUtil.inputList.get(index-1));
}
}
}
out.print(hu.getTableContents("center", av, 9,200));
out.print(hu.getBR(25));
}
printAllInputs(input, out, hu);
out.print(hu.getHtmlFooter());
return out;
}
private static void printAllInputs(InputData input, PrintWriter out,HtmlUtils hu) throws IOException
{
out.print(hu.getTableHead("center", 1));
Vector av = new Vector();
for (String obj:ExcelUtil.inputList)
{
av.addElement(obj);
}
out.print(hu.getTableContents("center", av, 10,50));
out.print(hu.getBR(25));
}
}
| [
"sachin.gade@clogeny.com"
] | sachin.gade@clogeny.com |
1239fba14a1cbc6a63f10448db98eeffb8ebb681 | 1c73912a857e629a3245c218b1a344640a263b71 | /QACaseStudy/src/test/java/stepdefs/ResponseValidationTest.java | 3aad01d70c2d3f5c21a7a0e86148bda7301e2309 | [
"Apache-2.0"
] | permissive | achchu/postcodes-api-tests | a3d92b575e6bb25f51bf3ed40e7f5df1a20c5351 | a696a5028df2aca4c1fc351805ebbd8a0c0054b3 | refs/heads/master | 2022-01-25T10:13:28.338161 | 2022-01-19T11:29:39 | 2022-01-19T11:29:39 | 136,812,616 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,226 | java | package stepdefs;
import com.google.gson.Gson;
import com.jayway.restassured.response.Response;
import cucumber.api.java.Before;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import javafx.geometry.Pos;
import org.testng.annotations.Test;
import utils.DbModule;
import utils.PostcodeAPI;
import java.util.Map;
import static com.jayway.restassured.RestAssured.get;
import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.testng.Assert.assertEquals;
/**
* Class to test api response and format
*/
public class ResponseValidationTest {
private Response response;
private Map<String, String> responseJson;
private String formattedJson;
private Map<String, String> resultValueList;
private String actualRandomPostcode;
@Before
public void setup() {
}
/**
* Method to query from the api
*/
@When("a user queries for postcode")
public void queryPostCode() {
this.response = get(PostcodeAPI.endPoint + "/" + "NR330AU");
this.responseJson = this.response.body().jsonPath().get();
Gson gson = new Gson();
this.formattedJson = gson.toJson(this.responseJson);
}
/**
* Method to validate JSON format
*/
@Then("it should produce expected JSON format")
public void expectedResponse() {
assertThat(this.formattedJson, matchesJsonSchemaInClasspath("responseSchema.json"));
}
/**
* Method to query specific postcode
*
* @param specificPostcode
*/
@When("^user queries for random \"([^\\“]*)\"$")
public void randomPostCode(String specificPostcode) {
Response response = get(PostcodeAPI.endPoint + "/" + specificPostcode);
this.resultValueList = response.body().jsonPath().getMap("result");
this.actualRandomPostcode = this.resultValueList.get("postcode");
}
/**
* Method to validate specific postcode information with database
*/
@Then("ensure that it matches the database")
public void matchDB() {
assertEquals(this.actualRandomPostcode, DbModule.getPostcodeFromDatabase());
}
}
| [
"achchuthan.ganeshanathan@trivago.com"
] | achchuthan.ganeshanathan@trivago.com |
2fc2bb07b15088063b5bb540a7a740cd8a91b35f | 43ca534032faa722e206f4585f3075e8dd43de6c | /src/android/support/v4/view/a/b.java | 6a353bbc0a931a2a9df5ba46ce7863338c685e95 | [] | no_license | dnoise/IG-6.9.1-decompiled | 3e87ba382a60ba995e582fc50278a31505109684 | 316612d5e1bfd4a74cee47da9063a38e9d50af68 | refs/heads/master | 2021-01-15T12:42:37.833988 | 2014-10-29T13:17:01 | 2014-10-29T13:17:01 | 26,952,948 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,498 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package android.support.v4.view.a;
import android.graphics.Rect;
// Referenced classes of package android.support.v4.view.a:
// g, h
class b extends g
{
b()
{
}
public final int a(Object obj)
{
return android.support.v4.view.a.h.a(obj);
}
public final void a(Object obj, int i1)
{
android.support.v4.view.a.h.a(obj, i1);
}
public final void a(Object obj, Rect rect)
{
android.support.v4.view.a.h.a(obj, rect);
}
public final void a(Object obj, CharSequence charsequence)
{
android.support.v4.view.a.h.a(obj, charsequence);
}
public final void a(Object obj, boolean flag)
{
android.support.v4.view.a.h.a(obj, flag);
}
public final CharSequence b(Object obj)
{
return android.support.v4.view.a.h.b(obj);
}
public final void b(Object obj, Rect rect)
{
android.support.v4.view.a.h.b(obj, rect);
}
public final CharSequence c(Object obj)
{
return android.support.v4.view.a.h.c(obj);
}
public final CharSequence d(Object obj)
{
return android.support.v4.view.a.h.d(obj);
}
public final CharSequence e(Object obj)
{
return android.support.v4.view.a.h.e(obj);
}
public final boolean f(Object obj)
{
return android.support.v4.view.a.h.f(obj);
}
public final boolean g(Object obj)
{
return android.support.v4.view.a.h.g(obj);
}
public final boolean h(Object obj)
{
return android.support.v4.view.a.h.h(obj);
}
public final boolean i(Object obj)
{
return android.support.v4.view.a.h.i(obj);
}
public final boolean j(Object obj)
{
return android.support.v4.view.a.h.j(obj);
}
public final boolean k(Object obj)
{
return android.support.v4.view.a.h.k(obj);
}
public final boolean l(Object obj)
{
return android.support.v4.view.a.h.l(obj);
}
public final boolean m(Object obj)
{
return android.support.v4.view.a.h.m(obj);
}
public final boolean n(Object obj)
{
return android.support.v4.view.a.h.n(obj);
}
public final boolean o(Object obj)
{
return android.support.v4.view.a.h.o(obj);
}
}
| [
"leo.sjoberg@gmail.com"
] | leo.sjoberg@gmail.com |
b36d6350d282d46d0d2cdefd88a2a613566b874d | cbfc2798a09380d8a174b16f3465d4bc028cea90 | /alg-best-practice/src/main/java/johnny/dsa/practice/StringExamples.java | b14979a891648a85492151aec8ed0096d27698bc | [
"MIT"
] | permissive | C3vin/dsa-java | b3e9d9bf1a3e4ebea79b7fdc29e4f78b5700393c | 8328972a041c6676cade88c3e47c5769c3bd870e | refs/heads/master | 2022-12-09T11:54:07.001117 | 2020-09-23T06:26:21 | 2020-09-23T06:26:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,310 | java | package johnny.dsa.practice;
public class StringExamples {
public static void main(String[] args) {
StringExample();
StringSplit();
StringBuilderExmaple();
CharacterExample();
}
private static void StringExample() {
// convert string to char array
String str = "Hello";
char[] array = str.toCharArray(); // array = ['H','e','l','l','o']
// convert int to string
String str2 = String.valueOf(123); // str2 = "123"
// concatenate strings
String sub1 = "hello";
String sub2 = "123";
String str3 = sub1 + sub2; // str3 = "hello123";
// string comparison
String s1 = "abc";
String s2 = "abc";
if (s1 == s2) { // return false
}
if (s1.equals(s2)) { // return true;
}
}
private static void StringSplit() {
// Split string to string array
String sentence = "I am a software engineer";
String[] words = sentence.split(" "); // words = {"I", "am", "a", "software", "engineer"}
//Split string with regex.
String complex1 = "1+2i";
String[] x = complex1.split("\\+|i"); // x = {1, 2};
String complex2 = "1+2i3";
String[] y = complex2.split("\\+|i"); // y = {1, 2, 3};
String complex3 = "1+2i3";
String[] z = complex3.split("[+i]+"); // z = {1, 2, 3};
String str4 = "word1, word2 word3@word4?word5.word6";
String[] arrWords = str4.split("[, ?.@]+"); // arrWords = {"word1", "word2", "word3", "word4", "word5", "word6"}
String str5 = "Elmo will be on every kid's wishlist!";
String[] words3 = str5.split("\\W"); // words3 = {"Elmo", "will", "be", "on", "every", "kid", "s", "wishlist"}
String[] words4 = str5.split("[^\\w]"); // words4 = {"Elmo", "will", "be", "on", "every", "kid", "s", "wishlist"}
String[] words5 = str5.split("[^\\w']"); // words5 = {"Elmo", "will", "be", "on", "every", "kid's", "wishlist"}
String[] words6 = str5.split("[ '!]+"); // words6 = {"Elmo", "will", "be", "on", "every", "kid", "s", "wishlist"}
// The W metacharacter is used to find a word character.
// A word character is a character from a-z, A-Z, 0-9, including the _ (underscore) character.
String str6 = "Could you update -my age to variable _count? I'm 18.";
String[] words7 = str6.split("\\W");
// words7 = {"Could", "you", "update", "", "my", "age", "to", "variable", "_count", "", "I","m","18"}
String[] words8 = str6.split("[^\\w]");
// words8 = {"Could", "you", "update", "", "my", "age", "to", "variable", "_count", "", "I","m","18"}
String[] words9 = str6.replaceAll("[^a-zA-Z0-9_ ]", "").split("\\s+");
// words9 = {"Could", "you", "update", "my", "age", "to", "variable", "_count", "Im","18"}
String paragraph = "Bob hit a ball, the hit BALL flew far after it was hit.";
String[] words10 = paragraph.replaceAll("[^a-zA-Z ]", "").toLowerCase().split("\\s+");
// words10 = ["bob", "hit", "a", "ball", "the", "hit", "ball", "flew", "far", "after", "it", "was", "hit"];
}
private static void StringBuilderExmaple() {
// concatenate strings
String s1 = "hello";
String s2 = "123";
StringBuilder sb = new StringBuilder();
sb.append(s1);
sb.append(s2);
// stringbuilder to string
sb.toString(); // return "hello123";
// delete last character of a StringBuilder
sb.setLength(sb.length() - 1);
sb.toString(); // return "hello12";
// reverse
sb.reverse();
sb.toString(); // return "21olleh";
}
private static void CharacterExample() {
// get integer value from char
String s = "ab5d";
int x = Character.getNumericValue(s.charAt(2)); // x = 5
// check if character is number(one single character)
char c = '5';
Character.isDigit(c);
// same as
if (c >= '0' && c <= '9') {
}
// check if character is number or letter
Character.isLetterOrDigit(c);
// same as
if (c >= '0' && c <= '9' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z') {
}
}
}
| [
"jojozhuang@gmail.com"
] | jojozhuang@gmail.com |
e5c537df1f5e06b0b1e003e8be4a68137258381b | dcbba1baea0d6353dc1c54a7e26da5b782e71f5f | /FizzBuzzTest.java | 133d4deabf23ae2878011b54ad7aacb65dd3da8e | [] | no_license | Stuart-Yee/FizzBuzzJava | 7dc3078e382392c304b1a0a459dc054bde9b0b68 | 7e2b66842eb8f2d3ad38305cb52995956395daa7 | refs/heads/main | 2023-05-04T21:41:21.128097 | 2021-05-30T03:08:09 | 2021-05-30T03:08:09 | 372,112,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | public class FizzBuzzTest{
public static void main(String[] args){
System.out.println(FizzBuzz.fizzBuzz(4));
}
} | [
"noreply@github.com"
] | noreply@github.com |
396ec10d40d33f648c5f2d16e696baf9733e21da | 1c18cc0b1c374f3934eacf0010d31c9ac1a515b8 | /week/src/com/pluralsight/abb/Main.java | 744a9277d12c3446a42621eb1b0fa0f2ddb10c7e | [] | no_license | hendrybones/Aggree | ca252e3ed97e10b58211f240caa2797ebe2aa086 | 4d39b878936265232565d35f18450c2a016906a2 | refs/heads/master | 2023-06-19T05:32:15.149522 | 2021-07-19T08:56:58 | 2021-07-19T08:56:58 | 386,739,835 | 0 | 0 | null | 2021-07-19T08:56:59 | 2021-07-16T19:12:14 | Java | UTF-8 | Java | false | false | 252 | java | package com.pluralsight.abb;
import java.util.Scanner;
public class Main {
public static void main (String[]args){
Scanner scanner=new Scanner(System.in);
System.out.println("enter day of the week");
}
}
} | [
"hendrymwamburi56@gmail.com"
] | hendrymwamburi56@gmail.com |
a32316045ac63dadbc8a69050985096d217ef316 | 5a2023b2365f2e934c2f50cb63b7c82e78e767ed | /app/src/main/java/com/p/diabetz/MainActivity.java | 9c08a4d46c4e7dc0fda37deeb2762d79d51fe2a7 | [] | no_license | kamal-ezz/diabetes-tracker | 77d5a77be750595b7797f0a42c9ab87d4f8d3e52 | d97cf3b4b068d936bb70384f4a7e5db52cc519b8 | refs/heads/master | 2023-02-19T09:31:36.034003 | 2021-01-13T23:25:49 | 2021-01-13T23:25:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,332 | java | package com.p.diabetz;
import android.content.Intent;
import android.os.Bundle;
import com.google.android.material.tabs.TabLayout;
import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
private ViewPager viewPager;
private TabLayout tabLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // obtenir la référence de la barre d'outils
setSupportActionBar(toolbar); // Définition / remplacement de la barre d'outils comme ActionBar
// obtenir la référence de ViewPager et TabLayout
viewPager = (ViewPager) findViewById(R.id.view_pager);
tabLayout = (TabLayout) findViewById(R.id.tabs);
// Créer un nouvel onglet nommé "Accueil"
TabLayout.Tab firstTab = tabLayout.newTab();
firstTab.setText("Accueil"); // définir le texte du premier onglet
firstTab.setIcon(R.drawable.buildings); // définir une icône pour le premier onglet
tabLayout.addTab(firstTab); // ajouter l'onglet dans le TabLayout
TabLayout.Tab secondTab = tabLayout.newTab();
secondTab.setText("Mésures");
secondTab.setIcon(R.drawable.tools);
tabLayout.addTab(secondTab);
TabLayout.Tab thirdTab = tabLayout.newTab();
thirdTab.setText("Données");
thirdTab.setIcon(R.drawable.computing);
tabLayout.addTab(thirdTab);
MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(adapter);
// lorsqu'on clique sur un onglet il va afficher les données qu'il contient
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
// L'événement addOnPageChangeListener modifie l'onglet sur la diapositive
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
}
//lier le menu avec le fichier ressource correspandante
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.main_menu,menu);
return super.onCreateOptionsMenu(menu);
}
//les actions qui sont éxecutés dés qu'on clique sur un élement de menu
public boolean onOptionsItemSelected(MenuItem item){
int id = item.getItemId();
switch(id){
case R.id.about :
Intent intent = new Intent(getApplicationContext(), Apropos.class);
startActivity(intent);
break;
case R.id.share:
intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT,"Diabetz: une application génial pour suivre votre glycémie");
intent.setType("text/plain");
Intent.createChooser(intent,"Partager via");
startActivity(intent);
break;
case R.id.contacts:
intent = new Intent(getApplicationContext(),Contacts.class);
startActivity(intent);
break;
case R.id.settings:
intent = new Intent(getApplicationContext(), Parametres.class);
startActivity(intent);
break;
case R.id.export:
//Log.i("Info", "Export");
intent = new Intent(getApplicationContext(), Export.class);
startActivity(intent);
break;
}
return true;
}
} | [
"kamalezzarmou1999@gmail.com"
] | kamalezzarmou1999@gmail.com |
68004887e9f975917987a06f80e850237049462c | 9bc97f3f292c32ba21720f67ccb80c8d627dade0 | /libs/commons-dbcp-1.4-src/src/java/org/apache/commons/dbcp/PoolingDataSource.java | 122a7e6058c8f3d0f6300145d35b3cf3e8d1951d | [
"Zlib",
"EPL-1.0",
"LZMA-exception",
"bzip2-1.0.6",
"CPL-1.0",
"CDDL-1.0",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | liwei19911215/tomcat-7.0.x | ebf539cd75269d4d6382c04a65dbae45b8688df6 | 68742a7bad395d83c2a8cd25c70b0f7a4ee719cb | refs/heads/master | 2022-02-02T20:58:12.245956 | 2019-07-28T12:54:18 | 2019-07-28T12:54:18 | 199,286,962 | 0 | 0 | Apache-2.0 | 2022-01-21T23:36:57 | 2019-07-28T12:53:22 | Java | UTF-8 | Java | false | false | 14,791 | 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.commons.dbcp;
import java.io.PrintWriter;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Map;
import java.util.NoSuchElementException;
import javax.sql.DataSource;
import org.apache.commons.pool.ObjectPool;
/**
* A simple {@link DataSource} implementation that obtains
* {@link Connection}s from the specified {@link ObjectPool}.
*
* @author Rodney Waldhoff
* @author Glenn L. Nielsen
* @author James House
* @author Dirk Verbeeck
* @version $Revision: 895844 $ $Date: 2010-01-04 20:50:04 -0500 (Mon, 04 Jan 2010) $
*/
public class PoolingDataSource implements DataSource {
/** Controls access to the underlying connection */
private boolean accessToUnderlyingConnectionAllowed = false;
public PoolingDataSource() {
this(null);
}
public PoolingDataSource(ObjectPool pool) {
_pool = pool;
}
public void setPool(ObjectPool pool) throws IllegalStateException, NullPointerException {
if(null != _pool) {
throw new IllegalStateException("Pool already set");
} else if(null == pool) {
throw new NullPointerException("Pool must not be null.");
} else {
_pool = pool;
}
}
/**
* Returns the value of the accessToUnderlyingConnectionAllowed property.
*
* @return true if access to the underlying is allowed, false otherwise.
*/
public boolean isAccessToUnderlyingConnectionAllowed() {
return this.accessToUnderlyingConnectionAllowed;
}
/**
* Sets the value of the accessToUnderlyingConnectionAllowed property.
* It controls if the PoolGuard allows access to the underlying connection.
* (Default: false)
*
* @param allow Access to the underlying connection is granted when true.
*/
public void setAccessToUnderlyingConnectionAllowed(boolean allow) {
this.accessToUnderlyingConnectionAllowed = allow;
}
/* JDBC_4_ANT_KEY_BEGIN */
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
public <T> T unwrap(Class<T> iface) throws SQLException {
throw new SQLException("PoolingDataSource is not a wrapper.");
}
/* JDBC_4_ANT_KEY_END */
//--- DataSource methods -----------------------------------------
/**
* Return a {@link java.sql.Connection} from my pool,
* according to the contract specified by {@link ObjectPool#borrowObject}.
*/
public Connection getConnection() throws SQLException {
try {
Connection conn = (Connection)(_pool.borrowObject());
if (conn != null) {
conn = new PoolGuardConnectionWrapper(conn);
}
return conn;
} catch(SQLException e) {
throw e;
} catch(NoSuchElementException e) {
throw new SQLNestedException("Cannot get a connection, pool error " + e.getMessage(), e);
} catch(RuntimeException e) {
throw e;
} catch(Exception e) {
throw new SQLNestedException("Cannot get a connection, general error", e);
}
}
/**
* Throws {@link UnsupportedOperationException}
* @throws UnsupportedOperationException
*/
public Connection getConnection(String uname, String passwd) throws SQLException {
throw new UnsupportedOperationException();
}
/**
* Returns my log writer.
* @return my log writer
* @see DataSource#getLogWriter
*/
public PrintWriter getLogWriter() {
return _logWriter;
}
/**
* Throws {@link UnsupportedOperationException}.
* @throws UnsupportedOperationException As this
* implementation does not support this feature.
*/
public int getLoginTimeout() {
throw new UnsupportedOperationException("Login timeout is not supported.");
}
/**
* Throws {@link UnsupportedOperationException}.
* @throws UnsupportedOperationException As this
* implementation does not support this feature.
*/
public void setLoginTimeout(int seconds) {
throw new UnsupportedOperationException("Login timeout is not supported.");
}
/**
* Sets my log writer.
* @see DataSource#setLogWriter
*/
public void setLogWriter(PrintWriter out) {
_logWriter = out;
}
/** My log writer. */
protected PrintWriter _logWriter = null;
protected ObjectPool _pool = null;
/**
* PoolGuardConnectionWrapper is a Connection wrapper that makes sure a
* closed connection cannot be used anymore.
*/
private class PoolGuardConnectionWrapper extends DelegatingConnection {
private Connection delegate;
PoolGuardConnectionWrapper(Connection delegate) {
super(delegate);
this.delegate = delegate;
}
protected void checkOpen() throws SQLException {
if(delegate == null) {
throw new SQLException("Connection is closed.");
}
}
public void close() throws SQLException {
if (delegate != null) {
this.delegate.close();
this.delegate = null;
super.setDelegate(null);
}
}
public boolean isClosed() throws SQLException {
if (delegate == null) {
return true;
}
return delegate.isClosed();
}
public void clearWarnings() throws SQLException {
checkOpen();
delegate.clearWarnings();
}
public void commit() throws SQLException {
checkOpen();
delegate.commit();
}
public Statement createStatement() throws SQLException {
checkOpen();
return new DelegatingStatement(this, delegate.createStatement());
}
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
checkOpen();
return new DelegatingStatement(this, delegate.createStatement(resultSetType, resultSetConcurrency));
}
public boolean innermostDelegateEquals(Connection c) {
Connection innerCon = super.getInnermostDelegate();
if (innerCon == null) {
return c == null;
} else {
return innerCon.equals(c);
}
}
public boolean getAutoCommit() throws SQLException {
checkOpen();
return delegate.getAutoCommit();
}
public String getCatalog() throws SQLException {
checkOpen();
return delegate.getCatalog();
}
public DatabaseMetaData getMetaData() throws SQLException {
checkOpen();
return delegate.getMetaData();
}
public int getTransactionIsolation() throws SQLException {
checkOpen();
return delegate.getTransactionIsolation();
}
public Map getTypeMap() throws SQLException {
checkOpen();
return delegate.getTypeMap();
}
public SQLWarning getWarnings() throws SQLException {
checkOpen();
return delegate.getWarnings();
}
public int hashCode() {
if (delegate == null){
return 0;
}
return delegate.hashCode();
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
// Use superclass accessor to skip access test
Connection conn = super.getInnermostDelegate();
if (conn == null) {
return false;
}
if (obj instanceof DelegatingConnection) {
DelegatingConnection c = (DelegatingConnection) obj;
return c.innermostDelegateEquals(conn);
}
else {
return conn.equals(obj);
}
}
public boolean isReadOnly() throws SQLException {
checkOpen();
return delegate.isReadOnly();
}
public String nativeSQL(String sql) throws SQLException {
checkOpen();
return delegate.nativeSQL(sql);
}
public CallableStatement prepareCall(String sql) throws SQLException {
checkOpen();
return new DelegatingCallableStatement(this, delegate.prepareCall(sql));
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
checkOpen();
return new DelegatingCallableStatement(this, delegate.prepareCall(sql, resultSetType, resultSetConcurrency));
}
public PreparedStatement prepareStatement(String sql) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this, delegate.prepareStatement(sql));
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this, delegate.prepareStatement(sql, resultSetType, resultSetConcurrency));
}
public void rollback() throws SQLException {
checkOpen();
delegate.rollback();
}
public void setAutoCommit(boolean autoCommit) throws SQLException {
checkOpen();
delegate.setAutoCommit(autoCommit);
}
public void setCatalog(String catalog) throws SQLException {
checkOpen();
delegate.setCatalog(catalog);
}
public void setReadOnly(boolean readOnly) throws SQLException {
checkOpen();
delegate.setReadOnly(readOnly);
}
public void setTransactionIsolation(int level) throws SQLException {
checkOpen();
delegate.setTransactionIsolation(level);
}
public void setTypeMap(Map map) throws SQLException {
checkOpen();
delegate.setTypeMap(map);
}
public String toString() {
if (delegate == null){
return "NULL";
}
return delegate.toString();
}
public int getHoldability() throws SQLException {
checkOpen();
return delegate.getHoldability();
}
public void setHoldability(int holdability) throws SQLException {
checkOpen();
delegate.setHoldability(holdability);
}
public java.sql.Savepoint setSavepoint() throws SQLException {
checkOpen();
return delegate.setSavepoint();
}
public java.sql.Savepoint setSavepoint(String name) throws SQLException {
checkOpen();
return delegate.setSavepoint(name);
}
public void releaseSavepoint(java.sql.Savepoint savepoint) throws SQLException {
checkOpen();
delegate.releaseSavepoint(savepoint);
}
public void rollback(java.sql.Savepoint savepoint) throws SQLException {
checkOpen();
delegate.rollback(savepoint);
}
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
checkOpen();
return new DelegatingStatement(this, delegate.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability));
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
checkOpen();
return new DelegatingCallableStatement(this, delegate.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
}
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this, delegate.prepareStatement(sql, autoGeneratedKeys));
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this,delegate.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability));
}
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this, delegate.prepareStatement(sql, columnIndexes));
}
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
checkOpen();
return new DelegatingPreparedStatement(this, delegate.prepareStatement(sql, columnNames));
}
/**
* @see org.apache.commons.dbcp.DelegatingConnection#getDelegate()
*/
public Connection getDelegate() {
if (isAccessToUnderlyingConnectionAllowed()) {
return super.getDelegate();
} else {
return null;
}
}
/**
* @see org.apache.commons.dbcp.DelegatingConnection#getInnermostDelegate()
*/
public Connection getInnermostDelegate() {
if (isAccessToUnderlyingConnectionAllowed()) {
return super.getInnermostDelegate();
} else {
return null;
}
}
}
}
| [
"124823565@qq.com"
] | 124823565@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.