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
d8ec5aa555bdb647abba73adce230a81b3503a29
1d395f5a26dc56a9ddb0938cbc93c1be11ce8a43
/FormaEnvio/src/main/java/lsi/microservices/projeto2/FormaEnvio/FormaEnvioApplication.java
5627875043fdaa349b895c1a1db9d3b1d1aaae6d
[]
no_license
IsaquePorto/Microservices-Projeto-Exemplo
b837c2e49b0c4a2376db36cc4a2473389e73fcf8
adc2bcbd5480940a4e296f28818471a6f154c879
refs/heads/main
2023-05-30T10:23:37.985167
2021-06-20T14:58:16
2021-06-20T14:58:16
378,671,222
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package lsi.microservices.projeto2.FormaEnvio; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; @EnableDiscoveryClient @SpringBootApplication public class FormaEnvioApplication { public static void main(String[] args) { SpringApplication.run(FormaEnvioApplication.class, args); } }
12c0bfab4cdf3d0734d45ba99c71695c27d66e6f
6c2d83e1573306e7390cba38eab99adc8341eed8
/src/test/java/tests/OverviewListFullTests.java
25cc1f77237aa31d394493a9bd622334c21ead2a
[]
no_license
Sash77/Example_API_RA
4c2ecbc8836c2b533c05c0b3b57394e4f688b4cb
96cafb1dc84223514c8b995e004bdadde0e4e119
refs/heads/master
2020-05-19T19:28:55.557162
2019-09-20T08:55:53
2019-09-20T08:55:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,736
java
package tests; import api.EndPoints; import appmanager.TestBase; import appmanager.TestListener; import dataprovider.DataProviderDocument; import io.qameta.allure.Description; import model.entity.EntityRequest; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import java.io.IOException; import static io.qameta.allure.Allure.step; import static io.restassured.RestAssured.given; import static io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchemaInClasspath; import static org.hamcrest.Matchers.*; import static org.testng.Assert.assertEquals; @Listeners(TestListener.class) public class OverviewListFullTests extends TestBase { @Description("Overview list full positive") @Test(dataProvider = "validHeaderPositive", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullHeaderPositive(EntityRequest dataProvider) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { step(String.format("Test case: %s", dataProvider.getTestCase())); app.setCheck("Send request"); assertEquals(app.getHelperHTTPRequest().sendHeadersPost(dataProvider, EndPoints.overViewListFull), dataProvider.getCode()); } @Description("Overview list full negative") @Test(dataProvider = "validHeaderNegative", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullHeaderNegative(EntityRequest dataProvider) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { step(String.format("Test case: %s", dataProvider.getTestCase())); app.setCheck("Send request"); assertEquals(app.getHelperHTTPRequest().sendHeadersPost(dataProvider, EndPoints.overViewListFull), dataProvider.getCode()); } @Description("Overview list full json schema validation") @Test(dataProvider = "validOverviewJsonSchema", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullJsonSchema(EntityRequest dataProvider) { step(String.format("Test case: %s", dataProvider.getTestCase())); given(). spec(app.getSpecificationRequest().getRequestRegular()). body(app.getHelperHTTPRequest().getBodyInHashMap(dataProvider.getBody())). when(). post(EndPoints.overViewListFull). then(). assertThat(). body(matchesJsonSchemaInClasspath("schemaRawSchema.json")); } @Description("Overview list full well formed negative") @Test(dataProvider = "validOverviewWellFormedNegative", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullWellFormedNegative(EntityRequest dataProvider) { step(String.format("Test case: %s", dataProvider.getTestCase())); given(). spec(app.getSpecificationRequest().getRequestRegular()). body(String.format(dataProvider.getWellFormed(), app.getDocID())). when(). post(EndPoints.overViewListFull). then(). assertThat(). statusCode(dataProvider.getCode()); } @Description("Overview list full body positive") @Test(dataProvider = "validOverviewBodyPositive", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullBodyPositive(EntityRequest dataProvider) { step(String.format("Test case: %s", dataProvider.getTestCase())); given(). spec(app.getSpecificationRequest().getRequestRegular()). body(app.getHelperHTTPRequest().getBodyInHashMap(dataProvider.getBody())). when(). post(EndPoints.overViewListFull). then(). assertThat(). spec(app.getSpecificationResponse().getResponseRegular()). and(). body("messages", not(hasEntry("type", "ERROR"))). and(). body("id", equalTo(String.format("%s", app.getDocID()))). and(). body("type", is(in(app.getHelperHTTPRequest().getSchemaTypeList()))). and(). body("documentType", not(emptyOrNullString())); } @Description("Overview list full body negative") @Test(dataProvider = "validOverviewBodyNegative", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullBodyNegative(EntityRequest dataProvider) { step(String.format("Test case: %s", dataProvider.getTestCase())); given(). spec(app.getSpecificationRequest().getRequestRegular()). body(app.getHelperHTTPRequest().getBodyInHashMap(dataProvider.getBody())). when(). post(EndPoints.overViewListFull). then(). assertThat(). statusCode(dataProvider.getCode()). and(). body("id", emptyOrNullString()); } @Description("Overview list full null test") @Test(dataProvider = "validNullOverview", dataProviderClass = DataProviderDocument.class, alwaysRun = true) public void testOverviewListFullNullInBody(EntityRequest dataProvider) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException { step(String.format("Test case: %s", dataProvider.getTestCase())); app.setCheck("Send request"); assertEquals(app.getHelperHTTPRequest().sendNullInBodyPost(dataProvider, EndPoints.overViewListFull), dataProvider.getCode()); } }
b6ed99f6d7dffa849da5b72e3e762e43b83caf98
c9e5c79afdcb66ba74eb039cec838679e67637f8
/CucumberVerifyProject.java
1c0176e8cd4d80e435cad18c758adbdd56842dea
[]
no_license
rklama1992/implementing_Cucumber_And_Selenium
febf092ddc598d8cf739f10faec1b1b1a6e32212
d1c70969a1ee3b3f5fbcf96637c3e23601ec8e83
refs/heads/master
2022-02-22T10:24:02.418235
2019-09-17T00:30:09
2019-09-17T00:30:09
208,922,767
0
0
null
null
null
null
UTF-8
Java
false
false
9,711
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 cucumberverifyproject; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.sikuli.script.FindFailed; import org.sikuli.script.ImagePath; import org.sikuli.script.Key; import org.sikuli.script.Pattern; import org.sikuli.script.Screen; /** * * @author RLAMA */ public class CucumberVerifyProject { /** * @param args the command line arguments */ WebDriver driver; JavascriptExecutor jse; Screen myscreen; public static void main(String[] args) throws InterruptedException { // TODO code application logic here try { CucumberVerifyProject locate = new CucumberVerifyProject(); locate.loginNormally(); locate.loginUsingExcelSheet(); } catch(Exception e) { System.out.println("Error trying to login in both of the ways."); } } public void loginNormally() { try { invokeBrowser(); loginCommand(); loginInfo(); Thread.sleep(3000); updateInfo(); sikuliImageClass(); logout(); } catch(Exception e) { System.out.println("Error login.") ; } } public void loginUsingExcelSheet() { try { FacebookLoginWithExcel read = new FacebookLoginWithExcel( "C:\\Users\\rlama\\Documents\\ExcelData\\TestData.xlsx"); read.displayNumRows(0); read.getData(0, 0, 0); passData("rlama","Selenium"); Thread.sleep(5000); logout(); } catch(Exception e) { System.out.println("Error login"); } } public void invokeBrowser() { try { // String PROXY = "10.8.186.78:8080"; // setting up the IP Address and the port // org.openqa.selenium.Proxy prox = new org.openqa.selenium.Proxy(); // prox.setHttpProxy(PROXY).setFtpProxy(PROXY).setSslProxy(PROXY); // DesiredCapabilities cap = new DesiredCapabilities(); // cap.setCapability(CapabilityType.PROXY, prox); System.setProperty("webdriver.chrome.driver","C:\\Users\\rlama\\Desktop\\chromedriver.exe"); driver = new ChromeDriver(); jse = (JavascriptExecutor)driver; driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS); driver.get("https://www.facebook.com/"); } catch ( Exception e) { System.out.println("Error while trying to open the browser."); } } public void loginCommand() throws InterruptedException { try { driver.findElement(By.name("firstname")).sendKeys("Raj Kumar"); Thread.sleep(1000); driver.findElement(By.name("lastname")).sendKeys("Lama"); Thread.sleep(1000); driver.findElement(By.cssSelector("input#u_0_h")).sendKeys("[email protected]"); Thread.sleep(1000); driver.findElement(By.cssSelector("input#u_0_k")).sendKeys("[email protected]"); Thread.sleep(1000); driver.findElement(By.cssSelector("input#u_0_o")).sendKeys("Selenium123"); driver.findElement(By.cssSelector("input#u_0_a")).click(); Thread.sleep(1000); driver.findElement(By.id("month")).sendKeys("Jan"); Thread.sleep(1000); driver.findElement(By.id("day")).sendKeys("01"); Thread.sleep(1000); driver.findElement(By.id("year")).sendKeys("2000"); TakeShots.captureScreenShots(driver, "FacebookLoginPage"); driver.findElement(By.cssSelector("button#u_0_u")).click(); } catch(Exception e) { System.out.println("Error in loginCommand."); } } public String[][] passData(String username, String password) { invokeBrowser(); FacebookLoginWithExcel exelFile = new FacebookLoginWithExcel( "C:\\Users\\rlama\\Documents\\Raj's Folder\\FacebookLogin2Version\\ExcelDataSheet\\LoginData.xlsx"); int numRows = exelFile.displayNumRows(0); String [][]data = new String[numRows][2]; for(int i = 0; i< numRows; i++) { driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); driver.findElement(By.id("email")).sendKeys(username = data[i][0] = exelFile.getData(0, i, 0)); driver.findElement(By.id("pass")).sendKeys(password = data[i][1] = exelFile.getData(0, i, 1)); driver.findElement(By.id("loginbutton")).click(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); } return data; } public void loginInfo() { String title, urlInfo; title = driver.getTitle(); urlInfo = driver.getCurrentUrl(); System.out.println("The title of the page is: " + title); System.out.println("The URL of the website: " + urlInfo); } public void updateInfo() throws InterruptedException { try { driver.navigate().refresh(); Thread.sleep(2000); driver.findElement(By.name("q")).sendKeys("Mercury Marine"); Thread.sleep(2000); driver.findElement(By.name("q")).sendKeys(Keys.ENTER); Thread.sleep(2000); TakeShots.captureScreenShots(driver, "MercuryMarine"); driver.findElement(By.className("_32mo")).click(); Thread.sleep(3000); jse.executeScript("window.scrollBy(0,2000)"); TakeShots.captureScreenShots(driver, "Homepage"); Thread.sleep(2000); driver.findElement(By.className("_1vp5")).click(); Thread.sleep(4000); driver.findElement(By.className("_5yk2")).sendKeys("Hello world."); driver.findElement(By.xpath("//div[@class='_45wg _69yt']")).click(); Thread.sleep(2000); driver.findElement(By.className("_5yk2")).sendKeys("Welcome to automation Testing."); driver.findElement(By.xpath("//div[@class='_45wg _69yt']")).click(); Thread.sleep(2000); jse.executeScript("window.scrollTo(0,document.body.scrollHeight)"); TakeShots.captureScreenShots(driver, "updatedStatus"); // Thread.sleep(5000); // WebElement element = driver.findElement(By.id("u_0_a")); // jse.executeScript("argument[0].scrollIntoView(true);",element); Thread.sleep(2000); driver.findElement(By.id("u_0_c")).click(); Thread.sleep(2000); driver.findElement(By.id("findFriendsNav")).click(); Thread.sleep(2000); driver.findElement(By.name("q")).sendKeys("Dustin Balcerowisk"); driver.findElement(By.name("q")).sendKeys(Keys.ENTER); TakeShots.captureScreenShots(driver, "friendPage"); Thread.sleep(2000); driver.findElement(By.className("_1vp5")).click(); } catch(Exception e) { System.out.println("Error in updateInfo"); } } public void logout() throws InterruptedException { try { driver.findElement(By.id("userNavigationLabel")).click(); // logout button TakeShots.captureScreenShots(driver, "logoutPage"); Thread.sleep(3000); driver.findElement(By.xpath ("//li[@class='_54ni navSubmenu _6398 _64kz __MenuItem']//a[@class='_54nc']//span//span[@class='_54nh']")).click(); driver.close(); } catch(Exception e) { System.out.println("Error while logging out."); } } public void sikuliImageClass() { try { ImagePath.setBundlePath("C:\\Users\\rlama\\Documents\\Raj's Folder\\SikuliImages"); myscreen = new Screen(); Pattern timeline = new Pattern("timeline.PNG"); Pattern view = new Pattern("timelineView.PNG"); myscreen.wait(timeline,5); myscreen.click(timeline); myscreen.wait(3.0); driver.navigate().back(); myscreen.wait(2.0); myscreen.hover(view); myscreen.wait(1.0); myscreen.type(Key.DOWN); myscreen.wait(1.0); myscreen.type(Key.DOWN); myscreen.wait(1.0); myscreen.type(Key.ENTER); driver.navigate().refresh(); myscreen.wait(4.0); } catch(FindFailed e) { System.out.println("Did not find the image."); } } }
b95b87333da80653145cd90378990149412a6449
45fdc6fc4267f2288a8b71bb38897086da2685b0
/app/src/main/java/com/example/pesquisadepartes/MeuViewHolder.java
cb1380f5238ea9241ec687e002751fe6c19c26db
[]
no_license
JosueReis/Pesquisa-de-partes
6d807dee8473e606e1fd180cdd846a8d1a7e66aa
0e2d6d7ecff0ec499cd3c1bb149b961480c98563
refs/heads/master
2023-03-03T12:53:39.406766
2021-02-09T11:06:12
2021-02-09T11:09:43
334,922,190
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package com.example.pesquisadepartes; import android.view.View; import android.widget.ImageView; import androidx.recyclerview.widget.RecyclerView; public class MeuViewHolder extends RecyclerView.ViewHolder { ImageView imageView; public MeuViewHolder(View view) { super(view); imageView = (ImageView) view.findViewById(R.id.imageView ); } }
96b2e98933a82817024ecf0195b3d5a97e6db5ce
b9f9ebfccb6e52d6ad240bb686afdec1bdb0ce78
/chapter07/src/main/java/com/example/chapter07/provider/UserInfoContent.java
7310ce22a0bd0a3f9ca29a92114e5eeb72b8557a
[]
no_license
bugkill/myapp
0f47706edef69c6bc09e76d155e4af4193025cd6
d0a70b4785148dac6fad48a0b973769c97cd423d
refs/heads/master
2023-08-26T01:41:57.528944
2021-11-07T05:50:22
2021-11-07T05:50:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.example.chapter07.provider; import android.net.Uri; import android.provider.BaseColumns; import com.example.chapter07.database.UserDBHelper; public class UserInfoContent implements BaseColumns { // 这里的名称必须与AndroidManifest.xml里的android:authorities保持一致 public static final String AUTHORITIES = "com.example.chapter07.provider.UserInfoProvider"; // 内容提供器的外部表名 public static final String TABLE_NAME = UserDBHelper.TABLE_NAME; // 访问内容提供器的URI public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITIES + "/user"); // 下面是该表的各个字段名称 public static final String USER_NAME = "name"; public static final String USER_AGE = "age"; public static final String USER_HEIGHT = "height"; public static final String USER_WEIGHT = "weight"; public static final String USER_MARRIED = "married"; // 默认的排序方法 public static final String DEFAULT_SORT_ORDER = "_id desc"; }
32a6804c285dac97668ec5ec6eb93473736b4e41
454cbcdd6dd2a8c1a0debe1890dce10b033154c8
/SubServers.Host/src/net/ME1312/SubServers/Host/Event/SubAddHostEvent.java
a1952be0c167475aa4eae2241885975560da6ed8
[ "Apache-2.0" ]
permissive
treydun/SubServers-2
6895855f3798937af5b91755832206ce836c5447
ef1c59360713488d0b865282f74df0eb5ca0037e
refs/heads/master
2021-12-02T07:03:42.420393
2021-07-09T05:46:10
2021-07-09T05:46:10
192,621,070
1
0
null
2019-06-18T22:33:45
2019-06-18T22:33:45
null
UTF-8
Java
false
false
906
java
package net.ME1312.SubServers.Host.Event; import net.ME1312.Galaxi.Event.Event; import net.ME1312.Galaxi.Library.Util; import java.util.UUID; /** * Add Server Event */ public class SubAddHostEvent extends Event { private UUID player; private String host; /** * Server Add Event * * @param player Player Adding Server * @param host Host to be added */ public SubAddHostEvent(UUID player, String host) { if (Util.isNull(host)) throw new NullPointerException(); this.player = player; this.host = host; } /** * Gets the Host to be Added * * @return The Host to be Added */ public String getHost() { return host; } /** * Gets the player that triggered the Event * * @return The Player that triggered this Event or null if Console */ public UUID getPlayer() { return player; } }
ac079d5059bdee6b6c8d4a3708bfd8de58c39a66
53f2237c87202bf9648399f73e270a9466ede9c2
/udsservice/src/test/java/br/com/uds/udsservice/UdsserviceApplicationTests.java
05dccf21d1a5626d43c603574c3bce73aa20fe2a
[]
no_license
MYonemoto/UDS-teste
dd19c7fd14d0a0a29c422dab3694d866176b0d69
50be0ad9896161c75880c079cf6e55c9e219c825
refs/heads/master
2022-06-02T14:01:32.124774
2019-11-04T21:33:25
2019-11-04T21:33:25
219,356,294
0
0
null
2022-05-20T21:14:53
2019-11-03T19:48:27
Java
UTF-8
Java
false
false
217
java
package br.com.uds.udsservice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class UdsserviceApplicationTests { @Test void contextLoads() { } }
da7e8f0d6d2ea69d2f16b35806e222ac2d91c9eb
f51fd4021a721aca48148e4ac60828ec958d81bd
/Git/Primeira/src/PrimeiraAula.java
ff5934f3106a7cf56f4226389725dc8cfcd6edae
[]
no_license
MarcosAntfon/Primeira
c75ffb1b9b6441a4dd6588afa9a268ad3c2dc262
d02d8587ea81e79da24a3eb5c57ff1410daf162f
refs/heads/main
2023-07-27T14:56:23.703647
2021-08-31T15:20:21
2021-08-31T15:20:21
401,092,834
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
public class PrimeiraAula { public static void main(String[] args) { PrimeiraAula primeiraaula = new PrimeiraAula(); System.out.println(primeiraaula); /*int a = 5; int b = 9; int c = 6; System.out.println("Helo World! " + (a+b*c));*/ } }
494ff6063eb6e82d80f68bda6b466087aaa0ecd0
5df523c446f4892bda6427aedfe81c7bcd9d4f59
/wellmart-app/src/main/java/com/citt/wellmart/services/ShippingInfoService.java
9892454c6aa3da18eaf5d13e73a034a755a934db
[]
no_license
Amine-er/citt-wellmart
fda6a12d2058dd0b6e4c1dcc0dd5482151ceac24
1ff25d585819942bf9e3ccee5f941984b1cebffd
refs/heads/main
2023-06-20T09:37:28.274763
2021-07-12T19:27:34
2021-07-12T19:27:34
371,190,462
1
2
null
2021-06-23T11:57:18
2021-05-26T23:12:53
SCSS
UTF-8
Java
false
false
850
java
package com.citt.wellmart.services; import com.citt.wellmart.entities.ShippingInfo; import com.citt.wellmart.repositories.ShippingInfoRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class ShippingInfoService { @Autowired private ShippingInfoRepository shippingInfoRepository; public ShippingInfo saveShippingInfo(ShippingInfo shippingInfo) { return shippingInfoRepository.save(shippingInfo); } public ShippingInfo updateShippingInfo(ShippingInfo shippingInfo) {return shippingInfoRepository.save(shippingInfo); } public List<ShippingInfo> getAllShippingInfo() {return shippingInfoRepository.findAll();} public void deleteShippingInfoById(Long id) {shippingInfoRepository.deleteById(id);} }
57db449f414f5310654d46bebab144a0f12b47f8
ba92b0bdbfff934c3d613d82548046fbef12cad2
/app/src/main/java/com/veggietaler/customview/customview/LineChartView.java
1c0add6a5ee7728d88094893fce4cb50a3cd0704
[]
no_license
jicwiiaaa/CustomView
e1846af0ba3b08221aa540d399b8697e701bc908
2afa72e2daa6103c23e64310bb4b901b6941b314
refs/heads/master
2020-12-13T12:53:35.457261
2017-06-29T02:08:39
2017-06-29T02:08:39
95,403,442
0
0
null
null
null
null
UTF-8
Java
false
false
7,590
java
package com.veggietaler.customview.customview; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.CornerPathEffect; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * Created by liuliu on 2017/6/21. */ public class LineChartView extends View { private Paint mPaintCoordinate;//坐标线画笔 private Paint mPaintLine;//数据折线画笔 private Paint mPaintGrid;//网格线画笔 private Paint mPaintTextCoordinate;//横纵坐标文本说明画笔 private Paint mPaintTextScale;//横纵坐标刻度文本画笔 private Path mPath;//折线path对象 private float xPointX, xPointY;//横坐标说明文字的位置 private float yPointX, yPointY;//纵坐标说明文字的位置 private int viewSize; private float viewLeft, viewTop, viewRight, viewBottom; private String xLabel = "x轴"; private String yLabel = "y轴"; private List<PointF> pointFs = new ArrayList<>();//数据坐标 private int maxX, maxY;//横纵坐标最大值 private float spaceX, spaceY;//横纵轴坐标间隔 private float space;//定义一个距离大小 public LineChartView(Context context) { this(context, null); } public LineChartView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); initPaint(); initData(); } private void initData() { Random random = new Random(); pointFs = new ArrayList<PointF>(); for (int i = 0; i < 8; i++) { PointF pointF = new PointF(); pointF.x = (float) (random.nextInt(100) * i); pointF.y = (float) (random.nextInt(100) * i); pointFs.add(pointF); } } private void initPaint() { mPaintCoordinate = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mPaintCoordinate.setColor(Color.WHITE); mPaintCoordinate.setStyle(Paint.Style.STROKE); mPaintLine = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mPaintLine.setColor(Color.WHITE); mPaintLine.setStyle(Paint.Style.STROKE); mPaintLine.setPathEffect(new CornerPathEffect(25)); mPaintGrid = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mPaintGrid.setColor(Color.WHITE); mPaintGrid.setStyle(Paint.Style.STROKE); mPaintTextCoordinate = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mPaintTextCoordinate.setColor(Color.WHITE); mPaintTextScale = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); mPaintTextScale.setColor(Color.WHITE); mPath = new Path(); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { //目前宽高强制一致 super.onMeasure(widthMeasureSpec, widthMeasureSpec); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { viewSize = w; viewLeft = viewSize / 16; viewTop = viewSize / 16; viewRight = viewSize * 15 / 16; viewBottom = viewSize * 7 / 8; mPaintCoordinate.setStrokeWidth(viewSize / 128); mPaintLine.setStrokeWidth(viewSize / 128); mPaintGrid.setStrokeWidth(viewSize / 512); mPaintTextCoordinate.setTextSize(viewSize / 32); mPaintTextScale.setTextSize(viewSize * 3 / 128); xPointX = viewSize * 3 / 32; xPointY = viewSize / 16; yPointX = viewSize * 7 / 8; yPointY = viewSize * 15 / 16; space = viewSize / 128; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawColor(0xffcd782a); //画坐标轴 drawCoordinates(canvas); //画网格线 drawGrid(canvas); //画数据线 drawDataLine(canvas); } private void drawDataLine(Canvas canvas) { for (int i = 0; i < pointFs.size(); i++) { float pointX = pointFs.get(i).x / maxX * ((viewRight - viewLeft) * (pointFs.size() - 1) / pointFs.size()) + viewLeft; float pointY = viewBottom - pointFs.get(i).y / maxY * ((viewBottom - viewTop) * (pointFs.size() - 1) / pointFs.size()); if (i == 0) { mPath.moveTo(pointX, pointY); }else { mPath.lineTo(pointX, pointY); } } canvas.drawPath(mPath, mPaintLine); } private void drawGrid(Canvas canvas) { canvas.save(); //计算最大横坐标 maxX = 0; for (int i = 0; i < pointFs.size(); i++) { if (maxX < pointFs.get(i).x){ maxX = (int) pointFs.get(i).x; } } //计算横轴最近能被pointFs整除的数 int reminderX = maxX % (pointFs.size() - 1); maxX = reminderX == 0 ? maxX : maxX + (pointFs.size() - 1) - reminderX; //计算最大纵坐标 maxY = 0; for (int i = 0; i < pointFs.size(); i++) { if (maxY < pointFs.get(i).y){ maxY = (int) pointFs.get(i).y; } } //计算纵轴最近能被pointFs整除的数 int reminderY = maxY % (pointFs.size() - 1); maxY = reminderY == 0 ? maxY : maxY + (pointFs.size() - 1) - reminderY; spaceX = (viewRight - viewLeft) / pointFs.size(); spaceY = (viewBottom - viewTop) / pointFs.size(); int sc = canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), 75, Canvas.ALL_SAVE_FLAG); //画横网格线 for (float y = viewBottom - spaceY; y - viewTop >= 1; y -= spaceY){//y - viewTop >= 1,算余数时,会有小数偏差,+1来抵消 canvas.drawLine(viewLeft, y, viewRight - spaceX, y, mPaintLine); } //画纵网格线 for (float x = viewLeft + spaceX; x + 1 < viewRight; x += spaceX){//x + 1 < viewRight,算余数时,会有小数偏差,+1来抵消 canvas.drawLine(x, viewBottom, x, viewTop + spaceY, mPaintLine); } canvas.restoreToCount(sc); //画横坐标刻度 mPaintTextScale.setTextAlign(Paint.Align.CENTER); for (int i = 0; i < pointFs.size(); i++) { canvas.drawText(maxX / (pointFs.size() - 1) * i + "", viewLeft + spaceX * i, viewBottom - mPaintTextScale.ascent() + space, mPaintTextScale); } //或纵坐标刻度 mPaintTextScale.setTextAlign(Paint.Align.RIGHT); for (int i = 0; i < pointFs.size(); i++) { canvas.drawText(maxY / (pointFs.size() - 1) * i + "", viewLeft - space, viewBottom - spaceY * i, mPaintTextScale); } canvas.restore(); } private void drawCoordinates(Canvas canvas) { canvas.save(); canvas.drawLine(viewLeft, viewTop, viewLeft, viewBottom, mPaintCoordinate); canvas.drawLine(viewLeft, viewBottom, viewRight, viewBottom, mPaintCoordinate); canvas.drawText(xLabel, xPointX, xPointY, mPaintTextCoordinate); canvas.drawText(yLabel, yPointX, yPointY, mPaintTextCoordinate); canvas.restore(); } public synchronized void setData(List<PointF> pointFs, String labelX, String labelY){ this.pointFs = pointFs; this.xLabel = labelX; this.yLabel = labelY; invalidate(); } }
380569e5dfd25d8741c5fa1e58732467a38c68ef
34124019707ff6088291867e6949d7b209192154
/lab10/src/Subject.java
65a3a550fd29e46dcdb84670e27d6dd38446bd67
[]
no_license
BogdanBG2/POO
8cba80765810a1b959bdfb6e180dd786fbd009c3
cf0c1b4db053578864bf70b4fffda91db8130de9
refs/heads/main
2023-03-21T19:23:08.916483
2021-03-10T17:38:14
2021-03-10T17:38:14
346,103,883
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
public interface Subject { public void registerObserver(Observer o); public void unregisterObserver(Observer o); public void notifyObservers(String m); }
dfd963571a8560e1d70e9c82524447bbc9c0a319
3870918a7d61e468f49b786d7dd747646f6a305a
/app/src/main/java/android/collab/myapplication/data/LoginDataSource.java
a36fc4b3c4f186beadcdf818d581921b8aa52b04
[]
no_license
OrcaSuit/kakaosnslogin
3c84d458144914ce5b5848f3e6f7332e874ceadf
91b44f317d425c94779facb9288b18b449170fc5
refs/heads/master
2020-06-23T10:43:52.484310
2019-07-25T00:35:10
2019-07-25T00:35:10
198,599,889
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
package android.collab.myapplication.data; import android.collab.myapplication.data.model.LoggedInUser; import java.io.IOException; /** * Class that handles authentication w/ login credentials and retrieves user information. */ public class LoginDataSource { public Result<LoggedInUser> login(String username, String password) { try { // TODO: handle loggedInUser authentication LoggedInUser fakeUser = new LoggedInUser( java.util.UUID.randomUUID().toString(), "Jane Doe"); return new Result.Success<>(fakeUser); } catch (Exception e) { return new Result.Error(new IOException("Error logging in", e)); } } public void logout() { // TODO: revoke authentication } }
8394b8df9110c0fd8d3d3ccd9a56fe1a8f99b2f4
b92ea639759ef8fab0ca8fe772e2a933bf008d52
/src/main/java/co/alectronic/aome/iot/fitbit/FitbitJsonBody.java
9d5a52e8116f225133ee34fef32dfe6583303a49
[]
no_license
alectronic0/ProjectAome
cb88e734d95933d08c20acb4c3bed05138f30ced
03c1c55a81ba239d0d0f88ee00903bdde29e78eb
refs/heads/master
2023-05-13T13:14:37.396479
2017-12-04T21:47:37
2017-12-04T21:47:37
83,074,641
1
2
null
2023-04-29T01:32:41
2017-02-24T19:16:20
Java
UTF-8
Java
false
false
314
java
package co.alectronic.aome.iot.fitbit; import co.alectronic.aome.util.RestClient; import java.util.HashMap; /** * Created by alec on 24/02/17. */ public class FitbitJsonBody { public static HashMap<String,Object> getAuthHeader(String key){ return RestClient.getAuthHeader("Bearer",key); } }
09ea6c780f84e4ea2459e2b69d18c056859f23a7
4ebd82bdf25e84c7070614df2293765daffbdca5
/src/main/java/com/jh/dealer/app/config/DefaultProfileUtil.java
02e40b5dd00eaa151e1908824ae8831d70c57105
[]
no_license
jh7rnn/dealer-app
3b70e12c34d53309cf64c507835fb68223e4173c
b5d4c84b1b0e527f82785c769493c4f90a8e4810
refs/heads/master
2020-04-23T17:13:29.713978
2019-02-18T17:06:06
2019-02-18T17:06:06
171,323,487
0
0
null
null
null
null
UTF-8
Java
false
false
1,712
java
package com.jh.dealer.app.config; import io.github.jhipster.config.JHipsterConstants; import org.springframework.boot.SpringApplication; import org.springframework.core.env.Environment; import java.util.*; /** * Utility class to load a Spring profile to be used as default * when there is no <code>spring.profiles.active</code> set in the environment or as command line argument. * If the value is not available in <code>application.yml</code> then <code>dev</code> profile will be used as default. */ public final class DefaultProfileUtil { private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; private DefaultProfileUtil() { } /** * Set a default to use when no profile is configured. * * @param app the Spring application */ public static void addDefaultProfile(SpringApplication app) { Map<String, Object> defProperties = new HashMap<>(); /* * The default profile to use when no other profiles are defined * This cannot be set in the <code>application.yml</code> file. * See https://github.com/spring-projects/spring-boot/issues/1219 */ defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); app.setDefaultProperties(defProperties); } /** * Get the profiles that are applied else get default profiles. * * @param env spring environment * @return profiles */ public static String[] getActiveProfiles(Environment env) { String[] profiles = env.getActiveProfiles(); if (profiles.length == 0) { return env.getDefaultProfiles(); } return profiles; } }
e17f3e8f17ebd9b43319623e8e8ab578a443bce9
68920f4fdb442244cc471d96e2139bb2124931fd
/android_studio_study/version1.0/randomtest/app/src/test/java/org/techtown/randomtest/ExampleUnitTest.java
647bbb491beb3ee4288a5a36f70bc1ba971e8441
[]
no_license
alsrb2026/study
5fc96d83c2011d0725d9e28280a9877deda3f492
9dad94fabbbbfa284e68573244f952b28ddb96c7
refs/heads/master
2021-07-14T15:25:16.744835
2020-11-12T13:43:06
2020-11-12T13:43:06
222,710,296
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package org.techtown.randomtest; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
393578ad0d0949af5c156064249460084d3037dd
cc1fd71c39c4e688081512499c375e9e52b105f1
/src/main/java/com/yyx/interceptor/CustomerIdInterceptor.java
94c2c4160920debb2e9f2792b261a6cf0dabd5e4
[]
no_license
yunyexiao/Yummy
5098cee4b3f9f586bd69134a43ca8ad9bd76ef33
d7e5e47d1210f9081c82c0d48c71ec2dae1460c9
refs/heads/master
2022-12-21T08:37:59.889359
2019-05-21T04:00:03
2019-05-21T04:00:03
173,460,696
0
1
null
2022-12-15T23:45:35
2019-03-02T14:55:12
TSQL
UTF-8
Java
false
false
520
java
package com.yyx.interceptor; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class CustomerIdInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { return IdentityHelper.checkIdentity(request, response, "customer"); } }
2b9f052f310ecec18e816799dbd9cb858f56e81f
f4452c726e3cffd3ce891f200cfcfce483b5bc0d
/src/main/java/com/secure/service/demo/domain/Authority.java
471938964c2f1f3447e0bf1697cc85d0ef762cca
[]
no_license
llamkhan/firebase-rest-demo
9e29c7ad5e87dc1c8dd183362c39647b339c4ca7
5f29fffb04c9e6d84c570d868816344289a8ea7b
refs/heads/master
2020-09-08T01:12:29.245402
2019-11-11T11:36:20
2019-11-11T11:36:20
220,967,651
0
0
null
2020-01-31T18:25:21
2019-11-11T11:36:06
Java
UTF-8
Java
false
false
1,182
java
package com.secure.service.demo.domain; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.Objects; /** * An authority (a security role) used by Spring Security. */ @Document(collection = "jhi_authority") public class Authority implements Serializable { private static final long serialVersionUID = 1L; @NotNull @Size(max = 50) @Id private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Authority)) { return false; } return Objects.equals(name, ((Authority) o).name); } @Override public int hashCode() { return Objects.hashCode(name); } @Override public String toString() { return "Authority{" + "name='" + name + '\'' + "}"; } }
cefc521c29faf19af3859138d2b2d71113ef94f6
b7705781c21a31fcf549ca22d4683e83f4b91d5c
/src/Tablero.java
0363f46292c6bdcf4c46355cd0642929fa65dc36
[]
no_license
dementedapple5/TestTicTacToe
16ef634ab101828ec3645429757a11b17ad25aa5
4f12c15e8c7f957a6bb9df55a1b6c091c749dee6
refs/heads/master
2021-04-15T10:12:12.688350
2018-03-25T22:36:26
2018-03-25T22:36:26
126,746,276
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
public class Tablero { private Casilla[][] casillas; public Tablero(){ casillas = new Casilla[3][3]; initializeCasillas(); } public Casilla[][] getCasillas() { return casillas; } private void initializeCasillas() { for (int i = 0; i < casillas.length; i++) { for (int j = 0; j < casillas[i].length; j++) { casillas[i][j] = new Casilla(); } } } public boolean markCasilla(char value, Posicion pos) { try { return casillas[pos.getX()][pos.getY()].isEmpty() && casillas[pos.getX()][pos.getY()].setValue(value); }catch (ArrayIndexOutOfBoundsException e) { return false; } } }
8e67eff4ea8945d31a52ad39f0e59418ff168cd3
4da9dc7ef7b328f15e027830ae94f98847f8d0df
/chapter7th-demo2nd/licensing-service-c7d2/src/main/java/com/siwuxie095/spring/cloud/licenses/hystrix/DelegatingUserContextCallable.java
0159906f080dbffec031207fd31c0a2f65f670e2
[]
no_license
siwuxie095/spring-cloud-practice
7f4370097d314c759a2b7f2be2fd2b93da448af1
89b990aa41d6a239cf6e4513aa2e2d25bee4a54d
refs/heads/master
2023-06-17T11:51:51.190006
2021-07-10T11:37:47
2021-07-10T11:37:47
363,970,891
0
0
null
null
null
null
UTF-8
Java
false
false
1,764
java
package com.siwuxie095.spring.cloud.licenses.hystrix; import com.siwuxie095.spring.cloud.licenses.utils.UserContext; import com.siwuxie095.spring.cloud.licenses.utils.UserContextHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.Assert; import java.util.concurrent.Callable; /** * @author Jiajing Li * @date 2021-06-16 22:06:13 */ @SuppressWarnings("all") public final class DelegatingUserContextCallable<V> implements Callable<V> { private static final Logger logger = LoggerFactory.getLogger(DelegatingUserContextCallable.class); private final Callable<V> delegate; //private final UserContext delegateUserContext; private UserContext originalUserContext; public DelegatingUserContextCallable(Callable<V> delegate, UserContext userContext) { Assert.notNull(delegate, "delegate cannot be null"); Assert.notNull(userContext, "userContext cannot be null"); this.delegate = delegate; this.originalUserContext = userContext; } public DelegatingUserContextCallable(Callable<V> delegate) { this(delegate, UserContextHolder.getContext()); } @Override public V call() throws Exception { UserContextHolder.setContext(originalUserContext); try { return delegate.call(); } finally { this.originalUserContext = null; } } @Override public String toString() { return delegate.toString(); } public static <V> Callable<V> create(Callable<V> delegate, UserContext userContext) { return new DelegatingUserContextCallable<V>(delegate, userContext); } }
a25f1003b87d447609b2723172505f7e8b36c758
72c2db218f267e585f789d413119adace9e526e5
/leecode/src/learnalgorithm/algs4/Genome.java
fabd968aa4937b162e2b02043892d77274d2e92c
[]
no_license
mengxiangzhilan/JavaProj
c37a92430505af5806179aad7f25648b39ad2264
b33ea67dc1fb4b26fd8b5b3bd101b25d4065fd8b
refs/heads/master
2020-03-27T21:25:26.922632
2019-03-18T00:55:24
2019-03-18T00:55:24
147,142,582
0
0
null
null
null
null
UTF-8
Java
false
false
3,874
java
/****************************************************************************** * Compilation: javac Genome.java * Execution: java Genome - < input.txt (compress) * Execution: java Genome + < input.txt (expand) * Dependencies: BinaryIn.java BinaryOut.java * Data files: https://algs4.cs.princeton.edu/55compression/genomeTiny.txt * * Compress or expand a genomic sequence using a 2-bit code. * * % more genomeTiny.txt * ATAGATGCATAGCGCATAGCTAGATGTGCTAGC * * % java Genome - < genomeTiny.txt | java Genome + * ATAGATGCATAGCGCATAGCTAGATGTGCTAGC * ******************************************************************************/ package learnalgorithm.algs4; /** * The {@code Genome} class provides static methods for compressing * and expanding a genomic sequence using a 2-bit code. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/55compression">Section 5.5</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class Genome { // Do not instantiate. private Genome() { } /** * Reads a sequence of 8-bit extended ASCII characters over the alphabet * { A, C, T, G } from standard input; compresses them using two bits per * character; and writes the results to standard output. */ public static void compress() { Alphabet DNA = Alphabet.DNA; String s = BinaryStdIn.readString(); int n = s.length(); BinaryStdOut.write(n); // Write two-bit code for char. for (int i = 0; i < n; i++) { int d = DNA.toIndex(s.charAt(i)); BinaryStdOut.write(d, 2); } BinaryStdOut.close(); } /** * Reads a binary sequence from standard input; converts each two bits * to an 8-bit extended ASCII character over the alphabet { A, C, T, G }; * and writes the results to standard output. */ public static void expand() { Alphabet DNA = Alphabet.DNA; int n = BinaryStdIn.readInt(); // Read two bits; write char. for (int i = 0; i < n; i++) { char c = BinaryStdIn.readChar(2); BinaryStdOut.write(DNA.toChar(c), 8); } BinaryStdOut.close(); } /** * Sample client that calls {@code compress()} if the command-line * argument is "-" an {@code expand()} if it is "+". * * @param args the command-line arguments */ public static void main(String[] args) { if (args[0].equals("-")) compress(); else if (args[0].equals("+")) expand(); else throw new IllegalArgumentException("Illegal command line argument"); } } /****************************************************************************** * Copyright 2002-2018, Robert Sedgewick and Kevin Wayne. * * This file is part of algs4.jar, which accompanies the textbook * * Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne, * Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. * http://algs4.cs.princeton.edu * * * algs4.jar is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * algs4.jar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with algs4.jar. If not, see http://www.gnu.org/licenses. ******************************************************************************/
55b33abc91335c70b2bdf6b89467b6ad3e2f57db
833224a55e69f23c5c215bf9fd7218562ebaeec1
/src/main/java/leetcode/FindDuplicateNumber/Solution.java
982b7a7f9524f670e5ae2cf61c7e0ba1b5a5c623
[]
no_license
daisyligf/algorithms
f757a884d54fdc8391698e7354235f102c6f1ceb
8df36c346c7d2fb42c56d77663e02447552a1b45
refs/heads/master
2021-01-18T15:30:12.827804
2017-04-08T09:31:38
2017-04-08T09:31:38
86,658,118
0
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package leetcode.FindDuplicateNumber; import java.util.HashMap; import java.util.Map; /** * Created by daisyli on 2017/4/8. * Given an array nums containing n+1 integers where each integer is between 1 and n(inclusive), * prove that at least one duplicate number must exist. * Assume that there is only one duplicate number, find the duplicate one. */ public class Solution { public int findDuplicate(int[] nums) { if (nums == null || nums.length == 0 || nums.length == 1) { throw new RuntimeException("wrong input"); } if (nums.length == 2) { return nums[0]; } int[] extra = new int[nums.length]; Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < nums.length; i++) { Integer count = map.get(nums[i]); if (count != null) { return nums[i]; } else { map.put(nums[i], 1); } } throw new RuntimeException("wrong input"); } }
14efbe709a27b50747c71acb7897ac18a9345bce
ed7e662b8190aea88a63c6409ee390694ba1ebd9
/FinalGame/MouseInput.java
beeba297ea0a0d16ada40b23469e16ea40a13875
[]
no_license
jekn-lee/WarehouseBoss
23113463a633bfc094ef295008ef49fd48a7351a
d7b4f2093a3a2ab23685e8005feb5768166639aa
refs/heads/master
2021-01-20T01:04:06.323825
2017-05-27T01:54:30
2017-05-27T01:54:30
89,216,355
0
0
null
null
null
null
UTF-8
Java
false
false
5,402
java
import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; /** * MouseInput class to detect mouse presses/releases * * */ public class MouseInput implements MouseListener{ //For difficulty selection private final int EASY = 1; private final int MEDIUM= 2; private final int HARD = 3; //Pointer to game for updating GameBoard game; /** * Constructor for mouse input * @param game currently running */ public MouseInput(GameBoard game){ this.game = game; } @Override public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } /** * Action when mouse is pressed */ public void mousePressed(MouseEvent e) { int mX = e.getX(); int mY = e.getY(); STATE currState = game.getState(); System.out.println("X mouse: " +mX+"Y mouse: " +mY); System.out.println(game.getGameBoardWidth()/2+150); System.out.println(game.getGameBoardHeight()/2+130); switch(currState){ case MENU: if(mX<= game.getGameBoardWidth()/2+150 && mX>= game.getGameBoardWidth()/2-150){ if(mY>= game.getGameBoardHeight()/2-170 && mY<= game.getGameBoardHeight()/2-110) { game.setState(STATE.DIFFICULTY); game.repaint(); } else if(mY>=game.getGameBoardHeight()/2-20 && mY<= game.getGameBoardHeight()/2+130) { game.setState(STATE.HOWTOPLAY); game.repaint(); } else if(mY>=game.getGameBoardHeight()/2+130 && mY<= game.getGameBoardHeight()/2+280) { System.exit(1); } } break; case HOWTOPLAY: if(mX<= 125 && mX>= 50){ if(mY<= 750 && mY>= 675) { game.setState(STATE.MENU); game.repaint(); } }else if(mX>=game.getGameBoardWidth()/2+150 && mX<=game.getGameBoardWidth()/2+350){ if(mY<= 755 && mY>= 675) { game.setState(STATE.DIFFICULTY); game.repaint(); } } break; case SELECTION: if(mY>=game.getGameBoardHeight()/2-200 && mY<=game.getGameBoardHeight()/2){ if(mX>= 50 && mX<= 250) { game.setPredefNum(1); game.setMap(); game.setState(STATE.INGAME); game.repaint(); } else if(mX>=300 && mX<= 500) { game.setPredefNum(2); game.setMap(); game.setState(STATE.INGAME); game.repaint(); } else if(mX>=550 && mX<= 750) { game.setPredefNum(3); game.setMap(); game.setState(STATE.INGAME); game.repaint(); } }else if(mX>=game.getGameBoardWidth()/2-150 && mX<=game.getGameBoardWidth()/2+150){ if(mY>=game.getGameBoardHeight()/2+130 && mY<=game.getGameBoardHeight()/2+210){ game.setPredefNum(4); game.setMap(); game.setState(STATE.INGAME); game.repaint(); } }else if(mX<= 125 && mX>= 50){ if(mY<= 750 && mY>= 675) { game.setState(STATE.MENU); game.repaint(); } } break; case DIFFICULTY: if(mX<= game.getGameBoardWidth()/2+150 && mX>= game.getGameBoardWidth()/2-150){ if(mY>= game.getGameBoardHeight()/2-170 && mY<= game.getGameBoardHeight()/2-110) { game.setDifficulty(EASY); game.setState(STATE.SELECTION); game.repaint(); } else if(mY>=game.getGameBoardHeight()/2-20 && mY<= game.getGameBoardHeight()/2+130) { game.setDifficulty(MEDIUM); game.setState(STATE.SELECTION); game.repaint(); } else if(mY>=game.getGameBoardHeight()/2+130 && mY<= game.getGameBoardHeight()/2+280) { game.setDifficulty(HARD); game.setState(STATE.SELECTION); game.repaint(); } }else if(mX<= 125 && mX>= 50){ if(mY<= 750 && mY>= 675) { game.setState(STATE.MENU); game.repaint(); } } break; case INGAME: if(mY<= 60 && mY>= 10) { if (mX>=700 && mX<=750) { game.resetGame(); game.setState(STATE.MENU); game.repaint(); } else if (mX>=575 && mX<=675) { game.resetGame(); game.repaint(); } else if(game.undoPossible()){ if(mX>=450 && mX<=550){ game.undo(); game.repaint(); } } } break; case WIN: if(mX<=game.getGameBoardWidth()/2+150 && mX>= game.getGameBoardWidth()/2-150) { if (mY <= game.getGameBoardHeight()/2+80 && mY >= game.getGameBoardHeight()/2) { game.rerun(); game.setState(STATE.INGAME); game.repaint(); } }else if(mX<= 125 && mX>= 50){ if(mY<= 750 && mY>= 675) { game.setState(STATE.MENU); game.repaint(); } } break; } } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } }
e70990bb36e6d81553a0a200c9626145a375b584
e6d0968e5f28b6bdbae1b7495afefaad4c77be81
/erupt-annotation/src/main/java/xyz/erupt/annotation/sub_field/EditTypeMapping.java
89650795ec78b2c3e107ab61f7bf301e208e10ba
[ "Apache-2.0" ]
permissive
zhonghao611910/EruptManageSystem
8379752fb1a9a02976911306922285b19dc0f5d2
d1f4242b7fd532c8eb2685165bc9c39417450847
refs/heads/master
2023-04-14T09:04:43.210196
2021-03-30T07:12:48
2021-03-30T07:12:48
352,903,523
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package xyz.erupt.annotation.sub_field; import xyz.erupt.annotation.config.Empty; import xyz.erupt.annotation.config.JavaTypeEnum; import java.lang.annotation.*; /** * @author liyuepeng * @date 2019-05-24. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) @Documented public @interface EditTypeMapping { Class<? extends Annotation> mapping() default Empty.class; String desc() default ""; JavaTypeEnum[] allowType() default {}; boolean excelOperator() default true; String[] nameInfer() default {}; }
4037dda67dcadf20719acb79c0a3843df54683ca
77bcd3c74c9da6fbe1fb2d9f16638ec018ad47b1
/lab10/src/Example2/Cat.java
08e5e1609cad537a912e940e3094b7e026c32c5b
[]
no_license
MaiPhan20/lab10_java
96b3ecba41274f34c1c9ed5c0bca949bac730b7a
3e80b125b1875bc867f6efc03437d273fc63ba58
refs/heads/master
2022-12-19T16:58:52.247468
2020-10-26T04:33:45
2020-10-26T04:33:45
307,261,728
0
0
null
null
null
null
UTF-8
Java
false
false
141
java
package Example2; public class Cat extends Animal { @Override public void greeting() { System.out.println("Meow!"); } }
44ffb7d8ff0baa824fb4fedf4447bda7f95ef549
a8e932c59421e5d2e23631511025b9d234b39c32
/src/com/dora/gui/HotBar.java
2569d6630ac8be7168f27bcb4106f80cbd316de7
[]
no_license
ldkuba/DoraTheGodfather
9309634967505bcd1b7b9f8947cca4e69bd46858
113e7478d0a91aec3c6b911962990af88dc706e8
refs/heads/master
2021-01-25T09:38:26.945490
2017-06-11T12:29:03
2017-06-11T12:29:03
93,867,379
0
0
null
2017-06-11T11:38:12
2017-06-09T14:33:08
Java
UTF-8
Java
false
false
2,079
java
package com.dora.gui; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.SlickException; import com.dora.item.EmptyItem; import com.dora.item.Item; import com.dora.main.GameState; import com.dora.main.Main; public class HotBar extends GuiElement { private int x, y; private int height; private int slotWidth; private int slotNumber; private Image slotImage; private Image selectorImage; private int selectedId; private Item[] items; private GameContainer gc; private Main app; private GameState gameState; public HotBar(String name, float x, float y, int slotW, int h, GameContainer gc, Main app, int slotNumber, String slotImagePath, String selectorImagePath, GameState gs) { super(name); this.x = (int) x; this.y = (int) y; this.height = h; this.slotWidth = slotW; this.gc = gc; this.app = app; this.gameState = gs; this.selectedId = 0; this.slotNumber = slotNumber; try { slotImage = new Image(slotImagePath); }catch (SlickException e) { e.printStackTrace(); } try { this.selectorImage = new Image(selectorImagePath); }catch (SlickException e) { e.printStackTrace(); } items = new Item[slotNumber]; for(int i = 0; i < slotNumber; i++) { items[i] = new EmptyItem(); //- EmptySlot } } public void addItem(int x, Item item) { this.items[x] = item; } public void removeItem(int x) { this.items[x] = new EmptyItem(); } public void draw(GameContainer gc, Graphics g) { for(int i = 0; i < slotNumber; i++) { slotImage.draw(x + i*slotWidth, y, slotWidth, height); Item.itemImages[items[i].getId().ordinal()].draw(x + i*slotWidth, y, slotWidth, height); if(selectedId == i) { selectorImage.draw(x + i*slotWidth, y); } } } public Item getSelectedItem() { return items[selectedId]; } public void selectItem(int newId) { this.gameState.setCursor(GameState.cursors.standard); this.selectedId = newId; items[selectedId].onEquip(); } }
1a7f06a709c0da9cf5643d75140c1b3b647d4cff
e14249fddcfdc4ffeb0ca9ba34fa55c70251fb80
/src/main/java/com/movies/service/GeneriqueService.java
71cb2189506e0afc5dc67920778e02865b7f07c7
[]
no_license
slampas/exo_cinema
bbd9f6c551d5570941067db3958edcaeb98a6d1e
6e4db137cba771488014cacd12dae6d0844a7cd3
refs/heads/main
2023-05-14T01:32:50.435437
2021-06-02T14:45:47
2021-06-02T14:45:47
373,201,417
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package com.movies.service; import java.util.List; public interface GeneriqueService<T> { List<T> getAll() ; T getById(String id); T create(T t); T update(T t); void delete(String id); }
1a5026a3f4842de671b4b79591d7c913a72fb56c
1c0e03ce8e53915e689d15cdb11f42c4f04ae30b
/src/main/java/com/att/libs/executor/graph/impl/TaskGraph.java
421ab37c306e92d617bd978f060324aca136e296
[]
no_license
adeelmahmood/executor
b2ff951d0dc3cf2ef4e81adbfa52582cb8b2a4d7
ad98170ca9fc89b51ab448341950c8743f729104
refs/heads/master
2020-04-02T13:41:04.944340
2015-02-22T16:25:02
2015-02-22T16:25:02
31,169,266
0
0
null
null
null
null
UTF-8
Java
false
false
1,362
java
package com.att.libs.executor.graph.impl; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import com.att.libs.executor.graph.AbstractGraph; import com.att.libs.executor.graph.Node.NodeStatus; /** * TaskGraph provides graph implementation for * {@link TaskNode} nodes with an indexed graph * * @author aq728y * */ public class TaskGraph extends AbstractGraph<TaskNode>{ public TaskGraph(){ nodes = new ArrayList<TaskNode>(); } /** * Returns next node to process. IndexedGraph relies on * internal orderering of nodes based on an index number. * This methods returns the next unprocessed node based on * index number */ @Override public TaskNode getNextNode() { List<TaskNode> graphNodes = new ArrayList<TaskNode>(getNodes()); //sort by processing order number Collections.sort(graphNodes, new Comparator<TaskNode>(){ public int compare(TaskNode n1, TaskNode n2) { return -1*(n2.getOrder() - n1.getOrder()); } }); //find the first unprocessed node for(TaskNode node : graphNodes){ if(node.getStatus() == NodeStatus.NOT_PROCESSED){ return node; } } return null; } @Override public TaskNode getNode(TaskNode node) { List<TaskNode> graphNodes = new ArrayList<TaskNode>(nodes); return graphNodes.get(graphNodes.indexOf(node)); } }
b7008a6e65bfd397fbb2141dd9ce033849698ba0
2040cab85b2ea08aef0b3e49bb89a984f0f362c8
/MyScanner.java
756b2160b4e496076ed17cc8cbcff7243f87212c
[]
no_license
DevBerringer/Epidemic_Simulator
de109eaf4333543267c4a604939c4d21f91a3039
0a77fe33afaf9c874ed552092aa6c7472caecbf5
refs/heads/main
2023-02-09T12:38:54.764208
2021-01-05T10:36:19
2021-01-05T10:36:19
326,313,474
0
0
null
null
null
null
UTF-8
Java
false
false
5,537
java
import java.lang.NumberFormatException; import java.util.regex.Pattern; import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; /** * Wrapper or Adapter for Scanners that integrates error handling * @author Blake Berringer * @author Douglas Jones * @version 11/2/2020 * Status: Relatively stable code * @see java.util.Scanner * @see Error */ public class MyScanner { Scanner self; // the scanner this object wraps /** * Parameter carrier class for deferred string construction * used only for error message parameters to getXXX() methods */ public static interface ErrorMessage { String myString(); } // patterns for popular scannables, compiled just once static Pattern delimPat = Pattern.compile( "([ \t\r\n]|(//[\\S \t]*\n))*" ); // allow empty delimiters, and allow Java style comments static Pattern intPat = Pattern.compile( "-?[0-9]*" ); // integers static Pattern realPat = Pattern.compile( "-?\\d*\\.?\\d*(E(\\+|-)?\\d*)?" ); /** Construct a MyScanner to read from a file * @param f the file to read from * @throws FileNotFoundException if the file could not be read */ public MyScanner( File f ) throws FileNotFoundException { self = new Scanner( f ); } // methods we wish could inherit from Scanner but can't beause it's final // BUG -- to properly handle end of line delimiters, these need redefinition public boolean hasNext( String s ) { return self.hasNext( s ); } public boolean hasNextDouble() { return self.hasNextFloat(); } public boolean hasNextFloat() { return self.hasNextFloat(); } public boolean hasNextInt() { return self.hasNextInt(); } public String next( String s ) { return self.next( s ); } public float nextDouble() { return self.nextFloat(); } public float nextFloat() { return self.nextFloat(); } public int nextInt() { return self.nextInt(); } public String nextLine() { return self.nextLine(); } // redefined methods from class Scanner /** Is there a next token? * but first skip optional extended delimiters * @return true if there is a token, otherwise false */ public boolean hasNext() { self.skip( delimPat ); // skip the delimiter, if any return self.hasNext(); } /** Get the next token, * but first skip optional extended delimiters * @return the token as a string */ public String next() { self.skip( delimPat ); // skip the delimiter, if any return self.next(); } // new methods we add to this class /** Get the next string, if one is available * @param def the default value if no string is available * @param msg the error message to print if no string is available * @return the token as a String or the default */ public String getNext( String def, ErrorMessage msg ) { if (self.hasNext()) return self.next(); Error.warn( msg.myString() ); return def; } /** Get the next match to pattern, if one is available * @param pat the pattern string we are trying to match * @param def the default value if no match available * @param msg the error message to print if no match available * @return the token as a String or the default */ public String getNext( String pat, String def, ErrorMessage msg ) { self.skip( delimPat ); // skip the delimiter, if any self.skip( "(" + pat + ")?" ); // skip the pattern if present String next = self.match().group(); if (!next.isEmpty()) { // non-empty means next thing matched pat return next; } else { Error.warn( msg.myString() ); return def; } } /** Get the next double, if one is available * @param def the default value if no float is available * @param msg the error message to print if no double is available * @return the token as a double or the default */ public double getNextDouble( double def, ErrorMessage msg ) { self.skip( delimPat ); // skip the delimiter, if any self.skip( realPat ); // skip the float, if any String next = self.match().group(); try { return Double.parseDouble( next ); } catch ( NumberFormatException e ) { Error.warn( msg.myString() ); return def; } } /** Get the next float, if one is available * @param def the default value if no float is available * @param msg the error message to print if no float is available * @return the token as a float or the default */ public float getNextFloat( float def, ErrorMessage msg ) { self.skip( delimPat ); // skip the delimiter, if any self.skip( realPat ); // skip the float, if any String next = self.match().group(); try { return Float.parseFloat( next ); } catch ( NumberFormatException e ) { Error.warn( msg.myString() ); return def; } } /** Get the next int, if one is available * @param def the default value if no int is available * @param msg the error message to print if no int is available * @return the token as an int or the default */ public int getNextInt( int def, ErrorMessage msg ) { self.skip( delimPat ); // skip the delimiter, if any self.skip( intPat ); // skip the float, if any String next = self.match().group(); try { return Integer.parseInt( next ); } catch ( NumberFormatException e ) { Error.warn( msg.myString() ); return def; } } }
901a6b2937a12b857069779bf01141082d327dfb
c2ba7b1715aa0c023bae32ea1351cf069d9211fb
/app/src/main/java/com/cqu/shixun/tingwoshuo/model/myokhttp/callback/MyDownloadCallback.java
be84ab599d87600726cc724756588269eb39f93d
[ "Apache-2.0" ]
permissive
yzr0512/tingwoshuo
ea49f36a57def7a0d82e95085227e78da50892c3
d6c06eb9fba7e6a86c98f6e527b37772d537daeb
refs/heads/master
2020-03-22T07:38:16.033121
2018-07-11T16:01:12
2018-07-11T16:01:12
139,713,947
0
0
null
null
null
null
UTF-8
Java
false
false
5,863
java
package com.cqu.shixun.tingwoshuo.model.myokhttp.callback; import android.os.Handler; import android.os.Looper; import com.cqu.shixun.tingwoshuo.model.myokhttp.response.DownloadResponseHandler; import com.cqu.shixun.tingwoshuo.model.myokhttp.util.LogUtils; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import okhttp3.ResponseBody; /** * Created by tsy on 16/9/18. */ public class MyDownloadCallback implements Callback { private DownloadResponseHandler mDownloadResponseHandler; private String mFilePath; private Long mCompleteBytes; private static Handler mHandler = new Handler(Looper.getMainLooper()); public MyDownloadCallback(DownloadResponseHandler downloadResponseHandler, String filePath, Long completeBytes) { mDownloadResponseHandler = downloadResponseHandler; mFilePath = filePath; mCompleteBytes = completeBytes; } @Override public void onFailure(Call call, final IOException e) { LogUtils.e("onFailure", e); mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onFailure(e.toString()); } } }); } @Override public void onResponse(Call call, final Response response) throws IOException { ResponseBody body = response.body(); try { if (response.isSuccessful()) { //开始 mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onStart(response.body().contentLength()); } } }); try { if(response.header("Content-Range") == null || response.header("Content-Range").length() == 0){ //返回的没有Content-Range 不支持断点下载 需要重新下载 mCompleteBytes = 0L; } saveFile(response, mFilePath, mCompleteBytes); final File file = new File(mFilePath); mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onFinish(file); } } }); } catch (final Exception e) { if(call.isCanceled()) { //判断是主动取消还是别动出错 mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onCancel(); } } }); } else { LogUtils.e("onResponse saveFile fail", e); mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onFailure("onResponse saveFile fail." + e.toString()); } } }); } } } else { LogUtils.e("onResponse fail status=" + response.code()); mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onFailure("fail status=" + response.code()); } } }); } } finally { if(body != null) { body.close(); } } } //保存文件 private void saveFile(Response response, String filePath, Long completeBytes) throws Exception { InputStream is = null; byte[] buf = new byte[4 * 1024]; //每次读取4kb int len; RandomAccessFile file = null; try { is = response.body().byteStream(); file = new RandomAccessFile(filePath, "rwd"); if(completeBytes > 0L) { file.seek(completeBytes); } long complete_len = 0; final long total_len = response.body().contentLength(); while ((len = is.read(buf)) != -1) { file.write(buf, 0, len); complete_len += len; //已经下载完成写入文件的进度 final long final_complete_len = complete_len; mHandler.post(new Runnable() { @Override public void run() { if(mDownloadResponseHandler != null) { mDownloadResponseHandler.onProgress(final_complete_len, total_len); } } }); } } finally { try { if (is != null) is.close(); } catch (IOException e) { } try { if (file != null) file.close(); } catch (IOException e) { } } } }
83478c726fea8adcd31f7a4d5fed54a5d452b87d
a9e8e297de53f0c0447e406a8e8aa11ac675d612
/src/main/java/com/utils/interceptor/LogInterceptor.java
792d738e75939e88ca30b97260d900b8b61fb8a5
[]
no_license
kishaque1227/test2
01df7585512ff7952e9058513d595e034a81131e
04d84e6e4b0d6b00fb0ab291fba9953c4ab50554
refs/heads/master
2023-03-19T09:33:02.105675
2017-06-02T02:02:44
2017-06-02T02:02:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,706
java
package com.utils.interceptor; import com.entity.User; import com.utils.ExceptionUtil; import com.utils.StringUtil; import com.utils.annotation.Log; import com.utils.annotation.LogLevel; import com.utils.annotation.LogManage; import com.utils.annotation.LogModel; import org.apache.log4j.Logger; import org.springframework.core.NamedThreadLocal; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import java.lang.reflect.Method; import java.util.Calendar; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * 使用拦截器对系统进行日志记录并保存到数据库 */ public class LogInterceptor extends HandlerInterceptorAdapter { private static Logger log = Logger.getLogger(LogInterceptor.class); private NamedThreadLocal<Long> startTimeThreadLocal = new NamedThreadLocal<Long>("StopWatch-StartTime"); @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { User user = (User) request.getSession().getAttribute("now_user"); if (user != null) { long beginTime = System.currentTimeMillis();// 1、开始时间 startTimeThreadLocal.set(beginTime);// 线程绑定变量(该数据只有当前请求的线程可见) } return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { super.postHandle(request, response, handler, modelAndView); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { User user = (User) request.getSession().getAttribute("now_user"); if (!(handler instanceof HandlerMethod)) { return; } HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); final Log log = method.getAnnotation(Log.class); if (log != null && user != null) { String newString = StringUtil.getParseLog(log.desc(), request); boolean view = log.view(); String level = log.level().name(); String opeDesc = log.operationDesc(); if (view) { long endTime = System.currentTimeMillis(); long beginTime = startTimeThreadLocal.get(); long consumeTime = endTime - beginTime; String paras = request.getQueryString(); LogModel ul = new LogModel(); ul.setOperationDesc(opeDesc); ul.setCreateDate(Calendar.getInstance()); ul.setLoginIp(request.getRemoteAddr()); ul.setOperation(request.getRequestURI()); ul.setSpendTime(consumeTime); ul.setUserId(user.getId()); ul.setUserName(user.getUserName()); ul.setParas(paras); ul.setLevel(level); ul.setMessage(newString); if (ex != null) { ul.setError(ExceptionUtil.print(ex)); ul.setStatus(500); ul.setLevel(LogLevel.ERROR.name()); } else { ul.setStatus(200); } LogManage.getInstance().info(ul); } } } }
2930de19d88f7eed5f5c2df0b35a7e998e03999d
b585b51bac338ba319a192d9e7b10597a61a1952
/Gameholic/src/gameholic/dal/UsersDao.java
508db04071247a9f6bd40fb0a68bc072b1c403a5
[]
no_license
cwang114/5200final
c63f72b108b887034a8c2043d0dd1991e08b22ce
e18109c47f80a7da139f795da3119d2860678b77
refs/heads/master
2020-04-07T14:57:48.368391
2018-11-21T00:24:30
2018-11-21T00:24:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,654
java
package gameholic.dal; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import gameholic.model.Users; public class UsersDao { protected ConnectionManager connectionManager; // Single pattern: instantiation is limited to one object. private static UsersDao instance = null; protected UsersDao() { connectionManager = new ConnectionManager(); } public static UsersDao getInstance() { if(instance == null) { instance = new UsersDao(); } return instance; } /** * Save the Users instance by storing it in your MySQL instance. * This runs a INSERT statement. */ public Users create(Users user) throws SQLException { String insertPerson = "INSERT INTO Users(UserName, Password, FirstName, LastName, Phone, Email, Street1, Street2, City, State, ZipCode) VALUES(?,?,?,?,?,?,?,?,?,?,?);"; Connection connection = null; PreparedStatement insertStmt = null; ResultSet resultKey = null; try { connection = connectionManager.getConnection(); insertStmt = connection.prepareStatement(insertPerson, Statement.RETURN_GENERATED_KEYS); insertStmt.setString(1, user.getUserName()); insertStmt.setString(2, user.getPassword()); insertStmt.setString(3, user.getFirstName()); insertStmt.setString(4, user.getLastName()); insertStmt.setString(5, user.getPhone()); insertStmt.setString(6, user.getEmail()); insertStmt.setString(7, user.getStreet1()); insertStmt.setString(8, user.getStreet2()); insertStmt.setString(9, user.getCity()); insertStmt.setString(10, user.getState()); insertStmt.setString(11, user.getZipCode()); insertStmt.executeUpdate(); resultKey = insertStmt.getGeneratedKeys(); int reviewId = -1; if(resultKey.next()) { reviewId = resultKey.getInt(1); } else { throw new SQLException("Unable to retrieve auto-generated key."); } user.setUserId(reviewId); return user; } catch (SQLException e) { e.printStackTrace(); throw e; } finally { if(connection != null) { connection.close(); } if(insertStmt != null) { insertStmt.close(); } } } /** * Delete the Users instance. * This runs a DELETE statement. */ public Users delete(Users user) throws SQLException { String deletePerson = "DELETE FROM Users WHERE UserId=?;"; Connection connection = null; PreparedStatement deleteStmt = null; try { connection = connectionManager.getConnection(); deleteStmt = connection.prepareStatement(deletePerson); deleteStmt.setInt(1, user.getUserId()); deleteStmt.executeUpdate(); // Return null so the caller can no longer operate on the Users instance. return null; } catch (SQLException e) { e.printStackTrace(); throw e; } finally { if(connection != null) { connection.close(); } if(deleteStmt != null) { deleteStmt.close(); } } } /** * Get the Users record by fetching it from your MySQL instance. * This runs a SELECT statement and returns a single Users instance. */ public Users getUserByUserId(int userId) throws SQLException { String selectPerson = "SELECT UserId, UserName, Password, FirstName, LastName, Phone, Email, Street1, Street2, City, State, ZipCode FROM Users WHERE UserId=?;"; Connection connection = null; PreparedStatement selectStmt = null; ResultSet results = null; try { connection = connectionManager.getConnection(); selectStmt = connection.prepareStatement(selectPerson); selectStmt.setInt(1, userId); results = selectStmt.executeQuery(); if(results.next()) { int id = results.getInt("UserId"); String resultUserName = results.getString("UserName"); String passWord = results.getString("Password"); String firstName = results.getString("FirstName"); String lastName = results.getString("LastName"); String email = results.getString("Email"); String phone = results.getString("Phone"); String street1 = results.getString("Street1"); String street2 = results.getString("Street2"); String city = results.getString("City"); String state = results.getString("State"); String zipcode = results.getString("ZipCode"); Users user = new Users(id, resultUserName, passWord, firstName, lastName, phone, email, street1, street2, city, state, zipcode); return user; } } catch (SQLException e) { e.printStackTrace(); throw e; } finally { if(connection != null) { connection.close(); } if(selectStmt != null) { selectStmt.close(); } if(results != null) { results.close(); } } return null; } }
7ca2c71d7d69ee0b76479b52d7be8b8b7e6509e7
20ed4af9458d2653b7d6f5bc034aaf1f6db084ed
/app/src/main/java/com/brc/idauth/ui/mine/SearchSquareModle.java
e7f69ef4359ef132be0efaa3391fe3cf0608ab82
[ "Apache-2.0" ]
permissive
lixiaodaoaaa/ReadHeadIDCardDemo
054282069202200fa504ac65d66c17e5747428c6
632c3629ca048df6bdf4231895dfef41127b4cc4
refs/heads/master
2021-02-27T07:46:37.388527
2020-04-23T02:55:22
2020-04-23T02:55:22
245,593,096
8
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.brc.idauth.ui.mine; import com.daolion.net.response.SquareBean; import rx.Observable; public class SearchSquareModle implements SearchSquareContract.Model{ @Override public Observable<SquareBean> searchSquare(String searchStr,String page,String pageSize) { return apiService.searchSquare(searchStr,page,pageSize); } }
3f81a311b538bf92233242010c27cd103d7e65c8
b434eda50bf94ed860ab3ff9bfd319a2aa5cca20
/Midterm/app/src/main/java/com/example/zero/midterm/LoadData.java
7cfb6570c7f4e4901f599ba7a6deccbc548b9e05
[]
no_license
taisazero/ITCS-5180
f116f03a5ae0226417370cff9b3e0e5179e8a8c7
7e0c3e34abd79805d9d2b02e798726ce2af0682a
refs/heads/master
2020-05-23T08:28:00.250292
2019-05-14T19:51:07
2019-05-14T19:51:07
186,685,238
0
0
null
null
null
null
UTF-8
Java
false
false
4,517
java
package com.example.zero.midterm; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.util.ArrayList; import android.content.Intent; import android.os.AsyncTask; import android.speech.tts.Voice; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.Toast; //import org.apache.commons.io.IOUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.MissingFormatArgumentException; /** * * @author Erfan Al-Hossami * * @version 10/16/2017 */ public class LoadData extends AsyncTask<RequestParams,Void,String> { MainActivity m; static MovieAdapter adapter; public LoadData(MainActivity m){ this.m=m; Movie.favorites=new ArrayList<Movie>(); } @Override protected String doInBackground(RequestParams... requests) { String data=""; StringBuilder sb=null; if (Movie.results != null) { ArrayList<Movie> temp = new ArrayList<>(); for (Movie result : Movie.results) { if (result.isFavorite()) { temp.add(result); } } for (Movie Movie : temp) { Movie.favorites.add(Movie); } } Movie.results = new ArrayList<>(); try { HttpURLConnection connection=requests[0].setUpConnection(); connection.connect(); if(connection.getResponseCode()== HttpURLConnection.HTTP_OK) { // data= IOUtils.toString(connection.getInputStream(),"UTF-8"); BufferedReader br= new BufferedReader (new InputStreamReader(connection.getInputStream())); sb=new StringBuilder(); while((data=br.readLine())!=null){ sb.append(data); Log.d("data",data); } br.close(); JSONObject root=new JSONObject(sb.toString()); JSONArray r=root.getJSONArray("results"); Log.d("parsing 1","found "+r.length()+"Movies"); for(int i =0; i<r.length();i++){ JSONObject t=r.getJSONObject(i); Movie m=new Movie(); m.setName(t.getString("title")); m.setOverview(t.getString("overview")); m.setDate(t.getString("release_date")); m.setPopularity(t.getString("popularity")); m.setRating(t.getString("vote_average")); m.setPosterPath(t.getString("poster_path")); m.setsImageURL("http://image.tmdb.org/t/p/w154"+m.getPosterPath()); m.setlImageURL("http://image.tmdb.org/t/p/w342"+m.getPosterPath()); Movie.results.add(m); } } else { Log.d("Connection", "Connection Failed"); } } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return sb.toString(); } @Override protected void onPostExecute(String s) { for (Movie m : Movie.results) { Log.d("Movies",m.toString() ); } adapter = new MovieAdapter(m,Movie.results); m.list.setAdapter(adapter); if(Movie.results.size()==0){ Toast.makeText(m,"No results found",Toast.LENGTH_LONG).show(); } m.list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Log.d("ResultsActivity::", "List clicked"); Intent i = new Intent(m,MovieDetails.class); i.putExtra("position",position); m.startActivity(i); } }); //m.finish(); } public static void notifyStuff (){ adapter.notifyDataSetChanged(); } }
01bf35927927cc4a0b72934343af32583ac260b1
1e8f514229db4d1c15a75668cf4d6fccac22ca83
/src/main/java/com/github/lindenb/jvarkit/tools/biostar/Biostar3654.java
809a26552e64642eb12f279307a43891d6f3cbb6
[ "MIT" ]
permissive
ammar257ammar/jvarkit
58fb936aca2c7e1bbbd21e30c77edcd3fa5eba6e
1dfd4ec7e85294bf689a08a7afe451c68f689d99
refs/heads/master
2022-05-04T10:30:47.148406
2022-04-26T14:08:40
2022-04-26T14:08:40
216,183,678
0
0
NOASSERTION
2019-10-19T09:49:10
2019-10-19T09:49:09
null
UTF-8
Java
false
false
19,158
java
/* The MIT License (MIT) Copyright (c) 2022 Pierre Lindenbaum 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. History: * 2015 creation copied from http://plindenbaum.blogspot.fr/2010/11/blastxmlannotations.html */ package com.github.lindenb.jvarkit.tools.biostar; /* BEGIN_DOC ## Example ``` $ cat ~/jeter.blastn.xml <?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd"> <BlastOutput> (...) <Hit> <Hit_num>1</Hit_num> <Hit_id>gi|14971104|gb|AF338247.1|</Hit_id> <Hit_def>Human rotavirus A strain M clone M1 NSP3 genes, complete cds</Hit_def> <Hit_accession>AF338247</Hit_accession> <Hit_len>2032</Hit_len> <Hit_hsps> <Hsp> <Hsp_num>1</Hsp_num> ``` ``` $ java -jar dist/biostar3654.jar ~/jeter.blastn.xml 2> /dev/null | cut -c-${COLUMNS} QUERY: No definition line ID:Query_186611 Len:980 >Human rotavirus A strain M clone M1 NSP3 genes, complete cds AF338247 id:gi|14971104|gb|AF338247.1| len:2032 e-value:0 gap:0 bitScore:1764.98 QUERY 000000001 GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGC 000000050 |||||||||||||||||||||||||||||||||||||||||||||||||| HIT 000000001 GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGC 000000050 ################################################## source organi ################################## 5'UTR ################ CDS codon_sta QUERY 000000051 AGATGGTAAGCTCTATTATTAATACTTCTTTTGAAGCTGCAGTCGTTGCT 000000100 |||||||||||||||||||||||||||||||||||||||||||||||||| HIT 000000051 AGATGGTAAGCTCTATTATTAATACTTCTTTTGAAGCTGCAGTCGTTGCT 000000100 ################################################## source organi ################################################## CDS codon_sta (...) ``` END_DOC */ import gov.nih.nlm.ncbi.blast.Hit; import gov.nih.nlm.ncbi.blast.Hsp; import gov.nih.nlm.ncbi.blast.Iteration; import gov.nih.nlm.ncbi.insdseq.INSDFeature; import gov.nih.nlm.ncbi.insdseq.INSDFeatureIntervals; import gov.nih.nlm.ncbi.insdseq.INSDInterval; import gov.nih.nlm.ncbi.insdseq.INSDQualifier; import htsjdk.samtools.util.CloserUtil; import java.util.List; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.net.URL; import java.util.ArrayList; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLResolver; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParametersDelegate; import com.github.lindenb.jvarkit.lang.StringUtils; import com.github.lindenb.jvarkit.util.jcommander.Launcher; import com.github.lindenb.jvarkit.util.jcommander.Program; import com.github.lindenb.jvarkit.util.log.Logger; import com.github.lindenb.jvarkit.util.ncbi.NcbiApiKey; import com.github.lindenb.jvarkit.util.ncbi.NcbiConstants; /** BEGIN_DOC ## Example ``` $ cat ~/jeter.blastn.xml <?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd"> <BlastOutput> (...) <Hit> <Hit_num>1</Hit_num> <Hit_id>gi|14971104|gb|AF338247.1|</Hit_id> <Hit_def>Human rotavirus A strain M clone M1 NSP3 genes, complete cds</Hit_def> <Hit_accession>AF338247</Hit_accession> <Hit_len>2032</Hit_len> <Hit_hsps> <Hsp> <Hsp_num>1</Hsp_num> ``` ``` $ java -jar dist/biostar3654.jar ~/jeter.blastn.xml 2> /dev/null | cut -c-${COLUMNS} QUERY: No definition line ID:Query_186611 Len:980 >Human rotavirus A strain M clone M1 NSP3 genes, complete cds AF338247 id:gi|14971104|gb|AF338247.1| len:2032 e-value:0 gap:0 bitScore:1764.98 QUERY 000000001 GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGC 000000050 |||||||||||||||||||||||||||||||||||||||||||||||||| HIT 000000001 GGCTTTTAATGCTTTTCAGTGGTTGCTGCTCAAGATGGAGTCTACTCAGC 000000050 ################################################## source organi ################################## 5'UTR ################ CDS codon_sta QUERY 000000051 AGATGGTAAGCTCTATTATTAATACTTCTTTTGAAGCTGCAGTCGTTGCT 000000100 |||||||||||||||||||||||||||||||||||||||||||||||||| HIT 000000051 AGATGGTAAGCTCTATTATTAATACTTCTTTTGAAGCTGCAGTCGTTGCT 000000100 ################################################## source organi ################################################## CDS codon_sta (...) ``` END_DOC */ @Program(name="biostar3654", description="show blast alignment with annotations", biostars=3654, keywords={"blast","xml","annotation"}) public class Biostar3654 extends Launcher { private static final Logger LOG=Logger.build(Biostar3654.class).make(); @SuppressWarnings("unused") private static final gov.nih.nlm.ncbi.blast.ObjectFactory _fool_javac1=null; @SuppressWarnings("unused") private static final gov.nih.nlm.ncbi.insdseq.ObjectFactory _fool_javac2=null; private PrintWriter pw=null; /** left margin */ private int margin=9; @Parameter(names={"-o","--out"},description=OPT_OUPUT_FILE_OR_STDOUT) private File outputFile=null; /** length of a fasta line */ @Parameter(names={"-L","--length"},description="Fasta Line kength") private int fastaLineLength=50; @ParametersDelegate private NcbiApiKey ncbiApiKey = new NcbiApiKey(); /** XML input factory */ private XMLInputFactory xif; /** transforms XML/DOM to GBC entry */ private Unmarshaller unmarshaller; /** abstract class writing the line of an alignment */ private abstract class AbstractHspPrinter { /** index in sequence for this line*/ int seqStart; /** end of sequence for this line */ int seqEnd; /** forward/reverse */ int sign; /** index in alignment string */ int stringStart; /** end index in alignment string */ int stringEnd; /** current HSP */ protected Hsp hsp; /** features to be printed */ private List<INSDFeature> features; /** get sequence to be displayed */ public abstract String getSequence(); /** get starting index of the sequence */ public abstract int getSeqFrom(); /** get end index of the sequence */ public abstract int getSeqTo(); protected AbstractHspPrinter( Hsp hsp, List<INSDFeature> features) { this.hsp=hsp; this.features=features; this.sign= (getSeqFrom()< getSeqTo()?1:-1); this.seqStart=getSeqFrom(); this.seqEnd=this.seqStart; this.stringStart=0; this.stringEnd=0; } /** can we print another line ? yes ? init the data */ boolean next() { if(this.stringEnd>=getSequence().length()) return false; this.seqStart=this.seqEnd; this.stringStart=this.stringEnd; for(int i=0;i< fastaLineLength && this.stringStart+i< getSequence().length(); ++i) { if(Character.isLetter(getSequence().charAt(this.stringStart+i))) { this.seqEnd+=this.sign; } this.stringEnd++; } return true; } /** print the line */ void print() { /* loop over the feature */ for(final INSDFeature feature:this.features) { if(feature.getINSDFeatureIntervals()==null) continue; if(feature.getINSDFeatureIntervals().getINSDInterval()==null) continue; //loop over the coordinates for(final INSDInterval interval:feature.getINSDFeatureIntervals().getINSDInterval()) { int intervalFrom=0; int intervalTo=0; //is it an interval ? if( interval.getINSDIntervalFrom()!=null && interval.getINSDIntervalTo()!=null ) { intervalFrom = Integer.parseInt(interval.getINSDIntervalFrom()); intervalTo = Integer.parseInt(interval.getINSDIntervalTo()); } //is it a single point ? else if(interval.getINSDIntervalPoint()!=null && (intervalFrom=Integer.parseInt(interval.getINSDIntervalPoint()))>=this.seqStart && intervalFrom< this.seqEnd ) { intervalFrom = Integer.parseInt(interval.getINSDIntervalPoint()); intervalTo = intervalFrom; } else { continue; } if(intervalFrom> intervalTo) { int tmp=intervalFrom; intervalFrom=intervalTo; intervalTo=tmp; } intervalTo++; if(intervalFrom>this.seqEnd) continue; if(intervalTo<this.seqStart) continue; //margin left Biostar3654.this.pw.printf(" %"+margin+"s ",""); //trim the positions intervalFrom=Math.max(this.seqStart,intervalFrom); intervalTo=Math.min(this.seqEnd,intervalTo); int genome=this.seqStart; //loop over the line for( int i=0;i< fastaLineLength && this.stringStart+i< this.stringEnd; ++i) { boolean isSeq=Character.isLetter(getSequence().charAt(this.stringStart+i)); boolean isGap=hsp.getHspMidline().charAt(this.stringStart+i)==' '; //in the feature if(intervalFrom<=genome && genome< intervalTo) { Biostar3654.this.pw.print(isSeq?(isGap?":":"#"):"-"); } else //not in the feature { Biostar3654.this.pw.print(" "); } //extends the current position if current char is a base/aminoacid if(Character.isLetter(getSequence().charAt(this.stringStart+i))) { genome+=this.sign; } } Biostar3654.this.pw.print(" "); Biostar3654.this.pw.print(feature.getINSDFeatureKey()); //Biostar3654.this.pw.print(" "); //Biostar3654.this.pw.print(feature.getINSDFeatureLocation());//no because using seq_start & seq_stop with efetch change this //print the infos if( feature.getINSDFeatureQuals()!=null && feature.getINSDFeatureQuals().getINSDQualifier()!=null ) { for(final INSDQualifier qual:feature.getINSDFeatureQuals().getINSDQualifier()) { Biostar3654.this.pw.print(" "); Biostar3654.this.pw.print(qual.getINSDQualifierName()); Biostar3654.this.pw.print(":"); Biostar3654.this.pw.print(qual.getINSDQualifierValue()); } } Biostar3654.this.pw.println(); } } } } /** specialized AbstractHspPrinter for the QUERY */ private class QPrinter extends AbstractHspPrinter { QPrinter( Hsp hsp, List<INSDFeature> features) { super(hsp,features); } @Override public int getSeqFrom() { return Integer.parseInt(this.hsp.getHspQueryFrom()); } @Override public int getSeqTo() { return Integer.parseInt(this.hsp.getHspQueryTo()); } public String getSequence() { return this.hsp.getHspQseq(); } } /** specialized AbstractHspPrinter for the HIT */ private class HPrinter extends AbstractHspPrinter { HPrinter( Hsp hsp, List<INSDFeature> features) { super(hsp,features); } @Override public int getSeqFrom() { return Integer.parseInt(this.hsp.getHspHitFrom()); } @Override public int getSeqTo() { return Integer.parseInt(this.hsp.getHspHitTo()); } public String getSequence() { return this.hsp.getHspHseq(); } } /** fetches the annotation for a given entry if the name starts with gi|.... */ private List<INSDFeature> fetchAnnotations( final String database, final String acn,int start,int end) throws Exception { InputStream in=null; XMLEventReader r=null; final List<INSDFeature> L=new ArrayList<INSDFeature>(); if(start>end) return fetchAnnotations(database,acn,end,start); try { if(acn!=null && !acn.isEmpty() && !acn.startsWith("Query")) { String uri= NcbiConstants.efetch()+"?db="+database+ "&id="+StringUtils.escapeHttp(acn)+ "&rettype=gbc&retmode=xml&seq_start="+start+"&seq_stop="+end+ this.ncbiApiKey.getAmpParamValue() ; LOG.info(uri); in = new URL(uri).openStream(); r=this.xif.createXMLEventReader(in); while(r.hasNext()) { XMLEvent evt=r.peek(); if(evt.isStartElement() && evt.asStartElement().getName().getLocalPart().equals("INSDFeature")) { INSDFeature feature = this.unmarshaller.unmarshal(r, INSDFeature.class).getValue(); INSDFeatureIntervals its = feature.getINSDFeatureIntervals(); if(its==null || its.getINSDInterval().isEmpty()) continue; for(INSDInterval interval:its.getINSDInterval()) { //when using seq_start and seq_stop , the NCBI shifts the data... if( interval.getINSDIntervalFrom()!=null && interval.getINSDIntervalTo()!=null) { interval.setINSDIntervalFrom(String.valueOf(Integer.parseInt(interval.getINSDIntervalFrom())+start-1)); interval.setINSDIntervalTo(String.valueOf(Integer.parseInt(interval.getINSDIntervalTo())+start-1)); } else if( interval.getINSDIntervalPoint()!=null) { interval.setINSDIntervalPoint(String.valueOf(Integer.parseInt(interval.getINSDIntervalPoint())+start-1)); } } L.add(feature); } else { r.next();//consumme } } } } catch(Exception err) { LOG.error(err); } finally { CloserUtil.close(r); CloserUtil.close(in); } LOG.info("N(INSDFeature)="+L.size()); //not found, return empty table return L; } /** parses BLAST output */ private void parseBlast(XMLEventReader r) throws Exception { String database="nucleotide"; while(r.hasNext()) { XMLEvent evt=r.peek(); if(evt.isStartElement() && evt.asStartElement().getName().getLocalPart().equals("BlastOutput_program")) { r.next(); String BlastOutput_program = r.getElementText(); if("blastn".equals(BlastOutput_program)) { database="nucleotide"; } else if("blastp".equals(BlastOutput_program) ) { database="protein"; } else { throw new IOException("only blastn && blastn are supported: "+database); } } else if(evt.isStartElement() && evt.asStartElement().getName().getLocalPart().equals("Iteration")) { Iteration iteration= this.unmarshaller.unmarshal(r, Iteration.class).getValue(); parseIteration(database,iteration); } else { r.next();//consumme } } } private void parseIteration(String database,Iteration iteration) throws Exception { this.pw.println("QUERY: "+iteration.getIterationQueryDef()); this.pw.println(" ID:"+iteration.getIterationQueryID()+" Len:"+iteration.getIterationQueryLen()); for(Hit hit:iteration.getIterationHits().getHit()) { this.pw.println(">"+hit.getHitDef()); this.pw.println(" "+hit.getHitAccession()); this.pw.println(" id:"+hit.getHitId()+" len:"+hit.getHitLen()); for(Hsp hsp :hit.getHitHsps().getHsp()) { List<INSDFeature> qFeatures= fetchAnnotations( database, iteration.getIterationQueryID(), Integer.parseInt(hsp.getHspQueryFrom()), Integer.parseInt(hsp.getHspQueryTo()) ); List<INSDFeature> hFeatures= fetchAnnotations( database, hit.getHitAccession(), Integer.parseInt(hsp.getHspHitFrom()), Integer.parseInt(hsp.getHspHitTo()) ); this.pw.println(); this.pw.println(" e-value:"+hsp.getHspEvalue()+" gap:"+hsp.getHspGaps()+" bitScore:"+hsp.getHspBitScore()); this.pw.println(); //create the Printer for the Query and the Hit QPrinter qPrinter=new QPrinter(hsp,qFeatures); HPrinter hPrinter=new HPrinter(hsp,hFeatures); //loop over the lines while(qPrinter.next() && hPrinter.next()) { qPrinter.print(); this.pw.printf("QUERY %0"+margin+"d ",qPrinter.seqStart); this.pw.print(hsp.getHspQseq().substring(qPrinter.stringStart,qPrinter.stringEnd)); this.pw.printf(" %0"+margin+"d",qPrinter.seqEnd-(qPrinter.sign)); this.pw.println(); this.pw.printf(" %"+margin+"s ",""); this.pw.print(hsp.getHspMidline().substring(qPrinter.stringStart,qPrinter.stringEnd)); this.pw.println(); this.pw.printf("HIT %0"+margin+"d ",hPrinter.seqStart); this.pw.print(hsp.getHspHseq().substring(hPrinter.stringStart,hPrinter.stringEnd)); this.pw.printf(" %0"+margin+"d",hPrinter.seqEnd-(hPrinter.sign)); this.pw.println(); hPrinter.print(); this.pw.println(); } this.pw.flush(); } } //System.err.println("OK"); } @Override public int doWork(final List<String> args) { if(!this.ncbiApiKey.isApiKeyDefined()) { LOG.error("NCBI API key is not defined"); return -1; } try { //create a Unmarshaller for genbank JAXBContext jc = JAXBContext.newInstance( "gov.nih.nlm.ncbi.insdseq:gov.nih.nlm.ncbi.blast"); this.unmarshaller=jc.createUnmarshaller(); this.xif=XMLInputFactory.newFactory(); this.xif.setXMLResolver(new XMLResolver() { @Override public Object resolveEntity(String publicID, String systemID, String baseURI, String namespace) throws XMLStreamException { return new ByteArrayInputStream(new byte[0]); } }); this.pw = super.openFileOrStdoutAsPrintWriter(this.outputFile); //read from stdin if(args.isEmpty()) { XMLEventReader r=this.xif.createXMLEventReader(stdin(), "UTF-8"); this.parseBlast(r); r.close(); } else { //loop over the files for(String inputName:args) { LOG.info("Reading "+inputName); FileReader fr=new java.io.FileReader(inputName); XMLEventReader r=this.xif.createXMLEventReader(fr); this.parseBlast(r); r.close(); fr.close(); } } pw.flush(); return 0; } catch(Throwable err) { LOG.error(err); return -1; } finally { CloserUtil.close(this.pw); } } /** * @param args */ public static void main(String[] args) { new Biostar3654().instanceMainWithExit(args); } }
5bdda04e8d511ea8632558e1661be84fef9683b5
e8eca46970c994d0476e4b2d583a07840e63e15b
/plugins/demo-plugin-author/src/main/java/demo/sbp/author/AuthorPlugin.java
09a6ce7251783e516ec3b906d28496b1ecc17ba6
[ "Apache-2.0" ]
permissive
hank-cp/sbp
d39a9668033e57b59ea27c393c1b2f81f7a0b66a
33b680a38b7356559029de45404c7f05af15d810
refs/heads/master
2023-07-07T02:04:04.761756
2023-07-03T14:42:29
2023-07-03T14:42:29
196,934,638
139
55
Apache-2.0
2020-12-22T08:59:03
2019-07-15T06:06:58
Java
UTF-8
Java
false
false
1,380
java
/* * Copyright (C) 2019-present the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package demo.sbp.author; import org.laxture.sbp.SpringBootPlugin; import org.laxture.sbp.spring.boot.SpringBootstrap; import org.laxture.sbp.spring.boot.configurer.SbpDataSourceConfigurer; import org.laxture.sbp.spring.boot.configurer.SbpSharedServiceConfigurer; import org.pf4j.PluginWrapper; /** * @author <a href="https://github.com/hank-cp">Hank CP</a> */ public class AuthorPlugin extends SpringBootPlugin { public AuthorPlugin(PluginWrapper wrapper) { super(wrapper, new SbpDataSourceConfigurer(), new SbpSharedServiceConfigurer()); } @Override protected SpringBootstrap createSpringBootstrap() { return new SpringBootstrap(this, AuthorPluginStarter.class) .importBean("bookService"); } }
e40aa5fc1545ae73fb78ce17dbf100ddbbba15b3
53d66ab5a6762dc0c9f3baa6988a2404f9c4729f
/All program2/src/com/ms/generalization/vehical/TestVehicle.java
bcd9348e317cebe6d3cad73035d06919108d0ee3
[]
no_license
monika8877/java
c20ebfde005ab3eac8357c5fd0b4f6d2c28feec1
e1c8b44b157da47886a425741c8ea95ab2fc501c
refs/heads/master
2020-03-15T03:07:10.281588
2018-05-03T03:23:43
2018-05-03T03:23:43
131,934,947
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.ms.generalization.vehical; public class TestVehicle { public static void main(String[] args) { Car c = new Car(); c.brand = "Audi"; c.color = "White"; c.isACPresent = true; c.noOfSeatBelts = 4; c.price = 8600000; System.out.println(c.brand); c.move(); c.start(); c.stop(); c.temperatureControl(); //Truck t = new Truck(); //Bike b = new Bike(); } }
[ "User@User-PC" ]
User@User-PC
32795ab3653068d6bf18116fbf0e804559724970
2e6e8546ccc259c4e8d422494e0c7b090fbfc073
/shop-vo/src/main/java/com/fh/shop/backend/vo/ProductVo.java
9a66876fe9ec0ec9f68da06c4cdd0cc4d73c7159
[]
no_license
songxiaojing666/shop
20e020272e69097fabe1a2cf78131343deb2596b
7cb5e9e4138409b6a661d6983614906449412dab
refs/heads/master
2020-05-05T11:34:08.627485
2019-04-07T16:46:40
2019-04-07T16:46:40
179,994,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,721
java
package com.fh.shop.backend.vo; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; public class ProductVo implements Serializable { private static final long serialVersionUID = -2787534372005034182L; private Integer id; private String productName; private Float productPrice; @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date insertDate;//当前时间 @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date updateDate;//修改时间 //品牌表 private String brandname; //图片 private String image; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public Float getProductPrice() { return productPrice; } public void setProductPrice(Float productPrice) { this.productPrice = productPrice; } public Date getInsertDate() { return insertDate; } public void setInsertDate(Date insertDate) { this.insertDate = insertDate; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } public String getBrandname() { return brandname; } public void setBrandname(String brandname) { this.brandname = brandname; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } }
70930e52ad68f0b7b65765a3dea930a0c7cdd435
7a00f82499669c4a405fdf40b817cab792262f59
/src/com/formaplus/controllers/FormationDialogController.java
cd9819af0ef70238b3a99ecdb9287ffdbb0d186d
[]
no_license
mkakpabla/formaplus
eb952c9c4b4b14a824b53b41ea136b58ef41d8eb
fa6844ae73177216316f71171d457a654e655150
refs/heads/main
2023-05-29T13:33:30.003035
2021-06-09T08:09:56
2021-06-09T08:09:56
364,691,032
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,187
java
package com.formaplus.controllers; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.event.ActionEvent; import java.net.URL; import java.util.ResourceBundle; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.Positive; import com.formaplus.dao.models.Formation; import com.formaplus.dao.repositories.FormationRepository; import com.formaplus.utils.AlertMessage; public class FormationDialogController extends Controller implements Initializable { private int idFormation = 0; @FXML @NotEmpty(message = "Le libellé ne peur être vide") private TextField libFormationField; @FXML @Positive(message = "La durée n'est pas valide") private TextField dureeFormationField; @FXML @Positive(message = "Le prix n'est pas valide") private TextField prixFormationField; @FXML private Button saveFormationButton; // Event Listener on Button[#saveFormationButton].onAction @FXML public void handleSaveFormationButtonAction(ActionEvent event) { if (this.validate()) { Formation formation = new Formation(); formation.setIdFormation(idFormation); formation.setLibFormation(libFormationField.getText()); formation.setDureeFormation(Integer.parseInt(dureeFormationField.getText())); formation.setPrixFormation(Double.parseDouble(prixFormationField.getText())); if (new FormationRepository().Save(formation)) { if (idFormation == 0) { AlertMessage.showInformation("Les informations de la formation ont été mis a jour"); } else { AlertMessage.showInformation("Formation sauvegarder avec success"); } } } } @Override public void setData(Object obj) { Formation formation = (Formation)obj; libFormationField.setText(formation.getLibFormation()); dureeFormationField.setText(String.valueOf(formation.getDureeFormation())); prixFormationField.setText(String.valueOf(formation.getPrixFormation())); idFormation = formation.getIdFormation(); } @Override public void initialize(URL arg0, ResourceBundle arg1) { // TODO Auto-generated method stub } }
bf6515f96e3b964b278d12191d2e4b33376bd503
8445e35b03735892b93979091764919ecd814188
/src/app/model/addProjekt.java
4d2d6484a88f2f95342dedc93c62543c23a3985f
[]
no_license
MarcinHoinka/ocena_projektu
c194ab9aed212b784bd2847e992b1c4e9aa1625d
add6b65c18442632c4788636ad03104df1f35208
refs/heads/master
2021-08-30T06:31:54.514335
2017-12-16T14:03:31
2017-12-16T14:03:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package app.model; public class addProjekt { private int temat, opis, deadline; public addProjekt(int temat, int opis, int deadline) { super(); this.temat = temat; this.opis = opis; this.deadline = deadline; } public addProjekt() { super(); } public int getTemat() { return temat; } public void setTemat(int temat) { this.temat = temat; } public int getOpis() { return opis; } public void setOpis(int opis) { this.opis = opis; } public int getDeadline() { return deadline; } public void setDeadline(int deadline) { this.deadline = deadline; } @Override public String toString() { return "addProjekt [temat=" + temat + ", opis=" + opis + ", deadline=" + deadline + "]"; } }
7384eff62d4a6e6c86267b2b3d118bca44940e21
c2190ff40be193f4ce799ed429ac5b9e8abde43e
/src/main/java/com/bmv/auditoria/ai/persistent/ControlStrategiesRisk.java
0bd686687da3e2c0f42bea46ec00b917b40a6ceb
[]
no_license
angeljach/ai
778c01723d1810d2cf8428ee57e68012d85ffa53
ff12bcda1d2a3dc8bf090cceb9cfc25b27dfc9a8
refs/heads/master
2023-08-04T10:04:17.689917
2023-07-19T19:16:30
2023-07-19T19:16:30
3,280,499
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.bmv.auditoria.ai.persistent; import com.bmv.auditoria.ai.persistent.auto._ControlStrategiesRisk; public class ControlStrategiesRisk extends _ControlStrategiesRisk { }
7153d16fea788c1de7cdea22c65e841011c7e00b
862b8d2e72b48c82626984f91a4188e7828a3b64
/src/main/java/com/dev21/solid/isp/unviolated3/SwimmingAthlete.java
0e8b3f5d72ec86fe42c4cbd3be177e30b576868e
[]
no_license
strannik01/design-principles
9520d0ac23a367a8dd5651f5c856d09ba6bb9d11
f58d6b67a8c8dbbf48f53101de02b734aef67299
refs/heads/master
2020-09-09T01:33:50.619741
2019-11-12T20:25:03
2019-11-12T20:25:03
221,303,424
0
0
null
null
null
null
UTF-8
Java
false
false
112
java
package com.dev21.solid.isp.unviolated3; public interface SwimmingAthlete extends Athlete { void swim(); }
da9a5fd3fd02245db38d11188dca8fdaa9d05692
5ba0a3f4a59ea6df5c7d276d446ed8f9abb2fdb8
/src/main/java/com/cfckata/team/sales/domain/OrderItem.java
50f536bc2510c22c53da1f2544a5c4f99efc1eb8
[ "Apache-2.0" ]
permissive
cfc-kata/cfc-kata-team-d
ab2124d6401419a1af6a385dc942726133ae3a3b
979e1ab727310ffabf079b85336cddef0b07065e
refs/heads/master
2022-12-13T16:45:03.779970
2020-09-17T08:07:26
2020-09-17T08:07:26
294,271,264
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
package com.cfckata.team.sales.domain; import java.math.BigDecimal; import java.math.RoundingMode; public class OrderItem { private Long id; private String productId; private String productName; private BigDecimal price; private BigDecimal amount; private BigDecimal subTotal; public OrderItem() { } public OrderItem(Long id, BigDecimal amount, BigDecimal price, String productId, String productName) { if (productId == null) { throw new IllegalArgumentException("product is null"); } this.id = id; this.productId = productId; this.productName = productName; this.amount = amount; this.subTotal = price.multiply(amount).setScale(2, RoundingMode.HALF_UP); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public BigDecimal getAmount() { return amount; } public void setAmount(BigDecimal amount) { this.amount = amount; } public BigDecimal getSubTotal() { return subTotal; } public void setSubTotal(BigDecimal subTotal) { this.subTotal = subTotal; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } }
4811ac9dee804cbbb8f0877efafd3104dc6a7d3d
c956623bc3437933b5eb00989ae625aaa120d898
/src/main/java/by/epam/booking/specification/impl/book/update/BookChangeCountSpecification.java
a57a975ffb5832f85d8a52156c1e3668a73e561b
[]
no_license
TheAntoshkaBy/Booking_Club_Epam_Project
b3d1b60f9393f3f73805d89d4f8b32e8aee05a0b
a63cee5679029413f1c678e29c493270bde226bb
refs/heads/master
2022-07-02T01:37:37.761264
2020-03-12T21:03:20
2020-03-12T21:03:20
225,802,167
2
0
null
2022-06-21T02:22:38
2019-12-04T07:07:17
Java
UTF-8
Java
false
false
1,507
java
package by.epam.booking.specification.impl.book.update; import by.epam.booking.connection.ConnectionPool; import by.epam.booking.exception.ConnectionPoolException; import by.epam.booking.exception.SpecificationException; import by.epam.booking.specification.Specification; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; public class BookChangeCountSpecification implements Specification { private static Logger logger = LogManager.getLogger(); private Integer id; private Integer count; private String SQL_REQUEST = "UPDATE "+BOOK_TABLE+" SET count=? WHERE idBook=?"; public BookChangeCountSpecification(Integer id, Integer count) { this.id = id; this.count = count; } @Override public PreparedStatement specify() throws SpecificationException { PreparedStatement statement = null; try { Connection connection = ConnectionPool.getInstance().getConnection(); statement = connection.prepareStatement(SQL_REQUEST); statement.setInt(1,count); statement.setInt(2,id); statement.executeUpdate(); } catch (SQLException | ConnectionPoolException e) { logger.error(e); throw new SpecificationException(e); } return statement; } @Override public boolean isUpdate() { return true; } }
60f9b2661c5d5e85c3ab97b43311fa1fb85469c8
81bc68e488b1e604b770d2d168528247b49214f5
/kodilla-rps/src/main/java/pl/mps/kodilla/rps/RpsRoundRunner.java
0ddf529966f766ae1f73b4411c8855722c756b87
[]
no_license
xmarcinsx/kodilla-course
0ee6b8170d62a3b504c09ac45eb5efc0a11e8c00
a49241b2fe82e354d9b8efcf68de32c1f37cf943
refs/heads/master
2020-03-26T03:33:42.574427
2018-08-12T11:51:23
2018-08-12T11:51:23
144,460,688
0
0
null
null
null
null
UTF-8
Java
false
false
1,160
java
package pl.mps.kodilla.rps; import java.util.Random; import static pl.mps.kodilla.rps.RpsMenu.printComputerMoveInfo; import static pl.mps.kodilla.rps.RpsMenu.printRoundInfo; public class RpsRoundRunner { private static final Random random = new Random(); private final int roundNumber; public RpsRoundRunner(int roundNumber) { this.roundNumber = roundNumber; } public RpsRoundResult play() { printRoundInfo(roundNumber); RpsTurn userTurn = getUserTurn(); RpsTurn computerTurn = getComputerTurn(); if (userTurn == RpsTurn.BAD) { return RpsRoundResult.BAD; } if (userTurn == RpsTurn.END) { return RpsRoundResult.END; } if (userTurn == RpsTurn.REPLAY) { return RpsRoundResult.REPLAY; } printComputerMoveInfo(computerTurn); return RpsMoveComparator.comapre(userTurn, computerTurn); } private RpsTurn getComputerTurn() { int move = random.nextInt(3) + 1; return RpsTurn.getMove(move); } private RpsTurn getUserTurn() { return RpsMenu.getUserTurn(); } }
e6e4c9f60d06c15f31d0c84094e909bc11901fe9
d9b78295c9a07cea85ea4748c473f5becacb75a2
/app/src/main/java/com/lingjun/colliery_android/utils/AndPermissionUtils.java
fbd2abc065a8dcf84242c4e9ec20a289c1e3b307
[]
no_license
ztchongchong/HuangLIngMeiKuang
3b762564f8900a3a5831e4f39f94d0b723c693bc
fce5b94e6cc3a20f26ea75e6a57b0c9ffbebf4d8
refs/heads/master
2020-08-24T02:50:17.946313
2019-10-22T07:38:41
2019-10-22T07:38:41
216,750,261
0
0
null
null
null
null
UTF-8
Java
false
false
8,641
java
package com.lingjun.colliery_android.utils; import android.Manifest; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.AlertDialog; import com.blankj.utilcode.util.LogUtils; import com.yanzhenjie.permission.AndPermission; import com.yanzhenjie.permission.PermissionListener; import java.util.List; import static com.blankj.utilcode.util.ActivityUtils.startActivity; /** * Created by nefa on 2017/12/28. */ public class AndPermissionUtils { //只获取某个权限 public static void requestPermission(final Activity activity, final int code, String permission, @Nullable final RequestPermissionCall requestPermissionCall){ AndPermission.with(activity) .requestCode(code) .permission(permission) .callback(new PermissionListener() { @Override public void onSucceed(int requestCode, @NonNull List<String> grantPermissions) { if (requestCode == code){ if (AndPermission.hasPermission(activity,grantPermissions)){ //获取成功 LogUtils.e("权限获取成功"); if (null != requestPermissionCall){ requestPermissionCall.isSucceed(); } }else { LogUtils.e("权限获取失败-1"); AndPermission.defaultSettingDialog(activity, code) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } } @Override public void onFailed(int requestCode, @NonNull List<String> deniedPermissions) { LogUtils.e("权限获取失败"); if (requestCode == code){ AndPermission.defaultSettingDialog(activity, code) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } }).start(); } //只获取某个权限 public static void requestPermissionList(final Activity activity, final int code, String[] permissionList, @Nullable final RequestPermissionCall requestPermissionCall){ AndPermission.with(activity) .requestCode(code) .permission(permissionList) .callback(new PermissionListener() { @Override public void onSucceed(int requestCode, @NonNull List<String> grantPermissions) { if (requestCode == code){ if (AndPermission.hasPermission(activity,grantPermissions)){ //获取成功 LogUtils.e("权限获取成功"); if (null != requestPermissionCall){ requestPermissionCall.isSucceed(); } }else { LogUtils.e("权限获取失败-1"); AndPermission.defaultSettingDialog(activity, code) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } } @Override public void onFailed(int requestCode, @NonNull List<String> deniedPermissions) { LogUtils.e("权限获取失败"); if (requestCode == code){ AndPermission.defaultSettingDialog(activity, code) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } }).start(); } //获取打电话权限并跳转 public static void callPhone(final Activity activty, final String phone){ AndPermission.with(activty) .requestCode(100) .permission(Manifest.permission.CALL_PHONE) .callback(new PermissionListener() { @Override public void onSucceed(int i, @NonNull List<String> list) { if (i == 100) { if (AndPermission.hasPermission(activty, list)) { new AlertDialog.Builder(activty) .setMessage("" + phone) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .setPositiveButton("呼叫", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_DIAL); Uri data = Uri.parse("tel:" + phone); intent.setData(data); startActivity(intent); } }).show(); } else { AndPermission.defaultSettingDialog(activty, 100) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } } @Override public void onFailed(int i, @NonNull List<String> list) { if (i == 100) { AndPermission.defaultSettingDialog(activty, 100) .setTitle("权限申请失败") .setMessage("您拒绝了我们必要的一些权限,请在设置中授权!") .setPositiveButton("好,去设置") .show(); } } }) .start(); } private void initPoker(int[] paker){ //遍历牌组 for(int i =0;i<paker.length-1;i++) { //内循环遍历比对,0位对比1位,1位对比2位,以此类推 for(int j=0;j<paker.length-i-1;j++) {//-1为了防止溢出 if(paker[j]>paker[j+1]) { //若当前位大于下一位则交换位置 int temp = paker[j]; paker[j]=paker[j+1]; paker[j+1]=temp; } } } } public interface RequestPermissionCall{ void isSucceed(); } }
bb5fe278ebf669c9658bf2e5f9ed200cf384a6bc
6638fba4f3dc3e61e1f7ce6ed8e96570929a32a4
/src/screens/EndScreen.java
363c609f629b3cda76282dea0bd37315879d15fc
[]
no_license
shaniherskowitz/space-invaders
2e45be069f042af89ab04b354c25597c0840511f
02e0a52553e7df412ad52107bf3ed1b7c1067ddc
refs/heads/master
2021-08-22T22:12:12.687452
2017-12-01T12:24:48
2017-12-01T12:24:48
112,736,727
0
0
null
null
null
null
UTF-8
Java
false
false
1,727
java
package screens; import biuoop.DrawSurface; import interfaces.Animation; import java.awt.Color; /** * end screen of the game. */ public class EndScreen implements Animation { private int score; private boolean winner; /** * @param scoreIs score of game. * @param win if won */ public EndScreen(int scoreIs, boolean win) { this.score = scoreIs; this.winner = win; } /** * * @param d draws one frame of the game on this surface. * @param dt frame rate */ public void doOneFrame(DrawSurface d, double dt) { if (this.winner) { d.setColor(Color.BLACK); d.fillRectangle(0, 0, 800, 600); d.setColor(new Color((int) (0.235 * 0x1000000))); d.drawText(200, d.getHeight() / 4, "You Win!", 62); d.setColor(new Color((int) (0.541 * 0x1000000))); d.drawText(100, d.getHeight() / 4 + 150, "Your Score Is: ", 60); d.setColor(new Color((int) (0.246 * 0x1000000))); d.drawText(530, d.getHeight() / 4 + 150, score + "", 80); } else { d.setColor(Color.BLACK); d.fillRectangle(0, 0, 800, 600); d.setColor(new Color((int) (0.5 * 0x1000000))); d.drawText(200, d.getHeight() / 4, "Game Over", 62); d.setColor(new Color((int) (0.54 * 0x1000000))); d.drawText(100, d.getHeight() / 4 + 150, "Your Score Is: ", 60); d.setColor(new Color((int) (0.65 * 0x1000000))); d.drawText(530, d.getHeight() / 4 + 150, score + "", 80); } } /** * * @return when it should end the game */ public boolean shouldStop() { return true; } }
e264321f51345dd7138de3366749edc7abaddcde
177d862ced3c41f6a9cfafcd9864bcdefdf5a619
/java/org/apache/catalina/Host.java
bd2abb0fbd8e03c94d86b0e09393c48d4833372a
[ "Apache-2.0" ]
permissive
supercj92/tomcat6
42bacc64a28bf577d6427f96b7e237fb1f18de83
adc5f830893449ace06fbbce8857ec36a825e1b5
refs/heads/master
2020-05-02T04:09:04.794044
2019-03-26T08:23:38
2019-03-26T08:23:38
177,743,419
0
0
null
null
null
null
UTF-8
Java
false
false
6,332
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.catalina; /** * A <b>Host</b> is a Container that represents a virtual host in the * Catalina servlet engine. It is useful in the following types of scenarios: * <ul> * <li>You wish to use Interceptors that see every single request processed * by this particular virtual host. * <li>You wish to run Catalina in with a standalone HTTP connector, but still * want support for multiple virtual hosts. * </ul> * In general, you would not use a Host when deploying Catalina connected * to a web server (such as Apache), because the Connector will have * utilized the web server's facilities to determine which Context (or * perhaps even which Wrapper) should be utilized to process this request. * <p> * The parent Container attached to a Host is generally an Engine, but may * be some other implementation, or may be omitted if it is not necessary. * <p> * The child containers attached to a Host are generally implementations * of Context (representing an individual servlet context). * * @author Craig R. McClanahan * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $ */ public interface Host extends Container { // ----------------------------------------------------- Manifest Constants /** * The ContainerEvent event type sent when a new alias is added * by <code>addAlias()</code>. */ public static final String ADD_ALIAS_EVENT = "addAlias"; /** * The ContainerEvent event type sent when an old alias is removed * by <code>removeAlias()</code>. */ public static final String REMOVE_ALIAS_EVENT = "removeAlias"; // ------------------------------------------------------------- Properties /** * Return the application root for this Host. This can be an absolute * pathname, a relative pathname, or a URL. */ public String getAppBase(); /** * Set the application root for this Host. This can be an absolute * pathname, a relative pathname, or a URL. * * @param appBase The new application root */ public void setAppBase(String appBase); /** * Return the value of the auto deploy flag. If true, it indicates that * this host's child webapps should be discovred and automatically * deployed dynamically. */ public boolean getAutoDeploy(); /** * Set the auto deploy flag value for this host. * * @param autoDeploy The new auto deploy flag */ public void setAutoDeploy(boolean autoDeploy); /** * Return the Java class name of the context configuration class * for new web applications. */ public String getConfigClass(); /** * Set the Java class name of the context configuration class * for new web applications. * * @param configClass The new context configuration class */ public void setConfigClass(String configClass); /** * Return the value of the deploy on startup flag. If true, it indicates * that this host's child webapps should be discovred and automatically * deployed. */ public boolean getDeployOnStartup(); /** * Set the deploy on startup flag value for this host. * * @param deployOnStartup The new deploy on startup flag */ public void setDeployOnStartup(boolean deployOnStartup); /** * Return the canonical, fully qualified, name of the virtual host * this Container represents. */ public String getName(); /** * Set the canonical, fully qualified, name of the virtual host * this Container represents. * * @param name Virtual host name * * @exception IllegalArgumentException if name is null */ public void setName(String name); /** * Get the server.xml <host> attribute's xmlNamespaceAware. * @return true if namespace awarenes is enabled. * */ public boolean getXmlNamespaceAware(); /** * Get the server.xml <host> attribute's xmlValidation. * @return true if validation is enabled. * */ public boolean getXmlValidation(); /** * Set the validation feature of the XML parser used when * parsing xml instances. * @param xmlValidation true to enable xml instance validation */ public void setXmlValidation(boolean xmlValidation); /** * Set the namespace aware feature of the XML parser used when * parsing xml instances. * @param xmlNamespaceAware true to enable namespace awareness */ public void setXmlNamespaceAware(boolean xmlNamespaceAware); // --------------------------------------------------------- Public Methods /** * Add an alias name that should be mapped to this same Host. * * @param alias The alias to be added */ public void addAlias(String alias); /** * Return the set of alias names for this Host. If none are defined, * a zero length array is returned. */ public String[] findAliases(); /** * Return the Context that would be used to process the specified * host-relative request URI, if any; otherwise return <code>null</code>. * * @param uri Request URI to be mapped */ public Context map(String uri); /** * Remove the specified alias name from the aliases for this Host. * * @param alias Alias name to be removed */ public void removeAlias(String alias); }
10c22f8e5bc8432ad1c2fed7fb0e54352f35d399
82aad10b5c6ea747a8198e89d514d0925b59768f
/app/src/main/java/com/arturagapov/easymath/MathActiveChoice/QuizPlus.java
14c0e7f25a94712b314275a842a706ab1e3331fd
[]
no_license
ArturAhapov/EasyMath
90c9da2e0f0288579e31de092a2fb8100315c510
48fc661a7d8c081404e2c6b7068cb4b622819210
refs/heads/master
2021-05-06T14:13:13.601924
2017-12-06T15:43:22
2017-12-06T15:43:22
113,335,013
0
0
null
null
null
null
UTF-8
Java
false
false
4,626
java
package com.arturagapov.easymath.MathActiveChoice; /** * Created by Artur Agapov on 15.08.2016. */ public class QuizPlus { private int firstNumber; private int secondNumber; private int rightAnswer; private int wrongtAnswer1; private int wrongtAnswer2; private int wrongtAnswer3; private static int level; public void setLevel(int level) { this.level = level; } public void generation() { if (level == 1) { do { firstNumber = (int) (Math.random() * 10); secondNumber = (int) (Math.random() * 10); rightAnswer = firstNumber + secondNumber; } while (rightAnswer < 4 || firstNumber == 0 || secondNumber == 0); do { wrongtAnswer1 = rightAnswer - (int) (Math.random() * 3); wrongtAnswer2 = rightAnswer + (int) (Math.random() * 3); wrongtAnswer3 = rightAnswer - (int) (Math.random() * 4); } while (wrongtAnswer1 <= 0 || wrongtAnswer2 <= 0 || wrongtAnswer3 <= 0 || wrongtAnswer1 == wrongtAnswer2 || wrongtAnswer1 == wrongtAnswer3 || wrongtAnswer3 == wrongtAnswer2 || wrongtAnswer1 == rightAnswer || wrongtAnswer2 == rightAnswer || wrongtAnswer3 == rightAnswer); } if (level == 2) { do { firstNumber = (int) (Math.random() * 100); secondNumber = (int) (Math.random() * 100); rightAnswer = firstNumber + secondNumber; } while (rightAnswer < 11 || firstNumber < 11 || secondNumber < 11); do { if (rightAnswer > 20) { int x = (int) (Math.random() * 2); if (x < 1) { wrongtAnswer1 = rightAnswer - 10; wrongtAnswer2 = rightAnswer + 5 * ((int) (Math.random() * 3)); } else { wrongtAnswer1 = rightAnswer + 10; wrongtAnswer2 = rightAnswer - 5 * ((int) (Math.random() * 3)); } } else { wrongtAnswer1 = rightAnswer - (int) (Math.random() * 3); wrongtAnswer2 = rightAnswer + (int) (Math.random() * 3); } int r = (int) (Math.random() * 10); if (r < 5) { wrongtAnswer3 = rightAnswer + (int) (Math.random() * 5); } else { wrongtAnswer3 = rightAnswer - (int) (Math.random() * 5); } } while (wrongtAnswer1 <= 0 || wrongtAnswer2 <= 0 || wrongtAnswer3 <= 0 || wrongtAnswer1 == wrongtAnswer2 || wrongtAnswer1 == wrongtAnswer3 || wrongtAnswer3 == wrongtAnswer2 || wrongtAnswer1 == rightAnswer || wrongtAnswer2 == rightAnswer || wrongtAnswer3 == rightAnswer); } if (level == 3) { do { firstNumber = (int) (Math.random() * 1000); secondNumber = (int) (Math.random() * 1000); rightAnswer = firstNumber + secondNumber; } while (rightAnswer < 101 || firstNumber < 101 || secondNumber < 101); do { int x = (int) (Math.random() * 2); if (x < 1) { wrongtAnswer1 = rightAnswer - 10; wrongtAnswer2 = rightAnswer + 10 * 2 * ((int) (Math.random() * 3)); } else { wrongtAnswer1 = rightAnswer + 10; wrongtAnswer2 = rightAnswer - 10 * ((int) (Math.random() * 3)); ; } int r = (int) (Math.random() * 10); if (r < 5) { wrongtAnswer3 = rightAnswer + 5*((int) (Math.random() * 5)); } else { wrongtAnswer3 = rightAnswer - 5*((int) (Math.random() * 5)); } } while (wrongtAnswer1 <= 0 || wrongtAnswer2 <= 0 || wrongtAnswer3 <= 0 || wrongtAnswer1 == wrongtAnswer2 || wrongtAnswer1 == wrongtAnswer3 || wrongtAnswer3 == wrongtAnswer2 || wrongtAnswer1 == rightAnswer || wrongtAnswer2 == rightAnswer || wrongtAnswer3 == rightAnswer); } } public int getFirstNumber() { return firstNumber; } public int getSecondNumber() { return secondNumber; } public int getRightAnswer() { return rightAnswer; } public int getWrongtAnswer1() { return wrongtAnswer1; } public int getWrongtAnswer2() { return wrongtAnswer2; } public int getWrongtAnswer3() { return wrongtAnswer3; } }
5bd658c48b5f0ad8d6437c059ef11e6a3fd55e74
7abd1b0ce74b023b815a4abe8930f8ccd5e64b67
/src/main/java/link/infra/indium/renderer/render/BlockRenderInfo.java
20378770e84a3d7e51d8f30a5805630d224aa01d
[ "Apache-2.0" ]
permissive
TechnicProblem/Indium
22aa287fdde763908bf68078942e0eec1b78d078
2c4bae93fc0dbcc1b513d31aecb7a4f7d21a5f5f
refs/heads/master
2023-03-30T11:35:42.334303
2021-03-28T19:20:45
2021-03-28T19:20:45
352,363,791
0
0
Apache-2.0
2021-03-28T15:20:23
2021-03-28T15:20:22
null
UTF-8
Java
false
false
2,919
java
/* * Copyright (c) 2016, 2017, 2018, 2019 FabricMC * * 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 link.infra.indium.renderer.render; import net.fabricmc.fabric.api.renderer.v1.material.BlendMode; import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.client.color.block.BlockColors; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderLayers; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; import java.util.Random; import java.util.function.Supplier; /** * Holds, manages and provides access to the block/world related state * needed by fallback and mesh consumers. * * <p>Exception: per-block position offsets are tracked in {@link IndiumChunkRenderInfo} * so they can be applied together with chunk offsets. */ public class BlockRenderInfo { private final BlockColors blockColorMap = MinecraftClient.getInstance().getBlockColors(); public final Random random = new Random(); public BlockRenderView blockView; public BlockPos blockPos; public BlockState blockState; public long seed; boolean defaultAo; RenderLayer defaultLayer; public final Supplier<Random> randomSupplier = () -> { final Random result = random; long seed = this.seed; if (seed == -1L) { seed = blockState.getRenderingSeed(blockPos); this.seed = seed; } result.setSeed(seed); return result; }; public void setBlockView(BlockRenderView blockView) { this.blockView = blockView; } public void prepareForBlock(BlockState blockState, BlockPos blockPos, boolean modelAO) { this.blockPos = blockPos; this.blockState = blockState; // in the unlikely case seed actually matches this, we'll simply retrieve it more than one seed = -1L; defaultAo = modelAO && MinecraftClient.isAmbientOcclusionEnabled() && blockState.getLuminance() == 0; defaultLayer = RenderLayers.getBlockLayer(blockState); } public void release() { blockPos = null; blockState = null; } int blockColor(int colorIndex) { return 0xFF000000 | blockColorMap.getColor(blockState, blockView, blockPos, colorIndex); } boolean shouldDrawFace(Direction face) { return true; } RenderLayer effectiveRenderLayer(BlendMode blendMode) { return blendMode == BlendMode.DEFAULT ? this.defaultLayer : blendMode.blockRenderLayer; } }
ca5de0966ef55d3b08eedf8f58f998b6d0d757e9
efb57b7b268d38a17d61cb45250c9e74eea79b12
/src/main/java/cn/com/leave/interceptor/AdminInterceptor.java
b76ff01de39bc77035e69a0fe50706917b86c06f
[]
no_license
hbjycl/ask_for_leave
0b34fc789e6681c69d907829c674cfdb5f0090e2
08db2c7c7ac4848de2f54aa35c85190adeece4d7
refs/heads/master
2022-12-22T16:05:37.968061
2021-03-15T02:09:14
2021-03-15T02:09:14
51,903,518
0
0
null
2022-12-16T02:36:11
2016-02-17T07:29:45
CSS
UTF-8
Java
false
false
1,370
java
package cn.com.leave.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import cn.com.leave.entity.User; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; public class AdminInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HttpSession session = request.getSession(); // Customer loginCustomer = (Customer) session.getAttribute(AppConst.LOGINCUSTOMER); User loginAdmin = (User) session.getAttribute("loginUser"); String url = request.getRequestURI(); if (loginAdmin == null && loginAdmin == null) { response.sendRedirect("login.jsp"); return false; } return super.preHandle(request, response, handler); } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null) { HttpSession session = request.getSession(); } super.postHandle(request, response, handler, modelAndView); } }
3b392562b138eb22e8449dec3bca82b35f57633e
ba6879a50ab7e43c86bb0188918669319b72560b
/UsandoColecoesPRJ/src/br/ba/senai/principal/UsandoSET.java
a0fa96cafad8dc5adf922a600052247a355feb77
[]
no_license
patriciamag/poo-java
940c6aeb630671480e7521ae129e5c0505619142
52c1b0775b65452007e5377ec908109c325f210b
refs/heads/master
2021-04-13T15:33:09.689886
2015-11-21T00:36:55
2015-11-21T00:36:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
789
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.ba.senai.principal; import br.ba.senai.beans.Aluno; import java.util.HashSet; import java.util.Scanner; import java.util.Set; /** * * @author André Portugal */ public class UsandoSET { public static void main(String[] args) { Set<Aluno> alunos = new HashSet<Aluno>(); Scanner tec = new Scanner(System.in); for (int i = 1; i < 4; i++) { Aluno aluno = new Aluno(tec.next(), tec.nextInt()); alunos.add(aluno); } for(Aluno a:alunos){ System.out.println("Nome:"+a.getNome()); System.out.println("Idade:"+a.getIdade()); } } }
a29426313499c66957ac4b03b5a2f3c8d9a9ea39
697d4bce10894ad57391672719fde29b8108f767
/ShapeshifterMod/src/main/java/StSShapeShifter/relics/AnimalHeart.java
368092442a62bd8a4ee60b6c0c5cea502d54bab2
[ "MIT" ]
permissive
austingregory-git/StS-ShapeshifterMod
2d6ed8b42f80e29307add7242ed7c6025fefa2d5
216baa85ba429593e34fe50d85e9ca8051650ce7
refs/heads/master
2023-03-07T19:55:45.157666
2021-02-24T10:18:02
2021-02-24T10:18:02
305,566,434
1
0
null
null
null
null
UTF-8
Java
false
false
2,316
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by FernFlower decompiler) // package StSShapeShifter.relics; import StSShapeShifter.ShapeshifterMod; import StSShapeShifter.powers.FreeFormPower; import StSShapeShifter.util.AllForms; import StSShapeShifter.util.BloomCountUtils; import StSShapeShifter.util.TextureLoader; import basemod.abstracts.CustomRelic; import com.badlogic.gdx.graphics.Texture; import com.megacrit.cardcrawl.actions.GameActionManager; import com.megacrit.cardcrawl.actions.common.*; import com.megacrit.cardcrawl.actions.utility.UseCardAction; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.characters.AbstractPlayer.PlayerClass; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.helpers.PowerTip; import com.megacrit.cardcrawl.monsters.AbstractMonster; import com.megacrit.cardcrawl.powers.watcher.VigorPower; import com.megacrit.cardcrawl.relics.AbstractRelic; import com.megacrit.cardcrawl.relics.AbstractRelic.LandingSound; import com.megacrit.cardcrawl.relics.AbstractRelic.RelicTier; import org.apache.logging.log4j.core.appender.rolling.action.AbstractAction; import static StSShapeShifter.ShapeshifterMod.makeRelicPath; public class AnimalHeart extends CustomRelic { public static final String ID = ShapeshifterMod.makeID(AnimalHeart.class.getSimpleName()); private static final String PNG = ".png"; private static final Texture IMG = TextureLoader.getTexture(makeRelicPath(AnimalHeart.class.getSimpleName() + PNG)); public AnimalHeart() { super(ID, IMG, RelicTier.STARTER, LandingSound.SOLID); } public String getUpdatedDescription() { return AbstractDungeon.player != null ? this.setDescription(AbstractDungeon.player.chosenClass) : this.setDescription((PlayerClass)null); } private String setDescription(PlayerClass c) { return DESCRIPTIONS[0]; } public void atBattleStart() { this.flash(); this.addToTop(new ApplyPowerAction(AbstractDungeon.player, AbstractDungeon.player, new FreeFormPower(AbstractDungeon.player, 1), 1)); this.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this)); } public AbstractRelic makeCopy() { return new AnimalHeart(); } }
288b11fcfcf3cbeeb71c770ecf9973595ebcec9e
b991d0c39a09c451e8eb08782bc1b1bd422b136b
/src/metierp/PosulationImpp.java
332db8a74e1de2f7ea63cae67db3e219fbc2eb11
[]
no_license
hanaaharmouch/freelance
6789acb256141a26a0278fb0fa24afeb6e456fe7
ead1036e9e6bb954a2c51cff1bfeddd04d83d6a0
refs/heads/master
2020-08-27T11:18:05.620406
2019-10-24T16:56:11
2019-10-24T16:56:11
217,348,465
0
0
null
null
null
null
UTF-8
Java
false
false
2,373
java
package metierp; 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 entities.Offre; import entities.Postulation; import metier.SingletonConnection; public class PosulationImpp implements IPostulationp { @Override public List<Postulation> listpost() { List<Postulation> Postulations=new ArrayList<Postulation>() ; Connection conn=SingletonConnection.getConnection(); try { PreparedStatement ps=conn.prepareStatement ("select * from postulation"); ResultSet rs=ps.executeQuery(); while(rs.next()) { Postulation p =new Postulation(); p.setBudget(rs.getInt("budget")); p.setDure(rs.getString("dure")); p.setMotivation(rs.getString("motivation")); p.setNomf(rs.getString("nomf")); p.setId_freelancer(rs.getInt("id_freelancer")); p.setPrenomf(rs.getString("prenomf")); p.setNomp(rs.getString("nomp")); System.out.println("Conne"); Postulations.add(p); } ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return Postulations; } @Override public List<Postulation> postulationParMC(Integer mc) { List<Postulation> Postulations=new ArrayList<Postulation>() ; Connection conn=SingletonConnection.getConnection(); try { PreparedStatement ps=conn.prepareStatement ("select * from postulation where id_offre=?"); ps.setInt(1, mc); ResultSet rs=ps.executeQuery(); while(rs.next()) { Postulation P =new Postulation(); P.setBudget(rs.getInt("budget")); P.setDure(rs.getString("dure")); P.setMotivation(rs.getString("motivation")); P.setId_offre(rs.getInt("id_offre")); P.setNomf(rs.getString("nomf")); P.setId_freelancer(rs.getInt("id_freelancer")); P.setPrenomf(rs.getString("prenomf")); P.setNomp(rs.getString("nomp")); P.setId_postulation(rs.getInt("id_postulation")); System.out.println("Conne"); Postulations.add(P); } ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return Postulations; } @Override public Offre getPostulation(Integer id) { // TODO Auto-generated method stub return null; } }
d2fb26ebd712ec65a27fcb9005c38f189dacff5e
6c1f41dc1d689cec784a570cb0004494d7ee7ea1
/Source Code/GeneticAlgorithm/src/GeneticAlgorithm.java
f259610d2c768f749e8a58ce860794aa57b80bd1
[]
no_license
roypulak/GeneticAlgorithm
1cba2c8069644a00cdc2ba658f535d2f0c657ccc
cd766c80bdccf3b85c0a5cad7cb1eaa33aa0f297
refs/heads/master
2021-01-19T23:49:07.144112
2017-04-22T01:00:38
2017-04-22T01:00:38
89,034,796
0
0
null
null
null
null
UTF-8
Java
false
false
9,850
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class GeneticAlgorithm { private static int defaultGeneLength = 1000; private static byte[] bestGene = new byte[1000]; private static byte[][] population = new byte[1000][defaultGeneLength]; private static byte[][] tournamentPop = new byte[1000][defaultGeneLength];//used for individual selection before crossover private static int fittestIndex;// fittest index for population private static int tournamentFittestIndex;//fittest index for tournament Population private static final double uniformRate = 0.5; private static final double mutationRate = 0.015; private static final int tournamentSize = 5; private static final boolean elitism = true; private static int popSize = 200; private static int totalGeneration = 300; private static int totalNode = 7; private static int[][] G = new int [1000][1000]; public static void main(String[] args) { double maxFitness,temp; int nthgen = 1; //extracting network from input file processInput(); // Create an initial population initialializePopulation(popSize, true); // Set a candidate solution maxFitness = getFittest(false); setBestIndividual(); // Evolve our population until we reach an optimum solution for(int gen = 1; gen < totalGeneration; gen++) { System.out.println("Generation: " + gen + " Fitness: " + maxFitness); evolvePopulation(); temp = getFittest(false); if(temp > maxFitness) { maxFitness = temp; setBestIndividual(); nthgen = gen+1; } } System.out.println("Solution found!"); System.out.println("Generation: " +nthgen); System.out.println("Genes:"); for(int i = 0; i < defaultGeneLength; i++) System.out.print(bestGene[i]); writeFile(); } // take best individual gene sequence private static void setBestIndividual() { for(int i = 0; i < defaultGeneLength; i++) { bestGene[i] = population[fittestIndex][i]; } } // Evolve a population public static void evolvePopulation() { byte[] indv1 = new byte[defaultGeneLength];//used for crossover byte[] indv2 = new byte[defaultGeneLength];//used for crossover byte[] newIndiv = new byte [defaultGeneLength];//keeps new individual after crossover // Keep our best individual if (elitism) { for(int i = 0; i < defaultGeneLength; i++) { population[0][i] = population[fittestIndex][i]; } } // Crossover population int elitismOffset; if (elitism) { elitismOffset = 1; } else { elitismOffset = 0; } // Loop over the population size and create new individuals with // crossover for (int i = elitismOffset; i < popSize; i++) { int index1 = tournamentSelection(popSize); for(int j = 0; j < defaultGeneLength; j++) { indv1[j] = tournamentPop[index1][j]; } int index2 = tournamentSelection(popSize); for(int j = 0; j < defaultGeneLength; j++) { indv2[j] = tournamentPop[index2][j]; } newIndiv = crossover(indv1, indv2); for(int j = 0; j < defaultGeneLength; j++) { population[i][j] = newIndiv[j]; } } // Mutate population for (int i = elitismOffset; i < popSize; i++) { mutate(i); } } // Crossover individuals private static byte[] crossover(byte[] in1, byte[] in2) { byte[] newSol = new byte[defaultGeneLength]; // Loop through genes for (int i = 0; i < in1.length; i++) { // Crossover if (Math.random() <= uniformRate) { newSol[i] = in1[i]; } else { newSol[i] = in2[i]; } } return newSol; } // Mutate an individual private static void mutate(int index) { // Loop through genes for (int i = 0; i < defaultGeneLength; i++) { if (Math.random() <= mutationRate) { // Create random gene byte gene = (byte) Math.round(Math.random()); population[index][i] = gene; } } } // Select individuals for crossover private static int tournamentSelection(int pop) { // Create a tournament population //created tournament population in the above (globally) // For each place in the tournament get a random individual for (int t = 0; t < tournamentSize; t++) { int randomId = (int) (Math.random() * pop); //here pop means popSize for(int i = 0 ; i < defaultGeneLength; i++) { tournamentPop[t][i] = population[randomId][i]; } } // Get the fittest among tournamentPop getFittest(true); return tournamentFittestIndex;// will return index } private static double getFittest(boolean isTournament) { double fitVal; double temp; if(isTournament)// execute if called from tournamentSelection method { fitVal = getFitness(0,true); tournamentFittestIndex = 0; // Loop through individuals to find fittest for (int i = 1; i < tournamentSize; i++) { temp = getFitness(i,true); if (fitVal <= temp) { fitVal = temp; tournamentFittestIndex = i; } } } else { fitVal = getFitness(0,false); fittestIndex = 0; // Loop through individuals to find fitVal for (int i = 1; i < popSize; i++) { temp = getFitness(i,false); if (fitVal <= temp) { fitVal = temp; fittestIndex = i; } } } return fitVal; } public static void initialializePopulation(int populationSize, boolean initialise) { if (initialise) { // Loop and create individuals for (int i = 0; i < populationSize; i++) { for (int j = 0; j < defaultGeneLength; j++) { byte gene = (byte) Math.round(Math.random()); population[i][j] = gene; } } } } static double getFitness(int index, boolean isTournament) { double sum = 0; double L_2; double Q_S; double F_S; //System.out.println("L2:"+L_2); L_2 = compute2L(); // Loop through our individuals genes and compare them to our candidates if(isTournament)//if the method called from tournamentSelection() { for (int i = 0; i < totalNode; i++) { for(int j = 0; j < totalNode; j++) { sum += (G[i][j] - ( k(i) * k(j) ) / L_2 ) * ( tournamentPop[index][i] * tournamentPop[index][j] + (1-tournamentPop[index][i]) * (1-tournamentPop[index][j])); } } } else { for (int i = 0; i < totalNode; i++) { for(int j = 0; j < totalNode; j++) { sum += (G[i][j] - ( k(i) * k(j) ) / L_2 ) * ( population[index][i] * population[index][j] + (1-population[index][i]) * (1-population[index][j])); } } } //Q_S = sum / L_2; Q_S = sum / L_2; //F_S = (1 + Q_S) / (double)2; F_S = Math.pow((1+Q_S), 4); return F_S; } //function that returns degree of a node static int k(int node) { int sum = 0; for(int i = 0; i < totalNode; i++) { if(G[node][i] == 1) { sum += G[node][i]; } } return sum; } private static int compute2L() { int sum = 0; for(int i = 0; i < totalNode; i++) { for(int j = 0; j < totalNode; j++) { if(G[i][j] == 1) sum += G[i][j]; } } return sum; } private static void processInput() { BufferedReader br = null; String[] parts = null; String line = null; int edgeCounter = 0; boolean isEdge = false; double tempN; //taking network file as input try { br = new BufferedReader(new FileReader("E:/Algorithm Codes/GeneticAlgorithm/networks/zachary_unwh.net")); while ((line = br.readLine()) != null) { if(line.contains("Vertices")) { parts = line.trim().split(" "); totalNode = Integer.parseInt(parts[1].trim()); defaultGeneLength = totalNode; continue; } if(line.contains("Edges")) { isEdge = true; continue; } if(isEdge) { edgeCounter++; parts = line.trim().split(" "); //System.out.println(parts[0] + " " + parts[1] + " " + parts[2]); G[Integer.parseInt(parts[0]) - 1][Integer.parseInt(parts[1]) - 1] = 1; G[Integer.parseInt(parts[1]) - 1][Integer.parseInt(parts[0]) - 1] = 1; } } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } private static void writeFile() { try { //String content = "This is the content to write into file"; File file = new File("E:/Algorithm Codes/GeneticAlgorithm/output/zachary_unwh.clu"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write("*Vertices "+Integer.toString(totalNode)+"\n"); for(int i = 0; i < defaultGeneLength; i++) { bw.write("\t "+Integer.toString(bestGene[i])+"\n"); } bw.close(); } catch (IOException e) { e.printStackTrace(); } } }
983709a704a00a429d49e37fff4f99e5e5f4ae05
32ee65a20825ce083c3a45817eb90407a3539892
/src/net/smudgecraft/nations/database/MySQL.java
a27e017c5e81f3e7727c4ed6553abdb3a32855d5
[]
no_license
Marwzoor/Nations
11cd98b6c8d958fef36a932a7d6d5cdd95062dac
806763cac347a200bb9659ee88aa7953525c1e2d
refs/heads/master
2016-09-06T02:11:48.850550
2013-09-21T15:17:00
2013-09-21T15:17:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,434
java
package net.smudgecraft.nations.database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import org.bukkit.plugin.Plugin; /** * Connects to and uses a MySQL database * * @author -_Husky_- * @author tips48 */ public class MySQL extends Database { private final String user; private final String database; private final String password; private final String port; private final String hostname; private Connection connection; /** * Creates a new MySQL instance * * @param plugin * Plugin instance * @param hostname * Name of the host * @param portnmbr * Port number * @param database * Database name * @param username * Username * @param password * Password */ public MySQL(Plugin plugin, String hostname, String port, String database, String username, String password) { super(plugin); this.hostname = hostname; this.port = port; this.database = database; this.user = username; this.password = password; this.connection = null; } @Override public Connection openConnection() { try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password); } catch (SQLException e) { plugin.getLogger().log(Level.SEVERE, "Could not connect to MySQL server! because: " + e.getMessage()); } catch (ClassNotFoundException e) { plugin.getLogger().log(Level.SEVERE, "JDBC Driver not found!"); } return connection; } @Override public boolean checkConnection() { return connection != null; } @Override public Connection getConnection() { return connection; } @Override public void closeConnection() { if (connection != null) { try { connection.close(); } catch (SQLException e) { plugin.getLogger().log(Level.SEVERE, "Error closing the MySQL Connection!"); e.printStackTrace(); } } } public ResultSet querySQL(String query) { Connection c = null; if (checkConnection()) { c = getConnection(); } else { c = openConnection(); } Statement s = null; try { s = c.createStatement(); } catch (SQLException e1) { e1.printStackTrace(); } ResultSet ret = null; try { ret = s.executeQuery(query); } catch (SQLException e) { e.printStackTrace(); } closeConnection(); return ret; } public void updateSQL(String update) { Connection c = null; if (checkConnection()) { c = getConnection(); } else { c = openConnection(); } Statement s = null; try { s = c.createStatement(); s.executeUpdate(update); } catch (SQLException e1) { e1.printStackTrace(); } closeConnection(); } }
7e3abed0d666daec729e866603956f66ba477b65
0234500ed3adc4f84072289bdf6e1d1a0393f102
/camera/camera-extensions/src/test/java/androidx/camera/extensions/BlockingCloseAccessCounterTest.java
7b7e8b73d727be88896c04c7136fc15b5a50c120
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
jaymicrocode/androidx
3d1fc7ae143e55a3db046909a7b1408167dde88c
12a051a7ebbd844d12801b828a66361bd7179a80
refs/heads/androidx-master-dev
2022-12-12T11:10:58.884045
2020-09-15T04:08:25
2020-09-15T04:08:25
295,623,111
0
0
Apache-2.0
2020-09-15T05:27:19
2020-09-15T05:24:44
null
UTF-8
Java
false
false
1,918
java
/* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package androidx.camera.extensions; import static org.junit.Assert.assertFalse; import android.os.Build; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; import org.robolectric.annotation.internal.DoNotInstrument; @RunWith(RobolectricTestRunner.class) @DoNotInstrument @Config(minSdk = Build.VERSION_CODES.LOLLIPOP) public class BlockingCloseAccessCounterTest { @Test(expected = IllegalStateException.class) public void decrementWithoutIncrementThrowsException() { BlockingCloseAccessCounter counter = new BlockingCloseAccessCounter(); // Expect a IllegalStateException to be thrown counter.decrement(); } @Test(expected = IllegalStateException.class) public void decrementAfterDestroy() { BlockingCloseAccessCounter counter = new BlockingCloseAccessCounter(); counter.destroyAndWaitForZeroAccess(); // Expect a IllegalStateException to be thrown counter.decrement(); } @Test public void incrementAfterDestroyDoesNotIncrement() { BlockingCloseAccessCounter counter = new BlockingCloseAccessCounter(); counter.destroyAndWaitForZeroAccess(); assertFalse(counter.tryIncrement()); } }
af835074b3968427eee8ff2d6c50df8750090a80
84335710d23967ba35f096bdde8d86f07d8f1cd1
/src/c_021/MyContainer1.java
fb43f2be5200a77c5a00fa600f6a643d4c1b0ad8
[]
no_license
JunSIr/concurrencydemo
6203a77206ffb97d8b17189f1a5b8afd874f3682
de061ac784ab46ef7546552617ae6187adc4b425
refs/heads/master
2021-04-20T18:43:21.868481
2020-03-24T14:08:12
2020-03-24T14:08:12
249,710,398
0
0
null
null
null
null
UTF-8
Java
false
false
2,203
java
package c_021; import java.util.LinkedList; import java.util.concurrent.TimeUnit; /** * 面试题:写一个固定容量同步容器,拥有put和get方法,以及getCount方法 * 能够支持两个生产者线程以及10个消费者线程的阻塞调用 * * 使用wait和nofify、notifyAll来实现 */ public class MyContainer1<T> { final private LinkedList<T> lists=new LinkedList<T>(); final private int MAX=10; //最多10个元素 private int count=0; /*生产者线程*/ public synchronized void put(T t){ while (lists.size()==MAX){ //想想为什么用while而不是用if ->while 中每条语句都会对while中的判断条件进行判断 try { this.wait(); }catch (InterruptedException e){ e.printStackTrace(); } } lists.add(t); ++count; this.notifyAll();//通知消费者线程进行消费 } /*消费者线程*/ public synchronized T get(){ T t=null; while (lists.size()==0){ try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } t=lists.removeFirst(); count--; this.notifyAll(); //通知生产者进行生产 return t; } public static void main(String[] args) { MyContainer1<String> c =new MyContainer1<>(); //启动十个消费者线程 for (int i = 0; i < 10; i++) { new Thread(()->{ /*一次拿五个*/ for (int j = 0; j < 5; j++) { System.out.println("cget:"+c.get()); } },"c"+i).start(); } try { TimeUnit.SECONDS.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } //启动生产者线程 for (int i = 0; i < 2; i++) { new Thread(()->{ /*一次生产25个*/ for (int j = 0; j < 25; j++) { c.put(Thread.currentThread().getName()+" "+j); } },"p"+i).start(); } } }
68ad4fa9b5d4a64fccd4ebc01081727ebdc47b9a
d2a4e1a611cbf3338423cfb9f28172067436bb37
/kotlin/collections/ArraysKt___ArraysKt$asList$5.java
7f7c58e7249d39773063467ba382a05e97169f24
[]
no_license
i-bthn/cs
302c8526ed879e11c2b32b5130486d672374b768
0fc2180ad48b615e11f2ec0e3e721fcaf9095bc2
refs/heads/master
2023-08-19T04:46:16.284787
2021-10-14T08:24:09
2021-10-14T08:24:09
417,046,547
1
0
null
null
null
null
UTF-8
Java
false
false
3,133
java
package kotlin.collections; import com.google.firebase.analytics.FirebaseAnalytics; import java.util.RandomAccess; import kotlin.Metadata; import org.jetbrains.annotations.NotNull; @Metadata(bv = {1, 0, 2}, d1 = {"\u0000)\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\b*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00060\u0003j\u0002`\u0004B\u0005¢\u0006\u0002\u0010\u0005J\u0011\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u0002H–\u0002J\u0016\u0010\r\u001a\u00020\u00022\u0006\u0010\u000e\u001a\u00020\u0007H–\u0002¢\u0006\u0002\u0010\u000fJ\u0010\u0010\u0010\u001a\u00020\u00072\u0006\u0010\f\u001a\u00020\u0002H\u0016J\b\u0010\u0011\u001a\u00020\u000bH\u0016J\u0010\u0010\u0012\u001a\u00020\u00072\u0006\u0010\f\u001a\u00020\u0002H\u0016R\u0014\u0010\u0006\u001a\u00020\u00078VX–\u0004¢\u0006\u0006\u001a\u0004\b\b\u0010\t¨\u0006\u0013"}, d2 = {"kotlin/collections/ArraysKt___ArraysKt$asList$5", "Lkotlin/collections/AbstractList;", "", "Ljava/util/RandomAccess;", "Lkotlin/collections/RandomAccess;", "([F)V", "size", "", "getSize", "()I", "contains", "", "element", "get", FirebaseAnalytics.Param.INDEX, "(I)Ljava/lang/Float;", "indexOf", "isEmpty", "lastIndexOf", "kotlin-stdlib"}, k = 1, mv = {1, 1, 8}) /* compiled from: _Arrays.kt */ public final class ArraysKt___ArraysKt$asList$5 extends AbstractList<Float> implements RandomAccess { final /* synthetic */ float[] receiver$0; ArraysKt___ArraysKt$asList$5(float[] fArr) { this.receiver$0 = fArr; } @Override // kotlin.collections.AbstractCollection public final /* bridge */ boolean contains(Object obj) { if (obj instanceof Float) { return contains(((Number) obj).floatValue()); } return false; } @Override // kotlin.collections.AbstractList public final /* bridge */ int indexOf(Object obj) { if (obj instanceof Float) { return indexOf(((Number) obj).floatValue()); } return -1; } @Override // kotlin.collections.AbstractList public final /* bridge */ int lastIndexOf(Object obj) { if (obj instanceof Float) { return lastIndexOf(((Number) obj).floatValue()); } return -1; } @Override // kotlin.collections.AbstractList, kotlin.collections.AbstractCollection public int getSize() { return this.receiver$0.length; } @Override // kotlin.collections.AbstractCollection public boolean isEmpty() { return this.receiver$0.length == 0; } public boolean contains(float f) { return ArraysKt.contains(this.receiver$0, f); } @Override // java.util.List, kotlin.collections.AbstractList @NotNull public Float get(int i) { return Float.valueOf(this.receiver$0[i]); } public int indexOf(float f) { return ArraysKt.indexOf(this.receiver$0, f); } public int lastIndexOf(float f) { return ArraysKt.lastIndexOf(this.receiver$0, f); } }
7875cceea580acd03c6f1eab13af8f22a78ac069
6c70e76fb1481baeda4636b41a86151cf4807f0d
/day13Work/src/day13/work/work6/TestStudent.java
18885198c5d3927f69f6576fd1fb2bc3ccc0a85a
[]
no_license
sang678/MyJavaPractice
674361534a3fe05087adcb72084488ec659cbd42
b2ba0ec86f7ea5601060e6dc1bd1b658bce02a9f
refs/heads/master
2016-09-05T10:51:43.466309
2014-08-17T09:46:11
2014-08-17T09:46:11
null
0
0
null
null
null
null
UHC
Java
false
false
1,665
java
package day13.work.work6; import java.util.ArrayList; public class TestStudent { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<Student> man = new ArrayList<Student>(); ArrayList<Student> woman = new ArrayList<Student>(); man.add(new ManSchool(1, 1, "남성1", 'M', 40, 40, 40, 40)); man.add(new ManSchool(2, 2, "남성2", 'M', 50, 50, 50, 50)); man.add(new ManSchool(3, 3, "남성3", 'M', 60, 60, 60, 60)); woman.add(new WomanSchool(1, 1, "여성1", 'F', 40, 40, 40, 40)); woman.add(new WomanSchool(2, 2, "여성2", 'F', 60, 60, 60, 60)); woman.add(new WomanSchool(3, 3, "여성3", 'F', 70, 70, 70, 70)); woman.add(new WomanSchool(4, 4, "여성4", 'F', 50, 50, 50, 50)); man.get(0).calcSungjuk(); man.get(1).calcSungjuk(); System.out.println("test branch"); for(int i = 0 ; i<man.size(); i++) { man.get(i).calcSungjuk(); } for(int i = 0 ; i<woman.size(); i++) { woman.get(i).calcSungjuk(); } man.get(0).rankCalc(man); woman.get(0).rankCalc(woman); for(int i = 0 ; i<woman.size(); i++) { Student s = woman.get(i); s.setRank(i+1); System.out.println("학번 : " + s.getNo() + " 학년 : " + s.getLevel() + " 이름 : " + s.getName() + " 성별 : " + s.getGender() + " 평균 : " + s.getAvg() + " 등수 : "+ s.getRank()); } for(int i = 0 ; i<man.size(); i++) { Student s = man.get(i); s.setRank(i+1); System.out.println("학번 : " + s.getNo() + " 학년 : " + s.getLevel() + " 이름 : " + s.getName() + " 성별 : " + s.getGender() + " 평균 : " + s.getAvg() + " 등수 : "+ s.getRank()); } } }
929dc432e096c66026a386d231e11d004895b318
5aa5f80134511afbc8c0980a268644f297d5c2da
/src/main/java/com/s/bean/FyShareUserDetail.java
d1694abffb6c9f91d2d27308e1593ab0b31f08ab
[]
no_license
Slime6666/projects
edcdf4c26749f67239fc852ea9b8db44599e28da
0704cc61a7fc8ae74a630d89973f1fd51cc861ab
refs/heads/master
2023-06-28T19:39:45.074269
2021-07-27T12:29:28
2021-07-27T12:29:28
386,939,813
0
0
null
null
null
null
UTF-8
Java
false
false
6,486
java
package com.s.bean; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import java.time.LocalDateTime; import java.io.Serializable; /** * <p> * 公摊费用台账用户明细 * </p> * * @author smile * @since 2021-07-17 */ public class FyShareUserDetail implements Serializable { private static final long serialVersionUID=1L; /** * 用户明细id */ @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 所属台账编号 */ private Double standingBookId; /** * 所属房间编码 */ private Integer cellId; /** * 业主姓名 */ private String customerName; /** * 表编号 */ private String boxId; /** * 分摊金额 */ private Double shareMoney; /** * 本次分摊量 */ private Double currentShareNumber; /** * 本次费用起期 */ private LocalDateTime currentPayStartDate; /** * 本次费用止期 */ private LocalDateTime currentPayStopDate; /** * 本次缴费限期 */ private LocalDateTime currentPayLimitDate; /** * 收费标识 */ private String receiveIdentify; /** * 单位价格 */ private Double priceUnit; /** * 费用标识 */ private String costIdentify; /** * 收费单号 */ private String receiveId; /** * 退款次数 */ private Integer refundNumber; /** * 收费周期 */ private Integer receiveCycle; /** * 减免金额 */ private Double derateMoney; /** * 应收金额 */ private Double shouldPay; /** * 作废次数 */ private Integer invalidNumber; /** * 减免滞纳金 */ private Double derateDelayMoney; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Double getStandingBookId() { return standingBookId; } public void setStandingBookId(Double standingBookId) { this.standingBookId = standingBookId; } public Integer getCellId() { return cellId; } public void setCellId(Integer cellId) { this.cellId = cellId; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getBoxId() { return boxId; } public void setBoxId(String boxId) { this.boxId = boxId; } public Double getShareMoney() { return shareMoney; } public void setShareMoney(Double shareMoney) { this.shareMoney = shareMoney; } public Double getCurrentShareNumber() { return currentShareNumber; } public void setCurrentShareNumber(Double currentShareNumber) { this.currentShareNumber = currentShareNumber; } public LocalDateTime getCurrentPayStartDate() { return currentPayStartDate; } public void setCurrentPayStartDate(LocalDateTime currentPayStartDate) { this.currentPayStartDate = currentPayStartDate; } public LocalDateTime getCurrentPayStopDate() { return currentPayStopDate; } public void setCurrentPayStopDate(LocalDateTime currentPayStopDate) { this.currentPayStopDate = currentPayStopDate; } public LocalDateTime getCurrentPayLimitDate() { return currentPayLimitDate; } public void setCurrentPayLimitDate(LocalDateTime currentPayLimitDate) { this.currentPayLimitDate = currentPayLimitDate; } public String getReceiveIdentify() { return receiveIdentify; } public void setReceiveIdentify(String receiveIdentify) { this.receiveIdentify = receiveIdentify; } public Double getPriceUnit() { return priceUnit; } public void setPriceUnit(Double priceUnit) { this.priceUnit = priceUnit; } public String getCostIdentify() { return costIdentify; } public void setCostIdentify(String costIdentify) { this.costIdentify = costIdentify; } public String getReceiveId() { return receiveId; } public void setReceiveId(String receiveId) { this.receiveId = receiveId; } public Integer getRefundNumber() { return refundNumber; } public void setRefundNumber(Integer refundNumber) { this.refundNumber = refundNumber; } public Integer getReceiveCycle() { return receiveCycle; } public void setReceiveCycle(Integer receiveCycle) { this.receiveCycle = receiveCycle; } public Double getDerateMoney() { return derateMoney; } public void setDerateMoney(Double derateMoney) { this.derateMoney = derateMoney; } public Double getShouldPay() { return shouldPay; } public void setShouldPay(Double shouldPay) { this.shouldPay = shouldPay; } public Integer getInvalidNumber() { return invalidNumber; } public void setInvalidNumber(Integer invalidNumber) { this.invalidNumber = invalidNumber; } public Double getDerateDelayMoney() { return derateDelayMoney; } public void setDerateDelayMoney(Double derateDelayMoney) { this.derateDelayMoney = derateDelayMoney; } @Override public String toString() { return "FyShareUserDetail{" + "id=" + id + ", standingBookId=" + standingBookId + ", cellId=" + cellId + ", customerName=" + customerName + ", boxId=" + boxId + ", shareMoney=" + shareMoney + ", currentShareNumber=" + currentShareNumber + ", currentPayStartDate=" + currentPayStartDate + ", currentPayStopDate=" + currentPayStopDate + ", currentPayLimitDate=" + currentPayLimitDate + ", receiveIdentify=" + receiveIdentify + ", priceUnit=" + priceUnit + ", costIdentify=" + costIdentify + ", receiveId=" + receiveId + ", refundNumber=" + refundNumber + ", receiveCycle=" + receiveCycle + ", derateMoney=" + derateMoney + ", shouldPay=" + shouldPay + ", invalidNumber=" + invalidNumber + ", derateDelayMoney=" + derateDelayMoney + "}"; } }
4cdc95545207e5cafb6ce19c8c7555177e378a0c
07d103661fd4af7e29cbeb585e94822934c3b255
/src/java/util/LinkedHashMap.java
7d268f0a9ffe5282c6ef97a408f843b33e9c75cc
[]
no_license
zyrocker/jdk8-read
53dd86e974d7fb8e8a6a6ceab8e47fb235353d27
4f30b1ec0269407b10070814b8799bec2a3cbd87
refs/heads/master
2021-10-20T14:59:03.371499
2019-02-28T14:07:27
2019-02-28T14:07:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
30,439
java
/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package java.util; import java.util.function.Consumer; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.io.IOException; /** * <p>Hash table and linked list implementation of the <tt>Map</tt> interface, * with predictable iteration order. This implementation differs from * <tt>HashMap</tt> in that it maintains a doubly-linked list running through * all of its entries. This linked list defines the iteration ordering, * which is normally the order in which keys were inserted into the map * (<i>insertion-order</i>). Note that insertion order is not affected * if a key is <i>re-inserted</i> into the map. (A key <tt>k</tt> is * reinserted into a map <tt>m</tt> if <tt>m.put(k, v)</tt> is invoked when * <tt>m.containsKey(k)</tt> would return <tt>true</tt> immediately prior to * the invocation.) * * <p>This implementation spares its clients from the unspecified, generally * chaotic ordering provided by {@link HashMap} (and {@link Hashtable}), * without incurring the increased cost associated with {@link TreeMap}. It * can be used to produce a copy of a map that has the same order as the * original, regardless of the original map's implementation: * <pre> * void foo(Map m) { * Map copy = new LinkedHashMap(m); * ... * } * </pre> * This technique is particularly useful if a module takes a map on input, * copies it, and later returns results whose order is determined by that of * the copy. (Clients generally appreciate having things returned in the same * order they were presented.) * * <p>A special {@link #LinkedHashMap(int,float,boolean) constructor} is * provided to create a linked hash map whose order of iteration is the order * in which its entries were last accessed, from least-recently accessed to * most-recently (<i>access-order</i>). This kind of map is well-suited to * building LRU caches. Invoking the {@code put}, {@code putIfAbsent}, * {@code get}, {@code getOrDefault}, {@code compute}, {@code computeIfAbsent}, * {@code computeIfPresent}, or {@code merge} methods results * in an access to the corresponding entry (assuming it exists after the * invocation completes). The {@code replace} methods only result in an access * of the entry if the value is replaced. The {@code putAll} method generates one * entry access for each mapping in the specified map, in the order that * key-value mappings are provided by the specified map's entry set iterator. * <i>No other methods generate entry accesses.</i> In particular, operations * on collection-views do <i>not</i> affect the order of iteration of the * backing map. * * <p>The {@link #removeEldestEntry(Map.Entry)} method may be overridden to * impose a policy for removing stale mappings automatically when new mappings * are added to the map. * * <p>This class provides all of the optional <tt>Map</tt> operations, and * permits null elements. Like <tt>HashMap</tt>, it provides constant-time * performance for the basic operations (<tt>add</tt>, <tt>contains</tt> and * <tt>remove</tt>), assuming the hash function disperses elements * properly among the buckets. Performance is likely to be just slightly * below that of <tt>HashMap</tt>, due to the added expense of maintaining the * linked list, with one exception: Iteration over the collection-views * of a <tt>LinkedHashMap</tt> requires time proportional to the <i>size</i> * of the map, regardless of its capacity. Iteration over a <tt>HashMap</tt> * is likely to be more expensive, requiring time proportional to its * <i>capacity</i>. * * <p>A linked hash map has two parameters that affect its performance: * <i>initial capacity</i> and <i>load factor</i>. They are defined precisely * as for <tt>HashMap</tt>. Note, however, that the penalty for choosing an * excessively high value for initial capacity is less severe for this class * than for <tt>HashMap</tt>, as iteration times for this class are unaffected * by capacity. * * <p><strong>Note that this implementation is not synchronized.</strong> * If multiple threads access a linked hash map concurrently, and at least * one of the threads modifies the map structurally, it <em>must</em> be * synchronized externally. This is typically accomplished by * synchronizing on some object that naturally encapsulates the map. * * If no such object exists, the map should be "wrapped" using the * {@link Collections#synchronizedMap Collections.synchronizedMap} * method. This is best done at creation time, to prevent accidental * unsynchronized access to the map:<pre> * Map m = Collections.synchronizedMap(new LinkedHashMap(...));</pre> * * A structural modification is any operation that adds or deletes one or more * mappings or, in the case of access-ordered linked hash maps, affects * iteration order. In insertion-ordered linked hash maps, merely changing * the value associated with a key that is already contained in the map is not * a structural modification. <strong>In access-ordered linked hash maps, * merely querying the map with <tt>get</tt> is a structural modification. * </strong>) * * <p>The iterators returned by the <tt>iterator</tt> method of the collections * returned by all of this class's collection view methods are * <em>fail-fast</em>: if the map is structurally modified at any time after * the iterator is created, in any way except through the iterator's own * <tt>remove</tt> method, the iterator will throw a {@link * ConcurrentModificationException}. Thus, in the face of concurrent * modification, the iterator fails quickly and cleanly, rather than risking * arbitrary, non-deterministic behavior at an undetermined time in the future. * * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed * as it is, generally speaking, impossible to make any hard guarantees in the * presence of unsynchronized concurrent modification. Fail-fast iterators * throw <tt>ConcurrentModificationException</tt> on a best-effort basis. * Therefore, it would be wrong to write a program that depended on this * exception for its correctness: <i>the fail-fast behavior of iterators * should be used only to detect bugs.</i> * * <p>The spliterators returned by the spliterator method of the collections * returned by all of this class's collection view methods are * <em><a href="Spliterator.html#binding">late-binding</a></em>, * <em>fail-fast</em>, and additionally report {@link Spliterator#ORDERED}. * * <p>This class is a member of the * <a href="{@docRoot}/../technotes/guides/collections/index.html"> * Java Collections Framework</a>. * * @implNote * The spliterators returned by the spliterator method of the collections * returned by all of this class's collection view methods are created from * the iterators of the corresponding collections. * * @param <K> the type of keys maintained by this map * @param <V> the type of mapped values * * @author Josh Bloch * @see Object#hashCode() * @see Collection * @see Map * @see HashMap * @see TreeMap * @see Hashtable * @since 1.4 */ public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V> { /* * Implementation note. A previous version of this class was * internally structured a little differently. Because superclass * HashMap now uses trees for some of its nodes, class * LinkedHashMap.Entry is now treated as intermediary node class * that can also be converted to tree form. The name of this * class, LinkedHashMap.Entry, is confusing in several ways in its * current context, but cannot be changed. Otherwise, even though * it is not exported outside this package, some existing source * code is known to have relied on a symbol resolution corner case * rule in calls to removeEldestEntry that suppressed compilation * errors due to ambiguous usages. So, we keep the name to * preserve unmodified compilability. * * The changes in node classes also require using two fields * (head, tail) rather than a pointer to a header node to maintain * the doubly-linked before/after list. This class also * previously used a different style of callback methods upon * access, insertion, and removal. */ /** * HashMap.Node subclass for normal LinkedHashMap entries. */ static class Entry<K,V> extends HashMap.Node<K,V> { /** * 这两个字段,是用来给迭代时使用的,相当于一个双向链表, * 实际上用的时候,操作LinkedHashMap的entry和操作HashMap的Entry是一样的,只操作相同的四个属性, * 这两个字段是由linkedHashMap中一些方法所操作。LinkedHashMap的很多方法度是直接继承自HashMap。 * before:指向前一个entry元素。after:指向后一个entry元素 */ Entry<K,V> before, after; //使用的是HashMap的Entry构造 Entry(int hash, K key, V value, Node<K,V> next) { super(hash, key, value, next); } } private static final long serialVersionUID = 3801124242820219131L; /** * The head (eldest) of the doubly linked list. */ transient LinkedHashMap.Entry<K,V> head; /** * The tail (youngest) of the doubly linked list. */ transient LinkedHashMap.Entry<K,V> tail; /** * The iteration ordering method for this linked hash map: <tt>true</tt> * for access-order, <tt>false</tt> for insertion-order. * * @serial */ /** * 用来指定LinkedHashMap的迭代顺序, * true则表示按照基于访问的顺序来排列,意思就是最近使用的entry,放在链表的最末尾 * false则表示按照插入顺序来 * 注意:accessOrder的final关键字,说明我们要在构造方法里给它初始化。 */ final boolean accessOrder; // internal utilities // link at the end of list private void linkNodeLast(LinkedHashMap.Entry<K,V> p) { LinkedHashMap.Entry<K,V> last = tail; tail = p; if (last == null) head = p; else { p.before = last; last.after = p; } } // apply src's links to dst private void transferLinks(LinkedHashMap.Entry<K,V> src, LinkedHashMap.Entry<K,V> dst) { LinkedHashMap.Entry<K,V> b = dst.before = src.before; LinkedHashMap.Entry<K,V> a = dst.after = src.after; if (b == null) head = dst; else b.after = dst; if (a == null) tail = dst; else a.before = dst; } // overrides of HashMap hook methods void reinitialize() { super.reinitialize(); head = tail = null; } Node<K,V> newNode(int hash, K key, V value, Node<K,V> e) { LinkedHashMap.Entry<K,V> p = new LinkedHashMap.Entry<K,V>(hash, key, value, e); linkNodeLast(p); return p; } Node<K,V> replacementNode(Node<K,V> p, Node<K,V> next) { LinkedHashMap.Entry<K,V> q = (LinkedHashMap.Entry<K,V>)p; LinkedHashMap.Entry<K,V> t = new LinkedHashMap.Entry<K,V>(q.hash, q.key, q.value, next); transferLinks(q, t); return t; } TreeNode<K,V> newTreeNode(int hash, K key, V value, Node<K,V> next) { TreeNode<K,V> p = new TreeNode<K,V>(hash, key, value, next); linkNodeLast(p); return p; } TreeNode<K,V> replacementTreeNode(Node<K,V> p, Node<K,V> next) { LinkedHashMap.Entry<K,V> q = (LinkedHashMap.Entry<K,V>)p; TreeNode<K,V> t = new TreeNode<K,V>(q.hash, q.key, q.value, next); transferLinks(q, t); return t; } void afterNodeRemoval(Node<K,V> e) { // unlink LinkedHashMap.Entry<K,V> p = (LinkedHashMap.Entry<K,V>)e, b = p.before, a = p.after; p.before = p.after = null; if (b == null) head = a; else b.after = a; if (a == null) tail = b; else a.before = b; } void afterNodeInsertion(boolean evict) { // possibly remove eldest LinkedHashMap.Entry<K,V> first; if (evict && (first = head) != null && removeEldestEntry(first)) { K key = first.key; removeNode(hash(key), key, null, false, true); } } void afterNodeAccess(Node<K,V> e) { // move node to last LinkedHashMap.Entry<K,V> last; if (accessOrder && (last = tail) != e) { LinkedHashMap.Entry<K,V> p = (LinkedHashMap.Entry<K,V>)e, b = p.before, a = p.after; p.after = null; if (b == null) head = a; else b.after = a; if (a != null) a.before = b; else last = b; if (last == null) head = p; else { p.before = last; last.after = p; } tail = p; ++modCount; } } void internalWriteEntries(java.io.ObjectOutputStream s) throws IOException { for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) { s.writeObject(e.key); s.writeObject(e.value); } } /** * Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance * with the specified initial capacity and load factor. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public LinkedHashMap(int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor); accessOrder = false; } /** * Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance * with the specified initial capacity and a default load factor (0.75). * * @param initialCapacity the initial capacity * @throws IllegalArgumentException if the initial capacity is negative */ public LinkedHashMap(int initialCapacity) { super(initialCapacity); accessOrder = false; } /** * Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance * with the default initial capacity (16) and load factor (0.75). */ public LinkedHashMap() { super(); accessOrder = false; } /** * Constructs an insertion-ordered <tt>LinkedHashMap</tt> instance with * the same mappings as the specified map. The <tt>LinkedHashMap</tt> * instance is created with a default load factor (0.75) and an initial * capacity sufficient to hold the mappings in the specified map. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null */ public LinkedHashMap(Map<? extends K, ? extends V> m) { super(); accessOrder = false; putMapEntries(m, false); } /** * Constructs an empty <tt>LinkedHashMap</tt> instance with the * specified initial capacity, load factor and ordering mode. * * @param initialCapacity the initial capacity * @param loadFactor the load factor * @param accessOrder the ordering mode - <tt>true</tt> for * access-order, <tt>false</tt> for insertion-order * @throws IllegalArgumentException if the initial capacity is negative * or the load factor is nonpositive */ public LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) { super(initialCapacity, loadFactor); this.accessOrder = accessOrder; } /** * Returns <tt>true</tt> if this map maps one or more keys to the * specified value. * * @param value value whose presence in this map is to be tested * @return <tt>true</tt> if this map maps one or more keys to the * specified value */ public boolean containsValue(Object value) { for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) { V v = e.value; if (v == value || (value != null && value.equals(v))) return true; } return false; } /** * Returns the value to which the specified key is mapped, * or {@code null} if this map contains no mapping for the key. * * <p>More formally, if this map contains a mapping from a key * {@code k} to a value {@code v} such that {@code (key==null ? k==null : * key.equals(k))}, then this method returns {@code v}; otherwise * it returns {@code null}. (There can be at most one such mapping.) * * <p>A return value of {@code null} does not <i>necessarily</i> * indicate that the map contains no mapping for the key; it's also * possible that the map explicitly maps the key to {@code null}. * The {@link #containsKey containsKey} operation may be used to * distinguish these two cases. */ public V get(Object key) { Node<K,V> e; if ((e = getNode(hash(key), key)) == null) return null; if (accessOrder) afterNodeAccess(e); return e.value; } /** * {@inheritDoc} */ public V getOrDefault(Object key, V defaultValue) { Node<K,V> e; if ((e = getNode(hash(key), key)) == null) return defaultValue; if (accessOrder) afterNodeAccess(e); return e.value; } /** * {@inheritDoc} */ public void clear() { super.clear(); head = tail = null; } /** * Returns <tt>true</tt> if this map should remove its eldest entry. * This method is invoked by <tt>put</tt> and <tt>putAll</tt> after * inserting a new entry into the map. It provides the implementor * with the opportunity to remove the eldest entry each time a new one * is added. This is useful if the map represents a cache: it allows * the map to reduce memory consumption by deleting stale entries. * * <p>Sample use: this override will allow the map to grow up to 100 * entries and then delete the eldest entry each time a new entry is * added, maintaining a steady state of 100 entries. * <pre> * private static final int MAX_ENTRIES = 100; * * protected boolean removeEldestEntry(Map.Entry eldest) { * return size() &gt; MAX_ENTRIES; * } * </pre> * * <p>This method typically does not modify the map in any way, * instead allowing the map to modify itself as directed by its * return value. It <i>is</i> permitted for this method to modify * the map directly, but if it does so, it <i>must</i> return * <tt>false</tt> (indicating that the map should not attempt any * further modification). The effects of returning <tt>true</tt> * after modifying the map from within this method are unspecified. * * <p>This implementation merely returns <tt>false</tt> (so that this * map acts like a normal map - the eldest element is never removed). * * @param eldest The least recently inserted entry in the map, or if * this is an access-ordered map, the least recently accessed * entry. This is the entry that will be removed it this * method returns <tt>true</tt>. If the map was empty prior * to the <tt>put</tt> or <tt>putAll</tt> invocation resulting * in this invocation, this will be the entry that was just * inserted; in other words, if the map contains a single * entry, the eldest entry is also the newest. * @return <tt>true</tt> if the eldest entry should be removed * from the map; <tt>false</tt> if it should be retained. */ protected boolean removeEldestEntry(Map.Entry<K,V> eldest) { return false; } /** * Returns a {@link Set} view of the keys contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Set.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt> * operations. It does not support the <tt>add</tt> or <tt>addAll</tt> * operations. * Its {@link Spliterator} typically provides faster sequential * performance but much poorer parallel performance than that of * {@code HashMap}. * * @return a set view of the keys contained in this map */ public Set<K> keySet() { Set<K> ks = keySet; if (ks == null) { ks = new LinkedKeySet(); keySet = ks; } return ks; } final class LinkedKeySet extends AbstractSet<K> { public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } public final Iterator<K> iterator() { return new LinkedKeyIterator(); } public final boolean contains(Object o) { return containsKey(o); } public final boolean remove(Object key) { return removeNode(hash(key), key, null, false, true) != null; } public final Spliterator<K> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED | Spliterator.DISTINCT); } public final void forEach(Consumer<? super K> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) action.accept(e.key); if (modCount != mc) throw new ConcurrentModificationException(); } } /** * Returns a {@link Collection} view of the values contained in this map. * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress * (except through the iterator's own <tt>remove</tt> operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Collection.remove</tt>, <tt>removeAll</tt>, * <tt>retainAll</tt> and <tt>clear</tt> operations. It does not * support the <tt>add</tt> or <tt>addAll</tt> operations. * Its {@link Spliterator} typically provides faster sequential * performance but much poorer parallel performance than that of * {@code HashMap}. * * @return a view of the values contained in this map */ public Collection<V> values() { Collection<V> vs = values; if (vs == null) { vs = new LinkedValues(); values = vs; } return vs; } final class LinkedValues extends AbstractCollection<V> { public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } public final Iterator<V> iterator() { return new LinkedValueIterator(); } public final boolean contains(Object o) { return containsValue(o); } public final Spliterator<V> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED); } public final void forEach(Consumer<? super V> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) action.accept(e.value); if (modCount != mc) throw new ConcurrentModificationException(); } } /** * Returns a {@link Set} view of the mappings contained in this map. * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through * the iterator's own <tt>remove</tt> operation, or through the * <tt>setValue</tt> operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding * mapping from the map, via the <tt>Iterator.remove</tt>, * <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and * <tt>clear</tt> operations. It does not support the * <tt>add</tt> or <tt>addAll</tt> operations. * Its {@link Spliterator} typically provides faster sequential * performance but much poorer parallel performance than that of * {@code HashMap}. * * @return a set view of the mappings contained in this map */ public Set<Map.Entry<K,V>> entrySet() { Set<Map.Entry<K,V>> es; return (es = entrySet) == null ? (entrySet = new LinkedEntrySet()) : es; } final class LinkedEntrySet extends AbstractSet<Map.Entry<K,V>> { public final int size() { return size; } public final void clear() { LinkedHashMap.this.clear(); } public final Iterator<Map.Entry<K,V>> iterator() { return new LinkedEntryIterator(); } public final boolean contains(Object o) { if (!(o instanceof Map.Entry)) return false; Map.Entry<?,?> e = (Map.Entry<?,?>) o; Object key = e.getKey(); Node<K,V> candidate = getNode(hash(key), key); return candidate != null && candidate.equals(e); } public final boolean remove(Object o) { if (o instanceof Map.Entry) { Map.Entry<?,?> e = (Map.Entry<?,?>) o; Object key = e.getKey(); Object value = e.getValue(); return removeNode(hash(key), key, value, true, true) != null; } return false; } public final Spliterator<Map.Entry<K,V>> spliterator() { return Spliterators.spliterator(this, Spliterator.SIZED | Spliterator.ORDERED | Spliterator.DISTINCT); } public final void forEach(Consumer<? super Map.Entry<K,V>> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) action.accept(e); if (modCount != mc) throw new ConcurrentModificationException(); } } // Map overrides public void forEach(BiConsumer<? super K, ? super V> action) { if (action == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) action.accept(e.key, e.value); if (modCount != mc) throw new ConcurrentModificationException(); } public void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) { if (function == null) throw new NullPointerException(); int mc = modCount; for (LinkedHashMap.Entry<K,V> e = head; e != null; e = e.after) e.value = function.apply(e.key, e.value); if (modCount != mc) throw new ConcurrentModificationException(); } // Iterators abstract class LinkedHashIterator { LinkedHashMap.Entry<K,V> next; LinkedHashMap.Entry<K,V> current; int expectedModCount; LinkedHashIterator() { next = head; expectedModCount = modCount; current = null; } public final boolean hasNext() { return next != null; } final LinkedHashMap.Entry<K,V> nextNode() { LinkedHashMap.Entry<K,V> e = next; if (modCount != expectedModCount) throw new ConcurrentModificationException(); if (e == null) throw new NoSuchElementException(); current = e; next = e.after; return e; } public final void remove() { Node<K,V> p = current; if (p == null) throw new IllegalStateException(); if (modCount != expectedModCount) throw new ConcurrentModificationException(); current = null; K key = p.key; removeNode(hash(key), key, null, false, false); expectedModCount = modCount; } } final class LinkedKeyIterator extends LinkedHashIterator implements Iterator<K> { public final K next() { return nextNode().getKey(); } } final class LinkedValueIterator extends LinkedHashIterator implements Iterator<V> { public final V next() { return nextNode().value; } } final class LinkedEntryIterator extends LinkedHashIterator implements Iterator<Map.Entry<K,V>> { public final Map.Entry<K,V> next() { return nextNode(); } } }
671b94895573a8236e82523af23467824aa4841b
ef9693d426e94385c8fffd57e77cb22dcb381729
/src/main/java/com/huawei/master/plc/bean/PlcOnline.java
9a31e889de34e5774487b2634aa95024e1773fe6
[]
no_license
zyj408/master-SpringBoot
e145cc756e3eb9893ee916523d8971ea09c036df
ba2531c70665487b696a127a79e67329081727a3
refs/heads/master
2021-06-28T13:26:29.928755
2019-04-22T01:35:59
2019-04-22T01:35:59
146,195,130
0
0
null
null
null
null
UTF-8
Java
false
false
1,151
java
package com.huawei.master.plc.bean; import com.huawei.master.plc.domain.Plc; public class PlcOnline { private Plc plc; private long lastTime; private long upCount; private long downCount; private long x; private long y; public PlcOnline(Plc plc) { this.plc = plc; lastTime = System.currentTimeMillis(); upCount = 0; } public Plc getPlc() { return plc; } public void setPlc(Plc plc) { this.plc = plc; } public long getLastTime() { return lastTime; } public void setLastTime(long lastTime) { this.lastTime = lastTime; } public long getUpCount() { return upCount; } public void setUpCount(long upCount) { this.upCount = upCount; } public long getDownCount() { return downCount; } public void setDownCount(long downCount) { this.downCount = downCount; } public void up(int x) { this.upCount++; this.x = x; } public void down() { this.downCount++; this.lastTime = System.currentTimeMillis(); } }
4b5cec32c40d6944e6af5e430dfdd124cecea75f
8e6ae2b194ef0d67d69d30ecc409a2cafc79642a
/src/main/java/tgtools/xml/XmlSerializeException.java
e35ceaeb5aea48338a6eb32ea74806e0a686d0a6
[]
no_license
tianjing/tgtools.core
3d07965a38a6c55988b001c35f4453e8d23183fd
00404f379e5f63130950b85c969ffef6a58c8e4a
refs/heads/master
2023-04-14T12:21:44.962510
2023-03-22T05:39:48
2023-03-22T05:39:48
83,109,894
2
1
null
2022-11-16T08:56:02
2017-02-25T05:51:21
Java
UTF-8
Java
false
false
516
java
package tgtools.xml; import tgtools.exceptions.APPRuntimeException; /** * @author tianjing */ public class XmlSerializeException extends APPRuntimeException{ private static final long serialVersionUID = 8731745468346909325L; public XmlSerializeException(Throwable pException) { super(pException); } public XmlSerializeException(String pExcptMsg) { super(pExcptMsg); } public XmlSerializeException(String pExcptMsg, Throwable pExcpt) { super(pExcptMsg, pExcpt); } }
27b8cda07c0b33a71d4a22d3078ee863a416772e
9796ea48d0841f86b6319635dacb8393f74d5d42
/java-rxjava/src/main/java/org/joke/rxjava/lesson_3/d_combine/Operation_StartWith.java
4073e61267298c824312e52c65f74d1373dc2b1f
[]
no_license
dxh8808/AndroidDemo
4779087cd9e5cdc30f881eaa7ce660c76c745325
bb7ffb4229097e01d6b50b0427f9b2d0dfa2721a
refs/heads/master
2021-12-23T21:56:27.283504
2017-11-25T14:39:39
2017-11-25T14:39:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
package org.joke.rxjava.lesson_3.d_combine; import java.util.ArrayList; import java.util.List; import rx.Observable; import rx.functions.Action1; /** * 在数据序列的开头插入一条指定的项 * 如果你想要一个Observable在发射数据之前先发射一个指定的数据序列,可以使 * 用 StartWith 操作符。(如果你想一个Observable发射的数据末尾追加一个数据序列可以使 * 用 Concat 操作符。) * 可接受一个Iterable或者多个Observable作为函数的参数。 * Javadoc: startWith(Iterable)) * Javadoc: startWith(T)) (最多接受九个参数) * 你也可以传递一个Observable给 startWith ,它会将那个Observable的发射物插在原始 * Observable发射的数据序列之前,然后把这个当做自己的发射物集合。这可以看作 * 是 Concat 的反转。 * Javadoc: startWith(Observable)) */ public class Operation_StartWith { private static List<Integer> list = new ArrayList<>(); private static void init() { for (int i = 1; i < 9; i++) { list.add(i); } } public static void main(String[] args) { init(); step_1(); } private static void step_1() { Observable.from(list).startWith(Observable.from(list)).subscribe(new Action1<Integer>() { @Override public void call(Integer integer) { System.out.println("integer = " + integer); } }); } }
f636d2f81a969453d996d160ee91926d9ef9ebbd
0040681a763159add8287b35327cb92e8ebab0a9
/app/src/main/java/com/example/archirayan/cabsbookdriver/model/VehicleInformationModel.java
c067ec65ff8ef5ef8fea5eb088ab8f0448ca73c0
[]
no_license
iamrahulyadav/CabsBookDriver
1219d71d04f0166912fd5c2bb47d99eaaf4c0ad5
a9c8a7a140fbb3ce7e032a79c1aecbab7245abf8
refs/heads/master
2020-03-27T21:04:28.041321
2018-02-12T10:27:31
2018-02-12T10:27:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,872
java
package com.example.archirayan.cabsbookdriver.model; import com.google.gson.annotations.SerializedName; /** * Created by archirayan on 3/1/18. */ public class VehicleInformationModel { @SerializedName("id") private String id; @SerializedName("make") private String make; @SerializedName("model") private String model; @SerializedName("year") private String year; @SerializedName("license_plate") private String license_plate; @SerializedName("vehicle_color") private String vehicle_color; @SerializedName("vehicle_type") private String vehicle_type; public String getImage() { return image; } public void setImage(String image) { this.image = image; } @SerializedName("image") private String image; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getLicense_plate() { return license_plate; } public void setLicense_plate(String license_plate) { this.license_plate = license_plate; } public String getVehicle_color() { return vehicle_color; } public void setVehicle_color(String vehicle_color) { this.vehicle_color = vehicle_color; } public String getVehicle_type() { return vehicle_type; } public void setVehicle_type(String vehicle_type) { this.vehicle_type = vehicle_type; } }
ec6284d1788ba10a03556f600c40904bb00273ac
66be97a312c74e0cb56c19081d64aba49650c56a
/app/src/test/java/com/example/hyu13/firebase/ExampleUnitTest.java
5d308b46d2fb534a264c6243408188295306e5f4
[]
no_license
jason18401/FireBaseLogin
5d073358fb45e93ed315819749a5fe665152bddb
13b453cd67f633ea7ffd754a048528eb50726e57
refs/heads/master
2020-03-25T07:26:32.126217
2018-08-04T20:33:12
2018-08-04T20:33:12
143,561,191
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.example.hyu13.firebase; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
4001408f679c73a9ebabe30c40294ff448110da5
b30268c52a91409c2e2a4f0b5325f4208e731960
/lab14/src/lab14/mainclass.java
8b45344a7f70cb1e2bf25a8bc8ea355dfa5afbf0
[]
no_license
shahzaibansari123/Shahzaib249lab14taskSCD
e9c14e9a0f2819354ff16717ce052aa973cebdfe
be59c58d10f8c691fcc4f8984ef2d7d25593feda
refs/heads/master
2023-05-06T14:00:58.099641
2021-05-26T05:44:32
2021-05-26T05:44:32
370,908,952
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package lab14; public class mainclass { public static void main(String[] args) { // TODO Auto-generated method stub } }
5477106c0ff53cb00851e070d925a0705a04283c
3b60b4f6426ae81ca317f765429b1468724aa158
/src/LogicaNegocio/Validacion.java
3ad1bc9d8558a52287f198b18c430ab9d5e1f0a7
[]
no_license
Superrobertomr/PV
74894960efb46c139a8a0a2c1d8d9e7f77d6996a
310ceddb58b42e5e7a0b0d35f94562485b426447
refs/heads/master
2021-01-01T17:26:53.069725
2017-08-13T21:47:33
2017-08-13T21:47:33
98,076,644
0
0
null
null
null
null
UTF-8
Java
false
false
821
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 LogicaNegocio; import Datos.ValidarUsuario; import java.sql.SQLException; /** * * @author My Little Kid */ public class Validacion { public Validacion(){ } public String ValidarUsuario(String Usuario, String Contrasena) throws SQLException, ClassNotFoundException{ ValidarUsuario validar = new ValidarUsuario(); String user=""; int Bandera = validar.VerificarUsuario(Usuario, Contrasena); if (Bandera == 1){ user = Usuario; } if(Bandera == 0){ user = "Nada"; } return user; } }
9ab001d723de549741cee97d600e8edc7fa5434e
b16fb0d4909da173f1d47ae9f89bca3b521e9051
/src/main/java/com/gzs/learn/bootstrap/controller/SwaggerConfiguration.java
871acda32cbe3dbccb4b247388ffe968d6342c8a
[ "Apache-2.0" ]
permissive
tiger8888/bootstrap
d2c70940b1bb81b5f085dee7d84a4025a767a45e
eb110d5a6b2f1b0d199a016fad9f9e39e52e9b76
refs/heads/master
2021-01-18T03:51:28.114102
2016-07-28T09:32:59
2016-07-28T09:36:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
package com.gzs.learn.bootstrap.controller; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Controller; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @Controller public class SwaggerConfiguration { @Bean public Docket testApi() { Docket docket = new Docket(DocumentationType.SWAGGER_2).groupName("user-api").apiInfo(apiInfo()).select() .build(); return docket; } private ApiInfo apiInfo() { return new ApiInfoBuilder().title("User api").description("user api").termsOfServiceUrl("http://springfox.io") .license("Apache License Version 2.0") .licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE").version("2.0").build(); } }
a43ddfe6c3dbbf1b3ec7f3e6feaa4ebfe092d7f8
67bd84b45b8c0decf68a5ccf638c23897d64a450
/src/main/java/Runner_files/Bills_positive_scenarios_runner.java
c1df754691953c03564f2e8722f7990b79fed9ef
[]
no_license
AnushaJagadish/Android_suite
e949d619cd588b17a3982fa562512aa57e22769a
7dbb173e97abb34285451422907639d7cb36fa24
refs/heads/main
2023-06-23T00:06:50.376338
2021-07-19T07:33:37
2021-07-19T07:33:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package Runner_files; import io.cucumber.testng.AbstractTestNGCucumberTests; import io.cucumber.testng.CucumberOptions; @CucumberOptions(plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}, features = "src\\main\\java\\Bills_positive_scenarios\\Bills_positive_scenarios.feature", glue= {"Bills_positive_scenarios"}, monochrome = true,publish = true) public class Bills_positive_scenarios_runner extends AbstractTestNGCucumberTests { }
950f27e549006f18264b34396546d4c73d270639
128e9bc4a7d6acb983f728a7d82bd6b262ea3fb2
/src/animations/AnimationRunner.java
f35f87649da6fa8b15ead5ed1d975f43793a400f
[]
no_license
avital676/ArkanoidGame
9bd0e9557f147fa359aa82f89f32d46febe9a3d2
29c73cc4764a8ebfc3b48405eef6e1fc376bacb4
refs/heads/master
2022-12-14T07:41:09.140875
2020-09-07T10:28:17
2020-09-07T10:28:17
293,494,283
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package animations; import biuoop.DrawSurface; import biuoop.GUI; /** * Animation Runner is a class for running animations. It has a GUI, * and runs animations with a certain number of frames per second. */ public class AnimationRunner { private GUI gui; private int framesPerSecond; private biuoop.Sleeper sleeper; /** * Constructor: creates a new AnimationRunner with given gui, number of frames per second and a sleeper. * * @param gui graphical user interface. */ public AnimationRunner(GUI gui) { this.gui = gui; this.framesPerSecond = 60; this.sleeper = new biuoop.Sleeper(); } /** * Runs a given animation by setting timing and calling a method to show frames of the animation. * * @param animation the animation to be run. */ public void run(Animation animation) { int millisecondsPerFrame = 1000 / framesPerSecond; while (!animation.shouldStop()) { // timing: long startTime = System.currentTimeMillis(); // show animation: DrawSurface d = gui.getDrawSurface(); animation.doOneFrame(d); gui.show(d); // sleep: long usedTime = System.currentTimeMillis() - startTime; long milliSecondLeftToSleep = millisecondsPerFrame - usedTime; if (milliSecondLeftToSleep > 0) { this.sleeper.sleepFor(milliSecondLeftToSleep); } } } }
da25a8a3d668d7e1cdd3f30272354d0d199c6302
cefe248faf76b4caf844232fb5b89c6b26f1f2e4
/abstractfactory/componentfactories/NJBonusComponentFactory.java
34c3eb27b0ea4c363938f521fecc4ae508d786a5
[]
no_license
williamgarner/GarnerWagnerFactory
e4f0ce7faac9ccd22cc6639a9934938fb7bfdea1
79186dd927be90e1b0bd40868d4f8650787e6f70
refs/heads/master
2020-07-31T18:44:27.638556
2019-10-01T23:52:47
2019-10-01T23:52:47
210,715,381
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package abstractfactory.componentfactories; import abstractfactory.components.*; public class NJBonusComponentFactory extends SlotComponentFactory { @Override public Cabinet createCabinet() { return new LargeCabinet(); } @Override public Payment createPayment() { return new CoinsPayment(); } @Override public Display createDisplay() { return new ReelsDisplay(); } @Override public GPU createGPU() { return new ARMGPU(); } @Override public OS createOS() { return new WindowsMEOS(); } }
9b4744c38bb421550844b2645850552f00fdd800
4b622a2368daebf830b45e5145be19fa61118dcf
/eElections/src/main/java/info/akritikos/eelections/queries/EElectoralPeriphery.java
7ad2a0ee030fccc037e40dbea3ece62bb194cb47
[ "Apache-2.0" ]
permissive
akritikos/PLI24
153766cd3d67000379f84c6177de31379ebbdb04
022ae2bc30f4fa2243d0e76d658d205d804580a5
refs/heads/master
2021-06-16T03:09:19.735823
2017-05-10T10:27:33
2017-05-10T10:27:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package info.akritikos.eelections.queries; import info.akritikos.eelections.contracts.ISearchQueries; /** * Search fields on ElectoralPeriphery entities */ public enum EElectoralPeriphery implements ISearchQueries { PkElectoralPeripheryId, FldName, FldRegisteredCitizensCount, FldSeatsCount }
9acca717c15bedf506b7a8329c9795196dcf2c5b
53962a4d9ec900a85b0b31cea832306bd7ee81a4
/src/main/java/io/jaylim/compiler/ast/pojos/statements/withoutsubstatement/tries/Catches.java
bf8d6f11fe8a245c788f7cf5ffa4d1325fba3920
[ "BSD-3-Clause" ]
permissive
jisunglim/pasta
73a9a48b588a965ea235c5041e6174cc25b68343
352d86eeede759534d2b02de747829bc4586fb50
refs/heads/master
2020-12-25T15:18:28.069904
2016-09-20T01:00:17
2016-09-20T01:00:17
67,093,659
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
package io.jaylim.compiler.ast.pojos.statements.withoutsubstatement.tries; /** * @author Jisung Lim <[email protected]> */ @Deprecated public class Catches { }
dc3efad4ed74ee60af4c27a6af3b6484e6655c50
36e98b00de5457f8dcbaa290c1924f8993819475
/src/main/java/com/denuncias/web/rest/errors/ParameterizedErrorDTO.java
5a354908f30b0e3e107a02363cdc626ebb57079c
[]
no_license
juanultimate/denuncias
20117c4992033c58e470d76500489db5a7455888
5d04b4c6ef6a9d08d15e1b48b9468db12344523e
refs/heads/master
2020-04-06T03:34:03.533339
2016-09-13T12:41:12
2016-09-13T12:41:12
52,638,211
0
1
null
2016-09-13T12:41:24
2016-02-26T22:58:44
JavaScript
UTF-8
Java
false
false
581
java
package com.denuncias.web.rest.errors; import java.io.Serializable; /** * DTO for sending a parameterized error message. */ public class ParameterizedErrorDTO implements Serializable { private static final long serialVersionUID = 1L; private final String message; private final String[] params; public ParameterizedErrorDTO(String message, String... params) { this.message = message; this.params = params; } public String getMessage() { return message; } public String[] getParams() { return params; } }
19fdca9b9e207472290ec0eae6e2c0c05996e274
c7204381d8e4be71b2eb8f627f67de830ff558e0
/pet_clinic_data/src/main/java/com/mizuirokoala/pet_clinic/model/PetType.java
40f3dbc2e66091f5f1fe37be0f582ca7beff0e38
[]
no_license
Mizuirokoala/Pet_Clinic
ae7b8294093153f523eef9e452a393f0266bbe7b
125cf64cf8d564f26dbc7239b9ec2a25bc014176
refs/heads/main
2023-06-02T22:07:01.977257
2021-06-16T20:32:21
2021-06-16T20:32:21
369,647,575
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package com.mizuirokoala.pet_clinic.model; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Setter @Getter @NoArgsConstructor public class PetType extends BaseEntity{ private String name; }
864587e34808651b4f1979f2233c2660719faa59
d10deacfd8249b9c5529c7d2c4bca1891ee1242a
/app/build/tmp/kapt3/stubs/liveDebug/com/droid/dorpee/ui/venue/venueresponse/Service.java
8b363e8d78d12cd52af6ab1a9f4fdc44859e34a0
[]
no_license
mohanbright/DorpeeAndroid
e2238d995c1c22fbe2ae4e41c8a5ce4fc968c02e
c30d0aeedd0df31a5c8e7800e81155d1cd5b78a7
refs/heads/master
2022-12-10T05:52:47.721702
2020-08-31T20:07:11
2020-08-31T20:07:11
291,743,562
0
0
null
null
null
null
UTF-8
Java
false
false
8,388
java
package com.droid.dorpee.ui.venue.venueresponse; import java.lang.System; @kotlin.Metadata(mv = {1, 1, 16}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0018\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\b\u0086\b\u0018\u00002\u00020\u0001BY\u0012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u0003\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0003\u0012\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0007\u0012\n\b\u0002\u0010\b\u001a\u0004\u0018\u00010\t\u0012\n\b\u0002\u0010\n\u001a\u0004\u0018\u00010\u0003\u0012\n\b\u0002\u0010\u000b\u001a\u0004\u0018\u00010\u0003\u00a2\u0006\u0002\u0010\fJ\u000b\u0010\u0018\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003J\u000b\u0010\u0019\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003J\u000b\u0010\u001a\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003J\u0010\u0010\u001b\u001a\u0004\u0018\u00010\u0007H\u00c6\u0003\u00a2\u0006\u0002\u0010\u0012J\u000b\u0010\u001c\u001a\u0004\u0018\u00010\tH\u00c6\u0003J\u000b\u0010\u001d\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003J\u000b\u0010\u001e\u001a\u0004\u0018\u00010\u0003H\u00c6\u0003Jb\u0010\u001f\u001a\u00020\u00002\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u0004\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u00072\n\b\u0002\u0010\b\u001a\u0004\u0018\u00010\t2\n\b\u0002\u0010\n\u001a\u0004\u0018\u00010\u00032\n\b\u0002\u0010\u000b\u001a\u0004\u0018\u00010\u0003H\u00c6\u0001\u00a2\u0006\u0002\u0010 J\u0013\u0010!\u001a\u00020\"2\b\u0010#\u001a\u0004\u0018\u00010$H\u00d6\u0003J\t\u0010%\u001a\u00020\u0007H\u00d6\u0001J\t\u0010&\u001a\u00020\u0003H\u00d6\u0001R\u0018\u0010\u0002\u001a\u0004\u0018\u00010\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u0018\u0010\u0004\u001a\u0004\u0018\u00010\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u000eR\u0018\u0010\u0005\u001a\u0004\u0018\u00010\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u000eR\u001a\u0010\u0006\u001a\u0004\u0018\u00010\u00078\u0006X\u0087\u0004\u00a2\u0006\n\n\u0002\u0010\u0013\u001a\u0004\b\u0011\u0010\u0012R\u0018\u0010\b\u001a\u0004\u0018\u00010\t8\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R\u0018\u0010\n\u001a\u0004\u0018\u00010\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u000eR\u0018\u0010\u000b\u001a\u0004\u0018\u00010\u00038\u0006X\u0087\u0004\u00a2\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u000e\u00a8\u0006\'"}, d2 = {"Lcom/droid/dorpee/ui/venue/venueresponse/Service;", "Ljava/io/Serializable;", "category", "", "createdAt", "deletedAt", "id", "", "pivot", "Lcom/droid/dorpee/ui/venue/venueresponse/Pivot;", "service", "updatedAt", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lcom/droid/dorpee/ui/venue/venueresponse/Pivot;Ljava/lang/String;Ljava/lang/String;)V", "getCategory", "()Ljava/lang/String;", "getCreatedAt", "getDeletedAt", "getId", "()Ljava/lang/Integer;", "Ljava/lang/Integer;", "getPivot", "()Lcom/droid/dorpee/ui/venue/venueresponse/Pivot;", "getService", "getUpdatedAt", "component1", "component2", "component3", "component4", "component5", "component6", "component7", "copy", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lcom/droid/dorpee/ui/venue/venueresponse/Pivot;Ljava/lang/String;Ljava/lang/String;)Lcom/droid/dorpee/ui/venue/venueresponse/Service;", "equals", "", "other", "", "hashCode", "toString", "app_liveDebug"}) public final class Service implements java.io.Serializable { @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "category") private final java.lang.String category = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "created_at") private final java.lang.String createdAt = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "deleted_at") private final java.lang.String deletedAt = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "id") private final java.lang.Integer id = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "pivot") private final com.droid.dorpee.ui.venue.venueresponse.Pivot pivot = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "service") private final java.lang.String service = null; @org.jetbrains.annotations.Nullable() @com.google.gson.annotations.SerializedName(value = "updated_at") private final java.lang.String updatedAt = null; @org.jetbrains.annotations.Nullable() public final java.lang.String getCategory() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String getCreatedAt() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String getDeletedAt() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.Integer getId() { return null; } @org.jetbrains.annotations.Nullable() public final com.droid.dorpee.ui.venue.venueresponse.Pivot getPivot() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String getService() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String getUpdatedAt() { return null; } public Service(@org.jetbrains.annotations.Nullable() java.lang.String category, @org.jetbrains.annotations.Nullable() java.lang.String createdAt, @org.jetbrains.annotations.Nullable() java.lang.String deletedAt, @org.jetbrains.annotations.Nullable() java.lang.Integer id, @org.jetbrains.annotations.Nullable() com.droid.dorpee.ui.venue.venueresponse.Pivot pivot, @org.jetbrains.annotations.Nullable() java.lang.String service, @org.jetbrains.annotations.Nullable() java.lang.String updatedAt) { super(); } public Service() { super(); } @org.jetbrains.annotations.Nullable() public final java.lang.String component1() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String component2() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String component3() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.Integer component4() { return null; } @org.jetbrains.annotations.Nullable() public final com.droid.dorpee.ui.venue.venueresponse.Pivot component5() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String component6() { return null; } @org.jetbrains.annotations.Nullable() public final java.lang.String component7() { return null; } @org.jetbrains.annotations.NotNull() public final com.droid.dorpee.ui.venue.venueresponse.Service copy(@org.jetbrains.annotations.Nullable() java.lang.String category, @org.jetbrains.annotations.Nullable() java.lang.String createdAt, @org.jetbrains.annotations.Nullable() java.lang.String deletedAt, @org.jetbrains.annotations.Nullable() java.lang.Integer id, @org.jetbrains.annotations.Nullable() com.droid.dorpee.ui.venue.venueresponse.Pivot pivot, @org.jetbrains.annotations.Nullable() java.lang.String service, @org.jetbrains.annotations.Nullable() java.lang.String updatedAt) { return null; } @org.jetbrains.annotations.NotNull() @java.lang.Override() public java.lang.String toString() { return null; } @java.lang.Override() public int hashCode() { return 0; } @java.lang.Override() public boolean equals(@org.jetbrains.annotations.Nullable() java.lang.Object p0) { return false; } }
4467c8a6f90a1422721d429c5b729377dbfbd11f
94c305c93473b1cdedc125722c99d28df79967fe
/app/src/main/java/com/feicuiedu/demoretrofit/demoCGithub/GitHubApi2.java
467878a5bbb557d9de5088524a1703451af5ed58
[]
no_license
gqq519/RetrofitUseDemo
4c7541bcb1de4720f32dbae1ccb3a28ec64cefa9
234522d004c4bd1fa33fa5c3d7de8072ab1dc6c0
refs/heads/master
2020-09-18T17:09:09.156290
2016-09-02T07:27:49
2016-09-02T07:27:49
67,193,759
0
0
null
null
null
null
UTF-8
Java
false
false
1,741
java
package com.feicuiedu.demoretrofit.demoCGithub; import com.feicuiedu.demoretrofit.demoAOkHttp.Contributor; import java.util.List; import java.util.Map; import okhttp3.RequestBody; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.PUT; import retrofit2.http.Part; import retrofit2.http.Path; import retrofit2.http.Query; import retrofit2.http.QueryMap; public interface GitHubApi2 { @GET("repos/{owner}/{repo}/contributors") Call<List<Contributor>> contributors(@Path("owner") String owner, @Path("repo") String repo); /** * 注解的使用 * <p> * 1.GET,POST,PUT。。。。@GET("网址"),@POST("网址") 表明他的一个请求方式 * 2.http://www.baidu.com/day/images?q=123&order=desc&aa=asda&adsa=dsds; */ //http://www.baidu.com/day/年/月/日/images @GET("http://www.baidu.com/day/{year}/{month}/{day}/images") Call<ResponseBody> getImages(@Path("year") int year, @Path("month") int month, @Path("day") int day); //http://www.baidu.com/day/images?q=123&order=desc&aa=asda&adsa=dsds @GET("http://www.baidu.com/day/images") Call<ResponseBody> getImage(@Query("q") String q, @Query("order") String order); @GET("http://www.baidu.com/day/images") Call<ResponseBody> getImage(@QueryMap Map<String, String> po); @PUT("http://www") @Headers("Access-type:application/json") Call<ResponseBody> getMult(@Part("photo") RequestBody body, @Part("de") RequestBody body1); @PUT("网址") @Headers({"Access-type:...", "X-type"}) Call<ResponseBody> getMult1(@Part("photo") RequestBody body, @Part("de") RequestBody body1); }
823ec405497d21e7691e9ea02bbcf66b71a0b58a
b2f07f3e27b2162b5ee6896814f96c59c2c17405
/java/awt/dnd/peer/DropTargetContextPeer.java
67fad64bd8f9f1b65b7f0c0705b6484a91b144ec
[]
no_license
weiju-xi/RT-JAR-CODE
e33d4ccd9306d9e63029ddb0c145e620921d2dbd
d5b2590518ffb83596a3aa3849249cf871ab6d4e
refs/heads/master
2021-09-08T02:36:06.675911
2018-03-06T05:27:49
2018-03-06T05:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
998
java
package java.awt.dnd.peer; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.InvalidDnDOperationException; public abstract interface DropTargetContextPeer { public abstract void setTargetActions(int paramInt); public abstract int getTargetActions(); public abstract DropTarget getDropTarget(); public abstract DataFlavor[] getTransferDataFlavors(); public abstract Transferable getTransferable() throws InvalidDnDOperationException; public abstract boolean isTransferableJVMLocal(); public abstract void acceptDrag(int paramInt); public abstract void rejectDrag(); public abstract void acceptDrop(int paramInt); public abstract void rejectDrop(); public abstract void dropComplete(boolean paramBoolean); } /* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar * Qualified Name: java.awt.dnd.peer.DropTargetContextPeer * JD-Core Version: 0.6.2 */
fe63e1504eed034cc465d7c58760fd7d82b89b91
1b2b75753b6b5870e2093d62c741192962a9b446
/springmvc/src/main/java/com/mvc/henry/entity/User.java
db5febe6fcabbd3d761ecf5a8682bf75ae75efcc
[]
no_license
ThoreauZZ/java
30de53d519dc9a9bb709571e44e88fc3ce4db805
a64bff18d475c242a0d94c8b577542406774640f
refs/heads/master
2023-01-13T09:34:02.271390
2022-12-31T05:45:57
2022-12-31T05:45:57
44,820,917
1
2
null
2022-12-31T05:46:39
2015-10-23T15:17:09
Java
UTF-8
Java
false
false
637
java
package com.mvc.henry.entity; import javax.validation.constraints.NotNull; public class User { @NotNull(message="username cannot null") private String username; @NotNull private String password; private String addres; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getAddres() { return addres; } public void setAddres(String addres) { this.addres = addres; } }
5f6464440ae3de2ac99c39db0857dd838da14cd9
e2d44fdccba4459f5d096d943ff2d715ee75c0f5
/NYUSummerDoubleLinked/src/DDLNode.java
5001c13e326c510e4952f9a470b199c63c09247f
[]
no_license
hkajs/data_structures
6f66216b8d8d2eca76698b395419e7352c9d3db5
4acc30842d1561ad45f9fa497472c278c7740374
refs/heads/master
2022-02-10T01:02:01.413124
2019-07-22T14:32:50
2019-07-22T14:32:50
198,240,857
1
0
null
null
null
null
UTF-8
Java
false
false
527
java
public class DDLNode { public class DLLNode<T> { private T info; private DLLNode<T> forward, back; public DLLNode(T info) { this.info = info; forward = null; back = null; } public void setInfo(T info){this.info = info;} public T getInfo(){return info;} public void setForward(DLLNode<T> forward){this.forward = forward;} public void setBack(DLLNode<T> back){this.back = back;} public DLLNode getForward(){return forward;} public DLLNode getBack(){return back;} } }
4c5d85171e28a7210203fff26a64d6271e85ff45
206d15befecdfb67a93c61c935c2d5ae7f6a79e9
/lightDao/src/demo/org/swiftdao/MockCompositeKey.java
798dd7e0a7e638d59bdf6fa3399a4de7d85ccbbd
[]
no_license
MarkChege/micandroid
2e4d2884929548a814aa0a7715727c84dc4dcdab
0b0a6dee39cf7e258b6f54e1103dcac8dbe1c419
refs/heads/master
2021-01-10T19:15:34.994670
2013-05-16T05:56:21
2013-05-16T05:56:21
34,704,029
0
1
null
null
null
null
UTF-8
Java
false
false
1,251
java
package org.swiftdao; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Embeddable; /** * * @author Wang Yuxing * */ @Embeddable public class MockCompositeKey implements Serializable { private static final long serialVersionUID = 1L; @Column(name = "NPAGE_ID", nullable = false) private int pageId = 0; @Column(name = "DTIME_PERIOD", nullable = false) private Date timePeriod; public MockCompositeKey() { } public MockCompositeKey(int pageId, Date timePeriod) { super(); this.pageId = pageId; this.timePeriod = timePeriod; } public int getPageId() { return pageId; } public void setPageId(int pageId) { this.pageId = pageId; } public Date getTimePeriod() { return timePeriod; } public void setTimePeriod(Date timePeriod) { this.timePeriod = timePeriod; } @Override public boolean equals(Object obj) { MockCompositeKey target = (MockCompositeKey) obj; return this.pageId == target.getPageId() && this.timePeriod.equals(target.getTimePeriod()); } @Override public int hashCode() { return Integer.valueOf(this.pageId).hashCode() ^ this.getTimePeriod().hashCode(); } }
[ "zoopnin@29cfa68c-37ae-8048-bc30-ccda835e92b1" ]
zoopnin@29cfa68c-37ae-8048-bc30-ccda835e92b1
75ef1c9d8c9eb4b7684acf1e6f3b8ca9b1bf8d07
7ec0194c493e63b18ab17b33fe69a39ed6af6696
/masterlock/app_decompiled/sources/com/masterlock/ble/app/presenter/lock/keysafe/BatteryDetailKeySafePresenter.java
8766007c23802630e3e632708d291b059c1e0e08
[]
no_license
rasaford/CS3235
5626a6e7e05a2a57e7641e525b576b0b492d9154
44d393fb3afb5d131ad9d6317458c5f8081b0c04
refs/heads/master
2020-07-24T16:00:57.203725
2019-11-05T13:00:09
2019-11-05T13:00:09
207,975,557
0
1
null
null
null
null
UTF-8
Java
false
false
2,070
java
package com.masterlock.ble.app.presenter.lock.keysafe; import android.view.View; import android.widget.ImageView; import butterknife.ButterKnife; import com.masterlock.ble.app.C1075R; import com.masterlock.ble.app.bus.UpdateToolbarEvent.Builder; import com.masterlock.ble.app.presenter.AuthenticatedPresenter; import com.masterlock.ble.app.screens.LockScreens.BatteryDetailKeySafe; import com.masterlock.ble.app.screens.LockScreens.MoreBatteryInfoKeySafe; import com.masterlock.ble.app.view.lock.keysafe.BatteryDetailKeySafeView; import com.masterlock.core.Lock; import com.square.flow.appflow.AppFlow; public class BatteryDetailKeySafePresenter extends AuthenticatedPresenter<Lock, BatteryDetailKeySafeView> { ImageView mBatteryIndicator; public BatteryDetailKeySafePresenter(BatteryDetailKeySafeView batteryDetailKeySafeView) { super(batteryDetailKeySafeView); this.model = ((BatteryDetailKeySafe) AppFlow.getScreen(batteryDetailKeySafeView.getContext())).mLock; } public void start() { super.start(); this.mEventBus.post(new Builder(((BatteryDetailKeySafeView) this.view).getResources()).build()); this.mBatteryIndicator = (ImageView) ButterKnife.findById((View) this.view, (int) C1075R.C1077id.battery_indicator); setBatteryPercentage(); } private void setBatteryPercentage() { if (((Lock) this.model).getRemainingBatteryPercentage() <= ((BatteryDetailKeySafeView) this.view).getResources().getInteger(C1075R.integer.low_battery_percentage)) { this.mBatteryIndicator.setImageDrawable(((BatteryDetailKeySafeView) this.view).getResources().getDrawable(C1075R.C1076drawable.ic_battery_info_red)); } else { this.mBatteryIndicator.setImageDrawable(((BatteryDetailKeySafeView) this.view).getResources().getDrawable(C1075R.C1076drawable.ic_battery_info_white)); } } public void showBatteryInfoWebView() { AppFlow.get(((BatteryDetailKeySafeView) this.view).getContext()).goTo(new MoreBatteryInfoKeySafe((Lock) this.model)); } }
996229e0e1cfac796b4c2384c4329f1510428183
c0d6d6a19f6f4884da700645abcdd473a02b554b
/src/day17/Loop_Even_Number.java
d552499e908b160d5af44f73e21456c8a6c72d42
[]
no_license
zeeyoda/MyJavaPackages
c6a4d65591497db4308d028a88c4d1e5c44b1de6
233569412539230411cec821aa94c8eb9df881f8
refs/heads/master
2021-02-14T05:34:43.411860
2020-03-04T17:53:13
2020-03-04T17:53:13
244,775,259
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package day17; public class Loop_Even_Number { public static void main(String[] args) { int counter = 0 ; while (counter<=50){ System.out.print( counter + " "); counter += 2 ; } System.out.println("___________________________"); int number = 1; while (number <= 50 ) { System.out.print( number + " "); number += 2 ; } System.out.println("___________________________"); int cnt3 = 0 ; while (cnt3 <= 50) { if ( cnt3 %2 ==0) { System.out.println(cnt3 + " is an even number"); }else{ System.out.println(cnt3 + " is an odd number"); } ++cnt3; } } }
4ae3891fe5d2291594c109657f81c8a8e3081c00
091faa1f0effb10b629e5065dab05b783eb665a8
/app/src/main/java/net/pocketmine/server/Utils/ShellOutputFormatter.java
5ec0c383ccf46e31780c6ef8355a0a1c55d01804
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
JumHuang/PocketMine
38a42cc468ab7cfd85e2cf6ea30b029352d7ff63
c25e28282cf3d69c342ab9bd0993bae65b6b3fe8
refs/heads/master
2020-06-13T23:39:47.258266
2019-07-02T08:49:15
2019-07-02T08:49:15
194,824,721
0
0
null
null
null
null
UTF-8
Java
false
false
657
java
/** * This file is part of DroidPHP * * (c) 2013 Shushant Kumar * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package net.pocketmine.server.Utils; public class ShellOutputFormatter { public static String toHTML(String mString) { /** * Replace all repeating whitespace with one single whilespace */ mString = mString.replaceAll("\\s+", " "); // String[] mArrStr = mString.split("\n"); // String s = ""; // for (int i = 0; i < mArrStr.length; i++) { mString = "<strong>" + mString.trim() + "</strong><br/>"; // } return mString.trim(); } }
0b247ea61369f064c025beba3bff170be402c6da
2b46fa19057492850323f285bb6ad3d2522ea975
/Ladder/NineChapter/1_strStr & Coding Style/RestoreIPAddresses.java
adcaccf78a96729dc12d0f0fd29c822b1e8815fc
[]
no_license
pxu/Lintcode
eda75be6784b1b7658050b05820f727f649b0cf2
086855dec1fd057c8ce4f2d9c2e94747b88a36c9
refs/heads/master
2020-03-21T18:42:58.551160
2015-10-29T19:19:23
2015-10-29T19:19:23
138,908,746
1
0
null
2018-06-27T16:49:30
2018-06-27T16:49:29
null
UTF-8
Java
false
false
2,880
java
/* Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"]. (Order does not matter) */ public class EestoreIPAddresses { public ArrayList<String> restoreIpAddresses(String s) { ArrayList<String> result = new ArrayList<String>(); ArrayList<String> list = new ArrayList<String>(); if(s.length() <4 || s.length() > 12) return result; helper(result, list, s , 0); return result; } public void helper(ArrayList<String> result, ArrayList<String> list, String s, int start){ if(list.size() == 4){ if(start != s.length()) return; StringBuffer sb = new StringBuffer(); for(String tmp: list){ sb.append(tmp); sb.append("."); } sb.deleteCharAt(sb.length()-1); // delete the last '.' result.add(sb.toString()); return; } for(int i=start; i<s.length() && i<= start+3; i++){ String tmp = s.substring(start, i+1); if(isvalid(tmp)){ // backtracking list.add(tmp); helper(result, list, s, i+1); list.remove(list.size()-1); } } } private boolean isvalid(String s){ if(s.charAt(0) == '0') return s.equals("0"); // to eliminate cases like "00", "10" int digit = Integer.valueOf(s); return digit >= 0 && digit <= 255; } } /* DFS 基本思路就是取出一个合法的数字,作为IP地址的一项,然后递归处理剩下的项。可以想象出一颗树,每个结点有三个可能的分支(因为范围是0-255,所以可以由一位两位或者三位组成) 并且这里树的层数不会超过四层,因为IP地址由四段组成,到了之后我们就没必要再递归下去,可以结束了。这里除了上述的结束条件外,另一个就是字符串读完了 可以看出这棵树的规模是固定的,不会像平常的NP问题那样,时间复杂度取决于输入的规模,是指数量级的,所以这道题并不是NP问题,因为他的分支是四段,有限制 实现中需要一个判断数字是否为合法ip地址的一项的函数,首先要在0-255之间,其次前面字符不能是0 Reference: https://leetcodenotes.wordpress.com/2013/08/11/leetcode-restore-ip-address-%E6%8A%8A%E4%B8%80%E4%B8%AAstring-parse%E6%88%90valid-ip%E5%9C%B0%E5%9D%80%EF%BC%8C%E8%BF%94%E5%9B%9E%E6%89%80%E6%9C%89valid-parse/ http://www.ninechapter.com/solutions/restore-ip-addresses/ http://blog.csdn.net/linhuanmars/article/details/24683699 https://yusun2015.wordpress.com/2015/01/16/restore-ip-addresses/ */
7785c25325914db6b9a059a71e0285b9f056e485
42d1c983be6686c3f40f0b482b2de84b401c7ea5
/src/main/java/com/miro/springit/domain/Link.java
c24ec259b054e78fe283d765e77f3e1eec132bc5
[]
no_license
MirekKrenc/springit
3c35efe439dccc3571369672aa9780182e73cced
5636fb6bb13da5f4d312b6661705a58bb5e5dad8
refs/heads/master
2020-12-19T05:50:53.254401
2020-02-16T22:10:41
2020-02-16T22:10:41
235,637,948
0
0
null
null
null
null
UTF-8
Java
false
false
2,442
java
package com.miro.springit.domain; import com.miro.springit.service.BeanUtil; import lombok.*; import org.hibernate.validator.constraints.URL; import org.ocpsoft.prettytime.PrettyTime; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.net.URI; import java.net.URISyntaxException; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.ArrayList; import java.util.Date; import java.util.List; @Entity public class Link extends Auditable{ @Id @GeneratedValue private Long id; @NotNull(message="Tytul nie moze byc pusty") @NotEmpty(message="Prosze wprowadzic tytul ") private String title; @NotNull(message="Adres URL musi byc wypełniony") @NotEmpty(message="Adres URL jest wymagany ...") @URL(message="Wprowadz poprawny adres URL") private String url; // comments @OneToMany(mappedBy = "link") private List<Comment> comments = new ArrayList<>(); public Link(String title, String url) { this.title = title; this.url = url; } public Link() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public void setComments(List<Comment> comments) { this.comments = comments; } public void addComment(Comment comment) { this.comments.add(comment); } public List<Comment> getComments() { return comments; } public String getDomainName() throws URISyntaxException { URI uri = new URI(this.url); String domain = uri.getHost(); return domain.startsWith("www.") ? domain.substring(4) : domain; } public String getPrettyTime() { PrettyTime pt = BeanUtil.getBean(PrettyTime.class); return pt.format(convertToDateViaInstant(getCreationDate())); } private Date convertToDateViaInstant(LocalDateTime dateToConvert) { return java.util.Date.from(dateToConvert.atZone(ZoneId.systemDefault()).toInstant()); } }
e13ce6492cd975dc526e29abc76f3125075bd9fb
440e5bff3d6aaed4b07eca7f88f41dd496911c6b
/myapplication/src/main/java/com/vlocker/search/bi.java
d9c25b163e35cda3b0727c78421d8ae71ff10c4f
[]
no_license
freemanZYQ/GoogleRankingHook
4d4968cf6b2a6c79335b3ba41c1c9b80e964ddd3
bf9affd70913127f4cd0f374620487b7e39b20bc
refs/heads/master
2021-04-29T06:55:00.833701
2018-01-05T06:14:34
2018-01-05T06:14:34
77,991,340
7
5
null
null
null
null
UTF-8
Java
false
false
304
java
package com.vlocker.search; class bi implements Runnable { final /* synthetic */ bh a; bi(bh bhVar) { this.a = bhVar; } public void run() { if (this.a.b.a.b == null) { this.a.b.a.i.a("starry"); } else { this.a.b.a.f(); } } }
c22263b89197f679df184f8bec3c2a555a7c4dde
23cf9439a7178e5256cb689ca4bc77507495e0a4
/jpashop/src/main/java/jpabook/jpashop/domain/Item.java
f49e09983108b156e5c551fb2b6127ed26ed5425
[]
no_license
limwoobin/Spring_Data_Jpa-Study
e84fb328bc4222b59ace4bb2e0f47105f9408051
7424fc400127108f6950fc00c12fa2ba4670417c
refs/heads/master
2023-04-25T23:18:01.939700
2021-05-26T11:22:25
2021-05-26T11:22:25
365,428,254
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package jpabook.jpashop.domain; import lombok.Getter; import lombok.Setter; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Getter @Setter @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn public abstract class Item extends BaseEntity { @Id @GeneratedValue @Column(name = "ITEM_ID") private Long id; private String name; private int price; private int stockQuantity; @ManyToMany(mappedBy = "items") private List<Category> categories = new ArrayList<>(); }
3eb2f8a6fe44ab8a37a8a46dce1c974b22417d37
c9aa7cc34c5b3d68c0025e8094923b7c3bbc8941
/src/test/java/com/testcases/AssignmentTest.java
03cb1ba8353d3f5012295f214f279fe71323a70f
[]
no_license
markmazay/demo
e3b7d02e204f9dbe3e2460e49b9d61feaf7697dd
4f4518ae8c98a51f55b3e602128112f4012ed77c
refs/heads/master
2020-03-14T23:29:32.174038
2018-05-02T12:24:14
2018-05-02T12:24:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,731
java
package com.testcases; import java.io.FileInputStream; import java.util.Hashtable; import java.util.Properties; import org.apache.log4j.Logger; import org.openqa.selenium.support.PageFactory; //import org.junit.Assert; import org.testng.Assert; import org.testng.SkipException; import org.testng.annotations.AfterMethod; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.testng.asserts.SoftAssert; //import org.junit.Test; import org.testng.annotations.Test; import org.testng.asserts.SoftAssert; import com.base.BaseTest; import com.base.TestBase; import com.resources.Constants; import com.resources.P; import com.resources.TestUtil; import com.resources.Xls_Reader; import com.pages.LoginPage; import com.pages.HomePage; import com.pages.CommunityPage; import com.relevantcodes.extentreports.LogStatus; public class AssignmentTest extends BaseTest{ @BeforeSuite public void BeforeSuite() { initConfigurations(); getEnvironmentDetails(); } @BeforeMethod public void init() { initDriver(); } @AfterMethod public void quit() { // quitDriver(); } @AfterSuite public void closeChromeDriver() { quitDriver(); killChromeDriver(); } @DataProvider public Object[][] getTestData() { return TestUtil.getData("AssignmentTest", xlsx); } Xls_Reader xlsx = new Xls_Reader(Constants.testCases); LoginPage login = PageFactory.initElements(driver, LoginPage.class); HomePage home = PageFactory.initElements(driver, HomePage.class); // Login and go to community page @Test(priority=1,dataProvider="getTestData") public void LoginToSite(Hashtable<String,String> data) { if(!TestUtil.isExecutable("AssignmentTest", xlsx) || data.get("Runmode").equals("N")) throw new SkipException("Skipping the test"); test = rep.startTest("Test Data"); test.log(LogStatus.INFO, data.toString()); login.loginToSite(); home.goToCommunitypage(); } // Get number of answers and views and verify they are numeric @Test(priority=2,dataProvider="getTestData",dependsOnMethods={"LoginToSite"}) public void checkNumbersIsNumeric(Hashtable<String,String> data) { JOB_NUMBER = new Properties(); try { FileInputStream fs = new FileInputStream(Constants.JOB_NUMBER); JOB_NUMBER.load(fs); } catch (Exception e) { e.printStackTrace(); } CommunityPage comm = PageFactory.initElements(driver, CommunityPage.class); comm.checkStringIsNumeric(text(Constants.number_of_answers).replaceAll(" Answers", "").trim()); comm.addToProps("answers1", text(Constants.number_of_answers).replaceAll(" Answers", "").trim()); comm.checkStringIsNumeric(text(Constants.number_of_views).replaceAll(" Views", "").trim()); comm.addToProps("views1", text(Constants.number_of_views).replaceAll(" Views", "").trim()); } // Switch to Popular Questions @Test(priority=3,dataProvider="getTestData",dependsOnMethods={"checkNumbersIsNumeric"}) public void switchTopopular(Hashtable<String,String> data) { CommunityPage comm = PageFactory.initElements(driver, CommunityPage.class); comm.switchToPopularQuestions(); } // Get second set of answers and views @Test(priority=4,dataProvider="getTestData",dependsOnMethods={"switchTopopular"}) public void getSecondSet(Hashtable<String,String> data) { CommunityPage comm = PageFactory.initElements(driver, CommunityPage.class); comm.addToProps("answers2", text(Constants.number_of_answers).replaceAll(" Answers", "").trim()); comm.addToProps("views2", text(Constants.number_of_views).replaceAll(" Views", "").trim()); } // Verify second set of numbers greater than 1 st @Test(priority=5,dataProvider="getTestData",dependsOnMethods={"getSecondSet"}) public void comparenumbers(Hashtable<String,String> data) { JOB_NUMBER = new Properties(); try { FileInputStream fs = new FileInputStream(Constants.JOB_NUMBER); JOB_NUMBER.load(fs); } catch (Exception e) { e.printStackTrace(); } CommunityPage comm = PageFactory.initElements(driver, CommunityPage.class); comm.verifyPopularGreaterThanResent(JOB_NUMBER.getProperty("answers1"), JOB_NUMBER.getProperty("answers2")); comm.verifyPopularGreaterThanResent(JOB_NUMBER.getProperty("views1"), JOB_NUMBER.getProperty("views2")); } // ################################################### Ofcourse you can combine all in one test: ###################################################################################### /* @Test(priority=0,dataProvider="getTestData") public void SingleTest(Hashtable<String,String> data) { if(!TestUtil.isExecutable("AssignmentTest", xlsx) || data.get("Runmode").equals("N")) throw new SkipException("Skipping the test"); test = rep.startTest("Test Data"); test.log(LogStatus.INFO, data.toString()); login.loginToSite(); home.goToCommunitypage(); CommunityPage comm = PageFactory.initElements(driver, CommunityPage.class); comm.checkStringIsNumeric(text(Constants.number_of_answers).trim()); comm.addToProps("answers1", text(Constants.number_of_answers).trim()); comm.checkStringIsNumeric(text(Constants.number_of_views).trim()); comm.addToProps("views1", text(Constants.number_of_answers).trim()); comm.switchToPopularQuestions(); comm.addToProps("answers2", text(Constants.number_of_answers).trim()); comm.addToProps("views2", text(Constants.number_of_answers).trim()); comm.verifyPopularGreaterThanResent(JOB_NUMBER.getProperty("answers1"), JOB_NUMBER.getProperty("answers2")); comm.verifyPopularGreaterThanResent(JOB_NUMBER.getProperty("views1"), JOB_NUMBER.getProperty("views2")); } */ }
22c5b051e38fed4ffc704bcd3058bfb093c4d930
e53b7a02300de2b71ac429d9ec619d12f21a97cc
/src/com/coda/efinance/schemas/currency/GetRequest.java
ec4eb8d43bf45ad09eba6f2a263378c533214529
[]
no_license
phi2039/coda_xmli
2ad13c08b631d90a26cfa0a02c9c6c35416e796f
4c391b9a88f776c2bf636e15d7fcc59b7fcb7531
refs/heads/master
2021-01-10T05:36:22.264376
2015-12-03T16:36:23
2015-12-03T16:36:23
47,346,047
0
0
null
null
null
null
UTF-8
Java
false
false
1,922
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.12.03 at 01:43:12 AM EST // package com.coda.efinance.schemas.currency; import java.io.Serializable; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import com.coda.efinance.schemas.common.Key; import com.coda.efinance.schemas.common.Request; /** * <p>Java class for GetRequest complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="GetRequest"&gt; * &lt;complexContent&gt; * &lt;extension base="{http://www.coda.com/efinance/schemas/common}Request"&gt; * &lt;sequence&gt; * &lt;element name="Key" type="{http://www.coda.com/efinance/schemas/common}Key"/&gt; * &lt;/sequence&gt; * &lt;/extension&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "GetRequest", propOrder = { "key" }) public class GetRequest extends Request implements Serializable { @XmlElement(name = "Key", required = true) protected Key key; /** * Gets the value of the key property. * * @return * possible object is * {@link Key } * */ public Key getKey() { return key; } /** * Sets the value of the key property. * * @param value * allowed object is * {@link Key } * */ public void setKey(Key value) { this.key = value; } }
d944afc98a5a7f980fe07b0aa7ec488e790000eb
24396cdb9b5d366d0b93099718c2d527f402eec7
/src/LeetCodeHot100/String/Solution5.java
2b8886f8fc19702bc2f1e7350a258cf98295ac28
[]
no_license
suoranxiu/AlgrithmTest
ac633c4795079f9f7f14b9502972f47a326763dd
a0a5abd1279508ee98618da6fdfa36a935c57ca1
refs/heads/master
2023-02-25T20:04:22.874401
2021-01-29T09:40:20
2021-01-29T09:40:20
280,866,785
0
0
null
null
null
null
UTF-8
Java
false
false
2,157
java
package LeetCodeHot100.String; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Solution5 { /** * 给定一个字符串 s,找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。 */ public String longestPalindrome(String s) { if(s.length() <1 || s == null){ return ""; } Map<Integer,String> subStringMap = new HashMap(); int len = 0; StringBuffer reversed; for(int i=0; i< s.length();i++){ for (int j = i+1; j< s.length()-i+1; j++ ){ String subString = s.substring(i,i+j); reversed = new StringBuffer(subString).reverse(); if(reversed.toString().equals(subString)){ subStringMap.put(subString.length(),subString); if(subString.length() > len){ len = subString.length(); } } } } return subStringMap.get(len); } public String longestPalindrome2(String s){ return null; } public static void main(String[] args) { String str = "a"; Map<Integer,String> subStringMap = new HashMap(); int len = 0; // StringBuffer reversed; for(int i=0; i< str.length();i++){ for (int j = i+1; j< str.length(); j++ ){ String subString = str.substring(i,j); StringBuffer reversed = new StringBuffer(subString).reverse(); if(reversed.toString().equals(subString)){ subStringMap.put(subString.length(),subString); if(subString.length() > len){ len = subString.length(); } } } } System.out.println(subStringMap.get(len)); // StringBuffer s = new StringBuffer(str); // StringBuffer c = new StringBuffer(str); // System.out.println(c.reverse()); // System.out.println(s); // System.out.println(c.toString().equals(s.toString())); } }
061725bee2b0defd421c9bb312105315e4e72bc4
14c98ffd213b2c9039ef0cb25a88f0135a0157f1
/src/main/java/com/an/acquisition/manage/core/CommonDao.java
59b6f87ca89c9ea43e69b9e28e2ad8e9ebdb3796
[]
no_license
JasonorJane/datasystem
395c50126a441bf600ac53577191d3b7a17ff595
f3a9ea3abdbb7bc8c2b2af330283c06be1f4d801
refs/heads/master
2020-04-11T11:36:35.300166
2018-12-12T03:38:04
2018-12-12T03:38:04
161,753,676
1
0
null
2018-12-14T08:19:09
2018-12-14T08:19:08
null
UTF-8
Java
false
false
563
java
package com.an.acquisition.manage.core; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; public abstract class CommonDao { protected static final Logger logger = LogManager.getLogger(); @Autowired protected JdbcTemplate jdbcTemplate; @Autowired protected NamedParameterJdbcTemplate namedParameterJdbcTemplate; }
[ "Administrator@PC-20170725DVXX" ]
Administrator@PC-20170725DVXX
2a1d2773c7004657d4f4af2994e7b96a7fe7ec8b
111327fdf2382b8891dbbf915692c311b7333b1f
/src/clienttwo/DelayedClient.java
c06b4778e567a964619e504c07c2b853cc17c98d
[]
no_license
BDenBleyker/ClientOne
dcd5b6b146f09074625f2d37d530719b1525a8a1
75ad2362f188b5f39ff90f270f8811f010b2d158
refs/heads/master
2021-01-23T00:35:36.244883
2017-03-31T03:10:31
2017-03-31T03:10:31
85,749,028
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package clienttwo; /** * * @author Bennett.DenBleyker */ public class DelayedClient implements MessageClient { @Override public String send(String message) { System.out.println("One sec........,........"); try { Thread.sleep(2000); } catch (InterruptedException ex) { System.out.println("STOP IT!!!"); } return message; } }
14a47cffce806e6934673afa0e579f0263ab96ef
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_97b0147bfcf2a4f00e707e8103dee3ca6f37ccb6/WeightedPageRankProgramTest/9_97b0147bfcf2a4f00e707e8103dee3ca6f37ccb6_WeightedPageRankProgramTest_s.java
8da770883727845a1d493c3d92fa09f91ecb35d4
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
3,560
java
package com.tinkerpop.furnace.algorithms.vertexcentric.programs.ranking; import com.google.common.collect.ImmutableSortedMap; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.tg.TinkerGraphFactory; import com.tinkerpop.furnace.algorithms.vertexcentric.GraphComputer; import com.tinkerpop.furnace.algorithms.vertexcentric.VertexMemory; import com.tinkerpop.furnace.algorithms.vertexcentric.computers.SerialGraphComputer; import junit.framework.TestCase; import java.util.Comparator; import java.util.HashMap; import java.util.Map; /** * @author Marko A. Rodriguez (http://markorodriguez.com) */ public class WeightedPageRankProgramTest extends TestCase { public void testWeightedPageRankProgram() throws Exception { Graph graph = TinkerGraphFactory.createTinkerGraph(); //Graph graph = new TinkerGraph(); //GraphMLReader.inputGraph(graph, "/Users/marko/software/tinkerpop/gremlin/data/graph-example-2.xml"); WeightedPageRankProgram program = WeightedPageRankProgram.create().vertexCount(6).edgeWeightFunction(WeightedPageRankProgram.getEdgeWeightPropertyFunction("weight")).build(); SerialGraphComputer computer = new SerialGraphComputer(graph, program, GraphComputer.Isolation.BSP); computer.execute(); VertexMemory results = computer.getVertexMemory(); System.out.println(results); double total = 0.0d; final Map<String, Double> map = new HashMap<String, Double>(); for (Vertex vertex : graph.getVertices()) { double pageRank = results.getProperty(vertex, WeightedPageRankProgram.PAGE_RANK); assertTrue(pageRank > 0.0d); total = total + pageRank; map.put(vertex.getProperty("name") + " ", pageRank); } for (Map.Entry<String, Double> entry : ImmutableSortedMap.copyOf(map, new Comparator<String>() { public int compare(final String key, final String key2) { int c = map.get(key2).compareTo(map.get(key)); return c == 0 ? -1 : c; } }).entrySet()) { System.out.println(entry.getKey() + " " + entry.getValue()); } System.out.println(total); System.out.println(computer.getGraphMemory().getRuntime()); /*for (int i = 1; i < 7; i++) { double PAGE_RANK = result.getResult(graph.getVertex(i)); System.out.println(i + " " + (PAGE_RANK / total)); }*/ } public void testWeightedPageRankDegenerateToPageRank() throws Exception { Graph graph = TinkerGraphFactory.createTinkerGraph(); WeightedPageRankProgram program1 = WeightedPageRankProgram.create().vertexCount(6).build(); SerialGraphComputer computer1 = new SerialGraphComputer(graph, program1, GraphComputer.Isolation.BSP); computer1.execute(); PageRankProgram program2 = PageRankProgram.create().vertexCount(6).build(); SerialGraphComputer computer2 = new SerialGraphComputer(graph, program2, GraphComputer.Isolation.BSP); computer2.execute(); VertexMemory results1 = computer1.getVertexMemory(); VertexMemory results2 = computer2.getVertexMemory(); for (final Vertex vertex : graph.getVertices()) { assertEquals(results1.getProperty(vertex, WeightedPageRankProgram.PAGE_RANK), results2.getProperty(vertex, PageRankProgram.PAGE_RANK)); } } }
634ec7da4d5569a9be582a4420f4e0042b0a2654
7f8613584517bb7f7851309552c52e37ddd05d9c
/app/src/main/java/cr/ac/unadeca/parcial/activities/MainActivity.java
ffecbedddea57c311490c1a156079a308098f291
[]
no_license
fr4nk20/Parcial
4bdfa4bc487c4ab89971ff128e60fd035b3019b7
063a476e879b09c6378010d4a1b8449784f1ca44
refs/heads/master
2020-03-11T00:09:45.988306
2018-04-15T22:38:23
2018-04-15T22:38:23
129,656,964
0
0
null
null
null
null
UTF-8
Java
false
false
6,822
java
package cr.ac.unadeca.parcial.activities; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.raizlabs.android.dbflow.sql.language.SQLite; import org.sufficientlysecure.htmltextview.HtmlResImageGetter; import java.util.List; import cr.ac.unadeca.parcial.R; import cr.ac.unadeca.parcial.database.models.ParcialTable; import cr.ac.unadeca.parcial.subclase.ParcialViewHolder; public class MainActivity extends AppCompatActivity { private static Context QuickContext; private RecyclerView lista; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); QuickContext = this; Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent actividad = new Intent(getApplicationContext(), FormularioActivity.class); getApplicationContext().startActivity(actividad); } }); lista = findViewById(R.id.lista); lista.setLayoutManager(new LinearLayoutManager(this)); List<ParcialTable>info =SQLite.select().from(ParcialTable.class).queryList(); lista.setAdapter(new ParcialAdapter(info)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { List<ParcialTable> info = SQLite.select().from(ParcialTable.class).queryList(); lista.setAdapter(new ParcialAdapter(info)); } return super.onOptionsItemSelected(item); } public static class ParcialAdapter extends RecyclerView.Adapter<ParcialViewHolder> { private final List<ParcialTable> listParcialTable; private final LayoutInflater inflater; public ParcialAdapter(List<ParcialTable> listToDoTables) { this.inflater = LayoutInflater.from(QuickContext); this.listParcialTable = listToDoTables; } @Override public ParcialViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = inflater.inflate(R.layout.objecto, parent, false); return new ParcialViewHolder(view); } public void animateTo(List<ParcialTable> models) { applyAndAnimateRemovals(models); applyAndAnimateAdditions(models); applyAndAnimateMovedItems(models); } private void applyAndAnimateRemovals(List<ParcialTable> newModels) { for (int i = listParcialTable.size() - 1; i >= 0; i--) { final ParcialTable model = listParcialTable.get(i); if (!newModels.contains(model)) { removeItem(i); } } } private void applyAndAnimateAdditions(List<ParcialTable> newModels) { for (int i = 0, count = newModels.size(); i < count; i++) { final ParcialTable model = newModels.get(i); if (!listParcialTable.contains(model)) { addItem(i, model); } } } private void applyAndAnimateMovedItems(List<ParcialTable> newModels) { for (int toPosition = newModels.size() - 1; toPosition >= 0; toPosition--) { final ParcialTable model = newModels.get(toPosition); final int fromPosition = listParcialTable.indexOf(model); if (fromPosition >= 0 && fromPosition != toPosition) { moveItem(fromPosition, toPosition); } } } public ParcialTable removeItem(int position) { final ParcialTable model = listParcialTable.remove(position); notifyItemRemoved(position); return model; } public void addItem(int position, ParcialTable model) { listParcialTable.add(position, model); notifyItemInserted(position); } public void moveItem(int fromPosition, int toPosition) { final ParcialTable model = listParcialTable.remove(fromPosition); listParcialTable.add(toPosition, model); notifyItemMoved(fromPosition, toPosition); } @Override public void onBindViewHolder(final ParcialViewHolder holder, final int position) { final ParcialTable current = listParcialTable.get(position); holder.html.setHtml(ActividadAString(current), new HtmlResImageGetter(holder.html)); holder.html.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); holder.borrar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { current.delete(); removeItem(position); notifyDataSetChanged(); } }); } private String ActividadAString(ParcialTable todo){ String html= "<a><big><b> <font color =\""+"\">"+"Nombre: "+todo.Nombre_Apellido+"</b></big>"; html+="<br><big><b>"+"Cédula: "+"</big>"+ todo.Cedula + "</b>"; html+="<br><big><b>"+"Codigo: "+"</big>"+todo.Codigo+"</b>"; html+="<br><big><b>"+"Departamento: "+"</big>"+todo.Departamento+"</b>"; html+="<br><big><b>"+"Telefono: "+"</big>"+todo.Telefono+"</b></a>"; return html; } @Override public int getItemCount() { return listParcialTable.size(); } } }
c374fb182ecdad0e03b91a66afe5c929ad257e90
f9784c23348c9449da6309cf00744f0baeac28d3
/java/Myfirst.java
d32f4b9250e015ac42dac4257ac887486540d50e
[]
no_license
Monisha-912/Capegemini-Practise
2d0c887a55f8a51b5b3007747e09b64e0d42424e
ef75264630b45d449c144225d5706d4fc006c4be
refs/heads/master
2023-06-23T07:04:47.051217
2021-07-20T08:15:16
2021-07-20T08:15:16
383,344,258
0
0
null
null
null
null
UTF-8
Java
false
false
127
java
class Myfirst{ public static void main(String[] args){ System.out.println("Hello..."+args[0]+" "+args[1]+"!!"); } }
7d41e190a289fa8d14a0d1f588ee9c9bdc01236d
947225f5650bd85f3bb1ec7ec7d82371ca4eca30
/src/main/java/com/rw/slamschedule/utils/ObjectConvert.java
b8fe8d2dab3997e207b1b5451386faa77dabea0b
[]
no_license
zhuxibrian/slamschedule
0c3247650580111c435dedc78985e5b265fa3c37
214992615f764118dcc1042b7667a17442a03b29
refs/heads/master
2021-05-02T07:39:38.805213
2018-09-01T07:24:16
2018-09-01T07:24:16
120,834,733
0
0
null
null
null
null
UTF-8
Java
false
false
1,116
java
package com.rw.slamschedule.utils; import com.rw.slamschedule.domain.CommandHistory; import com.rw.slamschedule.domain.CommandMapper; import com.rw.slamschedule.domain.Slam; import com.rw.slamschedule.domain.Todo; public class ObjectConvert { public static Todo commandMapper2Todo(Integer terminalId, Integer buttonId, Integer commandMapperId) { Todo todo = new Todo(); todo.setTerminalId(terminalId); todo.setButtonId(buttonId); todo.setCommandMapperId(commandMapperId); return todo; } public static CommandHistory todo2CommandHistory(Todo todo, CommandMapper commandMapper) { CommandHistory commandHistory = new CommandHistory(); commandHistory.setButtonId(todo.getButtonId()); commandHistory.setTerminalId(todo.getTerminalId()); commandHistory.setReceiveTimestamp(todo.getReceiveTimestamp()); commandHistory.setSlamId(todo.getSlamId()); commandHistory.setFinishTimestamp(System.currentTimeMillis()); commandHistory.setCommandString(commandMapper.toString()); return commandHistory; } }
1aed5029084809ae89e21628b9bc5ad3e26f7ec7
4747d3a444b98eb56ad7e7982dc44c49d09dcef7
/src/main/java/com/janlei/thread/pool/Singleton.java
eba8c7025b6a3486b750d28d6c5b1cf016dc9dc9
[]
no_license
Janlei-CN/thread
6fecf314092e27817e009b2e857a0a758c5a312f
adccf402a5421e67892300226c8cbe90ea41e276
refs/heads/master
2021-07-10T14:55:18.226324
2020-10-14T09:24:05
2020-10-14T09:24:05
209,695,007
0
0
null
2020-10-14T09:24:07
2019-09-20T03:12:11
Java
UTF-8
Java
false
false
1,136
java
package com.janlei.thread.pool; public class Singleton implements Cloneable{ protected RunnableDemo no; protected static RunnableDemo sticno; @Override protected Object clone() throws CloneNotSupportedException { return super.clone(); } /** * JVM反复加载 */ { no=new RunnableDemo(); int i=0; System.out.println("dy"+no.hashCode()); System.out.println( ++i ); } /** * JVM只会加载一次 */ static{ sticno=new RunnableDemo(); System.out.println("static"+sticno.hashCode()); } /** * 类级的内部类,也就是静态的成员式内部类,该内部类的实例与外部类的实例 * 没有绑定关系,而且只有被调用到才会装载,从而实现了延迟加载 */ private static class SingleHolder{ private static Singleton instance = new Singleton(); } /** * 私有化构造方法 */ public Singleton(){} public static Singleton getInstance(){ return SingleHolder.instance; } }
7e963431fb33837e7e6aa8b229c0a3d2942619ca
08c5675ad0985859d12386ca3be0b1a84cc80a56
/src/main/java/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java
590979adcee1092fdd417f46e6f8173b0a57b3b1
[]
no_license
ytempest/jdk1.8-analysis
1e5ff386ed6849ea120f66ca14f1769a9603d5a7
73f029efce2b0c5eaf8fe08ee8e70136dcee14f7
refs/heads/master
2023-03-18T04:37:52.530208
2021-03-09T02:51:16
2021-03-09T02:51:16
345,863,779
0
0
null
null
null
null
UTF-8
Java
false
false
4,100
java
/* * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.corba.se.impl.interceptors; import java.io.IOException; import org.omg.CORBA.Any; import org.omg.CORBA.NVList; import org.omg.IOP.CodecFactory; import org.omg.CORBA.portable.RemarshalException; import org.omg.PortableInterceptor.ObjectReferenceTemplate; import org.omg.PortableInterceptor.ForwardRequest; import org.omg.PortableInterceptor.Interceptor; import org.omg.PortableInterceptor.PolicyFactory; import org.omg.PortableInterceptor.Current; import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; import com.sun.corba.se.pept.encoding.OutputObject; import com.sun.corba.se.spi.ior.ObjectKeyTemplate; import com.sun.corba.se.spi.oa.ObjectAdapter; import com.sun.corba.se.spi.orb.ORB; import com.sun.corba.se.spi.protocol.PIHandler; import com.sun.corba.se.spi.protocol.ForwardException; import com.sun.corba.se.spi.protocol.CorbaMessageMediator; import com.sun.corba.se.impl.corba.RequestImpl; import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; /** * This is No-Op implementation of PIHandler. It is used in ORBConfigurator * to initialize a piHandler before the Persistent Server Activation. This * PIHandler implementation will be replaced by the real PIHandler in * ORB.postInit( ) call. */ public class PINoOpHandlerImpl implements PIHandler { public PINoOpHandlerImpl() { } public void close() { } public void initialize() { } public void destroyInterceptors() { } public void objectAdapterCreated(ObjectAdapter oa) { } public void adapterManagerStateChanged(int managerId, short newState) { } public void adapterStateChanged(ObjectReferenceTemplate[] templates, short newState) { } public void disableInterceptorsThisThread() { } public void enableInterceptorsThisThread() { } public void invokeClientPIStartingPoint() throws RemarshalException { } public Exception invokeClientPIEndingPoint( int replyStatus, Exception exception) { return null; } public Exception makeCompletedClientRequest( int replyStatus, Exception exception) { return null; } public void initiateClientPIRequest(boolean diiRequest) { } public void cleanupClientPIRequest() { } public void setClientPIInfo(CorbaMessageMediator messageMediator) { } public void setClientPIInfo(RequestImpl requestImpl) { } final public void sendCancelRequestIfFinalFragmentNotSent() { } public void invokeServerPIStartingPoint() { } public void invokeServerPIIntermediatePoint() { } public void invokeServerPIEndingPoint(ReplyMessage replyMessage) { } public void setServerPIInfo(Exception exception) { } public void setServerPIInfo(NVList arguments) { } public void setServerPIExceptionInfo(Any exception) { } public void setServerPIInfo(Any result) { } public void initializeServerPIInfo(CorbaMessageMediator request, ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp) { } public void setServerPIInfo(java.lang.Object servant, String targetMostDerivedInterface) { } public void cleanupServerPIRequest() { } public void register_interceptor(Interceptor interceptor, int type) throws DuplicateName { } public Current getPICurrent() { return null; } public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) throws org.omg.CORBA.PolicyError { return null; } public void registerPolicyFactory(int type, PolicyFactory factory) { } public int allocateServerRequestId() { return 0; } }