blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
4a3c3ba2dd73d1ccf695ec7dd6643ad10ea88939
7d453c5ad71d08efe776a848aaaad5e8e60035eb
/library/build/generated/source/r/release/com/facebook/drawee/R.java
06b8e0ee060e79b28e64cbe2ed6d6f37fd849a1b
[]
no_license
liutengsay1221/Android_Library
ce98232284a32486922f9541460b9c1780b62c8e
ca3c7e5e31097be508f946965bd696a0df61290f
refs/heads/master
2020-12-03T07:55:32.952466
2017-08-04T02:55:39
2017-08-04T02:55:39
95,638,417
1
0
null
null
null
null
UTF-8
Java
false
false
4,640
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package com.facebook.drawee; public final class R { public static final class attr { public static int actualImageScaleType = 0x7f0100e3; public static int actualImageUri = 0x7f010115; public static int backgroundImage = 0x7f0100e4; public static int fadeDuration = 0x7f0100d8; public static int failureImage = 0x7f0100de; public static int failureImageScaleType = 0x7f0100df; public static int overlayImage = 0x7f0100e5; public static int placeholderImage = 0x7f0100da; public static int placeholderImageScaleType = 0x7f0100db; public static int pressedStateOverlayImage = 0x7f0100e6; public static int progressBarAutoRotateInterval = 0x7f0100e2; public static int progressBarImage = 0x7f0100e0; public static int progressBarImageScaleType = 0x7f0100e1; public static int retryImage = 0x7f0100dc; public static int retryImageScaleType = 0x7f0100dd; public static int roundAsCircle = 0x7f0100e7; public static int roundBottomLeft = 0x7f0100ec; public static int roundBottomRight = 0x7f0100eb; public static int roundTopLeft = 0x7f0100e9; public static int roundTopRight = 0x7f0100ea; public static int roundWithOverlayColor = 0x7f0100ed; public static int roundedCornerRadius = 0x7f0100e8; public static int roundingBorderColor = 0x7f0100ef; public static int roundingBorderPadding = 0x7f0100f0; public static int roundingBorderWidth = 0x7f0100ee; public static int viewAspectRatio = 0x7f0100d9; } public static final class id { public static int center = 0x7f0d0027; public static int centerCrop = 0x7f0d003b; public static int centerInside = 0x7f0d003c; public static int fitCenter = 0x7f0d003d; public static int fitEnd = 0x7f0d003e; public static int fitStart = 0x7f0d003f; public static int fitXY = 0x7f0d0040; public static int focusCrop = 0x7f0d0041; public static int none = 0x7f0d0014; } public static final class styleable { public static int[] GenericDraweeHierarchy = { 0x7f0100d8, 0x7f0100d9, 0x7f0100da, 0x7f0100db, 0x7f0100dc, 0x7f0100dd, 0x7f0100de, 0x7f0100df, 0x7f0100e0, 0x7f0100e1, 0x7f0100e2, 0x7f0100e3, 0x7f0100e4, 0x7f0100e5, 0x7f0100e6, 0x7f0100e7, 0x7f0100e8, 0x7f0100e9, 0x7f0100ea, 0x7f0100eb, 0x7f0100ec, 0x7f0100ed, 0x7f0100ee, 0x7f0100ef, 0x7f0100f0 }; public static int GenericDraweeHierarchy_actualImageScaleType = 11; public static int GenericDraweeHierarchy_backgroundImage = 12; public static int GenericDraweeHierarchy_fadeDuration = 0; public static int GenericDraweeHierarchy_failureImage = 6; public static int GenericDraweeHierarchy_failureImageScaleType = 7; public static int GenericDraweeHierarchy_overlayImage = 13; public static int GenericDraweeHierarchy_placeholderImage = 2; public static int GenericDraweeHierarchy_placeholderImageScaleType = 3; public static int GenericDraweeHierarchy_pressedStateOverlayImage = 14; public static int GenericDraweeHierarchy_progressBarAutoRotateInterval = 10; public static int GenericDraweeHierarchy_progressBarImage = 8; public static int GenericDraweeHierarchy_progressBarImageScaleType = 9; public static int GenericDraweeHierarchy_retryImage = 4; public static int GenericDraweeHierarchy_retryImageScaleType = 5; public static int GenericDraweeHierarchy_roundAsCircle = 15; public static int GenericDraweeHierarchy_roundBottomLeft = 20; public static int GenericDraweeHierarchy_roundBottomRight = 19; public static int GenericDraweeHierarchy_roundTopLeft = 17; public static int GenericDraweeHierarchy_roundTopRight = 18; public static int GenericDraweeHierarchy_roundWithOverlayColor = 21; public static int GenericDraweeHierarchy_roundedCornerRadius = 16; public static int GenericDraweeHierarchy_roundingBorderColor = 23; public static int GenericDraweeHierarchy_roundingBorderPadding = 24; public static int GenericDraweeHierarchy_roundingBorderWidth = 22; public static int GenericDraweeHierarchy_viewAspectRatio = 1; public static int[] SimpleDraweeView = { 0x7f010115 }; public static int SimpleDraweeView_actualImageUri = 0; } }
[ "80381811@qq.com" ]
80381811@qq.com
3b4481fbd76e4560f2be596c7e9f2724436ec281
ae23e0ccead7faf6f6f7a96a0ff3c120346e2036
/library/src/main/java/com/hippo/tuxiang/GLThreadManager.java
e6a8ff19f9e23f9b3ab60405451672fa01c5d4dc
[ "Apache-2.0" ]
permissive
seven332/TuXiang
c31b11d26b70b56ea0a341a014281d02f3838f32
a8594f13f37abda1833ab9f23b5be580acf71ad4
refs/heads/master
2020-12-24T06:53:16.650032
2019-01-31T14:55:19
2019-01-31T14:55:19
57,882,607
0
2
null
null
null
null
UTF-8
Java
false
false
1,241
java
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hippo.tuxiang; import android.util.Log; // android-9.0.0_r30 final class GLThreadManager { private static final String TAG = "GLThreadManager"; public synchronized void threadExiting(GLThread thread) { if (GLStuff.LOG_THREADS) { Log.i("GLThread", "exiting tid=" + thread.getId()); } thread.mExited = true; notifyAll(); } /* * Releases the EGL context. Requires that we are already in the * sGLThreadManager monitor when this is called. */ public void releaseEglContextLocked(GLThread thread) { notifyAll(); } }
[ "seven332@163.com" ]
seven332@163.com
8ee64b3c1370f31f2918b858d0aa50c0660f5545
383e1905b54ddbc34e41c522e4f32b7fb697a316
/common/src/main/java/com/paycr/common/data/dao/InvoicePaymentDao.java
f150a40d731668b3cfeb471954de254057802590
[]
no_license
sharmavikashkr/paycr-api
8f04d44828a8202674e010028b876968c846672c
b7d6462cfe111e498331dc12cb38b223a949b01b
refs/heads/master
2023-08-06T05:14:12.632805
2020-04-19T16:57:55
2020-04-19T16:57:55
415,630,140
0
0
null
null
null
null
UTF-8
Java
false
false
2,452
java
package com.paycr.common.data.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import org.springframework.stereotype.Component; import com.paycr.common.bean.search.SearchInvoicePaymentRequest; import com.paycr.common.data.domain.InvoicePayment; import com.paycr.common.data.domain.Merchant; import com.paycr.common.util.CommonUtil; import com.paycr.common.util.DateUtil; @Component public class InvoicePaymentDao { @PersistenceContext private EntityManager em; public List<InvoicePayment> findPayments(SearchInvoicePaymentRequest searchReq, Merchant merchant) { StringBuilder squery = new StringBuilder("SELECT p FROM InvoicePayment p WHERE"); if (!CommonUtil.isNull(merchant)) { squery.append(" p.merchant = :merchant AND"); } if (!CommonUtil.isEmpty(searchReq.getInvoiceCode())) { squery.append(" p.invoiceCode LIKE :invoiceCode AND"); } if (!CommonUtil.isEmpty(searchReq.getInvoiceCode())) { squery.append(" p.paymentRefNo LIKE :paymentRefNo AND"); } if (!CommonUtil.isNull(searchReq.getPayType())) { squery.append(" p.payType = :payType AND"); } if (!CommonUtil.isNull(searchReq.getPayType())) { squery.append(" p.payMode = :payMode AND"); } if (!CommonUtil.isNull(searchReq.getCreatedFrom())) { squery.append(" p.created between :startDate AND :endDate AND"); } squery.append(" p.deleted = FALSE AND p.id > 0 ORDER BY p.id DESC"); TypedQuery<InvoicePayment> query = em.createQuery(squery.toString(), InvoicePayment.class); if (!CommonUtil.isNull(merchant)) { query.setParameter("merchant", merchant); } if (!CommonUtil.isEmpty(searchReq.getInvoiceCode())) { query.setParameter("invoiceCode", "%" + searchReq.getInvoiceCode() + "%"); } if (!CommonUtil.isEmpty(searchReq.getInvoiceCode())) { query.setParameter("paymentRefNo", "%" + searchReq.getPaymentRefNo() + "%"); } if (!CommonUtil.isNull(searchReq.getPayType())) { query.setParameter("payType", searchReq.getPayType()); } if (!CommonUtil.isNull(searchReq.getPayType())) { query.setParameter("payMode", searchReq.getPayMode()); } if (!CommonUtil.isNull(searchReq.getCreatedFrom())) { query.setParameter("startDate", DateUtil.getStartOfDay(searchReq.getCreatedFrom())); query.setParameter("endDate", DateUtil.getEndOfDay(searchReq.getCreatedTo())); } return query.getResultList(); } }
[ "vikash.kumar@talentica.com" ]
vikash.kumar@talentica.com
cd48fa8e03f5e622af1f7454d65b7c36706d77da
723cc31d703bca25aa7edcc0359f268c7a07c679
/spring-batch-demo/src/main/java/com/jaky/spring/batch/demo/JobCompletionNotificationListener.java
2ad673c30c68f9be6c6375774a43af53904a44dd
[]
no_license
littlePang/spring-demo
0f4dde39e2241ba69f70a17c11263c039b728383
b15f4931afca93a61c7ebc499b129904ba300b9e
refs/heads/master
2021-01-19T09:48:37.524153
2019-01-30T07:47:05
2019-01-30T07:47:05
82,140,241
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package com.jaky.spring.batch.demo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.listener.JobExecutionListenerSupport; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Component; @Component public class JobCompletionNotificationListener extends JobExecutionListenerSupport { private static final Logger log = LoggerFactory.getLogger(JobCompletionNotificationListener.class); private final JdbcTemplate jdbcTemplate; @Autowired public JobCompletionNotificationListener(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } @Override public void afterJob(JobExecution jobExecution) { if(jobExecution.getStatus() == BatchStatus.COMPLETED) { log.info("!!! JOB FINISHED! Time to verify the results"); jdbcTemplate.query("SELECT first_name, last_name FROM people", (rs, row) -> new Person( rs.getString(1), rs.getString(2)) ).forEach(person -> log.info("Found <" + person + "> in the database.")); } } }
[ "xiaomo.wj@alibaba-inc.com" ]
xiaomo.wj@alibaba-inc.com
bc95d229ce5c25c9b8b2c5426780e97f53a4471a
afc4fd9b009aeb4841359cec7e6568889af17040
/src/main/java/com/codegym/controller/PhoneCustomer.java
9618bb58a43aff57665cd1c85219b5433ec81d9f
[]
no_license
duyettwyler2k/phone_validate
0fc3969e0e354ca17fbfdd26a1c2d67b79c777fa
bfe135e66c6ff531e41d118445d2adb12362191f
refs/heads/master
2023-06-05T08:19:35.223904
2021-06-22T07:59:22
2021-06-22T07:59:22
379,188,650
0
0
null
null
null
null
UTF-8
Java
false
false
1,029
java
package com.codegym.controller; import com.codegym.model.Phone; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class PhoneCustomer { @GetMapping("/phone") public ModelAndView phoneList(){ ModelAndView modelAndView=new ModelAndView("/list"); modelAndView.addObject("phones",new Phone()); return modelAndView; } @PostMapping("/save") public ModelAndView checkPhone(@Validated @ModelAttribute(name = "phones")Phone phone, BindingResult bindingResult){ if (bindingResult.hasFieldErrors()){ return new ModelAndView("/list","phones",phone); } return new ModelAndView("/result"); } }
[ "duyettwyller@gmail.com" ]
duyettwyller@gmail.com
d907e50799cb12c98cd6611a47d87cc672299f72
ff72eacb53e5fa100c84ab323838b4e0a1881dee
/src/com/eiffel/sdk/EiffelFrameworkType.java
b226ab82aa2b12514a7384ebebe905dc23039845
[ "MIT" ]
permissive
ionagamed/eiffel-idea
37da8ce647708363c5708e1c88c0277af328f3e3
bd3945c8637a57b8a9e5ed02d0d724e684c5ab53
refs/heads/master
2021-09-04T03:44:01.830567
2018-01-11T21:30:09
2018-01-11T21:30:09
103,184,447
5
0
null
null
null
null
UTF-8
Java
false
false
716
java
package com.eiffel.sdk; import com.eiffel.EiffelIcons; import com.intellij.framework.FrameworkTypeEx; import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider; import org.jetbrains.annotations.NotNull; import javax.swing.*; public class EiffelFrameworkType extends FrameworkTypeEx { protected EiffelFrameworkType() { super("Eiffel"); } @NotNull @Override public FrameworkSupportInModuleProvider createProvider() { return new EiffelModuleProvider(); } @NotNull @Override public String getPresentableName() { return "Eiffel"; } @NotNull @Override public Icon getIcon() { return EiffelIcons.E_ICON_FILE; } }
[ "ionagamed@gmail.com" ]
ionagamed@gmail.com
34f2e5b351d9b64b2c2213c1a3acbb108b024a0e
f1479edd542cd0febb97bc72c603d1df888478bd
/src/test/java/com/usa/Stepdefination/UPSLoginFuntion.java
59a60dc353aa8d6fd1753c7e7838b568991df4e8
[]
no_license
sayada/fedtest
0345626a1b3b9f0c7c463b5c1ef06670816c4dde
6432197aba5d28ff1c8ba56a055acca95bf0b154
refs/heads/master
2020-03-17T02:31:08.023658
2018-05-13T00:29:39
2018-05-13T00:29:39
133,193,326
0
0
null
null
null
null
UTF-8
Java
false
false
1,755
java
package com.usa.Stepdefination; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import com.usa.loginfuntiontest.HomePageFactory; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class UPSLoginFuntion extends HomePageFactory { public UPSLoginFuntion(WebDriver driver) { super(driver); // TODO Auto-generated constructor stub } WebDriver driver; @Given("^user able to open the browser$") public void user_able_to_open_the_browser() throws Throwable { driver = new FirefoxDriver (); } @Given("^go to UPS home page$") public void go_to_UPS_home_page() throws Throwable { HomePageFactory obj = new HomePageFactory(driver); driver.get(obj.getAppURL()); } @When("^user navigate to login button link$") public void user_navigate_to_login_button_link() throws Throwable { driver.findElement(By.xpath(".//a[text()='Log In']")).click(); } @When("^user able to put valid user name- Sarower(\\d+)$") public void user_able_to_put_valid_user_name_Sarower(int arg1) throws Throwable { driver.findElement(By.xpath(".//*[@id='email']")).sendKeys("Sarower2017"); } @When("^user able to put valid passwords- Ttch(\\d+)\\$$") public void user_able_to_put_valid_passwords_Ttch_$(int arg1) throws Throwable { driver.findElement(By.xpath(".//*[@id='pwd']")).sendKeys("Ttech123$"); driver.findElement(By.xpath(".//*[@id='submitBtn']")).click(); } @Then("^Login Successful$") public void login_Successful() throws Throwable { System.out.println("Test Pass"); driver.quit (); } }
[ "Sayad@LAPTOP-NOO1O6PJ.fios-router.home" ]
Sayad@LAPTOP-NOO1O6PJ.fios-router.home
4bb5d737184a452878c248b2b40df89ab4c379f2
a59e4ff0a027961c69cf0f939c823d8df58e2a91
/NightLife2-2/app/src/main/java/com/example/dhritiwasan/nightlife/DownloadUrl.java
3e58287a366fd058348c79ac33117fdc07fe14c3
[]
no_license
OmegAshEnr01n/androidappsgnightlife
8a63437b042922a49a1deb081c7999d48b50ca31
b38d5bf28e614df8e359eefdb6c6b86792ff9344
refs/heads/master
2021-08-23T10:58:08.579231
2017-12-04T16:06:32
2017-12-04T16:06:32
113,063,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
package com.example.dhritiwasan.nightlife; import android.util.Log; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; /** * Created by Shobhit on 2/12/2017. */ public class DownloadUrl { public String readUrl(String myUrl) throws IOException { String data = ""; InputStream inputStream = null; HttpURLConnection urlConnection = null; try { URL url = new URL(myUrl); urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.connect(); inputStream = urlConnection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); StringBuffer sb = new StringBuffer(); String line = ""; while((line = br.readLine()) != null) { sb.append(line); } data = sb.toString(); Log.d("downloadUrl", data.toString()); br.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if(inputStream != null) inputStream.close(); urlConnection.disconnect(); } Log.d("data downlaod",data); return data; } }
[ "sobhit.me@gmail.com" ]
sobhit.me@gmail.com
f216412ff41ecb6ae2bb4a59bd02be499b95543b
8380139bad2d18127ec9c03abb910aec0839b0c0
/eLaundromat/app/src/main/java/jawale/ankita/elaundromat/DisclaimerActivity.java
56c5a172573b1bcc53510d292fa2a1b5d2dd36a1
[]
no_license
ankijaws/eLaundromat
0132b08f4990b1621fab24227b07a1061070a085
31f222be2bcac2d6b794b510ada4c23a43d9b13a
refs/heads/master
2020-03-22T10:46:51.633561
2018-07-06T21:50:26
2018-07-06T21:50:26
139,926,056
0
0
null
null
null
null
UTF-8
Java
false
false
1,395
java
package jawale.ankita.elaundromat; import android.content.Context; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; public class DisclaimerActivity extends MainActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_disclaimer); LayoutInflater inflater = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View contentView = inflater.inflate(R.layout.activity_disclaimer, null, true); //drawer.removeAllViews(); drawer.removeViewAt(0); drawer.addView(contentView, 0); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } }
[ "ankijaws@users.noreply.github.com" ]
ankijaws@users.noreply.github.com
c93e74a9dbe47f2d33649a550ddd85e05b19cd28
b4cbc825c8ddc75303143d1d78c4eb355113fda7
/src/main/java/com/toDo/service/ToDoService.java
5c2f5e791a9a568736f792da92bfdac1c42f2e80
[]
no_license
justsayr/toDo
2491c41834e4473524c96d5605f5b94e6321fb10
a18d69eb533b3baf3c99142ef27e7212a18b8829
refs/heads/master
2021-01-22T07:49:03.894945
2017-02-21T14:32:33
2017-02-21T14:32:33
81,857,066
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.toDo.service; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.toDo.domain.Task; import com.toDo.domain.Tasks; import com.toDo.repository.IToDoRepository; @Service public class ToDoService { @Autowired private IToDoRepository repo; public void saveTask(Task task) { repo.save(task); } public List<Task> getTasks() { List<Task> tasks= (List<Task>) repo.findAll(); return tasks; } /*public void writeToFile() throws IOException{ List<Task> listOfTask= getTasks(); FileOutputStream file = null; ObjectOutputStream out = null; try{ file = new FileOutputStream("D:\\ram.txt"); out = new ObjectOutputStream(file); for(Task task : listOfTask){ out.writeObject(task); } }catch(IOException e ){ } finally{ file.close(); } }*/ public Task getTask() { List<Task> tasks= (List<Task>) repo.findAll(); for(Task task : tasks){ return task ; } return null; } public void deleteTask(String id) { repo.delete(id); } public Task getTAskById(String id) { return repo.findById(id); } }
[ "rhajare@osius.com" ]
rhajare@osius.com
d6c903d66cd034b6f206f6bddca3b939d92ccbab
b773b58ec793790f9a548ddf2000202dfcf83097
/app/src/main/java/com/example/saifullah_albasrie/pnm/model/ProspekJadwalModel.java
bbb03dd9a9aea2aaec57af21f8d04d4bf8a9dd6d
[]
no_license
poonix/pnm-src
de446683853a5ab83566c8530ff2a8e922ba062a
5ea07a25981d2dc884637e3654fc23d184cab6ab
refs/heads/master
2021-05-11T12:19:02.376258
2018-01-24T16:46:27
2018-01-24T16:46:27
117,210,397
0
0
null
null
null
null
UTF-8
Java
false
false
2,001
java
package com.example.saifullah_albasrie.pnm.model; import android.os.Parcel; import android.os.Parcelable; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; /** * Created by saifullah_albasrie on 3/2/17. */ public class ProspekJadwalModel implements Parcelable{ @SerializedName("id") @Expose private int id; @SerializedName("realisasi_pertemuan") @Expose private String realisasiPertemuan; @SerializedName("keterangan_pertemuan") @Expose private String keteranganPertemuan; public ProspekJadwalModel() { } protected ProspekJadwalModel(Parcel in) { id = in.readInt(); realisasiPertemuan = in.readString(); keteranganPertemuan = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(id); dest.writeString(realisasiPertemuan); dest.writeString(keteranganPertemuan); } @Override public int describeContents() { return 0; } public static final Creator<ProspekJadwalModel> CREATOR = new Creator<ProspekJadwalModel>() { @Override public ProspekJadwalModel createFromParcel(Parcel in) { return new ProspekJadwalModel(in); } @Override public ProspekJadwalModel[] newArray(int size) { return new ProspekJadwalModel[size]; } }; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getRealisasiPertemuan() { return realisasiPertemuan; } public void setRealisasiPertemuan(String realisasiPertemuan) { this.realisasiPertemuan = realisasiPertemuan; } public String getKeteranganPertemuan() { return keteranganPertemuan; } public void setKeteranganPertemuan(String keteranganPertemuan) { this.keteranganPertemuan = keteranganPertemuan; } }
[ "poonix27@gmail.com" ]
poonix27@gmail.com
b431b4f9c7b6ab09fd5099664d6b4979a390d6d4
50987aaddadc7dd0c656a0e7cbe7004543acc4fa
/ezHL7WS/src/main/java/com/ezdi/cac/constant/table/EditOptionsTableConstant.java
bb6bbde72d12180d602c1af6b09e5b4fcb696011
[]
no_license
janakt-ezdi/testjenkins
f53e51b33199050ae89d8bb22f5695efa2a967b8
bc91bef06d54551129bf79c6d7b450261012cb8e
refs/heads/master
2016-09-05T15:26:38.512919
2015-08-26T04:38:53
2015-08-26T04:38:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
package com.ezdi.cac.constant.table; public interface EditOptionsTableConstant { public static final String TABLE_NAME = "Edit_Options"; public static final String EDITOPTIONSID = "editoptionsID"; public static final String APPLY_DRG_EDITS = "apply_drg_edits"; public static final String APPLY_MUE_EDITS = "apply_mue_edits"; public static final String APPLY_RAC_EDITS = "apply_rac_edits"; public static final String APPLY_TRUCODE_EDITS = "apply_trucode_edits"; public static final String APPLY_E_CODE_EDITS = "apply_e_code_edits"; public static final String APPLY_E_CODE_PLACE_OF_OCCURRENCE_EDITS = "apply_e_code_place_of_occurrence_edits"; public static final String ENCOUNTERID = "encounterID"; public static final String PATIENTCLASSID = "patientClassId"; public static final String CREATORUSERID = "creatorUserId"; public static final String CREATORDTS = "creatorDTS"; public static final String UPDATEUSERID = "updateUserId"; public static final String UPDATEDTS = "updateDTS"; public static final String ACTIVERECORD = "activeRecord"; public static final String PATIENTCLASSCODE = "patientclasscode"; public static final String PATIENTCLASSDESC = "patientclassdesc"; public static final String GROUPER_TYPE = "grouper_type"; public static final String ISDEFAULT = "isDefault"; }
[ "thakkarjanak1811@gmail.com" ]
thakkarjanak1811@gmail.com
5effb855444b696e956dae9eb9f35b3f5a73c359
376641f400747cc5019a6c529519d5c85cdd9eca
/src/lec21/collection/set/MainClass.java
758da0cab918d482074184a7121e1e0c78b3047c
[]
no_license
kchhipa4u/JavaInitialConcepts
ed18c82d638537f2600d963ba7b5f457ebe2a3e8
244cc1749a184ac6e38917b62d78f161cce7db3f
refs/heads/master
2021-01-21T16:45:42.509964
2017-12-28T02:04:55
2017-12-28T02:04:55
91,905,397
0
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package lec21.collection.set; import java.util.Iterator; import java.util.LinkedHashSet; public class MainClass { public static void main(String[] args) { //Creating LinkedHashSet LinkedHashSet<Customer> set = new LinkedHashSet<Customer>(); set.add(new Customer("Kanhaiya", 1)); set.add(new Customer("Anil", 2)); set.add(new Customer("Madhu", 3)); set.add(new Customer("Anil", 2)); //Adding elements to LinkedHashSet /* set.add(new Customer("Jack", 021)); set.add(new Customer("Peter", 105)); set.add(new Customer("Ramesh", 415)); set.add(new Customer("Julian", 814)); set.add(new Customer("Avinash", 105)); //Duplicate Element set.add(new Customer("Sapna", 879)); set.add(new Customer("John", 546)); set.add(new Customer("Moni", 254)); set.add(new Customer("Ravi", 105)); */ //Duplicate Element //Getting Iterator object Iterator<Customer> it = set.iterator(); while (it.hasNext()) { Customer customer = (Customer) it.next(); System.out.println(customer); } } }
[ "kchhipa4u@gmail.com" ]
kchhipa4u@gmail.com
eafbe5b068314b358eb1e062fcd2e7e2b70bfd9a
ea516849f3551408b2168cb7ee7f9143c1bdc13e
/src/com/cynovo/sirius/core/order/OrderContentToOnsale.java
4fa46a018e25644824745d4a723d9daadca0c496
[]
no_license
joysun2006/CloudPos_part10_20141212
3767594ae7d9123be2452b67b6d974204ae1aafb
31eceebc1d54f08fc38666387d0d1e2ab4a00ab8
refs/heads/master
2018-05-30T00:09:09.363701
2014-12-12T11:45:15
2014-12-12T11:45:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.cynovo.sirius.core.order; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class OrderContentToOnsale { @SerializedName("cid") @Expose private int orderContentID; @Expose private int onsaleID; @Expose private String value; public int getOrderContentID() { return orderContentID; } public void setOrderContentID(int orderContentID) { this.orderContentID = orderContentID; } public int getOnsaleID() { return onsaleID; } public void setOnsaleID(int onsaleID) { this.onsaleID = onsaleID; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } }
[ "no_1hailong@yeah.net" ]
no_1hailong@yeah.net
b5f500b4dce92298a1d28c7b759db0bdbe2a1d14
6101e5b1db4efca6dff16d7255c80c8247bb0704
/src/main/java/eu/purecode/springloginapp/controller/UserController.java
e18f0062c5ab989687fbb44bb0de1c130bc426b0
[]
no_license
aszulist/spring-login-app
2234b9afe4dc790d467b9c9219aa77ed031d570c
45f3707813966c8102babc977e7094069638acd1
refs/heads/master
2021-06-27T21:54:05.947736
2017-09-12T16:13:56
2017-09-12T16:13:56
103,293,548
0
0
null
null
null
null
UTF-8
Java
false
false
2,376
java
package eu.purecode.springloginapp.controller; import eu.purecode.springloginapp.validator.UserValidator; import eu.purecode.springloginapp.service.SecurityService; import eu.purecode.springloginapp.model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import eu.purecode.springloginapp.service.UserService; @Controller public class UserController { private final UserService userService; private final SecurityService securityService; private final UserValidator userValidator; @Autowired public UserController(UserService userService, SecurityService securityService, UserValidator userValidator) { this.userService = userService; this.securityService = securityService; this.userValidator = userValidator; } @RequestMapping(value = "/registration", method = RequestMethod.GET) public String registration(Model model) { model.addAttribute("userForm", new User()); return "registration"; } @RequestMapping(value = "/registration", method = RequestMethod.POST) public String registration(@ModelAttribute("userForm") User userForm, BindingResult bindingResult) { userValidator.validate(userForm, bindingResult); if (bindingResult.hasErrors()) { return "registration"; } userService.save(userForm); securityService.autologin(userForm.getUsername(), userForm.getPasswordConfirmation()); return "redirect:/welcome"; } @RequestMapping(value = "/login", method = RequestMethod.GET) public String login(Model model, String error, String logout) { if (error != null) { model.addAttribute("error", "Your username and password is invalid"); } if (logout != null) { model.addAttribute("message", "You have been logged out successfully"); } return "login"; } @RequestMapping(value = {"/", "/welcome"}, method = RequestMethod.GET) public String welcome() { return "welcome"; } }
[ "aszulist@o2.pl" ]
aszulist@o2.pl
324ab7b3843013975a2a9cf40c35bd917888c6e1
a7b64f2cf2a780654b09a083ee190067c4918686
/DesignPattern/src/main/java/strategy/Computer.java
74d88130f8572a76f027e7fb89b01aac5877a8b8
[]
no_license
Eyecandy/Design-Patterns-
d63d7b9e4c29d0f511b2131c6c9dc9a57a0a9945
8e42eee765c8d0af64cbc586935642ee6cb5f55f
refs/heads/master
2020-03-09T00:45:36.777427
2018-07-28T10:50:41
2018-07-28T10:50:41
128,496,616
0
0
null
null
null
null
UTF-8
Java
false
false
606
java
package strategy; /** * The computer class is a class with many behaviors. instead of defining all it's operation in one file * we instead configure the class behavior to perform the wanted mathOperation. I.e add, sub or mult. */ class Computer { private MathOperation mathOperation; public Computer(MathOperation mathOperation) { this.mathOperation = mathOperation; } public void setOperation(MathOperation mathOperation) { this.mathOperation = mathOperation; } public int compute(int a,int b) { return mathOperation.performOperation(a,b); } }
[ "joakim.nilfjord@gmail.com" ]
joakim.nilfjord@gmail.com
e7d8c5fb10f2db53b37df6741a4474da2eb1ac1d
5c8cc0e42ee1fb7b4f5151a2e6d77f2f4fb7906a
/oDKCollect/src/main/java/org/odk/collect/android/preferences/PreferencesActivity.java
31c8a236ab0eee120df1d9dd004ac6db64d8b701
[]
no_license
SferaDev/ETIC-Formas
7c4a2b3053a2a50a64c727e1cfb261dafa612e59
728908c3c6556d6d1e8575a74355eaf681ae3b52
refs/heads/master
2020-05-07T22:23:06.846781
2014-06-02T16:05:04
2014-06-02T16:05:04
20,221,732
0
0
null
null
null
null
UTF-8
Java
false
false
15,009
java
/* * Copyright (C) 2011 University of Washington * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package org.odk.collect.android.preferences; import org.odk.collect.android.R; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.provider.MediaStore.Images; import android.text.InputFilter; import android.text.Spanned; /** * Handles general preferences. * * @author Thomas Smyth, Sassafras Tech Collective (tom@sassafrastech.com; constraint behavior option) */ public class PreferencesActivity extends PreferenceActivity implements OnPreferenceChangeListener { protected static final int IMAGE_CHOOSER = 0; public static final String KEY_INFO = "info"; public static final String KEY_LAST_VERSION = "lastVersion"; public static final String KEY_FIRST_RUN = "firstRun"; public static final String KEY_SHOW_SPLASH = "showSplash"; public static final String KEY_SPLASH_PATH = "splashPath"; public static final String KEY_FONT_SIZE = "font_size"; public static final String KEY_SELECTED_GOOGLE_ACCOUNT = "selected_google_account"; public static final String KEY_GOOGLE_SUBMISSION = "google_submission_id"; public static final String KEY_USERNAME = "username"; public static final String KEY_PASSWORD = "password"; public static final String KEY_PROTOCOL = "protocol"; // must match /res/arrays.xml public static final String PROTOCOL_ODK_DEFAULT = "odk_default"; public static final String PROTOCOL_GOOGLE = "google"; public static final String PROTOCOL_OTHER = ""; public static final String NAVIGATION_SWIPE = "swipe"; public static final String NAVIGATION_BUTTONS = "buttons"; public static final String NAVIGATION_SWIPE_BUTTONS = "swipe_buttons"; public static final String CONSTRAINT_BEHAVIOR_ON_SWIPE = "on_swipe"; public static final String CONSTRAINT_BEHAVIOR_ON_FINALIZE = "on_finalize"; public static final String CONSTRAINT_BEHAVIOR_DEFAULT = "on_swipe"; public static final String KEY_FORMLIST_URL = "formlist_url"; public static final String KEY_SUBMISSION_URL = "submission_url"; public static final String KEY_COMPLETED_DEFAULT = "default_completed"; public static final String KEY_AUTH = "auth"; public static final String KEY_AUTOSEND_WIFI = "autosend_wifi"; public static final String KEY_AUTOSEND_NETWORK = "autosend_network"; public static final String KEY_NAVIGATION = "navigation"; public static final String KEY_CONSTRAINT_BEHAVIOR = "constraint_behavior"; private PreferenceScreen mSplashPathPreference; private EditTextPreference mSubmissionUrlPreference; private EditTextPreference mFormListUrlPreference; private EditTextPreference mUsernamePreference; private EditTextPreference mPasswordPreference; private ListPreference mFontSizePreference; private ListPreference mNavigationPreference; private ListPreference mConstraintBehaviorPreference; private CheckBoxPreference mAutosendWifiPreference; private CheckBoxPreference mAutosendNetworkPreference; private ListPreference mProtocolPreference; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); setTitle(getString(R.string.app_name) + " > " + getString(R.string.general_preferences)); // not super safe, but we're just putting in this mode to help // administrate // would require code to access it boolean adminMode = getIntent().getBooleanExtra("adminMode", false); SharedPreferences adminPreferences = getSharedPreferences( AdminPreferencesActivity.ADMIN_PREFERENCES, 0); boolean serverAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_SERVER, true); boolean urlAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_URL, true); PreferenceCategory autosendCategory = (PreferenceCategory) findPreference(getString(R.string.autosend)); mAutosendWifiPreference = (CheckBoxPreference) findPreference(KEY_AUTOSEND_WIFI); boolean autosendWifiAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_AUTOSEND_WIFI, true); if (!(autosendWifiAvailable || adminMode)) { autosendCategory.removePreference(mAutosendWifiPreference); } mAutosendNetworkPreference = (CheckBoxPreference) findPreference(KEY_AUTOSEND_NETWORK); boolean autosendNetworkAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_AUTOSEND_NETWORK, true); if (!(autosendNetworkAvailable || adminMode)) { autosendCategory.removePreference(mAutosendNetworkPreference); } if (!(autosendNetworkAvailable || autosendWifiAvailable || adminMode)) { getPreferenceScreen().removePreference(autosendCategory); } PreferenceCategory serverCategory = (PreferenceCategory) findPreference(getString(R.string.server_preferences)); // declared early to prevent NPE in toggleServerPaths mFormListUrlPreference = (EditTextPreference) findPreference(KEY_FORMLIST_URL); mSubmissionUrlPreference = (EditTextPreference) findPreference(KEY_SUBMISSION_URL); if (!(serverAvailable || adminMode)) { Preference protocol = findPreference(KEY_PROTOCOL); serverCategory.removePreference(protocol); } else { } mUsernamePreference = (EditTextPreference) findPreference(KEY_USERNAME); mUsernamePreference.setOnPreferenceChangeListener(this); mUsernamePreference.setSummary(mUsernamePreference.getText()); mUsernamePreference.getEditText().setFilters( new InputFilter[] { getReturnFilter() }); boolean usernameAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_USERNAME, true); if (!(usernameAvailable || adminMode)) { serverCategory.removePreference(mUsernamePreference); } mPasswordPreference = (EditTextPreference) findPreference(KEY_PASSWORD); mPasswordPreference .setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String pw = newValue.toString(); if (pw.length() > 0) { mPasswordPreference.setSummary("********"); } else { mPasswordPreference.setSummary(""); } return true; } }); if (mPasswordPreference.getText() != null && mPasswordPreference.getText().length() > 0) { mPasswordPreference.setSummary("********"); } mUsernamePreference.getEditText().setFilters( new InputFilter[] { getReturnFilter() }); boolean passwordAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_PASSWORD, true); if (!(passwordAvailable || adminMode)) { serverCategory.removePreference(mPasswordPreference); } // mFormListUrlPreference.setOnPreferenceChangeListener(this); smap // mFormListUrlPreference.setSummary(mFormListUrlPreference.getText()); smap if (!(serverAvailable || adminMode)) { serverCategory.removePreference(mFormListUrlPreference); } // mSubmissionUrlPreference.setOnPreferenceChangeListener(this); smap // mSubmissionUrlPreference.setSummary(mSubmissionUrlPreference.getText()); smap if (!(serverAvailable || adminMode)) { serverCategory.removePreference(mSubmissionUrlPreference); } if (!(serverAvailable || urlAvailable || usernameAvailable || passwordAvailable || /* googleAccountAvailable || */ adminMode)) { // smap - remove google account getPreferenceScreen().removePreference(serverCategory); } PreferenceCategory clientCategory = (PreferenceCategory) findPreference(getString(R.string.client)); boolean navigationAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_NAVIGATION, true); mNavigationPreference = (ListPreference) findPreference(KEY_NAVIGATION); mNavigationPreference.setSummary(mNavigationPreference.getEntry()); mNavigationPreference .setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int index = ((ListPreference) preference) .findIndexOfValue(newValue.toString()); String entry = (String) ((ListPreference) preference) .getEntries()[index]; ((ListPreference) preference).setSummary(entry); return true; } }); if (!(navigationAvailable || adminMode)) { clientCategory.removePreference(mNavigationPreference); } boolean constraintBehaviorAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CONSTRAINT_BEHAVIOR, true); mConstraintBehaviorPreference = (ListPreference) findPreference(KEY_CONSTRAINT_BEHAVIOR); mConstraintBehaviorPreference.setSummary(mConstraintBehaviorPreference.getEntry()); mConstraintBehaviorPreference .setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int index = ((ListPreference) preference) .findIndexOfValue(newValue.toString()); String entry = (String) ((ListPreference) preference) .getEntries()[index]; ((ListPreference) preference).setSummary(entry); return true; } }); if (!(constraintBehaviorAvailable || adminMode)) { clientCategory.removePreference(mConstraintBehaviorPreference); } boolean fontAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_CHANGE_FONT_SIZE, true); mFontSizePreference = (ListPreference) findPreference(KEY_FONT_SIZE); mFontSizePreference.setSummary(mFontSizePreference.getEntry()); mFontSizePreference .setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { int index = ((ListPreference) preference) .findIndexOfValue(newValue.toString()); String entry = (String) ((ListPreference) preference) .getEntries()[index]; ((ListPreference) preference).setSummary(entry); return true; } }); if (!(fontAvailable || adminMode)) { clientCategory.removePreference(mFontSizePreference); } boolean defaultAvailable = adminPreferences.getBoolean( AdminPreferencesActivity.KEY_DEFAULT_TO_FINALIZED, true); Preference defaultFinalized = findPreference(KEY_COMPLETED_DEFAULT); if (!(defaultAvailable || adminMode)) { clientCategory.removePreference(defaultFinalized); } if (!(fontAvailable || defaultAvailable || navigationAvailable || adminMode)) { getPreferenceScreen().removePreference(clientCategory); } } private void disableFeaturesInDevelopment() { // remove Google Collections from protocol choices in preferences ListPreference protocols = (ListPreference) findPreference(KEY_PROTOCOL); int i = protocols.findIndexOfValue(PROTOCOL_GOOGLE); if (i != -1) { CharSequence[] entries = protocols.getEntries(); CharSequence[] entryValues = protocols.getEntryValues(); CharSequence[] newEntries = new CharSequence[entryValues.length - 1]; CharSequence[] newEntryValues = new CharSequence[entryValues.length - 1]; for (int k = 0, j = 0; j < entryValues.length; ++j) { if (j == i) continue; newEntries[k] = entries[j]; newEntryValues[k] = entryValues[j]; ++k; } protocols.setEntries(newEntries); protocols.setEntryValues(newEntryValues); } } private void setSplashPath(String path) { SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this); Editor editor = sharedPreferences.edit(); editor.putString(KEY_SPLASH_PATH, path); editor.commit(); mSplashPathPreference = (PreferenceScreen) findPreference(KEY_SPLASH_PATH); mSplashPathPreference.setSummary(mSplashPathPreference .getSharedPreferences().getString(KEY_SPLASH_PATH, getString(R.string.default_splash_path))); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (resultCode == RESULT_CANCELED) { // request was canceled, so do nothing return; } switch (requestCode) { case IMAGE_CHOOSER: String sourceImagePath = null; // get gp of chosen file Uri uri = intent.getData(); if (uri.toString().startsWith("file")) { sourceImagePath = uri.toString().substring(6); } else { String[] projection = { Images.Media.DATA }; Cursor c = null; try { c = getContentResolver().query(uri, projection, null, null, null); int i = c.getColumnIndexOrThrow(Images.Media.DATA); c.moveToFirst(); sourceImagePath = c.getString(i); } finally { if (c != null) { c.close(); } } } // setting image path setSplashPath(sourceImagePath); break; } } /** * Disallows whitespace from user entry * * @return */ private InputFilter getWhitespaceFilter() { InputFilter whitespaceFilter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i < end; i++) { if (Character.isWhitespace(source.charAt(i))) { return ""; } } return null; } }; return whitespaceFilter; } /** * Disallows carriage returns from user entry * * @return */ private InputFilter getReturnFilter() { InputFilter returnFilter = new InputFilter() { public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { for (int i = start; i < end; i++) { if (Character.getType((source.charAt(i))) == Character.CONTROL) { return ""; } } return null; } }; return returnFilter; } /** * Generic listener that sets the summary to the newly selected/entered * value */ @Override public boolean onPreferenceChange(Preference preference, Object newValue) { preference.setSummary((CharSequence) newValue); return true; } }
[ "sferadev@gmail.com" ]
sferadev@gmail.com
8f263bb528a94189613e8235a4b08e15cb80a5f2
a62e9b92156a9125d49f55f1202bb62206c55b9e
/src/main/java/logic/expressions/comparators/SpecificComparatorFactory.java
92fa147cc32bcb30f6934adc9b9943b6b1f89094
[]
no_license
LazarevY/JavaEETask
deac0c97cc4ceef7d827fe0dbe0113de9e03158a
ff882e1d9651d25835435ba4b7367f835ec8d0c5
refs/heads/master
2023-02-05T23:33:39.996998
2020-12-21T21:53:53
2020-12-21T21:53:53
294,992,892
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package logic.expressions.comparators; import logic.expressions.interfaces.SpecificComparator; public interface SpecificComparatorFactory<T> { SpecificComparator<T> createForOperator(OperatorType operator); }
[ "lazarev@cs.vsu.ru" ]
lazarev@cs.vsu.ru
9571940e176d6fb3fdf353fee67efbc13b88334b
51368d721fce467bb464f570bb0bee6d664eb5e2
/src/main/java/com/satansk/concurrency/producerconsumer/Consumer.java
77e9c2ca302eb163289c51330c62da9993d4136e
[]
no_license
kun-song/Java-Concurrency
3b76ee43d5da4ff896d0cad9bd814dc83e28c63a
418581f42aa53b88ca0b5ea851e4b85348e04533
refs/heads/master
2021-06-17T19:54:29.765406
2017-06-22T23:39:25
2017-06-22T23:39:25
39,202,070
1
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.satansk.concurrency.producerconsumer; import java.util.Random; public class Consumer implements Runnable { // 线程共享数据 private Drop drop; public Consumer(Drop drop) { this.drop = drop; } public void run() { Random random = new Random(); for (String message = drop.take(); ! message.equals("DONE"); message = drop.take()) { System.out.format("Consumer received: %s%n", message); try { Thread.sleep(random.nextInt(5000)); } catch (InterruptedException e) { } } } }
[ "satansk@hotmail.com" ]
satansk@hotmail.com
f2969044ca019b00686858d4646250856173f1d5
6eca2c4714542f68266ff6d8beb751fcde01860b
/src/main/java/com/deepak/MessagingDriver.java
a82c701666850cedec9f6d454bdc2cfe7da91974
[]
no_license
deepakmehra10/maven-app-it
c2e20740f309a9739e2333a6e5cd3b934f40c1a0
04307ad987638fec5dbdcaa7dc1c2ec894a5a84d
refs/heads/master
2020-04-11T02:36:08.426594
2018-12-12T07:40:56
2018-12-12T07:40:56
161,449,661
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.deepak; import java.util.logging.Logger; public class MessagingDriver { public static void main(String[] args) { SocialMessageAggregator socialMessageAggregator = new SocialMessageAggregator(); String userMessage = socialMessageAggregator.aggregateMessages(); System.out.println(userMessage); } }
[ "dmehra@rccl.com" ]
dmehra@rccl.com
f7f4400da9748186d3486c014e3ba356b7b63916
db97ce70bd53e5c258ecda4c34a5ec641e12d488
/src/main/java/com/alipay/api/domain/SpecialPriceDTO.java
abded1377ae6d672fee9ab966ae6dc6948d05750
[ "Apache-2.0" ]
permissive
smitzhang/alipay-sdk-java-all
dccc7493c03b3c937f93e7e2be750619f9bed068
a835a9c91e800e7c9350d479e84f9a74b211f0c4
refs/heads/master
2022-11-23T20:32:27.041116
2020-08-03T13:03:02
2020-08-03T13:03:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,064
java
package com.alipay.api.domain; import java.util.List; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; /** * 特价营销 * * @author auto create * @since 1.0, 2020-05-06 16:54:48 */ public class SpecialPriceDTO extends AlipayObject { private static final long serialVersionUID = 5378149779527117681L; /** * 最少份数,如果有阶梯规则,多个值用英文逗号分割,例如:3,5 */ @ApiField("min_nums") private String minNums; /** * 营销活动skuid */ @ApiListField("promotion_sku_id") @ApiField("string") private List<String> promotionSkuId; /** * 活动价,必须是数字格式,且最多两位小数点。 如果有阶梯规则,多个值用英文逗号分割,例如:10,5 */ @ApiField("special_price") private String specialPrice; /** * 是否仅特价商品(Y/N) */ @ApiField("special_price_only") private String specialPriceOnly; /** * 特价skuId */ @ApiListField("special_price_sku_id") @ApiField("string") private List<String> specialPriceSkuId; public String getMinNums() { return this.minNums; } public void setMinNums(String minNums) { this.minNums = minNums; } public List<String> getPromotionSkuId() { return this.promotionSkuId; } public void setPromotionSkuId(List<String> promotionSkuId) { this.promotionSkuId = promotionSkuId; } public String getSpecialPrice() { return this.specialPrice; } public void setSpecialPrice(String specialPrice) { this.specialPrice = specialPrice; } public String getSpecialPriceOnly() { return this.specialPriceOnly; } public void setSpecialPriceOnly(String specialPriceOnly) { this.specialPriceOnly = specialPriceOnly; } public List<String> getSpecialPriceSkuId() { return this.specialPriceSkuId; } public void setSpecialPriceSkuId(List<String> specialPriceSkuId) { this.specialPriceSkuId = specialPriceSkuId; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
758fa397a1a6a196937bc9e565edd77997be1352
7daf3e17a9c52daeff88f07375363b273a51e123
/shoppingcart-session-app/src/java/com/servlets/OrderPage.java
beaa37dd6b9b1e7acf5f3b18241ed502f7413123
[]
no_license
mlhazan/shoppingcart-session-app
7ffd35aff7768e012b107ec9a9127adf24511b4a
c95847712471dce5afb6fa63b444e9a5b211c910
refs/heads/master
2020-05-29T09:16:16.506373
2016-10-22T00:49:11
2016-10-22T00:49:11
70,200,985
0
0
null
null
null
null
UTF-8
Java
false
false
6,575
java
package com.servlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; import java.text.NumberFormat; /** * Shows all items in ShoppingCart currently. Clients have their own session * that keeps track of which ShoppingCart is theirs. If this is their first * visit to the order page, a new shopping cart is created. Usually, people come * to this page by way of a page showing catalog entries, so this page adds an * additional item to the shopping cart. But users can also bookmark this page, * access it from their history list, or be sent back to it by clicking on the * "Update Order" button after changing the number of items ordered. */ public class OrderPage extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); ShoppingCart cart; synchronized (session) { cart = (ShoppingCart) session.getValue("shoppingCart"); // New visitors get a fresh shopping cart. // Previous visitors keep using their existing cart. if (cart == null) { cart = new ShoppingCart(); session.putValue("shoppingCart", cart); } String itemID = request.getParameter("itemID"); if (itemID != null) { String numItemsString = request.getParameter("numItems"); if (numItemsString == null) { // If request specified an ID but no number, // then customers came here via an "Add Item to Cart" // button on a catalog page. cart.addItem(itemID); } else { // If request specified an ID and number, then // customers came here via an "Update Order" button // after changing the number of items in order. // Note that specifying a number of 0 results // in item being deleted from cart. int numItems; try { numItems = Integer.parseInt(numItemsString); } catch (NumberFormatException nfe) { numItems = 1; } cart.setNumOrdered(itemID, numItems); } } } // Whether or not the customer changed the order, show // order status. response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Status of Your Order"; out.println(ServletUtilities.headWithTitle(title) + "<BODY BGCOLOR=\"#FDF5E6\">\n" + "<H1 ALIGN=\"CENTER\">" + title + "</H1>"); synchronized (session) { Vector itemsOrdered = cart.getItemsOrdered(); if (itemsOrdered.size() == 0) { out.println("<H2><I>No items in your cart...</I></H2>"); } else { // If there is at least one item in cart, show table // of items ordered. out.println("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" + "<TR BGCOLOR=\"#FFAD00\">\n" + " <TH>Item ID<TH>Description\n" + " <TH>Unit Cost<TH>Number<TH>Total Cost"); ItemOrder order; // Rounds to two decimal places, inserts dollar // sign (or other currency symbol), etc., as // appropriate in current Locale. NumberFormat formatter = NumberFormat.getCurrencyInstance(); String formURL = "/shoppingcart-session-app/OrderPage"; // Pass URLs that reference own site through encodeURL. formURL = response.encodeURL(formURL); // For each entry in shopping cart, make // table row showing ID, description, per-item // cost, number ordered, and total cost. // Put number ordered in textfield that user // can change, with "Update Order" button next // to it, which resubmits to this same page // but specifying a different number of items. for (int i = 0; i < itemsOrdered.size(); i++) { order = (ItemOrder) itemsOrdered.elementAt(i); out.println("<TR>\n" + " <TD>" + order.getItemID() + "\n" + " <TD>" + order.getShortDescription() + "\n" + " <TD>" + formatter.format(order.getUnitCost()) + "\n" + " <TD>" + "<FORM ACTION=\"" + formURL + "\">\n" + "<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\"\n" + " VALUE=\"" + order.getItemID() + "\">\n" + "<INPUT TYPE=\"TEXT\" NAME=\"numItems\"\n" + " SIZE=3 VALUE=\"" + order.getNumItems() + "\">\n" + "<SMALL>\n" + "<INPUT TYPE=\"SUBMIT\"\n " + " VALUE=\"Update Order\">\n" + "</SMALL>\n" + "</FORM>\n" + " <TD>" + formatter.format(order.getTotalCost())); } String checkoutURL = response.encodeURL("/shoppingcart-session-app/checkout.jsp"); // "Proceed to Checkout" button below table out.println("</TABLE>\n" + "<FORM ACTION=\"" + checkoutURL + "\">\n" + "<BIG><CENTER>\n" + "<INPUT TYPE=\"SUBMIT\"\n" + " VALUE=\"Proceed to Checkout\">\n" + "</CENTER></BIG></FORM>"); } out.println("</BODY></HTML>"); } } /** * POST and GET requests handled identically. */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
[ "mlhazan@hotmail.com" ]
mlhazan@hotmail.com
77afc74c028b69b735c3dd22ac9fb6653d1bb05d
d7dce1546d3d61eeb7ca534f5c184033cdc9fb82
/myshop-web-admin/src/main/java/com/zls/myshop/web/admin/interceptor/PermissionInterceptor.java
c82dced8570ba1c097612cbcff0909966e739a79
[ "MIT" ]
permissive
LeShengZhong/myshop
14839fd200c50dd485091adc6a93a6accf3e8a9a
6f7222edfc39c61e04420018e4b3a683165d275d
refs/heads/master
2022-12-21T11:23:21.094474
2019-06-17T09:28:19
2019-06-17T09:28:19
191,704,066
0
0
MIT
2022-12-16T09:43:49
2019-06-13T06:28:37
JavaScript
UTF-8
Java
false
false
178
java
package com.zls.myshop.web.admin.interceptor; /** * @program: myshop * @description: * @author: zls * @create: 2019-03-25 15:58 **/ public class PermissionInterceptor { }
[ "zhong1072109825@163.com" ]
zhong1072109825@163.com
b6e79f773c7033333b94198cb0abe76a4cfe93f7
83ca0a866769ab2b6e24a2588ec19c6e0d1d77ff
/mall/src/main/java/com/hongjiang/mall/service/IndexService.java
b09fe9af37a67618a103ac81c6607f9755944376
[]
no_license
zgq65751348/hongjiangkeji
6dfddaab95e25de2d121f7ebebe5be5d91d8b4b4
fb1f905761b2a4f31c3919ae1e5874820078aea1
refs/heads/master
2020-08-20T08:47:48.561739
2019-10-18T10:50:56
2019-10-18T10:50:56
216,003,383
1
0
null
null
null
null
UTF-8
Java
false
false
726
java
package com.hongjiang.mall.service; import com.hongjiang.mall.entity.User; import com.hongjiang.share.exception.BaseException; import com.hongjiang.share.response.ResponseCode; import org.springframework.stereotype.Service; /** * <p> * * </p> * windows 7 旗舰版 * * @author 墨茗琦妙 * @since 2019/10/18 0018 下午 4:54 */ @Service public class IndexService { public User getOnrUserById(Integer id) { if (id == 2) { throw new RuntimeException(); } if (id == 0) { throw new BaseException(ResponseCode.RESOURCES_NOT_EXIST); } User user = new User(); user.setId(2); user.setName("易水玄裳"); return user; } }
[ "46865783+zgq65751348@users.noreply.github.com" ]
46865783+zgq65751348@users.noreply.github.com
3b6e20a5eedf98b3c54a8a2112c6314cfcdf2fa8
ae148d4b0d77f9a0f8364954057966950606d745
/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/server/HttpRestartServerTests.java
1e52b245991bdadca83abd69b0b4bb3067340cd8
[ "Apache-2.0" ]
permissive
varunjha089/spring-boot
b259ab6b1373fdf40d58dca2f61a1356de64a9b9
c4adb76df214d7e1bb6960ccaa569d4322a499f7
refs/heads/master
2022-11-11T17:07:21.607677
2017-10-16T14:48:49
2017-10-16T14:48:49
107,150,191
1
0
Apache-2.0
2020-07-05T12:04:47
2017-10-16T15:56:48
Java
UTF-8
Java
false
false
4,385
java
/* * Copyright 2012-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.devtools.restart.server; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile; import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile.Kind; import org.springframework.boot.devtools.restart.classloader.ClassLoaderFiles; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.http.server.ServletServerHttpResponse; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; /** * Tests for {@link HttpRestartServer}. * * @author Phillip Webb */ public class HttpRestartServerTests { @Rule public ExpectedException thrown = ExpectedException.none(); @Mock private RestartServer delegate; private HttpRestartServer server; @Captor private ArgumentCaptor<ClassLoaderFiles> filesCaptor; @Before public void setup() { MockitoAnnotations.initMocks(this); this.server = new HttpRestartServer(this.delegate); } @Test public void sourceFolderUrlFilterMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("SourceFolderUrlFilter must not be null"); new HttpRestartServer((SourceFolderUrlFilter) null); } @Test public void restartServerMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("RestartServer must not be null"); new HttpRestartServer((RestartServer) null); } @Test public void sendClassLoaderFiles() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); ClassLoaderFiles files = new ClassLoaderFiles(); files.addFile("name", new ClassLoaderFile(Kind.ADDED, new byte[0])); byte[] bytes = serialize(files); request.setContent(bytes); this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response)); verify(this.delegate).updateAndRestart(this.filesCaptor.capture()); assertThat(this.filesCaptor.getValue().getFile("name")).isNotNull(); assertThat(response.getStatus()).isEqualTo(200); } @Test public void sendNoContent() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response)); verifyZeroInteractions(this.delegate); assertThat(response.getStatus()).isEqualTo(500); } @Test public void sendBadData() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); request.setContent(new byte[] { 0, 0, 0 }); this.server.handle(new ServletServerHttpRequest(request), new ServletServerHttpResponse(response)); verifyZeroInteractions(this.delegate); assertThat(response.getStatus()).isEqualTo(500); } private byte[] serialize(Object object) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(object); oos.close(); return bos.toByteArray(); } }
[ "pwebb@pivotal.io" ]
pwebb@pivotal.io
dd47ee5e53971ef42c55a787f68cb502e79f064f
02e1b1d375bd7e45d3707b6a663d7b6ccaf1be92
/eddmanager/src/main/java/com/wisesource/product/eddm/util/Param.java
ca389c7bd03f378db52d5dec290dfa78ae603bb2
[]
no_license
zhonghai/lightframework
4308ab3f76ba6100248301f150045db76e2bb63a
1a3ad5db7dfb892f0ed67fcee7b71c7b647ac485
refs/heads/master
2021-01-23T16:30:34.921215
2012-10-07T13:11:00
2012-10-07T13:11:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.wisesource.product.eddm.util; import java.util.Map; public class Param { public static String oneVal(Map param,String attrNm){ if(param == null) return ""; String[] s = null; String sRtn = ""; if(param.get(attrNm) != null){ s = (String[]) param.get(attrNm); if(s.length > 0 ){ sRtn = s[0]; } } return sRtn; } }
[ "879856636@qq.com" ]
879856636@qq.com
4c41790c024435ea65c9d70807b0681b77bb4ae1
163fc6d36acf2fe2b568f59f1c83e556bbff73c7
/app/src/test/java/cskku/amornpalang/mananchaya/petpet/ExampleUnitTest.java
294799c113eb1a5c3484772f7669e3670d8fc647
[]
no_license
mananchaya/Pet-Pet
3ed44967ed612265cd78aa86646945e4f25d31ac
aebccf2993ef3b2c0937835211d1c568a3a5565f
refs/heads/master
2021-01-11T23:52:53.517162
2017-01-13T04:43:10
2017-01-13T04:43:10
78,639,951
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package cskku.amornpalang.mananchaya.petpet; 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() throws Exception { assertEquals(4, 2 + 2); } }
[ "aoy.mananchaya@gmail.com" ]
aoy.mananchaya@gmail.com
c500ba4f1ea7abfd17bfd48eb2cf3331d2077d2f
07a6f93b136e6c97c975b84c9955fe106fccabab
/src/MoviesProject/MovieInfo/RatingController.java
dce1f7b5f4d4d9ccd3ff4e2b288c9697b6d29e8e
[]
no_license
jsj1215/MoviesProject
ac8fd8dba4ecb7d9fff97f54804fb8c0d0684920
526c164c4306f3770bc9214f8c664335ad83dc7f
refs/heads/master
2020-12-05T23:32:45.451558
2020-01-07T11:40:55
2020-01-07T11:40:55
232,277,930
0
0
null
null
null
null
UTF-8
Java
false
false
812
java
package MoviesProject.MovieInfo; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.ComboBox; import javafx.scene.control.Alert.AlertType; public class RatingController implements Initializable{ @FXML ComboBox<String> ComB_Rating; @Override public void initialize(URL location, ResourceBundle resources) {} public void BTN_serrating() { if(ComB_Rating.getValue() == null) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("오류"); alert.setHeaderText("평점 입력 오류."); alert.setContentText("점수를 선택하셔야 합니다."); alert.showAndWait(); alert.close(); } else{System.out.println(ComB_Rating.getValue() + " 주기");} } }
[ "jsj1215@naver.com" ]
jsj1215@naver.com
81b996816b8009f64697f7532ba9054300aaa090
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/2eee56e117d26ee8f93b1c072a371c124d3d6acf/before/GroovyConfigUtils.java
70b5a6c42b03869b2cbd2e04826659443d13beb8
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
12,184
java
/* * Copyright 2000-2008 JetBrains s.r.o. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jetbrains.plugins.groovy.config; import com.intellij.facet.ui.ValidationResult; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.*; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; import com.intellij.openapi.roots.libraries.LibraryUtil; import com.intellij.openapi.roots.ui.configuration.LibraryTableModifiableModelProvider; import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesModifiableModel; import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable; import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigrableContext; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Function; import com.intellij.util.Processor; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.grails.config.GrailsConfigUtils; import org.jetbrains.plugins.groovy.GroovyBundle; import org.jetbrains.plugins.groovy.settings.GroovyApplicationSettings; import org.jetbrains.plugins.groovy.util.GroovyUtils; import org.jetbrains.plugins.groovy.util.LibrariesUtil; import java.io.File; import java.util.Collection; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; /** * @author ilyas */ public class GroovyConfigUtils { private static final String GROOVY_STARTER_FILE_NAME = "groovy"; public static final String UNDEFINED_VERSION = "undefined"; public static final String GROOVY_LIB_PATTERN = "groovy-\\d.*"; public static final String GRAILS_LIB_PATTERN = "grails-\\d.*"; public static final String MANIFEST_PATH = "META-INF/MANIFEST.MF"; public static final String GROOVY_JAR_PATTERN = "groovy-all-\\d.*\\.jar"; public static final String GROOVY_LIB_PREFIX = "groovy-"; public static boolean isGroovySdkHome(final VirtualFile file) { final Ref<Boolean> result = Ref.create(false); processFilesUnderGDKRoot(file, new Processor<VirtualFile>() { public boolean process(final VirtualFile virtualFile) { result.set(true); return false; } }); return result.get(); } private static void processFilesUnderGDKRoot(VirtualFile file, final Processor<VirtualFile> processor) { if (file != null && file.isDirectory()) { final VirtualFile child = file.findChild("bin"); if (child != null && child.isDirectory()) { for (VirtualFile grandChild : child.getChildren()) { if (GROOVY_STARTER_FILE_NAME.equals(grandChild.getNameWithoutExtension())) { if (!processor.process(grandChild)) return; } } } } } public static String getGroovyVersion(@NotNull String path) { String groovyJarVersion = getGroovyGrailsJarVersion(path + "/lib", "groovy-\\d.*\\.jar", MANIFEST_PATH); return groovyJarVersion != null ? groovyJarVersion : UNDEFINED_VERSION; } /** * Return value of Implementation-Version attribute in jar manifest * <p/> * * @param jarPath directory containing jar file * @param jarRegex filename pattern for jar file * @param manifestPath path to manifest file in jar file * @return value of Implementation-Version attribute, null if not found */ public static String getGroovyGrailsJarVersion(String jarPath, final String jarRegex, String manifestPath) { try { File[] jars = GroovyUtils.getFilesInDirectoryByPattern(jarPath, jarRegex); if (jars.length != 1) { return null; } JarFile jarFile = new JarFile(jars[0]); JarEntry jarEntry = jarFile.getJarEntry(manifestPath); if (jarEntry == null) { return null; } Manifest manifest = new Manifest(jarFile.getInputStream(jarEntry)); return manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION); } catch (Exception e) { return null; } } public static Library[] getGroovyLibraries() { Condition<Library> condition = new Condition<Library>() { public boolean value(Library library) { return isGroovySdkLibrary(library); } }; return LibrariesUtil.getLibraries(condition); } public static String[] getGroovyLibNames() { return LibrariesUtil.getLibNames(getGroovyLibraries()); } public static boolean isGroovySdkLibrary(Library library) { return library != null && library.getName() != null && library.getName().matches(GROOVY_LIB_PATTERN); } @Nullable public static String getGroovyLibVersion(Library library) { return getGroovyVersion(LibrariesUtil.getGroovyOrGrailsLibraryHome(library)); } public static GroovySDK[] getGroovySDKs() { return ContainerUtil.map2Array(getGroovyLibraries(), GroovySDK.class, new Function<Library, GroovySDK>() { public GroovySDK fun(final Library library) { return new GroovySDK(library); } }); } public static void updateGroovyLibInModule(@NotNull Module module, @Nullable GroovySDK sdk) { ModuleRootManager manager = ModuleRootManager.getInstance(module); ModifiableRootModel model = manager.getModifiableModel(); removeGroovyLibrariesFormModule(model); if (sdk == null || sdk.getLibrary() == null) { model.commit(); return; } saveGroovyDefaultLibName(sdk.getLibraryName()); Library newLib = sdk.getLibrary(); LibraryOrderEntry addedEntry = model.addLibraryEntry(newLib); LibrariesUtil.placeEntryToCorrectPlace(model, addedEntry); model.commit(); } public static void removeGroovyLibrariesFormModule(ModifiableRootModel model) { OrderEntry[] entries = model.getOrderEntries(); for (OrderEntry entry : entries) { if (entry instanceof LibraryOrderEntry) { LibraryOrderEntry libEntry = (LibraryOrderEntry) entry; Library library = libEntry.getLibrary(); if (isGroovySdkLibrary(library)) { model.removeOrderEntry(entry); } } } } public static Library[] getGroovyLibrariesByModule(final Module module) { final Condition<Library> condition = new Condition<Library>() { public boolean value(Library library) { return isGroovySdkLibrary(library); } }; return LibrariesUtil.getLibrariesByCondition(module, condition); } public static ValidationResult isGroovySdkHome(String path) { if (path != null) { final VirtualFile relativeFile = VfsUtil.findRelativeFile(path, null); if (relativeFile != null && GroovyConfigUtils.isGroovySdkHome(relativeFile)) { return ValidationResult.OK; } } return new ValidationResult(GroovyBundle.message("invalid.groovy.sdk.path.message")); } public static Library createGroovyLibrary(final String path, final String name, final @Nullable Project project, final boolean inModuleSettings) { if (project == null) return null; final Ref<Library> libRef = new Ref<Library>(); ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { Library library = createGroovyLibImmediately(path, name, project, inModuleSettings); libRef.set(library); } }); return libRef.get(); } private static Library createGroovyLibImmediately(String path, String name, Project project, boolean inModuleSettings) { String version = getGroovyVersion(path); String libName = name != null ? name : generateNewGroovyLibName(version); if (path.length() > 0) { // create library LibraryTable.ModifiableModel modifiableModel = null; Library library; if (inModuleSettings) { StructureConfigrableContext context = ModuleStructureConfigurable.getInstance(project).getContext(); LibraryTableModifiableModelProvider provider = context.createModifiableModelProvider(LibraryTablesRegistrar.APPLICATION_LEVEL, true); modifiableModel = provider.getModifiableModel(); library = modifiableModel.createLibrary(libName); } else { LibraryTable libTable = LibraryTablesRegistrar.getInstance().getLibraryTable(); library = libTable.getLibraryByName(libName); if (library == null) { library = LibraryUtil.createLibrary(libTable, libName); } } // fill library final Library.ModifiableModel model; if (inModuleSettings) { model = ((LibrariesModifiableModel) modifiableModel).getLibraryEditor(library).getModel(); } else { model = library.getModifiableModel(); } File srcRoot = new File(path + "/src/main"); if (srcRoot.exists()) { model.addRoot(VfsUtil.getUrlForLibraryRoot(srcRoot), OrderRootType.SOURCES); } File[] jars; File embeddableDir = new File(path + "/embeddable"); if (embeddableDir.exists()) { jars = embeddableDir.listFiles(); } else { jars = new File(path + "/lib").listFiles(); } if (jars != null) { for (File file : jars) { if (file.getName().endsWith(".jar")) { model.addRoot(VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES); } } } if (!inModuleSettings) { model.commit(); } return library; } return null; } public static String generateNewGroovyLibName(String version) { String prefix = GROOVY_LIB_PREFIX; return LibrariesUtil.generateNewLibraryName(version, prefix); } public static void saveGroovyDefaultLibName(String name) { GroovyApplicationSettings settings = GroovyApplicationSettings.getInstance(); if (!UNDEFINED_VERSION.equals(name)) { settings.DEFAULT_GROOVY_LIB_NAME = name; } } @Nullable public static String getGroovyDefaultLibName() { GroovyApplicationSettings settings = GroovyApplicationSettings.getInstance(); return settings.DEFAULT_GROOVY_LIB_NAME; } public static Library createLibFirstTime(String baseName) { LibraryTable libTable = LibraryTablesRegistrar.getInstance().getLibraryTable(); Library library = libTable.getLibraryByName(baseName); if (library == null) { library = LibraryUtil.createLibrary(libTable, baseName); } return library; } public static void removeOldRoots(Library.ModifiableModel model) { for (OrderRootType type : OrderRootType.ALL_TYPES) for (String url : model.getUrls(type)) model.removeRoot(url, type); } public static Collection<String> getGroovyVersions() { return ContainerUtil.map2List(getGroovyLibraries(), new Function<Library, String>() { public String fun(Library library) { return getGroovyLibVersion(library); } }); } public static boolean isGroovyConfigured(Module module) { return module != null && getGroovyLibrariesByModule(module).length > 0 || GrailsConfigUtils.isGrailsConfigured(module); } @NotNull public static String getGroovyInstallPath(Module module) { if (module == null) return ""; Library[] libraries = getGroovyLibrariesByModule(module); if (libraries.length == 0) return ""; Library library = libraries[0]; return LibrariesUtil.getGroovyOrGrailsLibraryHome(library); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
7f8e150e699eaa3db29023590535fd5a1144f8e5
bdd99fcebf6031214f94139e39370eef71773c23
/repository/src/main/java/org/cradle/repository/BasicRowMapper.java
322c875669ddc5db54278eaf04c93d5951b437b8
[ "Apache-2.0" ]
permissive
mcraken/platform
7b8b3c1e10c673cc189e54282b45982469979c73
f98161d8aeeb81528fcbd6b0224aefa3573c2c52
refs/heads/master
2016-09-05T14:34:15.309179
2015-05-27T06:59:19
2015-05-27T06:59:19
29,773,123
24
10
null
null
null
null
UTF-8
Java
false
false
1,310
java
/** * Copyright mcplissken. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.cradle.repository; /** * @author Sherief Shawky * @email mcrakens@gmail.com * @date Jan 26, 2015 */ public abstract class BasicRowMapper<T> { private ModelRepository repository; private String modelName; private String target; /** * @param target the target to set */ public void setTarget(String target) { this.target = target; } public void setRepository(ModelRepository repository) { this.repository = repository; } public void setModelName(String modelName) { this.modelName = modelName; } public void init() throws UnknowRepositoryTargetException{ repository.registerMapper(target, modelName, this); } public abstract T map(RowAdapter row); }
[ "mcrakens@gmail.com" ]
mcrakens@gmail.com
b7a3df701f616dbf3517fd0ecfc8543f4fc38360
4d5e3e4c89645df4a3f161c6d7da5dd808b8cfa7
/app/src/test/java/com/example/root/inventoryappstage1/ExampleUnitTest.java
69ee8b6845a82e705c2cb7850a6f96c6414eb147
[]
no_license
izorkus/InventoryAppStage1
2e6e9f3052d747b8a62db8f58aac85333329b409
2505da8b87b47c9b14b0c59a9bb97d12627066d7
refs/heads/master
2020-03-20T16:12:49.222616
2018-06-15T21:20:27
2018-06-15T21:20:27
137,532,888
0
0
null
null
null
null
UTF-8
Java
false
false
396
java
package com.example.root.inventoryappstage1; 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); } }
[ "izorkus@gmail.com" ]
izorkus@gmail.com
ba0689f69e03fffc2edde567a168e574422410eb
c10a9915acdc6d3905f0b48e4d61c2fc8c2ec7a3
/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectionRegistrarImpl.java
40cc878acb70a1ffbea73372696cbb18644501ad
[ "Apache-2.0" ]
permissive
xylo/intellij-community
9f861f76a82ba4493d568e76f2e21a943e9f9d71
7553f42b992bc364205beef7f7f145a51cff4dff
refs/heads/master
2021-01-11T18:41:59.062042
2017-12-04T10:47:30
2017-12-04T10:47:30
79,597,067
0
0
null
2017-01-20T20:49:29
2017-01-20T20:49:29
null
UTF-8
Java
false
false
27,955
java
/* * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.psi.impl.source.tree.injected; import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator; import com.intellij.injected.editor.DocumentWindow; import com.intellij.injected.editor.VirtualFileWindow; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; import com.intellij.lang.LanguageParserDefinitions; import com.intellij.lang.ParserDefinition; import com.intellij.lang.injection.MultiHostRegistrar; import com.intellij.lexer.Lexer; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.impl.DebugUtil; import com.intellij.psi.impl.DocumentCommitThread; import com.intellij.psi.impl.PsiDocumentManagerBase; import com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl; import com.intellij.psi.impl.source.PsiFileImpl; import com.intellij.psi.impl.source.resolve.FileContextUtil; import com.intellij.psi.impl.source.text.BlockSupportImpl; import com.intellij.psi.impl.source.text.DiffLog; import com.intellij.psi.impl.source.tree.FileElement; import com.intellij.psi.impl.source.tree.LeafElement; import com.intellij.psi.impl.source.tree.TreeElement; import com.intellij.psi.impl.source.tree.TreeUtil; import com.intellij.psi.injection.ReferenceInjector; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtilCore; import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.PathUtil; import com.intellij.util.SmartList; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; class InjectionRegistrarImpl extends MultiHostRegistrarImpl implements MultiHostRegistrar, ModificationTracker { private List<Pair<Place, PsiFile>> result; private Language myLanguage; private List<LiteralTextEscaper<? extends PsiLanguageInjectionHost>> escapers; private List<PsiLanguageInjectionHost.Shred> shreds; private StringBuilder outChars; private boolean isOneLineEditor; private boolean cleared; private String fileExtension; private final Project myProject; private final PsiManager myPsiManager; private final DocumentEx myHostDocument; private final VirtualFile myHostVirtualFile; private final PsiElement myContextElement; private final PsiFile myHostPsiFile; private ReferenceInjector myReferenceInjector; InjectionRegistrarImpl(@NotNull Project project, @NotNull PsiFile hostPsiFile, @NotNull PsiElement contextElement) { myProject = project; myContextElement = contextElement; myHostPsiFile = PsiUtilCore.getTemplateLanguageFile(hostPsiFile); myPsiManager = myHostPsiFile.getManager(); cleared = true; FileViewProvider viewProvider = myHostPsiFile.getViewProvider(); myHostVirtualFile = viewProvider.getVirtualFile(); myHostDocument = (DocumentEx)viewProvider.getDocument(); } @Nullable("null means nobody cared to call .doneInjecting()") public List<Pair<Place, PsiFile>> getResult() { return result; } @NotNull @Override public MultiHostRegistrar startInjecting(@NotNull Language language) { return startInjecting(language, null); } @NotNull @Override public MultiHostRegistrar startInjecting(@NotNull Language language, @Nullable String extension) { fileExtension = extension; escapers = new SmartList<>(); shreds = new SmartList<>(); outChars = new StringBuilder(); if (!cleared) { clear(); throw new IllegalStateException("Seems you haven't called doneInjecting()"); } if (LanguageParserDefinitions.INSTANCE.forLanguage(language) == null) { throw new UnsupportedOperationException("Cannot inject language '" + language + "' because it has no ParserDefinition"); } myLanguage = language; return this; } private void clear() { escapers.clear(); shreds.clear(); outChars.setLength(0); isOneLineEditor = false; fileExtension = null; myLanguage = null; cleared = true; } @Override @NotNull public MultiHostRegistrar addPlace(@NonNls @Nullable String prefix, @NonNls @Nullable String suffix, @NotNull PsiLanguageInjectionHost host, @NotNull TextRange rangeInsideHost) { PsiFile containingFile = PsiUtilCore.getTemplateLanguageFile(host); assert containingFile == myHostPsiFile : exceptionContext("Trying to inject into foreign file: "+containingFile); TextRange hostTextRange = host.getTextRange(); if (!hostTextRange.contains(rangeInsideHost.shiftRight(hostTextRange.getStartOffset()))) { clear(); throw new IllegalArgumentException("rangeInsideHost must lie within host text range. rangeInsideHost:"+rangeInsideHost+"; host textRange:"+ hostTextRange); } if (myLanguage == null && myReferenceInjector == null) { clear(); throw new IllegalStateException("Seems you haven't called startInjecting()"); } if (prefix == null) prefix = ""; if (suffix == null) suffix = ""; cleared = false; int startOffset = outChars.length(); outChars.append(prefix); LiteralTextEscaper<? extends PsiLanguageInjectionHost> textEscaper = host.createLiteralTextEscaper(); escapers.add(textEscaper); isOneLineEditor |= textEscaper.isOneLine(); TextRange relevantRange = textEscaper.getRelevantTextRange().intersection(rangeInsideHost); if (relevantRange == null) { relevantRange = TextRange.from(textEscaper.getRelevantTextRange().getStartOffset(), 0); } else { int before = outChars.length(); boolean result = textEscaper.decode(relevantRange, outChars); int after = outChars.length(); assert after >= before : "Escaper " + textEscaper + "("+textEscaper.getClass()+") must not mangle char buffer"; if (!result) { // if there are invalid chars, adjust the range int offsetInHost = textEscaper.getOffsetInHost(outChars.length() - before, rangeInsideHost); relevantRange = relevantRange.intersection(new ProperTextRange(0, offsetInHost)); } } outChars.append(suffix); int endOffset = outChars.length(); TextRange relevantRangeInHost = relevantRange.shiftRight(hostTextRange.getStartOffset()); SmartPointerManagerImpl manager = (SmartPointerManagerImpl)SmartPointerManager.getInstance(myProject); shreds.add(new ShredImpl(manager.createSmartPsiFileRangePointer(myHostPsiFile, relevantRangeInHost, true), manager.createSmartPsiElementPointer(host, myHostPsiFile, true), prefix, suffix, new ProperTextRange(startOffset, endOffset), false)); return this; } @Override public void doneInjecting() { try { if (shreds.isEmpty()) { throw new IllegalStateException("Seems you haven't called addPlace()"); } if (myReferenceInjector != null) { addToResults(new Place(shreds), null); return; } PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject); Place place = new Place(shreds); DocumentWindowImpl documentWindow = new DocumentWindowImpl(myHostDocument, isOneLineEditor, place); String fileName = PathUtil.makeFileName(myHostVirtualFile.getName(), fileExtension); VirtualFileWindowImpl virtualFile = new VirtualFileWindowImpl(fileName, myHostVirtualFile, documentWindow, myLanguage, outChars); Language forcedLanguage = myContextElement.getUserData(InjectedFileViewProvider.LANGUAGE_FOR_INJECTED_COPY_KEY); myLanguage = forcedLanguage == null ? LanguageSubstitutors.INSTANCE.substituteLanguage(myLanguage, virtualFile, myProject) : forcedLanguage; createDocument(virtualFile); InjectedFileViewProvider viewProvider = new InjectedFileViewProvider(myPsiManager, virtualFile, documentWindow, myLanguage); ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(myLanguage); assert parserDefinition != null : "Parser definition for language "+myLanguage+" is null"; PsiFile psiFile = parserDefinition.createFile(viewProvider); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = ((ShredImpl)shreds.get(0)).getSmartPointer(); synchronized (InjectedLanguageManagerImpl.ourInjectionPsiLock) { final ASTNode parsedNode = keepTreeFromChameleoningBack(psiFile); assert parsedNode instanceof FileElement : "Parsed to "+parsedNode+" instead of FileElement"; String documentText = documentManager.getLastCommittedDocument(documentWindow).getText(); assert ((FileElement)parsedNode).textMatches(outChars) : exceptionContext("Before patch: doc:\n'" + documentText + "'\n---PSI:\n'" + parsedNode.getText() + "'\n---chars:\n'"+outChars+"'"); viewProvider.setPatchingLeaves(true); try { patchLeaves(parsedNode, escapers, place); } catch (ProcessCanceledException e) { throw e; } catch (RuntimeException e) { throw new RuntimeException(exceptionContext("Patch error"), e); } finally { viewProvider.setPatchingLeaves(false); } if (!((FileElement)parsedNode).textMatches(documentText)) { throw new AssertionError(exceptionContext("After patch: doc:\n'" + documentText + "'\n---PSI:\n'" + parsedNode.getText() + "'\n---chars:\n'" + outChars + "'")); } virtualFile.setContent(null, documentWindow.getText(), false); virtualFile.setWritable(virtualFile.getDelegate().isWritable()); cacheEverything(place, documentWindow, viewProvider, psiFile, pointer); PsiFile cachedPsiFile = documentManager.getCachedPsiFile(documentWindow); assert cachedPsiFile == psiFile : "Cached psi :"+ cachedPsiFile +" instead of "+psiFile; assert place.isValid(); assert viewProvider.isValid(); PsiFile newFile = registerDocument(documentWindow, psiFile, place, myHostPsiFile, documentManager); boolean mergeHappened = newFile != psiFile; if (mergeHappened) { InjectedLanguageUtil.clearCaches(psiFile, documentWindow); psiFile = newFile; viewProvider = (InjectedFileViewProvider)psiFile.getViewProvider(); documentWindow = (DocumentWindowImpl)viewProvider.getDocument(); virtualFile = (VirtualFileWindowImpl)viewProvider.getVirtualFile(); boolean shredsRewritten = cacheEverything(place, documentWindow, viewProvider, psiFile, pointer); if (!shredsRewritten) { place.dispose(); place = documentWindow.getShreds(); } } assert psiFile.isValid(); assert place.isValid(); assert viewProvider.isValid(); try { List<Trinity<IElementType, SmartPsiElementPointer<PsiLanguageInjectionHost>, TextRange>> tokens = obtainHighlightTokensFromLexer(myLanguage, outChars, escapers, place, virtualFile, myProject); psiFile.putUserData(InjectedLanguageUtil.HIGHLIGHT_TOKENS, tokens); } catch (ProcessCanceledException e) { throw e; } catch (RuntimeException e) { throw new RuntimeException(exceptionContext("Obtaining tokens error"), e); } addToResults(place, psiFile); assertEverythingIsAllright(documentManager, documentWindow, psiFile); } } finally { clear(); } } public void injectReference(@NotNull Language language, @NotNull String prefix, @NotNull String suffix, @NotNull PsiLanguageInjectionHost host, @NotNull TextRange rangeInsideHost) { ParserDefinition parser = LanguageParserDefinitions.INSTANCE.forLanguage(language); if (parser != null) { throw new IllegalArgumentException("Language "+language+" being injected as reference must not have ParserDefinition and yet - "+parser); } ReferenceInjector injector = ReferenceInjector.findById(language.getID()); if (injector == null) { throw new IllegalArgumentException("Language "+language+" being injected as reference must register reference injector"); } escapers = new SmartList<>(); shreds = new SmartList<>(); outChars = new StringBuilder(); if (!cleared) { clear(); throw new IllegalStateException("Seems you haven't called doneInjecting()"); } myReferenceInjector = injector; myLanguage = language; addPlace(prefix, suffix, host, rangeInsideHost); doneInjecting(); } private static void createDocument(@NotNull LightVirtualFile virtualFile) { CharSequence content = virtualFile.getContent(); DocumentImpl document = new DocumentImpl(content, StringUtil.indexOf(content, '\r') >= 0, false); FileDocumentManagerImpl.registerDocument(document, virtualFile); } // returns true if shreds were set, false if old ones were reused private static boolean cacheEverything(@NotNull Place place, @NotNull DocumentWindowImpl documentWindow, @NotNull InjectedFileViewProvider viewProvider, @NotNull PsiFile psiFile, @NotNull SmartPsiElementPointer<PsiLanguageInjectionHost> pointer) { FileDocumentManagerImpl.registerDocument(documentWindow, viewProvider.getVirtualFile()); DebugUtil.startPsiModification("MultiHostRegistrar cacheEverything"); try { viewProvider.forceCachedPsi(psiFile); } finally { DebugUtil.finishPsiModification(); } psiFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, pointer); ((PsiDocumentManagerBase)PsiDocumentManager.getInstance(psiFile.getProject())).associatePsi(documentWindow, psiFile); keepTreeFromChameleoningBack(psiFile); return viewProvider.setShreds(place, psiFile.getProject()); } @NonNls private String exceptionContext(@NonNls String msg) { return msg + ".\n" + myLanguage+";\n "+ "Host file: "+myHostPsiFile+" in '" + myHostVirtualFile.getPresentableUrl() + "'" + (PsiDocumentManager.getInstance(myProject).isUncommited(myHostDocument) ? " (uncommitted)": "")+ "\n" + "Context element "+myContextElement.getTextRange() + ": '" + myContextElement +"'; "+ "Ranges: "+shreds; } private static final Key<ASTNode> TREE_HARD_REF = Key.create("TREE_HARD_REF"); private static ASTNode keepTreeFromChameleoningBack(PsiFile psiFile) { // need to keep tree reachable to avoid being garbage-collected (via WeakReference in PsiFileImpl) // and then being reparsed from wrong (escaped) document content ASTNode node = psiFile.getNode(); // expand chameleons ASTNode child = node.getFirstChildNode(); assert !TreeUtil.isCollapsedChameleon(node) : "Chameleon "+node+" is collapsed; file: "+psiFile+"; language: "+psiFile.getLanguage(); psiFile.putUserData(TREE_HARD_REF, node); // just to use child variable if (child == null) { assert node != null; } return node; } private void assertEverythingIsAllright(PsiDocumentManagerBase documentManager, DocumentWindowImpl documentWindow, PsiFile psiFile) { boolean isAncestor = false; for (PsiLanguageInjectionHost.Shred shred : shreds) { PsiLanguageInjectionHost host = shred.getHost(); isAncestor |= PsiTreeUtil.isAncestor(myContextElement, host, false); } assert isAncestor : exceptionContext(myContextElement + " must be the parent of at least one of injection hosts"); InjectedFileViewProvider injectedFileViewProvider = (InjectedFileViewProvider)psiFile.getViewProvider(); assert injectedFileViewProvider.isValid() : "Invalid view provider: "+injectedFileViewProvider; DocumentEx frozenWindow = documentManager.getLastCommittedDocument(documentWindow); assert psiFile.textMatches(frozenWindow.getText()) : "Document window text mismatch"; assert injectedFileViewProvider.getDocument() == documentWindow : "Provider document mismatch"; assert documentManager.getCachedDocument(psiFile) == documentWindow : "Cached document mismatch"; assert Comparing.equal(psiFile.getVirtualFile(), injectedFileViewProvider.getVirtualFile()) : "Virtual file mismatch: " + psiFile.getVirtualFile() + "; " + injectedFileViewProvider.getVirtualFile(); PsiDocumentManagerBase.checkConsistency(psiFile, frozenWindow); } void addToResults(@NotNull Place place, @Nullable /*WAT?*/PsiFile psiFile, @NotNull InjectionRegistrarImpl from) { addToResults(place, psiFile); myReferenceInjector = from.myReferenceInjector; } private void addToResults(@NotNull Place place, @Nullable /*WAT?*/PsiFile psiFile) { if (result == null) { result = new SmartList<>(); } result.add(Pair.create(place, psiFile)); } private static void patchLeaves(@NotNull ASTNode parsedNode, @NotNull List<LiteralTextEscaper<? extends PsiLanguageInjectionHost>> escapers, @NotNull Place shreds) { LeafPatcher patcher = new LeafPatcher(shreds, escapers); ((TreeElement)parsedNode).acceptTree(patcher); assert ((TreeElement)parsedNode).textMatches(patcher.catLeafs) : "Malformed PSI structure: leaf texts do not add up to the whole file text." + "\nFile text (from tree) :'"+parsedNode.getText()+"'" + "\nFile text (from PSI) :'"+parsedNode.getPsi().getText()+"'" + "\nLeaf texts concatenated:'"+ patcher.catLeafs +"';" + "\nFile root: "+parsedNode+ "\nLanguage: "+parsedNode.getPsi().getLanguage()+ "\nHost file: "+ shreds.getHostPointer().getVirtualFile() ; DebugUtil.startPsiModification("injection leaf patching"); try { for (Map.Entry<LeafElement, String> entry : patcher.newTexts.entrySet()) { LeafElement leaf = entry.getKey(); String newText = entry.getValue(); leaf.rawReplaceWithText(newText); } } finally { DebugUtil.finishPsiModification(); } TreeUtil.clearCaches((TreeElement)parsedNode); } // under InjectedLanguageManagerImpl.ourInjectionPsiLock @NotNull private static PsiFile registerDocument(@NotNull DocumentWindowImpl newDocumentWindow, @NotNull PsiFile newInjectedPsi, @NotNull Place shreds, @NotNull PsiFile hostPsiFile, @NotNull PsiDocumentManager documentManager) { List<DocumentWindow> injected = InjectedLanguageUtil.getCachedInjectedDocuments(hostPsiFile); for (int i = injected.size()-1; i>=0; i--) { DocumentWindowImpl oldDocument = (DocumentWindowImpl)injected.get(i); final PsiFileImpl oldFile = (PsiFileImpl)documentManager.getCachedPsiFile(oldDocument); FileViewProvider viewProvider; if (oldFile == null || !oldFile.isValid() || !((viewProvider = oldFile.getViewProvider()) instanceof InjectedFileViewProvider) || ((InjectedFileViewProvider)viewProvider).isDisposed() ) { injected.remove(i); Disposer.dispose(oldDocument); continue; } final ASTNode newInjectedNode = newInjectedPsi.getNode(); final ASTNode oldFileNode = oldFile.getNode(); assert newInjectedNode != null : "New node is null"; if (oldDocument.areRangesEqual(newDocumentWindow)) { if (oldFile.getFileType() != newInjectedPsi.getFileType() || oldFile.getLanguage() != newInjectedPsi.getLanguage()) { injected.remove(i); Disposer.dispose(oldDocument); continue; } oldFile.putUserData(FileContextUtil.INJECTED_IN_ELEMENT, newInjectedPsi.getUserData(FileContextUtil.INJECTED_IN_ELEMENT)); assert shreds.isValid(); mergePsi(oldFile, oldFileNode, newInjectedPsi, newInjectedNode); assert shreds.isValid(); return oldFile; } else if (intersect(oldDocument, newDocumentWindow)) { injected.remove(i); // injected fragments should not overlap. In the End, there can be only one. } } injected.add(newDocumentWindow); return newInjectedPsi; } private static void mergePsi(@NotNull PsiFileImpl oldFile, @NotNull ASTNode oldFileNode, @NotNull PsiFile injectedPsi, @NotNull ASTNode injectedNode) { if (!oldFile.textMatches(injectedPsi)) { InjectedFileViewProvider oldViewProvider = (InjectedFileViewProvider)oldFile.getViewProvider(); oldViewProvider.performNonPhysically(() -> { DebugUtil.startPsiModification("injected tree diff"); try { final DiffLog diffLog = BlockSupportImpl.mergeTrees(oldFile, oldFileNode, injectedNode, new DaemonProgressIndicator(), oldFileNode.getText()); DocumentCommitThread.doActualPsiChange(oldFile, diffLog); } finally { DebugUtil.finishPsiModification(); } }); } } private static boolean intersect(DocumentWindowImpl doc1, DocumentWindowImpl doc2) { Segment[] hostRanges1 = doc1.getHostRanges(); Segment[] hostRanges2 = doc2.getHostRanges(); // DocumentWindowImpl.getHostRanges() may theoretically return non-sorted ranges for (Segment segment1 : hostRanges1) { for (Segment segment2 : hostRanges2) { if (Math.max(segment1.getStartOffset(), segment2.getStartOffset()) < Math.min(segment1.getEndOffset(), segment2.getEndOffset())) { return true; } } } return false; } // returns lexer element types with corresponding ranges in encoded (injection host based) PSI private static List<Trinity<IElementType, SmartPsiElementPointer<PsiLanguageInjectionHost>, TextRange>> obtainHighlightTokensFromLexer(Language language, StringBuilder outChars, List<LiteralTextEscaper<? extends PsiLanguageInjectionHost>> escapers, Place shreds, VirtualFileWindow virtualFile, Project project) { SyntaxHighlighter syntaxHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, (VirtualFile)virtualFile); Lexer lexer = syntaxHighlighter.getHighlightingLexer(); lexer.start(outChars); int hostNum = -1; int prevHostEndOffset = 0; SmartPsiElementPointer<PsiLanguageInjectionHost> host = null; LiteralTextEscaper<? extends PsiLanguageInjectionHost> escaper = null; int prefixLength = 0; int suffixLength = 0; TextRange rangeInsideHost = null; int shredEndOffset = -1; List<Trinity<IElementType, SmartPsiElementPointer<PsiLanguageInjectionHost>, TextRange>> tokens = new ArrayList<>(10); for (IElementType tokenType = lexer.getTokenType(); tokenType != null; lexer.advance(), tokenType = lexer.getTokenType()) { TextRange range = new ProperTextRange(lexer.getTokenStart(), lexer.getTokenEnd()); while (range != null && !range.isEmpty()) { if (range.getStartOffset() >= shredEndOffset) { hostNum++; PsiLanguageInjectionHost.Shred shred = shreds.get(hostNum); shredEndOffset = shred.getRange().getEndOffset(); prevHostEndOffset = range.getStartOffset(); host = ((ShredImpl)shred).getSmartPointer(); escaper = escapers.get(hostNum); rangeInsideHost = shred.getRangeInsideHost(); prefixLength = shred.getPrefix().length(); suffixLength = shred.getSuffix().length(); } //in prefix/suffix or spills over to next fragment if (range.getStartOffset() < prevHostEndOffset + prefixLength) { range = new UnfairTextRange(prevHostEndOffset + prefixLength, range.getEndOffset()); } TextRange spilled = null; if (range.getEndOffset() > shredEndOffset - suffixLength) { spilled = new UnfairTextRange(shredEndOffset, range.getEndOffset()); range = new UnfairTextRange(range.getStartOffset(), shredEndOffset-suffixLength); } if (!range.isEmpty()) { int start = escaper.getOffsetInHost(range.getStartOffset() - prevHostEndOffset - prefixLength, rangeInsideHost); if (start == -1) start = rangeInsideHost.getStartOffset(); int end = escaper.getOffsetInHost(range.getEndOffset() - prevHostEndOffset - prefixLength, rangeInsideHost); if (end == -1) { end = rangeInsideHost.getEndOffset(); prevHostEndOffset = shredEndOffset; } TextRange rangeInHost = new ProperTextRange(start, end); tokens.add(Trinity.create(tokenType, host, rangeInHost)); } range = spilled; } } return tokens; } // for CachedValue @Override public long getModificationCount() { List<PsiLanguageInjectionHost.Shred> shredList = shreds; if (shredList != null) { for (PsiLanguageInjectionHost.Shred shred : shredList) { if (!shred.isValid()) return -1; } } DocumentEx hostDocument = myHostDocument; return hostDocument == null ? -1 : hostDocument.getModificationStamp(); } @Override public String toString() { return String.valueOf(result); } // performance: avoid context.getContainingFile() @NotNull PsiFile getHostPsiFile() { return myHostPsiFile; } ReferenceInjector getReferenceInjector() { return myReferenceInjector; } boolean isValid() { List<Pair<Place, PsiFile>> result = getResult(); if (result == null) return false; for (Pair<Place, PsiFile> pair : result) { if (!pair.getFirst().isValid()) return false; } return true; } }
[ "cdr@intellij.com" ]
cdr@intellij.com
adccd190e04d658d48e27e50874c9ddd2e8c4e3f
42f39db65e2c493678a95d30be4dcb1127a2c521
/fundacionbancomerextranetwebback/src/main/java/com/bbva/arq/front/spring/mgbf/fundacionbancomerextranetwebback/DepositQueryBack.java
f23f006cb0a4532b398b1ffb9a9b80dfa323d4d4
[]
no_license
GitHubBrackets/Fundaci-nBBVAF2
5cebc97254de1442b3e3e9e4f02266efc19d70e2
c9cb3924bb84f3c6058cf34d375fe5f657842ef4
refs/heads/master
2020-03-23T00:41:19.416282
2018-07-24T22:15:13
2018-07-24T22:15:13
140,879,052
0
0
null
null
null
null
UTF-8
Java
false
false
740
java
package com.bbva.arq.front.spring.mgbf.fundacionbancomerextranetwebback; import javax.servlet.http.HttpServletRequest; import org.springframework.http.ResponseEntity; import com.bbva.arq.front.spring.mgbf.fundacionbancomerextranetwebdto.DepositQueryInDTO; /** * Interface DepositQueryBack. * Contains depositQueryArmed method. * * @author Diego Espinoza * @version 28 november 2017 */ public interface DepositQueryBack { /** * * Method depositQueryArmed * @return ResponseEntity<?> value as parameter. * * @param DepositQueryInDTO beanScholarIn * @param HttpServletRequest request * */ public ResponseEntity<?> depositQueryArmed(DepositQueryInDTO beanScholarIn, HttpServletRequest request); }
[ "diego.bolanios@gmail.com" ]
diego.bolanios@gmail.com
0b35bb2f0053c5e593e3c992e8258fb9439cd543
6a0730360dc3a6f6f7325ba558d35356589ac3fb
/third.java
d3a03d46c110ba981810474c8020773fea128268
[]
no_license
ishika612/sample
b3c163ecc545a4e9468387e1c5f82b7aeb35f745
002710a3a760b521cf7f39289db6d18cab9798a4
refs/heads/master
2021-02-18T07:04:20.997475
2020-03-05T13:44:32
2020-03-05T13:44:32
245,173,185
0
0
null
null
null
null
UTF-8
Java
false
false
27
java
System.out.println ("Hi!");
[ "jishika@bu.edu" ]
jishika@bu.edu
f4be05c89d3a9c6034d43c80c8ff3b04db134ce6
e0da2644f734f7cd6ec40efd766ae2c56a586194
/DaMing/app/src/main/java/com/example/daming_text/tuzhiwenjian.java
6b523bbcdcb2bbce06e750764bb7d2b9bf417824
[]
no_license
aa992131860aa/androidgit
192e473d8871fa33ba76604631a9105d77bdf953
32cd0f705cf1330e1f7e1af4852b8cb1ff231740
refs/heads/master
2020-06-15T23:15:08.965453
2016-12-01T08:19:55
2016-12-01T08:19:55
75,259,467
0
0
null
null
null
null
UTF-8
Java
false
false
3,730
java
package com.example.daming_text; import java.io.File; import com.daming.entity.Chanpjswj; import com.daming.entity.Chanpjyjl; import com.daming.entity.TongZi; import com.daming.util.RequestDataUtil; import com.lidroid.xutils.HttpUtils; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.exception.HttpException; import com.lidroid.xutils.http.ResponseInfo; import com.lidroid.xutils.http.callback.RequestCallBack; import com.squareup.picasso.Picasso; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.view.Window; import android.widget.AdapterView; import android.widget.Toast; public class tuzhiwenjian extends Activity { private String mIp; private String mUserName; private String mUserPwd; private String scrq; private String cpdm; private String test; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tuzhiwenjian); ViewUtils.inject(this); init(); new ChanpjswjTask().execute(); } private void init() { // TODO Auto-generated method stub mIp = getIntent().getStringExtra("ip"); mUserName = getIntent().getStringExtra("username"); mUserPwd = getIntent().getStringExtra("userpwd"); scrq = getIntent().getStringExtra("scrq"); cpdm = getIntent().getStringExtra("cpdm1"); } /** * 异步加载历史信息 * * @author Administrator * */ private class ChanpjswjTask extends AsyncTask<Void, Void, Chanpjswj> { @Override protected Chanpjswj doInBackground(Void... arg0) { return loadChanpjswj(); } @Override protected void onPostExecute(Chanpjswj result) { // TODO Auto-generated method stub super.onPostExecute(result); if(result!=null&&result.getSrc_tzwj()!=null&&!result.getSrc_tzwj().equals("")){ String src = result.getSrc_tzwj(); int lastOf = src.lastIndexOf("/"); String srcPdf = src.substring(lastOf, src.length()); final String targe = TongZiActivity.getDiskCacheDir(tuzhiwenjian.this)+srcPdf; new HttpUtils().download(result.getSrc_tzwj(), targe, new RequestCallBack<File>() { @Override public void onSuccess(ResponseInfo<File> arg0) { // TODO Auto-generated method stub //showDocument(Uri.fromFile(new File(targe))); Uri path = Uri.fromFile(new File(targe)); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, "application/pdf"); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //startActivity(intent); startActivityForResult(intent, 100); } @Override public void onFailure(HttpException arg0, String arg1) { } }); }else{ Toast.makeText(tuzhiwenjian.this, "没有文件", 0).show(); finish(); } } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); finish(); } /** * 加载培训内容数据 * * @return */ private Chanpjswj loadChanpjswj() { String param = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"no\"?><root> <data> <param> <cpdm>" + cpdm + "</cpdm></param></data></root>"; String method_name = "GetChanpjswj"; String data = RequestDataUtil.callCommonMethod(mUserName, mUserPwd, param, method_name, mIp); if (!data.equals("")) { // Log.e("chanx", data); data = RequestDataUtil.splieRequestXml(data); return RequestDataUtil.parseChanpjswj(data); } else { return null; } } }
[ "992131860@qq.com" ]
992131860@qq.com
42a680ac11abb93f4c66203b305fc965c1a73af3
8253bae8fc27e66764166308390b19c2745d263e
/src/com/ecollege/android/view/HeaderView.java
099ad93a341e3f240d9a913d8198da904caf3e85
[ "Apache-2.0" ]
permissive
math4youbyusgroupillinois/mobile2-android
4c75fd898d5e928827a890e83fd5245514eed2fa
3835e60c487fa3c4a0b9dd198de039cddd7e39bf
refs/heads/master
2021-01-15T08:40:56.563788
2015-01-10T10:14:37
2015-01-10T10:14:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,091
java
package com.ecollege.android.view; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.widget.FrameLayout; import android.widget.ProgressBar; import com.ecollege.android.ECollegeApplication; import com.ecollege.android.R; public class HeaderView extends FrameLayout { private final ProgressBar busyIndicator; public HeaderView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public HeaderView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); LayoutInflater.from(context).inflate(R.layout.header_view, this, true); ECollegeApplication app = (ECollegeApplication)context.getApplicationContext(); if (app != null) { app.registerHeaderView(this); } busyIndicator = (ProgressBar) findViewById(R.id.busy_indicator); } public void setProgressVisibility(boolean visible) { if (busyIndicator != null) busyIndicator.setVisibility(visible ? VISIBLE : INVISIBLE); } }
[ "zachary.pinter@effectiveui.com" ]
zachary.pinter@effectiveui.com
774ddf0d023ea74e1e92e3b8a0fb03f5bef1af2e
c26304a54824faa7c1b34bb7882ee7a335a8e7fb
/flink-filesystems/flink-azure-fs-hadoop/src/main/java/org/apache/flink/fs/azurefs/EnvironmentVariableKeyProvider.java
9c981d376d39aef400f1d54aa9c0f35447d95a4e
[ "BSD-3-Clause", "OFL-1.1", "ISC", "MIT", "Apache-2.0" ]
permissive
apache/flink
905e0709de6389fc9212a7c48a82669706c70b4a
fbef3c22757a2352145599487beb84e02aaeb389
refs/heads/master
2023-09-04T08:11:07.253750
2023-09-04T01:33:25
2023-09-04T01:33:25
20,587,599
23,573
14,781
Apache-2.0
2023-09-14T21:49:04
2014-06-07T07:00:10
Java
UTF-8
Java
false
false
1,892
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.fs.azurefs; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.azure.KeyProvider; import org.apache.hadoop.fs.azure.KeyProviderException; /** * An implementation of {@link org.apache.hadoop.fs.azure.KeyProvider}, which reads the Azure * storage key from an environment variable named "AZURE_STORAGE_KEY". */ public class EnvironmentVariableKeyProvider implements KeyProvider { public static final String AZURE_STORAGE_KEY_ENV_VARIABLE = "AZURE_STORAGE_KEY"; @Override public String getStorageAccountKey(final String s, final Configuration configuration) throws KeyProviderException { String azureStorageKey = System.getenv(AZURE_STORAGE_KEY_ENV_VARIABLE); if (azureStorageKey != null) { return azureStorageKey; } else { throw new KeyProviderException( "Unable to retrieve Azure storage key from environment. \"" + AZURE_STORAGE_KEY_ENV_VARIABLE + "\" not set."); } } }
[ "sewen@apache.org" ]
sewen@apache.org
0f82fff0821d401396d32095003da2f5e3c895d0
738ff74d3424805fba13c46aa51924b522b497d6
/VendingMachine/VendingMachineV2.java
e314bf391d7fb86ce04c0b9ddac993d1aa7c5430
[]
no_license
abhishekgupta368/LLD-designs
c8e50cd6bda0e7e9dd0d9281431ebe5cf26bb703
0b85fc7a9dcd82f56da9f7f47d583c79c6fb6403
refs/heads/main
2023-03-27T23:42:25.081502
2021-03-19T05:20:33
2021-03-19T05:20:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,894
java
// A Different Kind of Implementation for Vending Machine.. // You need to get you head Around OOD Design Stuff. // You will have a State Interface and Rest all States will implement // Try to always code to Interfaces or Abstraction.. // Some of the DisAdvantages of the State Design Pattern is Each State with a function needs // To know which Next state it needs to go.. public interface VendingMachineState { public void collectCash(int cash); public void dispenseChange(String productCode); public void dispenseItem(String productCode); public void cancelTransaction(); } // Even the States Which Implemented the State Interface can Do the State Transition Too.. // Four States Defined.. Ready ,DispenseChange, DispenseItem, TransactionCancelled. public class DispenseChange implements VendingMachineState { private VendingMachine vendingMachine; public DispenseChange(VendingMachine vendingMachine) { this.vendingMachine = vendingMachine; } @Override public void collectCash(int cash) { throw new RunTimeException("State :: DispenseChange, Unable to Collect Cash"); } @Override public void dispenseChange(String productCode) { int change = vendingMachine.calculateChange(productCode); System.out.println("Change :: " + change + " -- Returned"); this.vendingMachine.setState(new DispenseItem(vendingMachine)); this.vendingMachine.dispenseItem(productCode); } @Override public void dispenseItem(String productCode) { throw new RunTimeException("State :: DispenseChange, Unable to Dispense Item"); } @Override public void cancelTransaction() { throw new RunTimeException("State :: DispenseChange, Unable to cancelTransaction"); } } public class DispenseItem implements VendingMachineState { private VendingMachine vendingMachine; public DispenseItem(VendingMachine vendingMachine) { this.vendingMachine = vendingMachine; } @Override public void collectCash(int cash) { throw new RunTimeException("State :: DispenseItem, Unable to Collect Cash"); } @Override public void dispenseChange(String productCode) { throw new RunTimeException("State :: DispenseItem, Unable to Dispense Change"); } @Override public void dispenseItem(String productCode) { this.vendingMachine.removeProduct(productCode); System.out.println("Dispensing Item :: " + productCode); this.vendingMachine.setState(new Ready(this.vendingMachine)); } @Override public void cancelTransaction() { throw new RunTimeException("State :: DispenseItem, Unable to cancelTransaction"); } } public class Ready implements VendingMachineState { private VendingMachine vendingMachine; public Ready(VendingMachine vendingMachine) { this.vendingMachine = vendingMachine; } @Override public void collectCash(int cash) { this.vendingMachine.addCollectedCash(cash); } @Override public void dispenseChange(String productCode) { this.vendingMachine.setState(new DispenseChange(this.vendingMachine)); this.vendingMachine.dispenseChange(productCode); } @Override public void dispenseItem(String productCode) { throw new RunTimeException("State :: Ready, Unable to Dispense Item"); } @Override public void cancelTransaction() { this.vendingMachine.setState(new TransactionCancelled(this.vendingMachine)); this.vendingMachine.cancelTransaction(); } } public class TransactionCancelled implements VendingMachineState { private VendingMachine vendingMachine; public Ready(VendingMachine vendingMachine) { this.vendingMachine = vendingMachine; } @Override public void collectCash(int cash) { throw new RunTimeException("State :: TransactionCancelled, Unable to collect cash"); } @Override public void dispenseChange(String productCode) { throw new RunTimeException("State :: TransactionCancelled, Unable to dispense Change"); } @Override public void dispenseItem(String productCode) { throw new RunTimeException("State :: TransactionCancelled, Unable to dispense Item"); } @Override public void cancelTransaction() { System.out.println("Cash Returned.. :: " + this.vendingMachine.getCollectedCash()); this.vendingMachine.setCollectedCash(0); this.vendingMachine.setState(new Ready(this.vendingMachine); } } // You can Implement it or can Leave it Just a normal class public class VendingMachine implements VendingMachineState { private int collectedCash; private State state; private Map<String, Set<String>> productCodeItemMap; private Map<String, Integer> productCodePriceMap; @Override public void collectCash(int collectedCash) { this.collectedCash += collectedCash; } public VendingMachine setCollectedCash(int collectedCash) { this.collectedCash = collectedCash; return this; } public State getState() { return state; } public VendingMachine setState(State state) { this.state = state; return this; } public void removeProduct(String productCode) { } @Override public void dispenseChange(String productCode) { this.state.dispenseChange(productCode); } @Override public void cancelTransaction() { this.state.cancelTransaction(); } public int calculateChange(String productCode) { return collectedCash - productCodePriceMap.get(productCode); } @Override public void dispenseItem(String productCode) { this.state.dispenseItem(productCode); } public int getCollectedCash() { return collectedCash; } }
[ "swargaa@88665a13cfe8.ant.amazon.com" ]
swargaa@88665a13cfe8.ant.amazon.com
400e1a4449475eb0d9184ecf7095386984b0688f
9dce6a8569b94277307b6adabd70a8cd6780dc92
/appointment-requests-service/src/main/java/com/fcg/bookings/service/AppointmentRequestsService.java
8566c8d076591746eefdeac0a1f4116b6c11932a
[]
no_license
gcfederico/bookings
53a6196c9deddc2d62938c669b735470e707b94c
24e1d1dcec2a8c1ed9de8e152934dc22de485074
refs/heads/main
2023-05-23T23:54:04.104971
2021-06-27T03:12:23
2021-06-27T03:12:23
380,637,132
0
0
null
null
null
null
UTF-8
Java
false
false
2,664
java
package com.fcg.bookings.service; import static java.util.Objects.isNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.fcg.bookings.model.AppointmentRequest; import com.fcg.bookings.model.AppointmentRequestState; import com.fcg.bookings.repository.AppointmentRequestsRepository; @Service public class AppointmentRequestsService implements IAppointmentRequestsService { private AppointmentRequestsRepository appointmentsRepository; @Autowired public AppointmentRequestsService(AppointmentRequestsRepository appointmentsRepository) { this.appointmentsRepository = appointmentsRepository; } @Override public AppointmentRequest create(AppointmentRequest appointment) { var newAppointment = new AppointmentRequest( appointment.getStartDate(), appointment.getClientId(), appointment.getServiceProviderId(), appointment.getScheduleId()); if (!isNull(appointment.getEstimatedEndDate())) { newAppointment.setEstimatedEndDate(appointment.getEstimatedEndDate()); } return appointmentsRepository.save(newAppointment); } @Override public AppointmentRequest accept(AppointmentRequest appointment) { var appointmentRequest = appointmentsRepository.findById(appointment.getId()) .orElseThrow(); appointmentRequest.setCurrentState(AppointmentRequestState.ACCEPTED); return appointmentsRepository.save(appointmentRequest); } @Override public AppointmentRequest reschedule(AppointmentRequest appointment) { var appointmentRequest = appointmentsRepository.findById(appointment.getId()) .orElseThrow(); var startDate = appointment.getStartDate(); if (!appointmentRequest.getStartDate().equals(startDate)) { appointmentRequest.setCurrentState(AppointmentRequestState.RESCHEDULED); appointmentRequest.setStartDate(startDate); appointmentRequest.setEstimatedEndDate(appointment.getEstimatedEndDate()); } return appointmentsRepository.save(appointmentRequest); } @Override public AppointmentRequest cancel(AppointmentRequest appointment) { var appointmentRequest = appointmentsRepository.findById(appointment.getId()) .orElseThrow(); appointmentRequest.setCurrentState(AppointmentRequestState.CANCELED); return appointmentsRepository.save(appointmentRequest); } @Override public AppointmentRequest reject(AppointmentRequest appointment) { var appointmentRequest = appointmentsRepository.findById(appointment.getId()) .orElseThrow(); appointmentRequest.setCurrentState(AppointmentRequestState.REJECTED); return appointmentsRepository.save(appointmentRequest); } }
[ "fede@pop-os.localdomain" ]
fede@pop-os.localdomain
fbc4ebbcaf52c7f9de2a84d9e84c16726dc15fd9
1637b0f1477b09540434eefed6091ef6a490e42e
/src/main/java/org/tomitribe/jkta/repos/Project.java
abb2b9a19061d677deba75e5b3821251d400b95f
[]
no_license
tomitribe/jkta
6c9a24464609835c922fa1c3bce3023ed9903886
29d3c47526ad018683109df4c38dab662394e48c
refs/heads/master
2022-07-23T18:11:59.659910
2021-04-06T02:45:11
2021-04-06T02:45:11
189,473,135
1
3
null
2022-07-15T21:08:39
2019-05-30T19:49:06
Java
UTF-8
Java
false
false
4,361
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.tomitribe.jkta.repos; import org.tomitribe.util.Join; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; public class Project implements Comparable<Project>{ private final File dir; private final List<Source> sources; public Project(final File dir, final List<Source> sources) { this.dir = dir; this.sources = sources; } @Override public int compareTo(final Project o) { return this.dir.getName().compareTo(o.dir.getName()); } public File getDir() { return dir; } public List<Source> getSources() { return sources; } public List<String> getClasses() { return sources.stream() .map(Source::getClassName) .distinct() .sorted() .collect(Collectors.toList()); } public List<String> getPackages() { return sources.stream() .map(Source::getPackageName) .distinct() .sorted() .collect(Collectors.toList()); } public List<String> getShortPackages() { final List<String> list = new ArrayList<String>(getPackages()); final List<String> strings = new ArrayList<>(list); for (final String string : strings) { final Iterator<String> iterator = list.iterator(); while (iterator.hasNext()) { final String value = iterator.next(); if (value.equals(string)) continue; if (value.startsWith(string)) iterator.remove(); } } Collections.sort(list); return list; } public List<String> getNonstandardImports() { return sources.stream() .map(Source::getImports) .flatMap(Collection::stream) .sorted() .collect(Collectors.toList()); } public String getStatus() { if (getClassesCount() == 0) return "other"; if (getNonstandardImportsCount() == 0) return "api"; return "api-impl"; } public static Project parse(final File dir) { final List<Source> sources = Javax.getJavaxFiles(dir) .stream() .filter(Paths::isMain) .filter(file -> !file.getName().equals("module-info.java")) .filter(file -> !file.getName().equals("package-info.java")) .map(Source::parse) .filter(Source::isJavax) .collect(Collectors.toList()); return new Project(dir, sources); } @Override public String toString() { return "Project{" + "name=" + getName() + ", javax=[" + getPackageList() + "]" + ", classes=" + getClassesCount() + ", packages=" + getPackagesCount() + (getNonstandardImportsCount() > 0 ? ", nonportable=" + getNonstandardImportsCount() : "") + '}'; } public String getName() { return dir.getName(); } public String getPackageList() { return Join.join(", ", getShortPackages()); } public int getNonstandardImportsCount() { return getNonstandardImports().size(); } public int getPackagesCount() { return getPackages().size(); } public int getClassesCount() { return getClasses().size(); } }
[ "david.blevins@gmail.com" ]
david.blevins@gmail.com
11a744874fb0f50b4e07e7e3b77d5bd2374756c1
b9847599b78d0911ddb88cee319e93d84d494910
/jboss-ejb-core-src/org/jboss/ejb3/stateful/StatefulContainerInvocation.java
6d29138ba1f207a1a998ecb2b0db3d59e56d0950
[]
no_license
haaappy/ReconstructionWithClassLoader
9f72f80a213ec9798883196d4479a4f9b3716a3b
76197d3ab2617e193fbd5fa7aff7e394188d23c1
refs/heads/master
2021-01-23T18:08:18.058581
2015-06-02T06:50:29
2015-06-02T06:50:29
35,587,405
0
0
null
null
null
null
UTF-8
Java
false
false
2,570
java
/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.ejb3.stateful; import java.lang.reflect.Method; import org.jboss.aop.Advisor; import org.jboss.aop.MethodInfo; import org.jboss.aop.advice.Interceptor; import org.jboss.aop.joinpoint.Invocation; import org.jboss.ejb3.EJBContainerInvocation; /** * Comment * * @author <a href="mailto:bill@jboss.org">Bill Burke</a> * @version $Revision: 71938 $ */ public class StatefulContainerInvocation extends EJBContainerInvocation<StatefulContainer, StatefulBeanContext> { private static final long serialVersionUID = -7636489066612082373L; private Object id; public StatefulContainerInvocation(Interceptor[] interceptors, long methodHash, Method advisedMethod, Method unadvisedMethod, Advisor advisor, Object id) { super(interceptors, methodHash, advisedMethod, unadvisedMethod, advisor); this.id = id; } public StatefulContainerInvocation(MethodInfo info, Object id) { super(info); this.id = id; } public StatefulContainerInvocation() { } public Object getId() { return id; } public Invocation copy() { StatefulContainerInvocation wrapper = new StatefulContainerInvocation(interceptors, methodHash, advisedMethod, unadvisedMethod, advisor, id); wrapper.metadata = this.metadata; wrapper.currentInterceptor = this.currentInterceptor; //wrapper.setTargetObject(this.getTargetObject()); wrapper.setArguments(this.getArguments()); wrapper.setBeanContext(getBeanContext()); return wrapper; } }
[ "frj@frj-OptiPlex-780.(none)" ]
frj@frj-OptiPlex-780.(none)
7fd1f1935a2dfcf8165a7207d50f72e99e6d355d
2a050607f970392a3b1368b6f552d059672440dd
/src/view/JanelaDespesasNovas.java
d4b8268861c39467f41f5aa32c4580de4b445f0e
[]
no_license
gabrielgregh1/BallonEasySystem
cdcfa0ecfb8a2d0f3a36eda2911fe6f97e62aefa
a2b5d996c7dad6c6a35f3ad256d32bcb6bdd81c3
refs/heads/master
2020-03-27T01:32:34.088505
2018-08-22T14:26:59
2018-08-22T14:26:59
145,720,553
0
0
null
null
null
null
UTF-8
Java
false
false
26,165
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 view; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.text.SimpleDateFormat; import java.util.Date; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import model.bean.Despesas; import model.dao.DespesasDAO; /** * * @author gabri */ public class JanelaDespesasNovas extends javax.swing.JDialog { /** * Creates new form JanelaDespesasNovas */ public JanelaDespesasNovas(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); condicoesIniciais(); // setExtendedState(JFrame.MAXIMIZED_BOTH); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); this.setBounds(0, 0, screenSize.width, screenSize.height); } private double transformaDouble(String campo){ String campoReal = campo; int achou ; do{ achou = campoReal.indexOf("."); if(achou != -1) campoReal = campoReal.substring(0, achou)+campoReal.substring(achou+1); else break; }while(true); int id = campoReal.indexOf(","); campoReal = campoReal.substring(0, id)+"."+campoReal.substring(id+1); double campoDouble = Double.parseDouble(campoReal); return campoDouble; } private String transformaReais(Double campo){ String campoReal = String.valueOf(campo); int id = campoReal.indexOf("."); campoReal = campoReal.substring(0, id)+","+campoReal.substring(id+1); int colocaPonto = id - 1; int ponto = 2; while(colocaPonto > 0){ if(colocaPonto - 2 > 0){ campoReal = campoReal.substring(0, colocaPonto - ponto)+"."+campoReal.substring(colocaPonto - ponto); }else break; colocaPonto -= 3; } return campoReal; } private void atalhos(KeyEvent evt){ if(evt.getKeyCode() == KeyEvent.VK_F12) this.dispose(); if(evt.getKeyCode() == KeyEvent.VK_ENTER) ConfirmarDespesas(); } private void condicoesIniciais(){ //OBTER DATA ATUAL PELO JAVA Date dataAtual = new Date(); SimpleDateFormat formatador = new SimpleDateFormat("yyyy/MM/dd"); jLabelDia.setText(formatador.format( dataAtual )); //CONFIGURAR JTABLE DespesasDAO dao = new DespesasDAO(); DefaultTableModel model = (DefaultTableModel) jTableDespesas.getModel(); while (jTableDespesas.getModel().getRowCount() > 0) model.removeRow(0); double total = 0; //CAPTURA O MES INFORMADO PELO JAVA QUEBRANDO POR SUBSTRING String mes = jLabelDia.getText(); mes = mes.substring(5, 7); for(Despesas d : dao.read(mes)){ String valorString = transformaReais(d.getValor()); int id = valorString.indexOf(","); if(valorString.length() == id+2) valorString += "0"; model.addRow(new Object[]{ d.getData(), d.getTipo(), d.getObservacao(), valorString, }); total += d.getValor(); } jLabelTotal.setText(String.valueOf(total)); } private void limparCampos(){ jTextFieldTipo.setText(""); jTextFieldObservacao.setText(""); jFormattedTextFieldDespesa.setText(""); } private void ConfirmarDespesas(){ try{ DespesasDAO dao = new DespesasDAO(); String tipo = jTextFieldTipo.getText(); String obs = jTextFieldObservacao.getText(); double valor = transformaDouble(jFormattedTextFieldDespesa.getText()); Despesas des = new Despesas(tipo, obs, valor); dao.create(des); condicoesIniciais(); limparCampos(); }catch(NumberFormatException ex){ JOptionPane.showMessageDialog(rootPane, "Informe o valor da Despesa"); jFormattedTextFieldDespesa.setText(""); } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabelEsstatisticas = new javax.swing.JLabel(); jLabeIcon = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabelDia = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTextFieldTipo = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); jTableDespesas = new javax.swing.JTable(); jTextFieldObservacao = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jButtonConfimar = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jLabelTotal = new javax.swing.JLabel(); jFormattedTextFieldDespesa = new javax.swing.JFormattedTextField(); jPanel2 = new javax.swing.JPanel(); jLabelBalao = new javax.swing.JLabel(); jLabelBallom = new javax.swing.JLabel(); jLabeSair = new javax.swing.JLabel(); jLabeSair1 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setUndecorated(true); jLabelEsstatisticas.setFont(new java.awt.Font("Trebuchet MS", 1, 24)); // NOI18N jLabelEsstatisticas.setForeground(new java.awt.Color(0, 153, 255)); jLabelEsstatisticas.setText("Despesas Mensais"); jLabeIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_azul/iconsGastos_80px.png"))); // NOI18N jPanel1.setBackground(new java.awt.Color(0, 153, 255)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 37, Short.MAX_VALUE) ); jPanel3.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jPanel3KeyPressed(evt); } }); jLabel1.setFont(new java.awt.Font("Trebuchet MS", 2, 14)); // NOI18N jLabel1.setForeground(new java.awt.Color(0, 153, 255)); jLabel1.setText("DIA: "); jLabelDia.setFont(new java.awt.Font("Trebuchet MS", 2, 14)); // NOI18N jLabelDia.setForeground(new java.awt.Color(0, 153, 255)); jLabelDia.setText("000-00-00"); jLabel2.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jLabel2.setForeground(new java.awt.Color(51, 51, 51)); jLabel2.setText("Típo da Dispesa: "); jTextFieldTipo.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jTextFieldTipo.setForeground(new java.awt.Color(51, 51, 51)); jTextFieldTipo.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTextFieldTipoKeyPressed(evt); } }); jLabel3.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jLabel3.setForeground(new java.awt.Color(51, 51, 51)); jLabel3.setText("Valor da Dispesa:"); jTableDespesas.setFont(new java.awt.Font("Trebuchet MS", 2, 14)); // NOI18N jTableDespesas.setForeground(new java.awt.Color(51, 51, 51)); jTableDespesas.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Data", "Tipo da Dispesa", "Observação", "Valor" } )); jScrollPane1.setViewportView(jTableDespesas); jTextFieldObservacao.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jTextFieldObservacao.setForeground(new java.awt.Color(51, 51, 51)); jTextFieldObservacao.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jTextFieldObservacaoKeyPressed(evt); } }); jLabel4.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jLabel4.setForeground(new java.awt.Color(51, 51, 51)); jLabel4.setText("Observação: "); jButtonConfimar.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jButtonConfimar.setText("Confirmar"); jButtonConfimar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonConfimarActionPerformed(evt); } }); jButtonConfimar.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { jButtonConfimarKeyPressed(evt); } }); jLabel5.setFont(new java.awt.Font("Trebuchet MS", 2, 16)); // NOI18N jLabel5.setForeground(new java.awt.Color(0, 153, 255)); jLabel5.setText("Díspesas do Mês"); jLabelTotal.setFont(new java.awt.Font("Trebuchet MS", 2, 16)); // NOI18N jLabelTotal.setForeground(new java.awt.Color(0, 153, 255)); jLabelTotal.setText("00,00"); jFormattedTextFieldDespesa.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00")))); jFormattedTextFieldDespesa.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jFormattedTextFieldDespesa, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(9, 9, 9) .addComponent(jButtonConfimar, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel4) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextFieldTipo, javax.swing.GroupLayout.PREFERRED_SIZE, 506, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextFieldObservacao, javax.swing.GroupLayout.PREFERRED_SIZE, 506, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelDia) .addGap(29, 29, 29)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelTotal) .addGap(36, 36, 36)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabelDia)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(jTextFieldTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(jTextFieldObservacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jButtonConfimar) .addComponent(jFormattedTextFieldDespesa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(30, 30, 30) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jLabelTotal)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2.setBackground(new java.awt.Color(0, 153, 255)); jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 153, 255))); jLabelBalao.setFont(new java.awt.Font("Trebuchet MS", 0, 14)); // NOI18N jLabelBalao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_azul/iconBalloon_80px.png"))); // NOI18N jLabelBallom.setFont(new java.awt.Font("Trebuchet MS", 1, 24)); // NOI18N jLabelBallom.setForeground(new java.awt.Color(255, 255, 255)); jLabelBallom.setText("BALLOON"); jLabeSair.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N jLabeSair.setForeground(new java.awt.Color(255, 255, 255)); jLabeSair.setText("ENTER - Confirmar"); jLabeSair1.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N jLabeSair1.setForeground(new java.awt.Color(255, 255, 255)); jLabeSair1.setText("F12 - Sair"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(495, 495, 495) .addComponent(jLabeSair) .addGap(18, 18, 18) .addComponent(jLabeSair1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(356, 356, 356) .addComponent(jLabelBallom) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelBalao, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabelBalao, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addComponent(jLabelBallom, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addGap(11, 11, 11) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabeSair1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabeSair, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_azul/closeWindow_30 (2).png"))); // NOI18N jLabel6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel6MouseClicked(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabeIcon) .addGap(0, 0, 0) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabelEsstatisticas) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(8, 8, 8) .addComponent(jLabelEsstatisticas)) .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabeIcon)) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(29, 29, 29) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextFieldTipoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldTipoKeyPressed atalhos(evt); }//GEN-LAST:event_jTextFieldTipoKeyPressed private void jTextFieldObservacaoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldObservacaoKeyPressed atalhos(evt); }//GEN-LAST:event_jTextFieldObservacaoKeyPressed private void jButtonConfimarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfimarActionPerformed ConfirmarDespesas(); }//GEN-LAST:event_jButtonConfimarActionPerformed private void jButtonConfimarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jButtonConfimarKeyPressed atalhos(evt); }//GEN-LAST:event_jButtonConfimarKeyPressed private void jPanel3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jPanel3KeyPressed atalhos(evt); }//GEN-LAST:event_jPanel3KeyPressed private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked this.dispose(); }//GEN-LAST:event_jLabel6MouseClicked /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(JanelaDespesasNovas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JanelaDespesasNovas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JanelaDespesasNovas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JanelaDespesasNovas.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JanelaDespesasNovas dialog = new JanelaDespesasNovas(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButtonConfimar; private javax.swing.JFormattedTextField jFormattedTextFieldDespesa; private javax.swing.JLabel jLabeIcon; private javax.swing.JLabel jLabeSair; private javax.swing.JLabel jLabeSair1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabelBalao; private javax.swing.JLabel jLabelBallom; private javax.swing.JLabel jLabelDia; private javax.swing.JLabel jLabelEsstatisticas; private javax.swing.JLabel jLabelTotal; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTableDespesas; private javax.swing.JTextField jTextFieldObservacao; private javax.swing.JTextField jTextFieldTipo; // End of variables declaration//GEN-END:variables }
[ "32684089+gabrielgregh1@users.noreply.github.com" ]
32684089+gabrielgregh1@users.noreply.github.com
6ed08f0a6aa17877e0e553145e0798919b7d2dcd
36f9e609648a570b75612f093997702fa52567a2
/src/main/java/ru/muzafarov/test/cardirectory/service/CarService.java
15dc3d9ab9b07372f34969a918bb685ff814d20e
[]
no_license
Inkin88/CarDirectory
8fba16e2f7b4b6b7c6628426c8099a96434a3637
8700c09e952f86a7715e11401849703e325a02e1
refs/heads/master
2022-12-26T13:53:38.326252
2020-10-01T22:01:24
2020-10-01T22:01:24
298,061,582
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
package ru.muzafarov.test.cardirectory.service; import ru.muzafarov.test.cardirectory.dto.CarDto; import ru.muzafarov.test.cardirectory.exception.ValidationException; import java.util.List; public interface CarService { CarDto getById(Integer id); List<CarDto> getAll(); CarDto saveCar(CarDto car) throws ValidationException; void delete(Integer id); }
[ "inkin_88@mail.ru" ]
inkin_88@mail.ru
8b1bc74a056a82151f6bb9750a19d95039637800
a98f8067d2de0b5be7d8db8c7ce70c7e50cacb16
/src/robot/GyroDrive.java
1c120a76e5df90169f6baf829096002718dbec1a
[]
no_license
qwertpas/jos4
04702cac804ec3d6d38663e7326fbc1186c43502
0896302145bbc00873f53ebff42abde45fdf9a3e
refs/heads/master
2020-03-17T04:52:54.193600
2018-05-14T02:06:47
2018-05-14T02:06:47
133,292,371
0
0
null
null
null
null
UTF-8
Java
false
false
4,291
java
package robot; import lejos.hardware.Audio; import lejos.hardware.Button; import lejos.hardware.Key; import lejos.hardware.KeyListener; import lejos.hardware.ev3.EV3; import lejos.hardware.ev3.LocalEV3; import lejos.hardware.lcd.LCD; import lejos.hardware.motor.UnregulatedMotor; import lejos.hardware.port.MotorPort; import lejos.hardware.port.SensorPort; import lejos.hardware.sensor.EV3GyroSensor; import lejos.robotics.SampleProvider; import lejos.utility.Delay; public class GyroDrive { EV3 ev3 = null; private EV3GyroSensor gyro = null; private SampleProvider gyroSamples = null; private UnregulatedMotor leftMotor = null; private UnregulatedMotor rightMotor = null; private Audio audio = null; float[] angle = { 0.0f }; float gyroTacho = 0; public GyroDrive() { // register custom key listener Button.ESCAPE.addKeyListener(new KeyListener() { @Override public void keyPressed(Key k) { System.out.println("Bye..."); if (k.getId() == Button.ID_ESCAPE) { GyroDrive.this.exit(); } } @Override public void keyReleased(Key k) { } }); // write current angle on demand Button.DOWN.addKeyListener(new KeyListener() { @Override public void keyPressed(Key k) { if (k.getId() == Button.ID_DOWN) { System.out.println("Current angle:" + getGyroAngle()); } } @Override public void keyReleased(Key k) { } }); // reset gyro Button.UP.addKeyListener(new KeyListener() { @Override public void keyPressed(Key k) { if (k.getId() == Button.ID_UP) { resetGyro(); } } @Override public void keyReleased(Key k) { } }); } public void resetGyro() { if (gyro != null) { Delay.msDelay(1000); //wait until the hands are off the robot audio.systemSound(0); gyro.reset(); gyroSamples = gyro.getAngleMode(); gyroTacho = 0; System.out.println("Gyro is reset"); } } public void resetGyroTacho() { gyroTacho += getGyroAngle(); } public void init() { ev3 = LocalEV3.get(); audio = ev3.getAudio(); audio.systemSound(0); gyro = new EV3GyroSensor(SensorPort.S4); System.out.println("Gyro init"); leftMotor = new UnregulatedMotor(MotorPort.B); System.out.println("Left motor init"); rightMotor = new UnregulatedMotor(MotorPort.C); System.out.println("Right motor init"); gyroSamples = gyro.getAngleMode(); audio.systemSound(Audio.DOUBLE_BEEP); } public float getGyroAngleRaw() { gyroSamples.fetchSample(angle, 0); return angle[0]; } public float getGyroAngle() { float rawAngle = getGyroAngleRaw(); return rawAngle - gyroTacho; } public void exit() { if (audio != null) { audio.systemSound(2); } if (leftMotor != null) { leftMotor.stop(); leftMotor.close(); } if (rightMotor != null) { rightMotor.stop(); rightMotor.close(); } if (gyro != null) { gyro.close(); } System.exit(0); } public void run() { Delay.msDelay(500); LCD.clear(); while (true) { Button.ENTER.waitForPress(); LCD.clearDisplay(); System.out.println("Angle is " + angle[0]); leftMotor.setPower(50); rightMotor.setPower(50); //start turning right leftMotor.forward(); rightMotor.backward(); while (getGyroAngle() < 60) { System.out.println("Angle is " + angle[0]); } leftMotor.stop(); rightMotor.stop(); System.out.println("Angle is " + angle[0]); //wait until the robot is really stopped Delay.msDelay(100); audio.systemSound(0); resetGyroTacho(); } } public static void main(String[] args) { GyroDrive test = new GyroDrive(); test.init(); test.run(); test.exit(); } }
[ "christopher.y.x@gmail.com" ]
christopher.y.x@gmail.com
9092566279811524e89005d36a68a8ad7021b77a
d7da52233647b0ba55211aecf9eb33f0873882e5
/src/com/footballaigame/client/simulationentities/GameState.java
efc8705fe18a2799bf82a34f91805b08a3c41401
[]
no_license
pall-j/FootballAIGame.Client.Java
8ea20bca0e106ebb03f16db38510f4ebc6e20a08
98e184d516eea0de952d4ad8a738bcf70570d4a3
refs/heads/master
2021-06-16T16:03:13.450676
2017-05-13T22:20:41
2017-05-13T22:20:41
83,986,078
1
0
null
null
null
null
UTF-8
Java
false
false
2,649
java
package com.footballaigame.client.simulationentities; import com.footballaigame.client.customdatatypes.Vector; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; /** * Represents the state of the football match. */ public class GameState { /** * The football players' array consisting of 22 players, where first 11 * players are target the player's team and the other 11 players are target the opponent's team. */ public FootballPlayer[] footballPlayers; /** * The football ball. */ public FootballBall ball; /** * The simulation step number specifying to which simulation step this instance belongs. */ public int step; /** * The value indicating whether a kickoff is happening. */ public boolean kickOff; /** * Parses the specified binary representation of the game state. * * @param data The binary representation of the game state. * @return The parsed game state. * @throws IllegalArgumentException Thrown if an error has occurred while parsing the game state. */ public static GameState parse(byte[] data) throws IllegalArgumentException { float[] floatData = new float[92]; GameState state = new GameState(); int step; if (data.length != floatData.length * 4 + 4 + 1) throw new IllegalArgumentException("Invalid game state data."); state.kickOff = data[4] == 1; ByteBuffer byteBuffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN); step = byteBuffer.asIntBuffer().get(0); // parse step data = Arrays.copyOfRange(data, 5, data.length); byteBuffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN); byteBuffer.asFloatBuffer().get(floatData); // parse vectors FootballPlayer[] players = new FootballPlayer[22]; for (int i = 0; i < 22; i++) { players[i] = new FootballPlayer(i); } FootballBall ball = new FootballBall(); ball.position = new Vector(floatData[0], floatData[1]); ball.movement = new Vector(floatData[2], floatData[3]); for (int i = 0; i < 22; i++) { players[i].position = new Vector(floatData[4 + 4 * i], floatData[4 + 4 * i + 1]); players[i].movement = new Vector(floatData[4 + 4 * i + 2], floatData[4 + 4 * i + 3]); } state.ball = ball; state.footballPlayers = players; state.step = step; return state; } }
[ "serillan11@gmail.com" ]
serillan11@gmail.com
4867edf1ca8448bf2d5214bf22659166445b2561
c709af5a97ec676974e1a448e8f9ff8fa4d97a24
/src/com/amazonservices/mws/orders/_2013_09_01/model/ListOrdersByNextTokenResult.java
73e761c4a26316255df5651b112f71fffcfa979c
[]
no_license
PoRuiHuang/Amazon_Tumaz_Project
e20349ea765cc27a64241091571232aa2419d8e3
ab5151d4a9e17d0e088dea576183a9ad0abb1193
refs/heads/master
2021-04-24T03:40:56.262529
2021-04-21T08:08:03
2021-04-21T08:08:03
250,070,397
0
0
null
null
null
null
UTF-8
Java
false
false
7,416
java
/******************************************************************************* * Copyright 2009-2019 Amazon Services. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: http://aws.amazon.com/apache2.0 * 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. ******************************************************************************* * List Orders By Next Token Result * API Version: 2013-09-01 * Library Version: 2019-12-27 * Generated: Fri Dec 27 03:17:33 UTC 2019 */ package com.amazonservices.mws.orders._2013_09_01.model; import java.util.List; import java.util.ArrayList; import javax.xml.datatype.XMLGregorianCalendar; import com.amazonservices.mws.client.*; /** * ListOrdersByNextTokenResult complex type. * * XML schema: * * <pre> * &lt;complexType name="ListOrdersByNextTokenResult"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="NextToken" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt; * &lt;element name="CreatedBefore" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&gt; * &lt;element name="LastUpdatedBefore" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&gt; * &lt;element name="Orders" type="{https://mws.amazonservices.com/Orders/2013-09-01}Order" maxOccurs="unbounded"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> */ public class ListOrdersByNextTokenResult extends AbstractMwsObject { private String nextToken; private XMLGregorianCalendar createdBefore; private XMLGregorianCalendar lastUpdatedBefore; private List<Order> orders; /** * Get the value of NextToken. * * @return The value of NextToken. */ public String getNextToken() { return nextToken; } /** * Set the value of NextToken. * * @param nextToken * The new value to set. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * Check to see if NextToken is set. * * @return true if NextToken is set. */ public boolean isSetNextToken() { return nextToken != null; } /** * Set the value of NextToken, return this. * * @param nextToken * The new value to set. * * @return This instance. */ public ListOrdersByNextTokenResult withNextToken(String nextToken) { this.nextToken = nextToken; return this; } /** * Get the value of CreatedBefore. * * @return The value of CreatedBefore. */ public XMLGregorianCalendar getCreatedBefore() { return createdBefore; } /** * Set the value of CreatedBefore. * * @param createdBefore * The new value to set. */ public void setCreatedBefore(XMLGregorianCalendar createdBefore) { this.createdBefore = createdBefore; } /** * Check to see if CreatedBefore is set. * * @return true if CreatedBefore is set. */ public boolean isSetCreatedBefore() { return createdBefore != null; } /** * Set the value of CreatedBefore, return this. * * @param createdBefore * The new value to set. * * @return This instance. */ public ListOrdersByNextTokenResult withCreatedBefore(XMLGregorianCalendar createdBefore) { this.createdBefore = createdBefore; return this; } /** * Get the value of LastUpdatedBefore. * * @return The value of LastUpdatedBefore. */ public XMLGregorianCalendar getLastUpdatedBefore() { return lastUpdatedBefore; } /** * Set the value of LastUpdatedBefore. * * @param lastUpdatedBefore * The new value to set. */ public void setLastUpdatedBefore(XMLGregorianCalendar lastUpdatedBefore) { this.lastUpdatedBefore = lastUpdatedBefore; } /** * Check to see if LastUpdatedBefore is set. * * @return true if LastUpdatedBefore is set. */ public boolean isSetLastUpdatedBefore() { return lastUpdatedBefore != null; } /** * Set the value of LastUpdatedBefore, return this. * * @param lastUpdatedBefore * The new value to set. * * @return This instance. */ public ListOrdersByNextTokenResult withLastUpdatedBefore(XMLGregorianCalendar lastUpdatedBefore) { this.lastUpdatedBefore = lastUpdatedBefore; return this; } /** * Get the value of Orders. * * @return The value of Orders. */ public List<Order> getOrders() { if (orders==null) { orders = new ArrayList<Order>(); } return orders; } /** * Set the value of Orders. * * @param orders * The new value to set. */ public void setOrders(List<Order> orders) { this.orders = orders; } /** * Clear Orders. */ public void unsetOrders() { this.orders = null; } /** * Check to see if Orders is set. * * @return true if Orders is set. */ public boolean isSetOrders() { return orders != null && !orders.isEmpty(); } /** * Add values for Orders, return this. * * @param orders * New values to add. * * @return This instance. */ public ListOrdersByNextTokenResult withOrders(Order... values) { List<Order> list = getOrders(); for (Order value : values) { list.add(value); } return this; } /** * Read members from a MwsReader. * * @param r * The reader to read from. */ @Override public void readFragmentFrom(MwsReader r) { nextToken = r.read("NextToken", String.class); createdBefore = r.read("CreatedBefore", XMLGregorianCalendar.class); lastUpdatedBefore = r.read("LastUpdatedBefore", XMLGregorianCalendar.class); orders = r.readList("Orders", "Order", Order.class); } /** * Write members to a MwsWriter. * * @param w * The writer to write to. */ @Override public void writeFragmentTo(MwsWriter w) { w.write("NextToken", nextToken); w.write("CreatedBefore", createdBefore); w.write("LastUpdatedBefore", lastUpdatedBefore); w.writeList("Orders", "Order", orders); } /** * Write tag, xmlns and members to a MwsWriter. * * @param w * The Writer to write to. */ @Override public void writeTo(MwsWriter w) { w.write("https://mws.amazonservices.com/Orders/2013-09-01", "ListOrdersByNextTokenResult",this); } /** Default constructor. */ public ListOrdersByNextTokenResult() { super(); } }
[ "B06705027@ntu.edu.tw" ]
B06705027@ntu.edu.tw
68b32c39bdf6f9c74d0b8a80a211926ca315d12e
a75a9b7f09aacf7f6f9d869e0ff936560c5c4787
/app/src/main/java/org/nearbyshops/shopkeeperappnew/ModelEventBus/NotificationEvent.java
fb992b3c3c358a78e3778fdc16b465deb19edd78
[ "Apache-2.0" ]
permissive
WambuaSimon/Nearby-Shops-Shop-Owner-Android-app
e95041c9e2fcb5255e456e6f3c32811f8748ef67
f366ed43aa4af05e8f225da7e22605a621b18bfa
refs/heads/master
2020-06-22T00:20:42.960629
2019-07-06T11:00:56
2019-07-06T11:00:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package org.nearbyshops.shopkeeperappnew.ModelEventBus; public class NotificationEvent { private int notificationType; public NotificationEvent(int notificationType) { this.notificationType = notificationType; } public int getNotificationType() { return notificationType; } public void setNotificationType(int notificationType) { this.notificationType = notificationType; } }
[ "sumeet.0587@gmail.com" ]
sumeet.0587@gmail.com
9069206ec9fd98d4fe1f7f30b6cdebd035e4289e
d80a724c857dcf8ee6aad96986ab9849f52f2e32
/game/src/main/java/com/psych/game/config/SpringConfiguration.java
94deba2d038fdad54640f0d7cca5da470842511e
[]
no_license
suawasthi/psych-game
785929f64bd3d287effa52dd8bc3bfb01d0fa0f6
3b4a87b1999fbf8bbfae6611a62a5f81c2054ee5
refs/heads/master
2021-01-07T19:09:57.389358
2020-02-27T11:05:17
2020-02-27T11:05:17
241,792,515
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.psych.game.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class SpringConfiguration { @Bean public static ApplicationContxtProvider contextProvider() { return new ApplicationContxtProvider(); } }
[ "suawasthi@gmail.com" ]
suawasthi@gmail.com
a5144b35ee47bd653f8d4cac044c34d7de9b15dc
91cc93f18148ed3c19892054eb3a1a6fd1210842
/com/etsy/android/lib/models/shopedit/ShopEditDelegate.java
de2c4909718b7fe819a38ab66b25f1842ac57101
[]
no_license
zickieloox/EtsyAndroidApp
9a2729995fb3510d020b203de5cff5df8e73bcfe
5d9df4e7e639a6aebc10fe0dbde3b6169d074a84
refs/heads/master
2021-12-10T02:57:10.888170
2016-07-11T11:57:53
2016-07-11T11:57:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package com.etsy.android.lib.models.shopedit; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import com.etsy.android.lib.models.EditStructuredPoliciesShopContext; import com.etsy.android.lib.models.ShopAbout.Link; import com.etsy.android.lib.models.ShopAboutImage; import com.etsy.android.lib.models.ShopAboutMember; import com.etsy.android.lib.models.ShopAboutVideo; import com.etsy.android.lib.models.apiv3.FAQ; import com.etsy.android.lib.models.apiv3.Image; import com.etsy.android.lib.models.apiv3.SellerDetails; import com.etsy.android.lib.models.apiv3.StructuredShopPolicies; import com.etsy.android.lib.models.shopedit.switchrow.ShopEditVacationSwitchRow; import java.util.List; public interface ShopEditDelegate { void addAboutImage(); void addFaq(); void addLink(@NonNull List<Link> list); void addShopMember(); void editAboutImage(@NonNull ShopAboutImage shopAboutImage); void editBasicShopField(@NonNull String str, @StringRes int i, @NonNull String str2, @NonNull String str3); void editCoverPhoto(@Nullable Image image, int i); void editFaq(@Nullable FAQ faq); void editLink(@NonNull Link link, @NonNull List<Link> list); void editSellerDetails(@Nullable SellerDetails sellerDetails); void editShopIcon(@Nullable Image image); void editShopMember(@NonNull ShopAboutMember shopAboutMember); void editShopVideo(@Nullable ShopAboutVideo shopAboutVideo, @NonNull ShopVideoShareData shopVideoShareData); void editStructuredPolicies(@Nullable StructuredShopPolicies structuredShopPolicies, @NonNull EditStructuredPoliciesShopContext editStructuredPoliciesShopContext); void goToShopRearrange(); void reloadContent(); void toggleVacationSwitch(@NonNull ShopEditVacationSwitchRow shopEditVacationSwitchRow); }
[ "pink2mobydick@gmail.com" ]
pink2mobydick@gmail.com
f22bb515c00c074e92f23d2f82b54b6f0dc23b7b
5ec06dab1409d790496ce082dacb321392b32fe9
/clients/jaxrs-resteasy-eap/generated/src/gen/java/org/openapitools/model/ComDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties.java
0d6c463fe25816bdf1d4917affa81d6b1587436d
[ "Apache-2.0" ]
permissive
shinesolutions/swagger-aem-osgi
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
c2f6e076971d2592c1cbd3f70695c679e807396b
refs/heads/master
2022-10-29T13:07:40.422092
2021-04-09T07:46:03
2021-04-09T07:46:03
190,217,155
3
3
Apache-2.0
2022-10-05T03:26:20
2019-06-04T14:23:28
null
UTF-8
Java
false
false
3,091
java
package org.openapitools.model; import java.util.Objects; import java.util.ArrayList; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.ConfigNodePropertyArray; import org.openapitools.model.ConfigNodePropertyInteger; import javax.validation.constraints.*; import io.swagger.annotations.*; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyEapServerCodegen", date = "2019-08-05T01:00:05.540Z[GMT]") public class ComDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties { private ConfigNodePropertyArray allowedPaths = null; private ConfigNodePropertyInteger cqAnalyticsSaintExporterPagesize = null; /** **/ @ApiModelProperty(value = "") @JsonProperty("allowed.paths") public ConfigNodePropertyArray getAllowedPaths() { return allowedPaths; } public void setAllowedPaths(ConfigNodePropertyArray allowedPaths) { this.allowedPaths = allowedPaths; } /** **/ @ApiModelProperty(value = "") @JsonProperty("cq.analytics.saint.exporter.pagesize") public ConfigNodePropertyInteger getCqAnalyticsSaintExporterPagesize() { return cqAnalyticsSaintExporterPagesize; } public void setCqAnalyticsSaintExporterPagesize(ConfigNodePropertyInteger cqAnalyticsSaintExporterPagesize) { this.cqAnalyticsSaintExporterPagesize = cqAnalyticsSaintExporterPagesize; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ComDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties comDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties = (ComDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties) o; return Objects.equals(allowedPaths, comDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties.allowedPaths) && Objects.equals(cqAnalyticsSaintExporterPagesize, comDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties.cqAnalyticsSaintExporterPagesize); } @Override public int hashCode() { return Objects.hash(allowedPaths, cqAnalyticsSaintExporterPagesize); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ComDayCqAnalyticsSitecatalystImplExporterClassificationsExporteProperties {\n"); sb.append(" allowedPaths: ").append(toIndentedString(allowedPaths)).append("\n"); sb.append(" cqAnalyticsSaintExporterPagesize: ").append(toIndentedString(cqAnalyticsSaintExporterPagesize)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
[ "cliffano@gmail.com" ]
cliffano@gmail.com
7d0edd000adf1efc11af8b3a5fec22500917b953
af837a1dc76f646862d987006adf7e78ea534b04
/src/main/java/com/gsh/controller/TestController.java
0429f9d963bbee860c1cac1b272f31b50ba3db02
[]
no_license
gsh-go/Spring-Session
68750c25c5df89a8b42b93f79cde05f8790bd95a
8e68fb1692ca8b6cd5cbd86b7f97caaa51f2982e
refs/heads/master
2020-04-08T06:57:31.833776
2018-11-26T06:20:55
2018-11-26T06:20:55
159,120,497
0
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
package com.gsh.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.Map; /** * @Author: gsh * @Date: Created in 2018/11/26 13:35 * @Description: */ @RestController @RequestMapping(value = "/admin/v1") public class TestController { @RequestMapping(value = "/first", method = RequestMethod.GET) public Map<String, Object> firstResp (HttpServletRequest request){ Map<String, Object> map = new HashMap<>(); request.getSession().setAttribute("request Url", request.getRequestURL()); map.put("request Url", request.getRequestURL()); return map; } @RequestMapping(value = "/sessions", method = RequestMethod.GET) public Object sessions (HttpServletRequest request){ Map<String, Object> map = new HashMap<>(); map.put("sessionId", request.getSession().getId()); map.put("message", request.getSession().getAttribute("request Url")); return map; } }
[ "sihangong@163.com" ]
sihangong@163.com
91213f8a7735040388570beff107e992ee92b9d7
3f86a7e0136b20a8b0567a469c203af051ab3799
/app/src/test/java/com/example/utests/ExampleUnitTest.java
cde5ddbb05d1684199291de8feb87a0a324f616f
[]
no_license
abil97/Unit_and_UI_Tests
b92263b0e15d86a1d7e88d94b95e63f16c68b4bc
2fc4a905c365d23d648292c9ca0700b440558948
refs/heads/master
2021-02-13T20:10:28.212587
2020-03-03T19:55:21
2020-03-03T19:55:21
244,728,631
1
0
null
null
null
null
UTF-8
Java
false
false
1,412
java
package com.example.utests; 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); } @Test public void CorrectInput(){ assertTrue(MainActivity.checkCorrectInput("Abil")); assertTrue(MainActivity.checkCorrectInput("Somename")); assertTrue(MainActivity.checkCorrectInput("Hello")); assertTrue(MainActivity.checkCorrectInput("Foo")); assertTrue(MainActivity.checkCorrectInput("Dbshsiiueudw")); } public void IncorrectInput(){ assertFalse(MainActivity.checkCorrectInput("abil")); assertFalse(MainActivity.checkCorrectInput("aBiL")); assertFalse(MainActivity.checkCorrectInput("abiL")); assertFalse(MainActivity.checkCorrectInput("ABIL")); assertFalse(MainActivity.checkCorrectInput("abil_001")); assertFalse(MainActivity.checkCorrectInput("a1b2c3d4")); assertFalse(MainActivity.checkCorrectInput("a_b_i_l")); assertFalse(MainActivity.checkCorrectInput("AbiL")); assertFalse(MainActivity.checkCorrectInput("Abil009")); assertFalse(MainActivity.checkCorrectInput("Abil_001")); } }
[ "abil.kuatbayev@nu.edu.kz" ]
abil.kuatbayev@nu.edu.kz
42a868bb024318b32767e42e5748adaf3452c852
e138d9c0f26e85380a2cceb31085d455613f2009
/src/leetcode/E168.java
36212041beac594213b3ce57920601bbeffdedd6
[]
no_license
huiyuhao/leetcode
d6e61f3c3da1ada96b2e7c609dc7f42a7d4e69cc
c7f46b6369feaca31e03c8d3ff9bb00b98c226fc
refs/heads/master
2020-08-29T08:47:35.517295
2019-12-22T16:10:05
2019-12-22T16:10:05
217,985,765
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package leetcode; public class E168 { public String convertToTitle(int n) { char[] ch = new char[27]; ch[0] = 'Z'; for (int i = 1; i < ch.length; i++) { ch[i] = (char) ('A' + i - 1); } StringBuilder sb = new StringBuilder(); while (n != 0) { sb.append(ch[n % 26]); n = n % 26 == 0 ? n / 26 - 1 : n / 26; } sb.reverse(); return sb.toString(); } public static void main(String[] args) { E168 e168 = new E168(); System.out.println(e168.convertToTitle(53)); } }
[ "cv78619233@qq.com" ]
cv78619233@qq.com
6655378413f6abc72d710f749294cfe6aad94c49
49743d1b594284c18af9370e8907bcc7e66443ca
/nhotel/gwtui/gwtuisharedtypes/com/gwtmodel/table/binder/BinderWidgetAttributes.java
8d7e50f19353b017d4172405bdb7515c6c61fd33
[]
no_license
stanislawbartkowski/javahotel
1a06ce1eecc8508787be8fbcce697471d0c8d2b3
13f65d0fda5238dc5cb944aaa90c7275ce186ef9
refs/heads/master
2021-01-25T07:21:48.960529
2017-07-31T10:55:43
2017-07-31T10:55:43
34,128,037
2
2
null
null
null
null
UTF-8
Java
false
false
15,778
java
/* * Copyright 2017 stanislawbartkowski@gmail.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. */ package com.gwtmodel.table.binder; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import com.gwtmodel.table.common.ConvertTT; import com.gwtmodel.table.common.TT; public class BinderWidgetAttributes { private BinderWidgetAttributes() { } private static class A { final String name; final TT type; A(String name, TT type) { this.name = name; this.type = type; } A(String name) { this(name, TT.STRING); } public String getName() { return name; } public TT getType() { return type; } } private static Map<String, TT> oMap = Arrays .asList(new A(IAttrName.ATTRADDSTYLENAMES), new A(IAttrName.FIELDID), new A(IAttrName.ATTRSIZE), new A(IAttrName.ATTRPIXELSIZE), new A(IAttrName.ATTRHEIGHT), new A(IAttrName.ATTRSTYLENAME), new A(IAttrName.ATTRSTYLEPRIMARYNAME), new A(IAttrName.ATTRTITLE), new A(IAttrName.ATTRVISIBLE, TT.BOOLEAN), new A(IAttrName.ATTRWIDTH)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> polymerMap = Arrays .asList(new A(IAttrName.ATTRATRIBUTES), new A(IAttrName.ATTRBOOLEANATTRIBUTE), new A(IAttrName.ATTRID), new A(IAttrName.ATTRNAME), new A(IAttrName.ATTRNOINK, TT.BOOLEAN), new A(IAttrName.ATTRSTYLE), new A(IAttrName.ATTRTABINDEX, TT.INT), new A(IAttrName.ATTRCLASS), new A(IAttrName.ATTRARIALABEL)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> basebuttonMap = Arrays .asList(new A(IAttrName.ATTRFOCUSED, TT.BOOLEAN), new A(IAttrName.ATTRPOINTERDOWN, TT.BOOLEAN), new A(IAttrName.ATTRINVALID, TT.BOOLEAN), new A(IAttrName.ATTRPRESSED, TT.BOOLEAN), new A(IAttrName.ATTRTOGGLES, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> baseenterMap = Arrays .asList(new A(IAttrName.ATTRERRORMESSAGE), new A(IAttrName.ATTRDISABLED, TT.BOOLEAN), new A(IAttrName.ATTRINVALID, TT.BOOLEAN), new A(IAttrName.ATTRVALIDATOR), new A(IAttrName.ATTRVALIDATORTYPE), new A(IAttrName.ATTRVALUE)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> paperToastMap = Arrays .asList(new A(IAttrName.ATTRSETALWAYSONTOP, TT.BOOLEAN), new A(IAttrName.ATTRAUTOFITONATTACH, TT.BOOLEAN), new A(IAttrName.ATTRBACKDROPELEMENT), new A(IAttrName.ATTRCANCELED), new A(IAttrName.ATTRCLOSINGREASON), new A(IAttrName.ATTRDURATION, TT.BIGDECIMAL), new A(IAttrName.ATTRDYNAMICALLIGN, TT.BOOLEAN), new A(IAttrName.ATTRFITINFO), new A(IAttrName.ATTRHORIZONTALALIGN), new A(IAttrName.ATTRHORIZONTALOFFSET, TT.BIGDECIMAL), new A(IAttrName.ATTRNOAUTOFOCUS, TT.BOOLEAN), new A(IAttrName.ATTRNOCANCELONESCKEY, TT.BOOLEAN), new A(IAttrName.ATTRNOCANCELONOUTSIDECLICK, TT.BOOLEAN), new A(IAttrName.ATTRNOOVERLAP, TT.BOOLEAN), new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRPOSITIONTARGET), new A(IAttrName.ATTRRESTOREFOCUSONCLOSE, TT.BOOLEAN), new A(IAttrName.ATTRSIZINGTARGET), new A(IAttrName.ATTRTEXT), new A(IAttrName.ATTRVERTICALALIGN), new A(IAttrName.ATTRVETICALOFFSET, TT.BIGDECIMAL), new A(IAttrName.ATTRWITHBACKDROP, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> papertogglebuttontMap = Arrays.asList(new A(IAttrName.ATTRACTIVE, TT.BOOLEAN), new A(IAttrName.ATTRARIAACTIVEATTRIBUTE), new A(IAttrName.ATTRCHECKED, TT.BOOLEAN), new A(IAttrName.ATTRDISABLED, TT.BOOLEAN), new A(IAttrName.ATTRINVALID, TT.BOOLEAN), new A(IAttrName.ATTRKEYBINDINGS), new A(IAttrName.ATTRKEYEVENTTARGET), new A(IAttrName.ATTRRECEIVEDFOCUSFROMKEYBOARD, TT.BOOLEAN), new A(IAttrName.ATTRREQUIRED, TT.BOOLEAN), new A(IAttrName.ATTRSTOPKEYBORADFROMPROPAGATION, TT.BOOLEAN), new A(IAttrName.ATTRVALIDATOR), new A(IAttrName.ATTRVALIDATORTYPE), new A(IAttrName.ATTRVALUE)).stream() .collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> ironajaxMap = Arrays .asList(new A(IAttrName.ATTRACTIVEREQUESTS), new A(IAttrName.ATTRAUTO, TT.BOOLEAN), new A(IAttrName.ATTRBODY), new A(IAttrName.ATTRBUBBLES, TT.BOOLEAN), new A(IAttrName.ATTRDEBOUNCEDURATION), new A(IAttrName.ATTRCONTENTTYPE), new A(IAttrName.ATTRHANDLEAS), new A(IAttrName.ATTRHEADERS), new A(IAttrName.ATTRJSONPREFIX), new A(IAttrName.ATTRLASTERROR), new A(IAttrName.ATTRLASTREQUEST), new A(IAttrName.ATTRLASTRESPONSE), new A(IAttrName.ATTRLOADING, TT.BOOLEAN), new A(IAttrName.ATTRMETHOD), new A(IAttrName.ATTRPARAMS), new A(IAttrName.ATTRSYNC, TT.BOOLEAN), new A(IAttrName.ATTRTIMEOUT), new A(IAttrName.ATTRURL), new A(IAttrName.ATTRVERBOSE, TT.BOOLEAN), new A(IAttrName.ATTRWITHCREDENTIALS, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> ironcollapseMap = Arrays .asList(new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRHORIZONTAL, TT.BOOLEAN), new A(IAttrName.ATTRNOANIMATION, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> ironimageMap = Arrays .asList(new A(IAttrName.ATTRFADE, TT.BOOLEAN), new A(IAttrName.ATTRALT, TT.BOOLEAN), new A(IAttrName.ATTRERROR, TT.BOOLEAN), new A(IAttrName.ATTRHEIGHT), new A(IAttrName.ATTRLOADED, TT.BOOLEAN), new A(IAttrName.ATTRLOADING, TT.BOOLEAN), new A(IAttrName.ATTRPLACEHOLDER), new A(IAttrName.ATTRPOSITION), new A(IAttrName.ATTRPRELOAD, TT.BOOLEAN), new A(IAttrName.ATTRPREVENTLOAD, TT.BOOLEAN), new A(IAttrName.ATTRSIZING), new A(IAttrName.ATTRSRC), new A(IAttrName.ATTRWIDTH)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> ironlistMap = Arrays .asList(new A(IAttrName.ATTRAS), new A(IAttrName.ATTRFIRSTVISIBLEINDEX), new A(IAttrName.ATTRGRID), new A(IAttrName.ATTRINDEXAS), new A(IAttrName.ATTRITEMS), new A(IAttrName.ATTRKEYBINDINGS), new A(IAttrName.ATTRKEYEVENTTARGET), new A(IAttrName.ATTRLASTVISIBLEINDEX), new A(IAttrName.ATTRMAXPHYSICALCOUNT), new A(IAttrName.ATTRMULTISELECTION, TT.BOOLEAN), new A(IAttrName.ATTRSCROLLTARGET), new A(IAttrName.ATTRSELECTEDAS), new A(IAttrName.ATTRSELECTEDITEM), new A(IAttrName.ATTRSELECTEDITEMS), new A(IAttrName.ATTRSELECTIONENABLED, TT.BOOLEAN), new A(IAttrName.ATTRSTOPKEYBORADFROMPROPAGATION, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> paperdropdownmenuMap = Arrays.asList(new A(IAttrName.ATTRACTIVE, TT.BOOLEAN), new A(IAttrName.ATTRALLOWOUTSIDESCROLL, TT.BOOLEAN), new A(IAttrName.ATTRALWAYSFLOATLABEL, TT.BOOLEAN), new A(IAttrName.ATTRARIAACTIVEATTRIBUTE), new A(IAttrName.ATTRDYNAMICALLIGN, TT.BOOLEAN), new A(IAttrName.ATTRHORIZONTALALIGN), new A(IAttrName.ATTRKEYBINDINGS), new A(IAttrName.ATTRKEYEVENTTARGET), new A(IAttrName.ATTRLABEL), new A(IAttrName.ATTRNAME), new A(IAttrName.ATTRNOANIMATION, TT.BOOLEAN), new A(IAttrName.ATTRNOLABELFLOAT, TT.BOOLEAN), new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRPLACEHOLDER), new A(IAttrName.ATTRRECEIVEDFOCUSFROMKEYBOARD, TT.BOOLEAN), new A(IAttrName.ATTRREQUIRED, TT.BOOLEAN), new A(IAttrName.ATTRSELECTEDITEM), new A(IAttrName.ATTRSELECTITEMLABEL), new A(IAttrName.ATTRSTOPKEYBORADFROMPROPAGATION, TT.BOOLEAN), new A(IAttrName.ATTRVERTICALALIGN)).stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> ironselectorMap = Arrays.asList(new A(IAttrName.ATTRACTIVATEEVENT), new A(IAttrName.ATTRATTRFORSELECTED), new A(IAttrName.ATTRFALLBACKSELECTION), new A(IAttrName.ATTRITEMS), new A(IAttrName.ATTRMULTI, TT.BOOLEAN), new A(IAttrName.ATTRSELECTABLE), new A(IAttrName.ATTRSELECTED), new A(IAttrName.ATTRSELECTEDATTRIBUTE), new A(IAttrName.ATTRSELECTEDCLASS), new A(IAttrName.ATTRSELECTEDITEM), new A(IAttrName.ATTRSELECTEDITEMS), new A(IAttrName.ATTRSELECTEDVALUES)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadingridMap = Arrays .asList(new A(IAttrName.ATTRCOLUMNS), new A(IAttrName.ATTRCOLUMNREORDERINGALLOWED, TT.BOOLEAN), new A(IAttrName.ATTRDISABLED, TT.BOOLEAN), new A(IAttrName.ATTRDETAILEDEVENTS, TT.BOOLEAN), new A(IAttrName.ATTRFOOTER), new A(IAttrName.ATTRFROZENCOLUMN), new A(IAttrName.ATTRHEADER), new A(IAttrName.ATTRITEMS), new A(IAttrName.ATTRSELECTION), new A(IAttrName.ATTRSIZE), new A(IAttrName.ATTRSORTORDER), new A(IAttrName.ATTRVISIBLEROWS)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadincomboboxMap = Arrays.asList(new A(IAttrName.ATTRALLOWCUSTOMVALUE, TT.BOOLEAN), new A(IAttrName.ATTRALLOWEDPATTERN), new A(IAttrName.ATTRALWAYSFLOATLABEL, TT.BOOLEAN), new A(IAttrName.ATTRAUTOFOCUS, TT.BOOLEAN), new A(IAttrName.ATTRHASVALUE, TT.BOOLEAN), new A(IAttrName.ATTRINPUTELEMENT), new A(IAttrName.ATTRINPUTMODE, TT.BOOLEAN), new A(IAttrName.ATTRITEMS), new A(IAttrName.ATTRITEMLABELPATH), new A(IAttrName.ATTRLABEL), new A(IAttrName.ATTRNAME), new A(IAttrName.ATTRNOLABELFLOAT, TT.BOOLEAN), new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRPLACEHOLDER), new A(IAttrName.ATTRREADONLY, TT.BOOLEAN), new A(IAttrName.ATTRREQUIRED, TT.BOOLEAN), new A(IAttrName.ATTRSELECTEDITEM), new A(IAttrName.ATTRSIZE)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadindatepickerMap = Arrays .asList(new A(IAttrName.ATTRAUTOVALIDATE, TT.BOOLEAN), new A(IAttrName.ATTRHASVALUE, TT.BOOLEAN), new A(IAttrName.ATTRI18N), new A(IAttrName.ATTRINITIALPOSITION), new A(IAttrName.ATTRKEYBINDINGS), new A(IAttrName.ATTRKEYEVENTTARGET), new A(IAttrName.ATTRINVALID, TT.BOOLEAN), new A(IAttrName.ATTRLABEL), new A(IAttrName.ATTRNAME), new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRREADONLY), new A(IAttrName.ATTRREQUIRED, TT.BOOLEAN), new A(IAttrName.ATTRSTOPKEYBORADFROMPROPAGATION, TT.BOOLEAN)) .stream().collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadinuploadMap = Arrays.asList(new A(IAttrName.ATTRACCEPT), new A(IAttrName.ATTRFILES), new A(IAttrName.ATTRHEADERS), new A(IAttrName.ATTRI18N), new A(IAttrName.ATTRMAXFILES), new A(IAttrName.ATTRMAXFILESIZE), new A(IAttrName.ATTRMETHOD), new A(IAttrName.ATTRNODROP, TT.BOOLEAN), new A(IAttrName.ATTRTARGET), new A(IAttrName.ATTRTIMEOUT)).stream() .collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadincontextmenuMap = Arrays.asList(new A(IAttrName.ATTRCLOSEON), new A(IAttrName.ATTRLISTENON), new A(IAttrName.ATTROPENON), new A(IAttrName.ATTRSELECTOR)).stream() .collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadinsplitlayoutMap = Arrays.asList(new A(IAttrName.ATTRVERTICAL)).stream() .collect(Collectors.toMap(A::getName, A::getType)); private static Map<String, TT> vaadindatepickerlightMap = Arrays.asList(new A(IAttrName.ATTRATTRFORVALUE), new A(IAttrName.ATTRHASVALUE, TT.BOOLEAN), new A(IAttrName.ATTRI18N), new A(IAttrName.ATTRINITIALPOSITION), new A(IAttrName.ATTRKEYBINDINGS), new A(IAttrName.ATTRKEYEVENTTARGET), new A(IAttrName.ATTRLABEL), new A(IAttrName.ATTRNAME), new A(IAttrName.ATTROPENED, TT.BOOLEAN), new A(IAttrName.ATTRREADONLY), new A(IAttrName.ATTRREQUIRED, TT.BOOLEAN), new A(IAttrName.ATTRSTOPKEYBORADFROMPROPAGATION, TT.BOOLEAN), new A(IAttrName.ATTRVALIDATOR), new A(IAttrName.ATTRVALIDATORTYPE)).stream().collect(Collectors.toMap(A::getName, A::getType)); // VaadinSplitLayout private final static Map<WidgetTypes, Map<String, TT>> wMap = new HashMap<WidgetTypes, Map<String, TT>>(); private final static Set<WidgetTypes> buttSet = Arrays .asList(WidgetTypes.PaperDropdownMenu, WidgetTypes.PaperToggleButton).stream().collect(Collectors.toSet()); private final static Set<WidgetTypes> editSet = Arrays.asList(WidgetTypes.PaperDropdownMenu, WidgetTypes.VaadinComboBox, WidgetTypes.VaadinDatePicker, WidgetTypes.VaadinDatePickerLight).stream() .collect(Collectors.toSet()); // VaadinSplitLayout static { wMap.put(WidgetTypes.PaperToast, paperToastMap); wMap.put(WidgetTypes.PaperToggleButton, papertogglebuttontMap); wMap.put(WidgetTypes.IronAjax, ironajaxMap); wMap.put(WidgetTypes.IronCollapse, ironcollapseMap); wMap.put(WidgetTypes.IronImage, ironimageMap); wMap.put(WidgetTypes.IronList, ironlistMap); wMap.put(WidgetTypes.PaperDropdownMenu, paperdropdownmenuMap); wMap.put(WidgetTypes.IronSelector, ironselectorMap); wMap.put(WidgetTypes.VaadinGrid, vaadingridMap); wMap.put(WidgetTypes.VaadinComboBox, vaadincomboboxMap); wMap.put(WidgetTypes.VaadinDatePicker, vaadindatepickerMap); wMap.put(WidgetTypes.VaadinUpload, vaadinuploadMap); wMap.put(WidgetTypes.VaadinSplitLayout, vaadinsplitlayoutMap); wMap.put(WidgetTypes.VaadinContextMenu, vaadincontextmenuMap); wMap.put(WidgetTypes.VaadinDatePickerLight, vaadindatepickerlightMap); } private static TT getPolymerA(WidgetTypes w, String attr) { if (oMap.containsKey(attr)) return oMap.get(attr); if (polymerMap.containsKey(attr)) return polymerMap.get(attr); // w exists in wMap if (buttSet.contains(w) && basebuttonMap.containsKey(attr)) return basebuttonMap.get(attr); if (editSet.contains(w) && baseenterMap.containsKey(attr)) return baseenterMap.get(attr); return wMap.get(w).get(attr); } public interface IWidgetAttribute { String errval(); String getString(); boolean getBool(); } public static boolean isBinderWidgetAttr(WidgetTypes w) { return wMap.containsKey(w); } public static IWidgetAttribute getWidgetAttribute(WidgetTypes w, String attr, String val) { TT t = getPolymerA(w, attr); if (t == null) return null; if (t == TT.BOOLEAN) { if (!IAttrName.BOOLEANFALSE.equals(val) && !IAttrName.BOOLEANTRUE.equals(val)) return new IWidgetAttribute() { @Override public String errval() { return "Only " + IAttrName.BOOLEANFALSE + " or " + IAttrName.BOOLEANTRUE + " allowed as bool value. " + val + " found"; } @Override public String getString() { return null; } @Override public boolean getBool() { return false; } }; } final Object o = ConvertTT.toO(t, val); if (o == null) return new IWidgetAttribute() { @Override public String errval() { return "Attribute type " + t.name() + " Incorrect value found"; } @Override public String getString() { return null; } @Override public boolean getBool() { return false; } }; return new IWidgetAttribute() { @Override public String errval() { return null; } @Override public String getString() { if (t != TT.BOOLEAN) return val; return null; } @Override public boolean getBool() { if (t == TT.BOOLEAN) return (Boolean) (o); return false; } }; } }
[ "stanislawbartkowski@gmail.com" ]
stanislawbartkowski@gmail.com
d128b63497bf86a8d0eaf2fa206c12e23cf173ef
690a8c7c341fbf289a26cb83ebac60f4c9bad6b8
/src/ooplab8/ShapeApp.java
d95fd73b50333e258a19bb459a5c3aac209917ea
[]
no_license
intarasuwan/s359211110114.rmutsv.com2
49443947f6ccb0bdf1e1ee774113d64043f51ec2
b83b781bdeaf52d37e9e264406e99fa9e4ce276d
refs/heads/master
2021-09-07T15:35:57.257842
2018-02-25T06:15:43
2018-02-25T06:15:43
111,058,136
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package ooplab8; public class ShapeApp { public static void main(String[] args) { Rectangle rectangle = new Rectangle(20, 30); System.out.println("Area of rectangle: "+rectangle.findArea()); { Circle circle = new Circle (15); System.out.println("Area of Circle: "+circle.findArea()); } }//main }//class
[ "mild_suttida@hotmail.com" ]
mild_suttida@hotmail.com
6f371df79b406f93da14b146d63e3967e49f7ffd
5873f9ba710348fe6f713ab2439234299698c6e4
/CTS_AntociTeodora_1063/src/clase/Invitat.java
89d1944b2be4c7042dccfc9d32a50be000dd9c92
[]
no_license
antociteodora/ProiectCTS
62d836f7106577ca2143217084b16fdcfd16381e
ed6a0a76f2083d79da17b9871180d2dcacbf6592
refs/heads/master
2016-09-14T19:13:53.592730
2016-05-23T21:15:32
2016-05-23T21:15:32
59,518,585
0
0
null
null
null
null
UTF-8
Java
false
false
3,003
java
package clase; import interfete.IObserver; public class Invitat implements IObserver{ private String nume; private String prenume; private String CNP; private int varsta; public Invitat(String nume,String prenume,String CNP) { super(); this.nume = nume; this.prenume=prenume; this.CNP=CNP; } public String getPrenume() { return prenume; } public void setPrenume(String prenume) { if(prenume!=null) this.prenume = prenume; else throw new IllegalArgumentException(); } public String getCNP() { return CNP; } public void setCNP(String cNP) { if(cNP.length()==13) CNP = cNP; else throw new IllegalArgumentException(); } public String getNume() { return nume; } public void setNume(String nume) { if(nume!=null) this.nume = nume; else throw new IllegalArgumentException(); } public int getVarsta() { return varsta; } public void setVarsta(int varsta) { this.varsta = varsta; } @Override public void update(String mesaj) { // TODO Auto-generated method stub if(mesaj.length()<70) System.out.println(mesaj); else throw new IllegalArgumentException(); } //verificare CNP lungime public boolean checkCNPLungime() { boolean ok=false; if(this.CNP.length()==13) ok=true; else System.out.println("CNP-ul nu are 13 cifre!!"); return ok; } //verificare CNP spatii public boolean checkCNPSpatii() { boolean ok=true; char[] cnp=this.CNP.toCharArray(); for(int i=0;i<cnp.length && ok==true;i++) if(cnp[i]==' ') ok=false; return ok; } //verificare CNP - contine doar cifre public boolean checkCNPCifre() { boolean ok=true; char[] cnp=this.CNP.toCharArray(); for(int i=0;i<cnp.length && ok==true;i++) if(!Character.isDigit(cnp[i])) ok=false; return ok; } //verificare CNP - validitate 1->4 public boolean checkCNPValid() { boolean ok=true; int cifra; char[] cnp=this.CNP.toCharArray(); cifra=cnp[0]-'0'; if(cifra==0 || cifra>4) ok=false; return ok; } //verificare nume - litera mare public boolean checkNumeUpper() { char[] Nume=this.nume.toCharArray(); if(Nume[0]>'A'&&Nume[0]<'Z') return true; return false; } //verificare mesaj - contine spatii public boolean checkMesajSpatii(String mesaj) { boolean ok=false; char[] m=mesaj.toCharArray(); for(int i=0;i<m.length && ok==false;i++) if(m[i]==' ') ok=true; return ok; } //verificare an < 98 - ca varsta sa fie peste 18 ani public boolean checkCNP18() { int an; an=(this.CNP.charAt(1)-'0')*10 + (this.CNP.charAt(2)-'0'); if(an<=98 && an>17) return true; return false; } //functie calcul varsta public int calculVarsta() { int varsta; int an_nastere; an_nastere=(this.CNP.charAt(1)-'0')*10 + (this.CNP.charAt(2)-'0'); varsta= 2016 - (19*100 + an_nastere); return varsta; } //functie compunere informatii invitat public String compunereInvitat() { return this.nume + " " + this.prenume + " " + this.calculVarsta() + " ani."; } }
[ "teodoraantoci94@gmail.com" ]
teodoraantoci94@gmail.com
a29caf6be9612fc39cf175ac9b80095e43b9db6d
d84582cbd02b63314dc23dea03a8c6a1980b1cc8
/src/main/java/com/gumtree/addressbook/exception/InvalidAddressBookException.java
e268d737a9fc15708ff2b59455c6087cc524706d
[]
no_license
jkarri/addressbook
162e85f21aaa4c9a7e63820deaaff23613bd2414
fdbcd57b8e67721ad393b636687d832ae1626e9a
refs/heads/master
2021-01-10T09:51:56.190305
2016-02-05T14:32:16
2016-02-05T14:32:16
51,141,404
0
0
null
null
null
null
UTF-8
Java
false
false
350
java
package com.gumtree.addressbook.exception; /** * Exception to denote that the given address book is invalid. */ public class InvalidAddressBookException extends Exception { /** * Default constructor. * @param message exception message */ public InvalidAddressBookException(String message) { super(message); } }
[ "v-jkarrii@expedia.com" ]
v-jkarrii@expedia.com
e58e8a444c30c56feef9f81ef35be73c04729998
b1e260050369c55f844b3f1559f504d002612869
/src/main/java/com/dell/isg/smi/virtualidentity/model/VirtualIdentityResponse.java
86e896a056df20152b21ecb9703228b829e758ef
[ "Apache-2.0" ]
permissive
RackHD/smi-lib-virtualidentity
ed26cf7a1c8f83ec9260c2c26fc2c7b4b7060000
5f96bc1fa6b8c27a0032ef53577e78b0e503397b
refs/heads/master
2021-01-20T10:06:20.015894
2018-07-16T07:41:30
2018-07-16T07:41:30
90,324,413
1
5
null
2018-07-16T07:37:49
2017-05-05T01:24:56
Java
WINDOWS-1252
Java
false
false
3,379
java
/** * Copyright © 2017 DELL Inc. or its subsidiaries. All Rights Reserved. */ package com.dell.isg.smi.virtualidentity.model; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * The Class VirtualIdentityResponse. */ @ApiModel @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "id", "value", "state", "type", "usageId", "poolId" }) @XmlRootElement(name = "VirtualIdentityResponse") public class VirtualIdentityResponse { @ApiModelProperty(position = 1) protected long id; @ApiModelProperty(position = 2) @XmlElement(required = true) protected String value; @ApiModelProperty(position = 3) @XmlElement(required = true) protected String state; @ApiModelProperty(position = 4) @XmlElement(required = true) protected String type; @ApiModelProperty(position = 5) protected String usageId; @ApiModelProperty(position = 6) protected long poolId; /** * Gets the value of the id property. * * @return the id */ public long getId() { return id; } /** * Sets the value of the id property. * * @param value the new id */ public void setId(long value) { this.id = value; } /** * Gets the value of the value property. * * @return possible object is {@link String } * */ public String getValue() { return value; } /** * Sets the value of the value property. * * @param value allowed object is {@link String } * */ public void setValue(String value) { this.value = value; } /** * Gets the value of the state property. * * @return possible object is {@link String } * */ public String getState() { return state; } /** * Sets the value of the state property. * * @param value allowed object is {@link String } * */ public void setState(String value) { this.state = value; } /** * Gets the value of the type property. * * @return possible object is {@link String } * */ public String getType() { return type; } /** * Sets the value of the type property. * * @param value allowed object is {@link String } * */ public void setType(String value) { this.type = value; } /** * Gets the value of the usageId property. * * @return the usage id */ public String getUsageId() { return usageId; } /** * Sets the value of the usageId property. * * @param value the new usage id */ public void setUsageId(String value) { this.usageId = value; } /** * Gets the value of the poolId property. * * @return the pool id */ public long getPoolId() { return poolId; } /** * Sets the value of the poolId property. * * @param value the new pool id */ public void setPoolId(long value) { this.poolId = value; } }
[ "Michael_Hepfer@dell.com" ]
Michael_Hepfer@dell.com
da02876184117dba4e419feb377961f87f216f35
2634fcf37c84a70ad1e179d7c41b1f684f2beb14
/src/main/java/com/softuni/springintroex/Serveses/CategoryServis.java
1c5fd3595a5f46bc54146e7bba44efb750d602e1
[]
no_license
lozevBogdan/spring-intro-ex
b09e2fa577ee6ee69913a5f419781973ce04746b
c9f82babfb6ca50de40f97169d81ca9e6b4834b9
refs/heads/master
2023-01-12T00:33:07.335169
2020-11-10T10:08:39
2020-11-10T10:08:39
311,377,136
0
0
null
null
null
null
UTF-8
Java
false
false
162
java
package com.softuni.springintroex.Serveses; import java.io.IOException; public interface CategoryServis { void seedCategoriesInDB() throws IOException; }
[ "lozev.bogdan@abv.bg" ]
lozev.bogdan@abv.bg
2d67e58f50c3597572431428aada425b5dcc4902
2bb6379e9b363861618d562ceb5a277d56197514
/jbpm/quickstarts/src/main/java/org/jbpm/quickstarts/looping/LoopingStart.java
6691d3e16efa4220128e03a05e01f6134177e9e4
[]
no_license
talipkorkmaz/drools-examples
79e4a50f002b193a4925b874e443cd9fecb861d3
8a04f7d671f4d9765159dc996dc00d03b1bb59ca
refs/heads/master
2020-04-13T06:25:56.224454
2018-12-24T09:17:19
2018-12-24T09:17:19
163,020,438
1
0
null
2018-12-24T20:03:06
2018-12-24T20:03:06
null
UTF-8
Java
false
false
438
java
package org.jbpm.quickstarts.looping; import org.drools.runtime.StatefulKnowledgeSession; import org.jbpm.quickstarts.QuickStartBase; public class LoopingStart extends QuickStartBase{ public void test() { StatefulKnowledgeSession ksession = createKnowledgeSession("quickstarts/looping.bpmn"); ksession.startProcess("org.jbpm.quickstarts.looping"); } public static void main(String[] args) { new LoopingStart().test(); } }
[ "songzhiqi_1214@yahoo.com.cn" ]
songzhiqi_1214@yahoo.com.cn
b5401066ab3fa20767dd5e86d14f66519cc521db
ea348433ebe843a7e34b3ee0fec88d465e498cee
/src/main/java/br/com/devmedia/blog/web/controller/ComentarioController.java
f97498d6dbc6164aed97c0c20b1f362fe835853b
[]
no_license
MarceloAugusto/Blog_SpringMVC_Boot_Data_Security_Devmedia
d7e0c673957c6db9bca8b46560d270f7e9c25cd5
66efa7a9d7b924f12ee3e8ede01eacb218fde095
refs/heads/master
2021-01-20T15:49:30.838416
2016-07-13T12:34:21
2016-07-13T12:34:21
63,243,912
0
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
package br.com.devmedia.blog.web.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import br.com.devmedia.blog.entity.Comentario; import br.com.devmedia.blog.entity.Postagem; import br.com.devmedia.blog.service.ComentarioService; import br.com.devmedia.blog.service.PostagemService; @Controller @RequestMapping("comentario") public class ComentarioController { @Autowired private ComentarioService comentarioService; @Autowired private PostagemService postagemService; @RequestMapping(value = "/save", method = RequestMethod.POST) public String save( @ModelAttribute("comentario") Comentario comentario, @RequestParam("permalink") String permalink) { Postagem postagem = postagemService.findByPermalink(permalink); comentario.setPostagem(postagem); comentarioService.save(comentario); return "redirect:/" + permalink; } }
[ "marceloaugusto16@gmail.com" ]
marceloaugusto16@gmail.com
3337a47d3ee12037762680d3f95688de32ceb4ca
381325a109e35a67425dedfc9973da4a6b83959c
/nodeagent/branches/3-0/src/main/java/appcloud/nodeagent/info/NodeAgent.java
7dd0c48279a4048c548fd8eeec8850fae0f3b4cc
[]
no_license
ShangfengDing/IaaS
213287571e2ba3c06814565fbb229ef9c964a91a
89d7120ceac53d22520e353325f193c7cdf3a6ff
refs/heads/master
2022-12-22T21:01:06.596557
2019-11-07T13:12:14
2019-11-07T13:12:14
220,217,355
0
1
null
2022-12-16T04:01:46
2019-11-07T11:07:33
JavaScript
UTF-8
Java
false
false
12,619
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package appcloud.nodeagent.info; import java.util.*; import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.log4j.Logger; import appcloud.common.constant.HostCapacities; import appcloud.common.model.Host; import appcloud.common.model.Host.HostTypeEnum; /** * * @author yicou * @author jianglei */ public class NodeAgent { private static NodeAgent agent; private String uuid = ""; private String nfsLocation; private int hitInterval; private int hostInfoInterval; private int gcInfoInterval; private long lastUseCpuTime = 0; private long lastTotalCpuTime = 0; private long lastCpuTime = 0; private int hostId = -1; private String capability; private int diskCap; private int cpuNum; private int cpuHz; private int maxMem; private String url; private String location; private String os; private static Logger logger = Logger.getLogger(NodeAgent.class); public static NodeAgent getInstance() { if (agent == null) { agent = new NodeAgent(); } return agent; } private NodeAgent() { InputStream is = NodeAgent.class.getClassLoader().getResourceAsStream("na.properties"); java.util.Properties p = new java.util.Properties(); try { p.load(is); url = p.getProperty("url"); String typeString = p.getProperty("type"); if(typeString.trim().equalsIgnoreCase("COMPUTE_NODE")) { type = HostTypeEnum.COMPUTE_NODE; } else if (typeString.trim().equalsIgnoreCase("FUNCTION_NODE")){ type = HostTypeEnum.FUNCTION_NODE; } else { logger.error("type not supportted"); System.exit(1); } capability = p.getProperty("capability"); if (capability == null) { logger.error("capability must be filled"); System.exit(1); } vmEpStr = p.getProperty("vm"); j2eeEpStr = p.getProperty("j2ee"); nfsLocation = p.getProperty("nfs"); location = p.getProperty("location"); location = new String(location.getBytes("ISO8859-1"), "UTF-8"); hitInterval = Integer.parseInt(p.getProperty("hitInterval")); hostInfoInterval = Integer.parseInt(p.getProperty("hostInfoInterval")); gcInfoInterval = Integer.parseInt(p.getProperty("gcInfoInterval")); // TODO os info setter //os = p.getProperty("os"); os = getHostOS(); uuid = p.getProperty("uuid"); if (uuid == null) { logger.error("uuid must be filled"); System.exit(1); //uuid = UUID.randomUUID().toString().replace("-", ""); } for (String pro : p.stringPropertyNames()) { if (pro.contains("Dir")) { dirList.add(p.getProperty(pro)); } } } catch (Exception ex) { ex.printStackTrace(); } setCpuInfo(); setMemInfo(); setDiskCap(); hit(); } private String getHostOS() { final String DES_PREFIX = "Description"; final String DES_REG = ".*Description:*[\\s]+"; final int len = DES_PREFIX.length(); String os = getCmd("lsb_release -d"); if (os != null && os.length() > len) { int index = os.indexOf(DES_PREFIX); if ( index >= 0) { os = os.replaceAll(DES_REG, ""); } } else { os = "Unknown OS"; } return os; } public String getNfsLocation() { return nfsLocation; } public int getHitInterval() { return hitInterval; } public int getHostInfoInterval() { return hostInfoInterval; } public int getGcInfoInterval() { return gcInfoInterval; } public int getHostId() { return hostId; } public void setHostId(int id) { hostId = id; } public String getCapability() { return capability; } public boolean containsVm() { return capability.toUpperCase().contains(HostCapacities.VM); } public boolean containsJ2ee() { return capability.toUpperCase().contains(HostCapacities.J2EE); } private List<String> dirList = new ArrayList<String>(); public static final Pattern DISK_PARTTERN = Pattern .compile("\\n([\\s\\S]+?)[\\s]+?([0-9]+?)[\\s]+?([0-9]+?)[\\s]+?([0-9]+?)[\\s]+?([0-9]+?)%[\\s]+?([\\s\\S]+?)"); private void setDiskCap() { String command = "df"; for (String dir : dirList) { command += " " + dir; } String msg = getCmd(command); Matcher matcher = DISK_PARTTERN.matcher(msg); Map<String, Long> tMap = new HashMap<String, Long>(); tMap.clear(); while (matcher.find()) { String sys = matcher.group(1); long cap = Long.parseLong(matcher.group(2)); tMap.put(sys, cap); } diskCap = 0; for (String sys : tMap.keySet()) { diskCap += tMap.get(sys) / 1024; } } public int getUseDisk() { String command = "df"; for (String dir : dirList) { command += " " + dir; } String msg = getCmd(command); Matcher matcher = DISK_PARTTERN.matcher(msg); Map<String, Long> tMap = new HashMap<String, Long>(); tMap.clear(); while (matcher.find()) { String sys = matcher.group(1); long cap = Long.parseLong(matcher.group(3)); tMap.put(sys, cap); } int useDisk = 0; for (String sys : tMap.keySet()) { useDisk += tMap.get(sys) / 1024; } return useDisk; } public int getFreeDisk() { return getDiskCap() - getUseDisk(); } public int getDiskCap() { return diskCap; } public static final Pattern CPU_HZ_PARTTERN = Pattern .compile("cpu[\\s]*?MHz[\\s]*?:[\\s]*?([0-9]+)".toLowerCase()); private void setCpuInfo() { String fileContent = getLocalFile("/proc/cpuinfo"); cpuNum = -1; int idx = -1; do { idx = fileContent.indexOf("processor", idx + 1); cpuNum++; } while (idx >= 0); int num = 0; int total = 0; Matcher matcher = CPU_HZ_PARTTERN.matcher(fileContent.toLowerCase()); while (matcher.find()) { num++; total += Integer.parseInt(matcher.group(1)); } cpuHz = total / num; } public static final Pattern TOTAL_MEM_PARTTERN = Pattern .compile("MemTotal:[\\s]*?([0-9]*) ([a-z ])B".toLowerCase()); private void setMemInfo() { String fileContent = getLocalFile("/proc/meminfo"); Matcher matcher = TOTAL_MEM_PARTTERN.matcher(fileContent.toLowerCase()); maxMem = 0; if (matcher.find()) { String totalMem = matcher.group(1); String pri = matcher.group(2); Long total = Long.parseLong(totalMem); // 换算为MB if (pri.equalsIgnoreCase("k")) { total /= 1024; } else if (pri.equalsIgnoreCase(" ")) { total /= 1024 * 1024; } else if (pri.equalsIgnoreCase("g")) { total *= 1024; } maxMem = total.intValue(); } else { logger.warn("max mem set FAILD"); } } public int getMaxMem() { return maxMem; } public static final Pattern FREE_MEM_PARTTERN = Pattern .compile("\\n((MemFree)|(Buffers)|(Cached)?):[\\s]*?([0-9]*) ([a-z ])B".toLowerCase()); public int getFreeMem() { int mem = 0; String fileContent = getLocalFile("/proc/meminfo"); Matcher matcher = FREE_MEM_PARTTERN.matcher(fileContent.toLowerCase()); while (matcher.find()) { String totalMem = matcher.group(5); String pri = matcher.group(6); Long total = Long.parseLong(totalMem); // 换算为MB if (pri.equalsIgnoreCase("k")) { total /= 1024; } else if (pri.equalsIgnoreCase(" ")) { total /= 1024 * 1024; } else if (pri.equalsIgnoreCase("g")) { total *= 1024; } mem += total.intValue(); } return mem; } public int getUseMem() { return getMaxMem() - getFreeMem(); } public int getCpuNum() { return cpuNum; } public int getCpuHz() { return cpuHz; } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public String getUrl() { return url; } public String getLocation() { return location; } public String getOs() { return os; } private HostTypeEnum type; public HostTypeEnum getType() { return type; } private String vmEpStr; public String getVmEpStr() { return vmEpStr; } private String j2eeEpStr; public String getJ2eeEpStr() { return j2eeEpStr; } private String getCmd(String command) { String msg = ""; InputStream is = null; BufferedReader br = null; try { Process proc = Runtime.getRuntime().exec(command); is = proc.getInputStream(); br = new BufferedReader(new InputStreamReader(is)); msg += br.readLine(); while (br.ready()) { msg += "\n" + br.readLine(); } // destroy 此进程 可以回收 相关资源 特别是 文件句柄 proc.destroy(); } catch (Exception ex) { msg = ""; } try { br.close(); is.close(); } catch (Exception ex) { } return msg; } /** * 修改了个bug,直接读文件的话时间长了会报异常 * /proc/stat (Too many open files) * java.io.FileNotFoundException: /proc/stat (Too many open files) * @param location * @return */ private String getLocalFile(String location) { return getCmd("cat " + location); } public static final Pattern CPU_PARTTERN = Pattern .compile("cpu[\\s]+?([0-9]+?) ([0-9]+?) ([0-9]+?) ([0-9]+?) ([0-9]+?) ([0-9]+?) ([0-9]+?)"); public long getUseCpuTime() { String msg = getLocalFile("/proc/stat"); Matcher matcher = CPU_PARTTERN.matcher(msg); long time = 0; if (matcher.find()) { time += Long.parseLong(matcher.group(1)); time += Long.parseLong(matcher.group(2)); time += Long.parseLong(matcher.group(3)); } return time * 10; //换算为10^-3s } public long getTotalCpuTime() { String msg = getLocalFile("/proc/stat"); Matcher matcher = CPU_PARTTERN.matcher(msg); long time = 0; if (matcher.find()) { for (int i = 1; i <= 7; i++) { time += Long.parseLong(matcher.group(i)); } } return time * 10; //换算为10^-3s } public long getCpuTime() { return System.currentTimeMillis(); } public void hit() { lastUseCpuTime = getUseCpuTime(); lastTotalCpuTime = getTotalCpuTime(); lastCpuTime = getCpuTime(); } public int getHitCpuTime() { long thisCpuTime = getCpuTime(); return (int)(thisCpuTime - lastCpuTime); } public int getHitUseCpuTime() { long thisUseCpuTime = getUseCpuTime(); return (int)(thisUseCpuTime - lastUseCpuTime); } public float getUseCpuLoad() { long thisUseCpuTime = getUseCpuTime(); long thisTotalCpuTime = getTotalCpuTime(); double load = thisUseCpuTime - lastUseCpuTime; load *= 100; load /= thisTotalCpuTime - lastTotalCpuTime; return (float) load; } public Host getHostInfoWithUuid() { Host host = new Host(); host.setUuid(this.getUuid()); host.setType(this.getType()); return host; } }
[ "747879583@qq.com" ]
747879583@qq.com
9e446b3a7b09fda2f7657c1c124c68088961d3d7
e27830b98bda1c0b8c8a9da1f2de3d092e515f48
/Before/src/DAY1014/test/StringToNumber.java
12f68c7a7971c4da591389ee3b9cf13070261251
[]
no_license
pjeasu/ECLIPSE
9731161560dd29934bbd3807ff139d9ccf9f2477
876bb8edf2e45ab801bc8e52a346831cba0e4588
refs/heads/master
2021-01-03T04:31:35.969081
2020-02-12T03:59:00
2020-02-12T03:59:00
239,922,681
0
0
null
null
null
null
UHC
Java
false
false
1,998
java
package DAY1014.test; import java.util.Scanner; // 문자열 숫자를 입력받아 숫자로 바꾸는 예제 // 숫자가 아닌 글자는 걸러내기 public class StringToNumber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String temp; do { System.out.print("Input number : "); temp = scanner.next(); if (temp.equalsIgnoreCase("q")) { //대소문자 상관없이 q인지 확인 System.out.println("bye"); break;// bye 출력후 } else if (!isDigit(temp)) // 숫자가 아닐경우 continue; // 블럭을 빠져나가서 다시 입력창으로. System.out.format("Input is %d\n", parseInt(temp)); //숫자라면 출력 } while (true); } public static boolean isDigit(String str) { if (str == null) return false; boolean isDigit = true; str.trim();//앞뒤 공백제거 for (int i = 0; i < str.length(); i++) { //입력된 문자열 길이만큼 루프 돌기 char ch = str.charAt(i); //첫번째 자릿수 글자~문자열의 길이번째 숫자 1,2,3... 를 하나씩 가져옴 if (!Character.isDigit(ch)) {//그 문자가 숫자가 아니라면 false처리 isDigit = false; break; } } return isDigit; //false가 아닌건 숫자 } public static Integer parseInt(String str) { if (str == null) return null; int number = 0; str.trim(); for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if (!Character.isDigit(ch)) { return null; } else { number = number * 10 + (ch - '0'); //문자열인 숫자를 int 숫자로 바꾸는 식 } } return number; } }
[ "pjeasu@gmail.com" ]
pjeasu@gmail.com
8293f241466c829eb7ece2bb4dd304943f766b09
27e622af3f043ab3c3caf7c27e18e22b18868961
/app/src/main/java/com/efe/teamstack/Player.java
14ecd4a2ca5da870f0fa51022085e0b78fb44fee
[]
no_license
coderEFE/TeamStack
69e095b31e93748e9378ba9f03ce8e34b6e7b97e
1e84f16d15da7da6ca7137fb52134618bb12f2e8
refs/heads/master
2023-03-21T09:21:04.084937
2020-10-16T02:57:39
2020-10-16T02:57:39
304,503,163
0
0
null
null
null
null
UTF-8
Java
false
false
1,082
java
package com.efe.teamstack; import androidx.recyclerview.widget.RecyclerView; //Player object public class Player { private String name; private int age, pic, playerID, roundsPlayed; public Player(String name, int playerID, int age, int pic){ this.name = name; this.playerID = playerID; this.age = age; this.pic = pic; roundsPlayed = 0; } public int getPlayerID() { return playerID; } public void setPlayerID(int playerID) { this.playerID = playerID; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPic() { return pic; } public void setPic(int pic) { this.pic = pic; } public int age() { return age; } public void age(int age) { this.age = age; } public int getRoundsPlayed() { return roundsPlayed; } public void setRoundsPlayed(int roundsPlayed) { this.roundsPlayed = roundsPlayed; } }
[ "coder.efe@gmail.com" ]
coder.efe@gmail.com
307b71814b5926ad0f55dd330cfe25b403d746ce
04bc4cbeb942541a4568d24952658d531ecdaeaa
/src/cn/mygenekey/utils/WebApplication.java
48bbfb1f21f85d0f07abc27c463d9e7c6d1b1814
[]
no_license
Uoor/mygenekey
24b40e1112102f8447fca6b4d68d480b7ff0ea70
eaff1047ef96d580e5f58295a41264221339ca0b
refs/heads/master
2021-01-11T19:51:45.356987
2017-04-12T12:55:44
2017-04-12T12:55:44
79,407,750
0
3
null
2017-10-26T09:30:46
2017-01-19T02:39:11
HTML
UTF-8
Java
false
false
3,543
java
package cn.mygenekey.utils; import cn.mygenekey.utils.*; import org.apache.struts2.ServletActionContext; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.net.InetAddress; import java.net.UnknownHostException; public class WebApplication { public static String getIP(){ String ip = null; try { ip = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { e.printStackTrace(); } return ip; } // ---------------get user message begin-------------------- // ---------------get user message end-------------------- /** * 得到session * * @return */ public static HttpSession getSession() { return getRequest().getSession(); } /** * 得到request * * @return */ public static HttpServletRequest getRequest() { HttpServletRequest request = ServletActionContext.getRequest(); System.out.println("request=>"+request); return request; } /** * 得到response * * @return */ public static HttpServletResponse getResponse() { HttpServletResponse response = ServletActionContext.getResponse(); return response; } /** * 获得工程的上下文路径 * @return */ public static String getContextPath(){ return getSession().getServletContext().getRealPath(""); } /** * 获得资源文件的路径 * @return */ public static String getResourcePath(){ return getContextPath()+"/resource"; } /** * 获得资源测试文件路径 * @return */ public static String getDemoResourcePath(){ return getContextPath()+"/resource/demo-image"; } /** * 添加cookie * @param key * @param value * @param jiami 是否采用aes加密 */ public static void addCookie(String key, String value, boolean jiami){ if(jiami){ //采用aes加密 value = Aes.encrypt(EscapeUnescape.escape(value)); } Cookie cookie = new Cookie(key, value); cookie.setMaxAge(60*60*24*7); //默认保存7天 getResponse().addCookie(cookie); } /** * 默认采用加密来添加cookie * @param key * @param value */ public static void addCookie(String key, String value){ addCookie(key, value,true); } /** * * @param key * @param jiami * @return */ public static String getCookie(String key, boolean jiami){ System.out.println("WebApplication.getCookie()"); Cookie[] allCookies = getRequest().getCookies(); if(allCookies!=null && allCookies.length!=0){ for (int i = 0; i < allCookies.length; i++) { Cookie cookie = allCookies[i]; if(key.equals(cookie.getName())){ String value = EscapeUnescape.unescape(cookie.getValue()); System.out.println("key=>"+cookie.getName()+","+"value=>"+value); if(value==null){ value = ""; }else if(jiami){ value = Aes.desEncrypt(EscapeUnescape.unescape(cookie.getValue())); } return value; } } } return ""; } /** * * @param key * @return */ public static String getCookie(String key){ return getCookie(key,true); } /** * 删除cookie * @param key */ public static void removeCookie(String key){ Cookie[] allCookies = getRequest().getCookies(); if(allCookies!=null&&allCookies.length!=0){ for (int i = 0; i < allCookies.length; i++) { Cookie cookie = allCookies[i]; if(key.equals(cookie.getName())){ Cookie nullCookie = new Cookie(key, null); nullCookie.setMaxAge(0); getResponse().addCookie(nullCookie); } } } } }
[ "838199384@qq.com" ]
838199384@qq.com
9fd9f6e518c991d703d99a61b4f5c9d3e863e51d
671daf60cdb46250214da19132bb7f21dbc29612
/android/src/org/jetbrains/android/dom/converters/NonExpansibleResourceReferenceConverter.java
4e363b31d0f3a88691c0ac43799488dbe8e84002
[ "Apache-2.0" ]
permissive
JetBrains/android
3732f6fe3ae742182c2684a13ea8a1e6a996c9a1
9aa80ad909cf4b993389510e2c1efb09b8cdb5a0
refs/heads/master
2023-09-01T14:11:56.555718
2023-08-31T16:50:03
2023-08-31T16:53:27
60,701,247
947
255
Apache-2.0
2023-09-05T12:44:24
2016-06-08T13:46:48
Kotlin
UTF-8
Java
false
false
432
java
package org.jetbrains.android.dom.converters; /** * Useful in cases which the expanded completion suggestion list would be too long. * In those cases, don't list all the possible resource values, but the types of resources instead. */ public class NonExpansibleResourceReferenceConverter extends ResourceReferenceConverter { public NonExpansibleResourceReferenceConverter() { setExpandedCompletionSuggestion(false); } }
[ "intellij-monorepo-bot-no-reply@jetbrains.com" ]
intellij-monorepo-bot-no-reply@jetbrains.com
9965d5f4a27aa3891af56ae989f46859f431de66
c04b88c77368899805058af6164253a07bf9dbc2
/app/src/main/java/com/example/proto_type_1/Add_Sub_Rout.java
6f03bec261dcdbdd8054d41de66e3ddb13f961e7
[]
no_license
D21IT185BapodraRajSatish/Bus-Servise
7c8b4eba1772b2fb789a439a37e1f53fa30eb59c
3352ba39222107876357e014074f1dd1a140c0f6
refs/heads/master
2023-08-29T23:54:22.161142
2021-11-09T08:25:31
2021-11-09T08:51:37
426,154,482
0
0
null
null
null
null
UTF-8
Java
false
false
27,854
java
package com.example.proto_type_1; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.ekalips.fancybuttonproj.FancyButton; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.android.material.textfield.TextInputLayout; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Add_Sub_Rout extends AppCompatActivity { //Text View TextView TXT_VIEW_kilometre; //TextInputLayout TextInputLayout stpname, kilometre; // ProgressDialog progressDialog; // TextView retry; // Toolbar toolbar; //Button Button btnadd; //List View ListView lstview, lstTitle; //Array List ArrayList<Routs> arrayList, arrayList1; //Adapter RoutsAdpater routsAdpater, routsAdpater1; //Firebase Database Reference DatabaseReference dbstore, dbretrieve, dbretrieve1, dbretrieve2, dbretrieve3, dbretrive4; //UserDefine Class GetandSetRout store, retrieve, retrieve1, retrieve2, retrieve3; // FancyButton button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_sub_rout); //init method call init(); //Set kilometer value in TextView method Call setTitleKilometer(); //List View Long Click Event lstview.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, final int position, long id) { if(isConnected()) { final int i = position; Animation animation = new AlphaAnimation(0.3f, 0.1f); animation.setDuration(400); view.startAnimation(animation); AlertDialog.Builder builder = new AlertDialog.Builder(Add_Sub_Rout.this); builder.setMessage("Do You want to DELETE " + routsAdpater.getItem(position).getCustomize_Source_Point() + " ?"); builder.setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dbretrieve3 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")).child(routsAdpater.getItem(i).getCustomize_Source_Point().replace("/", "--").replace(".", "_")); dbretrieve3.removeValue(); } }) .setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.create().show(); } else { AlertDialogBox(); } return true; } }); //Button Click Event /*btnadd.setOnClickListener(new View.OnClickListener() { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) @Override public void onClick(final View v) { if (validator()) { dbretrieve2.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { Double Kilo_M = dataSnapshot.getValue(GetandSetRout.class).getKilometre(); Double TxtK_M = Double.parseDouble(kilometre.getEditText().getText().toString()); if (TxtK_M >= Kilo_M) { Toast.makeText(Add_Sub_Rout.this, "Kilometre's value is more than or equal last point value", Toast.LENGTH_SHORT).show(); } else if (TxtK_M <= 0) { Toast.makeText(Add_Sub_Rout.this, "Kilometre's value Can't be negative or zero", Toast.LENGTH_SHORT).show(); } else { dbretrive4 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); dbretrive4.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { boolean vaild = false; for (DataSnapshot item : dataSnapshot.getChildren()) { if (item.hasChildren()) { retrieve3 = item.getValue(GetandSetRout.class); String CPD = retrieve3.getStp_Name(); String CPT = stpname.getEditText().getText().toString(); //int CPint=CPD.compareToIgnoreCase(CPT); if (CPD.equalsIgnoreCase(CPT) & TextUtils.equals(kilometre.getEditText().getText().toString(), String.valueOf(retrieve3.getKilometre()))) { AlertDialog.Builder builder = new AlertDialog.Builder(Add_Sub_Rout.this); builder.setCancelable(false); builder.setMessage("This Rout Details allready register "); builder.setPositiveButton("Try Again", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.create().show(); vaild = false; break; } else if (TextUtils.equals(String.valueOf(Double.parseDouble(kilometre.getEditText().getText().toString())), String.valueOf(retrieve3.getKilometre()))) { Toast.makeText(Add_Sub_Rout.this, "Stop is already registered at this kilometre", Toast.LENGTH_SHORT).show(); vaild = false; break; } else if (CPD.equalsIgnoreCase(CPT)) { Toast.makeText(Add_Sub_Rout.this, "Stop is already registered ", Toast.LENGTH_SHORT).show(); vaild = false; break; } else { vaild = true; } } } if (vaild) { storeToDatabase(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } });*/ View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View view) { if (view instanceof FancyButton) { button1.collapse(); if (validator()) { dbretrieve2.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { Double Kilo_M = dataSnapshot.getValue(GetandSetRout.class).getKilometre(); Double TxtK_M = Double.parseDouble(kilometre.getEditText().getText().toString()); if (TxtK_M >= Kilo_M) { Toast.makeText(Add_Sub_Rout.this, "Kilometre's value is more than or equal last point value", Toast.LENGTH_SHORT).show(); } else if (TxtK_M <= 0) { Toast.makeText(Add_Sub_Rout.this, "Kilometre's value Can't be negative or zero", Toast.LENGTH_SHORT).show(); } else { dbretrive4 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); dbretrive4.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { boolean vaild = false; for (DataSnapshot item : dataSnapshot.getChildren()) { if (item.hasChildren()) { retrieve3 = item.getValue(GetandSetRout.class); String CPD = retrieve3.getStp_Name(); String CPT = stpname.getEditText().getText().toString(); //int CPint=CPD.compareToIgnoreCase(CPT); if (CPD.equalsIgnoreCase(CPT) & TextUtils.equals(kilometre.getEditText().getText().toString(), String.valueOf(retrieve3.getKilometre()))) { AlertDialog.Builder builder = new AlertDialog.Builder(Add_Sub_Rout.this); builder.setCancelable(false); builder.setMessage("This Rout Details allready register "); builder.setPositiveButton("Try Again", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.create().show(); vaild = false; break; } else if (TextUtils.equals(String.valueOf(Double.parseDouble(kilometre.getEditText().getText().toString())), String.valueOf(retrieve3.getKilometre()))) { Toast.makeText(Add_Sub_Rout.this, "Stop is already registered at this kilometre", Toast.LENGTH_SHORT).show(); vaild = false; break; } else if (CPD.equalsIgnoreCase(CPT)) { Toast.makeText(Add_Sub_Rout.this, "Stop is already registered ", Toast.LENGTH_SHORT).show(); vaild = false; break; } else { vaild = true; } } } if (vaild) { storeToDatabase(); } else { button1.expand(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } } } }; button1.setOnClickListener(listener); } //Set Kilometer in Text View method private void setTitleKilometer() { dbretrieve.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { for (DataSnapshot ds : snapshot.getChildren()) { if (ds.hasChildren()) { retrieve3 = ds.getValue(GetandSetRout.class); if (TextUtils.equals(retrieve3.getStp_Name(), getIntent().getExtras().getString("LPoint"))) { TXT_VIEW_kilometre.setText(String.valueOf(retrieve3.getKilometre())); break; } } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Toast.makeText(Add_Sub_Rout.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show(); } }); } //validate controls private boolean validator() { boolean valid; if (TextUtils.isEmpty(stpname.getEditText().getText().toString()) & TextUtils.isEmpty(kilometre.getEditText().getText().toString())) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("all filed are Required"); builder.setPositiveButton("Try Again", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { stpname.setErrorEnabled(false); kilometre.setErrorEnabled(false); } }); builder.create().show(); button1.expand(); valid = false; button1.expand(); } else { if (stpname.getEditText().getText().toString().isEmpty()) { stpname.setErrorEnabled(true); stpname.setError("Please Enter SubStop name"); button1.expand(); valid = false; button1.expand(); } else { Pattern ps = Pattern.compile("^[A-Za-z/()0-9., ]+$"); Matcher ms = ps.matcher(stpname.getEditText().getText().toString()); if (!ms.matches()) { String temp1 = stpname.getEditText().getText().toString(); String temp2 = String.valueOf(temp1.charAt(temp1.indexOf("-"))); int i = temp2.compareTo("-"); if (i == 0) { valid = true; stpname.setErrorEnabled(false); } else { stpname.setErrorEnabled(true); stpname.setError("Please Enter Stop Name in character only"); valid = false; button1.expand(); } } else { valid = true; stpname.setErrorEnabled(false); } } if (valid) { if (kilometre.getEditText().getText().toString().isEmpty()) { kilometre.setError("value must contain digit"); valid = false; button1.expand(); } else { if (TextUtils.isEmpty(kilometre.getEditText().getText().toString())) { kilometre.setErrorEnabled(true); kilometre.setError("Please Enter Kilometre"); valid = false; button1.expand(); } else { Pattern ps = Pattern.compile("^[0-9.]+$"); Matcher ms = ps.matcher(kilometre.getEditText().getText().toString()); if (!ms.matches()) { kilometre.setErrorEnabled(true); kilometre.setError("Please Enter Kilometre In Digit Only"); valid = false; button1.expand(); } else { valid = true; kilometre.setErrorEnabled(false); } } } } } if (valid) { String FrPOint = getIntent().getExtras().getString("FPoint"); String LaPOint = getIntent().getExtras().getString("LPoint"); if (TextUtils.equals(FrPOint, stpname.getEditText().getText().toString()) | TextUtils.equals(LaPOint, stpname.getEditText().getText().toString())) { AlertDialog.Builder builder = new AlertDialog.Builder(Add_Sub_Rout.this); builder.setTitle("Oops...!"); builder.setMessage("This Rout Already Registered"); builder.setPositiveButton("Try Again", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.create().show(); valid = false; button1.expand(); } } return valid; } //Store Value To Database private void storeToDatabase() { String temp = stpname.getEditText().getText().toString(); String temp1 = stpname.getEditText().getText().toString(); temp = temp.replace("/", "--"); temp = temp.replace(".", "_"); store.setStp_Name(temp); store.setKilometre(Double.parseDouble(kilometre.getEditText().getText().toString())); dbstore.child(store.getStp_Name()).setValue(store).addOnCompleteListener(new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { if (task.isSuccessful()) { button1.expand(); Toast.makeText(Add_Sub_Rout.this, "Rout Register successfully", Toast.LENGTH_SHORT).show(); } else { button1.expand(); Toast.makeText(Add_Sub_Rout.this, "ERROR : " + task.getException().toString(), Toast.LENGTH_SHORT).show(); } } }); } //Initialize controls & object private void init() { //textView TXT_VIEW_kilometre = findViewById(R.id.Register_Sub_rout_Kilometre1); // button1 = (FancyButton) findViewById(R.id.RSR_ADD); //TextInputLayout stpname = findViewById(R.id.Sub_Rout_Name); kilometre = findViewById(R.id.Sub_Rout_Kilo_Meter); //Set User define Toolbar toolbar = findViewById(R.id.toolbar_RSR); setSupportActionBar(toolbar); toolbar.setSubtitle("Register Sub Rout"); // progressDialog=new ProgressDialog(Add_Sub_Rout.this); //Button //btnadd = findViewById(R.id.RSR_ADD); //ListView lstview = findViewById(R.id.RSR_LST); lstTitle = findViewById(R.id.RSR_Lst_Title); //Java Class store = new GetandSetRout(); retrieve = new GetandSetRout(); retrieve1 = new GetandSetRout(); retrieve2 = new GetandSetRout(); retrieve3 = new GetandSetRout(); //DatabaseReference dbretrieve2 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")).child(getIntent().getExtras().getString("LPoint")); dbstore = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); dbretrieve = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); dbretrieve1 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); dbretrieve3 = FirebaseDatabase.getInstance().getReference("stops").child(getIntent().getExtras().getString("Rout")); //ArrayList & RoutAdapter arrayList = new ArrayList<>(); arrayList1 = new ArrayList<>(); routsAdpater = new RoutsAdpater(this, R.layout.customize_list_view, arrayList); routsAdpater1 = new RoutsAdpater(this, R.layout.customize_list_view, arrayList1); arrayList1.add(new Routs("Sr.No.", "Stop Name", "Kilometre From Source")); lstTitle.setAdapter(routsAdpater1); //RetrieveFromDatabase retrieveFromDatabase(); } //Retrieve Value From Database private void retrieveFromDatabase() { dbretrieve.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { int i = 1; String temp; String temp1; String FiPoint = getIntent().getExtras().getString("FPoint"); String LaPoint = getIntent().getExtras().getString("LPoint"); routsAdpater.clear(); for (DataSnapshot iteam : dataSnapshot.getChildren()) { if (iteam.hasChildren()) { for (DataSnapshot sub : iteam.getChildren()) { if (sub.hasChildren()) { retrieve = sub.getValue(GetandSetRout.class); temp = retrieve.getStp_Name(); temp = temp.replace("_", "."); temp = temp.replace("--", "/"); temp1 = String.valueOf(retrieve.getKilometre()); temp1 = temp1.replace("_", "."); if (!TextUtils.equals(FiPoint, temp) & !TextUtils.equals(LaPoint, temp)) { arrayList.add(new Routs(String.valueOf(i), temp, temp1)); i += 1; break; } } else { retrieve = iteam.getValue(GetandSetRout.class); temp = retrieve.getStp_Name(); temp1 = String.valueOf(retrieve.getKilometre()); temp = temp.replace("_", "."); temp = temp.replace("--", "/"); temp1 = temp1.replace("_", "."); if (!TextUtils.equals(FiPoint, temp) & !TextUtils.equals(LaPoint, temp)) { arrayList.add(new Routs(String.valueOf(i), temp, temp1)); i += 1; } break; } } } } lstview.setAdapter(routsAdpater); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Toast.makeText(Add_Sub_Rout.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show(); } }); } private boolean isConnected() { boolean connected = false; try { ConnectivityManager cm = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo nInfo = cm.getActiveNetworkInfo(); connected = nInfo != null && nInfo.isConnected(); return connected; } catch (Exception e) { Log.e("Connectivity Exception", e.getMessage()); } return connected; } private void AlertDialogBox() { Dialog dialog = new Dialog(Add_Sub_Rout.this, R.style.NO_INTERNET_DIALOG); dialog.setContentView(R.layout.no_internet_dilog); dialog.setCancelable(false); dialog.show(); retry = dialog.findViewById(R.id.BTN_RETRY); retry.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); progressDialog.setCancelable(false); progressDialog.setTitle("Waiting For Connection.."); progressDialog.show(); startActivity(new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS)); new Handler().postDelayed(new Runnable() { @Override public void run() { if (!isConnected()) { progressDialog.dismiss(); AlertDialogBox(); } else { progressDialog.dismiss(); } } }, 5000); } }); } }
[ "d21it185@charusat.edu.in" ]
d21it185@charusat.edu.in
eb30e6df957b8429efd764c75a328149b4d4a9ad
c5765db45df294be9791e2fbcca65ffe2844bf22
/src/main/java/com/qd/modules/ws/utils/SmsBaseUtils.java
0bf46faf77d8d4451faebfd82ef7ae107bf2871f
[ "Apache-2.0" ]
permissive
guohaolei/harry
f7993f09a4c65982e69125769e46a85bc7473f45
54fca65e0c500d7705bcffcbb21f5830b9d23eda
refs/heads/master
2020-12-02T19:44:01.861952
2017-06-15T09:41:06
2017-06-15T09:41:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,737
java
package com.qd.modules.ws.utils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; public class SmsBaseUtils { public static String post(String path, String params) throws Exception { HttpURLConnection httpConn = null; BufferedReader in = null; PrintWriter out = null; try { URL url = new URL(path); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setRequestMethod("POST"); httpConn.setDoInput(true); httpConn.setDoOutput(true); // 发送post请求参数 out = new PrintWriter(httpConn.getOutputStream()); out.println(params); out.flush(); // 读取响应 if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) { StringBuffer content = new StringBuffer(); String tempStr = ""; in = new BufferedReader(new InputStreamReader(httpConn.getInputStream())); while ((tempStr = in.readLine()) != null) { content.append(tempStr); } return content.toString(); } else { throw new Exception("请求出现了问题!"); } } catch (IOException e) { e.printStackTrace(); } finally { in.close(); out.close(); httpConn.disconnect(); } return null; } public static String sendSMS(String id,String pwd,String to,String content,String url){ try { String param="id="+id+"&pwd="+pwd+"&to="+to+"&content="+URLEncoder.encode(content, "gb2312")+ "&time="; String resMessage = SmsBaseUtils.post(url,param); return resMessage; } catch (Exception e) { return e.getMessage().substring(0,500); } } }
[ "183865800@qq.com" ]
183865800@qq.com
19d6ff6341f4682ac1d091c8903e0297af358118
fb131c0362b36262149e8b871e85caf1c3e7d066
/src/org/apache/ibatis/ognl/ASTRemainder.java
2a9fc6904f4ec9d221f0629f3780f7dc009497be
[]
no_license
LastGhost00/IBATIS
c8bbf80a799dc986f7538572b3763b25d0eda595
9988ae34792a5458a14ed0ee774414023a33c68d
refs/heads/master
2021-05-11T06:50:41.300995
2018-01-18T16:37:24
2018-01-18T16:37:24
117,999,264
0
0
null
null
null
null
UTF-8
Java
false
false
2,460
java
// -------------------------------------------------------------------------- // Copyright (c) 1998-2004, Drew Davidson and Luke Blanshard // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // Neither the name of the Drew Davidson nor the names of its contributors // may be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED // AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. // -------------------------------------------------------------------------- package org.apache.ibatis.ognl; /** * @author Luke Blanshard (blanshlu@netscape.net) * @author Drew Davidson (drew@ognl.org) */ class ASTRemainder extends ExpressionNode { public ASTRemainder(int id) { super(id); } public ASTRemainder(OgnlParser p, int id) { super(p, id); } protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { Object v1 = children[0].getValue(context, source); Object v2 = children[1].getValue(context, source); return OgnlOps.remainder(v1, v2); } public String getExpressionOperator(int index) { return "%"; } }
[ "Administrator@THE" ]
Administrator@THE
ca40575b63dbc1a575b6146e4f385832993d2697
b078c0ec786a3a27739f40942b196ba971314610
/ignition-support/ignition-support-lib/src/main/java/com/github/ignition/support/http/MultipartRequestParams.java
5b61f0a7a7ae74df4ed5b457b7e25467247b2825
[ "Apache-2.0" ]
permissive
jonson/ignition
75cd76f0277d65dae177e9078439ec2c5bd947e0
bf3a5ab489d948b527175582bd40caebd4cb5e9b
refs/heads/master
2021-01-16T18:58:46.554110
2012-03-06T04:39:47
2012-03-06T04:39:47
3,526,429
0
0
null
null
null
null
UTF-8
Java
false
false
2,130
java
package com.github.ignition.support.http; import java.io.UnsupportedEncodingException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.apache.http.HttpEntity; import org.apache.http.client.entity.UrlEncodedFormEntity; import com.github.ignition.support.http.multipart.FilePart; import com.github.ignition.support.http.multipart.MultipartEntity; import com.github.ignition.support.http.multipart.StrictWriteTimeoutFilePart; import com.github.ignition.support.http.multipart.StringPart; /** * Alternative version of RequestParams that returns a MultipartEntity. * * @author jon * */ public class MultipartRequestParams extends RequestParams { private final int writeTimeoutMillis; public MultipartRequestParams(int writeTimeoutMillis) { this.writeTimeoutMillis = writeTimeoutMillis; } @Override HttpEntity getEntity() { HttpEntity entity = null; if(!fileParams.isEmpty()) { MultipartEntity multipartEntity = new MultipartEntity(); if (!fileParams.isEmpty()) { ExecutorService executor = Executors.newSingleThreadExecutor(); multipartEntity.setExecutor(executor); } // Add string params for(ConcurrentHashMap.Entry<String, String> entry : urlParams.entrySet()) { multipartEntity.addPart(new StringPart(entry.getKey(), entry.getValue())); } for(ConcurrentHashMap.Entry<String, FileWrapper> entry : fileParams.entrySet()) { FileWrapper wrapper = entry.getValue(); multipartEntity.addPart(new StrictWriteTimeoutFilePart(entry.getKey(), wrapper.file, wrapper.getFileName(), wrapper.contentType, writeTimeoutMillis)); } entity = multipartEntity; } else { try { entity = new UrlEncodedFormEntity(getParamsList(), ENCODING); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return entity; } }
[ "jdeyoung@gmail.com" ]
jdeyoung@gmail.com
6cc93b07f81cf4da9919d42094632078c01fdbb3
bac9e3154606bf919f5e233e1cd76c0d8b5af868
/src/main/java/com/sapana/day5/Piano.java
e09b7fd9b94407034ccd217434b15af63af569e2
[]
no_license
sapanarimal12/full-stack-java
8fa13b38a88fdb86eb97a145d52f4d533add02ec
313cdf638446ef3db9904a7b302619623a2385bf
refs/heads/master
2023-08-25T07:10:40.834889
2021-11-01T07:44:45
2021-11-01T07:44:45
379,908,637
0
0
null
null
null
null
UTF-8
Java
false
false
126
java
package com.sapana.day5; public class Piano { public void play(){ System.out.println("Playing Pino!!"); } }
[ "rimalsapanaaa55@gmail.com" ]
rimalsapanaaa55@gmail.com
0cdb825cda6affe07743c8b2ffbce28547043009
6f676ff17eb95791b8ac0d5e37957bbbd22d71e1
/src/main/java/com/jp/cursomc/config/S3Config.java
875b4769eeb1d351d68c1390d05370e5ac0fc5f6
[]
no_license
jpmelloelias/cursomc
3d0160c324e617fea020efe805293b846a5078c6
c55de4540f471f6bc144b2f46aab5d14d734d8bc
refs/heads/master
2021-06-19T11:06:40.580035
2019-12-12T12:57:21
2019-12-12T12:57:21
199,876,069
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package com.jp.cursomc.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; @Configuration public class S3Config { @Value("${aws.access_key_id}") private String awsId; @Value("${aws.secret_access_key}") private String awsKey; @Value("${s3.region}") private String region; @Bean public AmazonS3 s3Client() { BasicAWSCredentials awsCred = new BasicAWSCredentials(awsId, awsKey); AmazonS3 s3Client = AmazonS3ClientBuilder.standard().withRegion(Regions.fromName(region)) .withCredentials(new AWSStaticCredentialsProvider(awsCred)).build(); return s3Client; } }
[ "jpmelloelias@gmail.com" ]
jpmelloelias@gmail.com
488d1806ca1f1a5c3e502415236f753705255f84
ee930ea3660e80a3fac63de8420338a4481d77b3
/src/main/java/com/esotacredit/esotaapi/api/login/LoginResource.java
ed1f8acd95269a059ec21e9adac34b7d229a71b4
[]
no_license
francizevarist/esotaapi
fe76285440f355060a225c321f78d41bc71fe08b
b190db2f175378b66b700f14e4c01a3c0d774a4a
refs/heads/master
2020-07-19T06:15:30.433532
2019-09-04T18:55:51
2019-09-04T18:55:51
206,389,710
0
0
null
null
null
null
UTF-8
Java
false
false
810
java
package com.esotacredit.esotaapi.api.login; import com.esotacredit.esotaapi.api.login.datamodel.LoginBody; import com.esotacredit.esotaapi.api.login.datamodel.LoginResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @CrossOrigin(origins = "*", allowedHeaders = "*") @RestController public class LoginResource { @Autowired LoginDaoService service; @PostMapping("/login") LoginResponse loginToAccount(@RequestBody LoginBody loginBody){ return new LoginResponse(service.login(loginBody)); } }
[ "francizevarist@gmail.com" ]
francizevarist@gmail.com
c3ae4d3192f83701aa204b45ec938cfde58c1b04
3fc623097af581e523b0382938c19761332338f2
/src/holychordsdownloader/main/Start.java
b82ce5145e4dc1214e42bada6c5de6edcc486dfd
[]
no_license
davidwowa/HollyChordsDownloader
23c2bdc79021e08431d629145ecc4f84da422a70
2b1a69af4e87b847271342c85f9c9433c306fd82
refs/heads/master
2021-05-23T05:48:31.182864
2018-08-28T21:35:15
2018-08-28T21:35:15
94,945,828
0
0
null
null
null
null
UTF-8
Java
false
false
7,666
java
package holychordsdownloader.main; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import holychordsdownloader.action.ChooseFolderAction; import holychordsdownloader.action.LoadDataFromURLAction; import holychordsdownloader.bo.Song; import holychordsdownloader.data.Loader; import javafx.application.Application; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.TextField; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; import javafx.scene.media.MediaPlayer.Status; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Callback; public class Start extends Application { private static Logger logger = LoggerFactory.getLogger(Start.class); private ObservableList<Song> songs; private TableView<Song> commonTable = new TableView<>(songs); private Text messageField = new Text(); private Loader loader = new Loader(); public static void main(String[] args) { logger.info("start app holy chords"); launch(args); } private void initData() { if (logger.isDebugEnabled()) { logger.debug("init app"); } try { songs = loader.loadData(); } catch (IOException e) { if (logger.isErrorEnabled()) { logger.error("error on data loading ", e); } } } @Override public void start(Stage primaryStage) { initData(); if (logger.isDebugEnabled()) { logger.debug("init UI"); } primaryStage.setTitle("HolyChords Downloader v.0.1"); GridPane commonGrid = new GridPane(); commonGrid.setAlignment(Pos.TOP_CENTER); commonGrid.setHgap(10); commonGrid.setVgap(10); commonGrid.setPadding(new Insets(25, 25, 25, 25)); Scene commonScene = new Scene(commonGrid, 600, 600); // commonScene.getStylesheets().add("resources/css/button.css"); commonScene.getStylesheets().add(Start.class.getResource("button.css").toExternalForm()); Text scenetitle = new Text("Welcome to HolyChords Downloader v.0.1"); scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); commonGrid.add(scenetitle, 0, 0, 2, 1); Label labelDownloadFolder = new Label("Download Folder:"); commonGrid.add(labelDownloadFolder, 0, 1); TextField fieldDownloadFolder = new TextField(); commonGrid.add(fieldDownloadFolder, 1, 1); Button buttonChooseFolder = new Button("Choose Folder"); buttonChooseFolder.getStyleClass().add("button_choose_folder"); commonGrid.add(buttonChooseFolder, 2, 1); buttonChooseFolder.setOnAction(new ChooseFolderAction(fieldDownloadFolder, primaryStage)); Label labelURL = new Label("URL:"); commonGrid.add(labelURL, 0, 2); TextField fieldURL = new TextField(); commonGrid.add(fieldURL, 1, 2); Button buttonLoad = new Button("Load"); buttonLoad.getStyleClass().add("button_load_url"); commonGrid.add(buttonLoad, 2, 2); buttonLoad.setOnAction(new LoadDataFromURLAction(fieldURL, songs, commonTable)); commonTable.setEditable(false); // TableColumn<Song, String> colInterpreter = new // TableColumn<>("Interpreter"); // colInterpreter.setCellValueFactory(new PropertyValueFactory<Song, // String>("interpreter")); TableColumn<Song, String> colName = new TableColumn<>("Name"); colName.setCellValueFactory(new PropertyValueFactory<Song, String>("name")); TableColumn<Song, String> colAction = new TableColumn<>("Action"); // https://stackoverflow.com/questions/29489366/how-to-add-button-in-javafx-table-view colAction.setCellValueFactory(new PropertyValueFactory<>("DUMMY")); Callback<TableColumn<Song, String>, TableCell<Song, String>> cellFactory = // new Callback<TableColumn<Song, String>, TableCell<Song, String>>() { @Override public TableCell call(final TableColumn<Song, String> param) { final TableCell<Song, String> cell = new TableCell<Song, String>() { final Button buttonDownload = new Button("Download"); @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (empty) { setGraphic(null); setText(null); } else { buttonDownload.getStyleClass().add("button_download"); buttonDownload.setOnAction((ActionEvent event) -> { Song song = getTableView().getItems().get(getIndex()); String name = song.getName() + ".mp3"; messageField.setText("download : " + name); loader.download(song.getUrl(), fieldDownloadFolder.getText(), name, messageField); }); setGraphic(buttonDownload); setText(null); } } }; return cell; } }; colAction.setCellFactory(cellFactory); TableColumn<Song, String> colPlay = new TableColumn<>("Play"); // https://stackoverflow.com/questions/29489366/how-to-add-button-in-javafx-table-view colPlay.setCellValueFactory(new PropertyValueFactory<>("DUMMY2")); Callback<TableColumn<Song, String>, TableCell<Song, String>> cellFactoryPlay = // new Callback<TableColumn<Song, String>, TableCell<Song, String>>() { @Override public TableCell call(final TableColumn<Song, String> param) { final TableCell<Song, String> cell = new TableCell<Song, String>() { Media pik; MediaPlayer mediaPlayer; @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (empty) { setGraphic(null); setText(null); } else { Button playButton = new Button("Play"); playButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Song song = getTableView().getItems().get(getIndex()); if (pik == null && mediaPlayer == null) { pik = new Media(song.getUrl()); mediaPlayer = new MediaPlayer(pik); } if (Status.PLAYING != mediaPlayer.getStatus()) { if (logger.isDebugEnabled()) { logger.debug("playing " + song.getUrl()); } messageField.setText("playing : " + song.getName()); playButton.setText("Stop"); mediaPlayer.play(); } else { playButton.setText("Play"); mediaPlayer.stop(); } } }); setGraphic(playButton); setText(null); } } }; return cell; } }; colPlay.setCellFactory(cellFactoryPlay); commonTable.setItems(songs); commonTable.getColumns().addAll(colName, colAction, colPlay); Label tableLabel = new Label("Files:"); tableLabel.setFont(new Font("Arial", 14)); VBox tableVBox = new VBox(); tableVBox.setSpacing(5); tableVBox.setPadding(new Insets(10, 0, 0, 10)); tableVBox.getChildren().addAll(tableLabel, commonTable); commonGrid.add(tableVBox, 0, 3, 3, 1); Button buttonDownloadAll = new Button("Download All Songs"); buttonDownloadAll.getStyleClass().add("button_download_all"); commonGrid.add(buttonDownloadAll, 0, 4); commonGrid.add(messageField, 0, 5); primaryStage.setScene(commonScene); primaryStage.show(); } }
[ "wd.zakrevskyy@icloud.com" ]
wd.zakrevskyy@icloud.com
f82cbad7527e92e5bd0041e7748a11bfc7caeb1d
f78ff6871dc25b3189f1599a2e85da4bcfc4cdbe
/app/src/main/java/com/choirunnisa/physicaltest/DayaEksplosif/TataStandingActivity.java
e450628269dbe4260276a5924ee78665199a7357
[]
no_license
choirunnisa1/PhysicalTest
53696418f74667e462daf9d439020e08de0686c9
3ad09ae20cd5413f497e26dee9a23d545ba4bd48
refs/heads/master
2022-12-15T06:45:26.411781
2020-08-28T04:48:50
2020-08-28T04:48:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,626
java
package com.choirunnisa.physicaltest.DayaEksplosif; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.choirunnisa.physicaltest.R; import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.YouTubePlayer; import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.listeners.AbstractYouTubePlayerListener; import com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView; public class TataStandingActivity extends AppCompatActivity { YouTubePlayerView youTubePlayerView; private ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tata_standing); actionBar = getSupportActionBar(); actionBar.setTitle("Tata Cara Standing Long Jump Test"); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); youTubePlayerView = findViewById(R.id.youtube_player_view); getLifecycle().addObserver(youTubePlayerView); youTubePlayerView.addYouTubePlayerListener(new AbstractYouTubePlayerListener() { @Override public void onReady(@NonNull YouTubePlayer youTubePlayer) { String videoId = "7aIf3BdQLiE"; youTubePlayer.loadVideo(videoId, 0); } }); } @Override public boolean onSupportNavigateUp() { onBackPressed(); return super.onSupportNavigateUp(); } }
[ "nisaninda3@gmail.com" ]
nisaninda3@gmail.com
b1e0ef4167018f0f01a9fe8c170eec04d4624775
cec26a96fea500f1fbf9037a38944bdc173a774d
/app/src/main/java/com/example/hegua/androidwork/presenter/asynctask/FuzzyQuseryGoodsAsyncTask.java
ad9427dc6551b06fca7677b2255c673c91bb7113
[]
no_license
GJA-pun/Android_work
389088caa4f3f382cb7ccca5bb14289e986fd9ab
51b6d064fe5b5b0f2673999c06619ac4fdadd5b1
refs/heads/master
2020-03-26T05:17:36.116949
2018-08-13T08:14:44
2018-08-13T08:14:44
144,463,777
0
0
null
null
null
null
UTF-8
Java
false
false
2,751
java
package com.example.hegua.androidwork.presenter.asynctask; import android.os.AsyncTask; import com.example.hegua.androidwork.View.SearchBoxView; import com.example.hegua.androidwork.utils.MyStringCallback; import com.zhy.http.okhttp.OkHttpUtils; import java.io.UnsupportedEncodingException; import okhttp3.Call; /** * Created by hegua on 2018/8/8. */ /** * 1,Params 2,Progress 3,Result * Result doInBackground(Paraams... prarams) * onProgressUpdate(Progress...values) 在publishProgress()调用,时调用 * onProstExecute(Result result) 结束时 */ public class FuzzyQuseryGoodsAsyncTask extends AsyncTask<Void,String,Void>{ private String url; private SearchBoxView searchBoxView; public FuzzyQuseryGoodsAsyncTask(String url, SearchBoxView searchBoxView) { this.url = url; this.searchBoxView = searchBoxView; } @Override protected Void doInBackground(Void... voids) { OkHttpUtils .get() .url(url) .build() .execute(new MyStringCallback() { @Override public void onError(Call call, Exception e, int id) { publishProgress("NetWorkError"); System.out.println("FuzzyQuseryGoodsonError----------->"+e); } @Override public void onResponse(byte[] response, int id) { String sresponse = null; try { sresponse = new String(response,"utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (sresponse!=null&&sresponse.equals("[]")==false&&sresponse.equals("")==false){ publishProgress("data",sresponse); }else{ publishProgress("Null"); } } }); return null; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); } @Override protected void onProgressUpdate(String... values) { if (values[0].equals("NetWorkError")){ searchBoxView.showNetWorkError(); }else if (values[0].equals("Null")){ searchBoxView.showFuzzyQuseryGoodsDataNull("没有找到相应的商品"); }else if (values[0].equals("data")){ searchBoxView.showFuzzyQuseryGoodsData(values[1]); } super.onProgressUpdate(values); } }
[ "1185748312@qq.com" ]
1185748312@qq.com
2057305e3c49933f660f7da1df0bbcdcea1f1715
1e6ce2d3ac1d60ac89eb7ba39605ead29676970a
/lib-common/src/androidTest/java/me/itzhu/common/webapp/common/ExampleInstrumentedTest.java
dc4ddffb0508207e05be7c8142d2d31d2cac35d6
[]
no_license
itzhu/BBNote
bceb8c4e82f9b748b3c76e814920f7a9ebb28282
b313da4fd835c1906a31e7db239cdace21000fc6
refs/heads/master
2021-04-12T11:25:15.641475
2018-03-27T10:13:52
2018-03-27T10:13:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package me.itzhu.common.webapp.common; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("me.itzhu.common.webapp.lib_common.test", appContext.getPackageName()); } }
[ "itzhu@foxmail.com" ]
itzhu@foxmail.com
26de1e69eee050e31eb275be8b8775e8877d4bd9
8b503e70defde744fd41ef26a1720cfc25aaae6e
/practice-1/src/bubble_sort.java
9418b24189be2580c644f1e9866322dd1823379d
[]
no_license
nitheeshasingireddy/batchupload
fe353b00fe1814f70b63a44819632bdb6024021a
7c20dd53eb1a59fdb4c4fce40ec3d47c03fb591a
refs/heads/master
2021-09-15T16:39:35.469808
2018-03-04T01:46:54
2018-03-04T01:46:54
122,886,071
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
public class bubble_sort { static void bubble(int a[]) { int l = a.length; int temp,x,y; for(int i =0;i<l;i++) { for(int j = 1;j<l-i;j++) { if(a[j-1]>a[j]) { temp = a[j-1]; a[j-1]=a[j]; a[j] = temp; } } } } public static void main(String args[]) { int a[] = {1,3,56,4,43,36,7}; for(int i=0;i<a.length;i++) { System.out.print(a[i]+" "); } bubble(a); System.out.println("\n after sorting \n"); for(int i =0;i<a.length;i++) { System.out.print(a[i]+" "); } } }
[ "nithi@DESKTOP-G6RF7TU" ]
nithi@DESKTOP-G6RF7TU
e989afe6db7454fafea719af783450759b1f31c8
eba91d49ef83184aceda77794230157c277f9315
/128-longest-consecutive-sequence/longest-consecutive-sequence.java
ab3af30cf285d8d02adc59220f323395a8e451e0
[]
no_license
FutureKen/Coding-Practice
8f12540e57d60a140f5900f929b25f224f39448a
e0787d6e141b38b5991dab7ecdf466ff6f955f12
refs/heads/master
2021-01-23T22:00:04.303906
2017-01-04T10:33:13
2017-01-04T10:33:13
57,018,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
// Given an unsorted array of integers, find the length of the longest consecutive elements sequence. // // // For example, // Given [100, 4, 200, 1, 3, 2], // The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4. // // // Your algorithm should run in O(n) complexity. public class Solution { public int longestConsecutive(int[] nums) { HashMap<Integer, Integer> hash = new HashMap<Integer, Integer>(); int max = 1; for (int i : nums){ hash.put(i, 0); } for (int i : nums){ if (hash.get(i) == 1) { continue; } int temp = i; int cmax = 1; while (hash.containsKey(temp+1)) { cmax++; hash.put(temp++, 1); } temp = i; while (hash.containsKey(temp-1)) { cmax++; hash.put(temp--, 1); } max = Math.max(max, cmax); } return max; } }
[ "zhaohaozhou@gmail.com" ]
zhaohaozhou@gmail.com
e7f366f7ba72c274b9826e1a379356f2590cd3d6
7c83b3cf100af54fc1aa9b82b9367f9a58696372
/src/main/java/org/lanternpowered/server/data/io/UserIO.java
506013453f7291f66ba48be39d82102ee24f3e2f
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
GustaveHooghmoed/LanternServer
c971eb284fdc18554f4aceefef47f40f116e4f14
61b3d181e87d571bcea01fbab8093a0a718578f8
refs/heads/master
2021-05-14T14:29:46.643758
2017-09-21T13:15:46
2017-12-30T14:10:59
115,972,253
1
0
null
2018-01-02T03:48:32
2018-01-02T03:48:32
null
UTF-8
Java
false
false
5,911
java
/* * This file is part of LanternServer, licensed under the MIT License (MIT). * * Copyright (c) LanternPowered <https://www.lanternpowered.org> * Copyright (c) SpongePowered <https://www.spongepowered.org> * Copyright (c) contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the Software), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.lanternpowered.server.data.io; import org.lanternpowered.server.data.DataQueries; import org.lanternpowered.server.data.io.store.ObjectStore; import org.lanternpowered.server.data.io.store.ObjectStoreRegistry; import org.lanternpowered.server.data.persistence.nbt.NbtStreamUtils; import org.lanternpowered.server.entity.living.player.AbstractUser; import org.spongepowered.api.data.DataContainer; import org.spongepowered.api.data.DataQuery; import org.spongepowered.api.data.DataView; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Optional; import java.util.UUID; public final class UserIO { private final static Path SPONGE_PLAYER_DATA_FOLDER = Paths.get("data", "sponge"); private final static Path PLAYER_DATA_FOLDER = Paths.get("playerdata"); private final static Path STATISTICS_FOLDER = Paths.get("stats"); private final static DataQuery NAME = DataQuery.of("Name"); public static boolean exists(Path dataFolder, UUID uniqueId) { final String fileName = uniqueId.toString() + ".dat"; final Path dataFile = dataFolder.resolve(PLAYER_DATA_FOLDER).resolve(fileName); return Files.exists(dataFile); } public static Optional<String> loadName(Path dataFolder, UUID uniqueId) throws IOException { final Path path = dataFolder.resolve(SPONGE_PLAYER_DATA_FOLDER).resolve(uniqueId.toString() + ".dat"); if (Files.exists(path)) { return NbtStreamUtils.read(Files.newInputStream(path), true).getString(NAME); } return Optional.empty(); } public static void load(Path dataFolder, AbstractUser player) throws IOException { final String fileName = player.getUniqueId().toString() + ".dat"; // Search for the player data and load it Path dataFile = dataFolder.resolve(PLAYER_DATA_FOLDER).resolve(fileName); if (Files.exists(dataFile)) { final DataContainer dataContainer = NbtStreamUtils.read(Files.newInputStream(dataFile), true); // Load sponge data if present and attach it to the main data dataFile = dataFolder.resolve(SPONGE_PLAYER_DATA_FOLDER).resolve(fileName); if (Files.exists(dataFile)) { final DataContainer spongeDataContainer = NbtStreamUtils.read(Files.newInputStream(dataFile), true); dataContainer.set(DataQueries.EXTENDED_SPONGE_DATA, spongeDataContainer); } final ObjectStore<AbstractUser> objectStore = ObjectStoreRegistry.get().get(AbstractUser.class).get(); objectStore.deserialize(player, dataContainer); } final Path statisticsFile = dataFolder.resolve(STATISTICS_FOLDER).resolve(player.getUniqueId().toString() + ".json"); if (Files.exists(statisticsFile)) { player.getStatisticMap().load(statisticsFile); } } public static void save(Path dataFolder, AbstractUser player) throws IOException { final String fileName = player.getUniqueId().toString() + ".dat"; final DataContainer dataContainer = DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED); final ObjectStore<AbstractUser> objectStore = ObjectStoreRegistry.get().get(AbstractUser.class).get(); objectStore.serialize(player, dataContainer); final Optional<DataView> optSpongeData = dataContainer.getView(DataQueries.EXTENDED_SPONGE_DATA); dataContainer.remove(DataQueries.EXTENDED_SPONGE_DATA); Path dataFolder0 = dataFolder.resolve(PLAYER_DATA_FOLDER); if (!Files.exists(dataFolder0)) { Files.createDirectories(dataFolder0); } Path dataFile = dataFolder0.resolve(fileName); NbtStreamUtils.write(dataContainer, Files.newOutputStream(dataFile), true); dataFolder0 = dataFolder.resolve(SPONGE_PLAYER_DATA_FOLDER); if (!Files.exists(dataFolder0)) { Files.createDirectories(dataFolder0); } dataFile = dataFolder0.resolve(fileName); if (optSpongeData.isPresent()) { final DataView spongeData = optSpongeData.get(); spongeData.set(NAME, player.getName()); NbtStreamUtils.write(spongeData, Files.newOutputStream(dataFile), true); } else { Files.deleteIfExists(dataFile); } final Path statisticsFile = dataFolder.resolve(STATISTICS_FOLDER).resolve(player.getUniqueId().toString() + ".json"); player.getStatisticMap().save(statisticsFile); } private UserIO() { } }
[ "seppevolkaerts@hotmail.com" ]
seppevolkaerts@hotmail.com
d1d6772bf1f70434b05d8c69dc4b381e9d04ffb1
d6e1e33cc2441b89100ff4a172d141dc79b2ffbc
/Disruptor/src/test/com/baidu/disruptor/pattern/ReplicateThenFoldback.java
be636bf58ce0697547d84bf9f05f20145934d73b
[]
no_license
renguiqiang/zhzhdisruptor
0d9aaffa7ecf0e58ac3a6cc17f0d11b4ffbca90a
53e12a5c9de31534866b84d269c16b919deb5861
refs/heads/master
2016-09-06T13:28:40.891704
2014-02-14T09:25:03
2014-02-14T09:25:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,258
java
package com.baidu.disruptor.pattern; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.baidu.disruptor.ValueEvent; import com.lmax.disruptor.BatchEventProcessor; import com.lmax.disruptor.EventFactory; import com.lmax.disruptor.EventHandler; import com.lmax.disruptor.RingBuffer; import com.lmax.disruptor.SequenceBarrier; import com.lmax.disruptor.SingleThreadedClaimStrategy; import com.lmax.disruptor.YieldingWaitStrategy; import com.lmax.disruptor.util.Util; /** * <b>Replicate a message then fold back the results</b> +-----+ track to prevent wrap +----->| EP1 |-----+ +-------------------------------+ | +-----+ | | | | v | v +----+ +-----+ +----+ +====+ +=====+ +-----+ | P1 | | EP3 | | P1 |--->| RB |<--------------| SB2 |<---| EP3 | +----+ +-----+ +----+ +====+ +=====+ +-----+ | ^ claim ^ get | waitFor | +-----+ | | | +----->| EP2 |-----+ +=====+ +-----+ | +-----+ | SB1 |<---| EP1 |<-----+ +=====+ +-----+ | ^ | | +-----+ | +-------| EP2 |<-----+ waitFor +-----+ */ public class ReplicateThenFoldback { public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); RingBuffer<ValueEvent> ringBuffer = new RingBuffer<ValueEvent>( new EventFactory<ValueEvent>() { @Override public ValueEvent newInstance() { return new ValueEvent(); } }, new SingleThreadedClaimStrategy(4), new YieldingWaitStrategy()); // SequenceBarrier SequenceBarrier barrier1 = ringBuffer.newBarrier(); // 第一个EventProcessor BatchEventProcessor<ValueEvent> processor1 = new BatchEventProcessor<ValueEvent>( ringBuffer, barrier1, new EventHandler<ValueEvent>() { @Override public void onEvent(ValueEvent event, long sequence, boolean endOfBatch) throws Exception { System.out.println("Value:" + event.getValue() + ":Thread.id-" + Thread.currentThread().getId()); } }); // 第二个Processor BatchEventProcessor<ValueEvent> processor2 = new BatchEventProcessor<ValueEvent>( ringBuffer, barrier1, new EventHandler<ValueEvent>() { @Override public void onEvent(ValueEvent event, long sequence, boolean endOfBatch) throws Exception { System.out.println("Value:" + event.getValue() + ":Thread.id-" + Thread.currentThread().getId()); } }); SequenceBarrier barrier2 = ringBuffer.newBarrier(Util.getSequencesFor(processor1, processor2)); // 第三个Processor BatchEventProcessor<ValueEvent> processor3 = new BatchEventProcessor<ValueEvent>( ringBuffer, barrier2, new EventHandler<ValueEvent>() { @Override public void onEvent(ValueEvent event, long sequence, boolean endOfBatch) throws Exception { System.out.println("Value:" + event.getValue() + ":Thread.id-" + Thread.currentThread().getId()); } }); // 提供给生产者参考的消费者track ringBuffer.setGatingSequences(Util.getSequencesFor(processor3)); exec.execute(processor1); exec.execute(processor2); exec.execute(processor3); publish(ringBuffer, 20); } public static void publish(RingBuffer<ValueEvent> ringBuffer, int count) { for (int i = 0; i < count; i++) { long sequence = ringBuffer.next(); ValueEvent event = ringBuffer.get(sequence); event.setValue("number:" + i); // this could be more complex with // multiple fields System.out.println("Thread.id-" + Thread.currentThread().getId()); // make the event available to EventProcessors ringBuffer.publish(sequence); } } }
[ "renxiaoqiang1226@gmail.com" ]
renxiaoqiang1226@gmail.com
d0d1df181b0c1c7c8a926a172cf0ad860a9305b1
e59b5590497953dea52d5262fc20fd6afec3ea93
/games/flip/src/java/com/threerings/flip/client/FlipPanel.java
4ea255b432024dccdbfa127ae1bd5b51a0219e8e
[]
no_license
greyhavens/whirled-projects
b461ea519e19135242957285327388a881348253
83fa8a94a4eda97e392a7d40b3a9e01e67878c28
refs/heads/master
2021-01-10T10:56:39.009796
2015-12-14T21:38:09
2015-12-14T21:38:09
47,995,550
5
3
null
null
null
null
UTF-8
Java
false
false
683
java
// // $Id$ package com.threerings.flip.client; import java.awt.BorderLayout; import java.awt.Dimension; import com.threerings.crowd.client.PlacePanel; import com.whirled.util.WhirledContext; /** * Contains the UI for a game of flip. */ public class FlipPanel extends PlacePanel { /** The board view. */ public FlipBoardView view; /** * Create the flip panel. */ public FlipPanel (WhirledContext ctx, FlipController ctrl) { super(ctrl); setLayout(new BorderLayout()); view = new FlipBoardView(ctx, ctrl); add(view, BorderLayout.CENTER); // TODO setPreferredSize(new Dimension(450, 600)); } }
[ "mdb@threerings.net" ]
mdb@threerings.net
1371b0697a84372759c3e38d9fe2b76f81282597
19ca7adb6bdd190420471c6ef9bbe21e898a6240
/Ciphers/VigenereCipher.java
0d7381076e6da8180624669e9f8e5fef8ea46397
[]
no_license
monir06/Algorithms-1
69759886ba1ed4029bbd56bbeb48698f3845e68a
e7295b395054237ba4f7388c165947fbbdacc8a2
refs/heads/master
2020-03-19T19:11:40.465120
2018-02-02T17:45:48
2018-02-02T17:45:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
837
java
class VigenereCipher { public static String encrypt(String plainText, String key) { String result = ""; for (int i = 0, j = 0; i < plainText.length(); i++) { char ch = plainText.charAt(i); result += (char)(((int)ch + key.charAt(j) - 2 * 65) % 26 + 65); j = (++j) % key.length(); } return result; } public static String decrypt(String cipherText, String key) { String result = ""; for (int i = 0, j = 0; i < cipherText.length(); i++) { char ch = cipherText.charAt(i); result += (char)(((int)ch - key.charAt(j) + 26) % 26 + 65); j = (++j) % key.length(); } return result; } public static void main(String[] args) { String key = "AYUSH"; String str = "GEEKSFORGEEKS"; String cipherText = encrypt(str, key); System.out.println(cipherText); System.out.println(decrypt(cipherText, key)); } }
[ "sid6327@gmail.com" ]
sid6327@gmail.com
41ceca4aed702581279ea743d005077e23384663
b7224d58630722183fbf3a8fe70f49f607a2472d
/src/main/java/com/chenva/usermember/service/UserMemberService.java
1dc00405eac0142e9463c37655afe85d707aa5c7
[]
no_license
zjk25673578/mytest
e61a2c7285cd11b231e52b761475582300661ace
71efc1c3bc01ff0a5371a071ba13e1e8bd760ba3
refs/heads/master
2020-04-12T10:17:13.272556
2018-12-20T03:26:07
2018-12-20T03:26:07
162,424,643
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.chenva.usermember.service; import com.chenva.usermember.model.UserMember; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 用户成员表 服务类 * </p> * * @author zjk * @since 2018-12-20 */ public interface UserMemberService extends IService<UserMember> { }
[ "25673578@qq.com" ]
25673578@qq.com
446445ba6831dd15fda904359034eb05ee670694
83f1dd890ea893442113f5f8e13d955ba3cdf9b7
/src/systemTime.java
ccc4f53d48247533ea83a615c451d9c1d6419b28
[]
no_license
Tuananh28597/JavaBai1
20f870f41b685af568876d6c0e968741fa9f588e
24936f1030327bfa93d18961b56bf0fb1b469f65
refs/heads/master
2023-06-27T04:34:09.265927
2021-08-04T06:51:25
2021-08-04T06:51:25
392,581,707
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
import java.util.Date; public class systemTime { public static void main(String[] args) { Date now = new Date(); //lay ra thoi gian hien tai System.out.println("Now is: " + now); } }
[ "86956980+Tuananh28597@users.noreply.github.com" ]
86956980+Tuananh28597@users.noreply.github.com
1a4dea3b0da0269e46c465dcbf329055b3ff9a5d
502dcdd6b5ac9c4c8318db4e522ba9440cc914dc
/src/com/tlys/dic/model/DicSinodepartment.java
27abe73b7372acc34ea8910d2057fad9dea4458a
[ "Apache-2.0" ]
permissive
icedreamer/test
f3948a2274ea01a86b3e1317f16187b5221f2188
e492b219fc7cff27c6ce631d07619f1ac3637e87
refs/heads/master
2021-01-10T10:18:33.574898
2019-08-16T09:26:14
2019-08-16T09:26:14
51,994,723
0
0
null
null
null
null
UTF-8
Java
false
false
6,309
java
package com.tlys.dic.model; // default package import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; /** * DicSinodepartment entity. * * @author MyEclipse Persistence Tools */ @Entity @Table(name = "TB_ZBC_DIC_SINODEPARTMENT" ) @org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true) public class DicSinodepartment implements java.io.Serializable { // Fields private String sinodepaid; private String fullname; private String shortname; private String address; private String dutyperson; private String telephones; private String fax; private String contactperson; private String issalecorp; private String isreceiver; private String issender; private String parentid; private String isactive; private String description; private Date createdtime; private String issalecorpDIC; private String isreceiverDIC; private String issenderDIC; private String parentidDIC; private String isactiveDIC; /** default constructor */ public DicSinodepartment() { } /** minimal constructor */ public DicSinodepartment(String sinodepaid, String fullname, String shortname, String issalecorp, String isreceiver, String issender, String parentid, String isactive) { this.sinodepaid = sinodepaid; this.fullname = fullname; this.shortname = shortname; this.issalecorp = issalecorp; this.isreceiver = isreceiver; this.issender = issender; this.parentid = parentid; this.isactive = isactive; } /** full constructor */ public DicSinodepartment(String sinodepaid, String fullname, String shortname, String address, String dutyperson, String telephones, String fax, String contactperson, String issalecorp, String isreceiver, String issender, String parentid, String isactive, String description, Date createdtime) { this.sinodepaid = sinodepaid; this.fullname = fullname; this.shortname = shortname; this.address = address; this.dutyperson = dutyperson; this.telephones = telephones; this.fax = fax; this.contactperson = contactperson; this.issalecorp = issalecorp; this.isreceiver = isreceiver; this.issender = issender; this.parentid = parentid; this.isactive = isactive; this.description = description; this.createdtime = createdtime; } // Property accessors @Id @Column(name = "SINODEPAID", unique = true, nullable = false, length = 6) public String getSinodepaid() { return this.sinodepaid; } public void setSinodepaid(String sinodepaid) { this.sinodepaid = sinodepaid; } @Column(name = "FULLNAME", nullable = false, length = 100) public String getFullname() { return this.fullname; } public void setFullname(String fullname) { this.fullname = fullname; } @Column(name = "SHORTNAME", nullable = false, length = 30) public String getShortname() { return this.shortname; } public void setShortname(String shortname) { this.shortname = shortname; } @Column(name = "ADDRESS", length = 200) public String getAddress() { return this.address; } public void setAddress(String address) { this.address = address; } @Column(name = "DUTYPERSON", length = 40) public String getDutyperson() { return this.dutyperson; } public void setDutyperson(String dutyperson) { this.dutyperson = dutyperson; } @Column(name = "TELEPHONES", length = 60) public String getTelephones() { return this.telephones; } public void setTelephones(String telephones) { this.telephones = telephones; } @Column(name = "FAX", length = 60) public String getFax() { return this.fax; } public void setFax(String fax) { this.fax = fax; } @Column(name = "CONTACTPERSON", length = 40) public String getContactperson() { return this.contactperson; } public void setContactperson(String contactperson) { this.contactperson = contactperson; } @Column(name = "ISSALECORP", nullable = false, length = 1) public String getIssalecorp() { return this.issalecorp; } public void setIssalecorp(String issalecorp) { this.issalecorp = issalecorp; } @Column(name = "ISRECEIVER", nullable = false, length = 1) public String getIsreceiver() { return this.isreceiver; } public void setIsreceiver(String isreceiver) { this.isreceiver = isreceiver; } @Column(name = "ISSENDER", nullable = false, length = 1) public String getIssender() { return this.issender; } public void setIssender(String issender) { this.issender = issender; } @Column(name = "PARENTID", nullable = false, length = 8) public String getParentid() { return this.parentid; } public void setParentid(String parentid) { this.parentid = parentid; } @Column(name = "ISACTIVE", nullable = false, length = 1) public String getIsactive() { return this.isactive; } public void setIsactive(String isactive) { this.isactive = isactive; } @Column(name = "DESCRIPTION", length = 120) public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } @Temporal(TemporalType.DATE) @Column(name = "CREATEDTIME", length = 7) public Date getCreatedtime() { return this.createdtime; } public void setCreatedtime(Date createdtime) { this.createdtime = createdtime; } @Transient public String getIssalecorpDIC() { return issalecorpDIC; } public void setIssalecorpDIC(String issalecorpDIC) { this.issalecorpDIC = issalecorpDIC; } @Transient public String getIsreceiverDIC() { return isreceiverDIC; } public void setIsreceiverDIC(String isreceiverDIC) { this.isreceiverDIC = isreceiverDIC; } @Transient public String getIssenderDIC() { return issenderDIC; } public void setIssenderDIC(String issenderDIC) { this.issenderDIC = issenderDIC; } @Transient public String getParentidDIC() { return parentidDIC; } public void setParentidDIC(String parentidDIC) { this.parentidDIC = parentidDIC; } @Transient public String getIsactiveDIC() { return isactiveDIC; } public void setIsactiveDIC(String isactiveDIC) { this.isactiveDIC = isactiveDIC; } @Override public String toString() { return shortname; } }
[ "liang.zhang@pcitc.com" ]
liang.zhang@pcitc.com
f0365b1c7b743ec600435c62dadb28cc904bf790
d08dc83f2af54104c0f79bc5fff6faed09f2d837
/app/src/main/java/com/roix/inhype/pojo/Comment.java
1b6476755362bc2d49bffaaf792868191f37e156
[]
no_license
roixa/InHype
252af55987218100d8b38891bbf71dbe863f89b1
ea608b005a295c4416ab8fe7f05f18ae30d171a2
refs/heads/master
2020-12-03T04:14:17.697045
2018-01-13T03:16:59
2018-01-13T03:16:59
95,836,354
0
0
null
null
null
null
UTF-8
Java
false
false
1,673
java
package com.roix.inhype.pojo; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.roix.inhype.RoixRecyclerAdapter; /** * Created by roix on 07.06.2017. */ public class Comment implements RoixRecyclerAdapter.RoixDataItem { @SerializedName("identifier") @Expose private Integer identifier; @SerializedName("authorId") @Expose private Integer authorId; @SerializedName("text") @Expose private String text; @SerializedName("date") @Expose private String date; private ProfileShort profile; public ProfileShort getProfile() { return profile; } public void setProfile(ProfileShort profile) { this.profile = profile; } public Integer getIdentifier() { return identifier; } public void setIdentifier(Integer identifier) { this.identifier = identifier; } public Integer getAuthorId() { return authorId; } public void setAuthorId(Integer authorId) { this.authorId = authorId; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } @Override public void copy(RoixRecyclerAdapter.RoixDataItem item) { Comment comment= (Comment) item; setText(comment.getText()); setAuthorId(comment.getAuthorId()); setDate(comment.getDate()); setIdentifier(comment.getIdentifier()); setProfile(comment.getProfile()); } }
[ "belyalov@azoft.com" ]
belyalov@azoft.com
4812e2e99ac590621edca66db03245621ef5b028
914630b434078193ab8d05aa9021b306fb38eb02
/src/spring_files/java/com/dtcc/todos/repository/TodoJpaRepository.java
cc6830a5a4d1d0d41586219d6eb498ff8f80bc06
[]
no_license
charujamnis/todo-app
398e891ac76ccf50f20da4739737babb3b510f61
afba633b2ea3b8b6c5fca41e53f9128fe598b11c
refs/heads/master
2023-07-14T06:41:25.456619
2021-08-30T14:52:20
2021-08-30T14:52:20
397,672,444
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.dtcc.todos.repository; import com.dtcc.todos.beans.Todo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface TodoJpaRepository extends JpaRepository<Todo,Long> { List<Todo> findByUsername(String username); }
[ "charushila.jamnis@gmail.com" ]
charushila.jamnis@gmail.com
aa93743a14dafe29ae7099b26649357ddbcb9ff8
e97d8f41e2ea6082fd344368a041ae150c239754
/src/cc/flydev/launcher/AppsCustomizeCellLayout.java
7c5c786d7b9273d37931a96d4d3356707db2aee6
[ "Apache-2.0" ]
permissive
flyui/FlyFace
2b60361ad712e57f97bb07695f99821633bafe71
73fd057caf83c80595257f008890663ba6327d69
refs/heads/master
2016-09-11T04:10:33.064025
2014-04-08T14:23:10
2014-04-08T14:23:10
18,521,237
0
0
null
null
null
null
UTF-8
Java
false
false
1,813
java
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cc.flydev.launcher; import android.content.Context; import android.view.View; public class AppsCustomizeCellLayout extends CellLayout implements Page { public AppsCustomizeCellLayout(Context context) { super(context); } @Override public void removeAllViewsOnPage() { removeAllViews(); setLayerType(LAYER_TYPE_NONE, null); } @Override public void removeViewOnPageAt(int index) { removeViewAt(index); } @Override public int getPageChildCount() { return getChildCount(); } @Override public View getChildOnPageAt(int i) { return getChildAt(i); } @Override public int indexOfChildOnPage(View v) { return indexOfChild(v); } /** * Clears all the key listeners for the individual icons. */ public void resetChildrenOnKeyListeners() { ShortcutAndWidgetContainer children = getShortcutsAndWidgets(); int childCount = children.getChildCount(); for (int j = 0; j < childCount; ++j) { children.getChildAt(j).setOnKeyListener(null); } } }
[ "root@FLYDEV-K43SD.(none)" ]
root@FLYDEV-K43SD.(none)
f73f39d6d1d1ad3bf2501ea90373c8f4bc6cb261
6bd0068cff15add9fa54b13c93495ba1f69c823a
/app/src/main/java/com/example/jason/stressreliefapp/model/FragmentFour.java
096fe9bffe3e563a894e2718f77a04352cdea915
[]
no_license
dci05049/StressReliefAPP
c4cc09dfc5d7b5735ff98217cbdbe31755246766
257a94e518dad6e33860f2e83367160cb7adc602
refs/heads/master
2021-01-12T04:32:39.253483
2017-01-20T05:52:23
2017-01-20T05:52:23
77,646,305
0
1
null
null
null
null
UTF-8
Java
false
false
659
java
package com.example.jason.stressreliefapp.model; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.jason.stressreliefapp.R; /** * Created by dndql on 2017-01-03. */ public class FragmentFour extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_four_layout, container, false); } }
[ "woongbinchoi@gmail.com" ]
woongbinchoi@gmail.com
7c4948a1297fe9368793628c75f30685fd19583a
bcf4757d197816dab860456f83c8a5a4a76c1682
/src/main/java/com/zzu/booking_manager/location/LocationController.java
cf92ba309be60b56a6eaa623fd567900b11d7d56
[]
no_license
zzuxgzh/booking_service
f15c2485e2ec040bd123a11e54e3c93407d6dc80
a8d58e2e0f479365ad66f3e3613fc08f7245e2c9
refs/heads/master
2022-12-08T04:48:21.797429
2020-08-22T08:04:29
2020-08-22T08:04:29
277,310,706
0
0
null
null
null
null
UTF-8
Java
false
false
1,205
java
package com.zzu.booking_manager.location; import com.zzu.booking_manager.location.locationService.ILocationService; import com.zzu.entity.Location; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @Controller @RequestMapping("/data/manager/location/") public class LocationController { @Autowired private ILocationService ils; @GetMapping("getLocationsTree") @ResponseBody public List<LocationParam> getLocationsTree(){ return ils.getLocationsTree(); } @ResponseBody @GetMapping("getProvinceList") public List<CodeNamePair> getProvinceList(){ return ils.getProvinceList(); } @ResponseBody @GetMapping("getCityList") public List<CodeNamePair> getCityList(String prv){ return ils.getCityList(prv); } @ResponseBody @GetMapping("getTownList") public List<CodeNamePair> getTownList(String cty){ return ils.getTownList(cty); } }
[ "ChenxiLi@DESKTOP-11UI8I5" ]
ChenxiLi@DESKTOP-11UI8I5
7e25fa45b64d244a9bfa0584ff8eaf00aeeaf2b6
f447846f7413c8fa7927be41a52426440efed67b
/app/src/main/java/come/example/mysbd/WeekThreeFragment.java
407f8c2bacd4cf8e2fcdfd0e2c0e00f3a78be1b5
[]
no_license
oloakeem/mySBD
749e31790aa7d310d87bdd7bab60d6b562e48f6b
80b577ff9c3b85899b9eb7ebad2e78f0e34ae8ab
refs/heads/main
2023-03-08T11:40:28.812557
2021-02-24T08:12:08
2021-02-24T08:12:08
315,120,268
0
0
null
null
null
null
UTF-8
Java
false
false
2,653
java
package come.example.mysbd; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.GridLayout; import android.widget.ImageView; import android.widget.TextView; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import androidx.viewpager.widget.ViewPager; import com.google.android.material.tabs.TabLayout; import java.util.ArrayList; import java.util.List; public class WeekThreeFragment extends Fragment { List<Model> models; ViewPager viewPager; DayAdapter adapter; TabLayout tabLayout; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.day_pager, container, false); TextView textView = view.findViewById(R.id.thisWeek); textView.setText("Week 3"); models = new ArrayList<>(); models.add(new Model("Day One","Day 9",R.drawable.yellow_background)); models.add(new Model("Day Two","Day 10", R.drawable.purple_background)); models.add(new Model("Day Three","Day 11",R.drawable.red_background)); models.add(new Model("Day Four", "Day 12",R.drawable.blue_background)); adapter = new DayAdapter(models,getContext(), new WeekThreeDays(),3); tabLayout = view.findViewById(R.id.DayTracker); viewPager = view.findViewById(R.id.myNewViewPager); viewPager.setAdapter(adapter); viewPager.setPadding(100, 0, 100, 0); tabLayout.setupWithViewPager(viewPager); viewPager.setPageTransformer(true, new ViewPager.PageTransformer() { @Override public void transformPage(View page, float position) { final float normalizedposition = Math.abs(Math.abs(position) - 1); page.setAlpha(normalizedposition); } }); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { if (position < (adapter.getCount() - 1) && position < (3 - 1)) { } else { if(position<=2){ } } } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); return view; } }
[ "74876042+oloakeem@users.noreply.github.com" ]
74876042+oloakeem@users.noreply.github.com
4e3b56d2c339c3f6e5665b5197553abc5a53e5a4
d81629c014839da528e664a60fd6f15956e1b53b
/projects/log4j-core-extended/src/main/java/org/apache/logging/log4j/core/filter/ThreadContextMapFilter.java
34c025d000cf641278e47f854d1cf277adaa3cd8
[ "Apache-2.0" ]
permissive
inoueke-n/PADLA
4942b370a4050a72b39c718afcd42a6ff3729b16
1f78d171448656810bee7dcba3a858f168771b53
refs/heads/master
2022-10-29T09:21:57.034996
2020-03-13T11:35:29
2020-03-13T11:35:29
174,953,933
2
0
Apache-2.0
2022-10-25T21:12:49
2019-03-11T08:10:50
Java
UTF-8
Java
false
false
9,678
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache license, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the license for the specific language governing permissions and * limitations under the license. */ package org.apache.logging.log4j.core.filter; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.core.ContextDataInjector; import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.core.config.Node; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.config.plugins.PluginAliases; import org.apache.logging.log4j.core.config.plugins.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.impl.ContextDataInjectorFactory; import org.apache.logging.log4j.core.util.KeyValuePair; import org.apache.logging.log4j.message.Message; import org.apache.logging.log4j.util.IndexedReadOnlyStringMap; import org.apache.logging.log4j.util.PerformanceSensitive; import org.apache.logging.log4j.util.ReadOnlyStringMap; /** * Filter based on a value in the Thread Context Map (MDC). */ @Plugin(name = "ThreadContextMapFilter", category = Node.CATEGORY, elementType = Filter.ELEMENT_TYPE, printObject = true) @PluginAliases("ContextMapFilter") @PerformanceSensitive("allocation") public class ThreadContextMapFilter extends MapFilter { private final ContextDataInjector injector = ContextDataInjectorFactory.createInjector(); private final String key; private final String value; private final boolean useMap; public ThreadContextMapFilter(final Map<String, List<String>> pairs, final boolean oper, final Result onMatch, final Result onMismatch) { super(pairs, oper, onMatch, onMismatch); if (pairs.size() == 1) { final Iterator<Map.Entry<String, List<String>>> iter = pairs.entrySet().iterator(); final Map.Entry<String, List<String>> entry = iter.next(); if (entry.getValue().size() == 1) { this.key = entry.getKey(); this.value = entry.getValue().get(0); this.useMap = false; } else { this.key = null; this.value = null; this.useMap = true; } } else { this.key = null; this.value = null; this.useMap = true; } } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object... params) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final Object msg, final Throwable t) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final Message msg, final Throwable t) { return filter(); } private Result filter() { boolean match = false; if (useMap) { ReadOnlyStringMap currentContextData = null; final IndexedReadOnlyStringMap map = getStringMap(); for (int i = 0; i < map.size(); i++) { if (currentContextData == null) { currentContextData = currentContextData(); } final String toMatch = currentContextData.getValue(map.getKeyAt(i)); match = toMatch != null && ((List<String>) map.getValueAt(i)).contains(toMatch); if ((!isAnd() && match) || (isAnd() && !match)) { break; } } } else { match = value.equals(currentContextData().getValue(key)); } return match ? onMatch : onMismatch; } private ReadOnlyStringMap currentContextData() { return injector.rawContextData(); } @Override public Result filter(final LogEvent event) { return super.filter(event.getContextData()) ? onMatch : onMismatch; } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, final Object p6) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, final Object p6, final Object p7) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, final Object p6, final Object p7, final Object p8) { return filter(); } @Override public Result filter(final Logger logger, final Level level, final Marker marker, final String msg, final Object p0, final Object p1, final Object p2, final Object p3, final Object p4, final Object p5, final Object p6, final Object p7, final Object p8, final Object p9) { return filter(); } // TODO Consider refactoring to use AbstractFilter.AbstractFilterBuilder @PluginFactory public static ThreadContextMapFilter createFilter( @PluginElement("Pairs") final KeyValuePair[] pairs, @PluginAttribute("operator") final String oper, @PluginAttribute("onMatch") final Result match, @PluginAttribute("onMismatch") final Result mismatch) { if (pairs == null || pairs.length == 0) { LOGGER.error("key and value pairs must be specified for the ThreadContextMapFilter"); return null; } final Map<String, List<String>> map = new HashMap<>(); for (final KeyValuePair pair : pairs) { final String key = pair.getKey(); if (key == null) { LOGGER.error("A null key is not valid in MapFilter"); continue; } final String value = pair.getValue(); if (value == null) { LOGGER.error("A null value for key " + key + " is not allowed in MapFilter"); continue; } List<String> list = map.get(pair.getKey()); if (list != null) { list.add(value); } else { list = new ArrayList<>(); list.add(value); map.put(pair.getKey(), list); } } if (map.isEmpty()) { LOGGER.error("ThreadContextMapFilter is not configured with any valid key value pairs"); return null; } final boolean isAnd = oper == null || !oper.equalsIgnoreCase("or"); return new ThreadContextMapFilter(map, isAnd, match, mismatch); } }
[ "m-tys@sel-samba.ics.es.osaka-u.ac.jp" ]
m-tys@sel-samba.ics.es.osaka-u.ac.jp
e42d0a7cb7fb520cb6bdc32c46574f48184e5268
08f4c7ff8222b06b99c660aa8b090c842da8ecc7
/src/test/java/com/perunlabs/jsolid/ConvexPolygonApiTest.java
02b1437529e19ebe5fa0716c11be652f5ce62e13
[ "Apache-2.0" ]
permissive
philipparndt/jsolid
2ddbf09785afb973be44637890e54444f055c3e0
8a36643d489c693c0f7033d3b331ec1988b3893c
refs/heads/master
2023-04-09T21:21:00.120328
2020-07-11T09:26:00
2020-07-11T09:26:08
278,824,317
0
0
Apache-2.0
2023-04-04T00:27:20
2020-07-11T08:52:53
Java
UTF-8
Java
false
false
958
java
package com.perunlabs.jsolid; import static com.perunlabs.jsolid.JSolid.convexPolygon; import static com.perunlabs.jsolid.JSolid.v; import static org.testory.Testory.thenThrown; import static org.testory.Testory.when; import org.junit.Test; public class ConvexPolygonApiTest { @Test public void zero_vertexes_throws_exception() throws Exception { when(() -> convexPolygon()); thenThrown(IllegalArgumentException.class); } @Test public void one_vertex_throws_exception() throws Exception { when(() -> convexPolygon(v(1, 1))); thenThrown(IllegalArgumentException.class); } @Test public void two_vertexes_throws_exception() throws Exception { when(() -> convexPolygon(v(1, 1), v(2, 2))); thenThrown(IllegalArgumentException.class); } @Test public void null_argument_causes_exception() throws Exception { when(() -> convexPolygon(v(1, 1), v(2, 2), null)); thenThrown(NullPointerException.class); } }
[ "marcin.mikosik@gmail.com" ]
marcin.mikosik@gmail.com
5dd36a2d549e8469673ae5197e72f809709204ee
0f4ac67c5e008e01f2ad5f2f60db8f47f0e79d85
/src/main/java/net/rehttp/tk/TkStatus.java
8953f1454e954b60fcf68e92a9a53009416156e3
[ "MIT" ]
permissive
niqmk/rehttp
cb4aba786bf9f74e9cc221a10766258e0e91e30c
707b9c22f1d2f979c7fa9abdfa8012e69eedce25
refs/heads/master
2021-06-22T20:35:06.230293
2017-09-05T20:31:08
2017-09-05T21:08:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,487
java
/** * The MIT License (MIT) * * Copyright (c) 2017 Yegor Bugayenko * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: the above copyright notice and this * permission notice shall be included in all copies or substantial * portions of the Software. The software is provided "as is", without * warranty of any kind, express or implied, including but not limited to * the warranties of merchantability, fitness for a particular purpose * and non-infringement. In no event shall the authors or copyright * holders be liable for any claim, damages or other liability, whether * in an action of contract, tort or otherwise, arising from, out of or * in connection with the software or the use or other dealings in the * software. */ package net.rehttp.tk; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import net.rehttp.base.Base; import org.takes.Request; import org.takes.Response; import org.takes.Take; import org.takes.rq.RqHref; import org.takes.rs.RsText; import org.takes.rs.RsWithStatus; /** * Status for the URL. * * @author Yegor Bugayenko (yegor256@gmail.com) * @version $Id$ * @since 1.0 * @checkstyle ClassDataAbstractionCouplingCheck (500 lines) */ final class TkStatus implements Take { /** * Base. */ private final Base base; /** * Ctor. * @param bse Base */ TkStatus(final Base bse) { this.base = bse; } @Override public Response act(final Request req) throws IOException { final URL url = new URL(new RqHref.Smart(req).single("u")); final int errors = this.base.status(url).failures( Long.MAX_VALUE ).size(); final Response response; if (errors == 0) { response = new RsText("No errors."); } else { response = new RsWithStatus( new RsText(String.format("%d errors.", errors)), HttpURLConnection.HTTP_INTERNAL_ERROR ); } return response; } }
[ "yegor256@gmail.com" ]
yegor256@gmail.com
63ef91857043c89f298d15cc6742da59cd97e237
7016cec54fb7140fd93ed805514b74201f721ccd
/src/java/com/echothree/control/user/invoice/common/form/CreateInvoiceLineUseTypeDescriptionForm.java
a5c21fec716a6060c89dd9e2e28321e86a16fe71
[ "MIT", "Apache-1.1", "Apache-2.0" ]
permissive
echothreellc/echothree
62fa6e88ef6449406d3035de7642ed92ffb2831b
bfe6152b1a40075ec65af0880dda135350a50eaf
refs/heads/master
2023-09-01T08:58:01.429249
2023-08-21T11:44:08
2023-08-21T11:44:08
154,900,256
5
1
null
null
null
null
UTF-8
Java
false
false
1,166
java
// -------------------------------------------------------------------------------- // Copyright 2002-2023 Echo Three, LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // -------------------------------------------------------------------------------- package com.echothree.control.user.invoice.common.form; import com.echothree.control.user.invoice.common.spec.InvoiceLineUseTypeSpec; import com.echothree.control.user.party.common.spec.LanguageSpec; public interface CreateInvoiceLineUseTypeDescriptionForm extends InvoiceLineUseTypeSpec, LanguageSpec { String getDescription(); void setDescription(String description); }
[ "rich@echothree.com" ]
rich@echothree.com
56f0a6b5073e7219dc224dacb106700248eeacc6
4016795e7231caffa84867954aa7326c4acafbf1
/src/cebwrPackage/Problem008.java
a2f4bb3324304a40b998d87481a4e71420fd375e
[]
no_license
kevinyou/cebwrpgrhyre
2a08f08682fa8e81839d7cf1a1e91404f3eea8f5
5d9fd3686b7d96d6f688c60f94dde9e107786149
refs/heads/master
2021-01-02T22:50:33.253474
2014-12-27T21:41:28
2014-12-27T21:41:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,442
java
package cebwrPackage; import java.io.*; import java.util.*; public class Problem008 { public static void main(String[] args) throws IOException { // Handling IO String inputFileName = "Problem008.in"; Scanner input = new Scanner(new File("src/data/" + inputFileName)); // Trim off file name for use as output file name inputFileName = inputFileName.substring(0, inputFileName.indexOf(".")); FileWriter fstream = new FileWriter("src/data/" + inputFileName + ".out"); BufferedWriter output = new BufferedWriter(fstream); int length = 1000; long greatest = 0; int position = 0; int[] digits = new int[length]; while (input.hasNext()) { String line = input.nextLine(); for (int j = 0; j < line.length(); j++) { digits[position] = Integer.parseInt(line.substring(j, j+1)); position++; } } for (int i = 0; i < length - 13; i++) { if(!hasZeroes(i, digits)) { greatest = Math.max(greatest, compute(i, digits)); } } System.out.println(greatest); output.write("" + greatest); // Add to output output.close(); // End output } public static boolean hasZeroes(int index, int[] digits) { for (int i = index; i < index + 13; i++) if (digits[i] == 0) return true; return false; } public static long compute(int index, int[] digits) { long product = 1; for (int i = index; i < index + 13; i++) product *= digits[i]; return product; } }
[ "kevin.you@outlook.com" ]
kevin.you@outlook.com
bff47931b5ae925a014fe63e4cd1d8d1a348530a
b9ca543bed8c02d85336c30f0ef61409b6046f1a
/carinventory/src/main/java/com/oi/carinventory/carinventory/service/CarService.java
7c58d3cf1f2ca67d2a08622325247132ace2b698
[]
no_license
ogorifuwe/JDBC-Car-Inventory
6f931df68d1ca0436dcf3444d02dc6f55a0e4cd2
f047af8786887bce983d678213dacbdfec520214
refs/heads/master
2022-12-27T19:02:49.795537
2020-07-05T18:51:17
2020-07-05T18:51:17
277,361,087
0
1
null
2020-10-13T23:19:58
2020-07-05T18:31:57
Java
UTF-8
Java
false
false
387
java
package com.oi.carinventory.carinventory.service; import com.oi.carinventory.carinventory.model.Car; import java.util.List; public interface CarService { public Car createCar(Car car); public Car retrieveCar(int id); public List<Car> retrieveCars(); public List<Car> retrieveCarsByColor(String color); public Car updateCar(Car car); public void deleteCar(int id); }
[ "oifuwe@luc.edu" ]
oifuwe@luc.edu
85e311532e6d6af8372eef2527bff83c23626e00
ff88764592cbd5b06f01cf9c6049d13773af196f
/java-example/test/dynamic/FibonacciTest.java
5cd6b86b6ee0eab0998707143154d84bd4aeac03
[]
no_license
puresprout/code-example
6b0b3ae9c7c486cd1c4fdcd5c74e01c75b36b703
5b4e75b7e241fdc8cdb7976603e42e146ba52e77
refs/heads/master
2021-01-22T19:54:55.584907
2017-04-11T13:58:13
2017-04-11T13:58:13
85,261,698
0
0
null
null
null
null
UTF-8
Java
false
false
897
java
package dynamic; import org.hamcrest.CoreMatchers; import org.junit.Test; import java.util.Arrays; import static org.junit.Assert.assertThat; /** * Created by sunghyun on 2016. 12. 22.. */ public class FibonacciTest { @Test(expected = RuntimeException.class) public void fibonacci() throws Exception { assertThat(Fibonacci.getFibonacci(-1), CoreMatchers.is(Arrays.asList())); } @Test public void fibonacci2() throws Exception { assertThat(Fibonacci.getFibonacci(0), CoreMatchers.is(Arrays.asList())); assertThat(Fibonacci.getFibonacci(1), CoreMatchers.is(Arrays.asList(0))); assertThat(Fibonacci.getFibonacci(2), CoreMatchers.is(Arrays.asList(0, 1))); assertThat(Fibonacci.getFibonacci(3), CoreMatchers.is(Arrays.asList(0, 1, 1))); assertThat(Fibonacci.getFibonacci(4), CoreMatchers.is(Arrays.asList(0, 1, 1, 2))); } }
[ "puresprout@gmail.com" ]
puresprout@gmail.com
0c1995c79d27eeee547e9f2e40d92a4ba429ed9e
154e43989765e3774495c0a0b31effdaa3bf3d40
/body/src/main/java/com/adc/da/article/dao/ImgPathEODao.java
d67e27d15c5f8f4cec1367dfe5f69ac4d5c7f25b
[]
no_license
yueBen/communityProjectBack
443993b92eab9d4a242f66b95c3d77d7a0238e02
f18b34300b20d65d875471b51bbdc19c369ed3b3
refs/heads/master
2020-04-25T04:37:06.349570
2019-05-13T02:21:54
2019-05-13T02:21:54
172,516,064
0
0
null
null
null
null
UTF-8
Java
false
false
393
java
package com.adc.da.article.dao; import com.adc.da.base.dao.BaseDao; import com.adc.da.article.entity.ImgPathEO; /** * * <br> * <b>功能:</b>img_path ImgPathEODao<br> * <b>作者:</b>code generator<br> * <b>日期:</b> 2019-03-17 <br> * <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br> */ public interface ImgPathEODao extends BaseDao<ImgPathEO> { }
[ "1154451750@qq.com" ]
1154451750@qq.com