blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
8eb743477a08b59ad1ba8714c93d1007b1af909f
e788b0234686bf83de725e8ca57c51edfb65e03e
/src/test/java/org/tgf/regression/pet/GenericMethods.java
ac37833a86774888e02d49f5973d6a768091198c
[]
no_license
Nazareena/SeleniumWorkspace
b10e899b3b22e47fb085a34142efb16208dec287
c0a1cbe1113ac06286f97cc9a9c28947fcc93b98
refs/heads/master
2020-03-07T14:41:28.424570
2018-04-17T07:53:48
2018-04-17T07:53:48
127,532,892
0
0
null
null
null
null
UTF-8
Java
false
false
1,801
java
package org.tgf.regression.pet; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; //import com.gargoylesoftware.htmlunit.javascript.host.media.webkitAudioContext; public class GenericMethods extends TestData { static String WorkPlanNameForPet; public static void CheckCorrectAppSelected() { wait_Till_Visible(byappsMenu_id); String appMenu; try { appMenu = get_Text_of_Webelement(byappsMenu_id); if (!(appMenu=="AppName")) { click(byappsMenu_id); click(byPetSurvey_App_linktext); wait_Till_Visible(byPET_linktext); System.out.println("Required app selected" +appMenu); } System.out.println("Required app has already been selected" +appMenu); } catch (Exception e) { e.printStackTrace(); } } public static void lfaWorkPlanCreation() { try { select_App_From_AppMenu(LfaServices_app); wait_Till_Visible(byLfaWorkPlan_linktext); click(byLfaWorkPlan_linktext); wait_Till_Visible(byNew_button_cssselector); click(byNew_button_cssselector); wait_Till_Visible(bycontinue_button_cssselector); select_Dropdown_By_Value(byRecordTypeofNewLfarecord_dropdown, lfaRecordType); click(bycontinue_button_cssselector); enter_Text(byLfaWorkPlanName_textbox, lfaWorkPlanName); enter_Text(byLfa_textbox, lfaName); enter_Text(byCountryTeam_textbox, countryTeam); clear_TextBox(byStartDate_calendarField); enter_Date(byStartDate_calendarField, "01.01.2017"); clear_TextBox(byEndDate_calendarField); enter_Date(byEndDate_calendarField, "31.12.2017"); click(bySave_button_cssselector); String WorkPlan = get_Current_URL(); WorkPlanNameForPet = get_Text_of_Webelement(byWorkPlanName_label); } catch (Exception e) { e.printStackTrace(); } } }
825c65b06448a4e027aeb43cab90cfbfc9aefeec
0af8b92686a58eb0b64e319b22411432aca7a8f3
/single-large-project/src/test/java/org/gradle/test/performancenull_407/Testnull_40669.java
b1f09cf239f8cb1ca937cdc8d4f910bb751eedd3
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
308
java
package org.gradle.test.performancenull_407; import static org.junit.Assert.*; public class Testnull_40669 { private final Productionnull_40669 production = new Productionnull_40669("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
ec17698c175b847a246614ac901bba3325b718f0
656ce78b903ef3426f8f1ecdaee57217f9fbc40e
/src/o/pu.java
610b3bca7be0caec97eafe86b5bcf66b990bc6c9
[]
no_license
zhuharev/periscope-android-source
51bce2c1b0b356718be207789c0b84acf1e7e201
637ab941ed6352845900b9d465b8e302146b3f8f
refs/heads/master
2021-01-10T01:47:19.177515
2015-12-25T16:51:27
2015-12-25T16:51:27
48,586,306
8
10
null
null
null
null
UTF-8
Java
false
false
9,610
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package o; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.os.Handler; import android.util.AttributeSet; import android.view.KeyEvent; import android.widget.ImageView; // Referenced classes of package o: // pz, pv, pw abstract class pu extends ImageView { public static interface if { public abstract void _mth02BF(Bitmap bitmap); } private Matrix OM; private Matrix OO; private final Matrix OP; private final float OQ[]; protected final pz OR; private int OS; private int OT; private float OU; private pv OV; private if OW; protected Handler handler; public pu(Context context) { super(context); OM = new Matrix(); OO = new Matrix(); OP = new Matrix(); OQ = new float[9]; OR = new pz(null, 0); OS = -1; OT = -1; handler = new Handler(); setScaleType(android.widget.ImageView.ScaleType.MATRIX); } public pu(Context context, AttributeSet attributeset) { super(context, attributeset); OM = new Matrix(); OO = new Matrix(); OP = new Matrix(); OQ = new float[9]; OR = new pz(null, 0); OS = -1; OT = -1; handler = new Handler(); setScaleType(android.widget.ImageView.ScaleType.MATRIX); } public pu(Context context, AttributeSet attributeset, int i) { super(context, attributeset, i); OM = new Matrix(); OO = new Matrix(); OP = new Matrix(); OQ = new float[9]; OR = new pz(null, 0); OS = -1; OT = -1; handler = new Handler(); setScaleType(android.widget.ImageView.ScaleType.MATRIX); } private void _mth02CA(Bitmap bitmap, int i) { super.setImageBitmap(bitmap); Object obj = getDrawable(); if (obj != null) { ((Drawable) (obj)).setDither(true); } obj = OR.oW; OR.oW = bitmap; OR.rotation = i; if (obj != null && obj != bitmap && OW != null) { OW._mth02BF(((Bitmap) (obj))); } } private void _mth02CA(pz pz1, Matrix matrix, boolean flag) { float f = getWidth(); float f1 = getHeight(); int i; if (pz1.oW == null) { i = 0; } else { if ((pz1.rotation / 90) % 2 != 0) { i = 1; } else { i = 0; } if (i != 0) { i = pz1.oW.getHeight(); } else { i = pz1.oW.getWidth(); } } float f2 = i; if (pz1.oW == null) { i = 0; } else { if ((pz1.rotation / 90) % 2 != 0) { i = 1; } else { i = 0; } if (i != 0) { i = pz1.oW.getWidth(); } else { i = pz1.oW.getHeight(); } } float f3 = i; matrix.reset(); float f4 = Math.min(Math.min(f / f2, 3F), Math.min(f1 / f3, 3F)); if (flag) { matrix.postConcat(pz1._mth0167()); } matrix.postScale(f4, f4); matrix.postTranslate((f - f2 * f4) / 2.0F, (f1 - f3 * f4) / 2.0F); } public void clear() { setImageBitmapResetBase(null, true); } protected final float getScale() { OO.getValues(OQ); return OQ[0]; } public boolean onKeyDown(int i, KeyEvent keyevent) { if (i == 4 && keyevent.getRepeatCount() == 0) { keyevent.startTracking(); return true; } else { return super.onKeyDown(i, keyevent); } } public boolean onKeyUp(int i, KeyEvent keyevent) { if (i == 4 && keyevent.isTracking() && !keyevent.isCanceled()) { OO.getValues(OQ); if (OQ[0] > 1.0F) { _mth02CE(1.0F, (float)getWidth() / 2.0F, (float)getHeight() / 2.0F); return true; } } return super.onKeyUp(i, keyevent); } protected void onLayout(boolean flag, int i, int j, int k, int l) { super.onLayout(flag, i, j, k, l); OS = k - i; OT = l - j; pv pv1 = OV; if (pv1 != null) { OV = null; pv1.run(); } if (OR.oW != null) { _mth02CA(OR, OM, true); OP.set(OM); OP.postConcat(OO); setImageMatrix(OP); } } public void setImageBitmap(Bitmap bitmap) { _mth02CA(bitmap, 0); } public void setImageBitmapResetBase(Bitmap bitmap, boolean flag) { setImageRotateBitmapResetBase(new pz(bitmap, 0), flag); } public void setImageRotateBitmapResetBase(pz pz1, boolean flag) { if (getWidth() <= 0) { OV = new pv(this, pz1, flag); return; } if (pz1.oW != null) { _mth02CA(pz1, OM, true); _mth02CA(pz1.oW, pz1.rotation); } else { OM.reset(); setImageBitmap(null); } if (flag) { OO.reset(); } OP.set(OM); OP.postConcat(OO); setImageMatrix(OP); float f; if (OR.oW == null) { f = 1.0F; } else { pz1 = OR; int i; if (pz1.oW == null) { i = 0; } else { if ((pz1.rotation / 90) % 2 != 0) { i = 1; } else { i = 0; } if (i != 0) { i = pz1.oW.getHeight(); } else { i = pz1.oW.getWidth(); } } f = (float)i / (float)OS; pz1 = OR; if (pz1.oW == null) { i = 0; } else { if ((pz1.rotation / 90) % 2 != 0) { i = 1; } else { i = 0; } if (i != 0) { i = pz1.oW.getWidth(); } else { i = pz1.oW.getHeight(); } } f = Math.max(f, (float)i / (float)OT) * 4F; } OU = f; } public void setRecycler(if if1) { OW = if1; } protected final void _mth02BB(boolean flag, boolean flag1) { Object obj = OR.oW; if (obj == null) { return; } OP.set(OM); OP.postConcat(OO); Matrix matrix = OP; obj = new RectF(0.0F, 0.0F, ((Bitmap) (obj)).getWidth(), ((Bitmap) (obj)).getHeight()); matrix.mapRect(((RectF) (obj))); float f3 = ((RectF) (obj)).height(); float f2 = ((RectF) (obj)).width(); float f1 = 0.0F; float f = 0.0F; int i = getHeight(); if (f3 < (float)i) { f = ((float)i - f3) / 2.0F - ((RectF) (obj)).top; } else if (((RectF) (obj)).top > 0.0F) { f = -((RectF) (obj)).top; } else if (((RectF) (obj)).bottom < (float)i) { f = (float)getHeight() - ((RectF) (obj)).bottom; } i = getWidth(); if (f2 < (float)i) { f1 = ((float)i - f2) / 2.0F - ((RectF) (obj)).left; } else if (((RectF) (obj)).left > 0.0F) { f1 = -((RectF) (obj)).left; } else if (((RectF) (obj)).right < (float)i) { f1 = (float)i - ((RectF) (obj)).right; } _mth037A(f1, f); OP.set(OM); OP.postConcat(OO); setImageMatrix(OP); } protected void _mth02CE(float f, float f1, float f2) { float f3 = f; if (f > OU) { f3 = OU; } OO.getValues(OQ); f = f3 / OQ[0]; OO.postScale(f, f, f1, f2); OP.set(OM); OP.postConcat(OO); setImageMatrix(OP); _mth02BB(true, true); } protected final void _mth02CF(float f, float f1, float f2, float f3) { OO.getValues(OQ); f = (f - OQ[0]) / 300F; OO.getValues(OQ); f3 = OQ[0]; long l = System.currentTimeMillis(); handler.post(new pw(this, 300F, l, f3, f, f1, f2)); } protected void _mth037A(float f, float f1) { OO.postTranslate(f, f1); } protected final void _mth1FBE(float f, float f1) { _mth037A(f, f1); OP.set(OM); OP.postConcat(OO); setImageMatrix(OP); } public Matrix FF7F() { Matrix matrix = new Matrix(); _mth02CA(OR, matrix, false); matrix.postConcat(OO); return matrix; } }
2c070e69bf6f26f0f5d536b65a955e56bc0305dc
bc612daf37c974c12263f8ba81461aaaee553572
/src/main/java/com/wonderlabz/banking/test/bankingaccounts/service/SavingsService.java
4a8a9544fa120153bd07d877a3647a0ce64a9b63
[]
no_license
Damuuz/banking-accounts-assessment
3989c52212024869d098f8527e8385c02af4dfb3
4c43fc4d307e0a51766245a438c63db052adbe49
refs/heads/master
2023-06-30T09:21:16.588203
2021-08-02T15:08:31
2021-08-02T15:08:31
391,993,124
0
0
null
null
null
null
UTF-8
Java
false
false
4,981
java
package com.wonderlabz.banking.test.bankingaccounts.service; import com.wonderlabz.banking.test.bankingaccounts.exception.SavingsBalanceError; import com.wonderlabz.banking.test.bankingaccounts.model.Savings; import com.wonderlabz.banking.test.bankingaccounts.model.SavingsDTO; import com.wonderlabz.banking.test.bankingaccounts.model.Transaction; import com.wonderlabz.banking.test.bankingaccounts.repository.SavingsRepository; import org.joda.time.DateTime; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.wonderlabz.banking.test.bankingaccounts.exception.SavingsExistsError; import java.util.Optional; @Service public class SavingsService { @Autowired SavingsRepository savingsRepository; @Autowired TransactionService transactionService; public void create(SavingsDTO savingsDTO) throws SavingsExistsError, SavingsBalanceError { Savings savings = convertToEntity(savingsDTO); double balance = savingsDTO.getTransactionAmount(); savings.setBalance(balance); throwExceptionIfSavingsAccountExist(savings); throwExceptionIfBalanceIsLess(savings); savings.setDateOpened(new DateTime()); Transaction transaction = new Transaction(); transaction.set_id(savings.getTransactionId()); transaction.setDateCreated(new DateTime()); transactionService.save(transaction); savingsRepository.save(savings); } public void save(SavingsDTO savingsDTO) { Savings savings = convertToEntity(savingsDTO); // Transaction transaction = new Transaction(); // transaction.set_id(savings.getTransactionId()); // transaction.setDateCreated(new DateTime()); savingsRepository.save(savings); } private void throwExceptionIfSavingsAccountExist(Savings savings) throws SavingsExistsError { Optional<Savings> existingSavings = savingsRepository.findByUserId(savings.getUserId()); if (!existingSavings.isEmpty()) { throw new SavingsExistsError("Savings Account with UserId " + savings.getUserId() + "already exists"); } } private void throwExceptionIfBalanceIsLess(Savings savings) throws SavingsBalanceError { if (savings.getBalance() < 1000.0) { throw new SavingsBalanceError("Savings account must have a minimum balance of R1000"); } } public void withdraw(SavingsDTO savingsDTO) throws SavingsBalanceError { Savings savings = convertToEntity(savingsDTO); Optional<Savings> existingSavings = savingsRepository.findByUserId(savings.getUserId()); double balance = existingSavings.get().getBalance() - savingsDTO.getTransactionAmount(); savings.setBalance(balance); throwExceptionIfBalanceIsLess(savings); savings.setDateUpdated(new DateTime()); Transaction transaction = new Transaction(); transaction.set_id(savings.getTransactionId()); transaction.setDateCreated(new DateTime()); transactionService.save(transaction); savingsRepository.save(savings); } public void deposit(SavingsDTO savingsDTO) { Savings savings = convertToEntity(savingsDTO); Optional<Savings> existingSavings = savingsRepository.findByUserId(savings.getUserId()); double balance = existingSavings.get().getBalance() + savingsDTO.getTransactionAmount(); savings.setBalance(balance); savings.setDateUpdated(new DateTime()); Transaction transaction = new Transaction(); transaction.set_id(savings.getTransactionId()); transaction.setDateCreated(new DateTime()); transactionService.save(transaction); savingsRepository.save(savings); } private SavingsDTO convertToDTO(Optional<Savings> savings) { SavingsDTO savingsDTO = new SavingsDTO(); savingsDTO.set_id(savings.get().get_id()); savingsDTO.setBalance(savings.get().getBalance()); savingsDTO.setUserId(savings.get().getUserId()); savingsDTO.setTransactionAmount(savings.get().getTransactionAmount()); savingsDTO.setDateOpened(savings.get().getDateOpened()); savingsDTO.setDateUpdated(savings.get().getDateUpdated()); return savingsDTO; } private Savings convertToEntity(SavingsDTO savingsDTO) { Savings savings = new Savings(); savings.set_id(savingsDTO.get_id()); savings.setBalance(0.0); savings.setUserId(savingsDTO.getUserId()); savings.setTransactionAmount(savingsDTO.getTransactionAmount()); savings.setDateOpened(savingsDTO.getDateOpened()); savings.setDateUpdated(savingsDTO.getDateUpdated()); return savings; } public SavingsDTO findByUserId(String userId) { Optional<Savings> savings = savingsRepository.findByUserId(userId); return convertToDTO(savings); } }
63af4358380085d3fb5a5eafbab4f2724e5021cf
0050ffdb8e458d83db7ae4521cbb660e53baf806
/controlFlowStatements2/src/ru/skillbench/tasks/basics/control/ControlFlowStatements2Main.java
574449a67ee62afa03f1b23981922758eaa8e879
[]
no_license
UserVanya/Java
a7d8c5eda260b804350b5d3ad61d60783fd2ded2
d1b4718aa9f2f7e335bd5a84ac1dfcb56b330396
refs/heads/master
2020-05-16T04:05:45.905222
2019-05-02T13:12:42
2019-05-02T13:12:42
182,763,359
0
0
null
null
null
null
UTF-8
Java
false
false
174
java
package ru.skillbench.tasks.basics.control; public class ControlFlowStatements2Main { public static void main(String[] args) { // TODO Auto-generated method stub } }
222ae61a697691dc50b7191feb31f9733bf2e492
864906109319f74baaca5208aa140af0b503bc24
/cloud-consumerzk-order80/src/main/java/com/example/springcloud/OrderZkMain80.java
b42b1b15076d6d2efdf0ff529ebefd0fc0107c5d
[]
no_license
CrayonLee/cloud2020
64d48cbb8aaf6d6a728a1c510912c6869a9eed62
72e0db738735464b7197165daff52f73b772bb53
refs/heads/master
2022-07-24T02:35:50.901687
2020-03-20T00:35:54
2020-03-20T00:35:54
247,395,985
0
0
null
2022-06-21T02:59:26
2020-03-15T03:41:12
Java
UTF-8
Java
false
false
498
java
package com.example.springcloud; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; /** * @author lzh * @create 2020-03-16 23:00 **/ @SpringBootApplication @EnableDiscoveryClient public class OrderZkMain80 { public static void main(String[] args) { SpringApplication.run(OrderZkMain80.class,args); } }
be9a5660d771efd9159a5956b3fb8f051ec1b07c
5b665869085ef8b76393191413b6c69a759855c0
/kodilla-spring/src/main/java/com/kodilla/spring/library/Library.java
d782cac83237de205b8c7559864205b6b4c3dd32
[]
no_license
zarembaadrian/kodilla-testing
a9d052a91788e66682a0fa9da62c115b1913e1d0
89c9bebe1a3b213458d300727efc9ca4ed671dd2
refs/heads/master
2021-09-08T12:35:51.600128
2018-03-09T17:48:28
2018-03-09T17:48:28
113,217,502
0
1
null
2023-06-08T19:27:01
2017-12-05T18:19:49
Java
UTF-8
Java
false
false
591
java
package com.kodilla.spring.library; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public final class Library { private LibraryDbController libraryDbController; private List<String> books = new ArrayList<>(); public Library(LibraryDbController libraryDbController) { this.libraryDbController = libraryDbController; } public Library() { } public void saveToDb() { libraryDbController.saveData(); } public void loadToDb() { libraryDbController.loadData(); } }
39b47101fe37550858030cb8881ef7961ec2499b
46122748db8e86d6df6ee9f345bb7920c0d6e3c9
/src/main/java/com/slugmandrew/imagegallery/client/application/home/HomePageView.java
09f577548a6ae17419677c27840616b8ee1b2a51
[]
no_license
slugmandrew/ImageGallery
c5e27e886ea1e2ad1621ff034fd0569a5a0dd1c8
e0a9f2ec82a28d547bf61f81488fffd773130220
refs/heads/master
2021-05-17T07:34:56.407032
2015-06-15T10:13:11
2015-06-15T10:13:11
37,319,830
0
0
null
2021-01-20T11:00:57
2015-06-12T12:06:12
Java
UTF-8
Java
false
false
1,589
java
package com.slugmandrew.imagegallery.client.application.home; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import com.gwtplatform.mvp.client.ViewImpl; import com.slugmandrew.imagegallery.shared.LoginInfo; class HomePageView extends ViewImpl implements HomePagePresenter.MyView { interface Binder extends UiBinder<Widget, HomePageView> { } @UiField SimplePanel uploadPanel, photoSharing, uploadedImage, galleryPanel; private VerticalPanel loginPanel = new VerticalPanel(); private Label loginLabel = new Label("Sign in to upload images!"); private Anchor signInLink = new Anchor("Sign In"); @Inject HomePageView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); } @Override public void initLoginWidget(LoginInfo loginInfo) { signInLink.setHref(loginInfo.getLoginUrl()); loginPanel.add(loginLabel); loginPanel.add(signInLink); photoSharing.setWidget(loginPanel); } @Override public void setInSlot(Object slot, IsWidget content) { if(slot == HomePagePresenter.SLOT_UPLOAD) { uploadPanel.setWidget(content); } else if(slot == HomePagePresenter.SLOT_GALLERY) { galleryPanel.setWidget(content); } else { super.setInSlot(slot, content); } } }
415821a280157c3b230621804e70931b1f8e9690
07f9a73a57e550b3e2f8899c342b38580a029799
/FINAL/mac.java
cfbe28b68e48ebf2c073d2f2b356ea0cf620bb2e
[]
no_license
frunkyfrunk/Game
1bf54e9d6de00c0193dc92bba2b732229bcdc341
d12ebd8cc7a751e70029e6a49ba36e0fce91546f
refs/heads/master
2020-12-31T06:55:28.225233
2016-04-24T13:12:26
2016-04-24T13:12:26
56,971,189
0
0
null
null
null
null
UTF-8
Java
false
false
3,354
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class mac here. * * @author (your name) * @version (a version number or a date) */ public class mac extends truck { private int clicked = 0; private int countdown = 150; private int starttime = 0; public boolean Here = true; public boolean wasHere = false; private int moveaway=0; private int timer=70; public int trucktype= Greenfoot.getRandomNumber(3); public int beginning=1; /** * Act - do whatever the mac wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if(!pause.isPaused) { // Add your action code here. Actor mac = getOneObjectAtOffset(0, 25, box.class); Actor box = getOneIntersectingObject( box.class); macgrabbing(); if (beginning==1) { truckTypes(); beginning=0; } if (moveaway==0) { setLocation(765, getY()); timer--; } if (timer==0) { moveaway=1; } if (moveaway==1) { timer--; } if (timer==-100) { moveaway=2; } if (moveaway==2) { setLocation(getX()+3,getY()); timer--; } if (timer==-174)//(getX()>=getWorld().getWidth()-5 )//&& (getWorld().getObjects(mac.class).size() == 0))//(timer==-174) { getWorld().removeObject(this); //getWorld().addObject(new truckgen(), 767, 450); } } } public void truckTypes() { if(getWorld().getObjects(mac.class).size() == 0) { if (trucktype==1) { getWorld().addObject( new truck1(), 800, 300); //setImage("t21.png"); } else if (trucktype==2) { getWorld().addObject( new truck2(), 800, 300); //setImage("t22.png"); } else{ trucktype=3; getWorld().addObject( new truck3(), 800, 300); //setImage("t23.png"); } } else { } } public void macgrabbing() { //this function checks if a box if begin grabbed or not //this method uses the variables private int clicked, gravity, ground MouseInfo mouse = Greenfoot.getMouseInfo(); //gets information from your mouse //this is called for when the box is being grabbed //checks if mouse is in the room and if clicked is equal to 1/true if(null != mouse && clicked==1) { setLocation(mouse.getX(), mouse.getY()); } //checks if box is able to be clicked on, if true, it will set clicked to 1/true and gravity to 0 if (Greenfoot.mousePressed(this)){ clicked=1; World myWorld = getWorld(); gameover gameover = new gameover(); myWorld.addObject(gameover, myWorld.getWidth()/2, myWorld.getHeight()/2); } //checks if box is released, if true, it will set clicked to 0 if (Greenfoot.mouseClicked(null)){ clicked=0; } } }
8ca8267b3f47e968235d5a36a2fbba1f7a3c39df
048daf86220672f3e8eae97486677c69d9c238cb
/app/src/main/java/com/persiandesigners/freeze/Util/PersianDate.java
9a2db7a45adba37d69b510697580f1c2c03a1ab2
[]
no_license
abc2005/forushgah_freeze_new98
277a1f51915ebb728158fec01efb383781e2c770
50b3a9370e95f41c76e317b132d64b8e3715952e
refs/heads/master
2020-05-30T16:51:51.748608
2019-06-02T14:31:33
2019-06-02T14:31:33
189,856,604
0
0
null
null
null
null
UTF-8
Java
false
false
2,871
java
package com.persiandesigners.freeze.Util; import java.text.SimpleDateFormat; import java.util.Date; public class PersianDate { public String todayShamsi() { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String curentDateandTime = sdf.format(new Date()); String year = curentDateandTime.substring(0, 4); String month = curentDateandTime.substring(4, 6); String day = curentDateandTime.substring(6, 8); int Y = Integer.valueOf(year); int M = Integer.valueOf(month); int D = Integer.valueOf(day); return Shamsi(Y, M, D); } public String convertDateShamsi(String y, String m, String d) { return Shamsi(Integer.parseInt(y),Integer.parseInt( m),Integer.parseInt(d)); } public String Shamsi(int Y, int M, int D) { if (Y == 0) Y = 2000; if (Y < 100) Y = Y + 1900; if (Y == 2000) { if (M > 2) { SimpleDateFormat temp = new SimpleDateFormat("yyyyMMdd"); String curentDateandTime = temp.format(new Date()); String year = curentDateandTime.substring(0, 4); String month = curentDateandTime.substring(4, 6); String day = curentDateandTime.substring(6, 8); Y = Integer.valueOf(year); M = Integer.valueOf(month); D = Integer.valueOf(day); } } if (M < 3 || (M == 3 && D < 21)) Y = Y - 622; else Y = Y - 621; switch (M) { case 1: if (D < 21) { M = 10; D = D + 10; } else { M = 11; D = D - 20; } break; case 2: if (D < 20) { M = 11; D = D + 11; } else { M = 12; D = D - 19; } break; case 3: if (D < 21) { M = 12; D = D + 9; } else { M = 1; D = D - 20; } break; case 4: if (D < 21) { M = 1; D = D + 11; } else { M = 2; D = D - 20; } break; case 5: if (D < 22) { M = M - 3; D = D + 10; } else { M = M - 2; D = D - 21; } break; case 6: if (D < 22) { M = M - 3; D = D + 10; } else { M = M - 2; D = D - 21; } break; case 7: if (D < 23) { M = M - 3; D = D + 9; } else { M = M - 2; D = D - 22; } break; case 8: if (D < 23) { M = M - 3; D = D + 9; } else { M = M - 2; D = D - 22; } break; case 9: if (D < 23) { M = M - 3; D = D + 9; } else { M = M - 2; D = D - 22; } break; case 10: if (D < 23) { M = 7; D = D + 8; } else { M = 8; D = D - 22; } break; case 11: if (D < 22) { M = M - 3; D = D + 9; } else { M = M - 2; D = D - 21; } break; case 12: if (D < 22) { M = M - 3; D = D + 9; } else { M = M - 2; D = D - 21; } break; } String month = "00"; String day = "00"; D = Integer.valueOf(D)+1; if (M < 10) { month = "0" + M; } else { month = String.valueOf(M); } if (D < 10) { day = "0" + D; } else { day = String.valueOf(D); } return String.valueOf(Y) + "-" + month + "-" + day; } }
20d73fcf2461e79ab760f4f878d1caa13dc5e68c
e730096f42bffb4ef9942e4354c81137beb67637
/solutions/179/179-kir3i.java
c660772fc0e3bb983b2f1f245d5223f3b0517982
[ "MIT" ]
permissive
kir3i/LeetCode-Solutions
529b5bf2ab725a91574dbfd8c072627e30590646
a93438ae575496005cbd7919c51575911d9ddb23
refs/heads/main
2023-08-28T19:34:03.880789
2021-10-06T07:39:51
2021-10-06T07:39:51
331,904,115
0
0
MIT
2021-03-25T02:03:09
2021-01-22T09:54:14
Python
UTF-8
Java
false
false
662
java
class Solution { public String largestNumber(int[] nums) { List<String> strNums = new ArrayList<>(); for (int num : nums) { strNums.add(Integer.toString(num)); } strNums.sort(new MyComparator()); String rtn = String.join("", strNums); if (rtn.charAt(0) == '0') { return "0"; } else { return rtn; } } static class MyComparator implements Comparator<String> { @Override public int compare(String s1, String s2) { String o1 = s1 + s2; String o2 = s2 + s1; return o2.compareTo(o1); } } }
1ef73bbf47e1516e8b09ec86d4cae36ede0f2b2a
a60ace261249cc2f42498a57f4dcfadc58095b5a
/app/src/main/java/com/study/onedx/qweather/utils/Utility.java
05b3a92659a982ba86cace63e102406a88722fd1
[ "Apache-2.0" ]
permissive
onedx1943/QWeather
e48dbb9785fb7a3c0c66e44c9b3067400d006dab
db8d59f75ca2c45833b4f4b22ce42750ecc3318f
refs/heads/master
2020-03-28T04:01:03.290608
2018-09-14T17:43:22
2018-09-14T17:43:22
147,689,375
0
0
null
null
null
null
UTF-8
Java
false
false
2,293
java
package com.study.onedx.qweather.utils; import android.view.View; import android.view.ViewGroup; import android.widget.ListAdapter; import android.widget.ListView; import com.google.gson.Gson; import com.study.onedx.qweather.gson.forecast.ForecastWeather; import com.study.onedx.qweather.gson.realTime.RealTimeWeather; import org.json.JSONException; import org.json.JSONObject; public class Utility { /** * 处理实时天气信息 * * @param response 返回值 * @return 实时天气对象 */ public static RealTimeWeather handleRealTimeResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); String responseText = jsonObject.toString(); return new Gson().fromJson(responseText, RealTimeWeather.class); } catch (JSONException e) { e.printStackTrace(); } return null; } /** * 处理天气预报信息 * * @param response 返回值 * @return 天气预报对象 */ public static ForecastWeather handleForecastResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); String responseText = jsonObject.toString(); return new Gson().fromJson(responseText, ForecastWeather.class); } catch (JSONException e) { e.printStackTrace(); } return null; } /** * 动态设置ListView的高度 * * @param listView */ public static void setListViewHeightBasedOnChildren(ListView listView) { if (listView == null) return; ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView); listItem.measure(0, 0); totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams params = listView.getLayoutParams(); params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); listView.setLayoutParams(params); listView.invalidate(); } }
035acb6446b108aeea77895d6287dda90ea14d5a
efbde9107b0cffb862c7090e215dd429e7ab8548
/src/main/java/cn/grassinfo/wap/entity/ForecastTownUtil.java
10da29a13648b25d26a440d4f70d0707d79e5557
[]
no_license
huzhongqiang/xstq
290fa0cbff92b0cd077b40d1ecb323ddb9fbd9a8
feac652b040326a16207ff1b9af1048ab78e019e
refs/heads/master
2020-04-15T04:48:40.630488
2019-01-07T07:59:49
2019-01-07T07:59:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,350
java
package cn.grassinfo.wap.entity; public class ForecastTownUtil { private String id; private String stationN; private String idateTime; private String ldateTime; private String formatLdateTime; // private String fdateTime; // private int interval; private int step; // private String forecaster; // private int isCorrect; private int rain; // private int rain1; // private int rain3; // private int rain6; // private int rain12; // private int rain24; private String weatherCode; private String weatherStr; private int cloudT; // private int cloudD; // private int cloudH; private int vv; private int rh; private String windd; private String windv; private int tem; private int tmax; private int tmin; private int wd; private int ws; public String getId () { return id; } public void setId (String id) { this.id = id; } public String getStationN(){ return stationN; } public void setStationN(String stationN) { this.stationN = stationN; } public String getIdateTime(){ return idateTime; } public void setIdateTime (String idateTime) { this.idateTime = idateTime; } public String getLdateTime () { return ldateTime; } public void setLdateTime (String ldateTime) { this.ldateTime = ldateTime; } public String getFormatLdateTime () { return formatLdateTime; } public void setFormatLdateTime (String formatLdateTime) { this.formatLdateTime = formatLdateTime; } // public String getFdateTime () { // return fdateTime; // } // public void setFdateTime (String fdateTime) { // this.fdateTime = fdateTime; // } // // public int getInterval() { // return interval; // } // public void setInterval (int interval) { // this.interval = interval; // } // public int getStep () { return step; } public void setStep (int step) { this.step = step; } // // public String getForecaster () { // return forecaster; // } // public void setForecaster(String forecaster) { // this.forecaster = forecaster; // } // // public int getIsCorrect() { // return isCorrect; // } // public void setIsCorrect (int isCorrect) { // this.isCorrect = isCorrect; // } public int getRain() { return rain; } public void setRain (int rain) { this.rain = rain; } // public int getRain1() { // return rain1; // } // public void setRain1 (int rain1) { // this.rain1 = rain1; // } // public int getRain3() { // return rain3; // } // public void setRain3 (int rain3) { // this.rain3 = rain3; // } // // public int getRain6() { // return rain6; // } // public void setRain6 (int rain6) { // this.rain6 = rain6; // } // // public int getRain12() { // return rain12; // } // public void setRain12 (int rain12) { // this.rain12 = rain12; // } // // public int getRain24() { // return rain24; // } // public void setRain24 (int rain24) { // this.rain24 = rain24; // } public String getWeatherCode() { return weatherCode; } public void setWeatherCode (String weatherCode) { this.weatherCode = weatherCode; } public String getWeatherStr() { return weatherStr; } public void setWeatherStr (String weatherStr) { this.weatherStr = weatherStr; } public int getCloudT() { return cloudT; } public void setCloudT (int cloudT) { this.cloudT = cloudT; } // public int getCloudD() { // return cloudD; // } // public void setCloudD (int cloudD) { // this.cloudD = cloudD; // } // // public int getCloudH() { // return cloudH; // } // public void setCloudH (int cloudH) { // this.cloudH = cloudH; // } public int getVv() { return vv; } public void setVv (int vv) { this.vv = vv; } public int getRh() { return rh; } public void setRh (int rh) { this.rh = rh; } public String getWindd() { return windd; } public void setWindd (String windd) { this.windd = windd; } public String getWindv() { return windv; } public void setWindv(String windv) { this.windv = windv; } public int getTem() { return tem; } public void setTem(int tem) { this.tem = tem; } public int getTmax() { return tmax; } public void setTmax(int tmax) { this.tmax = tmax; } public int getTmin() { return tmin; } public void setTmin(int tmin) { this.tmin = tmin; } public int getWd() { return wd; } public void setWd(int wd) { this.wd = wd; } public int getWs() { return ws; } public void setWs(int ws) { this.ws = ws; } }
e6c180fe2f289f02d4c16ac4591a3fa206ea3067
6b3e15e925da036df1c0db291acc22362048c337
/BookStore4/src/action/BookServlet.java
a81fb2a602a512d9ee99ab366a32f5c98a298576
[]
no_license
2364511934/eclipse-workspace-ssm-home
396d6fef20bdb63617f314949712f7b4d84c4189
d7355f6fa6e9f8ae4db678cd557bcc44cf692754
refs/heads/master
2021-04-15T12:12:21.383001
2018-03-24T02:23:31
2018-03-24T02:23:31
126,497,383
0
0
null
null
null
null
GB18030
Java
false
false
1,110
java
package action; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import bean.Book; import dao.BookDao; /** * Servlet implementation class BookServlet */ @WebServlet("/book") public class BookServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 1. 设置编码 request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); // 2.无用户数据 // 3.查询数据库 获取数据 BookDao bookDao = new BookDao(); List<Book> books = bookDao.executeQueryAll(); // 将结果返回 request.getSession().setAttribute("books", books); // 跳转至展示界面 request.getRequestDispatcher("/show.jsp").forward(request, response); } }
9e85dd3dac5e65b5b42e3d8da57d80172ad212b3
38c4451ab626dcdc101a11b18e248d33fd8a52e0
/tokens/apache-maven-3.0.4/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionResolutionException.java
00113391a3d54ce56d508f57266db91358ad08b0
[]
no_license
habeascorpus/habeascorpus-data
47da7c08d0f357938c502bae030d5fb8f44f5e01
536d55729f3110aee058ad009bcba3e063b39450
refs/heads/master
2020-06-04T10:17:20.102451
2013-02-19T15:19:21
2013-02-19T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,523
java
package TokenNamepackage org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT maven TokenNameIdentifier . TokenNameDOT plugin TokenNameIdentifier . TokenNameDOT version TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT List TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT sonatype TokenNameIdentifier . TokenNameDOT aether TokenNameIdentifier . TokenNameDOT repository TokenNameIdentifier . TokenNameDOT LocalRepository TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT sonatype TokenNameIdentifier . TokenNameDOT aether TokenNameIdentifier . TokenNameDOT repository TokenNameIdentifier . TokenNameDOT RemoteRepository TokenNameIdentifier ; TokenNameSEMICOLON public TokenNamepublic class TokenNameclass PluginVersionResolutionException TokenNameIdentifier extends TokenNameextends Exception TokenNameIdentifier { TokenNameLBRACE private TokenNameprivate final TokenNamefinal String TokenNameIdentifier groupId TokenNameIdentifier ; TokenNameSEMICOLON private TokenNameprivate final TokenNamefinal String TokenNameIdentifier artifactId TokenNameIdentifier ; TokenNameSEMICOLON private TokenNameprivate final TokenNamefinal String TokenNameIdentifier baseMessage TokenNameIdentifier ; TokenNameSEMICOLON public TokenNamepublic PluginVersionResolutionException TokenNameIdentifier ( TokenNameLPAREN String TokenNameIdentifier groupId TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier artifactId TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier baseMessage TokenNameIdentifier , TokenNameCOMMA Throwable TokenNameIdentifier cause TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE super TokenNamesuper ( TokenNameLPAREN "Error resolving version for plugin '" TokenNameStringLiteral + TokenNamePLUS groupId TokenNameIdentifier + TokenNamePLUS ":" TokenNameStringLiteral + TokenNamePLUS artifactId TokenNameIdentifier + TokenNamePLUS "': " TokenNameStringLiteral + TokenNamePLUS baseMessage TokenNameIdentifier , TokenNameCOMMA cause TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT groupId TokenNameIdentifier = TokenNameEQUAL groupId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT artifactId TokenNameIdentifier = TokenNameEQUAL artifactId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT baseMessage TokenNameIdentifier = TokenNameEQUAL baseMessage TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic PluginVersionResolutionException TokenNameIdentifier ( TokenNameLPAREN String TokenNameIdentifier groupId TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier artifactId TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier baseMessage TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE super TokenNamesuper ( TokenNameLPAREN "Error resolving version for plugin '" TokenNameStringLiteral + TokenNamePLUS groupId TokenNameIdentifier + TokenNamePLUS ":" TokenNameStringLiteral + TokenNamePLUS artifactId TokenNameIdentifier + TokenNamePLUS "': " TokenNameStringLiteral + TokenNamePLUS baseMessage TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT groupId TokenNameIdentifier = TokenNameEQUAL groupId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT artifactId TokenNameIdentifier = TokenNameEQUAL artifactId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT baseMessage TokenNameIdentifier = TokenNameEQUAL baseMessage TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic PluginVersionResolutionException TokenNameIdentifier ( TokenNameLPAREN String TokenNameIdentifier groupId TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier artifactId TokenNameIdentifier , TokenNameCOMMA LocalRepository TokenNameIdentifier localRepository TokenNameIdentifier , TokenNameCOMMA List TokenNameIdentifier < TokenNameLESS RemoteRepository TokenNameIdentifier > TokenNameGREATER remoteRepositories TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier baseMessage TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE super TokenNamesuper ( TokenNameLPAREN "Error resolving version for plugin '" TokenNameStringLiteral + TokenNamePLUS groupId TokenNameIdentifier + TokenNamePLUS ":" TokenNameStringLiteral + TokenNamePLUS artifactId TokenNameIdentifier + TokenNamePLUS "' from the repositories " TokenNameStringLiteral + TokenNamePLUS format TokenNameIdentifier ( TokenNameLPAREN localRepository TokenNameIdentifier , TokenNameCOMMA remoteRepositories TokenNameIdentifier ) TokenNameRPAREN + TokenNamePLUS ": " TokenNameStringLiteral + TokenNamePLUS baseMessage TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT groupId TokenNameIdentifier = TokenNameEQUAL groupId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT artifactId TokenNameIdentifier = TokenNameEQUAL artifactId TokenNameIdentifier ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT baseMessage TokenNameIdentifier = TokenNameEQUAL baseMessage TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic String TokenNameIdentifier getGroupId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn groupId TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic String TokenNameIdentifier getArtifactId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn artifactId TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic String TokenNameIdentifier getBaseMessage TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn baseMessage TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic String TokenNameIdentifier format TokenNameIdentifier ( TokenNameLPAREN LocalRepository TokenNameIdentifier localRepository TokenNameIdentifier , TokenNameCOMMA List TokenNameIdentifier < TokenNameLESS RemoteRepository TokenNameIdentifier > TokenNameGREATER remoteRepositories TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE String TokenNameIdentifier repos TokenNameIdentifier = TokenNameEQUAL "[" TokenNameStringLiteral ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN localRepository TokenNameIdentifier != TokenNameNOT_EQUAL null TokenNamenull ) TokenNameRPAREN { TokenNameLBRACE repos TokenNameIdentifier += TokenNamePLUS_EQUAL localRepository TokenNameIdentifier . TokenNameDOT getId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN + TokenNamePLUS " (" TokenNameStringLiteral + TokenNamePLUS localRepository TokenNameIdentifier . TokenNameDOT getBasedir TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN + TokenNamePLUS ")" TokenNameStringLiteral ; TokenNameSEMICOLON } TokenNameRBRACE if TokenNameif ( TokenNameLPAREN remoteRepositories TokenNameIdentifier != TokenNameNOT_EQUAL null TokenNamenull && TokenNameAND_AND ! TokenNameNOT remoteRepositories TokenNameIdentifier . TokenNameDOT isEmpty TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE for TokenNamefor ( TokenNameLPAREN RemoteRepository TokenNameIdentifier repository TokenNameIdentifier : TokenNameCOLON remoteRepositories TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE repos TokenNameIdentifier += TokenNamePLUS_EQUAL ", " TokenNameStringLiteral ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN repository TokenNameIdentifier != TokenNameNOT_EQUAL null TokenNamenull ) TokenNameRPAREN { TokenNameLBRACE repos TokenNameIdentifier += TokenNamePLUS_EQUAL repository TokenNameIdentifier . TokenNameDOT getId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN + TokenNamePLUS " (" TokenNameStringLiteral + TokenNamePLUS repository TokenNameIdentifier . TokenNameDOT getUrl TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN + TokenNamePLUS ")" TokenNameStringLiteral ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE } TokenNameRBRACE repos TokenNameIdentifier += TokenNamePLUS_EQUAL "]" TokenNameStringLiteral ; TokenNameSEMICOLON return TokenNamereturn repos TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE
d25f374585ee30b832b5f16355bc20f95a23f665
eedb6786bf3158adcaf309309397c5cc3831ff6d
/app/src/main/java/com/example/admin/myapplication/MenueActivity.java
5b9438f1d48974ed185f9d2d244224f3c70c689a
[]
no_license
gongran/android
f97f0e7d889762af9f36298e3d573c0d5a926d3c
fedb647642a8573f482b1456acd3964cbb15ca91
refs/heads/master
2021-05-07T08:40:13.812269
2017-11-03T09:56:48
2017-11-03T09:56:48
109,379,844
0
0
null
null
null
null
UTF-8
Java
false
false
3,731
java
package com.example.admin.myapplication; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class MenueActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menue); 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) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menue, 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) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { System.out.println("1"); // Handle the camera action } else if (id == R.id.nav_gallery) { System.out.println("2"); } else if (id == R.id.nav_slideshow) { System.out.println("3"); } else if (id == R.id.nav_manage) { System.out.println("4"); } else if (id == R.id.nav_share) { System.out.println("5"); } else if (id == R.id.nav_send) { System.out.println("6"); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
16e51a7a3cebf16508a9130502d81bb5c8c11c03
0db08258b5a2176da2a88af00aabe8f681404785
/src/main/java/com/ironhack/RestAPI/repository/ProductRepository.java
cd265822384b0f58bfaf842478ed6d270538357e
[]
no_license
Omakatayo/RestAPI
58d77b3adad9d79bdfe5788f9135e3fded71ec17
be2e45845dc3c37176d3c23bcd7be7c56797592e
refs/heads/master
2023-07-16T19:00:54.211046
2021-08-31T21:49:01
2021-08-31T21:49:01
401,851,952
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package com.ironhack.RestAPI.repository; import com.ironhack.RestAPI.dao.Product; import com.ironhack.RestAPI.enums.Category; import com.ironhack.RestAPI.enums.Department; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface ProductRepository extends JpaRepository<Product, Long> { List<Product> findByCategoryAndDepartment(Category category, Department department); List<Product> findByDepartment(Department department); }
4c3da8300a314b300f9501bb39350b772b567cde
d42b04ecfbb0447aae6726a678b6d1ac7da5863a
/gulimall-order/src/main/java/com/lvcp/gulimall/order/GulimallOrderApplication.java
34bc089290e79dcd10f0e87ab1e077a38a6f8139
[ "Apache-2.0" ]
permissive
lvcp/gulimall
779bb6f1cc17759f39257ca0d26f0842fc675e24
06580fd341a79fbdb6e1d1d60093f83a5cf5c7d4
refs/heads/main
2023-02-12T05:48:01.628797
2021-01-07T11:45:03
2021-01-07T11:45:03
327,556,945
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.lvcp.gulimall.order; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GulimallOrderApplication { public static void main(String[] args) { SpringApplication.run(GulimallOrderApplication.class, args); } }
1ac2cb63ca7d6a8b8a5b4a039e0d548adfa57901
6da3357ad74f245fc4e34152abdca12f8c7a230b
/app/src/main/java/com/flaierovation_studios/googlemapssamples/MapOverlaysDrawCircleMarker.java
40d3aedf9bb79c4f152403ec5f350ce92d7b7573
[]
no_license
Abhilashken/GoogleMapsSamples
009baf6d6d423c3616b6719c3e68e2495916afda
b52fb59b9f68c037a1986595989de5952a78b889
refs/heads/master
2023-08-06T22:19:48.780717
2023-07-28T06:38:56
2023-07-28T06:38:56
115,016,627
0
0
null
null
null
null
UTF-8
Java
false
false
7,156
java
package com.flaierovation_studios.googlemapssamples; import android.app.Dialog; import android.graphics.Color; import android.location.Address; import android.location.Geocoder; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.Circle; import com.google.android.gms.maps.model.CircleOptions; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import java.io.IOException; import java.util.List; /** * Created by Abhilash on 23-Dec-16. */ public class MapOverlaysDrawCircleMarker extends AppCompatActivity implements OnMapReadyCallback { GoogleMap mGoogleMap; Circle mCircle; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (googleServiceAvailabilityCheck()) { Toast.makeText(this, "Perfect !!", Toast.LENGTH_LONG).show(); setContentView(R.layout.activities_dynamic_location); initMap(); } } private void initMap() { MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.mapFragmentDynamic); mapFragment.getMapAsync(this); } private boolean googleServiceAvailabilityCheck() { GoogleApiAvailability mGoogleApiAvailability = GoogleApiAvailability.getInstance(); int isAvailable = mGoogleApiAvailability.isGooglePlayServicesAvailable(this); //check if Connection successful if (isAvailable == ConnectionResult.SUCCESS) { return true; } else if (mGoogleApiAvailability.isUserResolvableError(isAvailable)) { Dialog mDialog = mGoogleApiAvailability.getErrorDialog(this, isAvailable, 0); mDialog.show(); } else { Toast.makeText(this, "Can't connect to Play Service !!", Toast.LENGTH_SHORT).show(); } return false; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.mapTypeNone: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NONE); break; case R.id.mapTypeNormal: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); break; case R.id.mapTypeSatellite: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE); break; case R.id.mapTypeTerrain: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN); break; case R.id.mapTypeHybrid: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); break; default: break; } return super.onOptionsItemSelected(item); } Marker marker; public void geoLocate(View view) throws IOException { EditText eTLocation = findViewById(R.id.editText); String strLocation = eTLocation.getText().toString(); //Using Geocoder class to convert any string(entered location) to //its recognised latitude and longitude Geocoder mGeocoder = new Geocoder(this); List<Address> addressList = mGeocoder.getFromLocationName(strLocation, 1); Address address = addressList.get(0); String strLocality = address.getLocality(); Toast.makeText(this, "Locality: " + strLocality, Toast.LENGTH_LONG).show(); double lat = address.getLatitude(); double lng = address.getLongitude(); goToLocationZoom(lat, lng, 15); //calling Marker method setMarker(strLocation, strLocality, lat, lng); } private void goToLocationZoom(double lat, double lng, float zoom) { LatLng mLatLng = new LatLng(lat, lng); CameraUpdate mCameraUpdate = CameraUpdateFactory.newLatLngZoom(mLatLng, zoom); mGoogleMap.animateCamera(mCameraUpdate); } //Marker definition method with drawCircle called inside private void setMarker(String strLocation, String strLocality, double lat, double lng) { if (marker != null) { removeEverything(); } MarkerOptions markerOptions = new MarkerOptions() .title(strLocation) .draggable(true) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)) .position(new LatLng(lat, lng)) .snippet(strLocation + "," + strLocality); mGoogleMap.addMarker(markerOptions); mCircle = drawCircle(new LatLng(lat, lng)); } //method to remove everything previous i.e. marker and circle private void removeEverything() { marker.remove(); marker = null; mCircle.remove(); mCircle = null; } private Circle drawCircle(LatLng latLng) { CircleOptions mCircleOptions = new CircleOptions() .center(latLng) .radius(1000) .fillColor(0x33FF0000) .strokeColor(Color.BLUE) .strokeWidth(3); return mGoogleMap.addCircle(mCircleOptions); } @Override public void onMapReady(GoogleMap googleMap) { mGoogleMap = googleMap; if (mGoogleMap != null) { mGoogleMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() { @Override public void onMarkerDragStart(Marker marker) { } @Override public void onMarkerDrag(Marker marker) { } @Override public void onMarkerDragEnd(Marker marker) { Geocoder mGeocoder = new Geocoder(getApplicationContext()); LatLng mLatLng = marker.getPosition(); List<Address> addressList2 = null; try { addressList2 = mGeocoder.getFromLocation(mLatLng.latitude, mLatLng.longitude, 1); } catch (IOException e) { e.printStackTrace(); } Address address = addressList2.get(0); marker.setTitle(address.getSubLocality() + ", " + address.getLocality()); marker.showInfoWindow(); } }); } } }
7b4b26b96a909cf2ffaafda2ed9e996614b4a487
aec30c52e7e436839b3e1585493e7056f4b8db66
/springboot-jsp/src/main/java/top/pcstar/springboot/springbootjsp/SpringbootJspApplication.java
f0baa391816d64ff65b8991d07835dd16d55c6dc
[]
no_license
yuanliufei/spring-boot-examples
7293b0b3a1c3751b4a41d8af77c5255c531a273e
6979fc2a3c0525055d493792ad3bbf0c41442d36
refs/heads/master
2020-06-27T00:52:53.625237
2019-06-09T14:28:40
2019-06-09T14:28:40
199,803,948
1
0
null
2019-07-31T07:32:10
2019-07-31T07:32:10
null
UTF-8
Java
false
false
353
java
package top.pcstar.springboot.springbootjsp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SpringbootJspApplication { public static void main(String[] args) { SpringApplication.run(SpringbootJspApplication.class, args); } }
ca7f1e6cdfeffb98d2a946fadabf060fec983de8
48cc4f1674c449b6df96f8046e45cccaf0cbdc34
/src/main/java/com/fc/v2/service/auto/SysNoticeService.java
948110ed2c37a621c6f90c9b27d67758be6dcda2
[ "Apache-2.0" ]
permissive
Ben-1996/ywbzx
b98409fbc297f41634ea2d4dc264515093bf1965
7d8736535eb888be00567864bc58d6a1cebb23c3
refs/heads/master
2023-05-06T06:08:14.274197
2021-05-31T23:33:46
2021-05-31T23:33:46
331,331,645
0
0
null
null
null
null
UTF-8
Java
false
false
7,744
java
package com.fc.v2.service.auto; import com.fc.v2.common.base.BaseService; import com.fc.v2.common.support.ConvertUtil; import com.fc.v2.mapper.auto.SysNoticeMapper; import com.fc.v2.mapper.auto.SysNoticeUserMapper; import com.fc.v2.model.auto.*; import com.fc.v2.model.auto.SysNoticeUserExample.Criteria; import com.fc.v2.model.custom.Tablepar; import com.fc.v2.shiro.util.ShiroUtils; import com.fc.v2.util.SnowflakeIdWorker; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * 公告 SysNoticeService * @Title: SysNoticeService.java * @Package com.fc.v2.service * @author fuce_自动生成 * @email [email protected] * @date 2019-09-08 01:38:44 **/ @Service public class SysNoticeService implements BaseService<SysNotice, SysNoticeExample>{ @Autowired private SysNoticeMapper sysNoticeMapper; @Autowired private SysUserService sysUserService; @Autowired private SysNoticeUserService sysNoticeUserService; @Autowired private SysNoticeUserMapper sysNoticeUserMapper; /** * 分页查询 * @param pageNum * @param pageSize * @return */ public PageInfo<SysNotice> list(Tablepar tablepar,String name){ SysNoticeExample testExample=new SysNoticeExample(); testExample.setOrderByClause("id ASC"); if(name!=null&&!"".equals(name)){ testExample.createCriteria().andTitleLike("%"+name+"%"); } PageHelper.startPage(tablepar.getPage(), tablepar.getLimit()); List<SysNotice> list= sysNoticeMapper.selectByExample(testExample); PageInfo<SysNotice> pageInfo = new PageInfo<SysNotice>(list); return pageInfo; } /** * 对应用户的所有公告信息 * @param pageNum * @param pageSize * @return */ public PageInfo<SysNotice> list(TsysUser tsysUser,Tablepar tablepar,String name){ //查询未阅读的公告用户外键 SysNoticeUserExample sysNoticeUserExample=new SysNoticeUserExample(); Criteria criteria= sysNoticeUserExample.createCriteria(); criteria.andUserIdEqualTo(tsysUser.getId()); List<SysNoticeUser> noticeUsers= sysNoticeUserMapper.selectByExample(sysNoticeUserExample); if(noticeUsers!=null&&noticeUsers.size()>0) { //查询对应的公告列表 List<String> ids=new ArrayList<String>(); for (SysNoticeUser sysNoticeUser : noticeUsers) { ids.add(sysNoticeUser.getNoticeId()); } //分页查询对应用户的所有公告信息 SysNoticeExample testExample=new SysNoticeExample(); testExample.setOrderByClause("id desc"); com.fc.v2.model.auto.SysNoticeExample.Criteria criteria1= testExample.createCriteria(); if(name!=null&&!"".equals(name)){ criteria1.andTitleLike("%"+name+"%"); } criteria1.andIdIn(ids); PageHelper.startPage(tablepar.getPage(), tablepar.getLimit()); List<SysNotice> list= sysNoticeMapper.selectByExample(testExample); PageInfo<SysNotice> pageInfo = new PageInfo<SysNotice>(list); return pageInfo; } return new PageInfo<SysNotice>(); } @Override public int deleteByPrimaryKey(String ids) { List<String> lista=ConvertUtil.toListStrArray(ids); SysNoticeExample example=new SysNoticeExample(); example.createCriteria().andIdIn(lista); return sysNoticeMapper.deleteByExample(example); } @Override public SysNotice selectByPrimaryKey(String id) { return sysNoticeMapper.selectByPrimaryKey(id); } @Override public int updateByPrimaryKeySelective(SysNotice record) { return sysNoticeMapper.updateByPrimaryKeySelective(record); } /** * 添加 */ @Override @Transactional public int insertSelective(SysNotice record) { //添加雪花主键id record.setId(SnowflakeIdWorker.getUUID()); //添加创建人id record.setCreateId(ShiroUtils.getUserId()); //添加创建人 record.setCreateUsername(ShiroUtils.getLoginName()); //添加创建时间 record.setCreateTime(new Date()); sysNoticeMapper.insertSelective(record); //给所有人添加公告状态 List<TsysUser> list= sysUserService.selectByExample(new TsysUserExample()); for (TsysUser tsysUser : list) { SysNoticeUser noticeUser=new SysNoticeUser(null, record.getId(), tsysUser.getId(), 0); sysNoticeUserService.insertSelective(noticeUser); } return 1; } @Override public int updateByExampleSelective(SysNotice record, SysNoticeExample example) { return sysNoticeMapper.updateByExampleSelective(record, example); } @Override public int updateByExample(SysNotice record, SysNoticeExample example) { return sysNoticeMapper.updateByExample(record, example); } @Override public List<SysNotice> selectByExample(SysNoticeExample example) { return sysNoticeMapper.selectByExample(example); } @Override public long countByExample(SysNoticeExample example) { return sysNoticeMapper.countByExample(example); } @Override public int deleteByExample(SysNoticeExample example) { return sysNoticeMapper.deleteByExample(example); } /** * 检查name * @param sysNotice * @return */ public int checkNameUnique(SysNotice sysNotice){ SysNoticeExample example=new SysNoticeExample(); example.createCriteria().andTitleEqualTo(sysNotice.getTitle()); List<SysNotice> list=sysNoticeMapper.selectByExample(example); return list.size(); } /** * 获取用户未阅读公告 * @param tsysUser * @param state 阅读状态 0未阅读 1 阅读 -1全部 * @return * @author fuce * @Date 2019年9月8日 上午3:36:21 */ public List<SysNotice> getuserNoticeNotRead(TsysUser tsysUser,int state){ List<SysNotice> notices=new ArrayList<>(); //查询未阅读的公告用户外键 SysNoticeUserExample sysNoticeUserExample=new SysNoticeUserExample(); Criteria criteria= sysNoticeUserExample.createCriteria(); criteria.andUserIdEqualTo(tsysUser.getId()); if(-1!=state) { criteria.andStateEqualTo(state); } List<SysNoticeUser> noticeUsers= sysNoticeUserMapper.selectByExample(sysNoticeUserExample); if(noticeUsers!=null&&noticeUsers.size()>0) { //查询对应的公告列表 List<String> ids=new ArrayList<String>(); for (SysNoticeUser sysNoticeUser : noticeUsers) { ids.add(sysNoticeUser.getNoticeId()); } SysNoticeExample noticeExample = new SysNoticeExample(); noticeExample.createCriteria().andIdIn(ids); notices=sysNoticeMapper.selectByExample(noticeExample); } return notices; } /** * 根据公告id把当前用户的公告置为以查看 * @param noticeid * @author fuce * @Date 2019年9月8日 下午7:14:19 */ public void editUserState(String noticeid) { //SysNoticeUser SysNoticeUserExample sysNoticeUserExample=new SysNoticeUserExample(); sysNoticeUserExample.createCriteria().andNoticeIdEqualTo(noticeid).andUserIdEqualTo(ShiroUtils.getUserId()); List<SysNoticeUser> noticeUsers= sysNoticeUserMapper.selectByExample(sysNoticeUserExample); for (SysNoticeUser sysNoticeUser : noticeUsers) { sysNoticeUser.setState(1); sysNoticeUserMapper.updateByPrimaryKey(sysNoticeUser); } } /** * 获取最新8条公告 * @return */ public List<SysNotice> getNEW(){ SysNoticeExample testExample=new SysNoticeExample(); testExample.setOrderByClause("id DESC"); PageHelper.startPage(1, 8); List<SysNotice> list= sysNoticeMapper.selectByExample(testExample); return list; } }
eb10cb050b187cec0aee232e001ae03cde676831
273cc9074084ae80717036a4b3b52d010aa8ade8
/app/src/main/java/dhbkdn/it/dut/sqlitetest/MainActivity.java
9810595d99adead595392fd1501ef7ef08bf009b
[]
no_license
NguyenThaiQuyen/SQLiteTest
db33e4786238cf3c858977e223970a99ee93a3e9
16066f3ceffcd9d581ecf555f92afdad91495161
refs/heads/master
2020-04-03T03:17:29.680100
2018-10-27T15:49:14
2018-10-27T15:49:14
154,981,416
0
0
null
null
null
null
UTF-8
Java
false
false
5,268
java
package dhbkdn.it.dut.sqlitetest; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Menu; import android.view.MenuItem; import android.view.View; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private RecyclerView mRecyclerView; private ContactAdapter mAdapter; private MyDatabase db; private List<Contact> contacts; private int posClick = -1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); db = new MyDatabase(this); contacts = new ArrayList<>(); getData(); handle(); } private void getData(){ contacts.clear(); contacts = db.getAllContacts(); db.close(); } private void handle(){ mRecyclerView = (RecyclerView) findViewById(R.id.rvContacts); mRecyclerView.setHasFixedSize(true); mAdapter = new ContactAdapter(contacts, MainActivity.this); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(MainActivity.this); mRecyclerView.setLayoutManager(mLayoutManager); mRecyclerView.setAdapter(mAdapter); mRecyclerView.addOnItemTouchListener(new RecyclerItemClickListener(this, mRecyclerView, new RecyclerItemClickListener.OnItemClickListener(){ @Override public void onItemClick(View view, int position) { Intent intent = new Intent(getBaseContext(), DetailActivity.class); intent.putExtra("ID",contacts.get(position).getmId()); startActivityForResult(intent, 2); } @Override public void onLongItemClick(View view, int position) { // do whatever } })); } @Override public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.menu_option,menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item){ int id = item.getItemId(); switch (id){ case R.id.addContact: Intent intent = new Intent(MainActivity.this, AddActivity.class); startActivityForResult(intent,1); break; case R.id.deleteAll: AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.setTitle("DROP ALL DATA"); alertBuilder.setMessage("This action will deleta all data in SQLite. Are you sure?"); alertBuilder.setCancelable(false); alertBuilder.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { deleteAll(); } }); alertBuilder.setNeutralButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); AlertDialog alertDialog = alertBuilder.create(); alertDialog.show(); break; } return super.onOptionsItemSelected(item); } private void deleteAll(){ db.deleteAllContact(); contacts.clear(); mAdapter.notifyDataSetChanged(); db.close(); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode, resultCode, data); if (requestCode== 1 && resultCode == RESULT_OK) { Contact contact = (Contact) data.getExtras().getSerializable("RETURN"); contacts.add(contact); mAdapter.notifyDataSetChanged(); } if (requestCode == 2 && resultCode == RESULT_OK){ String contactID = data.getStringExtra("ID"); int id = Integer.parseInt(contactID); int pos = 0; for (int i=0;i<contacts.size();i++){ if (contacts.get(i).getmId()==id) { pos = i; break; } } contacts.remove(pos); mAdapter.notifyDataSetChanged(); } if (requestCode == 2 && resultCode == 1){ String editID = data.getStringExtra("ID"); int id = Integer.parseInt(editID); int pos=0; for (int i=0;i<contacts.size();i++){ if (contacts.get(i).getmId()==id) { pos = i; break; } } contacts.get(pos).setmName(db.getContact(id).getmName()); db.close(); mAdapter.notifyDataSetChanged(); } } }
e8779338596db735003d0337b945410280077806
63726a49e4b0719645d8ddf9898df726a274a654
/gulimall-coupon/src/main/java/com/xl/gulimall/coupon/service/impl/SmsMemberPriceServiceImpl.java
188a34abdd379a9e9d4107f56551e82e402f3ae3
[ "Apache-2.0" ]
permissive
bug10086/gulimall
d2ab2616cf111b5eb5bb2c6e1460a61edd901fd3
efaadd555ca89895e8b77838d32308b070253136
refs/heads/main
2023-04-18T02:16:53.449546
2021-05-04T14:59:37
2021-05-04T14:59:37
353,539,563
0
0
null
null
null
null
UTF-8
Java
false
false
1,031
java
package com.xl.gulimall.coupon.service.impl; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xl.common.utils.PageUtils; import com.xl.common.utils.Query; import com.xl.gulimall.coupon.dao.SmsMemberPriceDao; import com.xl.gulimall.coupon.entity.SmsMemberPriceEntity; import com.xl.gulimall.coupon.service.SmsMemberPriceService; @Service("smsMemberPriceService") public class SmsMemberPriceServiceImpl extends ServiceImpl<SmsMemberPriceDao, SmsMemberPriceEntity> implements SmsMemberPriceService { @Override public PageUtils queryPage(Map<String, Object> params) { IPage<SmsMemberPriceEntity> page = this.page( new Query<SmsMemberPriceEntity>().getPage(params), new QueryWrapper<SmsMemberPriceEntity>() ); return new PageUtils(page); } }
00c1188f9943f19c56aac1c9eeaa6b5deb6fb22f
12624428027d7048cfd611644cd85a805991fbbd
/src/27.FinalProject/MovieCatalogueFinalProject/app/src/test/java/net/coding4ever/roedhi/moviecataloguefinalproject/ExampleUnitTest.java
7dccc69237e8a75637ef6cb36b0adc37f625b0da
[]
no_license
k4m4r82/dicoding-android-developer-expert
6cc6bf1eeaff859cace9b860a888dc0d60103f9f
2102919012ee98bc9cf20b624194af20187d1029
refs/heads/master
2020-06-06T19:35:30.422791
2019-09-27T07:33:35
2019-09-27T07:33:35
192,835,290
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package net.coding4ever.roedhi.moviecataloguefinalproject; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * 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); } }
4f7ff79f401c36e428b23d39a21c826dac53594a
c783cf20689fca1a491a2ffef9258a9b690562f6
/java/src/main/java/creational/factory/JediConsular.java
f69c6f8128b4f537c4553e33c99fe651451d57b8
[]
no_license
MartenMaia/design-patterns
c9164e9412bb0df6978bd1cf546a56a4fb016856
a3b35ec9bacc7d6b7edf10fc806724d82a255d35
refs/heads/master
2023-05-28T11:00:53.995202
2019-09-07T14:26:12
2019-09-07T14:26:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package creational.factory; public class JediConsular implements Jedi { @Override public String whoAmI() { return "I am a Jedi Consular"; } }
[ "“tiagoamp@”" ]
“tiagoamp@”
c779177461947cde9de751780ecea8af836de75e
a40300de8ebe89b3dd09eac43e082884bdf38e09
/hw8_2/CollegeStudent.java
cf081ca2124d7a81ee7ff1de594b667cd97f8c76
[]
no_license
mashajmcz/grom1
4fbcb93ccbdc2cbf55254d8e3f459961ff073705
4412246762afa7c2cfb597eac5056f0c45f15120
refs/heads/master
2020-03-11T00:10:25.007155
2018-05-16T22:56:21
2018-05-16T22:56:21
129,657,234
0
0
null
null
null
null
UTF-8
Java
false
false
581
java
package lesson8.hw8_2; public class CollegeStudent extends Student { String collegeName; int rating; long id; public CollegeStudent(String firstName, String lastName, int group, Course[] coursesTaken) { super(firstName, lastName, group, coursesTaken); } public CollegeStudent(String firstName, String lastName, int group, Course[] coursesTaken, String collegeName, int rating, long id) { super(firstName, lastName, group, coursesTaken); this.collegeName = collegeName; this.rating = rating; this.id = id; } }
265af31d4c384b26baa1ba0017f39aea53304291
9965ff806ab968496a181c4c8985ab0dfaf35798
/app/src/main/java/com/talentica/rowingapp/common/data/remote/DatagramSocketType.java
9a73338b8fc732f1f356a6e057bfba3d694750ce
[]
no_license
Talentica/RowingStatsApp
b6169ca377f85ad7d50eca2d4515be3df8a8738e
f63aa7349678df68b39a14d9bc79fb36cef13864
refs/heads/master
2021-01-20T14:23:38.639640
2017-05-08T14:31:24
2017-05-08T14:31:24
90,603,112
1
1
null
2017-05-08T10:28:53
2017-05-08T08:15:42
Java
UTF-8
Java
false
false
100
java
package com.talentica.rowingapp.common.data.remote; enum DatagramSocketType { RECEIVER, SENDER }
a64d5e90d5526e040d994c2803a18c60ca674f3a
80f58239cb470d91530d8dd94cd42afed47e8aa1
/SigeduModeloApp/src/main/java/idat/edu/pe/sigedu/modelo/Curso.java
08b68ee0a60edd6a26ba2665b8b68be43c6118cb
[]
no_license
DPS1-IDAT/SIGEDU_Modelo
2bf6274dbdc72626b7a824a42a01452aefb551eb
205ea48fa2cef4123fa28cc75918f6fdc43125de
refs/heads/master
2022-06-23T22:39:47.978721
2019-11-23T03:50:52
2019-11-23T03:50:52
217,640,946
0
0
null
2022-06-21T02:07:03
2019-10-26T01:45:19
Java
UTF-8
Java
false
false
277
java
package idat.edu.pe.sigedu.modelo; /** * @author Christian Castillo */ public class Curso { /** * Default constructor */ public Curso() { } /** * */ public String codigo; /** * */ public String nombre; }
729301689e3dcf34abd01343e832514f44597a30
ab0f892b6a6adff5090192e5413b88bce1463160
/Chapter-4-Java-and-Tools/java_json/src/main/java/com/saternos/json/MyPojo.java
39ec9c3744eb323c607a3cef8f947c8f48b23216
[]
no_license
mbellomo/client-server-web-apps
8b73dbdef953ee7030999801a7ee34ce786455a4
d00fcc45d69cc64622623e02b5c0277486af4417
refs/heads/master
2021-01-20T11:09:18.384646
2013-12-24T01:17:32
2013-12-24T01:17:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package com.saternos.json; /** * */ public class MyPojo { private String thing1; private String thing2; public MyPojo(){ System.out.println("*** Constructor MyPojo() called"); } public String getThing1() { return thing1; } public void setThing1(String thing1) { this.thing1 = thing1; } public String getThing2() { return thing2; } public void setThing2(String thing2) { this.thing2 = thing2; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MyPojo myPojo = (MyPojo) o; if (thing1 != null ? !thing1.equals(myPojo.thing1) : myPojo.thing1 != null) return false; if (thing2 != null ? !thing2.equals(myPojo.thing2) : myPojo.thing2 != null) return false; return true; } @Override public int hashCode() { int result = thing1 != null ? thing1.hashCode() : 0; result = 31 * result + (thing2 != null ? thing2.hashCode() : 0); return result; } }
[ "cs@Cs-MacBook-Air.(none)" ]
cs@Cs-MacBook-Air.(none)
d78fef8a4faf7d8bf41fc1d03a570a917cb0128a
00abc1aec703a1d48c393bf853be907fc44280f5
/yeb-server/src/main/java/com/ming/server/service/impl/SalaryServiceImpl.java
b30ecd565289c70f378182e435ac2fbac5e63c64
[]
no_license
xiaoming-master/yeb
81c5f96e70881c5d9cff1b521f74a27c56115d24
843750239e67c1f92969a7990ac304c952e33593
refs/heads/master
2023-06-24T09:27:42.757753
2021-07-24T17:30:08
2021-07-24T17:30:08
387,009,042
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.ming.server.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ming.server.mapper.SalaryMapper; import com.ming.server.pojo.Salary; import com.ming.server.service.ISalaryService; import org.springframework.stereotype.Service; /** * <p> * 服务实现类 * </p> * * @author zhanglishen * @since 2021-07-17 */ @Service public class SalaryServiceImpl extends ServiceImpl<SalaryMapper, Salary> implements ISalaryService { }
31dade18df35bb8e6d214357f3a9badf8d046835
d7c9ff05d328b095517ea84c0c8e43564d410daf
/site/src/test/java/com/devdiscoveries/hippo/springmvc/components/DetailTest.java
0acfa5160d21fb334cfd2706621842af9512f313
[]
no_license
hugovalk/hippo-springmvc-example
09813c227d23046d9b626b2cd7435fa967e94c6f
77fc1cd1f014078e994ed0b7dd538a42638bf184
refs/heads/master
2020-04-09T09:12:31.219853
2013-06-24T13:01:04
2013-06-24T13:01:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,648
java
package com.devdiscoveries.hippo.springmvc.components; import javax.jcr.Session; import javax.servlet.ServletContext; import org.hippoecm.hst.configuration.hosting.Mount; import org.hippoecm.hst.content.beans.manager.ObjectConverter; import org.hippoecm.hst.content.beans.standard.HippoBean; import org.hippoecm.hst.core.component.HstRequest; import org.hippoecm.hst.core.component.HstResponse; import org.hippoecm.hst.core.request.ComponentConfiguration; import org.hippoecm.hst.core.request.HstRequestContext; import org.hippoecm.hst.core.request.ResolvedMount; import org.hippoecm.hst.core.request.ResolvedSiteMapItem; import org.hippoecm.hst.mock.content.beans.standard.MockHippoBean; import org.hippoecm.hst.mock.core.component.MockHstRequest; import org.hippoecm.hst.mock.core.request.MockComponentConfiguration; import org.hippoecm.hst.mock.core.request.MockHstRequestContext; import org.hippoecm.hst.mock.core.request.MockResolvedSiteMapItem; import org.junit.Test; import static junit.framework.Assert.assertEquals; import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.expectLastCall; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.verify; import static org.junit.Assert.assertNull; /** * Test class for {@link Detail} */ public class DetailTest { @Test public void doBeforeRender_FoundBean() throws Exception { HippoBean detailBean = new MockHippoBean(); ServletContext servletContext = createMock(ServletContext.class); ComponentConfiguration componentConfiguration = new MockComponentConfiguration(); ObjectConverter objectConverter = createMock(ObjectConverter.class); HstRequest request = new MockHstRequest(); Session session = createMock(Session.class); HstResponse response = createMock(HstResponse.class); HstRequestContext requestContext = new MockHstRequestContext(); ((MockHstRequestContext) requestContext).setSession(session); ResolvedMount resolvedMount = createMock(ResolvedMount.class); Mount mount = createMock(Mount.class); ((MockHstRequestContext) requestContext).setResolvedMount(resolvedMount); ResolvedSiteMapItem resolvedSiteMapItem = new MockResolvedSiteMapItem(); ((MockResolvedSiteMapItem) resolvedSiteMapItem).setRelativeContentPath("common/detail"); ((MockHstRequestContext) requestContext).setResolvedSiteMapItem(resolvedSiteMapItem); ((MockHstRequest) request).setRequestContext(requestContext); expect(resolvedMount.getMount()).andReturn(mount); expect(mount.getContentPath()).andReturn("/hst:hst/hst:sites/mysite-live/hst:content"); expect(servletContext.getAttribute("org.hippoecm.hst.component.support.bean.BaseHstComponent.objectConverter")).andReturn(objectConverter).anyTimes(); expect(objectConverter.getObject(session, "/hst:hst/hst:sites/mysite-live/hst:content/common/detail")).andReturn(detailBean); replay(servletContext, objectConverter, resolvedMount, mount, response, session); Detail detail = new Detail(); detail.init(servletContext, componentConfiguration); detail.doBeforeRender(request, response); verify(servletContext, objectConverter, resolvedMount, mount, response, session); assertEquals(detailBean, request.getAttribute("document")); } @Test public void doBeforeRender_MissingBean() throws Exception { ServletContext servletContext = createMock(ServletContext.class); ComponentConfiguration componentConfiguration = new MockComponentConfiguration(); ObjectConverter objectConverter = createMock(ObjectConverter.class); HstRequest request = new MockHstRequest(); Session session = createMock(Session.class); HstResponse response = createMock(HstResponse.class); HstRequestContext requestContext = new MockHstRequestContext(); ((MockHstRequestContext) requestContext).setSession(session); ResolvedMount resolvedMount = createMock(ResolvedMount.class); Mount mount = createMock(Mount.class); ((MockHstRequestContext) requestContext).setResolvedMount(resolvedMount); ResolvedSiteMapItem resolvedSiteMapItem = new MockResolvedSiteMapItem(); ((MockResolvedSiteMapItem) resolvedSiteMapItem).setRelativeContentPath("common/detail"); ((MockHstRequestContext) requestContext).setResolvedSiteMapItem(resolvedSiteMapItem); ((MockHstRequest) request).setRequestContext(requestContext); expect(resolvedMount.getMount()).andReturn(mount); expect(mount.getContentPath()).andReturn("/hst:hst/hst:sites/mysite-live/hst:content"); expect(servletContext.getAttribute("org.hippoecm.hst.component.support.bean.BaseHstComponent.objectConverter")).andReturn(objectConverter).anyTimes(); expect(objectConverter.getObject(session, "/hst:hst/hst:sites/mysite-live/hst:content/common/detail")).andReturn(null); response.setStatus(HstResponse.SC_NOT_FOUND); expectLastCall(); replay(servletContext, objectConverter, resolvedMount, mount, response, session); Detail detail = new Detail(); detail.init(servletContext, componentConfiguration); detail.doBeforeRender(request, response); verify(servletContext, objectConverter, resolvedMount, mount, response, session); assertNull(request.getAttribute("document")); } }
6f39e5643b1417b5a26889e397d9ba3ec033323b
528c04960c847297cc44424dbdd2eb8256970bc3
/src/main/java/com/junior/ecommerce/data/entity/Pages.java
015d46b551e991136510aef757c3b883d97264f0
[]
no_license
keremsrms0721/Spring-BasicECommerce
19e57aee263b2c4b21fb402336581910c629b62a
eb1f59e0a0b2b87c074566f49598bd814a21a6f6
refs/heads/master
2023-01-10T09:34:52.296804
2020-11-10T20:48:24
2020-11-10T20:48:24
311,772,846
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package com.junior.ecommerce.data.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Size; @Entity @Table(name = "page") public class Pages { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Size(min = 2, message = "Name must be at least 2 characters long") private String name; private String slug; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSlug() { return slug; } public void setSlug(String slug) { this.slug = slug; } }
50535e640c9d51ae2af4faa0f13f5bdf60bd0eff
a71aa580a3d58aebfb2d3b18432449964b06c789
/avoda1_nitoz/src/com/company/Order.java
ff3d8f5276f6747b5bc9c84e155719edad0cb5b2
[]
no_license
GuyArieli17/Shopping-UML
3ec5b31b9948e652fdc8d119c3d1c1344cd41bae
83f458d0ea74206cc8b96a58a75afe79fb867e57
refs/heads/main
2023-01-03T01:46:57.002684
2020-10-30T10:10:40
2020-10-30T10:10:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package com.company; public class Order { private String number; private Date Ordered; private Date shipprd; private Address ship_to; private OrderStatus status; private float total; }
406822edbf37ba0569a4cad0b98b4ba69cabdd24
e1527448392d94cb44a2f39628f0bddce1e6b902
/app/src/main/java/com/example/androidshop/NotificationLayoutActivity.java
2bbe11e5c89ea2d139f203b6b4dee16634d86e65
[]
no_license
jrluka13/android_shop
23a915ea50741316d767eecdfe9602e47d9c3305
b7b0069ba1ebec716a0c929f38cbab55bbcd6adb
refs/heads/master
2022-06-20T02:46:44.912463
2020-05-09T09:22:07
2020-05-09T09:22:07
262,532,899
0
0
null
null
null
null
UTF-8
Java
false
false
2,954
java
package com.example.androidshop; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import com.google.android.material.navigation.NavigationView; public class NotificationLayoutActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{ DrawerLayout drawerLayout; Toolbar toolbar; NavigationView navigationView; ActionBarDrawerToggle toggle; @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notification_layout); // create drawer navigation view drawerLayout = (DrawerLayout) findViewById(R.id.notification_drawer_layout); toolbar = findViewById(R.id.toolbar); navigationView = findViewById(R.id.navigationView); navigationView.setNavigationItemSelectedListener(this); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); toggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar, R.string.drawerOpen, R.string.drawerClose); drawerLayout.setDrawerListener(toggle); toggle.syncState(); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()){ case R.id.nav_home: Intent intent1 = new Intent(NotificationLayoutActivity.this, DrawerLayoutActivity.class); startActivity(intent1); break; case R.id.nav_dashboard: Intent intent2 = new Intent(NotificationLayoutActivity.this, DashboardLayoutActivity.class); startActivity(intent2); break; case R.id.nav_orders: Intent intent3 = new Intent(NotificationLayoutActivity.this,Orders.class); startActivity(intent3); break; case R.id.nav_notifications: Intent intent4 = new Intent(NotificationLayoutActivity.this, NotificationLayoutActivity.class); startActivity(intent4); break; case R.id.nav_activity: Intent intent6 = new Intent(NotificationLayoutActivity.this,Feed.class); startActivity(intent6); break; case R.id.nav_logout: Intent intent5 = new Intent(NotificationLayoutActivity.this, EnterToAdmin.class); startActivity(intent5); } drawerLayout.closeDrawer(GravityCompat.START); return true; } }
dd044586b571d5c79f943c378492a3fb5abc4d8a
6ab43ce407a89e0a4d4487ecbe7396319ebaedeb
/java/no/nordicsemi/android/nrftoolbox/hrs/HRSManager.java
bda40289d6f1bbbac9624d4bf9557ace02c1d734
[]
no_license
JihoonAndyKim/MoyoAndroid
cecb81d215f854b1b4b1834db5e7eda9452447c4
04a8daf50486840c2581923c3f165f50ca2820a6
refs/heads/master
2021-01-22T07:47:34.350678
2017-11-15T10:02:13
2017-11-15T10:02:13
81,850,270
0
0
null
2017-04-20T16:29:47
2017-02-13T17:11:38
Java
UTF-8
Java
false
false
8,153
java
/* * Copyright (c) 2015, Nordic Semiconductor * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package no.nordicsemi.android.nrftoolbox.hrs; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattCharacteristic; import android.bluetooth.BluetoothGattService; import android.content.Context; import java.util.Deque; import java.util.LinkedList; import java.util.UUID; import no.nordicsemi.android.log.Logger; import no.nordicsemi.android.nrftoolbox.R; import no.nordicsemi.android.nrftoolbox.parser.BodySensorLocationParser; import no.nordicsemi.android.nrftoolbox.parser.HeartRateMeasurementParser; import no.nordicsemi.android.nrftoolbox.profile.BleManager; /** * HRSManager class performs BluetoothGatt operations for connection, service discovery, enabling notification and reading characteristics. All operations required to connect to device with BLE HR * Service and reading heart rate values are performed here. HRSActivity implements HRSManagerCallbacks in order to receive callbacks of BluetoothGatt operations */ public class HRSManager extends BleManager<HRSManagerCallbacks> { /* public final static UUID HR_SERVICE_UUID = UUID.fromString("0000180D-0000-1000-8000-00805f9b34fb"); private static final UUID HR_SENSOR_LOCATION_CHARACTERISTIC_UUID = UUID.fromString("00002A38-0000-1000-8000-00805f9b34fb"); private static final UUID HR_CHARACTERISTIC_UUID = UUID.fromString("00002A37-0000-1000-8000-00805f9b34fb"); */ public final static UUID HR_SERVICE_UUID = UUID.fromString("e7bcb0d1-5f0b-427a-8a85-96354da753ee"); private static final UUID HR_SENSOR_LOCATION_CHARACTERISTIC_UUID = UUID.fromString("e7bcfeef-5f0b-427a-8a85-96354da753ee"); private static final UUID HR_CHARACTERISTIC_UUID = UUID.fromString("e7bcecec-5f0b-427a-8a85-96354da753ee"); public final static UUID HR_SERVICE = UUID.fromString("0000180D-0000-1000-8000-00805f9b34fb"); private static final UUID HR_CHAR = UUID.fromString("00002A37-0000-1000-8000-00805f9b34fb"); private BluetoothGattCharacteristic mHRCharacteristic, mHRLocationCharacteristic, mHR, mHRNewChar; private byte tempVal; private static HRSManager managerInstance = null; /** * singleton implementation of HRSManager class */ public static synchronized HRSManager getInstance(final Context context) { if (managerInstance == null) { managerInstance = new HRSManager(context); } return managerInstance; } public HRSManager(final Context context) { super(context); } @Override protected BleManagerGattCallback getGattCallback() { return mGattCallback; } /** * BluetoothGatt callbacks for connection/disconnection, service discovery, receiving notification, etc */ private final BleManagerGattCallback mGattCallback = new BleManagerGattCallback() { @Override protected Deque<Request> initGatt(final BluetoothGatt gatt) { final LinkedList<Request> requests = new LinkedList<>(); if (mHRLocationCharacteristic != null) requests.add(Request.newReadRequest(mHRLocationCharacteristic)); requests.add(Request.newEnableNotificationsRequest(mHRLocationCharacteristic)); requests.add(Request.newEnableNotificationsRequest(mHRCharacteristic)); requests.add(Request.newEnableNotificationsRequest(mHR)); return requests; } @Override protected boolean isRequiredServiceSupported(final BluetoothGatt gatt) { final BluetoothGattService service = gatt.getService(HR_SERVICE_UUID); if (service != null) { mHRCharacteristic = service.getCharacteristic(HR_CHARACTERISTIC_UUID); } mHRLocationCharacteristic = gatt.getService(HR_SERVICE_UUID).getCharacteristic(HR_SENSOR_LOCATION_CHARACTERISTIC_UUID); return mHRCharacteristic != null; } @Override protected boolean isOptionalServiceSupported(final BluetoothGatt gatt) { final BluetoothGattService service = gatt.getService(HR_SERVICE_UUID); if (service != null) { mHRLocationCharacteristic = service.getCharacteristic(HR_SENSOR_LOCATION_CHARACTERISTIC_UUID); } mHR = gatt.getService(HR_SERVICE).getCharacteristic(HR_CHAR); return mHRLocationCharacteristic != null; } @Override public void onCharacteristicRead(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) { Logger.a(mLogSession, "\"" + BodySensorLocationParser.parse(characteristic) + "\" received"); final String sensorPosition = getBodySensorPosition(characteristic.getValue()[0]); //This will send callback to HRSActivity when HR sensor position on body is found in HR device mCallbacks.onHRSensorPositionFound(gatt.getDevice(), sensorPosition); } @Override protected void onDeviceDisconnected() { mHRLocationCharacteristic = null; mHRCharacteristic = null; mHR = null; } @Override public void onCharacteristicNotified(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) { Logger.a(mLogSession, "\"" + HeartRateMeasurementParser.parse(characteristic) + "\" received"); if(characteristic.getUuid().equals(HR_CHAR)) { int hrValue; if (isHeartRateInUINT16(characteristic.getValue()[0])) { hrValue = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT16, 1); } else { hrValue = characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT8, 1); } mCallbacks.onHRValueUpdated(gatt.getDevice(), hrValue); return; } if((mHRLocationCharacteristic.getValue()[0] & 0xFF) != (tempVal & 0xFF)) { final String sensorPosition = getBodySensorPosition(mHRLocationCharacteristic.getValue()[0]); //This will send callback to HRSActivity when HR sensor position on body is found in HR device tempVal = mHRLocationCharacteristic.getValue()[0]; mCallbacks.onHRSensorPositionFound(gatt.getDevice(), sensorPosition); return; } byte hrValue[] = new byte[20]; hrValue = characteristic.getValue(); tempVal = mHRLocationCharacteristic.getValue()[0]; //This will send callback to HRSActivity when new HR value is received from HR device mCallbacks.onHRValueReceived(gatt.getDevice(), hrValue); } }; /** * This method will decode and return Heart rate sensor position on body */ private String getBodySensorPosition(final byte bodySensorPositionValue) { int val; switch(bodySensorPositionValue) { case 0x48: val = 0; break; case 0x46: val = 1; break; default: val = 0; break; } final String[] locations = getContext().getResources().getStringArray(R.array.hrs_locations); return locations[val]; } /** * This method will check if Heart rate value is in 8 bits or 16 bits */ private boolean isHeartRateInUINT16(final byte value) { return ((value & 0x01) != 0); } }
a6eb73e7e09590ca4c3c5cbe62db3a42a9ec403d
ac39ec69c542914dd348bf3dbd219dc86dd59504
/app/src/main/java/com/example/user/map/PlaceApiActivity.java
8d08d0f5c087247c0b1a07be290df07aba22a7bd
[]
no_license
JasonKaiKai/Map
b96a784662537b72965572978a5e28d1ac6a475b
393572fd68a4154f6da5c6a06d1d603223f87a56
refs/heads/master
2021-01-21T12:47:43.326559
2016-03-19T09:56:50
2016-03-19T09:56:50
40,316,984
0
0
null
null
null
null
UTF-8
Java
false
false
4,171
java
package com.example.user.map; import android.content.Context; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesNotAvailableException; import com.google.android.gms.common.GooglePlayServicesRepairableException; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.places.Place; import com.google.android.gms.location.places.PlaceDetectionApi; import com.google.android.gms.location.places.Places; import com.google.android.gms.location.places.ui.PlacePicker; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; public class PlaceApiActivity extends ActionBarActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { private GoogleApiClient mgoogleapiclient; private int PLACE_PICKER_REQUEST = 1; private static final LatLngBounds viewbound = new LatLngBounds(new LatLng(23.181767,121.639356), new LatLng(25.167292,120.000000)); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_place_api); mgoogleapiclient = new GoogleApiClient.Builder(this) .addApi(Places.GEO_DATA_API) .addApi(Places.PLACE_DETECTION_API) .addConnectionCallbacks( this) .addOnConnectionFailedListener( this) .build(); Log.i("googleservice","yes"); try { setupPlaceApi(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } } @Override protected void onStart(){ super.onStart(); mgoogleapiclient.connect(); } private void setupPlaceApi() throws GooglePlayServicesNotAvailableException, GooglePlayServicesRepairableException { //intentBuilder.build(context)需要這些例外 PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder(); intentBuilder.setLatLngBounds(viewbound); Context context = getApplicationContext(); startActivityForResult(intentBuilder.build(context),PLACE_PICKER_REQUEST); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == PLACE_PICKER_REQUEST) { Log.i("requestcode","yes"); if(resultCode == RESULT_OK) { Log.i("resultcode","yes"); Place place = PlacePicker.getPlace(data,this); String toastMsg = String.format("Place: %s", place.getName()); Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show(); } } Log.i("z",""); super.onActivityResult(requestCode, resultCode, data); } @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_place_api, 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) { return true; } return super.onOptionsItemSelected(item); } @Override public void onConnected(Bundle bundle) { } @Override public void onConnectionSuspended(int i) { } @Override public void onConnectionFailed(ConnectionResult connectionResult) { } }
b13dd220bd3052ee4f738811031fe379617ac46f
b6613fcd9803db5b17d351c6d8f2c7c8abd29cf4
/interfaz/IntfzComprador.java
24e6159b2d820ba7985bf2d78331d2d9ebfa1afa
[]
no_license
chelis1498/Sistemas-Artificiales-Inteligentes
827d8a21869ea8853fc8973d85eb73c4120bff33
1030d9a9a0f5197ef95ed82b17c4e97d90d9a125
refs/heads/master
2023-01-23T07:06:55.794394
2020-12-11T19:16:51
2020-12-11T19:16:51
293,994,947
0
0
null
null
null
null
UTF-8
Java
false
false
3,087
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 interfaz; import agentes.AGcomprador; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextField; /** * * @author OGChelis */ public class IntfzComprador extends JFrame{ private AGcomprador myAgent; private JTextField libroF; public JTextArea msg = new JTextArea(""); /** * * @param a */ public IntfzComprador(AGcomprador a) { super(a.getLocalName()); myAgent = a; JPanel p = new JPanel(); JPanel pTitulo = new JPanel(); JPanel pMsg = new JPanel(); pMsg.setLayout(new GridLayout(1,1)); pTitulo.setLayout(new GridLayout(1,2)); p.setLayout(new GridLayout(3, 1)); pTitulo.add(new JLabel("Titulo de libro:")); libroF = new JTextField(15); pTitulo.add(libroF); msg.setLineWrap(true); msg.setWrapStyleWord(true); msg.setEditable(false); JScrollPane scrollPane = new JScrollPane(msg); pMsg.add(scrollPane); getContentPane().add(p, BorderLayout.CENTER); p.add(pTitulo); p.add(pMsg); JButton addButton = new JButton("Comprar"); addButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { try { String libro = libroF.getText().trim(); myAgent.comprarLibro(libro); libroF.setText(""); msg.setText("Espere..."); }catch(Exception e) { JOptionPane.showMessageDialog(IntfzComprador.this, "Invalid values","Exception",JOptionPane.ERROR_MESSAGE); } } }); p = new JPanel(); p.add(addButton); getContentPane().add(p, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { myAgent.doDelete(); } }); setResizable(true); } public void showGui() { pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int centerX = (int)screenSize.getWidth() / 2; int centerY = (int)screenSize.getHeight() / 2; setLocation(centerX - getWidth() / 2, centerY - getHeight() / 2); super.setVisible(true); } }
e592161b50680cd60cdafd8ff9589077ae5fcb41
65ebd9cc9b8ac76522f77c84b70fdc8b2c6d77e6
/src/main/java/com/github/leetcode/medium/Leetcode932.java
548b88c89679e06b4dd71c4b18cdc3bbbdb2024c
[]
no_license
SlumDunk/leetcode
30af765c7f5e61317983af43230bafa23362e25a
c242f13e7b3a3ea67cdd70f3d8b216e83bd65829
refs/heads/master
2021-08-20T01:58:11.309819
2021-07-25T17:07:10
2021-07-25T17:07:10
121,602,686
0
0
null
2020-11-08T03:34:35
2018-02-15T07:38:45
Java
UTF-8
Java
false
false
3,170
java
package com.github.leetcode.medium; import java.util.ArrayList; /** * @Author: zerongliu * @Date: 6/29/19 22:33 * @Description: For some fixed N, an array A is beautiful if it is a permutation of the integers 1, 2, ..., N, such that: * <p> * For every i < j, there is no k with i < k < j such that A[k] * 2 = A[i] + A[j]. * <p> * Given N, return any beautiful array A. (It is guaranteed that one exists.) * <p> * <p> * <p> * Example 1: * <p> * Input: 4 * Output: [2,1,4,3] * Example 2: * <p> * Input: 5 * Output: [3,1,2,5,4] * <p> * <p> * Note: * <p> * 1 <= N <= 1000 */ public class Leetcode932 { /** * Intuition: * Try to divide and conquer, * so we have left part, right part. * <p> * One way is to divide into [1, N / 2] and [N / 2 + 1, N]. * But it will cause problems when we merge them. * <p> * Another way is to divide into odds part and evens part. * So there is no k with A[k] * 2 = odd + even * <p> * I brute force all permutations when N = 5: * 20 beautiful array found, * only 4 don't fit odd + even pattern: * [2, 1, 4, 5, 3] * [3, 1, 2, 5, 4] * [3, 5, 4, 1, 2] * [4, 5, 2, 1, 3] * <p> * <p> * Beautiful Array Properties * Saying that an array is beautiful, * there is no i < k < j, * such that A[k] * 2 = A[i] + A[j] * <p> * Apply these 3 following changes a beautiful array, * we can get a new beautiful array * <p> * <p> * 1. Deletion * Easy to prove. * <p> * 2. Addition * If we have A[k] * 2 != A[i] + A[j], * (A[k] + x) * 2 = A[k] * 2 + 2x != A[i] + A[j] + 2x = (A[i] + x) + (A[j] + x) * <p> * E.g: [1,3,2] + 1 = [2,4,3]. * <p> * 3. Multiplication * If we have A[k] * 2 != A[i] + A[j], * for any x != 0, * (A[k] * x) * 2 = A[k] * 2 * x != (A[i] + A[j]) * x = (A[i] * x) + (A[j] * x) * <p> * E.g: [1,3,2] * 2 = [2,6,4] * <p> * <p> * Explanation * With the observations above, we can easily construct any beautiful array. * Assume we have a beautiful array A with length N * <p> * A1 = A * 2 - 1 is beautiful with only odds from 1 to N * 2 -1 * A2 = A * 2 is beautiful with only even from 2 to N * 2 * B = A1 + A2 beautiful array with length N * 2 * <p> * E.g: * <p> * A = [2, 1, 4, 5, 3] * A1 = [3, 1, 7, 9, 5] * A2 = [4, 2, 8, 10, 6] * B = A1 + A2 = [3, 1, 7, 9, 5, 4, 2, 8, 10, 6] * <p> * Time Complexity: * I have iteration version here O(N) * Naive recursion is O(NlogN) * Recursion with one call or with cache is O(N) * * @param N * @return */ public int[] beautifulArray(int N) { ArrayList<Integer> res = new ArrayList<>(); res.add(1); while (res.size() < N) { ArrayList<Integer> tmp = new ArrayList<>(); for (int i : res) if (i * 2 - 1 <= N) tmp.add(i * 2 - 1); for (int i : res) if (i * 2 <= N) tmp.add(i * 2); res = tmp; } return res.stream().mapToInt(i -> i).toArray(); } }
e008f49fc9ef21f4de4987911affd9fff66d491b
47e8449ed66a3cd5514038c18e98832edd76e956
/Nimbus/src/main/java/nimbus/utils/ExceptionType.java
e0c317563733fadbd8b2da51251ed69d2c42d4c5
[]
no_license
adamjshook/nimbus
e6dec4d094ed0d4adbfb204d8bc918223466514f
0ce8d2cc5194cfbe2edcd71ad136633ef5a68b1f
refs/heads/master
2021-01-25T07:34:35.388647
2013-06-04T22:31:43
2013-06-04T22:31:43
8,021,340
1
1
null
null
null
null
UTF-8
Java
false
false
451
java
package nimbus.utils; public enum ExceptionType { BROKEN_STREAM, FAILED_TO_ACCEPT_CONNECTION, FAILED_TO_CONNECT, FAILED_TO_START_SERVER, PROTOCOL_ERROR, UNKNOWN_SERVER_TYPE, NO_AVAILABLE_SERVERS, FAILED_TO_RECOVER, FAILED_TO_CLOSE_WRITE_FILE, FAILED_TO_FLUSH_WRITE_FILE, MASTER_UNAVAILABLE, NEBULA_EXISTS, NEBULA_DOES_NOT_EXIST, NO_AVAILABLE_PORT, ZOOKEEPER_EXCEPTION, INVALID_CONF, NEBULA_ALREADY_EXISTS, FAILED_TO_CONNECT_TO_ZOOKEEPER }
3744c094121d1bbabf95c498b302bc85bd61c153
a0ce1a8448fda7cd2842c5e754c6cbaa7f46fd28
/labs/taking_rest/src/edu/neumont/jaxb/Catering.java
8a8048b4bbcfa234e18ec66f258fc4c21f4c4f89
[]
no_license
syergensen/syergensen_csc380
2a21481cd8f76f4e0389e752d31881857d952af9
1a7f639aba03822bd1e994e0ea957a50eb77c9b3
refs/heads/master
2021-01-18T14:13:56.151626
2013-08-05T19:22:15
2013-08-05T19:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,885
java
package edu.neumont.jaxb; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{}restaurant" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "restaurants" }) @XmlRootElement(name = "catering") public class Catering { @XmlElement(name = "restaurant", required = true) protected List<Restaurant> restaurants; /** * Gets the value of the restaurants property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the restaurants property. * * <p> * For example, to add a new item, do as follows: * <pre> * getRestaurants().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Restaurant } * * */ public List<Restaurant> getRestaurants() { if (restaurants == null) { restaurants = new ArrayList<Restaurant>(); } return this.restaurants; } }
25a3b6250d480a539b2662eb8855c0c69ba72b28
e1b1ce58fb1277b724022933176f0809169682d9
/sources/fr/pcsoft/wdjava/core/application/C0650i.java
6df508076a45d225a378edbf41df6785c04d1cce
[]
no_license
MR-116/com.masociete.projet_mobile-1_source_from_JADX
a5949c814f0f77437f74b7111ea9dca17140f2ea
6cd80095cd68cb9392e6e067f26993ab2bf08bb2
refs/heads/master
2020-04-11T15:00:54.967026
2018-12-15T06:33:57
2018-12-15T06:33:57
161,873,466
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
package fr.pcsoft.wdjava.core.application; import fr.pcsoft.wdjava.core.WDObjet; import fr.pcsoft.wdjava.core.allocation.IWDAllocateur; import fr.pcsoft.wdjava.core.erreur.WDErreurManager; /* renamed from: fr.pcsoft.wdjava.core.application.i */ final class C0650i implements IWDAllocateur { final Class val$classe; C0650i(Class cls) { this.val$classe = cls; } public WDObjet creerInstance() { try { return (WDObjet) this.val$classe.newInstance(); } catch (Throwable e) { WDErreurManager.m2888b(e); return null; } } public Class getClasseWD() { return this.val$classe; } public int getTypeWL() { return 111; } public boolean isDynamique() { return false; } }
1eb3204e5c1dbedd449351cd946253a4a902d2a5
06c1f2b43deeaa4c8e99cc4b2becc61b0619f663
/chapter_002/src/main/java/ru/job4j/tracker/TrackerSingleLazySecond.java
f138b73b47a6f43b7e891fea734c4c1ae6c6e88e
[]
no_license
dalexball/job4j
872176d721ac22ea2e755f1ea25722aab0025404
720e91517b5832effb2f3da64ee18df51a7a3114
refs/heads/master
2020-12-14T11:06:09.260545
2020-03-29T20:07:24
2020-03-29T20:07:24
234,721,439
0
0
null
2020-10-13T18:55:54
2020-01-18T11:01:00
Java
UTF-8
Java
false
false
673
java
package ru.job4j.tracker; /** * Class uses singleton pattern with private holder class * * @author Alex Dotsyak * @version 1 * @since 0.1 */ public class TrackerSingleLazySecond { /** * Make constructor private to restrict usage */ private TrackerSingleLazySecond() { } /** * Get instance of class * * @return class object */ public static TrackerSingleLazySecond getInstance() { return Holder.INSTANCE; } /** * Initializes instance of class */ private static final class Holder { private static final TrackerSingleLazySecond INSTANCE = new TrackerSingleLazySecond(); } }
783044ec89b2a846a605a3ef0400655e16f79514
0c45b2012ee2715b0b725e764fbfc9bc40109936
/src/br/inf/portalfiscal/nfe/cce/proccce/TEnvEvento.java
bab2a228882147b4764331016a3f0ea238202ab6
[]
no_license
roneison85/NFeLib4.00
9d5c50bd0011a624dff1279e15cc4d31257ade0e
d8bcb84aaca63c428cc8ca175330e77809b7f2c7
refs/heads/master
2021-12-10T07:18:43.952886
2021-12-01T10:44:19
2021-12-01T10:44:19
203,785,144
0
0
null
null
null
null
UTF-8
Java
false
false
3,827
java
// // Este arquivo foi gerado pela Arquitetura JavaTM para Implementa��o de Refer�ncia (JAXB) de Bind XML, v2.2.8-b130911.1802 // Consulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Todas as modifica��es neste arquivo ser�o perdidas ap�s a recompila��o do esquema de origem. // Gerado em: 2017.07.13 �s 09:54:11 AM BRT // package br.inf.portalfiscal.nfe.cce.proccce; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * Tipo Lote de Envio * * <p>Classe Java de TEnvEvento complex type. * * <p>O seguinte fragmento do esquema especifica o conte�do esperado contido dentro desta classe. * * <pre> * &lt;complexType name="TEnvEvento"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="idLote"> * &lt;simpleType> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;whiteSpace value="preserve"/> * &lt;pattern value="[0-9]{1,15}"/> * &lt;/restriction> * &lt;/simpleType> * &lt;/element> * &lt;element name="evento" type="{http://www.portalfiscal.inf.br/nfe}TEvento" maxOccurs="20"/> * &lt;/sequence> * &lt;attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/nfe}TVerEnvEvento" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TEnvEvento", namespace = "http://www.portalfiscal.inf.br/nfe", propOrder = { "idLote", "evento" }) public class TEnvEvento { @XmlElement(required = true) protected String idLote; @XmlElement(required = true) protected List<TEvento> evento; @XmlAttribute(name = "versao", required = true) protected String versao; /** * Obt�m o valor da propriedade idLote. * * @return * possible object is * {@link String } * */ public String getIdLote() { return idLote; } /** * Define o valor da propriedade idLote. * * @param value * allowed object is * {@link String } * */ public void setIdLote(String value) { this.idLote = value; } /** * Gets the value of the evento property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the evento property. * * <p> * For example, to add a new item, do as follows: * <pre> * getEvento().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TEvento } * * */ public List<TEvento> getEvento() { if (evento == null) { evento = new ArrayList<TEvento>(); } return this.evento; } /** * Obt�m o valor da propriedade versao. * * @return * possible object is * {@link String } * */ public String getVersao() { return versao; } /** * Define o valor da propriedade versao. * * @param value * allowed object is * {@link String } * */ public void setVersao(String value) { this.versao = value; } }
4a2761734541455192a70fc0e35533e28c45b9c8
c79c2f72fa52e35a5d648cc4175ad4fd8165eb6b
/northwind/src/main/java/kodlamaio/northwind/entities/concretes/Product.java
beeed119b739c300593d102db0adf4fddc5d12e8
[]
no_license
merveakbulutt/northwind-project
da750fd4c5976a8bea67235dea84dacec3acc1f6
34a469674dd6673cec59ece4f3bcb3c5ca8c4443
refs/heads/master
2023-05-09T16:06:39.371724
2021-06-05T22:54:41
2021-06-05T22:54:41
367,064,525
0
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package kodlamaio.northwind.entities.concretes; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @Entity @Table(name="products") @AllArgsConstructor @NoArgsConstructor public class Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="product_id") private int id; @Column(name="product_name") private String productName; @Column(name="unit_price") private double unitPrice; @Column(name="units_in_stock") private short unitsInStock; @Column(name="quantity_per_unit") private String quantityPerUnit; @ManyToOne() @JoinColumn(name="category_id") private Category category; }
[ "Katip@DESKTOP-6P2FP43" ]
Katip@DESKTOP-6P2FP43
ab54eb987b265de726afb8a334a2d08647a85722
2008d3a598bfa54e2c77c73da67271d8c41a1309
/app/src/main/java/com/example/placeholderviewer/entities/User.java
3194570d5859f1728cff1ab2b489df5bc3187ddf
[]
no_license
lechdo/PlaceHolderViewer
6f68c6d79c17a5af55bece4246463e52690cecc6
feb3a4297806f95c60affd70ea499ec31c132123
refs/heads/master
2020-05-14T21:48:03.214738
2019-04-19T12:26:29
2019-04-19T12:26:29
181,969,002
0
0
null
null
null
null
UTF-8
Java
false
false
3,466
java
package com.example.placeholderviewer.entities; import android.os.Parcel; import android.os.Parcelable; import com.example.placeholderviewer.data.database.base.DbEntity; import java.io.Serializable; public class User extends DbEntity implements Serializable, Parcelable { private String name; private String userName; private String email; private Adress adress; private String phone; private String website; private Compagny compagny; public User() { } public User(String name, String userName, String email, Adress adress, String phone, String website, Compagny compagny) { this.name = name; this.userName = userName; this.email = email; this.adress = adress; this.phone = phone; this.website = website; this.compagny = compagny; } protected User(Parcel in) { name = in.readString(); userName = in.readString(); email = in.readString(); adress = in.readParcelable(Adress.class.getClassLoader()); phone = in.readString(); website = in.readString(); compagny = in.readParcelable(Compagny.class.getClassLoader()); } public static final Creator<User> CREATOR = new Creator<User>() { @Override public User createFromParcel(Parcel in) { return new User(in); } @Override public User[] newArray(int size) { return new User[size]; } }; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Adress getAdress() { return adress; } public void setAdress(Adress adress) { this.adress = adress; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website; } public Compagny getCompagny() { return compagny; } public void setCompagny(Compagny compagny) { this.compagny = compagny; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(name); dest.writeString(userName); dest.writeString(email); dest.writeParcelable(adress, flags); dest.writeString(phone); dest.writeString(website); dest.writeParcelable(compagny, flags); } @Override public String toString() { final StringBuffer sb = new StringBuffer("User{"); sb.append("name='").append(name).append('\''); sb.append(", userName='").append(userName).append('\''); sb.append(", email='").append(email).append('\''); sb.append(", adress=").append(adress); sb.append(", phone='").append(phone).append('\''); sb.append(", website='").append(website).append('\''); sb.append(", compagny=").append(compagny); sb.append('}'); return sb.toString(); } }
0b99f5d0f8c39f356e98f47c5cf565ab221fa222
2b55cf09185a6154b633873f37525a6ee0fb6178
/src/test/java/com/sf/simple/jdbc/templete/entity/UserRole.java
1bd5f3ebc4a3cb48fa89e275de01c6714642cb71
[]
no_license
houzhanwu/simple-jdbc-templete
86aa9d540e6b0d5cf3ef289031bd7874e3aca2e1
d603df9427dcf9d2d885da619221a18fd6ba2b9a
refs/heads/master
2020-03-30T03:41:51.711875
2017-09-01T05:20:43
2017-09-01T05:20:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
849
java
package com.sf.simple.jdbc.templete.entity; import java.io.Serializable; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; /** * @author 作者 史锋 * @version 创建时间:2017年6月12日 下午7:19:21 */ @Table(name="t_user_role") public class UserRole implements Serializable{ private static final long serialVersionUID = 4405068293658708523L; private Long id; private Long userId; private Long roleId; @Id @GeneratedValue public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public Long getRoleId() { return roleId; } public void setRoleId(Long roleId) { this.roleId = roleId; } }
[ "Cloud@DESKTOP-4RVG6KQ" ]
Cloud@DESKTOP-4RVG6KQ
77773d6c76429e1dcb07f31884068723c3480077
2240d3e794583f25ce49a23bb7d7930882580c82
/core/src/main/java/hudson/search/UnionSearchIndex.java
cde13860b95f46c1f7c3fc4fc5419d16eddb60f3
[ "MIT" ]
permissive
oleg-nenashev/jenkins
f78f747aa5f0c656d6ffe3258707b11e1e861027
597e6431ba410ee2fde137d86bd607e078d48edd
refs/heads/master
2023-01-23T07:21:41.970949
2020-07-21T04:57:41
2020-07-21T04:57:41
14,375,421
2
3
MIT
2023-01-02T15:04:51
2013-11-13T20:24:23
Java
UTF-8
Java
false
false
2,220
java
/* * The MIT License * * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package hudson.search; import java.util.List; /** * Union of two sets. * * @author Kohsuke Kawaguchi */ public class UnionSearchIndex implements SearchIndex { public static SearchIndex combine(SearchIndex... sets) { SearchIndex p=EMPTY; for (SearchIndex q : sets) { // allow some of the inputs to be null, // and also recognize EMPTY if (q != null && q != EMPTY) { if (p == EMPTY) p = q; else p = new UnionSearchIndex(p,q); } } return p; } private final SearchIndex lhs,rhs; public UnionSearchIndex(SearchIndex lhs, SearchIndex rhs) { this.lhs = lhs; this.rhs = rhs; } public void find(String token, List<SearchItem> result) { lhs.find(token,result); rhs.find(token,result); } public void suggest(String token, List<SearchItem> result) { lhs.suggest(token,result); rhs.suggest(token,result); } }
[ "kohsuke@71c3de6d-444a-0410-be80-ed276b4c234a" ]
kohsuke@71c3de6d-444a-0410-be80-ed276b4c234a
383d898adb07131eda619cf70cab444802f321dc
325f18f8d121defa67dab27622ed49bd23f95ffb
/src/com/owner/entity/Lottery.java
f72cb0149751a58f0d7027e65c7894534cbae823
[]
no_license
ownerHZH/weixinowner
9c58c64d53c48fc87e2c8b6fd3b9663cb5c79da8
4a62f49ed74d84eeb93fd0856114dffc34cc7654
refs/heads/master
2021-01-20T21:52:46.912244
2014-08-23T18:54:14
2014-08-23T18:54:14
23,263,675
1
1
null
null
null
null
UTF-8
Java
false
false
594
java
package com.owner.entity; public class Lottery { String icon; String detailurl; String number; String info; public String getIcon() { return icon; } public void setIcon(String icon) { this.icon = icon; } public String getDetailurl() { return detailurl; } public void setDetailurl(String detailurl) { this.detailurl = detailurl; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getInfo() { return info; } public void setInfo(String info) { this.info = info; } }
e80b891e3e3c049ec0582b84c2ea3d390dd6177b
522370099e803b14d016abaa2db03490284f20eb
/src/main/java/com/tencentcloudapi/mps/v20190612/models/CreateWorkflowRequest.java
3d3d3e2ad7ea292d76a254ef9b5f8765c64c76fe
[ "Apache-2.0" ]
permissive
diaolingzc/tencentcloud-sdk-java
65277f6631d9d50cfc361f3f8b9401b689e0fbeb
677fa638f037d69963751d48f055997911572c77
refs/heads/master
2020-09-03T09:42:09.778129
2019-11-05T11:42:29
2019-11-05T11:42:29
219,438,072
0
0
Apache-2.0
2019-11-04T07:04:16
2019-11-04T07:04:16
null
UTF-8
Java
false
false
7,506
java
/* * Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tencentcloudapi.mps.v20190612.models; import com.tencentcloudapi.common.AbstractModel; import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.Expose; import java.util.HashMap; public class CreateWorkflowRequest extends AbstractModel{ /** * 工作流名称,最多128字符。同一个用户该名称唯一。 */ @SerializedName("WorkflowName") @Expose private String WorkflowName; /** * 工作流绑定的触发规则,当上传视频命中该规则到该对象时即触发工作流。 */ @SerializedName("Trigger") @Expose private WorkflowTrigger Trigger; /** * 视频处理的文件输出存储位置。不填则继承 Trigger 中的存储位置。 */ @SerializedName("OutputStorage") @Expose private TaskOutputStorage OutputStorage; /** * 视频处理生成的文件输出的目标目录,如`/movie/201907/`。如果不填,表示与触发文件所在的目录一致。 */ @SerializedName("OutputDir") @Expose private String OutputDir; /** * 视频处理类型任务参数。 */ @SerializedName("MediaProcessTask") @Expose private MediaProcessTaskInput MediaProcessTask; /** * 任务的事件通知配置,不填代表不获取事件通知。 */ @SerializedName("TaskNotifyConfig") @Expose private TaskNotifyConfig TaskNotifyConfig; /** * 工作流的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 */ @SerializedName("TaskPriority") @Expose private Long TaskPriority; /** * 获取工作流名称,最多128字符。同一个用户该名称唯一。 * @return WorkflowName 工作流名称,最多128字符。同一个用户该名称唯一。 */ public String getWorkflowName() { return this.WorkflowName; } /** * 设置工作流名称,最多128字符。同一个用户该名称唯一。 * @param WorkflowName 工作流名称,最多128字符。同一个用户该名称唯一。 */ public void setWorkflowName(String WorkflowName) { this.WorkflowName = WorkflowName; } /** * 获取工作流绑定的触发规则,当上传视频命中该规则到该对象时即触发工作流。 * @return Trigger 工作流绑定的触发规则,当上传视频命中该规则到该对象时即触发工作流。 */ public WorkflowTrigger getTrigger() { return this.Trigger; } /** * 设置工作流绑定的触发规则,当上传视频命中该规则到该对象时即触发工作流。 * @param Trigger 工作流绑定的触发规则,当上传视频命中该规则到该对象时即触发工作流。 */ public void setTrigger(WorkflowTrigger Trigger) { this.Trigger = Trigger; } /** * 获取视频处理的文件输出存储位置。不填则继承 Trigger 中的存储位置。 * @return OutputStorage 视频处理的文件输出存储位置。不填则继承 Trigger 中的存储位置。 */ public TaskOutputStorage getOutputStorage() { return this.OutputStorage; } /** * 设置视频处理的文件输出存储位置。不填则继承 Trigger 中的存储位置。 * @param OutputStorage 视频处理的文件输出存储位置。不填则继承 Trigger 中的存储位置。 */ public void setOutputStorage(TaskOutputStorage OutputStorage) { this.OutputStorage = OutputStorage; } /** * 获取视频处理生成的文件输出的目标目录,如`/movie/201907/`。如果不填,表示与触发文件所在的目录一致。 * @return OutputDir 视频处理生成的文件输出的目标目录,如`/movie/201907/`。如果不填,表示与触发文件所在的目录一致。 */ public String getOutputDir() { return this.OutputDir; } /** * 设置视频处理生成的文件输出的目标目录,如`/movie/201907/`。如果不填,表示与触发文件所在的目录一致。 * @param OutputDir 视频处理生成的文件输出的目标目录,如`/movie/201907/`。如果不填,表示与触发文件所在的目录一致。 */ public void setOutputDir(String OutputDir) { this.OutputDir = OutputDir; } /** * 获取视频处理类型任务参数。 * @return MediaProcessTask 视频处理类型任务参数。 */ public MediaProcessTaskInput getMediaProcessTask() { return this.MediaProcessTask; } /** * 设置视频处理类型任务参数。 * @param MediaProcessTask 视频处理类型任务参数。 */ public void setMediaProcessTask(MediaProcessTaskInput MediaProcessTask) { this.MediaProcessTask = MediaProcessTask; } /** * 获取任务的事件通知配置,不填代表不获取事件通知。 * @return TaskNotifyConfig 任务的事件通知配置,不填代表不获取事件通知。 */ public TaskNotifyConfig getTaskNotifyConfig() { return this.TaskNotifyConfig; } /** * 设置任务的事件通知配置,不填代表不获取事件通知。 * @param TaskNotifyConfig 任务的事件通知配置,不填代表不获取事件通知。 */ public void setTaskNotifyConfig(TaskNotifyConfig TaskNotifyConfig) { this.TaskNotifyConfig = TaskNotifyConfig; } /** * 获取工作流的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 * @return TaskPriority 工作流的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 */ public Long getTaskPriority() { return this.TaskPriority; } /** * 设置工作流的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 * @param TaskPriority 工作流的优先级,数值越大优先级越高,取值范围是 -10 到 10,不填代表 0。 */ public void setTaskPriority(Long TaskPriority) { this.TaskPriority = TaskPriority; } /** * 内部实现,用户禁止调用 */ public void toMap(HashMap<String, String> map, String prefix) { this.setParamSimple(map, prefix + "WorkflowName", this.WorkflowName); this.setParamObj(map, prefix + "Trigger.", this.Trigger); this.setParamObj(map, prefix + "OutputStorage.", this.OutputStorage); this.setParamSimple(map, prefix + "OutputDir", this.OutputDir); this.setParamObj(map, prefix + "MediaProcessTask.", this.MediaProcessTask); this.setParamObj(map, prefix + "TaskNotifyConfig.", this.TaskNotifyConfig); this.setParamSimple(map, prefix + "TaskPriority", this.TaskPriority); } }
075ac6c8d1360e5f653178c0ccd3055d43fd8074
21dab2dfee925a42b2a1fa36055158cbb05b5a58
/src/test/java/stepDefinations/Hooks.java
4431021e49c859d79a548d27d7d4dcd6538b6238
[]
no_license
AMEET3/class
bc76cba9dbce8c6230d02a3926e2d31be97441b0
805f20362bd326a47cca784ff9e4df32dd4534ad
refs/heads/master
2023-07-09T15:52:09.551059
2023-06-29T11:00:15
2023-06-29T11:00:15
94,319,760
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package stepDefinations; import java.io.IOException; import io.cucumber.java.Before; public class Hooks { @Before("@DeletePlace") public void beforeScenario() throws IOException { //execute this code only when place id is null //write a code that will give you place id StepDefination m =new StepDefination(); if(StepDefination.place_id==null) { m.add_Place_Payload_with("Shetty", "French", "Asia"); m.user_calls_with_http_request("AddPlaceAPI", "POST"); m.verify_place_Id_created_maps_to_using("Shetty", "getPlaceAPI"); } } }
3194f5e2b246e2703ba5721f480b8496e554d494
a3bf5252382ac42b0d88eb35aea616fef9e88862
/branches/non-determinism-sync/src/main/java/ujf/verimag/bip/java/api/Compound.java
72e3f6f27e9d32c5b4a89d1969d9c45cec9d7efc
[]
no_license
mohamadjaber/java-based-bip
f802ad8232321065588a28a5715a3c44c072781b
11403032cd3cc650f7e07a4be53b24997a596404
refs/heads/master
2021-08-07T23:52:04.818734
2014-02-13T21:04:41
2014-02-13T21:04:41
110,073,792
0
0
null
null
null
null
UTF-8
Java
false
false
845
java
package ujf.verimag.bip.java.api; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class Compound { private Set<BaseComponent> baseComponents; private Set<SyncComponent> syncComponents; private Map<ReceivePort, SendPort> connections; public Compound() { baseComponents = new HashSet<BaseComponent>(); syncComponents = new HashSet<SyncComponent>(); connections = new HashMap<ReceivePort, SendPort>(); } public Set<BaseComponent> getBaseComponents() { return baseComponents; } public Set<SyncComponent> getSyncComponents() { return syncComponents; } public Map<ReceivePort, SendPort> getConnections() { return connections; } public void resetSyncComponents() { for(SyncComponent syncComponent: syncComponents) { syncComponent.reset(); } } }
[ "jaberm@sysadmin-Latitude-E6520.(none)" ]
jaberm@sysadmin-Latitude-E6520.(none)
b86f059f1c1afbf722a0a3e2c1eaa19c35c8e73a
96765527cdbfede7afdb318eaa0bfa6be13d11b8
/app/src/androidTest/java/com/yotto/databasedemo/ExampleInstrumentedTest.java
d571376d8d89e0b66cdbc21fce84fced3cccc5e9
[]
no_license
bipraroy/DatabaseDemo
83d71af6d08cd732e57cedeb901b18b570c7ed91
2c3332266b26dd9bb70546bb3c191d0bfca6ca05
refs/heads/master
2021-01-13T13:55:41.697265
2017-01-18T13:46:42
2017-01-18T13:46:42
79,224,993
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.yotto.databasedemo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.yotto.databasedemo", appContext.getPackageName()); } }
fdae70a2ed0f9160f502fb0540569c139ce3b664
719ca5124cda565c2e6ce68f8ed91f640e34597e
/src/main/java/com/zamir/bike/controllers/BikeController.java
52b879467bebf861cade7886ee6037b0ab29e7fc
[]
no_license
zeeman0306/Bike-Project
a379429b1c3b0260659dd3616fed4ffc7ce28678
5a4b78762575f65b5fd6dee81a40d80fb75dc32e
refs/heads/master
2020-03-27T01:39:27.595421
2018-08-22T16:01:02
2018-08-22T16:01:02
145,730,875
0
0
null
null
null
null
UTF-8
Java
false
false
1,234
java
package com.zamir.bike.controllers; import java.util.List; import com.zamir.bike.repositories.BikeRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.zamir.bike.models.Bike; @RestController @RequestMapping("/api/v1/bikes") public class BikeController { @Autowired private BikeRepository bikeRepository; @GetMapping public List<Bike> list() { return bikeRepository.findAll(); } @PostMapping @ResponseStatus(HttpStatus.OK) public void create(@RequestBody Bike bike) { System.out.println(bike.getName()); bikeRepository.save(bike); } @GetMapping("/{id}") public Bike get(@PathVariable("id") long id) { return bikeRepository.getOne(id); } }
f6d40a7befd3a91476fedf73c6b0f8866e12c939
2a5e634b6f8b37997d99fb07688a60f9858f2868
/src/chapter1/character/WeaponBehavior.java
a2a73f83031272e7ba3f7f8be35bed23b5a9f0d5
[]
no_license
liukepeng/HeadFirstDesignPatterns
adfc488c0a4eaa6c3220790036f291f862f5dfae
8cdbeba8683173ff091c1dd954f2a83fc405c01d
refs/heads/master
2020-04-08T15:10:45.773898
2018-12-21T03:27:07
2018-12-21T03:27:07
159,468,844
1
0
null
null
null
null
UTF-8
Java
false
false
87
java
package chapter1.character; public interface WeaponBehavior { void useWeapon(); }
dff514b90e2d5fa32ac4aeb368e907af801c74d6
99dd39255b843c0cf21fe3cc367276afd37a3e43
/lib/src/main/java/io/github/hotstu/jsbridge/interact/ResponseCode.java
54b5126ecf94fb0c104e3d91bd91aea2d7d8efc5
[]
no_license
hotstu/JsBridge
1755f8c4d67f8b61e68c8bd059e100a074d6cc96
0cbdf35294c7bf82db4de8519c95ea1abb49ac8c
refs/heads/master
2023-06-16T07:10:30.434177
2021-06-30T02:29:51
2021-06-30T02:29:51
378,076,868
0
0
null
null
null
null
UTF-8
Java
false
false
954
java
/* * Copyright (c) 2018 hglf * * 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 io.github.hotstu.jsbridge.interact; /** * NIMJsBridge 错误码 * <p> * Created by huangjun on 2016/10/18. */ public interface ResponseCode { /** * 成功 */ int RES_SUCCESS = 200; /** * 目标不存在 */ int RES_TARGET_NOT_EXIST = 404; /** * 参数错误 */ int RES_PARAM_INVALID = 414; }
55fc703b52888cd05029edb6ab72b7e2303d57df
ff8c1d6e213f90d04f45dcde109a9ce398d1713a
/src/main/java/com/machworks/weightbacklog/service/SecurityService.java
123d0628d844c4c2fd0064907b1df27f257f1c77
[]
no_license
amachimura/weightbacklog
149ac70cf9b5064cb585d2df707e9970bd02f45d
a02b6b9aac3be9b65c879abff081261e9e702cd9
refs/heads/master
2021-05-29T09:50:55.330860
2015-08-24T05:09:07
2015-08-24T05:09:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,083
java
package com.machworks.weightbacklog.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.machworks.weightbacklog.dao.UserRepository; import com.machworks.weightbacklog.dto.UserDto; import com.machworks.weightbacklog.entity.User; @Component public class SecurityService implements SecurityServiceSpec{ @Autowired private UserRepository userRepo; @Override public boolean isExistUser(UserDto user) { return 1 <= userRepo.countByUserName(user.getUserName()); } @Override public boolean isValidPass(UserDto user){ String storedPass = userRepo.findByUserName(user.getUserName()).getPassword(); return user.getPassword().equals(storedPass); } @Override public Long generateId(){ return (long)Math.random()*100000; } @Override public String registerUser(UserDto user) { if(isExistUser(user)){ return "this user is already registered"; } User userForSave = new User(user.getId(),user.getUserName(),user.getPassword()); userRepo.save(userForSave); return "saved!"; } }
81981f6ef8dc212badc6fd6246028bf773488d0a
83d56024094d15f64e07650dd2b606a38d7ec5f1
/Construccion/PROYECTO.SICC/MAE/ENTIDADES/src/es/indra/sicc/entidades/mae/ConfiguracionCamposLocal.java
6221e8b68ec493199e00646d7a1321c8d36f7e60
[]
no_license
cdiglesias/SICC
bdeba6af8f49e8d038ef30b61fcc6371c1083840
72fedb14a03cb4a77f62885bec3226dbbed6a5bb
refs/heads/master
2021-01-19T19:45:14.788800
2016-04-07T16:20:51
2016-04-07T16:20:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,319
java
package es.indra.sicc.entidades.mae; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Column; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import java.io.Serializable; @Entity @Table(name="MAE_CONFI_CAMPO") @NamedQueries({ @NamedQuery(name="ConfiguracionCamposLocal.FindAll", query="SELECT OBJECT(o) FROM ConfiguracionCamposLocal o") }) public class ConfiguracionCamposLocal implements Serializable { public ConfiguracionCamposLocal() {} public ConfiguracionCamposLocal(Long oid, Long pais_oid_pais, Long atre_oid_atri_espe, String val_defe, Long ind_obli, Long ind_modi) { this.oid=oid; this.pais_oid_pais = pais_oid_pais; this.atre_oid_atri_espe = atre_oid_atri_espe; this.val_defe = val_defe; this.ind_obli = ind_obli; this.ind_modi = ind_modi; } @Id @Column(name="OID_CONF_CAMP") private Long oid; @Column(name="PAIS_OID_PAIS") private Long pais_oid_pais; @Column(name="SBTI_OID_SUBT_CLIE") private Long sbti_oid_subt_clie; @Column(name="ATRE_OID_ATRI_ESPE") private Long atre_oid_atri_espe; @Column(name="VAL_DEFE") private String val_defe; @Column(name="IND_OBLI") private Long ind_obli; @Column(name="IND_MODI") private Long ind_modi; public Long getOid() {return oid;} public Long getPrimaryKey() {return oid;} public Long getPais_oid_pais() {return pais_oid_pais;} public void setPais_oid_pais(Long pais_oid_pais){this.pais_oid_pais=pais_oid_pais;} public Long getSbti_oid_subt_clie() {return sbti_oid_subt_clie;} public void setSbti_oid_subt_clie(Long sbti_oid_subt_clie){this.sbti_oid_subt_clie=sbti_oid_subt_clie;} public Long getAtre_oid_atri_espe() {return atre_oid_atri_espe;} public void setAtre_oid_atri_espe(Long atre_oid_atri_espe){this.atre_oid_atri_espe=atre_oid_atri_espe;} public String getVal_defe() {return val_defe;} public void setVal_defe(String val_defe){this.val_defe=val_defe;} public Long getInd_obli() {return ind_obli;} public void setInd_obli(Long ind_obli){this.ind_obli=ind_obli;} public Long getInd_modi() {return ind_modi;} public void setInd_modi(Long ind_modi){this.ind_modi=ind_modi;} }
d2e01552b863a591af8a4a1b0a779b8e7287dd16
09d92c2cf58abc009b8adb940be1e9aefb7ab5cf
/basic-code/day15-code/src/cn/itcast/day15/demo02/Map/Demo01HashMapSavePerson.java
2b08a07d1e529036d789fc43776493021a8a195d
[]
no_license
CLAY-MSG/ideatest
ed93f5ae60394d2e81b743192db9d8301ffd430e
64a5d4698bcb25288878147babe8c372a5fd2c0f
refs/heads/master
2022-12-25T11:00:59.780015
2020-03-18T03:04:06
2020-03-18T03:04:06
248,125,871
0
0
null
2022-12-16T04:25:58
2020-03-18T03:04:06
JavaScript
UTF-8
Java
false
false
2,142
java
package cn.itcast.day15.demo02.Map; import java.util.HashMap; import java.util.Map; import java.util.Set; /* HashMap存储自定义类型键值 Map集合保证key是唯一的: 作为key的元素,必须重写hashCode方法和equals方法,以保证key唯一 */ public class Demo01HashMapSavePerson { public static void main(String[] args) { show02(); } /* HashMap存储自定义类型键值 key:Person类型 Person类就必须重写hashCode方法和equals方法,以保证key唯一 value:String类型 可以重复 */ private static void show02() { //创建HashMap集合 HashMap<Person,String> map = new HashMap<>(); //往集合中添加元素 map.put(new Person("女王",18),"英国"); map.put(new Person("秦始皇",18),"秦国"); map.put(new Person("普京",30),"俄罗斯"); map.put(new Person("女王",18),"毛里求斯"); //使用entrySet和增强for遍历Map集合 Set<Map.Entry<Person, String>> set = map.entrySet(); for (Map.Entry<Person, String> entry : set) { Person key = entry.getKey(); String value = entry.getValue(); System.out.println(key+"-->"+value); } } /* HashMap存储自定义类型键值 key:String类型 String类重写hashCode方法和equals方法,可以保证key唯一 value:Person类型 value可以重复(同名同年龄的人视为同一个) */ private static void show01() { //创建HashMap集合 HashMap<String,Person> map = new HashMap<>(); //往集合中添加元素 map.put("北京",new Person("张三",18)); map.put("上海",new Person("李四",19)); map.put("广州",new Person("王五",20)); map.put("北京",new Person("赵六",18)); //使用keySet加增强for遍历Map集合 Set<String> set = map.keySet(); for (String key : set) { Person value = map.get(key); System.out.println(key+"-->"+value); } } }
993ae47db167a2e00dc51a260a4262f01f1eaada
c9f8dfa5ad2459ef811704b17c2366f5ba14f4aa
/src/test/java/unit/devices/tdk_lambda_power_supply/Reset.java
e7566ad6a3e99fe2e9c70d1bcec3b6ba43acfe1b
[ "MIT" ]
permissive
OmicronProject/BakeoutController
94080a04440ba9caf7b9a8eeeb8875b0b56238ff
c6de4c4ee3c5a75594f9d031b319eec14a2af4c8
refs/heads/master
2021-01-11T02:25:08.507940
2017-02-06T18:32:45
2017-02-06T18:32:45
70,941,163
0
2
null
2017-02-06T18:32:46
2016-10-14T19:29:40
Java
UTF-8
Java
false
false
459
java
package unit.devices.tdk_lambda_power_supply; import devices.PowerSupply; import devices.TDKLambdaPowerSupply; import org.junit.Test; import java.io.IOException; /** * Contains unit tests for {@link TDKLambdaPowerSupply#reset()} */ public final class Reset extends TDKLambdaPowerSupplyTestCase { @Test public void testReset() throws IOException { this.powerSupply.reset(); assertCorrectMessage(PowerSupply.RESET_COMMAND); } }
cee186123a41541973c939711a7313a5df349617
4b18122559ccc6c1c7d68f0f52620ed6cb86f77a
/app/src/main/java/com/example/dr_benigno_aldana_mobile_application/ExampleDialog_2.java
719dada87949f2d5ce0dcbd65e0ed82e238e59d8
[]
no_license
mostafijur566/Class_room
13fec505fc72c7c03c9c6aaee1870c87a96364eb
3bb1de0128a63f704529080fd909cea1f2272392
refs/heads/main
2023-08-28T00:02:16.437825
2021-11-01T17:46:22
2021-11-01T17:46:22
420,613,585
0
0
null
null
null
null
UTF-8
Java
false
false
2,911
java
package com.example.dr_benigno_aldana_mobile_application; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatDialogFragment; public class ExampleDialog_2 extends AppCompatDialogFragment { private EditText dialog_class_name, dialog_section, dialog_subject, dialog_room, dialog_code; private ExampleDialog2Listener listener; @Override public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.layout_dialog_2, null); builder.setView(view) .setTitle("Create Class") .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setPositiveButton("Create Class", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String class_name = dialog_class_name.getText().toString().trim(); String class_section = dialog_section.getText().toString().trim(); String class_subject = dialog_subject.getText().toString().trim(); String class_room = dialog_room.getText().toString().trim(); String class_code = dialog_code.getText().toString().trim(); listener.applyTexts(class_name, class_section, class_subject, class_room, class_code); } }); dialog_class_name = view.findViewById(R.id.dialog_class_name); dialog_section = view.findViewById(R.id.dialog_section); dialog_subject = view.findViewById(R.id.dialog_subject); dialog_room = view.findViewById(R.id.dialog_room); dialog_code = view.findViewById(R.id.dialog_code); return builder.create(); } @Override public void onAttach(@NonNull Context context) { super.onAttach(context); try { listener = (ExampleDialog2Listener) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + "must implement ExampleDialog2Listener"); } } public interface ExampleDialog2Listener{ void applyTexts(String name, String section, String subject, String room, String code); } }
aae3f3dec69f992b9adf0535277d4531e48d6333
00e20ad1f9ce219a2f4694092f14c6ffb7d52b4d
/Java2 Mam/Day8/MyCrudHibernate/src/main/java/com/training/dao/UserDaoImpl.java
2a2ace2e7c318884f9ad91777b1b2baabeadc278
[]
no_license
Dhiraj-Ak/CDac
e8f01c6eb9e145916297da24223d7012b0ed25f7
0b0d9a9d752df2dc1dc19c7051689e65391dc7b6
refs/heads/master
2022-12-20T12:28:13.275798
2019-12-04T08:41:07
2019-12-04T08:41:07
225,768,455
0
0
null
2022-12-16T12:13:51
2019-12-04T03:13:36
Java
UTF-8
Java
false
false
1,455
java
package com.training.dao; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import com.training.dao.*; import com.training.beans.MyUser; public class UserDaoImpl implements UserDao { static SessionFactory sf=null; static { sf=HibernateUtil.getMySessionFactory(); } public List<MyUser> readAll() { Session s=sf.openSession(); Transaction tr=s.beginTransaction(); String sql="from MyUser"; Query q=s.createQuery(sql); List<MyUser> u=q.list(); tr.commit(); s.close(); return u; } public void addUser(MyUser u) { Session s=sf.openSession(); Transaction tr=s.beginTransaction(); s.save(u); tr.commit(); s.close(); } public MyUser readById(int id) { Session s=sf.openSession(); Transaction tr=s.beginTransaction(); MyUser u=(MyUser) s.get(MyUser.class, new Integer(id)); tr.commit(); s.close(); return u; } public void deleteById(int id) { Session s=sf.openSession(); Transaction tr=s.beginTransaction(); MyUser u=(MyUser)s.get(MyUser.class, new Integer(id)); s.delete(u); tr.commit(); s.close(); } public void updateById(int id) { Session s=sf.openSession(); Transaction tr=s.beginTransaction(); MyUser u=(MyUser) s.get(MyUser.class, new Integer(id)); u.setMobile("777"); s.update(u); tr.commit(); s.close(); } }
[ "“[email protected]”" ]
e6aa6e65d938431fe95a9e8cba405384ab7da87b
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/apache/camel/component/mina2/Mina2TcpTextlineDelimiterTest.java
02b0d2ee8f77fc5177c26698ae4f8d81c4a3a8e5
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,413
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.camel.component.mina2; import org.apache.camel.component.mock.MockEndpoint; import org.junit.Test; public class Mina2TcpTextlineDelimiterTest extends BaseMina2Test { @Test public void testMinaRoute() throws Exception { MockEndpoint endpoint = getMockEndpoint("mock:result"); Object body = "Hello there!"; endpoint.expectedBodiesReceived(body); template.sendBodyAndHeader(String.format("mina2:tcp://localhost:%1$s?sync=false&textline=true&textlineDelimiter=UNIX", getPort()), body, "cheese", 123); assertMockEndpointsSatisfied(); } }
ae02fc197e97af53bfdb788888250873a0d46eba
f1ae609ab1660afd02d8a8edc482e6dd5bd3e40f
/Concurrency-Examples/src/main/java/org/concurrency/examples/phaserexample/Thread_1.java
6f2abb8bd54ce8b83175f9046fb9b05311db689f
[]
no_license
akashbgajjar/Data-Structures-Algorithms-Interview-Questions
943e5b7f54df076dc8417a8eb4d5e7231838e91a
bb6f7e8b868edd6cca3284816954bde65ca6ee1c
refs/heads/master
2021-09-09T21:47:12.328958
2018-03-19T22:02:51
2018-03-19T22:02:51
115,738,915
1
1
null
null
null
null
UTF-8
Java
false
false
787
java
package org.concurrency.examples.phaserexample; import java.util.concurrent.Phaser; /** * * @author Akash Gajjar * */ public class Thread_1 extends AbstractRunnable{ private final long timeout = 1000L; public Thread_1(Phaser phaser){ super(phaser); } @Override public void execute() { try{ System.out.println("Thread_1 waiting for " + timeout + " ms"); Thread.sleep(timeout); Thread_4 thread_4 = new Thread_4(phaser); Thread thread = new Thread(thread_4); thread.start(); Thread_5 thread_5 = new Thread_5(phaser); Thread _thread = new Thread(thread_5); _thread.start(); this.phaser.arriveAndAwaitAdvance(); }catch(Exception e){ e.printStackTrace(); }finally{ System.out.println("Thread_1 party arrived"); } } }
22eb10e7958b052ff934124caa3a7dac8214540c
0efaecc118da82df1dfb27997723be7ce40e09e3
/backend/customerApp/src/main/java/com/spring2020/customerapp/domain/entity/Customer.java
2346fe5e8490d406bd7dc9fb7a743878857cd64b
[]
no_license
jinisminho/canteenshop
cbe714ceedb651738bb26389e4f83ba15ec26d03
79c05cc55f34ded3d094fee52e5bc9ac5b02fa40
refs/heads/master
2023-02-05T05:51:02.658613
2020-10-19T13:13:54
2020-10-19T13:13:54
235,277,454
0
3
null
2023-01-25T00:02:23
2020-01-21T07:10:33
JavaScript
UTF-8
Java
false
false
511
java
package com.spring2020.customerapp.domain.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Entity @Table(name = "Customer") public class Customer extends Audit { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "app_user_id") private AppUser appUser; }
05f4540a0c81299a7b07924e4f83deb2c404196d
f1612455d4c766ddf7b9407d5504325825ff6663
/Core Java/student-app/src/com/techlabs/student/test/TestStudentCsvstore.java
0469a24ef99aec397244b668fb1c06c5165e1ecc
[]
no_license
akashh1/Swabhav-Techlabs
0b95852b20acac343551fcd3747c39aec8c4a427
cb6cf67f6808f68c4199ed19477c9ed496c44fd0
refs/heads/master
2021-12-10T07:52:12.187674
2021-09-16T10:36:29
2021-09-16T10:36:29
125,467,540
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package com.techlabs.student.test; import java.util.ArrayList; import com.techlabs.student.Student; import com.techlabs.student.StudentCsvStore; public class TestStudentCsvstore { public static void main(String[] args) { StudentCsvStore studentcsv = new StudentCsvStore(); studentcsv.add(new Student("Akash","Malaviya","Ahmedabad")); print(studentcsv.get()); } private static void print(ArrayList<Student> students) { for (Student student : students) { System.out.println("Student Id:" + student.getId()); System.out.println("Student Name:" + student.getFirstName()+ " " +student.getLastName()); System.out.println("Student Address:" + student.getAddress() + "\n"); } } }
0d923dcbfe55328ef41d250c6bc7f55bac4c2ea7
842dac361328188624a398092a03254c79ac5d52
/src/Banco_Dados/DbIntegrityException.java
7fad314ebb61cb786be4da5f7e5bc86006af98df
[]
no_license
GabsLopes055/demo-dao-jdbc
d841a7664f8e780a1bb3d6866ed1a014bf370c91
2fb52f78af85d6bce4d95d314ee86fcb37039065
refs/heads/master
2020-11-26T02:45:58.211187
2019-12-19T00:53:07
2019-12-19T00:53:07
228,941,963
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package Banco_Dados; /** * @author Gabriel Lopes * */ public class DbIntegrityException extends RuntimeException { private static final long serialVersionUID = 1L; public DbIntegrityException(String msg) { super(msg); } }
3c8f3f60fbd7ac9649761e1e6a122b9752157aba
cb2e26e745c1febd096e7e9a029996cfa4327972
/app/src/main/java/com/example/blogger/models/PostsModel.java
93ad038f9321ed1dae0384461a21f01e88af8558
[]
no_license
Whiz75/Blogger-app
9ea202966a3418bb2bd1ca4aa99947c5cb6b87b6
29bbe8da3e3391acb77906f4e1893e3469341191
refs/heads/master
2023-07-14T16:38:24.455780
2021-08-18T00:00:32
2021-08-18T00:00:32
368,714,114
0
0
null
null
null
null
UTF-8
Java
false
false
1,831
java
package com.example.blogger.models; public class PostsModel { private String url, image_thumb, desc,user_id; private String author, profile_pic; private String timeStamp, id; public PostsModel() { } public PostsModel(String image_url, String image_thumb, String desc, String user_id, String timeStamp, String author, String profile_pic, String key) { this.url = image_url; this.image_thumb = image_thumb; this.desc = desc; this.user_id = user_id; this.timeStamp = timeStamp; //author this.author = author; this.profile_pic = profile_pic; this.id = key; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getImage_thumb() { return image_thumb; } public void setImage_thumb(String image_thumb) { this.image_thumb = image_thumb; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getTimeStamp() { return timeStamp; } public void setTimeStamp(String timeStamp) { this.timeStamp = timeStamp; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getProfile_pic() { return profile_pic; } public void setProfile_pic(String profile_pic) { this.profile_pic = profile_pic; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
2145d31d1b055d6fb91ee63ff18f43002fd4c88a
1e3e1aacdbe69e1f79cd408a96198a860c9dcf0f
/Repositorio/src/dto/JugadorDTO.java
8aff1765cf3d67aaa1600aa793219ee130e93df2
[]
no_license
gaborodri81/TP_distribuidas
83f47f5c808d7e6b06bdbca2db47dc4cb481e5a8
355a395061e05bc9fcd7065b6781cfdb07fe46bf
refs/heads/master
2020-03-30T05:28:29.088223
2018-11-12T23:20:30
2018-11-12T23:20:30
150,801,106
0
0
null
null
null
null
UTF-8
Java
false
false
2,502
java
package dto; import java.io.Serializable; import java.util.Collection; public class JugadorDTO implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private int id_jugador; private String nickname; private String mail; private String password; private CategoriaDTO categoria; private boolean mano; private boolean estado; private int puntos; private int partidasJugadas; private int partidasGanadas; private Collection<CartaDTO> cartas; private Collection<CartaDTO> cartasjugadas; private CartaDTO cartaActual; public int getId_jugador() { return id_jugador; } public void setId_jugador(int id_jugador) { this.id_jugador = id_jugador; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getMail() { return mail; } public void setMail(String mail) { this.mail = mail; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public CategoriaDTO getCategoria() { return categoria; } public void setCategoria(CategoriaDTO categoria) { this.categoria = categoria; } public boolean isMano() { return mano; } public void setMano(boolean mano) { this.mano = mano; } public boolean isEstado() { return estado; } public void setEstado(boolean estado) { this.estado = estado; } public int getPuntos() { return puntos; } public void setPuntos(int puntos) { this.puntos = puntos; } public int getPartidasJugadas() { return partidasJugadas; } public void setPartidasJugadas(int partidasJugadas) { this.partidasJugadas = partidasJugadas; } public int getPartidasGanadas() { return partidasGanadas; } public void setPartidasGanadas(int partidasGanadas) { this.partidasGanadas = partidasGanadas; } public Collection<CartaDTO> getCartas() { return cartas; } public void setCartas(Collection<CartaDTO> cartas) { this.cartas = cartas; } public Collection<CartaDTO> getCartasjugadas() { return cartasjugadas; } public void setCartasjugadas(Collection<CartaDTO> cartasjugadas) { this.cartasjugadas = cartasjugadas; } public CartaDTO getCartaActual() { return cartaActual; } public void setCartaActual(CartaDTO cartaActual) { this.cartaActual = cartaActual; } }
fabc93435fb87e027c2e68994c583a9ed6b214df
fa7c99383f89049d3226ef2df636aa26f664cda2
/app/src/main/java/com/nfc/electronicseal/util/ThreadPoolDo.java
2e47999d55d78efed0af7ecd3bdab963b768937c
[]
no_license
343702729/ElectronicSeal
f0f15d6198d4e6bc6ca9a9fa947b340523e2d395
b8248f10fc2a6dbf3e719c157e6adea98721d8d3
refs/heads/master
2020-05-15T03:38:15.021717
2019-10-25T12:28:36
2019-10-25T12:28:36
182,070,216
3
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.nfc.electronicseal.util; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** * @author: caoli * @CreateDate: 2016-7-13 * @Description: 线程池 */ public class ThreadPoolDo { private static ThreadPoolDo mThreadPoolDo; private ThreadPoolExecutor threadPool = null; private ThreadPoolDo(){ threadPool = new ThreadPoolExecutor(4, 10, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); } public static ThreadPoolDo getInstance(){ if(mThreadPoolDo==null) mThreadPoolDo = new ThreadPoolDo(); return mThreadPoolDo; } public void executeThread(Thread thread){ threadPool.execute(thread); } }
5758a26ca8ea06f671d790da56b1ff3e1a7af7bb
ec83d3e28f8464056fc093b8e5c790fc86781467
/万绘网Angular2+SSM/ssm-sboo-Test/src/main/java/com/whw/ssmsboot/controller/PhotoFindController.java
c7e903a6acea9383398881fe637f7c86ce82042c
[]
no_license
lzhanforgit/Project-source-code
f4d294bcc979932ec2c27098452b113b55006b6a
b0a42000c0e0a660b5614f5bf35eb63deb199ad2
refs/heads/master
2020-05-02T02:04:47.665596
2019-03-26T02:54:48
2019-03-26T02:54:48
177,697,415
9
5
null
null
null
null
UTF-8
Java
false
false
1,674
java
package com.whw.ssmsboot.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.json.MappingJackson2JsonView; import com.whw.ssmsboot.constant.Constant; import com.whw.ssmsboot.serivce.PhotoFindService; @Controller @RequestMapping(value = "photofind") public class PhotoFindController { @Autowired private PhotoFindService photoFindService; /** * 删除作品 * * @param photoUserId * @return */ @RequestMapping(value = "deletePhoto", method = RequestMethod.POST) public ModelAndView deletePhoto(Integer photoUserId,Integer photoId) { try { return new ModelAndView(new MappingJackson2JsonView()).addObject("updateNum",photoFindService.deletePhoto(photoUserId, photoId)) .addObject("resultCode", Constant.STATUS_CODE_1); }catch (Exception e) { return new ModelAndView(new MappingJackson2JsonView()).addObject("resultCode", Constant.STATUS_CODE_2); } } @RequestMapping(value = "findPhoto", method = RequestMethod.POST) public ModelAndView findPhoto(Integer photoUserId) { try { return new ModelAndView(new MappingJackson2JsonView()).addObject("upPhoto",photoFindService.findPhoto(photoUserId)) .addObject("resultCode", Constant.STATUS_CODE_1); } catch (Exception e) { System.out.println(e.getMessage()); return new ModelAndView(new MappingJackson2JsonView()).addObject("resultCode", Constant.STATUS_CODE_2); } } }
1cb3b9e7359ac98a902b4df164087cf349572367
8a6453cd49949798c11f57462d3f64a1fa2fc441
/aws-java-sdk-kinesisanalyticsv2/src/main/java/com/amazonaws/services/kinesisanalyticsv2/model/transform/SourceSchemaMarshaller.java
94d58db24f10675d449ee9eb6d711f77387a3962
[ "Apache-2.0" ]
permissive
tedyu/aws-sdk-java
138837a2be45ecb73c14c0d1b5b021e7470520e1
c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8
refs/heads/master
2020-04-14T14:17:28.985045
2019-01-02T21:46:53
2019-01-02T21:46:53
163,892,339
0
0
Apache-2.0
2019-01-02T21:38:39
2019-01-02T21:38:39
null
UTF-8
Java
false
false
2,640
java
/* * Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.kinesisanalyticsv2.model.transform; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.kinesisanalyticsv2.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * SourceSchemaMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class SourceSchemaMarshaller { private static final MarshallingInfo<StructuredPojo> RECORDFORMAT_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("RecordFormat").build(); private static final MarshallingInfo<String> RECORDENCODING_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("RecordEncoding").build(); private static final MarshallingInfo<List> RECORDCOLUMNS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("RecordColumns").build(); private static final SourceSchemaMarshaller instance = new SourceSchemaMarshaller(); public static SourceSchemaMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(SourceSchema sourceSchema, ProtocolMarshaller protocolMarshaller) { if (sourceSchema == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sourceSchema.getRecordFormat(), RECORDFORMAT_BINDING); protocolMarshaller.marshall(sourceSchema.getRecordEncoding(), RECORDENCODING_BINDING); protocolMarshaller.marshall(sourceSchema.getRecordColumns(), RECORDCOLUMNS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
0613ccf7873b1b26a9c3b9fc0d7e711f3bd02aea
da2913ee1c26e3166214be6d006ad18d219f3b62
/88.java
94a3ab7fa78f36f4b360c776ec7778c6869669f6
[]
no_license
viswasri007/set9
d6a8d2cbef6692fd0b7951628fac1e9fa299c232
996b7c3156960fdf260d7ef25d5d8d807e56817d
refs/heads/master
2020-03-27T02:33:34.640946
2018-08-23T04:48:44
2018-08-23T04:48:44
145,798,923
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
import java.util.*; import java.lang.*; import java.io.*; class Guvi { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int n=s.nextInt(); int m=s.nextInt();int t=1; if(n==1 && m==1) { System.out.println(n); } else { for(int i=1;i<=m*n;i++) { if(i%n==0 && i%m==0) { System.out.println(i); break; } } } } }
4d5c56b36daaa5988bf0f79e627faf946556ea5f
21d423e119e9ff9b1d5070d3b718f7ffefbdbf43
/maven-native-1.0-alpha-7/native-maven-plugin/src/test/java/org/codehaus/mojo/natives/plugin/NativeLinkerMojoTest.java
525d56289943aaf72b078cf7245d8dfef42e7c61
[ "MIT" ]
permissive
pdmack/maven-native
381da0bb183ce27227bdcd206ef90f9725b2819d
c24e62fe636d20b8fb75d8db31ba2b135847ca04
refs/heads/master
2021-01-22T07:39:09.716240
2013-04-01T14:02:41
2013-04-01T14:02:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,489
java
package org.codehaus.mojo.natives.plugin; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DefaultArtifact; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.DefaultArtifactHandler; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.codehaus.mojo.natives.linker.LinkerConfiguration; public class NativeLinkerMojoTest extends AbstractMojoTestCase { public void testMojoLookup() throws Exception { File pluginXml = new File( getBasedir(), "src/test/resources/linker/plugin-config.xml" ); NativeLinkMojo mojo = (NativeLinkMojo) lookupMojo( "link", pluginXml ); assertNotNull( mojo ); } public void testExecute() throws Exception { File pluginXml = new File( getBasedir(), "src/test/resources/linker/plugin-config.xml" ); NativeLinkMojo mojo = (NativeLinkMojo) lookupMojo( "link", pluginXml ); assertNotNull( mojo ); //must init this mojo.setPluginContext( new HashMap() ); //simulate object files List objectList = new ArrayList(); objectList.add( new File( "o1.o" ) ); objectList.add( new File( "o2.o" ) ); mojo.saveCompilerOutputFilePaths( objectList ); //simulate artifact ArtifactHandler artifactHandler = new DefaultArtifactHandler(); Artifact artifact = new DefaultArtifact( "test", "test", VersionRange.createFromVersion( "1.0-SNAPSHOT" ), "compile", "exe", null, artifactHandler ); mojo.getProject().setArtifact( artifact ); //simulate artifacts mojo.getProject().setArtifacts( new HashSet() ); //no extern libs for now mojo.execute(); LinkerConfiguration conf = mojo.getLgetLinkerConfiguration(); //"target is set in the stub assertEquals( new File( "target" ), conf.getOutputDirectory() ); assertEquals( "some-final-name", conf.getOutputFileName() ); //current artifactHandler mocking return null extension name assertEquals( new File( "target/some-final-name.null" ), conf.getOutputFile() ); } }
68fde04cd5a9546bb682f04f477f03a108d4ce2e
144c99466cfb085f2015ec2dc2e67c54f1af1443
/guyue-hive-source/src/main/java/org/apache/hadoop/hive/ql/exec/vector/expressions/gen/IntervalDayTimeColAddDateScalar.java
cf5cf1736efe034d39f897004a8c4a3d5d264e5f
[]
no_license
guyuetftb/guyue-parents
8c999c9ee510c141f4ddf31ee98d74e00d9287c7
d15bd256e70c10819f86d018d7a3e7cc5c513005
refs/heads/master
2023-05-24T08:18:48.921990
2023-05-15T03:03:42
2023-05-15T03:03:42
132,435,187
3
3
null
2022-11-16T08:28:50
2018-05-07T09:05:27
Java
UTF-8
Java
false
false
5,506
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.hadoop.hive.ql.exec.vector.expressions.gen; import java.sql.Timestamp; import org.apache.hadoop.hive.common.type.HiveIntervalDayTime; import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorExpression; import org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector; import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; import org.apache.hadoop.hive.ql.exec.vector.expressions.NullUtil; import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor; import org.apache.hadoop.hive.ql.exec.vector.*; import org.apache.hadoop.hive.ql.util.DateTimeMath; import org.apache.hadoop.hive.serde2.io.DateWritable; /** * Generated from template TimestampColumnArithmeticDateScalar.txt, which covers binary arithmetic * expressions between a column and a scalar. */ public class IntervalDayTimeColAddDateScalar extends VectorExpression { private static final long serialVersionUID = 1L; private int colNum; private Timestamp value; private int outputColumn; private DateTimeMath dtm = new DateTimeMath(); public IntervalDayTimeColAddDateScalar(int colNum, long value, int outputColumn) { this.colNum = colNum; this.value = new Timestamp(0); this.value.setTime(DateWritable.daysToMillis((int) value)); this.outputColumn = outputColumn; } public IntervalDayTimeColAddDateScalar() { } @Override public void evaluate(VectorizedRowBatch batch) { if (childExpressions != null) { super.evaluateChildren(batch); } // Input #1 is type interval_day_time. IntervalDayTimeColumnVector inputColVector1 = (IntervalDayTimeColumnVector) batch.cols[colNum]; // Output is type timestamp. TimestampColumnVector outputColVector = (TimestampColumnVector) batch.cols[outputColumn]; int[] sel = batch.selected; boolean[] inputIsNull = inputColVector1.isNull; boolean[] outputIsNull = outputColVector.isNull; outputColVector.noNulls = inputColVector1.noNulls; outputColVector.isRepeating = inputColVector1.isRepeating; int n = batch.size; // return immediately if batch is empty if (n == 0) { return; } if (inputColVector1.isRepeating) { dtm.add( inputColVector1.asScratchIntervalDayTime(0), value, outputColVector.getScratchTimestamp()); outputColVector.setFromScratchTimestamp(0); // Even if there are no nulls, we always copy over entry 0. Simplifies code. outputIsNull[0] = inputIsNull[0]; } else if (inputColVector1.noNulls) { if (batch.selectedInUse) { for(int j = 0; j != n; j++) { int i = sel[j]; dtm.add( inputColVector1.asScratchIntervalDayTime(i), value, outputColVector.getScratchTimestamp()); outputColVector.setFromScratchTimestamp(i); } } else { for(int i = 0; i != n; i++) { dtm.add( inputColVector1.asScratchIntervalDayTime(i), value, outputColVector.getScratchTimestamp()); outputColVector.setFromScratchTimestamp(i); } } } else /* there are nulls */ { if (batch.selectedInUse) { for(int j = 0; j != n; j++) { int i = sel[j]; dtm.add( inputColVector1.asScratchIntervalDayTime(i), value, outputColVector.getScratchTimestamp()); outputColVector.setFromScratchTimestamp(i); outputIsNull[i] = inputIsNull[i]; } } else { for(int i = 0; i != n; i++) { dtm.add( inputColVector1.asScratchIntervalDayTime(i), value, outputColVector.getScratchTimestamp()); outputColVector.setFromScratchTimestamp(i); } System.arraycopy(inputIsNull, 0, outputIsNull, 0, n); } } NullUtil.setNullOutputEntriesColScalar(outputColVector, batch.selectedInUse, sel, n); } @Override public int getOutputColumn() { return outputColumn; } @Override public String getOutputType() { return "timestamp"; } @Override public String vectorExpressionParameters() { return "col " + colNum + ", val " + value.toString(); } @Override public VectorExpressionDescriptor.Descriptor getDescriptor() { return (new VectorExpressionDescriptor.Builder()) .setMode( VectorExpressionDescriptor.Mode.PROJECTION) .setNumArguments(2) .setArgumentTypes( VectorExpressionDescriptor.ArgumentType.getType("interval_day_time"), VectorExpressionDescriptor.ArgumentType.getType("date")) .setInputExpressionTypes( VectorExpressionDescriptor.InputExpressionType.COLUMN, VectorExpressionDescriptor.InputExpressionType.SCALAR).build(); } }
fcaefd0e426c48a5b47e2fcaf70cf0b2cbc22bb2
cd25c9d0f5e3ed3e73b7044530ec5f51463695c6
/financas/src/br/com/caelum/financas/teste/TesteJPA.java
c6ea696f90a008a1785854c99f9ba37341314b14
[]
no_license
dposs/Alura
149fa021cbb288f825ec8a7e876239508d6f3226
64f7c2befed27f944a7b4335e9ec78a1ab85ff94
refs/heads/master
2021-01-19T13:47:19.648623
2017-05-27T02:31:26
2017-05-27T02:31:26
88,109,774
0
0
null
null
null
null
UTF-8
Java
false
false
1,630
java
package br.com.caelum.financas.teste; import javax.persistence.EntityManager; import br.com.caelum.financas.modelo.Conta; import br.com.caelum.financas.util.JPAUtil; public class TesteJPA { public static void main(String[] args) { double inicio = System.currentTimeMillis(); // Detached Conta contaDetached = new Conta(); contaDetached.setId(9); contaDetached.setTitular("Daniel Possamai"); contaDetached.setBanco("Bradesco"); contaDetached.setNumero("00478113"); contaDetached.setAgencia("175"); // Transient Conta contaTransient = new Conta(); contaTransient.setTitular("Daniel Possamai"); contaTransient.setBanco("Bradesco"); contaTransient.setNumero("00478113"); contaTransient.setAgencia("175"); EntityManager entityManager = new JPAUtil().getEntityManager(); entityManager.getTransaction().begin(); // Managed Conta contaManaged = entityManager.find(Conta.class, 9); // Entire object (with sql select) contaManaged = entityManager.getReference(Conta.class, 9); // Only id object (without sql select) entityManager.persist(contaTransient); contaDetached.setTitular("Daniel 1"); contaDetached.setTitular("Daniel 3"); contaDetached = entityManager.merge(contaDetached); // Removed entityManager.remove(contaManaged); entityManager.remove(contaTransient); entityManager.remove(contaDetached); entityManager.getTransaction().commit(); entityManager.close(); double fim = System.currentTimeMillis(); System.out.println("Executado em: " + (fim - inicio)/1000 + "s"); } }
ba3293ddb62de9ee386b2bdba0858b3cf7bc34af
46be947ffa404f0f1f56991f0c433aa17b559cf7
/CSCI 132/Node.java
77331859b3f1e52c16202a0e2fb8ab8609e09b0b
[]
no_license
nfaith/CSCI-132
6b9226b74070108b0366eda1c0d9eafbaaa92f88
189e73b5db1248b967509f27052e0bd90d3c72a9
refs/heads/master
2022-04-29T07:01:00.596802
2022-04-22T18:58:10
2022-04-22T18:58:10
223,637,518
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
/* basically just c+p from the inlab */ public class Node { private int pol; private Node next; private Node previous; public Node (int pol) { this.pol = pol; this.next = next; this.previous = previous; } public void setNext(Node what) { this.next = what; } public void setPrevious(Node what) { this.previous = what; } public int getData() { return pol; } public Node getNext() { return next; } public Node getPrevious() { return previous; } }
5b192c26da52380f43dd3e8133e78659b0b89f0e
895ea02e9fbbbddccd2f550769600608a5ce26bf
/CoreImportExport/src/au/gov/asd/tac/constellation/importexport/delimited/ActionPane.java
67d2206723e07ca448930756d455418b7018e0d2
[ "Apache-2.0" ]
permissive
sol695510/constellation
8e26a739a8ae09755f1ff2061206d13566d8b432
9ab9e0cc3a0bb673204d74d5b017453a882845a0
refs/heads/master
2020-12-19T13:40:11.523350
2020-03-16T22:31:41
2020-03-16T22:31:41
226,787,694
1
0
Apache-2.0
2019-12-20T00:16:47
2019-12-09T04:54:54
null
UTF-8
Java
false
false
2,195
java
/* * Copyright 2010-2019 Australian Signals Directorate * * 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 au.gov.asd.tac.constellation.importexport.delimited; import au.gov.asd.tac.constellation.pluginframework.PluginException; import java.io.IOException; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.control.Button; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; /** * * @author sirius */ public class ActionPane extends BorderPane { private final ImportController importController; public ActionPane(final ImportController importController) { this.importController = importController; HBox runBox = new HBox(); runBox.setSpacing(5); runBox.setPadding(new Insets(5)); setRight(runBox); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { importController.cancelImport(); } }); Button importButton = new Button("Import"); importButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { try { importController.processImport(); } catch (IOException ex) { ex.printStackTrace(); } catch (InterruptedException ex) { } catch (PluginException ex) { } } }); runBox.getChildren().addAll(cancelButton, importButton); } }
418e5288eb70fb14a83d2df5f39b98f654bea56b
3cd63aba77b753d85414b29279a77c0bc251cea9
/main/plugins/org.talend.designer.components.libs/libs_src/salesforceCRMManagement/com/salesforce/soap/partner/DescribeFlexiPageRegion.java
1ac1b35a1f18753d634e5796758030d23522f01a
[ "Apache-2.0" ]
permissive
195858/tdi-studio-se
249bcebb9700c6bbc8905ccef73032942827390d
4fdb5cfb3aeee621eacfaef17882d92d65db42c3
refs/heads/master
2021-04-06T08:56:14.666143
2018-10-01T14:11:28
2018-10-01T14:11:28
124,540,962
1
0
null
2018-10-01T14:11:29
2018-03-09T12:59:25
Java
UTF-8
Java
false
false
21,916
java
/** * DescribeFlexiPageRegion.java * * This file was auto-generated from WSDL by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST) */ package com.salesforce.soap.partner; /** * DescribeFlexiPageRegion bean class */ @SuppressWarnings({ "unchecked", "unused" }) public class DescribeFlexiPageRegion implements org.apache.axis2.databinding.ADBBean { /* * This type was generated from the piece of schema that had name = DescribeFlexiPageRegion Namespace URI = urn:partner.soap.sforce.com * Namespace Prefix = ns1 */ /** * field for Components This was an Array! */ protected com.salesforce.soap.partner.DescribeComponentInstance[] localComponents; /* * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be used to determine * whether to include this field in the serialized XML */ protected boolean localComponentsTracker = false; public boolean isComponentsSpecified() { return localComponentsTracker; } /** * Auto generated getter method * * @return com.salesforce.soap.partner.DescribeComponentInstance[] */ public com.salesforce.soap.partner.DescribeComponentInstance[] getComponents() { return localComponents; } /** * validate the array for Components */ protected void validateComponents(com.salesforce.soap.partner.DescribeComponentInstance[] param) { } /** * Auto generated setter method * * @param param Components */ public void setComponents(com.salesforce.soap.partner.DescribeComponentInstance[] param) { validateComponents(param); localComponentsTracker = param != null; this.localComponents = param; } /** * Auto generated add method for the array for convenience * * @param param com.salesforce.soap.partner.DescribeComponentInstance */ public void addComponents(com.salesforce.soap.partner.DescribeComponentInstance param) { if (localComponents == null) { localComponents = new com.salesforce.soap.partner.DescribeComponentInstance[] {}; } // update the setting tracker localComponentsTracker = true; java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(localComponents); list.add(param); this.localComponents = (com.salesforce.soap.partner.DescribeComponentInstance[]) list .toArray(new com.salesforce.soap.partner.DescribeComponentInstance[list.size()]); } /** * field for Name */ protected java.lang.String localName; /** * Auto generated getter method * * @return java.lang.String */ public java.lang.String getName() { return localName; } /** * Auto generated setter method * * @param param Name */ public void setName(java.lang.String param) { this.localName = param; } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException { org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, parentQName); return factory.createOMElement(dataSource, parentQName); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { serialize(parentQName, xmlWriter, false); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { java.lang.String prefix = null; java.lang.String namespace = null; prefix = parentQName.getPrefix(); namespace = parentQName.getNamespaceURI(); writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter); if (serializeType) { java.lang.String namespacePrefix = registerPrefix(xmlWriter, "urn:partner.soap.sforce.com"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":DescribeFlexiPageRegion", xmlWriter); } else { writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "DescribeFlexiPageRegion", xmlWriter); } } if (localComponentsTracker) { if (localComponents != null) { for (int i = 0; i < localComponents.length; i++) { if (localComponents[i] != null) { localComponents[i].serialize(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "components"), xmlWriter); } else { // we don't have to do any thing since minOccures is zero } } } else { throw new org.apache.axis2.databinding.ADBException("components cannot be null!!"); } } namespace = "urn:partner.soap.sforce.com"; writeStartElement(null, namespace, "name", xmlWriter); if (localName == null) { // write the nil attribute throw new org.apache.axis2.databinding.ADBException("name cannot be null!!"); } else { xmlWriter.writeCharacters(localName); } xmlWriter.writeEndElement(); xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) { if (namespace.equals("urn:partner.soap.sforce.com")) { return "ns1"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * Utility method to write an element start tag. */ private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, localPart); } else { if (namespace.length() == 0) { prefix = ""; } else if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, localPart, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix, java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace, attName, attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace, java.lang.String attName, java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix, namespaceURI); } if (prefix.trim().length() > 0) { stringToWrite.append(prefix).append(":") .append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); while (true) { java.lang.String uri = nsContext.getNamespaceURI(prefix); if (uri == null || uri.length() == 0) { break; } prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList attribList = new java.util.ArrayList(); if (localComponentsTracker) { if (localComponents != null) { for (int i = 0; i < localComponents.length; i++) { if (localComponents[i] != null) { elementList.add(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "components")); elementList.add(localComponents[i]); } else { // nothing to do } } } else { throw new org.apache.axis2.databinding.ADBException("components cannot be null!!"); } } elementList.add(new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name")); if (localName != null) { elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localName)); } else { throw new org.apache.axis2.databinding.ADBException("name cannot be null!!"); } return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray()); } /** * Factory class that keeps the parse method */ public static class Factory { /** * static method to create the object Precondition: If this object is an element, the current or next start element starts this * object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is * at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end * element If this object is a complex type, the reader is positioned at the end element of its outer element */ public static DescribeFlexiPageRegion parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception { DescribeFlexiPageRegion object = new DescribeFlexiPageRegion(); int event; java.lang.String nillableValue = null; java.lang.String prefix = ""; java.lang.String namespaceuri = ""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) { java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"); if (fullTypeName != null) { java.lang.String nsPrefix = null; if (fullTypeName.indexOf(":") > -1) { nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":")); } nsPrefix = nsPrefix == null ? "" : nsPrefix; java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1); if (!"DescribeFlexiPageRegion".equals(type)) { // find namespace for the prefix java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix); return (DescribeFlexiPageRegion) com.salesforce.soap.partner.sobject.ExtensionMapper.getTypeObject( nsUri, type, reader); } } } // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); reader.next(); java.util.ArrayList list1 = new java.util.ArrayList(); while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "components").equals(reader.getName())) { // Process the array and step past its final element's end. list1.add(com.salesforce.soap.partner.DescribeComponentInstance.Factory.parse(reader)); // loop until we find a start element that is not part of this array boolean loopDone1 = false; while (!loopDone1) { // We should be at the end element, but make sure while (!reader.isEndElement()) reader.next(); // Step out of this element reader.next(); // Step to next element event. while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isEndElement()) { // two continuous end elements means we are exiting the xml structure loopDone1 = true; } else { if (new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "components").equals(reader .getName())) { list1.add(com.salesforce.soap.partner.DescribeComponentInstance.Factory.parse(reader)); } else { loopDone1 = true; } } } // call the converter utility to convert and set the array object.setComponents((com.salesforce.soap.partner.DescribeComponentInstance[]) org.apache.axis2.databinding.utils.ConverterUtil .convertToArray(com.salesforce.soap.partner.DescribeComponentInstance.class, list1)); } // End of if for expected property start element else { } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement() && new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "name").equals(reader.getName())) { nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)) { throw new org.apache.axis2.databinding.ADBException("The element: " + "name" + " cannot be null"); } java.lang.String content = reader.getElementText(); object.setName(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content)); reader.next(); } // End of if for expected property start element else { // A start element we are not expecting indicates an invalid parameter was passed throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); if (reader.isStartElement()) // A start element we are not expecting indicates a trailing invalid property throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName()); } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }// end of factory class }
48ca8e3bfba4c9646aa2b3b82a38ec430889f8ff
703ea0087073d959e242349d711f3956acd1bb9e
/ups/bb808/bb808-protocol/src/main/java/allthings/iot/bb808/das/packet/JBT19506Packet.java
2b5e4e90d7ce96161c6fb30e50a3a1cf2af3d351
[ "Apache-2.0" ]
permissive
allthings-vip/iot-platform
dc1e66673f5f211ab2d424d94c0bb0f494da306b
826f80a4b0f72f93da0600b8c3c25483f5e7ce66
refs/heads/master
2023-06-08T04:19:55.498706
2020-10-21T06:12:44
2020-10-21T06:12:44
280,990,097
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
package allthings.iot.bb808.das.packet; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import allthings.iot.bb808.common.JBT19506MsgParam; import allthings.iot.das.util.DateUtil; /** * @author : luhao * @FileName : JBT19506Packet * @CreateDate : 2017/12/21 * @Description : * @ReviewedBy : * @ReviewedOn : * @VersionHistory : * @ModifiedBy : * @ModifiedDate : * @Comments : * @CopyRight : COPYRIGHT(c) allthings-vip All Rights Reserved * ******************************************************************************************* */ public abstract class JBT19506Packet extends AbstractPacket { public JBT19506Packet(String packetId) { super(packetId); } @Override public byte[] pack() { ByteBuf buf = Unpooled.buffer(); long startTime = super.get(JBT19506MsgParam.START_TIME); buf.writeBytes(DateUtil.millisecond2BytesSix(startTime)); long endTime = super.get(JBT19506MsgParam.END_TIME); buf.writeBytes(DateUtil.millisecond2BytesSix(endTime)); buf.writeShort(super.get(JBT19506MsgParam.MAX_FRAME_COUNT)); byte[] bytes = new byte[buf.readableBytes()]; buf.readBytes(bytes); setMessageBody(bytes); return bytes; } }
957443abbaff14cc36e9900828b882af42273439
ac5eb8fdb6edd4b5a9285654d88b2de5829b6953
/oops-inheritance/stringbuffer/Ex10.java
476abc588d1d916dc620e21de7dd95f65e06bfba
[]
no_license
lakshmiteja1234/WTN-PBL
e7ef71497a547ccc289b7a1301f948a99e3a9eed
30f92a0084ac6b60421c2cde0d83425871887af7
refs/heads/master
2022-11-06T23:56:49.389477
2020-07-04T03:39:56
2020-07-04T03:39:56
272,762,667
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.wipro.stringbuffer; public class Ex10 { public static void main(String[] args) { String str = "Wipro"; int n = 3; StringBuffer sb = new StringBuffer(); for (int i = 0; i < n; i++) { sb.append(str.substring(str.length() - n)); } System.out.println(sb); } }
7badfe8d8117837c8857555f93174fdff5d8d841
c45befd77849686dc4cf9a036547ad92a66b9d54
/src/network_programming/GetPostTest.java
394cd9df141d713a134c481d4765be1366b88e56
[]
no_license
18645956947/javaSE
cddcac5c99653fcf7561b5eb5494d78f2d8c534a
baee5781d2e469215786e9213b0d787c2011eeec
refs/heads/master
2021-07-16T06:10:24.407424
2020-09-06T13:43:56
2020-09-06T13:43:56
207,747,128
0
0
null
null
null
null
UTF-8
Java
false
false
4,100
java
package network_programming; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.List; import java.util.Map; /** * 向指定URL发送GET请求 * @author zhx */ public class GetPostTest { /** * 向制URL发送GET请求 * @param url 发送请求的URL * @param param 请求参数 格式满足name1 = value1&name2 = value2的形式 * @return URL代表远程资源的响应 */ public static String sendGet(String url, String param){ String result = ""; String urlName = url + "?" + param; try { URL realUrl = new URL(urlName); //打开和URL之间的连接 URLConnection conn = realUrl.openConnection(); //设置通用的请求属性 conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); //建立实际的连接 conn.connect(); //获取所有响应头的字段 Map<String, List<String>> map = conn.getHeaderFields(); //遍历所有的响应头字段 for (String key : map.keySet()) { System.out.println(key + "--->" + map.get(key)); } try ( //定义输出流来读取URL的响应 BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));) { String line; while ((line = in.readLine()) != null){ result += "\n"+line; } } return result; } catch (Exception e) { System.out.println("发送GET请求出现异常" + e); e.printStackTrace(); } return result; } /** * 向制URL发送GET请求 * @param url 发送请求的URL * @param param 请求参数 格式满足name1 = value1&name2 = value2的形式 * @return URL代表远程资源的响应 */ public static String sendPost(String url, String param){ String result = ""; try{ URL realUrl = new URL(url); //打开和URL之间的连接 URLConnection conn = realUrl.openConnection(); //设置通用的请求属性 conn.setRequestProperty("acccept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); //设置POST请求必须设置如下两行 conn.setDoOutput(true); conn.setDoInput(true); try( //获取URLConnection 对象对应的输出流 PrintWriter out = new PrintWriter(conn.getOutputStream())) { //发送请求参数 out.print(param); //flush 输出流的缓冲 out.flush(); } try( //定义BufferReader 输入流读取url的响应 BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")) ) { String line; while ((line = in.readLine()) != null){ result += "\n" + line; } } } catch (Exception e) { e.printStackTrace(); } return result; } public static void main(String[] args) { //发送get请求 String s = GetPostTest.sendGet("http://localhost:8888/abc/a.jsp", null); System.out.println(s); //发送post请求 String s1 = GetPostTest.sendPost("http://localhost:8888/abc/a.jsp", "name=crazyit.org&pass=leegang"); System.out.println(s1); } }
ff3a4b307639ce274b24726ee18ee8eaced963f0
017e978f5eb91003f791ea7055781bcee7347f02
/src/java/nginx/clojure/clj/StringFacedClojureBodyFilter.java
b1d00b2a58ef1edcf4e282a92406fe6524dad5ec
[ "BSD-3-Clause" ]
permissive
zcfrank1st/nginx-clojure
5586ed846bf4b8828c5fafbf256a0488057e8a8b
0bfbbc0dfe2ca95fd63a26952d0826bfbb1b0b37
refs/heads/master
2021-01-17T18:36:41.320818
2016-07-22T07:06:50
2016-07-22T07:06:50
65,341,859
1
0
null
2016-08-10T01:57:54
2016-08-10T01:57:54
null
UTF-8
Java
false
false
1,065
java
/** * Copyright (C) Zhang,Yuexiang (xfeep) * */ package nginx.clojure.clj; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.util.Map; import clojure.lang.IFn; import nginx.clojure.java.StringFacedJavaBodyFilter; /** * @author who * */ public class StringFacedClojureBodyFilter { public static final String CHAR_DECODER_BUF_REM_IN_REQUEST = "$char-decoder-buf-rem-in-request!"; protected IFn bodyFilter; public StringFacedClojureBodyFilter() { } public StringFacedClojureBodyFilter(IFn bodyFilter) { this.bodyFilter = bodyFilter; } public Map invoke(LazyFilterRequestMap request, InputStream bodyChunk, boolean isLast) throws IOException { ByteBuffer rem = (ByteBuffer) request.valAt(CHAR_DECODER_BUF_REM_IN_REQUEST); if (rem == null) { request.assoc(CHAR_DECODER_BUF_REM_IN_REQUEST, rem = ByteBuffer.allocate(3)); rem.flip(); } StringBuilder sb = StringFacedJavaBodyFilter.decodeToString(rem, bodyChunk); return (Map) bodyFilter.invoke(request, sb.toString(), isLast); } }
2a41348c67d38fa5b8f4522f37f30cf4534cd3ed
817a43c4ac0d3e267a531b14e4ae1ba0122a0750
/old/web/personal_page/java/CartesianToPolar.java
af44f3ef2e72401f68f84189bf580080bfcd694d
[]
no_license
plebtech/personal-page
35620bf62a6664133c210032d4208bec48ec86ad
f3dd8c41721ec292cbdd6df9f9993bfae09e1cfb
refs/heads/master
2023-04-13T13:47:31.928312
2021-04-21T14:48:15
2021-04-21T14:48:15
273,362,762
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
public class CartesianToPolar { public static void main(String[] args) { double x = Double.parseDouble(args[0]); double y = Double.parseDouble(args[1]); double r = Math.sqrt(x*x + y*y); double theta = Math.atan2(y, x); System.out.println("r = " + r); System.out.println("theta = " + theta); } }
a2c1a5aa0b4e5bb3f7153b001e7a355bbdbbb560
ee07486efc3e6e648922434d9fac054ffd7ab884
/qeweb-scms/scms/subprojects/vendormodule/src/main/java/com/qeweb/scm/vendormodule/vo/StatisticsVendorCountTransfer.java
49d38318f544300facece6ff48ca98238c3ef54a
[]
no_license
SrmSystem/SRM-SYETEM
b9c1c8dde92199cefdde99248850172edb0d9607
0160dc28acae0e5f9782c02cc37c14bb6a7f4cae
refs/heads/master
2021-08-31T04:39:57.497664
2017-12-20T11:14:51
2017-12-20T11:14:51
114,876,126
0
1
null
null
null
null
UTF-8
Java
false
false
2,044
java
package com.qeweb.scm.vendormodule.vo; import com.qeweb.scm.basemodule.annotation.Column; import com.qeweb.scm.basemodule.annotation.ExcelCol; import com.qeweb.scm.basemodule.annotation.ExcelTransfer; @ExcelTransfer(start=1, describe = "各维度供应商数量统计") public class StatisticsVendorCountTransfer { @ExcelCol(column = Column.B,desc="省份") private String province; @ExcelCol(column = Column.C,desc="供应商性质") private String phase; @ExcelCol(column = Column.D,desc="供应商分类") private String classify; @ExcelCol(column = Column.E,desc="系统") private String materialSystem; @ExcelCol(column = Column.F,desc="零部件类别") private String partsType; @ExcelCol(column = Column.G,desc="业务类型") private String bussinessType; @ExcelCol(column = Column.H,desc="工厂供货距离") private String distance; @ExcelCol(column = Column.I,desc="供应商总数") private String totalCount; public String getProvince() { return province; } public void setProvince(String province) { this.province = province; } public String getPhase() { return phase; } public void setPhase(String phase) { this.phase = phase; } public String getClassify() { return classify; } public void setClassify(String classify) { this.classify = classify; } public String getMaterialSystem() { return materialSystem; } public void setMaterialSystem(String materialSystem) { this.materialSystem = materialSystem; } public String getPartsType() { return partsType; } public void setPartsType(String partsType) { this.partsType = partsType; } public String getBussinessType() { return bussinessType; } public void setBussinessType(String bussinessType) { this.bussinessType = bussinessType; } public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getTotalCount() { return totalCount; } public void setTotalCount(String totalCount) { this.totalCount = totalCount; } }
66510a4e035f02d1293cd8c241c977d87f8cd927
c316afa4b2eb430e7a212124a1efb2527f819441
/src/com/darkguardsman/helpers/StringHelpers.java
68dec3c48dc95e7b0be33ec96bed39f8321044d8
[]
no_license
DarkGuardsman/AdventOfCode2018
bc00857d2520ac15c5fabd5f86f99fa02549b678
3f01be2800d51078d5cc67f4db2568f6278a76e4
refs/heads/master
2020-04-09T02:57:23.604303
2018-12-26T21:14:47
2018-12-26T21:14:47
159,961,814
0
0
null
null
null
null
UTF-8
Java
false
false
502
java
package com.darkguardsman.helpers; /** * @see <a href="https://github.com/BuiltBrokenModding/VoltzEngine/blob/development/license.md">License</a> for what you can and can't do with the code. * Created by Dark(DarkGuardsman, Robert) on 12/18/18. */ public class StringHelpers { public static String padRight(String s, int n) { return String.format("%1$-" + n + "s", s); } public static String padLeft(String s, int n) { return String.format("%1$" + n + "s", s); } }
9ee973623d61dd7565a1bbab4641417ca6223e8b
f350ccfc97a33237732c9d3314d5f2f4d8a206cd
/src/main/java/com/edgeMapper/zigbeeMapper/util/GateWayUtil.java
debafbbec574085bbdcf0077171a604611f8eaaf
[]
no_license
YanChuang2020-815/zigbeeMapper
f9001ba606a824c579fccb1a67d75a8602666e3d
f67d0d6e2bab5b1affba538de90d6b4a9558326a
refs/heads/master
2022-12-02T23:32:10.727617
2020-08-23T05:40:31
2020-08-23T05:40:31
279,628,691
0
0
null
null
null
null
UTF-8
Java
false
false
1,264
java
package com.edgeMapper.zigbeeMapper.util; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Created by rongshuai on 2020/7/15 14:12 */ public class GateWayUtil { private static Map<String, Channel> channelMap = new ConcurrentHashMap<String, Channel>(); public static Map<String, Channel> getChannelMap() { return channelMap; } public static String getIPString(ChannelHandlerContext ctx) { String ipString = ""; String socketString = ctx.channel().remoteAddress().toString(); ipString = socketString.substring(1); return ipString; } public static String byte2HexStr(byte[] b) { String stmp = ""; StringBuilder sb = new StringBuilder(""); for (int n = 0; n < b.length; n++) { stmp = Integer.toHexString(b[n] & 0xFF); sb.append((stmp.length() == 1) ? "0" + stmp : stmp); // sb.append(" "); } return sb.toString().toUpperCase().trim(); } public static int dataBytesToInt(byte[] src) { int value; value = (int) ((src[0] & 0xFF) | ((src[1] & 0xFF) << 8)); return value; } }
2438af2117cefe8d969a90b42bd5e8eaefc10540
87671c0bc2df44a2f2561836f54c483d19c3ec16
/app/src/main/java/odeen/weatherpredictor/view/LocationPickerDialog.java
8f6139c5e25fc7f0e27c2a4ebf5ad20204d7bf28
[]
no_license
ezamyatin/lesson8
60088dc2dea5576cb9311d08e1dbd3469a7bfd25
b62f595caf68293ce71a913465a3be634508ed26
refs/heads/master
2023-01-08T10:02:52.193808
2014-12-01T15:44:20
2014-12-01T15:44:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,676
java
package odeen.weatherpredictor.view; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.EditText; import odeen.weatherpredictor.R; /** * Created by Женя on 27.11.2014. */ public class LocationPickerDialog extends DialogFragment { public static final String EXTRA_CITY_NAME = "EXTRA_CITY_NAME"; private String mName; public static LocationPickerDialog newInstance() { LocationPickerDialog fragment = new LocationPickerDialog(); return fragment; } public void sendResult(int resultCode) { if (getTargetFragment() == null) return; Intent i = new Intent(); i.putExtra(EXTRA_CITY_NAME, mName); getTargetFragment().onActivityResult(getTargetRequestCode(), resultCode, i); } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { setRetainInstance(true); View v = getActivity().getLayoutInflater().inflate(R.layout.dialog_channel, null); EditText name = (EditText) v.findViewById(R.id.dialog_channel_namePicker); name.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { // getArguments().putString(EXTRA_CITY_NAME, charSequence.toString()); mName = charSequence.toString(); } @Override public void afterTextChanged(Editable editable) { } }); return new AlertDialog.Builder(getActivity()) .setView(v) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { sendResult(Activity.RESULT_OK); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { sendResult(Activity.RESULT_CANCELED); } }).create(); } }
9217108fb29df3be98f938e536cf05d6d84252dc
2779d673ff4f37a190e87072697d9e2cfa6f595f
/src/menubar/FormatStyle.java
8d2b2365ec95d8321aea069b741a105dd5bf22ed
[]
no_license
jefrusse24/JournalNotes
87804bb8dd32d2053a5347103f0b2c4369a42424
f4eb57f8e79a132d18e7edb5d4db213905c7996c
refs/heads/master
2020-06-04T12:54:31.068221
2014-12-19T01:23:40
2014-12-19T01:23:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
799
java
package menubar; import java.awt.event.KeyEvent; public enum FormatStyle { REGULAR("Regular","f_regular",KeyEvent.VK_R), HEADING1("Heading A","f_headinga",KeyEvent.VK_1), HEADING2("Heading B","f_headingb",KeyEvent.VK_2), HEADING3("Heading C","f_headingc",KeyEvent.VK_3), HEADING4("Heading D","f_headingd",KeyEvent.VK_4), CODE("Code","f_code",KeyEvent.VK_M), QUOTE("Quote","f_quote",KeyEvent.VK_I), BOLD("Bold","f_bold",KeyEvent.VK_B); private final String menuName, styleName; int key; private FormatStyle(String n, String f, int k) { menuName = n; styleName = f; key = k; } public String getMenuName() { return menuName; } public String getStyleName() { return styleName; } public String toString() { return menuName; } public int getKey() { return key; } }
fdf540ffb907bd26953d87f7094cf3bd10f40965
11053b15be9668d30dcff3be882ea694fc9d2d78
/app/src/main/java/com/add/yassin/popularmoviespart1/ui/movieslist/MoviesActivity.java
f1a467a6ce9dad5a06847cfb1eead69d237a1f8b
[]
no_license
medomchakil/popular-movies-part1
b2f630a8335ef2d9bd2d8532b4a577aacebf88d5
10aba02c7d2ab5249c70b1cc0305e785865deb52
refs/heads/master
2022-02-14T07:30:15.524578
2019-07-22T18:16:23
2019-07-22T18:16:23
198,278,433
0
0
null
null
null
null
UTF-8
Java
false
false
4,233
java
package com.add.yassin.popularmoviespart1.ui.movieslist; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import com.add.yassin.popularmoviespart1.R; import com.add.yassin.popularmoviespart1.data.api.NetworkState; import com.add.yassin.popularmoviespart1.data.model.Movie; import com.add.yassin.popularmoviespart1.utils.GlideApp; import com.add.yassin.popularmoviespart1.utils.GlideRequests; import com.add.yassin.popularmoviespart1.utils.Injection; import com.add.yassin.popularmoviespart1.utils.ItemOffsetDecoration; import com.add.yassin.popularmoviespart1.utils.UiUtils; import com.add.yassin.popularmoviespart1.utils.ViewModelFactory; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.paging.PagedList; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; public class MoviesActivity extends AppCompatActivity { MoviesViewModel viewModel; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewModel = obtainViewModel(); setupToolbar(); setupListAdapter(); } private void setupToolbar() { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); viewModel.getCurrentTitle().observe(this, new Observer<Integer>() { @Override public void onChanged(Integer integer) { setTitle(integer); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); UiUtils.tintMenuIcon(this, menu.findItem(R.id.action_sort_by), R.color.md_white_1000); if (viewModel.getCurrentSorting() == MoviesFilterType.POPULAR) { menu.findItem(R.id.action_popular_movies).setChecked(true); } else { menu.findItem(R.id.action_top_rated).setChecked(true); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getGroupId() == R.id.menu_sort_group) { viewModel.setSortMoviesBy(item.getItemId()); item.setChecked(true); } return super.onOptionsItemSelected(item); } private MoviesViewModel obtainViewModel() { ViewModelFactory factory = ViewModelFactory.getInstance(Injection.provideMovieRepository()); return ViewModelProviders.of(this, factory).get(MoviesViewModel.class); } private void setupListAdapter() { RecyclerView recyclerView = findViewById(R.id.rv_movie_list); GlideRequests glideRequests = GlideApp.with(this); final MoviesAdapter moviesAdapter = new MoviesAdapter(glideRequests, viewModel); recyclerView.setAdapter(moviesAdapter); final GridLayoutManager layoutManager = new GridLayoutManager(this, 2); layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch (moviesAdapter.getItemViewType(position)) { case R.layout.item_network_state: return layoutManager.getSpanCount(); default: return 1; } } }); recyclerView.setLayoutManager(layoutManager); ItemOffsetDecoration itemDecoration = new ItemOffsetDecoration(this, R.dimen.item_offset); recyclerView.addItemDecoration(itemDecoration); viewModel.getPagedList().observe(this, new Observer<PagedList<Movie>>() { @Override public void onChanged(PagedList<Movie> movies) { moviesAdapter.submitList(movies); } }); viewModel.getNetWorkState().observe(this, new Observer<NetworkState>() { @Override public void onChanged(NetworkState networkState) { moviesAdapter.setNetworkState(networkState); } }); } }
4d23fcb8583b43f0feb35c9e30a94859ea053b5a
4dd51361082b5f8bfd97b5c55d400343a323b7e9
/Proiect Final Fortech Pre-employment Ionut Bogdan/Cinema Reservation Sistem/src/main/java/ro/ionutbogdan/cinema/services/UserService.java
4b0dc79630735636d48820ce17f5ed54f999cdf4
[]
no_license
bogdan-ionut/CinemaReservationApp_UPDATED
868025abb1e83f834cdd1d3156d285ecb278baa4
d4a855a0e89a16d78ccebfcc14cb0a5e548cdf2d
refs/heads/master
2020-03-17T20:56:21.535436
2018-05-18T10:58:37
2018-05-18T10:58:37
133,935,975
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package ro.ionutbogdan.cinema.services; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ro.ionutbogdan.cinema.domain.User; import ro.ionutbogdan.cinema.dao.UserDAO; import java.util.Collection; public class UserService { private static final Logger LOGGER = LoggerFactory.getLogger(UserService.class); public UserDAO getDao() { return dao; } public void setDao(UserDAO dao) { this.dao = dao; } private UserDAO dao; public Collection<User> listAll() { return dao.getAll(); } }
48cfa9ca5a687544b532d0f5b433920c81cb5dcf
5048d80229c1f1830f969808c4c81a0949436eb4
/client_android/src/main/java/com/eyunda/third/domain/enumeric/CollectCode.java
68a2ae60594abf1e3cd531648e99319564e567cc
[]
no_license
leif228/client_android2
d1d1a13c4e7fcc8161de514c8a00e5947b18754e
b8b30b33d7544a3eca642d14cc2a2dd89d7db12e
refs/heads/master
2022-01-07T01:48:18.000519
2019-05-08T06:14:59
2019-05-08T06:14:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package com.eyunda.third.domain.enumeric; public enum CollectCode { mySelfShips("我的船舶"), collectShips("收藏船舶"); private String description; CollectCode(String description){ this.description = description; } public String getDescription() { return description; } }
a08e3b203568f5ca158c26f93a488939f4869df2
7fd0faf91fd354da4ecaf77c9814a9c13fc340c3
/app/src/main/java/com/coolweather/android/db/County.java
0f54e699aac1a0448cdc0d416da68b76fa9b379c
[ "Apache-2.0" ]
permissive
jojocj/coolweather
52f08c247fe84739f0fd282a4cc35cb3df78f76c
7b4eed35d2bcc2c71ab526eadd34e694f1b19975
refs/heads/master
2021-01-19T14:21:21.585360
2017-08-22T07:40:24
2017-08-22T07:40:24
100,900,828
0
0
null
null
null
null
UTF-8
Java
false
false
840
java
package com.coolweather.android.db; import org.litepal.crud.DataSupport; /** * Created by JOJO on 2017/8/21. */ public class County extends DataSupport { private int id; private String countyName; private String weatherId; private int cityId; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getCityId() { return cityId; } public void setCityId(int cityId) { this.cityId = cityId; } public String getCountyName() { return countyName; } public void setCountyName(String countyName) { this.countyName = countyName; } public String getWeatherId() { return weatherId; } public void setWeatherId(String weatherId) { this.weatherId = weatherId; } }
e126e888cfd3027632dcffad0a91736ddedf2466
2053a7239e00319dcc19937a4ee87477b3153eac
/wxysfma/src/gka/controller/lsjfgl/tjcx/xsyjxx/XsyjxxController.java
1ca700a4e7812eddb2ba0f0c1fb482faceec7e26
[]
no_license
ly3620296/wpt
5892b5e8e773b6f59d46ad16bef86881bfe310cc
a2fc8fce72454cd134ae161c78d9f67fdc2e9bb8
refs/heads/master
2021-06-25T03:50:41.425717
2020-12-07T15:40:24
2020-12-07T15:40:24
178,832,649
0
0
null
null
null
null
UTF-8
Java
false
false
5,812
java
package gka.controller.lsjfgl.tjcx.xsyjxx; import com.alibaba.druid.util.StringUtils; import com.jfinal.core.Controller; import com.jfinal.ext.route.ControllerBind; import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Record; import gka.controller.xsjfgl.wyjf.JfInfo; import gka.controller.xsjfgl.wyjf.WyjfDao; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @ControllerBind(controllerKey = "/lsjfgl/tjcx/xsyjxx") public class XsyjxxController extends Controller { private XsyjxxDao ddcxDao = new XsyjxxDao(); private WyjfDao wyjfDao = new WyjfDao(); public void index() { Map map = new HashMap(); try { String ddbh = getPara("ddbh"); String xn = getPara("xn"); String xm = getPara("xm"); String ddzt = getPara("ddzt"); String xh = getPara("xh"); String sfzh = getPara("sfzh"); String dateStart = getPara("dateStart"); String dateEnd = getPara("dateEnd"); XsyjxxSearch search = new XsyjxxSearch(ddbh, xn, xm, ddzt, xh, sfzh, dateStart, dateEnd); int page = Integer.parseInt(getPara("page")); int limit = Integer.parseInt(getPara("limit")); Page<Record> paginate = ddcxDao.getOrderInfo(page, limit, search); map.put("code", "0"); map.put("msg", "success"); map.put("data", paginate.getList()); map.put("count", paginate.getTotalRow()); } catch (Exception e) { e.printStackTrace(); map.put("code", "-1"); map.put("msg", "系统繁忙,请稍后重试!"); } renderJson(map); } public void qxInfo() { Map map = new HashMap(); try { String xn = getPara("xn"); String order_no = getPara("order_no"); String zh = getPara("zh"); if (!StringUtils.isEmpty(xn) && !StringUtils.isEmpty(order_no) && !StringUtils.isEmpty(zh)) { List<Record> titles = wyjfDao.queryTitle(); Record re = ddcxDao.getInfo(zh, xn); String ids = ddcxDao.getIds(order_no); List<JfInfo> jfInfoList = getJfinfo(titles, re, ids); Record userInfo = ddcxDao.userInfo(zh); map.put("data", jfInfoList); map.put("userInfo", userInfo); map.put("code", "0"); map.put("msg", "success"); } else { map.put("code", "-2"); map.put("msg", "请从正规渠道支付!"); } } catch (Exception e) { e.printStackTrace(); map.put("code", "-1"); map.put("msg", "系统繁忙,请稍后重试!"); } renderJson(map); } public void cgInfo() { Map map = new HashMap(); try { String xn = getPara("xn"); String order_no = getPara("order_no"); String zh = getPara("zh"); if (!StringUtils.isEmpty(xn) && !StringUtils.isEmpty(order_no) && !StringUtils.isEmpty(zh)) { List<Record> titles = wyjfDao.queryTitle(); Record re = ddcxDao.getInfo(zh, xn); Record re1 = ddcxDao.successOrderInfo(order_no); List<JfInfo> jfInfoList = getJfinfo(titles, re, re1.getStr("IDS")); Record userInfo = ddcxDao.userInfo(zh); map.put("data", jfInfoList); map.put("userInfo", userInfo); map.put("total_fee", re1.getStr("TOTAL_FEE_CALLBACK")); map.put("time_end", re1.getStr("TIME_END")); map.put("re", re1.getStr("TIME_END")); map.put("code", "0"); map.put("msg", "success"); } else { map.put("code", "-2"); map.put("msg", "请从正规渠道支付!"); } } catch (Exception e) { e.printStackTrace(); map.put("code", "-1"); map.put("msg", "系统繁忙,请稍后重试!"); } renderJson(map); } private List<JfInfo> getJfinfo(List<Record> titles, Record re, String ids) { List<JfInfo> jfInfos = new ArrayList<JfInfo>(); String[] xmid = ids.split(","); for (Record t : titles) { JfInfo jfInfo = new JfInfo(); String sfjf = t.getStr("SFBX"); boolean flag = false; if (sfjf.equals("1")) { jfInfo.setXmmc(t.getStr("JFXMMC")); jfInfo.setXmid(t.getStr("JFXMID")); jfInfo.setSfbx(sfjf); for (int j = 0; j < xmid.length; j++) { if (jfInfo.getXmid().equals(xmid[j])) { jfInfo.setJfje(re.getStr(jfInfo.getXmid())); flag = true; break; } } if (!flag) { jfInfo.setJfje("0.00"); } } else { jfInfo.setXmmc(t.getStr("JFXMMC") + "(选交)"); jfInfo.setXmid(t.getStr("JFXMID")); jfInfo.setSfbx(sfjf); jfInfo.setJfje(re.getStr(jfInfo.getXmid())); for (int j = 0; j < xmid.length; j++) { if (jfInfo.getXmid().equals(xmid[j])) { jfInfo.setJfje(re.getStr(jfInfo.getXmid())); flag = true; break; } } if (!flag) { jfInfo.setJfje("0.00"); } } jfInfos.add(jfInfo); } return jfInfos; } }
0fee9470d182163ae9060ef3378f381ad0a33cdf
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/44958/src_0.java
7d18148270f61b71ecba17785561e1081b61dff5
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
108,242
java
/******************************************************************************* * Copyright (c) 2011, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * This is an implementation of an early-draft specification developed under the Java * Community Process (JCP) and is made available for testing and evaluation purposes * only. The code is not compatible with any specification of the JCP. * * Contributors: * IBM Corporation - initial API and implementation * Andy Clement (GoPivotal, Inc) [email protected] - Contributions for * Bug 415541 - [1.8][compiler] Type annotations in the body of static initializer get dropped * Bug 415543 - [1.8][compiler] Incorrect bound index in RuntimeInvisibleTypeAnnotations attribute * Bug 415397 - [1.8][compiler] Type Annotations on wildcard type argument dropped * Bug 415399 - [1.8][compiler] Type annotations on constructor results dropped by the code generator * Bug 415470 - [1.8][compiler] Type annotations on class declaration go vanishing * Bug 414384 - [1.8] type annotation on abbreviated inner class is not marked as inner type * Jesper S Moller - Contributions for * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit) *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; import java.io.File; import java.util.Map; import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import junit.framework.Test; public class JSR308SpecSnippetTests extends AbstractRegressionTest { static { // TESTS_NUMBERS = new int [] { 19 }; // TESTS_NAMES = new String [] { "test033" }; } public static Class testClass() { return JSR308SpecSnippetTests.class; } public static Test suite() { return buildMinimalComplianceTestSuite(testClass(), F_1_8); } public JSR308SpecSnippetTests(String testName){ super(testName); } // Enables the tests to run individually protected Map getCompilerOptions() { Map defaultOptions = super.getCompilerOptions(); defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8); defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8); defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8); return defaultOptions; } public void test001() throws Exception { this.runConformTest( new String[] { "X.java", "import java.util.Map;\n" + "import java.util.List;\n" + "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class Document {}\n" + "public class X {\n" + " Map<@NonNull String, @NonEmpty List<@Readonly Document>> files;\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #10 @NonNull(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #11 @NonEmpty(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1)]\n" + " )\n" + " #12 @Readonly(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // note, javac 8b100 emits offset incorrectly. public void test002() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class Document {}\n" + "public class X {\n" + " static void foo(X o) {\n" + " o.<@NonNull String>m(\"...\");\n" + " }\n" + " <T> void m(String s) {}\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x49 METHOD_INVOCATION_TYPE_ARGUMENT\n" + " offset = 3\n" + " type argument index = 0\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test003() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.Collection;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Existing {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class File {}\n" + "class X<F extends @Existing File> { \n" + " Collection<? super @Existing File> c;\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Existing(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), WILDCARD]\n" + " )\n" + " \n" + " // Method descriptor #12 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [14]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 11]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " Local variable type table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X<F>\n" + "\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Existing(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 0\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test004() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.List;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Existing {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class File {}\n" + "abstract class X<T> implements @Readonly List<@Readonly T> { }\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #23 @Readonly(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " )\n" + " #23 @Readonly(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test005() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.List;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Critical {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class TemperatureException extends RuntimeException{}\n" + "class X {\n" + " void monitorTemperature() throws @Critical TemperatureException {}\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #19 @Critical(\n" + " target type = 0x17 THROWS\n" + " throws index = 0\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test006() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Interned {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "@Target(TYPE_USE)\n" + "@interface Tainted {}\n" + "class MyObject {\n" + " class NestedClass {}\n" + "}\n" + "class List<T> {}\n" + "class X {\n" + " static void monitorTemperature(MyObject myVar) {\n" + " new <String> @Interned MyObject();\n" + " new @NonEmpty @Readonly List<String>();\n" + " myVar.new @Tainted NestedClass();\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #33 @Interned(\n" + " target type = 0x44 NEW\n" + " offset = 0\n" + " )\n" + " #34 @NonEmpty(\n" + " target type = 0x44 NEW\n" + " offset = 6\n" + " )\n" + " #35 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 6\n" + " )\n" + " #36 @Tainted(\n" + " target type = 0x44 NEW\n" + " offset = 12\n" + " location = [INNER_TYPE]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test007() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "@Target(TYPE_USE)\n" + "@interface Tainted {}\n" + "class MyObject {\n" + " class NestedClass {}\n" + "}\n" + "class List<T> {}\n" + "class X {\n" + " Map.@NonNull Entry e;\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #8 @NonNull(\n" + " target type = 0x13 FIELD\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test008() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface A {}\n" + "@Target(TYPE_USE)\n" + "@interface B {}\n" + "class MyObject {\n" + " class NestedClass {}\n" + "}\n" + "class List<T> {}\n" + "class Type1 {}\n" + "interface Type2 {}\n" + "class X {\n" + " static void monitorTemperature(Object myObject) {\n" + " String myString = (@NonNull String) myObject;\n" + " Type1 x = (@A Type1 & @B Type2) null;\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #29 @NonNull(\n" + " target type = 0x47 CAST\n" + " offset = 1\n" + " type argument index = 0\n" + " )\n" + " #30 @B(\n" + " target type = 0x47 CAST\n" + " offset = 6\n" + " type argument index = 1\n" + " )\n" + " #31 @A(\n" + " target type = 0x47 CAST\n" + " offset = 9\n" + " type argument index = 0\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test009() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface A {}\n" + "@Target(TYPE_USE)\n" + "@interface B {}\n" + "class MyObject {\n" + " class NestedClass {}\n" + "}\n" + "class List<T> {}\n" + "class Type1 {}\n" + "interface Type2 {}\n" + "class X {\n" + " static void monitorTemperature(Object myObject) {\n" + " boolean isNonNull = myObject instanceof @NonNull String;\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #23 @NonNull(\n" + " target type = 0x43 INSTANCEOF\n" + " offset = 1\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test010() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.Arrays;\n" + "import java.util.Date;\n" + "import java.util.List;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "@Target(TYPE_USE)\n" + "@interface English {}\n" + "@Target(TYPE_USE)\n" + "@interface Vernal {}\n" + "@Target(TYPE_USE)\n" + "@interface NonNegative {}\n" + "class MyObject {\n" + " class NestedClass {}\n" + "}\n" + "class Type1 {}\n" + "interface I {\n" + " int f(Date d);\n" + "}\n" + "interface J {\n" + " int f(List l);\n" + "}\n" + "interface K {\n" + " void s(int [] ia);\n" + "}\n" + "class X {\n" + " static void monitorTemperature(Object myObject) {\n" + " I i = @Vernal Date::getDay;\n" + " J j = List<@English String>::size;\n" + " K k = Arrays::<@NonNegative Integer>sort;\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #36 @Vernal(\n" + " target type = 0x46 METHOD_REFERENCE\n" + " offset = 0\n" + " )\n" + " #37 @English(\n" + " target type = 0x46 METHOD_REFERENCE\n" + " offset = 6\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #38 @NonNegative(\n" + " target type = 0x4b METHOD_REFERENCE_TYPE_ARGUMENT\n" + " offset = 12\n" + " type argument index = 0\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test011() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.*;\n" + "import java.io.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Immutable { int value() default 0; }\n" + "class X {\n" + " List<@Immutable ? extends Comparable<X>> a;\n" + " List<? extends @Immutable Comparable<X>> b;\n" + " List<@Immutable(1) ? extends @Immutable(2) Comparable<X>> c;\n" + " Map<@Immutable(1) ? extends Comparable<X>,@Immutable(2) ? extends @Immutable(3) Serializable> d;\n" + "}\n", }, ""); // javac b100 // Field a: // RuntimeInvisibleTypeAnnotations: // 0: #9(): FIELD, location=[TYPE_ARGUMENT(0)] // Field b: // RuntimeInvisibleTypeAnnotations: // 0: #9(): FIELD, location=[TYPE_ARGUMENT(0), WILDCARD] // Field c: // RuntimeInvisibleTypeAnnotations: // 0: #9(#12=I#13): FIELD, location=[TYPE_ARGUMENT(0)] // 1: #9(#12=I#14): FIELD, location=[TYPE_ARGUMENT(0), WILDCARD] // Field d: // RuntimeInvisibleTypeAnnotations: // 0: #9(#12=I#13): FIELD, location=[TYPE_ARGUMENT(0)] // 1: #9(#12=I#14): FIELD, location=[TYPE_ARGUMENT(1)] // 2: #9(#12=I#18): FIELD, location=[TYPE_ARGUMENT(1), WILDCARD] String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"a\"\n" + " constant #6 utf8: \"Ljava/util/List;\"\n" + " constant #7 utf8: \"Signature\"\n" + " constant #8 utf8: \"Ljava/util/List<+Ljava/lang/Comparable<LX;>;>;\"\n" + " constant #9 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #10 utf8: \"LImmutable;\"\n" + " constant #11 utf8: \"b\"\n" + " constant #12 utf8: \"c\"\n" + " constant #13 utf8: \"value\"\n" + " constant #14 integer: 1\n" + " constant #15 integer: 2\n" + " constant #16 utf8: \"d\"\n" + " constant #17 utf8: \"Ljava/util/Map;\"\n" + " constant #18 utf8: \"Ljava/util/Map<+Ljava/lang/Comparable<LX;>;+Ljava/io/Serializable;>;\"\n" + " constant #19 integer: 3\n" + " constant #20 utf8: \"<init>\"\n" + " constant #21 utf8: \"()V\"\n" + " constant #22 utf8: \"Code\"\n" + " constant #23 method_ref: #3.#24 java/lang/Object.<init> ()V\n" + " constant #24 name_and_type: #20.#21 <init> ()V\n" + " constant #25 utf8: \"LineNumberTable\"\n" + " constant #26 utf8: \"LocalVariableTable\"\n" + " constant #27 utf8: \"this\"\n" + " constant #28 utf8: \"LX;\"\n" + " constant #29 utf8: \"SourceFile\"\n" + " constant #30 utf8: \"X.java\"\n" + " \n" + " // Field descriptor #6 Ljava/util/List;\n" + " // Signature: Ljava/util/List<+Ljava/lang/Comparable<LX;>;>;\n" + " java.util.List a;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Immutable(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " \n" + " // Field descriptor #6 Ljava/util/List;\n" + " // Signature: Ljava/util/List<+Ljava/lang/Comparable<LX;>;>;\n" + " java.util.List b;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Immutable(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), WILDCARD]\n" + " )\n" + " \n" + " // Field descriptor #6 Ljava/util/List;\n" + " // Signature: Ljava/util/List<+Ljava/lang/Comparable<LX;>;>;\n" + " java.util.List c;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Immutable(\n" + " #13 value=(int) 1 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #10 @Immutable(\n" + " #13 value=(int) 2 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), WILDCARD]\n" + " )\n" + " \n" + " // Field descriptor #17 Ljava/util/Map;\n" + " // Signature: Ljava/util/Map<+Ljava/lang/Comparable<LX;>;+Ljava/io/Serializable;>;\n" + " java.util.Map d;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @Immutable(\n" + " #13 value=(int) 1 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #10 @Immutable(\n" + " #13 value=(int) 2 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1)]\n" + " )\n" + " #10 @Immutable(\n" + " #13 value=(int) 3 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1), WILDCARD]\n" + " )\n" + " \n" + " // Method descriptor #21 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [23]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test012() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class Document {}\n" + "class X {\n" + " @Readonly Document [][] docs1 = new @Readonly Document [2][12]; // array of arrays of read-only documents\n" + " Document @Readonly [][] docs2 = new Document @Readonly [2][12]; // read-only array of arrays of documents\n" + " Document[] @Readonly [] docs3 = new Document[2] @Readonly [12]; // array of read-only arrays of documents\n" + "}\n", }, ""); String expectedOutput = " Document[][] docs1;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @Readonly(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY, ARRAY]\n" + " )\n" + " \n" + " // Field descriptor #6 [[LDocument;\n" + " Document[][] docs2;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @Readonly(\n" + " target type = 0x13 FIELD\n" + " )\n" + " \n" + " // Field descriptor #6 [[LDocument;\n" + " Document[][] docs3;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @Readonly(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY]\n" + " )\n" + " \n" + " // Method descriptor #12 ()V\n" + " // Stack: 3, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [14]\n" + " 4 aload_0 [this]\n" + " 5 iconst_2\n" + " 6 bipush 12\n" + " 8 multianewarray Document[][] [16]\n" + " 12 putfield X.docs1 : Document[][] [17]\n" + " 15 aload_0 [this]\n" + " 16 iconst_2\n" + " 17 bipush 12\n" + " 19 multianewarray Document[][] [16]\n" + " 23 putfield X.docs2 : Document[][] [19]\n" + " 26 aload_0 [this]\n" + " 27 iconst_2\n" + " 28 bipush 12\n" + " 30 multianewarray Document[][] [16]\n" + " 34 putfield X.docs3 : Document[][] [21]\n" + " 37 return\n" + " Line numbers:\n" + " [pc: 0, line: 6]\n" + " [pc: 4, line: 7]\n" + " [pc: 15, line: 8]\n" + " [pc: 26, line: 9]\n" + " [pc: 37, line: 6]\n" + " Local variable table:\n" + " [pc: 0, pc: 38] local: this index: 0 type: X\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 8\n" + " location = [ARRAY, ARRAY]\n" + " )\n" + " #8 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 19\n" + " )\n" + " #8 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 30\n" + " location = [ARRAY]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test013() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Immutable {}\n" + "class Document {}\n" + "class X {\n" + " @Immutable X() {\n" + " }\n" + "}\n", }, ""); // javac b100 gives: // RuntimeInvisibleTypeAnnotations: // 0: #9(): METHOD_RETURN String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #15 utf8: \"LImmutable;\"\n" + " constant #16 utf8: \"SourceFile\"\n" + " constant #17 utf8: \"X.java\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " [pc: 4, line: 8]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #15 @Immutable(\n" + " target type = 0x14 METHOD_RETURN\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test014() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Immutable {}\n" + "class Document {}\n" + "interface I {\n" + " void foo();\n" + "}\n" + "class X {\n" + " void foo (X this, X this) {\n" + " }\n" + " static void foo (X this) {\n" + " }\n" + " I i = (X this) -> {};\n" + "}\n" + "class Y<T> {\n" + " void foo(X this) {}\n" + " void foo(Y this, int x) {}\n" + " class Z {\n" + " void foo(Y<T>.Z this) {}\n" + " }\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 10)\n" + " void foo (X this, X this) {\n" + " ^^^^\n" + "Only the first formal parameter may be declared explicitly as \'this\'\n" + "----------\n" + "2. ERROR in X.java (at line 12)\n" + " static void foo (X this) {\n" + " ^^^^\n" + "Explicit \'this\' parameter is allowed only in instance methods of non-anonymous classes and inner class constructors\n" + "----------\n" + "3. ERROR in X.java (at line 14)\n" + " I i = (X this) -> {};\n" + " ^^^^^^^^^^^^^^\n" + "Lambda expression\'s signature does not match the signature of the functional interface method\n" + "----------\n" + "4. ERROR in X.java (at line 14)\n" + " I i = (X this) -> {};\n" + " ^^^^\n" + "Lambda expressions cannot declare a this parameter\n" + "----------\n" + "5. ERROR in X.java (at line 17)\n" + " void foo(X this) {}\n" + " ^\n" + "The declared type of the explicit \'this\' parameter is expected to be Y<T>\n" + "----------\n" + "6. WARNING in X.java (at line 18)\n" + " void foo(Y this, int x) {}\n" + " ^\n" + "Y is a raw type. References to generic type Y<T> should be parameterized\n" + "----------\n" + "7. ERROR in X.java (at line 18)\n" + " void foo(Y this, int x) {}\n" + " ^\n" + "The declared type of the explicit \'this\' parameter is expected to be Y<T>\n" + "----------\n"); } public void test015() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Immutable {}\n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class Document {}\n" + "interface I {\n" + " void foo();\n" + "}\n" + "class X {\n" + " class Y {\n" + " void foo(@Immutable X.@Readonly Y this) {\n" + " }\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #21 @Immutable(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " )\n" + " #22 @Readonly(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " location = [INNER_TYPE]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X$Y.class", "Y", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test016() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface A {}\n" + "@Target(TYPE_USE)\n" + "@interface B {}\n" + "@Target(TYPE_USE)\n" + "@interface C {}\n" + "public class X {}\n" + "class Outer {\n" + " class Middle {\n" + " class Inner {\n" + " void innerMethod(@A Outer.@B Middle.@C Inner this) { }\n" + " }\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #21 @A(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " )\n" + " #22 @B(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " location = [INNER_TYPE]\n" + " )\n" + " #23 @C(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " location = [INNER_TYPE, INNER_TYPE]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "Outer$Middle$Inner.class", "Inner", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test017() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Result {}\n" + "@Target(TYPE_USE)\n" + "@interface Receiver {}\n" + "class Document {}\n" + "interface I {\n" + " void foo();\n" + "}\n" + "class X {\n" + " class Y {\n" + " Y(@Receiver X X.this, boolean b) { }\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #22 @Receiver(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X$Y.class", "Y", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test018() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@interface Receiver {}\n" + "class Document {}\n" + "interface I {\n" + " void foo();\n" + "}\n" + "class X {\n" + " void foo(@Receiver X this) {}\n" + " class Y {\n" + " Y(@Receiver X X.this, boolean b) { }\n" + " }\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 9)\n" + " void foo(@Receiver X this) {}\n" + " ^^^^^^^^^\n" + "Annotation types that do not specify explicit target element types cannot be applied here\n" + "----------\n" + "2. ERROR in X.java (at line 11)\n" + " Y(@Receiver X X.this, boolean b) { }\n" + " ^^^^^^^^^\n" + "Annotation types that do not specify explicit target element types cannot be applied here\n" + "----------\n"); } public void test019() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class X<@Readonly T> {\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #21 @Readonly(\n" + " target type = 0x0 CLASS_TYPE_PARAMETER\n" + " type parameter index = 0\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test020() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.util.@NotAllowed Date; // illegal!\n" + "import @IllegalSyntax java.util.Date; // illegal syntax\n" + "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Even {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface NotAllowed {}\n" + "@Target(TYPE_USE)\n" + "@interface IllegalSyntax {}\n" + "@Target(TYPE_USE)\n" + "@interface Legal {}\n" + "class X {\n" + " static int staticField;\n" + " static class StaticNestedClass {}\n" + " void foo() {\n" + " Object o = @Even int.class; // illegal!\n" + " o = int @NonEmpty [].class; // illegal!\n" + " int x = @IllegalSyntax X.staticField;\n" + " StaticNestedClass snc = (@IllegalSyntax X.StaticNestedClass) null;\n" + " X.@Legal StaticNestedClass lsnc = (X.@Legal StaticNestedClass) null;\n" + " }\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 1)\n" + " import java.util.@NotAllowed Date; // illegal!\n" + " ^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "2. ERROR in X.java (at line 2)\n" + " import @IllegalSyntax java.util.Date; // illegal syntax\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "3. WARNING in X.java (at line 2)\n" + " import @IllegalSyntax java.util.Date; // illegal syntax\n" + " ^^^^^^^^^^^^^^\n" + "The import java.util.Date is never used\n" + "----------\n" + "4. ERROR in X.java (at line 19)\n" + " Object o = @Even int.class; // illegal!\n" + " ^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "5. WARNING in X.java (at line 20)\n" + " o = int @NonEmpty [].class; // illegal!\n" + " ^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "6. ERROR in X.java (at line 21)\n" + " int x = @IllegalSyntax X.staticField;\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "7. ERROR in X.java (at line 22)\n" + " StaticNestedClass snc = (@IllegalSyntax X.StaticNestedClass) null;\n" + " ^^^^^^^^^^^^^^\n" + "Type annotations are not allowed on type names used to access static members\n" + "----------\n"); } public void test021() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.util.@NotAllowed Date; // illegal!\n" + "import @IllegalSyntax java.util.Date; // illegal syntax\n" + "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Even {}\n" + "@Target(TYPE_USE)\n" + "@interface NonEmpty {}\n" + "@Target(TYPE_USE)\n" + "@interface NotAllowed {}\n" + "@Target(TYPE_USE)\n" + "@interface IllegalSyntax {}\n" + "@Target(TYPE_USE)\n" + "@interface Legal {}\n" + "interface I {\n" + " int f(Y y);\n" + "}\n" + "class Y {\n" + " int f;\n" + " int x(Y y) {}\n" + "}\n" + "class X extends Y {\n" + " static int staticField;\n" + " static class StaticNestedClass {}\n" + " void foo() {\n" + " Object o = @Even int.class; // illegal!\n" + " o = int @NonEmpty [].class; // illegal!\n" + " int x = @IllegalSyntax X.staticField;\n" + " StaticNestedClass snc = (@IllegalSyntax X.StaticNestedClass) null;\n" + " X.@Legal StaticNestedClass lsnc = (X.@Legal StaticNestedClass) null;\n" + " int x2 = @IllegalSyntax X.super.f;\n" + " I i = @IllegalSyntax X.super::x;\n" + " }\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 1)\n" + " import java.util.@NotAllowed Date; // illegal!\n" + " ^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "2. ERROR in X.java (at line 2)\n" + " import @IllegalSyntax java.util.Date; // illegal syntax\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "3. WARNING in X.java (at line 2)\n" + " import @IllegalSyntax java.util.Date; // illegal syntax\n" + " ^^^^^^^^^^^^^^\n" + "The import java.util.Date is never used\n" + "----------\n" + "4. ERROR in X.java (at line 26)\n" + " Object o = @Even int.class; // illegal!\n" + " ^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "5. WARNING in X.java (at line 27)\n" + " o = int @NonEmpty [].class; // illegal!\n" + " ^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "6. ERROR in X.java (at line 28)\n" + " int x = @IllegalSyntax X.staticField;\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "7. ERROR in X.java (at line 29)\n" + " StaticNestedClass snc = (@IllegalSyntax X.StaticNestedClass) null;\n" + " ^^^^^^^^^^^^^^\n" + "Type annotations are not allowed on type names used to access static members\n" + "----------\n" + "8. ERROR in X.java (at line 31)\n" + " int x2 = @IllegalSyntax X.super.f;\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n" + "9. ERROR in X.java (at line 32)\n" + " I i = @IllegalSyntax X.super::x;\n" + " ^^^^^^^^^^^^^^\n" + "Syntax error, type annotations are illegal here\n" + "----------\n"); } public void test022() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "class X {\n" + " @Readonly int foo() @Readonly [] {\n" + " return null;\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #17 @Readonly(\n" + " target type = 0x14 METHOD_RETURN\n" + " location = [ARRAY]\n" + " )\n" + " #17 @Readonly(\n" + " target type = 0x14 METHOD_RETURN\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test023() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "interface X {\n" + " default @Readonly int foo() @Readonly [] {\n" + " return null;\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #13 @Readonly(\n" + " target type = 0x14 METHOD_RETURN\n" + " location = [ARRAY]\n" + " )\n" + " #13 @Readonly(\n" + " target type = 0x14 METHOD_RETURN\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test024() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "@Target(TYPE_USE)\n" + "@interface Critical {}\n" + "class X {\n" + " void foo() {\n" + " try {\n" + " System.out.println();\n" + " } catch (@Readonly NullPointerException | @Critical ArrayIndexOutOfBoundsException e) {\n" + " }\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #34 @Readonly(\n" + " target type = 0x42 EXCEPTION_PARAMETER\n" + " exception table index = 0\n" + " )\n" + " #35 @Critical(\n" + " target type = 0x42 EXCEPTION_PARAMETER\n" + " exception table index = 1\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test025() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "@Target(TYPE_USE)\n" + "@interface Critical {}\n" + "class X {\n" + " void foo(@Readonly int [] [] @Critical ... x) {\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #19 @Readonly(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [ARRAY, ARRAY, ARRAY]\n" + " )\n" + " #20 @Critical(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [ARRAY, ARRAY]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test026() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface Readonly {}\n" + "@Target(TYPE_USE)\n" + "@interface Critical {}\n" + "class X {\n" + " void foo(@Readonly int [] [] @Critical ... x) {\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #19 @Readonly(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [ARRAY, ARRAY, ARRAY]\n" + " )\n" + " #20 @Critical(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [ARRAY, ARRAY]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test027() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "class X {\n" + " @NonNull String var1, arr2[];\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #8 @NonNull(\n" + " target type = 0x13 FIELD\n" + " )\n" + " \n" + " // Field descriptor #10 [Ljava/lang/String;\n" + " java.lang.String[] arr2;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @NonNull(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test028() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.List;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target(TYPE_USE)\n" + "@interface NonNull {}\n" + "class X<@NonNull T> {\n" + " <@NonNull K> void foo() {}\n" + " List<@NonNull ?> l;\n" + "}\n", }, ""); // javac b100 // On the type declaration: // RuntimeInvisibleTypeAnnotations: // 0: #9(): CLASS_TYPE_PARAMETER, param_index=0 // On the method: // RuntimeInvisibleTypeAnnotations: // 0: #9(): METHOD_TYPE_PARAMETER, param_index=0 // On the field: // RuntimeInvisibleTypeAnnotations: // 0: #9(): FIELD, location=[TYPE_ARGUMENT(0)] String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "// Signature: <T:Ljava/lang/Object;>Ljava/lang/Object;\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"l\"\n" + " constant #6 utf8: \"Ljava/util/List;\"\n" + " constant #7 utf8: \"Signature\"\n" + " constant #8 utf8: \"Ljava/util/List<*>;\"\n" + " constant #9 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #10 utf8: \"LNonNull;\"\n" + " constant #11 utf8: \"<init>\"\n" + " constant #12 utf8: \"()V\"\n" + " constant #13 utf8: \"Code\"\n" + " constant #14 method_ref: #3.#15 java/lang/Object.<init> ()V\n" + " constant #15 name_and_type: #11.#12 <init> ()V\n" + " constant #16 utf8: \"LineNumberTable\"\n" + " constant #17 utf8: \"LocalVariableTable\"\n" + " constant #18 utf8: \"this\"\n" + " constant #19 utf8: \"LX;\"\n" + " constant #20 utf8: \"LocalVariableTypeTable\"\n" + " constant #21 utf8: \"LX<TT;>;\"\n" + " constant #22 utf8: \"foo\"\n" + " constant #23 utf8: \"<K:Ljava/lang/Object;>()V\"\n" + " constant #24 utf8: \"SourceFile\"\n" + " constant #25 utf8: \"X.java\"\n" + " constant #26 utf8: \"<T:Ljava/lang/Object;>Ljava/lang/Object;\"\n" + " \n" + " // Field descriptor #6 Ljava/util/List;\n" + " // Signature: Ljava/util/List<*>;\n" + " java.util.List l;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @NonNull(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " \n" + " // Method descriptor #12 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [14]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 6]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " Local variable type table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X<T>\n" + " \n" + " // Method descriptor #12 ()V\n" + " // Signature: <K:Ljava/lang/Object;>()V\n" + " // Stack: 0, Locals: 1\n" + " void foo();\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @NonNull(\n" + " target type = 0x1 METHOD_TYPE_PARAMETER\n" + " type parameter index = 0\n" + " )\n" + "\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @NonNull(\n" + " target type = 0x0 CLASS_TYPE_PARAMETER\n" + " type parameter index = 0\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test029() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface TAnno { }\n" + "@Target({METHOD}) @interface MAnno { }\n" + "@Target({METHOD, TYPE_USE}) @interface MTAnno { }\n" + "@Target({FIELD}) @interface FAnno { }\n" + "@Target({FIELD, TYPE_USE}) @interface FTAnno { }\n" + "class X {\n" + "@FAnno Object field4; // legal, one field annotation\n" + "@TAnno Object field5; // legal, one type annotation\n" + "@FTAnno Object field6; // legal, one field annotation and one type annotation\n" + "@FAnno java.lang.Object field7; // legal, one field annotation\n" + "@TAnno java.lang.Object field8; // illegal\n" + "@FTAnno java.lang.Object field9; // legal, one field annotation\n" + "java.lang. @FAnno Object field10; // illegal\n" + "java.lang. @TAnno Object field11; // legal, one type annotation\n" + "java.lang. @FTAnno Object field12; // legal, one type annotation\n" + "@MAnno void myMethod1() { } // legal, one method annotation\n" + "@TAnno void myMethod2() { } // illegal\n" + "@MTAnno void myMethod3() { } // legal, one method annotation\n" + "@MAnno Object myMethod4() { } // legal, one method annotation\n" + "@TAnno Object myMethod5() { } // legal, one type annotation\n" + "@MTAnno Object myMethod6() { } // legal, one method annotation and one type annotation\n" + "@MAnno java.lang.Object myMethod7() { } // legal, one method annotation\n" + "@TAnno java.lang.Object myMethod8() { } // illegal\n" + "@MTAnno java.lang.Object myMethod9() { } // legal, one method annotation\n" + "java.lang. @MAnno Object myMethod10() { } // illegal\n" + "java.lang. @TAnno Object myMethod11() { } // legal, one type annotation\n" + "java.lang. @MTAnno Object myMethod12() { } // legal, one type annotation\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 13)\n" + " @TAnno java.lang.Object field8; // illegal\n" + " ^^^^^^\n" + "The annotation @TAnno is disallowed for this location\n" + "----------\n" + "2. ERROR in X.java (at line 15)\n" + " java.lang. @FAnno Object field10; // illegal\n" + " ^^^^^^\n" + "The annotation @FAnno is disallowed for this location\n" + "----------\n" + "3. ERROR in X.java (at line 19)\n" + " @TAnno void myMethod2() { } // illegal\n" + " ^^^^^^\n" + "Type annotation is illegal for a method that returns void\n" + "----------\n" + "4. ERROR in X.java (at line 25)\n" + " @TAnno java.lang.Object myMethod8() { } // illegal\n" + " ^^^^^^\n" + "The annotation @TAnno is disallowed for this location\n" + "----------\n" + "5. ERROR in X.java (at line 27)\n" + " java.lang. @MAnno Object myMethod10() { } // illegal\n" + " ^^^^^^\n" + "The annotation @MAnno is disallowed for this location\n" + "----------\n"); } public void test030() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface TypeAnnotation { }\n" + "@Target({TYPE}) @interface Annotation { }\n" + "@Annotation @TypeAnnotation class X {\n" + "}\n", }, ""); // javac b100 produces: // RuntimeInvisibleAnnotations: // 0: #11() LAnnotation; // 1: #12() LTypeAnnotation; String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"SourceFile\"\n" + " constant #15 utf8: \"X.java\"\n" + " constant #16 utf8: \"RuntimeInvisibleAnnotations\"\n" + " constant #17 utf8: \"LAnnotation;\"\n" + " constant #18 utf8: \"LTypeAnnotation;\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 5]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + "\n" + " RuntimeInvisibleAnnotations: \n" + " #17 @Annotation(\n" + " )\n" + " #18 @TypeAnnotation(\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test030a() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@Target({TYPE_USE}) @interface TypeAnnotation { }\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@Target({TYPE}) @interface Annotation { }\n" + "@Annotation @TypeAnnotation class X {\n" + "}\n", }, ""); String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"SourceFile\"\n" + " constant #15 utf8: \"X.java\"\n" + " constant #16 utf8: \"RuntimeVisibleAnnotations\"\n" + " constant #17 utf8: \"LAnnotation;\"\n" + " constant #18 utf8: \"LTypeAnnotation;\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + "\n" + " RuntimeVisibleAnnotations: \n" + " #17 @Annotation(\n" + " )\n" + " #18 @TypeAnnotation(\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test030b() throws Exception { this.runNegativeTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Retention(RetentionPolicy.RUNTIME)\n" + // Only TYPE_USE annotations get this special treatment "@Target({TYPE_PARAMETER}) @interface TypeAnnotation { }\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@Target({TYPE}) @interface Annotation { }\n" + "@Annotation @TypeAnnotation class X {\n" + "}\n", }, "----------\n" + "1. ERROR in X.java (at line 7)\n" + " @Annotation @TypeAnnotation class X {\n" + " ^^^^^^^^^^^^^^^\n" + "The annotation @TypeAnnotation is disallowed for this location\n" + "----------\n"); } public void test030c() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@Target({TYPE_USE,TYPE_PARAMETER}) @interface TypeAnnotation { }\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@Target({TYPE}) @interface Annotation { }\n" + "@Annotation @TypeAnnotation class X {\n" + "}\n", }, ""); String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"SourceFile\"\n" + " constant #15 utf8: \"X.java\"\n" + " constant #16 utf8: \"RuntimeVisibleAnnotations\"\n" + " constant #17 utf8: \"LAnnotation;\"\n" + " constant #18 utf8: \"LTypeAnnotation;\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + "\n" + " RuntimeVisibleAnnotations: \n" + " #17 @Annotation(\n" + " )\n" + " #18 @TypeAnnotation(\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // Test that annotations in initializer code are not attached to the field. public void test031() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "class X {\n" + " X x = new @NonNull X();\n" + "}\n", }, ""); String expectedOutput = " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [10]\n" + " 4 aload_0 [this]\n" + " 5 new X [1]\n" + " 8 dup\n" + " 9 invokespecial X() [12]\n" + " 12 putfield X.x : X [13]\n" + " 15 return\n" + " Line numbers:\n" + " [pc: 0, line: 4]\n" + " [pc: 4, line: 5]\n" + " [pc: 15, line: 4]\n" + " Local variable table:\n" + " [pc: 0, pc: 16] local: this index: 0 type: X\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #19 @NonNull(\n" + " target type = 0x44 NEW\n" + " offset = 5\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // Test co-existence of parameter annotations and type annotations. public void test032() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "@Target({PARAMETER}) @interface ParameterAnnot { }\n" + "class X {\n" + " void foo(@NonNull X this, @ParameterAnnot @NonNull X x) {\n" + " }\n" + "}\n", }, ""); String expectedOutput = " void foo(X x);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: x index: 1 type: X\n" + " RuntimeInvisibleParameterAnnotations: \n" + " Number of annotations for parameter 0: 1\n" + " #17 @ParameterAnnot(\n" + " )\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #20 @NonNull(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " )\n" + " #20 @NonNull(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // Test type annotations in initializer code. public void test033() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "class X {\n" + " static {\n" + " Object o = (@NonNull Object) new @NonNull Object();\n" + " }\n" + " {\n" + " new @NonNull Object();\n" + " }\n" + " X() {\n" + " }\n" + " X (int x) {\n" + " }\n" + "}\n", }, ""); // javac b100 // For the annotations in the static {...} the clinit has: // RuntimeInvisibleTypeAnnotations: // 0: #11(): CAST, offset=0, type_index=0 // 1: #11(): NEW, offset=0 // javac is skipping production of the cast so offset is 0. JDT is currently always producing the // checkcast for an annotated cast so the offset is 7. // For the annotations in the initializer {...} the constructors both have: // RuntimeInvisibleTypeAnnotations: // 0: #11(): NEW, offset=4 String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<clinit>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #10.#6 <init> ()V\n" + " constant #10 utf8: \"<init>\"\n" + " constant #11 utf8: \"LineNumberTable\"\n" + " constant #12 utf8: \"LocalVariableTable\"\n" + " constant #13 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #14 utf8: \"LNonNull;\"\n" + " constant #15 utf8: \"this\"\n" + " constant #16 utf8: \"LX;\"\n" + " constant #17 utf8: \"(I)V\"\n" + " constant #18 utf8: \"x\"\n" + " constant #19 utf8: \"I\"\n" + " constant #20 utf8: \"SourceFile\"\n" + " constant #21 utf8: \"X.java\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 2, Locals: 1\n" + " static {};\n" + " 0 new java.lang.Object [3]\n" + " 3 dup\n" + " 4 invokespecial java.lang.Object() [8]\n" + " 7 checkcast java.lang.Object [3]\n" + " 10 astore_0\n" + " 11 return\n" + " Line numbers:\n" + " [pc: 0, line: 6]\n" + " [pc: 11, line: 7]\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #14 @NonNull(\n" + " target type = 0x44 NEW\n" + " offset = 0\n" + " )\n" + " #14 @NonNull(\n" + " target type = 0x47 CAST\n" + " offset = 7\n" + " type argument index = 0\n" + " )\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 new java.lang.Object [3]\n" + " 7 invokespecial java.lang.Object() [8]\n" + " 10 return\n" + " Line numbers:\n" + " [pc: 0, line: 11]\n" + " [pc: 4, line: 9]\n" + " [pc: 10, line: 12]\n" + " Local variable table:\n" + " [pc: 0, pc: 11] local: this index: 0 type: X\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #14 @NonNull(\n" + " target type = 0x44 NEW\n" + " offset = 4\n" + " )\n" + " \n" + " // Method descriptor #17 (I)V\n" + " // Stack: 1, Locals: 2\n" + " X(int x);\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 new java.lang.Object [3]\n" + " 7 invokespecial java.lang.Object() [8]\n" + " 10 return\n" + " Line numbers:\n" + " [pc: 0, line: 13]\n" + " [pc: 4, line: 9]\n" + " [pc: 10, line: 14]\n" + " Local variable table:\n" + " [pc: 0, pc: 11] local: this index: 0 type: X\n" + " [pc: 0, pc: 11] local: x index: 1 type: int\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #14 @NonNull(\n" + " target type = 0x44 NEW\n" + " offset = 4\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test034() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "class X <T extends @NonNull Comparable> {\n" + "}\n", }, ""); // javac b100 // RuntimeInvisibleTypeAnnotations: // 0: #13(): CLASS_TYPE_PARAMETER_BOUND, param_index=0, bound_index=1 // bound_index is 1 because the bound is an interface, not a class String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "// Signature: <T::Ljava/lang/Comparable;>Ljava/lang/Object;\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"LocalVariableTypeTable\"\n" + " constant #15 utf8: \"LX<TT;>;\"\n" + " constant #16 utf8: \"SourceFile\"\n" + " constant #17 utf8: \"X.java\"\n" + " constant #18 utf8: \"Signature\"\n" + " constant #19 utf8: \"<T::Ljava/lang/Comparable;>Ljava/lang/Object;\"\n" + " constant #20 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #21 utf8: \"LNonNull;\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 4]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " Local variable type table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X<T>\n" + "\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #21 @NonNull(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // Bug 415543 - Incorrect bound index in RuntimeInvisibleTypeAnnotations attribute public void test034b() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.io.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "\n" + "class X <T extends Comparable & @NonNull Serializable> {\n" + " <T extends @NonNull Comparable> void one(T t) {}\n" + " <T extends Comparable & @NonNull Serializable> void two(T t) {}\n" + " <T extends @NonNull Comparable & @NonNull Serializable> void three(T t) {}\n" + " <T extends Object & @NonNull Serializable> void four(T t) {}\n" + " <T extends Object & @NonNull Serializable & @NonNull Runnable> void five(T t) {}\n" + "}\n", }, ""); String expectedOutput = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" + "// Signature: <T::Ljava/lang/Comparable;:Ljava/io/Serializable;>Ljava/lang/Object;\n" + "class X {\n" + " Constant pool:\n" + " constant #1 class: #2 X\n" + " constant #2 utf8: \"X\"\n" + " constant #3 class: #4 java/lang/Object\n" + " constant #4 utf8: \"java/lang/Object\"\n" + " constant #5 utf8: \"<init>\"\n" + " constant #6 utf8: \"()V\"\n" + " constant #7 utf8: \"Code\"\n" + " constant #8 method_ref: #3.#9 java/lang/Object.<init> ()V\n" + " constant #9 name_and_type: #5.#6 <init> ()V\n" + " constant #10 utf8: \"LineNumberTable\"\n" + " constant #11 utf8: \"LocalVariableTable\"\n" + " constant #12 utf8: \"this\"\n" + " constant #13 utf8: \"LX;\"\n" + " constant #14 utf8: \"LocalVariableTypeTable\"\n" + " constant #15 utf8: \"LX<TT;>;\"\n" + " constant #16 utf8: \"one\"\n" + " constant #17 utf8: \"(Ljava/lang/Comparable;)V\"\n" + " constant #18 utf8: \"Signature\"\n" + " constant #19 utf8: \"<T::Ljava/lang/Comparable;>(TT;)V\"\n" + " constant #20 utf8: \"t\"\n" + " constant #21 utf8: \"Ljava/lang/Comparable;\"\n" + " constant #22 utf8: \"TT;\"\n" + " constant #23 utf8: \"RuntimeInvisibleTypeAnnotations\"\n" + " constant #24 utf8: \"LNonNull;\"\n" + " constant #25 utf8: \"two\"\n" + " constant #26 utf8: \"<T::Ljava/lang/Comparable;:Ljava/io/Serializable;>(TT;)V\"\n" + " constant #27 utf8: \"three\"\n" + " constant #28 utf8: \"four\"\n" + " constant #29 utf8: \"(Ljava/lang/Object;)V\"\n" + " constant #30 utf8: \"<T:Ljava/lang/Object;:Ljava/io/Serializable;>(TT;)V\"\n" + " constant #31 utf8: \"Ljava/lang/Object;\"\n" + " constant #32 utf8: \"five\"\n" + " constant #33 utf8: \"<T:Ljava/lang/Object;:Ljava/io/Serializable;:Ljava/lang/Runnable;>(TT;)V\"\n" + " constant #34 utf8: \"SourceFile\"\n" + " constant #35 utf8: \"X.java\"\n" + " constant #36 utf8: \"<T::Ljava/lang/Comparable;:Ljava/io/Serializable;>Ljava/lang/Object;\"\n" + " \n" + " // Method descriptor #6 ()V\n" + " // Stack: 1, Locals: 1\n" + " X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [8]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 6]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " Local variable type table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X<T>\n" + " \n" + " // Method descriptor #17 (Ljava/lang/Comparable;)V\n" + " // Signature: <T::Ljava/lang/Comparable;>(TT;)V\n" + " // Stack: 0, Locals: 2\n" + " void one(java.lang.Comparable t);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: t index: 1 type: java.lang.Comparable\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " [pc: 0, pc: 1] local: t index: 1 type: T\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + " \n" + " // Method descriptor #17 (Ljava/lang/Comparable;)V\n" + " // Signature: <T::Ljava/lang/Comparable;:Ljava/io/Serializable;>(TT;)V\n" + " // Stack: 0, Locals: 2\n" + " void two(java.lang.Comparable t);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 8]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: t index: 1 type: java.lang.Comparable\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " [pc: 0, pc: 1] local: t index: 1 type: T\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 2\n" + " )\n" + " \n" + " // Method descriptor #17 (Ljava/lang/Comparable;)V\n" + " // Signature: <T::Ljava/lang/Comparable;:Ljava/io/Serializable;>(TT;)V\n" + " // Stack: 0, Locals: 2\n" + " void three(java.lang.Comparable t);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 9]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: t index: 1 type: java.lang.Comparable\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " [pc: 0, pc: 1] local: t index: 1 type: T\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 2\n" + " )\n" + " \n" + " // Method descriptor #29 (Ljava/lang/Object;)V\n" + " // Signature: <T:Ljava/lang/Object;:Ljava/io/Serializable;>(TT;)V\n" + " // Stack: 0, Locals: 2\n" + " void four(java.lang.Object t);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 10]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: t index: 1 type: java.lang.Object\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " [pc: 0, pc: 1] local: t index: 1 type: T\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + " \n" + " // Method descriptor #29 (Ljava/lang/Object;)V\n" + " // Signature: <T:Ljava/lang/Object;:Ljava/io/Serializable;:Ljava/lang/Runnable;>(TT;)V\n" + " // Stack: 0, Locals: 2\n" + " void five(java.lang.Object t);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 11]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: t index: 1 type: java.lang.Object\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X<T>\n" + " [pc: 0, pc: 1] local: t index: 1 type: T\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + " #24 @NonNull(\n" + " target type = 0x12 METHOD_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 2\n" + " )\n" + "\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #24 @NonNull(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 2\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test035() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "\n" + "class X {\n" + " void foo() {\n" + " @NonNull X [] x = new X[10];\n" + " System.out.println(x);\n" + " }\n" + "}\n", }, ""); String expectedOutput = " void foo();\n" + " 0 bipush 10\n" + " 2 anewarray X [1]\n" + " 5 astore_1 [x]\n" + " 6 getstatic java.lang.System.out : java.io.PrintStream [15]\n" + " 9 aload_1 [x]\n" + " 10 invokevirtual java.io.PrintStream.println(java.lang.Object) : void [21]\n" + " 13 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " [pc: 6, line: 8]\n" + " [pc: 13, line: 9]\n" + " Local variable table:\n" + " [pc: 0, pc: 14] local: this index: 0 type: X\n" + " [pc: 6, pc: 14] local: x index: 1 type: X[]\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #30 @NonNull(\n" + " target type = 0x40 LOCAL_VARIABLE\n" + " local variable entries:\n" + " [pc: 6, pc: 14] index: 1\n" + " location = [ARRAY]\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // test that parameter index does not include explicit this parameter. public void test036() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*; \n" + "@Target({TYPE_USE}) @interface NonNull { }\n" + "class X {\n" + " void foo(@NonNull X this, @NonNull X x) {\n" + " }\n" + "}\n", }, ""); String expectedOutput = " void foo(X x);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 6]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: x index: 1 type: X\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #18 @NonNull(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " )\n" + " #18 @NonNull(\n" + " target type = 0x15 METHOD_RECEIVER\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test037() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@interface Readonly {\n" + " String value() default \"default\";\n" + "}\n" + "public class X {\n" + " X [] x = new @Readonly X @Readonly [10];\n" + "}\n", }, ""); String expectedOutput = " public X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [10]\n" + " 4 aload_0 [this]\n" + " 5 bipush 10\n" + " 7 anewarray X [1]\n" + " 10 putfield X.x : X[] [12]\n" + " 13 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " [pc: 4, line: 8]\n" + " [pc: 13, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 14] local: this index: 0 type: X\n" + " RuntimeVisibleTypeAnnotations: \n" + " #19 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 7\n" + " location = [ARRAY]\n" + " )\n" + " #19 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 7\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // test anonymous class, the class itself should have class_extends target ? public void test038() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@interface Readonly {\n" + " String value() default \"default\";\n" + "}\n" + "public class X {\n" + " X x = new @Readonly X() {\n" + " };\n" + "}\n", }, ""); String expectedOutput = " public X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [10]\n" + " 4 aload_0 [this]\n" + " 5 new X$1 [12]\n" + " 8 dup\n" + " 9 aload_0 [this]\n" + " 10 invokespecial X$1(X) [14]\n" + " 13 putfield X.x : X [17]\n" + " 16 return\n" + " Line numbers:\n" + " [pc: 0, line: 7]\n" + " [pc: 4, line: 8]\n" + " [pc: 16, line: 7]\n" + " Local variable table:\n" + " [pc: 0, pc: 17] local: this index: 0 type: X\n" + " RuntimeVisibleTypeAnnotations: \n" + " #23 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 5\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test039() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.List;\n" + "@Target(ElementType.TYPE_USE)\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@interface Readonly {\n" + " String value() default \"default\";\n" + "}\n" + "public class X { \n" + " void foo(List<@Readonly ?> l) {\n" + " }\n" + "}\n", }, ""); String expectedOutput = " void foo(java.util.List l);\n" + " 0 return\n" + " Line numbers:\n" + " [pc: 0, line: 10]\n" + " Local variable table:\n" + " [pc: 0, pc: 1] local: this index: 0 type: X\n" + " [pc: 0, pc: 1] local: l index: 1 type: java.util.List\n" + " Local variable type table:\n" + " [pc: 0, pc: 1] local: l index: 1 type: java.util.List<?>\n" + " RuntimeVisibleTypeAnnotations: \n" + " #23 @Readonly(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test040() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@interface Readonly {\n" + " String value() default \"default\";\n" + "}\n" + "class X {\n" + " class Y {}\n" + " void foo() {\n" + " @Readonly X x = new X();\n" + " x.new @Readonly Y();\n" + " }\n" + "}\n", }, ""); String expectedOutput = " RuntimeVisibleTypeAnnotations: \n" + " #27 @Readonly(\n" + " target type = 0x44 NEW\n" + " offset = 8\n" + " location = [INNER_TYPE]\n" + " )\n" + " #27 @Readonly(\n" + " target type = 0x40 LOCAL_VARIABLE\n" + " local variable entries:\n" + " [pc: 8, pc: 21] index: 1\n" + " )\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test041() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface A {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface B {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface C {\n" + " String value() default \"default\";\n" + "}\n" + "class X<T extends @A Object & @B Comparable, U extends @C Cloneable> {\n" + "}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #21 @A(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 0\n" + " )\n" + " #22 @B(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 0 type parameter bound index = 1\n" + " )\n" + " #23 @C(\n" + " target type = 0x11 CLASS_TYPE_PARAMETER_BOUND\n" + " type parameter index = 1 type parameter bound index = 1\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // type path tests. public void test042() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "import java.util.List;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface A {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface B {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface C {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface D {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface E {\n" + " String value() default \"default\";\n" + "}\n" + "class X {\n" + " @A Map <@B ? extends @C String, @D List<@E Object>> f;\n" + "}\n", }, ""); String expectedOutput = " java.util.Map f;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @A(\n" + " target type = 0x13 FIELD\n" + " )\n" + " #11 @B(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #12 @C(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), WILDCARD]\n" + " )\n" + " #13 @D(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1)]\n" + " )\n" + " #14 @E(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" + " )\n" + " \n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // Bug 414384 - [1.8] type annotation on abbreviated inner class is not marked as inner type public void test043() throws Exception { this.runConformTest( new String[] { "pkg/Clazz.java", "package pkg;\n" + "import java.lang.annotation.*;\n" + "import static java.lang.annotation.ElementType.*;\n" + "\n" + "@Target({TYPE_USE}) @interface P { }\n" + "@Target({TYPE_USE}) @interface O { }\n" + "@Target({TYPE_USE}) @interface I { }\n" + "\n" + "public abstract class Clazz {\n" + " public class Inner {}\n" + " public abstract void n1(@I Inner i1);\n" + " public abstract void n2(@O Clazz.@I Inner i2);\n" + " public abstract void n3(pkg.@O Clazz.@I Inner i3);\n" + "}\n", }, ""); // javac b100 produces for the methods: // public abstract void n1(pkg.Clazz$Inner); // RuntimeInvisibleTypeAnnotations: // 0: #14(): METHOD_FORMAL_PARAMETER, param_index=0, location=[INNER_TYPE] // // public abstract void n2(pkg.Clazz$Inner); // RuntimeInvisibleTypeAnnotations: // 0: #14(): METHOD_FORMAL_PARAMETER, param_index=0, location=[INNER_TYPE] // 1: #16(): METHOD_FORMAL_PARAMETER, param_index=0 // // public abstract void n3(pkg.Clazz$Inner); // RuntimeInvisibleTypeAnnotations: // 0: #14(): METHOD_FORMAL_PARAMETER, param_index=0, location=[INNER_TYPE] // 1: #16(): METHOD_FORMAL_PARAMETER, param_index=0 String expectedOutput = " // Method descriptor #15 (Lpkg/Clazz$Inner;)V\n" + " public abstract void n1(pkg.Clazz.Inner arg0);\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #17 @pkg.I(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [INNER_TYPE]\n" + " )\n" + " \n" + " // Method descriptor #15 (Lpkg/Clazz$Inner;)V\n" + " public abstract void n2(pkg.Clazz.Inner arg0);\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #19 @pkg.O(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " )\n" + " #17 @pkg.I(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [INNER_TYPE]\n" + " )\n" + " \n" + " // Method descriptor #15 (Lpkg/Clazz$Inner;)V\n" + " public abstract void n3(pkg.Clazz.Inner arg0);\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #19 @pkg.O(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " )\n" + " #17 @pkg.I(\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [INNER_TYPE]\n" + " )\n" + "\n" + " Inner classes:\n" + " [inner class info: #24 pkg/Clazz$Inner, outer class info: #1 pkg/Clazz\n" + " inner name: #26 Inner, accessflags: 1 public]\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "pkg" + File.separator + "Clazz.class", "pkg.Clazz", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // More type path tests public void test044() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface I {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface F {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface G {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface H {\n" + " String value() default \"default\";\n" + "}\n" + "class X {\n" + " @I String @F [] @G [] @H [] f;\n" + "}\n", }, ""); String expectedOutput = " // Field descriptor #6 [[[Ljava/lang/String;\n" + " java.lang.String[][][] f;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @I(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY, ARRAY, ARRAY]\n" + " )\n" + " #9 @F(\n" + " target type = 0x13 FIELD\n" + " )\n" + " #10 @G(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY]\n" + " )\n" + " #11 @H(\n" + " target type = 0x13 FIELD\n" + " location = [ARRAY, ARRAY]\n" + " )\n" + " \n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // More type path tests public void test045() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface M {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface L {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface K {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface J {\n" + " String value() default \"default\";\n" + "}\n" + "class O1 {\n" + " class O2 {\n" + " class O3 {\n" + " class Nested {}\n" + " }\n" + " }\n" + "}\n" + "class X {\n" + " @M O1.@L O2.@K O3.@J Nested f = null;\n" + "}\n", }, ""); String expectedOutput = " // Field descriptor #6 LO1$O2$O3$Nested;\n" + " O1$O2$O3$Nested f;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #8 @M(\n" + " target type = 0x13 FIELD\n" + " )\n" + " #9 @L(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE]\n" + " )\n" + " #10 @K(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE]\n" + " )\n" + " #11 @J(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE]\n" + " )\n" + " \n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // More type path tests public void test046() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.Map;\n" + "import java.util.List;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface A {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface B {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface C {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface D {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface E {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface F {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface G {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface H {\n" + " String value() default \"default\";\n" + "}\n" + "class Document {}\n" + "class X {\n" + " @A Map<@B Comparable<@F Object @C [] @D [] @E[]>, @G List<@H Document>> f;\n" + "}\n", }, ""); String expectedOutput = " java.util.Map f;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @A(\n" + " target type = 0x13 FIELD\n" + " )\n" + " #11 @B(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #12 @F(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY, ARRAY, ARRAY]\n" + " )\n" + " #13 @C(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]\n" + " )\n" + " #14 @D(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY]\n" + " )\n" + " #15 @E(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY, ARRAY]\n" + " )\n" + " #16 @G(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1)]\n" + " )\n" + " #17 @H(\n" + " target type = 0x13 FIELD\n" + " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" + " )\n" + " \n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } // More type path tests public void test047() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface A {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface B {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface C {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface D {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface E {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface F {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface G {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface H {\n" + " String value() default \"default\";\n" + "}\n" + "class O1 {\n" + " class O2<S, T> {\n" + " class O3 {\n" + " class Nested<K, V> {\n" + " }\n" + " }\n" + " }\n" + "}\n" + " class S {}\n" + " class T {}\n" + " class U {}\n" + " class V {}\n" + "class X {\n" + " @H O1.@E O2<@F S, @G T>.@D O3.@A Nested<@B U, @C V> f;\n" + "}\n", }, ""); String expectedOutput = " // Field descriptor #6 LO1$O2$O3$Nested;\n" + " // Signature: LO1$O2<LS;LT;>.O3.Nested<LU;LV;>;\n" + " O1$O2$O3$Nested f;\n" + " RuntimeInvisibleTypeAnnotations: \n" + " #10 @H(\n" + " target type = 0x13 FIELD\n" + " )\n" + " #11 @E(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE]\n" + " )\n" + " #12 @D(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE]\n" + " )\n" + " #13 @A(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE]\n" + " )\n" + " #14 @F(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, TYPE_ARGUMENT(0)]\n" + " )\n" + " #15 @G(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, TYPE_ARGUMENT(1)]\n" + " )\n" + " #16 @B(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE, TYPE_ARGUMENT(0)]\n" + " )\n" + " #17 @C(\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE, TYPE_ARGUMENT(1)]\n" + " )\n" + " \n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test048() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface Readonly {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface NonNull {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface NonEmpty {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface D {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface E {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface F {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface G {\n" + " String value() default \"default\";\n" + "}\n" + "@Target(ElementType.TYPE_USE)\n" + "@interface H {\n" + " String value() default \"default\";\n" + "}\n" + "\n" + "abstract class X implements @Readonly Map<@NonNull String, @NonEmpty List<@NonNull @Readonly String>> {}\n", }, ""); String expectedOutput = " RuntimeInvisibleTypeAnnotations: \n" + " #21 @Readonly(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " )\n" + " #22 @NonNull(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " location = [TYPE_ARGUMENT(0)]\n" + " )\n" + " #23 @NonEmpty(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " location = [TYPE_ARGUMENT(1)]\n" + " )\n" + " #22 @NonNull(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" + " )\n" + " #21 @Readonly(\n" + " target type = 0x10 CLASS_EXTENDS\n" + " type index = 0\n" + " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" + " )\n" + "}"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } public void test049() throws Exception { this.runConformTest( new String[] { "X.java", "import java.lang.annotation.*;\n" + "@Target(ElementType.TYPE_USE)\n" + "@Retention(RetentionPolicy.RUNTIME)\n" + "@interface B { int value() default -1; }\n" + "public class X {\n" + " class Y {\n" + " }\n" + " @B(1) X. @B(2) Y xy;\n" + " void foo(@B(3) X. @B(4) Y xy) {\n" + " @B(5) X. @B(6) Y local = null; \n" + " }\n" + "}\n", }, ""); String expectedOutput = " // Field descriptor #6 LX$Y;\n" + " X$Y xy;\n" + " RuntimeVisibleTypeAnnotations: \n" + " #8 @B(\n" + " #9 value=(int) 1 (constant type)\n" + " target type = 0x13 FIELD\n" + " )\n" + " #8 @B(\n" + " #9 value=(int) 2 (constant type)\n" + " target type = 0x13 FIELD\n" + " location = [INNER_TYPE]\n" + " )\n" + " \n" + " // Method descriptor #13 ()V\n" + " // Stack: 1, Locals: 1\n" + " public X();\n" + " 0 aload_0 [this]\n" + " 1 invokespecial java.lang.Object() [15]\n" + " 4 return\n" + " Line numbers:\n" + " [pc: 0, line: 5]\n" + " Local variable table:\n" + " [pc: 0, pc: 5] local: this index: 0 type: X\n" + " \n" + " // Method descriptor #22 (LX$Y;)V\n" + " // Stack: 1, Locals: 3\n" + " void foo(X.Y xy);\n" + " 0 aconst_null\n" + " 1 astore_2 [local]\n" + " 2 return\n" + " Line numbers:\n" + " [pc: 0, line: 10]\n" + " [pc: 2, line: 11]\n" + " Local variable table:\n" + " [pc: 0, pc: 3] local: this index: 0 type: X\n" + " [pc: 0, pc: 3] local: xy index: 1 type: X.Y\n" + " [pc: 2, pc: 3] local: local index: 2 type: X.Y\n" + " RuntimeVisibleTypeAnnotations: \n" + " #8 @B(\n" + " #9 value=(int) 5 (constant type)\n" + " target type = 0x40 LOCAL_VARIABLE\n" + " local variable entries:\n" + " [pc: 2, pc: 3] index: 2\n" + " )\n" + " #8 @B(\n" + " #9 value=(int) 6 (constant type)\n" + " target type = 0x40 LOCAL_VARIABLE\n" + " local variable entries:\n" + " [pc: 2, pc: 3] index: 2\n" + " location = [INNER_TYPE]\n" + " )\n" + " RuntimeVisibleTypeAnnotations: \n" + " #8 @B(\n" + " #9 value=(int) 3 (constant type)\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " )\n" + " #8 @B(\n" + " #9 value=(int) 4 (constant type)\n" + " target type = 0x16 METHOD_FORMAL_PARAMETER\n" + " method parameter index = 0\n" + " location = [INNER_TYPE]\n" + " )\n" + "\n"; checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM); } }
e43d78029e96c890ecc0255857d143d33ed67cdb
58a3d797bfc13ff8d4e960aafa97a7816e4e76f4
/app/src/main/java/com/ys/administrator/mydemo/util/WeiXinUtil.java
c284227513a5fc3537da4f87288463b892033b14
[]
no_license
YsInHZ/MyPublicFarm
3c53769cd88e150e3965b22ae58a7bd5014ea78e
7fe40fbf24dd01f65ffb939d2c2b4d120d962b56
refs/heads/master
2020-04-11T07:23:38.570540
2019-03-24T15:43:32
2019-03-24T15:43:32
161,608,767
0
0
null
null
null
null
UTF-8
Java
false
false
2,728
java
package com.ys.administrator.mydemo.util; import android.graphics.Bitmap; import com.ys.administrator.mydemo.application.MyApplication; import com.tencent.mm.opensdk.modelmsg.SendAuth; import com.tencent.mm.opensdk.modelmsg.SendMessageToWX; import com.tencent.mm.opensdk.modelmsg.WXImageObject; import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; import com.tencent.mm.opensdk.modelmsg.WXWebpageObject; import com.tencent.mm.opensdk.openapi.IWXAPI; import com.tencent.mm.opensdk.openapi.WXAPIFactory; /** * 微信工具类 * Created by Administrator on 2018/8/2. */ public class WeiXinUtil { public static IWXAPI api = null; public static IWXAPI getIWXAPI() { if(api==null){ api = WXAPIFactory.createWXAPI(MyApplication.getInstance(),Constant.APP_ID,true); api.registerApp(Constant.APP_ID); } return api; } /** * 微信登录 */ public static void WXLogin(){ if(api==null){ getIWXAPI(); } SendAuth.Req req = new SendAuth.Req(); req.scope = "snsapi_userinfo"; req.state = "wechat_gengnong_login"; api.sendReq(req); } /** * 分享APP * @param aa 分享类型:SendMessageToWX.Req.WXSceneTimeline朋友圈 WXSceneSession对话 */ public static void share(int aa){//SendMessageToWX.Req.WXSceneTimeline WXSceneSession if(api==null){ getIWXAPI(); } WXWebpageObject webpage = new WXWebpageObject(); webpage.webpageUrl = "https://www.hzmyxf119.com/static/app-release.apk"; WXMediaMessage msg = new WXMediaMessage(webpage); msg.title = "名邑消防"; msg.description = "加入名邑消防,开启智慧管理"; SendMessageToWX.Req req = new SendMessageToWX.Req(); req.message = msg; req.scene = aa; api.sendReq(req); } /** * 分享图片 * @param bitmap * @param aa 分享类型:SendMessageToWX.Req.WXSceneTimeline朋友圈 WXSceneSession对话 */ public static void share(Bitmap bitmap, int aa){ if(api==null){ getIWXAPI(); } WXImageObject imageObject = new WXImageObject(bitmap); WXMediaMessage msg = new WXMediaMessage(); msg.title = "极客耘耕"; msg.description = "扫码加入我的农场吧"; msg.mediaObject = imageObject; SendMessageToWX.Req req= new SendMessageToWX.Req(); // req.transaction = System.currentTimeMillis()+""+Constant.getUSERID(); req.message = msg; req.scene = aa; api.sendReq(req); } public static void detach(){ api.detach(); api = null; } }
[ "[email protected]:zhizhuokeji/jikeyungeng-android.git" ]
[email protected]:zhizhuokeji/jikeyungeng-android.git
05e745453b95f461601bc7088d3cbba90c028d93
f1c9396ced5f7b88ab74f66e1404ef803c41eec8
/myspring2.0/src/main/java/com/gupao/gp17190/springframework/aop/config/MyAopConfig.java
1b86dedbd35cdf3c106ec29d45c8b24faaaf961a
[]
no_license
phaetonlai/gupaoedu
ebcc1c58ef7f39b835b02d15128368d2b17a634b
1c7810e1e8ee06322220129e05e912f18ed93a5a
refs/heads/master
2022-12-22T22:13:13.017043
2020-03-11T08:46:16
2020-03-11T08:46:16
174,681,423
0
1
null
2022-12-16T04:09:40
2019-03-09T10:46:55
Java
UTF-8
Java
false
false
1,558
java
package com.gupao.gp17190.springframework.aop.config; /** * @Author laihui * @Date 2019/4/28 * @Desc * @Version 1.0 **/ public class MyAopConfig { private String pointCut; private String aspectBefore; private String aspectAfter; private String aspectClass; private String aspectAfterThrow; private String aspectAfterThrowingName; public String getPointCut() { return pointCut; } public void setPointCut(String pointCut) { this.pointCut = pointCut; } public String getAspectBefore() { return aspectBefore; } public void setAspectBefore(String aspectBefore) { this.aspectBefore = aspectBefore; } public String getAspectAfter() { return aspectAfter; } public void setAspectAfter(String aspectAfter) { this.aspectAfter = aspectAfter; } public String getAspectClass() { return aspectClass; } public void setAspectClass(String aspectClass) { this.aspectClass = aspectClass; } public String getAspectAfterThrow() { return aspectAfterThrow; } public void setAspectAfterThrow(String aspectAfterThrow) { this.aspectAfterThrow = aspectAfterThrow; } public String getAspectAfterThrowingName() { return aspectAfterThrowingName; } public void setAspectAfterThrowingName(String aspectAfterThrowingName) { this.aspectAfterThrowingName = aspectAfterThrowingName; } }
ce85b7243baf5c84c085910673a68524b5e14b64
eb06eb728146187562707f17fe890205aec811d8
/tnt4j-streams-core/src/main/java/com/jkoolcloud/tnt4j/streams/configure/OutputProperties.java
c4e40f77a138fa29b5aa7c65cf44cdb9d5fa4fd9
[ "Apache-2.0" ]
permissive
oustoyev/tnt4j-streams
f852db4e523b0eb655ff1e8541c4ae9bc6275032
3c8cd793f901548d5794802ef98e1b821861b405
refs/heads/master
2020-05-02T21:45:46.367080
2019-03-28T10:45:10
2019-03-28T10:45:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,144
java
/* * Copyright 2014-2018 JKOOL, LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jkoolcloud.tnt4j.streams.configure; /** * Lists predefined property names used by TNT4-Streams outputs. * * @version $Revision: 1 $ */ public interface OutputProperties { /** * Constant for name of built-in {@value} property. */ String PROP_TNT4J_CONFIG_FILE = "TNT4JConfigFile"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_TNT4J_PROPERTY = "TNT4JProperty"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_RESOLVE_SERVER = "ResolveServerFromDNS"; // NON-NLS /** * Constant for name of built-in {@value} property. * * @deprecated use {@link #PROP_SPLIT_RELATIVES} instead */ @Deprecated String PROP_TURN_OUT_CHILDREN = "TurnOutActivityChildren"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_SPLIT_RELATIVES = "SplitRelatives"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_BUILD_FQN_FROM_DATA = "BuildSourceFQNFromStreamedData"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_TNT4J_CONFIG_ZK_NODE = "TNT4JConfigZKNode"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_SOURCE_FQN = "SourceFQN"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_RETRY_STATE_CHECK = "RetryStateCheck"; // NON-NLS /** * Constant for name of built-in {@value} property. */ String PROP_SEND_STREAM_STATES = "SendStreamStates"; // NON-NLS }
1dbc000dc21723c96e2eca822f88b8efb0d947b8
d9fbd35c03bcc26422ede68738e2950b180fc092
/bower_components/cometd-jquery/cometd-java/cometd-java-server/src/test/java/org/cometd/server/ConcurrentConnectDisconnectTest.java
7acbd5b252a27004806e9dcaa1df4722ea9fe7f8
[]
no_license
barrackboy/work-stuff
598234f1537b1e5c1d2674669b00910541be0450
0f6ae62f9f4647f0185607fce7888a0ae9a38556
refs/heads/master
2021-01-17T17:52:45.794607
2016-10-28T08:32:24
2016-10-28T08:32:24
70,683,389
0
0
null
null
null
null
UTF-8
Java
false
false
10,601
java
/* * Copyright (c) 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cometd.server; import java.util.Map; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; import org.cometd.bayeux.Channel; import org.cometd.bayeux.Message; import org.cometd.bayeux.server.ServerChannel; import org.cometd.bayeux.server.ServerMessage; import org.cometd.bayeux.server.ServerSession; import org.cometd.common.JettyJSONContextClient; import org.cometd.server.transport.JSONTransport; import org.eclipse.jetty.client.ContentExchange; import org.eclipse.jetty.client.HttpExchange; import org.eclipse.jetty.http.HttpHeaders; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class ConcurrentConnectDisconnectTest extends AbstractBayeuxClientServerTest { @Before public void prepare() throws Exception { startServer(null); } @Test public void testConnectListenerThenDisconnectThenConnectHandler() throws Exception { final CountDownLatch connectLatch = new CountDownLatch(2); final CountDownLatch disconnectLatch = new CountDownLatch(1); bayeux.getChannel("/meta/connect").addListener(new ServerChannel.MessageListener() { public boolean onMessage(ServerSession from, ServerChannel channel, ServerMessage.Mutable message) { connectLatch.countDown(); if (connectLatch.getCount() == 0) await(disconnectLatch); return true; } }); ContentExchange handshake = newBayeuxExchange("[{" + "\"channel\": \"/meta/handshake\"," + "\"version\": \"1.0\"," + "\"minimumVersion\": \"1.0\"," + "\"supportedConnectionTypes\": [\"long-polling\"]" + "}]"); httpClient.send(handshake); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, handshake.waitForDone()); Assert.assertEquals(200, handshake.getResponseStatus()); String clientId = extractClientId(handshake); String bayeuxCookie = extractBayeuxCookie(handshake); String channelName = "/foo"; ContentExchange subscribe = newBayeuxExchange("[{" + "\"clientId\": \"" + clientId + "\"," + "\"channel\": \"/meta/subscribe\"," + "\"subscription\": \"" + channelName + "\"" + "}]"); httpClient.send(subscribe); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, subscribe.waitForDone()); Assert.assertEquals(200, subscribe.getResponseStatus()); ContentExchange connect1 = newBayeuxExchange("[{" + "\"channel\": \"/meta/connect\"," + "\"clientId\": \"" + clientId + "\"," + "\"connectionType\": \"long-polling\"" + "}]"); connect1.setRequestHeader(HttpHeaders.COOKIE, bayeuxCookie); httpClient.send(connect1); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, connect1.waitForDone()); Assert.assertEquals(200, connect1.getResponseStatus()); ContentExchange connect2 = newBayeuxExchange("[{" + "\"channel\": \"/meta/connect\"," + "\"clientId\": \"" + clientId + "\"," + "\"connectionType\": \"long-polling\"" + "}]"); connect2.setRequestHeader(HttpHeaders.COOKIE, bayeuxCookie); httpClient.send(connect2); // Wait for the second connect to arrive, then disconnect Assert.assertTrue(connectLatch.await(5, TimeUnit.SECONDS)); ContentExchange disconnect = newBayeuxExchange("[{" + "\"channel\": \"/meta/disconnect\"," + "\"clientId\": \"" + clientId + "\"" + "}]"); httpClient.send(disconnect); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, disconnect.waitForDone()); Assert.assertEquals(200, disconnect.getResponseStatus()); disconnectLatch.countDown(); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, connect2.waitForDone()); Assert.assertEquals(200, connect2.getResponseStatus()); JettyJSONContextClient parser = new JettyJSONContextClient(); Message.Mutable connectReply2 = parser.parse(connect2.getResponseContent())[0]; String error = (String)connectReply2.get(Message.ERROR_FIELD); Assert.assertNotNull(error); Assert.assertTrue(error.toLowerCase().contains("unknown")); Map<String,Object> advice = connectReply2.getAdvice(); Assert.assertNotNull(advice); Assert.assertEquals(Message.RECONNECT_NONE_VALUE, advice.get(Message.RECONNECT_FIELD)); Assert.assertNull(bayeux.getSession(clientId)); // Test that sending a connect for an expired session // will return an advice with reconnect:"handshake" ContentExchange connect3 = newBayeuxExchange("[{" + "\"channel\": \"/meta/connect\"," + "\"clientId\": \"" + clientId + "\"," + "\"connectionType\": \"long-polling\"" + "}]"); connect3.setRequestHeader(HttpHeaders.COOKIE, bayeuxCookie); httpClient.send(connect3); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, connect3.waitForDone()); Assert.assertEquals(200, connect3.getResponseStatus()); Message.Mutable connectReply3 = parser.parse(connect3.getResponseContent())[0]; advice = connectReply3.getAdvice(); Assert.assertNotNull(advice); Assert.assertEquals(Message.RECONNECT_HANDSHAKE_VALUE, advice.get(Message.RECONNECT_FIELD)); } @Test public void testConnectHandlerThenDisconnect() throws Exception { final CountDownLatch connectLatch = new CountDownLatch(2); final CountDownLatch disconnectLatch = new CountDownLatch(1); final CountDownLatch suspendLatch = new CountDownLatch(1); bayeux.setTransports(new JSONTransport(bayeux) { { init(); } @Override protected ServerMessage.Mutable bayeuxServerHandle(ServerSessionImpl session, ServerMessage.Mutable message) { ServerMessage.Mutable reply = super.bayeuxServerHandle(session, message); if (Channel.META_CONNECT.equals(message.getChannel())) { connectLatch.countDown(); if (connectLatch.getCount() == 0) await(disconnectLatch); } return reply; } @Override protected void metaConnectSuspended(HttpServletRequest request, ServerSession session, long timeout) { suspendLatch.countDown(); } }); ContentExchange handshake = newBayeuxExchange("[{" + "\"channel\": \"/meta/handshake\"," + "\"version\": \"1.0\"," + "\"minimumVersion\": \"1.0\"," + "\"supportedConnectionTypes\": [\"long-polling\"]" + "}]"); httpClient.send(handshake); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, handshake.waitForDone()); Assert.assertEquals(200, handshake.getResponseStatus()); String clientId = extractClientId(handshake); String bayeuxCookie = extractBayeuxCookie(handshake); String channelName = "/foo"; ContentExchange subscribe = newBayeuxExchange("[{" + "\"clientId\": \"" + clientId + "\"," + "\"channel\": \"/meta/subscribe\"," + "\"subscription\": \"" + channelName + "\"" + "}]"); httpClient.send(subscribe); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, subscribe.waitForDone()); Assert.assertEquals(200, subscribe.getResponseStatus()); ContentExchange connect1 = newBayeuxExchange("[{" + "\"channel\": \"/meta/connect\"," + "\"clientId\": \"" + clientId + "\"," + "\"connectionType\": \"long-polling\"" + "}]"); connect1.setRequestHeader(HttpHeaders.COOKIE, bayeuxCookie); httpClient.send(connect1); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, connect1.waitForDone()); Assert.assertEquals(200, connect1.getResponseStatus()); ContentExchange connect2 = newBayeuxExchange("[{" + "\"channel\": \"/meta/connect\"," + "\"clientId\": \"" + clientId + "\"," + "\"connectionType\": \"long-polling\"" + "}]"); connect2.setRequestHeader(HttpHeaders.COOKIE, bayeuxCookie); httpClient.send(connect2); // Wait for the second connect to arrive, then disconnect Assert.assertTrue(connectLatch.await(5, TimeUnit.SECONDS)); ContentExchange disconnect = newBayeuxExchange("[{" + "\"channel\": \"/meta/disconnect\"," + "\"clientId\": \"" + clientId + "\"" + "}]"); httpClient.send(disconnect); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, disconnect.waitForDone()); Assert.assertEquals(200, disconnect.getResponseStatus()); disconnectLatch.countDown(); // The connect must not be suspended Assert.assertFalse(suspendLatch.await(1, TimeUnit.SECONDS)); Assert.assertEquals(HttpExchange.STATUS_COMPLETED, connect2.waitForDone()); Assert.assertEquals(200, connect2.getResponseStatus()); Assert.assertTrue(connect2.getResponseContent().toLowerCase().contains("\"none\"")); Assert.assertNull(bayeux.getSession(clientId)); } private void await(CountDownLatch latch) { try { latch.await(); } catch (InterruptedException x) { Thread.currentThread().interrupt(); } } }
afde394f11ced9627b52b776302661a5548c644d
e05a290f18b0ae8089709f4fbe92f3f49042daee
/kernel/kernel-core/src/main/java/io/mosip/kernel/core/idgenerator/spi/UinGenerator.java
ec498019af46df3a437ed6af132c85f3bf99f1a9
[]
no_license
Aswin-MN/personal
25e6d6bf306e61a236d0ea886d33ea621bb7dc56
d096fa6ab16e13a66a82be0325cf4d117d3669f3
refs/heads/master
2021-10-11T16:24:08.604019
2019-01-28T12:52:41
2019-01-28T12:52:41
166,238,628
0
1
null
null
null
null
UTF-8
Java
false
false
327
java
package io.mosip.kernel.core.idgenerator.spi; /** * Interface having a function to generate an Id * * @author Dharmesh Khandelwal * @since 1.0.0 * * @param <T> * Type of Id */ public interface UinGenerator<T> { /** * Function to generate an Id * * @return The generated id */ T generateId(); }
f0a15c452fd8956891caebbf8a3451c62c514c8b
91ff59f4d545662a442219de8dc235fa8f495877
/TeamManager/src/com/sns/teammgr/action/EventDeleteAction.java
21aa752a36d9c29e594d747de7283c0e555a6ceb
[]
no_license
robbroadhead/OpenCode
1a277454a639a0fbc080806c86f8d32e2831d1aa
27739f83369901157a6033d08fe892f4425f7cd9
refs/heads/master
2021-01-10T05:17:11.893802
2016-03-31T19:34:03
2016-03-31T19:34:03
55,176,885
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
2,736
java
package com.sns.teammgr.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.torque.Torque; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; import com.sns.teammgr.managers.EventPeer; /** * The controller class for the Link delete action * ******************************************************************* * Copyright Notice: * Copyright © 2007 Sleepless Nights Software, Inc. * All Rights Reserved. * * This computer program is protected by copyright law and * international treaties. Unauthorized use or distribution of * this program, or any portion of it is strictly prohibited. * Violation may result in severe civil or criminal penalties. ******************************************************************* * */ public final class EventDeleteAction extends Action { /** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param actionForm The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * * @exception Exception if business logic throws an exception */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Basic cleanup to keep the session as thin as possible request.getSession().removeAttribute("curlist"); if (!Torque.isInit()) { Torque.init("/usr/conf/Teammgr.properties"); } // Make sure the user has logged in. if (request.getSession().getAttribute("teammgr.User") == null) { return mapping.findForward("failure"); } EventPeer.delete(request.getParameter("id")); // Remove the Form Bean - don't need to carry values forward request.removeAttribute(mapping.getAttribute()); // Forward control to the specified success URI ActionMessages msgs = new ActionMessages(); msgs.add("success",new ActionMessage("general.delete.success")); saveMessages(request,msgs); // Assume success if we have reached this point return mapping.findForward("success"); } }