blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cbe4ae18b16fc6f42d12cda5f451d7a7310dc348 | ad5f5e0dcf6b60a88dd244c57e759dc7548bd134 | /hamstersimulator-2.9.5/de/hamster/visual/model/ReturnExpressionStatement.java | 0cf47030da683d76e3ff95b91ae03ed5a96c2895 | [] | no_license | markus9991/Schule | 4649127572b95f9cbfb0e76aad3f09fafb111e47 | ddc44db5442a43936a16947bac0ee448e5ef4fbf | refs/heads/master | 2020-12-29T02:36:21.045473 | 2017-01-16T09:24:43 | 2017-01-16T09:24:43 | 47,878,736 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package de.hamster.visual.model;
public class ReturnExpressionStatement extends ReturnStatement {
protected Expression expression;
public ReturnExpressionStatement() {
this(new FalseExpression());
}
public ReturnExpressionStatement(Expression expr) {
this.expression = expr;
}
public void setExpression(Expression expr) {
this.expression = expr;
}
public Expression getExpression() {
return this.expression;
}
@Override
public Object perform() throws FunctionResultException {
throw new FunctionResultException(this.expression.perform());
}
}
| [
"[email protected]"
] | |
018c5cdf80cd5f953f6da52533091231013885f3 | 3ae6565494b4e6fa1d03cd4d05c982b9c7e3ea84 | /src/main/java/scenes/HelloApplication.java | 80a569b89b5b86bfe0d4ca1bf8e9631e46685e68 | [] | no_license | ariflogs/java_attendance_manager | 72eff52cb961aac95619df44e96fe95182b133ee | 16a9fddc764e3bc0b46ff0c8350cf5f85cc22fe2 | refs/heads/master | 2023-08-11T16:32:26.094929 | 2021-09-17T16:02:05 | 2021-09-17T16:02:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package scenes;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
import java.sql.*;
public class HelloApplication extends Application {
public static Stage primaryStage;
@Override
public void start(Stage stage) throws IOException {
primaryStage = stage;
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("home.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 900, 600);
stage.setTitle("AAAAAAAAAAAATTTTEEEENNNNN!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
// public static void main(String[] args) throws SQLException {
// try {
// String url = "jdbc:mysql://localhost:3306/at_managment";
// String username = "root";
// String password = "14101999";
// Class.forName("com.mysql.jdbc.Driver");
// Connection connection = DriverManager.getConnection(url, username, password);
// Statement statement = connection.createStatement();
// String connectQuery = "SELECT * FROM courses";
//
// ResultSet queryOutput = statement.executeQuery(connectQuery);
//
// while (queryOutput.next()) {
// System.out.println(queryOutput.getString("name"));
// }
//// launch();
//
// } catch (Exception e) {
// System.out.println(e.getMessage());
// throw new IllegalStateException("Cannot connect the database! :|");
// }
// }
} | [
"[email protected]"
] | |
8d32b154ead271075c955e0278ed71703805f2a3 | 1104d8d98acbd7eb0ae273d5cdc557338fb1e0d2 | /gulimall-coupon/src/main/java/com/zhulin/gulimall/coupon/entity/SeckillPromotionEntity.java | 08945d4a16988bc21edd01c88d44e9eaf8a6dde2 | [] | no_license | a-bird/gulimall | 44294947432bcf132f959f0645cf5396e3fef702 | 555075b53dd776f0db3ec743937b3416dae5ff73 | refs/heads/main | 2023-06-04T09:29:14.634836 | 2021-06-25T01:46:41 | 2021-06-25T01:46:41 | 341,117,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package com.zhulin.gulimall.coupon.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 秒杀活动
*
* @author lql
* @email [email protected]
* @date 2021-03-05 16:41:47
*/
@Data
@TableName("sms_seckill_promotion")
public class SeckillPromotionEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId
private Long id;
/**
* 活动标题
*/
private String title;
/**
* 开始日期
*/
private Date startTime;
/**
* 结束日期
*/
private Date endTime;
/**
* 上下线状态
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private Long userId;
}
| [
"[email protected]"
] | |
6a461acdae0ccdbafab9d17da926f449c11ae2a6 | a422de59c29d077c512d66b538ff17d179cc077a | /hsxt/hsxt-tm/hsxt-tm-api/src/main/java/com/gy/hsxt/tm/bean/BizTypeAuth.java | 8752acc25432115a5bd6691097520562a0b9e43b | [] | no_license | liveqmock/hsxt | c554e4ebfd891e4cc3d57e920d8a79ecc020b4dd | 40bb7a1fe5c22cb5b4f1d700e5d16371a3a74c04 | refs/heads/master | 2020-03-28T14:09:31.939168 | 2018-09-12T10:20:46 | 2018-09-12T10:20:46 | 148,461,898 | 0 | 0 | null | 2018-09-12T10:19:11 | 2018-09-12T10:19:10 | null | UTF-8 | Java | false | false | 1,479 | java | /*
* Copyright (c) 2015-2018 SHENZHEN GUIYI SCIENCE AND TECHNOLOGY DEVELOP CO., LTD. All rights reserved.
*
* 注意:本内容仅限于深圳市归一科技研发有限公司内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.gy.hsxt.tm.bean;
import java.io.Serializable;
import com.alibaba.fastjson.JSON;
/**
* 业务办理授权实体类
*
* @Package: com.gy.hsxt.tm.bean
* @ClassName: BizTypeAuth
* @Description: TODO
*
* @author: kongsl
* @date: 2015-11-9 下午4:24:29
* @version V3.0.0
*/
public class BizTypeAuth implements Serializable {
private static final long serialVersionUID = 7041133179656087683L;
/** 业务类型 **/
private String bizType;
/** 值班员编号 **/
private String optCustId;
/** 业务类型名称 **/
private String bizTypeName;
public String getBizTypeName() {
return bizTypeName;
}
public void setBizTypeName(String bizTypeName) {
this.bizTypeName = bizTypeName;
}
public String getBizType() {
return bizType;
}
public void setBizType(String bizType) {
this.bizType = bizType == null ? null : bizType.trim();
}
public String getOptCustId() {
return optCustId;
}
public void setOptCustId(String optCustId) {
this.optCustId = optCustId == null ? null : optCustId.trim();
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
| [
"[email protected]"
] | |
7c98cf9823e583a98cff2fdcefabae08619981a8 | 8769ef14b150ff982ee0fd1283b35f15b49877b5 | /src/com/hokumus/hib/project/dao/util/IDBService.java | 3b94d24d802de04fb7b63098f1a667882fa2f498 | [] | no_license | hokumus86/JavaHibProject | 25993870f73d43a515b179ccd7cae7021f0c41f9 | 67ddb9ce5a082351e5a254d9b76de37813deffd1 | refs/heads/master | 2022-09-20T21:10:12.722052 | 2019-08-05T18:21:56 | 2019-08-05T18:21:56 | 200,693,423 | 0 | 0 | null | 2022-09-08T01:02:11 | 2019-08-05T16:42:15 | Java | UTF-8 | Java | false | false | 391 | java | package com.hokumus.hib.project.dao.util;
import java.util.List;
public interface IDBService<T> {
public Boolean kaydet(T temp);
public Boolean guncelle(T temp);
public Boolean sil(T temp);
public List<T> getir(T temp);
public T bul(Long id, T temp);
public T bul(T temp);
public List<T> getir(String kolonAdi, String deger, T temp);
public List<T> ara(T temp);
}
| [
"vektorel@lab10-OGR"
] | vektorel@lab10-OGR |
2e39414fbf3900d9a50c5d3ea81d0f927dd9086c | da3d8bdb29432628692e5482699a091c669a311f | /src/com/lql/easy/com/lql/easy/btree/BinaryTreeTravel.java | 6ecafb6d7c7809556610678eb32ea406906a1b0a | [] | no_license | 2513lql/leetcode_1 | 59b9585a4b4ca2315b545496e44951a47aafde33 | 11dae8726840e90c93ad537ca5d44e371922d109 | refs/heads/master | 2021-05-01T12:41:12.736962 | 2017-02-25T01:17:08 | 2017-02-25T01:17:08 | 79,529,355 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,242 | java | package com.lql.easy.com.lql.easy.btree;
import java.util.Stack;
/**
* Created by LQL on 2016/7/9.
*/
public class BinaryTreeTravel {
/*二叉树非递归中序遍历*/
public static void btTravelUnrecursion(TreeNode root){
if(root == null){
return;
}
TreeNode p = root;
Stack<TreeNode> stack = new Stack<TreeNode>();
while (p != null || !stack.isEmpty()){
if (p != null) {
stack.push(p);
p = p.left;
}
while (p == null && !stack.isEmpty()){
p = stack.pop();
System.out.println(p.val);
p = p.right;
}
}
}
/*二叉树先序非递归遍历*/
public static void preOrder(TreeNode root){
if (root == null);
TreeNode p = root;
Stack<TreeNode> stack = new Stack<TreeNode>();
while (p != null || !stack.isEmpty()){
if (p != null){
System.out.print(p.val + " ");
stack.push(p);
p = p.left;
}
while (p == null && !stack.isEmpty()){
p = stack.pop();
p = p.right;
}
}
}
/*二叉树后序非递归遍历
* 借助两个栈可以用很简单的方式实现二叉树的后序非递归遍历
* */
public static void postOrder(TreeNode root){
if (root == null){
return;
}
Stack<TreeNode> stack = new Stack<TreeNode>();
Stack<TreeNode> output = new Stack<TreeNode>();
TreeNode p = root;
while (p != null || !stack.isEmpty()){
if (p != null){
stack.push(p);
output.push(p);
p = p.right;
}else{
p = stack.pop();
p = p.left;
}
}
while (!output.isEmpty()){
System.out.println(output.pop().val + " ");
}
}
public static void main(String[] args) {
// btTravelUnrecursion(BinaryTreeUtil.generateBinaryTree());
// preOrder(BinaryTreeUtil.generateBinaryTree());
postOrder(BinaryTreeUtil.generateBinaryTree());
}
}
| [
"[email protected]"
] | |
f0b7fb8e6b4b96cea477d3fc1cc6eaf08767f94c | e0e0d6db84f3e79ec6ea588869504ffb3084e402 | /MixSoundSystemXMLJavaConfig/src/soundsystem/SgtPeppers.java | d4ff0059867ae9597a29984016e96f4f00036bdf | [] | no_license | nain12/practiseJava | f7e84cb3becaebe980c3af022f49600e4720434a | ce812973423a94ff75c03aee7d339fa299d3b0e9 | refs/heads/master | 2020-03-28T16:05:20.000965 | 2018-09-19T13:12:48 | 2018-09-19T13:12:48 | 148,658,148 | 0 | 0 | null | 2018-09-13T16:05:10 | 2018-09-13T15:24:48 | Java | UTF-8 | Java | false | false | 286 | java | package soundsystem;
public class SgtPeppers implements CompactDisc {
private String title = "Sgt. Pepper's Lonely Hearts Club Band";
private String artist = "The Beatles";
@Override
public void play() {
System.out.println("Playing " + title + " by " + artist);
}
} | [
"[email protected]"
] | |
b8d48559d7cd7cdbf8bdbb8dff2e83f338f6bad9 | 61ae313e3f1c35df9d3f1107049dc8bbc354125d | /java/net/sf/l2j/gameserver/handler/itemhandlers/BeastSoulShots.java | d5b94dccfc8a031eb93f83b38834b02f2bc4a238 | [] | no_license | GerryP1925/L2Faction_GS | ea0f8fff453ab7f141ac1aa427a92a9818d66187 | 51e6fe2daaee8df624db272ff9c1aad6bbc15084 | refs/heads/master | 2023-03-18T19:51:52.651413 | 2021-03-22T14:38:16 | 2021-03-22T14:38:16 | 348,318,372 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,926 | java | package net.sf.l2j.gameserver.handler.itemhandlers;
import net.sf.l2j.gameserver.enums.items.ShotType;
import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.actor.Playable;
import net.sf.l2j.gameserver.model.actor.Player;
import net.sf.l2j.gameserver.model.actor.Summon;
import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
public class BeastSoulShots implements IItemHandler
{
@Override
public void useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (playable == null)
return;
final Player player = playable.getActingPlayer();
if (player == null)
return;
if (playable instanceof Summon)
{
player.sendPacket(SystemMessageId.PET_CANNOT_USE_ITEM);
return;
}
final Summon summon = player.getSummon();
if (summon == null)
{
player.sendPacket(SystemMessageId.PETS_ARE_NOT_AVAILABLE_AT_THIS_TIME);
return;
}
if (summon.isDead())
{
player.sendPacket(SystemMessageId.SOULSHOTS_AND_SPIRITSHOTS_ARE_NOT_AVAILABLE_FOR_A_DEAD_PET);
return;
}
// SoulShots are already active.
if (summon.isChargedShot(ShotType.SOULSHOT))
return;
// If the player doesn't have enough beast soulshot remaining, remove any auto soulshot task.
if (!player.destroyItemWithoutTrace(item.getObjectId(), summon.getSoulShotsPerHit()))
{
if (!player.disableAutoShot(item.getItemId()))
player.sendPacket(SystemMessageId.NOT_ENOUGH_SOULSHOTS_FOR_PET);
return;
}
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.PET_USES_S1).addItemName(item.getItemId()));
summon.setChargedShot(ShotType.SOULSHOT, true);
player.broadcastPacketInRadius(new MagicSkillUse(summon, summon, 2033, 1, 0, 0), 600);
}
} | [
"[email protected]"
] | |
5218ed143a579b1df51621290ba60248abdc2a00 | 9e5f1f8fc6ddfeaee0db7bdce43a3416cf309074 | /app/src/main/java/com/lab/flickr/fragments/interfaces/RecyclerViewOnItemClickListener.java | 1d58a7f26dcacc02745c9c65d2d31d5fddc4bd04 | [] | no_license | mroche89/FlickrLab | adf0572db7cb548240272014441af68e7ee27371 | a2f051cb10df4c9bb6e44a659d90c427bb39a5d0 | refs/heads/master | 2022-09-16T20:58:01.089141 | 2016-06-04T07:35:50 | 2016-06-04T07:35:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.lab.flickr.fragments.interfaces;
import android.view.View;
public interface RecyclerViewOnItemClickListener {
void onClick(View view, int position);
}
| [
"[email protected]"
] | |
5c1c25eb36042137059ca0b47c17bdf7a633f3ed | 5741045375dcbbafcf7288d65a11c44de2e56484 | /reddit-decompilada/com/reddit/frontpage/presentation/listing/ui/view/HeaderMetadataView$bottomMetadataIndicators$2.java | 85efc09d86b2a4a5e00f93022a4aff9b2be0840a | [] | no_license | miarevalo10/ReporteReddit | 18dd19bcec46c42ff933bb330ba65280615c281c | a0db5538e85e9a081bf268cb1590f0eeb113ed77 | refs/heads/master | 2020-03-16T17:42:34.840154 | 2018-05-11T10:16:04 | 2018-05-11T10:16:04 | 132,843,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package com.reddit.frontpage.presentation.listing.ui.view;
import com.reddit.frontpage.C1761R;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
@Metadata(bv = {1, 0, 2}, d1 = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\n \u0002*\u0004\u0018\u00010\u00010\u0001H\n¢\u0006\u0002\b\u0003"}, d2 = {"<anonymous>", "Lcom/reddit/frontpage/presentation/listing/ui/view/UserIndicatorsView;", "kotlin.jvm.PlatformType", "invoke"}, k = 3, mv = {1, 1, 9})
/* compiled from: HeaderMetadataView.kt */
final class HeaderMetadataView$bottomMetadataIndicators$2 extends Lambda implements Function0<UserIndicatorsView> {
final /* synthetic */ HeaderMetadataView f36830a;
HeaderMetadataView$bottomMetadataIndicators$2(HeaderMetadataView headerMetadataView) {
this.f36830a = headerMetadataView;
super(0);
}
public final /* synthetic */ Object invoke() {
return (UserIndicatorsView) this.f36830a.mo4901a(C1761R.id.bottom_row_metadata_indicators);
}
}
| [
"[email protected]"
] | |
a12c03283b678c40a9cd16b6d05e41e26ca6118f | bc02a58894d48bb97294798bed9a4b694f91b431 | /app/src/main/java/com/example/madcampweek3/customfonts/MyTextView_Roboto_Medium.java | 3a077f18300194975aa3ee25046f5db31e3b59ab | [] | no_license | seo3650/2020_madcamp_third | 815e044641126ab193554e0efbe35d94d281dee0 | 8f9fb26f345cb20653072797927d993419723eb5 | refs/heads/master | 2022-12-05T05:13:03.425173 | 2020-08-23T08:17:34 | 2020-08-23T08:17:34 | 281,841,913 | 1 | 1 | null | 2020-07-25T14:33:27 | 2020-07-23T03:35:18 | Java | UTF-8 | Java | false | false | 995 | java | package com.example.madcampweek3.customfonts;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
/**
* DatingApp
* https://github.com/quintuslabs/DatingApp
* Created on 25-sept-2018.
* Created by : Santosh Kumar Dash:- http://santoshdash.epizy.com
*/
public class MyTextView_Roboto_Medium extends androidx.appcompat.widget.AppCompatTextView {
public MyTextView_Roboto_Medium(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public MyTextView_Roboto_Medium(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public MyTextView_Roboto_Medium(Context context) {
super(context);
init();
}
private void init() {
if (!isInEditMode()) {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/Roboto-Medium.ttf");
setTypeface(tf);
}
}
} | [
"[email protected]"
] | |
590e0293a65eded5be82bffd7c5b5637d476a828 | 1b8ae41e4e43429ba6c21b49fdfa7312ddee23b3 | /src/opencv-3.0.0-rc1/platforms/android/service/engine/src/org/opencv/engine3/OpenCVEngineService.java | c7df4a811703fb7f9b994889eab98ffd53dfacbd | [
"BSD-3-Clause"
] | permissive | Technipire/Cpp | 9f8476a944497b82ce425a3d9191acb74337a129 | 78d4c89385216865b9a9f475055fca1ff600d2a4 | refs/heads/master | 2021-05-01T16:31:45.977554 | 2017-04-03T00:02:01 | 2017-04-03T00:02:01 | 32,282,437 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,325 | java | package org.opencv.engine3;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
public class OpenCVEngineService extends Service
{
private static final String TAG = "OpenCVEngine/Service";
private IBinder mEngineInterface = null;
private MarketConnector mMarket;
private BinderConnector mNativeBinder;
public void onCreate() {
Log.i(TAG, "Service starting");
super.onCreate();
Log.i(TAG, "Engine binder component creating");
mMarket = new MarketConnector(getBaseContext());
mNativeBinder = new BinderConnector(mMarket);
if (mNativeBinder.Init()) {
mEngineInterface = mNativeBinder.Connect();
Log.i(TAG, "Service started successfully");
} else {
Log.e(TAG, "Cannot initialize native part of OpenCV Manager!");
Log.e(TAG, "Using stub instead");
mEngineInterface = new OpenCVEngineInterface.Stub() {
@Override
public boolean installVersion(String version) throws RemoteException {
// TODO Auto-generated method stub
return false;
}
@Override
public String getLibraryList(String version) throws RemoteException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getLibPathByVersion(String version) throws RemoteException {
// TODO Auto-generated method stub
return null;
}
@Override
public int getEngineVersion() throws RemoteException {
return -1;
}
};
}
}
public IBinder onBind(Intent intent) {
Log.i(TAG, "Service onBind called for intent " + intent.toString());
return mEngineInterface;
}
public boolean onUnbind(Intent intent)
{
Log.i(TAG, "Service onUnbind called for intent " + intent.toString());
return true;
}
public void OnDestroy()
{
Log.i(TAG, "OpenCV Engine service destruction");
mNativeBinder.Disconnect();
}
}
| [
"[email protected]"
] | |
0438c019dfe3a3e4671c2ed27cbd4fda5c3f99a8 | b59472ded3c2a1439f3b16d0941d8dec6520dac5 | /src/proyecto-original/Revelaciones-branch-5/src/XbrlCore/src/xbrlcore/junit/LoadSVSTaxonomy.java | f67cad1a9dce4af63ebaf2a57c68c66f66695c7a | [] | no_license | vicky1404/rev-ii | a0672bf6d1ffa16f9a2c99b2465359d0a69d51bd | cc264cf7612ad3b2b4c9705f6b8cf29639ef7fa2 | refs/heads/master | 2020-05-16T09:19:22.181375 | 2013-08-05T02:14:06 | 2013-08-05T02:14:06 | 34,520,890 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,297 | java | package xbrlcore.junit;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import javax.xml.parsers.ParserConfigurationException;
import org.junit.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import xbrlcore.taxonomy.Concept;
import xbrlcore.taxonomy.DiscoverableTaxonomySet;
import xbrlcore.taxonomy.sax.SAXBuilder;
public class LoadSVSTaxonomy {
@SuppressWarnings("unused")
@Test
public void getDTS() throws SAXException, IOException, ParserConfigurationException {
SAXBuilder saxBuilder = new SAXBuilder();
try{
//DiscoverableTaxonomySet taxonomySet = saxBuilder.build(new InputSource("file://EQ13797/taxonomias/2012-01-02/taxonomia-svs/eeff/cl-cs_shell_2012-01-02.xsd"));
//DiscoverableTaxonomySet taxonomySet = saxBuilder.build(new InputSource("xbrl/test/svs/eeff-y-notas/cl-cs_shell_2012-07-17.xsd"));
DiscoverableTaxonomySet taxonomySet = saxBuilder.build(new InputSource("file://eq13830/taxonomias/2012-07-17/taxonomia-svs/eeff-y-notas/cl-cs_shell_2012-07-17.xsd"));
System.err.println("Nombre de la Taxonomia :"+taxonomySet.getTopTaxonomy().getName());
System.err.println("Total de conceptos "+taxonomySet.getConcepts().size());
for(Concept concept : taxonomySet.getConcepts()){
System.err.println("=====================================\n"+
"ID: "+concept.getId()+"\n"+
"Name: "+concept.getName()+"\n"+
"Type: "+concept.getType()+"\n"+
"Namespace: "+concept.getNamespace().getPrefix()+"\n"+
"Substitution Group: "+concept.getSubstitutionGroup()+"\n"+
"Period Type: "+concept.getPeriodType()+"\n"+
"Schema Name: "+concept.getTaxonomySchemaName()+"\n"+
"=====================================\n");
}
// for(Map.Entry<String, TaxonomySchema> entry : taxonomySet.getTaxonomyMap().entrySet()){
// String key = entry.getKey();
// TaxonomySchema value = entry.getValue();
// System.out.println("key "+key);
// System.out.println("value "+value.getName());
// }
}catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"rodrigo.reyesco@17bb37fe-d5a1-dcfe-262a-f88f89c0b580"
] | rodrigo.reyesco@17bb37fe-d5a1-dcfe-262a-f88f89c0b580 |
347e2eedd3a6f0f3e78515a1e2dd39255d56a37e | 358c053b91085e8d93a52d2ef24b994f63c3ffaf | /src/fynal/project/MainWindow.java | 345bf236d4aee30c1f0f350c1fc53acdde8d2128 | [] | no_license | DylanBarrios/Proyecto_Final | 52b028481147a1551517a1303232521a5730a1c4 | fdae84ff6507c1ce03799e6193ddbc0e05bdc0a0 | refs/heads/master | 2020-05-19T16:49:02.496929 | 2019-05-13T23:52:46 | 2019-05-13T23:52:46 | 185,114,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,307 | java | package fynal.project;
import java.util.Random;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*MainWindow
* @author Usuario
*/
public class MainWindow extends javax.swing.JFrame {
PlayersDialog pd;
ReportsDialog rd;
private Random ale = new Random();
ReportsDialog rp = new ReportsDialog();
private TypeField matrixField[][];
private JButton matrixBtt[][];
private int x,y,poInitX,poInitY;
private int diceMov;
DefaultTableModel dtm;
TypeField posan;
private String mensaje;
public int anterior;
/**
* MainWindow
*/
public MainWindow() {
pd = new PlayersDialog();
rd = new ReportsDialog();
this.setResizable(false);
initComponents();
bttAddVehicles.setEnabled(false);
}
//Metodo qeu me envia el numero del archivo que haya elejido para jugar
public void sacarTexto(){
tmp tm = new tmp();
System.out.println("El valor es "+tm.getTmp());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
PanelBattle = new javax.swing.JPanel();
PanelButtons = new javax.swing.JPanel();
bttUP = new javax.swing.JButton();
BttLeft = new javax.swing.JButton();
bttRight = new javax.swing.JButton();
bttDown = new javax.swing.JButton();
ComboPlayer2 = new javax.swing.JComboBox();
ComboPlayer1 = new javax.swing.JComboBox();
diceMovementsGUI = new javax.swing.JLabel();
diceShotGUI = new javax.swing.JLabel();
diceWildcardGUI = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
Player1 = new javax.swing.JLabel();
Player2 = new javax.swing.JLabel();
bttAddVehicles = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
txt2 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu7 = new javax.swing.JMenu();
jMenu3 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem5 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem7 = new javax.swing.JMenuItem();
jMenu6 = new javax.swing.JMenu();
jMenuItem6 = new javax.swing.JMenuItem();
jMenuItem8 = new javax.swing.JMenuItem();
jMenuItem9 = new javax.swing.JMenuItem();
jMenuItem10 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem11 = new javax.swing.JMenuItem();
jMenuItem12 = new javax.swing.JMenuItem();
jMenuItem13 = new javax.swing.JMenuItem();
jMenu8 = new javax.swing.JMenu();
jMenuItem15 = new javax.swing.JMenuItem();
jMenuItem16 = new javax.swing.JMenuItem();
jMenuItem17 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
PanelBattle.setBackground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout PanelBattleLayout = new javax.swing.GroupLayout(PanelBattle);
PanelBattle.setLayout(PanelBattleLayout);
PanelBattleLayout.setHorizontalGroup(
PanelBattleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1023, Short.MAX_VALUE)
);
PanelBattleLayout.setVerticalGroup(
PanelBattleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
PanelButtons.setBackground(new java.awt.Color(255, 255, 255));
bttUP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/ArrowUP.png"))); // NOI18N
bttUP.setBorder(null);
bttUP.setContentAreaFilled(false);
bttUP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bttUPActionPerformed(evt);
}
});
BttLeft.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/ArrowLeft.png"))); // NOI18N
BttLeft.setBorder(null);
BttLeft.setContentAreaFilled(false);
BttLeft.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BttLeftActionPerformed(evt);
}
});
bttRight.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/ArrowRight.png"))); // NOI18N
bttRight.setBorder(null);
bttRight.setContentAreaFilled(false);
bttRight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bttRightActionPerformed(evt);
}
});
bttDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/ArrowDown.png"))); // NOI18N
bttDown.setBorder(null);
bttDown.setContentAreaFilled(false);
bttDown.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bttDownActionPerformed(evt);
}
});
ComboPlayer2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Choose a vehicle" }));
ComboPlayer1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Choose a Vehicle" }));
ComboPlayer1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ComboPlayer1ActionPerformed(evt);
}
});
diceMovementsGUI.setFont(new java.awt.Font("Monotype Corsiva", 1, 48)); // NOI18N
diceMovementsGUI.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
diceMovementsGUI.setText("DICE");
diceMovementsGUI.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
diceShotGUI.setFont(new java.awt.Font("Monotype Corsiva", 1, 48)); // NOI18N
diceShotGUI.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
diceShotGUI.setText("DICE");
diceWildcardGUI.setFont(new java.awt.Font("Monotype Corsiva", 1, 48)); // NOI18N
diceWildcardGUI.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
diceWildcardGUI.setText("DICE");
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel1.setText("AMOUNT OF MOVEMENTS");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel4.setText("shooting percentage");
jLabel2.setFont(new java.awt.Font("Monotype Corsiva", 1, 24)); // NOI18N
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("MOVE");
jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel5.setText("wildcard");
Player1.setText("Player 1");
Player2.setText("Player 2");
bttAddVehicles.setBackground(new java.awt.Color(0, 204, 204));
bttAddVehicles.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
bttAddVehicles.setForeground(new java.awt.Color(255, 255, 255));
bttAddVehicles.setText("Add Vehicles");
bttAddVehicles.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bttAddVehiclesActionPerformed(evt);
}
});
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Rhombus_34545.png"))); // NOI18N
txt2.setText("jLabel6");
javax.swing.GroupLayout PanelButtonsLayout = new javax.swing.GroupLayout(PanelButtons);
PanelButtons.setLayout(PanelButtonsLayout);
PanelButtonsLayout.setHorizontalGroup(
PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addComponent(Player1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Player2)
.addGap(124, 124, 124))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(bttAddVehicles))
.addComponent(diceWildcardGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(79, 79, 79))
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addComponent(txt2)
.addGap(17, 17, 17)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addComponent(ComboPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ComboPlayer2, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addGap(94, 94, 94)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(bttUP, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addGap(0, 33, Short.MAX_VALUE)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(diceMovementsGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(diceShotGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 167, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(86, 86, 86))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(105, 105, 105))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addComponent(BttLeft, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(bttRight, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(54, 54, 54))))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelButtonsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bttDown, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(145, 145, 145))
);
PanelButtonsLayout.setVerticalGroup(
PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelButtonsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bttUP, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(BttLeft)
.addComponent(bttRight)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bttDown, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(2, 2, 2)
.addComponent(diceMovementsGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(diceShotGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(diceWildcardGUI, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(bttAddVehicles)
.addGap(17, 17, 17)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Player1)
.addComponent(Player2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(PanelButtonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ComboPlayer1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ComboPlayer2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25))
);
jMenu1.setText("BattleField");
jMenu7.setText("New Game");
jMenu3.setText("4 X 4 ");
jMenu3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu3ActionPerformed(evt);
}
});
jMenuItem4.setText("Player vs Computer");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}
});
jMenu3.add(jMenuItem4);
jMenuItem5.setText("Player vs Player");
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
});
jMenu3.add(jMenuItem5);
jMenu7.add(jMenu3);
jMenu4.setText("6 X 4");
jMenuItem1.setText("Player vs Computer");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem1);
jMenuItem7.setText("Player vs Player");
jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem7ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem7);
jMenu7.add(jMenu4);
jMenu6.setText("8 X 9");
jMenuItem6.setText("Player vs Computer");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem6);
jMenuItem8.setText("Player vs Player");
jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem8ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem8);
jMenu7.add(jMenu6);
jMenu1.add(jMenu7);
jMenuItem9.setText("Load Game");
jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem9ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem9);
jMenuItem10.setText("Save Game");
jMenu1.add(jMenuItem10);
jMenuItem3.setText("Clear");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem3);
jMenuBar1.add(jMenu1);
jMenu2.setText("Reports");
jMenuItem2.setText("Vehicles reports");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem2);
jMenuItem11.setText("Battle Reports");
jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem11ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem11);
jMenuItem12.setText("Best Vehicle");
jMenu2.add(jMenuItem12);
jMenuItem13.setText("Worst Vehicle");
jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem13ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem13);
jMenuBar1.add(jMenu2);
jMenu8.setText("More Optiones");
jMenuItem15.setText("Shop Store");
jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem15ActionPerformed(evt);
}
});
jMenu8.add(jMenuItem15);
jMenuItem16.setText("Create Vehicles");
jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem16ActionPerformed(evt);
}
});
jMenu8.add(jMenuItem16);
jMenuItem17.setText("Create Weapons");
jMenu8.add(jMenuItem17);
jMenuBar1.add(jMenu8);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(PanelBattle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(PanelButtons, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(5, 5, 5))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(PanelButtons, javax.swing.GroupLayout.PREFERRED_SIZE, 947, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(PanelBattle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void bttUPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttUPActionPerformed
mensaje = ComboPlayer1.getSelectedItem().toString();
clear();
movements();
shot();
diceWildcardGUI.setText("NOT");
poInitY-=diceMov;
if(poInitY<0){
poInitY+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane,"Out of Matrix");
}
else if( mensaje.equals("War Tank")&&(matrixField[poInitX][poInitY] instanceof Lake || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitY+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A tank can not be on the water or on an enemy");
}
else if( mensaje.equals("War Plane")&&(matrixField[poInitX][poInitY] instanceof Mountain || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitY+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A Plane can not be on the Mountains or on an enemy");
}else{
poInitY+=diceMov;
//Me imprime donde estaba antes
matrixField[poInitX][poInitY] = posan;
poInitY-=diceMov;
//Me guarda el nuevo campo
posan = matrixField[poInitX][poInitY];
//Me configura el nuevo lugar
matrixField[poInitX][poInitY] = pd.one;
addPanel();
}
}//GEN-LAST:event_bttUPActionPerformed
private void ComboPlayer1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ComboPlayer1ActionPerformed
}//GEN-LAST:event_ComboPlayer1ActionPerformed
/**
* Introduzco el numero de archivo sleccionado para cargar juego
* a una varibale qeu esta en otra clase
*/
private void set(){
tmp tm = new tmp();
txt2.setText(tm.getTmp());
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
pd.TextFieldP2.setEnabled(false);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield4();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem4ActionPerformed
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
pd.TextFieldP2.setEnabled(true);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield4();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem5ActionPerformed
private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu3ActionPerformed
}//GEN-LAST:event_jMenu3ActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
pd.TextFieldP2.setEnabled(false);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield6();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
pd.TextFieldP2.setEnabled(true);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield6();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem7ActionPerformed
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
pd.TextFieldP2.setEnabled(false);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield8();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem6ActionPerformed
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
pd.TextFieldP2.setEnabled(true);
pd.TextFieldP1.setText(null);
pd.TextFieldP2.setText(null);
clear();
pd.setVisible(true);
newBattliedfield8();
bttAddVehicles.setEnabled(true);
ComboPlayer1.removeAllItems();
ComboPlayer1.addItem("Choose a Vehicle");
}//GEN-LAST:event_jMenuItem8ActionPerformed
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
clear();
}//GEN-LAST:event_jMenuItem3ActionPerformed
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
rd.setVisible(true);
}//GEN-LAST:event_jMenuItem2ActionPerformed
private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenuItem11ActionPerformed
private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem13ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jMenuItem13ActionPerformed
private void bttAddVehiclesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttAddVehiclesActionPerformed
addVehicles();
bttAddVehicles.setEnabled(false);
}//GEN-LAST:event_bttAddVehiclesActionPerformed
private void bttRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttRightActionPerformed
mensaje = ComboPlayer1.getSelectedItem().toString();
clear();
movements();
shot();
diceWildcardGUI.setText("NOT");
poInitX+=diceMov;
if(poInitX>(x-1)){
poInitX-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "Out of Matrix");
}
else if( mensaje.equals("War Tank")&&(matrixField[poInitX][poInitY] instanceof Lake || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitX-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A tank can not be on the water or on an enemy");
}
else if( mensaje.equals("War Plane")&&(matrixField[poInitX][poInitY] instanceof Mountain || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitX-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A Plane can not be on the Mountains or on an enemy");
}else{
poInitX-=diceMov;
//Me imprime donde estaba antes
matrixField[poInitX][poInitY] = posan;
poInitX+=diceMov;
//Me guarda el nuevo campo
posan = matrixField[poInitX][poInitY];
//Me configura el nuevo lugar
matrixField[poInitX][poInitY] = pd.one;
addPanel();
}
}//GEN-LAST:event_bttRightActionPerformed
private void BttLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BttLeftActionPerformed
mensaje = ComboPlayer1.getSelectedItem().toString();
clear();
movements();
shot();
diceWildcardGUI.setText("NOT");
poInitX-=diceMov;
if(poInitX<0){
poInitX+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "Out of Matrix");
}
else if( mensaje.equals("War Tank")&&(matrixField[poInitX][poInitY] instanceof Lake || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitX+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A tank can not be on the water or on an enemy");
}
else if( mensaje.equals("War Plane")&&(matrixField[poInitX][poInitY] instanceof Mountain || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitX+=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A Plane can not be on the Mountains or on an enemy");
}else{
poInitX+=diceMov;
//Me imprime donde estaba antes
matrixField[poInitX][poInitY] = posan;
poInitX-=diceMov;
//Me guarda el nuevo campo
posan = matrixField[poInitX][poInitY];
//Me configura el nuevo lugar
matrixField[poInitX][poInitY] = pd.one;
addPanel();
}
}//GEN-LAST:event_BttLeftActionPerformed
private void bttDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttDownActionPerformed
mensaje = ComboPlayer1.getSelectedItem().toString();
clear();
movements();
shot();
diceWildcardGUI.setText("NOT");
poInitY+=diceMov;
if(poInitY>(y-1)){
poInitY-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "Out of Matrix");
}
else if( mensaje.equals("War Tank")&&(matrixField[poInitX][poInitY] instanceof Lake || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitY-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A tank can not be on the water or on an enemy");
}
else if( mensaje.equals("War Plane")&&(matrixField[poInitX][poInitY] instanceof Mountain || matrixField[poInitX][poInitY] instanceof Enemies)){
poInitY-=diceMov;
addPanel();
JOptionPane.showMessageDialog(rootPane, "A Plane can not be on the Mountains or on an enemy");
}else{
poInitY-=diceMov;
//Me imprime donde estaba antes
matrixField[poInitX][poInitY] = posan;
poInitY+=diceMov;
//Me guarda el nuevo campo
posan = matrixField[poInitX][poInitY];
//Me configura el nuevo lugar
matrixField[poInitX][poInitY] = pd.one;
addPanel();
}
}//GEN-LAST:event_bttDownActionPerformed
private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed
bttAddVehicles.setEnabled(true);
rd.setVisible(true);
}//GEN-LAST:event_jMenuItem9ActionPerformed
private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed
ShopStore_ ss = new ShopStore_();
ss.setVisible(true);
}//GEN-LAST:event_jMenuItem15ActionPerformed
private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
CreateVehicles cv = new CreateVehicles();
cv.setVisible(true);
}//GEN-LAST:event_jMenuItem16ActionPerformed
/**
*Me limpia todo lo que tenga en matriz del juego
*/
public void clear(){
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
PanelBattle.remove(matrixBtt[i][j]);
}
}
repaint();
}
/**
*Metodos que me serviran para indicar tamaño a mis matrices
*/
private void newBattliedfield4() {
battliedfield(4, 4);
}
private void newBattliedfield6() {
battliedfield(6, 4);
}
private void newBattliedfield8() {
battliedfield(9, 8);
}
/**
*Metodo que resive el tamaño de la matriz que desee
* @param x
* @param y
*/
private void battliedfield(int x, int y){
this.x = x;
this.y = y;
matrixField = new TypeField[x][y];
matrixBtt = new JButton[x][y];
createMatrix();
}
/**
*Me genera una matriz de instancias qeu me serviran para comparar al momento
* de estar jugando
*/
private void createMatrix(){
int instances = 0;
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
instances = ale.nextInt(3);
switch(instances){
case 0:
matrixField[i][j] = new Grass();
break;
case 1:
matrixField[i][j] = new Mountain();
break;
case 2:
matrixField[i][j] = new Lake();
break;
}
}
}
for (int i = 0; i < x; i++) {
for (int j = 0; j < 2; j++) {
instances = ale.nextInt(5);
switch(instances){
case 0:
break;
case 1:
matrixField[i][j] = new Enemies();
break;
case 2:
break;
case 3:
matrixField[i][j] = new Enemies();
break;
case 4:
break;
}
}
}
poInitX=0;
poInitY=3;
posan = matrixField[poInitX][poInitY];
matrixField[poInitX][poInitY] = pd.one;
addPanel();
}
/**
*Metodo que me va a poner imagenes dependeindo de la instancia qeu tengan
*/
private void addPanel() {
mensaje = ComboPlayer1.getSelectedItem().toString();
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
matrixBtt[i][j] = new JButton();
matrixBtt[i][j].setSize(100, 100);
matrixBtt[i][j].setLocation(i*110, j*110);
if(matrixField[i][j] instanceof Grass)
matrixBtt[i][j].setIcon(new ImageIcon("src/Imagenes/Grass.jpg"));
else if(matrixField[i][j] instanceof Mountain)
matrixBtt[i][j].setIcon(new ImageIcon("src/Imagenes/Mountain.jpg"));
else if(matrixField[i][j] instanceof Lake)
matrixBtt[i][j].setIcon(new ImageIcon("src/Imagenes/Lake.jpg"));
else if(matrixField[i][j] instanceof Vehicles&&mensaje.equals("War Plane"))
matrixBtt[poInitX][poInitY].setIcon(new ImageIcon("src/Imagenes/plane.jpg"));
else if(matrixField[i][j] instanceof Vehicles&&mensaje.equals("War Tank"))
matrixBtt[poInitX][poInitY].setIcon(new ImageIcon("src/Imagenes/tank.jpg"));
else if(matrixField[i][j] instanceof Enemies)
matrixBtt[i][j].setIcon(new ImageIcon("src/Imagenes/Enemy.jpg"));
else
matrixBtt[poInitX][poInitY].setIcon(new ImageIcon("src/Imagenes/plane.jpg"));
matrixBtt[i][j].setVisible(true);
PanelBattle.add(matrixBtt[i][j]);
}
}
}
/**
*Me genera el dado para moverme
*/
private void movements() {
diceMov = (int) (Math.random() * 3)+1;
String textMovs = Integer.toString(diceMov);
diceMovementsGUI.setText(textMovs);
}
/**
*Me genera el dado para la precision al disparar
*/
private void shot(){
int diceShot;
diceShot = (int) (Math.random() * 100) + 1;
String textShot = Integer.toString(diceShot);
diceShotGUI.setText(textShot+"%");
}
/**
*AGrega los vehiculos al combo box de jugar
*/
public void addVehicles(){
ComboPlayer1.addItem(pd.vehicle1);
ComboPlayer1.addItem(pd.vehicle2);
ComboPlayer1.addItem(pd.vehicle3);
ComboPlayer2.addItem(pd.vehicle4);
ComboPlayer2.addItem(pd.vehicle5);
ComboPlayer2.addItem(pd.vehicle6);
}
public void prueba(){
// tmp t = new tmp();
// System.out.println(t.getTmp());
// String tmpo = Integer.toString(t.getTmp());
// System.out.println(tmpo);
// File URL = new File(pd.ubicacion+pd.registros[0].getName());
// try {
// FileInputStream fis = new FileInputStream(URL);
// rp.mostrar.load(fis);
// pd.vehicle1 = rp.mostrar.getProperty("TipoVehiculo1");
// System.out.println("Ella tiene"+pd.vehicle1);
// pd.vehicle2 = rp.mostrar.getProperty("TipoVehiculo2");
// System.out.println("Ella tiene"+pd.vehicle2);
// pd.vehicle3 = rp.mostrar.getProperty("TipoVehiculo3");
// System.out.println("Ella tiene"+pd.vehicle3);
// }
// catch(Exception e){System.out.println("Fallo"+e);}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton BttLeft;
public javax.swing.JComboBox ComboPlayer1;
public javax.swing.JComboBox ComboPlayer2;
private javax.swing.JPanel PanelBattle;
private javax.swing.JPanel PanelButtons;
public javax.swing.JLabel Player1;
public javax.swing.JLabel Player2;
public javax.swing.JButton bttAddVehicles;
private javax.swing.JButton bttDown;
private javax.swing.JButton bttRight;
private javax.swing.JButton bttUP;
private javax.swing.JLabel diceMovementsGUI;
private javax.swing.JLabel diceShotGUI;
private javax.swing.JLabel diceWildcardGUI;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenu jMenu7;
private javax.swing.JMenu jMenu8;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem10;
private javax.swing.JMenuItem jMenuItem11;
private javax.swing.JMenuItem jMenuItem12;
private javax.swing.JMenuItem jMenuItem13;
private javax.swing.JMenuItem jMenuItem15;
private javax.swing.JMenuItem jMenuItem16;
private javax.swing.JMenuItem jMenuItem17;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JMenuItem jMenuItem7;
private javax.swing.JMenuItem jMenuItem8;
private javax.swing.JMenuItem jMenuItem9;
public javax.swing.JLabel txt2;
// End of variables declaration//GEN-END:variables
} | [
"[email protected]"
] | |
44ec8039bc98b92b826bc271890095f9fcb86342 | f9bf6f73e0640e723bc392be9e1004adaf8dcec4 | /src/metier/etat/Etats.java | 05c5e554ed9d959adbd69f629a39b4df87baa3b5 | [] | no_license | alexc21/g-art-de-manger | d2f75e476eb564b690e040a8b0f5c16576829186 | acaaa464e1927fd250a7f58a0bf4012b7a86b9d7 | refs/heads/master | 2022-11-12T13:42:29.902481 | 2020-07-02T12:20:49 | 2020-07-02T12:20:49 | 276,636,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 159 | java | package metier.etat;
import java.util.ArrayList;
public class Etats extends ArrayList<Etat> {
private static final long serialVersionUID = 1L;
}
| [
"[email protected]"
] | |
ed5676efc6b874498b3d954ed8c6b46c4c4b3858 | 62e330c99cd6cedf20bc162454b8160c5e1a0df8 | /basex-core/src/main/java/org/basex/query/func/fn/FnSubstringAfter.java | 92e062618de9809e5b45b301aae9b29e33210d4f | [
"BSD-3-Clause"
] | permissive | nachawati/basex | 76a717b069dcea3932fad5116e0a42a727052b58 | 0bc95648390ec3e91b8fd3e6ddb9ba8f19158807 | refs/heads/master | 2021-07-20T06:57:18.969297 | 2017-10-31T04:17:00 | 2017-10-31T04:17:00 | 106,351,382 | 0 | 0 | null | 2017-10-10T01:00:38 | 2017-10-10T01:00:38 | null | UTF-8 | Java | false | false | 849 | java | package org.basex.query.func.fn;
import static org.basex.util.Token.*;
import org.basex.query.*;
import org.basex.query.func.*;
import org.basex.query.util.collation.*;
import org.basex.query.value.item.*;
import org.basex.util.*;
/**
* Function implementation.
*
* @author BaseX Team 2005-17, BSD License
* @author Christian Gruen
*/
public final class FnSubstringAfter extends StandardFunc {
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
final byte[] ss = toEmptyToken(exprs[0], qc), sb = toEmptyToken(exprs[1], qc);
final Collation coll = toCollation(2, qc);
if(coll == null) {
final int p = indexOf(ss, sb);
return p == -1 ? Str.ZERO : Str.get(substring(ss, p + sb.length));
}
return Str.get(coll.after(ss, sb, info));
}
}
| [
"[email protected]"
] | |
a8a47af038994194155b516ad9c729335507047c | 9fb58555b6ad35e085ce4a4e1e9b651873174d6a | /src/test/java/com.corneti/elasticsearch/plugin/ingest/geocoding/GeocodingProcessorTests.java | 3a179c29ee5f9f6d7047b84920d2302ec63bd749 | [] | no_license | mostrilla/ingest-geocoding | 919ac7e80f078ba52a16f5f63c517d48c900f85c | 50e75df574dc72c8c682a45d728090f3097994e0 | refs/heads/master | 2023-08-13T09:03:43.271715 | 2018-10-28T02:19:04 | 2018-10-28T02:19:04 | 417,463,923 | 0 | 0 | null | 2021-10-15T10:48:03 | 2021-10-15T10:47:12 | null | UTF-8 | Java | false | false | 10,170 | java | /*
* Copyright [2017] [Fabio Corneti]
*
* 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.corneti.elasticsearch.plugin.ingest.geocoding;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.ingest.IngestDocument;
import org.elasticsearch.ingest.RandomDocumentPicks;
import org.elasticsearch.test.ESTestCase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.corneti.elasticsearch.plugin.ingest.geocoding.IngestGeocodingPlugin.API_KEY;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
public class GeocodingProcessorTests extends ESTestCase {
static final String KNOWN_ADDRESS = "1600 Amphitheatre Parkway, Mountain+View, CA, US";
static final String MOCK_KEY = "mock_key";
/**
* This mocks returns a valid {@link GeocodingOutput} for the known address if the expected mock key
* was specified in the settings, otherwise null.
*/
static final class GeocodingServiceMock extends GeocodingService {
GeocodingServiceMock(Settings settings) {
super(settings);
}
@Override
GeocodingOutput geocode(String address) {
if (API_KEY.get(super.settings).equals(MOCK_KEY)) {
if (address.equals(KNOWN_ADDRESS)) {
return new GeocodingOutput(1.0, -1.0);
}
return null;
}
return new GeocodingOutput(new Exception("Invalid API key (mock)."));
}
}
@SuppressWarnings("unchecked")
public void testKnownAddressWithMissingAPIKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", KNOWN_ADDRESS);
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final GeocodingService service = new GeocodingService(Settings.EMPTY);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), equalTo(KNOWN_ADDRESS));
assertThat(ingestDocument.hasField("loc.coordinates"), is(false));
final List<String> errors = ingestDocument.getFieldValue("loc._errors", List.class);
assertThat(errors.size(), is(1));
assertThat(errors.get(0), equalTo("Invalid API key."));
} finally {
service.stop();
service.close();
}
}
@SuppressWarnings("unchecked")
public void testAddressAsMapWithMissingAPIKey() throws Exception {
final Map<String, String> addressMap = new HashMap<>();
addressMap.put("road", "to nowhere");
final Map<String, Object> document = new HashMap<>();
document.put("address", addressMap);
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final GeocodingService service = new GeocodingService(Settings.EMPTY);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", Map.class, true), equalTo(addressMap));
assertThat(ingestDocument.hasField("loc.coordinates"), is(false));
final List<String> errors = ingestDocument.getFieldValue("loc._errors", List.class);
assertThat(errors.size(), is(1));
assertThat(errors.get(0),
equalTo("field [address] of type [java.util.HashMap] cannot be cast to [java.lang.String]"));
} finally {
service.stop();
service.close();
}
}
public void testEmptyAddressWithMissingAPIKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", " ");
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final GeocodingService service = new GeocodingService(Settings.EMPTY);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), equalTo(" "));
assertThat(ingestDocument.hasField("loc._errors"), is(false));
assertThat(ingestDocument.getFieldValue("loc.coordinates", Map.class), nullValue());
} finally {
service.stop();
service.close();
}
}
public void testNullAddressWithMissingAPIKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", null);
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final GeocodingService service = new GeocodingService(Settings.EMPTY);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), nullValue());
assertThat(ingestDocument.hasField("loc._errors"), is(false));
assertThat(ingestDocument.getFieldValue("loc.coordinates", Map.class), nullValue());
} finally {
service.stop();
service.close();
}
}
public void testNoAddressWithMissingAPIKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final GeocodingService service = new GeocodingService(Settings.EMPTY);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.hasField("loc"), is(false));
} finally {
service.stop();
service.close();
}
}
@SuppressWarnings("unchecked")
public void testKnownAddressUsingMockWithCorrectApiKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", KNOWN_ADDRESS);
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final Settings settings = Settings.builder()
.put(API_KEY.getKey(), MOCK_KEY)
.build();
final GeocodingService service = new GeocodingServiceMock(settings);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), equalTo(KNOWN_ADDRESS));
assertThat(ingestDocument.hasField("loc._errors"), is(false));
assertThat(ingestDocument.hasField("loc.coordinates.lat"), is(true));
assertThat(ingestDocument.hasField("loc.coordinates.lon"), is(true));
final Map<String, Double> coordinates = ingestDocument.getFieldValue("loc.coordinates", Map.class);
assertThat(coordinates.size(), is(2));
final Double lat = ingestDocument.getFieldValue("loc.coordinates.lat", Double.class);
final Double lon = ingestDocument.getFieldValue("loc.coordinates.lon", Double.class);
assertThat(lat, equalTo(1.0));
assertThat(lon, equalTo(-1.0));
} finally {
service.stop();
service.close();
}
}
@SuppressWarnings("unchecked")
public void testKnownAddressUsingMockWithIncorrectApiKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", KNOWN_ADDRESS);
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final Settings settings = Settings.builder()
.put(API_KEY.getKey(), "abc")
.build();
final GeocodingService service = new GeocodingServiceMock(settings);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), equalTo(KNOWN_ADDRESS));
assertThat(ingestDocument.hasField("loc.coordinates"), is(false));
final List<String> errors = ingestDocument.getFieldValue("loc._errors", List.class);
assertThat(errors.size(), is(1));
assertThat(errors.get(0), equalTo("Invalid API key (mock)."));
} finally {
service.stop();
service.close();
}
}
public void testUnknownAddressUsingMockWithCorrectApiKey() throws Exception {
final Map<String, Object> document = new HashMap<>();
document.put("address", "unknown");
final IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document);
final Settings settings = Settings.builder()
.put(API_KEY.getKey(), MOCK_KEY)
.build();
final GeocodingService service = new GeocodingServiceMock(settings);
service.start();
try {
final GeocodingProcessor processor = new GeocodingProcessor(service, "geocoding", "address", "loc");
processor.execute(ingestDocument);
assertThat(ingestDocument.getFieldValue("address", String.class, true), equalTo("unknown"));
assertThat(ingestDocument.hasField("loc.coordinates"), is(true));
assertThat(ingestDocument.hasField("loc._errors"), is(false));
assertThat(ingestDocument.getFieldValue("loc.coordinates", Map.class), nullValue());
} finally {
service.stop();
service.close();
}
}
}
| [
"[email protected]"
] | |
083d434571a6c5886aa91ac45c59f9128bc86410 | e0e4eedbe00b79f9c00d8e14c3e49395c98b79ae | /app/src/main/java/com/cmbpizza/razor/golubev/AdminMenu.java | 455cbfdb35e783170cffbe06519e28b75014ce24 | [] | no_license | leaderout/Course-work2 | 67b2a50b9d1b1fcc5c41f2e7c7a29b2c3732e35e | 665ac7fcf97f4d28e7ea11ef9043f269c0ddceb5 | refs/heads/main | 2023-02-05T14:10:06.400418 | 2020-12-17T21:40:28 | 2020-12-17T21:40:28 | 322,300,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,864 | java | package com.cmbpizza.razor.golubev;
import android.Manifest;
import android.app.Activity;
import android.app.ActivityOptions;
import android.app.Dialog;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.util.Base64;
import android.util.Pair;
import android.util.TypedValue;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SearchView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
public class AdminMenu extends Activity implements View.OnClickListener, SearchView.OnQueryTextListener, SearchView.OnSuggestionListener, SearchView.OnCloseListener, ListView.OnItemClickListener {
private static final String[] COLUMNS = {
BaseColumns._ID,
SearchManager.SUGGEST_COLUMN_TEXT_1,
SearchManager.SUGGEST_COLUMN_ICON_1
};
private static SQLLiteHelperProducts sqLiteHelper;
final int REQUEST_CODE_GALLERY = 999;
public int orderCount = 0;
public Dialog addProductDialog;
public Dialog orderDialog;
FloatingActionButton FabAddProduct;
Button AddProductButton, CancelButton, ChooseImageButton, CheckOrderButton;
EditText AddProductTitle, AddProductPrice, AddProductDescription;
Spinner SpinnerProductCategory;
ImageView ImgProductImageView;
SearchView AdminSearchView;
ListView ProductListView, OrderListView;
ArrayList<Products> ProductList;
ArrayList<Integer> ProductIDList;
ArrayList<Orders> OrderList;
ProductListAdapter ListAdapter;
OrderListAdapter OrderListAdapter;
private SearchSuggestionsAdapter mSuggestionsAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_menu);
initializeComponents();
initializeListeners();
sqlLiteDB();
getAllData();
getAllSearchSuggestions();
}
@Override
protected void onStart() {
super.onStart();
AdminSearchView.setIconified(true);
AdminSearchView.clearFocus();
getOrderCount();
checkOrderCount();
getAllData();
}
private void initializeComponents() {
orderDialog = new Dialog(AdminMenu.this);
orderDialog.setContentView(R.layout.admin_check_order_dialog);
ProductListView = findViewById(R.id.adminListView);
AdminSearchView = findViewById(R.id.adminSearchView);
OrderListView = orderDialog.findViewById(R.id.adminOrderListView);
AutoCompleteTextView searchAutoCompleteTextView = AdminSearchView.findViewById(AdminSearchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null));
searchAutoCompleteTextView.setThreshold(0);
ProductList = new ArrayList<>();
ProductIDList = new ArrayList<>();
OrderList = new ArrayList<>();
ListAdapter = new ProductListAdapter(AdminMenu.this, R.layout.admin_product_items_list, ProductList);
ProductListView.setAdapter(ListAdapter);
OrderListAdapter = new OrderListAdapter(orderDialog.getContext(), R.layout.admin_check_order_list_view, OrderList);
OrderListView.setAdapter(OrderListAdapter);
FabAddProduct = findViewById(R.id.add_product_fab);
CheckOrderButton = findViewById(R.id.adminOrderCheckButton);
addProductDialog = new Dialog(AdminMenu.this);
addProductDialog.setContentView(R.layout.admin_add_product_dialog);
AddProductButton = addProductDialog.findViewById(R.id.btnAdminAddProduct);
CancelButton = addProductDialog.findViewById(R.id.btnAdminCancel);
ChooseImageButton = addProductDialog.findViewById(R.id.btnAdminAddProductImage);
ImgProductImageView = addProductDialog.findViewById(R.id.imgProductImage);
AddProductTitle = addProductDialog.findViewById(R.id.txtNewProductTitle);
AddProductPrice = addProductDialog.findViewById(R.id.txtNewProductPrice);
AddProductDescription = addProductDialog.findViewById(R.id.txtNewProductDescription);
SpinnerProductCategory = addProductDialog.findViewById(R.id.spinnerAddProductCategory);
}
private void initializeListeners() {
AddProductButton.setOnClickListener(this);
CancelButton.setOnClickListener(this);
ChooseImageButton.setOnClickListener(this);
FabAddProduct.setOnClickListener(this);
AdminSearchView.setOnQueryTextListener(this);
AdminSearchView.setOnSuggestionListener(this);
AdminSearchView.setOnCloseListener(this);
ProductListView.setOnItemClickListener(this);
CheckOrderButton.setOnClickListener(this);
OrderListAdapter.registerDataSetObserver(new DataSetObserver() {
@Override
public void onChanged() {
super.onChanged();
getOrderCount();
checkOrderCount();
}
});
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnAdminAddProduct:
addProductToDB();
break;
case R.id.btnAdminCancel:
AddProductTitle.getText().clear();
AddProductPrice.getText().clear();
AddProductDescription.getText().clear();
ImgProductImageView.setImageBitmap(null);
addProductDialog.cancel();
getAllData();
break;
case R.id.btnAdminAddProductImage:
ActivityCompat.requestPermissions(
AdminMenu.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_CODE_GALLERY
);
break;
case R.id.add_product_fab:
addProductFAB();
break;
case R.id.adminOrderCheckButton:
showOrderDialog();
break;
}
}
private void showOrderDialog() {
getOrderDetails();
orderDialog.setCancelable(true);
orderDialog.setCanceledOnTouchOutside(true);
orderDialog.show();
}
private void getOrderDetails() {
OrderList.clear();
//Toast.makeText(this, "ArrayLength: " + String.valueOf(sqLiteHelper.getCartCount(randomID)), Toast.LENGTH_SHORT).show();
OrderList.addAll(sqLiteHelper.getAllOrderItems());
//Toast.makeText(this, "ArrayLength: " + String.valueOf(CartItemsList.size()), Toast.LENGTH_SHORT).show();
OrderListAdapter.notifyDataSetChanged();
}
private void getOrderCount() {
orderCount = sqLiteHelper.getOrderCount();
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
TextView ListProductId = view.findViewById(R.id.productId);
Intent newIntent = new Intent(AdminMenu.this, AdminProductView.class);
Pair<View, String> pairImage = Pair.create(view.findViewById(R.id.productImage), "productImageAdmin");
Pair<View, String> pairTitle = Pair.create(view.findViewById(R.id.productTitle), "productTitleAdmin");
Pair<View, String> pairDescription = Pair.create(view.findViewById(R.id.productDescription), "productDescriptionAdmin");
Pair<View, String> pairCategory = Pair.create(view.findViewById(R.id.productCategory), "productCategoryAdmin");
Pair<View, String> pairPrice = Pair.create(view.findViewById(R.id.productPrice), "productPriceAdmin");
ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(
AdminMenu.this,
pairImage,
pairTitle,
pairDescription,
pairCategory,
pairPrice);
newIntent.putExtra("productId", ListProductId.getText().toString());
startActivity(newIntent, activityOptions.toBundle());
}
public static String getPath(Uri uri, Context context) {
if (uri == null) {
Toast.makeText(context, "Невозможно обновить картинку, поробуйте ещё раз", Toast.LENGTH_SHORT).show();
return null;
}
String[] projection = {MediaStore.Images.Media.DATA};
Cursor cursor = context.getContentResolver().query(uri, projection, null, null, null);
if (cursor != null) {
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String path = cursor.getString(column_index);
cursor.close();
return path;
}
return uri.getPath();
}
public static Bitmap decodeBitmapFromFilePath(String path, int reqHeight, int reqWidth) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(path, options);
options.inSampleSize = calculateInSampleSize(options, reqHeight, reqWidth);
options.inJustDecodeBounds = false;
return BitmapFactory.decodeFile(path, options);
}
private static int calculateInSampleSize(BitmapFactory.Options options, int reqHeight, int reqWidth) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
while ((halfHeight / inSampleSize) >= reqHeight && (halfWidth / inSampleSize) >= reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
private void getAllSearchSuggestions() {
MatrixCursor cursor = new MatrixCursor(COLUMNS);
for(int i: ProductIDList){
cursor.addRow(new String[]{String.valueOf(sqLiteHelper.getProductID(i)), sqLiteHelper.getProductTitle(i), android.util.Base64.encodeToString(sqLiteHelper.getProductImage(i), Base64.DEFAULT)});
}
mSuggestionsAdapter = new SearchSuggestionsAdapter(AdminSearchView.getContext(), cursor, R.layout.search_suggestion_view, false);
AdminSearchView.setSuggestionsAdapter(mSuggestionsAdapter);
}
public void getSearchTextSuggestions(String searchString) {
MatrixCursor cursor = new MatrixCursor(COLUMNS);
ArrayList<Products> filterProductList = new ArrayList<>();
filterProductList.clear();
if (!searchString.isEmpty()) {
String searchStringLower = searchString.toLowerCase();
for (Products list : ProductList) {
String ProductName = list.getProductTitle().toLowerCase();
if (ProductName.startsWith(searchStringLower)) {
filterProductList.add(list);
}
}
for(Products filterList: filterProductList){
cursor.addRow(new String[]{String.valueOf(filterList.getProductId()), filterList.getProductTitle(), android.util.Base64.encodeToString(filterList.getProductImage(), Base64.DEFAULT)});
}
} else {
for(int i: ProductIDList){
cursor.addRow(new String[]{String.valueOf(sqLiteHelper.getProductID(i)), sqLiteHelper.getProductTitle(i), android.util.Base64.encodeToString(sqLiteHelper.getProductImage(i), Base64.DEFAULT)});
}
}
mSuggestionsAdapter = new SearchSuggestionsAdapter(AdminSearchView.getContext(), cursor, R.layout.search_suggestion_view, false);
AdminSearchView.setSuggestionsAdapter(mSuggestionsAdapter);
}
public byte[] imageViewToByte(ImageView image) {
Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
return stream.toByteArray();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == REQUEST_CODE_GALLERY) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_CODE_GALLERY);
} else {
Toast.makeText(AdminMenu.this, "У вас нет разрешения для доступа к галлереи", Toast.LENGTH_SHORT).show();
}
return;
}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_GALLERY && resultCode == RESULT_OK && data != null) {
Uri uri = data.getData();
ImgProductImageView.setImageBitmap(decodeBitmapFromFilePath(getPath(uri, this), 150, 150));
}
super.onActivityResult(requestCode, resultCode, data);
}
private void addProductFAB() {
addProductDialog.setCancelable(true);
addProductDialog.setCanceledOnTouchOutside(true);
addProductDialog.show();
}
private void sqlLiteDB() {
sqLiteHelper = new SQLLiteHelperProducts(AdminMenu.this, "ProductDB", null, 1);
sqLiteHelper.dataQuery("CREATE TABLE IF NOT EXISTS productTable (productId INTEGER PRIMARY KEY AUTOINCREMENT, productTitle VARCHAR, productCategory VARCHAR, productPrice INTEGER, productDescription VARCHAR, productImage BLOB)");
sqLiteHelper.dataQuery("CREATE TABLE IF NOT EXISTS productOrderTable (orderId INTEGER PRIMARY KEY, memberId INTEGER, idList VARCHAR, quantityList VARCHAR, totalPrice INTEGER, orderStatus INTEGER)");
}
private void getAllData() {
ProductIDList.clear();
ProductList.clear();
for (Products product: sqLiteHelper.getAllData()) {
ProductIDList.add(product.getProductId());
ProductList.add(new Products(product.getProductId(), product.getProductTitle(), product.getProductCategory(), product.getProductPrice(), product.getProductDescription(), product.getProductImage()));
}
ListAdapter.notifyDataSetChanged();
}
private void addProductToDB() {
if (inputValidation()) {
try {
sqLiteHelper.insertData(
AddProductTitle.getText().toString().trim(),
SpinnerProductCategory.getSelectedItem().toString(),
Integer.parseInt(AddProductPrice.getText().toString()),
AddProductDescription.getText().toString(),
imageViewToByte(ImgProductImageView)
);
Toast.makeText(AdminMenu.this, "Продукт успешно добавлен!", Toast.LENGTH_SHORT).show();
} catch (Exception ex) {
ex.printStackTrace();
}
getAllData();
AddProductTitle.getText().clear();
AddProductPrice.getText().clear();
AddProductDescription.getText().clear();
ImgProductImageView.setImageBitmap(null);
addProductDialog.cancel();
}
}
private boolean inputValidation() {
boolean valid;
if (ImgProductImageView.getDrawable() == null) {
valid = false;
Toast.makeText(this, "Пожалуйста, включите изображение продукта", Toast.LENGTH_SHORT).show();
} else if (String.valueOf(AddProductTitle.getText()).isEmpty()) {
valid = false;
Toast.makeText(this, "Пожалуйста, введите название продукта", Toast.LENGTH_SHORT).show();
} else if (String.valueOf(AddProductPrice.getText()).isEmpty()) {
valid = false;
Toast.makeText(this, "Пожалуйста, введите цену продукта", Toast.LENGTH_SHORT).show();
} else if (String.valueOf(AddProductDescription.getText()).isEmpty()) {
valid = false;
Toast.makeText(this, "Пожалуйста, введите описание продукта", Toast.LENGTH_SHORT).show();
} else {
valid = true;
}
return valid;
}
@Override
public boolean onQueryTextSubmit(String s) {
String searchStringLower = s.toLowerCase();
ArrayList<Products> filterProductList = new ArrayList<>();
for (Products list : ProductList) {
String ProductName = list.getProductTitle().toLowerCase();
if (ProductName.startsWith(searchStringLower)) {
filterProductList.add(list);
}
}
ProductList.clear();
ProductList.addAll(filterProductList);
ListAdapter.notifyDataSetChanged();
filterProductList.clear();
Toast.makeText(this, "Вы искали: " + s, Toast.LENGTH_LONG).show();
return true;
}
@Override
public boolean onQueryTextChange(String searchString) {
if (!searchString.isEmpty()) {
getSearchTextSuggestions(searchString);
} else {
getAllSearchSuggestions();
getAllData();
}
return true;
}
@Override
public boolean onSuggestionSelect(int i) {
return false;
}
@Override
public boolean onSuggestionClick(int i) {
Cursor c = (Cursor) mSuggestionsAdapter.getItem(i);
String query = c.getString(c.getColumnIndex(SearchManager.SUGGEST_COLUMN_TEXT_1));
AdminSearchView.setQuery(query, true);
return true;
}
@Override
public boolean onClose() {
getAllData();
return true;
}
private void checkOrderCount() {
RelativeLayout relativeLayoutButton, relativeLayoutBadge;
relativeLayoutButton = findViewById(R.id.layoutRelativeOrderCheckButton);
relativeLayoutBadge = findViewById(R.id.layoutRelativeOrderButtonBadge);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (orderCount > 0) {
layoutParams.setMargins(layoutParams.getMarginStart(), 0, layoutParams.getMarginEnd(), 0);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, R.layout.activity_admin_menu);
relativeLayoutButton.setLayoutParams(layoutParams);
RelativeLayout.LayoutParams layoutParamsBadge = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
layoutParamsBadge.setMargins(0, 0, 0, 0);
layoutParamsBadge.addRule(RelativeLayout.ALIGN_START, R.id.layoutLinearOrderCheckButton);
layoutParamsBadge.addRule(RelativeLayout.ALIGN_TOP, R.id.layoutLinearOrderCheckButton);
relativeLayoutBadge.setLayoutParams(layoutParamsBadge);
relativeLayoutBadge.setVisibility(View.VISIBLE);
TextView cartBadgeCount = findViewById(R.id.txtOrderButtonBadge);
cartBadgeCount.setText(String.valueOf(orderCount));
} else {
int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -50.0f, getResources().getDisplayMetrics());
layoutParams.setMargins(layoutParams.getMarginStart(), 0, layoutParams.getMarginEnd(), value);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, R.layout.activity_admin_menu);
relativeLayoutButton.setLayoutParams(layoutParams);
}
}
}
| [
"[email protected]"
] | |
14d997e7663b8435dadf5a414f14ae3a9f54ee31 | cf8ce47e5f608740169e671625034feffb9260e9 | /shopping-api/src/main/java/com/programyourhome/shop/model/PyhProductProperties.java | 14a521878c8e3d038f70a6353e52b3838902983c | [] | no_license | ewjmulder/program-your-home | a0c98980e7859c29bcb5014238a0542db783959b | ed3f6b64f12d3fd03e38e5dacbb3c049c9a2770a | refs/heads/master | 2020-12-20T12:33:18.718302 | 2017-12-19T11:04:40 | 2017-12-19T11:04:40 | 23,797,369 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.programyourhome.shop.model;
public interface PyhProductProperties {
public String getBarcode();
public String getName();
public String getDescription();
public PyhProductSizeProperties getSize();
}
| [
"[email protected]"
] | |
2ba8e719cf41723f80a6ee6e596169e31ad8be88 | cf5ff8e0bbd93e0d3110169bc7f89e2a2b2be60d | /yzim-easeui-SDK_3.1.3/src/com/yz/im/model/im/receiver/StartServiceReceiver.java | a50fb32f66b5f5dbea1ee86db97c4ef43e58112a | [
"Apache-2.0"
] | permissive | yaolu0311/ThinkcooRefactor-2016526 | 993c09b50719322d9d89621f2d991e4687ab81f8 | bfe011a0650ca0c80932dc45c2e60868966afda6 | refs/heads/master | 2020-09-26T05:30:24.155465 | 2016-09-05T07:12:13 | 2016-09-05T07:12:13 | 67,396,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | /************************************************************
* * Hyphenate CONFIDENTIAL
* __________________
* Copyright (C) 2016 Hyphenate Inc. All rights reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Hyphenate Inc..
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Hyphenate Inc.
*/
package com.yz.im.model.im.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.hyphenate.chat.EMChatService;
import com.hyphenate.util.EMLog;
public class StartServiceReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
EMLog.d("boot", "start IM service on boot");
Intent startServiceIntent=new Intent(context, EMChatService.class);
startServiceIntent.putExtra("reason", "boot");
context.startService(startServiceIntent);
}
}
| [
"[email protected]"
] | |
b0e89d12609dab32f8ae4d4d9009993131b9c340 | ad2bcc8ae995836f1d7219bf6f65bc874f8077c2 | /bubbletok_android/bubbletok/app/src/main/java/com/retrytech/vilo/utils/CustomDialogBuilder.java | 442d698edc300a3102bab3b9d90db6d3c70c4830 | [] | no_license | VinayakKelagar/bubbleinswara | f588b3d5d4e783900e950e666665cbbb62f68ffc | 3b7f06862ce6903634a6e8328fa779ca64e9d28e | refs/heads/master | 2022-12-01T13:39:04.420593 | 2020-08-16T11:29:38 | 2020-08-16T11:29:38 | 287,931,398 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,376 | java | package com.retrytech.vilo.utils;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import androidx.databinding.DataBindingUtil;
import com.retrytech.vilo.R;
import com.retrytech.vilo.databinding.DailogLoaderBinding;
import com.retrytech.vilo.databinding.LoutPopupBinding;
import com.retrytech.vilo.databinding.LoutSendBubbleBinding;
import com.retrytech.vilo.databinding.LoutSendResultPopupBinding;
public class CustomDialogBuilder {
private Context mContext;
private Dialog mBuilder = null;
public CustomDialogBuilder(Context context) {
this.mContext = context;
if (mContext != null) {
mBuilder = new Dialog(mContext);
mBuilder.requestWindowFeature(Window.FEATURE_NO_TITLE);
mBuilder.setCancelable(false);
mBuilder.setCanceledOnTouchOutside(false);
if (mBuilder.getWindow() != null) {
mBuilder.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
}
}
public void showSimpleDialog(String title, String message, String negativeText, String positiveText, OnDismissListener onDismissListener) {
if (mContext == null)
return;
mBuilder.setCancelable(true);
mBuilder.setCanceledOnTouchOutside(true);
LoutPopupBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.lout_popup, null, false);
mBuilder.setContentView(binding.getRoot());
Dialog1 dialog1 = new Dialog1();
dialog1.setTitle(title);
dialog1.setMessage(message);
dialog1.setPositiveText(positiveText);
dialog1.setNegativeText(negativeText);
binding.setModel(dialog1);
binding.tvPositive.setOnClickListener(v -> {
mBuilder.dismiss();
onDismissListener.onPositiveDismiss();
});
binding.tvCancel.setOnClickListener(v -> {
mBuilder.dismiss();
onDismissListener.onNegativeDismiss();
});
mBuilder.show();
}
public void showSendCoinDialogue(OnCoinDismissListener onCoinDismissListener) {
if (mContext == null)
return;
mBuilder.setCancelable(true);
mBuilder.setCanceledOnTouchOutside(true);
LoutSendBubbleBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.lout_send_bubble, null, false);
mBuilder.setContentView(binding.getRoot());
binding.tvCancel.setOnClickListener(view -> {
mBuilder.dismiss();
onCoinDismissListener.onCancelDismiss();
});
binding.lout5.setOnClickListener(view -> {
mBuilder.dismiss();
onCoinDismissListener.on5Dismiss();
});
binding.lout10.setOnClickListener(view -> {
mBuilder.dismiss();
onCoinDismissListener.on10Dismiss();
});
binding.lout20.setOnClickListener(view -> {
mBuilder.dismiss();
onCoinDismissListener.on20Dismiss();
});
mBuilder.show();
}
public void showSendCoinResultDialogue(boolean success, OnResultButtonClick onResultButtonClick) {
if (mContext == null)
return;
mBuilder.setCancelable(true);
mBuilder.setCanceledOnTouchOutside(true);
LoutSendResultPopupBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.lout_send_result_popup, null, false);
mBuilder.setContentView(binding.getRoot());
binding.setSuccess(success);
binding.loutButton.setOnClickListener(view -> {
mBuilder.dismiss();
onResultButtonClick.onButtonClick(success);
});
mBuilder.show();
}
public void showLoadingDialog() {
if (mContext == null)
return;
mBuilder.setCancelable(false);
mBuilder.setCanceledOnTouchOutside(false);
DailogLoaderBinding binding = DataBindingUtil.inflate(LayoutInflater.from(mContext), R.layout.dailog_loader, null, false);
Animation rotateAnimation = AnimationUtils.loadAnimation(mContext, R.anim.rotate);
Animation reverseAnimation = AnimationUtils.loadAnimation(mContext, R.anim.rotate_reverse);
binding.ivParent.startAnimation(rotateAnimation);
binding.ivChild.startAnimation(reverseAnimation);
mBuilder.setContentView(binding.getRoot());
mBuilder.show();
}
public void hideLoadingDialog() {
try {
mBuilder.dismiss();
} catch (Exception e) {
e.printStackTrace();
}
}
public interface OnResultButtonClick {
void onButtonClick(boolean success);
}
public interface OnDismissListener {
void onPositiveDismiss();
void onNegativeDismiss();
}
public interface OnCoinDismissListener {
void onCancelDismiss();
void on5Dismiss();
void on10Dismiss();
void on20Dismiss();
}
} | [
"[email protected]"
] | |
ee6c319ab3a6c5be550772b1bfe1c92d1f4d1720 | 5b665181dbb8b5c00c962199b8e93332f459f454 | /src/streamapi/StreamAPITest1.java | e43d24f6c89d836f484f6390d8ff27712189356b | [] | no_license | Dongdonghe1981/jdk_project | e3c2020db3bdf108bde0709deacc2d5e86e3e983 | 46c5653bc21833212671924a1940be0274e63517 | refs/heads/master | 2020-09-15T08:34:38.880023 | 2019-11-30T14:32:19 | 2019-11-30T14:32:19 | 223,396,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package streamapi;
import dto.Employee;
import dto.EmployeeData;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public class StreamAPITest1 {
@Test
public void test1(){
List<Employee> employees = EmployeeData.getEmployee();
employees.stream().filter(e -> e.getAge()>26).forEach(System.out::println);
System.out.println("===============");
employees.stream().limit(3).forEach(System.out::println);
System.out.println("===============");
employees.stream().skip(2).forEach(System.out::println);
System.out.println("===============");
employees.addAll(EmployeeData.getEmployee());
employees.stream().distinct().forEach(System.out::println);
System.out.println("===============");
}
@Test
public void test2(){
//ma(Function f)
List<String> list = Arrays.asList("aa","bb","cc","dd");
list.stream().map(s -> s.toUpperCase()).forEach(System.out::println);
List<Employee> emptiest = EmployeeData.getEmployee();
emptiest.stream().map(e -> e.getName().length() > 3).forEach(System.out::println);
emptiest.stream().filter(e -> e.getName().length() > 3).forEach(System.out::println);
//flatMap
list.stream().flatMap(StreamAPITest1::fromStringToStream).forEach(System.out::println);
}
public static Stream<Character> fromStringToStream(String str){
ArrayList<Character> list = new ArrayList();
for(Character c : str.toCharArray()){
list.add(c);
}
return list.stream();
}
@Test
public void test3(){
List<Integer> list = Arrays.asList(1,3,2,4,6,5);
list.stream().sorted().forEach(System.out::println);
List<Employee> emptiest = EmployeeData.getEmployee();
emptiest.stream().sorted((e1,e2) ->
{
int ageValue = Integer.compare(e1.getAge(),e2.getAge());
if (ageValue !=0 ){
return Double.compare(e1.getId(),e2.getId());
}else{
return ageValue;
}
}).forEach(System.out::println);
}
}
| [
"“[email protected]”"
] | |
c01253662c371c449d60bd2e234d132bf7db12ea | 35473a378566d6ab714290b8cdddc2bc6e73471f | /OOP/src/Logger/core/EngineImpl.java | e6d6b7340a8bbade18e3c0822aecdd6c583ed551 | [] | no_license | nilsys/Software-University | b132dd681335e534d0e7059975ece633c4432248 | fcf30bfb5ee25c1d1604895c665bea2637d61486 | refs/heads/master | 2022-11-29T01:52:23.153050 | 2020-08-08T08:58:04 | 2020-08-08T08:58:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package Logger.core;
import Logger.Interfaces.Engine;
public class EngineImpl implements Engine {
@Override
public void run() {
}
}
| [
"[email protected]"
] | |
788100ef0f57031958d7a1f6f7c08e78e14fd697 | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /java/Lightning/src/org/javenstudio/lightning/context/ConfigPluginInfo.java | 8032457ef4265df143978ad6872192e0dff8b37c | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 3,231 | java | package org.javenstudio.lightning.context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.javenstudio.falcon.ErrorException;
import org.javenstudio.falcon.util.ContextNode;
import org.javenstudio.falcon.util.NamedList;
import org.javenstudio.falcon.util.PluginInfo;
public class ConfigPluginInfo extends PluginInfo {
@SuppressWarnings("rawtypes")
public static final PluginInfo EMPTY_INFO = new ConfigPluginInfo("",
Collections.<String,String>emptyMap(),
new NamedList(), Collections.<PluginInfo>emptyList());
private static final Set<String> NL_TAGS = new HashSet<String>(
Arrays.asList("lst", "arr", "bool", "str", "int", "long", "float", "double"));
private final String mName, mClassName, mType;
private final NamedList<?> mInitArgs;
private final Map<String, String> mAttributes;
private final List<PluginInfo> mChildren;
public ConfigPluginInfo(String type, Map<String,String> attrs,
NamedList<?> initArgs, List<PluginInfo> children) {
mType = type;
mName = attrs.get("name");
mClassName = attrs.get("class");
mInitArgs = initArgs;
mAttributes = Collections.unmodifiableMap(attrs);
mChildren = (children == null) ? Collections.<PluginInfo>emptyList() :
Collections.unmodifiableList(children);
}
public ConfigPluginInfo(ContextNode node, String error,
boolean requireName, boolean requireClass) throws ErrorException {
mType = node.getNodeName();
mName = node.getAttribute("name", requireName ? error : null);
mClassName = node.getAttribute("class", requireClass ? error : null);
mInitArgs = node.getChildNodesAsNamedList();
mAttributes = Collections.unmodifiableMap(node.getAttributes());
mChildren = loadSubPlugins(node);
}
public final String getName() { return mName; }
public final String getClassName() { return mClassName; }
public final String getType() { return mType; }
public final NamedList<?> getInitArgs() { return mInitArgs; }
public final List<PluginInfo> getChildren() { return mChildren; }
@Override
public final String getAttribute(String name) {
return mAttributes.get(name);
}
private List<PluginInfo> loadSubPlugins(ContextNode node) throws ErrorException {
List<PluginInfo> children = new ArrayList<PluginInfo>();
//if there is another sub tag with a non namedlist tag that has to be another plugin
Iterator<ContextNode> nodes = node.getChildNodes();
while (nodes.hasNext()) {
ConfigNode nd = (ConfigNode)nodes.next();
if (!nd.isElementNode())
continue;
if (NL_TAGS.contains(nd.getNodeName()))
continue;
PluginInfo pluginInfo = new ConfigPluginInfo(nd, null, false, false);
if (pluginInfo.isEnabled())
children.add(pluginInfo);
}
return children.isEmpty() ? Collections.<PluginInfo>emptyList() :
Collections.unmodifiableList(children);
}
@Override
public boolean isEnabled() {
String enable = mAttributes.get("enable");
return enable == null || Boolean.parseBoolean(enable);
}
@Override
public boolean isDefault() {
return Boolean.parseBoolean(mAttributes.get("default"));
}
}
| [
"[email protected]"
] | |
a656e6eb382667928eec6db197f56357b1438da6 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-docdb/src/main/java/com/amazonaws/services/docdb/model/CopyDBClusterParameterGroupRequest.java | 824a27f50bef694738405e6bf2981f4446961426 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 21,834 | java | /*
* Copyright 2018-2023 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.docdb.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
* <p>
* Represents the input to <a>CopyDBClusterParameterGroup</a>.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/docdb-2014-10-31/CopyDBClusterParameterGroup" target="_top">AWS
* API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CopyDBClusterParameterGroupRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a valid
* parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid cluster
* parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
* </ul>
*/
private String sourceDBClusterParameterGroupIdentifier;
/**
* <p>
* The identifier for the copied cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
* </p>
*/
private String targetDBClusterParameterGroupIdentifier;
/**
* <p>
* A description for the copied cluster parameter group.
* </p>
*/
private String targetDBClusterParameterGroupDescription;
/**
* <p>
* The tags that are to be assigned to the parameter group.
* </p>
*/
private java.util.List<Tag> tags;
/**
* <p>
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a valid
* parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid cluster
* parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
* </ul>
*
* @param sourceDBClusterParameterGroupIdentifier
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a
* valid parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid
* cluster parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
*/
public void setSourceDBClusterParameterGroupIdentifier(String sourceDBClusterParameterGroupIdentifier) {
this.sourceDBClusterParameterGroupIdentifier = sourceDBClusterParameterGroupIdentifier;
}
/**
* <p>
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a valid
* parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid cluster
* parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
* </ul>
*
* @return The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a
* valid parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid
* cluster parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
*/
public String getSourceDBClusterParameterGroupIdentifier() {
return this.sourceDBClusterParameterGroupIdentifier;
}
/**
* <p>
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a valid
* parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid cluster
* parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
* </ul>
*
* @param sourceDBClusterParameterGroupIdentifier
* The identifier or Amazon Resource Name (ARN) for the source cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Must specify a valid cluster parameter group.
* </p>
* </li>
* <li>
* <p>
* If the source cluster parameter group is in the same Amazon Web Services Region as the copy, specify a
* valid parameter group identifier; for example, <code>my-db-cluster-param-group</code>, or a valid ARN.
* </p>
* </li>
* <li>
* <p>
* If the source parameter group is in a different Amazon Web Services Region than the copy, specify a valid
* cluster parameter group ARN; for example,
* <code>arn:aws:rds:us-east-1:123456789012:sample-cluster:sample-parameter-group</code>.
* </p>
* </li>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CopyDBClusterParameterGroupRequest withSourceDBClusterParameterGroupIdentifier(String sourceDBClusterParameterGroupIdentifier) {
setSourceDBClusterParameterGroupIdentifier(sourceDBClusterParameterGroupIdentifier);
return this;
}
/**
* <p>
* The identifier for the copied cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
* </p>
*
* @param targetDBClusterParameterGroupIdentifier
* The identifier for the copied cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
*/
public void setTargetDBClusterParameterGroupIdentifier(String targetDBClusterParameterGroupIdentifier) {
this.targetDBClusterParameterGroupIdentifier = targetDBClusterParameterGroupIdentifier;
}
/**
* <p>
* The identifier for the copied cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
* </p>
*
* @return The identifier for the copied cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
*/
public String getTargetDBClusterParameterGroupIdentifier() {
return this.targetDBClusterParameterGroupIdentifier;
}
/**
* <p>
* The identifier for the copied cluster parameter group.
* </p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
* </p>
*
* @param targetDBClusterParameterGroupIdentifier
* The identifier for the copied cluster parameter group.</p>
* <p>
* Constraints:
* </p>
* <ul>
* <li>
* <p>
* Cannot be null, empty, or blank.
* </p>
* </li>
* <li>
* <p>
* Must contain from 1 to 255 letters, numbers, or hyphens.
* </p>
* </li>
* <li>
* <p>
* The first character must be a letter.
* </p>
* </li>
* <li>
* <p>
* Cannot end with a hyphen or contain two consecutive hyphens.
* </p>
* </li>
* </ul>
* <p>
* Example: <code>my-cluster-param-group1</code>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CopyDBClusterParameterGroupRequest withTargetDBClusterParameterGroupIdentifier(String targetDBClusterParameterGroupIdentifier) {
setTargetDBClusterParameterGroupIdentifier(targetDBClusterParameterGroupIdentifier);
return this;
}
/**
* <p>
* A description for the copied cluster parameter group.
* </p>
*
* @param targetDBClusterParameterGroupDescription
* A description for the copied cluster parameter group.
*/
public void setTargetDBClusterParameterGroupDescription(String targetDBClusterParameterGroupDescription) {
this.targetDBClusterParameterGroupDescription = targetDBClusterParameterGroupDescription;
}
/**
* <p>
* A description for the copied cluster parameter group.
* </p>
*
* @return A description for the copied cluster parameter group.
*/
public String getTargetDBClusterParameterGroupDescription() {
return this.targetDBClusterParameterGroupDescription;
}
/**
* <p>
* A description for the copied cluster parameter group.
* </p>
*
* @param targetDBClusterParameterGroupDescription
* A description for the copied cluster parameter group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CopyDBClusterParameterGroupRequest withTargetDBClusterParameterGroupDescription(String targetDBClusterParameterGroupDescription) {
setTargetDBClusterParameterGroupDescription(targetDBClusterParameterGroupDescription);
return this;
}
/**
* <p>
* The tags that are to be assigned to the parameter group.
* </p>
*
* @return The tags that are to be assigned to the parameter group.
*/
public java.util.List<Tag> getTags() {
return tags;
}
/**
* <p>
* The tags that are to be assigned to the parameter group.
* </p>
*
* @param tags
* The tags that are to be assigned to the parameter group.
*/
public void setTags(java.util.Collection<Tag> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<Tag>(tags);
}
/**
* <p>
* The tags that are to be assigned to the parameter group.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
* existing values.
* </p>
*
* @param tags
* The tags that are to be assigned to the parameter group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CopyDBClusterParameterGroupRequest withTags(Tag... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList<Tag>(tags.length));
}
for (Tag ele : tags) {
this.tags.add(ele);
}
return this;
}
/**
* <p>
* The tags that are to be assigned to the parameter group.
* </p>
*
* @param tags
* The tags that are to be assigned to the parameter group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public CopyDBClusterParameterGroupRequest withTags(java.util.Collection<Tag> tags) {
setTags(tags);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getSourceDBClusterParameterGroupIdentifier() != null)
sb.append("SourceDBClusterParameterGroupIdentifier: ").append(getSourceDBClusterParameterGroupIdentifier()).append(",");
if (getTargetDBClusterParameterGroupIdentifier() != null)
sb.append("TargetDBClusterParameterGroupIdentifier: ").append(getTargetDBClusterParameterGroupIdentifier()).append(",");
if (getTargetDBClusterParameterGroupDescription() != null)
sb.append("TargetDBClusterParameterGroupDescription: ").append(getTargetDBClusterParameterGroupDescription()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof CopyDBClusterParameterGroupRequest == false)
return false;
CopyDBClusterParameterGroupRequest other = (CopyDBClusterParameterGroupRequest) obj;
if (other.getSourceDBClusterParameterGroupIdentifier() == null ^ this.getSourceDBClusterParameterGroupIdentifier() == null)
return false;
if (other.getSourceDBClusterParameterGroupIdentifier() != null
&& other.getSourceDBClusterParameterGroupIdentifier().equals(this.getSourceDBClusterParameterGroupIdentifier()) == false)
return false;
if (other.getTargetDBClusterParameterGroupIdentifier() == null ^ this.getTargetDBClusterParameterGroupIdentifier() == null)
return false;
if (other.getTargetDBClusterParameterGroupIdentifier() != null
&& other.getTargetDBClusterParameterGroupIdentifier().equals(this.getTargetDBClusterParameterGroupIdentifier()) == false)
return false;
if (other.getTargetDBClusterParameterGroupDescription() == null ^ this.getTargetDBClusterParameterGroupDescription() == null)
return false;
if (other.getTargetDBClusterParameterGroupDescription() != null
&& other.getTargetDBClusterParameterGroupDescription().equals(this.getTargetDBClusterParameterGroupDescription()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSourceDBClusterParameterGroupIdentifier() == null) ? 0 : getSourceDBClusterParameterGroupIdentifier().hashCode());
hashCode = prime * hashCode + ((getTargetDBClusterParameterGroupIdentifier() == null) ? 0 : getTargetDBClusterParameterGroupIdentifier().hashCode());
hashCode = prime * hashCode + ((getTargetDBClusterParameterGroupDescription() == null) ? 0 : getTargetDBClusterParameterGroupDescription().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public CopyDBClusterParameterGroupRequest clone() {
return (CopyDBClusterParameterGroupRequest) super.clone();
}
}
| [
""
] | |
1db710906bbfed36df9706b534a963b69577bb17 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /files/File_1016085.java | b886a0eece7010a31e296f8134d93b8eb54680d5 | [
"Apache-2.0"
] | permissive | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,991 | java | /*
* This file is part of WebLookAndFeel library.
*
* WebLookAndFeel library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebLookAndFeel library 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 WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>.
*/
package com.alee.managers.language.data;
import com.alee.utils.HtmlUtils;
import com.alee.utils.TextUtils;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import java.io.Serializable;
/**
* User: mgarin Date: 16.05.12 Time: 17:17
*/
@XStreamAlias ("text")
@XStreamConverter (TextConverter.class)
public final class Text implements Serializable, Cloneable
{
private String text;
private String state;
public Text ()
{
this ( "" );
}
public Text ( String text )
{
this ( text, null );
}
public Text ( String text, String state )
{
super ();
this.text = text;
this.state = state;
}
public String getText ()
{
return text;
}
public void setText ( String text )
{
this.text = text;
}
public String getState ()
{
return state;
}
public void setState ( String state )
{
this.state = state;
}
@Override
public Text clone ()
{
return new Text ( text, state );
}
public String toString ()
{
return TextUtils.shortenText ( HtmlUtils.getPlainText ( text ), 50, true );
}
}
| [
"[email protected]"
] | |
a0673fb05ae3d2d7a3ea4fe235d562084ad0b1df | 08a6239e875c207367d4149a6b9978768d03c40a | /src/main/java/com/demo/shipapp/models/Ship.java | 5f8632f028313c78607db1ec2a86fd45d3ed8955 | [] | no_license | flowtheci/shipappdemo | bfc3e5b6e7256080b1d2521b64e870b0e1010854 | 7320f5459500ac3f2d9788dcb7dfc3d3ff7f9fbf | refs/heads/master | 2023-05-19T15:22:11.343684 | 2021-06-11T19:24:55 | 2021-06-11T19:24:55 | 376,122,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package com.demo.shipapp.models;
import groovy.transform.EqualsAndHashCode;
import groovy.transform.ToString;
import javax.persistence.*;
@Entity
public class Ship {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private int grossTonnage;
private String shipType;
private String iceClass;
private String flagCountry;
public Ship() {}
public Ship(int grossTonnage, String shipType, String iceClass, String flagCountry){
this.grossTonnage = grossTonnage;
this.shipType = shipType;
this.iceClass = iceClass;
this.flagCountry = flagCountry;
}
public Long getId(){
return id;
}
public int getGrossTonnage() {
return grossTonnage;
}
public String getShipType() {
return shipType;
}
public String getIceClass() {
return iceClass;
}
public String getFlagCountry() {
return flagCountry;
}
public void setId(Long id) {
this.id = id;
}
public void setGrossTonnage(int grossTonnage) {
this.grossTonnage = grossTonnage;
}
public void setShipType(String shipType) {
this.shipType = shipType;
}
public void setIceClass(String iceClass) {
this.iceClass = iceClass;
}
public void setFlagCountry(String flagCountry) {
this.flagCountry = flagCountry;
}
} | [
"[email protected]"
] | |
36148b94fe0c1ae0043f32720aaa04962a111f44 | 000ad1311e24c4001ae2e9afa62787e354ba9172 | /src/net/fand/cheer/demo/ch06/MyExceptionTest.java | d4cbe50ae3a9420a45204d35fc60dbac5027e366 | [] | no_license | fsjw1234/boom | b80aba9725327f0b350d3f2f1d7716e2f2a4513e | 7d50d5b9403a101448f3deceb37ea83e4072305d | refs/heads/master | 2020-12-30T13:19:52.153909 | 2017-06-25T01:30:31 | 2017-06-25T01:30:31 | 91,343,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 575 | java | package net.fand.cheer.demo.ch06;
import java.util.Scanner;
public class MyExceptionTest{
public static void main(String[] args) throws MyException{
System.out.println("enter your age");
Scanner scan=null;
try{
scan=new Scanner(System.in);
while(scan.hasNextInt()){
int age=scan.nextInt();
if(age==-1){
break;
}
if(age<1||age>120){
throw new MyException();
}
}
}finally {
scan.close();
}
}
}
class MyException extends Exception{
public MyException(){
super("Age should be<=0 and <120");
}
}
| [
"[email protected]"
] | |
8cd9a7bc78fb835f5189afe5dd54199058afbf08 | 2cd23e4efba66172e78516cca8e52d6746e8c332 | /Seminar 7/src/ro/ase/cts/decorator/clase/OperatorBilet.java | d44fdb948a3873183297df767c950b3a14d17186 | [] | no_license | SagharPourFarhad/CTS | 5991bda57d9a24373edbfc0ee88a32aa98edd12b | f0a5c528665fbddc64a16d5716c659c419329c91 | refs/heads/master | 2023-05-09T12:37:07.979232 | 2021-05-10T22:28:05 | 2021-05-10T22:28:05 | 342,800,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | package ro.ase.cts.decorator.clase;
public interface OperatorBilet {
void rezervaBilet();
String getNumeEchipaGazda();
String getNumeEchipaOaspeti();
} | [
"[email protected]"
] | |
63da8dfd5f5cc25c4365cb3ea1049d733cba1cc8 | 6568a24a834ed1fd2ac2e590656653cf1612769b | /src/quan/Main/Main.java | 520703a41bc4022b7bc1ecf8230345392433a912 | [] | no_license | nguyenquan2707/EncodeAndDecodeUsingBase64 | 1e0fd45b287783d5a416e581293268da2dd5cae5 | 0cb39cd62094381c1dcdf5055e5b0120d0fe3460 | refs/heads/master | 2023-05-13T18:37:21.120934 | 2018-12-23T03:59:17 | 2018-12-23T03:59:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,375 | java | package quan.Main;
import java.util.Base64;
import java.util.UUID;
public class Main {
// refer https://gpcoder.com/4144-base64-encoding-va-decoding-trong-java-8/
// encode: Mã Hóa, decode: Giải mã
public static void main(String[] args) {
// Basic
//encode
String string = "Nguyen Viet Quan";
String encode = Base64.getEncoder().encodeToString(string.getBytes());
System.out.println(encode);
// decode
byte[] decode = Base64.getDecoder().decode(encode);
String string2 = new String(decode);
System.out.println(string2);
//Base 64URL
String URL = "https://faucet.rinkeby.io/";
String encodeToString = Base64.getUrlEncoder().encodeToString(URL.getBytes());
System.out.println(encodeToString);
byte[] decode2 = Base64.getUrlDecoder().decode(encodeToString);
String decodeURL = new String(decode2);
System.out.println(decodeURL);
//Base64 MIME
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < 10; i++) {
stringBuffer.append( UUID.randomUUID().toString());
}
String stringMIME = stringBuffer.toString();
String encodeToString2 = Base64.getMimeEncoder().encodeToString(stringMIME.getBytes());
System.out.println(encodeToString2);
//decode
byte[] decode3 = Base64.getMimeDecoder().decode(encodeToString2.getBytes());
System.out.println(new String(decode3));
}
}
| [
"[email protected]"
] | |
ed6689ad8fe694aa613723af07cde68175499971 | fc1130124c3d8c5277d3dbb26e899ebf20c90ce8 | /app/src/main/java/com/example/login/Lista/Clientes/ClienteAdapter.java | 396622cdfe3075547d94a41128db1651cb01d1af | [] | no_license | TiagoPereiraIfsul/TCC | 8a022e2557a2d8c637070856a434cb8d8c28e9fb | 974621639672dcf3ee69c13a0290eebaa904e70a | refs/heads/master | 2020-08-06T03:51:26.349046 | 2019-12-06T14:35:41 | 2019-12-06T14:35:41 | 212,823,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,314 | java | package com.example.login.Lista.Clientes;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.login.Modelo.ModeloCliente;
import com.example.login.R;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.database.FirebaseDatabase;
import com.squareup.picasso.Picasso;
import java.util.Date;
import java.util.List;
public class ClienteAdapter extends RecyclerView.Adapter<ClienteAdapter.ModeloClientesViewHolder>{
private final List<ModeloCliente> clientes;
private final Context context;
private final ClienteAdapter.ModeloClienteOnClickListener onClickListener;
public interface ModeloClienteOnClickListener {
void onClickModeloCliente(ModeloClientesViewHolder holder, int idx);
}
public ClienteAdapter(Context context, List<ModeloCliente> clientes, ModeloClienteOnClickListener onClickListener) {
this.context = context;
this.clientes = clientes;
this.onClickListener = onClickListener;
}
@Override
public ModeloClientesViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
// Este método cria uma subclasse de RecyclerView.ViewHolder
// Infla a view do layout
View view = LayoutInflater.from(context).inflate(R.layout.adapter_do_recycler_cliente, viewGroup, false);
// Cria a classe do ViewHolder
ModeloClientesViewHolder holder = new ModeloClientesViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(final ModeloClientesViewHolder holder, final int position) {
// Este método recebe o índice do elemento, e atualiza as views que estão dentro do ViewHolder
ModeloCliente c = clientes.get(position);
// Atualizada os valores nas views
holder.tNome.setText(c.getNome());
holder.tCabelo.setText(c.getCabelo());
holder.tBarba.setText(c.getBarba());
holder.tSobrancelha.setText(c.getSobrancelha());
holder.tHorario.setText(c.getHorario());
holder.tValor.setText(c.getValorTotal());
holder.tData.setText(c.getData());
//holder.tData.;
if(c.getFoto() != null)
{
Picasso.with(this.context).load(c.getFoto()).into(holder.img);
//Bitmap bitmap = BitmapFactory.decodeByteArray(c.getFoto(), 0, c.getFoto().length());
//holder.img.setImageBitmap(bitmap);
} else {
holder.img.setImageResource(R.mipmap.ic_launcher);
}
// holder.img.setImageResource(c.foto); // Click
if (onClickListener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Chama o listener para informar que clicou no Cachorro
onClickListener.onClickModeloCliente(holder, position);
}
});
}
holder.deletar.setOnClickListener(v -> {
// Chama o listener para informar que clicou no Cachorro
//onClickListener.onClickModeloEstilo(holder, position);
System.out.println("cloicou na merdada lixeira");
FirebaseDatabase.getInstance().getReference("HorariosMarcados").child(c.getId()).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(context, "Apagou", Toast.LENGTH_SHORT).show();
}
});
});
}
@Override
public int getItemCount() {
return this.clientes != null ? this.clientes.size() : 0;
}
// Subclasse de RecyclerView.ViewHolder. Contém todas as views.
public static class ModeloClientesViewHolder extends RecyclerView.ViewHolder {
public TextView tNome;
public TextView tCabelo;
public TextView tSobrancelha;
public TextView tBarba;
public TextView tHorario;
public TextView tValor;
public TextView tData;
public ImageView img;
public ImageView deletar;
private View view;
public ModeloClientesViewHolder(View view) {
super(view);
this.view = view;
// Cria as views para salvar no ViewHolder
img = (ImageView) view.findViewById(R.id.img);
tNome = (TextView) view.findViewById(R.id.tNome);
tCabelo = (TextView) view.findViewById(R.id.tCabelo);
tSobrancelha = (TextView) view.findViewById(R.id.tSobrancelha);
tBarba = (TextView) view.findViewById(R.id.tBarba);
tHorario = (TextView) view.findViewById(R.id.tHorario);
tValor = (TextView) view.findViewById(R.id.tValor);
tData = (TextView) view.findViewById(R.id.tData);
deletar = (ImageView) view.findViewById(R.id.deletarrr);
//img = (ImageView) view.findViewById(R.id.img);
}
}
}
| [
"[email protected]"
] | |
a1e1891d8fcb5f0bc513e11cb8099307a85b9bc5 | 117466d8121a7fdcf61ce3d7a5be91f817e3a5ce | /src/com/zanimaux/gui/ProduitController.java | 9f758dd6b21ea145bfedd7e66b24529bfcbcd60d | [] | no_license | emnou9/PiJavaZanimaux | cd661ad827c378a6b020de43a82bb324b202909b | dd1c517760c12ce3a13751ed7777af6b07907a12 | refs/heads/master | 2021-04-27T11:16:14.523692 | 2018-03-02T07:24:26 | 2018-03-02T07:24:26 | 122,557,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.zanimaux.gui;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXDrawer;
import com.jfoenix.controls.JFXHamburger;
import com.jfoenix.controls.JFXListView;
import com.jfoenix.controls.JFXTextField;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
/**
* FXML Controller class
*
* @author Emna
*/
public class ProduitController implements Initializable {
@FXML
private JFXListView<?> listproduit;
@FXML
private JFXTextField nomprod;
@FXML
private ImageView ivModif;
@FXML
private JFXButton btnModifier;
@FXML
private JFXButton btnImagemodifier;
@FXML
private Label ab;
@FXML
private Label ab1;
@FXML
private Label ab2;
@FXML
private Label ab3;
@FXML
private Label ab4;
@FXML
private JFXTextField prixprod;
@FXML
private JFXTextField quantiteprod;
@FXML
private ChoiceBox<?> tchoice;
@FXML
private JFXHamburger Hamburger;
@FXML
private JFXDrawer drawer;
@FXML
private JFXTextField lasto;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
@FXML
private void remplirInputs(MouseEvent event) {
}
@FXML
private void modifierBug(ActionEvent event) {
}
@FXML
private void uploadModifier(MouseEvent event) {
}
}
| [
"[email protected]"
] | |
c0f8c04d64893e9391df3e4c601bb2557d821027 | e27ca5fe3e7f49a0e39a9cacec516e5b63fcae32 | /src/com/clouds/www/QuickSort.java | 1c8030a489cf23ae6c46c38684a761866b33c639 | [] | no_license | yao23/Java_Playground | 0cb49c98df5c3c149bdc174a2e27aac11b914d58 | aa7496b9e55e30952075b47d82be01190166c0ad | refs/heads/master | 2023-09-03T05:21:11.864445 | 2023-09-02T05:46:29 | 2023-09-02T05:46:29 | 92,258,959 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.clouds.www;
/**
* Stability: No relative partition position guaranteed
* stability: No
*/
public class QuickSort { // time: average O(nlogn), worst O(n^2), space: O(1)
private void doQuickSort(int[] arr, int start, int end) {
if (start >= end) {
return;
}
int partitionPos = partition(arr, start, end);
doQuickSort(arr, start, partitionPos);
doQuickSort(arr, partitionPos + 1, end);
}
private int partition(int[] arr, int left, int right) {
int ran = left + (int)(Math.random() * (right - left + 1));
int pivot = arr[ran];
// switch pivot to the leftmost
arr[ran] = arr[left];
arr[left] = pivot;
while (left < right) {
// find a smaller element from right
while (left < right && arr[right] >= pivot) {
right--;
}
// put to the left
arr[left] = arr[right];
// find a larger element from left
while (left < right && arr[left] <= pivot) {
left++;
}
// put to the right
arr[right] = arr[left];
}
// put the pivot back
arr[left] = pivot;
return left;
}
}
| [
"[email protected]"
] | |
d687598d40a922f91944cf13d7150e1848f262b2 | 311918587dec5cce54cd436aa437222481c93073 | /coding_tx/src/main/java/com/temp/common/complier/test/demo1/compiler.java | 186b7566bf21ffb65354fd13ac567f85370c28c4 | [] | no_license | liwen666/component | 7f7ad2290e77632490012306cc835d43c71c8ca6 | 2b1839954bb58eb0adad9e32090d9b971c1577b9 | refs/heads/master | 2022-12-21T11:14:17.461104 | 2021-04-25T08:49:41 | 2021-04-25T08:49:41 | 163,070,384 | 0 | 1 | null | 2022-12-10T06:15:07 | 2018-12-25T09:55:09 | Java | UTF-8 | Java | false | false | 2,493 | java | package com.temp.common.complier.test.demo1;
import com.temp.common.complier.tools.JavaStringCompiler;
import com.temp.common.utils.PackageScanUtils;
import lombok.Cleanup;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.temp.common.complier.tools.JavaStringCompiler;
import com.temp.common.utils.PackageScanUtils;
import lombok.Cleanup;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.google.common.collect.Lists;
import com.temp.common.base.io.pagescan.PageScanUtil;
import com.temp.common.complier.tools.JavaStringCompiler;
import com.temp.common.utils.PackageScanUtils;
import lombok.Cleanup;
import org.springframework.core.io.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.Map;
/**
* <p>
* 描述
* </p>
*
* @author LW
* @since 2021/3/11 13:58
*/
public class compiler {
public static void main(String[] args) throws IOException {
String flinkJob = "hello";
ArrayList<File> objects = Lists.newArrayList();
PackageScanUtils.findResourceByPath("D:\\workspace\\test_workspace\\coding_tx\\src\\main\\java\\com\\temp\\common\\complier\\test\\demo1", objects);
String outPath = "D:\\workspace\\test_workspace\\coding_tx\\src\\main\\java\\com\\temp\\common\\complier\\test\\out\\";
objects.forEach(e -> {
System.out.println(e.getName());
System.out.println(e.getPath());
try {
@Cleanup FileInputStream fileInputStream = new FileInputStream(e);
byte[] cache = new byte[fileInputStream.available()];
fileInputStream.read(cache);
String java = new String(cache, "utf-8");
System.out.println(java);
Map<String, byte[]> results = new JavaStringCompiler().compile(e.getName(), java,"");
System.out.println(results.size());
File outFile = new File(outPath + e.getName().split("\\.")[0] + ".class");
FileOutputStream outputStream = new FileOutputStream(outFile);
outputStream.write(results.entrySet().iterator().next().getValue());
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
});
}
}
| [
"[email protected]"
] | |
bb045318e9babb4c2e1847cda349f5b4c66c935e | 2c86de84391b65a4ad3dc18ba0764d73bd89df81 | /src/main/java/com/springmvc/models/OperationLog.java | dfc0c717e5da60e4ed9c0536752deb1d90e8ca77 | [] | no_license | tsball/springmvc-hibernate | 4babb557443dcb5e2b6e87a6fa61f27b30bef9a6 | 42b17d71e7d83872c5198422be8c2a921a52d182 | refs/heads/master | 2020-09-19T23:17:50.683247 | 2018-06-08T07:07:30 | 2018-06-08T07:07:30 | 67,872,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | package com.springmvc.models;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "operation_logs")
public class OperationLog {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private OperationLogRiskLevel riskLevel;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private OperationLogEvent event;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private OperationLogCategory category;
@Column(nullable = false)
private String message;
@ManyToOne
@JoinColumn(name="user_id")
private User user;
@Column(nullable = false)
private Timestamp createdAt;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public OperationLogRiskLevel getRiskLevel() {
return riskLevel;
}
public void setRiskLevel(OperationLogRiskLevel riskLevel) {
this.riskLevel = riskLevel;
}
public OperationLogEvent getEvent() {
return event;
}
public void setEvent(OperationLogEvent event) {
this.event = event;
}
public OperationLogCategory getCategory() {
return category;
}
public void setCategory(OperationLogCategory category) {
this.category = category;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Timestamp getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Timestamp createdAt) {
this.createdAt = createdAt;
}
}
| [
"[email protected]"
] | |
9397defac63ca86988d474d720e1ed4696d323cb | ba6a8f0a9a2c2a524061ab353ab7a6626e1ecb1b | /src/main/java/com/learning/recipebook/controllers/ControllerExceptionHandler.java | 1c75385d7bceac3aa89dcb3e753dc78f651ee7ef | [] | no_license | mehj123/Spring-recipe-book | c661e8156eab4f798d7f28ee4e1dcc2fd9a62256 | 7e84ce17769d9058566d2e90272a18ce0beee64b | refs/heads/master | 2020-05-29T13:20:02.909903 | 2019-08-04T08:39:54 | 2019-08-04T08:39:54 | 189,157,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.learning.recipebook.controllers;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;
@Slf4j
@ControllerAdvice
public class ControllerExceptionHandler {
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(NumberFormatException.class)
public ModelAndView handleBadRequest(Exception e){
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("400error");
modelAndView.addObject("exception", e);
return modelAndView;
}
}
| [
"[email protected]"
] | |
a3e9a1b80e4e20aea248b19c21a59926748e88ed | f7893ba1f93dca28afd1759c3f1a2c40eede6763 | /backend/build/generated-source/endpoints/java/com/example/abhilash/myapplication/backend/myApi/MyApiRequest.java | 892f2a7be2edca3caf58a65a9a0bd4abf594b571 | [] | no_license | das-abhilash/JokeTellingApp | 8592726194e691286b8b0bf197d7a1513717255e | 19b8e97f391578d67270aec1d15a6c9f8ee7b961 | refs/heads/master | 2021-01-01T03:44:17.737636 | 2016-04-28T02:31:46 | 2016-04-28T02:31:46 | 57,190,070 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,429 | java | /*
* 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.
*/
/*
* This code was generated by https://github.com/google/apis-client-generator/
* (build: 2016-04-08 17:16:44 UTC)
* on 2016-04-27 at 05:42:02 UTC
* Modify at your own risk.
*/
package com.example.abhilash.myapplication.backend.myApi;
/**
* MyApi request.
*
* @since 1.3
*/
@SuppressWarnings("javadoc")
public abstract class MyApiRequest<T> extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest<T> {
/**
* @param client Google client
* @param method HTTP Method
* @param uriTemplate URI template for the path relative to the base URL. If it starts with a "/"
* the base path from the base URL will be stripped out. The URI template can also be a
* full URL. URI template expansion is done using
* {@link com.google.api.client.http.UriTemplate#expand(String, String, Object, boolean)}
* @param content A POJO that can be serialized into JSON or {@code null} for none
* @param responseClass response class to parse into
*/
public MyApiRequest(
MyApi client, String method, String uriTemplate, Object content, Class<T> responseClass) {
super(
client,
method,
uriTemplate,
content,
responseClass);
}
/** Data format for the response. */
@com.google.api.client.util.Key
private java.lang.String alt;
/**
* Data format for the response. [default: json]
*/
public java.lang.String getAlt() {
return alt;
}
/** Data format for the response. */
public MyApiRequest<T> setAlt(java.lang.String alt) {
this.alt = alt;
return this;
}
/** Selector specifying which fields to include in a partial response. */
@com.google.api.client.util.Key
private java.lang.String fields;
/**
* Selector specifying which fields to include in a partial response.
*/
public java.lang.String getFields() {
return fields;
}
/** Selector specifying which fields to include in a partial response. */
public MyApiRequest<T> setFields(java.lang.String fields) {
this.fields = fields;
return this;
}
/**
* API key. Your API key identifies your project and provides you with API access, quota, and
* reports. Required unless you provide an OAuth 2.0 token.
*/
@com.google.api.client.util.Key
private java.lang.String key;
/**
* API key. Your API key identifies your project and provides you with API access, quota, and
* reports. Required unless you provide an OAuth 2.0 token.
*/
public java.lang.String getKey() {
return key;
}
/**
* API key. Your API key identifies your project and provides you with API access, quota, and
* reports. Required unless you provide an OAuth 2.0 token.
*/
public MyApiRequest<T> setKey(java.lang.String key) {
this.key = key;
return this;
}
/** OAuth 2.0 token for the current user. */
@com.google.api.client.util.Key("oauth_token")
private java.lang.String oauthToken;
/**
* OAuth 2.0 token for the current user.
*/
public java.lang.String getOauthToken() {
return oauthToken;
}
/** OAuth 2.0 token for the current user. */
public MyApiRequest<T> setOauthToken(java.lang.String oauthToken) {
this.oauthToken = oauthToken;
return this;
}
/** Returns response with indentations and line breaks. */
@com.google.api.client.util.Key
private java.lang.Boolean prettyPrint;
/**
* Returns response with indentations and line breaks. [default: true]
*/
public java.lang.Boolean getPrettyPrint() {
return prettyPrint;
}
/** Returns response with indentations and line breaks. */
public MyApiRequest<T> setPrettyPrint(java.lang.Boolean prettyPrint) {
this.prettyPrint = prettyPrint;
return this;
}
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string
* assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
*/
@com.google.api.client.util.Key
private java.lang.String quotaUser;
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string
* assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
*/
public java.lang.String getQuotaUser() {
return quotaUser;
}
/**
* Available to use for quota purposes for server-side applications. Can be any arbitrary string
* assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
*/
public MyApiRequest<T> setQuotaUser(java.lang.String quotaUser) {
this.quotaUser = quotaUser;
return this;
}
/**
* IP address of the site where the request originates. Use this if you want to enforce per-user
* limits.
*/
@com.google.api.client.util.Key
private java.lang.String userIp;
/**
* IP address of the site where the request originates. Use this if you want to enforce per-user
* limits.
*/
public java.lang.String getUserIp() {
return userIp;
}
/**
* IP address of the site where the request originates. Use this if you want to enforce per-user
* limits.
*/
public MyApiRequest<T> setUserIp(java.lang.String userIp) {
this.userIp = userIp;
return this;
}
@Override
public final MyApi getAbstractGoogleClient() {
return (MyApi) super.getAbstractGoogleClient();
}
@Override
public MyApiRequest<T> setDisableGZipContent(boolean disableGZipContent) {
return (MyApiRequest<T>) super.setDisableGZipContent(disableGZipContent);
}
@Override
public MyApiRequest<T> setRequestHeaders(com.google.api.client.http.HttpHeaders headers) {
return (MyApiRequest<T>) super.setRequestHeaders(headers);
}
@Override
public MyApiRequest<T> set(String parameterName, Object value) {
return (MyApiRequest<T>) super.set(parameterName, value);
}
}
| [
"[email protected]"
] | |
e4ef51b85fce733048194555e2563ac307a1bae3 | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Hadoop/2884_1.java | 781571358946d9f49c7583f9c8f67264e609ea45 | [
"MIT"
] | permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | //,temp,TestFileBasedCopyListing.java,429,452,temp,TestIntegration.java,343,361
//,3
public class xxx {
@Test
public void testGlobTargetDirMultiLevel() {
try {
Path listFile = new Path("/tmp1/listing");
Path target = new Path("/tmp/target");
addEntries(listFile, "/tmp/*/*");
createFiles("/tmp/multifile/file3", "/tmp/multifile/file4", "/tmp/multifile/file5");
createFiles("/tmp/singledir1/dir3/file7", "/tmp/singledir1/dir3/file8",
"/tmp/singledir1/dir3/file9");
mkdirs(target.toString());
runTest(listFile, target, true);
checkResult(listFile, 6);
} catch (IOException e) {
LOG.error("Exception encountered while testing build listing", e);
Assert.fail("build listing failure");
} finally {
TestDistCpUtils.delete(fs, "/tmp");
TestDistCpUtils.delete(fs, "/tmp1");
}
}
}; | [
"[email protected]"
] | |
24dac2de7c50ba3563d7083ed565c17188b1117e | 9839e5d8aee9d014ab7aada4a203379b947dd43f | /java/day0513/0000src/day0513/FileReaderEx1.java | 1add6c32df4bc2c513f66bebfc1b8a670c524338 | [] | no_license | Yooogh/Gongboo | a2acc589e90730d21dff9b60a8ef19dc7f9e3962 | 6838ec20fea81b0502c1642dee64607ff325011f | refs/heads/main | 2023-08-04T04:25:32.140295 | 2021-09-10T01:00:06 | 2021-09-10T01:00:06 | 378,591,441 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 593 | java | package day0513;
import java.io.*;
public class FileReaderEx1 {
public static void main(String[] args) {
try {
String fileName = "test.txt";
FileInputStream fis = new FileInputStream(fileName);
FileReader fr = new FileReader(fileName);
int data = 0;
while((data=fis.read())!=-1) {
System.out.print((char)data);//형변환 한 경우
}
System.out.println();
fis.close();
while((data=fr.read())!=-1) {
System.out.print(data);//형변환 안한 경우
}
System.out.println();
fr.close();
}catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
137f9cdc43bd5b56a54b64db5782dde5148a9b12 | 70ab4ad77435fbd0c893a4487c21b2bd232b8b1d | /components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/device/dao/DeviceFlowDAO.java | 24a0b44d2a2b8ad7efd5b10a82918ff77ced1ae7 | [
"Apache-2.0"
] | permissive | janakamarasena/identity-inbound-auth-oauth-clone | 47d5dd05f10b66fc72ce8e0e14fcec7cb7607ad2 | cb6115d55c7256811934715c0f2d200e4cff2fb0 | refs/heads/master | 2022-12-20T02:48:35.448565 | 2020-10-24T18:49:48 | 2020-10-24T18:49:48 | 306,883,487 | 0 | 1 | Apache-2.0 | 2020-10-24T19:33:54 | 2020-10-24T12:55:32 | Java | UTF-8 | Java | false | false | 5,789 | java | /*
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.identity.oauth2.device.dao;
import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.device.model.DeviceFlowDO;
import java.sql.Timestamp;
/**
* New set of DAO classes for each purpose and factory class to get instance of each DAO classes were introduced
* during this step.
*/
public interface DeviceFlowDAO {
/**
* This will be used to enter the value to the database tables.
*
* @param deviceCode Code that is used to identify the device.
* @param userCode Code that is used to correlate user and device.
* @param consumerKey Consumer key of the client application.
* @param expiresIn Device code valid period.
* @param interval Polling interval.
* @param scopes Requested scopes.
* @throws IdentityOAuth2Exception Error while inserting device flow parameters.
*/
void insertDeviceFlowParameters(String deviceCode, String userCode, String consumerKey, Long expiresIn,
int interval, String scopes) throws IdentityOAuth2Exception;
/**
* Get the client id that has involved with user code.
*
* @param userCode Code that is used to correlate user and device.
* @return client_id
* @throws IdentityOAuth2Exception Error while getting client id for user code.
*/
String getClientIdByUserCode(String userCode) throws IdentityOAuth2Exception;
/**
* Set the status of the user code and device code.
*
* @param userCode Code that is used to correlate user and device.
* @param status Status of the device and user codes.
* @throws IdentityOAuth2Exception Error while setting authentication status.
*/
void setAuthenticationStatus(String userCode, String status) throws IdentityOAuth2Exception;
/**
* Get the authentication status for device code.
*
* @param deviceCode Code that is used to identify the device.
* @return Map of values.
* @throws IdentityOAuth2Exception Error while getting authentication details.
*/
DeviceFlowDO getAuthenticationDetails(String deviceCode) throws IdentityOAuth2Exception;
/**
* Check client id is exist or not.
*
* @param clientId Consumer key of the application.
* @return Exist or not.
* @throws IdentityOAuth2Exception Error while checking client id exist.
*/
boolean checkClientIdExist(String clientId) throws IdentityOAuth2Exception;
/**
* Get the status of the user code.
*
* @param userCode Code that is used to correlate user and device.
* @return status
* @throws IdentityOAuth2Exception Error while getting status for user code.
*/
String getStatusForUserCode(String userCode) throws IdentityOAuth2Exception;
/**
* Set last poll time of the token request.
*
* @param deviceCode Code that is used to identify the device.
* @param newPollTime Last poll time.
* @throws IdentityOAuth2Exception Error while setting last poll time.
*/
void setLastPollTime(String deviceCode, Timestamp newPollTime) throws IdentityOAuth2Exception;
/**
* Set authenticated user.
*
* @param userCode Code that is used to correlate user and device.
* @param status Status of the device code.
* @param authzUser Authenticated user.
* @throws IdentityOAuth2Exception Error while setting authenticated user and status.
*/
void setAuthzUserAndStatus(String userCode, String status, AuthenticatedUser authzUser)
throws IdentityOAuth2Exception;
/**
* Set device code as expired.
*
* @param deviceCode Code that is used to identify the device.
* @param status Status of the device code.
* @throws IdentityOAuth2Exception Error while setting device code as expired.
*/
void setDeviceCodeExpired(String deviceCode, String status) throws IdentityOAuth2Exception;
/**
* Set callback uri of the service provider.
*
* @param clientId Consumer key of service provide.
* @param callBackUri Callback uri of the service provider.
* @throws IdentityOAuth2Exception Error while Setting callback uri.
*/
void setCallbackURI(String clientId, String callBackUri) throws IdentityOAuth2Exception;
/**
* Return scope array for user code.
*
* @param userCode Code that is used to correlate user and device.
* @return Array of scopes.
* @throws IdentityOAuth2Exception Error while getting scopes for user code.
*/
String[] getScopesForUserCode(String userCode) throws IdentityOAuth2Exception;
/**
* Return scope array for device code.
*
* @param deviceCode Code that is used to identify the device.
* @return Array of scopes.
* @throws IdentityOAuth2Exception Error while getting scopes for device code.
*/
String[] getScopesForDeviceCode(String deviceCode) throws IdentityOAuth2Exception;
}
| [
"[email protected]"
] | |
315d6aedfd69a40d5b79e53b48abc1f0f50cb90f | 9c9067d9bfa19f052a433ec4111c97b686a6ac5e | /ch12/spring-java-config/src/main/java/jun/projavawebapp/config/RootContextConfiguration.java | a68390fe6c3a7f8b5212d9412b876bc70b7d229f | [
"MIT"
] | permissive | jdcsma/projavawebapp | c289123b59db4901a6d1760a9641c3117a357e73 | 50c596fb91fdc9e4c8b97b76557929fea2041bb6 | refs/heads/master | 2022-12-22T01:59:01.812147 | 2020-05-27T17:21:11 | 2020-05-27T17:21:11 | 185,805,881 | 0 | 0 | MIT | 2022-12-16T15:27:38 | 2019-05-09T13:36:51 | Java | UTF-8 | Java | false | false | 419 | java | package jun.projavawebapp.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
@Configuration
@ComponentScan(basePackages = {"jun.projavawebapp.site", "jun.projavawebapp.awarer"},
excludeFilters = {@ComponentScan.Filter(Controller.class)})
public class RootContextConfiguration {
}
| [
"[email protected]"
] | |
31c0c99c0e54b672ff842de19df37305edd8590f | afba8ff8767f5bd24b9faaf233f2c0ff4d984705 | /src/main/java/DataBase.java | c73884478da440fd812128151fb1bb531bd9a526 | [] | no_license | Baklysha9/WebJavaPractic | db1c199a98e5fa1f1de514c62cf54d61ab25253b | c7020f2de14db107afa0ac19726253f853c49fd5 | refs/heads/master | 2020-03-16T01:55:15.394154 | 2018-05-08T05:59:28 | 2018-05-08T05:59:28 | 132,452,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,272 | java | import org.sql2o.Connection;
import org.sql2o.Sql2o;
import java.util.List;
public class DataBase {
public void createTable() {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
String sql = "CREATE TABLE IF NOT EXISTS task (id int, title varchar(255), content varchar(255), status boolean)";
try (Connection con = sql2o.open()) {
con.createQuery(sql).executeUpdate();
}
}
public List<Task> getAllTasks() {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
String sql =
"SELECT * FROM task";
try (Connection con = sql2o.beginTransaction()) {
return con.createQuery(sql).executeAndFetch(Task.class);
}
}
public List<Task> fetchCustomers(int id) {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
try (Connection con = sql2o.beginTransaction()) {
final String query =
"SELECT id, title, content, status FROM task WHERE id = :id";
return con.createQuery(query)
.addParameter("id",id)
.executeAndFetch(Task.class);
}
}
public void addTask(Task task) {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
final String insertQuery =
"INSERT INTO task (id, title, content, status) " +
"VALUES (:id, :title, :content, :status)";
try (Connection con = sql2o.open()) {
con.createQuery(insertQuery)
.addParameter("id", task.getId())
.addParameter("title", task.getTitle())
.addParameter("content", task.getContent())
.addParameter("status", task.isStatus())
.executeUpdate();
// Remember to call commit() when a transaction is opened,
// default is to roll back.
}
}
public void editTask(Task task) {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
final String insertQuery =
"UPDATE task SET title = :title, content = :content, status = :status WHERE id = :id";
try (Connection con = sql2o.beginTransaction()) {
con.createQuery(insertQuery)
.addParameter("id", task.getId())
.addParameter("title", task.getTitle())
.addParameter("content", task.getContent())
.addParameter("status", task.isStatus())
.executeUpdate();
con.commit();
// Remember to call commit() when a transaction is opened,
// default is to roll back.
}
}
public void delete(int id) {
Sql2o sql2o = new Sql2o("jdbc:postgresql://192.168.99.100:5432/vote", "admin", "admin");
try(Connection con = sql2o.open()) {
String sql = "DELETE FROM task WHERE id = :id;";
con.createQuery(sql)
.addParameter("id", id)
.executeUpdate();
}
}
}
| [
"[email protected]"
] | |
e83bbe2dec8f2a608373522b2a65dbe1d099faec | a546db78e9806979e459831fb16c6e51878eb60b | /src/main/model/data/Value.java | 0affc32c898c337fdf427e5f8aa62dcb7f3c49e5 | [] | no_license | Bryce-MW/WikidataExplorer | 92fd35b8e9364d9bd7e005a39d321bc788ea049f | 9ad2dac3c82077466dcb36f25128611881f8965b | refs/heads/master | 2023-06-22T20:58:25.975518 | 2021-07-25T22:33:33 | 2021-07-25T22:33:33 | 287,648,884 | 5 | 1 | null | 2020-08-16T06:03:52 | 2020-08-15T00:23:27 | Java | UTF-8 | Java | false | false | 10,501 | java | package model.data;
import model.data.additional.*;
import model.data.additional.helpers.*;
import model.data.pages.Item;
import model.data.pages.Property;
import model.data.pages.language.Form;
import model.data.pages.language.Lexeme;
import model.data.pages.language.Sense;
import model.data.source.template.DataValue;
import ui.GUInterface;
import ui.cli.ItemView;
import ui.cli.StatementList;
import javax.swing.*;
import java.awt.*;
import java.util.List;
import java.util.Map;
public abstract class Value extends JPanel {
/*
* Class Description:
* This is the abstract class for any "Value". Originally, this was basically just going to be any Wikidata
* datatype, but my poor planning meant that it ended up also including things that should really be left to
* rendering or a different type of class entirely. It works well enough. This class also handles converting from
* a "snak" to an actual Value which is a reasonable static function for this class to have. This class also
* does its own rendering for the GUI but it does it in a very weird way since it's not actually as a panel but
* as an item in a statement list. This makes it very confusing to debug and use. I would definitely write this
* class very differently if I was doing this again.
*/
protected DatumQueryService queryService;
protected ItemView view = null;
protected final String id;
protected boolean initialized;
protected JButton button;
/*
* REQUIRES: queryService is not null, id is a valid Wikidata ID
* MODIFIES: this
* EFFECTS : sets up fields which are common to all Values
*/
protected Value(DatumQueryService queryService, String id) {
this.id = id;
this.queryService = queryService;
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
setAlignmentX(Component.LEFT_ALIGNMENT);
setBackground(GUInterface.midGray);
}
/*
* REQUIRES: dataType is a valid Wikidata datatype which has LiteralString as its backing, queryService is not
* null, stringValue is not null
* MODIFIES: none
* EFFECTS : interprets a literal string and returns the specific type of value which it corresponds to
*/
private static LiteralString getLiteralString(String dataType, DatumQueryService queryService, String stringValue) {
switch (dataType) {
case "commonsMedia":
return new CommonsMedia(stringValue, queryService);
case "geographic-shape":
return new GeographicShape(stringValue, queryService);
case "string":
return new LiteralString(stringValue, queryService);
case "tabular-data":
return new TabularData(stringValue, queryService);
case "url":
return new URL(stringValue, queryService);
case "external-id":
return new ExternalIdentifier(stringValue, queryService);
case "musical-notation":
return new MusicalNotation(stringValue, queryService);
case "mathematical-expression":
return new MathematicalExpression(stringValue, queryService);
}
throw new Error("Datatype: " + dataType + " not found");
}
/*
* REQUIRES: value is a valid Wikidata datatype, value is a valid DataValue corresponding to the datatype,
* queryService is not null
* MODIFIES: none
* EFFECTS : parses snak data into the specific type of Value which it represents
*/
public static Value parseData(DataValue value, String dataType, DatumQueryService queryService) {
switch (value.type) {
case "string":
String stringValue = (String) value.value;
return getLiteralString(dataType, queryService, stringValue);
case "globecoordinate":
GlobeCoordinateData globeCoordinateValue = new GlobeCoordinateData((Map<String, Object>) value.value);
return new GlobeCoordinate(globeCoordinateValue, queryService);
case "monolingualtext":
MonolingualTextData monolingualTextValue = new MonolingualTextData((Map<String, String>) value.value);
return new MonolingualText(monolingualTextValue, queryService);
case "quantity":
QuantityData quantityValue = new QuantityData((Map<String, String>) value.value);
return new Quantity(quantityValue, queryService);
case "time":
TimeData timeValue = new TimeData((Map<String, Object>) value.value);
return new Time(timeValue, queryService);
case "wikibase-entityid":
EntityData entityValue = new EntityData((Map<String, Object>) value.value);
return getDatum(dataType, queryService, entityValue);
}
throw new Error("Datatype: " + dataType + " not found");
}
/*
* REQUIRES: dataType is a valid Wikidata datatype with an item as its backing, queryService is not null,
* entityValue is not a valid EntityData corresponding to the dataType given
* MODIFIES: none
* EFFECTS : parses snak item data to return the specific type of Datum which this Item is
*/
private static Datum getDatum(String dataType, DatumQueryService queryService, EntityData entityValue) {
try {
switch (dataType) {
case "wikibase-item":
return new Item(entityValue, queryService);
case "wikibase-property":
return new Property(entityValue, queryService);
case "wikibase-lexeme":
return new Lexeme(entityValue, queryService);
case "wikibase-form":
return new Form(entityValue, queryService);
case "wikibase-sense":
return new Sense(entityValue, queryService);
}
} catch (NotFoundException e) {
throw new Error("ID: " + entityValue.id + " not found", e);
}
throw new Error("Datatype: " + dataType + " not found");
}
/*
* REQUIRES: none
* MODIFIES: this
* EFFECTS : finishes initializing the GUI components after it is added to another component (to allow for the
* subclasses to finish initializing first)
*/
@Override
public void addNotify() {
super.addNotify();
if (!initialized) {
initialized = true;
Value thisValue = this;
button = new JButton("◄");
button.addActionListener(i -> {
Container parent = getParent();
if (parent instanceof StatementList) {
StatementList guInterface = (StatementList) parent;
guInterface.toggle(new ItemView(thisValue));
}
});
button.setMargin(new Insets(0, 0, 0, 0));
add(button);
JLabel idComp = new JLabel(getID());
idComp.setForeground(Color.WHITE);
add(idComp);
JLabel separator = new JLabel(": ");
separator.setForeground(Color.WHITE);
add(separator);
JLabel titleComp = new JLabel(getTitle());
titleComp.setForeground(Color.WHITE);
add(titleComp);
}
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : gets the title to be displayed
*/
public abstract String getTitle();
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : gets the description to be displayed
*/
public abstract String getDescription();
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : gets the id if this Value (if there is one, often returns the title otherwise)
*/
public String getID() {
return id;
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns the list of statements associated with this Value
*/
public abstract StatementList getStatements();
/*
* REQUIRES: none
* MODIFIES: this
* EFFECTS : parses a REPL command directed at this Value
*/
public abstract Boolean parse(List<String> subList);
/*
* REQUIRES: view is not null
* MODIFIES: this
* EFFECTS : sets of the ItemView which contains this Value
*/
public void setView(ItemView view) {
this.view = view;
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns if an ItemView needs to include a search bar
*/
public boolean needsSearchBar() {
return false;
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns if an ItemView needs a right arrow
*/
public boolean needsRightArrow() {
return true;
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns the query service that this Value uses
*/
public DatumQueryService getQuery() {
return queryService;
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns true if this object has the same ID as another
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Value)) {
return false;
}
Value value = (Value) o;
return getID().equals(value.getID());
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns the hashcode of the description
*/
@Override
public int hashCode() {
int result = getDescription().hashCode();
result = 31 * result;
return result;
}
/*
* REQUIRES: value is not null
* MODIFIES: this
* EFFECTS : toggles the value in the controller to the left
*/
protected Boolean toggleLeft(Value value) {
if (this.view == null) {
return false;
}
return view.toggleLeft(value);
}
/*
* REQUIRES: value is not null and does not already exist
* MODIFIES: this
* EFFECTS : adds a statement to this statement list
*/
public void addStatement(Value value) {
getStatements().add(value);
}
/*
* REQUIRES: none
* MODIFIES: none
* EFFECTS : returns the image name or an empty string if there is no image
*/
public String getImage() {
return "";
}
}
| [
"[email protected]"
] | |
27c606c59a2abddfb1e99bd63e5a87a1ce079698 | 709d61a802585b3097f5ddb70a5ea9e2e99c3b8d | /src/main/java/Customer.java | 485ef5e3fba8acbf133db192e6f5c0b9c27e3a40 | [] | no_license | Harry29-exe/hibernate1 | 9031b22c30c99edc1399c5a6f62058a40cf6c7b2 | d98e957af2320a87c74154eb1ecc366f42a1f97c | refs/heads/master | 2022-12-08T20:46:17.980518 | 2020-08-31T13:12:17 | 2020-08-31T13:12:17 | 291,718,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "customer")
public class Customer implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long customerId = 1;
@Column(name = "firstName", nullable = false)
private String firstName;
@Column(name = "lastName", nullable = false)
private String lastName;
public long getCustomerId() {
return customerId;
}
public void setCustomerId(long customerId) {
this.customerId = customerId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
| [
"[email protected]"
] | |
070300fa7de278d8cf9fe2181b121dfc14a52300 | 2c6e2ba03eb71ca45fe690ff6e4586f6e2fa0f17 | /material/apks/banco/sources/com/google/common/util/concurrent/ListenableScheduledFuture.java | 56d0983b3e3d91eb52a5c3ac377f4a3f694cf885 | [] | no_license | lcrcastor/curso-mobile-2019 | 3088a196139b3e980ed6e09797a0bbf5efb6440b | 7585fccb6437a17c841772c1d9fb0701d6c68042 | refs/heads/master | 2023-04-06T21:46:32.333236 | 2020-10-30T19:47:54 | 2020-10-30T19:47:54 | 308,680,747 | 0 | 1 | null | 2023-03-26T06:57:57 | 2020-10-30T16:08:31 | Java | UTF-8 | Java | false | false | 308 | java | package com.google.common.util.concurrent;
import com.google.common.annotations.Beta;
import com.google.common.annotations.GwtIncompatible;
import java.util.concurrent.ScheduledFuture;
@GwtIncompatible
@Beta
public interface ListenableScheduledFuture<V> extends ListenableFuture<V>, ScheduledFuture<V> {
}
| [
"[email protected]"
] | |
fd63d43bc62b5b19baf7d39f05125972df950650 | 39ef743596d11bded67d0fb88a180da0b2d92d4a | /Backend/src/main/java/nl/han/ica/oose/dea/spotitube/exceptions/EntityNotFoundException.java | 77e2d9b1ce89a9d81b35badf2d0c7e4742de88a8 | [
"MIT"
] | permissive | SanderTeunissen/Spotitube | 89fa3730d14a3e285200221d5652dbde622719ed | 38d97323aab2efbb3c06b4962b02e10b9c2c1808 | refs/heads/master | 2020-04-15T23:06:29.254367 | 2019-01-10T16:53:10 | 2019-01-10T16:53:10 | 165,094,630 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 259 | java | package nl.han.ica.oose.dea.spotitube.exceptions;
public class EntityNotFoundException extends Exception {
public EntityNotFoundException(Class classType) {
super(String.format("Couldn't find instance of class: %s", classType.getName()));
}
} | [
"[email protected]"
] | |
a674f3e593a2e8111c645539da40ae0b42055139 | c119200e73847cbcb9eb956f5254fb05f912238e | /core/org.wso2.carbon.tomcat.ext/src/main/java/org/wso2/carbon/tomcat/ext/filter/CharacterSetFilter.java | 27b9241a525716f8ea813564bfcf5d9ab27f0e95 | [] | no_license | kasunbg/carbon-kernel-4.x | ac04423bc482ae4cdf98cbb92ad19b9b2be1dd9f | ea7a3cfea7b657d187f38e7628c56970b70c0491 | refs/heads/master | 2022-06-05T21:32:00.953299 | 2016-12-01T06:52:35 | 2016-12-01T06:52:35 | 75,286,577 | 0 | 2 | null | 2022-05-20T20:47:53 | 2016-12-01T11:33:12 | Java | UTF-8 | Java | false | false | 2,155 | java | /*
* Copyright (c) 2005-2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.tomcat.ext.filter;
import javax.servlet.*;
import java.io.IOException;
/***
* This is a filter class to force the java webapp to handle all requests and responses as UTF-8 encoded by default.
* This requires that we define a character set filter.
* This filter makes sure that if the browser hasn't set the encoding used in the request, that it's set to UTF-8.
*/
public class CharacterSetFilter implements Filter {
private static final String UTF8 = "UTF-8";
private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
private String encoding;
@Override
public void init(FilterConfig config) throws ServletException {
encoding = config.getInitParameter("requestEncoding");
if (encoding == null) {
encoding = UTF8;
}
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
// Respect the client-specified character encoding
// (see HTTP specification section 3.4.1)
if (null == request.getCharacterEncoding()) {
request.setCharacterEncoding(encoding);
}
/**
* Set the default response content type and encoding
*/
response.setContentType(CONTENT_TYPE);
response.setCharacterEncoding(UTF8);
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
} | [
"[email protected]"
] | |
f645f970f9a87c3d863f158cd87d8ed76a69ec4f | df7a73b04679da8e1aba210af222f8be7723e7a2 | /fangjia-fsh-api/src/main/java/com/fangjia/fsh/api/fallback/ServiceConsumerFallbackProvider.java | c6bdce315efed7a27802f13ad1ed809a37636875 | [] | no_license | isxuran/spring-cloud-safe | 60c27fe82c6d640eda41bb943cf3f44d476e51c8 | 6f1c5d61d5c950b969e1e1fe8c76b995d593937d | refs/heads/master | 2020-04-02T20:50:01.365845 | 2018-10-26T05:12:32 | 2018-10-26T05:12:32 | 154,780,600 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,274 | java | package com.fangjia.fsh.api.fallback;
import com.netflix.zuul.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.zuul.filters.route.ZuulFallbackProvider;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Component;
import com.fangjia.common.base.ResponseCode;
import com.fangjia.common.base.ResponseData;
import com.fangjia.common.util.JsonUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
/**
* 服务不可用时回退功能
* @author yinjihuan
*
*/
@Component
public class ServiceConsumerFallbackProvider implements ZuulFallbackProvider {
private Logger log = LoggerFactory.getLogger(ServiceConsumerFallbackProvider.class);
/**
* 需要回退的服务名称,必须是Eureka中注册的,全部用*
*/
@Override
public String getRoute() {
return "*";
}
@Override
public ClientHttpResponse fallbackResponse() {
return new ClientHttpResponse() {
@Override
public HttpStatus getStatusCode() throws IOException {
return HttpStatus.OK;
}
@Override
public int getRawStatusCode() throws IOException {
return this.getStatusCode().value();
}
@Override
public String getStatusText() throws IOException {
return this.getStatusCode().getReasonPhrase();
}
@Override
public void close() {
}
@Override
public InputStream getBody() throws IOException {
RequestContext ctx = RequestContext.getCurrentContext();
Throwable throwable = ctx.getThrowable();
if (throwable != null) {
log.error("", throwable.getCause());
}
ResponseData data = ResponseData.fail("服务器内部错误", ResponseCode.SERVER_ERROR_CODE.getCode());
return new ByteArrayInputStream(JsonUtils.toJson(data).getBytes());
}
@Override
public HttpHeaders getHeaders() {
HttpHeaders headers = new HttpHeaders();
MediaType mt = new MediaType("application", "json", Charset.forName("UTF-8"));
headers.setContentType(mt);
return headers;
}
};
}
} | [
"[email protected]"
] | |
8acc2db347a99eb87fb360fe2fc8d00fa72b4eed | a51cc60fe45f689e5ed13ed1bdfe3501ee37bcf1 | /app/src/main/java/com/madar/madardemo/Fragment/OrdersFragment.java | 501c4ae0177082f978458b3da0419a03bf16e7da | [] | no_license | Sotra970/MadarDemo | 8cb051915bd8ad3cf8b7e4fb19e7b71cc94b78dd | 5b8a3b13037f00b04a7eb723aa127467f5a61ac5 | refs/heads/master | 2021-05-03T10:14:19.588448 | 2018-04-08T00:19:14 | 2018-04-08T00:19:14 | 120,531,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,295 | java | package com.madar.madardemo.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.madar.madardemo.Adapter.OrderFragmentsAdapter;
import com.madar.madardemo.AppManger.MadarApplication;
import com.madar.madardemo.Fragment.Abstract.TitledFragment;
import com.madar.madardemo.Interface.NoConn;
import com.madar.madardemo.Model.OrderItem;
import com.madar.madardemo.Model.ServerResponse.UserOrdersResponse;
import com.madar.madardemo.R;
import com.madar.madardemo.Service.CallbackWithRetry;
import com.madar.madardemo.Service.Injector;
import com.madar.madardemo.Service.onRequestFailure;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
import retrofit2.Call;
import retrofit2.Response;
import uk.co.chrisjenx.calligraphy.CalligraphyUtils;
/**
* Created by Ahmed on 8/23/2017.
*/
public class OrdersFragment extends TitledFragment {
@BindView(R.id.progressView)
View progrssView ;
@BindView(R.id.container)
View containerHolder ;
public static OrdersFragment getInstance() {
return new OrdersFragment();
}
private ArrayList<OrderItem> orderItems;
private OrderFragmentsAdapter fragmentsAdapter;
private TabLayout tabLayout;
private ViewPager viewPager;
private ArrayList<BaseOrderListFragment> fragments;
private View v;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
/*if(v == null){
}*/
v = inflater.inflate(R.layout.fragment_orders, container, false);
ButterKnife.bind(this, v) ;
initLoading(this.progrssView, this.containerHolder) ;
viewPager = (ViewPager)
v.findViewById(R.id.fragment_orders_view_pager);
fragments = new ArrayList<>();
fragments.add(BaseOrderListFragment.getInstance(null));
fragments.add(BaseOrderListFragment.getInstance(null));
fragments.add(BaseOrderListFragment.getInstance(null));
fragmentsAdapter = new OrderFragmentsAdapter(getChildFragmentManager(), fragments, getContext());
viewPager.setAdapter(fragmentsAdapter);
viewPager.setOffscreenPageLimit(3);
tabLayout = (TabLayout) v.findViewById(R.id.fragment_orders_tab_layout);
tabLayout.setupWithViewPager(viewPager);
initTabLayout(tabLayout);
return v;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
private void initTabLayout(final TabLayout tabLayout){
for (int i = 0; i < tabLayout.getTabCount(); i++) {
TabLayout.Tab tab = tabLayout.getTabAt(i);
if(tab != null){
View v = getTabView(i);
if(v != null){
tab.setCustomView(getTabView(i));
}
}
}
tabLayout.addOnTabSelectedListener(
new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
if(tab.getCustomView() != null){
View v = tab.getCustomView();
v.setBackgroundColor(
ResourcesCompat.getColor(
getResources(),
R.color.yellow_button_background_selected,
null
)
);
}
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
if(tab.getCustomView() != null) {
View v = tab.getCustomView();
v.setBackgroundColor(
ResourcesCompat.getColor(
getResources(),
R.color.yellow_button_background_unselected,
null
)
);
}
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
if(tab.getCustomView() != null){
View v = tab.getCustomView();
v.setBackgroundColor(
ResourcesCompat.getColor(
getResources(),
R.color.yellow_button_background_selected,
null
)
);
}
}
}
);
TabLayout.Tab first = tabLayout.getTabAt(0);
if(first != null){
first.select();
}
}
@Override
public void onStart() {
super.onStart();
}
@Override
public void onResume() {
super.onResume();
loadOrdersList();
}
private View getTabView(int index){
int textResId = -1;
switch (index){
case 0:
textResId = R.string.text_all_orders;
break;
case 1:
textResId = R.string.text_i_deliver;
break;
case 2:
textResId = R.string.text_i_receive;
break;
}
if(textResId != - 1){
LinearLayout linearLayout = new LinearLayout(getContext());
linearLayout.setLayoutParams(
new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
);
linearLayout.setGravity(Gravity.CENTER);
TextView textView = new TextView(getContext());
textView.setTextColor(
ResourcesCompat.getColor(
getResources(),
R.color.grey_700,
null
)
);
CalligraphyUtils.applyFontToTextView(getContext(), textView, "fonts/Changa-Bold.ttf");
textView.setText(textResId);
textView.setLayoutParams(
new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
);
linearLayout.addView(textView);
return linearLayout;
}
return null;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setTitle(R.string.fragment_title_orders);
}
protected void loadOrdersList(){
if(orderItems != null){
showLoading(true);
if(MadarApplication.getExecutorService() != null){
MadarApplication.getExecutorService()
.submit(
new Runnable() {
@Override
public void run() {
showOrderItems(orderItems);
}
}
);
}
}
else{
String secret = null;
try {
secret = MadarApplication.getInstance().getPrefManager().getUser().getSecret();
}
catch (Exception e){
// ignore
}
if(secret != null){
showLoading(true);
final Call<UserOrdersResponse> receiptItemCall = Injector.Api()
.getUserOrderInfo("getUserAllOrders", secret);
receiptItemCall.enqueue(new CallbackWithRetry<UserOrdersResponse>(
CallbackWithRetry.HTTP_REQUEST_RETRY_COUNT,
CallbackWithRetry.HTTP_REQUEST_RETRY_INTERVAl_MILISECONDS,
receiptItemCall,
new onRequestFailure() {
@Override
public void onFailure() {
if(tabLayout != null){
tabLayout.setVisibility(View.GONE);
}
Log.e("orders Request", "failure");
showNoConn(
new NoConn() {
@Override
public void onRetry() {
loadOrdersList();
}
}
);
showLoading(false);
}
})
{
@Override
public void onResponse(Call<UserOrdersResponse> call, Response<UserOrdersResponse> response) {
final UserOrdersResponse userOrdersResponse = response.body();
if(userOrdersResponse != null){
orderItems = userOrdersResponse.getOrders();
if(MadarApplication.getExecutorService() != null){
MadarApplication.getExecutorService()
.submit(
new Runnable() {
@Override
public void run() {
initOrderDates(orderItems);
showOrderItems(orderItems);
}
}
);
}
}
}
});
}
}
}
private void initOrderDates(final ArrayList<OrderItem> orderItems){
// do not call on ui thread
if(orderItems != null && !orderItems.isEmpty()){
for(OrderItem orderItem : orderItems){
orderItem.initDate();
}
}
}
private void showOrderItems(final ArrayList<OrderItem> orderItems){
final ArrayList<OrderItem> receiving = new ArrayList<OrderItem>();
final ArrayList<OrderItem> sending = new ArrayList<OrderItem>();
if(orderItems != null && !orderItems.isEmpty()){
for(OrderItem orderItem : orderItems){
if(orderItem.isReceiving()){
receiving.add(orderItem);
}
else{
sending.add(orderItem);
}
}
}
Handler uiHandler =
new Handler(Looper.getMainLooper());
uiHandler.post(
new Runnable() {
@Override
public void run() {
if(fragmentsAdapter != null){
if(fragments != null){
BaseOrderListFragment f;
for(int i = 0; i < fragments.size(); i++){
f = fragments.get(i);
switch (i){
case 0:
f.setOrderItems(orderItems);
break;
case 1:
f.setOrderItems(sending);
break;
case 2:
f.setOrderItems(receiving);
break;
}
}
}
}
showLoading(false);
}
}
);
}
}
| [
"[email protected]"
] | |
076be54d304b4b4700979f94a53b7a1c38900028 | 1af1cfbaab4829584ec012ff637999f3ae3de017 | /DoctorCar/app/src/main/java/com/doctorcar/mobile/view/layout/OverScrollView.java | 17cc494c2ca9199ab730fb2338ce130b36c5b401 | [] | no_license | ldqsxsl/DoctorCar | 8681e3e1415320eb3143fb2da6b23c74417fba43 | fd00b2471c11ca2697976ff561ac82612e34dfc9 | refs/heads/master | 2020-06-11T09:54:05.372717 | 2017-06-19T09:47:50 | 2017-06-19T09:47:50 | 75,686,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,749 | java | package com.doctorcar.mobile.view.layout;
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.AnimationUtils;
import android.view.animation.OvershootInterpolator;
import android.widget.FrameLayout;
import android.widget.Scroller;
import android.view.View.OnTouchListener;
import java.lang.reflect.Field;
import java.util.List;
/**
* Layout container for a view hierarchy that can be scrolled by the user,
* allowing it to be larger than the physical display. A ScrollView is a
* {@link FrameLayout}, meaning you should place one child in it containing the
* entire contents to scroll; this child may itself be a layout manager with a
* complex hierarchy of objects. A child that is often used is a
* {@link } in a vertical orientation, presenting a vertical array
* of top-level items that the user can scroll through.
*
* <p>
* The {@link } class also takes care of its own scrolling, so does not
* require a ScrollView, but using the two together is possible to achieve the
* effect of a text view within a larger container.
*
* <p>
* ScrollView only supports vertical scrolling.
*/
public class OverScrollView extends FrameLayout implements OnTouchListener
{
static final int ANIMATED_SCROLL_GAP = 250;
static final float MAX_SCROLL_FACTOR = 0.5f;
static final float OVERSHOOT_TENSION = 0.75f;
private long mLastScroll;
private final Rect mTempRect = new Rect();
private Scroller mScroller;
protected Context mContext;
Field mScrollYField;
Field mScrollXField;
boolean hasFailedObtainingScrollFields;
int prevScrollY;
boolean isInFlingMode = false;
DisplayMetrics metrics;
LayoutInflater inflater;
protected View child;
private Runnable overScrollerSpringbackTask;
/**
* Flag to indicate that we are moving focus ourselves. This is so the code
* that watches for focus changes initiated outside this ScrollView knows
* that it does not have to do anything.
*/
private boolean mScrollViewMovedFocus;
/**
* Position of the last motion event.
*/
private float mLastMotionY;
/**
* True when the layout has changed but the traversal has not come through
* yet. Ideally the view hierarchy would keep track of this for us.
*/
private boolean mIsLayoutDirty = true;
/**
* The child to give focus to in the event that a child has requested focus
* while the layout is dirty. This prevents the scroll from being wrong if
* the child has not been laid out before requesting focus.
*/
private View mChildToScrollTo = null;
/**
* True if the user is currently dragging this ScrollView around. This is
* not the same as 'is being flinged', which can be checked by
* mScroller.isFinished() (flinging begins when the user lifts his finger).
*/
private boolean mIsBeingDragged = false;
/**
* Determines speed during touch scrolling
*/
private VelocityTracker mVelocityTracker;
/**
* When set to true, the scroll view measure its child to make it fill the
* currently visible area.
*/
private boolean mFillViewport;
/**
* Whether arrow scrolling is animated.
*/
private boolean mSmoothScrollingEnabled = true;
private int mTouchSlop;
private int mMinimumVelocity;
private int mMaximumVelocity;
/**
* ID of the active pointer. This is used to retain consistency during
* drags/flings if multiple pointers are used.
*/
private int mActivePointerId = INVALID_POINTER;
/**
* Sentinel value for no current active pointer. Used by
* {@link #mActivePointerId}.
*/
private static final int INVALID_POINTER = -1;
public OverScrollView(Context context)
{
this(context, null);
}
public OverScrollView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
public OverScrollView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
mContext = context;
initScrollView();
setFillViewport(true);
initBounce();
}
private void initBounce()
{
metrics = this.mContext.getResources().getDisplayMetrics();
// init the bouncy scroller, and make sure the layout is being drawn
// after the top padding
mScroller = new Scroller(getContext(), new OvershootInterpolator(OVERSHOOT_TENSION));
overScrollerSpringbackTask = new Runnable()
{
@Override
public void run()
{
// scroll till after the padding
mScroller.computeScrollOffset();
scrollTo(0, mScroller.getCurrY());
if (!mScroller.isFinished())
{
post(this);
}
}
};
prevScrollY = getPaddingTop();
try
{
mScrollXField = View.class.getDeclaredField("mScrollX");
mScrollYField = View.class.getDeclaredField("mScrollY");
} catch (Exception e)
{
hasFailedObtainingScrollFields = true;
}
}
private void SetScrollY(int value)
{
if (mScrollYField != null)
{
try
{
mScrollYField.setInt(this, value);
} catch (Exception e)
{
}
}
}
private void SetScrollX(int value)
{
if (mScrollXField != null)
{
try
{
mScrollXField.setInt(this, value);
} catch (Exception e)
{
}
}
}
public void initChildPointer()
{
child = getChildAt(0);
child.setPadding(0, 1500, 0, 1500);
}
@Override
protected float getTopFadingEdgeStrength()
{
if (getChildCount() == 0)
{
return 0.0f;
}
final int length = getVerticalFadingEdgeLength();
if (getScrollY() < length)
{
return getScrollY() / (float) length;
}
return 1.0f;
}
@Override
protected float getBottomFadingEdgeStrength()
{
if (getChildCount() == 0)
{
return 0.0f;
}
final int length = getVerticalFadingEdgeLength();
final int bottomEdge = getHeight() - getPaddingBottom();
final int span = getChildAt(0).getBottom() - getScrollY() - bottomEdge;
if (span < length)
{
return span / (float) length;
}
return 1.0f;
}
/**
* @return The maximum amount this scroll view will scroll in response to an
* arrow event.
*/
public int getMaxScrollAmount()
{
return (int) (MAX_SCROLL_FACTOR * (getBottom() - getTop()));
}
private void initScrollView()
{
mScroller = new Scroller(getContext());
setFocusable(true);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setWillNotDraw(false);
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
setOnTouchListener(this);
post(new Runnable()
{
public void run()
{
scrollTo(0, child.getPaddingTop());
}
});
}
@Override
public void addView(View child)
{
if (getChildCount() > 0)
{
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(child);
initChildPointer();
}
@Override
public void addView(View child, int index)
{
if (getChildCount() > 0)
{
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(child, index);
initChildPointer();
}
@Override
public void addView(View child, ViewGroup.LayoutParams params)
{
if (getChildCount() > 0)
{
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(child, params);
initChildPointer();
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params)
{
if (getChildCount() > 0)
{
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(child, index, params);
}
/**
* @return Returns true this ScrollView can be scrolled
*/
private boolean canScroll()
{
View child = getChildAt(0);
if (child != null)
{
int childHeight = child.getHeight();
return getHeight() < childHeight + getPaddingTop() + getPaddingBottom();
}
return false;
}
/**
* Indicates whether this ScrollView's content is stretched to fill the
* viewport.
*
* @return True if the content fills the viewport, false otherwise.
*/
public boolean isFillViewport()
{
return mFillViewport;
}
/**
* Indicates this ScrollView whether it should stretch its content height to
* fill the viewport or not.
*
* @param fillViewport
* True to stretch the content's height to the viewport's
* boundaries, false otherwise.
*/
public void setFillViewport(boolean fillViewport)
{
if (fillViewport != mFillViewport)
{
mFillViewport = fillViewport;
requestLayout();
}
}
/**
* @return Whether arrow scrolling will animate its transition.
*/
public boolean isSmoothScrollingEnabled()
{
return mSmoothScrollingEnabled;
}
/**
* Set whether arrow scrolling will animate its transition.
*
* @param smoothScrollingEnabled
* whether arrow scrolling will animate its transition
*/
public void setSmoothScrollingEnabled(boolean smoothScrollingEnabled)
{
mSmoothScrollingEnabled = smoothScrollingEnabled;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (!mFillViewport)
{
return;
}
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);
if (heightMode == MeasureSpec.UNSPECIFIED)
{
return;
}
if (getChildCount() > 0)
{
final View child = getChildAt(0);
int height = getMeasuredHeight();
if (child.getMeasuredHeight() < height)
{
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, getPaddingLeft() + getPaddingRight(), lp.width);
height -= getPaddingTop();
height -= getPaddingBottom();
int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
}
}
@Override
public boolean dispatchKeyEvent(KeyEvent event)
{
// Let the focused view and/or our descendants get the key first
return super.dispatchKeyEvent(event) || executeKeyEvent(event);
}
/**
* You can call this function yourself to have the scroll view perform
* scrolling from a key event, just as if the event had been dispatched to
* it by the view hierarchy.
*
* @param event
* The key event to execute.
* @return Return true if the event was handled, else false.
*/
public boolean executeKeyEvent(KeyEvent event)
{
mTempRect.setEmpty();
if (!canScroll())
{
if (isFocused() && event.getKeyCode() != KeyEvent.KEYCODE_BACK)
{
View currentFocused = findFocus();
if (currentFocused == this)
currentFocused = null;
View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, View.FOCUS_DOWN);
return nextFocused != null && nextFocused != this && nextFocused.requestFocus(View.FOCUS_DOWN);
}
return false;
}
boolean handled = false;
if (event.getAction() == KeyEvent.ACTION_DOWN)
{
switch (event.getKeyCode())
{
case KeyEvent.KEYCODE_DPAD_UP:
if (!event.isAltPressed())
{
handled = arrowScroll(View.FOCUS_UP);
} else
{
handled = fullScroll(View.FOCUS_UP);
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
if (!event.isAltPressed())
{
handled = arrowScroll(View.FOCUS_DOWN);
} else
{
handled = fullScroll(View.FOCUS_DOWN);
}
break;
case KeyEvent.KEYCODE_SPACE:
pageScroll(event.isShiftPressed() ? View.FOCUS_UP : View.FOCUS_DOWN);
break;
}
}
return handled;
}
public boolean inChild(int x, int y)
{
if (getChildCount() > 0)
{
final int scrollY = getScrollY();
final View child = getChildAt(0);
return !(y < child.getTop() - scrollY || y >= child.getBottom() - scrollY || x < child.getLeft() || x >= child.getRight());
}
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
/*
* This method JUST determines whether we want to intercept the motion.
* If we return true, onMotionEvent will be called and we do the actual
* scrolling there.
*/
/*
* Shortcut the most recurring case: the user is in the dragging state
* and he is moving his finger. We want to intercept this motion.
*/
final int action = ev.getAction();
if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged))
{
return true;
}
switch (action & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_MOVE:
{
/*
* mIsBeingDragged == false, otherwise the shortcut would have
* caught it. Check whether the user has moved far enough from his
* original down touch.
*/
/*
* Locally do absolute value. mLastMotionY is set to the y value of
* the down event.
*/
final int activePointerId = mActivePointerId;
if (activePointerId == INVALID_POINTER)
{
// If we don't have a valid id, the touch down wasn't on
// content.
break;
}
final int pointerIndex = ev.findPointerIndex(activePointerId);
final float y = ev.getY(pointerIndex);
final int yDiff = (int) Math.abs(y - mLastMotionY);
if (yDiff > mTouchSlop)
{
mIsBeingDragged = true;
mLastMotionY = y;
}
break;
}
case MotionEvent.ACTION_DOWN:
{
final float y = ev.getY();
if (!inChild((int) ev.getX(), (int) y))
{
mIsBeingDragged = false;
break;
}
/*
* Remember location of down touch. ACTION_DOWN always refers to
* pointer index 0.
*/
mLastMotionY = y;
mActivePointerId = ev.getPointerId(0);
/*
* If being flinged and user touches the screen, initiate drag;
* otherwise don't. mScroller.isFinished should be false when being
* flinged.
*/
mIsBeingDragged = !mScroller.isFinished();
break;
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
/* Release the drag */
mIsBeingDragged = false;
mActivePointerId = INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
/*
* The only time we want to intercept motion events is if we are in the
* drag mode.
*/
return mIsBeingDragged;
}
@Override
public boolean onTouchEvent(MotionEvent ev)
{
if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0)
{
// Don't handle edge touches immediately -- they may actually belong
// to one of our
// descendants.
return false;
}
if (mVelocityTracker == null)
{
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(ev);
final int action = ev.getAction();
switch (action & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_DOWN:
{
final float y = ev.getY();
if (!(mIsBeingDragged = inChild((int) ev.getX(), (int) y)))
{
return false;
}
/*
* If being flinged and user touches, stop the fling. isFinished
* will be false if being flinged.
*/
if (!mScroller.isFinished())
{
mScroller.abortAnimation();
}
// Remember where the motion event started
mLastMotionY = y;
mActivePointerId = ev.getPointerId(0);
break;
}
case MotionEvent.ACTION_MOVE:
if (mIsBeingDragged)
{
// Scroll to follow the motion event
final int activePointerIndex = ev.findPointerIndex(mActivePointerId);
final float y = ev.getY(activePointerIndex);
final int deltaY = (int) (mLastMotionY - y);
mLastMotionY = y;
if (isOverScrolled())
{
// when overscrolling, move the scroller just half of the
// finger movement, to make it feel like a spring...
scrollBy(0, deltaY / 2);
} else
{
scrollBy(0, deltaY);
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged)
{
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int initialVelocity = (int) velocityTracker.getYVelocity(mActivePointerId);
if (getChildCount() > 0 && Math.abs(initialVelocity) > mMinimumVelocity)
{
fling(-initialVelocity);
}
mActivePointerId = INVALID_POINTER;
mIsBeingDragged = false;
if (mVelocityTracker != null)
{
mVelocityTracker.recycle();
mVelocityTracker = null;
}
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged && getChildCount() > 0)
{
mActivePointerId = INVALID_POINTER;
mIsBeingDragged = false;
if (mVelocityTracker != null)
{
mVelocityTracker.recycle();
mVelocityTracker = null;
}
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return true;
}
public boolean isOverScrolled()
{
return (getScrollY() < child.getPaddingTop() || getScrollY() > child.getBottom() - child.getPaddingBottom() - getHeight());
}
private void onSecondaryPointerUp(MotionEvent ev)
{
final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
final int pointerId = ev.getPointerId(pointerIndex);
if (pointerId == mActivePointerId)
{
// This was our active pointer going up. Choose a new
// active pointer and adjust accordingly.
// TODO: Make this decision more intelligent.
final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
mLastMotionY = ev.getY(newPointerIndex);
mActivePointerId = ev.getPointerId(newPointerIndex);
if (mVelocityTracker != null)
{
mVelocityTracker.clear();
}
}
}
/**
* <p>
* Finds the next focusable component that fits in this View's bounds
* (excluding fading edges) pretending that this View's top is located at
* the parameter top.
* </p>
*
* @param topFocus
* look for a candidate is the one at the top of the bounds if
* topFocus is true, or at the bottom of the bounds if topFocus
* is false
* @param top
* the top offset of the bounds in which a focusable must be
* found (the fading edge is assumed to start at this position)
* @param preferredFocusable
* the View that has highest priority and will be returned if it
* is within my bounds (null is valid)
* @return the next focusable component in the bounds or null if none can be
* found
*/
private View findFocusableViewInMyBounds(final boolean topFocus, final int top, View preferredFocusable)
{
/*
* The fading edge's transparent side should be considered for focus
* since it's mostly visible, so we divide the actual fading edge length
* by 2.
*/
final int fadingEdgeLength = getVerticalFadingEdgeLength() / 2;
final int topWithoutFadingEdge = top + fadingEdgeLength;
final int bottomWithoutFadingEdge = top + getHeight() - fadingEdgeLength;
if ((preferredFocusable != null) && (preferredFocusable.getTop() < bottomWithoutFadingEdge)
&& (preferredFocusable.getBottom() > topWithoutFadingEdge))
{
return preferredFocusable;
}
return findFocusableViewInBounds(topFocus, topWithoutFadingEdge, bottomWithoutFadingEdge);
}
/**
* <p>
* Finds the next focusable component that fits in the specified bounds.
* </p>
*
* @param topFocus
* look for a candidate is the one at the top of the bounds if
* topFocus is true, or at the bottom of the bounds if topFocus
* is false
* @param top
* the top offset of the bounds in which a focusable must be
* found
* @param bottom
* the bottom offset of the bounds in which a focusable must be
* found
* @return the next focusable component in the bounds or null if none can be
* found
*/
private View findFocusableViewInBounds(boolean topFocus, int top, int bottom)
{
List<View> focusables = getFocusables(View.FOCUS_FORWARD);
View focusCandidate = null;
/*
* A fully contained focusable is one where its top is below the bound's
* top, and its bottom is above the bound's bottom. A partially
* contained focusable is one where some part of it is within the
* bounds, but it also has some part that is not within bounds. A fully
* contained focusable is preferred to a partially contained focusable.
*/
boolean foundFullyContainedFocusable = false;
int count = focusables.size();
for (int i = 0; i < count; i++)
{
View view = focusables.get(i);
int viewTop = view.getTop();
int viewBottom = view.getBottom();
if (top < viewBottom && viewTop < bottom)
{
/*
* the focusable is in the target area, it is a candidate for
* focusing
*/
final boolean viewIsFullyContained = (top < viewTop) && (viewBottom < bottom);
if (focusCandidate == null)
{
/* No candidate, take this one */
focusCandidate = view;
foundFullyContainedFocusable = viewIsFullyContained;
} else
{
final boolean viewIsCloserToBoundary = (topFocus && viewTop < focusCandidate.getTop())
|| (!topFocus && viewBottom > focusCandidate.getBottom());
if (foundFullyContainedFocusable)
{
if (viewIsFullyContained && viewIsCloserToBoundary)
{
/*
* We're dealing with only fully contained views, so
* it has to be closer to the boundary to beat our
* candidate
*/
focusCandidate = view;
}
} else
{
if (viewIsFullyContained)
{
/*
* Any fully contained view beats a partially
* contained view
*/
focusCandidate = view;
foundFullyContainedFocusable = true;
} else if (viewIsCloserToBoundary)
{
/*
* Partially contained view beats another partially
* contained view if it's closer
*/
focusCandidate = view;
}
}
}
}
}
return focusCandidate;
}
/**
* <p>
* Handles scrolling in response to a "page up/down" shortcut press. This
* method will scroll the view by one page up or down and give the focus to
* the topmost/bottommost component in the new visible area. If no component
* is a good candidate for focus, this scrollview reclaims the focus.
* </p>
*
* @param direction
* the scroll direction: {@link View#FOCUS_UP} to go
* one page up or {@link View#FOCUS_DOWN} to go one
* page down
* @return true if the key event is consumed by this method, false otherwise
*/
public boolean pageScroll(int direction)
{
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
if (down)
{
mTempRect.top = getScrollY() + height;
int count = getChildCount();
if (count > 0)
{
View view = getChildAt(count - 1);
if (mTempRect.top + height > view.getBottom())
{
mTempRect.top = view.getBottom() - height;
}
}
} else
{
mTempRect.top = getScrollY() - height;
if (mTempRect.top < 0)
{
mTempRect.top = 0;
}
}
mTempRect.bottom = mTempRect.top + height;
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
}
/**
* <p>
* Handles scrolling in response to a "home/end" shortcut press. This method
* will scroll the view to the top or bottom and give the focus to the
* topmost/bottommost component in the new visible area. If no component is
* a good candidate for focus, this scrollview reclaims the focus.
* </p>
*
* @param direction
* the scroll direction: {@link View#FOCUS_UP} to go
* the top of the view or {@link View#FOCUS_DOWN} to
* go the bottom
* @return true if the key event is consumed by this method, false otherwise
*/
public boolean fullScroll(int direction)
{
boolean down = direction == View.FOCUS_DOWN;
int height = getHeight();
mTempRect.top = 0;
mTempRect.bottom = height;
if (down)
{
int count = getChildCount();
if (count > 0)
{
View view = getChildAt(count - 1);
mTempRect.bottom = view.getBottom();
mTempRect.top = mTempRect.bottom - height;
}
}
return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom);
}
/**
* <p>
* Scrolls the view to make the area defined by <code>top</code> and
* <code>bottom</code> visible. This method attempts to give the focus to a
* component visible in this area. If no component can be focused in the new
* visible area, the focus is reclaimed by this scrollview.
* </p>
*
* @param direction
* the scroll direction: {@link View#FOCUS_UP} to go
* upward {@link View#FOCUS_DOWN} to downward
* @param top
* the top offset of the new area to be made visible
* @param bottom
* the bottom offset of the new area to be made visible
* @return true if the key event is consumed by this method, false otherwise
*/
private boolean scrollAndFocus(int direction, int top, int bottom)
{
boolean handled = true;
int height = getHeight();
int containerTop = getScrollY();
int containerBottom = containerTop + height;
boolean up = direction == View.FOCUS_UP;
View newFocused = findFocusableViewInBounds(up, top, bottom);
if (newFocused == null)
{
newFocused = this;
}
if (top >= containerTop && bottom <= containerBottom)
{
handled = false;
} else
{
int delta = up ? (top - containerTop) : (bottom - containerBottom);
doScrollY(delta);
}
if (newFocused != findFocus() && newFocused.requestFocus(direction))
{
mScrollViewMovedFocus = true;
mScrollViewMovedFocus = false;
}
return handled;
}
/**
* Handle scrolling in response to an up or down arrow click.
*
* @param direction
* The direction corresponding to the arrow key that was pressed
* @return True if we consumed the event, false otherwise
*/
public boolean arrowScroll(int direction)
{
View currentFocused = findFocus();
if (currentFocused == this)
currentFocused = null;
View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);
final int maxJump = getMaxScrollAmount();
if (nextFocused != null && isWithinDeltaOfScreen(nextFocused, maxJump, getHeight()))
{
nextFocused.getDrawingRect(mTempRect);
offsetDescendantRectToMyCoords(nextFocused, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
doScrollY(scrollDelta);
nextFocused.requestFocus(direction);
} else
{
// no new focus
int scrollDelta = maxJump;
if (direction == View.FOCUS_UP && getScrollY() < scrollDelta)
{
scrollDelta = getScrollY();
} else if (direction == View.FOCUS_DOWN)
{
if (getChildCount() > 0)
{
int daBottom = getChildAt(0).getBottom();
int screenBottom = getScrollY() + getHeight();
if (daBottom - screenBottom < maxJump)
{
scrollDelta = daBottom - screenBottom;
}
}
}
if (scrollDelta == 0)
{
return false;
}
doScrollY(direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta);
}
if (currentFocused != null && currentFocused.isFocused() && isOffScreen(currentFocused))
{
// previously focused item still has focus and is off screen, give
// it up (take it back to ourselves)
// (also, need to temporarily force FOCUS_BEFORE_DESCENDANTS so we
// are
// sure to
// get it)
final int descendantFocusability = getDescendantFocusability(); // save
setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
requestFocus();
setDescendantFocusability(descendantFocusability); // restore
}
return true;
}
/**
* @return whether the descendant of this scroll view is scrolled off
* screen.
*/
private boolean isOffScreen(View descendant)
{
return !isWithinDeltaOfScreen(descendant, 0, getHeight());
}
/**
* @return whether the descendant of this scroll view is within delta pixels
* of being on the screen.
*/
private boolean isWithinDeltaOfScreen(View descendant, int delta, int height)
{
descendant.getDrawingRect(mTempRect);
offsetDescendantRectToMyCoords(descendant, mTempRect);
return (mTempRect.bottom + delta) >= getScrollY() && (mTempRect.top - delta) <= (getScrollY() + height);
}
/**
* Smooth scroll by a Y delta
*
* @param delta
* the number of pixels to scroll by on the Y axis
*/
private void doScrollY(int delta)
{
if (delta != 0)
{
if (mSmoothScrollingEnabled)
{
smoothScrollBy(0, delta);
} else
{
scrollBy(0, delta);
}
}
}
/**
* Like {@link View#scrollBy}, but scroll smoothly instead of immediately.
*
* @param dx
* the number of pixels to scroll by on the X axis
* @param dy
* the number of pixels to scroll by on the Y axis
*/
public final void smoothScrollBy(int dx, int dy)
{
if (getChildCount() == 0)
{
// Nothing to do.
return;
}
long duration = AnimationUtils.currentAnimationTimeMillis() - mLastScroll;
if (duration > ANIMATED_SCROLL_GAP)
{
final int height = getHeight() - getPaddingBottom() - getPaddingTop();
final int bottom = getChildAt(0).getHeight();
final int maxY = Math.max(0, bottom - height);
final int scrollY = getScrollY();
dy = Math.max(0, Math.min(scrollY + dy, maxY)) - scrollY;
mScroller.startScroll(getScrollX(), scrollY, 0, dy);
invalidate();
} else
{
if (!mScroller.isFinished())
{
mScroller.abortAnimation();
}
scrollBy(dx, dy);
}
mLastScroll = AnimationUtils.currentAnimationTimeMillis();
}
public final void smoothScrollToTop()
{
smoothScrollTo(0, child.getPaddingTop());
}
public final void smoothScrollToBottom()
{
smoothScrollTo(0, child.getHeight() - child.getPaddingTop() - getHeight());
}
/**
* Like {@link #scrollTo}, but scroll smoothly instead of immediately.
*
* @param x
* the position where to scroll on the X axis
* @param y
* the position where to scroll on the Y axis
*/
public final void smoothScrollTo(int x, int y)
{
smoothScrollBy(x - getScrollX(), y - getScrollY());
}
/**
* <p>
* The scroll range of a scroll view is the overall height of all of its
* children.
* </p>
*/
@Override
protected int computeVerticalScrollRange()
{
final int count = getChildCount();
final int contentHeight = getHeight() - getPaddingBottom() - getPaddingTop();
if (count == 0)
{
return contentHeight;
}
return getChildAt(0).getBottom();
}
@Override
protected int computeVerticalScrollOffset()
{
return Math.max(0, super.computeVerticalScrollOffset());
}
@Override
protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec)
{
ViewGroup.LayoutParams lp = child.getLayoutParams();
int childWidthMeasureSpec;
int childHeightMeasureSpec;
childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight(), lp.width);
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
@Override
protected void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec,
int heightUsed)
{
final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
final int childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight() + lp.leftMargin
+ lp.rightMargin + widthUsed, lp.width);
final int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.topMargin + lp.bottomMargin, MeasureSpec.UNSPECIFIED);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
@Override
public void computeScroll()
{
// If android implementation has changed and we cannot obtain mScrollY -
// The default behavior will be applied by the parent.
if (hasFailedObtainingScrollFields)
{
super.computeScroll();
return;
}
if (mScroller.computeScrollOffset())
{
// This is called at drawing time by ViewGroup. We don't want to
// re-show the scrollbars at this point, which scrollTo will do,
// so we replicate most of scrollTo here.
//
// It's a little odd to call onScrollChanged from inside the
// drawing.
//
// It is, except when you remember that computeScroll() is used to
// animate scrolling. So unless we want to defer the
// onScrollChanged()
// until the end of the animated scrolling, we don't really have a
// choice here.
//
// I agree. The alternative, which I think would be worse, is to
// post
// something and tell the subclasses later. This is bad because
// there
// will be a window where getScrollX()/Y is different from what the
// app
// thinks it is.
//
int oldX = getScrollX();
int oldY = getScrollY();
int x = mScroller.getCurrX();
int y = mScroller.getCurrY();
if (getChildCount() > 0)
{
View child = getChildAt(0);
x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth());
y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight());
if (x != oldX || y != oldY)
{
SetScrollX(x);
// mScrollX = x;
SetScrollY(y);
// mScrollY = y;
onScrollChanged(x, y, oldX, oldY);
}
}
awakenScrollBars();
// Keep on drawing until the animation has finished.
postInvalidate();
}
}
/**
* Scrolls the view to the given child.
*
* @param child
* the View to scroll to
*/
private void scrollToChild(View child)
{
child.getDrawingRect(mTempRect);
/* Offset from child's local coordinates to ScrollView coordinates */
offsetDescendantRectToMyCoords(child, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
if (scrollDelta != 0)
{
scrollBy(0, scrollDelta);
}
}
/**
* If rect is off screen, scroll just enough to get it (or at least the
* first screen size chunk of it) on screen.
*
* @param rect
* The rectangle.
* @param immediate
* True to scroll immediately without animation
* @return true if scrolling was performed
*/
private boolean scrollToChildRect(Rect rect, boolean immediate)
{
final int delta = computeScrollDeltaToGetChildRectOnScreen(rect);
final boolean scroll = delta != 0;
if (scroll)
{
if (immediate)
{
scrollBy(0, delta);
} else
{
smoothScrollBy(0, delta);
}
}
return scroll;
}
/**
* Compute the amount to scroll in the Y direction in order to get a
* rectangle completely on the screen (or, if taller than the screen, at
* least the first screen size chunk of it).
*
* @param rect
* The rect.
* @return The scroll delta.
*/
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect)
{
if (getChildCount() == 0)
return 0;
int height = getHeight();
int screenTop = getScrollY();
int screenBottom = screenTop + height;
int fadingEdge = getVerticalFadingEdgeLength();
// leave room for top fading edge as long as rect isn't at very top
if (rect.top > 0)
{
screenTop += fadingEdge;
}
// leave room for bottom fading edge as long as rect isn't at very
// bottom
if (rect.bottom < getChildAt(0).getHeight())
{
screenBottom -= fadingEdge;
}
int scrollYDelta = 0;
if (rect.bottom > screenBottom && rect.top > screenTop)
{
// need to move down to get it in view: move down just enough so
// that the entire rectangle is in view (or at least the first
// screen size chunk).
if (rect.height() > height)
{
// just enough to get screen size chunk on
scrollYDelta += (rect.top - screenTop);
} else
{
// get entire rect at bottom of screen
scrollYDelta += (rect.bottom - screenBottom);
}
// make sure we aren't scrolling beyond the end of our content
int bottom = getChildAt(0).getBottom();
int distanceToBottom = bottom - screenBottom;
scrollYDelta = Math.min(scrollYDelta, distanceToBottom);
} else if (rect.top < screenTop && rect.bottom < screenBottom)
{
// need to move up to get it in view: move up just enough so that
// entire rectangle is in view (or at least the first screen
// size chunk of it).
if (rect.height() > height)
{
// screen size chunk
scrollYDelta -= (screenBottom - rect.bottom);
} else
{
// entire rect at top
scrollYDelta -= (screenTop - rect.top);
}
// make sure we aren't scrolling any further than the top our
// content
scrollYDelta = Math.max(scrollYDelta, -getScrollY());
}
return scrollYDelta;
}
@Override
public void requestChildFocus(View child, View focused)
{
if (!mScrollViewMovedFocus)
{
if (!mIsLayoutDirty)
{
scrollToChild(focused);
} else
{
// The child may not be laid out yet, we can't compute the
// scroll yet
mChildToScrollTo = focused;
}
}
super.requestChildFocus(child, focused);
}
/**
* When looking for focus in children of a scroll view, need to be a little
* more careful not to give focus to something that is scrolled off screen.
*
* This is more expensive than the default {@link ViewGroup}
* implementation, otherwise this behavior might have been made the default.
*/
@Override
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect)
{
// convert from forward / backward notation to up / down / left / right
// (ugh).
if (direction == View.FOCUS_FORWARD)
{
direction = View.FOCUS_DOWN;
} else if (direction == View.FOCUS_BACKWARD)
{
direction = View.FOCUS_UP;
}
final View nextFocus = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, null, direction) : FocusFinder
.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);
if (nextFocus == null)
{
return false;
}
if (isOffScreen(nextFocus))
{
return false;
}
return nextFocus.requestFocus(direction, previouslyFocusedRect);
}
@Override
public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate)
{
// offset into coordinate space of this scroll view
rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());
return scrollToChildRect(rectangle, immediate);
}
@Override
public void requestLayout()
{
mIsLayoutDirty = true;
super.requestLayout();
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
super.onLayout(changed, l, t, r, b);
mIsLayoutDirty = false;
// Give a child focus if it needs it
if (mChildToScrollTo != null && isViewDescendantOf(mChildToScrollTo, this))
{
scrollToChild(mChildToScrollTo);
}
mChildToScrollTo = null;
// Calling this with the present values causes it to re-clam them
scrollTo(getScrollX(), getScrollY());
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh)
{
super.onSizeChanged(w, h, oldw, oldh);
View currentFocused = findFocus();
if (null == currentFocused || this == currentFocused)
return;
// If the currently-focused view was visible on the screen when the
// screen was at the old height, then scroll the screen to make that
// view visible with the new screen height.
if (isWithinDeltaOfScreen(currentFocused, 0, oldh))
{
currentFocused.getDrawingRect(mTempRect);
offsetDescendantRectToMyCoords(currentFocused, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
doScrollY(scrollDelta);
}
}
@Override
protected void onScrollChanged(int leftOfVisibleView, int topOfVisibleView, int oldLeftOfVisibleView, int oldTopOfVisibleView)
{
int displayHeight = getHeight();
int paddingTop = child.getPaddingTop();
int contentBottom = child.getHeight() - child.getPaddingBottom();
if (isInFlingMode)
{
if (topOfVisibleView < paddingTop || topOfVisibleView > contentBottom - displayHeight)
{
if (topOfVisibleView < paddingTop)
{
mScroller.startScroll(0, topOfVisibleView, 0, paddingTop - topOfVisibleView, 1000);
} else if (topOfVisibleView > contentBottom - displayHeight)
{
mScroller.startScroll(0, topOfVisibleView, 0, contentBottom - displayHeight - topOfVisibleView, 1000);
}
// Start animation.
post(overScrollerSpringbackTask);
isInFlingMode = false;
return;
}
}
super.onScrollChanged(leftOfVisibleView, topOfVisibleView, oldLeftOfVisibleView, oldTopOfVisibleView);
}
/**
* Return true if child is an descendant of parent, (or equal to the
* parent).
*/
private boolean isViewDescendantOf(View child, View parent)
{
if (child == parent)
{
return true;
}
final ViewParent theParent = child.getParent();
return (theParent instanceof ViewGroup) && isViewDescendantOf((View) theParent, parent);
}
/**
* Fling the scroll view
*
* @param velocityY
* The initial velocity in the Y direction. Positive numbers mean
* that the finger/cursor is moving down the screen, which means
* we want to scroll towards the top.
*/
public void fling(int velocityY)
{
if (getChildCount() > 0)
{
int height = getHeight() - getPaddingBottom() - getPaddingTop();
int bottom = getChildAt(0).getHeight();
mScroller.fling(getScrollX(), getScrollY(), 0, velocityY, 0, 0, 0, Math.max(0, bottom - height));
final boolean movingDown = velocityY > 0;
View newFocused = findFocusableViewInMyBounds(movingDown, mScroller.getFinalY(), findFocus());
if (newFocused == null)
{
newFocused = this;
}
if (newFocused != findFocus() && newFocused.requestFocus(movingDown ? View.FOCUS_DOWN : View.FOCUS_UP))
{
mScrollViewMovedFocus = true;
mScrollViewMovedFocus = false;
}
invalidate();
}
}
/**
* {@inheritDoc}
*
* <p>
* This version also clamps the scrolling to the bounds of our child.
*/
@Override
public void scrollTo(int x, int y)
{
// we rely on the fact the View.scrollBy calls scrollTo.
if (getChildCount() > 0)
{
View child = getChildAt(0);
x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth());
y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight());
if (x != getScrollX() || y != getScrollY())
{
super.scrollTo(x, y);
}
}
}
private int clamp(int n, int my, int child)
{
if (my >= child || n < 0)
{
/*
* my >= child is this case: |--------------- me ---------------|
* |------ child ------| or |--------------- me ---------------|
* |------ child ------| or |--------------- me ---------------|
* |------ child ------|
*
* n < 0 is this case: |------ me ------| |-------- child --------|
* |-- getScrollX() --|
*/
return 0;
}
if ((my + n) > child)
{
/*
* this case: |------ me ------| |------ child ------| |--
* getScrollX() --|
*/
return child - my;
}
return n;
}
@Override
public boolean onTouch(View v, MotionEvent event)
{
// Stop scrolling calculation.
mScroller.forceFinished(true);
// Stop scrolling animation.
removeCallbacks(overScrollerSpringbackTask);
if (event.getAction() == MotionEvent.ACTION_UP)
{
return overScrollView();
}
else if (event.getAction() == MotionEvent.ACTION_CANCEL)
{
return overScrollView();
}
return false;
}
private boolean overScrollView()
{
// The height of scroll view, in pixels
int displayHeight = getHeight();
// The top of content view, in pixels.
int contentTop = child.getPaddingTop();
// The top of content view, in pixels.
int contentBottom = child.getHeight() - child.getPaddingBottom();
// The scrolled top position of scroll view, in pixels.
int currScrollY = getScrollY();
int scrollBy;
// Scroll to content top
if (currScrollY < contentTop)
{
onOverScroll(currScrollY);
scrollBy = contentTop - currScrollY;
} else if (currScrollY + displayHeight > contentBottom)
{
// Scroll to content top
if (child.getHeight() - child.getPaddingTop() - child.getPaddingBottom() < displayHeight)
{
scrollBy = contentTop - currScrollY;
}
// Scroll to content bottom
else
{
scrollBy = contentBottom - displayHeight - currScrollY;
// Log.d(Definitions.LOG_TAG, "scrollBy=" + scrollBy);
}
// fire onOverScroll event, and update scrollBy if a loadingView has
// been added to the scroller.
scrollBy += onOverScroll(currScrollY);
}
// scrolling between the contentTop and contentBottom
else
{
isInFlingMode = true;
return false;
}
mScroller.startScroll(0, currScrollY, 0, scrollBy, 500);
// Start animation.
post(overScrollerSpringbackTask);
prevScrollY = currScrollY;
// consume(to stop fling)
return true;
}
protected int onOverScroll(int scrollY)
{
return 0;
}
}
| [
"[email protected]"
] | |
863f269b6fc1bd7a738cea83ef9197dbb72ab766 | 727a283aea2c6c3c8c6ab33c04a860993a5089c9 | /src/main/java/com/lmg/enties/n21/both/test.java | 3f4cdaa44db61230faefee98ccbf01745a09861b | [] | no_license | as943000866/hibernate-2 | 1b863e646e7616032d08f444a0d0455a0babaa79 | e1af25386020f866c225dac362044f7d3b6e23f2 | refs/heads/master | 2020-03-31T21:09:28.835274 | 2018-10-16T10:01:20 | 2018-10-16T10:01:20 | 152,569,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,560 | java | package com.lmg.enties.n21.both;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
import org.hibernate.Hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.jdbc.Work;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.lmg.enties.New;
import com.lmg.enties.Pay;
import com.lmg.enties.Worker;
public class test {
private SessionFactory sessionFactory;
private Session session;
private Transaction transaction;
@Before
public void init(){
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder()
.applySettings(configuration.getProperties())
.buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
session = sessionFactory.openSession();
transaction = session.beginTransaction();
}
@After
public void destory(){
transaction.commit();
session.close();
sessionFactory.close();
}
@Test
public void testDelete2(){
Customer customer = (Customer) session.get(Customer.class, 2);
customer.getOrders().clear();
}
@Test
public void testDelete(){
//在不设定级联的情况下, 且 1 这一端的对象有 n 的对象在引用, 不能直接删除 1 这一端的对象
Customer customer = (Customer) session.get(Customer.class, 1);
session.delete(customer);
}
@Test
public void testUpdate2(){
Customer customer = (Customer) session.get(Customer.class, 1);
customer.getOrders().iterator().next().setOrderName("GGG");
}
@Test
public void testUpdate(){
Order order = (Order) session.get(Order.class, 1);
order.getCustomer().setCustomerName("AAA");
}
@Test
public void testOne2ManyGet(){
//1. 对 n 的一端的集合使用延迟加载
Customer customer = (Customer) session.get(Customer.class, 3);
System.out.println(customer.getCustomerName());
//2. 返回的多的一端的集合是 Hibernate 内置的集合类型
//该类型具有延迟加载和存放代理对象的功能.
System.out.println(customer.getOrders().getClass());
//session.close();
//3. 可能会抛出 LazyInitializationException 异常
System.out.println(customer.getOrders().size());
//4. 在需要使用集合中的元素的时候进行初始化.
}
@Test
public void testMany2OneGet(){
//1. 若查询多的一端的一个对象, 则默认情况下, 只查询了多的一端的对象. 而没有查询关联的
//1 的那一端的记录
Order order = (Order) session.get(Order.class, 1);
System.out.println(order.getOrderName());
System.out.println(order.getCustomer().getClass().getName());
session.close();
//2. 在需要使用到关联的对象时, 才会发送对应的 SQL 语句.
Customer customer = order.getCustomer();
System.out.println(customer.getCustomerName());
//3. 在查询 Customer 对象时, 由多的一端导航到 1 的一端时,
//若此时 session 已被关闭, 则会
//发生 LazyInitializationException 异常
//4. 获取 Order 对象时, 默认情况下, 其关联的 Customer 对象是一个代理对象!
}
@Test
public void testMany2OneSave(){
Customer customer = new Customer();
customer.setCustomerName("CC");
Order order1 = new Order();
order1.setOrderName("ORDER-5");
Order order2 = new Order();
order2.setOrderName("ORDER-6");
//设定关联关系
order1.setCustomer(customer);
order2.setCustomer(customer);
customer.getOrders().add(order1);
customer.getOrders().add(order2);
//执行 save 操作: 先插入 Customer, 再插入 Order, 3条 INSERT, 2 条 UPDATE
//因为 1 的一端和 n 的一端都维护关联关系. 所以会多出 UPDATE
//可以在 1 的一端的 set 节点指定 inverse=true, 来使 1 的一端放弃维护关联关系!
//建议设定 set 的 inverse=true, 建议先插入 1 的一端, 后插入多的一端
//好处是不会多出 UPDATE 语句
session.save(customer);
// session.save(order1);
// session.save(order2);
//先插入 Order, 再插入 Customer, 3 条 INSERT, 4 条 UPDATE
// session.save(order1);
// session.save(order2);
//
// session.save(customer);
}
}
| [
"as943000866"
] | as943000866 |
1c5ad15a9d104687492be616c5f065b293f76249 | 8d4e9768693971b5c96512cded189295d9502316 | /app/src/main/java/com/example/apporderfood/ThemLoaiThucDonActivity.java | 01e38662946c047393935691fe3e12ca7b0ef67e | [] | no_license | M26644/AppOrderFood | f2179433e091d6100d3fe7d2c6534d91a8904f96 | 25df33d2efa145dfb04ac6167d4f8bd1c02f525b | refs/heads/master | 2023-08-11T07:18:58.105079 | 2021-10-15T08:40:45 | 2021-10-15T08:40:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package com.example.apporderfood;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.apporderfood.DAO.LoaiMonAnDAO;
public class ThemLoaiThucDonActivity extends AppCompatActivity implements View.OnClickListener
{
Button btnDongYThemLoaiThucDon;
EditText edTenLoai;
LoaiMonAnDAO loaiMonAnDAO;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_themloaithucdon);
loaiMonAnDAO = new LoaiMonAnDAO(this);
btnDongYThemLoaiThucDon = (Button) findViewById(R.id.btnDongYThemLoaiThucDon);
edTenLoai = (EditText) findViewById(R.id.edThemLoaiThucDon);
btnDongYThemLoaiThucDon.setOnClickListener(this);
}
@Override
public void onClick(View v) {
String sTenLoaiThucDon = edTenLoai.getText().toString();
if(sTenLoaiThucDon != null || sTenLoaiThucDon.equals("")){
boolean kiemtra = loaiMonAnDAO.ThemLoaiMonAn(sTenLoaiThucDon);
Intent iDuLieu = new Intent();
iDuLieu.putExtra("kiemtraloaithucdon",kiemtra);
setResult(Activity.RESULT_OK,iDuLieu);
finish();
}else{
Toast.makeText(this,getResources().getString(R.string.vuilongnhapdulieu),Toast.LENGTH_SHORT).show();
}
}
}
| [
"[email protected]"
] | |
53e0557008421a395d548921b7b2555b9baea525 | 1adc22edc043702123b60680228e55d93b386d90 | /src/tests/string/OneEditAwayTest.java | b689e58224bd1e7c0e8158d1a04a7cba4454a287 | [] | no_license | astro-wolf/area51 | 50b0646697f69d614e2848806252d133b0ae6dc7 | 990ffd7252418bc7bed360c103a21cc89694a5a5 | refs/heads/master | 2023-05-04T08:03:49.272720 | 2021-05-28T02:02:19 | 2021-05-28T02:02:19 | 298,648,823 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package tests.string;
import org.junit.jupiter.api.Test;
import problems.string.OneEditAway;
import static org.junit.jupiter.api.Assertions.*;
class OneEditAwayTest {
private OneEditAway oneEditAway;
@Test
void hugelyUnequalLengths() {
oneEditAway = new OneEditAway();
assertFalse(oneEditAway.areOneAway("m", "masdfasf"));
}
@Test
void equalButDifferent() {
oneEditAway = new OneEditAway();
assertFalse(oneEditAway.areOneAway("asdf", "lkjh"));
}
@Test
void gotOneWordSame() {
oneEditAway = new OneEditAway();
assertFalse(oneEditAway.areOneAway("car", "bat"));
}
@Test
void oneAwayEqualLengths() {
oneEditAway = new OneEditAway();
assertTrue(oneEditAway.areOneAway("car", "cat"));
}
@Test
void oneAwayUnequalLengths() {
oneEditAway = new OneEditAway();
assertTrue(oneEditAway.areOneAway("pup", "pump"));
}
} | [
"[email protected]"
] | |
3467f43258b9ef2dc7a57dd4dddb94302fef04b5 | e108f887c811d995eff5e8a0606e3d94ec57c95c | /InhertitancePractice/src/com/mikesimagination/Driver.java | 62d495b435b9c1bae04f3cdcceb733660eae319d | [] | no_license | michaelgarza496/My_Personal_Repo_Practice | a177d40ea81d9321995f650c19af2c846dbf5463 | a649dfec5ab0b375a2973952c64b014796a90698 | refs/heads/master | 2021-01-19T16:21:14.230573 | 2017-10-07T21:09:11 | 2017-10-07T21:09:11 | 101,003,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,365 | java | package com.mikesimagination;
public class Driver {
{
System.out.println("Just a block in the Driver class");
}
public static void main(String[] args) {
{
System.out.println("Just a block in the main method");
}
new Driver();
/*
* Don't need to cast if it's a subtype
*
* Doesn't matter the reference. Whatever the object is, that's the method that's going to print
*/
C c = new C();
System.out.println("int a = " + c.a);
System.out.println(c);
B b = c;
System.out.println("int a = " + b.a);
System.out.println(b);
A a = c;
System.out.println("int a = " + a.a);
System.out.println(a);
b = (B) a;
System.out.println("int a = " + b.a);
System.out.println(b);
/*
* Can't cast a parent object to subclass on the second block
*/
a = b = c = null;
a = new A();
System.out.println("int a = " + a.a);
System.out.println(a);
b = (B) a;
System.out.println("int a = " + b.a);
System.out.println(b);
}
static{
System.out.println("A static block");
}
}
class A{
int a = 0;
@Override
public String toString() {
return "Inside Class A";
}
}
class B extends A{
int a = 1;
@Override
public String toString() {
return "Inside Class B";
}
}
class C extends B{
int a = 2;
@Override
public String toString() {
return "Inside Class C";
}
}
| [
"[email protected]"
] | |
a1e565ea9e864922634436c6573d1f4274d2eb9a | 87162f40b7c0a5958e2a4c4dcd04c9b79d5bd97e | /Work1/src/com/epam/javaQA/homework/Main.java | 9edf580f054201976667a06b300422ed92cd539c | [] | no_license | KhyzhniakAlex/Java-QA-winter-2019 | 98b205bfb7781c32ea549260b05a4ca835367373 | d6dc50dbc69ec8f984d38fb91386bc901ab0d2b9 | refs/heads/master | 2020-04-22T23:36:23.460734 | 2019-05-02T12:26:26 | 2019-05-02T12:26:26 | 170,746,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package com.epam.javaQA.homework;
public class Main {
public static void main(String[] args) {
WriteEPAM();
}
private static void WriteEPAM()
{
//the amount of stars is not the same, because this variant is better
System.out.println("***** ***** * * *");
System.out.println("* * * * * * * * *");
System.out.println("*** ***** * * * * *");
System.out.println("* * ******* * *");
System.out.println("***** * * * * *");
}
}
| [
"[email protected]"
] | |
8fe7662e7f33fc18103c747c90b66a7044a1afd2 | 9d376922bfa5efa214e06bd467a1e8df5c322cdd | /app/src/main/java/com/example/abbasahmednawaz/prayeralert/Activities/Events_List_Activity.java | a57f5404a4ef95382d0d97acc7e655d46c7ee815 | [] | no_license | fazalwahab/Android-Based-Prayer-Alert-System-For-District-Mansehra | 5596fc5f02010064d9524a1ac86d49504b7c05bc | 2bf3b13c8bd5c04f29b11d5806ef475bd7e4f3ed | refs/heads/master | 2020-09-23T05:20:07.592883 | 2019-12-02T17:15:07 | 2019-12-02T17:15:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | java | package com.example.abbasahmednawaz.prayeralert.Activities;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import com.example.abbasahmednawaz.prayeralert.Classes.PrefConfig;
import com.example.abbasahmednawaz.prayeralert.Classes.RecyclerAdapter;
import com.example.abbasahmednawaz.prayeralert.Classes.RecyclerAdapter_Events;
import com.example.abbasahmednawaz.prayeralert.R;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class Events_List_Activity extends AppCompatActivity {
private RecyclerView recyclerView;
private RecyclerAdapter_Events recyclerAdapter;
public PrefConfig prefConfig;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_events__list_);
//------------
prefConfig = new PrefConfig(getApplicationContext());
//----------------------------------------------------------------------------------------
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_events_list);
recyclerView.setHasFixedSize(true);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(layoutManager);
//------------------getting info array-----
showData();
//-------------
}
public void showData()
{
if( prefConfig.readEvent() != null )
{
Gson gson = new Gson();
String json = prefConfig.readEvent();
Type type = new TypeToken<ArrayList<String>>() {}.getType();
ArrayList<String> list = gson.fromJson(json, type);
recyclerAdapter = new RecyclerAdapter_Events(list);
recyclerView.setAdapter(recyclerAdapter);
}
}
}
| [
"[email protected]"
] | |
59118e3346191ae6cc76e4c60f21c163ae8fb3cf | cba28a584a274d2b43c35e94c1b9b4e19eab87e5 | /jeecg/src/main/java/org/jeecgframework/tag/core/easyui/AuthFilterTag.java | 10055533fb2c93b114b731dbe15d3a2cffc3e069 | [] | no_license | Chulf/baizhi-manager | a234c22bf4d03e242cead5045448d0ccfaf915dd | b7b4df492844531471ecf115c3b59e381152e52e | refs/heads/master | 2021-01-25T00:00:21.957535 | 2018-03-19T02:08:23 | 2018-03-19T02:08:23 | 123,286,825 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package org.jeecgframework.tag.core.easyui;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import org.jeecgframework.core.util.ApplicationContextUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
/**
*
* @Title:AuthFilterTag
* @description:列表按钮权限过滤
* @author 赵俊夫
* @date Aug 24, 2013 7:46:57 PM
* @version V1.0
*/
public class AuthFilterTag extends TagSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
/**列表容器的ID*/
protected String name;
@Autowired
private SystemService systemService;
public int doStartTag() throws JspException {
return super.doStartTag();
}
public int doEndTag() throws JspException {
JspWriter out = null;
try {
out = this.pageContext.getOut();
systemService = ApplicationContextUtil.getContext().getBean(SystemService.class);
out.print(systemService.getAuthFilterJS());
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(out!=null){
try {
out.clearBuffer();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return EVAL_PAGE;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
e3dd8e369785fb37c8e4679c8396cd9054a045f8 | b25b1776168b8498403fe074ded2e61d89e1d5b1 | /src/org/jrm/test/FileCryptoTest.java | f559803f17444000507fa9e0dd0cd2a128291275 | [] | no_license | jmallas1/encrypt | f2592c35956e2375d7ae7d152d94b4daec5c1ea8 | 09387e27123ae885ba88678ce33a423d86ff154d | refs/heads/master | 2020-03-27T22:43:28.362267 | 2018-09-04T03:45:18 | 2018-09-04T03:45:18 | 147,254,917 | 0 | 0 | null | 2018-09-04T03:45:19 | 2018-09-03T21:23:39 | Java | UTF-8 | Java | false | false | 648 | java | package org.jrm.test;
import org.jrm.crypto.FileCrypto;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class FileCryptoTest {
FileCrypto fc;
@org.junit.jupiter.api.BeforeEach
void setUp() { fc = new FileCrypto( "jrm123");}
@org.junit.jupiter.api.AfterEach
void tearDown() {
}
@Test
void decrypt()
{
assertEquals("Jared was here", fc.decrypt(fc.encrypt("Jared was here")), "Encrypt decrypt functions");
}
@Test
void encrypt()
{
assertNotEquals("Jared was here", fc.encrypt("Jared was here"), "Encrypt turns string to garbage");
}
} | [
"[email protected]"
] | |
1adf60cd39ac97d09254881bce38fa2caef5eccd | d1778d4fa86dc2d645eade6b268bdcca96ac1c4c | /plugin-controller-api/src/main/java/com/windf/plugin/controller/api/configure/WebApiConfigure.java | 719029ee226ce5b322636c5254ab7d0477f3456b | [] | no_license | windfChen/study.springcloud | 15d0946b2a4f441f4c34d2b3b9937e84295586ca | f7037343cdfffeb50b77ef8e25cc785b243423dd | refs/heads/master | 2022-12-20T12:39:15.698970 | 2020-01-19T01:19:24 | 2020-01-19T01:19:24 | 226,325,972 | 0 | 0 | null | 2022-12-10T05:53:54 | 2019-12-06T12:29:50 | Java | UTF-8 | Java | false | false | 1,226 | java | package com.windf.plugin.controller.api.configure;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.windf.core.Constant;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class WebApiConfigure {
@Bean
public HttpMessageConverters fastJsonConfigure(){
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
FastJsonConfig fastJsonConfig = new FastJsonConfig();
//处理中文乱码问题
List<MediaType> fastMediaTypes = new ArrayList<>();
fastMediaTypes.add(MediaType.APPLICATION_JSON);
converter.setSupportedMediaTypes(fastMediaTypes);
//日期格式化
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
converter.setFastJsonConfig(fastJsonConfig);
return new HttpMessageConverters(converter);
}
}
| [
"[email protected]"
] | |
1ccefbcd1cf0b98900d459502e254b5e4e61925d | 009e70fc9c458797947ab11959b1fc1e11725c3f | /app/src/main/java/com/fupengpeng/shoppingmall/entity/IntegralSequenceObject.java | 7bb1d8f36540ca09808d2bb3c38e30a376e5c58f | [] | no_license | fupengpeng/ShoppingMall | eca29dc1b584c02df5df42ecccb877b5417cb088 | 47203b1788f1db071a39aeb88c7b5295606fce27 | refs/heads/master | 2020-04-05T13:31:49.051180 | 2017-07-11T10:05:03 | 2017-07-11T10:05:03 | 94,762,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,850 | java | package com.fupengpeng.shoppingmall.entity;
import java.io.Serializable;
/**
* Created by fupengpeng on 2017/6/13 0013.
* 积分排名实体类
*/
public class IntegralSequenceObject implements Serializable{
/**
* 用户名次
*/
private String integralSequenceRanking;
/**
* 用户图像
*/
private int integralSequenceUserPic;
/**
* 用户名
*/
private String integralSequenceUsername;
/**
* 名次图像
*/
private int integralSequenceRankingPic;
/**
* 用户积分
*/
private String integralSequenceIntegral;
public String getIntegralSequenceRanking() {
return integralSequenceRanking;
}
public void setIntegralSequenceRanking(String integralSequenceRanking) {
this.integralSequenceRanking = integralSequenceRanking;
}
public int getIntegralSequenceUserPic() {
return integralSequenceUserPic;
}
public void setIntegralSequenceUserPic(int integralSequenceUserPic) {
this.integralSequenceUserPic = integralSequenceUserPic;
}
public String getIntegralSequenceUsername() {
return integralSequenceUsername;
}
public void setIntegralSequenceUsername(String integralSequenceUsername) {
this.integralSequenceUsername = integralSequenceUsername;
}
public int getIntegralSequenceRankingPic() {
return integralSequenceRankingPic;
}
public void setIntegralSequenceRankingPic(int integralSequenceRankingPic) {
this.integralSequenceRankingPic = integralSequenceRankingPic;
}
public String getIntegralSequenceIntegral() {
return integralSequenceIntegral;
}
public void setIntegralSequenceIntegral(String integralSequenceIntegral) {
this.integralSequenceIntegral = integralSequenceIntegral;
}
}
| [
"[email protected]"
] | |
e72c90c4ee2cd4426b8077e6a8ee97be2bd8e46c | 93a4d1b3befb832db6377bb559510ba9b6f226e9 | /Practice/696/Main.java | 5470e2133a1c3a8289e6b0bdf2ae78fbbe8c4de9 | [] | no_license | rjjfdn/Comprog-Stuffs | 7176c6ac01a777d6d753268bbee6189d6eaa56e2 | 4aabb183f66976ff14aa4d84df0f85c0540c0caa | refs/heads/master | 2021-01-06T20:41:01.399552 | 2014-06-11T10:20:02 | 2014-06-11T10:20:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while(true) {
int tmp = s.nextInt();
int tmp2 = s.nextInt();
if(tmp == 0 && tmp2 == 0)
break;
int x = Math.min(tmp, tmp2);
int y = Math.max(tmp, tmp2);
int ans = 0;
if(x == 1)
ans = y;
else if(x == 2) {
ans += y/4*4;
if(y%4 == 1)
ans += 2;
else if(y%4 != 0)
ans += 4;
}
else {
if(x%2 == 1 && y%2 == 1)
ans = x*y/2 + 1;
else
ans = x*y/2;
}
System.out.println(ans + " knights may be placed on a " + tmp + " row " + tmp2 + " column board.");
}
}
}
| [
"[email protected]"
] | |
f67b97ebe39a379eae10d5cd3032b8ec685a8af2 | dda3b5d166d7a057fc586cc200f5ffffd418400f | /src/main/java/com/reed/rmi/base/HessianConnectionFactoryByTimeout.java | 074345752dcd59292c892eb498aa8c79b7011e4a | [] | no_license | reedF/rmi-demo | 0532b2494a33228c3c20cdf771b4970a41908e78 | 00be506278e92ca7fd08f64c24893d628b5cae95 | refs/heads/master | 2021-05-16T02:53:37.927434 | 2018-10-19T08:28:33 | 2018-10-19T08:28:33 | 18,282,499 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 761 | java | package com.reed.rmi.base;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.FactoryBean;
/**
* 继承HessianProxyFactoryBean,扩展对connection timeout的配置
*
* @author reed
*
*/
public class HessianConnectionFactoryByTimeout extends HessianClientInterceptorByTimeout implements FactoryBean<Object> {
private Object serviceProxy;
@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();
this.serviceProxy = new ProxyFactory(getServiceInterface(), this).getProxy(getBeanClassLoader());
}
public Object getObject() {
return this.serviceProxy;
}
public Class<?> getObjectType() {
return getServiceInterface();
}
public boolean isSingleton() {
return true;
}
}
| [
"[email protected]"
] | |
7bf65af5bd7f41f2c964432c2f3cf0ec246c13da | 38f8944b4a80f38d158a075d4c1e96b09345763b | /version-1/src/com/hive/Mode/HiveSearch.java | 4d2dcd11d8ac8f5f3f3f97102ff6d54bc2b3df59 | [] | no_license | Glacier759/MyHive | bf2982d2da0a80d9d7e42a0d86985e7bc6c6c91f | 13272ad5f5c546524b424ac18ab7c5dc3ddf8bb4 | refs/heads/master | 2021-01-20T09:01:06.085528 | 2014-08-02T09:49:07 | 2014-08-02T09:49:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,532 | java | package com.hive.Mode;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.Iterator;
import java.util.Set;
import org.jsoup.HttpStatusException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.hive.Parameter.HiveParameter;
import com.hive.Save.HiveSaveData;
import com.hive.SearchEngine.ThreeSixZeroSpider;
public class HiveSearch {
private HiveParameter hiveParameter = null;
public HiveSearch( HiveParameter hiveParameter ) {
this.hiveParameter = hiveParameter;
}
public void doSaveData() {
try {
//添加搜索引擎
ThreeSixZeroSpider Spider360 = new ThreeSixZeroSpider( hiveParameter );
Set<String> UrlSet = Spider360.doParse360();
System.out.println(UrlSet.size());
Iterator<String> itr = UrlSet.iterator();
int NO = UrlSet.size();
while( itr.hasNext() ) {
String purl = itr.next();
System.out.println("剩余:"+NO+"\t"+purl);
String Hostname = new URL(purl).getHost();
NO--;
Document Doc = null;
try {
Doc = Jsoup.connect(purl).timeout(5000)
.userAgent("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36")
.get();
} catch( SocketTimeoutException e ) {
System.out.println("HiveSearch-doSaveData-42:\t" + e);
continue;
} catch( HttpStatusException e ) {
System.out.println("HiveSearch-doSaveData-45:\t" + e);
continue;
} catch( Exception e ) {
System.out.println(e);
}
//hiveParameter.hiveDatabase.insertUrl(purl);
new HiveSaveData(hiveParameter).doSaveToDB(Doc.title(), purl, Doc.select("p").text(), hiveParameter.config.getSavePath()+hiveParameter.Ttag, true);
Elements pageAllUrls = Doc.select("a[href]");
for ( Element pageAllUrl : pageAllUrls ) {
String pageUrl = pageAllUrl.attr("abs:href");
if ( pageUrl.isEmpty() )
continue;
String hostname = new URL(pageUrl).getHost();
//if ( (hostname.equals(Hostname) && !(hiveParameter.hiveDatabase.isUniqueURL(pageUrl))) ) {
if ( (hostname.equals(Hostname)) && !(hiveParameter.hiveBloomFilter.isUniqueValue(pageUrl)) ) {
//System.out.println("push redis" + hiveParameter.hiveRedis.getKey());
hiveParameter.hiveRedis.pushValue(pageUrl);
//hiveParameter.hiveDatabase.insertUrl(pageUrl); //抓取后再加入数据库才对
}
}
}
} catch( Exception e ) {
System.out.println(e);
}
}
}
| [
"[email protected]"
] | |
b08695a3e97a25dcee5d8fa7ae9beb01057cacc0 | 7eb746c88662e75a19f66f363aadd5d5237242af | /app/src/main/java/org/newstand/datamigration/data/model/FileBasedRecord.java | 7ffff6041730642965a90a8200d045a2acc28cd1 | [] | no_license | Tornaco/DataMigration | f03824288e995fa2088d325afa76849a839591b4 | 7304d95a5feb2068d4f26585f5a8c50e087fcefa | refs/heads/master | 2022-10-18T15:49:45.564065 | 2022-10-08T07:29:31 | 2022-10-08T07:29:31 | 84,621,616 | 19 | 5 | null | 2017-07-14T03:59:40 | 2017-03-11T03:42:24 | Java | UTF-8 | Java | false | false | 807 | java | package org.newstand.datamigration.data.model;
import com.google.common.io.Files;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* Created by [email protected] on 2017/3/7 13:24
* E-Mail: [email protected]
* All right reserved.
*/
@Getter
@Setter
@NoArgsConstructor
@ToString(callSuper = true)
public class FileBasedRecord extends DataRecord {
private long size;
private String path;
public long calculateSize() throws IOException {
if (path == null || !new File(path).exists()) throw new FileNotFoundException(path);
return size == 0 ? Files.asByteSource(new File(path)).size() : size;
}
}
| [
"[email protected]"
] | |
99a8577e535b89d7c6c652a152b6ee9f1e882619 | 4f7a7eeb7f9cde5c42a17896e9d436fbf2f7e63f | /Labs OOP/Car (1).java | be925840af5b08191d4b72d3bba13e3422537ee3 | [] | no_license | usman969/OOP | d00f54070e6f72272a26d6995e51ac25476054bf | 6fd8d98cd9b6483149c4bf9517798309f32318ee | refs/heads/main | 2023-06-09T03:59:55.917406 | 2021-06-28T18:35:15 | 2021-06-28T18:35:15 | 345,523,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java |
package l2assign1.L2ASSIGN1;
public class Car {
String name;
String color;
int model;
int mspeed;
public void display() {
System.out.println( " Name:\n " + name );
System.out.println( " color: " + color );
System.out.println( " Model " + model );
System.out.println( " Maximum speed is: \t " + mspeed );
}
}
| [
"[email protected]"
] | |
462e453749d2bc1f565991b41c666e2d847c851a | 51934a954934c21cae6a8482a6f5e6c3b3bd5c5a | /output/23d95e1bc4ea422d9c549c279a989112.java | 4e5ad843f78629ef5f65376da02d4f06ad156294 | [
"MIT",
"Apache-2.0"
] | permissive | comprakt/comprakt-fuzz-tests | e8c954d94b4f4615c856fd3108010011610a5f73 | c0082d105d7c54ad31ab4ea461c3b8319358eaaa | refs/heads/master | 2021-09-25T15:29:58.589346 | 2018-10-23T17:33:46 | 2018-10-23T17:33:46 | 154,370,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,177 | java | class qX6FEjSJg {
}
class WU {
public void[] o7DI6fQJyHLhaF (qocx4o5IEl QqbII7i, int iSwgAv, oByI lctNeRfw5P, boolean SJaOO, int RI6y0hqVh, int ouVjvthscXgohw) throws QgVlVgByUA9 {
kLgNlRRL[][] A_0AkKR9xFkOtE;
boolean[] PIIgL = !!new sDiHMV6GEb7o2L().i();
boolean ii5;
void[][] IPa5SZFHNrc;
int[] bUZ = ( this.cJtI()).wqOq();
while ( ( 64169746.MNaD_NG())[ !TXTw3RlMI0Yx.aKM()]) ;
void mSKX49E4svGhD = --this[ !null[ false.g()]];
}
public static void aN (String[] zBBe) throws X {
boolean S9OXF0l;
}
public static void W9LX (String[] E11L8FX8O) {
{
int rGP;
x6f1He[][] NAAMC7a;
return;
int VokTFCluedHQ;
}
;
;
!!35751.O3EB3owETiKx();
;
if ( !!new void[ -469.n8h62QA][ --( 23573.wIsO3FUjQR).CWaD()]) if ( -this[ -false.jjdYh]) return;
;
{
return;
void[] Ilk0rLVbJSw87;
boolean KP12JJOk;
void[][] mkv_aZVnPc;
while ( new br_G()[ !!---!null[ -!!B2kfwzuiBVNq_().b4BxAsIaYJ]]) if ( JmmffgvqPTlCO.NrbGBgjjhImf4G) ;
{
!-( -043.CxT4EF).jhSwhy();
}
boolean[] ztulb5FaO5v;
while ( new M().faII49uDaaq()) if ( false[ --!!this[ !!!true.mqixum9Pvt]]) !true.yxlTOV9;
iw[] u0P2kfqN;
void[] q4aobZWQX96gDm;
}
if ( false.b3) false[ Bv1NH.KC()];else {
return;
}
void tza54zz8Jv = !--new h().VNiypi4XyblT;
if ( !this.qENmIptv) return;else -WHdWsG71sF[ null[ this.rWRl0gvM()]];
void RQMoR7egCpkl;
int[][][][][] VvAYVWedfM5 = -!-!this.pUkd9 = -!!LS9STRDKB.x8L_0;
boolean kWbsLeINRtn;
;
int R2a;
void[] xyDWnZ9NaAIn = ( !!new void[ !( !---( new BF39VoTLDyr().J9auEO())[ new lL()[ false.AAfQSIwlkTVVe]]).CW2hI91Ck1RK()][ X9oE2()[ !false[ -kRxERs().n7bx_Qp6m()]]])[ -( new void[ this[ ez5()[ !XnlZrbYXnCs()[ false[ n01ddOzVdZTTC().JAkru]]]]].GHXW)[ -!true[ !-9.mj4L0gJ5WQ()]]] = this[ new boolean[ this.lZGF9KTx2][ !03.aa5mkKWEUmJ_9()]];
b95L3[] ktRpjTCJEJ;
if ( !!!zR9o().yBjeFy()) return;
}
public boolean[][][] vu () {
void[][][][][][][] K1tA;
int[] OEKmlk7RUcAY = -this[ -this.j8];
void r6zR = null.CpdGdUnwTN() = new boolean[ !new e5_g0SamD[ this.vFWSvZk5][ this[ !!!this.ma]]].MZHtRaJ3;
;
boolean[][][] UmD7pc7;
---this.u55qh0();
boolean Wfk1mRsY = ------!false[ -!OPTi7SK4vq[ -!false[ true.ZOJMvxamDG6l()]]] = 743808.SJq();
PwSVyjMGn rtQMGg9Twxa0;
int[][][] TRX8vaP = rB2Ac2GIg()[ !null.g] = !-new pyFfz().HpZphNYf7oAJ();
int[][] OEUPv = true[ new boolean[ !wMkYmcGP().iT41HIQAFDxF()][ -new pPEDcXnXsQ0C1F().tvJ()]] = 23024606.Ye1qRNgM7_;
boolean[][][] PswB5w6 = -hRTuzmkZZ().po() = new boolean[ ( null[ --false[ LSHxX17avG8fiP()[ !IOd.ueXMVYcb()]]]).q9iBFpwF].ahSl1();
int LQT;
;
void[] PA2MPGCMFW;
boolean KlEQt0ghBjJAqG;
tKoq p = !-new wbrMV8uenCDN[ -!null.i0Z4b9w8()].YI;
}
public int gw () {
boolean[] ORSS5u = !--!!!-!-!new boQ8DWJv7rxLaZ().wi7DDzw2t;
if ( ---!!-this[ -( !nBRfh().N5lt).cfobLgl()]) ;else if ( this[ null.ivMac]) oG2.KmJ8;
{
return;
boolean[][][] pZbCcAoAooiJ;
new void[ ---37271[ --this[ !this.GBcOJqATORX5LM]]].iM;
( new XTJ[ -!--4580.fs].Es18mq)[ -false[ ( --!-!this[ !true.iIFGHiCBe()]).c3nwasaqP()]];
return;
-null.E3k3crL4Q0d;
void cU;
void[][] LT5dVA1XROh6;
{
{
int _w0D68y;
}
}
boolean w95A;
int NR;
return;
;
}
while ( !!!!new Lkm().dX9UKVwUvRVc6t()) if ( -77950312.EvocEjFd4()) if ( !---!( -952373317.c)[ !-true.tbrpV3fSsoH()]) if ( true.QoIKRL) {
while ( !XdFiMJY_9eN[ !-994[ !!---ajRy().N23M()]]) {
void tGLAoJU9;
}
}
int[][][][][][] CDGLKYK4A3 = --TUj7l7O3AaBO.jyxKR7E = new void[ --!null.Os10_QiR].AfTX5p();
!!null[ false[ 2.tBH]];
;
if ( new dkfb_().W()) while ( 881778362.JhJQq9jrWce) !!-null[ --!-!this[ !!true.OAAI9()]];else if ( -WtUI3x2bLa().Y()) return;
;
int aKoQic;
v8p3[] DzOznumZslQij = true.vQDh6gaNU() = false.l();
if ( !Nh()[ ( new int[ !Qpv9t0ItNV0m5.q0c60aGgBw()].ESWpwGQ6ZlXl).EbxaugUVna]) ;else ;
return;
boolean[] UsqHmSeya0SerZ = ( -!null[ -!null[ !WiH9fciU_zqvB().vNNv8izn_NM]]).G6DH();
ulX_NciXLEHzaM[] rz;
int[][][][][][][] ANIMmj;
;
}
public static void OihGh (String[] gc6TKUplU3C) throws n4HtQs {
while ( -!-!new void[ WCne7_kRWtzZv()[ Rl1z_hdHjLo[ new boolean[ !!!( dm()[ new XdiT().H3i2Y1k2()]).qUpKTI].kMQ]]].rwEDu7()) {
int[] QA4OPAqt;
}
hc9ZG[] idgKw2C5Fits;
boolean[] Vx07Kx;
while ( new boolean[ new _jmQ3uy6()[ Cdp4wxPc[ !!!APV9jodIl_F.PFUHdV5l55D()]]][ this.FLUOIxdTVKB]) return;
boolean akme = -( -( !--new ai8rBChn().EA)[ ToSDmXa().UdqAJ])[ !new D()[ new jq8WN5vJtCuVBq()[ new RlgIU_o4N3vQ().tSRqyfqk5fMZLk()]]];
nrUq4[][] R4g4380jZW;
}
public void[] DlAMxGl (void _zB_E2oy, boolean[] H4Zuax, void[] O64lb_, boolean[] ezMmCt9, void UBQhlmMwI, zG2Ja3QtW KucZZBs8IJ) throws a8Kl_8rXZWu {
9500.g7U_dAM1XvLvW();
return;
{
int QzJ36IbvbhpvI;
void[][][] Uq6txa;
-false.NClbAfGgMq6;
int[][][] gCfn35TxxeJEA;
void[] y3U9;
return;
int[] p4rofo;
int[] KfW7cwDg5C5XY;
boolean[][][][][][] IU9sXQ;
int uts2SiVUExnaT;
}
void[][] DZdwsKu60 = !!-false.zMQ4Qu = ( ( 40481255._P()).sa_Bqc7).idE();
return true.W4x;
027506[ --new JEiGX7sh()[ null.TMKRRpLX]];
Sh1K().a;
;
if ( 947397[ 5.owmzcan()]) !this[ !!!-new VCYwPrFz[ null.WLNukGSG()][ 853685109.KWFC49vKITF8L0]];else if ( 092778.ipnOL) if ( true.ESbqzhJmhr) dzpH1V2.lJxGZFfAyrK();
boolean to;
uLoveA0[] OSYocs7r6HmqM;
boolean[] QM8iLcJGy9NKd = -oJjPh4gYa14ncz.nDzCuC8();
int[][] AQ3i9 = dkItZkvZ01yJ[ ----ifk0VhbU[ --47376013[ true[ !this[ ( true.LgmbreQx()).TvrzD]]]]];
while ( this.lbW) {
while ( new kAdyDmhS8Ui().VP__rOd0D()) while ( ( !this.tEXjNIpCz()).aQkgo()) if ( --!Q5ckv.RdKwlSNpk9n) while ( KrKkTlAwS1cmm8.wffk5I1r) {
return;
}
}
wcSYs_HH_[] k = new Q6fstYekeC53wu()[ -null[ !this[ -!new void[ --!this.DlHRKi].Nl]]];
t8 Fpr22WdJ = ( true.QlNtI6mkAp)[ !--false[ !this.B()]] = new SpauRildoXz().ZeRimGuwWkMY();
_3DMwwd2[] wsgclsR4wgH_6 = new wfFpy6TPGbe().lMkK() = -new vkDpfnx8().qnJaAuxjCCKqb();
tqwtLY[][] RtAw;
}
public static void q34ehpLQu (String[] KXE7k3Az) throws tzVG5 {
{
boolean[][] OPs3A0uHujZn;
;
while ( !null.BuB) return;
;
boolean[][] ibMc;
{
void[][] Shze;
}
while ( new QUIxp3s()[ wPQqmoQ_egbG.N9HWSYx0Ma_Xf]) !!!!!true._AUhtAKV();
}
return;
void wk8TSQIBwiaqu = this[ -this.RhM6()];
return 3.dRkcQd;
{
void[] FRpkSAM6;
}
if ( -true.gK) while ( !--null[ ( -!this.KCaR9j())[ -new XqEfrwmtSd().TlLtF4UHb()]]) {
boolean lje1;
}else ;
boolean lQnam;
fVA djK1SB4zcKEZ1;
;
void IHzdxU3bkZS;
}
public Tti6fIKKWd5[] Y1Wj_s2h_ () {
while ( YyExSdZ()[ ( Shyn().BNXSZ9t4U7w())[ !r.fTgZsjN0JJ()]]) {
----true[ !qEb[ -!null.AE]];
}
01985.GQIvHhZ();
{
while ( new cSUh_MJaopK().X5KcY()) return;
void YRpwPnAPTV;
{
boolean U9tFrgR;
}
;
boolean[][] m1A_aavhMfPaIp;
;
;
;
return;
Sf7 vyg5d;
int[][] z;
boolean Cl1nosGUmQ;
while ( false.fcEwI4NRz7TqVL()) if ( !!( ( true.pDK_ei7G26J).DB7lkHvtUr()).M7P5b()) if ( -!-!!!--!yXk[ new lkHXSx0Z2OrE()[ zwR7yC9gIcVt.T_]]) {
while ( new H1gGaqiJ227f().adpI4yy81gV()) ;
}
boolean[][] L14RQepKg;
vxHMYlGxtqteer eUxBE1kARnH;
new CVOxSIU6JX1().zsPkdkqIc6u6OM;
qsU y1IjOOMzRrDK;
if ( -true[ !true.nwm()]) ;
return;
}
;
int Rpa2qwJe = !new hGMM9Leh().naWP3dYBEE();
void[][][][][] R7YF0IIv = yzAb()[ null.fsrnU7MN5Ip()] = !null[ Ri4PVvB7H().dNZg];
Task79Jdb63j jx9er;
boolean[] NMmJyF5LkQ = EOjflcmp[ 204346419.PQxb()];
int nfQ;
return -new Owg6LFJ()[ -( G.ZBO2CnU3).N6];
return;
int[][] JqxD8jXzBSA = lWC7.q();
return !this.q4GBrv();
boolean[][][] z;
void[] aedu5hjc9ois = ( !-true.MjYKvcw1Rz0DqG).Oh;
false[ -!55155618[ ( new void[ null.tr2EAp()].Y49dT)[ true.cWUi()]]];
{
void[][] AsBluSxU;
if ( 34309.nHA()) ;
}
;
if ( ---Dnywdqu7nj7().ZkOFgKA()) while ( new OxyV().YrrdYZQJtWC) if ( kkF()[ false.nT1UT2()]) if ( BzDf4ID()[ !( !-!-qJCFIgTZfES().zVaHVJ_h7bH2k).LAhrtY4z]) ;else return;
}
public static void DqZvUQU7vd (String[] IxscM7jzUXNB) {
boolean j = -( new fSramn().sn34aQ())[ WrgDrGtH()[ -new UKqOzqi()[ null.Cez]]] = -15.ILznVW_z();
if ( --QEYQARXbOeeg().N76isNDsndoRRd()) !-new NX0mE()[ ( -( true.AQjjrOP).hRIB1r()).hGU2z()];else !!!null.btigrIZjDGB();
;
int v;
;
if ( ( -new LMWgnlCKtP()[ new Qoms4GuN()[ qaiUXRGYaMt().hCF()]]).inOAcRP3_6uXj()) !-!AkPckr4s()[ -this.KlgmmT];
int gAcNz = true[ !new s_()[ false.POwrb4]];
drKWADd3TeT[] hJDGdCy = false.uyOVT_876DXF;
}
public int[] R_al7lCg1rcOe () {
void u = d_TALWMx().pDVRZVKd();
void[][] VpmfwDJ1v = -new int[ new Al().iHA3K7q8s1_Uei()].Gqh01i76DI6KI8() = new void[ !ANJyBuPt.nD7r].ixRYFFCiSsDgBB;
return;
{
return;
boolean XN3Jml_x7;
return;
}
;
void[][] aLVC;
while ( rdT6nIm3[ new iBII_lUDTTzL().wSxdc5h()]) if ( new boolean[ true.Fskn()].idF6DMUldnC()) new int[ true.y_IhuyR()].eK;
int[][][] VgBXAIQ2v = -( ( new RQivnN2sKkndq()._QzyQnQw81v()).Hg8lOxFcQ()).ao();
void[] dut4ecixyL;
;
boolean[][][] D;
int X;
if ( new HCRZQnSN5R1()[ this[ -!new vYmbY5uiht56xY[ !( false.P())[ true[ !-!null.cjYBNvjqZ57Z0Z()]]].VJJU()]]) ;else return;
qg85DOKXjhq64 A = -!!new dC21eMlpdRzs().R8();
int QUFfWxWOVgX;
if ( -!new boolean[ new bN8().BAikRfYEfP1()].FyBe7iFo3tb8()) ;else -false.NJP9dR3;
}
public boolean vH8mPEKlwgH8 (void xBKazUbu, Sf4A4HK QOt, int[][] u3Zen9b07qce, boolean g20) throws moAzalR {
void Kv6oNskzsQQTTf;
;
oRONQAXg kJ7 = 82.lI_UfF99tUxY();
boolean[] bWeu9UieI4Wvcd = -new uBvISl1nSyQ81A()[ !!true.YnE35m4YWYrth()];
void[] fjw2x7jyafRb4J;
while ( !false[ null.qhMvqmne2()]) return;
new wsNzzjUHSu().hzZMMFWK;
return ---!-!!--( -!!false[ ( !582391.FvWQewVfDF()).I_]).E0Lc6jR5MCfhQ1();
return false.PVS06N4xYlbrLE;
return;
;
int[] RR = !-true.c = -!false.CKkXzH();
sPsvRof5[][][] TQYb;
boolean Uo;
boolean SVXfyLO;
H4XE4F[][][] uYOFIGH14zdI;
int yNQLIvB5dDH = new boolean[ -new wt().JUWKnH8b8Xt()].yz3FF();
return -false.zxG2sAnZw();
boolean H34Xk26;
}
public void wSlaD0n4pZSI3e () {
boolean kdOo = !!!new void[ !-!PkEbjWdfd.MDLFTL3].wZua = ( -new d2TYrA8b930go().a5fR97y1d).yMyF05le;
;
}
public boolean[][][][] qpxSWA08PwED5;
}
class tp8kDxPl {
public boolean VTyFk () {
!Px5CR.wp;
int ZP = fXWX54gCbpsf.Hm;
if ( new r8Osx3()[ Ok().sS5bvjebea9XN()]) while ( !-!!-( 7134[ new void[ -!!true.cgYu8yhq9I()].EKryq1O])._aNHhbs9ybM2bA) if ( this.Ql8g8Np8Kvb()) while ( DFDALy3C().qkpXVU_N5w) while ( LVJpGG1gkVS().grEAI6tI7GGoRW) while ( !true.h_s()) return;else return;
int x9 = true.gdxlcBnrwhM_pm = !new whFobuIkgNX()[ Q3ZJyQukkf3.aG()];
int jWlyQnD = null.PDt();
{
{
return;
}
if ( !new t5j[ !-this[ --null.ie2NtdtiM()]].btSEbSVwhluDcQ) ;
void[] RvIN_dm9np;
boolean[][][] T6_;
return;
!!true.BJ;
void IZsO6IC;
void[] tZ5PkefamP;
int[] HAx8sf;
int[][][][] lWF;
while ( --new int[ 9.fnZ].RKMVv()) !true.JlUx2oSe8R5_0();
}
{
void[] Fd4Dfm;
void MX0SpJCxJ3D9;
vntswRrPEVd6g zWM3Lml9HsV;
boolean[][] u;
if ( ( new jyztWo1o9d[ !this.D7Nd()].EdUB2D()).goKs7Bk31h6ZB) {
void xxY4O3yIp6N;
}
boolean[][] LbXGygh;
boolean[] Aas09;
}
while ( -null[ !false[ ( -new lMQqjCPH().u0FRERd1())[ yoJGqU8e482rP[ --false.LIeNfAb]]]]) return;
rFOhT_erdGx3 TCdld_2;
CRv3[][][][][][] WhTBM8pBBnf;
{
void uqV9HZl_;
!null.uuLS00;
boolean EkUFiW;
new boolean[ !true.iaIYZbBPhaggp7()].Eru7bBIzxf;
if ( -new t6y[ new void[ new eVhmIIPSwag().o][ !( null.u9ZayXqxQ).dzvUt1vaR2()]].f1()) ;
}
void[][] YkeM1bgQR = !--!true.TcPvx4kBiD7();
int B41g8U;
}
public boolean[] jU (pGwwHsYKmVKI[] TTGVchZTcHQp, int DXBVJYmLRoLEe0) {
{
int Lf;
L0F3cneLtofj[] cYj9LVp3rha80q;
void[] eih94lcIeSGW;
int PtsSkCT5M;
return;
{
int RVvMj;
}
boolean[] NtlLCZ;
Dn.JA5VY;
while ( LJ294zC3N().TGAc6jkzBWN()) return;
boolean[][][][] hN3vgbHDuV3;
new cU7().RgcoyTZjEX;
jBG yZ;
}
;
{
int[][] lZEXX68zH8zn85;
( true.WRm5J32).fs_0vng_I;
return;
int GkJ32gSIyVVmx;
FRlDLYwYROKGa[][][] yBjOT4DH5exA49;
boolean[][] y93SN4Ggu;
wBmRpjU IiMakL;
}
{
while ( -yQoT7()[ 995837824[ ---new H().FZR2LJeaLHA]]) while ( !true.L()) if ( !DMm_OOmB().grtC5) return;
if ( -xs2iGf5naGAO().NO_qt) return;
}
Q[][][] hKKArRZ;
iGyY1NWnSNMR PsU = umqxmjHOfJL[ Mgbbe()[ 6.lxPKAYRRZflE()]];
;
if ( -!new Q3IQ0h[ !null.Psum()].cFee) {
return;
}else while ( true[ b()[ -51[ -true[ !-!866621.htS()]]]]) while ( false[ new U32a3v().It5u()]) return;
return new HwEF1BKvcN2tI7[ !-true.MfpJ()][ !new YKgsXJgnZ().mVAG0UHGAriJ()];
void[][][][][][] OigT = ( -!-!ozosu()[ !( --!new ScoQCOuN[ -new IlONe()[ false[ SCxK2IQG()[ true.V3j5s9u9iV]]]].u).e8o()])[ -!!stP().ENwUu()];
void _LQ;
wZ CnK = -new boolean[ 3511392[ 420143405.Nek]][ new void[ !new Iq().A9JXsr66].T5FKeNm] = !-new hNvw6hX0hu()[ vKkei_XafRz.E()];
boolean V = this.egq6egF97OWxwS = !32056.LJVo339T32XV();
new int[ !this.IcIH9].VcU9JQDJldk;
}
public static void EhlEc1O75mN (String[] U) throws x {
int n2U = !5[ !( ( 18.mI_kUcx2TX()).AVLY5ubzxY())[ -null.rnwmOxmrhI9()]] = -u1.ARSLsrAk();
boolean[] zCngHPrH = -!new boolean[ -true.RW()][ null.ogoYC0l];
;
{
fsyR9i6YUR[] g5crRGQ0;
boolean[][] H_3v2AX9C7aBc;
return;
return;
;
!!rEOtE.w;
}
return;
if ( !new nRKG2MZQl()[ -false.A1qWBF()]) while ( ( ( wzikrbC.mYzQWdVPI11TB7()).I0YY7_7DyVgzr).vY()) ;else {
return;
}
if ( -null.Ag1YYRRUb7L) {
;
}
BDOsaUC[] a_AMoP;
if ( this.HLVs1JfTknsi) ;
while ( 41175106.VYGmvOYv5M()) return;
void[] sO11mzIya = null.x0wUYInLp97() = new int[ !!null[ --( -false.ruWgbRzWrKkFGs()).sBoSTuG]].R4vfUcyQzqOaoR();
boolean[] AL_sh;
hW GrA = this.chjMeJ79uM0;
;
}
public int VMLbE (VVtNrP6zCI _0D, void GwMS4, rbp4NPnkG lTGHH2RxxxvyT, _Cnvv4AGKkfc7 WPlEnguAY9P, void AfS8, boolean[] FUdp5lr4cie) {
int TasDCmIPul = !( true[ this[ new _fZlMuiZvkKQV().a()]]).lep3Q() = this.hrY;
Ro9[] faPU;
-!-( ( !this.yNw0ZwV_54vUR).Q3x()).ZoPQ();
void VWDnTA7X8jS;
;
new Zn()[ this.Kta];
;
OqQjx08ilR7 Uq46ClTk = null.oI2oJLJmFh = !90589338.hnbfYR;
int[] IDAcmyNFp;
boolean NYS0rw = !!-!545600.c3TlCMM_Lodlpx();
if ( BD5nCfEdq().xg7dRJ3fZ3Lv) while ( this.w) ;
!null[ -true[ -new void[ !APsXa8DIH()[ !!!new W6p9gZn6VcxF[ !!new boolean[ -!!-true.EYLdNjW].bxO()]._()]].UTtGYHA()]];
void[] EvqE0wRcL;
;
;
if ( this.PE9S5()) {
return;
}else return;
void vfbOpOdBofqNLe;
;
;
}
public int[][] Dkj5FmxDVfck;
}
class Qb {
public static void nvtwn3_Q5aoO (String[] VghEGpBf9E) throws Lph6Ks {
b5UX_ f8BFq = Fdl()[ new Aa4Hv().xaFeW2Hhrz] = !YYiwAi__6.gdI_mBAQbT;
nc1FqhdMw c = jZJNVlaqWfV().Js;
return --new void[ LlNgFKGV3xHgNv()[ -true.uaWV]][ !bUd().zbfZJs7wwJtB6];
;
}
public int[] Sf2n2Jo5d () throws Ffg {
void bSgqPZk;
void HRy0;
if ( -627612.Hp2()) return;else {
;
}
while ( bYY9ezM4GJk().GiN) {
boolean[] wwgZHcX_2BwA;
}
return;
return -this.JQ8j2();
int Ve3iSbg8Nc4cu7 = false.V;
RKU42gVsMj[][] t3 = --this.m5773OPkjsiKk() = !-!( ( null.kum7zRrVEZ7YR()).U5E02qt).XjaKr8BKM4Jg56;
boolean J1;
}
public static void r (String[] Td8bop8OVRM) throws Wrsmz {
void[][][] o6_B = null._2uCPEDyJuECEr;
void j = n()[ --this.az8()];
int[] _eb_m0QVi6 = -!!( 684250176[ -!-qN_Wl5CvBsWjJ().L()]).nUxU();
;
int XSdEf8;
r8bRXNwphknZ_r[][][] zw4P98sJ4FWtV = !-true.I8JgYfRSm8AFJ();
}
public static void HYRVB4fqY4L6Fp (String[] PlYsF) {
{
boolean[][][] sBVr;
}
void[][][] vxPR6;
NdAdgcoobH tzLVKy625 = this[ !true.K5dw3bGs7()] = new r_VPp2f0().VP409H8uMxVAx();
return !!!!new int[ --( null.E1emckw1()).BaxUbTy].a2Vie3Y4W;
boolean[][][][][][][][][] IKXdC35NSUIwVx;
return;
x4NC KPZQvr = -!-true[ false._PjDuX()] = true.mf3V5gCGAXM1;
if ( --!pZ35[ fOdGGk1Qor.BGwp()]) if ( !zwxGg36Un.AYrpaZ()) {
int[] Mmcti;
}
{
{
JT_7W34[][] wBgkqW;
}
i jb;
-new TOpCjTP1rQWY62()[ -new int[ ( true[ ---!new void[ !false.j2N()].Ss]).Si()].IOE()];
;
{
{
if ( -this.Oeji05KW()) while ( 2158198.OZHY) ;
}
}
void[] u6y;
void DMLB;
boolean uKPZd;
boolean[][][] ehSLig2n;
return;
{
fePRrCs64cv Q9AMxY;
}
void l9Fv3lS2SS;
}
return -this.HLdY46g;
boolean[][][] kJnRFa;
return;
void[] tpwWOrqtDLW9L = false.Eh() = 4183.dsgAm04();
{
int[] XZ9G;
while ( this.K) !null.DCESJoRjQ;
int[] KApxLDa;
if ( true.nvrHq) if ( !false.H) {
while ( false.qaKsomETlo0nGy) if ( !!5.rF4KYorS) Zhmiw3myC.BKS_F();
}
if ( null.ECDo) {
yOvSEDpm9y8QoA()[ !new EVVwU().sN81U8xRH()];
}
;
qPjc89r eeUWFdZEUUm2PR;
while ( !g2w[ 39332834.eP()]) {
;
}
;
}
NLOXAkTH[] R5VAMu = --!new Hbf1[ -false.J36oKBjlcDAkO].EvC92562ozw3l = null.roJR2C();
int[] K = vES().r0puVps = true.l7f7TpJqHPNBi;
{
jgivHSyyeoSbOa[] RC86pp;
}
}
public int[] UM53pdv (boolean[] WRn, boolean eaI3, boolean pYaWvTZ, int[][] L2jZZk, boolean QXnS60DfUDjd, void b_WBwAi, int xGMeyR) throws p__TmB {
Pin3tsOei[][] YGuscijCftK3Hi = !( _5o.vuc).Y2l_TW = u6MkbgMLZTj().R14Tj;
while ( PEmCV0tN[ -true.tecyF()]) ;
int XhmqDnCVcygbVl;
while ( fQrcEkPEaGn.u) if ( ---false.lFSScmJv5q) while ( new int[ ---!!zgFXfdxFyV7o3I.dA7kMfW()].esrBor3VaaYA()) ;
while ( cKOlD2cwiW7hwd[ j0keyJW4Cwk5[ sp56gwWMWh().vqlHw_xMDUROvC]]) while ( --l_[ new boolean[ !true.b].RM()]) while ( -_oWSbrF.f()) !gcxn9()[ null[ !P()[ -this.AoSy5r]]];
void[][][] YAGnZm7H27eNO;
if ( !new int[ --( !( false.w8uCK4e8wYR_T())[ null.rgSCE82()])[ -IiI8EwPGyq2()[ -new int[ -( !d31b.ycvq())[ !NzJBL2J[ false.dZfNer()]]][ -null.J4ueW()]]]].ytAnjT()) ;else while ( true.p9vXCAVKi78()) if ( !!--822.lcJYXGKJjo()) ;
Ql2e7KIyBgJ_m[][] htshCSBy2 = -!new fYSrns().VgV3z9JJAz;
!ZbLyx6()[ ( new Xx[ !!( 838776.SACXRvrFT).pqFp89U()].DCMiQEQt()).DYwiMI3()];
void N;
void[][] WftpIUdj3Ghc = -!false[ new PgxkPu90q()[ oy40frcM8[ -false.OY45C85YJ8tsD]]] = -true.Tijpb6B3nD_();
{
A23tSRPHm P4iovnsJpXTc;
while ( null.tYs) return;
;
while ( ( --4688.voPFS())[ AF()[ -!!rPBPcV9U7B().XIZdYEUcoqIin()]]) {
if ( new int[ !true.o__DJ()].Ol) {
{
{
if ( true.F5) if ( -!-!!---false[ !-t2zkzTlrG.hPaB]) {
boolean jIKeg;
}
}
}
}
}
if ( !this[ !!-new int[ true[ null.q5MyXlfZ4()]][ 7228623.fIwnU()]]) while ( ( !-true[ !-!-!-!!false.NOQV2eeQjQgSDq])[ new void[ !!-!-!!-null[ null.rOR7tCAKaL()]].Bu4euozW]) if ( new hUgyCsYSbFR[ true.Rr7x()].yk5nB()) if ( -false.WZgQ) return;
CPIz[][][] nYPgPOgL8X9HH;
}
;
}
public void JswLLVh;
public int[][] x1YwJr1_5fFWKv;
public a6tNhM O9XWvvCjOa4;
public void gW8uXCKegjCV72 (boolean[] Qp7A3W, void dRZIa, boolean[] pS5QWK, int wsU3, void[][][][] on4d0v, int[] AMs) {
return;
;
return;
while ( false[ -new S8gTWvJlw_u().C]) return;
if ( f0tBVifnSu().dcjubUdlLWp()) return;else if ( 2[ !new IM5KTZ95().SqoQbm]) if ( ( !!-KtDPgia0Od().vine8NFksetWL).r9_xG) return;
null[ true.PEL7l7v2NhSyHC()];
sxOPqhE8HK[] dpb7y5S8e = mgWjkh.Otba();
boolean YIB;
{
;
while ( -!new void[ new Of4dm7[ !!this.PWsh2JulrrL][ !-null.F5oweO()]][ -null[ new tjE()[ !-!false[ !( -!!new OtHspGp[ --!new d527().DNzN6UP2qSE].bMFbjjHeINxLn)[ !-new GklOhmj[ false.G()].fW3A()]]]]]) ;
boolean xWHXJnIM2psRr;
while ( -false.VznMsVnH_9B3) if ( -!5735931.hMNgpVgxyIDiD()) return;
boolean iHMbWHbJH;
if ( --SfcSLe9bHLS().kedI8) I.F8O();
{
{
void SzUPPTKhhsXagN;
}
}
{
boolean jkN9kF_z72qF8;
}
int[] e;
void kKdo5SshMwO;
int[] pCDOvz8K0j;
( false.u8q5opFXQjSY)[ false.AIcY5cS()];
{
void TlAGC0;
}
{
int[][] c_o4eeOSGn9C_U;
}
void[] NLIWXqnVf;
}
}
}
class gwY {
}
class onM {
}
class qBS {
}
class m30c4v5e1_Ad {
public void Kos (void Wga4H6mLdqNxR, void[][][] tnEBxKT9kOxE8F, int[][][] upY285Pb3SC_, RVEq2X7g MNqeIQg) throws lan6VCYi {
{
{
return;
}
}
while ( -!-new qlOKUiuaUL().fZ) return;
if ( 40848559.r86x2) return;
}
public int nSBO () throws VFazelr1Y {
void d27V7NZJa9zP;
UxIwHEj7()[ true.tiY];
while ( --true.wnZ6A) ;
{
boolean KGlaF;
void TDhk;
while ( true.biExN4H_F0DoF()) ;
;
nnIv7c4bL[] k;
void[] gG;
void[][][][] _UXrVjabq5DtwJ;
return;
int EL_GWf;
wfo0ICUEg[] Xt;
}
{
int XOiqkPi0uPt;
while ( 44136121[ ( null.SH4kgh4T()).OsVu]) return;
pFcbIK4PXYbLG[][] bgDCWU;
void[] ZXlOD2z;
this.U1_6s_5;
void[][] BwMc1KmnthK;
!!null.poS2hJWLFbpo;
int i9jn3ljX;
return;
{
boolean[] yQe;
}
int F;
!!new int[ !nmUa.B4327h5HcNLV()][ new UsY_Sa[ vwl_()[ ( --true.iIw1dzJjcb())[ this.H6]]][ FeTOYuW().hwfy2fhO()]];
fAvu SibFfwO;
return;
-new gzMVMcY_8910jT[ !tsm3S99M.E].Of();
}
;
;
while ( new GK5Ugau[ ( !!03.Hj_PMU7G).KrH70ZO()][ ( X[ ---null.eEmVwjv6v8()]).cNoUDEjP()]) ;
return;
void[][] _y = -null.f_7eSDs1c = true.VAXyLWjgf3PFX();
return;
!-Wt9eRI.G;
void[][] FZT8EX875 = -!ZRhjx0tkdqf().iPW6;
;
void Z20kxc5515S;
}
public sGVuyah6SqsCO L2xRLE0SvB2btR;
public void Vbpg;
public void gTLyPKU7owj7k;
public void OWiR6 () {
if ( !new GF().A0diSh2w()) {
int[] dfmqV2GkFqs;
}
{
int i;
void[][] vZZt2I1v;
NN[][] fX1oZQ5v;
boolean[][] mlfI7;
int VvxT5e9sRXxu;
{
boolean[][][] _qt9KpYbhC;
}
while ( new int[ true[ !false[ null[ ( --!!true.eqzf6an1Vuw()).CDKJL]]]].KuiEpkc) {
!-true[ KLfklh0UQEpK1().YWn];
}
{
if ( --!ewl9B.P7) {
hiBhsT9Irr12fu[][][] xzGNgdGrK;
}
}
boolean giTs0T1s;
return;
boolean G;
int[] XdFwtrpYYh;
void[] rcU7ylV1fY;
this[ null.KrFO];
kh682G[][] K76A4QRTNtDl8F;
;
void y74Is5xiS1jvsN;
;
new void[ !( !null[ z7SZ3.mhTz7H()])[ 98[ !09445.ZgJIiGM1g3P()]]].JLM5Hgxhx();
}
QW91ChEm9s FqH = -cVX4inrb4[ !false[ !--( !new I01Y3ykcmHDwN().sH()).ycky()]] = true.lfPlkdCzYWuXW();
boolean ozwTird9mp6 = null.vC3_h5gygJI;
if ( !-( !this.F9mpWcTE())._mMP) if ( !--( -false._()).KvwZ1Qn()) return;else ;
int UJ7jYTiiX = new JI()[ 47116131.t5bkZ] = TzO9L0[ !--( !!-!!new M().SVvoVz()).BZ6r7];
{
while ( L6E_EN[ yTeUrSA[ -true[ !( new XKIJ9YJ1Em8().wa)[ -!new aJgYZf9seKIc().W0LEn7UX]]]]) {
while ( null.o) if ( -!!-D7Dq4FQ4Su().g9aj()) {
arXI4LZ[] JdfNCX12m1G;
}
}
void[][] U4yovpzalCnZ50;
int[] US4wOm;
bq qO;
;
void NjhmpuwDV7;
!-new grSi999().NDY();
return;
int dY;
}
boolean u3Apgq6zD = new void[ -this.UJ6cwg1tW][ --RA.Fwf0b05()] = this.eDn_NaJs3rGU3R();
int[] Gu9_3wBlOgW5Y = !( new Z6WvO()[ false.VQq6Sd])[ new dxUr7B2yUTl().kwvJrGZ_DSdfK4()] = -false[ !( !PHiL7C.FRy).jk55Mvv];
if ( !!30587648.kAOs6VJZOnh) if ( false.AavTYt7kM()) !false.f4ri();else while ( new void[ -mMZ.nqnN()][ -!BHTpyk1s()[ new z().qTv0yLbxNrCc]]) while ( !739452858.d6FYcTWRfzkEs) ;
{
fLoO2CAlTKBGY[][] Maa_myviqw;
int[][] IIdRV6djF0;
void[] w6OVpwMjj5J;
while ( this.s2k) ;
int o;
}
boolean[][][] arOA8SSYB;
boolean wf;
if ( 457038280.qaL6()) ;else new cxCXop0K().g06bs6cXwBqAC();
}
public void[] JX70_c8Uni () {
H_Ai4vengkDdfe Y4txV_O9P83o = !-( !689427.H15).RF3v();
return;
;
ncqwkq3vLvRASV[][] SY9WDD3PLox = !-true.isXkw0D8cXDmZL;
boolean hr0V4Cr5uHX;
return ( !---02074087[ --!-new TcXzE()[ -!-new goBgYKWYw[ false.njopt].UJgeN_dDMA]]).iPE6eQefUS;
while ( true.vwVlhv) {
void m8Sq;
}
if ( new djZ().UlA7URXQoKEQx()) while ( pTzC4().f) ;else ;
while ( ( this.WQBYoJRF7w()).AncdpdAjlc3t()) this.D9vDagRDLGML;
void[][] mwolPjk;
void ae1MM = 8111482[ !-( new KS0Xv3I9()[ -!-mLT4W8sIIBzsgS().XgqaQO]).aSgtCYuLaGpxK] = -new void[ 38427500[ fd4nrmFiDHy5.m9FCgXcBWLmKmu]].ztIB4X;
void[][] r4 = !!-794309447[ null[ -( new LaWaVdtsHRdf()[ y_ifvUCn().cmAeI4]).NEo()]];
this.DvfxewM();
boolean b8QY = ZvlBxVc0().GPPF5bY35eEWmR() = -26331[ -false.Q()];
BFncrUei[][] pNe_NfWZX = -new KY().A5nHkA();
int WejeSr;
int OkwyvV = new VFRHf48MixVOKa()[ ( qTFq[ !true[ !new ZvMGxLCw().c9c6x()]]).bb1()] = !VR0L.jyHxz36V4P9F();
}
public int MEhG7Y;
public boolean MSspB;
public void[] PkQC;
}
class MhPQv83u7 {
public static void I4 (String[] iyb) throws XetKdg {
boolean q2ghVzj23oTL2 = -null.VwZZxFRjk = !!!!new boolean[ new void[ yQg2().rBNr9x7_AFn_Hi][ -!D3L4kViOET().bPu2PgI()]].ne();
boolean[][][] rIY8r3hrR = ( !( false.MYnsEce1bo_)[ null.Qk6F9pdNW]).zWNmwEi() = !!!dAqpZDLps()[ !!!-null.eHwZwSBjRi()];
;
}
public jMNZDxpGqyHyi yXxmv (boolean[][] YJuDmYOkK9v0bx) throws c8PDXGHPvmdzt {
void u58 = true[ ( zJ5n.vstueJoJrAgF()).Ibe3EW()] = eJBlEfBaBY[ -true[ true.gBecLFu6RcU()]];
int rjwCw9OuIq_Ima = !new wXwbEkl().ndcnsPtPfUO = !this[ !!-this.Ho()];
!-null.xI4;
if ( !!!-this._21A0kHDA) if ( -null.FOFRa4Iixdy0()) while ( this.cDn) if ( -!AWJ[ !new w1FkXgVZ4Ek7()[ -Yza6().LQL9b2()]]) ;else while ( new B1M1oA().xg7xbcvS()) while ( -qmmPyfAnajh6Z[ new xqpdw85DzLLqK[ !0853104.PRfgDzO].E67h0WdPO()]) if ( new boolean[ true[ new JGErR8mu().LVjwXoMaLo]].moOMAg8bGCuMt) if ( !-1.cqK()) ;
return _r50Y3DGjd()[ ( ( Fp().RDPiysj).pUU3URq()).bdP42QNqlVv()];
while ( 52398228.LxN_JN3()) ;
int[] xzGRGgBsH = new boolean[ --!-new void[ -!!new tM0().o4D74jwWg76eO][ true[ -X7uP8EkTBI().f34uM()]]][ !2046878.laYgkVGr()] = false.COwWnQ5bsge1Z;
return;
boolean[] u7D8MyVn4N;
Px_pP[ false.Im_()];
if ( true.K) if ( !( !-null[ xniE20.zBMhvCm()]).R1k8I3x()) {
return;
}
return;
void VX = !739049424.W0Xc00JS24IYIK();
;
return !!!a5LPVI53x()[ null.AOBxW6JKAj21D];
gPqYcop8fB0[][] tyb;
;
boolean[][][] Td3djmGsaSIwr = null.FZX_kEhh9r_3d = true[ this.Vk5NeVdG()];
PTeP7EXw1 KH = true._I();
;
}
public void FUW (int[] ijkYRTe4c) {
if ( false[ new xcP()[ --v5yET96fYa().xejjixca]]) if ( true[ --!1692.mN90Y9DYHX()]) {
int ttMfzz;
}
wKeRCPjv3 n6PFWwUhMfy;
{
if ( true.vT()) ( !new int[ true[ new a().r()]].knTE)[ wSMkFJJ_hGHa.yALpZnQD2];
{
if ( !203.iuHB3I0TuppGuh) if ( !!!B84kSamtdMIp[ new int[ oORkscU7()[ --!-!( --!--!this.TXzPtb1sF)[ true.pfHcuP47qM]]][ !!true.tscgnT]]) {
M3j1Pu[][] R47zG2ypSF4ty;
}
}
}
boolean FfQfnB_OZfq7f;
while ( ---!R_NrtV4L.pV52DVAjGEnn) {
while ( ( null.VX).FJ3J1JRJ()) -new ovUoYT()[ -!( !-!this.MWxqrA35m).WTc7Z()];
}
void[][] sBbnDL = 23761035[ new Cl3ZwKzLVgT2T[ 3839[ Z_6ti10WBK.Z1K7]].bU9SDkfw4SG8t()];
}
public static void HfH8GGI (String[] pA) throws cnRc453 {
while ( false[ -!this.whylSOhUAC()]) return;
int Rxg7AQaImp3fh;
R39TB[][] rRp43Uq3AWUxEW = AaG().fg1KFF5N5;
!!41657516.lrlBVWtwL_W();
{
_Wxyh6POxB l;
while ( -true.FGOrlPJxd2()) {
return;
}
;
-new boolean[ null[ !!!( 131[ W8FTT0().IcHxJb()])[ ( !!!-!-----true[ ( -Se().cDVzdrPIDb7BV).Ue0d()]).qH2()]]].MW;
if ( -!-nqz4hGm6rH4()[ false[ !null.D1]]) while ( null.fup2bsgPgK5bs()) !!!!-!!!this[ -gCYtAI747u3().AvouT3K];
boolean s;
boolean au_5QrE5_c;
return;
( !this.Fpp()).A1yPPs3Hr9();
while ( -new aWCahD2uNn8Xa[ new boolean[ null[ null.RsdCzR0O83uCe()]][ true.jVV8r1kukHN]].z543AeW()) while ( --!false.q1tA8o()) if ( -( !this.WmN1_AZ()).Xg6i9PKWcmfFC) {
XshwST0zgfDyn M6maun;
}
return;
zLd_KLGfwzv eYXlTDGv_1gZ8j;
!new boolean[ this.V()].Siw3PkS;
OCYoIULBA2BK sYLuwkooGK2PrM;
return;
int Bg;
;
if ( this.d()) {
return;
}
}
;
boolean[][][][][] B69ISulXs;
rEPFR9HOQpft[][][][] hspa92tu460;
}
public boolean[] RubrFXqpcj4K () throws MCP {
return ( -( new kQe5yZXuM26()[ -!-new boolean[ !!!true[ 18.D2]].kb1Z0tPXVrjsJ]).LytlgFEEj()).N5aF0rj_();
eq_5sgTAMJ6i[][] UGC36rq2QM = ( new T8f_4K[ ZoY6().l39W()].c())[ -!-new LSIHYC18tw().QjPAz()];
wI41 b;
}
public boolean[][] dRFFm2hF;
public HkNWC4c57[] U (int CPEhTt5lyX_Iw, void[] On1E, int TzogaNruOm7, t[] E, lNakRRC[] iG, int[][] HsdeC) throws Pf26P {
void Y;
boolean[] v = !null.eyXLr1K52eYbG = -new OdC().N7hqqW82go4Zj1;
sQcQ9[][][] K;
void[] WrASNuqm6PRK2 = new int[ !--this.JOPZ5jVsthWW][ -null.qsy()];
--new boolean[ _UNt72oEz8zD8q[ -MrOplk[ !( !!!5265808.So5())[ true[ this.ddI2jvyvXK]]]]].K85();
int UP7RS;
void vNdKGE3mPq = -!--true.yWjowoSv = vwTjr.EjQ8jBwn();
boolean gxWe;
;
while ( --true[ false.jHkvHw6eCnatrj]) false.wm;
boolean pa_KU = null.j();
int WyjxHZeeljqM;
int gHkX = ( -false.Ka9osOb).HuUejgXa_v7 = !!-false.YWVqFhm1;
xIE8 XqkfCXa8Kd8zfy = -( !new void[ G3cr8F().QXdUu5r6i31L()][ new EEOg()[ -true.M()]]).o() = true.dB_MO_b9Gmc();
while ( !false.miBEaY8y1()) return;
boolean yTova = !-true[ --!pF().MGiVLz2illz7()];
boolean kT_Nmf_wO;
}
public OKdgGi_d1Ib i07hVK (boolean h2yoGqBVdnJ, N[] RuXSTp5) throws IJ4R0VZc59 {
{
void[] GE;
;
while ( ---new uYn()[ !--1027922.tNV15b9Sh]) ;
return;
Pa2Og[] LAUdm;
true.OhBPp43nZ;
new _ktTzPpY4().d();
int aXDPoBzw54ayw;
pcUxE8ttQRCM jczch04Dc9zDVq;
M7LC5D1_TB6Rt5[] A7B525;
if ( this.K9PZl) !( !-17631.phk()).cIx_CJ();
return;
int q5a3rlQe6qqW;
int[] ioXXHR;
int[][] CQwKM;
{
return;
}
X9 LcE;
boolean Xnjk;
}
QhV[] RN0_n8cR6t;
int Y;
int pl0n1vF6aMm;
void[][] PdrruyamhaAC;
{
int[] uZtODh;
void r42Ymhx;
if ( this[ -null.xqNRR()]) while ( false.XZegCx) return;
void nvwLZTibT8R9pB;
return;
O[][][] DEQNdyeuT;
return;
{
while ( -!Z3g0L().ylKXN()) if ( -new QkJPFHA().Ka) {
qZnKVfi_[][][][] WWo;
}
}
}
int[][] RcN18QUWKw = -( --!true.XmztQ4CO)[ !dWRT9F.c] = !!!-null.fiCkGByf();
}
public int Ug8S;
public static void w8JUllfu (String[] t797FLGoB) {
;
;
L Rh2F;
void[][][] se261s6 = ( !rTP[ this[ new vfOnXUIE().cenBW7FKgM8]]).JDuSXnEFdaQY = 350358942.WyeAuE7QrEe8D9();
{
if ( this.ztE7P()) if ( Otkb2MALNkxy()[ new xLz()[ ( !true.cpBQJzPO)[ -new boolean[ new T[ -true.dSCRnnOGP75bW][ null.VXoMCA()]][ ( !!!-fAfl().xG())[ -!60.pEN2d]]]]]) ;
true.sPluhUYNpI();
TSD1Eca59lMlN[] D2P8UjC;
;
return;
if ( null.fa) while ( this[ this.mN1L5oK()]) !!99.a9VOO9;
}
;
-!-true[ lMIVA[ -nIp6yFZvT().Fla]];
if ( !--wauAROPMLR()[ -ximUfCvA.tKiktI7d1]) Q2yxYpyWY[ IIr5ozv.Nb];
return R5sZL[ !( -!null.KPOQEjRTN2NAG()).OQS6()];
while ( !!!-!false[ new void[ false._5()].HYu44IVv3ZJLJ()]) if ( false.bcrzy) ;
while ( null[ !WAcAedYmxjIF.sObyBo]) ;
int wtgd1h5JKcq;
}
public int tPnZOfgApAe;
}
| [
"[email protected]"
] | |
fca3cbabc12145776b9bfc4c3319888ffd0927be | f607c52f2f9e585900577f9dd8824823710ff9d8 | /GetUsers/src/main/java/com/rm334439/UserRegistryModify/domain/Photo.java | 38dde0665fc7ef960d2a3c400bf3cdcd3e1ff808 | [] | no_license | edgardpavanellio/handson6 | 6450b266f64a7eb2b2cd26d9331055aa96446eb9 | c42fa958a6bfe68a04748e02342d5415103edabc | refs/heads/master | 2021-04-23T21:51:18.030169 | 2020-04-11T00:26:04 | 2020-04-11T00:26:04 | 250,013,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,592 | java | package com.rm334439.UserRegistryModify.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "photo_table")
public class Photo {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long photo_id;
private PhotoType photo_type;
private PhotoPosition photo_position;
private String photo_path;
public Photo() {
super();
// TODO Auto-generated constructor stub
}
public Photo(PhotoType photo_type, PhotoPosition photo_position, String photo_path) {
super();
this.photo_type = photo_type;
this.photo_position = photo_position;
this.photo_path = photo_path;
}
public Long getPhoto_id() {
return photo_id;
}
public void setPhoto_id(Long photo_id) {
this.photo_id = photo_id;
}
public PhotoType getPhoto_type() {
return photo_type;
}
public void setPhoto_type(PhotoType photo_type) {
this.photo_type = photo_type;
}
public PhotoPosition getPhoto_position() {
return photo_position;
}
public void setPhoto_position(PhotoPosition photo_position) {
this.photo_position = photo_position;
}
public String getPhoto_path() {
return photo_path;
}
public void setPhoto_path(String photo_path) {
this.photo_path = photo_path;
}
@Override
public String toString() {
return "Photo [photo_id=" + photo_id + ", photo_type=" + photo_type + ", photo_position=" + photo_position
+ ", photo_path=" + photo_path + "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((photo_id == null) ? 0 : photo_id.hashCode());
result = prime * result + ((photo_path == null) ? 0 : photo_path.hashCode());
result = prime * result + ((photo_position == null) ? 0 : photo_position.hashCode());
result = prime * result + ((photo_type == null) ? 0 : photo_type.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Photo other = (Photo) obj;
if (photo_id == null) {
if (other.photo_id != null)
return false;
} else if (!photo_id.equals(other.photo_id))
return false;
if (photo_path == null) {
if (other.photo_path != null)
return false;
} else if (!photo_path.equals(other.photo_path))
return false;
if (photo_position != other.photo_position)
return false;
if (photo_type != other.photo_type)
return false;
return true;
}
}
| [
"[email protected]"
] | |
9792c18e95802fbb2f1e583717b2bc2320985f2d | ee4b7fd7a6da9929f01076520ba9c2e82ba6cc20 | /src/main/java/ru/house/manager/EntityDB/Users.java | e53ebcc2ea062d00d5dfcc4fe8daff2bff753eb9 | [] | no_license | Marchuk27/houseManagerMVC | 01ebc7d7babd03d0a083f659968532d4666bb89f | 2f6b0f01a9e9b09f41e632070871a8b4f92bc792 | refs/heads/master | 2020-09-11T06:40:07.619233 | 2019-11-15T17:47:29 | 2019-11-15T17:47:29 | 221,975,192 | 0 | 0 | null | 2019-11-19T18:34:24 | 2019-11-15T17:48:02 | null | UTF-8 | Java | false | false | 1,711 | java | package ru.house.manager.EntityDB;
public class Users {
private int id;
public int getHouseId() {
return houseId;
}
public void setHouseId(int houseId) {
this.houseId = houseId;
}
private int houseId;
public int getAccount_id() {
return account_id;
}
public void setAccount_id(int account_id) {
this.account_id = account_id;
}
private int account_id;
private String firstName;
private String lastName;
private String fatherName;
private String phoneNumber;
private String roomNumber;
private String eMail;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFatherName() {
return fatherName;
}
public void setFatherName(String fatherName) {
this.fatherName = fatherName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber;
}
public String geteMail() {
return eMail;
}
public void seteMail(String eMail) {
this.eMail = eMail;
}
public Users() {
}
}
| [
"[email protected]"
] | |
37ad97bef4fdcfc00a9cdceed87f1e306ef5a827 | 09d0ddd512472a10bab82c912b66cbb13113fcbf | /TestApplications/TF-BETA-THERMATK-v5.7.1/DecompiledCode/JADX/src/main/java/org/telegram/p004ui/Components/C2516-$$Lambda$ChatActivityEnterView$0PqxYA4Sm4DXenEKSdETEwDwen0.java | 70c7fac49e22406146c1316140a3f5fd5c72883e | [] | no_license | sgros/activity_flow_plugin | bde2de3745d95e8097c053795c9e990c829a88f4 | 9e59f8b3adacf078946990db9c58f4965a5ccb48 | refs/heads/master | 2020-06-19T02:39:13.865609 | 2019-07-08T20:17:28 | 2019-07-08T20:17:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package org.telegram.p004ui.Components;
import android.view.View;
import android.view.View.OnClickListener;
/* compiled from: lambda */
/* renamed from: org.telegram.ui.Components.-$$Lambda$ChatActivityEnterView$0PqxYA4Sm4DXenEKSdETEwDwen0 */
public final /* synthetic */ class C2516-$$Lambda$ChatActivityEnterView$0PqxYA4Sm4DXenEKSdETEwDwen0 implements OnClickListener {
private final /* synthetic */ ChatActivityEnterView f$0;
public /* synthetic */ C2516-$$Lambda$ChatActivityEnterView$0PqxYA4Sm4DXenEKSdETEwDwen0(ChatActivityEnterView chatActivityEnterView) {
this.f$0 = chatActivityEnterView;
}
public final void onClick(View view) {
this.f$0.lambda$new$5$ChatActivityEnterView(view);
}
}
| [
"[email protected]"
] | |
ef4a4f7bd9a9e8c71a582161e5af8100bdf4dab1 | 8b42c325b7e47ead8cad7322c44262cd7ffb98cd | /WeatherStationArduino/src/main/java/org/thingml/tobegenerated/REST_RemoteControl_Server.java | 57e601102d4a16915535f14e11407b545168cf6b | [
"MIT"
] | permissive | HEADS-project/WeatherStationDemo | 8ca1f9e500b7487239790e55a834f5762997e158 | 2df8d7bf53ad6415ad473e531ea01e0c1a28e64e | refs/heads/master | 2021-01-02T09:20:54.094499 | 2015-06-24T11:49:03 | 2015-06-24T11:49:03 | 23,834,799 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package org.thingml.tobegenerated;
import org.thingml.generated.WeatherStation;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/RemoteControl")
public class REST_RemoteControl_Server {
private WeatherStation weatherStation;
public REST_RemoteControl_Server(WeatherStation thing) {
weatherStation = thing;
}
@PUT @Path("/changeDisplay")
@Produces(MediaType.TEXT_PLAIN)
// @Consumes(MediaType.TEXT_PLAIN)
public String changeDisplay() {
weatherStation.changeDisplay_via_gui();
System.out.println("Got changeDisplay");
return "OK";
}
}
| [
"[email protected]"
] | |
e8682db73304beb7a7b19ac868e2892843ad23e2 | aa82c44707cbb70da67c3dabdde11e162e56a1b6 | /com.jtrent238.jtcraft/src/main/java/beh.java | c88d78c002cdba18004f54bafffc2d7c659f5589 | [] | no_license | jtrent238/jtcraft | c6804899969c7e5776253c5122539848c7de5f50 | 290820012690e87a491eaa450b9154fd9cf96115 | refs/heads/master | 2021-01-10T09:28:28.084577 | 2016-03-03T02:52:04 | 2016-03-03T02:52:04 | 53,013,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,154 | java | /* */ import org.lwjgl.opengl.GL11;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class beh
/* */ extends bbw
/* */ {
/* 16 */ private static final bqx a = new bqx("textures/gui/achievement/achievement_background.png");
/* */ private bao f;
/* */ private int g;
/* */ private int h;
/* */ private String i;
/* */ private String j;
/* */ private pb k;
/* */ private long l;
/* */ private bny m;
/* */ private boolean n;
/* */
/* */ public beh(bao parambao) {
/* 28 */ this.f = parambao;
/* 29 */ this.m = new bny();
/* */ }
/* */
/* */ public void a(pb parampb) {
/* 33 */ this.i = brp.a("achievement.get", new Object[0]);
/* 34 */ this.j = parampb.e().c();
/* 35 */ this.l = bao.K();
/* 36 */ this.k = parampb;
/* 37 */ this.n = false;
/* */ }
/* */
/* */ public void b(pb parampb) {
/* 41 */ this.i = parampb.e().c();
/* 42 */ this.j = parampb.f();
/* */
/* 44 */ this.l = (bao.K() + 2500L);
/* 45 */ this.k = parampb;
/* 46 */ this.n = true;
/* */ }
/* */
/* */ private void c() {
/* 50 */ GL11.glViewport(0, 0, this.f.d, this.f.e);
/* 51 */ GL11.glMatrixMode(5889);
/* 52 */ GL11.glLoadIdentity();
/* 53 */ GL11.glMatrixMode(5888);
/* 54 */ GL11.glLoadIdentity();
/* */
/* 56 */ this.g = this.f.d;
/* 57 */ this.h = this.f.e;
/* */
/* 59 */ bca localbca = new bca(this.f, this.f.d, this.f.e);
/* 60 */ this.g = localbca.a();
/* 61 */ this.h = localbca.b();
/* */
/* 63 */ GL11.glClear(256);
/* 64 */ GL11.glMatrixMode(5889);
/* 65 */ GL11.glLoadIdentity();
/* 66 */ GL11.glOrtho(0.0D, this.g, this.h, 0.0D, 1000.0D, 3000.0D);
/* 67 */ GL11.glMatrixMode(5888);
/* 68 */ GL11.glLoadIdentity();
/* 69 */ GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
/* */ }
/* */
/* */ public void a() {
/* 73 */ if ((this.k == null) || (this.l == 0L) || (bao.B().h == null)) { return;
/* */ }
/* 75 */ double d1 = (bao.K() - this.l) / 3000.0D;
/* 76 */ if (!this.n) {
/* 77 */ if ((d1 < 0.0D) || (d1 > 1.0D)) {
/* 78 */ this.l = 0L;
/* */ }
/* */
/* */ }
/* 82 */ else if (d1 > 0.5D) { d1 = 0.5D;
/* */ }
/* */
/* 85 */ c();
/* 86 */ GL11.glDisable(2929);
/* 87 */ GL11.glDepthMask(false);
/* */
/* 89 */ double d2 = d1 * 2.0D;
/* 90 */ if (d2 > 1.0D) d2 = 2.0D - d2;
/* 91 */ d2 *= 4.0D;
/* 92 */ d2 = 1.0D - d2;
/* 93 */ if (d2 < 0.0D) d2 = 0.0D;
/* 94 */ d2 *= d2;
/* 95 */ d2 *= d2;
/* */
/* 97 */ int i1 = this.g - 160;
/* 98 */ int i2 = 0 - (int)(d2 * 36.0D);
/* 99 */ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
/* 100 */ GL11.glEnable(3553);
/* 101 */ this.f.P().a(a);
/* 102 */ GL11.glDisable(2896);
/* */
/* 104 */ b(i1, i2, 96, 202, 160, 32);
/* */
/* 106 */ if (this.n) {
/* 107 */ this.f.l.a(this.j, i1 + 30, i2 + 7, 120, -1);
/* */ } else {
/* 109 */ this.f.l.b(this.i, i1 + 30, i2 + 7, 65280);
/* 110 */ this.f.l.b(this.j, i1 + 30, i2 + 18, -1);
/* */ }
/* */
/* 113 */ bam.c();
/* 114 */ GL11.glDisable(2896);
/* 115 */ GL11.glEnable(32826);
/* 116 */ GL11.glEnable(2903);
/* */
/* 118 */ GL11.glEnable(2896);
/* 119 */ this.m.b(this.f.l, this.f.P(), this.k.d, i1 + 8, i2 + 8);
/* 120 */ GL11.glDisable(2896);
/* */
/* 122 */ GL11.glDepthMask(true);
/* 123 */ GL11.glEnable(2929);
/* */ }
/* */
/* */ public void b() {
/* 127 */ this.k = null;
/* 128 */ this.l = 0L;
/* */ }
/* */ }
/* Location: C:\Users\trent\.gradle\caches\minecraft\net\minecraft\minecraft\1.7.10\minecraft-1.7.10.jar!\beh.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
0453b1fd7b2ffe314a110b1474e0cf732046b251 | a7ee43a26c944bd5476d04964554c99abcb0244f | /OOP - 2/src/sample/Main.java | d182a1842e8570362097493365758cc53c23fb79 | [] | no_license | drapejny/OOP | d77dad896aafbec242a2b6370b0adcd69ec5fb2b | bf05e030ca0d5183bcd13382ca4e982e940ded12 | refs/heads/main | 2023-05-12T14:37:19.214707 | 2021-05-23T10:08:06 | 2021-05-23T10:08:06 | 361,215,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import sample.myshapes.*;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
primaryStage.setTitle("Hello World");
primaryStage.setScene(new Scene(root));
primaryStage.show();
shapesList.drawList(Controller.gc);
}
public static ShapesList shapesList;
static {
shapesList = new ShapesList();
shapesList.add(new Circle(200,200,100));
shapesList.add(new Ellipse(350,500,100,40));
shapesList.add( new Square(400,400,100));
shapesList.add(new Rectangle(120,270,300,100));
shapesList.add( new Triangle(340,300,110,50));
shapesList.add( new Line(450,450,300,278));
}
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
08d6c93cd2d0fcf89f226fff0af9634743724d50 | f22bb10ab6d29fc4fc1e14586237911f4d45bd49 | /app/src/main/java/com/example/root/httprequest/Rain.java | 5becc1a3738d1fc20e444c3aa63338f70965ad46 | [] | no_license | mams2/HttpRequest | 62b895a83a258c2695bfa159d4ec2a2b2835b1d1 | cb184e8abe64a00e0bc911b42b99a6c4f235c830 | refs/heads/master | 2021-01-13T03:42:47.233563 | 2016-12-24T13:01:05 | 2016-12-24T13:01:05 | 77,267,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package com.example.root.httprequest;
import com.google.gson.annotations.SerializedName;
/**
* Created by root on 24/12/16.
*/
public class Rain {
@SerializedName("3h")
public double treshoras;
}
| [
"[email protected]"
] | |
fbab0d45c3d868bef415e8b17780cffdf8146f91 | dc51a0642db90f246377b4b1b5159eac708999e3 | /src/main/java/edu/unimagdalena/domicilios/api/DomicilioController.java | 0791477e66724c8b66496ff5474c6c090484c3bd | [] | no_license | derekcantillo/DeliveriesBackend | 778b5b6776ee7c5f6d7085de9d3f7a9733dfb0ec | 6f35fba2add38ed33449a8d02c977a8bae88aa5e | refs/heads/main | 2023-07-10T19:48:04.273811 | 2021-08-20T21:53:13 | 2021-08-20T21:53:13 | 398,407,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,066 | java | package edu.unimagdalena.domicilios.api;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import edu.unimagdalena.domicilios.modelo.Domicilio;
import edu.unimagdalena.domicilios.modelo.Mensajero;
import edu.unimagdalena.domicilios.repository.DomicilioRepository;
import edu.unimagdalena.domicilios.repository.MensajeroRepository;
@RestController
@CrossOrigin(origins = {"http://localhost:8080","http://localhost:3000"})
@RequestMapping("/api/domicilios")
public class DomicilioController {
@Autowired
private DomicilioRepository domicilioRepositorio;
@Autowired
private MensajeroRepository mensajeroRepositorio;
@GetMapping
//@PreAuthorize("hasRole('USER')")
public ResponseEntity<List<Domicilio>> getTodosDomicilios(){
List<Domicilio> listaDomicilios = domicilioRepositorio.findAll();
if(listaDomicilios.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(listaDomicilios, HttpStatus.OK);
}
@GetMapping("/mensajeros/{id}")
//@PreAuthorize("hasRole('USER')")
public ResponseEntity<List<Domicilio>> getDomiciliosByMensajero(@PathVariable("id") Long idMensajero){
List<Domicilio> domicilios = domicilioRepositorio.findByMensajeroId(idMensajero);
if(domicilios.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}else {
return new ResponseEntity<>(domicilios, HttpStatus.OK);
}
}
@PostMapping("/mensajeros/{id}")
//@PreAuthorize("hasRole('USER')")
public ResponseEntity<Domicilio> createDomicilio(@PathVariable("id") Long idMensajero, @RequestBody Domicilio domicilio ){
Optional<Mensajero> mensajero = mensajeroRepositorio.findById(idMensajero);
if(mensajero.isPresent()) {
domicilio.setMensajero(mensajero.get());
Domicilio nuevoDomicilio = domicilioRepositorio.save(domicilio);
return new ResponseEntity<>(nuevoDomicilio, HttpStatus.CREATED);
}else {
return new ResponseEntity<>(HttpStatus.FAILED_DEPENDENCY);
}
}
@PutMapping("/{id}")
//@PreAuthorize("hasRole('USER')")
public ResponseEntity<Domicilio> updateDomicilio(@PathVariable("id") Long id, @RequestBody Domicilio domi){
Optional<Domicilio> datosDomicilio = domicilioRepositorio.findById(id);
if(datosDomicilio.isPresent()) {
Domicilio domicilio = datosDomicilio.get();
domicilio.setValor(domi.getValor());
domicilio.setDireccionOrigen(domi.getDireccionOrigen());
domicilio.setDireccionDestino(domi.getDireccionDestino());
domicilio.setNombreClienteOrigen(domi.getNombreClienteOrigen());
domicilio.setNombreClienteDestino(domi.getNombreClienteDestino());
domicilio.setEstado(domi.isEstado());
domicilio.setFechaDomicilio(domi.getFechaDomicilio());
Domicilio nuevoDomicilio = domicilioRepositorio.save(domicilio);
return new ResponseEntity<>(nuevoDomicilio, HttpStatus.OK);
}else {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
@DeleteMapping("/{id}")
//@PreAuthorize("hasRole('USER')")
public ResponseEntity<Domicilio> deleteDomicilio (@PathVariable("id") Long id){
try {
domicilioRepositorio.deleteById(id);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
| [
"[email protected]"
] | |
c1f6089de9af60948c2f0c6267b3adbfc88437ff | 9d72a9310420e9e5a52e2e0ce78f4a403ba53a3b | /src/com/javarush/test/level04/lesson13/task02/Solution.java | 9719483d223ad36538d896c8b68bde33ffb10267 | [] | no_license | VladimirPen/rush | 9ef4808480cbf8c576bb86e8da18a8371a4f9930 | f5151f1ef498c078063c199c555046ab561ca499 | refs/heads/master | 2021-01-17T06:53:39.798974 | 2016-08-10T17:44:31 | 2016-08-10T17:44:31 | 45,965,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.javarush.test.level04.lesson13.task02;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/* Рисуем прямоугольник
Ввести с клавиатуры два числа m и n.
Используя цикл for вывести на экран прямоугольник размером m на n из восьмёрок.
Пример: m=2, n=4
8888
8888
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
int m = Integer.parseInt(bufferedReader.readLine());
int n = Integer.parseInt(bufferedReader.readLine());
for (int i = 0;i<m;i++){
for (int j = 0;j<n;j++){
System.out.print("8");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
c99a5f60b09ea3dbbc1682512a550545d9f8564e | 41c9381ec1061ecdee0829f92712ec4b7d4c5bd8 | /springboot/springboot-all/src/main/java/org/spring/springboot/common/aop/APPControllerAOP.java | 948600371e96ce8e461e48b2c240d6c89628e732 | [] | no_license | 0100chf/study-java | 9d3b0cc7e178b82a0d57a12326007f3982c342cc | bc8723aaaa84290a86b1c7cede06d31f92237b6c | refs/heads/master | 2020-03-23T11:51:27.401127 | 2018-09-21T06:59:33 | 2018-09-21T06:59:33 | 141,523,822 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,859 | java | package org.spring.springboot.common.aop;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.UnknownAccountException;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.spring.springboot.common.exceptions.CheckException;
import org.spring.springboot.common.result.ResultBean;
import org.spring.springboot.common.result.ResultStatus;
/**
* 接口开发一般在controller返回ResultBean
* 对此拦截,计算运行时间和统一处理异常,如果有异常返回异常json
* @author chen haifeng
*
*/
@Aspect
@Component
public class APPControllerAOP {
private static final Logger logger = LoggerFactory.getLogger(APPControllerAOP.class);
@Pointcut("execution(public org.spring.springboot.common.result.ResultBean *(..))")
public void controllerMethod(){}
@Around("controllerMethod()")
public Object handlerControllerMethod(ProceedingJoinPoint pjp) {
long startTime = System.currentTimeMillis();
ResultBean<?> result=null;
logger.info("APPControllerAOP-------");
try {
result = (ResultBean<?>)pjp.proceed();
logger.info(pjp.getSignature() + "use time:" + (System.currentTimeMillis() - startTime));
return new ResultBean(new ResultStatus(result.getData()));
} catch (Throwable e) {
return handlerAppException(pjp, e);
}
}
private ResultBean<ResultStatus> handlerAppException(ProceedingJoinPoint pjp, Throwable e) {
// 已知异常,可以登录
if (e instanceof CheckException) {
return ResultStatus.exceptionResult(e.getLocalizedMessage());
}
//else if (e instanceof UnloginException) {
// return ResultStatus.exceptionResult(ResultStatus.NO_LOGIN);
//}
else if (e instanceof UnknownAccountException) { //shiro 异常
return ResultStatus.exceptionResult(ResultStatus.INCORRECT_LOGIN);
}
else if (e instanceof IncorrectCredentialsException) { //shiro 异常
return ResultStatus.exceptionResult(ResultStatus.INCORRECT_LOGIN);
} else if ("kaptchaValidateFailed".equals(e)) { //406,验证码错误,不允许进
return ResultStatus.exceptionResult(ResultStatus.VERICODE_ERROR);
}
/* else if (User.STATUS_LOCK.equals(user.getStatus())) {
throw new LockedAccountException("账号已被锁定,请联系管理员!");
}*/
else {
ResultStatus status=new ResultStatus();
logger.error(pjp.getSignature() + " error ", e);
//TODO 发邮件
status.setMsg(e.toString());
status.setMsgCode(ResultStatus.FAIL);
return new ResultBean<>(status,HttpStatus.INTERNAL_SERVER_ERROR);//500
}
}
}
| [
"[email protected]"
] | |
2ecd0e4e194dfd52d483f17abdea7fcd8d5b025e | 3447b9cbca807cc921a3abd72094196bf4599288 | /Omnom.Android/Omnom/src/main/java/com/omnom/android/acquiring/mailru/OrderInfoMailRu.java | 1bd4a0e98ad3861fbead9b6ea5012c7536d86127 | [] | no_license | saintlab/mobileapp_android | a1f6614d0837f0527ce426baa232916b985f4b43 | 14ab2f0ae62ee432a740922f5c2784799dac6a99 | refs/heads/master | 2021-05-29T11:32:21.305429 | 2015-07-02T06:24:50 | 2015-07-02T06:24:50 | 21,729,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package com.omnom.android.acquiring.mailru;
import com.omnom.android.acquiring.OrderInfo;
/**
* Created by Ch3D on 24.09.2014.
*/
public class OrderInfoMailRu implements OrderInfo {
public static OrderInfoMailRu create(double amount, String orderId, String orderMsg) {
return new OrderInfoMailRu(amount, orderId, orderMsg);
}
private double amount;
private String orderId;
private String orderMsg;
private OrderInfoMailRu(double amount, String orderId, String orderMsg) {
this.amount = amount;
this.orderId = orderId;
this.orderMsg = orderMsg;
}
@Override
public String getOrderId() {
return orderId;
}
@Override
public void setOrderId(String orderId) {
this.orderId = orderId;
}
@Override
public String getOrderMsg() {
return orderMsg;
}
@Override
public void setOrderMsg(String orderMsg) {
this.orderMsg = orderMsg;
}
@Override
public double getAmount() {
return amount;
}
@Override
public void setAmount(double amount) {
this.amount = amount;
}
}
| [
"[email protected]"
] | |
c2382155b7797dff0efb13679f3bd55d71399111 | 9fb166524f673dfae75aae6b42c59a9a50560ce1 | /chap6/DollarFormatFirstTryDriver.java | 18bca501b911593a6ab79a03b1a2d3178d2ba3fe | [] | no_license | akplearner/JAVA101 | b9050306349bccce0081f3856d5ffe2b672b4350 | 78e053726030ab8fc6de14b0277117d4b373092c | refs/heads/master | 2020-03-19T02:44:42.593972 | 2018-06-02T01:47:48 | 2018-06-02T01:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 567 | java | //listing 6.12
import java.util.Scanner;
public class DollarFormatFirstTryDriver{
public static void main(String[] args){
double amount;
String response;
Scanner kb = new Scanner(System.in);
do{
System.out.println("enter value of type double:");
amount = kb.nextDouble();
DollarFormatFirstTry.write(amount);
System.out.println("\n"+"Test again?");
response = kb.next();
}while(response.equalsIgnoreCase("yes"));
System.out.println("End of test.");
}
} | [
"[email protected]"
] | |
5bf9945858da8a2fb7dfcd6e0ddc71fc0ae08f2b | 08047f920fa0dde9b865e0557b09da0075b8774b | /simple-registration-app/src/main/java/eg/com/unifonic/assignment/aop/aspect/UserRegistrationAppAspect.java | ddc455c1c2c7262206a13037dc5d8667a029c01c | [] | no_license | manargalal/SimpleRegistrationForm | 25962466e08cd0e86b2e15751c2c39006547ad9f | b965b473cde7e743c604b263f8b117ef5db3937e | refs/heads/master | 2022-03-24T03:04:11.414612 | 2019-12-18T10:24:10 | 2019-12-18T10:24:10 | 198,036,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,302 | java | package eg.com.unifonic.assignment.aop.aspect;
import java.util.Arrays;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StopWatch;
public class UserRegistrationAppAspect {
Logger log = LoggerFactory.getLogger(this.getClass());
@Pointcut("within(@org.springframework.web.bind.annotation.RestController *)")
public void controller() {
}
@Pointcut("execution(* *.*(..))")
protected void allMethod() {
}
@Pointcut("execution(public * *(..))")
protected void loggingPublicOperation() {
}
@Pointcut("execution(* *.*(..))")
protected void loggingAllOperation() {
}
@Pointcut("within(eg.com.redshift.doctorhome.*)")
private void logAnyFunctionWithinResource() {
}
//before -> Any resource annotated with @Controller annotation
//and all method and function taking HttpServletRequest as first parameter
@Before("controller() && allMethod()")
public void logBefore(JoinPoint joinPoint) {
log.debug("Entering in Method : " + joinPoint.getSignature().getName());
log.debug("Class Name : " + joinPoint.getSignature().getDeclaringTypeName());
log.debug("Arguments : " + Arrays.toString(joinPoint.getArgs()));
log.debug("Target class : " + joinPoint.getTarget().getClass().getName());
}
//After -> All method within resource annotated with @Controller annotation
// and return a value
@AfterReturning(pointcut = "controller() && allMethod()", returning = "result")
public void logAfter(JoinPoint joinPoint, Object result) {
String returnValue = this.getValue(result);
log.debug("Method Return value : " + returnValue);
}
//After -> Any method within resource annotated with @Controller annotation
// throws an exception ...Log it
@AfterThrowing(pointcut = "execution(* eg.com.unifonic.assignment.exception.UserRegistartionExceptionHandler.handleUserRegistrationException(..))", throwing = "exception")
public void logAfterThrowing(JoinPoint joinPoint, Throwable exception) {
log.error("An exception has been thrown in " + joinPoint.getSignature().getName() + " ()");
log.error("Cause : " + exception.getCause());
}
//Around -> Any method within resource annotated with @Controller annotation
@Around("controller() && allMethod()")
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.currentTimeMillis();
try {
String className = joinPoint.getSignature().getDeclaringTypeName();
String methodName = joinPoint.getSignature().getName();
Object result = joinPoint.proceed();
long elapsedTime = System.currentTimeMillis() - start;
log.debug("Method " + className + "." + methodName + " ()" + " execution time : "
+ elapsedTime + " ms");
return result;
} catch (IllegalArgumentException e) {
log.error("Illegal argument " + Arrays.toString(joinPoint.getArgs()) + " in "
+ joinPoint.getSignature().getName() + "()");
throw e;
}
}
@Around("execution(* eg.com.unifonic.assignment.*.**(..))")
public Object logMethod(ProceedingJoinPoint joinPoint) throws Throwable{
final Logger logger = LoggerFactory.getLogger(joinPoint.getTarget().getClass().getName());
Object retVal = null;
try {
StringBuffer startMessageStringBuffer = new StringBuffer();
startMessageStringBuffer.append("Start method ");
startMessageStringBuffer.append(joinPoint.getSignature().getName());
startMessageStringBuffer.append("(");
Object[] args = joinPoint.getArgs();
for (int i = 0; i < args.length; i++) {
startMessageStringBuffer.append(args[i]).append(",");
}
if (args.length > 0) {
startMessageStringBuffer.deleteCharAt(startMessageStringBuffer.length() - 1);
}
startMessageStringBuffer.append(")");
logger.debug(startMessageStringBuffer.toString());
StopWatch stopWatch = new StopWatch();
stopWatch.start();
retVal = joinPoint.proceed();
stopWatch.stop();
StringBuffer endMessageStringBuffer = new StringBuffer();
endMessageStringBuffer.append("Finish method ");
endMessageStringBuffer.append(joinPoint.getSignature().getName());
endMessageStringBuffer.append("(..); in : "+joinPoint.getSignature().getDeclaringTypeName());
endMessageStringBuffer.append("execution time: ");
endMessageStringBuffer.append(stopWatch.getTotalTimeMillis());
endMessageStringBuffer.append(" ms;");
logger.debug(endMessageStringBuffer.toString());
} catch (Throwable ex) {
StringBuffer errorMessageStringBuffer = new StringBuffer();
// Create error message
logger.error(errorMessageStringBuffer.toString(), ex);
throw ex;
}
return retVal;
}
private String getValue(Object result) {
String returnValue = null;
if (null != result) {
if (result.toString().endsWith("@" + Integer.toHexString(result.hashCode()))) {
returnValue = ReflectionToStringBuilder.toString(result);
} else {
returnValue = result.toString();
}
}
return returnValue;
}
}
| [
"[email protected]"
] | |
2b1188642970119eb3f002a5aede1c42dd5e0680 | 5fc1d203f8dbc9adce92bec5346f18d54fd37aa9 | /Project2/OrderProcess/src/OrderResponseAction.java | ab877540427ab8cdf3427abd6853b0920cd9bbe5 | [] | no_license | jinguanz/Rep-for-Arch-Course | 6656b51d9190b97bb96ee1b32dc8ee8aaa7c07f4 | 31b53128afc387b78163c6ee38c2eeade547aac3 | refs/heads/master | 2021-01-17T07:28:28.939893 | 2013-09-25T06:04:52 | 2013-09-25T06:04:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java |
import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.actions.ActionUtils;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;
import java.util.Map;
public class OrderResponseAction extends AbstractActionLifecycle
{
protected ConfigTree _config;
public OrderResponseAction(ConfigTree config)
{
_config = config;
}
public Message noOperation(Message message)
{
return message;
}
/*
* Retrieve and output the webservice response.
*/
public Message process(Message message) throws Exception
{
logHeader();
Map responseMsg = (Map) message.getBody().get();
System.out.println("Response Map is: " + responseMsg);
logFooter();
return message;
}
public void exceptionHandler(Message message, Throwable exception)
{
logHeader();
System.out.println("!ERROR!");
System.out.println(exception.getMessage());
System.out.println("For Message: ");
System.out.println(message.getBody().get());
logFooter();
}
// This makes it easier to read on the console
private void logHeader()
{
System.out.println("Start of Order response..\n");
}
private void logFooter()
{
System.out.println("End of Order response..\n");
}
} | [
"[email protected]"
] | |
4c0dde08889f9a36ef00e6eb0c25139b9b5f7aac | 429213b6c5b01ac8618673fd0d684735ff89260e | /java/com/venilry/web/pojo/Permission.java | 7c8b0c66e27f5f61f4e2c6a1636d398e46ba3f59 | [] | no_license | vevoidry/blog2_linux | 3d30b24f4961289394ee565a3d2ba6825e71b1a5 | 782c73ff5f7ad0ddacc5534a3a5e3188ccc001ff | refs/heads/master | 2020-09-26T05:19:31.327203 | 2019-12-05T19:42:52 | 2019-12-05T19:42:52 | 226,174,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | package com.venilry.web.pojo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Entity
@Table(name = "permission")
@JsonIgnoreProperties(value={"hibernateLazyInitializer"})
public class Permission {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "url")
private String url;
@Column(name = "method")
private String method;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
}
| [
"[email protected]"
] | |
2bc3845969fb938ba9dc0d4bcb8af0d7caf3e995 | 4fff79c6705e3a8b21131a9638e82dc487a7b0f9 | /App.java | 05d7f11e99ac5f81ac7e0d181a0ecd1597c73874 | [] | no_license | avinash-bussa/avinashbussa_dp | 8ab1abadd5acd31211bf2681d1bcda1450ded6f5 | c3c8fbab4af2670b8ea1005bfec080b4a3710de1 | refs/heads/master | 2022-11-22T07:14:21.279336 | 2020-07-26T05:42:48 | 2020-07-26T05:42:48 | 282,584,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.epam.designPatterns;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"[email protected]"
] | |
7c311c41720d9d66ccfce50f79244836c0c57889 | 28fc83a12cc8951c4ba7ca0351ca535f5b476166 | /exercism-examples/hello-world/src/main/java/Greeter.java | af2100084f246d9b6130a1907d7f63911542e536 | [] | no_license | AlaineCMiller/Java | 756868a6955cb75a6a2fb42698c9f82503d8a05c | d91247609afa1047a45cd6f44477dc1768ce5938 | refs/heads/master | 2021-10-08T18:17:07.867776 | 2021-10-07T00:50:49 | 2021-10-07T00:50:49 | 203,431,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | class Greeter {
String getGreeting() {
return "Hello, World!";
}
}
| [
"[email protected]"
] | |
8e016ce7998415483a47093a304e4cae9b63d290 | 4082835d52d668dfa6fce72bb97df156805bcd53 | /src/com/javarush/test/level36/lesson04/home01/Model.java | ad21f9890c563ee2024a61f3197958e2650d1771 | [] | no_license | Arkadiu/JavaRush | 00cd04072fa1af70020d03510b9694f565423aec | c467f58c433b99a7374e11c60a83d30860ae866a | refs/heads/master | 2021-06-25T18:14:15.204111 | 2017-04-17T18:32:06 | 2017-04-17T18:32:06 | 57,323,182 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.javarush.test.level36.lesson04.home01;
import java.util.List;
/**
* Created by Администратор on 21.04.2016.
*/
public class Model
{
private Service service = new Service();
public List<String> getStringDataList() {
return service.getData();
}
}
| [
"[email protected]"
] | |
1e7b24cbd3361b2670c3ae0ee9ca5c844d46ecc3 | 4d55a7a9ca62789b1f1eb2ac2343fb1e2f74611b | /translate/cloud-client/src/test/java/com/example/translate/TranslateTextWithGlossaryTests.java | 3b2be95994e895a10e044593ebfff3ecf54f48c5 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | isabella232/java-docs-samples | 26fc4b9f3f8ed15b549e012035f76fb733b9baf9 | 559ed808141b97504d108f9cb962c9d02d0f8f5c | refs/heads/master | 2023-03-11T16:56:44.199541 | 2020-10-02T20:53:42 | 2020-10-02T20:53:42 | 300,751,939 | 1 | 0 | Apache-2.0 | 2021-04-03T11:41:56 | 2020-10-02T22:46:04 | null | UTF-8 | Java | false | false | 3,127 | java | /*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.translate;
import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/** Tests for Translate Text With Glossary sample. */
@RunWith(JUnit4.class)
@SuppressWarnings("checkstyle:abbreviationaswordinname")
public class TranslateTextWithGlossaryTests {
private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
private static final String GLOSSARY_INPUT_URI =
"gs://cloud-samples-data/translation/glossary_ja.csv";
private static final String GLOSSARY_ID =
String.format("test_%s", UUID.randomUUID().toString().replace("-", "_").substring(0, 26));
private ByteArrayOutputStream bout;
private PrintStream out;
private static void requireEnvVar(String varName) {
assertNotNull(
"Environment variable '%s' is required to perform these tests.".format(varName),
System.getenv(varName));
}
@BeforeClass
public static void checkRequirements() {
requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
requireEnvVar("GOOGLE_CLOUD_PROJECT");
}
@Before
public void setUp() throws InterruptedException, ExecutionException, IOException {
// Create a glossary that can be used in the test
PrintStream temp = new PrintStream(new ByteArrayOutputStream());
System.setOut(temp);
List<String> languageCodes = new ArrayList<>();
languageCodes.add("en");
languageCodes.add("ja");
CreateGlossary.createGlossary(PROJECT_ID, GLOSSARY_ID, languageCodes, GLOSSARY_INPUT_URI);
bout = new ByteArrayOutputStream();
out = new PrintStream(bout);
System.setOut(out);
}
@After
public void tearDown() throws InterruptedException, ExecutionException, IOException {
// Clean up
// Delete the created glossary
DeleteGlossary.deleteGlossary(PROJECT_ID, GLOSSARY_ID);
System.setOut(null);
}
@Test
public void testTranslateTextWithGlossary() throws IOException {
TranslateTextWithGlossary.translateTextWithGlossary(
PROJECT_ID, "en", "ja", "account", GLOSSARY_ID);
String got = bout.toString();
assertThat(got).contains("アカウント");
}
}
| [
"[email protected]"
] | |
30e61ad8235fc03003713319ef45e6bfb52b980d | 9d4513a7274a04f5485396a4deedc95d8226cb75 | /IFace/src/Iface/Users.java | 19dea5adae1c81186e96389150dce4f5cd538290 | [] | no_license | joaopedro1998/iFaceP3 | 0f10e47ee0926429778b6ccf11c0ffc6b23c4d66 | 00924563e823f0873f911e0d4609cfb3b6b968ce | refs/heads/master | 2021-04-03T07:02:06.825162 | 2018-03-09T17:46:57 | 2018-03-09T17:46:57 | 124,574,078 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,600 | java | package Iface;
import java.util.*;
public class Users {
Profile profile = new Profile();
Friends friends = new Friends();
ArrayList<Messages> messages = new ArrayList<Messages>();
ArrayList<String> communities = new ArrayList<String>();
boolean flag;
private String ownCommunity = "Empty";
private String login;
private String password;
private String name;
public Users(String login, String password, String name)
{
this.login = login;
this.password = password;
this.name = name;
}
public void readMessages()
{
flag = true;
for(Messages m: messages)
if(m.viewMessage() == false)
{
m.readMessage();
flag = false;
}
if(flag == true)
{
System.out.println("Ou voce nao tem mensagem, Ou voce ja visualizou todas!");
System.out.println("Volte para o menu e recupere informacoes da sua conta para ver mensagens ja vistas");
}
}
public void addCommunity(String name)
{
communities.add(name);
}
public String getOwnCommunity()
{
return this.ownCommunity;
}
public void setOwnCommunity(String name)
{
this.ownCommunity = name;
}
public void allFriends()
{
friends.allFriends();
}
public void allCommunities()
{
if(this.ownCommunity.equals("Empty"))
System.out.println("Voce nao eh dono de nenhuma comunidade!");
else
System.out.println("Voce eh dono da comunidade " + ownCommunity);
if(communities.size() == 0)
System.out.println("Voce nao esta associado a nenhuma comunidade");
else
{
System.out.println("Essas sao as comunidades que voce esta associado:");
for(String c: communities)
System.out.println(c);
}
}
public void messagesFriendDelete(String name)
{
int i, size;
size = messages.size();
for(i = 0; i<size; ++i)
{
if(name.equals(messages.get(i).friendName()))
{
messages.remove(i);
--i;
--size;
}
}
}
public void allMessages()
{
if(messages.size() == 0) {
System.out.println("Voce nunca mandou nem recebeu mensagens!");
return;
}
for(Messages m : messages)
m.infoMessages();
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
public String getPassword()
{
return this.password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getLogin()
{
return this.login;
}
public void setLogin(String login)
{
this.login = login;
}
}
| [
"[email protected]"
] | |
881538668387f5610b90bb31c69053abe90fa72b | ce46a3711e62bb1cfa442d1891691c8e337fff00 | /Family/CC1/src/cn/jxufe/test1/Way.java | 7ed6553064d3c649243763b1427d737a6d6f0930 | [] | no_license | bigcaiyujie/FamilyTree | ed57aeb92a8256292ff5ae9b5185eefafddcc641 | 501a0edc74b781c0968092c852451c71ca228a0d | refs/heads/master | 2021-07-13T14:57:54.377988 | 2017-12-27T02:31:24 | 2017-12-27T02:31:24 | 96,073,241 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,523 | java | package cn.jxufe.test1;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ansj.domain.Term;
import org.ansj.splitWord.analysis.ToAnalysis;
import cn.jxufe.data.CatchTxt;
import cn.jxufe.data.Data_xml;
import cn.jxufe.test.Family;
public class Way {
public static final int BOUND = 3;
private CatchTxt txt = new CatchTxt();
private Family family = new Family();
private Data_xml data = new Data_xml("xml/name1.xml");
private BasicWay sd = new BasicWay();
private ArrayList<String> relative = this.data.getList();
public Family getFamily() {
return family;
}
public void setFamily(Family family) {
this.family = family;
}
/*
* 把相应的人称,名字 放入到类中
*/
public ArrayList<ArrayList<String>> word() {
HashMap<String, Integer> map = this.data.getMap();
String context = txt.readTxtFile();
ArrayList<List<Term>> clearword = clear(context);
for (int i = 0; i < clearword.size(); i++) {
int num = 1;
if (exit(clearword.get(i),"毛泽东/nr")) {
while (num <= 10) { //范围在后10句之内
sd.way(clearword.get(i));
num++;
if((i+1)<clearword.size())
i++;
}
}
}
for (int i = 0; i < sd.getTerm().size(); i++) {
System.out.println(sd.getTerm().get(i));
}
return sd.getTerm();
}
/*
* 判断出现最多的人物次数
*/
public String select(ArrayList<String> allPeo) {
int n = 0;
String keys = new String();
Map<String, Integer> map = new HashMap<>();
for (int s = 0; s < allPeo.size(); s++) {
if (map.get(allPeo.get(s)) == null) {
map.put(allPeo.get(s), 1);
} else {
int i = map.get(allPeo.get(s));
map.put(allPeo.get(s), ++i);
}
}
System.out.println(map);
for (String key : map.keySet()) {
if (map.get(key) > n) {
n = map.get(key);
keys = new String(key);
}
}
return keys;
}
/*
* 分句 分词最终结果
*/
public ArrayList<List<Term>> clear(String str) {
ArrayList<String> list = new ArrayList<>();
ArrayList<List<Term>> list_term = new ArrayList<>();
String[] word = str.split("[,。]");
for (int i = 0; i < word.length; i++) {
list.add(word[i]);
}
for (int i = 0; i < list.size(); i++) {
List<Term> parse = ToAnalysis.parse(list.get(i));
list_term.add(parse);
}
return list_term;
}
public boolean exit(List<Term> parse,String str){
boolean e=false;
for(int i=0;i<parse.size();i++){
if(parse.get(i).toString().equals(str))
e=true;
}
return e;
}
}
| [
"[email protected]"
] | |
80562860440bc5838557b24ad0963b7601b5d1c0 | e3d35d1114bcdb5b9010f6781d25305f37426090 | /Task 3.1C/Project_Task_3_1C/Task_3_1C/app/src/main/java/com/task_3_1c/MainActivity.java | 9b6858b0f0ff6d0b78f71ccfaae9a685fc78c242 | [] | no_license | agrawal2598/Task3.1C | 3f5b2ef852e924965a907e8e4c9ad72a77432344 | 1cec593cc45a4429f7838ffccdab6b7322a4ee3d | refs/heads/main | 2023-04-08T19:59:42.283850 | 2021-04-16T06:05:51 | 2021-04-16T06:05:51 | 356,270,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | package com.task_3_1c;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.Toolbar;
public class MainActivity extends AppCompatActivity {
AppCompatButton btnStartQuiz;
AppCompatEditText etEnterName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
btnStartQuiz = findViewById(R.id.btnStart);
etEnterName = findViewById(R.id.etEnterName);
btnStartQuiz.setOnClickListener(v -> {
if (etEnterName.getText().toString().isEmpty())
etEnterName.setError("Please Enter Your Name");
else {
finish();
startActivity(new Intent(getApplicationContext(), QuizActivity.class).putExtra("Name",etEnterName.getText().toString()));
}
});
}
} | [
"[email protected]"
] | |
c6617e59d6251f66efd37e213d30995c59fbcf45 | b641e97d985535e4f1d52c7891aa907f3eb0a254 | /src/Components/net/raumzeitfalle/fx/filechooser/FindFilesTask.java | c1887e4f0952ec6763b4f7dbe44ffdd4a39d164a | [] | no_license | mmaciag1991/HarnessDesignSystemInterfaceDiagram | 7e6f5dc078205475700dc2f63abc3f1e88e62728 | 4569676541a80dff1ffb5df6080799367e835065 | refs/heads/main | 2023-05-19T00:43:10.113472 | 2021-06-11T21:54:03 | 2021-06-11T21:54:03 | 375,101,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,309 | java | /*-
* #%L
* FXFileChooser
* %%
* Copyright (C) 2017 - 2019 Oliver Loeffler, Raumzeitfalle.net
* %%
* 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.
* #L%
*/
package Components.net.raumzeitfalle.fx.filechooser;
import javafx.collections.ObservableList;
import javafx.concurrent.Task;
import java.io.File;
import java.nio.file.Path;
import java.util.Objects;
final class FindFilesTask extends Task<Integer>{
private final ObservableList<IndexedPath> pathsToUpdate;
private final Path directory;
public FindFilesTask(Path searchFolder, ObservableList<IndexedPath> listOfPaths) {
this.pathsToUpdate = Objects.requireNonNull(listOfPaths, "listOfPaths must not be null");
this.directory = searchFolder;
}
/**
* Even in case the directory to be processed is empty or does not exist,
* the consumer collection is always cleared as first step.
*
* @return number of files found and processed
*/
@Override
protected Integer call() throws Exception {
Invoke.andWait(pathsToUpdate::clear);
if (null == directory)
return 0;
File[] files = directory.toAbsolutePath().toFile().listFiles();
if (null == files)
return 0;
updateProgress(0, files.length);
RefreshBuffer buffer = RefreshBuffer.get(this,files.length, pathsToUpdate);
for (int f = 0; f < files.length; f++) {
if (isCancelled())
break;
updateProgress(f+1, files.length);
if (files[f].isFile())
buffer.update(files[f].toPath());
}
buffer.flush();
updateProgress(files.length, files.length);
return files.length;
}
}
| [
"[email protected]"
] | |
4f757023f207f95d8f87be34e515b7238f5a5a4a | dfe5caf190661c003619bfe7a7944c527c917ee4 | /src/main/java/com/vmware/vim25/AnswerFile.java | 8e8fed71f0c8f474a33262643ed0bcdd2cd74284 | [
"BSD-3-Clause"
] | permissive | timtasse/vijava | c9787f9f9b3116a01f70a89d6ea29cc4f6dc3cd0 | 5d75bc0bd212534d44f78e5a287abf3f909a2e8e | refs/heads/master | 2023-06-01T08:20:39.601418 | 2022-10-31T12:43:24 | 2022-10-31T12:43:24 | 150,118,529 | 4 | 1 | BSD-3-Clause | 2023-05-01T21:19:53 | 2018-09-24T14:46:15 | Java | UTF-8 | Java | false | false | 2,505 | java | /*================================================================================
Copyright (c) 2013 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.vmware.vim25;
import java.util.Calendar;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class AnswerFile extends DynamicData {
public ProfileDeferredPolicyOptionParameter[] userInput;
public Calendar createdTime;
public Calendar modifiedTime;
public ProfileDeferredPolicyOptionParameter[] getUserInput() {
return this.userInput;
}
public Calendar getCreatedTime() {
return this.createdTime;
}
public Calendar getModifiedTime() {
return this.modifiedTime;
}
public void setUserInput(ProfileDeferredPolicyOptionParameter[] userInput) {
this.userInput=userInput;
}
public void setCreatedTime(Calendar createdTime) {
this.createdTime=createdTime;
}
public void setModifiedTime(Calendar modifiedTime) {
this.modifiedTime=modifiedTime;
}
} | [
"[email protected]"
] | |
0943f2d287e81f2be72f7231d2c83d3acd640d43 | 21ab7480dfc055dbb0f275218bb6a67ddf14e3f4 | /QuanlyHsWs_server/src/entities/QuanheId.java | ba4963909646619d4b1bd25b5984f1399afff6ae | [] | no_license | x981/Rest-sercurity | 3a0f708a4712cf5a412573e8e26eead048fc7ad5 | 752d1b7e371cfeadc5e30c8610873fb3a100729c | refs/heads/master | 2021-01-01T03:49:55.839197 | 2016-05-19T03:15:24 | 2016-05-19T03:15:24 | 59,079,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,229 | java | package entities;
// Generated Nov 23, 2015 4:06:50 PM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Embeddable;
/**
* QuanheId generated by hbm2java
*/
@Embeddable
public class QuanheId implements java.io.Serializable {
private int maHs01;
private int maHs02;
public QuanheId() {
}
public QuanheId(int maHs01, int maHs02) {
this.maHs01 = maHs01;
this.maHs02 = maHs02;
}
@Column(name = "MaHS01", nullable = false)
public int getMaHs01() {
return this.maHs01;
}
public void setMaHs01(int maHs01) {
this.maHs01 = maHs01;
}
@Column(name = "MaHS02", nullable = false)
public int getMaHs02() {
return this.maHs02;
}
public void setMaHs02(int maHs02) {
this.maHs02 = maHs02;
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof QuanheId))
return false;
QuanheId castOther = (QuanheId) other;
return (this.getMaHs01() == castOther.getMaHs01())
&& (this.getMaHs02() == castOther.getMaHs02());
}
public int hashCode() {
int result = 17;
result = 37 * result + this.getMaHs01();
result = 37 * result + this.getMaHs02();
return result;
}
}
| [
"[email protected]"
] | |
d6792233af50421b862fe22b4e3e178f9f79ff9a | 7de840e11447e9784f63c4281b03e93d8cf69457 | /oneVRE/Web/Services/IoComService/src/main/java/com/googlecode/onevre/web/IoComService/IoComService.java | 9a9d07a10e322b0a86db40a447589e5a73497c1e | [
"BSD-2-Clause"
] | permissive | rowleya/onevre | 553cedc7e868ae399608676310fd5274b7465ece | 4e6a6de560a8f4feea60e2e0010471c749fe8a6f | refs/heads/master | 2016-09-05T23:34:29.889486 | 2011-02-21T16:04:26 | 2011-02-21T16:04:26 | 32,145,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,805 | java | /*
* @(#)InSorsService.java
* Created: 11-Oct-2007
* Version: 1.0
* Copyright (c) 2005-2006, University of Manchester All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. Redistributions in binary
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials
* provided with the distribution. Neither the name of the University of
* Manchester nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.googlecode.onevre.web.IoComService;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.PasswordAuthentication;
import java.net.URL;
import com.googlecode.onevre.ag.types.Capability;
import com.googlecode.onevre.ag.types.StreamDescription;
import com.googlecode.onevre.ag.types.network.NetworkLocation;
import com.googlecode.onevre.ag.types.server.AGService;
import com.googlecode.onevre.ag.types.service.parameter.TextParameter;
import com.googlecode.onevre.platform.SystemConfig;
/**
* An AG3 Service for using IoCom software
*
* @author Anja Le Blanc
* @version 1.0
*
*/
public class IoComService extends AGService {
private static final int BUFFER_SIZE = 8096;
private static final String H261 = "H261";
private static final String L16 = "L16";
private static final String L8 = "L8";
private static final String PCMU = "PCMU";
private static final Capability[] CAPABILITY = new Capability[] {
new Capability(Capability.CONSUMER, Capability.AUDIO, L16,
16000, 1),
new Capability(Capability.CONSUMER, Capability.AUDIO, L16, 8000, 1),
new Capability(Capability.CONSUMER, Capability.AUDIO, L8, 16000, 1),
new Capability(Capability.CONSUMER, Capability.AUDIO, L8, 8000, 1),
new Capability(Capability.CONSUMER, Capability.AUDIO, PCMU,
16000, 1),
new Capability(Capability.CONSUMER, Capability.AUDIO, PCMU,
8000, 1),
new Capability(Capability.PRODUCER, Capability.AUDIO, PCMU,
16000, 1),
new Capability(Capability.CONSUMER, Capability.VIDEO, H261,
90000, 1),
new Capability(Capability.PRODUCER, Capability.VIDEO, H261,
90000, 1)};
private TextParameter igClient = new TextParameter("IG Client",
"C:\\Program Files\\inSORS\\IGClient.exe");
private TextParameter iocomServer = new TextParameter("IoCom Server", "");
private TextParameter username = new TextParameter("Username", "");
private TextParameter password = new TextParameter("Password", "");
private boolean started = false;
private boolean inSorsLaunched = false;
private StreamDescription audioDescription = null;
private StreamDescription videoDescription = null;
private Process process = null;
/**
* Creates a new AudioService
*
*/
public IoComService() {
System.err.println("InSorsService construced");
for (int i = 0; i < CAPABILITY.length; i++) {
addCapability(CAPABILITY[i]);
}
setIdentity(null);
addConfigurationOption(iocomServer);
addConfigurationOption(username);
addConfigurationOption(password);
}
/**
*
* @see com.googlecode.onevre.ag.types.server.AGService#deallocate()
*/
public void deallocate() {
// Does Nothing
}
/**
*
* @see com.googlecode.onevre.ag.types.server.AGService#isStarted()
*/
public boolean isStarted() {
return started;
}
/**
* Configure the service according to the StreamDescription, and stop and
* start rat
*
* @param description
* description of the stream (StreamDescription)
*/
public void setStream(StreamDescription description) {
Capability cap = this.configureStream(description);
if (cap != null) {
if (cap.getType().equals(Capability.AUDIO)) {
audioDescription = description;
} else if (cap.getType().equals(Capability.VIDEO)) {
videoDescription = description;
}
}
// if started stop
if (isStarted()) {
stop();
}
if (isEnabled()) {
start();
}
}
/**
* Start service
*/
public void start() {
if (!inSorsLaunched) {
if ((audioDescription != null) && (videoDescription != null)) {
if (iocomServer.getValue().equals("")
|| username.getValue().equals("")
|| password.getValue().equals("")) {
System.err.println("Missing configuration for service");
} else {
try {
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication
getPasswordAuthentication() {
return new PasswordAuthentication(
(String) username.getValue(),
((String) password.getValue()).toCharArray());
}
});
NetworkLocation videoLocation =
videoDescription.getLocation();
NetworkLocation audioLocation =
audioDescription.getLocation();
String startupfile =
SystemConfig.getInstance().getTempDir() + "/"
+ "IoCom_" + System.currentTimeMillis() + ".igv";
String server = (String) iocomServer.getValue();
server += "?MMDS=\"Multicast%20Connect\""
+ "&MBVIP=" + videoLocation.getHost()
+ "&MBVP=" + videoLocation.getPort()
+ "&MBAIP=" + audioLocation.getHost()
+ "&MBAP=" + audioLocation.getPort();
URL url = new URL(server);
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
InputStream inputStream = connection.getInputStream();
FileOutputStream outputStream =
new FileOutputStream(startupfile);
byte[] data = new byte[BUFFER_SIZE];
int bytesRead = inputStream.read(data);
while (bytesRead != -1) {
outputStream.write(data, 0, bytesRead);
bytesRead = inputStream.read(data);
}
outputStream.close();
inputStream.close();
process = Runtime.getRuntime().exec(new String[]{
"\"" + igClient.getValue() + "\"",
"\"" + startupfile + "\""});
inSorsLaunched = true;
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
/**
*
* @see com.googlecode.onevre.ag.types.server.AGService#stop()
*/
public void stop() {
if (inSorsLaunched) {
process.destroy();
inSorsLaunched = false;
}
}
}
| [
"ts23gm@ff34145c-7872-3b35-6561-e9169588922b"
] | ts23gm@ff34145c-7872-3b35-6561-e9169588922b |
f9c10286e22da0acaf88ba696aa89aabd3be94e2 | 440c0e2923f3734cb4e536f715d8dcb3f4b9c9b6 | /titan2-everett-master/src/main/java/frc/robot/subsystems/Riser.java | 68960af78151e9cd22c0f31c76ca2cee415d24f8 | [] | no_license | Sagecoyote77/titan2-everett2 | 51855767e7fde8ec151a607153ad27d6e39f814a | 5115abc0e15f226a824d3a03623ae4704abf9cc3 | refs/heads/main | 2023-03-20T23:00:09.833939 | 2021-03-16T19:05:59 | 2021-03-16T19:05:59 | 332,862,770 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package frc.robot.subsystems;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import frc.robot.Constants;
public class Riser extends SubsystemBase{
public Jaguar elevatorUpMotor;
public SpeedControllerGroup elevating;
public Riser() {
elevatorUpMotor = new Jaguar(Constants.PWDConstants.ELEVATORUP);
elevating = new SpeedControllerGroup(elevatorUpMotor);
}
}
| [
"[email protected]"
] | |
5a34b70c2fddaacfb919f5181b5dc04ed4f04ef3 | 48e0d81d0a2b2d90438eb5cfe10fd42dd3b99581 | /src/org/mz/action/registeringEnrollenment.java | dd20458ea38949951ad561a2b1a99699eb437129 | [] | no_license | aman157/Appointment-Management | 1ffb512b7802d51a38102688e0d9795e6d039e9d | caa687a5b3ef6c0b91c81d17a6cae64b60dc400c | refs/heads/master | 2021-01-11T17:04:36.335328 | 2017-01-22T11:22:44 | 2017-01-22T11:22:44 | 79,713,253 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,537 | java | package org.mz.action;
import java.util.Random;
import org.mz.modal.MeetingSlipEntryModal;
import org.mz.service.MeetingSlipService;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class registeringEnrollenment extends ActionSupport implements ModelDriven<MeetingSlipEntryModal> {
private static final long serialVersionUID = 1L;
private String uidForEnrolled;
private MeetingSlipEntryModal meetingSlipEntryModal=new MeetingSlipEntryModal();
private String identity="notEmail";
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
public String execute(){
if(identity.equals("email")){
MeetingSlipService meetingSlipService=new MeetingSlipService();
boolean toggle=meetingSlipService.checkingEnrollnmentInsideDatabase(uidForEnrolled,meetingSlipEntryModal);
if (toggle==true){
return ERROR;
}
else{
Random random=new Random();
int randomInteger = random.nextInt(1000);
String randomStr =Integer.toString(randomInteger);
String appliactionFormNumber=uidForEnrolled+"-"+randomStr;
meetingSlipEntryModal.setUid(uidForEnrolled);
meetingSlipEntryModal.setApplicationFormNumber(appliactionFormNumber);
return "SUCCESSFORMAILUSER";
}
}
else{
MeetingSlipService meetingSlipService=new MeetingSlipService();
boolean toggle=meetingSlipService.checkingEnrollnmentInsideDatabase(uidForEnrolled,meetingSlipEntryModal);
if (toggle==true){
return ERROR;
}
else{
Random random=new Random();
int randomInteger = random.nextInt(1000);
String randomStr =Integer.toString(randomInteger);
String appliactionFormNumber=uidForEnrolled+"-"+randomStr;
meetingSlipEntryModal.setUid(uidForEnrolled);
meetingSlipEntryModal.setApplicationFormNumber(appliactionFormNumber);
return SUCCESS;
}
}
}
public String getUidForEnrolled() {
return uidForEnrolled;
}
public void setUidForEnrolled(String uidForEnrolled) {
this.uidForEnrolled = uidForEnrolled;
}
public MeetingSlipEntryModal getMeetingSlipEntryModal() {
return meetingSlipEntryModal;
}
public void setMeetingSlipEntryModal(MeetingSlipEntryModal meetingSlipEntryModal) {
this.meetingSlipEntryModal = meetingSlipEntryModal;
}
@Override
public MeetingSlipEntryModal getModel() {
// TODO Auto-generated method stub
return meetingSlipEntryModal;
}
}
| [
"[email protected]"
] | |
9b5b32e6593a8cabadb9f8b5c356c080529e4c14 | 421f0a75a6b62c5af62f89595be61f406328113b | /generated_tests/model_seeding/89_jiggler-jigl.image.types.InterpolatedGrayImage-1.0-6/jigl/image/types/InterpolatedGrayImage_ESTest.java | 973218d8d8ad0fa322156178df3b3cfc58287b40 | [] | no_license | tigerqiu712/evosuite-model-seeding-empirical-evaluation | c78c4b775e5c074aaa5e6ca56bc394ec03c2c7c6 | 11a920b8213d9855082d3946233731c843baf7bc | refs/heads/master | 2020-12-23T21:04:12.152289 | 2019-10-30T08:02:29 | 2019-10-30T08:02:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | /*
* This file was automatically generated by EvoSuite
* Fri Oct 25 21:42:26 GMT 2019
*/
package jigl.image.types;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class InterpolatedGrayImage_ESTest extends InterpolatedGrayImage_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"[email protected]"
] | |
1fa98dc67578d3f8bae9e9ce62c0ef2ecc31a97d | 1882e6f69b689d804559cdf956e3968ccfa42bd0 | /Meal_Management_System/src/meal_management_system/Meal_Management_System.java | bf7927eebcbf963aaa3a581c0b81438cde1fa6b4 | [] | no_license | 3-Shamim/JavaRawCode | 7bfef1e8c491ff7dded353ff3260cfa72ba16e10 | e08c1cb449909a588bfa9df0033b099d996a1c63 | refs/heads/master | 2021-07-18T19:36:01.870286 | 2017-10-27T12:03:17 | 2017-10-27T12:03:17 | 108,540,570 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meal_management_system;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
/**
*
* @author MD SHAMIM
*/
public class Meal_Management_System extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("SplashScreen.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.initStyle(StageStyle.UNDECORATED);
stage.setTitle("Meal Management System");
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
36ab14f092dbd428881e1ede888080e36fd922cf | ffeaf567e9b1aadb4c00d95cd3df4e6484f36dcd | /Hotgram/org/ocpsoft/prettytime/i18n/Resources_ca.java | 640f26a2ccaa08fd147b50aefcc52d634e3ff12b | [] | no_license | danielperez9430/Third-party-Telegram-Apps-Spy | dfe541290c8512ca366e401aedf5cc5bfcaa6c3e | f6fc0f9c677bd5d5cd3585790b033094c2f0226d | refs/heads/master | 2020-04-11T23:26:06.025903 | 2018-12-18T10:07:20 | 2018-12-18T10:07:20 | 162,166,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,308 | java | package org.ocpsoft.prettytime.i18n;
import java.util.ListResourceBundle;
public class Resources_ca extends ListResourceBundle {
private static final Object[][] a;
static {
Resources_ca.a = new Object[][]{new Object[]{"CenturyPattern", "%n %u"}, new Object[]{"CenturyFuturePrefix", "d\'aquí a "}, new Object[]{"CenturyFutureSuffix", ""}, new Object[]{"CenturyPastPrefix", "fa "}, new Object[]{"CenturyPastSuffix", ""}, new Object[]{"CenturySingularName", "segle"}, new Object[]{"CenturyPluralName", "segles"}, new Object[]{"DayPattern", "%n %u"}, new Object[]{"DayFuturePrefix", "d\'aquí a "}, new Object[]{"DayFutureSuffix", ""}, new Object[]{"DayPastPrefix", "fa "}, new Object[]{"DayPastSuffix", ""}, new Object[]{"DaySingularName", "dia"}, new Object[]{"DayPluralName", "dies"}, new Object[]{"DecadePattern", "%n %u"}, new Object[]{"DecadeFuturePrefix", "d\'aquí a "}, new Object[]{"DecadeFutureSuffix", ""}, new Object[]{"DecadePastPrefix", "fa "}, new Object[]{"DecadePastSuffix", ""}, new Object[]{"DecadeSingularName", "deseni"}, new Object[]{"DecadePluralName", "desenis"}, new Object[]{"HourPattern", "%n %u"}, new Object[]{"HourFuturePrefix", "d\'aquí a "}, new Object[]{"HourFutureSuffix", ""}, new Object[]{"HourPastPrefix", "fa "}, new Object[]{"HourPastSuffix", ""}, new Object[]{"HourSingularName", "hora"}, new Object[]{"HourPluralName", "hores"}, new Object[]{"JustNowPattern", "%u"}, new Object[]{"JustNowFuturePrefix", ""}, new Object[]{"JustNowFutureSuffix", "en un instant"}, new Object[]{"JustNowPastPrefix", "fa uns instants"}, new Object[]{"JustNowPastSuffix", ""}, new Object[]{"JustNowSingularName", ""}, new Object[]{"JustNowPluralName", ""}, new Object[]{"MillenniumPattern", "%n %u"}, new Object[]{"MillenniumFuturePrefix", "d\'aquí a "}, new Object[]{"MillenniumFutureSuffix", ""}, new Object[]{"MillenniumPastPrefix", "fa "}, new Object[]{"MillenniumPastSuffix", ""}, new Object[]{"MillenniumSingularName", "mileni"}, new Object[]{"MillenniumPluralName", "milenis"}, new Object[]{"MillisecondPattern", "%n %u"}, new Object[]{"MillisecondFuturePrefix", "d\'aquí a "}, new Object[]{"MillisecondFutureSuffix", ""}, new Object[]{"MillisecondPastPrefix", "fa "}, new Object[]{"MillisecondPastSuffix", ""}, new Object[]{"MillisecondSingularName", "mil·lisegon"}, new Object[]{"MillisecondPluralName", "mil·lisegons"}, new Object[]{"MinutePattern", "%n %u"}, new Object[]{"MinuteFuturePrefix", "d\'aquí a "}, new Object[]{"MinuteFutureSuffix", ""}, new Object[]{"MinutePastPrefix", "fa "}, new Object[]{"MinutePastSuffix", ""}, new Object[]{"MinuteSingularName", "minut"}, new Object[]{"MinutePluralName", "minuts"}, new Object[]{"MonthPattern", "%n %u"}, new Object[]{"MonthFuturePrefix", "d\'aquí a "}, new Object[]{"MonthFutureSuffix", ""}, new Object[]{"MonthPastPrefix", "fa "}, new Object[]{"MonthPastSuffix", ""}, new Object[]{"MonthSingularName", "mes"}, new Object[]{"MonthPluralName", "mesos"}, new Object[]{"SecondPattern", "%n %u"}, new Object[]{"SecondFuturePrefix", "d\'aquí a "}, new Object[]{"SecondFutureSuffix", ""}, new Object[]{"SecondPastPrefix", "fa "}, new Object[]{"SecondPastSuffix", ""}, new Object[]{"SecondSingularName", "segon"}, new Object[]{"SecondPluralName", "segons"}, new Object[]{"WeekPattern", "%n %u"}, new Object[]{"WeekFuturePrefix", "d\'aquí a "}, new Object[]{"WeekFutureSuffix", ""}, new Object[]{"WeekPastPrefix", "fa "}, new Object[]{"WeekPastSuffix", ""}, new Object[]{"WeekSingularName", "setmana"}, new Object[]{"WeekPluralName", "setmanes"}, new Object[]{"YearPattern", "%n %u"}, new Object[]{"YearFuturePrefix", "d\'aquí a "}, new Object[]{"YearFutureSuffix", ""}, new Object[]{"YearPastPrefix", "fa "}, new Object[]{"YearPastSuffix", ""}, new Object[]{"YearSingularName", "any"}, new Object[]{"YearPluralName", "anys"}, new Object[]{"AbstractTimeUnitPattern", ""}, new Object[]{"AbstractTimeUnitFuturePrefix", ""}, new Object[]{"AbstractTimeUnitFutureSuffix", ""}, new Object[]{"AbstractTimeUnitPastPrefix", ""}, new Object[]{"AbstractTimeUnitPastSuffix", ""}, new Object[]{"AbstractTimeUnitSingularName", ""}, new Object[]{"AbstractTimeUnitPluralName", ""}};
}
public Resources_ca() {
super();
}
protected Object[][] getContents() {
return Resources_ca.a;
}
}
| [
"[email protected]"
] | |
99b4a8b1bd22f295745266693c61a8e9ea8c6053 | e31d6ea59cb574e7981aa7b31d1c8b56d08e989e | /tree/MaxPathSum.java | c56be8c9b4e06283624be9d66c3197e0d079c65c | [] | no_license | wuzhuang0/algorithm | 303df16dd82bec05b2d6b237a140705aa9ee83dc | d2e8d5d9e7e24105a3f5c0dccf65f90ed3d15e0d | refs/heads/master | 2022-12-20T04:03:24.842068 | 2020-09-28T03:54:02 | 2020-09-28T03:54:02 | 290,748,556 | 0 | 0 | null | 2020-08-27T10:41:18 | 2020-08-27T10:41:18 | null | UTF-8 | Java | false | false | 376 | java | /**
* @Description: leetcode 124 给定一个二叉树,返回最大路径和
* 路径被定义为一条从树中任意节点出发,沿父节点-子节点连接,达到任意节点的序列。该路径至少包含一个节点,且不一定经过根节点
* @Author: wz
*/
public class MaxPathSum {
public int maxPathSum(TreeNode root) {
return 0;
}
}
| [
"[email protected]"
] | |
f4065765e99a0915e8b42cd4874cf4c467ee5407 | d4e09f22ff945ed9dcf515b47b1f865339c6608d | /src/net/morematerials/manager/WGenManager.java | 4add18d21c7d7e3da1f87f63b5c2ce2b7715bc56 | [] | no_license | AlmuraDev/MoreMaterialsPlus | 4b13a3813a54b18be1be83e973eadfdda80f6e08 | 65985acc099bccc8fac26b851a7c3b9f039b9e6c | refs/heads/master | 2018-12-29T02:34:37.924070 | 2012-07-12T04:11:07 | 2012-07-12T04:11:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,943 | java | /*
The MIT License
Copyright (c) 2012 Zloteanu Nichita (ZNickq) and Andre Mohren (IceReaper)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package net.morematerials.manager;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import net.morematerials.Main;
import net.morematerials.materials.SMCustomBlock;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.generator.BlockPopulator;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.material.CustomBlock;
public class WGenManager extends BlockPopulator {
private Main plugin;
private Map<String, Set<ConfigurationSection>> populators = new HashMap<String, Set<ConfigurationSection>>();
public WGenManager(Main plugin) {
this.plugin = plugin;
// Create new materials file, if none found.
File active = new File(plugin.getDataFolder().getPath(), "wgen.yml");
if (!active.exists()) {
try {
active.createNewFile();
} catch (Exception e) {
MainManager.getUtils().log("Couldn't read wgen.yml.");
}
}
// Loading the wgen.yml
File wgenYml = new File(plugin.getDataFolder().getPath(), "wgen.yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(wgenYml);
for (String worldName : config.getKeys(false)) {
Set<ConfigurationSection> pops = new HashSet<ConfigurationSection>();
ConfigurationSection datWorld = config.getConfigurationSection(worldName);
for (String matName : datWorld.getKeys(false)) {
ConfigurationSection section = datWorld.getConfigurationSection(matName);
pops.add(section);
}
this.populators.put(worldName, pops);
}
// Registering for worlds.
for (World world : this.plugin.getServer().getWorlds()) {
if (this.populators.containsKey(world.getName())) {
world.getPopulators().add(this);
}
}
}
@Override
public void populate(World world, Random random, Chunk chunk) {
// Do not do anything for world which are not defined in wgen.yml.
if (!this.populators.containsKey(world.getName())) {
return;
}
// Doing all wgen stuff for this world.
for (ConfigurationSection entry : this.populators.get(world.getName())) {
Object material = MainManager.getSmpManager().getMaterial(entry.getName());
// If given material was not found
if (!(material instanceof SMCustomBlock)) {
continue;
}
// Getting values
Integer chance = entry.getInt("Chance", 0);
Integer minY = entry.getInt("MinY", 0);
Integer maxY = entry.getInt("MaxY", 128);
Integer veins = entry.getInt("Veins", 0);
Integer veinSize = entry.getInt("VeinSize", 0);
String replaces = entry.getString("Replaces", "1 3 13");
// Calculate chance that blocks will be present in this chunk.
int rn = random.nextInt(100);
if (rn > chance) {
return;
}
// Calculate how many veins will be present in this chunk.
int howMany = random.nextInt(veins - 1) + 1;
// Calculate how large a vein may become.
int howLarge = random.nextInt(veinSize - 1) + 1;
int x;
int y;
int z;
Block curBlock;
for (int i = 0; i < howMany; i++) {
// Get a random block in this chunk.
x = random.nextInt(16);
y = random.nextInt(maxY - minY) + minY;
z = random.nextInt(16);
curBlock = chunk.getBlock(x, y, z);
// Generate this vein.
for (int j = 1; j < howLarge; j++) {
for (String replacement : replaces.split(" ")) {
if (curBlock.getTypeId() == Integer.parseInt(replacement)) {
SpoutManager.getMaterialManager().overrideBlock(curBlock, (CustomBlock) material);
}
}
rn = random.nextInt(BlockFace.values().length);
curBlock = curBlock.getRelative(BlockFace.values()[rn]);
}
}
}
}
}
| [
"[email protected]"
] | |
367a61843a9a0289f96893b816cdbbfdaf794458 | 492ab60eaa5619551af16c79c569bdb704b4d231 | /src/net/sourceforge/plantuml/code/Transcoder.java | 6c33d27d72d1fcb65d4c2b7bd3cd73caa5042e1c | [] | no_license | ddcjackm/plantuml | 36b89d07401993f6cbb109c955db4ab10a47ac78 | 4638f93975a0af9374cec8200d16e1fa180dafc2 | refs/heads/master | 2021-01-12T22:34:56.588483 | 2016-07-25T19:25:28 | 2016-07-25T19:25:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,447 | java | /* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* Original Author: Arnaud Roques
*
* Revision $Revision: 19109 $
*
*/
package net.sourceforge.plantuml.code;
import java.io.IOException;
public interface Transcoder {
public String encode(String text) throws IOException;
public String decode(String code) throws IOException;
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.