blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
91c14b9ec6a73ead6572c8c9f1430805287a84d9 | 9f83f3f306bbc29410c812444ce5d3a35b678d7f | /week-01/day-3/src/DefineBasicInfo.java | df2fee4a4888af0ccac0f89f78b7cfe20ee6e764 | [] | no_license | markpalotas/starlinginferno | 18eefbb5e3a6003ee77b30709b866b7d2a77fe63 | 5d711cf49e6446facc3e9e5383e39f46acd4f028 | refs/heads/master | 2020-04-17T14:34:50.553166 | 2019-01-16T12:20:47 | 2019-01-16T12:20:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | public class DefineBasicInfo {
public static void main(String[] args) {
String name = "Lili";
int age = 26;
double height = 1.65;
boolean married = false;
}
}
| [
"liliszendrei@gmail.com"
] | liliszendrei@gmail.com |
5741916a562539a682103e510ec2b342ebcc7655 | d80156bb8e04f815f3d498ad1fc941146ebd741e | /app/src/main/java/com/huaren/logistics/myrecycleinput/IMyRecycleInputDetailView.java | d00db0bcca80fced87375c9c2f2d17ce29098945 | [] | no_license | pq27120/Logistics | aa88a4b9a6548602924cb3b67e2fe3f908f2a70a | 9cc3c4e575769f0578d793915f25c4d2961d07e9 | refs/heads/master | 2020-05-21T14:00:23.331485 | 2017-11-20T12:59:36 | 2017-11-20T12:59:36 | 49,876,773 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.huaren.logistics.myrecycleinput;
import com.dexafree.materialList.card.Card;
/**
* Created by bj on 2016/9/1.
*/
public interface IMyRecycleInputDetailView {
void addCard(Card card);
}
| [
"pq27120@126.com"
] | pq27120@126.com |
3d5567a0fad57619c3cf62b12ff7f7991215f5e1 | b69b6701de0b990f95310952e7108066bad33f1f | /.history/lesson4_20210501172301.java | e009be243f0a5ad56ef91245cd8d67d30bda2dc3 | [] | no_license | deepakadishankar/Practice | 909551bf369ed286dfde1b6c8e495bc19dc22d7e | 5725cdd6cb55ae5ff1e6b4607692ef364a3dc267 | refs/heads/master | 2023-07-27T07:26:13.783415 | 2021-09-14T07:51:18 | 2021-09-14T07:51:18 | 352,027,381 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 99 | java | public class lesson4 {
public static void main(String[] args) {
}
}
class aircarft{
} | [
"tsanthosh@Santhoshs-MacBook-Pro.local"
] | tsanthosh@Santhoshs-MacBook-Pro.local |
331ab3a201226f3f2b1e3e5244b71b94f3c7b010 | e4aea93f2988e2cf1be4f96a39f6cc3328cbbd50 | /src/com/flagleader/builder/a/bt.java | eb8b0fc1bbd2fd56450b3b1c45f995362d7dd9ce | [] | no_license | lannerate/ruleBuilder | 18116282ae55e9d56e9eb45d483520f90db4a1a6 | b5d87495990aa1988adf026366e92f7cbb579b19 | refs/heads/master | 2016-09-05T09:13:43.879603 | 2013-11-10T08:32:58 | 2013-11-10T08:32:58 | 14,231,127 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.flagleader.builder.a;
public class bt
implements bp
{
public void b()
{
}
public String a()
{
return "";
}
}
/* Location: D:\Dev_tools\ruleEngine\rbuilder.jar
* Qualified Name: com.flagleader.builder.a.bt
* JD-Core Version: 0.6.0
*/ | [
"zhanghuizaizheli@hotmail.com"
] | zhanghuizaizheli@hotmail.com |
434685153cc21320df96a777948f282356ff7d19 | aeef9545afa2b124cb7efdd8654979855ef65900 | /src/main/java/io/microservices/sellersService/controllers/SellersController.java | cfeeaeba71aa16ea99a96851b9c07380c26f59bb | [] | no_license | YoussefJAMOURE/-Microservices-Service-Sellers | 4cf6f4af99484bf805f1f5d1c19453569274ffe1 | a885d7ac1b188d3db3cfbf6d59cdc64e1b4fab68 | refs/heads/master | 2020-07-12T17:22:23.422834 | 2019-09-04T16:38:56 | 2019-09-04T16:38:56 | 204,872,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java | package io.microservices.sellersService.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.microservices.sellersService.beans.Seller;
import io.microservices.sellersService.repositories.SellersRepository;
@RestController
@RequestMapping("sellersWS")
public class SellersController {
@Autowired
SellersRepository sellersRepo;
@GetMapping(value = "/isUp")
public String isUp(){
return "Yeah it is !";
}
@GetMapping(value = "/getAll")
public List<Seller> getAllSellers(){
return sellersRepo.findAll();
}
}
| [
"y.jamoure@gmail.com"
] | y.jamoure@gmail.com |
b88451a5908c80f168452a2941f1627d296cd711 | 9019a0dda1150b6897b9140b818b8bf96a62fd92 | /trec-ndd/src/main/java/de/webis/trec_ndd/App.java | 30aec45351eb658dee7e54f0fda40cb3ed6fbf10 | [] | no_license | mam10eks/robust04-self-similarity-join | 8d7cd2dc3308e6272dc2db68b794aba7be8d8b20 | ef38ab8383fea8a50c02994d8fde28c610988e1b | refs/heads/master | 2022-07-16T18:27:12.771639 | 2021-05-12T04:25:38 | 2021-05-12T04:25:38 | 195,593,741 | 0 | 0 | null | 2022-06-22T18:38:10 | 2019-07-07T00:17:10 | Java | UTF-8 | Java | false | false | 2,358 | java | package de.webis.trec_ndd;
import java.io.IOException;
import java.util.Set;
import org.apache.http.HttpHost;
import de.webis.trec_ndd.es.ElasticSearchClient;
import de.webis.trec_ndd.similarity.TextProfileSignatureSimilarity;
import de.webis.trec_ndd.similarity.TextSimilarity;
import de.webis.trec_ndd.trec_collections.QrelReader;
import de.webis.trec_ndd.util.QueryByExampleBuilder;
public class App {
public static void main(String[] args) throws IOException {
System.out.println("Please note that you must be connected to the vpn ;)");
executeExampleReadOnlyRequestsProductionElasticsearch();
readSomeQrelFiles();
doSomeNearDuplicateDetection();
}
private static void executeExampleReadOnlyRequestsProductionElasticsearch() throws IOException {
//Attention: Our production system. Please use only read operations!
ElasticSearchClient client = productionCluewebElasticSearch();
String documentId = "340b9756-040d-5a2d-b062-d351fb7ca660";
String documentText = client.getTextOfDocument(documentId);
System.out.println("The full text of document '"+
documentId +"' is: " + documentText);
String query = QueryByExampleBuilder.esQueryByExampleWithKMedianTokens(documentText, 5);
System.out.println("I use the query '"+ query +"' to obtain near duplicates.");
System.out.println(client.getDocumentsForQuery(query, 3));
}
private static void readSomeQrelFiles() throws IOException {
String exampleQrelFile = "topics-and-qrels/qrels.web.51-100.txt";
Set<String> judgedDocumentIds = new QrelReader().readJudgedDocumentIdsFromQrelsFile(exampleQrelFile);
System.out.println("The qrel-file '"+ exampleQrelFile
+"' has the following documents with judgements: "
+ judgedDocumentIds);
}
private static void doSomeNearDuplicateDetection() {
TextSimilarity textSimilarity = new TextProfileSignatureSimilarity();
String textOfDocumentA = "Hello World";
String textOfDocumentB = "Hello World";
System.out.println("Dummy documents are near-duplicates: "
+ textSimilarity.textsAreSimilar(textOfDocumentA, textOfDocumentB)
);
}
private static ElasticSearchClient productionCluewebElasticSearch() {
String index = "webis_warc_clueweb12_011";
HttpHost productionHost = new HttpHost("betaweb120", 9200, "http");
return new ElasticSearchClient(productionHost, index);
}
}
| [
"maik.froebe@informatik.uni-halle.de"
] | maik.froebe@informatik.uni-halle.de |
1ccb4e414f22700d2372921a84d2eff4a648f080 | 22c4af186e7e90e83f25f9a4072d19d73fb1cafb | /src/main/java/com/example/controller/JsonWebToken.java | 015a68128167a2b4e186b41cacefedd2b4350287 | [] | no_license | yinshicong/jwtone | e0da658ba5bcc6d4e85a4a6aa8afc83ccde46fc5 | 8a8cbb60a83b4fccd1a01aa6379b4de1fc886e20 | refs/heads/master | 2020-03-28T10:40:47.569696 | 2018-09-10T09:47:49 | 2018-09-10T09:47:49 | 148,133,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,645 | java | package com.example.controller;
import com.example.Entity.UserInfoEntity;
import com.example.config.Audience;
import com.example.dto.AccessToken;
import com.example.dto.LoginPara;
import com.example.repositoy.IUserInfoRepository;
import com.example.util.JwtHelper;
import com.example.util.MyUtils;
import com.example.util.ResultMsg;
import com.example.util.ResultStatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
*
* JWT流程。
* https://cnodejs.org/topic/5b0c4a7b8a4f51e140d942fc
*
* Created by Administrator on 2018/8/20 0020.
*/
@RestController
public class JsonWebToken {
@Autowired
private Audience audienceEntity;
@Autowired
private IUserInfoRepository userRepositoy;
@PostMapping("oauth/token")
public Object getAccessToken(@RequestBody LoginPara loginPara)
{
ResultMsg resultMsg;
try
{
if(loginPara.getClientId() == null
|| (loginPara.getClientId().compareTo(audienceEntity.getClientId()) != 0))
{
resultMsg = new ResultMsg(ResultStatusCode.INVALID_CLIENTID.getErrcode(),
ResultStatusCode.INVALID_CLIENTID.getErrmsg(), null);
return resultMsg;
}
//验证码校验在后面章节添加
//验证用户名密码
UserInfoEntity user = userRepositoy.findUserInfoByName(loginPara.getUserName());
if (user == null)
{
resultMsg = new ResultMsg(ResultStatusCode.INVALID_PASSWORD.getErrcode(),
ResultStatusCode.INVALID_PASSWORD.getErrmsg(), null);
return resultMsg;
}
else
{
String md5Password = MyUtils.getMD5(loginPara.getPassword()+user.getSalt());
if (md5Password.compareTo(user.getPassword()) != 0)
{
resultMsg = new ResultMsg(ResultStatusCode.INVALID_PASSWORD.getErrcode(),
ResultStatusCode.INVALID_PASSWORD.getErrmsg(), null);
return resultMsg;
}
}
//拼装accessToken
String accessToken = JwtHelper.createJWT(
loginPara.getUserName(),
String.valueOf(user.getName()),
user.getRole(),
audienceEntity.getClientId(),
audienceEntity.getName(),
audienceEntity.getExpiresSecond() * 1000,
audienceEntity.getBase64Secret()
);
//返回accessToken
AccessToken accessTokenEntity = new AccessToken();
accessTokenEntity.setAccess_token(accessToken);
accessTokenEntity.setExpires_in(audienceEntity.getExpiresSecond());
accessTokenEntity.setToken_type("bearer");
resultMsg = new ResultMsg(ResultStatusCode.OK.getErrcode(),
ResultStatusCode.OK.getErrmsg(), accessTokenEntity);
return resultMsg;
}
catch(Exception ex)
{
resultMsg = new ResultMsg(ResultStatusCode.SYSTEM_ERR.getErrcode(),
ResultStatusCode.SYSTEM_ERR.getErrmsg(), null);
return resultMsg;
}
}
@GetMapping("hello")
public String hello(){
return "hello";
}
}
| [
"yinshicong@zchz.com"
] | yinshicong@zchz.com |
c65e15c66e7c7731cf480f791a84376dfa65ed9a | 53c3bc5000cef82f8244e3686649aef0b77937d3 | /NCC An Thien/quanLyKho/KhuVuc.java | ab0c76dd1fe7f09ffd872a4008bc69917a31059c | [] | no_license | toxicskrill/QuanLyKho2 | 32e1859fb238c5fce5b145ff4831c27d02854b8e | 9c3f51f690861eed8b0c5027ba9c228aefdb1c4b | refs/heads/master | 2020-03-22T15:01:44.026596 | 2018-07-09T02:57:59 | 2018-07-09T02:57:59 | 140,223,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,941 | java | package quanLyKho;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class KhuVuc {
private int id;
private String ten;
private String TrangThai;
private int DienTich;
private ArrayList<MatHang> ListMatHang;
public void setDienTich(int dienTich) {
DienTich = dienTich;
}
public void Xoa() {
try {
new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void HienThi() {
System.out.println("ID: " +id);
System.out.println("Ten: " +ten);
System.out.println("Dien Tich" +DienTich);
}
public void Nhap() {
layout hien = new layout();
Scanner Xuat = new Scanner(System.in);
hien.hien("nhap ID: ");
id=Integer.parseInt(Xuat.nextLine());
Xoa();
hien.hien("nhap Ten: ");
ten=Xuat.nextLine();
Xoa();
}
@Override
public String toString() {
// TODO Auto-generated method stub
return "khu("+"ID: "+id+" Ten: "+ten+" Dien Tich: "+DienTich+"ListMH:"+ListMatHang+')';
}
public KhuVuc() {
// TODO Auto-generated constructor stub
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTen() {
return ten;
}
public void setTen(String ten) {
this.ten = ten;
}
public int getDienTich() {
return DienTich;
}
public ArrayList<MatHang> getListMatHang() {
return ListMatHang;
}
public void setListMatHang(ArrayList<MatHang> listMatHang) {
ListMatHang = listMatHang;
}
public String getTrangThai() {
return TrangThai;
}
public void setTrangThai(String trangThai) {
TrangThai = trangThai;
}
}
| [
"nguyenhoanglong0911@gmail.com"
] | nguyenhoanglong0911@gmail.com |
17cf60e9214a2a683d069dcf99507a48802fa07d | df6f96898184729604068a013622c5a3b0833c03 | /app/src/main/java/com/rose/guojiangzhibo/fragment/TwoFragment.java | 5b9f40bcfd3b543e76e5abd0f73c475653589526 | [] | no_license | cherry98/huahua | bd0ab7bcc2b304d7f7c1f44afbaeb0aa38f6d934 | 73ce804da1f0f28f17a57b8eaed376d9d3301ddd | refs/heads/master | 2020-12-30T13:09:29.585800 | 2017-05-15T15:24:58 | 2017-05-15T15:24:58 | 91,336,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,466 | java | package com.rose.guojiangzhibo.fragment;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.rose.guojiangzhibo.R;
import com.rose.guojiangzhibo.bean.SelectionHeaderItem;
import com.rose.guojiangzhibo.bean.SelectionItem;
import com.rose.guojiangzhibo.fragment.TwoFragments.CircleFragment;
import com.rose.guojiangzhibo.fragment.TwoFragments.SelectionFragment;
import com.rose.guojiangzhibo.urlconfig.ConfigURL;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class TwoFragment extends Fragment {
private View view;
private TextView selection;
private TextView circle;
private FragmentTransaction fragmentTransaction;
private FragmentManager fragmentManager;
private ArrayList<SelectionItem> selections;
private SelectionFragment selectionFragment;
private CircleFragment circleFragment;
private ArrayList<SelectionHeaderItem> headers;
public TwoFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_two, container, false);
getListViewData();
getHeaderData();
initView(view);
return view;
}
private void initView(View view) {
fragmentManager = getFragmentManager();
fragmentTransaction = fragmentManager.beginTransaction();
selectionFragment = new SelectionFragment();
circleFragment = new CircleFragment();
fragmentTransaction.add(R.id.contentframelayout_twofrag, selectionFragment, null);
fragmentTransaction.show(selectionFragment);
fragmentTransaction.add(R.id.contentframelayout_twofrag, circleFragment, null);
fragmentTransaction.hide(circleFragment);
fragmentTransaction.commit();
selection = (TextView) view.findViewById(R.id.selectiontitle_twofragment);
circle = (TextView) view.findViewById(R.id.circletitle_twofragment);
selection.setTextColor(0xffffffff);
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
fragmentTransaction = fragmentManager.beginTransaction();
selection.setTextColor(0xffbbbbbb);
circle.setTextColor(0xffbbbbbb);
switch (v.getId()) {
case R.id.selectiontitle_twofragment:
selection.setTextColor(0xffffffff);
fragmentTransaction.show(selectionFragment);
fragmentTransaction.hide(circleFragment);
break;
case R.id.circletitle_twofragment:
circle.setTextColor(0xffffffff);
fragmentTransaction.show(circleFragment);
fragmentTransaction.hide(selectionFragment);
break;
}
fragmentTransaction.commit();
}
};
selection.setOnClickListener(onClickListener);
circle.setOnClickListener(onClickListener);
}
public void getListViewData() {
RequestParams requestParams = new RequestParams(ConfigURL.getSelcetion());
x.http().get(requestParams, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
try {
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("data");
selections = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
SelectionItem item = new SelectionItem();
item.getJSONObject(jsonArray.getJSONObject(i));
selections.add(item);
}
initListView();
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
private void initHeader(ArrayList<SelectionHeaderItem> headers) {
selectionFragment.setHeader(headers);
}
private void initListView() {
selectionFragment.setList(selections);
}
public void getHeaderData() {
final RequestParams headerString = new RequestParams(ConfigURL.getSelectionHeader());
x.http().get(headerString, new Callback.CommonCallback<String>() {
@Override
public void onSuccess(String result) {
try {
JSONObject jsonObject = new JSONObject(result);
JSONArray data = jsonObject.optJSONArray("data");
headers = new ArrayList<>();
for (int i = 0; i < data.length(); i++) {
SelectionHeaderItem selectionHeaderItem = new SelectionHeaderItem();
JSONObject object = data.optJSONObject(i);
selectionHeaderItem.getJSONObject(object);
headers.add(selectionHeaderItem);
}
initHeader(headers);
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable ex, boolean isOnCallback) {
}
@Override
public void onCancelled(CancelledException cex) {
}
@Override
public void onFinished() {
}
});
}
}
| [
"cherry18515@163.com"
] | cherry18515@163.com |
48bd7d76d328fcf96f7b5928d7d5864c66c455a6 | b6ef786c51d33c6df3de5487b5af2cd7fea1afdf | /Client/ClientApp.java | dd92dea364c6469a0a3664f1aa9dfb5532df93d3 | [] | no_license | AnitaRezaee/CourseRegistration | 9de581a9714fdb341aea1060f66757012a32af60 | 72d6bb062a99f93320883ac3c3af36685b672b27 | refs/heads/master | 2023-03-04T02:31:26.409982 | 2021-02-15T22:16:34 | 2021-02-15T22:16:34 | 339,216,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java |
public class ClientApp {
public static void main(String[] args) {
CommunicationController commCtrl = new CommunicationController("localhost", 8099);
LoginGUI loginView = new LoginGUI(400, 170);
LoginGUIController loginController = new LoginGUIController(loginView, commCtrl);
}
}
| [
"anita.anzabee@gmail.com"
] | anita.anzabee@gmail.com |
a162974fb10f458e1af0040b59b993ab02708388 | f3a4782a5066fe87e29044ddf6a43eacb710876b | /852.Peak_Index_in_a_Mountain_Array/solution.java | 1da19978e8eda5f631d4c8b59f51dac5aa6abb5c | [] | no_license | Xintong-Wang/Leetcode | 1c530a06f033ad567cea06a479a3c6608c1069b5 | b604d7031828fc9bf34baa8eff8f7b59a3f22f9a | refs/heads/master | 2022-04-12T20:35:05.922199 | 2020-03-22T04:57:21 | 2020-03-22T04:57:21 | 197,919,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | class Solution {
public int peakIndexInMountainArray(int[] A) {
if(A.length < 3)
return 0;
for(int i = 1; i < A.length; i++){
if(A[i - 1] > A[i])
return i - 1;
}
return 0;
}
}
| [
"xintongwang0710@gmail.com"
] | xintongwang0710@gmail.com |
08cf6d88d207cbbbe008775308dd7c59bfb9416f | fb676f57d00b7bed6f57b0fcb340e19bd0231bf6 | /src/main/java/domain/CampaignName.java | fa1a220750ba796c2ab818fe9276b805dbf190ee | [] | no_license | jammazwan/xbo_BareBonesCamelMicroService | 984bd527281b9e3d4cc61608cd8b939037f2fc79 | 240138e772df7fa724b40404b857006748f2c937 | refs/heads/master | 2021-01-09T20:29:09.220626 | 2017-02-02T01:52:29 | 2017-02-02T01:52:29 | 63,264,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | package domain;
public class CampaignName {
public String campaignKey;
public CampaignName() {
super();
}
@Override
public String toString() {
return "CampaignName [campaignKey=" + campaignKey + "]";
}
}
| [
"pete@couldbe.net"
] | pete@couldbe.net |
d775f8d7d0531248968135720fe7b8f99b38acea | 25e1bad480f2352be09f78038c5ec15a8aff391e | /DMServer/src/teamHarambe/Server.java | 01532d2125728a81b6b12f3c830584dd89826a82 | [] | no_license | cleikness/DM_GitHub | d3c0af8208282b9ec0362735b9dde66ea1d95b86 | 6ab5403093dc9d6513e45554b2ba895fe5bf0cd8 | refs/heads/master | 2021-01-12T16:14:22.724063 | 2016-10-25T19:15:15 | 2016-10-25T19:15:15 | 71,953,894 | 0 | 0 | null | 2016-10-26T01:30:35 | 2016-10-26T01:30:34 | null | UTF-8 | Java | false | false | 4,213 | java | package teamHarambe;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
import java.util.Calendar;
import org.json.JSONObject;
public class Server {
static List<Team> teams = new LinkedList<>();
static Scanner console = new Scanner(System.in);
static Schedule schedule;
public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(1234);
JSONObject database = getDatabase();
System.out.println("Server ready to accept clients.");
while (true) {
Socket s = server.accept();
Runnable connectionHandler = new ConnectionHandler(s, database);
new Thread(connectionHandler).start();
}
}
private static JSONObject getDatabase() throws IOException {
File dbFile = new File("resources/Database.json");
if (!dbFile.exists()) {
dbFile.createNewFile();
System.out.println("Welcome to first time setup!");
String password = promptInitialPassword();
System.out.println("How many teams will play in the debate season?");
int numTeams = promptInt(2);
promptTeams(numTeams);
System.out.println("How many referees will manage the season?");
int numReferees = promptInt(numTeams/2);
List<Referee> referees = generateRefereeList(numReferees);
System.out.println("Enter the season start date.");
Calendar startDate = promptDate();
schedule = new Schedule(teams, referees);
String filePath = dbFile.getPath();
String dbString = "{\n \"Schedule\": "+ schedule.toJSON() + "\n}";
PrintWriter writer = new PrintWriter(filePath, "UTF-8");
writer.println(dbString);
writer.close();
}
return new JSONObject(readFile("resources/Database.json", StandardCharsets.UTF_8));
}
private static int promptInt(int minValue) {
int input = 0;
do {
try {
input = console.nextInt();
if (input < minValue) {
System.out.print("Please input an integer >= " + minValue + ": ");
}
}
catch (NumberFormatException e) {
System.out.print("Please input an integer >= " + minValue + ": ");
}
} while (input < minValue);
return input;
}
private static void promptTeams(int numTeams) {
System.out.println("Please enter " + numTeams + " team names.");
for (int i = 0; i < numTeams; i++) {
System.out.print((i + 1) + ". ");
teams.add(new Team(console.next()));
}
}
private static Calendar promptDate() {
Calendar selectedDate = Calendar.getInstance();//shitty Java library
int selectedYear, selectedMonth, selectedDay;
int currentYear = selectedDate.get(Calendar.YEAR);
int currentMonth = selectedDate.get(Calendar.MONTH);
int currentDay = selectedDate.get(Calendar.DAY_OF_MONTH);
System.out.print("Enter the season start year: ");
selectedYear = promptInt(currentYear);
System.out.print("Enter the season start month: ");
selectedMonth = promptInt(selectedYear == currentYear ? currentMonth+1 : 1)-1;
System.out.print("Enter the season start day: ");
selectedDay = promptInt(selectedYear == currentYear && selectedMonth == currentMonth ? currentDay : 1);
selectedDate.set(selectedYear, selectedMonth, selectedDay);
return selectedDate;
}
private static String promptInitialPassword() {
String password;
System.out.print("Please create a password: ");
password = console.nextLine();
System.out.println("Your password is " + password);
return password;
}
private static List<Referee> generateRefereeList(int numReferees) {
List<Referee> referees = new LinkedList<>();
Random r = new Random();
for (int i=0; i < numReferees; i ++) {
referees.add(new Referee(r.nextInt(999999999) + 111111111, i==0));
}
return referees;
}
private static String readFile(String path, Charset encoding) throws IOException {
byte[] encoded = Files.readAllBytes(Paths.get(path));
return new String(encoded, encoding);
}
}
| [
"dwarwick96@gmail.com"
] | dwarwick96@gmail.com |
aa5e933ae6d2756571816bb21f803d684bd0883a | 9dd072444f1bea8e7c9247a2964af786f554c264 | /Phone/app/src/main/java/com/example/lance_3770/phone/phonedialer.java | 76214f6c1bd20b24fb5a617bb8e93e87911abe23 | [] | no_license | fangj99/AndroidStudioProjects | d51530c8cb32dfd65c83bdc9749dc2893fa1375f | 137373a7be47fb85498cc45080ba4a076d2f898d | refs/heads/master | 2021-01-17T11:14:00.461341 | 2016-03-25T07:05:56 | 2016-03-25T07:05:56 | 41,685,465 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,037 | java | package com.example.lance_3770.phone;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class phonedialer extends Activity {
/*lance changed*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_phonedialer);
Button button = (Button) this.findViewById(R.id.button);
button.setOnClickListener(new ButtonClickListener());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_phonedialer, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/*lance changed*/
private final class ButtonClickListener implements View.OnClickListener {
public void onClick(View v){
EditText mobileText = (EditText) findViewById(R.id.mobile);
String number = mobileText.getText().toString();
Intent intent= new Intent();
intent.setAction("android.intent.action.CALL");
intent.addCategory("android.intent.category.DEFAULT");
intent.setData (Uri.parse("tel:" + number));
startActivity (intent);// 可以不用intent.addCategory("android.intent.category.DEFAULT"); 自动添加
}
}
}
| [
"fangj99@gmail.com"
] | fangj99@gmail.com |
c0c21d2dab04486aa9d8727d28bf62445f127b64 | 76dc3f3a7226fca163ec234ab5643a2fb1b90700 | /reto3/src/main/java/tienda_disfraces/reto3/controlador/DisfrazControlador.java | 3ca59033d87de196427dad3bf3ef88f0162bc578 | [] | no_license | aacunam/Reto3 | d466939161a43e8031c372a2c9246fb6b5727195 | 7053f35f3a384eb0baa4ef047742a1a0bb01fd5f | refs/heads/master | 2023-08-31T20:27:56.551228 | 2021-10-31T04:17:56 | 2021-10-31T04:17:56 | 422,994,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | package tienda_disfraces.reto3.controlador;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import tienda_disfraces.reto3.modelo.Costume;
import tienda_disfraces.reto3.servicios.DisfrazServicios;
@RestController
@RequestMapping("/api/Costume")
@CrossOrigin(origins = "*", methods = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT,
RequestMethod.DELETE })
public class DisfrazControlador {
@Autowired
private DisfrazServicios disfrazServicios;
@GetMapping("/all")
public List<Costume> getDisfraz() {
return disfrazServicios.getAll();
}
@GetMapping("/{id}")
public Optional<Costume> getDisfraz(@PathVariable("id") int id) {
return disfrazServicios.getDisfraz(id);
}
@PostMapping("/save")
@ResponseStatus(HttpStatus.CREATED)
public Costume save(@RequestBody Costume disfraz) {
return disfrazServicios.save(disfraz);
}
@PutMapping("/update")
@ResponseStatus(HttpStatus.CREATED)
public Costume update(@RequestBody Costume disfraz) {
return disfrazServicios.update(disfraz);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public boolean deletePapeleria(@PathVariable("id") int id) {
return disfrazServicios.deleteDisfraz(id);
}
}
| [
"armando.acuna.mt@correo.usa.edu.co"
] | armando.acuna.mt@correo.usa.edu.co |
7f58a5bd23ca5da4a4407b09b2e7dbff7bc1ac78 | 2e15cf72332dea0fa1916a626b00983d802ec5d6 | /src/model/Mail.java | 9dfebe01f9421c60a649f617aa6a427e3208fc08 | [] | no_license | jorvesan96/Kata4 | 9df870a0a7c425cb2e7f2dc2716d7343917ef9e4 | 8b4e05e0c99049b4dab8f4876cbc222450cf65ad | refs/heads/master | 2021-12-03T00:05:08.794799 | 2021-11-04T15:02:23 | 2021-11-04T15:04:56 | 221,471,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package model;
public class Mail {
private final String mail;
public Mail(String mail) {
this.mail = mail;
}
public String getEmail(){return mail;}
public String getDomain(){
try{
String[] domain = this.mail.split("@");
return domain[1];
}catch(Exception e){
return "";
}
}
}
| [
"jorve@DESKTOP-5E2NNK5"
] | jorve@DESKTOP-5E2NNK5 |
043d60d4b2af48d73909e3334e5ba03e3612c1f7 | 77fb90c41fd2844cc4350400d786df99e14fa4ca | /com/coremedia/iso/boxes/TitleBox.java | 926251eadcfdaee6df93a8a470309ca24eb3d064 | [] | no_license | highnes7/umaang_decompiled | 341193b25351188d69b4413ebe7f0cde6525c8fb | bcfd90dffe81db012599278928cdcc6207632c56 | refs/heads/master | 2020-06-19T07:47:18.630455 | 2019-07-12T17:16:13 | 2019-07-12T17:16:13 | 196,615,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,295 | java | package com.coremedia.iso.boxes;
import f.h.a.MimeMessage;
import f.slide.asm.ByteBufferList;
import f.slide.asm.Label;
import org.aspectj.lang.JoinPoint;
public class TitleBox
extends MimeMessage
{
public static final String TYPE = "titl";
public String language;
public String title;
static {}
public TitleBox()
{
super("titl");
}
public void _parseDetails(java.nio.ByteBuffer paramByteBuffer)
{
parseVersionAndFlags(paramByteBuffer);
language = ByteBufferList.nextToken(paramByteBuffer);
title = ByteBufferList.readString(paramByteBuffer);
}
public void getContent(java.nio.ByteBuffer paramByteBuffer)
{
writeVersionAndFlags(paramByteBuffer);
Label.add(paramByteBuffer, language);
paramByteBuffer.put(f.slide.asm.ByteBuffer.append(title));
paramByteBuffer.put((byte)0);
}
public long getContentSize()
{
return f.slide.asm.ByteBuffer.convert(title) + 7;
}
public String getLanguage()
{
JoinPoint localJoinPoint = org.aspectj.runtime.reflect.Factory.makeJP(ajc$tjp_0, this, this);
f.h.a.Factory.aspectOf().before(localJoinPoint);
return language;
}
public String getTitle()
{
JoinPoint localJoinPoint = org.aspectj.runtime.reflect.Factory.makeJP(ajc$tjp_1, this, this);
f.h.a.Factory.aspectOf().before(localJoinPoint);
return title;
}
public void setLanguage(String paramString)
{
JoinPoint localJoinPoint = org.aspectj.runtime.reflect.Factory.makeJP(ajc$tjp_2, this, this, paramString);
f.h.a.Factory.aspectOf().before(localJoinPoint);
language = paramString;
}
public void setTitle(String paramString)
{
JoinPoint localJoinPoint = org.aspectj.runtime.reflect.Factory.makeJP(ajc$tjp_3, this, this, paramString);
f.h.a.Factory.aspectOf().before(localJoinPoint);
title = paramString;
}
public String toString()
{
StringBuilder localStringBuilder = f.sufficientlysecure.rootcommands.util.StringBuilder.getTag(org.aspectj.runtime.reflect.Factory.makeJP(ajc$tjp_4, this, this), "TitleBox[language=");
localStringBuilder.append(getLanguage());
localStringBuilder.append(";title=");
localStringBuilder.append(getTitle());
localStringBuilder.append("]");
return localStringBuilder.toString();
}
}
| [
"highnes.7@gmail.com"
] | highnes.7@gmail.com |
f9e719f69f53830c9057405f50fe574273aa9396 | 62d620ee3370f874236cbf921b37e16257f593cf | /CSE214/src/ApplicantNotFoundException.java | 2dd417bc72d9b82a56980846c9bba1e98440ca17 | [] | no_license | Tamaarine/CSE214-Storage-File | 3cfe2504ef3ed51315d6fea9b7d3a39ea35bd788 | 407b895548fa4ca5d604232ea874fb9f13c29b92 | refs/heads/master | 2022-11-28T12:18:30.836158 | 2019-12-26T19:11:23 | 2019-12-26T19:11:23 | 212,611,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | /**
* The ApplicantNotFoundException class is meant to be a custom Exception class
* that reports the exception of the Applicant not being found when searching through
* the HiringTable
*
* @author Ricky Lu
* email: ricky.lu@stonybrook.edu
* Stony Brook ID: 112829937
* Recitation: Wednesday 11:00AM - 11:53Am
*/
public class ApplicantNotFoundException extends Exception
{
/**
* Constructor of the ApplicantNotFoundException, it takes the a input of a
* msg that is printed when the exception is evoked
*
* @param msg
* The message to display to the user when the exception is called
*/
public ApplicantNotFoundException(String msg)
{
super(msg);
}
} | [
"irebootplaygt@gmail.com"
] | irebootplaygt@gmail.com |
a9dc917a837845728d9bf39e78e40cfcc2170881 | c4eec416ae4678d6346b09bf28a1700f20f1b7d6 | /assignment.queryreport.rest/src/main/java/nl/lunatech/assignment/queryreport/rest/util/QueryReportSQL.java | 0323c3c49be3d2175ed0713e24967fbde60f69a3 | [] | no_license | ArkiTheDeveloper/workspace | d1d8acb1fbfda3761dc99b090cb6a2302ae19534 | 2f6deb2fb1de3a6397db87ed7d22592fa481fa0c | refs/heads/master | 2020-03-21T03:45:04.162039 | 2018-06-20T13:20:54 | 2018-06-20T13:20:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,690 | java | package nl.lunatech.assignment.queryreport.rest.util;
/**
* Utility Class with SQLs
*
*/
public class QueryReportSQL {
public static final String GET_COUNTRY_DETAILS_FOR_COUNTRY_NAME="SELECT C.ID, C.NAME, C.CODE, A.ID, A.NAME, A.IDENT, A.ISO_COUNTRY, R.ID, R.SURFACE, R.LENGTH_FT, " +
"R.WIDTH_FT, R.AIRPORT_REF, R.AIRPORT_IDENT FROM ((COUNTRY C INNER JOIN AIRPORT A ON C.CODE = A.ISO_COUNTRY) " +
"INNER JOIN RUNWAY R ON A.ID = R.AIRPORT_REF) WHERE UPPER(C.NAME) LIKE upper('%?%')";
public static final String GET_COUNTRY_DETAILS_FOR_COUNTRY_CODE="SELECT C.ID, C.NAME, C.CODE, A.ID, A.NAME, A.IDENT, A.ISO_COUNTRY, R.ID, R.SURFACE, R.LENGTH_FT, " +
"R.WIDTH_FT, R.AIRPORT_REF, R.AIRPORT_IDENT FROM ((COUNTRY C INNER JOIN AIRPORT A ON C.CODE = A.ISO_COUNTRY) " +
"INNER JOIN RUNWAY R ON A.ID = R.AIRPORT_REF) WHERE UPPER(C.CODE) LIKE upper('%?%')";
public static final String GET_COUNTRY_WITH_HIGHEST_AIRPORTS="SELECT DISTINCT(A.ISO_COUNTRY), COUNT(A.ISO_COUNTRY) FROM AIRPORT A group BY A.ISO_COUNTRY ORDER BY COUNT(A.ISO_COUNTRY) DESC";
public static final String GET_COUNTRY_WITH_LOWEST_AIRPORTS="SELECT DISTINCT(A.ISO_COUNTRY), COUNT(A.ISO_COUNTRY) FROM AIRPORT A group BY A.ISO_COUNTRY ORDER BY COUNT(A.ISO_COUNTRY) ASC";
public static final String GET_RUNWAY_TYPE_FOR_ALL_COUNTRIES="SELECT C.NAME, R.SURFACE FROM ((COUNTRY C INNER JOIN AIRPORT A ON C.CODE = A.ISO_COUNTRY) " +
"INNER JOIN RUNWAY R ON A.ID = R.AIRPORT_REF) GROUP BY C.NAME, R.SURFACE";
public static final String GET_HIGHEST_USED_RUNWAY_IDENT="SELECT R.LE_IDENT, COUNT(R.LE_IDENT) FROM RUNWAY R GROUP BY R.LE_IDENT ORDER BY COUNT(R.LE_IDENT) DESC";
}
| [
"asthaparashar05@gmail.com"
] | asthaparashar05@gmail.com |
52e1e80476c8646b0f28465e8bac1a000d39cb99 | 2055c9c3c6531511d29a3ad7ab8f2ad1785ccc8a | /python.django/src/org/netbeans/modules/python/django/project/ui/wizards/DjangoApplicationWizardPanel1.java | 2b350d67586b8d51d9c854d77f8a18d5bc2d8710 | [] | no_license | Seha16/netbeans-django | 30534cbdc7bbbd5dd82b6e5523a853ee102bee62 | 24c9c359740a9d945afca9214a2606b185f994c1 | refs/heads/master | 2020-05-28T07:42:30.130567 | 2009-03-04T09:21:53 | 2009-03-04T09:21:53 | 40,284,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,789 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.netbeans.modules.python.django.project.ui.wizards;
import java.awt.Component;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
public class DjangoApplicationWizardPanel1 implements WizardDescriptor.Panel {
/**
* The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent().
*/
private Component component;
// Get the visual component for the panel. In this template, the component
// is kept separate. This can be more efficient: if the wizard is created
// but never displayed, or not all panels are displayed, it is better to
// create only those which really need to be visible.
public Component getComponent() {
if (component == null) {
component = new DjangoApplicationVisualPanel1();
}
return component;
}
public HelpCtx getHelp() {
// Show no Help button for this panel:
return HelpCtx.DEFAULT_HELP;
// If you have context help:
// return new HelpCtx(SampleWizardPanel1.class);
}
public boolean isValid() {
// If it is always OK to press Next or Finish, then:
return true;
// If it depends on some condition (form filled out...), then:
// return someCondition();
// and when this condition changes (last form field filled in...) then:
// fireChangeEvent();
// and uncomment the complicated stuff below.
}
public final void addChangeListener(ChangeListener l) {
}
public final void removeChangeListener(ChangeListener l) {
}
/*
private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
public final void addChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.add(l);
}
}
public final void removeChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.remove(l);
}
}
protected final void fireChangeEvent() {
Iterator<ChangeListener> it;
synchronized (listeners) {
it = new HashSet<ChangeListener>(listeners).iterator();
}
ChangeEvent ev = new ChangeEvent(this);
while (it.hasNext()) {
it.next().stateChanged(ev);
}
}
*/
// You can use a settings object to keep track of state. Normally the
// settings object will be the WizardDescriptor, so you can use
// WizardDescriptor.getProperty & putProperty to store information entered
// by the user.
public void readSettings(Object settings) {
}
public void storeSettings(Object settings) {
}
}
| [
"alberto.paro@53ee0c52-ff2b-11dd-9d1d-173cc1d06e3c"
] | alberto.paro@53ee0c52-ff2b-11dd-9d1d-173cc1d06e3c |
925ab2104fb6e893e7fd63c54352fafdb2548389 | 66cbc16fbbf8d66854052d4ef05fb6680d783e20 | /daogenerator/src/main/java/com/example/Daogenerator.java | d9b0e355fbe1597909c73c40efee8f1e9ef378c3 | [] | no_license | zhangqingdev/new_lsj | 2d6fc1d06831b2fd311fb7b75659ad5b792bb5be | b42d771d566ae96f469a5a5ec103333f4cda4862 | refs/heads/master | 2021-01-22T19:59:11.428252 | 2017-04-06T10:32:13 | 2017-04-06T10:32:13 | 85,265,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.example;
import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;
public class Daogenerator {
public static void main(String[] args) throws Exception {
int version = 1;
String defaultJavaPackage = "com.oushangfeng.ounews.greendao";
Schema schema = new Schema(version, defaultJavaPackage);
addTable(schema);
// /表示根目录, ./表示当前路径, ../表示上一级父目录
new DaoGenerator().generateAll(schema, "./app/src/main/java-gen");
}
private static void addTable(Schema schema) {
Entity note = schema.addEntity("NewsChannelTable");
// note.addIdProperty();
/**
* 频道名称
*/
note.addStringProperty("newsChannelName").notNull().primaryKey().index();
/**
* 频道id
*/
note.addStringProperty("newsChannelId").notNull();
/**
* 频道类型
*/
note.addStringProperty("newsChannelType").notNull();
/**
* 选中的频道
*/
note.addBooleanProperty("newsChannelSelect").notNull();
/**
* 频道的排序位置
*/
note.addIntProperty("newsChannelIndex").notNull();
/**
* 频道是否是固定的
*/
note.addBooleanProperty("newsChannelFixed");
}
}
| [
"qing.zhang@dianjoy.com"
] | qing.zhang@dianjoy.com |
381ba1890023d84c2b51dff933f68292a7fe8f0d | fbee421a0dded774dfdc20c67b33a02e9d24c366 | /pet-clinic-data/src/main/java/com/example/model/PetType.java | 3d1fd3d6565a0c3a9f441124d18c621fe3104484 | [] | no_license | freana86/sfg-pet-clinic | b9297e6c79d31f4310a1ff7fe4ae6559e0dea1ed | eb840863f6ae17160b4452cc636925e796b92f9c | refs/heads/master | 2020-05-22T13:54:23.431299 | 2019-07-12T18:54:17 | 2019-07-12T18:54:17 | 186,369,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.example.model;
public class PetType extends BaseEntity {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"fredrik.f.andersson@lm.se"
] | fredrik.f.andersson@lm.se |
f28b0c8f32b2a0193f6661e5e1ac62c006e372c2 | 5a89a92f2fc4d0fc9e60dbe0fe50a85b212b5ee8 | /Lesson02-GitHub-Repo-Search/T02.04-Exercise-ConnectingToTheInternet/app/src/main/java/com/example/android/datafrominternet/MainActivity.java | b2b3914862ab67f30f82ff59351b5650edfe2fd1 | [
"Apache-2.0"
] | permissive | floydkots/favorite-toys | 294f8f5674ef8b96fecbd813745e007c5515b2d9 | 90c2caba050819bdc28a56b02bb4a417078fdcf0 | refs/heads/master | 2020-03-19T14:14:01.355528 | 2018-06-14T13:09:01 | 2018-06-14T13:09:01 | 136,614,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,023 | java | /*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.datafrominternet;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import com.example.android.datafrominternet.utilities.NetworkUtils;
import java.io.IOException;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
private EditText mSearchBoxEditText;
private TextView mUrlDisplayTextView;
private TextView mSearchResultsTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSearchBoxEditText = (EditText) findViewById(R.id.et_search_box);
mUrlDisplayTextView = (TextView) findViewById(R.id.tv_url_display);
mSearchResultsTextView = (TextView) findViewById(R.id.tv_github_search_results_json);
}
/**
* This method retrieves the search text from the EditText, constructs
* the URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays
* that URL in a TextView, and finally fires off an AsyncTask to perform the GET request using
* our (not yet created) {@link GithubQueryTask}
*/
private void makeGithubSearchQuery() {
String githubQuery = mSearchBoxEditText.getText().toString();
URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery);
mUrlDisplayTextView.setText(githubSearchUrl.toString());
// TODO (2) Call getResponseFromHttpUrl and display the results in mSearchResultsTextView
// TODO (3) Surround the call to getResponseFromHttpUrl with a try / catch block to catch an IOException
try {
String results = NetworkUtils.getResponseFromHttpUrl(githubSearchUrl);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int itemThatWasClickedId = item.getItemId();
if (itemThatWasClickedId == R.id.action_search) {
makeGithubSearchQuery();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"floydkotohoyoh@gmail.com"
] | floydkotohoyoh@gmail.com |
32ac5a04ce449408bbbed6cb78917d4929cbf65d | 432bde2a0e2672eb1bb5e12b6c27aea76f26f64f | /src/main/java/cn/movie/utils/DBUtil.java | ff662baf070a15f79089d19b01be340c00e2ed09 | [] | no_license | tanbinh123/moviedesign | 317859ea333ee98c37cf1ba12340f1dfc86cf7fa | cd5e697482b57f5e728e59bef66e9bc280e31eb6 | refs/heads/master | 2023-03-19T15:04:49.043701 | 2018-08-28T07:50:25 | 2018-08-28T07:50:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package cn.movie.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBUtil {
private static final String DRIVER ="com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost:3306/data_movie?characterEncoding=UTF-8";
private static final String USER="root";
private static final String PASSWORD="123456";
private static Connection connection;
public static Connection getConnection(){
try{
Class.forName(DRIVER);
connection = DriverManager.getConnection(URL,USER,PASSWORD);
}catch(ClassNotFoundException e){
e.printStackTrace();
}catch(SQLException e){
e.printStackTrace();
}
return connection;
}
}
| [
"raotq25156@hs.handsome.com.cn"
] | raotq25156@hs.handsome.com.cn |
8fcc945b90f060f35ba9c589d1d470d80353dec0 | daef55c1cb336fe3c82d71e36f62a4934c2f3e0f | /it.ismb.pert.pwal.core.smartcity.api/src/main/java/it/ismb/pertlab/smartcity/api/Quarter.java | 724fb3eec2ff3a39f3e507cd37dc6f95aa599be2 | [
"Apache-2.0"
] | permissive | almanacproject/scral | 9e13aff8b41d7bab426e826d46f8b0ed337794e2 | b4771e8464ea7f3962bdc342b3a71dbd3e71c924 | refs/heads/master | 2021-01-11T06:20:12.676724 | 2016-10-06T13:34:58 | 2016-10-06T13:34:58 | 70,152,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,715 | java | /*
* SmartCityAPI - core
*
* Copyright (c) 2014 Dario Bonino
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package it.ismb.pertlab.smartcity.api;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author <a href="mailto:dario.bonino@gmail.com">Dario Bonino</a>
*
*/
public class Quarter
{
// The quarter name
private String name;
// the quarter url
private String url;
// The quarter human-readable description
private String description;
// the city name
private SmartCity city;
// the district name
private District district;
// the set of waste production data, per year and genre
private Set<WasteProduction> wasteProduction;
// the quarter boundary
private GeoBoundary boundary;
// the waste bins located in the quarter
public Set<WasteBin> bins;
/**
*
*/
public Quarter()
{
// initialize inner data structures
this.wasteProduction = new HashSet<WasteProduction>();
this.bins = new HashSet<WasteBin>();
}
public Quarter(String name)
{
// store the name
this.setName(name);
// initialize inner data structures
this.wasteProduction = new HashSet<WasteProduction>();
this.bins = new HashSet<WasteBin>();
}
/**
* @return the name
*/
public String getName()
{
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name)
{
this.name = name;
}
/**
* @return the city
*/
public SmartCity getCity()
{
return city;
}
/**
* @param city
* the city to set
*/
public void setCity(SmartCity city)
{
this.city = city;
}
/**
* @return the district
*/
public District getDistrict()
{
return district;
}
/**
* @param district the district to set
*/
public void setDistrict(District district)
{
this.district = district;
}
/**
* @return the wasteProduction
*/
public Set<WasteProduction> getWasteProduction()
{
return wasteProduction;
}
/**
* @param wasteProduction
* the wasteProduction to set
*/
public void setWasteProduction(Set<WasteProduction> wasteProduction)
{
this.wasteProduction = wasteProduction;
}
public void addWasteProduction(WasteProduction wasteProduction)
{
this.wasteProduction.add(wasteProduction);
}
/**
* @return the boundary
*/
public GeoBoundary getBoundary()
{
return boundary;
}
/**
* @param boundary
* the boundary to set
*/
public void setBoundary(GeoBoundary boundary)
{
this.boundary = boundary;
}
/**
* @return the bins
*/
public Set<WasteBin> getBins()
{
return bins;
}
/**
* @param bins
* the bins to set
*/
public void setBins(Set<WasteBin> bins)
{
this.bins = bins;
}
public void addBin(WasteBin bin)
{
this.bins.add(bin);
}
/**
* @return the description
*/
public String getDescription()
{
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* @return the url
*/
public String getUrl()
{
return url;
}
/**
* @param url the url to set
*/
public void setUrl(String url)
{
this.url = url;
}
} | [
"dario.bonino@gmail.com"
] | dario.bonino@gmail.com |
d2a2f1c031af068b2b9702c4888963734f89bb90 | 12563229bd1c69d26900d4a2ea34fe4c64c33b7e | /nan21.dnet.module.ad/nan21.dnet.module.ad.presenter/src/main/java/net/nan21/dnet/module/ad/workflow/ds/model/WfDefNodeFieldDs.java | d0d2034848377876d2661bf080afb22e73d5f875 | [] | no_license | nan21/nan21.dnet.modules | 90b002c6847aa491c54bd38f163ba40a745a5060 | 83e5f02498db49e3d28f92bd8216fba5d186dd27 | refs/heads/master | 2023-03-15T16:22:57.059953 | 2012-08-01T07:36:57 | 2012-08-01T07:36:57 | 1,918,395 | 0 | 1 | null | 2012-07-24T03:23:00 | 2011-06-19T05:56:03 | Java | UTF-8 | Java | false | false | 1,582 | java | /*
* DNet eBusiness Suite
* Copyright: 2008-2012 Nan21 Electronics SRL. All rights reserved.
* Use is subject to license terms.
*/
package net.nan21.dnet.module.ad.workflow.ds.model;
import net.nan21.dnet.core.api.annotation.Ds;
import net.nan21.dnet.core.api.annotation.DsField;
import net.nan21.dnet.core.api.annotation.SortField;
import net.nan21.dnet.core.presenter.model.base.AbstractTypeDs;
import net.nan21.dnet.module.ad.workflow.domain.entity.WfDefNodeField;
@Ds(entity = WfDefNodeField.class, sort = { @SortField(field = WfDefNodeFieldDs.fNAME) })
public class WfDefNodeFieldDs extends AbstractTypeDs<WfDefNodeField> {
public static final String fTYPE = "type";
public static final String fREQUIRED = "required";
public static final String fNODEID = "nodeId";
@DsField()
private String type;
@DsField()
private Boolean required;
@DsField(join = "left", path = "node.id")
private Long nodeId;
public WfDefNodeFieldDs() {
super();
}
public WfDefNodeFieldDs(WfDefNodeField e) {
super(e);
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public Boolean getRequired() {
return this.required;
}
public void setRequired(Boolean required) {
this.required = required;
}
public Long getNodeId() {
return this.nodeId;
}
public void setNodeId(Long nodeId) {
this.nodeId = nodeId;
}
}
| [
"mathe_attila@yahoo.com"
] | mathe_attila@yahoo.com |
2e7d4e38eac5f7b41a810c2dca6742c6b9055405 | 9344af5fb6424e1328d69a1a705a0a3e324b7ca9 | /src/com/guofeilong/fortune/ui/coolguide/transitions/ChangeRotate.java | eb09f7879e9fdfb9a57e234c5a00a29f5a804774 | [] | no_license | GuoFeilong/MySelfFortune | e3eaeb2994e50007a366a7c56c8b953d29d9daa1 | 1ea8fc9f53cb3633a0ff50d4875e1d0a384bc4f3 | refs/heads/master | 2020-12-24T08:01:38.909626 | 2016-08-09T10:04:03 | 2016-08-09T10:04:03 | 48,013,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,352 | java | package com.guofeilong.fortune.ui.coolguide.transitions;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.TargetApi;
import android.os.Build;
import android.transition.Transition;
import android.transition.TransitionValues;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by linfaxin on 2015/5/29.
* Email: linlinfaxin@163.com
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
public class ChangeRotate extends Transition {
private static final String PROPNAME_NAME = "android:rotate:rotate";
private static final String PROPNAME_NAME_X = "android:rotate:rotateX";
private static final String PROPNAME_NAME_Y = "android:rotate:rotateY";
private static final String FIELD_NAME = "rotation";
private static final String FIELD_NAME_X = "rotationX";
private static final String FIELD_NAME_Y = "rotationY";
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void captureStartValues(TransitionValues transitionValues) {
transitionValues.values.put(PROPNAME_NAME, transitionValues.view.getRotation());
transitionValues.values.put(PROPNAME_NAME_X, transitionValues.view.getRotationX());
transitionValues.values.put(PROPNAME_NAME_Y, transitionValues.view.getRotationY());
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public void captureEndValues(TransitionValues transitionValues) {
transitionValues.values.put(PROPNAME_NAME, transitionValues.view.getRotation());
transitionValues.values.put(PROPNAME_NAME_X, transitionValues.view.getRotationX());
transitionValues.values.put(PROPNAME_NAME_Y, transitionValues.view.getRotationY());
}
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
final View view = endValues.view;
float startValue = (Float) startValues.values.get(PROPNAME_NAME);
float startValueX = (Float) startValues.values.get(PROPNAME_NAME_X);
float startValueY = (Float) startValues.values.get(PROPNAME_NAME_Y);
float endValue = (Float) endValues.values.get(PROPNAME_NAME);
float endValueX = (Float) endValues.values.get(PROPNAME_NAME_X);
float endValueY = (Float) endValues.values.get(PROPNAME_NAME_Y);
AnimatorSet animatorSet = new AnimatorSet();
if (startValue != endValue) {
view.setRotation(startValue);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME, startValue, endValue));
}
if (startValueX != endValueX) {
view.setRotationX(startValueX);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME_X, startValueX, endValueX));
}
if (startValueY != endValueY) {
view.setRotationY(startValueY);
animatorSet.playTogether(ObjectAnimator.ofFloat(view, FIELD_NAME_Y, startValueY, endValueY));
}
if(animatorSet.getChildAnimations()!=null && animatorSet.getChildAnimations().size()>0){
return animatorSet;
}
return null;
}
}
| [
"guofeilong@asiatravel.com"
] | guofeilong@asiatravel.com |
3c50fb0c9c4358f43f8f7c3eb4ec9bc96d4e8098 | d132a32f07cdc583c021e56e61a4befff6228900 | /src/main/java/net/minecraft/network/play/server/S05PacketSpawnPosition.java | 614c56f53c190ac6c47cfa868c253d0a04248f7a | [] | no_license | TechCatOther/um_clean_forge | 27d80cb6e12c5ed38ab7da33a9dd9e54af96032d | b4ddabd1ed7830e75df9267e7255c9e79d1324de | refs/heads/master | 2020-03-22T03:14:54.717880 | 2018-07-02T09:28:10 | 2018-07-02T09:28:10 | 139,421,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,209 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class S05PacketSpawnPosition implements Packet
{
private BlockPos field_179801_a;
private static final String __OBFID = "CL_00001336";
public S05PacketSpawnPosition() {}
public S05PacketSpawnPosition(BlockPos p_i45956_1_)
{
this.field_179801_a = p_i45956_1_;
}
public void readPacketData(PacketBuffer buf) throws IOException
{
this.field_179801_a = buf.readBlockPos();
}
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeBlockPos(this.field_179801_a);
}
public void func_180752_a(INetHandlerPlayClient p_180752_1_)
{
p_180752_1_.handleSpawnPosition(this);
}
@SideOnly(Side.CLIENT)
public BlockPos func_179800_a()
{
return this.field_179801_a;
}
public void processPacket(INetHandler handler)
{
this.func_180752_a((INetHandlerPlayClient)handler);
}
} | [
"alone.inbox@gmail.com"
] | alone.inbox@gmail.com |
666f1e903ab555ba4ff6c3b20d5490615abb2b36 | a8d6029b78411ca580dd0463e4658b511e136f8a | /Calculator/src/test/java/CalculatorTest.java | 33ac37be7c66a60274073e5b9ffa7828d2301587 | [] | no_license | ChaYujin/OOP_WITH_JAVA | 67eae2dc25c3d6154afd52c3cf1174af0cd542a9 | 48bb0597bfbfb3bf9bc08895d88a6a5ffc480642 | refs/heads/master | 2021-01-24T01:51:26.127795 | 2018-02-23T15:44:06 | 2018-02-23T15:44:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.*;
public class CalculatorTest {
Calculator calculator;
@Before
public void setup() {
calculator = new Calculator();
}
@Test
public void plus() {
assertThat(calculator.plus(1,2)).isEqualTo(3);
}
@Test
public void minus() {
assertThat(calculator.minus(2,1)).isEqualTo(1);
}
@Test
public void multiply() {
assertThat(calculator.multifly(4,2)).isEqualTo(8);
}
@Test
public void devide() {
assertThat(calculator.divide(4,2)).isEqualTo(2);
}
}
| [
"hyde0401@gmail.com"
] | hyde0401@gmail.com |
9eea9ccfbf288746764fafc05825c3eb4a9c4b4e | d5b5ff7e669c3b5af75d75f9287772a215ec1aef | /src/com/AIPC/RobotConnection.java | 0b16416e91cb436c13fbfec3a8c1b20241ef76b6 | [] | no_license | matty234/AIPC | c1e84f3cf496ca5faefa3db602e60d7d58065d08 | f34d912cf6ae570cb66f827a56c14161efa96da2 | refs/heads/master | 2023-04-30T01:39:25.922161 | 2016-12-07T23:22:22 | 2016-12-07T23:22:22 | 72,861,802 | 0 | 0 | null | 2023-04-17T16:01:51 | 2016-11-04T15:46:32 | Java | UTF-8 | Java | false | false | 2,335 | java | package com.AIPC;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import lejos.pc.comm.NXTComm;
import lejos.pc.comm.NXTCommException;
import lejos.pc.comm.NXTCommFactory;
import lejos.pc.comm.NXTInfo;
public class RobotConnection implements RCCommand {
NXTComm nxtComm = NXTCommFactory.createNXTComm(NXTCommFactory.BLUETOOTH);
DataOutputStream brickOutput;
DataInputStream brickInput;
public RobotConnection(NXTInfo nxtInfo, NXTComm nxtComm) throws NXTCommException {
setNxtComm(nxtComm);
openConnection(nxtInfo);
}
public RobotConnection(NXTInfo nxtInfo) throws NXTCommException {
openConnection(nxtInfo);
}
private void openConnection(NXTInfo nxtInfo) throws NXTCommException {
nxtComm.open(nxtInfo);
brickOutput = new DataOutputStream(nxtComm.getOutputStream());
brickInput = new DataInputStream(nxtComm.getInputStream());
}
public boolean handshake() {
try {
writeByte(RCCommand.Modes.HANDSHAKE);
if(readByte()==RCCommand.Modes.HANDSHAKE) {
return true;
}
} catch (IOException e) {
e.printStackTrace();
return false;
}
return false;
}
public NXTComm getNxtComm() {
return nxtComm;
}
private void setNxtComm(NXTComm nxtComm) {
this.nxtComm = nxtComm;
}
public void writeInt(int value) throws IOException {
brickOutput.writeInt(value);
brickOutput.flush();
}
public void writeByte(byte value) throws IOException {
brickOutput.writeByte(value);
brickOutput.flush();
}
public void writeRobotPacket(RobotPacket rb) throws IOException {
brickOutput.write(rb.getMode());
brickOutput.write(rb.getLength());
for (int i = 0; i < rb.getLength(); i++) {
brickOutput.write(rb.getCommands()[i]);
}
brickOutput.flush();
}
public byte readByte() throws IOException {
return brickInput.readByte();
}
public RobotPacket readRobotPacket() throws IOException {
byte mode = readByte();
int length = readByte();
byte[] commands = new byte[length];
for (int i = 0; i < length; i++) {
commands[i] = readByte();
}
RobotPacket robotPacket = new RobotPacket(mode, commands);
return robotPacket;
}
public void close() throws IOException {
brickOutput.close();
brickInput.close();
}
}
| [
"matthew@bargrove.com"
] | matthew@bargrove.com |
2cb6aed9c009826daf248fe699bab0e20d1140ed | 468b7ad129000f390bafce9a81df19ecc7fa0862 | /src/main/java/parser.java | d08644c3c8c9851163f3312250a403583e50314b | [] | no_license | rnc/java_cup | 5485b5309804b4a7857aa8dce712fb5f3bdade10 | 4b44237e0371ea6765ffd6acb4d2caf52188629f | refs/heads/master | 2020-04-01T19:35:48.805617 | 2014-04-02T16:12:26 | 2014-04-02T16:12:26 | 18,372,425 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 35,532 | java |
//----------------------------------------------------
// The following code was generated by CUP v0.9e
// Sun Apr 07 11:44:20 EDT 1996
//----------------------------------------------------
package java_cup;
import java_cup.runtime.*;
import java.util.Hashtable;
public class parser extends java_cup.runtime.lr_parser {
/** constructor */
public parser() {super();}
/** production table */
protected static final short _production_table[][] = {
{0, 2}, {31, 0}, {1, 9}, {1, 4}, {32, 0},
{2, 4}, {2, 1}, {3, 2}, {3, 1}, {33, 0},
{11, 4}, {4, 2}, {5, 4}, {5, 1}, {6, 4},
{6, 1}, {13, 4}, {13, 1}, {14, 4}, {14, 1},
{7, 2}, {7, 1}, {34, 0}, {15, 5}, {35, 0},
{15, 6}, {36, 0}, {15, 4}, {37, 0}, {15, 5},
{17, 3}, {17, 1}, {18, 3}, {18, 1}, {38, 0},
{8, 5}, {8, 1}, {9, 2}, {9, 1}, {39, 0},
{19, 5}, {40, 0}, {19, 3}, {24, 3}, {24, 1},
{25, 1}, {20, 2}, {20, 1}, {21, 2}, {21, 1},
{30, 2}, {30, 1}, {10, 3}, {10, 1}, {12, 3},
{12, 1}, {16, 1}, {22, 1}, {23, 1}, {27, 1},
{28, 1}, {29, 1}, {26, 0} };
/** access to production table */
public short[][] production_table() {return _production_table;}
/** parse action table */
protected static final short[][] _action_table = {
/*0*/{1,4,2,-2,3,-2,5,-2,6,-2,7,-2,8,-2,9,-2,10,-2,-1,0},
/*1*/{0,114,-1,0},
/*2*/{2,72,3,-63,5,-63,6,-63,7,-63,8,-63,9,-63,10,-63,-1,0},
/*3*/{7,5,8,8,-1,0},
/*4*/{1,59,20,10,-1,0},
/*5*/{1,-22,7,-22,8,-22,12,-22,20,-22,-1,0},
/*6*/{1,-63,7,5,8,8,12,28,20,-63,-1,0},
/*7*/{7,9,-1,0},
/*8*/{1,11,20,10,-1,0},
/*9*/{13,-54,16,-54,20,-54,-1,0},
/*10*/{13,-29,-1,0},
/*11*/{20,18,-1,0},
/*12*/{16,14,20,-57,-1,0},
/*13*/{20,15,-1,0},
/*14*/{13,-53,16,-53,20,-53,-1,0},
/*15*/{13,-34,14,-34,-1,0},
/*16*/{13,-25,14,20,-1,0},
/*17*/{13,-59,14,-59,-1,0},
/*18*/{13,22,-1,0},
/*19*/{20,18,-1,0},
/*20*/{13,-33,14,-33,-1,0},
/*21*/{1,-26,7,-26,8,-26,12,-26,20,-26,-1,0},
/*22*/{13,24,-1,0},
/*23*/{1,-30,7,-30,8,-30,12,-30,20,-30,-1,0},
/*24*/{1,-21,7,-21,8,-21,12,-21,20,-21,-1,0},
/*25*/{1,-37,20,-37,-1,0},
/*26*/{1,34,20,30,-1,0},
/*27*/{11,29,-1,0},
/*28*/{20,30,-1,0},
/*29*/{13,-60,18,-60,-1,0},
/*30*/{13,-35,-1,0},
/*31*/{13,33,-1,0},
/*32*/{1,-36,20,-36,-1,0},
/*33*/{13,-42,-1,0},
/*34*/{18,-40,-1,0},
/*35*/{0,-4,1,34,20,30,-1,0},
/*36*/{0,-39,1,-39,20,-39,-1,0},
/*37*/{0,-38,1,-38,20,-38,-1,0},
/*38*/{18,40,-1,0},
/*39*/{13,-63,19,-63,20,-63,21,-63,-1,0},
/*40*/{13,-48,19,-48,20,-48,21,-48,-1,0},
/*41*/{13,-46,19,-46,20,49,21,48,-1,0},
/*42*/{13,-45,19,-45,-1,0},
/*43*/{13,45,19,46,-1,0},
/*44*/{0,-41,1,-41,20,-41,-1,0},
/*45*/{13,-63,19,-63,20,-63,21,-63,-1,0},
/*46*/{13,-44,19,-44,-1,0},
/*47*/{13,-50,19,-50,20,-50,21,-50,-1,0},
/*48*/{13,-61,17,-61,19,-61,20,-61,21,-61,-1,0},
/*49*/{13,-63,17,54,19,-63,20,-63,21,-63,-1,0},
/*50*/{13,-47,19,-47,20,-47,21,-47,-1,0},
/*51*/{13,-52,19,-52,20,-52,21,-52,-1,0},
/*52*/{13,-49,19,-49,20,-49,21,-49,-1,0},
/*53*/{20,55,-1,0},
/*54*/{13,-62,19,-62,20,-62,21,-62,-1,0},
/*55*/{13,-51,19,-51,20,-51,21,-51,-1,0},
/*56*/{13,58,-1,0},
/*57*/{0,-43,1,-43,20,-43,-1,0},
/*58*/{13,-27,-1,0},
/*59*/{20,63,-1,0},
/*60*/{13,-23,14,64,-1,0},
/*61*/{13,-32,14,-32,-1,0},
/*62*/{13,-58,14,-58,-1,0},
/*63*/{20,63,-1,0},
/*64*/{13,66,-1,0},
/*65*/{1,-24,7,-24,8,-24,12,-24,20,-24,-1,0},
/*66*/{13,-31,14,-31,-1,0},
/*67*/{13,69,-1,0},
/*68*/{1,-28,7,-28,8,-28,12,-28,20,-28,-1,0},
/*69*/{3,-7,5,-7,6,-7,7,-7,8,-7,9,-7,10,-7,-1,0},
/*70*/{3,-63,5,-63,6,-63,7,-63,8,-63,9,-63,10,-63,-1,0},
/*71*/{20,10,-1,0},
/*72*/{13,-5,16,14,-1,0},
/*73*/{13,75,-1,0},
/*74*/{3,-6,5,-6,6,-6,7,-6,8,-6,9,-6,10,-6,-1,0},
/*75*/{3,82,5,79,6,-63,7,-63,8,-63,9,-63,10,-63,-1,0},
/*76*/{3,-9,5,-9,6,-9,7,-9,8,-9,9,-9,10,-9,-1,0},
/*77*/{6,-14,7,-14,8,-14,9,-14,10,-14,-1,0},
/*78*/{4,111,-1,0},
/*79*/{6,107,7,-63,8,-63,9,-63,10,-63,-1,0},
/*80*/{3,-8,5,-8,6,-8,7,-8,8,-8,9,-8,10,-8,-1,0},
/*81*/{20,10,-1,0},
/*82*/{7,-63,8,-63,9,86,10,-63,-1,0},
/*83*/{7,-18,8,-18,10,-18,-1,0},
/*84*/{7,-63,8,-63,10,92,-1,0},
/*85*/{11,87,-1,0},
/*86*/{21,88,-1,0},
/*87*/{13,89,-1,0},
/*88*/{7,-17,8,-17,10,-17,-1,0},
/*89*/{7,-20,8,-20,-1,0},
/*90*/{7,5,8,8,-1,0},
/*91*/{11,93,-1,0},
/*92*/{21,94,-1,0},
/*93*/{13,95,-1,0},
/*94*/{7,-19,8,-19,-1,0},
/*95*/{1,-63,7,5,8,8,12,28,20,-63,-1,0},
/*96*/{1,34,20,30,-1,0},
/*97*/{0,-3,1,34,20,30,-1,0},
/*98*/{13,-10,-1,0},
/*99*/{13,-56,16,101,-1,0},
/*100*/{15,102,20,15,-1,0},
/*101*/{13,-55,-1,0},
/*102*/{13,104,-1,0},
/*103*/{3,-11,5,-11,6,-11,7,-11,8,-11,9,-11,10,-11,-1,0},
/*104*/{7,-16,8,-16,9,-16,10,-16,-1,0},
/*105*/{7,-12,8,-12,9,-12,10,-12,-1,0},
/*106*/{4,108,-1,0},
/*107*/{21,109,-1,0},
/*108*/{13,110,-1,0},
/*109*/{7,-15,8,-15,9,-15,10,-15,-1,0},
/*110*/{21,112,-1,0},
/*111*/{13,113,-1,0},
/*112*/{6,-13,7,-13,8,-13,9,-13,10,-13,-1,0},
/*113*/{0,-1,-1,0},
};
/** access to parse action table */
public short[][] action_table() {return _action_table;}
/** reduce_goto table */
protected static final short[][] _reduce_table = {
/*0*/{1,1,31,2,-1,-1},
/*1*/{-1,-1},
/*2*/{2,70,26,69,-1,-1},
/*3*/{7,6,15,5,-1,-1},
/*4*/{10,12,16,59,-1,-1},
/*5*/{-1,-1},
/*6*/{8,26,15,24,26,25,-1,-1},
/*7*/{-1,-1},
/*8*/{10,12,16,11,-1,-1},
/*9*/{-1,-1},
/*10*/{37,22,-1,-1},
/*11*/{18,16,23,15,-1,-1},
/*12*/{-1,-1},
/*13*/{-1,-1},
/*14*/{-1,-1},
/*15*/{-1,-1},
/*16*/{35,18,-1,-1},
/*17*/{-1,-1},
/*18*/{-1,-1},
/*19*/{23,20,-1,-1},
/*20*/{-1,-1},
/*21*/{-1,-1},
/*22*/{-1,-1},
/*23*/{-1,-1},
/*24*/{-1,-1},
/*25*/{-1,-1},
/*26*/{9,35,19,36,27,34,-1,-1},
/*27*/{-1,-1},
/*28*/{27,30,-1,-1},
/*29*/{-1,-1},
/*30*/{38,31,-1,-1},
/*31*/{-1,-1},
/*32*/{-1,-1},
/*33*/{40,56,-1,-1},
/*34*/{39,38,-1,-1},
/*35*/{19,37,27,34,-1,-1},
/*36*/{-1,-1},
/*37*/{-1,-1},
/*38*/{-1,-1},
/*39*/{20,41,24,43,25,42,26,40,-1,-1},
/*40*/{-1,-1},
/*41*/{21,50,28,49,-1,-1},
/*42*/{-1,-1},
/*43*/{-1,-1},
/*44*/{-1,-1},
/*45*/{20,41,25,46,26,40,-1,-1},
/*46*/{-1,-1},
/*47*/{-1,-1},
/*48*/{-1,-1},
/*49*/{26,51,30,52,-1,-1},
/*50*/{-1,-1},
/*51*/{-1,-1},
/*52*/{-1,-1},
/*53*/{29,55,-1,-1},
/*54*/{-1,-1},
/*55*/{-1,-1},
/*56*/{-1,-1},
/*57*/{-1,-1},
/*58*/{36,67,-1,-1},
/*59*/{17,60,22,61,-1,-1},
/*60*/{34,64,-1,-1},
/*61*/{-1,-1},
/*62*/{-1,-1},
/*63*/{22,66,-1,-1},
/*64*/{-1,-1},
/*65*/{-1,-1},
/*66*/{-1,-1},
/*67*/{-1,-1},
/*68*/{-1,-1},
/*69*/{-1,-1},
/*70*/{3,75,26,76,-1,-1},
/*71*/{10,72,-1,-1},
/*72*/{32,73,-1,-1},
/*73*/{-1,-1},
/*74*/{-1,-1},
/*75*/{4,82,5,79,11,80,26,77,-1,-1},
/*76*/{-1,-1},
/*77*/{-1,-1},
/*78*/{-1,-1},
/*79*/{6,105,26,104,-1,-1},
/*80*/{-1,-1},
/*81*/{10,99,12,98,-1,-1},
/*82*/{13,84,26,83,-1,-1},
/*83*/{-1,-1},
/*84*/{14,90,26,89,-1,-1},
/*85*/{-1,-1},
/*86*/{-1,-1},
/*87*/{-1,-1},
/*88*/{-1,-1},
/*89*/{-1,-1},
/*90*/{7,95,15,5,-1,-1},
/*91*/{-1,-1},
/*92*/{-1,-1},
/*93*/{-1,-1},
/*94*/{-1,-1},
/*95*/{8,96,15,24,26,25,-1,-1},
/*96*/{9,97,19,36,27,34,-1,-1},
/*97*/{19,37,27,34,-1,-1},
/*98*/{33,102,-1,-1},
/*99*/{-1,-1},
/*100*/{-1,-1},
/*101*/{-1,-1},
/*102*/{-1,-1},
/*103*/{-1,-1},
/*104*/{-1,-1},
/*105*/{-1,-1},
/*106*/{-1,-1},
/*107*/{-1,-1},
/*108*/{-1,-1},
/*109*/{-1,-1},
/*110*/{-1,-1},
/*111*/{-1,-1},
/*112*/{-1,-1},
/*113*/{-1,-1},
};
/** access to reduce_goto table */
public short[][] reduce_table() {return _reduce_table;}
/** instance of action encapsulation class */
protected CUP$actions action_obj;
/** action encapsulation object initializer */
protected void init_actions()
{
action_obj = new CUP$actions();
}
/** invoke a user supplied parse action */
public java_cup.runtime.symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$do_action(act_num, parser, stack, top);
}
/** start state */
public int start_state() {return 0;}
/** start production */
public int start_production() {return 0;}
/** EOF symbol index */
public int EOF_sym() {return 0;}
/** error symbol index */
public int error_sym() {return 1;}
/** user initialization */
public void user_init() throws java.lang.Exception
{
lexer.init();
}
/** scan to get the next token */
public java_cup.runtime.token scan()
throws java.lang.Exception
{
return lexer.next_token();
}
/* override error routines */
public void report_fatal_error(
String message,
Object info)
{
done_parsing();
lexer.emit_error(message);
System.err.println("Can't recover from previous error(s), giving up.");
System.exit(1);
}
public void report_error(String message, Object info)
{
lexer.emit_error(message);
}
};
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$actions {
/** helper routine to clone a new production part adding a given label */
protected production_part add_lab(production_part part, String lab)
throws internal_error
{
/* if there is no label, or this is an action, just return the original */
if (lab == null || part.is_action()) return part;
/* otherwise build a new one with the given label attached */
return new symbol_part(((symbol_part)part).the_symbol(),lab);
}
/** max size of right hand side we will support */
protected final int MAX_RHS = 200;
/** array for accumulating right hand side parts */
protected production_part[] rhs_parts = new production_part[MAX_RHS];
/** where we are currently in building a right hand side */
protected int rhs_pos = 0;
/** start a new right hand side */
protected void new_rhs() {rhs_pos = 0; }
/** add a new right hand side part */
protected void add_rhs_part(production_part part) throws java.lang.Exception
{
if (rhs_pos >= MAX_RHS)
throw new Exception("Internal Error: Productions limited to " +
MAX_RHS + " symbols and actions");
rhs_parts[rhs_pos] = part;
rhs_pos++;
}
/** string to build up multiple part names */
protected String multipart_name = new String();
/** append a new name segment to the accumulated multipart name */
protected void append_multipart(String name)
{
String dot = "";
/* if we aren't just starting out, put on a dot */
if (multipart_name.length() != 0) dot = ".";
multipart_name = multipart_name.concat(dot + name);
}
/** table of declared symbols -- contains production parts indexed by name */
protected Hashtable symbols = new Hashtable();
/** table of just non terminals -- contains non_terminals indexed by name */
protected Hashtable non_terms = new Hashtable();
/** declared start non_terminal */
protected non_terminal start_nt = null;
/** left hand side non terminal of the current production */
protected non_terminal lhs_nt;
/** Constructor */
CUP$actions() { }
/** Method with the actual generated action code. */
public final java_cup.runtime.symbol CUP$do_action(
int CUP$act_num,
java_cup.runtime.lr_parser CUP$parser,
java.util.Stack CUP$stack,
int CUP$top)
throws java.lang.Exception
{
/* object for return from actions */
java_cup.runtime.symbol CUP$result;
/* select the action based on the action number */
switch (CUP$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 62: // empty ::=
{
CUP$result = new java_cup.runtime.symbol(/*empty*/26);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 61: // label_id ::= ID
{
CUP$result = new java_cup.runtime.str_token(/*label_id*/29);
((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 60: // symbol_id ::= ID
{
CUP$result = new java_cup.runtime.str_token(/*symbol_id*/28);
((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 59: // nt_id ::= ID
{
CUP$result = new java_cup.runtime.str_token(/*nt_id*/27);
((java_cup.runtime.str_token)CUP$result).str_val = (/*the_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 58: // new_non_term_id ::= ID
{
CUP$result = new java_cup.runtime.symbol(/*new_non_term_id*/23);
/* see if this non terminal has been declared before */
if (symbols.get((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val) != null)
{
/* issue a message */
lexer.emit_error( "Symbol \"" + (/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
"\" has already been declared");
}
else
{
/* build the non terminal object */
non_terminal this_nt =
new non_terminal((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, multipart_name);
/* put it in the non_terms table */
non_terms.put((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, this_nt);
/* build a production_part and put it in the symbols table */
symbols.put((/*non_term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, new symbol_part(this_nt));
}
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 57: // new_term_id ::= ID
{
CUP$result = new java_cup.runtime.symbol(/*new_term_id*/22);
/* see if this terminal has been declared before */
if (symbols.get((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val) != null)
{
/* issue a message */
lexer.emit_error("Symbol \"" + (/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
"\" has already been declared");
}
else
{
/* build a production_part and put it in the table */
symbols.put((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val,
new symbol_part(new terminal((/*term_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val, multipart_name)));
}
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 56: // type_id ::= multipart_id
{
CUP$result = new java_cup.runtime.symbol(/*type_id*/16);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 55: // import_id ::= multipart_id
{
CUP$result = new java_cup.runtime.symbol(/*import_id*/12);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 54: // import_id ::= multipart_id DOT STAR
{
CUP$result = new java_cup.runtime.symbol(/*import_id*/12);
append_multipart("*");
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 53: // multipart_id ::= ID
{
CUP$result = new java_cup.runtime.symbol(/*multipart_id*/10);
append_multipart((/*an_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 52: // multipart_id ::= multipart_id DOT ID
{
CUP$result = new java_cup.runtime.symbol(/*multipart_id*/10);
append_multipart((/*another_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 51: // opt_label ::= empty
{
CUP$result = new java_cup.runtime.str_token(/*opt_label*/30);
((java_cup.runtime.str_token)CUP$result).str_val = null;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 50: // opt_label ::= COLON label_id
{
CUP$result = new java_cup.runtime.str_token(/*opt_label*/30);
((java_cup.runtime.str_token)CUP$result).str_val = (/*labid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 49: // prod_part ::= CODE_STRING
{
CUP$result = new java_cup.runtime.symbol(/*prod_part*/21);
/* add a new production part */
add_rhs_part(new action_part((/*code_str*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val));
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 48: // prod_part ::= symbol_id opt_label
{
CUP$result = new java_cup.runtime.symbol(/*prod_part*/21);
/* try to look up the id */
production_part symb = (production_part)symbols.get((/*symid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val);
/* if that fails, symbol is undeclared */
if (symb == null)
{
if (lexer.error_count == 0)
lexer.emit_error("Symbol \"" + (/*symid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val +
"\" has not been declared");
}
else
{
/* add a labeled production part */
add_rhs_part(add_lab(symb, (/*labid*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val));
}
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 47: // prod_part_list ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*prod_part_list*/20);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 46: // prod_part_list ::= prod_part_list prod_part
{
CUP$result = new java_cup.runtime.symbol(/*prod_part_list*/20);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 45: // rhs ::= prod_part_list
{
CUP$result = new java_cup.runtime.symbol(/*rhs*/25);
if (lhs_nt != null)
{
/* build the production */
production p = new production(lhs_nt, rhs_parts, rhs_pos);
/* if we have no start non-terminal declared and this is
the first production, make its lhs nt the start_nt
and build a special start production for it. */
if (start_nt == null)
{
start_nt = lhs_nt;
/* build a special start production */
new_rhs();
add_rhs_part(new symbol_part(start_nt));
add_rhs_part(new symbol_part(terminal.EOF));
emit.start_production =
new production(non_terminal.START_nt, rhs_parts, rhs_pos);
new_rhs();
}
}
/* reset the rhs accumulation in any case */
new_rhs();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 44: // rhs_list ::= rhs
{
CUP$result = new java_cup.runtime.symbol(/*rhs_list*/24);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 43: // rhs_list ::= rhs_list BAR rhs
{
CUP$result = new java_cup.runtime.symbol(/*rhs_list*/24);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 42: // production ::= error NT$9 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*production*/19);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 41: // NT$9 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$9*/40);
lexer.emit_error("Syntax Error");
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 40: // production ::= nt_id NT$8 COLON_COLON_EQUALS rhs_list SEMI
{
CUP$result = new java_cup.runtime.symbol(/*production*/19);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 39: // NT$8 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$8*/39);
/* lookup the lhs nt */
lhs_nt = (non_terminal)non_terms.get((/*lhs_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
/* if it wasn't declared, emit a message */
if (lhs_nt == null)
{
if (lexer.error_count == 0)
lexer.emit_error("LHS non terminal \"" + (/*lhs_id*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
"\" has not been declared");
}
/* reset the rhs accumulation */
new_rhs();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 38: // production_list ::= production
{
CUP$result = new java_cup.runtime.symbol(/*production_list*/9);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 37: // production_list ::= production_list production
{
CUP$result = new java_cup.runtime.symbol(/*production_list*/9);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 36: // start_spec ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*start_spec*/8);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 35: // start_spec ::= START WITH nt_id NT$7 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*start_spec*/8);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 34: // NT$7 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$7*/38);
/* verify that the name has been declared as a non terminal */
non_terminal nt = (non_terminal)non_terms.get((/*start_name*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val);
if (nt == null)
{
lexer.emit_error( "Start non terminal \"" + (/*start_name*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-0)).str_val +
"\" has not been declared");
}
else
{
/* remember the non-terminal for later */
start_nt = nt;
/* build a special start production */
new_rhs();
add_rhs_part(new symbol_part(start_nt));
add_rhs_part(new symbol_part(terminal.EOF));
emit.start_production =
new production(non_terminal.START_nt, rhs_parts, rhs_pos);
new_rhs();
}
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 33: // non_term_name_list ::= new_non_term_id
{
CUP$result = new java_cup.runtime.symbol(/*non_term_name_list*/18);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 32: // non_term_name_list ::= non_term_name_list COMMA new_non_term_id
{
CUP$result = new java_cup.runtime.symbol(/*non_term_name_list*/18);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 31: // term_name_list ::= new_term_id
{
CUP$result = new java_cup.runtime.symbol(/*term_name_list*/17);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 30: // term_name_list ::= term_name_list COMMA new_term_id
{
CUP$result = new java_cup.runtime.symbol(/*term_name_list*/17);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 29: // symbol ::= NON TERMINAL error NT$6 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 28: // NT$6 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$6*/37);
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 27: // symbol ::= TERMINAL error NT$5 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 26: // NT$5 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$5*/36);
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 25: // symbol ::= NON TERMINAL type_id non_term_name_list NT$4 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 24: // NT$4 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$4*/35);
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 23: // symbol ::= TERMINAL type_id term_name_list NT$3 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*symbol*/15);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 22: // NT$3 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$3*/34);
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 21: // symbol_list ::= symbol
{
CUP$result = new java_cup.runtime.symbol(/*symbol_list*/7);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // symbol_list ::= symbol_list symbol
{
CUP$result = new java_cup.runtime.symbol(/*symbol_list*/7);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // scan_code ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*scan_code*/14);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 18: // scan_code ::= SCAN WITH CODE_STRING SEMI
{
CUP$result = new java_cup.runtime.symbol(/*scan_code*/14);
/* save the user code */
emit.scan_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 17: // init_code ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*init_code*/13);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 16: // init_code ::= INIT WITH CODE_STRING SEMI
{
CUP$result = new java_cup.runtime.symbol(/*init_code*/13);
/* save the user code */
emit.init_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // parser_code_part ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*parser_code_part*/6);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // parser_code_part ::= PARSER CODE CODE_STRING SEMI
{
CUP$result = new java_cup.runtime.symbol(/*parser_code_part*/6);
/* save the user included code string */
emit.parser_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // action_code_part ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*action_code_part*/5);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // action_code_part ::= ACTION CODE CODE_STRING SEMI
{
CUP$result = new java_cup.runtime.symbol(/*action_code_part*/5);
/* save the user included code string */
emit.action_code = (/*user_code*/(java_cup.runtime.str_token)CUP$stack.elementAt(CUP$top-1)).str_val;
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // code_part ::= action_code_part parser_code_part
{
CUP$result = new java_cup.runtime.symbol(/*code_part*/4);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // import_spec ::= IMPORT import_id NT$2 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*import_spec*/11);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // NT$2 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$2*/33);
/* save this import on the imports list */
emit.import_list.push(multipart_name);
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // import_list ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*import_list*/3);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // import_list ::= import_list import_spec
{
CUP$result = new java_cup.runtime.symbol(/*import_list*/3);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // package_spec ::= empty
{
CUP$result = new java_cup.runtime.symbol(/*package_spec*/2);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // package_spec ::= PACKAGE multipart_id NT$1 SEMI
{
CUP$result = new java_cup.runtime.symbol(/*package_spec*/2);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // NT$1 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$1*/32);
/* save the package name */
emit.package_name = multipart_name;
/* reset the accumulated multipart name */
multipart_name = new String();
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // spec ::= error symbol_list start_spec production_list
{
CUP$result = new java_cup.runtime.symbol(/*spec*/1);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // spec ::= NT$0 package_spec import_list code_part init_code scan_code symbol_list start_spec production_list
{
CUP$result = new java_cup.runtime.symbol(/*spec*/1);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // NT$0 ::=
{
CUP$result = new java_cup.runtime.token(/*NT$0*/31);
/* declare "error" as a terminal */
symbols.put("error", new symbol_part(terminal.error));
/* declare start non terminal */
non_terms.put("$START", non_terminal.START_nt);
}
return CUP$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // $START ::= spec EOF
{
CUP$result = new java_cup.runtime.token(/*$START*/0);
}
/* ACCEPT */
CUP$parser.done_parsing();
return CUP$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
};
| [
"ncross@redhat.com"
] | ncross@redhat.com |
014a2038c991125c1b8000c0a94830a192cb9bfc | 6750fce76a576c4aad2e16003ec3b34eae4fd988 | /src/com/example/android/pinprogress/MainActivity.java | 0a7e015cd1afc6e5c78b44504abcb854367a456c | [] | no_license | ymotoba/pinprogress | 39f16fe9a74b701466e99e91faabcef9180b1e52 | e34b384e784cf34c3f6ee120202a4b3104de69cd | refs/heads/master | 2016-09-05T18:24:40.833596 | 2013-04-19T07:45:47 | 2013-04-19T07:45:47 | 9,540,219 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,182 | java | /*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.pinprogress;
import android.app.Activity;
import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.SeekBar;
import android.widget.TextView;
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final HpPinProgressButton pinProgress1 = (HpPinProgressButton) findViewById(
R.id.pin_progress_1);
final CircleProgress pinProgress2 = (CircleProgress) findViewById(
R.id.pin_progress_2);
final PinProgressButton pinProgress3 = (PinProgressButton) findViewById(
R.id.pin_progress_3);
final PinProgressButton pinProgress4 = (PinProgressButton) findViewById(
R.id.pin_progress_4);
final TextView pinProgress1TextView = (TextView) findViewById(R.id.pin_progress_1_TextView);
CompoundButton.OnCheckedChangeListener checkedChangeListener
= new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
updatePinProgressContentDescription((PinProgressButton) compoundButton);
}
};
pinProgress1.setOnCheckedChangeListener(checkedChangeListener);
pinProgress3.setOnCheckedChangeListener(checkedChangeListener);
pinProgress4.setOnCheckedChangeListener(checkedChangeListener);
SeekBar progressSeekBar = (SeekBar) findViewById(R.id.progress_seek_bar);
progressSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
pinProgress1.setProgress(progress);
pinProgress2.setProgress(progress);
pinProgress3.setProgress(progress);
pinProgress4.setProgress(progress);
updatePinProgressContentDescription(pinProgress1);
updatePinProgressContentDescription(pinProgress3);
updatePinProgressContentDescription(pinProgress4);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
pinProgress1.setProgress(progressSeekBar.getProgress());
pinProgress2.setProgress(progressSeekBar.getProgress());
pinProgress3.setProgress(progressSeekBar.getProgress());
pinProgress4.setProgress(progressSeekBar.getProgress());
updatePinProgressContentDescription(pinProgress1);
updatePinProgressContentDescription(pinProgress3);
updatePinProgressContentDescription(pinProgress4);
}
private void updatePinProgressContentDescription(HpPinProgressButton button) {
int progress = button.getProgress();
if (progress <= 0) {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_not_downloaded
: R.string.content_desc_unpinned_not_downloaded));
} else if (progress >= 100) {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_downloaded
: R.string.content_desc_unpinned_downloaded));
} else {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_downloading
: R.string.content_desc_unpinned_downloading));
}
}
private void updatePinProgressContentDescription(PinProgressButton button) {
int progress = button.getProgress();
if (progress <= 0) {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_not_downloaded
: R.string.content_desc_unpinned_not_downloaded));
} else if (progress >= 100) {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_downloaded
: R.string.content_desc_unpinned_downloaded));
} else {
button.setContentDescription(getString(button.isChecked()
? R.string.content_desc_pinned_downloading
: R.string.content_desc_unpinned_downloading));
}
}
}
| [
"ymotoba@gmail.com"
] | ymotoba@gmail.com |
13602b5373cf1386cd99f28fc4a3cee03dbf51ed | a261b977e6f5a9e38832274adafd797d3bc78752 | /letus-search/src/main/java/com/letus/search/controller/ItemController.java | 0d48ee4de1319a0e3ce842663f86cced3e5371b0 | [] | no_license | xfyin/letus-learing | 0a14f3f8fd746c8487cce0f5c4c01f01d35d6232 | c5211994d17b92cc071b056d23f88c7e92c66622 | refs/heads/master | 2020-06-17T19:37:45.677844 | 2016-12-19T16:09:53 | 2016-12-19T16:09:53 | 74,976,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | /**
* File:ItemController.java
* Package:com.letus.search.controller
* Author:xfyin
* Date:2016-12-11 上午10:52:05
* Copyright (C) 2016-2016 letus179-Copyright
*/
package com.letus.search.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.letus.common.pojo.LetusResult;
import com.letus.search.service.ItemService;
/**
*
* 索引库维护---发布服务controller
*
* @author xfyin
*
*/
@Controller
@RequestMapping("/manager")
public class ItemController {
/**
* 注入service
*/
@Autowired
private ItemService itemService;
/**
* 导入所有商品信息到索引库
*
* @return LetusResult
*/
@RequestMapping("/importall")
@ResponseBody
public LetusResult importAllItems() {
return itemService.importAllItems();
}
}
| [
"xfyin179@163.com"
] | xfyin179@163.com |
c08468d24bcc348540dae848cac0ff2eb785258b | b752743f04621c57a3dc07cdd4becbd97408b2c5 | /ReadMe/app/src/droidQuery-master/droidQuery/src/self/philbrown/droidQuery/CustomHttpUriRequest.java | 262e622b178b9230188a91b33f0dcaefb6506a73 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | Nuriix/ConUHacks2 | 269f70ed56d5599e06a2431530ce4727aa690bda | b723070ed854f50d49ab7d894cea8eb8b091462b | refs/heads/master | 2021-01-11T18:55:13.366752 | 2017-01-23T21:54:49 | 2017-01-23T21:54:49 | 79,657,517 | 0 | 3 | null | 2017-01-22T06:26:50 | 2017-01-21T16:29:42 | Java | UTF-8 | Java | false | false | 965 | java | /*
* Copyright 2013 Phil Brown
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package self.philbrown.droidQuery;
import org.apache.http.client.methods.HttpUriRequest;
/**
* Used to create custom HTTP Requests for Ajax
* @author Phil Brown
*/
public abstract class CustomHttpUriRequest implements HttpUriRequest {
/**
* Constructor
* @param url the URL of the page to request
*/
protected CustomHttpUriRequest(String url)
{
}
}
| [
"cars4321@hotmail.com"
] | cars4321@hotmail.com |
b7542ee03c0073f3bfc73bf7d51119668a981b84 | 0b5c3fceed7f662ea7224fc9373ff65be027d087 | /app/src/main/java/kntryer/downloadapk/util/CustomTools.java | 89bb787505bb047b99b1888fc2d2f0c742064eb8 | [] | no_license | lipeijian/UpdateApk | c4621cf573259931f95aa20386c64b5321e71cbb | 9938a1bcc4ac2d35947c51c06abe7d825357bb7f | refs/heads/master | 2021-07-13T13:52:19.470376 | 2017-10-17T08:18:12 | 2017-10-17T08:18:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,029 | java | package kntryer.downloadapk.util;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.support.v4.content.FileProvider;
import android.util.Log;
import android.view.View;
import java.io.File;
import kntryer.downloadapk.BuildConfig;
import kntryer.downloadapk.server.DownloadApkService;
import me.drakeet.materialdialog.MaterialDialog;
/**
* Created by kntryer on 2017/10/13.
*/
public class CustomTools {
/**
* @param context
* @param title
* @param msg
* @param positive
*/
public static void showToast(Context context, String title, String msg, String positive) {
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle(title);
dialog.setMessage(msg);
dialog.setCanceledOnTouchOutside(true);
if (!positive.equals("")) {
dialog.setPositiveButton(positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
dialog.show();
}
/**
* 获取应用版本号
*
* @param context
* @return
* @throws Exception
*/
public static String getVersionName(Context context) {
PackageManager packageManager = context.getPackageManager();
// getPackageName()是你当前类的包名,0代表是获取版本信息
PackageInfo packInfo = null;
try {
packInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
String version = packInfo.versionName;
return version;
}
/**
* 检查版本号是否一致
*
* @param context
* @param serverVersion
* @return
*/
public static boolean checkVersionUpdate(Context context, String serverVersion) {
String[] serverVersions = serverVersion.split("\\.");
String[] localVersions = getVersionName(context).split("\\.");
int num = serverVersions.length > localVersions.length ? localVersions.length : serverVersions.length;
for (int i = 0; i < num; i++) {
if (serverVersions[i].compareTo(localVersions[i]) > 0) {
return true;
} else if (serverVersions[i].compareTo(localVersions[i]) < 0) {
return false;
}
}
return serverVersions.length > localVersions.length;
}
/**
* 版本更新
*
* @param context
* @param status
* @param url
*/
public static void startUpdateApk(final Context context, int status, final String url) {
final MaterialDialog dialog = new MaterialDialog(context);
dialog.setTitle("更新啦");
dialog.setMessage("快来体验崭新的宝宝!");
dialog.setCanceledOnTouchOutside(status == 0);
dialog.setPositiveButton("立即更新", new View.OnClickListener() {
@Override
public void onClick(View v) {
//启动下载服务,显示通知栏
Log.e("---->", "下载更新");
Intent intent = new Intent(context, DownloadApkService.class);
intent.setAction(DownloadApkService.ACTION_START);
intent.putExtra("id", 0);
intent.putExtra("url", url);
intent.putExtra("name", "宝宝.apk");
context.startService(intent);
dialog.dismiss();
}
});
if (status == 0) {
dialog.setNegativeButton("稍候更新", new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
dialog.show();
}
/**
* 安装apk文件
*
* @param context
* @param file
*/
public static void installApk(Context context, File file) {
Intent intent = new Intent(Intent.ACTION_VIEW);
//判断是否是AndroidN以及更高的版本
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);
Uri contentUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileProvider", file);
intent.setDataAndType(contentUri, "application/vnd.android.package-archive");
} else {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
context.startActivity(intent);
}
}
| [
"l"
] | l |
6922482ea06de9ea38f4a8d5b2e0ab4997ecee47 | a86d058e0b602d357407fb4cc1120a52cf767c69 | /logstash-core/src/main/java/org/logstash/instrument/metrics/counter/LongCounter.java | 69aeceafb050e6a1c6f3f3ba4367dcb6a5e350ce | [
"Apache-2.0"
] | permissive | zentavr/logstash | c1d09c5f69d4c5182747c52a429d9db03a1abab4 | 63aba80eaffa0bc8a1a5d5b2fd9f4b9fc82d0f7c | refs/heads/master | 2021-05-07T19:55:12.770689 | 2017-11-14T20:27:09 | 2017-11-14T20:27:09 | 108,912,907 | 1 | 0 | null | 2017-10-30T21:57:08 | 2017-10-30T21:57:08 | null | UTF-8 | Java | false | false | 1,793 | java | package org.logstash.instrument.metrics.counter;
import org.logstash.instrument.metrics.AbstractMetric;
import org.logstash.instrument.metrics.MetricType;
import java.util.concurrent.atomic.LongAdder;
/**
* A {@link CounterMetric} that is backed by a {@link Long} type.
*/
public class LongCounter extends AbstractMetric<Long> implements CounterMetric<Long> {
private static final IllegalArgumentException NEGATIVE_COUNT_EXCEPTION = new IllegalArgumentException("Counters can not be incremented by negative values");
private LongAdder longAdder;
/**
* Constructor
*
* @param name The name of this metric. This value may be used for display purposes.
*/
public LongCounter(String name) {
super(name);
longAdder = new LongAdder();
}
@Override
public MetricType getType() {
return MetricType.COUNTER_LONG;
}
@Override
public Long getValue() {
return longAdder.longValue();
}
@Override
public void increment() {
increment(1l);
}
@Override
public void increment(Long by) {
if (by < 0) {
throw NEGATIVE_COUNT_EXCEPTION;
}
longAdder.add(by);
}
/**
* Optimized version of {@link #increment(Long)} to avoid auto-boxing.
* @param by The value which to increment by. Can not be negative.
*/
public void increment(long by) {
if (by < 0) {
throw NEGATIVE_COUNT_EXCEPTION;
}
longAdder.add(by);
}
/**
* Resets the counter back to it's initial state.
*/
public void reset(){
//replacing since LongAdder#reset "is only effective if there are no concurrent updates", we can not make that guarantee
longAdder = new LongAdder();
}
}
| [
"jake.landis@elastic.co"
] | jake.landis@elastic.co |
dac5ea3fc002de88b0a86b2e8267451074242239 | d00af6c547e629983ff777abe35fc9c36b3b2371 | /jboss-all/jetty/src/main/org/mortbay/html/Input.java | 410082a08a8c15cd4b8de48de7b03bf9f716d10c | [] | no_license | aosm/JBoss | e4afad3e0d6a50685a55a45209e99e7a92f974ea | 75a042bd25dd995392f3dbc05ddf4bbf9bdc8cd7 | refs/heads/master | 2023-07-08T21:50:23.795023 | 2013-03-20T07:43:51 | 2013-03-20T07:43:51 | 8,898,416 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,820 | java | // ===========================================================================
// Copyright (c) 1996 Mort Bay Consulting Pty. Ltd. All rights reserved.
// $Id: Input.java,v 1.15.2.3 2003/06/04 04:47:37 starksm Exp $
// ---------------------------------------------------------------------------
package org.mortbay.html;
/* -------------------------------------------------------------------- */
/** HTML Form Input Tag.
* <p>
* @see Tag
* @see Form
* @version $Id: Input.java,v 1.15.2.3 2003/06/04 04:47:37 starksm Exp $
* @author Greg Wilkins
*/
public class Input extends Tag
{
/* ----------------------------------------------------------------- */
/** Input types */
public final static String Text="text";
public final static String Password="password";
public final static String Checkbox="checkbox";
public final static String Radio="radio";
public final static String Submit="submit";
public final static String Reset="reset";
public final static String Hidden="hidden";
public final static String File="file";
public final static String Image="image";
/* ----------------------------------------------------------------- */
public Input(String type,String name)
{
super("input");
attribute("type",type);
attribute("name",name);
}
/* ----------------------------------------------------------------- */
public Input(String type,String name, String value)
{
this(type,name);
attribute("value",value);
}
/* ----------------------------------------------------------------- */
public Input(Image image,String name, String value)
{
super("input");
attribute("type","image");
attribute("name",name);
if (value!=null)
attribute("value",value);
attribute(image.attributes());
}
/* ----------------------------------------------------------------- */
public Input(Image image,String name)
{
super("input");
attribute("type","image");
attribute("name",name);
attribute(image.attributes());
}
/* ----------------------------------------------------------------- */
public Input check()
{
attribute("checked");
return this;
}
/* ----------------------------------------------------------------- */
public Input setSize(int size)
{
size(size);
return this;
}
/* ----------------------------------------------------------------- */
public Input setMaxSize(int size)
{
attribute("maxlength",size);
return this;
}
/* ----------------------------------------------------------------- */
public Input fixed()
{
setMaxSize(size());
return this;
}
}
| [
"rasmus@dll.nu"
] | rasmus@dll.nu |
2df1538e18797249b0b33bc62e3cfb0f81fc43f4 | 4db6c5146d1450cdd346af800d598dc845151b38 | /src/main/java/at/ac/tuwien/student/e01526624/backend/service/ModelManager.java | 0451ee41c689412226feb5424a7ee84d8cc13050 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | jjnp/dss-ue2 | 66a515c1ec837cd702bc83611235db274abb2c29 | 83aedf456be1fc7b09dee22ca1be52cc93e7beda | refs/heads/master | 2022-11-21T11:27:39.069654 | 2020-07-09T02:50:26 | 2020-07-09T02:50:26 | 278,241,720 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,023 | java | package at.ac.tuwien.student.e01526624.backend.service;
import org.apache.jena.ontology.*;
import org.apache.jena.query.Dataset;
import org.apache.jena.query.ReadWrite;
import org.apache.jena.rdf.model.*;
import org.apache.jena.tdb.TDBFactory;
import org.springframework.stereotype.Component;
@Component
public class ModelManager {
public static final String NS = "http://www.jacobpalecek.com/01526624/dss-ue2-ss20/excel#";
public static final String MODEL_NAME = "ExcelRdfModel";
public static final String DATASET_LOCATION = "target/ds";
public static final String CELL_URI = NS + "Cell";
public static final String PURE_CELL_URI = NS + "PureCell";
public static final String CALCULATED_CELL_URI = NS + "CalculatedCell";
public static final String CELL_VALUE_URI = NS + "cell_value";
public static final String CELL_WORKSHEET_URI = NS + "worksheet";
public static final String CELL_WORKBOOK_URI = NS + "workbook";
public static final String CELL_COLUMN_URI = NS + "cell_column";
public static final String CELL_ROW_URI = NS + "cell_row";
public static final String CELL_USESVALUEFROM_URI = NS + "usesValueFrom";
public static final String CELL_FORMULA_URI = NS + "cell_formula";
public static final String FILE_NAME_URI = NS + "filename";
public static final String FILE_HASH_URI = NS + "filehash";
public static final String EXCEL_FILE_URI = NS + "ExcelFile";
private OntModel excelModel;
private OntModel inferencedExcelModel;
private Dataset dataset;
public OntClass cell;
public OntClass pureCell;
public OntClass calculatedCell;
public OntClass excelFile;
public DatatypeProperty cellValue;
public DatatypeProperty cellWorksheet;
public DatatypeProperty cellColumn;
public DatatypeProperty cellRow;
public DatatypeProperty cellFormula;
public DatatypeProperty filename;
public DatatypeProperty filehash;
public ObjectProperty cellUsesValueFrom;
public ObjectProperty cellWorkbook;
public ModelManager() {
this.initialize();
}
public void beginTx() {
if (!this.dataset.isInTransaction()) {
this.dataset.begin(ReadWrite.WRITE);
}
}
public void endTx() {
this.dataset.commit();
this.dataset.end();
}
public OntModel getExcelModel() {
return excelModel;
}
public OntModel getInferencedExcelModel() {
return inferencedExcelModel;
}
public void saveModel() {
if (this.dataset.isInTransaction()) {
this.dataset.commit();
this.dataset.end();
}
this.dataset.begin(ReadWrite.WRITE);
// this.dataset.replaceNamedModel(MODEL_NAME, model);
this.dataset.commit();
this.dataset.end();
}
private void initialize() {
this.dataset = TDBFactory.createDataset(DATASET_LOCATION);
if (!this.dataset.containsNamedModel(MODEL_NAME)) {
createInitialDataset();
}
loadModels();
loadOntologyArtifacts();
}
private void loadModels() {
this.dataset.begin(ReadWrite.READ);
Model base = this.dataset.getNamedModel(MODEL_NAME);
this.excelModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, base);
this.inferencedExcelModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, base);
this.dataset.commit();
this.dataset.end();
}
private void loadOntologyArtifacts() {
this.dataset.begin(ReadWrite.READ);
this.cell = this.excelModel.getOntClass(CELL_URI);
this.pureCell = this.excelModel.getOntClass(PURE_CELL_URI);
this.excelFile = this.excelModel.getOntClass(EXCEL_FILE_URI);
this.calculatedCell = this.excelModel.getOntClass(CALCULATED_CELL_URI);
this.cellValue = this.excelModel.getDatatypeProperty(CELL_VALUE_URI);
this.cellWorksheet = this.excelModel.getDatatypeProperty(CELL_WORKSHEET_URI); // not working somehow
this.cellRow = this.excelModel.getDatatypeProperty(CELL_ROW_URI);
this.cellColumn = this.excelModel.getDatatypeProperty(CELL_COLUMN_URI);
this.cellFormula = this.excelModel.getDatatypeProperty(CELL_FORMULA_URI);
this.filehash = this.excelModel.getDatatypeProperty(FILE_HASH_URI);
this.filename = this.excelModel.getDatatypeProperty(FILE_NAME_URI);
this.cellWorkbook = this.excelModel.getObjectProperty(CELL_WORKBOOK_URI);
this.cellUsesValueFrom = this.excelModel.getObjectProperty(CELL_USESVALUEFROM_URI);
this.dataset.end();
}
private void createInitialDataset() {
System.out.println("Creating initial dataset");
this.dataset.begin(ReadWrite.WRITE);
OntModel base = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
base.read("ontology/excel_ontology.owl");
this.dataset.addNamedModel(MODEL_NAME, base);
this.dataset.commit();
this.dataset.end();
}
}
| [
"jacob.palecek@outlook.com"
] | jacob.palecek@outlook.com |
4c070ef7bda03f8a56214549cadd43aa15add9dc | 61fcf94ee170f516448ed8bbe3ee9ddaa6781239 | /app/src/main/java/com/example/crime/missingcrime/AdminHome.java | 0ebb2ecf1d2e5c999e0e8737c7a1af4f3a544172 | [] | no_license | narayandudhe/CrimeReport | 5a6febca897dd653cf437a614079cb18c6bf955f | f429fdbeacc1c13fb7aba356dc8d06d7e4d36a22 | refs/heads/master | 2020-05-31T01:34:34.430414 | 2019-06-03T17:35:57 | 2019-06-03T17:35:57 | 190,052,072 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,359 | java | package com.example.crime.missingcrime;
import android.Manifest;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.CardView;
import android.telephony.SmsManager;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.example.crime.missingcrime.Model.UserModel;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
public class AdminHome extends AppCompatActivity {
private static final String TAG = "MissingPersonMenuActivity";
private static final int ERROR_DIALOG_REQUEST = 9001;
private FirebaseAuth mAuth;
private FirebaseUser user;
public UserModel userModel;
Button send;
TextView textView;
public FirebaseDatabase database;
CardView add,list,myReports;
private FusedLocationProviderClient client;
private LocationManager locationManager;
private com.google.android.gms.location.LocationListener listener;
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_home);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mAuth = FirebaseAuth.getInstance();
user = FirebaseAuth.getInstance().getCurrentUser();
if(checkAndRequestPermissions()) {
// carry on the normal flow, as the case of permissions granted.
}
textView = findViewById(R.id.location);
database = FirebaseDatabase.getInstance();
client = LocationServices.getFusedLocationProviderClient(this);
cardView();
}
@Override
protected void onStart() {
super.onStart();
if (user != null) {
// User is signed in
} else {
Intent intentLogin= new Intent(this, SignInActivity.class );
startActivity(intentLogin);
}
}
public boolean isServicesOK(){
int available = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(AdminHome.this);
if(available == ConnectionResult.SUCCESS){
//everything is fine and the user can make map requests
Toast.makeText(this, "isServicesOK: Google Play Services is working", Toast.LENGTH_SHORT).show();
return true;
}
else if(GoogleApiAvailability.getInstance().isUserResolvableError(available)){
//an error occured but we can resolve it
Toast.makeText(this, "isServicesOK: an error occured but we can fix it", Toast.LENGTH_SHORT).show();
Dialog dialog = GoogleApiAvailability.getInstance().getErrorDialog(AdminHome.this, available, ERROR_DIALOG_REQUEST);
dialog.show();
}else{
Toast.makeText(this, "You can't make map requests", Toast.LENGTH_SHORT).show();
}
return false;
}
public void cardView()
{
list=(CardView)findViewById(R.id.reportList);
myReports=(CardView)findViewById(R.id.myReports);
// on click
list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
reportList();
}
});
myReports.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
myReport();
}
});
}
void signOut()
{
FirebaseAuth.getInstance().signOut();
Intent intent = new Intent(AdminHome.this, SignInActivity.class);
startActivity(intent);
finish();
return;
}
private void requestPermission(){
ActivityCompat.requestPermissions(this, new String[]{ACCESS_FINE_LOCATION}, 1);
if (ContextCompat.checkSelfPermission(this,
android.Manifest.permission.SEND_SMS)
!= PackageManager.PERMISSION_GRANTED)
{
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
android.Manifest.permission.SEND_SMS))
{
Toast.makeText(getBaseContext(),
"App requires permission to send SMS",
Toast.LENGTH_SHORT).show();
}
else
{
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.SEND_SMS},
1);
}
} }
private boolean checkAndRequestPermissions() {
int permissionSendMessage = ContextCompat.checkSelfPermission(this,
android.Manifest.permission.SEND_SMS);
int locationPermission = ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION);
List<String> listPermissionsNeeded = new ArrayList<>();
if (locationPermission != PackageManager.PERMISSION_GRANTED) {
listPermissionsNeeded.add(android.Manifest.permission.ACCESS_FINE_LOCATION);
}
if (permissionSendMessage != PackageManager.PERMISSION_GRANTED) {
listPermissionsNeeded.add(Manifest.permission.SEND_SMS);
}
if (!listPermissionsNeeded.isEmpty()) {
ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]),REQUEST_ID_MULTIPLE_PERMISSIONS);
return false;
}
return true;
}
public void addReport()
{
Intent intentAddCrime = new Intent(this, AddReportActivity.class);
startActivity(intentAddCrime);
}
public void reportList()
{
Intent intentReportList = new Intent(this, AdminReports.class);
startActivity(intentReportList);
}
public void myReport()
{
Intent myReports = new Intent(this, ApproveActivity.class);
startActivity(myReports);
}
public void emergencyContact()
{
Intent intentContacts = new Intent(this, ContactsActvity.class);
startActivity(intentContacts);
}
}
| [
"narayandudhe@users.noreply.github.com"
] | narayandudhe@users.noreply.github.com |
c571b975bb65dadf11860a99aea4e67765f2edfa | 32b2a0072c0d740c081e0c8dece3ee1cf7123804 | /src/main/java/com/rainier/strategypattern/promotionscenario/HolidayPromotionFactory.java | c27ce120050c73622cf709aef8b4db202e22a9f1 | [] | no_license | aiyun-app/design-pattern | f90b96c7d9cd2e7146922c6475220767afb1f067 | 077d5754c66f5818f9ac2d4f50768492e78757da | refs/heads/master | 2021-03-23T19:38:33.101083 | 2019-03-24T15:32:20 | 2019-03-24T15:32:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package com.rainier.strategypattern.promotionscenario;
import java.time.LocalDate;
public class HolidayPromotionFactory {
public static HolidayPromotion getPromotion(){
LocalDate date = LocalDate.now();
int month = date.getMonthValue();
int day = date.getDayOfMonth();
if (month == 10 && day >=1 && day <= 7 ){
return new NationalDayPromotion();
}
else if (month == 2 && day >= 4 && day <= 10){
return new SpringFestivalPromotion();
}
else {
return new DefaultHolidayPromotion();
}
}
}
| [
"1712737559@qq.com"
] | 1712737559@qq.com |
eb000a6d1c48edda9203a65d71b4a578a2bdb7ff | ea2f0f5b5bb494f816d8e9a236199a55827c945b | /java-estacionamento-backend/src/main/java/com/backend/test/java/JavaEstacionamentoBackendApplication.java | a8493cf908d7bf565c8da384f86220c790a5d227 | [] | no_license | 94rodrigo/backend-test-java | 3293235ab5cc467a2da048270a74db2d002ca460 | addb4e3c10498b5da13fd5215d58889ccbd69f67 | refs/heads/master | 2021-03-31T09:23:32.916082 | 2020-05-01T16:01:01 | 2020-05-01T16:01:01 | 248,096,608 | 0 | 0 | null | 2020-03-17T23:47:25 | 2020-03-17T23:47:24 | null | UTF-8 | Java | false | false | 352 | java | package com.backend.test.java;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JavaEstacionamentoBackendApplication {
public static void main(String[] args) {
SpringApplication.run(JavaEstacionamentoBackendApplication.class, args);
}
}
| [
"rodrigoc94@hotmail.com"
] | rodrigoc94@hotmail.com |
3b806ed29bd0730c8e0784541978530a97d002d4 | 85aa9949fc6ff7e44eff58631d0950fd76907d3f | /src/Also/Classes/BorderTools.java | ffd1e7a08abd38f5701bc02a553bea28b17d4780 | [] | no_license | PlumIk/PathOfPaint | bc43bb79070b2e7d81bb810ba99093237c8ae6fc | 68018b8c82b051ec1d29cc1333cdf54661b0f56b | refs/heads/main | 2023-03-09T00:51:22.239090 | 2021-02-22T06:35:05 | 2021-02-22T06:35:05 | 341,103,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package Also.Classes;
import javax.swing.*;
import java.awt.*;
public class BorderTools {
public JButton ChBottomAk=null;
public JButton ChBottomCo=null;
public void NewCol(JButton NewBot){
ChBottomCo.setSelected(false);
ChBottomCo=NewBot;
ChBottomCo.setSelected(true);
}
public void NewAk(JButton NewBot){
if (ChBottomAk != null) {
ChBottomAk.setSelected(false);
}
ChBottomAk=NewBot;
ChBottomAk.setSelected(true);
}
}
| [
"a.chemagin@g.nsu.ru"
] | a.chemagin@g.nsu.ru |
560377673bf5d465df3b220eeade41895e9103a3 | 81cf7eb8613af1d178e85888cc15e74669f69273 | /app/src/test/java/quotes/AppTest.java | 30839d7eb9c923681aeb19576bea13e1d482ed01 | [] | no_license | ahmedbani/quotes | 975cd67a752b922abec6ed3a897e19954b6da52d | 37c35ef7879e6f93278c3027028fe5ebd4cddc42 | refs/heads/main | 2023-09-01T16:34:07.765323 | 2021-10-26T08:50:59 | 2021-10-26T08:50:59 | 419,364,957 | 0 | 0 | null | 2021-10-20T16:39:22 | 2021-10-20T14:29:31 | null | UTF-8 | Java | false | false | 3,106 | java | /*
* This Java source file was generated by the Gradle 'init' task.
*/
package quotes;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.junit.jupiter.api.Test;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.Arrays;
import static org.junit.jupiter.api.Assertions.*;
class AppTest {
Gson gson = new Gson();
@Test void gson() throws FileNotFoundException {
Reader reader = new FileReader("/Users/macbookpro/projects/401/quotes/app/src/main/resources/data.json");
Quotes [] quotesArray = gson.fromJson(reader,Quotes[].class);
Quotes quote = quotesArray[5];
String text = "{\"author\":\"ahmed\",\"text\":\"roses are red\"}";
Quotes quote1 = gson.fromJson(text,Quotes.class);
assertTrue(Arrays.asList(quotesArray).contains(quote));
assertFalse(Arrays.asList(quotesArray).contains(quote1));
assertEquals("{\"author\":\"Marilyn Monroe\",\"text\": “I am good, but not an angel. I do sin, but I am not the devil. I am just a small girl in a big world trying to find someone to love.” }",quotesArray[0].toString());
}
@Test void testApi() throws IOException {
Gson gson = new Gson();
URL url = new URL("http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
InputStream inputStream = connection.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader input = new BufferedReader(inputStreamReader);
String quote = input.readLine();
ApiQuotes newQuote = gson.fromJson(quote, ApiQuotes.class);
System.out.println(newQuote);
try {
Object obj = JsonParser.parseReader(new FileReader("/Users/macbookpro/projects/401/quotes/app/src/main/resources/Data.json"));
JsonArray jsonArray = (JsonArray)obj;
JsonObject quoteToAdd = new JsonObject();
quoteToAdd.addProperty("author",newQuote.getQuoteAuthor());
quoteToAdd.addProperty("quote",newQuote.getQuoteText());
jsonArray.add(quoteToAdd);
System.out.println(jsonArray.get(jsonArray.size()-1));
FileWriter file = new FileWriter("/Users/macbookpro/projects/401/quotes/app/src/main/resources/Data.json");
file.write(jsonArray.toString());
file.flush();
file.close();
assertTrue(jsonArray.contains(quoteToAdd));
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"a13banisal@gmail.com"
] | a13banisal@gmail.com |
72e02d70e8117315303367885c941a13668d0c64 | 31f7f0a21dddbd4437bae55bad7f1a2d4bb10f77 | /src/main/java/omtteam/omlib/reference/Reference.java | a57ceba1cb0f025830ee78d59bd74ed840a34544 | [
"MIT"
] | permissive | OpenModularTurretsTeam/OMLib | 948b22155152c9aab9863c4151dec23b9b780584 | 2a70145d7ee2993c765048146e184bfd6597c059 | refs/heads/1.12 | 2022-05-11T14:44:30.182699 | 2021-08-12T10:12:15 | 2021-08-12T10:18:59 | 74,905,225 | 6 | 10 | MIT | 2018-03-28T18:55:31 | 2016-11-27T18:08:37 | Java | UTF-8 | Java | false | false | 468 | java | package omtteam.omlib.reference;
import static omtteam.omlib.compatibility.OMLibModCompatibility.*;
public class Reference {
public static final String MOD_ID = "omlib";
public static final String NAME = "OMLib";
public static final String VERSION = "@VERSION@";
public static final String DEPENDENCIES = "after:" + TEModID + ";after:" + CCModID + ";after:" + MekModID +
";after:" + EIOModID + ";after:" + TCModID + ";after:" + OCModID;
} | [
"2742845+Keridos@users.noreply.github.com"
] | 2742845+Keridos@users.noreply.github.com |
440ba3f910d3043726876ae33f4f5e446cfe72b9 | 379729a2a64021d6af30d0a980d420769e83b3c0 | /YiBoLibrary/src/com/cattong/commons/util/Base64.java | adb8948fed6e6677681172e3ed4c3e5fcd00873f | [
"Apache-2.0"
] | permissive | Terry-L/YiBo | 632e81ab27d104c73fda0c36e277d77b61a23255 | 6c5709c839722553b963cfb0c883fcd6cf99f8c7 | refs/heads/master | 2021-01-01T17:48:00.816313 | 2013-12-06T08:26:53 | 2013-12-06T08:26:53 | 14,976,533 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 26,069 | java | package com.cattong.commons.util;
/*
* Copyright 2001-2008 The Apache Software Foundation.
* 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.
*/
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
/**
* Provides Base64 encoding and decoding as defined by RFC 2045.
*
* <p>
* This class implements section <cite>6.8. Base64 Content-Transfer-Encoding</cite> from RFC 2045 <cite>Multipurpose
* Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</cite> by Freed and Borenstein.
* </p>
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>
* @author Apache Software Foundation
* @author John Kristian
*/
public class Base64 {
/**
* Chunk size per RFC 2045 section 6.8.
*
* <p>
* The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any
* equal signs.
* </p>
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 6.8</a>
*/
static final int CHUNK_SIZE = 76;
/**
* Chunk separator per RFC 2045 section 2.1.
*
* @see <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 section 2.1</a>
*/
static final byte[] CHUNK_SEPARATOR = {'\r', '\n'};
/**
* This array is a lookup table that translates 6-bit positive integer
* index values into their "Base64 Alphabet" equivalents as specified
* in Table 1 of RFC 2045.
*
* Thanks to "commons" project in ws.apache.org for this code.
* http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
*/
private static final byte[] intToBase64 = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
/**
* Byte used to pad output.
*/
private static final byte PAD = '=';
/**
* This array is a lookup table that translates unicode characters
* drawn from the "Base64 Alphabet" (as specified in Table 1 of RFC 2045)
* into their 6-bit positive integer equivalents. Characters that
* are not in the Base64 alphabet but fall within the bounds of the
* array are translated to -1.
*
* Thanks to "commons" project in ws.apache.org for this code.
* http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
*/
private static final byte[] base64ToInt = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54,
55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
};
/** Mask used to extract 6 bits, used when encoding */
private static final int MASK_6BITS = 0x3f;
/** Mask used to extract 8 bits, used in decoding base64 bytes */
private static final int MASK_8BITS = 0xff;
// The static final fields above are used for the original static byte[] methods on Base64.
// The private member fields below are used with the new streaming approach, which requires
// some state be preserved between calls of encode() and decode().
/**
* Line length for encoding. Not used when decoding. A value of zero or less implies
* no chunking of the base64 encoded data.
*/
private final int lineLength;
/**
* Line separator for encoding. Not used when decoding. Only used if lineLength > 0.
*/
private final byte[] lineSeparator;
/**
* Convenience variable to help us determine when our buffer is going to run out of
* room and needs resizing. <code>decodeSize = 3 + lineSeparator.length;</code>
*/
private final int decodeSize;
/**
* Convenience variable to help us determine when our buffer is going to run out of
* room and needs resizing. <code>encodeSize = 4 + lineSeparator.length;</code>
*/
private final int encodeSize;
/**
* Buffer for streaming.
*/
private byte[] buf;
/**
* Position where next character should be written in the buffer.
*/
private int pos;
/**
* Position where next character should be read from the buffer.
*/
private int readPos;
/**
* Variable tracks how many characters have been written to the current line.
* Only used when encoding. We use it to make sure each encoded line never
* goes beyond lineLength (if lineLength > 0).
*/
private int currentLinePos;
/**
* Writes to the buffer only occur after every 3 reads when encoding, an
* every 4 reads when decoding. This variable helps track that.
*/
private int modulus;
/**
* Boolean flag to indicate the EOF has been reached. Once EOF has been
* reached, this Base64 object becomes useless, and must be thrown away.
*/
private boolean eof;
/**
* Place holder for the 3 bytes we're dealing with for our base64 logic.
* Bitwise operations store and extract the base64 encoding or decoding from
* this variable.
*/
private int x;
/**
* Default constructor: lineLength is 76, and the lineSeparator is CRLF
* when encoding, and all forms can be decoded.
*/
public Base64() {
this(CHUNK_SIZE, CHUNK_SEPARATOR);
}
/**
* <p>
* Consumer can use this constructor to choose a different lineLength
* when encoding (lineSeparator is still CRLF). All forms of data can
* be decoded.
* </p><p>
* Note: lineLengths that aren't multiples of 4 will still essentially
* end up being multiples of 4 in the encoded data.
* </p>
*
* @param lineLength each line of encoded data will be at most this long
* (rounded up to nearest multiple of 4).
* If lineLength <= 0, then the output will not be divided into lines (chunks).
* Ignored when decoding.
*/
public Base64(int lineLength) {
this(lineLength, CHUNK_SEPARATOR);
}
/**
* <p>
* Consumer can use this constructor to choose a different lineLength
* and lineSeparator when encoding. All forms of data can
* be decoded.
* </p><p>
* Note: lineLengths that aren't multiples of 4 will still essentially
* end up being multiples of 4 in the encoded data.
* </p>
* @param lineLength Each line of encoded data will be at most this long
* (rounded up to nearest multiple of 4). Ignored when decoding.
* If <= 0, then output will not be divided into lines (chunks).
* @param lineSeparator Each line of encoded data will end with this
* sequence of bytes.
* If lineLength <= 0, then the lineSeparator is not used.
* @throws IllegalArgumentException The provided lineSeparator included
* some base64 characters. That's not going to work!
*/
public Base64(int lineLength, byte[] lineSeparator) {
this.lineLength = lineLength;
this.lineSeparator = new byte[lineSeparator.length];
System.arraycopy(lineSeparator, 0, this.lineSeparator, 0, lineSeparator.length);
if (lineLength > 0) {
this.encodeSize = 4 + lineSeparator.length;
} else {
this.encodeSize = 4;
}
this.decodeSize = encodeSize - 1;
if (containsBase64Byte(lineSeparator)) {
String sep;
try {
sep = new String(lineSeparator, "UTF-8");
} catch (UnsupportedEncodingException uee) {
sep = new String(lineSeparator);
}
throw new IllegalArgumentException("lineSeperator must not contain base64 characters: [" + sep + "]");
}
}
/**
* Returns true if this Base64 object has buffered data for reading.
*
* @return true if there is Base64 object still available for reading.
*/
boolean hasData() { return buf != null; }
/**
* Returns the amount of buffered data available for reading.
*
* @return The amount of buffered data available for reading.
*/
int avail() { return buf != null ? pos - readPos : 0; }
/** Doubles our buffer. */
private void resizeBuf() {
if (buf == null) {
buf = new byte[8192];
pos = 0;
readPos = 0;
} else {
byte[] b = new byte[buf.length * 2];
System.arraycopy(buf, 0, b, 0, buf.length);
buf = b;
}
}
/**
* Extracts buffered data into the provided byte[] array, starting
* at position bPos, up to a maximum of bAvail bytes. Returns how
* many bytes were actually extracted.
*
* @param b byte[] array to extract the buffered data into.
* @param bPos position in byte[] array to start extraction at.
* @param bAvail amount of bytes we're allowed to extract. We may extract
* fewer (if fewer are available).
* @return The number of bytes successfully extracted into the provided
* byte[] array.
*/
int readResults(byte[] b, int bPos, int bAvail) {
if (buf != null) {
int len = Math.min(avail(), bAvail);
if (buf != b) {
System.arraycopy(buf, readPos, b, bPos, len);
readPos += len;
if (readPos >= pos) {
buf = null;
}
} else {
// Re-using the original consumer's output array is only
// allowed for one round.
buf = null;
}
return len;
} else {
return eof ? -1 : 0;
}
}
/**
* Small optimization where we try to buffer directly to the consumer's
* output array for one round (if consumer calls this method first!) instead
* of starting our own buffer.
*
* @param out byte[] array to buffer directly to.
* @param outPos Position to start buffering into.
* @param outAvail Amount of bytes available for direct buffering.
*/
void setInitialBuffer(byte[] out, int outPos, int outAvail) {
// We can re-use consumer's original output array under
// special circumstances, saving on some System.arraycopy().
if (out != null && out.length == outAvail) {
buf = out;
pos = outPos;
readPos = outPos;
}
}
/**
* <p>
* Encodes all of the provided data, starting at inPos, for inAvail bytes.
* Must be called at least twice: once with the data to encode, and once
* with inAvail set to "-1" to alert encoder that EOF has been reached,
* so flush last remaining bytes (if not multiple of 3).
* </p><p>
* Thanks to "commons" project in ws.apache.org for the bitwise operations,
* and general approach.
* http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
* </p>
*
* @param in byte[] array of binary data to base64 encode.
* @param inPos Position to start reading data from.
* @param inAvail Amount of bytes available from input for encoding.
*/
void encode(byte[] in, int inPos, int inAvail) {
if (eof) {
return;
}
// inAvail < 0 is how we're informed of EOF in the underlying data we're
// encoding.
if (inAvail < 0) {
eof = true;
if (buf == null || buf.length - pos < encodeSize) {
resizeBuf();
}
switch (modulus) {
case 1:
buf[pos++] = intToBase64[(x >> 2) & MASK_6BITS];
buf[pos++] = intToBase64[(x << 4) & MASK_6BITS];
buf[pos++] = PAD;
buf[pos++] = PAD;
break;
case 2:
buf[pos++] = intToBase64[(x >> 10) & MASK_6BITS];
buf[pos++] = intToBase64[(x >> 4) & MASK_6BITS];
buf[pos++] = intToBase64[(x << 2) & MASK_6BITS];
buf[pos++] = PAD;
break;
}
if (lineLength > 0) {
System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length);
pos += lineSeparator.length;
}
} else {
for (int i = 0; i < inAvail; i++) {
if (buf == null || buf.length - pos < encodeSize) {
resizeBuf();
}
modulus = (++modulus) % 3;
int b = in[inPos++];
if (b < 0) { b += 256; }
x = (x << 8) + b;
if (0 == modulus) {
buf[pos++] = intToBase64[(x >> 18) & MASK_6BITS];
buf[pos++] = intToBase64[(x >> 12) & MASK_6BITS];
buf[pos++] = intToBase64[(x >> 6) & MASK_6BITS];
buf[pos++] = intToBase64[x & MASK_6BITS];
currentLinePos += 4;
if (lineLength > 0 && lineLength <= currentLinePos) {
System.arraycopy(lineSeparator, 0, buf, pos, lineSeparator.length);
pos += lineSeparator.length;
currentLinePos = 0;
}
}
}
}
}
/**
* <p>
* Decodes all of the provided data, starting at inPos, for inAvail bytes.
* Should be called at least twice: once with the data to decode, and once
* with inAvail set to "-1" to alert decoder that EOF has been reached.
* The "-1" call is not necessary when decoding, but it doesn't hurt, either.
* </p><p>
* Ignores all non-base64 characters. This is how chunked (e.g. 76 character)
* data is handled, since CR and LF are silently ignored, but has implications
* for other bytes, too. This method subscribes to the garbage-in, garbage-out
* philosophy: it will not check the provided data for validity.
* </p><p>
* Thanks to "commons" project in ws.apache.org for the bitwise operations,
* and general approach.
* http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/
* </p>
* @param in byte[] array of ascii data to base64 decode.
* @param inPos Position to start reading data from.
* @param inAvail Amount of bytes available from input for encoding.
*/
void decode(byte[] in, int inPos, int inAvail) {
if (eof) {
return;
}
if (inAvail < 0) {
eof = true;
}
for (int i = 0; i < inAvail; i++) {
if (buf == null || buf.length - pos < decodeSize) {
resizeBuf();
}
byte b = in[inPos++];
if (b == PAD) {
x = x << 6;
switch (modulus) {
case 2:
x = x << 6;
buf[pos++] = (byte) ((x >> 16) & MASK_8BITS);
break;
case 3:
buf[pos++] = (byte) ((x >> 16) & MASK_8BITS);
buf[pos++] = (byte) ((x >> 8) & MASK_8BITS);
break;
}
// WE'RE DONE!!!!
eof = true;
return;
} else {
if (b >= 0 && b < base64ToInt.length) {
int result = base64ToInt[b];
if (result >= 0) {
modulus = (++modulus) % 4;
x = (x << 6) + result;
if (modulus == 0) {
buf[pos++] = (byte) ((x >> 16) & MASK_8BITS);
buf[pos++] = (byte) ((x >> 8) & MASK_8BITS);
buf[pos++] = (byte) (x & MASK_8BITS);
}
}
}
}
}
}
/**
* Returns whether or not the <code>octet</code> is in the base 64 alphabet.
*
* @param octet
* The value to test
* @return <code>true</code> if the value is defined in the the base 64 alphabet, <code>false</code> otherwise.
*/
public static boolean isBase64(byte octet) {
return octet == PAD || (octet >= 0 && octet < base64ToInt.length && base64ToInt[octet] != -1);
}
/**
* Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.
* Currently the method treats whitespace as valid.
*
* @param arrayOctet
* byte array to test
* @return <code>true</code> if all bytes are valid characters in the Base64 alphabet or if the byte array is
* empty; false, otherwise
*/
public static boolean isArrayByteBase64(byte[] arrayOctet) {
for (int i = 0; i < arrayOctet.length; i++) {
if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) {
return false;
}
}
return true;
}
/*
* Tests a given byte array to see if it contains only valid characters within the Base64 alphabet.
*
* @param arrayOctet
* byte array to test
* @return <code>true</code> if any byte is a valid character in the Base64 alphabet; false herwise
*/
private static boolean containsBase64Byte(byte[] arrayOctet) {
for (int i = 0; i < arrayOctet.length; i++) {
if (isBase64(arrayOctet[i])) {
return true;
}
}
return false;
}
/**
* Encodes binary data using the base64 algorithm but does not chunk the output.
*
* @param binaryData
* binary data to encode
* @return Base64 characters
*/
public static byte[] encodeBase64(byte[] binaryData) {
return encodeBase64(binaryData, false);
}
/**
* Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks
*
* @param binaryData
* binary data to encode
* @return Base64 characters chunked in 76 character blocks
*/
public static byte[] encodeBase64Chunked(byte[] binaryData) {
return encodeBase64(binaryData, true);
}
/**
* Decodes a byte[] containing containing characters in the Base64 alphabet.
*
* @param pArray
* A byte array containing Base64 character data
* @return a byte array containing binary data
*/
public byte[] decode(byte[] pArray) {
return decodeBase64(pArray);
}
/**
* Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.
*
* @param binaryData
* Array containing binary data to encode.
* @param isChunked
* if <code>true</code> this encoder will chunk the base64 output into 76 character blocks
* @return Base64-encoded data.
* @throws IllegalArgumentException
* Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE}
*/
public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
if (binaryData == null || binaryData.length == 0) {
return binaryData;
}
Base64 b64 = isChunked ? new Base64() : new Base64(0);
long len = (binaryData.length * 4) / 3;
long mod = len % 4;
if (mod != 0) {
len += 4 - mod;
}
if (isChunked) {
len += (1 + (len / CHUNK_SIZE)) * CHUNK_SEPARATOR.length;
}
if (len > Integer.MAX_VALUE) {
throw new IllegalArgumentException(
"Input array too big, output array would be bigger than Integer.MAX_VALUE=" + Integer.MAX_VALUE);
}
byte[] buf = new byte[(int) len];
b64.setInitialBuffer(buf, 0, buf.length);
b64.encode(binaryData, 0, binaryData.length);
b64.encode(binaryData, 0, -1); // Notify encoder of EOF.
// Encoder might have resized, even though it was unnecessary.
if (b64.buf != buf) {
b64.readResults(buf, 0, buf.length);
}
return buf;
}
/**
* Decodes Base64 data into octets
*
* @param base64Data Byte array containing Base64 data
* @return Array containing decoded data.
*/
public static byte[] decodeBase64(byte[] base64Data) {
if (base64Data == null || base64Data.length == 0) {
return base64Data;
}
Base64 b64 = new Base64();
long len = (base64Data.length * 3) / 4;
byte[] buf = new byte[(int) len];
b64.setInitialBuffer(buf, 0, buf.length);
b64.decode(base64Data, 0, base64Data.length);
b64.decode(base64Data, 0, -1); // Notify decoder of EOF.
// We have no idea what the line-length was, so we
// cannot know how much of our array wasn't used.
byte[] result = new byte[b64.pos];
b64.readResults(result, 0, result.length);
return result;
}
/**
* Check if a byte value is whitespace or not.
*
* @param byteToCheck the byte to check
* @return true if byte is whitespace, false otherwise
*/
private static boolean isWhiteSpace(byte byteToCheck){
switch (byteToCheck) {
case ' ' :
case '\n' :
case '\r' :
case '\t' :
return true;
default :
return false;
}
}
/**
* Discards any characters outside of the base64 alphabet, per the requirements on page 25 of RFC 2045 - "Any
* characters outside of the base64 alphabet are to be ignored in base64 encoded data."
*
* @param data
* The base-64 encoded data to groom
* @return The data, less non-base64 characters (see RFC 2045).
*/
static byte[] discardNonBase64(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
if (isBase64(data[i])) {
groomedData[bytesCopied++] = data[i];
}
}
byte packedData[] = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
return packedData;
}
// Implementation of the Encoder Interface
/**
* Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
*
* @param pArray
* a byte array containing binary data
* @return A byte array containing only Base64 character data
*/
public byte[] encode(byte[] pArray) {
return encodeBase64(pArray, false);
}
// Implementation of integer encoding used for crypto
/**
* Decode a byte64-encoded integer according to crypto
* standards such as W3C's XML-Signature
*
* @param pArray a byte array containing base64 character data
* @return A BigInteger
*/
public static BigInteger decodeInteger(byte[] pArray) {
return new BigInteger(1, decodeBase64(pArray));
}
/**
* Encode to a byte64-encoded integer according to crypto
* standards such as W3C's XML-Signature
*
* @param bigInt a BigInteger
* @return A byte array containing base64 character data
* @throws NullPointerException if null is passed in
*/
public static byte[] encodeInteger(BigInteger bigInt) {
if (bigInt == null) {
throw new NullPointerException("encodeInteger called with null parameter");
}
return encodeBase64(toIntegerBytes(bigInt), false);
}
/**
* Returns a byte-array representation of a <code>BigInteger</code>
* without sign bit.
*
* @param bigInt <code>BigInteger</code> to be converted
* @return a byte array representation of the BigInteger parameter
*/
static byte[] toIntegerBytes(BigInteger bigInt) {
int bitlen = bigInt.bitLength();
// round bitlen
bitlen = ((bitlen + 7) >> 3) << 3;
byte[] bigBytes = bigInt.toByteArray();
if (((bigInt.bitLength() % 8) != 0) &&
(((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) {
return bigBytes;
}
// set up params for copying everything but sign bit
int startSrc = 0;
int len = bigBytes.length;
// if bigInt is exactly byte-aligned, just skip signbit in copy
if ((bigInt.bitLength() % 8) == 0) {
startSrc = 1;
len--;
}
int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec
byte[] resizedBytes = new byte[bitlen / 8];
System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len);
return resizedBytes;
}
}
| [
"liutianyi0204@gmail.com"
] | liutianyi0204@gmail.com |
949a1b86e3f1ec7e539c4ed4e8a0185e9f1808e8 | 2fc61092f6b10492f88bb4b20dc181ee5f49580f | /app/src/main/java/co/in/divi/ui/CountDownTimerView.java | e258a859112d9d0a13d493916f309009c470fc4f | [] | no_license | indra83/Divi2 | 9f51c67b102697652621338c050ef0b7577266b1 | 2ab9d9b7beb7bc7b9e7708ab54165f5305a14779 | refs/heads/master | 2023-04-22T00:46:17.642565 | 2021-05-10T07:50:35 | 2021-05-10T07:50:35 | 27,070,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,249 | java | package co.in.divi.ui;
import co.in.divi.util.Util;
import android.content.Context;
import android.os.Handler;
import android.text.Html;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
public class CountDownTimerView extends TextView {
private static final String TAG = CountDownTimerView.class.getSimpleName();
private static final long UPDATE_FREQUENCY = 499; // ms
public static final long FOREVER = Long.MAX_VALUE;
public interface CountDownTimerViewListener {
public void timerEvent();
}
private enum TimerState {
BEFORE, DURING, AFTER
}
private CountDownTimerViewListener listener = null;
private Handler handler;
private long endTime;
private String preText;
private TimerState curState;
private Runnable updateTextRunnable = new Runnable() {
@Override
public void run() {
long now = Util.getTimestampMillis();
if (now > endTime) {
if (listener != null)
listener.timerEvent();
stop();
return;
} else {
long diff_secs = (endTime - now) / 1000;
String text = preText
+ " <b>"
+ String.format("%02d:%02d", diff_secs / 60, diff_secs % 60)
+ "</b>";
setText(Html.fromHtml(text));
}
handler.postDelayed(updateTextRunnable, UPDATE_FREQUENCY);
}
};
public CountDownTimerView(Context context, AttributeSet attrs) {
super(context, attrs);
handler = new Handler();
}
public void start(long endTime, String preText, CountDownTimerViewListener listener) {
if (Util.getTimestampMillis() > endTime)
throw new RuntimeException("End time is in past!");
this.listener = listener;
this.preText = preText;
this.endTime = endTime;
handler.removeCallbacks(updateTextRunnable);
handler.post(updateTextRunnable);
setVisibility(View.VISIBLE);
}
public void stop() {
handler.removeCallbacks(updateTextRunnable);
listener = null;
setVisibility(View.INVISIBLE);
}
}
| [
"b.indraneel@gmail.com"
] | b.indraneel@gmail.com |
1a18e2645e14f94df4a87a07b3c0ccfdf8495d4f | 275226290cef9e77e6581416351ed25386339dd0 | /DecoratorPattern/src/main/java/com/guoyang/my/nyStarbuzz.java | f0d732e156873f63d2d62a468e575b5aaa0f82a8 | [] | no_license | PlumpMath/DesignPattern-652 | ec1979f9bfdb2eaf38cc1d1a73c64aa75d6192c7 | d48d8d8179d0f56c1cb5577a6408ec7a5c754590 | refs/heads/master | 2021-01-20T09:42:24.048125 | 2017-01-25T01:31:55 | 2017-01-25T01:31:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.guoyang.my;
/**
* Created by L'Accordeur on 2016/11/10.
*/
public class nyStarbuzz {
public static void main(String[] args) {
Beverage beverage = new DarkRoast();
beverage = new Mocha(beverage);
beverage = new Mocha(beverage);
System.out.println(beverage.getDescription() + " $" + beverage.cost());
}
}
| [
"610641902@qq.com"
] | 610641902@qq.com |
b8cb1b65ed7b48746484beab457f112ce032922d | b91b34b404d15f0b67e3369b711bffafd6625a95 | /src/pidev/GUI1/UserScreenController.java | 2f5114aa316fd2307bbd8cc7b05b60eaa523f6b5 | [] | no_license | achrefzeddini/PIDEV-Desktop-JAVA | 6dac6ac4c1b86253bfe39f6448f9c5a706bc92e0 | f42469fc8a04113318831505c347fda512c614ae | refs/heads/main | 2023-06-30T09:35:05.044534 | 2021-07-25T12:57:25 | 2021-07-25T12:57:25 | 389,344,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,758 | 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 pidev.GUI1;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
/**
* FXML Controller class
*
* @author Testouri Mohamed
*/
public class UserScreenController implements Initializable {
@FXML
private AnchorPane Pane;
@FXML
private TextField SearchTermTextFiled;
@FXML
private TableView<?> Table;
@FXML
private TableColumn<?, ?> IDUser;
@FXML
private TableColumn<?, ?> FnameUser;
@FXML
private TableColumn<?, ?> LnameUser;
@FXML
private TableColumn<?, ?> PhoneUser;
@FXML
private TableColumn<?, ?> EmailUser;
@FXML
private Button DeleteButton;
@FXML
private Button UpdateButton;
@FXML
private Button AddButton;
@FXML
private Button AssignButton;
@FXML
private Button refreshButton;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void deleteUser(ActionEvent event) {
}
@FXML
private void updateUser(ActionEvent event) {
}
@FXML
private void addUser(ActionEvent event) {
}
@FXML
private void assignUser(ActionEvent event) {
}
@FXML
private void refresh(ActionEvent event) {
}
}
| [
"60570373+achrefzeddini@users.noreply.github.com"
] | 60570373+achrefzeddini@users.noreply.github.com |
715f6334cb00c9bd1a8dc6392cd5a804274b6bc0 | 0efe079e25f22a8bd6964a9eb3a4d4790344e1f3 | /app/src/main/java/com/longer/demo/di/component/ActivityComponent.java | 65cb30800e478c501ea954ab7f1add747ae5ef40 | [] | no_license | lg878398509/demo | b52f9de341f4e3c6ef66542a795a06339ff015d8 | 348f6a632618ef5b05bc500f07581b7ccdc87674 | refs/heads/master | 2021-01-15T23:21:33.152524 | 2017-08-10T14:01:28 | 2017-08-10T14:01:28 | 99,929,062 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.longer.demo.di.component;
import android.app.Activity;
import com.longer.demo.di.module.ActivityModule;
import com.longer.demo.di.scope.PerActivity;
import dagger.Component;
@PerActivity
@Component(dependencies = ApplicationComponent.class, modules = ActivityModule.class)
public interface ActivityComponent {
Activity activity();
}
| [
"878398509@qq.com"
] | 878398509@qq.com |
b650f79f6c8dbf77fbf997c3577b07c5f288e572 | 737c1f09c9c4928198752bd02f01041c3429b002 | /src/main/java/blservice/organizationBLService/StudentBLService.java | 7c17fb0be796543f33203a8fc377ec530d012bdb | [] | no_license | marioquer/Phenomenology | cc6f1c2d7a433040a2d950a0f0b7102539d8bdd4 | 250c9f9249b6c5dfcecd4caa072d0c6a12cf1434 | refs/heads/master | 2021-01-24T11:01:27.397777 | 2016-10-07T16:06:29 | 2016-10-07T16:06:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package blservice.organizationBLService;
import ENUM.UniversalState;
import vo.OrganizationVO;
import java.util.ArrayList;
/**
* Created by lvdechao on 2016/9/30.
*/
public interface StudentBLService {
//得到一个新的存储id
public int getID();
//增加一条本所学生记录
public String addItem(OrganizationVO organizationVO);
//删除一条本所学生记录
public UniversalState deleteItem(int id);
//更新一条本所学生记录
public UniversalState updateItem(OrganizationVO organizationVO);
//将本所学生进行排序【ArrayList里面id的顺序即为最终顺序】
public UniversalState sort(ArrayList<Integer> idList);
//得到某位本所学生的详细信息
public OrganizationVO getItem(int id);
//按排序获得所有本所学生的名单
public ArrayList<OrganizationVO> getAllItem(String language);
}
| [
"ldc14@software.nju.edu.cn"
] | ldc14@software.nju.edu.cn |
83458a24fdeb12e953f73493cfae1654aaeeef25 | a6905033ace978b540ea1ced70ed95b3033fba45 | /LearningGit/src/myJavaCodes/SalesTool.java | ca500e207e44f93fc8a2776c81a8d76325040d42 | [] | no_license | ps2811/JavaCodesRepo | d4bc4f0a32efd59541fb326c789780c8d7ccd715 | b4876b938ced664a674ef40f55e8463b31f2748f | refs/heads/master | 2021-01-10T04:45:28.891927 | 2015-10-17T17:34:22 | 2015-10-17T17:34:22 | 44,220,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package myJavaCodes;
public class SalesTool {
int data[] = {0,4,42};
public void display() {
System.out.println("Inside SalesTool class");
System.out.println("Insode SalesTool 2");
System.out.println("SalesTool Ends");
}
} | [
"mail.pooja2811@gmail.com"
] | mail.pooja2811@gmail.com |
d61cc91daf598cc499eb33f1776e40e173a02f40 | ae22a4eddf5faa9bb4dd9bb1dc9073c892b3cbb8 | /src/test/java/TodoTest.java | 9bf8ff2cfcc2520681d61b6c792529349e25ab4f | [] | no_license | Leofeng10/ip | fa655ed44642ae6843224fcd348b1234d17c3df9 | 15a6da1b1c21b1abc1148c3a74da0ac580d2a784 | refs/heads/master | 2023-08-17T12:35:55.940398 | 2021-10-12T15:46:47 | 2021-10-12T15:46:47 | 397,195,584 | 0 | 0 | null | 2021-09-05T13:11:17 | 2021-08-17T09:43:29 | Java | UTF-8 | Java | false | false | 751 | java | import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;
import duke.core.Duke;
import duke.task.Todo;
public class TodoTest {
@Test
public void createTodoTest() {
try {
Duke duke = new Duke("data/todoList2.txt");
Todo todo = new Todo("test", false);
} catch (Exception e) {
fail("Should not have thrown any exception");
}
}
@Test
public void searchKeywordTest() {
try {
Duke duke = new Duke("data/todoList2.txt");
Todo todo = new Todo("test", false);
todo.searchKeyword("run");
} catch (Exception e) {
fail("Should not have thrown any exception");
}
}
}
| [
"leofengbar@gmail.com"
] | leofengbar@gmail.com |
80400d6be80906984753c6e0581bb17ad49662bf | e24c795684765bbc3b0931e1fe49861d1bb2a975 | /CoursesRegistrationSystemHCMUS/src/main/java/GUI/teacherClassShow.java | 966e62571902e82420f5480a13fa11006b30c0c7 | [] | no_license | vophiminhhieu/CoursesRegistrationSystem | 9da93a0488207505e4140ea66fe30e819a0654d8 | a5a624bc6feb982c1205f4523f279de84467f51b | refs/heads/master | 2023-05-30T08:41:58.086729 | 2021-06-11T18:12:26 | 2021-06-11T18:12:26 | 366,107,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,437 | java | package GUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import DAL.DAO.ClassDao;
public class teacherClassShow extends JPanel {
private ImageIcon background = new ImageIcon("image/Menu/leftCenterPanel.png");
private Icon backIcon = new ImageIcon("image/Menu/Dashboard/userAccount/back.png");
private JButton backBtn = new JButton(backIcon);
private JFrame frame = new JFrame();
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (background != null) {
g.drawImage(background.getImage(), 0, 0, getWidth(), getHeight(), null);
}
}
private void prepareGUI() {
backBtn.setBounds(400, 200, 95, 29); backBtn.setActionCommand("Back");
frame.setLayout(null);
frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
frame.setLocation(200,80);
frame.setTitle("List of Semester");
frame.pack();
frame.setSize(750,550);
}
private void on() {
ClassDao dao = new ClassDao();
String[] columnName = {"ID","Name","Number of Male","Number of Female","Number of Student"};
JTable table = new JTable(dao.getListClass(),columnName);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.getColumnModel().getColumn(0).setPreferredWidth(80);
table.getColumnModel().getColumn(1).setPreferredWidth(220);
table.getColumnModel().getColumn(2).setPreferredWidth(144);
table.getColumnModel().getColumn(3).setPreferredWidth(144);
table.getColumnModel().getColumn(4).setPreferredWidth(144);
JPanel panel =new JPanel(new BorderLayout());
panel.setPreferredSize(new Dimension(750,550));
JScrollPane sp=new JScrollPane(table);
panel.add(sp,BorderLayout.CENTER);
panel.setOpaque(true);
frame.setContentPane(panel);
frame.setVisible(true);
}
public teacherClassShow(ActionListener obj) {
setLayout(null); add(backBtn); prepareGUI(); backBtn.addActionListener(obj); on(); setBounds(0, 10, 495, 281);
}
}
| [
"minhhieu.maicogroup@gmail.com"
] | minhhieu.maicogroup@gmail.com |
bfab4f60fcc8999f74cae3227b1b5da4dbbc5405 | b7cd8062b527c86441c7838e4824e4a5b4c67932 | /gwt-test-utils-gxt3/src/test/java/com/googlecode/gxt/test/WindowTest.java | 34728fd42ceaba61e4cdd092778f48573d8b8c62 | [] | no_license | vboulaye/gwt-test-utils | 5e9ecd93259a1500b5fa0a3a965bc7b795cc09bb | a40f63937b42d2861f8e974d9927351c9b91bde7 | refs/heads/master | 2021-07-13T03:21:46.185661 | 2017-04-03T06:55:49 | 2017-04-03T06:55:49 | 107,225,727 | 0 | 0 | null | 2017-10-17T06:15:31 | 2017-10-17T06:15:29 | null | UTF-8 | Java | false | false | 4,562 | java | package com.googlecode.gxt.test;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.widget.core.client.Window;
import com.sencha.gxt.widget.core.client.event.*;
import com.sencha.gxt.widget.core.client.event.ActivateEvent.ActivateHandler;
import com.sencha.gxt.widget.core.client.event.DeactivateEvent.DeactivateHandler;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
import com.sencha.gxt.widget.core.client.event.MaximizeEvent.MaximizeHandler;
import com.sencha.gxt.widget.core.client.event.MinimizeEvent.MinimizeHandler;
import com.sencha.gxt.widget.core.client.event.RestoreEvent.RestoreHandler;
import com.sencha.gxt.widget.core.client.event.ShowEvent.ShowHandler;
import org.junit.Before;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class WindowTest extends GwtGxtTest {
private boolean activate;
private boolean deactivate;
private boolean hide;
private boolean maximize;
private boolean minimize;
private boolean restore;
private boolean show;
private Window window;
@Test
public void activate() {
// Given
window.addActivateHandler(new ActivateHandler<Window>() {
public void onActivate(ActivateEvent<Window> event) {
assertThat(event.getItem()).isEqualTo(window);
activate = true;
}
});
window.show();
// When
window.setActive(true);
// Then
assertThat(activate).isTrue();
}
@Before
public void beforeWindowTest() {
window = new Window();
RootPanel.get().add(window);
activate = false;
deactivate = false;
hide = false;
maximize = false;
minimize = false;
restore = false;
show = false;
}
@Test
public void deactivate() {
// Given
window.addDeactivateHandler(new DeactivateHandler<Window>() {
public void onDeactivate(DeactivateEvent<Window> event) {
assertThat(event.getItem()).isEqualTo(window);
deactivate = true;
}
});
window.show();
// When
window.setActive(false);
// Then
assertThat(deactivate).isTrue();
}
@Test
public void hide() {
// Given
window.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
assertThat(event.getSource()).isEqualTo(window);
hide = true;
}
});
window.show();
// When
window.hide();
// Then
assertThat(hide).isTrue();
}
@Test
public void maximize() {
// Given
window.addMaximizeHandler(new MaximizeHandler() {
public void onMaximize(MaximizeEvent event) {
assertThat(event.getSource()).isEqualTo(window);
maximize = true;
}
});
window.show();
// When
window.maximize();
// Then
assertThat(maximize).isTrue();
}
@Test
public void minimize() {
// Given
window.addMinimizeHandler(new MinimizeHandler() {
public void onMinimize(MinimizeEvent event) {
assertThat(event.getSource()).isEqualTo(window);
minimize = true;
}
});
window.show();
// When
window.minimize();
// Then
assertThat(minimize).isTrue();
}
@Test
public void restore() {
// Given
window.addRestoreHandler(new RestoreHandler() {
public void onRestore(RestoreEvent event) {
assertThat(event.getSource()).isEqualTo(window);
restore = true;
}
});
window.show();
window.maximize();
// When
window.restore();
// Then
assertThat(restore).isTrue();
}
@Test
public void show() {
// Given
window.addShowHandler(new ShowHandler() {
public void onShow(ShowEvent event) {
assertThat(event.getSource()).isEqualTo(window);
show = true;
}
});
// When
window.show();
// Then
assertThat(show).isTrue();
}
}
| [
"gael.lazzari@gmail.com"
] | gael.lazzari@gmail.com |
f0034af1f8232c2e1e57e5051df1bee59f7ad1ad | 8652aa52ac965a3388854e298ce36996780bf4b4 | /TestSys/src/com/example/testsys/fragment/EnvironmentFragment.java | 308a6c60edc8581d70a399e3d51f19d071aeb7df | [] | no_license | irelia8/TestSys | b2a1aaf51065617cdb7116fb1af2d112b9553581 | e5c881e29cdcebf49364289347fae25659c06d0d | refs/heads/master | 2016-08-10T20:57:30.157575 | 2016-03-02T10:51:06 | 2016-03-02T10:51:06 | 52,945,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,492 | java | package com.example.testsys.fragment;
import java.util.ArrayList;
import com.example.testsys.R;
import com.example.testsys.adapter.TrafficLightAdapter;
import com.example.testsys.bean.BusStation;
import com.example.testsys.bean.Environment;
import com.example.testsys.bean.TrafficLight;
import com.example.testsys.util.HttpThreadNew;
import com.example.testsys.request.BaseRequest;
import com.example.testsys.request.BaseRequestNew;
import com.example.testsys.request.GetCarSpeedRequest;
import com.example.testsys.request.GetEnvironmentRequest;
import com.example.testsys.request.GetStationRequest;
import com.example.testsys.request.GetTrafficLight;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.TextView;
public class EnvironmentFragment extends Fragment{
ArrayAdapter<TrafficLight> trafficlightAdapter;
private ListView lv_trafficlight;
private TextView tv_station1;
private TextView tv_station2;
private ArrayList<TrafficLight> trafficLightList;
private BusStation station1;
private BusStation station2;
private ArrayList<BaseRequestNew> requestList;
private GetTrafficLight request1;
private GetTrafficLight request2;
private GetTrafficLight request3;
private GetTrafficLight request4;
private GetTrafficLight request5;
private GetStationRequest request6;
private GetStationRequest request7;
Handler mHandler = new Handler(){
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
updateTrafficLight(trafficLightList.get(0),(TrafficLight) msg.obj);
break;
case 1:
updateTrafficLight(trafficLightList.get(1),(TrafficLight) msg.obj);
break;
case 2:
updateTrafficLight(trafficLightList.get(2),(TrafficLight) msg.obj);
break;
case 3:
updateTrafficLight(trafficLightList.get(3),(TrafficLight) msg.obj);
break;
case 4:
updateTrafficLight(trafficLightList.get(4),(TrafficLight) msg.obj);
break;
case 5:
updateStation(station1,(BusStation) msg.obj);
break;
case 6:
updateStation(station2,(BusStation) msg.obj);
break;
default:
System.out.println("notchange");
break;
}
updateView();
};
};
@Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
initData();
startThread();
}
protected void updateTrafficLight(TrafficLight oldTL, TrafficLight newTL) {
// TODO Auto-generated method stub
oldTL.setGreenTime(newTL.getGreenTime());
oldTL.setRedTime(newTL.getRedTime());
oldTL.setYellowTime(newTL.getYellowTime());
}
protected void updateStation(BusStation oldStation, BusStation newStation) {
// TODO Auto-generated method stub
try {
oldStation.setDistanceTo1(newStation.getDistanceTo1());
oldStation.setDistanceTo2(newStation.getDistanceTo2());
} catch (Exception e) {
// TODO: handle exception
System.out.println("station null");
}
}
private void startThread() {
// TODO Auto-generated method stub
requestList = new ArrayList<BaseRequestNew>();
request1 = new GetTrafficLight("http://172.16.164.3:8080/transportservice/type/jason/action/GetTrafficLightConfigAction.do",String.valueOf(1));
request2 = new GetTrafficLight("http://172.16.164.3:8080/transportservice/type/jason/action/GetTrafficLightConfigAction.do",String.valueOf(2));
request3 = new GetTrafficLight("http://172.16.164.3:8080/transportservice/type/jason/action/GetTrafficLightConfigAction.do",String.valueOf(3));
request4 = new GetTrafficLight("http://172.16.164.3:8080/transportservice/type/jason/action/GetTrafficLightConfigAction.do",String.valueOf(4));
request5 = new GetTrafficLight("http://172.16.164.3:8080/transportservice/type/jason/action/GetTrafficLightConfigAction.do",String.valueOf(5));
request6 = new GetStationRequest("http://172.16.164.3:8080/transportservice/type/jason/action/GetBusStationInfo.do", String.valueOf(1));
request7 = new GetStationRequest("http://172.16.164.3:8080/transportservice/type/jason/action/GetBusStationInfo.do", String.valueOf(2));
request1.setTAG("GetTrafficLight");
request2.setTAG("GetTrafficLight");
request3.setTAG("GetTrafficLight");
request4.setTAG("GetTrafficLight");
request5.setTAG("GetTrafficLight");
request6.setTAG("GetStation");
request7.setTAG("GetStation");
requestList.add(request1);
requestList.add(request2);
requestList.add(request3);
requestList.add(request4);
requestList.add(request5);
requestList.add(request6);
requestList.add(request7);
HttpThreadNew threadNew = new HttpThreadNew(mHandler, requestList);
threadNew.setLoop(true, 2000);
threadNew.start();
}
private void initData() {
trafficLightList = new ArrayList<TrafficLight>();
for (int i = 0; i < 5; i++) {
TrafficLight tf = new TrafficLight();
tf.setGreenTime(0);
tf.setRedTime(0);
tf.setYellowTime(0);
trafficLightList.add(tf);
}
station1 = new BusStation();
station1.setDistanceTo1(0);
station1.setDistanceTo2(0);
station2 = new BusStation();
station2.setDistanceTo1(0);
station2.setDistanceTo2(0);
}
private void updateView() {
trafficlightAdapter.notifyDataSetChanged();
String str = "1号公交 : "+station1.getDistanceTo1()+"m,2号公交 : "+station1.getDistanceTo2()+"m";
tv_station1.setText(str);
str = "1号公交 : "+station2.getDistanceTo1()+"m,2号公交 : "+station2.getDistanceTo2()+"m";
tv_station2.setText(str);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View v = inflater.inflate(R.layout.fragment_envio, container, false);
initView(v);
updateView();
return v;
}
private void initView(View v) {
// TODO Auto-generated method stub
lv_trafficlight = (ListView) v.findViewById(R.id.lv_trafficLight);
tv_station1 = (TextView) v.findViewById(R.id.tv_station1);
tv_station2 = (TextView) v.findViewById(R.id.tv_station2);
trafficlightAdapter = new TrafficLightAdapter(getActivity(), R.layout.item_tl, trafficLightList);
lv_trafficlight.setAdapter(trafficlightAdapter);
}
}
| [
"zhangzhiwei@192.168.58.1"
] | zhangzhiwei@192.168.58.1 |
8b948406ad74908d578d31e40aa7b57b8080ecbd | 4f76b11fe30cec0c817418a418ae0bbb65df058d | /glcfsPointQuery/src/us/glos/glcfs/helpers/GLCFSGrid.java | 22ccea701cb3dedfaa97678389ac214687d4d4c7 | [] | no_license | glos/glos_server_script | 1a3b80c03b7cf31d20276928208536d5fa41210f | 5d741a56b2f320dffb2ed62edf80a1d6ce69905d | refs/heads/master | 2020-04-12T05:34:11.029361 | 2017-11-09T13:50:34 | 2017-11-09T13:50:34 | 64,231,442 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,526 | java | /*
;---xdist.pro-------------------------------------------------------------------
function xdist,rlat,rlon,ip,rp
; geographic to map coordinate transformation for x coordinate
alpha=rp(6)*!dtor
; transformation for approximate polyconic projection
if(ip(4) eq 0) then begin
dlat=rlat-rp(0)
dlon=rp(1)-rlon
xp=rp(7)*dlon+rp(8)*dlat+rp(9)*dlon*dlat+rp(10)*dlon*dlon
yp=rp(11)*dlon+rp(12)*dlat+rp(13)*dlat*dlon+rp(14)*dlon*dlon
xp=xp*1000.
yp=yp*1000.
end
; transformation for lambert conformal conic projection
if(ip(4) eq 1) then begin
r=(tan(!pi/4.-!dtor*rlat/2.))^rp(10)
xp=rp(11)*r*sin(rp(10)*(rp(7)-!dtor*rlon))
yp=-rp(11)*r*cos(rp(10)*(rp(7)-!dtor*rlon))
xp=xp-rp(12)
yp=yp-rp(13)
end
; transform to 'unprimed' system
; first rotate
xd=xp*cos(alpha)+yp*sin(alpha)
; now translate
xd=xd+ip(2)*rp(2)
return,xd
end
;---ydist.pro-------------------------------------------------------------------
function ydist,rlat,rlon,ip,rp
; geographic to map coordinate transformation for y coordinate
alpha=rp(6)*!dtor
; transformation for approximate polyconic projection
if(ip(4) eq 0) then begin
dlat=rlat-rp(0)
dlon=rp(1)-rlon
xp=rp(7)*dlon+rp(8)*dlat+rp(9)*dlon*dlat+rp(10)*dlon*dlon
yp=rp(11)*dlon+rp(12)*dlat+rp(13)*dlat*dlon+rp(14)*dlon*dlon
xp=xp*1000.
yp=yp*1000.
end
; transformation for lambert conformal conic projection
if(ip(4) eq 1) then begin
r=(tan(!pi/4.-!dtor*rlat/2.))^rp(10)
xp=rp(11)*r*sin(rp(10)*(rp(7)-!dtor*rlon))
yp=-rp(11)*r*cos(rp(10)*(rp(7)-!dtor*rlon))
xp=xp-rp(12)
yp=yp-rp(13)
end
; transform to 'unprimed' system
; first rotate
yd=yp*cos(alpha)-xp*sin(alpha)
; now translate
yd=yd+ip(3)*rp(2)
return,yd
end
;----------------------------------------------------------------------
pro rgrid,fname,gname,dgrid,iparm,rparm
; Purpose:
; To read a bathymetric grid data file
; and return grid parameters and depths.
; Arguments:
; On input:
; fname - Full pathway name of bathymetric data file
; On output:
; gname - Lake name (from bathymetric data file)
; dgrid - Depth grid
; iparm - Integer parameters for grid description and
; coordinate conversion
; rparm - Real parameters for grid description and
; coordinate conversion
;
; ------------------------------------------------------------------
; FORMAT OF BATHYMETRIC DATA FILE
; ------------------------------------------------------------------
; FIELD FORTRAN FORMAT COLUMNS
; ------------------------------------------------------------------
; RECORD 1: LAKE NAME 40A1 1-40
; RECORD 2: FIRST (I) DIMENSION OF DEPTH ARRAY I5 1-5
; SECOND (J) DIMENSION OF DEPTH ARRAY I5 6-10
; BASE LATITUDE F12.7 11-22
; BASE LONGITUDE F12.7 23-34
; GRID SIZE F5.0 35-39
; MAXIMUM DEPTH F5.0 40-44
; MINIMUM DEPTH F5.0 45-49
; BASE ROTATION (CCW FROM E-W) F6.2 50-55
; I DISPLACEMENT I5 56-60
; J DISPLACEMENT I5 61-65
; ROTATION FROM BASE (CCW) F6.2 66-71
; POWER OF TEN TO CONVERT DEPTHS TO
; METERS I3 72-74
; MAP PROJECTION INDICATOR
; 0=APPROXIMATE POLYCONIC
; 1=LAMBERT CONFORMAL CONIC I2 75-76
; RECORDS 3-6 (FOR APPROXIMATE POLYCONIC PROJECTION):
; MAP PROJECTION COORDINATE CONVERSION
; COEFFICIENTS 4E15.6 1-60
; RECORD 3 (FOR LAMBERT CONFORMAL CONIC PROJECTION):
; CENTRAL MERIDIAN OF PROJECTION E15.6 1-15
; SOUTHERNMOST STANDARD PARALLEL E15.6 16-30
; NORTHERNMOST STANDARD PARALLEL E15.6 31-45
; FOLLOWING RECORDS:
; DEPTHS IN ASCENDING I, ASCENDING J
; SEQUENCE, 19 TO A RECORD 19F4.0 1-76
; ------------------------------------------------------------------
;
; ON OUTPUT:
; D - DEPTH ARRAY. ZERO FOR LAND, AVERAGE DEPTH
; OF GRID BOX IN METERS FOR WATER.
; RPARM - ARRAY CONTAINING REAL-VALUED BATHYMETRIC
; GRID PARAMETERS AS FOLLOWS:
; 1. BASE LATITUDE
; 2. BASE LONGITUDE
; 3. GRID SIZE (M)
; 4. MAXIMUM DEPTH (M)
; 5. MINIMUM DEPTH (M)
; 6. BASE ROTATION (COUNTERCLOCKWISE FROM E-W)
; 7. ROTATION FROM BASE (COUNTERCLOCKWISE)
;
; FOR IPARM(45)=0 (APPROXIMATE POLYCONIC PROJECTION):
; 8-11. GEOGRAPHIC-TO-MAP COORDINATE CONVERSION
; COEFFICIENTS FOR X
; 12-15. GEOGRAPHIC-TO-MAP COORDINATE CONVERSION
; COEFFICIENTS FOR Y
; 16-19. MAP-TO-GEOGRAPHIC COORDINATE CONVERSION
; COEFFICIENTS FOR LONGITUDE
; 20-23. MAP-TO-GEOGRAPHIC COORDINATE CONVERSION
; COEFFICIENTS FOR LATITUDE
;
; FOR IPARM(45)=1 (LAMBERT CONFORMAL CONIC PROJECTION):
; 8. CENTRAL MERIDIAN OF PROJECTION (RADIANS)
; 9. SOUTHERNMOST STANDARD PARALLEL (RADIANS)
; 10. NORTHERNMOST STANDARD PARALLEL (RADIANS)
; 11. LOGARITHMIC COEFFICIENT FOR TRANSFORMATIONS
; 12. DISTANCE SCALING FACTOR FOR TRANSFORMATIONS
; 13. X DISPLACEMENT OF BATHYMETRIC GRID ORIGIN
; FROM MAP PROJECTION ORIGIN
; 14. Y DISPLACEMENT OF BATHYMETRIC GRID ORIGIN
; FROM MAP PROJECTION ORIGIN
;
; IPARM - ARRAY CONTAINING INTEGER-VALUED BATHYMETRIC
; GRID PARAMETERS AS FOLLOWS:
; 1. NUMBER OF GRID BOXES IN X DIRECTION
; 2. NUMBER OF GRID BOXES IN Y DIRECION
; 3. I DISPLACEMENT - THE NUMBER OF NEW GRID
; SQUARES IN THE X-DIRECTION FROM THE NEW
; GRID ORIGIN TO THE OLD GRID ORIGIN
; (USED ONLY FOR IPARM(45)=0)
; 4. J DISPLACEMENT - THE NUMBER OF NEW GRID
; SQUARES IN THE Y-DIRECTION FROM THE NEW
; GRID ORIGIN TO THE OLD GRID ORIGIN
; (USED ONLY FOR IPARM(45)=0)
; 5. MAP PROJECTION USED FOR BATHYMETRIC GRID:
; 0=APPROXIMATE POLYCONIC (GREAT LAKES GRIDS)
; 1=LAMBERT CONFORMAL CONIC
gname=' '
rparm=fltarr(23)
iparm=intarr(5)
openr,1,fname
readf,1,gname
iw1=intarr(2)
iw2=intarr(2)
rw1=fltarr(6)
r1=0.
on_ioerror,next
readf,1,iw1,rw1,iw2,r1,idexp,iproj, $
format='(2I5,2F12.7,3F5.0,F6.2,2I5,F6.2,I3,I2)'
goto,next1
next:idexp=0
iproj=0
next1:on_ioerror,null
iparm(0:1)=iw1
rparm(0:5)=rw1
iparm(2:3)=iw2
iparm(4)=iproj
rparm(6)=r1
if(iproj eq 0) then begin ;Approximate Polyconic Projection
rw1=fltarr(16)
readf,1,format='(4e15.6)',rw1
rparm(7:22)=rw1
end
if(iproj eq 1) then begin ;Lambert Conformal Conic
rw1=fltarr(3)
readf,1,format='(3e15.6)',rw1
rparm(7:9)=rw1
end
im=iparm(0)
jm=iparm(1)
dgrid=fltarr(im,jm)
readf,1,dgrid,format='(19f4.0)'
close,1
; adjust depths
dfac=10.^idexp
rparm(3)=rparm(3)*dfac
rparm(4)=rparm(4)*dfac
dgrid=dgrid*dfac
; for lambert projection compute required constants
if(iparm(4) eq 1) then begin
a45=atan(1.)
rparm(7)=rparm(7)*!dtor
rparm(8)=rparm(8)*!dtor
rparm(9)=rparm(9)*!dtor
; alon0=rparm(7)
a1=rparm(8)
a2=rparm(9)
rparm(10)=(alog(cos(a1))-alog(cos(a2)))/ $
(alog(tan(a45-a1/2.))-alog(tan(a45-a2/2.)))
; set scale factor for n-s distance from a1 to a2
aexp=rparm(10)
y1=(tan(a45-a1/2.))^aexp
y2=(tan(a45-a2/2.))^aexp
rparm(11)=6378140.*(a2-a1)/(y1-y2)
rparm(12)=0.
rparm(13)=0.
dx=xdist(rparm(0),rparm(1),iparm,rparm)
dy=ydist(rparm(0),rparm(1),iparm,rparm)
rparm(12)=dx
rparm(13)=dy
end
return
end
;-------------------------------------------------------------------------
*/
package us.glos.glcfs.helpers;
import java.util.HashMap;
import org.glc.domain.Coordinate;
public class GLCFSGrid {
private static final double Degree2Radians=0.017453293;
private static final double PI=3.1415927;
private static HashMap<String,int[]> IPARAM=null;
private static HashMap<String,double[]> RPARAM=null;
//private static HashMap<String,Coordinate> ORIGIN=null;
static
{
IPARAM=new HashMap<String,int[]>(6);
RPARAM=new HashMap<String,double[]>(6);
//ORIGIN=new HashMap<String,Coordinate>(6);
int[] michiganIP={131, 251, 0, 0, 1};
double[] michiganRP={41.5976372, 87.9898071, 2000, 273*Math.pow(10, 0), 1*Math.pow(10, 0), 0.00, 0.00, 86.500000*Degree2Radians, 43.000000*Degree2Radians, 45.000000*Degree2Radians, 0.0, 0.0, 0.0, 0.0};
michiganRP[10]=(Math.log(Math.cos(michiganRP[8]))-Math.log(Math.cos(michiganRP[9])))/(Math.log(Math.tan(Math.atan(1.0)-michiganRP[8]/2.0))-Math.log(Math.tan(Math.atan(1.0)-michiganRP[9]/2.0)));
michiganRP[11]=6378140.*(michiganRP[9]-michiganRP[8])/(Math.pow(Math.tan(Math.atan(1.0)-michiganRP[8]/2.0), michiganRP[10])-Math.pow(Math.tan(Math.atan(1.0)-michiganRP[9]/2.0), michiganRP[10]));
IPARAM.put("michigan", michiganIP);
RPARAM.put("michigan", michiganRP);
Coordinate origin=GetCoordInXY(false,michiganRP[1],michiganRP[0],null,"michigan");
if(origin!=null)
{
michiganRP[12]=origin.getLon();
michiganRP[13]=origin.getLat();
}
//Coordinate coord=GetCoordInXY(michiganRP[1],michiganRP[0],null,"michigan");
//ORIGIN.put("michigan", coord);
int[] erieIP={193, 87, 0, 0, 1};
double[] erieRP={41.3358841, 83.4890823, 2000, 628*Math.pow(10, -1), 30*Math.pow(10, -1), 0.00, 0.00, 81.000000*Degree2Radians, 41.750000*Degree2Radians, 42.500000*Degree2Radians, 0.0, 0.0, 0.0, 0.0};
erieRP[10]=(Math.log(Math.cos(erieRP[8]))-Math.log(Math.cos(erieRP[9])))/(Math.log(Math.tan(Math.atan(1.0)-erieRP[8]/2.0))-Math.log(Math.tan(Math.atan(1.0)-erieRP[9]/2.0)));
erieRP[11]=6378140.*(erieRP[9]-erieRP[8])/(Math.pow(Math.tan(Math.atan(1.0)-erieRP[8]/2.0), erieRP[10])-Math.pow(Math.tan(Math.atan(1.0)-erieRP[9]/2.0), erieRP[10]));
IPARAM.put("erie", erieIP);
RPARAM.put("erie", erieRP);
origin=GetCoordInXY(false,erieRP[1],erieRP[0],null,"erie");
if(origin!=null)
{
erieRP[12]=origin.getLon();
erieRP[13]=origin.getLat();
}
int[] huronIP={201, 188, 0, 0, 1};
double[] huronRP={42.9612122, 84.6548080, 2000, 2144*Math.pow(10, -1), 20*Math.pow(10, -1), 0.00, 0.00, 82.000000*Degree2Radians, 43.000000*Degree2Radians, 45.000000*Degree2Radians, 0.0, 0.0, 0.0, 0.0};
huronRP[10]=(Math.log(Math.cos(huronRP[8]))-Math.log(Math.cos(huronRP[9])))/(Math.log(Math.tan(Math.atan(1.0)-huronRP[8]/2.0))-Math.log(Math.tan(Math.atan(1.0)-huronRP[9]/2.0)));
huronRP[11]=6378140.*(huronRP[9]-huronRP[8])/(Math.pow(Math.tan(Math.atan(1.0)-huronRP[8]/2.0), huronRP[10])-Math.pow(Math.tan(Math.atan(1.0)-huronRP[9]/2.0), huronRP[10]));
IPARAM.put("huron", huronIP);
RPARAM.put("huron", huronRP);
origin=GetCoordInXY(false,huronRP[1],huronRP[0],null,"huron");
if(origin!=null)
{
huronRP[12]=origin.getLon();
huronRP[13]=origin.getLat();
}
int[] huron2006IP={81, 75, 1, 0, 0};
double[] huron2006RP={42.9660301, 84.6620712, 5000, 206*Math.pow(10, 0), 1*Math.pow(10, 0), 0.0, 0.0,
0.815869E+02, 0.257566E+01, -0.134705E+01, 0.000000E+00,
-0.185606E+01, 0.111111E+03, 0.000000E+00, 0.485354E+00,
0.122482E-01, -0.297178E-03, 0.192849E-05, 0.000000E+00,
0.220311E-03, 0.899372E-02, 0.000000E+00, -0.702891E-06
};
IPARAM.put("huron2006", huron2006IP);
RPARAM.put("huron2006", huron2006RP);
int[] ontarioIP={61, 25, 0, 1, 0};
double[] ontarioRP={43.1655426, 79.8199615, 5000, 226*Math.pow(10, 0), 7*Math.pow(10, 0), 0.0, 0.0,
0.813204E+02, 0.242939E+01, -0.133486E+01, 0.0,
-0.176688E+01, 0.111101E+03, 0.0, 0.485416E+00,
0.122965E-01, -0.274739E-03, 0.185864E-05, 0.0,
0.199237E-03, 0.899770E-02, 0.0, -0.674272E-06
};
IPARAM.put("ontario", ontarioIP);
RPARAM.put("ontario", ontarioRP);
int[] superiorIP={61, 30, 1, 0, 0};
double[] superiorRP={46.3184662, 92.1027527, 10000, 326*Math.pow(10, 0), 12*Math.pow(10, 0), 0.0, 0.0,
0.770215E+02, 0.584617E+01, -0.142494E+01, 0.0,
-0.398892E+01, 0.111176E+03, 0.0, 0.486127E+00,
0.129841E-01, -0.717624E-03, 0.226882E-05, 0.0,
0.477160E-03, 0.898120E-02, 0.0, -0.757848E-06
};
IPARAM.put("superior", superiorIP);
RPARAM.put("superior", superiorRP);
}
public static Coordinate GetCoordInXY(boolean isCellNo,double lon,double lat,String year,String lake)
{
Coordinate coord=null;
if(lake!=null&&year!=null&&lake.equals("huron")&&(year.equals("2006")||year.equals("2007")||year.equals("2008")))
lake="huron2006";
int[] iparam=IPARAM.get(lake);
double[] rparam=RPARAM.get(lake);
if(iparam!=null&&rparam!=null)
{
if(lon<0)lon=lon*-1.0;
double alpha=rparam[6]*Degree2Radians;
double xp=0.,yp=0.;
if(iparam[4]==1)
{
double r=Math.pow(Math.tan(PI/4.0-Degree2Radians*lat/2.0),rparam[10]);
xp=rparam[11]*r*Math.sin(rparam[10]*(rparam[7]-Degree2Radians*lon));
yp=-rparam[11]*r*Math.cos(rparam[10]*(rparam[7]-Degree2Radians*lon));
xp-=rparam[12];
yp-=rparam[13];
}
else if(iparam[4]==0)
{
xp=1000.0*(rparam[7]*(rparam[1]-lon)+rparam[8]*(lat-rparam[0])+rparam[9]*(rparam[1]-lon)*(lat-rparam[0])+rparam[10]*(rparam[1]-lon)*(rparam[1]-lon));
yp=1000.0*(rparam[11]*(rparam[1]-lon)+rparam[12]*(lat-rparam[0])+rparam[13]*(rparam[1]-lon)*(lat-rparam[0])+rparam[14]*(rparam[1]-lon)*(rparam[1]-lon));
}
double xd=xp*Math.cos(alpha)+yp*Math.sin(alpha)+iparam[2]*rparam[2];
double yd=yp*Math.cos(alpha)-xp*Math.sin(alpha)+iparam[3]*rparam[2];
//Coordinate ocoord=ORIGIN.get(lake);
//if(ocoord!=null)
// coord=new Coordinate((xd-ocoord.getLon())/rparam[2],(yd-ocoord.getLat())/rparam[2]);
//coord=new Coordinate((xd)/rparam[2],(yd)/rparam[2]);
//else
if(isCellNo)
{
double xr=xd/rparam[2];
double yr=yd/rparam[2];
if(xr>=0&&xr<iparam[0]&&yr<iparam[1]&&yr>=0)
coord=new Coordinate(xd/rparam[2],yd/rparam[2]);
else
coord=new Coordinate(-1,-1);
}
else
coord=new Coordinate(xd,yd);
}
return coord;
}
}
| [
"gwang@glc.org"
] | gwang@glc.org |
4fa9987ef35e802f8a4228e9655436ef6650536e | 5b6269673007ca62e47ce933c13f5251cf324875 | /src/main/java/io/alpyg/rpg/events/EntityConstructEvents.java | 6e8c8b64e18481cc875a1bfdc3838bbfc43ccf63 | [] | no_license | Alpyg/RPGSeed | 0babfc2b7504aa53b61cc50ded34ba03e14b6b3b | 2748bb4b7d306987fa247c72ff71f4c162e9cdae | refs/heads/master | 2021-06-27T03:09:16.131607 | 2019-05-23T23:47:22 | 2019-05-23T23:47:22 | 173,173,470 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 513 | java | package io.alpyg.rpg.events;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.entity.SpawnEntityEvent;
import io.alpyg.rpg.data.npc.NpcData;
public class EntityConstructEvents {
@Listener
public void onEntityConstruct(SpawnEntityEvent.ChunkLoad e) {
for (Entity entity : e.getEntities()) {
if (entity.get(NpcData.class).isPresent()) {
System.out.println(entity);
// entity.remove();
}
}
}
}
| [
"abder@DESKTOP-HBA4111"
] | abder@DESKTOP-HBA4111 |
5113ff1d8b74b0a5f6ce5fab3873ba00a0bcfc67 | b7922eabff59ac8b181b8eb1fb31b879f219ddc2 | /src/main/java/com/dbg/cloud/acheron/consumers/service/ConsumerService.java | 63c20075162150710c931656a67d6ed2cca129c9 | [] | no_license | xrogzu/acheron | faa56e19ddf618adc3522f7ea201c309a7f4f856 | 0c432d3524beedbb82aaa7dfafe8f99a7c3afcf5 | refs/heads/master | 2021-01-22T02:35:14.148353 | 2017-02-03T06:36:00 | 2017-02-03T06:36:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,775 | java | package com.dbg.cloud.acheron.consumers.service;
import com.datastax.driver.core.utils.UUIDs;
import com.dbg.cloud.acheron.consumers.Consumer;
import com.dbg.cloud.acheron.exception.TechnicalException;
import com.dbg.cloud.acheron.exception.ValidationException;
import com.dbg.cloud.acheron.consumers.store.ConsumerStore;
import com.dbg.cloud.acheron.pluginconfig.PluginConfig;
import com.dbg.cloud.acheron.pluginconfig.service.PluginConfigService;
import com.dbg.cloud.acheron.plugins.apikey.store.APIKey;
import com.dbg.cloud.acheron.plugins.apikey.store.APIKeyStore;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
public interface ConsumerService {
List<Consumer> getAllConsumers() throws TechnicalException;
Optional<Consumer> getConsumer(@NonNull UUID consumerId) throws TechnicalException;
Consumer addNewConsumer(@NonNull Consumer consumer) throws ValidationException, TechnicalException;
void deleteConsumer(@NonNull UUID consumerId) throws TechnicalException;
@Service
@AllArgsConstructor
class ConsumerServiceImpl implements ConsumerService {
private final ConsumerStore consumerStore;
private final PluginConfigService pluginConfigService;
private final APIKeyStore apiKeyStore; // TODO Replace with service
@Override
public List<Consumer> getAllConsumers() throws TechnicalException {
try {
return consumerStore.findAll();
} catch (final RuntimeException e) {
throw new TechnicalException(e);
}
}
@Override
public Optional<Consumer> getConsumer(final @NonNull UUID consumerId) throws TechnicalException {
try {
return consumerStore.findById(consumerId);
} catch (final RuntimeException e) {
throw new TechnicalException(e);
}
}
@Override
public Consumer addNewConsumer(final @NonNull Consumer consumer) throws ValidationException,
TechnicalException {
validateConsumer(consumer);
try {
final UUID consumerId = UUIDs.random();
final Date createdAt = new Date();
return consumerStore.add(new Consumer.Smart(consumerId, consumer.getName(), createdAt));
} catch (final RuntimeException e) {
throw new TechnicalException(e);
}
}
@Override
public void deleteConsumer(final @NonNull UUID consumerId) {
try {
consumerStore.deleteById(consumerId);
// Delete all plugin configs linked to the consumer
final List<PluginConfig> consumerPluginConfigs =
pluginConfigService.getPluginConfigsOfConsumer(consumerId);
consumerPluginConfigs.forEach(
consumerPluginConfig -> pluginConfigService.deletePluginConfig(consumerPluginConfig.getId()));
// Delete API Keys
final List<APIKey> consumerAPIKeys = apiKeyStore.findByConsumer(consumerId);
consumerAPIKeys.forEach(consumerAPIKey -> apiKeyStore.deleteById(consumerAPIKey.getId()));
} catch (final RuntimeException e) {
throw new TechnicalException(e);
}
}
private void validateConsumer(final Consumer consumer) throws ValidationException {
if (consumer.getName() == null || consumer.getName().isEmpty()) {
throw new ValidationException("consumer name cannot be empty");
}
}
}
}
| [
"skaliotis@gmail.com"
] | skaliotis@gmail.com |
02b13b8b7e19b8b2757e5aeed88ca48ddae6d49c | 5a9c39be816778887d59dd5252641e9addec924f | /2017025_Lab06/Lab6/src/InvalidProductException.java | ff2698ce5b394eb51ef027111b704636552057d8 | [] | no_license | anshuman1117/Advanced-Programming-Labs | 6807991893987f764da5c72e854f21e1effefd8d | e8d1b2f472fce21a1d7762ac739bda0377fd352a | refs/heads/master | 2020-04-16T09:38:34.046650 | 2019-01-13T07:00:14 | 2019-01-13T07:00:14 | 165,471,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java |
public class InvalidProductException extends Exception {
public InvalidProductException(String arg0) {
super(arg0);
}
}
| [
"anshuman17025@iiitd.ac.in"
] | anshuman17025@iiitd.ac.in |
3e2d552d6dea046c8a7e842d2e387e1c5ad2315d | 171e316664227454084cbda2e123b7ecf778b094 | /generating_func.java | c8dcef55781ec8a50bb3bbfd2bbfb82dc2e33430 | [] | no_license | shwetacharchita/Basic-Codes | 9accc988c56fd2c09627b3d4ba76abb41c89e53b | c561e2d78f1f544b31d29c89a7a83cf093f3fb3b | refs/heads/master | 2021-01-01T03:42:39.282319 | 2016-05-01T16:20:11 | 2016-05-01T16:20:11 | 57,636,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,287 | java | import java.io.*;
class generating_func
{
public static void main(String[]args)throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Generating Function of Numeric Functions of type:\n1.Exponential: x^r\n2.Polynomial:Cor^0+C1r^1+C2r^2+...");
int op=Integer.parseInt(in.readLine());
switch(op)
{
case 1:
System.out.println("Enter value of x:");
int x=Integer.parseInt(in.readLine());
System.out.println("Enter value of r till which function is to be generated:");
int r=Integer.parseInt(in.readLine());
System.out.println("Generating function:");
for(int i=0;i<=r;i++)
{
int a=xfn(x,i);
System.out.print(a+"z^"+i);
if(i!=r)
System.out.print("\t+\t");
}
break;
case 2:
System.out.println("Enter value of degree till which function is to be generated:");
int d=Integer.parseInt(in.readLine());
float rhs[]=new float[d+1];
for(int i=0;i<=d;i++)
{
System.out.println("Enter coefficient for r^"+i+":");
rhs[i]=Float.parseFloat(in.readLine());
}
float z=0;
System.out.println("Generating function:");
for(int i=0;i<=d;i++)
{
for(int j=0;j<=d;j++)
{
z+=rhs[j]*xfn(i,j);
}
System.out.print(z+"z^"+i);
if(i!=d)
System.out.print("\t+\t");
z=0;
}
break;
default:System.out.println("Invalid choice!");
}
}
public static int xfn(int a,int i)
{
int val=1;
for(int j=0;j<i;j++)
{
val*=a;
}
return val;
}
} | [
"sweet.shweta73@gmail.com"
] | sweet.shweta73@gmail.com |
28aefd57bb20165cdf3bae67ae8829e8f3155f47 | a197dcc02c98151b519a921d7abc940c19f2dae9 | /Java8/src/Day0402/Hangman2.java | a841e3d0dfcd5d575733199a07be3ee8a422f746 | [] | no_license | EunJuOh33/java8 | a6b08a1c1e20433e76c761b6d435d9683d97a6e4 | d69d6d16ed2e65b5ece60a3d3657c3bf385d9765 | refs/heads/master | 2021-03-25T03:02:51.843520 | 2020-05-11T15:21:46 | 2020-05-11T15:21:46 | 247,584,474 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 260 | java | package Day0402;
public class Hangman2 extends Hangman {
static String[] arr = {"hello", "hospital", "capacity", "language"};
static String str = arr[(int)(Math.random()*arr.length)];
/* »ý¼ºÀÚ */
public Hangman2() {
super(str);
}
}
| [
"yn-s04@DESKTOP-7TBF8RP"
] | yn-s04@DESKTOP-7TBF8RP |
e38ac5c02f420ef99210e815e5b7b55b21eb20f4 | 7139a93e7d5515fd490e4c2d838f906043999add | /src/application/beans/Coordinates.java | 1e3f6615aa134af2c1b931736c9360a2744772ac | [] | no_license | antoniospoletojr/Fractal-Explorer | 3d3ba021e91234513d31e8ac85aed3e5855f8138 | 2b36bf5199918092989393f72136c9a47669823a | refs/heads/master | 2020-06-21T21:12:32.537038 | 2019-09-12T21:10:49 | 2019-09-12T21:10:49 | 197,553,525 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,793 | java | package application.beans;
/**
* Bean class implementing the coordinates of the complex plane, used to render the fractals.
* It implements Cloneable for the Memento pattern.
* @author Antonio Spoleto Junior
*/
public class Coordinates implements Cloneable
{
private double realMax;
private double realMin;
private double imagMax;
private double imagMin;
public Coordinates(){}
/**
* Construct the plane with its 4 edges.
* @param realMax
* @param realMin
* @param imagMax
* @param imagMin
*/
public Coordinates(double realMax, double realMin, double imagMax, double imagMin)
{
this.realMax = realMax;
this.realMin = realMin;
this.imagMax = imagMax;
this.imagMin = imagMin;
}
public double getRealMax()
{
return realMax;
}
public void setRealMax(double realMax)
{
this.realMax = realMax;
}
public double getRealMin()
{
return realMin;
}
public void setRealMin(double realMin)
{
this.realMin = realMin;
}
public double getImagMax()
{
return imagMax;
}
public void setImagMax(double imagMax)
{
this.imagMax = imagMax;
}
public double getImagMin()
{
return imagMin;
}
public void setImagMin(double imagMin)
{
this.imagMin = imagMin;
}
@Override
public Coordinates clone() {
try {
return (Coordinates) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}
@Override
public String toString()
{
return "realMax=" + realMax + ", realMin=" + realMin + ", imagMax=" + imagMax + ", imagMin=" + imagMin;
}
}
| [
"spoletoantoniojr@libero.it"
] | spoletoantoniojr@libero.it |
18dc5fcdb546cde578a5d31cc92062a49391e1d6 | 0d380a2cdc70b7720c9b5b95cd96bc0f769257d1 | /src/main/java/com/redsparkle/foe/containers/player_additional_inventory/Slots/SlotAmmo.java | a9376fadb3095935e21d98af60acee95271bf4d9 | [
"MIT"
] | permissive | BrotherLavarius/Fallout_Equestria | 6d0f2004044db8a856a01a780e307d7d3d1e7378 | 090278c4e4454f90366a5088b73bfeb80c76237c | refs/heads/master | 2022-03-12T05:22:02.033915 | 2018-04-05T13:58:50 | 2018-04-05T13:58:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,467 | java | package com.redsparkle.foe.containers.player_additional_inventory.Slots;
import com.redsparkle.api.items.helpers.Item_Instances.Item_AmmoHolder;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
/**
* Created by hoijima on 28.06.17.
*/
public class SlotAmmo extends Slot {
/**
* The inventory we want to extract a slot from.
*/
public final IInventory inventory;
/**
* The index of the slot in the inventory.
*/
private final int slotIndex;
/**
* the id of the slot(also the index in the inventory arraylist)
*/
public int slotNumber;
/**
* display position of the inventory slot on the screen x axis
*/
public int xPos;
/**
* display position of the inventory slot on the screen y axis
*/
public int yPos;
public SlotAmmo(IInventory inventoryIn, int index, int xPosition, int yPosition) {
super(inventoryIn, index, xPosition, yPosition);
this.inventory = inventoryIn;
this.slotIndex = index;
this.xPos = xPosition;
this.yPos = yPosition;
}
@Override
public int getSlotIndex() {
return slotIndex;
}
@Override
public int getSlotStackLimit() {
return 65;
}
@Override
public boolean isItemValid(ItemStack stack) {
return super.isItemValid(stack) && stack.getItem() instanceof Item_AmmoHolder;
}
}
| [
"rkislinsky@devexperts.com"
] | rkislinsky@devexperts.com |
023b76c002aaf863be60ae0c81cc3f2f5af87a6b | e2904a117b4ba8582579955ad383cbf8250a6ae5 | /src/march11Codes/reviewMethods.java | 34f7e424b522c274e4fc306c5059a149b5408792 | [] | no_license | eyilmaz4/March11 | 05e24a8d42974333a4128f0071562f47f7baef01 | 52c239f4b473afd7c51201cdb106a1d072120926 | refs/heads/master | 2021-03-14T04:11:25.683507 | 2020-03-12T03:34:17 | 2020-03-12T03:34:17 | 246,735,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package march11Codes;
public class reviewMethods {
public static void main(String[] args) {
parkFee(true, 12);
}
public static void parkFee(Boolean member, int hour) {
int payment=0;
if (member) {
System.out.println("no charge");;
} else {
if (hour >= 1 && hour <= 2) {
payment = 3;
} else if (hour >= 3 && hour <= 6) {
payment = 5;
} else if (hour >= 7 && hour <= 12) {
payment = 10;
} else if (hour > 12) {
payment = 15;
}
}System.out.println("your parking fee is: $"+payment);
}
}
| [
"eyilmaz4@na.edu"
] | eyilmaz4@na.edu |
89ebe69b1c1ed3fdea9b4d1028e2bd1b74e67782 | 7a682dcc4e284bced37d02b31a3cd15af125f18f | /bitcamp-java-basic/src/main/java/ch20/d/Test04.java | 1a4a25f2045e0a2013d899ce5b378420d38198ce | [] | no_license | eomjinyoung/bitcamp-java-20190527 | a415314b74954f14989042c475a4bf36b7311a8c | 09f1b677587225310250078c4371ed94fe428a35 | refs/heads/master | 2022-03-15T04:33:15.248451 | 2019-11-11T03:33:58 | 2019-11-11T03:33:58 | 194,775,330 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | // HashMap에서 value 목록 꺼내기
package ch20.d;
import java.util.Collection;
import java.util.HashMap;
public class Test04 {
public static void main(String[] args) {
class Student {
String name;
int age;
public Student(String name, int age) {
this.name = name;
this.age = age;
}
@Override
public String toString() {
return "Student [name=" + name + ", age=" + age + "]";
}
}
HashMap<String, Student> map = new HashMap<>();
map.put("aaa", new Student("홍길동", 20));
map.put("bbb", new Student("임꺽정", 30));
map.put("ccc", new Student("안중근", 25));
// value 목록 꺼내기
Collection<Student> values = map.values();
for (Student value : values) {
System.out.println(value);
}
}
}
| [
"jinyoung.eom@gmail.com"
] | jinyoung.eom@gmail.com |
c971df983705b95dd8aa4ea022a91b8391181d65 | 330a4176df3be6c73a2c0af36391a92f04740789 | /app/src/main/java/cn/vailing/chunqiu/jiashifen/bean/FileBean.java | 7eead1bf768f00646f375d1141fb13d4240b9b12 | [] | no_license | WHUCC/JiaShiFen | 0d4b12a27d865deb01795b06956acb1c9d1a16dc | 9d9c0914729b437e558d33accaaa671b7c8c2282 | refs/heads/master | 2022-02-22T13:20:23.351742 | 2019-09-05T03:52:03 | 2019-09-05T03:52:03 | 276,130,042 | 1 | 0 | null | 2020-06-30T14:56:06 | 2020-06-30T14:56:05 | null | UTF-8 | Java | false | false | 1,083 | java | package cn.vailing.chunqiu.jiashifen.bean;
import android.widget.ImageButton;
/**
* Created by dream on 2018/7/4.
*/
public class FileBean {
private String thumbnailBigPath;
private String originalPath;
private ImageButton imageButton;
public ImageButton getImageButton() {
return imageButton;
}
public void setImageButton(ImageButton imageButton) {
this.imageButton = imageButton;
}
public FileBean( String thumbnailBigPath,String originalPath,ImageButton imageButton) {
this.imageButton = imageButton;
this.originalPath = originalPath;
this.thumbnailBigPath = thumbnailBigPath;
}
public FileBean() {
}
public String getOriginalPath() {
return originalPath;
}
public void setOriginalPath(String originalPath) {
this.originalPath = originalPath;
}
public String getThumbnailBigPath() {
return thumbnailBigPath;
}
public void setThumbnailBigPath(String thumbnailBigPath) {
this.thumbnailBigPath = thumbnailBigPath;
}
}
| [
"vailing817@gmail.com"
] | vailing817@gmail.com |
aa3245df68edf8f6eabe0f49901e90cc3217b6a3 | 38b0b4390600dae624ad18f81ce9be60a7c879c3 | /src/main/java/hellojpa/entity/Member.java | cc0aea35254d7752f324bdf028e4d6d697eef0cc | [] | no_license | Jis2nYoon/hello.jpa | 46a99dcc66bbe8125d85d465867b57e120a940be | c21d4bd45440ba7f41cd7d1370ccbf327c2f8ab4 | refs/heads/main | 2023-04-16T10:03:33.898565 | 2021-04-08T05:17:40 | 2021-04-08T05:17:40 | 355,455,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,342 | java | package hellojpa.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
@Entity
@NamedQuery(name = "Member.findByUsername", query="select m from Member m where m.name = :username")
public class Member {
@Id @GeneratedValue
private Long id;
@Column(name="USERNAME")
private String name;
private int age;
//fetch = FetchType.LAZY 로 해주면 JOIN 안하고 member만 조회함. team 사용하는 시점에서 team 조회함, 지연로딩!!(현업에서권장하는방법)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="TEAM_ID")
private Team team;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Team getTeam() {
return team;
}
public void setTeam(Team team) {
this.team = team;
}
@Override
public String toString() {
return "Member [id=" + id + ", name=" + name + ", age=" + age + ", team=" + team + "]";
}
}
| [
"yoosijisun12@gmail.com"
] | yoosijisun12@gmail.com |
a92b07f0c4efa162c11e7aafea8dfa4f882201b8 | 97e29489566dff2c2b309aebc66c91a69db234a3 | /asianpaintsb2b/asianpaintsb2bcockpits/src/com/asianpaintsb2b/cockpits/cmscockpit/browser/filters/AbstractUiExperienceFilter.java | 2335433573803cbd551cf73a413c7d95118f7d2c | [] | no_license | vamshivushakola/Home_asianpaints_b2b | f8ea6568dca3e87375a100c5d9e8f801e702404c | 9ea46652e699fc843f8bb55f94a826bb1a9c4fd0 | refs/heads/master | 2020-12-31T04:56:13.029311 | 2016-05-22T18:28:48 | 2016-05-22T18:28:48 | 58,956,762 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,959 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of 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 hybris.
*
*
*/
package com.asianpaintsb2b.cockpits.cmscockpit.browser.filters;
import de.hybris.platform.cockpit.model.meta.PropertyDescriptor;
import de.hybris.platform.cockpit.model.search.Query;
import de.hybris.platform.cockpit.model.search.SearchParameterValue;
import de.hybris.platform.cockpit.services.meta.TypeService;
import de.hybris.platform.cockpit.session.BrowserFilter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Required;
public abstract class AbstractUiExperienceFilter implements BrowserFilter
{
private static final String ABSTRACT_PAGE_DEFAULT_PROPERTY_DESC = "abstractPage.defaultPage";
public static final String UI_EXPERIENCE_PARAM = "uiExperienceParam";
private TypeService typeService;
public TypeService getTypeService()
{
return typeService;
}
@Required
public void setTypeService(final TypeService typeService)
{
this.typeService = typeService;
}
public void removeDefaultPageFilter(final Query query)
{
//we have to remove a defaultPage = true filter if we are interested in immediate results..
final PropertyDescriptor propertyDescriptor = typeService.getPropertyDescriptor(ABSTRACT_PAGE_DEFAULT_PROPERTY_DESC);
final List<SearchParameterValue> finalSearchParams = new ArrayList<SearchParameterValue>();
for (final SearchParameterValue searchParameter : query.getParameterValues())
{
if (!propertyDescriptor.equals(searchParameter.getParameterDescriptor()))
{
finalSearchParams.add(searchParameter);
}
}
query.setParameterValues(finalSearchParams);
}
}
| [
"vamshi.vshk@gmail.com"
] | vamshi.vshk@gmail.com |
1090ac7ca7db92ea2b46826c0ca152f25a2b2124 | b02b82032567f2b2d5882016b313dbc60dbd91d7 | /app/src/main/java/ua/tarastom/newsaggregator/api/ApiInterface.java | a0fb01056683b3015c64ee4bacd4ae17ec6b4cf6 | [] | no_license | HeavyMetal77/NewsAggregator | 39a785034cfb7c209dec91222d4159fcaccceae3 | 67803ac9900a633d379b818e0077455092cdf572 | refs/heads/main | 2023-02-15T06:33:19.656969 | 2020-12-21T09:28:18 | 2020-12-21T09:28:18 | 328,184,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package ua.tarastom.newsaggregator.api;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;
import ua.tarastom.newsaggregator.models.News;
public interface ApiInterface {
@GET("find")
Call<News> getFeed(
@Query("key") String keyWord,
@Query("country") String country,
@Query("category") String category,
@Query("language") String language,
@Query("titleChannel") String titleChannel,
@Query("page") int page,
@Query("size") int size
);
}
| [
"ttm2006@ukr.net"
] | ttm2006@ukr.net |
f527af81dcd24427dde869074c4e02a155e649c6 | 27b260a46caa09eb5f28877ffc27322881b80a6b | /task2/src/main/java/com/vinaypabba/task2/Task2Application.java | b40983f37a4f5f680c64090007c826376d6a18f3 | [] | no_license | vinaynikhil313/assignment | 65435646dd84198cfa93d692e61a1e6ee362c87c | 0abbcce02640e59b75b27016814bd9cb4338859b | refs/heads/master | 2022-11-16T22:01:38.041403 | 2020-07-13T05:37:35 | 2020-07-13T05:37:35 | 279,120,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 968 | java | package com.vinaypabba.task2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
public class Task2Application {
public static void main(String[] args) {
SpringApplication.run(Task2Application.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.vinaypabba.task2"))
.paths(PathSelectors.any())
.build();
}
}
| [
"vpabba@cognitivescale.com"
] | vpabba@cognitivescale.com |
b01ceec332847b5e41fd4e6aadd98d5894d3dec4 | 6417a01e8635d2cd660c7481af3a6adefc61d9b9 | /src/main/java/io/zipcoder/tc_spring_poll_application/Repositories/VoteRepository.java | ecfd92dce155a294cc517f8a366377be1f0bbb7d | [] | no_license | vaidehi4321/Maven.Spring-QuickPollApplication | 578067845d31167fa75189b45cebd47071fe7ecc | e44c58655ee828b2ea8cd408c53d3b114929a41e | refs/heads/master | 2020-09-27T17:07:17.172498 | 2019-12-14T21:21:19 | 2019-12-14T21:21:19 | 226,565,769 | 0 | 0 | null | 2019-12-07T19:31:56 | 2019-12-07T19:31:55 | null | UTF-8 | Java | false | false | 645 | java | package io.zipcoder.tc_spring_poll_application.Repositories;
import io.zipcoder.tc_spring_poll_application.domain.Vote;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface VoteRepository extends CrudRepository<Vote, Long> {
@Query(value = "SELECT v.* " +
"FROM Option o, Vote v " +
"WHERE o.POLL_ID = ?1 " +
"AND v.OPTION_ID = o.OPTION_ID", nativeQuery = true)
public Iterable<Vote> findVotesByPoll(Long pollId);
Iterable<Vote> findById(Long pollId);
}
| [
"56602405+vaidehi4321@users.noreply.github.com"
] | 56602405+vaidehi4321@users.noreply.github.com |
0fd90faced321c87436ba4004d31f9b25b9b81b0 | d168c02c4753a30bd0bf07e86b49ccacfb9b5f83 | /AndroidViews/src/net/learn2develop/PurchaseOrders/WebServiceTransferTo.java | f06de6af9166027209fca99c247e8aae44093f88 | [] | no_license | luizsr/jtelmon | 3ec5e679523ab3adf602c9beeb0fae7ca68447f0 | 6792e3dc8152f058fd16d0862b7b1aae051bb25c | refs/heads/master | 2021-01-10T07:43:46.820147 | 2015-03-12T17:28:07 | 2015-03-12T17:28:07 | 47,506,842 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,327 | java |
package net.learn2develop.PurchaseOrders;
import net.learn2develop.R;
import java.util.List;
import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.json.JSONStringer;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import android.util.Log;
public class WebServiceTransferTo extends Activity {
private final static String SERVICE_URI = "http://sfa.pangram.ro:8090/PostgresWebService/rest";
// private final static String SERVICE_URI = "http://192.168.61.3/SalesService/SalesService.svc";
// private final static String SERVICE_URI = "http://ftp.pangram.ro:9090/SalesService/SalesService.svc";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ProgressDialog progressDialog = ProgressDialog.show(this, "", "Trimitere comenzi...");
new Thread() {
public void run() {
SyncOrders();
progressDialog.dismiss();
}
}.start();
}
private Handler threadHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
String isNot = new String(" ");
if (msg.what == 0) {
// t3.setText(msg.getData().getString("result"));
isNot = msg.getData().getString("result");
Toast.makeText(WebServiceTransferTo.this, isNot + " OK ! " + "\n", Toast.LENGTH_LONG).show() ;
}
super.handleMessage(msg);
}
};
public void SyncOrders() {
Message messageToThread = threadHandler.obtainMessage();
DataManipulator dm;
List<String[]> ordersToSend = null ;
dm = new DataManipulator(this);
ordersToSend = dm.selectAllOrders();
String isNot = new String(" ");
Bundle messageData = new Bundle();
HttpPost request = new HttpPost(SERVICE_URI + "/sales");
request.setHeader("Accept", "application/json");
request.setHeader("Content-type", "application/json");
for (String[] orderToSend : ordersToSend) {
String idLineToSend = orderToSend[0];
String clientToSend = orderToSend[1];
String productToSend = orderToSend[2];
String piecesToSend = orderToSend[3];
String discountToSend = orderToSend[4];
try {
JSONStringer jsonOrderToSend = new JSONStringer()
.object()
.key("client").value(clientToSend)
.key("product").value(productToSend)
.key("pieces").value(piecesToSend)
.key("discount").value(discountToSend)
.key("line").value(idLineToSend)
.endObject();
StringEntity entity = new StringEntity(jsonOrderToSend.toString());
Log.d( " OrderLine " , jsonOrderToSend.toString() + "\n" ) ;
request.setEntity(entity);
// Send request to REST Web Service ->
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(request);
// IF [200=response.getStatusLine().getStatusCode()] => HttpResponse=OK
Log.d("WebInvoke", " OK if 200 = " + response.getStatusLine().getStatusCode());
}catch (Exception e) {
isNot = "NOT ";
}
}
// Toast.makeText(this, isNot + " OK ! " + "\n", Toast.LENGTH_LONG).show() ;
messageToThread.what = 0;
messageData.putString("result", isNot);
messageToThread.setData(messageData);
threadHandler.sendMessage(messageToThread);
if (dm != null) {
dm.close();
}
}
}
| [
"auntaru@fbeace9d-d74f-0410-b0ac-cf0a61670a25"
] | auntaru@fbeace9d-d74f-0410-b0ac-cf0a61670a25 |
d9e2cd28cbc913e67d85a22e7e975faa7a6d00d1 | 460b146c295355d34b47a5a7c771a3c3c52f238d | /app/src/main/java/com/hj/app/oschina/ui/fragment/ExploreFragment.java | ce0f35a2b1d2d282639a753721435f3297de31ef | [] | no_license | toberole/oschina-mvp | 611a2d889872285ad807ca7dd999c34973a11896 | 9700c7d9409514285d1f45e7f3e63deed59cf293 | refs/heads/master | 2021-06-10T04:03:59.185625 | 2016-09-26T10:58:04 | 2016-09-26T10:58:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.hj.app.oschina.ui.fragment;
import android.view.View;
import com.hj.app.oschina.R;
import com.hj.app.oschina.base.BaseFragment;
/**
* Created by huangjie08 on 2016/8/18.
*/
public class ExploreFragment extends BaseFragment {
@Override
public int getLayoutId() {
return R.layout.fragment_custom;
}
@Override
public void initView(View root) {
}
@Override
public void initData() {
}
}
| [
"huangjie"
] | huangjie |
ae8c13ddcb4240b423a08bfc38e83dcfbcae5c7a | 63ab92f2daeb8c395b353f75c4ed78f018a1371e | /20190306@DesignPattern/src/chielong/pattern/decorator/passport/ISigninService.java | 194cf217211905bc082332c496e8636c50b52f76 | [] | no_license | chielong/Study | 52cd952f1475661590e976221455e6ac41573333 | 04e7264630e2889892f0780a83e93bf3387408c0 | refs/heads/master | 2020-04-27T21:35:53.433945 | 2019-05-10T09:06:49 | 2019-05-10T09:06:49 | 174,566,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | package chielong.pattern.decorator.passport;
import chielong.pattern.adapter.login.ResultMsg;
public interface ISigninService {
ResultMsg register(String username , String password);
ResultMsg login(String username , String password);
}
| [
"1184927949@qq.com"
] | 1184927949@qq.com |
6fc6c3fb389dee402f1006faba98750f02e5d228 | 18f51e55d572837d880a2223140bd61127a18459 | /src/main/java/ru/job4j/module4polimorphism/straregy/Square.java | c0d2b7879ba1565a7326ab92d0922ac3439fa0cc | [] | no_license | kuvera22/job4j_OOP | e19263c5670119819aecbdeaca128b6d986d86ac | 2958e5552cb320f7aa1fde86eae0a5f774f6470b | refs/heads/master | 2023-07-02T05:49:02.353075 | 2021-08-03T20:29:30 | 2021-08-03T20:29:30 | 389,351,201 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package ru.job4j.module4polimorphism.straregy;
public class Square implements Shape {
@Override
public String draw() {
String ln = System.lineSeparator();
return " ____" + ln
+ "| |" + ln
+ "|____|" + ln;
}
}
| [
"kuvera22@mail.ru"
] | kuvera22@mail.ru |
e7c249afd565aa8688d3a6e0d3a0f694101afcc1 | 88c866eab06fa3e896b0bd709caaa630b1d8ae41 | /src/exe234/Student.java | f2fee941670a100553cc1fc63efbadf2f6387fcd | [] | no_license | lebaohung/Java-HomeWork | b3b8a60233d36f76897c33ec97eff57f604e966f | 4822124e25386984c4d60b78850fb45f23d338eb | refs/heads/master | 2021-05-21T02:34:29.587628 | 2020-04-03T08:13:08 | 2020-04-03T08:13:08 | 252,504,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | package exe234;
import java.util.Scanner;
public class Student extends Person {
private int id;
private double averageScore ;
private String email;
private boolean getScholarship = false;
public Student() {
}
public Student(String name, String gender, int birth, String add, int id, double averageScore, String email) {
super(name, gender, birth, add);
this.id = id;
this.averageScore = averageScore;
this.email = email;
if (this.averageScore > 8) this.setGetScholarship(true);
}
public int getId() {
return id;
}
public boolean isGetScholarship() {
return getScholarship;
}
public void setGetScholarship(boolean getScholarship) {
this.getScholarship = getScholarship;
}
public double getAverageScore() {
return averageScore;
}
public String getEmail() {
return email;
}
public void setId(int id) {
this.id = id;
}
public void setAverageScore(double averageScore) {
this.averageScore = averageScore;
}
public void setEmail(String email) {
this.email = email;
}
public void inputStudent() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter Student name: ");
this.setName(scanner.nextLine());
System.out.print("Enter gender (male/female): ");
this.setGender(scanner.nextLine());
System.out.print("Enter birthday: ");
this.setBirth(scanner.nextInt());
scanner.nextLine();
System.out.print("Enter address: ");
this.setAdd(scanner.nextLine());
System.out.print("Enter Student ID: ");
this.setId(scanner.nextInt());
System.out.print("Enter Student's average score: ");
this.setAverageScore(scanner.nextDouble());
scanner.nextLine();
System.out.print("Enter Student Email: ");
this.setEmail(scanner.nextLine());
}
public void displayStudent() {
System.out.printf("%-15s%-10s%-10d%-10s%-10d%-10.2f%-30s",this.getName(), this.getGender(), this.getBirth(), this.getAdd(),this.getId(), this.getAverageScore(), this.getEmail());
System.out.println();
}
public void checkScholarship() {
if (this.getAverageScore() > 8) {
this.getScholarship = true;
}
}
}
| [
"lebaohung.1996@gmail.com"
] | lebaohung.1996@gmail.com |
da8eedbaf71222ddf0ae0466075cb7a9b07caa47 | f4593abde861f751668565d2961d6e75304f98d3 | /src/main/java/org/soulwing/jwt/api/PublicKeyLocator.java | 24e86d475916dfa82a8298258ff251843501bfea | [
"Apache-2.0"
] | permissive | soulwing/jwt-api | f5fda3d4c7d26a5397b7645fc3166a0dcc23b295 | c894bd33001cffb6ebdc3d6e3b6ae81f5bd4f9ae | refs/heads/master | 2023-05-10T11:11:07.267683 | 2023-04-28T11:39:29 | 2023-04-28T11:39:29 | 174,628,888 | 0 | 0 | NOASSERTION | 2023-04-28T11:39:30 | 2019-03-09T00:18:44 | Java | UTF-8 | Java | false | false | 5,250 | java | /*
* File created on Mar 17, 2019
*
* Copyright (c) 2019 Carl Harris, Jr
* and others as noted
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.soulwing.jwt.api;
import java.net.URI;
import java.security.PublicKey;
import java.security.cert.X509Certificate;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import org.soulwing.jwt.api.exceptions.CertificateException;
import org.soulwing.jwt.api.exceptions.CertificateValidationException;
import org.soulwing.jwt.api.exceptions.PublicKeyNotFoundException;
/**
* A service provider that locates a public key given criteria from a JOSE
* header.
*
* @author Carl Harris
*/
public interface PublicKeyLocator {
/**
* An enumeration of strategy types for locating public keys.
*/
enum StrategyType {
/** certificate chain in {@code x5c} header claim */
CERT_CHAIN,
/** certificate chain URL in {@code x5u} header claim */
CERT_CHAIN_URL,
/** JSON web key in {@code jwk} header claim */
JWK,
/** JSON web key URL in {@code jku} header claim */
JWK_URL
}
/**
* A builder that creates a {@link PublicKeyLocator}.
*/
interface Builder {
/**
* Locator strategies to enable; by default <em>all</em> strategies are
* considered in the order given in the {@link StrategyType} enumeration.
* @param strategies locator strategies;
* @return this builder
*/
Builder strategies(Set<StrategyType> strategies);
/**
* Specifies the certificate validator.
* @param validator certificate validator
* @return this builder
*/
Builder certificateValidator(X509CertificateValidator validator);
/**
* Specifies the certificate validator factory.
* @param validatorFactory certificate validator factory
* @return this builder
*/
Builder certificateValidatorFactory(
X509CertificateValidator.Factory validatorFactory);
/**
* Builds a locator in accordance with the configuration of this builder.
* @return locator
*/
PublicKeyLocator build();
}
/**
* Criteria for a public key search as obtained from the JOSE header.
*/
interface Criteria {
/**
* Gets the value of the {@code kid} header.
* @return header value or {@code null} if the header is not present
*/
String getKeyId();
/**
* Gets the value of the {@code x5c} header.
* @return list of certificates or {@code null} if header is not present
* @throws CertificateException if an error occurs in producing the
* certificate chain
*/
List<X509Certificate> getCertificateChain()
throws CertificateException;
/**
* Gets the value of the {@code x5u} header.
* @return certificate chain URL or {@code null} if header is not present
*/
URI getCertificateChainUrl();
/**
* Gets an object that can be used to match values of the {@code x5t}
* and {@code x5t#S256} headers.
* @return thumbprint if either header is available, otherwise {@code null}
* @throws CertificateException if an error occurs in producing the
* thumbprint
*/
Thumbprint getCertificateThumbprint() throws CertificateException;
/**
* Gets the value of the {@code jwk} header.
* @return web key or {@code null} if header is not present
* @throws CertificateException if an error occurs in producing the web key
*/
JWK getWebKey() throws CertificateException;
/**
* Gets the value of the {@code jku} header.
* @return URL or {@code null} if header is not present
*/
URI getWebKeyUrl();
}
/**
* An object that encapsulates the algorithms and matching operations for
* certificate thumbprints provided in the JOSE header.
*/
interface Thumbprint {
/**
* Gets a predicate that tests whether this thumbprint matches a given
* certificate
* @return predicate
* @throws CertificateException if the matcher cannot be created due to
* an error (e.g. a JCA error in obtaining MessageDigest instances)
*/
Predicate<X509Certificate> matcher() throws CertificateException;
}
/**
* Locates the public key described by the given criteria, if possible.
* @param criteria criteria to match
* @return public key information
* @throws CertificateValidationException if a certificate containing the
* matching public key fails validation; e.g. expired, revoked,
* untrusted, etc
* @throws PublicKeyNotFoundException if a matching public key cannot be
* found
*/
PublicKeyInfo locate(Criteria criteria) throws PublicKeyNotFoundException,
CertificateValidationException;
}
| [
"ceharris@vt.edu"
] | ceharris@vt.edu |
56e50cf6649e3270ba0d69deb9dbeeed77238cea | 19c7d3b55abf898390ee86d5db5383f35b2673c7 | /BD_AggregateServer_Maven/src/main/java/com/cloud/mina/unit_a/strategy/UnitASportsPacketHandleStrategy.java | 894d17bdfbb15518c2cbd716c30b1de0c27ebdd9 | [] | no_license | wangXiGits/bdlab | f02fbf889df9d7a400183913e61471439f02d307 | 8a8bb0e8461b10a2dcd6a491a07386cec10be14c | refs/heads/master | 2022-11-08T19:33:03.417137 | 2020-04-26T06:36:30 | 2020-04-26T06:36:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,892 | java | package com.cloud.mina.unit_a.strategy;
import java.util.HashMap;
import java.util.Map;
import org.apache.mina.core.session.IoSession;
import com.cloud.mina.unit_a.sportpackage.PackageData;
import com.cloud.mina.unit_a.sportstate.SportLogoutState;
import com.cloud.mina.unit_a.sportstate.SportNo1LoginState;
import com.cloud.mina.unit_a.sportstate.SportNo8OneWayState;
import com.cloud.mina.unit_a.sportstate.SportNo8ThreeWayState;
import com.cloud.mina.unit_a.sportstate.SportNo8TwoWayState;
import com.cloud.mina.unit_a.sportstate.SportsPacketHandleState;
/**
* unitA公司运动数据处理策略类(策略模式) UnitASportsPacketHandleStrategy就是Context(状态模式)
*/
public class UnitASportsPacketHandleStrategy implements MHDataPacketHandleStrategy {
static Map<String, Class> classMap = new HashMap<String, Class>();
// 定义变量区域
static {
classMap.put("login", SportNo1LoginState.class);
classMap.put("logout", SportLogoutState.class);
classMap.put("No8-1", SportNo8OneWayState.class);
classMap.put("No8-2", SportNo8TwoWayState.class);
classMap.put("No8-3", SportNo8ThreeWayState.class);
}
SportsPacketHandleState state = null;
public void setState(SportsPacketHandleState state) {
this.state = state;
}
public void handle(IoSession session, Object message) {
// TODO Auto-generated method stub
// 根据数据包的头,调用具体的状态类
if (message != null && message instanceof PackageData) {
PackageData packageData = (PackageData) message;
try {
setState((SportsPacketHandleState) classMap.get(packageData.getType()).newInstance());
state.handlePacket(session, message);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"414269688@qq.com"
] | 414269688@qq.com |
07d5b7891f18dae652f22d380ca28194d3a0670d | e0ae3741ef634c8fba8f913879b19a552d7ff0e2 | /backend/src/main/java/com/devsuperior/dsvendas/entities/Sale.java | 821c5d3143e99f671706e2fed817283d82b1d0dc | [] | no_license | Thiteago/Spring-React | 233268f2f0f5d27bc44770816b1df8d1db1ba51e | ea1d2d653c99a78f7c52d9eed9a3c2433fc9cf78 | refs/heads/main | 2023-07-29T11:30:23.372042 | 2021-09-12T16:24:28 | 2021-09-12T16:24:28 | 403,775,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package com.devsuperior.dsvendas.entities;
import java.time.LocalDate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "tb_sales")
public class Sale {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Integer visited;
private Integer deals;
private Double amount;
private LocalDate date;
@ManyToOne
@JoinColumn(name = "seller_id")
private Seller seller;
public Sale() {
}
public Sale(Long id, Integer visited, Integer deals, Double amount, LocalDate date, Seller seller) {
this.id = id;
this.visited = visited;
this.deals = deals;
this.amount = amount;
this.date = date;
this.seller = seller;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getVisited() {
return visited;
}
public void setVisited(Integer visited) {
this.visited = visited;
}
public Integer getDeals() {
return deals;
}
public void setDeals(Integer deals) {
this.deals = deals;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Seller getSeller() {
return seller;
}
public void setSeller(Seller seller) {
this.seller = seller;
}
}
| [
"thiagodavidpd@gmail.com"
] | thiagodavidpd@gmail.com |
6ed93c2843c41355a91f2654f46cb85cf57e8072 | 82dfac8dc593c7d1325a9bd427a6f91c92d336fe | /src/main/java/helloWord/homeWork_5_2_Pleers/PleerFour.java | ff62c1393d2cd84c63d48cde53ca51b25bc66e03 | [] | no_license | VitaliyZhernovoy/GoJava8--Full | 600c5c4d924bc1ca6c1120af0a523d4230f579a5 | 9bfca065e60e6a17df6abad6082b23e195a06fe6 | refs/heads/master | 2020-12-02T17:56:43.300289 | 2018-05-24T11:01:42 | 2018-05-24T11:01:42 | 96,450,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 686 | java | package helloWord.homeWork_5_2_Pleers;
/**
* Created by Оля on 04.10.2017.
*/
public class PleerFour extends PleerThree {
protected PleerFour(int price, String pleerName, String playlist) {
super(price, pleerName, playlist);
super.description="Этот плеер может проиграть последнюю песню и весь плейлист";
}
@Override
public void playSong() {
System.out.println("играет плеер - " + super.pleerName);
System.out.println(description);
System.out.println("Сейчас играет последняя композиция - " + (super.playlist.length-1));
}
}
| [
"vitaliyzhernovoy@gmail.com"
] | vitaliyzhernovoy@gmail.com |
88157b1e1ac8ce059725de0dc5474418a7d771c5 | aa241e2c3d2948550a853fc420f3f82c37447e2d | /numbersequencesummarizer/src/main/java/com/numbersequencesummarizer/numbersequencesummarizer/NumbersequencesummarizerApplication.java | 851275ad642f785843e3536366cd71de77e2a585 | [] | no_license | Justin0911/impactTest | ff6827783f6cd07b25b56c610c2a0504f9643827 | 5ad4fdef254f8d06fad70619d1d33696e50b6a83 | refs/heads/master | 2023-01-20T21:32:30.874559 | 2020-11-17T06:14:59 | 2020-11-17T06:14:59 | 313,523,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.numbersequencesummarizer.numbersequencesummarizer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@EnableWebMvc
@SpringBootApplication
@ComponentScan({
"com.numbersequencesummarizer.numbersequencesummarizer.getAPI",
"com.numbersequencesummarizer.numbersequencesummarizer.sequenceSummary",
"com.numbersequencesummarizer.numbersequencesummarizer.summarizerService"})
public class NumbersequencesummarizerApplication {
public static void main(String[] args) {
SpringApplication.run(NumbersequencesummarizerApplication.class, args);
}
} | [
"justhemansmith@gmail.com"
] | justhemansmith@gmail.com |
e8203299159d4ce4359bae8b2554f5da3fb0bda5 | fbdf15d88ea1c4eadab707cd2717d79c13469b02 | /src/test/java/com/example/SpringRestServerTest/SpringRestServerTestApplicationTests.java | 863a53c4aa6ea0a39432b827e7c77603e122afbe | [] | no_license | bastienChe/springRestTest | ccf9e805b37b950dec1cdab897ed448f7df1eeee | 822549ac9d486f45bc0e5dc11043a0fd16366497 | refs/heads/master | 2022-11-22T22:53:28.409393 | 2020-07-27T20:35:15 | 2020-07-27T20:35:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.example.SpringRestServerTest;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringRestServerTestApplicationTests {
@Test
void contextLoads() {
}
}
| [
"bchevriaut@gmail.com"
] | bchevriaut@gmail.com |
36483fe4ce9c826ec996fc54ac064a13fa5d13d1 | 5dd092442f022addfd1989c592bb65864e45cf3b | /src/com/example/mobilesafe/SettingActivity.java | bda209bdfcfb517310a34e8f9e7413471572a480 | [] | no_license | xuegz/MobileSafe | faa63211003c6aefab703d7246cecc99cea3a25b | b6cfddfe7960874a79b2d12373a2988701fd5e41 | refs/heads/master | 2021-01-10T01:20:36.087747 | 2016-04-06T02:41:11 | 2016-04-06T02:41:11 | 55,400,963 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,664 | java | package com.example.mobilesafe;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import com.example.service.CallSafeService;
import com.example.service.WatchDogService;
import com.example.view.SettingClickView;
import com.example.view.SettingView;
/*
* 设置中心页面
*/
public class SettingActivity extends Activity {
private SettingView sv_update;
private SettingView sv_watch_dog;
private SettingView sv_phone;
private SettingView sv_black_number;
private SettingClickView scv_style;
private SettingClickView scv_location;
private SharedPreferences sp;
private Intent watchDogIntent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
sv_update = (SettingView) findViewById(R.id.sv_update);
sv_watch_dog = (SettingView) findViewById(R.id.sv_watch_dog);
sv_phone=(SettingView) findViewById(R.id.sv_phone);
sv_black_number=(SettingView) findViewById(R.id.sv_black_number);
scv_style=(SettingClickView) findViewById(R.id.scv_style);
scv_location=(SettingClickView) findViewById(R.id.scv_location);
sp = getSharedPreferences("info", MODE_PRIVATE);
initUpdate();
initWatchDog();
initPhone();
initAddress();
initDialogLocation();
initBlackNumber();
}
/*
* 自动更新
*/
public void initUpdate(){
boolean check_update = sp.getBoolean("status", true);
if (check_update){
//sv_update.setDesc("自动更新已开启");
sv_update.setStatus(true);
}else{
//sv_update.setDesc("自动更新已关闭");
sv_update.setStatus(false);
}
//sv_update.setTitle("自动更新设置");
sv_update.setOnClickListener(new OnClickListener() {
private boolean checked;
public void onClick(View v) {
checked = sv_update.getStatus();
System.out.println(checked+"check_update");
if (checked){
//sv_update.setDesc("自动更新已关闭");
sv_update.setStatus(false);
sp.edit().putBoolean("status", false).commit();
}else{
//sv_update.setDesc("自动更新已开启");
sv_update.setStatus(true);
sp.edit().putBoolean("status", true).commit();
}
}
});
}
/*
* 看萌狗
*/
public void initWatchDog(){
boolean check_watchDog=sp.getBoolean("status_watchDog", false);
watchDogIntent = new Intent(this, WatchDogService.class);
if (check_watchDog){
sv_watch_dog.setStatus(true);
// 开启拦截服务
startService(watchDogIntent);
}else{
sv_watch_dog.setStatus(false);
}
sv_watch_dog.setOnClickListener(new OnClickListener() {
private boolean checked;
public void onClick(View v) {
checked = sv_watch_dog.getStatus();
if (checked) {
sv_watch_dog.setStatus(false);
// 停止拦截服务
stopService(watchDogIntent);
sp.edit().putBoolean("status_watchDog", false).commit();
} else {
sv_watch_dog.setStatus(true);
// 开启拦截服务
startService(watchDogIntent);
sp.edit().putBoolean("status_watchDog", true).commit();
}
}
});
}
/*
* 归属地
*/
public void initPhone(){
boolean check_phone=sp.getBoolean("status_phone", false);
if (check_phone){
sv_phone.setStatus(true);
}else{
sv_phone.setStatus(false);
}
sv_phone.setOnClickListener(new OnClickListener() {
private boolean checked;
public void onClick(View v) {
checked = sv_phone.getStatus();
if (checked){
sv_phone.setStatus(false);
sp.edit().putBoolean("status_phone", false).commit();
}else{
sv_phone.setStatus(true);
sp.edit().putBoolean("status_phone", true).commit();
}
}
});
}
/*
* 设置归属地风格
*/
public void initAddress(){
scv_style.setTitle("归属地提示框风格");
sp=getSharedPreferences("info", MODE_PRIVATE);
String addressStyle=sp.getString("addressStyle","半透明");
scv_style.setDesc(addressStyle);
scv_style.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showSingleChoiceDialog();
}
});
}
//单选对话框
public void showSingleChoiceDialog(){
AlertDialog.Builder builder=new Builder(this);
builder.setTitle("归属地提示框风格");
builder.setIcon(R.drawable.ic_launcher);
final String[] items=new String[]{"半透明","活力橙","卫士蓝","金属灰","土豪金"};
builder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sp.edit().putString("addressStyle", items[which]).commit();
scv_style.setDesc(items[which]);
dialog.dismiss();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
builder.create().show();
}
/*
* 设置归属地提示框的显示位置
*/
public void initDialogLocation(){
scv_location.setTitle("归属地提示框显示位置");
scv_location.setDesc("归属地提示框显示位置");
scv_location.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
startActivity(new Intent(SettingActivity.this, DialogLocationActivity.class));
}
});
}
/*
* 黑名单
*/
public void initBlackNumber(){
boolean checked=sp.getBoolean("setBlackNumber", true);
if (checked){
sv_black_number.setStatus(true);
startService(new Intent(this, CallSafeService.class));
}else{
sv_black_number.setStatus(false);
}
sv_black_number.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
boolean b=sv_black_number.getStatus();
if (b){
sp.edit().putBoolean("setBlackNumber", false).commit();
sv_black_number.setStatus(false);
stopService(new Intent(SettingActivity.this, CallSafeService.class));
}else{
sp.edit().putBoolean("setBlackNumber", true).commit();
sv_black_number.setStatus(true);
startService(new Intent(SettingActivity.this, CallSafeService.class));
Log.v("System.out", "开启服务");
}
}
});
}
}
| [
"99276854@qq.com"
] | 99276854@qq.com |
865ccdafd8dabbcd5a3d4f26ee3c5b3c4e070554 | 279ce23db15004038ce9001027964dec4c5459f0 | /src/Conexion/ConexionBD.java | c2fb4ded73e3153f7587cdd2261f352b5fdfe9c9 | [] | no_license | jpmazate90/InventarioCUNOC | f893c817fb887c094639969a39a364f7b5904a7f | 3eade9cefc3667fbf411fe58d869aa5d7656b235 | refs/heads/master | 2022-12-14T12:21:38.739488 | 2020-09-10T03:29:25 | 2020-09-10T03:29:25 | 284,141,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,316 | 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 Conexion;
import java.awt.Frame;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
/**
*
* @author jpmazate
*/
public class ConexionBD {
public static Connection connection= null;
public static Connection getInstance(){
if(connection == null){
try {
String user = "jp";
String password = "Suchi123!";
// La url incluye el esquema a usar, en este caso 'mysql'
String urlConnection ="jdbc:mysql://localhost:3306/inventario";
//abrimos una coneccion a la DB usando una url, el usuario y password (SUSTITUIR PASSWORD)
connection = DriverManager.getConnection(urlConnection,user,password);
return connection;
}catch(SQLException e){
e.printStackTrace();
JOptionPane.showMessageDialog(null,"NO SE PUDO CONECTAR A LA BASE DE DATOS");
return null;
}
}else{
return connection;
}
}
}
| [
"juanpablo-orizabalgil@cunoc.edu.gt"
] | juanpablo-orizabalgil@cunoc.edu.gt |
025114a4389572ec70ffaa545450a0f55dcd3e12 | 35b710e9bc210a152cc6cda331e71e9116ba478c | /tc-main/src/main/java/com/topcoder/security/groups/services/dto/ProjectDTO.java | a5fdaf7c17513e723cad06568184ad0bae68db04 | [] | no_license | appirio-tech/tc1-tcnode | d17649afb38998868f9a6d51920c4fe34c3e7174 | e05a425be705aca8f530caac1da907d9a6c4215a | refs/heads/master | 2023-08-04T19:58:39.617425 | 2016-05-15T00:22:36 | 2016-05-15T00:22:36 | 56,892,466 | 1 | 8 | null | 2022-04-05T00:47:40 | 2016-04-23T00:27:46 | Java | UTF-8 | Java | false | false | 1,656 | java | /*
* Copyright (C) 2011 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.security.groups.services.dto;
/**
* <p>
* This class represents relevant info about a project
* </p>
* <p>
* <strong>Thread Safety:</strong> This class is mutable and not thread safe
* </p>
*
* @author TCSASSEMBLER
* @version 1.0 (Topcoder Security Groups Backend Model and Authorization
* Assembly v1.0 )
* @since 1.0
*/
public class ProjectDTO {
/**
* <p>
* Represents the ID of the project It is managed with a getter and setter,
* hence fully mutable. It may have any value.
* </p>
*/
private long projectId;
/**
* <p>
* Represents the name of the project It is managed with a getter and
* setter, hence fully mutable. It may have any value.
* </p>
*/
private String name;
/**
* <p>
* Default constructor.
* </p>
*/
public ProjectDTO() {
}
/**
* <p>
* Getter of projectId field.
* </p>
* @return the projectId
*/
public long getProjectId() {
return projectId;
}
/**
* <p>
* Setter of projectId field.
* </p>
* @param projectId the projectId to set
*/
public void setProjectId(long projectId) {
this.projectId = projectId;
}
/**
* <p>
* Getter of name field.
* </p>
* @return the name
*/
public String getName() {
return name;
}
/**
* <p>
* Setter of name field.
* </p>
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
}
| [
"dongzhengbin@winterflames-MacBook-Pro.local"
] | dongzhengbin@winterflames-MacBook-Pro.local |
40963828794cf87cee3e44acd7d7a533df72a828 | 25e1b83b023b8a12579167b47faaa794397d113e | /src/main/java/org/oummait/janazapp/web/rest/errors/InvalidPasswordException.java | b2f7fd45c3eb0c8099908a93d7ecda37ea085116 | [] | no_license | BulkSecurityGeneratorProject/Janazapp | f4aa8a33df724cbf1c1bce1acb987ed2fcb38c51 | 27eb909ee00422b036649fc3c466afe2e603f2a6 | refs/heads/master | 2022-12-14T02:36:54.814074 | 2018-12-04T11:49:41 | 2018-12-04T11:49:41 | 296,601,765 | 0 | 0 | null | 2020-09-18T11:29:41 | 2020-09-18T11:29:41 | null | UTF-8 | Java | false | false | 407 | java | package org.oummait.janazapp.web.rest.errors;
import org.zalando.problem.AbstractThrowableProblem;
import org.zalando.problem.Status;
public class InvalidPasswordException extends AbstractThrowableProblem {
private static final long serialVersionUID = 1L;
public InvalidPasswordException() {
super(ErrorConstants.INVALID_PASSWORD_TYPE, "Incorrect password", Status.BAD_REQUEST);
}
}
| [
"oihid-externe.belounis@edf.fr"
] | oihid-externe.belounis@edf.fr |
817ac7be3914e3f38af4e2a288b7512dc4820b51 | 17079fa276050a5a7b5994d7fae541d7d0cfa3b3 | /yxw-commons/src/main/java/com/yxw/commons/entity/platform/app/color/AppColor.java | 8b41c3bb98f9a1d9b9729df505e480e190f95107 | [] | no_license | zhiji6/yxw | 664f6729b6642affb8ff1ee258b915f8d1ccf666 | 7f75370fcd425cda11faf3d2c54e6119ecc7d9fd | refs/heads/master | 2023-08-17T00:12:03.150081 | 2019-12-04T07:33:45 | 2019-12-04T07:33:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package com.yxw.commons.entity.platform.app.color;
import com.yxw.base.entity.BaseEntity;
public class AppColor extends BaseEntity {
private static final long serialVersionUID = 8114263231882165544L;
// 平台名称
private String appName;
// appCode, 银联:unionpay
private String appCode;
// 3/6位的颜色值,带#
private String color;
private String payInfoViewType = "iframe";
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getAppCode() {
return appCode;
}
public void setAppCode(String appCode) {
this.appCode = appCode;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getPayInfoViewType() {
return payInfoViewType;
}
public void setPayInfoViewType(String payInfoViewType) {
this.payInfoViewType = payInfoViewType;
}
}
| [
"279430985@qq.com"
] | 279430985@qq.com |
0d4d0ce168b479ce059a312af985f7d358ff8b40 | 2f7eafeaac196d4ed699345e4376012388f25f96 | /java/src/PLE.java | ab119a6cc8be12b88248a5739ad9f45e1d6eab69 | [] | no_license | stepince/interview_questions | 53c504b4a119dd80784c205611920d81407658e7 | 8f19a86d5f72d05ed21244d94133ac5fac0d3e25 | refs/heads/master | 2023-03-18T09:36:34.534424 | 2021-03-06T15:47:00 | 2021-03-06T15:47:00 | 265,547,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | import java.util.Arrays;
import java.util.Stack;
/*
*
* Given an array, print the Previous Lesser Element (PLE) for every element.
**
*/
public class PLE {
public static int[] find(int[] nums){
int[] out = new int[nums.length];
Stack<Integer> st = new Stack<>();
// increasing monotone stack
// 1,2,3,4,5
for ( int i = 0 ; i < nums.length; ++i ){
while( !st.empty() && nums[i] <= st.peek()) st.pop();
out[i] = st.empty() ? -1 : st.peek();
st.push(nums[i]);
}
return out;
}
public static void main(String[] args){
// int[] arr = Stream.of(args[0].split("[\\s,]+")).mapToInt(Integer::parseInt).toArray();
int[] nums = {2,5,6,1,8};
System.out.println(Arrays.toString(nums));
System.out.println(Arrays.toString(find(nums)));
}
} | [
"IT@tmxintermodal.com"
] | IT@tmxintermodal.com |
721749883f1329eb9c9088c5df7def99b728a6d9 | 343b22a860f936d04efcd9f2ccb5433e33eeb44a | /proba01/src/examples/de/fhpotsdam/unfolding/examples/data/TransitLinesMarkerApp.java | 229583969c988cc46322b2216d6f455b9e7e56a0 | [
"MIT"
] | permissive | ZelimirS/EarthquakeMap_02 | cfe8b35c26421037b150659d6deddb98337fd889 | fd5f2ebbca8bb480148f236ed7fdbb15f5b853f6 | refs/heads/master | 2021-09-03T17:33:45.350411 | 2018-01-10T18:17:14 | 2018-01-10T18:17:14 | 113,784,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,426 | java | package examples.de.fhpotsdam.unfolding.examples.data;
import java.util.ArrayList;
import java.util.List;
import processing.core.PApplet;
import de.fhpotsdam.unfolding.UnfoldingMap;
import de.fhpotsdam.unfolding.data.Feature;
import de.fhpotsdam.unfolding.data.GeoJSONReader;
import de.fhpotsdam.unfolding.data.ShapeFeature;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.marker.Marker;
import de.fhpotsdam.unfolding.marker.SimpleLinesMarker;
import de.fhpotsdam.unfolding.providers.StamenMapProvider;
import de.fhpotsdam.unfolding.utils.MapUtils;
/**
* Displays the subway lines of Boston, read from a GeoJSON file.
*
* This example shows how to load data features and create markers manually in order to map specific properties; in this
* case the colors according to the MBTA schema.
*/
public class TransitLinesMarkerApp extends PApplet {
Location bostonLocation = new Location(42.357778f, -71.061667f);
UnfoldingMap map;
public void setup() {
size(800, 600, P2D);
smooth();
map = new UnfoldingMap(this, new StamenMapProvider.TonerBackground());
map.zoomToLevel(11);
map.panTo(bostonLocation);
map.setZoomRange(9, 17); // prevent zooming too far out
map.setPanningRestriction(bostonLocation, 50);
MapUtils.createDefaultEventDispatcher(this, map);
List<Feature> transitLines = GeoJSONReader.loadData(this, "data/MBTARapidTransitLines.json");
// Create marker from features, and use LINE property to color the markers.
List<Marker> transitMarkers = new ArrayList<Marker>();
for (Feature feature : transitLines) {
ShapeFeature lineFeature = (ShapeFeature) feature;
SimpleLinesMarker m = new SimpleLinesMarker(lineFeature.getLocations());
String lineColor = lineFeature.getStringProperty("LINE");
int color = 0;
// Original MBTA colors
if (lineColor.equals("BLUE")) {
color = color(44, 91, 167);
}
if (lineColor.equals("RED")) {
color = color(233, 57, 35);
}
if (lineColor.equals("GREEN")) {
color = color(59, 130, 79);
}
if (lineColor.equals("SILVER")) {
color = color(154, 156, 157);
}
if (lineColor.equals("ORANGE")) {
color = color(238, 137, 40);
}
m.setColor(color);
m.setStrokeWeight(5);
transitMarkers.add(m);
}
map.addMarkers(transitMarkers);
}
public void draw() {
map.draw();
}
}
| [
"zelimir.s.bl@gmail.com"
] | zelimir.s.bl@gmail.com |
7e3a9d374f8ff6ecf8d68086d1257fa3287762cd | 0e29cfcde7163cbf2311733e6af4c213758537bf | /src/main/java/com/example/ssoserver/common/validator/annotation/ValidateParam.java | 3e01969666af723200282af158215e069b9f084f | [] | no_license | lizhaoyang888/sso-server | 1691b89f90554cc23b3586804e68e422da0481e9 | 728a35cefe768f21704c8c5b0ff8eb160b4017a3 | refs/heads/master | 2022-12-26T10:42:21.164601 | 2020-03-26T13:36:38 | 2020-03-26T13:36:38 | 250,267,205 | 0 | 0 | null | 2022-12-14T20:35:26 | 2020-03-26T13:33:50 | Java | UTF-8 | Java | false | false | 502 | java | package com.example.ssoserver.common.validator.annotation;
import com.example.ssoserver.common.validator.Validator;
import java.lang.annotation.*;
/**
* 自定义请求参数注解
*
* @author Joe
*/
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ValidateParam {
/**
* 验证器
* @return
*/
Validator[] value() default {};
/**
* 参数的描述名称
* @return
*/
String name() default "";
}
| [
"lichaoyang1@guazi.com"
] | lichaoyang1@guazi.com |
e41db8269f6696a6a83963543416c3739c539cde | 40873957cc93e8947336943370bc1e47cee0ab2b | /src/net/tortuga/gui/widgets/composite/DragStoneExtended.java | ff5855e5736aefd06a3923d55e6f7fcda58cdfb2 | [
"BSD-2-Clause"
] | permissive | MightyPork/tortuga | 2a9d7f59319a133db8633f3ff4f9416526632ad7 | dcf4c8e09920fb64eeec622b545e7559e5f5ec6e | refs/heads/master | 2020-05-17T06:34:36.469494 | 2014-05-25T00:24:14 | 2014-05-25T00:24:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 902 | java | package net.tortuga.gui.widgets.composite;
import com.porcupine.coord.Coord;
public class DragStoneExtended implements IDragStone {
private DragStone top;
private DragStone middle;
private DragStone bottom;
public DragStoneExtended(DragStone top, DragStone middle, DragStone bottom) {
this.middle = middle;
this.top = top;
this.bottom = bottom;
}
public DragStone getMiddleStone()
{
return middle;
}
public DragStone getTopStone()
{
return top;
}
public DragStone getBottomStone()
{
return bottom;
}
@Override
public void render(Coord pos)
{
if (top != null) top.render(pos.add(0, 64));
middle.render(pos);
if (bottom != null) bottom.render(pos.sub(0, 64));
}
@Override
public IDragStone copy()
{
return new DragStoneExtended(top != null ? top.copy() : null, middle != null ? middle.copy() : null, bottom != null ? bottom.copy() : null);
}
}
| [
"hruskon5@fel.cvut.cz"
] | hruskon5@fel.cvut.cz |
e366e83d008a3f3ada820fa84dac5d40853188fe | 8de1aa33a1a5a5cf91b05b87ecf2fb9815c358d8 | /basecomponent/src/main/java/com/yuntian/basecomponent/mvp/BaseModel.java | 9dc8da5e8580efcc11f98a17718d1b1baa993a2d | [] | no_license | chuzhonglingyan/GankApp | ca93c5df62b4c16ffe8a0a4c68036b42ecba922e | 3e3104f9a4716df02915aaa2088e3ee27a3f7617 | refs/heads/master | 2020-03-18T04:32:14.270742 | 2018-05-27T10:59:20 | 2018-05-27T10:59:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package com.yuntian.basecomponent.mvp;
/**
* description .
* Created by ChuYingYan on 2018/5/1.
*/
public interface BaseModel{
}
| [
"944610721@qq.com"
] | 944610721@qq.com |
99b348103aacbbc47413465a4e39cfc5a904437d | c231eb64cc7def2cf8acaf224003b558b20f4e26 | /src/tech/aistar/day11/innerclass/TestOuter.java | 4d71d22e63f92b6c2706d7951e82952d8a689dca | [
"Apache-2.0"
] | permissive | wk0122/CoreJava | be27862674fc5d48b7e6c5127029756e79402d98 | 612eebbe6e9f99d421dfe0eff881b69429a969bb | refs/heads/master | 2020-05-20T03:08:28.745879 | 2019-05-07T07:53:35 | 2019-05-07T07:53:35 | 184,862,146 | 0 | 0 | Apache-2.0 | 2019-05-06T13:04:48 | 2019-05-04T06:52:18 | Java | UTF-8 | Java | false | false | 1,254 | java | package tech.aistar.day11.innerclass;
import tech.aistar.day09.supers.Shape;
/**
* @author success
* @version 1.0
* @description:本类用来演示:
* @date 2019/4/9 0009
*/
public class TestOuter {
public static void main(String[] args) {
//外部类的对象
Outer outer = new Outer();
//1. 演示如何创建成员内部类的对象
//外部类.内部类 对象 = 外部类对象.new 内部类();
//Outer.MemberClass memberClass = outer.new MemberClass();
//memberClass.test();
Outer.MemberClass m = outer.createMemberClass();
m.test();
//2. 测试静态内部类创建对象.
//外部类.内部类 对象 = new 外部类.内部类();
// Outer.StaticClass s = new Outer.StaticClass();
// s.test();
//静态内部类如果是public修饰的,那么可以上升成为顶级类
//StaticClass s1 = new StaticClass();
Outer.StaticClass s1 = new Outer.StaticClass();
s1.test();
//局部内部类
outer.createLocalClass();
//匿名内部类
outer.createLoyalClass();
AA aa = new AA() {
@Override
public void test() {
}
};
}
}
| [
"1415929645@qq.com"
] | 1415929645@qq.com |
e0d57f2136efbb760288559f26e98c434a8e348f | 82f7d9381e1ab2a096658d24a718416af5c0e06c | /src/ThreadTest/day02/FairLock.java | dba971c69087aa14ad7d9b1933e134fa185d8575 | [] | no_license | lizhijie1/parallel | a7d1877b0ce0f292cc9c04f2ab10432fcc4466af | 1a89df4b5ed75050070b35f9835581c642031755 | refs/heads/master | 2020-04-13T21:58:09.283158 | 2018-12-30T13:14:02 | 2018-12-30T13:14:02 | 163,468,909 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 979 | java | /**
* FairLock.java V1.0 2018年12月15日 下午5:13:04
*
* Copyright 2018 FUJIAN FUJITSU COMMUNICATION SOFTWARE CO., LTD. All rights reserved.
*
* Modification history(By Time Reason):
*
* Description:
*/
package ThreadTest.day02;
import java.util.concurrent.locks.ReentrantLock;
/**
*
* 功能描述:公平锁
*
* @author :lizhijie
*
* 修改历史:(修改人,修改时间,修改原因/内容)
*/
public class FairLock implements Runnable{
//
public static ReentrantLock fairLock = new ReentrantLock(true);
@Override
public void run() {
while(true){
try {
fairLock.lock();
System.out.println(Thread.currentThread().getName()+":获得锁");
} finally {
// TODO: handle finally clause
}
fairLock.unlock();
}
}
public static void main(String[] args) {
FairLock r1 = new FairLock();
Thread t1 = new Thread(r1,"Thread-T1");
Thread t2 = new Thread(r1,"Thread-T2");
t1.start();
t2.start();
}
}
| [
"2385514385@qq.com"
] | 2385514385@qq.com |
1f4471718e9881457feebb90f6dfe0230fa7e16f | a1c9cadb550d0ccf73d73cacd4df8b692c113488 | /src/test/java/cloud/autotests/tests/TestBase.java | 64d5a043aaeb16220aa73d929962ab303626563f | [] | no_license | xt4k/selenide-web-ios-android-tests | 58dff518c881456ae8229042ca8999b7825e1bc8 | 167328eeb96b5e5947dac8cf4b3592bfdb96fffb | refs/heads/master | 2023-03-31T00:42:21.774683 | 2021-04-06T18:49:20 | 2021-04-06T18:49:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,063 | java | package cloud.autotests.tests;
import org.junit.jupiter.api.*;
import static cloud.autotests.helpers.AttachmentsHelper.*;
import static cloud.autotests.helpers.BrowserstackHelper.getBSPublicLink;
import static cloud.autotests.helpers.DriverHelper.*;
import static cloud.autotests.helpers.EnvironmentHelper.*;
import static com.codeborne.selenide.WebDriverRunner.closeWebDriver;
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
public class TestBase {
@BeforeAll
public static void beforeAll() {
configureSelenide();
}
@AfterEach
public void addAttachments(){
String sessionId = getSessionId();
attachScreenshot("Last screenshot");
attachPageSource();
// attachNetwork(); // todo
if (isWeb) attachAsText("Browser console logs", getConsoleLogs());
if (isIos || isAndroid) attachAsText("Browserstack build link", getBSPublicLink(sessionId));
closeWebDriver();
if (isVideoOn) attachVideo(sessionId); // in browserstack video url generates after driver close
}
}
| [
"aanher@gmail.com"
] | aanher@gmail.com |
2b8ce760db6a343efa0be74de11e89360c77cfed | e8bf0a0cc3f578280a2449d78ff72a70882d61d5 | /tags/1/src/com/foo_baz/v_q/ivqPackage/domain_info.java | a3657462ae147700487c867c15ef4bbce6cec69a | [] | no_license | BackupTheBerlios/ihs-svn | 40c98f4ac28554eb6e03e616b424135b50371d3b | 10ef4cce9816eb18bf6661c386fa1a064872819d | refs/heads/master | 2016-09-11T04:09:16.474459 | 2006-08-21T16:13:09 | 2006-08-21T16:13:09 | 40,747,775 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 584 | java | package com.foo_baz.v_q.ivqPackage;
/**
* com/foo_baz/v_q/ivqPackage/domain_info.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /export/home/new/svn/berlios.de/ihs/trunk/vq.idl
* sobota, 24 grudzień 2005 13:57:44 CET
*/
public final class domain_info implements org.omg.CORBA.portable.IDLEntity
{
public int id_domain = (int)0;
public String domain = null;
public domain_info ()
{
} // ctor
public domain_info (int _id_domain, String _domain)
{
id_domain = _id_domain;
domain = _domain;
} // ctor
} // class domain_info
| [
"paweln@1a90c287-d1f1-0310-8079-81815bb721a4"
] | paweln@1a90c287-d1f1-0310-8079-81815bb721a4 |
e3c065ec91f5a29a771f0f845fc906a637c94b55 | a7c716bad711b569fd575b17f5feccec8e5966bb | /eduation_student/src/main/java/com/muji/zh/student/util/Base64Utils.java | 3a245add0c329bc57711accbeec5281300f077c0 | [] | no_license | liuwenqi9/kinderEducation | 1d4da26e412a365d95e0decbc5b37951bf358630 | fc2933321feb21a95a5d3a1b75f1c188ddedf180 | refs/heads/master | 2020-04-30T08:57:23.328662 | 2019-01-15T13:29:18 | 2019-01-15T13:29:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,186 | java | package com.muji.zh.student.util;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
@SuppressWarnings("restriction")
public class Base64Utils {
public static void main(String[] args) throws Exception {
//
// //本地图片地址
//
// String url = "C:\\ss\\1815925402.png";
//
// //在线图片地址
//
// String string = "http://bpic.588ku.com//element_origin_min_pic/17/03/03/7bf4480888f35addcf2ce942701c728a.jpg";
//
//
//
// String str = Base64Utils.ImageToBase64ByLocal(url);
//
//
//
// String ste = Base64Utils.ImageToBase64ByOnline(string);
//
//
//
// System.out.println(str);
//
//
//
// Base64Utils.Base64ToImage(str,"C:\\ss\\1815925622.png");
//
//
//
// Base64Utils.Base64ToImage(ste, "C:\\ss\\1815925621.png");
String s="iVBORw0KGgoAAAANSUhEUgAAAHsAAAA8CAIAAADJ+FL8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADUElEQVR4nO1cwW6jMBCdsaGRctyVVj13D/2a7v//QLVSteccktizBycUzDgBYwYDfpcSahvzeB7PjA348+0DdgNEbI6J6HYAQIOrN7WiUU2sPxPa1Cx4uT6/0zuWKeMzoWEQETt6D5RvizqVCFSSVgqGw9d4/0k+sFwTC8sjog/Ju100Lo3CuDQK49KontqpUYYsB2OdOYrGpVFNDaFSgIjUfXDcvB3BsSLMQEUtUzA9hIXB8Zsr9vr6i4g+P/+C1i7ccIVytk3DLSfL55Ixp7X2/f3NWvv19e9yuQAAEb28vBhjFuzV3MAfv/8spXFjTF3XRHQ6nY7Ho9b6fD4bY7TWOc/A69B4/9pEpJSyxiBAVVXX65WIEFGpjU/mHcbnVpY3mJRSl/NZIR4OB2uttdYV8NJM6wV7F0sKyhgDiKAUEVlrnca11gt2SQALD+G6rm8uCpGTdpK5JGcs6as0JtvZ9D3QDUOi/CTwrtI26KF/bRUbdwwyRGFcGoVxaRTGpVEYl0ZhXBod77C9N6PtGrNlxoLNl63XF4zexyIXAbkubiZnEg3GqjTpJPHO7AKTNB6XKd6GVYnGI8YTJjp2yGwIfH684bowlRyMxhs7njCTF9rUukMwjO8hZZoCkboZPXPGKTRca616jx6oJeaURmFcGs937M8M5nKhiWTiRpFHnRC866JxaezrzasQ5nDOQqMmfm9t0yIFzq8I87nDfTYq/9xgwoiNkmhMEwG0o6S44GCUXSYAmkcmyPU93qoEE1IlfgIAp0juvNB+lcwh6T/Ea5xfGCLANVpywXGZID/+/UkBl24MMJ7tYBLuVvEO3bicqWHmefIry0Nb7L/as85pcz6Z9/nwNB556SEGI3YLQFStbB5834Gu2veUwNKmV0usCLiT0fmW6DWDfsVixwEAbOB8KK4eCAIC6qxlQmEc4OEomjhk08acawS7ykoQNBnUO4Axbi7Sd1H35g2I7VeZjrHfyhnVs6dGI86q8FF+VFNbw0yMO0vuYRrjmThhXDeCHxvrKo+8v94v5BoaftfUzWe5mRNhHe9PprJfHF2o/TL33TWAjErZZu8bqrrWj5k2ilVJif6re32Udc4niPYOQhUL488xkHT/q5UB5+o/hpszfrbTjY0AAAAASUVORK5CYII=";
String path="D:\\2";
String filenmae="D:\\2\\2.png";
//Base64Utils.Base64ToImage(s,path,filenmae);
}
/**
* 本地图片转换成base64字符串
* @param imgFile 图片本地路径
* @return
*
* @author ZHANGJL
* @dateTime 2018-02-23 14:40:46
*/
public static String ImageToBase64ByLocal(String imgFile) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
InputStream in = null;
byte[] data = null;
// 读取图片字节数组
try {
in = new FileInputStream(imgFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);// 返回Base64编码过的字节数组字符串
}
/**
* 在线图片转换成base64字符串
*
* @param imgURL 图片线上路径
* @return
*
* @author ZHANGJL
* @dateTime 2018-02-23 14:43:18
*/
public static String ImageToBase64ByOnline(String imgURL) {
ByteArrayOutputStream data = new ByteArrayOutputStream();
try {
// 创建URL
URL url = new URL(imgURL);
byte[] by = new byte[1024];
// 创建链接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5000);
InputStream is = conn.getInputStream();
// 将内容读取内存中
int len = -1;
while ((len = is.read(by)) != -1) {
data.write(by, 0, len);
}
// 关闭流
is.close();
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data.toByteArray());
}
/**
* base64字符串转换成图片
* @param imgStr base64字符串
* @param imgFilePath 图片存放路径
* @return
*
* @author ZHANGJL
* @dateTime 2018-02-23 14:42:17
*/
public static boolean Base64ToImage(String imgStr, String imgFilePath, String filename, HttpServletRequest request) { // 对字节数组字符串进行Base64解码并生成图片
System.out.println(imgFilePath);
File file =new File(request.getRealPath("/")+imgFilePath);
//如果文件夹不存在则创建
if (!file .exists() && !file .isDirectory())
{
System.out.println("//不存在");
file .mkdir();
} else
{
System.out.println("//目录存在");
}
if (StringUtil.isEmpty(imgStr)) // 图像数据为空
return false;
BASE64Decoder decoder = new BASE64Decoder();
try {
// Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {// 调整异常数据
b[i] += 256;
}
}
OutputStream out = new FileOutputStream(imgFilePath+filename);
out.write(b);
out.flush();
out.close();
return true;
} catch (Exception e) {
return false;
}
}
}
| [
"m2345691@126.com"
] | m2345691@126.com |
4743544ec9313d96a97a6d6f42b98ddf226863d1 | 9e42b115dac0b0d4c5ed8658764dcf54261376a0 | /src/main/java/net/tespia/ClientController.java | 165911119c86a495dc51daaa53b6f7f15fe78edb | [] | no_license | JasonNew89/tespia-clb | f8d66bbe898477f7f5dccadac7dcd48357ae176b | f2960a6beb5b40b802ae0dc69c4f6dccf1e14ac9 | refs/heads/master | 2023-03-17T08:02:17.746259 | 2020-06-21T05:57:50 | 2020-06-21T05:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,777 | java | package net.tespia;
import net.tespia.net.UIController;
import net.tespia.ui.FieldManager;
import net.tespia.ui.LoginModel;
import net.tespia.wvs.Context;
import net.tespia.wvs.Field;
import net.tespia.wvs.User;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class ClientController implements UIController {
private GameScripting scripting;
private LoginModel model = new LoginModel();
private Client client;
private Context context;
private FieldManager fieldManager;
public void setFieldManager(FieldManager fieldManager) {
this.fieldManager = fieldManager;
}
public void setScripting(GameScripting scripting) {
this.scripting = scripting;
}
public LoginModel getModel() {
return model;
}
public void setModel(LoginModel model) {
this.model = model;
}
public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
@Override
public void setConnected(String accountID) {
System.out.println("Account " + accountID + " connected.");
}
@Override
public void onConnectionOpened() {
System.out.println("Connection Opened.");
}
@Override
public void onConnectionClosed() {
System.out.println("Connection Closed.");
}
@Override
public void onConnectFailure() {
}
@Override
public LoginModel getLoginModel() {
return model;
}
@Override
public void log(String msg, Object... args) {
System.out.println(String.format(msg, args));
}
@Override
public void updateContext(Context context) {
this.context = context;
}
@Override
public void migrateTo(byte[] ip, short port, Context context) {
log("Trying to migrate to port: %d", port);
try {
String strIp = InetAddress.getByAddress(ip).getHostAddress();
log("Migrating to new HOST %s:%d", strIp, port);
this.client.migrateTo(strIp, port, context);
} catch (UnknownHostException ex) {
log("Could not parse ip to connect.");
}
}
@Override
public void setInGame() {
User user = context.getUser(model.getCharIndex());
fieldManager.setField(user.getStat().getFieldID());
Field field = fieldManager.getField();
user.setField(field);
scripting.addBinding("field", field);
scripting.addBinding("user", getSelectedUser());
scripting.callEvent("inGame");
}
@Override
public User getSelectedUser() {
return context.getUser(model.getCharIndex());
}
public FieldManager getFieldManager() {
return fieldManager;
}
}
| [
"undefined-sin@maple.com"
] | undefined-sin@maple.com |
62d114c254c196a00fa60f4bc1984876ff9e0c46 | 2129172dd570422a1be82e754884518af5bc61ac | /app/src/main/java/com/ksquarej/edunomics/MainActivity.java | 60bb6e6d5ba2ec947add85ebc1b0c690e664568f | [] | no_license | Kundannitp/Edunomics | 7285fb90cbecb950909962b6c1cb6fe1fe768321 | e7689234d77af8dd7626a1f4a95cf705d020322d | refs/heads/master | 2022-11-07T22:25:35.429266 | 2020-06-25T22:59:33 | 2020-06-25T22:59:33 | 275,026,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,758 | java | package com.ksquarej.edunomics;
import android.app.Dialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.GravityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.navigation.ui.AppBarConfiguration;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.navigation.NavigationView;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.ksquarej.edunomics.NavigationDrawer.Blogsfragment;
import com.ksquarej.edunomics.NavigationDrawer.Botfragment;
import com.ksquarej.edunomics.NavigationDrawer.Homefragment;
import com.ksquarej.edunomics.NavigationDrawer.ImpactFragment;
import com.ksquarej.edunomics.NavigationDrawer.Initiativesfragment;
import com.ksquarej.edunomics.NavigationDrawer.Opportunitesfragment;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
NavigationView navigationView;
DrawerLayout drawer ;
FirebaseAuth mAuth;
private ActionBarDrawerToggle mToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
drawer = findViewById(R.id.drawer_layout);
navigationView = findViewById(R.id.nav_view);
mToggle=new ActionBarDrawerToggle(this,drawer,R.string.open,R.string.close);
Intent intent = getIntent();
drawer.addDrawerListener(mToggle);
mToggle.syncState();
Toolbar mytool=findViewById(R.id.home_toolbar);
setSupportActionBar(mytool);
ActionBar actionBar = getSupportActionBar();
actionBar.setLogo(getDrawable(R.drawable.logo));
actionBar.setTitle("");
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_navigation_drawer);
setUpDrawerContent(navigationView);
navigationView.getMenu().getItem(0).setChecked(true);
mAuth=FirebaseAuth.getInstance();
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
displaySelectedScreen(menuItem.getItemId());
return true;
}
});
FragmentTransaction tx = getSupportFragmentManager().beginTransaction();
tx.replace(R.id.nav_host_fragment, new Homefragment());
tx.commit();
}
private void setUpDrawerContent(NavigationView navigationView){
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
displaySelectedScreen(menuItem.getItemId());
return true;
}
});
}
protected void onStart() {
super.onStart();
if(mAuth.getCurrentUser()!=null){
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Logout");
}else{
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Login");
}
}
public void onBackPressed(){
if(drawer.isDrawerOpen(GravityCompat.START)){
drawer.closeDrawer(GravityCompat.START);
}else {
super.onBackPressed();
}
}
private void displaySelectedScreen(int itemId) {
//creating fragment object
Fragment fragment = null;
int[] b=new int[]{1,2,3};
//initializing the fragment object which is selected
switch (itemId) {
case R.id.nav_home:
b[0]=1;
b[1]=2;
b[2]=3;
navColor(0,b);
fragment = new Homefragment();
break;
case R.id.nav_impact:
b[0]=0;
b[1]=2;
b[2]=3;
navColor(1,b);
fragment=new ImpactFragment();
break;
case R.id.nav_initiative:
b[0]=1;
b[1]=2;
b[2]=0;
navColor(3,b);
fragment=new Initiativesfragment();
break;
case R.id.nav_opportunites:
b[0]=1;
b[1]=0;
b[2]=3;
navColor(2,b);
fragment=new Opportunitesfragment();
break;
case R.id.nav_blogs:
if(mAuth.getCurrentUser()!=null) {
discolor();
// navigationView.getMenu().getItem(4).getSubMenu().getItem(1).setChecked(true);
fragment = new Blogsfragment();
}else{
openLoginDialog();
}
break;
case R.id.nav_login:
if(mAuth.getCurrentUser()!=null){
showLogoutDialog();
}else{
openLoginDialog();
}
break;
case R.id.nav_bot:
if(mAuth.getCurrentUser()!=null) {
// navigationView.getMenu().getItem(4).getSubMenu().getItem(2).setChecked(true);
discolor();
fragment = new Botfragment();
}else{
openLoginDialog();
}
break;
}
//replacing the fragment
if (fragment != null) {
navColor(0,b);
getSupportFragmentManager().beginTransaction().
replace(R.id.nav_host_fragment, fragment)
.commit();
}
drawer.closeDrawer(GravityCompat.START);
}
void discolor(){
for(int i=0;i<4;i++){
navigationView.getMenu().getItem(i).setChecked(false);
}
}
void discolorchild(){
for(int i=0;i<3;i++){
navigationView.getMenu().getItem(4).getSubMenu().getItem(i).setChecked(false);
}
}
void openLoginDialog(){
final Dialog customView = new Dialog(MainActivity.this);
customView.setContentView(R.layout.login_dialog);
customView.setTitle("Login");
customView.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
customView.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_bottom;
final EditText loginemail=customView.findViewById(R.id.login_email);
final EditText loginpsw=customView.findViewById(R.id.login_psw);
Button loginbtn=customView.findViewById(R.id.login_btn);
TextView signupreq=customView.findViewById(R.id.signup_now);
signupreq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
customView.dismiss();
openSignupDialog();
}
});
loginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email=loginemail.getText().toString().trim();
String psw=loginpsw.getText().toString().trim();
try {
mAuth.signInWithEmailAndPassword(email, psw)
.addOnCompleteListener(MainActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Toast.makeText(MainActivity.this, "Successfully Loged In", Toast.LENGTH_SHORT).show();
if(mAuth.getCurrentUser()!=null){
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Logout");
}else{
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Login");
}
customView.dismiss();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "Login Failed", Toast.LENGTH_SHORT).show();
}
// ...
}
});
}catch (Exception e){}
customView.dismiss();
}
});
customView.show();
}
void openSignupDialog(){
final Dialog customView = new Dialog(MainActivity.this);
customView.setContentView(R.layout.signup_dialog);
customView.setTitle("Login");
customView.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
customView.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation_bottom;
final EditText loginemail=customView.findViewById(R.id.signup_email);
final EditText loginpsw=customView.findViewById(R.id.signup_psw);
Button loginbtn=customView.findViewById(R.id.signup_btn);
loginbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email=loginemail.getText().toString().trim();
String psw=loginpsw.getText().toString().trim();
mAuth.createUserWithEmailAndPassword(email, psw)
.addOnCompleteListener(MainActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Toast.makeText(MainActivity.this, "Successfully signed in", Toast.LENGTH_SHORT).show();
if(mAuth.getCurrentUser()!=null){
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Logout");
}else{
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Login");
}
customView.dismiss();
} else {
// If sign in fails, display a message to the user.
Toast.makeText(MainActivity.this, "Sign up Failed", Toast.LENGTH_SHORT).show();
}
// ...
}
});
}
});
customView.show();
}
void navColor(int a,int b[]){
for(int i=0;i<b.length;i++){
navigationView.getMenu().getItem(i).setChecked(false);
}
navigationView.getMenu().getItem(a).setChecked(true);
}
private void showLogoutDialog()
{
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage("Sure to logout?");
builder.setCancelable(false);
builder.setPositiveButton("LOGOUT", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
mAuth.signOut();
if(mAuth.getCurrentUser()!=null){
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Logout");
}else{
navigationView.getMenu().getItem(4).getSubMenu().getItem(0).setTitle("Login");
}
dialog.cancel();
}
});
builder.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if(mToggle.onOptionsItemSelected(item)){
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"kundan3316@gmail.com"
] | kundan3316@gmail.com |
d2f68a8d5ac0e8ee82a326ca30ef4d6e8fadea0f | 73267be654cd1fd76cf2cb9ea3a75630d9f58a41 | /services/cbr/src/main/java/com/huaweicloud/sdk/cbr/v1/model/BatchUpdateVaultResponse.java | 730c1d7432409d4e0b2ebada43b8dc5745aeab78 | [
"Apache-2.0"
] | permissive | huaweicloud/huaweicloud-sdk-java-v3 | 51b32a451fac321a0affe2176663fed8a9cd8042 | 2f8543d0d037b35c2664298ba39a89cc9d8ed9a3 | refs/heads/master | 2023-08-29T06:50:15.642693 | 2023-08-24T08:34:48 | 2023-08-24T08:34:48 | 262,207,545 | 91 | 57 | NOASSERTION | 2023-09-08T12:24:55 | 2020-05-08T02:27:00 | Java | UTF-8 | Java | false | false | 2,661 | java | package com.huaweicloud.sdk.cbr.v1.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.huaweicloud.sdk.core.SdkResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
/**
* Response Object
*/
public class BatchUpdateVaultResponse extends SdkResponse {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value = "updated_vaults_id")
private List<String> updatedVaultsId = null;
public BatchUpdateVaultResponse withUpdatedVaultsId(List<String> updatedVaultsId) {
this.updatedVaultsId = updatedVaultsId;
return this;
}
public BatchUpdateVaultResponse addUpdatedVaultsIdItem(String updatedVaultsIdItem) {
if (this.updatedVaultsId == null) {
this.updatedVaultsId = new ArrayList<>();
}
this.updatedVaultsId.add(updatedVaultsIdItem);
return this;
}
public BatchUpdateVaultResponse withUpdatedVaultsId(Consumer<List<String>> updatedVaultsIdSetter) {
if (this.updatedVaultsId == null) {
this.updatedVaultsId = new ArrayList<>();
}
updatedVaultsIdSetter.accept(this.updatedVaultsId);
return this;
}
/**
* 已批量修改id列表
* @return updatedVaultsId
*/
public List<String> getUpdatedVaultsId() {
return updatedVaultsId;
}
public void setUpdatedVaultsId(List<String> updatedVaultsId) {
this.updatedVaultsId = updatedVaultsId;
}
@Override
public boolean equals(java.lang.Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
BatchUpdateVaultResponse that = (BatchUpdateVaultResponse) obj;
return Objects.equals(this.updatedVaultsId, that.updatedVaultsId);
}
@Override
public int hashCode() {
return Objects.hash(updatedVaultsId);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BatchUpdateVaultResponse {\n");
sb.append(" updatedVaultsId: ").append(toIndentedString(updatedVaultsId)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"hwcloudsdk@huawei.com"
] | hwcloudsdk@huawei.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.