blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
19269f539c5e292ebbc41cc860d10957a1af64d6 | 116fbcad9a41a4dce36930c2b31ec036d1a7ce98 | /app/src/main/java/com/example/android/medicines/AlarmAdapter.java | 855eda62d1743d0b21f9d4c496b781fce9659757 | []
| no_license | Ahsen21/Medicines | 0ca7985a7f5541e92a60eed8185af5c2f70d4a67 | be03e284f75a38509818710cece15c6e05d3712e | refs/heads/master | 2022-12-29T01:56:16.048192 | 2020-10-14T09:04:54 | 2020-10-14T09:04:54 | 293,261,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,050 | java | package com.example.android.medicines;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
public class AlarmAdapter extends RecyclerView.Adapter<AlarmAdapter.ViewHolder> {
private List<Alarm> alarmArray;
private Context context;
AlarmAdapter(Context context, List<Alarm> alarms) {
this.alarmArray = alarms;
this.context = context;
}
@NonNull
@Override
public AlarmAdapter.ViewHolder onCreateViewHolder(
@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(context).
inflate(R.layout.row_item, parent, false));
}
@Override
public void onBindViewHolder(AlarmAdapter.ViewHolder holder, int position) {
// Get current medicine.
Alarm currentAlarm = alarmArray.get(position);
// Populate the TextViews with data.
holder.bindTo(currentAlarm);
}
@Override
public int getItemCount() {
if (alarmArray != null) {
return alarmArray.size();
} else return 0;
}
void setAlarmArray(List<Alarm> alarms) {
alarmArray = alarms;
notifyDataSetChanged();
}
public Alarm getAlarmAtPosition (int position) {
return alarmArray.get(position);
}
static class ViewHolder extends RecyclerView.ViewHolder {
// Member Variables for the TextViews
TextView alarmName;
TextView alarmTime;
ViewHolder(View itemView) {
super(itemView);
alarmName = itemView.findViewById(R.id.alarm_label);
alarmTime = itemView.findViewById(R.id.time_value);
}
void bindTo(Alarm currentAlarm) {
alarmName.setText(currentAlarm.getAlarmName() + " alarm:");
alarmTime.setText(currentAlarm.getAlarmTime());
}
}
} | [
"[email protected]"
]
| |
893a41c84edf177b030064f9923e2bd90c7bd287 | b742b210c72aa71e5bfa4f17f58e7e543f79d11d | /src/main/java/org/subnode/model/client/ErrorType.java | 2e7878d513184783352463b4956cfffc73fc4d00 | [
"MIT"
]
| permissive | BNationsDEV/quantizr | 649c0a7254f07b56174edab173c8f59f8d6a24dc | 31a1a175bc900ce9f044c6b24138e0232f9f9169 | refs/heads/master | 2023-08-05T04:32:47.896010 | 2021-09-15T15:04:12 | 2021-09-15T15:04:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package org.subnode.model.client;
public enum ErrorType {
/* Can read the node and entire subgraph of nodes it contains */
OUT_OF_SPACE("oos"), //
// not used yet.
TIMEOUT("timeout"), //
AUTH("auth"); //
public final String name;
private ErrorType(String name) {
this.name = name;
}
public String toString() {
return name;
}
public String s() {
return name;
}
}
| [
"[email protected]"
]
| |
d88d099c8a8bee3ebbcb9626dba392ede1e1b6a7 | 7c0d4bbeb65a58e2ae80191258c76960de691390 | /poc/SpaceWeatherSWD/SpaceWeatherSWD/SpaceWeatherSWD-Backend-Ejb/src/main/java/br/inpe/climaespacial/swd/indexes/BIndexScheduler.java | ea2bac59bbd9586fbd2b39b7db0d977c5d79aebf | []
| no_license | guilhermebotossi/upmexmples | 92d53f2a04d4fe53cc0bf8ead0788983d7c28a0a | 77d90477c85456b223c21e4e9a77f761be4fa861 | refs/heads/master | 2022-12-07T12:25:32.599139 | 2019-11-26T23:45:48 | 2019-11-26T23:45:48 | 35,224,927 | 0 | 0 | null | 2022-11-24T09:17:43 | 2015-05-07T14:31:30 | Java | UTF-8 | Java | false | false | 667 | java | package br.inpe.climaespacial.swd.indexes;
import java.util.concurrent.TimeUnit;
import javax.ejb.AccessTimeout;
import javax.ejb.DependsOn;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Inject;
import br.inpe.climaespacial.swd.indexes.b.services.BIndexService;
@Startup
@Singleton
@DependsOn("DefaultTimeZone")
public class BIndexScheduler {
@Inject
private BIndexService bIndexService;
@AccessTimeout(value = 5, unit = TimeUnit.MINUTES)
@Schedule(hour = "*", minute = "*", second = "20", persistent = false)
public void bIndexCalculate() {
bIndexService.calculate();
}
}
| [
"[email protected]"
]
| |
6b8896728be5edcf205e0ec147437ba8f4162461 | b107e7ae583594ad91c7e2d11db72e0c0db14980 | /src/com/marlabs/struts/FirstInterceptor.java | 0d02c670400ec2a56fd04a26aa2c8e1e2d76b409 | []
| no_license | akhileshreddy9/Struts-interceptor-demo | 060ed1d6d18fc9a8825fdd1eb5308695c8b14391 | 862765d4c8c6217d8b818075c16772c227d975fc | refs/heads/master | 2021-01-20T05:43:08.750752 | 2017-03-04T03:29:51 | 2017-03-04T03:29:51 | 83,862,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package com.marlabs.struts;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
public class FirstInterceptor implements Interceptor{
@Override
public void destroy() {
}
@Override
public void init() {
}
@Override
public String intercept(ActionInvocation actionInvocation) throws Exception {
String startInterceptor=" Start Interceptor 1";
System.out.println(startInterceptor);
String result=actionInvocation.invoke();
String endInterceptor=" End Interceptor 1";
System.out.println(endInterceptor);
return result;
}
}
| [
"[email protected]"
]
| |
7ca47087e5e70b6a08fe5ab2999bca9995ab68c2 | eb9f655206c43c12b497c667ba56a0d358b6bc3a | /java/java-tests/testData/codeInsight/overrideImplement/beforeInterfaceAndAbstractClass.java | 74b4f0a7bcede14d3e077a8928766a0c17a283f2 | [
"Apache-2.0"
]
| permissive | JetBrains/intellij-community | 2ed226e200ecc17c037dcddd4a006de56cd43941 | 05dbd4575d01a213f3f4d69aa4968473f2536142 | refs/heads/master | 2023-09-03T17:06:37.560889 | 2023-09-03T11:51:00 | 2023-09-03T12:12:27 | 2,489,216 | 16,288 | 6,635 | Apache-2.0 | 2023-09-12T07:41:58 | 2011-09-30T13:33:05 | null | UTF-8 | Java | false | false | 156 | java | abstract class A {
public abstract D foo();
}
interface B {
F foo();
}
class C extends A implements B {
<caret>
}
class D {}
class F extends D {} | [
"[email protected]"
]
| |
277704643a2bc520e6f5a0aebfc4d0ae4149aa1c | cf5d5f57f06ab41b770f1ab8cadc34581efad207 | /src/main/java/com/shitao/common/entity/ResponseJson.java | 1e51fa877cdeb06ffcf60b10c14da5fb9e8a3e4f | [
"Apache-2.0"
]
| permissive | csTaoo/springmvc-shiro | 7729601e4ac9ff58336c3dbf9600d908e75ecbbd | 29e643de0253bec6943124e1f53a9e3229964d9b | refs/heads/master | 2021-01-22T13:22:14.059698 | 2018-03-13T02:34:41 | 2018-03-13T02:34:41 | 100,667,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.shitao.common.entity;
public class ResponseJson {
private String httpStatus;
private String message;
public ResponseJson(String status ,String mes)
{
this.httpStatus = status;
this.message = mes;
}
public String getHttpStatus() {
return httpStatus;
}
public void setHttpStatus(String httpStatus) {
this.httpStatus = httpStatus;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
| [
"[email protected]"
]
| |
6e25b351742969742d333f48a108c7ebff73d98a | 58da62dfc6e145a3c836a6be8ee11e4b69ff1878 | /src/main/java/com/alipay/api/response/AlipayBossFncSubaccountBalanceFreezeResponse.java | 7c0b740f93eb7e00a3ef5c6cb0e05c93eb5cb653 | [
"Apache-2.0"
]
| permissive | zhoujiangzi/alipay-sdk-java-all | 00ef60ed9501c74d337eb582cdc9606159a49837 | 560d30b6817a590fd9d2c53c3cecac0dca4449b3 | refs/heads/master | 2022-12-26T00:27:31.553428 | 2020-09-07T03:39:05 | 2020-09-07T03:39:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.domain.SubAccountBalanceFreezeResultOpenApiDTO;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.boss.fnc.subaccount.balance.freeze response.
*
* @author auto create
* @since 1.0, 2020-08-31 19:45:14
*/
public class AlipayBossFncSubaccountBalanceFreezeResponse extends AlipayResponse {
private static final long serialVersionUID = 8321813951391639324L;
/**
* 子户余额冻结结果open api数据传输对象
*/
@ApiField("result_set")
private SubAccountBalanceFreezeResultOpenApiDTO resultSet;
public void setResultSet(SubAccountBalanceFreezeResultOpenApiDTO resultSet) {
this.resultSet = resultSet;
}
public SubAccountBalanceFreezeResultOpenApiDTO getResultSet( ) {
return this.resultSet;
}
}
| [
"[email protected]"
]
| |
7b7a210db9ae8c308640011d082bb7ae0908915a | 9ccb35ce763b75689911a36a5a8d68106448a4cb | /PillApp/app/src/main/java/edu/uw/lucav17/pillapp/Home.java | 0a8e805292fd81cb94065a215dcd519ffd4f5e41 | []
| no_license | Lucav17/Pill-App | ab91a868d4bf91bfabf40f6c12897b1833992a26 | d89cebb7c4cc513a357e7fbc047a016396d2c6c8 | refs/heads/master | 2020-04-05T22:42:32.260701 | 2016-08-07T20:47:36 | 2016-08-07T20:47:36 | 64,622,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | package edu.uw.lucav17.pillapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Home extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.log_in_layout);
/*
boolean loginStatus = MyApplication.preferences.getBoolean("isLoggedIn", false);
if(!loginStatus) {
} else {
//setContentView(R.layout.activity_home);
} */
}
}
| [
"luca vaccarini"
]
| luca vaccarini |
4396270619df75dbad34c26cc850d90d344782e8 | 1947e49a157817576aba57f2f57905646cddd3e6 | /Chess28/src/chess/Knight.java | cff762b03149af79f33ba16a9731abb235edd7e0 | []
| no_license | anshshah96/Chess-Java | f55f21b569350c0665cc8708fce577cd41ca4d5b | 1038e45f298548872df1ac2283776728bed6e732 | refs/heads/master | 2020-05-29T23:59:54.153047 | 2019-05-30T16:54:29 | 2019-05-30T16:54:29 | 189,449,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,021 | java | package chess;
/**
* Knight class that portray a knight's behavior
*
* @author Ansh Shah, Kandarp Patel
*
*/
public class Knight implements Piece{
/** Row index of the Knight's location */
int row;
/** Column index of the Knight's location */
int col;
/** If Knight is still alive */
boolean isAlive = true;
/**
* Constructor - initializes the fields
*
* @param col Column index of the Knight
* @param row Row index of the Knight
*/
public Knight(int col, int row) {
this.row = row;
this.col = col;
}
/**
* This method will return the row of that piece
* @return int Current row of the piece
*/
@Override
public int getRow() {
return row;
}
/**
* This method will return the column of that piece
* @return int Current column of the piece
*/
@Override
public int getCol() {
return col;
}
/**
* This method will return true if that piece has not yet been captured
* @return boolean Returns true if piece is still alive
*/
@Override
public boolean isAlive() {
return isAlive;
}
/**
* This method checks if the proposed move is valid for that piece based off of the path it can take
* @param currCol Index of the current column
* @param currRow Index of the current row
* @param tarCol Index of the target column
* @param tarRow Index of the target row
* @param color Color of the piece
* @return boolean Returns true if the proposed move is valid for that piece
*/
@Override
public boolean moveValid(int currCol, int currRow, int tarCol, int tarRow, char color) {
if(Math.abs(currCol - tarCol) == 1 && Math.abs(currRow - tarRow) == 2)
return true;
if(Math.abs(currCol - tarCol) == 2 && Math.abs(currRow - tarRow) == 1)
return true;
return false;
}
/**
* This method changes the row and column fields of that piece when moved
* @param toRow Index of the target row
* @param toCol Index of the target column
*/
@Override
public void move(int toRow, int toCol) {
row = toRow;
col = toCol;
}
}
| [
"[email protected]"
]
| |
b28afdc6ae5ad9eb536f8642635a23b0422075a9 | b9da835890859001d26897da438ef838934f7745 | /src/main/java/net/mightypork/rpw/tree/assets/tree/AssetTreeGroup.java | bab024f09001a01bc6a83c8005018672dd7088d3 | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | itsmemac/MC-Pack-Workbench | 18bd06ec8939c4427db3b4642158a929d3094748 | f0496913ae384ede515f816a31189a465a8db7e6 | refs/heads/master | 2023-04-01T04:30:45.086141 | 2021-04-10T03:37:02 | 2021-04-10T03:37:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,535 | java | package net.mightypork.rpw.tree.assets.tree;
import javax.swing.tree.TreeNode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
public class AssetTreeGroup extends AssetTreeNode {
public ArrayList<AssetTreeNode> children = new ArrayList<AssetTreeNode>();
public String groupKey;
public AssetTreeGroup(String groupKey, String label, String librarySource) {
super(label, librarySource);
this.groupKey = groupKey;
}
/**
* Get asset key
*
* @return asset key
*/
public String getGroupKey() {
return groupKey;
}
@Override
public boolean isLeaf() {
return false;
}
@Override
public int getChildCount() {
return children.size();
}
@Override
public int getIndex(TreeNode child) {
return children.indexOf(child);
}
@Override
public AssetTreeNode getChildAt(int index) {
return children.get(index);
}
/**
* Add a child to this group
*
* @param child
*/
public void addChild(AssetTreeNode child) {
this.children.add(child);
child.setParent(this);
}
@Override
public void prepareForDisplay() {
Collections.sort(children);
for (final AssetTreeNode node : children) {
node.prepareForDisplay();
}
for (int i = children.size() - 1; i >= 0; i--) {
final AssetTreeNode child = children.get(i);
if (! child.isLeaf() && child.getChildCount() == 0) {
children.remove(i);
}
}
}
@Override
public void processThisAndChildren(AssetTreeProcessor processor) {
processor.process(this);
for (final AssetTreeNode node : children) {
node.processThisAndChildren(processor);
}
}
@Override
public Enumeration children() {
return Collections.enumeration(children);
}
@Override
public List<AssetTreeNode> getChildrenList() {
return children;
}
@Override
public boolean isDirectory() {
return true;
}
@Override
public boolean isFile() {
return false;
}
@Override
public boolean isSound() {
return false;
}
@Override
public boolean isImage() {
return false;
}
@Override
public boolean isText() {
return false;
}
@Override
public boolean isJson() {
return false;
}
}
| [
"[email protected]"
]
| |
3ce616ecb58b64d207fb1a38f9023b20fd5ede34 | 793de3b9626d8405fe1b5d34258b453feddbc3c1 | /core/src/main/java/com/github/automain/bean/SysConfig.java | a1cefbdda522f327e2eda1755e244959dc8a3b1f | [
"MIT"
]
| permissive | automain/automain | 000204f5a3aed35a949a9a7fde20a1266ae7d3b2 | cf6f077bde753c782845a7cb36b9dac7a22e008f | refs/heads/master | 2022-06-23T15:30:53.591965 | 2020-03-13T10:01:55 | 2020-03-13T10:01:55 | 124,373,109 | 2 | 0 | MIT | 2022-06-20T23:29:27 | 2018-03-08T10:06:05 | Java | UTF-8 | Java | false | false | 3,900 | java | package com.github.automain.bean;
import com.github.fastjdbc.BaseBean;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
public class SysConfig implements BaseBean<SysConfig> {
// 主键
private Integer id;
// 创建时间
private Integer createTime;
// 更新时间
private Integer updateTime;
// 是否有效(0:否,1:是)
private Integer isValid;
// 配置项键
private String configKey;
// 配置项值
private String configValue;
// 配置项描述
private String configRemark;
public Integer getId() {
return id;
}
public SysConfig setId(Integer id) {
this.id = id;
return this;
}
public Integer getCreateTime() {
return createTime;
}
public SysConfig setCreateTime(Integer createTime) {
this.createTime = createTime;
return this;
}
public Integer getUpdateTime() {
return updateTime;
}
public SysConfig setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getIsValid() {
return isValid;
}
public SysConfig setIsValid(Integer isValid) {
this.isValid = isValid;
return this;
}
public String getConfigKey() {
return configKey;
}
public SysConfig setConfigKey(String configKey) {
this.configKey = configKey;
return this;
}
public String getConfigValue() {
return configValue;
}
public SysConfig setConfigValue(String configValue) {
this.configValue = configValue;
return this;
}
public String getConfigRemark() {
return configRemark;
}
public SysConfig setConfigRemark(String configRemark) {
this.configRemark = configRemark;
return this;
}
@Override
public String tableName() {
return "sys_config";
}
@Override
public Map<String, Object> columnMap(boolean all) {
Map<String, Object> map = new HashMap<String, Object>(7);
if (all || this.getId() != null) {
map.put("id", this.getId());
}
if (all || this.getCreateTime() != null) {
map.put("create_time", this.getCreateTime());
}
if (all || this.getUpdateTime() != null) {
map.put("update_time", this.getUpdateTime());
}
if (all || this.getIsValid() != null) {
map.put("is_valid", this.getIsValid());
}
if (all || this.getConfigKey() != null) {
map.put("config_key", this.getConfigKey());
}
if (all || this.getConfigValue() != null) {
map.put("config_value", this.getConfigValue());
}
if (all || this.getConfigRemark() != null) {
map.put("config_remark", this.getConfigRemark());
}
return map;
}
@Override
public SysConfig beanFromResultSet(ResultSet rs) throws SQLException {
return new SysConfig()
.setId(rs.getInt("id"))
.setCreateTime(rs.getInt("create_time"))
.setUpdateTime(rs.getInt("update_time"))
.setIsValid(rs.getInt("is_valid"))
.setConfigKey(rs.getString("config_key"))
.setConfigValue(rs.getString("config_value"))
.setConfigRemark(rs.getString("config_remark"));
}
@Override
public String toString() {
return "SysConfig{" +
"id=" + id +
", createTime=" + createTime +
", updateTime=" + updateTime +
", isValid=" + isValid +
", configKey='" + configKey + '\'' +
", configValue='" + configValue + '\'' +
", configRemark='" + configRemark + '\'' +
'}';
}
} | [
"[email protected]"
]
| |
34f4bf378aeaa27b2fad1b5f878b0ada8f8576dc | 29196e2d4adfb14ddd7c2ca8c1e60f8c10c26dad | /src/main/java/it/csi/siac/siaccecser/model/CECDataDictionary.java | 8b3111c3aacd1e817d6b9e77d772664a90a349d1 | []
| no_license | unica-open/siacbilitf | bbeef5ceca40e9fb83d5b1176e7f54e8d84592bf | 85f3254c05c719a0016fe55cea1a105bcb6b89b2 | refs/heads/master | 2021-01-06T14:51:17.786934 | 2020-03-03T13:27:47 | 2020-03-03T13:27:47 | 241,366,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 420 | java | /*
*SPDX-FileCopyrightText: Copyright 2020 | CSI Piemonte
*SPDX-License-Identifier: EUPL-1.2
*/
package it.csi.siac.siaccecser.model;
/**
* Caratteristiche del Data Dictionary di CEC. Contiene la versione corrente del
* dd
*
*
* @author Domenico
*
*/
public interface CECDataDictionary {
String VERSION = "1.0";
String NAME = "cec";
String NAMESPACE = "http://siac.csi.it/" + NAME + "/data/" + VERSION;
}
| [
"[email protected]"
]
| |
c6832c6fc2cce322d340749964ddd2bb9aaf3154 | d1dea6217a38ff6f92bc955504a82d8da62d49c2 | /PepCoding/src/sept_01_2018/graph_001/Topic_002_ArtculationPointAndEdge.java | 7d2ae3b1f4e898dec438cf8be74bc280ae0664f3 | []
| no_license | rajneeshkumar146/java_workspace | fbdf12d0a8f8a99f6a800d3a9fa37dac9ec81ac5 | f77fbbb82dccbb3762fd27618dd366388724cf9b | refs/heads/master | 2020-03-31T04:51:22.151046 | 2018-10-27T11:54:20 | 2018-10-27T11:54:20 | 151,922,604 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | package sept_01_2018.graph_001;
import java.util.Scanner;
public class Topic_002_ArtculationPointAndEdge {
public static Scanner scn = new Scanner(System.in);
static int[][] graph;
static int[] discT, lowT, parent;
static boolean[] isdone, isAP;
static int time = 0;
public static void main(String[] args) throws Exception {
graph = new int[6][6];
graph[0][1] = 1;
graph[1][0] = 1;
graph[0][5] = 1;
graph[5][0] = 1;
graph[1][3] = 1;
graph[3][1] = 1;
graph[1][2] = 1;
graph[2][1] = 1;
graph[3][4] = 1;
graph[4][3] = 1;
graph[3][2] = 1;
graph[2][3] = 1;
graph[2][4] = 1;
graph[4][2] = 1;
discT = new int[graph.length];
lowT = new int[graph.length];
parent = new int[graph.length];
isdone = new boolean[graph.length];
isAP = new boolean[graph.length];
solve();
}
public static void solve() throws Exception {
for (int i = 0; i < graph.length; i++) {
if (isdone[i]) {
continue;
}
parent[i] = -1;
DFT(i);
}
for (int i = 0; i < isAP.length; i++) {
if (isAP[i]) {
System.out.println(i);
}
}
}
private static void DFT(int src) {
isdone[src] = true;
discT[src] = lowT[src] = ++time;
int count = 0;
for (int i = 0; i < graph[0].length; i++) {
if (graph[src][i] == 0) { // Not_A_vertex.
continue;
}
if (!isdone[i]) { // freshNbrs.
count++;
parent[i] = src;
DFT(i);
lowT[src] = Math.min(lowT[i], lowT[src]);
if (parent[src] != -1) {
if (lowT[i] >= discT[src]) {
// System.out.println(src);
isAP[src] = true;
}
} else if (parent[src] == -1) { // root.
if (count > 1) {
// System.out.println(src);
isAP[src] = true;
}
}
} else if (parent[src] != i) {
lowT[src] = Math.min(lowT[src], discT[i]);
}
}
}
}
| [
"[email protected]"
]
| |
5890d51391fe20c1b2489c758799b978721cc373 | b403f3efd5a1567bc5c0294990421b1340a11958 | /src/main/java/nl/hu/v1wac/firstapp/persistence/CountryDAO.java | f73a84cff4ff5e8c70c1fa3cc0059a5a72b33b05 | []
| no_license | justinwilkes/WAC-Opdrachten | e5740c1b886300cd3fbc162f30c7616ecf18e63d | 6e5e9b986ba32328842fedfdb5e28950035359af | refs/heads/master | 2021-03-16T07:29:31.742681 | 2017-06-06T12:54:03 | 2017-06-06T12:54:03 | 92,818,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,120 | java | package nl.hu.v1wac.firstapp.persistence;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import nl.hu.v1wac.firstapp.model.Country;
public class CountryDAO extends BaseDAO {
public Country save(Country country) {
Connection connection = super.getConnection();
try {
PreparedStatement statement = connection.prepareStatement("INSERT INTO country VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
if(statement != null) {
statement.setString(1, country.getIso3Code());
statement.setString(2, country.getName());
statement.setString(3, country.getContinent());
statement.setString(4, country.getRegion());
statement.setDouble(5, country.getSurface());
statement.setInt(6, 0);
statement.setDouble(7, country.getPopulation());
statement.setInt(8, 0);
statement.setInt(9, 0);
statement.setInt(10, 0);
statement.setInt(11, 0);
statement.setString(12, country.getGovernment());
statement.setInt(13, 0);
statement.setString(14, country.getCode());
statement.setDouble(15, country.getLatitude());
statement.setDouble(16, country.getLongitude());
statement.setString(17, country.getCapital());
try {
statement.executeUpdate();
} catch(Exception ex) { ex.printStackTrace(); }
statement.close();
}
} catch (Exception ex) { ex.printStackTrace(); }
return findByCode(country.getCode());
}
public List<Country> findAll() {
Connection connection = super.getConnection();
List<Country> results = new ArrayList<Country>();
try {
Statement stmt = connection.createStatement();
ResultSet dbResultSet = stmt.executeQuery("SELECT * FROM country ORDER BY name");
while (dbResultSet.next()) {
String iso2cd = dbResultSet.getString("code2");
String iso3cd = dbResultSet.getString("code");
String name = dbResultSet.getString("name");
String capital = dbResultSet.getString("capital");
String continent = dbResultSet.getString("continent");
String region = dbResultSet.getString("region");
double surface = dbResultSet.getDouble("surfacearea");
int population = dbResultSet.getInt("population");
String government = dbResultSet.getString("governmentform");
double lat = dbResultSet.getDouble("latitude");
double lon = dbResultSet.getDouble("longitude");
Country country = new Country(iso2cd, iso3cd, name, capital, continent, region, surface, population, government, lat, lon);
results.add(country);
}
} catch (SQLException sqle) { sqle.printStackTrace(); }
return results;
}
public Country findByCode(String code) {
List<Country> countries = new ArrayList<Country>(findAll());
for (Country c : countries) {
if (c.getCode().equals(code)) return c;
}
return null;
}
public List<Country> find10LargestPopulations() {
List<Country> countries = new ArrayList<Country>(findAll());
Collections.sort(countries, new Comparator<Country>() {
public int compare(Country c1, Country c2) {
return (int)(c2.getPopulation() - c1.getPopulation());
}
});
return countries.subList(0, 10);
}
public List<Country> find10LargestSurfaces() {
List<Country> countries = new ArrayList<Country>(findAll());
Collections.sort(countries, new Comparator<Country>() {
public int compare(Country c1, Country c2) {
return (int)(c2.getSurface() - c1.getSurface());
}
});
return countries.subList(0, 10);
}
public Country update(Country country) {
Connection connection = super.getConnection();
System.out.println(country.getContinent());
try {
PreparedStatement statement = connection.prepareStatement("UPDATE country SET name=?, continent=?::continenttype, region=?, surfacearea=?, population=?, governmentform=?, code2=?, latitude=?, longitude=?, capital=? WHERE code=?");
statement.setString(1, country.getName());
statement.setString(2, country.getContinent());
statement.setString(3, country.getRegion());
statement.setDouble(4, country.getSurface());
statement.setInt(5, country.getPopulation());
statement.setString(6, country.getGovernment());
statement.setString(7, country.getCode());
statement.setDouble(8, country.getLatitude());
statement.setDouble(9, country.getLongitude());
statement.setString(10, country.getCapital());
statement.setString(11, country.getIso3Code());
statement.executeUpdate();
statement.close();
} catch (SQLException ex) { ex.printStackTrace(); }
return findByCode(country.getCode());
}
public boolean delete(Country country) {
Connection connection = super.getConnection();
try {
PreparedStatement statement = connection.prepareStatement("DELETE FROM country WHERE code=?");
statement.setString(1, country.getIso3Code());
statement.executeUpdate();
statement.close();
return true;
} catch (SQLException ex) { ex.printStackTrace(); }
return false;
}
}
| [
"[email protected]"
]
| |
9485ef4b44813bf90d8d81fefb4dc0bb9a33d4d0 | 080520516eb9a2bd9e6db1b0e8f6377a6e023df6 | /src/khalil/solutions/Problem467A.java | d0b40e41e3742c35531c37803c119681ca41a47f | []
| no_license | khalilahmed232/codeforces | 8326e0751bd28eb82374b61dacfa29517ce954f7 | 9f3b2b21815928a011187ae5099f60d65f621df8 | refs/heads/main | 2023-06-17T07:14:54.530447 | 2021-07-18T20:16:24 | 2021-07-18T20:16:24 | 387,258,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package khalil.solutions;
import java.util.Scanner;
public class Problem467A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] p = new int[n];
int[] q = new int[n];
int rooms = 0;
for ( int i = 0 ; i < n ; i++ )
{
p[i] = in.nextInt();
q[i] = in.nextInt();
rooms += ( q[i] - p[i] ) >= 2 ? 1 : 0;
}
in.close();
System.out.println(rooms);
}
}
| [
"[email protected]"
]
| |
343fa7692c6204f4e80dad0e6836b00e40e03631 | 7b660d8f09340f5a2523f962549c0a42800fd1bc | /workspace/Chess/src/br/com/abacomm/agilejava/chess/exception/ConvertIndexException.java | 558b182956b840a0e9626f653f00b57f48faccd3 | []
| no_license | foguinhoperuca/agile-java | 54439b608cd81878806ddfd10fd15bca647adea9 | 77e3789cfb061e305c26462e31ab39ea590d911a | refs/heads/master | 2021-01-01T18:55:22.306938 | 2011-07-25T00:37:19 | 2011-07-25T00:37:19 | 2,287,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package br.com.abacomm.agilejava.chess.exception;
public class ConvertIndexException extends Exception {
private static final long serialVersionUID = -8233076966259795066L;
@Override
public String getMessage() {
return "Error to convert index: index dont are between a and h!";
}
}
| [
"[email protected]"
]
| |
829687555fe7f804e7448ca3fe8111ae9af63096 | b40a28d249bb907a67ecf209a59205c0b2c5c35c | /src/test/java/config/typed/runtime/DefValStr_GlobalYes_LocalYesIT.java | b93a3a837ea715b004fdbb70bcba8af890ec922a | []
| no_license | ArekLopus/ConfiguratorTest | 1268347ca6e48234ab3fd2b29c914f1098ba5baa | ab724ea9d75f869fb52a9d9ea36be0254ab4df05 | refs/heads/master | 2021-08-07T15:51:04.388217 | 2019-12-10T18:10:53 | 2019-12-10T18:10:53 | 227,130,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,321 | java | package config.typed.runtime;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.HashSet;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import configurator.TypedProperty;
public class DefValStr_GlobalYes_LocalYesIT {
Client client;
boolean runtime = false;
@Before
public void init() {
client = ClientBuilder.newClient();
WebTarget getRuntime = client.target("http://localhost:8080/ConfiguratorTest/res/config/getRuntime");
Response resp = getRuntime.request(MediaType.TEXT_PLAIN).get();
runtime = resp.readEntity(Boolean.class);
}
@After
public void clean() {
WebTarget getRuntime = client.target("http://localhost:8080/ConfiguratorTest/res/config/changeRuntime/" + runtime);
getRuntime.request(MediaType.TEXT_PLAIN).get();
client.close();
}
@Test
// If both true, always reload. If requested target changed we can see the change in the next request.
public void typed_String_DefVal_runtimeCheckTrue_AnnotationRuntimeCheckYes() {
HashSet<String> newPaths = new HashSet<String>(Arrays.asList("/config/prop1changed.properties"));
HashSet<String> oldPaths = client.target("http://localhost:8080/ConfiguratorTest/res/config/getOldPaths").request(MediaType.APPLICATION_JSON).get(new GenericType<HashSet<String>>(){});
WebTarget setOldPaths = client.target("http://localhost:8080/ConfiguratorTest/res/config/setOldPaths");
WebTarget setNewPaths = client.target("http://localhost:8080/ConfiguratorTest/res/config/setNewPaths");
WebTarget setRuntimecheckToTrue = client.target("http://localhost:8080/ConfiguratorTest/res/config/changeRuntime?runtime=true");
WebTarget runtimeCheck = client.target("http://localhost:8080/ConfiguratorTest/res/config/typedDefValGlobalRuntimeYesLocalRuntimeYes/test");
setRuntimecheckToTrue.request().get();
Response requestForFirstTimeResponse = runtimeCheck.request().get();
setNewPaths.request().post(Entity.entity(newPaths, MediaType.APPLICATION_JSON));
Response checkAfterChangeResponse = runtimeCheck.request().get();
setOldPaths.request().post(Entity.entity(oldPaths, MediaType.APPLICATION_JSON));
TypedProperty<String> entity = requestForFirstTimeResponse.readEntity(new GenericType<TypedProperty<String>>(){});
//String entity = requestForFirstTimeResponse.readEntity(String.class);
assertNotNull(entity);
// first check
assertNotNull(entity.getDefaultValue());
assertThat(entity.getDefaultValue(), instanceOf(String.class));
assertThat(entity.getDefaultValue(), is("This is a default value property from the file 'prop1.properties'"));
// after change check
entity = checkAfterChangeResponse.readEntity(new GenericType<TypedProperty<String>>(){});
assertNotNull(entity.getDefaultValue());
assertThat(entity.getDefaultValue(), instanceOf(String.class));
assertThat(entity.getDefaultValue(), is("testFilePropDefVal changed."));
}
}
| [
"[email protected]"
]
| |
84a58b5ea04c34594ddfca46a88920aa0053f584 | c33b8307aa456d65184173e0fb1113a50f40dbd4 | /java/testDate/src/cn/bjsxt/test/TestDate.java | 47101f46e580c316faa58622b475327c3bd7eaec | []
| no_license | h5codefans/urlresource | 9ed1d40fcafa616f7dabbd2424a5206738458b3c | 163c843c5827f5a236c1f98b97b0c6fd85c79e17 | refs/heads/master | 2023-03-26T21:43:51.138430 | 2021-03-28T09:00:55 | 2021-03-28T09:00:55 | 302,877,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 493 | java | package cn.bjsxt.test;
import java.util.Date;
/**
* 测试Date的用法
* @author Administrator
*
*/
public class TestDate {
public static void main(String[] args){
Date d=new Date();
long t=System.currentTimeMillis();
System.out.println(t);
Date d2=new Date(1000);
System.out.println(d2.toGMTString()); //不建议使用
d2.setTime(20000);
System.out.println(d2.getTime());
System.out.println(d.getTime()<d2.getTime());
}
}
| [
"[email protected]"
]
| |
cc1d35ab2965af66daf804e8280ebd06363e88dc | eaff0208742cdb563412a42c2a72b91040fae51d | /TEST100/src/TEST100/Test51_sum67.java | 5d802c50d360a310ed225fd36cc6835345c8a58e | []
| no_license | liuyi-CSU/JavaStudy | 5864fa5a70012b188ed01ded264dc3730a82c910 | 9b7573797a1b45fcaf9480fe6466b5552ee85084 | refs/heads/master | 2020-06-19T21:14:36.375494 | 2016-12-18T15:02:08 | 2016-12-18T15:02:08 | 74,832,616 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,516 | java | package TEST100;
public class Test51_sum67 {
/**
* 类中有一个方法,方法名sum67;
有一个整型数组,返回数组中的数字的总和,如果数组含有数6和7那么忽略不计入从6开始并延伸到有7的数字段(每6个将跟随至少一个7)。
返回0表示没有数字。
提示:
方法调用 期望值
sum67(1,2,2) 5
sum67(1,2,2,6,99,99,7) 5
sum67(1,1,6,7,2) 4
sum67(1,6,6,2,2,7,1,6,99,99,7) 2
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr={1,6,6,2,2};
//System.out.println(sum67_1(arr));
System.out.println(sum67_2(arr));
}
private static int sum67_1(int[] arr) {//此方法可以处理没有7的情况
// TODO Auto-generated method stub
int sum1=0;
int sum2=0;
int index6=-1;
int index7=-1;
for (int i = 0; i < arr.length; i++) {
sum1+=arr[i];
if((arr[i]==6)&&(index7==-1)&&(index6==-1)){
index6=i;
}
if((arr[i]==7)&&(index6!=-1)&&(index7==-1)){
index7=i;
}
if((index6!=-1)&&(index7!=-1)){
for(int j=index6;j<=index7;j++){
sum2+=arr[j];
}
sum1=sum1-sum2;
index6=-1;
index7=-1;
sum2=0;
}
}
return sum1;
}
public static int sum67_2(int[] arr){//此方法 不 可以处理没有7的情况
int sum=0;
for (int i = 0; i < arr.length; i++) {
if (arr[i]==6) {
while (true) {
i++;
if (arr[i]==7) {
break;
}
}
continue;
}
sum+=arr[i];
}
return sum;
}
}
| [
"[email protected]"
]
| |
0e70fd67e3ef56601d9d1158278bff26013ec737 | 92cbfa3ae861dcab955626328f70318addf6aa36 | /app/src/main/java/yixiao/gamestore/common/GameFragmentManager.java | a04d65071e7b06d007686ae3287fd7bc5508a27b | []
| no_license | YixiaoTang/GameStore | eb0716c188231b816f2f9077d19748d550ef958c | e6b0532741cd09c8ce7072af1e1c6d6c73f6adaa | refs/heads/master | 2020-04-11T13:11:29.568414 | 2018-11-22T23:38:21 | 2018-11-22T23:38:21 | 161,807,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 145 | java | package yixiao.gamestore.common;
public interface GameFragmentManager {
void doFragmentTransaction(GameBasicFragment basicFragment);
}
| [
"[email protected]"
]
| |
15d9a16c1f2b0e275508e491f09407f068a085a7 | 223f68d2c4227f92b7b4c547960e8fd34c505e9b | /app/src/main/java/se/skeppstedt/swimpy/ShowSwimmerActivity.java | d57be69ad753b74ae61f86ca2cc9d4f0313479e1 | []
| no_license | niklasskeppstedt/SwimpyAndroid | 83f3600f7f0441cbc39a72859df14f2f78e55ad5 | c514b00c4c46e110abefd65ba386769e23a02739 | refs/heads/master | 2021-01-22T16:38:00.594331 | 2015-11-19T10:46:14 | 2015-11-19T10:46:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,125 | java | package se.skeppstedt.swimpy;
import android.content.Intent;
import android.database.DataSetObserver;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import se.skeppstedt.swimpy.application.PersonalBest;
import se.skeppstedt.swimpy.application.Swimmer;
import se.skeppstedt.swimpy.application.SwimmerApplication;
import se.skeppstedt.swimpy.application.enumerations.Event;
import se.skeppstedt.swimpy.listadapter.PersonalBestListAdapter;
public class ShowSwimmerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getIntent().getExtras();
String swimmerid = bundle.getString("swimmerid");
final Swimmer swimmer = ((SwimmerApplication) getApplication()).getSwimmer(swimmerid);
setContentView(R.layout.activity_show_swimmer);
setUpHeader(swimmer);
setUpPersonalBests(swimmer.getPersonalBests());
FloatingActionButton addButton = (FloatingActionButton) findViewById(R.id.addPersonalBestButton);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(getClass().getSimpleName(), "Add personal best buttobn clicked");
Intent intent = new Intent(ShowSwimmerActivity.this, AddPersonalBestActivity.class);
intent.putExtra("swimmerid", swimmer.octoId);
startActivity(intent);
}
});
}
@Override
protected void onResume() {
super.onResume();
Log.d(getClass().getSimpleName(), "onResume...");
Bundle bundle = getIntent().getExtras();
String swimmerid = bundle.getString("swimmerid");
final Swimmer swimmer = ((SwimmerApplication) getApplication()).getSwimmer(swimmerid);
setUpPersonalBests(swimmer.getPersonalBests());
}
private void setUpHeader(Swimmer swimmer) {
TextView nameText = (TextView) findViewById(R.id.nameText);
nameText.setText(swimmer.name);
TextView clubText = (TextView) findViewById(R.id.clubText);
clubText.setText(swimmer.club);
TextView yearOfBirthText = (TextView) findViewById(R.id.yearText);
yearOfBirthText.setText(swimmer.yearOfBirth);
}
private void setUpPersonalBests(List<PersonalBest> personalBests) {
ListView personalBestList = (ListView) findViewById(R.id.personalBestList);
//personalBestList.setAdapter(new ArrayAdapter<PersonalBest>(this,R.layout.personalbest, personalBests));
personalBestList.setAdapter(new PersonalBestListAdapter(this, personalBests));
}
}
| [
"[email protected]"
]
| |
03fbd76e4245e103e927cdbd1f6bf26218fa73c4 | 18300445fdb25c33991cf1836884105b5909ca53 | /hummingbird_server/src/main/java/com/wqh/hummingbird/server/common/bo/DataPointPageBO.java | 1c4dced9c3342fe53e4f03d74657ac71c50c7b8c | []
| no_license | redwolf2019/HummingBirdApplication | 5964846fb78f9986d462af289f4cf8a255ded9ff | 9e74070426249d976d924d9044255f22b7db87f5 | refs/heads/master | 2022-06-24T02:41:54.598519 | 2019-08-17T16:42:55 | 2019-08-17T16:42:55 | 202,906,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.wqh.hummingbird.server.common.bo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DataPointPageBO extends BasePage {
private Integer deviceTypeId;
}
| [
"[email protected]"
]
| |
b3b8387b372d0e28dd2efa03f8795ca681037b90 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XWIKI-12798-89-23-NSGA_II-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/XWiki_ESTest_scaffolding.java | 292a1c780b14a5940784d471e19d38006607335b | []
| no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Apr 02 18:54:11 UTC 2020
*/
package com.xpn.xwiki;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class XWiki_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
]
| |
7edef681a62606ac9729c6567bf0e0706ace7386 | 7dfb517aeff5c983036a015efae38e0fe42185ee | /builder-pattern-demo-with-lombok/src/main/java/com/java/exception/ExceptionResponse.java | 938e193e047346f1ab14151bfc0fd23c165cfdf4 | []
| no_license | akshayhavale/builder-pattern-with-lombok | f7bda0241514268dbfec0ca10b7f7e762f7c9679 | 8dccc843dd9dc4957d706b5cd0043f0dded486e2 | refs/heads/main | 2022-12-28T12:41:41.853405 | 2020-10-15T07:35:49 | 2020-10-15T07:35:49 | 304,245,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | package com.java.exception;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ExceptionResponse {
private String message;
private String url;
}
| [
"[email protected]"
]
| |
320bec79d6b22fed389134e209cc856fa7be49d6 | bfb16637837dcfcd8605e076ecd70e74c14f9b26 | /src/main/java/cn/eli486/imp/Demo4.java | efe99195fdb4fa0c5e949c7d3bec9b316371d6c2 | []
| no_license | eli719/crawler | 644aac4f4e99ca5cd0c7e3c5e72be457e98a06d7 | a0248c4d94cd3e9a588e8133e0425db0cfa61e01 | refs/heads/master | 2022-06-30T07:38:27.910200 | 2020-04-22T10:39:56 | 2020-04-22T10:39:56 | 243,663,767 | 0 | 0 | null | 2022-06-17T02:54:02 | 2020-02-28T02:44:42 | Java | UTF-8 | Java | false | false | 4,977 | java | package cn.eli486.imp;
import cn.eli486.excel.AbstractionVerify;
import cn.eli486.utils.WebUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author eli
*/
public class Demo4 extends AbstractionVerify {
@Override
protected void login () throws IOException {
System.out.println (client);
String str = "";
loginParams.put("username", "ys");
loginParams.put("password", "welcome123");
loginParams.put("isMoblie", "false");
str = WebUtil.httpPost (client, loginParams, "http://e.hjt360.cn/login/vali");
str = WebUtil.httpGet (client, "http://e.hjt360.cn/index.html");
}
@Override
protected void login (CloseableHttpClient client, Map<String, String> params) throws Exception {
}
@Override
protected String getLoginUrl () {
return "http://e.hjt360.cn/login/login.html";
}
@Override
public void addVerifyCodeParam (String verifyCode) {
loginParams.put("authCode", verifyCode);
}
@Override
protected String getPictureUrl () {
return "http://e.hjt360.cn/authimg";
}
@Override
public List<List<String>> getPurchase (CloseableHttpClient client, List<String> title) {
return null;
}
@Override
public List<String> createPurchase () {
return null;
}
@Override
public List<List<String>> getSale (CloseableHttpClient client, List<String> title) throws IOException {
return null;
}
@Override
public List<String> createSale () {
return null;
}
@Override
public List<List<String>> getStock (CloseableHttpClient client, List<String> title) throws IOException {
List<String> rows = null;
String str = WebUtil.httpGet (client, "http://e.hjt360.cn/bill/view/multibill?billKey=changjiakucunquery");
loginParams.clear();
loginParams.put("billkey", "changjiakucunquery");
str = WebUtil.httpPost (client, loginParams, "http://e.hjt360.cn/bill/data/multibill");
JSONObject json = new JSONObject();
json = JSONObject.fromObject(str);
JSONObject target = json.getJSONObject("data");
JSONObject inv = target.getJSONObject("changjiakucunquery");
Integer page = (Integer) inv.getJSONObject("page").get("totalPage");
Integer totalRow = (Integer) inv.getJSONObject("page").get("totalRow");
loginParams.clear();
loginParams.put("entityKey", "changjiakucunquery");
loginParams.put("billkey", "changjiakucunquery");
loginParams.put("fullKey", "MultiBill_changjiakucunquery");
loginParams.put("page", "{\"pageNumber\":" + 1 + ",\"pageSize\":"+totalRow+",\"totalPage\":" + page + ",\"totalRow\":"
+ totalRow + "}");
loginParams.put("model",
"{\"changjiakucunquery\":{\"page\":{\"pageNumber\":" + 1 + ",\"pageSize\":"+totalRow+",\"totalPage\":" + page
+ ",\"totalRow\":" + totalRow + "},\"params\":{\"goodsCode\":null,\"goodsName\":null}}}");
str = WebUtil.httpPost (client, loginParams, "http://e.hjt360.cn/bill/data/refresh");
json = JSONObject.fromObject (str);
target = json.getJSONObject("data");
JSONArray c = target.getJSONArray("cos");
List<List<String>> content = new ArrayList<> ();
for (int i = 0; i < c.size(); i++) {
JSONObject n = c.getJSONObject(i);
rows = new ArrayList<String> ();
addRows(content,rows, title);
addCell(rows, n.get("goodsName").toString(), 2);
addCell(rows, n.get("goodsSpec").toString(),3);
addCell(rows, n.get("placeNum").toString(),4);
addCell(rows, n.get("batchCode").toString(),5);
addCell(rows, n.get("unit").toString(),6);
}
return content;
}
@Override
public List<String> createStock () {
return null;
}
public static void main (String[] args) throws IOException {
CloseableHttpClient client = WebUtil.getHttpClient ();
String s = WebUtil.httpGet (client, "http://e.hjt360.cn/login/login.html");
WebUtil.getFile (client,"http://e.hjt360.cn/authimg","d:\\1.jpg");
String sr = FileUtils.readFileToString (new File ("d:\\code.txt"),"utf-8");
Map<String,String> loginparams = new HashMap<> ();
loginparams.put("username", "ys");
loginparams.put("password", "welcome123");
loginparams.put("isMoblie", "false");
loginparams.put("authCode", sr);
s = WebUtil.httpPost (client, loginparams, "http://e.hjt360.cn/login/vali");
s = WebUtil.httpGet (client, "http://e.hjt360.cn/index.html");
}
}
| [
"[email protected]"
]
| |
f2498f5107165515a965288bcfd0e714143da0cc | e56c0c78a24d37e80d507fb915e66d889c58258d | /seeds-reflect/src/main/java/net/tribe7/common/reflect/TypeParameter.java | 529ee6d288ff62b37963a9b61bd6c9d7689952dd | []
| no_license | jjzazuet/seeds-libraries | d4db7f61ff3700085a36eec77eec0f5f9a921bb5 | 87f74a006632ca7a11bff62c89b8ec4514dc65ab | refs/heads/master | 2021-01-23T20:13:04.801382 | 2014-03-23T21:51:46 | 2014-03-23T21:51:46 | 8,710,960 | 30 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,901 | java | /*
* Copyright (C) 2011 The Guava Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.tribe7.common.reflect;
import static net.tribe7.common.base.Preconditions.checkArgument;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import javax.annotation.Nullable;
import net.tribe7.common.annotations.Beta;
/**
* Captures a free type variable that can be used in {@link TypeToken#where}.
* For example:
*
* <pre> {@code
* static <T> TypeToken<List<T>> listOf(Class<T> elementType) {
* return new TypeToken<List<T>>() {}
* .where(new TypeParameter<T>() {}, elementType);
* }}</pre>
*
* @author Ben Yu
* @since 12.0
*/
@Beta
public abstract class TypeParameter<T> extends TypeCapture<T> {
final TypeVariable<?> typeVariable;
protected TypeParameter() {
Type type = capture();
checkArgument(type instanceof TypeVariable, "%s should be a type variable.", type);
this.typeVariable = (TypeVariable<?>) type;
}
@Override public final int hashCode() {
return typeVariable.hashCode();
}
@Override public final boolean equals(@Nullable Object o) {
if (o instanceof TypeParameter) {
TypeParameter<?> that = (TypeParameter<?>) o;
return typeVariable.equals(that.typeVariable);
}
return false;
}
@Override public String toString() {
return typeVariable.toString();
}
}
| [
"[email protected]"
]
| |
3c15a6b24b8eb0a326226a2295cd8cd52f925e5b | 75a32292e7cb6eaae092152b95271bc599af317a | /WorldEditor/src/old/TerrainRenderer.java | 65d64afedcbbc4ce227e6d503a7ae3695771009d | []
| no_license | nshsdesign/World-Editor | 193cfbe0a2134ac3ae184db2c275016c162e1581 | 96181f874cfa4ec0cc2b1fb97b5710181a6d601e | refs/heads/master | 2016-08-09T15:47:29.115657 | 2016-04-18T21:59:13 | 2016-04-18T21:59:13 | 50,121,309 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,502 | java | package old;
import java.util.List;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import models.RawModel;
import shaders.TerrainShader;
import terrains.Terrain;
import textures.TerrainTexturePack;
import toolbox.Maths;
public class TerrainRenderer {
private TerrainShader shader;
public TerrainRenderer(TerrainShader shader, Matrix4f projectionMatrix) {
this.shader = shader;
shader.start();
shader.loadProjectionMatrix(projectionMatrix);
shader.connectTextureUnits();
shader.stop();
}
public void render(List<Terrain> terrains) {
for (Terrain terrain : terrains) {
prepareTerrain(terrain);
loadModelMatrix(terrain);
GL11.glDrawElements(GL11.GL_TRIANGLES, terrain.getModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
unbindTexturedModel();
}
}
private void prepareTerrain(Terrain terrain) {
RawModel rawModel = terrain.getModel();
GL30.glBindVertexArray(rawModel.getVaoID());
GL20.glEnableVertexAttribArray(0);
GL20.glEnableVertexAttribArray(1);
GL20.glEnableVertexAttribArray(2);
bindTextures(terrain);
shader.loadShineVariables(1, 0);
}
private void bindTextures(Terrain terrain) {
TerrainTexturePack texturePack = terrain.getTexturePack();
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturePack.getBackgroundTexture().getTextureID());
GL13.glActiveTexture(GL13.GL_TEXTURE1);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturePack.getrTexture().getTextureID());
GL13.glActiveTexture(GL13.GL_TEXTURE2);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturePack.getgTexture().getTextureID());
GL13.glActiveTexture(GL13.GL_TEXTURE3);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texturePack.getbTexture().getTextureID());
GL13.glActiveTexture(GL13.GL_TEXTURE4);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, terrain.getBlendMap().getTextureID());
}
private void unbindTexturedModel() {
GL20.glDisableVertexAttribArray(0);
GL20.glDisableVertexAttribArray(1);
GL20.glDisableVertexAttribArray(2);
GL30.glBindVertexArray(0);
}
private void loadModelMatrix(Terrain terrain) {
Matrix4f transformationMatrix = Maths
.createTransformationMatrix(new Vector3f(terrain.getX(), 0, terrain.getZ()), 0, 0, 0, 1);
shader.loadTransformationMatrix(transformationMatrix);
}
}
| [
"[email protected]"
]
| |
a9148833e6ff84d2744493c55de264dbc3412f3e | 4422a3febe2d330067ee5333e02ca22a66bf1aa5 | /Demo/src/jdbc/PrepareStatement.java | cdd81956cd467e33565a6eb66652b082883eaf09 | []
| no_license | priyakaliyappan/repository | 05b3229d81283e6a66272072f85087260ebbb2a8 | c227a33705e8c1a4cc6f5fe9ccf6b3f8719fa5bc | refs/heads/master | 2020-09-10T05:26:08.536336 | 2019-12-27T09:53:12 | 2019-12-27T09:53:12 | 221,659,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class PrepareStatement {
public static void main(String args[])
{
Connection conn;
try {
Class.forName("oracle.jdbc.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","Orcl1234"); //url=(//localhost//port no//sidname//)username//password
PreparedStatement pst = conn.prepareStatement("select * from student"); //driverr 4 is the thin driver
//rs = stmt.executeQuery("select * from STUDENT");
//pst.setInt(1,21);
//pst.setString(2,"User21");
//pst.setInt(3,21);
//execute query
boolean result=pst.execute();//already creating record so no need for another else part
//conn.commit();
if (result)
{
ResultSet rs =pst.executeQuery();
while(rs.next())
{
System.out.println(rs.getInt(1)+" "+rs.getString(2));
}
}// else part not required
else
{
// int result=pst.executeUpdate();
// System.out.println("Number of records updated"+result);
conn.commit();
}
//process result
System.out.println(result);//true/false
// while (rs.next()) {
// System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getInt(3)+" "+rs.getString(4)+" "+rs.getInt(5)+" "+rs.getString(6)+" "+rs.getLong(7));
// }
// conn.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
15ec1c8c070725b621b60de8143a0af6aa240874 | 7291f94681a60fe9060cb8fe220d125cd7b2d73f | /CompCode/RetroFinalPrac/src/org/usfirst/frc4415/RetroFinal/commands/MyTelescopeSetpoint.java | 7ba6658e9325205b091fc1d339cd6b868a7670e2 | []
| no_license | VCHSRobots/RobotCode2018 | 8ad8d6da40847115f9148e9f23e459690d68d144 | defabea407647dc7b65fc853d09b06b727bd4462 | refs/heads/master | 2021-05-14T02:54:04.590677 | 2018-03-17T20:24:40 | 2018-03-17T20:24:40 | 116,601,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,317 | java | // RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.
package org.usfirst.frc4415.RetroFinal.commands;
import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc4415.RetroFinal.Robot;
/**
*
*/
public class MyTelescopeSetpoint extends Command {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS
private boolean limit = false;
public int setpoint;
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
public MyTelescopeSetpoint() {
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
requires(Robot.telescopePID);
requires(Robot.climber);
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
setpoint = 40;
Robot.telescopePID.enable();
Robot.telescopePID.setSetpoint(setpoint);
Robot.climber.climbUp();
if (Robot.telescopePID.getEncoder() > setpoint * .9 && Robot.telescopePID.getEncoder() < setpoint * 1.1) {
limit = true;
}
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return limit;
}
// Called once after isFinished returns true
@Override
protected void end() {
Robot.climber.climbOff();
limit = false;
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
end();
}
}
| [
"[email protected]"
]
| |
a608888ec1f1e8a0f182f41c8cb54ce7e1206aed | 0a7af014927090b6c5a4f0d36ff578dd8791ee12 | /src/Thread11Deadlock/App.java | fc3b434c06b2df1cf8aaf11182a13503a3afccfb | []
| no_license | kmoreti/multithreading | edbcb9a334a0693e13762c14158336b71d040a97 | c2851e299a7edd20e95b2a8901522dcd0dc7f1ff | refs/heads/master | 2020-04-02T03:04:53.999115 | 2018-10-22T02:25:43 | 2018-10-22T02:25:43 | 153,945,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package Thread11Deadlock;
import java.time.Duration;
import java.time.Instant;
public class App {
public static void main(String[] args) throws InterruptedException {
Runner runner = new Runner();
Thread t1 = new Thread(() -> {
try {
runner.firstThread();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
Thread t2 = new Thread(() -> {
try {
runner.secondThread();
} catch (InterruptedException e) {
e.printStackTrace();
}
});
System.out.println("Starting...");
Instant start = Instant.now();
t1.start();
t2.start();
t1.join();
t2.join();
runner.finished();
System.out.println("Time elapsed: " + Duration.between(start, Instant.now()).toMillis());
}
}
| [
"[email protected]"
]
| |
978974a5bdac0e1721bcd608d4d764a9f6ac1c5b | e7a9a50f5df6b43b59395edef7d584321054a80b | /Railroad.java | 6add9bf9763760716062a2c3a1c6678965e509e0 | []
| no_license | albinoBandicoot/Railroads | 6e66dffca552848472e12b2ddd8026368e7b3c37 | 2b2f5c257824e97b9bc3f919db6d5571ea83b91d | refs/heads/master | 2021-01-13T02:03:57.283872 | 2014-09-22T22:50:30 | 2014-09-22T22:50:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | import javax.swing.*;
import java.awt.event.*;
public class Railroad extends JFrame implements ActionListener {
public static RailroadPanel rp;
public Railroad () {
super ("Railroads");
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JPanel content = new JPanel ();
content.setOpaque (true);
content.setLayout (null);
rp = new RailroadPanel ();
rp.setBounds (5,5, 1000, 700);
rp.addMouseListener (rp);
rp.addKeyListener (rp);
rp.addMouseWheelListener (rp);
content.add (rp);
setContentPane (content);
pack();
setSize (1010, 750);
setVisible (true);
}
public static void main (String[] args) {
Railroad r = new Railroad ();
}
public void actionPerformed (ActionEvent e) {
}
}
| [
"[email protected]"
]
| |
3e23a3c6c00fa6d6dc89b07cce1d1a892e5eb683 | d3afba989ff4d5da6d2694d08629dfe44bad65ab | /src/ex5/Runner.java | 348d088b187563555395b5e0f4ff8537840f166c | []
| no_license | Cato-Old/exercises | 5bd997ce145ee46e13331d3bf0f5d290c01f2316 | 3c8ba8e23c6a8618fbe8a563bb7dc064bd917cdc | refs/heads/master | 2020-04-01T06:37:20.119342 | 2018-10-19T18:16:41 | 2018-10-19T18:16:41 | 152,955,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | package ex5;
public class Runner {
public static void main(String[] args) {
Avverage avv = new Avverage();
System.out.println(avv.ComputeAvv());
}
}
| [
"[email protected]"
]
| |
0067dc0042499d3b5fff8944ed1a17b7791d61d7 | 7d4a53c49ec74d5b4f5c7029a4480a92351a2885 | /ZXingCaptureActivity/src/com/google/zxing/client/android/CaptureActivity.java | f0fc36933997cd9acaeb80e4010f753c8c6f8a14 | []
| no_license | demdxx/ZXingCaptureActivity | 5401a1c02e6d819a274a3caf03e46c7f7e0bcae3 | c42b86c24af3d9e08f3e8a30d68e3eb58b923bf1 | refs/heads/master | 2016-09-11T02:50:10.759545 | 2013-07-20T09:29:56 | 2013-07-20T09:29:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,562 | java | package com.google.zxing.client.android;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.Result;
import com.google.zxing.ResultMetadataType;
import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.CaptureActivityHandler;
import com.google.zxing.client.android.Preferences;
import com.google.zxing.client.android.ViewfinderView;
import com.google.zxing.client.android.camera.CameraManager;
import com.google.zxing.client.android.result.ResultButtonListener;
import com.google.zxing.client.android.result.ResultHandler;
import com.google.zxing.client.android.result.ResultHandlerFactory;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.ClipboardManager;
import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
/**
* This activity opens the camera and does the actual scanning on a background thread. It draws a
* viewfinder to help the user place the barcode correctly, shows feedback as the image processing
* is happening, and then overlays the results when a scan is successful.
*
* @author [email protected] (Daniel Switkin)
* @author Sean Owen
* @author Dmitry Ponomarev <[email protected]>
*/
public class CaptureActivity extends Activity implements SurfaceHolder.Callback {
private static final String TAG = CaptureActivity.class.getSimpleName();
private static final long DEFAULT_INTENT_RESULT_DURATION_MS = 1500L;
private static final long BULK_MODE_SCAN_DELAY_MS = 1000L;
private static final String[] ZXING_URLS = { "http://zxing.appspot.com/scan", "zxing://scan/" };
public static final String OPTION_COPY_TO_CLIPBOARD = "ZXING_COPY_TO_CLIPBOARD"; // Boolean
public static final String OPTION_SHOW_PREVIEW = "ZXING_SHOW_PREVIEW"; // Boolean
public static final String OPTION_DEFAULT_IMAGE = "ZXING_DEFAULT_IMAGE"; // Int
public static final String RESULT_CODE = "ZXING_RESULT_CODE";
public static final String RESULT_FORMAT = "ZXING_RESULT_FORMAT";
private static final Set<ResultMetadataType> DISPLAYABLE_METADATA_TYPES =
EnumSet.of(ResultMetadataType.ISSUE_NUMBER,
ResultMetadataType.SUGGESTED_PRICE,
ResultMetadataType.ERROR_CORRECTION_LEVEL,
ResultMetadataType.POSSIBLE_COUNTRY);
protected CameraManager cameraManager;
protected CaptureActivityHandler handler;
protected Result savedResultToShow;
protected ViewfinderView viewfinderView;
protected TextView statusView;
protected View resultView;
protected Result lastResult;
protected boolean hasSurface;
protected IntentSource source;
protected String sourceUrl;
protected ScanFromWebPageManager scanFromWebPageManager;
protected Collection<BarcodeFormat> decodeFormats;
protected Map<DecodeHintType,?> decodeHints;
protected String characterSet;
protected InactivityTimer inactivityTimer;
protected BeepManager beepManager;
protected AmbientLightManager ambientLightManager;
protected int barcodeDefaultImage() {
return getIntent().getExtras().getInt(OPTION_DEFAULT_IMAGE, 0);
}
protected boolean showPreview() {
return getIntent().getExtras().getBoolean(OPTION_SHOW_PREVIEW, true);
}
protected boolean copyToClipboard() {
return getIntent().getExtras().getBoolean(OPTION_COPY_TO_CLIPBOARD, true);
}
ViewfinderView getViewfinderView() {
return viewfinderView;
}
public Handler getHandler() {
return handler;
}
CameraManager getCameraManager() {
return cameraManager;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Preferences.preload(this);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.capture);
hasSurface = false;
inactivityTimer = new InactivityTimer(this);
beepManager = new BeepManager(this);
ambientLightManager = new AmbientLightManager(this);
}
@Override
protected void onResume() {
super.onResume();
// CameraManager must be initialized here, not in onCreate(). This is necessary because we don't
// want to open the camera driver and measure the screen size if we're going to show the help on
// first launch. That led to bugs where the scanning rectangle was the wrong size and partially
// off screen.
cameraManager = new CameraManager(getApplication());
viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view);
viewfinderView.setCameraManager(cameraManager);
resultView = findViewById(R.id.result_view);
statusView = (TextView) findViewById(R.id.status_view);
handler = null;
lastResult = null;
resetStatusView();
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
if (hasSurface) {
// The activity was paused but not stopped, so the surface still exists. Therefore
// surfaceCreated() won't be called, so init the camera here.
initCamera(surfaceHolder);
} else {
// Install the callback and wait for surfaceCreated() to init the camera.
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
beepManager.updatePrefs();
ambientLightManager.start(cameraManager);
inactivityTimer.onResume();
Intent intent = getIntent();
source = IntentSource.NONE;
decodeFormats = null;
characterSet = null;
if (intent != null) {
String action = intent.getAction();
String dataString = intent.getDataString();
if (Intents.Scan.ACTION.equals(action)) {
// Scan the formats the intent requested, and return the result to the calling activity.
source = IntentSource.NATIVE_APP_INTENT;
decodeFormats = DecodeFormatManager.parseDecodeFormats(intent);
decodeHints = DecodeHintManager.parseDecodeHints(intent);
if (intent.hasExtra(Intents.Scan.WIDTH) && intent.hasExtra(Intents.Scan.HEIGHT)) {
int width = intent.getIntExtra(Intents.Scan.WIDTH, 0);
int height = intent.getIntExtra(Intents.Scan.HEIGHT, 0);
if (width > 0 && height > 0) {
cameraManager.setManualFramingRect(width, height);
}
}
String customPromptMessage = intent.getStringExtra(Intents.Scan.PROMPT_MESSAGE);
if (customPromptMessage != null) {
statusView.setText(customPromptMessage);
}
} else if (isZXingURL(dataString)) {
// Scan formats requested in query string (all formats if none specified).
// If a return URL is specified, send the results there. Otherwise, handle it ourselves.
source = IntentSource.ZXING_LINK;
sourceUrl = dataString;
Uri inputUri = Uri.parse(dataString);
decodeFormats = DecodeFormatManager.parseDecodeFormats(inputUri);
// Allow a sub-set of the hints to be specified by the caller.
decodeHints = DecodeHintManager.parseDecodeHints(inputUri);
}
characterSet = intent.getStringExtra(Intents.Scan.CHARACTER_SET);
}
}
/**
* Check scan url
* @param dataString
* @return boolean
*/
protected boolean isZXingURL(String dataString) {
if (dataString == null) {
return false;
}
for (String url : ZXING_URLS) {
if (dataString.startsWith(url)) {
return true;
}
}
return false;
}
@Override
protected void onPause() {
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
inactivityTimer.onPause();
ambientLightManager.stop();
cameraManager.closeDriver();
if (!hasSurface) {
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
surfaceHolder.removeCallback(this);
}
super.onPause();
}
@Override
protected void onDestroy() {
inactivityTimer.shutdown();
super.onDestroy();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
if (source == IntentSource.NATIVE_APP_INTENT) {
setResult(RESULT_CANCELED);
finish();
return true;
}
if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
restartPreviewAfterDelay(0L);
return true;
}
break;
case KeyEvent.KEYCODE_FOCUS:
case KeyEvent.KEYCODE_CAMERA:
// Handle these events so they don't launch the Camera app
return true;
// Use volume up/down to turn on light
case KeyEvent.KEYCODE_VOLUME_DOWN:
cameraManager.setTorch(false);
return true;
case KeyEvent.KEYCODE_VOLUME_UP:
cameraManager.setTorch(true);
return true;
}
return super.onKeyDown(keyCode, event);
}
private void decodeOrStoreSavedBitmap(Bitmap bitmap, Result result) {
// Bitmap isn't used yet -- will be used soon
if (handler == null) {
savedResultToShow = result;
} else {
if (result != null) {
savedResultToShow = result;
}
if (savedResultToShow != null) {
Message message = Message.obtain(handler, R.id.decode_succeeded, savedResultToShow);
handler.sendMessage(message);
}
savedResultToShow = null;
}
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
if (holder == null) {
Log.e(TAG, "*** WARNING *** surfaceCreated() gave us a null surface!");
}
if (!hasSurface) {
hasSurface = true;
initCamera(holder);
}
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
hasSurface = false;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
/**
* A valid barcode has been found, so give an indication of success and show the results.
*
* @param rawResult The contents of the barcode.
* @param scaleFactor amount by which thumbnail was scaled
* @param barcode A greyscale bitmap of the camera data which was decoded.
*/
public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
inactivityTimer.onActivity();
lastResult = rawResult;
ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
boolean fromLiveScan = barcode != null;
if (fromLiveScan) {
// Then not from history, so beep/vibrate and we have an image to draw on
beepManager.playBeepSoundAndVibrate();
drawResultPoints(barcode, scaleFactor, rawResult);
}
switch (source) {
case NATIVE_APP_INTENT:
case PRODUCT_SEARCH_LINK:
handleDecodeExternally(rawResult, resultHandler, barcode);
break;
case ZXING_LINK:
if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
handleDecodeInternally(rawResult, resultHandler, barcode);
} else {
handleDecodeExternally(rawResult, resultHandler, barcode);
}
break;
case NONE:
if (fromLiveScan && Preferences.bulk_mode) {
String message = getResources().getString(R.string.msg_bulk_mode_scanned)
+ " (" + rawResult.getText() + ')';
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
// Wait a moment or else it will scan the same barcode continuously about 3 times
restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
} else {
handleDecodeInternally(rawResult, resultHandler, barcode);
}
break;
}
}
/**
* Superimpose a line for 1D or dots for 2D to highlight the key features of the barcode.
*
* @param barcode A bitmap of the captured image.
* @param scaleFactor amount by which thumbnail was scaled
* @param rawResult The decoded results which contains the points to draw.
*/
protected void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) {
ResultPoint[] points = rawResult.getResultPoints();
if (points != null && points.length > 0) {
Canvas canvas = new Canvas(barcode);
Paint paint = new Paint();
paint.setColor(getResources().getColor(R.color.result_points));
if (points.length == 2) {
paint.setStrokeWidth(4.0f);
drawLine(canvas, paint, points[0], points[1], scaleFactor);
} else if (points.length == 4 &&
(rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A ||
rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) {
// Hacky special case -- draw two lines, for the barcode and metadata
drawLine(canvas, paint, points[0], points[1], scaleFactor);
drawLine(canvas, paint, points[2], points[3], scaleFactor);
} else {
paint.setStrokeWidth(10.0f);
for (ResultPoint point : points) {
canvas.drawPoint(scaleFactor * point.getX(), scaleFactor * point.getY(), paint);
}
}
}
}
protected static void drawLine(Canvas canvas, Paint paint, ResultPoint a, ResultPoint b, float scaleFactor) {
if (a != null && b != null) {
canvas.drawLine(scaleFactor * a.getX(),
scaleFactor * a.getY(),
scaleFactor * b.getX(),
scaleFactor * b.getY(),
paint);
}
}
// Put up our own UI for how to handle the decoded contents.
private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
// Set information
statusView.setVisibility(View.GONE);
viewfinderView.setVisibility(View.GONE);
resultView.setVisibility(View.VISIBLE);
ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
if (barcode == null) {
int barcodeDefaultImage = this.barcodeDefaultImage();
if (barcodeDefaultImage>0) {
barcodeImageView.setImageBitmap(
BitmapFactory.decodeResource(getResources(), barcodeDefaultImage));
}
} else {
barcodeImageView.setImageBitmap(barcode);
}
TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
formatTextView.setText(rawResult.getBarcodeFormat().toString());
TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
typeTextView.setText(resultHandler.getType().toString());
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
String formattedTime = formatter.format(new Date(rawResult.getTimestamp()));
TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
timeTextView.setText(formattedTime);
TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
metaTextView.setVisibility(View.GONE);
metaTextViewLabel.setVisibility(View.GONE);
Map<ResultMetadataType,Object> metadata = rawResult.getResultMetadata();
if (metadata != null) {
StringBuilder metadataText = new StringBuilder(20);
for (Map.Entry<ResultMetadataType,Object> entry : metadata.entrySet()) {
if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
metadataText.append(entry.getValue()).append('\n');
}
}
if (metadataText.length() > 0) {
metadataText.setLength(metadataText.length() - 1);
metaTextView.setText(metadataText);
metaTextView.setVisibility(View.VISIBLE);
metaTextViewLabel.setVisibility(View.VISIBLE);
}
}
TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
CharSequence displayContents = rawResult.getText();
contentsTextView.setText(displayContents);
// Crudely scale betweeen 22 and 32 -- bigger font for shorter text
int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);
TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view);
supplementTextView.setText("");
supplementTextView.setOnClickListener(null);
// if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
// PreferencesActivity.KEY_SUPPLEMENTAL, true)) {
// SupplementalInfoRetriever.maybeInvokeRetrieval(supplementTextView,
// resultHandler.getResult(),
// historyManager,
// this);
// }
ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
if (null!=buttonView) {
int buttonCount = resultHandler.getButtonCount();
buttonView.requestFocus();
for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
TextView button = (TextView) buttonView.getChildAt(x);
if (x < buttonCount) {
button.setVisibility(View.VISIBLE);
button.setText(resultHandler.getButtonText(x));
button.setOnClickListener(new ResultButtonListener(resultHandler, x));
} else {
button.setVisibility(View.GONE);
}
}
}
if (copyToClipboard() && !resultHandler.areContentsSecure()) {
ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
if (displayContents != null) {
try {
clipboard.setText(displayContents);
} catch (NullPointerException npe) {
// Some kind of bug inside the clipboard implementation, not due to null input
Log.w(TAG, "Clipboard bug", npe);
}
}
}
}
// Briefly show the contents of the barcode, then handle the result outside Barcode Scanner.
private void handleDecodeExternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
if (barcode != null) {
viewfinderView.drawResultBitmap(barcode);
}
long resultDurationMS;
if (getIntent() == null) {
resultDurationMS = DEFAULT_INTENT_RESULT_DURATION_MS;
} else {
resultDurationMS = getIntent().getLongExtra(Intents.Scan.RESULT_DISPLAY_DURATION_MS,
DEFAULT_INTENT_RESULT_DURATION_MS);
}
if (source == IntentSource.NATIVE_APP_INTENT) {
// Hand back whatever action they requested - this can be changed to Intents.Scan.ACTION when
// the deprecated intent is retired.
Intent intent = new Intent(getIntent().getAction());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
byte[] rawBytes = rawResult.getRawBytes();
if (rawBytes != null && rawBytes.length > 0) {
intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
}
Map<ResultMetadataType,?> metadata = rawResult.getResultMetadata();
if (metadata != null) {
if (metadata.containsKey(ResultMetadataType.UPC_EAN_EXTENSION)) {
intent.putExtra(Intents.Scan.RESULT_UPC_EAN_EXTENSION,
metadata.get(ResultMetadataType.UPC_EAN_EXTENSION).toString());
}
Integer orientation = (Integer) metadata.get(ResultMetadataType.ORIENTATION);
if (orientation != null) {
intent.putExtra(Intents.Scan.RESULT_ORIENTATION, orientation.intValue());
}
String ecLevel = (String) metadata.get(ResultMetadataType.ERROR_CORRECTION_LEVEL);
if (ecLevel != null) {
intent.putExtra(Intents.Scan.RESULT_ERROR_CORRECTION_LEVEL, ecLevel);
}
Iterable<byte[]> byteSegments = (Iterable<byte[]>) metadata.get(ResultMetadataType.BYTE_SEGMENTS);
if (byteSegments != null) {
int i = 0;
for (byte[] byteSegment : byteSegments) {
intent.putExtra(Intents.Scan.RESULT_BYTE_SEGMENTS_PREFIX + i, byteSegment);
i++;
}
}
}
sendReplyMessage(R.id.return_scan_result, intent, resultDurationMS);
} else if (source == IntentSource.ZXING_LINK) {
if (scanFromWebPageManager != null && scanFromWebPageManager.isScanFromWebPage()) {
String replyURL = scanFromWebPageManager.buildReplyURL(rawResult, resultHandler);
sendReplyMessage(R.id.launch_product_query, replyURL, resultDurationMS);
}
}
}
private void sendReplyMessage(int id, Object arg, long delayMS) {
Message message = Message.obtain(handler, id, arg);
if (delayMS > 0L) {
handler.sendMessageDelayed(message, delayMS);
} else {
handler.sendMessage(message);
}
}
private void initCamera(SurfaceHolder surfaceHolder) {
if (surfaceHolder == null) {
throw new IllegalStateException("No SurfaceHolder provided");
}
if (cameraManager.isOpen()) {
Log.w(TAG, "initCamera() while already open -- late SurfaceView callback?");
return;
}
try {
cameraManager.openDriver(surfaceHolder);
// Creating the handler starts the preview, which can also throw a RuntimeException.
if (handler == null) {
handler = new CaptureActivityHandler(this, decodeFormats, decodeHints, characterSet, cameraManager);
}
decodeOrStoreSavedBitmap(null, null);
} catch (IOException ioe) {
Log.w(TAG, ioe);
displayFrameworkBugMessageAndExit();
} catch (RuntimeException e) {
// Barcode Scanner has seen crashes in the wild of this variety:
// java.?lang.?RuntimeException: Fail to connect to camera service
Log.w(TAG, "Unexpected error initializing camera", e);
displayFrameworkBugMessageAndExit();
}
}
private void displayFrameworkBugMessageAndExit() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.app_name));
builder.setMessage(getString(R.string.msg_camera_framework_bug));
builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
builder.setOnCancelListener(new FinishListener(this));
builder.show();
}
public void restartPreviewAfterDelay(long delayMS) {
if (handler != null) {
handler.sendEmptyMessageDelayed(R.id.restart_preview, delayMS);
}
resetStatusView();
}
private void resetStatusView() {
resultView.setVisibility(View.GONE);
statusView.setText(R.string.msg_default_status);
statusView.setVisibility(View.VISIBLE);
viewfinderView.setVisibility(View.VISIBLE);
lastResult = null;
}
public void drawViewfinder() {
viewfinderView.drawViewfinder();
}
}
| [
"[email protected]"
]
| |
da59aeef19c62b3f4d6dea6252b0e280a71e88c7 | 83204cdcdf62a8f78dc701eb68d7f26131c4b474 | /ch16/src/main/java/com/apress/prospring3/ch16/jms/JmsListenerSample.java | 95d18f838d7a929dc631320c8ab3a0ef003eb947 | []
| no_license | wikibook/prospring3 | 1974189e573b8bf7c42ba570339375c84b29ee12 | 1a463948898753d8817088d093e14c819ce0e040 | refs/heads/master | 2021-01-01T05:31:25.398537 | 2013-10-25T13:57:17 | 2013-10-25T13:57:17 | 13,862,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | /**
* Created on Nov 25, 2011
*/
package com.apress.prospring3.ch16.jms;
import org.springframework.context.support.GenericXmlApplicationContext;
/**
* @author Clarence
*
*/
public class JmsListenerSample {
public static void main(String[] args) {
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.load("classpath:jms-listener-app-context.xml");
ctx.refresh();
while (true) {
}
}
}
| [
"[email protected]"
]
| |
2a42add305b8b067680e761da817ef5ae051736a | a25a6e4248ffd6fa1727f87779013d9ac3fed69b | /geshanzsq-nav-nav/src/main/java/com/geshanzsq/nav/mapper/FrontMenuMapper.java | ccb95b85914379996434e2389a26cd8dbcbc4d91 | [
"MIT"
]
| permissive | Qyanjia/- | 6bcd35974a30ac591cb2b3834b59500c2e5bce4a | d947eb93e5dffbd68774a03005d4fbb6b13852f2 | refs/heads/master | 2023-03-16T13:18:38.141265 | 2022-05-01T15:35:21 | 2022-05-01T15:35:21 | 243,139,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package com.geshanzsq.nav.mapper;
import com.geshanzsq.nav.domain.vo.FrontMenuVO;
import com.geshanzsq.nav.domain.vo.FrontSiteVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author geshanzsq
* @date 2020/7/30
*/
public interface FrontMenuMapper {
/**
* 前台导航页面展示,获取所有导航菜单
*/
List<FrontMenuVO> findFrontAllMenu(@Param("status") Integer status);
/**
* 前台导航页面展示,获取所有导航站点
*/
List<FrontSiteVO> findFrontAllSite(@Param("status")Integer status);
/**
* 查询站点
* @param siteName
* @param siteDescription
* @param status
* @return
*/
List<FrontSiteVO> searchSiteByName(@Param("siteName") String siteName,
@Param("siteDescription") String siteDescription,
@Param("status") Integer status);
}
| [
"[email protected]"
]
| |
fc375162772a8e7fedadf2c8689206c20f18265d | fb370d66be228ba5bc6b3db8e339a1f5e222d912 | /src/main/java/com/microsoft/store/partnercenter/invoices/InvoiceStatementOperations.java | d5914e961e50ebbba2e2919757b5b410c83d0f3f | [
"MIT"
]
| permissive | Serik0/Partner-Center-Java | dd49495fcf624bba8fd428068ecdee2519f20217 | 9e10bb1c62b3d36c131795950b5553c36a0a3c4f | refs/heads/master | 2022-01-04T14:39:11.853043 | 2020-03-04T20:02:43 | 2020-03-04T20:02:43 | 250,222,888 | 0 | 0 | MIT | 2020-03-26T10:07:13 | 2020-03-26T10:07:12 | null | UTF-8 | Java | false | false | 1,557 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See the LICENSE file in the project root for full license information.
package com.microsoft.store.partnercenter.invoices;
import java.io.InputStream;
import java.text.MessageFormat;
import com.microsoft.store.partnercenter.BasePartnerComponentString;
import com.microsoft.store.partnercenter.IPartner;
import com.microsoft.store.partnercenter.PartnerService;
import com.microsoft.store.partnercenter.utils.StringHelper;
public class InvoiceStatementOperations
extends BasePartnerComponentString
implements IInvoiceStatement
{
/**
* Initializes a new instance of the InvoiceStatementOperations class.
*
* @param rootPartnerOperations The root partner operations instance.
* @param invoiceId The invoice identifier.
*/
public InvoiceStatementOperations(IPartner rootPartnerOperations, String invoiceId)
{
super(rootPartnerOperations, invoiceId);
if (StringHelper.isNullOrWhiteSpace(invoiceId))
{
throw new IllegalArgumentException("invoiceId has to be set.");
}
}
/**
* Retrieves the invoice statement. This operation is currently only supported for user based credentials.
*
* @return The invoice statement.
*/
@Override
public InputStream get()
{
return this.getPartner().getServiceClient().getFileContents(
this.getPartner(),
MessageFormat.format(
PartnerService.getInstance().getConfiguration().getApis().get("GetInvoiceStatement").getPath(),
this.getContext()),
"application/pdf");
}
} | [
"[email protected]"
]
| |
cc43d40c4e2b762139c6a63fe662464972b41dbb | d8ee1fbb7fa17895994b13f353417f5326588967 | /src/com/meilishuo/meidian/testcase/ShowDetail/TestClickLike1.java | 521861ca65b03605fbd4ab1f8d43a6d62ddac99d | []
| no_license | ghmjava/git_iphone | 9e5b74c65da5344a13d787782d993e4d3db6aaa6 | aefc1d0bdcee4a5853b41b9b23b9c848ba81e484 | refs/heads/master | 2021-01-10T11:24:44.788708 | 2016-03-14T09:00:43 | 2016-03-14T09:00:43 | 53,839,860 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package com.meilishuo.meidian.testcase.ShowDetail;
import android.util.Log;
import com.meilishuo.meidian.init.BaseClass;
import com.meilishuo.meidian.init.Discover;
import com.meilishuo.meidian.page.ShowDetailPage;
import com.meilishuo.meidian.page.UserShowListPage;
/**
* Created by MLS on 15/9/28.
*/
public class TestClickLike1 extends BaseClass {
@Discover
public void testClickLike() {
init();
solo.scrollToBottom();
solo.sleep(1000);
//点击我的发布
solo.clickOnText("^我的发布$");
Log.d(TAG, "点击我的发布");
solo.sleep(1000);
//启动我的发布页面
UserShowListPage.get_UserShowList(solo);
Log.d(TAG, "启动我的发布页面");
solo.sleep(3000);
//点击发布
UserShowListPage.click_Show(solo, 0);
solo.sleep(1000);
//进入动态详情页
ShowDetailPage.get_showdetail(solo);
Log.d(TAG, "启动动态详情页");
solo.sleep(3000);
//点击喜欢icon
ShowDetailPage.click_like1(solo);
solo.sleep(2000);
//点击喜欢icon
ShowDetailPage.click_like1(solo);
solo.sleep(2000);
}
}
| [
"[email protected]"
]
| |
f4e49a854511fcdfc643ac16fa4febfc5c6d6111 | 93816b557223261a5fc21e0eac3c86361af0b60b | /401/src/test/java/codechallenges/ArrayShiftTest.java | 803a3dc01fd9297f28da0bd9a0fa0b437a33033b | []
| no_license | DwayneWayneJr/data-structures-and-algorithms | af365a0102329d31af938061fa42db8df89b600c | 9c1d67c3fb318ae0aebbb212da8df0800a47b047 | refs/heads/master | 2023-01-11T17:01:47.510606 | 2020-01-28T18:03:11 | 2020-01-28T18:03:11 | 215,145,811 | 0 | 0 | null | 2023-01-04T22:46:57 | 2019-10-14T21:09:35 | JavaScript | UTF-8 | Java | false | false | 262 | java | package codechallenges;
import org.junit.Test;
import static org.junit.Assert.*;
public class ArrayShiftTest {
// @Test public void testShiftArrayCorrectAns () {
// assertEquals("this is going to be correct", [2,4,5,6,8], [],);
// }
} | [
"[email protected]"
]
| |
1bed8d7bbd4482de88a3c5fb94cde0894494ebc6 | 6e0227ec97524de4ff1a727b7d59b448706d0cc6 | /src/main/java/com/stu/dao/StuTeacherMapper.java | 0e42c37bc0b8cfd70f5e57cda584dd08a665951f | []
| no_license | 7eau/studentManerger | 1013f26ae0f624342a4868c49be92e369121f15c | db3c1dcc5ef10cb248b4064f53c678be9bbe0f17 | refs/heads/master | 2023-04-26T11:33:53.387478 | 2021-05-14T18:16:31 | 2021-05-14T18:16:31 | 365,213,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package com.stu.dao;
import com.stu.entity.StuTeacher;
import org.springframework.stereotype.Component;
@Component
public interface StuTeacherMapper {
/**
* delete by primary key
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(Integer id);
/**
* insert record to table
* @param record the record
* @return insert count
*/
int insert(StuTeacher record);
/**
* insert record to table selective
* @param record the record
* @return insert count
*/
int insertSelective(StuTeacher record);
/**
* select by primary key
* @param id primary key
* @return object by primary key
*/
StuTeacher selectByPrimaryKey(Integer id);
/**
* update record selective
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(StuTeacher record);
/**
* update record
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(StuTeacher record);
} | [
"[email protected]"
]
| |
2575541865fe91ec12b779205a47b801b325c605 | 6f3f180bdead25d44082338f921d6e804fa38d72 | /android_works/displayintextview/app/src/androidTest/java/sjcet/displayintextview/ExampleInstrumentedTest.java | 164a5cd85589e8308137c4ca8e8e866b01858e82 | []
| no_license | bismimariajose123/bismimariajosegit | e910e22466fd61bcc63e1230e5153768fc2feedd | 0a2a34dafaf879340a1ff08f02c8c6566bd4407b | refs/heads/master | 2021-01-18T03:47:28.299317 | 2018-07-25T11:38:57 | 2018-07-25T11:38:57 | 85,784,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package sjcet.displayintextview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("sjcet.displayintextview", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
10058c4d576bdbc494a1edea0e3c6a3e5f47409e | 8bee85517db94e19cc453e9ba3c3e1cdb25f9147 | /src/main/java/com/gft/dataservice/web/config/SpringWebAppInitializer.java | dfa7adabb1522b06aab2a44426394128afca1a8d | []
| no_license | jamesmedice/Apache | 87e5695a7570050110d417a174be3db09810e980 | 31fac81384545d971b993817a8a32e4e902b1049 | refs/heads/master | 2021-01-19T12:23:46.168728 | 2017-04-27T10:29:35 | 2017-04-27T10:29:35 | 82,308,465 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package com.gft.dataservice.web.config;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.apache.wicket.protocol.http.WicketFilter;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import com.gft.dataservice.config.AppConfig;
import com.gft.dataservice.web.ui.WicketApplication;
/**
* @author TMedice
*
*/
public class SpringWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] { AppConfig.class };
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { WebMvcConfig.class, RepositoryRestMvcConfiguration.class };
}
@Override
protected String[] getServletMappings() {
return new String[] { "/rest/*" };
}
@Override
protected Filter[] getServletFilters() {
return new Filter[] {
// new DelegatingFilterProxy("springSecurityFilterChain")
new OpenEntityManagerInViewFilter() };
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
FilterRegistration.Dynamic filter = servletContext.addFilter("com.gft.dataservice.web.ui", WicketFilter.class.getName());
filter.setInitParameter("applicationClassName", WicketApplication.class.getName());
filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*");
filter.addMappingForUrlPatterns(null, false, "/*");
super.onStartup(servletContext);
}
}
| [
"[email protected]"
]
| |
9eeee403ca2d874033c2a191d42b157428231aac | 045aa5a4cb6778ac392677846fcbec102e472c60 | /src/com/tekwill/learning/javaapi/collections/EmirpNumbers.java | 688fd6ffe3b16692a9d87c9a82cdfcb0d60b6576 | [
"MIT"
]
| permissive | dimashpro/tekwill-homework | 30e6353b884d2bbefd783ca8da6b039e1abcf944 | 5ad75c8bb44e56847a5fa38420e4046c52c92a58 | refs/heads/main | 2023-03-21T03:40:43.354909 | 2021-03-21T19:23:23 | 2021-03-21T19:23:23 | 317,319,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,369 | java | package com.tekwill.learning.javaapi.collections;
import java.util.ArrayList;
import java.util.List;
public class EmirpNumbers {
public static void printEmirps() {
List<Integer> emirpNumbers = new ArrayList<>();
int numberOfEmirps = 0;
int incNumber = 0, counter = 0;
while (numberOfEmirps < 100) {
incNumber++;
int n = incNumber;
int emirpNumber = 0;
while (n != 0) {
emirpNumber = emirpNumber * 10 + n % 10;
n /= 10;
}
if (incNumber != emirpNumber) {
if (checkPrime(incNumber) && checkPrime(emirpNumber)) {
emirpNumbers.add(incNumber);
numberOfEmirps++;
}
}
}
for (Integer emirpNumber : emirpNumbers) {
counter++;
System.out.print(emirpNumber + " ");
if ((counter % 10) == 0) System.out.println();
}
}
public static boolean checkPrime(int checkedNumber) {
int numberOfDivisors = 0;
for (int i = 1; i <= checkedNumber; i++) {
if ((checkedNumber % i) == 0) {
numberOfDivisors++;
}
}
if (numberOfDivisors == 2) {
return true;
} else {
return false;
}
}
}
| [
"[email protected]"
]
| |
6d57dbba59588652642fda431611611b2caa8ed4 | 267ccb51333f528a50f2f8720fe989437596fd2b | /oncecloud-docker-api/src/main/java/com/github/dockerjava/jaxrs/InspectExecCmdExec.java | b9ee33d61c8abf105989f2fb34bdbf8ef9e83081 | [
"LicenseRef-scancode-warranty-disclaimer"
]
| no_license | XJW163/OnceCloud | 55e393175b3073f94c074b2458b7cc25d7683081 | 7400154f41021704cd7eedec88489916b6d9eefb | refs/heads/master | 2021-05-30T05:28:44.261493 | 2015-12-22T12:07:43 | 2015-12-22T12:07:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package com.github.dockerjava.jaxrs;
import com.github.dockerjava.api.command.InspectExecCmd;
import com.github.dockerjava.api.command.InspectExecResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
public class InspectExecCmdExec extends AbstrDockerCmdExec<InspectExecCmd, InspectExecResponse> implements InspectExecCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(InspectExecCmdExec.class);
public InspectExecCmdExec(WebTarget baseResource) {
super(baseResource);
}
@Override
protected InspectExecResponse execute(InspectExecCmd command) {
WebTarget webResource = getBaseResource().path("/exec/{id}/json").resolveTemplate("id", command.getExecId());
LOGGER.debug("GET: {}", webResource);
return webResource.request().accept(MediaType.APPLICATION_JSON).get(InspectExecResponse.class);
}
}
| [
"[email protected]"
]
| |
ac79e22fa6dd22e665ad52563f6aaaa2d4c98a0f | c06687ab90e075d67ca629e44cd1778371cd4508 | /Java8Program/src/javed/com/test/Drawable.java | 612360871e2ef43d0da4788932585a7f94bbc11e | []
| no_license | javedshaikh22/Java8Programming | 78e58abe3e6d2de76fb16a361931a41950a8708d | a7781327218909d4dd2c2064d05f0ebca8e96095 | refs/heads/master | 2022-11-25T10:46:10.113806 | 2020-07-29T05:19:43 | 2020-07-29T05:19:43 | 283,404,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 83 | java | package javed.com.test;
public interface Drawable {
public void draw();
}
| [
"[email protected]"
]
| |
347944f95458c77531439dad9ced6b6ba16a2815 | df134b422960de6fb179f36ca97ab574b0f1d69f | /com/google/gson/LongSerializationPolicy.java | a2aea38d66f293c92e3dde205a713c09bd79994d | []
| no_license | TheShermanTanker/NMS-1.16.3 | bbbdb9417009be4987872717e761fb064468bbb2 | d3e64b4493d3e45970ec5ec66e1b9714a71856cc | refs/heads/master | 2022-12-29T15:32:24.411347 | 2020-10-08T11:56:16 | 2020-10-08T11:56:16 | 302,324,687 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | /* */ package com.google.gson;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public enum LongSerializationPolicy
/* */ {
/* 34 */ DEFAULT {
/* */ public JsonElement serialize(Long value) {
/* 36 */ return new JsonPrimitive(value);
/* */ }
/* */ },
/* */
/* */
/* */
/* */
/* */
/* */
/* 45 */ STRING {
/* */ public JsonElement serialize(Long value) {
/* 47 */ return new JsonPrimitive(String.valueOf(value));
/* */ }
/* */ };
/* */
/* */ public abstract JsonElement serialize(Long paramLong);
/* */ }
/* Location: C:\Users\Josep\Downloads\Decompile Minecraft\tuinity-1.16.3.jar!\com\google\gson\LongSerializationPolicy.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ | [
"[email protected]"
]
| |
c407071713c937b47059c652a9468f0355ab382b | 6e091263225b226addc6d17dada25f3d3329dfd9 | /JavaSE/01Find2/src/Solution.java | 3ce7701407595784ac1366bfd0feec5f43d861ff | []
| no_license | WangWenQian12/Java_Practice | 7df3920887b2d07ee6f1715692073cbe8ed2088b | dbff6008dc2fba1f0ac3ad2bde402e78438a8f56 | refs/heads/master | 2021-06-30T19:58:37.276996 | 2020-11-02T14:10:32 | 2020-11-02T14:10:32 | 190,980,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | public class Solution {
// 杨氏矩阵
public boolean Find(int target, int[][] array) {
int i = 0;
int j = array[0].length-1;
while(i < array.length && j >=0 ) {
if(array[i][j] == target){
return true;
}else if (target > array[i][j]) {
i++;
} else if(target < array[i][j]){
j--;
}
}
return false;
}
} | [
"[email protected]"
]
| |
b64995a75de3f44efc84f89f175d4b0984b2466c | d9cefe6c22e2e88980931472177832663314667e | /src/main/java/pe/edu/upc/dao/IUsuarioDao.java | 030d59eb866d7d718e4ffa8ec8ee7a5c82d389e4 | []
| no_license | Kahs98/MyTransport.V1 | 69c21017d4cd26689ad77b6c19350629cc718c30 | 90b8de4c9c1b71c49064e2bf9ab2d0fab5162bf9 | refs/heads/main | 2023-08-10T17:46:35.324889 | 2021-09-30T09:43:15 | 2021-09-30T09:43:15 | 412,004,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package pe.edu.upc.dao;
import java.util.List;
import pe.edu.upc.entity.Usuario;
public interface IUsuarioDao {
public void insertar(Usuario usuario);
public List<Usuario> listar();
public void eliminar(int idUsuario);
public List<Usuario> findByDNIUsuario(Usuario t);
}
| [
"[email protected]"
]
| |
1e03ab0d79cb587916bbcfb11df4f695ce1d3cce | 8c44ac5186f789f8be0269a9fcc48ab084ba081a | /src/main/java/com/github/xiaoxfan/microservicesimpleconsumermovie/MicroserviceSimpleConsumerMovieApplication.java | 1831f4c787a647fa1bfbf117bae59e11f91903f4 | []
| no_license | xiaoxfan/microservice-simple-consumer-movie | 5316c6c7387bbe006ede61673a69bb89758accea | cd7002d598646fed469054593543c0d7d75ff2c7 | refs/heads/master | 2020-04-08T07:54:54.020516 | 2018-11-26T11:13:05 | 2018-11-26T11:13:05 | 159,156,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package com.github.xiaoxfan.microservicesimpleconsumermovie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class MicroserviceSimpleConsumerMovieApplication {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(MicroserviceSimpleConsumerMovieApplication.class, args);
}
}
| [
"[email protected]"
]
| |
b8a29b4a718611b2fe33cf1c1e3968f6953497f3 | 561af688427f63aad8b820182492cc64eb036df2 | /Hydracan/hydraconstraints.resource.hydraConst/src-gen/hydraconstraints/resource/hydraConst/mopp/HydraConstFoldingInformationProvider.java | 822900bdbcde9fc6c850b6d9ebb34cb7838fee91 | []
| no_license | latacita/hydra | af31a0ca5622a86ed48c0fc55d26175f03039ca8 | 349daf1df3b17806440104ba83be845f101f37c8 | refs/heads/master | 2016-09-11T05:20:52.976100 | 2013-03-07T20:44:46 | 2013-03-07T20:44:46 | 32,510,479 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 272 | java | /**
* <copyright>
* </copyright>
*
*
*/
package hydraconstraints.resource.hydraConst.mopp;
public class HydraConstFoldingInformationProvider {
public org.eclipse.emf.ecore.EClass[] getFoldableClasses() {
return new org.eclipse.emf.ecore.EClass[] {
};
}
}
| [
"[email protected]@c5724cf3-a313-91a5-481f-bcaaae864fe7"
]
| [email protected]@c5724cf3-a313-91a5-481f-bcaaae864fe7 |
167769b49f9c4f76e197bb86dba62f75f8c545ad | 52b831279452afac9e41800fbcff8be48129c7e8 | /src/com/mpp/exam/prob3/Problem3.java | 0bb077978e1cb16969af85f5939ed01d42a31de3 | []
| no_license | aklakl/mpp | 961022002dfc3d563fe24d2d5003684034090406 | 2734edb795b1286b5f3353f95134a2fd1effaa6d | refs/heads/master | 2021-08-20T10:23:52.879896 | 2017-11-28T22:04:50 | 2017-11-28T22:04:50 | 112,393,895 | 0 | 0 | null | 2017-11-28T22:04:51 | 2017-11-28T21:57:23 | null | UTF-8 | Java | false | false | 1,030 | java | package com.mpp.exam.prob3;
import java.time.LocalDate;
import java.util.Iterator;
import java.util.List;
import helperclasses.Book;
import helperclasses.LibraryMember;
import helperclasses.LibrarySystemException;
import helperclasses.TestData;
public class Problem3 {
@SuppressWarnings("unused")
public static void main(String[] args) {
Problem3 p = new Problem3();
List<LibraryMember> members = TestData.INSTANCE.getMembers();
p.books = TestData.INSTANCE.getAllBooks().iterator();
LibraryMember member = p.detectIfWinnerDuringCheckout(members);
System.out.println(member);
}
Iterator<Book> books;
public LibraryMember detectIfWinnerDuringCheckout(List<LibraryMember> mems) {
return mems.stream().filter(mem -> {
try {
return mem.checkout(books.next().getNextAvailableCopy(), LocalDate.now(), LocalDate.of(2015, 9, 1))
.getCheckoutRecordEntries().size() == 10;
} catch (LibrarySystemException e) {
e.printStackTrace();
return false;
}
}).findFirst().orElse(null);
}
}
| [
"[email protected]"
]
| |
a7ccd6278e03c116f092ce25284a3b984f0a1683 | babf149f18ccdc4102fc9bc03d4610cbff0da6da | /iot-e2e-tests/android/things/src/androidTest/java/com/microsoft/azure/sdk/iot/androidthings/iothubservices/errorinjection/twin/ReportedPropertiesErrInjDeviceThingsRunner.java | ad0665edc33bbf49e877251547dbf0e2386d328c | [
"MIT"
]
| permissive | mjcctech/azure-iot-sdk-java | c49d710378030f72a07273e2416e3331f158d1c9 | f40631dbbae5348a8f0999c0728cda837586a024 | refs/heads/master | 2020-04-22T16:02:17.691078 | 2019-02-04T17:23:13 | 2019-02-07T21:15:55 | 170,495,776 | 0 | 0 | NOASSERTION | 2019-02-13T14:14:23 | 2019-02-13T11:23:07 | Java | UTF-8 | Java | false | false | 2,655 | java | /*
* Copyright (c) Microsoft. All rights reserved.
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
package com.microsoft.azure.sdk.iot.androidthings.iothubservices.errorinjection.twin;
import com.microsoft.azure.sdk.iot.androidthings.BuildConfig;
import com.microsoft.azure.sdk.iot.common.helpers.ClientType;
import com.microsoft.azure.sdk.iot.common.helpers.Rerun;
import com.microsoft.azure.sdk.iot.common.tests.iothubservices.errorinjection.ReportedPropertiesErrInjTests;
import com.microsoft.azure.sdk.iot.deps.util.Base64;
import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol;
import com.microsoft.azure.sdk.iot.service.BaseDevice;
import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType;
import org.junit.AfterClass;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Collection;
@RunWith(Parameterized.class)
public class ReportedPropertiesErrInjDeviceThingsRunner extends ReportedPropertiesErrInjTests
{
static Collection<BaseDevice> identities;
@Rule
public Rerun count = new Rerun(3);
public ReportedPropertiesErrInjDeviceThingsRunner(String deviceId, String moduleId, IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType, String publicKeyCert, String privateKey, String x509Thumbprint)
{
super(deviceId, moduleId, protocol, authenticationType, clientType, publicKeyCert, privateKey, x509Thumbprint);
}
//This function is run before even the @BeforeClass annotation, so it is used as the @BeforeClass method
@Parameterized.Parameters(name = "{2}_{3}_{4}")
public static Collection inputsCommons() throws IOException, GeneralSecurityException
{
String privateKeyBase64Encoded = BuildConfig.IotHubPrivateKeyBase64;
String publicKeyCertBase64Encoded = BuildConfig.IotHubPublicCertBase64;
iotHubConnectionString = BuildConfig.IotHubConnectionString;
String x509Thumbprint = BuildConfig.IotHubThumbprint;
String privateKey = new String(Base64.decodeBase64Local(privateKeyBase64Encoded.getBytes()));
String publicKeyCert = new String(Base64.decodeBase64Local(publicKeyCertBase64Encoded.getBytes()));
Collection inputs = inputsCommon(ClientType.DEVICE_CLIENT, publicKeyCert, privateKey, x509Thumbprint);
identities = getIdentities(inputs);
return inputs;
}
@AfterClass
public static void cleanUpResources()
{
tearDown(identities);
}
}
| [
"[email protected]"
]
| |
05f90089fa1015a65cfc064a52d480a6fcd0ab29 | b80efbbcf2316292aa5868e8d079481756174eac | /src/main/java/com/wday/prism/dataset/file/schema/ParseOptions.java | 865463ad68ca0ee10138c8778939af53092f7df8 | [
"Apache-2.0"
]
| permissive | terretta/workday-prism-analytics-data-loader | 624b0b9161ac151897d504d00451f2904cd8739f | 641dd9e6cdf8c49f6c156ab1573b5e32b3076443 | refs/heads/master | 2023-08-23T12:03:12.526067 | 2019-09-24T22:47:58 | 2019-09-24T22:47:58 | 218,604,065 | 0 | 0 | NOASSERTION | 2023-08-07T17:14:33 | 2019-10-30T19:15:31 | null | UTF-8 | Java | false | false | 5,035 | java | /*
* =========================================================================================
* Copyright (c) 2018 Workday, Inc.
*
* 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.
*
* Contributors:
* Each Contributor (“You”) represents that such You are legally entitled to submit any
* Contributions in accordance with these terms and by posting a Contribution, you represent
* that each of Your Contribution is Your original creation.
*
* You are not expected to provide support for Your Contributions, except to the extent You
* desire to provide support. You may provide support for free, for a fee, or not at all.
* Unless required by applicable law or agreed to in writing, You provide Your Contributions
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions of TITLE,
* NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
* =========================================================================================
*/
package com.wday.prism.dataset.file.schema;
import java.util.LinkedHashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class ParseOptions {
private String fieldsDelimitedBy = ",";
private char fieldsEnclosedBy = '"';
private int headerLinesToIgnore = 1; // BY DEFAULT THERE IS A HEADER LINE IN CSV
private Map<String, String> charset = new LinkedHashMap<String, String>();
private Map<String, String> type = new LinkedHashMap<String, String>();
@JsonIgnore
private String charsetName = "UTF-8";
public String getCharsetName() {
return charsetName;
}
public void setCharsetName(String charsetName) {
this.charsetName = charsetName;
}
public String getFieldsDelimitedBy() {
return fieldsDelimitedBy;
}
public void setFieldsDelimitedBy(String fieldsDelimitedBy) {
if (fieldsDelimitedBy != null && !fieldsDelimitedBy.isEmpty())
this.fieldsDelimitedBy = fieldsDelimitedBy;
}
public char getFieldsEnclosedBy() {
return fieldsEnclosedBy;
}
public void setFieldsEnclosedBy(char fieldsEnclosedBy) {
this.fieldsEnclosedBy = fieldsEnclosedBy;
}
public int getHeaderLinesToIgnore() {
return headerLinesToIgnore;
}
public void setHeaderLinesToIgnore(int numberOfLinesToIgnore) {
this.headerLinesToIgnore = numberOfLinesToIgnore;
}
public Map<String, String> getCharset() {
charset.put("id", "Encoding=" + getCharsetName());
return charset;
}
public void setCharset(Map<String, String> charset) {
if (charset != null && charset.containsKey("id")) {
String temp = charset.get("id");
if (temp != null && !temp.trim().isEmpty()) {
setCharsetName(temp.replace("Encoding=", ""));
}
}
}
public Map<String, String> getType() {
if (type != null && !type.containsKey("id"))
type.put("id", "Schema_File_Type=Delimited");
return type;
}
public void setType(Map<String, String> type) {
this.type = type;
}
public ParseOptions() {
super();
}
public ParseOptions(ParseOptions old) {
super();
if (old != null) {
setCharsetName(old.getCharsetName());
setFieldsDelimitedBy(old.getFieldsDelimitedBy());
setFieldsEnclosedBy(old.getFieldsEnclosedBy());
setHeaderLinesToIgnore(old.getHeaderLinesToIgnore());
}
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getCharsetName() == null) ? 0 : getCharsetName().hashCode());
result = prime * result + ((getFieldsDelimitedBy() == null) ? 0 : getFieldsDelimitedBy().hashCode());
result = prime * result + getFieldsEnclosedBy();
result = prime * result + getHeaderLinesToIgnore();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ParseOptions other = (ParseOptions) obj;
if (getCharsetName() == null) {
if (other.getCharsetName() != null) {
return false;
}
} else if (!getCharsetName().equals(other.getCharsetName())) {
return false;
}
if (getFieldsDelimitedBy() == null) {
if (other.getFieldsDelimitedBy() != null) {
return false;
}
} else if (!getFieldsDelimitedBy().equals(other.getFieldsDelimitedBy())) {
return false;
}
if (getFieldsEnclosedBy() != other.getFieldsEnclosedBy()) {
return false;
}
if (getHeaderLinesToIgnore() != other.getHeaderLinesToIgnore()) {
return false;
}
return true;
}
}
| [
"[email protected]"
]
| |
9b41d4e720e21f721ec642fd2dd98f4ddd2a1e29 | 3f20ba7e2c50d6d70a394fbe325683f0653414eb | /src/main/java/guru/springframework/services/IngredientServiceImpl.java | 53cc47a8f9112083a964048d0808747e7b1c8a73 | []
| no_license | kschafer2/sfg-recipes | cc3e05cc527361c311ba1e172cdf1ed03e90e28d | 8ab8e84b82232c30b32c7c2225e0a79b25364471 | refs/heads/master | 2020-04-29T08:26:30.102103 | 2019-08-19T19:20:00 | 2019-08-20T13:33:28 | 175,986,851 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,222 | java | package guru.springframework.services;
import guru.springframework.commands.IngredientCommand;
import guru.springframework.converters.IngredientCommandToIngredient;
import guru.springframework.converters.IngredientToIngredientCommand;
import guru.springframework.domain.Ingredient;
import guru.springframework.domain.Recipe;
import guru.springframework.repositories.RecipeRepository;
import guru.springframework.repositories.UnitOfMeasureRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Optional;
@Slf4j
@Service
public class IngredientServiceImpl implements IngredientService {
private final RecipeRepository recipeRepository;
private final UnitOfMeasureRepository unitOfMeasureRepository;
private final IngredientToIngredientCommand ingredientToIngredientCommand;
private final IngredientCommandToIngredient ingredientCommandToIngredient;
public IngredientServiceImpl(RecipeRepository recipeRepository, UnitOfMeasureRepository unitOfMeasureRepository,
IngredientToIngredientCommand ingredientToIngredientCommand,
IngredientCommandToIngredient ingredientCommandToIngredient) {
this.recipeRepository = recipeRepository;
this.unitOfMeasureRepository = unitOfMeasureRepository;
this.ingredientToIngredientCommand = ingredientToIngredientCommand;
this.ingredientCommandToIngredient = ingredientCommandToIngredient;
}
@Override
public IngredientCommand findByRecipeIdAndIngredientId(Long recipeId, Long ingredientId) {
Optional<Recipe> recipeOptional = recipeRepository.findById(recipeId);
if(!recipeOptional.isPresent()) {
//todo implement error handling
log.error("Ingredient id not found: " + ingredientId);
}
Recipe recipe = recipeOptional.get();
Optional<IngredientCommand> ingredientCommandOptional = recipe.getIngredients().stream()
.filter(ingredient -> ingredient.getId().equals(ingredientId))
.map(ingredient -> ingredientToIngredientCommand.convert(ingredient)).findFirst();
if(!ingredientCommandOptional.isPresent()) {
//todo implement error handling
log.error("Ingredient id not found: " + ingredientId);
}
return ingredientCommandOptional.get();
}
@Transactional
@Override
public IngredientCommand saveIngredientCommand(IngredientCommand command) {
Optional<Recipe> recipeOptional = recipeRepository.findById(command.getRecipeId());
if(!recipeOptional.isPresent()) {
//todo implement error checking
log.error("Recipe not found for id: " + command.getRecipeId());
return new IngredientCommand();
} else {
Recipe recipe = recipeOptional.get();
Optional<Ingredient> ingredientOptional = recipe
.getIngredients()
.stream()
.filter(ingredient -> ingredient.getId().equals(command.getId()))
.findFirst();
if(ingredientOptional.isPresent()) {
Ingredient ingredientFound = ingredientOptional.get();
ingredientFound.setDescription(command.getDescription());
ingredientFound.setAmount(command.getAmount());
ingredientFound.setUom(unitOfMeasureRepository
.findById(command.getUom().getId())
.orElseThrow(() -> new RuntimeException("UOM NOT FOUND"))); //todo address this
} else {
//add new Ingredient
Ingredient ingredient = ingredientCommandToIngredient.convert(command);
ingredient.setRecipe(recipe);
recipe.addIngredient(ingredient);
}
Recipe savedRecipe = recipeRepository.save(recipe);
//search for ingredient by id
Optional<Ingredient> savedIngredientOptional = savedRecipe.getIngredients()
.stream()
.filter(recipeIngredients -> recipeIngredients.getId().equals(command.getId()))
.findFirst();
//otherwise, search for ingredient by description, amount, and uomId
if(!savedIngredientOptional.isPresent()) {
//may not be safe
savedIngredientOptional = savedRecipe.getIngredients()
.stream()
.filter(recipeIngredients ->
recipeIngredients.getDescription().equals(command.getDescription()))
.filter(recipeIngredients ->
recipeIngredients.getAmount().equals(command.getAmount()))
.filter(recipeIngredients ->
recipeIngredients.getUom().getId().equals(command.getUom().getId()))
.findFirst();
}
return ingredientToIngredientCommand.convert(savedIngredientOptional.get());
}
}
@Override
public void deleteByRecipeIdAndIngredientId(Long recipeId, Long id) {
log.debug("Deleting ingredient: " + recipeId + ":" + id);
Optional<Recipe> recipeOptional = recipeRepository.findById(recipeId);
if(recipeOptional.isPresent()) {
Recipe recipe = recipeOptional.get();
log.debug("Found Recipe");
Optional<Ingredient> ingredientOptional = recipe
.getIngredients()
.stream()
.filter(ingredient -> ingredient.getId().equals(id))
.findFirst();
if(ingredientOptional.isPresent()) {
log.debug("Found Ingredient");
Ingredient ingredientToDelete = ingredientOptional.get();
ingredientToDelete.setRecipe(null);
recipe.getIngredients().remove(ingredientOptional.get());
recipeRepository.save(recipe);
}
} else {
log.debug("Recipe " + recipeId + " Not Found!");
}
}
}
| [
"[email protected]"
]
| |
d3ce7920fb32df092bee53cd424b3d080aa6a3c1 | 527eeea04b6a39e05b15926d4c51f64b17ff29da | /trail/src/test/java/krtkush/github/io/trail/ExampleUnitTest.java | 51e418fb4449bd0be5d41f1c5a829ba7d2c920a6 | []
| no_license | krtkush/Trail | 27be30ad7f1ddcd5dd9f7df03b81cf45a4b110e5 | 03614854ac5f8e07aadff49435f04e2c91edf42d | refs/heads/master | 2022-10-19T05:41:07.212239 | 2022-10-07T22:06:16 | 2022-10-07T22:06:16 | 87,334,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package krtkush.github.io.trail;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
92b5c371f64271dbb18809b4d854a4ec2c181d4d | 30eb08a6a2faf851eab7c6a43326ec34fa94e66c | /app/src/main/java/calderonconductor/tactoapps/com/calderonconductor/Adapter/ListaComentariosHistoricoAdapter.java | 0430a6a5c685315e5e746db8296d8575e548cda7 | []
| no_license | Andres20000/CalderonConductorII | ba5ae6d478c814a47695b710df3561fe16f49f27 | 82c560781c04b621acc76d7ff931778e2c80e4f9 | refs/heads/master | 2023-08-22T06:56:06.221144 | 2023-08-13T00:55:21 | 2023-08-13T00:55:21 | 233,422,507 | 0 | 0 | null | 2020-01-29T20:25:32 | 2020-01-12T16:29:27 | Java | UTF-8 | Java | false | false | 2,072 | java | package calderonconductor.tactoapps.com.calderonconductor.Adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import calderonconductor.tactoapps.com.calderonconductor.Clases.Calificacion;
import calderonconductor.tactoapps.com.calderonconductor.Clases.Modelo;
import calderonconductor.tactoapps.com.calderonconductor.R;
/**
* Created by tactomotion on 30/08/16.
*/
public class ListaComentariosHistoricoAdapter extends BaseAdapter {
//Atributos del adaptador
private final Context mContext;
private List<Calificacion> calificaciones;
private Modelo sing = Modelo.getInstance();
//recivimos los datos de la clase informacionServicio
public ListaComentariosHistoricoAdapter(Context mContext, String idServicio){
this.mContext = mContext;
//informacion del pasajero segun el idServicio
this.calificaciones = sing.getOrdenHistorial(idServicio).calificaciones;
}
@Override
public int getCount() {
return calificaciones.size();
}
@Override
public Object getItem(int position) {
return calificaciones.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Declare Variables
final TextView comentario;
final Calificacion calificacion = (Calificacion) getItem(position);
// Inflate la vista de la Orden
LinearLayout itemLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.adapter_comentario, parent, false);
// Toma los elementos a utilizar
comentario = (TextView) itemLayout.findViewById(R.id.comentario);
comentario.setText(calificacion.getObervacion());
return itemLayout;
}
}
| [
"[email protected]"
]
| |
d00dd0d3eb8d60b912a7299f791145355b05a80b | d55d8bff80b6e53f98d06a4c2ad1ec3718499d57 | /src/main/java/com/mps/insight/c4/report/library/DB1Report.java | a14d1b593a66b752993fe87e256f816ea7af0260 | []
| no_license | satyamsingh1/newInsigtc5Api | 8cdc441518fb060caff7be5650d68af117fd6c9b | 6ff294cea0fbc16e73711a1fd0e40b72dc9f48ed | refs/heads/master | 2023-04-28T11:55:40.716131 | 2020-02-27T04:11:25 | 2020-02-27T04:11:25 | 242,647,535 | 0 | 0 | null | 2023-04-14T17:33:04 | 2020-02-24T04:37:02 | Java | UTF-8 | Java | false | false | 2,998 | java | package com.mps.insight.c4.report.library;
import com.mps.insight.c4.report.DynamicMonthCreater;
import com.mps.insight.global.MyLogger;
public class DB1Report {
DynamicMonthCreater dmc = new DynamicMonthCreater();
private String tableName = "DataBaseReport1";
private String query = "";
private String montList = "";
private String accountCode;
private String from;
private String to;
private String queryHeader ="CONCAT('Total for all Database_', UserActivity) AS Database_,`Publisher`,`UserActivity`";
public DB1Report(String accountCode, String report, String from, String to) {
this.accountCode = accountCode;
this.from = from;
this.to = to;
run();
}
public void run() {
includeMonth();
generatDB1Report();
}
public void generatDB1Report() {
StringBuilder stb = new StringBuilder();
try {
stb.append("SELECT ");
stb.append(" " + queryHeader + ",");
stb.append(" (" + getMonthSum(montList) + " ) AS `Reporting_Period_Total`,");
stb.append(" " + getMonthAliasSum(montList) + "");
stb.append(" from " + tableName + " where");
stb.append(" Institution='" + accountCode + "' ");
stb.append(" GROUP BY `Publisher`,`UserActivity` ");
stb.append("UNION ALL ");
stb.append("SELECT Database_,`Publisher`,`UserActivity`, ");
stb.append("("+getMonthPlus(montList)+") AS `Reporting Period Total`, ");
stb.append(montList+" ");
stb.append("FROM "+tableName+" WHERE institution='"+accountCode+"'");
} catch (Exception e) {
MyLogger.error("DB1Report : generatDB1Report : Unable to create query " + e.toString());
}
this.query = stb.toString();
}
private void includeMonth() {
try {
montList = dmc.getMonthListNew("DB1", from, to);
} catch (Exception e) {
MyLogger.error("BR2Report : unable to add month in query" + e.toString());
}
}
private String getMonthSum(String montList){
String[] months = montList.split(",");
StringBuilder sb = new StringBuilder();
for (String string : months) {
sb.append("SUM("+string+")")
.append("+");
}
//remove last + symbol
return sb.toString().substring(0, sb.length()-1);
}
private String getMonthAliasSum(String montList){
String[] months = montList.split(",");
StringBuilder sb = new StringBuilder();
for (String string : months) {
sb.append("SUM("+string+")")
.append(" AS "+string+",");
}
//remove last + symbol
return sb.toString().substring(0, sb.length()-1);
}
private String getMonthPlus(String montList){
String[] months = montList.split(",");
StringBuilder sb = new StringBuilder();
for (String string : months) {
sb.append(string+"+");
}
//remove last + symbol
return sb.toString().substring(0, sb.length()-1);
}
public String getQuery() {
return query;
}
public void setQuery(String query) {
this.query = query;
}
}
| [
"[email protected]"
]
| |
01af2cfa992dd4ee8919abdd664be73bc7d09c69 | 71b15ca4d295dd125a4728bb2e9bfe5ee1cf2ee3 | /Auction/src/main/java/kr/ac/jbnu/dao/ProductDaoImpl.java | 70b189af1f50f8e02513843e036c2e1192631976 | []
| no_license | insangYu/Auction | 98f6df8ddbb44b8d196d27609edf20ff5fc9c124 | eb489c8b3e42ed4260aefc515077d4e6b760217f | refs/heads/master | 2020-04-16T02:07:43.792493 | 2019-01-11T07:34:43 | 2019-01-11T07:34:43 | 165,198,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,794 | java | package kr.ac.jbnu.dao;
import java.util.List;
import javax.transaction.Transactional;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import kr.ac.jbnu.model.Product;
public class ProductDaoImpl implements ProductDao {
private SessionFactory sessionFactory;
public ProductDaoImpl(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
@Transactional
public List<Product> queryProduct() {
@SuppressWarnings("unchecked")
List<Product> list = (List<Product>) sessionFactory.getCurrentSession().createCriteria(Product.class)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
return list;
}
@Override
@Transactional
public Product findProduct(String productCode) {
Query query = sessionFactory.getCurrentSession()
.createQuery("from Product as product where code=:code");
query.setParameter("code", Integer.parseInt(productCode));
@SuppressWarnings("unchecked")
List<Product> list = (List<Product>) query.list();
return list.get(0);
}
@Override
@Transactional
public List<Product> querySearchedProduct(String keyword) {
// TODO Auto-generated method stub
Query query = sessionFactory.getCurrentSession()
.createQuery("from Product as product where product.name like :name");
query.setParameter("name", "%" + keyword + "%");
@SuppressWarnings("unchecked")
List<Product> list = (List<Product>) query.list();
return list;
}
@Override
@Transactional
public List<Product> queryPriceSearchedProduct(String minprice, String maxprice) {
// TODO Auto-generated method stub
Query query = sessionFactory.getCurrentSession().createQuery(
"from Product as product where product.price>=:minprice and " + "product.price<=:maxprice");
query.setInteger("minprice", Integer.parseInt(minprice));
query.setInteger("maxprice", Integer.parseInt(maxprice));
@SuppressWarnings("unchecked")
List<Product> list = (List<Product>) query.list();
return list;
}
@Override
@Transactional
public List<Product> queryCategorySearchedProduct(String _category) {
// TODO Auto-generated method stub
String hql = null;
if (_category.equals("others")) {
hql = "from Product a where a.category<>'fashion' and a.category<>'electronics' and a.category<>'health' and a.category<>'motors' and a.category<>'collections' "
+ "and a.category<>'sports'and a.category<>'interior'and a.category<>'beauty'";
} else {
hql = "from Product a where a.category='" + _category + "'";
}
Query query = sessionFactory.getCurrentSession().createQuery(hql);
@SuppressWarnings("unchecked")
List<Product> list = (List<Product>) query.list();
return list;
}
@Override
@Transactional
public void insertProduct(Product product) {
// TODO Auto-generated method stub
Session session;
try {
session = sessionFactory.getCurrentSession();
} catch (HibernateException e) {
session = sessionFactory.openSession();
}
session.save(product);
}
@Override
@Transactional
public void updateProduct(Product product) {
// TODO Auto-generated method stub
Query query = sessionFactory.getCurrentSession()
.createQuery("update Product set bid_price=:bid_price, "
+ "bidder=:bidder, "
+ "bid_stack=:bid_stack "
+ "where name=:name");
query.setParameter("bid_price", product.getBid_price());
query.setParameter("bidder", product.getBidder());
query.setParameter("bid_stack", product.getBid_stack());
System.out.println(product.getName());
query.setParameter("name", product.getName());
@SuppressWarnings("unchecked")
int result = query.executeUpdate();
System.out.println("쿼리업데이트들어감 프로덕트");
}
}
| [
"[email protected]"
]
| |
c94dfa514bbfb3226a909c37423ef56b777c2637 | 4159224dde67616c7b64707d149253fc70724f1b | /XmlToJson.java | 292a0f7aa99ace0f0e3f33794daa57cef34be1e5 | []
| no_license | yxingithub/git_test | 4eac24e04878446f63ca5aeee74c11da55fb7a7e | ea6d67a698f3199ba2afaf7e2860f28f5ec875ef | refs/heads/master | 2020-05-30T12:23:45.506470 | 2019-06-02T02:54:01 | 2019-06-02T02:54:01 | 189,732,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,459 | java |
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import net.sf.json.JSON;
import net.sf.json.JSONSerializer;
import net.sf.json.xml.XMLSerializer;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
public class XmlToJson {
public static void main(String[] args) {
//xml转json
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><realName>test</realName><identityNumber>411525152242417185276</identityNumber><phone>1314456788</phone><user><sex>nan</sex><name>zhangsan</name><age>23</age></user><user><sex>nv</sex><name>lisi</name><age>18</age></user></request>";
// String str = xml2json(xml);
// System.out.println("to_json" + str);
//xmlDocument转json
Document doc = null;
try {
FileInputStream fis = new FileInputStream("E:\\lsworkspace\\helloWord\\WebContent\\resources\\customer.xml");
byte[] b = new byte[fis.available()];
fis.read(b);
String str = new String(b);
System.out.println(str);
doc = DocumentHelper.parseText(str);
// 转为可解析对象
// doc = DocumentHelper.parseText(xml);
String newStr = xml2json(str);
System.out.println("to_json" + newStr);
} catch (DocumentException e) {
e.printStackTrace();
}
//json转xml
// String newxml = json2xml(str);
// System.out.println("xml:" + newxml);
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("username", "horizon");
// JSONArray jsonArray = new JSONArray();
// JSONObject dataJson = new JSONObject();
// jsonArray.add(jsonObject);
// //jsonArray.add(jsonObject);
// dataJson.put("data", jsonArray);
// System.out.println(dataJson.toString());
//
// String xml = json2xml(dataJson.toString());
// System.out.println("xml:" + xml);
// String str = xml2json(xml);
// System.out.println("to_json" + str);
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* 将xml字符串<STRONG>转换</STRONG>为JSON字符串
*
* @param xmlString
* xml字符串
* @return JSON<STRONG>对象</STRONG>
*/
public static String xml2json(String xmlString) {
XMLSerializer xmlSerializer = new XMLSerializer();
JSON json = xmlSerializer.read(xmlString);
return json.toString(1);
}
/**
* 将xmlDocument<STRONG>转换</STRONG>为JSON<STRONG>对象</STRONG>
*
* @param xmlDocument
* XML Document
* @return JSON<STRONG>对象</STRONG>
*/
public static String xml2json(Document xmlDocument) {
return xml2json(xmlDocument.toString());
}
/**
* JSON(数组)字符串<STRONG>转换</STRONG>成XML字符串
*
* @param jsonString
* @return
*/
public static String json2xml(String jsonString) {
XMLSerializer xmlSerializer = new XMLSerializer();
return xmlSerializer.write(JSONSerializer.toJSON(jsonString));
// return xmlSerializer.write(JSONArray.fromObject(jsonString));//这种方式只支持JSON数组
}
} | [
"[email protected]"
]
| |
62debec23438abdc9f7a30b681de66c1fd72e13d | 7c0dc5cd25ccc19e836416e5fc22cdfec56de7e2 | /csolver-java-core/csolver/kernel/solver/propagation/event/ConstraintEvent.java | a0490163e047854ac9225a5a8796cb1fc00fde06 | []
| no_license | EmilioDiez/csolver | 3b453833566e36151014a36ab914548fe4569dc1 | 44202f7b3c5bcf3d244f0fd617261b63aa411a68 | refs/heads/master | 2020-12-29T03:30:55.881640 | 2018-11-18T03:04:14 | 2018-11-18T03:04:14 | 68,049,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,324 | java | /*
* Javascript Constraint Solver (CSolver) Copyright (c) 2016,
* Emilio Diez,All rights reserved.
*
*
* Choco Copyright (c) 1999-2010, Ecole des Mines de Nantes
* 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 Ecole des Mines de Nantes 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 REGENTS 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 REGENTS AND 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 csolver.kernel.solver.propagation.event;
import csolver.kernel.solver.ContradictionException;
import csolver.kernel.solver.propagation.Propagator;
import nitoku.log.Logger;
/**
* A class for constraint revisions in the propagation process.
*/
public class ConstraintEvent implements PropagationEvent {
private static int _value = 1;
public final static int UNARY = _value++;
public final static int BINARY = _value++;
public final static int TERNARY = _value++;
public final static int LINEAR = _value++;
public final static int QUADRATIC = _value++;
public final static int CUBIC = _value++;
public final static int VERY_SLOW = _value++;
public final static int NB_PRIORITY = _value;
/**
* The touched constraint.
*/
private Propagator touchedConstraint;
/**
* Specifies if the constraint should be initialized.
*/
private boolean initialized = false;
/**
* Returns the priority of the var.
*/
private int priority = (-1);
/**
* Constructs a new var with the specified values for the fileds.
*/
public ConstraintEvent(Propagator constraint, boolean init, int prio) {
this.touchedConstraint = constraint;
this.initialized = init;
this.priority = prio;
}
public Object getModifiedObject() {
return touchedConstraint;
}
/**
* Returns the priority of the var.
*/
@Override
public int getPriority() {
return priority;
}
/**
* Propagates the var: awake or propagate depending on the init status.
*
* @throws csolver.kernel.solver.ContradictionException
*
*/
public boolean propagateEvent() throws ContradictionException {
if (this.initialized) {
assert (this.touchedConstraint.isActive());
this.touchedConstraint.propagate();
} else {
this.touchedConstraint.setActiveSilently();
this.touchedConstraint.awake();
}
return true;
}
/**
* Returns if the constraint is initialized.
*/
public boolean isInitialized() {
return this.initialized;
}
/**
* Sets if the constraint is initialized.
*/
public void setInitialized(boolean init) {
this.initialized = init;
}
/**
* Testing whether an event is active in the propagation network
*/
public boolean isActive(int idx) {
return true;
}
/**
* Clears the var. This should not be called with this kind of var.
*/
public void clear() {
Logger.warning(ConstraintEvent.class,"Const Awake Event does not need to be cleared !");
}
}
| [
"[email protected]"
]
| |
f067f84c74d3331158186a017840a17e0165b06f | 204d80af21c91be323fd607feb334bb76c72cecc | /evector-web/evector-web/src/univ/evector/db/dao/GramWordDao.java | 80a2c9af7b76b325e141d63bb144aa537376270a | []
| no_license | lukasonokoleg/evector | 3cb708f93de05b5e1944339ffed472f50ad89ca9 | 942855db30b3210485beebb84789b7043f407af2 | refs/heads/master | 2021-01-10T19:41:00.324499 | 2015-01-07T09:17:09 | 2015-01-07T09:17:09 | 25,296,524 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package univ.evector.db.dao;
import java.util.List;
import lt.jmsys.spark.bind.executor.plsql.errors.SparkBusinessException;
import org.springframework.stereotype.Repository;
import univ.evector.beans.book.GramWord;
@Repository
public interface GramWordDao {
GramWord findGramWord(String word) throws SparkBusinessException;
List<GramWord> findGramWords(List<String> words) throws SparkBusinessException;
List<GramWord> findGramWords(Long prgId) throws SparkBusinessException;
}
| [
"[email protected]"
]
| |
b3bc7dbe01fe0215d35c0d4aa6e2466064f043db | 01fe8e625b063f9deed1635e853884519e0c9143 | /testjava/src/main/java/test/string/TestString.java | faa67d8216c668271f17f84193d3238b9ffebab6 | []
| no_license | warterWu/my-javaweb-project-demo | 2887c6884577aafe3e49b2770732e9e4eef0ecd7 | c827384eeb0ba68278dea795b8de3f98da1573cf | refs/heads/master | 2020-05-02T07:28:53.344593 | 2014-02-14T06:56:45 | 2014-02-14T06:56:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package test.string;
import java.util.HashMap;
import org.apache.commons.lang.StringUtils;
public class TestString {
public static void main(String[] args) {
Integer num = null;
System.out.println(String.valueOf(num));//null字符串
StringBuffer sb = new StringBuffer();
System.out.println("result="+sb.toString());//返回空result=
StringBuilder sb2 = new StringBuilder();
System.out.println("sb="+sb2.substring(0, 0));
/* split */
String ipListStr = "10.10.10.1,,10.10.10.2";
String[] ipArr = ipListStr.split(",");
System.out.println("ip size="+ipArr.length);
for(String ip:ipArr){
System.out.print(ip+", ");
}
System.out.println(String.valueOf(new HashMap().get("memcached_ip")));//null(PS: String)
System.out.println("test map get null=" + StringUtils.isEmpty(String.valueOf(new HashMap().get("memcached_ip"))));
}
}
| [
"[email protected]"
]
| |
cb9c4b3f0612e3d97d36c0563681728ce59eb84a | 2d2cb6c660cbc97f63d16c8c0120be12d0d1181f | /src/main/java/com/bewitchment/common/item/util/ModItemDoor.java | 23b682829873550b3d9a0d760e2fbe2a9f9bb7bd | [
"MIT"
]
| permissive | DavveCze/Bewitchment | a8ae779c04a748fbcf4696cd15958a0c4a97a9f2 | 718117b4419f553f3652c4fd62f1fe644cf7501d | refs/heads/the-snappening | 2020-06-10T16:56:50.325031 | 2019-06-24T23:32:28 | 2019-06-24T23:32:28 | 193,682,706 | 1 | 0 | MIT | 2019-06-28T09:28:26 | 2019-06-25T10:01:26 | Java | UTF-8 | Java | false | false | 1,827 | java | package com.bewitchment.common.item.util;
import com.bewitchment.Util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.Random;
public class ModItemDoor extends ItemDoor {
public final ModBlockDoor door;
public ModItemDoor(String name, Block base, String... oreDictionaryNames) {
this(name, new ModBlockDoor("block_" + name, base), oreDictionaryNames);
}
private ModItemDoor(String name, ModBlockDoor door, String... oreDictionaryNames) {
super(door);
Util.registerItem(this, name, oreDictionaryNames);
this.door = door;
this.door.drop = new ItemStack(this);
}
@SuppressWarnings({"NullableProblems", "ConstantConditions"})
public static class ModBlockDoor extends BlockDoor {
private ItemStack drop;
private ModBlockDoor(String name, Block base) {
super(base.getDefaultState().getMaterial());
Util.registerBlock(this, name, base);
setCreativeTab(null);
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return Util.isTransparent(getDefaultState()) ? BlockRenderLayer.TRANSLUCENT : BlockRenderLayer.CUTOUT;
}
@Override
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
return drop;
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return state.getValue(HALF) == EnumDoorHalf.UPPER ? Items.AIR : drop.getItem();
}
}
} | [
"[email protected]"
]
| |
79dcae8224e3f55dc887156963aecfe88570d993 | de67300bd12e65ab23b2f33cb49f35b69dca349e | /src/main/java/com/lgd/CultyKids/models/services/PuntajefinalService.java | b9bd2d84f41e16ab4e2cd6b05498254f3a995531 | []
| no_license | Diana19lopez/CultyKids | 8940a7859e41d790cf82642f7cb67e2d01e56da5 | 97b1495d881a1d15256172d78ea5f43b49a61933 | refs/heads/master | 2021-01-14T01:04:30.690012 | 2020-03-24T22:44:57 | 2020-03-24T22:44:57 | 242,551,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.lgd.CultyKids.models.services;
import java.util.List;
import java.util.Optional;
import com.lgd.CultyKids.models.entities.PuntajeFinal;
public interface PuntajefinalService {
public List<PuntajeFinal> findAll();
public PuntajeFinal save(PuntajeFinal entity);
public Optional<PuntajeFinal> findById (long id);
public void delete (Long id);
}
| [
"[email protected]"
]
| |
dc8c31064a6f06951e1fe1eee32761653469c2f2 | 8d7e2ed8dfae44459bf865b4c5090a08f8c3ec94 | /src/main/java/com/ambition/agile/common/ApiResponse.java | a5d1c1da5f9d032fdd633ff65d2c41543b0cc39b | []
| no_license | hanqingtao/sal_admin | 1aac4a9aeccc1e4a20f849ba45d7e248661ac2db | 9078204eb5ca25a4c6afa9ddf88e9b2e094e951f | refs/heads/master | 2022-12-29T14:34:29.500002 | 2020-01-04T17:13:56 | 2020-01-04T17:13:56 | 122,911,455 | 0 | 0 | null | 2022-12-16T06:11:39 | 2018-02-26T04:08:29 | JavaScript | UTF-8 | Java | false | false | 2,628 | java | package com.ambition.agile.common;
import java.io.Serializable;
/**
* 包装API的返回值
*
* @author Administrator
*
* @param <T> - 任意类型
*/
public class ApiResponse<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 成功返回码
*/
private static final int SUCCESS_CODE = 200;
/**
* 成功消息
*/
private static final String SUCCESS_MSG = "操作成功";
/**
* 成功或失败的具体信息
*/
private String message;
/**
* 返回码
*/
private int code;
/**
* 返回数据
*/
private T body;
/**
* 空构造函数
*/
public ApiResponse() {
}
/**
* 构造函数
* @param code - 返回码;200成功,其它为失败
* @param message - 成功或失败的具体信息
* @param body - 返回的数据,如果没有数据则为null
*/
public ApiResponse(int code, String message, T body) {
this();
this.message = message;
this.body = body;
this.code = code;
}
/**
* 返回成功消息API
* @param <T> 任意类型
* @param body - 要返回的数据
* @return
*/
public static <T> ApiResponse<T> success(T body) {
return new ApiResponse<T>(SUCCESS_CODE, SUCCESS_MSG, body);
}
/**
* 返回成功消息API,指定消息
* @param <T> 任意类型
* @param message - 成功或失败的具体信息
* @param body - 要返回的数据
* @return
*/
public static <T> ApiResponse<T> success(String message, T body) {
return new ApiResponse<T>(SUCCESS_CODE, message, body);
}
/**
* 返回失败消息API,有返回数据
* @param <T> - 任意类型
* @param code - 返回码
* @param message - 返回的消息
* @param body - 返回的数据
* @return - ApiResponse
*/
public static <T> ApiResponse<T> fail(int code, String message, T body) {
return new ApiResponse<T>(code, message, body);
}
/**
* 返回失败消息API,无返回数据
* @param <T> - 任意类型
* @param code - 返回码
* @param message - 返回的消息
* @return - ApiResponse
*/
public static <T> ApiResponse<T> fail(int code, String message) {
return new ApiResponse<T>(code, message, null);
}
/**
* API调用是否成功
* @return - 是否成功
*/
public boolean isSuccess() {
return this.code == SUCCESS_CODE;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getBody() {
return body;
}
public void setBody(T body) {
this.body = body;
}
}
| [
"[email protected]"
]
| |
a96866e658558c73fc6b6e4112e760fb3e052c1a | bc940525ca801390e66877e2aca519f9a4eacdcd | /html_work/PracticeSelf/src/classPractice/ForEx.java | 8c4833c1c64a575a96a10e6435f85dd190513d8e | []
| no_license | gunvv00/Java_practice | 7a98e1f5b7b3afaf91ae8bd4a453b873eee49ed3 | fec8378ccc2a1535bbe7253da9d58c74b81a0306 | refs/heads/master | 2022-12-25T06:36:54.655467 | 2020-02-26T09:04:04 | 2020-02-26T09:04:04 | 232,251,272 | 0 | 0 | null | 2022-12-16T01:02:38 | 2020-01-07T05:43:04 | JavaScript | UTF-8 | Java | false | false | 241 | java | package classPractice;
public class ForEx {
public static void main(String[] args) {
int num = 1;
for(int i = 0; i < 5; i++ ) {
for(int j = 0; j < 4; j++) {
System.out.print(num++ + "\t" );
}System.out.println();
}
}
}
| [
"[email protected]"
]
| |
5722a34d4aedb18975c06c8eb464902ac8557638 | 491d68d006314de605de28a3be398d3bef20b8c3 | /src/main/java/edu/vt/arc/vis/osnap/gui/wizards/IWizardWithStatus.java | 34fedecf7df25d065ec06af72a6e1bce8252ef99 | [
"Apache-2.0"
]
| permissive | VT-Visionarium/osnap | c0afeace5c07686d2897f874da92c2bf782fd512 | 3055447ef2017b0184282ed5d6fb1e71a0d372f1 | refs/heads/master | 2021-01-15T15:51:26.043422 | 2019-01-11T02:05:19 | 2019-01-11T02:05:19 | 25,793,629 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,125 | java | /*******************************************************************************
* Copyright 2014 Virginia Tech Visionarium
*
* 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 edu.vt.arc.vis.osnap.gui.wizards;
import edu.vt.arc.vis.osnap.gui.wizards.statusobjects.IStatus;
/**
* @author Peter J. Radics
* @version 1.0
*
*/
public interface IWizardWithStatus
extends IWizard {
/**
* Returns the status object.
*
* @return the status object.
*/
public IStatus getStatusObject();
}
| [
"[email protected]"
]
| |
3f9e2a699656ef77a9bb4c66add81d167e4bbcbb | 71a457967b5a7cd1db0ee9beb6ff55feec5b9e47 | /src/main/java/com/refatoracao/faturamentolote/bom/strategy/GeradorNotaFiscalPeloFaturamentoLoteParaVendaCliente.java | 848cabc5e4833d4800ae6709808bf87ff38d28a0 | []
| no_license | wendemendes/refatoracao | eb1a685b67b01d88e46a72406e05d8849a2a1e04 | 61e0c0e3ee6dd1b5e965a69f96b8e264301526ab | refs/heads/master | 2021-01-21T08:25:08.629992 | 2017-05-22T23:03:22 | 2017-05-22T23:03:22 | 91,629,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package com.refatoracao.faturamentolote.bom.strategy;
import org.springframework.stereotype.Service;
import com.refatoracao.faturamentolote.bom.parametro.GeradorNotaFiscalPeloFaturamentoLoteParametro;
import notafiscal.model.NotaFiscal;
import notafiscal.model.NotaFiscalFactory;
@Service
public class GeradorNotaFiscalPeloFaturamentoLoteParaVendaCliente implements GeradorNotaFiscalPeloFaturamentoLote{
@Override
public NotaFiscal criarNotaFiscal(GeradorNotaFiscalPeloFaturamentoLoteParametro parametro) {
return NotaFiscalFactory.criarNotaFiscal(this.toString());
}
}
| [
"[email protected]"
]
| |
bb591de6ada5dee08af0dcb2cb72d2a4c8c1dc8a | 3df51e60f6036e7ddf45e2a38f4bf1d67f8f12f0 | /maky/CardsSunJVM/src/com/maky/cards/MyPlayer.java | 5e923702b6ed032245a2cedf9c57bb5452ef99b3 | []
| no_license | maky1984/samples | 57bb1723a82f15ead8e91c79386fb2aa809bc2f6 | ab7b8052cfdf1a8a4b78560d4604caa833afdf49 | refs/heads/master | 2020-04-26T19:30:35.196134 | 2015-03-28T10:19:25 | 2015-03-28T10:19:25 | 13,567,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,765 | java | package com.maky.cards;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import com.maky.cards.player.Player;
public class MyPlayer extends Player {
public MyPlayer(ITable table, int number) {
super(table, "MyPlayer" + number, number);
}
public void readyForAdditionalAttack() {
stopAttack();
}
@Override
public void notifyWin() {
}
@Override
public void notifyLose() {
}
@Override
public int getAttackCardNumberFromHand() {
synchronized (table) {
System.out.println(table);
System.out.println(hand);
System.out.println("Choose card to attck:");
int a = readCardNumber();
System.out.println(a);
return a;
}
}
@Override
public Pair getBlockedPair() {
synchronized (table) {
System.out.println("Pairs:");
for (int i=0;i<pairs.size();i++) {
System.out.print("Pair:" + pairs.get(i).getAttack() + " ");
}
int pairNumber = readCardNumber();
System.out.println(hand);
int cardNumber = readCardNumber();
Pair pair = pairs.get(pairNumber);
Card card = hand.dropCard(cardNumber);
if (pair == null || card == null) {
return null;
}
pair.block(card);
return pair;
}
}
private int readCardNumber() {
int a = -1;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
switch(str.charAt(0)) {
case '1':
a = 0;
break;
case '2':
a = 1;
break;
case '3':
a = 2;
break;
case '4':
a = 3;
break;
case '5':
a = 4;
break;
case '6':
a = 5;
break;
case 'q':
System.out.println("QUIT");
System.exit(0);
break;
}
} catch (IOException e) {
e.printStackTrace();
}
return a;
}
}
| [
"[email protected]"
]
| |
f70b5a617a6c90956153ef80b7e2d19f6027b04c | c51a56c485636bf9df0c384e5b25a11d1c0efbcb | /Android_workspace_4.4/testApp/src/com/google/zxing/integration/android/IntentIntegrator.java | 59b49cf880c0d6be316d07cf576a57376d7e29b1 | []
| no_license | konthornR/Qme-Android | 32c2148520e7dc14f4dddcf0b81f83082ae710d4 | 7d521ef0b9117ecca70d89abdb423954de4ab600 | refs/heads/master | 2021-01-17T23:33:42.879400 | 2015-09-30T14:04:58 | 2015-09-30T14:04:58 | 43,391,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,671 | java | /*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.integration.android;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
/**
* <p>A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
* project's source code.</p>
*
* <h2>Initiating a barcode scan</h2>
*
* <p>To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait
* for the result in your app.</p>
*
* <p>It does require that the Barcode Scanner (or work-alike) application is installed. The
* {@link #initiateScan()} method will prompt the user to download the application, if needed.</p>
*
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
*
* <pre>{@code
* public void onActivityResult(int requestCode, int resultCode, Intent intent) {
* IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
* if (scanResult != null) {
* // handle scan result
* }
* // else continue with any other code you need in the method
* ...
* }
* }</pre>
*
* <p>This is where you will handle a scan result.</p>
*
* <p>Second, just call this in response to a user action somewhere to begin the scan process:</p>
*
* <pre>{@code
* IntentIntegrator integrator = new IntentIntegrator(yourActivity);
* integrator.initiateScan();
* }</pre>
*
* <p>Note that {@link #initiateScan()} returns an {@link AlertDialog} which is non-null if the
* user was prompted to download the application. This lets the calling app potentially manage the dialog.
* In particular, ideally, the app dismisses the dialog if it's still active in its {@link Activity#onPause()}
* method.</p>
*
* <p>You can use {@link #setTitle(String)} to customize the title of this download prompt dialog (or, use
* {@link #setTitleByID(int)} to set the title by string resource ID.) Likewise, the prompt message, and
* yes/no button labels can be changed.</p>
*
* <p>Finally, you can use {@link #addExtra(String, Object)} to add more parameters to the Intent used
* to invoke the scanner. This can be used to set additional options not directly exposed by this
* simplified API.</p>
*
* <p>By default, this will only allow applications that are known to respond to this intent correctly
* do so. The apps that are allowed to response can be set with {@link #setTargetApplications(List)}.
* For example, set to {@link #TARGET_BARCODE_SCANNER_ONLY} to only target the Barcode Scanner app itself.</p>
*
* <h2>Sharing text via barcode</h2>
*
* <p>To share text, encoded as a QR Code on-screen, similarly, see {@link #shareText(CharSequence)}.</p>
*
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
*
* <h2>Enabling experimental barcode formats</h2>
*
* <p>Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as
* PDF417. Use {@link #initiateScan(java.util.Collection)} with
* a collection containing the names of formats to scan for explicitly, like "PDF_417", to use such
* formats.</p>
*
* @author Sean Owen
* @author Fred Lin
* @author Isaac Potoczny-Jones
* @author Brad Drehmer
* @author gcstang
*/
@SuppressLint("NewApi") public class IntentIntegrator {
public static final int REQUEST_CODE = 0x0000c0de; // Only use bottom 16 bits
private static final String TAG = IntentIntegrator.class.getSimpleName();
public static final String DEFAULT_TITLE = "Install Barcode Scanner?";
public static final String DEFAULT_MESSAGE =
"This application requires Barcode Scanner. Would you like to install it?";
public static final String DEFAULT_YES = "Yes";
public static final String DEFAULT_NO = "No";
private static final String BS_PACKAGE = "com.google.zxing.client.android";
private static final String BSPLUS_PACKAGE = "com.srowen.bs.android";
// supported barcode formats
public static final Collection<String> PRODUCT_CODE_TYPES = list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "RSS_14");
public static final Collection<String> ONE_D_CODE_TYPES =
list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "CODE_39", "CODE_93", "CODE_128",
"ITF", "RSS_14", "RSS_EXPANDED");
public static final Collection<String> QR_CODE_TYPES = Collections.singleton("QR_CODE");
public static final Collection<String> DATA_MATRIX_TYPES = Collections.singleton("DATA_MATRIX");
public static final Collection<String> ALL_CODE_TYPES = null;
public static final List<String> TARGET_BARCODE_SCANNER_ONLY = Collections.singletonList(BS_PACKAGE);
public static final List<String> TARGET_ALL_KNOWN = list(
BSPLUS_PACKAGE, // Barcode Scanner+
BSPLUS_PACKAGE + ".simple", // Barcode Scanner+ Simple
BS_PACKAGE // Barcode Scanner
// What else supports this intent?
);
public static Activity activity;
private final Fragment fragment;
private String title;
private String message;
private String buttonYes;
private String buttonNo;
private List<String> targetApplications;
private final Map<String,Object> moreExtras = new HashMap<String,Object>(3);
/**
* @param activity {@link Activity} invoking the integration
*/
public IntentIntegrator(Activity activity) {
this.activity = activity;
this.fragment = null;
initializeConfiguration();
}
/**
* @param fragment {@link Fragment} invoking the integration.
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
* of an {@link Activity}
*/
public IntentIntegrator(Fragment fragment) {
this.activity = fragment.getActivity();
this.fragment = fragment;
initializeConfiguration();
}
private void initializeConfiguration() {
title = DEFAULT_TITLE;
message = DEFAULT_MESSAGE;
buttonYes = DEFAULT_YES;
buttonNo = DEFAULT_NO;
targetApplications = TARGET_ALL_KNOWN;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setTitleByID(int titleID) {
title = activity.getString(titleID);
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public void setMessageByID(int messageID) {
message = activity.getString(messageID);
}
public String getButtonYes() {
return buttonYes;
}
public void setButtonYes(String buttonYes) {
this.buttonYes = buttonYes;
}
public void setButtonYesByID(int buttonYesID) {
buttonYes = activity.getString(buttonYesID);
}
public String getButtonNo() {
return buttonNo;
}
public void setButtonNo(String buttonNo) {
this.buttonNo = buttonNo;
}
public void setButtonNoByID(int buttonNoID) {
buttonNo = activity.getString(buttonNoID);
}
public Collection<String> getTargetApplications() {
return targetApplications;
}
public final void setTargetApplications(List<String> targetApplications) {
if (targetApplications.isEmpty()) {
throw new IllegalArgumentException("No target applications");
}
this.targetApplications = targetApplications;
}
public void setSingleTargetApplication(String targetApplication) {
this.targetApplications = Collections.singletonList(targetApplication);
}
public Map<String,?> getMoreExtras() {
return moreExtras;
}
public final void addExtra(String key, Object value) {
moreExtras.put(key, value);
}
/**
* Initiates a scan for all known barcode types with the default camera.
*
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise.
*/
public final AlertDialog initiateScan() {
return initiateScan(ALL_CODE_TYPES, -1);
}
/**
* Initiates a scan for all known barcode types with the specified camera.
*
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise.
*/
public final AlertDialog initiateScan(int cameraId) {
return initiateScan(ALL_CODE_TYPES, cameraId);
}
/**
* Initiates a scan, using the default camera, only for a certain set of barcode types, given as strings corresponding
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
* like {@link #PRODUCT_CODE_TYPES} for example.
*
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise.
*/
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) {
return initiateScan(desiredBarcodeFormats, -1);
}
/**
* Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
* like {@link #PRODUCT_CODE_TYPES} for example.
*
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise
*/
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
// check requested camera ID
if (cameraId >= 0) {
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
}
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
}
/**
* Start an activity. This method is defined to allow different methods of activity starting for
* newer versions of Android and for compatibility library.
*
* @param intent Intent to start.
* @param code Request code for the activity
* @see android.app.Activity#startActivityForResult(Intent, int)
* @see android.app.Fragment#startActivityForResult(Intent, int)
*/
protected void startActivityForResult(Intent intent, int code) {
if (fragment == null) {
activity.startActivityForResult(intent, code);
} else {
fragment.startActivityForResult(intent, code);
}
}
private String findTargetAppPackage(Intent intent) {
PackageManager pm = activity.getPackageManager();
List<ResolveInfo> availableApps = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (availableApps != null) {
for (String targetApp : targetApplications) {
if (contains(availableApps, targetApp)) {
return targetApp;
}
}
}
return null;
}
private static boolean contains(Iterable<ResolveInfo> availableApps, String targetApp) {
for (ResolveInfo availableApp : availableApps) {
String packageName = availableApp.activityInfo.packageName;
if (targetApp.equals(packageName)) {
return true;
}
}
return false;
}
private AlertDialog showDownloadDialog() {
AlertDialog.Builder downloadDialog = new AlertDialog.Builder(activity);
downloadDialog.setTitle(title);
downloadDialog.setMessage(message);
downloadDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() {
@SuppressLint("NewApi") @Override
public void onClick(DialogInterface dialogInterface, int i) {
String packageName;
if (targetApplications.contains(BS_PACKAGE)) {
// Prefer to suggest download of BS if it's anywhere in the list
packageName = BS_PACKAGE;
} else {
// Otherwise, first option:
packageName = targetApplications.get(0);
}
Uri uri = Uri.parse("market://details?id=" + packageName);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
try {
if (fragment == null) {
activity.startActivity(intent);
} else {
fragment.startActivity(intent);
}
} catch (ActivityNotFoundException anfe) {
// Hmm, market is not installed
Log.w(TAG, "Google Play is not installed; cannot install " + packageName);
}
}
});
downloadDialog.setNegativeButton(buttonNo, null);
downloadDialog.setCancelable(true);
return downloadDialog.show();
}
/**
* <p>Call this from your {@link Activity}'s
* {@link Activity#onActivityResult(int, int, Intent)} method.</p>
*
* @param requestCode request code from {@code onActivityResult()}
* @param resultCode result code from {@code onActivityResult()}
* @param intent {@link Intent} from {@code onActivityResult()}
* @return null if the event handled here was not related to this class, or
* else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning,
* the fields will be null.
*/
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
Toast.makeText(activity, "it's in here "+contents, Toast.LENGTH_LONG).show();
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
return new IntentResult(contents,
formatName,
rawBytes,
orientation,
errorCorrectionLevel);
}
return new IntentResult();
}
return null;
}
/**
* Defaults to type "TEXT_TYPE".
*
* @param text the text string to encode as a barcode
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise
* @see #shareText(CharSequence, CharSequence)
*/
public final AlertDialog shareText(CharSequence text) {
return shareText(text, "TEXT_TYPE");
}
/**
* Shares the given text by encoding it as a barcode, such that another user can
* scan the text off the screen of the device.
*
* @param text the text string to encode as a barcode
* @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants.
* @return the {@link AlertDialog} that was shown to the user prompting them to download the app
* if a prompt was needed, or null otherwise
*/
@SuppressLint("NewApi") public final AlertDialog shareText(CharSequence text, CharSequence type) {
Intent intent = new Intent();
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setAction(BS_PACKAGE + ".ENCODE");
intent.putExtra("ENCODE_TYPE", type);
intent.putExtra("ENCODE_DATA", text);
String targetAppPackage = findTargetAppPackage(intent);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intent.setPackage(targetAppPackage);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
attachMoreExtras(intent);
if (fragment == null) {
activity.startActivity(intent);
} else {
fragment.startActivity(intent);
}
return null;
}
private static List<String> list(String... values) {
return Collections.unmodifiableList(Arrays.asList(values));
}
private void attachMoreExtras(Intent intent) {
for (Map.Entry<String,Object> entry : moreExtras.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
// Kind of hacky
if (value instanceof Integer) {
intent.putExtra(key, (Integer) value);
} else if (value instanceof Long) {
intent.putExtra(key, (Long) value);
} else if (value instanceof Boolean) {
intent.putExtra(key, (Boolean) value);
} else if (value instanceof Double) {
intent.putExtra(key, (Double) value);
} else if (value instanceof Float) {
intent.putExtra(key, (Float) value);
} else if (value instanceof Bundle) {
intent.putExtra(key, (Bundle) value);
} else {
intent.putExtra(key, value.toString());
}
}
}
}
| [
"[email protected]"
]
| |
96e195186bd9a1476e9dc51267516151843d8966 | 9851b4ed20638e652f529e03fb84911f2530a785 | /src/main/java/designModel/factory/methodFactory/Main.java | 55450152b77bedbf413e6220939d8578e4aa64e4 | []
| no_license | persistInHacker/study | 9b62c299c6bc1df885b695826c273f928f83fe0f | a49972d8de9f5359f26ddf22a8971720c52db043 | refs/heads/master | 2021-08-01T20:51:13.198570 | 2021-07-26T06:04:53 | 2021-07-26T06:04:53 | 162,003,405 | 1 | 0 | null | 2021-05-31T02:42:52 | 2018-12-16T13:23:24 | Java | UTF-8 | Java | false | false | 333 | java | package designModel.factory.methodFactory;
public class Main {
public static void main(String[] args) {
Bean createBean = new ServiceBeanFactory().createBean();
System.out.println(createBean.getName());
Bean createBean2 = new ControllerBeanFactory().createBean();
System.out.println(createBean2.getName());
}
}
| [
"[email protected]"
]
| |
e4bef02f557b035326c4a7d8d7edc1ac41d28e95 | 79bb01d384bd5d450ce40f54ddaad4feee2ffc2e | /app/src/main/java/com/ztftrue/recyclertablet/adapter/AdapterWidget.java | eadcb580e6e83ff963c3b755761d34513b5a210b | [
"Apache-2.0"
]
| permissive | ZTFtrue/RecyclerviewTable | 9fa6980d71c31a5d759f0da333a60cee0d3623c2 | 6a70728dacf8f39c3b3be30d410f3ce140e4e1c7 | refs/heads/master | 2022-02-07T09:15:43.896315 | 2019-07-25T11:54:13 | 2019-07-25T11:54:13 | 104,162,685 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,871 | java | package com.ztftrue.recyclertablet.adapter;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.ztftrue.recyclertablet.R;
import java.util.List;
/**
* Created by ztftrue on 2017/9/15
*/
public class AdapterWidget extends RecyclerView.Adapter<AdapterWidget.MyViewHolder> {
private Context context;
private static final int TYPE_HEADER = 0; //说明是带有Header的
private static final int TYPE_NORMAL = 2; //说明是不带有header和footer的
private List<AppWidgetHostView> list;
private View mHeaderView;
public AdapterWidget(Context context, List<AppWidgetHostView> exhibitlist) {
list = exhibitlist;
this.context = context;
}
public View getHeaderView() {
return mHeaderView;
}
public void setHeaderView(View headerView) {
mHeaderView = headerView;
notifyItemInserted(0);
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (mHeaderView != null && viewType == TYPE_HEADER) {
return new MyViewHolder(mHeaderView);
}
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
context).inflate(R.layout.adapter_widget, parent,
false));
return holder;
}
private int getRealPosition(RecyclerView.ViewHolder holder) {
int position = holder.getLayoutPosition();
return mHeaderView == null ? position : position - 1;
}
@Override
public void onBindViewHolder(final MyViewHolder holder, int position) {
if (getItemViewType(position) == TYPE_HEADER) {
return;
}
final int pos = getRealPosition(holder);
// RelativeLayout.LayoutParams linearLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
holder.relativeLayout.addView(list.get(pos));
}
@Override
public int getItemCount() {
return mHeaderView == null ? list.size() : list.size() + 1;
}
class MyViewHolder extends RecyclerView.ViewHolder {
RelativeLayout relativeLayout;
MyViewHolder(View view) {
super(view);
if (itemView == mHeaderView) {
return;
}
relativeLayout = view.findViewById(R.id.parentPanel);
}
}
@Override
public int getItemViewType(int position) {
if (mHeaderView == null) {
return TYPE_NORMAL;
}
if (position == 0) {
//第一个item应该加载Header
return TYPE_HEADER;
}
return TYPE_NORMAL;
}
} | [
"[email protected]"
]
| |
95d28397b247b4e613eb9664ffc1527212735fe0 | 0d4f09bbff48591ebb9a7b9bf58cfe5a5dbc4795 | /src/main/java/br/com/grupocesw/easyong/entities/Ngo.java | 48502c07afd2340f57d992ce3d4b90bbd0096c5c | []
| no_license | grupocesw/easy-ong-backend | dca5a0f5cc5fafc79c4f2c1e5e1e3f5ff31f17be | 321ed65eab7c20776d85ed2c086eb86719d35ac5 | refs/heads/main | 2023-06-23T20:33:53.721571 | 2021-07-25T23:20:54 | 2021-07-25T23:20:54 | 338,603,933 | 0 | 0 | null | 2021-07-25T23:20:55 | 2021-02-13T15:24:39 | Java | UTF-8 | Java | false | false | 4,041 | java | package br.com.grupocesw.easyong.entities;
import br.com.grupocesw.easyong.security.UserPrincipal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import org.hibernate.annotations.*;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;
@Entity
@Table(name = "ngos")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
@Proxy(lazy = false)
@EqualsAndHashCode(of = {"id", "cnpj"})
@ToString(of = { "id", "cnpj", "name", "activated" })
public class Ngo implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "name", nullable = false, length = 100)
private String name;
@Column(name = "cnpj", length = 14, unique = true, nullable = false)
private String cnpj;
@Column(name = "description", columnDefinition = "TEXT")
private String description;
@Builder.Default
@Column(name = "activated", nullable = false, columnDefinition = "BOOLEAN DEFAULT true")
private Boolean activated = true;
@Transient
private boolean favorite;
@CreationTimestamp
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "created_at", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime createdAt;
@UpdateTimestamp
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "updated_at", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
private LocalDateTime updatedAt;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "address_id", referencedColumnName = "id")
private Address address;
@JsonProperty(required = true)
@ManyToMany(fetch = FetchType.EAGER, cascade = {
CascadeType.DETACH,
CascadeType.REFRESH,
CascadeType.PERSIST,
CascadeType.MERGE })
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinTable(name = "ngo_contacts", joinColumns= @JoinColumn(name = "ngo_id"), inverseJoinColumns = @JoinColumn(name = "contact_id"))
private Set<Contact> contacts;
@OneToMany(targetEntity = NgoMoreInformation.class, cascade=CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name="ngo_id")
private Set<NgoMoreInformation> moreInformations;
@ManyToMany(fetch = FetchType.EAGER)
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinTable(name = "ngo_social_causes", joinColumns= @JoinColumn(name = "ngo_id"), inverseJoinColumns = @JoinColumn(name = "social_cause_id"))
private Set<SocialCause> causes;
@ManyToMany(fetch = FetchType.EAGER, cascade = {
CascadeType.DETACH,
CascadeType.REFRESH,
CascadeType.PERSIST,
CascadeType.MERGE })
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinTable(name = "ngo_pictures", joinColumns= @JoinColumn(name = "ngo_id"), inverseJoinColumns = @JoinColumn(name = "picture_id"))
private Set<Picture> pictures;
@JsonIgnore
@OnDelete(action = OnDeleteAction.CASCADE)
@ManyToMany(mappedBy = "favoriteNgos", fetch = FetchType.EAGER, cascade = {
CascadeType.DETACH,
CascadeType.REFRESH,
CascadeType.PERSIST,
CascadeType.MERGE })
private Set<User> users;
public boolean getFavorite() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!(authentication instanceof AnonymousAuthenticationToken) && this.getUsers() != null) {
UserPrincipal userPrincipal = (UserPrincipal) authentication.getPrincipal();
for (User user: this.getUsers()) {
if (userPrincipal.getEmail().equals(user.getUsername()))
favorite = true;
}
}
return favorite;
}
}
| [
"[email protected]"
]
| |
385bd25f97c547d30f8aa20bf3131a8a90da03d3 | f023873fc204f95c9bdb5a0864c61d56ac7c422c | /app/src/main/java/first/test/qimo/presenter/ImpClasPresenter.java | 384392c71e6bfac4bb0f7ed5113c690156c67ba2 | []
| no_license | gyb060411/gaoyabo | 896e2ad8bc082216ce947365343b46e118461506 | ba8c99971da383b6ed7db8029d5b547ac0f461fb | refs/heads/master | 2023-02-05T04:16:32.943204 | 2020-12-15T13:53:07 | 2020-12-15T13:53:07 | 321,582,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 767 | java | package first.test.qimo.presenter;
import first.test.qimo.bean.ClasBean;
import first.test.qimo.callback.ClasCallBack;
import first.test.qimo.model.ImpClasModel;
import first.test.qimo.view.ClasView;
public class ImpClasPresenter implements ClasPresenter, ClasCallBack {
private ClasView clasView;
private final ImpClasModel impClasModel;
public ImpClasPresenter(ClasView clasView) {
this.clasView = clasView;
impClasModel = new ImpClasModel();
}
@Override
public void onSuccess(ClasBean clasBean) {
clasView.onSuccess(clasBean);
}
@Override
public void onFail(String error) {
clasView.onFail(error);
}
@Override
public void getClas() {
impClasModel.getClas(this);
}
}
| [
"[email protected]"
]
| |
cb034aee07d65b8715823230e1322c237f88934e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_ad473ad832901d06606b44cf074afce3035cb419/ScrollerView/2_ad473ad832901d06606b44cf074afce3035cb419_ScrollerView_t.java | a40744fc13853d832c833fb67611f41d187a2fae | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 71,952 | java | /*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.camera.ui;
import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.FocusFinder;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.AnimationUtils;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.OverScroller;
import android.widget.TextView;
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 LinearLayout} in a vertical orientation, presenting a vertical
* array of top-level items that the user can scroll through.
*
* <p>The {@link TextView} 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.
*
* @attr ref android.R.styleable#ScrollView_fillViewport
*/
public class ScrollerView extends FrameLayout {
static final int ANIMATED_SCROLL_GAP = 250;
static final float MAX_SCROLL_FACTOR = 0.5f;
private long mLastScroll;
private final Rect mTempRect = new Rect();
protected OverScroller mScroller;
/**
* 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.
*/
protected 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).
*/
protected 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.
*/
@ViewDebug.ExportedProperty(category = "layout")
private boolean mFillViewport;
/**
* Whether arrow scrolling is animated.
*/
private boolean mSmoothScrollingEnabled = true;
private int mTouchSlop;
protected int mMinimumVelocity;
private int mMaximumVelocity;
private int mOverscrollDistance;
private int mOverflingDistance;
/**
* 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;
/**
* orientation of the scrollview
*/
protected boolean mHorizontal;
protected boolean mIsOrthoDragged;
private float mLastOrthoCoord;
private View mDownView;
private PointF mDownCoords;
private float mScrollFactor;
private boolean mIgnoreScroll;
public ScrollerView(Context context) {
this(context, null);
}
public ScrollerView(Context context, AttributeSet attrs) {
this(context, attrs, android.R.attr.scrollViewStyle);
}
public ScrollerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initScrollView();
}
private void initScrollView() {
mScroller = new OverScroller(getContext());
setFocusable(true);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setWillNotDraw(false);
final ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mOverscrollDistance = configuration.getScaledOverscrollDistance();
mOverflingDistance = configuration.getScaledOverflingDistance();
mDownCoords = new PointF();
mScrollFactor = 5;
TypedValue outValue = new TypedValue();
if (!getContext().getTheme().resolveAttribute(
android.R.attr.listPreferredItemHeight, outValue, true)) {
throw new IllegalStateException(
"Expected theme to define listPreferredItemHeight.");
}
mScrollFactor = outValue.getDimension(
getContext().getResources().getDisplayMetrics());
}
public void setOrientation(int orientation) {
mHorizontal = (orientation == LinearLayout.HORIZONTAL);
requestLayout();
}
public boolean ignoreScroll() {
return mIgnoreScroll;
}
@Override
public boolean shouldDelayChildPressedState() {
return true;
}
@Override
protected float getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
if (mHorizontal) {
final int length = getHorizontalFadingEdgeLength();
if (getScrollX() < length) {
return getScrollX() / (float) length;
}
} else {
final int length = getVerticalFadingEdgeLength();
if (getScrollY() < length) {
return getScrollY() / (float) length;
}
}
return 1.0f;
}
@Override
protected float getBottomFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
if (mHorizontal) {
final int length = getHorizontalFadingEdgeLength();
final int bottomEdge = getWidth() - getPaddingRight();
final int span = getChildAt(0).getRight() - getScrollX() - bottomEdge;
if (span < length) {
return span / (float) length;
}
} else {
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 * (mHorizontal
? (getRight() - getLeft()) : (getBottom() - getTop())));
}
@Override
public void addView(View child) {
if (getChildCount() > 0) {
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(child);
}
@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);
}
@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);
}
@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) {
if (mHorizontal) {
return getWidth() < child.getWidth() + getPaddingLeft() + getPaddingRight();
} else {
return getHeight() < child.getHeight() + 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.
*
* @attr ref android.R.styleable#ScrollView_fillViewport
*/
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.
*
* @attr ref android.R.styleable#ScrollView_fillViewport
*/
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);
if (mHorizontal) {
int width = getMeasuredWidth();
if (child.getMeasuredWidth() < width) {
final FrameLayout.LayoutParams lp = (LayoutParams) child
.getLayoutParams();
int childHeightMeasureSpec = getChildMeasureSpec(
heightMeasureSpec, getPaddingTop() + getPaddingBottom(),
lp.height);
width -= getPaddingLeft();
width -= getPaddingRight();
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(
width, MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
} else {
int height = getMeasuredHeight();
if (child.getMeasuredHeight() < height) {
final FrameLayout.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;
}
private 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;
}
private void initOrResetVelocityTracker() {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
} else {
mVelocityTracker.clear();
}
}
private void initVelocityTrackerIfNotExists() {
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
}
private void recycleVelocityTracker() {
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
}
@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
if (disallowIntercept) {
recycleVelocityTracker();
}
super.requestDisallowInterceptTouchEvent(disallowIntercept);
}
@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;
}
if ((action == MotionEvent.ACTION_MOVE) && (mIsOrthoDragged)) {
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 = mHorizontal ? ev.getX(pointerIndex) : ev
.getY(pointerIndex);
final int yDiff = (int) Math.abs(y - mLastMotionY);
if (yDiff > mTouchSlop) {
mIsBeingDragged = true;
mLastMotionY = y;
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
} else {
final float ocoord = mHorizontal ? ev.getY(pointerIndex) : ev
.getX(pointerIndex);
if (Math.abs(ocoord - mLastOrthoCoord) > mTouchSlop) {
mIsOrthoDragged = true;
mLastOrthoCoord = ocoord;
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
}
}
break;
}
case MotionEvent.ACTION_DOWN: {
final float y = mHorizontal ? ev.getX() : ev.getY();
mDownCoords.x = ev.getX();
mDownCoords.y = ev.getY();
if (!inChild((int) ev.getX(), (int) ev.getY())) {
mIsBeingDragged = false;
recycleVelocityTracker();
break;
}
/*
* Remember location of down touch. ACTION_DOWN always refers to
* pointer index 0.
*/
mLastMotionY = y;
mActivePointerId = ev.getPointerId(0);
initOrResetVelocityTracker();
mVelocityTracker.addMovement(ev);
/*
* If being flinged and user touches the screen, initiate drag;
* otherwise don't. mScroller.isFinished should be false when being
* flinged.
*/
mIsBeingDragged = !mScroller.isFinished();
mIsOrthoDragged = false;
final float ocoord = mHorizontal ? ev.getY() : ev.getX();
mLastOrthoCoord = ocoord;
mDownView = findViewAt((int) ev.getX(), (int) ev.getY());
break;
}
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
onScrollUp();
}
/* Release the drag */
mIsBeingDragged = false;
mIsOrthoDragged = false;
mActivePointerId = INVALID_POINTER;
recycleVelocityTracker();
// TODO: this upset the single tap; need to fix later
//if (mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0,
// getScrollRange())) {
// invalidate();
//}
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 || mIsOrthoDragged;
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
initVelocityTrackerIfNotExists();
mVelocityTracker.addMovement(ev);
final int action = ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: {
mIsBeingDragged = getChildCount() != 0;
if (!mIsBeingDragged) {
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 = mHorizontal ? ev.getX() : ev.getY();
mActivePointerId = ev.getPointerId(0);
break;
}
case MotionEvent.ACTION_MOVE:
if (mIsOrthoDragged) {
// Scroll to follow the motion event
final int activePointerIndex = ev.findPointerIndex(mActivePointerId);
final float x = ev.getX(activePointerIndex);
final float y = ev.getY(activePointerIndex);
if (isOrthoMove(x - mDownCoords.x, y - mDownCoords.y)) {
onOrthoDrag(mDownView, mHorizontal
? y - mDownCoords.y
: x - mDownCoords.x);
}
} else if (mIsBeingDragged) {
// Scroll to follow the motion event
final int activePointerIndex = ev.findPointerIndex(mActivePointerId);
final float y = mHorizontal ? ev.getX(activePointerIndex)
: ev.getY(activePointerIndex);
final int deltaY = (int) (mLastMotionY - y);
mLastMotionY = y;
final int oldX = getScrollX();
final int oldY = getScrollY();
final int range = getScrollRange();
if (mHorizontal) {
if (overScrollBy(deltaY, 0, getScrollX(), 0, range, 0,
mOverscrollDistance, 0, true)) {
// Break our velocity if we hit a scroll barrier.
mVelocityTracker.clear();
}
} else {
if (overScrollBy(0, deltaY, 0, getScrollY(), 0, range,
0, mOverscrollDistance, true)) {
// Break our velocity if we hit a scroll barrier.
mVelocityTracker.clear();
}
}
onScrollChanged(getScrollX(), getScrollY(), oldX, oldY);
final int overscrollMode = getOverScrollMode();
if (overscrollMode == OVER_SCROLL_ALWAYS ||
(overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0)) {
final int pulledToY = mHorizontal ? oldX + deltaY : oldY + deltaY;
if (pulledToY < 0) {
onPull(pulledToY);
} else if (pulledToY > range) {
onPull(pulledToY - range);
} else {
onPull(0);
}
}
} else {
return false;
}
break;
case MotionEvent.ACTION_UP:
final VelocityTracker vtracker = mVelocityTracker;
vtracker.computeCurrentVelocity(1000, mMaximumVelocity);
if (isOrthoMove(vtracker.getXVelocity(mActivePointerId),
vtracker.getYVelocity(mActivePointerId))
&& mMinimumVelocity < Math.abs((mHorizontal ? vtracker.getYVelocity()
: vtracker.getXVelocity()))) {
onOrthoFling(mDownView, mHorizontal ? vtracker.getYVelocity()
: vtracker.getXVelocity());
break;
}
if (mIsOrthoDragged) {
onOrthoDragFinished(mDownView);
mActivePointerId = INVALID_POINTER;
endDrag();
} else if (mIsBeingDragged) {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int initialVelocity = mHorizontal
? (int) velocityTracker.getXVelocity(mActivePointerId)
: (int) velocityTracker.getYVelocity(mActivePointerId);
if (getChildCount() > 0) {
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
fling(-initialVelocity);
} else {
final int bottom = getScrollRange();
if (mHorizontal) {
if (mScroller.springBack(getScrollX(), getScrollY(), 0, bottom, 0, 0)) {
invalidate();
}
} else {
if (mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, bottom)) {
invalidate();
}
}
onScrollUp();
}
onPull(0);
}
mActivePointerId = INVALID_POINTER;
endDrag();
} else {
return false;
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsOrthoDragged) {
onOrthoDragFinished(mDownView);
mActivePointerId = INVALID_POINTER;
endDrag();
} else if (mIsBeingDragged && getChildCount() > 0) {
if (mHorizontal) {
if (mScroller.springBack(getScrollX(), getScrollY(), 0, getScrollRange(), 0, 0)) {
invalidate();
}
} else {
if (mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
invalidate();
}
}
// when touch is cancelled, treat it as up to allow icons to snap back
onScrollUp();
mActivePointerId = INVALID_POINTER;
endDrag();
} else {
return false;
}
break;
case MotionEvent.ACTION_POINTER_DOWN: {
final int index = ev.getActionIndex();
final float y = mHorizontal ? ev.getX(index) : ev.getY(index);
mLastMotionY = y;
mLastOrthoCoord = mHorizontal ? ev.getY(index) : ev.getX(index);
mActivePointerId = ev.getPointerId(index);
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY = mHorizontal
? ev.getX(ev.findPointerIndex(mActivePointerId))
: ev.getY(ev.findPointerIndex(mActivePointerId));
break;
}
return true;
}
protected void onScrollUp() {
}
protected View findViewAt(int x, int y) {
// subclass responsibility
return null;
}
protected void onPull(int delta) {
}
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 = mHorizontal ? ev.getX(newPointerIndex) : ev.getY(newPointerIndex);
mActivePointerId = ev.getPointerId(newPointerIndex);
if (mVelocityTracker != null) {
mVelocityTracker.clear();
}
mLastOrthoCoord = mHorizontal ? ev.getY(newPointerIndex)
: ev.getX(newPointerIndex);
}
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (!mIsBeingDragged) {
if (mHorizontal) {
final float hscroll = event
.getAxisValue(MotionEvent.AXIS_HSCROLL);
if (hscroll != 0) {
final int delta = (int) (hscroll * mScrollFactor);
final int range = getScrollRange();
int oldScrollX = getScrollX();
int newScrollX = oldScrollX - delta;
if (newScrollX < 0) {
newScrollX = 0;
} else if (newScrollX > range) {
newScrollX = range;
}
if (newScrollX != oldScrollX) {
super.scrollTo(newScrollX, getScrollY());
return true;
}
}
} else {
final float vscroll = event
.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * mScrollFactor);
final int range = getScrollRange();
int oldScrollY = getScrollY();
int newScrollY = oldScrollY - delta;
if (newScrollY < 0) {
newScrollY = 0;
} else if (newScrollY > range) {
newScrollY = range;
}
if (newScrollY != oldScrollY) {
super.scrollTo(getScrollX(), newScrollY);
return true;
}
}
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
protected void onOrthoDrag(View draggedView, float distance) {
}
protected void onOrthoDragFinished(View draggedView) {
}
protected void onOrthoFling(View draggedView, float velocity) {
}
@Override
protected void onOverScrolled(int scrollX, int scrollY,
boolean clampedX, boolean clampedY) {
// Treat animating scrolls differently; see #computeScroll() for why.
if (!mScroller.isFinished()) {
// workaround
// need to do this because can't set scroll offset before API 14
mIgnoreScroll = true;
super.scrollTo(scrollX, scrollY);
mIgnoreScroll = false;
// original code:
// mScrollX = scrollX;
// mScrollY = scrollY;
// invalidateParentIfNeeded();
if (mHorizontal && clampedX) {
mScroller.springBack(getScrollX(), getScrollY(), 0, getScrollRange(), 0, 0);
} else if (!mHorizontal && clampedY) {
mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange());
}
} else {
super.scrollTo(scrollX, scrollY);
}
awakenScrollBars();
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setScrollable(true);
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
event.setScrollable(true);
}
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
// Do not append text content to scroll events they are fired frequently
// and the client has already received another event type with the text.
if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_SCROLLED) {
super.dispatchPopulateAccessibilityEvent(event);
}
return false;
}
private int getScrollRange() {
int scrollRange = 0;
if (getChildCount() > 0) {
View child = getChildAt(0);
if (mHorizontal) {
scrollRange = Math.max(0,
child.getWidth() - (getWidth() - getPaddingRight() - getPaddingLeft()));
} else {
scrollRange = Math.max(0,
child.getHeight() - (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
return scrollRange;
}
/**
* <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 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 = (mHorizontal
? getHorizontalFadingEdgeLength()
: getVerticalFadingEdgeLength()) / 2;
final int topWithoutFadingEdge = top + fadingEdgeLength;
final int bottomWithoutFadingEdge = top + (mHorizontal ? getWidth() : getHeight()) - fadingEdgeLength;
if ((preferredFocusable != null)
&& ((mHorizontal ? preferredFocusable.getLeft() : preferredFocusable.getTop())
< bottomWithoutFadingEdge)
&& ((mHorizontal ? preferredFocusable.getRight() : 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 = mHorizontal ? view.getLeft() : view.getTop();
int viewBottom = mHorizontal ? view.getRight() : 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 int ctop = mHorizontal ? focusCandidate.getLeft() : focusCandidate.getTop();
final int cbot = mHorizontal ? focusCandidate.getRight() : focusCandidate.getBottom();
final boolean viewIsCloserToBoundary =
(topFocus && viewTop < ctop) ||
(!topFocus && viewBottom > cbot);
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;
}
// i was here
/**
* <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 android.view.View#FOCUS_UP}
* to go one page up or
* {@link android.view.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 android.view.View#FOCUS_UP}
* to go the top of the view or
* {@link android.view.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() + getPaddingBottom();
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 android.view.View#FOCUS_UP}
* to go upward, {@link android.view.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);
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() - getPaddingBottom();
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;
}
private boolean isOrthoMove(float moveX, float moveY) {
return mHorizontal && Math.abs(moveY) > Math.abs(moveX)
|| !mHorizontal && Math.abs(moveX) > Math.abs(moveY);
}
/**
* @return whether the descendant of this scroll view is scrolled off
* screen.
*/
private boolean isOffScreen(View descendant) {
if (mHorizontal) {
return !isWithinDeltaOfScreen(descendant, getWidth(), 0);
} else {
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);
if (mHorizontal) {
return (mTempRect.right + delta) >= getScrollX()
&& (mTempRect.left - delta) <= (getScrollX() + height);
} else {
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) {
if (mHorizontal) {
smoothScrollBy(0, delta);
} else {
smoothScrollBy(delta, 0);
}
} else {
if (mHorizontal) {
scrollBy(0, delta);
} else {
scrollBy(delta, 0);
}
}
}
}
/**
* 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) {
if (mHorizontal) {
final int width = getWidth() - getPaddingRight() - getPaddingLeft();
final int right = getChildAt(0).getWidth();
final int maxX = Math.max(0, right - width);
final int scrollX = getScrollX();
dx = Math.max(0, Math.min(scrollX + dx, maxX)) - scrollX;
mScroller.startScroll(scrollX, getScrollY(), dx, 0);
} else {
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();
}
/**
* 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() {
if (mHorizontal) {
return super.computeVerticalScrollRange();
}
final int count = getChildCount();
final int contentHeight = getHeight() - getPaddingBottom() - getPaddingTop();
if (count == 0) {
return contentHeight;
}
int scrollRange = getChildAt(0).getBottom();
final int scrollY = getScrollY();
final int overscrollBottom = Math.max(0, scrollRange - contentHeight);
if (scrollY < 0) {
scrollRange -= scrollY;
} else if (scrollY > overscrollBottom) {
scrollRange += scrollY - overscrollBottom;
}
return scrollRange;
}
/**
* <p>
* The scroll range of a scroll view is the overall height of all of its
* children.
* </p>
*/
@Override
protected int computeHorizontalScrollRange() {
if (!mHorizontal) {
return super.computeHorizontalScrollRange();
}
final int count = getChildCount();
final int contentWidth = getWidth() - getPaddingRight() - getPaddingLeft();
if (count == 0) {
return contentWidth;
}
int scrollRange = getChildAt(0).getRight();
final int scrollX = getScrollX();
final int overscrollBottom = Math.max(0, scrollRange - contentWidth);
if (scrollX < 0) {
scrollRange -= scrollX;
} else if (scrollX > overscrollBottom) {
scrollRange += scrollX - overscrollBottom;
}
return scrollRange;
}
@Override
protected int computeVerticalScrollOffset() {
return Math.max(0, super.computeVerticalScrollOffset());
}
@Override
protected int computeHorizontalScrollOffset() {
return Math.max(0, super.computeHorizontalScrollOffset());
}
@Override
protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) {
ViewGroup.LayoutParams lp = child.getLayoutParams();
int childWidthMeasureSpec;
int childHeightMeasureSpec;
if (mHorizontal) {
childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec, getPaddingTop()
+ getPaddingBottom(), lp.height);
childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
} else {
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();
int childWidthMeasureSpec;
int childHeightMeasureSpec;
if (mHorizontal) {
childHeightMeasureSpec = getChildMeasureSpec(parentHeightMeasureSpec,
getPaddingTop() + getPaddingBottom() + lp.topMargin + lp.bottomMargin
+ heightUsed, lp.height);
childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(
lp.leftMargin + lp.rightMargin, MeasureSpec.UNSPECIFIED);
} else {
childWidthMeasureSpec = getChildMeasureSpec(parentWidthMeasureSpec,
getPaddingLeft() + getPaddingRight() + lp.leftMargin + lp.rightMargin
+ widthUsed, lp.width);
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(
lp.topMargin + lp.bottomMargin, MeasureSpec.UNSPECIFIED);
}
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
@Override
public void computeScroll() {
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 (oldX != x || oldY != y) {
if (mHorizontal) {
overScrollBy(x - oldX, y - oldY, oldX, oldY, getScrollRange(), 0,
mOverflingDistance, 0, false);
} else {
overScrollBy(x - oldX, y - oldY, oldX, oldY, 0, getScrollRange(),
0, mOverflingDistance, false);
}
onScrollChanged(getScrollX(), getScrollY(), 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);
scrollToChildRect(mTempRect, true);
}
/**
* 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) {
if (mHorizontal) {
scrollBy(delta, 0);
} else {
scrollBy(0, delta);
}
} else {
if (mHorizontal) {
smoothScrollBy(delta, 0);
} 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 (mHorizontal) {
return computeScrollDeltaToGetChildRectOnScreenHorizontal(rect);
} else {
return computeScrollDeltaToGetChildRectOnScreenVertical(rect);
}
}
private int computeScrollDeltaToGetChildRectOnScreenVertical(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;
}
private int computeScrollDeltaToGetChildRectOnScreenHorizontal(Rect rect) {
if (getChildCount() == 0) return 0;
int width = getWidth();
int screenLeft = getScrollX();
int screenRight = screenLeft + width;
int fadingEdge = getHorizontalFadingEdgeLength();
// leave room for left fading edge as long as rect isn't at very left
if (rect.left > 0) {
screenLeft += fadingEdge;
}
// leave room for right fading edge as long as rect isn't at very right
if (rect.right < getChildAt(0).getWidth()) {
screenRight -= fadingEdge;
}
int scrollXDelta = 0;
if (rect.right > screenRight && rect.left > screenLeft) {
// need to move right to get it in view: move right just enough so
// that the entire rectangle is in view (or at least the first
// screen size chunk).
if (rect.width() > width) {
// just enough to get screen size chunk on
scrollXDelta += (rect.left - screenLeft);
} else {
// get entire rect at right of screen
scrollXDelta += (rect.right - screenRight);
}
// make sure we aren't scrolling beyond the end of our content
int right = getChildAt(0).getRight();
int distanceToRight = right - screenRight;
scrollXDelta = Math.min(scrollXDelta, distanceToRight);
} else if (rect.left < screenLeft && rect.right < screenRight) {
// need to move right to get it in view: move right just enough so that
// entire rectangle is in view (or at least the first screen
// size chunk of it).
if (rect.width() > width) {
// screen size chunk
scrollXDelta -= (screenRight - rect.right);
} else {
// entire rect at left
scrollXDelta -= (screenLeft - rect.left);
}
// make sure we aren't scrolling any further than the left our content
scrollXDelta = Math.max(scrollXDelta, -getScrollX());
}
return scrollXDelta;
}
@Override
public void requestChildFocus(View child, View focused) {
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 android.view.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 (mHorizontal) {
if (direction == View.FOCUS_FORWARD) {
direction = View.FOCUS_RIGHT;
} else if (direction == View.FOCUS_BACKWARD) {
direction = View.FOCUS_LEFT;
}
} else {
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 onDetachedFromWindow() {
super.onDetachedFromWindow();
}
@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);
}
}
/**
* 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) {
if (mHorizontal) {
int width = getWidth() - getPaddingRight() - getPaddingLeft();
int right = getChildAt(0).getWidth();
mScroller.fling(getScrollX(), getScrollY(), velocityY, 0,
0, Math.max(0, right - width), 0, 0, width/2, 0);
} else {
int height = getHeight() - getPaddingBottom() - getPaddingTop();
int bottom = getChildAt(0).getHeight();
mScroller.fling(getScrollX(), getScrollY(), 0, velocityY, 0, 0, 0,
Math.max(0, bottom - height), 0, height/2);
}
invalidate();
}
}
private void endDrag() {
mIsBeingDragged = false;
mIsOrthoDragged = false;
mDownView = null;
recycleVelocityTracker();
}
/**
* {@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 --------|
* |-- mScrollX --|
*/
return 0;
}
if ((my+n) > child) {
/* this case:
* |------ me ------|
* |------ child ------|
* |-- mScrollX --|
*/
return child-my;
}
return n;
}
}
| [
"[email protected]"
]
| |
12192dd7688ff0b1bcbb220e248627b9cdd77005 | adff71486eea01af155f8a257d66feecb79db47b | /Java_Progrmas/src/com/bridgelabz/programs/BubbleSort.java | e8daffeee0cead8eeb0fbdbbf5506e5719cebe2e | []
| no_license | Miral02Modi/Java_Final1 | 36e2ab369f0960ed0949df6f1b78f015b0ed715a | 69b7a3d9753bf27d318475cf5c79e61fc60d90c8 | refs/heads/master | 2021-01-19T23:32:39.970834 | 2017-04-24T05:58:06 | 2017-04-24T05:58:06 | 88,990,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package com.bridgelabz.programs;
public class BubbleSort {
static Integer[] bubbleSort(Integer[] arr) {
int n = arr.length;
int swap = 0;
for (int i = 0; i < n; i++) {
for (int j = 1; j < (n - i); j++) {
if (arr[j - 1] > arr[j]) {
swap = arr[j - 1];
arr[j - 1] = arr[j];
arr[j] = swap;
}
}
}
return arr;
}
}
| [
"[email protected]"
]
| |
492212a992c7ecb0da7a7ddbdb3464a095ec1522 | 0dd96f09c31aede89c9e9ccd66ebfabad845703c | /BioMetAtt/app/src/main/java/com/innprojects/biometatt/fragments/GMail.java | 6c82687b2cfc9ab5e9988ff965f99ee9a36cb4c1 | []
| no_license | simransarin/Biometric-bus-attendance-system | cc5fe519e6fd9af932dd2fbb1d5983c0c14ae34b | 35b0cace00ae1f56e8a6f49c689e171438a8a8b4 | refs/heads/master | 2020-03-10T02:43:50.023132 | 2018-04-11T19:36:44 | 2018-04-11T19:36:44 | 129,143,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,878 | java | package com.innprojects.biometatt.fragments;
import android.util.Log;
import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class GMail {
final String emailPort = "587";// gmail's smtp port
final String smtpAuth = "true";
final String starttls = "true";
final String emailHost = "smtp.gmail.com";
// final String fromUser = "[email protected]";
// final String fromUserEmailPassword = "Patidar009";
String fromEmail;
String fromPassword;
List<String> toEmailList;
String emailSubject;
String emailBody;
Properties emailProperties;
Session mailSession;
MimeMessage emailMessage;
public GMail() {
}
public GMail(String fromEmail, String fromPassword,
List<String> toEmailList, String emailSubject, String emailBody) {
this.fromEmail = fromEmail;
this.fromPassword = fromPassword;
this.toEmailList = toEmailList;
this.emailSubject = emailSubject;
this.emailBody = emailBody;
emailProperties = System.getProperties();
emailProperties.put("mail.smtp.port", emailPort);
emailProperties.put("mail.smtp.auth", smtpAuth);
emailProperties.put("mail.smtp.starttls.enable", starttls);
Log.i("GMail", "Mail server properties set.");
}
public MimeMessage createEmailMessage() throws AddressException,
MessagingException, UnsupportedEncodingException {
mailSession = Session.getDefaultInstance(emailProperties, null);
emailMessage = new MimeMessage(mailSession);
emailMessage.setFrom(new InternetAddress(fromEmail, fromEmail));
for (String toEmail : toEmailList) {
Log.i("GMail", "toEmail: " + toEmail);
emailMessage.addRecipient(Message.RecipientType.TO,
new InternetAddress(toEmail));
}
emailMessage.setSubject(emailSubject);
emailMessage.setContent(emailBody, "text/html");// for a html email
// emailMessage.setText(emailBody);// for a text email
Log.i("GMail", "Email Message created.");
return emailMessage;
}
public void sendEmail() throws AddressException, MessagingException {
Transport transport = mailSession.getTransport("smtp");
transport.connect(emailHost, fromEmail, fromPassword);
Log.i("GMail", "allrecipients: " + emailMessage.getAllRecipients());
transport.sendMessage(emailMessage, emailMessage.getAllRecipients());
transport.close();
Log.i("GMail", "Email sent successfully.");
}
}
| [
"[email protected]"
]
| |
8cab094502f228e5e837bd752468dcf76fe8be46 | e04db3c7e67d2db41e3cea158d3830b1be620afc | /SeekBar/app/src/main/java/com/example/seekbar/AudioActivity.java | 5c40106f19fd9dc43437d34dcb20cacf67ea97a9 | []
| no_license | Maryam004/Android_1 | 1707bba51289880f0dd802f462a72e44294ad939 | 6bb05b12c665cbf005be7f3a93afcc5c3e1b3b98 | refs/heads/master | 2023-05-09T08:36:47.973293 | 2021-05-27T05:37:02 | 2021-05-27T05:37:02 | 345,442,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.example.seekbar;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
public class AudioActivity extends AppCompatActivity {
MediaPlayer mp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_audio);
mp= MediaPlayer.create(this, R.raw.surah_rehman);
}
public void Play(View view) {
mp.start();
}
public void Pause(View view) {
mp.pause();
}
} | [
"[email protected]"
]
| |
0f6189a8bafaaad6baf7ab05cd1d660d58248417 | 86f796d4fbc3ea1085d503f338b8c55e5e5b8697 | /src/main/java/com/lym/demo/mapper/CountryMapper.java | 77215e5a86e28525926aab65711b9a909025844a | []
| no_license | liuyanmin/spring-boot-pagehelper | 6651cc0dd030627ba3ea5e8e8e569b27f82ca278 | dd6d307f69629e1517dd74c0de255b1145728058 | refs/heads/master | 2022-07-12T08:40:20.632059 | 2019-08-29T01:02:32 | 2019-08-29T01:02:32 | 204,281,873 | 1 | 0 | null | 2022-06-21T01:44:22 | 2019-08-25T10:56:46 | Java | UTF-8 | Java | false | false | 2,640 | java | package com.lym.demo.mapper;
import com.lym.demo.domain.Country;
import com.lym.demo.domain.CountryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface CountryMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int countByExample(CountryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int deleteByExample(CountryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int insert(Country record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int insertSelective(Country record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
List<Country> selectByExample(CountryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
Country selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int updateByExampleSelective(@Param("record") Country record, @Param("example") CountryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int updateByExample(@Param("record") Country record, @Param("example") CountryExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int updateByPrimaryKeySelective(Country record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table country
*
* @mbggenerated
*/
int updateByPrimaryKey(Country record);
List<Country> selectCountryList();
} | [
"[email protected]"
]
| |
dd7495615f7fa489e46aa5082228542f0de15673 | 1d8247abe759bfb3d9f8a993e6a5cd156c23c110 | /java/src/plan9/auth/Infauth.java | 9ea36f9ad34a61f5bc25d9c00ae66bbe7233d049 | [
"MIT"
]
| permissive | Plan9-Archive/styx-n-9p | 8cc3f1ca597ea2f03d5835049874374b72a2d864 | 56db45da8a5a40bf535e03211def644b9e5c64df | refs/heads/master | 2021-05-19T00:32:51.395401 | 2015-03-17T15:19:06 | 2015-03-17T15:19:06 | 251,496,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,434 | java | package plan9.auth;
/*
* Inferno public key authentication
*
* Copyright © 2005 Vita Nuova Holdings Limited
*
* to do
* attr=val keys
* secstore interface
* Auth.auth
*/
import java.math.BigInteger;
import java.security.*;
import java.security.interfaces.*;
import java.security.spec.*;
import java.nio.*;
import java.nio.channels.*;
import java.io.IOException;
import javax.crypto.Cipher;
import java.io.*;
import java.util.Date;
import static plan9.lib.Strings.bytes;
import plan9.lib.Strings;
import plan9.lib.Msgio;
import plan9.lib.RemoteError;
//java.security.interfaces.RSAKey, RSAPrivateCrtKey, RSAPrivateKey, RSAPublicKey
// use instanceof applied to java.security.PublicKey
//java.security.spec
// use with java.security.KeyFactory and java.security.AlgorithmParameters
// RSAKeyGenParameterSpec(modulus, pubexp, privexp, primeP, primeQ, primeExpP, primeExpQ, crtCoeff)
// getCrtCoefficient, getPrimeExponentP, getPrimeExponentQ, getPrimeP, getPrimeQ, getPublicExponent
// RSAPrivateKeySpec(modulus, privateexp)
// getModulus, getPrivateExponent
// RSAPublicKeySpec(modulus, publicexp)
// getModulus, getPublicExponent
import static plan9.auth.Aids.*;
public class Infauth {
final static int Maxmsg = 4096;
static KeyFactory keyfactory;
public Infauth() throws NoSuchAlgorithmException {
if(keyfactory == null)
keyfactory = KeyFactory.getInstance("RSA");
}
public static class InfPublicKey {
public PublicKey pk;
public String owner;
public InfPublicKey(PublicKey pk, String owner){
this.pk = pk; this.owner = owner;
}
public InfPublicKey(String s) throws InvalidKey {
if(s == null)
throw new InvalidKey("missing public key");
String[] a = Strings.getfields(s, "\n");
if(a.length < 4)
throw new InvalidKey("bad public key syntax");
if(!a[0].equals("rsa"))
throw new InvalidKey("unknown key algorithm: "+a[0]);
BigInteger modulus = s2big64(a[2]);
BigInteger publicexp = s2big64(a[3]);
try{
this.pk = keyfactory.generatePublic(new RSAPublicKeySpec(modulus, publicexp));
}catch(InvalidKeySpecException e){
throw new InvalidKey("bad key spec: "+e.getMessage(), e);
}
this.owner = a[1];
}
public String text(){
RSAPublicKey pk = (RSAPublicKey)this.pk;
return "rsa\n"+this.owner+"\n"+b64(pk.getModulus())+"\n"+b64(pk.getPublicExponent())+"\n";
}
public String toString(){
return pk.toString()+"\nowner="+owner;
}
}
public static class InfPrivateKey {
PrivateKey sk;
public String owner;
public InfPrivateKey(PrivateKey sk, String owner){
this.sk = sk; this.owner = owner;
}
public InfPrivateKey(String s) throws InvalidKey {
if(s == null)
throw new InvalidKey("missing private key");
String[] a = Strings.getfields(s, "\n");
if(a.length < 10)
throw new InvalidKey("bad private key syntax");
if(!a[0].equals("rsa"))
throw new InvalidKey("unknown key algorithm: "+a[0]);
BigInteger n = s2big64(a[2]);
BigInteger e = s2big64(a[3]);
BigInteger dk = s2big64(a[4]);
BigInteger p = s2big64(a[5]);
BigInteger q = s2big64(a[6]);
BigInteger kp = s2big64(a[7]);
BigInteger kq = s2big64(a[8]);
BigInteger c12 = s2big64(a[9]);
// mind your p's and q's: libsec's p is java's q! (Java follows PKCS#1 in reversing their roles)
// if using Java's RSA implementation directly, reverse p and q, and kp and kq
// we can't use it here because it imposes PKCS#1, so we do the calculation ourselves
try{
this.sk = keyfactory.generatePrivate(new RSAPrivateCrtKeySpec(n, e, dk, p, q, kp, kq, c12));
}catch(InvalidKeySpecException ex){
throw new InvalidKey("bad key spec: "+ex.getMessage(), e);
}
this.owner = a[1];
}
public InfPublicKey getpk() throws InvalidKey {
RSAPrivateCrtKey rsk = (RSAPrivateCrtKey)this.sk;
try{
PublicKey pk = keyfactory.generatePublic(new RSAPublicKeySpec(rsk.getModulus(), rsk.getPublicExponent()));
return new InfPublicKey(pk, this.owner);
}catch(InvalidKeySpecException e){
throw new InvalidKey("bad key spec: "+e.getMessage(), e);
}
}
public String text(){
RSAPrivateCrtKey sk = (RSAPrivateCrtKey)this.sk;
return "rsa\n"+
b64(sk.getModulus())+"\n"+
b64(sk.getPublicExponent())+"\n"+
b64(sk.getPrivateExponent())+"\n"+
b64(sk.getPrimeP())+"\n"+
b64(sk.getPrimeQ())+"\n"+
b64(sk.getPrimeExponentP())+"\n"+
b64(sk.getPrimeExponentQ())+"\n"+
b64(sk.getCrtCoefficient())+"\n";
}
public String toString(){
return sk.toString()+"\nowner="+owner;
}
}
public static class Authinfo {
public InfPrivateKey mysk;
public InfPublicKey mypk;
public Certificate cert; // signature of my public key
public InfPublicKey spk; // signer's public key
public BigInteger alpha; // diffie-hellman parameters
public BigInteger p;
public Authinfo(InfPrivateKey sk, InfPublicKey pk, Certificate cert, InfPublicKey spk, BigInteger alpha, BigInteger p){
this.mysk = sk; this.mypk = pk; this.cert = cert; this.spk = spk; this.alpha = alpha; this.p = p;
}
}
public final Authinfo readauthinfo(ByteChannel fd) throws Exception {
// signer's public key, certificate, secret key (use sk.getpk to get public one), alpha, p
InfPublicKey spk;
Certificate cert;
InfPrivateKey mysk;
BigInteger alpha, p;
Msgio io;
io = new Msgio(fd);
spk = new InfPublicKey(io.gets());
cert = new Certificate(io.gets());
mysk = new InfPrivateKey(io.gets());
alpha = s2big64(io.gets());
p = s2big64(io.gets());
return new Authinfo(mysk, mysk.getpk(), cert, spk, alpha, p);
}
public static class Certificate {
public String sa; // signature algorithm
public String ha; // hash algorithm
public String signer; // name of signer
public int exp; // expiration date (seconds from Epoch, 0=never)
BigInteger rsa; // only RSA signatures supported
public Certificate(String sa, String ha, String signer, int exp, BigInteger rsa){
this.sa = sa; this.ha = ha; this.signer = signer; this.exp = exp; this.rsa = rsa;
}
public Certificate(String s) throws InvalidCertificate {
if(s == null)
throw new InvalidCertificate("missing certificate");
String[] a = Strings.getfields(s, "\n");
if(a.length < 5)
throw new InvalidCertificate("bad certificate syntax"+":"+a.length);
this.sa = a[0];
this.ha = a[1];
this.signer = a[2];
this.exp = Integer.parseInt(a[3]);
this.rsa = s2big64(a[4]);
}
public final String text(){
return this.sa+"\n"+this.ha+"\n"+this.signer+"\n"+this.exp+"\n"+b64(this.rsa)+"\n";
}
}
public static class AuthResult {
public Authinfo info;
public byte[] secret;
AuthResult(Authinfo info, byte[] secret){
this.info = info; this.secret = secret;
}
}
public final AuthResult basicauth(ByteChannel fd, Authinfo info) throws AuthenticationException {
BigInteger low, r0, alphar0, alphar1, alphar0r1;
Certificate hiscert, alphacert;
Msgio io = new Msgio(fd);
byte[] buf, hispkbuf, alphabuf;
InfPublicKey hispk;
byte[] secret;
int vers;
try{
io.sendmsg("1"); // version
buf = io.getmsg();
vers = Integer.parseInt(Strings.S(buf));
if(vers != 1 || buf.length > 4)
throw new LocalAuthErr("incompatible authentication protocol");
if(info == null)
throw new LocalAuthErr("no authentication information");
if(info.p == null)
throw new LocalAuthErr("missing diffie hellman mod");
if(info.alpha == null)
throw new LocalAuthErr("missing diffie hellman base");
if(info.mysk == null || info.mypk == null || info.cert == null || info.spk == null) // could check key details
throw new LocalAuthErr("invalid authentication information");
if(info.p.compareTo(BigInteger.ZERO) <= 0)
throw new LocalAuthErr("-ve modulus");
low = info.p.shiftRight(info.p.bitLength()/4);
r0 = rand(low, info.p);
alphar0 = info.alpha.modPow(r0, info.p);
io.sendmsg(b64(alphar0));
io.sendmsg(info.cert.text());
io.sendmsg(info.mypk.text());
alphar1 = s2big64(io.gets());
if(info.p.compareTo(alphar1) <= 0)
throw new LocalAuthErr("implausible parameter value");
if(alphar0.compareTo(alphar1) == 0)
throw new LocalAuthErr("possible replay attack");
hiscert = new Certificate(io.gets());
hispkbuf = io.getmsg();
hispk = new InfPublicKey(Strings.S(hispkbuf));
if(!verify(info.spk, hiscert, hispkbuf))
throw new LocalAuthErr("pk doesn't match certificate");
if(hiscert.exp != 0 && hiscert.exp <= now())
throw new LocalAuthErr("certificate expired");
alphabuf = bytes(b64(alphar0) + b64(alphar1));
alphacert = sign(info.mysk, 0, alphabuf);
io.sendmsg(alphacert.text());
alphacert = new Certificate(io.gets());
alphabuf = bytes(b64(alphar1) + b64(alphar0));
if(!verify(hispk, alphacert, alphabuf))
throw new LocalAuthErr("signature did not match pk");
alphar0r1 = alphar1.modPow(r0, info.p);
secret = trim0(alphar0r1.toByteArray());
io.sendmsg("OK");
}catch(ClosedByInterruptException e){
throw new LocalAuthErr("interrupted by time-out", e);
}catch(IOException e){
throw new LocalAuthErr("i/o error: "+e.getMessage()); // could distinguish a few cases
}catch(InvalidCertificate e){
io.senderrmsg("remote: "+e.getMessage());
throw e;
}catch(InvalidKey e){
io.senderrmsg("remote: "+e.getMessage());
throw e;
}catch(NoSuchAlgorithmException e){
String msg = "unsupported algorithm: "+e.getMessage();
io.senderrmsg("remote: "+msg);
throw new AuthenticationException(msg);
}catch(LocalAuthErr e){
io.senderrmsg("remote: "+e.getMessage());
throw e;
}catch(RemoteError e){
io.senderrmsg("missing your authentication data"); // strange but true
throw new AuthenticationException(e.getMessage());
}
try{
String s;
do{
s = io.gets();
}while(!s.equals("OK"));
}catch(ClosedByInterruptException e){
throw new AuthenticationException("interrupted by time-out", e);
}catch(IOException e){
throw new AuthenticationException("i/o error: "+e.getMessage());
}catch(RemoteError e){
throw new AuthenticationException("remote: "+e.getMessage());
}
return new AuthResult(new Authinfo(null, hispk, hiscert, info.spk, info.alpha, info.p), secret);
}
private static int now(){
return (int)((new Date()).getTime()/1000);
}
public static final BigInteger rand(BigInteger p, BigInteger q) throws IllegalArgumentException {
if(p.compareTo(q) > 0){
BigInteger t = p; p = q; q = t;
}
BigInteger diff = q.subtract(p);
BigInteger two = BigInteger.ONE.add(BigInteger.ONE);
if(diff.compareTo(two) < 0)
throw new IllegalArgumentException("range must be at least two");
int l = diff.bitLength();
BigInteger t = BigInteger.ONE.shiftLeft(l);
l = (l + 7) & ~7; // nearest byte
BigInteger slop = t.mod(diff);
BigInteger r;
do{
byte[] buf = new byte[l];
Aids.memrandom(buf, 0, l);
r = new BigInteger(1, buf);
}while(r.compareTo(slop) < 0);
return r.mod(diff).add(p);
}
public final void setlinecrypt(ByteChannel fd, String role, String[] algs) throws IOException {
String alg;
Msgio io;
io = new Msgio(fd);
if(role.equals("client")){
if(algs != null && algs.length > 0)
alg = algs[0];
else
alg = "none"; // alg = "md5/rc4_256"; // no idea how to make use of SSL without its handshake
io.sendmsg(alg);
}else if(role.equals("server")){
try{
alg = io.gets();
}catch(RemoteError e){
throw new IOException("remote: "+e.getMessage(), e); // can't happen
}
if(!alg.equals("none"))
throw new IOException("unsupported algorithm: "+alg);
}else
throw new IOException("invalid role: "+role);
}
public final AuthResult auth(ByteChannel fd, String role, Authinfo info, String[] algs) throws AuthenticationException, IOException {
AuthResult a;
a = basicauth(fd, info);
setlinecrypt(fd, role, algs);
return a;
}
private static final BigInteger rsaencrypt(RSAPublicKey pk, BigInteger data){
return data.modPow(pk.getPublicExponent(), pk.getModulus());
}
public final Certificate sign(InfPrivateKey sk, int exp, byte a[]) throws NoSuchAlgorithmException {
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
BigInteger sig, digest;
sha1.update(a);
// add signer's name and expiration to hash
sha1.update(bytes(sk.owner+" "+exp)); // "%s %d"
digest = new BigInteger(1, sha1.digest());
sig = rsadecrypt(digest, sk.sk);
return new Certificate("rsa", "sha1", sk.owner, exp, sig);
}
public final boolean verify(InfPublicKey pk, Certificate c, byte a[]) throws NoSuchAlgorithmException {
if(!c.sa.equals("rsa") || !c.ha.equals("sha1") && !c.ha.equals("sha"))
return false;
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
sha1.update(a);
sha1.update(bytes(c.signer+" "+c.exp));
return rsaverify(new BigInteger(1, sha1.digest()), c.rsa, (RSAPublicKey)pk.pk);
}
public static final BigInteger rsadecrypt(BigInteger n, PrivateKey rsa1){
RSAPrivateCrtKey rsa = (RSAPrivateCrtKey)rsa1;
BigInteger p, q, v1, v2;
p = rsa.getPrimeP();
v1 = n.mod(p);
q = rsa.getPrimeQ();
v2 = n.mod(q);
v1 = v1.modPow(rsa.getPrimeExponentP(), p);
v2 = v2.modPow(rsa.getPrimeExponentQ(), q);
// out = v1 + p*((v2-v1)*c2 mod q)
return v2.subtract(v1).multiply(rsa.getCrtCoefficient()).mod(q).multiply(p).add(v1);
}
public static final boolean rsaverify(BigInteger m, BigInteger sig, RSAPublicKey key){
return rsaencrypt(key, sig).equals(m);
}
}
| [
"[email protected]"
]
| |
6c73e8ce1f13eae3c6cad9426c899a5421c66f43 | f66fc1aca1c2ed178ac3f8c2cf5185b385558710 | /reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/ConcreteChild.java | 06613d5f0e19231f7264b6b8f9f33979b1dcdc56 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-public-domain"
]
| permissive | goldmansachs/reladomo | 9cd3e60e92dbc6b0eb59ea24d112244ffe01bc35 | a4f4e39290d8012573f5737a4edc45d603be07a5 | refs/heads/master | 2023-09-04T10:30:12.542924 | 2023-07-20T09:29:44 | 2023-07-20T09:29:44 | 68,020,885 | 431 | 122 | Apache-2.0 | 2023-07-07T21:29:52 | 2016-09-12T15:17:34 | Java | UTF-8 | Java | false | false | 864 | java | /*
Copyright 2018 Mohammad Rezaei
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.gs.fw.common.mithra.test.domain;
public class ConcreteChild extends ConcreteChildAbstract
{
public ConcreteChild()
{
super();
// You must not modify this constructor. Mithra calls this internally.
// You can call this constructor. You can also add new constructors.
}
}
| [
"[email protected]"
]
| |
fd26a37975216f4eacd727f959cf4c6bfc48c295 | 3c41dcfba987f2b17d737ecb9c80b2c8f72be3c1 | /src/main/java/thread_demo/demo15/ThreadB.java | 4f1df2eb9f0539e7c9f69df97c83729d069156ca | []
| no_license | xuchang1/Demo | cfc0effdc39394748fba64ad668b2b6f6ed5bb74 | 23c1f076c6caac52cd1642b7eb75dcc13cdf41f0 | refs/heads/master | 2023-04-29T16:00:20.779760 | 2020-10-17T03:14:11 | 2020-10-17T03:14:11 | 150,219,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | package thread_demo.demo15;
public class ThreadB extends Thread {
private MyObject myObject;
public ThreadB(MyObject myObject) {
this.myObject = myObject;
}
@Override
public void run() {
myObject.methodB();
}
}
| [
"1w2b3c4g"
]
| 1w2b3c4g |
715ac409556569a44b982c1069430a8f4a0321a1 | eb9e8acae72226fe4d3f7adb23754381306c99c4 | /app/build/generated/source/r/debug/com/google/android/gms/R.java | 280f7b28301bdcda08c2d2349290c4b85ec121f0 | []
| no_license | deadondemographic/Diary | 8d9577e0e9d55f36ab0bac63ca50a48f63689fcc | eb975a29afd142aff3ea7df977227c40f17781c4 | refs/heads/master | 2021-01-10T19:53:50.338415 | 2015-05-07T12:34:04 | 2015-05-07T12:34:19 | 35,218,483 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,069 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010000;
public static final int adSizes = 0x7f010001;
public static final int adUnitId = 0x7f010002;
public static final int appTheme = 0x7f010017;
public static final int buyButtonAppearance = 0x7f01001e;
public static final int buyButtonHeight = 0x7f01001b;
public static final int buyButtonText = 0x7f01001d;
public static final int buyButtonWidth = 0x7f01001c;
public static final int cameraBearing = 0x7f010008;
public static final int cameraTargetLat = 0x7f010009;
public static final int cameraTargetLng = 0x7f01000a;
public static final int cameraTilt = 0x7f01000b;
public static final int cameraZoom = 0x7f01000c;
public static final int circleCrop = 0x7f010006;
public static final int environment = 0x7f010018;
public static final int fragmentMode = 0x7f01001a;
public static final int fragmentStyle = 0x7f010019;
public static final int imageAspectRatio = 0x7f010005;
public static final int imageAspectRatioAdjust = 0x7f010004;
public static final int liteMode = 0x7f01000d;
public static final int mapType = 0x7f010007;
public static final int maskedWalletDetailsBackground = 0x7f010021;
public static final int maskedWalletDetailsButtonBackground = 0x7f010023;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f010022;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010020;
public static final int maskedWalletDetailsLogoImageType = 0x7f010025;
public static final int maskedWalletDetailsLogoTextColor = 0x7f010024;
public static final int maskedWalletDetailsTextAppearance = 0x7f01001f;
public static final int uiCompass = 0x7f01000e;
public static final int uiMapToolbar = 0x7f010016;
public static final int uiRotateGestures = 0x7f01000f;
public static final int uiScrollGestures = 0x7f010010;
public static final int uiTiltGestures = 0x7f010011;
public static final int uiZoomControls = 0x7f010012;
public static final int uiZoomGestures = 0x7f010013;
public static final int useViewLifecycle = 0x7f010014;
public static final int windowTransitionStyle = 0x7f010003;
public static final int zOrderOnTop = 0x7f010015;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f050000;
public static final int common_signin_btn_dark_text_default = 0x7f050001;
public static final int common_signin_btn_dark_text_disabled = 0x7f050002;
public static final int common_signin_btn_dark_text_focused = 0x7f050003;
public static final int common_signin_btn_dark_text_pressed = 0x7f050004;
public static final int common_signin_btn_default_background = 0x7f050005;
public static final int common_signin_btn_light_text_default = 0x7f050006;
public static final int common_signin_btn_light_text_disabled = 0x7f050007;
public static final int common_signin_btn_light_text_focused = 0x7f050008;
public static final int common_signin_btn_light_text_pressed = 0x7f050009;
public static final int common_signin_btn_text_dark = 0x7f050017;
public static final int common_signin_btn_text_light = 0x7f050018;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f05000a;
public static final int wallet_bright_foreground_holo_dark = 0x7f05000b;
public static final int wallet_bright_foreground_holo_light = 0x7f05000c;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f05000d;
public static final int wallet_dim_foreground_holo_dark = 0x7f05000e;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f05000f;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f050010;
public static final int wallet_highlighted_text_holo_dark = 0x7f050011;
public static final int wallet_highlighted_text_holo_light = 0x7f050012;
public static final int wallet_hint_foreground_holo_dark = 0x7f050013;
public static final int wallet_hint_foreground_holo_light = 0x7f050014;
public static final int wallet_holo_blue_light = 0x7f050015;
public static final int wallet_link_text_light = 0x7f050016;
public static final int wallet_primary_text_holo_light = 0x7f050019;
public static final int wallet_secondary_text_holo_dark = 0x7f05001a;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f020000;
public static final int common_ic_googleplayservices = 0x7f020001;
public static final int common_signin_btn_icon_dark = 0x7f020002;
public static final int common_signin_btn_icon_disabled_dark = 0x7f020003;
public static final int common_signin_btn_icon_disabled_focus_dark = 0x7f020004;
public static final int common_signin_btn_icon_disabled_focus_light = 0x7f020005;
public static final int common_signin_btn_icon_disabled_light = 0x7f020006;
public static final int common_signin_btn_icon_focus_dark = 0x7f020007;
public static final int common_signin_btn_icon_focus_light = 0x7f020008;
public static final int common_signin_btn_icon_light = 0x7f020009;
public static final int common_signin_btn_icon_normal_dark = 0x7f02000a;
public static final int common_signin_btn_icon_normal_light = 0x7f02000b;
public static final int common_signin_btn_icon_pressed_dark = 0x7f02000c;
public static final int common_signin_btn_icon_pressed_light = 0x7f02000d;
public static final int common_signin_btn_text_dark = 0x7f02000e;
public static final int common_signin_btn_text_disabled_dark = 0x7f02000f;
public static final int common_signin_btn_text_disabled_focus_dark = 0x7f020010;
public static final int common_signin_btn_text_disabled_focus_light = 0x7f020011;
public static final int common_signin_btn_text_disabled_light = 0x7f020012;
public static final int common_signin_btn_text_focus_dark = 0x7f020013;
public static final int common_signin_btn_text_focus_light = 0x7f020014;
public static final int common_signin_btn_text_light = 0x7f020015;
public static final int common_signin_btn_text_normal_dark = 0x7f020016;
public static final int common_signin_btn_text_normal_light = 0x7f020017;
public static final int common_signin_btn_text_pressed_dark = 0x7f020018;
public static final int common_signin_btn_text_pressed_light = 0x7f020019;
public static final int ic_plusone_medium_off_client = 0x7f02001a;
public static final int ic_plusone_small_off_client = 0x7f02001b;
public static final int ic_plusone_standard_off_client = 0x7f02001c;
public static final int ic_plusone_tall_off_client = 0x7f02001d;
public static final int powered_by_google_dark = 0x7f02001f;
public static final int powered_by_google_light = 0x7f020020;
}
public static final class id {
public static final int adjust_height = 0x7f0a0002;
public static final int adjust_width = 0x7f0a0003;
public static final int book_now = 0x7f0a0011;
public static final int buyButton = 0x7f0a000d;
public static final int buy_now = 0x7f0a0012;
public static final int buy_with_google = 0x7f0a0013;
public static final int classic = 0x7f0a0015;
public static final int donate_with_google = 0x7f0a0014;
public static final int grayscale = 0x7f0a0016;
public static final int holo_dark = 0x7f0a0008;
public static final int holo_light = 0x7f0a0009;
public static final int hybrid = 0x7f0a0004;
public static final int match_parent = 0x7f0a000f;
public static final int monochrome = 0x7f0a0017;
public static final int none = 0x7f0a0000;
public static final int normal = 0x7f0a0005;
public static final int production = 0x7f0a000a;
public static final int sandbox = 0x7f0a000b;
public static final int satellite = 0x7f0a0006;
public static final int selectionDetails = 0x7f0a000e;
public static final int slide = 0x7f0a0001;
public static final int strict_sandbox = 0x7f0a000c;
public static final int terrain = 0x7f0a0007;
public static final int wrap_content = 0x7f0a0010;
}
public static final class integer {
public static final int google_play_services_version = 0x7f060000;
}
public static final class raw {
public static final int gtm_analytics = 0x7f040000;
}
public static final class string {
public static final int accept = 0x7f070000;
public static final int common_android_wear_notification_needs_update_text = 0x7f070003;
public static final int common_android_wear_update_text = 0x7f070004;
public static final int common_android_wear_update_title = 0x7f070005;
public static final int common_google_play_services_enable_button = 0x7f070006;
public static final int common_google_play_services_enable_text = 0x7f070007;
public static final int common_google_play_services_enable_title = 0x7f070008;
public static final int common_google_play_services_error_notification_requested_by_msg = 0x7f070009;
public static final int common_google_play_services_install_button = 0x7f07000a;
public static final int common_google_play_services_install_text_phone = 0x7f07000b;
public static final int common_google_play_services_install_text_tablet = 0x7f07000c;
public static final int common_google_play_services_install_title = 0x7f07000d;
public static final int common_google_play_services_invalid_account_text = 0x7f07000e;
public static final int common_google_play_services_invalid_account_title = 0x7f07000f;
public static final int common_google_play_services_needs_enabling_title = 0x7f070010;
public static final int common_google_play_services_network_error_text = 0x7f070011;
public static final int common_google_play_services_network_error_title = 0x7f070012;
public static final int common_google_play_services_notification_needs_installation_title = 0x7f070013;
public static final int common_google_play_services_notification_needs_update_title = 0x7f070014;
public static final int common_google_play_services_notification_ticker = 0x7f070015;
public static final int common_google_play_services_sign_in_failed_text = 0x7f070016;
public static final int common_google_play_services_sign_in_failed_title = 0x7f070017;
public static final int common_google_play_services_unknown_issue = 0x7f070018;
public static final int common_google_play_services_unsupported_text = 0x7f070019;
public static final int common_google_play_services_unsupported_title = 0x7f07001a;
public static final int common_google_play_services_update_button = 0x7f07001b;
public static final int common_google_play_services_update_text = 0x7f07001c;
public static final int common_google_play_services_update_title = 0x7f07001d;
public static final int common_open_on_phone = 0x7f07001e;
public static final int common_signin_button_text = 0x7f07001f;
public static final int common_signin_button_text_long = 0x7f070020;
public static final int commono_google_play_services_api_unavailable_text = 0x7f070021;
public static final int create_calendar_message = 0x7f070024;
public static final int create_calendar_title = 0x7f070025;
public static final int decline = 0x7f070026;
public static final int store_picture_message = 0x7f07002b;
public static final int store_picture_title = 0x7f07002c;
public static final int wallet_buy_button_place_holder = 0x7f07002e;
}
public static final class style {
public static final int Theme_IAPTheme = 0x7f080000;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f080001;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f080002;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f080003;
public static final int WalletFragmentDefaultStyle = 0x7f080004;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010000, 0x7f010001, 0x7f010002 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f010003 };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f010004, 0x7f010005, 0x7f010006 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016 };
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] WalletFragmentOptions = { 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025 };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"[email protected]"
]
| |
5c332343f1b3e0c72322b026fd00773d21cacb2e | b3bce1c0bf896106e44d8b13d6c42344bfde6fef | /JavaFootballAdmin/src/com/betfair/www/publicapi/types/global/v3/APIResponse.java | 5166bf86dab38f57d1240fe7d223a439e372e9bc | []
| no_license | flashmonkey/footballmonkey | aecbdb817d98533f6b658572152cda0090935502 | 5be346b1b98d9bc496a681077adfa4a966e19ab8 | refs/heads/master | 2020-05-20T08:57:52.628121 | 2009-12-26T11:22:04 | 2009-12-26T11:22:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,663 | java | /**
* APIResponse.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.betfair.www.publicapi.types.global.v3;
public abstract class APIResponse implements java.io.Serializable {
private com.betfair.www.publicapi.types.global.v3.APIResponseHeader header;
public APIResponse() {
}
public APIResponse(
com.betfair.www.publicapi.types.global.v3.APIResponseHeader header) {
this.header = header;
}
/**
* Gets the header value for this APIResponse.
*
* @return header
*/
public com.betfair.www.publicapi.types.global.v3.APIResponseHeader getHeader() {
return header;
}
/**
* Sets the header value for this APIResponse.
*
* @param header
*/
public void setHeader(com.betfair.www.publicapi.types.global.v3.APIResponseHeader header) {
this.header = header;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof APIResponse)) return false;
APIResponse other = (APIResponse) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.header==null && other.getHeader()==null) ||
(this.header!=null &&
this.header.equals(other.getHeader())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getHeader() != null) {
_hashCode += getHeader().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(APIResponse.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.betfair.com/publicapi/types/global/v3/", "APIResponse"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("header");
elemField.setXmlName(new javax.xml.namespace.QName("", "header"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.betfair.com/publicapi/types/global/v3/", "APIResponseHeader"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"[email protected]"
]
| |
0f9918982b0c6cfa9426010b5191a352e2ea8b76 | 0d76e148348cf8ff022506bd065826efc2a7d61e | /sb/Game.java | 48af2a1676a9297df9cba59c95c6689f3cd04cfb | []
| no_license | ad3g/openshift_apps | fc4b78a10742a2965bff7d96a1fae838102fac63 | 479b78d23ebd8f5fa484ad9bf34de3f891a6ecb5 | refs/heads/master | 2021-08-27T23:00:30.732624 | 2017-12-10T16:17:41 | 2017-12-10T16:17:41 | 106,334,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,173 | java | package com.sb;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.naming.NamingException;
import com.common.MVDBHelper;
public class Game {
public String gameid = "";
public String NFCTeam = "Seatle Seahawks";
public String AFCTeam = "New England Patriots";
public String NFCNumbers1 = "";
public String AFCNumbers1 = "";
public String NFCNumbers2 = "";
public String AFCNumbers2 = "";
public String PlayerNumbers = "";
public String NFCAbbr = "";
public String AFCAbbr = "";
public void assignNumbers() throws NamingException {
System.out.println("Game, assignNumbers");
List<String> sNFCNumbers1 = GetList(10);
SuffleList(sNFCNumbers1);
NFCNumbers1 = sNFCNumbers1.toString().replace("[","").replace("]","");
System.out.println("assignNumbers, NFCNumbers1: " + NFCNumbers1);
List<String> sNFCNumbers2 = GetList(10);
SuffleList(sNFCNumbers2);
NFCNumbers2 = sNFCNumbers2.toString().replace("[","").replace("]","");
System.out.println("assignNumbers, NFCNumbers2: " + NFCNumbers2);
List<String> sAFCNumbers1 = GetList(10);
SuffleList(sAFCNumbers1);
AFCNumbers1 = sAFCNumbers1.toString().replace("[","").replace("]","");
System.out.println("assignNumbers, AFCNumbers1: " + AFCNumbers1);
List<String> sAFCNumbers2 = GetList(10);
SuffleList(sAFCNumbers2);
AFCNumbers2 = sAFCNumbers2.toString().replace("[","").replace("]","");
System.out.println("assignNumbers, AFCNumbers2: " + AFCNumbers2);
List<String> sPlayerNumbers = GetList(100);
SuffleList(sPlayerNumbers);
PlayerNumbers = sPlayerNumbers.toString().replace("[","").replace("]","");
System.out.println("assignNumbers, PlayerNumbers: " + PlayerNumbers);
updateGame();
System.out.println("Game, After updateGame, assignNumbers");
}
private void updateGame() throws NamingException {
System.out.println("Game, updateGame");
String sql = "UPDATE apps.SB_GAME SET NFCNUMBERS1 = ?, AFCNUMBERS1 = ?, NFCNUMBERS2 = ?, AFCNUMBERS2 = ?, PLAYERNUMBERS = ?";
System.out.println("Game, updateGame, sql: " + sql);
// MVDBHelper dbh = new MVDBHelper();
// Connection conn = null;
// conn = dbh.getLocalConnection();
PreparedStatement pstmt = null;
try {
pstmt = MVDBHelper.getLocalConnection().prepareStatement(sql);
pstmt.setString(1, NFCNumbers1);
pstmt.setString(2, AFCNumbers1);
pstmt.setString(3, NFCNumbers2);
pstmt.setString(4, AFCNumbers2);
pstmt.setString(5, PlayerNumbers);
pstmt.executeUpdate();
pstmt.close();
//conn.close();
}
catch (SQLException e) {
e.printStackTrace();
}
finally
{
// try {
// if (conn != null)
// conn.close();
// }
// catch (Exception e) {
// e.printStackTrace();
// }
}
}
private static List GetList(int sz) {
List l = new ArrayList<String>();
for (int i = 0; i < sz;i++){
l.add(i);
}
return l;
}
private static List SuffleList(List lToShuffle) {
Collections.shuffle(lToShuffle);
return lToShuffle;
}
public void getGame() throws NamingException {
System.out.println("Game, getGame");
String sql = "SELECT NFCTEAM, AFCTEAM, NFCNUMBERS1, AFCNUMBERS1, NFCNUMBERS2, AFCNUMBERS2, PLAYERNUMBERS, GAMEID, NFCABBR, AFCABBR FROM apps.SB_GAME";
System.out.println("Game, getGame, sql: " + sql);
// MVDBHelper dbh = new MVDBHelper();
// Connection conn = null;
// conn = dbh.getLocalConnection();
PreparedStatement pstmt = null;
try {
pstmt = MVDBHelper.getLocalConnection().prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
setNFCTeam(rs.getString(1));
setAFCTeam(rs.getString(2));
setNFCNumbers1(rs.getString(3));
setAFCNumbers1(rs.getString(4));
setNFCNumbers2(rs.getString(5));
setAFCNumbers2(rs.getString(6));
setPlayerNumbers(rs.getString(7));
setGameid(rs.getString(8));
setNFCAbbr(rs.getString(9));
setAFCAbbr(rs.getString(10));
}
pstmt.close();
}
catch (SQLException e) {
e.printStackTrace();
}
finally
{
// try {
// if (conn != null)
// conn.close();
// }
// catch (Exception e) {
// e.printStackTrace();
// }
}
System.out.println("Game, getGame, done, NFCTEAM: " + NFCTeam + " AFCTEAM:" + AFCTeam);
}
public String getNFCTeam() {
return NFCTeam;
}
public void setNFCTeam(String nFCTeam) {
NFCTeam = nFCTeam;
}
public String getAFCTeam() {
return AFCTeam;
}
public void setAFCTeam(String aFCTeam) {
AFCTeam = aFCTeam;
}
public String getNFCNumbers1() {
return NFCNumbers1;
}
public void setNFCNumbers1(String nFCNumbers1) {
NFCNumbers1 = nFCNumbers1;
}
public String getAFCNumbers1() {
return AFCNumbers1;
}
public void setAFCNumbers1(String aFCNumbers1) {
AFCNumbers1 = aFCNumbers1;
}
public String getNFCNumbers2() {
return NFCNumbers2;
}
public void setNFCNumbers2(String nFCNumbers2) {
NFCNumbers2 = nFCNumbers2;
}
public String getAFCNumbers2() {
return AFCNumbers2;
}
public void setAFCNumbers2(String aFCNumbers2) {
AFCNumbers2 = aFCNumbers2;
}
public String getPlayerNumbers() {
return PlayerNumbers;
}
public void setPlayerNumbers(String playerNumbers) {
PlayerNumbers = playerNumbers;
}
public String getGameid() {
return gameid;
}
public void setGameid(String gameid) {
this.gameid = gameid;
}
public String getNFCAbbr() {
return NFCAbbr;
}
public void setNFCAbbr(String nFCAbbr) {
NFCAbbr = nFCAbbr;
}
public String getAFCAbbr() {
return AFCAbbr;
}
public void setAFCAbbr(String aFCAbbr) {
AFCAbbr = aFCAbbr;
}
public boolean numbersLoaded() {
boolean bRtn = true;
if (PlayerNumbers==null || PlayerNumbers.equals("")){
bRtn = false;
}
else
{
bRtn = true;
}
return bRtn;
}
}
| [
"[email protected]"
]
| |
0c95a5a6e77f8ee18f70c3ff7e2d09b5c0268157 | a497410298083873bb4a82acf1f55150409e74cd | /src/prj/user/ActionManage.java | 3730ccd18b5c2fb0c5d15b10121d25a2868530be | []
| no_license | jackchen2015/jcErp | 32c9cd2953e4f1a96ab2b936f3e853fd047a43b1 | f7df1eb453b9cbdb17bfa57955f6eaa202367c9b | refs/heads/master | 2021-01-19T22:10:27.511982 | 2017-04-28T08:52:07 | 2017-04-28T08:52:07 | 88,766,540 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | /*
* Copyright 2015 Hongxin Telecommunication Technologies Co, Ltd.,
* Wuhan, Hubei, China. All rights reserved.
*/
/*
* ActionManage.java
*
* Created on 2017-4-24, 9:24:56
*/
package prj.user;
/**
*
* @author chenwei
*/
public class ActionManage extends javax.swing.JPanel
{
/** Creates new form ActionManage */
public ActionManage()
{
initComponents();
}
/** 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()
{
setName("Form"); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
1464b0e31b1632d8f81afbf67bc5b4f8c887c3c8 | 98bf0dc455f4865bea06847c12c46f4be31d2ec4 | /fhir/src/test/java/org/dhis2/fhir/adapter/fhir/metadata/repository/validator/BeforeCreateSaveOrganizationUnitRuleValidatorTest.java | 419690acafdcad31997204c3bd98adcfb801dc8c | [
"BSD-3-Clause"
]
| permissive | opensrp/dhis2-fhir-adapter | 5150e8876fb3405534792e6ce15d73a4363cf09e | e29d531f311d87089a32fbfaedde3456dbb6da6e | refs/heads/master | 2022-11-28T02:45:44.378322 | 2022-05-17T11:40:41 | 2022-05-17T11:40:41 | 472,286,673 | 1 | 2 | BSD-3-Clause | 2022-11-12T22:13:07 | 2022-03-21T10:25:17 | Java | UTF-8 | Java | false | false | 10,264 | java | package org.dhis2.fhir.adapter.fhir.metadata.repository.validator;
/*
* Copyright (c) 2004-2019, University of Oslo
* 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 HISP project 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.
*/
import org.apache.commons.lang3.StringUtils;
import org.dhis2.fhir.adapter.fhir.AbstractJpaRepositoryTest;
import org.dhis2.fhir.adapter.fhir.metadata.model.CodeSet;
import org.dhis2.fhir.adapter.fhir.metadata.model.ExecutableScript;
import org.dhis2.fhir.adapter.fhir.metadata.model.FhirResourceType;
import org.dhis2.fhir.adapter.fhir.metadata.model.OrganizationUnitRule;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.MediaType;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Validator tests for the corresponding repository.
*
* @author volsch
*/
public class BeforeCreateSaveOrganizationUnitRuleValidatorTest extends AbstractJpaRepositoryTest
{
public static final String RESOURCE_PATH = "/api/organizationUnitRules";
public static final String AUTHORIZATION_HEADER_VALUE = CODE_MAPPING_AUTHORIZATION_HEADER_VALUE;
private ExecutableScript identifierLookupScript;
private ExecutableScript filterScript;
private ExecutableScript otherTransformInScript;
private CodeSet applicableCodeSet;
private OrganizationUnitRule entity;
@Before
public void before()
{
identifierLookupScript = entityManager.createQuery( "SELECT e FROM ExecutableScript e WHERE e.code=:code", ExecutableScript.class )
.setParameter( "code", "DHIS_ORG_UNIT_IDENTIFIER_LOC" ).getSingleResult();
filterScript = entityManager.createQuery( "SELECT e FROM ExecutableScript e WHERE e.code=:code", ExecutableScript.class )
.setParameter( "code", "SEARCH_FILTER_LOCATION" ).getSingleResult();
otherTransformInScript = entityManager.createQuery( "SELECT e FROM ExecutableScript e WHERE e.code=:code", ExecutableScript.class )
.setParameter( "code", "CP_OPV_DOSE" ).getSingleResult();
entity = new OrganizationUnitRule();
entity.setEnabled( false );
entity.setEvaluationOrder( Integer.MIN_VALUE );
entity.setName( createUnique() );
entity.setFhirResourceType( FhirResourceType.ORGANIZATION );
entity.setDescription( createUnique() );
}
@Test
public void testNameBlank() throws Exception
{
entity.setName( " " );
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "name" ) ) );
}
@Test
public void testNameLength() throws Exception
{
entity.setName( StringUtils.repeat( 'a', OrganizationUnitRule.MAX_NAME_LENGTH + 1 ) );
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "name" ) ) );
}
@Test
public void testFhirResourceTypeNull() throws Exception
{
entity.setFhirResourceType( null );
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "fhirResourceType" ) ) );
}
@Test
public void testIdentifierLookupNull() throws Exception
{
entity.setIdentifierLookupScript( null );
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "identifierLookupScript" ) ) );
}
@Test
public void testManagingOrgIdentifierLookupNull() throws Exception
{
entity.setManagingOrgIdentifierLookupScript( null );
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isCreated() );
}
@Test
public void testIdentifierLookupInvalid() throws Exception
{
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "identifierLookupScript", "executableScripts", otherTransformInScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "identifierLookupScript" ) ) );
}
@Test
public void testManagingOrgIdentifierLookupInvalid() throws Exception
{
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "filterScript", "executableScripts", filterScript.getId().toString() ),
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", otherTransformInScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "managingOrgIdentifierLookupScript" ) ) );
}
@Test
public void testFilterScriptInvalid() throws Exception
{
mockMvc.perform( post( RESOURCE_PATH ).header( AUTHORIZATION_HEADER_NAME, AUTHORIZATION_HEADER_VALUE )
.contentType( MediaType.APPLICATION_JSON ).content( replaceJsonEntityReferences( entity,
JsonEntityValue.create( "identifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "filterScript", "executableScripts", identifierLookupScript.getId().toString() ),
JsonEntityValue.create( "managingOrgIdentifierLookupScript", "executableScripts", identifierLookupScript.getId().toString() ) ) ) )
.andExpect( status().isBadRequest() ).andExpect( jsonPath( "errors[0].property", Matchers.is( "filterScript" ) ) );
}
} | [
"[email protected]"
]
| |
34975aa1c4eeec4b547d0faca4268bf7871d1824 | c9f2bd34255a1f7822fe0fbf4c7e51fa26eede14 | /java-project/src/main/examples/ar/uba/dc/simple/TwoCallsToSameMethod.java | 4f8bf072445206a767dcd7f991c9c59a834f2ef2 | []
| no_license | billy-mosse/jconsume | eca93b696eaf8edcb8af5730eebd95f49e736fd4 | b782a55f20c416a73c967b2225786677af5f52ba | refs/heads/master | 2022-09-22T18:10:43.784966 | 2020-03-09T01:00:38 | 2020-03-09T01:00:38 | 97,016,318 | 4 | 0 | null | 2022-09-01T22:58:04 | 2017-07-12T14:18:01 | C | UTF-8 | Java | false | false | 281 | java | package ar.uba.dc.simple;
public class TwoCallsToSameMethod {
public static void main(String[] args) {
a1();
}
public static void a1()
{
Integer i = a0();
Integer j = a0();
Integer k = a0();
}
public static Integer a0()
{
return new Integer(4);
}
} | [
"[email protected]"
]
| |
8e32e6085071215f3f7ff6fe748c6956981eceea | 69d2268a2c24172ae789bb92b73d7e185102698e | /04_State/src/patterns/state/parser_state_machine/Main.java | 8a0478bc24873aafc6c19d00732adb492fc17c6f | []
| no_license | riscie/DEPA_HS2016 | 76f7a619a397d8c33b0789dab59064b66906316c | 2ccb5cc745ed91d4f8d603b745c558123a1a7f77 | refs/heads/master | 2021-01-12T13:44:00.254038 | 2016-11-01T14:38:37 | 2016-11-01T14:38:37 | 69,157,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,133 | java | package patterns.state.parser_state_machine;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
System.out.println("Enter a Float: ");
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String input = r.readLine();
int pos = 0;
Parser parser = new Parser();
while (input != null && pos < input.length()) {
char ch = input.charAt(pos++);
try {
if (parser.isDigit(ch))
parser.state.digit(parser.getNumericValue(ch));
else if (ch == '.')
parser.state.dot();
else if (ch == '+')
parser.state.plus();
else if (ch == '-')
parser.state.minus();
else if (ch == 'e' || ch == 'E')
parser.state.e();
} catch (IllegalStateException e) {
System.out.println("Illegal Format");
}
input = r.readLine();
}
}
}
| [
"[email protected]"
]
| |
bff73eb2600bb29c3eea5c465fae7ef1ac0a8f86 | e657fc6144356afa759352ed938ffd4962a6098d | /app/src/main/java/oliweira/com/br/contacerta/MainActivity.java | a20246adf5b6c82701329e08a5fc16dbb12b5bda | []
| no_license | oliweiradf/ContaCerta | 0d83739a0a8ad19a0f7ce72da537e8e019d99d26 | 4f9f8d9e3a8f9b4ea48badee197733667f9db76b | refs/heads/master | 2020-12-25T14:57:45.100997 | 2016-08-31T20:27:19 | 2016-08-31T20:27:19 | 67,070,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | package oliweira.com.br.contacerta;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
]
| |
e0a69411f2e03342655054e1db6f7e28d6523c2f | a78e1c5a6520c8c9965772889f58802fb26ac840 | /Conch/build/conch/proj.android/src/laya/game/PlatformInterface/LayaPlatformGlue.java | c63c35e886437c1dd2d853d5cf8e421ce9a67ea5 | []
| no_license | lvfulong/LayaNative-0.9.16 | 495c0fc4522a3dd34479e1ffd1e37c5c77b4a206 | 067d94a63a1917aee6802ab0675fc9efb74a5d9e | refs/heads/main | 2023-03-20T05:41:38.738179 | 2021-03-02T02:14:10 | 2021-03-02T02:14:10 | 343,613,003 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,695 | java | package laya.game.PlatformInterface;
import laya.game.conch.LayaConch3;
import android.util.Log;
//laya与js的胶水函数定义
public class LayaPlatformGlue
{
private static LayaPlatformGlue m_spLayaPlatformGlue = null;
private static String sNotSupport="{\"result\":-50,\"desc\":\"not support\"}";
private LayaPlatformInterface m_pPlatform = null;
static public LayaPlatformGlue GetInstance()
{
if( m_spLayaPlatformGlue == null )m_spLayaPlatformGlue = new LayaPlatformGlue();
return m_spLayaPlatformGlue;
}
static public void DelInstance(){
m_spLayaPlatformGlue = null;
}
public void Init( LayaPlatformInterface p_pPlatfrom )
{
m_pPlatform = p_pPlatfrom;
}
public String getMarketName()
{
Log.i("0",">>>>>getMarketName");
String sMarketName = LayaConch3.getMarketBundle().getString(LayaConch3.MARKET_MARKETNAME);
if( sMarketName == null ) sMarketName = "";
return sMarketName;
}
public int getPayType()
{
Log.i("0",">>>>>getPayType");
return LayaConch3.getMarketBundle().getInt(LayaConch3.MARKET_PAYTYPE);
}
public int getChargeType()
{
Log.i("0",">>>>>getChargeType");
return LayaConch3.getMarketBundle().getInt(LayaConch3.MARKET_CHARGETYPE);
}
public int getLoginType()
{
Log.i("0",">>>>>getLoginType");
return LayaConch3.getMarketBundle().getInt(LayaConch3.MARKET_LOGINTYPE);
}
public String getServerName()
{
Log.i("0",">>>>>getServerName");
String sServerName = LayaConch3.getMarketBundle().getString(LayaConch3.MARKET_SERVERNAME);
if( sServerName == null ) sServerName = "";
return sServerName;
}
public int getEnterPlatformType()
{
Log.i("0",">>>>>getEnterPlatformType");
return LayaConch3.getMarketBundle().getInt(LayaConch3.MARKET_ENTERPLATFORMTYPE);
}
public void login(String jsonParam)
{
Log.i("0",">>>>>login");
if( m_pPlatform != null )
{
m_pPlatform.LP_Login(jsonParam);
}
else
{
LayaPlatformCallback.GetInstance().LP_LoginCallback(sNotSupport);
}
}
public void switchUser(String jsonParam)
{
Log.i("0",">>>>>switchUser");
if( m_pPlatform != null )
{
m_pPlatform.LP_SwitchUser(jsonParam);
}
else
{
LayaPlatformCallback.GetInstance().LP_SwitchUserCallback(sNotSupport);
}
}
public void logout(String jsonParam)
{
Log.i("0",">>>>>logout");
if( m_pPlatform != null )
{
m_pPlatform.LP_Logout(jsonParam);
}
else
{
LayaPlatformCallback.GetInstance().LP_onLogoutCallback(sNotSupport);
}
}
public void recharge( String jsonParam )
{
Log.i("0",">>>>>uniPayForCoin");
if( m_pPlatform != null )
{
m_pPlatform.LP_Recharge( jsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onRechargeCallback(sNotSupport);
}
}
public void enterPlatform(String jsonParam)
{
Log.i("0",">>>>>enterPlatform");
if( m_pPlatform != null )
{
m_pPlatform.LP_EnterPlatform(jsonParam);
}
else
{
LayaPlatformCallback.GetInstance().LP_EnterPlatformCallback(sNotSupport);
}
}
public void onGameEvent( String jsonParam )
{
Log.i("0",">>>>>onGameEvent");
if( m_pPlatform != null )
{
m_pPlatform.LP_onGameEvent( jsonParam );
}
}
public void enterBBS(String jsonParam)
{
Log.i("0",">>>>>enterBBS");
if( m_pPlatform != null )
{
m_pPlatform.LP_enterBBS(jsonParam);
}
else
{
LayaPlatformCallback.GetInstance().LP_EnterBBSCallback(sNotSupport);
}
}
public void enterFeedback(String jsonParam)
{
Log.i("0",">>>>>enterFeedback");
if( m_pPlatform != null )
{
m_pPlatform.LP_enterFeedback(jsonParam);
}
}
public void setRechargeInfo( String jsonParam )
{
Log.i("0",">>>>>setRechargeInfo param="+jsonParam);
if( m_pPlatform != null )
{
m_pPlatform.LP_setRechargeInfo(jsonParam );
}
}
public void enterAccountMgr(String jsonParam)
{
Log.i("0",">>>>>enterAccountMgr");
if( m_pPlatform != null )
{
m_pPlatform.LP_enterAccountMgr(jsonParam);
}
}
public void buyProps( String jsonParam )
{
Log.i("0",">>>>>buyProps = "+jsonParam);
if( m_pPlatform != null )
{
m_pPlatform.LP_buyProps(jsonParam);
}
}
public void shareAndFeed( String p_sExtInfo )
{
Log.i("0",">>>>>shareAndFeed param = "+p_sExtInfo);
if( m_pPlatform != null )
{
m_pPlatform.LP_enterShareAndFeed( p_sExtInfo );
}
else
{
LayaPlatformCallback.GetInstance().LP_ShareAndFeedCallback(sNotSupport);
}
}
public void invite( String p_sJsonParam )
{
Log.i("0",">>>>>invite = "+p_sJsonParam);
if( m_pPlatform != null )
{
m_pPlatform.LP_enterInvite(p_sJsonParam);
}
}
public void authorize( String p_sJsonParam )
{
Log.i("0",">>>>>authorize = "+p_sJsonParam);
if( m_pPlatform != null )
{
m_pPlatform.LP_authorize( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onAuthorizeCallback(sNotSupport);
}
}
public void refreshToken( String p_sJsonParam )
{
Log.i("0",">>>>>refreshToken = "+p_sJsonParam);
if( m_pPlatform != null )
{
m_pPlatform.LP_RefreshToken( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onRefreshTokenCallback(sNotSupport);
}
}
//------------------------------------------------------------------------------
public void getGameFriends( String p_sJsonParam )
{
Log.i("0",">>>>>getGameFriends = " + p_sJsonParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_getGameFriends( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onGetGameFriendsCallback(sNotSupport);
}
}
//------------------------------------------------------------------------------
public void sendToDesktop( String p_sJsonParam )
{
Log.i("0",">>>>>sendToDesktop extinfo=" + p_sJsonParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_sendToDesktop( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onSendToDesktopCallback(sNotSupport);
}
}
//------------------------------------------------------------------------------
public int canSendToDesktop(String p_sJsonParam){
Log.i("0",">>>>>canSendToDesktop");
if( m_pPlatform != null )
{
return m_pPlatform.LP_canSendToDesktop(p_sJsonParam);
}
return 1;
}
//------------------------------------------------------------------------------
public void sendMessageToPlatform( String p_sParam )
{
Log.i("0",">>>>>sendMessageToPlatform p_sParam=" + p_sParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_sendMessageToPlatform( p_sParam );
}
}
public void openTopicCircle(String p_sJsonParam) {
Log.i("0",">>>>>openTopicCircle p_sParam=" + p_sJsonParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_openTopicCircle( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_onTopicCircleCallback(sNotSupport);
}
}
public void getUserInfo(String p_sJsonParam)
{
Log.i("0",">>>>>getUserInfo p_sParam=" + p_sJsonParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_getUserInfo( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_GetUserInfoCallback(sNotSupport);
}
}
public void getAvailableLoginType(String p_sJsonParam)
{
Log.i("0",">>>>>getAvailableLoginType p_sParam=" + p_sJsonParam );
if( m_pPlatform != null )
{
m_pPlatform.LP_getAvailableLoginType( p_sJsonParam );
}
else
{
LayaPlatformCallback.GetInstance().LP_GetAvailableLoginTypeCallback(sNotSupport);
}
}
public String getMarketValue(String key)
{
Log.i("0",">>>>>getMarketValue key=" + key );
if( m_pPlatform != null )
{
return m_pPlatform.LP_getMarketValue(key);
}
return "";
}
public void setMarketValue(String key,String value)
{
Log.i("0",">>>>>setMarketValue key=" + key +"value="+value);
if( m_pPlatform != null )
{
m_pPlatform.LP_setMarketValue(key,value);
}
}
}
| [
"[email protected]"
]
| |
53e5f41332943e055d9aae9fa85860c9e740eb38 | 847bb021e588ef9be7a296ebcff3ad28fe7214ec | /app/src/main/java/com/hudawei/popupwindowsample/popupwindow/BasePopupWindow.java | bbd112a9ff0af666a06bd585d2c64952e55e4bc6 | []
| no_license | youlemei133/PopupWindowSample | e7c45584a5773ffa7cac14421da8d9ebfc4e3b71 | d6b1e7ef10b7636a857198272f2a2b36f0268eb3 | refs/heads/master | 2021-01-22T07:22:33.152692 | 2017-02-13T09:51:47 | 2017-02-13T09:51:47 | 81,809,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,610 | java | package com.hudawei.popupwindowsample.popupwindow;
import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.PopupWindow;
import java.util.ArrayList;
import java.util.List;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
/**
* Created by hudawei on 2017/2/13.
*
* 方法
*
* 1.popBackgroundColor 设置背景色
* 2.popAnimationExit、popAnimationEnter 设置动画
* 3.popTouchOutsideDismiss 设置点击空白区域,是否消失
* 4.showAtLocation、showAsDropDown 显示
* 5.dismissPopupWindow 消失
* 6.findViewById 查找view
*
* 抽象方法
*
* initView()
* initData()
* initEvent()
*
* 使用示例:
* 子类继承SimplePopupWindow
*
* MySimplePopupWindow popupWindow = (MySimplePopupWindow) new MySimplePopupWindow(this)
.popBackgroundColor(0x99FFF0F0)
.popAnimationEnter(R.anim.popup_window_enter)
.popAnimationExit(R.anim.popup_window_exit)
.popTouchOutsideDismiss(true);
popupWindow.showAtLocation(Gravity.CENTER, 0, 0);
*
*
* 注意:
*
* 1.在显示的时候,要确保Activity已经onCreate了
* 2.在Activity onDestroy或finish之前都要调用 PopupWindowManager的clear()方法
*
*
*/
public abstract class BasePopupWindow {
private PopupWindow mPopupWindow;
//该PopupWindow显示的Activity
private Activity mActivity;
//显示的整个布局View
private ViewGroup mContentView;
//在点击外部消失的时候需要用到,该innerId
private View mInnerView;
//是否在进入时开启动画
private boolean mEnterAnimFlag;
//是否在消失的时候开启动画
private boolean mExitAnimFlag;
//进入动画资源
private int mEnterAnimRes;
//消失动画资源
private int mExitAnimRes;
//点击外部是否消失
private boolean mTouchOutsideFlag;
//是否设置了背景色
private boolean mBackgroundFlag;
private static List<BasePopupWindow> windows = new ArrayList<>();
public BasePopupWindow(Activity activity, int layoutRes, int innerLayoutId) {
mActivity = activity;
//加载布局资源
mContentView = (ViewGroup) activity.getLayoutInflater().inflate(layoutRes, null);
mInnerView = mContentView.findViewById(innerLayoutId);
//创建一个PopupWindow,设置宽高,以及FocusAble为true
mPopupWindow = new PopupWindow(mContentView, MATCH_PARENT, MATCH_PARENT, true);
//下面的设置都是为了点击空白区域时,消失PopupWindow
//当是上面设置了宽高为全屏,所以这里设置是多余的
// mPopupWindow.setTouchable(true);
// mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// return false;
// // 这里如果返回true的话,touch事件将被拦截
// // 拦截后 PopupWindow的onTouchEvent不被调用,这样点击外部区域无法dismiss
// }
// });
// mPopupWindow.setBackgroundDrawable(new ColorDrawable(0xAA000000)); //要为popWindow设置一个背景才有效
initView();
initData();
initEvent();
}
/**
* 用来实例化布局里面的View,通过本类中的findViewById()方法
*/
protected abstract void initView();
/**
* 初始化View
*/
protected abstract void initData();
/**
* 绑定View的各种事件
*/
protected abstract void initEvent();
/**
* 点击空白区域,自动消失
*/
private void touchOutSideDismiss() {
mContentView = (ViewGroup) mPopupWindow.getContentView();
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v == mContentView) {
dismissPopupWindow(false);
}
}
};
mInnerView.setOnClickListener(clickListener);
mContentView.setOnClickListener(clickListener);
}
/**
* 设置背景色
*/
public BasePopupWindow popBackgroundColor(int color) {
mBackgroundFlag = true;
mContentView.setBackgroundColor(color);
return this;
}
/**
* 设置背景色
*/
public BasePopupWindow popBackgroundColor(String color) {
return popBackgroundColor(Color.parseColor(color));
}
/**
* 设置PopupWindow显示时的动画
* @param enterAnimRes 动画资源,/res/anim下
* @return this
*/
public BasePopupWindow popAnimationEnter(int enterAnimRes) {
mEnterAnimFlag = true;
mEnterAnimRes = enterAnimRes;
return this;
}
/**
* 设置PopupWindow消失时的动画
* @param exitAnimRes 动画资源,/res/anim下
* @return this
*/
public BasePopupWindow popAnimationExit(int exitAnimRes) {
mExitAnimFlag = true;
mExitAnimRes = exitAnimRes;
return this;
}
/**
* 是否点击空白区域自动消失
* @param touchOutside true自动消失
* @return this
*/
public BasePopupWindow popTouchOutsideDismiss(boolean touchOutside) {
mTouchOutsideFlag = touchOutside;
return this;
}
/**
* 获取View实例工具方法
* @param viewId 查找的View的id
* @return View
*/
public View findViewById(int viewId) {
return mContentView.findViewById(viewId);
}
/**
* 检查当前的Activity是否finish
* @return true没有finish
*/
private boolean checkLifeCycle() {
if (mActivity != null && !mActivity.isFinishing()) {
return true;
}
return false;
}
/**
* 在显示PopupWindow前,设置PopupWindow
*/
private void initShow() {
//检测Activity是否finsih
if (checkLifeCycle()) {
//是否设置了进入动画
if (mEnterAnimFlag) {
//是否设置了背景色,如果设置了,动画只总用于InnerView,如果没有作用于整个contentView
if (mBackgroundFlag) {
mInnerView.startAnimation(AnimationUtils.loadAnimation(mActivity, mEnterAnimRes));
} else {
mContentView.startAnimation(AnimationUtils.loadAnimation(mActivity, mEnterAnimRes));
}
}
//是否点击空白区域自动消失
if (mTouchOutsideFlag) {
touchOutSideDismiss();
}
//全局的PopupWindow管理类,用来存储与销毁PopupWindow
PopupWindowManager.add(this);
}
}
/**
* 消失PopupWindow
* @param immediate 当Activity在finish时,传入true,不会执行动画。其他情况false
*/
public void dismissPopupWindow(boolean immediate) {
//检测Activity是否finish
if (checkLifeCycle()) {
//popupWindow是否在显示
if (mPopupWindow != null && mPopupWindow.isShowing()) {
//如果不是Activity在finish且设置了消失动画
if (!immediate&&mExitAnimFlag) {
//加载动画资源
Animation animation = AnimationUtils.loadAnimation(mActivity, mExitAnimRes);
//设置动画监听器,在动画执行完后,在调用popupWindow的dismiss()方法
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (checkLifeCycle())
mPopupWindow.dismiss();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
//是否设置了背景色
if (mBackgroundFlag) {
mInnerView.startAnimation(animation);
} else {
mContentView.startAnimation(animation);
}
} else {
mPopupWindow.dismiss();
}
}
}
}
/**
* 对应PopupWIndow中的显示方法
*/
public void showAtLocation(int gravity, int x, int y) {
initShow();
mPopupWindow.showAtLocation(mContentView, gravity, x, y);
}
/**
* 对应PopupWIndow中的显示方法
*/
public void showAsDropDown(View anchor) {
initShow();
mPopupWindow.showAsDropDown(anchor);
}
/**
* 对应PopupWIndow中的显示方法
*/
public void showAsDropDown(View anchor, int xoff, int yoff) {
initShow();
mPopupWindow.showAsDropDown(anchor, xoff, yoff);
}
/**
* 对应PopupWIndow中的显示方法
*/
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
initShow();
mPopupWindow.showAsDropDown(anchor, xoff, yoff, gravity);
}
}
| [
"[email protected]"
]
| |
336e4c3e0db55bd320e43fca15e6d7ef7c5e121e | 815b308a90377ad243d50230a7ffbbba744363c9 | /cable-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/test/mapper/JeecgDemoMapper.java | 2277da62be816108e71b80ceb14cd5cee89b37c7 | [
"Apache-2.0",
"MIT"
]
| permissive | luckilyzll/yaq-crm | bca3262b39d0aa98738d2c0fb9b8dccff594a7e0 | e70b7224b60f898428a8ed2d78de5500ddc79129 | refs/heads/master | 2023-03-22T09:20:09.774751 | 2021-03-11T06:42:20 | 2021-03-11T06:42:20 | 346,601,769 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 887 | java | package org.jeecg.modules.demo.test.mapper;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.demo.test.entity.JeecgDemo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* @Description: jeecg 测试demo
* @Author: jeecg-boot
* @Date: 2018-12-29
* @Version: V1.0
*/
public interface JeecgDemoMapper extends BaseMapper<JeecgDemo> {
public List<JeecgDemo> getDemoByName(@Param("name") String name);
/**
* 查询列表数据 直接传数据权限的sql进行数据过滤
*
* @param page
* @param permissionSql
* @return
*/
public IPage<JeecgDemo> queryListWithPermission(Page<JeecgDemo> page, @Param("permissionSql") String permissionSql);
}
| [
"[email protected]"
]
| |
c8075bccf65865d752045e604580cbd349086f36 | 49a1215f06f0f2d2b8e485b07d998d373a5a89ed | /design-pattern/src/main/java/iterator/dinermerger/MenuItem.java | efe4cb1d4dc8c598457ac5c243e81dd86ee4d14e | [
"MIT"
]
| permissive | snx1030/Java-Demos | 408175661de0c44e12af0f30e2023d762f61dd98 | 9c3be4e35fbc3a596e43108d40c8cf32e566aa69 | refs/heads/master | 2022-08-01T13:04:57.553561 | 2020-05-25T04:29:47 | 2020-05-25T04:29:47 | 267,240,318 | 1 | 0 | MIT | 2020-05-27T06:35:57 | 2020-05-27T06:35:57 | null | UTF-8 | Java | false | false | 696 | java | package iterator.dinermerger;
public class MenuItem {
String name;
String description;
boolean vegetarian;
double price;
public MenuItem(String name,
String description,
boolean vegetarian,
double price)
{
this.name = name;
this.description = description;
this.vegetarian = vegetarian;
this.price = price;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
public double getPrice() {
return price;
}
public boolean isVegetarian() {
return vegetarian;
}
public String toString() {
return (name + ", $" + price + "\n " + description);
}
}
| [
"[email protected]"
]
| |
d40d9a1af690d3027cd7e8ecdefcd31aed6b1fd8 | 45453eabec9ded1d6d0980970016df1c545aa8df | /bl_permission/src/test/java/com/bailun/wangjing/permissionlibrary/ExampleUnitTest.java | 82ab43d47ccf2dea475e3d31c13de3b581dfde2f | []
| no_license | fang1994042128/devComLib | 7e5d64acf090fa9b857e076ae8462353cad48ea8 | 7beb82bbb972545040aee45688af6fe495da84cc | refs/heads/master | 2022-04-13T06:45:28.166458 | 2020-04-09T07:46:49 | 2020-04-09T07:46:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.bailun.wangjing.permissionlibrary;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
7706100d670559ae58230f47712d5e23d6dbaa01 | bc7827f7398b0b7e91b72be5024d8658e5531f85 | /app/src/main/java/com/restaurant/nusantaraku/model/ListRestaurantResponse.java | c0cd03da68210b76cbd912217b333c37d5221df3 | []
| no_license | Alnino98/UAS_PRAKMOPRO | 45bc0a46883196140c774ea0ef736238b47d35f3 | bd37df68366d64948887f7a29408812f97a95ea2 | refs/heads/master | 2020-12-01T14:53:50.347569 | 2019-12-28T21:26:14 | 2019-12-28T21:26:14 | 230,670,477 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package com.restaurant.nusantaraku.model;
import com.google.gson.annotations.SerializedName;
import com.restaurant.nusantaraku.model.RestaurantItem;
import java.util.List;
public class ListRestaurantResponse{
@SerializedName("data")
private List<RestaurantItem> data;
@SerializedName("status")
private String status;
public void setData(List<RestaurantItem> data){
this.data = data;
}
public List<RestaurantItem> getData(){
return data;
}
public void setStatus(String status){
this.status = status;
}
public String getStatus(){
return status;
}
}
| [
"[email protected]"
]
| |
6cff46ce0efcf3c8afa5415bfdcbb1d056aa4454 | 01405bcc106dadc79d6f5d75f918ed6162e33f7e | /javase07_gof/src/cn/zhoufy/go/bridge/Brand.java | 1e58432865460449c68e6d47e10bf0823685daf0 | []
| no_license | zfyvvv/javase | 9d9209e3302564419aba7a15e0c0e8e0fea66b72 | e748ffc35924b3368a018971ea1367b95c380dc5 | refs/heads/master | 2020-08-02T01:50:00.532593 | 2019-10-21T22:27:24 | 2019-10-21T22:27:24 | 211,197,331 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 469 | java | package cn.zhoufy.go.bridge;
/**
* 1.一个维度:电脑品牌!
* @author DELL
*
*/
public interface Brand {
void getBrand();
}
class Lenovo implements Brand{
@Override
public void getBrand() {
System.out.println("lenovo");
}
}
class Dell implements Brand{
@Override
public void getBrand() {
System.out.println("dell");
}
}
class Mi implements Brand{
@Override
public void getBrand() {
System.out.println("mi");
}
} | [
"DELL@DESKTOP-3OU3NNV"
]
| DELL@DESKTOP-3OU3NNV |
1159bfbd15b2563b164c01de5d41c4eaa1ccdd57 | 9122337b185e1000fb8719871c441a7f6c3c8685 | /SplashActivity 2.0/src/it/project/main/NewProfileActivity.java | d800aaa0fe019f39d85215760adc8688f11fe5f2 | []
| no_license | Dario66/Mpass-V2 | d37fe56283b627c3d6225669fa08d473a08facad | 43354ed57b881674428d25b65d1c215a5e6891d6 | refs/heads/master | 2021-01-13T02:14:30.081018 | 2015-07-11T11:05:28 | 2015-07-11T11:05:28 | 23,886,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,436 | java | package it.project.main;
import it.project.main.log.LogDbManager;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.example.fstest.R;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
@SuppressLint("SimpleDateFormat")
public class NewProfileActivity extends Activity
{
//User new_user;
User new_user;
LogDbManager log;
String imagepath=null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_profile);
log=new LogDbManager(this);
Button skip=(Button)findViewById(R.id.btn_skip);
skip.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
NewProfileActivity.this.finish();
}
});
List<String> items = new ArrayList<String>();
items.add("Camera");
items.add("Galleria");
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this, android.R.layout.select_dialog_item, items);
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("Seleziona immagine");
//GESTIONE DELL'IMMAGINE
builder.setAdapter(adapter,new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
if (which==0)
{
Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(i, 2);
}
else
{
Intent i=new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, 1);
}
}
});
final AlertDialog dialog=builder.create();
//AL CLICK DELL IMMAGINE
Button btn_image=(Button)findViewById(R.id.btn_image);
btn_image.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
dialog.show();
}
});
//////////////////////////////////////////
//SALVATAGGIO DELLE INFORMAZIONI INSERITE
//DALL'UTENTE DA REGISTRARE NEL DB
/////////////////////////////////////////
Button btn_confirm=(Button)findViewById(R.id.btn_confirmprofile);
btn_confirm.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
EditText et_user=(EditText)findViewById(R.id.et_user);
String username=et_user.getText().toString();
if (!username.isEmpty())
{
//codice per regristrare la persona nel db
NewProfileActivity.this.finish();
}
else
{
Toast.makeText(NewProfileActivity.this, "Username non inserito", Toast.LENGTH_LONG).show();
}
}
});
////////////////////////////
//ENTRATA IN MANIERA ANONIMA
////////////////////////////
Button btn_anon=(Button)findViewById(R.id.btn_anon);
btn_anon.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
new_user=new User(NewProfileActivity.this);
new_user.eraseUser();
new_user.setName("Anonimo");
new_user.setImagePath(null);
new_user.setType("User");
//Intent i=new Intent(NewProfileActivity.this,MapActivity.class);
//startActivity(i);
NewProfileActivity.this.finish();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode==1 && resultCode==RESULT_OK && data!=null)
{
Uri selectedImage=data.getData();
String[] filePath={MediaStore.Images.Media.DATA};
Cursor cursor=getContentResolver().query(selectedImage, filePath, null, null, null);
cursor.moveToFirst();
int columnIndex=cursor.getColumnIndex(filePath[0]);
String picturePath=cursor.getString(columnIndex);
cursor.close();
ImageView image=(ImageView)findViewById(R.id.imageView2);
image.setImageBitmap(BitmapFactory.decodeFile(picturePath));
imagepath=picturePath;
}
else if (requestCode==2 && resultCode==RESULT_OK)
{
Bitmap photo=(Bitmap)data.getExtras().get("data");
ImageView image=(ImageView)findViewById(R.id.imageView2);
image.setImageBitmap(photo);
try
{
File imagefile=createImageFile(photo);
Log.d("dir",imagefile.getAbsolutePath());
imagepath=imagefile.getAbsolutePath();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.new_profile, menu);
return true;
}
@Override
public void onBackPressed()
{
}
@Override
protected void onDestroy()
{
super.onDestroy();
SharedPreferences pref=this.getSharedPreferences("activity", Context.MODE_PRIVATE);
//pref.getBoolean("firsttime", true);
Editor editor = pref.edit();
editor.putBoolean("firsttime", false);
editor.commit();
Intent i=new Intent(NewProfileActivity.this,MapActivity.class);
startActivity(i);
}
private File createImageFile(Bitmap image) throws IOException
{
String dir=Environment.getExternalStorageDirectory().toString();
OutputStream stream=null;
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File file=new File(dir,"temp_avatar"+timeStamp+".jpg");
try
{
//Bitmap bitmap=BitmapFactory.decodeFile(file.getName());
stream=new FileOutputStream(file);
image.compress(Bitmap.CompressFormat.JPEG, 100, stream);
stream.flush();
stream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
return file;
}
}
| [
"[email protected]"
]
| |
e1bdcee4290bffcf6718a273954a433d16a7d555 | 3ac73f4f18e7f6f9bc2d68d45ece3cd13953cb24 | /app/src/main/java/com/riya/marvel/DetailPersonFragment.java | 2ef6c62e7e51628f5f36b722e28d009b7708f0a1 | []
| no_license | ayir/marvel-explorer | d9be69bd6ee1eb4d66f1f63e5fb3377ebb905411 | 09fa0eb172c697333286aeddeb150a34a046bd69 | refs/heads/master | 2021-01-19T20:26:53.890026 | 2017-04-17T12:23:35 | 2017-04-17T12:23:35 | 88,505,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,694 | java | package com.riya.marvel;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.riya.marvel.db.Comic;
import com.riya.marvel.db.Person;
import com.riya.marvel.utilities.ImageLoader;
import com.riya.marvel.utilities.Tools;
/**
* Created by RiyaSharma on 16-04-2017.
*/
public class DetailPersonFragment extends Fragment implements View.OnClickListener {
private static final String LOG_TAG = DetailPersonFragment.class.getSimpleName();
private TextView mName;
private ImageView mImagePerson;
private ProgressBar mProgress;
private TextView mDescription;
private TextView mMoreDetails;
private Person person;
private Comic comic;
public DetailPersonFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle args = getArguments();
if (args != null) {
person = (Person) args.getSerializable("person");
comic=(Comic)args.getSerializable("comic");
} else {
person = null;
comic=null;
}
View rootView = inflater.inflate(R.layout.fragment_detail_person, container, false);
mName = (TextView) rootView.findViewById(R.id.fragment_detail_name);
mImagePerson = (ImageView) rootView.findViewById(R.id.fragment_detail_image);
mProgress = (ProgressBar) rootView.findViewById(R.id.fragment_detail_progress);
mDescription = (TextView) rootView.findViewById(R.id.fragment_detail_description);
mMoreDetails = (TextView) rootView.findViewById(R.id.seedetails);
mMoreDetails.setOnClickListener(this);
if (person != null) {
mName.setText(person.getName());
getActivity().setTitle(person.getName());
mImagePerson.setTag(person.getStandardXLargeImageUrl());
mDescription.setText(person.getDescription());
ImageLoader imageLoader = new ImageLoader(getActivity());
imageLoader.displayImage(person.getStandardXLargeImageUrl(), mImagePerson, mProgress);
}else{
mName.setText(comic.getName());
getActivity().setTitle(comic.getName());
mImagePerson.setTag(comic.getStandardXLargeImageUrl());
mDescription.setText(comic.getDescription());
ImageLoader imageLoader = new ImageLoader(getActivity());
imageLoader.displayImage(comic.getStandardXLargeImageUrl(), mImagePerson, mProgress);
}
return rootView;
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.seedetails) {
Intent intent;
if(person!=null) {
if ((person.getURLDetail() == null) || (person.getURLDetail().equals("")))
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Tools.URL_MARVEL));
else
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(person.getURLDetail())); //+ Tools.genKeyUser()));
}
else{
if ((comic.getURLDetail() == null) || (comic.getURLDetail().equals("")))
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Tools.URL_MARVEL));
else
intent = new Intent(Intent.ACTION_VIEW, Uri.parse(comic.getURLDetail()));
}
startActivity(intent);
}
}
}
| [
"[email protected]"
]
| |
a0698e5a45820ae1bce8f78c4f67b0d73f357f06 | 5c6321406205288466c97c25480e35ffab0603b9 | /ProgramacaoOrientadaObjetoJava/src/poo/slide8/ClasseAbstrataInterface/BemTeVi.java | c245e77c6db37c6dc66554e4bc356974801f34b7 | [
"MIT"
]
| permissive | gabrielvieira1/ProgramacaoOrientadaObjetoJava | 34a17aec8fee3b31b26ef64dfc468222ae62f671 | 517b7447363558963ee2a6fcb46c0a3414f62f7d | refs/heads/master | 2022-11-18T02:54:46.389710 | 2020-07-15T18:02:54 | 2020-07-15T18:02:54 | 257,977,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package poo.slide8.ClasseAbstrataInterface;
public class BemTeVi implements Anda, Voa {
private int posx, posy;
private int altura;
public void avancar(int deslx, int desly) {
posx += deslx;
posy += desly;
}
public void recuar(int deslx, int desly) {
posx -= deslx;
posy -= desly;
}
public void subir(int desl_alt) {
altura += desl_alt;
}
public void descer(int desl_alt) {
altura -= desl_alt;
}
}
| [
"[email protected]"
]
| |
72e95382866eabd044571f4ff7ce8f7171ab4ab4 | 36a8c2d89f42c5d19af8aa2e5736519b0a3a15c5 | /cmsnesia-web/src/main/java/com/cmsnesia/web/config/LoggingFilterConfig.java | ab29d45794419a3c7ddd7500c3988521004c7ae2 | []
| no_license | cmsnesia/cmsnesia | 77b6d6971f43a8455ddc267748185725356400b8 | 8d3077ee0a98dc29ffd2b0332a083275598d27c9 | refs/heads/master | 2022-04-15T17:46:41.926816 | 2020-03-16T06:21:31 | 2020-03-16T08:12:45 | 236,416,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,468 | java | package com.cmsnesia.web.config;
import com.cmsnesia.web.config.interceptor.RequestLoggingInterceptor;
import com.cmsnesia.web.config.interceptor.ResponseLoggingInterceptor;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.ServerWebExchangeDecorator;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
@Slf4j
@Configuration
public class LoggingFilterConfig implements WebFilter {
private final String ignorePatterns = "/swagger";
private final boolean logHeaders = true;
private final boolean useContentLength = true;
@Override
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
if (ignorePatterns != null
&& exchange.getRequest().getURI().getPath().matches(ignorePatterns)) {
return chain.filter(exchange);
} else {
final long startTime = System.currentTimeMillis();
List<String> header = exchange.getRequest().getHeaders().get("Content-Length");
if (useContentLength && (header == null || header.get(0).equals("0"))) {
if (logHeaders)
log.info(
"Request: method={}, uri={}, headers={}",
exchange.getRequest().getMethod(),
exchange.getRequest().getURI().getPath(),
exchange.getRequest().getHeaders());
else
log.info(
"Request: method={}, uri={}",
exchange.getRequest().getMethod(),
exchange.getRequest().getURI().getPath());
}
ServerWebExchangeDecorator exchangeDecorator =
new ServerWebExchangeDecorator(exchange) {
@Override
public ServerHttpRequest getRequest() {
return new RequestLoggingInterceptor(super.getRequest());
}
@Override
public ServerHttpResponse getResponse() {
return new ResponseLoggingInterceptor(super.getResponse(), startTime, logHeaders);
}
};
return chain
.filter(exchangeDecorator)
.doOnSuccess(
aVoid -> {
// logResponse(startTime, exchangeDecorator.getResponse(),
// exchangeDecorator.getResponse().getStatusCode().value());
})
.doOnError(
throwable -> {
logResponse(startTime, exchangeDecorator.getResponse(), 500);
});
}
}
private void logResponse(long startTime, ServerHttpResponse response, int overriddenStatus) {
final long duration = System.currentTimeMillis() - startTime;
List<String> header = response.getHeaders().get("Content-Length");
if (useContentLength && (header == null || header.get(0).equals("0"))) {
if (logHeaders) {
log.info(
"Response({} ms): status={}, headers={}",
"X-Response-Time: " + duration,
"X-Response-Status: " + overriddenStatus,
response.getHeaders());
} else {
log.info(
"Response({} ms): status={}",
"X-Response-Time: " + duration,
"X-Response-Status: " + overriddenStatus);
}
}
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.