blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1e08a1ab6c6c4e3085af13d3a8e2eda520194112 | 77fb5c3e21d05db9d897bc75481df332aef4fa39 | /tamacat-webdav/src/test/java/org/tamacat/httpd/webdav/WebDavHttpRequestFactoryTest.java | 96cad2dc42c1fdd0275c3f3474af62172f6fdfe2 | [] | no_license | jait-purohit/tamacat | 96840c693c8620ec68bf961f9c4bad1f6b39cbc6 | 27be4a70de28ff3b7f6a616c863dbe41b8145830 | refs/heads/master | 2021-01-10T10:29:23.580087 | 2014-02-13T13:57:18 | 2014-02-13T13:57:18 | 45,519,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,676 | java | package org.tamacat.httpd.webdav;
import static org.junit.Assert.*;
import org.apache.http.HttpEntityEnclosingRequest;
import org.apache.http.HttpRequest;
import org.apache.http.MethodNotSupportedException;
import org.apache.http.ProtocolVersion;
import org.apache.http.message.BasicRequestLine;
import org.junit.Test;
public class WebDavHttpRequestFactoryTest {
@Test
public void testIsOneOf() {
String[] methods = new String[] {
"HEAD", "GET", "POST"
};
assertTrue(WebDavHttpRequestFactory.isOneOf(methods, "GET"));
assertTrue(WebDavHttpRequestFactory.isOneOf(methods, "POST"));
assertTrue(WebDavHttpRequestFactory.isOneOf(methods, "HEAD"));
assertFalse(WebDavHttpRequestFactory.isOneOf(methods, "PUT"));
assertFalse(WebDavHttpRequestFactory.isOneOf(methods, "DELETE"));
}
@Test
public void testNewHttpRequestRequestLine() {
WebDavHttpRequestFactory factory = new WebDavHttpRequestFactory();
try {
HttpRequest request = factory.newHttpRequest(
new BasicRequestLine("GET", "/", new ProtocolVersion("HTTP",1,1)));
assertEquals(false, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest(
new BasicRequestLine("HEAD", "/", new ProtocolVersion("HTTP",1,1)));
assertEquals(false, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest(
new BasicRequestLine("POST", "/", new ProtocolVersion("HTTP",1,1)));
assertEquals(true, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest(
new BasicRequestLine("MKCOL", "/", new ProtocolVersion("HTTP",1,1)));
assertEquals(true, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
factory.newHttpRequest(new BasicRequestLine("ERROR", "/", new ProtocolVersion("HTTP",1,1)));
fail();
} catch (MethodNotSupportedException e) {
assertTrue(true);
};
try {
factory.newHttpRequest(null);
fail();
} catch (IllegalArgumentException e) {
assertTrue(true);
} catch (MethodNotSupportedException e) {
fail();
};
}
@Test
public void testNewHttpRequestStringString() {
WebDavHttpRequestFactory factory = new WebDavHttpRequestFactory();
try {
HttpRequest request = factory.newHttpRequest("GET", "/");
assertEquals(false, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest("HEAD", "/");
assertEquals(false, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest("POST", "/");
assertEquals(true, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
HttpRequest request = factory.newHttpRequest("MKCOL", "/");
assertEquals(true, request instanceof HttpEntityEnclosingRequest);
} catch (MethodNotSupportedException e) {
fail();
};
try {
factory.newHttpRequest("ERROR", "/");
fail();
} catch (MethodNotSupportedException e) {
assertTrue(true);
};
try {
factory.newHttpRequest(null, null);
fail();
} catch (MethodNotSupportedException e) {
assertTrue(true);
};
}
}
| [
"tamacat.org@9b12007c-730a-11de-9528-39508ac20fff"
] | tamacat.org@9b12007c-730a-11de-9528-39508ac20fff |
58b10a2ad595b049fed93dcb1dd6fa6a6a658733 | 3a1c73837a2e3b5c6b358f30d4ef06373be41afe | /app/src/main/java/pro/bignerdranch/android/osmpro/NoteActivity.java | 4443646b8c5273a267970b1c975fadda5d1aafa3 | [] | no_license | SevaZhukov/OSM2 | 28dc8ba28398591471b803e7a7f38f3ea49fb039 | 909264183e0301c486a683ad4a62222b0fe03608 | refs/heads/master | 2022-09-27T03:27:05.858443 | 2018-01-18T14:37:36 | 2018-01-18T14:37:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package pro.bignerdranch.android.osmpro;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.Fragment;
import java.util.UUID;
/**
* Created by Севастьян on 01.03.2017.
*/
public class NoteActivity extends SingleFragmentActivity {
public static final String EXTRA_NOTE_ID =
"com.bignerdranch.android.criminalintent.crime_id";
public static Intent newIntent(Context packageContext, UUID noteId) {
Intent intent = new Intent(packageContext, NoteActivity.class);
intent.putExtra(EXTRA_NOTE_ID, noteId);
return intent;
}
@Override
protected Fragment createFragment() {
UUID noteId = (UUID) getIntent()
.getSerializableExtra(EXTRA_NOTE_ID);
return NewNoteFragment.newInstance(noteId);
}
}
| [
"mrswimmerlab@gmail.com"
] | mrswimmerlab@gmail.com |
e799589fe0dfd76d904472b989c658dedb79ebac | a2aa93a9bff02b971d5fc48d461e628d9b5df046 | /app/src/main/java/demo/minifly/com/fuction_demo/ActivityAnimation/MyViewOnClickListener.java | ecbcd945a08443a9ed90c7871fc9fcdbcc000754 | [] | no_license | Begin-With-Start/Demoall | acbc2b96fe6cad9a7f8fbafe47211384341db639 | 4ed396321aff5176bff3da2fa38db3a263b4c53b | refs/heads/master | 2021-07-17T09:34:03.138503 | 2020-04-11T04:52:26 | 2020-04-11T04:52:26 | 90,339,902 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 255 | java | package demo.minifly.com.fuction_demo.ActivityAnimation;
/**
* 点击事件接口
* <p/>
* Created by wangchenlong on 15/11/5.
*/
public interface MyViewOnClickListener {
void onClickedView(MyGridAdapter.MyGridViewHolder holder, int position);
}
| [
"hexiaofei@leoao.com"
] | hexiaofei@leoao.com |
8baa5922b461928021b48b120c29339a8601da4c | 708b872fe14eb95dc143a786f4bc7e20ea613e46 | /app/src/androidTest/java/com/example/kuvar/gps_service/ExampleInstrumentedTest.java | b7f073b85b75ff760ec96e6a9020f7e55f2b7501 | [] | no_license | Kuvar/GPS_service | d274dd8e7f945037f30bf679d3976befd701ad78 | 6012a7875805a12f9d2cdd1b0111aa9fb3fcceba | refs/heads/master | 2020-04-15T10:55:05.896043 | 2019-01-08T08:39:54 | 2019-01-08T08:39:54 | 164,603,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.example.kuvar.gps_service;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.kuvar.gps_service", appContext.getPackageName());
}
}
| [
"kuvarjava@gmail.com"
] | kuvarjava@gmail.com |
a456445d380536f99cc2e1e245af57f2c76352ad | f8e3de88e9582b791c125a1bc8cabb2221054027 | /app_newtest_version_app/src/main/java/com/sqli/echallenge/formation/web/admin/CollaborateurInfoAction.java | 805b6f252bf36fc2873e626f9d210d2a93265600 | [
"Apache-2.0"
] | permissive | medbelmahi/formationOurApp | 04c20d29f9162869630594a0dbdf6aaa40cb8b1f | fb8f92489437649331e25992c18cde2850f307ff | refs/heads/master | 2021-01-17T05:01:59.239312 | 2014-12-03T02:26:11 | 2014-12-03T02:26:11 | 26,480,732 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | /**
*
*/
package com.sqli.echallenge.formation.web.admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.validator.annotations.ConversionErrorFieldValidator;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.sqli.echallenge.formation.metier.CollaborateurMetier;
import com.sqli.echallenge.formation.model.Collaborateur;
import com.sqli.echallenge.formation.web.SqliBasicAction;
/**
* @author Mouad
*
*/
@Controller
public class CollaborateurInfoAction extends SqliBasicAction {
private static final long serialVersionUID = 2815345006989153728L;
@Autowired
public CollaborateurMetier collaborateurMetier;
private Long id;
private Collaborateur collaborateur;
@Override
public String execute() throws Exception {
//After validation
try {
//get collaborateur
collaborateur = collaborateurMetier.getCollaborateur(id);
return ActionSupport.SUCCESS;
} catch (Exception e) {
//load Fail
setSessionActionErrorText(getText("infoCollaborateur.error.load.fail"));
return ActionSupport.ERROR;
}
}
@RequiredFieldValidator(shortCircuit=true)
@ConversionErrorFieldValidator(shortCircuit=true)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Collaborateur getCollaborateur() {
return collaborateur;
}
public void setCollaborateur(Collaborateur collaborateur) {
this.collaborateur = collaborateur;
}
}
| [
"medbelmahi@outlook.com"
] | medbelmahi@outlook.com |
fdbaaf858c64f198203d07fc622482a89e53bcc1 | 085669367cc95056ab4fc97b8cde1fb8daeae757 | /RASHEED_Selenium_WorkSpace/NewSeleniumWorkSpaceExtentReports/TsFactories-ExtentReports/src/main/java/com/cgg/Pages/EntreprenuerLoggedinPage.java | bea21ef9ab0f86f36229fcd8ad180afa3c28c113 | [] | no_license | rasheed-rasoon/Git-Study | 20ba4ddcc820bec16e67a9f04db376e685c60d90 | 208c32d1f8fbef900d97295ecaaacf067488dca7 | refs/heads/master | 2020-05-24T16:13:57.291983 | 2019-05-18T11:28:19 | 2019-05-18T11:28:19 | 187,348,453 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,505 | java | package com.cgg.Pages;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.cgg.testcases.TestBase;
import com.cgg.util.AssertionsUtil;
import com.cgg.util.FunctionUtil;
import com.cgg.util.WaitUtil;
import com.relevantcodes.extentreports.LogStatus;
public class EntreprenuerLoggedinPage extends TestBase {
private WebDriver driver;
public static String appNumber=null;
public static String PlanhorsPower=null;
public EntreprenuerLoggedinPage(WebDriver driver){
this.driver=driver;
PageFactory.initElements(driver, this);
}
@FindBy(name="mM1")
private WebElement DoEntreprenuerLogout;
@FindBy(xpath=".//*[@id='collapseOne3']/div/table/tbody/tr/td/a")
private WebElement ClickOnContinueTransferOfLicence;
@FindBy(xpath="//img[@id='simg1']")
private WebElement MouseHoverOnServices;
@FindBy(xpath=".//*[@id='lnk11']")
private WebElement ClickOnTransferOfLicence;
@FindBy(xpath="html/body/div[1]/div[2]/center/table")
private WebElement EntreprenuerPlanOfApprovalWebTable;
@FindBy(xpath="html/body/div[1]/div[2]/center/table/tbody/tr[3]/td/table")
private WebElement EntreprenuerRegistrationAndGrantOfLicenceWebTable;
@FindBy(xpath="html/body/div[1]/div[2]/center/table/tbody/tr[4]/td/table")
private WebElement EntreprenuerAmendmentOfLicenceWebTable;
@FindBy(xpath="html/body/div[1]/div[2]/center/table/tbody/tr[5]/td/table")
private WebElement EntreprenuerTransferOfLicenceWebTable;
public HomePage doEntreprenuerLogout()
{
clickOnButton(this.DoEntreprenuerLogout);
APP_LOGS.info("clicked on logout button back to home page");
return PageFactory.initElements(driver, HomePage.class);
}
public boolean isEntreprenuerLoggedInPageOpened(){
try {
AssertionsUtil.isElementPresent(this.DoEntreprenuerLogout);
} catch (NoSuchElementException e) {
return false;
}
return true;
}
public RegAndLicenceAppForm clickOnRegGrantOfLicence()
{
driver.navigate().to("http://test.cgg.gov.in:8083/tsfactories/newfactoryregistration.do");
APP_LOGS.info("Navigated to Registration and Grant OF Licence Form Page");
return PageFactory.initElements(driver,RegAndLicenceAppForm.class);
}
public PlanOfAppappFormPage clickOnPlanOfApprovalExtension()
{
driver.navigate().to("http://test.cgg.gov.in:8083/tsfactories/newForm1.do");
return PageFactory.initElements(driver,PlanOfAppappFormPage.class);
}
public AmendmentOfLicenseFormPage clickOnAmendmentOfLicense()
{
//driver.get("http://test.cgg.gov.in:8083/tsfactories/Form2.do");
WaitUtil.waitForElementVisible(this.DoEntreprenuerLogout);
driver.navigate().to("http://test.cgg.gov.in:8083/tsfactories/Form2.do");
WaitUtil.waitForElementVisible(this.DoEntreprenuerLogout);
test.log(LogStatus.INFO,"clicked on Amendment of Licence application form");
return PageFactory.initElements(driver,AmendmentOfLicenseFormPage.class);
}
public void mouseHoverOnServices()
{
WaitUtil.waitForElementVisible(this.MouseHoverOnServices);
FunctionUtil.moveMouseToElement(this.MouseHoverOnServices);
}
public TransferOfLicensePages clickOnTransferOfLicense()
{
//driver.get("http://test.cgg.gov.in:8083/tsfactories/Form2a.do");
driver.navigate().to("http://test.cgg.gov.in:8083/tsfactories/Form2a.do");
WaitUtil.waitForElementVisible(this.ClickOnContinueTransferOfLicence);
clickOnButton(this.ClickOnContinueTransferOfLicence);
return PageFactory.initElements(driver,TransferOfLicensePages.class);
}
public void getApNumPlanOfApprovalEntreprenuerLogin()
{
List<WebElement> rows=EntreprenuerPlanOfApprovalWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
//APP_LOGS.info("going to "+i+" row ");
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
//APP_LOGS.info("going to "+j+" cell and validating whether for this application already done payment part and is it under prescrutiny pending ");
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Pre-Scrutiny-Pending"))
{
appNumber=cells.get(j-3).getText();
APP_LOGS.info("The newly updated application number is "+this.appNumber);
this.doEntreprenuerLogout();
break outerloop;
}
}
}
}
public void getApNumGrantOfLicenceEntreprenuerLogin()
{
List<WebElement> rows=EntreprenuerRegistrationAndGrantOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
//APP_LOGS.info("going to "+i+" row ");
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
//APP_LOGS.info("going to "+j+" cell and validating whether for this application already done payment part and is it under prescrutiny pending ");
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Pre-Scrutiny-Pending"))
{
appNumber=cells.get(j-2).getText();
APP_LOGS.info("The newly updated application number is "+this.appNumber);
//AssertionsUtil.verifytext(this.appNumber, null);
this.doEntreprenuerLogout();
break outerloop;
}
}
}
}
public void getAppNumAmendmentOFLicence()
{
List<WebElement> rows=EntreprenuerAmendmentOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
//APP_LOGS.info("going to "+i+" row ");
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
//APP_LOGS.info("going to "+j+" cell and validating whether for this application already done payment part and is it under prescrutiny pending ");
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Pre-Scrutiny-Pending"))
{
appNumber=cells.get(j-2).getText();
APP_LOGS.info("The newly updated application number is "+this.appNumber);
//AssertionsUtil.verifytext(this.appNumber, null);
this.doEntreprenuerLogout();
break outerloop;
}
}
}
}
public void getApNumTransferOfLicenceEntreprenuerLogin()
{
List<WebElement> rows=EntreprenuerTransferOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
//APP_LOGS.info("going to "+i+" row ");
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Pre-Scrutiny-Pending"))
{
appNumber=cells.get(j-2).getText();
APP_LOGS.info("The newly updated application number is "+this.appNumber);
//AssertionsUtil.verifytext(this.appNumber, null);
this.doEntreprenuerLogout();
break outerloop;
}
}
}
}
public PlanOfAppReplyToQueryFormPage planOfApprovalclickReplyToQuery(String appnum) throws Exception
{
List<WebElement> rows=EntreprenuerPlanOfApprovalWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Awaiting Query Response"))
{
driver.findElement(By.cssSelector("button[onclick*='"+appnum+"'][class='btn btn-success']")).click();
AssertionsUtil.verifyisAlertPresent();
//doLogout();
break outerloop;
}
}
}
return PageFactory.initElements(driver,PlanOfAppReplyToQueryFormPage.class);
}
public RegAndLicenceReplyToQueryPage regAndLicenceclickReplyToQuery(String appnum)
{
List<WebElement> rows=EntreprenuerRegistrationAndGrantOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Awaiting Query Response"))
{
APP_LOGS.info("going to click on Reply to Query");
driver.findElement(By.cssSelector("button[onclick*='"+appnum+"'][class='btn btn-success']")).click();
//doLogout();
break outerloop;
}
else{
APP_LOGS.info("no application number is there to process reply to Query ");
}
}
}
return PageFactory.initElements(driver,RegAndLicenceReplyToQueryPage.class);
}
public AmendmentOfLicenceReplyToQueryPage amendmentReplyToQuery(String appnum)
{List<WebElement> rows=EntreprenuerAmendmentOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Awaiting Query Response"))
{
APP_LOGS.info("going to click on Reply to Query");
driver.findElement(By.cssSelector("button[onclick*='"+appnum+"'][class='btn btn-success']")).click();
//doLogout();
break outerloop;
}
else{
}
}
}
return PageFactory.initElements(driver,AmendmentOfLicenceReplyToQueryPage.class);
}
public TransferOfLicenceReplyToQuerPage TransferOfLicenceclickReplyToQuery(String appnum)
{
List<WebElement> rows=EntreprenuerTransferOfLicenceWebTable.findElements(By.tagName("tr"));
outerloop:
for(int i=0;i<rows.size();i++)
{
List<WebElement> cells=rows.get(i).findElements(By.tagName("td"));
for(int j=0;j<cells.size();j++)
{
if(cells.get(j).getText().equals("Payment Done")&&cells.get(j+1).getText().equals("Awaiting Query Response"))
{
APP_LOGS.info("going to click on Reply to Query");
driver.findElement(By.cssSelector("button[onclick*='"+appnum+"'][class='btn btn-success']")).click();
//doLogout();
break outerloop;
}
else{
APP_LOGS.info("no application number is there to process reply to Query ");
}
}
}
return PageFactory.initElements(driver,TransferOfLicenceReplyToQuerPage.class);
}
}
| [
"rasheedahmed.sk@cgg.gov.in"
] | rasheedahmed.sk@cgg.gov.in |
5a7a186b9bf17536f7905d10fe8c5fa8beab3976 | e49ddf6e23535806c59ea175b2f7aa4f1fb7b585 | /tags/release-4.1.3/mipav/src/gov/nih/mipav/model/algorithms/AlgorithmHoughEllipse.java | 976b4c8f96efeb584ab31c160c3528553f5365b7 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | svn2github/mipav | ebf07acb6096dff8c7eb4714cdfb7ba1dcace76f | eb76cf7dc633d10f92a62a595e4ba12a5023d922 | refs/heads/master | 2023-09-03T12:21:28.568695 | 2019-01-18T23:13:53 | 2019-01-18T23:13:53 | 130,295,718 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89,082 | java | package gov.nih.mipav.model.algorithms;
import gov.nih.mipav.model.structures.*;
import gov.nih.mipav.model.structures.jama.JamaMatrix;
import gov.nih.mipav.view.*;
import gov.nih.mipav.view.dialogs.*;
import java.io.*;
import java.awt.Color;
/**
* This Hough transform uses (xi, yi) points in the original image space to generate p, q, r1, r2, and theta points in the Hough
* transform. This Hough transform module only works with binary images. Before it is used the user must
* compute the gradient of an image and threshold it to obtain a binary image. Noise removal and thinning should also
* be performed, if necessary, before this program is run.
*
* The code for finding the best tangent for a point on a curve uses a port of findOptimalTangent.m from the Randomized Hough
* transform used for ellipse detection MATLAB code by Andrew Schuler. The rest of the code is not ported, but is derived
* from the writeups by Andrew Schuler and Robert A. Mclaughlin. Robert A. Mclaughlin uses a linked list to save memory at
* the cost of slower speed. Andrew Schuler uses an array to achieve higher speed at the cost of more memory usage. In
* this application I use the array for higher speed and incur a higher memory cost. If need be, memory can be saved by
* rewriting this application to used a linked list.
*
* Pixel neighbors:
* 0 1 2
* 3 4
* 5 6 7
*
* The algorithm works as follows:
* 1.) Skeletonization is performed. Branches with 2 or less pixels are pruned off.
* 2.) When a pixel has a diagonal neighbor adjacent to a horizontal or vertical neighbor,
* the horizontal or vertical neighbor is deleted.
* 3.) Remove points with 2 or more neighbors.
* 4.) Find the 1 or 2 neighbors of every point
* Find the number of end points, that is, points with only 1 neighbor
* Delete isolated points with no neighbors
* 5.) Find the starting positions and lengths of the open curves
* Delete all open curves with only 2 points
* 6.) For the open curves find the slope and y axis intercept of the tangent line to the curve at a point
* With a user specified sidePointsForTangent on each side of a point find the tangent line that
* minimizes the sum of the squared distances from these side points to the tangent line
* 7.) Find a position and length of closed curve
* 8.) For the closed curve find the slope and y axis intercept of the tangent line to the curve at a point
* With a user specified sidePointsForTangent on each side of a point find the tangent line that
* minimizes the sum of the squared distances from these side points to the tangent line
* 9.) Calculate the desired number of bins that would be used for each parameter if memory were not a
* limitation. This desired bin number = (maximum parameter value - minimum parameter value)/maximum bin width
* 10.) Shrink the number of each bins used for each parameter by the fifth root of desiredBytes/actualBytesAvailable
to keep the buffer size down to user specified actualBytesAvailable.
* 11.) User a random number generator to select 3 of the points. If 2 of the 3 points are closer than
* the user specified minimum distance or farther than the user specified maximum distance, then
* run the random number generator again to find another point within the permissible distance
* range. If 2 of the points have tangents with the same slope, then run the random number
* generator again.
* 12.) Find the intersection of the tangent line for point 1 and the tangent line for point2, t12.
* Find the point midway between point 1 and point 2, point m12.
* Find the intersection of the tangent line for point 2 and the tangent line for point3, t23.
* Find the point midway between point 2 and point 3, point m23.
* The center is found at the intersection of t12m12 and t23m23. If the center is not inside
* the bounds of the image, go back and run the random number generator for 3 new points.
* 13.) Translate the center of the ellipse to the origin by subtracting xCenter, yCenter from
* point 1, point 2, and point 3.
* 14.) Solve for the other 3 ellipse parameters a, b, and c in a*x**2 + 2*b*x*y + c*y**2 = 1 by solving:
* [x1**2 2*x1*y1 y1**2] [a] [1]
* [x2**2 2*x2*y2 y2**2] [b] = [1]
* [x3**2 2*x3*y3 y3**2] [c] [1]
* 15.) The inequality a*c - b**2 > 0 is true if the parameters represent a valid ellipse.
* If this inequality is false, it implies that either the 3 pixels do not lie on the same ellipse,
* or that the estimates of the tangents were inaccurate. In either case, we discard the
* parameters and run the random number generator to find a new pixel triplet.
* 16.) Convert a, b, and c to semi major axis r1, semi minor axis r2, and orientation angle theta.
* Find the combined index value for these 5 parameters from the 5 individual index values and the bin
* numbers for the 5 parameters. Add the respective parameters to xCenterArray[index],
* yCenterArray[index], r1Array[index], r2Array[index], and thetaArray[index].
* Increment countArray[index].
* 17.) Keep collecting point triplets until the user specified pointSetsRequired have been collected.
* 18.) Find the maxIndex yielding the largest value of countArray[index]. If countArray[index] > countThreshold,
* then proceed with step 19. Otherwise zero the Hough buffer and start to collect a new set of
* pointSetsRequired point triplets.
* 19.) Divide xCenterArray[maxIndex], yCenterArray[maxIndex], r1Array[maxIndex], r2Array[maxIndex],
* and thetaArray[maxIndex] by countArray[maxIndex]. For xCenter, yCenter, r1, r2, and theta,
* find the number of pixels near the perimiter of the ellipse. For xCenter, yCenter, r1, r2,
* and theta - 90 degrees, find the number of pixels near the perimiter of the ellipse. The
* correct one of these 2 cases has the largest number of pixels near the perimiter of the
* ellipse. If the correct case finds more pixels than minCoverage percent of the perimiter
* length, then the ellipse is considered as valid. If the correct case has fewer than minCoverage
* percent of the ellipse perimiter, then this set of parameters is discarded and we return to step 18.
* 20.) If an ellipse has been found, but the algorithm still has not found the user specified numEllipses
* number of ellipses, then delete the points found along its perimiter from indexArray, slopeArray,
* and interceptArray before running the Hough transform again. xCenterArray, yCenterArray,
* r1Array, r2Array, thetaArray, and countArray are zeroed before the next Hough transform
* is acquired.
* 21.) Perform no more than maxEllipseFindCycles of pointSetsRequired triplet set acquisitions. When
* this number of triplet set acquisitions has occurred, stop trying to find new ellipses.
* 22.) Create a dialog with numEllipsesFound xCenterArray[i], yCenterArray[i], r1Array[i], r2Array[i],
* thetaArray[i], and countArray[i] values, where the user will select a check box to have that
* ellipse drawn.
*
* References: 1.) The Randomized Hough Transform used for ellipse detection by Andrew Schuler
*
* 2.) Technical Report - Randomized Hough Transform: Improved Ellipse Detection with Comparison by
* Robert A. Mclaughlin
*
* 3.) Digital Image Processing, Second Edition by Richard C. Gonzalez and Richard E. Woods, Section 10.2.2
* Global Processing via the Hough Transform, Prentice-Hall, Inc., 2002, pp. 587-591.
*
* 4.) Shape Detection in Computer Vision Using the Hough Transform by V. F. Leavers, Springer-Verlag, 1992.
*
*/
public class AlgorithmHoughEllipse extends AlgorithmBase {
//~ Instance fields ------------------------------------------------------------------------------------------------
// Minimum percentage of the perimiter of a found ellipse that must be covered by points for it to be
// valid. The perimiter of an ellipse = 4 * a * E(e), where E is the complete elliptic integral of
// the second kind and e = the eccentricity = sqrt(r1**2 - r2**2)/r1
// The perimiter equals approximately PI * sqrt(2*(r1**2 + r2**2))
// A more exact approximation is perimiter equals approximately
// PI * [3*(r1 + r2) - sqrt((r1 + 3*r2)*(3*r1 + r2))]
// More exact still is perimiter equals approximately
// PI * (r1 + r2) * [1 + (3*h)/(10 + sqrt(4 - 3*h))], where h = ((r1 - r2)/(r1 + r2))**2,
// where the last approximation has an error of about 3 * 2**-17 * h**5 for small values of h.
// Default value is 30.0.
private double minCoverage;
// Maximum number of points to take from each side of a point on a curve in determining a tangent
// If only 1 point is available on each side, simply use avarage of slopes to each of the
// neigboring points.
private int sidePointsForTangent;
// xCenter, yCenter, r1, and r2 must have bin width <= maxPixelBinWidth
private double maxPixelBinWidth;
// theta must have bin width <= maxDegreesBinWidth
private double maxDegreesBinWidth;
// Smallest allowable distance between 2 of 3 picked points
private double minPointDistance;
// Largest allowable distance between 2 of 3 picked points
private double maxPointDistance;
// Number of point triplets required before each ellipse find is performed
private int pointSetsRequired;
// number of ellipses to be found
private int numEllipses;
// Maximum number of pointSetsRequired triplet point acqusitions that is allowed to occur
private int maxEllipseFindCycles = 80;
// The maximum Hough transform size in megabytes - default is currently 256
private int maxBufferSize;
// Number of counts required to find an ellipse
private int countThreshold;
// Maximum percent by which perimiter pixels can deviate from the ellipse equation
private double ellipseRangeTolerance;
private ModelImage testImage;
//~ Constructors ---------------------------------------------------------------------------------------------------
/**
* AlgorithmHoughEllipse - default constructor.
*/
public AlgorithmHoughEllipse() { }
/**
* AlgorithmHoughEllipse.
*
* @param destImg Image with ellipses filled in
* @param srcImg Binary source image that has ellipses and near ellipse shapes with gaps
* @param minCoverage Minimum percentage of the perimiter of a found ellipse that must be covered by points
* for it to be valid.
* @param sidePointsForTangent Maximum number of points to take from each side of a point on a curve
* in determining the tangent
* @param maxPixelBinWidth Maximum pixel difference allowed for xCenter, yCenter, r1, and r2 for 5 values
* to be placed into an existing bin
* @param maxDegreesBinWidth Maximum degrees difference allowed for theta for 5 values to be placed into
* an existing bin
* @param minPointDistance Smallest allowable distance between 2 of 3 picked points
* @param maxPointDistance Largest allowable distance between 2 of 3 picked points
* @param pointSetsRequired Number of point triplets acquired before each ellipse find is performed
* @param countThreshold Number of counts required to find an ellipse
* @param ellipseRangeTolerance Maximum percent by which perimiter pixels can deviate from the
* ellipse equation
* @param numEllipses number of ellipses to be found
* @param maxEllipseFindCycles Maximum number of pointSetsRequired triplet point acqusitions that
* is allowed to occur
* @param maxBufferSize maximum Hough transform size in megabytes
*/
public AlgorithmHoughEllipse(ModelImage destImg, ModelImage srcImg, double minCoverage, int sidePointsForTangent,
double maxPixelBinWidth, double maxDegreesBinWidth, double minPointDistance,
double maxPointDistance, int pointSetsRequired, int countThreshold,
double ellipseRangeTolerance, int numEllipses,
int maxEllipseFindCycles, int maxBufferSize) {
super(destImg, srcImg);
this.minCoverage = minCoverage;
this.sidePointsForTangent = sidePointsForTangent;
this.maxPixelBinWidth = maxPixelBinWidth;
this.maxDegreesBinWidth = maxDegreesBinWidth;
this.minPointDistance = minPointDistance;
this.maxPointDistance = maxPointDistance;
this.pointSetsRequired = pointSetsRequired;
this.countThreshold = countThreshold;
this.ellipseRangeTolerance = ellipseRangeTolerance;
this.numEllipses = numEllipses;
this.maxEllipseFindCycles = maxEllipseFindCycles;
this.maxBufferSize = maxBufferSize;
}
//~ Methods --------------------------------------------------------------------------------------------------------
/**
* finalize -
*/
public void finalize() {
super.finalize();
}
/**
* Starts the program.
*/
public void runAlgorithm() {
int x, y;
int offset;
int xDim;
int yDim;
int sourceSlice;
int numPoints;
int i, j, k, n;
int index;
double theta;
double theta1;
double theta2;
byte[] srcBuffer;
boolean test = false;
double xCenter;
double yCenter;
float xCenterArray[];
float yCenterArray[];
float r1Array[];
float r2Array[];
float thetaArray[];
short countArray[];
boolean selectedEllipse[];
JDialogHoughEllipseChoice choice;
byte value = 0;
int x1;
int y1;
int x2;
int y2;
int x3;
int y3;
double x1c;
double y1c;
double x2c;
double y2c;
double x3c;
double y3c;
int indexArray[];
int newIndexArray[];
int neighbors;
int endPoints;
int numOpenCurves;
int numClosedCurves;
boolean foundArray[];
int openStart[];
int openLength[];
int closedLength;
int indexPtr = 0;
int nextPoint;
float xArray[];
float yArray[];
float tangentX;
float tangentY;
float slopeArray[];
float newSlopeArray[];
float interceptArray[];
float newInterceptArray[];
int startPtr;
int presentSidePoints;
float xPoints[];
float yPoints[];
int endPtr;
int startWrapPoints;
int endWrapPoints;
double a1;
double b1;
double alpha;
double cosalpha;
double sinalpha;
double angle;
double beta;
double cosbeta;
double sinbeta;
int neighbor1[];
int neighbor2[];
AlgorithmMorphology2D algoMorph2D;
int neigh0;
int neigh1;
int neigh2;
int neigh3;
int neigh4;
int neigh5;
int neigh6;
int neigh7;
int pruningPix;
boolean entireImage;
int ellipsesFound = 0;
int ellipseFindCycles = 0;
int pointSetsAcquired = 0;
RandomNumberGen randomGen;
int number1;
int number2;
int number3;
double minDistanceSquared;
double maxDistanceSquared;
int distanceSquared;
int xDiff;
int yDiff;
float slope1;
float slope2;
float slope3;
float intercept1;
float intercept2;
float intercept3;
float tx12;
float ty12;
float midx12;
float midy12;
float tangentx12;
float tangenty12;
float slope12;
float intercept12 = 0.0f;
float tx23;
float ty23;
float midx23;
float midy23;
float tangentx23;
float tangenty23;
float slope23;
float intercept23 = 0.0f;
JamaMatrix A;
JamaMatrix B;
JamaMatrix X = null;
double a = 1.0;
double b = 0.0;
double c = 1.0;
double r1;
double r2;
double aminusc;
double sqr2 = Math.sqrt(2.0);
double twob;
double var;
double aplusc;
float minXCenter;
float maxXCenter;
float minYCenter;
float maxYCenter;
float minR1;
float maxR1;
float minR2;
float maxR2;
float minTheta;
int bytesPerCell;
int xCenterBins;
int yCenterBins;
int r1Bins;
int r2Bins;
int thetaBins;
double maxRadiansDiff;
long desiredBytes;
long actualBytesAvailable;
double shrinkFactor = 1.0;
long longNumBins;
int numBins;
int xCenterIndex;
int yCenterIndex;
int r1Index;
int r2Index;
int thetaIndex;
int scale1;
int scale12;
int scale123;
int scale1234;
int maxIndex = -1;
int maxCount = 0;
double h;
double perimiter;
int minPixels;
byte foundPoint[];
double xc;
double yc;
double costheta1;
double costheta2;
double sintheta1;
double sintheta2;
double r1Sq;
double r2Sq;
double var1;
double var2;
double checkVal;
double upperLimit = 1.0 + 0.01 * ellipseRangeTolerance;
double lowerLimit = 1.0 - 0.01 * ellipseRangeTolerance;
short pointsOnEllipse;
short pointsOnEllipse1;
short pointsOnEllipse2;
float xCenterTable[];
float yCenterTable[];
float r1Table[];
float r2Table[];
float thetaTable[];
short countTable[];
int pointsDeleted;
int newNumPoints;
boolean testedArray[];
float xpc;
float ypc;
double xSqSum;
double ySqSum;
double xySum;
double x1t;
double x2t;
double y1t;
double y2t;
double d1;
double d2;
double slope;
boolean ellipseDetected;
VOI ellipseVOI[] = null;
int ellipsesDrawn = 0;
int ellipsePoints[];
float xArr[];
float yArr[];
float zArr[];
if (srcImage == null) {
displayError("Source Image is null");
finalize();
return;
}
fireProgressStateChanged(srcImage.getImageName(), "Hough ellipse ...");
xDim = srcImage.getExtents()[0];
yDim = srcImage.getExtents()[1];
sourceSlice = xDim * yDim;
srcBuffer = new byte[sourceSlice];
try {
srcImage.exportData(0, sourceSlice, srcBuffer);
} catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on srcImage.exportData");
setCompleted(false);
return;
}
if (test) {
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
srcBuffer[index] = 0;
} // for (x = 0; x < xDim; x++)
} // for (y = 0; y < yDim; y++)
xCenter = (xDim-1)/2.0;
yCenter = (yDim-1)/2.0;
a1 = 50.0;
b1 = 25.0;
for (i = 0; i < 360; i++) {
alpha = i * Math.PI/180.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + a1 * cosalpha);
y = (int)(yCenter + b1 * sinalpha);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
a1 = 75.0;
b1 = 37.5;
angle = Math.PI/4.0;
beta = -angle;
cosbeta = Math.cos(beta);
sinbeta = Math.sin(beta);
for (i = 0; i < 720; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + 50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter + 50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
/*for (i = 0; i < 90; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + 50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter + 50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 180; i < 270; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + 50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter + 50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 360; i < 450; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + 50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter + 50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 540; i < 630; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter + 50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter + 50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}*/
a1 = 50.0;
b1 = 25.0;
/*angle = -Math.PI/4.0;
beta = -angle;
cosbeta = Math.cos(beta);
sinbeta = Math.sin(beta);
for (i = 0; i < 720; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter -50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter -50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}*/
for (i = 0; i < 90; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter -50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter -50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 180; i < 270; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter -50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter -50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 360; i < 450; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter -50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter -50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
for (i = 540; i < 630; i++) {
alpha = i * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenter -50.0 + a1 * cosalpha * cosbeta - b1 * sinalpha * sinbeta);
y = (int)(yCenter -50.0 + a1 * cosalpha * sinbeta + b1 * sinalpha * cosbeta);
index = x + (xDim*y);
srcBuffer[index] = 1;
}
testImage = new ModelImage(ModelStorageBase.BYTE, srcImage.getExtents(), "Hough Ellipse Test Image");
try {
testImage.importData(0, srcBuffer, true);
}
catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on testImage.importData");
setCompleted(false);
return;
}
new ViewJFrameImage(testImage);
} // if (test)
try {
destImage.importData(0, srcBuffer, true);
} catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on destImage.importData");
setCompleted(false);
return;
}
// Skeletonize the binary image
// Prune off branches with 2 or less pixels
pruningPix = 2;
entireImage = true;
algoMorph2D = new AlgorithmMorphology2D(destImage, 0, 0.0f, AlgorithmMorphology2D.SKELETONIZE, 0, 0, pruningPix, 0, entireImage);
algoMorph2D.run();
algoMorph2D.finalize();
try {
destImage.exportData(0, sourceSlice, srcBuffer);
} catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on destImage.exportData");
setCompleted(false);
return;
}
for (i = 0; i < sourceSlice; i++) {
if (srcBuffer[i] != 0) {
value = srcBuffer[i];
break;
}
}
// When a diagonal neighbor is adjacent to a horizontal or vertical neighbor,
// remove the horizontal or vertical neighbor
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if (srcBuffer[index] != 0) {
neighbors = 0;
neigh0 = -1;
neigh1 = -1;
neigh2 = -1;
neigh3 = -1;
neigh4 = -1;
neigh5 = -1;
neigh6 = -1;
neigh7 = -1;
if (y > 0) {
if (x > 0) {
if (srcBuffer[index - xDim - 1] != 0) {
neighbors++;
neigh0 = index - xDim - 1;
}
}
if (srcBuffer[index - xDim] != 0) {
neighbors++;
neigh1 = index - xDim;
}
if (x < xDim - 1) {
if (srcBuffer[index - xDim + 1] != 0) {
neighbors++;
neigh2 = index - xDim + 1;
}
}
} // if (y > 0)
if (x > 0) {
if (srcBuffer[index - 1] != 0) {
neighbors++;
neigh3 = index - 1;
}
} // if (x > 0)
if (x < xDim - 1) {
if (srcBuffer[index + 1] != 0) {
neighbors++;
neigh4 = index + 1;
}
} // if (x < xDim - 1)
if (y < yDim - 1) {
if (x > 0) {
if (srcBuffer[index + xDim - 1] != 0) {
neighbors++;
neigh5 = index + xDim - 1;
}
}
if (srcBuffer[index + xDim] != 0) {
neighbors++;
neigh6 = index + xDim;
}
if (x < xDim - 1) {
if (srcBuffer[index + xDim + 1] != 0) {
neighbors++;
neigh7 = index + xDim + 1;
}
}
} // if (y < yDim - 1)
if (neighbors > 2) {
// Could be 3 or 4
if ((neigh0 >= 0) && (neigh1 >= 0)) {
srcBuffer[neigh1] = 0;
neigh1 = -1;
}
if ((neigh1 >= 0) && (neigh2 >= 0)) {
srcBuffer[neigh1] = 0;
neigh1 = -1;
}
if ((neigh0 >= 0) && (neigh3 >= 0)) {
srcBuffer[neigh3] = 0;
neigh3 = -1;
}
if ((neigh3 >= 0) && (neigh5 >= 0)) {
srcBuffer[neigh3] = 0;
neigh3 = -1;
}
if ((neigh2 >= 0) && (neigh4 >= 0)) {
srcBuffer[neigh4] = 0;
neigh4 = -1;
}
if ((neigh4 >= 0) && (neigh7 >= 0)) {
srcBuffer[neigh4] = 0;
neigh4 = -1;
}
if ((neigh5 >= 0) && (neigh6 >= 0)) {
srcBuffer[neigh6] = 0;
neigh6 = -1;
}
if ((neigh6 >= 0) && (neigh7 >= 0)) {
srcBuffer[neigh6] = 0;
neigh6 = -1;
}
}
} // if (srcBuffer[index] != 0)
} // for (x = 0; x < xDim; x++)
} // for (y = 0; y < yDim; y++)
// Remove points with more than 2 neighbors
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if (srcBuffer[index] != 0) {
neighbors = 0;
if (y > 0) {
if (x > 0) {
if (srcBuffer[index - xDim - 1] != 0) {
neighbors++;
}
}
if (srcBuffer[index - xDim] != 0) {
neighbors++;
}
if (x < xDim - 1) {
if (srcBuffer[index - xDim + 1] != 0) {
neighbors++;
}
}
} // if (y > 0)
if (x > 0) {
if (srcBuffer[index - 1] != 0) {
neighbors++;
}
} // if (x > 0)
if (x < xDim - 1) {
if (srcBuffer[index + 1] != 0) {
neighbors++;
}
} // if (x < xDim - 1)
if (y < yDim - 1) {
if (x > 0) {
if (srcBuffer[index + xDim - 1] != 0) {
neighbors++;
}
}
if (srcBuffer[index + xDim] != 0) {
neighbors++;
}
if (x < xDim - 1) {
if (srcBuffer[index + xDim + 1] != 0) {
neighbors++;
}
}
} // if (y < yDim - 1)
if (neighbors > 2) {
srcBuffer[index] = 0;
}
} // if (srcBuffer[index] != 0)
} // for (x = 0; x < xDim; x++)
} // for (y = 0; y < yDim; y++)
// Find the 1 or 2 neighbors of every point
// Find the number of end points, that is, points with only 1 neighbor
// Delete isolated points with no neighbors
numPoints = 0;
endPoints = 0;
neighbor1 = new int[sourceSlice];
neighbor2 = new int[sourceSlice];
for (i = 0; i < sourceSlice; i++) {
neighbor1[i] = -1;
neighbor2[i] = -1;
}
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if (srcBuffer[index] != 0) {
neighbors = 0;
if (y > 0) {
if (x > 0) {
if (srcBuffer[index - xDim - 1] != 0) {
neighbors++;
neighbor1[index] = index - xDim - 1;
}
}
if (srcBuffer[index - xDim] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index - xDim;
}
else {
neighbor2[index] = index - xDim;
}
}
if (x < xDim - 1) {
if (srcBuffer[index - xDim + 1] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index - xDim + 1;
}
else {
neighbor2[index] = index - xDim + 1;
}
}
}
} // if (y > 0)
if (x > 0) {
if (srcBuffer[index - 1] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index - 1;
}
else {
neighbor2[index] = index - 1;
}
}
} // if (x > 0)
if (x < xDim - 1) {
if (srcBuffer[index + 1] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index + 1;
}
else {
neighbor2[index] = index + 1;
}
}
} // if (x < xDim - 1)
if (y < yDim - 1) {
if (x > 0) {
if (srcBuffer[index + xDim - 1] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index + xDim - 1;
}
else {
neighbor2[index] = index + xDim - 1;
}
}
}
if (srcBuffer[index + xDim] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index + xDim;
}
else {
neighbor2[index] = index + xDim;
}
}
if (x < xDim - 1) {
if (srcBuffer[index + xDim + 1] != 0) {
neighbors++;
if (neighbor1[index] == -1) {
neighbor1[index] = index + xDim + 1;
}
else {
neighbor2[index] = index + xDim + 1;
}
}
}
} // if (y < yDim - 1)
if (neighbors == 0) {
srcBuffer[index] = 0;
neighbor1[index] = -1;
neighbor2[index] = -1;
}
else {
numPoints++;
if (neighbors == 1) {
endPoints++;
}
}
} // if (srcBuffer[index] != 0)
} // for (x = 0; x < xDim; x++)
} // for (y = 0; y < yDim; y++)
numOpenCurves = endPoints/2;
openStart = new int[numOpenCurves];
openLength = new int[numOpenCurves];
foundArray = new boolean[sourceSlice];
// Set foundArray to true at every zero location
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if (srcBuffer[index] == 0) {
foundArray[index] = true;
}
}
}
// Find the starting positions and lengths of the open curves
i = 0;
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if ((neighbor2[index] == -1) && (!foundArray[index])) {
foundArray[index] = true;
openStart[i] = index;
openLength[i]++;
index = neighbor1[index];
foundArray[index] = true;
openLength[i]++;
while(neighbor2[index] != -1) {
if (!foundArray[neighbor1[index]]) {
index = neighbor1[index];
}
else {
index = neighbor2[index];
}
foundArray[index] = true;
openLength[i]++;
} // (while(neighbor2[index] != -1)
// Delete all open curves with only 2 points
// Also don't determine tangents of end points on longer curves,
// but use these 2 end points in determining tangents of more inner points
// These 2 end points will not be used in generating random 3 point sets.
numPoints = numPoints - 2;
if (openLength[i] == 2) {
srcBuffer[openStart[i]] = 0;
srcBuffer[neighbor1[openStart[i]]] = 0;
numOpenCurves--;
openLength[i] = 0;
}
else {
i++;
}
}
}
}
ViewUserInterface.getReference().setDataText("Number of open curves = " + numOpenCurves + "\n");
// For the open curves find the slope and y axis intercept of the tangent line to the curve at a point
// With a user specified sidePointsForTangent on each side of a point find the tangent line that
// minimizes the sum of the squared distances from these side points to the tangent line
indexArray = new int[numPoints];
slopeArray = new float[numPoints];
interceptArray = new float[numPoints];
for (i = 0; i < sourceSlice; i++) {
if (srcBuffer[i] != 0) {
foundArray[i] = false;
}
}
indexPtr = 0;
for (i = 0; i < numOpenCurves; i++) {
startPtr = indexPtr;
xArray = new float[openLength[i]];
yArray = new float[openLength[i]];
nextPoint = openStart[i];
xArray[0] = nextPoint % xDim;
yArray[0] = nextPoint / xDim;
foundArray[nextPoint] = true;
for (n = 1; n <= openLength[i] - 1; n++) {
if (!foundArray[neighbor1[nextPoint]]) {
nextPoint = neighbor1[nextPoint];
}
else {
nextPoint = neighbor2[nextPoint];
}
if (n <= openLength[i] - 2) {
indexArray[indexPtr++] = nextPoint;
}
xArray[n] = nextPoint % xDim;
yArray[n] = nextPoint / xDim;
foundArray[nextPoint] = true;
} // for (n = 0; n <= openLength[i] - 1; n++)
indexPtr = startPtr;
for (n = 1; n <= openLength[i] - 2; n++) {
presentSidePoints = Math.min(sidePointsForTangent, n);
presentSidePoints = Math.min(presentSidePoints, openLength[i] - 1 - n);
if (presentSidePoints == 1) {
tangentX = (xArray[n+1] - xArray[n-1])/2.0f;
tangentY = (yArray[n+1] - yArray[n-1])/2.0f;
if (tangentX == 0.0f) {
slopeArray[indexPtr++] = Float.POSITIVE_INFINITY;
}
else {
slopeArray[indexPtr] = tangentY/tangentX;
interceptArray[indexPtr] = yArray[n] - slopeArray[indexPtr] * xArray[n];
indexPtr++;
}
} // if (presentSidePoints == 1)
else {
xPoints = new float[2*presentSidePoints+1];
yPoints = new float[2*presentSidePoints+1];
for (k = 0, j = n - presentSidePoints; j <= n + presentSidePoints; j++, k++) {
xPoints[k] = xArray[j];
yPoints[k] = yArray[j];
}
// Center all points for tangent point touching curve at (0, 0)
// That is, use an x axis and a y axis going thru the tangent point
xpc = xPoints[presentSidePoints];
ypc = yPoints[presentSidePoints];
for (k = 0; k < xPoints.length; k++) {
xPoints[k] = xPoints[k] - xpc;
yPoints[k] = yPoints[k] - ypc;
}
xSqSum = 0.0;
ySqSum = 0.0;
xySum = 0.0;
for (k = 0; k < xPoints.length; k++) {
xSqSum += xPoints[k]*xPoints[k];
ySqSum += yPoints[k]*yPoints[k];
xySum += xPoints[k]*yPoints[k];
}
if (xySum != 0.0) {
var = Math.sqrt(ySqSum*ySqSum - 2.0 * xSqSum * ySqSum + xSqSum * xSqSum + 4.0 * xySum * xySum);
x1t = 0.5 * ((-ySqSum + xSqSum + var)/xySum);
x2t = 0.5 * ((-ySqSum + xSqSum - var)/xySum);
y1t = 1.0;
y2t = 1.0;
}
else {
// If all points are symmetric to either this new x axis or this new y axis, then
// their product sum is 0 and the tangentX, tangentY must be 1,0 or 0,1
x1t = 1.0;
x2t = 0.0;
y1t = 0.0;
y2t = 1.0;
}
// x1t, y1t and x2t, y2t are perpindicular. To find the solution, calculate the sum of
// distances from the curve points to the line for the 2 cases
// The shortest distance is the correct solution
// Distance from AX + BY + C = 0 to P1 is
// abs((A*x1 + B*y1 + C))/sqrt(A**2 + B**2)
// Here A = slope, B = -1, and C = 0.
d1 = 0.0;
for (k = 0; k < xPoints.length; k++) {
if (x1t == 0.0) {
// Infinite slope thru (0,0)
d1 += Math.abs(yPoints[k]);
}
else if (y1t == 0.0) {
// Zero slope thru (0, 0)
d1 += Math.abs(xPoints[k]);
}
else {
slope = y1t/x1t;
d1 += Math.abs((slope * xPoints[k] - yPoints[k])/Math.sqrt(slope*slope + 1));
}
}
d2 = 0.0;
for (k = 0; k < xPoints.length; k++) {
if (x2t == 0.0) {
// Infinite slope thru (0,0)
d2 += Math.abs(yPoints[k]);
}
else if (y2t == 0.0) {
// Zero slope thru (0, 0)
d2 += Math.abs(xPoints[k]);
}
else {
slope = y2t/x2t;
d2 += Math.abs((slope * xPoints[k] - yPoints[k])/Math.sqrt(slope*slope + 1));
}
}
if (d1 < d2) {
tangentX = (float)x1t;
tangentY = (float)y1t;
}
else {
tangentX = (float)x2t;
tangentY = (float)y2t;
}
if (tangentX == 0.0f) {
slopeArray[indexPtr++] = Float.POSITIVE_INFINITY;
}
else {
slopeArray[indexPtr] = tangentY/tangentX;
interceptArray[indexPtr] = yArray[n] - slopeArray[indexPtr] * xArray[n];
indexPtr++;
}
}
} // for (n = 2; n <= openLength[i] - 2; n++)
} // for (i = 0; i < numOpenCurves; i++)
openStart = null;
openLength = null;
xArray = null;
yArray = null;
// Find a position and length of closed curve
numClosedCurves = 0;
xPoints = new float[2*sidePointsForTangent + 1];
yPoints = new float[2*sidePointsForTangent + 1];
for (y = 0; y < yDim; y++) {
offset = y * xDim;
for (x = 0; x < xDim; x++) {
index = offset + x;
if (!foundArray[index]) {
startPtr = indexPtr;
foundArray[index] = true;
numClosedCurves++;
closedLength = 1;
indexArray[indexPtr++] = index;
while ((!foundArray[neighbor1[index]]) || (!foundArray[neighbor2[index]])) {
if (!foundArray[neighbor1[index]]) {
index = neighbor1[index];
}
else {
index = neighbor2[index];
}
foundArray[index] = true;
closedLength++;
indexArray[indexPtr++] = index;
} // while ((!foundArray[neighbor1[index]]) || (!foundArray[neighbor2[index]]))
endPtr = indexPtr - 1;
indexPtr = startPtr;
for (n = 0; n <= closedLength - 1; n++) {
// Put the tangent point at index sidePointsForTangent in the
// center of the xPoints and yPoints array with sidePointsForTangent points
// to each side.
startWrapPoints = Math.max(0, sidePointsForTangent - n);
endWrapPoints = Math.max(0, sidePointsForTangent - (closedLength - 1 - n));
for (k = 0; k < startWrapPoints; k++) {
xPoints[k] = indexArray[endPtr - (startWrapPoints - k)] % xDim;
yPoints[k] = indexArray[endPtr - (startWrapPoints - k)] / xDim;
}
for (k = startWrapPoints, j = indexPtr - sidePointsForTangent + startWrapPoints;
k < 2*sidePointsForTangent + 1 - endWrapPoints; j++, k++) {
xPoints[k] = indexArray[j] % xDim;
yPoints[k] = indexArray[j] / xDim;
}
for (j = 0, k = 2*sidePointsForTangent + 1 - endWrapPoints; k < 2*sidePointsForTangent + 1; j++, k++) {
xPoints[k] = indexArray[startPtr + j] % xDim;
yPoints[k] = indexArray[startPtr + j] / xDim;
}
// For the closed curve find the slope and y axis intercept of the tangent line to the curve at a point
// With a user specified sidePointsForTangent on each side of a point find the tangent line that
// minimizes the sum of the squared distances from these side points to the tangent line
if (sidePointsForTangent == 1) {
tangentX = (xPoints[2] - xPoints[0])/2.0f;
tangentY = (yPoints[2] - yPoints[0])/2.0f;
if (tangentX == 0.0f) {
slopeArray[indexPtr++] = Float.POSITIVE_INFINITY;
}
else {
slopeArray[indexPtr] = tangentY/tangentX;
interceptArray[indexPtr] = yPoints[1] - slopeArray[indexPtr] * xPoints[1];
indexPtr++;
}
} // if (sidePointsForTangent == 1)
else {
// Center all points for tangent point touching curve at (0, 0)
// That is, use an x axis and a y axis going thru the tangent point
xpc = xPoints[sidePointsForTangent];
ypc = yPoints[sidePointsForTangent];
for (k = 0; k < xPoints.length; k++) {
xPoints[k] = xPoints[k] - xpc;
yPoints[k] = yPoints[k] - ypc;
}
xSqSum = 0.0;
ySqSum = 0.0;
xySum = 0.0;
for (k = 0; k < xPoints.length; k++) {
xSqSum += xPoints[k]*xPoints[k];
ySqSum += yPoints[k]*yPoints[k];
xySum += xPoints[k]*yPoints[k];
}
if (xySum != 0.0) {
var = Math.sqrt(ySqSum*ySqSum - 2.0 * xSqSum * ySqSum + xSqSum * xSqSum + 4.0 * xySum * xySum);
x1t = 0.5 * ((-ySqSum + xSqSum + var)/xySum);
x2t = 0.5 * ((-ySqSum + xSqSum - var)/xySum);
y1t = 1.0;
y2t = 1.0;
}
else {
// If all points are symmetric to either this new x axis or this new y axis, then
// their product sum is 0 and the tangentX, tangentY must be 1,0 or 0,1
x1t = 1.0;
x2t = 0.0;
y1t = 0.0;
y2t = 1.0;
}
// x1t, y1t and x2t, y2t are perpindicular. To find the solution, calculate the sum of
// distances from the curve points to the line for the 2 cases
// The shortest distance is the correct solution
// Distance from AX + BY + C = 0 to P1 is
// abs((A*x1 + B*y1 + C))/sqrt(A**2 + B**2)
// Here A = slope, B = -1, and C = 0.
d1 = 0.0;
for (k = 0; k < xPoints.length; k++) {
if (x1t == 0.0) {
// Infinite slope thru (0,0)
d1 += Math.abs(yPoints[k]);
}
else if (y1t == 0.0) {
// Zero slope thru (0, 0)
d1 += Math.abs(xPoints[k]);
}
else {
slope = y1t/x1t;
d1 += Math.abs((slope * xPoints[k] - yPoints[k])/Math.sqrt(slope*slope + 1));
}
}
d2 = 0.0;
for (k = 0; k < xPoints.length; k++) {
if (x2t == 0.0) {
// Infinite slope thru (0,0)
d2 += Math.abs(yPoints[k]);
}
else if (y2t == 0.0) {
// Zero slope thru (0, 0)
d2 += Math.abs(xPoints[k]);
}
else {
slope = y2t/x2t;
d2 += Math.abs((slope * xPoints[k] - yPoints[k])/Math.sqrt(slope*slope + 1));
}
}
if (d1 < d2) {
tangentX = (float)x1t;
tangentY = (float)y1t;
}
else {
tangentX = (float)x2t;
tangentY = (float)y2t;
}
if (tangentX == 0.0f) {
slopeArray[indexPtr++] = Float.POSITIVE_INFINITY;
}
else {
slopeArray[indexPtr] = tangentY/tangentX;
// Add xpc, ypc back in to return from tangent point (0, 0) origin to original origin
interceptArray[indexPtr] = (yPoints[sidePointsForTangent] + ypc)- slopeArray[indexPtr] * (xPoints[sidePointsForTangent] + xpc);
indexPtr++;
}
}
} // for (n = 0; n <= closedLength[i] - 1; n++)
}
} // for (x = 0; x < xDim; x++)
} // for (y = 0; y < yDim; y++)
neighbor1 = null;
neighbor2 = null;
foundArray = null;
xPoints = null;
yPoints = null;
ViewUserInterface.getReference().setDataText("Number of closed curves = " + numClosedCurves + "\n");
// Calculate the desired number of bins that would be used for each parameter if memory were not a
// limitation.
minXCenter = 0.0f;
maxXCenter = xDim - 1;
minYCenter = 0.0f;
maxYCenter = yDim - 1;
minR1 = (float)(2.0 * minPointDistance);
maxR1 = (float)Math.min(2.0 * maxPointDistance, Math.sqrt((xDim-1)*(xDim-1) + (yDim-1)*(yDim-1)));
minR2 = 0.0f;
maxR2 = (float)Math.min(2.0 * maxPointDistance, Math.min(xDim-1, yDim-1));
minTheta = (float)(-Math.PI/2.0);
bytesPerCell = 4 * 5 + 2; // float for each of 5 parameters and short for count;
xCenterBins = (int)Math.ceil((maxXCenter - minXCenter)/maxPixelBinWidth);
yCenterBins = (int)Math.ceil((maxYCenter - minYCenter)/maxPixelBinWidth);
r1Bins = (int)Math.ceil((maxR1 - minR1)/maxPixelBinWidth);
r2Bins = (int)Math.ceil((maxR2 - minR2)/maxPixelBinWidth);
maxRadiansDiff = maxDegreesBinWidth * Math.PI/180.0;
thetaBins = (int)Math.ceil(Math.PI/maxRadiansDiff);
longNumBins = (long)xCenterBins * (long)yCenterBins * (long)r1Bins * (long)r2Bins * (long)thetaBins;
numBins = (int)longNumBins;
desiredBytes = longNumBins * (long)bytesPerCell;
actualBytesAvailable = (long)maxBufferSize * 1024L * 1024L;
if (actualBytesAvailable < desiredBytes) {
// Must shrink the number of each bins used for each parameter by the fifth root of
// deisredBytes/actualBytesAvailable to keep the buffer size down to actualBytesAvailable
shrinkFactor = Math.pow((double)desiredBytes/(double)actualBytesAvailable, 0.2);
maxPixelBinWidth = maxPixelBinWidth * shrinkFactor;
maxRadiansDiff = maxRadiansDiff * shrinkFactor;
xCenterBins = (int)Math.ceil((maxXCenter - minXCenter)/maxPixelBinWidth);
yCenterBins = (int)Math.ceil((maxYCenter - minYCenter)/maxPixelBinWidth);
r1Bins = (int)Math.ceil((maxR1 - minR1)/maxPixelBinWidth);
r2Bins = (int)Math.ceil((maxR2 - minR2)/maxPixelBinWidth);
thetaBins = (int)Math.ceil(Math.PI/maxRadiansDiff);
numBins = xCenterBins * yCenterBins * r1Bins * r2Bins * thetaBins;
} // if (actualBytesAvailable < desiredBytes)
ViewUserInterface.getReference().setDataText("xCenterBins = " + xCenterBins + "\n");
ViewUserInterface.getReference().setDataText("yCenterBins = " + yCenterBins + "\n");
ViewUserInterface.getReference().setDataText("r1Bins = " + r1Bins + "\n");
ViewUserInterface.getReference().setDataText("r2Bins = " + r2Bins + "\n");
ViewUserInterface.getReference().setDataText("thetaBins = " + thetaBins + "\n");
ViewUserInterface.getReference().setDataText("numBins = " + numBins + "\n");
xCenterArray = new float[numBins];
yCenterArray = new float[numBins];
r1Array = new float[numBins];
r2Array = new float[numBins];
thetaArray = new float[numBins];
countArray = new short[numBins];
scale1 = xCenterBins;
scale12 = scale1 * yCenterBins;
scale123 = scale12 * r1Bins;
scale1234 = scale123 * r2Bins;
xCenterTable = new float[numEllipses];
yCenterTable = new float[numEllipses];
r1Table = new float[numEllipses];
r2Table = new float[numEllipses];
thetaTable = new float[numEllipses];
countTable = new short[numEllipses];
randomGen = new RandomNumberGen();
minDistanceSquared = minPointDistance * minPointDistance;
maxDistanceSquared = maxPointDistance * maxPointDistance;
A = new JamaMatrix(3,3, 0.0);
B = new JamaMatrix(3,1, 0.0);
foundPoint = new byte[numPoints];
testedArray = new boolean[numBins];
while (ellipseFindCycles < maxEllipseFindCycles) {
pointSetsAcquired = 0;
while (pointSetsAcquired < pointSetsRequired) {
// Generate 3 random numbers from 0 to numPoints - 1
number1 = randomGen.genUniformRandomNum(0, numPoints - 1);
x1 = indexArray[number1] % xDim;
y1 = indexArray[number1] / xDim;
slope1 = slopeArray[number1];
while (true) {
number2 = randomGen.genUniformRandomNum(0, numPoints - 1);
if (number1 == number2) {
continue;
}
x2 = indexArray[number2] % xDim;
y2 = indexArray[number2] / xDim;
xDiff = x1 - x2;
yDiff = y1 - y2;
distanceSquared = xDiff * xDiff + yDiff * yDiff;
// Don't use if points 1 and 2 are less than a minimum distance or greater than
// a maximum distance apart
if ((distanceSquared < minDistanceSquared) || (distanceSquared > maxDistanceSquared)) {
continue;
}
// Don't use if tangent lines 1 and 2 are parallel
slope2 = slopeArray[number2];
if (Float.isInfinite(slope1) && Float.isInfinite(slope2)) {
continue;
}
if (slope1 == slope2) {
continue;
}
break;
}
// Find intersection of tangent 1 and tangent2.
intercept1 = interceptArray[number1];
intercept2 = interceptArray[number2];
if (Float.isInfinite(slope1)) {
tx12 = x1;
ty12 = slope2 * tx12 + intercept2;
}
else if (Float.isInfinite(slope2)) {
tx12 = x2;
ty12 = slope1 * tx12 + intercept1;
}
else {
tx12 = (intercept2 - intercept1)/(slope1 - slope2);
ty12 = slope1 * tx12 + intercept1;
}
// Find point midway between point 1 and point 2
midx12 = (x1 + x2)/2.0f;
midy12 = (y1 + y2)/2.0f;
// Find slope and intercept of line connecting intersection point of tangent1 and tangent2 and midpoint of 1 and 2
tangentx12 = tx12 - midx12;
tangenty12 = ty12 - midy12;
if (tangentx12 == 0.0f) {
slope12 = Float.POSITIVE_INFINITY;
}
else {
slope12 = tangenty12/tangentx12;
intercept12 = midy12 - slope12 * midx12;
}
while (true) {
number3 = randomGen.genUniformRandomNum(0, numPoints - 1);
if ((number1 == number3) || (number2 == number3)) {
continue;
}
x3 = indexArray[number3] % xDim;
y3 = indexArray[number3] / xDim;
xDiff = x1 - x3;
yDiff = y1 - y3;
distanceSquared = xDiff * xDiff + yDiff * yDiff;
// Don't use if points 1 and 3 are less than a minimum distance or greater than
// a maximum distance apart
if ((distanceSquared < minDistanceSquared) || (distanceSquared > maxDistanceSquared)) {
continue;
}
xDiff = x2 - x3;
yDiff = y2 - y3;
distanceSquared = xDiff * xDiff + yDiff * yDiff;
// Don't use if points 2 and 3 are less than a minimum distance or greater than
// a maximum distance apart
if ((distanceSquared < minDistanceSquared) || (distanceSquared > maxDistanceSquared)) {
continue;
}
// Don't use if tangent lines 2 and 3 are parallel
slope3 = slopeArray[number3];
if (Float.isInfinite(slope2) && Float.isInfinite(slope3)) {
continue;
}
if (slope2 == slope3) {
continue;
}
break;
}
// Find intersection of tangent 2 and tangent3.
intercept3 = interceptArray[number3];
if (Float.isInfinite(slope2)) {
tx23 = x2;
ty23 = slope3 * tx23 + intercept3;
}
else if (Float.isInfinite(slope3)) {
tx23 = x3;
ty23 = slope2 * tx23 + intercept2;
}
else {
tx23 = (intercept3 - intercept2)/(slope2 - slope3);
ty23 = slope2 * tx23 + intercept2;
}
// Find point midway between point 2 and point 3
midx23 = (x2 + x3)/2.0f;
midy23 = (y2 + y3)/2.0f;
// Find slope and intercept of line connecting intersection point of tangent2 and tangent3 and midpoint of 2 and 3
tangentx23 = tx23 - midx23;
tangenty23 = ty23 - midy23;
if (tangentx23 == 0.0f) {
slope23 = Float.POSITIVE_INFINITY;
}
else {
slope23 = tangenty23/tangentx23;
intercept23 = midy23 - slope23 * midx23;
}
// Don't use if lines are parallel
if (Float.isInfinite(slope12) && Float.isInfinite(slope23)) {
continue;
}
if (slope12 == slope23) {
continue;
}
// The estimated center of the ellipse is at the intersection of these 2 lines
if (Float.isInfinite(slope12)) {
xCenter = midx12;
yCenter = slope23 * xCenter + intercept23;
}
else if (Float.isInfinite(slope23)) {
xCenter = midx23;
yCenter = slope12 * xCenter + intercept12;
}
else {
xCenter = (intercept23 - intercept12)/(slope12 - slope23);
yCenter = slope12 * xCenter + intercept12;
}
if ((xCenter < minXCenter) || (xCenter > maxXCenter)) {
continue;
}
if ((yCenter < minYCenter) || (yCenter > maxYCenter)) {
continue;
}
// Translate the ellipse to be centered at the origin
x1c = x1 - xCenter;
x2c = x2 - xCenter;
x3c = x3 - xCenter;
y1c = y1 - yCenter;
y2c = y2 - yCenter;
y3c = y3 - yCenter;
// Solve:
// [x1c**2 2*x1c*y1c y1c**2] [a] [1]
// [x2c**2 2*x2c*y2c y2c**2] [b] = [1]
// [x3c**2 2*x3c*y3c y3c**2] [c] [1]
A.set(0, 0, x1c*x1c);
A.set(0, 1, 2.0*x1c*y1c);
A.set(0, 2, y1c*y1c);
A.set(1, 0, x2c*x2c);
A.set(1, 1, 2.0*x2c*y2c);
A.set(1, 2, y2c*y2c);
A.set(2, 0, x3c*x3c);
A.set(2, 1, 2.0*x3c*y3c);
A.set(2, 2, y3c*y3c);
B.set(0, 0, 1.0);
B.set(1, 0, 1.0);
B.set(2, 0, 1.0);
try {
X = A.solve(B);
}
catch (RuntimeException e) {
// Matrix is singular
continue;
}
if (X == null) continue;
// Obtain the remaining 3 ellipse parameters, a, b, and c
// where a*x**2 + 2*b*x*y + c*y**2 = 1
// in the now zero centered ellipse
a = X.get(0, 0);
b = X.get(1, 0);
c = X.get(2, 0);
// The inequality a*c - b**2 > 0 is true if the parameters represent a valid ellipse.
// If this inequality is false, it implies that either the 3 pixels do not lie on the same ellipse,
// or that the estimates of the tangents were inaccurate. In either case, we discard the
// parameters and choose a new pixel triplet.
if ((a*c - b*b) <= 0.0) {
continue;
}
// Convert a, b, and c to semi major axis r1, semi minor axis r2, and orientation angle theta
// Convert a*x**2 + 2*b*x*y + c*y**2 = 1 to
// (y*sin(theta) + x*cos(theta))**2/r1**2 + (y*cos(theta) - x*sin(theta))**2/r2**2 = 1
// If a = c, this is a circle with r1 = a, r2 = a, and theta = 0.
// y**2*(sin(theta))**2/r1**2 + 2*x*y*cos(theta)*sin(theta)/r1**2 + x**2*(cos(theta))**2/r1**2
// + y**2*(cos(theta))**2/r2**2 - 2*x*y*cos(theta)*sin(theta)/r2**2 + x**2*(sin(theta))**2/r2**2 = 1
// a = (cos(theta))**2/r1**2 + (sin(theta))**2/r2**2
// c = (sin(theta))**2/r1**2 + (cos(theta))**2/r2**2
// b = cos(theta)*sin(theta)*(1/r1**2 - 1/r2**2) = (1/2)*sin(2*theta)*(1/r1*2 - 1/r2**2)
// a + c = 1/r1**2 + 1/r2**2
// a - c = ((cos(theta))**2 - (sin(theta))**2)*(1/r1**2 - 1/r2**2)
// a - c = (cos(2*theta)) * (1/r1*2 - 1/r2**2)
// b/(a - c)= tan(2*theta)/2
// tan(2*theta) = tan(2*theta + PI) = (2*b)/(a - c)
// 2*theta = arctan((2*b)/(a - c)) and 2*theta + PI = arctan((2*b)/(a - c))
// theta = 0.5 * arctan((2*b)/(a - c)) and theta = 0.5 * arctan((2*b)/(a - c)) - PI/2
// sin(2*theta) = (2*b)/(1/r1**2 - 1/r2**2)
// cos(2*theta) = (a - c)/(1/r1**2 - 1/r2**2)
// 1 = (4*b**2 + (a - c)**2)/((1/r1**2 - 1/r2**2)**2)
// If r1 > r2, then (1/r1**2 - 1/r2**2) < 0 so
// 1/r1**2 - 1/r2**2 = -sqrt(4*b**2 + (a - c)**2)
// 1/r2**2 = a + c - 1/r1**2
// 2/r1**2 - a - c = -sqrt(4*b**2 + (a - c)**2)
// 2/r1**2 = a + c - sqrt(4*b**2 + (a - c)**2)
// r1**2/2 = 1/(a + c - sqrt(4*b**2 + (a - c)**2))
// r1 = sqrt(2)/sqrt(a + c - sqrt(4*b**2 + (a - c)**2))
// 1/r2**2 = a + c - 1/r1**2
// 1/r2**2 = (2*a + 2*c - (a + c - sqrt(4*b**2 + (a - c)**2)))/2
// 1/r2**2 = (a + c + sqrt(4*b**2 + (a - c)**2))/2
// r2 = sqrt(2)/sqrt(a + c + sqrt(4*b**2 + (a - c)**2))
if (a == c) {
// Circle
r1 = a;
r2 = a;
theta = 0.0;
}
else {
aminusc = a - c;
twob = 2.0*b;
var = Math.sqrt(twob*twob + aminusc*aminusc);
aplusc = a + c;
r1 = sqr2/Math.sqrt(aplusc - var);
r2 = sqr2/Math.sqrt(aplusc + var);
theta = 0.5 * Math.atan2(twob, aminusc);
}
if ((r1 < minR1) || (r1 > maxR1)) {
continue;
}
if ((r2 < minR2) || (r2 > maxR2)) {
continue;
}
pointSetsAcquired++;
xCenterIndex = (int)((xCenter - minXCenter)/maxPixelBinWidth);
yCenterIndex = (int)((yCenter - minYCenter)/maxPixelBinWidth);
r1Index = (int)((r1 - minR1)/maxPixelBinWidth);
r2Index = (int)((r2 - minR2)/maxPixelBinWidth);
thetaIndex = (int)((theta - minTheta)/maxRadiansDiff);
index = xCenterIndex + scale1 * yCenterIndex + scale12 * r1Index + scale123 * r2Index + scale1234 * thetaIndex;
xCenterArray[index] += xCenter;
yCenterArray[index] += yCenter;
r1Array[index] += r1;
r2Array[index] += r2;
thetaArray[index] += theta;
countArray[index]++;
} // while (pointSetsAcquired < pointSetsRequired)
for (i = 0; i < numBins; i++) {
testedArray[i] = false;
}
ellipseDetected = false;
while (!ellipseDetected) {
// Keep checking all bins that meet the countThreshold until an ellipse which
// has minCoverage percent of pixels along the perimiter is found
maxIndex = -1;
maxCount = 0;
for (i = 0; i < numBins; i++) {
if ((!testedArray[i]) && (countArray[i] > maxCount)) {
maxIndex = i;
maxCount = countArray[i];
}
} // for (i = 0; i < numBins; i++)
testedArray[maxIndex] = true;
if (maxCount < countThreshold) {
break;
}
// Check to see if ellipse perimiter and nearby has at least minCoverage percent pixels set
xCenter = xCenterArray[maxIndex]/maxCount;
yCenter = yCenterArray[maxIndex]/maxCount;
r1 = r1Array[maxIndex]/maxCount;
r2 = r2Array[maxIndex]/maxCount;
theta1 = thetaArray[maxIndex]/maxCount;
theta2 = theta1 - Math.PI/2.0;
h = ((r1 - r2)/(r1 + r2));
h = h * h;
perimiter = Math.PI * (r1 + r2) * (1 + (3*h)/(10 + Math.sqrt(4 - 3*h)));
minPixels = (int)(minCoverage * 0.01 * perimiter);
// 2 theta values separated by 90 degrees must both be examined to see which one
// yields the largest number of pixels along the perimiter
costheta1 = Math.cos(theta1);
sintheta1 = Math.sin(theta1);
costheta2 = Math.cos(theta2);
sintheta2 = Math.sin(theta2);
r1Sq = r1 * r1;
r2Sq = r2 * r2;
pointsOnEllipse1 = 0;
pointsOnEllipse2 = 0;
for (i = 0; i < numPoints; i++) {
x = indexArray[i] % xDim;
y = indexArray[i] / xDim;
// Check on a zero centered ellipse
xc = x - xCenter;
yc = y - yCenter;
var1 = yc * sintheta1 + xc*costheta1;
var2 = yc * costheta1 - xc*sintheta1;
checkVal = var1*var1/r1Sq + var2*var2/r2Sq;
if ((checkVal >= lowerLimit) && (checkVal <= upperLimit)) {
pointsOnEllipse1++;
if (foundPoint[i] == 0) {
foundPoint[i] = 1;
}
}
var1 = yc * sintheta2 + xc*costheta2;
var2 = yc * costheta2 - xc*sintheta2;
checkVal = var1*var1/r1Sq + var2*var2/r2Sq;
if ((checkVal >= lowerLimit) && (checkVal <= upperLimit)) {
pointsOnEllipse2++;
if ((foundPoint[i] == 0) || (foundPoint[i] == 1)) {
foundPoint[i] += 2;
}
}
} // for (i = 0; i < numPoints; i++)
if (pointsOnEllipse1 > pointsOnEllipse2) {
pointsOnEllipse = pointsOnEllipse1;
theta = theta1;
}
else {
pointsOnEllipse = pointsOnEllipse2;
theta = theta2;
}
if (pointsOnEllipse >= minPixels) {
xCenterTable[ellipsesFound] = (float)xCenter;
yCenterTable[ellipsesFound] = (float)yCenter;
r1Table[ellipsesFound] = (float)r1;
r2Table[ellipsesFound] = (float)r2;
thetaTable[ellipsesFound] = (float)(theta);
countTable[ellipsesFound] = pointsOnEllipse;
ellipsesFound++;
ellipseDetected = true;
ViewUserInterface.getReference().setDataText("Ellipse # " + ellipsesFound + " found\n");
ViewUserInterface.getReference().setDataText(" x center = " + xCenter + "\n");
ViewUserInterface.getReference().setDataText(" y center = " + yCenter + "\n");
ViewUserInterface.getReference().setDataText(" r1 = " + r1 + "\n");
ViewUserInterface.getReference().setDataText(" r2 = " + r2 + "\n");
ViewUserInterface.getReference().setDataText(" theta = " + (theta * 180/Math.PI) + "\n");
if (pointsOnEllipse1 > pointsOnEllipse2) {
for (i = 0; i < numPoints; i++) {
if ((foundPoint[i] == 1) || (foundPoint[i] == 3)) {
foundPoint[i] = 4;
}
else if (foundPoint[i] == 2) {
foundPoint[i] = 0;
}
}
} // if (pointsOnEllipse1 > pointsOnEllipse2)
else { // else pointsOnEllipse1 <= pointsOnEllipse2
for (i = 0; i < numPoints; i++) {
if ((foundPoint[i] == 2) || (foundPoint[i] == 3)) {
foundPoint[i] = 4;
}
else if (foundPoint[i] == 1) {
foundPoint[i] = 0;
}
}
} // else pointsOnEllipse
}
else { // pointsOnEllipse < minPixels
for (i = 0; i < numPoints; i++) {
if ((foundPoint[i] >= 1) && (foundPoint[i] <= 3)) {
foundPoint[i] = 0;
}
}
}
} // while (!ellipseDetected)
if (ellipsesFound == numEllipses) {
break;
}
// If an ellipse was found, then zero the Hough transform array before acquiring a
// new set of point triplets.
for (i = 0; i < numBins; i++) {
xCenterArray[i] = 0.0f;
yCenterArray[i] = 0.0f;
r1Array[i] = 0.0f;
r2Array[i] = 0.0f;
thetaArray[i] = 0.0f;
countArray[i] = 0;
}
// If an ellipse was found, then delete the points found along its perimiter
// from indexArray, slopeArray, and interceptArray before running the
// Hough transform again
pointsDeleted = 0;
for (i = 0; i < numPoints; i++) {
if (foundPoint[i] != 0) {
pointsDeleted++;
}
} // for (i = 0; i < numPoints; i++)
if (pointsDeleted > 0) {
newNumPoints = numPoints - pointsDeleted;
if (newNumPoints == 0) {
break;
}
newIndexArray = new int[newNumPoints];
newSlopeArray = new float[newNumPoints];
newInterceptArray = new float[newNumPoints];
for (i = 0, j = 0; i < numPoints; i++) {
if (foundPoint[i] == 0) {
newIndexArray[j] = indexArray[i];
newSlopeArray[j] = slopeArray[i];
newInterceptArray[j] = interceptArray[i];
j++;
}
} // for (i = 0, j = 0; i < numPoints; i++)
numPoints = newNumPoints;
foundPoint = null;
foundPoint = new byte[numPoints];
indexArray = null;
indexArray = new int[numPoints];
slopeArray = null;
slopeArray = new float[numPoints];
interceptArray = null;
interceptArray = new float[numPoints];
for (i = 0; i < numPoints; i++) {
indexArray[i] = newIndexArray[i];
slopeArray[i] = newSlopeArray[i];
interceptArray[i] = newInterceptArray[i];
}
newIndexArray = null;
newSlopeArray = null;
newInterceptArray = null;
} // if (pointsDeleted > 0)
} // while (ellipseFindCycles < maxEllipseFindCycles)
xCenterArray = null;
yCenterArray = null;
r1Array = null;
r2Array = null;
thetaArray = null;
foundPoint = null;
indexArray = null;
slopeArray = null;
interceptArray = null;
testedArray = null;
// try {
// A.finalize();
// B.finalize();
// if (X != null) {
// X.finalize();
// }
// }
// catch (Throwable e) {
//
// }
A = null;
B = null;
X = null;
randomGen = null;
// Restore original source values
if (!test) {
try {
srcImage.exportData(0, sourceSlice, srcBuffer);
} catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on srcImage.exportData");
setCompleted(false);
return;
}
} // if (!test)
// Create a dialog with numEllipsesFound xCenterTable[i], yCenterTable[i], r1Table[i],
// r2Table[i], thetaTable[i], and countTable[i] values, where the user will select a check box
// to have the selected ellipse drawn.
selectedEllipse = new boolean[ellipsesFound];
choice = new JDialogHoughEllipseChoice(ViewUserInterface.getReference().getMainFrame(), xCenterTable,
xDim, yCenterTable, yDim, r1Table, minR1, maxR1, r2Table, minR2, maxR2, thetaTable,
countTable, selectedEllipse);
if (!choice.okayPressed() ) {
setCompleted(false);
return;
}
for (i = 0; i < ellipsesFound; i++) {
if (selectedEllipse[i]) {
ellipsesDrawn++;
}
}
// Draw selected elipses
ellipsePoints = new int[ellipsesDrawn];
for (i = 0, k = 0; i < ellipsesFound; i++) {
if (selectedEllipse[i]) {
beta = thetaTable[i];
cosbeta = Math.cos(beta);
sinbeta = Math.sin(beta);
for (j = 0; j < 720; j++) {
alpha = j * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenterTable[i] + r1Table[i] * cosalpha * cosbeta - r2Table[i] * sinalpha * sinbeta);
if ((x >= 0) && (x < xDim)) {
y = (int)(yCenterTable[i] + r1Table[i] * cosalpha * sinbeta + r2Table[i] * sinalpha * cosbeta);
if ((y >= 0) && (y < yDim)) {
index = x + (xDim*y);
srcBuffer[index] = value;
ellipsePoints[k]++;
}
}
}
k++;
} // if (selectedEllipse[i])
} // for (i = 0; i < ellipsesFound; i++)
ellipseVOI = new VOI[ellipsesDrawn];
for (i = 0, k = 0; i < ellipsesFound; i++) {
if (selectedEllipse[i]) {
n = 0;
ellipseVOI[k] = new VOI((short)k, "ellipseVOI" + Integer.toString(k), 1, VOI.CONTOUR, -1.0f);
ellipseVOI[k].setColor(Color.red);
xArr = new float[ellipsePoints[k]];
yArr = new float[ellipsePoints[k]];
zArr = new float[ellipsePoints[k]];
beta = thetaTable[i];
cosbeta = Math.cos(beta);
sinbeta = Math.sin(beta);
for (j = 0; j < 720; j++) {
alpha = j * Math.PI/360.0;
cosalpha = Math.cos(alpha);
sinalpha = Math.sin(alpha);
x = (int)(xCenterTable[i] + r1Table[i] * cosalpha * cosbeta - r2Table[i] * sinalpha * sinbeta);
if ((x >= 0) && (x < xDim)) {
y = (int)(yCenterTable[i] + r1Table[i] * cosalpha * sinbeta + r2Table[i] * sinalpha * cosbeta);
if ((y >= 0) && (y < yDim)) {
xArr[n] = x;
yArr[n++] = y;
}
}
}
ellipseVOI[k].importCurve(xArr, yArr, zArr, 0);
((VOIContour)(ellipseVOI[k].getCurves()[0].elementAt(0))).setFixed(true);
destImage.registerVOI(ellipseVOI[k]);
k++;
} // if (selectedEllipse[i])
} // for (i = 0; i < ellipsesFound; i++)
try {
destImage.importData(0, srcBuffer, true);
} catch (IOException e) {
MipavUtil.displayError("IOException " + e + " on destImage.importData");
setCompleted(false);
return;
}
setCompleted(true);
return;
}
}
| [
"NIH\\mccreedy@ba61647d-9d00-f842-95cd-605cb4296b96"
] | NIH\mccreedy@ba61647d-9d00-f842-95cd-605cb4296b96 |
1d914a1e2f473f45552ed66aeb0e98c1d55b8d8f | 18eb53b7498baa3251e121003ab94314859f0838 | /webview/src/main/java/com/dzk/webview/mainprocess/MainProcessCommandManager.java | 17c403cfb45f1f366bd5ccbd01b6c1d3709f2d3e | [] | no_license | MirDong/WebView | dfe862acf4014182f82506f39a1cab3aadf84539 | 54da89a0daaf26eb620cb9e08f5dcee261ee27c8 | refs/heads/master | 2022-12-14T18:32:47.362224 | 2020-09-07T07:06:40 | 2020-09-07T07:06:40 | 286,782,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,769 | java | package com.dzk.webview.mainprocess;
import android.os.RemoteException;
import com.dzk.webview.ICallbackFromMainProcessToWebViewProcessInterface;
import com.dzk.webview.IWebViewProcessToMainProcessInterface;
import com.dzk.webview.command.Command;
import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;
/**
* @author Administrator
*/
public class MainProcessCommandManager extends IWebViewProcessToMainProcessInterface.Stub {
private static MainProcessCommandManager sInstance;
private static final HashMap<String, Command> sCommands = new HashMap<>();
public static MainProcessCommandManager getInstance(){
if (sInstance == null){
synchronized (MainProcessCommandManager.class){
if (sInstance == null){
sInstance = new MainProcessCommandManager();
}
}
}
return sInstance;
}
private MainProcessCommandManager(){
ServiceLoader<Command> serviceLoader = ServiceLoader.load(Command.class);
for (Command command : serviceLoader) {
if (!sCommands.containsKey(command.name())){
sCommands.put(command.name(),command);
}
}
}
public void executeCommand(String commandName, Map parameter, ICallbackFromMainProcessToWebViewProcessInterface callback){
sCommands.get(commandName).execute(parameter,callback);
}
@Override
public void handleCommand(String commandName, String jsonParams, ICallbackFromMainProcessToWebViewProcessInterface callback) throws RemoteException {
MainProcessCommandManager.getInstance().executeCommand(commandName,new Gson().fromJson(jsonParams, Map.class),callback);
}
}
| [
"v_zakudong@tencent.com"
] | v_zakudong@tencent.com |
d5c779122ecc5d807d1e496680d9e7800d8754e8 | 62083e7d322b577aeaec800dc83f07ff4160c804 | /product-csv-reader/src/test/java/com/product/productcsvreader/ProductCsvReaderApplicationTests.java | bf8d627c5dd60d368c9560b82caa254b8715a5b7 | [] | no_license | prasad424jntu/product-management-system | ab1d39f2f2f5b77e66035e4dd8b3fb502fa56635 | 893a927caa9176173c88104a59681269a15fb306 | refs/heads/master | 2022-02-15T17:12:33.695460 | 2019-07-21T17:09:13 | 2019-07-21T17:09:13 | 197,956,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.product.productcsvreader;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProductCsvReaderApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"prasad424jntu@gmail.com"
] | prasad424jntu@gmail.com |
1228414045f7baa98828f8ebd992e66783a2d111 | 830c1a6755dfa669e5f50d2f4aa80f47a5cae8af | /app/src/main/java/com/example/myfragment/topSectionFragment.java | e02e2c71df33e56f6a29932e017c90e8a6590d09 | [] | no_license | LizaMNNIT/Apprise | f10b116750883f0fb2e5c3cd770d8fd486d22137 | fcd7bf781ebd59778b2ff9dfd8d104ba516db89d | refs/heads/master | 2020-12-23T13:31:08.055008 | 2020-01-30T08:18:03 | 2020-01-30T08:18:03 | 237,167,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.example.myfragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class topSectionFragment extends Fragment{
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.top_fragment,container,false);
return view;
}
}
| [
"singlaliza98@gmail.com"
] | singlaliza98@gmail.com |
669725de89b84d94929d4818e5657184246b6312 | aea8b8ff06502bf29e0568448168a5206e229fe5 | /src/main/java/com/example/tutorial/entities/Subcategory.java | 4e24c1e7be0b639475d8b5f3ad5cfe4b5e36010f | [] | no_license | dusanstanojevic1940/clasified | 3098032a9ba38964ba7660c047a926383dd4c326 | e9a4a046057481394b22768868b7daa69fd66d1f | refs/heads/master | 2021-01-13T01:46:22.708264 | 2015-04-13T23:13:08 | 2015-04-13T23:13:08 | 33,824,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package com.example.tutorial.entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.tapestry5.beaneditor.NonVisual;
@Entity
@Table(name="subcategory")
public class Subcategory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@NonVisual
@Column(name="subcategory_id")
public Long id;
@NonVisual
@Column(name="category_id")
public Long category_id;
@Column(name="name")
public String name;
//@OneToMany(fetch = FetchType.LAZY, mappedBy = "subcategory", targetEntity=Post.class, cascade={ CascadeType.ALL})
//public List<Post> posts;
@Column(name="shown_on_top_page")
public boolean showOnTopPage;
//@ManyToOne(targetEntity=Category.class, cascade = { CascadeType.ALL },fetch = FetchType.EAGER)
//@JoinColumn(name = "category_id",referencedColumnName="category_id")
//public Category category;
@Override
public int hashCode() {
return (int)((long)id);
};
@Override
public boolean equals(Object obj) {
if (obj instanceof Subcategory)
return ((Subcategory)obj).id.equals(id);
return false;
}
}
| [
"dusan.stanojevic95@gmail.com"
] | dusan.stanojevic95@gmail.com |
25da7dd84c67e4d62b565ef3b61d24134930aec7 | b01ae19d6bce9229b83d0165601719ae53ae2ed0 | /android/versioned-abis/expoview-abi46_0_0/src/main/java/abi46_0_0/expo/modules/adapters/react/ReactModuleRegistryProvider.java | 0c8d36d927c061e0ebc2223a0e1c07a746fc1a81 | [
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | Abhishek12345679/expo | 1655f4f71afbee0e8ef4680e43586168f75e1914 | 8257de135f6d333860a73676509332c9cde04ba5 | refs/heads/main | 2023-02-20T19:46:17.694860 | 2022-11-21T15:48:20 | 2022-11-21T15:48:20 | 568,898,209 | 1 | 0 | MIT | 2022-11-21T16:39:42 | 2022-11-21T16:39:41 | null | UTF-8 | Java | false | false | 3,889 | java | package abi46_0_0.expo.modules.adapters.react;
import android.content.Context;
import abi46_0_0.com.facebook.react.ReactPackage;
import abi46_0_0.com.facebook.react.bridge.ReactApplicationContext;
import abi46_0_0.expo.modules.core.ExportedModule;
import abi46_0_0.expo.modules.core.ModuleRegistry;
import abi46_0_0.expo.modules.core.ModuleRegistryProvider;
import abi46_0_0.expo.modules.core.ViewManager;
import abi46_0_0.expo.modules.core.interfaces.InternalModule;
import abi46_0_0.expo.modules.core.interfaces.Package;
import expo.modules.core.interfaces.SingletonModule;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
/**
* Since React Native v0.55, {@link abi46_0_0.com.facebook.react.ReactPackage#createViewManagers(ReactApplicationContext)}
* gets called only once per lifetime of {@link abi46_0_0.com.facebook.react.ReactInstanceManager}.
* <p>
* To make @unimodules/react-native-adapter compatible with this change we have to remember view managers collection
* which is returned in {@link ModuleRegistryAdapter#createViewManagers(ReactApplicationContext)}
* only once (and managers returned this one time will persist "forever").
*/
public class ReactModuleRegistryProvider extends ModuleRegistryProvider {
private Collection<ViewManager> mViewManagers;
private Collection<abi46_0_0.com.facebook.react.uimanager.ViewManager> mReactViewManagers;
private Collection<SingletonModule> mSingletonModules;
public ReactModuleRegistryProvider(List<Package> initialPackages) {
this(initialPackages, null);
}
public ReactModuleRegistryProvider(List<Package> initialPackages, List<SingletonModule> singletonModules) {
super(initialPackages);
mSingletonModules = singletonModules;
}
@Override
public ModuleRegistry get(Context context) {
Collection<InternalModule> internalModules = new ArrayList<>();
Collection<ExportedModule> exportedModules = new ArrayList<>();
ReactPackagesProvider reactPackagesProvider = new ReactPackagesProvider();
for (Package pkg : getPackages()) {
internalModules.addAll(pkg.createInternalModules(context));
exportedModules.addAll(pkg.createExportedModules(context));
if (pkg instanceof ReactPackage) {
reactPackagesProvider.addPackage((ReactPackage) pkg);
}
}
internalModules.add(reactPackagesProvider);
return new ModuleRegistry(internalModules, exportedModules, getViewManagers(context), getSingletonModules(context));
}
private Collection<SingletonModule> getSingletonModules(Context context) {
// If singleton modules were provided to registry provider, then just pass them to module registry.
if (mSingletonModules != null) {
return mSingletonModules;
}
Collection<SingletonModule> singletonModules = new ArrayList<>();
for (Package pkg : getPackages()) {
singletonModules.addAll(pkg.createSingletonModules(context));
}
return singletonModules;
}
// TODO: change access to package private when react-native-adapter was removed.
public Collection<ViewManager> getViewManagers(Context context) {
if (mViewManagers != null) {
return mViewManagers;
}
mViewManagers = new HashSet<>();
mViewManagers.addAll(createViewManagers(context));
return mViewManagers;
}
// TODO: change access to package private when react-native-adapter was removed.
public Collection<abi46_0_0.com.facebook.react.uimanager.ViewManager> getReactViewManagers(ReactApplicationContext context) {
if (mReactViewManagers != null) {
return mReactViewManagers;
}
mReactViewManagers = new HashSet<>();
for (Package pkg : getPackages()) {
if (pkg instanceof ReactPackage) {
mReactViewManagers.addAll(((ReactPackage) pkg).createViewManagers(context));
}
}
return mReactViewManagers;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
68c0b94d26f092638ad17da6cdedd1d7711c71ae | 78d6c9bcf40d900a1f0ee223dcab473ed5b170b4 | /maven-plugin/src/main/java/org/l2x6/cq/maven/ExamplesSetPlatformMojo.java | 8ebdaef77dbb8a37c943c9d2ed8b1ad94673bde7 | [
"Apache-2.0"
] | permissive | l2x6/cq-maven-plugin | 3d6f6c8995f6b9913c99c1cbbceec8b6a6cf8815 | 8c410eab75b0db18810fd04dc45314a1a493a002 | refs/heads/main | 2023-08-07T20:32:05.635157 | 2023-08-07T08:55:02 | 2023-08-07T09:05:30 | 247,812,510 | 4 | 10 | NOASSERTION | 2023-09-13T15:46:50 | 2020-03-16T20:41:40 | Java | UTF-8 | Java | false | false | 15,565 | java | /*
* Copyright (c) 2020 CQ Maven Plugin
* project contributors as indicated by the @author tags.
*
* 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.l2x6.cq.maven;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.l2x6.cq.common.CqCommonUtils;
import org.l2x6.pom.tuner.PomTransformer;
import org.l2x6.pom.tuner.PomTransformer.ContainerElement;
import org.l2x6.pom.tuner.PomTransformer.SimpleElementWhitespace;
import org.l2x6.pom.tuner.PomTransformer.TransformationContext;
import org.w3c.dom.Document;
/**
* Sets either the just released Quarkus platform on all examples under the current directory via
* {@code -Dcq.quarkus.platform.version=...}
* or sets the {@code camel-quarkus-bom} instead via {@code -Dcq.camel-quarkus.version=...}
* <p>
* Optionally can also set the project versions via {@code -Dcq.newVersion=...}.
*
* @since 2.10.0
*/
@Mojo(name = "examples-set-platform", requiresProject = false)
public class ExamplesSetPlatformMojo extends AbstractMojo {
private static final String CQ_CAMEL_QUARKUS_VERSION = "cq.camel-quarkus.version";
private static final String CQ_QUARKUS_PLATFORM_VERSION = "cq.quarkus.platform.version";
/**
* Directory where the changes should be performed. Default is the current directory of the current Java process.
*
* @since 2.10.0
*/
@Parameter(property = "cq.basedir", defaultValue = "${project.basedir}")
File basedir;
private Path basePath;
/**
* Encoding to read and write files in the current source tree
*
* @since 2.10.0
*/
@Parameter(defaultValue = CqUtils.DEFAULT_ENCODING, required = true, property = "cq.encoding")
String encoding;
Charset charset;
/**
* The Quarkus platform version to use in {@code <quarkus.platform.version>} and
* {@code <camel-quarkus.platform.version>}.
* If you set this, do not set {@link #camelQuarkusVersion}.
*
* @since 2.10.0
*/
@Parameter(property = CQ_QUARKUS_PLATFORM_VERSION)
String quarkusPlatformVersion;
/**
* The Camel Quarkus version to use in {@code <camel-quarkus.platform.version>}.
* {@code <quarkus.platform.version>} will be set to the quarkus version available in {@code camel-quarkus-bom}.
* If you set this, do not set {@link #quarkusPlatformVersion}.
*
* @since 2.10.0
*/
@Parameter(property = CQ_CAMEL_QUARKUS_VERSION)
String camelQuarkusVersion;
/**
* Skip the execution of this mojo.
*
* @since 2.10.0
*/
@Parameter(property = "cq.examples.skip", defaultValue = "false")
boolean skip;
/**
* The project version to set
*
* @since 2.10.0
*/
@Parameter(property = "cq.newVersion")
String newVersion;
@Parameter(defaultValue = "${settings.localRepository}", readonly = true)
String localRepository;
/**
* How to format simple XML elements ({@code <elem/>}) - with or without space before the slash.
*
* @since 2.10.0
*/
@Parameter(property = "cq.simpleElementWhitespace", defaultValue = "EMPTY")
SimpleElementWhitespace simpleElementWhitespace;
@Parameter(defaultValue = "${plugin}", readonly = true)
private PluginDescriptor plugin;
boolean isChecking() {
return false;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
getLog().info("Skipping as requested by the user");
return;
}
basePath = basedir != null ? basedir.toPath().toAbsolutePath().normalize() : Paths.get(".");
charset = Charset.forName(encoding);
if (isChecking()) {
if (quarkusPlatformVersion != null) {
throw new MojoFailureException(CQ_QUARKUS_PLATFORM_VERSION + " should be null in checking mode");
}
if (camelQuarkusVersion != null) {
throw new MojoFailureException(CQ_CAMEL_QUARKUS_VERSION + " should be null in checking mode");
}
try (Stream<Path> dirs = Files.list(basePath)) {
final Path firstPomXml = dirs
.map(dir -> dir.resolve("pom.xml"))
.filter(Files::isRegularFile)
.findFirst()
.orElseThrow(() -> new RuntimeException("Could not find any example project under " + basePath));
final Model fistModel = CqCommonUtils.readPom(firstPomXml, charset);
final Properties props = fistModel.getProperties();
final String cqBomVersion = props.getProperty("camel-quarkus.platform.version");
if (!cqBomVersion.startsWith("$")) {
camelQuarkusVersion = cqBomVersion;
} else {
final String quarkusBomVersion = props.getProperty("quarkus.platform.version");
if (!quarkusBomVersion.startsWith("$")) {
quarkusPlatformVersion = quarkusBomVersion;
} else {
throw new MojoFailureException(
"One of camel-quarkus.platform.version and quarkus.platform.version in " + firstPomXml
+ " must be a literal. Found: "
+ camelQuarkusVersion + " and " + quarkusBomVersion);
}
}
} catch (IOException e) {
throw new RuntimeException("Could not list " + basePath, e);
}
} else {
if (quarkusPlatformVersion != null && camelQuarkusVersion != null) {
throw new MojoFailureException(
"Set only one of " + CQ_QUARKUS_PLATFORM_VERSION + " and " + CQ_CAMEL_QUARKUS_VERSION);
}
}
final String quarkusBomGroupId;
final String quarkusBomArtifactId;
final String quarkusBomVersion;
final String cqBomGroupId;
final String cqBomArtifactId;
final String cqBomVersion;
final String cqVersion;
if (quarkusPlatformVersion != null) {
quarkusBomGroupId = "io.quarkus.platform";
quarkusBomArtifactId = "quarkus-bom";
quarkusBomVersion = quarkusPlatformVersion;
cqBomGroupId = "${quarkus.platform.group-id}";
cqBomArtifactId = "quarkus-camel-bom";
cqBomVersion = "${quarkus.platform.version}";
cqVersion = findCamelQuarkusVersion(Paths.get(localRepository), charset, quarkusPlatformVersion);
} else {
quarkusBomGroupId = "io.quarkus";
quarkusBomArtifactId = "quarkus-bom";
quarkusBomVersion = findQuarkusVersion(Paths.get(localRepository), charset, camelQuarkusVersion);
cqBomGroupId = "org.apache.camel.quarkus";
cqBomArtifactId = "camel-quarkus-bom";
cqBomVersion = camelQuarkusVersion;
cqVersion = "${camel-quarkus.platform.version}";
}
final List<String> issues = new ArrayList<>();
try (Stream<Path> dirs = Files.list(basePath)) {
dirs
.map(dir -> dir.resolve("pom.xml"))
.filter(Files::isRegularFile)
.forEach(pomXmlPath -> {
if (isChecking()) {
final Model model = CqCommonUtils.readPom(pomXmlPath, charset);
final Properties props = model.getProperties();
assertRequiredProperty(pomXmlPath, props, "quarkus.platform.group-id", quarkusBomGroupId, issues);
assertRequiredProperty(pomXmlPath, props, "quarkus.platform.artifact-id", quarkusBomArtifactId,
issues);
assertRequiredProperty(pomXmlPath, props, "quarkus.platform.version", quarkusBomVersion, issues);
assertRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.group-id", cqBomGroupId, issues);
assertRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.artifact-id", cqBomArtifactId,
issues);
assertRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.version", cqBomVersion, issues);
if (props.containsKey("camel-quarkus.version")) {
assertRequiredProperty(pomXmlPath, props, "camel-quarkus.version", cqVersion, issues);
}
} else {
new PomTransformer(pomXmlPath, charset, simpleElementWhitespace).transform(
(Document document, TransformationContext context) -> {
if (newVersion != null && !newVersion.isEmpty()) {
context.getContainerElement("project", "version")
.ifPresent(version -> version.getNode().setTextContent(newVersion));
}
final ContainerElement props = context.getOrAddContainerElement("properties");
setRequiredProperty(pomXmlPath, props, "quarkus.platform.group-id", quarkusBomGroupId);
setRequiredProperty(pomXmlPath, props, "quarkus.platform.artifact-id",
quarkusBomArtifactId);
setRequiredProperty(pomXmlPath, props, "quarkus.platform.version", quarkusBomVersion);
setRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.group-id",
cqBomGroupId);
setRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.artifact-id",
cqBomArtifactId);
setRequiredProperty(pomXmlPath, props, "camel-quarkus.platform.version",
cqBomVersion);
props.getChildContainerElement("camel-quarkus.version")
.ifPresent(v -> v.getNode().setTextContent(cqVersion));
});
}
});
} catch (IOException e) {
throw new RuntimeException("Could not list " + basePath, e);
}
if (isChecking() && !issues.isEmpty()) {
final String param = quarkusPlatformVersion != null
? "-D" + CQ_QUARKUS_PLATFORM_VERSION + "=" + quarkusPlatformVersion
: "-D" + CQ_CAMEL_QUARKUS_VERSION + "=" + camelQuarkusVersion;
throw new MojoFailureException(
"Found " + issues.size() + " consistency issues:\n - "
+ issues.stream().collect(Collectors.joining("\n - "))
+ "\n\nYou may want to run mvn org.l2x6.cq:cq-maven-plugin:" + plugin.getVersion()
+ ":examples-set-platform " + param);
}
}
static void assertRequiredProperty(Path pomXmlPath, Properties props, String key, String expectedValue,
List<String> issues) {
final String actual = props.getProperty(key);
if (!expectedValue.equals(actual)) {
issues.add("Expected <" + key + ">" + expectedValue + "</" + key + ">, found " + actual + " in " + pomXmlPath);
}
}
static String findQuarkusVersion(Path localRepository, Charset charset, String camelQuarkusVersion) {
final Path cqPomPath = CqCommonUtils.copyArtifact(
localRepository,
"org.apache.camel.quarkus",
"camel-quarkus",
camelQuarkusVersion,
"pom",
Collections.singletonList("https://repo1.maven.org/maven2"));
final Model cqModel = CqCommonUtils.readPom(cqPomPath, charset);
final String v = cqModel.getProperties().entrySet().stream()
.filter(prop -> prop.getKey().equals("quarkus.version"))
.map(Entry::getValue)
.map(Object::toString)
.findFirst()
.orElseThrow(() -> new RuntimeException("Could not find <quarkus.version> in " + cqPomPath));
if (v.startsWith("$")) {
throw new RuntimeException(
"The version of io.quarkus:quarkus-bom in " + cqPomPath + " should be a literal; found: " + v);
}
return v;
}
static String findCamelQuarkusVersion(Path localRepository, Charset charset, String quarkusPlatformVersion) {
final Path cqPomPath = CqCommonUtils.copyArtifact(
localRepository,
"io.quarkus.platform",
"quarkus-camel-bom",
quarkusPlatformVersion,
"pom",
Collections.singletonList("https://repo1.maven.org/maven2"));
final Model cqModel = CqCommonUtils.readPom(cqPomPath, charset);
final String v = cqModel.getDependencyManagement().getDependencies().stream()
.filter(dep -> dep.getGroupId().equals("org.apache.camel.quarkus"))
.findFirst()
.orElseThrow(() -> new RuntimeException(
"Could not find any managed dependency having org.apache.camel.quarkus groupId in " + cqPomPath))
.getVersion();
if (v.startsWith("$")) {
throw new RuntimeException(
"Camel Quarkus version on the first managed dependency having org.apache.camel.quarkus groupId should be a literal; found: "
+ v);
}
return v;
}
static void setRequiredProperty(Path pomXmlPath, ContainerElement props, String name, String value) {
props
.getChildContainerElement(name)
.orElseThrow(() -> new RuntimeException("Could not find <" + name + "> property in " + pomXmlPath))
.getNode().setTextContent(value);
}
}
| [
"ppalaga@redhat.com"
] | ppalaga@redhat.com |
36ee865e57b36e2f6808fd419af80760df97e88e | 75035aed65fc11f993f75f085204340658d472a3 | /app/src/main/java/com/example/geek/testingapp/test/SettingsActivity.java | 9eebec7bcd720b06f63afcf2631c964e7cf242d7 | [] | no_license | DJShamix/WeatherYouGo | a7ab095070e2d27cf898ea60c84f16d0b5f33afe | fe888c277c0f71cb6db25baf97411d128ad8e317 | refs/heads/master | 2021-01-17T16:22:42.938018 | 2016-07-30T12:41:04 | 2016-07-30T12:41:04 | 63,078,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,302 | java | /**
* The MIT License (MIT)
*
* Copyright (c) 2015 Yoel Nunez <dev@nunez.guru>
*
* 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.
*
*/
package com.example.geek.testingapp.test;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.widget.Toolbar;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.geek.testingapp.R;
import com.example.geek.testingapp.fragments.SettingsFragment;
public class SettingsActivity extends PreferenceActivity {
private AppCompatDelegate delegate;
@Override
protected void onCreate(Bundle savedInstanceState) {
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
// Display the fragment as the main content.
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
getDelegate().onPostCreate(savedInstanceState);
}
public ActionBar getSupportActionBar() {
return getDelegate().getSupportActionBar();
}
public void setSupportActionBar(@Nullable Toolbar toolbar) {
getDelegate().setSupportActionBar(toolbar);
}
@Override
public MenuInflater getMenuInflater() {
return getDelegate().getMenuInflater();
}
@Override
public void setContentView(@LayoutRes int layoutResID) {
getDelegate().setContentView(layoutResID);
}
@Override
public void setContentView(View view) {
getDelegate().setContentView(view);
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().setContentView(view, params);
}
@Override
public void addContentView(View view, ViewGroup.LayoutParams params) {
getDelegate().addContentView(view, params);
}
@Override
protected void onPostResume() {
super.onPostResume();
getDelegate().onPostResume();
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
getDelegate().setTitle(title);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
getDelegate().onConfigurationChanged(newConfig);
}
@Override
protected void onStop() {
super.onStop();
getDelegate().onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
getDelegate().onDestroy();
}
public void invalidateOptionsMenu() {
getDelegate().invalidateOptionsMenu();
}
private AppCompatDelegate getDelegate() {
if (delegate == null) {
delegate = AppCompatDelegate.create(this, null);
setTitle(R.string.settings);
}
return delegate;
}
}
| [
"Valiullin1995@mail.ru"
] | Valiullin1995@mail.ru |
12efeb687dd643c227790b36107b363105bd94f6 | 1e6f3912b31642613eb8bb0041d065043e8e56e4 | /src/test/java/ru/ifmo/docx_templater/TemplaterTest.java | eda3caf6c5e681f7333ebb93e4b274e64ac2d4c5 | [
"MIT"
] | permissive | DmytriiGrishin/diplom | 24851017d5ebaf8ea4b00da6a809b991127c3b81 | 4d26ff6af3cf1a1260354f6459190d9eded73af4 | refs/heads/master | 2020-05-08T22:46:17.510710 | 2019-04-22T23:17:51 | 2019-04-22T23:17:51 | 180,970,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,667 | java | package ru.ifmo.docx_templater;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.util.ArrayList;
import static org.junit.jupiter.api.Assertions.*;
class TemplaterTest {
@Test
public void testShowParagraphHide() throws IOException {
InputStream template = getClass().getResourceAsStream("hideParagraph.docx");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Templater<Object> templater = new Templater<>();
templater.process(template, new ArrayList<>(), out);
ByteArrayInputStream result = new ByteArrayInputStream(out.toByteArray());
XWPFDocument resultDocument = new XWPFDocument(result);
int size = resultDocument.getParagraphs().size();
assertEquals(0, size);
FileOutputStream outputStream = new FileOutputStream("hideParagraphResult.docx");
resultDocument.write(outputStream);
}
@Test
public void testShowParagraph() throws IOException {
InputStream template = getClass().getResourceAsStream("showParagraph.docx");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Templater<Object> templater = new Templater<>();
templater.process(template, new ArrayList<>(), out);
ByteArrayInputStream result = new ByteArrayInputStream(out.toByteArray());
XWPFDocument resultDocument = new XWPFDocument(result);
int size = resultDocument.getParagraphs().size();
assertEquals(4, size);
FileOutputStream outputStream = new FileOutputStream("showParagraphResult.docx");
resultDocument.write(outputStream);
}
} | [
"dmytriigrishin@gmail.com"
] | dmytriigrishin@gmail.com |
decb53a6712c0f91f1ed978d14ba6c6b1e4826a1 | 6244785c662d1ea14928f796e60ba33b4628cbc9 | /autosize/src/main/java/me/jessyan/autosize/utils/ScreenUtils.java | ff0dee711e96eefa45584c9984aa0c2bc40f9851 | [
"Apache-2.0"
] | permissive | quintushorace/AndroidAutoSize | 10971c513b75f7c4bc9080944413d2a15f333930 | 8bf46cbab4b3503f958b0c2e356847bd75bcfcfe | refs/heads/master | 2020-03-27T02:43:34.554274 | 2018-08-23T03:59:38 | 2018-08-23T03:59:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,464 | java | /*
* Copyright 2018 JessYan
*
* 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 me.jessyan.autosize.utils;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
/**
* ================================================
* Created by JessYan on 26/09/2016 16:59
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* ================================================
*/
public class ScreenUtils {
private ScreenUtils() {
throw new IllegalStateException("you can't instantiate me!");
}
public static int getStatusBarHeight() {
int result = 0;
try {
int resourceId = Resources.getSystem().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
result = Resources.getSystem().getDimensionPixelSize(resourceId);
}
} catch (Resources.NotFoundException e) {
e.printStackTrace();
}
return result;
}
public static int[] getScreenSize(Context context) {
int[] size = new int[2];
WindowManager w = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display d = w.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
d.getMetrics(metrics);
// since SDK_INT = 1;
int widthPixels = metrics.widthPixels;
int heightPixels = metrics.heightPixels;
// includes window decorations (statusbar bar/menu bar)
if (Build.VERSION.SDK_INT >= 14 && Build.VERSION.SDK_INT < 17)
try {
widthPixels = (Integer) Display.class.getMethod("getRawWidth").invoke(d);
heightPixels = (Integer) Display.class.getMethod("getRawHeight").invoke(d);
} catch (Exception ignored) {
}
// includes window decorations (statusbar bar/menu bar)
if (Build.VERSION.SDK_INT >= 17)
try {
Point realSize = new Point();
Display.class.getMethod("getRealSize", Point.class).invoke(d, realSize);
widthPixels = realSize.x;
heightPixels = realSize.y;
} catch (Exception ignored) {
}
size[0] = widthPixels;
size[1] = heightPixels;
return size;
}
public static int getHeightOfNavigationBar(Context context) {
Display d = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int realHeight = getScreenSize(context)[1];
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
return realHeight - displayHeight;
}
}
| [
"jessyan@foxmail.com"
] | jessyan@foxmail.com |
737a6b1c65c02e472cd97f3984a86c4f5ad9f0a2 | 2529998c07aafa1f7365ababe5cbe17e85fdcfa4 | /week-06/Day-05/src/main/java/com/bodavivi/basicwebshop/BasicwebshopApplication.java | 6309c6b8f157c00f90d6084d9830802795094337 | [] | no_license | green-fox-academy/bodavivi | 73a1012a011fb32701065663b9e4f78fca40f604 | 603acf231cabdf24c227d6287ee8f92eaeec66d0 | refs/heads/master | 2020-07-24T05:10:58.611946 | 2019-11-25T15:46:01 | 2019-11-25T15:46:01 | 207,810,737 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.bodavivi.basicwebshop;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BasicwebshopApplication {
public static void main(String[] args) {
SpringApplication.run(BasicwebshopApplication.class, args);
}
}
| [
"bodavivienviktoria@gmail.com"
] | bodavivienviktoria@gmail.com |
65d8f4abdaed82deba209e2350f461f42f60ca63 | 2d3648fd70865652585d8b8f7bdbff0c83d75a90 | /src/main/java/es/altair/dao/EquiposDAOImplHibernate.java | cf15e29d476056fd9d5b5b46e46d2ea36b5ef1e2 | [] | no_license | DesarolloWebEntornoCliente/Hibernate1N | ad48d295ee23b82fd3059dadb885900510b0e493 | 17a055d921fe33bddf07ee53dc58b1bde2b5dcb7 | refs/heads/master | 2021-05-08T03:01:46.597365 | 2017-10-26T08:03:44 | 2017-10-26T08:03:44 | 108,109,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,162 | java | package es.altair.dao;
import java.util.List;
import java.util.Scanner;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import es.altair.bean.Equipos;
public class EquiposDAOImplHibernate implements EquiposDAO {
private static Scanner sc = new Scanner(System.in);
private static Scanner tecladoLine = new Scanner(System.in);
private static Scanner tecladoInt = new Scanner(System.in);
public void guardar(Equipos e) {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session sesion = sf.openSession();
try {
sesion.beginTransaction();
sesion.save(e);
sesion.getTransaction().commit();
} catch (Exception e2) {
e2.printStackTrace();
} finally {
sesion.close();
sf.close();
}
}
public Equipos colectarDatos() {
System.out.println("Introduzca los Datos del Nuevo Equipo [ENTER para Retornar]");
System.out.println();
System.out.println("Nombre: ");
String nombre = tecladoLine.nextLine();
if(nombre.trim().length() != 0) {
System.out.println("Ciudad: ");
String ciudad = tecladoLine.nextLine();
System.out.println("Edad: ");
int numSocios = tecladoInt.nextInt();
Equipos e = new Equipos(nombre,ciudad,numSocios);
return e;
}
return null;
}
public Equipos obtenerEquipos(int idEquipo) {
Equipos equipo = null;
SessionFactory sessionFactory;
StandardServiceRegistry str = new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build();
Metadata mt = new MetadataSources(str).getMetadataBuilder().build();
sessionFactory = mt.getSessionFactoryBuilder().build();
Session sesion = sessionFactory.openSession();
sesion.beginTransaction();
equipo = (Equipos) sesion.get(Equipos.class, idEquipo);
sesion.close();
sessionFactory.close();
return equipo;
}
public List<Equipos> listaEquipos() {
List<Equipos> listaEquipo = null;
SessionFactory sessionFactory;
StandardServiceRegistry str = new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build();
Metadata mt = new MetadataSources(str).getMetadataBuilder().build();
sessionFactory = mt.getSessionFactoryBuilder().build();
Session sesion = sessionFactory.openSession();
sesion.beginTransaction();
listaEquipo = sesion.createQuery("from Equipos").list();
sesion.close();
sessionFactory.close();
return listaEquipo;
}
}
| [
"railton.cardoso@hotmail.com"
] | railton.cardoso@hotmail.com |
655f211aef8c6b642d445f7e470564124c5ef0dc | 6ea1619faaff5b87a3a12a9c71e7b0500a5b991d | /app/src/main/java/com/abc/fragment_imaderomiandika/fragment/About.java | f36abfeb9949e6b759b9b47cecf777436f4e64e6 | [] | no_license | Romiandikas/Fragment-Android-Studio | 8f3fb38abf6d9936a7098586d5290f1f4b0bea68 | 3e65e184ac3a9dd5afd26bfc61bf672e0e274a4d | refs/heads/master | 2023-04-14T03:16:56.248777 | 2021-04-26T14:37:19 | 2021-04-26T14:37:19 | 361,781,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,040 | java | package com.abc.fragment_imaderomiandika.fragment;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.abc.fragment_imaderomiandika.R;
/**
* A simple {@link Fragment} subclass.
* Use the {@link About#newInstance} factory method to
* create an instance of this fragment.
*/
public class About extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public About() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment About.
*/
// TODO: Rename and change types and number of parameters
public static About newInstance(String param1, String param2) {
About fragment = new About();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_about, container, false);
}
} | [
"Romiandika01@gmail.com"
] | Romiandika01@gmail.com |
e48c824c467f6cf49b084d73e13ef8660724726c | 9258e7ce41b7a21a66837919f016098155a0fdaa | /app/src/main/java/com/example/rotatingcubeimplementation/Map.java | da457f46002bcd3840b01319fe4688db000a6842 | [] | no_license | TheMarchack/RotatingCubeImplementation | 214feb0162bf79065619c0ca85b96b0c31a6a583 | f8a4c8da188e3c1a63ba796ca064762210c9d2a7 | refs/heads/master | 2023-06-04T10:23:10.200139 | 2021-06-25T14:22:29 | 2021-06-25T14:22:29 | 379,893,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | package com.example.rotatingcubeimplementation;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class Map {
int mHeight = 2000;
int mWidth = 4000;
String imgLoc = "../../res/drawable/map.jpg";
Bitmap bitmap = null;
Canvas Map;
Paint white = null;
Paint black = null;
public Map() {
bitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
Map = new Canvas(bitmap);
white = new Paint();
white.setStyle(Paint.Style.FILL);
white.setColor(Color.WHITE);
black = new Paint();
black.setStyle(Paint.Style.FILL);
black.setColor(Color.BLACK);
Map.drawPaint(white);
FileOutputStream out = null;
try {
out = new FileOutputStream(imgLoc);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void drawPoint(float x, float y) {
Map.drawCircle(x, y, 25, black);
}
}
| [
"martins.abelitis@gmail.com"
] | martins.abelitis@gmail.com |
b388ad3a3763842faa3545690a649bf3366ae7ed | 6663574baad6cccac84e6b99e1459792ad7fa520 | /src/com/dldnh/hello/HelloServlet.java | 519be7037a1487228cee9bdd5929d72c93566d82 | [] | no_license | dldnh/hello-servlet | 4fe2fa8afe652ac0d5d0f3b84ec0d07cda23044d | b9467eff3d1193f9fe2d6d3311bc6eceb4214051 | refs/heads/master | 2020-04-11T09:39:44.262746 | 2018-12-13T21:18:22 | 2018-12-13T21:18:22 | 161,686,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | package com.dldnh.hello;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
public class HelloServlet extends javax.servlet.http.HttpServlet {
private String getAddress() {
StringBuilder str = new StringBuilder();
try {
Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
while (ifaces.hasMoreElements()) {
NetworkInterface iface = ifaces.nextElement();
if (iface.isLoopback()) {
continue;
}
Enumeration<InetAddress> addrs = iface.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
byte[] bytes = addr.getAddress();
if (bytes.length != 4) {
continue;
}
if (str.length() > 0) {
str.append(", ");
}
for (int i = 0; i < 4; i++) {
int n = bytes[i] & 0xff;
str.append(n);
if (i < 3) {
str.append(".");
}
}
}
}
} catch (SocketException e) {
e.printStackTrace();
return e.getLocalizedMessage();
}
return str.toString();
}
protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) {
}
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException {
final PrintWriter w = response.getWriter();
w.println("Hello, world! " + getAddress());
}
}
| [
"dave.diamond@oracle.com"
] | dave.diamond@oracle.com |
c2e60e2fd92b07805407b4e7e1d54301d0b31fa2 | 6b874867e75329325b0baaf1c0f3f6d7ecf004cf | /src/main/java/baekjoon/star/dot/q2440/Main.java | e11d62c16069c386eec0c59ca868d459fb80d2e6 | [] | no_license | kkssry/algorithm | e36ef834fea2d2db444b16b58898b9cc76a45383 | cdd4af227db018d2529e6aedd991d2ef1b596d6f | refs/heads/master | 2020-04-20T14:27:19.293476 | 2020-02-28T13:55:16 | 2020-02-28T13:55:16 | 168,898,908 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package baekjoon.star.dot.q2440;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int input = Integer.parseInt(br.readLine());
for (int i = 0; i < input; i++) {
for (int j = input; j > i; j--) {
System.out.print("*");
}
System.out.println();
}
}
}
| [
"kkssry@naver.com"
] | kkssry@naver.com |
0c1e3b208a5b7b61927af57a59e12d746af68982 | b9f6a7df8995fd7223d0b63d2e974705890f5cc1 | /src/main/java/net/fhirfactory/pegacorn/petasos/ipc/beans/sender/InterProcessingPlantHandoverPacketGenerationBean.java | f51f25939f1c9470cc7d87863d70eb62f66d19af | [] | no_license | fhirfactory/pegacorn-platform-petasos-ipc | b4fc4e528ed84358099fa930e8d8fc0cdfae0aa8 | a2da7501d7c75d7db85e6989730466518d2eb855 | refs/heads/master | 2023-01-23T23:56:19.319713 | 2020-12-02T20:23:41 | 2020-12-02T20:23:41 | 294,220,885 | 0 | 0 | null | 2020-12-02T20:23:43 | 2020-09-09T20:22:16 | Java | UTF-8 | Java | false | false | 5,246 | java | /*
* Copyright (c) 2020 Mark A. Hunter
*
* 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.
*/
package net.fhirfactory.pegacorn.petasos.ipc.beans.sender;
import net.fhirfactory.pegacorn.deployment.topology.manager.DeploymentTopologyIM;
import net.fhirfactory.pegacorn.petasos.core.moa.pathway.naming.PetasosPathwayExchangePropertyNames;
import net.fhirfactory.pegacorn.petasos.ipc.model.InterProcessingPlantHandoverPacket;
import net.fhirfactory.pegacorn.petasos.ipc.model.InterProcessingPlantHandoverResponsePacket;
import net.fhirfactory.pegacorn.petasos.model.processingplant.ProcessingPlantServicesInterface;
import net.fhirfactory.pegacorn.petasos.model.resilience.activitymatrix.moa.ParcelStatusElement;
import net.fhirfactory.pegacorn.petasos.model.topology.NodeElement;
import net.fhirfactory.pegacorn.petasos.model.uow.UoW;
import net.fhirfactory.pegacorn.petasos.model.wup.WUPJobCard;
import org.apache.camel.Exchange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.sql.Date;
import java.time.Instant;
import java.time.LocalDateTime;
@ApplicationScoped
public class InterProcessingPlantHandoverPacketGenerationBean {
private static final Logger LOG = LoggerFactory.getLogger(InterProcessingPlantHandoverPacketGenerationBean.class);
@Inject
DeploymentTopologyIM topologyProxy;
@Inject
PetasosPathwayExchangePropertyNames exchangePropertyNames;
@Inject
ProcessingPlantServicesInterface processingPlantServices;
public InterProcessingPlantHandoverPacket constructInterProcessingPlantHandoverPacket(UoW theUoW, Exchange camelExchange, String wupInstanceKey){
LOG.debug(".constructInterProcessingPlantHandoverPacket(): Entry, theUoW (UoW) --> {}, wupInstanceKey (String) --> {}", theUoW, wupInstanceKey);
LOG.trace(".constructInterProcessingPlantHandoverPacket(): Attempting to retrieve NodeElement");
NodeElement node = topologyProxy.getNodeByKey(wupInstanceKey);
LOG.trace(".constructInterProcessingPlantHandoverPacket(): Node Element retrieved --> {}", node);
LOG.trace(".constructInterProcessingPlantHandoverPacket(): Extracting Job Card and Status Element from Exchange");
String jobcardPropertyKey = exchangePropertyNames.getExchangeJobCardPropertyName(wupInstanceKey); // this value should match the one in WUPIngresConduit.java/WUPEgressConduit.java
String parcelStatusPropertyKey = exchangePropertyNames.getExchangeStatusElementPropertyName(wupInstanceKey); // this value should match the one in WUPIngresConduit.java/WUPEgressConduit.java
WUPJobCard jobCard = camelExchange.getProperty(jobcardPropertyKey, WUPJobCard.class); // <-- Note the "WUPJobCard" property name, make sure this is aligned with the code in the WUPEgressConduit.java file
ParcelStatusElement statusElement = camelExchange.getProperty(parcelStatusPropertyKey, ParcelStatusElement.class); // <-- Note the "ParcelStatusElement" property name, make sure this is aligned with the code in the WUPEgressConduit.java file
LOG.trace(".constructInterProcessingPlantHandoverPacket(): Creating the Response message");
InterProcessingPlantHandoverPacket forwardingPacket = new InterProcessingPlantHandoverPacket();
forwardingPacket.setActivityID(jobCard.getActivityID());
String processingPlantName = processingPlantServices.getProcessingPlantNodeElement().extractNodeKey();
forwardingPacket.setMessageIdentifier(processingPlantName + "-" + Date.from(Instant.now()).toString());
forwardingPacket.setSendDate(Date.from(Instant.now()));
forwardingPacket.setPayloadPacket(theUoW);
LOG.trace(".constructInterProcessingPlantHandoverPacket(): not push the UoW into Exchange as a property for extraction after IPC activity");
String uowPropertyKey = exchangePropertyNames.getExchangeUoWPropertyName(wupInstanceKey);
camelExchange.setProperty(uowPropertyKey, theUoW);
LOG.debug(".constructInterProcessingPlantHandoverPacket(): Exit, forwardingPacket (InterProcessingPlantHandoverPacket) --> {}", forwardingPacket);
return(forwardingPacket);
}
}
| [
"m.a.hunter@outlook.com"
] | m.a.hunter@outlook.com |
324c93aa647c4f982007a1cbdc3786e3c0effe52 | 231bf734c1b70ec09b956bc479ecaa354645c47a | /src/main/java/example/controller/HelloController.java | 21d636c1609651918e52e6affe1d36334f335cc4 | [] | no_license | Alvinidea/MavenSpringLearnDoc2 | 8e97511f6377538937a95a2c2bc7a458f8e0a4c8 | a9a40f63ec452096b431a54b200728d03216ccf4 | refs/heads/master | 2023-04-12T00:22:40.639918 | 2021-05-07T08:37:58 | 2021-05-07T08:37:58 | 363,079,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package example.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.annotation.Annotation;
public class HelloController implements Controller {
public ModelAndView handleRquest(HttpServletRequest request, HttpServletResponse response) {
ModelAndView mv = new ModelAndView();
mv.setViewName("success");
mv.addObject("Hello","原始的Controller方式");
return mv;
}
@Override
public String value() {
return null;
}
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
}
| [
"276157760@qq.com"
] | 276157760@qq.com |
4540c38f4c988f568e3a2faf1ffa1a86e3ec5b99 | 91c1ec6a714795c13e4d33097750ea5953ff3e63 | /HSWeb/src/main/com/sf/energy/powernet/dao/.svn/text-base/AmMeterPDDatasDao.java.svn-base | d6b71e68cdd2fa4c55b8288d664d4b92a4e1ff20 | [] | no_license | SundyTuOk/HSWeb | 8b9cd4af8c6014ca69c8cd60a61d15128ed4d5bd | 27215d8b3998b4cb160e3955691518476a776830 | refs/heads/master | 2021-06-20T13:49:30.724083 | 2017-08-12T04:33:44 | 2017-08-12T04:33:44 | 69,729,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,561 | package com.sf.energy.powernet.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.sf.energy.powernet.model.AmMeterPDDatasModel;
import com.sf.energy.powernet.model.AmnoBalanceModel;
import com.sf.energy.powernet.model.PWnoBalanceModel;
import com.sf.energy.powernet.model.PYnoBalanceModel;
import com.sf.energy.powernet.model.VnoBalanceModel;
import com.sf.energy.util.ConnDB;
/**
*
* @author 蒯越
*
*/
public class AmMeterPDDatasDao
{
/**
* 通过回路和日期时间查询该天内不同时刻的三相电流以及电流不平衡率
*
* @param huiluID
* 回路ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @return 结果集
* @throws SQLException
*/
public AmMeterPDDatasModel getAnobalanceAnalysis(int huiluID, int year, int month, int day) throws SQLException
{
AmMeterPDDatasModel apdm = null;
String sql = "select CurrentA,CurrentB,CurrentC,Current0,to_char(VALUETIME,'hh:mm:ss')TIME" + " from AmMeterPDDatas,PD_PartInfo03 "
+ "where AmMeterPDDatas.AmMeter_ID = PD_PartInfo03.JLID and Part_ID = ? "
+ "and extract(year from valuetime) = ? and extract(month from valuetime) = ? " + "and extract(day from valuetime) = ? ";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
// rs = ps.executeQuery();
ps.setInt(1, huiluID);
ps.setInt(2, year);
ps.setInt(3, month);
ps.setInt(4, day);
rs = ps.executeQuery();
while (rs.next())
{
apdm = new AmMeterPDDatasModel();
apdm.setCurrentA(rs.getFloat("CurrentA"));
apdm.setCurrentB(rs.getFloat("CurrentB"));
apdm.setCurrentC(rs.getFloat("CurrentC"));
apdm.setCurrent0(rs.getFloat("Current0"));
apdm.setTime(rs.getString("TIME"));
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
// PreparedStatement ps = ConnDB.getConnection().prepareStatement(sql);
// ps.setInt(1, huiluID);
// ps.setInt(2, year);
// ps.setInt(3, month);
// ps.setInt(4, day);
// ResultSet rs = ps.executeQuery();
//
// while (rs.next())
// {
// apdm = new AmMeterPDDatasModel();
// apdm.setCurrentA(rs.getFloat("CurrentA"));
// apdm.setCurrentB(rs.getFloat("CurrentB"));
// apdm.setCurrentC(rs.getFloat("CurrentC"));
// apdm.setCurrent0(rs.getFloat("Current0"));
// apdm.setTime(rs.getString("TIME"));
// }
// if (rs != null)
// rs.close();
// if (ps != null)
// ps.close();
return apdm;
}
/**
* 通过电表ID,查询指定年月日里面每个小时电流的不平衡率(包含A,B,C相电流值)
*
* @param am_ID
* 电表ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<AmnoBalanceModel> getAmNobalancedata(int am_ID, int year, int month, int day, int hour) throws SQLException
{
List<AmnoBalanceModel> list = null;
list = new ArrayList<AmnoBalanceModel>();
AmnoBalanceModel anbm = null;
float a = 0; // A相电流
float b = 0; // B相电流
float c = 0; // C相电流
float t1 = 0; // 转换参数
float t2 = 0; // 转换参数
float rate = 0; // 不平衡率
String sql = "select VALUETIME,CURRENTA,CURRENTB,CURRENTC from ZPDDATAS" + String.valueOf(am_ID) + " where "
+ "extract(year from Valuetime)= ? " + "and extract(month from valuetime)= ? and extract(day from valuetime)= ? "
+ "and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
// rs = ps.executeQuery();
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
anbm = new AmnoBalanceModel();
a = rs.getFloat("CURRENTA");
b = rs.getFloat("CURRENTB");
c = rs.getFloat("CURRENTC");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
rate = t2 / (2 * t1) * 100;
anbm.setCURRENTA(a);
anbm.setCURRENTB(b);
anbm.setCURRENTC(c);
anbm.setNobalanceRate(rate);
anbm.setValuetime(rs.getString("VALUETIME"));
list.add(anbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return list;
}
/**
* 查询全校指定年月日里面每个小时电流的不平衡率(包含A,B,C相电流值)
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<AmnoBalanceModel> getAllAmNobalancedata(int year, int month, int day, int hour) throws SQLException
{
List<AmnoBalanceModel> list = null;
list = new ArrayList<AmnoBalanceModel>();
AmnoBalanceModel anbm = null;
float a = 0; // A相电流
float b = 0; // B相电流
float c = 0; // C相电流
float t1 = 0; // 转换参数
float t2 = 0; // 转换参数
float rate = 0; // 不平衡率
String sql = "select JLID AMMETER_ID from PD_PARTINFO03";
Connection conn1 =null;
PreparedStatement ps1=null;
ResultSet rs1 =null;
try
{
conn1 = ConnDB.getConnection();
ps1 = conn1.prepareStatement(sql);
rs1 = ps1.executeQuery();
while (rs1.next())
{
String ammeterid = rs1.getString("AMMETER_ID");
if ((ammeterid != null) && (!"".equals(ammeterid)))
{
sql = "select VALUETIME,CURRENTA,CURRENTB,CURRENTC from ZPDDATAS" + ammeterid + " where extract(year from Valuetime)= ? "
+ "and extract(month from valuetime)= ? and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
anbm = new AmnoBalanceModel();
a = rs.getFloat("CURRENTA");
b = rs.getFloat("CURRENTB");
c = rs.getFloat("CURRENTC");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
rate = t2 / (2 * t1) * 100;
anbm.setCURRENTA(a);
anbm.setCURRENTB(b);
anbm.setCURRENTC(c);
anbm.setNobalanceRate(rate);
anbm.setValuetime(rs.getString("VALUETIME"));
list.add(anbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
}
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn1, ps1, rs1);
}
return list;
}
/**
* 通过根ID查出下面所有子回路ID
*
* @param parent_ID
* 根节点
* @return list集合
* @throws SQLException
*/
public List<Integer> getHuiluByParent(int parent_ID) throws SQLException
{
List<Integer> list = new ArrayList<Integer>();
String sql = "SELECT part_id FROM pd_part where PARTSTYLE_ID='03' START WITH part_parent=? CONNECT BY PRIOR part_id = part_parent ";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, parent_ID);
rs = ps.executeQuery();
while (rs.next())
{
list.add(rs.getInt("part_id"));
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return list;
}
/**
* 通过电表ID,查询指定年月日里面每个小时电压的不平衡率(包含A,B,C相电压值)
*
* @param am_ID
* 电表ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<VnoBalanceModel> getVNobalancedata(int am_ID, int year, int month, int day, int hour) throws SQLException
{
List<VnoBalanceModel> list = null;
list = new ArrayList<VnoBalanceModel>();
VnoBalanceModel vnbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double vrate = 0; // 电压不平衡率
String sql = "select VALUETIME,VoltageA,VoltageB,VoltageC from ZPDDATAS" + String.valueOf(am_ID) + " where "
+ "extract(year from Valuetime)= ? " + "and extract(month from valuetime)= ? and extract(day from valuetime)= ? "
+ "and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
vnbm = new VnoBalanceModel();
a = rs.getFloat("VoltageA");
b = rs.getFloat("VoltageB");
c = rs.getFloat("VoltageC");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
vrate = t2 / (2 * t1) * 100;
vnbm.setVoltageA(a);
vnbm.setVoltageB(b);
vnbm.setVoltageC(c);
vnbm.setVrate(vrate);
vnbm.setValuetime(rs.getString("VALUETIME"));
list.add(vnbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return list;
}
/**
* 查询全校指定年月日里面每个小时电压的不平衡率(包含A,B,C相电压值)
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<VnoBalanceModel> getAllVNobalancedata(int year, int month, int day, int hour) throws SQLException
{
List<VnoBalanceModel> list = null;
list = new ArrayList<VnoBalanceModel>();
VnoBalanceModel vnbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double vrate = 0; // 电压不平衡率
String sql = "select JLID AMMETER_ID from PD_PARTINFO03";
Connection conn1 = null;
PreparedStatement ps1=null;
ResultSet rs1 =null;
try
{
conn1 = ConnDB.getConnection();
ps1 = conn1.prepareStatement(sql);
rs1 = ps1.executeQuery();
while (rs1.next())
{
String ammeterid = rs1.getString("AMMETER_ID");
if ((ammeterid != null) && (!"".equals(ammeterid)))
{
sql = "select VALUETIME,VoltageA,VoltageB,VoltageC from ZPDDATAS" + ammeterid + " where extract(year from Valuetime)= ? "
+ "and extract(month from valuetime)= ? and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
vnbm = new VnoBalanceModel();
a = rs.getFloat("VoltageA");
b = rs.getFloat("VoltageB");
c = rs.getFloat("VoltageC");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
vrate = t2 / (2 * t1) * 100;
vnbm.setVoltageA(a);
vnbm.setVoltageB(b);
vnbm.setVoltageC(c);
vnbm.setVrate(vrate);
vnbm.setValuetime(rs.getString("VALUETIME"));
list.add(vnbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
}
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn1, ps1, rs1);
}
return list;
}
/**
* 通过电表ID,查询指定年月日里每个小时里面电流电压的数据点的条数
*
* @param am_ID
* 电表ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @param hour
* 小时
* @return 记录条数
* @throws SQLException
*/
public int getcountNo(int am_ID, int year, int month, int day, int hour) throws SQLException
{
int count = 0;
String sql = "select count(rownum) from ZPDDATAS" + String.valueOf(am_ID) + " where "
+ "extract(year from Valuetime)=? and extract(month from valuetime)= ? "
+ "and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
count = rs.getInt("count(rownum)");
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return count;
}
/**
* 查询全校指定年月日里每个小时里面电流电压的数据点的条数
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public int getAllcountNo(int year, int month, int day, int hour) throws SQLException
{
int count = 0;
String sql = "select JLID AMMETER_ID from PD_PARTINFO03";
Connection conn1 = null;
PreparedStatement ps1=null;
ResultSet rs1 =null;
try
{
conn1 =ConnDB.getConnection();
ps1 = conn1.prepareStatement(sql);
rs1 = ps1.executeQuery();
while (rs1.next())
{
String ammeterid = rs1.getString("AMMETER_ID");
if ((ammeterid != null) && (!"".equals(ammeterid)))
{
sql = "select count(rownum) from ZPDDATAS" + ammeterid + " where "
+ " extract(year from Valuetime)=? and extract(month from valuetime)= ? "
+ "and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
count = rs.getInt("count(rownum)");
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
}
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn1, ps1, rs1);
}
return count;
}
/**
* 通过电表ID,查询指定年月日里面每个小时有功功率的不平衡率(包含A,B,C相有功功率值)
*
* @param am_ID
* 电表ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<PYnoBalanceModel> getPYNobalancedata(int am_ID, int year, int month, int day, int hour) throws SQLException
{
List<PYnoBalanceModel> list = null;
list = new ArrayList<PYnoBalanceModel>();
PYnoBalanceModel pynbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double pyrate = 0; // 电压不平衡率
String sql = "select VALUETIME,PowerAY,PowerBY,PowerCY from ZPDDATAS" + String.valueOf(am_ID) + " where "
+ "extract(year from Valuetime)= ? " + "and extract(month from valuetime)= ? and extract(day from valuetime)= ? "
+ "and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
pynbm = new PYnoBalanceModel();
a = rs.getFloat("PowerAY");
b = rs.getFloat("PowerBY");
c = rs.getFloat("PowerCY");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
pyrate = t2 / (2 * t1) * 100;
pynbm.setPowerAY(a);
pynbm.setPowerBY(b);
pynbm.setPowerCY(c);
pynbm.setPYrate(pyrate);
pynbm.setValuetime(rs.getString("VALUETIME"));
list.add(pynbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return list;
}
/**
* 查询全校指定年月日里面每个小时有功功率的不平衡率(包含A,B,C相有功功率值)
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<PYnoBalanceModel> getAllPYNobalancedata(int year, int month, int day, int hour) throws SQLException
{
List<PYnoBalanceModel> list = null;
list = new ArrayList<PYnoBalanceModel>();
PYnoBalanceModel pynbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double pyrate = 0; // 电压不平衡率
String sql = "select JLID AMMETER_ID from PD_PARTINFO03";
Connection conn1 = null;
PreparedStatement ps1=null;
ResultSet rs1 =null;
try
{
conn1 =ConnDB.getConnection();
ps1 = conn1.prepareStatement(sql);
rs1 = ps1.executeQuery();
while (rs1.next())
{
String ammeterid = rs1.getString("AMMETER_ID");
if ((ammeterid != null) && (!"".equals(ammeterid)))
{
sql = "select VALUETIME,PowerAY,PowerBY,PowerCY from ZPDDATAS" + ammeterid + " where extract(year from Valuetime)= ? "
+ "and extract(month from valuetime)= ? and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
pynbm = new PYnoBalanceModel();
a = rs.getFloat("PowerAY");
b = rs.getFloat("PowerBY");
c = rs.getFloat("PowerCY");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
pyrate = t2 / (2 * t1) * 100;
pynbm.setPowerAY(a);
pynbm.setPowerBY(b);
pynbm.setPowerCY(c);
pynbm.setPYrate(pyrate);
pynbm.setValuetime(rs.getString("VALUETIME"));
list.add(pynbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
}
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn1, ps1, rs1);
}
return list;
}
/**
* 通过电表ID,查询指定年月日里面每个小时无功功率的不平衡率(包含A,B,C相无功功率值)
*
* @param am_ID
* 电表ID
* @param year
* 年份
* @param month
* 月份
* @param day
* 日期
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<PWnoBalanceModel> getPWNobalancedata(int am_ID, int year, int month, int day, int hour) throws SQLException
{
List<PWnoBalanceModel> list = null;
list = new ArrayList<PWnoBalanceModel>();
PWnoBalanceModel pwnbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double pwrate = 0; // 电压不平衡率
String sql = "select VALUETIME,PowerAW,PowerBW,PowerCW from ZPDDATAS" + String.valueOf(am_ID) + " where "
+ "extract(year from Valuetime)= ? " + "and extract(month from valuetime)= ? and extract(day from valuetime)= ? "
+ "and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
pwnbm = new PWnoBalanceModel();
a = rs.getFloat("PowerAW");
b = rs.getFloat("PowerBW");
c = rs.getFloat("PowerCW");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
pwrate = t2 / (2 * t1) * 100;
pwnbm.setPowerAW(a);
pwnbm.setPowerBW(b);
pwnbm.setPowerCW(c);
pwnbm.setPWrate(pwrate);
pwnbm.setValuetime(rs.getString("VALUETIME"));
list.add(pwnbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
return list;
}
/**
* 查询全校指定年月日里面每个小时无功功率的不平衡率(包含A,B,C相无功功率值)
*
* @param year
* 年
* @param month
* 月
* @param day
* 日
* @param hour
* 小时
* @return 结果集
* @throws SQLException
*/
public List<PWnoBalanceModel> getAllPWNobalancedata(int year, int month, int day, int hour) throws SQLException
{
List<PWnoBalanceModel> list = null;
list = new ArrayList<PWnoBalanceModel>();
PWnoBalanceModel pwnbm = null;
double a = 0; // A相电压
double b = 0; // B相电压
double c = 0; // C相电压
double t1 = 0; // 转换参数
double t2 = 0; // 转换参数
double pwrate = 0; // 电压不平衡率
String sql = "select JLID AMMETER_ID from PD_PARTINFO03";
Connection conn1 = null;
PreparedStatement ps1=null;
ResultSet rs1=null;
try
{
conn1 = ConnDB.getConnection();
ps1 = conn1.prepareStatement(sql);
rs1 = ps1.executeQuery();
while (rs1.next())
{
String ammeterid = rs1.getString("AMMETER_ID");
if ((ammeterid != null) && (!"".equals(ammeterid)))
{
sql = "select VALUETIME,PowerAW,PowerBW,PowerCW from ZPDDATAS" + ammeterid + " where extract(year from Valuetime)= ? "
+ "and extract(month from valuetime)= ? and extract(day from valuetime)= ? and TO_CHAR(valuetime,'HH24')= ?";
Connection conn=null;
PreparedStatement ps =null;
ResultSet rs = null;
try
{
conn = ConnDB.getConnection();
ps = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ps.setInt(1, year);
ps.setInt(2, month);
ps.setInt(3, day);
ps.setInt(4, hour);
rs = ps.executeQuery();
while (rs.next())
{
pwnbm = new PWnoBalanceModel();
a = rs.getFloat("PowerAW");
b = rs.getFloat("PowerBW");
c = rs.getFloat("PowerCW");
t1 = (Math.abs(a) + Math.abs(b) + Math.abs(c)) / 3;
t2 = Math.abs(a - t1) + Math.abs(b - t1) + Math.abs(c - t1);
pwrate = t2 / (2 * t1) * 100;
pwnbm.setPowerAW(a);
pwnbm.setPowerBW(b);
pwnbm.setPowerCW(c);
pwnbm.setPWrate(pwrate);
pwnbm.setValuetime(rs.getString("VALUETIME"));
list.add(pwnbm);
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn, ps, rs);
}
}
}
} catch (Exception e)
{
e.printStackTrace();
}finally{
ConnDB.release(conn1, ps1, rs1);
}
return list;
}
/**
* 通过回路查询电表ID
*
* @param huilu
* 回路ID
* @return 电表ID
* @throws SQLException
*/
/*
* public int getAmmeterID(int huilu) throws SQLException { int amID = 0;
*
* String sql = "select JLID FROM PD_PARTINFO03 WHERE PART_ID = ?";
*
* PreparedStatement ps = ConnDB.getConnection().prepareStatement(sql);
* ps.setInt(1, huilu);
*
* ResultSet rs = ps.executeQuery(); while(rs.next()) { amID =
* rs.getInt("JLID"); } return amID; }
*/
}
| [
"1129830650@qq.com"
] | 1129830650@qq.com | |
08a23bee2e90dfeb0c9ab4d960ba2846a8b150a1 | 59247456c23faa2aa987583d42ab8e8a7f613511 | /src/main/java/cz/tul/bussiness/jobs/EdgeDetectors/AEdgeDetector.java | 41fafb38330c083511bb98c6329f3588c2f1ce83 | [
"BSD-3-Clause"
] | permissive | JinMar/ComputerVision | 3cb571bf734e0eb26a06cf7b536adbffd2267c44 | 7a813d7e66a4f8245053728e02add5027c9739b2 | refs/heads/master | 2020-12-25T15:08:41.647150 | 2017-05-14T20:01:28 | 2017-05-14T20:01:28 | 63,721,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,585 | java | package cz.tul.bussiness.jobs.EdgeDetectors;
import cz.tul.bussiness.jobs.AJob;
import cz.tul.bussiness.jobs.exceptions.MinimalArgumentsException;
import cz.tul.entities.PartAttributeValue;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.imgproc.Imgproc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Bc. Marek Jindrák on 13.02.2017.
*/
public abstract class AEdgeDetector extends AJob {
private static final Logger logger = LoggerFactory.getLogger(AEdgeDetector.class);
private Mat edges;
private int lowThreshold;
private int ratio;
//Aperture size. It can be CV_SCHARR , 1, 3, 5, or 7.
private int size;
private int scale;
@Override
protected void init() throws MinimalArgumentsException {
for (PartAttributeValue att : getAttributes()) {
if (att.getOperationAttributes().getAttribute().getName().equals("Práh")) {
lowThreshold = Integer.parseInt(att.getValue());
}
if (att.getOperationAttributes().getAttribute().getName().equals("Poměr")) {
ratio = Integer.parseInt(att.getValue());
}
if (att.getOperationAttributes().getAttribute().getName().equals("Velikost")) {
size = Integer.parseInt(att.getValue());
}
if (att.getOperationAttributes().getAttribute().getName().equals("Scale")) {
scale = Integer.parseInt(att.getValue());
}
}
}
@Override
protected BufferedImage procces() {
sourceData = ((DataBufferByte) imgData.getRaster().getDataBuffer()).getData();
BGR = new Mat(imgData.getHeight(), imgData.getWidth(), CvType.CV_8UC3);
BGR.put(0, 0, sourceData);
Mat gray = new Mat(imgData.getHeight(), imgData.getWidth(), CvType.CV_8UC3);
Imgproc.cvtColor(BGR, gray, Imgproc.COLOR_RGB2GRAY);
Core.split(gray, channels);
findEdges();
Mat BGR = new Mat(channels.get(0).rows(), channels.get(0).cols(), CvType.CV_8UC3);
List<Mat> RGB = new ArrayList<>();
RGB.add(getEdges());
RGB.add(getEdges());
RGB.add(getEdges());
Core.merge(RGB, BGR);
sourceData = new byte[channels.get(0).rows() * channels.get(0).cols() * (int) BGR.elemSize()];
BGR.get(0, 0, sourceData);
imgData = new BufferedImage(channels.get(0).cols(), channels.get(0).rows(), BufferedImage.TYPE_3BYTE_BGR);
imgData.getRaster().setDataElements(0, 0, channels.get(0).cols(), channels.get(0).rows(), sourceData);
return imgData;
}
protected abstract void findEdges();
public Mat getEdges() {
if (edges == null) {
edges = new Mat();
}
return edges;
}
public void setEdges(Mat edges) {
this.edges = edges;
}
public int getLowThreshold() {
return lowThreshold;
}
public void setLowThreshold(int lowThreshold) {
this.lowThreshold = lowThreshold;
}
public int getRatio() {
return ratio;
}
public void setRatio(int ratio) {
this.ratio = ratio;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getScale() {
return scale;
}
public void setScale(int scale) {
this.scale = scale;
}
}
| [
"Jindrak.marek@gmail.com"
] | Jindrak.marek@gmail.com |
b66c66ec1793a2345dbd01e8cf18469f05f39f66 | a3beeb505673a9bffd0bd30a9a05e066d2292ac8 | /src/regexeg/ValidateIPAddress.java | fc895ba6616bd1254bb0953f4240e59c2ff50a57 | [] | no_license | rohit-rs/JavaSampleProblems | 8a6112cfb3054e44f9acb6ae00c01e1e7c0e83a4 | 3cb79ab4b3bdae91f79471dc3669818cc367140d | refs/heads/master | 2023-04-17T03:51:14.663604 | 2021-04-12T16:51:17 | 2021-04-12T16:51:17 | 357,271,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package regexeg;
class ValidateIPAddress {
public static void main(String[] args) {
String ip = "023.45.12.56";
String regex = "(([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\\.){3}([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
System.out.println(ip.matches(regex));
}
}
| [
"rohitmckvie@gmail.com"
] | rohitmckvie@gmail.com |
0c94c451ffd58a5605978283d8e240d8ac617a9d | 599c8f322dbdeabc0cca47fcc49e6c3708ebc5f7 | /Ex03_OOP_Basic/src/kr/or/bit/Program.java | 18b0c1d2807ba9e520e435e16f95cf01940e45b3 | [] | no_license | 2nojin/Labs | 0b4ad89165f6db37a3b714f6554a72550c034124 | ccbfe6005291844c22a88447a753ef11b36e9a51 | refs/heads/master | 2020-04-23T01:52:39.412555 | 2019-03-29T08:14:33 | 2019-03-29T08:14:33 | 170,827,198 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 410 | java | package kr.or.bit;
public class Program {
public static void main(String[] args) {
// 사원 1명 생성
Emp emp = new Emp();
emp.empno = 7788;
emp.ename = "smith";
emp.job = "manager";
emp.setSal(8000);
/*int sal = emp.getSal();
System.out.println("급여정보:"+sal);*/
String result = emp.getEmpInfo();
System.out.println(result);
Emp emp2 = new Emp();
}
}
| [
"rhsfks1785@naver.com"
] | rhsfks1785@naver.com |
6f4866b32c4d53ff0dd6bb9ea205e1741fa9ee02 | 41e168cfa600c71b6dbe8eec21f76e56add8f17e | /src/main/java/com/kelvSYC/curbside/CurbsidePrinter.java | ff9ec0efe5c6ffa0b4d9498ee655ff8afc83c089 | [] | no_license | kelvSYC/curbside-interview-2015 | e1c2fb7bb72532c69abe005f6c2ef207f7c82c4d | 70f28c5bd66b71f63eb7913a745ec605690877e2 | refs/heads/master | 2021-03-12T20:35:55.998854 | 2015-09-20T03:45:42 | 2015-09-20T03:45:42 | 42,799,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package com.kelvSYC.curbside;
import java.util.Map;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import com.google.common.collect.ImmutableMap;
/**
* Program that scrapes the Curbside jobs page and prints job counts by location.
* @author kelvSYC
*
*/
public class CurbsidePrinter {
// Incomplete list, but should cover the average case.
private static final Map<String, String> stateAbbreviations = ImmutableMap.<String, String>builder().put("CA", "California").put("NY", "New York").build();
public static void main(String... args) {
WebDriver driver = new ChromeDriver();
CurbsideJobScraper scraper = new CurbsideJobScraper(driver);
scraper.scrape().forEach((location, count) -> {
int index = location.indexOf(", ");
String city = location.substring(0, index);
String state = location.substring(index + 2);
System.out.printf("%s, %s: %d%n", city, stateAbbreviations.get(state), count);
});
driver.close();
}
}
| [
"kelv@kelvSYC.com"
] | kelv@kelvSYC.com |
56ebbc20e069ed1621a18c955d7d2140e6e955b1 | dcd970cbf9232c08894ce9ee492dcc4b008fc00f | /src/main/java/com/wtf/clerk/eureka/ClerkEurekaApplication.java | 943fc31d86aa40fff1e253f12feca97e37d9ba93 | [] | no_license | strugglesnail/clk-eureka | 9ca155302d81e5bcd1732d76e6e239daaa9d2749 | e998ff0641c95452881308bae2ca3c8edde336c2 | refs/heads/master | 2022-11-14T04:10:58.324096 | 2020-07-12T02:17:35 | 2020-07-12T02:17:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.wtf.clerk.eureka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class ClerkEurekaApplication {
public static void main(String[] args) {
SpringApplication.run(ClerkEurekaApplication.class, args);
}
}
| [
"593616590@qq.com"
] | 593616590@qq.com |
a24effde3e4433cbdf6831baa0a0c37c44f0201a | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Lang/53/org/apache/commons/lang/builder/ToStringStyle_ToStringStyle_277.java | c3779925e34096fd0505a0e8d6c990ea9c08ea19 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 3,176 | java |
org apach common lang builder
control code string code format link string builder tostringbuild
main code string builder tostringbuild code
class intend code singleton code
instanti style time program
gener predefin constant
altern link standard string style standardtostringstyl
set individu set style achiev
subclass
requir subclass overrid
method requir object type code code
code code code object code code code
method output version detail summari
detail version arrai base method
output arrai summari method output
arrai length
format output object date
creat subclass overrid method
pre
style mystyl string style tostringstyl
append detail appenddetail string buffer stringbuff buffer string field fieldnam object
date
simpl date format simpledateformat yyyi format
buffer append
pre
author stephen colebourn
author gari gregori
author pete gieser
author masato tezuka
version
string style tostringstyl serializ
constructor
string style tostringstyl
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
b8aa059de1f40686100204176172062926522ded | f40ca224b1b7c79cecabff31d973d57ff19c5755 | /app/src/main/java/de/hs_bremen/aurora_hunter/ui/fragments/placeSearch/SearchFragment.java | c19e9a2dbe266f95b7c91098b9930c812e7d4a2b | [] | no_license | kikiChuang/Aurora-Hunter | b6fe754ad901cc1707c6e9e47abcf062227c319f | dfe8e44e6040fb3aa00156f4307d6194e5c68ff0 | refs/heads/master | 2020-03-08T01:38:57.494815 | 2016-06-23T21:57:52 | 2016-06-23T21:57:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,172 | java | package de.hs_bremen.aurora_hunter.ui.fragments.placeSearch;
import android.annotation.SuppressLint;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.os.Bundle;
import android.os.Parcel;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.text.style.CharacterStyle;
import android.text.style.MetricAffectingSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import com.arlib.floatingsearchview.FloatingSearchView;
import com.arlib.floatingsearchview.suggestions.model.SearchSuggestion;
import com.crashlytics.android.answers.Answers;
import com.crashlytics.android.answers.ContentViewEvent;
import com.crashlytics.android.answers.SearchEvent;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.data.DataBufferUtils;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.AutocompletePrediction;
import com.google.android.gms.location.places.AutocompletePredictionBuffer;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import de.hs_bremen.aurora_hunter.R;
import de.hs_bremen.aurora_hunter.helpers.permissions.PermissionManager;
import de.hs_bremen.aurora_hunter.notifications.locationUpdate.LocationService;
/**
* A simple {@link Fragment} subclass.
*/
public class SearchFragment extends Fragment {
private GoogleApiClient mGoogleApiClient;
private FloatingSearchView mFloatingSearchView;
private LocationChangedInterface mLocationChangedListener;
public SearchFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final View view = inflater.inflate(R.layout.fragment_search, container, false);
final GoogleApiConnectionClass callbacks = new GoogleApiConnectionClass();
mFloatingSearchView = (FloatingSearchView) view.findViewById(R.id.floating_search_view);
mFloatingSearchView.bringToFront();
//On query search
mFloatingSearchView.setOnQueryChangeListener(new FloatingSearchView.OnQueryChangeListener() {
@Override
public void onSearchTextChanged(String oldQuery, String newQuery) {
if (!oldQuery.equals("") && newQuery.equals("")) {
mFloatingSearchView.clearSuggestions();
} else {
mFloatingSearchView.showProgress();
Answers.getInstance().logSearch(new SearchEvent()
.putQuery(newQuery));
List<Integer> filterTypes = new ArrayList<Integer>();
filterTypes.add( Place.TYPE_LOCALITY );
filterTypes.add( Place.TYPE_ADMINISTRATIVE_AREA_LEVEL_1 );
filterTypes.add( Place.TYPE_COUNTRY );
final AutocompleteFilter autocompleteFilter = AutocompleteFilter.create(filterTypes);
PendingResult<AutocompletePredictionBuffer> result = Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient, newQuery,null,autocompleteFilter);
result.setResultCallback(new ResultCallback<AutocompletePredictionBuffer>() {
@Override
public void onResult(AutocompletePredictionBuffer autocompletePredictions) {
mFloatingSearchView.clearSuggestions();
mFloatingSearchView.swapSuggestions(createSearchSuggestions(autocompletePredictions));
mFloatingSearchView.hideProgress();
}
});
}
}
});
//on menue item Click
mFloatingSearchView.setOnMenuItemClickListener(new FloatingSearchView.OnMenuItemClickListener() {
@Override
public void onActionMenuItemSelected(MenuItem item) {
if (item.getItemId() == R.id.action_location) {
setToCurrentLocation();
}else if (item.getItemId() == R.id.action_refresh){
mLocationChangedListener.onRefreshRequested();
} else{
Snackbar.make(getView(), item.getTitle(), Snackbar.LENGTH_SHORT).show();
}
}
});
//On search open
mFloatingSearchView.setOnSearchListener(new FloatingSearchView.OnSearchListener() {
@Override
public void onSuggestionClicked(SearchSuggestion searchSuggestion) {
final PlaceSuggestion placeSuggestion= (PlaceSuggestion) searchSuggestion;
PendingResult<PlaceBuffer> placeBufferPendingResult = Places.GeoDataApi.getPlaceById(mGoogleApiClient,placeSuggestion.getPlaceId());
placeBufferPendingResult.setResultCallback(new ResultCallback<PlaceBuffer>() {
@Override
public void onResult(PlaceBuffer places) {
if(places.getStatus().isSuccess()){
Place place = places.get(0);
Location location = new Location("own");
location.setLatitude(place.getLatLng().latitude);
location.setLongitude(place.getLatLng().longitude);
mLocationChangedListener.onLocationChanged(location);
}else {
Snackbar.make(getView(),places.getStatus().getStatusMessage(),Snackbar.LENGTH_LONG);
}
}
});
}
@Override
public void onSearchAction(String currentQuery) {
if(!currentQuery.isEmpty() && !currentQuery.equals(getString(R.string.search_default_hint))){
}
}
});
mGoogleApiClient = new GoogleApiClient.Builder(this.getContext())
.addConnectionCallbacks(callbacks)
.addOnConnectionFailedListener(callbacks)
.addApi(Places.GEO_DATA_API)
.addApi(LocationServices.API)
.addApi(Places.PLACE_DETECTION_API)
.build();
return view;
}
private void setToCurrentLocation(){
PermissionManager.getInstance().ensureAllPermissions(this.getActivity(), new PermissionManager.PermissionResultCallback() {
@Override
public void granted() {
if(LocationServices.FusedLocationApi.getLocationAvailability(mGoogleApiClient).isLocationAvailable()){
Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
Geocoder geocoder = new Geocoder(getContext());
try {
mLocationChangedListener.onLocationChanged(location);
Address address = geocoder.getFromLocation(location.getLatitude(),location.getLongitude(),1).get(0);
if(address != null){
mFloatingSearchView.setSearchText(address.getLocality() + ", " + address.getCountryName());
}else {
Snackbar.make(getView(), "Can't find city name for your location", Snackbar.LENGTH_SHORT).show();
Answers.getInstance().logContentView(new ContentViewEvent()
.putContentName("Search")
.putContentType("User-Interaction")
.putContentId("place-not-found"));
}
}catch (IOException e){
Snackbar.make(getView(), e.getMessage(), Snackbar.LENGTH_SHORT).show();
Answers.getInstance().logContentView(new ContentViewEvent()
.putContentName("Search")
.putContentType("User-Interaction")
.putContentId("place-exception"));
}
}else {
Snackbar.make(getView(), "Location not available! Activate GPS?", Snackbar.LENGTH_SHORT).show();
Answers.getInstance().logContentView(new ContentViewEvent()
.putContentName("Search")
.putContentType("User-Interaction")
.putContentId("gps-deactivated"));
}
}
@Override
public void denied() {
Snackbar.make(getView(), "Permissions denied, please restart app and confirm all permissions ", Snackbar.LENGTH_SHORT).show();
}
});
}
protected List<PlaceSuggestion> createSearchSuggestions(AutocompletePredictionBuffer autocompletePredictions){
final List<PlaceSuggestion> list = new ArrayList<>();
final List<AutocompletePrediction> bufferList = DataBufferUtils.freezeAndClose(autocompletePredictions);
autocompletePredictions.release();
for(AutocompletePrediction autocompletePrediction: bufferList){
list.add(new PlaceSuggestion(autocompletePrediction));
}
return list;
}
public void onStart() {
mGoogleApiClient.connect();
try {
mLocationChangedListener = (LocationChangedInterface) this.getParentFragment();
}catch (ClassCastException e){
throw new RuntimeException(e);
}
super.onStart();
}
public void onStop() {
mGoogleApiClient.disconnect();
mLocationChangedListener = null;
super.onStop();
}
private class GoogleApiConnectionClass implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
@Override
public void onConnected(Bundle bundle) {
setToCurrentLocation();
//Log.i("SearchFragement", "Google client is there");
}
@Override
public void onConnectionSuspended(int i) {
Snackbar.make(getView(),"Google Play service connection suspended, please restart the app",Snackbar.LENGTH_LONG).show();
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Snackbar.make(getView(),"Google Play service connection failed, please restart the app",Snackbar.LENGTH_LONG).show();
}
}
private class PlaceSuggestion implements SearchSuggestion {
public final Creator<PlaceSuggestion> CREATOR = new Creator<PlaceSuggestion>() {
@Override
public PlaceSuggestion createFromParcel(Parcel in) {
return new PlaceSuggestion(in);
}
@Override
public PlaceSuggestion[] newArray(int size) {
return new PlaceSuggestion[size];
}
};
private String mCityName;
private String mPlaceId;
private boolean mIsHistory = false;
public PlaceSuggestion(AutocompletePrediction autocompletePrediction){
this.mIsHistory = false;
this.mCityName = autocompletePrediction.getFullText(null).toString();
this.mPlaceId = autocompletePrediction.getPlaceId();
}
public PlaceSuggestion(Parcel source) {
this.mCityName = source.readString();
this.mIsHistory = source.readInt() != 0;
this.mPlaceId = source.readString();
}
@Override
public String getBody() {
return mCityName;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.mCityName);
parcel.writeInt(this.mIsHistory ? 1 : 0);
parcel.writeString(this.mPlaceId);
}
public boolean isIsHistory() {
return mIsHistory;
}
public void setIsHistory(boolean mIsHistory) {
this.mIsHistory = mIsHistory;
}
public String getPlaceId() {
return mPlaceId;
}
}
public interface LocationChangedInterface {
public void onLocationChanged(Location location);
public void onRefreshRequested();
}
}
| [
"Stefan.bie@live.de"
] | Stefan.bie@live.de |
c72e0be6631f571199da72d3e3b78dbe74318228 | f77de7909a6a73c766c0651a2cabeed027764608 | /src/main/java/org/juon/jpashop/enums/RoleStatus.java | e2421b94f02e8033522507226c710c92102423d5 | [] | no_license | darkhorizon12/OnlineMall | f5f3e0101e3bd978bee93c0bae8c4b11f77e00c5 | 2fe8a6345bb15a87095475764a10da553564accf | refs/heads/master | 2021-07-16T20:45:23.638068 | 2017-10-25T01:12:45 | 2017-10-25T01:12:45 | 105,948,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | package org.juon.jpashop.enums;
public enum RoleStatus {
ROLE_ADMIN, ROLE_USER, ROLE_GUEST, ROLE_TEST
}
| [
"kimjuon12@gmail.com"
] | kimjuon12@gmail.com |
e5195640e10e52e5173a1379e159d96ec382aa94 | 80c4eaaf07039d4ac2cc00e1cddfd641f2667c89 | /JianMerchant/src/main/java/com/woniukeji/jianmerchant/http/ProgressCancelListener.java | cf1780b8e5e35f10d6ada54e23b2bc4b95342401 | [
"Apache-2.0"
] | permissive | woniukeji/jianguo | 828d6818ff36f27199bc7bbae58c4c580f2d7b86 | 279fec1ea6298f0d3a4c02494c388be0ef2273b7 | refs/heads/master | 2020-04-04T04:10:34.563125 | 2016-08-04T08:16:39 | 2016-08-04T08:16:39 | 52,862,624 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package com.woniukeji.jianmerchant.http;
/**
* Created by Administrator on 2016/7/16.
*/
public interface ProgressCancelListener {
void onCancelProgress();
}
| [
"411697643@qq.com"
] | 411697643@qq.com |
ba46bf7ffc594f82e0f589fbf3a23a1c30f3b334 | d2d896aed9abb05307e3b819dfd9f89b0f55ccf1 | /Homework/Homework 2-Josephus Problem [LinkedList & Queue]/Josephus.java | d61f23ea73f22b23d57c8bda4236da3eeb0aa527 | [] | no_license | Jessicawwww/08722-Data-Structures-for-Application-Programmers | e637e66f59afe56b40cd7b67655f7ad023c75b87 | 704ce098d41c94cd5395c1ab68abf69ee166c1b7 | refs/heads/master | 2023-04-05T07:06:13.065990 | 2023-03-28T19:42:09 | 2023-03-28T19:42:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,385 | java | import java.util.List;
import java.util.ArrayDeque;
import java.util.LinkedList;
import java.util.Queue;
/**
* 08-722 Data Structures for Application Programmers.
* Homework 2-Josephus Problem
*
* Solve Josephus problem with different data structures and different
* algorithms and compare running times
*
* Andrew ID: ziangl
* @author Ziang Lu
*/
public class Josephus {
/**
* Uses ArrayDeque class as Queue/Deque to find the survivor's position.
* @param size number of people in the circle that is bigger than 0
* @param rotation elimination order in the circle. The value has to be greater than 0
* @return the position value of the survivor
*/
public int playWithAD(int size, int rotation) {
// Check whether the input size is positive
if (size <= 0) {
throw new RuntimeException("The input size must be greater than 0.");
}
// Check whether the input rotation is positive
if (rotation <= 0) {
throw new RuntimeException("The input rotation must be greater than 0.");
}
Queue<Integer> queue = new ArrayDeque<>();
for (int i = 1; i <= size; ++i) {
queue.offer(i);
}
while (queue.size() > 1) {
int actualRotation = rotation % queue.size();
if (actualRotation == 0) {
actualRotation = queue.size();
}
for (int i = 0; i < (actualRotation - 1); ++i) {
queue.offer(queue.poll());
}
queue.poll();
}
return queue.peek();
}
/**
* Uses LinkedList class as Queue/Deque to find the survivor's position.
* @param size number of people in the circle that is bigger than 0
* @param rotation elimination order in the circle. The value has to be greater than 0
* @return the position value of the survivor
*/
public int playWithLL(int size, int rotation) {
// Check whether the input size is positive
if (size <= 0) {
throw new RuntimeException("The input size must be greater than 0.");
}
// Check whether the input rotation is positive
if (rotation <= 0) {
throw new RuntimeException("The input rotation must be greater than 0.");
}
Queue<Integer> queue = new LinkedList<>();
for (int i = 1; i <= size; ++i) {
queue.offer(i);
}
while (queue.size() > 1) {
int actualRotation = rotation % queue.size();
if (actualRotation == 0) {
actualRotation = queue.size();
}
for (int i = 0; i < (actualRotation - 1); ++i) {
queue.offer(queue.poll());
}
queue.poll();
}
return queue.peek();
}
/**
* Uses LinkedList class to find the survivor's position.
* However, do NOT use the LinkedList as Queue/Deque
* Instead, use the LinkedList as "List"
* That means, it uses index value to find and remove a person to be executed in the circle
*
* Note: Think carefully about this method!!
* When in doubt, please visit one of the office hours!!
*
* @param size number of people in the circle that is bigger than 0
* @param rotation elimination order in the circle. The value has to be greater than 0
* @return the position value of the survivor
*/
public int playWithLLAt(int size, int rotation) {
// Check whether the input size is positive
if (size <= 0) {
throw new RuntimeException("The input size must be greater than 0.");
}
// Check whether the input rotation is positive
if (rotation <= 0) {
throw new RuntimeException("The input rotation must be greater than 0.");
}
List<Integer> list = new LinkedList<>();
for (int i = 1; i <= size; ++i) {
list.add(i);
}
int eliminateIdx = -1;
while (list.size() > 1) {
int actualRotation = rotation % list.size();
if (actualRotation == 0) {
actualRotation = list.size();
}
eliminateIdx = (eliminateIdx + actualRotation) % list.size();
list.remove(eliminateIdx);
--eliminateIdx;
}
return list.get(0);
}
}
| [
"ziangl@andrew.cmu.edu"
] | ziangl@andrew.cmu.edu |
7dcc0da34b8b79a7d1e2f6aeeac14e86548d12c8 | 673d3f5c48799f747110d758d48504aa997ca732 | /src/liuzh/poker/controler/CommonDealer.java | 85d1a7280e2c442e0bc793aa6ede1ef09e3ea82b | [] | no_license | liuzh99/DigTheEarth | 833c86a2335204be6d437ff6c6caf497cfa78c4f | 2bd6abb4d180ecfb415829a8359399461f669da7 | refs/heads/master | 2021-01-01T04:49:40.822331 | 2016-05-19T04:31:10 | 2016-05-19T04:31:10 | 57,293,404 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package liuzh.poker.controler;
import java.util.List;
import liuzh.poker.domain.PokerElem;
import liuzh.poker.exception.DealerException;
import liuzh.poker.exception.PokerException;
/**
* title:常规发牌器
* descript:
* @author liuzh
* @date 2016年4月27日 上午9:36:26
*/
public class CommonDealer extends Dealer {
public CommonDealer() {
super();
}
@Override
public void deal() throws PokerException, DealerException {
List<PokerElem> pokerElems = (List<PokerElem>) poker.getPokerCollection();
if(pokerElems.size() != 52){
throw new PokerException("扑克牌不是52张");
}
if(players.size() < 4){
throw new DealerException("玩家数量不足");
}
int index = 0;
while(index < 52){
for(int i=0;i<4;i++){
players.get(i).addPokerElem(pokerElems.get(index));
index++;
}
}
}
}
| [
"1432111595@qq.com"
] | 1432111595@qq.com |
63ff71c6cab2c94f245a6ca36ffb14be19bc5537 | 9a12f6c2d2ce0c1273e0370aacb17c7248c5f9ee | /moduleSystem/tools/src/main/java/com/aptdev/tools/screens/ScreenUtils.java | 2e0d7cca67103b55977d2e0938c9c1a7d61a3c54 | [] | no_license | dragonNLC/MyNettyProject-master | 3f0806eabf119bd3aff9420475f9a85f44e05be5 | 8deb5d52cbf9d168c2f37a39c3a88f19b82cf41b | refs/heads/master | 2022-07-06T15:31:50.540876 | 2020-05-09T10:58:33 | 2020-05-09T10:58:33 | 262,036,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | package com.aptdev.tools.screens;
import android.content.Context;
import android.util.DisplayMetrics;
public class ScreenUtils {
public static DisplayMetrics getScreenDM(Context context) {
return context.getResources().getDisplayMetrics();
}
public static int getScreenWidth(Context context) {
return getScreenDM(context).widthPixels;
}
public static int getScreenHeight(Context context) {
return getScreenDM(context).heightPixels;
}
public static int dp2px(int dp) {
return 0;
}
public static int px2dp(int px) {
return 0;
}
}
| [
"707969194@qq.com"
] | 707969194@qq.com |
93311ce0d4ea116cafc573bfad37eef38edb5a3f | ae463fd9dec11bbe0d2fe39882b11d2f2358d9f1 | /mywuwu-visual/mywuwu-shop/src/main/java/com/mywuwu/pigx/shop/entity/Channel.java | ab75df906f8d8b25b50fedfafc961414f10a4873 | [] | no_license | soon14/mywuwu-new | 232278894bc896210e1bc99e3a9166063d021461 | 8f0b6377c30b32ee8405de39637f4f3204991028 | refs/heads/master | 2022-06-25T16:50:03.374484 | 2020-05-11T13:15:41 | 2020-05-11T13:15:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,838 | java | /*
* Copyright (c) 2018-2025, lianglele All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the ywuwu.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lianglele (liangle1986@126.com)
*/
package com.mywuwu.pigx.shop.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author lianglele
* @date 2019-08-26 22:23:42
*/
@Data
@TableName("channel")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "")
public class Channel extends Model<Channel> {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId
@ApiModelProperty(value="")
private Integer id;
/**
*
*/
@ApiModelProperty(value="")
private String name;
/**
*
*/
@ApiModelProperty(value="")
private String url;
/**
*
*/
@ApiModelProperty(value="")
private String iconUrl;
/**
*
*/
@ApiModelProperty(value="")
private Integer sortOrder;
}
| [
"liangle1986@126.com"
] | liangle1986@126.com |
1cff01f456fecd2868e49c035f3dfa7f68f50c81 | 75389d9bb86218800bdb0265d59e1597c20af6d2 | /app/src/androidTest/java/marlyn/registerloginlogoutsqlite/ExampleInstrumentedTest.java | 0a672b93931bf060583d8007770a551472b0378f | [] | no_license | rrTio/RegisterLoginLogoutSQLite | 0fdb9e881549a1533d6fca75e338c5fd0c07b9f2 | 94a930e0c9fe69d009bb0052d1284e816e0db8f1 | refs/heads/master | 2021-06-15T04:40:29.096349 | 2017-04-17T05:36:01 | 2017-04-17T05:36:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package marlyn.registerloginlogoutsqlite;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("marlyn.registerloginlogoutsqlite", appContext.getPackageName());
}
}
| [
"mlynn1710@gmail.com"
] | mlynn1710@gmail.com |
4c3365e4da9624b79fd4ea3be36e5c7626d199f6 | c6e78ae78f2f9a5aa4e2adf540a54be3bc7f1715 | /02-Stack_And_Queue/Queue/src/Array.java | cc17d83ed058dbe7a150f36dd92f86d23e43b61c | [] | no_license | Arbonkeep/Data-Structure | 2014f8813a7df4411b9f2a7c448412dc1a1e7dba | 214481de2e6d93ae61cbf7fdea1a95262c9924f8 | refs/heads/master | 2020-07-02T15:01:41.980578 | 2019-10-05T08:55:55 | 2019-10-05T08:55:55 | 201,565,363 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,429 | java | public class Array<E> {
private E[] data;//定义一个数组成员变量
private int size;//定义数组的size实际长度
//定义一个无参构造,默认数组容量为10
public Array() {
this(10);
}
//定义一个有参构造,传入数组容量capacity构造Array
public Array(int capacity) {
data = (E[]) new Object[capacity];//此处不能够直接创建一个泛型为E的数组,可以通过将Object数组进行强转的方式实现
size = 0;
}
//定义一个获取数组实际长度的方法,即获取数组中元素的个数
public int getSize() {
return size;
}
//定义一个获取数组容量的方法
public int getCapacity() {
return data.length;
}
//定义一个方法isEmpty判断数组是否为空
public boolean isEmpty() {
return size == 0;
}
//在数组的末尾添加一个元素
public void addLast(E e) {
/* if (size == data.length) {
throw new ArrayIndexOutOfBoundsException("索引越界");
}else {
data[size] = e;
size ++;//增加了一个元素所以size改变
}*/
//方法复用
add(size,e);
}
//在指定位置添加一个元素
public void add(int index, E e) {
if(index < 0 || index > size) {//索引为负数或者索引大于真实元素个数(说明索引非法)
throw new ArrayIndexOutOfBoundsException("数组索引越界");
}
if (size == data.length) {
resize(2 * data.length);
}
for (int i = size - 1; i >= index ; i--) {//倒着遍历index之后的数组元素,将前后元素进行进行交换
data[i + 1] = data[i];
}
data[index] = e;
size++;
}
//定义一个扩容的方法.内部调用方法用private修饰。
private void resize(int newCapacity) {
//创建一个新数组
E[] newData = (E[]) new Object[newCapacity];
//遍历,将data中的元素转移到newData
for (int i = 0; i < size ; i++) {
newData[i] = data[i];
}
//将data的引用指向newData
data = newData;
}
//定义一个在数组第一个索引添加元素的方法
public void addFirst(E e) {
add(0,e);
}
//重写toString方法
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.format("Array:size = %d , capacity = %d\n",size,data.length));
sb.append("[");
for (int i = 0; i < size; i++) {
sb.append(data[i]);
if(i != size - 1) {
sb.append(", ");
}else {
sb.append("]");
}
}
return sb.toString();
}
//定义一个获取索引位置的元素的方法
public E get(int index) {
if (index < 0 || index >= size) {
throw new ArrayIndexOutOfBoundsException("数组索引越界");
}
return data[index];
}
//定义一个获取第一个元素的方法
public E getFirst() {
return get(0);
}
//定义一个获取最后一个元素的方法
public E getLast() {
return get(getSize() - 1 );
}
//定义一个设置指定索引位置元素的方法
public void set(int index ,E e) {
if (index < 0 || index >= size) {
throw new ArrayIndexOutOfBoundsException("数组索引越界");
}
data[index] = e;
}
//添加判断是否包含指定元素的方法
public boolean contains(E e) {
boolean flag = true;
for (int i = 0; i < size ; i++) {
if (data[i] == e) {
break;
}else {
flag = false;
}
}
return flag;
}
//定义一个查找元素的方法,并返回对应的索引
public int find(E e) {
for (int i = 0; i < size; i++) {
if (data[i] == e) {
return i;
}
}
return -1;
}
//定义删除指定索引的元素的方法,并将该元素返回
public E remove(int index) {
if(index < 0 || index >= size) {//索引为负数或者索引大于真实元素个数(说明索引非法)
throw new ArrayIndexOutOfBoundsException("数组索引越界");
}
E ele = data[index];
for (int i = index + 1; i < size ; i++) {//从index之后的元素开始都让它向前移动一个位置
data[i - 1] = data[i];
}
size--;
data[size] = null;//将数组中的引用设置为null,这样能够被垃圾回收机制清理
if(data.length == 4 * size) {//如果数组容量为2倍的元素的实际长度
resize(data.length/2);
}
return ele;//最后将删除的元素返回
}
//定义删除第一个元素的方法
public E removeFirst() {
return remove(0);
}
//定义删除最后一个元素的方法
public E removeLast() {
return remove(size - 1);
}
//定义一个删除指定元素的方法
public void removeElement(E e) {
int index = find(e);//调用方法查看是否存在这个元素
if(index != -1)
remove(index);//调用之前定义的方法将该元素删除
}
}
| [
"1277406510@qq.com"
] | 1277406510@qq.com |
97bb5d478c732a2b79d7218152246926061b60f8 | 98d55874343a2e89795497086f3c87657f29738e | /src/main/java/com/whatscover/service/MailService.java | 786880204f40a580dac68531cdaa7550318fad03 | [] | no_license | BulkSecurityGeneratorProject/whatscover | f4c820b6ebfc14f502d01bebc401c2f491357eaa | 96cea6d40172557ce6b7e1e596d0fe77244f69df | refs/heads/master | 2022-12-28T03:23:22.564738 | 2017-07-12T01:53:03 | 2017-07-12T01:53:03 | 296,613,361 | 0 | 0 | null | 2020-09-18T12:21:16 | 2020-09-18T12:21:15 | null | UTF-8 | Java | false | false | 4,613 | java | package com.whatscover.service;
import com.whatscover.domain.User;
import io.github.jhipster.config.JHipsterProperties;
import org.apache.commons.lang3.CharEncoding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.apache.commons.lang3.StringUtils;
import javax.mail.internet.MimeMessage;
import java.util.Locale;
/**
* Service for sending emails.
* <p>
* We use the @Async annotation to send emails asynchronously.
* </p>
*/
@Service
public class MailService {
private final Logger log = LoggerFactory.getLogger(MailService.class);
private static final String USER = "user";
private static final String BASE_URL = "baseUrl";
private final JHipsterProperties jHipsterProperties;
private final JavaMailSender javaMailSender;
private final MessageSource messageSource;
private final SpringTemplateEngine templateEngine;
public MailService(JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender,
MessageSource messageSource, SpringTemplateEngine templateEngine) {
this.jHipsterProperties = jHipsterProperties;
this.javaMailSender = javaMailSender;
this.messageSource = messageSource;
this.templateEngine = templateEngine;
}
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
log.debug("Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
isMultipart, isHtml, to, subject, content);
// Prepare message using a Spring helper
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
try {
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
message.setTo(to);
message.setFrom(jHipsterProperties.getMail().getFrom());
message.setSubject(subject);
message.setText(content, isHtml);
javaMailSender.send(mimeMessage);
log.debug("Sent email to User '{}'", to);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.warn("Email could not be sent to user '{}'", to, e);
} else {
log.warn("Email could not be sent to user '{}': {}", to, e.getMessage());
}
}
}
@Async
public void sendEmailFromTemplate(User user, String templateName, String titleKey) {
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl());
String content = templateEngine.process(templateName, context);
String subject = messageSource.getMessage(titleKey, null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}
@Async
public void sendActivationEmail(User user) {
log.debug("Sending activation email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "activationEmail", "email.activation.title");
}
@Async
public void sendCreationEmail(User user) {
log.debug("Sending creation email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "creationEmail", "email.activation.title");
}
@Async
public void sendPasswordResetMail(User user) {
log.debug("Sending password reset email to '{}'", user.getEmail());
sendEmailFromTemplate(user, "passwordResetEmail", "email.reset.title");
}
@Async
public void sendSocialRegistrationValidationEmail(User user, String provider) {
log.debug("Sending social registration validation email to '{}'", user.getEmail());
Locale locale = Locale.forLanguageTag(user.getLangKey());
Context context = new Context(locale);
context.setVariable(USER, user);
context.setVariable("provider", StringUtils.capitalize(provider));
String content = templateEngine.process("socialRegistrationValidationEmail", context);
String subject = messageSource.getMessage("email.social.registration.title", null, locale);
sendEmail(user.getEmail(), subject, content, false, true);
}
}
| [
"toni.xm@gmail.com"
] | toni.xm@gmail.com |
f746b034804d08ca4ac844bdab9655bc4a623f04 | a14a7f4c082acab026f04f5141cdf1036e10ed69 | /practise_set_11/Q2.java | 0dc758948be81c6599e24471e4909d8ea0d7a4b6 | [] | no_license | imyogeshgaur/java_practise | 04882f89ba7af3171c1aef4e432d91810830873f | 2811cf3481b8bf24118df3843bb354a1c70281b0 | refs/heads/main | 2023-02-10T08:57:52.344433 | 2021-01-07T05:23:23 | 2021-01-07T05:23:23 | 305,073,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package practise_set_11;
class Monkey {
public void bite() {
System.out.println("Biting...!!!!");
}
public void jump() {
System.out.println("Jumping...!!!!");
}
}
interface animal {
abstract void eat();
abstract void sleep();
}
class Human extends Monkey implements animal {
@Override
public void eat() {
System.out.println("Eating...!!!!");
}
@Override
public void sleep() {
System.out.println("Sleeping...!!!");
}
}
public class Q2 {
}
| [
"yogeshgaur1995@gmail.com"
] | yogeshgaur1995@gmail.com |
2e36831e2b97780bd30f9fee730b2964f420e232 | 07d2c8aead35f3e71b691c7f3fb43a62259591d3 | /src/main/java/com/nado/rlzy/service/impl/JobSeekingPersonalCenterServiceImpl.java | 3254d8793a8046ba5847c0b12a964788c345b1ae | [] | no_license | Lushuaiyu/rlzy | c4017493c53e7a36343368525d32631b4fb18fca | 587a2644decfb77bf2d6a0128709f699e0bae009 | refs/heads/master | 2022-11-23T08:39:13.439626 | 2019-09-23T01:49:32 | 2019-09-23T01:49:32 | 193,653,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,470 | java | package com.nado.rlzy.service.impl;
import com.nado.rlzy.db.mapper.HrBriefchapterMapper;
import com.nado.rlzy.db.mapper.HrGroupMapper;
import com.nado.rlzy.db.mapper.HrSignUpMapper;
import com.nado.rlzy.db.mapper.HrUserMapper;
import com.nado.rlzy.db.pojo.HrBriefchapter;
import com.nado.rlzy.db.pojo.HrSignUp;
import com.nado.rlzy.db.pojo.HrUser;
import com.nado.rlzy.service.JobSeekingPersonalCenterService;
import com.nado.rlzy.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @ClassName 求职端个人中心实现类
* @Description TODO
* @Author lushuaiyu
* @Data 2019/7/22 14:59
* @Version 1.0
*/
@Service
public class JobSeekingPersonalCenterServiceImpl implements JobSeekingPersonalCenterService {
@Resource
private HrBriefchapterMapper mapper;
@Resource
private HrSignUpMapper signUpMapper;
@Resource
private HrUserMapper userMapper;
@Resource
private HrGroupMapper groupMapper;
@Override
public List<HrBriefchapter> recruitmentBrochureCollectionRecruitment(Integer userId, Integer type) {
return mapper.recruitmentBrochureCollectionRecruitment(userId, type)
.stream()
.map(dto -> {
//月综合
double value = dto.getAvgSalary().doubleValue();
String format = StringUtil.decimalFormat2(value);
dto.setAvgSalary1(format + "元起");
//计薪
double value1 = dto.getDetailSalary().doubleValue();
String s1 = StringUtil.decimalFormat2(value1);
String detailSalaryWay = dto.getDetailSalaryWay();
dto.setDetailSalry1(s1 + "元/" + detailSalaryWay);
dto.setNo(dto.getRecruitingNo() + "人");
BigDecimal rebateMaleInterview = dto.getRebateMaleInterview();
BigDecimal rebateMaleReport = dto.getRebateMaleReport();
BigDecimal rebateMaleEntry = dto.getRebateMaleEntry();
BigDecimal rebateFemaleInterview = dto.getRebateFemaleInterview();
BigDecimal rebateFemaleReport = dto.getRebateFemaleReport();
BigDecimal rebateFemaleEntry = dto.getRebateFemaleEntry();
if (null != rebateMaleInterview && null != rebateMaleReport && null != rebateMaleEntry &&
null != rebateFemaleInterview && null != rebateFemaleReport && null != rebateFemaleEntry) {
//男生返佣的钱
BigDecimal add = rebateMaleInterview.add(rebateMaleReport)
.add(rebateMaleEntry);
BigDecimal add1 = rebateFemaleInterview.add(rebateFemaleReport)
.add(rebateFemaleEntry);
//女生返佣的钱
BigDecimal n = add.compareTo(add1) >= 0 ? add : add1;
String rebateMoney = StringUtil.decimalToString(n);
dto.setRebateRecord("返" + rebateMoney + "元");
}
return dto;
})
.collect(Collectors.toList());
}
@Override
public List<HrBriefchapter> recruitmentBrochureCollection(Integer userId, Integer type) {
return mapper.recruitmentBrochureCollection(userId, type)
.stream()
.map(dto -> {
//月综合
double value = dto.getAvgSalary().doubleValue();
String format = StringUtil.decimalFormat2(value);
dto.setAvgSalary1(format + "元起");
//计薪
double value1 = dto.getDetailSalary().doubleValue();
String s1 = StringUtil.decimalFormat2(value1);
String detailSalaryWay = dto.getDetailSalaryWay();
dto.setDetailSalry1(s1 + "元/" + detailSalaryWay);
dto.setNo(dto.getRecruitingNo() + "人");
BigDecimal rebateMaleInterview = dto.getRebateMaleInterview();
BigDecimal rebateMaleReport = dto.getRebateMaleReport();
BigDecimal rebateMaleEntry = dto.getRebateMaleEntry();
BigDecimal rebateFemaleInterview = dto.getRebateFemaleInterview();
BigDecimal rebateFemaleReport = dto.getRebateFemaleReport();
BigDecimal rebateFemaleEntry = dto.getRebateFemaleEntry();
if (null != rebateMaleInterview && null != rebateMaleReport && null != rebateMaleEntry &&
null != rebateFemaleInterview && null != rebateFemaleReport && null != rebateFemaleEntry) {
//男生返佣的钱
BigDecimal add = rebateMaleInterview.add(rebateMaleReport)
.add(rebateMaleEntry);
BigDecimal add1 = rebateFemaleInterview.add(rebateFemaleReport)
.add(rebateFemaleEntry);
//女生返佣的钱
BigDecimal n = add.compareTo(add1) >= 0 ? add : add1;
String rebateMoney = StringUtil.decimalToString(n);
dto.setRebateRecord("返" + rebateMoney + "元");
}
return dto;
}).collect(Collectors.toList());
}
@Override
public HrSignUp selectSignUpTable(Integer signId) {
HrSignUp sign = signUpMapper.selectSignUpTable(signId);
String s = StringUtil.realName(Optional.ofNullable(sign).orElseGet(HrSignUp::new).getIdCard());
sign.setIdCard(s);
return sign;
}
@Override
public List<HrSignUp> selectSignUp(Integer userId) {
return signUpMapper.selectSignUp(userId).stream().collect(Collectors.toList());
}
@Override
public List<HrUser> queryMyselfVillation(Integer userId) {
List<HrUser> list = userMapper.queryMyselfVillation(userId);
return list.stream()
.map(dto -> {
dto.getDeliveryrecords()
.stream().map(x -> {
Integer jobStatus = x.getJobStatus();
if (jobStatus.equals(8)) {
//未面试
x.setInterviewFont("未面试");
}
if (jobStatus.equals(9)) {
//未报到
x.setReportFont("未报到");
}
return x;
}).collect(Collectors.toList());
return dto;
}).collect(Collectors.toList());
}
@Override
public List<HrUser> queryReferrerVillation(Integer userId) {
List<HrUser> list = userMapper.queryReferrerVillation(userId);
List<HrUser> users = list.stream()
.map(dto -> {
Integer dtoUserId = dto.getUserId();
Integer briefChapterId = dto.getBriefChapterId();
List<HrUser> hrUsers = userMapper.queryJobStatus(dtoUserId, briefChapterId);
hrUsers.stream()
.map(d -> {
long count = d.getDeliveryrecords().stream().filter(x -> x.getJobStatus() == 8).count();
Integer inteviewe = (int) count;
long count1 = d.getDeliveryrecords().stream().filter(xx -> xx.getJobStatus() == 9).count();
Integer report = (int) count1;
if (!(inteviewe.equals(0))) {
dto.setInteview(inteviewe + "人未面试");
}
if (!(report.equals(0))) {
dto.setReport(report + "人未报到");
}
return d;
}).collect(Collectors.toList());
return dto;
}).collect(Collectors.toList());
return users;
}
}
| [
"lsy1246796812@gmail.com"
] | lsy1246796812@gmail.com |
0ec2a01fba7d022d7ba3dc62729fb08376e64a75 | 60b80d80342987e0123a0206bcb204cc18daf1ba | /aws-java-sdk-mediapackagevod/src/main/java/com/amazonaws/services/mediapackagevod/model/transform/CreatePackagingConfigurationResultJsonUnmarshaller.java | 06409286bc963b43b313d9e209449a6dace11cbb | [
"Apache-2.0"
] | permissive | Jayu8/aws-sdk-java | 43084f98cc60de7e917e753fe00e46c6b746a889 | 5ee04c93922ecbabed8bbed237b17db695661900 | refs/heads/master | 2021-06-20T02:15:09.070582 | 2020-04-09T22:55:17 | 2020-04-09T22:55:17 | 254,494,443 | 0 | 0 | Apache-2.0 | 2020-04-09T22:49:35 | 2020-04-09T22:49:34 | null | UTF-8 | Java | false | false | 4,580 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.mediapackagevod.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.mediapackagevod.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* CreatePackagingConfigurationResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreatePackagingConfigurationResultJsonUnmarshaller implements Unmarshaller<CreatePackagingConfigurationResult, JsonUnmarshallerContext> {
public CreatePackagingConfigurationResult unmarshall(JsonUnmarshallerContext context) throws Exception {
CreatePackagingConfigurationResult createPackagingConfigurationResult = new CreatePackagingConfigurationResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return createPackagingConfigurationResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("arn", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setArn(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("cmafPackage", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setCmafPackage(CmafPackageJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("dashPackage", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setDashPackage(DashPackageJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("hlsPackage", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setHlsPackage(HlsPackageJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("id", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("mssPackage", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setMssPackage(MssPackageJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("packagingGroupId", targetDepth)) {
context.nextToken();
createPackagingConfigurationResult.setPackagingGroupId(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return createPackagingConfigurationResult;
}
private static CreatePackagingConfigurationResultJsonUnmarshaller instance;
public static CreatePackagingConfigurationResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new CreatePackagingConfigurationResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
dfceb0327b9b534e3ad45bf397a92fcc965217de | 449f1828967f97b32119139956967ede375dd052 | /src/cn/ajax/City.java | e1e780202470229c8c2e8730c5b5ee4acfae5237 | [] | no_license | Maalau/Study_JSP-Servlet-Mysql | 17b84a021f0d6595d0b63e9b757efa0ce21da71f | e6df43ea53611b8cc7fd4469ca8c2ef031585d2b | refs/heads/master | 2022-03-30T06:26:52.310077 | 2020-01-25T05:33:53 | 2020-01-25T05:33:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package cn.ajax;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("city")
public class City {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"690005691@qq.com"
] | 690005691@qq.com |
7e2e8b26ef16b0755a37cb375d18ed54adc2d35e | 9a9b770ad371a1eb26cfbfcf23ba34de9498eed9 | /app/src/test/java/com/fat_trainer/fakepokemonlocation/ExampleUnitTest.java | 5e2d7376021cfba628a61feea5e9c12dbcb28c46 | [] | no_license | opeykin/FakePokemonLocation | fc5225180a94f6733a5d82209653c188bdf9426d | 498ae7812f59cac284ea0478880b85142e7326b0 | refs/heads/master | 2021-01-20T19:13:37.224106 | 2016-07-30T15:27:39 | 2016-07-30T15:27:39 | 64,550,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 328 | java | package com.fat_trainer.fakepokemonlocation;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"alexander.opeykin@gmail.com"
] | alexander.opeykin@gmail.com |
2adc9e755fd23e4368da64de67182b5085f05b64 | f53421c7e0a6456547c5c3219cb904aa51165591 | /src/java/cz/mutabene/controller/entity/AddressController.java | aa17d7617ad130c5a34de52f8fbf6df3f61cac1b | [] | no_license | fuchsane/mutabene | 45a16f82a5ff47dd45b27514761e05104f23546b | 7796a58da7f7076dc9278e4d0bb1588f17eed442 | refs/heads/master | 2021-01-15T21:54:07.286564 | 2011-11-26T17:18:14 | 2011-11-26T17:18:14 | 2,860,294 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,972 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cz.mutabene.controller.entity;
import cz.mutabene.controller.entity.interfaces.IEntityUseController;
import cz.mutabene.model.forms.entity.AddressModel;
import cz.mutabene.model.entity.AddressEntity;
import cz.mutabene.model.entity.RegionEntity;
import cz.mutabene.service.manager.AddressManager;
import cz.mutabene.service.manager.RegionManager;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
*
* @author stenlik
*/
@Controller
@RequestMapping(value = "admin/address/")
public class AddressController implements IEntityUseController<AddressModel, Long, ModelMap, String, BindingResult> {
private AddressManager addressManager;
private RegionManager regionManager;
private final String PATH_VIEW = "Entity/Address";
private Map<String, String> getListRegions() {
Collection<RegionEntity> allRegions = regionManager.findAll();
Map<String, String> listRegion = new LinkedHashMap<String, String>();
for (RegionEntity r : allRegions) {
if (r.getRegion() == null) {
listRegion.put("parent", r.getName());
for (RegionEntity r2 : allRegions) {
if (null != r2.getRegion() && r.getId() == r2.getRegion().getId() && r2.getRegion().getId() != r2.getId()) {
listRegion.put(r2.getId().toString(), " - " + r2.getName() + " -");
}
}
}
}
return listRegion;
}
@RequestMapping(value = "show.htm", method = RequestMethod.GET)
public String show(ModelMap m) {
Collection<AddressEntity> allAddress = addressManager.findAll();
m.addAttribute("allAddress", allAddress);
return PATH_VIEW + "/show";
}
@RequestMapping(value = "add.htm", method = RequestMethod.GET)
public String add(AddressModel formModel, ModelMap m) {
m.addAttribute("formModel", formModel);
m.addAttribute("listRegions", getListRegions());
return PATH_VIEW + "/add";
}
@RequestMapping(value = "edit.htm", method = RequestMethod.GET)
public String edit(Long id, ModelMap m) {
AddressEntity addressModel;
try {
addressModel = addressManager.findById(id);
addressModel.getId();
} catch (Exception e) {
return "redirect:show.htm";
}
AddressModel formModel = new AddressModel();
formModel.setId(addressModel.getId().toString());
formModel.setCity(addressModel.getCity());
formModel.setStreet(addressModel.getStreet());
formModel.setZipCode(addressModel.getZipCode());
try{
formModel.setIdRegion(addressModel.getRegion().getId().toString());
}catch(Exception e){
}
m.addAttribute("formModel", formModel);
m.addAttribute("listRegions", getListRegions());
return PATH_VIEW + "/edit";
}
@RequestMapping(value = "delete.htm", method = RequestMethod.GET)
public String delete(Long id, ModelMap m) {
AddressEntity toDelete;
try {
toDelete = addressManager.findById(id);
toDelete.getId();
} catch (Exception e) {
return "redirect:show.htm";
}
addressManager.delete(toDelete);
return "redirect:show.htm";
}
@RequestMapping(value = "save.htm", method = RequestMethod.POST)
public String save(AddressModel formModel, BindingResult result, ModelMap m) {
AddressEntity addressOrig;
RegionEntity addressRegion;
try {
Long id = Long.parseLong(formModel.getId());
addressOrig = addressManager.findById(id);
addressOrig.setCity(formModel.getCity());
addressOrig.setStreet(formModel.getStreet());
addressOrig.setZipCode(formModel.getZipCode());
} catch (Exception e) {
return "redirect:show.htm";
}
try {
Long id = Long.parseLong(formModel.getIdRegion());
addressRegion = regionManager.findById(id);
addressOrig.setRegion(addressRegion);
} catch (Exception e) {
addressOrig.setRegion(null);
}
addressManager.update(addressOrig);
Collection<AddressEntity> allAddress = addressManager.findAll();
m.addAttribute("allAddress", allAddress);
return "redirect:show.htm";
}
@RequestMapping(value = "submit.htm", method = RequestMethod.POST)
public String submit(AddressModel formModel, BindingResult result, ModelMap m) {
AddressEntity address = new AddressEntity();
address.setCity(formModel.getCity());
address.setStreet(formModel.getStreet());
address.setZipCode(formModel.getZipCode());
RegionEntity region;
try {
Long id = Long.parseLong(formModel.getIdRegion());
region = regionManager.findById(id);
} catch (Exception e) {
region = null;
}
address.setRegion(region);
addressManager.add(address);
Collection<AddressEntity> allAddress = addressManager.findAll();
m.addAttribute("allAddress", allAddress);
return "redirect:show.htm";
}
public @Autowired
void setAddressManager(AddressManager addressManager) {
this.addressManager = addressManager;
}
public @Autowired
void setRegionManager(RegionManager regionManager) {
this.regionManager = regionManager;
}
}
| [
"stenlik@gmail.com"
] | stenlik@gmail.com |
1fc4ee7dec15f3462a2990b554728cf6cf14242e | 6d8270f15c75ee9b47c0309ca55718beecee4f12 | /source/core/src/main/com/deco2800/game/components/Component.java | 4e4b430dae1eb70b06be9142cc96984e8d5e782b | [] | no_license | UQdeco2800/2021-studio-1 | 3b9304743b51c6f1b301e61ff85f8985ed13cf99 | 456db35e929a3f1fe63c0153295546514aa3b82a | refs/heads/main | 2023-08-18T16:39:53.051524 | 2021-10-19T23:11:47 | 2021-10-19T23:11:47 | 391,529,995 | 6 | 2 | null | 2021-10-19T23:11:48 | 2021-08-01T04:58:18 | Java | UTF-8 | Java | false | false | 2,922 | java | package com.deco2800.game.components;
import com.deco2800.game.entities.Entity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Core component class from which all components inherit. Contains logic for creating, updating,
* and disposing. Components can be attached to an entity to give it specific behaviour. It is
* unlikely that changes will need to be made here.
*/
public class Component {
private static final Logger logger = LoggerFactory.getLogger(Component.class);
protected Entity entity;
protected boolean enabled = true;
/**
* Called when the entity is created and registered. Initial logic such as calls to GetComponent
* should be made here, not in the constructor which is called before an entity is finished.
*/
public void create() {
// No action by default.
}
/**
* Early update called once per frame of the game, before update(). Use this only for logic that
* must run before other updates, such as physics. Not called if component is disabled.
*/
public void earlyUpdate() {
// No action by default.
}
/**
* Called once per frame of the game, and should be used for most component logic. Not called if
* component is disabled.
*/
public void update() {
// No action by default.
}
/** Called when the component is disposed. Dispose of any internal resources here. */
public void dispose() {
// No action by default.
}
/**
* Set the entity to which this component belongs. This is called by the Entity, and should not be
* set manually.
*
* @param entity The entity to which the component is attached.
*/
public void setEntity(Entity entity) {
logger.debug("Attaching {} to {}", this, entity);
this.entity = entity;
}
/**
* Get the entity to which this component belongs.
* @return entity
*/
public Entity getEntity() {
return entity;
}
/**
* Enable or disable the component. While disabled, a component does not run update() or
* earlyUpdate(). Other events inside the component may still fire. The component can still be
* disposed while disabled.
*
* @param enabled Should component be enabled
*/
public void setEnabled(boolean enabled) {
logger.debug("Setting enabled={} on {}", enabled, this);
this.enabled = enabled;
}
/** Used to trigger the component to update itself. This should not need to be called manually. */
public final void triggerUpdate() {
if (enabled) {
update();
}
}
/**
* Used to trigger the component to early-update itself. This should not need to be called
* manually.
*/
public final void triggerEarlyUpdate() {
if (enabled) {
earlyUpdate();
}
}
@Override
public String toString() {
String className = this.getClass().getSimpleName();
if (entity == null) {
return className;
}
return entity + "." + className;
}
}
| [
"thebelgiumesekid@gmail.com"
] | thebelgiumesekid@gmail.com |
548ef7d0af186194c3107c3d7f487d5d8374dcec | d68b6e200de489651d0335835ddadd803405be51 | /chicken-manage/src/main/java/io/renren/chick/chicken/service/impl/RaiserecordServiceImpl.java | 56fb1d2b5a780e6bc9635e7165306f5990b1f23a | [
"Apache-2.0"
] | permissive | XiangHuaZheng/ChickenManage | a9bdbd621d188ba6a08b4fd7700f936e28dbc3f7 | af38f30b13e4957cc641e89eedbb3aeadf461081 | refs/heads/master | 2023-01-05T15:52:15.071616 | 2020-10-22T04:04:02 | 2020-10-22T04:04:02 | 299,990,380 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package io.renren.chick.chicken.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.chick.chicken.dao.RaiserecordDao;
import io.renren.chick.chicken.entity.RaiserecordEntity;
import io.renren.chick.chicken.service.RaiserecordService;
@Service("raiserecordService")
public class RaiserecordServiceImpl extends ServiceImpl<RaiserecordDao, RaiserecordEntity> implements RaiserecordService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<RaiserecordEntity> page = this.page(
new Query<RaiserecordEntity>().getPage(params),
new QueryWrapper<RaiserecordEntity>()
);
return new PageUtils(page);
}
} | [
"912358463@qq.com"
] | 912358463@qq.com |
c8d408718bc7329fa90cd4de241c547b3e9d3355 | 8d8c0b63d8d40d61f0606b4525002fee3f32f8a1 | /src/cn/especially/hotdemo3/MyView.java | 21982353be251b43461610f7f109378ccf61bbdb | [] | no_license | BEspecially/Demo | 22ce5b8043d27693eb04650fe66b8b3530c959e1 | 10ef29068c229271f2cb3984b3da567372bdf3aa | refs/heads/master | 2016-09-01T08:49:39.212242 | 2015-11-03T10:48:05 | 2015-11-03T10:48:52 | 45,034,605 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,951 | java | package cn.especially.hotdemo3;
import cn.especially.hotdemo2.EvaluateUtil;
import com.nineoldandroids.view.ViewHelper;
import android.content.Context;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
import android.support.v4.widget.ViewDragHelper.Callback;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
public class MyView extends FrameLayout {
private Callback callback=new Callback() {
@Override
public boolean tryCaptureView(View arg0, int arg1) {
return ll_boom==arg0||ll_top==arg0;
}
/**
* 垂直方向
*/
@Override
public int clampViewPositionVertical(View child, int top, int dy) {
if (child==ll_boom) {
if (top<0) {
top=0;
}else if (top>ll_topHeight) {
top=ll_topHeight;
}
}else if (child==ll_top){
if (top>0) {
top=0;
}
}
return top;
}
public int getViewVerticalDragRange(View child) {
return ll_topHeight; //大于0
};
/**
* 位置发生改变dy 向上为正 向下为负
*/
public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) {
if (changedView==ll_top) {
ll_top.layout(0, 0, ll_topWidth, ll_topHeight);
int newHeight=ll_boom.getTop()+dy;
if (newHeight>ll_topHeight) {
newHeight=ll_topHeight;
ll_boom.layout(0, newHeight, ll_topWidth, newHeight+ll_boomheight);
}
ll_boom.layout(0, newHeight, ll_topWidth, newHeight+ll_boomheight);
}
upPullAnimation(ll_boom.getTop());
invalidate();//解决2.3不能动的bug
};
/**
* 手释放的时候
*/
public void onViewReleased(View releasedChild, float xvel, float yvel) {
if (yvel==0&&ll_boom.getTop()<ll_topHeight*0.5f) {
close();
}else if (yvel<0) {
close();
}else {
open();
}
};
};
private ViewDragHelper dragHelper;
private ViewGroup ll_top;
private ViewGroup ll_boom;
private int ll_topHeight;
private int ll_topWidth;
private int ll_boomheight;
public MyView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
/**
* 上拉
* @param top
*/
protected void upPullAnimation(int top) {
float fraction = top*1f/ll_topHeight;
ViewHelper.setTranslationY(ll_top, -EvaluateUtil.evaluateInt(fraction, ll_topHeight/3,0 ));
}
/**
* 打开
*/
protected void open() {
open(true);
}
public void open (boolean isSmooth){
if (isSmooth) {
dragHelper.smoothSlideViewTo(ll_boom, 0, ll_topHeight);
invalidate();
}else {
ll_boom.layout(0, ll_topHeight, ll_topWidth, ll_topHeight+ll_boomheight);
}
}
/**
* 关闭
*/
protected void close() {
close(true);
}
public void close (boolean isSmooth){
if (isSmooth) {
dragHelper.smoothSlideViewTo(ll_boom, 0, 0);
invalidate();
}else {
ll_boom.layout(0, 0, ll_topWidth, ll_boomheight);
}
}
public MyView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public MyView(Context context) {
this(context,null);
}
private void init() {
dragHelper = ViewDragHelper.create(this, callback);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
dragHelper.processTouchEvent(event);
return true;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return dragHelper.shouldInterceptTouchEvent(ev);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
if (getChildCount()<2) {
throw new RuntimeException("Containing at least two view");
}
if (!(getChildAt(0) instanceof ViewGroup)||!(getChildAt(1) instanceof ViewGroup)) {
throw new IllegalArgumentException("illeagal type");
}
ll_top = (ViewGroup) getChildAt(0);
ll_boom = (ViewGroup) getChildAt(1);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
ll_topHeight = ll_top.getMeasuredHeight();
ll_topWidth = ll_top.getMeasuredWidth();
ll_boomheight = ll_boom.getMeasuredHeight();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right,
int bottom) {
super.onLayout(changed, left, top, right, bottom);
ll_boom.layout(0, ll_topHeight, ll_topWidth, ll_topHeight+ll_boomheight);
}
@Override
public void computeScroll() {
super.computeScroll();
if(dragHelper.continueSettling(true)){
ViewCompat.postInvalidateOnAnimation(this);
}
}
}
| [
"Administrator@USER-20150805SQ"
] | Administrator@USER-20150805SQ |
e482ceed0345d0607a5f53ec6156bc196d5e6177 | 2e44c71cc759d91f0f89267520d6a97e9588ae92 | /src/main/java/com/teklive/demo/PersonApplication.java | dd8881f9f68c64254e60e0892864fc62c78d9b29 | [] | no_license | mayes21/quarkus-teklive-demo | 88303f509679ef633d81c8e159589e7efa0ff6c8 | 66ec7ec02b016ccbed92cf19bff8ae3eb5e87210 | refs/heads/main | 2023-08-03T22:00:10.605703 | 2021-09-21T08:42:33 | 2021-09-21T08:42:33 | 408,743,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,073 | java | package com.teklive.demo;
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
import io.quarkus.runtime.configuration.ProfileManager;
import org.eclipse.microprofile.openapi.annotations.ExternalDocumentation;
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition;
import org.eclipse.microprofile.openapi.annotations.info.Contact;
import org.eclipse.microprofile.openapi.annotations.info.Info;
import org.jboss.logging.Logger;
import javax.enterprise.event.Observes;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
@OpenAPIDefinition(
info = @Info(title = "Person api",
description = "This API allows to generate random person",
version = "1.0",
contact = @Contact(name = "@amayas", url = "https://twitter.com/amabb21")),
externalDocs = @ExternalDocumentation(url = "https://github.com/mayes21",
description = "Person documentation API"))
public class PersonApplication extends Application {
private static final Logger _log = Logger.getLogger(PersonApplication.class);
void onStart(@Observes StartupEvent startupEvent) {
banner();
_log.info("The application Person is starting with profile [" + ProfileManager.getActiveProfile() + "]");
}
void onStop(@Observes ShutdownEvent shutdownEvent) {
_log.info("The application Person is stopping...");
}
private void banner() {
System.out.println(" .---. ");
System.out.println(" __.....__ . | |.--..----. .----. __.....__ ");
System.out.println(" .-'' '. .'| | ||__| \\ \\ / /.-'' '. ");
System.out.println(" .| / .-''\"'-. `. .' | | |.--. ' '. /' // .-''\"'-. `. ");
System.out.println(" .' |_ / /________\\ \\ | | | || | | |' // /________\\ \\ ");
System.out.println(" .' || | | | ____ | || | | || || | ");
System.out.println("'--. .-'\\ .-------------' | | \\ .' | || | '. `' .'\\ .-------------' ");
System.out.println(" | | \\ '-.____...---. | |/ . | || | \\ / \\ '-.____...---. ");
System.out.println(" | | `. .' | /\\ \\ | ||__| \\ / `. .' ");
System.out.println(" | '.' `''-...... -' | | \\ \'---' '----' `''-...... -' ");
System.out.println(" | / ' \\ \\ \\ ");
System.out.println(" `'-' '------' '---' ");
System.out.println(" ");
}
}
| [
"amayas.abboute@live.fr"
] | amayas.abboute@live.fr |
165e5004b68f4af8b602fc81016d342da771b335 | 29c9e18a600969cb62a1d85f451e3c53b5b9027a | /src/com/ots/dao/UserDao.java | 89ceab2fdc6e550bf0c2c8791101f538e904655d | [] | no_license | tiaotiao97/ots | aef359d50e32ce97d6db46bd9205f44076502209 | b40bafae33cede28294cf9b20b4bac0160ec773d | refs/heads/master | 2020-05-18T08:11:57.895836 | 2019-05-21T13:53:10 | 2019-05-21T13:53:10 | 184,287,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package com.ots.dao;
import com.ots.entity.User;
import org.springframework.stereotype.Repository;
@Repository
public interface UserDao {
public User selectOne(User user);
public Integer insertUser(User user);
}
| [
"1442297162@qq.com"
] | 1442297162@qq.com |
10f1a9e4617334bf17d12b174bb6478b3bbf89c2 | 5ca3901b424539c2cf0d3dda52d8d7ba2ed91773 | /src_fernflower/com/google/protobuf/TextFormat$Parser$Builder.java | fc84c648247626b0429824ea951ca3c0b7c88c17 | [] | no_license | fjh658/bindiff | c98c9c24b0d904be852182ecbf4f81926ce67fb4 | 2a31859b4638404cdc915d7ed6be19937d762743 | refs/heads/master | 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.google.protobuf;
import com.google.protobuf.TextFormat$1;
import com.google.protobuf.TextFormat$Parser;
import com.google.protobuf.TextFormat$Parser$SingularOverwritePolicy;
public class TextFormat$Parser$Builder {
private boolean allowUnknownFields = false;
private TextFormat$Parser$SingularOverwritePolicy singularOverwritePolicy;
public TextFormat$Parser$Builder() {
this.singularOverwritePolicy = TextFormat$Parser$SingularOverwritePolicy.ALLOW_SINGULAR_OVERWRITES;
}
public TextFormat$Parser$Builder setSingularOverwritePolicy(TextFormat$Parser$SingularOverwritePolicy var1) {
this.singularOverwritePolicy = var1;
return this;
}
public TextFormat$Parser build() {
return new TextFormat$Parser(this.allowUnknownFields, this.singularOverwritePolicy, (TextFormat$1)null);
}
}
| [
"manouchehri@riseup.net"
] | manouchehri@riseup.net |
1bf9f7a9edbc2f1e86c8ad7cfbf445cce906301b | 5085fc3955b1c07fbb98916430eb35c8db223d1d | /src/main/java/com/smartweather/server/service/WeatherService.java | 8c4be7e1a50f684931cc0d4bdd9765f9ebd73f12 | [] | no_license | getJv/smartweather_server | cbd8138399fc98c703ab0ec07a6fcb3e6fbd6b0d | 9d9a3d176cee50780ea4c0a8b04fdf3625d79713 | refs/heads/master | 2020-04-15T19:39:52.850362 | 2019-01-25T13:18:17 | 2019-01-25T13:18:17 | 164,959,372 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package com.smartweather.server.service;
import java.util.List;
import com.smartweather.server.repository.WeatherRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smartweather.server.model.WeatherLocation;
@Service
public class WeatherService {
@Autowired
private WeatherRepository repo;
public WeatherService() {
// TODO Auto-generated constructor stub
}
public void save(WeatherLocation data) {
repo.save(data);
}
public List<WeatherLocation> find(String stringSearch) {
return repo.findByNameContainingIgnoreCaseOrderByModifiedDateDesc(stringSearch);
}
}
| [
"jhonatanvinicius@gmail.com"
] | jhonatanvinicius@gmail.com |
a983bb3db35bc592d69460a7c2f9818ce4a2f10a | e6f822c89bd93a5928baf79fb620126190e46ff1 | /RobotArdu/src/test/java/de/fhg/iais/roberta/syntax/codegen/arduino/bob3/Bob3SensorsTest.java | 889eeba00791452aac6d847a791ac5e8b3001bd7 | [
"MIT",
"GPL-3.0-only",
"Apache-2.0"
] | permissive | MatthiasSchmickler/openroberta-lab | f5469b6a82612d48679f52662e207419017f9e57 | e1d2306945ad60670d7dd619b38edd933e4d299d | refs/heads/master | 2020-06-24T03:29:45.957459 | 2019-06-27T13:36:26 | 2019-06-27T13:36:26 | 198,834,046 | 0 | 0 | Apache-2.0 | 2019-07-25T13:11:25 | 2019-07-25T13:11:25 | null | UTF-8 | Java | false | false | 657 | java | package de.fhg.iais.roberta.syntax.codegen.arduino.bob3;
import org.junit.Test;
import de.fhg.iais.roberta.util.test.ardu.HelperBob3ForXmlTest;
public class Bob3SensorsTest {
private final HelperBob3ForXmlTest bob3Helper = new HelperBob3ForXmlTest();
@Test
public void listsTest() throws Exception {
this.bob3Helper.compareExistingAndGeneratedSource("/ast/sensors/bob3_sensors_test.ino", "/ast/sensors/bob3_sensors_test.xml");
}
@Test
public void waitBlockTest() throws Exception {
this.bob3Helper.compareExistingAndGeneratedSource("/ast/sensors/bob3_wait_test.ino", "/ast/sensors/bob3_wait_test.xml");
}
}
| [
"artem.vinokurov@iais.fraunhofer.de"
] | artem.vinokurov@iais.fraunhofer.de |
0fe43e6b7558f700a3865073cc668fc6e88ec033 | 85c855c3a2ec3924075cef496cc8eca3254b28bd | /openaz-xacml-pdp/src/main/java/org/apache/openaz/xacml/pdp/policy/dom/DOMPolicySetIdReference.java | e0dac38e2cb4e8f47e96f1964fd570446e400408 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | dash-/apache-openaz | 340da02d491c617e726b0aa96ae1b62180203c5b | 7ffda51e6b17e8f25b5629dc0f65c8eea8d9df8b | refs/heads/master | 2022-11-30T16:13:38.373969 | 2015-11-30T13:27:14 | 2015-11-30T13:27:14 | 47,570,303 | 0 | 1 | Apache-2.0 | 2022-11-18T23:02:23 | 2015-12-07T18:12:25 | Java | UTF-8 | Java | false | false | 2,859 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.openaz.xacml.pdp.policy.dom;
import org.apache.openaz.xacml.pdp.policy.PolicySet;
import org.apache.openaz.xacml.pdp.policy.PolicySetIdReference;
import org.apache.openaz.xacml.std.StdStatusCode;
import org.apache.openaz.xacml.std.dom.DOMIdReferenceMatch;
import org.apache.openaz.xacml.std.dom.DOMProperties;
import org.apache.openaz.xacml.std.dom.DOMStructureException;
import org.w3c.dom.Node;
/**
* DOMPolicySetIdReference extends {@link org.apache.openaz.xacml.pdp.policy.PolicySetIdReference} with
* methods for creation from DOM {@link org.w3c.dom.Node}s.
*/
public class DOMPolicySetIdReference {
protected DOMPolicySetIdReference() {
}
/**
* Creates a new <code>PolicySetIdReference</code> parsed from the given <code>Node</code> representing a
* XACML PolicySetIdReference element.
*
* @param nodePolicySetIdReference the <code>Node</code> representing the XACML PolicySetIdReference
* element
* @return a new <code>PolicySetIdReference</code> parsed from the given <code>Node</code>
* @throws DOMStructureException if there is an error parsing the <code>Node</code>
*/
public static PolicySetIdReference newInstance(Node nodePolicySetIdReference, PolicySet policySetParent)
throws DOMStructureException {
PolicySetIdReference domPolicySetIdReference = new PolicySetIdReference(policySetParent);
try {
domPolicySetIdReference.setIdReferenceMatch(DOMIdReferenceMatch
.newInstance(nodePolicySetIdReference));
} catch (DOMStructureException ex) {
domPolicySetIdReference.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, ex.getMessage());
if (DOMProperties.throwsExceptions()) {
throw ex;
}
}
return domPolicySetIdReference;
}
public static boolean repair(Node nodePolicySetIdReference) throws DOMStructureException {
return DOMIdReferenceMatch.repair(nodePolicySetIdReference);
}
}
| [
"basic@localhost"
] | basic@localhost |
7c3dd9ea60dea4d418ac8e68de3a41b9a267e76d | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-422-10-5-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/internal/parser/wikimodel/DefaultXWikiGeneratorListener_ESTest_scaffolding.java | 05af1bd0c9d4416f4d630dd5cdafacd703cbbe52 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Sat Apr 04 16:41:43 UTC 2020
*/
package org.xwiki.rendering.internal.parser.wikimodel;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultXWikiGeneratorListener_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
1ccaca2e3d44ba241c8ed38d73dbd781bf5f700b | 6fb0ebe810cf97d5673d508ad2c593d8def7f441 | /src/sql/Database.java | c1f1c4e24749f154859b4216c4097629e111a881 | [] | no_license | rupakrajak/MySQLCLIApp | c2e1a796c6f8aa469445f5892734581abfeb6965 | cf2149b74adf93dc63a6f755813e69ce62de2a00 | refs/heads/master | 2023-02-11T13:04:37.436541 | 2021-01-13T04:46:09 | 2021-01-13T04:46:09 | 329,042,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,905 | java | /**
* @author rupakrajak
*/
package sql;
import java.io.*;
import java.util.*;
import java.util.regex.*;
import java.sql.*;
public class Database {
/**
* Database Driver
*/
private static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
private static final String DB_URL = "jdbc:mysql://localhost:3306/";
private static String database = null;
/**
* Credentials
*/
private static String username = null;
private static String password = null;
/**
* Message color codes
*/
private static final String RESET = "\u001B[0m";
private static final String ERROR = "\u001B[31m";
private static final String SUCCE = "\u001B[32m";
private static final String UNAME = "\u001B[33m";
private static final String MYSQL = "\u001B[34m";
private static final String DBASE = "\u001B[35m";
private static final String HEADR = "\u001B[36m";
/**
* Message symbols
*/
private static final String TICK = "\u2714";
private static final String CROS = "\u2718";
/**
* Parameter extractor regex
*/
private static final String PARAM_REGEX = "(\\'\\$\\{([^\\}\\']+)\\}\\')|(\\$\\{([^\\}]+)\\})";
/**
* Useful variables
*/
private static Connection connection = null;
private static Statement statement = null;
private static PreparedStatement preparedStatement = null;
private static ResultSet resultSet = null;
private static List<String> matches = null;
/**
* Giving an SQL exception, this will print the exception in a formatted way
* @param se this is the SQL exception
*/
private static void printSQLException(SQLException se) {
System.out.println(ERROR + CROS + " ERROR " + RESET + se.getErrorCode() + " (" + se.getSQLState() + "): " + ERROR + se.getMessage() + RESET);
}
/**
* A helper method for method printResultSet() to print row separating lines
* @param colWidth this array consists the width of columns of the current result set
* @param sepType this specifies the line type
*/
private static void printRowSeparator(int[] colWidth, char sepType) {
System.out.print("+");
for (int i = 0; i < colWidth.length; i++) {
int colDisSize = colWidth[i];
for (int j = 0; j < colDisSize + 2; j++) System.out.print(sepType);
System.out.print("+");
}
System.out.println("");
}
/**
* This method prints the result set in a tabular format
*/
private static void printResultSet() {
try {
// extracting the metadata of the result set
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
int colCount = resultSetMetaData.getColumnCount();
// calculating the width of each column
int[] colWidth = new int[colCount];
for (int i = 0; i < colCount; i++) colWidth[i] = resultSetMetaData.getColumnLabel(i + 1).length();
while (resultSet.next()) {
for (int i = 0; i < colCount; i++) {
String colData = resultSet.getString(i + 1);
if (colData != null) colWidth[i] = Math.max(colWidth[i], colData.length());
}
}
// reseting the pointer
resultSet.beforeFirst();
// printing the heading row
printRowSeparator(colWidth, '=');
System.out.print("|");
for (int i = 0; i < colCount; i++) {
String colValue = resultSetMetaData.getColumnLabel(i + 1).toUpperCase();
System.out.print(" " + HEADR + colValue + RESET);
for (int j = 0; j < colWidth[i] - colValue.length() + 1; j++)
System.out.print(" ");
System.out.print("|");
}
System.out.println("");
printRowSeparator(colWidth, '=');
// printing the data rows
int rowCount = 0; // initializing the rowCount
while (resultSet.next()) {
rowCount++;
System.out.print("|");
for (int i = 0; i < colCount; i++) {
String colValue = resultSet.getString(i + 1);
if (colValue == null) colValue = "";
for (int j = 0; j < colWidth[i] - colValue.length() + 1; j++)
System.out.print(" ");
System.out.print(colValue + " |");
}
System.out.println("");
printRowSeparator(colWidth, '-');
}
// printing the SUCCESS message
System.out.println(SUCCE + TICK + " SUCCESS" + RESET + ": " + rowCount + " row(s) in set");
} catch (SQLException se) {
printSQLException(se);
}
}
/**
* This method performs the execution of query
* @param sql this is the sql query string
*/
private static void simpleQuery(String sql) {
try {
statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
boolean status = statement.execute(sql);
if (status) {
resultSet = statement.getResultSet();
printResultSet();
} else {
int affectedRows = statement.getUpdateCount();
System.out.println(SUCCE + TICK + " SUCCESS" + RESET + ": " + affectedRows + " row(s) affected");
}
preparedStatement = null;
matches = null;
resultSet = null;
} catch (SQLException se) {
printSQLException(se);
}
return;
}
/**
* A helper method for method prepareQuery(String sql).
* This checks for the parameter type and takes input accordingly, then sets them.
*/
private static void getParametersAndExecute() {
try {
Console paramReader = System.console();
for (int i = 0; i < matches.size(); i++) {
if (matches.get(i).charAt(0) == '\'') {
String param = paramReader.readLine("Enter the value for " + matches.get(i).substring(3, matches.get(i).length() - 2) + ": ");
preparedStatement.setString(i + 1, param);
} else {
long param = Long.parseLong(paramReader.readLine("Enter the value for " + matches.get(i).substring(2, matches.get(i).length() - 1) + ": "));
preparedStatement.setLong(i + 1, param);
}
}
boolean status = preparedStatement.execute();
if (status) {
resultSet = preparedStatement.getResultSet();
printResultSet();
} else {
int affectedRows = preparedStatement.getUpdateCount();
System.out.println(SUCCE + TICK + " SUCCESS" + RESET + ": " + affectedRows + " row(s) affected");
}
} catch (SQLException se) {
printSQLException(se);
} catch (Exception e) {
System.out.println(ERROR + CROS + " ERROR" + RESET + ":" + ERROR + " Error in setting the values of the parameters. Please check the syntax of the statement." + RESET);
preparedStatement = null;
matches = null;
return;
}
}
/**
* This method performs the execution of prepared query
* @param sql this is the sql query string
*/
private static void prepareQuery(String sql) {
try {
preparedStatement = connection.prepareStatement(sql.replaceAll(PARAM_REGEX, "?"));
// extracting the parameters
Pattern PARAM_REGEX_PATTERN = Pattern.compile(PARAM_REGEX);
Matcher match = PARAM_REGEX_PATTERN.matcher(sql);
matches = new ArrayList<>();
while (match.find()) matches.add(match.group(0));
getParametersAndExecute();
statement = null;
} catch (SQLException se) {
printSQLException(se);
}
return;
}
/**
* This method identifies the query type, i.e., callable or prepared
* @param sql this is the sql query string
*/
private static void identifyQueryAndExecute(String sql) {
if (sql.indexOf('$') == -1) simpleQuery(sql); else prepareQuery(sql);
}
/**
* The main method
* @param args system args
*/
public static void main(String[] args) throws Exception {
try {
Console console = System.console();
username = console.readLine("Username: ");
password = new String(console.readPassword("Password: "));
try {
Class.forName(JDBC_DRIVER);
connection = DriverManager.getConnection(DB_URL, username, password);
} catch (ClassNotFoundException e) {
System.out.println(ERROR + "JDBC Driver not found!" + RESET);
} catch (SQLException se) {
System.out.println(ERROR + "Couldn't connect to the database!" + RESET);
printSQLException(se);
}
if (connection == null) return;
String s = "";
try {
while (true) {
ResultSet rs = connection.createStatement().executeQuery("SELECT DATABASE()");
rs.next();
database = rs.getString(1);
s = console.readLine(UNAME + username + RESET + "@" + MYSQL + "mysql" + RESET + ((database == null) ? "" : "::" + DBASE + database + RESET) + "> ").trim();
if (s.equals("exit")) {
connection.close();
return;
}
if (s.equals("/")) {
if (preparedStatement != null) getParametersAndExecute();
else continue;
} else if (s != null && !s.equals("")) identifyQueryAndExecute(s);
else continue;
}
} catch (SQLException se) {
printSQLException(se);
connection.close();
return;
}
} catch (Exception e) {
System.out.println("\n" + ERROR + CROS + " ERROR" + RESET + ":" + ERROR + " Some internal error occurred. Terminating the application." + RESET);
connection.close();
return;
}
}
} | [
"rajakrupak0@gmail.com"
] | rajakrupak0@gmail.com |
ac52e50ee08d7051b394298881a0b91524c1fe78 | 7f44611a259b60c6edb05b48ae78c5d05e363e15 | /Apple_iFruite_Store/src/main/java/project/tag/HiddenInputs.java | 73f1db12242c0b41cc8773dc964dbc1e5c517ffd | [] | no_license | NikolkoMisha/WebStore | 4140bca53c98e3fed2c928f9304b848b854f870f | d5429e59c30fcac0037497fcfd9cbc9b737ebf7b | refs/heads/master | 2020-05-09T14:08:24.728291 | 2019-04-13T14:33:45 | 2019-04-13T14:33:45 | 181,183,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package project.tag;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
public class HiddenInputs extends SimpleTagSupport{
private final StringWriter sw = new StringWriter();
private List<String> excludes = new ArrayList<>();
@Override
public void doTag() throws JspException, IOException {
JspWriter out = getJspContext().getOut();
PageContext pageContext = (PageContext) getJspContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
Map<String, String[]> map = request.getParameterMap();
for(Entry<String, String[]> entry : map.entrySet()){
if(!excludes.contains(entry.getKey())){
for(String value : entry.getValue()){
sw.append("<input type='hidden' ");
sw.append("name='");
sw.append(entry.getKey());
sw.append("' value='");
sw.append(value);
sw.append("'>");
}
}
}
out.println(sw.toString());
}
public void setExcludeParams(String excludeParams){
StringTokenizer tokenizer = new StringTokenizer(excludeParams, ", ");
while(tokenizer.hasMoreTokens()){
excludes.add(tokenizer.nextToken());
}
}
} | [
"mishna9_10@ukr.net"
] | mishna9_10@ukr.net |
c95270d586723c82fddc0acaffedcc6d62d3818b | 0dc06e5cc1b49a092245f5caf9ab6ee573b727ec | /Xideo/src/no/sumo/api/vo/asset/RestPlatformPublishInfo.java | 9fedfa7669b87267fed2e6d471be2f83ca6c1ea0 | [] | no_license | sandeeptiku2012/ComcastRobotium | d64122d1aa89ba5d19cd2574e07053a933c9a1bb | f9f5d061ba4b09d54ff294aaad346044823c29b5 | refs/heads/master | 2016-09-06T05:43:03.717164 | 2014-01-06T12:56:49 | 2014-01-06T12:56:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,106 | java | package no.sumo.api.vo.asset;
import java.util.Date;
import no.sumo.api.contracts.IPlatformPublishInfo;
import no.sumo.api.vo.RestObject;
import org.simpleframework.xml.Default;
import org.simpleframework.xml.DefaultType;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Transient;
@Root( name = "publishing" )
@Default( DefaultType.FIELD )
public class RestPlatformPublishInfo extends RestObject implements IPlatformPublishInfo {
@Transient
private Long id;
@Transient
private Integer platformId;
@Transient
private Long assetId;
@Element( name = "platform" )
private String platformName;
@Element( name = "live" )
private Boolean livePublished;
@Element( name = "onDemand" )
private Boolean onDemandPublished;
public static final Date DATE_EMPTY = new Date( 0L );
@Element( name = "expire", required = true )
private Date expire = null;
@Element( name = "publish", required = true )
private Date publish = null;
public Long getId() {
return id;
}
public void setId( Long id ) {
this.id = id;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId( Integer platformId ) {
this.platformId = platformId;
}
public Boolean getLivePublished() {
return livePublished;
}
public void setLivePublished( Boolean livePublished ) {
this.livePublished = livePublished;
}
public Boolean getOnDemandPublished() {
return onDemandPublished;
}
public void setOnDemandPublished( Boolean onDemandPublished ) {
this.onDemandPublished = onDemandPublished;
}
public Date getExpire() {
return expire;
}
public void setExpire( Date expire ) {
this.expire = expire;
}
public Date getPublish() {
return publish;
}
public void setPublish( Date publish ) {
this.publish = publish;
}
public Long getAssetId() {
return assetId;
}
public void setAssetId( Long assetId ) {
this.assetId = assetId;
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName( String platformName ) {
this.platformName = platformName;
}
}
| [
"manju1375@gmail.com"
] | manju1375@gmail.com |
29b1f52415d462f68ec601bf2b99257ae633d746 | 4aed66ad4fb140f5823e748cae8fd71ac402cf67 | /src/main/java/com/xiaoshabao/wechat/service/impl/WechatUserServiceImpl.java | 36f3ceafb7d29cf69881daf45e21581c65bc6fdf | [] | no_license | manxx5521/shabao-test | f4236cd0da3f3a5944a28d08f58d090be64329ca | 3cd8b95ed401feb20d759f31618b27bb4669ad7e | refs/heads/master | 2020-04-12T03:57:41.256135 | 2019-01-15T06:37:46 | 2019-01-15T06:37:46 | 60,821,316 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,016 | java | package com.xiaoshabao.wechat.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xiaoshabao.baseframework.exception.ServiceException;
import com.xiaoshabao.baseframework.service.impl.AbstractServiceImpl;
import com.xiaoshabao.system.component.ContextHolderSystem;
import com.xiaoshabao.system.entity.SessionUserInfo;
import com.xiaoshabao.webframework.dto.AjaxResult;
import com.xiaoshabao.wechat.api.wxuser.UserAPI;
import com.xiaoshabao.wechat.api.wxuser.result.UserOpenIDList;
import com.xiaoshabao.wechat.component.TokenManager;
import com.xiaoshabao.wechat.dao.SubscriberDao;
import com.xiaoshabao.wechat.dto.WechatUserDto;
import com.xiaoshabao.wechat.entity.SubscriberEntity;
import com.xiaoshabao.wechat.service.WechatUserService;
/**
* 微信用户
*/
@Service("wechatUserServiceImpl")
public class WechatUserServiceImpl extends AbstractServiceImpl implements WechatUserService{
@Autowired
private SubscriberDao subscriberDao;
@Resource(name="tokenManager")
private TokenManager tokenManager;
//获得用户列表
@Override
public List<WechatUserDto> getList(Integer accountId) {
SessionUserInfo sessionInfo=ContextHolderSystem.getSeesionInfo();
String priFrame=sessionInfo.getPriFrame();
List<WechatUserDto> list=subscriberDao.getUserList(priFrame,accountId);
return list;
}
//同步用户
@Override
@Transactional
public AjaxResult syncUser(Integer accountId) {
String accessToken =tokenManager.getAccessToken(accountId).getAccessToken();
UserOpenIDList result=UserAPI.getUserOpenIdList(accessToken);
List<String> openidList=result.getOpenidList();
SubscriberEntity user=new SubscriberEntity();
user.setAccountId(accountId);
user.setType(1);
int i=0;
String lastOpenid="";
if(!openidList.isEmpty()&&openidList.size()>0){
for(String openid:openidList){
user.setOpenid(openid);
SubscriberEntity subscriberEntity=subscriberDao.getSubscriberById(openid);
if(subscriberEntity==null){
i=subscriberDao.insert(user);
if(i<1){
throw new ServiceException("数据更新失败");
}
lastOpenid=openid;
}
}
}
int total=result.getTotal();
int count=result.getCount();
while(total>count){
result=UserAPI.getUserOpenIdList(accessToken,lastOpenid);
if(!openidList.isEmpty()&&openidList.size()>0){
for(String openid:openidList){
user.setOpenid(openid);
SubscriberEntity subscriberEntity=subscriberDao.getSubscriberById(openid);
if(subscriberEntity==null){
i=subscriberDao.insert(user);
if(i<1){
throw new ServiceException("数据更新失败");
}
lastOpenid=openid;
}
}
}
count=count+result.getCount();
}
return new AjaxResult(true, "同步成功");
}
}
| [
"manxx5521@163.com"
] | manxx5521@163.com |
eb4854c77491b48c6c70b09d3c37c238b6aee828 | b939de78b3e00b79dc581031bd41ac02e12ea29a | /src/main/java/com/security/project/web/service/UserService.java | 6bbf07e0d50550176c932ca62849dfc3760544d7 | [] | no_license | autronius/SpringSecurity | 237267221c89f8d14b983a9b44573747128b5550 | f908b8ee50601ba883095f8ea5006d8d7cacfb93 | refs/heads/master | 2016-08-12T02:49:51.510467 | 2016-01-28T02:43:52 | 2016-01-28T02:43:52 | 49,114,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package com.security.project.web.service;
import com.security.project.web.service.domain.CustomUser;
public interface UserService {
public CustomUser findUserByEmail(String email);
public int createRegularUser(CustomUser user);
public int createSuperUser(CustomUser user);
}
| [
"Andrew@Radford.IO"
] | Andrew@Radford.IO |
6c0a61da1d8d2edff95789baf38af614068d7ca2 | 3f82fadc4c8f5da17a75ef4e1f02fb54bc114c73 | /src/main/java/com/raepheles/kou/starwars/characters/Stormtrooper.java | 92c2e06e769687a93b9bac6207723c16cf736f0e | [] | no_license | Raepheles/starwars-game | d2a60e619248c5a93049b0baac3a711e7eef828c | f66833d87fb6eee39087bb02277ee650665d65fc | refs/heads/master | 2020-05-07T10:30:30.518067 | 2019-04-09T17:57:42 | 2019-04-09T17:57:42 | 180,420,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 162 | java | package com.raepheles.kou.starwars.characters;
public class Stormtrooper extends Character {
public Stormtrooper() {
super("Stormtrooper");
}
}
| [
"raepheles@yahoo.com"
] | raepheles@yahoo.com |
49dcfc97b452902617ff18a2bd06208dc02d6f30 | 94fdda665676ac3b2e15c7b199b2de78bb793e02 | /src/main/java/reservation/entity/Client.java | df4966a0acc576d3d9cc57fef9eab7b9fc6a1460 | [] | no_license | sneybe/reservationspringmvc | 3b44e767c9ca9194340c95f43b27bb24e196f398 | 3daf194724580a45af9e9d77fc542677164b80a8 | refs/heads/master | 2021-01-22T12:26:05.246923 | 2017-06-01T15:23:55 | 2017-06-01T15:23:55 | 92,725,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,457 | 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 reservation.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
/**
*
* @author formation
*/
@Entity
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String nom;
private String prenom;
@Embedded
private Adresse adresse;
@OneToMany(mappedBy = "client")
private List<Reservation>reservations=new ArrayList();
public String getNom() {
return nom;
}
public List<Reservation> getReservations() {
return reservations;
}
public void setReservations(List<Reservation> reservations) {
this.reservations = reservations;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getPrenom() {
return prenom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public Adresse getAdresse() {
return adresse;
}
public void setAdresse(Adresse adresse) {
this.adresse = adresse;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Client)) {
return false;
}
Client other = (Client) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "reservation.entity.Client[ id=" + id + " ]";
}
}
| [
"Administrateur@FORMATI-G0D4BQD.formation.at"
] | Administrateur@FORMATI-G0D4BQD.formation.at |
c56e8d08bb7bc7fb393654afc29dfbd4f63f6973 | 7fbbd237f08f7575b7f735164a866bfe74fe631f | /src/main/java/com/mycompany/portfolio_tracker/controller/AbstractController.java | d1dc8070364c54e361e4f0567e37a733379239a3 | [] | no_license | colinbut/portfolio-tracker | e1c039fc797b5ef36c9e1c3950cba00955f5a109 | 513ad7b9e82a69d278585798c2ad8eac029376ac | refs/heads/master | 2021-05-04T11:11:13.946955 | 2017-10-08T10:09:22 | 2017-10-08T10:09:22 | 36,391,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | /*
* |-------------------------------------------------
* | Copyright © 2008 Colin But. All rights reserved.
* |-------------------------------------------------
*/
package com.mycompany.portfolio_tracker.controller;
import com.mycompany.portfolio_tracker.model.Quote;
import com.mycompany.portfolio_tracker.view.MainWindow;
import com.mycompany.portfolio_tracker.view.components.MyTableView;
/**
* AbstractController class
*
* Common controller containing common resources
*
* @author colin
*
*/
public class AbstractController {
protected MainWindow gui; //view
private MyTableView ft; //Table View --> get model from there
protected Quote quote;
/**
* Returns the current selection table
*
* @return MyTableView
*/
public MyTableView getCurrentSelectionTable(){
ft = (MyTableView)gui.getTabs().getSelectedComponent();
return ft;
}
}
| [
"colinbut@users.noreply.github.com"
] | colinbut@users.noreply.github.com |
69e7ab9f72e8a5a2f9ec3cdb5cd176f4f50bf27d | 9f1f5d38a86b76b3f73523956a6e5125bd8954e0 | /LeetCode/medium/127.WordLadder/WordLadder.java | 0ecee968a6988ea2ba834d28d6d4fe3da60a2e2b | [] | no_license | nwulqx/Algorithm | 61f102b47042d03fa433046296f1646c1a840a4b | 752146a451346ac7f4eead81e74630022eb67b9a | refs/heads/master | 2023-03-01T15:10:47.016155 | 2021-01-28T14:15:28 | 2021-01-28T14:15:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | import java.util.*;
public class WordLadder{
public static void main(String []args){
Set<String> set = new HashSet<String>();
set.add("hot");
set.add("dot");
set.add("dog");
set.add("lot");
set.add("log");
System.out.println(ladderLength(new String("hit"),new String("cog"),set));
}
public static int ladderLength(String beginWord, String endWord, Set<String> wordList) {
int len = 1;
Set<String> beginSet = new HashSet<String>(),endSet = new HashSet<String>();
Set<String> visted = new HashSet<String>();
beginSet.add(beginWord);
endSet.add(endWord);
while(!beginSet.isEmpty() && !endSet.isEmpty()){
if(beginSet.size()>endSet.size()){
Set<String> tmp = beginSet;
beginSet = endSet;
endSet = tmp;
}
Set<String> temp = new HashSet<String>();
for(String word : beginSet){
char []chs = word.toCharArray();
for(int i=0;i<chs.length;i++){
for(char c='a';c<='z';c++){
char old = chs[i];
chs[i] = c;
String target = String.valueOf(chs);
if(endSet.contains(target)){
return len+1;
}
if(!visted.contains(target) && wordList.contains(target)){
temp.add(target);
visted.add(target);
}
chs[i] = old;
}
}
}
beginSet = temp;
len++;
}
return 0;
}
} | [
"471867085@qq.com"
] | 471867085@qq.com |
45582d89fe87be1c53aea1c1f06f17dc1ba15bce | 3df27b037c878b7d980b5c068d3663682c09b0b3 | /src/com/wfzcx/ppms/synthesize/expert/dao/impl/ProAssociationDaoImpl.java | 113871caecb9bae8d430214a2cf9a0c9b680fc43 | [] | no_license | shinow/tjec | 82fbd67886bc1f60c63af3e6054d1e4c16df2a0d | 0b2f4de2eda13acf351dfc04faceea508c9dd4b0 | refs/heads/master | 2021-09-24T15:45:42.212349 | 2018-10-11T06:13:55 | 2018-10-11T06:13:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package com.wfzcx.ppms.synthesize.expert.dao.impl;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;
import com.jbf.common.dao.impl.GenericDao;
import com.wfzcx.ppms.synthesize.expert.dao.ProAssociationDaoI;
import com.wfzcx.ppms.synthesize.expert.po.ProAssociation;
@Scope("prototype")
@Repository
public class ProAssociationDaoImpl extends GenericDao<ProAssociation, Integer> implements ProAssociationDaoI {
}
| [
"lin521lh"
] | lin521lh |
6efd5a13409e48c2f450a7e071b6c686a55b791f | dc8e8c9db3aec667b656c2755ea97af277b29c17 | /computer-database-core/src/main/java/core/Company.java | c3f1dea908aab70baee32144aa320e60faf66af8 | [] | no_license | dkrache/computerDatabase | b0dc92ccb66754e0b358219521e9fdfce7de8315 | 1e1d4ff1b7a74ae131c16002d150238481a9057f | refs/heads/master | 2021-01-19T12:36:28.328920 | 2014-11-05T17:08:57 | 2014-11-06T10:41:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,402 | java | package core;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
/**
*
* @author excilys
*
*/
@Entity(name = "company")
@Table(name = "company")
public class Company {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name = "name")
private String name;
/**
* @return the id
*/
@XmlElement(name = "id")
public long getId() {
return id;
}
/**
* @return the name
*/
@XmlElement(name = "name")
public String getName() {
return name;
}
/**
* @param id the id to set
*/
public void setId(final long id) {
this.id = id;
}
/**
* @param name the name to set
*/
public void setName(final String name) {
this.name = name;
}
public static Builder builder(final String name) {
return new Builder(name);
}
//BUILDER
public static final class Builder {
private transient Company company;
private Builder(final String name) {
company = new Company();
company.name = name;
}
public Builder id(final long id) {
company.id = id;
return this;
}
public Company build() {
return company;
}
}
}
| [
"dkrache@excilys.com"
] | dkrache@excilys.com |
8d32134159118c743a333359653e4be013a7f05c | 7893c1e225d2de3eadbfc98ab0720cde57338cc2 | /src/main/java/robomuss/rc/track/TrackTypeSlopeUp.java | e8ad57324743706430d86a5617960208f2549484 | [] | no_license | RollercoasterTeam/Rollercoaster | c8c6c49090251bd9a679c43b8ebdcd312f121218 | e351051208365b0b42d1ecd0b8e58639bcc05824 | refs/heads/master | 2021-01-23T05:39:28.224133 | 2015-07-19T17:14:59 | 2015-07-19T17:14:59 | 23,036,736 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,636 | java | package robomuss.rc.track;
import net.minecraft.client.model.ModelBase;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import robomuss.rc.block.te.TileEntityTrack;
import robomuss.rc.entity.EntityTrainDefault;
import robomuss.rc.rollercoaster.RollercoasterType;
import robomuss.rc.util.IInventoryRenderSettings;
public class TrackTypeSlopeUp extends TrackType implements IInventoryRenderSettings {
public TrackTypeSlopeUp(String unlocalized_name, int crafting_cost) {
super(unlocalized_name, crafting_cost);
}
@Override
public void render(RollercoasterType type, TileEntityTrack te) {
rotate(te);
ModelBase model = type.getStandardModel();
GL11.glRotatef(45f, 0f, 0f, 1f);
model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPushMatrix();
GL11.glRotatef(-45f, 0f, 0f, 1f);
model.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
@Override
public AxisAlignedBB getRenderBoundingBox(World world, int xCoord, int yCoord, int zCoord) {
return AxisAlignedBB.getBoundingBox(xCoord - 1, yCoord, zCoord - 1, xCoord + 2, yCoord + 2, zCoord + 2);
}
@Override
public void moveTrain(TileEntityTrack te, EntityTrainDefault entity) {
if(te.direction == 0) {
if(entity.direction == 0) {
entity.posZ += 1f;
entity.rotationPitch = 45f;
entity.posY += 1f;
}
if(entity.direction == 2) {
entity.posZ -= 1f;
entity.rotationPitch = 0f;
}
}
if(te.direction == 1) {
if(entity.direction == 1) {
entity.posX += 1f;
entity.rotationPitch = 0f;
}
if(entity.direction == 3) {
entity.posX -= 1f;
entity.rotationPitch = 45f;
entity.posY += 1f;
}
}
if(te.direction == 2) {
if(entity.direction == 2) {
entity.posZ -= 1f;
entity.rotationPitch = 45f;
entity.posY += 1f;
}
if(entity.direction == 0) {
entity.posZ += 1f;
entity.rotationPitch = 0f;
}
}
if(te.direction == 3) {
if(entity.direction == 1) {
entity.posX += 1f;
entity.rotationPitch = 45f;
entity.posY += 1f;
}
if(entity.direction == 3) {
entity.posX -= 1f;
entity.rotationPitch = 0f;
}
}
}
@Override
public float getInventoryX() {
return 0.3f;
}
@Override
public float getInventoryY() {
return 0.55f;
}
@Override
public float getInventoryZ() {
return 0;
}
@Override
public float getInventoryScale() {
return 0.9f;
}
@Override
public float getInventoryRotation() {
return 180f;
}
@Override
public boolean useIcon() {
return false;
}
}
| [
"km.github@gmail.com"
] | km.github@gmail.com |
1eeed57041dbf3faebe1651cccb0a97d5353ad5b | 5622d518bac15a05590055a147628a728ca19b23 | /jcore-xmi-splitter/src/test/java/de/julielab/jcore/types/ValueMention.java | f1bdae61f361b5619346677ed3d4df8a4663ded8 | [
"BSD-2-Clause"
] | permissive | JULIELab/jcore-dependencies | e51349ccf6f26c7b7dab777a9e6baacd7068b853 | a303c6a067add1f4b05c4d2fe31c1d81ecaa7073 | refs/heads/master | 2023-03-19T20:26:55.083193 | 2023-03-09T20:32:13 | 2023-03-09T20:32:13 | 44,806,492 | 4 | 2 | BSD-2-Clause | 2022-11-16T19:48:08 | 2015-10-23T10:32:10 | Java | UTF-8 | Java | false | false | 1,907 | java |
/* First created by JCasGen Tue Sep 03 12:34:17 CEST 2019 */
package de.julielab.jcore.types;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
/**
* Updated by JCasGen Tue Sep 03 12:34:17 CEST 2019
* XML source: all-test-types.xml
* @generated */
public class ValueMention extends ConceptMention {
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int typeIndexID = JCasRegistry.register(ValueMention.class);
/** @generated
* @ordered
*/
@SuppressWarnings ("hiding")
public final static int type = typeIndexID;
/** @generated
* @return index of the type
*/
@Override
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected ValueMention() {/* intentionally empty block */}
/** Internal - constructor used by generator
* @generated
* @param addr low level Feature Structure reference
* @param type the type of this Feature Structure
*/
public ValueMention(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
*/
public ValueMention(JCas jcas) {
super(jcas);
readObject();
}
/** @generated
* @param jcas JCas to which this Feature Structure belongs
* @param begin offset to the begin spot in the SofA
* @param end offset to the end spot in the SofA
*/
public ValueMention(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/**
* <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
*
* @generated modifiable
*/
private void readObject() {/*default - does nothing empty block */}
}
| [
"chew@gmx.net"
] | chew@gmx.net |
06fdfba9ee802b5a17dc8869b9a0c4b7c5e395d2 | f6899a2cf1c10a724632bbb2ccffb7283c77a5ff | /glassfish/deployment/common/src/main/java/com/sun/enterprise/deploy/shared/AbstractArchiveHandler.java | 798a18987a4c13ae01d4fdfa43220f51791450dc | [] | no_license | Appdynamics/OSS | a8903058e29f4783e34119a4d87639f508a63692 | 1e112f8854a25b3ecf337cad6eccf7c85e732525 | refs/heads/master | 2023-07-22T03:34:54.770481 | 2021-10-28T07:01:57 | 2021-10-28T07:01:57 | 19,390,624 | 2 | 13 | null | 2023-07-08T02:26:33 | 2014-05-02T22:42:20 | null | UTF-8 | Java | false | false | 4,243 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008-2011 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package com.sun.enterprise.deploy.shared;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.net.URI;
import org.glassfish.api.deployment.archive.ReadableArchive;
import org.glassfish.api.deployment.DeploymentContext;
import org.glassfish.deployment.common.DeploymentUtils;
import java.io.IOException;
import java.util.jar.Manifest;
import java.util.List;
import java.util.ArrayList;
import java.util.logging.Logger;
import java.util.logging.Level;
import java.net.URL;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLResolver;
import com.sun.logging.LogDomains;
import org.glassfish.internal.deployment.GenericHandler;
/**
* Common methods for ArchiveHandler implementations
*
* @author Jerome Dochez
*/
public abstract class AbstractArchiveHandler extends GenericHandler {
static final protected Logger _logger = LogDomains.getLogger(DeploymentUtils.class, LogDomains.DPL_LOGGER);
private static XMLInputFactory xmlInputFactory;
static {
xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
// set an zero-byte XMLResolver as IBM JDK does not take SUPPORT_DTD=false
// unless there is a jvm option com.ibm.xml.xlxp.support.dtd.compat.mode=false
xmlInputFactory.setXMLResolver(new XMLResolver() {
@Override
public Object resolveEntity(String publicID,
String systemID, String baseURI, String namespace)
throws XMLStreamException {
return new ByteArrayInputStream(new byte[0]);
}
});
}
public List<URL> getManifestLibraries(DeploymentContext context) {
try {
Manifest manifest = getManifest(context.getSource());
return DeploymentUtils.getManifestLibraries(context, manifest);
}catch (IOException ioe) {
_logger.log(Level.WARNING,
"Exception while getting manifest classpath: ", ioe);
return new ArrayList<URL>();
}
}
protected static XMLInputFactory getXMLInputFactory() {
return xmlInputFactory;
}
}
| [
"srini@appdynamics.com"
] | srini@appdynamics.com |
71fab8867f1e2d62e5acc7430b83013222b6787b | ed2439ff94d9f60dc41964d623e28407bf1b474e | /src/main/java/com/ourslook/guower/service/impl/score/InfExchangeRecordServiceImpl.java | 88f2c7ee149480713a5833df35f1f9d42b568fc5 | [] | no_license | gittgo/guower | 6bd87dc03070c982f1ffd9f926790617d382cd8b | afc93b982fc880987e67e84bc34004dd321fd595 | refs/heads/master | 2022-09-07T07:03:53.814579 | 2020-05-06T22:26:52 | 2020-05-06T22:26:52 | 195,541,320 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,519 | java | package com.ourslook.guower.service.impl.score;
import com.ourslook.guower.dao.score.InfCurrencyDao;
import com.ourslook.guower.dao.score.InfExchangeRecordDao;
import com.ourslook.guower.dao.score.InfScoreUsedDao;
import com.ourslook.guower.dao.user.UserDao;
import com.ourslook.guower.entity.score.InfCurrencyEntity;
import com.ourslook.guower.entity.score.InfExchangeRecordEntity;
import com.ourslook.guower.entity.score.InfScoreUsedEntity;
import com.ourslook.guower.entity.user.UserEntity;
import com.ourslook.guower.service.score.InfCurrencyService;
import com.ourslook.guower.service.score.InfExchangeRecordService;
import com.ourslook.guower.service.user.UserService;
import com.ourslook.guower.utils.*;
import com.ourslook.guower.utils.beanmapper.BeanMapper;
import com.ourslook.guower.utils.office.csvexports.CsvExportor;
import com.ourslook.guower.utils.office.excelutils.ExcelColumCellInterface;
import com.ourslook.guower.utils.office.excelutils.ExcelColumn;
import com.ourslook.guower.utils.office.excelutils.ExcelHead;
import com.ourslook.guower.utils.office.excelutils.ExcelHelper;
import com.ourslook.guower.vo.score.InfExchangeRecordVo;
import org.apache.poi.ss.usermodel.CellType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.*;
@Transactional
@Service("infExchangeRecordService")
public class InfExchangeRecordServiceImpl implements InfExchangeRecordService {
private Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private InfExchangeRecordDao infExchangeRecordDao;
@Resource
private BeanMapper beanMapper;
@Resource
private CsvExportor csvExportor;
@Resource
private MessageSource messageSource;
@Autowired
private InfCurrencyService currencyService;
@Autowired
private UserService userService;
@Autowired
private UserDao userDao;
@Autowired
private InfScoreUsedDao infScoreUsedDao;
@Autowired
private InfCurrencyDao infCurrencyDao;
/**
* 兑换货币(生成兑换记录,更新用户积分,生成积分使用记录,更新货币库存)
* @param infExchangeRecordEntity 兑换记录实体类,请自行检查
*/
@Override
public void exchangeCurrency(InfExchangeRecordEntity infExchangeRecordEntity) {
//保存兑换记录
save(infExchangeRecordEntity);
//更新用户积分
UserEntity userEntity = userDao.queryObject(infExchangeRecordEntity.getUserId());
userEntity.setScore(userEntity.getScore()-infExchangeRecordEntity.getScore());
userDao.update(userEntity);
//生成积分使用记录
InfScoreUsedEntity infScoreUsedEntity = new InfScoreUsedEntity();
infScoreUsedEntity.setUserId(infExchangeRecordEntity.getUserId());
infScoreUsedEntity.setScoreChange(-infExchangeRecordEntity.getScore());
infScoreUsedEntity.setChangeType(0);
infScoreUsedEntity.setCreateDate(LocalDateTime.now());
infScoreUsedEntity.setChangeNote("兑换货币");
infScoreUsedDao.save(infScoreUsedEntity);
//更新货币库存
InfCurrencyEntity infCurrencyEntity = infCurrencyDao.queryObject(infExchangeRecordEntity.getCurrencyId());
infCurrencyEntity.setCount(infCurrencyEntity.getCount()-1);
infCurrencyDao.update(infCurrencyEntity);
}
/**
* 发放货币
*/
@Override
public void grant(Map<String, Object> map) {
infExchangeRecordDao.grant(map);
}
@Override
public List<InfExchangeRecordVo> queryVoList(Map<String, Object> map) {
return infExchangeRecordDao.queryVoList(map);
}
@Override
public InfExchangeRecordEntity queryObject(Integer id) {
return infExchangeRecordDao.queryObject(id);
}
@Override
public List<InfExchangeRecordEntity> queryList(Map<String, Object> map) {
return infExchangeRecordDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return infExchangeRecordDao.queryTotal(map);
}
@Override
public void save(InfExchangeRecordEntity infExchangeRecord) {
infExchangeRecordDao.save(infExchangeRecord);
}
@Override
public void multiOperate(List<String> modelIds, Integer status) {
if (XaUtils.isNotEmpty(modelIds)) {
status = status == null ? Constant.Status.delete : status;
Query query = new Query();
query.put("id_IN", modelIds);
List<InfExchangeRecordEntity> entities = infExchangeRecordDao.queryList(query);
for (int i = 0, count = entities.size(); i < count; ++i) {
InfExchangeRecordEntity entity = entities.get(i);
entity.setState(status);
infExchangeRecordDao.update(entity);
}
}
}
@Override
public void update(InfExchangeRecordEntity infExchangeRecord) {
Objects.requireNonNull(infExchangeRecord);
final InfExchangeRecordEntity dest = new InfExchangeRecordEntity();
Optional.ofNullable(infExchangeRecord.getId()).ifPresent(aInteger -> {
InfExchangeRecordEntity dests = Optional.ofNullable(infExchangeRecordDao.queryObject(aInteger)).orElse(dest);
beanMapper.copy(infExchangeRecord, dests);
infExchangeRecordDao.update(dests);
});
}
@Override
public void delete(Integer id) {
infExchangeRecordDao.delete(id);
}
@Override
public void deleteBatch(Integer[] ids) {
infExchangeRecordDao.deleteBatch(ids);
}
/**
* 导出成为excel
* <p>
* 导出数据不正确的几种情况分析
* 1:要检查CellType是否使用正确,如要显示字符串您确使用 CellType.NUMERIC
* 2:去确定转换函数(excelColumnsConvertMap)的泛型,如数据是整数Map<Integer,String>您确使用了Map<String,String>
*/
@Override
@SuppressWarnings("all")
public void exportsToExcels(List<InfExchangeRecordEntity> vos, HttpServletRequest request, HttpServletResponse response, boolean isCvs) throws Exception {
//excel结构
List<ExcelColumn> excelColumns = new ArrayList<>();
excelColumns.add(new ExcelColumn(excelColumns.size(), "id", "编号", CellType.NUMERIC));
excelColumns.add(new ExcelColumn(excelColumns.size(), "userId", "用户id", CellType.NUMERIC));
excelColumns.add(new ExcelColumn(excelColumns.size(), "currencyId", "货币id", CellType.NUMERIC));
excelColumns.add(new ExcelColumn(excelColumns.size(), "score", "消耗积分", CellType.NUMERIC));
excelColumns.add(new ExcelColumn(excelColumns.size(), "createDate", "创建时间", CellType.STRING));
excelColumns.add(new ExcelColumn(excelColumns.size(), "purseAddress", "钱包地址", CellType.NUMERIC));
excelColumns.add(new ExcelColumn(excelColumns.size(), "sysUserId", "操作人", CellType.STRING));
excelColumns.add(new ExcelColumn(excelColumns.size(), "state", "状态【1.兑换中 2.已完成】", CellType.NUMERIC));
// 需要特殊转换的单元 map的可以必须好实体的类型一致
// 一下excelColumnsConvertMap 转换的根据实际情况使用,这里是示例
Map<String, Map> excelColumnsConvertMap = new HashMap<>();
Map<String, String> isReceive1 = new HashMap<>();
/**
* {@link Constant.OrderStatus}
*/
/*
isReceive1.put("0", "未支付");
isReceive1.put("1", "已支付");
isReceive1.put("2", "待收货");
isReceive1.put("3", "已经消费/已经收货");
isReceive1.put("4", "交易完成");
isReceive1.put("5", "交易关闭");
excelColumnsConvertMap.put("orderState", isReceive1);*/
/**
* {@link Constant.PayType}
*/
/*Map<Integer, String> isReceive2 = new HashMap<>();
try {
Map<Integer, String> map = ReflectUtils.covetConstaintClassToMap(Constant.PayType.class);
isReceive2.putAll(map);
excelColumnsConvertMap.put("paymentKind", isReceive2);
} catch (Exception e) {
e.printStackTrace();
throw new RRException(e.getLocalizedMessage());
}*/
//转换函数
Map<String, ExcelColumCellInterface> excelColumnsConvertFunMap = new HashMap<>();
//excelColumnsConvertFunMap.put("orderState", new ExcelHead.ExcelColumCellDate());
//excelColumnsConvertFunMap.put("clearingmoney", new ExcelHead.ExcelColumCellBigDecimal("元"));
//class类型抓换函数
//Map<Class, ExcelColumCellInterface> columnsTypeConvertFunMap = new HashMap<>();
//columnsTypeConvertFunMap.put(LocalDateTime.class, new ExcelHead.ExcelColumCellLocalDateTime());
//设置头部
ExcelHead head = new ExcelHead();
head.setRowCount(1); // 模板中头部所占行数
head.setColumns(excelColumns); // 列的定义
head.setColumnsConvertMap(excelColumnsConvertMap); // 列的转换byMap
head.setColumnsConvertFunMap(excelColumnsConvertFunMap); // 列的转换by 接口方法
//执行导出,第一个null是response参数,用来输出到浏览器,第二个null是要导出的数据集合
if (isCvs) {
ExcelHelper.getInstanse().exportCsvFile(csvExportor, request, response, head, vos,
"兑换记录表-" + DateUtils.parseDateTime(new Date(), DateUtils.YYYYMMDDHHMMSSCn));
} else {
ExcelHelper.getInstanse().exportExcelFile(request, response, head, vos,
"兑换记录表-" + DateUtils.parseDateTime(new Date(), DateUtils.YYYYMMDDHHMMSSCn));
}
}
@Override
public void saveExchangeRecord(InfExchangeRecordEntity exchangeRecordEntity) {
InfCurrencyEntity currencyEntity = currencyService.queryObject(exchangeRecordEntity.getCurrencyId());
if (XaUtils.isEmpty(currencyEntity)) {
throw new RRException("兑换失败,没有找到该货币信息");
}
UserEntity userEntity = userService.queryObject(exchangeRecordEntity.getUserId());
if (userEntity.getScore() < currencyEntity.getScore()) {
throw new RRException("积分不够,无法兑换");
}
//减掉库存
currencyEntity.setCount(currencyEntity.getCount() - 1);
currencyService.update(currencyEntity);
//减去用户消耗的积分
userEntity.setScore(userEntity.getScore() - currencyEntity.getScore());
exchangeRecordEntity.setScore(currencyEntity.getScore());
this.save(exchangeRecordEntity);
//添加积分使用记录
InfScoreUsedEntity infScoreUsedEntity = new InfScoreUsedEntity();
infScoreUsedEntity.setUserId(exchangeRecordEntity.getUserId());
infScoreUsedEntity.setCreateDate(LocalDateTime.now());
infScoreUsedEntity.setChangeNote("兑换货币");
infScoreUsedEntity.setChangeType(0);
infScoreUsedDao.save(infScoreUsedEntity);
userService.update(userEntity);
}
}
| [
"332860608@qq.com"
] | 332860608@qq.com |
7edb9c597e37465977e3dff36ba3bdcadc8338a7 | 224090e78e3795b3d23a3cf6beaf199cfc2741bb | /src/main/java/com/demo/ServiceLayer.java | f4eb7b614072a1bd66ac14c57d3fc726432bb952 | [] | no_license | nnanda2016/webflux-mvc-annotation-demo | 92acda7dc2a106e5aef18a015e47d8217db59939 | 69c4f08bf0351503d6282df786b561f5501b77a3 | refs/heads/master | 2022-11-30T10:42:54.824553 | 2020-08-01T09:21:25 | 2020-08-01T09:21:25 | 284,225,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Service layer
*
* @author Niranjan Nanda
*/
@Component
public class ServiceLayer {
private static final Logger logger = LoggerFactory.getLogger(ServiceLayer.class);
private final DAOLayer dao;
@Autowired
public ServiceLayer(final DAOLayer dao) {
this.dao = dao;
}
public String get(final String name) {
logger.info("ServiceLayer: name: {}", name);
return dao.get(name);
}
}
| [
"niranjan_nanda@apple.com"
] | niranjan_nanda@apple.com |
ea24e63c6107f418143df044b1c6c16c9504be8d | 2ecc1af678121f8c360e130500b953bda3d38b20 | /ControlRecursos/src/java/co/interfaces/administrar/IAdministrarAusentismos.java | 33288668fc2963f55ab70bc83a092200db90c0f1 | [] | no_license | Felipett1/Gliese-581g | 58c845e3419015c305041a148604dc1ef879006f | 09bb9241d7b0534a5ef91355dd813350f9dcbf29 | refs/heads/master | 2020-06-03T19:21:52.665655 | 2015-08-03T13:42:27 | 2015-08-03T13:42:27 | 39,779,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 751 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package co.interfaces.administrar;
/**
*
* @author 908036
*/
public interface IAdministrarAusentismos {
public java.util.List<co.entidades.Ausentismo> obtenerAusentismos();
public boolean registrarAusentismo(co.entidades.Ausentismo ausentismo);
public boolean eliminarAusentismo(co.entidades.Ausentismo ausentismo);
public boolean modificarAusentismo(co.entidades.Ausentismo ausentismo);
public boolean validarFechasAusentismoRecurso(java.lang.Long identificacionRecurso, java.util.Date fechaInicio, java.util.Date fechaFin);
public java.util.List<co.entidades.Recurso> lovRecursos();
}
| [
"908036@50IT016493.SOAM.TCS.com"
] | 908036@50IT016493.SOAM.TCS.com |
790bc4c3c71b4ff99ea5a3f982dcb7d7e11d1615 | 5361596f52fef16003af22965f6a86698d82a8cb | /app/src/main/java/com/route/test/hungrydemo/model/bean/VitamioBean.java | 384219d6382cf62b35eabbe02bb2f84cafce4c01 | [] | no_license | Sweetzlj/EleMa | c4fdea6b321d13c8c013211f27398fd61c2255c4 | f2fbbb7bf258b19c727d369a2ded4c831e41d7d2 | refs/heads/master | 2021-07-09T11:16:35.994652 | 2017-10-06T07:16:27 | 2017-10-06T07:16:27 | 105,977,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,605 | java | package com.route.test.hungrydemo.model.bean;
import java.util.List;
/**
* Created by my301s on 2017/8/16.
*/
public class VitamioBean {
/**
* code : 1
* data : {"trailers":[{"coverImg":"http://img5.mtime.cn/mg/2017/08/16/162039.34669741.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/08/16/mp4/170816125337243063.mp4","id":67132,"movieId":222372,"movieName":"《追捕》国际版预告","rating":-1,"summary":"张涵予福山雅治双雄对峙","type":["剧情","犯罪"],"url":"https://vfx.mtime.cn/Video/2017/08/16/mp4/170816125337243063_480.mp4","videoLength":57,"videoTitle":"追捕 国际先行预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/08/08/183655.55720224.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/08/08/mp4/170808142541264481.mp4","id":67013,"movieId":231079,"movieName":"《母亲》预告片","rating":-1,"summary":"不速之客打破平静生活","type":["恐怖","悬疑","惊悚","剧情"],"url":"https://vfx.mtime.cn/Video/2017/08/08/mp4/170808142541264481_480.mp4","videoLength":132,"videoTitle":"母亲 剧场版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/08/04/165120.47668055.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/08/02/mp4/170802074323236656.mp4","id":66916,"movieId":234474,"movieName":"\"请以你的名字呼唤我\"预告","rating":-1,"summary":"男孩与房客的暧昧故事","type":["剧情","爱情"],"url":"https://vfx.mtime.cn/Video/2017/08/02/mp4/170802074323236656_480.mp4","videoLength":129,"videoTitle":"请以你的名字呼唤我 剧场版预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/30/110608.43296478.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/29/mp4/170329234509793831.mp4","id":65091,"movieId":225003,"movieName":"《星际特工》中文预告","rating":6.9,"summary":"蕾哈娜惊艳变装 ","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/03/29/mp4/170329234509793831_480.mp4","videoLength":148,"videoTitle":"星际特工:千星之城 中文版剧场预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/25/103830.80188886.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/27/mp4/170727100951771139.mp4","id":66820,"movieId":208175,"movieName":"《蜘蛛侠:英雄归来》预告","rating":7.6,"summary":"小蜘蛛捅娄子钢铁侠擦屁股","type":["动作","冒险","科幻"],"url":"https://vfx.mtime.cn/Video/2017/07/27/mp4/170727100951771139_480.mp4","videoLength":139,"videoTitle":"蜘蛛侠:英雄归来 中文定档预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/15/175020.67051995.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/26/mp4/170726151655944219.mp4","id":66811,"movieId":218546,"movieName":"《猩球崛起3》定档预告","rating":8,"summary":"凯撒面对机关枪扫射生死成谜","type":["动作","冒险","剧情","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/07/26/mp4/170726151655944219_480.mp4","videoLength":30,"videoTitle":"猩球崛起3:终极之战 中文定档预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/07/23/173131.74001414.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/25/mp4/170725165208913886.mp4","id":66744,"movieId":209123,"movieName":"《雷神3》中文预告","rating":-1,"summary":"雷神联手洛基绿巨人女武神","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/07/25/mp4/170725165208913886_480.mp4","videoLength":148,"videoTitle":"雷神3:诸神黄昏 中文版SDCC预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/07/23/173930.58976732.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/24/mp4/170724175154451353.mp4","id":66750,"movieId":70233,"movieName":"《正义联盟》中文预告","rating":-1,"summary":"派荒原狼现身 超人将回归?","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/07/24/mp4/170724175154451353_480.mp4","videoLength":251,"videoTitle":"正义联盟 中文版SDCC预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/07/21/112027.24058623.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/21/mp4/170721094215138136.mp4","id":66702,"movieId":224428,"movieName":"《王牌特工2》中文预告","rating":-1,"summary":"科林费斯回归 枪战爆炸升级","type":["动作","冒险","喜剧"],"url":"https://vfx.mtime.cn/Video/2017/07/21/mp4/170721094215138136_480.mp4","videoLength":112,"videoTitle":"王牌特工2:黄金圈 中文版预告片2"},{"coverImg":"http://img5.mtime.cn/mg/2016/12/20/152247.44954428.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/18/mp4/170718142554515867.mp4","id":66636,"movieId":212468,"movieName":"《银翼杀手2049》中文预告","rating":-1,"summary":"瑞恩高斯林遇上哈里森福特","type":["科幻"],"url":"https://vfx.mtime.cn/Video/2017/07/18/mp4/170718142554515867_480.mp4","videoLength":145,"videoTitle":"银翼杀手2049 中文版剧场预告片"},{"coverImg":"http://img5.mtime.cn/mg/2016/12/15/174636.89623805.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/12/mp4/170712132402662967.mp4","id":66563,"movieId":230741,"movieName":"《敦刻尔克》中文预告","rating":8.5,"summary":"军民协作\u201c大撤退\u201d","type":["剧情","战争"],"url":"https://vfx.mtime.cn/Video/2017/07/12/mp4/170712132402662967_480.mp4","videoLength":30,"videoTitle":"敦刻尔克 中文定档预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/13/162103.65026904.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/14/mp4/170714104320941749.mp4","id":66594,"movieId":220222,"movieName":"《极盗车神》中文版预告","rating":7.6,"summary":"《僵尸肖恩》导演新作","type":["动作","爱情","犯罪","音乐","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/07/14/mp4/170714104320941749_480.mp4","videoLength":60,"videoTitle":"极盗车神 定档预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/01/10/192328.93605490.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/13/mp4/170713143008019651.mp4","id":66586,"movieId":228907,"movieName":"《赛车总动员3》中文预告","rating":-1,"summary":"麦昆走下神坛,如何重回巅峰","type":["动画","冒险","喜剧","家庭","运动"],"url":"https://vfx.mtime.cn/Video/2017/07/13/mp4/170713143008019651_480.mp4","videoLength":125,"videoTitle":"赛车总动员3 中国定档版预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/07/10/114715.90140450.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/07/mp4/170707091849349669.mp4","id":66495,"movieId":211978,"movieName":"《天降浩劫》中文预告","rating":-1,"summary":"灭世浩劫来临 人类如何自救","type":["动作","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/07/07/mp4/170707091849349669_480.mp4","videoLength":150,"videoTitle":"天降浩劫 中文版剧场预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/30/111441.12495353.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/30/mp4/170630091254559104.mp4","id":66404,"movieId":227232,"movieName":"《勇敢者的游戏》预告","rating":-1,"summary":"问题学生意外闯入冒险游戏","type":["冒险","家庭","奇幻"],"url":"https://vfx.mtime.cn/Video/2017/06/30/mp4/170630091254559104_480.mp4","videoLength":156,"videoTitle":"勇敢者的游戏 中文版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/25/163651.18002391.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/25/mp4/170625140544387501.mp4","id":66340,"movieId":223720,"movieName":"《完美音调3》预告片","rating":-1,"summary":"潦倒姐妹团能否谷底翻身","type":["喜剧"],"url":"https://vfx.mtime.cn/Video/2017/06/25/mp4/170625140544387501_480.mp4","videoLength":147,"videoTitle":"完美音调3 中国台湾版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/22/162710.96848141.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/22/mp4/170622094840984563.mp4","id":66317,"movieId":111754,"movieName":"《权力的游戏》新预告","rating":9.1,"summary":"凛冬降至 诸强争霸鹿死谁手","type":["剧情","冒险","奇幻"],"url":"https://vfx.mtime.cn/Video/2017/06/22/mp4/170622094840984563_480.mp4","videoLength":128,"videoTitle":"权力的游戏 第七季预告片2"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/11/161555.71470017.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/12/mp4/170612162426436484.mp4","id":66154,"movieId":218085,"movieName":"《黑豹》中文预告片","rating":-1,"summary":"\u201c黑豹\u201d卷入正邪大战","type":["动作","剧情","科幻"],"url":"https://vfx.mtime.cn/Video/2017/06/12/mp4/170612162426436484_480.mp4","videoLength":115,"videoTitle":"黑豹 中文版先行预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/16/165458.29417943.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/08/mp4/170608085505964169.mp4","id":66107,"movieId":227434,"movieName":"《寻梦环游记》新预告","rating":-1,"summary":"男孩\"穿越\"绚烂亡灵世界","type":["动画","冒险","喜剧","家庭","奇幻","恐怖","歌舞","悬疑"],"url":"https://vfx.mtime.cn/Video/2017/06/08/mp4/170608085505964169_480.mp4","videoLength":88,"videoTitle":"寻梦环游记 剧场版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/06/02/095051.22589872.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/02/mp4/170602085724111639.mp4","id":66016,"movieId":225829,"movieName":"\"东方快车谋杀案\"预告","rating":-1,"summary":"约翰尼德普陷命案 众星出演","type":["犯罪","剧情","悬疑"],"url":"https://vfx.mtime.cn/Video/2017/06/02/mp4/170602085724111639_480.mp4","videoLength":120,"videoTitle":"东方快车谋杀案 中文版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/30/174224.30566229.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/06/01/mp4/170601101938945658.mp4","id":66000,"movieId":229372,"movieName":"《帕丁顿熊2》预告片","rating":-1,"summary":"蠢萌小熊回归 囧况百出","type":["家庭"],"url":"https://vfx.mtime.cn/Video/2017/06/01/mp4/170601101938945658_480.mp4","videoLength":58,"videoTitle":"帕丁顿熊2 中文先导预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/15/181222.74848940.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/25/mp4/170525100752401900.mp4","id":65892,"movieId":208828,"movieName":"《神偷奶爸3》中国版预告","rating":7.3,"summary":"光头奶爸处处被碾压","type":["动画","动作","冒险","喜剧","家庭","科幻"],"url":"https://vfx.mtime.cn/Video/2017/05/25/mp4/170525100752401900_480.mp4","videoLength":134,"videoTitle":"神偷奶爸3 中国版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/17/085721.86499044.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/17/mp4/170517091619822234.mp4","id":65732,"movieId":233547,"movieName":"《表情奇幻冒险》预告","rating":-1,"summary":"表情小伙伴穿行手机拯救世界","type":["动画","冒险","喜剧","家庭","科幻"],"url":"https://vfx.mtime.cn/Video/2017/05/17/mp4/170517091619822234_480.mp4","videoLength":119,"videoTitle":"表情奇幻冒险 中文预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/05/073210.22326807.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/05/mp4/170505073213801260.mp4","id":65559,"movieId":13038,"movieName":"3D版《终结者2》预告","rating":8.4,"summary":"阿诺·施瓦辛格勇猛现身","type":["动作","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/05/05/mp4/170505073213801260_480.mp4","videoLength":95,"videoTitle":"终结者2:审判日 3D版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/04/114042.43095826.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/04/mp4/170504094646697284.mp4","id":65546,"movieId":136911,"movieName":"《黑暗塔》中文预告片","rating":-1,"summary":"枪侠艾尔巴恶战黑衣人麦康纳","type":["动作","冒险","奇幻","恐怖","科幻","西部"],"url":"https://vfx.mtime.cn/Video/2017/05/04/mp4/170504094646697284_480.mp4","videoLength":158,"videoTitle":"黑暗塔 中文版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/05/04/171548.23436952.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/17/mp4/170517153754509087.mp4","id":65743,"movieId":236404,"movieName":"《芳华》青春版预告片","rating":-1,"summary":"冯小刚讲述文工团\"大时代\"","type":["剧情"],"url":"https://vfx.mtime.cn/Video/2017/05/17/mp4/170517153754509087_480.mp4","videoLength":137,"videoTitle":"芳华 青春版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/04/17/150203.97483388.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/04/17/mp4/170417142735243176.mp4","id":65320,"movieId":211981,"movieName":"《星球大战8》中文预告","rating":-1,"summary":"蕾伊拜师天行者","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/04/17/mp4/170417142735243176_480.mp4","videoLength":121,"videoTitle":"星球大战:最后的绝地武士 中文版先行预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/04/11/101459.94827578.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/04/10/mp4/170410223006310887.mp4","id":65233,"movieId":209123,"movieName":"《雷神3》中文版先行预告","rating":-1,"summary":"死神海拉亮相 雷神之锤被捏碎","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/04/10/mp4/170410223006310887_480.mp4","videoLength":116,"videoTitle":"雷神3:诸神黄昏 中文版先行预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/04/01/151023.25802609.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/30/mp4/170330071312694571.mp4","id":65094,"movieId":103523,"movieName":"《小丑回魂》预告片","rating":-1,"summary":"预告片点击量超《速8》","type":["剧情","恐怖"],"url":"https://vfx.mtime.cn/Video/2017/03/30/mp4/170330071312694571_480.mp4","videoLength":152,"videoTitle":"小丑回魂 预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/25/232414.50087057.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/25/mp4/170325232435421788.mp4","id":65056,"movieId":70233,"movieName":"《正义联盟》中文预告","rating":-1,"summary":"蝙蝠侠闪电侠联手逗比","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/03/25/mp4/170325232435421788_480.mp4","videoLength":145,"videoTitle":"正义联盟 中文剧场版预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/29/154811.21990528.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/29/mp4/170329104601028602.mp4","id":65082,"movieId":235816,"movieName":"《公牛历险记》中文预告","rating":-1,"summary":"一头公牛的爆笑历险故事","type":["动画","冒险","喜剧","家庭","奇幻"],"url":"https://vfx.mtime.cn/Video/2017/03/29/mp4/170329104601028602_480.mp4","videoLength":144,"videoTitle":"公牛历险记 中文版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/23/134553.34671740.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/22/mp4/170322232030382961.mp4","id":65006,"movieId":215107,"movieName":"《内裤队长》预告片","rating":-1,"summary":"梦工场最新动画力作","type":["动画","动作","喜剧","家庭"],"url":"https://vfx.mtime.cn/Video/2017/03/22/mp4/170322232030382961_480.mp4","videoLength":172,"videoTitle":"内裤队长 预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/10/161629.16533637.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/10/mp4/170310094908405891.mp4","id":64879,"movieId":224149,"movieName":"《速度与激情8》","rating":7.2,"summary":"新预告大场面炸裂","type":["动作","冒险","犯罪","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/03/10/mp4/170310094908405891_480.mp4","videoLength":175,"videoTitle":"速度与激情8 中国版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/09/094418.45811592.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/09/mp4/170309094229400596.mp4","id":64860,"movieId":233763,"movieName":"《仓惶一夜》","rating":-1,"summary":"寡姐和闺蜜们狂欢遇大事","type":["喜剧"],"url":"https://vfx.mtime.cn/Video/2017/03/09/mp4/170309094229400596_480.mp4","videoLength":161,"videoTitle":"仓惶一夜 限制级预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/04/13/143101.52689729.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/05/24/mp4/170524162152494074.mp4","id":65875,"movieId":211901,"movieName":"《变形金刚5》中文预告","rating":6,"summary":"擎天柱惨遭BOSS洗脑","type":["动作","冒险","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/05/24/mp4/170524162152494074_480.mp4","videoLength":30,"videoTitle":"变形金刚5 中国版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/09/164334.23425131.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/09/mp4/170309090846280479.mp4","id":64857,"movieId":208054,"movieName":"《蓝精灵:寻找神秘村》","rating":6.5,"summary":"蓝妹妹带领冒险队智斗格格巫","type":["动画","冒险","喜剧","家庭","奇幻"],"url":"https://vfx.mtime.cn/Video/2017/03/09/mp4/170309090846280479_480.mp4","videoLength":144,"videoTitle":"蓝精灵:寻找神秘村 中国版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/03/164728.61303636.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/02/mp4/170302221701685514.mp4","id":64787,"movieId":151657,"movieName":"《加勒比海盗5》","rating":7.6,"summary":"哈维尔巴登首露真容","type":["动作","冒险","奇幻"],"url":"https://vfx.mtime.cn/Video/2017/03/02/mp4/170302221701685514_480.mp4","videoLength":147,"videoTitle":"加勒比海盗5 中文版剧场预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/03/01/164446.22245752.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/03/01/mp4/170301133120672165.mp4","id":64768,"movieId":216008,"movieName":"《银河护卫队2》","rating":7.9,"summary":"废柴英雄斗嘴耍帅两不误","type":["动作","冒险","科幻"],"url":"https://vfx.mtime.cn/Video/2017/03/01/mp4/170301133120672165_480.mp4","videoLength":143,"videoTitle":"银河护卫队2 中文终极版预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/23/145301.70557588.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/23/mp4/170223102102779354.mp4","id":64692,"movieId":226894,"movieName":"《金刚:骷髅岛》","rating":7.2,"summary":"骷髅岛王者之战硝烟四起","type":["动作","冒险","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/02/23/mp4/170223102102779354_480.mp4","videoLength":60,"videoTitle":"金刚:骷髅岛 中文预告之\u201c制霸骷髅岛\u201d"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/20/153423.98736653.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/18/mp4/170218171317773949.mp4","id":64647,"movieId":156743,"movieName":"《歌至歌》","rating":6.3,"summary":"R级爱情片预告呈现多角关系","type":["剧情","音乐","爱情"],"url":"https://vfx.mtime.cn/Video/2017/02/18/mp4/170218171317773949_480.mp4","videoLength":91,"videoTitle":"歌至歌 预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/17/175303.60177408.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/17/mp4/170217103357049622.mp4","id":64629,"movieId":230023,"movieName":"《绑架者》","rating":6.1,"summary":"徐静蕾悬疑新作。","type":["动作","犯罪"],"url":"https://vfx.mtime.cn/Video/2017/02/17/mp4/170217103357049622_480.mp4","videoLength":74,"videoTitle":"绑架者 先导预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/16/172409.22959539.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/16/mp4/170216103715670994.mp4","id":64619,"movieId":209688,"movieName":"《金刚狼3:殊死一战》","rating":8,"summary":"罗根的避世状态宣告终结","type":["动作","剧情","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/02/16/mp4/170216103715670994_480.mp4","videoLength":60,"videoTitle":"金刚狼3:殊死一战 中文终极预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/07/13/101159.39929172.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/07/10/mp4/170710120156390625.mp4","id":66519,"movieId":237264,"movieName":"《父子雄兵》终极预告","rating":5.8,"summary":"范伟宝刀不老赴险救大鹏","type":["剧情","喜剧"],"url":"https://vfx.mtime.cn/Video/2017/07/10/mp4/170710120156390625_480.mp4","videoLength":123,"videoTitle":"父子雄兵 终极预告"},{"coverImg":"http://img5.mtime.cn/mg/2016/11/14/170931.53336754.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/13/mp4/170213170800740573.mp4","id":64589,"movieId":219801,"movieName":"《攻壳机动队》","rating":6.8,"summary":"斯嘉丽·约翰逊性感亮相","type":["动作","犯罪","剧情","悬疑","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/02/13/mp4/170213170800740573_480.mp4","videoLength":129,"videoTitle":"攻壳机动队 中文版预告片2"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/13/144123.86441409.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/10/mp4/170210102848023042.mp4","id":64559,"movieId":232603,"movieName":"《拆弹专家》","rating":6.9,"summary":"隧道里的惊险拆弹任务","type":["动作","悬疑","犯罪"],"url":"https://vfx.mtime.cn/Video/2017/02/10/mp4/170210102848023042_480.mp4","videoLength":28,"videoTitle":"拆弹专家 先导预告"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/06/103602.18091106.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/06/mp4/170206141638841406.mp4","id":64456,"movieId":216008,"movieName":"《银河护卫队2》","rating":7.9,"summary":"\u201c逗B天团\u201d迎来新成员","type":["动作","冒险","科幻"],"url":"https://vfx.mtime.cn/Video/2017/02/06/mp4/170206141638841406_480.mp4","videoLength":60,"videoTitle":"银河护卫队2 中文版超级碗预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/02/06/090407.53967072.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/02/06/mp4/170206090401106016.mp4","id":64452,"movieId":224149,"movieName":"《速度与激情8》","rating":7.2,"summary":"范迪赛尔上演冰原飞车","type":["动作","冒险","犯罪","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/02/06/mp4/170206090401106016_480.mp4","videoLength":60,"videoTitle":"速度与激情8 超级碗预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/01/20/161551.60889647.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/01/19/mp4/170119225326610502.mp4","id":64312,"movieId":209688,"movieName":"《金刚狼3》","rating":8,"summary":"罗根携X教授亡命天涯","type":["动作","剧情","科幻","惊悚"],"url":"https://vfx.mtime.cn/Video/2017/01/19/mp4/170119225326610502_480.mp4","videoLength":135,"videoTitle":"金刚狼3:殊死一战 中文预告片2"},{"coverImg":"http://img5.mtime.cn/mg/2017/01/17/140841.68563015.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/01/16/mp4/170116173823484498.mp4","id":64259,"movieId":208325,"movieName":"《西游伏妖篇》","rating":6.5,"summary":"唐僧\"重色轻友\"与悟空反目","type":["奇幻","动作","喜剧","古装"],"url":"https://vfx.mtime.cn/Video/2017/01/16/mp4/170116173823484498_480.mp4","videoLength":127,"videoTitle":"西游伏妖篇 剧场版预告片"},{"coverImg":"http://img5.mtime.cn/mg/2017/01/16/102902.55846324.jpg","hightUrl":"https://vfx.mtime.cn/Video/2017/01/16/mp4/170116084052051939.mp4","id":64245,"movieId":200591,"movieName":"《刺客信条》","rating":6.4,"summary":"\u201c法鲨\u201d变身中世界刺客","type":["动作","冒险","剧情","奇幻","科幻"],"url":"https://vfx.mtime.cn/Video/2017/01/16/mp4/170116084052051939_480.mp4","videoLength":146,"videoTitle":"刺客信条 中文版定档预告片"}]}
* msg : 成功
* showMsg :
*/
private String code;
private DataBean data;
private String msg;
private String showMsg;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getShowMsg() {
return showMsg;
}
public void setShowMsg(String showMsg) {
this.showMsg = showMsg;
}
public static class DataBean {
private List<TrailersBean> trailers;
public List<TrailersBean> getTrailers() {
return trailers;
}
public void setTrailers(List<TrailersBean> trailers) {
this.trailers = trailers;
}
public static class TrailersBean {
/**
* coverImg : http://img5.mtime.cn/mg/2017/08/16/162039.34669741.jpg
* hightUrl : https://vfx.mtime.cn/Video/2017/08/16/mp4/170816125337243063.mp4
* id : 67132
* movieId : 222372
* movieName : 《追捕》国际版预告
* rating : -1
* summary : 张涵予福山雅治双雄对峙
* type : ["剧情","犯罪"]
* url : https://vfx.mtime.cn/Video/2017/08/16/mp4/170816125337243063_480.mp4
* videoLength : 57
* videoTitle : 追捕 国际先行预告片
*/
private String coverImg;
private String hightUrl;
private int id;
private int movieId;
private String movieName;
private String rating;
private String summary;
private String url;
private int videoLength;
private String videoTitle;
private List<String> type;
public String getCoverImg() {
return coverImg;
}
public void setCoverImg(String coverImg) {
this.coverImg = coverImg;
}
public String getHightUrl() {
return hightUrl;
}
public void setHightUrl(String hightUrl) {
this.hightUrl = hightUrl;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMovieId() {
return movieId;
}
public void setMovieId(int movieId) {
this.movieId = movieId;
}
public String getMovieName() {
return movieName;
}
public void setMovieName(String movieName) {
this.movieName = movieName;
}
public String getRating() {
return rating;
}
public void setRating(String rating) {
this.rating = rating;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getVideoLength() {
return videoLength;
}
public void setVideoLength(int videoLength) {
this.videoLength = videoLength;
}
public String getVideoTitle() {
return videoTitle;
}
public void setVideoTitle(String videoTitle) {
this.videoTitle = videoTitle;
}
public List<String> getType() {
return type;
}
public void setType(List<String> type) {
this.type = type;
}
}
}
}
| [
"2958061115@qq.com"
] | 2958061115@qq.com |
6d9ebc612c6781b736fa7cacc421c3e1f4fa3d15 | 42c2f8c162adc2151ee1e4a90917f5f3d1f9a0d0 | /src/main/java/com/library/model/LibraryModel.java | bebdff74c01ea466ccb534531bbbea59d77187a6 | [] | no_license | dineshpazani/library-service | ce3a3fae1ae551fd8672bb66fc77177a16312f25 | 91ebe0e6554bb26151183076fd770bbe86ac3d7c | refs/heads/master | 2022-11-05T22:12:45.343520 | 2020-06-09T13:53:56 | 2020-06-09T13:53:56 | 270,537,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.library.model;
import java.sql.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import lombok.Getter;
import lombok.Setter;
@Entity
@Getter
@Setter
@Table(name = "LIBRARY")
public class LibraryModel {
@Id
@Column(name = "username", length = 64, nullable = false)
private String username;
@Column(name = "issueddate", nullable = false)
private Date issueddate;
@ManyToOne
private BooksModel issuedBooks;
}
| [
"dineshpazanee@gmail.com"
] | dineshpazanee@gmail.com |
d4dcb49ba80508cbffa0eca116fbf5b2893532d2 | c5d08131d94aad146b8fb7da0696a5f6187b8f1e | /quantity/src/main/java/si/uom/quantity/KinematicViscosity.java | c7dbe226805d9b8c1acc87013a1fdf7e3a46e7fa | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | htreu/si-units | d48ca979923b72889def135c7400c475e2259c27 | a3d15efa9bd3ec568ed843001ad4a8125e75e33a | refs/heads/master | 2021-05-05T10:06:50.103258 | 2018-01-18T07:43:49 | 2018-01-18T07:43:49 | 117,948,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,146 | java | /*
* International System of Units (SI)
* Copyright (c) 2005-2017, Jean-Marie Dautelle, Werner Keil and others.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of JSR-363, Units of Measurement nor the names of their contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package si.uom.quantity;
import javax.measure.Quantity;
/**
* Diffusion of momentum.
* The system unit for this quantity is "m²/s".
*
* @author <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
* @author <a href="mailto:units@catmedia.us">Werner Keil</a>
* @version 3.2.1
*
* @see DynamicViscosity
* @see <a href="http://en.wikipedia.org/wiki/Viscosity">Wikipedia: Viscosity</a>
*/
public interface KinematicViscosity extends Quantity<KinematicViscosity> {
}
| [
"werner.keil@gmx.net"
] | werner.keil@gmx.net |
ecb01f0551c2e81c3b522fdc35469d49d0290099 | ff24cc52b68ea23b2597991a34aea3b527c941e6 | /app/src/main/java/com/example/user/adoptionanimal/adapter/AdoptionAnimalRVAdapter.java | abf6548fe55b0ac7a895366d5a172968b0c117a6 | [] | no_license | FuyuLei/AdoptionAnimal | 0ecff86cd19ad8e844ee732788fae97c43cf83bb | d419a4ee4a7529c8c4a6972b5485f3c1a06c17e2 | refs/heads/master | 2021-06-24T05:26:09.203831 | 2019-09-15T04:56:29 | 2019-09-15T04:56:29 | 97,186,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,540 | java | package com.example.user.adoptionanimal.adapter;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.user.adoptionanimal.R;
import com.example.user.adoptionanimal.activity.AnimalInformationActivity;
import com.example.user.adoptionanimal.model.Animal;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class AdoptionAnimalRVAdapter extends RecyclerView.Adapter {
private Context context;
private ArrayList<Animal> list;
int w ;
public AdoptionAnimalRVAdapter(Context context, ArrayList<Animal> list) {
this.context = context;
this.list = list;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, final int viewType) {
return new ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_rv_animal, parent, false));
}
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
w = (int) context.getResources().getDimension(R.dimen.animal_small);
if (holder instanceof ViewHolder) {
ViewHolder h = (ViewHolder) holder;
final Animal item = list.get(position);
Picasso.with(context)
.load(item.getImageName())
.resize(w, w)
.centerCrop().into(h.img);
if(item.getName().equals("") ){
h.name.setText("尚未取名字");
h.name.setTextColor(Color.parseColor("#bcaaa4"));
}else {
h.name.setText(item.getName());
h.name.setTextColor(Color.parseColor("#866161"));
}
h.sex.setText(item.getSex());
h.type.setText(item.getType());
h.build.setText(item.getBuild());
h.age.setText(item.getAge());
h.itemView.findViewById(R.id.cv_item_rv_animal).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = holder.getAdapterPosition();
Animal animal = list.get(position);
Intent intent = new Intent();
intent.setClass(context, AnimalInformationActivity.class);
intent.putExtra("Animal", animal);
context.startActivity(intent);
}
});
}
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public int getItemCount() {
return list.size();
}
private class ViewHolder extends RecyclerView.ViewHolder {
ImageView img;
TextView name;
TextView sex;
TextView type;
TextView build;
TextView age;
public ViewHolder(View v) {
super(v);
img = (ImageView) v.findViewById(R.id.iv_item_rv_animal_img);
name = (TextView) v.findViewById(R.id.tv_item_rv_animal_name);
sex = (TextView) v.findViewById(R.id.tv_item_rv_animal_sex);
type = (TextView) v.findViewById(R.id.tv_item_rv_animal_type);
build = (TextView) v.findViewById(R.id.tv_item_rv_animal_build);
age = (TextView) v.findViewById(R.id.tv_item_rv_animal_age);
}
}
}
| [
"raralei8860@gmail.com"
] | raralei8860@gmail.com |
d1ac3edbe8daf653e61efd1f1f92219ea76bae91 | 534cfcae192f403cba062400958f3fc6df5c84c2 | /conversion.java | 82b1fb036293442e35b397568c708477d07288cf | [] | no_license | Tanish001/class10 | 40ccdc9a2d517b73999ae3e8708726517d4af4b1 | 783778f6cfb0ed8677cdb347f74888e5d9e9c59d | refs/heads/master | 2023-04-03T15:56:08.706091 | 2021-04-01T02:11:01 | 2021-04-01T02:11:01 | 353,539,878 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 629 | java | public class conversion
{
static int mTocm(int m)
{
return m*100;
}
static int multiply(int x,int y)
{
return x*y;
}
public class rectangle
{
int length,breadth;
rectangle(int l,int b)
{
length=l;
breadth=b;
}
void convert()
{
length=conversion.mTocm(length);
}
void compute()
{
int area;
convert();
area=conversion.multiply(length,breadth);
System.out.println("area= "+area);
}
}
}
| [
"Tanish@DESKTOP-U165CV2"
] | Tanish@DESKTOP-U165CV2 |
e79b450498ff235d8cb9e2dc7efe05ce5421f21d | dd3c5a815994f5f35ad775e7f05cb73423789f74 | /src/business_logic/Domino.java | c29932cf95ba749a4d7131fb90f1f02b90deb10a | [] | no_license | mrnestor123/dominoLibrary | 021dee43bad6b1c4aec7d3d1e607a3b3510a6b20 | 2e100d5f1f0ad466e53ef4e2c0f468b4c7553867 | refs/heads/master | 2020-04-25T04:37:41.077790 | 2019-05-20T22:27:57 | 2019-05-20T22:27:57 | 172,516,527 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,456 | 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 business_logic;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javafx.geometry.HPos;
import javafx.geometry.Pos;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.RowConstraints;
import javafx.scene.shape.Circle;
/**
*
* @author Barra
*/
public class Domino implements Serializable {
//up can be right,down can be left
private int number1, number2;
public Domino(int n1, int n2) {
number1 = n1;
number2 = n2;
}
//public void setPosition(int p){position = p;}
//public int getPositon(){return position;}
public int getNumber1() {
return number1;
}
public int getNumber2() {
return number2;
}
public List<Integer> getBothNumbers() {
List<Integer> aux = new ArrayList<>();
aux.add(number1);
aux.add(number2);
return aux;
}
public int getTotalPoints() {
return this.number1 + this.number2;
}
public boolean isDoble() {
return this.number1 == this.number2;
}
public boolean equals(Domino d) {
return this.toString().equals(d.toString());
}
/**
* Given a number it draws the circles on its position
*
* @param number
* @return
*/
public GridPane drawDomino(int number) {
GridPane g = new GridPane();
Circle c1 = new Circle();
c1.setRadius(3);
Circle c2 = new Circle();
c2.setRadius(3);
Circle c3 = new Circle();
c3.setRadius(3);
Circle c4 = new Circle();
c4.setRadius(3);
Circle c5 = new Circle();
c5.setRadius(3);
Circle c6 = new Circle();
c6.setRadius(3);
g.setAlignment(Pos.CENTER);
RowConstraints row1 = new RowConstraints();
RowConstraints row2 = new RowConstraints();
RowConstraints row3 = new RowConstraints();
switch (number) {
case 1:
g.add(c1, 1, 1);
break;
case 2:
g.add(c1, 0, 2);
g.add(c2, 2, 0);
break;
case 3:
g.add(c1, 0, 2);
g.add(c2, 1, 1);
g.add(c3, 2, 0);
break;
case 4:
g.add(c1, 0, 0);
g.add(c2, 0, 2);
g.add(c3, 2, 0);
g.add(c4, 2, 2);
break;
case 5:
g.add(c1, 0, 0);
g.add(c2, 0, 2);
g.add(c3, 1, 1);
g.add(c4, 2, 0);
g.add(c5, 2, 2);
break;
case 6:
g.add(c1, 0, 0);
g.add(c2, 0, 1);
g.add(c3, 0, 2);
g.add(c4, 2, 0);
g.add(c5, 2, 1);
g.add(c6, 2, 2);
break;
default:
row1.setPercentHeight(50);
break;
}
g.setVgap(2);
g.setPrefHeight(60);
row1.setVgrow(Priority.NEVER);
row2.setVgrow(Priority.NEVER);
row3.setVgrow(Priority.NEVER);
row1.setPercentHeight(50);
row2.setPercentHeight(50);
row3.setPercentHeight(50);
ColumnConstraints column1 = new ColumnConstraints();
column1.setPercentWidth(50);
ColumnConstraints column2 = new ColumnConstraints();
column2.setPercentWidth(50);
ColumnConstraints column3 = new ColumnConstraints();
column3.setPercentWidth(50);
column1.setHalignment(HPos.CENTER);
column2.setHalignment(HPos.CENTER);
column3.setHalignment(HPos.CENTER);
g.getColumnConstraints().addAll(column1, column2, column3);
g.getRowConstraints().addAll(row1, row2, row3);
return g;
}
public String toString() {
return number1 + "/" + number2;
}
//DRAW DOMINO cada uno en una direccion(Vertocal,horizontal)
}
| [
"noreply@github.com"
] | noreply@github.com |
efbc3aa0b153f1af4bed75d247bd7f6635b15ddb | 1199fbea1a34829252b03cad2d8e08e9f5d50721 | /src/rs/ac/bg/etf/pp1/ast/OrOperator.java | a781ef3bf5f2d3a2fcabdbbec7199a7a44b13660 | [] | no_license | Ivan1902/MJCompiler | aca6eb80beb9c96b1076121793122da90f254d90 | bda1617a777be69da77489669d87c27186cff540 | refs/heads/main | 2023-06-17T10:10:42.126344 | 2021-07-17T19:03:46 | 2021-07-17T19:03:46 | 387,017,773 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | // generated with ast extension for cup
// version 0.8
// 29/5/2021 23:42:58
package rs.ac.bg.etf.pp1.ast;
public class OrOperator implements SyntaxNode {
private SyntaxNode parent;
private int line;
public OrOperator () {
}
public SyntaxNode getParent() {
return parent;
}
public void setParent(SyntaxNode parent) {
this.parent=parent;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line=line;
}
public void accept(Visitor visitor) {
visitor.visit(this);
}
public void childrenAccept(Visitor visitor) {
}
public void traverseTopDown(Visitor visitor) {
accept(visitor);
}
public void traverseBottomUp(Visitor visitor) {
accept(visitor);
}
public String toString(String tab) {
StringBuffer buffer=new StringBuffer();
buffer.append(tab);
buffer.append("OrOperator(\n");
buffer.append(tab);
buffer.append(") [OrOperator]");
return buffer.toString();
}
}
| [
"ivan.ned19@gmail.com"
] | ivan.ned19@gmail.com |
a5756beac5fe57672df3e6a7cf6e698162ddc68d | e798e977bc777e137785bebac293c713db88faeb | /Hacking code/hacking/src/JpcapTip.java | 87cbab1a8305c3c108d68c736fc5e35137b5b0bd | [] | no_license | arunkumar267/Projects | faa8093028d93f5330e50c10b3dd97dc2b5b3ebb | 4f1fbbbc2924c1c261c4946cc2c8cbf6174395b4 | refs/heads/master | 2021-01-10T19:38:38.369140 | 2014-06-11T15:09:06 | 2014-06-11T15:09:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Elcot
*/
public class JpcapTip {
}
| [
"arunkumar267@gmail.com"
] | arunkumar267@gmail.com |
28a6a2906fdb46bdbc3c4381da2818ee7759b5b9 | a0f1001a3e872a17d21ec76461cc6761286c5734 | /day07/张栗玮/day1222_zhangliwei/app/src/main/java/com/example/day1222_zhangliwei/mvp/base/BaseFragment.java | 17b055026dcff70fff06c74f77708e61db90c346 | [] | no_license | JohnZhang1000/group6 | e7d0a447a77cc9e0426e9ba602fef2293d6f105a | a26297b745585e60f03264effa8a81ccb063e5f0 | refs/heads/main | 2023-02-08T22:48:08.882603 | 2021-01-05T00:26:52 | 2021-01-05T00:26:52 | 322,816,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,862 | java | package com.example.day1222_zhangliwei.mvp.base;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import butterknife.ButterKnife;
import butterknife.Unbinder;
public abstract class BaseFragment<P extends BasePresenter,T> extends Fragment implements IBaseView<T> {
private Unbinder mBind;
private P mPresenter;
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
int layoutId = getLayoutId();
View view = null;
if (layoutId != 0) {
view = inflater.inflate(layoutId, null);
mBind = ButterKnife.bind(this, view);
}
mPresenter = createPresenter();
if (mPresenter != null)
mPresenter.attachView(this);
return view;
}
protected abstract P createPresenter();
protected P getmPresenter() {
if (mPresenter != null)
return mPresenter;
return null;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
init();
initData();
}
protected void initData() {
}
protected abstract void init();
protected abstract int getLayoutId();
@Override
public void onScuccess(T t) {
}
@Override
public void onError(String msg) {
}
@Override
public void onDestroyView() {
super.onDestroyView();
if (mBind != null)
mBind.unbind();
if (mPresenter != null) {
mPresenter.detachView();
mPresenter = null;
}
}
}
| [
"1652402920@qq.com"
] | 1652402920@qq.com |
d8fbac49bf1ef9a3558aff4550747a58fb077c5a | aef075c82b910c28fccb2780d6b3d2d8e93bd088 | /src/test/java/com/shigang/test/TestMapper.java | 5c0d47b706d54ff889b5bd25672116274c7ff745 | [] | no_license | shigang-zhang/Mybatis_Plus_Demo | 0617b4c92816a956349beb08cf6a4e0369429bb9 | b8f4721204ab5bdf075a344bc696db2ae87606ac | refs/heads/master | 2023-02-16T12:00:22.028090 | 2021-01-19T06:54:15 | 2021-01-19T06:54:15 | 330,876,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | package com.shigang.test;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.shigang.MyBatisApplication;
import com.shigang.mapper.UserMapper;
import com.shigang.pojo.User;
import com.shigang.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest(classes = MyBatisApplication.class)
@RunWith(SpringRunner.class)
public class TestMapper {
@Autowired
private UserService userService;
@Autowired(required = false)
private UserMapper userMapper;
@Test
public void test01(){
List<User> users = userMapper.selectList(null);
users.forEach(s -> System.out.println("s = " + s));
}
@Test
public void test02(){
List<User> users = new ArrayList<>();
users.add(new User(1, "张1", "123"));
users.add(new User(1, "张2", "123"));
users.add(new User(1, "张3", "123"));
System.out.println(userService.saveBatch(users, 2));
}
@Test
public void test03(){
User user = new User(8, "张1", "123");
System.out.println(userService.saveOrUpdate(user));
}
@Test
public void test04(){
User user = new User(1, "张1", "999");
System.out.println(userService.saveOrUpdate(user, Wrappers.<User>lambdaUpdate()
.eq(User::getId, 2)
.set(User::getUserName, "李四")));
}
@Test
public void test05(){
User user = new User(1, null, "234");
System.out.println(userService.updateById(user));
}
@Test
public void test06(){
User user = new User(1, "123", "123");
System.out.println(userService.saveOrUpdate(user, Wrappers.<User>lambdaUpdate()
.eq(User::getId, 1)
.set(User::getUserName, "张6")));
}
@Test
public void test07(){
User user = new User(9, "张1", "123");
System.out.println(userService.saveOrUpdate(user, Wrappers.<User>lambdaUpdate()
.eq(User::getUserName, "张三")));
}
}
| [
"1441705828@qq.com"
] | 1441705828@qq.com |
8464ff3a9abefb74fd274a307f28d725a023ca5f | 0a2924f4ae6dafaa6aa28e2b947a807645494250 | /dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataapproval/exceptions/PeriodShorterThanDataSetPeriodException.java | c9e24d1a11b2366df19793e93cca39569290befb | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | filoi/ImmunizationRepository | 9483ee02afd0b46d0f321a1e1ff8a0f6d8ca7f71 | efb9f2bb9ae3da8c6ac60e5d5661b8a79a6939d5 | refs/heads/master | 2023-03-16T03:26:34.564453 | 2023-03-06T08:32:07 | 2023-03-06T08:32:07 | 126,012,725 | 0 | 0 | BSD-3-Clause | 2022-12-16T05:59:21 | 2018-03-20T12:17:24 | Java | UTF-8 | Java | false | false | 1,808 | java | package org.hisp.dhis.dataapproval.exceptions;
/*
* Copyright (c) 2004-2015, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @author Jim Grace
*/
public class PeriodShorterThanDataSetPeriodException
extends DataApprovalException
{
public PeriodShorterThanDataSetPeriodException()
{
super();
}
}
| [
"neeraj@filoi.in"
] | neeraj@filoi.in |
213885e6cf7ed7c104cb2cb91ef52ad355928398 | 63f3cdd47a8172a02752c492d47baf8b0e31a1d9 | /Sam/002/C/Student.java | f8b38334ed9b00068d42572429aaa878e0fc66dd | [] | no_license | GayanSamuditha/Assignment-Package | 826fa90875fde3b8edb71a1472ea4303ad59b4bd | 6a71a7c542b344283d31a467bbf90e7fc8570460 | refs/heads/master | 2020-12-10T22:45:21.193356 | 2020-01-14T01:58:58 | 2020-01-14T01:58:58 | 233,733,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132 | java |
package C;
import B.Course;
public class Student{
public void print(){
Course course =new Course();
course.print();
}
} | [
"gayansamudithatech@gmail.com"
] | gayansamudithatech@gmail.com |
fa85d84d6fa8ec6a131abec8fc209684ab9620e4 | 0ad5774da285de3561aebe71f9a9242cc849c4cf | /src/test/java/org/realityforge/jeo/geolatte/jpa/eclipselink/TestPolygonEntity.java | bed7cb5f6582739ce24cfd8100ef820f3c356640 | [
"Apache-2.0"
] | permissive | brain64bit/geolatte-geom-eclipselink | fd16d97f52ebceba19f2baa51dba9bb0c57413e9 | a82f968cd4b017928c1ee9bec8d56847fe58273e | refs/heads/master | 2021-01-21T07:45:56.855780 | 2013-08-06T01:53:37 | 2013-08-06T01:53:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package org.realityforge.jeo.geolatte.jpa.eclipselink;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.geolatte.geom.Point;
import org.geolatte.geom.Polygon;
@Entity
public class TestPolygonEntity
implements Serializable
{
@Id
@Column( name = "id" )
private Integer _id;
@Column( name = "geom" )
private Polygon _geom;
public Integer getId()
{
return _id;
}
public void setId( final Integer id )
{
_id = id;
}
public Polygon getGeom()
{
return _geom;
}
public void setGeom( final Polygon geom )
{
_geom = geom;
}
} | [
"peter@realityforge.org"
] | peter@realityforge.org |
244920bb7ba42f4e2496fa5ac299d3892f172500 | 837c4204a155111fd2ce6cb08030e5df16721463 | /Seminar9 -CTS/src/ro/ase/cts/observer/state/State.java | 9241fc7468f18cdd35f75e33b844f0730177b002 | [] | no_license | CraciunE/CTS | f3b38e531efc683deffca3a3d2523739593c129a | 2a7d764c5e4f274a425bcf761b52e51cfead937a | refs/heads/master | 2023-05-26T16:03:09.675081 | 2021-06-05T12:05:27 | 2021-06-05T12:05:27 | 342,843,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package ro.ase.cts.observer.state;
public interface State {
void descrieStare();
}
| [
"craciunelena18@stud.ase.ro"
] | craciunelena18@stud.ase.ro |
d869b437f5b6732964b0f1dab0993c7bc5c7f781 | 10f4600b1c42426af8618de08aeb8f10880ace0e | /app/src/main/java/me/storm/volley/VolleyApp.java | 7b406aa10a907e10ae60cf889c3ab5bdbf01ffcb | [] | no_license | zhangquanit/net-volley | d3aca8a0b4d5355b9528342a826af154c75e5806 | 5b3d5ed50774fad868e098e398c67b1c9e70b279 | refs/heads/master | 2021-10-08T06:39:11.621315 | 2018-12-09T16:39:22 | 2018-12-09T16:39:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | /*
* Created by Storm Zhang, Feb 11, 2014.
*/
package me.storm.volley;
import android.app.Application;
import me.storm.volley.data.RequestManager;
public class VolleyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
init();
}
private void init() {
RequestManager.init(this);
}
}
| [
"zhangquanit@126.com"
] | zhangquanit@126.com |
6a6737885a85c4f0b62ef9fc73238c22289e6bbc | 5d75cf39da084d67eb1f8a7e2d3095c376455008 | /android/src/com/keyking/admin/data/user/Account.java | 20a54eee4142723683be1078525c4dfeccfe6006 | [] | no_license | keyking-coin/code | 1413a32a9901725228004cd971f6efac4a4e5121 | bdba6b9d8a7bb8a4ac682d7ff5f12d3e37c27bdb | refs/heads/master | 2020-04-04T05:46:34.108286 | 2016-09-30T07:09:46 | 2016-09-30T07:09:46 | 52,215,473 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 848 | java | package com.keyking.admin.data.user;
public class Account {
String account;//银行账号
String name;//银行名称
String openAddress;//开户行地址
String openName;//开户人姓名
String addTime;//添加时间
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOpenAddress() {
return openAddress;
}
public void setOpenAddress(String openAddress) {
this.openAddress = openAddress;
}
public String getOpenName() {
return openName;
}
public void setOpenName(String openName) {
this.openName = openName;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
}
| [
"keyking@163.com"
] | keyking@163.com |
017c2e89e340f184df95a168fdbf5fb6509be726 | 5bf0b6e3d5d65ebc1c382da813b71f1bf0e42b32 | /src/test/java/com/NopCom/MyStepdefs.java | 4dbc2b361744f2036642837904ceae25573e2669 | [] | no_license | NSS18/Hybrid-model-with-Cucumber-for-NopCommerceDemo | f67596bb7cb13e120939979e353abe2e8aeb3335 | 256d3333cc41df24918997c3dae267167eaeff90 | refs/heads/master | 2021-04-18T08:55:24.360395 | 2020-03-23T19:34:11 | 2020-03-23T19:34:11 | 249,526,187 | 0 | 0 | null | 2020-10-13T20:35:53 | 2020-03-23T19:35:39 | Java | UTF-8 | Java | false | false | 11,001 | java | package com.NopCom;
import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
public class MyStepdefs {
//To Create object of home page
HomePage homePage = new HomePage();
//To Create object of registration page
RegistrationPage registrationPage = new RegistrationPage();
//To Create object of registration result page
RegistrationResultPage registrationResultPage = new RegistrationResultPage();
//To Create object of electronics page
ElectronicsPage electronicsPage = new ElectronicsPage();
//To Create object of camera and photo page
CameraAndPhotoPage cameraAndPhotoPage = new CameraAndPhotoPage();
//To Create object of camera and photo result page
CameraAndPhotoResultPage cameraAndPhotoResultPage = new CameraAndPhotoResultPage();
//To Create object of login page
LoginPage loginPage = new LoginPage();
//To Create object of product email a friend
ProductEmailAFriend productEmailAFriend = new ProductEmailAFriend();
//To Create object of product email a friend details
ProductEmailAFriendDetails productEmailAFriendDetails = new ProductEmailAFriendDetails();
//To Create object of user success email result--register user
RegisterUserSuccessEmailResult productEmailResult = new RegisterUserSuccessEmailResult();
//To Create object of user email result--non register user
NonRagisterUseremailResult nonRagisterUseremailResult = new NonRagisterUseremailResult();
//To Create object of Book page
BookPage bookPage=new BookPage();
//To create object of cart page
CartPage cartPage=new CartPage();
//To create object of checkout as guest
CheckoutAsGuest checkoutAsGuest=new CheckoutAsGuest();
//To create object of fill checkout details
FillCheckoutDetails fillCheckoutDetails=new FillCheckoutDetails();
//To create object of checkout result
CheckoutResult checkoutResult=new CheckoutResult();
//To create object of news page
NewsPage newsPage=new NewsPage();
//To create object of new online store open page
NewOnlineStoreIsOpenPage newOnlineStoreIsOpenPage=new NewOnlineStoreIsOpenPage();
//test case 1---------------->User should able to register successfully and able to see successful registration message.
@Given("user is on register page")
public void userIsOnRegisterPage() {
homePage.clickRegisterButton();
registrationPage.verifyUserIsOnRegisterPage();
}
@When("user enters all registration details")
public void userEntersAllRegistrationDetails() {
registrationPage.verifyUserIsOnRegisterPage();
registrationPage.userEnterRegistrationDetails();
}
@And("user clicks on register button")
public void userClicksOnRegisterButton() {
registrationPage.userClicksRegisterButton();
}
@Then("user should able to register successfully")
public void userShouldAbleToRegisterSuccessfully() {
registrationResultPage.verifyUserSeeRegistrationSuccessMessage();
}
//test case 2 --------------->User should able to compare two products successfully and able to see 'compare products' text.
@Given("User is on electronics page")
public void user_is_on_electronics_page() {
homePage.clickOnElectronics();
//Verify user is on electronics page
electronicsPage.verifyUserIsOnElectronicsPage();
}
@When("User selects two products for comparision")
public void user_selects_two_products_for_comparision() {
electronicsPage.userClicksOnCameraAndPhoto();
//Click on compare button for item 1
cameraAndPhotoPage.clickOnCompareButtonForProduct1();
cameraAndPhotoPage.verifyUserIsOnCameraAndPhotoPage();
cameraAndPhotoPage.clickOnCompareButtonForProduct2();
//Click on green product comparison link
cameraAndPhotoPage.productComparision();
}
@Then("User should able to compare successfully")
public void user_should_able_to_compare_successfully() {
//Verify compare product success message
cameraAndPhotoResultPage.verifyUserSeeCompareProductSuccessMessage();
}
//Test case 3------------->User(Registered) should be able to refer a product to a friend and able to see message "Your message has been sent."
@Given("User is on Home Page")
public void user_is_on_Home_Page() {
//To verify user is on homepage
homePage.verifyUserIsOnHomepage();
}
@When("User selects product and fill all details")
public void user_selects_product_and_fill_all_details() {
//Click on login link
homePage.clickOnLogin();
//To verify user is on login page
loginPage.verifyOnLoginPage();
//Enter login details
loginPage.loginDetails();
//Click on electronics
homePage.clickOnElectronics();
//To verify we are on electronics page
electronicsPage.verifyUserIsOnElectronicsPage();
//Click on camera & photo
electronicsPage.userClicksOnCameraAndPhoto();
//To select product
cameraAndPhotoPage.selectProduct();
}
@When("Clicks on send email button")
public void clicks_on_send_email_button() {
//To click on email a friend
productEmailAFriend.emailAFriend();
//To fill the details
productEmailAFriendDetails.registerUserEnterFriendDetails();
}
@Then("User should able to see message {string}")
public void user_should_able_to_see_message(String string) {
//To check User should able to see message-"Your message has been sent.".
productEmailResult.verifyRegisterUserSeeEmailSuccessMessage();
}
//test case 4------>//To verify that non registered user should not be able to refer a product to a friend.
@When("User\\(non register) selects product and fill all details")
public void user_non_register_selects_product_and_fill_all_details() {
homePage.clickOnElectronics();
//To verify user is on electronics page
electronicsPage.verifyUserIsOnElectronicsPage();
//To click camera and photo
electronicsPage.userClicksOnCameraAndPhoto();
//To select product
cameraAndPhotoPage.selectProduct();
}
@When("User Clicks on send email button")
public void user_Clicks_on_send_email_button() {
//To click email a friend
productEmailAFriend.emailAFriend();
//To fill details
productEmailAFriendDetails.nonRegisterUserEnterFriendDetails();
}
@Then("User should able to see unsuccessful message")
public void user_should_able_to_see_unsuccessful_message() {
//To verify User should able to see error message -"Only registered customers can use email a friend feature"
nonRagisterUseremailResult.verifyNonRegisterUserSeeErrorMessage();
}
//Test case 5----->//To verify user should be able to sort product high to low by price
@When("User click on sort by filter and selects high to low filter")
public void user_click_on_sort_by_filter_and_selects_high_to_low_filter() {
//To click on books
homePage.clickBooks();
//To select short by filter for price high to low
bookPage.selectHighToLowFromShortByFilter();
}
@Then("User should able to see sorted product price from high to low.")
public void user_should_able_to_see_sorted_product_price_from_high_to_low() {
//To print price high to low
bookPage.verifyPriceHighToLowSorting();
}
//testcase 6------>Guest user should be able to checkout successfully
@When("User adds product in the cart")
public void user_adds_product_in_the_cart() {
//Click on book link
homePage.clickOnBooksLink();
//Click on add to cart
bookPage.clickOnAddToCart();
//Click on shopping cart
bookPage.clickOnShoppingCart();
//To accept on terms and condition
cartPage.checkTermsAndCondition();
}
@When("User checkout as a guest")
public void user_checkout_as_a_guest() {
//Click on checkout
cartPage.clickOnCheckout();
//Click on checkout as guest
checkoutAsGuest.clickOnCheckoutAsGuest();
}
@When("User fills all compulsory fields and clicks confirm")
public void user_fills_all_compulsory_fields_and_clicks_confirm() {
//To fill checkout details
fillCheckoutDetails.fillCheckoutDetails();
}
@Then("User should able to see successful order message")
public void user_should_able_to_see_successful_order_message() {
//To verify success message
checkoutResult.verifyCheckoutSuccessMessage();
}
//test case 7---------------->Guest user should able to add new comment on nope commerce website
@When("User selects product and add the comment")
public void user_selects_product_and_add_the_comment() {
//To click on view news archive
homePage.ClickOnViewNewsArchive();
//To click on details
newsPage.clickOnDetails();
}
@When("User clicks on New comment button")
public void user_clicks_on_New_comment_button() {
//To add new comment
newOnlineStoreIsOpenPage.addNewComment();
}
@Then("User should able to see successful message")
public void user_should_able_to_see_successful_message() {
//To verify New comment added
newOnlineStoreIsOpenPage.verifySuccessMessageOfComment();
}
//testcase-8------->User should able to change the currency and able to see all products price with changed currancy.
@When("User selects currency")
public void user_selects_currency() {
//To click on currency euro
homePage.clickCurrencyEuro();
}
@Then("User should able to see product prices with that currency symbol")
public void user_should_able_to_see_product_prices_with_that_currency_symbol() {
//To verify Euro sign
homePage.VerifyPriceHasEuroSign();
}
//test case 9-------> User should able to verify that Add to cart button is present on all homepage products
@Then("User should able to see Add to cart button on all homepage products")
public void user_should_able_to_see_Add_to_cart_button_on_all_homepage_products() {
//To verify add to cart is present in all featured products
homePage.verifyAddToCartPresentOnHomepageFeaturedItems();
}
//Scenario outline
@When("user clicks on {string} link from top menu")
public void user_clicks_on_link_from_top_menu(String category) {
homePage.clickOnCategoryLinks(category);
}
@Then("user should able to navigate to {string} successfully")
public void user_should_able_to_navigate_to_successfully(String related_category_page) {
Utils.assertURL((related_category_page));
}
}
| [
"nidhisoftwaretesting@gmail.com"
] | nidhisoftwaretesting@gmail.com |
266556d646b7f001245acdc1448d3aeb91975215 | e9f8dfe7ba3a684260610934e08d2570ca578744 | /source/1_JAVA/ch12_interface/src/com/lec/ex04_multi/TestClass.java | 529d9547f55a052b9b7b36880f1ee0138cafc826 | [] | no_license | cherryuki/bigdata | 87864d6058ae23d854c3b146d11dc7fc2bc3f8eb | 928a1a302977017c47724edb5b5a722484cdcfb4 | refs/heads/main | 2023-04-16T20:32:14.017057 | 2021-04-30T12:37:57 | 2021-04-30T12:37:57 | 317,099,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 347 | java | package com.lec.ex04_multi;
//20-12-09_interface ⓒcherryuki(ji)
//i1, i2, i3
public class TestClass implements I3 {
@Override
public void m1() {
System.out.println("상수 i1: "+i1);
}
@Override
public void m2() {
System.out.println("상수 i2: "+i2);
}
@Override
public void m3() {
System.out.println("상수 i3: "+i3);
}
}
| [
"cherry__love@naver.com"
] | cherry__love@naver.com |
35edaaf9e5c205f0703cd956d80b81e76054fd3b | 34c6ae0fd4243156c55d591127d24a3be8a4dda2 | /src/test/java/com/example/restspringapi/service/GroupServiceTest.java | 51da13697f14d4114181dbc6dd9f5672e872db2c | [] | no_license | OleksZamkovyi/RestSpringApi_2.0 | a2f2d1ca1c10d87a6b7a6b52824e7125e94fec37 | 32536a65073535e06c271a7d2a80b4ffb45fef9f | refs/heads/master | 2023-06-24T09:18:59.283307 | 2021-07-25T20:13:33 | 2021-07-25T20:13:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,961 | java | package com.example.restspringapi.service;
import com.example.restspringapi.dao.GroupDao;
import com.example.restspringapi.dao.StudentDao;
import com.example.restspringapi.model.Group;
import com.example.restspringapi.model.Student;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import java.util.List;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
class GroupServiceTest {
@Mock
private GroupDao groupDao;
@Mock
private StudentDao studentDao;
private GroupService underTest;
@BeforeEach
void setUp() {
underTest = new GroupService(groupDao, studentDao);
}
@Test
void canGetAllGroup() {
underTest.getAllGroup();
verify(groupDao).getAll();
}
@Test
void shouldThrowExceptionWhenDeletingGroupWithIdThatNotExist() {
given(groupDao.isGroupExistsById(1)).willReturn(false);
assertThatThrownBy(() -> underTest.deleteGroupById(1))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Groups with id 1 isn't exist");
}
@Test
void shouldThrowExceptionWhenDeletingGroupWithStudents() {
given(groupDao.isGroupExistsById(1)).willReturn(true);
given(studentDao.getStudentListByGroupId(1)).willReturn(List.of(new Student()));
assertThatThrownBy(() -> underTest.deleteGroupById(1))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Group with id 1 has student");
}
@Test
void canDeleteGroupById() {
given(groupDao.isGroupExistsById(1)).willReturn(true);
given(studentDao.getStudentListByGroupId(1)).willReturn(List.of());
underTest.deleteGroupById(1);
verify(groupDao).deleteById(1);
}
@Test
void shouldThrowExceptionIfGroupNullWhenAddNewGroup() {
assertThatThrownBy(() -> underTest.addNewGroup(null))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Group can't be null");
}
@Test
void shouldThrowExceptionIfGroupNameNullWhenAddNewGroup() {
Group group = new Group(1L, null);
assertThatThrownBy(() -> underTest.addNewGroup(group))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Name can't be null");
}
@Test
void shouldThrowExceptionIfGroupNameShortWhenAddNewGroup() {
Group group = new Group(1L, "1");
assertThatThrownBy(() -> underTest.addNewGroup(group))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(String.format("Name %s is to short", group.getName()));
}
@Test
void shouldThrowExceptionIfGroupNameExistWhenAddNewGroup() {
Group group = new Group(1L, "cs1");
given(groupDao.getGroupByName(group.getName())).willReturn(Optional.of(group));
assertThatThrownBy(() -> underTest.addNewGroup(group))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(String.format("Group with name %s is already exist", group.getName()));
}
@Test
void canAddNewGroup() {
Group group = new Group(1L, "cs1");
given(groupDao.getGroupByName(group.getName())).willReturn(Optional.empty());
underTest.addNewGroup(group);
verify(groupDao).save(group);
}
@Test
void shouldThrowExceptionIfGroupNullWhenUpdateGroup() {
assertThatThrownBy(() -> underTest.updateGroup(1, null))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining("Group can't be null");
}
@Test
void shouldThrowExceptionIfGroupDoesNotExistWhenUpdateGroup(){
Group group = new Group(1L, "cs1");
given(groupDao.getGroupById(group.getId())).willReturn(Optional.empty());
assertThatThrownBy(() -> underTest.updateGroup(group.getId(), group))
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(String.format("Group with id %s doesn't exist", group.getId()));
}
@Test
void canUpdateGroup(){
Group group = new Group(1L, "cs1");
given(groupDao.getGroupById(group.getId())).willReturn(Optional.of(group));
Group group1 = new Group(1L, "cs2");
underTest.updateGroup(group1.getId(), group1);
verify(groupDao).update(group1);
}
} | [
"2knzamkovyi@gmail.com"
] | 2knzamkovyi@gmail.com |
ab2b745032aa6f105d13d5ec87f05d399f2fb273 | 84a54c639ef62f1c6d81f830e2f545a0f45e73d5 | /src/main/java/com/will/design/demo/construction/service/impl/Decorator.java | f671a87f4bf5c801c1f75b55f85f7f49754d48c9 | [] | no_license | Will-M-Lee/design | e6c869f8bd2e272bdf3e382deeaaca854575cd50 | d9d426d4dd2eb6fe95b51e340c567ad8325a3ba6 | refs/heads/master | 2020-04-01T17:12:32.073066 | 2018-10-17T12:57:59 | 2018-10-17T12:57:59 | 153,418,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 818 | java | package com.will.design.demo.construction.service.impl;
import com.will.design.demo.construction.service.TargetableService;
/**
* @author will
*/
public class Decorator implements TargetableService {
private TargetableService targetableService;
public Decorator(TargetableService targetableService) {
super();
this.targetableService = targetableService;
}
@Override
public void method1() {
System.out.println("this is Decorator method1 before");
targetableService.method1();
System.out.println("this is Decorator method1 after");
}
@Override
public void method2() {
System.out.println("this is Decorator method2 before");
targetableService.method2();
System.out.println("this is Decorator method2 after");
}
}
| [
"willmlee@126.com"
] | willmlee@126.com |
468db7780016d1d1a54c06a432601c81a83f41b7 | 87bda6d015314eb8d943339d9bcb76e5b7bc4643 | /customplugin/src/customplugin/dropdown/internal/DropDownHandler.java | ee11de5a1332641767e8f6ca71d8847e86caf31a | [] | no_license | quocnh/customplugin | 8190e8aacd7b9e4bb5aceb91e34c5ea54ad400dc | 3e4d0a896a747afa1eae717b98bf2bdc2064956d | refs/heads/master | 2021-05-29T01:04:45.057558 | 2014-08-19T04:17:57 | 2014-08-19T04:17:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,641 | java | package customplugin.dropdown.internal;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
/**
* This class support make pull down button
* @author QUOC NGUYEN
*
*/
public class DropDownHandler extends AbstractHandler implements IHandler {
private static final String PARM_MSG = "customplugin.dropdown.msg";
@Override
public void addHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
String msg = event.getParameter(PARM_MSG);
if (msg == null) {
System.out.println("No message");
} else {
System.out.println("msg: " + msg);
System.out.println("Building...");
Process p;
// building app using cordova
try {
p = Runtime.getRuntime().exec("cmd.exe /C START E:\\run.bat");
p.waitFor();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean isHandled() {
// TODO Auto-generated method stub
return false;
}
@Override
public void removeHandlerListener(IHandlerListener handlerListener) {
// TODO Auto-generated method stub
}
}
| [
"QUOC NGUYEN@QUOCNGUYEN"
] | QUOC NGUYEN@QUOCNGUYEN |
690186c51675a8764ecb3c6cf31319cd41f4383d | c4d87aabb37fd4550ca7bae8204e121567c40750 | /inautomobile.java | 992cf3df72a94c24f39d958b3b670fd5f0c1bdfd | [] | no_license | PranjaliBhore/ThinkQuotient | 7c1026bd1ba657137f3de94026018cf26ec2f439 | 60baf761f7123410016a0e95e0c3cfbc78569dce | refs/heads/main | 2023-07-18T12:18:55.436927 | 2021-09-01T14:44:10 | 2021-09-01T14:44:10 | 401,027,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package javamorning;
public class inautomobile
{
private int speed;
private String colour;
public int getSpeed()
{
return speed;
}
public void setSpeed(int speed)
{
this.speed=speed;
}
public String getColour()
{
return colour;
}
public void setColour(String colour)
{
this.colour=colour;
}
static class bike extends inautomobile{
}
static class ktm extends bike{
}
public static void main(String args[])
{
ktm obj1=new ktm();
obj1.setSpeed(90);
obj1.setColour("orange");
System.out.println(obj1.getSpeed());
System.out.println(obj1.getColour());
System.out.println("this is ktm class");
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
27716326dbfe9fe560e0d2bb97f4fb172639b5c1 | 719372b8cd636ea2155b143eb6dd0a97c600789e | /src/main/java/top/cms/service/impl/PictureManagerServiceImpl.java | 2686eedfd83ce9ae9d93e936f6813e9bde669771 | [] | no_license | huachunwu/COM-SSM01 | da572f81b6067148f99fe192dc6ed513347f254e | 5d99f0fb4fa922993355006800f6b5fb9b8548fb | refs/heads/master | 2020-03-13T07:00:31.029634 | 2018-04-25T09:19:29 | 2018-04-25T09:19:29 | 131,016,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,781 | java | package top.cms.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.cms.bean.PictureList;
import top.cms.bean.PictureManager;
import top.cms.dao.PictureListMapper;
import top.cms.dao.PictureManagerMapper;
import top.cms.service.PictureManagerService;
import java.util.List;
/**
* 图片管理
* @author yhmi
*/
@Service
public class PictureManagerServiceImpl implements PictureManagerService {
@Autowired
private PictureManagerMapper pictureManagerMapper;
@Autowired
private PictureListMapper pictureListMapper;
@Override
public List<PictureManager> findPictureManager() {
return pictureManagerMapper.findPictureManager();
}
@Override
public PictureManager findPictureManagerByPName(PictureManager pictureManager) {
return pictureManagerMapper.findPictureManagerByPName(pictureManager);
}
@Override
public void insertPictureManager(PictureManager pictureManager) {
PictureManager pictureManagerByUser = pictureManagerMapper.findPictureManagerByPName(pictureManager);
String s="1";
if (pictureManager.getpName()!=null&&!pictureManager.getpName().trim().equals("")){
if (pictureManagerByUser==null){
System.out.println(pictureManager.getpState());
if (s.trim().equals(pictureManager.getpState().trim())){
pictureManagerMapper.updatePictureManagerAllPState();
pictureManagerMapper.insertPictureManager(pictureManager);
}else {
pictureManagerMapper.insertPictureManager(pictureManager);
}
}else{
System.out.println("用户已经存在");
}
}else{
System.out.println("你输入的名称为空!!!");
}
}
@Override
public PictureManager findPictureManagerByPid(String pId) {
return pictureManagerMapper.findPictureManagerByPid(pId);
}
@Override
public void editPictureManager(PictureManager pictureManager) {
if (pictureManager.getpState().equals("1")){
pictureManagerMapper.updatePictureManagerAllPState();
pictureManagerMapper.editPictureManager(pictureManager);
}else {
pictureManagerMapper.editPictureManager(pictureManager);
}
}
@Override
public void deletePictureManagerByPId(String pId) {
List<PictureList> pictureByPid = pictureListMapper.findPictureByPid(pId);
if (pictureByPid==null){
pictureManagerMapper.deletePictureManagerByPId(pId);
}else {
pictureListMapper.deletePictureListByPId(pId);
pictureManagerMapper.deletePictureManagerByPId(pId);
}
}
}
| [
"13181657631@163.com"
] | 13181657631@163.com |
efa1c920e2f34da9e4bdbcbcdcd4b256812d7d63 | 79b07265695ac0a082e10122aec730c4526e4f3a | /app/src/androidTest/java/com/examples/androidpractice12/ExampleInstrumentedTest.java | f39c856efed2268a0a8b9601d5d687c27e820fe3 | [] | no_license | Ywook/AndroidPractice12 | 3c903cfe4b91159ada2e270634e7a1e8e6f946ac | 29300a0807780c7dd9a94fefc9e1058c4e7a2c31 | refs/heads/master | 2021-01-23T06:35:32.803084 | 2017-06-05T04:50:58 | 2017-06-05T04:50:58 | 93,030,975 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.examples.androidpractice12;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.examples.androidpractice12", appContext.getPackageName());
}
}
| [
"cywibo@gmail.com"
] | cywibo@gmail.com |
de99bea3bb8f4ca5b2ebb1acc5b4341c17c209bc | 09b4e71b37ca4e5cf758c33cc1cfbb48fb283eb8 | /src/main/java/kanbanapp/payload/JWTSuccessResponse.java | db4ded05c1a1a223d7191e6c1ba0124ade757a55 | [] | no_license | dustincheung/KanbanApp | 164196fe2629bee5461e2882e8ee5a7022a84ab2 | fc0755051542b106da5703572a6f64c5e64cfe80 | refs/heads/master | 2022-12-03T02:54:19.930615 | 2020-08-05T16:15:42 | 2020-08-05T16:15:42 | 277,348,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | /*
* Response Object sent to client on successful authentication. Contains boolean success and the
* JSON web token that will be used in header of all requests.
*/
package kanbanapp.payload;
public class JWTSuccessResponse {
private String token;
private boolean success;
public JWTSuccessResponse(String token, boolean success) {
this.token = token;
this.success = success;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
@Override
public String toString() {
return "JWTSuccessResponse [token=" + token + ", success=" + success + "]";
}
}
| [
"dustincheung@Dustins-MBP.fios-router.home"
] | dustincheung@Dustins-MBP.fios-router.home |
7db24268c1cdcba756deb057ff0785b3cb78ebc9 | 9b98fdda197fcfb49f217b1836081902944bfece | /app/src/main/java/com/robot/tuling/base/BaseTalkActivity.java | 8ac2f8a362cc004ba99be360a5c1c061ba998597 | [] | no_license | IKtell/IK_TELL | 53c66c78d6f082dfeb28c9b10ae33fde35c0fda9 | ce9855a382a132fdaa62b9c742b9bb6aab024154 | refs/heads/master | 2020-03-17T01:08:22.984533 | 2018-05-13T06:53:19 | 2018-05-13T06:53:19 | 133,141,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | package com.robot.tuling.base;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.robot.tuling.R;
import com.robot.tuling.adapter.TalkAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public abstract class BaseTalkActivity extends AppCompatActivity {
@BindView(R.id.viewPager)
protected ViewPager mViewPager;
@BindView(R.id.ll_indicator)
protected LinearLayout mLlIndicator;
protected TalkAdapter mTalkAdapter;
protected List<Fragment> mFragmentList;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_base_talk);
ButterKnife.bind(this);
init();
}
private void init(){
mFragmentList = new ArrayList<>();
}
}
| [
"1653673717@qq.com"
] | 1653673717@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.