blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a7c41881265b0f39f47103bbfa1fed9a75c71aa0 | abf79e62053beb7e39979010ef45e900636e81c4 | /src/test/java/Stepdef/Scifinowlive/SCISMO19_transaction_from_new_pub_notice.java | 1584341a83e454448a7b7935c0e86923880b56d8 | [] | no_license | Agateone/Scifi_Smoke_Tests | a7d2f8352fb4b2b1182cf6ab3fd7ce9edde94b17 | 9d7c1ebb1d94df973f2763689a259e5ae98b0934 | refs/heads/master | 2022-07-18T01:02:12.912494 | 2020-03-02T14:59:21 | 2020-03-02T14:59:21 | 237,038,077 | 0 | 0 | null | 2022-06-29T17:55:52 | 2020-01-29T17:08:12 | HTML | UTF-8 | Java | false | false | 7,916 | java | package Stepdef.Scifinowlive;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import Elements.Finish_Notice_elements;
import Elements.New_Pub_Notice;
import Elements.Popbitch_First_Use_Notice_Elements;
import Elements.Register_Page_Elements1;
import Elements.Wallet_Elements;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class SCISMO19_transaction_from_new_pub_notice {
WebDriver driver;
@Given("I am a user of Axate and I am on the registration page through popbitch FUN {string}")
@Test(priority=96)
@Parameters("browser")
public void i_am_a_user_of_Axate_and_I_am_on_the_registration_page_through_popbitch_FUN(String browser) throws InterruptedException {
//firefox
if(browser.equalsIgnoreCase("firefox")) {
System.setProperty("webdriver.gecko.driver","C:/Users/Administrator/Desktop/geckodriver.exe");
driver = new FirefoxDriver();
driver.get("https://popbitch.com/2019/11/royal-blush/");
Popbitch_First_Use_Notice_Elements popbitch_first_use_elements= new Popbitch_First_Use_Notice_Elements(driver);
popbitch_first_use_elements.Click_On_Popbitch_First_Use_Notice_Create_Wallet();
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("email")));
String reg_Page_url= driver.getCurrentUrl();
if(reg_Page_url.contains("sign"))
{
System.out.println("Clicking on create wallet opened registration page");
}
}
//safari
else if (browser.equalsIgnoreCase("safari")) {
driver= new SafariDriver();
driver.manage().window().maximize();
try {
driver.get("https://popbitch.com/2019/11/royal-blush/");
}
catch(Exception e)
{
System.out.println("Couldnt open popbitch staging");
}
Popbitch_First_Use_Notice_Elements popbitch_first_use_elements= new Popbitch_First_Use_Notice_Elements(driver);
popbitch_first_use_elements.Click_On_Popbitch_First_Use_Notice_Create_Wallet();
String reg_Page_url= driver.getCurrentUrl();
if(reg_Page_url.contains("https://account.agate.io/my-agate/sign-up?"))
{
System.out.println("Clicking on create wallet opened registration page");
}
}
//chrome
else if (browser.equalsIgnoreCase("chrome")) {
System.setProperty("webdriver.chrome.driver","/Users/jay/eclipse-workspace/chromedriver");
driver= new ChromeDriver();
driver.get("https://popbitch.com/2019/11/royal-blush/");
Popbitch_First_Use_Notice_Elements popbitch_first_use_elements= new Popbitch_First_Use_Notice_Elements(driver);
popbitch_first_use_elements.Click_On_Popbitch_First_Use_Notice_Create_Wallet();
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("email")));
String reg_Page_url= driver.getCurrentUrl();
if(reg_Page_url.contains("https://account.agate.io/my-agate/sign-up?"))
{
System.out.println("Clicking on create wallet opened registration page");
}
}
//edge
else if (browser.equalsIgnoreCase("Edge")) {
System.setProperty("webdriver.edge.driver","/Users/jay/eclipse-workspace/chromedriver");
driver = new EdgeDriver();
}
}
@When("I register successfully on popbitch with one pound")
@Test(priority=97)
public void i_register_successfully_on_popbitch_with_one_pound() throws InterruptedException {
Register_Page_Elements1 Reg_page_elements = new Register_Page_Elements1(driver);
Reg_page_elements.Registration_Step1();
Reg_page_elements.voucher_process();
Reg_page_elements.click_continue_on_reg_page2();
Wallet_Elements w1 = new Wallet_Elements(driver);
w1.Click_On_popbitch_staging_agate_poster();
String actual_current_balance=w1.current_balance();
String expected_current_balance="10.00";
Assert.assertEquals(actual_current_balance, expected_current_balance);
Finish_Notice_elements finish_notice = new Finish_Notice_elements(driver);
Boolean Actual_result = finish_notice.Verify_finish_notice_appears();
Boolean Expected_result= true;
Assert.assertEquals(Actual_result, Expected_result);
}
@When("click ok on the finish notice")
@Test(priority=98)
public void click_ok_on_the_finish_notice() throws InterruptedException {
Finish_Notice_elements finish = new Finish_Notice_elements(driver);
finish.popbitch_click_ok_on_finish_notice();
Thread.sleep(2000);
}
@When("navigate to a premium article on scifinow")
@Test(priority=99)
public void navigate_to_a_premium_article_on_scifinow() throws InterruptedException {
driver.get("https://www.scifinow.co.uk/interviews/scary-stories-to-tell-in-the-dark-director-andre-ovredal-on-horror-anticipation-and-smuggling-illegal-vhs-tapes/");
driver.switchTo().frame("ciframe_footer_330237_1");
driver.switchTo().defaultContent();
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("window.scrollBy(0,1200)");
}
@When("opt just charge me on the newpublication notice and click ok")
@Test(priority=100)
public void opt_just_charge_me_on_the_newpublication_notice_and_click_ok() throws InterruptedException, IOException {
New_Pub_Notice new_pub = new New_Pub_Notice(driver);
new_pub.newpub_charge_notice_click_continue();
}
//failing on automation
/*
@Then("twentyp is displayed on the green tab")
@Test(priority=101)
public void twentyp_is_displayed_on_the_green_tab() throws InterruptedException {
Wallet_Elements w1 = new Wallet_Elements(driver);
String actual_price= w1.green_tab_price();
String expected_price= "30";
Assert.assertEquals(actual_price, expected_price);
}*/
@Then("wallet balance is detucted by twentyp")
@Test(priority=102)
public void wallet_balance_is_detucted_by_twentyp() throws InterruptedException {
Wallet_Elements w1 = new Wallet_Elements(driver);
w1.Click_On_popbitch_staging_agate_poster();
String actual_current_balance=w1.current_balance();
String expected_current_balance="9.50";
Assert.assertEquals(actual_current_balance, expected_current_balance);
}
@Then("free point is detucted by twentyp")
@Test(priority=103)
public void free_point_is_detucted_by_twentyp() throws InterruptedException {
Wallet_Elements w1 = new Wallet_Elements(driver);
w1.Click_On_popbitch_staging_agate_poster();
String actual_free_point=w1.Free_point_free();
String expected_free_point="Free";
Assert.assertEquals(actual_free_point, expected_free_point);
System.out.println(expected_free_point);
}
@Then("full article is displayed to the user")
@Test(priority=104)
public void full_article_is_displayed_to_the_user() throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 20);
WebElement paragraph = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[5]/div/main/article/div[2]/p[13]")));
Boolean displayed = driver.findElement(By.xpath("/html/body/div[5]/div/main/article/div[2]/p[13]")).isDisplayed();
Boolean Expected_displayed = true;
Assert.assertEquals(displayed, Expected_displayed);
System.out.print("full article displayed");
String Para= paragraph.getText();
Assert.assertTrue(Para.contains("y Stories’ biggest pulls is the "));
System.out.print(Para);
}
}
| [
"jayasree.kamineni1@gmail.com"
] | jayasree.kamineni1@gmail.com |
d4834eac37bb318d68c0af1555b4edd07ac27d73 | 562acf2d9c6e3d74dc698b422647181a27096630 | /learning/learningfulfilmentprocess/testsrc/com/learning/fulfilmentprocess/test/CheckTransactionReviewStatusActionTest.java | c67a78895229a89e0410bd889afe87635f1e3ea6 | [] | no_license | rahulcoder1234/learning | 7ed314a208026c32832eefb0aa4b79c2093d267c | 166750ebddccfa3a2c208fcb04ace57002cede68 | refs/heads/master | 2020-05-17T03:22:26.613839 | 2019-05-03T09:36:47 | 2019-05-03T09:36:47 | 183,474,339 | 0 | 0 | null | 2019-05-03T09:36:49 | 2019-04-25T16:46:32 | null | UTF-8 | Java | false | false | 6,894 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.learning.fulfilmentprocess.test;
import static org.junit.Assert.fail;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.model.order.OrderModel;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.payment.dto.TransactionStatus;
import de.hybris.platform.payment.enums.PaymentTransactionType;
import de.hybris.platform.payment.model.PaymentTransactionEntryModel;
import de.hybris.platform.payment.model.PaymentTransactionModel;
import de.hybris.platform.servicelayer.model.ModelService;
import de.hybris.platform.task.RetryLaterException;
import de.hybris.platform.ticket.model.CsTicketModel;
import de.hybris.platform.ticket.service.TicketBusinessService;
import com.learning.fulfilmentprocess.actions.order.CheckTransactionReviewStatusAction;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.mockito.BDDMockito;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.Assert;
@UnitTest
public class CheckTransactionReviewStatusActionTest
{
private static final Logger LOG = LoggerFactory.getLogger(CheckTransactionReviewStatusActionTest.class);
protected static final String OK = "OK"; //NOPMD
protected static final String NOK = "NOK";
protected static final String WAIT = "WAIT";
private final CheckTransactionReviewStatusAction action = new CheckTransactionReviewStatusAction();
private PaymentTransactionEntryModel authorizationAccepted;
private PaymentTransactionEntryModel authorizationReview;
private PaymentTransactionEntryModel reviewAccepted;
private PaymentTransactionEntryModel reviewRejected;
private OrderProcessModel process = new OrderProcessModel();
private List<PaymentTransactionEntryModel> paymentTransactionEntriesList = new ArrayList<PaymentTransactionEntryModel>();
@Mock
private ModelService modelService;
@Mock
private TicketBusinessService ticketBusinessService;
protected PaymentTransactionEntryModel createPaymentTransactionEntry(final PaymentTransactionType type,
final TransactionStatus status)
{
final PaymentTransactionEntryModel paymentTransactionEntry = new PaymentTransactionEntryModel();
paymentTransactionEntry.setType(type);
paymentTransactionEntry.setTransactionStatus(status.toString());
return paymentTransactionEntry;
}
@Before
public void setUp() throws Exception
{
// Used for MockitoAnnotations annotations
MockitoAnnotations.initMocks(this);
action.setModelService(modelService);
action.setTicketBusinessService(ticketBusinessService);
BDDMockito.given(modelService.create(CsTicketModel.class)).willReturn(new CsTicketModel());
authorizationAccepted = createPaymentTransactionEntry(PaymentTransactionType.AUTHORIZATION, TransactionStatus.ACCEPTED);
authorizationReview = createPaymentTransactionEntry(PaymentTransactionType.AUTHORIZATION, TransactionStatus.REVIEW);
reviewAccepted = createPaymentTransactionEntry(PaymentTransactionType.REVIEW_DECISION, TransactionStatus.ACCEPTED);
reviewRejected = createPaymentTransactionEntry(PaymentTransactionType.REVIEW_DECISION, TransactionStatus.REJECTED);
process = new OrderProcessModel();
final OrderModel order = new OrderModel();
process.setOrder(order);
final List<PaymentTransactionModel> paymentTransactionList = new ArrayList<PaymentTransactionModel>();
order.setPaymentTransactions(paymentTransactionList);
final PaymentTransactionModel paymentTransactionModel = new PaymentTransactionModel();
paymentTransactionList.add(paymentTransactionModel);
paymentTransactionEntriesList = new ArrayList<PaymentTransactionEntryModel>();
paymentTransactionModel.setEntries(paymentTransactionEntriesList);
}
@Test
public void testAcceptedAuthorization()
{
paymentTransactionEntriesList.add(authorizationAccepted);
try
{
final String result = action.execute(process);
Assert.assertEquals(OK, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
@Test
public void testReviewAuthorization()
{
paymentTransactionEntriesList.add(authorizationReview);
try
{
final String result = action.execute(process);
Assert.assertEquals(WAIT, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
@Test
public void testAcceptedReviewAuthorization()
{
paymentTransactionEntriesList.add(authorizationReview);
paymentTransactionEntriesList.add(reviewAccepted);
try
{
final String result = action.execute(process);
Assert.assertEquals(OK, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
@Test
public void testRejectedReviewAuthorization()
{
paymentTransactionEntriesList.add(authorizationReview);
paymentTransactionEntriesList.add(reviewRejected);
try
{
final String result = action.execute(process);
Assert.assertEquals(NOK, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
@Test
public void testMultipleReviewAuthorization()
{
paymentTransactionEntriesList.add(authorizationReview);
paymentTransactionEntriesList.add(reviewRejected);
paymentTransactionEntriesList.add(authorizationReview);
try
{
final String result = action.execute(process);
Assert.assertEquals(WAIT, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
@Test
public void testMultipleReview()
{
paymentTransactionEntriesList.add(authorizationReview);
paymentTransactionEntriesList.add(reviewRejected);
paymentTransactionEntriesList.add(authorizationReview);
paymentTransactionEntriesList.add(reviewAccepted);
try
{
final String result = action.execute(process);
Assert.assertEquals(OK, result);
}
catch (final RetryLaterException e)
{
LOG.error("Exception : ", e);
fail();
}
catch (final Exception e)
{
LOG.error("Exception : ", e);
fail();
}
}
}
| [
"rahulgarg.189@gmail.com"
] | rahulgarg.189@gmail.com |
a3e196e79496bf02f916eb545803cee03eb74ff4 | 952789d549bf98b84ffc02cb895f38c95b85e12c | /V_2.x/Server/tags/SpagoBI-2.5.0(20100412)/SpagoBIJPaloEngine/src/com/tensegrity/palowebviewer/modules/util/client/taskqueue/ITaskQueueListener.java | 4e0664b39038757fc396d61c1ffb84aa93a9b4ac | [] | no_license | emtee40/testingazuan | de6342378258fcd4e7cbb3133bb7eed0ebfebeee | f3bd91014e1b43f2538194a5eb4e92081d2ac3ae | refs/heads/master | 2020-03-26T08:42:50.873491 | 2015-01-09T16:17:08 | 2015-01-09T16:17:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | package com.tensegrity.palowebviewer.modules.util.client.taskqueue;
public interface ITaskQueueListener {
public void onTaskAdded(ITask task);
public void onTaskStart(ITask task);
public void onTaskFinished(ITask task);
}
| [
"gioia@99afaf0d-6903-0410-885a-c66a8bbb5f81"
] | gioia@99afaf0d-6903-0410-885a-c66a8bbb5f81 |
061f855ff8e4edc378a5f1753a65421019116fc6 | a8908c938e58bac4a0a7185fe2a52d95b08d7aa2 | /src/main/java/cz/martlin/douckonline/business/model/base/EntityWithLongID.java | b4775f678f0723becec6275bf1fb2f5ee91da9eb | [] | no_license | martlin2cz/douckonline1 | 519a8e254890953ddec66aea8ca92aae90f1de01 | e52ee679504df03c00101db0fa269a551cf283ce | refs/heads/master | 2020-06-29T23:19:48.789227 | 2016-12-15T06:26:19 | 2016-12-15T06:26:19 | 74,403,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | java | package cz.martlin.douckonline.business.model.base;
import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
/**
* Base entity class with <code>long</code> id field.
*
* @author m@rtlin <martlin@seznam.cz>
*/
@MappedSuperclass
public abstract class EntityWithLongID implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected long id;
public EntityWithLongID() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public boolean isPersisted() {
return this.id != 0;
}
@Override
public int hashCode() {
int hash = 0;
hash += (int) id;
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof EntityWithLongID)) {
return false;
}
EntityWithLongID other = (EntityWithLongID) object;
if (this.id != other.id) {
return false;
}
return true;
}
@Override
public String toString() {
return "EntityWithLongID{ id = " + id + " }";
}
}
| [
"martlin2cz@gmail.com"
] | martlin2cz@gmail.com |
f5198a75a27691ce0ed8239e1abc94165a56eee3 | 724d2b31557779e055b741bab79dc4b487dd4f45 | /DesignPatterns/src/main/java/linkedin/CH06/designpatterns/state/gumballstate/NoQuarterState.java | 2c3d3c4728c06ebe30e9a1315c6d07e8fd968b4a | [] | no_license | ikonovi/DesignPatterns | 0271be1a0a8dfc996b0476c7f3d99e62ebd87154 | 537ca741d5d4577fd9a3e0eb27884cd6718c3ef2 | refs/heads/master | 2020-12-02T17:54:24.534435 | 2018-08-13T15:22:43 | 2018-08-13T15:22:43 | 96,445,276 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package linkedin.CH06.designpatterns.state.gumballstate;
public class NoQuarterState implements State {
GumballMachine gumballMachine;
public NoQuarterState(GumballMachine gumballMachine) {
this.gumballMachine = gumballMachine;
}
public void insertQuarter() {
System.out.println("You inserted a quarter");
gumballMachine.setState(gumballMachine.getHasQuarterState());
}
public void ejectQuarter() {
System.out.println("You haven't inserted a quarter");
}
public void turnCrank() {
System.out.println("You turned, but there's no quarter");
}
public void dispense() {
System.out.println("You need to pay first");
}
public String toString() {
return "waiting for quarter";
}
}
| [
"ikonovi@gmail.com"
] | ikonovi@gmail.com |
26aa98bfd24f43d2e74a573a1308cef48638301b | e3942519231bbf9615abbd45ef8874e51eef4647 | /src/com/ty/Test.java | 81540eea6a449dcd4f90e599fc2a02262bfedf12 | [] | no_license | bhavanagajendra/Java | 7c5cd684de84f871f2bb088557cd62d8ca5fe81f | 390b14e119100fd700ac379e93c883fffe8599b9 | refs/heads/master | 2020-03-27T21:53:08.523186 | 2018-09-03T09:41:05 | 2018-09-03T09:41:05 | 147,183,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package com.ty;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("My First Project");
}
}
| [
"jhasimmi55@gmail.com"
] | jhasimmi55@gmail.com |
7bec0e4c50d377ee6734a9d313600f39ffd552a5 | 4f34b8d6b9af72e879d4e18e0d40ca3fd5188c82 | /app/src/androidTest/java/com/example/miconductor/ExampleInstrumentedTest.java | 3a6cc76c27082745ac686d8b629d736ef4d60987 | [] | no_license | anggonzales/U2Tema2MiconductorEjercicio1 | ea32dcae47edf8fcf30a982241e9b51608bf3722 | e5105e0c2c363294ee93cec3d7ae1e4a0c26b10a | refs/heads/master | 2021-01-02T08:03:42.529424 | 2020-02-10T16:38:39 | 2020-02-10T16:38:39 | 239,560,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.example.miconductor;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.miconductor", appContext.getPackageName());
}
}
| [
"anggonzalesca@upt.pe"
] | anggonzalesca@upt.pe |
15f08db8044df4728061ed728448acdcab4de899 | f6c34e7f311cbb502d198b924a3c75c400aafbd7 | /jservlet2-examples/ch16/SimpleResultSetTable.java | 2b068ddda3e27811fcf6f1a60e0c2ea1eb856a83 | [
"LicenseRef-scancode-oreilly-notice"
] | permissive | golddusty/javaservletprogramming | 856d49670c4b8f47efb823ab6f4683066035f4dc | 2fcd33b8ebe6dc36564a23aa3e27163d4e7cdf66 | refs/heads/master | 2020-06-04T06:02:17.054928 | 2017-06-27T15:04:34 | 2017-06-27T15:04:34 | 191,897,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | import java.io.*;
import java.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.ecs.*;
import org.apache.ecs.html.*;
public class SimpleResultSetTable extends Table {
public SimpleResultSetTable(ResultSet rs) throws SQLException {
setBorder(1);
ResultSetMetaData rsmd = rs.getMetaData();
int colCount = rsmd.getColumnCount();
TR row = new TR();
for (int i = 1; i <= colCount; i++) {
addElement(new TH().addElement(rsmd.getColumnName(i)));
}
addElement(row);
while (rs.next()) {
row = new TR();
for (int i = 1; i <= colCount; i++) {
addElement(new TD().addElement(rs.getString(i)));
}
addElement(row);
}
}
}
| [
"booktech@oreilly.com"
] | booktech@oreilly.com |
96c526d2622647478011fafaba0d29c8072a2302 | 69eb1f0b99d5ec82c1088aea05d12de12b8c621c | /estudos_caseiros/estudo05.java | f0fd1a807501d12604f625adba16c786cbe83680 | [] | no_license | juliumnix/estudos-java | 3b6e524f43b25d2dcbe3d96611b272351f7df8aa | d153982a66d5c32dd6d8ceab31e482dd904c8749 | refs/heads/master | 2023-02-21T10:27:55.954852 | 2021-01-06T14:10:14 | 2021-01-06T14:10:14 | 327,332,191 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package estudos_caseiros;
public class estudo05 {
public static void main(String[] args) {
int x = 0;
int y = 100;
for(int i = x; i < y; i++){
if(i % 19 == 0){
System.out.println("Achei um número divísível por 19 entre x e y\no número é " + i);
break;
}
}
}
}
| [
"juliumnix@gmail.com"
] | juliumnix@gmail.com |
ad3712f7a25dc510d55bf3552a03d8fde875b7a9 | b5bac1445d11309b8503d5f9b1719d8fd43de39c | /src/client/RequestWorkerRunnable.java | 8dec21f57ab2018199f5d442ea2e090e086ee4ab | [] | no_license | jiu9x9uij/CSEEW4119_Project1 | f0192cc21a95efb426895a14d63c2e631e78452a | b70943a540d5aff246b3bce7acb4143a87e13748 | refs/heads/master | 2020-04-15T15:55:16.017589 | 2015-03-19T00:35:54 | 2015-03-19T00:35:54 | 31,573,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,461 | java | package client;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Client-side worker thread
*/
public class RequestWorkerRunnable implements Runnable{
protected Socket connectionSocket = null;
protected String serverText = null;
public RequestWorkerRunnable(Socket connectionSocket, String serverText) {
this.connectionSocket = connectionSocket;
this.serverText = serverText;
}
public void run() {
try {
/* Read client request */
// System.out.println("### Client Request Received " + System.currentTimeMillis() + " ###"); // DEBUG Request received stamp
BufferedReader inFromClient = new BufferedReader (new InputStreamReader(connectionSocket.getInputStream()));
String clientMsg = inFromClient.readLine();
/* Execute request */
// Parse request
JSONObject requestJson = new JSONObject(clientMsg);
String request = requestJson.getString("request");
JSONObject body = requestJson.getJSONObject("body");
// System.out.println("request = " + request); // DEBUG Request type
// Execute corresponding method
JSONObject serverResponse;
if (request.equals("message")) serverResponse = displayMessage(body);
else if (request.equals("notify")) serverResponse = displayNotification(body);
// TODO handle P2P connection request
else serverResponse = responseOK();
/* Respond to client */
// System.out.println("---response---\n" + serverResponse + "\n------end-----"); // DEBUG Response content
DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream());
outToClient.writeBytes(serverResponse.toString() + '\n');
/* Close connection */
// System.out.println("closing connection"); // DEBUG Responded
inFromClient.close();
outToClient.close();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
// System.out.println("######### Done #########"); // DEBUG Request processed
}
/* Display received message */
private JSONObject displayMessage(JSONObject body) {
JSONObject response = new JSONObject();
String sender = body.getString("sender");
String content = body.getString("content");
ClientLauncher.println(sender + ": " + content);
response.put("result", "success");
response.put("response", "Message received.");
return response;
}
/* Display notification */
private JSONObject displayNotification(JSONObject body) {
JSONObject response = new JSONObject();
String content = body.getString("content");
ClientLauncher.println(content);
if (content.contains("logged out")) ClientLauncher.terminateClient();
response.put("result", "success");
response.put("response", "Notification received.");
return response;
}
/* TEST Give a HTTP 200 OK response to client */
private JSONObject responseOK() {
JSONObject response = new JSONObject();
response.put("result", "success");
long time = System.currentTimeMillis();
response.put("response", "HTTP/1.1 200 OK\n\nWorkerRunnable: " + this.serverText + " - " + time);
return response;
}
}
| [
"jiu9x9uij@gmail.com"
] | jiu9x9uij@gmail.com |
d4109d0ae18ffcb02fdeb0abe6c8141e14b656cf | bcb0f94c73bcd6c82674a3ef4e37f8f8074af60f | /app/src/main/java/com/example/doc_mech/ex1.java | 6fc4b875bac617d2375d71ff54e4b5610ee9b04a | [] | no_license | naga-rgb/DOC_MECH | 9b53acbf4d1df72a2414a36525661fb278a61d0f | 1f3e410d48ea0489c173d59f7621d05f77cece3e | refs/heads/master | 2022-11-06T22:49:24.774423 | 2020-06-19T06:11:17 | 2020-06-19T06:11:17 | 273,530,688 | 0 | 0 | null | 2020-06-19T15:45:37 | 2020-06-19T15:45:37 | null | UTF-8 | Java | false | false | 978 | java | package com.example.doc_mech;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.google.firebase.auth.FirebaseAuth;
public class ex1 extends AppCompatActivity {
private Button next;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ex1);
if (FirebaseAuth.getInstance().getCurrentUser()!=null)
{
startActivity(new Intent(getApplicationContext(),Home.class));
finish();
}
next = (Button) findViewById(R.id.next);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),login_signup.class));
finish();
}
});
}
}
| [
"gowthamvj15@users.noreply.github.com"
] | gowthamvj15@users.noreply.github.com |
47019cf69061f4744d0f165069f03bee2f3905d6 | 11821de97ded22375318cdcd8e271e16a4590b69 | /StopApp/src/com/android/stop/UserFunctions.java | ce573c3d5af072a35a9cb7c2163eeedf896723ed | [] | no_license | Raphaeljunior/Stop-app | 0f129ac4b971400bc2c67e0b081a589d50729cc1 | 4b788fdd2fa70bb3094e16178d65c387df0e53b2 | refs/heads/master | 2016-09-05T18:34:40.554094 | 2014-12-13T19:05:03 | 2014-12-13T19:05:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | package com.android.stop;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
public class UserFunctions {
private JSONParser jsonParser;
private static String universalURL = "http://stopapp.davinaqualispess.com/index.php";
private static String create_accident = "create_accidents";
private static String get_stats = "get_stats";
// constructor
public UserFunctions(){
jsonParser = new JSONParser();
}
//Get Accident Statistics
public JSONObject getStats(){
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("tag", get_stats));
JSONObject json = jsonParser.getJSONFromUrl(universalURL, params);
if(json != null){
return json;
}
else {
return null;
}
}
//Report an accident
public JSONObject createAccident(String locName, String category, String no_injured, String no_dead,String image_resource){
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("tag", create_accident));
params.add(new BasicNameValuePair("locName", locName));
params.add(new BasicNameValuePair("category", category));
params.add(new BasicNameValuePair("no_injured", no_injured));
params.add(new BasicNameValuePair("no_dead", no_dead));
params.add(new BasicNameValuePair("image", image_resource));
JSONObject json = jsonParser.getJSONFromUrl(universalURL, params);
if(json != null){
return json;
}
else {
return null;
}
}
} | [
"raphnano@gmail.com"
] | raphnano@gmail.com |
b740f3d1dba8917f1c8684e72bf5d570ee453ee2 | cc2f75d66f62fbdc4a312146564605943d1863b7 | /spring-boot-backend/src/main/java/com/etiya/hms/model/party/PartyRoleType.java | 044d789664457dc24cf5137377f4853305124c81 | [] | no_license | ervakabil/smartHms | 17ce56910dbb6c93d9bd641bbfc3b99ffaabf150 | 1635c917be05b4eecd20eddf0246edfe93b2c1b5 | refs/heads/master | 2020-03-27T22:03:52.821047 | 2018-09-07T11:36:11 | 2018-09-07T11:36:11 | 147,201,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | package com.etiya.hms.model.party;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
/**
* Created with IntelliJ IDEA.
* User: marco
* Date: 04/01/15
* Time: 21:23
*/
@Document(collection = "par_partyroletype")
@TypeAlias("party.PartyRoleType")
@Data
@RequiredArgsConstructor
public class PartyRoleType {
@Id
private ObjectId id;
/**
* The code of the PartyRoleType
*/
// @Indexed(unique=true)
@NonNull private String code;
/**
* The status (canceled/not canceled) of the PartyRoleType;
*/
private boolean canceled;
/**
* The status (freezed/not freezed) of the PartyRoleType;
*/
private boolean frozen;
/**
* The multi-language name of the PartyRoleType
*/
@NonNull private String name;
/**
* The multi-language description of the PartyRoleType
*/
private String description;
} | [
"burakiztanbul@gmail.com"
] | burakiztanbul@gmail.com |
9a509a16d24f33ef8c3138b91895a942d939b510 | 13fe80e1b6c8bf9c3e45c9c17a7c59a99c0fee92 | /src/main/java/com/exceedo/vrpapi/repository/ApiUserRepository.java | 686d4fa93ae01e8a5547611d41b4e8699b24808e | [] | no_license | exceedo-systems/vrp-api | fe5ea9601414410778317efd1d7f5c9d61aa6c52 | 53f52c17836377ab4781332eefe06944310a3923 | refs/heads/master | 2021-07-16T15:25:39.056702 | 2017-10-21T03:56:29 | 2017-10-21T03:56:29 | 105,394,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.exceedo.vrpapi.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.exceedo.vrpapi.domain.ApiUser;
public interface ApiUserRepository extends MongoRepository<ApiUser, String> {
}
| [
"systems@exceedo.com"
] | systems@exceedo.com |
0bb48c9d1fc3effa18a9421ab6d059790fb2860e | 47cf00d2111725623789cc7f33f28f0895b5e138 | /Core Java/studentapp/src/com/ustglobalstudentapp/jspidrers/Remote.java | a093ea5f786017dcde327cf42bcb1379a1f7ab7b | [] | no_license | deeksha-kamrani/USTGlobal-16Sep19-Deeksha-Kamrani | 14d7eadfbbeca182784c9911bb6487455b5aae31 | fe1ec257ab64106944046196e4519cf84e972b07 | refs/heads/master | 2023-01-10T21:19:28.160875 | 2019-12-22T03:26:25 | 2019-12-22T03:26:25 | 215,538,417 | 0 | 0 | null | 2023-01-07T13:01:31 | 2019-10-16T12:05:49 | CSS | UTF-8 | Java | false | false | 261 | java | package com.ustglobalstudentapp.jspidrers;
public class Remote
{
public static int num;
public int sum;
public static void on()
{
System.out.println("I am on() method");
}
public static void off()
{
System.out.println("I am off() method");
}
}
| [
"54739165+deeksha-kamrani@users.noreply.github.com"
] | 54739165+deeksha-kamrani@users.noreply.github.com |
921254fadf02b523539a210ba5a3285e61cf394b | 10568ede568a80b6f927d8d387a2c5c35135cfc7 | /src/main/java/DoublyLinkedList.java | e30e0572fc376506e6656df5cee981203934eef3 | [] | no_license | akshayamangaraj/codepal | 899d47ef36d63eab4df9bf9f4fdf5534409bcad2 | d65143c78751f48289edd00282de276ebbe37a5b | refs/heads/master | 2021-01-20T04:09:11.993766 | 2017-06-05T16:39:32 | 2017-06-05T16:39:32 | 89,647,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | /**
*
*/
/**
* @author sparid2
*
*/
public class DoublyLinkedList {
private DoubleyLinkedNode head;
public void insertatHead(int data){
DoubleyLinkedNode newNode = new DoubleyLinkedNode(data);
newNode.setNextNode(this.head);
if(this.head !=null){
this.head.setNextNode(newNode);
}
this.head = newNode;
}
public int length(){
DoubleyLinkedNode current = this.head;
int length = 0;
if(this.head == null){
return 0;
}
while(current!=null){
length++;
current = current.getNextNode();
}
return length;
}
}
| [
"amangara@stubhub.com"
] | amangara@stubhub.com |
361a1b573d36f534b8af65d3b8911ec0df87b372 | 215ef66ccec376f22a6569cfa56928af5c7613c3 | /app/src/main/java/com/xcyo/live/activity/user_edit/EditActivity.java | 6b55137dd01db12ca1d32058a9fb485131f10061 | [] | no_license | hanwj/android_live | 00a22df62d0dc26565070bea46551631932bf123 | 53a3ef47218bdb6b5ea25a9791867cd1d82c75c5 | refs/heads/master | 2021-01-08T12:57:53.531234 | 2016-08-05T09:44:23 | 2016-08-05T09:44:23 | 63,296,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,819 | java | package com.xcyo.live.activity.user_edit;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bigkoo.pickerview.OptionsPickerView;
import com.bigkoo.pickerview.TimePickerView;
import com.jazz.direct.libs.ConsUtils;
import com.xcyo.baselib.server.ServerBinderData;
import com.xcyo.baselib.ui.BaseActivity;
import com.xcyo.live.R;
import com.xcyo.live.model.UserModel;
import com.xcyo.live.record.UserRecord;
import com.xutils.x;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* Created by TDJ on 2016/6/3.
*/
public class EditActivity extends BaseActivity<EditPresenter>{
@Override
protected void initArgs() {
}
@Override
protected void initViews() {
setContentView(R.layout.activity_user_edit);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
actionbar_back = (TextView) findViewById(R.id.base_title_back);
actionbar_title = (TextView) findViewById(R.id.base_title_name);
actionbar_finish = (TextView) findViewById(R.id.base_title_right);
actionbar_title.setText("编辑资料");
icon_layer = (RelativeLayout) findViewById(R.id.usr_edit_icon_layer);
name_layer = (RelativeLayout) findViewById(R.id.usr_edit_name_layer);
number_layer = (RelativeLayout) findViewById(R.id.usr_edit_number_layer);
sex_layer = (RelativeLayout) findViewById(R.id.usr_edit_sex_layer);
signature_layer = (RelativeLayout) findViewById(R.id.usr_edit_signature_layer);
identity_layer = (RelativeLayout) findViewById(R.id.usr_edit_identity_layer);
identification_layer = (RelativeLayout) findViewById(R.id.usr_edit_identification_layer);
age_layer = (RelativeLayout) findViewById(R.id.usr_edit_age_layer);
emotion_layer = (RelativeLayout) findViewById(R.id.usr_edit_emotion_layer);
hometown_layer = (RelativeLayout) findViewById(R.id.usr_edit_hometown_layer);
profession_layer = (RelativeLayout) findViewById(R.id.usr_edit_profession_layer);
icon = (ImageView) findViewById(R.id.usr_edit_icon);
name = (TextView) findViewById(R.id.usr_edit_name);
number = (TextView) findViewById(R.id.usr_edit_number);
sex = (TextView) findViewById(R.id.usr_edit_sex);
signature = (TextView) findViewById(R.id.usr_edit_signature);
identity = (TextView) findViewById(R.id.usr_edit_identity);
identification = (TextView) findViewById(R.id.usr_edit_identification);
age = (TextView) findViewById(R.id.usr_edit_age);
emotion = (TextView) findViewById(R.id.usr_edit_emotion);
hometown = (TextView) findViewById(R.id.usr_edit_hometown);
profession = (TextView) findViewById(R.id.usr_edit_profession);
UserRecord mR = UserModel.getInstance().getRecord();
if(mR != null){
UserRecord.User record = mR.getUser();
UserRecord.UserInfo info = mR.getUserInfo();
setUserName(switchNull(record.alias));
setUsrIcon(switchNull(record.avatar));
number.setText(switchNull(record.uid));
sex.setText(switchNull(record.sex));
signature.setText(switchNull(record.signature));
age.setText(switchNull(info.birthday));
hometown.setText(switchNull(info.city));
}
}
private TextView actionbar_back, actionbar_title, actionbar_finish;
private RelativeLayout icon_layer;
private RelativeLayout name_layer;
private RelativeLayout number_layer;
private RelativeLayout sex_layer;
private RelativeLayout signature_layer;
private RelativeLayout identity_layer;
private RelativeLayout identification_layer;
private RelativeLayout age_layer;
private RelativeLayout emotion_layer;
private RelativeLayout hometown_layer;
private RelativeLayout profession_layer;
private ImageView icon;
private TextView name;
private TextView number;
private TextView sex;
private TextView signature;
private TextView identity;
private TextView identification;
private TextView age;
private TextView emotion;
private TextView hometown;
private TextView profession;
private String switchNull(String attr){
if(attr == null || attr.equalsIgnoreCase("null")){
return "";
}
return attr;
}
@Override
protected void initEvents() {
addOnClickListener(actionbar_back, "finish");
addOnClickListener(icon_layer, "icon_layer");
addOnClickListener(name_layer, "name_layer");
addOnClickListener(number_layer, "number_layer");
addOnClickListener(sex_layer, "sex_layer");
addOnClickListener(signature_layer, "signature_layer");
addOnClickListener(identity_layer, "identity_layer");
addOnClickListener(identification_layer, "identification_layer");
addOnClickListener(age_layer, "age_layer");
addOnClickListener(emotion_layer, "emotion_layer");
addOnClickListener(hometown_layer, "hometown_layer");
addOnClickListener(profession_layer, "profession_layer");
}
@Override
public void onServerCallback(String evt, ServerBinderData data) {
}
protected void showHomeTown(final EditRecord.CN cn){
runOnUiThread(new Runnable() {
@Override
public void run() {
OptionsPickerView<String> options = new OptionsPickerView<>(EditActivity.this);
List<EditRecord.ProVince> pv = cn.getCn();
if (pv == null) {
return;
}
ArrayList<String> province = new ArrayList<String>();
ArrayList<ArrayList<String>> cities = new ArrayList<ArrayList<String>>();
for (EditRecord.ProVince p : pv) {
province.add(p.getName());
cities.add((ArrayList<String>) p.getSubString());
}
options.setPicker(province, cities, true);
options.setSelectOptions(0, 0);
options.setCancelable(true);
options.setCyclic(false);
options.setOnoptionsSelectListener(getOptionsListener(cn));
options.show();
}
});
}
private void setHometown(final CharSequence c){
hometown.setText(c);
}
private OptionsPickerView.OnOptionsSelectListener getOptionsListener(final EditRecord.CN cn) {
return new OptionsPickerView.OnOptionsSelectListener() {
@Override
public void onOptionsSelect(int options1, int option2, int options3) {
final EditRecord.ProVince proVince = cn.getCn().get(options1);
if(proVince != null){
final String pro = proVince.getName();
final String ct = proVince.getSub().get(option2).toString();
setHometown(pro+","+ct);
}
}
};
}
protected void showBirthSelector(){
runOnUiThread(new Runnable() {
@Override
public void run() {
TimePickerView picker = new TimePickerView(EditActivity.this, TimePickerView.Type.YEAR_MONTH_DAY);
// try {
// java.lang.reflect.Field field = picker.getClass().getSuperclass().getDeclaredField("rootView");
// if(field != null){
// field.setAccessible(true);
// View v = (View)field.get(picker);
// if(v != null){
// v.setFitsSystemWindows(true);
// v.setBackgroundColor(Color.RED);
// ((ViewGroup)v).getChildAt(0).setVisibility(View.GONE);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
Calendar cal = Calendar.getInstance();
picker.setRange(cal.get(Calendar.YEAR) - 40, cal.get(Calendar.YEAR) - 5);
picker.setTime(new Date(1990, 01, 01));
picker.setCancelable(true);
picker.setCyclic(true);
picker.setOnTimeSelectListener(getOnTimeSelector());
picker.show();
}
});
}
private void setAge(final int year){
age.setText(year + " 岁");
}
private TimePickerView.OnTimeSelectListener getOnTimeSelector(){
return new TimePickerView.OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date) {
if(date != null){
int year = new Date().getYear() - date.getYear();
setAge(year);
}
}
};
}
private View.OnClickListener emotionClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
synchronized (emotionClick){
int res = v.getId();
switch (res){
case R.id.emotion_scr:
setEmotion("保密");
break;
case R.id.emotion_single:
setEmotion("单身");
break;
case R.id.emotion_love:
setEmotion("恋爱中");
break;
case R.id.emotion_marry:
setEmotion("结婚");
break;
case R.id.emotion_gay:
setEmotion("同性");
break;
}
}
dialog.dismiss();
}
};
private void setEmotion(final CharSequence c){
emotion.setText(c);
}
private Dialog dialog ;
protected void showEmotionState(){
View convertView = getLayoutInflater().inflate(R.layout.dialog_edit_emotion, null);
TextView src = (TextView)convertView.findViewById(R.id.emotion_scr);
TextView single = (TextView)convertView.findViewById(R.id.emotion_single);
TextView love = (TextView)convertView.findViewById(R.id.emotion_love);
TextView marry = (TextView)convertView.findViewById(R.id.emotion_marry);
TextView gay = (TextView)convertView.findViewById(R.id.emotion_gay);
src.setSelected(true);
src.setOnClickListener(emotionClick);
single.setOnClickListener(emotionClick);
love.setOnClickListener(emotionClick);
marry.setOnClickListener(emotionClick);
gay.setOnClickListener(emotionClick);
if(dialog != null && dialog.isShowing())
dialog.dismiss();
dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(convertView);
WindowManager.LayoutParams ws = dialog.getWindow().getAttributes();
ws.width = WindowManager.LayoutParams.MATCH_PARENT;
ws.height = WindowManager.LayoutParams.WRAP_CONTENT;
ws.alpha = 1.0f;
ws.dimAmount = 0.5f;
ws.gravity = Gravity.BOTTOM;
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.setCancelable(false);
dialog.show();
}
protected void setUserName(@NonNull String name){
this.name.setText(name);
}
protected void setUsrIcon(@NonNull String path){
if(path != null){
x.image().bind(icon, "http://file.xcyo.com/"+path);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == 123){
switch (resultCode){
case EditPresenter.R_NAME_CODE:
presenter().upLoadUsrName(data.getStringExtra("r_content"));
break;
case EditPresenter.R_ICON_CODE:
setUsrIcon(data.getStringExtra("r_icon"));
if(UserModel.getInstance().getRecord() != null){
UserModel.getInstance().getRecord().getUser().avatar = data.getStringExtra("r_icon");
}
break;
}
}
}
}
| [
"hanwj"
] | hanwj |
a2141029097670baad6e737f65e0b690ab43d242 | cae7aba0df1a8bb21b2c490e3e33adb93aeec685 | /workflows/src/test/java/net/corda/samples/duediligence/FlowTests.java | e771be55215e0fb35fbd8be6ed95dab00c1130fb | [
"Apache-2.0"
] | permissive | peterli-r3/due-diligence-cordapp | c96504873f7887f663ca2afa6094dbd4d36b0b3b | d719af5438db17afd08b911dd9e011853f9d2f01 | refs/heads/main | 2023-02-22T01:28:09.934061 | 2021-01-28T13:46:21 | 2021-01-28T13:46:21 | 332,873,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,304 | java | package net.corda.samples.duediligence;
import com.google.common.collect.ImmutableList;
import net.corda.core.contracts.UniqueIdentifier;
import net.corda.samples.duediligence.flows.ComsumeTheCopy;
import net.corda.samples.duediligence.flows.RequestToValidateCorporateRecords;
import net.corda.samples.duediligence.flows.Responder;
import net.corda.testing.node.MockNetwork;
import net.corda.testing.node.MockNetworkParameters;
import net.corda.testing.node.StartedMockNode;
import net.corda.testing.node.TestCordapp;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
public class FlowTests {
private MockNetwork network;
private StartedMockNode a;
private StartedMockNode b;
@Before
public void setup() {
network = new MockNetwork(new MockNetworkParameters().withCordappsForAllNodes(ImmutableList.of(
TestCordapp.findCordapp("net.corda.samples.duediligence.contracts"),
TestCordapp.findCordapp("net.corda.samples.duediligence.flows"))));
a = network.createPartyNode(null);
b = network.createPartyNode(null);
network.runNetwork();
}
@After
public void tearDown() {
network.stopNodes();
}
@Test
public void dummyTest() throws ExecutionException, InterruptedException {
RequestToValidateCorporateRecords.RequestToValidateCorporateRecordsInitiator flow1 =
new RequestToValidateCorporateRecords.RequestToValidateCorporateRecordsInitiator(b.getInfo().getLegalIdentities().get(0),10);
Future<String> future = a.startFlow(flow1);
network.runNetwork();
String result1 = future.get();
System.out.println(result1);
int subString = result1.indexOf("Case Id: ");
String ApproalID = result1.substring(subString+9);
System.out.println("-"+ ApproalID+"-");
UniqueIdentifier id = UniqueIdentifier.Companion.fromString(ApproalID);
ComsumeTheCopy.ComsumeTheCopyInitiator flow2 = new ComsumeTheCopy.ComsumeTheCopyInitiator(id);
Future<String> future2 = a.startFlow(flow2);
network.runNetwork();
String result2 = future2.get();
System.out.println(result2);
}
}
| [
"51169685+peterli-r3@users.noreply.github.com"
] | 51169685+peterli-r3@users.noreply.github.com |
b72e58dc204411cba4a2e1e2c68e6abe7fb4367f | 799cce351010ca320625a651fb2e5334611d2ebf | /Data Set/Synthetic/After/after_2460.java | adc05b9269e9844681f0cc849b4dc5c244ca7dfb | [] | no_license | dareenkf/SQLIFIX | 239be5e32983e5607787297d334e5a036620e8af | 6e683aa68b5ec2cfe2a496aef7b467933c6de53e | refs/heads/main | 2023-01-29T06:44:46.737157 | 2020-11-09T18:14:24 | 2020-11-09T18:14:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | public class Dummy {
void sendRequest(Connection conn) throws SQLException {
String sql = "Select T.tripId,T.customerId,T.driverId,P.totalFare From tripHistory T join payment P ON T.tripId>P.tripId where P.totalFare>=? AND (T.date<=?) order by P.totalFare DESC";
PreparedStatement stmt = conn.prepareStatement(sql);
stmt.setObject(1 , Fare);
stmt.setObject(2 , CurrentDate);
stmt.executeQuery();
}
} | [
"jahin99@gmail.com"
] | jahin99@gmail.com |
09cbba98334d53282d693c0fd52e60acc7b5f94d | c2f60866b6ddb8cacaaf18585bf2c4379884bfce | /ProjetoAgendaContato20201/src/gui/TelaPrincipal.java | bb6a3c2b0ed8eaf00ab8b4bc35aa1948b01ef647 | [
"MIT"
] | permissive | Calebaum/Ads02 | 3c9f9bad0b5ac2da27909f84604d32093266f9be | 1ccc7cf63c14538f5a644cd874129893b125213f | refs/heads/master | 2021-01-14T18:55:30.277303 | 2020-05-20T23:58:01 | 2020-05-20T23:58:01 | 242,720,447 | 0 | 0 | MIT | 2020-02-25T18:36:03 | 2020-02-24T11:37:32 | null | UTF-8 | Java | false | false | 6,987 | 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 gui;
import javax.swing.JOptionPane;
import classesdedados.*;
import persistencias.ContatoPersistencia;
/**
*
* @author Calebe Cabral
*/
public class TelaPrincipal extends javax.swing.JFrame {
/**
* Creates new form TelaPrincipal
*/
public TelaPrincipal() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButtonIncluir = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("AGENDA DE CONTATOS");
jButtonIncluir.setFont(new java.awt.Font("Lucida Grande", 0, 18)); // NOI18N
jButtonIncluir.setText("Incluir");
jButtonIncluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButtonIncluirActionPerformed(evt);
}
});
jLabel1.setText("Nome Completo:");
jLabel2.setText("Telefone:");
jLabel3.setText("Email:");
jLabel4.setText("Endereço:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jButtonIncluir, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 282, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 159, Short.MAX_VALUE)
.addComponent(jButtonIncluir, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButtonIncluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonIncluirActionPerformed
// TODO add your handling code here:
try {
Contato objPadrao1;
objPadrao1 = new Contato();
objPadrao1.setNomeCompleto("Jose das Cove");
objPadrao1.setTelefone("123456");
objPadrao1.setEmail("dascove@orta.com.br");
objPadrao1.setEnderecoResidencial(new Endereco("Rua das cove",51));
Contato objPadrao2;
objPadrao2 = new Contato("Maria das Cove","54321",
"mariadascove@orta.com.br","Rua das cove",51);
Contato objPadrao3;
objPadrao3 = new Contato("Antonio das Cove","54321",
"antoniodascove@orta.com.br",new Endereco("Rua das cove",51));
ContatoPersistencia agenda = null;
agenda = new ContatoPersistencia("contato.dat");
agenda.incluir(objPadrao1);
Contato objPadrao4 = new Contato(objPadrao3);
objPadrao3.setNomeCompleto("Godofredo do Pepino");
JOptionPane.showMessageDialog(rootPane, objPadrao4.toString());
} catch (Exception erro) {
JOptionPane.showMessageDialog(rootPane, erro);
}
}//GEN-LAST:event_jButtonIncluirActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TelaPrincipal().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonIncluir;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration//GEN-END:variables
}
| [
"calebaum@gmail.com"
] | calebaum@gmail.com |
3eb3d100fe3fd5e6be56d68e30365c0180030141 | 791dbce8a03d0580069e71facd3715ea36e74a58 | /MidnightArtifact/okhttputils/src/main/java/com/tbl/okhttputils/builder/HasParamsable.java | 28f098a4c5e97142611c3316f8c6fe9da0af659f | [] | no_license | almeidalhs/wuye_android | aa94c50172859d8ef5a0f18dbfabdadb396eb972 | b4216a0a75d4649878302caee0d01aa8fbbc97e9 | refs/heads/master | 2020-12-25T14:14:11.522921 | 2016-10-10T03:35:51 | 2016-10-10T03:35:51 | 66,350,429 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.tbl.okhttputils.builder;
import java.util.Map;
public interface HasParamsable {
OkHttpRequestBuilder params(Map<String, String> params);
OkHttpRequestBuilder addParams(String key, String val);
}
| [
"1534379470@qq.com"
] | 1534379470@qq.com |
aab9377ff4d724a612308f7baf1bb5bc31e752f5 | d0bee7e8c09441dd1e4b3706e14b65143858a16b | /zoo/test/commandLine/commandImpl/BiomePadTest.java | da91b9b0bdbce0366c6832591523b3c1433fd601 | [] | no_license | LineVA/zoo | 1f7a18dc34b4c83369d58a6c802adee06eb02f1f | 9fc5c90f4a9df196490b398caa1e18ec9b420886 | refs/heads/master | 2020-04-06T20:14:05.375710 | 2017-02-24T21:23:14 | 2017-02-24T21:23:14 | 55,900,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,127 | java | package commandLine.commandImpl;
import org.junit.After;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
/**
*
* @author doyenm
*/
public class BiomePadTest {
String[] cmd;
Boolean actual;
BiomePad cmdImpl;
@Before
public void setUpClass() {
cmdImpl = new BiomePad(null);
}
@After
public void tearDownClass() {
}
@Rule
public ExpectedException thrown = ExpectedException.none();
/**
* canExecute tests
*/
@Test
public void shouldReturnTrueWhenTheCommandIsCorrectWithPad() {
// Given
cmd = "pad z biome 1".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertTrue(actual);
}
@Test
public void shouldReturnTrueWhenTheCommandIsCorrectWithPaddock() {
// Given
cmd = "paddock z biome 1".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertTrue(actual);
}
@Test
public void shouldReturnFalseWhenTheCommandIsTooLong() {
// Given
cmd = "pad z biome 1 long".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertFalse(actual);
}
@Test
public void shouldReturnFalseWhenTheCommandIsNotEnoughLong() {
// Given
cmd = "pad z biome".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertFalse(actual);
}
@Test
public void shouldReturnFalseWhenTheFirstElementIsNotPadOrPaddock() {
// Given
cmd = "pad2 z biome 1".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertFalse(actual);
}
@Test
public void shouldReturnFalseWhenTheThirdElementIsNotBiome() {
// Given
cmd = "pad z biome2 1".split(" ");
// When
actual = cmdImpl.canExecute(cmd);
// Then
assertFalse(actual);
}
}
| [
"marine.doyen-le-boulaire@ensimag.grenoble-inp.fr"
] | marine.doyen-le-boulaire@ensimag.grenoble-inp.fr |
a0f9ed61fd50c92803768e7f8952b84b4aac357b | ce2bb67293e965244018ff420a45117a646d7c7d | /array/array_rotation/src/QuickLeftRotation.java | 844b6bb7aa9e5edb7b0a764d68609117992d6599 | [] | no_license | vaibhavd039/DataSturctures | 5e95643f73d308c32b1d38db1d342a5a45c8d123 | 4026ae60ee2485e134b972017914e32dbda8111b | refs/heads/master | 2022-12-22T01:20:08.501383 | 2020-04-30T10:02:55 | 2020-04-30T10:02:55 | 171,259,635 | 0 | 0 | null | 2022-12-16T06:06:33 | 2019-02-18T10:04:12 | Java | UTF-8 | Java | false | false | 1,220 | java | /*
Given an array of size n and multiple values around which we need to left rotate the array.
How to quickly find multiple left rotations?
* */
import java.util.Scanner;
public class QuickLeftRotation {
static int [] copyArray(int [ ] ary)
{
int n= ary.length;
int [] temp= new int [2*n];
for(int i=0;i<n;i++)
{
temp[i]=temp[i+n]=ary[i];
}
return temp;
}
public static void quickrotation(int [] temp, int k, int n)
{
int start=k%n;
for(int i=start; i<start+n;i++)
{
System.out.print(temp[i]+"\t");
System.out.println(" ");
}
return;
}
public static void main(String[] args)
{
int[] ary = new int[10];
for (int i = 0; i < 10; i++) {
ary[i] = i + 1;
}
Scanner sc = new Scanner(System.in);
for(int i :ary)
{
System.out.println(i);
}
int [] temp=copyArray(ary);
int k=sc.nextInt();
while(k!=0)
{
quickrotation(temp,k,ary.length);
System.out.println("Value of key");
k=sc.nextInt();
}
}
}
| [
"vdubey@onemarketnetwork.com"
] | vdubey@onemarketnetwork.com |
744eee13b1aa04183bb25d6767423f13cfa4a448 | c87bad22d0afebdba041f37c1e43e2f9342e3567 | /ecommerce/src/main/java/com/residencia/ecommerce/controllers/CategoriaController.java | ed1e8a76cf83315a38440529b5be88930829cbe5 | [] | no_license | lucasdealcantara/ecommerce | 8b37b32771ed3334b2552f953433e47728e03340 | 4adec286f8ee2b2c3297d0d117d6bd56e78613a9 | refs/heads/main | 2023-05-20T16:49:32.522580 | 2021-06-11T14:38:11 | 2021-06-11T14:38:11 | 376,020,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,863 | java | package com.residencia.ecommerce.controllers;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.residencia.ecommerce.entities.Categoria;
import com.residencia.ecommerce.services.CategoriaService;
@RestController
@RequestMapping("/categoria")
public class CategoriaController {
@Autowired
private CategoriaService categoriaService;
@GetMapping("/{id}")
public ResponseEntity<Categoria> findById(@PathVariable Integer id) {
HttpHeaders headers = new HttpHeaders();
return new ResponseEntity<>(categoriaService.findById(id), headers, HttpStatus.OK);
}
@GetMapping
public ResponseEntity<List<Categoria>> findAll() throws Exception {
HttpHeaders headers = new HttpHeaders();
return new ResponseEntity<>(categoriaService.findAll(), headers, HttpStatus.OK);
}
@GetMapping("/count")
public Long count() {
return categoriaService.count();
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<Categoria> save(@Valid @RequestBody Categoria categoria) {
HttpHeaders headers = new HttpHeaders();
if (null != categoriaService.save(categoria))
return new ResponseEntity<>(categoriaService.save(categoria), headers, HttpStatus.OK);
else
return new ResponseEntity<>(categoriaService.save(categoria), headers, HttpStatus.BAD_REQUEST);
}
@PutMapping
public Categoria update(@Valid @RequestBody Integer id, Categoria categoria) {
return categoriaService.update(id, categoria);
}
@DeleteMapping
public ResponseEntity<Categoria> delete(@RequestParam Integer id){
HttpHeaders headers = new HttpHeaders();
boolean isRemoved = categoriaService.delete(id);
if(isRemoved) {
return new ResponseEntity<>(headers, HttpStatus.OK);
}
else {
return new ResponseEntity<>(headers, HttpStatus.BAD_REQUEST);
}
}
} | [
"noreply@github.com"
] | lucasdealcantara.noreply@github.com |
ed8710efaf7df61a6e1104b75080d1ab23c8825a | 41ce5edf2e270e321dddd409ffac11ab7f32de86 | /7/com/android/ide/eclipse/adt/internal/editors/ui/tree/UiTreeBlock.java | ca8d9f3e5b14422f8455a7ec8596bcd95830c69f | [] | no_license | danny-source/SDK_Android_Source_03-14 | 372bb03020203dba71bc165c8370b91c80bc6eaa | 323ad23e16f598d5589485b467bb9fba7403c811 | refs/heads/master | 2020-05-18T11:19:29.171830 | 2014-03-29T12:12:44 | 2014-03-29T12:12:44 | 18,238,039 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 36,740 | java | /*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
*
* 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.ide.eclipse.adt.internal.editors.ui.tree;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.AndroidEditor;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor;
import com.android.ide.eclipse.adt.internal.editors.ui.SectionHelper;
import com.android.ide.eclipse.adt.internal.editors.ui.SectionHelper.ManifestSectionPart;
import com.android.ide.eclipse.adt.internal.editors.uimodel.IUiUpdateListener;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener;
import com.android.ide.eclipse.adt.internal.sdk.Sdk.TargetChangeListener;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.forms.DetailsPart;
import org.eclipse.ui.forms.IDetailsPage;
import org.eclipse.ui.forms.IDetailsPageProvider;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.MasterDetailsBlock;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
/**
* {@link UiTreeBlock} is a {@link MasterDetailsBlock} which displays a tree view for
* a specific set of {@link UiElementNode}.
* <p/>
* For a given UI element node, the tree view displays all first-level children that
* match a given type (given by an {@link ElementDescriptor}. All children from these
* nodes are also displayed.
* <p/>
* In the middle next to the tree are some controls to add or delete tree nodes.
* On the left is a details part that displays all the visible UI attributes for a given
* selected UI element node.
*/
public final class UiTreeBlock extends MasterDetailsBlock implements ICommitXml {
/** Height hint for the tree view. Helps the grid layout resize properly on smaller screens. */
private static final int TREE_HEIGHT_HINT = 50;
/** Container editor */
AndroidEditor mEditor;
/** The root {@link UiElementNode} which contains all the elements that are to be
* manipulated by this tree view. In general this is the manifest UI node. */
private UiElementNode mUiRootNode;
/** The descriptor of the elements to be displayed as root in this tree view. All elements
* of the same type in the root will be displayed. */
private ElementDescriptor[] mDescriptorFilters;
/** The title for the master-detail part (displayed on the top "tab" on top of the tree) */
private String mTitle;
/** The description for the master-detail part (displayed on top of the tree view) */
private String mDescription;
/** The master-detail part, composed of a main tree and an auxiliary detail part */
private ManifestSectionPart mMasterPart;
/** The tree viewer in the master-detail part */
private TreeViewer mTreeViewer;
/** The "add" button for the tree view */
private Button mAddButton;
/** The "remove" button for the tree view */
private Button mRemoveButton;
/** The "up" button for the tree view */
private Button mUpButton;
/** The "down" button for the tree view */
private Button mDownButton;
/** The Managed Form used to create the master part */
private IManagedForm mManagedForm;
/** Reference to the details part of the tree master block. */
private DetailsPart mDetailsPart;
/** Reference to the clipboard for copy-paste */
private Clipboard mClipboard;
/** Listener to refresh the tree viewer when the parent's node has been updated */
private IUiUpdateListener mUiRefreshListener;
/** Listener to enable/disable the UI based on the application node's presence */
private IUiUpdateListener mUiEnableListener;
/** An adapter/wrapper to use the add/remove/up/down tree edit actions. */
private UiTreeActions mUiTreeActions;
/**
* True if the root node can be created on-demand (i.e. as needed as
* soon as children exist). False if an external entity controls the existence of the
* root node. In practise, this is false for the manifest application page (the actual
* "application" node is managed by the ApplicationToggle part) whereas it is true
* for all other tree pages.
*/
private final boolean mAutoCreateRoot;
/**
* Creates a new {@link MasterDetailsBlock} that will display all UI nodes matching the
* given filter in the given root node.
*
* @param editor The parent manifest editor.
* @param uiRootNode The root {@link UiElementNode} which contains all the elements that are
* to be manipulated by this tree view. In general this is the manifest UI node or the
* application UI node. This cannot be null.
* @param autoCreateRoot True if the root node can be created on-demand (i.e. as needed as
* soon as children exist). False if an external entity controls the existence of the
* root node. In practise, this is false for the manifest application page (the actual
* "application" node is managed by the ApplicationToggle part) whereas it is true
* for all other tree pages.
* @param descriptorFilters A list of descriptors of the elements to be displayed as root in
* this tree view. Use null or an empty list to accept any kind of node.
* @param title Title for the section
* @param description Description for the section
*/
public UiTreeBlock(AndroidEditor editor,
UiElementNode uiRootNode,
boolean autoCreateRoot,
ElementDescriptor[] descriptorFilters,
String title,
String description) {
mEditor = editor;
mUiRootNode = uiRootNode;
mAutoCreateRoot = autoCreateRoot;
mDescriptorFilters = descriptorFilters;
mTitle = title;
mDescription = description;
}
/** @returns The container editor */
AndroidEditor getEditor() {
return mEditor;
}
/** @returns The reference to the clipboard for copy-paste */
Clipboard getClipboard() {
return mClipboard;
}
/** @returns The master-detail part, composed of a main tree and an auxiliary detail part */
ManifestSectionPart getMasterPart() {
return mMasterPart;
}
/**
* Returns the {@link UiElementNode} for the current model.
* <p/>
* This is used by the content provider attached to {@link #mTreeViewer} since
* the uiRootNode changes after each call to
* {@link #changeRootAndDescriptors(UiElementNode, ElementDescriptor[], boolean)}.
*/
public UiElementNode getRootNode() {
return mUiRootNode;
}
@Override
protected void createMasterPart(final IManagedForm managedForm, Composite parent) {
FormToolkit toolkit = managedForm.getToolkit();
mManagedForm = managedForm;
mMasterPart = new ManifestSectionPart(parent, toolkit);
Section section = mMasterPart.getSection();
section.setText(mTitle);
section.setDescription(mDescription);
section.setLayout(new GridLayout());
section.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite grid = SectionHelper.createGridLayout(section, toolkit, 2);
Tree tree = createTreeViewer(toolkit, grid, managedForm);
createButtons(toolkit, grid);
createTreeContextMenu(tree);
createSectionActions(section, toolkit);
}
private void createSectionActions(Section section, FormToolkit toolkit) {
ToolBarManager manager = new ToolBarManager(SWT.FLAT);
manager.removeAll();
ToolBar toolbar = manager.createControl(section);
section.setTextClient(toolbar);
ElementDescriptor[] descs = mDescriptorFilters;
if (descs == null && mUiRootNode != null) {
descs = mUiRootNode.getDescriptor().getChildren();
}
if (descs != null && descs.length > 1) {
for (ElementDescriptor desc : descs) {
manager.add(new DescriptorFilterAction(desc));
}
}
manager.add(new TreeSortAction());
manager.update(true /*force*/);
}
/**
* Creates the tree and its viewer
* @return The tree control
*/
private Tree createTreeViewer(FormToolkit toolkit, Composite grid,
final IManagedForm managedForm) {
// Note: we *could* use a FilteredTree instead of the Tree+TreeViewer here.
// However the class must be adapted to create an adapted toolkit tree.
final Tree tree = toolkit.createTree(grid, SWT.MULTI);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = AndroidEditor.TEXT_WIDTH_HINT;
gd.heightHint = TREE_HEIGHT_HINT;
tree.setLayoutData(gd);
mTreeViewer = new TreeViewer(tree);
mTreeViewer.setContentProvider(new UiModelTreeContentProvider(mUiRootNode, mDescriptorFilters));
mTreeViewer.setLabelProvider(new UiModelTreeLabelProvider());
mTreeViewer.setInput("unused"); //$NON-NLS-1$
// Create a listener that reacts to selections on the tree viewer.
// When a selection is made, ask the managed form to propagate an event to
// all parts in the managed form.
// This is picked up by UiElementDetail.selectionChanged().
mTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
managedForm.fireSelectionChanged(mMasterPart, event.getSelection());
adjustTreeButtons(event.getSelection());
}
});
// Create three listeners:
// - One to refresh the tree viewer when the parent's node has been updated
// - One to refresh the tree viewer when the framework resources have changed
// - One to enable/disable the UI based on the application node's presence.
mUiRefreshListener = new IUiUpdateListener() {
public void uiElementNodeUpdated(UiElementNode ui_node, UiUpdateState state) {
mTreeViewer.refresh();
}
};
mUiEnableListener = new IUiUpdateListener() {
public void uiElementNodeUpdated(UiElementNode ui_node, UiUpdateState state) {
// The UiElementNode for the application XML node always exists, even
// if there is no corresponding XML node in the XML file.
//
// Normally, we enable the UI here if the XML node is not null.
//
// However if mAutoCreateRoot is true, the root node will be created on-demand
// so the tree/block is always enabled.
boolean exists = mAutoCreateRoot || (ui_node.getXmlNode() != null);
if (mMasterPart != null) {
Section section = mMasterPart.getSection();
if (section.getEnabled() != exists) {
section.setEnabled(exists);
for (Control c : section.getChildren()) {
c.setEnabled(exists);
}
}
}
}
};
/** Listener to update the root node if the target of the file is changed because of a
* SDK location change or a project target change */
final ITargetChangeListener targetListener = new TargetChangeListener() {
@Override
public IProject getProject() {
if (mEditor != null) {
return mEditor.getProject();
}
return null;
}
@Override
public void reload() {
// If a details part has been created, we need to "refresh" it too.
if (mDetailsPart != null) {
// The details part does not directly expose access to its internal
// page book. Instead it is possible to resize the page book to 0 and then
// back to its original value, which has the side effect of removing all
// existing cached pages.
int limit = mDetailsPart.getPageLimit();
mDetailsPart.setPageLimit(0);
mDetailsPart.setPageLimit(limit);
}
// Refresh the tree, preserving the selection if possible.
mTreeViewer.refresh();
}
};
// Setup the listeners
changeRootAndDescriptors(mUiRootNode, mDescriptorFilters, false /* refresh */);
// Listen on resource framework changes to refresh the tree
AdtPlugin.getDefault().addTargetListener(targetListener);
// Remove listeners when the tree widget gets disposed.
tree.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
UiElementNode node = mUiRootNode.getUiParent() != null ?
mUiRootNode.getUiParent() :
mUiRootNode;
node.removeUpdateListener(mUiRefreshListener);
mUiRootNode.removeUpdateListener(mUiEnableListener);
AdtPlugin.getDefault().removeTargetListener(targetListener);
if (mClipboard != null) {
mClipboard.dispose();
mClipboard = null;
}
}
});
// Get a new clipboard reference. It is disposed when the tree is disposed.
mClipboard = new Clipboard(tree.getDisplay());
return tree;
}
/**
* Changes the UI root node and the descriptor filters of the tree.
* <p/>
* This removes the listeners attached to the old root node and reattaches them to the
* new one.
*
* @param uiRootNode The root {@link UiElementNode} which contains all the elements that are
* to be manipulated by this tree view. In general this is the manifest UI node or the
* application UI node. This cannot be null.
* @param descriptorFilters A list of descriptors of the elements to be displayed as root in
* this tree view. Use null or an empty list to accept any kind of node.
* @param forceRefresh If tree, forces the tree to refresh
*/
public void changeRootAndDescriptors(UiElementNode uiRootNode,
ElementDescriptor[] descriptorFilters, boolean forceRefresh) {
UiElementNode node;
// Remove previous listeners if any
if (mUiRootNode != null) {
node = mUiRootNode.getUiParent() != null ? mUiRootNode.getUiParent() : mUiRootNode;
node.removeUpdateListener(mUiRefreshListener);
mUiRootNode.removeUpdateListener(mUiEnableListener);
}
mUiRootNode = uiRootNode;
mDescriptorFilters = descriptorFilters;
mTreeViewer.setContentProvider(new UiModelTreeContentProvider(mUiRootNode, mDescriptorFilters));
// Listen on structural changes on the root node of the tree
// If the node has a parent, listen on the parent instead.
node = mUiRootNode.getUiParent() != null ? mUiRootNode.getUiParent() : mUiRootNode;
node.addUpdateListener(mUiRefreshListener);
// Use the root node to listen to its presence.
mUiRootNode.addUpdateListener(mUiEnableListener);
// Initialize the enabled/disabled state
mUiEnableListener.uiElementNodeUpdated(mUiRootNode, null /* state, not used */);
if (forceRefresh) {
mTreeViewer.refresh();
}
createSectionActions(mMasterPart.getSection(), mManagedForm.getToolkit());
}
/**
* Creates the buttons next to the tree.
*/
private void createButtons(FormToolkit toolkit, Composite grid) {
mUiTreeActions = new UiTreeActions();
Composite button_grid = SectionHelper.createGridLayout(grid, toolkit, 1);
button_grid.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
mAddButton = toolkit.createButton(button_grid, "Add...", SWT.PUSH);
SectionHelper.addControlTooltip(mAddButton, "Adds a new element.");
mAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.VERTICAL_ALIGN_BEGINNING));
mAddButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
doTreeAdd();
}
});
mRemoveButton = toolkit.createButton(button_grid, "Remove...", SWT.PUSH);
SectionHelper.addControlTooltip(mRemoveButton, "Removes an existing selected element.");
mRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mRemoveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
doTreeRemove();
}
});
mUpButton = toolkit.createButton(button_grid, "Up", SWT.PUSH);
SectionHelper.addControlTooltip(mRemoveButton, "Moves the selected element up.");
mUpButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mUpButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
doTreeUp();
}
});
mDownButton = toolkit.createButton(button_grid, "Down", SWT.PUSH);
SectionHelper.addControlTooltip(mRemoveButton, "Moves the selected element down.");
mDownButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mDownButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
doTreeDown();
}
});
adjustTreeButtons(TreeSelection.EMPTY);
}
private void createTreeContextMenu(Tree tree) {
MenuManager menuManager = new MenuManager();
menuManager.setRemoveAllWhenShown(true);
menuManager.addMenuListener(new IMenuListener() {
/**
* The menu is about to be shown. The menu manager has already been
* requested to remove any existing menu item. This method gets the
* tree selection and if it is of the appropriate type it re-creates
* the necessary actions.
*/
public void menuAboutToShow(IMenuManager manager) {
ISelection selection = mTreeViewer.getSelection();
if (!selection.isEmpty() && selection instanceof ITreeSelection) {
ArrayList<UiElementNode> selected = filterSelection((ITreeSelection) selection);
doCreateMenuAction(manager, selected);
return;
}
doCreateMenuAction(manager, null /* ui_node */);
}
});
Menu contextMenu = menuManager.createContextMenu(tree);
tree.setMenu(contextMenu);
}
/**
* Adds the menu actions to the context menu when the given UI node is selected in
* the tree view.
*
* @param manager The context menu manager
* @param selected The UI nodes selected in the tree. Can be null, in which case the root
* is to be modified.
*/
private void doCreateMenuAction(IMenuManager manager, ArrayList<UiElementNode> selected) {
if (selected != null) {
boolean hasXml = false;
for (UiElementNode uiNode : selected) {
if (uiNode.getXmlNode() != null) {
hasXml = true;
break;
}
}
if (hasXml) {
manager.add(new CopyCutAction(getEditor(), getClipboard(),
null, selected, true /* cut */));
manager.add(new CopyCutAction(getEditor(), getClipboard(),
null, selected, false /* cut */));
// Can't paste with more than one element selected (the selection is the target)
if (selected.size() <= 1) {
// Paste is not valid if it would add a second element on a terminal element
// which parent is a document -- an XML document can only have one child. This
// means paste is valid if the current UI node can have children or if the
// parent is not a document.
UiElementNode ui_root = selected.get(0).getUiRoot();
if (ui_root.getDescriptor().hasChildren() ||
!(ui_root.getUiParent() instanceof UiDocumentNode)) {
manager.add(new PasteAction(getEditor(), getClipboard(), selected.get(0)));
}
}
manager.add(new Separator());
}
}
// Append "add" and "remove" actions. They do the same thing as the add/remove
// buttons on the side.
IconFactory factory = IconFactory.getInstance();
// "Add" makes sense only if there's 0 or 1 item selected since the
// one selected item becomes the target.
if (selected == null || selected.size() <= 1) {
manager.add(new Action("Add...", factory.getImageDescriptor("add")) { //$NON-NLS-1$
@Override
public void run() {
super.run();
doTreeAdd();
}
});
}
if (selected != null) {
if (selected != null) {
manager.add(new Action("Remove", factory.getImageDescriptor("delete")) { //$NON-NLS-1$
@Override
public void run() {
super.run();
doTreeRemove();
}
});
}
manager.add(new Separator());
manager.add(new Action("Up", factory.getImageDescriptor("up")) { //$NON-NLS-1$
@Override
public void run() {
super.run();
doTreeUp();
}
});
manager.add(new Action("Down", factory.getImageDescriptor("down")) { //$NON-NLS-1$
@Override
public void run() {
super.run();
doTreeDown();
}
});
}
}
/**
* This is called by the tree when a selection is made.
* It enables/disables the buttons associated with the tree depending on the current
* selection.
*
* @param selection The current tree selection (same as mTreeViewer.getSelection())
*/
private void adjustTreeButtons(ISelection selection) {
mRemoveButton.setEnabled(!selection.isEmpty() && selection instanceof ITreeSelection);
mUpButton.setEnabled(!selection.isEmpty() && selection instanceof ITreeSelection);
mDownButton.setEnabled(!selection.isEmpty() && selection instanceof ITreeSelection);
}
/**
* An adapter/wrapper to use the add/remove/up/down tree edit actions.
*/
private class UiTreeActions extends UiActions {
@Override
protected UiElementNode getRootNode() {
return mUiRootNode;
}
@Override
protected void selectUiNode(UiElementNode uiNodeToSelect) {
// Select the new item
if (uiNodeToSelect != null) {
LinkedList<UiElementNode> segments = new LinkedList<UiElementNode>();
for (UiElementNode ui_node = uiNodeToSelect; ui_node != mUiRootNode;
ui_node = ui_node.getUiParent()) {
segments.add(0, ui_node);
}
if (segments.size() > 0) {
mTreeViewer.setSelection(new TreeSelection(new TreePath(segments.toArray())));
} else {
mTreeViewer.setSelection(null);
}
}
}
@Override
public void commitPendingXmlChanges() {
commitManagedForm();
}
}
/**
* Filters an ITreeSelection to only keep the {@link UiElementNode}s (in case there's
* something else in there).
*
* @return A new list of {@link UiElementNode} with at least one item or null.
*/
@SuppressWarnings("unchecked")
private ArrayList<UiElementNode> filterSelection(ITreeSelection selection) {
ArrayList<UiElementNode> selected = new ArrayList<UiElementNode>();
for (Iterator it = selection.iterator(); it.hasNext(); ) {
Object selectedObj = it.next();
if (selectedObj instanceof UiElementNode) {
selected.add((UiElementNode) selectedObj);
}
}
return selected.size() > 0 ? selected : null;
}
/**
* Called when the "Add..." button next to the tree view is selected.
*
* Displays a selection dialog that lets the user select which kind of node
* to create, depending on the current selection.
*/
private void doTreeAdd() {
UiElementNode ui_node = mUiRootNode;
ISelection selection = mTreeViewer.getSelection();
if (!selection.isEmpty() && selection instanceof ITreeSelection) {
ITreeSelection tree_selection = (ITreeSelection) selection;
Object first = tree_selection.getFirstElement();
if (first != null && first instanceof UiElementNode) {
ui_node = (UiElementNode) first;
}
}
mUiTreeActions.doAdd(
ui_node,
mDescriptorFilters,
mTreeViewer.getControl().getShell(),
(ILabelProvider) mTreeViewer.getLabelProvider());
}
/**
* Called when the "Remove" button is selected.
*
* If the tree has a selection, remove it.
* This simply deletes the XML node attached to the UI node: when the XML model fires the
* update event, the tree will get refreshed.
*/
protected void doTreeRemove() {
ISelection selection = mTreeViewer.getSelection();
if (!selection.isEmpty() && selection instanceof ITreeSelection) {
ArrayList<UiElementNode> selected = filterSelection((ITreeSelection) selection);
mUiTreeActions.doRemove(selected, mTreeViewer.getControl().getShell());
}
}
/**
* Called when the "Up" button is selected.
* <p/>
* If the tree has a selection, move it up, either in the child list or as the last child
* of the previous parent.
*/
protected void doTreeUp() {
ISelection selection = mTreeViewer.getSelection();
if (!selection.isEmpty() && selection instanceof ITreeSelection) {
ArrayList<UiElementNode> selected = filterSelection((ITreeSelection) selection);
mUiTreeActions.doUp(selected);
}
}
/**
* Called when the "Down" button is selected.
*
* If the tree has a selection, move it down, either in the same child list or as the
* first child of the next parent.
*/
protected void doTreeDown() {
ISelection selection = mTreeViewer.getSelection();
if (!selection.isEmpty() && selection instanceof ITreeSelection) {
ArrayList<UiElementNode> selected = filterSelection((ITreeSelection) selection);
mUiTreeActions.doDown(selected);
}
}
/**
* Commits the current managed form (the one associated with our master part).
* As a side effect, this will commit the current UiElementDetails page.
*/
void commitManagedForm() {
if (mManagedForm != null) {
mManagedForm.commit(false /* onSave */);
}
}
/* Implements ICommitXml for CopyCutAction */
public void commitPendingXmlChanges() {
commitManagedForm();
}
@Override
protected void createToolBarActions(IManagedForm managedForm) {
// Pass. Not used, toolbar actions are defined by createSectionActions().
}
@Override
protected void registerPages(DetailsPart detailsPart) {
// Keep a reference on the details part (the super class doesn't provide a getter
// for it.)
mDetailsPart = detailsPart;
// The page selection mechanism does not use pages registered by association with
// a node class. Instead it uses a custom details page provider that provides a
// new UiElementDetail instance for each node instance. A limit of 5 pages is
// then set (the value is arbitrary but should be reasonable) for the internal
// page book.
detailsPart.setPageLimit(5);
final UiTreeBlock tree = this;
detailsPart.setPageProvider(new IDetailsPageProvider() {
public IDetailsPage getPage(Object key) {
if (key instanceof UiElementNode) {
return new UiElementDetail(tree);
}
return null;
}
public Object getPageKey(Object object) {
return object; // use node object as key
}
});
}
/**
* An alphabetic sort action for the tree viewer.
*/
private class TreeSortAction extends Action {
private ViewerComparator mComparator;
public TreeSortAction() {
super("Sorts elements alphabetically.", AS_CHECK_BOX);
setImageDescriptor(IconFactory.getInstance().getImageDescriptor("az_sort")); //$NON-NLS-1$
if (mTreeViewer != null) {
boolean is_sorted = mTreeViewer.getComparator() != null;
setChecked(is_sorted);
}
}
/**
* Called when the button is selected. Toggles the tree viewer comparator.
*/
@Override
public void run() {
if (mTreeViewer == null) {
notifyResult(false /*success*/);
return;
}
ViewerComparator comp = mTreeViewer.getComparator();
if (comp != null) {
// Tree is currently sorted.
// Save currently comparator and remove it
mComparator = comp;
mTreeViewer.setComparator(null);
} else {
// Tree is not currently sorted.
// Reuse or add a new comparator.
if (mComparator == null) {
mComparator = new ViewerComparator();
}
mTreeViewer.setComparator(mComparator);
}
notifyResult(true /*success*/);
}
}
/**
* A filter on descriptor for the tree viewer.
* <p/>
* The tree viewer will contain many of these actions and only one can be enabled at a
* given time. When no action is selected, everything is displayed.
* <p/>
* Since "radio"-like actions do not allow for unselecting all of them, we manually
* handle the exclusive radio button-like property: when an action is selected, it manually
* removes all other actions as needed.
*/
private class DescriptorFilterAction extends Action {
private final ElementDescriptor mDescriptor;
private ViewerFilter mFilter;
public DescriptorFilterAction(ElementDescriptor descriptor) {
super(String.format("Displays only %1$s elements.", descriptor.getUiName()),
AS_CHECK_BOX);
mDescriptor = descriptor;
setImageDescriptor(descriptor.getImageDescriptor());
}
/**
* Called when the button is selected.
* <p/>
* Find any existing {@link DescriptorFilter}s and remove them. Install ours.
*/
@Override
public void run() {
super.run();
if (isChecked()) {
if (mFilter == null) {
// create filter when required
mFilter = new DescriptorFilter(this);
}
// we add our filter first, otherwise the UI might show the full list
mTreeViewer.addFilter(mFilter);
// Then remove the any other filters except ours. There should be at most
// one other filter, since that's how the actions are made to look like
// exclusive radio buttons.
for (ViewerFilter filter : mTreeViewer.getFilters()) {
if (filter instanceof DescriptorFilter && filter != mFilter) {
DescriptorFilterAction action = ((DescriptorFilter) filter).getAction();
action.setChecked(false);
mTreeViewer.removeFilter(filter);
}
}
} else if (mFilter != null){
mTreeViewer.removeFilter(mFilter);
}
}
/**
* Filters the tree viewer for the given descriptor.
* <p/>
* The filter is linked to the action so that an action can iterate through the list
* of filters and un-select the actions.
*/
private class DescriptorFilter extends ViewerFilter {
private final DescriptorFilterAction mAction;
public DescriptorFilter(DescriptorFilterAction action) {
mAction = action;
}
public DescriptorFilterAction getAction() {
return mAction;
}
/**
* Returns true if an element should be displayed, that if the element or
* any of its parent matches the requested descriptor.
*/
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
while (element instanceof UiElementNode) {
UiElementNode uiNode = (UiElementNode)element;
if (uiNode.getDescriptor() == mDescriptor) {
return true;
}
element = uiNode.getUiParent();
}
return false;
}
}
}
}
| [
"danny@35g.tw"
] | danny@35g.tw |
c7453f85f581116d7a80108fb4cebd14a8f3dd99 | f09e009c97490fba182ca8b36823d520e80ee881 | /src/de/x8bit/Fantasya/Host/serialization/basic/SkillSerializer.java | 7c96b2d1b27f239c3652e21945aee89994a3ed92 | [] | no_license | wavepacket/Fantasya | b910a74344d370c1b8cb4cf172e593a61558d354 | 0cb8745a0fd8979502fda7ec5afe35f63f194a2b | refs/heads/master | 2021-01-17T09:39:44.976629 | 2015-03-19T22:09:45 | 2015-03-19T22:09:45 | 27,676,248 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,090 | java | package de.x8bit.Fantasya.Host.serialization.basic;
import de.x8bit.Fantasya.Atlantis.Helper.MapCache;
import de.x8bit.Fantasya.Atlantis.Skill;
import de.x8bit.Fantasya.Atlantis.Unit;
import de.x8bit.Fantasya.Host.serialization.util.SerializedData;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* This class loads and saves the skills belonging to some unit.
*/
public class SkillSerializer implements ObjectSerializer<Unit> {
private Logger logger = LoggerFactory.getLogger(this.getClass());
private MapCache<Unit> unitCache;
/** Creates a new serializer.
*
* @param unitCache a collection of loaded units.
* @throws IllegalArgumentException if the cache is not supplied.
*/
public SkillSerializer(MapCache<Unit> unitCache) {
if (unitCache == null) {
throw new IllegalArgumentException("Require a valid unit list.");
}
this.unitCache = unitCache;
}
@Override
public boolean isValidKeyset(Set<String> keys) {
return (keys.contains("talent")
&& keys.contains("nummer")
&& keys.contains("lerntage"));
}
@SuppressWarnings("unchecked")
@Override
public Unit load(Map<String, String> mapping) {
// figure out the correct skill class
Class<? extends Skill> clazz;
try {
clazz = (Class<? extends Skill>) Class.forName(
"de.x8bit.Fantasya.Atlantis.Skills." + mapping.get("talent"));
} catch (ClassNotFoundException ex) {
logger.warn("Error loading skill: Invalid type \"{}\"",
mapping.get("talent"));
return null;
}
// figure out the correct unit
int id = Integer.decode(mapping.get("nummer"));
Unit unit = unitCache.get(id);
if (unit == null) {
logger.warn("Error loading skill: Unit with id \"{}\" not found.",
id);
return null;
}
int lerntage = Integer.decode(mapping.get("lerntage"));
if (lerntage <= 0) {
logger.warn("Error loading skill {} of unit {}: non-positive values.",
mapping.get("talent"),
id);
return null;
}
logger.debug("Loading skill \"{}\" of unit \"{}\" with {} lerntage.",
mapping.get("talent"),
id,
lerntage);
unit.setSkill(clazz, lerntage);
return unit;
}
@Override
public SerializedData save(Unit object) {
SerializedData data = new SerializedData();
for (Skill skill : object.getSkills()) {
if (skill.getLerntage() <= 0) {
// the current code effectively produces a skill object for each
// skill and attaches it to each unit. Most of them are zero,
// because the unit simply does not have the skill, so this
// logging produces too much output currently.
// logger.warn("Error saving skill \"{}\" of unit \"{}\": Non-positive lerntage.",
// skill.getClass().getSimpleName(),
// object.getNummer());
continue;
}
Map<String, String> item = new HashMap<String, String>();
item.put("nummer", String.valueOf(object.getNummer()));
item.put("talent", skill.getClass().getSimpleName());
item.put("lerntage", String.valueOf(skill.getLerntage()));
data.add(item);
}
return data;
}
}
| [
"ulf82@users.sf.net"
] | ulf82@users.sf.net |
4483fdfebc0b2280e25e910845a136940824d085 | 94d91903819947c4fb2598af40cf53344304dbac | /wssmall_1.2.0/.svn/pristine/5a/5aa2a8f000309e8967ff58663f1fc8d7b0d87bbd.svn-base | 70671d08681a8c39b4f631d54f8e1e9615d5a65f | [] | no_license | lichao20000/Union | 28175725ad19733aa92134ccbfb8c30570f4795a | a298de70065c5193c98982dacc7c2b3e2d4b5d86 | refs/heads/master | 2023-03-07T16:24:58.933965 | 2021-02-22T12:34:05 | 2021-02-22T12:34:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,021 | package zte.params.goodscats.req;
import com.ztesoft.api.ApiRuleException;
import com.ztesoft.net.annotation.ZteSoftCommentAnnotationParam;
import com.ztesoft.net.mall.core.model.Cat;
import commons.CommonTools;
import consts.ConstsCore;
import params.ZteError;
import params.ZteRequest;
public class CatEditReq extends ZteRequest {
@ZteSoftCommentAnnotationParam(name="商品分类",type="Cat",isNecessary="Y",desc="cat:商品分类。")
private Cat cat;
public Cat getCat() {
return cat;
}
public void setCat(Cat cat) {
this.cat = cat;
}
@Override
public void check() throws ApiRuleException {
if(cat.getName() == null || "".equals(cat.getName())) CommonTools.addError(new ZteError(ConstsCore.ERROR_FAIL, "name:分类名称不允许为空"));
if(cat.getCat_id() == null || "".equals(cat.getCat_id())) CommonTools.addError(new ZteError(ConstsCore.ERROR_FAIL, "cat_id:分类ID不允许为空"));
}
@Override
public String getApiMethodName() {
return "com.goodsService.cat.edit";
}
}
| [
"hxl971230.outlook.com"
] | hxl971230.outlook.com | |
7970c31d98a113932053e04833707f04581e2f10 | cb0e08dcf8ca6707d4942bbb77a39df4efd7d82a | /src/main/java/eu/bitfork/dens/web/rest/vm/KeyAndPasswordVM.java | f3cf1f1185c7b78344be96ceddbde09f985343f3 | [] | no_license | bitfork-develop/dens | d8f1cf6f9c2873f95a6b0bb9d6cccfad637af1b5 | 1aebf1c97955ef00d2bf2af2572e8e8d313c16c3 | refs/heads/master | 2021-06-28T18:34:01.750957 | 2017-09-15T08:31:44 | 2017-09-15T08:31:44 | 103,633,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package eu.bitfork.dens.web.rest.vm;
/**
* View Model object for storing the user's key and password.
*/
public class KeyAndPasswordVM {
private String key;
private String newPassword;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
965c7714f4f4910a0e7b27bb2b05860934139d76 | 806f76edfe3b16b437be3eb81639d1a7b1ced0de | /src/com/amap/api/services/core/at.java | 8f0f420bef1b3d1f90c77bf22c40ac42690dc979 | [] | no_license | magic-coder/huawei-wear-re | 1bbcabc807e21b2fe8fe9aa9d6402431dfe3fb01 | 935ad32f5348c3d8c8d294ed55a5a2830987da73 | refs/heads/master | 2021-04-15T18:30:54.036851 | 2018-03-22T07:16:50 | 2018-03-22T07:16:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package com.amap.api.services.core;
/* compiled from: Util */
class at {
at() {
}
static String m16692a(String str) {
if (str == null) {
return null;
}
String b = aa.m16586b(str.getBytes());
return ((char) ((b.length() % 26) + 65)) + b;
}
static String m16693b(String str) {
if (str.length() < 2) {
return "";
}
return aa.m16582a(str.substring(1));
}
}
| [
"lebedev1537@gmail.com"
] | lebedev1537@gmail.com |
d19adb9425a444d94848f8d521aeb733b06f5c03 | 0c222c8260187ea7edf1a48c0876ceebd70fa6fa | /RxJava/r1-start/src/androidTest/java/ru/test/r1_start/ExampleInstrumentedTest.java | 75c54134733d048ef03b3d087a9d63929045f4d2 | [] | no_license | dan9112/work_all | 8da454829119c87c380eb0235b24f8ac1eed7418 | 0205e7dced0fcf22be1a497d111742c0076b2b93 | refs/heads/master | 2023-03-18T10:27:48.901882 | 2021-03-10T08:38:13 | 2021-03-10T08:38:13 | 337,049,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package ru.test.r1_start;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("ru.test.r1_start", appContext.getPackageName());
}
} | [
"58068292+dan9112@users.noreply.github.com"
] | 58068292+dan9112@users.noreply.github.com |
869a4fd4ae16117b060cbc17f23974437445ea7b | c21c967d7a7f6df4eade4c96492b5df988e4d536 | /app/src/main/java/dimfcompany/com/salesideas/act_main.java | cc22fefcb36944825da912694b604e171f4f089c | [] | no_license | bios90/salesIdeas | 3b485f48277f50fcdebc1cba5a14fabdbde3ab21 | 1758dcc963940fd619c394467fe6d340182619da | refs/heads/master | 2020-04-05T19:30:15.469114 | 2019-01-30T13:43:46 | 2019-01-30T13:43:46 | 157,137,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,691 | java | package dimfcompany.com.salesideas;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.vk.sdk.VKAccessToken;
import com.vk.sdk.VKCallback;
import com.vk.sdk.VKSdk;
import com.vk.sdk.api.VKError;
import java.util.ArrayList;
import dimfcompany.com.salesideas.Fragments.frag_analitics;
import dimfcompany.com.salesideas.Fragments.frag_clients;
import dimfcompany.com.salesideas.Fragments.frag_export;
import dimfcompany.com.salesideas.Fragments.frag_import;
import dimfcompany.com.salesideas.Fragments.frag_my_profile;
import dimfcompany.com.salesideas.Helpers.GlobalHelper;
public class act_main extends AppCompatActivity
{
private static final String TAG = "act_main";
private GlobalHelper gh;
Toolbar toolbar;
DrawerLayout laDrawerRoot;
TextView tvTitle,tvHamburger;
FrameLayout laMainFrame;
LinearLayout laMyProfile,laClients,laAnalitics,laExport,laMailing,laImport;
ArrayList<LinearLayout> listOfNavLinks = new ArrayList<>();
TextView tvAdminName,tvAdminEmail;
private FragmentManager fragManager;
private FragmentTransaction fragTransaction;
private Fragment fragClients;
private Fragment fragMyProfile;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.act_main);
init();
}
private void init()
{
gh=(GlobalHelper)getApplicationContext();
fragManager = act_main.this.getSupportFragmentManager();
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
laDrawerRoot = findViewById(R.id.laDrawerRoot);
tvTitle = findViewById(R.id.tvBarTitle);
tvHamburger = findViewById(R.id.tvHamburger);
laMainFrame = findViewById(R.id.frameMain);
laMyProfile = findViewById(R.id.laMyProfile);
laClients = findViewById(R.id.laClients);
laAnalitics = findViewById(R.id.laAnalitics);
laMailing = findViewById(R.id.laMailing);
laExport = findViewById(R.id.laExport);
laImport = findViewById(R.id.laImport);
listOfNavLinks.add(laMyProfile);
listOfNavLinks.add(laClients);
listOfNavLinks.add(laAnalitics);
listOfNavLinks.add(laMailing);
listOfNavLinks.add(laExport);
listOfNavLinks.add(laImport);
tvAdminName = findViewById(R.id.tvAdminName);
tvAdminEmail = findViewById(R.id.tvAdminEmail);
tvAdminName.setText((String)gh.getAdminInfo().get(GlobalHelper.SQL_COL_NAME));
tvAdminEmail.setText((String)gh.getAdminInfo().get(GlobalHelper.SQL_COL_EMAIL));
tvHamburger.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
laDrawerRoot.openDrawer(Gravity.START,true);
}
});
laMyProfile.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_my_profile(),laMainFrame);
changeLinksColor((LinearLayout)view);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
});
laClients.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_clients(),laMainFrame);
changeLinksColor((LinearLayout)view);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
});
laImport.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_import(),laMainFrame);
changeLinksColor((LinearLayout)view);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
});
laExport.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_export(),laMainFrame);
changeLinksColor((LinearLayout)view);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
});
laAnalitics.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_analitics(),laMainFrame);
changeLinksColor((LinearLayout)view);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
});
}
public void showAllAfterVkAdd()
{
fragManager = getSupportFragmentManager();
gh.makeFragChange(fragManager,new frag_clients(),laMainFrame);
changeLinksColor(laClients);
laDrawerRoot.closeDrawer(Gravity.LEFT,true);
}
private void changeLinksColor(LinearLayout clickedLa)
{
for(LinearLayout navLa : listOfNavLinks)
{
TextView tvIcon = (TextView)navLa.getChildAt(0);
TextView link = (TextView)navLa.getChildAt(1);
if(navLa == clickedLa)
{
tvIcon.setTextColor(getResources().getColor(R.color.myPink));
link.setTextColor(getResources().getColor(R.color.myPink));
continue;
}
tvIcon.setTextColor(getResources().getColor(R.color.myLightGray));
link.setTextColor(getResources().getColor(R.color.myLightGray));
}
}
@Override
public void onBackPressed()
{
if(laDrawerRoot.isDrawerOpen(Gravity.START))
{
laDrawerRoot.closeDrawer(Gravity.START,true);
return;
}
super.onBackPressed();
}
}
| [
"bios90@mail.ru"
] | bios90@mail.ru |
72e44f32522817437dd3e851c1c2c7c6c8d09d66 | 442bab63495ff3cd6f946e776037b7958e144075 | /src/hibernate/MessageDAO.java | 1c86b181e2e911ea487e64107224f9a8113b86a4 | [] | no_license | nenew/gd | b8946f896f20d7739cf8ee7340cf0cffcbb6fb57 | 4abe05068f8ceb42806853d28517bfdbeceb0f4a | refs/heads/master | 2016-09-01T19:22:14.488855 | 2013-06-19T12:21:51 | 2013-06-19T12:21:51 | 8,771,516 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,202 | java | package hibernate;
import java.util.Date;
import java.util.List;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A data access object (DAO) providing persistence and search support for
* Message entities. Transaction control of the save(), update() and delete()
* operations can directly support Spring container-managed transactions or they
* can be augmented to handle user-managed Spring transactions. Each of these
* methods provides additional information for how to configure it for the
* desired type of transaction control.
*
* @see hibernate.Message
* @author MyEclipse Persistence Tools
*/
public class MessageDAO extends BaseHibernateDAO {
private static final Logger log = LoggerFactory.getLogger(MessageDAO.class);
// property constants
public static final String TOID = "toid";
public static final String CONTENT = "content";
public static final String ISREAD = "isread";
public void save(Message transientInstance) {
log.debug("saving Message instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Message persistentInstance) {
log.debug("deleting Message instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Message findById(java.lang.Integer id) {
log.debug("getting Message instance with id: " + id);
try {
Message instance = (Message) getSession().get("hibernate.Message",
id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Message instance) {
log.debug("finding Message instance by example");
try {
List results = getSession().createCriteria("hibernate.Message")
.add(Example.create(instance)).list();
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Message instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Message as model where model."
+ propertyName + "= ? order by model.sendtime desc";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByToid(Object toid) {
return findByProperty(TOID, toid);
}
public List findByContent(Object content) {
return findByProperty(CONTENT, content);
}
public List findByIsread(Object isread) {
return findByProperty(ISREAD, isread);
}
public List findAll() {
log.debug("finding all Message instances");
try {
String queryString = "from Message";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Message merge(Message detachedInstance) {
log.debug("merging Message instance");
try {
Message result = (Message) getSession().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Message instance) {
log.debug("attaching dirty Message instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Message instance) {
log.debug("attaching clean Message instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
} | [
"nenew.net@gmail.com"
] | nenew.net@gmail.com |
3bc6a9d1e9c896d791654214bb4dd6874ba3b2b2 | 4be0056bfb7b7347c05732669ac47ab889e0ec78 | /cucumber-core/src/test/java/io/cucumber/core/plugin/BannerTest.java | c34df121d91d13a97260e5e52d34df732ba7f4eb | [
"MIT"
] | permissive | cucumber/cucumber-jvm | c0cc0771b02eade3bbea26cf6af934693ce0cdeb | 5a84f4f35474d21698e990197d20d5fdccceddaa | refs/heads/main | 2023-08-31T20:35:34.167596 | 2023-08-30T22:46:29 | 2023-08-30T22:46:29 | 1,962,219 | 2,190 | 1,935 | MIT | 2023-09-14T17:12:50 | 2011-06-27T19:49:46 | Java | UTF-8 | Java | false | false | 2,445 | java | package io.cucumber.core.plugin;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import static io.cucumber.core.plugin.Bytes.bytes;
import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
class BannerTest {
@Test
void printsAnsiBanner() throws UnsupportedEncodingException {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Banner banner = new Banner(new PrintStream(bytes, false, StandardCharsets.UTF_8.name()), false);
banner.print(asList(
new Banner.Line("Bla"),
new Banner.Line(
new Banner.Span("Bla "),
new Banner.Span("Bla", AnsiEscapes.BLUE),
new Banner.Span(" "),
new Banner.Span("Bla", AnsiEscapes.RED)),
new Banner.Line("Bla Bla")), AnsiEscapes.CYAN);
assertThat(bytes, bytes(equalTo("" +
"\u001B[36m┌─────────────┐\u001B[0m\n" +
"\u001B[36m│\u001B[0m Bla \u001B[36m│\u001B[0m\n" +
"\u001B[36m│\u001B[0m Bla \u001B[34mBla\u001B[0m \u001B[31mBla\u001B[0m \u001B[36m│\u001B[0m\n" +
"\u001B[36m│\u001B[0m Bla Bla \u001B[36m│\u001B[0m\n" +
"\u001B[36m└─────────────┘\u001B[0m\n")));
}
@Test
void printsMonochromeBanner() throws Exception {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
Banner banner = new Banner(new PrintStream(bytes, false, StandardCharsets.UTF_8.name()), true);
banner.print(asList(
new Banner.Line("Bla"),
new Banner.Line(
new Banner.Span("Bla "),
new Banner.Span("Bla", AnsiEscapes.BLUE),
new Banner.Span(" "),
new Banner.Span("Bla", AnsiEscapes.RED)),
new Banner.Line("Bla Bla")), AnsiEscapes.CYAN);
assertThat(bytes, bytes(equalTo("" +
"┌─────────────┐\n" +
"│ Bla │\n" +
"│ Bla Bla Bla │\n" +
"│ Bla Bla │\n" +
"└─────────────┘\n")));
}
}
| [
"noreply@github.com"
] | cucumber.noreply@github.com |
33378c0ecd3138dbde678be679703230e549c4f3 | 0d6f964cf24ceeea715fb641533141f08daefc49 | /gallery-web/src/main/java/com/xs/controllers/SlideController.java | 25f834acb42075fdcff420b15bf89a2d07a44903 | [] | no_license | fmbah/gallery_upper | cb61a391aed39f4505091b646a33558388f50d68 | 5f40a213d658801975cde800429310a973a44c6c | refs/heads/master | 2020-04-01T21:05:38.694844 | 2019-05-08T05:51:51 | 2019-05-08T05:51:51 | 153,636,773 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,467 | java | package com.xs.controllers;
import com.xs.core.ResultGenerator;
import com.xs.beans.Slide;
import com.xs.services.SlideService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xs.core.scontroller.BaseController;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import javax.validation.Valid;
import org.springframework.validation.BindingResult;
import java.util.List;
/**
\* User: zhaoxin
\* Date: 2018/10/18
\* To change this template use File | Settings | File Templates.
\* Description:
\*/
@Api(description = "轮播图管理")
@RestController
@RequestMapping(value="/api/back/slide")
public class SlideController extends BaseController{
@Autowired
private SlideService slideService;
/***
* 新增
* @return
*/
@ApiOperation(value = "录入",notes = "录入")
@PutMapping(value = "/add",produces = "application/json;charset=utf-8")
public Object add(@Valid @RequestBody Slide slide, BindingResult bindingResult) {
slideService.save(slide);
return ResultGenerator.genSuccessResult();
}
/***
* 删除
* @return
*/
@ApiOperation(value = "删除",notes = "删除")
@ApiImplicitParams({
@ApiImplicitParam(value = "ID",name="id",required = true,paramType = "query")
})
@DeleteMapping(value = "/delete",produces = "application/json;charset=utf-8")
public Object delete(@RequestParam Integer id) {
slideService.deleteById(id);
return ResultGenerator.genSuccessResult();
}
// /***
// * 修改
// * @return
// */
// @ApiOperation(value = "修改",notes = "修改")
// @PostMapping(value = "/update",produces = "application/json;charset=utf-8")
// public Object update(@Valid @RequestBody Slide slide, BindingResult bindingResult) {
// slideService.update(slide);
// return ResultGenerator.genSuccessResult();
// }
/***
* 详情
* @return
*/
@ApiOperation(value = "详情",notes = "详情")
@ApiImplicitParams({@ApiImplicitParam(value = "ID",name="id",required = true,paramType = "query")})
@GetMapping(value = "/detail",produces = "application/json;charset=utf-8")
public Object detail(@RequestParam Integer id) {
Slide slide = slideService.findById(id);
return ResultGenerator.genSuccessResult(slide);
}
/***
* 分页列表
* @return
*/
@ApiOperation(value = "分页列表",notes = "分页列表")
@ApiImplicitParams({
@ApiImplicitParam(value = "页码",name = "page", paramType = "query",defaultValue = "0"),
@ApiImplicitParam(value = "条数",name = "size",paramType = "query",defaultValue = "0"),
@ApiImplicitParam(value = "位置(首页:1;分享获益:2;会员权益:3;)",name = "type",paramType = "query")
})
@GetMapping(value = "/list",produces = "application/json;charset=utf-8")
public Object list(@RequestParam(required = false,defaultValue = "0") Integer page,
@RequestParam(required = false,defaultValue = "0") Integer size,
@RequestParam(required = false) Integer type
){
return slideService.queryWithPage(page, size, type);
}
}
| [
"807966224@qq.com"
] | 807966224@qq.com |
0b11f35866e4726418f9cfeaa743056159b42031 | b797dbfcca959eb9f9faa07872f1070fe3fb1e75 | /z/src/Workshop1_5_2.java | a0e4f4fcf224eda6fe8ed2704f3e29efc9f706c1 | [] | no_license | Jack0215/Java_Basic | 310a49d1f9ca423a808db245fc339850e109ed5b | 3d4605c398fd09e3634994582e4ab5aa41c3ad04 | refs/heads/master | 2023-02-17T22:35:15.616035 | 2021-01-15T06:14:08 | 2021-01-15T06:14:08 | 329,824,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | //
//public class Workshop1_5_2{
//
// public static void main(String[] args) {
// Workshop1_5 studentArray [] = new Workshop1_5[3];
// studentArray[0] = new Workshop1_5("홍길동", 15, 170, 80);
// studentArray[1] = new Workshop1_5("한사람", 13, 180, 70);
// studentArray[2] = new Workshop1_5("임걱정", 16, 175, 65);
//
//
// }
// double totalAge = 0;
// double totalHeight = 0;
// double totalWeight = 0;
//
// int maxAgeIndex = 0;
// int minAgeIndex = 0;
// int maxHeightIndex = 0;
// int minHeightIndex = 0;
// int maxWeightIndex = 0;
// int minWeightIndex = 0;
//
// System.out.println("이름 \t 나이 \t 신장 \t 몸무게");
//
// for(int i = 0; i < studentArray.length; i++) {
// Object[] studentArray;
// System.out.println(studentArray[i].studentInfo());
//
// totalAge += studentArray[i].getAge();
// totalHeight += studentArray[i].getHeight();
// totalWeight += studentArray[i].getWeight();
//
// if( studentArray[maxAgeIndex].getAge() <
// studentArray[i].getAge()) {
// maxAgeIndex = i;
// }
//
// if( studentArray[minAgeIndex].getAge() >
// studentArray[i].getAge()) {
// minAgeIndex = i;
//
// }
// if( Array[maxHeightIndex].getHeight() <
// Array[i].getHeight()) {
// maxHeightIndex = i;
//
// }
// if( Array[minHeightIndex].getHeight() >
// Array[i].getHeight()) {
// minHeightIndex = i;
//
// }
// if( Array[minWeightIndex].getWeight() <
// Array[i].getWeight()) {
// minWeightIndex = i;
//
// }
// if( Array[minWeightIndex].getWeight() >
// Array[i].getWeight()) {
// minWeightIndex = i;
// }
// }
// System.out.println();
// System.out.printf("나이 평균 : %.3f \n", (totalAge / studentArray.length));
// System.out.printf("신장 평균 : %.3f \n", (totalHeight / studentArray.length));
// System.out.printf("몸무게 평균 : %.3f \n", (totalWeight / studentArray.length));
// System.out.println();
// System.out.println("나이가 가장 많은 학생 : " + studentArray[maxAgeIndex].getName());
// System.out.println("나이가 가장 적은 학생 : " + studentArray[minAgeIndex].getName());
// System.out.println("신장이 가장 큰 학생 : " + studentArray[maxHeightIndex].getName());
// System.out.println("신장이 가장 작은 학생 : " + studentArray[minHeightIndex].getName());
// System.out.println("몸무게가 가장 많이 나가는 학생 : " +
// studentArray[maxWeightIndex].getName());
// System.out.println("몸무게가 가장 적게 나가는 학생 : " +
// studentArray[minWeightIndex].getName());
// }
//
//} | [
"jaeyoon-lee@naver.com"
] | jaeyoon-lee@naver.com |
74543f005931a23489f8ceedff61db8820a6465b | c3bb93f79fad89a638cff82e4b1bfebfdc1a8dfa | /contours/src/main/java/ar/edu/it/itba/ati/operation/tp2/edge/Kirsh.java | 9ab7967470af4412c9013f0be87890487a7ed92c | [] | no_license | champo/proyecto-final | e432495772b594573e9d25fb81580edfc76cd831 | 5f988da114cef3a847349183acecf6be21faeb63 | refs/heads/master | 2020-04-16T01:31:33.292800 | 2014-08-02T03:03:33 | 2014-08-02T03:03:33 | 12,148,506 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package ar.edu.it.itba.ati.operation.tp2.edge;
import ar.edu.it.itba.ati.operation.BaseMask;
import ar.edu.it.itba.ati.operation.Synthethizer;
public class Kirsh extends DirectionalDetector {
public Kirsh(final Synthethizer synth, final boolean simple) {
super(synth, simple);
}
@Override
protected Mask buildSimpleMask(final int width, final int height) {
return new Mask(width, height, new double[][] { { 5, 5, 5 }, { -3, 0, -3 }, { -3, -3, -3 } });
}
@Override
protected BaseMask[] buildAllMasks(final int width, final int height) {
return new BaseMask[] {
/*
* 5 5 5
* -3 0 -3
* -3 -3 -3
*/
new Mask(width, height, new double[][] { { 5, 5, 5 }, { -3, 0, -3 }, { -3, -3, -3 } }),
new Mask(width, height, new double[][] { { 0, 5, -3 }, { 5, 0, -3 }, { -3, -3, 0 } }),
new Mask(width, height, new double[][] { { 5, -3, -3 }, { 5, 0, -3 }, { 5, -3, -3 } }),
new Mask(width, height, new double[][] { { -3, -3, 0 }, { 5, 0, -3 }, { 0, 5, -3 } }),
};
}
}
| [
"eordano@gmail.com"
] | eordano@gmail.com |
437df510d221c3a4161656e76605c17e4690fddf | fa895d21cc9cf1f7fc452cb8ad0b836c30ce954c | /bitbucket-microservice/bitbucket-repository/src/main/java/eu/cloudteams/repository/dao/UserRepository.java | a9770d78627871943aef014d6b8ffb798e7a5f4d | [] | no_license | singularlogic/cloudteams | 4fe988d4ec2f740b04584b5af71222f0d053da52 | 992a40d2ad66f8747ecd7cf7f14163c3dea31d6a | refs/heads/master | 2021-01-20T09:03:57.887104 | 2017-05-10T09:07:10 | 2017-05-10T09:07:10 | 49,866,777 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package eu.cloudteams.repository.dao;
import eu.cloudteams.repository.domain.BitbucketUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author Christos Paraskeva <ch.paraskeva at gmail dot com>
*/
public interface UserRepository extends JpaRepository<BitbucketUser, Long> {
//Define CRUD operations
/**
*
* @param username
* @return
*/
public BitbucketUser findByUsername(String username);
@Transactional
@Modifying
@Query("update BitbucketUser u set u.isSynch=?1 where u.id=?2")
public int setSynchStatus(boolean isSynch, long uid);
}
| [
"gledakis.ubitech.eu"
] | gledakis.ubitech.eu |
0a35c13abc6714ddae3dca926d3993ecf6b8486f | b0194dfd3d8d9d5364ba33aec4bc5f2fb2cc6df7 | /test/com/twu/biblioteca/BibliotecaAppTest.java | f656af1969c55d768689e084af82acb025ead973 | [
"Apache-2.0"
] | permissive | yaoping/TWU_Biblioteca_master | 91ba507550db8b8f0fffbd26a10e7f61b483af54 | a82cc037a5231b44b843524a0053824e585f5d7f | refs/heads/master | 2021-01-01T08:56:46.939509 | 2015-09-19T15:24:50 | 2015-09-19T15:24:50 | 42,526,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.twu.biblioteca;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class BibliotecaAppTest {
@Test
public void should_show_welcome_message() {
assertThat(BibliotecaApp.sendWelcomeMessage(), is("Welcome"));
}
} | [
"ppyao@thoughtworks.com"
] | ppyao@thoughtworks.com |
fdb1922e9d005e3aa4eea5acc5127138855ac530 | c77e5d16bc2e26de5884ef14baa2fb7e30312d40 | /src/main/java/yuri/misyac/productmanager/entity/Document.java | 406b17061d46f8ab8dc2e10f8486af2957024665 | [] | no_license | andrewMistetskii/Productmanager | bbcbd92c6d78d4c2a00f11f343474e18487dddfe | 5c57bc2eaed06cb471bf8cf6955ec102bb7ebf95 | refs/heads/master | 2021-01-22T00:06:28.076652 | 2015-01-21T09:08:18 | 2015-01-21T09:08:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | package yuri.misyac.productmanager.entity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "DOCUMENT")
public class Document {
@Id
@GeneratedValue
@Column(name = "DOCUMENT_ID")
private Integer id;
@Column(name = "CREATE_DATE")
private Date createDate;
@Column(name = "operation")
private String operationType;
@Column(name = "amount")
private Integer amount;
@Column(name = "product")
private Integer productId;
@Column(name = "description")
private String description;
@ManyToOne(optional = false)
@JoinColumn(name = "product", insertable = false, updatable = false)
private Product manyToOneProductId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public Integer getAmount() {
return amount;
}
public void setAmount(Integer amount) {
this.amount = amount;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Product getManyToOneProductId() {
return manyToOneProductId;
}
public void setManyToOneProductId(Product manyToOneProductId) {
this.manyToOneProductId = manyToOneProductId;
}
}
| [
"justokayyy@gmail.com"
] | justokayyy@gmail.com |
8a135797aea3b4d5139ce9f86c327cece96f09e3 | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Core/System.IO.FileSystem,Version=4.1.2.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a/system/io/EnumerationOptions.java | c7a4fa951d7ebc769f30800235f60e79b281afe6 | [
"MIT"
] | permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,853 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.io;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.io.FileAttributes;
import system.io.MatchCasing;
import system.io.MatchType;
/**
* The base .NET class managing System.IO.EnumerationOptions, System.IO.FileSystem, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.IO.EnumerationOptions" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.IO.EnumerationOptions</a>
*/
public class EnumerationOptions extends NetObject {
/**
* Fully assembly qualified name: System.IO.FileSystem, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
*/
public static final String assemblyFullName = "System.IO.FileSystem, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
/**
* Assembly name: System.IO.FileSystem
*/
public static final String assemblyShortName = "System.IO.FileSystem";
/**
* Qualified class name: System.IO.EnumerationOptions
*/
public static final String className = "System.IO.EnumerationOptions";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public EnumerationOptions(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link EnumerationOptions}, a cast assert is made to check if types are compatible.
*/
public static EnumerationOptions cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new EnumerationOptions(from.getJCOInstance());
}
// Constructors section
public EnumerationOptions() throws Throwable {
try {
// add reference to assemblyName.dll file
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Methods section
// Properties section
public boolean getIgnoreInaccessible() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("IgnoreInaccessible");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setIgnoreInaccessible(boolean IgnoreInaccessible) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("IgnoreInaccessible", IgnoreInaccessible);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getRecurseSubdirectories() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("RecurseSubdirectories");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setRecurseSubdirectories(boolean RecurseSubdirectories) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("RecurseSubdirectories", RecurseSubdirectories);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getReturnSpecialDirectories() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("ReturnSpecialDirectories");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setReturnSpecialDirectories(boolean ReturnSpecialDirectories) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("ReturnSpecialDirectories", ReturnSpecialDirectories);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getBufferSize() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("BufferSize");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setBufferSize(int BufferSize) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("BufferSize", BufferSize);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public FileAttributes getAttributesToSkip() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("AttributesToSkip");
return new FileAttributes(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setAttributesToSkip(FileAttributes AttributesToSkip) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("AttributesToSkip", AttributesToSkip == null ? null : AttributesToSkip.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MatchCasing getMatchCasing() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("MatchCasing");
return new MatchCasing(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setMatchCasing(MatchCasing MatchCasing) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("MatchCasing", MatchCasing == null ? null : MatchCasing.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public MatchType getMatchType() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("MatchType");
return new MatchType(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void setMatchType(MatchType MatchType) throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Set("MatchType", MatchType == null ? null : MatchType.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
} | [
"mario.mastrodicasa@masesgroup.com"
] | mario.mastrodicasa@masesgroup.com |
913762d16a9f6872f6997899c133a86dca2f7582 | d8dc5bec2d567ba0c97b2813bfb38366d7927377 | /Magacin/src/gui/forms/TipObjektaForma.java | 5d2eb10a52c447aa55e15c812d8e7b99d100f27b | [] | no_license | sljuka/diplomski-rad-magacin | 258d052cb90f0424d61eaa2d69287cf0496d86f7 | 050990d9ae935f9546c366a1d76bac58306cbccd | refs/heads/master | 2021-01-18T06:47:01.877571 | 2016-09-13T20:35:06 | 2016-09-13T20:35:06 | 13,813,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package gui.forms;
import gui.DocumentLimit;
import gui.Input;
import gui.TextInput;
import model.DataBaseTableModel.tableNames;
import controllers.FormController;
public class TipObjektaForma extends DatabaseForma {
private TextInput tfsifraTipa;
private TextInput tfnazivTipa;
public TipObjektaForma(FormController fc) {
// TODO Auto-generated constructor stub
super(fc, tableNames.TIP_OBJEKTA, 700, 400, false);
}
@Override
protected void sync() {
// TODO Auto-generated method stub
super.sync();
childRetVals[0] = tfsifraTipa.getText();
}
@Override
protected void initializeInputFields(FormController controller) {
inputsArray = new Input[] {
tfsifraTipa = new TextInput(14, "Sifra tipa", new DocumentLimit(14)),
tfnazivTipa = new TextInput(14, "Naziv tipa", null)
};
}
@Override
public void populateInputsAndRequiredArray() {
requiredFields = new int[2];
for(int i = 0; i<inputsArray.length; i++) //every field required
requiredFields[i] = i;
}
@Override
public void populatePrimaryInputsArray() {
primaryKeysColumnNumber = new int[1];
primaryKeysColumnNumber[0] = 0;
}
@Override
public void childResponse(tableNames iD2, String[] childRetVals) {
// TODO Auto-generated method stub
// NO CHILDREN, SMRC
}
}
| [
"uraniumsheep@gmail.com"
] | uraniumsheep@gmail.com |
aa6d9388c5d6d3e39706817978b70e6cb60ba86d | 84c167b833f4e29cb705e67a9979e101351b24dd | /src/test/java/omq/test/multiProcess/NumberClient.java | a5a78b73a31d8d669d76a21da85c1636d8fb7dc8 | [] | no_license | cloudspaces/objectmq | 638283db2633fc51acd36e8afd9c139cbaa3df70 | 3eff11618202c5ccb9f5348b938d31e08c3e2d2c | refs/heads/master | 2016-09-06T10:36:07.701411 | 2014-05-28T11:03:36 | 2014-05-28T11:03:36 | 9,815,843 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | package omq.test.multiProcess;
import omq.Remote;
import omq.client.annotation.AsyncMethod;
import omq.client.annotation.MultiMethod;
import omq.client.annotation.RemoteInterface;
import omq.client.annotation.SyncMethod;
/**
*
* @author Sergi Toda <sergi.toda@estudiants.urv.cat>
*
*/
@RemoteInterface
public interface NumberClient extends Remote {
@SyncMethod(timeout = 1000)
public void setNumber(int x);
@SyncMethod(timeout = 1000)
public int getNumber();
@MultiMethod
@AsyncMethod
public void setMultiNumber(int x);
@MultiMethod(waitNum = 2)
@SyncMethod(timeout = 1000)
public int[] getMultiNumber();
}
| [
"sergi@toda"
] | sergi@toda |
1b7c7adcf5ffb2b42a477ad472d9c24318774f49 | 59cace888ff0073cba7f8cedea74ddd230e442e9 | /src/avro/java/gpudb/unique_response.java | db5d87eb721d477d988c7919793bd5d477f1b889 | [] | no_license | sungsoo/gpudb-api-java | 89b0278b4bb632cd6c60efa41083d86d113f9aea | 1b05557fcc43d8a87ae24c413182cda7ecb09bfd | refs/heads/master | 2020-12-24T23:39:52.776379 | 2015-01-29T03:09:20 | 2015-01-29T03:09:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,431 | java | /**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package avro.java.gpudb;
@SuppressWarnings("all")
public class unique_response extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"unique_response\",\"namespace\":\"avro.java.gpudb\",\"fields\":[{\"name\":\"set_id\",\"type\":\"string\"},{\"name\":\"attribute\",\"type\":\"string\"},{\"name\":\"values\",\"type\":{\"type\":\"array\",\"items\":\"double\"}},{\"name\":\"values_str\",\"type\":{\"type\":\"array\",\"items\":\"string\"}},{\"name\":\"is_string\",\"type\":\"boolean\"}]}");
@Deprecated public java.lang.CharSequence set_id;
@Deprecated public java.lang.CharSequence attribute;
@Deprecated public java.util.List<java.lang.Double> values;
@Deprecated public java.util.List<java.lang.CharSequence> values_str;
@Deprecated public boolean is_string;
/**
* Default constructor.
*/
public unique_response() {}
/**
* All-args constructor.
*/
public unique_response(java.lang.CharSequence set_id, java.lang.CharSequence attribute, java.util.List<java.lang.Double> values, java.util.List<java.lang.CharSequence> values_str, java.lang.Boolean is_string) {
this.set_id = set_id;
this.attribute = attribute;
this.values = values;
this.values_str = values_str;
this.is_string = is_string;
}
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return set_id;
case 1: return attribute;
case 2: return values;
case 3: return values_str;
case 4: return is_string;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
// Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
case 0: set_id = (java.lang.CharSequence)value$; break;
case 1: attribute = (java.lang.CharSequence)value$; break;
case 2: values = (java.util.List<java.lang.Double>)value$; break;
case 3: values_str = (java.util.List<java.lang.CharSequence>)value$; break;
case 4: is_string = (java.lang.Boolean)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'set_id' field.
*/
public java.lang.CharSequence getSetId() {
return set_id;
}
/**
* Sets the value of the 'set_id' field.
* @param value the value to set.
*/
public void setSetId(java.lang.CharSequence value) {
this.set_id = value;
}
/**
* Gets the value of the 'attribute' field.
*/
public java.lang.CharSequence getAttribute() {
return attribute;
}
/**
* Sets the value of the 'attribute' field.
* @param value the value to set.
*/
public void setAttribute(java.lang.CharSequence value) {
this.attribute = value;
}
/**
* Gets the value of the 'values' field.
*/
public java.util.List<java.lang.Double> getValues() {
return values;
}
/**
* Sets the value of the 'values' field.
* @param value the value to set.
*/
public void setValues(java.util.List<java.lang.Double> value) {
this.values = value;
}
/**
* Gets the value of the 'values_str' field.
*/
public java.util.List<java.lang.CharSequence> getValuesStr() {
return values_str;
}
/**
* Sets the value of the 'values_str' field.
* @param value the value to set.
*/
public void setValuesStr(java.util.List<java.lang.CharSequence> value) {
this.values_str = value;
}
/**
* Gets the value of the 'is_string' field.
*/
public java.lang.Boolean getIsString() {
return is_string;
}
/**
* Sets the value of the 'is_string' field.
* @param value the value to set.
*/
public void setIsString(java.lang.Boolean value) {
this.is_string = value;
}
/** Creates a new unique_response RecordBuilder */
public static avro.java.gpudb.unique_response.Builder newBuilder() {
return new avro.java.gpudb.unique_response.Builder();
}
/** Creates a new unique_response RecordBuilder by copying an existing Builder */
public static avro.java.gpudb.unique_response.Builder newBuilder(avro.java.gpudb.unique_response.Builder other) {
return new avro.java.gpudb.unique_response.Builder(other);
}
/** Creates a new unique_response RecordBuilder by copying an existing unique_response instance */
public static avro.java.gpudb.unique_response.Builder newBuilder(avro.java.gpudb.unique_response other) {
return new avro.java.gpudb.unique_response.Builder(other);
}
/**
* RecordBuilder for unique_response instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<unique_response>
implements org.apache.avro.data.RecordBuilder<unique_response> {
private java.lang.CharSequence set_id;
private java.lang.CharSequence attribute;
private java.util.List<java.lang.Double> values;
private java.util.List<java.lang.CharSequence> values_str;
private boolean is_string;
/** Creates a new Builder */
private Builder() {
super(avro.java.gpudb.unique_response.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(avro.java.gpudb.unique_response.Builder other) {
super(other);
}
/** Creates a Builder by copying an existing unique_response instance */
private Builder(avro.java.gpudb.unique_response other) {
super(avro.java.gpudb.unique_response.SCHEMA$);
if (isValidValue(fields()[0], other.set_id)) {
this.set_id = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.set_id);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.attribute)) {
this.attribute = (java.lang.CharSequence) data().deepCopy(fields()[1].schema(), other.attribute);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.values)) {
this.values = (java.util.List<java.lang.Double>) data().deepCopy(fields()[2].schema(), other.values);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.values_str)) {
this.values_str = (java.util.List<java.lang.CharSequence>) data().deepCopy(fields()[3].schema(), other.values_str);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.is_string)) {
this.is_string = (java.lang.Boolean) data().deepCopy(fields()[4].schema(), other.is_string);
fieldSetFlags()[4] = true;
}
}
/** Gets the value of the 'set_id' field */
public java.lang.CharSequence getSetId() {
return set_id;
}
/** Sets the value of the 'set_id' field */
public avro.java.gpudb.unique_response.Builder setSetId(java.lang.CharSequence value) {
validate(fields()[0], value);
this.set_id = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'set_id' field has been set */
public boolean hasSetId() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'set_id' field */
public avro.java.gpudb.unique_response.Builder clearSetId() {
set_id = null;
fieldSetFlags()[0] = false;
return this;
}
/** Gets the value of the 'attribute' field */
public java.lang.CharSequence getAttribute() {
return attribute;
}
/** Sets the value of the 'attribute' field */
public avro.java.gpudb.unique_response.Builder setAttribute(java.lang.CharSequence value) {
validate(fields()[1], value);
this.attribute = value;
fieldSetFlags()[1] = true;
return this;
}
/** Checks whether the 'attribute' field has been set */
public boolean hasAttribute() {
return fieldSetFlags()[1];
}
/** Clears the value of the 'attribute' field */
public avro.java.gpudb.unique_response.Builder clearAttribute() {
attribute = null;
fieldSetFlags()[1] = false;
return this;
}
/** Gets the value of the 'values' field */
public java.util.List<java.lang.Double> getValues() {
return values;
}
/** Sets the value of the 'values' field */
public avro.java.gpudb.unique_response.Builder setValues(java.util.List<java.lang.Double> value) {
validate(fields()[2], value);
this.values = value;
fieldSetFlags()[2] = true;
return this;
}
/** Checks whether the 'values' field has been set */
public boolean hasValues() {
return fieldSetFlags()[2];
}
/** Clears the value of the 'values' field */
public avro.java.gpudb.unique_response.Builder clearValues() {
values = null;
fieldSetFlags()[2] = false;
return this;
}
/** Gets the value of the 'values_str' field */
public java.util.List<java.lang.CharSequence> getValuesStr() {
return values_str;
}
/** Sets the value of the 'values_str' field */
public avro.java.gpudb.unique_response.Builder setValuesStr(java.util.List<java.lang.CharSequence> value) {
validate(fields()[3], value);
this.values_str = value;
fieldSetFlags()[3] = true;
return this;
}
/** Checks whether the 'values_str' field has been set */
public boolean hasValuesStr() {
return fieldSetFlags()[3];
}
/** Clears the value of the 'values_str' field */
public avro.java.gpudb.unique_response.Builder clearValuesStr() {
values_str = null;
fieldSetFlags()[3] = false;
return this;
}
/** Gets the value of the 'is_string' field */
public java.lang.Boolean getIsString() {
return is_string;
}
/** Sets the value of the 'is_string' field */
public avro.java.gpudb.unique_response.Builder setIsString(boolean value) {
validate(fields()[4], value);
this.is_string = value;
fieldSetFlags()[4] = true;
return this;
}
/** Checks whether the 'is_string' field has been set */
public boolean hasIsString() {
return fieldSetFlags()[4];
}
/** Clears the value of the 'is_string' field */
public avro.java.gpudb.unique_response.Builder clearIsString() {
fieldSetFlags()[4] = false;
return this;
}
@Override
public unique_response build() {
try {
unique_response record = new unique_response();
record.set_id = fieldSetFlags()[0] ? this.set_id : (java.lang.CharSequence) defaultValue(fields()[0]);
record.attribute = fieldSetFlags()[1] ? this.attribute : (java.lang.CharSequence) defaultValue(fields()[1]);
record.values = fieldSetFlags()[2] ? this.values : (java.util.List<java.lang.Double>) defaultValue(fields()[2]);
record.values_str = fieldSetFlags()[3] ? this.values_str : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[3]);
record.is_string = fieldSetFlags()[4] ? this.is_string : (java.lang.Boolean) defaultValue(fields()[4]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}
| [
"sbardhan@gisfederal.com"
] | sbardhan@gisfederal.com |
6f2991202ec17262d20662ca0f2fe9457d937339 | ac592e6431b66f34f3219656176d52c22a0e41cc | /network_monitoring_sd/src/main/java/com/gw/wechat/data/MaintenanceDealInData.java | 40468f33d94275934063340d08e0d2b33bb5bb2a | [] | no_license | leijie-git/project | a19b7beab3982912ea45ae3eecc18953b59c5642 | dcac5819341c5712efb8201c61dfc3629d7f9a3b | refs/heads/master | 2022-07-10T23:19:36.331798 | 2019-10-17T02:58:38 | 2019-10-17T02:58:38 | 215,679,145 | 1 | 0 | null | 2022-06-29T17:43:00 | 2019-10-17T01:43:31 | JavaScript | UTF-8 | Java | false | false | 788 | java | package com.gw.wechat.data;
import lombok.Data;
/**
* 维保整改巡查
* @author zfg
*
**/
@Data
public class MaintenanceDealInData {
private String id;
private String dealtype;
private String dealdate;
private String RepairCode;
private String dealinfo;//维修描述
private String userId;//当前处理人
private String operateinfo;//问题描述
private String operatetime;
private String operateusername;
private String repairid;//token
private String dealuserid;
private String operateuserid;
private String picurl;//问题描述
private String picpath; //现场照片
private String longitude; //经度
private String latitude; //纬度
private String location;//位置信息
}
| [
"574335745@qq.com"
] | 574335745@qq.com |
729446fe7231bcd2e9855511ce78ce5e8ac7df8a | 0884a671a52128016bc45b34d4568c42139516f6 | /src/main/java/com/xassure/framework/model/PageLocator.java | 1ac98022d388d59800d51005bd6db2986e06672d | [] | no_license | bilal89hayat/SpringBatchExamples | 57a39870006a956835ebd7733bf4a3a1805bfd88 | 470ddc6b9a9194b14d2e3e7757bb9adffe30df6f | refs/heads/master | 2021-02-05T07:12:00.628289 | 2020-03-03T05:20:11 | 2020-03-03T05:20:11 | 243,755,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.xassure.framework.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode
public class PageLocator {
private String runId;
private String pageName;
private String elementName;
private String locatorTime;
private String date;
private String time;
}
| [
"bhayat@xebia.com"
] | bhayat@xebia.com |
d0cbb648e3824e8d0dd62a1b614dc3e8d7e6091b | 7ec39fe819789da6c2b10f1940b0c9b37ceb4985 | /restservice/src/main/java/fr/project/restservice/services/module/ChatMessageService.java | 261ae54d19548792eba9f4d70ed74d27328bee21 | [] | no_license | BourgeoisThibault/personal_project | 9f84dc1e20c91016cd647d2d2bdb68eef662a72f | 96898a9de4aafacca83aa1dcc33c36e784328259 | refs/heads/master | 2020-03-18T12:26:57.947004 | 2018-05-24T14:06:43 | 2018-05-24T14:06:43 | 134,726,943 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package fr.project.restservice.services.module;
import fr.project.restservice.repositories.module.ChatMessageRepo;
import fr.project.utils.entities.module.ChatMessage;
import fr.project.utils.entities.module.ChatRoom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author BOURGEOIS Thibault
* Date 13/05/2018
* Time 19:57
*/
@Service
public class ChatMessageService {
/*
@Autowired
private ChatMessageRepo chatMessageRepo;
public List<ChatMessage> getMessageByRoom(ChatRoom chatRoom){
return (List<ChatMessage>)chatMessageRepo.findAllByChatRoomOrderByDateSend(chatRoom);
}
*/
}
| [
"thibault.bourgeois@etu.u-pec.fr"
] | thibault.bourgeois@etu.u-pec.fr |
87dc7f78c630082b81051b6ecc1b69da6fd3d00d | 2b8fe620e9aa72161b47f8e4d47d0e922e0081da | /mobilepayment/src/main/java/com/szxb/tangren/mobilepayment/view/activity/MainSweepActivity.java | ea1d100502220c5aa686e716ea9ef332f34209ff | [] | no_license | wuxinxi/SzxiaobingPayment | 4b792a7f212d823b566cd05fca97b4ac93f06f80 | 395239bb603a11f6e2841af3932582f07a0c9d1e | refs/heads/master | 2021-01-24T08:35:41.631910 | 2016-10-08T06:01:33 | 2016-10-08T06:01:33 | 69,547,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,932 | java | package com.szxb.tangren.mobilepayment.view.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.zxing.WriterException;
import com.szxb.tangren.mobilepayment.R;
import com.szxb.tangren.mobilepayment.application.CustiomApplication;
import com.szxb.tangren.mobilepayment.presenter.MainSweepCompl;
import com.szxb.tangren.mobilepayment.presenter.MainSweepPresenter;
import com.szxb.tangren.mobilepayment.presenter.PaymentCompl;
import com.szxb.tangren.mobilepayment.presenter.PaymentPresenter;
import com.szxb.tangren.mobilepayment.utils.Config;
import com.szxb.tangren.mobilepayment.utils.Utils;
import com.szxb.tangren.mobilepayment.utils.singutils.XMlUtils;
import com.szxb.tangren.mobilepayment.view.view.MainSweepView;
import com.szxb.tangren.mobilepayment.view.view.PaymentView;
import com.yolanda.nohttp.Logger;
import java.util.Map;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
/**
* Created by Administrator on 2016/9/24 0024.
*/
public class MainSweepActivity extends AppCompatActivity implements MainSweepView, PaymentView {
@InjectView(R.id.mtoolbar)
Toolbar mtoolbar;
@InjectView(R.id.qrcode)
ImageView qrcode;
@InjectView(R.id.linear_qrcode)
LinearLayout linearQrcode;
@InjectView(R.id.swept)
Button swept;
@InjectView(R.id.checkOrder)
Button checkOrder;
private String payType;//支付方式
private String payAnount;//支付金额
private String out_trade_no;
private MainSweepPresenter presenter;
private PaymentPresenter paymentPresenter;
private String service;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainsweep_main);
ButterKnife.inject(this);
initView();
}
private void initView() {
mtoolbar.setTitle("");
setSupportActionBar(mtoolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
WindowManager manager = this.getWindowManager();
DisplayMetrics metrics = new DisplayMetrics();
manager.getDefaultDisplay().getMetrics(metrics);
//屏幕宽度
int width = metrics.widthPixels;
//布局宽度2/width
int layout = (int) (width * 0.7);
ViewGroup.LayoutParams lp = linearQrcode.getLayoutParams();
lp.height = layout;
lp.width = layout;
linearQrcode.setLayoutParams(lp);
out_trade_no = Utils.OrderNo();
presenter = new MainSweepCompl(this);
paymentPresenter = new PaymentCompl(this);
payType = getIntent().getStringExtra("payType");
payAnount = getIntent().getStringExtra("payAnount");
mtoolbar.setTitle(payType);
if (payType.equals("微信"))
service = Config.wechatService;
else if (payType.equals("支付宝"))
service = Config.aliService;
else if (payType.equals("QQ"))
service = Config.tenService;
Logger.e("Thrad count:" + Thread.activeCount());
presenter.doMainSweepPay(this, payAnount, out_trade_no, "商品", service);
}
@OnClick({R.id.swept, R.id.checkOrder})
public void onClick(View view) {
switch (view.getId()) {
case R.id.swept:
Intent intent = new Intent(MainSweepActivity.this, PaymentActivity.class);
intent.putExtra("payType", payType);
intent.putExtra("amoumt", payAnount);
startActivity(intent);
finish();
overridePendingTransition(R.anim.base_slide_remain, R.anim.base_slide_right_in);
break;
case R.id.checkOrder:
paymentPresenter.doSweptCheckOrder(this, out_trade_no);
break;
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
overridePendingTransition(0, R.anim.base_slide_right_out);
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(0, R.anim.base_slide_right_out);
}
@Override
protected void onStart() {
super.onStart();
CustiomApplication application = (CustiomApplication) getApplication();
application.setIsshowDown(0);
}
@Override
public void onUrlCode(String url_code) {
Bitmap bitmap = null;
try {
bitmap = Utils.CreateCode(url_code);
} catch (WriterException e) {
e.printStackTrace();
}
qrcode.setImageBitmap(bitmap);
}
@Override
public void onResult(int code, String result) {
if (code == 100) {
Map<String, String> xml = XMlUtils.decodeXml(result);
String payType = xml.get("payType");
String cashier = xml.get("cashier");
String out_trade_no = xml.get("out_trade_no");
String time_end = xml.get("time_end");
String transaction_id = xml.get("transaction_id");
Intent intent = new Intent(MainSweepActivity.this, PayResultActivity.class);
intent.putExtra("payType", payType);
intent.putExtra("cashier", cashier);
intent.putExtra("out_trade_no", out_trade_no);
intent.putExtra("time_end", time_end);
intent.putExtra("transaction_id", transaction_id);
startActivity(intent);
finish();
overridePendingTransition(R.anim.base_slide_right_in, R.anim.base_slide_remain);
} else if (code == 200) {
Toast.makeText(MainSweepActivity.this, result, Toast.LENGTH_LONG).show();
} else if (code == 300) {
Toast.makeText(MainSweepActivity.this, result, Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MainSweepActivity.this, result, Toast.LENGTH_LONG).show();
finish();
overridePendingTransition(0, R.anim.base_slide_right_out);
}
}
@Override
public void onCheckOrder(int code, String result) {
}
@Override
protected void onStop() {
super.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
CustiomApplication application = (CustiomApplication) getApplication();
application.setIsshowDown(1);
}
}
| [
"wu_tangren@163.com"
] | wu_tangren@163.com |
c7bf471159ac40ddd932e6f3465c2d699da9ec48 | 20567be286ca9f3a053cf64238eefb724239e138 | /PruebaT1/src/application/MainRocket.java | 2efa8b045e245458593fe9d5c3093f894953e853 | [] | no_license | Jmrx24/PruebaT1-Javier-Mu-oz-Rojas | 17f5b828238156d88f2e9ebf4e15a62ae52edb41 | e71b2ceee113fe4ca70461eff4db4e295d94f369 | refs/heads/master | 2020-09-30T22:36:17.062921 | 2019-12-11T17:16:37 | 2019-12-11T17:16:37 | 227,389,917 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,487 | java | package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Font;
/**
* Aplicación hecha con JavaFX y SceneBuilder que consiste en la creación de dos pantallas
* ,la primera tiene un Log-in y que al pulsar al botón te lleva a otra pantalla
* ,la cual, tiene un botón para cerrar la aplicación.
* @author Javier Muñoz
* @see ControlRocket
*
*
*/
public class MainRocket extends Application {
@Override
public void start(Stage primaryStage) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/application/view/Mars.fxml"));
//BorderPane root = new BorderPane();
AnchorPane root = (AnchorPane)loader.load();
Scene scene = new Scene(root,700,600);
//scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setTitle("Let me in");
scene.getStylesheets().add(
"https://fonts.googleapis.com/css?family=Poiret%20One");
Font.loadFont(
getClass().getResourceAsStream(
"/application/view/assets/PioretOne-Regular.ttf"), 20);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
| [
"Jmrx24@gmail.com"
] | Jmrx24@gmail.com |
fff04daa21f41d7ec2ad1a70ffc367545cc4eae0 | 7b73756ba240202ea92f8f0c5c51c8343c0efa5f | /classes2/wxw.java | 8bf05d324a2a7b7ebae0f237ac557e022e6e772e | [] | no_license | meeidol-luo/qooq | 588a4ca6d8ad579b28dec66ec8084399fb0991ef | e723920ac555e99d5325b1d4024552383713c28d | refs/heads/master | 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,401 | java | import com.tencent.mobileqq.hotpatch.NotVerifyClass;
import com.tencent.open.base.LogUtility;
import com.tencent.open.downloadnew.DownloadInfo;
import com.tencent.open.downloadnew.DownloadQueryListener;
import com.tencent.open.export.js.VipDownloadInterface;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class wxw
implements DownloadQueryListener
{
public wxw(VipDownloadInterface paramVipDownloadInterface)
{
boolean bool = NotVerifyClass.DO_VERIFY_CLASS;
}
public void a(int paramInt, String paramString)
{
LogUtility.e(this.a.b, "getQueryDownloadAction onException code = " + paramInt + " msg= ");
JSONObject localJSONObject = new JSONObject();
try
{
localJSONObject.put("errCode", paramInt);
localJSONObject.put("errMsg", paramString);
paramString = "javascript:publicAccountDownload.queryProcess(" + localJSONObject.toString() + ")";
this.a.a(paramString);
return;
}
catch (JSONException paramString)
{
for (;;)
{
paramString.printStackTrace();
}
}
}
public void b(List paramList)
{
LogUtility.a(this.a.b, "getQueryDownloadAction onResult = " + paramList.size());
JSONArray localJSONArray = new JSONArray();
int j = paramList.size();
int i = 0;
for (;;)
{
if (i < j)
{
JSONObject localJSONObject = new JSONObject();
DownloadInfo localDownloadInfo = (DownloadInfo)paramList.get(i);
try
{
localJSONObject.put("appid", localDownloadInfo.b);
localJSONObject.put("pro", localDownloadInfo.l);
localJSONObject.put("state", localDownloadInfo.a());
localJSONObject.put("ismyapp", localDownloadInfo.h);
localJSONArray.put(localJSONObject);
i += 1;
}
catch (JSONException localJSONException)
{
for (;;)
{
localJSONException.printStackTrace();
}
}
}
}
paramList = "javascript:publicAccountDownload.queryProcess(" + localJSONArray.toString() + ")";
LogUtility.a(this.a.b, "getQueryDownloadAction callback url = " + paramList);
this.a.a(paramList);
}
}
/* Location: E:\apk\QQ_91\classes2-dex2jar.jar!\wxw.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1776098770@qq.com"
] | 1776098770@qq.com |
b8c9caabee11f41a6fbb4602cb04ca0a8d44c1d0 | 763af4d1c341f96ce1c13978da1ff0d24b30c0b6 | /src/com/mfw/controller/bdata/KpiCategoryFilesController.java | 81063616a28c812380e49cf68a52b251d0168b9d | [] | no_license | cctecoo/STL_0730 | 9e6ad5c6d7dee24bded06e3162aaeda7cbc16f67 | 6ca35c9f89064fe362753945fd98ab9374767b5c | refs/heads/master | 2020-06-26T09:09:09.210583 | 2019-07-30T06:45:33 | 2019-07-30T06:45:33 | 199,591,524 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,782 | java | package com.mfw.controller.bdata;
import java.io.PrintWriter;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.mfw.controller.base.BaseController;
import com.mfw.entity.Page;
import com.mfw.service.bdata.KpiCategoryFilesService;
import com.mfw.util.PageData;
/**
* 基础数据-通用基础数据-KPI指标分类
* @author 作者 蒋世平
* @date 创建时间:2015年12月16日 下午17:02:31
*/
@Controller
@RequestMapping(value = "/kpiCategoryFiles")
public class KpiCategoryFilesController extends BaseController {
@Resource(name = "kpiCategoryService")
private KpiCategoryFilesService kpiCategoryService;
/**
* 列表
*/
@RequestMapping(value = "/list")
public ModelAndView list(Page page) {
logBefore(logger, "bd_kpi_category_files列表");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = this.getPageData();
PageData pdName = new PageData();
page.setPd(pd);
List<PageData> varList = kpiCategoryService.listAll(pd); //列出category列表
pd = kpiCategoryService.findById(pd); //根据ID读取
pdName = kpiCategoryService.findByParentIdName(pd);
if(null != pdName){
String parentName = pdName.getString("NAME");
pd.put("parentName", parentName);
}
mv.setViewName("bdata/kpi/kpiCategoryFiles_list");
mv.addObject("varList", varList);
mv.addObject("msg", "edit");
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* 新增页面跳转
*/
@RequestMapping(value = "/goAdd")
public ModelAndView goAdd() throws Exception {
logBefore(logger, "bd_kpi_category_files表新增页面跳转");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
pd = this.getPageData();
mv.setViewName("bdata/kpi/kpiCategoryFiles_edit");
mv.addObject("msg", "save");
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* 新增次级页面跳转
*/
@RequestMapping(value = "/goAddSec")
public ModelAndView goAddSec() throws Exception {
logBefore(logger, "bd_kpi_category_files表新增次级页面跳转");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
PageData pdName = new PageData();
pd = this.getPageData();
pdName = kpiCategoryService.findByIdName(pd);
String parentName = pdName.getString("NAME");
pd.put("parentName", parentName);
mv.setViewName("bdata/kpi/kpiCategoryFiles_addSec");
mv.addObject("msg", "saveSec");
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* KPI类别新增验证
*/
@RequestMapping(value = "/checkKpiCategory")
public void checkKpiCategory(String kpiCode, PrintWriter out){
try{
PageData pd = new PageData();
pd.put("CODE", kpiCode);
logBefore(logger, "KPI类别新增验证");
PageData kpiCategoryData = kpiCategoryService.findByCode(pd);
//判断用户所填code是否重复
if(null == kpiCategoryData){
out.write("true");
}else{
out.write("false");
}
} catch(Exception e){
logger.error(e.toString(), e);
} finally{
out.flush();
out.close();
}
}
/**
* 新增
*/
@RequestMapping(value = "/save")
public ModelAndView save() throws Exception {
logBefore(logger, "bd_kpi_category_files表新增");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
pd = this.getPageData();
kpiCategoryService.save(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* 新增次级
*/
@RequestMapping(value = "/saveSec")
public ModelAndView saveSec() throws Exception {
logBefore(logger, "bd_kpi_category_files表新增次级");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
pd = this.getPageData();
kpiCategoryService.saveSec(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* 删除
*/
@RequestMapping(value = "/delete")
public void delete(PrintWriter out) {
logBefore(logger, "bd_kpi_category_files表删除");
PageData pd = new PageData();
try {
pd = this.getPageData();
kpiCategoryService.delete(pd);
out.write("success");
} catch (Exception e) {
logger.error(e.toString(), e);
} finally{
out.flush();
out.close();
}
}
/**
* 修改页面跳转
*/
@RequestMapping(value = "/goEdit")
public ModelAndView goEdit() {
logBefore(logger, "bd_kpi_category_files表修改页面跳转");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
pd = this.getPageData();
pd = kpiCategoryService.findById(pd); //根据ID读取
mv.setViewName("bdata/kpi/kpiCategoryFiles_edit");
mv.addObject("msg", "edit");
mv.addObject("pd", pd);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
/**
* 修改
*/
@RequestMapping(value = "/edit")
public ModelAndView edit() throws Exception {
logBefore(logger, "修改表 bd_kpi_category_files");
ModelAndView mv = this.getModelAndView();
try {
PageData pd = new PageData();
pd = this.getPageData();
kpiCategoryService.edit(pd); //执行修改数据库
mv.addObject("msg","success");
mv.setViewName("save_result");
} catch (Exception e) {
logger.error(e.toString(), e);
}
return mv;
}
}
| [
"cctecoo@qq.com"
] | cctecoo@qq.com |
d7f189a9b1450e3daa9ae437326f3967624aa8ca | 15bf601c5e6442c50f503f065103f938cec9d3bc | /src/main/java/com/binbin/tools/RandomApp.java | 7fba103d621656d775b11c80d73b25188d069f58 | [] | no_license | binbinLeader/binbin-tools | 48908f9a403f153a36eb541526ec003528c972fc | 76c29c62243bfad304307bbcee1427003e946169 | refs/heads/master | 2022-06-24T14:29:33.515996 | 2020-06-05T09:50:16 | 2020-06-05T09:50:16 | 233,491,775 | 0 | 0 | null | 2022-06-21T02:37:49 | 2020-01-13T02:05:48 | Java | UTF-8 | Java | false | false | 367 | java | package com.binbin.tools;
import java.util.Random;
public class RandomApp {
public static void main(String[] args) {
Random random = new Random();
for (int rowNum = 1; rowNum <= 10000; rowNum++) {
int i = random.nextInt(100-50) + 50;
if (i == 99) {
System.out.println(i);
}
}
}
}
| [
"542732170@qq.com"
] | 542732170@qq.com |
ac6cb7252558df8cbdfb92ddf1c8e54aa09b8b0e | 9372d58ae7c6568153bb07df5d599dd026f6c9e6 | /rest-test/src/main/java/com/rest/client/RestClientDemo.java | f9ddde3e7d57f2353f1bdd97c3f8d3047f3644ab | [] | no_license | GitGuruputra/testexample | 24da00c2a3738a26f5f07d1caa226f6c9d9c146e | 54af4c6c94954dc389d8e7392790458f9296bf76 | refs/heads/master | 2020-03-29T16:11:08.199950 | 2018-09-24T13:12:52 | 2018-09-24T13:12:52 | 150,102,122 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package com.rest.client;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
public class RestClientDemo {
public static void main(String[] args){
try{
String url = "http://localhost:8080/rest/rservice/accout";
HttpClient client = new HttpClient();
GetMethod mPost = new GetMethod(url);
Header mtHeader = new Header();
mtHeader.setName("content-type");
mtHeader.setValue("application/json");
//mtHeader.setValue("application/json");
mPost.addRequestHeader(mtHeader);
client.executeMethod(mPost);
String output = mPost.getResponseBodyAsString( );
mPost.releaseConnection( );
System.out.println("output : " + output);
}catch(Exception e){
}
}
}
| [
"guruputrakm9@gmail.com"
] | guruputrakm9@gmail.com |
57dc59ee4152f7fcec3061fe9ffda12f3d3630e5 | 16b97b0b1261096fd42a38c713454c25f90b31ad | /gameserver/data/scripts/quests/_292_BrigandsSweep.java | eef46fbaa322d6d13947e0c2e1720ccac9c010ea | [] | no_license | magistor/My_La2 | 98ed7840c69bd2cd4608496a6e648032269cc8ed | e469b7954f5779fa1ec6e8908a634b2b47474a66 | refs/heads/master | 2022-02-06T03:29:51.005616 | 2015-11-14T17:13:29 | 2015-11-14T17:13:29 | 46,180,407 | 0 | 1 | null | 2022-02-01T21:16:56 | 2015-11-14T15:43:05 | HTML | UTF-8 | Java | false | false | 6,750 | java | package quests;
import l2p.commons.util.Rnd;
import l2p.gameserver.model.base.Race;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.model.quest.Quest;
import l2p.gameserver.model.quest.QuestState;
import l2p.gameserver.scripts.ScriptFile;
/**
* Квест Brigands Sweep
*
* @author Sergey Ibryaev aka Artful
*/
public class _292_BrigandsSweep extends Quest implements ScriptFile {
// NPCs
private static int Spiron = 30532;
private static int Balanki = 30533;
// Mobs
private static int GoblinBrigand = 20322;
private static int GoblinBrigandLeader = 20323;
private static int GoblinBrigandLieutenant = 20324;
private static int GoblinSnooper = 20327;
private static int GoblinLord = 20528;
// Quest Items
private static int GoblinNecklace = 1483;
private static int GoblinPendant = 1484;
private static int GoblinLordPendant = 1485;
private static int SuspiciousMemo = 1486;
private static int SuspiciousContract = 1487;
// Chances
private static int Chance = 10;
//Drop Cond
//# [COND, NEWCOND, ID, REQUIRED, ITEM, NEED_COUNT, CHANCE, DROP]
private static final int[][] DROPLIST_COND = {
{
1,
0,
GoblinBrigand,
0,
GoblinNecklace,
0,
40,
1
},
{
1,
0,
GoblinBrigandLeader,
0,
GoblinNecklace,
0,
40,
1
},
{
1,
0,
GoblinSnooper,
0,
GoblinNecklace,
0,
40,
1
},
{
1,
0,
GoblinBrigandLieutenant,
0,
GoblinPendant,
0,
40,
1
},
{
1,
0,
GoblinLord,
0,
GoblinLordPendant,
0,
40,
1
}
};
@Override
public void onLoad() {
}
@Override
public void onReload() {
}
@Override
public void onShutdown() {
}
public _292_BrigandsSweep() {
super(false);
addStartNpc(Spiron);
addTalkId(Balanki);
//Mob Drop
for (int i = 0; i < DROPLIST_COND.length; i++) {
addKillId(DROPLIST_COND[i][2]);
}
addQuestItem(SuspiciousMemo);
addQuestItem(SuspiciousContract);
addQuestItem(GoblinNecklace);
addQuestItem(GoblinPendant);
addQuestItem(GoblinLordPendant);
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc) {
if (event.equalsIgnoreCase("elder_spiron_q0292_03.htm")) {
st.setCond(1);
st.setState(STARTED);
st.playSound(SOUND_ACCEPT);
} else if (event.equalsIgnoreCase("elder_spiron_q0292_06.htm")) {
st.playSound(SOUND_FINISH);
st.exitCurrentQuest(true);
}
return event;
}
@Override
public String onTalk(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
String htmltext = "noquest";
int cond = st.getCond();
if (npcId == Spiron) {
if (cond == 0) {
if (st.getPlayer().getRace() != Race.dwarf) {
htmltext = "elder_spiron_q0292_00.htm";
st.exitCurrentQuest(true);
} else if (st.getPlayer().getLevel() < 5) {
htmltext = "elder_spiron_q0292_01.htm";
st.exitCurrentQuest(true);
} else {
htmltext = "elder_spiron_q0292_02.htm";
}
} else if (cond == 1) {
long reward = st.getQuestItemsCount(GoblinNecklace) * 12 + st.getQuestItemsCount(GoblinPendant) * 36 + st.getQuestItemsCount(GoblinLordPendant) * 33 + st.getQuestItemsCount(SuspiciousContract) * 100;
if (reward == 0) {
return "elder_spiron_q0292_04.htm";
}
if (st.getQuestItemsCount(SuspiciousContract) != 0) {
htmltext = "elder_spiron_q0292_10.htm";
} else if (st.getQuestItemsCount(SuspiciousMemo) == 0) {
htmltext = "elder_spiron_q0292_05.htm";
} else if (st.getQuestItemsCount(SuspiciousMemo) == 1) {
htmltext = "elder_spiron_q0292_08.htm";
} else {
htmltext = "elder_spiron_q0292_09.htm";
}
st.takeItems(GoblinNecklace, -1);
st.takeItems(GoblinPendant, -1);
st.takeItems(GoblinLordPendant, -1);
st.takeItems(SuspiciousContract, -1);
st.giveItems(ADENA_ID, reward);
}
} else if (npcId == Balanki && cond == 1) {
if (st.getQuestItemsCount(SuspiciousContract) == 0) {
htmltext = "balanki_q0292_01.htm";
} else {
st.takeItems(SuspiciousContract, -1);
st.giveItems(ADENA_ID, 120);
htmltext = "balanki_q0292_02.htm";
}
}
return htmltext;
}
@Override
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
int cond = st.getCond();
for (int i = 0; i < DROPLIST_COND.length; i++) {
if (cond == DROPLIST_COND[i][0] && npcId == DROPLIST_COND[i][2]) {
if (DROPLIST_COND[i][3] == 0 || st.getQuestItemsCount(DROPLIST_COND[i][3]) > 0) {
if (DROPLIST_COND[i][5] == 0) {
st.rollAndGive(DROPLIST_COND[i][4], DROPLIST_COND[i][7], DROPLIST_COND[i][6]);
} else if (st.rollAndGive(DROPLIST_COND[i][4], DROPLIST_COND[i][7], DROPLIST_COND[i][7], DROPLIST_COND[i][5], DROPLIST_COND[i][6])) {
if (DROPLIST_COND[i][1] != cond && DROPLIST_COND[i][1] != 0) {
st.setCond(Integer.valueOf(DROPLIST_COND[i][1]));
st.setState(STARTED);
}
}
}
}
}
if (st.getQuestItemsCount(SuspiciousContract) == 0 && Rnd.chance(Chance)) {
if (st.getQuestItemsCount(SuspiciousMemo) < 3) {
st.giveItems(SuspiciousMemo, 1);
st.playSound(SOUND_ITEMGET);
} else {
st.takeItems(SuspiciousMemo, -1);
st.giveItems(SuspiciousContract, 1);
st.playSound(SOUND_MIDDLE);
}
}
return null;
}
} | [
"magistor81@gmail.com"
] | magistor81@gmail.com |
3024c85802c421f5b3436ada68ecafc56f5eb05d | ee41de09d8283560daf03a0f4196c696f391f1cc | /src/main/java/com/course/Application.java | cbee5c2d05c7295175521de861421fe77b2ff951 | [] | no_license | yuna4603/test | d4790c338c3c4a0b10111088a9ceb89f0c6fbf44 | 77daa08fc24153a2130598afbc6f057450396885 | refs/heads/master | 2020-03-27T04:37:11.627579 | 2018-08-24T08:39:12 | 2018-08-24T08:39:12 | 138,602,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.course;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class,args);
}
}
| [
"fangtingting1@bacic5i5j.com"
] | fangtingting1@bacic5i5j.com |
34034df56da962b3c4d2f6d23f293274c4ab4f5b | f28c07ead39fc8e7e4707d9c44110855a644cc1a | /FirstTestNGProject/src/firsttestngpackage/FirstTestNGFile.java | 48e270fb02ba387c65ca47cb9c9013f0422df2b2 | [] | no_license | Arunshenll/selenium | 7532b4aef1e49716ed383a667c45a3050c7f4ab6 | 2fd61fc9fd4a638a27a6db98f2c1e5321ba5b3b8 | refs/heads/master | 2023-04-18T15:15:06.800438 | 2021-04-08T12:03:59 | 2021-04-08T12:03:59 | 355,879,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package firsttestngpackage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.asserts.*;
public class FirstTestNGFile {
public String baseUrl = "http://demo.guru99.com/test/newtours/";
@Test
public void verifyHomepageTitle() {
System.out.println("launching firefox browser");
WebDriver driver = new ChromeDriver();
driver.get(baseUrl);
String expectedTitle = "Welcome: Mercury Tours";
String actualTitle = driver.getTitle();
Assert.assertEquals(actualTitle, expectedTitle);
driver.close();
}
}
| [
"Shenll@DESKTOP-VL1TC80"
] | Shenll@DESKTOP-VL1TC80 |
058335547e6bcaf9d8f40383d66f5f72c8937fe0 | 670501664f0e894e8b202ec11234433abfe1127d | /src/corejava/v2ch08/buttons3/ButtonFrame.java | 09fbacd0224f7c6943a600fb5fb7467f1630c581 | [] | no_license | Nasibulin/CoreJava | d8c4ba0d8fcfcea5a8f80713f75636e572842067 | b33d32fb36bda1347a7f2d9c0094e5ec6c5895cf | refs/heads/master | 2020-03-28T15:55:47.874373 | 2018-09-17T16:39:46 | 2018-09-17T16:39:46 | 148,639,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,259 | java | package corejava.v2ch08.buttons3;
import java.awt.*;
import javax.swing.*;
import corejava.v2ch08.runtimeAnnotations.*;
/**
* A frame with a button panel.
* @version 1.00 2004-08-17
* @author Cay Horstmann
*/
public class ButtonFrame extends JFrame
{
private static final int DEFAULT_WIDTH = 300;
private static final int DEFAULT_HEIGHT = 200;
private JPanel panel;
private JButton yellowButton;
private JButton blueButton;
private JButton redButton;
public ButtonFrame()
{
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
panel = new JPanel();
add(panel);
yellowButton = new JButton("Yellow");
blueButton = new JButton("Blue");
redButton = new JButton("Red");
panel.add(yellowButton);
panel.add(blueButton);
panel.add(redButton);
ActionListenerInstaller.processAnnotations(this);
}
@ActionListenerFor(source = "yellowButton")
public void yellowBackground()
{
panel.setBackground(Color.YELLOW);
}
@ActionListenerFor(source = "blueButton")
public void blueBackground()
{
panel.setBackground(Color.BLUE);
}
@ActionListenerFor(source = "redButton")
public void redBackground()
{
panel.setBackground(Color.RED);
}
}
| [
"k.nasibulin@yandex.ru"
] | k.nasibulin@yandex.ru |
02efb75f4f84f0add80d1887be615971a734c4f0 | 7c8ca0926b9ce875298b1a410c90544745d95488 | /src/test/java/com/teamdev/security/DomainUserDetailsServiceIntTest.java | 8a1fb73ae6c882299927945939d2953617ba07a6 | [] | no_license | augustingims/jhipster-jasper | d0af9ab6437cdfabf21a33cb9a8eca82b312c671 | 8b3e22ab2b7a20f0322adc4d0c26bc7f5bb22695 | refs/heads/master | 2020-04-09T05:00:27.356311 | 2019-03-15T17:30:46 | 2019-03-15T17:30:46 | 160,046,888 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,623 | java | package com.teamdev.security;
import com.teamdev.JasperTestApp;
import com.teamdev.domain.User;
import com.teamdev.repository.UserRepository;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
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.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test class for DomainUserDetailsService.
*
* @see DomainUserDetailsService
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JasperTestApp.class)
@Transactional
public class DomainUserDetailsServiceIntTest {
private static final String USER_ONE_LOGIN = "test-user-one";
private static final String USER_ONE_EMAIL = "test-user-one@localhost";
private static final String USER_TWO_LOGIN = "test-user-two";
private static final String USER_TWO_EMAIL = "test-user-two@localhost";
private static final String USER_THREE_LOGIN = "test-user-three";
private static final String USER_THREE_EMAIL = "test-user-three@localhost";
@Autowired
private UserRepository userRepository;
@Autowired
private UserDetailsService domainUserDetailsService;
private User userOne;
private User userTwo;
private User userThree;
@Before
public void init() {
userOne = new User();
userOne.setLogin(USER_ONE_LOGIN);
userOne.setPassword(RandomStringUtils.random(60));
userOne.setActivated(true);
userOne.setEmail(USER_ONE_EMAIL);
userOne.setFirstName("userOne");
userOne.setLastName("doe");
userOne.setLangKey("en");
userRepository.save(userOne);
userTwo = new User();
userTwo.setLogin(USER_TWO_LOGIN);
userTwo.setPassword(RandomStringUtils.random(60));
userTwo.setActivated(true);
userTwo.setEmail(USER_TWO_EMAIL);
userTwo.setFirstName("userTwo");
userTwo.setLastName("doe");
userTwo.setLangKey("en");
userRepository.save(userTwo);
userThree = new User();
userThree.setLogin(USER_THREE_LOGIN);
userThree.setPassword(RandomStringUtils.random(60));
userThree.setActivated(false);
userThree.setEmail(USER_THREE_EMAIL);
userThree.setFirstName("userThree");
userThree.setLastName("doe");
userThree.setLangKey("en");
userRepository.save(userThree);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByLoginIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByEmail() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL);
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
@Transactional
public void assertThatUserCanBeFoundByEmailIgnoreCase() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN);
}
@Test
@Transactional
public void assertThatEmailIsPrioritizedOverLogin() {
UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL.toUpperCase(Locale.ENGLISH));
assertThat(userDetails).isNotNull();
assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN);
}
@Test(expected = UserNotActivatedException.class)
@Transactional
public void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() {
domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN);
}
}
| [
"augustingims@gmail.com"
] | augustingims@gmail.com |
8c53aa3805eba441e99f0b6e333bdf261229ed01 | 43b6aa98e66e06711c018ea441abfbaf33bc7f38 | /sources/com/google/android/gms/measurement/AppMeasurement.java | dd2fb34bfe8ca03c7db9dd5de67befffa796a902 | [] | no_license | nagpalShaurya/tic-tac-toe | 8d4c6c093f923d0d27419f8da2b8c50c4a3a78de | 28cb820916a591ab5137df43343fee8fd0df9482 | refs/heads/master | 2020-07-06T23:51:50.683624 | 2019-08-21T09:41:55 | 2019-08-21T09:41:55 | 203,176,484 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,722 | java | package com.google.android.gms.measurement;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresPermission;
import android.support.annotation.Size;
import android.support.annotation.WorkerThread;
import android.support.p000v4.util.ArrayMap;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.VisibleForTesting;
import com.google.android.gms.measurement.internal.zzak;
import com.google.android.gms.measurement.internal.zzbt;
import com.google.android.gms.measurement.internal.zzfh;
import com.google.android.gms.measurement.internal.zzfk;
import java.util.List;
import java.util.Map;
@Deprecated
public class AppMeasurement {
@KeepForSdk
public static final String CRASH_ORIGIN = "crash";
@KeepForSdk
public static final String FCM_ORIGIN = "fcm";
@KeepForSdk
public static final String FIAM_ORIGIN = "fiam";
private final zzbt zzadj;
@KeepForSdk
public static class ConditionalUserProperty {
@Keep
@KeepForSdk
public boolean mActive;
@Keep
@KeepForSdk
public String mAppId;
@Keep
@KeepForSdk
public long mCreationTimestamp;
@Keep
public String mExpiredEventName;
@Keep
public Bundle mExpiredEventParams;
@Keep
@KeepForSdk
public String mName;
@Keep
@KeepForSdk
public String mOrigin;
@Keep
@KeepForSdk
public long mTimeToLive;
@Keep
public String mTimedOutEventName;
@Keep
public Bundle mTimedOutEventParams;
@Keep
@KeepForSdk
public String mTriggerEventName;
@Keep
@KeepForSdk
public long mTriggerTimeout;
@Keep
public String mTriggeredEventName;
@Keep
public Bundle mTriggeredEventParams;
@Keep
@KeepForSdk
public long mTriggeredTimestamp;
@Keep
@KeepForSdk
public Object mValue;
public ConditionalUserProperty() {
}
public ConditionalUserProperty(ConditionalUserProperty conditionalUserProperty) {
Preconditions.checkNotNull(conditionalUserProperty);
this.mAppId = conditionalUserProperty.mAppId;
this.mOrigin = conditionalUserProperty.mOrigin;
this.mCreationTimestamp = conditionalUserProperty.mCreationTimestamp;
this.mName = conditionalUserProperty.mName;
Object obj = conditionalUserProperty.mValue;
if (obj != null) {
this.mValue = zzfk.zzf(obj);
if (this.mValue == null) {
this.mValue = conditionalUserProperty.mValue;
}
}
this.mActive = conditionalUserProperty.mActive;
this.mTriggerEventName = conditionalUserProperty.mTriggerEventName;
this.mTriggerTimeout = conditionalUserProperty.mTriggerTimeout;
this.mTimedOutEventName = conditionalUserProperty.mTimedOutEventName;
Bundle bundle = conditionalUserProperty.mTimedOutEventParams;
if (bundle != null) {
this.mTimedOutEventParams = new Bundle(bundle);
}
this.mTriggeredEventName = conditionalUserProperty.mTriggeredEventName;
Bundle bundle2 = conditionalUserProperty.mTriggeredEventParams;
if (bundle2 != null) {
this.mTriggeredEventParams = new Bundle(bundle2);
}
this.mTriggeredTimestamp = conditionalUserProperty.mTriggeredTimestamp;
this.mTimeToLive = conditionalUserProperty.mTimeToLive;
this.mExpiredEventName = conditionalUserProperty.mExpiredEventName;
Bundle bundle3 = conditionalUserProperty.mExpiredEventParams;
if (bundle3 != null) {
this.mExpiredEventParams = new Bundle(bundle3);
}
}
}
@KeepForSdk
public static final class Event {
@KeepForSdk
public static final String AD_REWARD = "_ar";
@KeepForSdk
public static final String APP_EXCEPTION = "_ae";
public static final String[] zzadk = {"app_clear_data", "app_exception", "app_remove", "app_upgrade", "app_install", "app_update", "firebase_campaign", "error", "first_open", "first_visit", "in_app_purchase", "notification_dismiss", "notification_foreground", "notification_open", "notification_receive", "os_update", "session_start", "user_engagement", "ad_exposure", "adunit_exposure", "ad_query", "ad_activeview", "ad_impression", "ad_click", "ad_reward", "screen_view", "ga_extra_parameter"};
public static final String[] zzadl = {"_cd", APP_EXCEPTION, "_ui", "_ug", "_in", "_au", "_cmp", "_err", "_f", "_v", "_iap", "_nd", "_nf", "_no", "_nr", "_ou", "_s", "_e", "_xa", "_xu", "_aq", "_aa", "_ai", "_ac", AD_REWARD, "_vs", "_ep"};
private Event() {
}
public static String zzak(String str) {
return zzfk.zza(str, zzadl, zzadk);
}
public static String zzal(String str) {
return zzfk.zza(str, zzadk, zzadl);
}
}
@KeepForSdk
public interface EventInterceptor {
@WorkerThread
@KeepForSdk
void interceptEvent(String str, String str2, Bundle bundle, long j);
}
@KeepForSdk
public interface OnEventListener {
@WorkerThread
@KeepForSdk
void onEvent(String str, String str2, Bundle bundle, long j);
}
@KeepForSdk
public static final class Param {
@KeepForSdk
public static final String FATAL = "fatal";
@KeepForSdk
public static final String TIMESTAMP = "timestamp";
@KeepForSdk
public static final String TYPE = "type";
public static final String[] zzadm = {"firebase_conversion", "engagement_time_msec", "exposure_time", "ad_event_id", "ad_unit_id", "firebase_error", "firebase_error_value", "firebase_error_length", "firebase_event_origin", "firebase_screen", "firebase_screen_class", "firebase_screen_id", "firebase_previous_screen", "firebase_previous_class", "firebase_previous_id", "message_device_time", "message_id", "message_name", "message_time", "previous_app_version", "previous_os_version", "topic", "update_with_analytics", "previous_first_open_count", "system_app", "system_app_update", "previous_install_count", "ga_event_id", "ga_extra_params_ct", "ga_group_name", "ga_list_length", "ga_index", "ga_event_name", "campaign_info_source", "deferred_analytics_collection", "session_number", "session_id"};
public static final String[] zzadn = {"_c", "_et", "_xt", "_aeid", "_ai", "_err", "_ev", "_el", "_o", "_sn", "_sc", "_si", "_pn", "_pc", "_pi", "_ndt", "_nmid", "_nmn", "_nmt", "_pv", "_po", "_nt", "_uwa", "_pfo", "_sys", "_sysu", "_pin", "_eid", "_epc", "_gn", "_ll", "_i", "_en", "_cis", "_dac", "_sno", "_sid"};
private Param() {
}
public static String zzal(String str) {
return zzfk.zza(str, zzadm, zzadn);
}
}
@KeepForSdk
public static final class UserProperty {
@KeepForSdk
public static final String FIREBASE_LAST_NOTIFICATION = "_ln";
public static final String[] zzado = {"firebase_last_notification", "first_open_time", "first_visit_time", "last_deep_link_referrer", "user_id", "first_open_after_install", "lifetime_user_engagement", "google_allow_ad_personalization_signals", "session_number", "session_id"};
public static final String[] zzadp = {FIREBASE_LAST_NOTIFICATION, "_fot", "_fvt", "_ldl", "_id", "_fi", "_lte", "_ap", "_sno", "_sid"};
private UserProperty() {
}
public static String zzal(String str) {
return zzfk.zza(str, zzado, zzadp);
}
}
@Keep
@RequiresPermission(allOf = {"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE", "android.permission.WAKE_LOCK"})
@Deprecated
public static AppMeasurement getInstance(Context context) {
return zzbt.zza(context, (zzak) null).zzki();
}
public final void logEvent(@Size(max = 40, min = 1) @NonNull String str, Bundle bundle) {
this.zzadj.zzge().zza("app", str, bundle, true);
}
public final void setUserProperty(@Size(max = 24, min = 1) @NonNull String str, @Nullable @Size(max = 36) String str2) {
this.zzadj.zzge().zzb("app", str, (Object) str2, false);
}
@KeepForSdk
@Deprecated
public void setMeasurementEnabled(boolean z) {
this.zzadj.zzge().setMeasurementEnabled(z);
}
public final void zzd(boolean z) {
this.zzadj.zzge().zzd(z);
}
public final void setMinimumSessionDuration(long j) {
this.zzadj.zzge().setMinimumSessionDuration(j);
}
public final void setSessionTimeoutDuration(long j) {
this.zzadj.zzge().setSessionTimeoutDuration(j);
}
public AppMeasurement(zzbt zzbt) {
Preconditions.checkNotNull(zzbt);
this.zzadj = zzbt;
}
@Keep
public void logEventInternal(String str, String str2, Bundle bundle) {
this.zzadj.zzge().logEvent(str, str2, bundle);
}
@KeepForSdk
public void logEventInternalNoInterceptor(String str, String str2, Bundle bundle, long j) {
this.zzadj.zzge().logEvent(str, str2, bundle, true, false, j);
}
@KeepForSdk
public void setUserPropertyInternal(String str, String str2, Object obj) {
Preconditions.checkNotEmpty(str);
this.zzadj.zzge().zzb(str, str2, obj, true);
}
@WorkerThread
@KeepForSdk
public Map<String, Object> getUserProperties(boolean z) {
List<zzfh> zzl = this.zzadj.zzge().zzl(z);
ArrayMap arrayMap = new ArrayMap(zzl.size());
for (zzfh zzfh : zzl) {
arrayMap.put(zzfh.name, zzfh.getValue());
}
return arrayMap;
}
@WorkerThread
@KeepForSdk
public void setEventInterceptor(EventInterceptor eventInterceptor) {
this.zzadj.zzge().setEventInterceptor(eventInterceptor);
}
@KeepForSdk
public void registerOnMeasurementEventListener(OnEventListener onEventListener) {
this.zzadj.zzge().registerOnMeasurementEventListener(onEventListener);
}
@KeepForSdk
public void unregisterOnMeasurementEventListener(OnEventListener onEventListener) {
this.zzadj.zzge().unregisterOnMeasurementEventListener(onEventListener);
}
@Keep
@Nullable
public String getCurrentScreenName() {
return this.zzadj.zzge().getCurrentScreenName();
}
@Keep
@Nullable
public String getCurrentScreenClass() {
return this.zzadj.zzge().getCurrentScreenClass();
}
@Keep
@Nullable
public String getAppInstanceId() {
return this.zzadj.zzge().zzfx();
}
@Keep
@Nullable
public String getGmpAppId() {
return this.zzadj.zzge().getGmpAppId();
}
@Keep
public long generateEventId() {
return this.zzadj.zzgm().zzmc();
}
@Keep
public void beginAdUnitExposure(@Size(min = 1) @NonNull String str) {
this.zzadj.zzgd().beginAdUnitExposure(str, this.zzadj.zzbx().elapsedRealtime());
}
@Keep
public void endAdUnitExposure(@Size(min = 1) @NonNull String str) {
this.zzadj.zzgd().endAdUnitExposure(str, this.zzadj.zzbx().elapsedRealtime());
}
@Keep
@KeepForSdk
public void setConditionalUserProperty(@NonNull ConditionalUserProperty conditionalUserProperty) {
this.zzadj.zzge().setConditionalUserProperty(conditionalUserProperty);
}
/* access modifiers changed from: protected */
@Keep
@VisibleForTesting
public void setConditionalUserPropertyAs(@NonNull ConditionalUserProperty conditionalUserProperty) {
this.zzadj.zzge().setConditionalUserPropertyAs(conditionalUserProperty);
}
@Keep
@KeepForSdk
public void clearConditionalUserProperty(@Size(max = 24, min = 1) @NonNull String str, @Nullable String str2, @Nullable Bundle bundle) {
this.zzadj.zzge().clearConditionalUserProperty(str, str2, bundle);
}
/* access modifiers changed from: protected */
@Keep
@VisibleForTesting
public void clearConditionalUserPropertyAs(@Size(min = 1) @NonNull String str, @Size(max = 24, min = 1) @NonNull String str2, @Nullable String str3, @Nullable Bundle bundle) {
this.zzadj.zzge().clearConditionalUserPropertyAs(str, str2, str3, bundle);
}
/* access modifiers changed from: protected */
@Keep
@WorkerThread
@VisibleForTesting
public Map<String, Object> getUserProperties(@Nullable String str, @Nullable @Size(max = 24, min = 1) String str2, boolean z) {
return this.zzadj.zzge().getUserProperties(str, str2, z);
}
/* access modifiers changed from: protected */
@Keep
@WorkerThread
@VisibleForTesting
public Map<String, Object> getUserPropertiesAs(@Size(min = 1) @NonNull String str, @Nullable String str2, @Nullable @Size(max = 23, min = 1) String str3, boolean z) {
return this.zzadj.zzge().getUserPropertiesAs(str, str2, str3, z);
}
@Keep
@WorkerThread
@KeepForSdk
public List<ConditionalUserProperty> getConditionalUserProperties(@Nullable String str, @Nullable @Size(max = 23, min = 1) String str2) {
return this.zzadj.zzge().getConditionalUserProperties(str, str2);
}
/* access modifiers changed from: protected */
@Keep
@WorkerThread
@VisibleForTesting
public List<ConditionalUserProperty> getConditionalUserPropertiesAs(@Size(min = 1) @NonNull String str, @Nullable String str2, @Nullable @Size(max = 23, min = 1) String str3) {
return this.zzadj.zzge().getConditionalUserPropertiesAs(str, str2, str3);
}
@Keep
@WorkerThread
@KeepForSdk
public int getMaxUserProperties(@Size(min = 1) @NonNull String str) {
this.zzadj.zzge();
Preconditions.checkNotEmpty(str);
return 25;
}
@KeepForSdk
public Boolean getBoolean() {
return this.zzadj.zzge().zzkt();
}
@KeepForSdk
public String getString() {
return this.zzadj.zzge().zzku();
}
@KeepForSdk
public Long getLong() {
return this.zzadj.zzge().zzkv();
}
@KeepForSdk
public Integer getInteger() {
return this.zzadj.zzge().zzkw();
}
@KeepForSdk
public Double getDouble() {
return this.zzadj.zzge().zzkx();
}
}
| [
"shauryanagpal1998@gmail.com"
] | shauryanagpal1998@gmail.com |
81988039e43bd9131a9a9dd77d964050574155f2 | 85835c9e57cfcace81def5f4305259116a4057a0 | /src/main/java/ws/payper/gateway/service/ValidatorService.java | c5a5966f978b274ffdaa54b97b7cffd431f240c6 | [
"Apache-2.0"
] | permissive | payperws/payper-gateway | ba6166682c755c89844baa0d3227d192a329fe85 | 4197d9c66c8853d931d446eb1a7b4da2d78f6cb3 | refs/heads/master | 2021-06-10T11:45:28.146841 | 2019-05-22T08:37:11 | 2019-05-22T08:37:11 | 152,949,762 | 9 | 1 | Apache-2.0 | 2021-03-31T21:16:30 | 2018-10-14T07:27:23 | Java | UTF-8 | Java | false | false | 6,817 | java | package ws.payper.gateway.service;
import com.google.common.net.InetAddresses;
import com.google.common.net.InternetDomainName;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Component;
import ws.payper.gateway.config.PaymentOptionType;
import ws.payper.gateway.model.CryptoCurrency;
import ws.payper.gateway.web.ConfigureLinkController;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import static ws.payper.gateway.service.ValidationException.Arg;
import static ws.payper.gateway.service.ValidationException.Error;
@Component
public class ValidatorService {
public void newLink(ConfigureLinkController.LinkConfig link) {
Optional<Error> url = checkUrl(link.getUrl());
Optional<Error> title = checkTitle(link.getTitle());
Optional<Error> description = checkDescription(link.getDescription());
Optional<Error> pseudonym = checkPseudonym(link.getPseudonym());
Optional<Error> price = checkPrice(link.getPrice());
List<Optional<Error>> paymentArgs = checkPaymentArgs(link.getPaymentOptionType(), link.getPaymentOptionArgs(), link.getCurrency());
List<Optional<Error>> fields = List.of(url, title, description, pseudonym, price);
List<Optional<Error>> allErrors = new ArrayList<>();
allErrors.addAll(fields);
allErrors.addAll(paymentArgs);
List<Error> errors = allErrors.stream()
.flatMap(Optional::stream)
.collect(Collectors.toList());
if (!errors.isEmpty()) {
throw new ValidationException("Config link validation errors", errors);
}
}
private Optional<Error> checkUrl(String url) {
Optional<Error> result = Optional.empty();
try {
new URL(url);
return result;
} catch (MalformedURLException e) {
Error error = new Error("linkconfig.url.invalid");
result = Optional.of(error);
}
return result;
}
private Optional<Error> checkTitle(String title) {
int titleMaxLength = 100;
Optional<Error> result = Optional.empty();
if (StringUtils.isBlank(title)) {
Error error = new Error("linkconfig.title.mandatory");
result = Optional.of(error);
} else {
if (title.length() > titleMaxLength) {
Error error = new Error("linkconfig.title.too-long",
Arg.of("value", title), Arg.of("max", String.valueOf(titleMaxLength)));
result = Optional.of(error);
}
}
return result;
}
private Optional<Error> checkDescription(String description) {
int descriptionMaxLength = 200;
Optional<Error> result = Optional.empty();
if (description.length() > descriptionMaxLength) {
Error error = new Error("linkconfig.description.too-long",
Arg.of("value", description), Arg.of("max", String.valueOf(descriptionMaxLength)));
result = Optional.of(error);
}
return result;
}
private Optional<Error> checkPseudonym(String pseudonym) {
return Optional.empty();
}
private Optional<Error> checkPrice(BigDecimal price) {
Optional<Error> result = Optional.empty();
if (price == null) {
Error error = new Error("linkconfig.price.mandatory");
result = Optional.of(error);
} else if (price.compareTo(BigDecimal.ZERO) < 1) {
Error error = new Error("linkconfig.price.not-positive",
Arg.of("value", price.toString()));
result = Optional.of(error);
}
return result;
}
private Map<PaymentOptionType, CryptoCurrency> currencies = Map.of(
PaymentOptionType.DUMMY_COIN, CryptoCurrency.DUMMY_COIN,
PaymentOptionType.LIGHTNING_BTC, CryptoCurrency.SATOSHI_BTC,
PaymentOptionType.HEDERA_HBAR_INVOICE, CryptoCurrency.HBAR
);
private List<Optional<Error>> checkPaymentArgs(PaymentOptionType paymentOptionType, Map<String, String> args, CryptoCurrency currency) {
if (paymentOptionType == null) {
Error error = new Error("linkconfig.paymentOptionType.missing");
return List.of(Optional.of(error));
}
if (currency == null) {
Error error = new Error("linkconfig.currency.missing");
return List.of(Optional.of(error));
}
if (!currency.equals(currencies.get(paymentOptionType))) {
Error error = new Error("linkconfig.currency.invalid",
Arg.of("paymentOptionType", paymentOptionType.name()),
Arg.of("currency", currency.name()));
return List.of(Optional.of(error));
}
if (PaymentOptionType.LIGHTNING_BTC.equals(paymentOptionType)) {
Optional<Error> ip = checkIpOrHost(args.get("pubkeyHost"));
Optional<Error> port = checkPort(args.get("rpcport"));
Optional<Error> cert = checkCert(args.get("tlsCert"));
Optional<Error> macaroon = checkMacaroon(args.get("invoiceMacaroon"));
return List.of(ip, port, cert, macaroon);
}
return List.of(Optional.empty());
}
private Optional<Error> checkIpOrHost(String pubkeyHost) {
Optional<Error> result = Optional.empty();
if (!InetAddresses.isInetAddress(pubkeyHost) && !InternetDomainName.isValid(pubkeyHost)) {
Error error = new Error("linkconfig.paymentOption.LIGHTNING_BTC.ipOrHost.missing");
result = Optional.of(error);
}
return result;
}
private Optional<Error> checkPort(String rpcport) {
Optional<Error> result = Optional.empty();
boolean invalid = true;
if (StringUtils.isNumeric(rpcport)) {
try {
int parsedPort = Integer.parseInt(rpcport);
if (parsedPort >= 0 || parsedPort <= 65535) {
invalid = false;
}
} catch (NumberFormatException ex) {
// invalid remains true
}
}
if (invalid) {
Error error = new Error("linkconfig.paymentOption.LIGHTNING_BTC.rpcport.invalid", Arg.of("value", rpcport));
result = Optional.of(error);
}
return result;
}
private Optional<Error> checkCert(String tlsCert) {
// TODO validate
return Optional.empty();
}
private Optional<Error> checkMacaroon(String invoiceMacaroon) {
// TODO validate
return Optional.empty();
}
}
| [
"alexandru.males@gmail.com"
] | alexandru.males@gmail.com |
62285607565959f36450fb3b926f962ec8d1a383 | 311e3eae631c6e8024b0ce40cd410d3a8673c31c | /web/src/main/java/org/jsets/fastboot/Application.java | 5e2249a4a9cec3a1a9ad5b4e284b5cdbc99aadb1 | [
"Apache-2.0"
] | permissive | wj596/fastboot | 045178a91ff9b887e3fec9d2519e3d0b7ffa838a | db2c2e828a7096953e114627521b7e82c28d9d33 | refs/heads/main | 2023-07-03T01:10:42.208925 | 2021-08-08T11:16:17 | 2021-08-08T11:16:17 | 389,641,195 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package org.jsets.fastboot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.util.StopWatch;
/**
*
* 启动程序
*
*/
@EnableCaching
@SpringBootApplication
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String[] args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ConfigurableApplicationContext ctx = new SpringApplicationBuilder(Application.class).logStartupInfo(true).run(args);
Environment env = ctx.getEnvironment();
String applicationName = env.getProperty("spring.application.name");
String serverPort = env.getProperty("server.port");
stopWatch.stop();
log.info("{}启动完成,监听端口:{},耗时:{}s", applicationName, serverPort, stopWatch.getTotalTimeSeconds());
}
} | [
"wangjie"
] | wangjie |
a7e909752fb556b8af41ff133be2fb1efbd90ceb | bc2c9644f8c6198188cc32df62063cfc59d8b8f2 | /app/src/main/java/com/example/go4lunch/Notifications/NotificationsAlarmReceiver.java | b654e6e879171321449b3336527ff3e2fd2dee0b | [] | no_license | julien-eko/Go4Lunch | ab66e141fa2ebc3098c63ed28bbfa9ca81c7c720 | 54c8945205152d1449449e9282cc69a3e5f3ed16 | refs/heads/master | 2020-05-16T11:41:19.444419 | 2019-06-23T19:00:50 | 2019-06-23T19:00:50 | 183,018,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,734 | java | package com.example.go4lunch.Notifications;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import com.example.go4lunch.Activities.MainActivity;
import com.example.go4lunch.Models.Firestore.User;
import com.example.go4lunch.R;
import com.example.go4lunch.Utils.Firestore.UserHelper;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import java.util.Calendar;
public class NotificationsAlarmReceiver extends BroadcastReceiver {
private final int NOTIFICATION_ID = 007;
private final String NOTIFICATION_TAG = "FIREBASEOC";
private String restaurantName;
private String restaurantAdress;
private String listWorkmates;
private Boolean isLunch;
private Context context;
@Override
public void onReceive(Context context, Intent intent) {
this.context=context;
restaurantInfo();
}
//search info of restaurant selected by user
private void restaurantInfo(){
UserHelper.getUser(FirebaseAuth.getInstance().getCurrentUser().getUid()).addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot) {
Calendar calendar = Calendar.getInstance();
int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
User currentUser = documentSnapshot.toObject(User.class);
restaurantName = currentUser.getRestaurantName();
restaurantAdress = currentUser.getRestaurantAdress();
if(currentUser.getDate() == dayOfYear && restaurantName != null){
isLunch=true;
}else{
isLunch=false;
}
workamateList(currentUser.getRestaurantChoiceId());
}
});
}
//create string with all workmate interested by same restaurant that user
private void workamateList(String restaurantId){
UserHelper.getUsersInterestedByRestaurant(restaurantId).addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot querySnapshot) {
Calendar calendar = Calendar.getInstance();
int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
for (int i = 0; i < querySnapshot.size(); i++) {
if (querySnapshot.getDocuments().get(i).get("date").toString().equals(Integer.toString(dayOfYear))) {
if (!querySnapshot.getDocuments().get(i).get("uid").equals(FirebaseAuth.getInstance().getCurrentUser().getUid())) {
if(listWorkmates == null){
listWorkmates = "" + querySnapshot.getDocuments().get(i).get("username");
}else{
listWorkmates =listWorkmates + " "+ querySnapshot.getDocuments().get(i).get("username");
}
}
}
}
sendNotification();
}
});
}
//send notification if user choice a restaurant
private void sendNotification(){
if(isLunch){
String title = context.getResources().getString(R.string.notification_your_lunch) +restaurantName;
String messageWorkmates;
String messageAdress;
if(listWorkmates == null){
messageWorkmates= context.getResources().getString(R.string.no_workmates);
messageAdress =context.getResources().getString(R.string.adress) +restaurantAdress;
}else{
messageWorkmates = context.getResources().getString(R.string.with_workmates) + listWorkmates ;
messageAdress = context.getResources().getString(R.string.adress) +restaurantAdress;
}
sendVisualNotification(title,messageWorkmates,messageAdress);
}
}
/**
* create nootification
* @param title title of notification
* @param messageWorkamates first line of notification
* @param messageAdress second line of notification
*/
private void sendVisualNotification(String title,String messageWorkamates,String messageAdress) {
// 1 - Create an Intent that will be shown when user will click on the Notification
Intent intent = new Intent(this.context, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this.context, 0, intent, PendingIntent.FLAG_ONE_SHOT);
// 2 - Create a Style for the Notification
NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
inboxStyle.setBigContentTitle(title);
inboxStyle.addLine(messageWorkamates);
inboxStyle.addLine(messageAdress);
// 3 - Create a Channel (Android 8)
String channelId = "notification_channel_id";
// 4 - Build a Notification object
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this.context, channelId)
.setSmallIcon(R.drawable.logo_restaurant)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(title)
.setAutoCancel(true)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContentIntent(pendingIntent)
.setStyle(inboxStyle);
// 5 - Add the Notification to the Notification Manager and show it.
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// 6 - Support Version >= Android 8
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence channelName = "Message provenant de Firebase";
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(channelId, channelName, importance);
notificationManager.createNotificationChannel(mChannel);
}
// 7 - Show notification
notificationManager.notify(NOTIFICATION_TAG, NOTIFICATION_ID, notificationBuilder.build());
}
}
| [
"julien.darcos@gmail.com"
] | julien.darcos@gmail.com |
8ea3ec9db537d5077c84b1bdeee9e5d791313808 | 0a76b0df678797e951c50d48e7a9c81a7fef0af3 | /src/sistemacontable/EntradaInventarioController.java | 759225bcee493e45f3cf9827b99c615f038a005f | [] | no_license | mvip94/SIC | ebe27cbc103e9d91173453cf722bcdc8ae9babb2 | dd216d05da42304df8ac9f5de7302ef8933f8c24 | refs/heads/master | 2021-01-10T06:54:02.652067 | 2015-10-31T20:42:38 | 2015-10-31T20:42:38 | 44,398,310 | 1 | 2 | null | 2015-10-25T04:53:09 | 2015-10-16T16:46:23 | JavaScript | UTF-8 | Java | false | false | 583 | 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 sistemacontable;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.Initializable;
/**
* FXML Controller class
*
* @author mario
*/
public class EntradaInventarioController implements Initializable {
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
}
| [
"mario@Mario-Probook"
] | mario@Mario-Probook |
483846691e775163ffce84c8b1c15f9e7d046fa9 | 7547d968fe3d5be7c046d41db756f472fa3851f4 | /app/src/main/java/com/dstyo/prelo/model/login/Rent.java | 3ff659a13c94d6733f0c629da9320d6c06ffc5f5 | [] | no_license | dstyo/prelo-android-challenge | 9e86a2e977df46eba60dbf406209143e5d4f4eb8 | be4509107192ce5a731de13a6b415611202a26c9 | refs/heads/master | 2021-08-24T05:20:42.852355 | 2017-12-08T06:32:07 | 2017-12-08T06:32:07 | 113,331,631 | 0 | 0 | null | 2017-12-08T06:32:08 | 2017-12-06T15:15:32 | Java | UTF-8 | Java | false | false | 1,187 | java | package com.dstyo.prelo.model.login;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* @author Dwi Setiyono <dwi.setiyono@ovo.id>
* @since 2017.07.12
*/
public class Rent implements Parcelable {
@SerializedName("docs")
@Expose
private List<String> docs = null;
public List<String> getDocs() {
return docs;
}
public void setDocs(List<String> docs) {
this.docs = docs;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStringList(this.docs);
}
public Rent() {
}
protected Rent(Parcel in) {
this.docs = in.createStringArrayList();
}
public static final Parcelable.Creator<Rent> CREATOR = new Parcelable.Creator<Rent>() {
@Override
public Rent createFromParcel(Parcel source) {
return new Rent(source);
}
@Override
public Rent[] newArray(int size) {
return new Rent[size];
}
};
}
| [
"dstyo91@gmail.com"
] | dstyo91@gmail.com |
19542957e31cd1b66a8bab5c6a81d47a68dbcbbc | f060f7a7976678cc8b9a1264e6f78e601ecad852 | /day009-ObjectArray-ArrayList/src/com/itheima/studentmanager/Student.java | 0990aaf11405ad887c608800f0128ae685dee5b9 | [] | no_license | flowstone/Base-Java | 1a734ea23ae22b4ffd7b05d37c0e020592164535 | 80e8700e696dede08456f4eb7e3c8203dd5dae69 | refs/heads/master | 2020-12-03T04:02:53.070350 | 2017-12-22T12:02:50 | 2017-12-22T12:02:50 | 95,805,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,002 | java | package com.itheima.studentmanager;
/**
* @author Yao Xue
* @date Jul 7, 2017 4:01:35 PM
*/
public class Student {
private String id;
private String name;
private String age;
private String address;
public Student() {
// TODO Auto-generated constructor stub
}
public Student(String id, String name, String age, String address) {
this.id = id;
this.name = name;
this.age = age;
this.address = address;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
| [
"yaoxue2014@hotmail.com"
] | yaoxue2014@hotmail.com |
468e35c11feb6e06b31e04cf3504faee87a1ed9e | ac47f96230648ff67ae384c38b5c1b80684c0822 | /src/ch03/Exam02.java | ae02f756dd3a34f6fe656080d4a6224ea3d87999 | [] | no_license | psm7047/Java | 397aed4e05036e1ea6acfb49e8d50e40e6dfac77 | c8af6e09533ae1ffa594d9312cbc0af66b52b5a6 | refs/heads/master | 2023-03-11T10:08:55.760299 | 2021-03-03T14:57:48 | 2021-03-03T14:57:48 | 339,272,737 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 601 | java | package ch03;
public class Exam02 {
public static void main(String[] args) {
//연산의 결과가 boolean타입으로 나오는 연산기호
int var1 = 2;
int var2 = 3;
boolean var3 = var1 == var2; //false
boolean var4 = var1 != var2; //true
boolean var5 = var1 > var2; //false
boolean var6 = var1 >= var2; //false
boolean var7 = var1 < var2; //true
boolean var8 = var1 <= var2; //true
boolean var9 = !(var1 == var2); //true
boolean var10 = ((var1 == var2) || (var1 < var2)); //true
boolean var11 = ((var1 == var2) && (var1 < var2)); //false
}
}
| [
"psm7047@naver.com"
] | psm7047@naver.com |
0078ad08088f9e47d92b9f356f81c8e09af86ba9 | 0b2e26d38925f7cab71dd7791d6791246b9bc0e4 | /app/src/main/java/com/openclassrooms/entrevoisins/service/DummyNeighbourApiService.java | 54fdde96d86141430cbc3933c1cdf8e071839120 | [] | no_license | amine91480/OC_EntreVoisins | 3cfe1cb291d051b322505e1b527affe83d15629d | 7492d9f451ecef508ec7d89f84bf08b15fe0f1ff | refs/heads/master | 2023-03-14T07:00:16.318158 | 2021-03-05T18:09:33 | 2021-03-05T18:09:33 | 313,090,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | package com.openclassrooms.entrevoisins.service;
import android.util.Log;
import com.openclassrooms.entrevoisins.model.Neighbour;
import java.util.ArrayList;
import java.util.List;
/**
* Dummy mock for the Api
*/
public class DummyNeighbourApiService implements NeighbourApiService {
private List<Neighbour> neighbours = DummyNeighbourGenerator.generateNeighbours();
/**
* Get all my Neighbours
* @return {@link List}
*/
@Override
public List<Neighbour> getNeighbours() {
return neighbours;
}
/**
* Get all my Favorites
* @return {@link List}
*/
@Override
public List<Neighbour> getFavorites() {
List<Neighbour> favorites = new ArrayList<>();
for (Neighbour neighbour : neighbours) {
if (neighbour.isFavorite()) {
favorites.add(neighbour);
}
}
return favorites;
}
/**
* Delete the neighbour to the List neighbours
* @ param neighbour
*/
@Override
public void deleteNeighbour(Neighbour neighbour) { neighbours.remove(neighbour); }
/**
* {@inheritDoc}
* Create a new neigbour or update a neighbour existing on the list neighbours
* @param neighbour
*/
@Override
public void createNeighbour(Neighbour neighbour) {
boolean isFound = false;
for (Neighbour n : neighbours) {
if (n.getId() == neighbour.getId()) {
n.setFavorite(neighbour.isFavorite());
isFound = true;
break;
}
}
if (!isFound) {
neighbours.add(neighbour);
}
}
}
| [
"amine91480@hotmail.fr"
] | amine91480@hotmail.fr |
9ef2ddc1eb43a4a33531b5045c143e374085762a | df54a4a49a7aca6b938e58e179021f9a8b37f69d | /springbootdemo/aop/src/main/java/com/xy/springbootdemo/aop/bean/DemoAnnotationService.java | 2d523966895afe17b1532e968008275850b92898 | [] | no_license | summercloudxy/study | 63a5f942290f95593503631464328ca6d0f6a439 | 2ba5a3f6440a6a0b42fe403fb3e677fb7eb67e3d | refs/heads/master | 2021-01-25T13:23:28.374720 | 2018-07-02T09:29:56 | 2018-07-02T09:29:56 | 123,561,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.xy.springbootdemo.aop.bean;
import org.springframework.stereotype.Service;
@Service
public class DemoAnnotationService {
@Action(name = "注解式拦截")
public void add(){}
}
| [
"469654418@qq.com"
] | 469654418@qq.com |
93f429c2221c6e298093227510cddc3c5b616402 | b91be9e6b91e179927aec448221635c4023d856f | /app/src/main/java/companion/virtual/com/virtualcompanion/SetUpProfileActivity.java | bcdef42058fba569ea809cd7b3a33e4b7d057c58 | [] | no_license | franchiiin20/virtual-companion-android | 126a1bf744cc07ab35042576f811b14ee4aa089e | 3e05ab4d0012abe6c50f62db9e1f71640ca98b62 | refs/heads/master | 2020-03-30T13:24:35.462894 | 2018-10-02T14:44:54 | 2018-10-02T14:44:54 | 151,271,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,646 | java | package companion.virtual.com.virtualcompanion;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.io.ByteArrayOutputStream;
import java.util.Map;
import companion.virtual.com.virtualcompanion.dialog.PhotoDialog;
import companion.virtual.com.virtualcompanion.dialog.SpinnerDialog;
import companion.virtual.com.virtualcompanion.model.UserModel;
import companion.virtual.com.virtualcompanion.router.PageRouter;
import companion.virtual.com.virtualcompanion.utils.Constant;
import companion.virtual.com.virtualcompanion.utils.PageAnimation;
import companion.virtual.com.virtualcompanion.utils.date.DateConvertReadable;
import companion.virtual.com.virtualcompanion.utils.date.DateTime;
import de.hdodenhof.circleimageview.CircleImageView;
public class SetUpProfileActivity extends FragmentActivity {
private Button continueButton;
private RelativeLayout addRelativeLayout;
private CircleImageView profileCircleImageView;
private UserModel userModel;
private SpinnerDialog spinnerDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_setup_profile);
pageTransition();
init();
initValues();
initClick();
}
private void setProfileImageURL(UploadTask.TaskSnapshot taskSnapshot){
@SuppressWarnings("VisibleForTests") Uri downloadUrl = taskSnapshot.getDownloadUrl();
try {
DatabaseReference mDatabase = FirebaseDatabase
.getInstance().getReference();
userModel.setProfileURL(downloadUrl.toString());
String userUID = userModel.getUID();
if(!userUID.equalsIgnoreCase("")){
mDatabase.child(Constant.FireUser.TABLE)
.child(userUID)
.child(Constant.FireUser.PROFILE_URL)
.setValue(userModel.getProfileURL());
}
Glide.with(this)
.load(downloadUrl)
.thumbnail(0.5f)
.into(profileCircleImageView);
spinnerDialog.dismiss();
continueButton.setVisibility(View.VISIBLE);
} catch (Exception ignore){}
}
private void photoErrorMessage(){
spinnerDialog.dismiss();
Toast.makeText(getApplicationContext(),
R.string.photo_error, Toast.LENGTH_SHORT).show();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == Constant.CallBackReference.GALLERY
&& resultCode == RESULT_OK){
if(!spinnerDialog.isShowing()){
spinnerDialog.show();
}
spinnerDialog.setCancelable(false);
spinnerDialog.setCanceledOnTouchOutside(false);
Uri uri = data.getData();
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
String databaseString = mDatabase.push().getKey();
StorageReference storageRef = FirebaseStorage.getInstance()
.getReferenceFromUrl(Constant.CloudReference.STORAGE_PROFILE
+ "/" + userModel.getUID());
StorageReference filePath = storageRef.child(databaseString);
filePath.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
setProfileImageURL(taskSnapshot);
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
photoErrorMessage();
}
});
} else if(requestCode == Constant.CallBackReference.CAMERA
&& resultCode == RESULT_OK){
if(!spinnerDialog.isShowing()){
spinnerDialog.show();
}
spinnerDialog.setCancelable(false);
spinnerDialog.setCanceledOnTouchOutside(false);
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
byte[] dataBAOS = byteArrayOutputStream.toByteArray();
DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();
String databaseString = mDatabase.push().getKey();
StorageReference storageRef = FirebaseStorage.getInstance()
.getReferenceFromUrl(Constant.CloudReference.STORAGE_PROFILE
+ "/" + userModel.getUID());
StorageReference imagesRef = storageRef.child(databaseString);
UploadTask uploadTask = imagesRef.putBytes(dataBAOS);
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
photoErrorMessage();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
setProfileImageURL(taskSnapshot);
}
});
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case Constant.PermissionReference.CAMERA: {
callCameraIntent();
break;
} case Constant.PermissionReference.GALLERY: {
callGalleryIntent();
break;
}
}
}
public void callCameraIntent(){
try {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, Constant.CallBackReference.CAMERA);
} catch (Exception ignore){}
}
public void callGalleryIntent(){
try {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, Constant.CallBackReference.GALLERY);
} catch (Exception ignore){}
}
private void getPhotoUploadOption(){
try {
PhotoDialog photoDialog = new PhotoDialog(this);
if(!photoDialog.isShowing()){
photoDialog.show();
}
} catch (Exception ignore){}
}
private void pageTransition(){
PageAnimation pageAnimation = new PageAnimation(this);
pageAnimation.fadeAnimation();
}
private void setProfile(DataSnapshot dataSnapshot){
try {
Map<String, String> dataMap = (Map<String, String>)dataSnapshot.getValue();
String firstName = dataMap.get(Constant.FireUser.FIRST_NAME);
String lastName = dataMap.get(Constant.FireUser.LAST_NAME);
String profileURL = dataMap.get(Constant.FireUser.PROFILE_URL);
userModel.setFirstName(firstName);
userModel.setLastName(lastName);
userModel.setProfileURL(profileURL);
} catch (Exception ignore){}
}
private void getProfile(){
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference(Constant.FireUser.TABLE).child(userModel.getUID());
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
setProfile(dataSnapshot);
}
@Override
public void onCancelled(DatabaseError databaseError){}
});
}
private void initClick(){
continueButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PageRouter pageRouter = new PageRouter(SetUpProfileActivity.this);
pageRouter.openSetUpDescriptionPage();
}
});
addRelativeLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getPhotoUploadOption();
}
});
profileCircleImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getPhotoUploadOption();
}
});
}
private void initValues(){
continueButton.setVisibility(View.GONE);
spinnerDialog = new SpinnerDialog(this);
userModel = new UserModel();
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
userModel.setUID(user.getUid());
getProfile();
}
}
private void init(){
continueButton = (Button)findViewById(R.id.setup_profile_continue);
addRelativeLayout = (RelativeLayout)findViewById(R.id.photo_edit);
profileCircleImageView = (CircleImageView)findViewById(R.id.profile_icon);
}
}
| [
"franchiiin20.github.com"
] | franchiiin20.github.com |
b7fa911b858ef1566b2831b47533acaf32e13486 | 3b81d09220d668964c4d3a187cbf0c84568e27a1 | /src/editor_main/MenuBar.java | 6c7fbeb30bf1a10f616051baf09d257d2afefa6e | [] | no_license | Gabe105502521/UML_editor | 9b6eff73f664959e3e416f6224a8aa6a4203f3de | 591e874766ed51ae404120c1fddc43c775915dd4 | refs/heads/master | 2021-05-24T18:40:23.917800 | 2020-10-09T14:12:23 | 2020-10-09T14:12:23 | 253,702,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,008 | java | package editor_main;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MenuBar extends JMenuBar {
private static MenuBar menuBar = null;
private JMenu fileMenu, editMenu;
private JMenuItem groupItem, unGroupItem, nameItem;
public MenuBar() {
fileMenu = new JMenu("File");
editMenu = new JMenu("Edit");
groupItem = new JMenuItem("Group");
groupItem.addActionListener(new groupItemListener());
groupItem.setEnabled(false);
unGroupItem = new JMenuItem("UnGroup");
unGroupItem.addActionListener(new unGroupItemListener());
unGroupItem.setEnabled(false);
nameItem = new JMenuItem("Change object name");
nameItem.addActionListener(new nameItemListener());
nameItem.setEnabled(false);
editMenu.add(groupItem);
editMenu.add(unGroupItem);
editMenu.add(nameItem);
this.add(fileMenu);
this.add(editMenu);
}
public static MenuBar getMenuBar() {
if (menuBar == null) {
menuBar = new MenuBar();
}
return menuBar;
}
class groupItemListener implements ActionListener {
public void actionPerformed(ActionEvent e){
Canvas.getInstance().groupObj();
}
}
class unGroupItemListener implements ActionListener {
public void actionPerformed(ActionEvent e){
Canvas.getInstance().unGroupObj();
}
}
class nameItemListener implements ActionListener {
public void actionPerformed(ActionEvent e){
Canvas.getInstance().changeName();
Canvas.getInstance().repaint();
}
}
public void setGroupItem(boolean enable) {
groupItem.setEnabled(enable);
}
public void setUnGroupItem(boolean enable) {
this.unGroupItem.setEnabled(enable);
}
public void setNameItem(boolean enable) {
this.nameItem.setEnabled(enable);
}
}
| [
"spi93017@gmail.com"
] | spi93017@gmail.com |
2973542e743df7e1774603d613f3ffb6c6b5f259 | 2fa92596f6449a9e8597dc22db03da4fb0559138 | /HT2Estructuras/HT2Estructuras/src/ht2estructuras/Lista.java | 38e1017eeabc3b0ccc6842e619472433a9c44e59 | [] | no_license | sergiomarchena16/HT4 | c43da1c7a50d0a937e0edbfb749c7027904e809d | a9d1a03a80a2eaa74e0d1176a1f901278fdfa835 | refs/heads/master | 2021-04-30T12:31:17.330247 | 2018-02-18T00:59:29 | 2018-02-18T00:59:29 | 121,277,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | 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 ht2estructuras;
/**
*
* @author Mafer
*/
public interface Lista<E> extends Stack<E> {
public int size();
// post: returns number of elements in list
public boolean isEmpty();
// post: returns true iff list has no elements
public void addFirst(E value);
// post: value is added to beginning of list
public void addLast(E value);
// post: value is added to end of list
public E getLast();
// pre: list is not empty
// post: returns last value in list
public E remove(int i);
// pre: 0 <= i < size()
// post: removes and returns object found at that location
public E removeLast();
// pre: list is not empty
// post: removes last value from list
}
| [
"31084398+diazMafer@users.noreply.github.com"
] | 31084398+diazMafer@users.noreply.github.com |
1b35235bbce6be3890368d885c28f51c0b1a32a7 | 485d691ce6e20dafd990687d02b4ea5b027cc740 | /demo/gRPC/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java | b2af88273a382afea7da6e5fac6295454db8b07f | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | galaxy0101/miniCassandra | 29acd039d5e81186676506addb7a559aa73548fd | a996a3bc1f21a9bf0a6589d4ba96dfea99a5ff4f | refs/heads/master | 2021-06-14T06:06:44.959881 | 2017-01-18T16:18:43 | 2017-01-18T16:18:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,657 | java | package io.grpc.testing.integration;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 0.15.0-SNAPSHOT)",
comments = "Source: io/grpc/testing/integration/metrics.proto")
public class MetricsServiceGrpc {
private MetricsServiceGrpc() {}
public static final String SERVICE_NAME = "grpc.testing.MetricsService";
// Static method descriptors that strictly reflect the proto.
@io.grpc.ExperimentalApi
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse> METHOD_GET_ALL_GAUGES =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING,
generateFullMethodName(
"grpc.testing.MetricsService", "GetAllGauges"),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Metrics.EmptyMessage.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()));
@io.grpc.ExperimentalApi
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse> METHOD_GET_GAUGE =
io.grpc.MethodDescriptor.create(
io.grpc.MethodDescriptor.MethodType.UNARY,
generateFullMethodName(
"grpc.testing.MetricsService", "GetGauge"),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Metrics.GaugeRequest.getDefaultInstance()),
io.grpc.protobuf.ProtoUtils.marshaller(io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()));
/**
* Creates a new async stub that supports all call types for the service
*/
public static MetricsServiceStub newStub(io.grpc.Channel channel) {
return new MetricsServiceStub(channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static MetricsServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
return new MetricsServiceBlockingStub(channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary and streaming output calls on the service
*/
public static MetricsServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
return new MetricsServiceFutureStub(channel);
}
/**
*/
public static interface MetricsService {
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver);
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver);
}
@io.grpc.ExperimentalApi
public static abstract class AbstractMetricsService implements MetricsService, io.grpc.BindableService {
@java.lang.Override
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_GET_ALL_GAUGES, responseObserver);
}
@java.lang.Override
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnimplementedUnaryCall(METHOD_GET_GAUGE, responseObserver);
}
@java.lang.Override public io.grpc.ServerServiceDefinition bindService() {
return MetricsServiceGrpc.bindService(this);
}
}
/**
*/
public static interface MetricsServiceBlockingClient {
/**
* <pre>
* Returns the values of all the gauges that are currently being maintained by
* the service
* </pre>
*/
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request);
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request);
}
/**
*/
public static interface MetricsServiceFutureClient {
/**
* <pre>
* Returns the value of one gauge
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request);
}
public static class MetricsServiceStub extends io.grpc.stub.AbstractStub<MetricsServiceStub>
implements MetricsService {
private MetricsServiceStub(io.grpc.Channel channel) {
super(channel);
}
private MetricsServiceStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new MetricsServiceStub(channel, callOptions);
}
@java.lang.Override
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncServerStreamingCall(
getChannel().newCall(METHOD_GET_ALL_GAUGES, getCallOptions()), request, responseObserver);
}
@java.lang.Override
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(METHOD_GET_GAUGE, getCallOptions()), request, responseObserver);
}
}
public static class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub<MetricsServiceBlockingStub>
implements MetricsServiceBlockingClient {
private MetricsServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}
private MetricsServiceBlockingStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceBlockingStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new MetricsServiceBlockingStub(channel, callOptions);
}
@java.lang.Override
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
io.grpc.testing.integration.Metrics.EmptyMessage request) {
return blockingServerStreamingCall(
getChannel(), METHOD_GET_ALL_GAUGES, getCallOptions(), request);
}
@java.lang.Override
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_GET_GAUGE, getCallOptions(), request);
}
}
public static class MetricsServiceFutureStub extends io.grpc.stub.AbstractStub<MetricsServiceFutureStub>
implements MetricsServiceFutureClient {
private MetricsServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}
private MetricsServiceFutureStub(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected MetricsServiceFutureStub build(io.grpc.Channel channel,
io.grpc.CallOptions callOptions) {
return new MetricsServiceFutureStub(channel, callOptions);
}
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
io.grpc.testing.integration.Metrics.GaugeRequest request) {
return futureUnaryCall(
getChannel().newCall(METHOD_GET_GAUGE, getCallOptions()), request);
}
}
private static final int METHODID_GET_ALL_GAUGES = 0;
private static final int METHODID_GET_GAUGE = 1;
private static class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final MetricsService serviceImpl;
private final int methodId;
public MethodHandlers(MetricsService serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_ALL_GAUGES:
serviceImpl.getAllGauges((io.grpc.testing.integration.Metrics.EmptyMessage) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
case METHODID_GET_GAUGE:
serviceImpl.getGauge((io.grpc.testing.integration.Metrics.GaugeRequest) request,
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
public static io.grpc.ServerServiceDefinition bindService(
final MetricsService serviceImpl) {
return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
.addMethod(
METHOD_GET_ALL_GAUGES,
asyncServerStreamingCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.EmptyMessage,
io.grpc.testing.integration.Metrics.GaugeResponse>(
serviceImpl, METHODID_GET_ALL_GAUGES)))
.addMethod(
METHOD_GET_GAUGE,
asyncUnaryCall(
new MethodHandlers<
io.grpc.testing.integration.Metrics.GaugeRequest,
io.grpc.testing.integration.Metrics.GaugeResponse>(
serviceImpl, METHODID_GET_GAUGE)))
.build();
}
}
| [
"ustczmk@gmail.com"
] | ustczmk@gmail.com |
3235dcb4def6c0ed093a265b9f3fc5622ad649d5 | 109294eb95d01659f643b86255c0bd6ed5d31e51 | /deferred/src/test/java/com/tuenti/deferred/ProgressPipeCallbackTest.java | 837083c74a5c71e88f487e20b62b20743b5353cf | [
"Apache-2.0"
] | permissive | r598476602/android-deferred | 3ec86f32b582b73d3124e48b93be3312287a110b | c830a9702248d9d3367638cbd730b06f6ea83143 | refs/heads/master | 2021-04-26T21:47:59.530029 | 2017-01-31T17:03:29 | 2017-01-31T17:03:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,529 | java | /*
* Copyright (c) Tuenti Technologies S.L. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tuenti.deferred;
import org.junit.Test;
public class ProgressPipeCallbackTest extends CallbacksTestBase {
@Test
public void testPipeComputationIsExecutedInComputationExecutor() {
givenADeferredObject();
Done.Pipe.Computation<Void, Void, Void, Void> callback = givenAComputationProgressPipe();
whenTheDeferredIsResolvedWithAPipeCallback(callback);
thenTheCallbackIsExecutedOnTheExecutor(computationExecutor);
}
@Test
public void testPipeDiskIsExecutedInDiskExecutor() {
givenADeferredObject();
Done.Pipe.Disk<Void, Void, Void, Void> callback = givenADiskProgressPipe();
whenTheDeferredIsResolvedWithAPipeCallback(callback);
thenTheCallbackIsExecutedOnTheExecutor(diskExecutor);
}
@Test
public void testPipeNetworkIsExecutedInNetworkExecutor() {
givenADeferredObject();
Done.Pipe.Network<Void, Void, Void, Void> callback = givenANetworkProgressPipe();
whenTheDeferredIsResolvedWithAPipeCallback(callback);
thenTheCallbackIsExecutedOnTheExecutor(networkExecutor);
}
private Done.Pipe.Computation<Void, Void, Void, Void> givenAComputationProgressPipe() {
return new Done.Pipe.Computation<Void, Void, Void, Void>() {
@Override
public Promise<Void, Void, Void> pipeDone(Void result) {
return null;
}
};
}
private Done.Pipe.Disk<Void, Void, Void, Void> givenADiskProgressPipe() {
return new Done.Pipe.Disk<Void, Void, Void, Void>() {
@Override
public Promise<Void, Void, Void> pipeDone(Void result) {
return null;
}
};
}
private Done.Pipe.Network<Void, Void, Void, Void> givenANetworkProgressPipe() {
return new Done.Pipe.Network<Void, Void, Void, Void>() {
@Override
public Promise<Void, Void, Void> pipeDone(Void result) {
return null;
}
};
}
private void whenTheDeferredIsResolvedWithAPipeCallback(DonePipe<Void, Void, Void, Void> donePipe) {
deferred.resolve(null).then(donePipe);
}
}
| [
"gmerino@tuenti.com"
] | gmerino@tuenti.com |
8b343b02d7df2ebbc7da5fa721d411821361d9f2 | 254adde206e72bb7f19ce5f1b3377c48519ea296 | /Google/DetectCapital.java | c9f4aca424a7d3baea272a8fdafbaac45d8ac4cf | [] | no_license | rukaiya2000/Competitive_Ques | 35bc2438fc4a9adf392dbbf4f92d1be8d751dccd | 3dc389f71350df9ff27e199bbabe9dc67af29253 | refs/heads/master | 2023-03-19T10:30:23.180945 | 2021-03-10T11:55:44 | 2021-03-10T11:55:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | class Solution {
public boolean detectCapitalUse(String word) {
if(word == null || word.length() <=1)
return true;
boolean prev_cap = true;
for(int i = 0; i<word.length();i++)
{
char ch = word.charAt(i);
System.out.println(ch+" "+prev_cap);
if(Character.isUpperCase(ch))
{
if(prev_cap == true)
continue;
else
return false;
}
if(!Character.isUpperCase(ch) && prev_cap == true && i-1>0)
return false;
prev_cap = false;
}
return true;
}
}
| [
"noreply@github.com"
] | rukaiya2000.noreply@github.com |
1ae2eb6157c90de0ad891ba63b03d904de6d7b6c | b3e41e2c6bb509562a4ca5318e600d1cbfa01a71 | /src/com/work/util/Const.java | 1b7cc570d18efc22f6ebb76cfa440d32d54b3504 | [] | no_license | lishaojunGitHub/es-Final | 1c8d60a430eb98d6718165963b84a7b351597cea | 415591284d5d26bf13ab457d28fd498af2c38ae6 | refs/heads/master | 2021-08-24T14:04:56.976768 | 2017-12-10T04:00:25 | 2017-12-10T04:00:25 | 113,721,591 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package com.work.util;
import java.util.UUID;
public class Const {
public final static String SESSIONCUSTOMER = "sessioncustomer"; //评估系统查询的公司名称
public final static String SESSIONUSER = "sessionusername";
public final static String SESSIONEMPLOYEE = "employee"; //登录用户bean
public final static String INDUSTRY = ""; //行业 电力与电网
public final static int SIZE = 20;
public static void main(String[] args) {
System.out.println(new Const().getAutoId(1));
}
public String getAutoId(int i) {
String s = UUID.randomUUID().toString()+i;
s = s.substring(24, 35);
return s;
}
}
| [
"lishaojun_mail@163.com"
] | lishaojun_mail@163.com |
bca97f6e504a157c14271326c090b05e1806b37c | 259e381f21c1ceb9fc812083bbd3c76c69682ba0 | /monitoring-dashboard/components/org.wso2.ei.dashboard.core/src/main/java/org/wso2/ei/dashboard/core/rest/model/SequenceListInner.java | a970e13e68cbfdd1e30e682cae8f467f275f4230 | [
"Apache-2.0"
] | permissive | sybernix/product-mi-tooling | c8fe31f9379025ca94bc249dba10a13d3838054f | 2f071a65356f8384e1ef8696b1dcc18dda019e5c | refs/heads/master | 2023-06-24T15:05:13.767983 | 2021-01-24T05:55:26 | 2021-01-24T05:55:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,839 | java | /*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*
*/
package org.wso2.ei.dashboard.core.rest.model;
import java.util.ArrayList;
import java.util.List;
import javax.validation.Valid;
import io.swagger.annotations.*;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
public class SequenceListInner {
private @Valid String sequenceName = null;
private @Valid List<Object> nodes = new ArrayList<Object>();
/**
**/
public SequenceListInner sequenceName(String sequenceName) {
this.sequenceName = sequenceName;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("sequenceName")
public String getSequenceName() {
return sequenceName;
}
public void setSequenceName(String sequenceName) {
this.sequenceName = sequenceName;
}
/**
**/
public SequenceListInner nodes(List<Object> nodes) {
this.nodes = nodes;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("nodes")
public List<Object> getNodes() {
return nodes;
}
public void setNodes(List<Object> nodes) {
this.nodes = nodes;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SequenceListInner sequenceListInner = (SequenceListInner) o;
return Objects.equals(sequenceName, sequenceListInner.sequenceName) &&
Objects.equals(nodes, sequenceListInner.nodes);
}
@Override
public int hashCode() {
return Objects.hash(sequenceName, nodes);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SequenceListInner {\n");
sb.append(" sequenceName: ").append(toIndentedString(sequenceName)).append("\n");
sb.append(" nodes: ").append(toIndentedString(nodes)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"dulanjalidilmi@gmail.com"
] | dulanjalidilmi@gmail.com |
3b6e0a4a488c9ae997aa76bb1cd1e6d1704d7d62 | 7570e250953a48bc8455ee96cf580b4596e0ef13 | /hazelcast/src/main/java/com/hazelcast/collection/operations/client/CountRequest.java | be8c971ef61308ed491e974ee781560e34b99e42 | [
"Apache-2.0"
] | permissive | cgchamath/hazelcast-3.0.1 | adc3cb1ebbc4330de91efdb2e0083266da7df67d | d3280e3e2f7b7aa481f5e5bb4e3f139433f4d33b | refs/heads/master | 2021-01-01T06:50:28.230445 | 2014-07-11T09:51:55 | 2014-07-11T09:51:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,414 | java | /*
* Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.collection.operations.client;
import com.hazelcast.client.RetryableRequest;
import com.hazelcast.collection.CollectionPortableHook;
import com.hazelcast.collection.CollectionProxyId;
import com.hazelcast.collection.operations.CountOperation;
import com.hazelcast.nio.serialization.Data;
import com.hazelcast.spi.Operation;
/**
* @author ali 5/10/13
*/
public class CountRequest extends CollectionKeyBasedRequest implements RetryableRequest {
public CountRequest() {
}
public CountRequest(CollectionProxyId proxyId, Data key) {
super(proxyId, key);
}
protected Operation prepareOperation() {
return new CountOperation(proxyId, key);
}
public int getClassId() {
return CollectionPortableHook.COUNT;
}
}
| [
"chamathg@gmail.com"
] | chamathg@gmail.com |
513295ffb3bc06198b3372bc42cad7440d63cdc0 | efa960e65243555d8840545a8099bbd297fb3fa9 | /src/test/java/en/entitties/RegistrationTest.java | 095f344f63a4f13fbcee703104a62b4d70d490eb | [] | no_license | ortolanph/JavaBasicConcepts | 3a104a668a996fb562619252865085e2fc019f89 | e921406bca232266363530e9b55fe539349abf1a | refs/heads/master | 2020-03-06T20:19:56.162355 | 2018-05-22T15:18:28 | 2018-05-22T15:18:28 | 127,050,533 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package en.entitties;
import org.junit.Test;
import java.time.LocalDate;
import java.time.Month;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class RegistrationTest {
@Test
public void signumTest() throws Exception {
Registration registrationX = Registration
.newRegistration(LocalDate.of(2018, Month.JANUARY, 1), 1);
Registration registrationY = Registration
.newRegistration(LocalDate.of(2018, Month.FEBRUARY, 1), 1);
assertTrue(registrationX.compareTo(registrationY) == (registrationY.compareTo(registrationX)) * -1);
}
@Test
public void testarTransitividade() throws Exception {
Registration registrationX = Registration
.newRegistration(LocalDate.of(2018, Month.MARCH, 1), 1);
Registration registrationY = Registration
.newRegistration(LocalDate.of(2018, Month.FEBRUARY, 1), 1);
Registration registrationZ = Registration
.newRegistration(LocalDate.of(2018, Month.JANUARY, 1), 1);
assertTrue(registrationX.compareTo(registrationY) > 0);
assertTrue(registrationY.compareTo(registrationZ) > 0);
assertTrue(registrationX.compareTo(registrationZ) > 0);
}
@Test
public void testarEquals() throws Exception {
Registration registrationX = Registration
.newRegistration(LocalDate.of(2018, Month.MARCH, 1), 1);
Registration registrationY = Registration
.newRegistration(LocalDate.of(2018, Month.MARCH, 1), 1);
assertTrue(registrationX.compareTo(registrationY) == 0);
assertEquals(registrationX, registrationY);
assertTrue(registrationX.compareTo(registrationY) == 0 && registrationX.equals(registrationY));
}
}
| [
"paulo.ortolan@serpro.gov.br"
] | paulo.ortolan@serpro.gov.br |
dc13b3c6be17c7fbd62e75e40506c0c1b523aa40 | 9587494eebe935202a9cd99bb6ecfaaf1d882b13 | /src-interface/net/minecraft/server/NBTTagByteArray.java | 9263995ac89b4441632f25bed1b50631ca017c81 | [
"BSD-3-Clause"
] | permissive | N3X15/MiddleCraft | 92d91b29d784e890302f1559f703a8e42d6be516 | 208135d5b8c082c7280d208c1bface329617adb6 | refs/heads/master | 2021-01-13T01:08:39.139458 | 2011-01-21T10:38:09 | 2011-01-21T10:38:09 | 1,195,198 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 410 | java | // AUTOMATICALLY GENERATED BY MIDDLECRAFT
/* Allows plugins to access server functions without needing to link the actual server Jar. */
package net.minecraft.server;
public abstract class NBTTagByteArray extends NBTBase {
// FIELDS
public byte[] byteArray;
// METHODS
/**
*
*/
public abstract byte MIDDLECRAFT_func_617_a();
/**
* *
*/
public abstract java.lang.String hi_toString();
}
| [
"nexisentertainment@gmail.com"
] | nexisentertainment@gmail.com |
2b976c7027a9426c7e62bdfb995728167c45e892 | bc1f9a27c4535be9a0dc170e006c8a7b58160a6e | /security-custom-form-login/src/main/java/com/vincent/security/example/SecurityCustomFormLoginApplication.java | ddbd26b14f281f5fc8e92aee4c19508f8ed632c2 | [] | no_license | JiangYongKang/spring-boot-security-example | e3c1ae418a44af2073e4c42048cd24ff37230a99 | 8d6809a7800cbca784f8671756fe0de18b0ba609 | refs/heads/master | 2020-03-20T01:15:10.556431 | 2019-01-16T05:20:40 | 2019-01-16T05:20:40 | 137,070,668 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | package com.vincent.security.example;
import com.vincent.security.example.model.MemberEntity;
import com.vincent.security.example.repository.MemberRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.security.crypto.password.PasswordEncoder;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
/**
* Author: vincent
* DateTime: 2019/1/15 21:18
* Comment:
*/
@SpringBootApplication
public class SecurityCustomFormLoginApplication {
@Resource
private MemberRepository repository;
@Resource
private PasswordEncoder encoder;
@PostConstruct
public void initDatabase() {
repository.save(
new MemberEntity(1, "example@mail.com", encoder.encode("123456"), 0)
);
}
public static void main(String[] args) {
SpringApplication.run(SecurityCustomFormLoginApplication.class, args);
}
}
| [
"vincent4502237@gmail.com"
] | vincent4502237@gmail.com |
5c62467c221b559f4ca3a050a022250b5dc5761c | 3bd3d96b4457374aaabfcc3851a38b0243bc8cda | /zaoczne/semestr6/src/zaj6/FXFormExample.java | b37bdfe8cd6734c963c471bde16ee76a05708f2a | [] | no_license | kpodlaski/Java2019 | 5326e4824e46bbb27cffa0259fdd7c47bb519d97 | a78d36c32d29ef291bae8635461a0281099be8c0 | refs/heads/master | 2021-06-29T03:10:34.597587 | 2019-06-01T10:35:21 | 2019-06-01T10:35:21 | 170,996,046 | 0 | 2 | null | 2020-10-13T13:21:57 | 2019-02-16T11:27:20 | Java | UTF-8 | Java | false | false | 2,303 | java | package zaj6;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class FXFormExample extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("JavaFX Welcome");
GridPane grid = new GridPane();
grid.setAlignment(Pos.CENTER);
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(25, 25, 25, 25));
Text scenetitle = new Text("Welcome");
//scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
scenetitle.setId("welcome_text");
grid.add(scenetitle, 0, 0, 2, 1);
Label userName = new Label("User Name:");
grid.add(userName, 0, 1);
TextField userTextField = new TextField();
grid.add(userTextField, 1, 1);
Label pw = new Label("Password:");
grid.add(pw, 0, 2);
PasswordField pwBox = new PasswordField();
grid.add(pwBox, 1, 2);
Button btn = new Button("Sign in");
HBox hbBtn = new HBox(10);
hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
hbBtn.getChildren().add(btn);
grid.add(hbBtn, 1, 4);
Text actiontarget = new Text();
grid.add(actiontarget, 1, 6);
actiontarget.setId("actiontarget");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
actiontarget.setFill(Color.FIREBRICK);
actiontarget.setText("Sign in button pressed");
}
});
Scene scene = new Scene(grid, 500, 275);
scene.getStylesheets().add(this.getClass().getResource("style.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
| [
"podlaski@uni.lodz.pl"
] | podlaski@uni.lodz.pl |
20d75b5727dca33335bd1bcc7bca5a94ac5dd669 | fea3428073a340bd416fbf1d369f08d74f1e81d4 | /carteautresor/src/main/java/model/Case.java | 628f75eb9d37ecb6eeef5d3737d35526181ca15c | [] | no_license | YunBoz69/Carteautresor | 80af35fe64dcb3f2037adee40717f9a173379317 | 088347e492a3d5bfc95f2b0c43485256194a5e34 | refs/heads/master | 2022-12-28T19:07:04.521192 | 2020-10-14T21:58:28 | 2020-10-14T21:58:28 | 304,144,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package model;
public abstract class Case {
private final Position position;
public Case(Position position){
this.position = position;
}
public Position getPosition(){
return position;
}
}
| [
"bozkur_y@etna-alternance.net"
] | bozkur_y@etna-alternance.net |
f6216b32edb0342580e1398b691b23934cdd0674 | a2f044892ba966c8062cdd137054f8b0c13d7f41 | /app/src/androidTest/java/wakeb/tech/drb/ExampleInstrumentedTest.java | 50ba5849b57bc2d4169bfcbff33916f64383d25f | [] | no_license | ahmedtaher3/DRB_Version2 | a121d4fe55e6cdb5433a86bd05a3d4e56d6e96e9 | e0e66304c2aa86efe27bc20c32b1e8a53341c65d | refs/heads/master | 2020-09-18T06:03:55.491860 | 2019-12-04T15:30:10 | 2019-12-04T15:30:10 | 224,131,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 699 | java | package wakeb.tech.drb;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("wakeb.tech.drb", appContext.getPackageName());
}
}
| [
"ahmedtaher376@gmail.com"
] | ahmedtaher376@gmail.com |
58f912564dd978eb75d4fd49d6ff6d3f1317c491 | e2b37dcf068868b9282521af5fdfb416d4e9d6c6 | /src/Horse.java | 9090233c2ebab9f5da754b4d1beff3e9b632e8ca | [] | no_license | GuillermoDeLeon/codeup-java-exercises | 5c9bbbfde0df07a20e8dfa651c69727e0eec4930 | 7d9787d515defc37ef37e3c265574dc9d0c3df03 | refs/heads/master | 2021-04-05T10:04:00.890132 | 2020-04-27T03:02:01 | 2020-04-27T03:02:01 | 248,544,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package LiveDemo;
import java.util.Scanner;
public class Horse {
public boolean flowingMain;
public boolean shoes;
public String color;
public String breed;
private boolean lungExpanded;
public static long numberOfHorses;
private static Scanner scanner;
public static void setScanner(Scanner s) {
scanner = s;
}
public void letUserEnterColor() {
System.out.println("Enter the horse color as a string: ");
color = scanner.nextLine();
}
public static long getNumberOfHorses() {
return numberOfHorses;
}
public void breath() {
lungExpanded = true;
}
public void exhale() {
lungExpanded = false;
}
public void setBreed(String breed) {
this.breed = breed;
}
public void setColor(String color) {
this.color = color;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
Horse.setScanner(s);
System.out.println(Horse.getNumberOfHorses());
Horse myHorse = new Horse();
myHorse.letUserEnterColor();
myHorse.breath();
System.out.printf("The color is: %s.\n", myHorse.color);
}
}
| [
"guillermo.x.deleon@gmail.com"
] | guillermo.x.deleon@gmail.com |
e0f65c0d8904621bb9ebb39fc911fe8325ed537a | eab88dd4865eb25b0c440504df1811575796b4fe | /src/kr/or/ddit/member/dao/IMemberDaoImpl.java | 6cfcc211661df0a6bae8b955f625a7c24533306c | [] | no_license | KimJeongMin111/JeongMinKim | f7b5e00e61e2a027e9d92b9d186da9c2246f6e1b | 688cd5e5c701bd9c845ced06f725dadf47dfa027 | refs/heads/master | 2020-09-02T02:04:12.421735 | 2019-11-02T05:45:30 | 2019-11-02T05:45:57 | 219,109,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package kr.or.ddit.member.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import com.ibatis.sqlmap.client.SqlMapClient;
import kr.or.ddit.ibatis.factory.SqlMapClientFactory;
import kr.or.ddit.vo.MemberVO;
public class IMemberDaoImpl implements IMemberDao {
private static IMemberDao dao = new IMemberDaoImpl();
private SqlMapClient client;
private IMemberDaoImpl(){
client = SqlMapClientFactory.getSqlMapClient();
}
public static IMemberDao getInstance(){
return (dao != null) ? dao = new IMemberDaoImpl() : dao;
}
@Override
public MemberVO memberInfo(Map<String, String> params) throws SQLException {
return (MemberVO) client.queryForObject("member.memberInfo", params);
}
@Override
public List<MemberVO> memberList() throws SQLException {
return client.queryForList("member.memberList");
}
@Override
public void insertMemberInfo(MemberVO memberInfo) throws SQLException {
client.insert("member.insertMember", memberInfo);
}
@Override
public void updateMemberInfo(MemberVO memberInfo) throws SQLException {
//동적인 테이블 생성, 시퀀스 생성, 뷰 생성, 유저 생성..
client.update("member.updateMember", memberInfo);
}
@Override
public void deleteMemberInfo(Map<String, String> params)
throws SQLException {
client.update("member.deleteMember", params);
}
}
| [
"gyung_123@hanmail.net"
] | gyung_123@hanmail.net |
af28ac0530647234c496a868c0846167d9c2f273 | f1d821b934fcf248e9afc066f79b6afd6d1c5c28 | /potbs4j/src/main/java/com/ashlux/potbs/potbs4j/services/PotbsService.java | cf9a3a2bd5e7abc4d8b6b77fa28a455e80dad366 | [] | no_license | ashlux/potbs4j | 982e9036883eb4f7e6f4d1c30b315ea99069845a | b06e55c8a6bde455c2250368dd0b59f0424de413 | refs/heads/master | 2022-07-26T12:18:05.295387 | 2009-05-31T06:34:11 | 2009-05-31T06:34:11 | 172,512 | 1 | 0 | null | 2022-07-01T22:17:44 | 2009-04-10T04:46:03 | Java | UTF-8 | Java | false | false | 270 | java | package com.ashlux.potbs.potbs4j.services;
public interface PotbsService
{
/**
* Minimum number of minutes this service is cached for and should not be recalled.
*
* @return update frequency in minutes
*/
long getMinimumUpdateFrequency();
}
| [
"ashlux@gmail.com"
] | ashlux@gmail.com |
2f9bb20ecce1e9e959d72cbaf860deb90bba6540 | 3b02018fb5a30b79c5997393f1dd15d66efe8240 | /CS_3330 Object Oriented Programming (Java)/CMP_SC_3330/HickmanjvMaintenanceTracker/src/hickmanjvmaintenancetracker/HickmanjvMaintenanceTracker.java | 2b6336429e06c9ce2dde6559d77da3eb632e63a0 | [
"MIT"
] | permissive | hickmanjv/hickmanjv | 7152d431dae55a63ae5f424110e5ead299f09bb8 | 390e22317b9ace552855897af19963ffb416b1b7 | refs/heads/master | 2022-12-08T21:35:40.501404 | 2020-07-06T19:05:30 | 2020-07-06T19:05:30 | 235,876,979 | 0 | 0 | MIT | 2022-12-06T03:48:41 | 2020-01-23T20:09:31 | JavaScript | UTF-8 | Java | false | false | 1,291 | java | /*
* Student: @author Josh Hickman - hickmanjv
* Student ID: 10236503
* Assignment: - HickmanjvMaintenanceTracker
* Program that will keep track of maintenance requests entered into a table
*/
package hickmanjvmaintenancetracker;
import javafx.application.Application;
import static javafx.application.Application.STYLESHEET_MODENA;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.HBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class HickmanjvMaintenanceTracker extends Application {
@Override
public void start(Stage stage) {
HBox root = new HBox();
root.setPrefSize(600, 400);
root.setAlignment(Pos.CENTER);
Text message = new Text("Error occured while switching scenes");
message.setFont(Font.font(STYLESHEET_MODENA, 32));
root.getChildren().add(message);
Scene scene = new Scene(root);
Switcher.scene = scene;
Switcher.switchTo("StartWindow");
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"hickmanjv@health.missouri.edu"
] | hickmanjv@health.missouri.edu |
3b62aca780e0c6f396ca8ca8a3ec5ab7a74c988a | c76efba0f8f9c7e36a08011f72c5399c464a0122 | /src/test/java/hello/CustomerProfileControllerIT.java | 6d9eeccb3d56a8de5d2a8557dde9c1c34694ef10 | [] | no_license | satyajit2010/Retail_Marketing_Rest | 313736afa4c2036afa8a4c73588eb3e503117c86 | 084dac53d65a9d2d3439375f3dced904dd6bf70f | refs/heads/master | 2021-01-18T09:54:50.715451 | 2015-08-13T23:24:44 | 2015-08-13T23:24:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package hello;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import java.net.URL;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;
import com.ss.retail.mkt.boot.manager.RetailMarketBootManager;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = RetailMarketBootManager.class)
@WebAppConfiguration
@IntegrationTest({"server.port=0"})
public class CustomerProfileControllerIT {
@Value("${local.server.port}")
private int port;
private URL base;
private RestTemplate template;
@Before
public void setUp() throws Exception {
this.base = new URL("http://localhost:" + port + "/register/customer");
template = new TestRestTemplate();
}
@Test
public void getHello() throws Exception {
ResponseEntity<String> response = template.getForEntity(base.toString(), String.class);
assertThat(response.getBody(), equalTo("Retail Market Welcomes You!"));
}
}
| [
"sureshkumar_garlapati@yahoo.com"
] | sureshkumar_garlapati@yahoo.com |
d73b9e20df3d42befc8c3bdc9b272b649dfb42eb | 9ca3ec164b734e6fdba2cb1405f58b4453148860 | /SE3340.005-TeamProject-master/src/mars/venus/HelpAboutAction.java | 2c335a67a6954f0424cf38a80ec9f2694e1a32e1 | [
"MIT"
] | permissive | SaranSundar/MARS-Graphics-Extension | d9dc8887489e264b6d497e4ff7b033573dd4faf1 | 7c4aea942226825819e44f5cdcc685ace0eacf6f | refs/heads/master | 2020-03-18T22:25:00.783712 | 2018-05-29T19:37:41 | 2018-05-29T19:37:41 | 135,344,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,869 | java | package mars.venus;
import mars.Globals;
import javax.swing.*;
import java.awt.event.ActionEvent;
/*
Copyright (c) 2003-2006, Pete Sanderson and Kenneth Vollmar
Developed by Pete Sanderson (psanderson@otterbein.edu)
and Kenneth Vollmar (kenvollmar@missouristate.edu)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject
to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(MIT license, http://www.opensource.org/licenses/mit-license.html)
*/
/**
* Action for the Help -> About menu item
*/
public class HelpAboutAction extends GuiAction {
public HelpAboutAction(String name, Icon icon, String descrip,
Integer mnemonic, KeyStroke accel, VenusUI gui) {
super(name, icon, descrip, mnemonic, accel, gui);
}
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(mainUI,
"MARS " + Globals.version + " Copyright " + Globals.copyrightYears + "\n" +
Globals.copyrightHolders + "\n" +
"MARS is the Mips Assembler and Runtime Simulator.\n\n" +
"Mars image courtesy of NASA/JPL.\n" +
"Toolbar and menu icons are from:\n" +
" * Tango Desktop Project (tango.freedesktop.org),\n" +
" * glyFX (www.glyfx.com) Common Toolbar Set,\n" +
" * KDE-Look (www.kde-look.org) crystalline-blue-0.1,\n" +
" * Icon-King (www.icon-king.com) Nuvola 1.0.\n" +
"Print feature adapted from HardcopyWriter class in David Flanagan's\n" +
"Java Examples in a Nutshell 3rd Edition, O'Reilly, ISBN 0-596-00620-9.",
"About Mars",
JOptionPane.INFORMATION_MESSAGE,
new ImageIcon("images/RedMars50.gif"));
}
} | [
"saransszg@gmail.com"
] | saransszg@gmail.com |
86ca0976c95301f1fa51fd7fb0cd86ca4cebdba1 | 97e3b3bdbd73abe9ba01b5abe211d8b694301f34 | /源码分析/spring/spring-framework-5.1.5.RELEASE/spring-test/src/main/java/org/springframework/test/context/junit/jupiter/DisabledIfCondition.java | e6820235493918dcd8bd9bbacb7a7c2cc741fdc6 | [
"Apache-2.0",
"MIT"
] | permissive | yuaotian/java-technology-stack | dfbbef72aeeca0aeab91bc309fcce1fb93fdabf0 | f060fea0f2968c2a527e8dd12b1ccf1d684c5d83 | refs/heads/master | 2020-08-26T12:37:30.573398 | 2019-05-27T14:10:07 | 2019-05-27T14:10:07 | 217,011,246 | 1 | 0 | MIT | 2019-10-23T08:49:43 | 2019-10-23T08:49:42 | null | UTF-8 | Java | false | false | 1,902 | java | /*
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.junit.jupiter;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExtensionContext;
/**
* {@code DisabledIfCondition} is an {@link org.junit.jupiter.api.extension.ExecutionCondition}
* that supports the {@link DisabledIf @DisabledIf} annotation when using the <em>Spring
* TestContext Framework</em> in conjunction with JUnit 5's <em>Jupiter</em> programming model.
*
* <p>Any attempt to use the {@code DisabledIfCondition} without the presence of
* {@link DisabledIf @DisabledIf} will result in an <em>enabled</em>
* {@link ConditionEvaluationResult}.
*
* @author Sam Brannen
* @since 5.0
* @see DisabledIf
* @see EnabledIf
* @see SpringExtension
*/
public class DisabledIfCondition extends AbstractExpressionEvaluatingCondition {
/**
* Containers and tests are disabled if {@code @DisabledIf} is present on the
* corresponding test class or test method and the configured expression evaluates
* to {@code true}.
*/
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {
return evaluateAnnotation(DisabledIf.class, DisabledIf::expression, DisabledIf::reason,
DisabledIf::loadContext, false, context);
}
}
| [
"626984947@qq.com"
] | 626984947@qq.com |
19258a27460e81720aa6e416f783c3c8d04e36ae | 02272a76d380d2340db5f614a52ee800d6a0fcbd | /crm-application/src/com/src/java/crm/web/LoginController.java | b3da849a99491d9ebf8462e30f06514d2a00a6d0 | [] | no_license | ibneyali/crm-application | 042cd0dfe4e871dd79cf29885960ccb19c967a9e | c09ae0d868892d6954d1d81f343eefbb92d4e02e | refs/heads/master | 2020-12-01T10:01:17.538244 | 2020-10-22T17:26:37 | 2020-10-22T17:26:37 | 230,605,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,488 | java | package com.src.java.crm.web;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.src.java.crm.dto.User;
import com.src.java.crm.services.CrmUserService;
@WebServlet(urlPatterns = "/validateLogin")
public class LoginController extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String nextPage = "";
int roleId = Integer.parseInt(req.getParameter("roleId"));
String loginId = req.getParameter("username");
String password = req.getParameter("password");
CrmUserService gPSUserService = new CrmUserService();
User user = null;
try {
user = gPSUserService.validateCRMUser(loginId, password, roleId);
HttpSession session = req.getSession(true);
session.setAttribute("UserDetails", user);
nextPage = "index.jsp";
} catch (RuntimeException rt) {
rt.printStackTrace();
req.setAttribute("eMsg", rt.getMessage());
req.setAttribute("loginId", loginId);
switch (roleId) {
case 1:
nextPage = "adminLogin";
break;
case 2:
nextPage = "customerLogin";
break;
// TODO
}
}
RequestDispatcher rd = req.getRequestDispatcher(nextPage);
rd.forward(req, resp);
}
}
| [
"ali@liberintechnologies.com"
] | ali@liberintechnologies.com |
0b80657cfd36e53af523f4dd9ebae4664f8c62e7 | c8e7aa530014216a3ac48d85f52c43cf88c849f9 | /app/src/main/java/com/duanlei/simplenet/config/HttpUrlConnConfig.java | b90d91b65fe72e35f995dd48d81e762b72488c09 | [] | no_license | nspduanlei/SimpleNetFramework | d002faba77215e3ae585d693b4b059fbc4b2a71e | c5139e2fa1a99e726d4cd387710f8d8eb9ec2680 | refs/heads/master | 2021-01-10T05:49:09.312098 | 2015-12-03T11:02:49 | 2015-12-03T11:02:49 | 47,326,279 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package com.duanlei.simplenet.config;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
/**
* Author: duanlei
* Date: 2015-12-03
*
* 这是针对于使用HttpUrlStack执行请求时为https请求设置的SSLSocketFactory和HostnameVerifier的配置类,参考
* http://blog.csdn.net/xyz_lmn/article/details/8027334,http://www.cnblogs.com/
* vus520/archive/2012/09/07/2674725.html,
*/
public class HttpUrlConnConfig extends HttpConfig {
private static HttpUrlConnConfig sConfig = new HttpUrlConnConfig();
private SSLSocketFactory mSslSocketFactory = null;
private HostnameVerifier mHostnameVerifier = null;
private HttpUrlConnConfig() {
}
public static HttpUrlConnConfig getConfig() {
return sConfig;
}
/**
* 配置https请求的SSLSocketFactory与HostnameVerifier
*
* @param sslSocketFactory
* @param hostnameVerifier
*/
public void setHttpsConfig(SSLSocketFactory sslSocketFactory,
HostnameVerifier hostnameVerifier) {
mSslSocketFactory = sslSocketFactory;
mHostnameVerifier = hostnameVerifier;
}
public HostnameVerifier getHostnameVerifier() {
return mHostnameVerifier;
}
public SSLSocketFactory getSslSocketFactory() {
return mSslSocketFactory;
}
}
| [
"455483293@qq.com"
] | 455483293@qq.com |
0a55517f3029d5708ee4c5969b32f774b0ce5e66 | ec4b79258467c706f5de165e1e2ba4af7683ab6e | /src/Demo1.java | 54551c47ac945e59abbc188f3ddc1dc990af1dc0 | [] | no_license | zd9453/javaMaybe | b78dca5d298b94ac0cf00811debdc64085ce2a2e | d70d9893e1d9d50d12baf97ca3dc9da50be04823 | refs/heads/master | 2023-08-01T13:28:37.059088 | 2021-09-18T09:16:22 | 2021-09-18T09:16:22 | 274,286,643 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | import inteface.BaseInterface;
import inteface.Inter;
import inteface.Interface1;
/**
* ProjectName: javaMaybe
* Package: PACKAGE_NAME
* className: Demo1
* describe:
* create by "zhangDong"
* createDate: 2019/9/29 0029
* createTime: 13:45
*/
public class Demo1 implements BaseInterface {
@Override
public void doBaseThring() {
}
class Demo2 implements Interface1 {
@Override
public void doInterface1Thring() {
}
@Override
public void doBaseThring() {
}
}
class Demo3 implements Inter {
@Override
public void doInterTring() {
}
@Override
public void doInterface1Thring() {
}
@Override
public void doBaseThring() {
}
}
}
| [
"zhangdong0921@139.com"
] | zhangdong0921@139.com |
f22e9ef323a9a0633326c8866ec36c806c9a1f2c | 7ad342704ff953f76f95c8118f3a29dec4df9aa8 | /src/main/java/com/practice/todo/repositories/UserRepository.java | efd17a333108a755718c95424005e20e1457a6c7 | [] | no_license | DivyaB28/todoservice | c654a97d59a383b07d5bf60c8bb88522451ce64b | 3fb56ca0aa0df2b8e0775dd0e817ef0886405f01 | refs/heads/master | 2023-06-04T11:49:01.434929 | 2021-06-22T14:58:52 | 2021-06-22T14:58:52 | 379,305,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package com.practice.todo.repositories;
import com.practice.todo.models.User;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Long> {
}
| [
"divyab@Divyas-MacBook-Pro.local"
] | divyab@Divyas-MacBook-Pro.local |
7f1181af5efcbf9d7031ea4bf6f156236a1d6487 | 34ee1771c6809c621041e1249bae92041c2eb431 | /app/src/main/java/de/appmotion/popularmovies/data/source/remote/NetworkLoader.java | ca66484a6d33cf904d78b3e6c1d48e04f2c94939 | [] | no_license | appmotion/PopularMovies | 99df026688e72237bfa08d9b6d6ac855a4d4c997 | 1266d2cbf75bdb3d722506b639a7fb1003af3c8f | refs/heads/master | 2020-04-05T10:14:07.088783 | 2018-04-03T12:37:20 | 2018-04-03T12:37:20 | 81,563,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,252 | java | package de.appmotion.popularmovies.data.source.remote;
import android.content.Context;
import android.support.annotation.StringDef;
import android.support.v4.content.AsyncTaskLoader;
import android.text.TextUtils;
import de.appmotion.popularmovies.App;
import de.appmotion.popularmovies.BuildConfig;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.URL;
import java.util.Scanner;
import okhttp3.Request;
import okhttp3.Response;
/**
* Use OkHttp inside this AsyncTaskLoader to get data from themoviedb.org.
*/
public class NetworkLoader extends AsyncTaskLoader<String> {
// Name of the URL sent via Bundle to this Loader
public final static String EXTRA_QUERY_URL = BuildConfig.APPLICATION_ID + ".query_url";
// Define {@link ErrorType} Types
public static final String EMPTY = "empty";
public static final String API_ERROR = "api_error";
public static final String OFFLINE = "offline";
// Url for this AsyncTaskLoader
private URL mUrl;
// Caching: This String will contain the raw JSON from the server results
// We dont need this, because OkHttp is already doing caching in a smarter way.
private String mJson;
/**
* Load Data from Network
*
* @param context current context
* @param url the URL to which this Loader should connect.
*/
public NetworkLoader(Context context, URL url) {
super(context);
mUrl = url;
}
@Override protected void onStartLoading() {
// If no URL was passed, we don't have a query to perform. Simply return.
if (mUrl == null) {
return;
}
// Show the loading indicator
//mLoadingIndicator.setVisibility(View.VISIBLE);
/*
* If we already have cached results, just deliver them now. If we don't have any
* cached results, force a load.
*/
/*
if (mJson != null) {
deliverResult(mJson);
} else {
forceLoad();
}
*/
// Force a load
forceLoad();
}
@Override public String loadInBackground() {
// If the URL is empty, there's nothing to search for
if (mUrl == null || TextUtils.isEmpty(mUrl.toString())) {
return null;
}
// Use OkHttp to get response from Server
try {
Request request = new Request.Builder().url(mUrl).get().build();
Response response = App.getInstance().getOkHttpClient().newCall(request).execute();
switch (response.code()) {
case 200:
Scanner scanner = new Scanner(response.body().byteStream());
scanner.useDelimiter("\\A");
boolean hasInput = scanner.hasNext();
if (hasInput) {
return scanner.next();
} else {
return EMPTY;
}
// response.code() is not 200
default:
return API_ERROR;
}
} catch (IOException e) {
e.printStackTrace();
return OFFLINE;
}
}
/**
* Used for caching response from server to mJson
*
* @param json the response from server
*/
@Override public void deliverResult(String json) {
mJson = json;
super.deliverResult(json);
}
@Retention(RetentionPolicy.CLASS) @StringDef({ EMPTY, API_ERROR, OFFLINE }) public @interface ErrorType {
}
}
| [
"thimo@appmotion.de"
] | thimo@appmotion.de |
c018c5f635fd92ba75bfa4c264a7e4c904197f13 | dbad68c04f9ba2856f918e8cd0f24ea97249636f | /bank-entity-boot/src/main/java/co/edu/usbcali/bank/service/OperacionBancaria.java | f8558a52c1cfc894e0afd61e828920879eb110eb | [] | no_license | carmel01/Curso_java | c393a69e9ad89b85afc64880ba887c9918d16b1b | e45c80da27993bda3aa5b143c312d46807aaee5b | refs/heads/master | 2023-01-22T20:14:14.799646 | 2019-10-22T01:55:17 | 2019-10-22T01:55:17 | 212,219,890 | 0 | 0 | null | 2023-01-07T10:48:59 | 2019-10-01T23:42:26 | TSQL | UTF-8 | Java | false | false | 412 | java | package co.edu.usbcali.bank.service;
import java.math.BigDecimal;
public interface OperacionBancaria {
public Long retirar(String cuenId,BigDecimal valor,String usuUsuario)throws Exception;
public Long consignar(String cuenId,BigDecimal valor,String usuUsuario)throws Exception;
public Long transferir(String cuenIdOrigen,String cuenIdDestino,BigDecimal valor,String usuUsuario)throws Exception;
}
| [
"salas@M520.usbcali.edu.co"
] | salas@M520.usbcali.edu.co |
06381d728922718c12a2af2b3a7bde009295421b | 12a33161c7bd34ba1823f5ad442297b2694027b3 | /src/interviewqustions/PrintUserNumber.java | 91db6df355504bfa8c790604c68313301f124af9 | [] | no_license | smhrash/SarkerJava | 161dcca4216724bb431519bdd1663acedc80c187 | aa002cd74e3daacfee4de826fc702dcbdff494e7 | refs/heads/master | 2023-01-21T04:51:40.161510 | 2020-11-30T18:09:37 | 2020-11-30T18:09:37 | 278,990,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package interviewqustions;
import java.util.Scanner;
public class PrintUserNumber {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Please enter a number");
int num=sc.nextInt();
System.out.println("You entered "+num);
}
}
| [
"smhrash@gmail.com"
] | smhrash@gmail.com |
25cf039bad4651e39a24618a60d1e5845b9d1d0e | c1658c7e80a8be3b86c3c57a561a49f9f2078c04 | /library-database/library-query/src/main/java/com/graduation/library/service/impl/UserServiceImpl.java | 55729dd862b730969982d5a00d1981fd4030b0ae | [] | no_license | luo2646212315/library | ac9e08102544b1c1b2c15751449d0cf814b2a138 | 476c81db50b417a9056500487ad18aaf4d5ddd81 | refs/heads/master | 2022-07-20T16:11:48.147860 | 2019-12-25T09:24:44 | 2019-12-25T09:24:44 | 229,235,110 | 1 | 0 | null | 2022-06-17T02:45:48 | 2019-12-20T09:38:59 | Java | UTF-8 | Java | false | false | 625 | java | package com.graduation.library.service.impl;
import com.graduation.library.domain.entity.TestUser;
import com.graduation.library.mapper.TestUserMapper;
import com.graduation.library.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Description :
* @Author : luomingjin
* @Date: 2019-12-25 15:06
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
TestUserMapper testUserMapper;
@Override
public TestUser finduser(Integer id) {
return testUserMapper.selectByPrimaryKey(id);
}
}
| [
"2646212315@qq.com"
] | 2646212315@qq.com |
ec425b7c83c4e46494047aec13ebd3017ccfd2f1 | aade51aabb74d41f40b40f773bb0a57f85901ef5 | /src/main/java/org/sfsu/post/manager/ProductCatalog.java | 20fb6b6db7fef5c561f72f57b4a7bc3c89bff00b | [] | no_license | ivanw-yu/csc668backup | 19c58d538c13390477b9618ee99856c90b0408fe | 88e02f339322766a14c5c20ed4fa875598202603 | refs/heads/master | 2020-05-30T01:31:11.933588 | 2017-02-21T01:05:03 | 2017-02-21T01:05:03 | 82,619,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,984 | java | package org.sfsu.post.manager;
/**
* Created by adisonlee on 2/7/17.
*
* Init by Store
*
* ProductCatalog used by Store to create a product catalog
**/
public class ProductCatalog
{
private ProductSpec productCatalog[];
private int productLineCount;
private int maxProductsInCatalog = 100;
// default constructor
ProductCatalog()
{
productCatalog = new ProductSpec[maxProductsInCatalog];
productLineCount = 0;
}
// adds one product w/ specs into catalog
void addProduct(ProductSpec product)
{
if(productLineCount < maxProductsInCatalog)
{
productCatalog[productLineCount++] = product;
}
else
{
System.out.println("Catalog is full.");
}
}
// check if given UPC exist in product catalog
public boolean validUPC(String productUPC)
{
for(int i = 0; i < productLineCount; i++)
{
if(productCatalog[i].getItemUPC().equals(productUPC))
{
return true;
}
}
return false;
}
// V: added method to retrieve ProductSpec
public ProductSpec getProduct(String productUPC){
for(int i = 0; i < productLineCount; i++){
if(productUPC.equals(productCatalog[i].getItemUPC())){
return productCatalog[i];
}
}
return null;
}
// returns true if catalog reaches 100 lines
boolean productCatalogIsFull()
{
return productLineCount == maxProductsInCatalog;
}
// prints formatted catalog onto console
void displayProductCatalog()
{
ProductSpec printProductSpecs;
for(int i = 0; i < productLineCount; i++)
{
printProductSpecs = productCatalog[i];
System.out.printf("%-10s%-15s%-10s\n", printProductSpecs.getItemUPC(), printProductSpecs.getItemDescription(), printProductSpecs.getItemPrice());
}
}
}
| [
"ivnyu@mail.sfsu.edu"
] | ivnyu@mail.sfsu.edu |
c8b4dd9f290645d038cb9013aba15c32c0386f2d | 0b0b98a13f5e6f13d991758c4bf1615e038cd525 | /src/main/java/ch/spacebase/openclassic/api/event/entity/EntityEvent.java | 0f771c103734b66e633057bec0e382c48fc226d8 | [
"MIT"
] | permissive | good2000mo/OpenClassicAPI | 6101ede1ab9e79eeeb7023d13330f0eb54f44159 | c79038336a2bfb4c677313ee74d6c8b293d4d385 | refs/heads/master | 2020-05-20T02:49:07.861275 | 2013-04-30T01:45:58 | 2013-04-30T01:45:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package ch.spacebase.openclassic.api.event.entity;
import ch.spacebase.openclassic.api.entity.BlockEntity;
import ch.spacebase.openclassic.api.event.Event;
/**
* Represents an event involving an entity.
*/
public abstract class EntityEvent extends Event {
private BlockEntity entity;
public EntityEvent(EventType type, BlockEntity entity) {
super(type);
this.entity = entity;
}
/**
* Gets the entity involved in this event.
* @return The involved entity.
*/
public BlockEntity getEntity() {
return this.entity;
}
}
| [
"good2000mo@hotmail.com"
] | good2000mo@hotmail.com |
2eeddf1ab9c0475cce54c670000d3413ffc36956 | 92f7ba1ebc2f47ecb58581a2ed653590789a2136 | /src/com/infodms/dms/po/TtAsWrSpecialChargeAuditPO.java | 22de8e1086ae92558fe8b2a93d7a418f690a194e | [] | no_license | dnd2/CQZTDMS | 504acc1883bfe45842c4dae03ec2ba90f0f991ee | 5319c062cf1932f8181fdd06cf7e606935514bf1 | refs/heads/master | 2021-01-23T15:30:45.704047 | 2017-09-07T07:47:51 | 2017-09-07T07:47:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,863 | java | /*
* Copyright (c) 2005 Infoservice, Inc. All Rights Reserved.
* This software is published under the terms of the Infoservice Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* CreateDate : 2013-06-18 20:10:59
* CreateBy : Administrator
* Comment : generate by com.sgm.po.POGen
*/
package com.infodms.dms.po;
import java.util.Date;
import com.infoservice.po3.bean.PO;
@SuppressWarnings("serial")
public class TtAsWrSpecialChargeAuditPO extends PO{
private Long spaId;
private Long oemCompanyId;
private Integer var;
private Long userId;
private Long updateBy;
private Date updateDate;
private Long speId;
private Long createBy;
private Date createDate;
public void setSpaId(Long spaId){
this.spaId=spaId;
}
public Long getSpaId(){
return this.spaId;
}
public void setOemCompanyId(Long oemCompanyId){
this.oemCompanyId=oemCompanyId;
}
public Long getOemCompanyId(){
return this.oemCompanyId;
}
public void setVar(Integer var){
this.var=var;
}
public Integer getVar(){
return this.var;
}
public void setUserId(Long userId){
this.userId=userId;
}
public Long getUserId(){
return this.userId;
}
public void setUpdateBy(Long updateBy){
this.updateBy=updateBy;
}
public Long getUpdateBy(){
return this.updateBy;
}
public void setUpdateDate(Date updateDate){
this.updateDate=updateDate;
}
public Date getUpdateDate(){
return this.updateDate;
}
public void setSpeId(Long speId){
this.speId=speId;
}
public Long getSpeId(){
return this.speId;
}
public void setCreateBy(Long createBy){
this.createBy=createBy;
}
public Long getCreateBy(){
return this.createBy;
}
public void setCreateDate(Date createDate){
this.createDate=createDate;
}
public Date getCreateDate(){
return this.createDate;
}
} | [
"wanghanxiancn@gmail.com"
] | wanghanxiancn@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.