blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6a751f2ca7646c8a72d0c80ffe22c4f4e6dc0ee7 | c06dcf457874d88893c009e8045f20467a17d515 | /src/main/java/com/example/demo/controller/LicensePlateController.java | 71c5973d28578f4358486cd9513bf0ee45176aa3 | [] | no_license | MrZhangZt/MyDream | 89101b0a476e16a5c91de70d9a6871edce3c951b | d98aab4598c0a1ec22be0604e8d95b40a4edcf3e | refs/heads/master | 2022-06-29T09:34:27.966680 | 2019-12-30T07:38:54 | 2019-12-30T07:38:54 | 163,072,538 | 1 | 0 | null | 2022-06-17T02:48:24 | 2018-12-25T10:24:40 | Java | UTF-8 | Java | false | false | 2,140 | java | package com.example.demo.controller;
import com.example.demo.util.AISDK;
import com.example.demo.util.Base64Util;
import com.example.demo.util.HttpUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@RestController
public class LicensePlateController {
@RequestMapping(value = "/plate",method = RequestMethod.GET)
public String plate(){
AISDK aisdk=new AISDK();
Map params=new HashMap<String,String>();
String result="";
String nonce_str= UUID.randomUUID().toString().replace("-","");
params.put("app_id","2125636236");
params.put("app_key","xjVevquA7DFNwW1R");
String time_stamp=String.valueOf(aisdk.DateToTimestamp(new Date()));
System.out.println(time_stamp);
params.put("time_stamp",time_stamp);
params.put("nonce_str",nonce_str);
InputStream in = null;
byte[] data = null;
// 读取图片字节数组
try {
in = new FileInputStream("C:\\Users\\Administrator\\Desktop\\demo2\\src\\main\\resources\\templates\\img\\plate.PNG");
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
Base64Util b64 = new Base64Util();
String b64str = b64.encode(data);
System.out.println(b64str);
params.put("image", b64str);
params.put("sign", aisdk.genSignString(params));
// 打开和URL之间的连接
try {
HttpUtils util = new HttpUtils();
result= util.httpPostWithForm("https://api.ai.qq.com/fcgi-bin/ocr/ocr_plateocr",params);
System.out.println("result:"+ result);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
| [
"528828294@qq.com"
] | 528828294@qq.com |
61d002abe703d73cf6afc663fd51b9b7d0c6988a | cb3af75a3579e8161473664fc99445be9c5d8bbb | /java7/core/src/main/java/org/apache/tamaya/core/internal/converters/BigDecimalConverter.java | 53122f5ef40d24246bf48f2537696b8bd39e3c59 | [
"Apache-2.0"
] | permissive | marschall/incubator-tamaya | 8bbd2f99593c6bc983100374121894b7d3616e44 | ced71fe231f3324d59fc947ad411bebadfec7a63 | refs/heads/master | 2021-01-12T19:41:56.249920 | 2015-08-26T20:08:38 | 2015-08-26T20:08:38 | 34,805,464 | 0 | 0 | null | 2015-04-29T16:38:34 | 2015-04-29T16:38:33 | null | UTF-8 | Java | false | false | 2,379 | 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.tamaya.core.internal.converters;
import org.apache.tamaya.spi.PropertyConverter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Objects;
import java.util.logging.Logger;
/**
* Converter, converting from String to BigDecimal, the supported format is one of the following:
* <ul>
* <li>232573527352.76352753</li>
* <li>-23257352.735276352753</li>
* <li>-0xFFFFFF (integral numbers only)</li>
* <li>-0XFFFFAC (integral numbers only)</li>
* <li>0xFFFFFF (integral numbers only)</li>
* <li>0XFFFFAC (integral numbers only)</li>
* </ul>
*/
public class BigDecimalConverter implements PropertyConverter<BigDecimal>{
/** The logger. */
private static final Logger LOG = Logger.getLogger(BigDecimalConverter.class.getName());
/** Converter to be used if the format is not directly supported by BigDecimal, e.g. for integral hex values. */
private BigIntegerConverter integerConverter = new BigIntegerConverter();
@Override
public BigDecimal convert(String value) {
String trimmed = Objects.requireNonNull(value).trim();
try{
return new BigDecimal(trimmed);
} catch(Exception e){
LOG.finest("Parsing BigDecimal failed, trying BigInteger for: " + value);
BigInteger bigInt = integerConverter.convert(trimmed);
if(bigInt!=null){
return new BigDecimal(bigInt);
}
LOG.finest("Failed to parse BigDecimal from: " + value);
return null;
}
}
}
| [
"anatole@apache.org"
] | anatole@apache.org |
89fcd11b4d066b08442ef5c3de8da9f4009993b4 | d1fb2fc159321208d40084f0dc1d86b376200ae9 | /PurchasePrepaidDataSIMService/src/main/java/org/IntegrateService/PurchasePrepaidDataSIM/Configuration/BaseRepositoryFactory.java | 91b5371b9a2b55cb471aa6c9c19f8e9baff6a997 | [] | no_license | vudq291295/BankABC | 9cdd10ca72c296330dead66fd290d98b4ba97b44 | f4b61961a8b370bb97bdaaaa959c26b7a2965c5a | refs/heads/main | 2023-03-30T17:05:26.962518 | 2021-04-04T04:39:35 | 2021-04-04T04:39:35 | 352,026,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,194 | java | package org.IntegrateService.PurchasePrepaidDataSIM.Configuration;
import java.io.Serializable;
import javax.persistence.EntityManager;
import org.IntegrateService.PurchasePrepaidDataSIM.Infrastructure.BaseCRUDRespositoryImpl;
import org.springframework.data.jpa.repository.support.JpaRepositoryFactory;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.data.repository.core.RepositoryInformation;
import org.springframework.data.repository.core.RepositoryMetadata;
public class BaseRepositoryFactory <T, I extends Serializable>
extends JpaRepositoryFactory{
private final EntityManager em;
public BaseRepositoryFactory(EntityManager entityManager) {
super(entityManager);
em = entityManager;
}
@SuppressWarnings("unchecked")
@Override
protected SimpleJpaRepository<?, ?> getTargetRepository(RepositoryInformation information, EntityManager em) {
return new BaseCRUDRespositoryImpl<T, I>((Class<T>) information.getDomainType(), em);
}
@Override
protected Class<?> getRepositoryBaseClass(RepositoryMetadata metadata) {
return BaseCRUDRespositoryImpl.class;
}
public EntityManager getEm() {
return em;
}
}
| [
"quangvu291295@gmail.com"
] | quangvu291295@gmail.com |
ca066b389ee577418d924aba526ce50804d5c993 | 24c40848127c85fda3726963e606e84ca03cff6e | /app/src/main/java/com/examapplication/ui/fragments/QuestionPaperFragment.java | 52352fa0e3ae74b8c0a375b341f73e31f7de1ea2 | [] | no_license | piyushpk/Exam-App | 2f32a38849e0d9e2fa17390be82bb55dac4ce11b | 7daa068a43200c582c30f18e1b8fdc0c6b2424e7 | refs/heads/master | 2021-01-01T18:15:42.448530 | 2017-08-18T20:03:11 | 2017-08-18T20:03:12 | 98,289,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,070 | java | package com.examapplication.ui.fragments;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.toolbox.JsonObjectRequest;
import com.examapplication.R;
import com.examapplication.interfaces.ApiServiceCaller;
import com.examapplication.models.QuestionModel;
import com.examapplication.ui.adapters.QuestionPaperAdapter;
import com.examapplication.utility.App;
import com.examapplication.utility.AppConstants;
import com.examapplication.utility.AppPreferences;
import com.examapplication.utility.CommonUtility;
import com.examapplication.webservices.ApiConstants;
import com.examapplication.webservices.JsonResponse;
import com.examapplication.webservices.WebRequest;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link QuestionPaperFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link QuestionPaperFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class QuestionPaperFragment extends ParentFragment implements ApiServiceCaller
{
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
private RecyclerView recyclerQuestionPaper;
private Context mContext;
private LinearLayoutManager layoutManager;
public QuestionPaperFragment()
{
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment QuestionPaperFragment.
*/
// TODO: Rename and change types and number of parameters
public static QuestionPaperFragment newInstance(String param1, String param2)
{
QuestionPaperFragment fragment = new QuestionPaperFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if(getArguments() != null)
{
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.fragment_question_paper, container, false);
mContext = getContext();
recyclerQuestionPaper = (RecyclerView)rootView.findViewById(R.id.recycler_question_paper);
layoutManager = new LinearLayoutManager(getActivity().getApplicationContext(),
LinearLayoutManager.VERTICAL, false);
recyclerQuestionPaper.setLayoutManager(layoutManager);
ArrayList<QuestionModel> questionModels = new ArrayList<>();
QuestionPaperAdapter runningNowAdapter = new QuestionPaperAdapter(mContext,
questionModels, "");
recyclerQuestionPaper.setAdapter(runningNowAdapter);
return rootView;
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri)
{
if(mListener != null)
{
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context)
{
super.onAttach(context);
}
@Override
public void onDetach()
{
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener
{
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
@Override
public void onResume()
{
super.onResume();
// getQuestionPaper();
}
private void getQuestionPaper()
{
if (CommonUtility.getInstance(mContext).checkConnectivity(mContext))
{
try
{
showLoadingDialog(mContext);
JSONObject jsonObject = new JSONObject();
String token = AppPreferences.getInstance(mContext).getString(AppConstants.TOKEN, "");
JsonObjectRequest request = WebRequest.callPostMethod(mContext, jsonObject, Request.Method.GET,
ApiConstants.GET_QUESTION_PAPER_URL, ApiConstants.GET_QUESTION_PAPER, this, token);
App.getInstance().addToRequestQueue(request, ApiConstants.GET_QUESTION_PAPER);
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
Toast.makeText(mContext, getString(R.string.internet_failed), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onAsyncSuccess(JsonResponse jsonResponse, String label)
{
switch (label)
{
case ApiConstants.GET_QUESTION_PAPER:
{
if (jsonResponse != null)
{
if (jsonResponse.result != null && jsonResponse.result.equals(jsonResponse.result))
{
try
{
dismissLoadingDialog();
ArrayList<QuestionModel> questionModels = new ArrayList<>();
// questionModels.addAll(jsonResponse.myexamorder.getMyRunningExam());
QuestionPaperAdapter runningNowAdapter = new QuestionPaperAdapter(mContext,
questionModels, "");
recyclerQuestionPaper.setAdapter(runningNowAdapter);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
break;
}
}
@Override
public void onAsyncFail(String message, String label, NetworkResponse response)
{
dismissLoadingDialog();
switch (label)
{
case ApiConstants.GET_QUESTION_PAPER:
{
Toast.makeText(mContext, AppConstants.API_FAIL_MESSAGE, Toast.LENGTH_SHORT).show();
}
break;
}
}
@Override
public void onAsyncCompletelyFail(String message, String label)
{
dismissLoadingDialog();
switch (label)
{
case ApiConstants.GET_QUESTION_PAPER:
{
Toast.makeText(mContext, AppConstants.API_FAIL_MESSAGE, Toast.LENGTH_SHORT).show();
}
break;
}
}
}
| [
"p.kalmegh1@gmail.com"
] | p.kalmegh1@gmail.com |
1871f0fb96a0bf7c187c98b042414b83de843c32 | 3f91602a7de5d4a16140088e1a26621428aa0221 | /plugin/src/main/java/com/yaojiafeng/maven/plugin/plugin/enums/HttpApiParamInEnum.java | 75f3618030be222429ce84e226cdd38104587460 | [] | no_license | yaojf/maven-plugin | c1450113e556ec70669b563582fb8125a94e526e | 7fdceb67857196a5821abcc0741e7d16770ab5b8 | refs/heads/master | 2020-03-24T03:07:08.596567 | 2018-07-31T02:17:01 | 2018-07-31T02:17:01 | 142,405,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.yaojiafeng.maven.plugin.plugin.enums;
/**
* User: yaojiafeng
* Date: 2018/6/14
* Time: 上午11:57
* Description:
*/
public enum HttpApiParamInEnum {
BODY("body"), QUERY("query"), PATH("path");
private final String value;
HttpApiParamInEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
| [
"yaojiafeng@terminus.io"
] | yaojiafeng@terminus.io |
58f99edfc02f0aa6467a9311def411652a05786a | cde96d77bceb7d4df410dc9cff0bace98ea2e1fb | /src/G.java | d70a3d3b73261c0926e7430fe1df7f38c3e51a12 | [] | no_license | devmhd/k-nearest-neighbour-document-classifier | 06fb1a2e8c78381070531c432f23ebf6ca1ac2e2 | c39d39735fed491c510e6dfce1d97b44388f99c2 | refs/heads/master | 2016-08-05T13:36:32.893415 | 2015-05-02T06:44:10 | 2015-05-02T06:44:10 | 34,892,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,353 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
public class G {
public static final double SMALL_PROBABILITY = 0.00000000000001;
public static HashMap<String, Integer> topicsMap;
public static String[] topics;
public static ArrayList<Article> trainingArticles;
public static ArrayList<Article> testArticles;
public static HashMap<String, Integer> nDocumentsContainingWord;
public static HashSet<String> allWords;
public static HashSet<String> dontCareWords;
public static void init(){
dontCareWords = new HashSet<String>();
dontCareWords.add("the");
dontCareWords.add("a");
dontCareWords.add("to");
dontCareWords.add("of");
dontCareWords.add("an");
dontCareWords.add("over");
dontCareWords.add("upon");
dontCareWords.add("on");
}
private static HashSet<String> keyUnion(HashMap<String, Integer> a, HashMap<String, Integer> b ){
HashSet<String> wordList = new HashSet<String>();
for (Entry<String, Integer> entry : a.entrySet())
{
wordList.add(entry.getKey());
}
for (Entry<String, Integer> entry : b.entrySet())
{
if( ! (wordList.contains(entry.getKey())))
wordList.add(entry.getKey());
}
return wordList;
}
public static int hammingDistance(Article trainArticle, Article testArticle){
int distance = 0;
HashSet<String> wordList = keyUnion(trainArticle.frequency, testArticle.frequency);
for(String word : wordList){
if(trainArticle.contains(word) ^ testArticle.contains(word))
distance++;
}
return distance;
}
public static int classifyByHammingDistance(Article testArticle, int k){
// update all distances;
for(Article trainArticle : trainingArticles ){
trainArticle.distance = hammingDistance(trainArticle, testArticle);
// System.out.println("distance " + trainArticle.hammingDistance);
}
Collections.sort(trainingArticles, new HammingDistanceComparator());
int[] topicsFrequency = new int[topicsMap.size()];
for(int i=0; i<k; ++i){
//System.out.println(topics[trainingArticles.get(i).topic] + " " + trainingArticles.get(i).hammingDistance);
topicsFrequency[trainingArticles.get(i).topic]++;
}
int iMax = -1;
int max = 0;
for(int i =0; i<topics.length; ++i){
if(topicsFrequency[i] > max){
max = topicsFrequency[i];
iMax = i;
}
}
return iMax;
}
public static double euclidianDistance(Article trainArticle, Article testArticle){
int sum = 0;
HashSet<String> wordList = keyUnion(trainArticle.frequency, testArticle.frequency);
int difference;
int countInTrain, countInTest;
for(String word : wordList){
if(trainArticle.contains(word))
countInTrain = trainArticle.frequency.get(word);
else
countInTrain = 0;
if(testArticle.contains(word))
countInTest = testArticle.frequency.get(word);
else
countInTest = 0;
sum += ((countInTrain - countInTest) * (countInTrain - countInTest));
}
return Math.sqrt(sum);
}
public static int classifyByEuclidianDistance(Article testArticle, int k){
// update all distances;
for(Article trainArticle : trainingArticles ){
trainArticle.dDistance = euclidianDistance(trainArticle, testArticle);
// System.out.println("distance " + trainArticle.hammingDistance);
}
Collections.sort(trainingArticles, new DoubleDistanceComparator());
int[] topicsFrequency = new int[topicsMap.size()];
for(int i=0; i<k; ++i){
//System.out.println(topics[trainingArticles.get(i).topic] + " " + trainingArticles.get(i).hammingDistance);
topicsFrequency[trainingArticles.get(i).topic]++;
}
int iMax = -1;
int max = 0;
for(int i =0; i<topics.length; ++i){
if(topicsFrequency[i] > max){
max = topicsFrequency[i];
iMax = i;
}
}
return iMax;
}
public static double cosineSimilarity(Article trainArticle, Article testArticle){
int sum = 0;
HashSet<String> wordList = keyUnion(trainArticle.frequency, testArticle.frequency);
// int difference;
int countInTrain, countInTest;
for(String word : wordList){
if(trainArticle.contains(word))
countInTrain = trainArticle.frequency.get(word);
else
countInTrain = 0;
if(testArticle.contains(word))
countInTest = testArticle.frequency.get(word);
else
countInTest = 0;
sum += (countInTrain * countInTest);
}
return (double)sum / trainArticle.magnitude / testArticle.magnitude;
}
public static int classifyByCosineSimilarity(Article testArticle, int k){
// update all distances;
for(Article trainArticle : trainingArticles ){
trainArticle.dDistance = cosineSimilarity(trainArticle, testArticle);
// System.out.println("distance " + trainArticle.hammingDistance);
}
Collections.sort(trainingArticles, new DoubleDistanceComparator());
int[] topicsFrequency = new int[topicsMap.size()];
for(int i=trainingArticles.size()-1; i>=(trainingArticles.size() - k); --i){
//System.out.println(topics[trainingArticles.get(i).topic] + " " + trainingArticles.get(i).hammingDistance);
topicsFrequency[trainingArticles.get(i).topic]++;
}
int iMax = -1;
int max = 0;
for(int i =0; i<topics.length; ++i){
if(topicsFrequency[i] > max){
max = topicsFrequency[i];
iMax = i;
}
}
return iMax;
}
}
| [
"devmhd@gmail.com"
] | devmhd@gmail.com |
bfe53bb4ab6bbc25deb17aad85ac9818c358ff12 | dbad729b9543157fb3ac39d6629f507dbe5bbf0b | /Cucumbers/src/main/java/StepDefination/ReportPageSteps.java | 53308d4d1002fc06cded7f2d2fcff96e5c61cc68 | [] | no_license | surajraje096/Cucumber_Testng_project | 2f24b1207c8dfba79b80ac118b58861a49c83a0b | e53f3a143cb552a272c31c959f5e0538cefa4457 | refs/heads/master | 2023-05-11T14:07:15.597837 | 2020-01-19T10:22:15 | 2020-01-19T10:22:15 | 234,878,669 | 0 | 0 | null | 2023-05-09T18:42:56 | 2020-01-19T10:08:17 | JavaScript | UTF-8 | Java | false | false | 1,016 | java | package StepDefination;
import base.TestBase;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import pages.HomePage;
import pages.ReportsPage;
public class ReportPageSteps extends TestBase {
HomePage hmpage;
ReportsPage report;
@When("^user clicks on Reports Tab$")
public void user_clicks_on_Reports_Tab() throws Throwable {
hmpage=new HomePage();
report=hmpage.clickOnReports();
}
@Then("^user is on Reports Page$")
public void user_is_on_Reports_Page() throws Throwable {
report.verifyTitle();
}
@Then("^user verifies all report links$")
public void user_verifies_links() throws Throwable {
report.verifyAllReportsLinks();
}
@Then("^user verifies all headings of Report Page$")
public void user_verifies_all_headings_of_Report_Page() throws Throwable {
report.verifyAllHeadings();
}
@Then("^user verifies all elements of Report Page$")
public void user_verifies_all_elements_of_Report_Page() throws Throwable {
report.verifyAllElements();
}
}
| [
"surajraje096@gmail.com"
] | surajraje096@gmail.com |
dd6bb3ae3fba2f43d5a2ba6a9dfa083489686c73 | 73fed0b3b7bb6062e1da3963ddfbd576cb6848ac | /src/Controller/ControllerGameScene.java | 72604ff59fa990929b5b74f9c61f4c19dfbf425b | [] | no_license | CloudyoErzod/starCityFrag | f85f46c9234bbae8b14e56770869f3974b76fb6b | 89d3f575b0736103b40c6ed1f077f53f653d384d | refs/heads/master | 2020-08-27T05:00:19.926373 | 2019-11-12T08:52:55 | 2019-11-12T08:52:55 | 217,251,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,774 | java | package Controller;
import Model.GameScene;
import Model.Menu;
import Timeline.GameTL;
import View.ViewHandler;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.event.EventHandler;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
public class ControllerGameScene implements EventHandler<KeyEvent> {
private ViewHandler launcher;
private GameScene model;
private GameTL gameTimeLine;
private BooleanProperty leftKeyTyped, rightKeyTyped, spaceBarKeyTyped;
public ControllerGameScene(ViewHandler launcher, GameScene model) {
leftKeyTyped = new SimpleBooleanProperty(false);
rightKeyTyped = new SimpleBooleanProperty(false);
spaceBarKeyTyped = new SimpleBooleanProperty(false);
this.launcher = launcher;
this.model = model;
gameTimeLine = new GameTL(this);
}
public void GameTLStart() {
gameTimeLine.start();
}
public void GameTLStoppe() {
gameTimeLine.stop();
gameTimeLine = new GameTL(this);
}
@Override
public void handle(KeyEvent event) {
if (event.getEventType() == KeyEvent.KEY_PRESSED) {
if (event.getCode() == KeyCode.LEFT) {
leftKeyTyped.set(true);
} else if (event.getCode() == KeyCode.RIGHT) {
rightKeyTyped.set(true);
} else if (event.getCode() == KeyCode.SPACE) {
spaceBarKeyTyped.set(true);
}
}else if (event.getEventType() == KeyEvent.KEY_RELEASED) {
if (event.getCode() == KeyCode.LEFT) {
leftKeyTyped.set(false);
} else if (event.getCode() == KeyCode.RIGHT) {
rightKeyTyped.set(false);
} else if (event.getCode() == KeyCode.SPACE) {
spaceBarKeyTyped.set(false);
}
}
}
public synchronized void majProjectiles() {
this.launcher.getVgs().majProjectiles();
}
public ViewHandler getLauncher() {
return launcher;
}
public void setLauncher(ViewHandler launcher) {
this.launcher = launcher;
}
public GameScene getModel() {
return model;
}
public void setModel(GameScene model) {
this.model = model;
}
public synchronized boolean isLeftKeyTyped() {
return leftKeyTyped.get();
}
public synchronized boolean isRightKeyTyped() {
return rightKeyTyped.get();
}
public synchronized boolean isSpaceBarKeyTyped() {
return spaceBarKeyTyped.get();
}
public synchronized void setSpaceBarKeyStatut(boolean statut) {
spaceBarKeyTyped.set(statut);
}
}
| [
"claudio.morabito@uha.fr"
] | claudio.morabito@uha.fr |
f0b3c0862bc5c408c658aaac1b04f7dd4288b047 | 1907cbc9105a0ac30a61e191530e1b87a4a7ce1c | /src/com/bright/amp/account/service/SpendService.java | 644ed3106ca2bc54ae26dc8592882c46d271a654 | [] | no_license | brightsw/amp | 4fa8a299bd3edfa302afb00b30c3439f1ade4db6 | 62a2219d5b68834e494d3958682045c6d0004b1e | refs/heads/master | 2021-05-04T04:11:06.403498 | 2016-10-24T08:25:21 | 2016-10-24T08:25:21 | 70,866,702 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package com.bright.amp.account.service;
import org.springframework.stereotype.Service;
import com.bright.amp.account.dao.TspendDao;
import com.bright.amp.account.model.Tspend;
import com.polydata.framework.core.service.BaseService;
@Service("spendService")
public class SpendService extends BaseService<Tspend,TspendDao>{
public void addSpend(Tspend spend){
String accdate = spend.getAccdate();
String date[] = accdate.split("-");
String accmon = date[0]+"-"+date[1];
spend.setAccmon(accmon);
spend.setAccyear(date[0]);
dao.insert(spend);
}
public void updateSpend(Tspend spend){
String accdate = spend.getAccdate();
String date[] = accdate.split("-");
String accmon = date[0]+"-"+date[1];
spend.setAccmon(accmon);
spend.setAccyear(date[0]);
dao.update(spend);
}
public void delete(Integer[] gids){
for(Integer gid : gids){
dao.delete(gid);
}
}
}
| [
"37761628@qq.com"
] | 37761628@qq.com |
cfd6b0719823359abfe973620af33a0d9e05aca2 | 60e2a318e07635ba96eb0f13af3f9cc01d0f8eeb | /src/main/java/hello/core/web/LogDemoService.java | 1eaefb01f25a70d976d7962d833e5e38af3808e2 | [] | no_license | MuseopKim/oop-spring-basic | 677d3addd577f4f1950e5b005bb82b91d422c3bb | 4d4596691517a7ba4c26ef5a805fff438afb0431 | refs/heads/master | 2023-06-08T14:22:22.662623 | 2021-04-14T14:57:33 | 2021-04-14T14:57:33 | 353,403,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package hello.core.web;
import hello.core.common.MyLogger;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.stereotype.Service;
@Service
public class LogDemoService {
private final MyLogger myLogger;
public LogDemoService(MyLogger myLogger) {
this.myLogger = myLogger;
}
public void logic(String id) {
myLogger.log("service id = " + id);
}
}
| [
"museopkim0214@gmail.com"
] | museopkim0214@gmail.com |
05e381a4052b01f05e3eb16387de9f93b22aec4a | 16f282c2166176326f44d6f234cc3378c3ad7d7c | /HibernateSpringBootSoftDeletesSpringStyle/src/main/java/com/bookstore/repository/AuthorRepository.java | 9c9bb0c4669a6fdc7b6c6c24e469a41c7b2d1632 | [
"Apache-2.0"
] | permissive | rzbrth/Hibernate-SpringBoot | 78ad0b764764aff74ad95a7c0dd1aa6b611fea1b | e91e1e0b2c8f2129fa0b9559701ac94ca68206af | refs/heads/master | 2020-12-13T05:59:51.024153 | 2020-01-15T16:38:39 | 2020-01-15T16:38:39 | 234,330,053 | 1 | 0 | Apache-2.0 | 2020-01-16T13:47:45 | 2020-01-16T13:47:44 | null | UTF-8 | Java | false | false | 479 | java | package com.bookstore.repository;
import com.bookstore.entity.Author;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional(readOnly = true)
public interface AuthorRepository extends SoftDeleteRepository<Author, Long> {
@Query("SELECT a FROM Author a WHERE a.name=?1 AND a.deleted=false")
Author fetchByName(String name);
}
| [
"leoprivacy@yahoo.com"
] | leoprivacy@yahoo.com |
6c5534006f4fea770d64d2ebd06afac00a114177 | d34737ea3e44d107697a88b25f6139a2189de2ee | /app/src/main/java/in/jivanmuktas/www/marg/adapter/CustomExpandableListAdapter.java | cd56d6a3726531b689736a6521d0950c3e9ac4e3 | [] | no_license | dhananjayt28/Gurukul-Android-App-Marg | 017f31fab9e185053da957c99514c7ecca4a4c30 | 299553591fffd847932d9f8f71631ea4f3d91516 | refs/heads/master | 2023-03-02T16:05:46.930034 | 2019-07-16T10:06:38 | 2019-07-16T10:06:38 | 335,535,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,518 | java | package in.jivanmuktas.www.marg.adapter;
/**
* Created by developer on 16-Oct-17.
*/
import java.util.List;
import java.util.TreeMap;
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
import in.jivanmuktas.www.marg.R;
public class CustomExpandableListAdapter extends BaseExpandableListAdapter {
private Context context;
private List<String> expandableListTitle;
private TreeMap<String, List<String>> expandableListDetail;
public CustomExpandableListAdapter(Context context, List<String> expandableListTitle,
TreeMap<String, List<String>> expandableListDetail) {
this.context = context;
this.expandableListTitle = expandableListTitle;
this.expandableListDetail = expandableListDetail;
}
@Override
public Object getChild(int listPosition, int expandedListPosition) {
return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))
.get(expandedListPosition);
}
@Override
public long getChildId(int listPosition, int expandedListPosition) {
return expandedListPosition;
}
@Override
public View getChildView(int listPosition, final int expandedListPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String expandedListText = (String) getChild(listPosition, expandedListPosition);
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.list_item, null);
}
TextView expandedListTextView = (TextView) convertView
.findViewById(R.id.expandedListItem);
expandedListTextView.setText(expandedListText);
return convertView;
}
@Override
public int getChildrenCount(int listPosition) {
return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))
.size();
}
@Override
public Object getGroup(int listPosition) {
return this.expandableListTitle.get(listPosition);
}
@Override
public int getGroupCount() {
return this.expandableListTitle.size();
}
@Override
public long getGroupId(int listPosition) {
return listPosition;
}
@Override
public View getGroupView(int listPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String listTitle = (String) getGroup(listPosition);
if (convertView == null) {
LayoutInflater layoutInflater = (LayoutInflater) this.context.
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = layoutInflater.inflate(R.layout.list_group, null);
}
TextView listTitleTextView = (TextView) convertView
.findViewById(R.id.listTitle);
listTitleTextView.setTypeface(null, Typeface.BOLD);
listTitleTextView.setText(listTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int listPosition, int expandedListPosition) {
return true;
}
} | [
"subha@tangenttechsolutions.com"
] | subha@tangenttechsolutions.com |
5789803b5fa12882f7bd3d56a25472d99f59250f | 573ff832665ecb882bfbe404002b3e2d9963084f | /DailyAlgorithm/src/main/java/DynamicSum.java | 6058326ce6251f2783e23c688034afde30247db5 | [] | no_license | Jhwonb/MultithreadDemo | 9c2e34d67248dd927125e5c4f9139fa1d4e9d501 | afd3b197e641d529a9a092f2ae2209b0a3261b6b | refs/heads/main | 2023-08-24T03:50:37.112520 | 2021-10-08T07:48:59 | 2021-10-08T07:48:59 | 399,757,886 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,261 | java | /**
* @Title DynamicSum
* @Description 给你一个数组 nums 。数组「动态和」的计算公式为:runningSum[i] = sum(nums[0]…nums[i])。
* 请返回 nums 的动态和。
* @Example ——输入:nums = [1,2,3,4] 输出:[1,3,6,10] 解释:动态和计算过程为 [1, 1+2, 1+2+3, 1+2+3+4]。
* @Difficulty 简单
* @Author hboy
* @Date 2021/8/28 16:26
* @Version 1.0.0
*/
public class DynamicSum {
// 我的解题
public static int[] runningSum(int[] nums) {
int numsLength = nums.length;
int[] runningSum = new int[numsLength];
int temNum = 0;
for (int i = 0; i < numsLength; i++) {
temNum = 0;
for (int j = 0; j <= i; j++) {
temNum+=nums[j];
}
runningSum[i] = temNum;
}
return runningSum;
}
// 官方解题 时间复杂度O(n) 空间复杂度O(1)
public static int[] runningSum2(int[] nums) {
int numsLength = nums.length;
for (int i = 1; i < numsLength; i++) {
nums[i] += nums[i - 1];
}
return nums;
}
public static void main(String[] args) {
System.out.println(runningSum2(new int[]{3,1,2,10,1}));
}
}
| [
"houby@hjsoft.com.cn"
] | houby@hjsoft.com.cn |
80d2c629ae1b8d1a3ec3ac5ceaa4ad908be22375 | b5d7fd9459a3779eb9a13bf8cc2c9326c23a11c7 | /FingerPrintAttendeceProject/src/FrontEndUI/LectureSession.java | cf5adf4597df6fa762371ecbc60b25f55a27f7c5 | [] | no_license | violinandchess/FingerPrintAttendence | 40f19de4e7cc634407645fa87d1af1f9399eb003 | 3d5598e4752b37cc84e9f44316a448f34600cc1a | refs/heads/master | 2021-09-10T12:32:37.649483 | 2018-03-26T10:03:27 | 2018-03-26T10:03:27 | 113,834,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,205 | 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 FrontEndUI;
import Models.Session;
import ServiceLayer.SessionService;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
import java.util.logging.Logger;
/**
*
* @author Avishka
*/
public class LectureSession extends javax.swing.JFrame {
private static final Logger LOGGER = Logger.getLogger(LectureSession.class.getName());
public static String UserType = "";
/**
* Creates new form LectureSession
*/
public LectureSession() {
initComponents();
this.setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
txtNoWeeks = new javax.swing.JTextField();
txtStartTimeWD = new javax.swing.JTextField();
txtEndTimeWD = new javax.swing.JTextField();
txtSubjectCode = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
txtWESDate = new com.toedter.calendar.JDateChooser();
txtStartTimeWE = new javax.swing.JTextField();
txtEndTimeWE = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
txtWDSDate = new com.toedter.calendar.JDateChooser();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Manage Lectures");
jPanel1.setBackground(new java.awt.Color(176, 222, 255));
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel1.setText("No of Weeks");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Start Time(Weekday):");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("End Time(Weekday):");
jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel5.setText("Weekday Lecture Start Date");
jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel8.setText("Code:");
txtSubjectCode.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtSubjectCodeActionPerformed(evt);
}
});
jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton2.setText("Shedule");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton4.setText("Back");
jButton1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jButton1.setText("Reshedule");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel12.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel12.setText("Weekend Lecture Start Date:");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel4.setText("Start Time(Weekend):");
jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel6.setText("End Time(Weekend):");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtWESDate, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtStartTimeWD, javax.swing.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
.addComponent(txtEndTimeWD)
.addComponent(txtNoWeeks)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtEndTimeWE, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(txtStartTimeWE, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtWDSDate, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtSubjectCode, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 10, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(txtNoWeeks, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtStartTimeWD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtEndTimeWD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(txtStartTimeWE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(txtEndTimeWE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtWDSDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtWESDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel8))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(txtSubjectCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(46, 46, 46)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(29, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
public boolean checktime_Starttime() {
if (!txtStartTimeWD.getText().isEmpty()) {
String start_time = txtStartTimeWD.getText().toString();
String[] parts = start_time.split(":");
int hour = Integer.parseInt(parts[0]);
int minute = Integer.parseInt(parts[1]);
System.out.println("" + hour);
System.out.println("" + minute);
if (((hour >= 0) && (hour <= 23)) && ((minute >= 0) && (minute <= 59))) {
return true;
}
} else {
return false;
}
return false;
}
public boolean checktime_endtime() {
if (!txtEndTimeWD.getText().isEmpty()) {
String start_time = txtEndTimeWD.getText().toString();
String[] parts = start_time.split(":");
int hour = Integer.parseInt(parts[0]);
int minute = Integer.parseInt(parts[1]);
System.out.println("" + hour);
System.out.println("" + minute);
if (((hour >= 0) && (hour <= 23)) && ((minute >= 0) && (minute <= 59))) {
return true;
}
} else {
return false;
}
return false;
}
public boolean check_no_weeks() {
if (!txtNoWeeks.getText().toString().isEmpty()) {
return true;
} else {
return false;
}
}
public boolean check_code() {
if (!txtSubjectCode.getText().toString().isEmpty()) {
return true;
} else {
return false;
}
}
public boolean check_weekstart_status() {
return txtWDSDate.getDate() != null || (txtWDSDate.getDate() != null);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
if (check_code() && check_no_weeks() && checktime_endtime() && checktime_Starttime() && check_weekstart_status()) {
String code = txtSubjectCode.getText();
String stime = txtStartTimeWD.getText();
String etime = txtEndTimeWD.getText();
String westime = txtStartTimeWE.getText();
String weetime = txtEndTimeWE.getText();
int now = Integer.parseInt(txtNoWeeks.getText());
Date WDDate = txtWDSDate.getDate();
Date WEDate = txtWESDate.getDate();
Calendar c = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
Date newWeekStartDate = c.getTime();
SessionService service = new SessionService();
SimpleDateFormat dateonly2 = new SimpleDateFormat("yyyy-MM-dd");
for (int i = 0; i < now; i++) {
c.setTime(txtWDSDate.getDate());
c.add(Calendar.WEEK_OF_MONTH, i);
Date d = c.getTime();
String SessionID = UUID.randomUUID().toString();
Session s = new Session(SessionID, stime, etime, code);
s.setStartDate(dateonly2.format(c.getTime()));
s.setBatch("Weekday");
service.AddSession(s);
}
for (int i = 0; i < now; i++) {
c.setTime(txtWESDate.getDate());
c.add(Calendar.WEEK_OF_MONTH, i);
Date d = c.getTime();
String SessionID = UUID.randomUUID().toString();
if(westime.isEmpty() && weetime.isEmpty())
{
westime=null;
weetime=null;
}
Session s = new Session(SessionID, westime, weetime, code);
s.setStartDate(dateonly2.format(c.getTime()));
s.setBatch("Weekend");
service.AddSession(s);
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void txtSubjectCodeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSubjectCodeActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtSubjectCodeActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
HolidayManage m = new HolidayManage();
m.setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @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 ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(LectureSession.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LectureSession.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LectureSession.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LectureSession.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LectureSession().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel12;
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 jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField txtEndTimeWD;
private javax.swing.JTextField txtEndTimeWE;
private javax.swing.JTextField txtNoWeeks;
private javax.swing.JTextField txtStartTimeWD;
private javax.swing.JTextField txtStartTimeWE;
private javax.swing.JTextField txtSubjectCode;
private com.toedter.calendar.JDateChooser txtWDSDate;
private com.toedter.calendar.JDateChooser txtWESDate;
// End of variables declaration//GEN-END:variables
}
| [
"vibaviattigala@gmail.com"
] | vibaviattigala@gmail.com |
6e551ce2adda7eb446a558cfe9849512195e62a4 | bbc6e1b319609868ad168b3d2686b1b41a4404c7 | /UniversitySystem/src/br/edu/ufca/Modelo/Disciplina.java | 6d33846a0fc4e44270d4635a9e067bdbd1d3d01a | [
"MIT"
] | permissive | CiceroWesley/ProjetoPOO_CC0019 | d88ff576dcca9b77a09c369062f09f114511ef9e | ce1f7a442de5074d4500a906b3b0a0af289ff1a9 | refs/heads/main | 2023-07-27T22:10:02.054275 | 2021-09-06T16:09:59 | 2021-09-06T16:09:59 | 388,533,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package br.edu.ufca.Modelo;
public class Disciplina {
}
| [
"wesleycariutaba@gmail.com"
] | wesleycariutaba@gmail.com |
05e8538a932d81050a2cc39d4306d3aafa9a2ee1 | ea07a2c5997a698035813adbf69ca5b5f034ddf4 | /Network/Network/Data/src/main/java/network/data/MatchResponse.java | 2da0842dfcef50f27f339b3dfed667d232f82a41 | [
"MIT"
] | permissive | James-yaoshenglong/NBACardGame | 9feea14e1c74867cc2c2f756fd73389a88847700 | be411e7980d37343e3f001f12392492229672afb | refs/heads/main | 2023-07-26T02:42:37.098719 | 2021-09-01T10:39:42 | 2021-09-01T10:39:42 | 330,607,234 | 5 | 1 | MIT | 2021-01-18T09:02:51 | 2021-01-18T08:53:45 | null | UTF-8 | Java | false | false | 526 | java | package network.data;
public class MatchResponse implements ResponseData{
private static final long serialVersionUID = 3490501964882670055L;
private String rivalUserName;
int order; //1 represent for first, 2 represent for second
public MatchResponse(String userName, int anOrder) {
this.rivalUserName = userName;
this.order = anOrder;
}
@Override
public void reProcess(ClientInterface client) {
client.getOperation().operate(this);
}
public int getOrder() {
return order;
}
}
| [
"yaoshenglong758063348@gmail.com"
] | yaoshenglong758063348@gmail.com |
afc56f69034e893cabc0c6a9d36aec012027dc1f | 2ebc7d0a695b6c42f224dd7704033bf801c443ef | /app/src/main/java/com/example/mvvmretrofit/util/HorizontalDottedProgress.java | bd329695cfe59f9ae10df1667054496da3363abc | [] | no_license | KruzhokProg/MvvmRetrofit_complete | 4db5584e5bd9d4e062f130ef9763c3e11f2a8fcf | ca90469ca02a5833cc809a6c99ea39aa3f0c221b | refs/heads/master | 2022-12-08T00:23:32.788417 | 2020-09-03T20:29:51 | 2020-09-03T20:29:51 | 292,663,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,952 | java | package com.example.mvvmretrofit.util;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.Transformation;
public class HorizontalDottedProgress extends View {
//actual dot radius
private int mDotRadius = 5;
//Bounced Dot Radius
private int mBounceDotRadius = 8;
//to get identified in which position dot has to bounce
private int mDotPosition;
//specify how many dots you need in a progressbar
private int mDotAmount = 10;
public HorizontalDottedProgress(Context context) {
super(context);
}
public HorizontalDottedProgress(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HorizontalDottedProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
//Method to draw your customized dot on the canvas
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
//set the color for the dot that you want to draw
paint.setColor(Color.parseColor("#fd583f"));
//function to create dot
createDot(canvas,paint);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
//Animation called when attaching to the window, i.e to your screen
startAnimation();
}
private void createDot(Canvas canvas, Paint paint) {
//here i have setted progress bar with 10 dots , so repeat and wnen i = mDotPosition then increase the radius of dot i.e mBounceDotRadius
for(int i = 0; i < mDotAmount; i++ ){
if(i == mDotPosition){
canvas.drawCircle(10+(i*20), mBounceDotRadius, mBounceDotRadius, paint);
}else {
canvas.drawCircle(10+(i*20), mBounceDotRadius, mDotRadius, paint);
}
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width;
int height;
//calculate the view width
int calculatedWidth = (20*9);
width = calculatedWidth;
height = (mBounceDotRadius*2);
//MUST CALL THIS
setMeasuredDimension(width, height);
}
private void startAnimation() {
BounceAnimation bounceAnimation = new BounceAnimation();
bounceAnimation.setDuration(100);
bounceAnimation.setRepeatCount(Animation.INFINITE);
bounceAnimation.setInterpolator(new LinearInterpolator());
bounceAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
mDotPosition++;
//when mDotPosition == mDotAmount , then start again applying animation from 0th positon , i.e mDotPosition = 0;
if (mDotPosition == mDotAmount) {
mDotPosition = 0;
}
Log.d("INFOMETHOD","----On Animation Repeat----");
}
});
startAnimation(bounceAnimation);
}
private class BounceAnimation extends Animation {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
//call invalidate to redraw your view againg.
invalidate();
}
}
} | [
"vongu3@gmail.com"
] | vongu3@gmail.com |
984d1b7e2b1d142dd0a106463e55730f36a7f814 | f2ac70adc55d0df8269f20721f24cb83e4eda801 | /ServiciosWebSIOT/ServiciosWebSIOT-war/src/java/modelo/datos/objetos/licenciasConduccion/Restriccionesdelicencia.java | e03f0eddbba4d6cf72ab632cce89453ba6c3a323 | [] | no_license | julianmira01/servintesa | 23966d3a73b5a118b880f3c81af8ad2f8e780d4f | 3ab90faf126f3b5964e5d21931b8ff9b1ba4c6d6 | refs/heads/master | 2021-01-09T20:08:30.825588 | 2016-06-08T15:12:39 | 2016-06-08T15:12:39 | 60,717,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 922 | java | package modelo.datos.objetos.licenciasConduccion;
import java.io.Serializable;
public class Restriccionesdelicencia implements Cloneable, Serializable {
private String ID_LICENCIAC;
private int ID_RESTRICCIONC;
private int NROREGISTRO;
public Restriccionesdelicencia(){
}
public Restriccionesdelicencia(String ID_LICENCIACIn) {
this.ID_LICENCIAC = ID_LICENCIACIn;
}
public String getID_LICENCIAC() {
return this.ID_LICENCIAC;
}
public void setID_LICENCIAC(String ID_LICENCIACIn) {
this.ID_LICENCIAC = ID_LICENCIACIn;
}
public int getID_RESTRICCIONC() {
return this.ID_RESTRICCIONC;
}
public void setID_RESTRICCIONC(int ID_RESTRICCIONCIn) {
this.ID_RESTRICCIONC = ID_RESTRICCIONCIn;
}
public int getNROREGISTRO() {
return this.NROREGISTRO;
}
public void setNROREGISTRO(int NROREGISTROIn) {
this.NROREGISTRO = NROREGISTROIn;
}
}
| [
"danielfyo@hotmail.com"
] | danielfyo@hotmail.com |
c7cd67735ac6ba3237d84b4e238d836affee28db | 991c05d23e63e13de4180ec231c200bac26a4b2c | /src/b_class/URLPermissionDemo.java | 90fe51a21b3bb34c1b2ea25c026ce9c529ced5f1 | [] | no_license | zhanglufeishishuaige/JavaNETDemo | 1f0a1c3395d8b16e0670e825fe32af6c4b30ba81 | 90d681b3a7179fddab072f3494ab41277abafb2a | refs/heads/master | 2023-03-15T12:37:11.048592 | 2017-12-21T16:53:43 | 2017-12-21T16:53:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package b_class;
/**
* @author SwordFall
* @create 2017-12-22 00:37.
* @desc
*
* 父类Permission
* 构造函数
* URLPermission(String url) 默认为URLPermission(url, "*:*")
* URLPermission(String url, String actions)
*
* actions为:
* "POST,GET,DELETE"
"GET:X-Foo-Request,X-Bar-Request"
"POST,GET:Header1,Header2"
*
* 主要方法:
* getActions() Returns the normalized method list and request header list, in the form:
* implies(Permission p) Checks if this URLPermission implies the given permission.
*
**/
public class URLPermissionDemo {
}
| [
"2506597416@qq.com"
] | 2506597416@qq.com |
92588e18c153c218560ef10f78412852e49ece0c | 32f42c4ad215f76837bc232e999d7ac32792bcea | /Sept/7thSept/Twenty5.java | 32946e7723c9c088092a41aa9057a45e6a91348e | [] | no_license | rajesh4java/ht | 2315c05f95dd7a4be92530f5267a1ef33ec0cff9 | 6a49d4672ebd14ce9e3fbc369a8c85cfcd5e8905 | refs/heads/master | 2021-01-01T19:25:05.756495 | 2014-09-21T04:01:54 | 2014-09-21T04:01:54 | 24,281,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java |
class Twenty5
{
public static void main(String []args)
{
System.out.println("Vishnu");
int n[]=new int[214748364];
System.out.println(n.length);
}
}
| [
"vinideas@gmail.com"
] | vinideas@gmail.com |
e329c22a22b37135bc78be8535fb1cd0ed6280b4 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/spoon/learning/6869/PrintingContext.java | 1c3537b19be9ceda96d3e7e667c3b15d8aa3d883 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,708 | java | /**
* Copyright (C) 2006-2018 INRIA and contributors
* Spoon - http://spoon.gforge.inria.fr/
*
* This software is governed by the CeCILL-C License under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at http://www.cecill.info.
*
* This program 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 CeCILL-C License for more details.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
package spoon.reflect.visitor;
import spoon.reflect.code.CtExpression;
import spoon.reflect.code.CtStatement;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.declaration.CtType;
import spoon.reflect.reference.CtTypeReference;
import java.util.ArrayDeque;
import java.util.Deque;
public class PrintingContext {
private long NEXT_FOR_VARIABLE = 1 << 0;
private long IGNORE_GENERICS = 1 << 1;
private long SKIP_ARRAY = 1 << 2;
private long IGNORE_STATIC_ACCESS = 1 << 3;
private long IGNORE_ENCLOSING_CLASS = 1 << 4;
private long FORCE_WILDCARD_GENERICS = 1 << 5;
private long FIRST_FOR_VARIABLE = 1 << 6;
private long state;
private CtStatement statement;
/**
* @return true if we are printing first variable declaration of CtFor statement
*/
public boolean isFirstForVariable() {
return (state & FIRST_FOR_VARIABLE) != 0L;
}
/**
* @return true if we are printing second or next variable declaration of CtFor statement
*/
public boolean isNextForVariable() {
return (state & NEXT_FOR_VARIABLE) != 0L;
}
public boolean ignoreGenerics() {
return (state & IGNORE_GENERICS) != 0L;
}
public boolean skipArray() {
return (state & SKIP_ARRAY) != 0L;
}
public boolean ignoreStaticAccess() {
return (state & IGNORE_STATIC_ACCESS) != 0L;
}
public boolean ignoreEnclosingClass() {
return (state & IGNORE_ENCLOSING_CLASS) != 0L;
}
public boolean forceWildcardGenerics() {
return (state & FORCE_WILDCARD_GENERICS) != 0L;
}
/**
* @return true if `stmt` has to be handled as statement in current printing context
*/
public boolean isStatement(CtStatement stmt) {
return this.statement == stmt;
}
public class Writable implements AutoCloseable {
private long oldState;
private CtStatement oldStatement;
protected Writable() {
oldState = state;
oldStatement = statement;
}
@Override
public void close() {
state = oldState;
statement = oldStatement;
}
/**
* @param v use true if printing first variable declaration of CtFor statement
*/
public <T extends Writable> T isFirstForVariable(boolean v) {
setState (FIRST_FOR_VARIABLE, v);
return (T) this;
}
/**
* @param v use true if printing second or next variable declaration of CtFor statement
*/
public <T extends Writable> T isNextForVariable(boolean v) {
setState(NEXT_FOR_VARIABLE, v);
return (T) this;
}
public <T extends Writable> T ignoreGenerics(boolean v) {
setState(IGNORE_GENERICS, v);
return (T) this;
}
public <T extends Writable> T skipArray(boolean v) {
setState(SKIP_ARRAY, v);
return (T) this;
}
public <T extends Writable> T ignoreStaticAccess(boolean v) {
setState(IGNORE_STATIC_ACCESS, v);
return (T) this;
}
public <T extends Writable> T ignoreEnclosingClass(boolean v) {
setState(IGNORE_ENCLOSING_CLASS, v);
return (T) this;
}
public <T extends Writable> T forceWildcardGenerics(boolean v) {
setState(FORCE_WILDCARD_GENERICS, v);
return (T) this;
}
/**
* There are statements (e.g. invocation), which may play role of expression too.
* They have to be suffixed by semicolon depending on the printing context.
* Call this method to inform printer that invocation is used as statement.
*
* @param stmt the instance of the actually printed statement.
* Such statement will be finished by semicolon.
*/
public <T extends Writable> T setStatement(CtStatement stmt) {
statement = stmt;
return (T) this;
}
private void setState(long mask, boolean v) {
state = v ? state | mask : state & ~mask;
}
}
public Writable modify() {
return new Writable();
}
Deque<CacheBasedConflictFinder> currentThis = new ArrayDeque<>();
/**
* @return top level type
*/
public CtTypeReference<?> getCurrentTypeReference() {
if (currentTopLevel != null) {
CacheBasedConflictFinder tc = getCurrentTypeContext();
if (tc != null) {
return tc.typeRef;
}
return currentTopLevel.getReference();
}
return null;
}
private CacheBasedConflictFinder getCurrentTypeContext() {
if (currentThis != null && !currentThis.isEmpty()) {
return currentThis.peek();
}
return null;
}
public void pushCurrentThis(CtType<?> type) {
currentThis.push(new CacheBasedConflictFinder(type));
}
public void popCurrentThis() {
currentThis.pop();
}
Deque<CtElement> elementStack = new ArrayDeque<>();
Deque<CtExpression<?>> parenthesedExpression = new ArrayDeque<>();
CtType<?> currentTopLevel;
@Override
public String toString() {
return "context.ignoreGenerics: " + ignoreGenerics() + "\n";
}
/**
* @param typeRef
* @return true if typeRef is equal to current (actually printed) Type (currentThis)
*/
public boolean isInCurrentScope(CtTypeReference<?> typeRef) {
CtTypeReference<?> currentTypeRef = getCurrentTypeReference();
return typeRef.equals(currentTypeRef);
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
a8cf37dc44888caee5dbf3d629aeba4ca0afd2fc | c6291d69cd9ca73ee7c9649409f1f5f3666bbaee | /src/main/java/com/example/wxorder/service/impl/OrderServiceImpl.java | 241941eaec335dfc4fadabc2ad21ee1adab246d8 | [] | no_license | wangxiaotian23/wxorder | 4bbb7d72bf561a0a64f7b4c9a6280e821d5ee091 | ce1adf49c3826357c09af472ecb5dce01e51e42a | refs/heads/master | 2020-09-09T12:24:49.419024 | 2019-11-21T00:03:00 | 2019-11-21T00:03:00 | 221,446,132 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,571 | java | package com.example.wxorder.service.impl;
import com.example.wxorder.converter.OrderMaster2OrderDTOConverter;
import com.example.wxorder.dao.OrderDetailDao;
import com.example.wxorder.dao.OrderMasterDao;
import com.example.wxorder.dto.CartDto;
import com.example.wxorder.dto.OrderDTO;
import com.example.wxorder.entity.OrderDetail;
import com.example.wxorder.entity.OrderMaster;
import com.example.wxorder.entity.ProductInfo;
import com.example.wxorder.enums.OrderStatusEnum;
import com.example.wxorder.enums.PayStatusEnum;
import com.example.wxorder.enums.ResultEnum;
import com.example.wxorder.exception.SellException;
import com.example.wxorder.service.OrderService;
import com.example.wxorder.service.ProductInfoService;
import com.example.wxorder.utils.KeyUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Auther: 李清依
* @Date: 2019/11/15 10:23
* @Description:
*/
@Service
@Slf4j
public class OrderServiceImpl implements OrderService {
@Autowired
private OrderDetailDao orderDetailDao;
@Autowired
private OrderMasterDao orderMasterDao;
@Autowired
private ProductInfoService productInfoService;
@Transactional
@Override
public OrderDTO create(OrderDTO orderDTO) {
String orderId = KeyUtil.getUniqueKey();
BigDecimal orderAmount = new BigDecimal(BigInteger.ZERO);
for(OrderDetail orderDetail:orderDTO.getOrderDetailList()){
ProductInfo productInfo = productInfoService.findById(orderDetail.getProductId());
if(productInfo==null){//商品不存在
throw new SellException(ResultEnum.PRODUCT_NOT_EXIST);
// throw new ResponseBankException(ResultEnum.PRODUCT_NOT_EXIST);//修改状态码返回
}
//2.计算总价
orderAmount=productInfo.getProductPrice()
.multiply(new BigDecimal(orderDetail.getProductQuantity()))//相乘- 计算出一种商品的总价
.add(orderAmount);
//订单详情入库
orderDetail.setDetailId(KeyUtil.getUniqueKey());
orderDetail.setOrderId(orderId);
//商品图片,名字等
// orderDetail.setProductName(productInfo.getProductName());//不要这样写,要写很多
BeanUtils.copyProperties(productInfo,orderDetail);//拷贝对应的属性值,将productInfo的属性值拷贝到orderDetail ,所以如果有不为null的属性值,记得写在前面
orderDetailDao.save(orderDetail);
// CartDTO cartDTO = new CartDTO(orderDetail.getProductId(),orderDetail.getProductQuantity());//方式一
// cartDTOList.add(cartDTO);//方式一
//扣库存放在下面了,不污染这里的代码,请见方式二
}
//3.写入订单数据库(orderMaster和orderDetail)
OrderMaster orderMaster = new OrderMaster();
orderDTO.setOrderId(orderId);
//Spring的对象拷贝函数 - 属性值是null的也会被拷贝进去,所以如果有不为null的属性值,记得写在前面。但是注意,有点默认值也会被写回去
BeanUtils.copyProperties(orderDTO,orderMaster);//将orderDTO拷贝到orderMaster
orderMaster.setOrderAmount(orderAmount);
//这两个状态值被覆盖为null了,记得写回去
orderMaster.setOrderStatus(OrderStatusEnum.NEW.getCode());
orderMaster.setPayStatus(PayStatusEnum.WAIT.getCode());
orderMasterDao.save(orderMaster);
//4.扣库存
//方式二
//TODO 在这里,产生高并发的情况下,会出现超卖的情况 - 也就是会出现把库存扣到负数的情况
List<CartDto> cartDTOList = orderDTO.getOrderDetailList().stream().map(e->
new CartDto(e.getProductId(),e.getProductQuantity()))
.collect(Collectors.toList());//Java8新特性 (java8 lambda) 推荐
productInfoService.decreaseStock(cartDTOList);//判断数量是否够
//发送websocket消息
//webSocket.sendMessage(orderDTO.getOrderId());
return orderDTO;
}
@Override
public OrderDTO findOne(String orderId) {
OrderDTO orderDTO=new OrderDTO();
OrderMaster orderMaster=orderMasterDao.findById(orderId).get();
if (orderMaster==null){
throw new SellException(ResultEnum.ORDER_NOT_EXIST);
}
List<OrderDetail> orderDetailList=orderDetailDao.findByOrderId(orderId);
if (CollectionUtils.isEmpty(orderDetailList)){
throw new SellException(ResultEnum.ORDERDETAIL_NOT_EXIST);
}
BeanUtils.copyProperties(orderMaster,orderDTO);
orderDTO.setOrderDetailList(orderDetailList);
return orderDTO;
}
@Override
public Page<OrderDTO> findList(String buyerOpenId, Pageable pageable) {
Page<OrderMaster> orderMasterPage=orderMasterDao.findByBuyerOpenid(buyerOpenId,pageable);
List<OrderDTO> orderDTOList= OrderMaster2OrderDTOConverter.convert(orderMasterPage.getContent());
return new PageImpl<>(orderDTOList,pageable,orderMasterPage.getTotalElements());
}
@Override
public Page<OrderDTO> findList(Pageable pageable) {
return null;
}
@Transactional
@Override
public OrderDTO cancel(OrderDTO orderDTO) {
OrderMaster orderMaster=new OrderMaster();
//BeanUtils.copyProperties(orderDTO,orderMaster);
//判断订单状态
if (!orderDTO.getPayStatus().equals(OrderStatusEnum.NEW.getCode())){
log.error("[取消订单] 订单状态不正确,orderId={},orderStatus={}",orderDTO.getOrderId(),orderDTO.getOrderStatus());
throw new SellException(ResultEnum.ORDER_STATUS_ERROR);
}
//修改订单状态
orderDTO.setOrderStatus(OrderStatusEnum.CANCEL.getCode());
BeanUtils.copyProperties(orderDTO,orderMaster);
OrderMaster updateResult=orderMasterDao.save(orderMaster);
if(updateResult == null){
log.error("[取消订单] 更新失败,orderMaster={}",orderMaster);
throw new SellException(ResultEnum.ORDER_UPDATE_FAIL);
}
//返回库存
//先判断有没有商品
if (CollectionUtils.isEmpty(orderDTO.getOrderDetailList())){
log.error("[取消订单] 订单中无商品,orderDTO={}",orderDTO);
throw new SellException(ResultEnum.ORDER_DETAIL_EMPTY);
}
//lambda表达式
List<CartDto> cartDtoList=orderDTO.getOrderDetailList().stream()
.map(e->new CartDto(e.getProductId(),e.getProductQuantity()))
.collect(Collectors.toList());
productInfoService.increaseStock(cartDtoList);
//如果已支付,需退款
if(orderDTO.getPayStatus().equals(PayStatusEnum.SUCCESS.getCode())){
//进行退款
//TODO
//payService.refund(orderDTO);
}
return orderDTO;
}
@Transactional
@Override
public OrderDTO finish(OrderDTO orderDTO) {
//判断订单状态
if (!orderDTO.getPayStatus().equals(OrderStatusEnum.NEW.getCode())){
log.error("[取消订单] 订单状态不正确,orderId={},orderStatus={}",orderDTO.getOrderId(),orderDTO.getOrderStatus());
throw new SellException(ResultEnum.ORDER_STATUS_ERROR);
}
//修改订单状态
orderDTO.setOrderStatus(OrderStatusEnum.FINISH.getCode());
OrderMaster orderMaster=new OrderMaster();
BeanUtils.copyProperties(orderDTO,orderMaster);
OrderMaster updateResult=orderMasterDao.save(orderMaster);
if (updateResult==null){
log.error("【完结订单】更新失败,orderMaster={}",orderMaster);
throw new SellException(ResultEnum.ORDER_UPDATE_FAIL);
}
return orderDTO;
}
@Transactional
@Override
public OrderDTO paid(OrderDTO orderDTO) {
//判断订单状态
if(!orderDTO.getOrderStatus().equals(OrderStatusEnum.NEW.getCode())){
log.error("[订单支付完成] 订单状态不正确,orderDTO={}",orderDTO);
throw new SellException(ResultEnum.ORDER_STATUS_ERROR);
}
//判断支付状态
if (!orderDTO.getPayStatus().equals(PayStatusEnum.WAIT.getCode())){
log.error("[订单支付完成] 订单支付状态不正确,orderDTO={}",orderDTO);
throw new SellException(ResultEnum.ORDER_PAY_STATUS_ERROR);
}
//修改订单状态
orderDTO.setPayStatus(PayStatusEnum.SUCCESS.getCode());
OrderMaster orderMaster=new OrderMaster();
BeanUtils.copyProperties(orderDTO,orderMaster);
OrderMaster updateResult = orderMasterDao.save(orderMaster);
if(updateResult==null){
log.error("[订单支付完成] 更新失败,orderMaster={}",orderMaster);
throw new SellException(ResultEnum.ORDER_UPDATE_FAIL);
}
return orderDTO;
}
}
| [
"1941779441@qq.com"
] | 1941779441@qq.com |
867d97d5b7418db070e373c7e89f47ff19f095fc | 9f3fc2bac1f69b4bd45ae2f336b4bcb508abf9a8 | /v9.2.0/tools/SLBReport/src/net/project/hibernate/model/PnPersonAuthenticatorPK.java | 9db3a15ea1a93297f1fa1daa66dea53cd4b8c46b | [] | no_license | nicolassemeniuk/project-ar | d46ccdbc0437391dad41ba09dd183d97ed9a7341 | 5762986946d8d693d9536fb0fc1e611199fcc109 | refs/heads/master | 2021-01-23T03:08:02.416898 | 2015-04-02T11:43:43 | 2015-04-02T11:43:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,056 | java | package net.project.hibernate.model;
import java.io.Serializable;
import java.math.BigDecimal;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class PnPersonAuthenticatorPK implements Serializable {
/** identifier field */
private BigDecimal personId;
/** identifier field */
private BigDecimal authenticatorId;
/** full constructor */
public PnPersonAuthenticatorPK(BigDecimal personId, BigDecimal authenticatorId) {
this.personId = personId;
this.authenticatorId = authenticatorId;
}
/** default constructor */
public PnPersonAuthenticatorPK() {
}
public BigDecimal getPersonId() {
return this.personId;
}
public void setPersonId(BigDecimal personId) {
this.personId = personId;
}
public BigDecimal getAuthenticatorId() {
return this.authenticatorId;
}
public void setAuthenticatorId(BigDecimal authenticatorId) {
this.authenticatorId = authenticatorId;
}
public String toString() {
return new ToStringBuilder(this)
.append("personId", getPersonId())
.append("authenticatorId", getAuthenticatorId())
.toString();
}
public boolean equals(Object other) {
if ( (this == other ) ) return true;
if ( !(other instanceof PnPersonAuthenticatorPK) ) return false;
PnPersonAuthenticatorPK castOther = (PnPersonAuthenticatorPK) other;
return new EqualsBuilder()
.append(this.getPersonId(), castOther.getPersonId())
.append(this.getAuthenticatorId(), castOther.getAuthenticatorId())
.isEquals();
}
public int hashCode() {
return new HashCodeBuilder()
.append(getPersonId())
.append(getAuthenticatorId())
.toHashCode();
}
}
| [
"rsavoie@users.noreply.github.com"
] | rsavoie@users.noreply.github.com |
944f92787b47361fca6b1d539155fca3f7a9519f | a640993160269612ec06ac13535a238debe40b6e | /app/src/main/java/com/example/mad_project/ui/gallery/GalleryViewModel.java | 54b642b9e85434bccaa8410161cd41c0127261a0 | [] | no_license | PasinduManeka/CodeLearner | 6e5c6d162f93eaac3d336861209e1adac88a72ec | d7ebb6a20929f780bb07c76eb5347b517a90f647 | refs/heads/main | 2023-03-03T04:17:10.366634 | 2021-02-17T11:41:48 | 2021-02-17T11:41:48 | 339,702,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package com.example.mad_project.ui.gallery;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class GalleryViewModel extends ViewModel {
private MutableLiveData<String> mText;
public GalleryViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is gallery fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"manekaherat815@gmail.com"
] | manekaherat815@gmail.com |
02230d42ee839434666a9d54b45afd04af98e0a6 | 3ad2bf18120d6e481e3650c49fbe8257c72aeabc | /uva10903.java | b233fa69e25a0ad5fd69a1fa8f83442bb1af427a | [
"MIT"
] | permissive | pokai0426/java_practice | a25fe24846e5e8c78b92ae4857ab87ffcbaa04af | 44c94bc25463ba316bca1c49e9679ef5df268a1b | refs/heads/master | 2020-04-01T14:12:06.058719 | 2018-10-16T12:57:28 | 2018-10-16T12:57:28 | 153,284,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,545 | java | import java.util.Scanner;
import java.text.DecimalFormat;
public class uva10903{
public static void main(String args[]){
DecimalFormat df = new DecimalFormat("#0.000");
Scanner sc=new Scanner(System.in);
while(true)
{
int n=sc.nextInt();
if(n==0)
break;
int k=sc.nextInt();
double[] win =new double[99];
double[] lose =new double[99];
for(int i=1;i<=(n*k*(n-1))/2;i++)
{
int p1=sc.nextInt();
String p1_1=sc.next();
int p2=sc.nextInt();
String p2_1=sc.next();
if(p1_1.equals("rock") && p2_1.equals("paper"))
{
win[p2]++;
lose[p1]++;
}
if(p1_1.equals("rock") && p2_1.equals("scissors"))
{
win[p1]++;
lose[p2]++;
}
if(p1_1.equals("scissors") && p2_1.equals("paper"))
{
win[p1]++;
lose[p2]++;
}
if(p1_1.equals("scissors") && p2_1.equals("rock"))
{
win[p2]++;
lose[p1]++;
}
if(p1_1.equals("paper") && p2_1.equals("rock"))
{
win[p1]++;
lose[p2]++;
}
if(p1_1.equals("paper") && p2_1.equals("scissors"))
{
win[p2]++;
lose[p1]++;
}
}
for(int j=1;j<=n;j++)
{
if(win[j]+lose[j]==0)
System.out.println("-");
else
{
double rat=win[j]/(win[j]+lose[j]);
System.out.println(df.format(rat));
}
win[j]=0;
lose[j]=0;
}
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
d89582cf5d575e53ffbba7ea34a516240a65c6c0 | 3ed8c08f0c6244731f83ebe44426f4b2636fdd84 | /src/main/java/com/zjw/consumer/service/impl/HelloRemoteHystrix.java | 38895f9c4e6793db2a7dd0f08e6fbb8a2fa17fcb | [] | no_license | abc1wait/hellowword | 9a434d4aa967f54b8028fef75d54a4fb6aaa5f53 | bd93d2232199dca9609b8ae228df5cd111f596ad | refs/heads/master | 2023-06-29T09:02:00.756882 | 2021-08-03T07:32:02 | 2021-08-03T07:32:02 | 392,227,511 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 496 | java | package com.zjw.consumer.service.impl;
import com.zjw.consumer.service.HelloRemote;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @author 朱建文
* @version 1.0
* @date 2021/8/3 10:30
* @describe
*/
@Component
public class HelloRemoteHystrix implements HelloRemote {
@Override
public String hello(@RequestParam(value = "name") String name) {
return "hello" +name+", this messge send failed ";
}
}
| [
"jianwen.zhu@eprobj.com.cn"
] | jianwen.zhu@eprobj.com.cn |
045ba716e0a2c361a341227514f8f89344eadb94 | 2552a00bf856518d4c80df851dba895811f1bb6e | /src/main/java/edu/stanford/nlp/ling/CoreAnnotations.java | dede2ad7778453b30bfde5f35d1ce7c583502c4a | [] | no_license | marcelmaatkamp/EntityExtractorUtils | d41a959964faf7d424e3bb0d7aad40a520fc3292 | 5157f1ad40f7e9b077fe8195588c7f316a5e72aa | refs/heads/master | 2021-01-22T09:20:35.495376 | 2014-09-02T07:53:27 | 2014-09-02T07:53:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,539 | java | package edu.stanford.nlp.ling;
import java.util.List;
import java.util.Map;
import edu.stanford.nlp.util.CoreMap;
import edu.stanford.nlp.util.IntPair;
import edu.stanford.nlp.util.Pair;
import edu.stanford.nlp.util.Triple;
/**
* <p>Set of common annotations for {@link CoreMap}'s. The classes defined
* here are typesafe keys for getting and setting annotation values.
* These classes need not be instantiated outside of this class. e.g
* {@link WordAnnotation}.class serves as the key and a <code>String</code>
* serves as the value containing the corresponding word.</p>
*
* <p>New types of {@link CoreAnnotation} can be defined anywhere that is
* convenient in the source tree - they are just classes. This file exists
* to hold widely used "core" annotations and others inherited from the
* {@link Label} family. In general, most keys should be placed in this file
* as they may often be reused throughout the code. This architecture allows
* for flexibility, but in many ways it should be considered as equivalent
* to an enum in which everything should be defined</p>
*
* <p>The getType method required by CoreAnnotation must return the same class
* type as its value type parameter. It feels like one should be able to get
* away without that method, but because Java erases the generic type signature,
* that info disappears at runtime. See {@link ValueAnnotation} for an
* example.</p>
*
* @author dramage
* @author rafferty
*/
public class CoreAnnotations {
private CoreAnnotations() {} // only static members
/**
* These are the keys hashed on by IndexedWord
*/
/**
* This refers to the unique identifier for a "document", where document
* may vary based on your application.
*/
public static class DocIDAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* This is generally an individual word or feature index - it is local,
* and may not be uniquely identifying without other identifiers such
* as sentence and doc. However, if these are the same, the index annotation
* should be a unique identifier for differentiating objects.
*/
public static class IndexAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* Unique identifier within a document for a given sentence.
*/
public static class SentenceIndexAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* Contains the "value" - an ill-defined string used widely in MapLabel.
*/
public static class ValueAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* String value of the word.
*/
public static class WordAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CategoryAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Annotation for the word appearing before this word
*/
public static class BeforeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Annotation for the word appear after this word
*/
public static class AfterAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Penn POS tag in String form
*/
public static class TagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CoarseTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CoNLLDepAnnotation implements CoreAnnotation<CoreMap> {
public Class<CoreMap> getType() { return CoreMap.class; } }
public static class CoNLLPredicateAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class CoNLLSRLAnnotation implements CoreAnnotation<Map> {
public Class<Map> getType() { return Map.class; } }
public static class CoNLLDepTypeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CoNLLDepParentIndexAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
public static class CurrentAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CharacterOffsetStart implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
public static class CharacterOffsetEnd implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* Lemma for the word this label represents
*/
public static class LemmaAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Inverse document frequency of the word this label represents
*/
public static class IDFAnnotation implements CoreAnnotation<Double> {
public Class<Double> getType() { return Double.class; } }
/**
* Keys from AbstractMapLabel (descriptions taken from that class)
*/
/**
* The standard key for storing a projected category in the map, as a String.
* For any word (leaf node), the projected category is the syntactic category
* of the maximal constituent headed by the word. Used in SemanticGraph.
*/
public static class ProjectedCategoryAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for a propbank label which is of type Argument
*/
public static class ArgumentAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Another key used for propbank - to signify core arg nodes or predicate nodes
*/
public static class MarkingAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for Semantic Head Word which is a String
*/
public static class SemanticHeadWordAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for Semantic Head Word POS which is a String
*/
public static class SemanticHeadTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Probank key for the Verb sense given in the Propbank Annotation, should
* only be in the verbnode
*/
public static class VerbSenseAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for storing category with functional tags.
*/
public static class CategoryFunctionalTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* the standard key for the NER label. (e.g., DATE, PERSON, etc.)
*/
public static class NERAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* POS tag for the NER (Note: not sure why this differs from "tag" annotation
*/
public static class NERTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* This is an NER ID annotation (in case the all caps parsing didn't work out for you...)
*/
public static class NERIDAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The key for the normalized value of numeric named entities.
*/
public static class NormalizedNERAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public enum SRL_ID { ARG, NO, ALL_NO, REL }
/**
* The key for semantic role labels (Note: please add to this description if you use this key)
*/
public static class SRLIDAnnotation implements CoreAnnotation<SRL_ID> {
public Class<SRL_ID> getType() { return SRL_ID.class; } }
/**
* the standard key for the coref label.
*/
public static class CorefAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** The standard key for the "shape" of a word: a String representing
* the type of characters in a word, such as "Xx" for a capitalized word.
* See {@link edu.stanford.nlp.process.WordShapeClassifier} for functions
* for making shape strings.
*/
public static class ShapeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The Standard key for storing the left terminal number relative to the
* root of the tree of the leftmost terminal dominated by the current node
*/
public static class LeftTermAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* The standard key for the parent which is a String
*/
public static class ParentAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class INAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for span which is an IntPair
*/
public static class SpanAnnotation implements CoreAnnotation<IntPair> {
public Class<IntPair> getType() { return IntPair.class; } }
/**
* The standard key for the answer which is a String
*/
public static class AnswerAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for gold answer which is a String
*/
public static class GoldAnswerAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for the features which is a Collection
*/
public static class FeaturesAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for the semantic interpretation
*/
public static class InterpretationAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for the semantic role label of a phrase.
*/
public static class RoleAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The standard key for the gazetteer information
*/
public static class GazetteerAnnotation implements CoreAnnotation<List<String>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<String>> getType() { return (Class) List.class; } }
/**
* Morphological stem of the word this label represents
*/
public static class StemAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class PolarityAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* for Chinese: character level information, segmentation
*/
public static class ChineseCharAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class ChineseOrigSegAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class ChineseSegAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** Not sure exactly what this is, but it is different from ChineseSegAnnotation and seems to indicate if the text is segmented */
public static class ChineseIsSegmentedAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
/** The character offset of first character of token in source. */
public static class BeginPositionAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/** The character offset of last character of token in source. */
public static class EndPositionAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* Key for relative value of a word - used in RTE
*/
public static class CostMagnificationAnnotation implements CoreAnnotation<Double> {
public Class<Double> getType() { return Double.class; } }
public static class WordSenseAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SRLInstancesAnnotation implements CoreAnnotation<List<List<Pair<String,Pair>>>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<List<Pair<String,Pair>>>> getType() { return (Class) List.class; } }
/**
* Used by RTE to track number of text sentences, to determine when hyp sentences begin.
*/
public static class NumTxtSentencesAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
/**
* Used in Trees
*/
public static class TagLabelAnnotation implements CoreAnnotation<Label> {
public Class<Label> getType() { return Label.class; } }
/**
* Used in CRFClassifier stuff
* PositionAnnotation should possibly be an int - it's present as either an int or string depending on context
* CharAnnotation may be "CharacterAnnotation" - not sure
*/
public static class PositionAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CharAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class PrevSGMLAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class AfterSGMLAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
//note: this is not a catchall "unknown" annotation but seems to have a specific meaning for sequence classifiers
public static class UnknownAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class IDAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
//possibly this should be grouped with gazetteer annotation - original key was "gaz"
public static class GazAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class PossibleAnswersAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class DistSimAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class AbbrAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class ChunkAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class GovernorAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class AbgeneAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class GeniaAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class AbstrAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class FreqAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class DictAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class WebAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class FemaleGazAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class MaleGazAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class LastGazAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** it really seems like this should have a different name or else be a boolean */
public static class IsURLAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class EntityTypeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** it really seems like this should have a different name or else be a boolean */
public static class IsDateRangeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class PredictedAnswerAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** Seems like this could be consolidated with something else... */
public static class OriginalAnswerAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/** Seems like this could be consolidated with something else... */
public static class OriginalCharAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class UTypeAnnotation implements CoreAnnotation<Integer> {
public Class<Integer> getType() { return Integer.class; } }
public static class EntityRuleAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SectionAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class WordPosAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class ParaPosAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SentencePosAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
//Why do both this and sentenceposannotation exist? I don't know, but one class
//uses both so here they remain for now...
public static class SentenceIDAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class EntityClassAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class AnswerObjectAnnotation implements CoreAnnotation<Object> {
public Class<Object> getType() { return Object.class; } }
/**
* Used in Task3 Pascal system
*/
public static class BestCliquesAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class BestFullAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class LastTaggedAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Used in wsd.supwsd package
*/
public static class LabelAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class NeighborsAnnotation implements CoreAnnotation<List<Pair<WordLemmaTag,String>>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<Pair<WordLemmaTag,String>>> getType() { return (Class) List.class; } }
public static class ContextsAnnotation implements CoreAnnotation<List<Pair<String, String>>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<Pair<String, String>>> getType() { return (Class) List.class; } }
public static class DependentsAnnotation implements CoreAnnotation<List<Pair<Triple<String, String, String>, String>>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<Pair<Triple<String, String, String>, String>>> getType() { return (Class) List.class; } }
public static class WordFormAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class TrueTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SubcategorizationAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class BagOfWordsAnnotation implements CoreAnnotation<List<Pair<String,String>>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<Pair<String, String>>> getType() { return (Class) List.class; } }
/**
* Used in srl.unsup
*/
public static class HeightAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class LengthAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Used in Gale2007ChineseSegmenter
*/
public static class LBeginAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class LMiddleAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class LEndAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class D2_LBeginAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class D2_LMiddleAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class D2_LEndAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class UBlockAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SpaceBeforeAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Used in parser.discrim
*/
public static class StateAnnotation implements CoreAnnotation<CoreLabel> {
public Class<CoreLabel> getType() { return CoreLabel.class; } }
public static class PrevChildAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class FirstChildAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class UnaryAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class DoAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class HaveAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class BeAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class NotAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class PercentAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class GrandparentAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* The key for storing a Head word as a string rather than a pointer
* (as in TreeCoreAnnotations.HeadWordAnnotation)
*/
public static class HeadWordStringAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Used in nlp.coref
*/
public static class MonthAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class DayAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class YearAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
/**
* Used in propbank.srl
*/
public static class PriorAnnotation implements CoreAnnotation<Map<String, Double>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<Map<String, Double>> getType() { return (Class) Map.class; } }
public static class SemanticWordAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class SemanticTagAnnotation implements CoreAnnotation<String> {
public Class<String> getType() { return String.class; } }
public static class CovertIDAnnotation implements CoreAnnotation<List<IntPair>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<List<IntPair>> getType() { return (Class) List.class; } }
public static class ArgDescendentAnnotation implements CoreAnnotation<Pair<String, Double>> {
@SuppressWarnings({"unchecked", "RedundantCast"})
public Class<Pair<String, Double>> getType() { return (Class) Pair.class; } }
/**
* Used in nlp.trees
*/
public static class CopyAnnotation implements CoreAnnotation<Boolean> {
public Class<Boolean> getType() { return Boolean.class; } }
public static class ValueLabelAnnotation implements CoreAnnotation<Label> {
public Class<Label> getType() { return Label.class; } }
}
| [
"you@example.com"
] | you@example.com |
0367868f00462b0347f4cf4d61aa18480cb66902 | 3898d6d186a61e8be3709141d40f7b949ce09d48 | /src/main/java/com/cisco/axl/api/_10/ListImeRouteFilterElementRes.java | 374b8acc1887277dadc04e8ae5ba364617e27fa4 | [] | no_license | dert261/cucmAxlImpl | a155bf1a8694a341fe932f8f601dafadd2a374a1 | 3000b6e614937d973cd4444a0dd7faf2513f569a | refs/heads/master | 2021-01-21T04:19:13.714018 | 2016-06-29T08:07:29 | 2016-06-29T08:07:29 | 54,956,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,092 | java |
package com.cisco.axl.api._10;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ListImeRouteFilterElementRes complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ListImeRouteFilterElementRes">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/10.0}APIResponse">
* <sequence>
* <element name="return">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ListImeRouteFilterElementRes", propOrder = {
"_return"
})
public class ListImeRouteFilterElementRes
extends APIResponse
{
@XmlElement(name = "return", required = true)
protected ListImeRouteFilterElementRes.Return _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public ListImeRouteFilterElementRes.Return getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public void setReturn(ListImeRouteFilterElementRes.Return value) {
this._return = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"imeRouteFilterElement"
})
public static class Return {
protected List<LImeRouteFilterElement> imeRouteFilterElement;
/**
* Gets the value of the imeRouteFilterElement property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the imeRouteFilterElement property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getImeRouteFilterElement().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LImeRouteFilterElement }
*
*
*/
public List<LImeRouteFilterElement> getImeRouteFilterElement() {
if (imeRouteFilterElement == null) {
imeRouteFilterElement = new ArrayList<LImeRouteFilterElement>();
}
return this.imeRouteFilterElement;
}
}
}
| [
"v.bozhenkov@obelisk-voip.ru"
] | v.bozhenkov@obelisk-voip.ru |
ecc123b27423bf9733a19b045d798bbbd7f24ea4 | 46d5d1c784c4d90eb1a2176c4245a82f8b4104e2 | /BrowserFactory.java | 0a73f5f77d3fd0a928cdb2cb83da32b125de3234 | [] | no_license | jamesngondo2013/ChromeMobileBrowserTestingFramework | 6cd63694c0350555aba3dcfcf7f1d55e11436872 | 4e442a147417ae07261eba4bcd446240656dbe63 | refs/heads/master | 2023-02-26T07:45:36.137050 | 2021-01-27T11:27:05 | 2021-01-27T11:27:05 | 293,127,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,339 | java | package managers;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.james.api.context.TestObject;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileBrowserType;
public class BrowserFactory {
public WebDriver driver;
public TestObject testObject;
DesiredCapabilities capabilities;
public BrowserFactory(TestObject testObject) {
this.testObject = testObject;
}
public void launchDriver(String browser, boolean useGrid) {
//String gridURL = "";
String gridURL = "http//testing122334.test.com:4600/wd/hub";
String mobileGridURL = "http//testing122334.seetest.com:4600/wd/hub";
String accessKey ="eydhdygfffkdkdurhr37fhg86gjgu0khkh";
if (System.getProperty("HUB_HOST") != null) {
gridURL = "http://" + System.getProperty("HUB_HOST") + ":4444/wd/hub";
}
switch (browser.toLowerCase()) {
case "android":
System.out.println("Starting Android");
capabilities = DesiredCapabilities.android();
capabilities.setCapability("accessKey", accessKey);
capabilities.setCapability("deviceQuery", "@os='android' and @category='PHONE'");
capabilities.setCapability("udid", "2789ef840");
capabilities.setBrowserName(MobileBrowserType.CHROME);
if (useGrid) {
try {
driver = new AndroidDriver<>(new URL(mobileGridURL), capabilities);
} catch (MalformedURLException e) {
System.out.println("Error in launching android mobile Chrome browser in Grid");
}
}
case "ios":
System.out.println("Starting iOS");
capabilities = DesiredCapabilities.iphone();
capabilities.setCapability("accessKey", accessKey);
capabilities.setCapability("deviceQuery", "@os='android' and @category='PHONE'");
capabilities.setCapability("udid", "2789ef840");
capabilities.setBrowserName(MobileBrowserType.SAFARI);
if (useGrid) {
try {
driver = new IOSDriver<>(new URL(mobileGridURL), capabilities);
} catch (MalformedURLException e) {
System.out.println("Error in launching ios mobile Chrome browser in Grid");
}
}
case "chrome":
HashMap<String, Object> chromePrefs = new HashMap<>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("safebrowsing.enabled", "true");
chromePrefs.put("disable-popup-blocking", "true");
chromePrefs.put("download.prompt_for_download", "false");
//Chrome Options
ChromeOptions options = new ChromeOptions();
//options.setExperimentalOption("useAutomationExtension", "false");
options.setExperimentalOption("prefs", chromePrefs);
//options.addArguments("test-type");
options.addArguments("--disable-extensions");
options.addArguments("--disable-web-security");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--no-sandbox");
//Capabilities
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities = DesiredCapabilities.chrome();
capabilities.setBrowserName("chrome");
capabilities.setPlatform(Platform.WINDOWS);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability("chrome.switches", Arrays.asList("--ignore-certificate-errors"));
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
if (useGrid) {
try {
driver = new RemoteWebDriver(new URL(gridURL), options);
} catch (MalformedURLException e) {
System.out.println("Error in launching Chrome browser in Grid");
}
}
else {
//System.setProperty("webdriver.chrome.driver", testObject.getServiceApi().getProp().getProperty("BROWSER").trim());
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
driver = new ChromeDriver();
}
break;
case "ie":
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.merge(ieCapabilities);
if (useGrid) {
try {
driver = new RemoteWebDriver(new URL(gridURL), ieOptions);
} catch (MalformedURLException e) {
System.out.println("Error in launching IE browser in Grid");
}
}
else {
System.setProperty("webdriver.ie.driver", "C:\\drivers\\IEDriver.exe");
driver = new InternetExplorerDriver(ieOptions);
}
default:
break;
}
driver.manage().window().maximize();
driver.manage().timeouts().pageLoadTimeout(90, TimeUnit.SECONDS);
testObject.setDriver(driver);
}
public WebDriver createChromeWithMobileEmulation(String deviceName, String browser, boolean useGrid) {
String gridURL = "http://vsfghhhhd.com/wd/hub";
if(System.getProperty("HUB_HOST") != null) {
gridURL = "http://"+System.getProperty("HUB_HOST")+ ":4444/wd/hub";
}
ChromeOptions chromeOptions = null;
switch (browser.toLowerCase()) {
case "chrome":
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", deviceName);
chromeOptions = new ChromeOptions();
chromeOptions.setExperimentalOption("mobileEmulation", mobileEmulation);
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
if (useGrid) {
try {
return new RemoteWebDriver(new URL(gridURL), chromeOptions);
} catch (Exception e) {
System.out.println("Error in launching browser in Grid");
}
}else {
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
return new ChromeDriver(chromeOptions);
}
break;
default:
break;
}
return new ChromeDriver(chromeOptions);
}
public WebDriver getDriver() {
return driver;
}
}
| [
"jamesngondo2013@outlook.com"
] | jamesngondo2013@outlook.com |
f1472be6a898ea0d0cd169dbc3dee2c8c9b16efb | c8d9d9b133d9786806fc9734346d938892bde61d | /src/br/com/fiap/model/Grupo.java | f133105afec6cb4db494b96cd01a0235bfa9405b | [] | no_license | EduAraujoDev/AmigoSecreto | 4180e35fa1b8d93f5b51fbc77defcd47493f5f7e | a32146016e905e8cbb28fb7f5b984dbe91640d5f | refs/heads/master | 2020-12-30T14:00:21.381381 | 2017-05-16T01:35:43 | 2017-05-16T01:35:43 | 91,271,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,919 | java | package br.com.fiap.model;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "Grupo")
public class Grupo implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "gru_codigo")
private Integer codigo;
@Column(name = "gru_codigoAcesso", length = 8)
private String codigoAcesso;
@Column(name = "gru_nome", length = 5)
private String nome;
@Column(name = "gru_inicio")
private Date dataInicio;
@Column(name = "gru_final")
private Date dataFinal;
@OneToMany(mappedBy = "grupo", targetEntity = Usuario.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private Set<Usuario> usuarios = new LinkedHashSet<Usuario>();
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public String getCodigoAcesso() {
return codigoAcesso;
}
public void setCodigoAcesso(String codigoAcesso) {
this.codigoAcesso = codigoAcesso;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Date getDataInicio() {
return dataInicio;
}
public void setDataInicio(Date dataInicio) {
this.dataInicio = dataInicio;
}
public Date getDataFinal() {
return dataFinal;
}
public void setDataFinal(Date dataFinal) {
this.dataFinal = dataFinal;
}
public Set<Usuario> getUsuarios() {
return usuarios;
}
public void setUsuarios(Set<Usuario> usuarios) {
this.usuarios = usuarios;
}
}
| [
"eduardo.araujo0@outlook.com"
] | eduardo.araujo0@outlook.com |
b497edd40cafe9b3cb3f673c97cff61a6dcb943d | adf696972535062d8cfb68e0bf54451119ffe54a | /src/recursion/Recursion.java | 6da008c283e94c435496adca763d5457f4e592b3 | [] | no_license | imakash560/Java_Study | 8f1106dd6b6f1d78183e6fc58513f295a4150a5a | fb8efddc00b9e030b02d2de265a04d017fb19595 | refs/heads/master | 2021-01-04T11:37:57.514933 | 2020-03-13T06:53:05 | 2020-03-13T06:53:05 | 240,529,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package recursion;
public class Recursion {
public static void main(String[] args) {
int row=4,col=0;
pattern(row,col);
}
public static void pattern(int row,int col)
{
if(row == 0){
return;
}
if(row == col){
System.out.println();
pattern(row-1,0);
return;
}
else {
System.out.print("* ");
pattern(row, col + 1);
}
}
}
| [
"imakash560@gmail.com"
] | imakash560@gmail.com |
08e1484a329dbf31887d063536b57cc73c9fc985 | 8ce1617e1445ba3e2ed9cdb0a7318a8f40ed5e22 | /src/main/java/com/zyx/jopo/RSAKeyMap.java | eabfcb666fab8dc60da1363e61da3008f2eeeaf6 | [] | no_license | ZyxServices/zyx-admin-2.0 | f901b3577423e3be257d016c3c37c7aee8064002 | de8e3d492c52836893445caae95c8408a8bdd33e | refs/heads/master | 2021-01-20T10:55:39.914840 | 2016-11-07T03:07:09 | 2016-11-07T03:07:09 | 73,037,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.zyx.jopo;
import java.util.concurrent.ConcurrentHashMap;
/**
* Created by wms on 2016/8/9.
*
* @author WeiMinSheng
* @version V1.0
* Copyright (c)2016 tyj-版权所有
* @title RSAKeyConstant.java
*/
public final class RSAKeyMap {
public static final ConcurrentHashMap RSA_MAP = new ConcurrentHashMap();
}
| [
"xiaoweiqb@126.com"
] | xiaoweiqb@126.com |
4fdfdbfa96de6bb8ae0aac0b6bbb76673c2d7203 | a6d64e7f81c1869abd6684b1adc9935ec62aebfb | /HW2_AnhPham/src/Student/TestStudents.java | ca59332e8d5cad396d2c08b3f417dce61359ded0 | [] | no_license | anhpham1509/ObjectOrientedProgramming | 6dcad6f197e8d8c7e92909c141e7c3bf5f328fd5 | da0458577798387beaf91709c85d2a854066c172 | refs/heads/master | 2021-01-10T13:50:15.807810 | 2015-12-01T14:47:11 | 2015-12-01T14:47:11 | 46,518,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | package Student;
import java.util.ArrayList;
import java.util.List;
/**
* Created by DuyAnhPham on 05/09/15.
*/
public class TestStudents {
public static void main (String[] arg){
//Create 3 students and print their properties
Student student1 = new Student();
Student student2 = new Student(12345,"Anh","Pham");
Student student3 = new Student(27485,"New","Student");
System.out.println(student1);
System.out.println(student2);
System.out.println(student3);
//Test Student Group
long groupCode = 123456;
Student contactStudent = new Student(987654,"HyHy","Phan");
List<Student> studentList = new ArrayList<>();
StudentGroup newGroup = new StudentGroup(groupCode, contactStudent, studentList);
newGroup.getInfo();
newGroup.addStudent(student2);
newGroup.addStudent(student3);
newGroup.getInfo();
}
}
| [
"duyanhpham1509@gmail.com"
] | duyanhpham1509@gmail.com |
655122e718bfc857f4210fe0c1da806f136d6a73 | d0f0e57f61a0bd7de1806a52b43d0f3cd0239d28 | /src/test/java/com/revenat/serviceLayer/dataAPI_JdbcImpl/daoJdbcImpl/UserJdbcDaoTest.java | 465d355296f42f720079ec8b6f3537013bc4c171 | [] | no_license | VitaliyDragun1990/data-access-layer-variations | 4c95c3d40a9745d07e2b10f8fc884c64b9c66f59 | 6ea3e8d62b343f67ad7ee8f4286b3f321d62c89b | refs/heads/master | 2020-03-28T18:44:40.483166 | 2018-09-15T14:01:52 | 2018-09-15T14:01:52 | 148,906,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,283 | java | package com.revenat.serviceLayer.dataAPI_JdbcImpl.daoJdbcImpl;
import com.revenat.serviceLayer.dataAPI_JdbcImpl.executors.Executor;
import com.revenat.serviceLayer.entities.User;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.*;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
public class UserJdbcDaoTest {
private static final long ID = 1L;
private final static String FIRST_NAME = "Jack";
private final static String LAST_NAME = "Smith";
private final static LocalDate BIRTH_DATE = LocalDate.of(1988, 7, 25);
private static final String SELECT_BY_FIRST_NAME = "SELECT * FROM user WHERE first_name = '" + FIRST_NAME + "'";
private static final String SELECT_BY_ID = "SELECT * FROM user WHERE user_id = " + ID;
private static final String SELECT_ALL = "SELECT * FROM user";
private static final String INSERT_QUERY =
"INSERT INTO user (first_name, last_name, birth_date) "
+ "VALUES ('"
+ FIRST_NAME
+ "', '"
+ LAST_NAME
+ "', '"
+ BIRTH_DATE.toString()
+ "')";
private static final String ID_QUERY = "SELECT @@IDENTITY AS IDENTITY";
private static final String UPDATE_QUERY = "UPDATE user " +
"SET " +
"first_name = '" + FIRST_NAME + "', " +
"last_name = '" + LAST_NAME + "', " +
"birth_date = '" + BIRTH_DATE.toString() + "' " +
"WHERE user_id = " + ID;
private static final String DELETE_QUERY = "DELETE FROM user WHERE user_id = " + ID;
@Mock
private Executor mockExecutor;
@Mock
private ResultSet mockResultSet;
private User user;
private UserJdbcDao userDao;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
userDao = new UserJdbcDao(mockExecutor);
user = new User();
user.setFirstName(FIRST_NAME);
user.setLastName(LAST_NAME);
user.setBirthDate(BIRTH_DATE);
}
@Test
public void findByFirstNameCallsExecutorWithCorrectQuery() {
userDao.findByFirstName(FIRST_NAME);
ArgumentCaptor<String> ac = ArgumentCaptor.forClass(String.class);
verify(mockExecutor, times(1)).executeQuery(ac.capture(), any());
String query = ac.getValue();
assertThat(query, equalTo(SELECT_BY_FIRST_NAME));
}
@Test
public void findByIdCallsExecutorWithCorrectQuery() {
when(mockExecutor.executeQuery(any(String.class), any())).thenReturn(Collections.emptyList());
userDao.findById(ID);
verify(mockExecutor, times(1)).executeQuery(eq(SELECT_BY_ID), any());
}
@Test
public void findAllCallsExecutorWithCorrectQuery() {
userDao.findAll();
verify(mockExecutor, times(1)).executeQuery(eq(SELECT_ALL), any());
}
@Test
public void saveCallsExecutorWithCorrectQueries() {
userDao.save(user);
verify(mockExecutor, times(1)).executeQuery(eq(INSERT_QUERY));
verify(mockExecutor, times(1)).executeQuery(eq(ID_QUERY), any());
}
@Test
public void saveProvidesIdToUserEntity() {
assertNull(user.getId());
when(mockExecutor.executeQuery(eq(ID_QUERY), any())).thenReturn(ID);
userDao.save(user);
assertThat(user.getId(), equalTo(ID));
}
@Test(expected = RuntimeException.class)
public void saveThrowsExceptionIfProvidedEntityWithId() {
user.setId(ID);
userDao.save(user);
}
@Test
public void updateCallsExecutorWithCorrectQuery() {
user.setId(ID);
userDao.update(user);
verify(mockExecutor, times(1)).executeQuery(UPDATE_QUERY);
}
@Test(expected = RuntimeException.class)
public void updateThrowsExceptionIfProvidedEntityWithoutId() {
userDao.update(user);
}
@Test
public void deleteCallsExecutorWithCorrectQuery() {
user.setId(ID);
userDao.delete(user);
verify(mockExecutor, times(1)).executeQuery(DELETE_QUERY);
}
@Test(expected = RuntimeException.class)
public void deleteThrowsExceptionIfProvidedEntityWithoutId() {
userDao.delete(user);
}
@Test
public void populatesUserEntitiesFromResultSet() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(false);
when(mockResultSet.getLong(eq("user_id"))).thenReturn(ID);
when(mockResultSet.getString("first_name")).thenReturn(FIRST_NAME);
when(mockResultSet.getString("last_name")).thenReturn(LAST_NAME);
when(mockResultSet.getDate("birth_date")).thenReturn(Date.valueOf(BIRTH_DATE));
List<User> users = userDao.createUserEntitiesFrom(mockResultSet);
assertThat(users.size(), equalTo(1));
assertEquals(users.get(0), user);
}
} | [
"vdrag00n90@gmail.com"
] | vdrag00n90@gmail.com |
ca5c1a3560b5dc8d28efb8fb4e67acb0d323d251 | 106ccba71a69964c8ccc85225d68adf77d3639d5 | /homework/lesson2/task1/src/TanosSort.java | 52e169c8a2eccd26bb191eec16a65652ac0c70dd | [] | no_license | ShadeCat/JavaLessons | 2af8415857f35e477188c07d0644b02767043217 | 113b680868ddb29bd6a8dc6ef5fa31120c4cbe57 | refs/heads/main | 2023-03-08T11:05:50.651380 | 2021-02-15T13:44:40 | 2021-02-15T13:44:40 | 338,780,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,017 | java | /*Реализовать сортировку - http://algolab.valemak.com/thanos .
Нужно реализовать метод, на вход которого подается массив из целых неотрицательных чисел, на выход - отсортированный массив.*/
import java.util.Arrays;
public class TanosSort {
public static void main(String[] args){
int[] example = {3, 20, 5, 7, 10, -12, 9, 1, 12};
System.out.println(Arrays.toString(example));
int[] sortedArray = toSort(example);
System.out.println(Arrays.toString(sortedArray));
}
private static int[] toSort(int[] arrayPart){
if (arrayPart.length > 1){
arrayPart = meanSort(arrayPart);
int meanPosition = arrayPart.length / 2;
int[] firstPart = Arrays.copyOfRange(arrayPart, 0, meanPosition);
int[] secondPart = Arrays.copyOfRange(arrayPart, meanPosition, arrayPart.length);
firstPart = toSort(firstPart);
secondPart = toSort(secondPart);
System.arraycopy(firstPart, 0, arrayPart, 0, meanPosition);
System.arraycopy(secondPart, 0, arrayPart, meanPosition, secondPart.length);
}
return arrayPart;
}
private static double getMean(int[] arrayToSort){
double arraySum = 0;
for (int j : arrayToSort) {
arraySum += j;
}
return (arraySum / arrayToSort.length);
}
private static int[] meanSort(int[] arrayToSort){
int[] sortedArray = new int[arrayToSort.length];
int frontCount = 0;
int backCount = 1;
double mean = getMean(arrayToSort);
for (int j : arrayToSort) {
if (j <= mean) {
sortedArray[frontCount] = j;
frontCount++;
} else {
sortedArray[arrayToSort.length - backCount] = j;
backCount++;
}
}
return sortedArray;
}
}
| [
"leonzhdan@gmail.com"
] | leonzhdan@gmail.com |
f5c23fc4e992dd36359db4663d655f0a20dab367 | ac6e436ff62811e1c13c6008b8e3ccd6c375c0b3 | /test/integ/InstructionSequenceOutlinerTestSecondary.java | 4bc668d105f7ee584b564f1364a5fa437653544a | [
"MIT"
] | permissive | Fklearn/redex | e93fbe76dac23da1d5c218fb20b504024649f48a | 4d7257d50342904a07a8515de23ac72676146155 | refs/heads/master | 2021-11-10T17:22:30.793539 | 2021-11-10T02:31:27 | 2021-11-10T02:36:44 | 162,951,167 | 0 | 0 | MIT | 2018-12-24T04:52:14 | 2018-12-24T04:52:13 | null | UTF-8 | Java | false | false | 969 | java | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.redextest;
class InstructionSequenceOutlinerTestSecondary {
public void secondary1() {
InstructionSequenceOutlinerTest.println("a", "b", "c");
InstructionSequenceOutlinerTest.println("d", "e", "f");
InstructionSequenceOutlinerTest.println("g", "h", "i");
InstructionSequenceOutlinerTest.println("j", "k", "l");
InstructionSequenceOutlinerTest.println("m", "n", "o");
}
public void secondary2() {
InstructionSequenceOutlinerTest.println("a", "b", "c");
InstructionSequenceOutlinerTest.println("d", "e", "f");
InstructionSequenceOutlinerTest.println("g", "h", "i");
InstructionSequenceOutlinerTest.println("j", "k", "l");
InstructionSequenceOutlinerTest.println("m", "n", "o");
}
}
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
8a1b8ccd7802f77d14344af5039f283b4d6dd22e | 1c0c39a6bfd357d275604adf304ddfaec170e81e | /gmf.adfg.diagram/src/adfg/diagram/edit/parts/AperiodicActorNameEditPart.java | 5d99fc35f190a7b69e59f6655fb8ff132b5a3c2d | [] | no_license | abouakaz/ADFG | 3a1bca51615d87091b375ce2122721ea4acf6414 | 6a2dbfd1b9fdbaaa224806c116c414439c460b58 | refs/heads/master | 2020-07-04T05:48:00.382573 | 2014-04-23T10:31:14 | 2014-04-23T10:31:14 | 19,062,976 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,829 | java | package adfg.diagram.edit.parts;
import java.util.Collections;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
import org.eclipse.gmf.runtime.diagram.ui.label.ILabelDelegate;
import org.eclipse.gmf.runtime.diagram.ui.label.WrappingLabelDelegate;
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.tooling.runtime.directedit.TextDirectEditManager2;
import org.eclipse.gmf.tooling.runtime.draw2d.labels.SimpleLabelDelegate;
import org.eclipse.gmf.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
import org.eclipse.gmf.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.ICellEditorValidator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import adfg.diagram.edit.policies.AdfgTextSelectionEditPolicy;
import adfg.diagram.part.AdfgVisualIDRegistry;
import adfg.diagram.providers.AdfgElementTypes;
import adfg.diagram.providers.AdfgParserProvider;
/**
* @generated
*/
public class AperiodicActorNameEditPart extends CompartmentEditPart implements
ITextAwareEditPart {
/**
* @generated
*/
public static final int VISUAL_ID = 5014;
/**
* @generated
*/
private DirectEditManager manager;
/**
* @generated
*/
private IParser parser;
/**
* @generated
*/
private List<?> parserElements;
/**
* @generated
*/
private String defaultText;
/**
* @generated
*/
private ILabelDelegate labelDelegate;
/**
* @generated
*/
public AperiodicActorNameEditPart(View view) {
super(view);
}
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE,
new AdfgTextSelectionEditPolicy());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE,
new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE,
new DefaultNodeLabelDragPolicy());
}
/**
* @generated
*/
protected String getLabelTextHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getText();
} else if (figure instanceof Label) {
return ((Label) figure).getText();
} else {
return getLabelDelegate().getText();
}
}
/**
* @generated
*/
protected void setLabelTextHelper(IFigure figure, String text) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setText(text);
} else if (figure instanceof Label) {
((Label) figure).setText(text);
} else {
getLabelDelegate().setText(text);
}
}
/**
* @generated
*/
protected Image getLabelIconHelper(IFigure figure) {
if (figure instanceof WrappingLabel) {
return ((WrappingLabel) figure).getIcon();
} else if (figure instanceof Label) {
return ((Label) figure).getIcon();
} else {
return getLabelDelegate().getIcon(0);
}
}
/**
* @generated
*/
protected void setLabelIconHelper(IFigure figure, Image icon) {
if (figure instanceof WrappingLabel) {
((WrappingLabel) figure).setIcon(icon);
return;
} else if (figure instanceof Label) {
((Label) figure).setIcon(icon);
return;
} else {
getLabelDelegate().setIcon(icon, 0);
}
}
/**
* @generated
*/
public void setLabel(WrappingLabel figure) {
unregisterVisuals();
setFigure(figure);
defaultText = getLabelTextHelper(figure);
registerVisuals();
refreshVisuals();
}
/**
* @generated
*/
@SuppressWarnings("rawtypes")
protected List getModelChildren() {
return Collections.EMPTY_LIST;
}
/**
* @generated
*/
public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
return null;
}
/**
* @generated
*/
protected EObject getParserElement() {
return resolveSemanticElement();
}
/**
* @generated
*/
protected Image getLabelIcon() {
EObject parserElement = getParserElement();
if (parserElement == null) {
return null;
}
return AdfgElementTypes.getImage(parserElement.eClass());
}
/**
* @generated
*/
protected String getLabelText() {
String text = null;
EObject parserElement = getParserElement();
if (parserElement != null && getParser() != null) {
text = getParser().getPrintString(
new EObjectAdapter(parserElement),
getParserOptions().intValue());
}
if (text == null || text.length() == 0) {
text = defaultText;
}
return text;
}
/**
* @generated
*/
public void setLabelText(String text) {
setLabelTextHelper(getFigure(), text);
refreshSelectionFeedback();
}
/**
* @generated
*/
public String getEditText() {
if (getParserElement() == null || getParser() == null) {
return ""; //$NON-NLS-1$
}
return getParser().getEditString(
new EObjectAdapter(getParserElement()),
getParserOptions().intValue());
}
/**
* @generated
*/
protected boolean isEditable() {
return getParser() != null;
}
/**
* @generated
*/
public ICellEditorValidator getEditTextValidator() {
return new ICellEditorValidator() {
public String isValid(final Object value) {
if (value instanceof String) {
final EObject element = getParserElement();
final IParser parser = getParser();
try {
IParserEditStatus valid = (IParserEditStatus) getEditingDomain()
.runExclusive(
new RunnableWithResult.Impl<IParserEditStatus>() {
public void run() {
setResult(parser
.isValidEditString(
new EObjectAdapter(
element),
(String) value));
}
});
return valid.getCode() == ParserEditStatus.EDITABLE ? null
: valid.getMessage();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
// shouldn't get here
return null;
}
};
}
/**
* @generated
*/
public IContentAssistProcessor getCompletionProcessor() {
if (getParserElement() == null || getParser() == null) {
return null;
}
return getParser().getCompletionProcessor(
new EObjectAdapter(getParserElement()));
}
/**
* @generated
*/
public ParserOptions getParserOptions() {
return ParserOptions.NONE;
}
/**
* @generated
*/
public IParser getParser() {
if (parser == null) {
parser = AdfgParserProvider
.getParser(
AdfgElementTypes.AperiodicActor_3014,
getParserElement(),
AdfgVisualIDRegistry
.getType(adfg.diagram.edit.parts.AperiodicActorNameEditPart.VISUAL_ID));
}
return parser;
}
/**
* @generated
*/
protected DirectEditManager getManager() {
if (manager == null) {
setManager(new TextDirectEditManager2(this, null,
AdfgEditPartFactory.getTextCellEditorLocator(this)));
}
return manager;
}
/**
* @generated
*/
protected void setManager(DirectEditManager manager) {
this.manager = manager;
}
/**
* @generated
*/
protected void performDirectEdit() {
getManager().show();
}
/**
* @generated
*/
protected void performDirectEdit(Point eventLocation) {
if (getManager().getClass() == TextDirectEditManager2.class) {
((TextDirectEditManager2) getManager()).show(eventLocation
.getSWTPoint());
}
}
/**
* @generated
*/
private void performDirectEdit(char initialCharacter) {
if (getManager() instanceof TextDirectEditManager) {
((TextDirectEditManager) getManager()).show(initialCharacter);
} else //
if (getManager() instanceof TextDirectEditManager2) {
((TextDirectEditManager2) getManager()).show(initialCharacter);
} else //
{
performDirectEdit();
}
}
/**
* @generated
*/
protected void performDirectEditRequest(Request request) {
final Request theRequest = request;
try {
getEditingDomain().runExclusive(new Runnable() {
public void run() {
if (isActive() && isEditable()) {
if (theRequest
.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
Character initialChar = (Character) theRequest
.getExtendedData()
.get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
performDirectEdit(initialChar.charValue());
} else if ((theRequest instanceof DirectEditRequest)
&& (getEditText().equals(getLabelText()))) {
DirectEditRequest editRequest = (DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
performDirectEdit();
}
}
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* @generated
*/
protected void refreshVisuals() {
super.refreshVisuals();
refreshLabel();
refreshFont();
refreshFontColor();
refreshUnderline();
refreshStrikeThrough();
}
/**
* @generated
*/
protected void refreshLabel() {
setLabelTextHelper(getFigure(), getLabelText());
setLabelIconHelper(getFigure(), getLabelIcon());
refreshSelectionFeedback();
}
/**
* @generated
*/
protected void refreshUnderline() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
}
}
/**
* @generated
*/
protected void refreshStrikeThrough() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null && getFigure() instanceof WrappingLabel) {
((WrappingLabel) getFigure()).setTextStrikeThrough(style
.isStrikeThrough());
}
}
/**
* @generated
*/
protected void refreshFont() {
FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(
NotationPackage.eINSTANCE.getFontStyle());
if (style != null) {
FontData fontData = new FontData(style.getFontName(),
style.getFontHeight(), (style.isBold() ? SWT.BOLD
: SWT.NORMAL)
| (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
setFont(fontData);
}
}
/**
* @generated
*/
private void refreshSelectionFeedback() {
requestEditPolicyFeedbackRefresh(EditPolicy.PRIMARY_DRAG_ROLE);
requestEditPolicyFeedbackRefresh(EditPolicy.SELECTION_FEEDBACK_ROLE);
}
/**
* @generated
*/
private void requestEditPolicyFeedbackRefresh(String editPolicyKey) {
Object editPolicy = getEditPolicy(editPolicyKey);
if (editPolicy instanceof IRefreshableFeedbackEditPolicy) {
((IRefreshableFeedbackEditPolicy) editPolicy).refreshFeedback();
}
}
/**
* @generated
*/
protected void setFontColor(Color color) {
getFigure().setForegroundColor(color);
}
/**
* @generated
*/
protected void addSemanticListeners() {
if (getParser() instanceof ISemanticParser) {
EObject element = resolveSemanticElement();
parserElements = ((ISemanticParser) getParser())
.getSemanticElementsBeingParsed(element);
for (int i = 0; i < parserElements.size(); i++) {
addListenerFilter(
"SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
}
} else {
super.addSemanticListeners();
}
}
/**
* @generated
*/
protected void removeSemanticListeners() {
if (parserElements != null) {
for (int i = 0; i < parserElements.size(); i++) {
removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
}
} else {
super.removeSemanticListeners();
}
}
/**
* @generated
*/
protected AccessibleEditPart getAccessibleEditPart() {
if (accessibleEP == null) {
accessibleEP = new AccessibleGraphicalEditPart() {
public void getName(AccessibleEvent e) {
e.result = getLabelTextHelper(getFigure());
}
};
}
return accessibleEP;
}
/**
* @generated
*/
private View getFontStyleOwnerView() {
return getPrimaryView();
}
/**
* @generated
*/
private ILabelDelegate getLabelDelegate() {
if (labelDelegate == null) {
IFigure label = getFigure();
if (label instanceof WrappingLabel) {
labelDelegate = new WrappingLabelDelegate((WrappingLabel) label);
} else {
labelDelegate = new SimpleLabelDelegate((Label) label);
}
}
return labelDelegate;
}
/**
* @generated
*/
@Override
public Object getAdapter(Class key) {
if (ILabelDelegate.class.equals(key)) {
return getLabelDelegate();
}
return super.getAdapter(key);
}
/**
* @generated
*/
protected void addNotationalListeners() {
super.addNotationalListeners();
addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
}
/**
* @generated
*/
protected void removeNotationalListeners() {
super.removeNotationalListeners();
removeListenerFilter("PrimaryView"); //$NON-NLS-1$
}
/**
* @generated
*/
protected void handleNotificationEvent(Notification event) {
Object feature = event.getFeature();
if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
Integer c = (Integer) event.getNewValue();
setFontColor(DiagramColorRegistry.getInstance().getColor(c));
} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(
feature)) {
refreshUnderline();
} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough()
.equals(feature)) {
refreshStrikeThrough();
} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_FontName().equals(
feature)
|| NotationPackage.eINSTANCE.getFontStyle_Bold()
.equals(feature)
|| NotationPackage.eINSTANCE.getFontStyle_Italic().equals(
feature)) {
refreshFont();
} else {
if (getParser() != null
&& getParser().isAffectingEvent(event,
getParserOptions().intValue())) {
refreshLabel();
}
if (getParser() instanceof ISemanticParser) {
ISemanticParser modelParser = (ISemanticParser) getParser();
if (modelParser.areSemanticElementsAffected(null, event)) {
removeSemanticListeners();
if (resolveSemanticElement() != null) {
addSemanticListeners();
}
refreshLabel();
}
}
}
super.handleNotificationEvent(event);
}
/**
* @generated
*/
protected IFigure createFigure() {
// Parent should assign one using setLabel() method
return null;
}
}
| [
"abouakaz@users.noreplay.github.com"
] | abouakaz@users.noreplay.github.com |
4307899feadc47238caba44154e212639c9098ae | cafe84851547ed08039e793a1bb2d26b780ce400 | /C4Week1/EarthquakeFilterStarterProgram/DepthFilter.java | 0d3b1f9fd3035ed8ee281013b96098c74b2c6fe0 | [] | no_license | Xnkr/java-adventure | e62c7f22b08ac759ff6fe88ae845f8b6aa43627d | 85f0cd5fa15e0701f1935f07168b539d02cd0d5b | refs/heads/master | 2020-03-30T07:36:02.614744 | 2019-08-31T14:43:34 | 2019-08-31T14:43:34 | 150,951,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package EarthquakeFilterStarterProgram;
/**
* Write a description of DepthFilter here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class DepthFilter implements Filter{
private double minDepth, maxDepth;
private String name;
public String getName(){
return name;
}
public DepthFilter(String n,double min, double max){
minDepth = min;
maxDepth = max;
name = n;
}
public boolean satisfies(QuakeEntry qe){
return qe.getDepth() <= maxDepth && qe.getDepth() >= minDepth;
}
} | [
"26054028+Xnkr@users.noreply.github.com"
] | 26054028+Xnkr@users.noreply.github.com |
c3fd5ed4e459630e47418e6ef48ab713bf3c9aec | e2f52c4aa526fa1965034ec6d92f79c754db16e7 | /app/src/main/java/sjq5766/aut/chessapp/ChessCore/Interface/ChessGame.java | 95bfa655c0c52f1801cdbc9c90f39d46dca3cbe8 | [] | no_license | garawaa/chess-android | 643f50ab60fc820e400aa839581dd8d84a8c3c01 | d0b0ef11480d4293fe555189816aa8db09dc9b3c | refs/heads/master | 2021-04-12T09:08:54.859556 | 2016-01-28T11:53:39 | 2016-01-28T11:53:39 | 126,202,289 | 1 | 0 | null | 2018-03-21T15:42:39 | 2018-03-21T15:42:38 | null | UTF-8 | Java | false | false | 9,293 | java | package sjq5766.aut.chessapp.ChessCore.Interface;
import android.util.Log;
import java.util.ArrayList;
import sjq5766.aut.chessapp.ChessCore.Objects.Bishop;
import sjq5766.aut.chessapp.ChessCore.Objects.ChessColor;
import sjq5766.aut.chessapp.ChessCore.Objects.GameState;
import sjq5766.aut.chessapp.ChessCore.Objects.King;
import sjq5766.aut.chessapp.ChessCore.Objects.Knight;
import sjq5766.aut.chessapp.ChessCore.Objects.Pawn;
import sjq5766.aut.chessapp.ChessCore.Objects.Piece;
import sjq5766.aut.chessapp.ChessCore.Objects.PieceType;
import sjq5766.aut.chessapp.ChessCore.Objects.Player;
import sjq5766.aut.chessapp.ChessCore.Objects.Queen;
import sjq5766.aut.chessapp.ChessCore.Objects.Rook;
import sjq5766.aut.chessapp.R;
public class ChessGame {
// Fields
private Cell[][] board;
private Player white, black;
private ChessColor turn;
private GameState currentGameState;
private boolean reversed = false;
private ArrayList<String> whiteMoves, blackMoves;
// Constructor
public ChessGame() {
board = new Cell[8][8];
initBoard(board);
turn = ChessColor.white;
currentGameState = GameState.normal;
whiteMoves = new ArrayList<>();
blackMoves = new ArrayList<>();
}
// Getters & Setters
public boolean isReversed() {return reversed; }
public void setReversed() {
this.reversed = !reversed;
}
public Cell[][] getBoard() {
return board;
}
public void setBoard(Cell[][] board) {
this.board = board;
}
public ChessColor getTurn() {
return turn;
}
public void setTurn(ChessColor turn) {
this.turn = turn;
}
public GameState getCurrentGameState(){
return this.currentGameState;
}
// Methods
public GameState checkForCheck(Cell board[][], ChessColor whoseCheck) {
Piece own[];
Piece opponent[];
if (whoseCheck == ChessColor.white) {
own = white.getPieces();
opponent = black.getPieces();
} else {
own = black.getPieces();
opponent = white.getPieces();
}
for (int i = 0; i < 15; i++) {
ArrayList<Cell> moves = opponent[i].getAvailableMoves();
if (moves != null && (!moves.isEmpty() && moves.contains(own[15].getLocation())))
{
if (whoseCheck == ChessColor.white)
return GameState.whiteCheck;
else
return GameState.blackCheck;
}
}
return GameState.normal;
}
public GameState checkForMate() {
ArrayList<Cell> whiteMoves = new ArrayList<>();
ArrayList<Cell> blackMoves = new ArrayList<>();
for (int i = 0; i < 15; i++) {
ArrayList<Cell> moves = white.getPieces()[i].getAvailableMoves();
for(int j = 0; j < moves.size(); j++)
whiteMoves.add(moves.get(j));
moves = black.getPieces()[i].getAvailableMoves();
for(int j = 0; j < moves.size(); j++)
blackMoves.add(moves.get(j));
}
if(blackMoves.size() == 0)
{
if(checkForCheck(board, ChessColor.black) == GameState.blackCheck)
return GameState.blackMate;
else
return GameState.stalemate;
}
if(whiteMoves.size() == 0)
{
if(checkForCheck(board, ChessColor.white) == GameState.whiteCheck)
return GameState.whiteMate;
else
return GameState.stalemate;
}
if (checkForCheck(board, ChessColor.white) == GameState.whiteCheck)
return GameState.whiteCheck;
if (checkForCheck(board, ChessColor.black) == GameState.blackCheck)
return GameState.blackCheck;
return GameState.normal;
}
public void turnMade(){
if(currentGameState == GameState.normal)
currentGameState = GameState.moved;
else if(currentGameState == GameState.moved)
currentGameState = GameState.normal;
}
public boolean move(int fromX, int fromY, int toX, int toY) {
Player currentPlayer = turn == ChessColor.white ? white : black;
Piece piece = board[fromX][fromY].getPiece();
boolean success = currentPlayer.move(piece, board[toX][toY]);
if (success) {
turn = turn == ChessColor.white ? ChessColor.black : ChessColor.white;
}
return success;
}
// 0 1 2 3 4 5 6 7
// ---------------------------------
// 0 | R | N | B | Q | K | B | N | R |
// ---------------------------------
// 1 | p | p | p | p | p | p | p | p |
// ---------------------------------
// 2 | | | | | | | | |
// ---------------------------------
// 3 | | | | | | | | |
// ---------------------------------
// 4 | | | | | | | | |
// ---------------------------------
// 5 | | | | | | | | |
// ---------------------------------
// 6 | p | p | p | p | p | p | p | p |
// ---------------------------------
// 7 | R | N | B | Q | K | B | N | R |
// ---------------------------------
public void initBoard(Cell[][] board) {
Piece whitePieces[] = new Piece[16];
Piece blackPieces[] = new Piece[16];
for(int x = 0; x < 8; x++) {
for(int y = 0; y < 8; y++) {
board[x][y] = new Cell(x,y);
}
}
for (int i = 0; i < 8; i++) {
Piece whitePawn = new Piece(ChessColor.white, PieceType.pawn,
board[i][6], new Pawn(this), R.drawable.wp, this);
whitePieces[i] = whitePawn;
board[i][6].setPiece(whitePawn);
Piece blackPawn = new Piece(ChessColor.black, PieceType.pawn,
board[i][1], new Pawn(this), R.drawable.bp, this);
blackPieces[i] = blackPawn;
board[i][1].setPiece(blackPawn);
}
// rooks
whitePieces[8] = new Piece(ChessColor.white, PieceType.rook,
board[0][7], new Rook(this), R.drawable.wr, this);
board[0][7].setPiece(whitePieces[8]);
whitePieces[9] = new Piece(ChessColor.white, PieceType.rook,
board[7][7], new Rook(this), R.drawable.wr, this);
board[7][7].setPiece(whitePieces[9]);
blackPieces[8] = new Piece(ChessColor.black, PieceType.rook,
board[0][0], new Rook(this), R.drawable.br, this);
board[0][0].setPiece(blackPieces[8]);
blackPieces[9] = new Piece(ChessColor.black, PieceType.rook,
board[7][0], new Rook(this), R.drawable.br, this);
board[7][0].setPiece(blackPieces[9]);
// knights
whitePieces[10] = new Piece(ChessColor.white, PieceType.knight,
board[1][7], new Knight(this), R.drawable.wn, this);
board[1][7].setPiece(whitePieces[10]);
whitePieces[11] = new Piece(ChessColor.white, PieceType.knight,
board[6][7], new Knight(this), R.drawable.wn, this);
board[6][7].setPiece(whitePieces[11]);
blackPieces[10] = new Piece(ChessColor.black, PieceType.knight,
board[1][0], new Knight(this), R.drawable.bn, this);
board[1][0].setPiece(blackPieces[10]);
blackPieces[11] = new Piece(ChessColor.black, PieceType.knight,
board[6][0], new Knight(this), R.drawable.bn, this);
board[6][0].setPiece(blackPieces[11]);
// bishops
whitePieces[12] = new Piece(ChessColor.white, PieceType.bishop,
board[2][7], new Bishop(this), R.drawable.wb, this);
board[2][7].setPiece(whitePieces[12]);
whitePieces[13] = new Piece(ChessColor.white, PieceType.bishop,
board[5][7], new Bishop(this), R.drawable.wb, this);
board[5][7].setPiece(whitePieces[13]);
blackPieces[12] = new Piece(ChessColor.black, PieceType.bishop,
board[2][0], new Bishop(this), R.drawable.bb, this);
board[2][0].setPiece(blackPieces[12]);
blackPieces[13] = new Piece(ChessColor.black, PieceType.bishop,
board[5][0], new Bishop(this), R.drawable.bb, this);
board[5][0].setPiece(blackPieces[13]);
// queens
whitePieces[14] = new Piece(ChessColor.white, PieceType.queen,
board[3][7], new Queen(this), R.drawable.wq, this);
board[3][7].setPiece(whitePieces[14]);
blackPieces[14] = new Piece(ChessColor.black, PieceType.queen,
board[3][0], new Queen(this), R.drawable.bq, this);
board[3][0].setPiece(blackPieces[14]);
// kings
whitePieces[15] = new Piece(ChessColor.white, PieceType.king,
board[4][7], new King(this), R.drawable.wk, this);
board[4][7].setPiece(whitePieces[15]);
blackPieces[15] = new Piece(ChessColor.black, PieceType.king,
board[4][0], new King(this), R.drawable.bk, this);
board[4][0].setPiece(blackPieces[15]);
white = new Player(ChessColor.white, whitePieces);
black = new Player(ChessColor.black, blackPieces);
}
}
| [
"ragonedk@gmail.com"
] | ragonedk@gmail.com |
46284c3748795113ce616642076bd10b09922330 | 910082b446f5e36850c6e269b9a9d9e557971996 | /src/java/br/com/sali/bean/licao/VisualizarLicaoBean.java | 3d3ed39cdd447959d298eba129dee1110aac9d72 | [] | no_license | JoseMarcio/SALI | 48ec75bc5ee9e3129c45105dd9edfb52eaebeb00 | 6607e3e6d395c6769361a53334c96a9e40838c86 | refs/heads/master | 2021-01-18T13:59:26.868548 | 2015-11-16T09:26:31 | 2015-11-16T09:26:31 | 41,258,269 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,289 | java | package br.com.sali.bean.licao;
import br.com.sali.modelo.Licao;
import br.com.sali.regras.LicaoRN;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletResponse;
import org.primefaces.context.RequestContext;
/**
*
* @author SALI
*/
@ManagedBean
@RequestScoped
public class VisualizarLicaoBean implements Serializable {
private Long idLicao;
private LicaoRN licaoRN;
public VisualizarLicaoBean() {
this.licaoRN = new LicaoRN();
}
//==========================================================================
/**
* Direciona para a página que carrega o arquivo pdf pertencente a lição
* selecionada.
*
* @return
*/
public String urlVisualizarArquivoLicao(Long idLicao) {
return "http://localhost:8080/SALI/professor/visualizar-licao.jsf?id=" + idLicao;
}
/**
* Exibe no browser o arquivo pdf da lição selecionada.
*/
public void exibirLicao() {
try {
Licao licaoSelecionada = licaoRN.pegarLicaoPorId(this.idLicao);
File arquivoDaLicao = new File(licaoSelecionada.getArquivo());
byte[] bytesDoArquivo = getBytes(arquivoDaLicao);
HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "inline;filename=arquivo.pdf");
response.getOutputStream().write(bytesDoArquivo);
response.getCharacterEncoding();
FacesContext.getCurrentInstance().responseComplete();
} catch (Exception ex) {
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_FATAL, "Erro.", ex.getMessage());
RequestContext.getCurrentInstance().showMessageInDialog(m);
ex.printStackTrace();
}
}
/**
* Retorna os byte de um arquivo.
*
* @param arquivo
* @return
* @throws IOException
*/
public byte[] getBytes(File arquivo) throws IOException {
int tamanho = (int) arquivo.length();
byte[] bytes = new byte[tamanho];
FileInputStream stream = new FileInputStream(arquivo);
stream.read(bytes, 0, tamanho);
return bytes;
}
/**
* Direciona para a página de visualização de lições. E também, atribui o
* caminho do arquivo ao caminho atual.
*
* @return
*/
public String visualizarLicao() {
return "/professor/visualizar-licao.jsf";
}
//==========================================================================
public Long getIdLicao() {
return idLicao;
}
public void setIdLicao(Long idLicao) {
this.idLicao = idLicao;
}
public LicaoRN getLicaoRN() {
return licaoRN;
}
public void setLicaoRN(LicaoRN licaoRN) {
this.licaoRN = licaoRN;
}
}
| [
"José@JM-PC"
] | José@JM-PC |
6cd77e09310f9e4a5aa07de7d1af2ba3cf12ec66 | 2586c3de18bc747fd996ccc2be0ed8d95a14fe2d | /app/src/test/java/com/txcsmad/madfall2017/ExampleUnitTest.java | 8f8b4f245bca3211d67c2f88f9ae2d7a7757b9f3 | [] | no_license | txcsmad/f17-android-beginner | 9a569714d469fa33ec70aeb1e16770fbc36b9186 | 2d640bb88e3dacef3a1797201ccfd2ca68ab6b6d | refs/heads/master | 2021-08-21T20:38:27.667022 | 2017-09-29T19:49:12 | 2017-09-29T19:49:12 | 103,069,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.txcsmad.madfall2017;
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);
}
} | [
"jacoblubecki@gmail.com"
] | jacoblubecki@gmail.com |
8aa0032fc4b2bddecb484e6bd64286dc93184f78 | a3bbeb443f4ed66c94f9019df060bf7ae2c44c7f | /test/java/src/org/omg/CORBA/IDLType.java | 402d88fc07edb8fd4184a9e1b91d11a6533cf9c2 | [] | no_license | FLC-project/ebison | d2bbab99a1b17800cb64e513d6bb2811e5ddb070 | 69da710bdd63a5d83af9f67a3d1fb9ba44524173 | refs/heads/master | 2021-08-29T05:36:39.118743 | 2021-08-22T09:45:51 | 2021-08-22T09:45:51 | 34,455,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | /*
* @(#)IDLType.java 1.18 00/02/02
*
* Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
*
*/
/*
* File: ./org/omg/CORBA/IDLType.java
* From: ./ir.idl
* Date: Fri Aug 28 16:03:31 1998
* By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
*/
package org.omg.CORBA;
/**
* tempout/org/omg/CORBA/IDLType.java
* Generated by the IBM IDL-to-Java compiler, version 1.0
* from ../../Lib/ir.idl
* Thursday, February 25, 1999 2:11:23 o'clock PM PST
*/
/**
* An abstract interface inherited by all Interface Repository
* (IR) objects that represent OMG IDL types. It provides access
* to the <code>TypeCode</code> object describing the type and is used in defining the
* other interfaces wherever definitions of <code>IDLType</code> must be referenced.
*/
public interface IDLType extends IDLTypeOperations, org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity
{
} // interface IDLType
| [
"luca.breveglieri@polimi.it"
] | luca.breveglieri@polimi.it |
2e85b37a3abaedff5f1890b4ce096093d8408f27 | c1b40aadea8d41acdae97f2cdc89690ffe9c5ccf | /Car.java | ba72fb00727c3ce188347c1f43845e56214af8a9 | [] | no_license | MladenPetrov88/Vehicles-Extension | 6fa084267f51eb843dd5566dad940bbccc116516 | 6cc2d8fbfc365c21289b06e481ed45e1ffd8ca55 | refs/heads/master | 2021-04-13T11:09:57.383942 | 2020-03-22T10:20:56 | 2020-03-22T10:20:56 | 249,158,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package VehicleExtenstion;
public class Car extends Vehicles {
private static final double CLIMATIC_CONSUMPTION = 0.9;
protected Car(double fuelQuantity, double consumption, double tankCapacity) {
super(fuelQuantity, consumption, tankCapacity);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7f41f946832e4ff11db3bff1155f4f41d8d60c9e | fd1b3baefee95d65c50782d10450db00716da8de | /core/src/main/java/com/future/yingyue/repository/AdminRepository.java | 21bee126616823488e1d1f99d01f4cde835be2dc | [] | no_license | cuishiying/yingyue-master | b29ade04d92d8013b31f1f07515c43ce6579221f | 8df0364e5388fdf48597df854abafa326583d88b | refs/heads/master | 2021-08-29T17:19:40.763594 | 2017-12-14T12:29:14 | 2017-12-14T12:29:14 | 108,139,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,078 | java | package com.future.yingyue.repository;
import com.future.yingyue.entity.Admin;
import com.future.yingyue.entity.AdminRole;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface AdminRepository extends JpaRepository<Admin, Integer>,JpaSpecificationExecutor<Admin> {
Admin findByAccountNumber(String accountNumber);
Admin findByAdminName(String adminName);
Admin findById(Integer id);
Admin findByPhone(String phone);
Admin findByEmail(String email);
@Query("select c from Admin c where c.adminRole = ?1")
Page<Admin> findAllEmployee(AdminRole role, Pageable pageable);
@Query("select c from Admin c where c.adminName = ?1")
Admin findByName(String name);
@Query("select c from Admin c where c.adminRole = ?1")
List<Admin> findEmployee(AdminRole role);
}
| [
"cuishiying163@163.com"
] | cuishiying163@163.com |
73fb19a8f3897abb8a96b1315af919ed3eae9e68 | b6edbaf8e32591aaa5172a0fb14cb9f8411bac17 | /CharString.java | 32d6f83ae60918913fee55c1d6010fb09d826d70 | [] | no_license | rajeshraman63/JavaCodes | 5388dfb0482aead0799b268ea53789a56d5618ed | 03e1db5ceada76797a698d839ad50200ff226206 | refs/heads/master | 2021-08-31T23:41:53.648899 | 2017-12-24T04:23:06 | 2017-12-24T04:23:06 | 106,901,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | class CharString{
public static void main(String ... args){
char[] charArray = new char[]{'a','r','r','a','y'};
String str = new String(charArray);
System.out.println(str);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f0e50b649085e8ccca659fdb34f7718dec0f5892 | 6fd29f30a4662b596c4c353cf739f3bc47416da2 | /app/src/androidTest/java/com/jueggs/popularmovies/UtilsAndroidTest.java | 455bc8fa9e234de17fc717adc45c6ca603ddc925 | [] | no_license | Lemao81/PopularMovies | ba078410807c442b1ec158ee48218ad3ac6466b7 | 23d7eea2c31f8bcb1e93a1c166473cf608378340 | refs/heads/master | 2021-01-17T18:00:37.423283 | 2016-07-29T17:54:13 | 2016-07-29T17:54:13 | 57,985,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,683 | java | package com.jueggs.popularmovies;
import android.content.ContentValues;
import com.jueggs.popularmovies.data.favourites.FavouriteColumns;
import com.jueggs.popularmovies.model.Movie;
import com.jueggs.popularmovies.util.Utils;
import org.junit.Test;
import java.util.Date;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public class UtilsAndroidTest
{
@Test
public void createGenreString()
{
//Arrange
String expected1 = "Action, Adventure, Animation, Comedy";
String expected2 = "Action, Unknown, Animation, Comedy";
String expected3 = "Action, Comedy";
//Act
String actual1 = Utils.createGenreString(new int[]{28, 12, 16, 35});
String actual2 = Utils.createGenreString(new int[]{28, 999, 16, 35});
String actual3 = Utils.createGenreString(new int[]{28, 35, 0, 0});
//Assert
assertThat(actual1, is(equalTo(expected1)));
assertThat(actual2, is(equalTo(expected2)));
assertThat(actual3, is(equalTo(expected3)));
}
@Test
public void transformMovieToContentValues()
{
//Arrange
String posterPath = "the poster path";
boolean adult = true;
String overview = "the overview";
String releaseDate = "2014-10-23";
int[] genreIds = new int[]{3, 8, 23, 0};
int movieId = 20302;
String origTitle = "the origtitle";
String origLang = "the origlanguage";
String title = "the title";
String backdropPath = "backdroppath";
float popularity = 45.2f;
int voteCount=7;
boolean video=true;
float voteAverage = 5.8f;
byte[] poster = new byte[]{-2, 5, 2, 5, -53, 34, 53};
Movie expected = Movie.builder().posterPath(posterPath).adult(adult).overview(overview).releaseDate(releaseDate).genreIds(genreIds)
.id(movieId).originalTitle(origTitle).originalLanguage(origLang).title(title).backdropPath(backdropPath).popularity(popularity)
.voteCount(voteCount).video(video).voteAverage(voteAverage).poster(poster).build();
//Act
ContentValues values = Utils.transformMovieToContentValues(expected);
Movie actual = Movie.builder().build();
actual.setPosterPath(values.getAsString(FavouriteColumns.POSTER_PATH));
actual.setAdult(values.getAsBoolean(FavouriteColumns.ADULT));
actual.setOverview(values.getAsString(FavouriteColumns.OVERVIEW));
actual.setReleaseDate(values.getAsString(FavouriteColumns.REL_DATE));
actual.setGenreIds(Utils.decodeGenreIds(values.getAsLong(FavouriteColumns.GENRE_IDS)));
actual.setId(values.getAsInteger(FavouriteColumns.MOVIE_ID));
actual.setOriginalTitle(values.getAsString(FavouriteColumns.ORIG_TITLE));
actual.setOriginalLanguage(values.getAsString(FavouriteColumns.ORIG_LANG));
actual.setTitle(values.getAsString(FavouriteColumns.TITLE));
actual.setBackdropPath(values.getAsString(FavouriteColumns.BACKDROP_PATH));
actual.setPopularity(values.getAsFloat(FavouriteColumns.POPULARITY));
actual.setVoteCount(values.getAsInteger(FavouriteColumns.VOTE_COUNT));
actual.setVideo(values.getAsBoolean(FavouriteColumns.VIDEO));
actual.setVoteAverage(values.getAsFloat(FavouriteColumns.VOTE_AVERAGE));
actual.setPoster(values.getAsByteArray(FavouriteColumns.POSTER));
//Assert
assertTrue(values.containsKey(FavouriteColumns.POSTER_PATH));
assertTrue(values.containsKey(FavouriteColumns.ADULT));
assertTrue(values.containsKey(FavouriteColumns.OVERVIEW));
assertTrue(values.containsKey(FavouriteColumns.REL_DATE));
assertTrue(values.containsKey(FavouriteColumns.GENRE_IDS));
assertTrue(values.containsKey(FavouriteColumns.MOVIE_ID));
assertTrue(values.containsKey(FavouriteColumns.ORIG_TITLE));
assertTrue(values.containsKey(FavouriteColumns.ORIG_LANG));
assertTrue(values.containsKey(FavouriteColumns.TITLE));
assertTrue(values.containsKey(FavouriteColumns.BACKDROP_PATH));
assertTrue(values.containsKey(FavouriteColumns.POPULARITY));
assertTrue(values.containsKey(FavouriteColumns.VOTE_COUNT));
assertTrue(values.containsKey(FavouriteColumns.VIDEO));
assertTrue(values.containsKey(FavouriteColumns.VOTE_AVERAGE));
assertTrue(values.containsKey(FavouriteColumns.POSTER));
assertThat(values.size(), is(equalTo(15)));
assertThat(actual, is(equalTo(expected)));
}
}
| [
"jr.berlin@web.de"
] | jr.berlin@web.de |
c040c4820ddd53b97996e344b39e9086f90c454f | 60b0efc45541c5a50821e33ff407df1c20b0e589 | /source/android/TriangleThings/app/src/main/java/com/bedidi/fawzi/trianglethings/MainActivity.java | 8b4f8dc541f05d5c44ee2bc3ffd93a1f5d1b6478 | [] | no_license | Faz95210/Foodies-BJTU | fa27c7cb7a2e1181dca0711e786413e0072a6252 | bcff4235513c37745553803b62d2cf8680c3bb75 | refs/heads/master | 2021-01-10T17:15:15.500782 | 2016-10-13T10:54:00 | 2016-10-13T10:54:00 | 53,821,900 | 1 | 2 | null | 2016-05-05T07:53:16 | 2016-03-14T02:48:38 | JavaScript | UTF-8 | Java | false | false | 344 | java | package com.bedidi.fawzi.trianglethings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"fawzi.bedidi@epitech.eu"
] | fawzi.bedidi@epitech.eu |
30a57a5fe3e4c28e44aac7e0be6f2009b163156c | 0a8edda10672e26aa7f3da6f02cff73a2fcb0d98 | /android/app/src/main/java/com/ferpa_22254/MainApplication.java | d2f3d2bd625d470b06bcc4c147f27927afb1a405 | [] | no_license | crowdbotics-apps/ferpa-22254 | 54de3adca4816f59a5ce1b98cc99202416fb336f | b77ac0392302f1bc94e73dbc4cc68d65ede36401 | refs/heads/master | 2023-01-03T07:55:12.034687 | 2020-11-03T14:47:00 | 2020-11-03T14:47:00 | 309,697,677 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,688 | java | package com.ferpa_22254;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rndiffapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
e0633c4a2f09204c4b1f7816a283331709f0d3be | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/org/apache/http/impl/cookie/BasicCommentHandler.java | 67a08d3509fffdd5eb6d64bdfe31f6de8b5355ba | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | package org.apache.http.impl.cookie;
import org.apache.http.cookie.MalformedCookieException;
import org.apache.http.cookie.SetCookie;
@Deprecated
public class BasicCommentHandler extends AbstractCookieAttributeHandler {
public void parse(SetCookie cookie, String value) throws MalformedCookieException {
if (cookie != null) {
cookie.setComment(value);
return;
}
throw new IllegalArgumentException("Cookie may not be null");
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
6a8a1143a972876ed35efb37db7ef0ea67211897 | 6268cad28a6947c4ecc9142524038bf950a896ba | /src/javatest/com/cloudera/flume/agent/TestAvroMultiMasterRPC.java | d0f9c0f674fe19c059e0a183284a76187972e608 | [
"Apache-2.0"
] | permissive | simplegeo/flume | 38d73ecc92d9e0e3da92a4293f209a91380f54d7 | 95127c07debf0d747dab27378db127010646dd3c | refs/heads/master | 2021-01-17T22:48:37.141726 | 2011-08-26T17:51:08 | 2011-08-26T17:51:08 | 873,422 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,964 | java | /**
* Licensed to Cloudera, Inc. under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Cloudera, Inc. 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 com.cloudera.flume.agent;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.apache.avro.ipc.AvroRemoteException;
import org.apache.avro.ipc.HttpServer;
import org.apache.avro.ipc.Server;
import org.apache.avro.specific.SpecificResponder;
import org.apache.thrift.transport.TTransportException;
import org.junit.Test;
import org.mortbay.log.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cloudera.flume.conf.FlumeConfigData;
import com.cloudera.flume.conf.FlumeConfiguration;
import com.cloudera.flume.conf.avro.AvroFlumeConfigData;
import com.cloudera.flume.reporter.server.avro.AvroFlumeReport;
import com.cloudera.flume.conf.avro.AvroFlumeClientServer;
import com.cloudera.flume.conf.avro.FlumeNodeState;
import com.cloudera.flume.master.MasterClientServerAvro;
public class TestAvroMultiMasterRPC {
static final Logger LOG = LoggerFactory.getLogger(TestAvroMultiMasterRPC.class);
/**
* Mock AvroServer.
*/
public class MockAvroServer implements AvroFlumeClientServer {
boolean first = true;
protected Server server;
public void stop() {
this.server.close();
}
public MockAvroServer() {
}
public void serve(int port) throws IOException {
LOG
.info(String
.format(
"Starting blocking thread pool server for control server on port %d...",
port));
SpecificResponder res = new SpecificResponder(
AvroFlumeClientServer.class, this);
this.server = new HttpServer(res, port);
this.server.start();
}
@Override
public java.lang.Void acknowledge(CharSequence ackid)
throws AvroRemoteException {
return null;
}
@Override
public boolean checkAck(CharSequence ackid) throws AvroRemoteException {
Log.info("Check-ack called at server on " + this.server.getPort());
if (first) {
first = false;
return true;
}
Log.info("throwing an exception on " + this.server.getPort());
throw new RuntimeException("Throwing an exception");
}
@Override
public AvroFlumeConfigData getConfig(CharSequence sourceId)
throws AvroRemoteException {
return MasterClientServerAvro.configToAvro(new FlumeConfigData());
}
@Override
public List<CharSequence> getLogicalNodes(CharSequence physNode)
throws AvroRemoteException {
return null;
}
@Override
public boolean heartbeat(CharSequence logicalNode,
CharSequence physicalNode, CharSequence clienthost, FlumeNodeState s,
long timestamp) throws AvroRemoteException {
return true;
}
@Override
public Void putReports(Map<CharSequence, AvroFlumeReport> reports)
throws AvroRemoteException {
return null;
}
@Override
public Map<CharSequence, Integer> getChokeMap(CharSequence physNode)
throws AvroRemoteException {
return null;
}
}
/**
* Tries to connect to several servers in turn and compensate as masters fail.
*/
@Test
public void testConnect() throws TTransportException, IOException,
InterruptedException {
FlumeConfiguration conf = FlumeConfiguration.get();
conf.set(FlumeConfiguration.MASTER_HEARTBEAT_SERVERS,
"localhost:9999,localhost:56789,localhost:56790");
conf.set(FlumeConfiguration.MASTER_HEARBEAT_RPC, "AVRO");
MultiMasterRPC masterRPC = new MultiMasterRPC(conf, false);
MockAvroServer server1 = new MockAvroServer();
server1.serve(56789);
MockAvroServer server2 = new MockAvroServer();
server2.serve(56790);
assertEquals(true, masterRPC.checkAck("UNKNOWNACK")); // Server should roll
// over to 56789
assertEquals("Port should have been 56789, got " + masterRPC.getCurPort(),
56789, masterRPC.getCurPort());
masterRPC.checkAck("UNKNOWNACK"); // should cause exception, fail
// over to 56790
assertEquals("Port should have been 56790, got " + masterRPC.getCurPort(),
56790, masterRPC.getCurPort());
masterRPC.close();
server2.stop();
}
}
| [
"jon@cloudera.com"
] | jon@cloudera.com |
92292f9e8d968ea81dc6ef8f66c0c71b8c35ecac | 6b79407affd5ddb3fcb9613a78008a8e0111335b | /Spring_min2/src/main/java/com/min/model/Page_VO.java | 45083a26a0dcfabcda11fb99a3977e06cb2b6e53 | [] | no_license | wishwing96/min2 | b855253386311107c644768ffeb700a343f5d6b0 | e4522224ed8f453f8265b1c6dc2952fe05b587bf | refs/heads/master | 2022-12-22T23:34:13.089241 | 2020-02-25T03:05:50 | 2020-02-25T03:05:50 | 238,154,500 | 0 | 0 | null | 2022-12-16T00:43:02 | 2020-02-04T08:09:02 | HTML | UTF-8 | Java | false | false | 1,527 | java | package com.min.model;
public class Page_VO {
//페이징의 시작번호
private int startPage;
//페이징의 끝번호
private int endPage;
//페이징의 이전
private boolean prev;
//페이징의 다음
private boolean next;
private int total;//전체가 몇건인지를 알아야 '페이징의 이전', '페이징의 다음'을 만들지 판단
private Recode rec;
public Page_VO(Recode rec , int total) {// 매개변수 2개인 생성자
this.rec=rec;
this.total=total;
// 페이징의 끝번호를 알 수 있게 계산
this.endPage=(int)(Math.ceil(rec.getpagenum()/10.0))*10;
this.startPage=this.endPage-9;
int realEnd=(int)(Math.ceil((total*1.0)/rec.getamount()));
if(realEnd < this.endPage) {
this.endPage=realEnd;
}
this.prev=this.startPage>1;
this.next=this.endPage < realEnd;
}
public int getStartPage() {
return startPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
public boolean isPrev() {
return prev;
}
public void setPrev(boolean prev) {
this.prev = prev;
}
public boolean isNext() {
return next;
}
public void setNext(boolean next) {
this.next = next;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public Recode getRec() {
return rec;
}
public void setRec(Recode rec) {
this.rec = rec;
}
}
| [
"wishwing96@naver.com"
] | wishwing96@naver.com |
dba11e11ab8a82a4730380b44647b1ec1477f623 | 434d1ca1295fbee39b48de570918db9a3d928321 | /app/src/main/java/xyz/elfanrodhian/myfamilylocator/models/TimelineItem.java | 3d34d9b4416a674389dd7d88548387361dfd3163 | [] | no_license | vickazy/MyFamilyLocator | 5b7d383be481785af43776e968cb936a8816c7d2 | cac81be61c051aa08f17033930abe0acfa9657f9 | refs/heads/master | 2021-01-01T09:56:13.645614 | 2019-01-02T07:07:06 | 2019-01-02T07:07:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | package xyz.elfanrodhian.myfamilylocator.models;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
public class TimelineItem {
private FamilyMember familyMember;
String date;
Long timestamp;
public TimelineItem() {
}
public TimelineItem(FamilyMember familyMember) {
this.familyMember = familyMember;
Calendar c = Calendar.getInstance();
// Apr 21, 2017 at 1:17pm
SimpleDateFormat df = new SimpleDateFormat("MMM dd,yyyy 'at' h:ma", Locale.getDefault());
date = df.format(c.getTime());
// negative to allow firebase to order i descending order
timestamp = -1 * System.currentTimeMillis();
}
public FamilyMember getFamilyMember() {
return familyMember;
}
public void setFamilyMember(FamilyMember familyMember) {
this.familyMember = familyMember;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
}
| [
"elfanapoywali@gmail.com"
] | elfanapoywali@gmail.com |
923e26fc070254d38bef1061603cb1cf23d794ea | 853a3207c23d0d0ce85ee78255a8b60613b53331 | /FragmentDialog/app/src/main/java/android/huyhuynh/fragmentdialog/MainActivity.java | 27410c146f9d1d193ba26c9d69ff608e20848088 | [] | no_license | huyhuynh1905/Android-Tutorial | 068409027f90ebe101494f4366cbe470d2e9446a | 838d15fc27085561f5cb80190a6dbb702575d8b6 | refs/heads/master | 2022-12-12T21:28:14.682411 | 2019-09-16T15:31:50 | 2019-09-16T15:31:50 | 195,052,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package android.huyhuynh.fragmentdialog;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity implements InterDelete {
Button mButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mButton = findViewById(R.id.button);
mButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FragmentDialog fragmentDialog = new FragmentDialog();
//để show dialog fragmrnt thì
fragmentDialog.show(getSupportFragmentManager(),"AAAA");
}
});
}
@Override
public void giaTriXoa(boolean value) {
if (value==true){
Toast.makeText(MainActivity.this,"Có",Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity.this,"Không",Toast.LENGTH_SHORT).show();
}
}
}
| [
"34849208+huyhuynh1905@users.noreply.github.com"
] | 34849208+huyhuynh1905@users.noreply.github.com |
86d116b18520b18e5e46b578eb9cf458a98b2ec1 | 3fc8b338a2b10c422ee6152ce2bd0d50b1929763 | /empManageSystem11/src/view/pro/AddProjectView.java | 643e82056920dd2737dfe287bffb373f5a2e93a2 | [] | no_license | MichaelShuang/Project_1 | 25f27f79010c696b48361790290e6b5736420900 | 53fd3c05a3d69c6fbd0b9c39008f7ac3c095912a | refs/heads/master | 2020-06-03T09:42:31.925712 | 2019-06-13T01:48:40 | 2019-06-13T01:48:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 620 | java | package view.pro;
import dao.ProjectDao;
import entity.Project;
import util.CallBack;
public class AddProjectView extends SuperProjectView {
CallBack cb;
ProjectDao proDao = new ProjectDao();
private static AddProjectView instance;
private AddProjectView(CallBack cb) {
super(cb);
}
public static AddProjectView getInstance(CallBack cb) {
if (instance == null) {
instance = new AddProjectView(cb);
}
return instance;
}
public void setData() {
nameText.setText("");
}
public boolean action(Project pro) {
boolean flag = proDao.add(pro);
return flag;
}
}
| [
"Michael@DESKTOP-BD2FKG7"
] | Michael@DESKTOP-BD2FKG7 |
8b7193979a1fcec0011c3aa23e886b7d6cc3db10 | c286904bea60fe122302d995d2d558c4d8403b57 | /Assignment4/src/Assignment4.java | 4691b82632ac9d633d2b61310e7f1de58624a8a5 | [] | no_license | Svilen-Stefanov/Computer-Networking-and-Distributed-Systems | 67957893492b317ea1c31b58b9cb1e0f3b6553da | 36c7e5efbf2730207f35d3439d24cf00da485144 | refs/heads/master | 2020-03-09T07:31:22.065739 | 2018-04-08T17:43:55 | 2018-04-08T17:43:55 | 128,666,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,626 | java | /**
* Assignment 4
* @author Svilen Stefanov
*/
/* DO NOT!!! put a package statement here, that would break the build system */
/* Since this file is mildly incompatible with IDEs and java without an IDE
* can be rather annoying here are some useful imports
*/
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Scanner;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class Assignment4 {
private static ArrayList<String> routingTable = new ArrayList<>();
/* Since we don't have GRNVS_RAW this time, here is a simple hexdump */
private static void printArray(byte[] array) {
int i = 0;
for (byte b : array) {
System.err.format("%02x ", b);
if (++i == 8) {
System.err.format("\n");
i = 0;
}
}
System.err.format("\n");
}
/* Our version of parseIP */
private static byte[] parseIP(String ipAddr) {
try{
return InetAddress.getByName(ipAddr).getAddress();
}
catch (UnknownHostException e) {
return null;
}
}
/**
* Feel free to use the java lib for data structure and conversion.
* The provided imports and parseIP should be a hint what we think you
* should use.
* Higher level functions should NOT be used for decision making.
* For example:
* Don't use: java.net.InetAddress.isLinkLocalAddress()
* Do use: Arrays.equals()
*/
/**
* This is your entry point
* You should read from `table' until eof is reached (getLine returns
* null), then start serving the routing requests from `requests'.
*
* NOTICE: You will have to print each answer to a request before you
* read the next one. The tester blocks until it gets an answer and
* doesn't give the next request.
*
* OUTPUT: The output has to be in the form "$hop $interface\n".
* Since System.out.println() does buffering and thus breaks the
* assumption that your string will be printed before you block in
* readLine() use System.out.format().
* System.out.format("%s\n", str) is equivalent to System.out.println(str)
* For more information about the format have a look at:
* http://www.cplusplus.com/reference/cstdio/printf/
* This is a C(++) reference but javas `format' is compatible.
* Example output: System.out.format("%s\n", "::1 eth0");
*/
public static void run(FileReader table, FileReader requests, String local) {
String route = new String();
Scanner in = new Scanner(route);
String prefix = new String(), comparablePrefix = new String();
Entry entry = new Entry();
boolean isDouble = false;
while((route=table.getLine())!=null){
isDouble = false;
prefix = route.substring(route.indexOf("/") + 1, route.length());
in = new Scanner(prefix);
prefix = in.next();
int i;
for (i = 0; i < routingTable.size(); i++) {
comparablePrefix = routingTable.get(i);
comparablePrefix = comparablePrefix.substring(comparablePrefix.indexOf("/") + 1, comparablePrefix.length());
in = new Scanner(comparablePrefix);
comparablePrefix = in.next();
if(Integer.parseInt(prefix) - Integer.parseInt(comparablePrefix) > 0)
break;
else if (Integer.parseInt(prefix) - Integer.parseInt(comparablePrefix) == 0){
if(route.substring(0, route.indexOf("/")).compareTo(routingTable.get(i).substring(0, routingTable.get(i).indexOf("/"))) < 0){
break;
}
if(route.substring(0, route.indexOf("/")).equals(routingTable.get(i).substring(0, routingTable.get(i).indexOf("/")))){
isDouble = true;
break;
}
} else continue;
}
if(!isDouble)
routingTable.add(i, route);
}
while((route=requests.getLine())!=null){
byte[] ip = parseIP(route);
if(route.equals(local))
System.out.format("%s\n", "It's a me!");
else if(((ip[0] & (byte)0xFF) == (byte)0xFE) && ((ip[1] & 0xC0) == 0x80))
System.out.format("%s\n", "Link local address");
else {
route = entry.check(routingTable, route);
System.out.format("%s\n", route);
}
}
in.close();
return;
}
public static void main(String[] argv) {
Arguments args = new Arguments(argv);
try{
try {
FileReader table = new FileReader(args.table);
FileReader reqs = new FileReader(args.requests);
run(table, reqs, args.local);
} catch (java.io.FileNotFoundException e) {
System.err.println("Could not find one of the files :(");
}
}
catch(Exception e) {
e.printStackTrace();
System.err.println(e.getMessage());
System.exit(1);
}
}
}
| [
"svilen.ks@gmail.com"
] | svilen.ks@gmail.com |
aaf100f6ead5a9f8a456fb39c45259e50338002a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_2c79acb65456095a82fd6a5988f2dbdddae5c965/ConcurrentMessageSender/2_2c79acb65456095a82fd6a5988f2dbdddae5c965_ConcurrentMessageSender_s.java | 68ccc15959f90da296066222e8a509e11796be56 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,440 | java | package com.github.bcap.dht.client;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import com.github.bcap.dht.message.request.Request;
import com.github.bcap.dht.message.response.Response;
import com.github.bcap.dht.node.Contact;
public class ConcurrentMessageSender implements MessageSender {
private static final Logger logger = Logger.getLogger(ConcurrentMessageSender.class);
private ThreadPoolExecutor workerThreadPool;
private LinkedBlockingDeque<Runnable> workerQueue;
private ConcurrentMessageSender thisRef = this;
public ConcurrentMessageSender(int maxConcurrentMessages) {
this.workerQueue = new LinkedBlockingDeque<Runnable>();
this.workerThreadPool = new ThreadPoolExecutor(1, maxConcurrentMessages, 30, TimeUnit.SECONDS, workerQueue);
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
thisRef.shutdown();
}
});
}
public void shutdown() {
workerThreadPool.shutdown();
}
public void send(Request request, ResponseHandler handler) {
logger.debug("Adding request " + request + " to the queue");
this.workerThreadPool.execute(new Worker(request, handler));
logger.debug("Request " + request + " added to the queue");
}
class Worker implements Runnable {
private Request request;
private ResponseHandler handler;
protected Worker(Request request, ResponseHandler handler) {
this.request = request;
this.handler = handler;
}
public void run() {
Contact destination = request.getDestination();
logger.info("Sending message of type " + request.getClass().getSimpleName() + " to " + destination.getIp() + ":" + destination.getPort());
ObjectInputStream inStream = null;
ObjectOutputStream outStream = null;
Socket socket = new Socket();
try {
socket.connect(new InetSocketAddress(destination.getIp(), destination.getPort()));
try {
outStream = new ObjectOutputStream(socket.getOutputStream());
} catch (IOException e) {
logger.error("IOException occured while trying to open the socket outputStream");
throw e;
}
logger.debug("Writing object " + request + " to socket output stream");
outStream.writeObject(request);
try {
inStream = new ObjectInputStream(socket.getInputStream());
} catch (IOException e) {
logger.error("IOException occured while trying to open the socket inputStream");
throw e;
}
Object readObj = null;
try {
logger.debug("Reading object from the socket input stream");
readObj = inStream.readObject();
} catch (IOException e) {
logger.error("IOException occured while trying to read the object from the socket");
throw e;
} catch (ClassNotFoundException e) {
logger.error("ClassNotFoundException occured while trying to read object from the socket");
throw e;
}
if (readObj instanceof Response) {
Response response = (Response) readObj;
logger.debug("Received response: " + response);
handler.handleResponse(response);
} else {
logger.warn("Object read from the socket is of an unsupported type (not instance of " + Response.class + "): " + readObj.getClass());
}
} catch (Exception e) {
logger.error(null, e);
} finally {
closeResources(socket, inStream, outStream);
}
}
private void closeResources(Socket socket, InputStream inputStream, OutputStream outputStream) {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
logger.error("Error while trying to close the inputstream " + inputStream, e);
}
}
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
logger.error("Error while trying to close the outputStream " + outputStream, e);
}
}
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
logger.error("Error while trying to close the socket " + socket, e);
}
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
20af08f36b01661e167bbf158de2f2f6c29ec43b | 4eb5369b60df3f4bc0839afac9e7f8ac76eedefe | /src/main/java/com/liancheng/lcweb/form/ChangeLineInfoForm.java | d8081f4b60bc57c404c0cc4ff69f2321b127e86a | [] | no_license | PFZTJLLYTC/LC_Backend | 40ea57a095968f7bc3e211212c06a2709b180185 | f74005ac024c2d6ad36b7993a390ceefcd707104 | refs/heads/master | 2020-04-27T07:04:34.903355 | 2020-01-08T08:09:39 | 2020-01-08T08:09:39 | 174,126,188 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.liancheng.lcweb.form;
import lombok.Data;
@Data
public class ChangeLineInfoForm {
// 目前就改个价格而已
private String price;
}
| [
"33611404+LEODPEN@users.noreply.github.com"
] | 33611404+LEODPEN@users.noreply.github.com |
133956f4b3c77f826f7b4466fe629a0a78ff3cbd | 5210e642f76947bebce85e94d3e0ca9d8a00b22f | /logintest/src/main/java/com/wy/service/WechatService.java | 89d5cba900644fad48160cec3bb8ddbf77d1caa2 | [] | no_license | sixclears/expressWechatProject | ef9ed36bfecdb65e6c2b8010a0a3e1f12d891bae | 396c2bb11623fe8f52330b0e066c5d66a0da04a0 | refs/heads/master | 2022-11-13T08:45:51.886670 | 2020-07-07T00:48:58 | 2020-07-07T00:48:58 | 263,670,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package com.wy.service;
import com.wy.config.wechat.WechatConfig;
import com.wy.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
@Service
public class WechatService {
//内置的httpclient类
@Autowired
RestTemplate restTemplate;
@Autowired
WechatConfig wechatConfig;
/*
到微信服务器获取用户的信息
*/
@Autowired
StringUtils stringUtils;
public Map<String,Object> code2Session(String code){
/*
code2SessionUrl:根据code拼接微信开放api
*/
String result =restTemplate.getForObject(wechatConfig.code2SessionUrl(code),String.class);
/*
将得到的json结果转化成Map集合
*/
Map<String,Object> wechatResult =stringUtils.Json2Map(result);
return wechatResult;
}
}
| [
"wangyang998520@icloud.com"
] | wangyang998520@icloud.com |
c4eff9a3068d5e835465154f99a42a68e5d9cda6 | fd6b48f50f9bfc26f4ed9ddb0ecfd57cf914763f | /singleton/Singleton3.java | 5908ce3a97b468ed00b25ed454c500ae7bd1fcc0 | [
"MIT"
] | permissive | weidingl/learngit | fbacb4170851f2fb118c7437a522a85a3e3cfc1a | c53f08746ba3531dec49ce96e0cb9f43a4977cac | refs/heads/master | 2021-09-12T13:19:28.781655 | 2018-04-17T07:06:36 | 2018-04-17T07:06:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.issc.dy.singleton;
/**
* 在方法上加synchronized同步锁或是用同步代码块对类加同步锁,此种方式虽然解决了多
* 个实例对象问题,但是该方式运行效率却很低下,下一个线程想要获取对象,
* 就必须等待上一个线程释放锁之后,才可以继续运行。
*/
public class Singleton3 {
// 私有构造
private Singleton3() {}
private static Singleton3 single = null;
public static Singleton3 getInstance() {
// 等同于 synchronized public static Singleton3 getInstance()
synchronized(Singleton3.class){
// 注意:里面的判断是一定要加的,否则出现线程安全问题
if(single == null){
single = new Singleton3();
}
}
return single;
}
}
| [
"578486558@qq.com"
] | 578486558@qq.com |
0710f021efb3bb705742b0aa78ad16e46ceef7b9 | 585abc69ee412297beb0415636c013f5b5f0bea0 | /src/NewRegisterPanel.java | 49fbe20b9d62d8d4aac2ca6b29de67bd30777a51 | [] | no_license | bhavsartej97/Movie-Reviews-DBMS | b0e074e3551c448d1b1b06a39c438ebb92f789d0 | f7654772c86f84acd63de814bd1c1487b799e61f | refs/heads/master | 2020-05-18T04:42:07.454239 | 2019-04-30T03:11:45 | 2019-04-30T03:11:45 | 184,181,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,072 | java | import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.*;
public class NewRegisterPanel {
private JPanel registerPanel;
private JTextField firstNameText;
private JTextField lastNameText;
private JTextField userNameText;
private JPasswordField passwordText;
private JButton registerHereButton;
private JLabel firstNameLabel;
private JLabel lastNameLabel;
private JLabel userNameLabel;
private JLabel passwordLabel;
private JLabel ageLabel;
private JTextField ageText;
private MainFrame theObject;
public void takeTheObject(MainFrame theObject) {
this.theObject = theObject;
}
public JPanel provideYourPanel() {
return registerPanel;
}
public NewRegisterPanel() {
registerHereButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (firstNameText.getText().isEmpty() || lastNameText.getText().isEmpty() || passwordText.getText().isEmpty() ||
userNameText.getText().isEmpty() || ageText.getText().isEmpty() || !ageText.getText().matches("[0-9]+")) {
JOptionPane.showMessageDialog(registerPanel, "All Fields Are Mandatory! And Age Should be a Number!");
} else {
if (!checkIfUserNameExists()) {
JOptionPane.showMessageDialog(registerPanel, "The User Name Already Exists. Please Choose another!");
}
Connection registerUser = theObject.provideYourConnection();
String insertIntoUsers = "call register_user(?, ?, ?, ?, ?)";
try {
PreparedStatement insertStatement = registerUser.prepareStatement(insertIntoUsers);
insertStatement.setString(1, firstNameText.getText());
insertStatement.setString(2, lastNameText.getText());
insertStatement.setString(3, userNameText.getText());
insertStatement.setString(4, passwordText.getText());
insertStatement.setInt(5, Integer.valueOf(ageText.getText()));
insertStatement.execute();
JOptionPane.showMessageDialog(registerPanel, "Registration Successful.");
theObject.killRegisterFrame();
} catch (SQLException e1) {
JOptionPane.showMessageDialog(registerPanel, "Registration Not Successful. Please Try Again.");
}
}
}
});
}
private boolean checkIfUserNameExists() {
Connection connect = theObject.provideYourConnection();
try {
String checkQuery = "select user_name from ourproject.users where user_name = ?";
PreparedStatement checkStatement = connect.prepareStatement(checkQuery);
checkStatement.setString(1, userNameLabel.getText());
ResultSet resultSet = checkStatement.executeQuery();
if (!resultSet.next()) {
return true;
}
} catch (Exception e) {
System.out.println("The check was not successful");
}
return false;
}
}
| [
"bhavsartej97@gmail.com"
] | bhavsartej97@gmail.com |
bb4c8293c0300e3df8b0a918fbd86c585bf668e3 | 9b33a5bb3934411ba96bde95774897a9b086a408 | /src/观察者模式/WeatherData.java | 82e83a59a677dbd34ad60f99a950a6625ff5a39f | [] | no_license | ipancong/designpatterns | 76220f9724d5f0b4d9b1c7d04114699730cc506f | 3646921ec0a911a2618fb2c3b57a02b6fe1c9f66 | refs/heads/master | 2021-05-08T16:19:25.865141 | 2019-03-03T06:12:44 | 2019-03-03T06:12:44 | 120,153,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package 观察者模式;
import java.util.ArrayList;
import java.util.List;
public class WeatherData implements Subject {
private List<Observer> observers;
private String todayWeather;
private Double pa;
private Double temp;
private String tomorrowWeather;
public WeatherData(){
observers = new ArrayList<>();
}
@Override
public void registerObserver(Observer observer) {
// 注册新的观察者
observers.add(observer);
}
@Override
public void removeObserver(Observer observer) {
int index = observers.indexOf(observer);
if(index > -1)
observers.remove(observer);
}
@Override
public void notifyObservers() {
//数据改动时通知各个观察者
for( Observer o : observers)
o.update(todayWeather,pa,temp,tomorrowWeather);
}
public void dataChanged(){
notifyObservers();
}
public void setNewData(String todayWeather,Double pa, Double temp, String tomorrowWeather){
this.todayWeather = todayWeather;
this.pa = pa;
this.temp = temp;
this.todayWeather = tomorrowWeather;
dataChanged();
}
}
| [
"pancong@thinkpad.com"
] | pancong@thinkpad.com |
f47c097a42e97ccf6f5566b8a882bea7eaaea42f | fb57ec3daaeaeaad558b6c44348432d8d97e57a5 | /src/main/java/jakarta/nosql/demo/column/Car.java | ea63381a46a16275e40ac1e953d47153d0f2a6cb | [] | no_license | soujava/nosql-design-pitfalls | 5e3bce5682283b4e48216775a478806fe22d1b28 | 723f4243fc52f07d09987236a5e1f39b12250e9b | refs/heads/master | 2022-12-02T09:46:27.941423 | 2020-08-23T16:54:01 | 2020-08-23T16:54:01 | 289,728,489 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,341 | java | package jakarta.nosql.demo.column;
import jakarta.nosql.mapping.Column;
import jakarta.nosql.mapping.Entity;
import jakarta.nosql.mapping.Id;
import org.eclipse.jnosql.artemis.cassandra.column.UDT;
import java.util.Objects;
@Entity
public class Car {
@Id
private String plate;
@Column
private String city;
@Column
private String color;
@UDT("owner")
@Column
private Owner owner;
private Car(String plate, String city, String color, Owner owner) {
this.plate = plate;
this.city = city;
this.color = color;
this.owner = owner;
}
Car() {
}
public String getPlate() {
return plate;
}
public String getCity() {
return city;
}
public String getColor() {
return color;
}
public Owner getOwner() {
return owner;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) {
return false;
}
Car car = (Car) o;
return Objects.equals(plate, car.plate);
}
@Override
public int hashCode() {
return Objects.hashCode(plate);
}
@Override
public String toString() {
return "Car{" +
"plate='" + plate + '\'' +
", city='" + city + '\'' +
", color='" + color + '\'' +
", owner=" + owner +
'}';
}
public static CarBuilder builder() {
return new CarBuilder();
}
public static class CarBuilder {
private String plate;
private String city;
private String color;
private Owner owner;
private CarBuilder() {
}
public CarBuilder withPlate(String plate) {
this.plate = plate;
return this;
}
public CarBuilder withCity(String city) {
this.city = city;
return this;
}
public CarBuilder withColor(String color) {
this.color = color;
return this;
}
public CarBuilder withOwner(Owner owner) {
this.owner = owner;
return this;
}
public Car build() {
return new Car(plate, city, color, owner);
}
}
}
| [
"otaviopolianasantana@gmail.com"
] | otaviopolianasantana@gmail.com |
7a30c7cedf633f18d06ecc0f0bc79e8f5fb35be6 | 6fde8579912549a125abd0683a3d54ec225e089e | /src/main/java/ivy/util/ObjUtil.java | 6cc504e74f9e5cd5353c7eeba95bd798f9a8b611 | [] | no_license | holafy/arrietty-core | d1ac3163bb4ecd41886e6eefc53cc53b1157450a | 42403fe5617adfbfc47f7a25acc21ed1c1c03336 | refs/heads/master | 2021-01-10T18:24:50.140317 | 2013-08-15T06:20:10 | 2013-08-15T06:20:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package ivy.util;
import ivy.util.ReflectObjectUtil.GetterMethodTag;
import java.lang.reflect.Method;
import com.ly.util.LogU;
/**
* @author holaivy@gmail.com
*
*/
public class ObjUtil {
/**
* 返回Object对象Getter方法的名字和值,仅适用于Debug用途
*
* @param obj
* 对象为NULL,将返回 Object is NULL 信息
* @return
*/
public static String outputObjectValue(Object obj) {
if (obj == null)
return "Object is NULL!";
StringBuilder buf = new StringBuilder();
Class<? extends Object> cls = obj.getClass();
Method[] ms = cls.getDeclaredMethods();
for (Method m : ms) {
String mName = m.getName();
GetterMethodTag rValue = ReflectObjectUtil.isGetterMethod(mName);
if (rValue != GetterMethodTag.No) {
Object o = null;
try {
o = m.invoke(obj, new Object[] {});
String propertyName = mName
.substring(rValue == GetterMethodTag.Yes_Get ? 3
: 2);
buf.append("Method: ").append(propertyName);
buf.append("\n");
buf.append("Value: ")
.append(o == null ? "NULL" : o.toString())
.append("\n");
} catch (Exception e) {
LogU.e(e);
}
}
}
return buf.toString();
}
}
| [
"holaivy@gmail.com"
] | holaivy@gmail.com |
c160e9a6daa4a50c1f811a92cf74caed17f1824f | fc7409b70b2ad5727250824fbf073d299bf35763 | /src/test/java/cn/hz/test/my/StringJoinTest.java | e0e56ffb8b682007716a0b174b1b2d0f9cee9dd3 | [] | no_license | wxfbiubiu/think-in-java | 61759e12c8a0fbecf15ea41390f9d97b1056f9b8 | 5a9b0c115561cc39ce935943519b3995f203d7e3 | refs/heads/master | 2021-08-15T06:46:11.358749 | 2017-11-17T14:48:47 | 2017-11-17T14:48:47 | 33,220,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package cn.hz.test.my;
public class StringJoinTest {
public static final String str = "aa";
public static int num = 1;
private int p;
public StringJoinTest(){
p = 2;
}
static {
n2 = 3;
}
public static int n2;
public String concatString(String a, String b, String c) {
return a + b + c;
}
}
| [
"wangxf1988@gmail.com"
] | wangxf1988@gmail.com |
d860804bc5a98a646126ce71534c0f960209621b | bc7f65bdeb31abbbaef4e3423b56691aaa5649fc | /src/cl222ae_assign1/intCollection/package-info.java | 910edbd31f13db56d6849dfb6425c28f5fd2106a | [] | no_license | clundstrom/Java_2---AlgorithmsDatastructures | cce435f469a9a730290ead9190a7d75828eefec5 | 37b317c65c8615eadf50f481ebe933f5cc187747 | refs/heads/master | 2020-05-20T07:20:39.158849 | 2019-05-07T17:43:46 | 2019-05-07T17:43:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 84 | java | /**
*
*/
/**
* @author Christoffer
*
*/
package cl222ae_assign1.intCollection; | [
"lulleh_@hotmail.com"
] | lulleh_@hotmail.com |
421320b7fa217f8040145f03ec8345da50cd26f5 | 05f4560027847b46c5677041033951341d001e5e | /src/java/com/mbeans/CredentialMBean.java | d0fc6980becc6ce0f9ac4227ca339f16c25605f8 | [] | no_license | lawale4me/JobService | bb51ce7ce2b704a227438d7faf90fb9432b818d7 | a292f839f0002318ae6fe55b24ed43d02b144905 | refs/heads/master | 2020-05-25T15:40:44.952132 | 2016-09-27T13:52:35 | 2016-09-27T13:52:35 | 69,362,053 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,576 | 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 com.mbeans;
import com.core.ProcessingException;
import com.dao.CredentialRepo;
import com.dao.CustomerRepo;
import com.dao.DisciplineRepo;
import com.dao.SMSRepo;
import com.dao.StateRepo;
import com.entities.Credential;
import com.entities.Customer;
import com.entities.Discipline;
import com.entities.States;
import com.util.Email;
import com.util.SendEmail;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.component.html.HtmlSelectBooleanCheckbox;
import javax.faces.context.FacesContext;
import javax.faces.event.AjaxBehaviorEvent;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.commons.io.FileUtils;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.UploadedFile;
/**
*
* @author Ahmed
*/
@ManagedBean
@RequestScoped
public class CredentialMBean {
/**
* Creates a new instance of ProductMBean
*/
public CredentialMBean() {
}
boolean checked;
private String username,myfile;
Credential credential;
private List<Customer> customerList ;
private Discipline discpiline;
private List<Discipline> discpilineList;
private States states;
private List<States> statesList;
private Date dob;
String userName,phone,passwd,fname,lname,email,cpasswd,address,discipline,state,qualification,cvurl;
int status;
private Customer customer;
private UploadedFile file;
private StreamedContent afile;
@Inject
CredentialRepo credentialrepo;
@Inject
CustomerRepo customerrepo;
@Inject
SMSRepo smsrepo;
@Inject
StateRepo staterepo;
@Inject
DisciplineRepo discrepo;
@PostConstruct
public void init() {
FacesContext context = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
HttpSession httpSession = request.getSession(false);
username=(String) httpSession.getAttribute("username");
discpilineList = discrepo.findAll();
statesList = staterepo.findAll();
customer=customerrepo.findByUsername(username);
if(customer!=null){
credential=credentialrepo.getCredential(customer.getCustomerId());
}
if(credential!=null){
fname=credential.getFirstname();
lname=credential.getSurname();
email=credential.getEmail();
phone=credential.getPhone();
qualification=credential.getQualification();
discpiline=credential.getDiscipline();
states=credential.getState();
myfile=credential.getCvurl();
FileDownloadView();
}
}
public String addCredentials() throws ProcessingException {
if(credential==null)
{
//UPLOADING CODE
if(file!=null){
String directory = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("uploadDirectory");
String filedetails=directory+file.getFileName();
try {
FileUtils.writeByteArrayToFile(new File(directory+file.getFileName()), file.getContents());
cvurl=filedetails;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//ENDS HERE
Credential cred=new Credential();
cred.setCustomer(customer.getCustomerId());
cred.setDiscipline(discpiline);
cred.setDob(dob);
cred.setFirstname(fname);
cred.setPhone(phone);
cred.setState(states);
cred.setDiscipline(discpiline);
cred.setSurname(lname);
cred.setCvurl(cvurl);
cred.setQualification(qualification);
cred.setEmail(customer.getEmail());
customer.setExtra(cred.getDiscipline().getName());
credentialrepo.create(cred);
smsrepo.updatePhone(customer.getPhone(),phone);
customer.setPhone(phone);
customer.setCvurl(cvurl);
customerrepo.edit(customer);
//SENDING EMAIL
SendEmail sendObject=new SendEmail();
Email mail=new Email();
mail.setEmailAddress(customer.getEmail());
mail.setMessage("Dear "+fname+ " "+lname +", your credential has been successfully updated. Kindly login to your account and click Pay/Renew Subscription to subscribe for your 30-day daily alerts. Thank you");
mail.setSubject("Vaultjobs Credentials updated");
sendObject.sendSimpleMail(mail);
//END OF EMAIL
FacesMessage msg = new FacesMessage("Credential Updated. Click Pay/Renew Subscription to subscribe for your daily alerts");
FacesContext.getCurrentInstance().addMessage(null, msg);
return null;
}
else{
//UPLOADING CODE
if(file!=null){
String directory = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("uploadDirectory");
String filedetails=directory+file.getFileName();
try {
FileUtils.writeByteArrayToFile(new File(directory+file.getFileName()), file.getContents());
cvurl=filedetails;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//ENDS HERE
credential.setDiscipline(discpiline);
credential.setDob(dob);
credential.setFirstname(fname);
credential.setPhone(phone);
credential.setState(states);
credential.setDiscipline(discpiline);
credential.setSurname(lname);
if(cvurl!=null){credential.setCvurl(cvurl);};
credential.setQualification(qualification);
credential.setEmail(customer.getEmail());
credentialrepo.edit(credential);
smsrepo.updatePhone(customer.getPhone(),phone);
if(cvurl!=null){customer.setCvurl(cvurl);}
customer.setExtra(credential.getDiscipline().getName());
customer.setPhone(phone);
customerrepo.edit(customer);
//SENDING EMAIL
SendEmail sendObject=new SendEmail();
Email mail=new Email();
mail.setEmailAddress(customer.getEmail());
mail.setMessage("Dear "+fname+ " "+lname +", your credential has been successfully updated. "
+ "Kindly login to your account and click Pay/Renew Subscription"
+ " to subscribe for your 30-day daily alerts. Thank you");
mail.setSubject("Vaultjobs Credentials updated");
sendObject.sendSimpleMail(mail);
//END OF EMAIL
FacesMessage msg = new FacesMessage("Credential Updated. Click Pay/Renew Subscription to subscribe for your daily alerts");
FacesContext.getCurrentInstance().addMessage(null, msg);
return null;
}
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public List<Customer> getCustomerList() {
return customerList;
}
public void setCustomerList(List<Customer> customerList) {
this.customerList = customerList;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPasswd() {
return passwd;
}
public void setPasswd(String passwd) {
this.passwd = passwd;
}
public Date getDob() {
return dob;
}
public void setDob(Date dob) {
this.dob = dob;
}
public String getFname() {
return fname;
}
public void setFname(String fname) {
this.fname = fname;
}
public String getLname() {
return lname;
}
public void setLname(String lname) {
this.lname = lname;
}
public String getDiscipline() {
return discipline;
}
public void setDiscipline(String discipline) {
this.discipline = discipline;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getQualification() {
return qualification;
}
public void setQualification(String qualification) {
this.qualification = qualification;
}
public String getCvurl() {
return cvurl;
}
public void setCvurl(String cvurl) {
this.cvurl = cvurl;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getCpasswd() {
return cpasswd;
}
public void setCpasswd(String cpasswd) {
this.cpasswd = cpasswd;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public void onSelect(AjaxBehaviorEvent event) {
checked = ((HtmlSelectBooleanCheckbox)event.getSource()).isSelected();
System.out.println("checked:"+checked);
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Discipline getDiscpiline() {
return discpiline;
}
public void setDiscpiline(Discipline discpiline) {
this.discpiline = discpiline;
}
public List<Discipline> getDiscpilineList() {
return discpilineList;
}
public void setDiscpilineList(List<Discipline> discpilineList) {
this.discpilineList = discpilineList;
}
public States getStates() {
return states;
}
public void setStates(States states) {
this.states = states;
}
public List<States> getStatesList() {
return statesList;
}
public void setStatesList(List<States> statesList) {
this.statesList = statesList;
}
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
public void FileDownloadView() {
if(myfile!=null)
{
InputStream stream=null;
try {
File ff=new File(myfile);
stream = new FileInputStream(ff);
afile = new DefaultStreamedContent(stream, FacesContext.getCurrentInstance().getExternalContext().getMimeType(ff.getName()), ff.getName());
System.out.println(afile.getContentType());
} catch (FileNotFoundException ex) {
Logger.getLogger(CredentialMBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public StreamedContent getAfile() {
return afile;
}
}
| [
"ahmed.oladele@vanso.com"
] | ahmed.oladele@vanso.com |
db48fbe1ef65ab858c1a4fe69d79ad7a2b7bd43f | ffd74ebe35f0facb20a1637a9401bac9e5762414 | /springboot-demo/src/main/java/com/cynen/demo/controller/ProducerController.java | efee29ff561ed97c78216ec3c2792a01a45963ee | [] | no_license | cynen/pinyougou | 0eefafac18736486d4b0c83d6fe78f314770d79b | ce0c8fc0c794b5cc523702dec121f337e5cd85f8 | refs/heads/master | 2023-03-05T20:14:04.743395 | 2022-06-08T12:58:18 | 2022-06-08T12:58:18 | 214,212,759 | 2 | 2 | null | 2023-02-22T05:26:23 | 2019-10-10T15:02:48 | JavaScript | UTF-8 | Java | false | false | 1,022 | java | package com.cynen.demo.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ProducerController {
@Autowired
private JmsMessagingTemplate jmsMessagingTemplate;
@RequestMapping("/send")
public void send() {
// Destination destination = new ActiveMQQueue("test");
/*jmsTemplate.send("test", new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
return session.createTextMessage("测试一下。。。");
}
});*/
// jmsMessagingTemplate.convertAndSend("springboot.queue", text);
Map map = new HashMap();
map.put("mobile", "18986521556");
map.put("checkcode", "189865");
jmsMessagingTemplate.convertAndSend("pinyougou.user.sms", map);
}
}
| [
"cai.neng@zte.com.cn"
] | cai.neng@zte.com.cn |
5958902faf76bec9e8dd1fb0f1059e988e1bdb3a | d4a9fca0d047226b48534cd0d9dc9e9ebdcef6be | /Jsp_project/src/com/cinema/model/ScreenDAO.java | 69f3479edd27b015492acf19380a0a3943a1e0df | [] | no_license | minseong0924/JSP_teamProject_3 | a9b4156d801d1573e99d2f88c96fc40f20cd5135 | 1121aa8d4764672bc7170ec8f2df5cd7ddf0eca7 | refs/heads/master | 2023-06-04T23:02:49.112268 | 2021-06-11T01:34:15 | 2021-06-11T01:34:15 | 372,354,422 | 0 | 0 | null | 2021-06-01T06:14:24 | 2021-05-31T01:50:09 | null | UTF-8 | Java | false | false | 6,662 | java | package com.cinema.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class ScreenDAO {
Connection con = null; // DB 연결하는 객체.
PreparedStatement pstmt = null; // DB에 SQL문을 전송하는 객체.
ResultSet rs = null; // SQL문을 실행 후 결과 값을 가지고 있는 객체.
String sql = null; // 쿼리문을 저장할 객체.
// 싱글톤 방식으로 BoardDAO 객체를 만들자.
// 1단계 : 싱글톤 방식으로 객체를 만들기 위해서는 우선적으로
// 기본생성자의 접근제어자를 private 으로 선언을 해야 함.
// 2단계 : 정적 멤버로 선언을 해야 함 - static 으로 선언을 한다는 의미.
private static ScreenDAO instance = null;
// 3단계 : 외부에서 객체 생성을 하지 못하게 접근을 제어 - private 기본 생성자를 만듬.
private ScreenDAO() { }
// 4단계 : 기본 생성자 대신에 싱긑턴 객체를 return을 해 주는 getInstance()
// 메서드를 만들어서 여기에 접근하게 하는 방법
public static ScreenDAO getInstance() {
if(instance == null) {
instance = new ScreenDAO();
}
return instance;
} // getInstance() 메서드 end
// DB 연동하는 작업을 진행하는 메서드 - DBCP방식으로 연결 진행
public void openConn() {
try {
// 1단계 : JNDI 서버 객체 생성.
Context ctx = new InitialContext();
// 2단계 : lookup() 메서드를 이용하여 매칭되는 커넥션을 찾는다.
DataSource ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/myoracle");
// 3단계 : DataSource 객체를 이용하여 커넥션 객체를 하나 가져온다.
con = ds.getConnection();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} // openConn() 메서드 end
// DB에 연결된 객체를 종료하는 메서드
public void closeConn(ResultSet rs,
PreparedStatement pstmt, Connection con) {
try {
if(rs != null) rs.close();
if(pstmt != null) pstmt.close();
if(con != null) con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} // closeConn() 메서드 end
public int insertScreen(ScreenDTO dto) {
int result = 0, count = 11111;
try {
openConn();
sql = "select max(screencode) from screen";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next()) {
if(rs.getInt(1) != 0) {
count = rs.getInt(1) + 1;
}
}
sql = "select * from screen where cinemacode = ? "+
"and cincode = ? " +
"and (? between start_time and end_time "+
"or ? between start_time and end_time)";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, dto.getCinemacode());
pstmt.setInt(2, dto.getCincode());
pstmt.setInt(3, dto.getStart_time());
pstmt.setInt(4, dto.getEnd_time());
rs = pstmt.executeQuery();
if(rs.next()) {
result = -2;
} else {
sql = "insert into screen "
+ " values(?,?,?,?,?,?)";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, count);
pstmt.setInt(2, dto.getMoviecode());
pstmt.setInt(3, dto.getCinemacode());
pstmt.setInt(4, dto.getCincode());
pstmt.setInt(5, dto.getStart_time());
pstmt.setInt(6, dto.getEnd_time());
result = pstmt.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConn(rs, pstmt, con);
}
return result;
}
public List<ScreenDTO> screenOpen() {
List<ScreenDTO> list = new ArrayList<>();
try {
openConn();
sql = "select * from screen order by screencode desc";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
while(rs.next()) {
ScreenDTO dto = new ScreenDTO();
dto.setScreencode(rs.getInt("screencode"));
dto.setMoviecode(rs.getInt("moviecode"));
dto.setCinemacode(rs.getInt("cinemacode"));
dto.setCincode(rs.getInt("cincode"));
dto.setStart_time(rs.getInt("start_time"));
dto.setEnd_time(rs.getInt("end_time"));
list.add(dto);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConn(rs, pstmt, con);
}
return list;
}
public ScreenDTO screenDetailOpen(int screencode) {
ScreenDTO dto = new ScreenDTO();
try {
openConn();
sql = "select * from screen where screencode =?";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, screencode);
rs = pstmt.executeQuery();
if(rs.next()) {
dto.setScreencode(screencode);
dto.setMoviecode(rs.getInt("moviecode"));
dto.setCinemacode(rs.getInt("cinemacode"));
dto.setCincode(rs.getInt("cincode"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConn(rs, pstmt, con);
}
return dto;
}
public int deleteScreen(int screencode) {
int result = 0;
try {
openConn();
sql = "delete from screen where screencode = ?";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, screencode);
result = pstmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConn(rs, pstmt, con);
}
return result;
}
public int updateScreen(ScreenDTO dto) {
int result = 0;
try {
openConn();
sql = "select * from screen where screencode != ? "+
"and cinemacode = ? "+
"and cincode = ? " +
"and ( ? between start_time and end_time "+
"or ? between start_time and end_time)";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, dto.getScreencode());
pstmt.setInt(2, dto.getCinemacode());
pstmt.setInt(3, dto.getCincode());
pstmt.setInt(4, dto.getStart_time());
pstmt.setInt(5, dto.getEnd_time());
rs = pstmt.executeQuery();
if(rs.next()) {
result = -2;
} else {
sql = "update screen set " +
"start_time = ?, " +
"end_time = ? " +
"where screencode = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, dto.getStart_time());
pstmt.setInt(2, dto.getEnd_time());
pstmt.setInt(3, dto.getScreencode());
result = pstmt.executeUpdate();
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
closeConn(rs, pstmt, con);
}
return result;
}
}
| [
"rhfqlsdkdl18@gmail.com"
] | rhfqlsdkdl18@gmail.com |
aa90d89644b37fec9853c6bb58a40856a009f135 | e8d37c2487ce86b9db779fea5ca790465e5a9fad | /aplicacao/src/main/java/br/com/gumga/academia/aplicacao/repository/PedidoRepository.java | aab5cdd4b5ad35d12b8a15248b306db8d775c06c | [] | no_license | edmagri/Mod2ExercFinal | 808777a7ebdd32eb04d9da4b5862148d9124c67c | feb900dd4e8bc68ce0ebdbd11fd53839d8107c93 | refs/heads/master | 2016-08-11T09:01:11.816246 | 2016-01-27T02:20:33 | 2016-01-27T02:20:33 | 50,215,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package br.com.gumga.academia.aplicacao.repository;
import br.com.gumga.academia.entidades.Pedido;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
/**
*
* @author Usuario
*/
public interface PedidoRepository extends JpaRepository<Pedido, Long> {
}
| [
"Edson"
] | Edson |
fcf12e6616e66a01b19f012c14ee034a3e5b794f | 3f8f160f0a368ad2b52ea07ae6b3495397a1a397 | /core/audio/src/main/java/usage/ywb/wrapper/audio/ui/view/VisualizerView.java | ae8f39060c32835bdae168df35d20e524685f317 | [] | no_license | yuwenbo/BaseWrapper | 8fe28f615f92553fa4ffa131c5f1e41d33d1f34c | f9ac779e9fff20015a8e4983f0c9494b986c449c | refs/heads/master | 2023-04-10T02:46:54.498933 | 2021-04-19T08:24:09 | 2021-04-19T08:24:09 | 269,015,535 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,817 | java | package usage.ywb.wrapper.audio.ui.view;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import usage.ywb.wrapper.audio.R;
/**
* @author frank.yu
*/
public class VisualizerView extends View {
private float[] points;
private byte[] waveform;
private Paint paint;
private static final int COUNT = 20;
public VisualizerView(Context context) {
this(context, null);
}
public VisualizerView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public VisualizerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
paint = new Paint();
paint.setColor(getResources().getColor(R.color.line));
paint.setAlpha(127);
}
@Override
protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
if (waveform == null) {
points = new float[waveform.length * 4];
return;
}
int width = getWidth();
int height = getHeight();
for (int i = 0; i < COUNT; i++) {
if (waveform[i] < 0) {
waveform[i] = 127;
}
points[i * 4] = width / COUNT * i + width / 45;
points[i * 4 + 1] = waveform[i] * height / 127 - 2;
points[i * 4 + 2] = width / COUNT * i + width / 45;
points[i * 4 + 3] = height;
}
paint.setStrokeWidth(width / 30);
canvas.drawLines(points, paint);
}
/**
* @param waveform
*/
public void updateVisualizer(final byte[] waveform) {
this.waveform = waveform;
postInvalidate();
}
}
| [
"749942362@qq.com"
] | 749942362@qq.com |
08694b5e495ea49d83d41c6ca4050d67d0001ec3 | 9719020dd3019fa2b5f1caa2720ae0cbb83579f1 | /app/src/main/java/com/enuke/smartapp/installappdetails/Pinfo.java | ae04eca2c602cf6a16b292b362945dcaf58cac8d | [] | no_license | logix01/SpyApp | 210732cda103653914f208b2c12d8b3871e4daf2 | b013237221b03d9ed9b9a7dea3387ae0d2b9dffd | refs/heads/master | 2020-09-13T03:02:30.349206 | 2016-08-31T11:58:34 | 2016-08-31T11:58:34 | 67,032,983 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package com.enuke.smartapp.installappdetails;
import java.util.Date;
import android.content.Context;
import android.graphics.drawable.Drawable;
import com.blinkawards.utility.Utility;
class PInfo {
public String appname = "";
public String pname = "";
public String versionName = "";
public int versionCode = 0;
public Drawable icon;
public void prettyPrint(Context mContext) {
////System.out.println(appname + "\t" + pname + "\t" + versionName + "\t" + versionCode);
InstallAppDetailsProvider.insertReferences(mContext,new AppDetailsBean(pname, versionName, appname, Utility.DateToString(new Date()), "INSTALLED"));
}
} | [
"vishal.kumar@enukesoftware.com"
] | vishal.kumar@enukesoftware.com |
e020a1c91d86065daddfc6972c2109a4dfd3e0d6 | 31b7d2067274728a252574b2452e617e45a1c8fb | /jpa-connector-beehive-bdk/com_V2.0.1.4/oracle/beehive/EnterpriseCreator.java | 4a66899105036663d1b1b75e8c3c214af38d685b | [] | no_license | ericschan/open-icom | c83ae2fa11dafb92c3210a32184deb5e110a5305 | c4b15a2246d1b672a8225cbb21b75fdec7f66f22 | refs/heads/master | 2020-12-30T12:22:48.783144 | 2017-05-28T00:51:44 | 2017-05-28T00:51:44 | 91,422,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,383 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.3-hudson-jaxb-ri-2.2.3-3-
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.05.18 at 04:52:34 PM PDT
//
package com.oracle.beehive;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for enterpriseCreator complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="enterpriseCreator">
* <complexContent>
* <extension base="{http://www.oracle.com/beehive}entityCreator">
* <sequence>
* <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="updater" type="{http://www.oracle.com/beehive}enterpriseUpdater" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "enterpriseCreator", propOrder = {
"name",
"updater"
})
public class EnterpriseCreator
extends EntityCreator
{
protected String name;
protected EnterpriseUpdater updater;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the updater property.
*
* @return
* possible object is
* {@link EnterpriseUpdater }
*
*/
public EnterpriseUpdater getUpdater() {
return updater;
}
/**
* Sets the value of the updater property.
*
* @param value
* allowed object is
* {@link EnterpriseUpdater }
*
*/
public void setUpdater(EnterpriseUpdater value) {
this.updater = value;
}
}
| [
"eric.sn.chan@gmail.com"
] | eric.sn.chan@gmail.com |
559c5df7a1f52b21b256380444cc54e3ccf56755 | a47d2cd85aacde5ae87a0bbef35aab6aace0d97c | /app/src/main/java/com/example/sisteminventory/HistoriPembelian.java | c735a90f70ea8d799a4ab659c8be08f535ce5dca | [] | no_license | MGalihPratama/Sistem-Inventori | daa26a439a723f537be2f40b53cc2202dcefa704 | de4385105de4c8bf5b4ea0d468a84aae347e0a04 | refs/heads/master | 2023-04-30T02:02:01.433082 | 2021-05-17T10:41:14 | 2021-05-17T10:41:14 | 368,148,514 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,793 | java | package com.example.sisteminventory;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class HistoriPembelian extends AppCompatActivity {
ImageButton back;
RecyclerView recyclerView;
MyDatabaseHelper myDB;
HisbeliAdapter HisbeliAdapter;
ArrayList<String> id_beli, nama_barang2, harga_barang2, beli_barang, tanggal_beli;
Button belibuttoncari;
EditText belibcari;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_histori_pembelian);
back = findViewById(R.id.tombol_back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
back();
}
});
belibuttoncari = findViewById(R.id.belibuttoncari);
belibcari = findViewById(R.id.belibcari);
recyclerView = findViewById(R.id.recyclerView);
myDB = new MyDatabaseHelper(this);
id_beli = new ArrayList<>();
nama_barang2 = new ArrayList<>();
harga_barang2 = new ArrayList<>();
beli_barang = new ArrayList<>();
tanggal_beli = new ArrayList<>();
storeDataInArrays();
HisbeliAdapter = new HisbeliAdapter(this,this, id_beli, nama_barang2, harga_barang2,
beli_barang, tanggal_beli);
recyclerView.setAdapter(HisbeliAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
belibuttoncari.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
HisbeliAdapter.clear();
id_beli.clear();
nama_barang2.clear();
harga_barang2.clear();
beli_barang.clear();
tanggal_beli.clear();
searchdata(belibcari.getText().toString());
HisbeliAdapter = new HisbeliAdapter(HistoriPembelian.this,HistoriPembelian.this, id_beli, nama_barang2, harga_barang2,
beli_barang, tanggal_beli);
recyclerView.setAdapter(HisbeliAdapter);
}
});
}
void storeDataInArrays(){
Cursor cursor = myDB.history();
if(cursor.getCount() == 0){
Toast.makeText(this, "Empty Data", Toast.LENGTH_SHORT).show();
}else{
while (cursor.moveToNext()){
id_beli.add(cursor.getString(0));
nama_barang2.add(cursor.getString(1));
harga_barang2.add(cursor.getString(2));
beli_barang.add(cursor.getString(3));
tanggal_beli.add(cursor.getString(4));
}
}
}
void searchdata(String text){
Cursor cursor = myDB.searchhistory(text);
if(cursor.getCount() == 0){
Toast.makeText(this, "Empty Data", Toast.LENGTH_SHORT).show();
}else{
while (cursor.moveToNext()){
id_beli.add(cursor.getString(0));
nama_barang2.add(cursor.getString(1));
harga_barang2.add(cursor.getString(2));
beli_barang.add(cursor.getString(3));
tanggal_beli.add(cursor.getString(4));
}
}
}
public void back (){
Intent intent = new Intent (this, Histori.class);
startActivity(intent);
}
}
| [
"mgalih.118140102@student.itera.ac.id"
] | mgalih.118140102@student.itera.ac.id |
98442422e16cf07f80936cae390777678429d9f4 | 39c4a193504ed2f10ff6ff525baf8aaedd50d549 | /financeCity/src/main/java/edu/nju/service/ExceptionsAndError/DataNotFoundException.java | 335a4a4b0b9ab1cde590fdbc4068657603a55f3d | [] | no_license | JayceSYH/Citi | 4565ce38dd70e872d9cca1ad7ad9e2e2df16f4a1 | ae6e1dfad43b1100e4e236a3c9f65b1399261687 | refs/heads/master | 2021-01-18T12:37:05.033934 | 2017-02-22T12:21:33 | 2017-02-22T12:21:33 | 67,296,299 | 1 | 0 | null | 2016-09-19T03:22:48 | 2016-09-03T15:08:42 | Java | UTF-8 | Java | false | false | 249 | java | package edu.nju.service.ExceptionsAndError;
/**
* Created by Sun YuHao on 2016/9/5.
*/
public class DataNotFoundException extends Exception {
public DataNotFoundException(String message) {
super("Data Not Found: " + message);
}
}
| [
"514380599@qq.com"
] | 514380599@qq.com |
03bdfdf232eee82c0c017532a43efe212ed25d3d | 44a4c0840654ae4f2f153ba17c95bc178436c9fd | /tlv/src/test/java/com/dream/codec/tlv/bean/DemoObj.java | 165d1ec749d3f957627bd65984e3bd95a31de791 | [
"Apache-2.0"
] | permissive | DreamJM/TLVCodec | f0c17cea26d43385b2a30b2d5f33d50fc0135169 | 7a2b77534bf401e05109b9a9f29d472432726d2e | refs/heads/master | 2023-06-22T23:45:53.547663 | 2021-08-28T13:42:31 | 2021-08-28T13:42:31 | 146,623,069 | 13 | 4 | Apache-2.0 | 2023-06-14T22:28:52 | 2018-08-29T15:46:23 | Java | UTF-8 | Java | false | false | 711 | java | package com.dream.codec.tlv.bean;
import com.dream.codec.tlv.annotation.TLVField;
import com.dream.codec.tlv.annotation.TLVObject;
import java.util.Objects;
/**
* @author DreamJM
*/
@TLVObject
public class DemoObj {
@TLVField(tag = 0x1)
private byte rawByte;
public DemoObj() {
}
public DemoObj(byte rawByte) {
this.rawByte = rawByte;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DemoObj demoObj = (DemoObj) o;
return rawByte == demoObj.rawByte;
}
@Override
public int hashCode() {
return Objects.hash(rawByte);
}
}
| [
"snovajiang@gmail.com"
] | snovajiang@gmail.com |
23a2fcdff1169bc50d96b232113bac4a1d70813c | 66b5dc1cc0d77e8e2fbab028feaf5db8cf4cdd34 | /src/main/java/com/GoEvent/controller/ShoppingCartController.java | f916e84c9a0797fc303bb75a22b190dae99b571b | [] | no_license | gilb77/GoEvents | 3fba595baa64420c3627f687ba97a7adbc16ffbf | 29936bc52b185eae1ee5d1e37104e803436cab98 | refs/heads/master | 2022-01-23T03:18:44.557691 | 2019-12-20T17:54:13 | 2019-12-20T17:54:13 | 190,762,740 | 0 | 0 | null | 2022-01-21T23:35:18 | 2019-06-07T15:01:25 | Java | UTF-8 | Java | false | false | 1,607 | java | package com.GoEvent.controller;
import com.GoEvent.service.impl.ShoppingCartServiceImpl;
import com.GoEvent.util.ParseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class ShoppingCartController {
@Autowired
private ShoppingCartServiceImpl shoppingCartService;
@RequestMapping("/shoppingCart")
public String shoppingCart(Model model) {
model.addAttribute("invites", shoppingCartService.getInvites());
model.addAttribute("total", shoppingCartService.getTotal());
model.addAttribute("parseUtil", new ParseUtil());
return "shoppingCart";
}
@RequestMapping("/shoppingCart/removeProduct/{eventId}")
public String removeEventFromCart(@PathVariable("eventId") int eventId, Model model) {
shoppingCartService.removeInvite(eventId);
return shoppingCart(model);
}
@GetMapping("/shoppingCart/checkout")
public String checkout(Model model,Authentication authentication) {
if(!shoppingCartService.checkout(authentication.getName())) {
model.addAttribute("error", "The places you want are save");
shoppingCartService.removeAllEvents();
return "shoppingCart";
}
return shoppingCart(model);
}
}
| [
"gilb77@gmail.com"
] | gilb77@gmail.com |
fef7deb81ebff66655c09b5649550a029cc65047 | 6b3547011816fcfd922588eb971320fe67b0abb4 | /scl-api-user/src/main/java/com/scl/user/domain/SysOrganization.java | 63782955708e40eda2c667df059a5046b124ab94 | [] | no_license | shengchenglong/scl-project.dubbo.version | dd25766895101b2c6826ececff6b356ac5f0d5ea | c8cfb10ce293e1b7395959ce900293be98f93908 | refs/heads/master | 2021-07-04T15:09:53.251836 | 2017-09-28T05:35:29 | 2017-09-28T05:35:29 | 103,911,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,212 | java | package com.scl.user.domain;
import java.io.Serializable;
import java.util.Date;
public class SysOrganization implements Serializable {
private String id;
private String code;
private String name;
private Integer priority;
private String parentCode;
private String parentCodes;
private Integer status;
private Integer isDelete;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private static final long serialVersionUID = 1L;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getParentCodes() {
return parentCodes;
}
public void setParentCodes(String parentCodes) {
this.parentCodes = parentCodes;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
SysOrganization other = (SysOrganization) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getPriority() == null ? other.getPriority() == null : this.getPriority().equals(other.getPriority()))
&& (this.getParentCode() == null ? other.getParentCode() == null : this.getParentCode().equals(other.getParentCode()))
&& (this.getParentCodes() == null ? other.getParentCodes() == null : this.getParentCodes().equals(other.getParentCodes()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
&& (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getPriority() == null) ? 0 : getPriority().hashCode());
result = prime * result + ((getParentCode() == null) ? 0 : getParentCode().hashCode());
result = prime * result + ((getParentCodes() == null) ? 0 : getParentCodes().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", code=").append(code);
sb.append(", name=").append(name);
sb.append(", priority=").append(priority);
sb.append(", parentCode=").append(parentCode);
sb.append(", parentCodes=").append(parentCodes);
sb.append(", status=").append(status);
sb.append(", isDelete=").append(isDelete);
sb.append(", createBy=").append(createBy);
sb.append(", createTime=").append(createTime);
sb.append(", updateBy=").append(updateBy);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
} | [
"shengchenglong@fulan.com.cn"
] | shengchenglong@fulan.com.cn |
0f5982d78f4bf437d8a19fb60c7d00c038868cc6 | 72e2124e5ec0a9fb1b5b0ec0c27322e6c2effb76 | /SuMu-Cloud/sumu-common/sumu-common-core/src/main/java/com/sumu/common/core/constant/GenConstants.java | e0b417a9c8a035e23574224f7dc26c1ed9db6058 | [] | no_license | sdtm1016/SuMu-App | 1d554f74c346cc60c88a8936205d44f4d906d054 | d96503fd5f94d762cb3aef58d680013fc2bf62cd | refs/heads/master | 2023-02-21T09:53:13.309836 | 2021-01-23T08:15:30 | 2021-01-23T08:15:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,293 | java | package com.sumu.common.core.constant;
/**
* 代码生成通用常量
*
* @author sumu
*/
public class GenConstants
{
/** 单表(增删改查) */
public static final String TPL_CRUD = "crud";
/** 树表(增删改查) */
public static final String TPL_TREE = "tree";
/** 树编码字段 */
public static final String TREE_CODE = "treeCode";
/** 树父编码字段 */
public static final String TREE_PARENT_CODE = "treeParentCode";
/** 树名称字段 */
public static final String TREE_NAME = "treeName";
/** 上级菜单ID字段 */
public static final String PARENT_MENU_ID = "parentMenuId";
/** 上级菜单名称字段 */
public static final String PARENT_MENU_NAME = "parentMenuName";
/** 数据库字符串类型 */
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2", "tinytext", "text",
"mediumtext", "longtext" };
/** 数据库时间类型 */
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
/** 数据库数字类型 */
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
"bigint", "float", "float", "double", "decimal" };
/** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
/** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" };
/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" };
/** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
/** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" };
/** 文本框 */
public static final String HTML_INPUT = "input";
/** 文本域 */
public static final String HTML_TEXTAREA = "textarea";
/** 下拉框 */
public static final String HTML_SELECT = "select";
/** 单选框 */
public static final String HTML_RADIO = "radio";
/** 复选框 */
public static final String HTML_CHECKBOX = "checkbox";
/** 日期控件 */
public static final String HTML_DATETIME = "datetime";
/** 富文本控件 */
public static final String HTML_EDITOR = "editor";
/** 字符串类型 */
public static final String TYPE_STRING = "String";
/** 整型 */
public static final String TYPE_INTEGER = "Integer";
/** 长整型 */
public static final String TYPE_LONG = "Long";
/** 浮点型 */
public static final String TYPE_DOUBLE = "Double";
/** 高精度计算类型 */
public static final String TYPE_BIGDECIMAL = "BigDecimal";
/** 时间类型 */
public static final String TYPE_DATE = "Date";
/** 模糊查询 */
public static final String QUERY_LIKE = "LIKE";
/** 需要 */
public static final String REQUIRE = "1";
}
| [
"18813000271@163.com"
] | 18813000271@163.com |
5dd675f1481c4fde50a2d5c7008096415b985b4f | d2a5f2fafcbcf2eba438c8eee161d4c35a98af9e | /src/main/java/com/cyx/service/impl/ProductServiceImpl.java | 463229b631ba5e2c126014b715fd51a336cb6ae4 | [] | no_license | mizuyeh/travel_web | 691bf05e92474699960217dbe4491e8d8c02753d | b4cf133d919d9a4182cb2f5102f0ac196580a21f | refs/heads/master | 2023-03-24T15:43:49.898851 | 2021-03-11T05:18:57 | 2021-03-11T05:18:57 | 349,920,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | java | package com.cyx.service.impl;
import com.cyx.dao.ProductDao;
import com.cyx.entity.Product;
import com.cyx.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @Description
* @date 2021/2/22
*/
@Service("productService")
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductDao productDao;
@Override
@Transactional(readOnly = true)
public List<Product> findAll() throws Exception {
return productDao.findAll();
}
@Override
public int saveProduct(Product product) throws Exception {
return productDao.saveProduct(product);
}
@Override
public int deleteProductByNum(String productNum) throws Exception {
return productDao.deleteProductByNum(productNum);
}
@Override
public int updateProductStatus(String productNum, int status) throws Exception {
return productDao.updateProductStatus(productNum, status);
}
}
| [
"744856727@qq.com"
] | 744856727@qq.com |
851686a0d73ac003d8210799b8594053fb6f1ead | 6bb452cd963f272039b0758f5310702d631c71d9 | /Supervised_Learning_HW/experiments/nnet/BackPropagationTrainerFactory.java | d4d2d3197084d0bed558d9f34bca15cd3f228bba | [] | no_license | jdreddaway/Machine-Learning-HW | 8087bc376f148d29592f45c784b02585830c69b1 | cdea89fe752f65f60cd45af15e2940722ae6a9f5 | refs/heads/master | 2021-01-01T05:37:31.933239 | 2015-04-20T04:22:23 | 2015-04-20T04:22:23 | 31,626,948 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package experiments.nnet;
import shared.DataSet;
import func.nn.NetworkTrainer;
import func.nn.backprop.BackPropagationNetwork;
public abstract class BackPropagationTrainerFactory {
private String name;
public BackPropagationTrainerFactory(String name) {
this.name = name;
}
public abstract NetworkTrainer create(DataSet data, BackPropagationNetwork network);
public String getName() {
return name;
}
}
| [
"jdreddaway@gmail.com"
] | jdreddaway@gmail.com |
b0dbb4dba6594516d5deb30021360dc6f362e7bc | 70e1cbf25448a94910bb6a62ccdc11997fa07597 | /blackduck-artifactory-common/src/main/java/com/synopsys/integration/blackduck/artifactory/modules/policy/PolicyModule.java | a67b5af2b3903ef3f6d8bce6611a21a3a044f517 | [
"Apache-2.0"
] | permissive | sumitsingh306/blackduck-artifactory | e37c2d6b1a54d88d2452c56e8b15ace7a019f7f2 | 47638a0406e33f1fa3c47267302800498c253e9d | refs/heads/master | 2022-11-30T11:41:50.294335 | 2020-08-14T19:21:23 | 2020-08-14T19:21:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,532 | java | /**
* blackduck-artifactory-common
*
* Copyright (c) 2020 Synopsys, Inc.
*
* 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 com.synopsys.integration.blackduck.artifactory.modules.policy;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.artifactory.exception.CancelException;
import org.artifactory.repo.RepoPath;
import com.synopsys.integration.blackduck.api.enumeration.PolicySeverityType;
import com.synopsys.integration.blackduck.api.generated.enumeration.PolicySummaryStatusType;
import com.synopsys.integration.blackduck.artifactory.ArtifactoryPropertyService;
import com.synopsys.integration.blackduck.artifactory.BlackDuckArtifactoryProperty;
import com.synopsys.integration.blackduck.artifactory.modules.Module;
import com.synopsys.integration.blackduck.artifactory.modules.analytics.collector.AnalyticsCollector;
import com.synopsys.integration.blackduck.artifactory.modules.analytics.collector.FeatureAnalyticsCollector;
public class PolicyModule implements Module {
private final PolicyModuleConfig policyModuleConfig;
private final ArtifactoryPropertyService artifactoryPropertyService;
private final FeatureAnalyticsCollector featureAnalyticsCollector;
public PolicyModule(final PolicyModuleConfig policyModuleConfig, final ArtifactoryPropertyService artifactoryPropertyService, final FeatureAnalyticsCollector featureAnalyticsCollector) {
this.policyModuleConfig = policyModuleConfig;
this.artifactoryPropertyService = artifactoryPropertyService;
this.featureAnalyticsCollector = featureAnalyticsCollector;
}
public void handleBeforeDownloadEvent(final RepoPath repoPath) {
String reason = null;
final boolean shouldBlock = false;
if (shouldCancelOnPolicyViolation(repoPath)) {
reason = "because it violates a policy in Black Duck.";
}
featureAnalyticsCollector.logFeatureHit("handleBeforeDownloadEvent", String.format("blocked:%s", Boolean.toString(shouldBlock)));
if (reason != null) {
throw new CancelException(String.format("The Black Duck %s has prevented the download of %s %s", PolicyModule.class.getSimpleName(), repoPath.toPath(), reason), 403);
}
}
@Override
public List<AnalyticsCollector> getAnalyticsCollectors() {
return Collections.singletonList(featureAnalyticsCollector);
}
@Override
public PolicyModuleConfig getModuleConfig() {
return policyModuleConfig;
}
private boolean shouldCancelOnPolicyViolation(final RepoPath repoPath) {
if (artifactoryPropertyService.hasProperty(repoPath, BlackDuckArtifactoryProperty.OVERALL_POLICY_STATUS)) {
// TODO: Fix in 8.0.0
// Currently scanned artifacts are not supported because POLICY_STATUS and OVERALL_POLICY_STATUS is used in scans and there is overlap
// with inspection using just POLICY_STATUS. Additional work will need to be done to sync these values and a use case for blocking
// scanned artifacts has yet to present itself. JM - 08/2019
return false;
}
final Optional<PolicySummaryStatusType> inViolationProperty = artifactoryPropertyService.getProperty(repoPath, BlackDuckArtifactoryProperty.POLICY_STATUS)
.map(PolicySummaryStatusType::valueOf)
.filter(it -> it.equals(PolicySummaryStatusType.IN_VIOLATION));
if (inViolationProperty.isPresent()) {
final Optional<String> severityTypes = artifactoryPropertyService.getProperty(repoPath, BlackDuckArtifactoryProperty.POLICY_SEVERITY_TYPES);
if (severityTypes.isPresent()) {
final List<PolicySeverityType> severityTypesToBlock = policyModuleConfig.getPolicySeverityTypes();
final List<PolicySeverityType> matchingSeverityTypes = Arrays.stream(severityTypes.get().split(","))
.map(PolicySeverityType::valueOf)
.filter(severityTypesToBlock::contains)
.collect(Collectors.toList());
return !matchingSeverityTypes.isEmpty();
} else {
// The plugin should populate the severity types on artifacts automatically. But if an artifact is somehow missed, we want to be on the safe side.
return true;
}
} else {
return false;
}
}
}
| [
"jake.mathews.email@gmail.com"
] | jake.mathews.email@gmail.com |
4b4b144c9290983326533b4f98127cb9f67f5855 | 72c47a38d1c9bdfbce85012744e85cf52b6295f7 | /linkedin/linkedin-web/src/test/java/com/ra/course/linkedin/web/service/recommendation/RecommendationServiceImplIntegrationTest.java | 203576f6f7e618837e10d562f6e910856b0cee0b | [] | no_license | GaiverK/linkedin | 728cfcd119cd4e7c12798c5d6feb174aba0dfb95 | 99dd5e3d049f74e173e3c85d6d9c8a702bee309b | refs/heads/main | 2022-12-27T19:54:06.734944 | 2020-10-12T10:18:04 | 2020-10-12T10:18:04 | 303,353,763 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,683 | java | package com.ra.course.linkedin.web.service.recommendation;
import com.ra.course.linkedin.model.entity.profile.Profile;
import com.ra.course.linkedin.model.entity.profile.Recommendation;
import com.ra.course.linkedin.persistence.profile.ProfileRepository;
import com.ra.course.linkedin.persistence.recommendation.RecommendationRepository;
import com.ra.course.linkedin.service.profile.ProfileService;
import com.ra.course.linkedin.service.recommendation.RecommendationService;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CopyOnWriteArrayList;
import static com.ra.course.linkedin.web.service.ServiceIntegrationTestUtils.tryToDelete;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
public class RecommendationServiceImplIntegrationTest {
private static final long NON_EXISTENT_ID = -1L;
public static final String NEW_DESCRIPTION = "New description";
@Autowired
private RecommendationService recommendationService;
@Autowired
private RecommendationRepository recommendationRepository;
@Autowired
private ProfileService profileService;
@Autowired
private ProfileRepository profileRepository;
private Recommendation recommendation;
private Profile profile;
@BeforeEach
void setUp() {
profile = new Profile();
profileService.saveProfile(profile);
recommendation = createRecommendation();
recommendationService.addOrUpdateRecommendation(recommendation);
}
@AfterEach
void tearDown() {
tryToDelete(recommendationRepository, recommendation);
tryToDelete(profileRepository, profile);
}
@Test
@DisplayName("When the recommendation is added or updated, " +
"then it should be saved in repository")
void testAddOrUpdateRecommendation() {
//then
final Recommendation recommendationFromRepo =
recommendationService.getRecommendationById(
recommendation.getId()).get();
assertEquals(recommendationFromRepo, recommendation);
//when
recommendation.setDescription(NEW_DESCRIPTION);
recommendationService.addOrUpdateRecommendation(recommendation);
//then
assertEquals(recommendation.getDescription(), NEW_DESCRIPTION);
}
@Test
@DisplayName("When recommendation was deleted, " +
"then this recommendation should be absent in repository")
public void testDeleteRecommendation() {
assertTrue(getAllRecommendationsFromRepository()
.contains(recommendation));
//when
recommendationService.deleteRecommendation(recommendation);
//then
assertFalse(getAllRecommendationsFromRepository()
.contains(recommendation));
}
@Test
@DisplayName("When get existed recommendation, it should be returned.")
public void testGetExistedRecommendation() {
//when
Recommendation recommendationFromRepo = recommendationService
.getRecommendationById(recommendation.getId()).get();
//then
assertEquals(recommendation, recommendationFromRepo);
}
@Test
@DisplayName("When get not existed recommendation, " +
"then must be returned empty optional.")
public void testGetNotExistedRecommendation() {
//when
Optional<Recommendation> recommendationOptional =
recommendationService.getRecommendationById(NON_EXISTENT_ID);
//then
assertTrue(recommendationOptional.isEmpty());
}
@Test
@DisplayName("When get recommendations with specific profileId, " +
"then return list of recommendations with this profileId")
void testGetAllRecommendationsByProfileID() {
//when
List<Recommendation> recommendationList = recommendationService
.getAllRecommendationsByProfileId(profile.getId());
//then
assertEquals(List.of(recommendation), recommendationList);
}
private Recommendation createRecommendation() {
return Recommendation.builder()
.profile(profile)
.build();
}
private List<Recommendation> getAllRecommendationsFromRepository() {
return new CopyOnWriteArrayList<>((CopyOnWriteArrayList<Recommendation>)
recommendationRepository.getAll());
}
}
| [
"gaiverkostyan1987@gmail.com"
] | gaiverkostyan1987@gmail.com |
ebe1cb939afdef2fa267fa15576d3826b8f11972 | e82c1473b49df5114f0332c14781d677f88f363f | /MED-CLOUD/med-service/src/main/java/nta/med/service/ihis/handler/nuro/NuroCboZipCodeHandler.java | 34d580a67b979a2de4724ea7d185b32e459de4e5 | [] | no_license | zhiji6/mih | fa1d2279388976c901dc90762bc0b5c30a2325fc | 2714d15853162a492db7ea8b953d5b863c3a8000 | refs/heads/master | 2023-08-16T18:35:19.836018 | 2017-12-28T09:33:19 | 2017-12-28T09:33:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,937 | java | package nta.med.service.ihis.handler.nuro;
import java.util.List;
import javax.annotation.Resource;
import nta.med.data.dao.medi.bas.Bas0123Repository;
import nta.med.core.infrastructure.socket.handler.ScreenHandler;
import nta.med.service.ihis.proto.NuroModelProto;
import nta.med.service.ihis.proto.NuroServiceProto;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.vertx.java.core.Vertx;
@Service
@Scope("prototype")
public class NuroCboZipCodeHandler extends ScreenHandler<NuroServiceProto.NuroCboZipCodeRequest, NuroServiceProto.NuroCboZipCodeResponse>{
private static final Log logger = LogFactory.getLog(NuroCboZipCodeHandler.class);
@Resource
private Bas0123Repository bas0123Repository;
@Override
@Transactional(readOnly = true)
public NuroServiceProto.NuroCboZipCodeResponse handle(Vertx vertx, String clientId,
String sessionId, long contextId,
NuroServiceProto.NuroCboZipCodeRequest request) throws Exception {
NuroServiceProto.NuroCboZipCodeResponse.Builder response = NuroServiceProto.NuroCboZipCodeResponse.newBuilder();
List<String> listNuroCboZipCode = bas0123Repository.getNuroCboZipCodeInfo(request.getZipCode1(), request.getZipCode2());
if (listNuroCboZipCode != null && !listNuroCboZipCode.isEmpty()) {
for (String nuroCboZipCode : listNuroCboZipCode) {
NuroModelProto.NuroCboZipCodeInfo.Builder builder = NuroModelProto.NuroCboZipCodeInfo.newBuilder();
if(!StringUtils.isEmpty(nuroCboZipCode)) {
builder.setZipName(nuroCboZipCode);
}
response.addZipCodeInfo(builder);
}
}
return response.build();
}
}
| [
"duc_nt@nittsusystem-vn.com"
] | duc_nt@nittsusystem-vn.com |
1d3d3728fa9d7813342981d299bf488eab072a5e | 377e5e05fb9c6c8ed90ad9980565c00605f2542b | /bin/platform/bootstrap/gensrc/de/hybris/platform/acceleratorservices/model/export/ExportDataHistoryEntryModel.java | 34a3ac796302d0ba4df9c8ba94e352fe1434138f | [] | no_license | automaticinfotech/HybrisProject | c22b13db7863e1e80ccc29774f43e5c32e41e519 | fc12e2890c569e45b97974d2f20a8cbe92b6d97f | refs/heads/master | 2021-07-20T18:41:04.727081 | 2017-10-30T13:24:11 | 2017-10-30T13:24:11 | 108,957,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,627 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at 30 Oct, 2017 12:11:59 PM ---
* ----------------------------------------------------------------
*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*
*/
package de.hybris.platform.acceleratorservices.model.export;
import de.hybris.bootstrap.annotations.Accessor;
import de.hybris.platform.acceleratorservices.enums.ExportDataStatus;
import de.hybris.platform.acceleratorservices.model.export.ExportDataCronJobModel;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.servicelayer.model.ItemModelContext;
import java.util.Date;
/**
* Generated model class for type ExportDataHistoryEntry first defined at extension acceleratorservices.
* <p>
* Contains a history of executed exports.
*/
@SuppressWarnings("all")
public class ExportDataHistoryEntryModel extends ItemModel
{
/**<i>Generated model type code constant.</i>*/
public final static String _TYPECODE = "ExportDataHistoryEntry";
/**<i>Generated relation code constant for relation <code>ExportDataCronJob2ExportDataHistoryRel</code> defining source attribute <code>exportDataCronJob</code> in extension <code>acceleratorservices</code>.</i>*/
public final static String _EXPORTDATACRONJOB2EXPORTDATAHISTORYREL = "ExportDataCronJob2ExportDataHistoryRel";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.code</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String CODE = "code";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.status</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String STATUS = "status";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.startTime</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String STARTTIME = "startTime";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.finishTime</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String FINISHTIME = "finishTime";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.processedResultCount</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String PROCESSEDRESULTCOUNT = "processedResultCount";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.failureMessage</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String FAILUREMESSAGE = "failureMessage";
/** <i>Generated constant</i> - Attribute key of <code>ExportDataHistoryEntry.exportDataCronJob</code> attribute defined at extension <code>acceleratorservices</code>. */
public static final String EXPORTDATACRONJOB = "exportDataCronJob";
/**
* <i>Generated constructor</i> - Default constructor for generic creation.
*/
public ExportDataHistoryEntryModel()
{
super();
}
/**
* <i>Generated constructor</i> - Default constructor for creation with existing context
* @param ctx the model context to be injected, must not be null
*/
public ExportDataHistoryEntryModel(final ItemModelContext ctx)
{
super(ctx);
}
/**
* <i>Generated constructor</i> - Constructor with all mandatory attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _code initial attribute declared by type <code>ExportDataHistoryEntry</code> at extension <code>acceleratorservices</code>
*/
@Deprecated
public ExportDataHistoryEntryModel(final String _code)
{
super();
setCode(_code);
}
/**
* <i>Generated constructor</i> - for all mandatory and initial attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _code initial attribute declared by type <code>ExportDataHistoryEntry</code> at extension <code>acceleratorservices</code>
* @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code>
*/
@Deprecated
public ExportDataHistoryEntryModel(final String _code, final ItemModel _owner)
{
super();
setCode(_code);
setOwner(_owner);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.code</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the code - unique code that identifies the export data history
*/
@Accessor(qualifier = "code", type = Accessor.Type.GETTER)
public String getCode()
{
return getPersistenceContext().getPropertyValue(CODE);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.exportDataCronJob</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the exportDataCronJob
*/
@Accessor(qualifier = "exportDataCronJob", type = Accessor.Type.GETTER)
public ExportDataCronJobModel getExportDataCronJob()
{
return getPersistenceContext().getPropertyValue(EXPORTDATACRONJOB);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.failureMessage</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the failureMessage - Message if failure occurred
*/
@Accessor(qualifier = "failureMessage", type = Accessor.Type.GETTER)
public String getFailureMessage()
{
return getPersistenceContext().getPropertyValue(FAILUREMESSAGE);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.finishTime</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the finishTime - Start time of this export
*/
@Accessor(qualifier = "finishTime", type = Accessor.Type.GETTER)
public Date getFinishTime()
{
return getPersistenceContext().getPropertyValue(FINISHTIME);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.processedResultCount</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the processedResultCount - The amount of records that was written to the export file
*/
@Accessor(qualifier = "processedResultCount", type = Accessor.Type.GETTER)
public Integer getProcessedResultCount()
{
return getPersistenceContext().getPropertyValue(PROCESSEDRESULTCOUNT);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.startTime</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the startTime - Start time of this export
*/
@Accessor(qualifier = "startTime", type = Accessor.Type.GETTER)
public Date getStartTime()
{
return getPersistenceContext().getPropertyValue(STARTTIME);
}
/**
* <i>Generated method</i> - Getter of the <code>ExportDataHistoryEntry.status</code> attribute defined at extension <code>acceleratorservices</code>.
* @return the status - The status of this particular export
*/
@Accessor(qualifier = "status", type = Accessor.Type.GETTER)
public ExportDataStatus getStatus()
{
return getPersistenceContext().getPropertyValue(STATUS);
}
/**
* <i>Generated method</i> - Initial setter of <code>ExportDataHistoryEntry.code</code> attribute defined at extension <code>acceleratorservices</code>. Can only be used at creation of model - before first save.
*
* @param value the code - unique code that identifies the export data history
*/
@Accessor(qualifier = "code", type = Accessor.Type.SETTER)
public void setCode(final String value)
{
getPersistenceContext().setPropertyValue(CODE, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.exportDataCronJob</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the exportDataCronJob
*/
@Accessor(qualifier = "exportDataCronJob", type = Accessor.Type.SETTER)
public void setExportDataCronJob(final ExportDataCronJobModel value)
{
getPersistenceContext().setPropertyValue(EXPORTDATACRONJOB, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.failureMessage</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the failureMessage - Message if failure occurred
*/
@Accessor(qualifier = "failureMessage", type = Accessor.Type.SETTER)
public void setFailureMessage(final String value)
{
getPersistenceContext().setPropertyValue(FAILUREMESSAGE, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.finishTime</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the finishTime - Start time of this export
*/
@Accessor(qualifier = "finishTime", type = Accessor.Type.SETTER)
public void setFinishTime(final Date value)
{
getPersistenceContext().setPropertyValue(FINISHTIME, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.processedResultCount</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the processedResultCount - The amount of records that was written to the export file
*/
@Accessor(qualifier = "processedResultCount", type = Accessor.Type.SETTER)
public void setProcessedResultCount(final Integer value)
{
getPersistenceContext().setPropertyValue(PROCESSEDRESULTCOUNT, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.startTime</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the startTime - Start time of this export
*/
@Accessor(qualifier = "startTime", type = Accessor.Type.SETTER)
public void setStartTime(final Date value)
{
getPersistenceContext().setPropertyValue(STARTTIME, value);
}
/**
* <i>Generated method</i> - Setter of <code>ExportDataHistoryEntry.status</code> attribute defined at extension <code>acceleratorservices</code>.
*
* @param value the status - The status of this particular export
*/
@Accessor(qualifier = "status", type = Accessor.Type.SETTER)
public void setStatus(final ExportDataStatus value)
{
getPersistenceContext().setPropertyValue(STATUS, value);
}
}
| [
"santosh.kshirsagar@automaticinfotech.com"
] | santosh.kshirsagar@automaticinfotech.com |
c28c81703b199f3dbd2ee0c126b465ac12200109 | cef49f80a7ee7c1f3fa8e01299f82b3f60ed8707 | /src/main/java/com/igor/structural/decorator/model/Umbrella.java | 393c5df26434ee1d62af98db26f5dbf1bb1b33a3 | [] | no_license | ihorsas/Patterns | 8494d118192d746fce90144af4e85dea0d4e2c21 | f1ba19a697894596a117b483f37a8d87eaf1a541 | refs/heads/master | 2023-02-23T20:08:50.538173 | 2021-01-29T09:28:35 | 2021-01-29T09:28:35 | 234,545,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 266 | java | package com.igor.structural.decorator.model;
public class Umbrella extends CompanyStuff {
public Umbrella(Color color) {
super(color);
}
@Override
public void view() {
System.out.print("It's umbrella with color: " + color);
}
}
| [
"Igor_Sas@epam.com"
] | Igor_Sas@epam.com |
0f9b98bad683b5d03b13f16156f070362cda10d3 | 85f577b3cf044f429d7760586751355480bcd91b | /DukeEarthquakes/src/edu/duke/FileSelector.java | 2488a2ae67552dc45450469e807149f6a4d8aef8 | [] | no_license | mvexel/refugees-duke-course | 0df9aec78572c92a8e122aa4e91b08e156b2cc6f | 47834e1ae72b72c38fa82b8087b4f5c1e3789e30 | refs/heads/master | 2020-04-12T21:32:30.585040 | 2019-02-04T06:35:07 | 2019-02-04T06:35:07 | 162,764,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,680 | java | package edu.duke;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.io.File;
/**
* This utility class creates a thread safe file dialog box for loading and
* saving files.
*
* @author Duke Software Team
* <p>
* This software is licensed with an Apache 2 license, see
* http://www.apache.org/licenses/LICENSE-2.0 for details.
*/
class FileSelector {
// result of selection
private static File[] ourFiles;
// BUGBUG: I think this is the right behavior, remembers where user left it last
private static JFileChooser ourChooser = new JFileChooser();
static {
ourChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
ourChooser.setCurrentDirectory(new File(System.getProperty("user.dir")));
}
/**
* Pops up a dialog box to select only one file.
*
* @return
*/
public static File selectFile() {
// guaranteed to have one element, though it may be null
return selectFiles(null, false, true)[0];
}
/**
* Pops up a dialog box to select only one file with given extensions.
*/
public static File selectFile(String[] extensionAccepted) {
// guaranteed to have one element, though it may be null
return selectFiles(extensionAccepted, false, true)[0];
}
/**
* Pops up a dialog box to select multiple files.
*/
public static File[] selectFiles() {
return selectFiles(null, true, true);
}
/**
* Pops up a dialog box to select multiple files with given extensions.
*
* @return
*/
public static File[] selectFiles(String[] extensionAccepted) {
return selectFiles(extensionAccepted, true, true);
}
/**
* Pops up a dialog box to save file with any extension.
*/
public static File saveFile() {
// guaranteed to have one element, though it may be null
return selectFiles(null, false, false)[0];
}
/**
* Pops up a dialog box to save file with given extensions.
*/
public static File saveFile(String[] extensionAccepted) {
// guaranteed to have one element, though it may be null
return selectFiles(extensionAccepted, false, false)[0];
}
// BUGBUG: one general function, but lots of booleans :(
private static File[] selectFiles(String[] extensionAccepted,
final boolean allowMultiple,
final boolean openForRead) {
ourChooser.setMultiSelectionEnabled(allowMultiple);
ourChooser.setFileFilter(new ChooserFilter(extensionAccepted));
try {
ourFiles = null;
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
int result = 0;
if (openForRead) {
result = ourChooser.showOpenDialog(null);
} else {
result = ourChooser.showSaveDialog(null);
}
if (result == JFileChooser.CANCEL_OPTION) {
ourFiles = new File[]{null};
} else {
try {
if (allowMultiple) {
ourFiles = ourChooser.getSelectedFiles();
} else {
ourFiles = new File[]{ourChooser.getSelectedFile()};
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e.toString());
}
}
}
});
return ourFiles;
} catch (Exception e) {
// it is still an exception, just not one required to be handled
throw new RuntimeException(e);
}
}
// This class implements a filter for image file names.
static class ChooserFilter extends FileFilter {
private String myExtensions;
public ChooserFilter(String[] extensionsAccepted) {
if (extensionsAccepted != null) {
myExtensions = String.format("(?i).*\\.(%s)", String.join("|", extensionsAccepted));
}
}
@Override
public boolean accept(File f) {
if (myExtensions != null) {
return f.getName().matches(myExtensions) || f.isDirectory();
} else {
return true;
}
}
@Override
public String getDescription() {
// BUGBUG: useful?
return "Files";
}
}
}
| [
"m@rtijn.org"
] | m@rtijn.org |
3de8983389d3fdda16c73bc3e05e29ffa5b5b544 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_844dd810c48c169d986c68ac71b5ff7c7216a590/OracleDataStoreManager/10_844dd810c48c169d986c68ac71b5ff7c7216a590_OracleDataStoreManager_t.java | e0fbdb6b9ec23096da809e93d8e5f1df5a4167f8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 25,901 | java | /*
* ====================================================================
*
* GeoBatch - Intersection Engine
*
* Copyright (C) 2007 - 2011 GeoSolutions S.A.S.
* http://www.geo-solutions.it
*
* GPLv3 + Classpath exception
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.
*
* ====================================================================
*
* This software consists of voluntary contributions made by developers
* of GeoSolutions. For more information on GeoSolutions, please see
* <http://www.geo-solutions.it/>.
*
*/
package it.geosolutions.geobatch.figis.intersection;
import static org.geotools.jdbc.JDBCDataStoreFactory.DATABASE;
import static org.geotools.jdbc.JDBCDataStoreFactory.DBTYPE;
import static org.geotools.jdbc.JDBCDataStoreFactory.HOST;
import static org.geotools.jdbc.JDBCDataStoreFactory.MAXCONN;
import static org.geotools.jdbc.JDBCDataStoreFactory.MAXWAIT;
import static org.geotools.jdbc.JDBCDataStoreFactory.MINCONN;
import static org.geotools.jdbc.JDBCDataStoreFactory.PASSWD;
import static org.geotools.jdbc.JDBCDataStoreFactory.PORT;
import static org.geotools.jdbc.JDBCDataStoreFactory.SCHEMA;
import static org.geotools.jdbc.JDBCDataStoreFactory.USER;
import static org.geotools.jdbc.JDBCDataStoreFactory.VALIDATECONN;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Semaphore;
import org.geotools.data.DataStore;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FeatureStore;
import org.geotools.data.Transaction;
import org.geotools.data.oracle.OracleNGDataStoreFactory;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.feature.FeatureCollections;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.geometry.jts.JTS;
import org.geotools.jdbc.JDBCDataStoreFactory;
import org.geotools.referencing.CRS;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vividsolutions.jts.geom.MultiPolygon;
public class OracleDataStoreManager
{
static final int DEFAULT_PAGE_SIZE = 50;
private static final Logger LOGGER = LoggerFactory.getLogger(OracleDataStoreManager.class);
private static final Semaphore SYNCH = new Semaphore(1);
private static final JDBCDataStoreFactory ORACLE_FACTORY = new OracleNGDataStoreFactory();
final static String STATS_TABLE = "STATISTICAL_TABLE";
final static String SPATIAL_TABLE = "SPATIAL_TABLE";
final static String STATS_TMP_TABLE = "STATISTICAL_TMP_TABLE";
final static String SPATIAL_TMP_TABLE = "SPATIAL_TMP_TABLE";
private final Map<String, Serializable> orclMap = new HashMap<String, Serializable>();
private static String DEFAULT_DBTYPE = "oracle";
SimpleFeatureType sfTmpGeom = null;
SimpleFeatureType sfTmpStats = null;
SimpleFeatureType sfStats = null;
SimpleFeatureType sfGeom = null;
private final DataStore orclDataStore;
/**
* Accepts params for connecting to the Oracle datastore
*/
public OracleDataStoreManager(
String hostname,
Integer port,
String database,
String schema,
String user,
String password) throws Exception
{
Transaction orclTransaction = null;
try
{
// init arguments
orclMap.put(DBTYPE.key, DEFAULT_DBTYPE);
orclMap.put(HOST.key, hostname);
orclMap.put(PORT.key, port);
orclMap.put(DATABASE.key, database);
orclMap.put(SCHEMA.key, schema);
orclMap.put(USER.key, user);
orclMap.put(PASSWD.key, password);
orclMap.put(MINCONN.key, 10);
orclMap.put(MAXCONN.key, 25);
orclMap.put(MAXWAIT.key, 100000);
orclMap.put(VALIDATECONN.key, true);
// create the underlying store and check that all table are there
try
{
orclDataStore = ORACLE_FACTORY.createDataStore(orclMap);
}
catch (Exception e)
{
throw new Exception("Error creating the ORACLE data store, check the connection parameters", e);
}
orclTransaction = new DefaultTransaction();
SYNCH.acquire();
initTables(orclDataStore, orclTransaction);
// commit the transaction
orclTransaction.commit();
}
catch (Exception e)
{
try{
orclTransaction.rollback();
} catch (Exception e1) {
if(LOGGER.isErrorEnabled()){
LOGGER.error(e1.getLocalizedMessage(),e1);
}
}
throw new Exception("Error creating tables in ORACLE", e);
}
finally
{
close(orclTransaction);
//permits to other threads to check if the tables are there or not
SYNCH.release();
}
}
/**
* Disposes the underlying GeoTools {@link DataStore} once for all.
*
*/
public void dispose(){
if(orclDataStore!=null){
try{
orclDataStore.dispose();
} catch (Exception e) {
LOGGER.trace(e.getLocalizedMessage(),e);
}
}
}
/************
* initialize the tables: create them if they do not exist
* @param tx
* @throws IOException
*/
private void initTables(DataStore ds, Transaction tx) throws Exception
{
// init of the Temp table for stats
SimpleFeatureTypeBuilder sftbTmpStats = new SimpleFeatureTypeBuilder();
sftbTmpStats.setName(STATS_TMP_TABLE);
sftbTmpStats.add("INTERSECTION_ID", String.class);
sftbTmpStats.add("SRCODE", String.class);
sftbTmpStats.add("TRGCODE", String.class);
sftbTmpStats.add("SRCLAYER", String.class);
sftbTmpStats.add("TRGLAYER", String.class);
sftbTmpStats.add("SRCAREA", String.class);
sftbTmpStats.add("TRGAREA", String.class);
sftbTmpStats.add("SRCOVLPCT", String.class);
sftbTmpStats.add("TRGOVLPCT", String.class);
sftbTmpStats.add("SRCCODENAME", String.class);
sftbTmpStats.add("TRGCODENAME", String.class);
sfTmpStats = sftbTmpStats.buildFeatureType();
// init of the permanent table for stats
SimpleFeatureTypeBuilder sftbStats = new SimpleFeatureTypeBuilder();
sftbStats.setName(STATS_TABLE);
sftbStats.add("INTERSECTION_ID", String.class);
sftbStats.add("SRCODE", String.class);
sftbStats.add("TRGCODE", String.class);
sftbStats.add("SRCLAYER", String.class);
sftbStats.add("TRGLAYER", String.class);
sftbStats.add("SRCAREA", String.class);
sftbStats.add("TRGAREA", String.class);
sftbStats.add("SRCOVLPCT", String.class);
sftbStats.add("TRGOVLPCT", String.class);
sftbStats.add("SRCCODENAME", String.class);
sftbStats.add("TRGCODENAME", String.class);
sfStats = sftbStats.buildFeatureType();
// init of the temp table for the list of geometries
SimpleFeatureTypeBuilder sftbTempGeoms = new SimpleFeatureTypeBuilder();
sftbTempGeoms.setName(SPATIAL_TMP_TABLE);
sftbTempGeoms.add("THE_GEOM", MultiPolygon.class);
sftbTempGeoms.add("INTERSECTION_ID", String.class);
sftbTempGeoms.setCRS(DefaultGeographicCRS.WGS84);
sfTmpGeom = sftbTempGeoms.buildFeatureType();
// init of the table for the list of geometries
SimpleFeatureTypeBuilder sftbGeoms = new SimpleFeatureTypeBuilder();
sftbGeoms.setName(SPATIAL_TABLE);
sftbGeoms.add("THE_GEOM", MultiPolygon.class);
sftbGeoms.add("INTERSECTION_ID", String.class);
sftbGeoms.setCRS(DefaultGeographicCRS.WGS84);
sfGeom = sftbGeoms.buildFeatureType();
// check if tables exist, if not create them
String[] listTables = ds.getTypeNames();
boolean statsTmpTableExists = false;
boolean statsTableExists = false;
boolean spatialTmpTableExists = false;
boolean spatialTableExists = false;
for (int i = 0; i < listTables.length; i++)
{
if (listTables[i].equals(STATS_TMP_TABLE))
{
statsTmpTableExists = true;
}
if (listTables[i].equals(STATS_TABLE))
{
statsTableExists = true;
}
if (listTables[i].equals(SPATIAL_TABLE))
{
spatialTableExists = true;
}
if (listTables[i].equals(SPATIAL_TMP_TABLE))
{
spatialTmpTableExists = true;
}
}
if (!statsTmpTableExists)
{
ds.createSchema(sfTmpStats);
}
if (!statsTableExists)
{
ds.createSchema(sfStats);
}
if (!spatialTableExists)
{
ds.createSchema(sfGeom);
}
if (!spatialTmpTableExists)
{
ds.createSchema(sfTmpGeom);
}
}
/***********
* delete all from temporary tables and then save intersections in them
*
* @param ds
* @param tx
* @param collection
* @param srcLayer
* @param trgLayer
* @param srcCode
* @param trgCode
* @return
* @throws Exception
*/
private void actionTemp(Transaction tx, SimpleFeatureCollection collection, String srcLayer,
String trgLayer, String srcCode, String trgCode, int itemsPerPage) throws Exception
{
//FIX ME: with synchronized don't fail any intersection
cleanTempTables(tx, SimpleFeatureCollection collection, String srcLayer,
String trgLayer, String srcCode, String trgCode, int itemsPerPage);
saveToTemp(tx, collection, srcLayer, trgLayer, srcCode, trgCode, itemsPerPage);
}
/*********
* delete all the instances of srcLayer and trgLayer from the permanent tables
* copy the intersections and the stats temporary information into the permanent tables
* @param ds
* @param tx
* @param srcLayer
* @param trgLayer
* @throws Exception
*/
private void action(Transaction tx, String srcLayer, String trgLayer, String srcCode,
String trgCode) throws Exception
{
FeatureStore featureStoreTmpData = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
FeatureStore featureStoreTmpGeom = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
featureStoreTmpData.setTransaction(tx);
featureStoreTmpGeom.setTransaction(tx);
FeatureStore featureStoreData = (FeatureStore) orclDataStore.getFeatureSource(STATS_TABLE);
FeatureStore featureStoreGeom = (FeatureStore) orclDataStore.getFeatureSource(SPATIAL_TABLE);
featureStoreData.setTransaction(tx);
featureStoreGeom.setTransaction(tx);
deleteOldInstancesFromPermanent(srcLayer, trgLayer, srcCode, trgCode, featureStoreData, featureStoreGeom);
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Saving data from permanent table.");
}
featureStoreData.addFeatures(featureStoreTmpData.getFeatures());
featureStoreGeom.addFeatures(featureStoreTmpGeom.getFeatures());
}
/*********
* delete all the information about the srcLayer and trgLayer pair from the permanent tables
* @param tx
* @param srcLayer
* @param trgLayer
* @param trgLayerCode
* @param srcLayerCode
* @param featureStoreData
* @param featureStoreGeom
* @param ds
* @throws IOException
*/
private void deleteOldInstancesFromPermanent(String srcLayer, String trgLayer,
String srcLayerCode, String trgLayerCode, FeatureStore featureStoreData, FeatureStore featureStoreGeom)
throws Exception
{
LOGGER.info("Deleting old instances of the intersection between " + srcLayer + " and " + trgLayer);
SimpleFeatureIterator iterator = null;
try
{
final FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
Filter filter1 = ff.equals(ff.property("SRCLAYER"), ff.literal(srcLayer));
Filter filter2 = ff.equals(ff.property("TRGLAYER"), ff.literal(trgLayer));
Filter filter3 = ff.equals(ff.property("SRCCODENAME"), ff.literal(srcLayerCode));
Filter filter4 = ff.equals(ff.property("TRGCODENAME"), ff.literal(trgLayerCode));
Filter filterAnd = ff.and(Arrays.asList(filter1, filter2, filter3, filter4));
iterator = (SimpleFeatureIterator) featureStoreData.getFeatures(filterAnd).features();
while (iterator.hasNext())
{
String id = (String) iterator.next().getAttribute("INTERSECTION_ID");
LOGGER.debug("Cascade delete of " + id);
Filter filter = ff.equals(ff.property("INTERSECTION_ID"), ff.literal(id));
featureStoreGeom.removeFeatures(filter);
featureStoreData.removeFeatures(filter);
}
}
catch (Exception e)
{
throw e;
}
finally
{
if (iterator != null)
{
try{
iterator.close();
}catch(Exception e){
LOGGER.error("ERROR on closing Features iterator: ", e);
}
}
}
}
/***
* close the transactions and the datastore
* @param tx
* @param ds
*/
private void close(Transaction tx)
{
if (tx != null) {
try {
tx.close();
}
catch (Exception e)
{
LOGGER.error("Exception closing the transaction", e);
}
}
}
private void cleanTempTables(Transaction tx, SimpleFeatureCollection collection, String srcLayer,
String trgLayer, String srcCode, String trgCode, int itemsPerPage) throws IOException
{
LOGGER.trace("Cleaning temp tables");
FeatureStore featureStoreData = (FeatureStore) orclDataStore.getFeatureSource(SPATIAL_TMP_TABLE);
featureStoreData.setTransaction(tx);
FeatureStore featureStoreGeom = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
featureStoreGeom.setTransaction(tx);
featureStoreData.removeFeatures(Filter.INCLUDE);
featureStoreGeom.removeFeatures(Filter.INCLUDE);
}
/*****
* perform the intersections, split the results into the two temporary tables
* @param ds
* @param tx
* @param source
* @param srcLayer
* @param trgLayer
* @param srcCode
* @param trgCode
* @return
* @throws Exception
*/
private void saveToTemp(Transaction tx, SimpleFeatureCollection source, String srcLayer,
String trgLayer, String srcCode, String trgCode, int itemsPerPage) throws Exception
{
itemsPerPage = (itemsPerPage <= 1) ? DEFAULT_PAGE_SIZE : itemsPerPage;
LOGGER.info("Saving intersections between " + srcLayer + " and " + trgLayer + " into temporary table");
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Attributes " + srcCode + " and " + trgCode);
LOGGER.debug("Items per page " + itemsPerPage);
}
FeatureStore featureStoreData = null;
FeatureStore featureStoreGeom = null;
SimpleFeatureIterator iterator = null;
try
{
if (source == null)
{
throw new Exception("Source cannot be null");
}
// initialize CRS transformation. It is performed in case source CRS is different from WGS84
CoordinateReferenceSystem sourceCRS = source.getSchema().getCoordinateReferenceSystem();
String geomName = source.getSchema().getGeometryDescriptor().getLocalName();
CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84;
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS);
iterator = source.features();
SimpleFeatureBuilder featureBuilderData = new SimpleFeatureBuilder(sfTmpStats);
SimpleFeatureBuilder featureBuilderGeom = new SimpleFeatureBuilder(sfTmpGeom);
int i = 0;
featureStoreData = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
featureStoreData.setTransaction(tx);
featureStoreGeom = (FeatureStore) orclDataStore.getFeatureSource(SPATIAL_TMP_TABLE);
featureStoreGeom.setTransaction(tx);
// this cycle is necessary to save itemsPerPage items at time
int page = 0;
if(LOGGER.isDebugEnabled()){
LOGGER.debug("PAGE : " + (page));
}
SimpleFeatureCollection sfcData = FeatureCollections.newCollection();
SimpleFeatureCollection sfcGeom = FeatureCollections.newCollection();
while (iterator.hasNext())
{
String intersectionID = srcLayer + "_" + srcCode + "_" + trgLayer + "_" + trgCode + i;
SimpleFeature sf = iterator.next();
featureBuilderData.set("SRCODE", sf.getAttribute(srcLayer + "_" + srcCode));
featureBuilderData.set("SRCLAYER", srcLayer);
featureBuilderData.set("TRGLAYER", trgLayer);
featureBuilderData.set("TRGCODE", sf.getAttribute(trgLayer + "_" + trgCode));
featureBuilderData.set("INTERSECTION_ID", intersectionID);
featureBuilderData.set("SRCCODENAME", srcCode);
featureBuilderData.set("TRGCODENAME", trgCode);
if(LOGGER.isDebugEnabled()){
LOGGER.debug("INTERSECTION_ID : " + intersectionID);
}
if (sf.getAttribute("areaA") != null)
{
featureBuilderData.set("SRCAREA", sf.getAttribute("areaA"));
}
if (sf.getAttribute("areaB") != null)
{
featureBuilderData.set("TRGAREA", sf.getAttribute("areaB"));
}
if (sf.getAttribute("percentageA") != null)
{
featureBuilderData.set("SRCOVLPCT", sf.getAttribute("percentageA"));
}
if (sf.getAttribute("percentageB") != null)
{
featureBuilderData.set("TRGOVLPCT", sf.getAttribute("percentageB"));
}
SimpleFeature sfwData = featureBuilderData.buildFeature(intersectionID);
sfcData.add(sfwData);
MultiPolygon geometry = (MultiPolygon) sf.getAttribute(geomName);
MultiPolygon targetGeometry = (MultiPolygon) JTS.transform(geometry, transform);
targetGeometry.setSRID(4326);
featureBuilderGeom.set("THE_GEOM", targetGeometry);
featureBuilderGeom.set("INTERSECTION_ID", intersectionID);
SimpleFeature sfwGeom = featureBuilderGeom.buildFeature(intersectionID);
sfcGeom.add(sfwGeom);
i++;
if ((i % itemsPerPage) == 0){
// save statistics to the statistics temporary table
featureStoreData.addFeatures(sfcData);
// save geometries to the statistics temporary table
featureStoreGeom.addFeatures(sfcGeom);
// clear
sfcData.clear();
sfcGeom.clear();
//increment page
page++;
if(LOGGER.isDebugEnabled()){
LOGGER.debug("PAGE : " + (page));
}
}
}
}
finally
{
if (iterator != null)
{
iterator.close();
}
}
}
/********************************************************************************************************************/
/**
* recall the steps from updating the database
* firstly delete all the information from temp tables
* then, perform the intersection, update temporary and finally update permanent
* @param collection
* @param srcLayer
* @param trgLayer
* @param srcCode
* @param trgCode
* @throws IOException
*/
public boolean saveAll(SimpleFeatureCollection collection, String srcLayer,
String trgLayer, String srcCode,
String trgCode, int itemsPerPage) throws Exception
{
boolean res = false;
Transaction tx = null;
try
{
tx = new DefaultTransaction();
LOGGER.trace("Performing data saving: SRCLAYER " + srcLayer + ", SRCCODE " + srcCode + ", TRGLAYER " + trgLayer + ", TRGLAYER " + trgCode);
actionTemp(tx, collection, srcLayer, trgLayer, srcCode, trgCode, itemsPerPage);
tx.commit();
res = true;
}
catch (Exception e)
{
try{
tx.rollback();
} catch (Exception e1) {
LOGGER.trace(e1.getLocalizedMessage(),e1);
}
throw new IOException("Exception during ORACLE saving. Rolling back ", e);
}
finally
{
close(tx);
}
try
{
if (res)
{
tx = new DefaultTransaction();
action(tx, srcLayer, trgLayer, srcCode, trgCode);
tx.commit();
res = true;
}
else
{
res = false;
throw new IOException("The collection cannot be null ");
}
}
catch (Exception e)
{
try{
tx.rollback();
} catch (Exception e1) {
LOGGER.trace(e1.getLocalizedMessage(),e1);
}
throw new IOException("Exception during ORACLE saving. Rolling back ", e);
}
finally
{
close(tx);
}
return res;
}
/**
* manage the delete all the information about the srcLayer and trgLayer pair from the permanent tables from a transaction
* @param srcLayer
* @param trgLayer
* @throws IOException
*/
public void deleteAll(String srcLayer, String trgLayer, String srcCode, String trgCode) throws IOException
{
Transaction orclTransaction = null;
try
{
orclTransaction = new DefaultTransaction();
FeatureStore featureStoreTmpData = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
FeatureStore featureStoreTmpGeom = (FeatureStore) orclDataStore.getFeatureSource(STATS_TMP_TABLE);
featureStoreTmpData.setTransaction(orclTransaction);
featureStoreTmpGeom.setTransaction(orclTransaction);
FeatureStore featureStoreData = (FeatureStore) orclDataStore.getFeatureSource(STATS_TABLE);
FeatureStore featureStoreGeom = (FeatureStore) orclDataStore.getFeatureSource(SPATIAL_TABLE);
featureStoreData.setTransaction(orclTransaction);
featureStoreGeom.setTransaction(orclTransaction);
deleteOldInstancesFromPermanent(srcLayer, trgLayer, srcCode, trgCode, featureStoreData,featureStoreGeom);
//commit!
orclTransaction.commit();
}
catch (Exception e)
{
try{
orclTransaction.rollback();
} catch (Exception e1) {
if(LOGGER.isInfoEnabled())
LOGGER.info(e1.getLocalizedMessage(),e1);
}
throw new IOException("Delete all raised an exception ", e);
}
finally
{
close(orclTransaction);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
aa56f2d7bc06f2b15671475429f62b6ceafc8621 | ba0f35adfd72c1726f69235d071e09928bc6e1c4 | /ivan-api/src/main/java/com/ivan/api/duboo/UserService.java | 65de40310ff19deb1c06adaf5d7bad906a0f89d9 | [] | no_license | DirBin/chat | b032667876ab7dc6f6f2827feceff795ded2e29a | 28145c19c7b134922403d964d7f4af3e2e2ad9c9 | refs/heads/master | 2020-12-30T10:49:39.264811 | 2017-07-31T07:38:02 | 2017-07-31T07:38:02 | 98,856,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 495 | java | package com.ivan.api.duboo;
import com.ivan.entity.User;
import java.util.List;
/**
* 描述:
*
* @auth mrz
* @mail 617071233@qq.com
* @create 2017/7/29 10:31
*/
public interface UserService {
int deleteByPrimaryKey(Integer id);
int insert(User record);
int insertSelective(User record);
User selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(User record);
int updateByPrimaryKey(User record);
//自定义
List<User> getUsers();
}
| [
"mengruizhi@hotmail.com"
] | mengruizhi@hotmail.com |
ec5e7480fa36958106831c79e3e1d83fb9a382c2 | 236312a8cfeb9ff6c671fe26481cb9dda30ddbd9 | /backendPro/src/main/java/com/niit/backend/dao/FriendDao.java | 803fa06816b602768b396e6be2e725f8b7e3efc5 | [] | no_license | 123poornima/UpdatedSecondProject | 74235942cd9bcbbcf8ecd6614039f4a262931b6f | 4461f7b55b5655598ff0c6eb06ffc6cfdb18829e | refs/heads/master | 2021-01-13T11:27:09.757385 | 2017-01-24T08:46:35 | 2017-01-24T08:46:35 | 77,138,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.niit.backend.dao;
import java.util.List;
import com.niit.backend.model.Friend;
import com.niit.backend.model.Job;
public interface FriendDao
{
public void addFriend(Friend friend);
List<Friend> getAllFriends(String username);
void sendFriendRequest(String from,String to);
List<Friend> getPendingRequest(String username);
void updatePendingRequest(char friendStatus,String fromId,String toId);
}
| [
"Poornima M"
] | Poornima M |
23eebabbca12c77b2c274546a18daa58ef746373 | 0e71ab06b33e7203f6659ff23acee47a5678b073 | /HW01/tester/org/mockito/internal/reporting/PrintingFriendlyInvocation.java | 519030e1d5635972f25462e37a283282ee01c124 | [
"BSD-3-Clause",
"Apache-2.0",
"MIT"
] | permissive | przrak/homework_tester | 10243be8b6d16d54cc0fc24f6d213efee3c300c8 | 9b292dc6c07abb466d6ad568931b84b6ac718401 | refs/heads/master | 2020-04-21T21:29:58.597449 | 2019-02-10T16:40:48 | 2019-02-10T16:40:48 | 169,880,768 | 0 | 0 | MIT | 2019-02-09T15:27:29 | 2019-02-09T15:27:29 | null | UTF-8 | Java | false | false | 270 | java | /*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.reporting;
public interface PrintingFriendlyInvocation {
String toString(PrintSettings printSettings);
} | [
"przrak@gmail.com"
] | przrak@gmail.com |
4b7fb23b112e2aca7516dad92f8a2e312605f666 | 4a22915c475b237eecdeeb1f407f7f47fbb87a76 | /src/br/com/fiap/test/ClientUtil.java | 553c269efa9a418e4173f42efae2096889948e0a | [] | no_license | RichelSensineli/trabalho-java-persistence | 479cbbdcbf5c2628e28b37a87c858b2615c249d3 | f3b9a749120a20decc862e64a7342f2fd7331f03 | refs/heads/master | 2023-08-05T06:16:42.152716 | 2019-07-05T01:38:42 | 2019-07-05T01:38:42 | 195,319,931 | 1 | 3 | null | 2023-07-22T10:04:05 | 2019-07-05T01:36:34 | Java | UTF-8 | Java | false | false | 3,984 | java | package br.com.fiap.test;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import br.com.fiap.entity.Cliente;
import br.com.fiap.entity.Endereco;
import br.com.fiap.entity.Pedido;
import br.com.fiap.entity.Produto;
public class ClientUtil {
public void getProdutoByIdDemo(long id) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/estoque/produto/{id}";
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
ResponseEntity<Produto> responseEntity = restTemplate.exchange(url, HttpMethod.GET, requestEntity,
Produto.class, id);
Produto produto = responseEntity.getBody();
System.out.println(produto);
}
public void getAllProdutosDemo() {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/estoque/produtos";
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
ResponseEntity<Produto[]> responseEntity = restTemplate.exchange(url, HttpMethod.GET, requestEntity,
Produto[].class);
Produto[] produtos = responseEntity.getBody();
for (Produto produto : produtos) {
System.out.println(produto);
}
}
public void addProdutoDemo(Produto objProduto) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/estoque/produto";
HttpEntity<Produto> requestEntity = new HttpEntity<Produto>(objProduto, headers);
URI uri = restTemplate.postForLocation(url, requestEntity);
System.out.println(uri.getPath());
}
public void updateProdutoDemo(Produto objProduto) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/estoque/produto";
HttpEntity<Produto> requestEntity = new HttpEntity<Produto>(objProduto, headers);
restTemplate.put(url, requestEntity);
}
public void deleteProdutoDemo(long id) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/estoque/produto/{id}";
HttpEntity<Produto> requestEntity = new HttpEntity<Produto>(headers);
restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, Void.class, id);
}
public void addClienteDemo(Cliente objCliente) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:8080/spring-app/cliente/cliente";
HttpEntity<Cliente> requestEntity = new HttpEntity<Cliente>(objCliente, headers);
URI uri = restTemplate.postForLocation(url, requestEntity);
System.out.println(uri.getPath());
}
public static void main(String args[]) {
ClientUtil util = new ClientUtil();
List<Pedido> pedidos = new ArrayList<Pedido>();
Cliente objCliente = new Cliente(1, "Richel", "richelsensineli@gmail.com", new Endereco(1, "Avenida do Estado", "01516-100", "5814", "São Paulo", "SP", "Brasil", new Cliente()), "(11) 975459892", pedidos);
// Produto objProduto = new Produto(1, "Notebook", 1.0f, 10);
util.addClienteDemo(objCliente);
// objProduto.nome = "Laranja";
// util.updateProdutoDemo(objProduto);
// util.deleteProdutoDemo(1);
// util.getProdutoByIdDemo(1);
// util.getAllProdutosDemo();
}
} | [
"richelsensineli@gmail.com"
] | richelsensineli@gmail.com |
5ab244c2de12d3b1507593e657bf65538b87c8f9 | aed778974ac3d88e634b98db318326d5bd8d96c9 | /client/src/main/java/class192.java | 7ccb6345fb009280a570c88df7528c56701225ca | [] | no_license | kyleescobar/avernic | 89bfe47cceb1286a64cb57bde31a17a39b8b8987 | f8306ae0b45d681ab4082c35ddc152d41142b032 | refs/heads/master | 2023-07-14T04:32:50.785244 | 2021-09-03T06:18:42 | 2021-09-03T06:18:42 | 400,934,182 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,187 | java | public final class class192 {
static class275 archive14;
static class275 archive2;
static int field2148;
class201 field2137;
class201 field2140;
class201 field2142;
int field2138;
int field2141;
int field2144;
int field2145;
long field2143;
class192() {
}
public static int method3313(int var0) {
int var2 = 0;
if (var0 < 0 || var0 >= 65536) {
var0 >>>= 16;
var2 += 16;
}
if (var0 >= 256) {
var0 >>>= 8;
var2 += 8;
}
if (var0 >= 16) {
var0 >>>= 4;
var2 += 4;
}
if (var0 >= 4) {
var0 >>>= 2;
var2 += 2;
}
if (var0 >= 1) {
var0 >>>= 1;
++var2;
}
return var2 + var0;
}
static final int method3314() {
if (class38.clientPreferences.field1113) {
return class285.plane;
} else {
int var1 = class123.method2216(class65.field934, class358.field4012, class285.plane);
return var1 - class337.field3924 < 800 && (class62.field901[class285.plane][class65.field934 >> 7][class358.field4012 >> 7] & 4) != 0 ? class285.plane : 3;
}
}
}
| [
"82987787+kyleescobar@users.noreply.github.com"
] | 82987787+kyleescobar@users.noreply.github.com |
5f7d9a4e4fcf07aab9af4dc0a6f8b50e3a417086 | 95d2dfaa1017bc58063acf47259d8906e941b842 | /wecloud-admin-9669/src/main/java/com/woniu/serviceadminImp/AdminServiceImp.java | 50bb1dc3de4a148e2e20bd77eb892dfa6e123789 | [] | no_license | skylishuai123/wecloud | 3049355166ce9c88bb52b8516b2041fca542a6dd | c8ed474cf46c177f85226508408b48f1e8fcb6ca | refs/heads/master | 2022-02-19T15:31:25.859103 | 2020-01-07T11:14:47 | 2020-01-07T11:14:47 | 232,308,091 | 0 | 0 | null | 2022-02-09T22:21:10 | 2020-01-07T11:13:45 | JavaScript | UTF-8 | Java | false | false | 545 | java | package com.woniu.serviceadminImp;
import com.woniu.dao.AdminDao;
import com.woniu.entity.Admin;
import com.woniu.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@Service
public class AdminServiceImp implements AdminService {
@Autowired
private AdminDao adminDao;
@Override
@Cacheable("findUser")
public Admin findUser(Admin admin) {
return adminDao.findUser(admin);
}
}
| [
"409435236@qq.com"
] | 409435236@qq.com |
43aedf0cb545f82c6fa39b3d4b7a562272caab2d | 928cfb56c2c54c96ed764d235830e7516ded23e7 | /app/src/main/java/com/projects/kevinbarassa/teachergauge/AppConfig.java | eac09634ea67262398dcd2d51adf0ad3d168567c | [] | no_license | bqevin/Hack2Teach-TeacherGauge | e448054b0b06a0527e764fd9c2d9e877c66bf534 | 5f7a71892963eab354efbb319b5688d66500c2cc | refs/heads/master | 2021-01-11T14:32:02.022104 | 2017-01-27T10:43:03 | 2017-01-27T10:43:03 | 80,154,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.projects.kevinbarassa.teachergauge;
/**
* Created by Kevin Barassa on 06-Dec-16.
*/
public class AppConfig {
// Server user login url
public static String URL_LOGIN = "http://tusemezane.or.ke/sandbox/users/login.php";
// Server user register url
public static String URL_REGISTER = "http://tusemezane.or.ke/sandbox/users/register.php";
}
| [
"kevin.barasa001@gmail.com"
] | kevin.barasa001@gmail.com |
cbabf1305c2adcd5199c0cc0a0e81dc6cd2b17b6 | 966e6efcd8c420598f4c451abaca5fd9f0370584 | /JavaRushHomeWork/JavaRushTasks/6.OldJavaRush/testJavaRush/level19/lesson05/task02/Solution.java | ab8af7f771e95d7b90a10934c634a78d1f269b2c | [] | no_license | ivshebanov/JavaRush | 7c04329a12db0970cf72b97327c0108fe9412b15 | 778463f3339a565934b04df7b0f327c4178bf0bf | refs/heads/master | 2021-06-03T14:13:29.442321 | 2021-04-20T17:31:16 | 2021-04-20T17:31:16 | 83,684,136 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,390 | java | package com.javarush.test.level19.lesson05.task02;
/* Считаем слово
Считать с консоли имя файла.
Файл содержит слова, разделенные знаками препинания.
Вывести в консоль количество слов "world", которые встречаются в файле.
Закрыть потоки. Не использовать try-with-resources
*/
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Solution {
public static void main(String[] args) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//String str = reader.readLine();
//String str = "/Users/iliashebanov/Dropbox/JAVA/JavaRushHomeWork/JavaRushHomeWork/src/com/javarush/test/level19/lesson05/task02/file";
BufferedReader readFile = new BufferedReader(new FileReader(reader.readLine()));
reader.close();
int sum = 0;
while (readFile.ready()){
String itogStr = readFile.readLine();
Pattern pattern = Pattern.compile("\\b[Ww]orld\\b[\\p{Punct}]? ?");
Matcher matcher = pattern.matcher(itogStr);
while (matcher.find()) {
sum++;
}
}
System.out.println(sum);
readFile.close();
}
}
| [
"ivshebanov@gmail.com"
] | ivshebanov@gmail.com |
799193879dee8ae655d324645a44c32d15c12e93 | c08938410551d3a6e5bc79df8a0126d9c6b43d42 | /ProjetoSD_Meta2/src/admin/model/ElectionBean.java | a9ace1261f354b9778f3362a0c5fc86e4c61fcf0 | [] | no_license | jmsmarques/SDProject | e91133f91aefadc3ce621c67af708df58188f828 | 46224de3125fc2a079967e1c3eadba8f01cd4011 | refs/heads/master | 2020-03-18T00:18:52.837803 | 2018-05-19T18:34:10 | 2018-05-19T18:34:10 | 134,086,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,912 | java | package admin.model;
import java.rmi.RemoteException;
import java.util.ArrayList;
import model.AdminBean;
public class ElectionBean extends AdminBean{
private static final long serialVersionUID = -7604531547629189812L;
String title;
String startDate;
String endDate;
String type;
String membersType;
String description;
public ElectionBean() {
super();
}
//creates election
public String getElectionCreation() {
String result;
try {
result = server.createElection(title, startDate, endDate, type, membersType, description);
} catch (RemoteException e) {
result = handleCreationException();
}
return result;
}
//removes election
public String getElectionRemoval() {
String result;
try {
result = server.removeElection(title);
} catch (RemoteException e) {
result = handleRemoveException();
}
return result;
}
//changes election
public String getElectionChange() {
String result;
try {
result = server.changeElection(title, startDate, endDate, type, membersType, description);
} catch (RemoteException e) {
result = handleChangeException();
}
return result;
}
//gets election info
public ArrayList<String> getElectionInfo() {
ArrayList<String> result = new ArrayList<String>();
try {
result = server.getElectionInfo(title);
} catch (RemoteException e) {
result = handleInfoException();
}
return result;
}
//gets all elections
public ArrayList<String> getAllElections() {
ArrayList<String> result = new ArrayList<String>();
try {
result = server.electionDetails(title);
} catch (RemoteException e) {
result = handleDetailsException();
}
return result;
}
public void setTitle(String title) {
this.title = title;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public void setType(String type) {
this.type = type;
}
public void setMembersType(String membersType) {
this.membersType = membersType;
}
public void setDescription(String description) {
this.description = description;
}
//failover protections
private String handleCreationException() {
String result;
for(int i = 0; true; i += 5000) {
try {
Thread.sleep(5000);
System.out.print(".");
lookupRMI();
result = server.createElection(title, startDate, endDate, type, membersType, description);
return result;
} catch (InterruptedException e1) {
System.out.println("Error on sleep: " + e1);
break;
} catch (RemoteException e1) {
if(i >= 30000) {
System.out.println("Lost RMI connection");
break;
}
}
}
return "Operation fail";
}
private String handleRemoveException() {
String result;
for(int i = 0; true; i += 5000) {
try {
Thread.sleep(5000);
System.out.print(".");
lookupRMI();
result = server.removeElection(title);
return result;
} catch (InterruptedException e1) {
System.out.println("Error on sleep: " + e1);
break;
} catch (RemoteException e1) {
if(i >= 30000) {
System.out.println("Lost RMI connection");
break;
}
}
}
return "Operation fail";
}
private String handleChangeException() {
String result;
for(int i = 0; true; i += 5000) {
try {
Thread.sleep(5000);
System.out.print(".");
lookupRMI();
result = server.changeElection(title, startDate, endDate, type, membersType, description);
return result;
} catch (InterruptedException e1) {
System.out.println("Error on sleep: " + e1);
break;
} catch (RemoteException e1) {
if(i >= 30000) {
System.out.println("Lost RMI connection");
break;
}
}
}
return "Operation fail";
}
private ArrayList<String> handleInfoException() {
ArrayList<String> result = new ArrayList<String>();
for(int i = 0; true; i += 5000) {
try {
Thread.sleep(5000);
System.out.print(".");
lookupRMI();
result = server.getElectionInfo(title);
return result;
} catch (InterruptedException e1) {
System.out.println("Error on sleep: " + e1);
break;
} catch (RemoteException e1) {
if(i >= 30000) {
System.out.println("Lost RMI connection");
break;
}
}
}
result.add("Operation fail");
return result;
}
private ArrayList<String> handleDetailsException() {
ArrayList<String> result = new ArrayList<String>();
for(int i = 0; true; i += 5000) {
try {
Thread.sleep(5000);
System.out.print(".");
lookupRMI();
result = server.electionDetails(title);
return result;
} catch (InterruptedException e1) {
System.out.println("Error on sleep: " + e1);
break;
} catch (RemoteException e1) {
if(i >= 30000) {
System.out.println("Lost RMI connection");
break;
}
}
}
result.add("Operation fail");
return result;
}
public String getTitle() {
return title;
}
}
| [
"jms@student.dei.uc.pt"
] | jms@student.dei.uc.pt |
18da5960458c9dd69883febbef04f1bd214be9af | 5a26c38ade76142bd84842e5a9ca0d9eae542523 | /IPC1A_Tarea5/Tarea5/src/listacircular/Listac.java | d37df29fc7fe72b14c488379f560258c39135611 | [] | no_license | saljeb91/Repositorio | bf3be8e89e37ed9bceb15d9495c8f26c5607cbb7 | d4a63607b2771252a05aa0b542d68aa33fcbc505 | refs/heads/master | 2021-01-23T18:50:30.044209 | 2015-05-09T03:02:11 | 2015-05-09T03:02:11 | 35,309,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 944 | java | package listacircular;
class Nodo{
int num;
Nodo next;
Nodo back;
public Nodo(int num){
this.num=num;
next=null;
back=null;
}
}
public class Listac {
Nodo inicio;
Nodo fin;
public Listac(){
inicio=null;
fin=null;
}
public void agregar(int num){
Nodo tmp = new Nodo(num);
tmp.num=num;
if (inicio==null){
inicio=tmp;
fin=inicio;
inicio.next=fin;
}
else{
fin.next = tmp;
tmp.next = inicio;
fin=tmp;
}
}
void visualizar(){
Nodo tmp = inicio;
if(inicio==null)
System.out.println("Esta lista esta vacia");
else{
System.out.print("[ ");
while(tmp!=null){
System.out.print(" "+tmp.num+" ");
tmp=tmp.next;
}
System.out.println(" ]");
}
}
public static void main(String[] args){
Listac listac =new Listac();
listac.agregar(10);
listac.agregar(20);
listac.agregar(30);
listac.agregar(40);
listac.visualizar();
}
} | [
"darksal201491@gmail.com"
] | darksal201491@gmail.com |
20465d8f33ae474feb2e5d2ef98c5f37ede1c23c | e455b112a11a44e17914f5177328b62c952a8fe3 | /flood-job/flood-xxl-job/flood-xxl-job-core/src/main/java/cn/flood/job/core/util/XxlJobRemotingUtil.java | 0ab19aef8c7921ed176c57d940cd99bc3ddc5305 | [
"Apache-2.0"
] | permissive | mmdai/flood-dependencies | 97035978179228efe740dc8712996a8b5188b51a | 586fa0db96dcfdd7bbdec064922f213df3250d21 | refs/heads/master | 2023-09-02T00:47:29.496481 | 2023-08-01T03:26:23 | 2023-08-01T03:26:23 | 203,513,950 | 5 | 3 | Apache-2.0 | 2023-03-01T09:04:21 | 2019-08-21T05:39:54 | Java | UTF-8 | Java | false | false | 6,057 | java | package cn.flood.job.core.util;
import cn.flood.job.core.biz.model.ReturnT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.*;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Map;
/**
* @author xuxueli 2018-11-25 00:55:31
*/
public class XxlJobRemotingUtil {
private static Logger logger = LoggerFactory.getLogger(XxlJobRemotingUtil.class);
public static final String XXL_JOB_ACCESS_TOKEN = "XXL-JOB-ACCESS-TOKEN";
// trust-https start
private static void trustAllHosts(HttpsURLConnection connection) {
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
SSLSocketFactory newFactory = sc.getSocketFactory();
connection.setSSLSocketFactory(newFactory);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
connection.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
});
}
private static final TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
}};
// trust-https end
/**
* post
*
* @param url
* @param accessToken
* @param timeout
* @param requestObj
* @param returnTargClassOfT
* @return
*/
public static ReturnT postBody(String url, String accessToken, int timeout, Object requestObj, Class returnTargClassOfT) {
HttpURLConnection connection = null;
BufferedReader bufferedReader = null;
try {
// connection
URL realUrl = new URL(url);
connection = (HttpURLConnection) realUrl.openConnection();
// trust-https
boolean useHttps = url.startsWith("https");
if (useHttps) {
HttpsURLConnection https = (HttpsURLConnection) connection;
trustAllHosts(https);
}
// connection setting
connection.setRequestMethod("POST");
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setUseCaches(false);
connection.setReadTimeout(timeout * 1000);
connection.setConnectTimeout(3 * 1000);
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
connection.setRequestProperty("Accept-Charset", "application/json;charset=UTF-8");
if(accessToken!=null && accessToken.trim().length()>0){
connection.setRequestProperty(XXL_JOB_ACCESS_TOKEN, accessToken);
}
// do connection
connection.connect();
// write requestBody
if (requestObj != null) {
String requestBody = GsonTool.toJson(requestObj);
DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream());
dataOutputStream.write(requestBody.getBytes(StandardCharsets.UTF_8));
dataOutputStream.flush();
dataOutputStream.close();
}
/*byte[] requestBodyBytes = requestBody.getBytes("UTF-8");
connection.setRequestProperty("Content-Length", String.valueOf(requestBodyBytes.length));
OutputStream outwritestream = connection.getOutputStream();
outwritestream.write(requestBodyBytes);
outwritestream.flush();
outwritestream.close();*/
// valid StatusCode
int statusCode = connection.getResponseCode();
if (statusCode != 200) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "xxl-job remoting fail, StatusCode("+ statusCode +") invalid. for url : " + url);
}
// result
bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
StringBuilder result = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
result.append(line);
}
String resultJson = result.toString();
// parse returnT
try {
ReturnT returnT = GsonTool.fromJson(resultJson, ReturnT.class, returnTargClassOfT);
return returnT;
} catch (Exception e) {
logger.error("xxl-job remoting (url="+url+") response content invalid("+ resultJson +").", e);
return new ReturnT<String>(ReturnT.FAIL_CODE, "xxl-job remoting (url="+url+") response content invalid("+ resultJson +").");
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ReturnT<String>(ReturnT.FAIL_CODE, "xxl-job remoting error("+ e.getMessage() +"), for url : " + url);
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
if (connection != null) {
connection.disconnect();
}
} catch (Exception e2) {
logger.error(e2.getMessage(), e2);
}
}
}
}
| [
"daiming123.happy@163.com"
] | daiming123.happy@163.com |
bf67239c475dcb3b0036e2c7532cdb10df321667 | f41d04ae9d2344522916e4cfb65b66dc08203132 | /src/me/broswen/binfection/utils/SpawnHandler.java | 7f5860a3b13ab253568792c538d7fd1439307d7b | [] | no_license | broswen/BInfection | 14fe26275d1be76f9a15d3c0bafa66d912ec377b | 91f577e9db5e0c49e74bc14256b199324c62bf66 | refs/heads/master | 2020-06-03T23:49:10.931356 | 2014-05-25T23:05:03 | 2014-05-25T23:05:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | package me.broswen.binfection.utils;
import me.broswen.binfection.API;
import me.broswen.binfection.BInfection;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
public class SpawnHandler {
public static void teleportToPlayerSpawn(){
for(Player player : Bukkit.getOnlinePlayers()){
if(API.isPlayer(player)){
player.teleport(BInfection.playerSpawn);
API.addToAlive(player);
API.giveAliveItems(player);
player.setGameMode(GameMode.SURVIVAL);
}
}
}
public static void teleportToLobbySpawn(){
for(Player player : Bukkit.getOnlinePlayers()){
if(API.isPlayer(player)){
player.teleport(BInfection.lobbySpawn);
player.getInventory().clear();
API.resetInventory(player);
API.resetPotions(player);
player.setGameMode(GameMode.SURVIVAL);
}
if(API.isInfected(player)){
API.removeFromInfected(player);
}
}
}
public static void teleportToInfectedSpawn(){
for(Player player : Bukkit.getOnlinePlayers()){
if(API.isPlayer(player)){
player.teleport(BInfection.infectedSpawn);
player.setGameMode(GameMode.SURVIVAL);
}
}
}
}
| [
"broswen@gmail.com"
] | broswen@gmail.com |
0ffb2733669a2b2a133abbc63a884c74523e199a | 793ca2413807c74c74f335e3a46a3b75fcc8f476 | /app/src/main/java/com/techno/batto/Adapter/MyReviewListAdapter.java | ed717fbc4c2dafde4ce571dbdebb9c1d7200f893 | [] | no_license | amabowilli/Batto | 001d9ce6b3a1a05838b7ed70d0dab3a63617cb8d | c0300cd3ca9781b556956696136e28f9771ca156 | refs/heads/master | 2020-07-08T08:48:12.250963 | 2019-08-21T18:19:23 | 2019-08-21T18:19:23 | 203,623,644 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,228 | java | package com.techno.batto.Adapter;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RatingBar;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import com.techno.batto.R;
import com.techno.batto.Result.ReviewResult;
import java.util.List;
import de.hdodenhof.circleimageview.CircleImageView;
import static com.techno.batto.Bean.MySharedPref.getData;
public class MyReviewListAdapter extends RecyclerView.Adapter<MyReviewListAdapter.ViewHolder> implements View.OnClickListener {
private Activity activity;
private View view;
private List<ReviewResult> result;
private String user_id, saler_id, request_id;
public MyReviewListAdapter(Activity activity, String user_id, List<ReviewResult> result) {
this.activity = activity;
this.result = result;
this.user_id = getData(activity, "user_id", "");
this.saler_id = user_id;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
try {
view = LayoutInflater.from(parent.getContext()).inflate(R.layout.review_list_item, parent, false);
} catch (Exception e) {
e.printStackTrace();
}
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
if (result.get(position).getUserDetails().getUserName().equalsIgnoreCase("")) {
holder.txt_username.setText(result.get(position).getUserDetails().getFirstName() + " " + result.get(position).getUserDetails().getLastName());
} else {
holder.txt_username.setText(result.get(position).getUserDetails().getUserName());
}
Picasso.with(activity).load(result.get(position).getUserDetails().getImage()).error(R.drawable.not_found).into(holder.img_user);
holder.txt_ttl.setText(result.get(position).getTitle());
holder.txt_comment.setText(result.get(position).getComment());
holder.ratingbarfeedback.setRating(Float.parseFloat(result.get(position).getRating()));
}
@Override
public int getItemCount() {
return result.size();
}
@Override
public void onClick(View view) {
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
CircleImageView img_user;
RatingBar ratingbarfeedback;
TextView txt_username, txt_ttl, txt_comment;
public ViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
img_user = itemView.findViewById(R.id.img_user);
ratingbarfeedback = itemView.findViewById(R.id.ratingbarfeedback);
txt_username = itemView.findViewById(R.id.txt_username);
txt_ttl = itemView.findViewById(R.id.txt_ttl);
txt_comment = itemView.findViewById(R.id.txt_comment);
}
@Override
public void onClick(View view) {
try {
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
| [
"amabowilli@gmail.com"
] | amabowilli@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.