blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
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
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
764d6dbc1f1347426739e712943e79924cbe5b73
|
09450bef927ab4151343fbcc93644f66847b1d4f
|
/Heure.java
|
d9b3a2a2b4a0b05d7c6e932cb79039237f5e81b8
|
[] |
no_license
|
dasilvaines/FoodyText
|
402faac51eca53f2b9de02dbafe45a650501b973
|
a49b85386c81ce0ff1ba692e2acb49a2b1debc56
|
refs/heads/master
| 2020-03-28T12:39:35.559277 | 2018-09-11T14:56:38 | 2018-09-11T14:56:38 | 148,320,597 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 382 |
java
|
class Heure{
private int heures;
private int minutes;
Heure( int heures , int minutes){
this.heures = heures;
this.minutes = minutes;
}
public int getHeures(){
return heures;
}
public int minutes(){
return minutes;
}
public void setHeures( int heures){
this.heures = heures;
}
public void setMinutes( int minutes){
this.minutes = minutes ;
}
}
|
[
"[email protected]"
] | |
507f6c9635d31ed95ae1bba4abab728353416cee
|
3bbd78a0343673c1595c66fcb2b4cdd6be2f8080
|
/src/main/java/de/schornyy/crate/crateplugin/interactableItems/InteractItem.java
|
d12333210730c8461d223892a76cecc586080eec
|
[] |
no_license
|
schornyy/CratePlugin
|
b4c149e22d8a107c546a8c7d22a496bea46d2c4a
|
b49525497668acb2fba4f0e12657202e1f38844a
|
refs/heads/master
| 2022-12-26T23:49:28.721429 | 2020-10-11T09:46:04 | 2020-10-11T09:46:04 | 303,087,959 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,026 |
java
|
package de.schornyy.crate.crateplugin.interactableItems;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.List;
public class InteractItem {
private String command;
private ItemStack itemStack;
private int index;
public InteractItem(ItemStack itemStack, String command, int index) {
this.command = command;
this.itemStack = itemStack;
this.index = index;
}
public int getIndex() {
return index;
}
public ItemStack getShowItem() {
ItemStack itemStack = getItemStack().clone();
ItemMeta itemMeta = itemStack.getItemMeta();
List<String> lore = new ArrayList<>();
lore.add("§fCommand: §e" + getCommand());
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
return itemStack;
}
public ItemStack getItemStack() {
return itemStack;
}
public String getCommand() {
return command;
}
}
|
[
"[email protected]"
] | |
5efe65c46eefa93cdf4873252be5f3b8e56468d3
|
b4e342353cb862dddd196303d805fdbe110b61b8
|
/MessageStack.java
|
e9e333c379ed75619c8d5eba1f4aff910955b247
|
[] |
no_license
|
EliasVahlberg/AOOP_Assignment_1_REP
|
97da3d83ff6991f59e3ab354dd8a7bdc787986fb
|
896c7d6beba0c98486b3eca6d8945b8e739f8780
|
refs/heads/main
| 2023-04-02T11:00:23.968332 | 2021-04-02T15:26:28 | 2021-04-02T15:26:28 | 353,978,820 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,230 |
java
|
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.NoSuchElementException;
public class MessageStack
{
private LinkedList<Message> elements;
private int count;
public MessageStack()
{
elements = new LinkedList<>();
count = 0;
}
public void push(Message m)
{
if(m == null)
throw new NullPointerException();
elements.addFirst(m);
count++;
}
public void push(LinkedList<Message> list)
{
if(list==null)
throw new NullPointerException();
for (Message message: list)
push(message);
}
public Message pop()
{
if(elements.isEmpty())
throw new NoSuchElementException();
count--;
return elements.removeFirst();
}
public LinkedList<Message> pop(int n)
{
if(isEmpty())
throw new NoSuchElementException();
LinkedList<Message> list = new LinkedList<>();
for (int i = 0; i < n && !isEmpty(); i++)
list.addFirst(pop());
return list;
}
public boolean isEmpty()
{
return elements.isEmpty();
}
public int size()
{
return count;
}
}
|
[
"[email protected]"
] | |
ec5b2023dc4b4ca800b6e3f951dfbb1936149bce
|
49d42478cbf9a7d5e669554bedd692000b733075
|
/src/net/shopxx/dao/impl/BrandDaoImpl.java
|
1992ca13ff9bfe94ec2ceb0002f93d44d32d81ab
|
[] |
no_license
|
jackeybill/eShop
|
d1b1e50712935fe7258ac2eb472faf505a49af34
|
67b7c846db5e463cdfa3da2d50688fe57fc38596
|
refs/heads/master
| 2021-01-10T19:23:22.997724 | 2015-04-22T13:09:24 | 2015-04-22T13:09:26 | 34,387,697 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 394 |
java
|
package net.shopxx.dao.impl;
import net.shopxx.dao.BrandDao;
import net.shopxx.entity.Brand;
import org.springframework.stereotype.Repository;
@Repository("brandDaoImpl")
public class BrandDaoImpl extends BaseDaoImpl<Brand, Long>
implements BrandDao
{
}
/* Location: C:\jackey\software\jad\
* Qualified Name: net.shopxx.dao.impl.BrandDaoImpl
* JD-Core Version: 0.6.2
*/
|
[
"[email protected]"
] | |
88e1c283b96b873e997b5af793eb752d10604555
|
d991dfbef8c02b207ba543ac0720cbd7bda94e57
|
/initiator/src/main/java/org/oclc/circill/toolkit/initiator/client/SocketClientImpl.java
|
caf7d1b67fddaa7ac721859cc468808c7b54f1eb
|
[
"MIT"
] |
permissive
|
OCLC-Developer-Network/circill-toolkit
|
fa66f6a800029b51960634dc674562c4588c63ae
|
f29d6f59a8b223dabf7b733f178be8fd4489ad58
|
refs/heads/master
| 2023-03-18T22:06:48.392938 | 2021-03-04T22:19:07 | 2021-03-04T22:19:07 | 307,710,469 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,425 |
java
|
/*
* Copyright (c) 2020 OCLC, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the MIT/X11 license. The text of the license can be
* found at http://www.opensource.org/licenses/mit-license.php.
*/
package org.oclc.circill.toolkit.initiator.client;
import org.oclc.circill.toolkit.common.base.StatisticsBean;
import org.oclc.circill.toolkit.service.base.ServiceException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
/**
* Base class for clients (a.k.a. 'initiators') using socket (a.k.a. TCP/IP) transport.
*/
public class SocketClientImpl extends BaseClient implements SocketClient {
/**
* Construct an instance with the provider {@link StatisticsBean}.
* @param statisticsBean the {@link StatisticsBean}
*/
protected SocketClientImpl(final StatisticsBean statisticsBean) {
super(statisticsBean);
}
/**
* Send the provided initiation message with no additional headers to the current target address.
*
* @param initiationMsgBytes the initiation message as an array of bytes (network octets)
* @param targetURL the URL of the target responder
* @return the {@link InputStream} from which the response message can be read
* @throws ServiceException if the service fails
*/
public InputStream sendMessage(final byte[] initiationMsgBytes, final String targetURL) throws ServiceException {
return sendMessage(initiationMsgBytes, Collections.emptyMap(), targetURL);
}
/**
* Send the provided initiation message (with supplied headers), represented as an array of bytes,
* to the current target address using the current connect and read timeouts.
*
* @param initiationMsgBytes the initiation message as an array of bytes (network octets)
* @param targetURL the URL of the target responder
* @param headers a map of HTTP headers
* @return the {@link InputStream} from which the response message can be read
* @throws ServiceException if the exchange of messages with the responder fails
*/
public InputStream sendMessage(final byte[] initiationMsgBytes, final Map<String, String> headers, final String targetURL) throws ServiceException {
// TODO: Implement socket client behavior
throw new UnsupportedOperationException("Socket client not yet implemented.");
}
}
|
[
"[email protected]"
] | |
538e7cfab76ab8ea53286a93382383509a99e192
|
ef72ad9c1cbcd944e76075311cdd71b11ac76f20
|
/Todos/app/src/main/java/com/example/nayani/todos/ToDo.java
|
b35833a10272d2e81c4e8a250961adc259c521ef
|
[
"Apache-2.0"
] |
permissive
|
nayaniabhishek/iOSTraining
|
d747319414cd24dc1a9a8e63efaa51f8cff0cdf7
|
34fc5c26f7159c38570bc9e9e4df40dd459f5fae
|
refs/heads/master
| 2020-09-21T22:20:53.850071 | 2017-02-03T18:20:32 | 2017-02-03T18:20:32 | 67,537,359 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 526 |
java
|
package com.example.nayani.todos;
import com.raizlabs.android.dbflow.annotation.Column;
import com.raizlabs.android.dbflow.annotation.PrimaryKey;
import com.raizlabs.android.dbflow.annotation.Table;
import com.raizlabs.android.dbflow.structure.BaseModel;
/**
* Created by nayani on 1/11/17.
*/
@Table(database = MyDatabase.class)
public class ToDo extends BaseModel {
@PrimaryKey
@Column
String title;
@Column
int priority;
@Override
public String toString() {
return title;
}
}
|
[
"[email protected]"
] | |
5027b2767a35f358158cbd313693a7dcbf07fbf8
|
0837f308549e8c56369ca46444ae0053773a52ac
|
/ibm-practice-jpa/src/main/java/com/practice/model/DataResponseStudent.java
|
9bed81fc61c0ca381b41addb32003f58d26b2433
|
[] |
no_license
|
Daythor8a/CursoCracks
|
2ceed04e77b60aefe83de7c57aee827638558492
|
7cd6e75cfaf8827377e1e58760afc6da20db1eb3
|
refs/heads/master
| 2021-04-04T13:39:50.578244 | 2020-03-23T07:06:37 | 2020-03-23T07:06:37 | 248,462,274 | 0 | 0 | null | 2020-03-23T07:06:39 | 2020-03-19T09:32:11 |
Java
|
UTF-8
|
Java
| false | false | 264 |
java
|
package com.practice.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DataResponseStudent {
private String id;
private String name;
private String lastName;
private String company;
private String city;
}
|
[
"[email protected]"
] | |
3870670a35c081d9ba1bca75e7c0aa666078b5e1
|
0a9b652775fc7368a45738a7e98d2d635a7e2f95
|
/app/src/main/java/com/cykj/survey/bean/IndustryBean.java
|
1a55cb5485cf8fdbb6d582dab1c57caf34214aa3
|
[] |
no_license
|
YSQDestiny/Survey
|
0ced42e0f07393a37d63573cb90c8d1521f14a1a
|
76a0df762d16d72232a2f3466bbdb0b74cc41c2d
|
refs/heads/master
| 2021-06-24T14:44:19.517494 | 2018-06-26T09:54:49 | 2018-06-26T09:54:49 | 133,258,584 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 577 |
java
|
package com.cykj.survey.bean;
public class IndustryBean {
@TreeNodeId
private int id;
@TreeNodePid
private int parentId;
@TreeNodeLabel
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getParentId() {
return parentId;
}
public void setParentId(int parentId) {
this.parentId = parentId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
[
"[email protected]"
] | |
38d8d97777737d5e58ed019188da9de8efc7c5c5
|
5033e314afea981e3ff2c5cffcd5c934929c5842
|
/src/main/java/club/ihere/common/message/req/BaseReq.java
|
e036f70fb698f69d72eb8ffb1015f06fc82b7677
|
[] |
no_license
|
BooHome/wechat-here
|
29805b36c28fe09430ede6ca71ce5c3ab005245f
|
ed4d09eecc557e0c79b72d8f949c5ea5776a8091
|
refs/heads/master
| 2020-04-04T09:13:41.619502 | 2018-11-20T09:37:30 | 2018-11-20T09:37:30 | 155,811,972 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 812 |
java
|
package club.ihere.common.message.req;
public class BaseReq {
String toUserName;
String fromUserName;
long createTime;
String msgType;
public String getToUserName() {
return toUserName;
}
public void setToUserName(String toUserName) {
this.toUserName = toUserName;
}
public String getFromUserName() {
return fromUserName;
}
public void setFromUserName(String fromUserName) {
this.fromUserName = fromUserName;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public String getMsgType() {
return msgType;
}
public void setMsgType(String msgType) {
this.msgType = msgType;
}
}
|
[
"[email protected]"
] | |
0498281a93febe693354de48ebc572102e7e1d1b
|
8bf3acab5988ce0c7a65682df848355e35f04c0d
|
/GYYEngineer/app/src/main/java/kzy/com/gyyengineer/leanchat/activity/EntrySplashActivity.java
|
ab1ac782f639d0c79ab6752483c4208da24eb280
|
[] |
no_license
|
kevin3574/YHMachine
|
e9e55e404e51d06358fd50fe44c7c8336d88f290
|
5d197af3d913c50b0a8d6c96437fcc18daf21df7
|
refs/heads/master
| 2021-07-12T11:25:38.732171 | 2017-10-16T02:56:48 | 2017-10-16T02:56:48 | 107,069,847 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,065 |
java
|
package kzy.com.gyyengineer.leanchat.activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.Toast;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.im.v2.AVIMClient;
import com.avos.avoscloud.im.v2.AVIMException;
import com.avos.avoscloud.im.v2.callback.AVIMClientCallback;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;
import org.json.JSONException;
import org.json.JSONObject;
import cn.leancloud.chatkit.LCChatKit;
import kzy.com.gyyengineer.R;
import kzy.com.gyyengineer.constant.Constants;
import kzy.com.gyyengineer.engineer.activity.GuideActivity;
import kzy.com.gyyengineer.engineer.activity.LoginActivity;
import kzy.com.gyyengineer.leanchat.controller.ChatManager;
import kzy.com.gyyengineer.leanchat.model.LeanchatUser;
import kzy.com.gyyengineer.leanchat.service.PushManager;
import kzy.com.gyyengineer.utils.MyHttpUtils;
import kzy.com.gyyengineer.utils.PackageUtils;
public class EntrySplashActivity extends AVBaseActivity {
public static final int SPLASH_DURATION = 2000;
private static final int GO_MAIN_MSG = 1;
private static final int GO_LOGIN_MSG = 2;
private ChatManager chatManager = ChatManager.getInstance();
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case GO_MAIN_MSG:
imLogin();
break;
case GO_LOGIN_MSG:
// Intent intent = new Intent(EntrySplashActivity.this, EntryLoginActivity.class);
Intent intent = new Intent(EntrySplashActivity.this, LoginActivity.class);
EntrySplashActivity.this.startActivity(intent);
finish();
break;
}
}
};
private boolean needGuide;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.entry_splash_layout);
isNeedGuide();
}
private void initData() {
if (LeanchatUser.getCurrentUser() != null) {
String username = LeanchatUser.getCurrentUser().getUsername();
String phone = username.substring(1, username.length());
getforgetpwdinNet(phone);
} else {
handler.sendEmptyMessageDelayed(GO_LOGIN_MSG, SPLASH_DURATION);
}
}
private void imLogin() {
LCChatKit.getInstance().open(LeanchatUser.getCurrentUserId(), new AVIMClientCallback() {
@Override
public void done(AVIMClient avimClient, AVIMException e) {
if (filterException(e)) {
Intent intent = new Intent(EntrySplashActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}
});
}
public void getforgetpwdinNet(final String phone) {
RequestParams params = new RequestParams();
params.addBodyParameter("telephone", phone);
MyHttpUtils.sendData(HttpRequest.HttpMethod.POST, Constants.URL + "cloundEngineer/userOldPassword", params, new RequestCallBack() {
@Override
public void onSuccess(ResponseInfo responseInfo) {
String result = (String) responseInfo.result;
Log.e("EntrySplashActivity", "--------------result-------------" + result);
try {
JSONObject jsonObject = new JSONObject(result);
String status = (String) jsonObject.get("status");
if (status.equals("1")) {
String forgetPwd = jsonObject.getString("password");
getLogData(phone, forgetPwd);
} else if (status.equals("0")) {
Toast.makeText(EntrySplashActivity.this, (String) jsonObject.get("data"), Toast.LENGTH_SHORT).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
Log.e("", "获取原始密码成功" + result);
}
@Override
public void onFailure(HttpException error, String msg) {
Log.e("", "获取原始密码失败" + msg);
}
});
}
private void getLogData(String phone, String forgetPwd) {
String url = Constants.URL + "cloundEngineer/userLogin";
RequestParams params = new RequestParams();
params.addBodyParameter("telephone", phone);
params.addBodyParameter("password", forgetPwd);
MyHttpUtils.sendData(HttpRequest.HttpMethod.POST, url, params, new RequestCallBack() {
@Override
public void onSuccess(ResponseInfo responseInfo) {
String result = (String) responseInfo.result;
try {
JSONObject jsonObject = new JSONObject(result);
String status = jsonObject.getString("status");
Log.e("EntrySplashActivity", "--EntrySplashActivity-result----" + result);
if ("3".equals(status)) {
Log.e("EntrySplashActivity", "--3----" + result);
chatManager.closeWithCallback(new AVIMClientCallback() {
@Override
public void done(AVIMClient avimClient, AVIMException e) {
}
});
PushManager.getInstance().unsubscribeCurrentUserChannel();
AVUser.logOut();
PushManager.getInstance().unsubscribeCurrentUserChannel();
LeanchatUser.logOut();
startActivity(new Intent(EntrySplashActivity.this, LoginActivity.class));
finish();
} else if ("1".equals(status)) {
handler.sendEmptyMessageDelayed(GO_MAIN_MSG, SPLASH_DURATION);
Log.e("EntrySplashActivity", "--1----" + result);
} else {
handler.sendEmptyMessageDelayed(GO_LOGIN_MSG, SPLASH_DURATION);
Log.e("EntrySplashActivity", "--else---" + result);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(HttpException error, String msg) {
}
});
}
public void isNeedGuide() {
SharedPreferences sp = getSharedPreferences("version", MODE_PRIVATE);
//相当于旧版本
final String version = sp.getString("version", null);
//相当于新版本
final String newVersion = PackageUtils.getPackageVersion(this);
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//说明登录过,不需要进入导航页,直接进入主界面
//当新版本与旧版本一致时直接跳转进入主界面
if (newVersion.equals(version)) {
initData();
} else {//需要进入导航页
Intent intent = new Intent(EntrySplashActivity.this, GuideActivity.class);
startActivity(intent);
finish();
}
}
});
thread.start();
}
}
|
[
"[email protected]"
] | |
1a329ba745f47643c090e8f05c006199b8c53dd0
|
c691fdb4a5702d8254f12c0eafb376f15dfbbbfb
|
/src/main/java/com/yumi/cash/app/server/dto/ProductListDTO.java
|
db4c17aece5c44d7d2bd3d08c4677b47b01e3fd2
|
[] |
no_license
|
gavinatcn/cash-app-server
|
925b63b5cdf0bb7fa2f1f0edb79df6ee216ad791
|
5abb82e0259828be463e4a2666b2377ac8b53f7d
|
refs/heads/master
| 2021-01-13T05:15:55.537399 | 2016-12-28T10:33:34 | 2016-12-28T10:33:34 | 81,300,290 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 409 |
java
|
package com.yumi.cash.app.server.dto;
import java.util.List;
/**
* Created by gavin on 2016/12/28.
*/
public class ProductListDTO {
private List<ProductAbstractInfoDTO> productList;
public List<ProductAbstractInfoDTO> getProductList() {
return productList;
}
public void setProductList(List<ProductAbstractInfoDTO> productList) {
this.productList = productList;
}
}
|
[
"[email protected]"
] | |
0e84ff60be065bf7f52027606b7a312b7375470a
|
26d731b5c9457bc96e1a7b28a5d2988f6c12065e
|
/src/main/java/com/cavendish/service/AsyncService.java
|
10d2f88821d0e2a8cb802b965cb0cee33a30fddf
|
[
"MIT"
] |
permissive
|
umashankar-sahoo/SpringBoot
|
cd4710c8b4226eea731f24f4a7abf753b2a80be3
|
e23f14ed0c6bd55546e3b9b30f9a9b9aed95fc89
|
refs/heads/master
| 2023-07-07T12:29:09.526331 | 2023-06-24T07:42:18 | 2023-06-24T07:42:18 | 128,923,778 | 0 | 0 |
MIT
| 2023-06-24T07:42:20 | 2018-04-10T11:43:22 |
Java
|
UTF-8
|
Java
| false | false | 2,139 |
java
|
package com.cavendish.service;
import java.util.concurrent.CompletableFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import com.cavendish.model.EmployeeAddresses;
import com.cavendish.model.EmployeeNames;
import com.cavendish.model.EmployeePhone;
@Service
public class AsyncService {
private static Logger log = LoggerFactory.getLogger(AsyncService.class);
@Autowired
private RestTemplate restTemplate;
@Async("asyncExecutor")
public CompletableFuture<EmployeeNames> getEmployeeName() throws InterruptedException {
log.info("getEmployeeName starts");
EmployeeNames employeeNameData = restTemplate.getForObject("http://localhost:8080/boot/name",
EmployeeNames.class);
log.info("employeeNameData, {}", employeeNameData);
Thread.sleep(1000L); // Intentional delay
log.info("employeeNameData completed");
return CompletableFuture.completedFuture(employeeNameData);
}
@Async("asyncExecutor")
public CompletableFuture<EmployeeAddresses> getEmployeeAddress() throws InterruptedException {
log.info("getEmployeeAddress starts");
EmployeeAddresses employeeAddressData = restTemplate.getForObject("http://localhost:8080/boot/address",
EmployeeAddresses.class);
log.info("employeeAddressData, {}", employeeAddressData);
Thread.sleep(1000L); // Intentional delay
log.info("employeeAddressData completed");
return CompletableFuture.completedFuture(employeeAddressData);
}
@Async("asyncExecutor")
public CompletableFuture<EmployeePhone> getEmployeePhone() throws InterruptedException {
log.info("getEmployeePhone starts");
EmployeePhone employeePhoneData = restTemplate.getForObject("http://localhost:8080/boot/phone",
EmployeePhone.class);
log.info("employeePhoneData, {}", employeePhoneData);
Thread.sleep(1000L); // Intentional delay
log.info("employeePhoneData completed");
return CompletableFuture.completedFuture(employeePhoneData);
}
}
|
[
"[email protected]"
] | |
5c948c7b05d3c47b6d315234ea010d8b9f4c2dff
|
af67f76935b7bb277966306710471e6260b81ee3
|
/app/build/generated/source/r/release/windmill/windmill/Manifest.java
|
5434f9f6344dbc5ae7708d1c62ab87a7d4d83e75
|
[] |
no_license
|
2horang2/Windmill
|
c45093fb883d7f61182c39d2b10f6e08aa62dbe9
|
c7e749bc8157ae62138c742a99dd5af9132b6672
|
refs/heads/master
| 2022-11-26T11:18:30.561378 | 2019-03-10T06:27:24 | 2019-03-10T06:27:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 382 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package windmill.windmill;
public final class Manifest {
public static final class permission {
public static final String C2D_MESSAGE="windmill.windmill.permission.C2D_MESSAGE";
}
}
|
[
"[email protected]"
] | |
4706cc840ee23b82380f2346e2bc28da125d1e53
|
5ca33bfe5df7f4d836c5bbd85ad8d767ed54d1df
|
/app/src/main/java/com/example/joshuamsingh/producto/Remote/APIService.java
|
ed56d3df3db70cc587ee6288cfceb5c151b52d0a
|
[] |
no_license
|
joshuasingh/productopfinal
|
c79d25028b251a6b1b044111dd49e96c63144336
|
d019ad7239712b1360611f1018885689ab32463f
|
refs/heads/master
| 2020-03-17T01:24:21.508129 | 2018-07-02T12:59:24 | 2018-07-02T12:59:24 | 133,151,468 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 731 |
java
|
package com.example.joshuamsingh.producto.Remote;
import com.example.joshuamsingh.producto.Model.MyResponse;
import com.example.joshuamsingh.producto.Model.Sender;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Headers;
import retrofit2.http.POST;
/**
* Created by Joshua M Singh on 13-04-2018.
*/
public interface APIService {
@Headers(
{
"Content-Type:application/json",
"Authorization:Key=AAAAVKT_8CU:APA91bH9mP33K0N-4mOI7FNmHIX-aGzD9LuQiePPco2oYTwP7-dPx6hbP5GtqBjQ23doEao9sMUQOUlsKx79lqcMdomjnj0yO9_v_suOAjlcSoJkQvqcPUbCG3wDlvSumd3MACd5S-DM"
}
)
@POST("fcm/send")
Call<MyResponse> sendNotification(@Body Sender body);
}
|
[
"[email protected]"
] | |
aafdf1efa73d10f0d14413c93a157fa022456d6a
|
6652c5c464617298417da2c0f2e83a83d926f45a
|
/SignUp/app/src/test/java/myview/zz/com/signup/ExampleUnitTest.java
|
eb06c46bd3ffaa1ba78fe3b6d200b4c0856d1142
|
[] |
no_license
|
2502089568/androidViewProject
|
6cdb59af83663dc9ec85e92f8a5757577ea6546e
|
b22f7aa2acbc086bc683a1bff7305b5182f78b8d
|
refs/heads/master
| 2020-03-19T02:59:35.987924 | 2018-03-17T06:57:55 | 2018-03-17T06:57:55 | 135,683,542 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 398 |
java
|
package myview.zz.com.signup;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
fed8f02d3478fb6d1ee1cfcc2b3b7fbf86e35f86
|
8a83ab3948b15f590e9973bf586bcdb1e5554f4a
|
/src/main/java/com/luoxuan/prediction/domain/PreprocessedWeibo.java
|
3e1a53cd39551b5f2610384e4c54306554cce742
|
[] |
no_license
|
candiceluoxuan/EventPredictionV2
|
1b7092ddc587bd7acfc40c58ffe8ad38e1b6930c
|
b007f70364844d0d12789952dfd1365132541764
|
refs/heads/master
| 2020-06-08T04:19:07.139369 | 2014-05-29T05:48:23 | 2014-05-29T05:48:23 | 20,125,355 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 982 |
java
|
package com.luoxuan.prediction.domain;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
public class PreprocessedWeibo {
private String id;
private String uid;
private Date date;
private String content;
private List<String> keywords = new LinkedList<>();
private String file;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public List<String> getKeywords() {
return keywords;
}
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
}
|
[
"[email protected]"
] | |
b7db1bf61d8fd72dc524a39a4f78afebfcd71b82
|
40593f0da54f7ed23eba02c69c446f88fac2fbb6
|
/JavaFundamentalsMay2018/Java OOP Basics/Exams/MyExam - 29 August 2018/src/constants/Messages.java
|
38d92e8d5d89e924d5d4b8d15dd6235713780686
|
[] |
no_license
|
NinoBonev/SoftUni
|
9edd2d1d747d95bbd39a8632c350840699600d31
|
938a489e2c8b4360de95d0207144313d016ef843
|
refs/heads/master
| 2021-06-29T13:22:37.277753 | 2019-04-16T19:18:53 | 2019-04-16T19:18:53 | 131,605,271 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,313 |
java
|
package constants;
/**
* Created by Nino Bonev - 3.8.2018 г., 16:01
*/
public class Messages {
public static final String ADDED_HERO = "Added hero: %s"; //name
public static final String ADDED_GUILD = "Added Guild: %s"; //name
public static final String ADDED_PROVINCE = "Created province %s"; //name
public static final String SELECTED_PROVINCE = "Province %s selected!"; //name
public static final String ALREADY_SELECTED = "Province %s has already been selected!";
public static final String NOT_ADDED_PROVINCE = "Province with name %s already exists!"; //name
public static final String NOT_EXISTING_PROVINCE = "Province %s does not exist"; //name
public static final String UPDATED_HERO = "Updated hero: %s"; //{heroName}
public static final String NOT_UPDATED = "Hero %s can not be replaced by a weaker one.";//{name}
public static final String REMOVE_HERO = "Successfully removed hero [%s] from guild %s";//{heroName} - {guildName}
public static final String REMOVE_GUILD = "Removed guild [%s] with %d members.";//{{guildName}} - {guildSize}
public static final String NO_SUCH_HERO_TYPE = "No such hero type!";//{{guildName}} - {guildSize}
public static final String INVALID_CHARACTERS = "Invalid character stats!";//{{guildName}} - {guildSize}
public static final String EXISTING_GUILD = "Guild already exists.";//{{guildName}} - {guildSize}
public static final String NO_PROVINCE_SELECTED = "No province selected!";//{{guildName}} - {guildSize}
public static final String NO_EXISTING_GUILD = "Guild [%s] does not exist.";//{{guildName}} - {guildSize}
public static final String REMOVED_GUILD = "Removed guild %s with %d members.";//{{guildName}} - {guildSize}
public static final String COMPLETED_MISSION_STATUS = "Completed";
//{name} - {name} - {id} - {assignedMissionsCount} - {completedMissionsCount} - {rating}
public static final String GUILD_DETAILS_MESSAGE = "Guild: %s\n" +
"###Heroes:";
//{agentType} - {name} - {id} - {assignedMissionsCount} - {completedMissionsCount} - {rating} - {bounty}
public static final String HERO_DETAILED_MESSAGE = "Hero: %s, Type: [%s]\n" +//{heroName} - {heroType}
"#Stats: \n" +
"Health: %d\n" + //health
"Fatigue: %d\n" + //fatigue
"Magicka: %d\n";
//{missionType} - {id} - {Open / Completed} - {rating} - {bounty}
public static final String MISSION_STATUS = "%s Mission - %s\n" +
"Status: %s\n" +
"Rating: %.2f\n" +
"Bounty: %.2f\n";
//{noviceAgentsCount} - {masterAgentsCount} - {totalAssignedMissionsCount} - {totalCompletedMissionsCount} - {totalRatingEarned} - {totalBountyEarned}
public static final String OVER_MESSAGE = "Novice Agents: %d\n" +
"Master Agents: %d\n" +
"Assigned Missions: %d\n" +
"Completed Missions: %d\n" +
"Total Rating Given: %.2f\n" +
"Total Bounty Given: $%.2f\n";
public static final String NO_SUCH_HERO = "No such hero in this guild!";
public static final String SUCCESSFULLY_REMOVED_HERO = "Successfully removed hero [%s] from guild %s";//{heroName} - {guildName}
public static final String HEROES_INFO = "Hero: %s, Offense: %.2f, Defense: %.2f";
}
|
[
"[email protected]"
] | |
7fe74d7a7f01c3392fe57125a34e1ec109c6ebac
|
7bc99e0774ffbf03a03628cc7cb8ca833dccc859
|
/src/practice/basicfeature/novice/designpetterns/solid/o/before/Controller.java
|
8cfd0b17033cce19bc72a49d249573c794551c61
|
[] |
no_license
|
mickeyjap182/mysample
|
d9cec884c4c94a2b23275b8ecdca4eab33056549
|
8f444872052ad1d8e91ede74a6a78be9c96c0cef
|
refs/heads/master
| 2022-08-03T22:25:06.192711 | 2022-07-23T08:16:35 | 2022-07-23T08:16:35 | 249,103,638 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 132 |
java
|
package practice.basicfeature.novice.designpetterns.solid.o.before;
public interface Controller {
public boolean dispatch();
}
|
[
"[email protected]"
] | |
dd85c4f8825bdf88fc050e3a7d94205949f1cee7
|
6ee5a27fef01a259eb81a27abd5cc3d0b9bcffe8
|
/src/main/java/com/example/myfridge/domain/User.java
|
a1070f079893aae66b8b269aa03aae7f1f623d73
|
[] |
no_license
|
GiT-LiHiS/myfridge
|
6ed78ee4a89f0b58e12504c1b97251d068659155
|
4945f724d8625eec5d0706961b433857f85d612b
|
refs/heads/master
| 2020-04-23T15:57:30.144086 | 2019-04-16T16:08:02 | 2019-04-16T16:08:02 | 171,282,104 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,843 |
java
|
package com.example.myfridge.domain;
import javax.persistence.*;
@Entity
@Table(name="Users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, updatable = false)
private Long id;
@Column(name = "username", nullable = false, unique = true)
private String username;
@Column(name = "password", nullable = false)
private String passwordHash;
@Column(name = "email", nullable = true)
private String email;
@Column(name = "role", nullable = false)
private String role;
public User() {
}
public User(String username, String passwordHash, String role) {
super();
this.username = username;
this.passwordHash = passwordHash;
this.role = role;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPasswordHash() {
return passwordHash;
}
public void setPasswordHash(String passwordHash) {
this.passwordHash = passwordHash;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
@Override
public String toString() {
return "User{" +
"id=" + id +
", username='" + username + '\'' +
", passwordHash='" + passwordHash + '\'' +
", email='" + email + '\'' +
", role='" + role + '\'' +
'}';
}
}
|
[
"[email protected]"
] | |
ba1e82c342ba03a77b1016f92c84744f11a1e2f9
|
a56b444e408060984ed0cb4346ef18a405dd6b5a
|
/dk.itu.pervasive.mobile.android/src/dk/itu/pervasive/mobile/utils/dataStructure/URLInformation.java
|
c3ef5003e85b0172c32a704f90adac68e5a4f36a
|
[
"Apache-2.0"
] |
permissive
|
tonybeltramelli/Ubiquitous-Media-Sharing-Surface
|
d10e8471a26a4695afba5d38f1d06439d00c8be5
|
069ace72a6dc08bed638de084c6171de752c4b94
|
refs/heads/master
| 2021-01-17T16:09:01.666960 | 2015-07-23T09:06:12 | 2015-07-23T09:06:12 | 18,179,241 | 1 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 356 |
java
|
package dk.itu.pervasive.mobile.utils.dataStructure;
/**
* @author Tony Beltramelli www.tonybeltramelli.com
*/
public class URLInformation
{
private String _ip;
private int _port;
public URLInformation(String ip, int port)
{
_ip = ip;
_port = port;
}
public String getIp()
{
return _ip;
}
public int getPort()
{
return _port;
}
}
|
[
"[email protected]"
] | |
d2c3eb1ee2fad589f308d886735e5993762f7878
|
7df51460731deef5f7b0276530e0fa0e3d5dc845
|
/app/src/main/java/com/courseraandroid/myfirstappcoursera/comments/CommentsHolder.java
|
ee73f4e41cf0f5ce4521e4866026784c5d435fc1
|
[] |
no_license
|
antoskaTest/MyCourseraC2T11DataBaseComments
|
badccc24d14d36645f672816887493b30180d291
|
a84850c63e6ae9a1756f0c60dab7093fad057a78
|
refs/heads/master
| 2022-12-05T19:21:05.251263 | 2020-09-02T15:34:50 | 2020-09-02T15:34:50 | 288,219,042 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,562 |
java
|
package com.courseraandroid.myfirstappcoursera.comments;
import android.view.View;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.courseraandroid.myfirstappcoursera.R;
import com.courseraandroid.myfirstappcoursera.model.Comment;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CommentsHolder extends RecyclerView.ViewHolder {
private TextView mAuthor;
private TextView mText;
private TextView mTime;
DateFormat df_datetime = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
DateFormat df_date = new SimpleDateFormat("dd.MM.yyyy");
DateFormat df_time = new SimpleDateFormat("HH:mm:ss");
public CommentsHolder(View view) {
super(view);
mAuthor = view.findViewById(R.id.tv_author);
mText = view.findViewById(R.id.tv_text);
mTime = view.findViewById(R.id.tv_time);
}
public void bind(Comment comment) {
mAuthor.setText(comment.getAuthor());
mText.setText(comment.getText());
try {
Date date = df_datetime.parse(comment.getTimestamp());
if((new Date()).getTime() - date.getTime() < 1000*60*60*24)
mTime.setText(df_time.format(date));
else
mTime.setText(df_date.format(date));
} catch (Exception ex) {
//Если не разберем, то выводим что получили
mTime.setText(comment.getTimestamp());
ex.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
250997407cc51077a34cc6615560120bef8db21d
|
20cb81cc83ab3c78dfdbc21b1f7e5886e8b81fc8
|
/src/HDOJ/baidu/Test5.java
|
46640683212d8bfa3159394c4ee13209c889d1a5
|
[
"MIT"
] |
permissive
|
kid1999/Algorithmic-training
|
44baf08be88fe6b032cde2895b23095824a2afea
|
7bb246ecfa6907c7f4b9a1fb2774ad75ce110673
|
refs/heads/master
| 2021-09-24T14:55:22.201025 | 2021-09-22T08:26:50 | 2021-09-22T08:26:50 | 196,485,140 | 2 | 0 |
MIT
| 2019-10-17T16:13:56 | 2019-07-12T01:07:47 |
Java
|
UTF-8
|
Java
| false | false | 477 |
java
|
package HDOJ.baidu;
import java.util.Scanner;
public class Test5 {
public static void main(String[] args) {
int sum = 0;
long[] nums = new long[100010];
nums[1] = 1;
Scanner sc = new Scanner(System.in);
long t = sc.nextLong();
sc.nextLong();
for (int i = 2; i <= t; i++) {
long n = sc.nextLong();
long pre2 = nums[i-1] * (i-1);
nums[i] = (sum + pre2) % n;
sum += pre2;
}
for (int i = 1; i <= t ; i++) {
System.out.println(nums[i]);
}
}
}
|
[
"[email protected]"
] | |
a1e1ac089595613257c145a7fde93e19706f1181
|
bb45ca5f028b841ca0a08ffef60cedc40090f2c1
|
/app/src/main/java/com/MCWorld/ui/profile/GiftLayout.java
|
eccf243efc4469e19bc58c552930b2f31c7b7fb0
|
[] |
no_license
|
tik5213/myWorldBox
|
0d248bcc13e23de5a58efd5c10abca4596f4e442
|
b0bde3017211cc10584b93e81cf8d3f929bc0a45
|
refs/heads/master
| 2020-04-12T19:52:17.559775 | 2017-08-14T05:49:03 | 2017-08-14T05:49:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,896 |
java
|
package com.MCWorld.ui.profile;
import android.app.Dialog;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.TextView;
import com.MCWorld.bbs.b.d;
import com.MCWorld.bbs.b.f;
import com.MCWorld.bbs.b.g;
import com.MCWorld.bbs.b.i;
import com.MCWorld.data.j;
import com.MCWorld.data.profile.GiftInfo;
import com.MCWorld.data.profile.ProductList;
import com.MCWorld.framework.base.image.PaintView;
import com.MCWorld.t;
import com.MCWorld.ui.base.BaseLoadingLayout;
import com.MCWorld.utils.at;
import com.MCWorld.utils.aw;
import com.simple.colorful.c;
import com.simple.colorful.setter.k;
import java.util.ArrayList;
import java.util.List;
public class GiftLayout extends BaseLoadingLayout implements OnItemClickListener, c {
private List<GiftInfo> aab;
private long bfk = 0;
private a bfl;
private GridView bfm;
private Context context;
private int mType = 0;
private String nick;
private class a extends BaseAdapter {
final /* synthetic */ GiftLayout bfn;
private List<GiftInfo> objs;
public a(GiftLayout giftLayout, List<GiftInfo> objs) {
this.bfn = giftLayout;
this.objs = objs;
}
public int getCount() {
return this.objs.size();
}
public Object getItem(int position) {
return this.objs.get(position);
}
public long getItemId(int position) {
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
a holder;
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext()).inflate(i.item_credit_gift, parent, false);
holder = new a(this);
holder.aRg = (PaintView) convertView.findViewById(g.img_gift);
holder.aRh = (TextView) convertView.findViewById(g.title);
holder.bfo = (FrameLayout) convertView.findViewById(g.fl_credit);
holder.bfp = (TextView) convertView.findViewById(g.credits);
convertView.setTag(holder);
} else {
holder = (a) convertView.getTag();
}
GiftInfo info = (GiftInfo) getItem(position);
int size = (at.getScreenPixWidth(this.bfn.context) - at.dipToPx(this.bfn.context, 16)) / 3;
holder.aRg.setLayoutParams(new LayoutParams(size, size));
t.a(holder.aRg, info.getIcon(), 0.0f);
holder.aRh.setText(info.getName());
if (this.bfn.mType == 1) {
holder.bfo.setBackgroundResource(f.bg_exchange_integral);
holder.bfp.setCompoundDrawablesWithIntrinsicBounds(f.ic_cup_white_small, 0, 0, 0);
}
holder.bfp.setText(String.valueOf(info.getCredits()));
return convertView;
}
public void setData(List<GiftInfo> data) {
this.objs = data;
notifyDataSetChanged();
}
}
public GiftLayout(Context context, int type) {
super(context);
this.context = context;
this.mType = type;
}
protected void c(Context context, AttributeSet attrs) {
super.c(context, attrs);
addView(LayoutInflater.from(context).inflate(i.include_video_detail_drama, this, false));
this.bfm = (GridView) findViewById(g.drama);
this.aab = new ArrayList();
this.bfl = new a(this, this.aab);
this.bfm.setAdapter(this.bfl);
this.bfm.setOnItemClickListener(this);
this.bfm.setSelector(d.transparent);
}
public void setGift(ProductList data) {
this.aab = data.getGifts();
this.bfl.setData(this.aab);
}
public void setUser(ProductList data) {
this.bfk = data.getUser() == null ? 0 : data.getUser().getCredits();
this.nick = data.getUser() == null ? "" : data.getUser().getNick();
this.nick = aw.W(this.nick, 10);
}
public void onItemClick(AdapterView<?> adapterView, View v, int position, long arg3) {
GiftInfo info = (GiftInfo) this.bfl.getItem(position);
if (this.mType == 0) {
b(info);
} else if (this.mType == 1) {
c(info);
}
}
public void Ff() {
if (this.bfl != null) {
this.bfl.notifyDataSetChanged();
}
}
private void b(GiftInfo info) {
if (!j.ep().ey()) {
t.an(this.context);
} else if (this.nick != null && info != null) {
t.a(this.context, info, this.bfk);
}
}
private void c(GiftInfo data) {
String msg = data.getDesc();
if (msg != null) {
final Dialog dialog = new Dialog(getContext(), com.simple.colorful.d.RD());
View layout = LayoutInflater.from(getContext()).inflate(i.include_dialog_one, null);
((TextView) layout.findViewById(g.tv_msg)).setText(msg);
dialog.setContentView(layout);
dialog.show();
layout.findViewById(g.tv_confirm).setOnClickListener(new OnClickListener(this) {
final /* synthetic */ GiftLayout bfn;
public void onClick(View arg0) {
dialog.dismiss();
}
});
}
}
public com.simple.colorful.a.a b(com.simple.colorful.a.a builder) {
k setter = new com.simple.colorful.setter.j(this.bfm);
setter.bg(g.item_gift, b.c.backgroundItemGift).bh(g.title, 16842806);
builder.a(setter);
return builder;
}
public void FG() {
}
}
|
[
"[email protected]"
] | |
d19644fc2f1a32a843b6358b4b3c11f72d2a8f4a
|
fc65185aa601974c8864015c646388330c82e660
|
/src/main/java/sh/exec/keywordharvester/service/KeywordHarvesterApiService.java
|
9328b39b710fb9abb7f1d9f38e31eab9be5b6d19
|
[] |
no_license
|
hfreire/keywordharvester
|
b46f6622ef0ef710b444a3002b5223108b0df06b
|
afb62eb826aa9a8f57723ca92e69a357659ac2bc
|
refs/heads/master
| 2016-09-06T20:16:44.514343 | 2013-04-14T19:00:23 | 2013-04-14T19:00:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 450 |
java
|
package sh.exec.keywordharvester.service;
import sh.exec.keywordharvester.exception.NoRelatedKeywordsFoundException;
import sh.exec.keywordharvester.exception.UnableToHarvestKeywordException;
import sh.exec.keywordharvester.model.KeywordModel;
public interface KeywordHarvesterApiService {
public KeywordModel harvestRelatedKeywordsFromKeywordString(String keyword)
throws UnableToHarvestKeywordException,
NoRelatedKeywordsFoundException;
}
|
[
"[email protected]"
] | |
ff8affbbc17c979dceeafee75dee21cc92bc7d4f
|
04cbb8c15ae0b3446606adf8419596d18f25b788
|
/master-microservices-master/currency-exchange-service/src/main/java/com/damo/currency/exchange/service/model/ExchangeValue.java
|
318d6664c888f20e5741aa4859dd13b616988b06
|
[] |
no_license
|
damukethireddy/Spring-Cloud
|
db3a8578691c3a59a194adfb840fba4ecb9df1ed
|
c1efe7e10e1a3b8784095e40d92987039e8ad783
|
refs/heads/master
| 2022-11-14T21:53:39.515467 | 2020-07-09T09:53:14 | 2020-07-09T09:53:14 | 278,070,537 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,452 |
java
|
package com.damo.currency.exchange.service.model;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class ExchangeValue {
@Id
private Long id;
@Column(name = "currency_from")
private String from;
@Column(name = "currency_to")
private String to;
private BigDecimal conversionMultiple;
private int port;
public ExchangeValue() {
super();
}
public ExchangeValue(Long id, String from, String to, BigDecimal conversionMultiple, int port) {
super();
this.id = id;
this.from = from;
this.to = to;
this.conversionMultiple = conversionMultiple;
this.port = port;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public BigDecimal getConversionMultiple() {
return conversionMultiple;
}
public void setConversionMultiple(BigDecimal conversionMultiple) {
this.conversionMultiple = conversionMultiple;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
@Override
public String toString() {
return "ExchangeValue [id=" + id + ", from=" + from + ", to=" + to + ", conversionMultiple="
+ conversionMultiple + ", port=" + port + "]";
}
}
|
[
"[email protected]"
] | |
adec21b57abf4e89f52d49cbfe60fe28b44f0873
|
40d844c1c780cf3618979626282cf59be833907f
|
/src/testcases/CWE789_Uncontrolled_Mem_Alloc/s02/CWE789_Uncontrolled_Mem_Alloc__getCookies_Servlet_HashSet_54a.java
|
5aff5f37c50d4425d2be1c836df355422785a450
|
[] |
no_license
|
rubengomez97/juliet
|
f9566de7be198921113658f904b521b6bca4d262
|
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
|
refs/heads/master
| 2023-06-02T00:37:24.532638 | 2021-06-23T17:22:22 | 2021-06-23T17:22:22 | 379,676,259 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,023 |
java
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__getCookies_Servlet_HashSet_54a.java
Label Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml
Template File: sources-sink-54a.tmpl.java
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: getCookies_Servlet Read data from the first cookie using getCookies()
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: HashSet
* BadSink : Create a HashSet using data as the initial size
* Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package
*
* */
package testcases.CWE789_Uncontrolled_Mem_Alloc.s02;
import testcasesupport.*;
import javax.servlet.http.*;
import java.util.logging.Level;
public class CWE789_Uncontrolled_Mem_Alloc__getCookies_Servlet_HashSet_54a extends AbstractTestCaseServlet
{
public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data;
data = Integer.MIN_VALUE; /* initialize data in case there are no cookies */
/* Read data from cookies */
{
Cookie cookieSources[] = request.getCookies();
if (cookieSources != null)
{
/* POTENTIAL FLAW: Read data from the first cookie value */
String stringNumber = cookieSources[0].getValue();
try
{
data = Integer.parseInt(stringNumber.trim());
}
catch(NumberFormatException exceptNumberFormat)
{
IO.logger.log(Level.WARNING, "Number format exception reading data from cookie", exceptNumberFormat);
}
}
}
(new CWE789_Uncontrolled_Mem_Alloc__getCookies_Servlet_HashSet_54b()).badSink(data , request, response);
}
public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
goodG2B(request, response);
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B(HttpServletRequest request, HttpServletResponse response) throws Throwable
{
int data;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
data = 2;
(new CWE789_Uncontrolled_Mem_Alloc__getCookies_Servlet_HashSet_54b()).goodG2BSink(data , request, response);
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
|
[
"[email protected]"
] | |
64dd48228f2643b3da3a47c157b873ea38200b4e
|
523cdb20b6dacc6f84a2338e1c9a79ba9539913e
|
/Midterm Coding Project/src/main/java/com/cisc181/core/Course.java
|
5ce17541de45add68b570a8ee741db7187242b41
|
[] |
no_license
|
rwadhwa/Midterm
|
e9258db12e9c311c40e38ad80e7fb377af6f186b
|
2ff95ea18840745c2d9ff057a9c5f8fa174be94b
|
refs/heads/master
| 2021-01-10T04:31:19.417124 | 2016-03-21T02:39:08 | 2016-03-21T02:39:08 | 54,288,569 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 895 |
java
|
package com.cisc181.core;
import java.util.UUID;
import com.cisc181.eNums.eMajor;
public class Course {
private UUID CourseID;
private String CourseName;
private int GradePoints;
private eMajor Major;
public Course(UUID courseID, String courseName, int gradePoints, eMajor major) {
this.CourseID = courseID;
this.CourseName = courseName;
this.GradePoints = gradePoints;
this.Major = major;
}
public UUID getCourseID() {
return CourseID;
}
public void setCourseID(UUID courseID) {
this.CourseID = courseID;
}
public String getCourseName() {
return CourseName;
}
public void setCourseName(String courseName) {
this.CourseName = courseName;
}
public int getGradePoints() {
return GradePoints;
}
public void setGradePoints(int gradePoints) {
this.GradePoints = gradePoints;
}
public eMajor getMajor() {
return Major;
}
public void setMajor(eMajor major) {
this.Major = major;
}
}
|
[
"[email protected]"
] | |
51c9a8e3b30313d5b93d09b87045c31e0201cd8c
|
78bfbd16923669e25c4cfedc097ef2f87ff8b092
|
/video_moudle1/src/main/java/com/ny/video_test/Test2Controller.java
|
a6f2a1f2a46406e0c536cdb24d3ba4127e7c298e
|
[] |
no_license
|
ny199004/video2
|
269496c11141238f0376d2fc19a04f274b053c0f
|
a6c978a53e2ac19c496b2da9c09020376b15518c
|
refs/heads/master
| 2020-05-27T22:57:35.888872 | 2019-05-27T09:31:55 | 2019-05-27T09:31:55 | 188,812,548 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 61 |
java
|
package com.ny.video_test;
public class Test2Controller {
}
|
[
"[email protected]"
] | |
9250661513f53bc439d0a8d8c3da941a924548b7
|
515e6d5ec87574112bc9e9a5319b99f5c0a92a9f
|
/src/Customers.java
|
67280f21cab35f7ab92567b75bd99940c9883479
|
[] |
no_license
|
RadekKaniecki/simple-bank-application
|
30d0f0ab0ccf5d2ca0013aceadc9da687da771d8
|
65d3ecb18cae562d59da07a2eea70f5db3925f70
|
refs/heads/master
| 2021-01-15T11:04:10.848140 | 2017-08-07T19:34:47 | 2017-08-07T19:34:47 | 99,612,467 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 555 |
java
|
import java.util.ArrayList;
public class Customers {
private ArrayList<Double> transactionList;
private String name;
public Customers(String name, double initialAmount) {
this.transactionList = new ArrayList<>();
this.name = name;
this.transactionList.add(initialAmount);
}
public ArrayList<Double> getTransactions() {
return transactionList;
}
public String getName() {
return name;
}
public void addTransaction(double amount) {
transactionList.add(amount);
}
}
|
[
"[email protected]"
] | |
011e1313e67d43c2aa3770440ab9c2717882f989
|
9eb4a4de1914073d87b00367f9043fa510cb4aba
|
/code/src/experiment/IExperiment.java
|
71890af45e82a222107dd5f0660e16979d360762
|
[] |
no_license
|
NonWhite/LabIA_P2
|
ec4376d16b0b063a1d367ec81e47ada16b529a8e
|
7b138428523fb8ef7ebea4a4826956c66eb32648
|
refs/heads/master
| 2020-05-18T08:15:35.922810 | 2015-05-04T17:55:45 | 2015-05-04T17:55:45 | 33,801,244 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 369 |
java
|
package experiment;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;
public interface IExperiment {
public static List<String> typesOfCost = Arrays.asList( "distance" , "waitingTime" , "both" ) ;
public static Integer NUM_EXECUTIONS = 20 ;
public void generateInput() ;
public void execute() throws FileNotFoundException ;
}
|
[
"[email protected]"
] | |
a2b1afcfa4e970e63a5c9fb019a66e29d41cdc2d
|
29170c7d4f8da3eaf88cb040066de89730eec5df
|
/2014_15_Even_Projects/E003, 001, 010/TheReadingRoom/app/src/main/java/com/example/aashya/thereadingroom/asciatic1.java
|
da3f32a08284b3ffb69854ea355e74975b46129f
|
[] |
no_license
|
NileshSingh/MPSTME_Project_Android
|
6c2f77abb5b151d62adfb586c1b339921ef3647e
|
8768deaa1b9bde66a1fdddc6ffdc571ca60489ed
|
refs/heads/master
| 2021-01-21T02:46:06.818487 | 2015-05-06T09:56:31 | 2015-05-06T09:56:31 | 59,458,925 | 0 | 1 | null | 2016-05-23T06:51:50 | 2016-05-23T06:51:50 | null |
UTF-8
|
Java
| false | false | 1,231 |
java
|
package com.example.aashya.thereadingroom;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
/**
* Created by aashya on 27/03/15.
*/
public class asciatic1 extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.asciatic1);
Button a = (Button) findViewById(R.id.aboutas);
a.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
Intent intent1 = new Intent(asciatic1.this, asciatic2.class);
startActivity(intent1);
}
});
Button b = (Button) findViewById(R.id.contactas);
b.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
Intent intent1 = new Intent(asciatic1.this, asciatic2.class);
startActivity(intent1);
}
}
);
}
}
|
[
"[email protected]"
] | |
1a3806747b9a10b2ad9831084ec398ed4a79e558
|
b34a2bf87961d440b43a5e6ab736f97f72b21697
|
/thread/src/main/java/com/oowanghan/thread/test/Test01.java
|
663fa0e1ff5420d4c3e5b4f39304fc33e85b199d
|
[] |
no_license
|
WH2zzZ/wh-java8
|
f0cca981ee10a854ded8e6ffe752c7d21165d219
|
b4294b3cf19a4224dd1e7fce499daaf4342531d5
|
refs/heads/master
| 2022-01-24T16:07:53.725542 | 2022-01-06T01:59:36 | 2022-01-06T01:59:36 | 149,905,162 | 2 | 0 | null | 2021-07-04T07:11:42 | 2018-09-22T18:27:08 |
Java
|
UTF-8
|
Java
| false | false | 2,977 |
java
|
package com.oowanghan.thread.thread.test;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import thread.problem.type.ReentryLock;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
/**
* 交叉打印
* @Author WangHan
* @Create 2020/5/17 8:46 下午
*/
@Slf4j
public class Test01 {
public static void main(String[] args) throws InterruptedException {
// Notify01 notify = new Notify01(1, 10);
// new Thread(() -> notify.print("线程1执行", 1, 2), "线程1").start();
// new Thread(() -> notify.print("线程2执行", 2, 3), "线程2").start();
// new Thread(() -> notify.print("线程3执行", 3, 1), "线程3").start();
Notify02 notify = new Notify02(10);
Condition condition1 = notify.newCondition();
Condition condition2 = notify.newCondition();
Condition condition3 = notify.newCondition();
new Thread(() -> notify.print("线程1执行", condition1, condition2), "线程1").start();
new Thread(() -> notify.print("线程2执行", condition2, condition3), "线程2").start();
new Thread(() -> notify.print("线程3执行", condition3, condition1), "线程3").start();
Thread.sleep(1000);
notify.lock();
try {
condition1.signal();
}finally {
log.info("======start======");
notify.unlock();
}
}
}
/**
* sync实现
*/
@Slf4j
@Data
@AllArgsConstructor
class Notify01 {
private int flag;
private int loopCount;
public void print(String content, int waitFlag, int nextFlag){
for (int i = 0; i < loopCount; i++) {
synchronized (this) {
while (flag != waitFlag) {
try {
this.wait();
} catch (InterruptedException e) {
log.info("等待中,被打断:{}", Thread.currentThread().getName());
}
}
log.info("thread:{},content:{},当前循环次数:{}", Thread.currentThread().getName(), content, i);
flag = nextFlag;
this.notifyAll();
}
}
}
}
/**
* lock实现
*/
@Slf4j
@Data
@AllArgsConstructor
class Notify02 extends ReentrantLock {
private int loopCount;
public void print(String content, Condition currentCondition, Condition nextCondition){
for (int i = 0; i < loopCount; i++) {
this.lock();
try {
currentCondition.await();
log.info("thread:{},content:{},当前循环次数:{}", Thread.currentThread().getName(), content, i);
nextCondition.signalAll();
} catch (InterruptedException e) {
log.info("等待被打断");
} finally {
this.unlock();
}
}
}
}
|
[
"[email protected]"
] | |
e614b68589c2c0e13a7c337ea4ec11ab184b3bb8
|
64c9966b6bd56e634bd20d25d1c8c8bcd6a95547
|
/code/order-service/src/test/java/com/northwind/orderservice/OrderServiceApplicationTests.java
|
1c45af457f76f6fd74fd95ad03c4be568b6a436a
|
[] |
no_license
|
sambireddych/Training-MicroServices
|
21fdccd76b3a4b206fe6b7de8b4ed9b0ed75fcf6
|
70299d585f1f1494bf2e13da99a6e519708d91f7
|
refs/heads/master
| 2022-04-21T21:53:46.908955 | 2020-04-22T17:14:24 | 2020-04-22T17:14:24 | 257,952,805 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 228 |
java
|
package com.northwind.orderservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
//@SpringBootTest
class OrderServiceApplicationTests {
//@Test
void contextLoads() {
}
}
|
[
"[email protected]"
] | |
c9a9e31af36715732e15cc0ed07e66c0e1cca2d1
|
44fa06e34a63bef1a1b87bf5a56018a5c06acaa5
|
/Caffeine/src/exe/common/Command.java
|
70f5c8845e1a5e2263a6b9ae061467602eb05e84
|
[] |
no_license
|
HANJIYEONN/CAffeine
|
5a8dac8011df556b352b0293b38b60b7eb75f953
|
0464537fb2fbead131fb7eaf066df5d638384fb5
|
refs/heads/master
| 2020-06-17T11:17:04.751160 | 2019-10-29T10:42:25 | 2019-10-29T10:42:25 | 195,908,198 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 271 |
java
|
package exe.common;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
public interface Command {
public ActionForward execute(HttpServletRequest request) throws IOException, ServletException;
}
|
[
"[email protected]"
] | |
27883a4b633018f0c830857b1748c3d6fa194a53
|
ca030864a3a1c24be6b9d1802c2353da4ca0d441
|
/classes4.dex_source_from_JADX/com/facebook/pages/adminedpages/backgroundtasks/AdminedPagesPrefetchBackgroundTaskConfig.java
|
a5f04004bdf34fe3e10b1f1fd1f957779e299174
|
[] |
no_license
|
pxson001/facebook-app
|
87aa51e29195eeaae69adeb30219547f83a5b7b1
|
640630f078980f9818049625ebc42569c67c69f7
|
refs/heads/master
| 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 394 |
java
|
package com.facebook.pages.adminedpages.backgroundtasks;
import javax.annotation.concurrent.Immutable;
@Immutable
/* compiled from: f */
public class AdminedPagesPrefetchBackgroundTaskConfig {
public final boolean f12420a;
public final long f12421b;
public AdminedPagesPrefetchBackgroundTaskConfig(boolean z, long j) {
this.f12420a = z;
this.f12421b = j;
}
}
|
[
"[email protected]"
] | |
29d3f46f06fa4fa0eb95ab5737eabf2014a47638
|
66759cdb5c947209b86a996f7a504fb36afc2692
|
/src/test/java/com/wavelabs/model/test/ReceiverTest.java
|
d34509dd278a5603d031fb4e2a35782d9b126b2f
|
[] |
no_license
|
TharunBairoju/CalendarApp
|
4faa55e6b9a5a309f90663c37fec5ff598a17099
|
6bfaedc8d7fd6972be708830860965ad094b2b93
|
refs/heads/master
| 2021-01-23T05:24:58.241572 | 2017-05-31T17:42:14 | 2017-05-31T17:42:14 | 92,967,744 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,248 |
java
|
package com.wavelabs.model.test;
import org.junit.Assert;
import org.junit.Test;
import com.wavelabs.model.Receiver;
public class ReceiverTest {
@Test
public void testGetId() {
Receiver receiver = new Receiver();
receiver.setId(100);
Assert.assertEquals(100, receiver.getId());
}
@Test
public void testGetName() {
Receiver receiver = new Receiver();
receiver.setName("Tharun");
Assert.assertEquals("Tharun", receiver.getName());
}
@Test
public void testGetEmail() {
Receiver receiver = new Receiver();
receiver.setEmail("[email protected]");
Assert.assertEquals("[email protected]", receiver.getEmail());
}
@Test
public void testGetPhone_number() {
Receiver receiver = new Receiver();
receiver.setPhoneNumber(9666253931l);
Assert.assertEquals(9666253931l, receiver.getPhoneNumber());
}
@Test
public void testGetPassword() {
Receiver receiver = new Receiver();
receiver.setPassword("password");
Assert.assertEquals("password", receiver.getPassword());
}
@Test
public void testGetAddress() {
Receiver receiver = new Receiver();
receiver.setAddress("plotNo:7 Jayaberi enclave,Hitech city");
Assert.assertEquals("plotNo:7 Jayaberi enclave,Hitech city", receiver.getAddress());
}
}
|
[
"[email protected]"
] | |
0edf24c9784c9f68fedc400d9797ae64410126c5
|
3ec181de57f014603bb36b8d667a8223875f5ee8
|
/gwdash-all/gwdash/gwdash-service/src/main/java/com/xiaomi/youpin/gwdash/service/ApiServerBillingService.java
|
392f49a02b34708b6242ee7ebf92344d363fcd9c
|
[
"Apache-2.0"
] |
permissive
|
XiaoMi/mone
|
41af3b636ecabd7134b53a54c782ed59cec09b9e
|
576cea4e6cb54e5bb7c37328f1cb452cda32f953
|
refs/heads/master
| 2023-08-31T08:47:40.632419 | 2023-08-31T08:09:35 | 2023-08-31T08:09:35 | 331,844,632 | 1,148 | 152 |
Apache-2.0
| 2023-09-14T07:33:13 | 2021-01-22T05:20:18 |
Java
|
UTF-8
|
Java
| false | false | 7,898 |
java
|
/*
* Copyright 2020 Xiaomi
*
* 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.xiaomi.youpin.gwdash.service;
import com.google.gson.Gson;
import com.xiaomi.youpin.docker.Safe;
import com.xiaomi.youpin.gwdash.bo.BillingReq;
import com.xiaomi.youpin.gwdash.rocketmq.BillingRocketMQProvider;
import com.xiaomi.youpin.tesla.billing.bo.BResult;
import com.xiaomi.youpin.tesla.billing.bo.BillingOperationBo;
import com.xiaomi.youpin.tesla.billing.bo.ReportBo;
import com.xiaomi.youpin.tesla.billing.bo.ReportRes;
import com.xiaomi.youpin.tesla.billing.common.BillingOperationTypeEnum;
import com.xiaomi.youpin.tesla.billing.common.BillingPlatformEnum;
import com.xiaomi.youpin.tesla.billing.common.BillingTypeEnum;
import com.xiaomi.youpin.tesla.billing.dataobject.BillingNorms;
import com.xiaomi.youpin.tesla.billing.service.BillingService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
/**
* @author [email protected]
* billing 操作服务类
*/
@Service
@Slf4j
public class ApiServerBillingService {
@Reference(group = "${ref.billing.service.group}", interfaceClass = BillingService.class, check = false)
private BillingService billingService;
@Autowired
private BillingRocketMQProvider billingRocketMQProvider;
/**
* 获取报表
*
* @return
*/
public BResult<ReportRes> report(long projectId, long envId) {
log.info("report projectId:{} envId:{}", projectId, envId);
// ReportBo reportBo = new ReportBo();
// reportBo.setBizId(projectId);
// reportBo.setSubBizId(envId);
// LocalDate ld = LocalDate.now();
// long now = System.currentTimeMillis();
return billingService.getBillingDetail(2020, projectId, envId);
// return billingService.generateBizReport(reportBo, ld.getYear(), ld.getMonthValue(), now);
}
/**
* 初始化报表内部数据
*
* @param reportBo
* @return
*/
public BResult<ReportRes> initReport(ReportBo reportBo) {
return billingService.initReport(reportBo);
}
/**
* 下线一台机器(不再对此台机器计费)
*/
public boolean offline(BillingReq req) {
log.info("offline:{}", req);
Safe.run(() -> {
BillingOperationBo bo = new BillingOperationBo();
bo.setBillingPlatform(BillingPlatformEnum.IDC_COMPUTER_ROOM.getCode());
bo.setBillingType(BillingTypeEnum.BY_MINUTE.getCode());
bo.setBillingOperation(BillingOperationTypeEnum.DESTROY_RESOURCE.getCode());
bo.setSubType(req.getSubType());
bo.setAccountId(req.getProjectId());
bo.setOperationTime(System.currentTimeMillis());
bo.setResourceIds(req.getResourceKeyList());
bo.setBizId(req.getProjectId());
bo.setSubBizId(req.getEnvId());
bo.setSendTime(System.currentTimeMillis());
BillingNorms useBillingNorms = new BillingNorms();
useBillingNorms.setCpu(String.valueOf(req.getUseCpu()));
BillingNorms allNorms = new BillingNorms();
allNorms.setCpu(String.valueOf(req.getCpu()));
bo.setUseNorms(useBillingNorms);
bo.setAllNorms(allNorms);
billingRocketMQProvider.send(new Gson().toJson(bo));
});
return true;
}
/**
* 上线一台机器(开始对此台机器计费)
*
* @return
*/
public boolean online(BillingReq req) {
log.info("online:{}", req);
Safe.run(() -> {
BillingOperationBo bo = new BillingOperationBo();
bo.setBillingPlatform(BillingPlatformEnum.IDC_COMPUTER_ROOM.getCode());
bo.setBillingType(BillingTypeEnum.BY_MINUTE.getCode());
bo.setBillingOperation(BillingOperationTypeEnum.CREATE_RESOURCE.getCode());
bo.setSubType(req.getSubType());
bo.setAccountId(req.getProjectId());
bo.setOperationTime(System.currentTimeMillis());
bo.setResourceIds(req.getResourceKeyList());
bo.setBizId(req.getProjectId());
bo.setSubBizId(req.getEnvId());
bo.setSendTime(System.currentTimeMillis());
BillingNorms useBillingNorms = new BillingNorms();
useBillingNorms.setCpu(String.valueOf(req.getUseCpu()));
BillingNorms allNorms = new BillingNorms();
allNorms.setCpu(String.valueOf(req.getCpu()));
bo.setUseNorms(useBillingNorms);
bo.setAllNorms(allNorms);
billingRocketMQProvider.send(new Gson().toJson(bo));
});
return true;
}
/**
* 升级配置
* @param req
* @return
*/
public boolean upgrade(BillingReq req) {
log.info("online:{}", req);
Safe.run(() -> {
BillingOperationBo bo = new BillingOperationBo();
bo.setBillingPlatform(BillingPlatformEnum.IDC_COMPUTER_ROOM.getCode());
bo.setBillingType(BillingTypeEnum.BY_MINUTE.getCode());
bo.setBillingOperation(BillingOperationTypeEnum.RISE_RESOURCE.getCode());
bo.setSubType(req.getSubType());
bo.setAccountId(req.getProjectId());
bo.setOperationTime(System.currentTimeMillis());
bo.setResourceIds(req.getResourceKeyList());
bo.setBizId(req.getProjectId());
bo.setSubBizId(req.getEnvId());
bo.setSendTime(System.currentTimeMillis());
BillingNorms useBillingNorms = new BillingNorms();
useBillingNorms.setCpu(String.valueOf(req.getUseCpu()));
BillingNorms allNorms = new BillingNorms();
allNorms.setCpu(String.valueOf(req.getCpu()));
bo.setUseNorms(useBillingNorms);
bo.setAllNorms(allNorms);
billingRocketMQProvider.send(new Gson().toJson(bo));
});
return true;
}
/**
* 降低配置
* @param req
* @return
*/
public boolean downgrade(BillingReq req) {
log.info("online:{}", req);
Safe.run(() -> {
BillingOperationBo bo = new BillingOperationBo();
bo.setBillingPlatform(BillingPlatformEnum.IDC_COMPUTER_ROOM.getCode());
bo.setBillingType(BillingTypeEnum.BY_MINUTE.getCode());
bo.setBillingOperation(BillingOperationTypeEnum.DROP_RESOURCE.getCode());
bo.setSubType(req.getSubType());
bo.setAccountId(req.getProjectId());
bo.setOperationTime(System.currentTimeMillis());
bo.setResourceIds(req.getResourceKeyList());
bo.setBizId(req.getProjectId());
bo.setSubBizId(req.getEnvId());
bo.setSendTime(System.currentTimeMillis());
BillingNorms useBillingNorms = new BillingNorms();
useBillingNorms.setCpu(String.valueOf(req.getUseCpu()));
BillingNorms allNorms = new BillingNorms();
allNorms.setCpu(String.valueOf(req.getCpu()));
bo.setUseNorms(useBillingNorms);
bo.setAllNorms(allNorms);
billingRocketMQProvider.send(new Gson().toJson(bo));
});
return true;
}
}
|
[
"[email protected]"
] | |
2f2ec04839d8225d55370d5653cf44d1a66878b4
|
9232a55d3b8dc711df9d43832fc6bf5132e06841
|
/Bridge Pattern/src/com/bridge/abs/Vehicle.java
|
639f4223cf530379a61accdd0f8bc9f32de9d663
|
[] |
no_license
|
kethan-sai/springboot-designpattern-day27
|
c4efc81bf74e803fd118b2e1efacadf891484dfe
|
b2acd988ec58be5c3c8dc8b02c257fd79274cdde
|
refs/heads/master
| 2022-11-11T09:41:38.684093 | 2020-07-01T16:21:20 | 2020-07-01T16:21:20 | 276,426,504 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 371 |
java
|
package com.bridge.abs;
import java.util.ArrayList;
import java.util.List;
public abstract class Vehicle {
protected List<Workshop> workshops = new ArrayList<>();
public Vehicle() {
super();
}
public boolean addworkshop(Workshop workshop) {
return workshops.add(workshop);
}
public abstract void manufacture();
public abstract int minWorkTime();
}
|
[
"[email protected]"
] | |
828ef584c9efc0091a8cfebc4cc153f34cdf4eff
|
abc7e2b2a4f4f835b5bc695dd8087e1c8c1199df
|
/pankaj/SparkExamples/transent/src/com/verifone/isd/vsms2/sales/ent/mop/Mop.java
|
8f9d3b74b5f79e1c77e7c7046c97dfa1c0d89322
|
[] |
no_license
|
katpb/spark-mongo-test
|
db54e83f94fc8f4d7638ea0838742331711025ed
|
4489ae3315dafc828ec5fbeefd3257bc2252be8c
|
refs/heads/master
| 2023-04-28T15:34:31.788929 | 2020-07-19T17:49:46 | 2020-07-19T17:49:46 | 268,293,363 | 0 | 2 | null | 2023-04-21T20:44:21 | 2020-05-31T14:09:23 |
Java
|
UTF-8
|
Java
| false | false | 22,339 |
java
|
package com.verifone.isd.vsms2.sales.ent.mop;
import com.verifone.isd.vsms2.sales.ent.ISalesEntityVisitable;
import com.verifone.isd.vsms2.sales.ent.SalesEntityVisitor;
import com.verifone.isd.vsms2.sys.db.pres.IEntityObject;
import com.verifone.isd.vsms2.sys.db.pres.IEntityPK;
import com.verifone.isd.vsms2.sys.l10n.LocalizedRB;
import com.verifone.isd.vsms2.sys.util.MoneyAmount;
/**Entity class for Mop.
*
* @author "mailto:[email protected]"
* @version 1.0
*/
public class Mop implements IEntityObject, ISalesEntityVisitable {
/** The Constant serialVersionUID. */
static final long serialVersionUID = -708007699441676941L;
/** Maximum ID value allowed for Mop; also max # of mop's allowed. */
public static final int MAX_MOPS = 100;
/** Maximum mop codes. */
private static final int MAX_MIN_AMT = 999999;
/** The Constant MAX_MAX_AMT. */
private static final int MAX_MAX_AMT = MAX_MIN_AMT;
/** The Constant MAX_LIM_AMT. */
private static final int MAX_LIM_AMT = MAX_MIN_AMT;
/** The Constant MAX_RCPT_CPS. */
private static final int MAX_RCPT_CPS = 3;
/** Number of decimals in MoneyAMount used by this class. */
public static final int NUM_DECIMALS = 2;
/** The id. */
private MopPK ID;
/** Holds value of property minimumAmount. */
private MoneyAmount minimumAmount;
/** Holds value of property maximumAmount. */
private MoneyAmount maximumAmount;
/** Holds value of property name. */
private String name;
/** Holds value of property code. */
private MopCode code;
/** Holds value of property limit. */
private MoneyAmount limit;
/** Holds value of property numReceiptCopies. */
private int numReceiptCopies = 0;
/** Holds value of property forceSafeDrop. */
private boolean forceSafeDrop;
/** Holds value of property openDrawerOnSale. */
private boolean openDrawerOnSale;
/** Holds value of property tenderAmountRequired. */
private boolean tenderAmountRequired;
/** Holds value of property refundable. */
private boolean refundable;
/** Holds value of property allowWithoutSale. */
private boolean allowWithoutSale;
/** Holds value of property allowChange. */
private boolean allowChange;
/** Holds value of property allowZeroEntry. */
private boolean allowZeroEntry;
/** Holds value of property allowSafeDrop. */
private boolean allowSafeDrop;
/** Holds value of property allowMoneyOrderPurchase. */
private boolean allowMoneyOrderPurchase;
/** Holds value of property forceTicketPrint. */
private boolean forceTicketPrint;
/** Holds value of property forceFixedAmount. */
private boolean forceFixedAmount;
/** Holds value of property promptForCashierReport. */
private boolean promptForCashierReport;
/** The tender code. */
private String nacsTenderCode = LocalizedRB.getNACSCodeRes(NACSTenderCode.GENERIC.getTenderCode());
/** The tender subcode. */
private String nacsTenderSubcode = LocalizedRB.getNACSCodeRes(NACSTenderSubCode.GENERIC.getTenderSubCode());
/** No-args constructor
*/
public Mop() {
this(null); // PK Not yet established!
}
/** Constructor
* @param pk MopPK for the object
*/
public Mop(MopPK pk) {
this.ID = pk;
this.code = MopCode.CASH;
}
/**
* Getter of the entity object's primary key.
*
* @return the ID of the entity object
*/
@Override
public IEntityPK getPK() {
return this.ID;
}
/**
* Method to validate the primary key of the entity object.
*
* @return true if the primary key of the entity object is valid
*/
@Override
public boolean isPKValid() {
return (this.ID == null) ? false : this.ID.isValid();
}
/**
* Set the primary key of the entity object.
*
* @param pk
* primary key for the entity object
*/
@Override
public void setPK(IEntityPK pk) {
this.ID = (MopPK)pk;
}
/**
* Method to clone this entity's attribute to another.
*
* @param obj
* object to copy to
*/
@Override
public void setAttributes(IEntityObject obj) {
Mop mObj = (Mop) obj;
mObj.ID = this.ID;
mObj.name = this.name;
mObj.code = this.code;
mObj.maximumAmount = this.maximumAmount;
mObj.minimumAmount = this.minimumAmount;
mObj.limit = this.limit;
mObj.numReceiptCopies = this.numReceiptCopies;
mObj.allowChange = this.allowChange;
mObj.allowMoneyOrderPurchase = this.allowMoneyOrderPurchase;
mObj.allowSafeDrop = this.allowSafeDrop;
mObj.allowWithoutSale = this.allowWithoutSale;
mObj.allowZeroEntry = this.allowZeroEntry;
mObj.forceSafeDrop = this.forceSafeDrop;
mObj.forceTicketPrint = this.forceTicketPrint;
mObj.forceFixedAmount = this.forceFixedAmount;
mObj.openDrawerOnSale = this.openDrawerOnSale;
mObj.promptForCashierReport = this.promptForCashierReport;
mObj.refundable = this.refundable;
mObj.tenderAmountRequired = this.tenderAmountRequired;
mObj.nacsTenderCode = this.nacsTenderCode;
mObj.nacsTenderSubcode = this.nacsTenderSubcode;
}
/** Method to validate an entity object's attributes.
* @throws Exception if validation fails
*/
@Override
public void validate() throws Exception {
if (!this.isPKValid()) {
throw new Exception("Invalid Mop: " +this.ID);
}
if ((this.name == null) || (this.name.trim().equals("")) ||
(this.name.trim().equals("*"))) {
throw new Exception("Invalid name for Mop: " +this.ID);
}
this.validateAmounts();
}
@SuppressWarnings("deprecation")
private void validateAmounts() throws Exception {
long minVal = 0;
if (this.minimumAmount != null) {
minVal = this.minimumAmount.getLongValue();
if ((minVal < 0) || (minVal > MAX_MIN_AMT)) {
throw new Exception("Invalid minimum amount: "
+this.minimumAmount.toString() +" for Mop: " +this.ID);
}
}
if (this.maximumAmount != null) {
long maxVal = this.maximumAmount.getLongValue();
if ((maxVal < 0) || (maxVal > MAX_MAX_AMT)) {
throw new Exception("Invalid maximum amount: "
+this.maximumAmount.toString() +" for Mop: " +this.ID);
}
if ((maxVal != 0) && (minVal != 0) && (minVal > maxVal)) {
throw new Exception("Mismatch between minimum and maximum value for Mop: "
+this.ID);
}
}
int copiesVal = this.numReceiptCopies;
if ((copiesVal < 0) || (copiesVal > MAX_RCPT_CPS)) {
throw new Exception("Invalid number of receipt copies: "
+this.numReceiptCopies + " for Mop: " +this.ID);
}
}
/** Getter for property minimumAmount.
* @return Value of property minimumAmount.
*/
public MoneyAmount getMinimumAmount() {
return (this.minimumAmount == null ? new MoneyAmount(0, Mop.NUM_DECIMALS)
: this.minimumAmount);
}
/** Setter for property minimumAmount.
* @param minimumAmount New value of property minimumAmount.
*/
public void setMinimumAmount(MoneyAmount minimumAmount) {
this.minimumAmount = minimumAmount;
}
/** Getter for property maximumAmount.
* @return Value of property maximumAmount.
*/
public MoneyAmount getMaximumAmount() {
return (this.maximumAmount == null ? new MoneyAmount(0, Mop.NUM_DECIMALS)
: this.maximumAmount);
}
/** Setter for property maximumAmount.
* @param maximumAmount New value of property maximumAmount.
*/
public void setMaximumAmount(MoneyAmount maximumAmount) {
this.maximumAmount = maximumAmount;
}
/** Getter for property name.
* @return Value of property name.
*/
public String getName() {
return (this.name != null ? this.name : "");
}
/** Setter for property name.
* @param name New value of property name.
*/
public void setName(String name) {
this.name = name;
}
/** Getter for property code.
* @return Value of property code.
*/
public MopCode getCode() {
if (this.code == null) {
this.code = MopCode.CASH;
}
return this.code;
}
/** Setter for property code.
* @param code New value of property code.
*/
public void setCode(MopCode code) {
this.code = code;
}
/** Getter for property limit.
* @return Value of property limit.
*/
public MoneyAmount getLimit() {
return (this.limit == null ? new MoneyAmount(0, Mop.NUM_DECIMALS)
: this.limit);
}
/** Setter for property limit.
* @param limit New value of property limit.
*/
public void setLimit(MoneyAmount limit) {
this.limit = limit;
}
/** Getter for property forceSafeDrop.
* @return Value of property forceSafeDrop.
*/
public boolean isForceSafeDrop() {
return this.forceSafeDrop;
}
/** Setter for property forceSafeDrop.
* @param forceSafeDrop New value of property forceSafeDrop.
*/
public void setForceSafeDrop(boolean forceSafeDrop) {
this.forceSafeDrop = forceSafeDrop;
}
/** Getter for property openDrawerOnSale.
* @return Value of property openDrawerOnSale.
*/
public boolean isOpenDrawerOnSale() {
return this.openDrawerOnSale;
}
/** Setter for property openDrawerOnSale.
* @param openDrawerOnSale New value of property openDrawerOnSale.
*/
public void setOpenDrawerOnSale(boolean openDrawerOnSale) {
this.openDrawerOnSale = openDrawerOnSale;
}
/** Getter for property tenderAmountRequired.
* @return Value of property tenderAmountRequired.
*/
public boolean isTenderAmountRequired() {
return this.tenderAmountRequired;
}
/** Setter for property tenderAmountRequired.
* @param tenderAmountRequired New value of property tenderAmountRequired.
*/
public void setTenderAmountRequired(boolean tenderAmountRequired) {
this.tenderAmountRequired = tenderAmountRequired;
}
/** Getter for property refundable.
* @return Value of property refundable.
*/
public boolean isRefundable() {
return this.refundable;
}
/** Setter for property refundable.
* @param refundable New value of property refundable.
*/
public void setRefundable(boolean refundable) {
this.refundable = refundable;
}
/** Getter for property allowWithoutSale.
* @return Value of property allowWithoutSale.
*/
public boolean isAllowWithoutSale() {
return this.allowWithoutSale;
}
/** Setter for property allowWithoutSale.
* @param allowWithoutSale New value of property allowWithoutSale.
*/
public void setAllowWithoutSale(boolean allowWithoutSale) {
this.allowWithoutSale = allowWithoutSale;
}
/** Getter for property allowChange.
* @return Value of property allowChange.
*/
public boolean isAllowChange() {
return this.allowChange;
}
/** Setter for property allowChange.
* @param allowChange New value of property allowChange.
*/
public void setAllowChange(boolean allowChange) {
this.allowChange = allowChange;
}
/** Getter for property allowZeroEntry.
* @return Value of property allowZeroEntry.
*/
public boolean isAllowZeroEntry() {
return this.allowZeroEntry;
}
/** Setter for property allowZeroEntry.
* @param allowZeroEntry New value of property allowZeroEntry.
*/
public void setAllowZeroEntry(boolean allowZeroEntry) {
this.allowZeroEntry = allowZeroEntry;
}
/** Getter for property allowSafeDrop.
* @return Value of property allowSafeDrop.
*/
public boolean isAllowSafeDrop() {
return this.allowSafeDrop;
}
/** Setter for property allowSafeDrop.
* @param allowSafeDrop New value of property allowSafeDrop.
*/
public void setAllowSafeDrop(boolean allowSafeDrop) {
this.allowSafeDrop = allowSafeDrop;
}
/** Getter for property allowMoneyOrderPurchase.
* @return Value of property allowMoneyOrderPurchase.
*/
public boolean isAllowMoneyOrderPurchase() {
return this.allowMoneyOrderPurchase;
}
/** Setter for property allowMoneyOrderPurchase.
* @param allowMoneyOrderPurchase New value of property allowMoneyOrderPurchase.
*/
public void setAllowMoneyOrderPurchase(boolean allowMoneyOrderPurchase) {
this.allowMoneyOrderPurchase = allowMoneyOrderPurchase;
}
/** Getter for property forceTicketPrint.
* @return Value of property forceTicketPrint.
*/
public boolean isForceTicketPrint() {
return this.forceTicketPrint;
}
/** Setter for property forceTicketPrint.
* @param forceTicketPrint New value of property forceTicketPrint.
*/
public void setForceTicketPrint(boolean forceTicketPrint) {
this.forceTicketPrint = forceTicketPrint;
}
/** Getter for property forceFixedAmount.
* @return Value of property forceFixedAmount.
*/
public boolean isForceFixedAmount() {
return this.forceFixedAmount;
}
/** Setter for property forceFixedAmount.
* @param forceFixedAmount New value of property forceFixedAmount.
*/
public void setForceFixedAmount(boolean forceFixedAmount) {
this.forceFixedAmount = forceFixedAmount;
}
/** Getter for property promptForCashierReport.
* @return Value of property promptForCashierReport.
*/
public boolean isPromptForCashierReport() {
return this.promptForCashierReport;
}
/** Setter for property promptForCashierReport.
* @param promptForCashierReport New value of property promptForCashierReport.
*/
public void setPromptForCashierReport(boolean promptForCashierReport) {
this.promptForCashierReport = promptForCashierReport;
}
/** Getter for property numReceiptCopies.
* @return Value of property numReceiptCopies.
*/
public int getNumReceiptCopies() {
return this.numReceiptCopies;
}
/** Setter for property numReceiptCopies.
* @param numReceiptCopies New value of property numReceiptCopies.
*/
public void setNumReceiptCopies(int numReceiptCopies) {
this.numReceiptCopies = numReceiptCopies;
}
/**
* Gets the tender code.
*
* @return the nacsTenderCode
*/
public String getNacsTenderCode() {
return this.nacsTenderCode;
}
/**
* Gets the tender subcode.
*
* @return the nacsTenderSubcode
*/
public String getNacsTenderSubcode() {
return this.nacsTenderSubcode;
}
/**
* Sets the tender code.
*
* @param nacsTenderCode
* the nacsTenderCode to set
*/
public void setNacsTenderCode(String nacsTenderCode) {
if(null != nacsTenderCode)
this.nacsTenderCode = nacsTenderCode;
}
/**
* Sets the tender subcode.
*
* @param nacsTenderSubcode
* the nacsTenderSubcode to set
*/
public void setNacsTenderSubcode(String nacsTenderSubcode) {
if(null != nacsTenderSubcode)
this.nacsTenderSubcode = nacsTenderSubcode;
}
/** Impelmentation method for visitable in visitor pattern
* @param v visitor
* @throws Exception on exception in visitor's visit method
*/
@Override
public void accept(SalesEntityVisitor v) throws Exception {
v.visit(this);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + ((this.ID == null) ? 0 : this.ID.hashCode());
result = (prime * result) + (this.allowChange ? 1231 : 1237);
result = (prime * result) + (this.allowMoneyOrderPurchase ? 1231 : 1237);
result = (prime * result) + (this.allowSafeDrop ? 1231 : 1237);
result = (prime * result) + (this.allowWithoutSale ? 1231 : 1237);
result = (prime * result) + (this.allowZeroEntry ? 1231 : 1237);
result = (prime * result) + ((this.code == null) ? 0 : this.code.hashCode());
result = (prime * result) + (this.forceSafeDrop ? 1231 : 1237);
result = (prime * result) + (this.forceTicketPrint ? 1231 : 1237);
result = (prime * result) + (this.forceFixedAmount ? 1231 : 1237);
result = (prime * result) + ((this.limit == null) ? 0 : this.limit.hashCode());
result = (prime * result)
+ ((this.maximumAmount == null) ? 0 : this.maximumAmount.hashCode());
result = (prime * result)
+ ((this.minimumAmount == null) ? 0 : this.minimumAmount.hashCode());
result = (prime * result)
+ ((this.nacsTenderCode == null) ? 0 : this.nacsTenderCode.hashCode());
result = (prime
* result)
+ ((this.nacsTenderSubcode == null) ? 0 : this.nacsTenderSubcode
.hashCode());
result = (prime * result) + ((this.name == null) ? 0 : this.name.hashCode());
result = (prime * result) + this.numReceiptCopies;
result = (prime * result) + (this.openDrawerOnSale ? 1231 : 1237);
result = (prime * result) + (this.promptForCashierReport ? 1231 : 1237);
result = (prime * result) + (this.refundable ? 1231 : 1237);
result = (prime * result) + (this.tenderAmountRequired ? 1231 : 1237);
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Mop)) {
return false;
}
Mop other = (Mop) obj;
if (this.ID == null) {
if (other.ID != null) {
return false;
}
} else if (!this.ID.equals(other.ID)) {
return false;
}
if (this.allowChange != other.allowChange) {
return false;
}
if (this.allowMoneyOrderPurchase != other.allowMoneyOrderPurchase) {
return false;
}
if (this.allowSafeDrop != other.allowSafeDrop) {
return false;
}
if (this.allowWithoutSale != other.allowWithoutSale) {
return false;
}
if (this.allowZeroEntry != other.allowZeroEntry) {
return false;
}
if (this.code == null) {
if (other.code != null) {
return false;
}
} else if (!this.code.equals(other.code)) {
return false;
}
if (this.forceSafeDrop != other.forceSafeDrop) {
return false;
}
if (this.forceTicketPrint != other.forceTicketPrint) {
return false;
}
if (this.forceFixedAmount != other.forceFixedAmount) {
return false;
}
if (this.limit == null) {
if (other.limit != null) {
return false;
}
} else if (!this.limit.equals(other.limit)) {
return false;
}
if (this.maximumAmount == null) {
if (other.maximumAmount != null) {
return false;
}
} else if (!this.maximumAmount.equals(other.maximumAmount)) {
return false;
}
if (this.minimumAmount == null) {
if (other.minimumAmount != null) {
return false;
}
} else if (!this.minimumAmount.equals(other.minimumAmount)) {
return false;
}
if (this.nacsTenderCode == null) {
if (other.nacsTenderCode != null) {
return false;
}
} else if (!this.nacsTenderCode.equals(other.nacsTenderCode)) {
return false;
}
if (this.nacsTenderSubcode == null) {
if (other.nacsTenderSubcode != null) {
return false;
}
} else if (!this.nacsTenderSubcode.equals(other.nacsTenderSubcode)) {
return false;
}
if (this.name == null) {
if (other.name != null) {
return false;
}
} else if (!this.name.equals(other.name)) {
return false;
}
if (this.numReceiptCopies != other.numReceiptCopies) {
return false;
}
if (this.openDrawerOnSale != other.openDrawerOnSale) {
return false;
}
if (this.promptForCashierReport != other.promptForCashierReport) {
return false;
}
if (this.refundable != other.refundable) {
return false;
}
if (this.tenderAmountRequired != other.tenderAmountRequired) {
return false;
}
return true;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Mop [ID=" + this.ID + ", minimumAmount=" + this.minimumAmount
+ ", maximumAmount=" + this.maximumAmount + ", name=" + this.name
+ ", code=" + this.code + ", limit=" + this.limit + ", numReceiptCopies="
+ this.numReceiptCopies + ", forceSafeDrop=" + this.forceSafeDrop
+ ", openDrawerOnSale=" + this.openDrawerOnSale
+ ", tenderAmountRequired=" + this.tenderAmountRequired
+ ", refundable=" + this.refundable + ", allowWithoutSale="
+ this.allowWithoutSale + ", allowChange=" + this.allowChange
+ ", allowZeroEntry=" + this.allowZeroEntry + ", allowSafeDrop="
+ this.allowSafeDrop + ", allowMoneyOrderPurchase="
+ this.allowMoneyOrderPurchase + ", forceTicketPrint="
+ this.forceTicketPrint + ", forceFixedAmount="
+ this.forceFixedAmount + ", promptForCashierReport="
+ this.promptForCashierReport + ", nacsTenderCode=" + this.nacsTenderCode
+ ", nacsTenderSubcode=" + this.nacsTenderSubcode + "]";
}
}
|
[
"[email protected]"
] | |
3a91f431af94e0e983cea86fa53bbc285e16b755
|
24bc4990e9d0bef6a42a6f86dc783785b10dbd42
|
/chrome/browser/password_check/android/internal/java/src/org/chromium/chrome/browser/password_check/PasswordCheckCoordinator.java
|
476e580f15710bc2e6a076bb5e768d9952112778
|
[
"BSD-3-Clause"
] |
permissive
|
nwjs/chromium.src
|
7736ce86a9a0b810449a3b80a4af15de9ef9115d
|
454f26d09b2f6204c096b47f778705eab1e3ba46
|
refs/heads/nw75
| 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 |
BSD-3-Clause
| 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null |
UTF-8
|
Java
| false | false | 7,123 |
java
|
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.password_check;
import android.content.Context;
import android.view.MenuItem;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.LifecycleObserver;
import org.chromium.chrome.browser.device_reauth.BiometricAuthRequester;
import org.chromium.chrome.browser.device_reauth.ReauthenticatorBridge;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher;
import org.chromium.chrome.browser.password_check.helper.PasswordCheckChangePasswordHelper;
import org.chromium.chrome.browser.password_check.helper.PasswordCheckIconHelper;
import org.chromium.chrome.browser.password_check.internal.R;
import org.chromium.chrome.browser.password_manager.settings.PasswordAccessReauthenticationHelper;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.components.browser_ui.settings.SettingsLauncher;
import org.chromium.components.favicon.LargeIconBridge;
import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
/**
* Creates the PasswordCheckComponentUi. This class is responsible for managing the UI for the check
* of the leaked password.
*/
class PasswordCheckCoordinator implements PasswordCheckComponentUi, LifecycleObserver {
private HelpAndFeedbackLauncher mHelpAndFeedbackLauncher;
private final PasswordCheckFragmentView mFragmentView;
private final SettingsLauncher mSettingsLauncher;
private final PasswordAccessReauthenticationHelper mReauthenticationHelper;
private final ReauthenticatorBridge mReauthenticatorBridge;
private final PasswordCheckMediator mMediator;
private PropertyModel mModel;
/**
* Blueprint for a class that handles interactions with credentials.
*/
interface CredentialEventHandler {
/**
* Edits the given Credential in the password store.
* @param credential A {@link CompromisedCredential} to be edited.
* @param context The context to launch the editing UI from.
*/
void onEdit(CompromisedCredential credential, Context context);
/**
* Removes the given Credential from the password store.
* @param credential A {@link CompromisedCredential} to be removed.
*/
void onRemove(CompromisedCredential credential);
/**
* View the given Credential.
* @param credential A {@link CompromisedCredential} to be viewed.
*/
void onView(CompromisedCredential credential);
/**
* Opens a password change form or home page of |credential|'s origin or an app.
* @param credential A {@link CompromisedCredential} to be changed.
*/
void onChangePasswordButtonClick(CompromisedCredential credential);
}
PasswordCheckCoordinator(PasswordCheckFragmentView fragmentView,
HelpAndFeedbackLauncher helpAndFeedbackLauncher, SettingsLauncher settingsLauncher,
PasswordCheckComponentUi.CustomTabIntentHelper customTabIntentHelper,
PasswordCheckComponentUi.TrustedIntentHelper trustedIntentHelper) {
mHelpAndFeedbackLauncher = helpAndFeedbackLauncher;
mFragmentView = fragmentView;
mSettingsLauncher = settingsLauncher;
// TODO(crbug.com/1101256): If help is part of the view, make mediator the delegate.
mFragmentView.setComponentDelegate(this);
// TODO(crbug.com/1178519): Ideally, the following replaces the lifecycle event forwarding.
// Figure out why it isn't working and use the following lifecycle observer once it does:
// mFragmentView.getLifecycle().addObserver(this);
mReauthenticationHelper = new PasswordAccessReauthenticationHelper(
mFragmentView.getActivity(), mFragmentView.getParentFragmentManager());
mReauthenticatorBridge =
new ReauthenticatorBridge(BiometricAuthRequester.PASSWORD_CHECK_AUTO_PWD_CHANGE);
PasswordCheckChangePasswordHelper changePasswordHelper =
new PasswordCheckChangePasswordHelper(mFragmentView.getActivity(),
mSettingsLauncher, customTabIntentHelper, trustedIntentHelper);
PasswordCheckIconHelper iconHelper = new PasswordCheckIconHelper(
new LargeIconBridge(Profile.getLastUsedRegularProfile()),
mFragmentView.getResources().getDimensionPixelSize(
org.chromium.chrome.browser.ui.favicon.R.dimen.default_favicon_size));
mMediator = new PasswordCheckMediator(changePasswordHelper, mReauthenticationHelper,
mReauthenticatorBridge, mSettingsLauncher, iconHelper);
}
private void launchCheckupInAccount() {
PasswordCheckFactory.getOrCreate(mSettingsLauncher)
.launchCheckupInAccount(mFragmentView.getActivity());
}
@Override
public void onStartFragment() {
// In the rare case of a restarted activity, don't recreate the model and mediator.
if (mModel == null) {
mModel = PasswordCheckProperties.createDefaultModel();
PasswordCheckCoordinator.setUpModelChangeProcessors(mModel, mFragmentView);
mMediator.initialize(mModel, PasswordCheckFactory.getOrCreate(mSettingsLauncher),
mFragmentView.getReferrer(), this::launchCheckupInAccount);
}
}
@Override
public void onResumeFragment() {
mMediator.onResumeFragment();
mReauthenticationHelper.onReauthenticationMaybeHappened();
}
@Override
public void onDestroyFragment() {
mMediator.stopCheck();
if (mFragmentView.getActivity() == null || mFragmentView.getActivity().isFinishing()) {
mMediator
.onUserLeavesCheckPage(); // Should be called only if the activity is finishing.
mMediator.destroy();
mModel = null;
}
}
// TODO(crbug.com/1101256): Move to view code.
@Override
public boolean handleHelp(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
mHelpAndFeedbackLauncher.show(mFragmentView.getActivity(),
mFragmentView.getActivity().getString(R.string.help_context_check_passwords),
Profile.getLastUsedRegularProfile(), null);
return true;
}
return false;
}
@Override
public void destroy() {
PasswordCheckFactory.destroy();
}
/**
* Connects the given model with the given view using Model Change Processors.
* @param model A {@link PropertyModel} built with {@link PasswordCheckProperties}.
* @param view A {@link PasswordCheckFragmentView}.
*/
@VisibleForTesting
static void setUpModelChangeProcessors(PropertyModel model, PasswordCheckFragmentView view) {
PropertyModelChangeProcessor.create(
model, view, PasswordCheckViewBinder::bindPasswordCheckView);
}
}
|
[
"[email protected]"
] | |
4bb647fc82b1ca3fbfadff7195742282ed22f234
|
e49ddf6e23535806c59ea175b2f7aa4f1fb7b585
|
/tags/release-5.4.1/mipav/src/gov/nih/mipav/model/algorithms/DiffusionTensorImaging/AlgorithmDTI2EGFA.java
|
6666f9b6e381e8b78632fb2be1db4d46a85f9cf3
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
svn2github/mipav
|
ebf07acb6096dff8c7eb4714cdfb7ba1dcace76f
|
eb76cf7dc633d10f92a62a595e4ba12a5023d922
|
refs/heads/master
| 2023-09-03T12:21:28.568695 | 2019-01-18T23:13:53 | 2019-01-18T23:13:53 | 130,295,718 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 17,807 |
java
|
package gov.nih.mipav.model.algorithms.DiffusionTensorImaging;
import gov.nih.mipav.model.algorithms.AlgorithmBase;
import gov.nih.mipav.model.file.FileInfoBase;
import gov.nih.mipav.model.structures.ModelImage;
import gov.nih.mipav.model.structures.ModelStorageBase;
import gov.nih.mipav.view.ViewJProgressBar;
import java.io.IOException;
import WildMagic.LibFoundation.Mathematics.Matrix3f;
import WildMagic.LibFoundation.Mathematics.Vector3f;
/**
* Algorithm requires input of a Diffusion Tensor Image to calculate an Apparent Diffusion Coefficient Image,
* Functional Anisotropy Image, Color Image, Eigen Value Image, Eigen Vector Image, Relative Anisotropy Image,
* Trace Image, and Volume Ratio Image
*
* This algorithm works in conjunction with AlgorithmDTITract to create the
* MIPAV DTI Fiber Tracking/ Statistics Dialog
*
* See: Introduction to Diffusion Tensor Imaging, by Susumu Mori
*/
public class AlgorithmDTI2EGFA extends AlgorithmBase
{
/** Input Diffusion Tensor Image: */
private ModelImage m_kDTI = null;
/** Output EigenVector Image: */
private ModelImage m_kEigenVectorImage = null;
/** Output EigenValue Image: */
private ModelImage m_kEigenValueImage = null;
/** Output Functional Anisotropy Image: */
private ModelImage m_kFAImage = null;
/** Output Trace (ADC) Image (before diagonalization of diffusion tensor): */
private ModelImage m_kADCImage = null;
/** Output Trace Image (before diagonalization of diffusion tensor): */
private ModelImage m_kTraceImage = null;
/** Output RA (Relative Anisotropy) Image: */
private ModelImage m_kRAImage = null;
/** Output VR (Volume Radio) Image: */
private ModelImage m_kVRImage = null;
/** Initialize the Algorithm with the input DTI Image:
* @param kDTI input DTI Image.
*/
public AlgorithmDTI2EGFA( ModelImage kDTI )
{
m_kDTI = kDTI;
}
/** Clean up memory. */
public void disposeLocal()
{
m_kDTI = null;
m_kEigenVectorImage = null;
m_kEigenValueImage = null;
m_kFAImage = null;
m_kADCImage = null;
m_kVRImage = null;
m_kTraceImage = null;
m_kRAImage = null;
System.gc();
}
/** Returns the Apparent Diffusion Coefficient Image.
* @return the Apparent Diffusion Coefficient Image.
*/
public ModelImage getADCImage()
{
return m_kADCImage;
}
/** Returns the Eigen Vector Image.
* @return the Eigen Vector Image.
*/
public ModelImage getEigenVectorImage()
{
return m_kEigenVectorImage;
}
/** Returns the Eigen Value Image.
* @return the Eigen Value Image.
*/
public ModelImage getEigenValueImage()
{
return m_kEigenValueImage;
}
/** Returns the Functional Anisotropy Image.
* @return the Functional Anisotropy Image.
*/
public ModelImage getFAImage()
{
return m_kFAImage;
}
/** Returns the Relative Anisotropy Image.
* @return the Relative Anisotropy Image.
*/
public ModelImage getRAImage()
{
return m_kRAImage;
}
/** Returns the Trace Image.
* @return the Trace Image.
*/
public ModelImage getTraceImage()
{
return m_kTraceImage;
}
/** Returns the Volume Ratio Image.
* @return the Volume Ratio Image.
*/
public ModelImage getVRImage()
{
return m_kVRImage;
}
/** Run the DTI -> EigenVector Functional Anisotropy algorithm. */
public void runAlgorithm()
{
if ( m_kDTI == null )
{
return;
}
calcEigenVectorFA();
}
/**
* Calculates the eigen vector data from the DTI.
*/
private void calcEigenVectorFA( )
{
if ( m_kDTI == null )
{
return;
}
int iLen = m_kDTI.getExtents()[0] * m_kDTI.getExtents()[1] * m_kDTI.getExtents()[2];
//int iZDim = m_kDTI.getExtents()[2];
int iSliceSize = m_kDTI.getExtents()[0] * m_kDTI.getExtents()[1];
float[] afData = new float[iLen];
float[] afTraceData = new float[iLen];
float[] afADCData = new float[iLen];
float[] afRAData = new float[iLen];
float[] afVRData = new float[iLen];
float[] afEigenValues = new float[iLen*4];
float[] afDataCM = new float[iLen*9];
float[] afTensorData = new float[6];
ViewJProgressBar kProgressBar = new ViewJProgressBar("Calculating Eigen Vectors ",
"Calculating Eigen Vectors...", 0, 100, true);
Matrix3f kMatrix = new Matrix3f();
Vector3f kV1 = new Vector3f();
Vector3f kV2 = new Vector3f();
Vector3f kV3 = new Vector3f();
Matrix3f kEigenValues = new Matrix3f();
for ( int i = 0; i < iLen; i++ )
{
boolean bAllZero = true;
for ( int j = 0; j < 6; j++ )
{
afTensorData[j] = m_kDTI.getFloat(i + j*iLen);
if ( afTensorData[j] == Float.NaN )
{
afTensorData[j] = 0;
}
if ( afTensorData[j] != 0 )
{
bAllZero = false;
}
}
if ( !bAllZero )
{
kMatrix.Set( afTensorData[0], afTensorData[3], afTensorData[4],
afTensorData[3], afTensorData[1], afTensorData[5],
afTensorData[4], afTensorData[5], afTensorData[2] );
afTraceData[i] = kMatrix.M00 + kMatrix.M11 + kMatrix.M22;
afADCData[i] = afTraceData[i]/3.0f;
if ( Matrix3f.EigenDecomposition( kMatrix, kEigenValues ) )
{
float fLambda1 = kEigenValues.M22;
float fLambda2 = kEigenValues.M11;
float fLambda3 = kEigenValues.M00;
afEigenValues[i*4 + 0] = 0;
afEigenValues[i*4 + 1] = fLambda1;
afEigenValues[i*4 + 2] = fLambda2;
afEigenValues[i*4 + 3] = fLambda3;
kMatrix.GetColumn(2,kV1);
kMatrix.GetColumn(1,kV2);
kMatrix.GetColumn(0,kV3);
afData[i] = (float)(Math.sqrt(1.0/2.0) *
( ( Math.sqrt( (fLambda1 - fLambda2)*(fLambda1 - fLambda2) +
(fLambda2 - fLambda3)*(fLambda2 - fLambda3) +
(fLambda3 - fLambda1)*(fLambda3 - fLambda1) ) ) /
( Math.sqrt( fLambda1*fLambda1 + fLambda2*fLambda2 + fLambda3*fLambda3 ) ) ) );
float fLambda = (fLambda1 + fLambda2 + fLambda3)/3.0f;
afRAData[i] = (float)(Math.sqrt((fLambda1 - fLambda)*(fLambda1 - fLambda) +
(fLambda2 - fLambda)*(fLambda2 - fLambda) +
(fLambda3 - fLambda)*(fLambda3 - fLambda) ) /
Math.sqrt( 3.0f * fLambda ));
afVRData[i] = (fLambda1*fLambda2*fLambda3)/(fLambda*fLambda*fLambda);
afDataCM[i + 0*iLen] = kV1.X;
afDataCM[i + 1*iLen] = kV1.Y;
afDataCM[i + 2*iLen] = kV1.Z;
afDataCM[i + 3*iLen] = -kV2.X;
afDataCM[i + 4*iLen] = -kV2.Y;
afDataCM[i + 5*iLen] = -kV2.Z;
afDataCM[i + 6*iLen] = kV3.X;
afDataCM[i + 7*iLen] = kV3.Y;
afDataCM[i + 8*iLen] = kV3.Z;
}
else
{
bAllZero = true;
}
}
if ( bAllZero )
{
afData[i] = 0;
afTraceData[i] = 0;
afRAData[i] = 0;
afVRData[i] = 0;
afEigenValues[i*4 + 0] = 0;
afEigenValues[i*4 + 1] = 0;
afEigenValues[i*4 + 2] = 0;
afEigenValues[i*4 + 3] = 0;
afDataCM[i + 0*iLen] = 0;
afDataCM[i + 1*iLen] = 0;
afDataCM[i + 2*iLen] = 0;
afDataCM[i + 3*iLen] = 0;
afDataCM[i + 4*iLen] = 0;
afDataCM[i + 5*iLen] = 0;
afDataCM[i + 6*iLen] = 0;
afDataCM[i + 7*iLen] = 0;
afDataCM[i + 8*iLen] = 0;
}
if ( (i%iSliceSize) == 0 )
{
int iValue = (int)(100 * (float)(i+1)/iLen);
kProgressBar.updateValueImmed( iValue );
}
}
kMatrix = null;
kV1 = null;
kV2 = null;
kV3 = null;
kEigenValues = null;
kProgressBar.dispose();
kProgressBar = null;
int[] extentsEV = new int[]{m_kDTI.getExtents()[0], m_kDTI.getExtents()[1], m_kDTI.getExtents()[2], 9};
int[] extentsA = new int[]{m_kDTI.getExtents()[0], m_kDTI.getExtents()[1], m_kDTI.getExtents()[2]};
/** Fractional Anisotropy Image */
m_kFAImage = new ModelImage( ModelStorageBase.FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "FA") );
try {
m_kFAImage.importData(0, afData, true);
} catch (IOException e) {
m_kFAImage.disposeLocal();
m_kFAImage = null;
}
if ( m_kFAImage != null )
{
//new ViewJFrameImage(m_kFAImage, null, new Dimension(610, 200), false);
m_kFAImage.setExtents(extentsA);
m_kFAImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kFAImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** Trace Image */
m_kTraceImage = new ModelImage( ModelStorageBase.FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "Trace") );
try {
m_kTraceImage.importData(0, afTraceData, true);
} catch (IOException e) {
m_kTraceImage.disposeLocal();
m_kTraceImage = null;
}
if ( m_kTraceImage != null )
{
//new ViewJFrameImage(m_kTraceImage, null, new Dimension(610, 200), false);
m_kTraceImage.setExtents(extentsA);
m_kTraceImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kTraceImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** RA Image */
m_kRAImage = new ModelImage( ModelStorageBase.FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "RA") );
try {
m_kRAImage.importData(0, afRAData, true);
} catch (IOException e) {
m_kRAImage.disposeLocal();
m_kRAImage = null;
}
if ( m_kRAImage != null )
{
//new ViewJFrameImage(m_kRAImage, null, new Dimension(610, 200), false);
m_kRAImage.setExtents(extentsA);
m_kRAImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kRAImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** Volume Ratio Image */
m_kVRImage = new ModelImage( ModelStorageBase.FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "VR") );
try {
m_kVRImage.importData(0, afVRData, true);
} catch (IOException e) {
m_kVRImage.disposeLocal();
m_kVRImage = null;
}
if ( m_kVRImage != null )
{
//new ViewJFrameImage(m_kVRImage, null, new Dimension(610, 200), false);
m_kVRImage.setExtents(extentsA);
m_kVRImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kVRImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** ADC Image */
m_kADCImage = new ModelImage( ModelStorageBase.FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "ADC") );
try {
m_kADCImage.importData(0, afADCData, true);
} catch (IOException e) {
m_kADCImage.disposeLocal();
m_kADCImage = null;
}
if ( m_kADCImage != null )
{
//new ViewJFrameImage(m_kADCImage, null, new Dimension(610, 200), false);
m_kADCImage.setExtents(extentsA);
m_kADCImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kADCImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** Eigen Vector Image */
m_kEigenVectorImage = new ModelImage( ModelStorageBase.FLOAT,
extentsEV,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "EG") );
try {
m_kEigenVectorImage.importData(0, afDataCM, true);
} catch (IOException e) {
m_kEigenVectorImage.disposeLocal();
m_kEigenVectorImage = null;
}
if ( m_kEigenVectorImage != null )
{
//new ViewJFrameImage(m_kEigenVectorImage, null, new Dimension(610, 200), false);
m_kEigenVectorImage.setExtents(extentsEV);
m_kEigenVectorImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kEigenVectorImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsEV);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
}
else
{
System.err.println( "null" );
}
/** Eigen Value Image */
m_kEigenValueImage = new ModelImage( ModelStorageBase.ARGB_FLOAT,
extentsA,
ModelImage.makeImageName( m_kDTI.getFileInfo(0).getFileName(), "EV") );
try {
m_kEigenValueImage.importData(0, afEigenValues, true);
} catch (IOException e) {
m_kEigenValueImage.disposeLocal();
m_kEigenValueImage = null;
}
if ( m_kEigenValueImage != null )
{
// looks good...
m_kEigenValueImage.setExtents(extentsA);
m_kEigenValueImage.copyFileTypeInfo(m_kDTI);
//copy core file info over
FileInfoBase[] fileInfoBases = m_kEigenValueImage.getFileInfo();
for (int i=0;i<fileInfoBases.length;i++) {
fileInfoBases[i].setExtents(extentsA);
fileInfoBases[i].setFileDirectory( m_kDTI.getFileInfo(0).getFileDirectory());
}
//new ViewJFrameImage(m_kEigenValueImage, null, new Dimension(610, 200), false);
}
else
{
System.err.println( "null" );
}
extentsEV = null;
extentsA = null;
afData = null;
afTraceData = null;
afADCData = null;
afVRData = null;
afRAData = null;
afDataCM = null;
afTensorData = null;
}
}
|
[
"[email protected]@ba61647d-9d00-f842-95cd-605cb4296b96"
] |
[email protected]@ba61647d-9d00-f842-95cd-605cb4296b96
|
2332cd9c10ae0db03f45d36477a9b9688b4551d6
|
746572ba552f7d52e8b5a0e752a1d6eb899842b9
|
/JDK8Source/src/main/java/com/sun/org/apache/xml/internal/serialize/HTMLSerializer.java
|
6263af8ceb63b23c8a86141f4c07de1a4c82ba1c
|
[] |
no_license
|
lobinary/Lobinary
|
fde035d3ce6780a20a5a808b5d4357604ed70054
|
8de466228bf893b72c7771e153607674b6024709
|
refs/heads/master
| 2022-02-27T05:02:04.208763 | 2022-01-20T07:01:28 | 2022-01-20T07:01:28 | 26,812,634 | 7 | 5 | null | null | null | null |
UTF-8
|
Java
| false | false | 37,956 |
java
|
/***** Lobxxx Translate Finished ******/
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.
* <p>
* 版权所有1999-2004 Apache软件基金会。
*
* 根据Apache许可证2.0版("许可证")授权;您不能使用此文件,除非符合许可证。您可以通过获取许可证的副本
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 除非适用法律要求或书面同意,否则根据许可证分发的软件按"原样"分发,不附带任何明示或暗示的担保或条件。请参阅管理许可证下的权限和限制的特定语言的许可证。
*
*/
// Sep 14, 2000:
// Fixed serializer to report IO exception directly, instead at
// the end of document processing.
// Reported by Patrick Higgins <[email protected]>
// Aug 21, 2000:
// Fixed bug in startDocument not calling prepare.
// Reported by Mikael Staldal <[email protected]>
// Aug 21, 2000:
// Added ability to omit DOCTYPE declaration.
// Sep 1, 2000:
// If no output format is provided the serializer now defaults
// to ISO-8859-1 encoding. Reported by Mikael Staldal
// <[email protected]>
package com.sun.org.apache.xml.internal.serialize;
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Enumeration;
import java.util.Locale;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.xml.sax.AttributeList;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
/**
* Implements an HTML/XHTML serializer supporting both DOM and SAX
* pretty serializing. HTML/XHTML mode is determined in the
* constructor. For usage instructions see {@link Serializer}.
* <p>
* If an output stream is used, the encoding is taken from the
* output format (defaults to <tt>UTF-8</tt>). If a writer is
* used, make sure the writer uses the same encoding (if applies)
* as specified in the output format.
* <p>
* The serializer supports both DOM and SAX. DOM serializing is done
* by calling {@link #serialize} and SAX serializing is done by firing
* SAX events and using the serializer as a document handler.
* <p>
* If an I/O exception occurs while serializing, the serializer
* will not throw an exception directly, but only throw it
* at the end of serializing (either DOM or SAX's {@link
* org.xml.sax.DocumentHandler#endDocument}.
* <p>
* For elements that are not specified as whitespace preserving,
* the serializer will potentially break long text lines at space
* boundaries, indent lines, and serialize elements on separate
* lines. Line terminators will be regarded as spaces, and
* spaces at beginning of line will be stripped.
* <p>
* XHTML is slightly different than HTML:
* <ul>
* <li>Element/attribute names are lower case and case matters
* <li>Attributes must specify value, even if empty string
* <li>Empty elements must have '/' in empty tag
* <li>Contents of SCRIPT and STYLE elements serialized as CDATA
* </ul>
*
* <p>
* 实现支持DOM和SAX漂亮序列化的HTML / XHTML序列化程序。 HTML / XHTML模式在构造函数中确定。有关使用说明,请参阅{@link Serializer}。
* <p>
* 如果使用输出流,则从输出格式(默认为<tt> UTF-8 </tt>)获取编码。如果使用写入程序,请确保写入程序使用与输出格式中指定的相同的编码(如果适用)。
* <p>
* 序列化器支持DOM和SAX。 DOM序列化通过调用{@link #serialize}完成,SAX序列化通过触发SAX事件并使用序列化程序作为文档处理程序来完成。
* <p>
* 如果在序列化时发生I / O异常,则序列化器不会直接抛出异常,而只是在序列化结束时抛出异常(DOM或SAX的{@link org.xml.sax.DocumentHandler#endDocument}
* 。
* <p>
* 对于未指定为空白保留的元素,序列化程序可能会在空格边界,缩进行和序列化元素在单独的行上断开长文本行。行终止符将被视为空格,行开始处的空格将被删除。
* <p>
* XHTML与HTML稍有不同:
* <ul>
* <li>元素/属性名称是小写和大小写<li>属性必须指定值,即使是空字符串<li>空元素在空标签中必须有"/"<li> SCRIPT和STYLE元素的内容序列化为CDATA
* </ul>
*
*
* @deprecated This class was deprecated in Xerces 2.6.2. It is
* recommended that new applications use JAXP's Transformation API
* for XML (TrAX) for serializing HTML. See the Xerces documentation
* for more information.
* @author <a href="mailto:[email protected]">Assaf Arkin</a>
* @see Serializer
*/
public class HTMLSerializer
extends BaseMarkupSerializer
{
/**
* True if serializing in XHTML format.
* <p>
* 如果以XHTML格式序列化,则为True。
*
*/
private boolean _xhtml;
public static final String XHTMLNamespace = "http://www.w3.org/1999/xhtml";
// for users to override XHTMLNamespace if need be.
private String fUserXHTMLNamespace = null;
/**
* Constructs a new HTML/XHTML serializer depending on the value of
* <tt>xhtml</tt>. The serializer cannot be used without calling
* {@link #setOutputCharStream} or {@link #setOutputByteStream} first.
*
* <p>
* 根据<tt> xhtml </tt>的值构造新的HTML / XHTML序列化程序。
* 不调用{@link #setOutputCharStream}或{@link #setOutputByteStream}时,不能使用序列化器。
*
*
* @param xhtml True if XHTML serializing
*/
protected HTMLSerializer( boolean xhtml, OutputFormat format )
{
super( format );
_xhtml = xhtml;
}
/**
* Constructs a new serializer. The serializer cannot be used without
* calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
* first.
* <p>
* 构造新的序列化程序。不调用{@link #setOutputCharStream}或{@link #setOutputByteStream}时,不能使用序列化器。
*
*/
public HTMLSerializer()
{
this( false, new OutputFormat( Method.HTML, "ISO-8859-1", false ) );
}
/**
* Constructs a new serializer. The serializer cannot be used without
* calling {@link #setOutputCharStream} or {@link #setOutputByteStream}
* first.
* <p>
* 构造新的序列化程序。不调用{@link #setOutputCharStream}或{@link #setOutputByteStream}时,不能使用序列化器。
*
*/
public HTMLSerializer( OutputFormat format )
{
this( false, format != null ? format : new OutputFormat( Method.HTML, "ISO-8859-1", false ) );
}
/**
* Constructs a new serializer that writes to the specified writer
* using the specified output format. If <tt>format</tt> is null,
* will use a default output format.
*
* <p>
* 构造使用指定的输出格式写入指定的写入程序的新序列化程序。如果<tt>格式</tt>为空,将使用默认输出格式。
*
*
* @param writer The writer to use
* @param format The output format to use, null for the default
*/
public HTMLSerializer( Writer writer, OutputFormat format )
{
this( false, format != null ? format : new OutputFormat( Method.HTML, "ISO-8859-1", false ) );
setOutputCharStream( writer );
}
/**
* Constructs a new serializer that writes to the specified output
* stream using the specified output format. If <tt>format</tt>
* is null, will use a default output format.
*
* <p>
* 构造新的序列化器,使用指定的输出格式写入指定的输出流。如果<tt>格式</tt>为空,将使用默认输出格式。
*
*
* @param output The output stream to use
* @param format The output format to use, null for the default
*/
public HTMLSerializer( OutputStream output, OutputFormat format )
{
this( false, format != null ? format : new OutputFormat( Method.HTML, "ISO-8859-1", false ) );
setOutputByteStream( output );
}
public void setOutputFormat( OutputFormat format )
{
super.setOutputFormat( format != null ? format : new OutputFormat( Method.HTML, "ISO-8859-1", false ) );
}
// Set value for alternate XHTML namespace.
public void setXHTMLNamespace(String newNamespace) {
fUserXHTMLNamespace = newNamespace;
} // setXHTMLNamespace(String)
//-----------------------------------------//
// SAX content handler serializing methods //
//-----------------------------------------//
public void startElement( String namespaceURI, String localName,
String rawName, Attributes attrs )
throws SAXException
{
int i;
boolean preserveSpace;
ElementState state;
String name;
String value;
String htmlName;
boolean addNSAttr = false;
try {
if ( _printer == null )
throw new IllegalStateException(
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"NoWriterSupplied", null));
state = getElementState();
if ( isDocumentState() ) {
// If this is the root element handle it differently.
// If the first root element in the document, serialize
// the document's DOCTYPE. Space preserving defaults
// to that of the output format.
if ( ! _started )
startDocument( (localName == null || localName.length() == 0)
? rawName : localName );
} else {
// For any other element, if first in parent, then
// close parent's opening tag and use the parnet's
// space preserving.
if ( state.empty )
_printer.printText( '>' );
// Indent this element on a new line if the first
// content of the parent element or immediately
// following an element.
if ( _indenting && ! state.preserveSpace &&
( state.empty || state.afterElement ) )
_printer.breakLine();
}
preserveSpace = state.preserveSpace;
// Do not change the current element state yet.
// This only happens in endElement().
// As per SAX2, the namespace URI is an empty string if the element has no
// namespace URI, or namespaces is turned off. The check against null protects
// against broken SAX implementations, so I've left it there. - mrglavas
boolean hasNamespaceURI = (namespaceURI != null && namespaceURI.length() != 0);
// SAX2: rawName (QName) could be empty string if
// namespace-prefixes property is false.
if ( rawName == null || rawName.length() == 0) {
rawName = localName;
if ( hasNamespaceURI ) {
String prefix;
prefix = getPrefix( namespaceURI );
if ( prefix != null && prefix.length() != 0 )
rawName = prefix + ":" + localName;
}
addNSAttr = true;
}
if ( !hasNamespaceURI )
htmlName = rawName;
else {
if ( namespaceURI.equals( XHTMLNamespace ) ||
(fUserXHTMLNamespace != null && fUserXHTMLNamespace.equals(namespaceURI)) )
htmlName = localName;
else
htmlName = null;
}
// XHTML: element names are lower case, DOM will be different
_printer.printText( '<' );
if ( _xhtml )
_printer.printText( rawName.toLowerCase(Locale.ENGLISH) );
else
_printer.printText( rawName );
_printer.indent();
// For each attribute serialize it's name and value as one part,
// separated with a space so the element can be broken on
// multiple lines.
if ( attrs != null ) {
for ( i = 0 ; i < attrs.getLength() ; ++i ) {
_printer.printSpace();
name = attrs.getQName( i ).toLowerCase(Locale.ENGLISH);
value = attrs.getValue( i );
if ( _xhtml || hasNamespaceURI ) {
// XHTML: print empty string for null values.
if ( value == null ) {
_printer.printText( name );
_printer.printText( "=\"\"" );
} else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
} else {
// HTML: Empty values print as attribute name, no value.
// HTML: URI attributes will print unescaped
if ( value == null ) {
value = "";
}
if ( !_format.getPreserveEmptyAttributes() && value.length() == 0 )
_printer.printText( name );
else if ( HTMLdtd.isURI( rawName, name ) ) {
_printer.printText( name );
_printer.printText( "=\"" );
_printer.printText( escapeURI( value ) );
_printer.printText( '"' );
} else if ( HTMLdtd.isBoolean( rawName, name ) )
_printer.printText( name );
else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
}
}
}
if ( htmlName != null && HTMLdtd.isPreserveSpace( htmlName ) )
preserveSpace = true;
if ( addNSAttr ) {
Enumeration keys;
keys = _prefixes.keys();
while ( keys.hasMoreElements() ) {
_printer.printSpace();
value = (String) keys.nextElement();
name = (String) _prefixes.get( value );
if ( name.length() == 0 ) {
_printer.printText( "xmlns=\"" );
printEscaped( value );
_printer.printText( '"' );
} else {
_printer.printText( "xmlns:" );
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
}
}
// Now it's time to enter a new element state
// with the tag name and space preserving.
// We still do not change the curent element state.
state = enterElementState( namespaceURI, localName, rawName, preserveSpace );
// Prevents line breaks inside A/TD
if ( htmlName != null && ( htmlName.equalsIgnoreCase( "A" ) ||
htmlName.equalsIgnoreCase( "TD" ) ) ) {
state.empty = false;
_printer.printText( '>' );
}
// Handle SCRIPT and STYLE specifically by changing the
// state of the current element to CDATA (XHTML) or
// unescaped (HTML).
if ( htmlName != null && ( rawName.equalsIgnoreCase( "SCRIPT" ) ||
rawName.equalsIgnoreCase( "STYLE" ) ) ) {
if ( _xhtml ) {
// XHTML: Print contents as CDATA section
state.doCData = true;
} else {
// HTML: Print contents unescaped
state.unescaped = true;
}
}
} catch ( IOException except ) {
throw new SAXException( except );
}
}
public void endElement( String namespaceURI, String localName,
String rawName )
throws SAXException
{
try {
endElementIO( namespaceURI, localName, rawName );
} catch ( IOException except ) {
throw new SAXException( except );
}
}
public void endElementIO( String namespaceURI, String localName,
String rawName )
throws IOException
{
ElementState state;
String htmlName;
// Works much like content() with additions for closing
// an element. Note the different checks for the closed
// element's state and the parent element's state.
_printer.unindent();
state = getElementState();
if ( state.namespaceURI == null || state.namespaceURI.length() == 0 )
htmlName = state.rawName;
else {
if ( state.namespaceURI.equals( XHTMLNamespace ) ||
(fUserXHTMLNamespace != null && fUserXHTMLNamespace.equals(state.namespaceURI)) )
htmlName = state.localName;
else
htmlName = null;
}
if ( _xhtml) {
if ( state.empty ) {
_printer.printText( " />" );
} else {
// Must leave CData section first
if ( state.inCData )
_printer.printText( "]]>" );
// XHTML: element names are lower case, DOM will be different
_printer.printText( "</" );
_printer.printText( state.rawName.toLowerCase(Locale.ENGLISH) );
_printer.printText( '>' );
}
} else {
if ( state.empty )
_printer.printText( '>' );
// This element is not empty and that last content was
// another element, so print a line break before that
// last element and this element's closing tag.
// [keith] Provided this is not an anchor.
// HTML: some elements do not print closing tag (e.g. LI)
if ( htmlName == null || ! HTMLdtd.isOnlyOpening( htmlName ) ) {
if ( _indenting && ! state.preserveSpace && state.afterElement )
_printer.breakLine();
// Must leave CData section first (Illegal in HTML, but still)
if ( state.inCData )
_printer.printText( "]]>" );
_printer.printText( "</" );
_printer.printText( state.rawName );
_printer.printText( '>' );
}
}
// Leave the element state and update that of the parent
// (if we're not root) to not empty and after element.
state = leaveElementState();
// Temporary hack to prevent line breaks inside A/TD
if ( htmlName == null || ( ! htmlName.equalsIgnoreCase( "A" ) &&
! htmlName.equalsIgnoreCase( "TD" ) ) )
state.afterElement = true;
state.empty = false;
if ( isDocumentState() )
_printer.flush();
}
//------------------------------------------//
// SAX document handler serializing methods //
//------------------------------------------//
public void characters( char[] chars, int start, int length )
throws SAXException
{
ElementState state;
try {
// HTML: no CDATA section
state = content();
state.doCData = false;
super.characters( chars, start, length );
} catch ( IOException except ) {
throw new SAXException( except );
}
}
public void startElement( String tagName, AttributeList attrs )
throws SAXException
{
int i;
boolean preserveSpace;
ElementState state;
String name;
String value;
try {
if ( _printer == null )
throw new IllegalStateException(
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"NoWriterSupplied", null));
state = getElementState();
if ( isDocumentState() ) {
// If this is the root element handle it differently.
// If the first root element in the document, serialize
// the document's DOCTYPE. Space preserving defaults
// to that of the output format.
if ( ! _started )
startDocument( tagName );
} else {
// For any other element, if first in parent, then
// close parent's opening tag and use the parnet's
// space preserving.
if ( state.empty )
_printer.printText( '>' );
// Indent this element on a new line if the first
// content of the parent element or immediately
// following an element.
if ( _indenting && ! state.preserveSpace &&
( state.empty || state.afterElement ) )
_printer.breakLine();
}
preserveSpace = state.preserveSpace;
// Do not change the current element state yet.
// This only happens in endElement().
// XHTML: element names are lower case, DOM will be different
_printer.printText( '<' );
if ( _xhtml )
_printer.printText( tagName.toLowerCase(Locale.ENGLISH) );
else
_printer.printText( tagName );
_printer.indent();
// For each attribute serialize it's name and value as one part,
// separated with a space so the element can be broken on
// multiple lines.
if ( attrs != null ) {
for ( i = 0 ; i < attrs.getLength() ; ++i ) {
_printer.printSpace();
name = attrs.getName( i ).toLowerCase(Locale.ENGLISH);
value = attrs.getValue( i );
if ( _xhtml ) {
// XHTML: print empty string for null values.
if ( value == null ) {
_printer.printText( name );
_printer.printText( "=\"\"" );
} else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
} else {
// HTML: Empty values print as attribute name, no value.
// HTML: URI attributes will print unescaped
if ( value == null ) {
value = "";
}
if ( !_format.getPreserveEmptyAttributes() && value.length() == 0 )
_printer.printText( name );
else if ( HTMLdtd.isURI( tagName, name ) ) {
_printer.printText( name );
_printer.printText( "=\"" );
_printer.printText( escapeURI( value ) );
_printer.printText( '"' );
} else if ( HTMLdtd.isBoolean( tagName, name ) )
_printer.printText( name );
else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
}
}
}
if ( HTMLdtd.isPreserveSpace( tagName ) )
preserveSpace = true;
// Now it's time to enter a new element state
// with the tag name and space preserving.
// We still do not change the curent element state.
state = enterElementState( null, null, tagName, preserveSpace );
// Prevents line breaks inside A/TD
if ( tagName.equalsIgnoreCase( "A" ) || tagName.equalsIgnoreCase( "TD" ) ) {
state.empty = false;
_printer.printText( '>' );
}
// Handle SCRIPT and STYLE specifically by changing the
// state of the current element to CDATA (XHTML) or
// unescaped (HTML).
if ( tagName.equalsIgnoreCase( "SCRIPT" ) ||
tagName.equalsIgnoreCase( "STYLE" ) ) {
if ( _xhtml ) {
// XHTML: Print contents as CDATA section
state.doCData = true;
} else {
// HTML: Print contents unescaped
state.unescaped = true;
}
}
} catch ( IOException except ) {
throw new SAXException( except );
}
}
public void endElement( String tagName )
throws SAXException
{
endElement( null, null, tagName );
}
//------------------------------------------//
// Generic node serializing methods methods //
//------------------------------------------//
/**
* Called to serialize the document's DOCTYPE by the root element.
* The document type declaration must name the root element,
* but the root element is only known when that element is serialized,
* and not at the start of the document.
* <p>
* This method will check if it has not been called before ({@link #_started}),
* will serialize the document type declaration, and will serialize all
* pre-root comments and PIs that were accumulated in the document
* (see {@link #serializePreRoot}). Pre-root will be serialized even if
* this is not the first root element of the document.
* <p>
* 调用通过根元素序列化文档的DOCTYPE。文档类型声明必须命名根元素,但是根元素只有当该元素被序列化时才知道,而不是在文档的开头。
* <p>
* 此方法将检查它是否尚未被调用({@link #_started}),将序列化文档类型声明,并将序列化所有在根文档中累积的注释和PI(参见{@link #serializePreRoot })。
* 预根将被序列化,即使这不是文档的第一个根元素。
*/
protected void startDocument( String rootTagName )
throws IOException
{
StringBuffer buffer;
// Not supported in HTML/XHTML, but we still have to switch
// out of DTD mode.
_printer.leaveDTD();
if ( ! _started ) {
// If the public and system identifiers were not specified
// in the output format, use the appropriate ones for HTML
// or XHTML.
if ( _docTypePublicId == null && _docTypeSystemId == null ) {
if ( _xhtml ) {
_docTypePublicId = HTMLdtd.XHTMLPublicId;
_docTypeSystemId = HTMLdtd.XHTMLSystemId;
} else {
_docTypePublicId = HTMLdtd.HTMLPublicId;
_docTypeSystemId = HTMLdtd.HTMLSystemId;
}
}
if ( ! _format.getOmitDocumentType() ) {
// XHTML: If public identifier and system identifier
// specified, print them, else print just system identifier
// HTML: If public identifier specified, print it with
// system identifier, if specified.
// XHTML requires that all element names are lower case, so the
// root on the DOCTYPE must be 'html'. - mrglavas
if ( _docTypePublicId != null && ( ! _xhtml || _docTypeSystemId != null ) ) {
if (_xhtml) {
_printer.printText( "<!DOCTYPE html PUBLIC " );
}
else {
_printer.printText( "<!DOCTYPE HTML PUBLIC " );
}
printDoctypeURL( _docTypePublicId );
if ( _docTypeSystemId != null ) {
if ( _indenting ) {
_printer.breakLine();
_printer.printText( " " );
} else
_printer.printText( ' ' );
printDoctypeURL( _docTypeSystemId );
}
_printer.printText( '>' );
_printer.breakLine();
} else if ( _docTypeSystemId != null ) {
if (_xhtml) {
_printer.printText( "<!DOCTYPE html SYSTEM " );
}
else {
_printer.printText( "<!DOCTYPE HTML SYSTEM " );
}
printDoctypeURL( _docTypeSystemId );
_printer.printText( '>' );
_printer.breakLine();
}
}
}
_started = true;
// Always serialize these, even if not te first root element.
serializePreRoot();
}
/**
* Called to serialize a DOM element. Equivalent to calling {@link
* #startElement}, {@link #endElement} and serializing everything
* inbetween, but better optimized.
* <p>
*
*/
protected void serializeElement( Element elem )
throws IOException
{
Attr attr;
NamedNodeMap attrMap;
int i;
Node child;
ElementState state;
boolean preserveSpace;
String name;
String value;
String tagName;
tagName = elem.getTagName();
state = getElementState();
if ( isDocumentState() ) {
// If this is the root element handle it differently.
// If the first root element in the document, serialize
// the document's DOCTYPE. Space preserving defaults
// to that of the output format.
if ( ! _started )
startDocument( tagName );
} else {
// For any other element, if first in parent, then
// close parent's opening tag and use the parnet's
// space preserving.
if ( state.empty )
_printer.printText( '>' );
// Indent this element on a new line if the first
// content of the parent element or immediately
// following an element.
if ( _indenting && ! state.preserveSpace &&
( state.empty || state.afterElement ) )
_printer.breakLine();
}
preserveSpace = state.preserveSpace;
// Do not change the current element state yet.
// This only happens in endElement().
// XHTML: element names are lower case, DOM will be different
_printer.printText( '<' );
if ( _xhtml )
_printer.printText( tagName.toLowerCase(Locale.ENGLISH) );
else
_printer.printText( tagName );
_printer.indent();
// Lookup the element's attribute, but only print specified
// attributes. (Unspecified attributes are derived from the DTD.
// For each attribute print it's name and value as one part,
// separated with a space so the element can be broken on
// multiple lines.
attrMap = elem.getAttributes();
if ( attrMap != null ) {
for ( i = 0 ; i < attrMap.getLength() ; ++i ) {
attr = (Attr) attrMap.item( i );
name = attr.getName().toLowerCase(Locale.ENGLISH);
value = attr.getValue();
if ( attr.getSpecified() ) {
_printer.printSpace();
if ( _xhtml ) {
// XHTML: print empty string for null values.
if ( value == null ) {
_printer.printText( name );
_printer.printText( "=\"\"" );
} else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
} else {
// HTML: Empty values print as attribute name, no value.
// HTML: URI attributes will print unescaped
if ( value == null ) {
value = "";
}
if ( !_format.getPreserveEmptyAttributes() && value.length() == 0 )
_printer.printText( name );
else if ( HTMLdtd.isURI( tagName, name ) ) {
_printer.printText( name );
_printer.printText( "=\"" );
_printer.printText( escapeURI( value ) );
_printer.printText( '"' );
} else if ( HTMLdtd.isBoolean( tagName, name ) )
_printer.printText( name );
else {
_printer.printText( name );
_printer.printText( "=\"" );
printEscaped( value );
_printer.printText( '"' );
}
}
}
}
}
if ( HTMLdtd.isPreserveSpace( tagName ) )
preserveSpace = true;
// If element has children, or if element is not an empty tag,
// serialize an opening tag.
if ( elem.hasChildNodes() || ! HTMLdtd.isEmptyTag( tagName ) ) {
// Enter an element state, and serialize the children
// one by one. Finally, end the element.
state = enterElementState( null, null, tagName, preserveSpace );
// Prevents line breaks inside A/TD
if ( tagName.equalsIgnoreCase( "A" ) || tagName.equalsIgnoreCase( "TD" ) ) {
state.empty = false;
_printer.printText( '>' );
}
// Handle SCRIPT and STYLE specifically by changing the
// state of the current element to CDATA (XHTML) or
// unescaped (HTML).
if ( tagName.equalsIgnoreCase( "SCRIPT" ) ||
tagName.equalsIgnoreCase( "STYLE" ) ) {
if ( _xhtml ) {
// XHTML: Print contents as CDATA section
state.doCData = true;
} else {
// HTML: Print contents unescaped
state.unescaped = true;
}
}
child = elem.getFirstChild();
while ( child != null ) {
serializeNode( child );
child = child.getNextSibling();
}
endElementIO( null, null, tagName );
} else {
_printer.unindent();
// XHTML: Close empty tag with ' />' so it's XML and HTML compatible.
// HTML: Empty tags are defined as such in DTD no in document.
if ( _xhtml )
_printer.printText( " />" );
else
_printer.printText( '>' );
// After element but parent element is no longer empty.
state.afterElement = true;
state.empty = false;
if ( isDocumentState() )
_printer.flush();
}
}
protected void characters( String text )
throws IOException
{
ElementState state;
// HTML: no CDATA section
state = content();
super.characters( text );
}
protected String getEntityRef( int ch )
{
return HTMLdtd.fromChar( ch );
}
protected String escapeURI( String uri )
{
int index;
// XXX Apparently Netscape doesn't like if we escape the URI
// using %nn, so we leave it as is, just remove any quotes.
index = uri.indexOf( "\"" );
if ( index >= 0 )
return uri.substring( 0, index );
else
return uri;
}
}
|
[
"[email protected]"
] | |
3a6113c17ea96cd1f56e383a79db46c64bd42d91
|
1a6df756d072bd424a5b7e3dac521e758ee0f49f
|
/Problem.java
|
caba626c526006283fe04598cd14e2b809cc9037
|
[] |
no_license
|
navjotvirk/Algorithms
|
7f6dada13774116625fa946ab4c67c1cc3a85c00
|
3568e1b1a3fb8da6dcb97b2d1a600de03d175df3
|
refs/heads/master
| 2020-12-31T00:30:08.126907 | 2017-03-28T23:27:58 | 2017-03-28T23:27:58 | 86,517,026 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,691 |
java
|
package knapsack;
import java.util.Random;
import java.util.Scanner;
/**
* Knapsack Problems consist of a knapsack capacity,
* and a list of Items that can possibly be included in the knapsack,
* each with a weight and value.
*
*/
public class Problem {
/**
* Capacity of knapsack in Problem
*/
int capacity;
/**
* Total number of Items to try to fit into knapsack
*/
int totalItems;
/**
* Items to try to fit into knapsack
*/
Item[] items;
/**
*
* Creates a new knapsack Problem whose parameters will be read from the Scanner.
* <br>Input format consists of non-negative integers separated by white space as follows:
* <ul>
* <li>First positive integer specifies the knapsack capacity
* <li>Next positive integer specifies the number of items n
* <li>Next 2Xn integers specify the items, one by one,
* listing the weight and value of each item.
* </ul>
* Incorrect knapsack information will simply be skipped.
* @param in Scanner used to read knapsack problem description
*/
Problem(Scanner in) {
// Read knapsack capacity
capacity = in.nextInt();
while (capacity<0) {
System.out.println("Error: knapsack capacity must be on-negative");
capacity = in.nextInt();
}
// Get total number of items
totalItems = in.nextInt();
while (totalItems < 0) {
System.out.println("Error: number of items must be non-negative");
totalItems = in.nextInt();
return;
}
items = new Item[totalItems];
// Read weights and values
for (int i=0; i<totalItems; i++)
items[i] = new Item(in);
}
/**
* Creates a randomly generated knapsack Problem according to specifications.
* or a trivial Problem (zero capacity or no totalItems) if the specifications are faulty.
* @param capacity Capacity of knapsack
* @param totalItems Total number of Items to try to fit in knapsack
*/
Problem( int capacity, int totalItems) {
if (capacity < 0) {
System.out.println("Error: knapsack capacity must be non-negative");
this.capacity = 0;
}
else
this.capacity = capacity;
if (totalItems<0) {
System.out.println("Error: number of items must be non-negative");
this.totalItems = 0;
}
else
this.totalItems = totalItems;
if (this.totalItems == 0) return;
// Create arrays based on number of totalItems
this.items = new Item[this.totalItems];
// Create weights randomly
Random rand = new Random();
int randmax = capacity;
for (int i=0; i<this.totalItems; i++) {
this.items[i] = new Item(rand,randmax);
}
}
/**
* Returns a string describing the Problem
* @return Description of Problem
*/
@Override
public String toString() {
String result = "Problem: try to fit " + totalItems + " items:\n";
for (int i=0; i<totalItems; i++)
result += "- " + items[i]+"\n";
result += "into knapsack of capacity " + capacity;
return result;
}
/**
* Returns the Solution to the knapsack Problem
* @return Solution for knapsack Problem
*/
public Solution solve() {
return bestFit(capacity, totalItems-1);
}
/**
* Finds best combination of items 0 to n that fits in capacity
* @param capacity Remaining capacity of knapsack
* @param n Index of new Item to be fitted into knapsack (or not)
* @return Solution which maximises the value of the knapsack
*/
private Solution bestFit(int capacity, int n) {
if (n == 0) {
Solution result = new Solution(this.capacity,totalItems);
if (items[0].getWeight() <= capacity)
result.add(0,items[0]);
return result;
}
int weightn = items[n].getWeight();
if (weightn > capacity)
return bestFit(capacity, n-1);
Solution included = bestFit(capacity-weightn, n-1).add(n, items[n]);
Solution excluded = bestFit(capacity,n-1);
if (excluded.getWorth() >= included.getWorth())
return excluded;
else
return included;
}
}
|
[
"[email protected]"
] | |
ba78f972ce7d49c2cf63cd82a1e3b1fdc51a87b4
|
04f1a14a5a60619f4d22f155fd3ba8a8cfc0eb27
|
/dragon-javaee-example/src/main/java/com/dragon/book/thinking/chapter19/Shrubbery.java
|
3c9d8e938626447ccf99e8aa46147562a9d0c08e
|
[] |
no_license
|
ymzyf2007/dragon-master
|
9029a13641a05f542f1c27f93848646d91a8b296
|
5b246a9ed726185f7f337f476a5aadabcf8ab7dd
|
refs/heads/master
| 2021-08-14T08:02:04.820103 | 2017-11-15T02:07:32 | 2017-11-15T02:07:32 | 109,670,267 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 106 |
java
|
package com.dragon.book.thinking.chapter19;
public enum Shrubbery {
GROUND, CRAWLING, HANGING
}
|
[
"[email protected]"
] | |
6451134cd770c2b3b5e6d75497671c04aa68336c
|
75201b6aafbadf72bfb4851dbb011bec91d6ef61
|
/lib_search/src/main/java/com/kotlin/lib_search/event/SearchVideoEvent.java
|
62b1232f40e914559005b8ed17d5fee631138670
|
[] |
no_license
|
4CEP1LOT/music_player_
|
a509667ae1af249a76121941672973d397f6a4b8
|
64987c2bdac9c1bfce77edfb9690895cffbc3b96
|
refs/heads/master
| 2022-12-10T09:06:48.119120 | 2020-08-28T10:15:33 | 2020-08-28T10:15:33 | 291,013,652 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 72 |
java
|
package com.kotlin.lib_search.event;
public class SearchVideoEvent {
}
|
[
"[email protected]"
] | |
b559b7669253424bc9b9fa5573ef2af9101ac317
|
6253283b67c01a0d7395e38aeeea65e06f62504b
|
/decompile/app/HwDeskClock/src/main/java/com/google/android/gms/signin/zzc.java
|
15c8625c426a76e816ff7ffa6803a7a8369bdd5e
|
[] |
no_license
|
sufadi/decompile-hw
|
2e0457a0a7ade103908a6a41757923a791248215
|
4c3efd95f3e997b44dd4ceec506de6164192eca3
|
refs/heads/master
| 2023-03-15T15:56:03.968086 | 2017-11-08T03:29:10 | 2017-11-08T03:29:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 94 |
java
|
package com.google.android.gms.signin;
/* compiled from: Unknown */
public interface zzc {
}
|
[
"[email protected]"
] | |
6e7fbb1c2c0fe2f9c293b48f69fd48a3f4b9935d
|
9ddabc14fe6b36796399275f6fc937d477b4bd38
|
/src/test/java/com/veeva/vault/vapil/api/request/SDKRequestTest.java
|
08d17e530b3c856e46f8932a21967c22d5d40376
|
[
"Apache-2.0"
] |
permissive
|
eleini/vault-api-library
|
ab3bb456a414d8f9ed00398476b84bc0854930c9
|
91fb47b43bfd77c03303b019700b16bf7d7b70b7
|
refs/heads/main
| 2023-05-09T15:09:21.855066 | 2021-05-28T15:15:17 | 2021-05-28T15:15:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,641 |
java
|
/*---------------------------------------------------------------------
* Copyright (c) 2021 Veeva Systems Inc. All Rights Reserved.
* This code is based on pre-existing content developed and
* owned by Veeva Systems Inc. and may only be used in connection
* with the deliverable with which it was provided to Customer.
*---------------------------------------------------------------------
*/
package com.veeva.vault.vapil.api.request;
import com.veeva.vault.vapil.api.client.VaultClient;
import com.veeva.vault.vapil.api.model.response.QueueResponse;
import com.veeva.vault.vapil.api.model.response.SDKResponse;
import com.veeva.vault.vapil.api.model.response.ValidatePackageResponse;
import com.veeva.vault.vapil.api.model.response.VaultResponse;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.ExtendWith;
import com.veeva.vault.vapil.extension.VaultClientParameterResolver;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@Tag("SDKRequest")
@ExtendWith(VaultClientParameterResolver.class)
public class SDKRequestTest {
final String CLASS_NAME = "com.veeva.vault.custom.triggers.HelloWorld";
final String SDK_FILE_NAME = "";
final String FILE_PATH = "";
final String PACKAGE_FILE_NAME = "";
final String PACKAGE_ID = "";
final String CERT_FILE_NAME = "";
@Test
public void testRetrieveSDKBinary(VaultClient vaultClient) {
SDKResponse response = vaultClient.newRequest(SDKRequest.class)
.retrieveSingleSourceCodeFile(CLASS_NAME);
Assertions.assertTrue(response.isSuccessful());
Assertions.assertNotNull(response.getBinaryContent());
}
@Test
public void testRetrieveSDKFile(VaultClient vaultClient) {
SDKResponse response = vaultClient.newRequest(SDKRequest.class)
.setInputPath("SDKFile")
.retrieveSingleSourceCodeFile(CLASS_NAME);
Assertions.assertTrue(response.isSuccessful());
}
@Test
public void disableSDK(VaultClient vaultClient) {
SDKResponse response = vaultClient.newRequest(SDKRequest.class)
.disableVaultExtension(CLASS_NAME);
Assertions.assertTrue(response.isSuccessful());
}
@Test
public void enableSDK(VaultClient vaultClient) {
SDKResponse response = vaultClient.newRequest(SDKRequest.class)
.enableVaultExtension(CLASS_NAME);
Assertions.assertTrue(response.isSuccessful());
}
@Test
public void addSDKBinary(VaultClient vaultClient) {
File sdkFile = new File(FILE_PATH);
SDKResponse response = null;
try {
response = vaultClient.newRequest(SDKRequest.class)
.setBinaryFile(sdkFile.getName(), Files.readAllBytes(sdkFile.toPath()))
.addOrReplaceSingleSourceCodeFile();
} catch (IOException e) {
e.printStackTrace();
}
Assertions.assertTrue(response.isSuccessful());
Assertions.assertNotNull(response.getUrl());
}
@Test
public void addSDKFile(VaultClient vaultClient) {
SDKResponse response = vaultClient.newRequest(SDKRequest.class)
.setInputPath(SDK_FILE_NAME)
.addOrReplaceSingleSourceCodeFile();
Assertions.assertTrue(response.isSuccessful());
Assertions.assertNotNull(response.getUrl());
}
@Test
public void deleteSDK(VaultClient vaultClient) {
VaultResponse response = vaultClient.newRequest(SDKRequest.class)
.deleteSingleSourceCodeFile(CLASS_NAME);
Assertions.assertTrue(response.isSuccessful());
}
@Test
public void validatePackageLocal(VaultClient vaultClient) {
ValidatePackageResponse response = vaultClient.newRequest(SDKRequest.class)
.setInputPath(PACKAGE_FILE_NAME)
.validatePackage();
Assertions.assertTrue(response.isSuccessful());
Assertions.assertNotNull(response.getResponseDetails().getAuthor());
}
@Test
public void validatePackageImported(VaultClient vaultClient) {
ValidatePackageResponse response = vaultClient.newRequest(SDKRequest.class)
.validateImportedPackage(PACKAGE_ID);
Assertions.assertTrue(response.isSuccessful());
Assertions.assertNotNull(response.getResponseDetails().getAuthor());
}
@Test
public void retrieveAllQueues(VaultClient vaultClient) {
QueueResponse response = vaultClient.newRequest(SDKRequest.class)
.retrieveAllQueues();
Assertions.assertTrue(response.isSuccessful());
}
// @Nested
// @DisplayName("Tests that depend on a queue")
// class TestQueues {
// String queueName;
//
// @BeforeEach
// public void beforeEach(VaultClient vaultClient) {
// QueueResponse response = vaultClient.newRequest(SDKRequest.class)
// .retrieveAllQueues();
//
//
// if (response.isSuccessful()) {
// for (QueueResponse.Queue queue : response.getData()) {
// queueName = queue.getName();
// }
// }
// }
//
// @Test
// public void testRetrieveQueueStatus(VaultClient vaultClient) {
// if (!queueName.isEmpty()) {
// QueueResponse response = vaultClient.newRequest(SDKRequest.class)
// .retrieveQueueStatus(queueName);
// Assertions.assertTrue(response.isSuccessful());
// }
// }
//
// @Test
// public void testEnableQueue(VaultClient vaultClient) {
// VaultResponse response = vaultClient.newRequest(SDKRequest.class)
// .enableDelivery(queueName);
// Assertions.assertTrue(response.isSuccessful());
// }
// @Test
// public void testResetQueue(VaultClient vaultClient) {
// VaultResponse response = vaultClient.newRequest(SDKRequest.class)
// .resetQueue(queueName);
// Assertions.assertTrue(response.isSuccessful());
// }
// }
@Test
public void testRetrieveCert(VaultClient vaultClient) {
VaultResponse response = vaultClient.newRequest(SDKRequest.class)
.setOutputPath(CERT_FILE_NAME)
.retrieveSigningCertificate("00001");
Assertions.assertTrue(response.isSuccessful());
}
}
|
[
"[email protected]"
] | |
abd514fdb9af49ff7d59e58e07a563be7e06de8f
|
ed594eafa3dbd89315545227caab82d86552a184
|
/Student_management/src/com/student/controller/adminaddStuController.java
|
f1fc3226fe7d5e7b9f2ac46d05147d7eae79a18d
|
[] |
no_license
|
IShowCode-xt/java_project
|
512366e81a1a75566c0b34040c670e7e544a37e4
|
a9d0f68ab6daf30cace029d7c012b08ba2da7924
|
refs/heads/master
| 2023-07-14T16:08:51.209329 | 2021-08-15T09:43:57 | 2021-08-15T09:43:57 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 658 |
java
|
package com.student.controller;
import com.student.service.addStuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class adminaddStuController {
@Autowired
private addStuService addStuService;
@RequestMapping("AdminaddStu.do")
public String addstu(String username,String idcard,String birthdate,String classId,String password){
int rows =addStuService.addStu(username,idcard,birthdate,classId,password);
return "redirect:afindStu.do?type=1&userSearchTxt=null";
}
}
|
[
"[email protected]"
] | |
2962a5d44fb2da646b54f4797fb0b3f321c33f26
|
d05cb5780ee3513dd636a227cc1050f1b4d38680
|
/src/teste/basico/AlterarUsuario2.java
|
a1c6dcaa58c40fb9e5fd77366fe8b30a491ab384
|
[] |
no_license
|
rookie-leo/JPA
|
72b39d7f8e0f89fb9b7d4d7ef5db22903546fe21
|
29692499d95b8df1e9047fef7d4912869b26d5b2
|
refs/heads/master
| 2023-02-03T15:16:57.771030 | 2020-12-22T17:12:42 | 2020-12-22T17:12:42 | 323,686,393 | 0 | 0 | null | null | null | null |
WINDOWS-1250
|
Java
| false | false | 685 |
java
|
package teste.basico;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import modelo.basico.Usuario;
public class AlterarUsuario2 {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("exercicios-jpa");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Usuario user = em.find(Usuario.class, 7L);
user.setEmail("[email protected]");
/*Mesmo sem o merge, o update será realizado, pois o objeto está em estado gerenciado*/
em.getTransaction().commit();
em.close();
emf.close();
}
}
|
[
"[email protected]"
] | |
dc72c70062a271414654b508070136d45025e296
|
e3163e7591eceb0e166e8b8091e2d02636f782c8
|
/src/main/java/com/amazonaws/services/simpleemail/model/SetIdentityNotificationTopicResult.java
|
d4ee633d24a4bb7d26784690b863ffdaae1538a9
|
[
"JSON",
"Apache-2.0"
] |
permissive
|
paulbakker/aws-sdk-java
|
c4542af4c4f72ed0023b8db42c5e57721378ae5d
|
045c79bce0e15634f27019185bfc09f876076629
|
refs/heads/master
| 2021-01-16T20:02:25.185751 | 2013-02-28T02:02:51 | 2013-02-28T02:08:54 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,711 |
java
|
/*
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.simpleemail.model;
/**
* <p>
* An empty element. Receiving this element indicates that the request completed successfully.
* </p>
*/
public class SetIdentityNotificationTopicResult {
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof SetIdentityNotificationTopicResult == false) return false;
SetIdentityNotificationTopicResult other = (SetIdentityNotificationTopicResult)obj;
return true;
}
}
|
[
"[email protected]"
] | |
a9445b13526d9e093386f302396eac6584ace4b9
|
ce357e312e3252f023c5ca6dfb5f05e1fdaa2773
|
/core/src/test/java/test/io/smallrye/openapi/runtime/scanner/jakarta/JAXBElementDto.java
|
d363fc4f79d9c8a8e8caf4a3d51ca91f2474d50f
|
[
"Apache-2.0"
] |
permissive
|
devnied/smallrye-open-api
|
b12f623089e7181a5fa55fdc15ab379ede03bb84
|
e38adfac6ded0f0bd6250b0452939c4dbd9c33c7
|
refs/heads/main
| 2023-05-28T07:26:22.331990 | 2021-06-04T07:38:16 | 2021-06-04T07:38:16 | 374,776,562 | 0 | 0 |
Apache-2.0
| 2021-06-07T19:20:08 | 2021-06-07T19:20:07 | null |
UTF-8
|
Java
| false | false | 912 |
java
|
package test.io.smallrye.openapi.runtime.scanner.jakarta;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElementRef;
import jakarta.xml.bind.annotation.XmlType;
@Schema
@XmlAccessorType(value = XmlAccessType.FIELD)
@XmlType(name = "JAXBElementDto", propOrder = { "caseSubtitleFree", "caseSubtitle" })
public class JAXBElementDto {
@XmlElementRef(name = "CaseSubtitle", namespace = "urn:Milo.API.Miljo.DataContracts.V1", type = JAXBElement.class, required = false)
protected JAXBElement<String> caseSubtitle;
@XmlElementRef(name = "CaseSubtitleFree", namespace = "urn:Milo.API.Miljo.DataContracts.V1", type = JAXBElement.class, required = false)
protected JAXBElement<String> caseSubtitleFree;
}
|
[
"[email protected]"
] | |
196e9a0f17b9b07f64623a66e456c591b891a4c2
|
5ec279f8d03630a0b80bdf5034d7f167b2f662da
|
/birinciGün_Ödev3/src/Odevler/sesliharf.java
|
4d9dab13e54e5feb7306653d4b213f205aa2b17c
|
[] |
no_license
|
grknsntrk/javaCamp
|
e385c5dd08ec4ff440dcd30c62351e260e605916
|
38e7ef3c5dd4fe7e8bd36c7d75fd3d83bd4ac953
|
refs/heads/main
| 2023-05-02T10:23:31.920430 | 2021-05-25T13:38:21 | 2021-05-25T13:38:21 | 363,199,156 | 0 | 0 | null | null | null | null |
ISO-8859-9
|
Java
| false | false | 1,080 |
java
|
package demoBuyukSayıBulma;
public class sesliharf {
public static void main(String[] args) {
//
// String harf = "k";
// boolean check = true;
// String[] sesliharf = new String[10];
// sesliharf [0] = "a";
// sesliharf [1] = "e";
// sesliharf [2] = "ı";
// sesliharf [3] = "i";
// sesliharf [4] = "o";
// sesliharf [5] = "ö";
// sesliharf [6] = "u";
// sesliharf [7] = "ü";
//
// for (int i=0; i<7;i++) {
// if(harf == sesliharf[i])
// check = true;
// else
// check = false;
// }
//
//
// if (check == true)
// System.out.println("SESLİ");
// else
// System.out.println("SESSİZ");
//
//
// for (int i=0 ; i<7 ; i++) {
// System.out.println(sesliharf[i]);
char harf = 'K';
switch (harf) {
case 'A' :
case 'E' :
case 'I' :
case 'İ' :
case 'O' :
case 'Ö' :
case 'U' :
case 'Ü' :
System.out.println("SESLİ");
break;
default:
System.out.println("SESSİZ");
}
}
}
|
[
"[email protected]"
] | |
5e1542bfab9dd887abdf8071822d951d5b32a1e6
|
0f9696c609f74eb92b68d0b72f016292a96a65ac
|
/src/java/org/apache/cassandra/config/Config.java
|
d979a2852d50b0e0789cba7f50140e6f19fc2e11
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
KedarBiradar/RESTandra
|
85a5402bec09f9708e01419b277e5d9f014ccdb4
|
3a6d7951d199658cb9bcb8c352868a1b7e8fdfb3
|
refs/heads/master
| 2021-01-16T22:34:41.678478 | 2011-04-20T01:51:04 | 2011-04-20T01:51:04 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,399 |
java
|
package org.apache.cassandra.config;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
import java.util.List;
public class Config
{
public String cluster_name = "Test Cluster";
public String authenticator;
public String authority;
/* Hashing strategy Random or OPHF */
public String partitioner;
public Boolean auto_bootstrap = false;
public Boolean hinted_handoff_enabled = true;
public Integer max_hint_window_in_ms = Integer.MAX_VALUE;
public SeedProviderDef seed_provider;
public DiskAccessMode disk_access_mode = DiskAccessMode.auto;
/* Address where to run the job tracker */
public String job_tracker_host;
/* Job Jar Location */
public String job_jar_file_location;
/* initial token in the ring */
public String initial_token;
public Long rpc_timeout_in_ms = new Long(2000);
public Integer phi_convict_threshold = 8;
public Integer concurrent_reads = 8;
public Integer concurrent_writes = 32;
public Integer concurrent_replicates = 32;
public Integer memtable_flush_writers = null; // will get set to the length of data dirs in DatabaseDescriptor
public Integer sliced_buffer_size_in_kb = 64;
public Integer storage_port = 7000;
public String listen_address;
public String rpc_address;
public Integer rpc_port = 9160;
public Boolean rpc_keepalive = true;
public Integer rpc_min_threads = 16;
public Integer rpc_max_threads = Integer.MAX_VALUE;
public Integer rpc_send_buff_size_in_bytes;
public Integer rpc_recv_buff_size_in_bytes;
public Integer thrift_max_message_length_in_mb = 16;
public Integer thrift_framed_transport_size_in_mb = 15;
public Boolean snapshot_before_compaction = false;
public Integer compaction_thread_priority = Thread.MIN_PRIORITY;
public Integer binary_memtable_throughput_in_mb = 256;
/* if the size of columns or super-columns are more than this, indexing will kick in */
public Integer column_index_size_in_kb = 64;
public Integer in_memory_compaction_limit_in_mb = 256;
public String[] data_file_directories;
public String saved_caches_directory;
// Commit Log
public String commitlog_directory;
public Integer commitlog_rotation_threshold_in_mb;
public CommitLogSync commitlog_sync;
public Double commitlog_sync_batch_window_in_ms;
public Integer commitlog_sync_period_in_ms;
public String endpoint_snitch;
public Boolean dynamic_snitch = false;
public Integer dynamic_snitch_update_interval_in_ms = 100;
public Integer dynamic_snitch_reset_interval_in_ms = 600000;
public Double dynamic_snitch_badness_threshold = 0.0;
public String request_scheduler;
public RequestSchedulerId request_scheduler_id;
public RequestSchedulerOptions request_scheduler_options;
public EncryptionOptions encryption_options;
public Integer index_interval = 128;
public List<RawKeyspace> keyspaces;
public Double flush_largest_memtables_at = 1.0;
public Double reduce_cache_sizes_at = 1.0;
public double reduce_cache_capacity_to = 0.6;
public int hinted_handoff_throttle_delay_in_ms = 0;
public boolean compaction_preheat_key_cache = true;
public boolean incremental_backups = false;
public static enum CommitLogSync {
periodic,
batch
}
public static enum DiskAccessMode {
auto,
mmap,
mmap_index_only,
standard,
}
public static enum RequestSchedulerId
{
keyspace
}
}
|
[
"[email protected]"
] | |
b03a14365eb92e1818ea352b1b18246a7e1d61bb
|
f943136abc43d4b1b0693eb71398911ff5c7a4f7
|
/SaboChores/src/controller/Servlet_RewardCheck.java
|
05d6e084d5cc45ee38648247f94ca4abdbba7a50
|
[] |
no_license
|
denisewkl/SaboChores
|
48f139cf00a2965985b2f768e6db803c86064557
|
5ac09dd91f807bee28e12136ed29c9b0030e3ea8
|
refs/heads/master
| 2021-01-02T09:02:40.684860 | 2013-10-30T14:58:11 | 2013-10-30T14:58:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,472 |
java
|
package controller;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import entity.*;
import manager.*;
import java.util.*;
public class Servlet_RewardCheck extends HttpServlet{
//overwrites the doGet method
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
processRequest(request,response);
}
//overwrites the doPost method
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
processRequest(request,response);
}
public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(true);
FamilyManager familyMgr = FamilyManager.getInstance();
String choice=request.getParameter("choice");
String[] user= request.getParameterValues("user");
if(user==null){
RequestDispatcher rd = request.getRequestDispatcher("admin-rewards.jsp");
request.setAttribute("msg","*Please select at least one.");
rd.forward(request, response);
}
else if(user != null && choice.equals("Yes")) {
for(int i=0; i<user.length; i++){;
Child getChild=familyMgr.getChildrenByName(user[i]);
if(user[i].equals(getChild.getUserName())){
familyMgr.getChildrenByName(user[i]).setReward(0);
}
}
response.sendRedirect("admin-rewards.jsp");
}
}
}
|
[
"[email protected]"
] | |
c4cca31ed87738bb2b19dd07cd64c653d58de609
|
2533cc5b576fce87ca98e69c71a0d395bfbd55b5
|
/src/main/java/com/example/demo/service/export/ArticleExportXLSXService.java
|
62b42e59e36b6299d8a2eb7dba6d7584ee3cace1
|
[] |
no_license
|
Eymeric-at-IPI/ipi-programation-java1
|
2177de67bc5f198bec35de255d96a8bed43099bc
|
8d4c94229ff606300fb68c2df84d5b6cb0b86707
|
refs/heads/master
| 2023-02-11T03:38:41.874287 | 2021-01-08T10:41:10 | 2021-01-08T10:41:10 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,727 |
java
|
package com.example.demo.service.export;
import com.example.demo.entity.Article;
import com.example.demo.repository.ArticleRepository;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFShape;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
@Service
public class ArticleExportXLSXService {
@Autowired
private ArticleRepository articleRepository;
public void export(OutputStream _outputStream) {
String sheetName = "Articles";
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet(sheetName);
XSSFRow rowHeader = sheet.createRow(0);
rowHeader.createCell(0).setCellValue("ID");
rowHeader.createCell(1).setCellValue("Libellé");
rowHeader.createCell(2).setCellValue("Prix");
rowHeader.createCell(3).setCellValue("Stock");
List<Article> articles = articleRepository.findAll();
int i = 1;
for( Article article : articles ) {
XSSFRow row = sheet.createRow(i);
row.createCell(0).setCellValue(article.getId().toString());
row.createCell(1).setCellValue(article.getLibelle());
row.createCell(2).setCellValue(article.getPrix());
row.createCell(3).setCellValue(article.getStock());
i++;
}
try {
wb.write(_outputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
cf55639cf8d65ea2d721cae0e22d215a25110688
|
fc66eef646e11c8376671ce89ac72d650f3f92c7
|
/app/src/main/java/com/chcovid19project/OrphanageSupport/DeliveryActivity.java
|
27930e2f4547cb9ad2e7b4209b6c346285d63576
|
[] |
no_license
|
COVID-19-Apps/CH-COVID-19-Project
|
95159da1c9a5b6cb86cf93173eb1dd551292eaf0
|
07933ecdebc237beccd437589fd801bc8b968d55
|
refs/heads/master
| 2022-11-10T07:33:26.365190 | 2020-07-01T10:42:05 | 2020-07-01T10:42:05 | 276,349,782 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,222 |
java
|
package com.chcovid19project.OrphanageSupport;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chcovid19project.Adapter.PersonAdapter;
import com.chcovid19project.ConfirmActivity;
import com.chcovid19project.MainActivity;
import com.chcovid19project.Models.Persons;
import com.chcovid19project.OrphanageSupportActivity;
import com.chcovid19project.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
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.Collections;
import java.util.List;
public class DeliveryActivity extends AppCompatActivity implements PersonAdapter.SearchAdapterListener {
private FloatingActionButton Add;
private RecyclerView mPersonList;
private PersonAdapter personAdapter;
private List<Persons> personsList;
private RelativeLayout mNoPersons;
private DatabaseReference mPersonsDatabase;
private SearchView searchView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_delivery);
Add = findViewById(R.id.add);
mNoPersons = findViewById(R.id.no_persons);
mPersonList =findViewById(R.id.volunteer_list);
mPersonsDatabase = FirebaseDatabase.getInstance().getReference().child("Persons");
mPersonsDatabase.keepSynced(true);
mPersonList.setHasFixedSize(true);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
mPersonList.setLayoutManager(mLayoutManager);
personsList = new ArrayList<>();
personAdapter = new PersonAdapter(this, personsList, this);
mPersonList.setAdapter(personAdapter);
Add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isNetworkConnected()) {
AlertDialog.Builder builder = new AlertDialog.Builder(DeliveryActivity.this);
builder.setMessage("Do you want to become Volunteer for Delivery ?").setTitle("Volunteer Confirm");
builder.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(DeliveryActivity.this, ConfirmActivity.class);
startActivity(intent);
dialog.dismiss();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.setTitle("Delivery");
alert.show();
}else{
Toast.makeText(DeliveryActivity.this, "Connect to Internet", Toast.LENGTH_SHORT).show();
}
}
});
readPersons();
}
private void readPersons() {
mPersonsDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
personsList.clear();
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
Persons myStatus = snapshot.getValue(Persons.class);
if (myStatus.getType().contains("Delivery"))
personsList.add(myStatus);
}
if (!personsList.isEmpty()) {
mPersonList.setVisibility(View.VISIBLE);
mNoPersons.setVisibility(View.GONE);
Collections.reverse(personsList);
personAdapter.notifyDataSetChanged();
}else{
mNoPersons.setVisibility(View.VISIBLE);
mPersonList.setVisibility(View.GONE);
}
}else {
mNoPersons.setVisibility(View.VISIBLE);
mPersonList.setVisibility(View.GONE);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private boolean isNetworkConnected() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected();
}
@Override
public void onSearchSelected(Persons persons) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.action_search)
.getActionView();
searchView.setSearchableInfo(searchManager
.getSearchableInfo(getComponentName()));
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// filter recycler view when query submitted
personAdapter.getFilter().filter(query);
return false;
}
@Override
public boolean onQueryTextChange(String query) {
// filter recycler view when text is changed
personAdapter.getFilter().filter(query);
return false;
}
});
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_search) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
[
"[email protected]"
] | |
e256eac90d319dfd4683ea72dc90ea7395df5ba1
|
69cb5ec62e23a38440adb26b9e3ebff0ade42f2b
|
/zoom-aop/src/test/java/org/zoomdev/zoom/aop/interceptors/LogMethodCallback.java
|
d9dc6032ddae51022a186d3c9d73f41b0bfa6424
|
[
"ISC",
"MIT"
] |
permissive
|
zoom-framework/zoom
|
a941aa06dcf87a61590494898e4d58252c0f52b1
|
ad5d6cee4aaef9bfb089af246106145ff0176040
|
refs/heads/master
| 2022-08-03T16:06:25.520593 | 2019-07-03T22:06:28 | 2019-07-03T22:06:28 | 157,067,525 | 1 | 0 |
MIT
| 2022-06-21T00:52:06 | 2018-11-11T10:08:57 |
Java
|
UTF-8
|
Java
| false | false | 201 |
java
|
package org.zoomdev.zoom.aop.interceptors;
import org.zoomdev.zoom.aop.MethodCallback;
/**
* 提供详细的日志
*
* @author jzoom
*/
public class LogMethodCallback extends MethodCallback {
}
|
[
"[email protected]"
] | |
e9114071ec6198b23296b2781c288fd306f48219
|
c0a5b21b3ed96f5f8c8db694139f76be5d324eac
|
/tonghang-mp Maven Webapp/src/main/java/com/tonghang/manage/user/dao/UserMapper.java
|
7a62008d122a847a9e229b5eb54295a35213af25
|
[] |
no_license
|
rpgmakervx/th_manager
|
c08e13a0aef992bf0809dc7d27180a8ad9901a4b
|
5d24329ab4beac5b78b7d0ff9d0b8fa3758944d1
|
refs/heads/master
| 2016-09-02T05:28:48.997831 | 2015-10-08T11:07:11 | 2015-10-08T11:07:11 | 41,240,127 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 814 |
java
|
package com.tonghang.manage.user.dao;
import java.util.List;
import java.util.Map;
import com.tonghang.manage.user.pojo.User;
/**
* 分页在service完成,使用PageHelper插件
* @author Administrator
*
*/
public interface UserMapper {
//按照ID查询用户
public User findUserById(String client_id);
//按照用户属性 分页查询用户
public List<User> findUserByAttribute(Map<String,Object> user);
//分页查询所有用户
public List<User> findAllUser();
//根据标签名查询用户
public List<User> finUserByLabelName(String label_name);
//获取总用户量
public int userNumbers();
//获取按条件搜索到的用户的总用户量
public int userNumbersByAttribute(Map<String,Object> user);
//管理员对用户进行封号和解封
public void isolate(User user);
}
|
[
"[email protected]"
] | |
5971b79a86c26bceb7a639327cf3051d0c4d7dfd
|
2a2f0d6120b8e9a5f27bbe39ebf064ff9353fadc
|
/dto/com.stefanvuckovic.dto/src-gen/com/stefanvuckovic/dto/dTO/impl/DTOModelImpl.java
|
820d4894c494849b21b0c9525dc10fdc55424529
|
[] |
no_license
|
stefanvuckovic/UIDSL
|
baaa80d5d7caf815dc69c2904a39c7242600021d
|
d1bbf10e471ea6cc2a129ff3c3fe70166a7d71de
|
refs/heads/master
| 2021-01-22T10:33:46.374340 | 2016-10-30T20:46:00 | 2016-10-30T20:46:00 | 68,538,407 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,694 |
java
|
/**
* generated by Xtext 2.10.0
*/
package com.stefanvuckovic.dto.dTO.impl;
import com.stefanvuckovic.domainmodel.domainModel.Concept;
import com.stefanvuckovic.dto.dTO.DTOModel;
import com.stefanvuckovic.dto.dTO.DTOPackage;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Model</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link com.stefanvuckovic.dto.dTO.impl.DTOModelImpl#getConcepts <em>Concepts</em>}</li>
* </ul>
*
* @generated
*/
public class DTOModelImpl extends MinimalEObjectImpl.Container implements DTOModel
{
/**
* The cached value of the '{@link #getConcepts() <em>Concepts</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConcepts()
* @generated
* @ordered
*/
protected EList<Concept> concepts;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DTOModelImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DTOPackage.Literals.DTO_MODEL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Concept> getConcepts()
{
if (concepts == null)
{
concepts = new EObjectContainmentEList<Concept>(Concept.class, this, DTOPackage.DTO_MODEL__CONCEPTS);
}
return concepts;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DTOPackage.DTO_MODEL__CONCEPTS:
return ((InternalEList<?>)getConcepts()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case DTOPackage.DTO_MODEL__CONCEPTS:
return getConcepts();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case DTOPackage.DTO_MODEL__CONCEPTS:
getConcepts().clear();
getConcepts().addAll((Collection<? extends Concept>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DTOPackage.DTO_MODEL__CONCEPTS:
getConcepts().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DTOPackage.DTO_MODEL__CONCEPTS:
return concepts != null && !concepts.isEmpty();
}
return super.eIsSet(featureID);
}
} //DTOModelImpl
|
[
"[email protected]"
] | |
4543ff9fe1d1ee0c8069b4aa10ce83cbae34a09d
|
d12cb22b01411ebb76ef9cd9a35f2f221cb83a4a
|
/batch-capture/src/main/java/zjtech/samples/parallel_step/FirstTask.java
|
86fab972bf2b4992a7849e0d7910f6fdb2b0c570
|
[] |
no_license
|
jeven2016/SpringBoot2Test
|
1f449329f110ec41c20e0049391cf5045eea3dff
|
2e526aa3124bd15d4af2d8cc3e13a6dce3aa69fe
|
refs/heads/master
| 2020-05-07T22:39:27.517089 | 2019-12-18T02:33:32 | 2019-12-18T02:33:32 | 180,953,462 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 891 |
java
|
/*
* Copyright (c) 2018 Zjtech. All rights reserved.
* This material is the confidential property of Zjtech or its
* licensors and may be used, reproduced, stored or transmitted only in
* accordance with a valid MIT license or sublicense agreement.
*/
package zjtech.samples.parallel_step;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class FirstTask implements Tasklet {
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext)
throws Exception {
log.info("First task is launched......");
return RepeatStatus.FINISHED;
}
}
|
[
"[email protected]"
] | |
b522e21022c9fd9a3ba22d4411a48650356a89e9
|
0a65a924dc5f45c81b280d3dba7c2153fddee0d1
|
/app/src/main/java/com/example/practicegallery/ImageFullActivity.java
|
e6faa148d9072fd49625f8ea4ac36e76f93b958e
|
[] |
no_license
|
AyushSrivastava-dev/my-app1
|
24903a46f16a225c44f46c9a19b8ce053ad038c6
|
62b9e7e5066dd58f67c54b406a4d8c8eb36bbd0d
|
refs/heads/master
| 2023-07-15T12:58:47.311542 | 2021-08-29T15:19:55 | 2021-08-29T15:19:55 | 374,043,517 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 38,073 |
java
|
package com.example.practicegallery;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.app.NavUtils;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import androidx.documentfile.provider.DocumentFile;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import android.Manifest;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.RecoverableSecurityException;
import android.app.WallpaperManager;
import android.content.ClipData;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentSender;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.PorterDuff;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.storage.StorageManager;
import android.provider.MediaStore;
import android.util.Log;
import android.view.ActionMode;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ActionMenuView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.GenericTransitionOptions;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.transition.ViewPropertyTransition;
import com.davemorrissey.labs.subscaleview.ImageSource;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.dsphotoeditor.sdk.activity.DsPhotoEditorActivity;
import com.dsphotoeditor.sdk.utils.DsPhotoEditorConstants;
import com.example.practicegallery.ImageSliderModel;
import com.github.chrisbanes.photoview.OnMatrixChangedListener;
import com.github.chrisbanes.photoview.OnScaleChangedListener;
import com.github.chrisbanes.photoview.PhotoView;
import com.github.chrisbanes.photoview.PhotoViewAttacher;
import com.google.android.material.bottomappbar.BottomAppBar;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
import static com.example.practicegallery.R.color.black;
import static com.example.practicegallery.R.color.red_background;
import static java.security.AccessController.getContext;
import androidx.core.content.FileProvider;
public class ImageFullActivity extends AppCompatActivity {
private String imagePath;
private float cumulScaleFactor = 1;
private Toolbar toolbar4;
private TextView textView;
private ImageView imageView;
private Toolbar toolbar5;
long periodMs;
ImageView rotate;
ImageView startview;
ImageView editImage;
private int positions;
ViewPager2 viewPager;
ViewPager viewPager1;
ArrayList<ImageSliderModel> sliders;
static final String SAVE_STATE = "state";
Timer timer;
boolean check = false;
TextView buttonSlide1;
TextView buttonSlide2;
private RadioGroup radioGroupSlide;
private RadioButton radioButtonSlide;
private ImageView cancelImage;
ArrayList<Uri> uriArrayList;
Uri deleteUri;
int activeClass;
String textC;
File file;
TextView txtName;
TextView txtPath;
TextView txtDate;
TextView txtSize;
private RadioGroup radioGroup1;
private TextView button1;
private TextView button2;
private int selectedIdTrans = 0;
private RadioButton radioButtonTrans;
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_image_full);
Intent intent = getIntent();
imagePath = intent.getStringExtra("path");
textC = intent.getStringExtra("textCon");
String imageN = intent.getStringExtra("name");
String imageName = intent.getStringExtra("name").replace(".jpg", "");
viewPager = findViewById(R.id.viewpPagersImage);
viewPager1 = findViewById(R.id.view_pager);
cancelImage = findViewById(R.id.image_cancel);
rotate = findViewById(R.id.rotate_view);
String folderName = intent.getStringExtra("folder");
sliders = new ArrayList<ImageSliderModel>();
Uri allImagesuri = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
String[] projection = {MediaStore.Images.ImageColumns.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.BUCKET_DISPLAY_NAME, MediaStore.Images.Media.DATE_TAKEN, MediaStore.Images.Media._ID,MediaStore.Images.Media.SIZE};
String sortOrders = MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC";
SharedPreferences sharedPreferences = getSharedPreferences("MYPREF", MODE_PRIVATE);
if (sharedPreferences.contains(SAVE_STATE)) {
sortOrders = sharedPreferences.getString(SAVE_STATE, null);
}
Cursor cursor = this.getContentResolver().query(allImagesuri, projection, null, null, sortOrders);
try {
cursor.moveToFirst();
do {
String displayName = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_DISPLAY_NAME));
if (displayName.equals(folderName)) {
activeClass = 2;
ImageSliderModel imageSliderModel = new ImageSliderModel();
imageSliderModel.imageNamer = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME));
imageSliderModel.imagePather = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
imageSliderModel.id = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID));
Double sizeImages = cursor.getDouble(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE))/1000000;
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
imageSliderModel.imageSize = df.format(sizeImages)+" MB";
Calendar myCal = Calendar.getInstance();
myCal.setTimeInMillis(cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_TAKEN)));
Date dateText = new Date(myCal.get(Calendar.YEAR)-1900,
myCal.get(Calendar.MONTH),
myCal.get(Calendar.DAY_OF_MONTH),
myCal.get(Calendar.HOUR_OF_DAY),
myCal.get(Calendar.MINUTE));
imageSliderModel.imageDate = (android.text.format.DateFormat.format("dd/MM/yy", dateText)).toString();
sliders.add(imageSliderModel);
} else if (folderName.isEmpty()) {
activeClass = 1;
ImageSliderModel imageSliderModel = new ImageSliderModel();
imageSliderModel.imageNamer = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME));
imageSliderModel.imagePather = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
imageSliderModel.id = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID));
Double sizeImages = cursor.getDouble(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE))/1000000;
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(2);
imageSliderModel.imageSize = df.format(sizeImages)+" MB";
Calendar myCal = Calendar.getInstance();
myCal.setTimeInMillis(cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATE_TAKEN)));
Date dateText = new Date(myCal.get(Calendar.YEAR)-1900,
myCal.get(Calendar.MONTH),
myCal.get(Calendar.DAY_OF_MONTH),
myCal.get(Calendar.HOUR_OF_DAY),
myCal.get(Calendar.MINUTE));
imageSliderModel.imageDate = (android.text.format.DateFormat.format("dd/MM/yy", dateText)).toString();
sliders.add(imageSliderModel);
}
} while (cursor.moveToNext());
cursor.close();
} catch (Exception e) {
e.printStackTrace();
}
for (int i = 0; i < sliders.size(); i++) {
if (imagePath.equals(sliders.get(i).imagePather)) {
positions = i;
}
}
textView = (TextView) findViewById(R.id.titleOfTool);
textView.setText(imageName);
toolbar4 = findViewById(R.id.tool_bar);
toolbar5 = findViewById(R.id.tool_bar2);
toolbar5.inflateMenu(R.menu.image_menu);
toolbar5.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
if (item.getItemId() == R.id.slide_show) {
slideshow();
return true;
}
if (item.getItemId() == R.id.wallpaper) {
setImageWallpaper();
return true;
}
if(item.getItemId() == R.id.details){
detailsImage();
return true;
}
if(item.getItemId() == R.id.transition){
transitionGetter();
return true;
}
return false;
}
});
startview = findViewById(R.id.star_view);
imageView = findViewById(R.id.back_up);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
cancelImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(ImageFullActivity.this, "Slideshow stopped", Toast.LENGTH_SHORT).show();
Log.d("check value", "Second " + check);
cancelImage.setVisibility(View.GONE);
timer.cancel();
toolbar4.setVisibility(View.VISIBLE);
toolbar5.setVisibility(View.VISIBLE);
}
});
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// viewPager.setPageTransformer(new ZoomOutPageTransformer());
SharedPreferences sharedPrefTrans = getSharedPreferences("TransitionId",MODE_PRIVATE);
String transString = sharedPrefTrans.getString("SelectedTrans",null);
if(transString != null) {
if(transString.equals(" Sink")){
viewPager1.setPageTransformer(true,new DepthPageTransformer());
}
if(transString.equals(" Zoom")){
viewPager1.setPageTransformer(false,new ZoomOutPageTransformer());
}
if(transString.equals(" Spin")){
viewPager1.setPageTransformer(false,new SpinnerTransformation());
}
if(transString.equals(" Cube_in")){
viewPager1.setPageTransformer(false,new CubeInRotationTransformation());
}
if(transString.equals(" Cube_out")){
viewPager1.setPageTransformer(false,new CubeOutRotationTransformation());
}
if(transString.equals(" Hinge")){
viewPager1.setPageTransformer(false,new HingeTransformation());
}
if(transString.equals(" Fade")){
viewPager1.setPageTransformer(false,new FadeOutTransformation());
}
}
viewPager1.setAdapter(new PictureAdapter(getApplicationContext(), sliders, ImageFullActivity.this, toolbar5, toolbar4,rotate,viewPager1,imagePath,textC,imageN,folderName));
viewPager1.setCurrentItem(positions, true);
viewPager1.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
positions = position;
textView.setText(sliders.get(position).imageNamer);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
editImage = findViewById(R.id.edit_view1);
editImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent dsPhotoEditorIntent = new Intent(ImageFullActivity.this, DsPhotoEditorActivity.class);
Uri inputImageUri = Uri.fromFile(new File(sliders.get(positions).imagePather));
dsPhotoEditorIntent.setData(inputImageUri);
dsPhotoEditorIntent.putExtra(DsPhotoEditorConstants.DS_PHOTO_EDITOR_OUTPUT_DIRECTORY, "Edited_Image");
startActivityForResult(dsPhotoEditorIntent, 200);
}
});
}
private void transitionGetter() {
ViewGroup viewGroupSlide = findViewById(android.R.id.content);
View dialogViewSlide = LayoutInflater.from(ImageFullActivity.this).inflate(R.layout.transition_get, viewGroupSlide, false);
AlertDialog.Builder builderSlide = new AlertDialog.Builder(ImageFullActivity.this);
builderSlide.setView(dialogViewSlide);
AlertDialog alertDialogSlide = builderSlide.create();
alertDialogSlide.show();
button1 = dialogViewSlide.findViewById(R.id.no_button_trans);
button2 = dialogViewSlide.findViewById(R.id.ok_button_trans);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialogSlide.dismiss();
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
radioGroup1 = dialogViewSlide.findViewById(R.id.radioG_trans);
selectedIdTrans = radioGroup1.getCheckedRadioButtonId();
radioButtonTrans = dialogViewSlide.findViewById(selectedIdTrans);
radioButtonTrans.setChecked(true);
String transitionValue = radioButtonTrans.getText().toString();
if(transitionValue.equals(" Sink")){
viewPager1.setPageTransformer(true,new DepthPageTransformer());
}
if(transitionValue.equals(" Zoom")){
viewPager1.setPageTransformer(false,new ZoomOutPageTransformer());
}
if(transitionValue.equals(" Spin")){
viewPager1.setPageTransformer(false,new SpinnerTransformation());
}
if(transitionValue.equals(" Cube_in")){
viewPager1.setPageTransformer(false,new CubeInRotationTransformation());
}
if(transitionValue.equals(" Cube_out")){
viewPager1.setPageTransformer(false,new CubeOutRotationTransformation());
}
if(transitionValue.equals(" Hinge")){
viewPager1.setPageTransformer(false,new HingeTransformation());
}
if(transitionValue.equals(" Fade")){
viewPager1.setPageTransformer(false,new FadeOutTransformation());
}
SharedPreferences sharedPreferencesTrans = getSharedPreferences("TransitionId",MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferencesTrans.edit();
editor.putString("SelectedTrans",transitionValue);
editor.apply();
alertDialogSlide.dismiss();
}
});
}
private void detailsImage() {
ViewGroup viewGroupSlide = findViewById(android.R.id.content);
View dialogViewSlide = LayoutInflater.from(ImageFullActivity.this).inflate(R.layout.details_image, viewGroupSlide, false);
AlertDialog.Builder builderSlide = new AlertDialog.Builder(ImageFullActivity.this);
builderSlide.setView(dialogViewSlide);
AlertDialog alertDialogSlide = builderSlide.create();
alertDialogSlide.show();
txtName = dialogViewSlide.findViewById(R.id.image_n1);
txtPath = dialogViewSlide.findViewById(R.id.image_p1);
txtDate = dialogViewSlide.findViewById(R.id.image_d1);
txtSize = dialogViewSlide.findViewById(R.id.image_s1);
txtName.setText(sliders.get(positions).imageNamer);
txtPath.setText(sliders.get(positions).imagePather);
txtDate.setText(sliders.get(positions).imageDate);
txtSize.setText(sliders.get(positions).imageSize);
}
private void setImageWallpaper() {
Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
File fileI = new File(imagePath);
Uri imageUri = getImageContentUri(this, fileI);
if (imageUri != null) {
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("mimeType", "image/*");
this.startActivity(Intent.createChooser(intent, "Set as:"));
}
}
public static Uri getImageContentUri(Context context, File imageFile) {
String filePath = imageFile.getAbsolutePath();
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Images.Media._ID},
MediaStore.Images.Media.DATA + "=? ",
new String[]{filePath}, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
cursor.close();
return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id);
} else {
if (imageFile.exists()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
return context.getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} else {
return null;
}
}
}
private void slideshow() {
ViewGroup viewGroupSlide = findViewById(android.R.id.content);
View dialogViewSlide = LayoutInflater.from(ImageFullActivity.this).inflate(R.layout.slideshow_menu, viewGroupSlide, false);
AlertDialog.Builder builderSlide = new AlertDialog.Builder(ImageFullActivity.this);
builderSlide.setView(dialogViewSlide);
AlertDialog alertDialogSlide = builderSlide.create();
alertDialogSlide.show();
buttonSlide1 = dialogViewSlide.findViewById(R.id.no_button_slide);
buttonSlide2 = dialogViewSlide.findViewById(R.id.ok_button_slide);
buttonSlide1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialogSlide.dismiss();
}
});
buttonSlide2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
radioGroupSlide = dialogViewSlide.findViewById(R.id.radioGroup_slide);
radioButtonSlide = dialogViewSlide.findViewById(radioGroupSlide.getCheckedRadioButtonId());
String slideName1 = radioButtonSlide.getText().toString();
slideName1 = slideName1.trim() + "000";
periodMs = Long.parseLong(slideName1);
alertDialogSlide.dismiss();
Toast.makeText(ImageFullActivity.this, "Slideshow started", Toast.LENGTH_SHORT).show();
cancelImage.setVisibility(View.VISIBLE);
toolbar4.setVisibility(View.GONE);
toolbar5.setVisibility(View.GONE);
final long DELAY_MS = 100;//delay in milliseconds before task is to be executed
final long PERIOD_MS = periodMs;// time in milliseconds between successive task execution
final Handler handler = new Handler();
final Runnable Update = new Runnable() {
public void run() {
if (positions == sliders.size()) {
positions = 0;
}
viewPager1.setCurrentItem(positions++, true);
}
};
timer = new Timer(); // This will create a new Thread
timer.schedule(new TimerTask() { // task to be scheduled
@Override
public void run() {
handler.post(Update);
SharedPreferences sharingTouch = getSharedPreferences("keyis1", Context.MODE_PRIVATE);
check = sharingTouch.getBoolean("keyNot1", false);
if (check) {
Toast.makeText(ImageFullActivity.this, "Slideshow stopped", Toast.LENGTH_SHORT).show();
cancelImage.setVisibility(View.GONE);
timer.cancel();
}
}
}, DELAY_MS, PERIOD_MS);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
switch (requestCode) {
case 200:
Uri outputUri = data.getData();
Toast.makeText(this, "Image saved Successfully.Please check on Edited_Image Folder", Toast.LENGTH_LONG).show();
break;
case 201:
if (resultCode == RESULT_OK) {
Log.d("deleteImage", "file deleted in ok");
if (file.delete()) {
}
getContentResolver().delete(deleteUri, null, null);
Toast.makeText(this, "maybe", Toast.LENGTH_SHORT).show();
intentStart();
}
break;
case 301:
if (resultCode == RESULT_OK) {
AlertDialog.Builder builder = new AlertDialog.Builder(ImageFullActivity.this).setTitle("Warning")
.setMessage("Do you really want to delete this image").setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (!(data == null)) {
ClipData clipData = data.getClipData();
if (clipData != null) {
Uri imU = clipData.getItemAt(0).getUri();
deleteImageWUri(imU);
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
onBackPressed();
}
});
builder.show();
}
}
}
}
private void deleteImageWUri(Uri imU) {
Log.d("nodeletethis", "yes");
DocumentFile documentFile = DocumentFile.fromSingleUri(this, imU);
if (documentFile.canWrite() == true) {
documentFile.delete();
Toast.makeText(this, "Hi deleted", Toast.LENGTH_SHORT).show();
}
}
public void sendIt(View view) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
Uri uriToImage = Uri.parse(imagePath);
sendIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
sendIntent.setType("image/jpeg");
Intent shareIntent = Intent.createChooser(sendIntent, null);
startActivity(shareIntent);
}
public void deleteFiles(View view) {
uriArrayList = new ArrayList<Uri>();
positions = viewPager1.getCurrentItem();
file = new File(sliders.get(positions).imagePather);
Uri imageUri = Uri.fromFile(file);
uriArrayList.add(imageUri);
if (file.exists()) {
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@RequiresApi(api = Build.VERSION_CODES.Q)
@Override
public void run() {
// Set up the projection (we only need the ID)
String[] projection = {MediaStore.Images.Media._ID};
// Match on the file path
String selection = MediaStore.Images.Media.DATA + " = ?";
String[] selectionArgs = new String[]{file.getAbsolutePath()};
Uri queryUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
ContentResolver contentResolver = getContentResolver();
Cursor c = contentResolver.query(queryUri, projection, selection, selectionArgs, null);
if (c != null) {
if (c.moveToFirst()) {
Log.d("mydeleteimage", "in movefirst");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
PendingIntent pi = MediaStore.createDeleteRequest(ImageFullActivity.this.getContentResolver(), uriArrayList);
try {
startIntentSenderForResult(pi.getIntentSender(), 201, null, 0, 0,
0);
} catch (IntentSender.SendIntentException e) {
}
}
else {
try {
String s1 = String.valueOf(sliders.get(positions).id);
String arg1[] = new String[]{s1};
long id = c.getLong(c.getColumnIndexOrThrow(MediaStore.Images.Media._ID));
deleteUri = ContentUris.withAppendedId(queryUri, id);
contentResolver.delete(deleteUri,null,null);
try {
file.getCanonicalFile().delete();
} catch (IOException e) {
e.printStackTrace();
}
if(file.delete()){
}
intentStart();
} catch (RecoverableSecurityException recoverableSecurityException) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
try {
ImageFullActivity.this.startIntentSenderForResult(recoverableSecurityException.getUserAction().getActionIntent().getIntentSender(), 201, null, 0, 0, 0, null);
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
}
}
}
}
}
c.close();
}
}
}, 300);
}
}
public class DepthPageTransformer implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.75f;
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0f);
} else if (position <= 0) { // [-1,0]
// Use the default slide transition when moving to the left page
view.setAlpha(1f);
view.setTranslationX(0f);
view.setScaleX(1f);
view.setScaleY(1f);
} else if (position <= 1) { // (0,1]
// Fade the page out.
view.setAlpha(1 - position);
// Counteract the default slide transition
view.setTranslationX(pageWidth * -position);
// Scale the page down (between MIN_SCALE and 1)
float scaleFactor = MIN_SCALE
+ (1 - MIN_SCALE) * (1 - Math.abs(position));
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
} else { // (1,+Infinity]
// This page is way off-screen to the right.
view.setAlpha(0f);
}
}
}
public class ZoomOutPageTransformer implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.85f;
private static final float MIN_ALPHA = 0.5f;
public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
int pageHeight = view.getHeight();
if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0f);
} else if (position <= 1) { // [-1,1]
// Modify the default slide transition to shrink the page as well
float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
float vertMargin = pageHeight * (1 - scaleFactor) / 2;
float horzMargin = pageWidth * (1 - scaleFactor) / 2;
if (position < 0) {
view.setTranslationX(horzMargin - vertMargin / 2);
} else {
view.setTranslationX(-horzMargin + vertMargin / 2);
}
// Scale the page down (between MIN_SCALE and 1)
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);
// Fade the page relative to its size.
view.setAlpha(MIN_ALPHA +
(scaleFactor - MIN_SCALE) /
(1 - MIN_SCALE) * (1 - MIN_ALPHA));
} else { // (1,+Infinity]
// This page is way off-screen to the right.
view.setAlpha(0f);
}
}
}
public class FadeOutTransformation implements ViewPager.PageTransformer{
@Override
public void transformPage(View page, float position) {
page.setTranslationX(-position*page.getWidth());
page.setAlpha(1-Math.abs(position));
}
}
public class CubeInRotationTransformation implements ViewPager.PageTransformer{
@Override
public void transformPage(View page, float position) {
page.setCameraDistance(20000);
if (position < -1){ // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
}
else if (position <= 0){ // [-1,0]
page.setAlpha(1);
page.setPivotX(page.getWidth());
page.setRotationY(90*Math.abs(position));
}
else if (position <= 1){ // (0,1]
page.setAlpha(1);
page.setPivotX(0);
page.setRotationY(-90*Math.abs(position));
}
else{ // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}
public class CubeOutRotationTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
if (position < -1){ // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
}
else if (position <= 0) { // [-1,0]
page.setAlpha(1);
page.setPivotX(page.getWidth());
page.setRotationY(-90 * Math.abs(position));
}
else if (position <= 1){ // (0,1]
page.setAlpha(1);
page.setPivotX(0);
page.setRotationY(90 * Math.abs(position));
}
else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}
public class HingeTransformation implements ViewPager.PageTransformer{
@Override
public void transformPage(View page, float position) {
page.setTranslationX(-position*page.getWidth());
page.setPivotX(0);
page.setPivotY(0);
if (position < -1){ // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
}
else if (position <= 0){ // [-1,0]
page.setRotation(90*Math.abs(position));
page.setAlpha(1-Math.abs(position));
}
else if (position <= 1){ // (0,1]
page.setRotation(0);
page.setAlpha(1);
}
else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}
public class SpinnerTransformation implements ViewPager.PageTransformer {
@Override
public void transformPage(View page, float position) {
page.setTranslationX(-position * page.getWidth());
page.setCameraDistance(12000);
if (position < 0.5 && position > -0.5) {
page.setVisibility(View.VISIBLE);
} else {
page.setVisibility(View.INVISIBLE);
}
if (position < -1){ // [-Infinity,-1)
// This page is way off-screen to the left.
page.setAlpha(0);
}
else if (position <= 0) { // [-1,0]
page.setAlpha(1);
page.setRotationY(900 *(1-Math.abs(position)+1));
}
else if (position <= 1) { // (0,1]
page.setAlpha(1);
page.setRotationY(-900 *(1-Math.abs(position)+1));
}
else { // (1,+Infinity]
// This page is way off-screen to the right.
page.setAlpha(0);
}
}
}
public void intentStart() {
if (activeClass == 1) {
Intent intent = new Intent(ImageFullActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
ImageFullActivity.this.finish();
} else if (activeClass == 2) {
Intent intent = new Intent(ImageFullActivity.this, Album_OpenActivity.class);
intent.putExtra("currentSong", textC);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
ImageFullActivity.this.finish();
}
}
}
|
[
"[email protected]"
] | |
2093d983ffb8f1d18edcca6395cadaf9573dc370
|
6f87d966ed5f8ce960d3d6c6af9907a3e079796f
|
/src/SortingAdvance/QuickSort/Main.java
|
354537bdb0aaebc7132cdca7f838b614b0beecad
|
[] |
no_license
|
Sunsanity/Algorithms
|
5f0163e395d9d1b05010eff301bf28a6336f0572
|
f776486e6a9bbd0f839da31b826824efaff4612f
|
refs/heads/master
| 2021-09-06T11:31:02.564447 | 2018-02-06T03:18:59 | 2018-02-06T03:18:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,128 |
java
|
package SortingAdvance.QuickSort;
import java.util.Arrays;
/**
* Created by SJW on 2017/7/9.
* 测试插入排序算法和选择排序算法的效率
*/
public class Main {
public static void main(String[] args) {
int n = 1000000;
Integer[] arr1 = SortTestHelper.generateTestArray(n,0,n);
//Integer[] arr1 = SortTestHelper.generateNearlyOrderedArray(n,100);
Integer[] arr2 = Arrays.copyOf(arr1,arr1.length);
/*Integer[] arr3 = Arrays.copyOf(arr1,arr1.length);
Integer[] arr4 = Arrays.copyOf(arr1,arr1.length);
Integer[] arr5 = Arrays.copyOf(arr1,arr1.length);*/
//此时的选择排序比插入排序的效率高
/*SortTestHelper.testSort("SortingBasic.InsertionSortAdvance.SelectionSort",arr1);
SortTestHelper.testSort("SortingBasic.InsertionSortAdvance.InsertSort",arr2);
SortTestHelper.testSort("SortingBasic.BubbleSort.BubbleSort",arr3);*/
SortTestHelper.testSort("SortingAdvance.MergeSortAdvance.MergeSort",arr1);
SortTestHelper.testSort("SortingAdvance.QuickSort.QuickSort",arr2);
return;
}
}
|
[
"[email protected]"
] | |
6efd5d079d247eea9acbc943fb4d681fc885fbe5
|
d4a4f5a19ab0cbe29f8f65ec76a5412e48bf70bc
|
/Client.java
|
88daa84c75e0c766883567c4baa4a6e05ee741e2
|
[] |
no_license
|
Wangzy673234096/ChatSystem
|
a0c32ed0298298d3b28d30cffabc61d96237cd9a
|
14452bae18fee06a407b7f01f3ed9e1899303946
|
refs/heads/master
| 2021-07-22T18:22:51.538489 | 2017-10-27T07:05:46 | 2017-10-27T07:05:46 | 108,511,628 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,247 |
java
|
package ChatSystem;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
public class Client {
private JFrame frame;
private JList<String> userList;// 用户列表
private JTextArea textArea;// 文本域
private JTextField textField;// 用于编辑显示文本信息
private JTextField txt_port;// 设置端口号
private JTextField txt_hostIp;// 设置IP
private JTextField txt_name;// 设置用户名
private JButton btn_start;// 开始按钮
private JButton btn_stop;// 断开按钮
private JButton btn_send;// 发送按钮
private JPanel northPanel;// 上面板
private JPanel southPanel;// 下面板
private JScrollPane leftScroll;// 左滚动条
private JScrollPane rightScroll;// 右滚动条
private JSplitPane centerSplit;// 分割线
private DefaultListModel<String> listModel;// 默认的列表
private boolean isConnected = false;// 用来记录客户端连接跟断开
private Socket socket;
private PrintWriter writer;// 输出字符打印
private BufferedReader reader;// 缓存读取
private MessageThread messageThread;// 负责接收消息的线程
private Map<String, User> onLineUsers = new HashMap<String, User>();// 所有在线用户
private static final String TIP = "请输入姓名";// 提示
public static void main(String[] args) {
new Client();
}
// 执行发送
public void send() {
String message = textField.getText().trim();// 去掉首尾空格获取文本框内容
sendMessage(frame.getTitle() + "@" + "ALL" + "@" + message);// 传输用户名及输入的文本信息
textField.setText(null);// 清空输入文本框内容
}
// 构造方法
public Client() {
// 初始化界面
textArea = new JTextArea();
textArea.setEditable(false);
textArea.setForeground(Color.blue);
textField = new JTextField();
txt_port = new JTextField("6666");
txt_hostIp = new JTextField("127.0.0.1");
txt_name = new JTextField(TIP);
txt_name.setName("txt_name");
txt_name.setForeground(Color.gray);
btn_start = new JButton("连接");
btn_stop = new JButton("断开");
btn_send = new JButton("发送(s)");
listModel = new DefaultListModel<String>();
userList = new JList<String>(listModel);
btn_start.setFont(new Font("宋体", Font.BOLD, 12));
btn_stop.setFont(new Font("宋体", Font.BOLD, 12));
btn_send.setFont(new Font("宋体", Font.BOLD, 12));
btn_send.setBackground(new Color(178, 143, 206));
// 上面板布局
northPanel = new JPanel();
northPanel.setLayout(new GridLayout(1, 7));
northPanel.setBorder(new TitledBorder("连接信息"));
northPanel.add(new JLabel("端口"));
northPanel.add(txt_port);
northPanel.add(new JLabel("服务器IP"));
northPanel.add(txt_hostIp);
northPanel.add(new JLabel("姓名"));
northPanel.add(txt_name);
northPanel.add(btn_start);
northPanel.add(btn_stop);
northPanel.setBackground(new Color(240, 255, 255));
// 下面板布局
leftScroll = new JScrollPane(userList);
leftScroll.setBorder(new TitledBorder("在线用户"));
rightScroll = new JScrollPane(textArea);
rightScroll.setBorder(new TitledBorder("消息显示区"));
southPanel = new JPanel(new BorderLayout());
southPanel.add(textField, "Center");
southPanel.add(btn_send, "East");
southPanel.setBorder(new TitledBorder("写消息"));
leftScroll.setBackground(new Color(240, 255, 255));
rightScroll.setBackground(new Color(240, 255, 255));
southPanel.setBackground(new Color(240, 255, 255));
centerSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScroll, rightScroll);
centerSplit.setDividerLocation(100);
frame = new JFrame("客户端");
frame.setIconImage(Toolkit.getDefaultToolkit().createImage(Client.class.getResource("qq.png")));
frame.setLayout(new BorderLayout());
frame.add(northPanel, "North");
frame.add(centerSplit, "Center");
frame.add(southPanel, "South");
// frame.setSize(600, 400);
frame.setMinimumSize(new Dimension(600, 400));
frame.setLocationRelativeTo(null);
// int screen_width = Toolkit.getDefaultToolkit().getScreenSize().width;
// int screen_height =
// Toolkit.getDefaultToolkit().getScreenSize().height;
// frame.setLocation((screen_width - frame.getWidth()) / 2,
// (screen_height - frame.getHeight()) / 2);
frame.setVisible(true);
txt_name.addMouseListener(new MouseListener() {
// 鼠标单击姓名文本框监听
@Override
public void mouseClicked(MouseEvent e) {
Component component = e.getComponent();
String name = component.getName();
if (e.getButton() == MouseEvent.BUTTON1) {
if ("txt_name".equals(name)) {
JTextField txt_name = (JTextField) component;
if (TIP.equals(txt_name.getText())) {
txt_name.setText("");
}
} else if ("panel".equals(name)) {
JTextField txt_name = (JTextField) ((JPanel) component).getComponents()[0];
if ("".equals(txt_name.getText())) {
txt_name.setText(TIP);
}
}
}
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
// 写消息的文本框中按回车键事件
textField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
send();
}
});
// 单击发送按钮事件
btn_send.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
send();
}
});
// 单击连接按钮事件
btn_start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int port;
if (isConnected) {
JOptionPane.showMessageDialog(frame, "已处于连接上状态,不要重复连接!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
try {
try {
port = Integer.parseInt(txt_port.getText().trim());
} catch (NumberFormatException e2) {
throw new Exception("端口号应为1024~65535的整数!");
}
String hostIp = txt_hostIp.getText().trim();
String name = txt_name.getText().trim();
if (name.equals("") || hostIp.equals("")) {
throw new Exception("姓名、服务器IP不能为空!");
}
boolean flag = connectServer(port, hostIp, name);
if (flag == false) {
throw new Exception("与服务器连接失败!");
}
frame.setTitle(name);
JOptionPane.showMessageDialog(frame, "成功连接!");
} catch (Exception exc) {
JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);
}
}
});
// 单击断开按钮事件
btn_stop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!isConnected) {
JOptionPane.showMessageDialog(frame, "已处于断开状态,不要重复断开!", "错误", JOptionPane.ERROR_MESSAGE);
return;
}
try {
boolean flag = closeConnection();// 断开连接
if (flag == false) {
throw new Exception("断开连接发生异常!");
}
JOptionPane.showMessageDialog(frame, "成功断开!");
} catch (Exception exc) {
JOptionPane.showMessageDialog(frame, exc.getMessage(), "错误", JOptionPane.ERROR_MESSAGE);
}
}
});
// 关闭窗口事件
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
if (isConnected) {
closeConnection();// 关闭连接
}
System.exit(0);// 退出程序
}
});
}
/**
* 连接服务器
*
* @param port
* @param hostIp
* @param name
*/
public boolean connectServer(int port, String hostIp, String name) {
// 连接服务器
try {
socket = new Socket(hostIp, port);// 根据端口号和服务器ip建立连接
writer = new PrintWriter(socket.getOutputStream());
reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
// 发送客户端用户基本信息(用户名和ip地址)
sendMessage(name + "@" + socket.getLocalAddress().toString());
// 开启接收消息的线程
messageThread = new MessageThread(reader, textArea);
messageThread.start();
isConnected = true;// 已经连接上了
return true;
} catch (Exception e) {
textArea.append("与端口号为:" + port + " IP地址为:" + hostIp + " 的服务器连接失败!" + "\r\n");
isConnected = false;// 未连接上
return false;
}
}
/**
* 发送消息
*
* @param message
*/
public void sendMessage(String message) {
writer.println(message);
writer.flush();
}
/**
* 客户端主动关闭连接
*/
@SuppressWarnings("deprecation")
public synchronized boolean closeConnection() {
try {
sendMessage("CLOSE");// 发送断开连接命令给服务器
messageThread.stop();// 停止接受消息线程
// 释放资源
if (reader != null) {
reader.close();
}
if (writer != null) {
writer.close();
}
if (socket != null) {
socket.close();
}
isConnected = false;
return true;
} catch (IOException e1) {
e1.printStackTrace();
isConnected = true;
return false;
}
}
// 接收消息的线程
class MessageThread extends Thread {
private BufferedReader reader;
private JTextArea textArea;
// 接收消息线程的构造方法
public MessageThread(BufferedReader reader, JTextArea textArea) {
this.reader = reader;
this.textArea = textArea;
}
// 被动的关闭连接
public synchronized void closeCon() throws Exception {
// 清空用户列表
listModel.removeAllElements();
// 被动的关闭连接释放资源
if (reader != null) {
reader.close();
}
if (writer != null) {
writer.close();
}
if (socket != null) {
socket.close();
}
isConnected = false;// 修改状态为断开
}
@Override
public void run() {
String message = "";
while (true) {
try {
message = reader.readLine();
StringTokenizer stringTokenizer = new StringTokenizer(message, "/@");
String command = stringTokenizer.nextToken();// 命令
if (command.equals("CLOSE"))// 服务器已关闭命令
{
textArea.append("服务器已关闭!\r\n");
closeCon();// 被动的关闭连接
return;// 结束线程
} else if (command.equals("ADD")) {// 有用户上线更新在线列表
String username = "";
String userIp = "";
if ((username = stringTokenizer.nextToken()) != null
&& (userIp = stringTokenizer.nextToken()) != null) {
User user = new User(username, userIp);
onLineUsers.put(username, user);
listModel.addElement(username);
}
} else if (command.equals("DELETE")) {// 有用户下线更新在线列表
String username = stringTokenizer.nextToken();
User user = (User) onLineUsers.get(username);
onLineUsers.remove(user);
listModel.removeElement(username);
} else if (command.equals("USERLIST")) {// 加载在线用户列表
int size = Integer.parseInt(stringTokenizer.nextToken());
String username = null;
String userIp = null;
for (int i = 0; i < size; i++) {
username = stringTokenizer.nextToken();
userIp = stringTokenizer.nextToken();
User user = new User(username, userIp);
onLineUsers.put(username, user);
listModel.addElement(username);
}
} else if (command.equals("MAX")) {// 人数已达上限
textArea.append(stringTokenizer.nextToken() + stringTokenizer.nextToken() + "\r\n");
closeCon();// 被动的关闭连接
JOptionPane.showMessageDialog(frame, "服务器缓冲区已满!", "错误", JOptionPane.ERROR_MESSAGE);
return;// 结束线程
} else {// 普通消息
textArea.append(message + "\r\n");
}
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
|
[
"[email protected]"
] | |
b9d2480e80c9c66478d23b28140eef5c883566f2
|
c7188abb3f90e15db6d6e07d7d7d56f074e5be5b
|
/src/main/java/pl/example/components/offer/search/SearchHotelDto.java
|
8497c886b73117d0e24f30024c907964ca1bf3ca
|
[
"Apache-2.0"
] |
permissive
|
AndrewAK1619/ParadiseIsland
|
06aa786c548117fc57b0fd54c84fe5f7a03445dd
|
dd39c19b25dabf0b687a41f63ac67d88759067aa
|
refs/heads/master
| 2022-05-14T10:55:23.145818 | 2020-09-22T17:53:24 | 2020-09-22T17:53:24 | 255,694,158 | 3 | 0 |
Apache-2.0
| 2022-05-04T20:30:55 | 2020-04-14T18:36:49 |
Java
|
UTF-8
|
Java
| false | false | 759 |
java
|
package pl.example.components.offer.search;
public class SearchHotelDto {
private Long id;
private String hotelName;
private String country;
private String region;
private String city;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
}
|
[
"[email protected]"
] | |
d542299cfe523d1ffaed5a7dc81c1dea57ddc2be
|
8f838fa3b56c37fcf6eea147d971fb58f2412e39
|
/HeRide Rider/app/src/main/java/com/karru/ApplicationClass.java
|
9dec3d3b2ab57687792810345a76a2dcfdec85b3
|
[] |
no_license
|
therealbop/Android-Rider
|
d37987e3fbfc32c1fa0e6525e3cc47291115c14d
|
b817485c68466a71415163134f1d019ca7d3a150
|
refs/heads/master
| 2021-02-09T18:28:47.211564 | 2020-03-02T09:00:09 | 2020-03-02T09:00:09 | 244,313,313 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 15,021 |
java
|
package com.karru;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.Log;
import androidx.appcompat.app.AppCompatDelegate;
import android.widget.Toast;
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.google.gson.Gson;
import com.karru.api.NetworkService;
import com.karru.dagger.AppComponent;
import com.karru.dagger.DaggerAppComponent;
import com.karru.data.source.local.shared_preference.PreferenceHelperDataSource;
import com.karru.data.source.local.sqlite.SQLiteDataSource;
import com.karru.managers.account.AccountGeneral;
import com.karru.managers.network.ConnectivityReceiver;
import com.karru.managers.network.NetworkStateHolder;
import com.karru.managers.network.RxNetworkObserver;
import com.karru.managers.user_vehicles.MQTTManager;
import com.karru.splash.first.LanguagesList;
import com.karru.util.Alerts;
import com.karru.util.DataParser;
import com.karru.util.ExpireSession;
import com.karru.utility.IsForeground;
import com.karru.utility.Utility;
import com.heride.rider.R;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import androidx.multidex.MultiDex;
import dagger.android.AndroidInjector;
import dagger.android.DaggerApplication;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Response;
import static com.karru.utility.Constants.DEVICE_TYPE;
import static com.karru.utility.Constants.IS_APP_BACKGROUND;
/**
* <h>ApplicationClass</h>
* <p>
* Class to get the application class to
* handle application level apis and
* </P>
*
* @since 12/8/16.
*/
public class ApplicationClass extends DaggerApplication
{
private static final String TAG = "ApplicationClass";
private static AccountManager mAccountManager;
@Inject NetworkService apiService;
@Inject RxConfigCalled rxConfigCalled;
@Inject Alerts alerts;
@Inject NetworkStateHolder networkStateHolder;
@Inject RxNetworkObserver rxNetworkObserver;
@Inject MQTTManager mqttManager;
@Inject ApplicationVersion applicationVersion;
@Inject SQLiteDataSource addressDataSource;
@Inject RxAppVersionObserver rxAppVersionObserver;
@Inject PreferenceHelperDataSource preferenceHelperDataSource;
private CompositeDisposable compositeDisposable;
private static ApplicationClass mInstance;
@Override
public void onCreate()
{
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate();
mInstance = this;
compositeDisposable = new CompositeDisposable();
mAccountManager = AccountManager.get(getApplicationContext());
IsForeground.init(this);
AppsFlyerConversionListener conversionDataListener =
new AppsFlyerConversionListener()
{
@Override
public void onInstallConversionDataLoaded(Map<String, String> map)
{
for (String attrName : map.keySet()) {
Utility.printLog(AppsFlyerLib.LOG_TAG+ "attribute: " + attrName + " = " + map.get(attrName));
}
}
@Override
public void onInstallConversionFailure(String s) {
Utility.printLog(AppsFlyerLib.LOG_TAG+ "error getting conversion data: " + s);
}
@Override
public void onAppOpenAttribution(Map<String, String> map) {
}
@Override
public void onAttributionFailure(String s) {
Utility.printLog(AppsFlyerLib.LOG_TAG+ "error onAttributionFailure : " + s);
}
};
AppsFlyerLib.getInstance().init(getString(R.string.AF_DEV_KEY), conversionDataListener, getApplicationContext());
AppsFlyerLib.getInstance().startTracking(this);
Utility.printLog(TAG+" preferenceHelperDataSource.getLanguageSettings() "+
preferenceHelperDataSource.getLanguageSettings());
if (preferenceHelperDataSource.getLanguageSettings() == null)
preferenceHelperDataSource.setLanguageSettings(new LanguagesList("en","English", 0));
changeLangConfig();
IsForeground.get(this).addListener(new IsForeground.Listener()
{
@Override
public void onBecameForeground()
{
IS_APP_BACKGROUND = false;
if (preferenceHelperDataSource.isLoggedIn())
{
mqttManager.createMQttConnection(new com.karru.util.Utility().getDeviceId(getApplicationContext())+"_"+
preferenceHelperDataSource.getSid());
getConfigurations(true);
}
}
@Override
public void onBecameBackground()
{
IS_APP_BACKGROUND = true;
if(mqttManager.isMQTTConnected())
{
mqttManager.unSubscribeToTopic(preferenceHelperDataSource.getMqttTopic());
mqttManager.disconnect();
}
compositeDisposable.clear();
}
});
}
public void setConnectivityListener(ConnectivityReceiver.ConnectivityReceiverListener listener)
{
ConnectivityReceiver.connectivityReceiverListener = listener;
}
/**
* <h2>changeLangConfig</h2>
* used to change the language configuration
*/
public void changeLangConfig()
{
com.karru.util.Utility.changeLanguageConfig(preferenceHelperDataSource.getLanguageSettings()
.getCode(),this);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Utility.printLog(TAG+" langguage change "+newConfig.locale);
}
public static synchronized ApplicationClass getInstance() {
return mInstance;
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
@Override
protected AndroidInjector<? extends DaggerApplication> applicationInjector() {
AppComponent appComponent = DaggerAppComponent.builder().application(this).build();
appComponent.inject(this);
return appComponent;
}
/**
* <h2>addAccount</h2>
* This method is used to set the auth token by creating the account manager with the account
*
* @param emailID email ID to be added
*/
public void setAuthToken(String emailID, String password, String authToken) {
Account account = new Account(emailID, AccountGeneral.ACCOUNT_TYPE);
mAccountManager.addAccountExplicitly(account, password, null);
mAccountManager.setAuthToken(account, AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS, authToken);
}
/**
* <h2>getAuthToken</h2>
* This method is used to get the auth token from the created account
*
* @return auth token stored
*/
public String getAuthToken(String emailID) {
Account[] account = mAccountManager.getAccountsByType(AccountGeneral.ACCOUNT_TYPE);
List<Account> accounts = Arrays.asList(account);
Utility.printLog(TAG + "auth token from size " + accounts.size() + " " + emailID);
if (accounts.size() > 0) {
for (int i = 0; i < accounts.size(); i++) {
Utility.printLog(TAG + "auth token from size " + accounts.get(i).name);
if (accounts.get(i).name.equals(emailID))
return mAccountManager.peekAuthToken(accounts.get(i), AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS);
else
removeAccount(accounts.get(i).name);
}
}
return null;
}
/**
* <h2>removeAccount</h2>
* This method is used to remove the account stored
*
* @param emailID email ID of the account
*/
public void removeAccount(String emailID)
{
Account[] account = mAccountManager.getAccountsByType(AccountGeneral.ACCOUNT_TYPE);
List<Account> accounts = Arrays.asList(account);
Utility.printLog(TAG + "auth token from size " + accounts.size() + " " + emailID);
if (accounts.size() > 0) {
for (int i = 0; i < accounts.size(); i++)
{
if (accounts.get(i).name.equals(emailID))
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1)
Utility.printLog("account removed " + mAccountManager.removeAccountExplicitly(accounts.get(i)));
}
}
}
}
/**
* <h2>getConfigurations</h2>
* This method is used to call API to get the configurations
*
* @param isToRestartMQTT boolean is to whether to restart MQTT
*/
public void getConfigurations(final boolean isToRestartMQTT)
{
Observable<Response<ConfigResponseModel>> request = apiService.getConfigurations(
getAuthToken(preferenceHelperDataSource.getSid()),
preferenceHelperDataSource.getLanguageSettings().getCode(), DEVICE_TYPE);
request.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Response<ConfigResponseModel>>() {
@Override
public void onSubscribe(Disposable d) {
compositeDisposable.add(d);
}
@Override
public void onNext(Response<ConfigResponseModel> result)
{
switch (result.code())
{
case 401:
case 404:
case 500:
try
{
Toast.makeText(getApplicationContext(), DataParser.fetchErrorMessage1(result.errorBody().string()), Toast.LENGTH_LONG).show();
ExpireSession.refreshApplication(getApplicationContext(),mqttManager,
preferenceHelperDataSource,addressDataSource);
}
catch (IOException e)
{
e.printStackTrace();
}
break;
case 200:
ConfigurationDataModel configurationDataModel = result.body().getData();
Log.d("Response","Resonse : "+new Gson().toJson(result.body().toString()));
if(configurationDataModel.getCustomerApiInterval()>0)
preferenceHelperDataSource.setCustomerApiInterval(configurationDataModel.getCustomerApiInterval());
preferenceHelperDataSource.setLaterBookingBufferTime(configurationDataModel.getRideLaterBookingAppBuffer());
preferenceHelperDataSource.setStripeKey(configurationDataModel.getStripePublishKey());
preferenceHelperDataSource.setGoogleServerKeys(configurationDataModel.getCustomerGooglePlaceKeys());
preferenceHelperDataSource.setEmergencyContactLimit(configurationDataModel.getCustomerEmergencyContactLimit());
preferenceHelperDataSource.setTWILIOCallEnable(configurationDataModel.isTwillioCallingEnable());
preferenceHelperDataSource.setReferralCodeEnabled(configurationDataModel.isReferralCodeEnable());
preferenceHelperDataSource.setChatModuleEnable(configurationDataModel.isChatModuleEnable());
preferenceHelperDataSource.setHelpModuleEnable(configurationDataModel.getHelpCenterEnable());
// if (configurationDataModel.getCustomerGooglePlaceKeys().size() > 0)
// preferenceHelperDataSource.setGoogleServerKey(configurationDataModel.getCustomerGooglePlaceKeys().get(0));
preferenceHelperDataSource.setGoogleServerKey(configurationDataModel.getGoogleMapKey());
// Log.d("Test","Google Key From Server: "+configurationDataModel.getGoogleMapKey());
Utility.printLog(TAG+ " ETA TEST current API key " + preferenceHelperDataSource.getGoogleServerKey());
applicationVersion.setCurrenctAppVersion(configurationDataModel.getAppVersion());
applicationVersion.setCurrenctAppVersion(configurationDataModel.getAppVersion());
applicationVersion.setMandatoryUpdateEnable(configurationDataModel.isMandatoryUpdateEnable());
if(isToRestartMQTT)
rxAppVersionObserver.publishApplicationVersion(applicationVersion);
rxConfigCalled.publishStatusOfConfig(true);
break;
case 502:
Toast.makeText(getApplicationContext(), ApplicationClass.this.getString(R.string.bad_gateway), Toast.LENGTH_LONG).show();
break;
default:
try
{
Toast.makeText(getApplicationContext(), DataParser.fetchErrorMessage1(result.errorBody().string()), Toast.LENGTH_LONG).show();
} catch (IOException e)
{
e.printStackTrace();
}
break;
}
}
@Override
public void onError(Throwable errorMsg)
{
Utility.printLog(TAG + " getConfigurations onAddCardError " + errorMsg);
}
@Override
public void onComplete()
{
Utility.printLog(TAG + " getConfigurations onComplete ");
}
});
}
}
|
[
"[email protected]"
] | |
a0b7eb35d002454d0732cdca489e34b582414f2a
|
5f954c33b582f6e01c22bf56e4b131de97608211
|
/lis-commons-util/src/main/java/com/link_intersystems/util/Loop.java
|
d7550aeb2fef95b16291afb5d67972a0479a2b5f
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
link-intersystems/lis-commons
|
bb94fa9e273feaa3714eb1b2464943c00366bc30
|
8ac73983600c99699989d34d9fdb23c5d5551345
|
refs/heads/main
| 2023-07-09T20:43:30.395494 | 2023-06-16T07:24:06 | 2023-06-16T07:49:20 | 28,567,154 | 0 | 1 |
Apache-2.0
| 2023-09-03T12:32:26 | 2014-12-28T17:16:44 |
Java
|
UTF-8
|
Java
| false | false | 2,468 |
java
|
package com.link_intersystems.util;
/**
* A configurable implementation of a loop that can be used in main methods in order to
* execute a specific task for a number of times. E.g. like the command line util ping does.
*
* @author René Link {@literal <[email protected]>}
*/
public class Loop {
private static interface LoopImplementor {
public boolean hasNext();
default public void next() {
}
}
private static class BoundedLoopImplementor implements LoopImplementor {
private int i;
private int max;
public BoundedLoopImplementor(int max) {
this.max = max;
}
@Override
public boolean hasNext() {
return i < max;
}
@Override
public void next() {
i++;
}
}
private int maxIterations;
private int inc;
private long lagDurationMs;
public Loop() {
setMaxIterations(1);
setLagDurationMs(1000);
}
public void execute(Runnable runnable) throws InterruptedException {
LoopImplementor loopImplementor = getLoopImplementor();
while (loopImplementor.hasNext()) {
runnable.run();
loopImplementor.next();
if (loopImplementor.hasNext()) {
sleep(lagDurationMs);
}
}
}
protected LoopImplementor getLoopImplementor() {
if(inc == 0){
return () -> true;
} else {
return new BoundedLoopImplementor(maxIterations);
}
}
protected int getInc() {
return inc;
}
protected void sleep(long millis) throws InterruptedException {
Thread.sleep(millis);
}
public void setMaxIterations(int maxIterations) {
if (maxIterations < 0) {
throw new IllegalArgumentException("max must be 0 or greater");
}
this.maxIterations = maxIterations;
this.inc = 1;
}
public void setInfinite(boolean infinite) {
this.inc = infinite ? 0 : 1;
}
public void setLagDurationMs(long lagDurationMs) {
if (lagDurationMs < 0) {
throw new IllegalArgumentException("lagDurationMs must be a positive integer.");
}
this.lagDurationMs = lagDurationMs;
}
public long getLagDurationMs() {
return lagDurationMs;
}
public int getMaxIterations() {
return maxIterations;
}
}
|
[
"[email protected]"
] | |
4fdfeb42113cb4ffb013d78c6834a2888fa24e21
|
67ec6f945330e63abd40e6652a939148d894b929
|
/SimpleOperationsCalculations/WeatherForecast2.java
|
9908a310eaf534900ffd6616e67718f15947c223
|
[] |
no_license
|
kokovtbg/Java-Programming-Basics
|
3e42c1a0678861468fc475ca3bab95b1a51783cf
|
007dcdda0a6084aa820532d07df6bbfe1aa6b7ff
|
refs/heads/main
| 2023-08-29T12:05:45.500419 | 2021-10-20T17:21:43 | 2021-10-20T17:21:43 | 416,336,547 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 891 |
java
|
package SimpleOperationsCalculations;
import java.util.Scanner;
public class WeatherForecast2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double celsius = Double.parseDouble(scan.nextLine());
if (celsius < 5) {
System.out.println("unknown");
} else if (celsius < 35 && celsius >= 26) {
System.out.println("Hot");
} else if (celsius < 26 && celsius >= 20.1 ) {
System.out.println("Warm");
} else if (celsius < 20.1 && celsius >= 15) {
System.out.println("Mild");
} else if (celsius < 15 && celsius >= 12) {
System.out.println("Cool");
} else if (celsius < 12 && celsius >= 5) {
System.out.println("Cold");
} else {
System.out.println("unknown");
}
}
}
|
[
"[email protected]"
] | |
f8bc9b1ab01c90fe2daa233f53e4d321c0bf1f54
|
ae5a36287701d17412143c4f611075cbfd480595
|
/src/main/java/com/ss/utopia/menu/admin/employee/EmployeeViewOperation.java
|
42c8f9a3e81c74466d5bdebb86bfa09bca8aaf24
|
[] |
no_license
|
psamsotha-ss/utopia-airline
|
7bf2f898913b2624388c27fd6a11cb556a6ff824
|
e0b352626cd960d133ea46998c9596cae0135aa7
|
refs/heads/main
| 2023-07-09T14:26:58.824181 | 2021-08-10T00:22:15 | 2021-08-10T00:22:15 | 390,541,409 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 752 |
java
|
package com.ss.utopia.menu.admin.employee;
import com.ss.utopia.domain.User;
import com.ss.utopia.menu.AbstractViewOperation;
import static com.ss.utopia.util.StringUtils.newLine;
class EmployeeViewOperation extends AbstractViewOperation<User> {
EmployeeViewOperation(User employee) {
super(employee);
}
@Override
protected String formatObject(User employee) {
return " Give name:\t" + employee.getGivenName() + newLine()
+ " Family name:\t" + employee.getFamilyName() + newLine()
+ " Username:\t\t" + employee.getUsername() + newLine()
+ " Email:\t\t" + employee.getEmail() + newLine()
+ " Phone:\t\t" + employee.getPhone() + newLine();
}
}
|
[
"[email protected]"
] | |
736f87c489117ef23c98982e8db60602344fe68a
|
b2c82e7de93e8a78ff92303300dff60523b7c253
|
/Simon/Simon/src/simon/Simon.java
|
e0f95d80e8844abff51ad1925ca782997c4872c5
|
[] |
no_license
|
Mike-Brice/Java
|
60001908e4136450e15a08c86cb3012b921b3cb6
|
ef03ce27dfdb0a96772da386c59f0569ef0c576b
|
refs/heads/master
| 2021-08-03T10:19:59.872500 | 2020-06-23T23:45:34 | 2020-06-23T23:45:34 | 187,128,650 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,138 |
java
|
/*
* Copyright (C) 2017 Couchoutput Studios
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* This program is intended to be an education tool
*/
package simon;
/**
*
* @author micha
*/
public class Simon {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
new Simon().run();
}
public void run() {
SimonGUI simon = new SimonGUI();
simon.play();
}
}
|
[
"[email protected]"
] | |
59767cb829d4e34593ffa603d71584eab7585e80
|
4ca23739c727c8731466971d8a012cf16baab0e4
|
/rgaa-middleware/src/main/java/com/urbilog/rgaa/middleware/security/UnauthorizedEntryPoint.java
|
db82afa1814897037f6e8fe571e48dd824340498
|
[] |
no_license
|
AlexisLambois/ProjetAnnuel
|
c8dafb2a4098805ab20ab36f9e1d15c303b7d3f4
|
e4f2db770a1cf6eb52564394d7eca08d96ff0d96
|
refs/heads/master
| 2022-12-21T20:42:35.281424 | 2019-06-16T14:25:03 | 2019-06-16T14:25:03 | 157,683,719 | 2 | 0 | null | 2022-12-16T00:00:59 | 2018-11-15T09:14:23 |
HTML
|
UTF-8
|
Java
| false | false | 931 |
java
|
package com.urbilog.rgaa.middleware.security;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.stereotype.Component;
/**
* {@link AuthenticationEntryPoint} that rejects all requests with an
* unauthorized error message.
*
* @author Philip W. Sorst <[email protected]>
*/
@Component
public class UnauthorizedEntryPoint implements AuthenticationEntryPoint {
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
"Unauthorized: Authentication token was either missing or invalid.");
}
}
|
[
"[email protected]"
] | |
988808f6a77ec36e346589ee1d4d2fb58646f926
|
2f589a841e11284e66fbdaf4a05059ef4cfe4b1c
|
/src/chapter05/Chapter5.java
|
8c2ba7392d30d6d95fbb974f10fe8cbdd3420f94
|
[] |
no_license
|
Idhar/cracking-the-coding-interview-solutions
|
e29f2eeec82cc547a184b3e312ae6e70a41f8f55
|
b418778a34baecaaae747652e4e9c7f891f0b9f0
|
refs/heads/master
| 2021-01-21T20:19:12.696424 | 2017-04-02T05:00:02 | 2017-04-02T05:00:02 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,334 |
java
|
package chapter05;
import java.util.ArrayList;
import java.util.BitSet;
public class Chapter5 {
public static void main (String [] args) {
test_FivePoint1();
test_FivePoint2();
test_FivePoint3();
// 5.4 --- did not require coding. Solution: it just checks if n is a power of 2
test_FivePoint5();
// 5.6 --- Exactly same as book code. No need to test.
test_FivePoint7();
// 5.8 --- Did not do testing since code is same as book's.
}
public static void test_FivePoint1() {
System.out.println("*** Test 5.1: Insert M into N");
int result = FivePoint1.insert_M_into_N(0b10000000000, 0b10011, 2, 6);
System.out.println(Integer.toBinaryString(result));
}
public static void test_FivePoint2() {
System.out.println("\n*** Test 5.2: Decimal as Binary");
double decimal = 0.625;
System.out.println("Decimal: " + decimal + " Binary: " + FivePoint2.printBinary(decimal));
decimal = 0.3;
System.out.println("Decimal: " + decimal + " Binary: " + FivePoint2.printBinary(decimal));
}
public static void test_FivePoint3() {
System.out.println("\n*** Test 5.3");
System.out.println("\nOriginal = 4");
System.out.println("Smaller = " + FivePoint3.getPrev(4));
System.out.println("Larger = " + FivePoint3.getNext(4));
System.out.println("\nOriginal = 15");
System.out.println("Smaller = " + FivePoint3.getPrev(15));
System.out.println("Larger = " + FivePoint3.getNext(15));
}
public static void test_FivePoint5() {
System.out.println("\n*** Test 5.5: Flipping Bits to convert a number to another");
System.out.println("Bits required for converting 31 to 14 = " + FivePoint5.bitsRequired(31, 14));
System.out.println("Bits required for converting 7 to 15 = " + FivePoint5.bitsRequired(7, 15));
}
public static void test_FivePoint7() {
System.out.println("\n*** Test 5.7: Finding missing number");
ArrayList<BitSet> array = new ArrayList<>();
// Testing note: I have to test this with all (except one) of the 3-digit binary numbers, since I set BitInteger.INTEGER_SIZE to 3
for (int i = 0; i < 8; i++) {
if (i != 2) { // will have numbesr 0-7, but skips 2
array.add(BitSet.valueOf(new long[]{i}));
}
}
int missing = FivePoint7.findMissing(array);
System.out.println("Missing # should be 2 (since array has 0 to 7, without 2) = " + missing);
}
}
|
[
"[email protected]"
] | |
9949fbd408bcf91f505542c4d44e8ae6917408e9
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/29/29_2e71f5d9a17a6473c882a9472bf2571dc5a7442a/ModuleVCF_LP/29_2e71f5d9a17a6473c882a9472bf2571dc5a7442a_ModuleVCF_LP_s.java
|
5ef6bcc030032c907f080a90be4594288708d24a
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 5,288 |
java
|
package fr.istic.synthlab.abstraction.module.vcf;
import java.util.ArrayList;
import java.util.List;
import com.jsyn.unitgen.FilterLowPass;
import com.jsyn.unitgen.PassThrough;
import com.jsyn.unitgen.UnitGenerator;
import fr.istic.synthlab.abstraction.filter.FrequencyModulatorFilter;
import fr.istic.synthlab.abstraction.module.AModule;
import fr.istic.synthlab.abstraction.observer.Observer;
import fr.istic.synthlab.abstraction.port.IInputPort;
import fr.istic.synthlab.abstraction.port.IOutputPort;
import fr.istic.synthlab.abstraction.port.Port;
import fr.istic.synthlab.abstraction.wire.IWire;
import fr.istic.synthlab.factory.impl.PACFactory;
public class ModuleVCF_LP extends AModule implements IModuleVCF, Observer<Port> {
private static final String MODULE_NAME = "VCFA LP24";
private static final String IN_NAME = "Input";
private static final String IN_MOD_FREQ_NAME = "FM";
private static final String OUT_NAME = "Output";
// FM Perso
private FrequencyModulatorFilter frequencyModulator;
// PassThrough
private PassThrough passThrough;
// Input & Output du module
private IInputPort input;
private IInputPort fm;
private IOutputPort output;
// Filtres de fréquence JSyn
private FilterLowPass filterJSyn1;
private FilterLowPass filterJSyn2;
public ModuleVCF_LP() {
super(MODULE_NAME);
System.out.println("ModuleVCFA LP24 initialized");
// Création des filtres JSyn
this.filterJSyn1 = new FilterLowPass();
this.filterJSyn2 = new FilterLowPass();
// Conection des filtres JSyn
this.filterJSyn1.output.connect(this.filterJSyn2.input);
// Création du modulateur de fréquence
this.frequencyModulator = new FrequencyModulatorFilter(1000);
// Création d'un module distribuant la nouvelle fréquence
this.passThrough = new PassThrough();
// Connexion du modulateur au PassThrough
frequencyModulator.output.connect(passThrough.input);
// Création d'un port d'entrée sur le générateur perso
this.fm = PACFactory.getFactory().newInputPort(this, IN_MOD_FREQ_NAME,
frequencyModulator.input);
this.fm.addObserver(this);
// Création des ports d'entrée sur le filtre JSyn 1
this.input = PACFactory.getFactory().newInputPort(this, IN_NAME,
filterJSyn1.input);
// Création du port de sortie sur le filtre JSyn 2
this.output = PACFactory.getFactory().newOutputPort(this, OUT_NAME,
filterJSyn2.output);
// Valeur par defaut
this.setCutFrequency(1000);
this.setResonance(1);
// Set de la frequence de coupure de base
filterJSyn1.frequency.set(getCutFrequency());
filterJSyn2.frequency.set(getCutFrequency());
addPort(input);
addPort(fm);
addPort(output);
}
@Override
public List<UnitGenerator> getJSyn() {
List<UnitGenerator> generators = new ArrayList<UnitGenerator>();
generators.add(filterJSyn1);
generators.add(filterJSyn2);
generators.add(frequencyModulator);
generators.add(passThrough);
return generators;
}
@Override
public void start() {
this.filterJSyn1.start();
this.filterJSyn2.start();
this.frequencyModulator.start();
this.passThrough.start();
}
@Override
public void stop() {
this.filterJSyn1.stop();
this.filterJSyn2.stop();
this.frequencyModulator.stop();
this.passThrough.stop();
}
@Override
public void setCutFrequency(int value) {
getParameters().put("cutFrequency", (double) value);
updateFrequency();
}
@Override
public int getCutFrequency() {
return getParameter("cutFrequency").intValue();
}
@Override
public void setResonance(double value) {
getParameters().put("resonance", (double) value);
this.filterJSyn1.Q.set(value);
}
@Override
public double getResonance() {
return getParameter("resonance");
}
private void updateFrequency() {
this.frequencyModulator.setBaseFrequency(getCutFrequency());
if (!getInputFm().isInUse()) {
filterJSyn1.frequency.set(getCutFrequency());
filterJSyn2.frequency.set(getCutFrequency());
}
}
@Override
public IInputPort getInput() {
return input;
}
@Override
public IInputPort getInputFm() {
return fm;
}
@Override
public IOutputPort getOutput() {
return output;
}
@Override
public List<IWire> getWires() {
List<IWire> wires = new ArrayList<IWire>();
if (input.getWire() != null) {
if(!wires.contains(input.getWire()))
wires.add(input.getWire());
}
if (fm.getWire() != null) {
if(!wires.contains(fm.getWire()))
wires.add(fm.getWire());
}
if (output.getWire() != null) {
if(!wires.contains(output.getWire()))
wires.add(output.getWire());
}
return wires;
}
@Override
public void update(Port subject) {
// Lors d'un event sur le port d'entrée
if (subject == fm) {
// En cas de connection
if (fm.isInUse()) {
// Connect the frequency modulator to the output
passThrough.output.connect(filterJSyn1.frequency);
passThrough.output.connect(filterJSyn2.frequency);
} else {
// En cas de déconnection
passThrough.output.disconnectAll();
filterJSyn1.frequency.set(getCutFrequency());
filterJSyn2.frequency.set(getCutFrequency());
}
}
}
}
|
[
"[email protected]"
] | |
bd8ff8423050714ce6cc02e13f1cd18a0394a771
|
c93d57edc5337e479230150b3bb3833c9a1cce3e
|
/src/com/javarush/test/level18/lesson10/home10/Solution.java
|
321df1092a02b57f80f25e04100c31e82490f40c
|
[] |
no_license
|
Lao-Ax/JavaRushHomeWork
|
fe1cbafc41a57a3bcb5804337ab10474ba34948a
|
d33681fad5d6f891609e1ff1bc51ae104476b7af
|
refs/heads/master
| 2023-01-28T22:01:36.059968 | 2023-01-15T13:11:46 | 2023-01-15T14:28:05 | 264,274,037 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,235 |
java
|
package com.javarush.test.level18.lesson10.home10;
/* Собираем файл
Собираем файл из кусочков
Считывать с консоли имена файлов
Каждый файл имеет имя: [someName].partN. Например, Lion.avi.part1, Lion.avi.part2, ..., Lion.avi.part37.
Имена файлов подаются в произвольном порядке. Ввод заканчивается словом "end"
В папке, где находятся все прочтенные файлы, создать файл без приставки [.partN]. Например, Lion.avi
В него переписать все байты из файлов-частей используя буфер.
Файлы переписывать в строгой последовательности, сначала первую часть, потом вторую, ..., в конце - последнюю.
Закрыть потоки. Не использовать try-with-resources
*/
import java.io.*;
import java.util.Map;
import java.util.TreeMap;
public class Solution {
public static void main(String[] args) throws IOException{
Map<Integer, String> files = new TreeMap<>();
BufferedReader fileNameReader = new BufferedReader(new InputStreamReader(System.in));
String consoleInput;
while (!(consoleInput = fileNameReader.readLine()).equals("end")) {
int part = Integer.parseInt(consoleInput.substring(consoleInput.lastIndexOf(".")+1).replace("part",""));
files.put(part, consoleInput);
}
fileNameReader.close();
String resultFileName = files.get(1).substring(0, files.get(1).lastIndexOf("."));
System.out.println(resultFileName);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(resultFileName));
for (int i = 1; i <= files.size(); i++) {
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(files.get(i)));
byte[] fileContent = new byte[bis.available()];
bis.read(fileContent);
bos.write(fileContent);
bos.flush();
bis.close();
}
bos.close();
}
}
|
[
"[email protected]"
] | |
04b5be08cb3ebbd1ee0d885880670e2ecd160e87
|
bd58dd51e1d1c202a422897c2113e8f4ec619a28
|
/maven-bank-example/src/main/java/testing/example/bank/BankAccount.java
|
7064f6f9fa8c733d74a4ae50b8fe76616c09d2e1
|
[] |
no_license
|
MassimilianoMancini/maven-bank-example
|
4938cffc317c44ee35ab5145948afb245f389eb1
|
90e9df844063ed86afc1a25057d2c9f3f29bf1c7
|
refs/heads/main
| 2023-07-06T04:17:37.573240 | 2021-08-10T15:31:39 | 2021-08-10T15:31:39 | 393,025,035 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 825 |
java
|
package testing.example.bank;
public class BankAccount {
private int id;
private double balance = 0;
private static int lastId = 0;
public BankAccount() {
this.id = ++lastId;
}
public int getId() {
return id;
}
public double getBalance() {
return balance;
}
public void deposit(double amount) {
handleNegativeAmount(amount);
balance += amount;
}
private void handleNegativeAmount(double amount) {
if (amount < 0) {
throw new IllegalArgumentException("Negative amount: " + amount);
}
}
public void withdraw(double amount) {
handleNegativeAmount(amount);
if (balance - amount < 0) {
throw new IllegalArgumentException("Cannot withdraw " + amount + " from " + balance);
}
balance -= amount;
}
void setBalance(double balance) {
this.balance = balance;
}
}
|
[
"[email protected]"
] | |
45b8fd057c7aaf5a499ef8857f1f5fbf5b2584f9
|
efb35aebd8d81f521abb9c6db9e20b8c3d8b0d70
|
/black-shop-service-api/black-shop-service-api-user/black-shop-service-api-user-security/src/main/java/cn/blackshop/service/api/user/security/UserSecurityService.java
|
22ff151e58b4b840e2a1d902214fc96d8d73abd4
|
[
"Apache-2.0"
] |
permissive
|
walter211/black-shop
|
5b91a06f5bb4d7cdca40454d106334355f503df1
|
df14f89ac81901c868420f90c01d6b775204f759
|
refs/heads/master
| 2020-04-17T16:11:46.772598 | 2019-01-23T04:14:50 | 2019-01-23T04:14:50 | 166,730,806 | 0 | 0 |
Apache-2.0
| 2019-01-23T04:14:51 | 2019-01-21T01:39:58 |
Java
|
UTF-8
|
Java
| false | false | 441 |
java
|
/**
* <p>Company: www.black-shop.cn</p>
* <p>Copyright: Copyright (c) 2018</p>
* @version 1.0
* black-shop(黑店) 版权所有,并保留所有权利。
*/
package cn.blackshop.service.api.user.security;
/**
* <p>Title: UserSecurityService</p>
* <p>Description: </p>
* @author zibin
* @date 2018年12月11日
*/
public interface UserSecurityService {
abstract String UserAuthentication(String userName);
}
|
[
"[email protected]"
] | |
253f2e93d3856f214d1a721c606ba5896b164f11
|
763f140e2eb16bb0a640b3b0989006c575f34b9a
|
/src/main/java/pk/home/busterminal/web/jsf/security/LoginErrorPhaseListener.java
|
a1332e77b9267e54c9cf3b0b562efd95da02d2aa
|
[
"Apache-2.0"
] |
permissive
|
povloid/busterminal
|
aa6f457d431e66873247c055e416dc04a41c8862
|
3b32db26cd1855ca8e8fe72dde32be33b7d81db8
|
refs/heads/master
| 2023-03-07T21:37:39.198011 | 2021-07-20T12:04:05 | 2021-07-20T12:04:05 | 60,454,839 | 0 | 0 |
Apache-2.0
| 2023-02-22T02:05:12 | 2016-06-05T10:31:45 |
Java
|
UTF-8
|
Java
| false | false | 1,673 |
java
|
package pk.home.busterminal.web.jsf.security;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.web.WebAttributes;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
/**
*
* Код позаимствован у:
* User: Dmitry Leontyev
* Date: 12.12.10
* Time: 21:45
*
* доработан:
* @author povloid
*/
public final class LoginErrorPhaseListener implements PhaseListener {
/**
*
*/
private static final long serialVersionUID = 1L;
/* (non-Javadoc)
* @see javax.faces.event.PhaseListener#beforePhase(javax.faces.event.PhaseEvent)
*/
@Override
public void beforePhase(final PhaseEvent arg0) {
Exception e = (Exception) FacesContext.getCurrentInstance()
.getExternalContext().getSessionMap()
.get(WebAttributes.AUTHENTICATION_EXCEPTION);
if (e instanceof BadCredentialsException) {
FacesContext.getCurrentInstance().getExternalContext()
.getSessionMap()
.put(WebAttributes.AUTHENTICATION_EXCEPTION, null);
FacesContext.getCurrentInstance().addMessage(
null,
new FacesMessage(FacesMessage.SEVERITY_ERROR,
"Username or password not valid.", null));
}
}
/* (non-Javadoc)
* @see javax.faces.event.PhaseListener#afterPhase(javax.faces.event.PhaseEvent)
*/
@Override
public void afterPhase(final PhaseEvent arg0) {
}
/* (non-Javadoc)
* @see javax.faces.event.PhaseListener#getPhaseId()
*/
@Override
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
}
|
[
"[email protected]"
] | |
bbfeaa9284d4e15dc25e8832e38776aa0ba4c646
|
2cea4b28b0a4eb1beb80ab9659f3bf9410698cf0
|
/java/All program/SerializeDemo1.java
|
375a18a7c41e77c56e1ff567b71d43e5d974bdf3
|
[] |
no_license
|
rajeshmorya/Core-java
|
e1e96b4c257ad2e854bcfe2e20b65769aef4d6c3
|
b978193bed637cbf180470b671afaf0f8fdedb79
|
refs/heads/master
| 2020-12-10T11:38:40.210108 | 2020-01-13T12:17:23 | 2020-01-13T12:17:23 | 233,583,010 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 687 |
java
|
import java.io.*;
class Dog implements Serializable
{
int i=10;
int j=20;
}
class SerializeDemo1
{
public static void main(String[] args) throws Exception
{
Dog d1 = new Dog();
System.out.println("serialization started");
FileOutputStream fos = new FileOutputStream("abc.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(d1);
System.out.println("serializable ended");
System.out.println("Deserializable started");
FileInputStream fis = new FileInputStream("abc.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
Dog d2 = (Dog)ois.readObject();
System.out.println("Deserialization ended");
System.out.println(d2.i+"---------"+d2.j);
}
}
|
[
"[email protected]"
] | |
ec496264a8ed1fc88224af31c9f7d37b792ecf9f
|
ed166738e5dec46078b90f7cca13a3c19a1fd04b
|
/minor/guice-OOM-error-reproduction/src/main/java/gen/S_Gen68.java
|
c0636f868a6b4e47c2f9986a87ff1845a8323b05
|
[] |
no_license
|
michalradziwon/script
|
39efc1db45237b95288fe580357e81d6f9f84107
|
1fd5f191621d9da3daccb147d247d1323fb92429
|
refs/heads/master
| 2021-01-21T21:47:16.432732 | 2016-03-23T02:41:50 | 2016-03-23T02:41:50 | 22,663,317 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 326 |
java
|
package gen;
public class S_Gen68 {
@com.google.inject.Inject
public S_Gen68(S_Gen69 s_gen69){
System.out.println(this.getClass().getCanonicalName() + " created. " + s_gen69 );
}
@com.google.inject.Inject public void injectInterfaceWithoutImpl(gen.InterfaceWithoutImpl i){} // should expolode :)
}
|
[
"[email protected]"
] | |
5b178425173f476f119fd79b3d158210b89b94e8
|
7a91f9493272413b71e4f86e7157352537e34236
|
/app/src/main/java/edu/isu/cs2263/hw01/App.java
|
747ea5c29321a75ddab41ad881949099cc423b38
|
[] |
no_license
|
evankaid/cs2263_hw01
|
8dad8bf09b182bb0be8f0e401c21717d551905ff
|
0b61fa82c26174edbb74ac20d2c24d0185316d6b
|
refs/heads/main
| 2023-08-10T03:06:47.259678 | 2021-09-16T20:05:15 | 2021-09-16T20:05:15 | 406,449,306 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,841 |
java
|
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package edu.isu.cs2263.hw01;
import org.apache.commons.cli.*;
//import jdk.internal.joptsimple.HelpFormatter;
import java.io.IOException;
import java.nio.file.*;
public class App {
public static void main(String[] args) {
Options options = createOptions();
CommandLineParser parser = new DefaultParser();
try {
CommandLine cmd = parser.parse(options, args);
if(cmd.hasOption("help")){
System.out.println("hi");
printHelpMessage(options);
System.exit(0);
} else {
batchDisplay(cmd);
outputDisplay(cmd);
}
} catch (ParseException e) {
System.out.println("Failed to parse: " + e.getMessage());
}
}
private static Options createOptions(){
Options options = new Options();
Option helpOption = Option.builder("h").longOpt("help").desc("Print usage message.").build();
Option batchOption = Option.builder("b").longOpt("batch").argName("file").hasArg().desc("Batch file that has expressions to evaluate").build();
Option outputOption = Option.builder("o").longOpt("output").argName("file").hasArg().desc("Output File").build();
options.addOption(helpOption);
options.addOption(batchOption);
options.addOption(outputOption);
return options;
}
private static void printHelpMessage(Options options){
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("eval [OPTIONS] \n\n Evaluation of simple mathematical expressions\n\n", options);
}
private static String batchDisplay(CommandLine cmd){
String file = "";
if(cmd.hasOption("batch")){
file = cmd.getOptionValue("batch");
Path filePath = Path.of(file);
if(Files.exists(filePath)){
System.out.println(filePath);
} else {
System.out.println("The file doesn't exist for the batch input.");
System.exit(1);
}
}
return file;
}
private static void outputDisplay(CommandLine cmd){
if(cmd.hasOption("output")){
String file = cmd.getOptionValue("output");
Path filePath = Path.of(file);
try {
Files.deleteIfExists(filePath);
Files.createFile(filePath);
System.out.println(filePath);
} catch(IOException e) {
System.out.println(e.getMessage());
System.exit(1);
}
}
}
public static String getGreeting(){
return "Hi";
}
}
|
[
"[email protected]"
] | |
ba357990ec8293f3bbaa0cb4a6b1b7b9fdcc93f7
|
853fe09f69baf637ea02beb1644ed6a454f31a9b
|
/rpc-services/rpc-services-provider/src/main/java/com/zy/rpc/services/api/impl/spring/SpringRpcService.java
|
4bec371f91543c73e2f987b9415ae2afdcd864c7
|
[] |
no_license
|
ZhangYDevelop/rpc-network-transport
|
916b83a07fcdadc1f89997e96f3f8337b5700914
|
cb25434107f6325229bdb669d65eb6139208cfa3
|
refs/heads/master
| 2021-05-22T00:22:41.748933 | 2020-04-11T01:35:47 | 2020-04-11T01:35:47 | 252,881,619 | 0 | 0 | null | 2020-04-06T15:25:46 | 2020-04-04T01:29:57 |
Java
|
UTF-8
|
Java
| false | false | 1,737 |
java
|
package com.zy.rpc.services.api.impl.spring;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @AUTHOR zhangy
* 2020-04-03 21:28
*/
@SuppressWarnings("all")
@Component
public class SpringRpcService implements ApplicationContextAware , InitializingBean {
private int prot;
private Map<String, Object> serviceMap = new HashMap<>();
private ExecutorService executorService = Executors.newCachedThreadPool();
public SpringRpcService(int prot) {
this.prot = prot;
}
@Override
public void afterPropertiesSet() throws Exception {
ServerSocket serverSocket = null;
serverSocket = new ServerSocket(prot);
while (true) {
Socket socket = serverSocket.accept();
executorService.execute(new SpringSocketHandler(socket, serviceMap ));
}
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
Map<String, Object> servicenams = applicationContext.getBeansWithAnnotation(RpcService.class);
for (Object value : servicenams.values()) {
RpcService rpcService = value.getClass().getAnnotation(RpcService.class);
String serviceName = rpcService.value().getName();
serviceMap.put(serviceName, value);
}
}
}
|
[
"[email protected]"
] | |
0af7f56413de79136a4b44300d74bafafc158198
|
b6bfba71956589aa6f56729ec9ebce824a5fb8f4
|
/src/main/java/com/javapatterns/iterator/goodexample/Client.java
|
b84855cc76f0b7f89a5cbe72927e9afa402f09ec
|
[
"Apache-2.0"
] |
permissive
|
plotor/design-pattern
|
5d78d0ef7349a2d637bea5b7270c9557820e5f60
|
4614bab50921b61610693b9b1ed06feddcee9ce6
|
refs/heads/master
| 2022-12-20T17:49:13.396939 | 2020-10-13T14:37:14 | 2020-10-13T14:37:14 | 67,619,122 | 0 | 0 |
Apache-2.0
| 2020-10-13T14:37:15 | 2016-09-07T15:21:45 |
Java
|
UTF-8
|
Java
| false | false | 567 |
java
|
package com.javapatterns.iterator.goodexample;
import java.util.Hashtable;
import java.util.Vector;
public class Client {
private Vector v = new Vector();
private Hashtable ht = new Hashtable();
private Display disp = new Display();
public static void main(String[] args) {
Client client = new Client();
client.test();
}
public void test() {
System.out.println("Before testing...");
disp.initList(v.elements());
disp.initList(ht.elements());
System.out.println("After testing...");
}
}
|
[
"[email protected]"
] | |
e727e4662d22cbab7deead58b30d8faa540e567d
|
3efa417c5668b2e7d1c377c41d976ed31fd26fdc
|
/src/br/com/mind5/masterData/cartItemCategory/dao/CaritegDaoJoinTxt.java
|
25329e3b49aeb55793c5bc33a867e9e8a2fb635f
|
[] |
no_license
|
grazianiborcai/Agenda_WS
|
4b2656716cc49a413636933665d6ad8b821394ef
|
e8815a951f76d498eb3379394a54d2aa1655f779
|
refs/heads/master
| 2023-05-24T19:39:22.215816 | 2023-05-15T15:15:15 | 2023-05-15T15:15:15 | 109,902,084 | 0 | 0 | null | 2022-06-29T19:44:56 | 2017-11-07T23:14:21 |
Java
|
UTF-8
|
Java
| false | false | 865 |
java
|
package br.com.mind5.masterData.cartItemCategory.dao;
import br.com.mind5.dao.DaoJoin;
import br.com.mind5.dao.DaoJoinBuilder;
import br.com.mind5.dao.DaoJoinBuilderHelper;
import br.com.mind5.dao.DaoJoinType;
import br.com.mind5.dao.common.DaoDbField;
import br.com.mind5.dao.common.DaoDbTable;
public final class CaritegDaoJoinTxt implements DaoJoinBuilder {
private final String leftTable;
public CaritegDaoJoinTxt(String leftTableName) {
leftTable = leftTableName;
}
@Override public DaoJoin build() {
DaoJoinBuilderHelper helper = new DaoJoinBuilderHelper(this.getClass());
helper.addColumn(DaoDbField.COL_COD_ITEM_CATEG);
helper.addJoinType(DaoJoinType.LEFT_OUTER_JOIN);
helper.addLeftTable(leftTable);
helper.addRightTable(DaoDbTable.CART_ITM_CATEG_TEXT_TABLE);
return helper.build();
}
}
|
[
"[email protected]"
] | |
cb2a0e13886a3eaa2677aad03994fdabe1a61b1f
|
f8c123956058bbcc5a882e8e28f4c54f54779782
|
/app/src/test/java/br/com/test/kaioh/exifcamera/ExampleUnitTest.java
|
f908b6dd989ae5a5a2b1ac23094ba71e2e9f511f
|
[] |
no_license
|
kaioshenrique/ExifCamera
|
41f792fc85de095a8987b3db96f2b0ca4cab964c
|
937a71609e9a5e466d19f8712fb1ab188683adad
|
refs/heads/master
| 2021-04-09T15:22:34.898996 | 2018-03-20T17:10:30 | 2018-03-20T17:10:30 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 406 |
java
|
package br.com.test.kaioh.exifcamera;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
84f268220bb016ae3c23b6a97abc2af2d9dc4b1d
|
1f11b787fa46215b7c6b5b9d8088446d48f99886
|
/src/main/java/jpabook/jpashop/dto/OrderItemDto.java
|
1255406df8cf3d786558d4c1ab5518bdcb3e064b
|
[] |
no_license
|
prankbye77/jpashop
|
2af9e90bb9de40948497a7b8cf848a40216b2288
|
74b7536fbea885e2e3d05513daef425b2a983052
|
refs/heads/master
| 2023-04-02T01:40:54.155148 | 2021-04-20T08:17:42 | 2021-04-20T08:17:42 | 349,021,517 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 399 |
java
|
package jpabook.jpashop.dto;
import jpabook.jpashop.domain.OrderItem;
import lombok.Data;
@Data
public class OrderItemDto {
private String itemName;
private int orderPrice;
private int count;
public OrderItemDto(OrderItem orderItem) {
itemName = orderItem.getItem().getName();
orderPrice = orderItem.getOrderPrice();
count = orderItem.getCount();
}
}
|
[
"[email protected]"
] | |
9717dc16fc60e144e76792c8ea3c947a4cf320ea
|
8f89f6abf36672f8c82a9e047c57ea494aa58647
|
/app/src/main/java/ru/boat/view/adapter/AdditionalItemAdapter.java
|
37c0808ca08cbcfd2fe2e0110714449a9583b0e2
|
[] |
no_license
|
kumaser/BoatTestTask
|
96c2fb371d1cf5913896454969bc37b515b6060d
|
afcd42e9527f81102131f5ef134969f22771dab4
|
refs/heads/master
| 2021-08-10T18:03:09.691419 | 2017-11-12T20:54:13 | 2017-11-12T20:54:13 | 110,466,333 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,043 |
java
|
package ru.boat.view.adapter;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import java.util.List;
import ru.boat.R;
import ru.boat.model.data.AdditionalItem;
import ru.boat.view.holders.AdditionalItemViewHolder;
public class AdditionalItemAdapter extends RecyclerView.Adapter<AdditionalItemViewHolder> {
private List<AdditionalItem> items;
public AdditionalItemAdapter(List<AdditionalItem> items) {
this.items = items;
}
@Override
public AdditionalItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
return new AdditionalItemViewHolder(inflater.inflate(R.layout.item_additional_inside, parent, false));
}
@Override
public void onBindViewHolder(AdditionalItemViewHolder holder, int position) {
holder.bind(items.get(position));
}
@Override
public int getItemCount() {
return items.size();
}
}
|
[
"[email protected]"
] | |
d0dd760259b1685077e632be0a1e9abc6066bfcd
|
7e713646a0619267b421aafa41a9afeeaf7a0108
|
/src/main/java/com/gdztyy/inca/controller/BmsStQtyCutPosController.java
|
e9fd09fe7af1075850c99281406dc6d400a34e6a
|
[] |
no_license
|
liutaota/ipl
|
4757e35d1100ca892f2137b690ee4b43b908dc19
|
9d53b9044ba56b6ea65f1347a779d4b66e075bea
|
refs/heads/master
| 2023-03-21T11:28:42.663574 | 2021-03-05T08:49:33 | 2021-03-05T08:49:33 | 344,747,852 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 332 |
java
|
package com.gdztyy.inca.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
/**
* <p>
* 前端控制器
* </p>
*
* @author peiqy
* @since 2020-08-18
*/
@Controller
@RequestMapping("/inca/bmsStQtyCutPos")
public class BmsStQtyCutPosController {
}
|
[
"[email protected]"
] | |
6415c406bf46732185eb9d8c1fb2f11f66e2b4c2
|
191f0e7cad5e8033bb90650d9b951bc7d1b82537
|
/aliyun-java-sdk-cdn/src/main/java/com/aliyuncs/cdn/model/v20141111/DeleteLivePullStreamInfoResponse.java
|
4910c24da6275e29ee943862a6b51c3707d3399c
|
[
"Apache-2.0"
] |
permissive
|
chunlicui/aliyun-openapi-java-sdk
|
b3fff7f81f8c141ca48e82d5ee7d2cb76f7b9462
|
06acc97ea07766838f24aa8cf4d8d02dd941467c
|
refs/heads/master
| 2020-12-30T23:34:25.723591 | 2016-09-05T10:03:11 | 2016-09-05T10:03:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,491 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.aliyuncs.cdn.model.v20141111;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.cdn.transform.v20141111.DeleteLivePullStreamInfoResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DeleteLivePullStreamInfoResponse extends AcsResponse {
private String requestId;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@Override
public DeleteLivePullStreamInfoResponse getInstance(UnmarshallerContext context) {
return DeleteLivePullStreamInfoResponseUnmarshaller.unmarshall(this, context);
}
}
|
[
"[email protected]"
] | |
8636cf5a220e88bd16f08300c40b8aff8adcf97c
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/2/2_9e708df17a4f297c874de933100b11608835c575/BPermissionsAdapter/2_9e708df17a4f297c874de933100b11608835c575_BPermissionsAdapter_t.java
|
f20d32cf56bba7a893ee0b8e9e3c7b8e1368652f
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 1,312 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.bekvon.bukkit.residence.permissions;
import com.bekvon.bukkit.residence.Residence;
import java.util.List;
import org.bukkit.entity.Player;
import de.bananaco.permissions.Permissions;
/**
*
* @author Administrator
*/
public class BPermissionsAdapter implements PermissionsInterface {
Permissions bperms;
public BPermissionsAdapter(Permissions p)
{
bperms = p;
}
public String getPlayerGroup(Player player) {
return this.getPlayerGroup(player.getName(), player.getWorld().getName());
}
public String getPlayerGroup(String player, String world) {
List<String> groups = Permissions.getWorldPermissionsManager().getPermissionSet(world).getGroups(player);
PermissionManager pmanager = Residence.getPermissionManager();
for(String group : groups)
{
if(pmanager.hasGroup(group))
return group.toLowerCase();
}
if(groups.size()>0)
return groups.get(0).toLowerCase();
return null;
}
public boolean hasPermission(Player player, String permission) {
return player.hasPermission(permission);
}
}
|
[
"[email protected]"
] | |
5605ed0ddcf159a0377ac0b1ea78c3d77b892d5b
|
25e3559f3584ff19d0a19e86c93c09a01ae5b04a
|
/spring-demo-aop-z-after-returning/src/com/naren/aop/AfterRequringMainDemoApp.java
|
c5a7cd1e97d477bddbf17af3e84b10d6df066a00
|
[] |
no_license
|
Naren-Mehta/SpringAOP
|
7b13953c4cfa93b93ab787bf2feceaab84083224
|
44b98b60963cdece96634d2afd8d5e4e8fe8961f
|
refs/heads/master
| 2020-07-06T18:02:00.036322 | 2019-08-19T18:01:10 | 2019-08-19T18:01:10 | 203,098,349 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 915 |
java
|
package com.naren.aop;
import java.util.List;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import com.naren.aop.dao.AccountDAO;
import com.naren.aop.dao.MembershipDAO;
public class AfterRequringMainDemoApp {
public static void main(String[] args) {
// read spring config java class
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(DemoConfig.class);
// get bean from spring container
AccountDAO theAccountDAO = context.getBean("accountDAO", AccountDAO.class);
// call business method
List<Account> listAccounts = theAccountDAO.findAccount();
System.out.println("====================================================================");
System.out.println(listAccounts);
System.out.println("====================================================================");
// close the context
context.close();
}
}
|
[
"[email protected]"
] | |
008e92cec3400f7f0bf160d9b80ed55f5cc8336f
|
d5d6dee91c46932a7ab8c71e743288516479d8c0
|
/src/sample/Cross.java
|
e6ed33d42ebb2d6f94f1ca43f0cf06097f855830
|
[] |
no_license
|
kabir-21/Color-Switch
|
c1c7a39250c2009495854388151efed64f6aed61
|
980b285b5a6d947deee0c9165c2e67f08ccff336
|
refs/heads/master
| 2023-02-02T03:34:48.552854 | 2020-12-17T15:02:25 | 2020-12-17T15:02:25 | 306,031,119 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,403 |
java
|
package sample;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.RotateTransition;
import javafx.animation.Timeline;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.scene.transform.Rotate;
import javafx.util.Duration;
import java.util.ArrayList;
public class Cross extends Obstacles{
private final Rectangle cross1;
private final Rectangle cross2;
private final ArrayList<Rectangle> cross = new ArrayList<>();
private Rotate r1 = new Rotate();
private double pivotX;
private double pivotY;
private Timeline timeline;
Cross(double lenX, double lenY, Color c1, Color c2){
cross1 = new Rectangle();
cross1.setHeight(12);
cross1.setWidth(150);
cross1.setY(lenY);
cross1.setX(lenX);
cross1.setFill(c1);
cross1.setArcWidth(15);
cross1.setArcHeight(15);
cross1.setRotate(90);
cross2 = new Rectangle();
cross2.setHeight(12);
cross2.setWidth(150);
cross2.setY(lenY);
cross2.setX(lenX);
cross2.setFill(c2);
cross2.setArcWidth(15);
cross2.setArcHeight(15);
cross2.setRotate(180);
pivotX = lenX+75;
pivotY = lenY;
r1.setPivotX(this.pivotX);
r1.setPivotY(this.pivotY);
cross1.getTransforms().add(r1);
cross2.getTransforms().add(r1);
timeline = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(r1.angleProperty(), 0)),
new KeyFrame(Duration.seconds(10), new KeyValue(r1.angleProperty(), 360)));
cross.add(cross1); cross.add(cross2);
}
public ArrayList<Rectangle> getCross(){
return cross;
}
@Override
public void move() {
timeline.play();
}
@Override
public double getPositionX() {
return 0;
}
@Override
public double getPositionY() {
return 0;
}
@Override
public void moveDown(double temp) {
for (Rectangle rectangle : cross) {
rectangle.setY(rectangle.getY() - temp);
}
pivotY-=temp;
}
@Override
public ImageView getStarView() {
return null;
}
@Override
public Shape getShape() {
return this.cross1;
}
}
|
[
"[email protected]"
] | |
bd1f67ec388a98c58bb254360cdff61dc69b3f3e
|
ccbbdf20d7fd3741d0edcfc3bbcfb85a2fed9a6f
|
/trunk/FacilityBookingSystem/src/servr/dispatchers/QueryAvailibilityMessageDispatcher.java
|
151da1600b5eada972fa041e034de31371a8a9e3
|
[] |
no_license
|
BGCX067/facilitybooking-svn-to-git
|
f4f68de66a52c4ff77e8e6198215763b52f3c0be
|
0e26ac4bfb4f78a14594b55e2e66e3a4d5ecc6d2
|
refs/heads/master
| 2021-01-13T00:56:29.187030 | 2015-12-28T14:21:50 | 2015-12-28T14:21:50 | 48,848,330 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,248 |
java
|
package servr.dispatchers;
import servr.ServerMain;
import servr.facilitybooking.Facility;
import servr.facilitybooking.FacilityManager;
import communication.messages.client.QueryAvailibilityMessage;
import communication.messages.server.AvailabilitiesMessage;
import communication.utils.Availability;
import communication.utils.DateTime;
public class QueryAvailibilityMessageDispatcher extends ServerDispatcher {
@Override
public void dispatch() {
ServerMain.printOnConsole("QueryAvailibilityMessageDispatcher");
QueryAvailibilityMessage message = (QueryAvailibilityMessage) getReceivedMessage();
String facilityName = message.facilityName;
DateTime day = message.day;
FacilityManager fm = FacilityManager.getFacilityManager();
Facility facility = fm.getFacilityByName(facilityName);
if(facility == null){
String errorText = "Facility " + facilityName + " does not exists." ;
sendErrorMessage(errorText);
return;
}
Availability[] availabilities = facility.getAvailabilityForDay(day);
AvailabilitiesMessage availabilitiesMsg = new AvailabilitiesMessage();
availabilitiesMsg.availabilities = availabilities;
sendReplyMessage(availabilitiesMsg);
}
}
|
[
"[email protected]"
] | |
335c6926f93a05bd75fd37475f9aa9f42acc30f4
|
167cf9a9ec455b4f26ba4d9dffcd65ce5e0a13f4
|
/src/main/java/seunghwan/won/controller/api/ApiImageController.java
|
0f261e9f276bde1e4aa88b7305da73a74751af03
|
[] |
no_license
|
seunghwan-won/reservation
|
fb56d90f2f21de6cf107eedace19031a04df8455
|
ebacbffe5f442b7b4a0c203d053d8403c645c730
|
refs/heads/master
| 2022-12-21T23:11:16.173921 | 2019-09-18T15:25:42 | 2019-09-18T15:25:42 | 195,051,571 | 0 | 1 | null | 2022-12-16T10:51:47 | 2019-07-03T12:44:22 |
CSS
|
UTF-8
|
Java
| false | false | 1,413 |
java
|
package seunghwan.won.controller.api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import seunghwan.won.service.ImageService;
import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping(path = "api/img")
public class ApiImageController {
@Autowired
ImageService imageService;
@GetMapping(path = "map", produces = MediaType.IMAGE_PNG_VALUE)
public @ResponseBody
byte[] mapImage(@RequestParam(name = "id", required = true) int displayInfoId, HttpServletRequest request) {
return imageService.getMapImage(displayInfoId, request);
}
@CrossOrigin(origins = "http://127.0.0.1:5500")
@GetMapping(path = "display", produces = MediaType.IMAGE_PNG_VALUE)
public @ResponseBody
byte[] displayImage(@RequestParam(name = "id", required = true) int displayInfoId, HttpServletRequest request) {
return imageService.getDisplayImage(displayInfoId, request);
}
@CrossOrigin(origins = "http://127.0.0.1:5500")
@GetMapping(path = "commentThumbnail", produces = MediaType.IMAGE_PNG_VALUE)
public @ResponseBody
byte[] commentThumbnailImage(@RequestParam(name = "id", required = true) int commentImageId, HttpServletRequest request) {
return imageService.getCommentThumbnailImage(commentImageId, request);
}
}
|
[
"[email protected]"
] | |
71d502eefa3ded9c0ec2879fbc73cde129460cbf
|
6bda22e9542a5f7093b6a736d1fa626af32adb97
|
/src/com/floreantpos/ui/ticket/TicketViewerTable.java
|
c6e21b08feb8c04e8e9cff41f992897f456f5930
|
[
"Apache-2.0"
] |
permissive
|
jalalzia1/infinity
|
2112a733739ccfabd60050f0867f31723e9ec5f9
|
264d16cef247f820967ef753e61feb13065b644c
|
refs/heads/master
| 2021-04-29T12:58:54.511812 | 2018-02-18T15:31:47 | 2018-02-18T15:31:47 | 121,738,150 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,740 |
java
|
/**
* ************************************************************************
* * The contents of this file are subject to the MRPL 1.2
* * (the "License"), being the Mozilla Public License
* * Version 1.1 with a permitted attribution clause; you may not use this
* * file except in compliance with the License. You may obtain a copy of
* * the License at http://www.floreantpos.org/license.html
* * Software distributed under the License is distributed on an "AS IS"
* * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* * License for the specific language governing rights and limitations
* * under the License.
* * The Original Code is Infinity POS.
* * The Initial Developer of the Original Code is OROCUBE LLC
* * All portions are Copyright (C) 2015 OROCUBE LLC
* * All Rights Reserved.
* ************************************************************************
*/
package com.floreantpos.ui.ticket;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListSelectionModel;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import com.floreantpos.model.ITicketItem;
import com.floreantpos.model.Ticket;
import com.floreantpos.model.TicketItem;
import com.floreantpos.model.TicketItemModifier;
import com.floreantpos.swing.PosUIManager;
public class TicketViewerTable extends JTable {
private TicketViewerTableModel model;
private DefaultListSelectionModel selectionModel;
private TicketViewerTableCellRenderer cellRenderer;
public TicketViewerTable() {
this(null);
}
public TicketViewerTable(Ticket ticket) {
model = new TicketViewerTableModel(this);
setModel(model);
selectionModel = new DefaultListSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
cellRenderer = new TicketViewerTableCellRenderer();
//getColumnModel().setColumnMargin(0);
setGridColor(Color.LIGHT_GRAY);
setSelectionModel(selectionModel);
setAutoscrolls(true);
setShowGrid(true);
setBorder(null);
setFocusable(false);
setRowHeight(50);
resizeTableColumns();
setTicket(ticket);
}
private void resizeTableColumns() {
setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
//setColumnWidth(1, PosUIManager.getSize(50));
setColumnWidth(0, PosUIManager.getSize(50));
setColumnWidth(2, PosUIManager.getSize(60));
}
private void setColumnWidth(int columnNumber, int width) {
TableColumn column = getColumnModel().getColumn(columnNumber);
column.setPreferredWidth(width);
column.setMaxWidth(width);
column.setMinWidth(width);
}
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
return cellRenderer;
}
public TicketViewerTableCellRenderer getRenderer() {
return cellRenderer;
}
private boolean isTicketNull() {
Ticket ticket = getTicket();
if (ticket == null) {
return true;
}
if (ticket.getTicketItems() == null) {
return true;
}
return false;
}
public void scrollUp() {
if (isTicketNull())
return;
int selectedRow = getSelectedRow();
int rowCount = model.getItemCount();
if (selectedRow > (rowCount - 1)) {
return;
}
--selectedRow;
if (selectedRow < 0) {
selectedRow = 0;
}
// while (isModifierOrOther(selectedRow)) {
// --selectedRow;
// if (selectedRow > (rowCount - 1)) {
// return;
// }
// }
selectionModel.addSelectionInterval(selectedRow, selectedRow);
Rectangle cellRect = getCellRect(selectedRow, 0, false);
scrollRectToVisible(cellRect);
}
public void scrollDown() {
if (isTicketNull())
return;
int selectedRow = getSelectedRow();
if (selectedRow >= model.getItemCount() - 1) {
return;
}
++selectedRow;
// while (isModifierOrOther(selectedRow)) {
// ++selectedRow;
// if (selectedRow >= model.getItemCount() - 1) {
// return;
// }
// }
selectionModel.addSelectionInterval(selectedRow, selectedRow);
Rectangle cellRect = getCellRect(selectedRow, 0, false);
scrollRectToVisible(cellRect);
}
private boolean isModifierOrOther(int selectedRow) {
ITicketItem selectedItem = (ITicketItem) get(selectedRow);
if (selectedItem instanceof TicketItem) {
return false;
}
else {
return true;
}
}
public void increaseItemAmount(TicketItem ticketItem) {
int itemCount = ticketItem.getItemCount();
ticketItem.setItemCount(++itemCount);
repaint();
}
public boolean increaseFractionalUnit(double selectedQuantity) {
int selectedRow = getSelectedRow();
if (selectedRow < 0) {
return false;
}
else if (selectedRow >= model.getItemCount()) {
return false;
}
Object object = model.get(selectedRow);
if (object instanceof TicketItem) {
TicketItem ticketItem = (TicketItem) object;
ticketItem.setItemQuantity(selectedQuantity);
return true;
}
return false;
}
public boolean increaseItemAmount() {
int selectedRow = getSelectedRow();
if (selectedRow < 0) {
return false;
}
else if (selectedRow >= model.getItemCount()) {
return false;
}
ITicketItem iTicketItem = (ITicketItem) model.get(selectedRow);
if (iTicketItem.isPrintedToKitchen()) {
return false;
}
if (iTicketItem instanceof TicketItem) {
TicketItem ticketItem = (TicketItem) iTicketItem;
int itemCount = ticketItem.getItemCount();
ticketItem.setItemCount(++itemCount);
return true;
}
return false;
}
public boolean decreaseItemAmount() {
int selectedRow = getSelectedRow();
if (selectedRow < 0) {
return false;
}
else if (selectedRow >= model.getItemCount()) {
return false;
}
ITicketItem iTicketItem = (ITicketItem) model.get(selectedRow);
if (iTicketItem.isPrintedToKitchen()) {
return false;
}
if (iTicketItem instanceof TicketItem) {
TicketItem ticketItem = (TicketItem) iTicketItem;
int itemCount = ticketItem.getItemCount();
if (itemCount == 1) {
model.delete(selectedRow);
return true;
}
ticketItem.setItemCount(--itemCount);
return true;
}
return false;
}
public void setTicket(Ticket ticket) {
model.setTicket(ticket);
}
public Ticket getTicket() {
return model.getTicket();
}
public void addTicketItem(TicketItem ticketItem) {
ticketItem.setTicket(getTicket());
int addTicketItem = model.addTicketItem(ticketItem);
int actualRowCount = addTicketItem;//getActualRowCount() - 1;
selectionModel.addSelectionInterval(actualRowCount, actualRowCount);
Rectangle cellRect = getCellRect(actualRowCount, 0, false);
scrollRectToVisible(cellRect);
}
public Object deleteSelectedItem() {
int selectedRow = getSelectedRow();
Object delete = model.delete(selectedRow);
return delete;
}
public boolean containsTicketItem(TicketItem ticketItem) {
return model.containsTicketItem(ticketItem);
}
public void delete(int index) {
model.delete(index);
}
public ITicketItem get(int index) {
return (ITicketItem) model.get(index);
}
public ITicketItem getSelected() {
int index = getSelectedRow();
return (ITicketItem) model.get(index);
}
public void addAllTicketItem(TicketItem ticketItem) {
model.addAllTicketItem(ticketItem);
}
public void removeModifier(TicketItem parent, TicketItemModifier modifier) {
model.removeModifier(parent, modifier);
}
public void updateView() {
int selectedRow = getSelectedRow();
model.update();
try {
getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
} catch (Exception e) {
// do nothing
}
}
public int getActualRowCount() {
return model.getActualRowCount();
}
public void selectLast() {
int actualRowCount = getActualRowCount() - 1;
selectionModel.addSelectionInterval(actualRowCount, actualRowCount);
Rectangle cellRect = getCellRect(actualRowCount, 0, false);
scrollRectToVisible(cellRect);
}
public void selectRow(int index) {
if (index < 0 || index >= getActualRowCount()) {
index = 0;
}
selectionModel.addSelectionInterval(index, index);
Rectangle cellRect = getCellRect(index, 0, false);
scrollRectToVisible(cellRect);
}
public TicketViewerTableModel getModel() {
return model;
}
private List<TicketItem> getRowByValue(TicketViewerTableModel model) {
List<TicketItem> ticketItems = new ArrayList();
for (int i = 0; i <= model.getRowCount(); i++) {
Object value = model.get(i);
if (value instanceof TicketItem) {
TicketItem ticketItem = (TicketItem) value;
ticketItems.add(ticketItem);
}
}
return ticketItems;
}
public List<TicketItem> getTicketItems() {
return getRowByValue(model);
}
public TicketItem getTicketItem() {
return (TicketItem) getSelected();
}
}
|
[
"[email protected]"
] | |
dbb234a0d70e1338906375e5d49ffae087966ba6
|
abdd3f80173925819df2125b83e5ddf4d669cc47
|
/app/src/main/java/com/example/administrator/uichat/Msg.java
|
279c1fd5fa2a0a7f39b3c2714d260b419925f789
|
[
"Apache-2.0"
] |
permissive
|
Skymqq/UIChat
|
8973e40ac47a5986bd285d4842b69dec25d5db1c
|
496fe465a3a87b6d9388c7db70ced33e2fb28ce7
|
refs/heads/master
| 2020-04-15T14:55:24.243848 | 2019-01-09T03:01:42 | 2019-01-09T03:01:42 | 164,773,118 | 4 | 0 |
Apache-2.0
| 2019-01-24T08:04:34 | 2019-01-09T02:40:19 |
Java
|
UTF-8
|
Java
| false | false | 575 |
java
|
package com.example.administrator.uichat;
public class Msg {
public static final int TYPE_RECEIVED = 0;//静态常量,用于表示消息类型为接收状态
public static final int TYPE_SEND = 1;//静态常量,用于表示消息类型为发送状态
private String content;//消息内容
private int type;//消息类型
public Msg(String content, int type) {
this.content = content;
this.type = type;
}
public String getContent() {
return content;
}
public int getType() {
return type;
}
}
|
[
"[email protected]"
] | |
cbb846321e8dec7557c90bbef27efb8f7a3c4232
|
f487532281c1c6a36a5c62a29744d8323584891b
|
/sdk/java/src/main/java/com/pulumi/azure/eventhub/outputs/EventSubscriptionRetryPolicy.java
|
c082c9c6a046ea5a5030933b8b6cedc4aca0bd7d
|
[
"BSD-3-Clause",
"MPL-2.0",
"Apache-2.0"
] |
permissive
|
pulumi/pulumi-azure
|
a8f8f21c46c802aecf1397c737662ddcc438a2db
|
c16962e5c4f5810efec2806b8bb49d0da960d1ea
|
refs/heads/master
| 2023-08-25T00:17:05.290397 | 2023-08-24T06:11:55 | 2023-08-24T06:11:55 | 103,183,737 | 129 | 57 |
Apache-2.0
| 2023-09-13T05:44:10 | 2017-09-11T20:19:15 |
Java
|
UTF-8
|
Java
| false | false | 2,683 |
java
|
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.eventhub.outputs;
import com.pulumi.core.annotations.CustomType;
import java.lang.Integer;
import java.util.Objects;
@CustomType
public final class EventSubscriptionRetryPolicy {
/**
* @return Specifies the time to live (in minutes) for events. Supported range is `1` to `1440`. See [official documentation](https://docs.microsoft.com/azure/event-grid/manage-event-delivery#set-retry-policy) for more details.
*
*/
private Integer eventTimeToLive;
/**
* @return Specifies the maximum number of delivery retry attempts for events.
*
*/
private Integer maxDeliveryAttempts;
private EventSubscriptionRetryPolicy() {}
/**
* @return Specifies the time to live (in minutes) for events. Supported range is `1` to `1440`. See [official documentation](https://docs.microsoft.com/azure/event-grid/manage-event-delivery#set-retry-policy) for more details.
*
*/
public Integer eventTimeToLive() {
return this.eventTimeToLive;
}
/**
* @return Specifies the maximum number of delivery retry attempts for events.
*
*/
public Integer maxDeliveryAttempts() {
return this.maxDeliveryAttempts;
}
public static Builder builder() {
return new Builder();
}
public static Builder builder(EventSubscriptionRetryPolicy defaults) {
return new Builder(defaults);
}
@CustomType.Builder
public static final class Builder {
private Integer eventTimeToLive;
private Integer maxDeliveryAttempts;
public Builder() {}
public Builder(EventSubscriptionRetryPolicy defaults) {
Objects.requireNonNull(defaults);
this.eventTimeToLive = defaults.eventTimeToLive;
this.maxDeliveryAttempts = defaults.maxDeliveryAttempts;
}
@CustomType.Setter
public Builder eventTimeToLive(Integer eventTimeToLive) {
this.eventTimeToLive = Objects.requireNonNull(eventTimeToLive);
return this;
}
@CustomType.Setter
public Builder maxDeliveryAttempts(Integer maxDeliveryAttempts) {
this.maxDeliveryAttempts = Objects.requireNonNull(maxDeliveryAttempts);
return this;
}
public EventSubscriptionRetryPolicy build() {
final var o = new EventSubscriptionRetryPolicy();
o.eventTimeToLive = eventTimeToLive;
o.maxDeliveryAttempts = maxDeliveryAttempts;
return o;
}
}
}
|
[
"[email protected]"
] | |
239180a1c361a66acf0fe0c0e3628a6aaf8e00d8
|
e12b284792417ed3802a43aa6396514390c55950
|
/src/main/java/com/danlind/igz/ig/api/client/rest/dto/positions/getPositionByDealIdV2/Market.java
|
558056228b92544bafa19d08860c06ee77f84309
|
[] |
no_license
|
dan-lind/igzplugin
|
af57ce1adf250f96dcd22b19073d4789171c9fd7
|
7e43b4cb7843a17db197a5919c3a0bc9383fac40
|
refs/heads/master
| 2021-07-14T17:29:32.199825 | 2019-08-05T05:12:09 | 2019-08-05T05:12:09 | 87,112,682 | 9 | 8 | null | 2021-04-26T17:12:24 | 2017-04-03T19:29:27 |
Java
|
UTF-8
|
Java
| false | false | 3,523 |
java
|
package com.danlind.igz.ig.api.client.rest.dto.positions.getPositionByDealIdV2;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/*
Market data
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Market {
/*
Instrument name
*/
private String instrumentName;
/*
Instrument expiry period
*/
private String expiry;
/*
Instrument epic identifier
*/
private String epic;
/*
Instrument type
*/
private InstrumentType instrumentType;
/*
Instrument lot size
*/
private Float lotSize;
/*
High price
*/
private Float high;
/*
Low price
*/
private Float low;
/*
Price percentage change
*/
private Float percentageChange;
/*
Price net change
*/
private Float netChange;
/*
Bid
*/
private Float bid;
/*
Offer
*/
private Float offer;
/*
Local time of last instrument price update
*/
private String updateTime;
/*
Time of last instrument price update
*/
private String updateTimeUTC;
/*
Instrument price delay (minutes)
*/
private Integer delayTime;
/*
True if streaming prices are available, i.e. the market is tradeable and the client has appropriate permissions
*/
private Boolean streamingPricesAvailable;
/*
Market status
*/
private MarketStatus marketStatus;
/*
multiplying factor to determine actual pip value for the levels used by the instrument
*/
private Integer scalingFactor;
public String getInstrumentName() { return instrumentName; }
public void setInstrumentName(String instrumentName) { this.instrumentName=instrumentName; }
public String getExpiry() { return expiry; }
public void setExpiry(String expiry) { this.expiry=expiry; }
public String getEpic() { return epic; }
public void setEpic(String epic) { this.epic=epic; }
public InstrumentType getInstrumentType() { return instrumentType; }
public void setInstrumentType(InstrumentType instrumentType) { this.instrumentType=instrumentType; }
public Float getLotSize() { return lotSize; }
public void setLotSize(Float lotSize) { this.lotSize=lotSize; }
public Float getHigh() { return high; }
public void setHigh(Float high) { this.high=high; }
public Float getLow() { return low; }
public void setLow(Float low) { this.low=low; }
public Float getPercentageChange() { return percentageChange; }
public void setPercentageChange(Float percentageChange) { this.percentageChange=percentageChange; }
public Float getNetChange() { return netChange; }
public void setNetChange(Float netChange) { this.netChange=netChange; }
public Float getBid() { return bid; }
public void setBid(Float bid) { this.bid=bid; }
public Float getOffer() { return offer; }
public void setOffer(Float offer) { this.offer=offer; }
public String getUpdateTime() { return updateTime; }
public void setUpdateTime(String updateTime) { this.updateTime=updateTime; }
public String getUpdateTimeUTC() { return updateTimeUTC; }
public void setUpdateTimeUTC(String updateTimeUTC) { this.updateTimeUTC=updateTimeUTC; }
public Integer getDelayTime() { return delayTime; }
public void setDelayTime(Integer delayTime) { this.delayTime=delayTime; }
public Boolean getStreamingPricesAvailable() { return streamingPricesAvailable; }
public void setStreamingPricesAvailable(Boolean streamingPricesAvailable) { this.streamingPricesAvailable=streamingPricesAvailable; }
public MarketStatus getMarketStatus() { return marketStatus; }
public void setMarketStatus(MarketStatus marketStatus) { this.marketStatus=marketStatus; }
public Integer getScalingFactor() { return scalingFactor; }
public void setScalingFactor(Integer scalingFactor) { this.scalingFactor=scalingFactor; }
}
|
[
"[email protected]"
] | |
311e08b1d7ad0b663d2daafc8dac36445a3a7856
|
a5f4de3e12b3615cf1be73ed2d6fd4673ef91102
|
/src/main/java/ma/eshop/nour/validation/PositivePriceValidator.java
|
cbf17d7fc9ecf36971521de81faea2f4ec8f4461
|
[] |
no_license
|
noure/eshop
|
9e8e0433787f780b8c49b4e051322a6f78ba9d02
|
32304aedb85cf3d9d49a4a5614369cf3c75f2303
|
refs/heads/master
| 2021-01-22T20:19:05.121435 | 2015-02-08T15:31:13 | 2015-02-08T15:31:13 | 29,798,249 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 425 |
java
|
package ma.eshop.nour.validation;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
public class PositivePriceValidator implements
ConstraintValidator<PositivePrice, Double>{
@Override
public void initialize(PositivePrice constraintAnnotation) {
}
@Override
public boolean isValid(Double value, ConstraintValidatorContext context) {
return value>=0;
}
}
|
[
"[email protected]"
] | |
cf7173d6c0dae450722bed758dd709c8238afb16
|
707f853d3f45beeb46369234f9e724e733a3737e
|
/javasecurity/src/main/java/rsa/CipherMain3.java
|
aae9c9679d7f3e71f7b8392ebf288e57384e2f1f
|
[] |
no_license
|
jollaman999/goodee_spring
|
3e1dbefd53b6eeb413279ebbf6c933539d8eccc7
|
80d2397523f377a87bc58639ca05152244aaf45e
|
refs/heads/master
| 2022-12-22T12:38:54.875246 | 2021-05-01T05:49:41 | 2021-05-01T05:49:41 | 194,190,317 | 0 | 0 | null | 2022-12-16T14:49:59 | 2019-06-28T02:08:03 |
Java
|
UTF-8
|
Java
| false | false | 180 |
java
|
package rsa;
public class CipherMain3 {
public static void main(String[] args) {
CipherRSA.decryptFile("javasecurity/rsac.ser", "javasecurity/p2.txt");
}
}
|
[
"[email protected]"
] | |
700c8a17083941ef41e6954a810088274a2d6968
|
ab56ce379b80fd422974058edff82a27e74b8bf0
|
/src/main/java/com/namnx/spring_aop/aspect/datasources/routing/DatabaseType.java
|
df28883ea7c36828013e2d85ea8e043cc4cd3fb2
|
[] |
no_license
|
thuyduongbka/Spring_AOP_Practice
|
5613f4017789b73285701022c4ad233befbeb956
|
e55b7690d0a1a6b13f294231ff5b617f3a6e7b30
|
refs/heads/master
| 2023-05-27T09:32:04.676760 | 2021-06-06T15:32:59 | 2021-06-06T15:32:59 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 111 |
java
|
package com.namnx.spring_aop.aspect.datasources.routing;
public enum DatabaseType {
PRIMARY,
REPLICA,
}
|
[
"[email protected]"
] | |
3abd7a505bef7cd125c1ccb34bc8ce36abe65449
|
710eb9919f436b60c270e09abd3734899454fa71
|
/rollingstone-ecommerce-product-api/src/main/java/com/rollingstone/spring/service/ProductService.java
|
de41c3b047cb107f0aaf02a7b33681d866d828b1
|
[] |
no_license
|
VineetCode/Spring
|
1d22354822c259d3166715c8bcadefd6322f9516
|
c32f96b92f14b82918c0b5f714bce988dd2c7314
|
refs/heads/master
| 2022-12-24T18:06:24.193733 | 2020-07-08T12:41:45 | 2020-07-08T12:41:45 | 183,037,251 | 0 | 0 | null | 2022-12-16T03:48:07 | 2019-04-23T14:51:52 |
Java
|
UTF-8
|
Java
| false | false | 434 |
java
|
package com.rollingstone.spring.service;
import java.util.Optional;
import org.springframework.data.domain.Page;
import com.rollingstone.spring.model.Product;
public interface ProductService {
public Product save(Product product);
public Optional<Product> get(long id);
public Page<Product> getProductsByPage(Integer pageNumber,Integer pageSize);
public void update(long id, Product product);
public void delete(long id);
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.