blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
9b2e64d882dda687d985aa5ce294e5f6117fa5a4
e0d7735213b7b12da5bccb47b766028bfde5308f
/src/com/lagerverwaltung/AddInventoryItem.java
dce7dba90cbc75b783cd30664473aa1dcf128dd1
[]
no_license
lucashoeft/lagerverwaltungssystem
7145713ea9d9b28e2964a52732a7779e1f05d57f
e3c294ce25146ea88171d3489d996cccbbbc5332
refs/heads/master
2023-04-26T02:36:42.118885
2021-05-27T14:22:11
2021-05-27T14:22:11
226,292,846
0
1
null
null
null
null
UTF-8
Java
false
false
4,872
java
package com.lagerverwaltung; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * The AddInventoryItem class is responsible for letting the user create new inventory items. */ public class AddInventoryItem { /** * The boolean value which shows if the create button was clicked. */ private Boolean acceptButtonClicked = false; /** * The panel holds the labels and text fields which are used for putting the attributes in for the new inventory * item. */ private InventoryItemInputPanel inputPanel = new InventoryItemInputPanel(App.getInventory().getCategoryMap()); /** * The button to close dialog without creating a new inventory item. */ private JButton dismissButton = new JButton("Abbrechen"); /** * The button to trigger the save event and to close the dialog. */ private JButton acceptButton = new JButton("Erstellen"); /** * The dialog which holds all the components of the graphical user interface. */ private JDialog dialog; /** * The constructor for the AddInventoryItem class. * * <p>It initialises the dialog window and all components of the graphical user interface. It also connects the * buttons to the action listeners. */ public AddInventoryItem() { dialog = new JDialog(); dialog.setResizable(false); dialog.setTitle("Artikel erstellen"); dialog.setSize(340,260); dialog.setLocationRelativeTo(null); dialog.setModal(true); JPanel buttonPanel = new JPanel(); ActionListener buttonListener = new ButtonListener(); acceptButton.addActionListener(buttonListener); dismissButton.addActionListener(buttonListener); buttonPanel.add(dismissButton); buttonPanel.add(acceptButton); dialog.add(inputPanel, BorderLayout.CENTER); dialog.add(buttonPanel, BorderLayout.SOUTH); dialog.pack(); dialog.setVisible(true); } /** * Returns the boolean value if create button was clicked. * * @return true if create button was clicked */ public Boolean isAcceptButtonClicked() { return this.acceptButtonClicked; } /** * The ButtonListener class implements the ActionListener interface and adds the functionality to dismiss and create * a new inventory item. */ class ButtonListener implements ActionListener { /** * Invoked when an action occurs. * * <p>This method detects which button was pressed and reacts accordingly. It tries to save the inventory item * if the accept button was clicked and shows an error message if saving was not possible. * * @param e the event that occurred */ @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == dismissButton) { acceptButtonClicked = false; dialog.dispose(); } if (e.getSource() == acceptButton) { try { InventoryItem item = new InventoryItem( inputPanel.getDescription(), inputPanel.getCategory(), inputPanel.getStock(), inputPanel.getItemLocation(), inputPanel.getWeight(), inputPanel.getPrice() ); if (App.getInventory().addNewItem(item)) { acceptButtonClicked = true; dialog.dispose(); } else { showErrorOptionPane("Der Artikel konnte dem Lagerbestand nicht hinzugefügt werden.\n" + "Die Produktbezeichnung und der Lagerort müssen eindeutig sein\n" + "und das Regalgewicht darf 10.000.000 g nicht überschreiten"); } } catch (IllegalArgumentException iae){ showErrorOptionPane(iae.getMessage()); } catch (NullPointerException npe) { showErrorOptionPane("Es muss erst eine Kategorie erstellt werden, bevor ein Artikel erstellt werden kann."); } } } } /** * Shows the custom error message to the user above every other JDialog or JFrame. * * @param message the error message that shall be shown */ private void showErrorOptionPane(String message) { final JDialog messageDialog = new JDialog(); messageDialog.setAlwaysOnTop(true); JOptionPane.showMessageDialog(messageDialog,message,"Fehler beim Erstellen eines Artikels",JOptionPane.ERROR_MESSAGE); } }
[ "lucashoeft@icloud.com" ]
lucashoeft@icloud.com
57928cc156da814c6eaf1be90d785704ce7dcb93
9ebe7c661b893068cb826175f27e3bd17b66773f
/src/main/java/com/demo/controller/DemoController.java
093bba343929fa5cefb2379100514cec347b2718
[]
no_license
shifeiqin/srpingboot2
555220104095e36dc467ba8442e44ef03a563cda
d0d09be3054185a501a019577581272a6d996a8f
refs/heads/master
2020-03-22T10:59:49.082624
2018-07-06T11:04:11
2018-07-06T11:04:11
139,940,080
0
0
null
null
null
null
UTF-8
Java
false
false
1,009
java
package com.demo.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.demo.entities.User; import com.demo.service.DemoService; import lombok.extern.slf4j.Slf4j; @RestController @RequestMapping(value="/demo") @Slf4j public class DemoController { @Autowired private DemoService demoService; @GetMapping("/test") public String test() { log.info(this.getClass().getName()+"demo:test"); return demoService.test(); } @GetMapping("/get/{id}") @ResponseBody public User get(@PathVariable("id") Integer id) { log.info(this.getClass().getName()+" demo:get "+id); User user = demoService.getOne(id); return user; } }
[ "FayQ@FayQ-PC" ]
FayQ@FayQ-PC
ae9602d2353a12ccd413757655ec18466f2c77f8
895f2c971bc5365655035c79be6d7b615c86bde5
/app/src/main/java/com/example/databasetest/fragments/pp_settings_fragment.java
8b7696252d397c9538b3d12cceaf9ca34958b9fe
[]
no_license
rickaldo/HotSpot
0d58baf8a7fbc576450a9b48ce72ccb50a04d174
7cf59c83200701502b69237d0eff611641f2533c
refs/heads/master
2023-06-04T08:53:44.336891
2021-07-01T13:06:39
2021-07-01T13:06:39
381,170,534
0
0
null
null
null
null
UTF-8
Java
false
false
5,167
java
package com.example.databasetest.fragments; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.ToggleButton; import androidx.appcompat.app.AppCompatDelegate; import androidx.fragment.app.Fragment; import com.example.databasetest.activity.MainActivity; import com.example.databasetest.R; import com.google.firebase.auth.FirebaseAuth; import javax.annotation.Nullable; public class pp_settings_fragment extends Fragment { private TextView tv_hp_empfehlen,tv_abmelden,tv_settings_ja; private ToggleButton tg_layout_day, tg_layout_night; private RadioGroup tg_group; private ImageView iv_backttomaps; private SharedPreferences pref; private SharedPreferences.Editor editor; @Nullable @Override public View onCreateView(LayoutInflater inflater, @androidx.annotation.Nullable ViewGroup container, @androidx.annotation.Nullable Bundle savedInstanceState){ return inflater.inflate(R.layout.layout_pp_settings_fragment, container, false); } @Override public void onViewCreated(View view, Bundle savedInstanceState){ super.onViewCreated(view,savedInstanceState); this.tg_layout_day = (ToggleButton) getActivity().findViewById(R.id.tg_layout_day); this.tg_layout_night = (ToggleButton) getActivity().findViewById(R.id.tg_layout_night); this.tv_abmelden = (TextView) getActivity().findViewById(R.id.tv_abmelden); this.tv_hp_empfehlen = (TextView) getActivity().findViewById(R.id.tv_hp_empfehlen); this.tv_settings_ja = (TextView) getActivity().findViewById(R.id.tv_settings_ja); this.tg_group = (RadioGroup) getActivity().findViewById(R.id.tg_group); this.iv_backttomaps = (ImageView)getActivity().findViewById(R.id.iv_backttomaps); pref = getActivity().getSharedPreferences("map", 0); editor = pref.edit(); String mapdesign = pref.getString("layout", "mapbox://styles/rickaldo/ck9fzm0451s231iqpio1e96ts"); if(mapdesign.equals("mapbox://styles/rickaldo/ck9fzm0451s231iqpio1e96ts")){ tg_layout_day.setChecked(true); }else{ tg_layout_night.setChecked(true); } tg_group.setOnCheckedChangeListener(ToggleListener); tg_layout_day.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { layout_day(v); } }); tg_layout_night.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { layout_night(v); } }); iv_backttomaps.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { HomeFragment fragment = new HomeFragment(); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,fragment).commit(); } }); tv_abmelden.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onnClick(v); } }); } final RadioGroup.OnCheckedChangeListener ToggleListener = new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { for(int j= 0; j < group.getChildCount(); j++){ final ToggleButton view = (ToggleButton) group.getChildAt(j); view.setChecked(view.getId() == checkedId); if(view.getId() == checkedId){ view.setChecked(true); }else{ view.setChecked(false); } } }}; public void layout_day(View view){ ((RadioGroup)view.getParent()).check(view.getId()); map_day(); } public void layout_night(View view){ ((RadioGroup)view.getParent()).check(view.getId()); map_night(); } private void map_day(){ editor.putString("layout", "mapbox://styles/rickaldo/ck9fzm0451s231iqpio1e96ts"); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); editor.apply(); } private void map_night(){ editor.putString("layout", "mapbox://styles/rickaldo/ck9n667n92gwb1immykdsmg0w"); AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); editor.apply(); } public void onnClick(View v){ FirebaseAuth.getInstance().signOut(); Intent intent = new Intent(getContext(), MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); } }
[ "gaumpert@gmx.de" ]
gaumpert@gmx.de
4cd6175ee9eb3c00f09994e1ec1303badf21b1d1
d113d294c8df8ff69825b0f3c43347b444b8ce85
/powers/BloodthirstPower.java
92fbd18b0aca15e52b72ff27600e21313b91b713
[]
no_license
blakkthunderr/Blakkmod
a9a1070c0fe429b345b71059e255a1f9e234ee06
1fb0c879104785a66b46f12aad4b6c10cf3e504f
refs/heads/master
2020-03-29T21:21:11.729472
2018-10-17T17:21:43
2018-10-17T17:21:43
150,362,029
0
0
null
null
null
null
UTF-8
Java
false
false
2,024
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package examplemod.powers; import com.megacrit.cardcrawl.actions.common.HealAction; import com.megacrit.cardcrawl.actions.common.ReducePowerAction; import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction; import com.megacrit.cardcrawl.cards.DamageInfo; import com.megacrit.cardcrawl.core.AbstractCreature; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.helpers.ImageMaster; import com.megacrit.cardcrawl.localization.PowerStrings; import com.megacrit.cardcrawl.powers.AbstractPower; import com.megacrit.cardcrawl.powers.AbstractPower.PowerType; public class BloodthirstPower extends AbstractPower { public static final String POWER_ID = "Bloodthirst"; private static final PowerStrings powerStrings; public static final String NAME; public static final String[] DESCRIPTIONS; private int baseamount; public BloodthirstPower(AbstractCreature owner, int newAmount) { this.name = NAME; this.ID = "Bloodthirst"; this.owner = owner; this.amount = newAmount; this.updateDescription(); this.img = ImageMaster.loadImage("img/bloodthirstpower.png"); } public void updateDescription() { this.description = DESCRIPTIONS[0]; } public void onAttack(DamageInfo info, int damageAmount, AbstractCreature target) { if (damageAmount > 0 && target != this.owner && info.type == DamageInfo.DamageType.NORMAL) { this.flash(); AbstractDungeon.actionManager.addToTop(new HealAction(AbstractDungeon.player, AbstractDungeon.player, 1)); } } static { powerStrings = CardCrawlGame.languagePack.getPowerStrings("Bloodthirst"); NAME = powerStrings.NAME; DESCRIPTIONS = powerStrings.DESCRIPTIONS; } }
[ "noreply@github.com" ]
noreply@github.com
e398b4002cca39a8c43a212f18da275adbe6bdf6
4f9e363bba3269099f251be4067765a7ffa0d158
/src/main/java/com/edou/community/exception/CustomizeException.java
95c1896c319647bdce12729caf9652a26ea9ff03
[]
no_license
yidou120/community
3a73377093d6697cb19d3b15f9eb339de5580e1f
a686b5694fa540635f050763298ac1da6b92abf1
refs/heads/master
2022-06-21T11:24:14.178242
2019-10-14T00:45:02
2019-10-14T00:45:02
209,941,129
0
0
null
2022-06-21T01:56:34
2019-09-21T07:08:11
Java
UTF-8
Java
false
false
364
java
package com.edou.community.exception; /** * @author 中森明菜 * @create 2019-10-13 20:13 */ public class CustomizeException extends RuntimeException { private String message; public String getMessage(){ return message; } public CustomizeException(ErrorMessage errorMessage){ this.message = errorMessage.getMessage(); } }
[ "1596510418@qq.com" ]
1596510418@qq.com
7dc1fc930b00121276cf8c0679324b7e742e1ef7
fc4fb96b14f19461591ffc6f870a5b0ef3b2ddc7
/app/src/main/java/com/example/parallelspace/flipkart.java
5028dca8b217635f7bc8951d07efa657647dff36
[]
no_license
chintanmak/parallelspace
e72d578efebb88e0b12d6bfc0725367f678758fd
612ce62f1f584ac282c7f21a7f1060a6ac5699dc
refs/heads/master
2023-06-10T11:18:06.264887
2021-07-01T19:35:38
2021-07-01T19:35:38
382,128,928
0
0
null
null
null
null
UTF-8
Java
false
false
845
java
package com.example.parallelspace; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; public class flipkart extends AppCompatActivity { WebView web; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_flipkart); web=findViewById(R.id.Web); WebSettings settings = web.getSettings(); settings.setJavaScriptEnabled(true); web.setWebViewClient(new WebViewClient()); web.loadUrl("https://www.flipkart.com"); } @Override public void onBackPressed() { super.onBackPressed(); if (web.canGoBack()){ web.goBack(); } } }
[ "chintanmakwana2011@gmail.com" ]
chintanmakwana2011@gmail.com
46fc0cd562495e5ff30a673a5b8baf9602aa7c9b
20554750e496f94a4f49ffa648b5f3f1a7e311cf
/src/main/java/com/sample/api/ExceptionHandler/RecordNotFoundException.java
022a88b9939138581370ba4540f788c18505a702
[]
no_license
ArmanHeydarian/OnlineShop
c35bcfe624314b029dcfcf5b7e9a01857f1b86be
1d4605f4d6b3f867081d4154f635ada78f78783d
refs/heads/master
2023-08-11T23:29:46.611660
2021-09-20T15:26:30
2021-09-20T15:26:30
407,971,315
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.sample.api.ExceptionHandler; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(HttpStatus.NOT_FOUND) public class RecordNotFoundException extends RuntimeException { public RecordNotFoundException(String exception) { super(exception); } }
[ "Arman.heydarian@gmail.com" ]
Arman.heydarian@gmail.com
287ed54a8946cdcd059de25aa4728f8b8c6d063d
619ab8cb4b1458bb4884299e3f024eea54ccb366
/User.java
c9ead945a9acb80ed50853fbcd87c32d08edd231
[]
no_license
sawawow/Serialization
3c159617f2340a5347cf24514725a5866f8d31e3
778debd9dbd0dcb329dbb976a764d9a4a7fba372
refs/heads/main
2023-06-19T11:46:51.385966
2021-07-09T18:57:21
2021-07-09T18:57:21
384,526,664
0
0
null
null
null
null
UTF-8
Java
false
false
680
java
package com.company; import java.io.Serializable; public class User implements Serializable { private final static long serialVersionUID = 2; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } //модификатор доступа не влияет на процесс сериализации public int age; protected String name; //игнорирует поле при сериализации public transient Job job; }
[ "noreply@github.com" ]
noreply@github.com
11a71f483623db9e89c23ab630c6de19fda90cb2
1488b36f4aa602d365896b119f5d46640f0c9229
/charles-credit-assist/src/main/java/com/charles/credit/assist/activity/InviteActivity.java
8c356b8a559281da62c78d9edd21b840f701d46d
[]
no_license
itstrongs/charles-app
3bda38566b5e9d898962c86dd04dedbc04abd837
ad8f653f94ffb4d67d256605b35a2fbec02ec3a6
refs/heads/master
2023-01-31T06:45:44.548680
2020-12-13T13:03:10
2020-12-13T13:03:10
234,723,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,612
java
package com.charles.credit.assist.activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; import com.charles.credit.assist.R; import com.charles.credit.assist.helper.BaseActivity; import com.charles.credit.assist.model.ConstantPool; import com.charles.library.utils.AppUtils; import com.charles.library.utils.Logger; import com.charles.library.utils.SPHelper; import com.charles.library.utils.ToastUtils; import butterknife.ButterKnife; import butterknife.OnClick; /** * 邀请好友页面 * * @Author: liufengqiang * @Date: 2019/6/29 */ public class InviteActivity extends BaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_invite); ButterKnife.bind(this); } @OnClick({R.id.img_back, R.id.text_share}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.img_back: onBackPressed(); break; case R.id.text_share: Logger.d("SPHelper.getLong(mContext, ConstantPool.SP_USER_ID" + SPHelper.getLong(mContext, ConstantPool.SP_USER_ID)); String url = ConstantPool.URL_SHARE + SPHelper.getLong(mContext, ConstantPool.SP_USER_ID); AppUtils.copyClipboard(mContext, url); ToastUtils.show(mContext, "链接已复制到剪贴板,快粘贴给好友分享吧~"); // IntentUtils.openURLByBrowser(mContext, url); break; } } }
[ "fq1781@163.com" ]
fq1781@163.com
4c6dbe96cb59a405db6d214a00d1f7b9c9783925
d0a0c8261519fd76ebe5d24f21c65b0457898dfc
/bin/platform/bootstrap/gensrc/de/hybris/platform/oauth2/data/AuthenticatedUserData.java
b40723e687543aaeabb9d2677c1b966fa001a115
[]
no_license
sheremet-vlad/hybris
6be4daa88cf31bad7f52c9e4bd646065be988ed8
e38c28326f1bc51b44ac94df2fc8ef9cc88317f4
refs/heads/master
2020-05-16T21:58:36.802719
2019-05-20T06:41:39
2019-05-20T06:41:39
183,320,565
0
0
null
null
null
null
UTF-8
Java
false
false
1,262
java
/* * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! * --- Generated at 20.05.2019 9:30:34 * ---------------------------------------------------------------- * * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package de.hybris.platform.oauth2.data; import java.io.Serializable; public class AuthenticatedUserData implements Serializable { /** Default serialVersionUID value. */ private static final long serialVersionUID = 1L; /** <i>Generated property</i> for <code>AuthenticatedUserData.displayName</code> property defined at extension <code>oauth2</code>. */ private String displayName; public AuthenticatedUserData() { // default constructor } public void setDisplayName(final String displayName) { this.displayName = displayName; } public String getDisplayName() { return displayName; } }
[ "ysc.vlad@gmail.com" ]
ysc.vlad@gmail.com
58ba4bbab44f8cb323c929133c6f4d6d5b1692bb
221f98ba865256537379223e40b4a337a86a2362
/TechTogether/src/Model/Store.java
e577c2c678486b850a22218c19dec06fc326a879
[]
no_license
HarshithaBhaskar/TechTogether
25a95013511fbfc068c3ed7895ff25b4e0190f4b
041b146c289b31187dd3ea811e7f365221730aa1
refs/heads/master
2020-05-01T03:09:34.120584
2019-03-24T11:52:15
2019-03-24T11:52:15
177,238,529
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package Model; import java.util.ArrayList; public class Store extends AStore{ public String storeName; public ArrayList<IItem> itemNames = new ArrayList<>(); public String storeLocation; public Store(String storeName, String storeLocation) { super(storeName, storeLocation); } public Store(String storeName) { super(storeName); } }
[ "noreply@github.com" ]
noreply@github.com
f70852ebd54a89814c775d1c2968cf1f421dcc65
9ab06591f30070d64dd957fdc4b96649ef28f5b2
/prsanna-selenium-practice/testpom/Login.java
f86aa94c953cd0280588052964de317f087afd9f
[]
no_license
prasanna-md/vtiger_frame_work
8ab62fa3a736c41e44c59ff798ef2c7ac8a7ae5f
b9a6a28576dcb851ef5424e32216c9e5495f68ab
refs/heads/master
2021-07-22T09:37:15.059114
2019-11-14T06:13:18
2019-11-14T06:13:18
221,611,621
0
0
null
2020-10-13T17:27:26
2019-11-14T04:29:19
Java
UTF-8
Java
false
false
844
java
package com.frameworks.testpom; import org.apache.poi.EncryptedDocumentException; import org.testng.annotations.Test; import com.frameworks.pom.EnterTimeTrack; import com.frameworks.pom.LoginPage; import com.generics.BaseTest; import com.generics.Excel; public class Login extends BaseTest { @Test public static void validLogin() throws EncryptedDocumentException { String username= Excel.getData(XL_PATH,SHEET_NAME,2,0); String password = Excel.getData(XL_PATH,SHEET_NAME,2,1); String title= Excel.getData(XL_PATH,SHEET_NAME,2,2); Excel.storeValue(XL_PATH,SHEET_NAME, 0, 3, "Status"); LoginPage l = new LoginPage(driver); l.username(username); l.password(password); l.loginClick(); EnterTimeTrack eTT = new EnterTimeTrack(driver); eTT.verifyHomePageIsDisplayed(driver, 5, title); } }
[ "Pinki@Pinki-PC" ]
Pinki@Pinki-PC
e5da169ffff258211d23c0bb7c504631c725d336
a7668efd5091d01d22b9c1122df7bef76f6e457b
/src/main/java/aop/Decorator/AccountWithSecurityCheck.java
d9baa6bfc6dda99d441a5e75018c52512adb7ebb
[]
no_license
zhengdifei/Test
92becfddcbc1caf2021c4068b9e399b64244ea4e
d997baebc636cc0794d7ca60e979d26bd3837fa4
refs/heads/master
2021-01-17T17:03:58.630070
2017-06-13T07:34:57
2017-06-13T07:34:57
69,366,132
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package aop.Decorator; import aop.base.SecurityChecker; public class AccountWithSecurityCheck { private Account account; public AccountWithSecurityCheck (Account account) { this.account = account; } public void operation() { SecurityChecker.checkSecurity(); account.operation(); } }
[ "zhengdifeixp@126.com" ]
zhengdifeixp@126.com
4d2ce45fd903720f0dc30be5a6682a0c60ccac3e
ab4ab4bec16afe3ce8721f6540c68dc63ebb6990
/lookit/app/src/main/java/com/shairlook/shairlook_v1/RegisterMember.java
8dca8cc37f5d5ce4f86fedda0761b4c910c3705b
[]
no_license
kkoci/androidexwip
c8151bc9ad60ebf27eb42a02344ca5782dabe38e
d1ccefcb219fdbac1b9c6cfdb04f7411562f7aa5
refs/heads/master
2021-01-22T20:29:27.629859
2015-08-18T01:56:03
2015-08-18T01:56:03
40,924,145
0
0
null
null
null
null
UTF-8
Java
false
false
5,832
java
package com.shairlook.shairlook_v1; /** * Created by kristian on 26/04/2015. */ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; public class RegisterMember extends Activity implements OnItemSelectedListener{ //DbAdapter dbAdapter; EditText txtName; EditText txtPassword; EditText txtPasswordConf; EditText txtEmail; EditText txtEmailConf; EditText txtSchool; Button btnJoin; Activity currentActivity; private String[] state= {"USB","Stanford","Harvard","UCV","USM","Tor vergata", "La Sapienza"}; Spinner spinner_school; /**public void onFinish(){ Intent intent = new Intent(RegisterMember.this, LoginActivity.class); startActivity(intent); }**/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_members_register); System.out.println(state.length); spinner_school = (Spinner) findViewById(R.id.spinner_school); ArrayAdapter<String> adapter_state = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, state); adapter_state .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner_school.setAdapter(adapter_state); spinner_school.setOnItemSelectedListener(this); currentActivity=this; txtName = (EditText) findViewById(R.id.et_user); txtPassword = (EditText) findViewById(R.id.et_pw_reg); txtPasswordConf = (EditText) findViewById(R.id.et_pw_conf); txtEmail = (EditText) findViewById(R.id.et_email_reg); txtEmailConf = (EditText) findViewById(R.id.et_email_conf); btnJoin = (Button) findViewById(R.id.btn_join); /**dbAdapter = new DbAdapter(this); dbAdapter.open();**/ btnJoin.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(txtName.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtPassword.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtPasswordConf.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtEmail.getWindowToken(), 0); imm.hideSoftInputFromWindow(txtEmailConf.getWindowToken(), 0); //imm.hideSoftInputFromWindow(txtSchool.getWindowToken(), 0); //imm.hideSoftInputFromWindow(spinner_school.getWindowToken(), 0); String name = txtName.getText().toString(); String password = txtPassword.getText().toString(); String passwordconf = txtPasswordConf.getText().toString(); String email = txtEmail.getText().toString(); String emailconf = txtEmailConf.getText().toString(); String school = spinner_school.getSelectedItem().toString(); //long i = EndpointsAsyncTaskInsert(name, password, email, school); if ((txtName.length() == 0) || (txtEmail.length() == 0) || (txtPassword.length() == 0)) { Toast.makeText(RegisterMember.this, "You need to provide values for Name, Email and Password", Toast.LENGTH_SHORT).show(); return; } //Toast.makeText(RegisterMember.this, "You have successfully registered",Toast.LENGTH_LONG).show(); else { if (!passwordconf.equals(password)) { Toast.makeText(getApplicationContext(), "Password Does Not Matches", Toast.LENGTH_LONG).show(); } if (!emailconf.equals(email)) { Toast.makeText(getApplicationContext(), "Email Does Not Matches", Toast.LENGTH_LONG).show(); } } //Go ahead and perform the transaction /**String[] params = {name,email,password,school}; new EndpointsAsyncTaskInsert((OnTaskFinishListener) currentActivity).execute(params);**/ try{ Intent k = new Intent(RegisterMember.this, LoginActivity.class); startActivity(k); }catch(Exception e){ } /**new EndpointsAsyncTaskInsert(LoginMember.this) { protected void onPostExecute(User result) { super.onPostExecute(result); // Do something with result Intent intent = new Intent(LoginMember.this, WelcomeScreen.class); startActivity(intent); } }.execute(params);**/ } /**catch (SQLException e) { Toast.makeText(RegisterMember.this, "Some problem occurred", Toast.LENGTH_LONG).show(); }**/ }); } public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { spinner_school.setSelection(position); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } /**public void insertUser(View v) { new EndpointsAsyncTaskInsert(this).execute(); }**/ }
[ "kristian.koci@gmail.com" ]
kristian.koci@gmail.com
aa0af06f9a8aa15c8fc40a6fe07db02306d0c056
c10d048a4ad2d4fcef903371970a50236a6c9e8c
/Java수업/exam2802/Member.java
d360eecb4c4e2fa48784ea774a33c301fee3319a
[]
no_license
denim5409/connected
1a2980569649cf276ed51c8f9f9c22425d1cdcde
bf44b76c043b0b984031b8f9e8dbb5ab875c80b0
refs/heads/master
2022-12-12T07:17:02.228511
2020-09-01T07:07:47
2020-09-01T07:07:47
260,469,225
0
0
null
null
null
null
UHC
Java
false
false
1,181
java
package exam2802; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Scanner; public class Member { String pName; String pAge; String pJun; String pDate; Scanner scanner = new Scanner(System.in); public Member() { System.out.print("이름 : "); pName = scanner.next(); System.out.print("나이 : "); pAge = scanner.next(); System.out.print("전화번호 : "); pJun = scanner.next(); // LocalDate nowDate = LocalDate.now(); // DateTimeFormatter nowFormat = DateTimeFormatter.ofPattern("yyyymmdd"); // String nT = nowDate.format(nowFormat); // pDate = nT.substring(0, 4)+"-"+nT.substring(4, 6)+"-"+nT.substring(6, 8); LocalDate nowTime = LocalDate.now(); DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("yyyyMMdd"); String nT = nowTime.format(myFormatObj); pDate = nT.substring(0,4)+"-"+nT.substring(4,6)+"-"+nT.substring(6,8); } public void disp() { System.out.print("이름 : " + pName + "\t"); System.out.print("나이 : " + pAge + "\t"); System.out.println("전화번호 : " + pJun + "\t"); System.out.println("가입일자 : " + pDate); } }
[ "noreply@github.com" ]
noreply@github.com
20796eb1f3425feeb6431530dee1084505728310
301e5eee13f12a38f3d2ac5c017e4351051433d0
/src/main/java/co/masslab/EchoController.java
db8c3f41da7172233713f4606755276f2eded61e
[]
no_license
xiangyangsunsmile/secbug
11a1e7835c089c9c2f808282208a594b2621e146
7da47de7bd3fef73d78978a40455c410dd0151f7
refs/heads/master
2021-01-19T21:01:13.199201
2016-02-11T18:35:35
2016-02-11T18:35:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package co.masslab; import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/echo") public class EchoController { @RequestMapping(value="/{word}") public String echo(@PathVariable("word") String word) { return word; } }
[ "jason.whittle@gmail.com" ]
jason.whittle@gmail.com
464e2d0aed1019d21b465a0d521a161431c4e514
c7cf8cc1641f7d0e1b4793cc2fff700f86d7cb76
/apgdiff/src/main/java/cz/startnet/utils/pgdiff/libraries/PgLibrarySource.java
97446db0bc6e504be37a875e1f13fb161ed7e022
[ "Apache-2.0", "MIT", "PostgreSQL" ]
permissive
pavel-xa/pgcodekeeper
bc8edf445ccc7c36e8d831d30c189468b5a6ed36
06a7673d5dc80f29179a0dc8967bac804b31ef09
refs/heads/master
2021-07-12T23:02:08.447756
2020-07-02T15:05:18
2020-07-02T15:08:33
175,141,254
0
0
Apache-2.0
2019-03-12T05:26:06
2019-03-12T05:26:01
Java
UTF-8
Java
false
false
107
java
package cz.startnet.utils.pgdiff.libraries; public enum PgLibrarySource { LOCAL, JDBC, URL; }
[ "levsha_aa@taximaxim.ru" ]
levsha_aa@taximaxim.ru
3dd73c290bbd287a1144ffae7deb4ef1ca0a87d4
8be404464a08520d1bc281b8cff451d90bec736d
/midland-bs-mannager/src/main/java/com/huixin/web/service/impl/PromotionServiceImpl.java
ab89a04b31d6a046d175604767cfc61393b20831
[]
no_license
tianjun102/midland
44a6f1f728509ba371d49003870d3a9b2895bc14
31cd283c0edca5c485e73bcfe0eca40e5993076e
refs/heads/master
2021-01-01T18:35:15.691301
2017-07-26T02:21:44
2017-07-26T02:21:44
98,365,797
0
0
null
null
null
null
UTF-8
Java
false
false
1,753
java
package com.huixin.web.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.huixin.web.dao.PromotionMapper; import com.huixin.web.model.Promotion; import com.huixin.web.service.PromotionService; @Service public class PromotionServiceImpl implements PromotionService { @Autowired private PromotionMapper promotionMapper; @Override public PageList<Promotion> selectPromotionByParem(Promotion promotion, PageBounds pageBounds) { return promotionMapper.selectPromotionByParem(promotion, pageBounds); } @Override public PageList<Promotion> selectPromotionByEntity(Promotion promotion, PageBounds pageBounds) { return promotionMapper.selectPromotionByEntity(promotion, pageBounds); } @Override public Promotion selectPromotionById(Promotion promotion) { return promotionMapper.selectPromotionById(promotion); } @Override public Integer insetPromotion(Promotion promotion) { return promotionMapper.insetPromotion(promotion); } @Override public Integer deletePromotion(Promotion promotion) { return promotionMapper.deletePromotion(promotion); } @Override public Integer updatePromotionById(Promotion promotion) { return promotionMapper.updatePromotionById(promotion); } @Override public Integer insetBatchPromotion(List<Promotion> promotionList) { return promotionMapper.batchInsert(promotionList); } @Override public Integer deletePromById(Promotion promotion) { return promotionMapper.deletePromById(promotion); } }
[ "tianj@717e5c6c-092c-5047-8948-5c0a3cc3e82d" ]
tianj@717e5c6c-092c-5047-8948-5c0a3cc3e82d
cf1d0e5f77fe1c59c1b5ffeb33a84bcdf9c149f8
538414f61a305cf84e00cbd0f2c154e4fa99ccb7
/src/org/openbravo/service/db/ClientImportProcessor.java
2cfe226365a162eb82516ebfc493df2e920338ec
[]
no_license
q3neeko/openz
4024d007ef2f1094faad8a8c17db8147e689d0f3
050ae0ba7b54ba9276a2fa85ecf5b2ec33954859
refs/heads/master
2020-03-29T21:44:56.783387
2018-09-26T14:34:00
2018-09-26T14:34:00
150,385,120
0
1
null
null
null
null
UTF-8
Java
false
false
2,449
java
/* ************************************************************************* * The contents of this file are subject to the Openbravo Public License * Version 1.0 (the "License"), being the Mozilla Public License * Version 1.1 with a permitted attribution clause; you may not use this * file except in compliance with the License. You may obtain a copy of * the License at http://www.openbravo.com/legal/license.html * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SL * All portions are Copyright (C) 2008 Openbravo SL * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ */ package org.openbravo.service.db; import java.util.List; import org.openbravo.base.model.Property; import org.openbravo.base.structure.BaseOBObject; import org.openbravo.dal.xml.EntityXMLProcessor; import org.openbravo.model.ad.access.Role; import org.openbravo.model.ad.access.User; import org.openbravo.model.ad.system.Client; import org.openbravo.model.common.enterprise.Organization; import org.openbravo.model.common.enterprise.Warehouse; /** * This ImportProcessor is used during client import. It repairs the names of client, user and a * number of other entities to prevent unique constraint violations during client import. * * The {@link #replaceValue} method does not contain logic in this class. * * @author mtaal */ public class ClientImportProcessor implements EntityXMLProcessor { private String newName; /** * @see EntityXMLProcessor#process(List, List) */ public void process(List<BaseOBObject> newObjects, List<BaseOBObject> updatedObjects) { return; } public Object replaceValue(BaseOBObject owner, Property property, Object importedValue) { return importedValue; } protected String replace(String currentValue, String orginalName) { if (currentValue == null) { return null; } return currentValue.replace(orginalName, newName); } public String getNewName() { return newName; } public void setNewName(String newName) { this.newName = newName; } }
[ "neeko@gmx.de" ]
neeko@gmx.de
97cb62f81eecb1d3b88db69af4069e4ce4d5d4fe
0f1836c7eeab2fa0e646632b2fa502d21a715370
/src/main/java/com/example/web1/Web1Application.java
869e54d795c3aeb94545b8d41c0d53fa8935063f
[]
no_license
edvansts/students-api-spring
12f055ac2b0a5eb2797119bc1cc9acaed0618f39
abdaef43647937eeb68322fd3b4c5053e47212ce
refs/heads/main
2023-05-11T16:36:46.750794
2021-06-05T22:54:19
2021-06-05T22:54:19
374,222,062
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.example.web1; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Web1Application { public static void main(String[] args) { SpringApplication.run(Web1Application.class, args); } }
[ "edvan.stt02@gmail.com" ]
edvan.stt02@gmail.com
6da42c358e6befc664f363ccf9aad05b745ec55e
75950d61f2e7517f3fe4c32f0109b203d41466bf
/tests/tags/ci-1.8/test-policy/src/test/java/org/fabric3/policy/attachment/AttachService.java
3d4b5cc3de6028014c5dc211da1b7067889885db
[ "Apache-2.0" ]
permissive
codehaus/fabric3
3677d558dca066fb58845db5b0ad73d951acf880
491ff9ddaff6cb47cbb4452e4ddbf715314cd340
refs/heads/master
2023-07-20T00:34:33.992727
2012-10-31T16:32:19
2012-10-31T16:32:19
36,338,853
0
0
null
null
null
null
UTF-8
Java
false
false
1,797
java
/* * Fabric3 * Copyright (c) 2009 Metaform Systems * * Fabric3 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version, with the * following exception: * * Linking this software statically or dynamically with other * modules is making a combined work based on this software. * Thus, the terms and conditions of the GNU General Public * License cover the whole combination. * * As a special exception, the copyright holders of this software * give you permission to link this software with independent * modules to produce an executable, regardless of the license * terms of these independent modules, and to copy and distribute * the resulting executable under terms of your choice, provided * that you also meet, for each linked independent module, the * terms and conditions of the license of that module. An * independent module is a module which is not derived from or * based on this software. If you modify this software, you may * extend this exception to your version of the software, but * you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * * Fabric3 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the * GNU General Public License along with Fabric3. * If not, see <http://www.gnu.org/licenses/>. */ package org.fabric3.policy.attachment; /** * @version $Rev$ $Date$ */ public interface AttachService { void invoke(); }
[ "jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf" ]
jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf
08d5fe57cab7f655ed946f67050016c21dde73a9
e9025bc5bd71911e6b67ad457931e30b6b1e8215
/src/objetos/Proveedor.java
0fae6feb1d5c8d068c39a3e7f6687efee6cd6778
[]
no_license
gianellak/PracticaProfesional
b4f3213ec6da0e357519e4393d7310aaa1943038
05ae9d9d87830ed75dddfeedddfd0b9223699130
refs/heads/master
2021-01-10T11:21:41.646632
2016-04-14T11:31:26
2016-04-14T11:31:26
50,308,659
0
0
null
null
null
null
UTF-8
Java
false
false
634
java
package objetos; public class Proveedor { int idProveedor; String nombre; String direccion; int telefono; public int getIdProveedor() { return idProveedor; } public void setIdProveedor(int idProveedor) { this.idProveedor = idProveedor; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getDireccion() { return direccion; } public void setDireccion(String direccion) { this.direccion = direccion; } public int getTelefono() { return telefono; } public void setTelefono(int telefono) { this.telefono = telefono; } }
[ "kravchik.gianella@maimonides.edu" ]
kravchik.gianella@maimonides.edu
8c82c61381bcde41b7283b9a0244f18d3ab2957d
e5e50380295ea9bf03a3f8b5057d26a586025cf7
/week-04/day-03/Fibonacci/test/FibonacciTest.java
701c2867c063aa5e825abe7069125fbe8960b0e4
[]
no_license
green-fox-academy/zitana
e299f0c5d0771c406e25328011feb246292a44b7
fc8c18636addf845a25bd3b1aff91e9cd7312de1
refs/heads/master
2021-06-17T03:01:04.905982
2017-06-05T19:49:43
2017-06-05T19:49:43
85,566,733
0
1
null
null
null
null
UTF-8
Java
false
false
340
java
import org.junit.Test; import static org.junit.Assert.*; public class FibonacciTest { @Test public void fibonacci() throws Exception { Fibonacci fibo = new Fibonacci(); int [] testTill8 = { 0, 1, 1, 2, 3, 5, 8, 13, 21}; for (int i = 0; i > testTill8.length; i++) assertEquals(testTill8[i], fibo.fibonacci(i)); } }
[ "nagyaghy.zita@gmail.com" ]
nagyaghy.zita@gmail.com
16d34132096b1af2ef5b499a4c13c5a0d73451c8
8f782f200183e52f90db5a7ba897d3d276d8603f
/src/main/java/IP/TCP_05.java
a4f57faf855eabe6757016242127bd7fd401f2f3
[]
no_license
shizhongyuan/JavaSe
1d99c753974421fac2af0e44173dbe2cd30f77b0
5f7b4eaa1a8b90cb00029c470a32a174883e292d
refs/heads/master
2021-01-20T13:18:03.332233
2017-10-24T14:35:29
2017-10-24T14:35:29
90,471,510
0
0
null
null
null
null
UTF-8
Java
false
false
811
java
package IP; import java.io.*; import java.net.Socket; /** * Created by Administrator on 2017/7/6 0006. */ public class TCP_05 { public static void main(String[] args) throws IOException { File f = new File("E:\\java_io\\io11.xex"); System.out.println(f.exists()); Socket s =new Socket("127.0.0.1",10005); BufferedReader br =new BufferedReader(new FileReader(f)); PrintWriter pw = new PrintWriter(s.getOutputStream()); String x = null; while ((x=br.readLine())!=null){ pw.println(x); } s.shutdownOutput(); BufferedReader bfr = new BufferedReader(new InputStreamReader(s.getInputStream())); String s1 = bfr.readLine(); System.out.println(s1); br.close(); s.close(); } }
[ "1067164628@qq.com" ]
1067164628@qq.com
628f80800e7b6f52ccaaedc5f84c90a0b4319cac
b111b77f2729c030ce78096ea2273691b9b63749
/gradle-talks/talks/power-features/samples/webinar-lib/src/main/java/webinar/Webinar.java
d9fb4032a8559578062330afe929c98592f24083
[]
no_license
WeilerWebServices/Gradle
a1a55bdb0dd39240787adf9241289e52f593ccc1
6ab6192439f891256a10d9b60f3073cab110b2be
refs/heads/master
2023-01-19T16:48:09.415529
2020-11-28T13:28:40
2020-11-28T13:28:40
256,249,773
1
0
null
null
null
null
UTF-8
Java
false
false
100
java
package webinar; public class Webinar { public String toString() { return "I'm happy!"; } }
[ "nateweiler84@gmail.com" ]
nateweiler84@gmail.com
6c112a5a29c3018f687fac8471cf8c1f47e8e0fc
ac4c83a0c79af175b7e24bf202a1c3642e106d5a
/src/main/java/bll/services/IdentificationService.java
8703b2a547a903771e6988aae7fd61c15362935b
[ "MIT" ]
permissive
jacksonbarreto/personal-finance-manager
d0ddd4b813cc81b5a77411250429bcfb44576586
497bac19a1ce77db6ce8a579213bc42535aa9428
refs/heads/main
2023-05-05T02:33:43.044026
2021-05-07T17:09:24
2021-05-07T17:09:24
347,369,478
1
0
null
null
null
null
UTF-8
Java
false
false
1,410
java
package bll.services; import bll.entities.IUser; import bll.exceptions.NullArgumentException; import bll.repositories.IUserRepository; import bll.repositories.UserRepository; import java.util.function.Predicate; public class IdentificationService implements IIdentificationService { private final IUserRepository userRepository; public IdentificationService(IUserRepository userRepository) { if (userRepository == null) throw new NullArgumentException(); this.userRepository = userRepository; } @Override public IUser identifyUser(String accessKey) { if (accessKey == null) throw new NullArgumentException(); Predicate<IUser> predicate = user -> user.getCredential().getAccessKeys().contains(accessKey); return this.userRepository.getFirst(predicate); } @Override public boolean isValid(IUser user) { if (user == null) throw new NullArgumentException(); IUser userFound = this.userRepository.get(user.getID()); if (userFound == null) return false; return userFound.getCredential().equals(user.getCredential()); } public static IIdentificationService identificationServiceDefault() { return new IdentificationService(); } private IdentificationService() { this.userRepository = UserRepository.getInstance(); } }
[ "jackson.barreto@gmail.com" ]
jackson.barreto@gmail.com
7103671f36af113edd885eedc1b14fd5cc2417f1
f08256664e46e5ac1466f5c67dadce9e19b4e173
/sources/kotlinx/coroutines/C13398t.java
e2e5b3c73b78effbc824df6f43ee4fec822c1b5a
[]
no_license
IOIIIO/DisneyPlusSource
5f981420df36bfbc3313756ffc7872d84246488d
658947960bd71c0582324f045a400ae6c3147cc3
refs/heads/master
2020-09-30T22:33:43.011489
2019-12-11T22:27:58
2019-12-11T22:27:58
227,382,471
6
3
null
null
null
null
UTF-8
Java
false
false
706
java
package kotlinx.coroutines; /* renamed from: kotlinx.coroutines.t */ /* compiled from: CancellableContinuationImpl.kt */ final class C13398t { /* renamed from: a */ public final Object f29894a; /* renamed from: b */ public final Object f29895b; /* renamed from: c */ public final C13414x1 f29896c; public C13398t(Object obj, Object obj2, C13414x1 x1Var) { this.f29894a = obj; this.f29895b = obj2; this.f29896c = x1Var; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("CompletedIdempotentResult["); sb.append(this.f29895b); sb.append(']'); return sb.toString(); } }
[ "101110@vivaldi.net" ]
101110@vivaldi.net
263d18baed1a1db7215e931c652d86b739dec730
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyPropertiesTests.java
ad21f446961c0c481302b9104a38a36e45d70b9d
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
1,165
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.billing.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyProperties; import com.azure.resourcemanager.billing.models.ViewCharges; import org.junit.jupiter.api.Assertions; public final class CustomerPolicyPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { CustomerPolicyProperties model = BinaryData.fromString("{\"viewCharges\":\"Allowed\"}").toObject(CustomerPolicyProperties.class); Assertions.assertEquals(ViewCharges.ALLOWED, model.viewCharges()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { CustomerPolicyProperties model = new CustomerPolicyProperties().withViewCharges(ViewCharges.ALLOWED); model = BinaryData.fromObject(model).toObject(CustomerPolicyProperties.class); Assertions.assertEquals(ViewCharges.ALLOWED, model.viewCharges()); } }
[ "noreply@github.com" ]
noreply@github.com
8b6abfc2e26ff53cda000f8f9f027ea2db24278a
1e86343463c1c8233c5e15c65164ecc5d34bd5a8
/even1/src/addItem/AddBoxArrayList.java
a7f288481552ed8a842596f3e121fb6a93ce3693
[]
no_license
sapirmar/even1
ae419c378d888712ee001e9c23abb07e117174ad
904a16dc68899c83c12e8a4b3ee08a0acada827b
refs/heads/master
2021-01-11T22:14:11.608277
2017-01-14T12:27:05
2017-01-14T12:27:05
78,938,306
0
0
null
null
null
null
UTF-8
Java
false
false
268
java
package addItem; import levels.Box; import levels.Items; import levels.Level; public class AddBoxArrayList implements IAddArrayList { @Override public void addToArrayList(Level level, Items item) { level.getBoxes().add((Box)item); } }
[ "markelsapir@gmail.com" ]
markelsapir@gmail.com
d140cbad424c99c0440317ec4e9a744729e22ba0
4b6b7a42da68f7279af4d9c99699a9254bf8eed9
/app/src/main/java/com/udacity/popularmovies/favouritesdb/Entitites/ReviewData.java
ffc98d443ebfe594c3a53c3495789a7ee293aa50
[]
no_license
Mastergammler/ADND-Popular-Movies
fec99e2a0461c314031970aa1da17c00903ba297
18f4f3b9c7fddb1c453ff2b826f3f738ce580cb7
refs/heads/master
2021-05-18T04:52:05.854332
2020-04-11T19:01:56
2020-04-11T19:14:45
251,118,389
0
0
null
null
null
null
UTF-8
Java
false
false
1,167
java
package com.udacity.popularmovies.favouritesdb.Entitites; import com.udacity.popularmovies.themoviedb.api.data.MovieReview; import androidx.room.Entity; import androidx.room.Ignore; import androidx.room.PrimaryKey; @Entity(tableName = "review_data") public class ReviewData { @PrimaryKey(autoGenerate = true) private int id; private int movie_id; private String author; private String content; /** * Developer constructor * @param movieId * @param review */ @Ignore public ReviewData(int movieId, MovieReview review) { movie_id = movieId; author = review.author; content = review.content; } /** * Room constructor */ public ReviewData(int id, int movie_id, String author, String content) { this.id = id; this.movie_id = movie_id; this.author = author; this.content = content; } public int getId() { return id; } public int getMovie_id() { return movie_id; } public String getAuthor() { return author; } public String getContent() { return content; } }
[ "raphael-hoppe@gmx.de" ]
raphael-hoppe@gmx.de
909736aec0bd0120021865c00e2a1255bf748e3f
d8772960b3b2b07dddc8a77595397cb2618ec7b0
/rhServer/src/main/java/com/rhlinkcon/model/CrmCrea.java
c7ed42bf554fb128adc83500d15bbf2864a9d39f
[]
no_license
vctrmarques/interno-rh-sistema
c0f49a17923b5cdfaeb148c6f6da48236055cf29
7a7a5d9c36c50ec967cb40a347ec0ad3744d896e
refs/heads/main
2023-03-17T02:07:10.089496
2021-03-12T19:06:05
2021-03-12T19:06:05
347,168,924
0
1
null
null
null
null
UTF-8
Java
false
false
3,028
java
package com.rhlinkcon.model; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EntityListeners; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import com.rhlinkcon.audit.AuditListener; import com.rhlinkcon.audit.UserDateAudit; import com.rhlinkcon.util.AuditLabelClass; @Entity @EntityListeners(AuditListener.class) @AuditLabelClass(label = "CRM CREA") @Table(name = "crm_crea") public class CrmCrea extends UserDateAudit { /** * */ private static final long serialVersionUID = 4440215695661565547L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @NotEmpty @Column(name = "nome_conveniado", unique = true) private String nomeConveniado; @NotNull @NotEmpty @Column(name = "numero_crm_crea", unique = true) private String numeroCrmCrea; @Column(name = "coordenador_pcmso") private boolean coordenadorPcmso; @Column(name = "responsavel_ltcat") private boolean responsavelLtcat; @Enumerated(EnumType.STRING) @Column(name = "tipo") private CrmCreaEnum tipo; @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "crm_crea_convenio", joinColumns = @JoinColumn(name = "crm_crea_id"), inverseJoinColumns = @JoinColumn(name = "convenio_id")) private Set<Convenio> convenios = new HashSet<>(); public CrmCrea() { } public CrmCrea(Long id) { this.id = id; } public CrmCreaEnum getTipo() { return tipo; } public void setTipo(CrmCreaEnum tipo) { this.tipo = tipo; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNomeConveniado() { return nomeConveniado; } public void setNomeConveniado(String nomeConveniado) { this.nomeConveniado = nomeConveniado; } public String getNumeroCrmCrea() { return numeroCrmCrea; } public void setNumeroCrmCrea(String numeroCrmCrea) { this.numeroCrmCrea = numeroCrmCrea; } public boolean isCoordenadorPcmso() { return coordenadorPcmso; } public void setCoordenadorPcmso(boolean coordenadorPcmso) { this.coordenadorPcmso = coordenadorPcmso; } public boolean isResponsavelLtcat() { return responsavelLtcat; } public void setResponsavelLtcat(boolean responsavelLtcat) { this.responsavelLtcat = responsavelLtcat; } public Set<Convenio> getConvenios() { return convenios; } public void setConvenios(Set<Convenio> convenios) { this.convenios = convenios; } @Override public String getLabel() { // TODO Auto-generated method stub return null; } }
[ "vctmarques@gmail.com" ]
vctmarques@gmail.com
72b4641eb6c31580b6c723c74eaed96c86eaad57
5f08808171fe9e8287ad170bc998efa0aca8380e
/NEW_EHS/src/test/java/de/ehs/step_definitions/Hooks.java
4c79b2f9b2beb5aca1f7426c54d27ba4ae366fa6
[]
no_license
SAkkaya/EHS_TASK
9803cebe658b288d407208c1fe4e8664f65022df
5df1c23f83fe91741cd75ec7c55e48ff72d7454f
refs/heads/master
2023-03-16T23:44:00.319494
2021-03-09T10:39:31
2021-03-09T10:39:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package de.ehs.step_definitions; import de.ehs.utilities.ConfigurationReader; import de.ehs.utilities.Driver; import io.cucumber.java.After; import io.cucumber.java.Before; import io.cucumber.java.Scenario; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import java.util.concurrent.TimeUnit; public class Hooks { @Before public void setUp() { Driver.get().manage().window().maximize(); Driver.get().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } @After public void tearDown(Scenario scenario) { if (scenario.isFailed()) { final byte[] screenshot = ((TakesScreenshot) Driver.get()).getScreenshotAs(OutputType.BYTES); scenario.attach(screenshot, "image/png", "screenshot"); } Driver.closeDriver(); } }
[ "yucel.krtls@icloud.com" ]
yucel.krtls@icloud.com
e725c7a396bc0fcf228d91c67996f78fbb3096fd
b622d501b86e9e345d90f164582927fd5faad301
/Projet Informatique/comp/gui/Board.java
de556c1abce772098b6a3f5ab23e8b5aa9246d58
[]
no_license
Decksign/Projet-Informatique
7ef0a660b0ddfa4de945f17ac25fa38349ea86bd
30b687fc09d49bba7bdd89498bcd64e69e9e7176
refs/heads/master
2022-07-12T02:14:57.629137
2020-05-11T22:39:18
2020-05-11T22:39:18
263,165,597
0
0
null
null
null
null
UTF-8
Java
false
false
66,398
java
package comp1110.ass2.gui; import comp1110.ass2.*; import javafx.application.Application; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.VPos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ScrollPane; import javafx.scene.effect.DropShadow; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.*; import javafx.scene.media.AudioClip; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; import comp1110.ass2.StratoGame; import static comp1110.ass2.Colour.BLACK; import static comp1110.ass2.Colour.GREEN; import static comp1110.ass2.Difficulty.*; import static comp1110.ass2.Player.MAX_TILES; import static comp1110.ass2.StratoGame.*; import static javafx.scene.paint.Color.*; public class Board extends Application { /*The majority of this class was done by Zhixian Wu, with some functions and layout by Manal Mohania and Joseph Meltzer*/ /*All elements using CSS was done by Manal Mohania, with inspiration and any * pieces of adapted code in the G-originality*/ /*OVERVIEW: The first function called by the stage is initialSettings(), which * creates the first screen many buttons to choose the playing mode (Human v.s * Hard AI, Human vs. Human, Easy AI vs. Cheating AI, etc. * (And buttons for the instructions, sound, etc.)*/ /*The difficulty buttons change the GameState, which changes what kind of board * is created, what difficulty AI to call, etc. */ /*Whenyou click 'Start', makeGame() is called * makeGame() calls makeControls() and makeBoard(). */ /*makeControls() is pretty much the same for all playing modes, except it omits * a "Rotate" button if it's single-player. And if the game is AI vs. AI, it creates * a button Next Move which progresses the game when clicked*/ /*makeBoard() is pretty much the same again. * makeBoard() modifies some GridPanes: * 1. playingBoard so it looks like a board * 2. heightLabels so its rows and columns align with the playingBoard * 3. clickablePanes so its rows and columns align with the playingBoard * The big difference is that depending if the game is Human vs. AI, AI vs. Human, * or Human vs. Human, it calls different addPane function: addPanePlayerGreen, * addPanePlayerRed, or addPaneTwoPlayer. * If it's AI vs. Human, it also makes the AI's first move by calling makeAIMove. * If it's AI vs. AI, it doesn't add clickable panes to the board*/ /*Each 'addPane' function creates a pane at the specified row and column * on the GridPane clickablePanes. * When a pane is clicked, the two player version of the function makes a * move (by calling makeGUIPlacement) based on whose turn it is. * The one player version makes the player's move and calls makeAIMove(). * These panes also hold the events for the previews of tile placements*/ /*Apart from putting an image in the right place, the makeGUIPlacement function * modifies whose turn it is, how far through their stack of tiles each player * is at, the heights of the tiles (by calling displayHeights()), what the current * score is (by calling updateScores()), check if the game is over and display * the Game Over Screen if it is, etc.*/ private static final int BOARD_WIDTH = 933; private static final int BOARD_HEIGHT = 700; private static final String URI_BASE = "assets/"; private static final int TILE_SIZE = 25; /*This is half the width of each tile*/ private static final int BOARD_SIZE = 26; /*As in a 26x26 board*/ private static final String PLACEMENT_URI = Viewer.class.getResource(URI_BASE + "sound.wav").toString(); /*Objects that need to be accessible to many functions.*/ private GameState gameState; private Player playerG; private Player playerR; /*Nodes that need to be accessible by many functions.*/ private ImageView ivg = new ImageView(); private ImageView ivr = new ImageView(); private Text greentxt = new Text("Green"); private Text redtxt = new Text("Red"); private Button rotateG = new Button("Rotate"); private Button rotateR = new Button("Rotate"); private Button nextMove = new Button("Next Move"); private Text errorMessage = new Text("Invalid move!"); private Text aiThink = new Text("Thinking..."); private Text redScore = new Text("1"); private Text greenScore = new Text("1"); private Text redTilesLeft = new Text(""); private Text greenTilesLeft = new Text(""); private ImageView sound_icon = new ImageView(); /*Various Groups that organise the screen.*/ private final Group root = new Group(); private final Group popUp1 = new Group(); private final Group popUp2 = new Group(); private final Group controls = new Group(); private final GridPane playerControls = new GridPane(); private final Group placementGrp = new Group(); private final GridPane playingBoard = new GridPane(); private final GridPane heightLabels = new GridPane(); private final GridPane clickablePanes = new GridPane(); /*We change the background colour the the scene in the game*/ private Scene scene; /*A counter that tells you if this is the first game played*/ private boolean firstGame = true; /*If the sound is muted*/ private boolean soundOn = true; /*the audio clip played when a placement is made*/ /*The sound was downloaded from * <http://www.sounds.beachware.com/2illionzayp3may/jspjrz/SWITCH.mp3>*/ private final AudioClip audio = new AudioClip(PLACEMENT_URI); /*Function mostly by Zhixian Wu, with all button styling by Manal Mohania*/ private void initialSettings() { /*The scene actually changes colour from the start screen to the actual game. * This was done by Manal Mohania*/ scene.setFill(Color.LIGHTGREY); /*Set the opacity back to normal and re-enable a button after the last game ended*/ placementGrp.setOpacity(1); playingBoard.setOpacity(1); heightLabels.setOpacity(1); nextMove.setDisable(false); /*A new game*/ gameState = new GameState(BLACK, HUMAN, HUMAN); /*The Stratopolis logo on the start screen*/ ImageView logo = new ImageView(); logo.setImage(new Image(Viewer.class.getResource(URI_BASE + "stratopolis" + ".png").toString())); placementGrp.getChildren().add(logo); logo.setLayoutX(220); logo.setLayoutY(180); /*The options for the game: Human vs Hard AI, etc.*/ /*This is the text describing these options*/ Text greenText = new Text("Player Green: Human"); greenText.setFill(Color.GREEN); greenText.setFont(Font.font("Arial", FontWeight.BOLD, 24)); Text green1 = new Text("Human: "); green1.setFill(Color.GREEN); green1.setFont(Font.font("Arial", FontWeight.BOLD, 15)); Text green2 = new Text("AI: "); green2.setFill(Color.GREEN); green2.setFont(Font.font("Arial", FontWeight.BOLD, 15)); Text redText = new Text("Player Red: Human"); redText.setFill(Color.RED); redText.setFont(Font.font("Arial", FontWeight.BOLD, 24)); Text red1 = new Text("Human: "); red1.setFill(Color.RED); red1.setFont(Font.font("Arial", FontWeight.BOLD, 15)); Text red2 = new Text("AI: "); red2.setFill(Color.RED); red2.setFont(Font.font("Arial", FontWeight.BOLD, 15)); /*Each of these buttons tell the game which players you want to be * human, and which to be AIs*/ Button greenHuman = new Button("Human"); greenHuman.setOnAction(event-> { gameState.greenPlayer = HUMAN; greenText.setText("Player Green: Human"); }); Button greenEasy = new Button("Easy"); greenEasy.setOnAction(event-> { gameState.greenPlayer = EASY; greenText.setText("Player Green: Easy"); }); Button greenMedium = new Button("Medium"); greenMedium.setOnAction(event-> { gameState.greenPlayer = MEDIUM; greenText.setText("Player Green: Medium"); }); Button greenHard = new Button("Hard"); greenHard.setOnAction(event-> { gameState.greenPlayer = HARD; greenText.setText("Player Green: Hard"); }); Button greenCheating = new Button("Cheating"); greenCheating.setOnAction(event-> { gameState.greenPlayer = CHEATING; greenText.setText("Player Green: Cheating"); }); Button redHuman = new Button("Human"); redHuman.setOnAction(event-> { gameState.redPlayer = HUMAN; redText.setText("Player Red: Human"); }); Button redEasy = new Button("Easy"); redEasy.setOnAction(event-> { gameState.redPlayer = EASY; redText.setText("Player Red: Easy"); }); Button redMedium = new Button("Medium"); redMedium.setOnAction(event-> { gameState.redPlayer = MEDIUM; redText.setText("Player Red: Medium"); }); Button redHard = new Button("Hard"); redHard.setOnAction(event-> { gameState.redPlayer = HARD; redText.setText("Player Red: Hard"); }); Button redCheating = new Button("Cheating"); redCheating.setOnAction(event-> { gameState.redPlayer = CHEATING; redText.setText("Player Red: Cheating"); }); DropShadow shadow = new DropShadow(); for (Button b : new Button[] {greenHuman, greenEasy, greenMedium, greenHard, greenCheating, redHuman, redEasy, redMedium, redHard, redCheating}) { b.setStyle("-fx-font: 14 Arial; -fx-background-color: \n" + " #090a0c,\n" + " linear-gradient(#38424b 0%, #1f2429 20%, #191d22 100%),\n" + " linear-gradient(#20262b, #191d22),\n" + " radial-gradient(center 50% 0%, radius 100%, " + "rgba(114,131,148,0.9), rgba(255,255,255,0));" + "-fx-text-fill: white;"); b.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> b.setEffect(shadow)); b.addEventHandler(MouseEvent.MOUSE_EXITED, event -> b.setEffect(null)); } /*Layout of the options by Zhixian Wu and Manal Mohania*/ HBox ghb1 = new HBox(5); ghb1.getChildren().addAll(green1,greenHuman); HBox ghb2 = new HBox(5); ghb2.getChildren().addAll(green2,greenEasy,greenMedium,greenHard,greenCheating); ghb2.setMargin(green2, new Insets(0,28,0,0)); ghb2.setSpacing(7); VBox green = new VBox(5); green.getChildren().addAll(greenText,ghb1,ghb2); green.setSpacing(15); green.setLayoutX(30); green.setLayoutY(480); HBox rhb1 = new HBox(5); rhb1.getChildren().addAll(red1,redHuman); HBox rhb2 = new HBox(5); rhb2.getChildren().addAll(red2,redEasy,redMedium,redHard,redCheating); rhb2.setMargin(red2, new Insets(0,28,0,0)); rhb2.setSpacing(7); VBox red = new VBox(5); red.getChildren().addAll(redText,rhb1,rhb2); red.setSpacing(15); red.setLayoutX(540); red.setLayoutY(480); /*This button starts the game*/ Button startGame = new Button("Start"); startGame.setOnAction(event-> { placementGrp.getChildren().clear(); makeGame(); }); startGame.setStyle("-fx-background-color: \n" + " linear-gradient(#ffd65b, #e68400),\n" + " linear-gradient(#ffef84, #f2ba44),\n" + " linear-gradient(#ffea6a, #efaa22),\n" + " linear-gradient(#ffe657 0%, #f8c202 50%, #eea10b 100%),\n" + " linear-gradient(from 0% 0% to 15% 50%, rgba(255,255,255,0.9)," + " rgba(255,255,255,0));\n" + " -fx-background-radius: 30;\n" + " -fx-background-insets: 0,1,2,3,0;\n" + " -fx-text-fill: #654b00;\n" + " -fx-font-weight: bold;\n" + " -fx-font-size: 26px;\n" + " -fx-padding: 10 25 10 25;"); startGame.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> startGame.setEffect(shadow)); startGame.addEventHandler(MouseEvent.MOUSE_EXITED, event -> startGame.setEffect(null)); startGame.setLayoutX(400); startGame.setLayoutY(620); /*The mute button by Zhixian Wu*/ /*The mute button's image*/ /*The image for unmuted sound is from * <https://pixabay.com/en/icon-loudspeaker-speaker-horn-1628258/> * The image from the muted sound is an edited version of that image*/ if (soundOn) sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon" + ".png").toString())); else sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon_off" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); sound_icon.setLayoutX(900); sound_icon.setLayoutY(15); /*The mute button's clickable pane*/ Pane sound_pane = new Pane(); sound_pane.setPrefSize(25,25); sound_pane.setOnMouseClicked(event -> { if (soundOn){ sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon_off" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); soundOn = false; } else{ sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); soundOn = true; } }); sound_pane.setLayoutX(900); sound_pane.setLayoutY(15); /*The button that brings up the instructions*/ Button instructions = new Button("?"); instructions.setOnAction(event-> getInstructions()); instructions.setStyle("-fx-background-color: #9932cc;" + "-fx-background-radius: 55em; " + "-fx-min-width: 30px; " + "-fx-min-height: 30px; " + "-fx-max-width: 30px; " + "-fx-max-height: 30px;" + "-fx-text-fill: #ffd65b" ); instructions.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> instructions.setEffect(shadow)); instructions.addEventHandler(MouseEvent.MOUSE_EXITED, event -> instructions.setEffect(null)); instructions.setLayoutX(860); instructions.setLayoutY(12); placementGrp.getChildren().addAll(green, red, startGame, instructions, sound_icon, sound_pane); } /*Function by Zhixian Wu. This function displays the instructions when called.*/ private void getInstructions(){ /*Disable the interactive stuff from these groups when the instructions are up*/ placementGrp.setDisable(true); controls.setDisable(true); /*Layout*/ GridPane mainInstruc = new GridPane(); mainInstruc.setLayoutY(90); mainInstruc.setLayoutX(130); mainInstruc.setHgap(5); mainInstruc.setVgap(5); /*A nice outline around the instructions*/ Rectangle thickBorder = new Rectangle(655,470,Color.BEIGE); thickBorder.setArcHeight(7); thickBorder.setArcWidth(7); thickBorder.setLayoutX(120); thickBorder.setLayoutY(80); thickBorder.setOpacity(0.5); /*Some of the instructions copied from * <https://boardgamegeek.com/boardgame/125022/stratopolis>*/ Text instructions = new Text("\n Stratopolis a two player strategy based game." + " Each player starts the game with twenty L-shaped tiles, each comprising " + "three squares; one player has tiles showing all green squares, green and " + "neutral squares, or two green squares and one red square, while the other " + "player's tiles reverse red and green. Players shuffle and stack these " + "tiles face down, revealing only the topmost tile. \n \n" + " To start the game, a two-square tile (one red, one green) is placed " + "on the table. Players then take turns adding their topmost tile to " + "the display. A placement is made by clicking on the board. Invalid placements " + "have duller preview images. \n\n" + " Apart from using the 'Rotate' button, the tiles can be rotated by scrolling " + "while hovering over the board.\n\n" + " A tile can be placed (1) on the table with at least one " + "edge adjacent to an edge in play or (2) on top of at least two tiles " + "already in play. When placed on a higher level, each square of the " + "tile must be supported, the tile must be level, and red and green " + "tile must be supported, the tile must be level, and red and green " + "squares cannot cover one another. (Every other color play – such as " + "green on neutral or red on red – is legal.)\n \n" + " Each player's score is the area of the largest connected area of " + "their colour, times the maximum height of that area.\n \n" + " If a tie breaker is required, the next largest area for both " + "players is used. If a tie breaker is still required, we go on " + "to the next largest area, and so on. If this does not produce a " + "winner, the winner is determined randomly.\n\n" + " You can choose a two-player game, play against an AI of any " + "difficulty (the cheating AI can peek into both your decks), or " + "watch two AIs play against each other. The two-AI game is advanced " + "by clicking the 'Next Move' button. \n" ); instructions.setFont(Font.font("Arial", 16)); instructions.setWrappingWidth(610); /*The scroll-capable pane the instructions go in*/ ScrollPane scroll = new ScrollPane(); scroll.setContent(instructions); scroll.setPrefViewportHeight(400.0); scroll.setPrefViewportWidth(620.0); /*The button that removes the instructions and makes the groups interactive again*/ Button exitBtn = new Button("x"); exitBtn.setOnAction(event-> { root.getChildren().remove(popUp1); placementGrp.setDisable(false); controls.setDisable(false); } ); exitBtn.setStyle("-fx-font: 14 Arial; -fx-background-color: \n" + " #090a0c,\n" + " linear-gradient(#38424b 0%, #1f2429 20%, #191d22 100%),\n" + " linear-gradient(#20262b, #191d22),\n" + " radial-gradient(center 50% 0%, radius 100%, rgba(114,131,148,0.9), " + " rgba(255,255,255,0));" + "-fx-text-fill: white;"); DropShadow shadow = new DropShadow(); exitBtn.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> exitBtn.setEffect(shadow)); exitBtn.addEventHandler(MouseEvent.MOUSE_EXITED, event -> exitBtn.setEffect(null)); /*Layout*/ mainInstruc.getChildren().addAll(scroll,exitBtn); GridPane.setRowIndex(scroll,1); GridPane.setColumnIndex(scroll,0); GridPane.setRowIndex(exitBtn,0); GridPane.setColumnIndex(exitBtn,0); GridPane.setHalignment(exitBtn, HPos.RIGHT); popUp1.getChildren().addAll(thickBorder,mainInstruc); root.getChildren().add(popUp1); } /*Function by Zhixian Wu*/ private void makeGame(){ playerG = new PlayerG(); playerR = new PlayerR(); /*Make the playing board*/ makeBoard(); /*Makes the controls for the game, separately from the board*/ makeControls(); } /*Function mostly by Zhixian Wu, with the running score and button styling by Manal Mohania*/ private void makeControls(){ scene.setFill(Color.WHITESMOKE); /*Make the control pane as a GridPane. This is the stuff on the right*/ playerControls.setPrefSize(120, 200); playerControls.setMaxSize(120, 200); /*The text labeling Green and Red's tiles, which you see on the right*/ greentxt.setFill(Color.GREEN); greentxt.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); redtxt.setFill(Color.RED); redtxt.setFont(Font.font("Verdana", 16)); /*The mute button's image*/ if (soundOn) sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon" + ".png").toString())); else sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon_off" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); sound_icon.setLayoutX(900); sound_icon.setLayoutY(15); /*The mute button's clickable pane*/ Pane sound_pane = new Pane(); sound_pane.setPrefSize(25,25); sound_pane.setOnMouseClicked(event -> { if (soundOn){ sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon_off" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); soundOn = false; } else{ sound_icon.setImage(new Image(Viewer.class.getResource(URI_BASE + "sound_icon" + ".png").toString())); sound_icon.setFitWidth(25); sound_icon.setPreserveRatio(true); sound_icon.setSmooth(true); sound_icon.setCache(true); soundOn = true; } }); sound_pane.setLayoutX(900); sound_pane.setLayoutY(15); /*The button that brings up the instructions*/ Button instructions = new Button("?"); instructions.setOnAction(event-> getInstructions()); instructions.setStyle("-fx-background-color: #9932cc;" + "-fx-background-radius: 55em; " + "-fx-min-width: 30px; " + "-fx-min-height: 30px; " + "-fx-max-width: 30px; " + "-fx-max-height: 30px;" + "-fx-text-fill: #ffd65b" ); DropShadow shadow = new DropShadow(); instructions.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> instructions.setEffect(shadow)); instructions.addEventHandler(MouseEvent.MOUSE_EXITED, event -> instructions.setEffect(null)); instructions.setLayoutX(860); instructions.setLayoutY(12); controls.getChildren().addAll(sound_icon,sound_pane,instructions); /*The tiles at the "top" of each player's "stack", displayed on the right*/ ivg.setImage(new Image(Viewer.class.getResource(URI_BASE + (playerG.available_tiles).get(playerG.used_tiles) + ".png").toString())); ivg.setRotate((((int) (playerG.rotation)-'A')*90)); ivg.setFitWidth(80); ivg.setPreserveRatio(true); ivg.setSmooth(true); ivg.setCache(true); ivr.setImage(new Image(Viewer.class.getResource(URI_BASE + (playerR.available_tiles).get(playerR.used_tiles) + ".png").toString())); ivr.setRotate((((int) (playerR.rotation)-'A')*90)); ivr.setFitWidth(80); ivr.setPreserveRatio(true); ivr.setSmooth(true); ivr.setCache(true); /*The events for the buttons that rotate the tiles*/ rotateG.setOnAction(event-> { playerG.rotateTile(); ivg.setRotate((((int) (playerG.rotation)-'A')*90)); }); rotateR.setOnAction(event-> { playerR.rotateTile(); ivr.setRotate((((int) (playerR.rotation)-'A')*90)); }); /*Adding the nodes. We may omit the a rotate button depending on the playingMode*/ playerControls.getChildren().addAll(greentxt,redtxt,ivg,ivr); if (gameState.greenPlayer==HUMAN) playerControls.getChildren().add(rotateG); if (gameState.redPlayer==HUMAN) playerControls.getChildren().add(rotateR); /*Layout for the controls*/ GridPane.setColumnIndex(ivg,0); GridPane.setRowIndex(ivg,0); GridPane.setColumnIndex(ivr,1); GridPane.setRowIndex(ivr,0); GridPane.setColumnIndex(rotateG,0); GridPane.setRowIndex(rotateG,1); GridPane.setColumnIndex(rotateR,1); GridPane.setRowIndex(rotateR,1); GridPane.setColumnIndex(greentxt,0); GridPane.setRowIndex(greentxt,2); GridPane.setColumnIndex(redtxt,1); GridPane.setRowIndex(redtxt,2); playerControls.setLayoutX(TILE_SIZE*BOARD_SIZE+85); playerControls.setLayoutY(200); playerControls.setHgap(10); playerControls.setVgap(10); controls.getChildren().add(playerControls); /*This line is for debugging purposes only. When set to true, it shows grid lines*/ playerControls.setGridLinesVisible(false); /*A main menu button. It clears the current game and calls initialSettings()*/ Button menu = new Button("Main Menu"); menu.setOnAction(event->{ placementGrp.setOpacity(1); controls.getChildren().clear(); placementGrp.getChildren().clear(); playingBoard.getChildren().clear(); heightLabels.getChildren().clear(); clickablePanes.getChildren().clear(); playerControls.getChildren().clear(); root.getChildren().remove(popUp2); firstGame = false; initialSettings(); }); controls.getChildren().add(menu); menu.setLayoutX(820); menu.setLayoutY(650); menu.setStyle("-fx-font: 14 Arial; -fx-background-color: \n" + " #090a0c,\n" + " linear-gradient(#38424b 0%, #1f2429 20%, #191d22 100%),\n" + " linear-gradient(#20262b, #191d22),\n" + " radial-gradient(center 50% 0%, radius 100%, rgba(114,131,148,0.9), " + " rgba(255,255,255,0));" + "-fx-text-fill: white;"); menu.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> menu.setEffect(shadow)); menu.addEventHandler(MouseEvent.MOUSE_EXITED, event -> menu.setEffect(null)); /*Scores by Manal Mohania*/ Rectangle r = new Rectangle(170,80,Color.SANDYBROWN); r.setLayoutY(50); r.setLayoutX(735); r.setArcHeight(20); r.setArcWidth(20); controls.getChildren().add(r); Text score = new Text("SCORES"); score.setLayoutX(800); score.setLayoutY(65); controls.getChildren().add(score); greenScore.setLayoutX(750); greenScore.setLayoutY(110); greenScore.setFill(Color.GREEN); greenScore.setFont(Font.font("Gentium", 44)); redScore.setLayoutX(830); redScore.setLayoutY(110); redScore.setFill(Color.RED); redScore.setFont(Font.font("Gentium", 44)); controls.getChildren().addAll(greenScore,redScore); updateScores(); /*Counter of tiles left by Zhixian Wu*/ Text tiles_left = new Text("TILES LEFT"); greenTilesLeft.setFill(Color.GREEN); greenTilesLeft.setFont(Font.font("Gentium", 24)); redTilesLeft.setFill(Color.RED); redTilesLeft.setFont(Font.font("Gentium", 24)); updateTilesLeft(); GridPane tileCounter = new GridPane(); tileCounter.getChildren().addAll(tiles_left,greenTilesLeft,redTilesLeft); for (int i = 0; i < 2; i++) { ColumnConstraints column = new ColumnConstraints(85); tileCounter.getColumnConstraints().add(column); } /*Layout of tiles left*/ GridPane.setColumnIndex(tiles_left,0); GridPane.setRowIndex(tiles_left,0); GridPane.setColumnSpan(tiles_left,2); GridPane.setHalignment(tiles_left, HPos.CENTER); GridPane.setValignment(tiles_left, VPos.BOTTOM); GridPane.setColumnIndex(greenTilesLeft,0); GridPane.setRowIndex(greenTilesLeft,1); GridPane.setHalignment(greenTilesLeft, HPos.CENTER); GridPane.setValignment(greenTilesLeft, VPos.TOP); GridPane.setColumnIndex(redTilesLeft,1); GridPane.setRowIndex(redTilesLeft,1); GridPane.setHalignment(redTilesLeft, HPos.CENTER); GridPane.setValignment(redTilesLeft, VPos.TOP); tileCounter.setLayoutX(TILE_SIZE*BOARD_SIZE+70); tileCounter.setLayoutY(360); controls.getChildren().add(tileCounter); /*If both players are AI: */ if (gameState.greenPlayer!=HUMAN && gameState.redPlayer!=HUMAN) { /*Makes the first move*/ makeGUIPlacement("MMUA"); /*The button that tells the AI to make a move, click this to progress the game*/ nextMove.setOnMousePressed(event-> { if (gameState.moveHistory.length()<=MAX_TILES*8){ aiThink.setFont(Font.font("Arial", FontWeight.NORMAL, 20)); controls.getChildren().add(aiThink); aiThink.setLayoutX(750); aiThink.setLayoutY(450); } }); nextMove.setOnAction(event-> makeAIMove()); nextMove.setStyle("-fx-font: 14 Arial; -fx-background-color: \n" + " #090a0c,\n" + " linear-gradient(#38424b 0%, #1f2429 20%, #191d22 100%),\n" + " linear-gradient(#20262b, #191d22),\n" + " radial-gradient(center 50% 0%, radius 100%, rgba(114,131,148,0.9), " + " rgba(255,255,255,0));" + "-fx-text-fill: white;"); nextMove.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> nextMove.setEffect(shadow)); nextMove.addEventHandler(MouseEvent.MOUSE_EXITED, event -> nextMove.setEffect(null)); nextMove.setLayoutX(TILE_SIZE*BOARD_SIZE+60); nextMove.setLayoutY(650); controls.getChildren().add(nextMove); } } /*Function by Zhixian Wu*/ /*It updates the TILES LEFT field on the board*/ private void updateTilesLeft(){ if (gameState.moveHistory.length()<=MAX_TILES*8-4){ String green = Integer.toString(MAX_TILES-playerG.used_tiles); String red = Integer.toString(MAX_TILES-playerR.used_tiles); greenTilesLeft.setText(green); redTilesLeft.setText(red); } else{ if (MAX_TILES*8-4<=gameState.moveHistory.length() && gameState.moveHistory.length()<=MAX_TILES*8){ greenTilesLeft.setText("0"); String red = Integer.toString(MAX_TILES-playerR.used_tiles); redTilesLeft.setText(red); } else{ greenTilesLeft.setText("0"); redTilesLeft.setText("0"); } } } /*Function mostly by Zhixian Wu, with minor changes by Manal Mohania (indicated below)*/ private void makeBoard(){ int size = TILE_SIZE * BOARD_SIZE; int offset = (BOARD_HEIGHT - size) / 2; playingBoard.setPrefSize(size, size); playingBoard.setMaxSize(size, size); if (firstGame){ /*determines the size of the rows and columns of the playing board*/ for (int i = 0; i < BOARD_SIZE; i++) { RowConstraints row = new RowConstraints(TILE_SIZE); playingBoard.getRowConstraints().add(row); } for (int i = 0; i < BOARD_SIZE; i++) { ColumnConstraints column = new ColumnConstraints(TILE_SIZE); playingBoard.getColumnConstraints().add(column); } } /*Makes the board background black using CSS*/ playingBoard.setStyle("-fx-background-color: black"); /*Creates white squares on a black background for the board*/ for (int i=0; i<BOARD_SIZE;i++){ for (int j=0; j<BOARD_SIZE; j++){ int rectSize = TILE_SIZE-2; Rectangle r = new Rectangle(rectSize, rectSize); r.setFill(Color.web("rgb(230,228,221)")); /*Colour done by Manal Mohania*/ playingBoard.getChildren().add(r); GridPane.setRowIndex(r,i); GridPane.setColumnIndex(r,j); GridPane.setHalignment(r, HPos.CENTER); GridPane.setValignment(r, VPos.CENTER); } } /*Give the board thicker outer edges*/ Rectangle thickBorder = new Rectangle(size+8,size+8,Color.BLACK); thickBorder.setArcHeight(7); thickBorder.setArcWidth(7); thickBorder.setLayoutX(offset-4); thickBorder.setLayoutY(offset-4); /*This line is for debugging purposes only. When set to true, it shows grid lines*/ playingBoard.setGridLinesVisible(false); /*Layout*/ playingBoard.setLayoutX(offset); playingBoard.setLayoutY(offset); /*An GridPane on top of playingBoard, laid out identically to playingBoard that shows the height of the tile on that position*/ heightLabels.setPrefSize(size, size); heightLabels.setMaxSize(size, size); if (firstGame){ /*Determines the size of the grid rows and columns*/ for (int i = 0; i < BOARD_SIZE; i++) { RowConstraints row = new RowConstraints(TILE_SIZE); heightLabels.getRowConstraints().add(row); } for (int i = 0; i < BOARD_SIZE; i++) { ColumnConstraints column = new ColumnConstraints(TILE_SIZE); heightLabels.getColumnConstraints().add(column); } } /*Layout*/ heightLabels.setLayoutX(offset); heightLabels.setLayoutY(offset); /*A GridPane on top of playingBoard and heightLabels, laid out identically to playingBoard, holding the interactive tiles for the game*/ clickablePanes.setPrefSize(size, size); clickablePanes.setMaxSize(size, size); if (firstGame){ /*Determines the size of the grid rows and columns*/ for (int i = 0; i < BOARD_SIZE; i++) { RowConstraints row = new RowConstraints(TILE_SIZE); clickablePanes.getRowConstraints().add(row); } for (int i = 0; i < BOARD_SIZE; i++) { ColumnConstraints column = new ColumnConstraints(TILE_SIZE); clickablePanes.getColumnConstraints().add(column); } } /*What kind of function the pane calls when clicked depends on the playingMode. * Instead of checking what the playingMode is everytime a pane is clicked, * we check it now and create different panes depending on the playingMode*/ if (gameState.greenPlayer==HUMAN && gameState.redPlayer==HUMAN) { for (int i=0; i<BOARD_SIZE;i++){ for (int j=0; j<BOARD_SIZE; j++){ /*Creates the clickable panes of the board*/ addPaneTwoPlayer(i,j); addPaneTwoPlayer(j,i); } } /*Makes the first move*/ makeGUIPlacement("MMUA"); } if (gameState.greenPlayer==HUMAN && gameState.redPlayer!=HUMAN) { for (int i=0; i<BOARD_SIZE;i++){ for (int j=0; j<BOARD_SIZE; j++){ addPanePlayerGreen(i,j); addPanePlayerGreen(j,i); } } /*Makes the first move*/ makeGUIPlacement("MMUA"); } if (gameState.greenPlayer!=HUMAN && gameState.redPlayer==HUMAN) { for (int i=0; i<BOARD_SIZE;i++){ for (int j=0; j<BOARD_SIZE; j++){ /*Creates the clickable panes of the board*/ addPanePlayerRed(i,j); addPanePlayerRed(j,i); } } /*Makes the first move*/ makeGUIPlacement("MMUA"); /*Makes the opponent's move first*/ char redTile = (char) (playerR.available_tiles).get(playerR.used_tiles); char greenTile = (char) (playerG.available_tiles).get(playerG.used_tiles); String opponent = genMoveEasy(gameState.moveHistory, greenTile); if (gameState.greenPlayer == MEDIUM) opponent = genMoveMedium(gameState.moveHistory, greenTile, redTile); if (gameState.greenPlayer == HARD) opponent = generateMove(gameState.moveHistory, greenTile, redTile); makeGUIPlacement(opponent); } /*Layout*/ clickablePanes.setLayoutX(offset); clickablePanes.setLayoutY(offset); /*The must be added in this order so the heights show on top of the tiles * and the interactive panes are on top of all of them.*/ placementGrp.getChildren().addAll(thickBorder,playingBoard,heightLabels,clickablePanes); } /** * The clickable panes for when there are two players * Function by Zhixian Wu, Manal Mohania, and Joseph Meltzer. * Idea of how to recursively creates panes that remember what position they were * created for is from StackOverflow: * <http://stackoverflow.com/questions/31095954/how-to-get-gridpane-row-and-column -ids-on-mouse-entered-in-each-cell-of-grid-in> * @param colIndex The column the pane is on * @param rowIndex The row the pane is on */ private void addPaneTwoPlayer(int colIndex, int rowIndex){ Pane pane = new Pane(); ImageView iv = new ImageView(); char col = (char) (colIndex+'A'); char row = (char) (rowIndex+'A'); /*Event by Zhixian Wu, this makes the player's move when they click on a pane*/ pane.setOnMouseClicked(event -> { switch (gameState.playerTurn){ case RED: String placement = String.valueOf(col) + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeGUIPlacement(placement); break; case GREEN: String placement2 = String.valueOf(col) + row + (playerG.available_tiles).get(playerG.used_tiles) + playerG.rotation; makeGUIPlacement(placement2); break; case BLACK: makeGUIPlacement("MMUA"); break; } }); /*Event by Joseph Meltzer, rotates the piece on scrolling*/ pane.setOnScroll(event -> { removeTempPlacement(iv); if (gameState.playerTurn==GREEN) { playerG.rotateTile(); if (event.getDeltaY()>0) { playerG.rotateTile(); playerG.rotateTile(); } ivg.setRotate((((int) (playerG.rotation) - 'A') * 90)); iv.setRotate(((int) (playerG.rotation) - 'A') * 90); } else { playerR.rotateTile(); if (event.getDeltaY()>0) { playerR.rotateTile(); playerR.rotateTile(); } ivr.setRotate(((int) (playerR.rotation) - 'A') * 90); iv.setRotate(((int) (playerR.rotation) - 'A') * 90); } switch (gameState.playerTurn){ case RED: String placement = "" + col + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeTempPlacement(iv, placement); break; case GREEN: String placement2 = "" + col + row + (playerG.available_tiles).get(playerG.used_tiles) + playerG.rotation; makeTempPlacement(iv, placement2); break; } }); /*Event by Manal Mohania, this creates the preview piece*/ pane.setOnMouseEntered(event -> { switch (gameState.playerTurn){ case RED: String placement = "" + col + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeTempPlacement(iv, placement); break; case GREEN: String placement2 = "" + col + row + (playerG.available_tiles).get(playerG.used_tiles) + playerG.rotation; makeTempPlacement(iv, placement2); break; } }); /*Event by Manal Mohania, this removes the preview piece*/ pane.setOnMouseExited(event -> removeTempPlacement(iv)); clickablePanes.getChildren().add(pane); GridPane.setRowIndex(pane,rowIndex); GridPane.setColumnIndex(pane,colIndex); } /** * The clickable panes for when the human player is Green * Function by Zhixian Wu, Manal Mohania, and Joseph Meltzer. * Idea of how to recursively creates panes that remember what position * they were created for is from StackOverflow: * <http://stackoverflow.com/questions/31095954/how-to-get-gridpane-row -and-column-ids-on-mouse-entered-in-each-cell-of-grid-in> * @param colIndex The column the pane is on * @param rowIndex The row the pane is on */ private void addPanePlayerGreen(int colIndex, int rowIndex){ Pane pane = new Pane(); ImageView iv = new ImageView(); char col = (char) (colIndex+'A'); char row = (char) (rowIndex+'A'); /*Event by Joseph Meltzer, rotates the piece on scrolling*/ pane.setOnScroll(event -> { removeTempPlacement(iv); playerG.rotateTile(); if (event.getDeltaY()>0) { playerG.rotateTile(); playerG.rotateTile(); } ivg.setRotate((((int) (playerG.rotation) - 'A') * 90)); iv.setRotate(((int) (playerG.rotation) - 'A') * 90); String placement2 = "" + col + row + (playerG.available_tiles).get(playerG.used_tiles) + playerG.rotation; makeTempPlacement(iv, placement2); }); /*Event by Manal Mohania, this adds the preview piece*/ pane.setOnMouseEntered(event -> { String placement = "" + col + row + playerG.available_tiles.get(playerG.used_tiles) + playerG.rotation; makeTempPlacement(iv, placement); }); /*Event by Manal Mohania, this removes the preview piece*/ pane.setOnMouseExited(event -> removeTempPlacement(iv)); /*Event by Zhixian Wu. This event makes the player's move when they press on a pane.*/ pane.setOnMousePressed(event -> { String placement = String.valueOf(col) + row + (playerG.available_tiles).get(playerG.used_tiles) + playerG.rotation; makeGUIPlacement(placement); int length = gameState.moveHistory.length()-2; /*This adds the image that suggests tha AI is thinking. We only suggest the AI is thinking if it actually is, i.e. your move was valid, i.e. if the last move in moveHistory was yours*/ if ('K'<=gameState.moveHistory.charAt(length) && gameState.moveHistory.charAt(length)<='T'){ aiThink.setFont(Font.font("Arial", FontWeight.NORMAL, 20)); controls.getChildren().add(aiThink); aiThink.setLayoutX(750); aiThink.setLayoutY(450); } }); /*Event by Zhixian Wu. This event causes the AI to make its move when the mouse is released.*/ pane.setOnMouseReleased(event -> { int length = gameState.moveHistory.length()-2; /*The AI only makes its move if your move was valid, i.e. if the last move in moveHistory was yours*/ if ('K'<=gameState.moveHistory.charAt(length) && gameState.moveHistory.charAt(length)<='T'){ makeAIMove(); } }); clickablePanes.getChildren().add(pane); GridPane.setRowIndex(pane,rowIndex); GridPane.setColumnIndex(pane,colIndex); } /** * The clickable panes for when the human player is Red * Function by Zhixian Wu, Manal Mohania, and Joseph Meltzer. * Idea of how to recursively creates panes that remember what position they * were created for is from StackOverflow (URL in the in the C-u5807060 originality statement) * @param colIndex The column the pane is on * @param rowIndex The row the pane is on */ private void addPanePlayerRed(int colIndex, int rowIndex){ Pane pane = new Pane(); ImageView iv = new ImageView(); char col = (char) (colIndex+'A'); char row = (char) (rowIndex+'A'); /*Event by Joseph Meltzer, rotates the piece on scrolling*/ pane.setOnScroll(event -> { removeTempPlacement(iv); playerR.rotateTile(); if (event.getDeltaY()>0) { playerR.rotateTile(); playerR.rotateTile(); } ivr.setRotate(((int) (playerR.rotation) - 'A') * 90); iv.setRotate(((int) (playerR.rotation) - 'A') * 90); String placement = "" + col + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeTempPlacement(iv, placement); }); /*Event by Manal Mohania, the adds the preview piece*/ pane.setOnMouseEntered(event -> { String placement = "" + col + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeTempPlacement(iv, placement); }); /*Event by Manal Mohania, this removes the preview piece*/ pane.setOnMouseExited(event -> removeTempPlacement(iv)); /*Event by Zhixian Wu. This event makes the player's move when they press on a pane.*/ pane.setOnMousePressed(event -> { String placement = String.valueOf(col) + row + (playerR.available_tiles).get(playerR.used_tiles) + playerR.rotation; makeGUIPlacement(placement); int length = gameState.moveHistory.length()-2; /*This adds the image that suggests tha AI is thinking. We only suggest the AI is thinking if it actually is, i.e. your move was valid, i.e. if the last move in moveHistory was yours*/ if ('A'<=gameState.moveHistory.charAt(length) && gameState.moveHistory.charAt(length)<='J'){ aiThink.setFont(Font.font("Arial", FontWeight.NORMAL, 20)); controls.getChildren().add(aiThink); aiThink.setLayoutX(740); aiThink.setLayoutY(450); } }); /*Event by Zhixian Wu. This event causes the AI to make its move when the mouse is released.*/ pane.setOnMouseReleased(event -> { int length = gameState.moveHistory.length()-2; /*The first two conditions check if your move was valid, by checking if the last move in moveHistory was yours. The AI only makes its move if your move was valid. * The last condition checks if you are out of tiles, so the AI doesn't try to make a move you are out of tiles*/ if ('A'<=gameState.moveHistory.charAt(length) && gameState.moveHistory.charAt(length)<='J' && gameState.moveHistory.length()<MAX_TILES*8){ makeAIMove(); } else{ controls.getChildren().remove(aiThink); } }); clickablePanes.getChildren().add(pane); GridPane.setRowIndex(pane,rowIndex); GridPane.setColumnIndex(pane,colIndex); } /** * This function removes the temporary placement created due to mouseover (if any) * Function by Manal Mohania * @param iv The preview image to be removed */ private void removeTempPlacement(ImageView iv){ if (iv == null) return; playingBoard.getChildren().remove(iv); } /** * This function * 1. creates a temporary placement upon mouseover - the placement pieces are * of different opacity depending upon the validity of the placement * 2. ensures that the individual piece does not lie outside the board when making the placement * 3. removes error messages if a valid placement is reached * * @param iv The preview image to be added * @param placement the placement string * * Function by Manal Mohania * Minor edits by Joseph Meltzer */ private void makeTempPlacement(ImageView iv, String placement){ /*remove error messages, if any*/ controls.getChildren().remove(errorMessage); /*The following ensure that the piece does not fall out of the board, * and thus they are not part of the preview*/ if ((placement.charAt(0) == 'Z') && ((placement.charAt(3) == 'A') || (placement.charAt(3) == 'D'))) return; if ((placement.charAt(0) == 'A') && ((placement.charAt(3) == 'B') || (placement.charAt(3) == 'C'))) return; if ((placement.charAt(1) == 'Z') && ((placement.charAt(3) == 'A') || (placement.charAt(3) == 'B'))) return; if ((placement.charAt(1) == 'A') && ((placement.charAt(3) == 'C') || (placement.charAt(3) == 'D'))) return; /*set image according to the validity of the placement*/ if (StratoGame.isPlacementValid(gameState.moveHistory.concat(placement))) { iv.setImage(new Image(Viewer.class.getResource(URI_BASE + placement.charAt(2) + "_h.png").toString())); iv.setOpacity(0.8); } else { iv.setImage(new Image(Viewer.class.getResource(URI_BASE + placement.charAt(2) + "_hx.png").toString())); iv.setOpacity(0.5); } /* set up the piece */ iv.setRotate((((int) placement.charAt(3)) - 'A') * 90); iv.setFitWidth(TILE_SIZE * 2); iv.setPreserveRatio(true); iv.setSmooth(true); iv.setCache(true); GridPane.setHalignment(iv, HPos.CENTER); GridPane.setValignment(iv, VPos.CENTER); playingBoard.getChildren().add(iv); GridPane.setRowSpan(iv, 2); GridPane.setColumnSpan(iv, 2); /* Ensure correct rotation and correct coordinates for the piece */ switch (placement.charAt(3)) { case 'A': GridPane.setColumnIndex(iv, placement.charAt(0) - 'A'); GridPane.setRowIndex(iv, placement.charAt(1) - 'A'); break; case 'B': GridPane.setColumnIndex(iv, placement.charAt(0) - 'A' - 1); GridPane.setRowIndex(iv, placement.charAt(1) - 'A'); break; case 'C': GridPane.setColumnIndex(iv, placement.charAt(0) - 'A' - 1); GridPane.setRowIndex(iv, placement.charAt(1) - 'A' - 1); break; case 'D': GridPane.setColumnIndex(iv, placement.charAt(0) - 'A'); GridPane.setRowIndex(iv, placement.charAt(1) - 'A' - 1); break; } } /** * The next function updates the score of the green and the red players. * * These functions were written by Manal Mohania * Some minor edits by Joseph Meltzer and Zhixian Wu * */ private void updateScores(){ String placement = gameState.moveHistory; int score = StratoGame.getScoreForPlacement(placement, true); greenScore.setText("" + score); int offset = (Integer.toString(score)).length() * 15; greenScore.setLayoutX(790-offset); int score2 = StratoGame.getScoreForPlacement(placement, false); redScore.setText("" + score2); int offset2 = (Integer.toString(score2)).length() * 15; redScore.setLayoutX(870 - offset2); } /** * The method that makes a placement * Function by Zhixian Wu * @param placement The placement string */ private void makeGUIPlacement(String placement) { /*Remove some messages if they are on screen*/ controls.getChildren().remove(errorMessage); controls.getChildren().remove(aiThink); String tempMove = gameState.moveHistory.concat(placement); if (!StratoGame.isPlacementValid(tempMove)) { /*If the attempted move is invalid*/ errorMessage.setFont(Font.font("Arial", FontWeight.NORMAL, 20)); controls.getChildren().add(errorMessage); errorMessage.setLayoutX(740); errorMessage.setLayoutY(450); } else { /*create the image that'll go on the board*/ ImageView iv1 = new ImageView(); iv1.setImage(new Image(Viewer.class.getResource(URI_BASE + placement.charAt(2) + "_b.png").toString())); iv1.setRotate((((int) placement.charAt(3)) - 'A') * 90); iv1.setFitWidth(TILE_SIZE * 2); iv1.setPreserveRatio(true); iv1.setSmooth(true); iv1.setCache(true); playingBoard.getChildren().add(iv1); /*make sure it spans two rows and columns*/ GridPane.setRowSpan(iv1, 2); GridPane.setColumnSpan(iv1, 2); /*make sure it's centered*/ GridPane.setHalignment(iv1, HPos.CENTER); GridPane.setValignment(iv1, VPos.CENTER); /*Place the image, in the correct rotation, in the correct place on the board*/ switch (placement.charAt(3)) { case 'A': GridPane.setColumnIndex(iv1, (((int) placement.charAt(0)) - 'A')); GridPane.setRowIndex(iv1, (((int) placement.charAt(1)) - 'A')); break; case 'B': GridPane.setColumnIndex(iv1, (((int) placement.charAt(0)) - 'A' - 1)); GridPane.setRowIndex(iv1, (((int) placement.charAt(1)) - 'A')); break; case 'C': GridPane.setColumnIndex(iv1, (((int) placement.charAt(0)) - 'A' - 1)); GridPane.setRowIndex(iv1, (((int) placement.charAt(1)) - 'A' - 1)); break; case 'D': GridPane.setColumnIndex(iv1, (((int) placement.charAt(0)) - 'A')); GridPane.setRowIndex(iv1, (((int) placement.charAt(1)) - 'A' - 1)); break; } /*Update the string of all the placements so far*/ gameState.updateMoves(placement); /*Update the heights we're supposed to display*/ displayHeights(); /*Update the scores displayed*/ updateScores(); if (soundOn) audio.play(); /*Update the top tiles shown on the control panel, * whose turn it is, and whose turn is bolded.*/ switch (gameState.playerTurn) { case RED: if (playerR.used_tiles<19){ /*If red still has tiles left*/ /*Update the red player's tile index*/ playerR.getNextTile(); /*Update the top red tile shown*/ ivr.setImage(new Image(Viewer.class.getResource(URI_BASE + (playerR.available_tiles).get(playerR.used_tiles) + ".png").toString())); ivr.setFitWidth(80); ivr.setPreserveRatio(true); ivr.setSmooth(true); ivr.setCache(true); } else{ /*If red does not still have tiles left, say they're our of tiles*/ Text outoftiles = new Text("Out of\n tiles"); outoftiles.setFont(Font.font("Arial", FontWeight.BOLD, 24)); GridPane.setColumnIndex(outoftiles,1); GridPane.setRowIndex(outoftiles,0); playerControls.getChildren().remove(ivr); playerControls.getChildren().add(outoftiles); playerR.getNextTile(); } /*Update whose turn is bolded, and which rotate button is greyed out.*/ greentxt.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); redtxt.setFont(Font.font("Verdana", FontWeight.NORMAL, 16)); rotateG.setDisable(false); rotateR.setDisable(true); break; case GREEN: if (playerG.used_tiles<19){ /*If green still has tiles left*/ /*Update the red player's tile index*/ playerG.getNextTile(); /*Update the top green tile shown*/ ivg.setImage(new Image(Viewer.class.getResource(URI_BASE + (playerG.available_tiles).get(playerG.used_tiles) + ".png").toString())); ivg.setFitWidth(80); ivg.setPreserveRatio(true); ivg.setSmooth(true); ivg.setCache(true); } else{ /*If green does not still have tiles left, say they're out of tiles*/ Text outoftiles = new Text("Out of\n tiles"); outoftiles.setFont(Font.font("Arial", FontWeight.BOLD, 24)); GridPane.setColumnIndex(outoftiles,0); GridPane.setRowIndex(outoftiles,0); playerControls.getChildren().remove(ivg); playerControls.getChildren().add(outoftiles); playerG.getNextTile(); } /*Update whose turn is bolded, and which rotate button is greyed out.*/ greentxt.setFont(Font.font("Verdana", FontWeight.NORMAL, 16)); redtxt.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); rotateG.setDisable(true); rotateR.setDisable(false); break; case BLACK: rotateG.setDisable(false); rotateR.setDisable(true); break; } /*Update whose turn it is*/ gameState.nextTurn(); /*Update the number of tiles left*/ updateTilesLeft(); /*Checks if the game is over. If it is, we display the winner.*/ if (gameState.moveHistory.length() > MAX_TILES*8) { /*Get rid of the panes*/ clickablePanes.getChildren().clear(); /*Lower opacity of the board*/ placementGrp.setOpacity(0.5); playingBoard.setOpacity(0.3); heightLabels.setOpacity(0.3); nextMove.setDisable(true); /*If green wins*/ if (Scoring.getWinner(gameState.moveHistory)){ Text score = new Text("Green Wins!"); score.setStyle("-fx-stroke: black; -fx-stroke-width: 1"); score.setFill(Color.GREEN); score.setFont(Font.font("Arial", FontWeight.BOLD, 36)); popUp2.getChildren().clear(); /*get rid of the last game's result*/ popUp2.getChildren().add(score); score.setLayoutX(265); score.setLayoutY(300); root.getChildren().add(popUp2); } else{ /*if red wins*/ Text score = new Text("Red Wins!"); score.setFill(Color.RED); score.setFont(Font.font("Arial", FontWeight.BOLD, 36)); score.setStyle("-fx-stroke: black; -fx-stroke-width: 1"); popUp2.getChildren().clear(); /*get rid of the last game's result*/ popUp2.getChildren().add(score); score.setLayoutX(270); score.setLayoutY(300); root.getChildren().add(popUp2); } greentxt.setFont(Font.font("Verdana", FontWeight.NORMAL, 16)); redtxt.setFont(Font.font("Verdana", FontWeight.NORMAL, 16)); } } } /*Function by Zhixian Wu * It makes a move for the AI, which plays as whichever player whose turn it is*/ private void makeAIMove(){ if (gameState.moveHistory.length()<=MAX_TILES*8){ /*Checks the game is not over*/ char greenTile = (char) (playerG.available_tiles).get(playerG.used_tiles); char redTile = (char) (playerR.available_tiles).get(playerR.used_tiles); String opponent = ""; if (gameState.playerTurn==GREEN){ /*if the current turn is green*/ switch (gameState.greenPlayer){ case EASY: opponent = genMoveEasy(gameState.moveHistory, greenTile); break; case MEDIUM: opponent = genMoveMedium(gameState.moveHistory, greenTile, redTile); break; case HARD: opponent = generateMove(gameState.moveHistory, greenTile, redTile); break; case CHEATING: opponent = genMoveCheating(gameState.moveHistory, playerG, playerR); break; } makeGUIPlacement(opponent); } else{ /*if the current turn is red*/ switch (gameState.redPlayer){ case EASY: opponent = genMoveEasy(gameState.moveHistory, redTile); break; case MEDIUM: opponent = genMoveMedium(gameState.moveHistory, redTile, greenTile); break; case HARD: opponent = generateMove(gameState.moveHistory, redTile, greenTile); break; case CHEATING: opponent = genMoveCheating(gameState.moveHistory, playerR, playerG); break; } makeGUIPlacement(opponent); } } } /*Display the height at each position*/ /*Function by Zhixian Wu*/ private void displayHeights(){ /*Clear existing heights*/ heightLabels.getChildren().clear(); /*Make 2D array of the height at each position*/ int[][] heights = heightArray(gameState.moveHistory); /*Recursively go through each tile and label its height*/ for (int i=0; i<BOARD_SIZE;i++){ for (int j=0; j<BOARD_SIZE; j++){ if (heights[i][j]>1){ String tall = Integer.toString(heights[i][j]); Text label1 = new Text(tall); label1.setFill(Color.WHITE); label1.setFont(Font.font("Verdana", FontWeight.BOLD, 12)); heightLabels.getChildren().add(label1); GridPane.setRowIndex(label1,j); GridPane.setColumnIndex(label1,i); GridPane.setHalignment(label1, HPos.CENTER); GridPane.setValignment(label1, VPos.CENTER); } } } } @Override public void start(Stage primaryStage) throws Exception { primaryStage.setTitle("Stratopolis"); primaryStage.setResizable(false); primaryStage.getIcons().add(new Image((Viewer.class.getResource(URI_BASE + "icon.png").toString()))); scene = new Scene(root, BOARD_WIDTH, BOARD_HEIGHT, LIGHTGREY); root.getChildren().add(controls); root.getChildren().add(placementGrp); initialSettings(); primaryStage.setScene(scene); primaryStage.show(); } }
[ "noreply@github.com" ]
noreply@github.com
988d7a40962c990ca01494987e5a1394e96a18f9
564eb616a40d0e798e43d53717da9f884942485b
/assignment1/Add1.java
0c456c9476874b64e7f7aa15b420f402f7bd9b43
[]
no_license
crypt0n90/CSCI470
75f63f0406ee4dac66706762562256b8ae590f2c
4379228d38ccc8cd019e33b757fe9c890dd9ee58
refs/heads/master
2022-12-16T12:59:44.116921
2020-09-28T19:41:18
2020-09-28T19:41:18
299,410,452
0
0
null
null
null
null
UTF-8
Java
false
false
2,477
java
import java.util.Scanner; /******************************************************************** * * * CSCI 470-1/502-1 In-Class Exercise 0 Summer 2019 * * Part 1 * * * * Class Name: Add1 * * * * Programmer: Your name goes here. * * (If you're working in a team, list * * names of each team member here with * * Z-IDs and the team lead's name first.) * * * * Purpose: A console program that adds two numbers and * * displays the result. * * * ********************************************************************/ public class Add1 { public static void main(String[] args) { String amountStr; double num1, num2; Scanner sc = new Scanner(System.in); // Read the first number as a String. System.out.println("Enter the first number: "); amountStr = sc.next(); // Try to convert String to double for calculation. try { num1 = Double.parseDouble(amountStr); } catch (NumberFormatException nfe1) { System.out.println("1st number invalid."); return; } // Read the second number as a String. System.out.println("Enter the second number: "); amountStr = sc.next(); // Try to convert String to double for calculation. try { num2 = Double.parseDouble(amountStr); } catch (NumberFormatException nfe1) { System.out.println("2nd number invalid."); return; } // Compute and print the sum. System.out.printf("Sum is: %.2f\n", num1 + num2); } }
[ "noreply@github.com" ]
noreply@github.com
fdfeeff8215b4404ddabb06528b79670399600fa
b18234e0f04e289d7bdbcff089e0aaeb96db81b0
/common/src/main/java/edu/njnu/opengms/common/config/TaskExecutorConfig.java
d7ef7ef321a26e806a6a0741100491f837e045a9
[]
no_license
sunlingzhi/3rBack
96e3efbbd231f1112a8957886823860879c9e16d
b690e6b80ca9eb794bc949ca51bffddecea76aff
refs/heads/master
2020-11-28T19:29:57.552257
2019-12-24T08:34:56
2019-12-24T08:34:56
229,903,358
0
0
null
null
null
null
UTF-8
Java
false
false
1,157
java
package edu.njnu.opengms.common.config; import base.exception.CustomAsyncExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import java.util.concurrent.Executor; /** * @ClassName TaskExecutorConfig * @Description todo * @Author sun_liber * @Date 2018/11/15 * @Version 1.0.0 */ @Configuration @EnableAsync public class TaskExecutorConfig implements AsyncConfigurer { @Override public Executor getAsyncExecutor() { ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor(); taskExecutor.setCorePoolSize(5); taskExecutor.setMaxPoolSize(10); taskExecutor.setQueueCapacity(25); taskExecutor.initialize(); return taskExecutor; } @Override public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { return new CustomAsyncExceptionHandler(); } }
[ "sun_liber@126.com" ]
sun_liber@126.com
63dc1b6ab3bf1ce560fdfd3fbfc60627428b54b6
5f6377e4f8eb4bb37bd5d620b96074c26d3267a2
/hackerRank_30DaysOfCode/Day1.java
824260e45dbdb07f092f4ec93955ec5f9e8183d9
[]
no_license
pbozidarova/Coding-Challanges
eaa63ca337f994fd76f5bfe041d28737b7580fc1
ff6e6e2ed2555f367fc330f1bda2bda1b458fdc5
refs/heads/main
2023-05-01T16:29:42.423664
2021-05-21T16:05:00
2021-05-21T16:05:00
360,220,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,046
java
package hackerRank_30DaysOfCode; import javax.xml.crypto.Data; import java.util.Scanner; public class Day1 { // Your Day 1: Data Types public static void main(String[] args) { int i = 4; double d = 4.0; String s = "HackerRank "; Scanner scan = new Scanner(System.in); /* Declare second integer, double, and String variables. */ int i2 = Integer.parseInt(scan.nextLine()); double d2 = Double.parseDouble(scan.nextLine()); String s2 = scan.nextLine(); /* Read and save an integer, double, and String to your variables.*/ // Note: If you have trouble reading the entire String, please go back and review the Tutorial closely. /* Print the sum of both integer variables on a new line. */ System.out.println(i + i2); /* Print the sum of the double variables on a new line. */ System.out.println(d + d2); /* Concatenate and print the String variables on a new line; the 's' variable above should be printed first. */ System.out.println(s + s2); scan.close(); } }
[ "p.bozidarova@gmail.com" ]
p.bozidarova@gmail.com
1a3b71152e6da6238515736340c8b05a35b22074
fc7a169262b49b639fab814ee1692c5612c8a43a
/zescs-dossier-parent/zescs-dossier-common/src/main/java/com/zescs/dossier/common/pagination/Pageable.java
8917c4006642d9b4982bb96abf7b19b78f2e099e
[]
no_license
zescs/dossier
36da1c2a3e35d67d1d22eeb6a32ff93f4ee73a62
0ddb0383b3a25044f1dce639f1bcd67593fbe45f
refs/heads/master
2020-07-02T18:52:05.700511
2016-11-20T17:18:53
2016-11-20T17:18:53
74,289,504
1
1
null
null
null
null
UTF-8
Java
false
false
268
java
package com.zescs.dossier.common.pagination; import java.io.Serializable; public interface Pageable extends Serializable{ /** * 获取分页页码 * @return */ Integer getPageIndex(); /** * 获取分页的大小 * @return */ Integer getPageSize(); }
[ "158668025@qq.com" ]
158668025@qq.com
f8d59866fef2c0f691d983c52e279b883d281803
ccb206a32ef234a7cbebee54a48f6f37b270ba8e
/app/src/main/java/com/ds/avare/instruments/AutoPilot.java
006c3d995c402ce0d3a02c9a97fe0b1d586dd442
[ "BSD-2-Clause" ]
permissive
apps4av/avare
81c5684a4fddf7e9a7c82059b5e4923d327b5f6f
ad7db8f9bba7b77a397cc106502600cee183efaa
refs/heads/master
2023-08-02T01:38:22.842074
2023-07-30T15:54:01
2023-07-30T15:54:01
6,973,819
133
135
NOASSERTION
2023-09-12T14:44:01
2012-12-02T23:34:31
Java
UTF-8
Java
false
false
6,055
java
/* Copyright (c) 2019, Apps4Av Inc. (apps4av.com) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * 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 com.ds.avare.instruments; import com.ds.avare.gps.GpsParams; import com.ds.avare.nmea.BODPacket; import com.ds.avare.nmea.GGAPacket; import com.ds.avare.nmea.RMBPacket; import com.ds.avare.nmea.RMCPacket; import com.ds.avare.place.Destination; import com.ds.avare.place.Plan; import com.ds.avare.position.Projection; import com.ds.avare.utils.Helper; /** * * @author rwalker * All functionality required to generate the NMEA sentances to drive an autopilot. No instance * data is part of this object */ public class AutoPilot { public static String apCreateSentences(GpsParams gpsParams, Plan plan, Destination dest) { // Create NMEA packet #1 RMCPacket rmcPacket = new RMCPacket( gpsParams.getTime(), gpsParams.getLatitude(), gpsParams.getLongitude(), gpsParams.getSpeedInKnots(), gpsParams.getBearing(), gpsParams.getDeclinition() ); String apText = rmcPacket.getPacket(); // Create NMEA packet #2 GGAPacket ggaPacket = new GGAPacket( gpsParams.getTime(), gpsParams.getLatitude(), gpsParams.getLongitude(), gpsParams.getAltitudeInMeters(), gpsParams.getSatCount(), gpsParams.getGeoid(), gpsParams.getHorDil() ); apText += ggaPacket.getPacket(); // If we have a destination set, then we need to add some more sentences // to tell the autopilot how to steer if (null != dest) { String startID = ""; // This is the bearing from our starting point, to our current // destination double brgOrig = Projection.getStaticBearing( dest.getLocationInit().getLongitude(), dest.getLocationInit().getLatitude(), dest.getLocation().getLongitude(), dest.getLocation().getLatitude()); // If we have a flight plan active, then we may need to re-calc the // original bearing based upon the most recently passed waypoint in the plan. if (null != plan) { if (plan.isActive()) { int nnp = plan.findNextNotPassed(); if (nnp > 0) { Destination prevDest = plan.getDestination(nnp - 1); if (null != prevDest) { startID = prevDest.getID(); brgOrig = Projection.getStaticBearing( prevDest.getLocation().getLongitude(), prevDest.getLocation().getLatitude(), dest.getLocation().getLongitude(), dest.getLocation().getLatitude()); } } } } // Calculate how many miles we are to the side of the course line double deviation = dest.getDistanceInNM() * Math.sin(Math.toRadians(Helper.angularDifference(brgOrig, dest.getBearing()))); // If we are to the left of the course line, then make our deviation negative. if(Helper.leftOfCourseLine(dest.getBearing(), brgOrig)) { deviation = -deviation; } // Limit our station IDs to 5 chars max so we don't exceed the 80 char // sentence limit. A "GPS" fix has a temp name that is quite long if(startID.length() > 5) { startID = "gSRC"; } String endID = dest.getID(); if(endID.length() > 5) { endID = "gDST"; } // We now have all the info to create NMEA packet #3 RMBPacket rmbPacket = new RMBPacket( dest.getDistanceInNM(), dest.getBearing(), dest.getLocation().getLongitude(), dest.getLocation().getLatitude(), endID, startID, deviation, gpsParams.getSpeedInKnots(), (null != plan) && (!plan.isActive() && plan.allWaypointsPassed()) ); apText += rmbPacket.getPacket(); // Now for the final NMEA packet BODPacket bodPacket = new BODPacket( endID, startID, brgOrig, (brgOrig + dest.getDeclination()) ); apText += bodPacket.getPacket(); } return apText; } }
[ "n520tx@gmail.com" ]
n520tx@gmail.com
afbc5303c4eaab218036df197ed8ea8c62d3dea9
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/transform/TestGridProjectJsonUnmarshaller.java
e43026935ac6d12994950b5b6874e080b3d9ca4e
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
3,711
java
/* * Copyright 2017-2022 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.devicefarm.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.devicefarm.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * TestGridProject JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class TestGridProjectJsonUnmarshaller implements Unmarshaller<TestGridProject, JsonUnmarshallerContext> { public TestGridProject unmarshall(JsonUnmarshallerContext context) throws Exception { TestGridProject testGridProject = new TestGridProject(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("arn", targetDepth)) { context.nextToken(); testGridProject.setArn(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("name", targetDepth)) { context.nextToken(); testGridProject.setName(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("description", targetDepth)) { context.nextToken(); testGridProject.setDescription(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("vpcConfig", targetDepth)) { context.nextToken(); testGridProject.setVpcConfig(TestGridVpcConfigJsonUnmarshaller.getInstance().unmarshall(context)); } if (context.testExpression("created", targetDepth)) { context.nextToken(); testGridProject.setCreated(DateJsonUnmarshallerFactory.getInstance("unixTimestamp").unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return testGridProject; } private static TestGridProjectJsonUnmarshaller instance; public static TestGridProjectJsonUnmarshaller getInstance() { if (instance == null) instance = new TestGridProjectJsonUnmarshaller(); return instance; } }
[ "" ]
cd5accb75f34f55e6a00208f69311422f7337fc3
875c9771f325e7b531884e17ba4dcd6e3437ea25
/PiviPlugin/src/asu/ser/capstone/pivi/SyncStart.java
eb5d6cca2036a40e2918b6cdd848f1c02b68e01e
[]
no_license
richashastri/Eclipse-Plugin
27880b165450bcb5665f891499d40efed2272f0d
d0253b391aba6d511b8cf466c31c7c429efacd85
refs/heads/master
2020-05-30T09:18:05.133528
2017-12-05T04:33:43
2017-12-05T04:33:43
83,611,404
0
1
null
null
null
null
UTF-8
Java
false
false
1,286
java
/** */ package asu.ser.capstone.pivi; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Sync Start</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * <ul> * <li>{@link asu.ser.capstone.pivi.SyncStart#getCondition <em>Condition</em>}</li> * </ul> * </p> * * @see asu.ser.capstone.pivi.PiviPackage#getSyncStart() * @model * @generated */ public interface SyncStart extends Statement { /** * Returns the value of the '<em><b>Condition</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Condition</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Condition</em>' attribute. * @see #setCondition(String) * @see asu.ser.capstone.pivi.PiviPackage#getSyncStart_Condition() * @model * @generated */ String getCondition(); /** * Sets the value of the '{@link asu.ser.capstone.pivi.SyncStart#getCondition <em>Condition</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Condition</em>' attribute. * @see #getCondition() * @generated */ void setCondition(String value); } // SyncStart
[ "skulka19@asu.edu" ]
skulka19@asu.edu
c633c4cdcf7c08a5738330c7bdbf1c109baeeecf
fa215842f7980abb1e2d95d3c1b4aae2657c25c0
/ProjectEulerJava/src/my/projecteuler/Problem16.java
bfa484c736ae90e7a644f229ad7730de492b7537
[]
no_license
tfesenko/ProjectEuler
06d179a75c98894cfd9ab4fe89ffe4f55be186ac
b692294bdab119c140e6f1aebcd9f1a85727f97e
refs/heads/master
2021-01-02T22:58:54.915051
2014-05-30T03:06:00
2014-05-30T03:06:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
790
java
package my.projecteuler; import static my.projecteuler.StringUtils.toDigits; import java.math.BigInteger; import java.util.List; import java.util.stream.Collectors; /** * <h1><a href="http://projecteuler.net/problem=16">Power digit sum</a></h1> * * <p> * 2pow15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. <br> * What is the sum of the digits of the number 2pow1000? * </p> * * @author Tatiana Fesenko <tatiana.fesenko@gmail.com> */ public class Problem16 { public static void main(String[] args) { BigInteger twoPowerThounsand = new BigInteger("2").pow(1000); List<Integer> digits = toDigits(twoPowerThounsand).collect(Collectors.<Integer> toList()); int result = digits.stream().mapToInt(x->x).sum(); System.out.println("Result: " + result); } }
[ "tatiana.fesenko@gmail.com" ]
tatiana.fesenko@gmail.com
ab1b41cfd11cc2f4915498a3c8c8ff0a4b892223
50da523d820bf991ab9aef375cd6dca4ada07e25
/src/main/java/com/zdv/shop/weixinh5/model/Refund.java
92429f265cfe8ee2b70f489ba3596f9b6437e07b
[]
no_license
729324091/zdv_shop
e46e6c4381cfea3fb737eeab84a7b024b1b5597c
40c78b1d4f5a024e1e31f1a86d36990862b23475
refs/heads/master
2020-07-22T12:21:08.304663
2019-09-09T04:09:50
2019-09-09T04:09:52
207,200,757
0
0
null
null
null
null
UTF-8
Java
false
false
2,698
java
package com.zdv.shop.weixinh5.model; public class Refund { private String appid; private String mchId; private String deviceInfo; private String nonceStr; private String sign; private String signType; private String transactionId; private String outTradeNo; private String outRefundNo; private int totalFee; private int refundFee; private String refundFeeType; private String opUserId; private String refundAccount; public String getAppid() { return appid; } public void setAppid(String appid) { this.appid = appid; } public String getMchId() { return mchId; } public void setMchId(String mchId) { this.mchId = mchId; } public String getDeviceInfo() { return deviceInfo; } public void setDeviceInfo(String deviceInfo) { this.deviceInfo = deviceInfo; } public String getNonceStr() { return nonceStr; } public void setNonceStr(String nonceStr) { this.nonceStr = nonceStr; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } public String getSignType() { return signType; } public void setSignType(String signType) { this.signType = signType; } public String getTransactionId() { return transactionId; } public void setTransactionId(String transactionId) { this.transactionId = transactionId; } public String getOutTradeNo() { return outTradeNo; } public void setOutTradeNo(String outTradeNo) { this.outTradeNo = outTradeNo; } public String getOutRefundNo() { return outRefundNo; } public void setOutRefundNo(String outRefundNo) { this.outRefundNo = outRefundNo; } public int getTotalFee() { return totalFee; } public void setTotalFee(int totalFee) { this.totalFee = totalFee; } public int getRefundFee() { return refundFee; } public void setRefundFee(int refundFee) { this.refundFee = refundFee; } public String getRefundFeeType() { return refundFeeType; } public void setRefundFeeType(String refundFeeType) { this.refundFeeType = refundFeeType; } public String getOpUserId() { return opUserId; } public void setOpUserId(String opUserId) { this.opUserId = opUserId; } public String getRefundAccount() { return refundAccount; } public void setRefundAccount(String refundAccount) { this.refundAccount = refundAccount; } }
[ "729324091@qq.com" ]
729324091@qq.com
84692331981faedbaf866e7ad69bb11c95bc0315
ac7302adf0c2aef4110c8a5b3e6e97f54acb4c41
/src/main/java/com/binary_winters/summary_kindle/exceptions/PathErroneoONoHalladoException.java
776c70acba165b18ad2bc850717f57a21df5f6e3
[]
no_license
pablonap/summary_kindle
d39a018948b4fa6aae13180f72080afd02e1c3d8
f0d80bb6fe2e6ff60f19f2fc82166459990e70a6
refs/heads/master
2022-12-19T02:22:46.022650
2020-09-14T18:39:58
2020-09-14T18:39:58
295,449,672
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
package com.binary_winters.summary_kindle.exceptions; @SuppressWarnings("serial") public class PathErroneoONoHalladoException extends Exception{ public PathErroneoONoHalladoException( String message ){ super( message ); } }
[ "pnapoli33@gmail.com" ]
pnapoli33@gmail.com
fbd75f0e92818998168acacfb625a04aa9e925d7
73004e8fb661aa5eed2fdf3d4a655119f5e55426
/app/src/test/java/com/ilham/hilihtextgenerator/ExampleUnitTest.java
a423b1ab933701763307a5496e3361f561e86202
[]
no_license
lhmrnfrzrfr/HilihTextGenerator
2e3533ea2ab0869008165977984c529b6a6f1894
73fbe0e25886ca9a16f85c0eaa6f5e7143ec2070
refs/heads/master
2020-12-11T10:52:21.604116
2020-01-14T11:46:15
2020-01-14T11:46:15
233,829,117
1
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.ilham.hilihtextgenerator; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "ilhamriana3@gmail.com" ]
ilhamriana3@gmail.com
e7f27ecd27d5de7d515e3df97233ddf9fd13b020
115d6928f0c264b4a7acb7533892a84cd38a7367
/core/src/com/derekentringer/gizmo/model/structure/destroyable/DestroyableBlockClayModel.java
8f88f6df843d70a8876efd3ec3403c777ea029f0
[]
no_license
derekentringer/gizmo
c215acc8b15805abd80a5af7518c5d5a797f5bec
09b7c3415c60495df9849d0fbcbb066f51895859
refs/heads/master
2021-08-23T19:16:06.590930
2016-10-25T03:04:45
2016-10-25T03:04:45
38,165,456
0
0
null
null
null
null
UTF-8
Java
false
false
633
java
package com.derekentringer.gizmo.model.structure.destroyable; import com.derekentringer.gizmo.model.BaseModelType; public class DestroyableBlockClayModel extends BaseDestroyableModel { public static final String DESTROYABLE_BLOCK_CLAY = "DESTROYABLE_BLOCK_CLAY"; private static final int DEFAULT_HEALTH = 50; public DestroyableBlockClayModel() { } public DestroyableBlockClayModel(boolean doesLootDrop, float posX, float posY) { mBaseModelType = BaseModelType.BLOCK_DESTROYABLE; mHealth = DEFAULT_HEALTH; mDoesLootDrop = doesLootDrop; mBlockPosition.add(posX, posY); } }
[ "dentringer@gmail.com" ]
dentringer@gmail.com
fac5fa151e6293b1238a9b313914dd3bd1b4c7a0
8233d62d16ce4fd5d845182e1e2eb809761f939d
/src/main/java/com/nado/douyuConnectorMicroservice/enums/MessageIntegrityStatuses.java
96708c291d08bf13c0d8b851fb169e21429dd31b
[]
no_license
Yintellectual/nado_DouyuConnectorMicroservice
c5c3d8f63ea40bba2ca1ddc1a59b39da1c8d80d5
a509fad2ec194611c919925e39dfadf24986523c
refs/heads/master
2021-09-01T13:03:51.433438
2017-12-27T04:52:34
2017-12-27T04:52:34
114,431,437
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package com.nado.douyuConnectorMicroservice.enums; public enum MessageIntegrityStatuses{ //total_message_count,broken_message_count; broken, good, total; }
[ "intellectual.y@gmail.com" ]
intellectual.y@gmail.com
8a4f14c517501fde88e57f1597edd066127f360b
08c29a91d8f524dc8217ced3b92e232afaef39fb
/app/src/main/java/com/myth/videofilter/render/IMovieRenderer.java
f6802525567f02211e7e29260b228f37183b189c
[ "Apache-2.0" ]
permissive
taoliuh/VideoFilter
aeaf8b3037fd79184ff83a50fa04a92de08e2446
75907514f914414d96cc54dc583a1840d432d568
refs/heads/master
2021-05-04T16:34:40.037175
2019-10-28T15:29:35
2019-10-28T15:31:05
120,254,515
1
1
null
2018-02-05T04:24:35
2018-02-05T04:24:35
null
UTF-8
Java
false
false
197
java
package com.myth.videofilter.render; public interface IMovieRenderer { void surfaceCreated(); void surfaceChanged(int width, int height); void doFrame(); void surfaceDestroy(); }
[ "maoyang@xiaomi.com" ]
maoyang@xiaomi.com
549e1d3d6761cc2e3e846f738414150edbb3a801
fa55ebbe4de7fd5955160fb6082f7a87922f204f
/javaee7tettei_sample/サンプルソース/SimpleBatch/src/java/sb/SimpleBatchResource.java
9f2def06c5d4c28fee1be14eaaf7b7790bd915fb
[]
no_license
yasushi-jp/samplesource
bc7892c0f9beaa265377b3e89f8acfbeb92ee3bc
bb992db7f240e0aaea7b2e7f07656423a8f59130
refs/heads/master
2020-03-12T15:45:12.454828
2018-04-23T13:15:41
2018-04-23T13:15:41
130,698,344
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package sb; import javax.batch.operations.JobOperator; import javax.batch.runtime.BatchRuntime; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("/jbatch") public class SimpleBatchResource { @POST @Path("start") @Produces("text/plain") public String startBatch(){ JobOperator jo = BatchRuntime.getJobOperator(); long id = jo.start("SimpleBatch", null); return "SimpleBatch has started. id = " + id; } }
[ "yasushi-ohtsuka@nifty.ne.jp" ]
yasushi-ohtsuka@nifty.ne.jp
11613353184f1d441cc9dd16c4bc80e9756cca87
3d6f43cd3f9bd1c49f24e3d72f932969ee9fd148
/src/pl/sda/javalon4/kalisz/dzien4/Data.java
231a2fae2435376f94f92d9ad0bf00b5c5e73379
[]
no_license
akalisz1987/sda-course-absolute-basis
643520c1385d655e48ad5e9c17d66ff5bc893468
f3a21867638b536b9081de71665de5ad3525852f
refs/heads/main
2023-08-17T20:37:15.172676
2021-09-12T10:25:51
2021-09-12T10:25:51
405,609,259
0
0
null
null
null
null
UTF-8
Java
false
false
2,305
java
package pl.sda.javalon4.kalisz.dzien4; public class Data {// we dont need to put main here // attributes public int dzien; public int miesiac; public int rok; // constructor public Data(int dzien, int miesiac, int rok){ this.dzien=dzien; // this jest obligatoryjne this.miesiac=miesiac; this.rok=rok; } public Data(){} // pusty konstruktor - jesli nie podamy arguemtnow to ten bedzie wybrany //method public String przerobNaTekst(){// metoda niestatyczna, dziala tylko na instancjach utworzonych z tej klasy (Data) return this.dzien+ "."+ this.miesiac+ "."+ this.rok; // jak dajesz this to zaznaczasz ze uzywasz tych atributow z gory ALE bez this WCIAZ bedzie dzialac! } //Stwórz w klasie Data metodę instancji do porównywania jej z inną datą. //Metoda powinna zwrócić: //• -1, jeśli nasza data jest wcześniejsza niż podana data //• 0, jeśli nasza data jest taka sama jak podana data //• 1, jeśli nasza data jest późniejsza niż podana data public int porownaj(Data innaData){ if(this.rok!=innaData.rok){ // jak rok nie jest taki sam - jak rok jest taki sam to konczy sie metoda return this.rok < innaData.rok ? -1:1; //jezeli nasz rok jest mniejsze od podanej daty to -1 a jak wiekszy to 1 } else if(this.miesiac!=innaData.miesiac){ return this.miesiac<innaData.miesiac ? -1:1; } else if(this.dzien!=innaData.dzien){ return this.dzien<innaData.dzien ? -1:1; } else{ return 0; } } //Pola daty takie jak miesiąc czy dzień nie mogą przyjmować dowolnych //wartości: //• ani dni, ani miesiące nie mogą być równe zero ani ujemne //• każdy rok ma 12 miesięcy //• każdy miesiąc ma określoną długość //Stwórz na klasie Data metodę instancji sprawdzającą, czy jest to //poprawna data public boolean poprawna(){ if(miesiac<1 || miesiac>12){ return false; } int maxDni=MetodyDlaDat.dniWMiesiacu(rok, miesiac);// max dni dla danego miesiaca w roku if(dzien<1 || dzien>maxDni){ return false; // jak dzien nie jest pomiedzy 1 i 28/29/30 } else{ return true; } } }
[ "alicja.kalisz@hotmail.co.uk" ]
alicja.kalisz@hotmail.co.uk
25fc381f7b7dfea9661106e7036ccad6c5a6b385
cb45ee341ecb4feb72aafbabe9d0bfdc8458a4d2
/src/com/hibernateubuntu/AddCoursesForManyDemo.java
8f04c116865c6d18ea000f0856936cce239b6f0c
[]
no_license
SaiAshish9/Spring-hibernate-ubuntu
5565d6a80b48e91f683df3fc04f906de2d32ff22
4aef41f3a16d4bc7dd672a57c2a467ad50f50172
refs/heads/master
2023-02-01T05:17:52.718593
2020-12-20T16:59:36
2020-12-20T16:59:36
322,679,519
0
0
null
null
null
null
UTF-8
Java
false
false
1,453
java
package com.hibernateubuntu; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.hibernateubuntu.entity.Course; import com.hibernateubuntu.entity.Instructor; import com.hibernateubuntu.entity.InstructorDetail; import com.hibernateubuntu.entity.Review; import com.hibernateubuntu.entity.Student; public class AddCoursesForManyDemo { public static void main(String[] args) { SessionFactory factory = new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(Instructor.class) .addAnnotatedClass(InstructorDetail.class) .addAnnotatedClass(Course.class) .addAnnotatedClass(Review.class) .addAnnotatedClass(Student.class) .buildSessionFactory(); Session session = factory.getCurrentSession(); try { session.beginTransaction(); int studentId =2; Student temp = session.get(Student.class, studentId); System.out.println(temp.getCourses()); Course tempC1 = new Course("Rubik"); Course tempC2 = new Course("Game"); tempC1.addStudent(temp); tempC2.addStudent(temp); session.save(tempC1); session.save(tempC2); session.getTransaction().commit(); } finally { session.close(); factory.close(); } } }
[ "saiashish3760@gmail.com" ]
saiashish3760@gmail.com
d329b9ed6d16e66b1bf538c262cec6a7d5bbe78d
daaa265fffd8ecbcf3bac3ef333931b7fb1883c1
/src/com/company/BondTrades.java
b48653b284c67af0baf8bb309cd09b077066c7d7
[]
no_license
enaannan/JavaLabs
11101ef70db649d83ee3f0b142ab2b4ef7af9711
bc131a85aac8394112f91b2387997d6b6369f214
refs/heads/master
2023-03-03T16:44:20.886172
2021-02-11T13:05:39
2021-02-11T13:05:39
338,028,684
0
0
null
null
null
null
UTF-8
Java
false
false
465
java
package com.company; public class BondTrades extends Trade{ static double dividend; public BondTrades(String ID, String symbol, int quantity, double price,double dividend) { super(ID, symbol, quantity, price); this.dividend = dividend; } public BondTrades(String ID, String symbol, int quantity) { super(ID, symbol, quantity); } @Override public double calcDividend() { return dividend * this.quantity; } }
[ "enaannan@gmail.com" ]
enaannan@gmail.com
c4fe1465412f095097caa8503c013ef3a510fcbc
bf5cd2ad1edeb2daf92475d95a380ddc66899789
/design-mode/src/com/microwu/cxd/design/rookie/chain/Handler.java
d867becbe9b3d7b8a3012278d9d9a51f9e19ec9b
[]
no_license
MarsGravitation/demo
4ca7cb8d8021bdc3924902946cc9bb533445a31e
53708b78dcf13367d20fd5c290cf446b02a73093
refs/heads/master
2022-11-27T10:17:18.130657
2022-04-26T08:02:59
2022-04-26T08:02:59
250,443,561
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
package com.microwu.cxd.design.rookie.chain; /** * Description: * * @Author: chengxudong chengxudong@microwu.com * Date: 2019/9/20 16:07 * Copyright: 北京小悟科技有限公司 http://www.microwu.com * Update History: * Author Time Content */ public abstract class Handler { /** * 下一个责任链成员 */ protected Handler nextHandler; public Handler getNextHandler() { return nextHandler; } public void setNextHandler(Handler nextHandler) { this.nextHandler = nextHandler; } /** * 处理传递过来的信息 * * @author chengxudong chengxudong@microwu.com * @date 2019/9/20 16:09 * * @param type * @return void */ public abstract void handleMessage(int type); }
[ "18435202728@163.com" ]
18435202728@163.com
674159fe61c3f0a427db930067701118b46fd7e9
92aa84a5db857cc3b870196f6cc693d67b703f46
/Laboratórios/lab20/PersonsContainer.java
dfbb8fb7385dedc8be5ba0ac46ea46ae9efc4141
[]
no_license
FilipaG/DemoRepo_Filipa-Goncalves
96f4882cefe40e4f93db7c96fc4d77c247f4cd74
d0ec45b4fd8a0e856804f3cb640b22cb8a9f1edd
refs/heads/master
2016-09-06T13:51:58.556649
2014-11-28T15:07:29
2014-11-28T15:07:29
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,337
java
package lab20; import java.util.Collection; /** * Interface that defines the contract to be implemented by all * containers of {@link Person} objects. * * @author Challenge.IT * * Copyright (c) 2014, Challenge.IT and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is distributed in the hope that it will be useful for learning purposes, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. * */ public interface PersonsContainer //interface que define o contrato a ser implementado por todos { // os contentores de objectos Person. /** * Add operation. * @param person The person for save in the container. * @return True if the operation succeeds. */ public boolean add(Person person); // adicionar um objeto Person ao contentor /** * @return All the persons. */ public Collection<Person> getAll(); //ver todos os objejos person da coleção /** * @param nif The person's nif number for search. * @return The person with the nif equals to the nif passed in the arguments or null if not exists. */ public Person getByNif(String nif); //ver o objecto Person que tem como argumento determinado nif ou a inexistência desse objecto Person }
[ "filipa.isabel.goncalves@gmail.com" ]
filipa.isabel.goncalves@gmail.com
1f42e704796fd013b50abaf4ec6ceeeb82bdd845
388ff0a1c61017cfac56d69dc55004eb474bad5b
/FactoryPattern/src/ingredients/dough/ThinCrustDough.java
dfe856f5c20a34ed3e802b2a3e12c384e66627a2
[]
no_license
wangshuangkc/HeadFirstDesignPatterns
f743fc53f7fa68c76b67f1aefc3f87ea3f74aafc
a370cf33aa45079e88fdfaa14d49f69fc3bb9178
refs/heads/master
2021-01-01T17:45:12.603452
2018-03-04T01:37:11
2018-03-04T01:37:11
98,147,219
0
0
null
null
null
null
UTF-8
Java
false
false
148
java
package ingredients.dough; public class ThinCrustDough implements Dough { @Override public String getDough() { return "Thin Crust"; } }
[ "sw2553@nyu.edu" ]
sw2553@nyu.edu
744498a3dab9a0160c50b4d98f3d5bd21c898e12
790250ac2bafcee22ee2fde73307f16f6d61368f
/src/main/java/de/evosec/gradle/gitflow/release/GitCredentialsProvider.java
d2ecdee327143974c826e3aebd8aff4f6e186430
[ "MIT" ]
permissive
evosec/gradle-gitflow-release
333a81fbb23ad0892b07dc74f08406fa00e56255
79c07ab0dd63770b5099f31a5a20911d1cac8226
refs/heads/develop
2021-01-22T20:13:13.125650
2018-04-26T08:58:41
2018-04-26T08:58:41
85,296,822
0
0
null
2017-11-06T14:59:18
2017-03-17T09:55:00
Java
UTF-8
Java
false
false
1,851
java
package de.evosec.gradle.gitflow.release; import org.eclipse.jgit.errors.UnsupportedCredentialItem; import org.eclipse.jgit.transport.CredentialItem; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.URIish; public class GitCredentialsProvider extends CredentialsProvider { private final ReleaseExtension extension; public GitCredentialsProvider(ReleaseExtension extension) { this.extension = extension; } @Override public boolean isInteractive() { return false; } @Override public boolean supports(CredentialItem... items) { for (CredentialItem i : items) { if (!itemIsUsernameOrPassword(i)) { return false; } } return true; } private boolean itemIsUsernameOrPassword(CredentialItem i) { return i instanceof CredentialItem.Username || i instanceof CredentialItem.Password; } @Override public boolean get(URIish uri, CredentialItem... items) { for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(extension.getUsername()); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue(extension.getPassword().toCharArray()); continue; } if (i instanceof CredentialItem.StringType && "Password: ".equals(i.getPromptText())) { ((CredentialItem.StringType) i).setValue( extension.getPassword()); continue; } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; } }
[ "k.janssen@herbrand.de" ]
k.janssen@herbrand.de
0e402c4ac249163af217b27c1d54dec67feaa51b
288edff8e03daeac6c2a17feb716d33940d98ee6
/src/com/panlong/test/Dayone/SystemOne.java
8e90c9954c634465f32edbfee166e3c9897fc335
[]
no_license
RomanceLink/JavaEE
d51c39e921838ff59799bcc70ff3e4e9ebba88f7
64d00ab7dd0a65a87ca8914150ebeb33c276d659
refs/heads/master
2020-05-04T19:40:51.813940
2019-04-29T03:02:23
2019-04-29T03:02:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,643
java
package com.panlong.test.Dayone; /* * 3.1 currentTimeMillis方法 实际上,currentTimeMillis方法就是 获取当前系统时间与1970年01月01日00:00点之间的毫秒差值 3.2 arraycopy方法 - public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length):将数组中指定的数据拷贝到另一个数组中。 数组的拷贝动作是系统级的,性能很高。System.arraycopy方法具有5个参数,含义分别为: 参数序号 参数名称 参数类型 参数含义 1 src Object 源数组 2 srcPos int 源数组索引起始位置 3 dest Object 目标数组 4 destPos int 目标数组索引起始位置 5 length int 复制元素个数 */ public class SystemOne { public static void main(String[] args) { //获取当前时间毫秒值 long time=System.currentTimeMillis(); System.out.println(time); //验证for循环打印数字1-99999所需使用时间 long start=System.currentTimeMillis(); for (int i = 0; i < 99999; i++) { System.out.println(i); } long end=System.currentTimeMillis(); System.out.println("共耗时:"+(end-start)); // 练习 // // 将src数组中前3个元素,复制到dest数组的前3个位置上复制元素前: // src数组元素[1,2,3,4,5],dest数组元素[6,7,8,9,10]复制元素后:src数组元素[1,2,3,4,5], // dest数组元素[1,2,3,9,10] int[] src=new int[]{1,2,3,4,5}; int[] dest=new int[]{6,7,8,9,10}; System.arraycopy(src,0,dest,0,3); } }
[ "42670895+Coniqiwa@users.noreply.github.com" ]
42670895+Coniqiwa@users.noreply.github.com
d12aa4cdfcf5ab1596d881b43ab3df7f6aaba2a1
18ebf12dcb3fda3b9bbd967210975bff1820c903
/eureka-server-demo/src/main/java/com/linjingc/eurekaserverdemo/EurekaServerDemoApplication.java
ed78b19ed526c0c43eb10ce93359dbecb262bdae
[]
no_license
AsummerCat/sleuth-demo
86db96260ac71d90a91cd97882d0bcbda47bbe5c
d5d0f2c9b70ecb274a06f391755ad576834a8db0
refs/heads/master
2020-06-21T04:07:15.467407
2019-07-17T08:22:30
2019-07-17T08:22:30
197,340,217
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.linjingc.eurekaserverdemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class EurekaServerDemoApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerDemoApplication.class, args); } }
[ "583188551@qq.com" ]
583188551@qq.com
64d469156385f23a4728d1c3463e9e62d1961cce
03f993ebaf17638a57fd01f4c6274863c990adf9
/src/java/uml/objCvuelo.java
ded7cec3c7d11f584e416c36e2dee600044abc15
[]
no_license
8218mauro/proyectoTns
37c39259e1243db231a2b9c413e57325b47e1792
dc6dbe8ecb540e560011202853363eeabd0cc6a5
refs/heads/master
2021-06-16T12:37:10.083959
2021-05-02T17:27:00
2021-05-02T17:27:00
74,796,330
0
0
null
null
null
null
UTF-8
Java
false
false
2,589
java
package uml; import java.sql.Timestamp; public class objCvuelo { private int idtarifa; private String nAerolinea; private String cOrigen; private String cDestino; private Timestamp fSalida; private Timestamp fllegada; private Double precio; private int cAvion; private int nPsajeros; private int aDisponibles; public objCvuelo() { } public objCvuelo(int idtarifa, String nAerolinea, String cOrigen, String cDestino, Timestamp fSalida, Timestamp fllegada, Double precio, int cAvion, int nPsajeros, int aDisponibles) { this.idtarifa = idtarifa; this.nAerolinea = nAerolinea; this.cOrigen = cOrigen; this.cDestino = cDestino; this.fSalida = fSalida; this.fllegada = fllegada; this.precio = precio; this.cAvion = cAvion; this.nPsajeros = nPsajeros; this.aDisponibles = aDisponibles; } public int getIdtarifa() { return idtarifa; } public void setIdtarifa(int idtarifa) { this.idtarifa = idtarifa; } public String getnAerolinea() { return nAerolinea; } public void setnAerolinea(String nAerolinea) { this.nAerolinea = nAerolinea; } public String getcOrigen() { return cOrigen; } public void setcOrigen(String cOrigen) { this.cOrigen = cOrigen; } public String getcDestino() { return cDestino; } public void setcDestino(String cDestino) { this.cDestino = cDestino; } public Timestamp getfSalida() { return fSalida; } public void setfSalida(Timestamp fSalida) { this.fSalida = fSalida; } public Timestamp getFllegada() { return fllegada; } public void setFllegada(Timestamp fllegada) { this.fllegada = fllegada; } public Double getPrecio() { return precio; } public void setPrecio(Double precio) { this.precio = precio; } public int getcAvion() { return cAvion; } public void setcAvion(int cAvion) { this.cAvion = cAvion; } public int getnPsajeros() { return nPsajeros; } public void setnPsajeros(int nPsajeros) { this.nPsajeros = nPsajeros; } public int getaDisponibles() { return aDisponibles; } public void setaDisponibles(int aDisponibles) { this.aDisponibles = aDisponibles; } }
[ "medinamauricio2009@hotmail.com" ]
medinamauricio2009@hotmail.com
956a697295f52f577410f67ac05a1909dfc41465
3cebe34e77438831007c598fe9a8e6109df765ed
/src/com/algoritmusistemos/gvdis/web/actions/query/copy/QueryCreateDataFormAction.java
c65711b9dbcb1f30f840c76e162457c319c915e6
[]
no_license
pauvil/test
b0be7a5fef6177ccf6aace3974151f290a1738fa
138d9a5d21d823560bb1de4e6b23e6e50b91cf3e
refs/heads/master
2021-04-15T12:55:38.790306
2018-03-21T11:42:56
2018-03-21T11:42:56
126,167,279
0
0
null
null
null
null
UTF-8
Java
false
false
1,692
java
package com.algoritmusistemos.gvdis.web.actions.query.copy; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; 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 com.algoritmusistemos.gvdis.web.delegators.UtilDelegator; import com.algoritmusistemos.gvdis.web.exceptions.DatabaseException; import com.algoritmusistemos.gvdis.web.exceptions.InternalException; import com.algoritmusistemos.gvdis.web.exceptions.ObjectNotFoundException; public class QueryCreateDataFormAction extends Action { public QueryCreateDataFormAction() { } public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ObjectNotFoundException, InternalException, DatabaseException { HttpSession session = request.getSession(); session.setAttribute("CENTER_STATE", "QUERY_CREATE_DATA"); session.removeAttribute("actGvtAsmNr"); session.removeAttribute("actGvtNr"); try { long asmNr = Long.parseLong(request.getParameter("gvtAsmNr")); session.setAttribute("actGvtAsmNr", new Long(asmNr)); List valstybes = UtilDelegator.getInstance().getValstybes(request); session.setAttribute("valstybes", valstybes); } catch (NumberFormatException nfe){ throw new InternalException("Perduoti neteisingi parametrai", nfe); } return mapping.findForward("continue"); } }
[ "pvi@kn.nrd.lt" ]
pvi@kn.nrd.lt
82325bc5dd0e39189a9e415ccca23158baf16ae3
2cbf06aecc70698fbff7f001091ffefe77185653
/FragmentConverseDemo/gen/com/yunfuyiren/fragmentconverse/R.java
f2595d35822719650eace341245c92c4fb12e836
[]
no_license
yunfuyiren/AndroidDemo
0aae1ae46b1ca929104970898cd1923d974deeba
5bed65bf76ce38a89e8a0f53271fd90e68a15a40
refs/heads/master
2021-01-01T18:41:48.262670
2014-06-11T12:20:24
2014-06-11T12:20:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,704
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.yunfuyiren.fragmentconverse; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080002; public static final int details=0x7f080001; public static final int titles=0x7f080000; } public static final class layout { public static final int activity_main=0x7f030000; public static final int fragment_main=0x7f030001; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050002; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050001; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
[ "yunfuyiren@sina.com" ]
yunfuyiren@sina.com
92d638159f1a422bba8b2808a2f3297170db5fdf
aac32fd50e8b032946f8a2ef01e852b05f2c4a4e
/jspold/jspold/taglibrary/WEB-INF/classes/RequiredTag.java
0d87c611fe168537cd75d4fafd4db07c40cbe323
[]
no_license
namratajavactp/advancejava
132fe0488fd6ac8551a2cefda58233a4a1bb3356
e54e4d75c33d9a79914fb3e4f040518f247f696f
refs/heads/master
2021-01-17T17:06:44.967410
2015-08-20T11:14:46
2015-08-20T11:14:46
41,087,982
0
0
null
null
null
null
UTF-8
Java
false
false
716
java
package sampleLib; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; public class RequiredTag implements Tag { private PageContext pageContext; private Tag parentTag; public void setPageContext(PageContext p) { pageContext=p; } public void setParent(Tag pt) { parentTag=pt; } public Tag getParent() { return parentTag; } public int doStartTag()throws JspException { try { JspWriter jw=pageContext.getOut(); jw.print("<Font color ='#ff0000'>*</Font>"); } catch(Exception e) { throw new JspException("Error in requiredTag"); } return SKIP_BODY; } public int doEndTag() throws JspException { return EVAL_PAGE; } public void release() { } }
[ "namrata.marathe@citiustech.com" ]
namrata.marathe@citiustech.com
e0da6887c69973f2466b8594643c927c2ecefdab
94b131a4722461fbd05c0123f399e3710dbfb9e7
/src/test/java/com/example/checknut/utils/DateUtilsTest.java
374d228be171021e314b642c0f5cbf37ef93af95
[]
no_license
simplelivings/checkNut
1945f4fe3b9a34e33e21a98c0c1637ae8a4b7b20
1604858d8e8b2b7a11ea857ae0c876afaf8b3867
refs/heads/master
2023-06-25T12:04:54.317451
2021-07-27T07:46:44
2021-07-27T07:46:44
388,384,255
0
0
null
null
null
null
UTF-8
Java
false
false
2,967
java
package com.example.checknut.utils; import com.example.checknut.entity.Circle; import org.junit.jupiter.api.Test; import org.opencv.core.Mat; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.imgproc.Imgproc; import org.springframework.boot.test.context.SpringBootTest; import java.io.File; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import static org.junit.jupiter.api.Assertions.*; import static org.opencv.highgui.HighGui.imshow; import static org.opencv.highgui.HighGui.waitKey; import static org.opencv.imgcodecs.Imgcodecs.imread; import static org.opencv.imgproc.Imgproc.circle; class DateUtilsTest { @Test public void cc(){ Date date = new Date(); Calendar c = Calendar.getInstance(); c.setTime(date); c.add(Calendar.MONTH,1); c.set(Calendar.DATE,1); date = c.getTime(); date = DateUtils.setHMSOfDayToZero(date); System.out.println("kkkkkkkkkk" + date); } @Test public void dd() throws InterruptedException { for (int i = 0; i < 20; i++) { Calendar c = Calendar.getInstance(); System.out.println("=="+DateUtils.getHMS(c)); Thread.sleep(5000); } } @Test public void fileTest(){ String path = "D:\\testPic"; File file = new File(path); int m = 0; if (null != file){ File[] files = file.listFiles(); for (File file1 : files) { if (file1.isDirectory()){ m++; } } } System.out.println("m=" + m); } @Test public void propTest(){ OpenCVUtils.loadOpenCV(); double prop = 1; Mat mat = imread("D:\\testPic1\\nutp1.jpg",1); prop = OpenCVUtils.calPropOfMat(mat); System.out.println("prop ==" + prop); } @Test public void imageUtils(){ OpenCVUtils.loadOpenCV(); double prop = 1; Mat mat = imread("D:\\testPic1\\nutp1.jpg",1); List<Circle> circleList = new ArrayList<>(); // circleList = ImageUtils.findCirclesByRadius(mat,0.5,100,150,10,100,0.5,100,300,50,200); circleList = ImageUtils.findCirclesByRadius(mat,prop,100,200,10,100,0.5,100,700,100,600); Mat reMat = new Mat(); Imgproc.resize( mat, reMat, new Size(mat.cols() * prop, mat.rows() * prop), 0, 0, Imgproc.INTER_AREA); for (int i = 0; i < circleList.size(); i++) { Circle circle = circleList.get(i); circle(reMat, circle.getCenter(), circle.getRadius(), new Scalar(70,240,60), 1); } OpenCVUtils.findReferencePoints(reMat, 5); imshow("mat",reMat); //按任何键,关闭图片窗口 while (true) { if (waitKey(0) == 27) { break; } } } }
[ "13842618807@139.com" ]
13842618807@139.com
b03d74c9ef5d5ad45df0f3937e5d95263056389f
1e68be606d3df96745fef385bb57c5a48a1489bd
/src/main/java/com/area/hello/world/qualifiers/PersonaRequestServiceQualifier.java
90ba4c230cb904873245c9a4b01de5d215b20de8
[]
no_license
antoniporu/helloworld-javaee-training
b32100de7d4ad927db3f553931fb4a98409555bf
30817ff3e5c3ec3a0c443bb287370f4ef76321de
refs/heads/main
2023-08-22T17:03:57.906396
2021-10-07T07:55:20
2021-10-07T07:55:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package com.area.hello.world.qualifiers; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.inject.Qualifier; /** * * @author antoni.pont */ @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({TYPE, METHOD, FIELD, PARAMETER}) public @interface PersonaRequestServiceQualifier { }
[ "antoni.pont@bonarea.com" ]
antoni.pont@bonarea.com
e522847813906777a68ee6cf0cae72b74d0beb66
209eccc599befc964e3d69dfee64b6abd0e250c9
/edziennik-core/src/main/java/pl/dziennik/core/services/impl/DefaultTeacherService.java
dd985acd42eb523abd9377437c4fb4d52f80e653
[]
no_license
piotrkrzyminski/edziennik
be73de2ef0464a3363f60b9a46f910f34579c6b5
ace639df335fa0a0b86b1832d1f23263cb8a4e24
refs/heads/master
2020-03-31T04:58:35.305941
2019-01-04T08:33:46
2019-01-04T08:33:46
151,927,939
0
0
null
2019-01-03T11:18:20
2018-10-07T10:01:46
JavaScript
UTF-8
Java
false
false
950
java
package pl.dziennik.core.services.impl; import org.apache.commons.lang3.Validate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pl.dziennik.core.repository.TeacherRepository; import pl.dziennik.core.services.TeacherService; import pl.dziennik.model.TeacherModel; @Service public class DefaultTeacherService implements TeacherService { private static final Logger LOG = LoggerFactory.getLogger(DefaultTeacherService.class); @Autowired private TeacherRepository teacherRepository; @Override public TeacherModel getTeacherForEmail(String email) { Validate.notBlank(email); final TeacherModel teacher = teacherRepository.findTeacherByEmail(email); if (teacher == null) { LOG.debug("No teacher found by email {}", email); } return teacher; } }
[ "piotr.krzyminski96@gmail.com" ]
piotr.krzyminski96@gmail.com
47e8ed9c8c8b6989dcb3d0b1b0ce03d1b1d17cf4
280ea433e82549e2224f7a2b5676dc738ca39715
/fr.uvsq.coo/src/main/java/fr/uvsq/coo/ex4_3/MainTest.java
b054707703278f667d4591259c16e3a88d845263
[]
no_license
uvsq21502859/ProjetMaven
7a7ceb585a8e661978b53836388e082f2af984fe
bbdf7cfa111e2e11166a143f37073b92db986e9b
refs/heads/master
2021-01-10T02:04:29.348632
2016-01-29T15:02:19
2016-01-29T15:02:19
45,403,485
0
0
null
null
null
null
UTF-8
Java
false
false
710
java
package fr.uvsq.coo.ex4_3; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; public class MainTest { private static final String PERSISTENCE_UNIT_NAME="Personnel"; private static EntityManagerFactory factory; public static void main(String [] args){ factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); Personnel personnel = new Personnel(); //personnel.setId(2); personnel.setNom("nom"); personnel.setPrenom("prenom"); em.persist(personnel); em.getTransaction().commit(); em.close(); } }
[ "chaiboudine@yahoo.fr" ]
chaiboudine@yahoo.fr
db8f71bded5ec4f90640028fecadc5bb2ffbb874
febc8da10ffb0a2b8822de5a097b81a530166ab3
/src/randomnumbers/test/RandomNumberTest.java
8c723afaa53b60e6f43d685f276a36388c296f98
[]
no_license
sudarshanpbhat/selenium-testng-sample
27835948be81e0620ff2846eff0e05aa6a44a499
cad2b9a6dfcc03abb3406d589bdac50453ef754f
refs/heads/master
2020-04-16T03:48:49.490181
2019-01-11T13:15:50
2019-01-11T13:15:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,621
java
package randomnumbers.test; import java.util.Arrays; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class RandomNumberTest { public static void main(String[] args) throws InterruptedException { RandomNumberTest.testGoogleChromeDriver(); } public static void testGoogleChromeDriver() throws InterruptedException { System.setProperty("webdriver.chrome.driver", "/Users/sudarshan/Downloads/chromedriver"); // Initialize chrome driver WebDriver driver = new ChromeDriver(); // Load web page driver.get("https://random.org/integers"); // Delay to wait until webpage is loaded Thread.sleep(3000); // Find input field for "number of random numbers" WebElement numOfRandoms = driver.findElement(By.xpath("//input[@name='num']")); assert(numOfRandoms != null); // Set number of randoms to 10 numOfRandoms.clear(); numOfRandoms.sendKeys("10"); // Delay to see what's happening (not necessary) Thread.sleep(1000); // Find input field for formatting in cols WebElement numOfCols = driver.findElement(By.xpath("//input[@name='col']")); assert(numOfRandoms != null); // Set columns to 10 numOfCols.clear(); numOfCols.sendKeys("10"); // Delay to see what's happening (not necessary) Thread.sleep(1000); // Submit the form = clicking generate button numOfCols.submit(); // Delay for page to load with random numbers (required) Thread.sleep(3000); // Get data web element where results are present WebElement data = driver.findElement(By.xpath("//pre[@class='data']")); String value = data.getText(); // Format data to sort // Convert to string array String[] stringArray = value.split(" "); // Convert string array to integer array int[] integerArray = new int[stringArray.length]; for (int i = 0; i < stringArray.length; i++) { integerArray[i] = Integer.parseInt(stringArray[i]); } int[] sortedArray = RandomNumberTest.sort(integerArray); System.out.println(Arrays.toString(sortedArray)); driver.close(); } private static int[] sort(int[] unsortedArray) { if (unsortedArray == null) { return null; } int temp = 0; // Variable used to swap integers for (int i = 0; i < unsortedArray.length; i++) { for (int j = 1; j < unsortedArray.length; j++) { if (unsortedArray[j-1] > unsortedArray[j]) { temp = unsortedArray[j]; unsortedArray[j] = unsortedArray[j-1]; unsortedArray[j-1] = temp; } } } return unsortedArray; } }
[ "sudarsh.bhat@gmail.com" ]
sudarsh.bhat@gmail.com
270b7ad93203d0f7f1bb3d7bc0e1e90e9ab1e8c7
aca457909ef8c4eb989ba23919de508c490b074a
/DialerJADXDecompile/io/grpc/internal/cn.java
0b5b03180e22f8d5fdb47a1de2f28e6fcb30db0c
[]
no_license
KHikami/ProjectFiCallingDeciphered
bfccc1e1ba5680d32a4337746de4b525f1911969
cc92bf6d4cad16559a2ecbc592503d37a182dee3
refs/heads/master
2021-01-12T17:50:59.643861
2016-12-08T01:20:34
2016-12-08T01:23:04
71,650,754
1
0
null
null
null
null
UTF-8
Java
false
false
91
java
package io.grpc.internal; /* compiled from: PG */ public interface cn { String b(); }
[ "chu.rachelh@gmail.com" ]
chu.rachelh@gmail.com
d229dd28774bc14295dd27ff2c489f657140060f
a70495cfc21ffdcb7c40ebdf4ae4c0750ef275b7
/src/main/java/tech/przybysz/pms/productsservice/domain/Attribute.java
ce48790768ce5930f630df2fe1288eaeaa25be29
[]
no_license
przybandrzej/products-service
54300e581390b716f069470ef35f20d90bfbe999
fe3826c1bb79c8851cde6af14381a2b34df80fb7
refs/heads/master
2023-07-29T18:25:06.507915
2021-04-11T12:25:00
2021-04-11T12:25:00
347,219,729
0
0
null
null
null
null
UTF-8
Java
false
false
3,829
java
package tech.przybysz.pms.productsservice.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import javax.persistence.*; import java.io.Serializable; /** * A Attribute. */ @Entity @Table(name = "attribute") public class Attribute implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator") private Long id; @Column(name = "name") private String name; @Column(name = "is_string") private Boolean isString; @Column(name = "is_long") private Boolean isLong; @Column(name = "is_double") private Boolean isDouble; @Column(name = "is_date") private Boolean isDate; @Column(name = "is_boolean") private Boolean isBoolean; @ManyToOne @JsonIgnoreProperties(value = "attributes", allowSetters = true) private Category category; // jhipster-needle-entity-add-field - JHipster will add fields here public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public Attribute name(String name) { this.name = name; return this; } public void setName(String name) { this.name = name; } public Boolean isIsString() { return isString; } public Attribute isString(Boolean isString) { this.isString = isString; return this; } public void setIsString(Boolean isString) { this.isString = isString; } public Boolean isIsLong() { return isLong; } public Attribute isLong(Boolean isLong) { this.isLong = isLong; return this; } public void setIsLong(Boolean isLong) { this.isLong = isLong; } public Boolean isIsDouble() { return isDouble; } public Attribute isDouble(Boolean isDouble) { this.isDouble = isDouble; return this; } public void setIsDouble(Boolean isDouble) { this.isDouble = isDouble; } public Boolean isIsDate() { return isDate; } public Attribute isDate(Boolean isDate) { this.isDate = isDate; return this; } public void setIsDate(Boolean isDate) { this.isDate = isDate; } public Boolean isIsBoolean() { return isBoolean; } public Attribute isBoolean(Boolean isBoolean) { this.isBoolean = isBoolean; return this; } public void setIsBoolean(Boolean isBoolean) { this.isBoolean = isBoolean; } public Category getCategory() { return category; } public Attribute category(Category category) { this.category = category; return this; } public void setCategory(Category category) { this.category = category; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Attribute)) { return false; } return id != null && id.equals(((Attribute) o).id); } @Override public int hashCode() { return 31; } // prettier-ignore @Override public String toString() { return "Attribute{" + "id=" + getId() + ", name='" + getName() + "'" + ", isString='" + isIsString() + "'" + ", isLong='" + isIsLong() + "'" + ", isDouble='" + isIsDouble() + "'" + ", isDate='" + isIsDate() + "'" + ", isBoolean='" + isIsBoolean() + "'" + "}"; } }
[ "andrzej.przybysz01@gmail.com" ]
andrzej.przybysz01@gmail.com
caaaf1a419fa626e009eac6ed258d39259af1284
99227394a8509fbef2fc11198d5ee96f9e5b7396
/app/src/main/java/com/ilboudofabrice/pharmainfo/activities/FindScheduledPharmaciesActivity.java
59c385d6958eed2365c0a785359883af90b1d45e
[]
no_license
donilboudo/pharmaInfo
8530a9c9512c0d629788dc6fb8f989a9192e2f71
25d74e75e96fbb52ab4638925bdf2a87debfb491
refs/heads/master
2023-08-17T01:15:26.464303
2016-12-06T05:15:47
2016-12-06T05:15:47
72,482,457
0
1
null
2023-08-09T20:30:29
2016-10-31T22:13:56
Java
UTF-8
Java
false
false
433
java
package com.ilboudofabrice.pharmainfo.activities; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.ilboudofabrice.pharmainfo.R; public class FindScheduledPharmaciesActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_find_scheaduled_pharmacy); } }
[ "ilboudofabrice@yahoo.fr" ]
ilboudofabrice@yahoo.fr
7b1b2f325c62722ef92955bf113546dd8e4b192e
e594003c17b2eaeb4baaba816eaccb56875064e0
/src/main/java/guru/springframework/spring5webapp/controllers/AuthorController.java
a40542b8f59faa41471c8994ee0dec19fd03ed0b
[]
no_license
jovehammer16/spring5webapp
9fc9793fb082c959abef5755ecf46d79f623e8de
f050c82d1bc4dafd0c1d5f55dac10bdb11fb292d
refs/heads/master
2022-04-18T06:38:45.444687
2020-04-12T13:47:38
2020-04-12T13:47:38
255,038,464
0
0
null
2020-04-12T08:18:59
2020-04-12T08:18:58
null
UTF-8
Java
false
false
685
java
package guru.springframework.spring5webapp.controllers; import guru.springframework.spring5webapp.repositories.AuthorRepository; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class AuthorController { private final AuthorRepository authorRepository; public AuthorController(AuthorRepository authorRepository) { this.authorRepository = authorRepository; } @RequestMapping("authors") public String getAuthors(Model model) { model.addAttribute("authors", authorRepository.findAll()); return "authors/list"; } }
[ "jovehammer16@gmail.com" ]
jovehammer16@gmail.com
0ea520e3ee4dac886c228352cf1841280a318d85
47c57638d0a9ea4c7be10a2c855d494aa6d4d353
/app/src/main/java/com/example/taller5_eco/MainActivity.java
d9465f25ebf3a93f975b2640e184947c31697ada
[]
no_license
xlHenshin/Taller5_ECO
eb5a8785a8b6db33f4f41cb63339f0ebce18aa21
546eae269b6b4831215cafd46eef8720e6e41cf7
refs/heads/master
2023-03-24T17:07:45.467081
2021-03-18T03:07:44
2021-03-18T03:07:44
348,923,504
0
0
null
null
null
null
UTF-8
Java
false
false
5,174
java
package com.example.taller5_eco; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.widget.Button; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.Socket; public class MainActivity extends AppCompatActivity { private Button left, right, up, down, color; private BufferedWriter bwriter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); left = findViewById(R.id.izquierda); right = findViewById(R.id.derecha); up = findViewById(R.id.arriba); down = findViewById(R.id.abajo); color = findViewById(R.id.color); new Thread( ()->{ try { Socket socket = new Socket("192.168.1.5", 5000); OutputStream os = socket.getOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(os); bwriter = new BufferedWriter(osw); } catch (IOException e) { e.printStackTrace(); } } ).start(); botonIzquierda(); botonDerecha(); botonArriba(); botonAbajo(); botonColor(); } private void botonIzquierda(){ left.setOnClickListener( v->{ new Thread( ()->{ try { bwriter.write("left\n"); } catch (IOException e) { e.printStackTrace(); } try { bwriter.flush(); } catch (IOException e) { e.printStackTrace(); } } ).start(); } ); } private void botonDerecha(){ right.setOnClickListener( v->{ new Thread( ()->{ try { bwriter.write("right\n"); } catch (IOException e) { e.printStackTrace(); } try { bwriter.flush(); } catch (IOException e) { e.printStackTrace(); } } ).start(); } ); } private void botonArriba(){ up.setOnClickListener( v->{ new Thread( ()->{ try { bwriter.write("up\n"); } catch (IOException e) { e.printStackTrace(); } try { bwriter.flush(); } catch (IOException e) { e.printStackTrace(); } } ).start(); } ); } private void botonAbajo(){ down.setOnClickListener( v->{ new Thread( ()->{ try { bwriter.write("down\n"); } catch (IOException e) { e.printStackTrace(); } try { bwriter.flush(); } catch (IOException e) { e.printStackTrace(); } } ).start(); } ); } private void botonColor(){ color.setOnClickListener( v->{ new Thread( ()->{ try { bwriter.write("color\n"); } catch (IOException e) { e.printStackTrace(); } try { bwriter.flush(); } catch (IOException e) { e.printStackTrace(); } } ).start(); } ); } }
[ "andreslayer117@gmail.com" ]
andreslayer117@gmail.com
711befc5125ba4b137b4afe748f4780b31118ccf
2b51f8b35c867f66ae212509b2d8285026a8f02a
/Videoteca/src/vasyl/videoteca/test/main/BluRayTest.java
f3e231e5b828255cef56995cc7cf0822c2713b15
[]
no_license
vasyltymchyshyn/tsac-oojava
33c9cebf432f50fdd6009fa1cc01aa407a667037
9e1d7b4ce42018b55a82c2ee9cddd79b7dca1d15
refs/heads/master
2021-01-10T02:07:53.209945
2016-02-16T11:50:47
2016-02-16T11:50:47
48,002,593
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package vasyl.videoteca.test.main; import static org.junit.Assert.*; import org.junit.Test; public class BluRayTest { @Test public void test() { fail("Not yet implemented"); } }
[ "vasiliy_94@hotmail.com" ]
vasiliy_94@hotmail.com
f517f452a6cd22f7a8660612597dd9253b350347
b357cc8e82ef87548fe9c3b3f2ceb80693f225f3
/main/io/src/boofcv/io/video/CombineFilesTogether.java
5b67628b0b00ea6a23ff82c5787a522d338bbd60
[ "Apache-2.0", "LicenseRef-scancode-takuya-ooura" ]
permissive
riskiNova/BoofCV
7806ef07586e28fbffd17537e741a71b11f0b381
16fff968dbbe07af4a9cb14395a89cde18ffb72e
refs/heads/master
2020-06-16T17:32:36.492220
2016-06-13T17:16:27
2016-06-13T17:16:27
75,079,845
1
0
null
2016-11-29T12:34:19
2016-11-29T12:34:19
null
UTF-8
Java
false
false
2,638
java
/* * Copyright (c) 2011-2013, Peter Abeles. All Rights Reserved. * * This file is part of BoofCV (http://boofcv.org). * * 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 boofcv.io.video; import boofcv.misc.BoofMiscOps; import org.ddogleg.struct.GrowQueue_I8; import java.io.*; import java.util.Collections; import java.util.List; /** * Combines a sequence of files together using a simple format. At the beginning of each segment/file [0xff,0xff,0xff] * is written, followed by the 4-byte integer in big endian order specifying the file size. After that the file * is written. This is repeated until all the files are done. * * @author Peter Abeles */ public class CombineFilesTogether { public static void combine( List<String> fileNames , String outputName ) throws IOException { FileOutputStream fos = new FileOutputStream(outputName); GrowQueue_I8 buffer = new GrowQueue_I8(); for( String s : fileNames ) { File f = new File(s); FileInputStream fis = new FileInputStream(f); long length = f.length(); buffer.resize((int)length); // write out header fos.write(255); fos.write(255); fos.write(255); fos.write((byte)(length >> 24)); fos.write((byte)(length >> 16)); fos.write((byte)(length >> 8)); fos.write((byte)(length)); fis.read(buffer.data, 0, (int) length); fos.write(buffer.data,0,(int)length); } } public static boolean readNext( DataInputStream fis , GrowQueue_I8 output ) throws IOException { int r; if( (r =fis.read()) != 0xFF || (r = fis.read()) != 0xFF || (r=fis.read()) != 0xFF ) if( r == -1 ) return false; else throw new IllegalArgumentException("Bad header byte: "+r); int length = ((fis.read() & 0xFF) << 24) | ((fis.read() & 0xFF) << 16) | ((fis.read() & 0xFF) << 8) | (fis.read() & 0xFF); output.resize(length); fis.read(output.data,0,length); return true; } public static void main( String args[] ) throws IOException { List<String> fileNames = BoofMiscOps.directoryList("log", "depth"); Collections.sort(fileNames); CombineFilesTogether.combine(fileNames,"combined.mpng"); } }
[ "peter.abeles@gmail.com" ]
peter.abeles@gmail.com
101b2e88cc0cc5481075a8c1c5217cfcb383f0a3
eb357248f3cc6484732042238c77108646f5e400
/VS/VS-ejb/src/main/java/domain/ForeignCountryRideIdGen.java
7b2b8a91fbcceaaa7555875521b30fb231279ae3
[]
no_license
Alexandervc/PTS62B
c24786070aa710c86596e31d1de0a9e79a8255fc
8c115fc8146a22f4f3e1cedce65b222d9e99a75a
refs/heads/master
2021-01-17T07:14:46.354593
2016-06-27T14:29:27
2016-06-27T14:29:27
52,521,659
1
0
null
2016-06-25T17:53:29
2016-02-25T12:08:21
Java
UTF-8
Java
false
false
728
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 domain; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; /** * The object which generates a new ForeignCountryId. * @author Jesse */ @Entity public class ForeignCountryRideIdGen implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } }
[ "j.vanbloemenhuis@student.fontys.nl" ]
j.vanbloemenhuis@student.fontys.nl
9225031af5a512eb63bc9ab524c9601a3a45be9f
7c4ece985a9b727e551d51b4a63bd919fc938ac0
/RxTools-library/src/main/java/com/vondear/rxtools/RxAnimationTool.java
ef3c43595003311aef11159a43fd7c70993b709a
[ "Apache-2.0" ]
permissive
duboAndroid/RxTools-master
caf57dbd9ae6a7d2463b2a79012dc0a859de2b6a
dfa9549ce577dac661d0360af7f90a4dd16fa232
refs/heads/master
2021-07-17T13:54:48.816686
2017-10-25T10:37:48
2017-10-25T10:37:48
108,255,984
166
41
null
null
null
null
UTF-8
Java
false
false
8,067
java
package com.vondear.rxtools; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.view.View; import android.view.ViewGroup; import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnticipateOvershootInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.view.animation.LinearInterpolator; import android.view.animation.OvershootInterpolator; import android.view.animation.ScaleAnimation; import com.vondear.rxtools.interfaces.OnUpdateListener; import static com.vondear.rxtools.RxImageTool.invisToVis; import static com.vondear.rxtools.RxImageTool.visToInvis; /** * Created by Administrator on 2017/3/15. */ public class RxAnimationTool { /** * 颜色渐变动画 * * @param beforeColor 变化之前的颜色 * @param afterColor 变化之后的颜色 * @param listener 变化事件 */ public static void animationColorGradient(int beforeColor, int afterColor, final OnUpdateListener listener) { ValueAnimator valueAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), beforeColor, afterColor).setDuration(3000); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { // textView.setTextColor((Integer) animation.getAnimatedValue()); listener.onUpdate((Integer) animation.getAnimatedValue()); } }); valueAnimator.start(); } /** * 卡片翻转动画 * * @param beforeView * @param AfterView */ public static void cardFilpAnimation(final View beforeView, final View AfterView) { Interpolator accelerator = new AccelerateInterpolator(); Interpolator decelerator = new DecelerateInterpolator(); if (beforeView.getVisibility() == View.GONE) { // 局部layout可达到字体翻转 背景不翻转 invisToVis = ObjectAnimator.ofFloat(beforeView, "rotationY", -90f, 0f); visToInvis = ObjectAnimator.ofFloat(AfterView, "rotationY", 0f, 90f); } else if (AfterView.getVisibility() == View.GONE) { invisToVis = ObjectAnimator.ofFloat(AfterView, "rotationY", -90f, 0f); visToInvis = ObjectAnimator.ofFloat(beforeView, "rotationY", 0f, 90f); } visToInvis.setDuration(250);// 翻转速度 visToInvis.setInterpolator(accelerator);// 在动画开始的地方速率改变比较慢,然后开始加速 invisToVis.setDuration(250); invisToVis.setInterpolator(decelerator); visToInvis.addListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator arg0) { if (beforeView.getVisibility() == View.GONE) { AfterView.setVisibility(View.GONE); invisToVis.start(); beforeView.setVisibility(View.VISIBLE); } else { AfterView.setVisibility(View.GONE); visToInvis.start(); beforeView.setVisibility(View.VISIBLE); } } @Override public void onAnimationCancel(Animator arg0) { } @Override public void onAnimationRepeat(Animator arg0) { } @Override public void onAnimationStart(Animator arg0) { } }); visToInvis.start(); } /** * 缩小动画 * * @param view */ public static void zoomIn(final View view, float scale, float dist) { view.setPivotY(view.getHeight()); view.setPivotX(view.getWidth() / 2); AnimatorSet mAnimatorSet = new AnimatorSet(); ObjectAnimator mAnimatorScaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.0f, scale); ObjectAnimator mAnimatorScaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.0f, scale); ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(view, "translationY", 0.0f, -dist); mAnimatorSet.play(mAnimatorTranslateY).with(mAnimatorScaleX); mAnimatorSet.play(mAnimatorScaleX).with(mAnimatorScaleY); mAnimatorSet.setDuration(300); mAnimatorSet.start(); } /** * 放大动画 * * @param view */ public static void zoomOut(final View view, float scale) { view.setPivotY(view.getHeight()); view.setPivotX(view.getWidth() / 2); AnimatorSet mAnimatorSet = new AnimatorSet(); ObjectAnimator mAnimatorScaleX = ObjectAnimator.ofFloat(view, "scaleX", scale, 1.0f); ObjectAnimator mAnimatorScaleY = ObjectAnimator.ofFloat(view, "scaleY", scale, 1.0f); ObjectAnimator mAnimatorTranslateY = ObjectAnimator.ofFloat(view, "translationY", view.getTranslationY(), 0); mAnimatorSet.play(mAnimatorTranslateY).with(mAnimatorScaleX); mAnimatorSet.play(mAnimatorScaleX).with(mAnimatorScaleY); mAnimatorSet.setDuration(300); mAnimatorSet.start(); } public static void ScaleUpDowm(View view) { ScaleAnimation animation = new ScaleAnimation(1.0f, 1.0f, 0.0f, 1.0f); animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); animation.setInterpolator(new LinearInterpolator()); animation.setDuration(1200); view.startAnimation(animation); } public static void animateHeight(int start, int end, final View view) { ValueAnimator valueAnimator = ValueAnimator.ofInt(start, end); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int value = (int) animation.getAnimatedValue();//根据时间因子的变化系数进行设置高度 ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); layoutParams.height = value; view.setLayoutParams(layoutParams);//设置高度 } }); valueAnimator.start(); } public static ObjectAnimator popup(final View view, final long duration) { view.setAlpha(0); view.setVisibility(View.VISIBLE); ObjectAnimator popup = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 0f, 1f), PropertyValuesHolder.ofFloat("scaleX", 0f, 1f), PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)); popup.setDuration(duration); popup.setInterpolator(new OvershootInterpolator()); return popup; } public static ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter) { ObjectAnimator popout = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1f, 0f), PropertyValuesHolder.ofFloat("scaleX", 1f, 0f), PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)); popout.setDuration(duration); popout.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.GONE); if (animatorListenerAdapter != null) { animatorListenerAdapter.onAnimationEnd(animation); } } }); popout.setInterpolator(new AnticipateOvershootInterpolator()); return popout; } }
[ "277627117@qq.com" ]
277627117@qq.com
2363aa7054f81d28f85064de08a0ad58d0f4a4a0
38e20b76cbab39f3f6cfe24c75f3d1bb05a889e1
/src/main/java/com/zy/designmode/iterator/LunchMenuIterater.java
f12ea2b5223bde8eb986d64eba6c23c82d36b4b9
[]
no_license
zy123a/zy-test
f15234b78d068caaf7932671cd21fdc71ab48d9a
92738488fde44309c388030416c71f8fee7f6726
refs/heads/master
2021-06-28T21:55:18.335067
2018-09-28T08:34:54
2018-09-28T08:34:54
91,323,255
0
1
null
null
null
null
UTF-8
Java
false
false
671
java
package com.zy.designmode.iterator; import java.util.Iterator; /** * Desc: * ------------------------------------ * Author:XXX * Date:2017/8/4 * Time:12:19 */ public class LunchMenuIterater implements Iterator { Object[] objects; int index = 0; public LunchMenuIterater(Object[] objects) { this.objects = objects; } public boolean hasNext() { if (index < objects.length && objects[index] != null) { return true; } return false; } public Object next() { return objects[index++]; } public void remove() { throw new UnsupportedOperationException("remove"); } }
[ "zhengyin02@meituan.com" ]
zhengyin02@meituan.com
ed6e4257e7add16b13ed3647384bc2db4ffc6d8e
3a2333d42e2198325302b64c6c9fa35b80e52cc7
/support/cas-server-support-couchbase-service-registry/src/main/java/org/apereo/cas/services/CouchbaseRegisteredServiceDeletedEvent.java
5502464a217ba358caeafea1884f8bcacc3d5ed7
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
antoine777/cas
4b78f80939c9b198e1265a27527b5aebbdab682d
7d0574350a03fffde419e0ee86eff5828ee29026
refs/heads/master
2023-04-04T23:56:51.627227
2023-03-20T05:16:55
2023-03-20T05:16:55
227,148,390
0
0
Apache-2.0
2022-02-26T00:53:30
2019-12-10T15:01:23
Java
UTF-8
Java
false
false
548
java
package org.apereo.cas.services; import org.springframework.context.ApplicationEvent; import java.io.Serial; /** * This is {@link CouchbaseRegisteredServiceDeletedEvent}. * * @author Misagh Moayyed * @since 6.0.0 * @deprecated Since 7.0.0 */ @Deprecated(since = "7.0.0") public class CouchbaseRegisteredServiceDeletedEvent extends ApplicationEvent { @Serial private static final long serialVersionUID = -6926761736041237960L; public CouchbaseRegisteredServiceDeletedEvent(final Object source) { super(source); } }
[ "mm1844@gmail.com" ]
mm1844@gmail.com
5023b02d4b17d1212841b5173092700486e478ea
2ac35db2c5c9be4cef57fbd54f0343614e1666d6
/1015-3_calendar_time/src/test/java/com/example/a1015_3_calendar_time/ExampleUnitTest.java
efdc7288361663b324bfbbec4338c7c377896d72
[]
no_license
hw05122/Mobile-Programming
aa094ea80cc17ee0560105105722c1010c7fbce9
231179f7f4a13624f323cc4031b24891d04101eb
refs/heads/master
2020-07-28T23:38:15.971015
2020-01-02T01:07:44
2020-01-02T01:07:44
208,832,088
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.example.a1015_3_calendar_time; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "hw05122@naver.com" ]
hw05122@naver.com
edbdbc220dded22972891e0939bb3a32328a7989
d3bc16fdec6824c44c3fcfff4fb6da571e89a7fe
/src/main/java/web/jhp7/web/web/rest/errors/package-info.java
296355e54eda405c9831bceb90f366f1b6e19b0b
[]
no_license
Tonterias2/jhipsterpress7
e6c7976307f119f9b7a5b691c5d88b97ffd8927d
ed6fb437c15ba0994e8b13265799087e1e1d6acd
refs/heads/master
2020-03-26T08:18:29.661309
2018-09-03T16:03:48
2018-09-03T16:03:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
/** * Specific errors used with Zalando's "problem-spring-web" library. * * More information on https://github.com/zalando/problem-spring-web */ package web.jhp7.web.web.rest.errors;
[ "ecorreos@htomail.com" ]
ecorreos@htomail.com
8fd418d24a3f5a309ff8eabd2958a52c92a2d92d
d91806654031fec4ae0542a5c9fe48c20a0c2952
/SearchEngine/src/main/java/edu/uci/index/IndexConstructor.java
7170dbcaa9afdd9efa76aea594f5d34c96a004fb
[]
no_license
spethe/SearchEngine
45652e9cefc2c4ee9d0849b008d6dd2f71b76736
31c5bdf7a6c732ca9781ffd7d636304269ccb827
refs/heads/master
2020-12-25T06:08:18.642178
2015-02-15T01:57:32
2015-02-15T01:57:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package edu.uci.index; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by swanand on 2/14/2015. */ public class IndexConstructor { public void construct(List<StemmedTerm> stemTokens) { Map<String,List<Posting>> partialIndex = new HashMap<>(); for(StemmedTerm stem : stemTokens){ List<Posting> postings; if(partialIndex.containsKey(stem.getStem())){ postings = partialIndex.get(stem.getStem()); }else{ postings = new ArrayList<>(); } Posting posting = new Posting(stem.getDocId(), stem.getPositions()); postings.add(posting); partialIndex.put(stem.getStem(),postings); } } }
[ "swanand.pethe@gmail.com" ]
swanand.pethe@gmail.com
d0917fdd2eabf0c5d31f2caeaa4b2b4ae2dc04eb
ca64e12086f1fbc93082051d13588f35951eb3e0
/src/main/java/ch/aerodigital/espcon/HexDumpCommandExecutor.java
a9f45512b6baea30041e3c114d91df159e233a1c
[ "BSD-2-Clause" ]
permissive
paweljasinski/espcon
26077dafc74391197cba7f8d2ae395b51b20e201
50077eda910ba15a8fb9ff15eecdef1a3cf65aea
refs/heads/master
2021-05-08T16:54:53.297321
2018-03-05T17:45:53
2018-03-05T17:45:53
120,178,657
0
0
null
null
null
null
UTF-8
Java
false
false
5,023
java
/* * */ package ch.aerodigital.espcon; import static ch.aerodigital.espcon.App.serialPort; import java.util.ArrayList; import jssc.SerialPortEvent; /** * * @author Pawel Jasinski */ public class HexDumpCommandExecutor extends AbstractCommandExecutor { private String filename; private enum State { IDLE, LUA_TRANSFER, DUMP_TRANSFER, } private State state; private ArrayList<String> sendBuffer; private int sendIndex; public HexDumpCommandExecutor(String command) throws InvalidCommandException { String args[] = command.split("\\s+"); if (args.length != 2) { throw new InvalidCommandException("hexdump needs 1 argument"); } filename = args[1]; state = State.IDLE; } @Override public void start() throws InvalidCommandException { String cmd = "" + "_dump=function()\n" + " local buf\n" + " local j=0\n" + " if file.open('" + filename + "','r') then\n" + " print('--HexDump start')\n" + " repeat\n" + " buf=file.read(1024)\n" + " if buf~=nil then\n" + " local n=1024\n" + " if #buf~=1024 then\n" + " n=(#buf-#buf%16)+16\n" + " end\n" + " for i=1,n do\n" + " j=j+1\n" + " if (i-1)%16==0 then\n" + " uart.write(0,string.format('%08X ',j-1))\n" + " end\n" + " uart.write(0,i>#buf and' 'or string.format('%02X ',buf:byte(i)))\n" + " if i%8==0 then uart.write(0,' ')end\n" + " if i%16==0 then uart.write(0,buf:sub(i-16+1, i):gsub('%c','.'),'\\n')end\n" + " if i%128==0 then tmr.wdclr()end\n" + " end\n" + " end\n" + " until(buf==nil)\n" + " file.close()\n" + " print('\\r--HexDump done')\n" + " else\n" + " print('\\r--HexDump error')\n" + " end\n" + "end\n" + "_dump()\n" + "_dump=nil\n"; sendBuffer = Util.cmdPrep(cmd); serialPort.pushEventListener(new SerialPortSink()); sendIndex = 0; state = State.LUA_TRANSFER; sendNext(); } private void sendNext() { if (sendIndex < sendBuffer.size()) { serialPort.writeStringX(sendBuffer.get(sendIndex)); sendIndex++; } if (sendIndex == sendBuffer.size()) { serialPort.writeStringX("\n"); } } private class SerialPortSink implements SerialPortEventListenerX { private String dataCollector; public SerialPortSink() { dataCollector = ""; } @Override public boolean serialEvent(SerialPortEvent event) { if (!event.isRXCHAR() || event.getEventValue() <= 0) { return false; } dataCollector = dataCollector + serialPort.readStringX(event.getEventValue()); switch (state) { case IDLE: writer.println("unexpected data when in idle: " + dataCollector); break; case LUA_TRANSFER: int startMarkerPos = dataCollector.indexOf("--HexDump start"); if (-1 != startMarkerPos) { dataCollector = dataCollector.substring(startMarkerPos + 15); state = State.DUMP_TRANSFER; break; } int errMarkerPos = dataCollector.indexOf("--HexDump error"); if (-1 != errMarkerPos) { serialPort.popEventListener(); serialPort.writeStringX("\n"); break; } int promptPos = dataCollector.indexOf("> "); if (-1 != promptPos) { dataCollector = dataCollector.substring(promptPos + 2); sendNext(); // break; } break; case DUMP_TRANSFER: int endMarkerPos = dataCollector.indexOf("--HexDump done"); if (-1 != endMarkerPos) { dataCollector = dataCollector.substring(endMarkerPos + 15); serialPort.popEventListener(); break; } writer.print(dataCollector); writer.flush(); dataCollector = ""; break; default: break; } return true; } } }
[ "pawel.jasinski@gmail.com" ]
pawel.jasinski@gmail.com
0b4a6aa4e1863454f6b57d6a10b7a30c4a31bb3f
e324ecd1b2b985dffee0e0a565a7715041237744
/src/main/java/com/iwd/petstore/services/dao/domain/Category.java
787fde1b2a42b2ff355a876ecb2defb9418d2803
[]
no_license
ernieshu/petstore-services
88ff92637439989c33a923ad0f4589d3641fc7e3
e22cd8740d9dae84d88b09d581e121f5a75f2d2f
refs/heads/master
2022-01-19T03:37:43.807784
2019-06-04T20:24:02
2019-06-04T20:24:02
60,285,307
0
1
null
null
null
null
UTF-8
Java
false
false
604
java
package com.iwd.petstore.services.dao.domain; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import org.hibernate.annotations.Immutable; @Entity @Immutable public class Category implements Serializable { @Id @Column(name = "CATEGORY_ID") private Integer id; @Column(name = "CATEGORY_NAME") private String name; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "ernie.shu@intelliware.com" ]
ernie.shu@intelliware.com
8ad12520e79c1053f8bc3becf30e477b3c578f46
af8819ae6be101ff78d508fe51eb80edf98bc774
/QuestionarioProj2/build/generated-sources/ap-source-output/modelo/ProfAval_.java
656e139c06e8e6314aceea5e37033e6fc0bfaf8e
[]
no_license
fernandisa/Questionario2
4c5493b3aaaef5f9e645f4a8dec5468dd569e06f
7e8a6c7fc8743924dfd3c3be1b357af8da2ddadd
refs/heads/master
2021-01-20T19:40:12.546677
2016-06-20T19:46:11
2016-06-20T19:46:11
61,065,638
0
0
null
null
null
null
UTF-8
Java
false
false
1,495
java
package modelo; import java.math.BigInteger; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; import modelo.Professor; import modelo.Questionario; @Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2016-06-20T15:55:33") @StaticMetamodel(ProfAval.class) public class ProfAval_ { public static volatile SingularAttribute<ProfAval, Long> idProfaval; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta3; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta2; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta5; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta4; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta7; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta6; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta9; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta8; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta10; public static volatile SingularAttribute<ProfAval, Questionario> idQuestionario; public static volatile SingularAttribute<ProfAval, Professor> idProfessor; public static volatile SingularAttribute<ProfAval, String> paPeriodo; public static volatile SingularAttribute<ProfAval, BigInteger> paResposta1; }
[ "borgesdecarvalho1998@gmail.com" ]
borgesdecarvalho1998@gmail.com
fe07598b569b62a6205e7d42a59e2299f9a48063
a493eb8e1cb098774eacc2d9587f225a1dc96a8c
/leetcode/String/CountNumberOfHomogenousSubstrings.java
d6e8834e226b24f0b492514ce05041f261247667
[]
no_license
lampardchelsea/hello-world
52ab8394a4cb20c3aff742f05baa75fdd77daf72
b4fa8f0de466778de99be5f2e5ddc38a6269dd41
refs/heads/master
2023-08-22T02:21:18.109561
2023-08-21T01:57:20
2023-08-21T01:57:20
67,059,187
6
2
null
2016-08-31T20:54:48
2016-08-31T17:33:13
null
UTF-8
Java
false
false
2,195
java
/** Refer to https://leetcode.com/problems/count-number-of-homogenous-substrings/ Given a string s, return the number of homogenous substrings of s. Since the answer may be too large, return it modulo 109 + 7. A string is homogenous if all the characters of the string are the same. A substring is a contiguous sequence of characters within a string. Example 1: Input: s = "abbcccaa" Output: 13 Explanation: The homogenous substrings are listed as below: "a" appears 3 times. "aa" appears 1 time. "b" appears 2 times. "bb" appears 1 time. "c" appears 3 times. "cc" appears 2 times. "ccc" appears 1 time. 3 + 1 + 2 + 1 + 3 + 2 + 1 = 13. Example 2: Input: s = "xy" Output: 2 Explanation: The homogenous substrings are "x" and "y". Example 3: Input: s = "zzzzz" Output: 15 Constraints: 1 <= s.length <= 105 s consists of lowercase letters. */ // Solution 1: Scan all chars in one pass // Refer to // https://leetcode.com/problems/count-number-of-homogenous-substrings/discuss/1064530/JavaC%2B%2BPython-Straight-Forward /** Explanation cur is the previous character in type integer, count the number of continuous same character. We iterate the whole string character by character, if it's same as the previous, we increment the count, otherwise we set it to 1. There are count characters to start with, ending at this current character, in order to construct a homogenous string. So increment our result res = (res + count) % mod. Complexity Time O(n) Space O(1) Solution 1 Java public int countHomogenous(String s) { int res = 0, cur = 0, count = 0, mod = 1_000_000_007; for (int i = 0; i < s.length(); ++i) { count = s.charAt(i) == cur ? count + 1 : 1; cur = s.charAt(i); res = (res + count) % mod; } return res; } */ class Solution { public int countHomogenous(String s) { int mod = 1000000007; int result = 0; int count = 0; char cur = '*'; for(int i = 0; i < s.length(); i++) { count = cur == s.charAt(i) ? count + 1 : 1; cur = s.charAt(i); result = (result + count) % mod; } return result; } }
[ "noreply@github.com" ]
noreply@github.com
129950ea423d3ca53ca7c08d54827901eebad4d4
78af0113ca442ca31e247ef1125141a90c24b9c5
/com.ibm.wala.core/src/com/ibm/wala/classLoader/IClass.java
8f6c4d4b8b8136d1bdcb2321b07adb8110fc6f14
[]
no_license
rsmbf/joana
25b6c684f538449aadd47c99165aaf69caa76edf
1112af9f05a3ede342736ecddae0f050b008f183
refs/heads/master
2021-01-24T21:11:59.363636
2016-11-21T17:22:17
2016-11-21T17:22:17
44,451,066
1
1
null
2015-10-17T19:25:40
2015-10-17T19:25:40
null
UTF-8
Java
false
false
5,806
java
/******************************************************************************* * Copyright (c) 2002 - 2006 IBM Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package com.ibm.wala.classLoader; import java.io.Reader; import java.util.Collection; import java.util.NoSuchElementException; import com.ibm.wala.ipa.cha.IClassHierarchyDweller; import com.ibm.wala.types.Selector; import com.ibm.wala.types.TypeName; import com.ibm.wala.types.TypeReference; import com.ibm.wala.types.annotations.Annotation; import com.ibm.wala.util.strings.Atom; /** * Basic interface for an object that represents a single Java class for analysis purposes, including array classes. */ public interface IClass extends IClassHierarchyDweller { /** * Return the object that represents the defining class loader for this class. * * @return the object that represents the defining class loader for this class. */ IClassLoader getClassLoader(); /** * Is this class a Java interface? */ boolean isInterface(); /** * @return true iff this class is abstract */ boolean isAbstract(); /** * @return true iff this class is public */ boolean isPublic(); /** * @return true iff this class is private */ boolean isPrivate(); /** * Return the integer that encodes the class's modifiers, as defined by the JVM specification * * @return the integer that encodes the class's modifiers, as defined by the JVM specification */ int getModifiers() throws UnsupportedOperationException; /** * @return the superclass, or null if java.lang.Object * @throws IllegalStateException if there's some problem determining the superclass */ IClass getSuperclass(); /** * @return Collection of (IClass) interfaces this class directly implements. If this class is an interface, returns the interfaces * it immediately extends. */ Collection<? extends IClass> getDirectInterfaces(); /** * @return Collection of (IClass) interfaces this class implements, including all ancestors of interfaces immediately implemented. * If this class is an interface, it returns all super-interfaces. */ Collection<IClass> getAllImplementedInterfaces(); /** * Finds method matching signature. Delegates to superclass if not found. * * @param selector a method signature * @return IMethod from this class matching the signature; null if not found in this class or any superclass. */ IMethod getMethod(Selector selector); /** * Finds a field. * * @throws IllegalStateException if the class contains multiple fields with name <code>name</code>. */ IField getField(Atom name); /** * Finds a field, given a name and a type. Returns <code>null</code> if not found. */ IField getField(Atom name, TypeName type); /** * @return canonical TypeReference corresponding to this class */ TypeReference getReference(); /** * @return String holding the name of the source file that defined this class, or null if none found * @throws NoSuchElementException if this class was generated from more than one source file * The assumption that a class is generated from a single source file is java * specific, and will change in the future. In place of this API, use the APIs in IClassLoader. * SJF .. we should think about this deprecation. postponing deprecation for now. */ String getSourceFileName() throws NoSuchElementException; /** * @return String representing the source file holding this class, or null if not found * @throws NoSuchElementException if this class was generated from more than one source file * The assumption that a class is generated from a single source file is java * specific, and will change in the future. In place of this API, use the APIs in IClassLoader. * SJF .. we should think about this deprecation. postponing deprecation for now. */ Reader getSource() throws NoSuchElementException; /** * @return the method that is this class's initializer, or null if none */ IMethod getClassInitializer(); /** * @return true iff the class is an array class. */ boolean isArrayClass(); /** * @return an Iterator of the IMethods declared by this class. */ Collection<IMethod> getDeclaredMethods(); /** * Compute the instance fields declared by this class or any of its superclasses. */ Collection<IField> getAllInstanceFields(); /** * Compute the static fields declared by this class or any of its superclasses. */ Collection<IField> getAllStaticFields(); /** * Compute the instance and static fields declared by this class or any of its superclasses. */ Collection<IField> getAllFields(); /** * Compute the methods declared by this class or any of its superclasses. */ Collection<IMethod> getAllMethods(); /** * Compute the instance fields declared by this class. * * @return Collection of IFields */ Collection<IField> getDeclaredInstanceFields(); /** * @return Collection of IField */ Collection<IField> getDeclaredStaticFields(); /** * @return the TypeName for this class */ TypeName getName(); /** * Does 'this' refer to a reference type? If not, then it refers to a primitive type. */ boolean isReferenceType(); /** * get annotations, if any */ Collection<Annotation> getAnnotations(); }
[ "rodrigo_cardoso@hotmail.it" ]
rodrigo_cardoso@hotmail.it
4398ba1b21b225f1f795a497d7a934c84dbd0469
839418d86b5c58d57ca547bab64f903606dd0afa
/comp 102/Practical Three/sumseries.java
c0e593755cdcb8b0368436c4192e0ea34e178720
[]
no_license
nikiel0405/Campus-Practicals
f13d8234d8578f8134a91f46fcf50d53d60a9d42
53af909fca124c6e352adf6387c1e6981a6f31f9
refs/heads/master
2021-02-14T20:22:02.389278
2020-09-29T07:20:04
2020-09-29T07:20:04
244,831,844
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
class sumseries { public static void main (String[] args){ double z = 100; double sum = 0; for ( int i = 1; (i <=100) ;i++){ sum += (Math.pow(-1,i) * i/z); z-=1; } System.out.println(sum); } }
[ "noreply@github.com" ]
noreply@github.com
60dd2ca8b971bddcec10eec2b0ca3dd9ab14ddeb
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/ads/googleads/v6/googleads-java/proto-googleads-java/src/main/java/com/google/ads/googleads/v6/services/GeoTargetConstantServiceProto.java
52cc84997062f6b663a22e14c1cb20c4385e34cf
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
10,815
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v6/services/geo_target_constant_service.proto package com.google.ads.googleads.v6.services; public final class GeoTargetConstantServiceProto { private GeoTargetConstantServiceProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_GetGeoTargetConstantRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_GetGeoTargetConstantRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_LocationNames_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_LocationNames_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_GeoTargets_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_GeoTargets_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v6_services_GeoTargetConstantSuggestion_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v6_services_GeoTargetConstantSuggestion_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\nBgoogle/ads/googleads/v6/services/geo_t" + "arget_constant_service.proto\022 google.ads" + ".googleads.v6.services\032;google/ads/googl" + "eads/v6/resources/geo_target_constant.pr" + "oto\032\034google/api/annotations.proto\032\027googl" + "e/api/client.proto\032\037google/api/field_beh" + "avior.proto\032\031google/api/resource.proto\"h" + "\n\033GetGeoTargetConstantRequest\022I\n\rresourc" + "e_name\030\001 \001(\tB2\340A\002\372A,\n*googleads.googleap" + "is.com/GeoTargetConstant\"\225\003\n SuggestGeoT" + "argetConstantsRequest\022\023\n\006locale\030\006 \001(\tH\001\210" + "\001\001\022\031\n\014country_code\030\007 \001(\tH\002\210\001\001\022j\n\016locatio" + "n_names\030\001 \001(\0132P.google.ads.googleads.v6." + "services.SuggestGeoTargetConstantsReques" + "t.LocationNamesH\000\022d\n\013geo_targets\030\002 \001(\0132M" + ".google.ads.googleads.v6.services.Sugges" + "tGeoTargetConstantsRequest.GeoTargetsH\000\032" + "\036\n\rLocationNames\022\r\n\005names\030\002 \003(\t\032*\n\nGeoTa" + "rgets\022\034\n\024geo_target_constants\030\002 \003(\tB\007\n\005q" + "ueryB\t\n\007_localeB\017\n\r_country_code\"\213\001\n!Sug" + "gestGeoTargetConstantsResponse\022f\n\037geo_ta" + "rget_constant_suggestions\030\001 \003(\0132=.google" + ".ads.googleads.v6.services.GeoTargetCons" + "tantSuggestion\"\263\002\n\033GeoTargetConstantSugg" + "estion\022\023\n\006locale\030\006 \001(\tH\000\210\001\001\022\022\n\005reach\030\007 \001" + "(\003H\001\210\001\001\022\030\n\013search_term\030\010 \001(\tH\002\210\001\001\022Q\n\023geo" + "_target_constant\030\004 \001(\01324.google.ads.goog" + "leads.v6.resources.GeoTargetConstant\022Y\n\033" + "geo_target_constant_parents\030\005 \003(\01324.goog" + "le.ads.googleads.v6.resources.GeoTargetC" + "onstantB\t\n\007_localeB\010\n\006_reachB\016\n\014_search_" + "term2\203\004\n\030GeoTargetConstantService\022\315\001\n\024Ge" + "tGeoTargetConstant\022=.google.ads.googlead" + "s.v6.services.GetGeoTargetConstantReques" + "t\0324.google.ads.googleads.v6.resources.Ge" + "oTargetConstant\"@\202\323\344\223\002*\022(/v6/{resource_n" + "ame=geoTargetConstants/*}\332A\rresource_nam" + "e\022\317\001\n\031SuggestGeoTargetConstants\022B.google" + ".ads.googleads.v6.services.SuggestGeoTar" + "getConstantsRequest\032C.google.ads.googlea" + "ds.v6.services.SuggestGeoTargetConstants" + "Response\")\202\323\344\223\002#\"\036/v6/geoTargetConstants" + ":suggest:\001*\032E\312A\030googleads.googleapis.com" + "\322A\'https://www.googleapis.com/auth/adwor" + "dsB\204\002\n$com.google.ads.googleads.v6.servi" + "cesB\035GeoTargetConstantServiceProtoP\001ZHgo" + "ogle.golang.org/genproto/googleapis/ads/" + "googleads/v6/services;services\242\002\003GAA\252\002 G" + "oogle.Ads.GoogleAds.V6.Services\312\002 Google" + "\\Ads\\GoogleAds\\V6\\Services\352\002$Google::Ads" + "::GoogleAds::V6::Servicesb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.ads.googleads.v6.resources.GeoTargetConstantProto.getDescriptor(), com.google.api.AnnotationsProto.getDescriptor(), com.google.api.ClientProto.getDescriptor(), com.google.api.FieldBehaviorProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), }); internal_static_google_ads_googleads_v6_services_GetGeoTargetConstantRequest_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_ads_googleads_v6_services_GetGeoTargetConstantRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_GetGeoTargetConstantRequest_descriptor, new java.lang.String[] { "ResourceName", }); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_descriptor, new java.lang.String[] { "Locale", "CountryCode", "LocationNames", "GeoTargets", "Query", "Locale", "CountryCode", }); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_LocationNames_descriptor = internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_descriptor.getNestedTypes().get(0); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_LocationNames_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_LocationNames_descriptor, new java.lang.String[] { "Names", }); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_GeoTargets_descriptor = internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_descriptor.getNestedTypes().get(1); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_GeoTargets_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsRequest_GeoTargets_descriptor, new java.lang.String[] { "GeoTargetConstants", }); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsResponse_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_SuggestGeoTargetConstantsResponse_descriptor, new java.lang.String[] { "GeoTargetConstantSuggestions", }); internal_static_google_ads_googleads_v6_services_GeoTargetConstantSuggestion_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_google_ads_googleads_v6_services_GeoTargetConstantSuggestion_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v6_services_GeoTargetConstantSuggestion_descriptor, new java.lang.String[] { "Locale", "Reach", "SearchTerm", "GeoTargetConstant", "GeoTargetConstantParents", "Locale", "Reach", "SearchTerm", }); com.google.protobuf.ExtensionRegistry registry = com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); registry.add(com.google.api.AnnotationsProto.http); registry.add(com.google.api.ClientProto.methodSignature); registry.add(com.google.api.ClientProto.oauthScopes); registry.add(com.google.api.ResourceProto.resourceReference); com.google.protobuf.Descriptors.FileDescriptor .internalUpdateFileDescriptor(descriptor, registry); com.google.ads.googleads.v6.resources.GeoTargetConstantProto.getDescriptor(); com.google.api.AnnotationsProto.getDescriptor(); com.google.api.ClientProto.getDescriptor(); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
cf35f970321fafadf638905379b018cb1627d360
e5af5bce5ae99a4210205704d29c22dadc1fd03d
/src/main/java/org/drip/sample/hjm/MultiFactorQMDynamics.java
38540efb7b7916b5cad1a4aa5e1e731217333350
[ "Apache-2.0" ]
permissive
idreamsfy/DRIP
7a5f969b1ca51f6cf957704ecb043d502c4c4bbc
f20cb7457efaadb7ff109fbcea0be0b9d9106230
refs/heads/master
2021-11-03T06:38:49.457972
2019-01-13T09:21:13
2019-01-13T09:21:13
100,677,021
0
0
Apache-2.0
2019-01-13T09:21:03
2017-08-18T05:43:52
Java
UTF-8
Java
false
false
12,910
java
package org.drip.sample.hjm; import org.drip.analytics.date.*; import org.drip.analytics.definition.MarketSurface; import org.drip.analytics.support.Helper; import org.drip.dynamics.hjm.*; import org.drip.function.definition.R1ToR1; import org.drip.function.r1tor1.FlatUnivariate; import org.drip.quant.common.FormatUtil; import org.drip.sequence.random.*; import org.drip.service.env.EnvManager; import org.drip.spline.basis.PolynomialFunctionSetParams; import org.drip.spline.params.*; import org.drip.spline.stretch.MultiSegmentSequenceBuilder; import org.drip.state.creator.ScenarioMarketSurfaceBuilder; import org.drip.state.identifier.*; /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! * Copyright (C) 2017 Lakshmi Krishnamurthy * Copyright (C) 2016 Lakshmi Krishnamurthy * Copyright (C) 2015 Lakshmi Krishnamurthy * * This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model * libraries targeting analysts and developers * https://lakshmidrip.github.io/DRIP/ * * DRIP is composed of four main libraries: * * - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ * - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ * - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ * - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ * * - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, * Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA * Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV * Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM * Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. * * - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy * Incorporator, Holdings Constraint, and Transaction Costs. * * - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. * * - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. * * 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. */ /** * MultiFactorQMDynamics demonstrates the Construction and Usage of the 3-Factor Gaussian Model Dynamics for * the Evolution of the Discount Factor Quantification Metrics - the Instantaneous Forward Rate, the LIBOR * Forward Rate, the Shifted LIBOR Forward Rate, the Short Rate, the Compounded Short Rate, and the Price. * * @author Lakshmi Krishnamurthy */ public class MultiFactorQMDynamics { private static final MarketSurface FlatVolatilitySurface ( final JulianDate dtStart, final String strCurrency, final double dblFlatVol) throws Exception { return ScenarioMarketSurfaceBuilder.CustomSplineWireSurface ( "VIEW_TARGET_VOLATILITY_SURFACE", dtStart, strCurrency, new double[] { dtStart.julian(), dtStart.addYears (2).julian(), dtStart.addYears (4).julian(), dtStart.addYears (6).julian(), dtStart.addYears (8).julian(), dtStart.addYears (10).julian() }, new double[] { dtStart.julian(), dtStart.addYears (2).julian(), dtStart.addYears (4).julian(), dtStart.addYears (6).julian(), dtStart.addYears (8).julian(), dtStart.addYears (10).julian() }, new double[][] { {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, {dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol, dblFlatVol}, }, new SegmentCustomBuilderControl ( MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new PolynomialFunctionSetParams (4), SegmentInelasticDesignControl.Create ( 2, 2 ), null, null ), new SegmentCustomBuilderControl ( MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL, new PolynomialFunctionSetParams (4), SegmentInelasticDesignControl.Create ( 2, 2 ), null, null ) ); } private static final MultiFactorStateEvolver HJMInstance ( final JulianDate dtStart, final String strCurrency, final String strTenor, final MarketSurface mktSurfFlatVol1, final MarketSurface mktSurfFlatVol2, final MarketSurface mktSurfFlatVol3, final R1ToR1 auForwardRate) throws Exception { MultiFactorVolatility mfv = new MultiFactorVolatility ( new MarketSurface[] { mktSurfFlatVol1, mktSurfFlatVol2, mktSurfFlatVol3 }, new PrincipalFactorSequenceGenerator ( new UnivariateSequenceGenerator[] { new BoxMullerGaussian ( 0., 1. ), new BoxMullerGaussian ( 0., 1. ), new BoxMullerGaussian ( 0., 1. ) }, new double[][] { {1.0, 0.1, 0.2}, {0.1, 1.0, 0.2}, {0.2, 0.1, 1.0} }, 3 ) ); return new MultiFactorStateEvolver ( FundingLabel.Standard (strCurrency), ForwardLabel.Create ( strCurrency, strTenor ), mfv, auForwardRate ); } private static final ShortForwardRateUpdate InitQMSnap ( final JulianDate dtStart, final String strCurrency, final String strViewTenor, final String strTenor, final double dblInitialForwardRate, final double dblInitialPrice) throws Exception { return ShortForwardRateUpdate.Create ( FundingLabel.Standard (strCurrency), ForwardLabel.Create ( strCurrency, strTenor ), dtStart.julian(), dtStart.julian(), dtStart.addTenor (strViewTenor).julian(), dblInitialForwardRate, 0., dblInitialForwardRate, 0., dblInitialForwardRate + (365.25 / Helper.TenorToDays (strTenor)), 0., dblInitialForwardRate, 0., dblInitialForwardRate, 0., dblInitialPrice, 0. ); } private static final void QMEvolution ( final MultiFactorStateEvolver hjm, final JulianDate dtStart, final String strCurrency, final String strViewTenor, final ShortForwardRateUpdate qmInitial) throws Exception { int iViewDate = dtStart.addTenor (strViewTenor).julian(); int iDayStep = 2; ShortForwardRateUpdate qm = qmInitial; JulianDate dtSpot = dtStart; System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\t| ||"); System.out.println ("\t| 3-Factor Gaussian HJM Quantification Metric Run ||"); System.out.println ("\t| ----------------------------------------------- ||"); System.out.println ("\t| ||"); System.out.println ("\t| L->R: ||"); System.out.println ("\t| Date ||"); System.out.println ("\t| Instantaneous Forward Rate (%) ||"); System.out.println ("\t| Instantaneous Forward Rate - Change (%) ||"); System.out.println ("\t| LIBOR Forward Rate (%) ||"); System.out.println ("\t| LIBOR Forward Rate - Change (%) ||"); System.out.println ("\t| Shifted LIBOR Forward Rate (%) ||"); System.out.println ("\t| Shifted LIBOR Forward Rate - Change (%) ||"); System.out.println ("\t| Short Rate (%) ||"); System.out.println ("\t| Short Rate - Change (%) ||"); System.out.println ("\t| Continuously Compounded Short Rate (%) ||"); System.out.println ("\t| Continuously Compounded Short Rate - Change (%) ||"); System.out.println ("\t| Price ||"); System.out.println ("\t| Price - Change ||"); System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); while (dtSpot.julian() < iViewDate) { int iSpotDate = dtSpot.julian(); qm = (ShortForwardRateUpdate) hjm.evolve ( iSpotDate, iViewDate, iDayStep, qm ); System.out.println ("\t| [" + dtSpot + "] = " + FormatUtil.FormatDouble (qm.instantaneousForwardRate(), 1, 2, 100.) + "% | " + FormatUtil.FormatDouble (qm.instantaneousForwardRateIncrement(), 1, 2, 100.) + "% || " + FormatUtil.FormatDouble (qm.liborForwardRate(), 1, 2, 100.) + "% | " + FormatUtil.FormatDouble (qm.liborForwardRateIncrement(), 1, 2, 100.) + "% || " + FormatUtil.FormatDouble (qm.shiftedLIBORForwardRate(), 1, 4, 1.) + " | " + FormatUtil.FormatDouble (qm.shiftedLIBORForwardRateIncrement(), 1, 2, 100.) + "% || " + FormatUtil.FormatDouble (qm.shortRate(), 1, 2, 100.) + "% | " + FormatUtil.FormatDouble (qm.shortRateIncrement(), 1, 2, 100.) + "% || " + FormatUtil.FormatDouble (qm.compoundedShortRate(), 1, 2, 100.) + "% | " + FormatUtil.FormatDouble (qm.compoundedShortRateIncrement(), 1, 2, 100.) + "% || " + FormatUtil.FormatDouble (qm.price(), 2, 2, 100.) + " | " + FormatUtil.FormatDouble (qm.priceIncrement(), 1, 2, 100.) + " || " ); dtSpot = dtSpot.addBusDays ( iDayStep, strCurrency ); } System.out.println ("\t|-------------------------------------------------------------------------------------------------------------------------------||"); } public static final void main ( final String[] astrArgs) throws Exception { EnvManager.InitEnv (""); String strCurrency = "USD"; double dblFlatVol1 = 0.007; double dblFlatVol2 = 0.009; double dblFlatVol3 = 0.004; double dblFlatForwardRate = 0.05; double dblInitialPrice = 0.9875; String strViewTenor = "3M"; String strTenor = "6M"; JulianDate dtSpot = DateUtil.Today(); MarketSurface mktSurfFlatVol1 = FlatVolatilitySurface ( dtSpot, strCurrency, dblFlatVol1 ); MarketSurface mktSurfFlatVol2 = FlatVolatilitySurface ( dtSpot, strCurrency, dblFlatVol2 ); MarketSurface mktSurfFlatVol3 = FlatVolatilitySurface ( dtSpot, strCurrency, dblFlatVol3 ); MultiFactorStateEvolver hjm = HJMInstance ( dtSpot, strCurrency, strTenor, mktSurfFlatVol1, mktSurfFlatVol2, mktSurfFlatVol3, new FlatUnivariate (dblFlatForwardRate) ); ShortForwardRateUpdate qmInitial = InitQMSnap ( dtSpot, strCurrency, strViewTenor, strTenor, dblFlatForwardRate, dblInitialPrice ); QMEvolution ( hjm, dtSpot, strCurrency, strViewTenor, qmInitial ); } }
[ "lakshmi@synergicdesign.com" ]
lakshmi@synergicdesign.com
defdd2d67e1d949b2b0dec9af57ef931a7040f9a
a4981a0458d74417ab9d24be860276d6d24eba6d
/src/main/java/com/zsmart/communale/ws/rest/vo/SecteurVo.java
f6bf9a2c1928589877bde1f47176af85d4a1a2ef
[]
no_license
ZOUANI/compta_transparency_commuale
92fbe6ff149a66b8523a4d2530641d93ba74fb5a
81290a6ff6c8ee04112777cb4cd2a3ee94281fe6
refs/heads/master
2021-06-02T08:16:47.891593
2020-04-09T08:48:24
2020-04-09T08:48:24
254,319,640
0
0
null
null
null
null
UTF-8
Java
false
false
685
java
package com.zsmart.communale.ws.rest.vo; import java.util.ArrayList; import java.util.List; public class SecteurVo{ private String id ; private String libelle ; private String code ; private String codeVille ; public String getId(){ return id; } public void setId(String id){ this.id = id; } public String getLibelle(){ return libelle; } public void setLibelle(String libelle){ this.libelle = libelle; } public String getCode(){ return code; } public void setCode(String code){ this.code = code; } public String getCodeVille(){ return codeVille; } public void setCodeVille(String codeVille){ this.codeVille = codeVille; } }
[ "zouani.younes@gmail.com" ]
zouani.younes@gmail.com
20739f71ed851282c404dd6da89ec3e6baf86519
02a301a3ee056f9d5e792bc8f1821d9d451218f1
/src/main/java/com/lin/web/layer/fusion/FusionTableUsingRest.java
89abe4ca56f0b8bb5dab1709b0787b543a9957d4
[ "Apache-2.0" ]
permissive
nareshPokhriyal86/testing
deefff94d059464d6f857b3ded6dc103f80f13c7
7d67fb1f04c1f5c5e75f7fe528bc013fc86b0398
refs/heads/master
2021-01-01T19:16:14.547753
2015-02-27T10:12:50
2015-02-27T10:12:50
29,577,586
0
0
null
null
null
null
UTF-8
Java
false
false
1,281
java
package com.lin.web.layer.fusion; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; public class FusionTableUsingRest { private static final String SERVICE_URL = "https://www.google.com/fusiontables/api/query"; private static final String API_KEY="AIzaSyBSW_nbk0I2AlVO3eE6wWt2lwALTTrzbWg"; public static void getAllTable(){ try { String query="SELECT Creative_Size FROM 1gNCPNqGLkdjph9-yPUPfI-b8nRd69XC8hm-iOtw&key=AIzaSyBSW_nbk0I2AlVO3eE6wWt2lwALTTrzbWg"; String encodedQuery = URLEncoder.encode(query, "UTF-8"); URL url = new URL("https://www.googleapis.com/fusiontables/v1/query?" +"sql="+encodedQuery); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = reader.readLine()) != null) { System.out.println("line:"+line); } reader.close(); } catch (MalformedURLException e) { System.out.println("MalformedURLException:"+e.getMessage()); } catch (IOException e) { System.out.println("IOException:"+e.getMessage()); } } public static void main(String [] args){ getAllTable(); } }
[ "nareshpokhriyal86@gmail.com" ]
nareshpokhriyal86@gmail.com
c8ceca0183acce8bc598a5f3198f96ee7cbc09b2
86c7010256aab13d6bcdedd6f12889f77965e905
/util/microservice-api/src/main/java/com/emc/microservice/messaging/DestinationConfiguration.java
a79c25f562d3634d67583ace05fb3e73f4672484
[ "MIT" ]
permissive
ocopea/orcs
6c45f677f978c7ed2fa3b10c6cb45c4d76e9936e
3a21a172c4712e6c24d558911017551132bac5fa
refs/heads/master
2021-01-23T09:45:40.131201
2017-11-14T13:45:27
2017-11-14T15:24:38
102,596,286
6
3
NOASSERTION
2019-03-25T21:01:45
2017-09-06T10:37:53
Java
UTF-8
Java
false
false
3,685
java
// Copyright (c) [2017] Dell Inc. or its subsidiaries. All Rights Reserved. /* * Copyright (c) 2014-2016 EMC Corporation All Rights Reserved */ package com.emc.microservice.messaging; import com.emc.microservice.resource.ResourceConfiguration; import com.emc.microservice.resource.ResourceConfigurationProperty; import com.emc.microservice.resource.ResourceConfigurationPropertyType; import java.util.Arrays; import java.util.List; /** * Created with love by liebea on 6/1/2014. */ public class DestinationConfiguration extends ResourceConfiguration { private static final String CONFIGURATION_NAME = "Messaging Destination"; private static final ResourceConfigurationProperty PROPERTY_DESTINATION_QUEUE_URI_NAME = new ResourceConfigurationProperty( "destinationQueueURI", ResourceConfigurationPropertyType.STRING, "Destination Queue URI", false, false); private static final ResourceConfigurationProperty PROPERTY_BLOB_NAMESPACE = new ResourceConfigurationProperty( "blobstoreNameSpace", ResourceConfigurationPropertyType.STRING, "Blobstore namespace to use", false, false); private static final ResourceConfigurationProperty PROPERTY_BLOB_KEY_HEADER_NAME = new ResourceConfigurationProperty( "blobstoreKeyHeaderName", ResourceConfigurationPropertyType.STRING, "Header from message whose value to use as blob key", false, false); private static final ResourceConfigurationProperty PROPERTY_LOG_IN_DEBUG = new ResourceConfigurationProperty( "logInDebug", ResourceConfigurationPropertyType.BOOLEAN, "Log message body content while reading if logging is in debug", true, false); private static final List<ResourceConfigurationProperty> PROPERTIES = Arrays.asList( PROPERTY_DESTINATION_QUEUE_URI_NAME, PROPERTY_BLOB_NAMESPACE, PROPERTY_BLOB_KEY_HEADER_NAME, PROPERTY_LOG_IN_DEBUG ); public DestinationConfiguration() { super(CONFIGURATION_NAME, PROPERTIES); } public DestinationConfiguration(String destinationQueueURI, boolean logInDebug) { this(destinationQueueURI, null, null, logInDebug); } public DestinationConfiguration(String destinationQueueURI, String blobStoreNameSpace, String blobstoreKeyHeaderName, boolean logInDebug) { this(); setPropertyValues(propArrayToMap(new String[]{ PROPERTY_DESTINATION_QUEUE_URI_NAME.getName(), destinationQueueURI, PROPERTY_BLOB_NAMESPACE.getName(), blobStoreNameSpace, PROPERTY_BLOB_KEY_HEADER_NAME.getName(), blobstoreKeyHeaderName, PROPERTY_LOG_IN_DEBUG.getName(), Boolean.toString(logInDebug) })); } public String getBlobNamespace() { return getProperty(PROPERTY_BLOB_NAMESPACE.getName()); } public String getBlobKeyHeaderName() { return getProperty(PROPERTY_BLOB_KEY_HEADER_NAME.getName()); } public String getDestinationQueueURI() { return getProperty(PROPERTY_DESTINATION_QUEUE_URI_NAME.getName()); } public boolean isLogContentWhenInDebug() { return Boolean.valueOf(getProperty(PROPERTY_LOG_IN_DEBUG.getName())); } }
[ "amit.lieberman@emc.com" ]
amit.lieberman@emc.com
5b4f9ad9c28bfac2560cf480fa7216f78546edb7
669e8172f24f8771f51be6a69738de0e7edba11c
/src/栈和队列/MaxQueue.java
afa56c7639288e9bddc726c3c856aceea7588042
[]
no_license
Myth-Sun/LeetCode
5eb479d09482d58eead90a30d9e53ec262c8deaf
2ff2ab04e7444e5f447dd08a15a193d51b0b0a8f
refs/heads/master
2023-06-19T07:21:36.928896
2021-07-04T14:44:01
2021-07-04T14:44:01
311,321,374
0
0
null
null
null
null
UTF-8
Java
false
false
1,913
java
package 栈和队列; import java.util.Deque; import java.util.LinkedList; import java.util.Queue; /* 剑指 Offer 59 - II. 队列的最大值 请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是O(1)。 若队列为空,pop_front 和 max_value 需要返回 -1 示例 1: 输入: ["MaxQueue","push_back","push_back","max_value","pop_front","max_value"] [[],[1],[2],[],[],[]] 输出: [null,null,null,2,1,2] 示例 2: 输入: ["MaxQueue","pop_front","max_value"] [[],[],[]] 输出: [null,-1,-1] 限制: 1 <= push_back,pop_front,max_value的总操作数 <= 10000 1 <= value <= 10^5 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/dui-lie-de-zui-da-zhi-lcof 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ //维护一个递减队列用于保存最大值 public class MaxQueue { Deque<Integer> deque; Queue<Integer> queue; public MaxQueue() { deque = new LinkedList<>(); queue = new LinkedList<>(); } public int max_value() { if (queue.size() == 0) { return -1; } return deque.peekFirst(); } public void push_back(int value) { queue.offer(value); while (!deque.isEmpty() && value > deque.peekLast()) { deque.pollLast(); } deque.offerLast(value); } public int pop_front() { if (queue.isEmpty()) { return -1; } int ans = queue.poll(); if (deque.peekFirst() == ans) { deque.pollFirst(); } return ans; } } /** * Your MaxQueue object will be instantiated and called as such: * MaxQueue obj = new MaxQueue(); * int param_1 = obj.max_value(); * obj.push_back(value); * int param_3 = obj.pop_front(); */
[ "1991773694@qq.com" ]
1991773694@qq.com
1292f5062da326f8191c3e6b19c4e94aad988dc9
883e366b3e2221900ca470f31c8a5bf538fee360
/Microservice-CustomerDetails/src/main/java/com/airtel/customerdetails/model/PlanDTO.java
abd9d7407e4b7e80551f0afef85dd4bd6d784043
[]
no_license
RahulTirkey1/Telecom-Microservice
e1806a8b33a4b4dcc9e3f670ce38237e1f2b1a6b
1f9910151779fb7f6114925c2133e4f3ce09ab49
refs/heads/master
2022-12-15T21:38:35.702055
2020-09-13T19:22:53
2020-09-13T19:22:53
295,192,560
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package com.airtel.customerdetails.model; public class PlanDTO { private String planId; private String planName; private Integer validity; public String getPlanId() { return planId; } public void setPlanId(String planId) { this.planId = planId; } public String getPlanName() { return planName; } public void setPlanName(String planName) { this.planName = planName; } public Integer getValidity() { return validity; } public void setValidity(Integer validity) { this.validity = validity; } }
[ "rahul.tirkey303@gmail.com" ]
rahul.tirkey303@gmail.com
083f240996550ad4c2ac6b1924d4ac8e70e25dfe
695d0360e4d26366c0b5ae72e50494bde8719395
/src/main/java/com/epickrram/binlog/MultiThreadedLoggingEvent.java
42cf34ca5bd88f383f6560d4a547a55b4dd3ebf4
[]
no_license
kogupta/binlog
67e1bcf50f6ccb2e2167695b95b4520206cf3e3f
0b55710ac0e461d4937b4ca08da473a0e48be184
refs/heads/master
2020-03-16T04:06:53.778022
2013-03-27T18:44:49
2013-03-27T18:44:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,209
java
package com.epickrram.binlog; ////////////////////////////////////////////////////////////////////////////////// // Copyright 2011 Mark Price mark at epickrram.com // // // // 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. // ////////////////////////////////////////////////////////////////////////////////// import sun.misc.Unsafe; /** * Should still only be accessed by a single thread, * but allows multiple threads to write to the same * shared memory space */ public final class MultiThreadedLoggingEvent implements LoggingEvent { private final DirectMemoryLogger logger; private final LoggingCapacityAllocator capacityAllocator; private final byte[] buffer = new byte[1024]; private final Unsafe unsafe; private final int arrayBaseOffset; private long positionInBuffer = 0L; private int logCategoryId = 0; public MultiThreadedLoggingEvent(final DirectMemoryLogger logger, final LoggingCapacityAllocator capacityAllocator) { this.logger = logger; this.capacityAllocator = capacityAllocator; this.unsafe = UnsafeUtil.getUnsafe(); arrayBaseOffset = this.unsafe.arrayBaseOffset(byte[].class); } @Override public LoggingEvent begin(final LogCategory logCategory) { positionInBuffer = 0L; logCategoryId = logCategory.getCategoryId(); return this; } @Override public LoggingEvent appendAsciiChar(final char value) { unsafe.putByte(buffer, arrayBaseOffset + positionInBuffer, (byte) value); positionInBuffer++; return this; } @Override public LoggingEvent appendByte(final byte value) { unsafe.putByte(buffer, arrayBaseOffset + positionInBuffer, value); positionInBuffer++; return this; } @Override public LoggingEvent appendDouble(final double value) { unsafe.putDouble(buffer, arrayBaseOffset + positionInBuffer, value); positionInBuffer += DirectMemoryLogger.SIZE_OF_DOUBLE; return this; } @Override public LoggingEvent appendFloat(final float value) { unsafe.putFloat(buffer, arrayBaseOffset + positionInBuffer, value); positionInBuffer += DirectMemoryLogger.SIZE_OF_FLOAT; return this; } @Override public LoggingEvent appendInt(final int value) { unsafe.putInt(buffer, arrayBaseOffset + positionInBuffer, value); positionInBuffer += DirectMemoryLogger.SIZE_OF_INT; return this; } @Override public LoggingEvent appendLong(final long value) { unsafe.putLong(buffer, arrayBaseOffset + positionInBuffer, value); positionInBuffer += DirectMemoryLogger.SIZE_OF_LONG; return this; } @Override public void commit() { final long totalRecordLength = positionInBuffer + 2 * DirectMemoryLogger.SIZE_OF_INT; final long address = capacityAllocator.getAllocatedBlockAddress(totalRecordLength); logger.writeIntAt(address, logCategoryId); logger.writeIntAt(address + DirectMemoryLogger.SIZE_OF_INT, (int) positionInBuffer); logger.writeByteArrayAt(address + 2 * DirectMemoryLogger.SIZE_OF_INT, buffer, (int) positionInBuffer); } }
[ "mark.web.mail@gmail.com" ]
mark.web.mail@gmail.com
83661ab5dffd557a1a19da09beab6f0649f05692
8d35146cc9b0f46782655aec228ef802c67e477f
/rcp/org.salever.rcp.tech.chapter8/src/org/salever/rcp/tech/chapter8/ApplicationWorkbenchWindowAdvisor.java
1e62cc08abf71d13d33d8f6ad3213c4b1dcfd27f
[ "MIT" ]
permissive
code1990/javaweb
2839a64363c2cd625dcd38d582d3c80b406e3ee4
148a15e603aef31d2251deba0d0a46297f6f4e30
refs/heads/master
2022-12-22T10:23:27.284490
2020-06-16T14:44:23
2020-06-16T14:44:32
242,639,166
1
0
MIT
2022-12-12T02:49:05
2020-02-24T03:35:20
Java
UTF-8
Java
false
false
978
java
package org.salever.rcp.tech.chapter8; import org.eclipse.swt.graphics.Point; import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.IActionBarConfigurer; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchWindowAdvisor; public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { super(configurer); } public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { return new ApplicationActionBarAdvisor(configurer); } public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(400, 300)); configurer.setShowCoolBar(false); configurer.setShowStatusLine(false); configurer.setTitle("Hello RCP"); //$NON-NLS-1$ } }
[ "s1332177151@sina.com" ]
s1332177151@sina.com
4ccb86700a9739b50e5457753a76a0d2e0465a9f
182f38ce4566b3c1c36076055db086a9ad2acf19
/src/main/java/com/pawelniewiadomski/devs/jira/servlet/LicenseServlet.java
bb21e2440eb50a281751e2e3a658307e016c792f
[ "BSD-2-Clause" ]
permissive
pawelniewie/bulk-create-issues-for-jira
d0596a4e27e8f674eb6ba2d2dfa3d4c44eb00cb6
d912fb7d78f34d71873f3503f137ed1a04e6f0da
refs/heads/master
2021-01-10T22:12:35.619663
2014-12-22T17:44:33
2014-12-22T17:44:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,660
java
package com.pawelniewiadomski.devs.jira.servlet; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; import javax.annotation.Nonnull; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.atlassian.sal.api.ApplicationProperties; import com.atlassian.sal.api.auth.LoginUriProvider; import com.atlassian.sal.api.message.I18nResolver; import com.atlassian.sal.api.user.UserManager; import com.atlassian.templaterenderer.TemplateRenderer; import com.atlassian.upm.api.license.entity.PluginLicense; import com.atlassian.upm.api.util.Option; import com.atlassian.upm.license.storage.lib.AtlassianMarketplaceUriFactory; import com.atlassian.upm.license.storage.lib.PluginLicenseStoragePluginUnresolvedException; import com.atlassian.upm.license.storage.lib.ThirdPartyPluginLicenseStorageManager; import org.apache.commons.lang.StringUtils; /** * A license administration servlet that uses {@link ThirdPartyPluginLicenseStorageManager} to: * - get the current plugin license, * - update the plugin license, * - remove the plugin license, * - buy, try, upgrade, and renew your license directly from My Atlassian, * - check for a licensing-aware UPM, * - and properly handle if a licensing-aware UPM is detected. * * This servlet can be reached at http://localhost:2990/jira/plugins/servlet/com.pawelniewiadomski.devs.jira.jira-bulk-create-plugin/license */ public class LicenseServlet extends HttpServlet { private static final String TEMPLATE = "com/pawelniewiadomski/devs/jira/views/license-admin.vm"; private final ThirdPartyPluginLicenseStorageManager licenseManager; private final AtlassianMarketplaceUriFactory uriFactory; private final ApplicationProperties applicationProperties; private final TemplateRenderer renderer; private final LoginUriProvider loginUriProvider; private final UserManager userManager; private final I18nResolver i18nResolver; public LicenseServlet(ThirdPartyPluginLicenseStorageManager licenseManager, AtlassianMarketplaceUriFactory uriFactory, ApplicationProperties applicationProperties, TemplateRenderer renderer, LoginUriProvider loginUriProvider, UserManager userManager, I18nResolver i18nResolver) { this.licenseManager = licenseManager; this.uriFactory = uriFactory; this.applicationProperties = applicationProperties; this.renderer = renderer; this.loginUriProvider = loginUriProvider; this.userManager = userManager; this.i18nResolver = i18nResolver; } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (!hasAdminPermission()) { redirectToLogin(req, resp); return; } final Map<String, Object> context = initVelocityContext(resp); addEligibleMarketplaceButtons(context); renderer.render(TEMPLATE, context, resp.getWriter()); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (!hasAdminPermission()) { redirectToLogin(req, resp); return; } final Map<String, Object> context = initVelocityContext(resp); if (!context.containsKey("errorMessage")) { try { if (!licenseManager.isUpmLicensingAware()) { String license = req.getParameter("license"); Option<PluginLicense> validatedLicense = licenseManager.validateLicense(license); //we have an empty/null license parameter - let's remove the stored license. if (StringUtils.isEmpty(license)) { licenseManager.removeRawLicense(); context.put("successMessage", i18nResolver.getText("plugin.license.storage.admin.license.remove")); context.put("license", licenseManager.getLicense()); } //we have a non-empty license parameter - let's update the license if it is valid. else if (validatedLicense.isDefined()) { licenseManager.setRawLicense(license); if (validatedLicense.get().getError().isDefined()) { context.put("warningMessage", i18nResolver.getText("plugin.license.storage.admin.license.update.invalid")); } else { context.put("successMessage", i18nResolver.getText("plugin.license.storage.admin.license.update")); } context.put("license", licenseManager.getLicense()); } //we have an invalid license - do nothing. else { context.put("errorMessage", i18nResolver.getText("plugin.license.storage.admin.license.invalid")); } } } catch (PluginLicenseStoragePluginUnresolvedException e) { context.put("errorMessage", i18nResolver.getText("plugin.license.storage.admin.plugin.unavailable")); context.put("storagePluginIsAvailable", false); } } addEligibleMarketplaceButtons(context); //must be invoked *after* the license update has occurred. renderer.render(TEMPLATE, context, resp.getWriter()); } @Nonnull public static URI getServletLocation(@Nonnull String baseUrl) { return URI.create(baseUrl + "/plugins/servlet/com.pawelniewiadomski.devs.jira.jira-bulk-create-plugin/license"); } private Map<String, Object> initVelocityContext(HttpServletResponse resp) { resp.setContentType("text/html;charset=utf-8"); URI servletUri = getServletLocation(applicationProperties.getBaseUrl()); final Map<String, Object> context = new HashMap<String, Object>(); resp.setContentType("text/html;charset=utf-8"); context.put("servletUri", servletUri); context.put("storagePluginIsAvailable", true); try { context.put("license", licenseManager.getLicense()); context.put("upmLicensingAware", licenseManager.isUpmLicensingAware()); context.put("pluginKey", licenseManager.getPluginKey()); if (licenseManager.isUpmLicensingAware()) { context.put("warningMessage", i18nResolver.getText("plugin.license.storage.admin.upm.licensing.aware", licenseManager.getPluginManagementUri())); } } catch (PluginLicenseStoragePluginUnresolvedException e) { context.put("errorMessage", i18nResolver.getText("plugin.license.storage.admin.plugin.unavailable")); context.put("storagePluginIsAvailable", false); } return context; } private void addEligibleMarketplaceButtons(Map<String, Object> context) { URI servletUri = getServletLocation(applicationProperties.getBaseUrl()); try { boolean eligibleButtons = false; if (uriFactory.isPluginBuyable()) { context.put("buyPluginUri", uriFactory.getBuyPluginUri(servletUri)); eligibleButtons = true; } if (uriFactory.isPluginTryable()) { context.put("tryPluginUri", uriFactory.getTryPluginUri(servletUri)); eligibleButtons = true; } if (uriFactory.isPluginRenewable()) { context.put("renewPluginUri", uriFactory.getRenewPluginUri(servletUri)); eligibleButtons = true; } if (uriFactory.isPluginUpgradable()) { context.put("upgradePluginUri", uriFactory.getUpgradePluginUri(servletUri)); eligibleButtons = true; } context.put("eligibleButtons", eligibleButtons); } catch (PluginLicenseStoragePluginUnresolvedException e) { context.put("errorMessage", i18nResolver.getText("plugin.license.storage.admin.plugin.unavailable")); context.put("storagePluginIsAvailable", false); } } private boolean hasAdminPermission() { String user = userManager.getRemoteUsername(); try { return user != null && (userManager.isAdmin(user) || userManager.isSystemAdmin(user)); } catch(NoSuchMethodError e) { // userManager.isAdmin(String) was not added until SAL 2.1. // We need this check to ensure backwards compatibility with older product versions. return user != null && userManager.isSystemAdmin(user); } } private void redirectToLogin(HttpServletRequest request, HttpServletResponse response) throws IOException { response.sendRedirect(loginUriProvider.getLoginUri(URI.create(request.getRequestURL().toString())).toASCIIString()); } }
[ "11110000b@gmail.com" ]
11110000b@gmail.com
75fd3d8ccae25b54210c36f8b0d0fd631cb416aa
c682d1656c861fda8f07d301b9094c5b3f9c153b
/src/main/java/br/com/zupacademy/erikaconca/casadocodigo/validadore/ValidarEstadoValidator.java
cc5677d1054dd77866152083f82ff1a3ed5db8d5
[ "Apache-2.0" ]
permissive
erikafconca/orange-talents-03-template-casa-do-codigo
cfcb9b4c80e7b7ceab7d39c8b0c8ce80e82eb029
428c20a6f246c4c3a64c2740198674aaccc0005c
refs/heads/main
2023-04-15T20:00:26.431700
2021-04-16T00:51:09
2021-04-16T00:51:09
357,175,262
0
0
Apache-2.0
2021-04-12T11:56:19
2021-04-12T11:56:18
null
UTF-8
Java
false
false
1,491
java
package br.com.zupacademy.erikaconca.casadocodigo.validadore; import br.com.zupacademy.erikaconca.casadocodigo.cliente.ClienteRequest; import br.com.zupacademy.erikaconca.casadocodigo.localizacao.EstadoRepository; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; public class ValidarEstadoValidator implements ConstraintValidator<ValidarEstado, ClienteRequest> { private EstadoRepository repository; public ValidarEstadoValidator(EstadoRepository repository) { this.repository = repository; } @Override public boolean isValid(ClienteRequest clienteRequest, ConstraintValidatorContext context) { // Long estadoId = clienteRequest.getEstado().getId(); Long paisId = clienteRequest.getPais().getId(); if(clienteRequest.getEstado() == null){ if(repository.existsByPaisId(paisId)){ System.out.println("dentro pais com estado : " + repository.existsByPaisId(paisId)); return false; } }else{ Long estadoId = clienteRequest.getEstado().getId(); if(!repository.existsByIdAndPais_Id(estadoId, paisId)){ System.out.println("dentro pais com estado e pais : " + !repository.existsByIdAndPais_Id(estadoId, paisId)); return false; } } System.out.println("dentro pais sem estado : " + repository.existsByPaisId(paisId)); return true; } }
[ "erikafconca@gmail.com" ]
erikafconca@gmail.com
2939a47e4ffd56be1d0f437ed6b7ded7ace9108c
db98454abf017f9428aa9c42c44c0c94247e995d
/src/main/java/com/zoowii/formutils/constraits/NotEmptyConstrait.java
38025d68dd1d241cd03a2a14cc731b2858499688
[ "MIT" ]
permissive
zoowii/form-utils
5843c8fa95865348cc593d82c29f3e3d03dd8fa9
aeb7d3e56e2b39fb53ddc5c63da16c5be8b30e6b
refs/heads/master
2020-06-03T03:40:57.021819
2017-03-20T13:17:11
2017-03-20T13:17:11
25,959,088
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.zoowii.formutils.constraits; import com.zoowii.formutils.Constrait; import com.zoowii.formutils.ValidateError; import com.zoowii.formutils.ValidateErrorGenerator; import com.zoowii.formutils.ValidateHelper; import com.zoowii.formutils.annotations.NotEmpty; /** * Created by zoowii on 14/10/30. */ public class NotEmptyConstrait extends Constrait<NotEmpty> { @Override public boolean isInValid(Object fieldValue) { return fieldValue == null || fieldValue.toString().trim().isEmpty(); } @Override public ValidateError createValidateError(ValidateErrorGenerator validateErrorGenerator) { return validateErrorGenerator.generate(validateAnnotation, ValidateHelper.firstNotEmptyString(validateAnnotation.message(), String.format("Field %s can't be empty", validateErrorGenerator.getFieldName()))); } }
[ "zoowii@zhouweideMacBook-Air.local" ]
zoowii@zhouweideMacBook-Air.local
1e94929ac28e6fe8aa2e5862c108790b2c2f65df
00e3dbee8ecc8f938fc7b2b63c2dbb425f3e07cb
/src/main/java/com/fangkuai/credit/util/HTTP.java
63e263783d91dc8662c9f9bee8bb5e62b1a924a2
[]
no_license
fangkuaiIT/credit
4165f2c67faa2da1cb45a68c6c04c841423eee9d
202296ed04328ac00b7f16e344d9e80a0e8e09a2
refs/heads/master
2022-12-12T17:04:12.350507
2020-04-10T07:29:55
2020-04-10T07:29:55
253,531,053
5
0
null
2022-12-12T10:46:42
2020-04-06T15:00:11
Java
UTF-8
Java
false
false
24,263
java
package com.fangkuai.credit.util; /** * @创建人 lin * @创建时间 2020/4/8 * @描述 */ public class HTTP { /** * 自定义错误 */ public static int ERROR = -1; // --- 1xx Informational --- /** * <tt>100 Continue</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_CONTINUE = 100; /** * <tt>101 Switching Protocols</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_SWITCHING_PROTOCOLS = 101; /** * <tt>102 Processing</tt> (WebDAV - RFC 2518) */ public static int SC_PROCESSING = 102; // --- 2xx Success --- /** * <tt>200 OK</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_OK = 200; /** * <tt>201 Created</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_CREATED = 201; /** * <tt>202 Accepted</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_ACCEPTED = 202; /** * <tt>203 Non Authoritative Information</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_NON_AUTHORITATIVE_INFORMATION = 203; /** * <tt>204 No Content</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_NO_CONTENT = 204; /** * <tt>205 Reset Content</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_RESET_CONTENT = 205; /** * <tt>206 Partial Content</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_PARTIAL_CONTENT = 206; /** * <tt>207 Multi-Status</tt> (WebDAV - RFC 2518) or <tt>207 Partial Update * OK</tt> (HTTP/1.1 - draft-ietf-http-v11-spec-rev-01?) */ public static int SC_MULTI_STATUS = 207; // --- 3xx Redirection --- /** * <tt>300 Mutliple Choices</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_MULTIPLE_CHOICES = 300; /** * <tt>301 Moved Permanently</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_MOVED_PERMANENTLY = 301; /** * <tt>302 Moved Temporarily</tt> (Sometimes <tt>Found</tt>) (HTTP/1.0 - RFC 1945) */ public static int SC_MOVED_TEMPORARILY = 302; /** * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.3">HTTP/1.1</a> */ public static int SC_FOUND = 302; /** * <tt>303 See Other</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_SEE_OTHER = 303; /** * <tt>304 Not Modified</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_NOT_MODIFIED = 304; /** * <tt>305 Use Proxy</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_USE_PROXY = 305; /** * <tt>307 Temporary Redirect</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_TEMPORARY_REDIRECT = 307; // --- 4xx Client Error --- /** * <tt>400 Bad Request</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_BAD_REQUEST = 400; /** * <tt>401 Unauthorized</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_UNAUTHORIZED = 401; /** * <tt>402 Payment Required</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_PAYMENT_REQUIRED = 402; /** * <tt>403 Forbidden</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_FORBIDDEN = 403; /** * <tt>404 Not Found</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_NOT_FOUND = 404; /** * <tt>405 Method Not Allowed</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_METHOD_NOT_ALLOWED = 405; /** * <tt>406 Not Acceptable</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_NOT_ACCEPTABLE = 406; /** * <tt>407 Proxy Authentication Required</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_PROXY_AUTHENTICATION_REQUIRED = 407; /** * <tt>408 Request Timeout</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_REQUEST_TIMEOUT = 408; /** * <tt>409 Conflict</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_CONFLICT = 409; /** * <tt>410 Gone</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_GONE = 410; /** * <tt>411 Length Required</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_LENGTH_REQUIRED = 411; /** * <tt>412 Precondition Failed</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_PRECONDITION_FAILED = 412; /** * <tt>413 Request Entity Too Large</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_REQUEST_TOO_LONG = 413; /** * <tt>414 Request-URI Too Long</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_REQUEST_URI_TOO_LONG = 414; /** * <tt>415 Unsupported Media Type</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_UNSUPPORTED_MEDIA_TYPE = 415; /** * <tt>416 Requested Range Not Satisfiable</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416; /** * <tt>417 Expectation Failed</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_EXPECTATION_FAILED = 417; /** * Static constant for a 418 error. * <tt>418 Unprocessable Entity</tt> (WebDAV drafts?) * or <tt>418 Reauthentication Required</tt> (HTTP/1.1 drafts?) */ // not used // public static int UNPROCESSABLE_ENTITY = 418; /** * Static constant for a 419 error. * <tt>419 Insufficient Space on Resource</tt> * (WebDAV - draft-ietf-webdav-protocol-05?) * or <tt>419 Proxy Reauthentication Required</tt> * (HTTP/1.1 drafts?) */ public static int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419; /** * Static constant for a 420 error. * <tt>420 Method Failure</tt> * (WebDAV - draft-ietf-webdav-protocol-05?) */ public static int SC_METHOD_FAILURE = 420; /** * <tt>422 Unprocessable Entity</tt> (WebDAV - RFC 2518) */ public static int SC_UNPROCESSABLE_ENTITY = 422; /** * <tt>423 Locked</tt> (WebDAV - RFC 2518) */ public static int SC_LOCKED = 423; /** * <tt>424 Failed Dependency</tt> (WebDAV - RFC 2518) */ public static int SC_FAILED_DEPENDENCY = 424; // --- 5xx Server Error --- /** * <tt>500 Server Error</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_INTERNAL_SERVER_ERROR = 500; /** * <tt>501 Not Implemented</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_NOT_IMPLEMENTED = 501; /** * <tt>502 Bad Gateway</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_BAD_GATEWAY = 502; /** * <tt>503 Service Unavailable</tt> (HTTP/1.0 - RFC 1945) */ public static int SC_SERVICE_UNAVAILABLE = 503; /** * <tt>504 Gateway Timeout</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_GATEWAY_TIMEOUT = 504; /** * <tt>505 HTTP Version Not Supported</tt> (HTTP/1.1 - RFC 2616) */ public static int SC_HTTP_VERSION_NOT_SUPPORTED = 505; /** * <tt>507 Insufficient Storage</tt> (WebDAV - RFC 2518) */ public static int SC_INSUFFICIENT_STORAGE = 507; /** * Enumeration of HTTP method. */ public enum Method { NONE, GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD, TRACE; public boolean isNone() { return this == NONE; } public boolean isGet() { return this == GET; } public boolean isPost() { return this == POST; } } /** * Enumeration of HTTP status codes. * <p> * <p>The HTTP status code series can be retrieved via * * @author Arjen Poutsma * @see <a href="http://www.iana.org/assignments/http-status-codes">HTTP Status Code Registry</a> * @see <a href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes">List of HTTP status codes - Wikipedia</a> */ //from spring framework public enum Status { ERROR(-1, "mismatch condition"), // 1xx Informational /** * {@code 100 Continue}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.1.1">HTTP/1.1</a> */ CONTINUE(100, "Continue"), /** * {@code 101 Switching Protocols}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.1.2">HTTP/1.1</a> */ SWITCHING_PROTOCOLS(101, "Switching Protocols"), /** * {@code 102 Processing}. * * @see <a href="http://tools.ietf.org/html/rfc2518#section-10.1">WebDAV</a> */ PROCESSING(102, "Processing"), /** * {@code 103 Checkpoint}. * * @see <a href="http://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal">A proposal for supporting * resumable POST/PUT HTTP requests in HTTP/1.0</a> */ CHECKPOINT(103, "Checkpoint"), // 2xx Success /** * {@code 200 OK}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.1">HTTP/1.1</a> */ OK(200, "OK"), /** * {@code 201 Created}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.2">HTTP/1.1</a> */ CREATED(201, "Created"), /** * {@code 202 Accepted}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.3">HTTP/1.1</a> */ ACCEPTED(202, "Accepted"), /** * {@code 203 Non-Authoritative Information}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.4">HTTP/1.1</a> */ NON_AUTHORITATIVE_INFORMATION(203, "Non-Authoritative Information"), /** * {@code 204 No Content}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.5">HTTP/1.1</a> */ NO_CONTENT(204, "No Content"), /** * {@code 205 Reset Content}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.6">HTTP/1.1</a> */ RESET_CONTENT(205, "Reset Content"), /** * {@code 206 Partial Content}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.2.7">HTTP/1.1</a> */ PARTIAL_CONTENT(206, "Partial Content"), /** * {@code 207 Multi-Status}. * * @see <a href="http://tools.ietf.org/html/rfc4918#section-13">WebDAV</a> */ MULTI_STATUS(207, "Multi-Status"), /** * {@code 208 Already Reported}. * * @see <a href="http://tools.ietf.org/html/rfc5842#section-7.1">WebDAV Binding Extensions</a> */ ALREADY_REPORTED(208, "Already Reported"), /** * {@code 226 IM Used}. * * @see <a href="http://tools.ietf.org/html/rfc3229#section-10.4.1">Delta encoding in HTTP</a> */ IM_USED(226, "IM Used"), // 3xx Redirection /** * {@code 300 Multiple Choices}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.1">HTTP/1.1</a> */ MULTIPLE_CHOICES(300, "Multiple Choices"), /** * {@code 301 Moved Permanently}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.2">HTTP/1.1</a> */ MOVED_PERMANENTLY(301, "Moved Permanently"), /** * {@code 302 Found}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.3">HTTP/1.1</a> */ FOUND(302, "Found"), /** * {@code 302 Moved Temporarily}. * * @see <a href="http://tools.ietf.org/html/rfc1945#section-9.3">HTTP/1.0</a> * @deprecated In favor of {@link #FOUND} which will be returned from {@code HttpStatus.valueOf(302)} */ @Deprecated MOVED_TEMPORARILY(302, "Moved Temporarily"), /** * {@code 303 See Other}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.4">HTTP/1.1</a> */ SEE_OTHER(303, "See Other"), /** * {@code 304 Not Modified}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.5">HTTP/1.1</a> */ NOT_MODIFIED(304, "Not Modified"), /** * {@code 305 Use Proxy}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.6">HTTP/1.1</a> */ USE_PROXY(305, "Use Proxy"), /** * {@code 307 Temporary Redirect}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.3.8">HTTP/1.1</a> */ TEMPORARY_REDIRECT(307, "Temporary Redirect"), /** * {@code 308 Resume Incomplete}. * * @see <a href="http://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal">A proposal for supporting * resumable POST/PUT HTTP requests in HTTP/1.0</a> */ RESUME_INCOMPLETE(308, "Resume Incomplete"), // --- 4xx Client Error --- /** * {@code 400 Bad Request}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.1">HTTP/1.1</a> */ BAD_REQUEST(400, "Bad Request"), /** * {@code 401 Unauthorized}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.2">HTTP/1.1</a> */ UNAUTHORIZED(401, "Unauthorized"), /** * {@code 402 Payment Required}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.3">HTTP/1.1</a> */ PAYMENT_REQUIRED(402, "Payment Required"), /** * {@code 403 Forbidden}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.4">HTTP/1.1</a> */ FORBIDDEN(403, "Forbidden"), /** * {@code 404 Not Found}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.5">HTTP/1.1</a> */ NOT_FOUND(404, "Not Found"), /** * {@code 405 Method Not Allowed}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.6">HTTP/1.1</a> */ METHOD_NOT_ALLOWED(405, "Method Not Allowed"), /** * {@code 406 Not Acceptable}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.7">HTTP/1.1</a> */ NOT_ACCEPTABLE(406, "Not Acceptable"), /** * {@code 407 Proxy Authentication Required}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.8">HTTP/1.1</a> */ PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"), /** * {@code 408 Request Timeout}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.9">HTTP/1.1</a> */ REQUEST_TIMEOUT(408, "Request Timeout"), /** * {@code 409 Conflict}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.10">HTTP/1.1</a> */ CONFLICT(409, "Conflict"), /** * {@code 410 Gone}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.11">HTTP/1.1</a> */ GONE(410, "Gone"), /** * {@code 411 Length Required}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.12">HTTP/1.1</a> */ LENGTH_REQUIRED(411, "Length Required"), /** * {@code 412 Precondition failed}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.13">HTTP/1.1</a> */ PRECONDITION_FAILED(412, "Precondition Failed"), /** * {@code 413 Request Entity Too Large}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.14">HTTP/1.1</a> */ REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"), /** * {@code 414 Request-URI Too Long}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.15">HTTP/1.1</a> */ REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"), /** * {@code 415 Unsupported Media Type}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.16">HTTP/1.1</a> */ UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"), /** * {@code 416 Requested Range Not Satisfiable}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.17">HTTP/1.1</a> */ REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested range not satisfiable"), /** * {@code 417 Expectation Failed}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.4.18">HTTP/1.1</a> */ EXPECTATION_FAILED(417, "Expectation Failed"), /** * {@code 418 I'm a teapot}. * * @see <a href="http://tools.ietf.org/html/rfc2324#section-2.3.2">HTCPCP/1.0</a> */ I_AM_A_TEAPOT(418, "I'm a teapot"), /** * @deprecated See <a href="http://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV Draft Changes</a> */ @Deprecated INSUFFICIENT_SPACE_ON_RESOURCE(419, "Insufficient Space On Resource"), /** * @deprecated See <a href="http://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV Draft Changes</a> */ @Deprecated METHOD_FAILURE(420, "Method Failure"), /** * @deprecated See <a href="http://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV Draft Changes</a> */ @Deprecated DESTINATION_LOCKED(421, "Destination Locked"), /** * {@code 422 Unprocessable Entity}. * * @see <a href="http://tools.ietf.org/html/rfc4918#section-11.2">WebDAV</a> */ UNPROCESSABLE_ENTITY(422, "Unprocessable Entity"), /** * {@code 423 Locked}. * * @see <a href="http://tools.ietf.org/html/rfc4918#section-11.3">WebDAV</a> */ LOCKED(423, "Locked"), /** * {@code 424 Failed Dependency}. * * @see <a href="http://tools.ietf.org/html/rfc4918#section-11.4">WebDAV</a> */ FAILED_DEPENDENCY(424, "Failed Dependency"), /** * {@code 426 Upgrade Required}. * * @see <a href="http://tools.ietf.org/html/rfc2817#section-6">Upgrading to TLS Within HTTP/1.1</a> */ UPGRADE_REQUIRED(426, "Upgrade Required"), /** * {@code 428 Precondition Required}. * * @see <a href="http://tools.ietf.org/html/rfc6585#section-3">Additional HTTP Status Codes</a> */ PRECONDITION_REQUIRED(428, "Precondition Required"), /** * {@code 429 Too Many Requests}. * * @see <a href="http://tools.ietf.org/html/rfc6585#section-4">Additional HTTP Status Codes</a> */ TOO_MANY_REQUESTS(429, "Too Many Requests"), /** * {@code 431 Request Header Fields Too Large}. * * @see <a href="http://tools.ietf.org/html/rfc6585#section-5">Additional HTTP Status Codes</a> */ REQUEST_HEADER_FIELDS_TOO_LARGE(431, "Request Header Fields Too Large"), // --- 5xx Server Error --- /** * {@code 500 Internal Server Error}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.1">HTTP/1.1</a> */ INTERNAL_SERVER_ERROR(500, "Internal Server Error"), /** * {@code 501 Not Implemented}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.2">HTTP/1.1</a> */ NOT_IMPLEMENTED(501, "Not Implemented"), /** * {@code 502 Bad Gateway}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.3">HTTP/1.1</a> */ BAD_GATEWAY(502, "Bad Gateway"), /** * {@code 503 Service Unavailable}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.4">HTTP/1.1</a> */ SERVICE_UNAVAILABLE(503, "Service Unavailable"), /** * {@code 504 Gateway Timeout}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.5">HTTP/1.1</a> */ GATEWAY_TIMEOUT(504, "Gateway Timeout"), /** * {@code 505 HTTP Version Not Supported}. * * @see <a href="http://tools.ietf.org/html/rfc2616#section-10.5.6">HTTP/1.1</a> */ HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version not supported"), /** * {@code 506 Variant Also Negotiates} * * @see <a href="http://tools.ietf.org/html/rfc2295#section-8.1">Transparent Content Negotiation</a> */ VARIANT_ALSO_NEGOTIATES(506, "Variant Also Negotiates"), /** * {@code 507 Insufficient Storage} * * @see <a href="http://tools.ietf.org/html/rfc4918#section-11.5">WebDAV</a> */ INSUFFICIENT_STORAGE(507, "Insufficient Storage"), /** * {@code 508 Loop Detected} * * @see <a href="http://tools.ietf.org/html/rfc5842#section-7.2">WebDAV Binding Extensions</a> */ LOOP_DETECTED(508, "Loop Detected"), /** * {@code 509 Bandwidth Limit Exceeded} */ BANDWIDTH_LIMIT_EXCEEDED(509, "Bandwidth Limit Exceeded"), /** * {@code 510 Not Extended} * * @see <a href="http://tools.ietf.org/html/rfc2774#section-7">HTTP Extension Framework</a> */ NOT_EXTENDED(510, "Not Extended"), /** * {@code 511 Network Authentication Required}. * * @see <a href="http://tools.ietf.org/html/rfc6585#section-6">Additional HTTP Status Codes</a> */ NETWORK_AUTHENTICATION_REQUIRED(511, "Network Authentication Required"); /** * ******************************************************************************************** * ******************************************************************************************** * ****************************** 自定义响应状态(约定 value 9数字开头) ********************************** * ******************************************************************************************** * ******************************************************************************************** */ private final int value; private final String reasonPhrase; private Status(int value, String reasonPhrase) { this.value = value; this.reasonPhrase = reasonPhrase; } /** * Return the integer value of this status code. */ public int value() { return this.value; } /** * Return the reason phrase of this status code. */ public String getReasonPhrase() { return reasonPhrase; } /** * Return a string representation of this status code. */ @Override public String toString() { return Integer.toString(value); } /** * Return the enum constant of this type with the specified numeric value. * * @param statusCode the numeric value of the enum to be returned * @return the enum constant with the specified numeric value * @throws IllegalArgumentException if this enum has no constant for the specified numeric value */ public static HTTP.Status valueOf(int statusCode) { for (HTTP.Status status : values()) { if (status.value == statusCode) { return status; } } throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); } } protected HTTP() { } }
[ "-" ]
-
6ee6c297dde9b640fff964d65491950e9048108e
3f2e4374652e940fec6c87f6c8b398a78dae7588
/src/main/java/com/guoyasoft/service/StudentSvcImpl.java
ad77bd294fceadec0cf78c4487244f6a6c045293
[]
no_license
LudvikWoo/guoya-client
2001f277bf5bbb546b7031a335ee512f1484ddb8
6658df3f8fcb68ea4e00941892b0abd36cb52fcb
refs/heads/master
2021-04-03T09:16:51.594092
2019-04-23T06:09:26
2019-04-23T06:09:26
124,406,448
0
0
null
null
null
null
UTF-8
Java
false
false
159
java
package com.guoyasoft.service; import org.springframework.stereotype.Service; @Service("studentSvc") public class StudentSvcImpl implements IStudentSvc{ }
[ "LudvikWoo@users.noreply.github.com" ]
LudvikWoo@users.noreply.github.com