blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8be11f6d306a154c736f1960530a3f662a90fa7b | 9dcb43e37096b6928a545c4148793af0c0102ced | /src/main/java/pages/ForgotPasswordPage.java | b061eb8c08750a2a700d5920428a934673bfc823 | [] | no_license | ardaytam/PractisePageObjetModel | 90aa24bd1e2ce6f60bebf49bb7c9d06698e13d28 | 6cd9580c8da17608d5dcb8c151a5309fb96cb9d1 | refs/heads/master | 2023-06-21T07:36:39.231339 | 2021-08-02T18:18:24 | 2021-08-02T18:18:24 | 390,846,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 635 | java | package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class ForgotPasswordPage {
private WebDriver driver;
private By emailField = By.id("email");
private By retrievePasswordButton = By.cssSelector("#form_submit");
public ForgotPasswordPage(WebDriver driver) {
this.driver = driver;
}
public void setEmailField(String email) {
driver.findElement(emailField).sendKeys(email);
}
public EmailSentPage clickRetrievePasswordButton() {
driver.findElement(retrievePasswordButton).click();
return new EmailSentPage(driver);
}
}
| [
"ardayt@gmail.com"
] | ardayt@gmail.com |
2dffe4b99d0055dac73f736ac0caa6cdfee25c89 | fe8a74de25385e942385611d096851bcb2a3953d | /junit3/src/test/java/org/guiceyfruit/testing/junit3/example/EdamModule.java | e4728ccbaee29e4487d26b51a4a2f62e24486cde | [] | no_license | realityforge/guiceyfruit | 91b8b36c2df1065e6748ad221d92fff9b9534eda | 114c64ca3e51b493a249de57b4005d4931df887b | refs/heads/master | 2020-04-01T06:58:31.884331 | 2011-08-27T07:28:57 | 2011-08-27T07:28:57 | 2,255,575 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | /**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.guiceyfruit.testing.junit3.example;
import com.google.inject.AbstractModule;
/** @version $Revision: 1.1 $ */
public class EdamModule extends AbstractModule {
protected void configure() {
bind(Cheese.class).to(Edam.class);
}
}
| [
"james.strachan@gmail.com"
] | james.strachan@gmail.com |
1ac0734d2d5c478fbd28ebe0fd9e2dc8e8342e3c | 13c7e0e6c823909285599f2ac1fe980f03b47e5e | /springcloud-service-feign/src/main/java/com/pci/hystric/SchedualServiceHiHystric.java | 777c7a1e9e66f0fe7f482c1f05becb2b3cb2eaaa | [] | no_license | jason-zyf/springcloud-learn | 536b83a732bea5ec811fa11454325a77adb67d9b | 5f944e4670e9e5d25bd329e9da2ca3b840cf2d39 | refs/heads/master | 2020-11-25T19:22:36.716355 | 2020-08-10T11:03:14 | 2020-08-10T11:03:14 | 228,810,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | /*
package com.pci.hystric;
import com.pci.service.SchedualServiceHi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SchedualServiceHiHystric implements SchedualServiceHi {
@Autowired
public String sayHiFromFeignOne(String name){
return name+",soryy,服务调用失败!!";
}
}
*/
| [
"jason@163.com"
] | jason@163.com |
473f6d623e544a1ac6971830e33463bb41bd63c4 | d4c1e2d83b100e77c045f82f9b449353841dbf1d | /src/main/java/com/cg/main/model/SensorNodeDiscover.java | ebc031f16fdd1175d249dca0cb51fc6a671b2556 | [] | no_license | nilpatid/CG-Parking | 3a050835b1791cc585c7d94820adadc6d9c4f6c0 | e70821b07947f00a11afedde88d08a2d9e2f26e1 | refs/heads/master | 2021-06-27T02:07:57.731819 | 2017-09-12T10:38:07 | 2017-09-12T10:38:07 | 103,257,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,051 | java | package com.cg.main.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
@Entity
@Table
public class SensorNodeDiscover
{
public String ipAddress;
@Id
public String macAddress;
public SensorNodeDiscover(){}
public SensorNodeDiscover(String macAddress){super(); this.macAddress = macAddress;}
public SensorNodeDiscover(String ipAddress, String macAddress) {
super();
this.ipAddress = ipAddress;
this.macAddress = macAddress;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getMacAddress() {
return macAddress;
}
public void setMacAddress(String macAddress) {
this.macAddress = macAddress;
}
@Override
public String toString() {
return "SensorNodeDiscover [ipAddress=" + ipAddress + ", macAddress=" + macAddress + "]";
}
} | [
"nilesh.patidar87@gmail.com"
] | nilesh.patidar87@gmail.com |
fcc5c092ea3a516c98456ca535fa96ef8e207a8f | 59c10e176981f8e80a42336f712eb03b5b607f87 | /wefr/src/webApplication/xml/TypeOfECI.java | 9df61ec0f925e62e9f13e9d6e0f7c997a2067602 | [] | no_license | UTL/psi | f8e9ef70689bb79299a3f34033c8b9bf26ea1494 | 12bba4c02bc395e444c5a4e39cc87c88370e6f2e | refs/heads/master | 2016-09-06T14:13:01.014234 | 2011-12-16T18:03:32 | 2011-12-16T18:03:32 | 2,006,504 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,588 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.11.06 at 03:09:43 PM CET
//
package webApplication.xml;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for typeOfECI.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="typeOfECI">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="Text"/>
* <enumeration value="Image"/>
* <enumeration value="Link"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "typeOfECI")
@XmlEnum
public enum TypeOfECI {
@XmlEnumValue("Text")
TEXT("Text"),
@XmlEnumValue("Image")
IMAGE("Image"),
@XmlEnumValue("Link")
LINK("Link");
private final String value;
TypeOfECI(String v) {
value = v;
}
public String value() {
return value;
}
public static TypeOfECI fromValue(String v) {
for (TypeOfECI c: TypeOfECI.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"cpll.andrea@gmail.com"
] | cpll.andrea@gmail.com |
fa9eb38ec7fc9a51a0fbf00f45fce31cdf45947b | b3294ca8fc9fccc82b31be1be0ee3eb3dd3602ff | /pet-clinic-data/src/main/java/com/springproject/learningpetclinic/services/VisitService.java | 0369cefcac86eaf4a6e9ba87dbe1dbd1de0ee3c0 | [] | no_license | MariaDn/learning-pet-clinic | e5c627b100fbfb3de31555939d270c1014f67fe2 | 9ee677de768e6d159ce32d8ab99362ca79f73848 | refs/heads/master | 2020-03-28T13:05:51.983260 | 2018-11-23T10:14:03 | 2018-11-23T10:14:03 | 148,365,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.springproject.learningpetclinic.services;
import com.springproject.learningpetclinic.model.Visit;
public interface VisitService extends CrudService<Visit, Long> {
}
| [
"mariadonenko@gmail.com"
] | mariadonenko@gmail.com |
fdf8826ccc3a38ad4b1faacdec829e82bbb6e30e | a363c46e7cbb080db2b3a69a70ebf912195e25c7 | /ls-modules/ls-webservice/src/main/java/cn/lonsun/webservice/vo/indicator/IndicatorVO.java | a05b56460adec471f47592a68ada41caa1e58acd | [] | no_license | pologood/excms | 601646dd7ea4f58f8423da007413978192090f8d | e1c03f574d0ecbf0200aaffa7facf93841bab02c | refs/heads/master | 2020-05-14T20:07:22.979151 | 2018-10-06T10:51:37 | 2018-10-06T10:51:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,413 | java | package cn.lonsun.webservice.vo.indicator;
import cn.lonsun.core.base.entity.AMockEntity;
/**
* 指示器
*
* @author xujh
*
*/
public class IndicatorVO extends AMockEntity {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
public enum Type {
Shortcut, // 快捷方式
Menu, // 菜单项
ToolBarButton, // 工具栏按钮
Other// 权限集合(不显示)
}
public enum SizeModel {
Pixel, // 像素
Percent, // 百分比
Max, // 最大化
Adaptation, // 自适应
Define// 指定尺寸
}
/**
* 按钮编码,用于标记操作类型
*
* @author xujh
* @date 2014年9月29日 下午3:13:22
* @version V1.0
*/
public enum OperatorCode {
Add, // 新增
Delete, // 删除
Update, // 修改
Query, // 查询
Enable, // 启用
Unable, // 禁用
Export, // 导出
Move // 移动
}
private Long indicatorId;
// 类型
private String type;
// 指示器编码
private String code;
// 名称
private String name;
// 系统编码,用于标识属于哪个系统
private String systemCode;
//服务器地址
private String host;
// 访问链接
private String uri;
// 资源ID
private Long resourceId;
// 是否可用
private Boolean isEnable = Boolean.TRUE;
// 父菜单的主键
private Long parentId;
// 是否系统定义-用户可以自定义菜单
private Boolean isSystem = Boolean.FALSE;
// 用户ID-用于用户自定义
private Long userId;
// 是否显示子菜单
private Boolean isShowSons = Boolean.FALSE;
// 是否为本引用的首页
private Boolean isIndex = Boolean.FALSE;
private Boolean isShowInDesktop = Boolean.FALSE;
// 序号
private Integer sortNum;
// 业务类别主键
private Long businessTypeId;
//描述
private String description;
// 文字图标
private String textIcon;
// 小图片图标
private String smallIconPath;
// 中图片图标
private String middleIconPath;
// 大图片图标
private String bigIconPath;
// 窗口打开模式,如果type为Define,那么width和height必须大于0,否则忽略这两个属性值
private String sizeModel;
// 窗口宽度,单位为px
private Integer width;
// 窗口高度,单位为px
private Integer height;
//是否是父亲
private Integer isParent = Integer.valueOf(0);
//是否需要推送消息
private Boolean hasMessage = Boolean.FALSE;
//外部用户是否显示
private Boolean isShown4ExternalUser;
//菜单级别
private int menuLevel = 0;
public Long getIndicatorId() {
return indicatorId;
}
public void setIndicatorId(Long indicatorId) {
this.indicatorId = indicatorId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Long getResourceId() {
return resourceId;
}
public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
public Integer getSortNum() {
return sortNum;
}
public void setSortNum(Integer sortNum) {
this.sortNum = sortNum;
}
public Long getBusinessTypeId() {
return businessTypeId;
}
public void setBusinessTypeId(Long businessTypeId) {
this.businessTypeId = businessTypeId;
}
public Boolean getIsEnable() {
return isEnable;
}
public void setIsEnable(Boolean isEnable) {
this.isEnable = isEnable;
}
public Boolean getIsSystem() {
return isSystem;
}
public void setIsSystem(Boolean isSystem) {
this.isSystem = isSystem;
}
public Boolean getIsShowSons() {
return isShowSons;
}
public void setIsShowSons(Boolean isShowSons) {
this.isShowSons = isShowSons;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getTextIcon() {
return textIcon;
}
public void setTextIcon(String textIcon) {
this.textIcon = textIcon;
}
public String getSmallIconPath() {
return smallIconPath;
}
public void setSmallIconPath(String smallIconPath) {
this.smallIconPath = smallIconPath;
}
public String getMiddleIconPath() {
return middleIconPath;
}
public void setMiddleIconPath(String middleIconPath) {
this.middleIconPath = middleIconPath;
}
public String getBigIconPath() {
return bigIconPath;
}
public void setBigIconPath(String bigIconPath) {
this.bigIconPath = bigIconPath;
}
public String getSizeModel() {
return sizeModel;
}
public void setSizeModel(String sizeModel) {
this.sizeModel = sizeModel;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public Integer getIsParent() {
return isParent;
}
public void setIsParent(Integer isParent) {
this.isParent = isParent;
}
public Boolean getIsIndex() {
return isIndex;
}
public void setIsIndex(Boolean isIndex) {
this.isIndex = isIndex;
}
public Boolean getIsShowInDesktop() {
return isShowInDesktop;
}
public void setIsShowInDesktop(Boolean isShowInDesktop) {
this.isShowInDesktop = isShowInDesktop;
}
public Boolean getHasMessage() {
return hasMessage;
}
public void setHasMessage(Boolean hasMessage) {
this.hasMessage = hasMessage;
}
public Boolean getIsShown4ExternalUser() {
return isShown4ExternalUser;
}
public void setIsShown4ExternalUser(Boolean isShown4ExternalUser) {
this.isShown4ExternalUser = isShown4ExternalUser;
}
public int getMenuLevel() {
return menuLevel;
}
public void setMenuLevel(int menuLevel) {
this.menuLevel = menuLevel;
}
}
| [
"2885129077@qq.com"
] | 2885129077@qq.com |
2e4c855c5b932cf84a006de56e85e66190cd9415 | 4172f8a054df556aa0c08c598292b3471e15473b | /PartnerApp/app/src/main/java/com/tatx/partnerapp/adapter/HelpListAdapter.java | 7d5c9641482057d6a3b7a130e038f668e2851e81 | [
"Apache-2.0"
] | permissive | qbizns/Android-Uber-Clone | ca65e3a6a91dc9245a2c94d8b7d21ec56ee7af1e | 85c85f5edf518da2ccc3d63f1ceb148e52698b2e | refs/heads/master | 2020-08-23T06:56:31.167334 | 2019-10-21T12:46:26 | 2019-10-21T12:46:26 | 216,564,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,204 | java | package com.tatx.partnerapp.adapter;
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.TextView;
import java.util.List;
import com.tatx.partnerapp.R;
import com.tatx.partnerapp.dataset.HelpPojo;
/**
* Created by Subbu on 6/19/2015.
*/
public class HelpListAdapter extends RecyclerView.Adapter<HelpListAdapter.ViewHolder> {
List<HelpPojo> helpList;
private OnItemClickListener mListener;
Context context;
public HelpListAdapter(com.tatx.partnerapp.menuactivity.HelpActivity context, List<HelpPojo> helpList) {
this.helpList = helpList;
this.context = context;
}
public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
mListener = onItemClickListener;
}
public interface OnItemClickListener {
void onItemClick(View view, int position);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.help_list, viewGroup, false);
ViewHolder vh = new ViewHolder(v);
v.setTag(i);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, int i) {
HelpPojo data2 = helpList.get(i);
holder.helplist.setText(data2.getAnswer());
//holder.offersimg.setImageResource(imageId[position]);
//Picasso.with(context).load(data2.getRoute()).into(holder.offersimg);
}
@Override
public int getItemCount() {
// return productDetailses.size();
return (null != helpList ? helpList.size() : 0);
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView helplist;
public ViewHolder(final View rowView) {
super(rowView);
helplist = (TextView) rowView.findViewById(R.id.helplist);
}
@Override
public void onClick(View v) {
if (mListener != null) {
mListener.onItemClick(v, getPosition());
}
}
}
}
| [
"Ahmed N. Galal@DESKTOP-EP5BBFO"
] | Ahmed N. Galal@DESKTOP-EP5BBFO |
9cc11da71edf196d14c730e1a859b653226b99e8 | df1fcd8156f02ceb47d9e3445f68e07ee7a446e4 | /PrintAncestorOfNode/src/main/java/org/learn/Client/App.java | f1ef7e59a7723a720549495ab42712f3a17562e7 | [] | no_license | sjkhullar/PrintAncestorOfNode | b7b5c55ea1089cab916c014f35ed96b8f3b3a049 | 3b4546943bb74f3542c12c06eedddf888368b9fe | refs/heads/master | 2021-01-10T03:18:59.649540 | 2016-02-21T15:23:36 | 2016-02-21T15:23:36 | 46,807,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package org.learn.Client;
import org.learn.Question.Node;
import org.learn.Question.PrintAncestorOfNode;
public class App {
public static void main(String[] args) {
// root level 0
Node A = Node.createNode(100);
// Level 1
Node B = Node.createNode(50);
Node C = Node.createNode(150);
// Level 2
Node D = Node.createNode(25);
Node E = Node.createNode(80);
Node F = Node.createNode(125);
Node G = Node.createNode(160);
// connect Level 0 and 1
A.left = B;
A.right = C;
// connect level 1 and level 2
B.left = D;
B.right = E;
C.left = F;
C.right = G;
int iNode = 50;
System.out.printf("Ancestor of Node %d is : \n", iNode);
PrintAncestorOfNode.printAncestorOfNode(A, iNode);
iNode = 160;
System.out.printf("\nAncestor of Node %d is : \n", iNode);
PrintAncestorOfNode.printAncestorOfNode(A, iNode);
iNode = 25;
System.out.printf("\nAncestor of Node %d is : \n", iNode);
PrintAncestorOfNode.printAncestorOfNode(A, iNode);
}
}
| [
"geeks2champ@gmail.com"
] | geeks2champ@gmail.com |
6371cd5260da120dfa0d119590766e003d3d06f0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_97ccd658bd9f2fce35c1d7ed18bd23908c918b8d/PostgresPointService/24_97ccd658bd9f2fce35c1d7ed18bd23908c918b8d_PostgresPointService_s.java | ae2f580c9cb1a05d6e6581a16f739e9fb52d0b45 | [] | 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 | 29,833 | java | /**
* Copyright (C) 2014
* by 52 North Initiative for Geospatial Open Source Software GmbH
*
* Contact: Andreas Wytzisk
* 52 North Initiative for Geospatial Open Source Software GmbH
* Martin-Luther-King-Weg 24
* 48155 Muenster, Germany
* info@52north.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.envirocar.analyse;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.envirocar.analyse.entities.InMemoryPoint;
import org.envirocar.analyse.entities.Point;
import org.envirocar.analyse.properties.Properties;
import org.envirocar.analyse.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* <code>Pointservice</code> implementation using a Postgres database to store the aggregated measurements.
*
* @author Benjamin Pross, Matthes Rieke
*
*/
public class PostgresPointService implements PointService {
private static final Logger LOGGER = LoggerFactory
.getLogger(PostgresPointService.class);
private Connection conn = null;
private String connectionURL = null;
private String databaseName;
private String databasePath;
private String username;
private String password;
public static String aggregated_MeasurementsTableName = (String) Properties.getProperty("aggregated_MeasurementsTableName");
public static String original_MeasurementsTableName = (String) Properties.getProperty("original_MeasurementsTableName");
public static String measurementRelationsTableName = (String) Properties.getProperty("measurement_relationsTableName");
public static String aggregatedTracksTableName = (String) Properties.getProperty("aggregatedTracksTableName");
private String spatial_ref_sys = "4326";// TODO from properties
private String id_exp = "$id$";
private String distance_exp = "$distance$";
private String table_name_exp = "$tablename$";
private String geomFromText_exp = "$geom_from_text$";
private final String speed_value_exp = "$speed_value$";
private final String speedNumberOfContributingPoints_value_exp = "$speedNumberOfContributingPoints_value$";
private final String co2_value_exp = "$co2_value$";
private final String co2NumberOfContributingPoints_value_exp = "$co2NumberOfContributingPoints_value$";
private final String generalNumberOfContributingPoints_value_exp = "$generalNumberOfContributingPoints_value$";
private final String generalnumberOfContributingTracks_value_exp = "$generalnumberOfContributingTracks_value$";
private final String lastContributingTrack_value_exp = "$lastContributingTrack_value$";
private final String geometryEncoded_value_exp = "$geometryEncoded_value$";
private String idField = "id";
private String generalNumberOfContributingPointsField = "generalnumberofcontributingpoints";
private String generalnumberOfContributingTracksField = "generalnumberofcontributingtracks";
private String lastContributingTrackField = "lastcontributingtrack";
private String co2Field = "co2";
private String speedField = "speed";
private String co2NumberOfContributingPointsField = "co2numberofcontributingpoints";
private String speedNumberOfContributingPointsField = "speednumberofcontributingpoints";
private String trackIDField = "trackid";
private String geometryEncodedField = "the_geom";
private String geometryPlainTextField = "text_geom";
private String distField = "dist";
private String aggregated_measurement_idField = "aggregated_measurement_id";
private String aggregation_dateField = "aggregation_date";
private SimpleDateFormat iso8601DateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
private final String pgCreationString = "CREATE TABLE "
+ aggregated_MeasurementsTableName + " ("
+ idField + " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
+ generalNumberOfContributingPointsField + " INTEGER, "
+ generalnumberOfContributingTracksField + " INTEGER,"
+ lastContributingTrackField + " VARCHAR(24),"
+ co2Field + " DOUBLE PRECISION,"
+ co2NumberOfContributingPointsField + " INTEGER, "
+ speedField + " DOUBLE PRECISION, "
+ speedNumberOfContributingPointsField + " INTEGER)";
private final String pgMeasurementRelationsTableCreationString = "CREATE TABLE "
+ measurementRelationsTableName + " ("
+ idField + " INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
+ aggregated_measurement_idField + " VARCHAR(24), "
+ "CONSTRAINT measurement_relations_aggregated_measurement_id_fkey FOREIGN KEY (" + aggregated_measurement_idField + ") "
+ "REFERENCES " + aggregated_MeasurementsTableName + " (" + idField + ") MATCH SIMPLE "
+ "ON UPDATE NO ACTION ON DELETE NO ACTION)";
private final String pgAggregatedTracksTableCreationString = "CREATE TABLE "
+ aggregatedTracksTableName + " ("
+ idField + " VARCHAR(24) NOT NULL PRIMARY KEY, "
+ aggregation_dateField + " timestamp with time zone)";
private String pgNearestNeighborCreationString = "select h." + idField + ", h." + speedField + ", h." + co2Field + ", h." + generalNumberOfContributingPointsField + ", h." + speedNumberOfContributingPointsField + ", h." + co2NumberOfContributingPointsField + ", h." + generalnumberOfContributingTracksField + ", h." + lastContributingTrackField + ", ST_AsText(h.the_geom) as " + geometryPlainTextField + ", ST_distance(" + geomFromText_exp + ",h.the_geom) as " + distField + " from " + aggregated_MeasurementsTableName + " h "
+ "where ST_DWithin(" + geomFromText_exp + ",h." + geometryEncodedField + ","
+ distance_exp + ") " + "order by " + distField + " ASC;";
private final String addGeometryColumnToTableString = "SELECT AddGeometryColumn( '"
+ table_name_exp
+ "', '" + geometryEncodedField + "', " + spatial_ref_sys + ", 'POINT', 2 );";
private final String selectAllAggregatedMeasurementsString = "select h." + idField + ", h." + speedField + ", h." + co2Field + ", h." + generalNumberOfContributingPointsField + ", h." + speedNumberOfContributingPointsField + ", h." + co2NumberOfContributingPointsField + ", h." + generalnumberOfContributingTracksField + ", h." + lastContributingTrackField + ", ST_AsText(h.the_geom) as " + geometryPlainTextField + " from " + aggregated_MeasurementsTableName + " h; ";
private final String deletePointFromTableString = "delete from " + table_name_exp + " where " + idField + "=";
private final String updateAggregatedMeasurementString = "UPDATE " + aggregated_MeasurementsTableName + " SET " + speedField + " = " + speed_value_exp + ", " + speedNumberOfContributingPointsField + " = " + speedNumberOfContributingPoints_value_exp + ", " + co2Field + " = " + co2_value_exp + ", " + co2NumberOfContributingPointsField + " = " + co2NumberOfContributingPoints_value_exp + ", " + generalNumberOfContributingPointsField + " = " + generalNumberOfContributingPoints_value_exp + ", " + generalnumberOfContributingTracksField + " = " + generalnumberOfContributingTracks_value_exp + ", " + lastContributingTrackField + " = '" + lastContributingTrack_value_exp + "', " + geometryEncodedField + " = " + geometryEncoded_value_exp + " WHERE " + idField + " = '" + id_exp + "';";
private Geometry bbox;
public PostgresPointService() {
this(null);
}
public PostgresPointService(Geometry bbox) {
this.bbox = bbox;
try {
createConnection();
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
createTable(pgCreationString, aggregated_MeasurementsTableName, true);
createTable(pgMeasurementRelationsTableCreationString, measurementRelationsTableName, false);
createTable(pgAggregatedTracksTableCreationString, aggregatedTracksTableName, false);
}
@Override
public Point getNearestNeighbor(Point point, double distance) {
String queryString = pgNearestNeighborCreationString.replace(distance_exp, "" + distance).replace(geomFromText_exp, createST_GeometryFromTextStatement(point.getX(), point.getY()));
ResultSet resultSet = executeQueryStatement(queryString);
try {
if (resultSet != null) {
while (resultSet.next()) {
String resultID = Integer.toString(resultSet.getInt(idField));
Map<String, Object> propertyMap = new HashMap<>();
Map<String, Integer> propertyPointsUsedForAggregationMap = new HashMap<>();
for (String propertyName : Properties
.getPropertiesOfInterestDatatypeMapping().keySet()) {
Class<?> propertyClass = Properties
.getPropertiesOfInterestDatatypeMapping().get(
propertyName);
Object value = null;
if (propertyClass.equals(Double.class)) {
value = resultSet.getDouble(propertyName
.toLowerCase());
}
propertyMap.put(propertyName, value);
int pointsUsedForAggregation = resultSet.getInt(propertyName
.toLowerCase() + "numberofcontributingpoints");
propertyPointsUsedForAggregationMap.put(propertyName, pointsUsedForAggregation);
}
String resultLastContributingTrack = resultSet
.getString(lastContributingTrackField);
int resultNumberOfContributingPoints = resultSet
.getInt(generalNumberOfContributingPointsField);
int resultNumberOfContributingTracks = resultSet
.getInt(generalnumberOfContributingTracksField);
String resultGeomAsText = resultSet.getString(geometryPlainTextField);
double[] resultXY = Utils
.convertWKTPointToXY(resultGeomAsText);
Point resultPoint = new InMemoryPoint(resultID,
resultXY[0], resultXY[1], propertyMap,
resultNumberOfContributingPoints,
resultNumberOfContributingTracks,
resultLastContributingTrack, propertyPointsUsedForAggregationMap);
return resultPoint;
}
}
} catch (SQLException e) {
LOGGER.error("Could not query nearest neighbor of " + point.getID(), e);
}
return null;
}
@Override
public boolean updateResultSet(String idOfPointToBeUpdated,
Point newPoint) {
String updateString = updateAggregatedMeasurementString;
updateString = updateString.replace(speed_value_exp, "" + newPoint.getProperty("Speed"));
updateString = updateString.replace(speedNumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation("Speed"));
updateString = updateString.replace(co2_value_exp, "" + newPoint.getProperty("CO2"));
updateString = updateString.replace(co2NumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation("CO2"));
updateString = updateString.replace(generalNumberOfContributingPoints_value_exp, "" + newPoint.getNumberOfPointsUsedForAggregation());
updateString = updateString.replace(generalnumberOfContributingTracks_value_exp, "" + newPoint.getNumberOfTracksUsedForAggregation());
updateString = updateString.replace(lastContributingTrack_value_exp, newPoint.getLastContributingTrack());
updateString = updateString.replace(geometryEncoded_value_exp, createST_GeometryFromTextStatement(newPoint.getX(), newPoint.getY()));
updateString = updateString.replace(id_exp, idOfPointToBeUpdated);
return executeUpdateStatement(updateString);
}
@Override
public List<Point> getResultSet() {
List<Point> result = new ArrayList<>();
ResultSet resultSet = executeQueryStatement(selectAllAggregatedMeasurementsString);
try {
if (resultSet != null) {
while (resultSet.next()) {
Point resultPoint = createPointFromCurrentResultSetEntry(resultSet);
result.add(resultPoint);
}
}
} catch (SQLException e) {
LOGGER.error("Could not query resultset.", e);
}
return result;
}
@Override
public Point aggregate(Point point, Point nearestNeighborPoint, String trackId) {
Point aggregatedPoint = new InMemoryPoint(point);
updateValues(aggregatedPoint, nearestNeighborPoint);
/*
* distance weighting
*/
double averagedX = ((nearestNeighborPoint.getX() * nearestNeighborPoint.getNumberOfPointsUsedForAggregation()) + aggregatedPoint.getX()) / (nearestNeighborPoint.getNumberOfPointsUsedForAggregation() + 1);
double averagedY = ((nearestNeighborPoint.getY() * nearestNeighborPoint.getNumberOfPointsUsedForAggregation()) + aggregatedPoint.getY()) / (nearestNeighborPoint.getNumberOfPointsUsedForAggregation() + 1);
aggregatedPoint.setNumberOfPointsUsedForAggregation(nearestNeighborPoint.getNumberOfPointsUsedForAggregation()+1);
aggregatedPoint.setX(averagedX);
aggregatedPoint.setY(averagedY);
LOGGER.debug(aggregatedPoint.getLastContributingTrack() + " vs. " + nearestNeighborPoint.getLastContributingTrack());
if(!aggregatedPoint.getLastContributingTrack().equals(nearestNeighborPoint.getLastContributingTrack())){
aggregatedPoint.setNumberOfTracksUsedForAggregation(nearestNeighborPoint.getNumberOfTracksUsedForAggregation() +1);
}else{
aggregatedPoint.setNumberOfTracksUsedForAggregation(nearestNeighborPoint.getNumberOfTracksUsedForAggregation());
}
LOGGER.debug("Aggregated: " + aggregatedPoint.getID() + " and " + nearestNeighborPoint.getID());
LOGGER.debug("NumberOfPoints " + aggregatedPoint.getNumberOfPointsUsedForAggregation());
insertMeasurementRelation(point.getID(), Integer.parseInt(nearestNeighborPoint.getID()));
/*
* store result in DB
*/
updateResultSet(nearestNeighborPoint.getID(),
aggregatedPoint);
return aggregatedPoint;
}
@Override
public boolean isFitForAggregation(Point point) {
boolean result = false;
for (String propertyName : Properties.getPropertiesOfInterestDatatypeMapping().keySet()) {
Object numberObject = point.getProperty(propertyName);
if(numberObject instanceof Number){
result = result || !isNumberObjectNullOrZero((Number) numberObject);
}else{
/*
* not a number, we cannot aggregate this currently
*/
result = result || false;
}
}
/*
* also check for bbox
*/
if (bbox != null) {
Coordinate pointCoordinate = new Coordinate(point.getX(), point.getY());
if (!bbox.contains(Utils.geometryFactory
.createPoint(pointCoordinate))) {
return false;
}
}
return result;
}
@Override
public void addToResultSet(Point newPoint) {
int newId;
try {
newId = insertPoint(newPoint);
} catch (SQLException e) {
LOGGER.warn(e.getMessage(), e);
return;
}
insertMeasurementRelation(newPoint.getID(), newId);
}
private String createST_GeometryFromTextStatement(double x, double y){
return "ST_GeomFromText('POINT(" + x
+ " " + y + ")', " + spatial_ref_sys + ")";
}
private boolean insertMeasurementRelation(String originalID, int aggregatedID){
String statement = "INSERT INTO " + measurementRelationsTableName
+ "(" + idField + ", " + aggregated_measurement_idField + ") VALUES ('" + originalID + "', " + aggregatedID + ");";
return executeUpdateStatement(statement);
}
private boolean isNumberObjectNullOrZero(Number numberObject) {
Number sourceValue = (Number) numberObject;
double value = sourceValue.doubleValue();
if (value == 0.0) {
return true;
}
return false;
}
public boolean removePoint(String pointID, String tableName){
return executeUpdateStatement(deletePointFromTableString.replace(table_name_exp, tableName).concat("'" + pointID + "';"));
}
private String getDatabaseName() {
if(databaseName == null || databaseName.equals("")){
this.databaseName = Properties.getProperty("databaseName").toString();
}
return databaseName;
}
private String getDatabasePath() {
if(databasePath == null || databasePath.equals("")){
databasePath = Properties.getProperty("databasePath").toString();
}
return databasePath;
}
private String getDatabaseUsername() {
if(username == null || username.equals("")){
username = Properties.getProperty("username").toString();
}
return username;
}
private String getDatabasePassword() {
if(password == null || password.equals("")){
this.password = Properties.getProperty("password").toString();
}
return password;
}
private void updateValues(Point source, Point closestPointInRange){
for (String propertyName : Properties.getPropertiesOfInterestDatatypeMapping().keySet()) {
double weightedAvg = getWeightedAverage(source, closestPointInRange, propertyName);
LOGGER.debug("Average: " + weightedAvg);
source.setProperty(propertyName, weightedAvg);
}
}
private double getWeightedAverage(Point source, Point closestPointInRange,
String propertyName) {
Object sourceNumberObject = source.getProperty(propertyName);
if (sourceNumberObject instanceof Number) {
Number sourceValue = (Number) sourceNumberObject;
double summedUpValues = sourceValue.doubleValue();
LOGGER.debug("Value of " + propertyName + " of point " + source.getID() + " = " + summedUpValues);
Object pointNumberObject = closestPointInRange.getProperty(propertyName);
if (pointNumberObject instanceof Number) {
double d = ((Number) pointNumberObject).doubleValue();
int numberOfPointsUsedForAggregation = closestPointInRange.getNumberOfPointsUsedForAggregation(propertyName);
/*
* sort out values of 0.0
*/
if(d == 0.0){
LOGGER.debug("Value for aggregation is 0.0, will not use this.");
source.setNumberOfPointsUsedForAggregation(numberOfPointsUsedForAggregation, propertyName);
return summedUpValues;
}
double weightedAvg = ((d * numberOfPointsUsedForAggregation) + summedUpValues) / (numberOfPointsUsedForAggregation + 1);
source.setNumberOfPointsUsedForAggregation(numberOfPointsUsedForAggregation + 1, propertyName);
LOGGER.debug("Value of " + propertyName + " of point " + closestPointInRange.getID() + " = " + d);
return weightedAvg;
}
}
LOGGER.debug("Source property " + propertyName + " is not a number.");
return -1;
}
private Point createPointFromCurrentResultSetEntry(ResultSet resultSet) throws SQLException{
String resultID = resultSet.getString(idField);
Map<String, Object> propertyMap = new HashMap<>();
Map<String, Integer> propertyPointsUsedForAggregationMap = new HashMap<>();
for (String propertyName : Properties
.getPropertiesOfInterestDatatypeMapping().keySet()) {
Class<?> propertyClass = Properties
.getPropertiesOfInterestDatatypeMapping().get(
propertyName);
Object value = null;
if (propertyClass.equals(Double.class)) {
value = resultSet.getDouble(propertyName
.toLowerCase());
}
propertyMap.put(propertyName, value);
try{
int pointsUsedForAggregation = resultSet.getInt(propertyName
.toLowerCase() + "numberofcontributingpoints");
propertyPointsUsedForAggregationMap.put(propertyName, pointsUsedForAggregation);
}catch(Exception e){
LOGGER.info("Column " + propertyName.toLowerCase() + "numberofcontributingpoints" + " not available.");
LOGGER.info(e.getMessage());
}
}
String resultLastContributingTrack = "";
try {
resultLastContributingTrack = resultSet.getString(lastContributingTrackField);
} catch (SQLException e) {
LOGGER.info("Column " + lastContributingTrackField + " not available.");
LOGGER.info(e.getMessage());
}
int resultNumberOfContributingPoints = 1;
try {
resultNumberOfContributingPoints = resultSet.getInt(generalNumberOfContributingPointsField);
} catch (SQLException e) {
LOGGER.info("Column " + generalNumberOfContributingPointsField + " not available. Defaulting to 1.");
LOGGER.info(e.getMessage());
}
int resultNumberOfContributingTracks = 1;
try {
resultNumberOfContributingTracks = resultSet.getInt(generalnumberOfContributingTracksField);
} catch (SQLException e) {
LOGGER.info("Column " + generalnumberOfContributingTracksField + " not available. Defaulting to 1.");
LOGGER.info(e.getMessage());
}
if(resultLastContributingTrack == null || resultLastContributingTrack.isEmpty()){
/*
* point seems to be original point, try accessing trackid column
*/
try {
resultLastContributingTrack = resultSet.getString(trackIDField);
} catch (SQLException e) {
LOGGER.info("Column " + trackIDField + " not available.");
LOGGER.info(e.getMessage());
}
}
double[] resultXY = new double[2];
try {
String resultGeomAsText = resultSet.getString(geometryPlainTextField);
resultXY = Utils.convertWKTPointToXY(resultGeomAsText);
} catch (SQLException e) {
LOGGER.info("Column " + geometryPlainTextField + " not available.");
LOGGER.error(e.getMessage());
}
Point resultPoint = new InMemoryPoint(resultID, resultXY[0], resultXY[1], propertyMap, resultNumberOfContributingPoints, resultNumberOfContributingTracks, resultLastContributingTrack, propertyPointsUsedForAggregationMap);
return resultPoint;
}
private boolean createConnection() throws ClassNotFoundException {
Class.forName("org.postgresql.Driver");
connectionURL = "jdbc:postgresql:" + getDatabasePath() + "/"
+ getDatabaseName();
java.util.Properties props = new java.util.Properties();
props.setProperty("create", "true");
props.setProperty("user", getDatabaseUsername());
props.setProperty("password", getDatabasePassword());
conn = null;
try {
conn = DriverManager.getConnection(connectionURL, props);
conn.setAutoCommit(false);
LOGGER.info("Connected to measurement database.");
} catch (SQLException e) {
LOGGER.error("Could not connect to or create the database.", e);
return false;
}
return true;
}
private boolean createTable(String creationString, String tableName, boolean addToGeometryColumnTable) {
try {
ResultSet rs;
DatabaseMetaData meta = conn.getMetaData();
rs = meta
.getTables(null, null, tableName, new String[] { "TABLE" });
if (!rs.next()) {
LOGGER.info("Table " + tableName + " does not yet exist.");
Statement st = conn.createStatement();
st.executeUpdate(creationString);
conn.commit();
meta = conn.getMetaData();
rs = meta.getTables(null, null, tableName,
new String[] { "TABLE" });
if (rs.next()) {
LOGGER.info("Succesfully created table " + tableName + ".");
/*
* add geometry column
*/
if(addToGeometryColumnTable){
executeStatement(addGeometryColumnToTableString.replace(table_name_exp, tableName));
}
} else {
LOGGER.error("Could not create table " + tableName + ".");
return false;
}
}
} catch (SQLException e) {
LOGGER.error("Connection to the Postgres database failed: "
+ e.getMessage());
return false;
}
return true;
}
private boolean executeStatement(String statement) {
Statement st = null;
try {
st = conn.createStatement();
st.execute(statement);
} catch (SQLException e) {
LOGGER.error("Execution of the following statement failed: "
+ statement + " cause: " + e.getMessage());
return false;
} finally {
try {
conn.commit();
} catch (SQLException e) {
LOGGER.warn(e.getMessage(), e);
}
}
return true;
}
private ResultSet executeQueryStatement(String statement) {
Statement st = null;
try {
st = conn.createStatement();
ResultSet resultSet = st.executeQuery(statement);
return resultSet;
} catch (SQLException e) {
LOGGER.error("Execution of the following statement failed: "
+ statement + " cause: " + e.getMessage());
return null;
} finally {
try {
conn.commit();
} catch (SQLException e) {
LOGGER.warn(e.getMessage(), e);
}
}
}
private boolean executeUpdateStatement(String statement) {
Statement st = null;
try {
st = conn.createStatement();
st.executeUpdate(statement);
} catch (SQLException e) {
LOGGER.error("Execution of the following statement failed: "
+ statement + " cause: " + e.getMessage());
return false;
} finally {
try {
conn.commit();
st.close();
} catch (SQLException e) {
LOGGER.warn(e.getMessage(), e);
}
}
return true;
}
private int insertPoint(Point point) throws SQLException {
PreparedStatement statement = createInsertPointStatement(point);
int affectedRows = statement.executeUpdate();
if (affectedRows == 0) {
throw new SQLException("Creating user failed, no rows affected.");
}
try (ResultSet generatedKeys = statement.getGeneratedKeys()) {
if (generatedKeys.next()) {
return generatedKeys.getInt(1);
}
else {
throw new SQLException("Creating user failed, no ID obtained.");
}
}
}
private PreparedStatement createInsertPointStatement(Point point) throws SQLException {
String columnNameString = "( "+
geometryEncodedField +", "+
generalNumberOfContributingPointsField +", "+
generalnumberOfContributingTracksField +", "+
lastContributingTrackField +", ";
Iterator<String> propertyNameIterator = Properties
.getPropertiesOfInterestDatatypeMapping().keySet().iterator();
List<Object> values = new ArrayList<>();
// String valueString = "( ST_GeomFromText('POINT(" + point.getX() + " " + point.getY() + ")', " + spatial_ref_sys + "), " +
// point.getNumberOfPointsUsedForAggregation() + ", " +
// point.getNumberOfTracksUsedForAggregation() + ", '" +
// point.getLastContributingTrack() + "', ";
values.add("ST_GeomFromText('POINT(" + point.getX() + " " + point.getY() + ")', " + spatial_ref_sys + ")");
values.add(new Integer(point.getNumberOfPointsUsedForAggregation()));
values.add(new Integer(point.getNumberOfTracksUsedForAggregation()));
values.add(point.getLastContributingTrack());
while (propertyNameIterator.hasNext()) {
String propertyName = (String) propertyNameIterator.next();
columnNameString = columnNameString.concat(propertyName
.toLowerCase());
columnNameString = columnNameString.concat(", ");
columnNameString = columnNameString.concat(propertyName
.toLowerCase() + "numberofcontributingpoints");
Object o = point.getProperty(propertyName);
values.add(o == null? null : Double.parseDouble(o.toString()));
int v = point.getNumberOfPointsUsedForAggregation(propertyName);
values.add(new Integer(v));
if (propertyNameIterator.hasNext()) {
columnNameString = columnNameString.concat(", ");
} else {
columnNameString = columnNameString.concat(")");
}
}
StringBuilder sb = new StringBuilder();
sb.append("(");
for (int i = 0; i < values.size(); i++) {
sb.append("?,");
}
sb.delete(sb.length()-1, sb.length());
sb.append(")");
String statement = "INSERT INTO " + aggregated_MeasurementsTableName
+ columnNameString + "VALUES" + sb.toString() + ";";
PreparedStatement result = conn.prepareStatement(statement, PreparedStatement.RETURN_GENERATED_KEYS);
int index = 0;
for (Object object : values) {
if (object instanceof String) {
result.setString(index++, object.toString());
}
else if (object instanceof Integer) {
result.setInt(index++, (int) object);
}
else if (object instanceof Double) {
result.setDouble(index++, (double) object);
}
}
return result;
}
public boolean insertTrackIntoAggregatedTracksTable(String trackID) {
if (trackAlreadyAggregated(trackID)) {
return false;
}
String statement = "INSERT INTO " + aggregatedTracksTableName + "("
+ idField + ", " + aggregation_dateField + ") VALUES ('"
+ trackID + "', '" + iso8601DateFormat.format(new Date())
+ "');";
return executeUpdateStatement(statement);
}
@Override
public boolean trackAlreadyAggregated(String trackID) {
String alreadyThere = "SELECT * FROM "+ aggregatedTracksTableName
+" WHERE " + idField +" = '"+trackID+"'";
ResultSet rs = executeQueryStatement(alreadyThere);
try {
if (rs.next()) {
return true;
}
} catch (SQLException e) {
LOGGER.warn(e.getMessage(), e);
}
return false;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
6ae316c59d3fa1334a317dbbcc208eb65f67ab72 | b85f16dadef1e4118a86b074d11f4508792239c2 | /src/test/java/com/redhat/cajun/navy/responder/message/serialization/QuotedStringDeserializerTest.java | d8d28dfbd5289e5b39dacbe7da22d40b62627305 | [] | no_license | cgruver-erdemo/responder-service | e8a6e1b6b49950b921b97991e26f7729cd10f9dd | e00d929fcf31810b2973e2cf074341126bab6b4b | refs/heads/master | 2022-12-07T12:15:41.143663 | 2020-07-28T12:14:30 | 2020-07-28T12:14:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,858 | java | package com.redhat.cajun.navy.responder.message.serialization;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.Test;
public class QuotedStringDeserializerTest {
@Test
public void testUnquoted() {
String json = "{\"messageType\":\"IncidentReportedEvent\"," +
"\"id\":\"messageId\"," +
"\"invokingService\":\"messageSender\"," +
"\"timestamp\":1521148332397," +
"\"body\": {\"id\":\"incident123\"," +
"\"lat\": \"34.14338\"," +
"\"lon\": \"-77.86569\"," +
"\"numberOfPeople\": 3," +
"\"medicalNeeded\": true," +
"\"timestamp\": 1521148332350" +
"}}";
QuotedStringDeserializer deserializer = new QuotedStringDeserializer();
byte[] data = json.getBytes();
String deserialized = deserializer.deserialize("test", data);
MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(json));
}
@Test
public void testQuoted() {
String json = "\"{\\\"messageType\\\":\\\"IncidentReportedEvent\\\"," +
"\\\"id\\\":\\\"messageId\\\"," +
"\\\"invokingService\\\":\\\"messageSender\\\"," +
"\\\"timestamp\\\":1521148332397," +
"\\\"body\\\": {\\\"id\":\\\"incident123\\\"," +
"\\\"lat\\\": \\\"34.14338\\\"," +
"\\\"lon\\\": \\\"-77.86569\\\"," +
"\\\"numberOfPeople\\\": 3," +
"\\\"medicalNeeded\\\": true," +
"\\\"timestamp\\\": 1521148332350" +
"}}\"";
String expected = "{\"messageType\":\"IncidentReportedEvent\"," +
"\"id\":\"messageId\"," +
"\"invokingService\":\"messageSender\"," +
"\"timestamp\":1521148332397," +
"\"body\": {\"id\":\"incident123\"," +
"\"lat\": \"34.14338\"," +
"\"lon\": \"-77.86569\"," +
"\"numberOfPeople\": 3," +
"\"medicalNeeded\": true," +
"\"timestamp\": 1521148332350" +
"}}";
QuotedStringDeserializer deserializer = new QuotedStringDeserializer();
byte[] data = json.getBytes();
String deserialized = deserializer.deserialize("test", data);
MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(expected));
}
@Test
public void testQuotedUnEscaped() {
String json = "\"{\"messageType\":\"IncidentReportedEvent\"," +
"\"id\":\"messageId\"," +
"\"invokingService\":\"messageSender\"," +
"\"timestamp\":1521148332397," +
"\"body\": {\"id\":\"incident123\"," +
"\"lat\": \"34.14338\"," +
"\"lon\": \"-77.86569\"," +
"\"numberOfPeople\": 3," +
"\"medicalNeeded\": true," +
"\"timestamp\": 1521148332350" +
"}}\"";
String expected = "{\"messageType\":\"IncidentReportedEvent\"," +
"\"id\":\"messageId\"," +
"\"invokingService\":\"messageSender\"," +
"\"timestamp\":1521148332397," +
"\"body\": {\"id\":\"incident123\"," +
"\"lat\": \"34.14338\"," +
"\"lon\": \"-77.86569\"," +
"\"numberOfPeople\": 3," +
"\"medicalNeeded\": true," +
"\"timestamp\": 1521148332350" +
"}}";
QuotedStringDeserializer deserializer = new QuotedStringDeserializer();
byte[] data = json.getBytes();
String deserialized = deserializer.deserialize("test", data);
MatcherAssert.assertThat(deserialized, CoreMatchers.equalTo(expected));
}
}
| [
"bernard.tison@gmail.com"
] | bernard.tison@gmail.com |
fe870f122a50e57bbc7b6e147efebbd2d4b71289 | b894e7feec5ef4711e9d5f00bffc3effc1294143 | /src/by/it/gerasimov/calc/ReportBuilder.java | 5c4a79bbdf658ac83ba602ca65da2e124a81a085 | [] | no_license | Vladislav7776/JD2020-01-20 | 877e311bfa2be42152424f5f4963deb1b718e7e3 | 2f977ee26b79a97fa37bd1053756c91f344c5757 | refs/heads/master | 2020-12-22T21:37:24.187529 | 2020-03-12T20:22:51 | 2020-03-12T20:22:51 | 236,938,743 | 6 | 0 | null | 2020-01-29T08:46:59 | 2020-01-29T08:46:58 | null | UTF-8 | Java | false | false | 1,685 | java | package by.it.gerasimov.calc;
import by.it.gerasimov.calc.translate.Globalization;
import by.it.gerasimov.calc.translate.Messages;
import by.it.gerasimov.calc.translate.ResMan;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Deque;
import java.util.LinkedList;
abstract class ReportBuilder {
Deque<String> logs = new LinkedList<>();
StringBuilder report = new StringBuilder();
abstract void addHeader();
void addRunningTime() {
report.append(Globalization.getCurrentDate()).append('\n');
}
abstract void addLines();
void print() {
System.out.println(report.toString());
}
void readLog() {
try (BufferedReader br = new BufferedReader(new FileReader(Settings.pathToLog))) {
String line;
while ((line = br.readLine()) != null) {
logs.addLast(line);
}
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
class ShortReportBuilder extends ReportBuilder {
@Override
void addHeader() {
report.append("Short report:\n");
}
@Override
void addLines() {
readLog();
for (String log : logs) {
if (log.contains(ResMan.INSTANCE.get(Messages.ERROR))) {
report.append(log).append('\n');
}
}
}
}
class FullReportBuilder extends ReportBuilder {
@Override
void addHeader() {
report.append("Full report:\n");
}
@Override
void addLines() {
readLog();
for (String log : logs) {
report.append(log).append('\n');
}
}
} | [
"herasimau.jahor@gmail.com"
] | herasimau.jahor@gmail.com |
d5ca8690bfe3c21ffe8e9a1dfb016fca3c7a1e33 | e24c6c940689c19fdcc2e39dd80a5061e0b0b326 | /org.eclipse.emf.refactor.refactorings.uml24.henshin/src/org/eclipse/emf/refactor/refactorings/uml24/renameattribute/RefactoringGuiHandler.java | 3fd3db2c37c1c2486081a4d1f45e16844cab399f | [] | no_license | ambrusthomas/MeDeR.refactor.examples | 63cf443045be9907d237d543db3df93e93175752 | 66a35d6f9b2924f7c1172c0fff857badd0e41b8e | refs/heads/master | 2021-01-22T19:09:18.404936 | 2017-03-29T16:24:23 | 2017-03-29T16:24:23 | 85,169,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,051 | java | /**
* <copyright>
* </copyright>
*
* $Id: RefactoringGuiHandlerHenshin.javajet,v 1.2 2012/11/26 15:39:38 tarendt Exp $
*/
package org.eclipse.emf.refactor.refactorings.uml24.renameattribute;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.refactor.refactoring.core.Refactoring;
import org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
/**
* Class used for specifying gui topics of a specific model refactoring.
* @generated
*/
public class RefactoringGuiHandler implements IGuiHandler {
/**
* Refactoring supported by the GuiHandler.
* @generated
*/
private Refactoring parent;
/**
* @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#getParent()
* @generated
*/
@Override
public Refactoring getParent() {
return parent;
}
/**
* @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#
* setParent(org.eclipse.emf.refactor.refactoring.core.Refactoring)
* @generated
*/
@Override
public void setParent(Refactoring refactoring) {
this.parent = refactoring;
}
/**
* @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#show()
* @generated
*/
@Override
public RefactoringWizard show() {
return new org.eclipse.emf.refactor.refactorings.uml24.renameattribute.RefactoringWizard
((RefactoringController) this.parent.getController());
}
/**
* @see org.eclipse.emf.refactor.refactoring.interfaces.IGuiHandler#
* showInMenu(java.util.List)
* @generated
*/
@Override
public boolean showInMenu(List<EObject> selection) {
if (selection.size() > 2) return false;
EObject o = selection.get(0);
if(null != o){
if (o instanceof org.eclipse.uml2.uml.Property) {
if (selection.size() == 2) {
EObject eo = selection.get(1);
if (eo.eClass().getName().equals("Diagram")) return true;
} else {
return true;
}
}
}
return false;
}
}
| [
"tarendt"
] | tarendt |
2aaf64dc80b2564edf056cd7ae46cda0b287e2b4 | 88bf23ad030017eb6645d76a7179260436bac431 | /src/main/java/com/znjt/dao/impl/PCITransferDao.java | 8d6395563ecf6bb963dc93d8d7aa51775282b395 | [] | no_license | qiury/deliverc | 4a939163bc935c3435a6c8d14055a3858f4b1ef5 | 0247e9480a54341bc013c0102caeb4cbcd3ef0ad | refs/heads/master | 2022-07-16T03:16:36.453444 | 2019-07-12T02:52:40 | 2019-07-12T02:52:40 | 177,367,127 | 0 | 0 | null | 2022-06-21T01:00:37 | 2019-03-24T03:39:28 | Java | UTF-8 | Java | false | false | 2,455 | java | package com.znjt.dao.impl;
import com.znjt.dao.beans.PCITransferIniBean;
import com.znjt.dao.mapper.PCITransferBeanMapper;
import com.znjt.datasource.enhance.EnhanceDbUtils;
import com.znjt.datasource.enhance.EnhanceMapperFactory;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import java.util.List;
/**
* Created by qiuzx on 2019-04-18
* Company BTT
* Depart Tech
*/
public class PCITransferDao {
public List<PCITransferIniBean> findUnUpLoadPCIRecordDatas(String dbname, int pageSize) {
List<PCITransferIniBean> recordDatas = null;
try {
SqlSession sqlSession = EnhanceMapperFactory.getMultiSqlSession(dbname, true);
PCITransferBeanMapper mapper = EnhanceMapperFactory.createMapper(PCITransferBeanMapper.class, sqlSession);
recordDatas = mapper.findUnUpLoadPCIRecordDatas(pageSize);
} catch (Exception e) {
e.printStackTrace();
new RuntimeException("查询未上传的PCI记录出现异常",e);
} finally {
EnhanceDbUtils.closeSession();
}
return recordDatas;
}
public void updateCurrentUpLoadedSuccessPCIRescords(String dbname,List<PCITransferIniBean> pciTransferIniBeans) {
try {
SqlSession sqlSession = EnhanceMapperFactory.getMultiSqlSession(dbname, false);
PCITransferBeanMapper mapper = EnhanceMapperFactory.createMapper(PCITransferBeanMapper.class, sqlSession);
mapper.updateCurrentUpLoadedSuccessPCIRescords(pciTransferIniBeans);
sqlSession.commit();
} catch (Exception e) {
new RuntimeException("更新已经上传的PCI记录状态出现异常",e);
} finally {
EnhanceDbUtils.closeSession();
}
}
public void upLoadPCIRecordDatas2UpStream(String dbname,List<PCITransferIniBean> pciTransferIniBeans) {
try {
SqlSession sqlSession = EnhanceMapperFactory.getMultiSqlSession(dbname, false, ExecutorType.BATCH);
PCITransferBeanMapper mapper = EnhanceMapperFactory.createMapper(PCITransferBeanMapper.class, sqlSession);
mapper.upLoadPICRecordDatas2UpStream(pciTransferIniBeans);
sqlSession.commit();
} catch (Exception e) {
new RuntimeException("更新已经上传的IRI状态出现异常",e);
} finally {
EnhanceDbUtils.closeSession();
}
}
}
| [
"qiury_zhenxin@126.com"
] | qiury_zhenxin@126.com |
4d8654c9106181a40726adc0750e1c1e9d1c08a6 | 08192e0e593398f42abaf5dc8f51d7726d830839 | /cqzqjg-services/src/main/java/cn/roilat/cqzqjg/services/system/sevice/impl/SysMenuServiceImpl.java | f2dcc01576988da0cd509b58ca0e00e2077f08d7 | [] | no_license | roilat/zqjg | 10ffb767ab8af298ca0fc08f2daac79c52aad31d | a4630b9b11fe533400a2d9eee0ed91f61604479a | refs/heads/master | 2022-06-29T18:55:50.084405 | 2020-02-29T08:49:54 | 2020-02-29T08:49:54 | 229,590,120 | 0 | 1 | null | 2022-06-17T02:49:35 | 2019-12-22T15:36:55 | Java | UTF-8 | Java | false | false | 3,229 | java | package cn.roilat.cqzqjg.services.system.sevice.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.roilat.cqzqjg.services.system.constants.SysConstants;
import cn.roilat.cqzqjg.services.system.dao.SysMenuMapper;
import cn.roilat.cqzqjg.services.system.model.SysMenu;
import cn.roilat.cqzqjg.services.system.sevice.SysMenuService;
import cn.roilat.cqzqjg.core.page.MybatisPageHelper;
import cn.roilat.cqzqjg.core.page.PageRequest;
import cn.roilat.cqzqjg.core.page.PageResult;
@Service
public class SysMenuServiceImpl implements SysMenuService {
@Autowired
private SysMenuMapper sysMenuMapper;
@Override
public int save(SysMenu record) {
if(record.getId() == null || record.getId() == 0) {
return sysMenuMapper.insertSelective(record);
}
if(record.getParentId() == null) {
record.setParentId(0L);
}
return sysMenuMapper.updateByPrimaryKeySelective(record);
}
@Override
public int delete(SysMenu record) {
return sysMenuMapper.deleteByPrimaryKey(record.getId());
}
@Override
public int delete(List<SysMenu> records) {
for(SysMenu record:records) {
delete(record);
}
return 1;
}
@Override
public SysMenu findById(Long id) {
return sysMenuMapper.selectByPrimaryKey(id);
}
@Override
public PageResult findPage(PageRequest pageRequest) {
return MybatisPageHelper.findPage(pageRequest, sysMenuMapper);
}
@Override
public List<SysMenu> findTree(String userName, int menuType) {
List<SysMenu> sysMenus = new ArrayList<>();
List<SysMenu> menus = findByUser(userName);
for (SysMenu menu : menus) {
if (menu.getParentId() == null || menu.getParentId() == 0) {
menu.setLevel(0);
if(!exists(sysMenus, menu)) {
sysMenus.add(menu);
}
}
}
sysMenus.sort((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()));
findChildren(sysMenus, menus, menuType);
return sysMenus;
}
@Override
public List<SysMenu> findByUser(String userName) {
if(userName == null || "".equals(userName) || SysConstants.ADMIN.equalsIgnoreCase(userName)) {
return sysMenuMapper.findAll();
}
return sysMenuMapper.findByUserName(userName);
}
private void findChildren(List<SysMenu> SysMenus, List<SysMenu> menus, int menuType) {
for (SysMenu SysMenu : SysMenus) {
List<SysMenu> children = new ArrayList<>();
for (SysMenu menu : menus) {
if(menuType == 1 && menu.getType() == 2) {
// 如果是获取类型不需要按钮,且菜单类型是按钮的,直接过滤掉
continue ;
}
if (SysMenu.getId() != null && SysMenu.getId().equals(menu.getParentId())) {
menu.setParentName(SysMenu.getName());
menu.setLevel(SysMenu.getLevel() + 1);
if(!exists(children, menu)) {
children.add(menu);
}
}
}
SysMenu.setChildren(children);
children.sort((o1, o2) -> o1.getOrderNum().compareTo(o2.getOrderNum()));
findChildren(children, menus, menuType);
}
}
private boolean exists(List<SysMenu> sysMenus, SysMenu sysMenu) {
boolean exist = false;
for(SysMenu menu:sysMenus) {
if(menu.getId().equals(sysMenu.getId())) {
exist = true;
}
}
return exist;
}
}
| [
"123456"
] | 123456 |
b9def918bb2a97ae36488afa0f33b9a11cfe2e93 | 1e5e092e50d88dfa47e2468dd146ac512ad1843a | /netbeans/curso-java-basico/src/com/loiane/cursojava/aula13/OperadoresAritmeticos.java | 79cecadb500b768e3da32706f63b04babffeef04 | [] | no_license | loiane/curso-java-basico | fa2f3223697db4404973e644570810c0143217bc | 6154c70c46f450358d3480cd85c70a5488e49de7 | refs/heads/master | 2023-08-15T07:58:24.717700 | 2022-11-23T21:11:12 | 2022-11-23T21:11:12 | 12,656,659 | 998 | 855 | null | 2022-11-23T21:11:49 | 2013-09-06T23:20:19 | Java | UTF-8 | Java | false | false | 1,190 | java | package com.loiane.cursojava.aula13;
public class OperadoresAritmeticos {
public static void main(String[] args) {
int resultado = 1 + 2;
System.out.println(resultado);
resultado = resultado - 1;
System.out.println(resultado);
resultado = resultado * 2;
System.out.println(resultado);
resultado = resultado / 2;
System.out.println(resultado);
resultado = resultado + 8;
System.out.println(resultado);
resultado = resultado % 7;
System.out.println(resultado);
String primeiroNome = "Esta é";
String segundoNome = " uma String concatenada.";
String terceiroNome = primeiroNome + segundoNome;
System.out.println(terceiroNome);
resultado = resultado + 1;
System.out.println(resultado);
resultado++;
System.out.println(resultado);
//5
System.out.println(resultado++);
//mesma coisa que
//System.out.println(resultado);
//resultado = resultado + 1;
//resultado += 1;
System.out.println(++resultado);
//mesma coisa que
//resultado += 1;
//System.out.println(resultado);
resultado--;
System.out.println(resultado);
System.out.println(resultado--);
System.out.println(--resultado);
}
}
| [
"me@loiane.com"
] | me@loiane.com |
7fce591c53b848be4f22c402f3299acec4c18c4a | b069c68ba6827618a98babc719d29a4ecbe78164 | /client/LibraryClient/src/com/libraryclient/connection/requests/BookInfo.java | d41456336ca1876daa4403dbfec1950c006aac2c | [] | no_license | minthanthtoo/bookaholic | 59993315c42548770e6e0bfd8ffe51e74cb506cd | 65e0981005612852998aa95949b604b8dc6eeb13 | refs/heads/master | 2021-01-10T21:36:10.823094 | 2013-08-24T17:11:52 | 2013-08-24T17:11:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.libraryclient.connection.requests;
import com.libraryclient.connection.Request;
public class BookInfo extends Request {
public BookInfo(String requestData) {
this(Requests.BookInfo.REQUEST_CODE, requestData);
}
private BookInfo(int requestCode, String requestData) {
super(requestCode, requestData);
}
@Override
public String getTargetResponseTag() {
return Requests.BookInfo.RESPONSE_TAG;
}
} | [
"minthanthtoo1994@gmail.com"
] | minthanthtoo1994@gmail.com |
bd43fef75eaa09f9573b9fb966880b4ff7cac3d2 | 4e647c158096ca953086856f6d0fc4346566503c | /module/lang/src/main/java/net/fluance/commons/lang/FluancePrintingMap.java | 2255c5acd9414893a85a618e36776e8265024af6 | [] | no_license | Fluance/fec-mw-common-libraries | c192b33875e2b930d7c04c324236db93dcaf6644 | 4d3b4b9244f2c7182ac051eb58c271f8d274b60a | refs/heads/master | 2022-11-18T21:23:26.302125 | 2021-03-17T15:14:08 | 2021-03-17T15:14:08 | 245,970,279 | 0 | 0 | null | 2022-11-16T09:29:16 | 2020-03-09T07:30:51 | Java | UTF-8 | Java | false | false | 1,142 | java | package net.fluance.commons.lang;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public class FluancePrintingMap<K, V> {
private Map<K, V> map;
public FluancePrintingMap(Map<K, V> map) {
this.map = map;
}
/**
* Returns a string representation of the Map
*/
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
Iterator<Entry<K, V>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<K, V> entry = iterator.next();
stringBuilder.append(entry.getKey());
stringBuilder.append('=');
if(entry.getValue() instanceof String[]){
String[] values = (String[]) entry.getValue();
stringBuilder.append("[");
for(int i=0; i<values.length; i++){
stringBuilder.append(values[i]);
if (i<values.length-1){
stringBuilder.append(',');
}
}
stringBuilder.append("]");
} else {
stringBuilder.append(entry.getValue());
}
if (iterator.hasNext()) {
stringBuilder.append(',').append(' ');
}
}
return stringBuilder.toString();
}
public Map<K, V> getMap(){
return this.map;
}
} | [
"zroncevic@flunace.ch"
] | zroncevic@flunace.ch |
49713199a3af8f104712e0209ace4bfac377935d | b405a6f7a3358c9008f7a7b30046201647de988d | /Technical/Code/business-card/src/test/java/com/edexer/service/UserServiceManagerImplTest.java | ac100bbe2ab1177b5b7300d69a79efecd13444d8 | [] | no_license | edexcompany/edexer | 1b9fb02ec4839406ff7c9f448986785b0a873ab7 | 74621fd172d52948c1878a2c299e941f2bfea0e8 | refs/heads/master | 2016-09-06T13:12:31.104932 | 2015-06-04T22:25:00 | 2015-06-04T22:25:00 | 35,110,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,743 | java | package com.edexer.service;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.TestCase;
import org.hibernate.Hibernate;
import org.hibernate.Query;
import org.hibernate.Session;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.primefaces.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.edexer.dao.RoleEntityDaoImpl;
import com.edexer.model.BusinessCard;
import com.edexer.model.Role;
import com.edexer.model.User;
//TODO: add junit 4 dependency in pom.xml
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/testapplicationContext.xml")
public class UserServiceManagerImplTest extends TestCase {
@Autowired
UserServiceManager userService;
@Autowired
RoleEntityDaoImpl roleDao;
@Autowired
BusinessCardServiceManager bcService;
@Test
public void test(){
List<BusinessCard> bcList = new ArrayList<BusinessCard>();
BusinessCard bc = bcService.get(50, true);
bcList.add(bcService.get(50, true));
bcList.add(bcService.get(51, true));
JSONObject a = new JSONObject(bcList);
System.out.println(a);
}
/*
* @Autowired BusinessCardServiceManager bcService;
*
* @Autowired TagsServiceManager tagsService;
*
* @Autowired UserSubscriptionServiceManager subService;
*/
/*
* //@Test public void testInsertSubscription(){ BusinessCard bc = new
* BusinessCard(); Set<Tags> s = new HashSet(); User u =
* null;//userService.getUserById(18);
*
*
*
* UserSubscription uSub = new UserSubscription();
* //uSub.setUserByUserId(u); // uSub.setUserId(18);
*
* ActAs actAs = new ActAs(); actAs.setActAsId(1); uSub.setActAs(actAs);
* uSub.setUserByLastEditBy(u);
*
* Subscription sub = new Subscription(); sub.setSubscriptionId(1);
* uSub.setSubscription(sub);
*
* SubscriptionStatus subStatus = new SubscriptionStatus();
* subStatus.setSubStatusId(1);
*
* uSub.setSubscriptionStatus(subStatus);
*
* Tags t = new Tags(); t.setTagName("My tag");
*
* //t.setUserSubscription(uSub); s.add(t); uSub.setTagses(s);
*
* // uSub.set subService.insertUserSubscription(uSub);
*
* } /* //@Test public void testInsertBusinessCard(){ BusinessCard bc = new
* BusinessCard(); Set<Tags> s = new HashSet(); Tags t = new Tags();
* t.setTagName("My tag"); UserSubscription sub =
* subService.getUserSubscriptionsByUserId(18).get(0);
* t.setUserSubscription(sub); tagsService.addTag(t); // s.add(t);
* bc.setBcFirstName("Karim3"); bc.setBcLastName("Karim"); bc.setTagses(s);
* Integer x = bcService.addBusinessCard(bc); // System.out.println(x); }
*
* //@Test public void testInsertUser() { // fail("Not yet implemented");
* User u = new User(); u.setFirstName("Karim2"); u.setLastName("Karim2");
* u.setMobile("01256598"); u.setUserEmail("k@tawfik.com");
* u.setPassword("karim2"); int result = userService.insertUser(u);
* UserSubscription userSub = new UserSubscription();
*
* UserSubscriptionId usid = new UserSubscriptionId(); usid.setSubType(1);
* usid.setUserId(result);
*
* userSub.setId(usid);
*
* Date curDate = new Date(); //userSub.setUserByUserId(u);
* userSub.setLastEditDate(new Date()); userSub.setStartDate(curDate);
* userSub.setUserByLastEditBy(u);
*
* SubscriptionStatus subStatus = new SubscriptionStatus();
* subStatus.setSubStatusId(1); userSub.setSubscriptionStatus(subStatus);
*
* ActAs actas = new ActAs(); actas.setActAsId(1); userSub.setActAs(actas);
*
* subService.insertUserSubscription(userSub); }
*
* // public void testGetUserById() { //// fail("Not yet implemented"); // }
* // // public void testGetUser() { //// fail("Not yet implemented"); // }
* // // public void testGetUsers() { //// fail("Not yet implemented"); // }
* //@Test public void test(){
*
* }
*/
// @Test
/*
* public void changeStaffPass() { boolean result=false; try{ User user=new
* User(); user=userService.getUserById(1);
* result=userService.changeStaffPassword(user, "12345", user, "1781992");
* if(result) { System.out.println("Updated Succesfully");
*
* } else{ System.out.println("didn't work"); }
*
* } catch(Exception e){e.printStackTrace();}
*
* }
*/
/*
* @Test public void UpdateUser() { try{ User user=new User();
* user=userService.getUserById(1); user.setFirstName("Mohamed");
* userService.update(user); System.out.println("Updated Succesfully"); }
* catch(Exception e){e.printStackTrace();System.out.println("Error");} }
*/
/*
* @Test public void DeleteUser() { try{ User user=new User();
* user=userService.getUserById(2);
*
* userService.delete(user); System.out.println("Deleted Succesfully"); }
* catch(Exception e){e.printStackTrace();System.out.println("Error");} }
*/
//@Test
public void InsertUser() {
try {
User user = new User();
user.setUserEmail("Medo@gmail.com");
user.setFirstName("MEDO");
user.setLastName("Rady");
user.setPassword("09876");
user.setPhone("01873298");
Role role = new Role();
// RoleEntityDaoImpl dao=new RoleEntityDaoImpl();
role = roleDao.get(Role.class, 1);
user.setRole(role);
userService.insertUser(user);
System.out.println("Inserted Succesfully");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error");
}
}
@Test
public void getColleagues() {
User user = userService.getUserById(59);
System.out.println("AA");
List<User> list = userService.getCorporateUsers(user);
System.out.println(list.size());
}
}
| [
"y.radwan@edex.co"
] | y.radwan@edex.co |
9f9d8b962a59858c66beaa75e3754a74382e88d9 | d5e36650e5c9dbd43e356dd3a52f410068389b4c | /src/main/java/org/cyberpwn/factionsplus/FA.java | 33ced29b02f8650607a402a770c521c55006eb22 | [] | no_license | cyberpwnn/FactionsPlus | 29cf680796a8a41267e2c1685b98525b3f08c13c | 92ec4c974f5834227c523bda2ac7d5bb5dde684f | refs/heads/master | 2021-01-19T10:54:54.979693 | 2016-11-23T09:15:36 | 2016-11-23T09:15:36 | 70,333,398 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,670 | java | package org.cyberpwn.factionsplus;
import java.util.HashSet;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.phantomapi.lang.GList;
import org.phantomapi.world.W;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Role;
public class FA
{
public static boolean isClaimed(Faction f)
{
return !f.isWilderness() && !f.isSafeZone() && !f.isWarZone();
}
public static boolean isWild(Faction f)
{
return f.isWilderness();
}
public static boolean isClaimed(Location l)
{
return isClaimed(getFaction(l));
}
public static boolean isClaimed(Chunk c)
{
return isClaimed(getFaction(c));
}
public static Faction getFaction(Player p)
{
return getFPlayer(p).getFaction();
}
public static FPlayer getFPlayer(Player p)
{
return FPlayers.getInstance().getByPlayer(p);
}
public static Faction getFaction(Location l)
{
return Board.getInstance().getFactionAt(new FLocation(l));
}
public static Faction getFaction(Chunk c)
{
return getFaction(c.getBlock(0, 0, 0).getLocation());
}
public static Chunk getChunk(FLocation fchunk)
{
return fchunk.getWorld().getChunkAt((int) fchunk.getX(), (int) fchunk.getZ());
}
public static FLocation getFLocation(Chunk c)
{
return new FLocation(c.getWorld().getName(), c.getX(), c.getZ());
}
public static GList<Chunk> getClaims(Player p)
{
return getClaims(getFaction(p));
}
public static boolean isOwnFaction(Player p, Chunk c)
{
return isClaimed(c) && getFaction(c).equals(getFaction(p));
}
public static boolean isOwner(Player p, Faction f)
{
return f.getFPlayerAdmin().getName().equals(p.getName());
}
public static boolean isOwner(Player p)
{
return isOwner(p, getFaction(p));
}
public static boolean isModerator(Player p)
{
return getFPlayer(p).getRole().equals(Role.MODERATOR);
}
public static boolean isAdmin(Player p)
{
return getFPlayer(p).getRole().equals(Role.ADMIN);
}
public static boolean isStaffed(Player p)
{
return isAdmin(p) || isModerator(p);
}
public static boolean isWithFaction(Player p, Faction f)
{
return getPlayers(f).contains(p);
}
public static GList<Chunk> getClaims(Faction f)
{
GList<Chunk> cx = new GList<Chunk>();
for(FLocation i : f.getAllClaims())
{
cx.add(getChunk(i));
}
return cx;
}
public static GList<Chunk> getClaims(Faction f, Location c, int rad)
{
GList<Chunk> cx = getClaims(f);
GList<Chunk> cs = W.chunkRadius(c.getChunk(), rad);
for(Chunk i : cx.copy())
{
if(!cs.contains(i))
{
cx.remove(i);
}
}
return cx;
}
public static GList<Player> getPlayers(Faction f)
{
GList<Player> p = new GList<Player>();
for(FPlayer i : f.getFPlayers())
{
if(i.isOnline())
{
p.add(i.getPlayer());
}
}
return p;
}
public static void addOwnership(Player p, Chunk c)
{
if(isOwnFaction(p, c))
{
FLocation l = getFLocation(c);
Faction f = getFaction(p);
if(!f.getClaimOwnership().containsKey(l))
{
f.getClaimOwnership().put(l, new HashSet<String>());
}
f.getClaimOwnership().get(l).add(p.getUniqueId().toString());
}
}
public static void removeOwnership(Player p, Chunk c)
{
if(isOwnFaction(p, c))
{
FLocation l = getFLocation(c);
Faction f = getFaction(p);
if(!f.getClaimOwnership().containsKey(l))
{
return;
}
f.getClaimOwnership().get(l).remove(p.getUniqueId().toString());
}
}
}
| [
"danielmillst@gmail.com"
] | danielmillst@gmail.com |
b526e62b51b09025fc2e7631081c673585345c60 | 6a545c68460bbb4757e502f5d9d649e15cdf2376 | /common_parent03/portal/src/main/java/com/vincent/bos/fore/web/action/CustomerAction.java | 231bedb8b516700e567eb9452bb1d59c4f2242e0 | [] | no_license | SanMaoTaGe/BOS_SUYUN | c6514ff8f8997f77bf26bc897aa356a3587bd9f0 | f8d54b9aecb84927148d0da8f12c13dd6916dbd7 | refs/heads/master | 2021-04-09T13:26:23.485795 | 2018-04-01T12:43:09 | 2018-04-01T12:43:09 | 125,701,838 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,888 | java | package com.vincent.bos.fore.web.action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.vincent.bos.fore.domain.Customer;
import com.vincent.utils.MailUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Controller;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.Session;
import javax.ws.rs.core.MediaType;
import java.util.concurrent.TimeUnit;
/**
* @author Vincent
* @Description:
* @create 2018-03-22 21:08
*/
@Namespace("/")
@ParentPackage("struts-default")
@Controller
@Scope("prototype")
public class CustomerAction extends ActionSupport implements ModelDriven<Customer> {
private Customer customer = new Customer();
@Autowired
private JmsTemplate jmsTemplate;
@Override
public Customer getModel() {
return customer;
}
/**
* 发送注册验证码
* @return
*/
@Action(value = "customerAction_sendSMS")
public String sendSMS() {
final String code = RandomStringUtils.randomNumeric(6);
System.out.println("code:------->" + code);
System.out.println("phone:------->" + customer.getTelephone());
//存入session
ServletActionContext.getRequest().getSession().setAttribute("ServerCode", code);
//SmsUtils.sendSms(customer.getTelephone(), code);
jmsTemplate.send("sms_message", new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
System.out.println("send message to activeMQ------------");
MapMessage mapMessage = session.createMapMessage();
mapMessage.setString("tel", customer.getTelephone());
mapMessage.setString("code", code);
return mapMessage;
}
});
return NONE;
}
private String checkcode;
public void setCheckcode(String checkcode) {
this.checkcode = checkcode;
}
@Autowired
private RedisTemplate<String, String> redisTemplate;
@Action(value = "customerAction_regist", results = {@Result(name = "success", location = "/signup-success.html", type = "redirect"), @Result(name = "error", location = "/signup-fail.html", type = "redirect")})
public String regist() {
System.out.println("-----------------------regist");
String serverCode = (String) ServletActionContext.getRequest().getSession().getAttribute("ServerCode");
//校验注册验证码
if (StringUtils.isNotEmpty(serverCode) && StringUtils.isNotEmpty(checkcode) && checkcode.equals(serverCode)) {
//注册
WebClient.create("http://localhost:8180/webService/customerService/save")
.type(MediaType.APPLICATION_JSON) // 传递的格式
.post(customer);
//信息OK后,发送激活邮件
//生成验证码
String activeCode = RandomStringUtils.randomNumeric(32);
//利用redis储存验证码
//有效时间1天
redisTemplate.opsForValue().set(customer.getTelephone(), activeCode, 1, TimeUnit.DAYS);
String emailText = "感谢注册,请点解以下链接文字激活您的账号"
+ "<a href='http://localhost:8280/customerAction_active.action?activeCode="
+ activeCode
+ "&telephone="
+ customer.getTelephone()
+ "'>此链接</a>激活您的账号";
//调用工具类发邮件
MailUtils.sendMail("来自长风的注册邮件", emailText, "13692280056@163.com");
return SUCCESS;
}
return ERROR;
}
private String activeCode;
public void setActiveCode(String activeCode) {
this.activeCode = activeCode;
}
@Action(value = "customerAction_active", results = {@Result(name = "success", location = "/login.html", type = "redirect"), @Result(name = "error", location = "/signup-fail.html", type = "redirect")})
public String active() {
System.out.println("-----------------active---------------\n");
String serverActiveCode = redisTemplate.opsForValue().get(customer.getTelephone());
if (StringUtils.isNotEmpty(activeCode) && StringUtils.isNotEmpty(serverActiveCode) && activeCode.equals(serverActiveCode)) {
//到crm中激活
System.out.println("--------------------------通过了激活码的初级验证");
WebClient.create("http://localhost:8180/webService/customerService/active")
.type(MediaType.APPLICATION_JSON)
.query("telephone", customer.getTelephone())
.accept(MediaType.APPLICATION_JSON)
.put(null);
return SUCCESS;
}
return ERROR;
}
/**
* 登录
*
* @return
*/
@Action(value = "customerAction_login", results = {
@Result(name = "success", location = "/myhome.html", type = "redirect"),
@Result(name = "error", location = "/login.html", type = "redirect"),
@Result(name = "unActived", location = "/login.html", type = "redirect")
})
public String login() {
System.out.println("-----------------login---------------\n");
//拿到验证码,验证由工具类存到session,key为validateCode
String serverValidateCode = (String) ServletActionContext.getRequest().getSession().getAttribute(("validateCode"));
if (StringUtils.isNotEmpty(serverValidateCode) && StringUtils.isNotEmpty(checkcode) && serverValidateCode.equals(checkcode)) {
//验证码正确,做进一步动作
//确认是否激活了
Customer cc = WebClient.create("http://localhost:8180/webService/customerService/isActived")
.type(MediaType.APPLICATION_JSON)
.query("telephone", this.customer.getTelephone())
.accept(MediaType.APPLICATION_JSON)
.get(Customer.class);
//用户
if (cc != null && cc.getType() != null) {
//符合条件,提取信息并跳转
if (cc.getType() == 1) {
Customer c2 = WebClient.create("http://localhost:8180/webService/customerService/login")
.type(MediaType.APPLICATION_JSON)
.query("telephone", this.customer.getTelephone())
.query("password", this.customer.getPassword())
.accept(MediaType.APPLICATION_JSON)
.get(Customer.class);
//根据账号密码找用户,如果找到说明账号和密码对
if (c2 != null) {
ServletActionContext.getRequest().getSession().setAttribute("user", c2);
return SUCCESS;
//登录信息有误
} else {
return ERROR;
}
} else {
//用户存在,但激活状态未变更
return "unActived";
}
}
}
//验证码验证失败,重新登录
return ERROR;
}
}
| [
"956619097@qq.com"
] | 956619097@qq.com |
03244bde6f46c2f664a4f6263c6b73445f4f83c4 | 50d1bd7343009a5d7f4bc3c5995144c1aa9d5c7f | /SpringBootJFX/src/main/java/com/billing/controller/ViewSalesReturnController.java | e679943daf5712e02797b8dffcc7aac59977c459 | [] | no_license | kumbharvish/SpringBootJavaFX | ea3731512ffd92bcde48261bc29905a47cce9967 | c55dbfbd2a835f138af946e60eeb8284bb70afee | refs/heads/master | 2023-08-17T05:21:39.164031 | 2023-04-09T17:08:15 | 2023-04-09T17:08:15 | 193,374,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,077 | java | package com.billing.controller;
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.billing.dto.ItemDetails;
import com.billing.dto.Product;
import com.billing.dto.ReturnDetails;
import com.billing.main.AppContext;
import com.billing.service.SalesReturnService;
import com.billing.utils.AlertHelper;
import com.billing.utils.AppUtils;
import com.billing.utils.IndianCurrencyFormatting;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.stage.Modality;
import javafx.stage.Stage;
@Controller
public class ViewSalesReturnController extends AppContext {
ReturnDetails returnDetails;
private static final Logger logger = LoggerFactory.getLogger(CreateInvoiceController.class);
public Stage currentStage = null;
ObservableList<Product> productList;
@Autowired
AlertHelper alertHelper;
@Autowired
AppUtils appUtils;
ObservableList<ItemDetails> productTableData;
@Autowired
SalesReturnService salesReturnService;
@FXML
private TextField txtReturnNo;
@FXML
private TextField txtReturnDate;
@FXML
private TextField txtInvoiceNo;
@FXML
private TextField txtInvoiceDate;
@FXML
private TextField txtComments;
@FXML
private TextField txtCustomer;
@FXML
private TableView<ItemDetails> tableView;
@FXML
private TableColumn<ItemDetails, String> tcItemName;
@FXML
private TableColumn<ItemDetails, String> tcUnit;
@FXML
private TableColumn<ItemDetails, String> tcQuantity;
@FXML
private TableColumn<ItemDetails, String> tcRate;
@FXML
private TableColumn<ItemDetails, String> tcDiscount;
@FXML
private TableColumn<ItemDetails, String> tcDiscountAmount;
@FXML
private TableColumn<ItemDetails, String> tcAmount;
@FXML
private TableColumn<ItemDetails, String> tcCGSTPercent;
@FXML
private TableColumn<ItemDetails, String> tcCGST;
@FXML
private TableColumn<ItemDetails, String> tcSGSTPercent;
@FXML
private TableColumn<ItemDetails, String> tcSGST;
@FXML
private TextField txtNoOfItems;
@FXML
private TextField txtTotalQty;
@FXML
private TextField txtSubTotal;
@FXML
private TextField txtDiscountPercent;
@FXML
private TextField txtDiscountAmt;
@FXML
private TextField txtPaymentMode;
@FXML
private TextField txtGstAmount;
@FXML
private TextField txtGstType;
@FXML
private TextField txtTotalReturnAmount;
public void initialize() {
productTableData = FXCollections.observableArrayList();
productList = FXCollections.observableArrayList();
tableView.setItems(productTableData);
setTableCellFactories();
}
private void setTableCellFactories() {
tcItemName.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().getItemName()));
tcUnit.setCellValueFactory(cellData -> new SimpleStringProperty(cellData.getValue().getUnit()));
tcQuantity.setCellValueFactory(
cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getQuantity())));
tcRate.setCellValueFactory(
cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getRate())));
tcAmount.setCellValueFactory(
cellData -> new SimpleStringProperty(appUtils.getDecimalFormat(cellData.getValue().getAmount())));
tcDiscountAmount.setCellValueFactory(cellData -> new SimpleStringProperty(
appUtils.getDecimalFormat(cellData.getValue().getDiscountAmount())));
tcCGST.setCellValueFactory(cellData -> new SimpleStringProperty(
appUtils.getDecimalFormat(cellData.getValue().getGstDetails().getCgst())));
tcSGST.setCellValueFactory(cellData -> new SimpleStringProperty(
appUtils.getDecimalFormat(cellData.getValue().getGstDetails().getSgst())));
tcCGSTPercent.setCellValueFactory(cellData -> new SimpleStringProperty(
String.valueOf(cellData.getValue().getGstDetails().getCgstPercent())));
tcSGSTPercent.setCellValueFactory(cellData -> new SimpleStringProperty(
String.valueOf(cellData.getValue().getGstDetails().getSgstPercent())));
tcDiscount.setCellValueFactory(
cellData -> new SimpleStringProperty(String.valueOf(cellData.getValue().getDiscountPercent())));
tcItemName.getStyleClass().add("character-cell");
tcQuantity.getStyleClass().add("numeric-cell");
tcUnit.getStyleClass().add("character-cell");
tcRate.getStyleClass().add("numeric-cell");
tcAmount.getStyleClass().add("numeric-cell");
tcDiscountAmount.getStyleClass().add("numeric-cell");
tcCGST.getStyleClass().add("numeric-cell");
tcDiscount.getStyleClass().add("numeric-cell");
tcCGSTPercent.getStyleClass().add("numeric-cell");
tcSGSTPercent.getStyleClass().add("numeric-cell");
tcSGST.getStyleClass().add("numeric-cell");
}
public void loadData() {
currentStage = (Stage) txtCustomer.getScene().getWindow();
List<ItemDetails> itemList = salesReturnService.getReturnedItemList(returnDetails.getReturnNumber());
returnDetails.setItemDetails(itemList);
for (ItemDetails item : returnDetails.getItemDetails()) {
Product p = new Product();
p.setGstDetails(item.getGstDetails());
productTableData.add(item);
productList.add(p);
}
txtComments.setText(returnDetails.getComments());
txtInvoiceNo.setText(String.valueOf(returnDetails.getInvoiceNumber()));
txtInvoiceDate.setText(appUtils.getFormattedDateWithTime(returnDetails.getInvoiceDate()));
txtReturnNo.setText(String.valueOf(returnDetails.getReturnNumber()));
txtReturnDate.setText(appUtils.getFormattedDateWithTime(returnDetails.getTimestamp()));
txtCustomer.setText(String.valueOf(returnDetails.getCustomerMobileNo())+" : "+String.valueOf(returnDetails.getCustomerName()));
txtNoOfItems.setText(String.valueOf(returnDetails.getNoOfItems()));
txtTotalQty.setText(String.valueOf(returnDetails.getTotalQuantity()));
txtSubTotal.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getSubTotal()));
txtDiscountAmt.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getDiscountAmount()));
txtDiscountPercent.setText(String.valueOf(returnDetails.getDiscount()));
txtPaymentMode.setText(returnDetails.getPaymentMode());
txtGstAmount.setText(IndianCurrencyFormatting.applyFormatting(returnDetails.getGstAmount()));
txtGstType.setText(returnDetails.getGstType());
txtTotalReturnAmount
.setText(IndianCurrencyFormatting.applyFormattingWithCurrency(returnDetails.getTotalReturnAmount()));
}
@FXML
void onViewGSTDetailsAction(ActionEvent event) {
getGSTDetailsPopUp();
}
private void getGSTDetailsPopUp() {
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setControllerFactory(springContext::getBean);
fxmlLoader.setLocation(this.getClass().getResource("/com/billing/gui/ViewGSTDetails.fxml"));
Parent rootPane = null;
try {
rootPane = fxmlLoader.load();
} catch (IOException e) {
e.printStackTrace();
logger.error("getGSTDetailsPopUp Error in loading the view file :", e);
alertHelper.beep();
alertHelper.showErrorAlert(null, "Error Occurred", "Error in creating user interface",
"An error occurred in creating user interface " + "for the selected command");
return;
}
final Scene scene = new Scene(rootPane);
final GSTDetailsController controller = (GSTDetailsController) fxmlLoader.getController();
controller.productList = productList;
final Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(currentStage);
stage.setUserData(controller);
stage.getIcons().add(new Image("/images/shop32X32.png"));
stage.setScene(scene);
stage.setTitle("GST Details");
controller.loadData();
stage.showAndWait();
}
}
| [
"VISHAL@HP"
] | VISHAL@HP |
f2aff4379b94cfc7d7b2aa66385d86ae5c2a3ee5 | 96d8f9a9be21b4ba02338123ffdab3d457d2ed8d | /mendez/Leet_code_234_palindrome_linkedList.java | 6879914ef75ea24dd31778e3ce7b170dbe5865ea | [] | no_license | otaruMendez/XtremeX | 95f9b5fabd5a61e5504683995db8afc24c17763f | 8ec9f34ca8c9f06cbc730e4ef527a317ac046050 | refs/heads/master | 2021-01-20T15:53:34.411972 | 2016-08-03T17:56:10 | 2016-08-03T17:56:10 | 60,859,222 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | /**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
public class Solution {
boolean isPalindrome(ListNode head) {
Stack<Integer> nodes = new Stack();
ListNode currentNode = head;
while(currentNode != null){
nodes.push(currentNode.val);
currentNode = currentNode.next;
}
currentNode = head;
while(currentNode != null){
if(currentNode.val != nodes.pop()){
return false;
}
currentNode = currentNode.next;
}
return true;
}
}
| [
"otarubabatunde@gmail.com"
] | otarubabatunde@gmail.com |
430cca8047a16bc9b57cc6dd3c48461dc17d3d4b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_db933908b999d47b84ac73d8e49eb1ae1fa504cb/MapControls/20_db933908b999d47b84ac73d8e49eb1ae1fa504cb_MapControls_s.java | b5cd9a5d228f6ecb321d7ca9d46510a95c6863b4 | [] | 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 | 9,418 | java | /**
* Copyright (C) 2002-2011 The FreeCol Team
*
* This file is part of FreeCol.
*
* FreeCol is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* FreeCol is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with FreeCol. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.freecol.client.gui.panel;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
import net.sf.freecol.client.gui.Canvas;
import net.sf.freecol.client.gui.GUI;
import net.sf.freecol.client.gui.ViewMode;
import net.sf.freecol.client.gui.action.ActionManager;
import net.sf.freecol.client.gui.action.BuildColonyAction;
import net.sf.freecol.client.gui.action.DisbandUnitAction;
import net.sf.freecol.client.gui.action.FortifyAction;
import net.sf.freecol.client.gui.action.SentryAction;
import net.sf.freecol.client.gui.action.SkipUnitAction;
import net.sf.freecol.client.gui.action.WaitAction;
import net.sf.freecol.client.gui.panel.MapEditorTransformPanel.MapTransform;
import net.sf.freecol.common.model.Tile;
import net.sf.freecol.common.model.TileImprovementType;
import net.sf.freecol.common.model.Map.Direction;
import net.sf.freecol.common.resources.ResourceManager;
/**
* A collection of panels and buttons that are used to provide
* the user with a more detailed view of certain elements on the
* map and also to provide a means of input in case the user
* can't use the keyboard.
*
* The MapControls are useless by themselves, this object needs to
* be placed on a JComponent in order to be usable.
*/
public final class MapControls {
private final FreeColClient freeColClient;
private final InfoPanel infoPanel;
private final MiniMap miniMap;
private final List<UnitButton> unitButtons = new ArrayList<UnitButton>();
private final JLabel compassRose;
private static final int CONTROLS_LAYER = JLayeredPane.MODAL_LAYER;
/**
* The basic constructor.
* @param freeColClient The main controller object for the client
*/
public MapControls(final FreeColClient freeColClient) {
this.freeColClient = freeColClient;
//
// Create GUI Objects
//
infoPanel = new InfoPanel(freeColClient);
miniMap = new MiniMap(freeColClient);
compassRose = new JLabel(ResourceManager.getImageIcon("compass.image"));
updateUnitButtons();
//
// Don't allow them to gain focus
//
infoPanel.setFocusable(false);
miniMap.setFocusable(false);
compassRose.setFocusable(false);
compassRose.setSize(compassRose.getPreferredSize());
compassRose.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int x = e.getX() - compassRose.getWidth()/2;
int y = e.getY() - compassRose.getHeight()/2;
double theta = Math.atan2(y, x) + Math.PI/2 + Math.PI/8;
if (theta < 0) {
theta += 2*Math.PI;
}
Direction direction = Direction.values()[(int) Math.floor(theta / (Math.PI/4))];
freeColClient.getInGameController().moveActiveUnit(direction);
}
});
}
public void updateUnitButtons() {
final ActionManager am = freeColClient.getActionManager();
unitButtons.clear();
unitButtons.add(new UnitButton(am.getFreeColAction(WaitAction.id)));
unitButtons.add(new UnitButton(am.getFreeColAction(SkipUnitAction.id)));
unitButtons.add(new UnitButton(am.getFreeColAction(SentryAction.id)));
unitButtons.add(new UnitButton(am.getFreeColAction(FortifyAction.id)));
for (TileImprovementType type : freeColClient.getGame().getSpecification()
.getTileImprovementTypeList()) {
if (!type.isNatural()) {
unitButtons.add(new UnitButton(am.getFreeColAction(type.getShortId() + "Action")));
}
}
unitButtons.add(new UnitButton(am.getFreeColAction(BuildColonyAction.id)));
unitButtons.add(new UnitButton(am.getFreeColAction(DisbandUnitAction.id)));
for (UnitButton button : unitButtons) {
button.setFocusable(false);
}
}
/**
* Updates this <code>InfoPanel</code>.
*
* @param mapTransform The current MapTransform.
*/
public void update(MapTransform mapTransform) {
if (infoPanel != null) {
infoPanel.update(mapTransform);
}
}
/**
* Adds the map controls to the given component.
* @param component The component to add the map controls to.
*/
public void addToComponent(Canvas component) {
if (freeColClient.getGame() == null
|| freeColClient.getGame().getMap() == null) {
return;
}
//
// Relocate GUI Objects
//
infoPanel.setLocation(component.getWidth() - infoPanel.getWidth(), component.getHeight() - infoPanel.getHeight());
miniMap.setLocation(0, component.getHeight() - miniMap.getHeight());
compassRose.setLocation(component.getWidth() - compassRose.getWidth() - 20, 20);
final int WIDTH = unitButtons.get(0).getWidth();
final int SPACE = 5;
int x = miniMap.getWidth() + 1 +
((infoPanel.getX() - miniMap.getWidth() -
unitButtons.size() * WIDTH -
(unitButtons.size() - 1) * SPACE - WIDTH) / 2);
int y = component.getHeight() - 40;
for (UnitButton button : unitButtons) {
button.setLocation(x, y);
x += (WIDTH + SPACE);
}
//
// Add the GUI Objects to the container
//
component.add(infoPanel, CONTROLS_LAYER, false);
component.add(miniMap, CONTROLS_LAYER, false);
if (freeColClient.getClientOptions().getBoolean(ClientOptions.DISPLAY_COMPASS_ROSE)) {
component.add(compassRose, CONTROLS_LAYER, false);
}
if (!freeColClient.isMapEditor()) {
for (UnitButton button : unitButtons) {
component.add(button, CONTROLS_LAYER, false);
Action a = button.getAction();
button.setAction(null);
button.setAction(a);
}
}
}
/**
* Returns the width of the InfoPanel.
*
* @return an <code>int</code> value
*/
public int getInfoPanelWidth() {
return infoPanel.getWidth();
}
/**
* Returns the height of the InfoPanel.
*
* @return an <code>int</code> value
*/
public int getInfoPanelHeight() {
return infoPanel.getHeight();
}
/**
* Removes the map controls from the parent canvas component.
*
* @param canvas <code>Canvas</code> parent
*/
public void removeFromComponent(Canvas canvas) {
canvas.remove(infoPanel, false);
canvas.remove(miniMap, false);
canvas.remove(compassRose, false);
for (UnitButton button : unitButtons) {
canvas.remove(button, false);
}
}
public boolean isShowing() {
return infoPanel.getParent() != null;
}
/**
* Zooms in the mini map.
*/
public void zoomIn() {
miniMap.zoomIn();
}
/**
* Zooms out the mini map.
*/
public void zoomOut() {
miniMap.zoomOut();
}
public boolean canZoomIn() {
return miniMap.canZoomIn();
}
public boolean canZoomOut() {
return miniMap.canZoomOut();
}
/**
*
* @param newColor
*/
public void changeBackgroundColor(Color newColor) {
miniMap.setBackgroundColor(newColor);
}
/**
* Updates this <code>MapControls</code>.
*/
public void update() {
GUI gui = freeColClient.getGUI();
int viewMode = gui.getViewMode().getView();
switch (viewMode) {
case ViewMode.MOVE_UNITS_MODE:
infoPanel.update(gui.getActiveUnit());
break;
case ViewMode.VIEW_TERRAIN_MODE:
if (gui.getSelectedTile() != null) {
Tile selectedTile = gui.getSelectedTile();
if (infoPanel.getTile() != selectedTile) {
infoPanel.update(selectedTile);
}
}
break;
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
8694ccee8b527f712c576a68cb5b57e603b90cd4 | ad1ec12f35deafff2a010b5fc4172d14d703e352 | /src/vaultPrograms/SortWithoutCollections_6.java | b20fb56197d1e04c715b7cfa795cdf81713933f1 | [] | no_license | PKavyaSri/JavaPrograms | b45f67a26ad127c3b765d49021057c6acf8c0227 | 3ba5e0e0d6ce65c65d3458bcc6e7f902078f82a6 | refs/heads/master | 2020-07-28T19:30:49.821798 | 2019-09-19T19:57:01 | 2019-09-19T19:57:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package vaultPrograms;
import java.util.Arrays;
public class SortWithoutCollections_6 {
public static void main(String[] args) {
// TODO Auto-generated method stub
/* int[] a= {2,7,5,1,0,9,6,3};
for(int i=0;i<a.length;i++)
{
for(int j=i+1;j<a.length;j++)
{
if(a[i]>a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
System.out.println(Arrays.toString(a));
}*/
//*****************DESCENDING ORDER****************
/* int[] a= {30,-1,9,0,4,22,11,6};
for(int i=0;i<a.length;i++)
{
for(int j=i+1;j<a.length;j++)
{
if(a[i]<a[j])
{
int temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
System.out.println(Arrays.toString(a));
}*/
//****************BUBBLE SORT ***************
int[] a= {3,1,5,0,9,4,7};
System.out.println(Arrays.toString(a));
for(int i=1;i<a.length;i++)
{
if(a[i]>a[i-1])
{
a[i]=a[i]+a[i-1];
a[i-1]=a[i]-a[i-1];
a[i]=a[i]-a[i-1];
i=0;
}
}
System.out.println(Arrays.copyOf(a,a.length));
}
} | [
"user@10.0.0.190"
] | user@10.0.0.190 |
798fbfa19808cd4884ff531c4259ba64fd35bd87 | e387bf8e88ab9a1725a9887a8f20efced7bfe918 | /AndroidChess36/app/src/main/java/model/Pawn.java | cd8e3220e918e917df34059dad14e546cc04a480 | [] | no_license | aldermanwhitney/AndroidChess | 3975c2b6137a464e03c5b114f98be4e0986f9530 | fcbba70d908eba960d0fd9fa72c65118340d9685 | refs/heads/master | 2022-07-02T04:16:48.744648 | 2020-05-09T18:50:08 | 2020-05-09T18:50:08 | 262,634,531 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,884 | java | package model;
/**
* @authors Gazal Arora and Whitney Alderman
*/
//package pieces;
//import chess.Block;
//import chess.Chessboard;
import controller.*;
import view.*;
import model.*;
public class Pawn extends Pieces{
static int oR = -1, oC = -1;
static Pieces enpL = null , enpR = null;
static boolean enpassantL, enpassantR;
static boolean canEnp;
public static int r = -1, c = -1;
/**
* Pawn(String color)
* Constructor for a Pawn Piece with given color and type pawn,
*
* @param color - color black or white using parameter
*/
public Pawn(String color) {
super(color);
type = "pawn";
}
/**
* isValidMove(int oldCol, int oldRow, int newCol, int newRow)
* checks to see if a move is valid from old position to new position for a Pawn piece
* @param oldCol - old block's File
* @param oldRow - old block's Rank
* @param newCol - new block's File
* @param newRow - new blocks Rank
*
*
* @return boolean
*/
public boolean isValidMove(int oldCol, int oldRow, int newCol, int newRow){
//System.out.println("In is valid move for pawn");
//forward move with in an empty block
if(Chessboard.chessBoard[newRow][newCol].getPiece()!=null) {
{
//diagonal move of pawn where it can beat opponent's piece
//first checks if pieces at new and old positions are of opposing sides
if((Chessboard.chessBoard[newRow][newCol].getPiece().isWhite() && !Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite()) ||
(!Chessboard.chessBoard[newRow][newCol].getPiece().isWhite() && Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite())) {
//adjacent column only
if(newCol==oldCol-1 || newCol==oldCol+1) {
//for black piece and next row
if(!Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite() && newRow==oldRow+1) {
//enpassantL = false;
//enpassantR = false;
return true;
}
//white piece and forward row
else if (Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite() && newRow==oldRow-1) {
// enpassantL = false;
//enpassantR = false;
return true;
}
}
}
//enpassantL = false;
//enpassantR = false;
return false;
}
}
else {
//vertical forward move for white piece
//System.out.println("Moving white piece with no piece in way");
if(Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite()) {
//System.out.println("here 1");
//first move of white pawn is at row 6 and
//clear path checks when first move is moving over 2 blocks
if(oldRow==6 && (newRow ==oldRow-2) ) {
//System.out.println("here 2");
//System.out.println("first move valid");
//moves the pawn only if new position has no pieces
if(pathClear(oldCol,oldRow, newCol, newRow) ) {
//System.out.println("path is clear");
if(newCol != 0 && newCol!= 7) {
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()!=null && !Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol-1].getPieceType().equals("p")) {
enpL= Chessboard.chessBoard[newRow][newCol-1].getPiece();
enpassantL = true;
//System.out.println("here 3 enpL = " + enpassantL);
}
//else {enpassantL =false;}
}
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()!=null && !Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol+1].getPieceType().equals("p")) {
enpR= Chessboard.chessBoard[newRow][newCol+1].getPiece();
enpassantR = true;
//System.out.println("here 3 enpR = " + enpassantR);
}
//else {enpassantR = false;}
}
/*
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()==null || Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite()) {
enpassantL = false;
}
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()==null || Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite()) {
enpassantR = false;
}
*/
//System.out.println("here 3");
}
else if (newCol==0) {
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()!=null && !Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol+1].getPieceType().equals("p")) {
enpR= Chessboard.chessBoard[newRow][newCol+1].getPiece();
enpassantR = true;
}
//else {enpassantR = false;}
}
/*else {
enpassantR = false;
}*/
// System.out.println("here 4");
}
else if (newCol == 7) {
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()!=null && !Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol-1].getPieceType().equals("p")) {
enpL= Chessboard.chessBoard[newRow][newCol-1].getPiece();
enpassantL = true;
}
//else { enpassantL = false; }
}
/* else {
enpassantL = false;
}*/
}
// System.out.println("here 5");
if(enpassantL || enpassantR) {
oR = newRow;
oC = newCol;
}
//System.out.println("here 7");
return true;
}
}
else if (oldRow==6 && newRow == oldRow-1) {
//System.out.println("here 8");
if(pathClear(oldCol,oldRow, newCol, newRow) ) {
//System.out.println("path is clear");
// enpassantL = false;
// enpassantR = false;
canEnp=false;
return true;
}
}
//if its not the first move of respective pawn, then we can only move one block forward
//given that new position has no piece in that block
else if ((oldRow!=6 && newRow == oldRow-1) && (oldCol == newCol)) {
//System.out.println("here 9");
// System.out.println(enpassantL + " enpassant value 1" + enpassantR +" " + r + c);
// enpassantL = false;
//enpassantR = false;
r = -1;
c = -1;
canEnp=false;
return true;
}
else if ((oldRow==3 && newRow == 2) && (newCol==oldCol+1 || newCol == oldCol-1)) {
//System.out.println("here 10");
//System.out.println(enpassantL + " enpassant value 2" + enpassantR+" " + r + c);
if( enpassant(oldCol, oldRow, newCol, newRow)) canEnp = true;
else canEnp = false;
return canEnp;
}
/*else{
canEnp=false;
}*/
//System.out.println("here 11");
}
//vertical forward move for black piece
else if (!Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite()) {
//first move of black pawn is at row 1 and
//clear path checks when first move is moving over 2 blocks
if(oldRow==1 && (newRow ==oldRow+2) ) {
//moves the pawn only if new position has no pieces
if(pathClear(oldCol,oldRow, newCol, newRow)) {
//System.out.println("here");
if((newCol != 0 && newCol!= 7)) {
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()!=null && Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol-1].getPieceType().equals("p")) {
enpL= Chessboard.chessBoard[newRow][newCol-1].getPiece();
enpassantL = true;
//System.out.println("here 3 enpL = " + enpassantL);
}
// else {enpassantL =false;}
}
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()!=null && Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol+1].getPieceType().equals("p")) {
enpR= Chessboard.chessBoard[newRow][newCol+1].getPiece();
enpassantR = true;
//System.out.println("here 3 enpR = " + enpassantR);
}
//else {enpassantR = false;}
}
/*
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()==null || !Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite()) {
enpassantL = false;
}
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()==null || !Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite()) {
enpassantR = false;
}
*/
//System.out.println("here 3 ");
}
else if (newCol==0) {
if(Chessboard.chessBoard[newRow][newCol+1].getPiece()!=null && Chessboard.chessBoard[newRow][newCol+1].getPiece().isWhite())
{ if(Chessboard.chessBoard[newRow][newCol+1].getPieceType().equals("p")) {
enpR= Chessboard.chessBoard[newRow][newCol+1].getPiece();
enpassantR = true;
}
//else {enpassantR = false;}
}
/* else {
enpassantR = false;
}*/
}
else if (newCol == 7) {
if(Chessboard.chessBoard[newRow][newCol-1].getPiece()!=null && Chessboard.chessBoard[newRow][newCol-1].getPiece().isWhite())
{
if(Chessboard.chessBoard[newRow][newCol-1].getPieceType().equals("p")) {
enpL= Chessboard.chessBoard[newRow][newCol-1].getPiece();
enpassantL = true;
}
/* else
{ enpassantL = false; }
}
else {
enpassantL = false;
*/
}
}
if(enpassantL || enpassantR) {
oR = newRow;
oC = newCol;
}
return true;
}
}
else if (oldRow==1 && (newRow == oldRow+1) ) {
if(pathClear(oldCol,oldRow, newCol, newRow)) {
//System.out.println("here");
// enpassantL = false;
// enpassantR = false;
canEnp=false;
return true;
}
}
//if its not the first move of respective pawn, then we can only move one block forward
//given that new position has no piece in that block
else if ((oldRow!=1 && newRow == oldRow+1) && (oldCol == newCol)){
// enpassantL = false;
// enpassantR = false;
r = -1;
c = -1;
canEnp=false;
return true;
}
else if ((oldRow==4 && newRow == 5) && (newCol==oldCol+1 || newCol ==oldCol-1)) {
// System.out.println(enpassantL + " enpassant value " + enpassantR);
if( enpassant(oldCol, oldRow, newCol, newRow)) canEnp = true;
else canEnp = false;
return canEnp;
}
/*
else{
canEnp=false;
}*/
}
//System.out.println("here 12");
return false; //false if new position has a piece
}
}
/**
* pathClear(int oldCol, int oldRow, int newCol, int newRow)
* Checks if the path from old position to new position is clear, returns false if it isn't
* @param oldCol - old block's File
* @param oldRow - old block's Rank
* @param newCol - new block's File
* @param newRow - new blocks Rank
* @return boolean
*/
public boolean pathClear(int oldCol, int oldRow, int newCol, int newRow) {
//only need vertical path check for pawn, if not in the same column then returns false
//which in turn makes isValidMove false
if(oldCol == newCol) {
while (oldRow!=newRow) {
if(oldRow>newRow) {
if (Chessboard.chessBoard[oldRow-1][oldCol].getPiece() != null) {
return false;
}
oldRow--;
}
else if (oldRow<newRow) {
if (Chessboard.chessBoard[oldRow+1][oldCol].getPiece() != null) {
return false;
}
oldRow++;
}
Pawn.r = oldRow; Pawn.c = oldCol;
//System.out.println("row col: " + oldRow + oldCol);
return true;
}
}
return false;
}
/**
* move(int oldCol, int oldRow, int newCol, int newRow, char promo)
* moves a Pawn piece if isValidMove is true and destroys any pieces on applicable collision at new position
* @param oldCol - old block's File
* @param oldRow - old block's Rank
* @param newCol - new block's File
* @param newRow - new blocks Rank
* @param promo - promotion value Q/R/N/B for pawn promotion
*
* @return boolean
*/
public boolean move(int oldCol, int oldRow, int newCol, int newRow, char promo) {
if(isValidMove(oldCol, oldRow, newCol, newRow)) {
// not a valid move for current player for ANY piece
// if current players king will be in check as a result
// move is disallowed
if (King.isPlayerKingInCheck(oldRow, oldCol, newRow, newCol)) {
return false;
}
else {
if (Chessboard.whitesTurn==true) {
Chessboard.whiteincheck=false;
}
if (Chessboard.blacksTurn==true) {
Chessboard.blackincheck=false;
}
}
if((oldRow==1 && newRow == 0) && Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite() ) {
Chessboard.chessBoard[oldRow][oldCol].setPiece(null);
// Chessboard.chessBoard[newRow][newCol].getPiece().moved();
//System.out.println("promotion value: " + promo);
switch(promo) {
case 'Q' : Chessboard.chessBoard[newRow][newCol].setPiece(new Queen("white")); Chessboard.chessBoard[newRow][newCol].getPiece().moved(); break;
case 'N' : Chessboard.chessBoard[newRow][newCol].setPiece(new Knight("white")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
case 'B' : Chessboard.chessBoard[newRow][newCol].setPiece(new Bishop("white")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
case 'R' : Chessboard.chessBoard[newRow][newCol].setPiece(new Rook("white")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
default: return true;
}
if (King.isOpponentKingInCheck(newRow, newCol)){
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=true;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=true;
}
}
else {
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=false;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=false;
}
}
if(King.isOpponentKinginCheckmate(newRow, newCol)) {
Chessboard.checkMate=true;
}
//System.out.println("promotion value: " + promo);
return true;
}
else if ((oldRow==6 && newRow == 7) && !Chessboard.chessBoard[oldRow][oldCol].getPiece().isWhite() ) {
Chessboard.chessBoard[oldRow][oldCol].setPiece(null);
// Chessboard.chessBoard[newRow][newCol].getPiece().moved();
// System.out.println("promotion value: " + promo);
switch(promo) {
case 'Q' : Chessboard.chessBoard[newRow][newCol].setPiece(new Queen("black")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
case 'N' : Chessboard.chessBoard[newRow][newCol].setPiece(new Knight("black")); Chessboard.chessBoard[newRow][newCol].getPiece().moved(); break;
case 'B' : Chessboard.chessBoard[newRow][newCol].setPiece(new Bishop("black")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
case 'R' : Chessboard.chessBoard[newRow][newCol].setPiece(new Rook("black")); Chessboard.chessBoard[newRow][newCol].getPiece().moved();break;
default: return true;
}
if (King.isOpponentKingInCheck(newRow, newCol)){
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=true;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=true;
}
}
else {
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=false;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=false;
}
}
if(King.isOpponentKinginCheckmate(newRow, newCol)) {
Chessboard.checkMate=true;
}
// System.out.println("promotion value: " + promo);
return true;
}
else {
if(canEnp){
Chessboard.chessBoard[oR][oC].setPiece(null);
}
Chessboard.chessBoard[newRow][newCol].setPiece(Chessboard.chessBoard[oldRow][oldCol].getPiece());
Chessboard.chessBoard[oldRow][oldCol].setPiece(null);
Chessboard.chessBoard[newRow][newCol].getPiece().moved();
//this will probably need to be added after your switch statements too, idk
if (King.isOpponentKingInCheck(newRow, newCol)){
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=true;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=true;
}
}
else {
if (Chessboard.whitesTurn==true) {
Chessboard.blackincheck=false;
}
if (Chessboard.blacksTurn==true) {
Chessboard.whiteincheck=false;
}
}
if(King.isOpponentKinginCheckmate(newRow, newCol)) {
Chessboard.checkMate=true;
}
return true;
}
}
return false;
}
/**
* enpassant(int oldCol, int oldRow, int newCol, int newRow)
* Checks if an enpassant Pawn move is valid and allowed. If so, return true.
* @param oldCol - old block's File
* @param oldRow - old block's Rank
* @param newCol - new block's File
* @param newRow - new blocks Rank
*
* @return boolean
*/
public boolean enpassant(int oldCol, int oldRow, int newCol, int newRow) {
if(Pawn.r==newRow && Pawn.c == newCol) {
if(enpassantL) {
if(Chessboard.chessBoard[oldRow][oldCol].getPiece().equals(enpL)) {
enpassantL = false;
enpassantR = false;
enpL = null;
enpR = null;
return true;
}
}
if(enpassantR) {
if(Chessboard.chessBoard[oldRow][oldCol].getPiece().equals(enpR) ){
enpassantL = false;
enpassantR = false;
enpL = null;
enpR = null;
return true;
}
}
}
enpassantL = false;
enpassantR = false;
enpL = null;
enpR = null;
return false;
}
}
| [
"whitney.alderman@rutgers.edu"
] | whitney.alderman@rutgers.edu |
1020ce70fbc98a0bdc8b82a27ad6121fb23ce8e5 | 0571d934e56edba1833662bc52415683f07b94a3 | /src/main/java/logik/NoValidSettingsFileException.java | 26f6102d1417fbd2bc85dc9f52c400b2887bfcaf | [
"BSD-3-Clause"
] | permissive | art-r/Java-Intelligent-SnakeProject | 1ad9b822264c69d97932856982071be73d305d6f | 60f69cc7e95c46868e6ff2005d918c1190a15acc | refs/heads/main | 2023-07-27T01:28:34.419935 | 2021-09-15T14:06:27 | 2021-09-15T14:06:27 | 364,915,556 | 4 | 1 | BSD-3-Clause | 2021-05-26T08:57:29 | 2021-05-06T13:13:07 | Java | UTF-8 | Java | false | false | 248 | java | package logik;
//Exception that we need while checking our custom settings file
public class NoValidSettingsFileException extends Exception{
//we only need a constructor without any message!
public NoValidSettingsFileException() {
}
}
| [
"ay@local.com"
] | ay@local.com |
7aecfb847a40794f37aa832a6689bec0c1f944b3 | 332e5b265241fe9a7d7287abdcae389fe2b772c0 | /Android App/app/src/main/java/gps_sms/mitko/tuesgpsapp/MyFirebaseMessagingService.java | a9e241f59ee6c5dafd40f2e8e6b9c63985e07a95 | [] | no_license | dneshev99/GPS-Dog-Tracker | aa3476025f7ef5f103e2bf9f49495dd3550769d7 | 2e05526f8049e78e2a98961d884c7907a3b3b240 | refs/heads/master | 2021-01-20T01:46:21.207547 | 2017-05-28T13:27:37 | 2017-05-28T13:27:37 | 89,329,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | package gps_sms.mitko.tuesgpsapp;
import android.content.Intent;
import com.google.android.gms.maps.model.LatLng;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getNotification() != null) {
String body = remoteMessage.getNotification().getBody();
String[] tokens = body.split(" ");
if (tokens[0].equals("location:") && tokens.length == 3) {
LatLng location = new LatLng(Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
Intent message = new Intent("locationUpdates");
message.putExtra("location", location);
sendBroadcast(message);
}
}
}
}
| [
"d.neshev99@gmail.com"
] | d.neshev99@gmail.com |
033c929253992ff69a47a698a2420306645f47da | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/32/32_2412c59f5c3a26027f32c25bc7db1510c75afb19/Gotoh/32_2412c59f5c3a26027f32c25bc7db1510c75afb19_Gotoh_t.java | 9ec7f44f73a675e4974fcaa324fc92a838bfb813 | [] | 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 | 15,999 | java | package de.bioinformatikmuenchen.pg4.alignment;
import de.bioinformatikmuenchen.pg4.alignment.gap.ConstantGapCost;
import de.bioinformatikmuenchen.pg4.alignment.gap.IGapCost;
import de.bioinformatikmuenchen.pg4.alignment.io.DPMatrixExporter;
import de.bioinformatikmuenchen.pg4.alignment.io.IAlignmentOutputFormatter;
import de.bioinformatikmuenchen.pg4.alignment.io.IDPMatrixExporter;
import de.bioinformatikmuenchen.pg4.common.Sequence;
import de.bioinformatikmuenchen.pg4.common.alignment.AlignmentResult;
import de.bioinformatikmuenchen.pg4.common.alignment.SequencePairAlignment;
import de.bioinformatikmuenchen.pg4.common.distance.IDistanceMatrix;
import java.io.IOException;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author tobias
*/
public class Gotoh extends AlignmentProcessor {
private double[][] matrixA;
private double[][] matrixIn;
private double[][] matrixDel;
private double score;
private int xSize = -1;
private int ySize = -1;
private String querySequence;
private String targetSequence;
private String querySequenceId;
private String targetSequenceId;
private boolean freeshift = false;
private boolean local = false;
boolean[][] leftPath;
boolean[][] leftTopPath;
boolean[][] topPath;
boolean[][] hasPath;
public Gotoh(AlignmentMode mode, AlignmentAlgorithm algorithm, IDistanceMatrix distanceMatrix, IGapCost gapCost) {
super(mode, algorithm, distanceMatrix, gapCost);
assert algorithm == AlignmentAlgorithm.GOTOH;
//AlignmentResult result = new AlignmentResult();
}
public Gotoh(AlignmentMode mode, AlignmentAlgorithm algorithm, IDistanceMatrix distanceMatrix, IGapCost gapCost, IAlignmentOutputFormatter outputFormatter) {
super(mode, algorithm, distanceMatrix, gapCost, outputFormatter);
assert gapCost instanceof ConstantGapCost : "Classic Needleman Wunsch can't use affine gap cost";
assert algorithm == AlignmentAlgorithm.NEEDLEMAN_WUNSCH;
}
@Override
public AlignmentResult align(Sequence seq1, Sequence seq2) {
assert seq1 != null && seq2 != null;
assert seq1.getSequence().length() > 0;
assert seq2.getSequence().length() > 0;
this.querySequence = seq1.getSequence();
this.targetSequence = seq2.getSequence();
this.querySequenceId = seq1.getId();
this.targetSequenceId = seq2.getId();
this.xSize = querySequence.length();
this.ySize = targetSequence.length();
AlignmentResult result = new AlignmentResult();
initMatrix(seq1.getSequence().length(), seq2.getSequence().length());
fillMatrix(seq1.getSequence(), seq2.getSequence(), result);////////////////////// SCORE übergeben!
this.score = matrixA[xSize - 1][ySize - 1];
//Calculate the alignment and add it to the result
if (mode == AlignmentMode.GLOBAL) {
result.setAlignments(Collections.singletonList(backTrackingGlobal()));
} else if (mode == AlignmentMode.LOCAL) {
result.setAlignments(Collections.singletonList(backTrackingLocal()));
} else if (mode == AlignmentMode.FREESHIFT) {
result.setAlignments(Collections.singletonList(backTrackingFreeShift()));
} else {
throw new IllegalArgumentException("Unknown alignment mode: " + mode);
}
result.setQuerySequenceId(seq1.getId());
result.setTargetSequenceId(seq2.getId());
// System.out.println(printMatrix());
return result;
}
public void initMatrix(int xSize, int ySize) {
this.xSize = xSize;
this.ySize = ySize;
xSize++;
ySize++;
//Create the matrices
matrixA = new double[xSize][ySize];
matrixIn = new double[xSize][ySize];
matrixDel = new double[xSize][ySize];
leftPath = new boolean[xSize][ySize];
leftTopPath = new boolean[xSize][ySize];
topPath = new boolean[xSize][ySize];
hasPath = new boolean[xSize][ySize];
matrixDel[0][0] = Double.NEGATIVE_INFINITY;//NaN;
matrixIn[0][0] = Double.NEGATIVE_INFINITY;//NaN;
if (!(mode == AlignmentMode.FREESHIFT || mode == AlignmentMode.LOCAL)) {// " == if(global)"
for (int i = 1; i < xSize; i++) {
matrixA[i][0] = gapCost.getGapCost(i);
}
for (int i = 1; i < ySize; i++) {
matrixA[0][i] = gapCost.getGapCost(i);
}
}
for (int i = 1; i < xSize; i++) {
matrixIn[i][0] = Double.NEGATIVE_INFINITY;
matrixDel[i][0] = Double.NEGATIVE_INFINITY;//NaN;
}
for (int i = 1; i < ySize; i++) {
matrixIn[0][i] = Double.NEGATIVE_INFINITY;//NaN;
matrixDel[0][i] = Double.NEGATIVE_INFINITY;
}
//init the boolean[][] arrays which store the path taken by the backtracking algorithm
for (int x = 0; x < xSize; x++) {
for (int y = 0; y < ySize; y++) {
leftPath[x][y] = false;
leftTopPath[x][y] = false;
topPath[x][y] = false;
hasPath[x][y] = false;
}
}
}
public double[] findMaximumInMatrix() {//returns the coordinates (x,y) and entry of the cell with the maximum entry (in this order)
int x = -1;
int y = -1;
double maxCell = Double.NEGATIVE_INFINITY;
for (int i = 0; i < xSize; i++) {
for (int j = 0; j < ySize; j++) {
if (matrixA[i][j] >= maxCell) {
x = i;
y = j;
maxCell = matrixA[i][j];
}
}
}
assert (x >= 0 && y >= 0 && maxCell > Double.NEGATIVE_INFINITY);
return new double[]{x, y, maxCell};
}
public void fillMatrix(String seq1, String seq2, AlignmentResult result) {
assert ((gapCost != null) && (distanceMatrix != null));
for (int x = 1; x < xSize + 1; x++) {
for (int y = 1; y < ySize + 1; y++) {
matrixIn[x][y] = Math.max(matrixA[x - 1][y] + gapCost.getGapCost(1), matrixIn[x - 1][y] + gapCost.getGapExtensionPenalty(0, 1));
matrixDel[x][y] = Math.max(matrixA[x][y - 1] + gapCost.getGapCost(1), matrixDel[x][y - 1] + gapCost.getGapExtensionPenalty(0, 1));
matrixA[x][y] = Math.max(Math.max(matrixIn[x][y], matrixDel[x][y]), matrixA[x - 1][y - 1] + distanceMatrix.distance(seq1.charAt(x - 1), seq2.charAt(y - 1)));
}
}
if (mode == AlignmentMode.GLOBAL) {
result.setScore(matrixA[xSize][ySize]);
} else if (mode == AlignmentMode.LOCAL) {
result.setScore(findMaximumInMatrix()[2]);
}
}
public SequencePairAlignment backTrackingLocal() {
StringBuilder queryLine = new StringBuilder();
StringBuilder targetLine = new StringBuilder();
//find the cell with the greatest entry:
double[] maxEntry = findMaximumInMatrix();
int x = (int) maxEntry[0];
int y = (int) maxEntry[1];
double maxCell = maxEntry[2];
while (matrixA[x][y] != 0 && x > 0 && y > 0) {
assert (x >= 0 && y >= 0 && maxCell > Double.NEGATIVE_INFINITY);
while (matrixA[x][y] != 0 && x > 0 && y > 0) {
char A = querySequence.charAt(x - 1);
char B = targetSequence.charAt(y - 1);
if (matrixA[x][y] == matrixA[x - 1][y - 1] + distanceMatrix.distance(A, B)) {
leftTopPath[x][y] = true;
hasPath[x][y] = true;
queryLine.append(A);
targetLine.append(B);
x--;
y--;
} else if (matrixA[x][y] == matrixIn[x][y]) {
int shift = findK(matrixA[x][y], x, y, true);
for (int i = x; i >= (x - shift) && i > 0; i--) {
leftPath[i][y] = true;
hasPath[i][y] = true;
queryLine.append(querySequence.charAt(i - 1));
targetLine.append('-');
}
x -= shift;
} else if (matrixA[x][y] == matrixDel[x][y]) {
int shift = findK(matrixA[x][y], x, y, false);
for (int i = y; i >= (y - shift) && i > 0; i--) {
topPath[x][i] = true;
hasPath[x][i] = true;
queryLine.append('-');
targetLine.append(targetSequence.charAt(i - 1));
}
y -= shift;
} else {
throw new AlignmentException("No possibility found to move on (indicates a sure failure)");
}
}
}
return new SequencePairAlignment(queryLine.reverse().toString(), targetLine.reverse().toString());
}
public SequencePairAlignment backTrackingFreeShift() {
return backTrackingGlobal();
}
public SequencePairAlignment backTrackingGlobal() {
int x = xSize;
int y = ySize;
StringBuilder queryLine = new StringBuilder();
StringBuilder targetLine = new StringBuilder();
while (x >= 0 && y >= 0) {//while the rim of the matrix or its left upper corner is not reached
// System.out.println("Stuff " + x);
// => ab hier: x > 0 && y > 0
char A = (x == 0 ? '?' : querySequence.charAt(x - 1));
char B = (y == 0 ? '?' : targetSequence.charAt(y - 1));
if (x == 0) {
//System.out.println("x==0");
while (y > 0) {
//System.out.println("x==0 x,y: " + x + ", " + y);
topPath[x][y] = true;
hasPath[x][y] = true;
queryLine.append('-');
targetLine.append(targetSequence.charAt(y - 1));
y--;
}
break;
} else if (y == 0) {
//System.out.println("y==0");
while (x > 0) {
//System.out.println("y==0 left x,y: " + x + ", " + y);
leftPath[x][y] = true;
hasPath[x][y] = true;
queryLine.append(querySequence.charAt(x - 1));
targetLine.append('-');
x--;
}
break;
} else if (Math.abs((matrixA[x][y]) - (matrixA[x - 1][y - 1] + distanceMatrix.distance(A, B))) < 0.0000000001) {//leftTop
leftTopPath[x][y] = true;
hasPath[x][y] = true;
queryLine.append(A);
targetLine.append(B);
x--;
y--;
} else if (Math.abs(matrixA[x][y] - matrixIn[x][y]) < 0.0000000001) {// Insertion -> to the left
int xShift = 1;
while (Math.abs(matrixA[x][y] - (matrixA[x - xShift][y] + gapCost.getGapCost(xShift))) > 0.0000000001) {
leftPath[x - xShift][y] = true;
hasPath[x - xShift][y] = true;
queryLine.append(querySequence.charAt(x - xShift - 1));
targetLine.append('-');
xShift++;
}
leftPath[x - xShift][y] = true;
hasPath[x - xShift][y] = true;
queryLine.append(querySequence.charAt(x - 1));
targetLine.append('-');
x -= xShift;
} else if (Math.abs(matrixA[x][y] - matrixDel[x][y]) < 0.0000000001) {// Deletion -> to the right
int yShift = 1;
while (Math.abs(matrixA[x][y] - (matrixA[x][y - yShift] + gapCost.getGapCost(yShift))) > 0.0000000001) {
topPath[x][y - yShift] = true;
hasPath[x][y - yShift] = true;
queryLine.append('-');
targetLine.append(targetSequence.charAt(y - yShift - 1));
yShift++;
}
topPath[x][y - yShift] = true;
hasPath[x][y - yShift] = true;
queryLine.append('-');
targetLine.append(targetSequence.charAt(y - 1));
y -= yShift;
} else {
throw new AlignmentException("No possibility found to move on (indicates a sure failure)");
}
}
return new SequencePairAlignment(queryLine.reverse().toString(), targetLine.reverse().toString());
}
private int findK(double entry, int x, int y, boolean insertion) {//not neccessary anymore
int shift = 0;
if (insertion) {
while (x != 0) {
if ((matrixA[x - 1][y] + gapCost.getGapCost(shift + 1)) == entry) {
shift++;
break;
} else {
shift++;
x--;
}
}
} else {//Deletion
while (y != 0) {
if ((matrixA[x][y - 1] + gapCost.getGapCost(shift + 1)) == entry) {
shift++;
break;
} else {
shift++;
y--;
}
}
}
assert shift > 0;
return shift;
}
public boolean setFreeshift(boolean freeshift) {
this.freeshift = freeshift;
return this.freeshift;
}
public boolean setLocal(boolean local) {
this.local = local;
return this.local;
}
public String printMatrix() {
StringBuilder builder = new StringBuilder();
builder.append("\t\t");
for (int x = 0; x < querySequence.length(); x++) {
builder.append(querySequence.charAt(x)).append("\t");
}
builder.append("\n");
for (int y = 0; y <= targetSequence.length(); y++) {
builder.append(y == 0 ? ' ' : targetSequence.charAt(y - 1)).append("\t");
for (int x = 0; x <= querySequence.length(); x++) {
builder.append(matrixA[x][y]).append("\t");
}
builder.append("\n");
}
return builder.toString();
}
@Override
public void writeMatrices(IDPMatrixExporter exporter) {
DPMatrixExporter.DPMatrixInfo info = new DPMatrixExporter.DPMatrixInfo();
//Set sequences
info.query = querySequence;
info.target = targetSequence;
//Set IDs
info.queryId = querySequenceId;
info.targetId = targetSequenceId;
info.xSize = xSize;
info.ySize = ySize;
info.matrix = this.matrixA;
info.matrixPostfix = "Gotoh alignment matrix";
try {
exporter.write(info);
} catch (IOException ex) {
Logger.getLogger(Gotoh.class.getName()).log(Level.SEVERE, null, ex);
}
info.matrix = this.matrixIn;
info.matrixPostfix = "Gotoh insertions matrix";
try {
exporter.write(info);
} catch (IOException ex) {
Logger.getLogger(Gotoh.class.getName()).log(Level.SEVERE, null, ex);
}
info.matrix = this.matrixDel;
info.matrixPostfix = "Gotoh deletions matrix";
try {
exporter.write(info);
} catch (IOException ex) {
Logger.getLogger(Gotoh.class.getName()).log(Level.SEVERE, null, ex);
}
info.score = score;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
b7576bc1483482101be931852d1252a4834c7415 | 3aecf26d933667423bd6ed44f0895c36a9d77eb5 | /java/ruby/bamboo/enchant/SilkTouch.java | 95ed26c4bdef83a1788572a61817ef7101fb278d | [] | no_license | rubnsn/mcmod18x | 74ace10554908217e37730a9c67463f9eb224177 | c9532cc1c4d38a5c5b2e6cc2e304cf87cfd994d9 | refs/heads/master | 2020-12-24T06:23:43.896601 | 2019-04-07T12:58:02 | 2019-04-07T12:58:02 | 31,073,624 | 2 | 8 | null | 2017-01-03T02:32:00 | 2015-02-20T16:32:52 | Java | UTF-8 | Java | false | false | 292 | java | package ruby.bamboo.enchant;
public class SilkTouch extends EnchantBase {
public SilkTouch(int id, String name) {
super(id, name);
}
@Override
public int getRarity() {
return 10;
}
@Override
public int getMaxLevel() {
return 1;
}
}
| [
"whiteruby.0214@gmail.com"
] | whiteruby.0214@gmail.com |
9aa8f25a53eade27f2d34ea178fcde7483c9e4a7 | c88a5291b258e3a1bac42fead6f0ca790e279189 | /app/src/main/java/com/thebestgroup/io/donkeymoney_io/utils/model/LoginResponse.java | 131fbb1302f68d5aea921b63bcfdbadf6637614f | [] | no_license | sher04lock/DonkeyMoneyMobile | f1a5ec2d45df4e9b25f178d7904587a88cbdfbd4 | 1b501910317ce8394e1e0f2f506d4e5f2dcc6143 | refs/heads/master | 2020-04-07T17:37:19.245749 | 2018-01-24T17:28:08 | 2018-01-24T17:28:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java |
package com.thebestgroup.io.donkeymoney_io.utils.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class LoginResponse {
@SerializedName("access_token")
@Expose
private String accessToken;
@SerializedName("instance_url")
@Expose
private String instanceUrl;
@SerializedName("id")
@Expose
private String id;
@SerializedName("token_type")
@Expose
private String tokenType;
@SerializedName("issued_at")
@Expose
private String issuedAt;
@SerializedName("signature")
@Expose
private String signature;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getInstanceUrl() {
return instanceUrl;
}
public void setInstanceUrl(String instanceUrl) {
this.instanceUrl = instanceUrl;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTokenType() {
return tokenType;
}
public void setTokenType(String tokenType) {
this.tokenType = tokenType;
}
public String getIssuedAt() {
return issuedAt;
}
public void setIssuedAt(String issuedAt) {
this.issuedAt = issuedAt;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
}
| [
"zosia.franczyk@gmail.com"
] | zosia.franczyk@gmail.com |
d0e36ca7828e2ef34cc0eee8777300fd211fc1fa | 3dddbe8d199f28d2c18a7782ac49b7b416cbc264 | /app/src/main/java/movie/bw/com/movie/net/PMCallback.java | aec261ae286d3f6e076e317aa4abc06880be73d9 | [] | no_license | hollewsq/Movie | f8417f18ad5d770dd5d06b84fd899b64a5dfd35b | b3f9e2e7b707b2382ddde18ca3f945829e84b61f | refs/heads/master | 2020-05-16T02:02:53.141888 | 2019-04-19T10:43:22 | 2019-04-19T10:43:26 | 182,618,321 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package movie.bw.com.movie.net;
public interface PMCallback {
void onFail(String msg);
void onSuccess(Object reg);
}
| [
"1469408383@qq.com"
] | 1469408383@qq.com |
4e869415bbce2dd9457ad6b421868e9f93e86020 | 47f12e7cae2ef77e64dc2401effcc1af7e4f209b | /src/main/java/ge/idealab/kedi/security/oauth2/user/OAuth2UserInfoFactory.java | f2f8e9883fafd8e93d07081db3dbe4347fa2e837 | [] | no_license | geass94/kedi | 75b141fde66bd969202b02c9f935ef8ab21999d3 | 25a0d2565738f4e85b26bfde7e34a202d0ae2973 | refs/heads/master | 2020-04-18T02:31:41.572167 | 2019-04-04T17:45:00 | 2019-04-04T17:45:00 | 167,166,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package ge.idealab.kedi.security.oauth2.user;
import ge.idealab.kedi.exception.OAuth2AuthenticationProcessingException;
import ge.idealab.kedi.model.enums.AuthProvider;
import java.util.Map;
public class OAuth2UserInfoFactory {
public static OAuth2UserInfo getOAuth2UserInfo(String registrationId, Map<String, Object> attributes) {
if(registrationId.equalsIgnoreCase(AuthProvider.google.toString())) {
return new GoogleOAuth2UserInfo(attributes);
} else if (registrationId.equalsIgnoreCase(AuthProvider.facebook.toString())) {
return new FacebookOAuth2UserInfo(attributes);
} else if (registrationId.equalsIgnoreCase(AuthProvider.github.toString())) {
return new GithubOAuth2UserInfo(attributes);
} else {
throw new OAuth2AuthenticationProcessingException("Sorry! Login with " + registrationId + " is not supported yet.");
}
}
}
| [
"okoridze@yahoo.com"
] | okoridze@yahoo.com |
927e9f55d80ab3041ef9ba59d6b76e00a49dd3b3 | 02507a5e6c42af839370c63870be8ada9599a941 | /skin/src/main/java/com/easy/skin/SkinFactory.java | e34169067dfc3a56e67c7c01782dbf427a30406c | [] | no_license | EasyDevWork/EasyAndroid2 | 42128245c2a1c3f4e483f8e83e101e7dd2130c20 | 8e70ef7389805f7504525a23aadcb8fda020aee3 | refs/heads/master | 2021-04-04T16:45:36.535233 | 2021-02-26T02:51:02 | 2021-02-26T02:51:02 | 248,472,146 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,027 | java | package com.easy.skin;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Observable;
import java.util.Observer;
public class SkinFactory implements LayoutInflater.Factory2, Observer {
/**
* 属性处理类
*/
private SkinAttribute mSkinAttribute;
AppCompatViewInflater2 inflater2;
/**
* 保存view的构造方法
*/
private static final HashMap<String, Constructor<? extends View>> sConstructorMap = new HashMap<>();
private static final Class<?>[] mConstructorSignature = new Class[]{Context.class, AttributeSet.class};
public final String[] a = new String[]{
"android.widget.",
"android.view.",
"android.webkit."
};
public SkinFactory() {
mSkinAttribute = new SkinAttribute();
inflater2 = new AppCompatViewInflater2();
}
/**
* AppCompatViewInflater
*
* @param parent
* @param name
* @param context
* @param attributeSet
* @return
*/
@Nullable
@Override
public View onCreateView(@Nullable View parent, @NonNull String name, @NonNull Context context, @NonNull AttributeSet attributeSet) {
View view = inflater2.createView(parent, name, context, attributeSet, false, false, true, false);
if (view != null) {
mSkinAttribute.loadView(view, attributeSet);
}
return view;
}
@Override
public void update(Observable observable, Object o) {
//接受到换肤请求
mSkinAttribute.applySkin();
}
public SkinAttribute getSkinAttribute() {
return mSkinAttribute;
}
@Nullable
@Override
public View onCreateView(@NonNull String s, @NonNull Context context, @NonNull AttributeSet attributeSet) {
return null;
}
}
| [
"caishuxing@linggan.com"
] | caishuxing@linggan.com |
f94ce65d7c104e841540e444d613b4d21dc9efdf | 99c832d838d78825a41e7b919cc1acbd8552ec97 | /tcc/src/main/java/br/com/sgce/repository/CidadeRepository.java | 23e8ba60ae37f3c69ade961f52819bf8053211e7 | [] | no_license | alberlan/tcc | 898e72928ad04d9d032d0d4564459e93f38e2807 | 20058e98438c0b5ed9b12a6ca3879f86342cca81 | refs/heads/master | 2016-09-01T17:21:23.615075 | 2014-10-08T00:53:41 | 2014-10-08T00:53:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | package br.com.sgce.repository;
import br.com.sgce.entity.Cidade;
import java.io.Serializable;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
public class CidadeRepository implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private EntityManager manager;
public Cidade guardar(Cidade cidade) {
return manager.merge(cidade);
}
public List<Cidade> buscarCidade() {
return manager.createQuery("from Cidade", Cidade.class).getResultList();
}
public Cidade porId(Long id) {
return manager.find(Cidade.class, id);
}
}
| [
"Administrador@172.18.113.195"
] | Administrador@172.18.113.195 |
0a985a7e28a74dbcdbf40d8d0e9a5773506f42b6 | da44e679a93bb2e90a3c501975a5ade0fd666b43 | /src/main/java/com/example/designpatterns/factory/factorymethod/PersonFactory.java | f3efe0aedf7c472e95dde5174f483a5dbc5c190d | [] | no_license | yoxiyoxiiii/design-patterns | 1346dffb3d011d4f1bd0ffbe7e16d862b13365e0 | 4d3f3d7951b5a0ac5ce7e664a62b76df311b6fe0 | refs/heads/master | 2020-05-20T15:07:31.990242 | 2019-05-12T05:58:10 | 2019-05-12T05:58:10 | 185,636,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 122 | java | package com.example.designpatterns.factory.factorymethod;
public interface PersonFactory {
Person createPerson();
}
| [
"846814595@qq.com"
] | 846814595@qq.com |
f9e1b71e54eb4d4dd47447c40fb315a89238d886 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/favorite/d.java | 867fc950e775b8efadc8a57d0c6eaa9defec06b5 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 45,860 | java | package com.tencent.mm.plugin.favorite;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.SpannableString;
import android.widget.Toast;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.aw.e;
import com.tencent.mm.aw.f;
import com.tencent.mm.g.a.ld;
import com.tencent.mm.model.aw;
import com.tencent.mm.model.r;
import com.tencent.mm.model.s;
import com.tencent.mm.plugin.fav.a.i;
import com.tencent.mm.plugin.fav.a.m;
import com.tencent.mm.plugin.fav.a.m.a;
import com.tencent.mm.plugin.fav.a.m.b;
import com.tencent.mm.plugin.fav.ui.i.a;
import com.tencent.mm.plugin.messenger.foundation.a.a.h;
import com.tencent.mm.pluginsdk.ui.applet.g.a;
import com.tencent.mm.protocal.protobuf.aar;
import com.tencent.mm.protocal.protobuf.aas;
import com.tencent.mm.protocal.protobuf.aau;
import com.tencent.mm.protocal.protobuf.aay;
import com.tencent.mm.protocal.protobuf.aaz;
import com.tencent.mm.protocal.protobuf.abe;
import com.tencent.mm.protocal.protobuf.abf;
import com.tencent.mm.protocal.protobuf.abh;
import com.tencent.mm.protocal.protobuf.abl;
import com.tencent.mm.protocal.protobuf.abo;
import com.tencent.mm.protocal.protobuf.abs;
import com.tencent.mm.protocal.protobuf.abu;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.mm.storage.bi.a;
import com.tencent.mm.ui.widget.a.c.a.b;
import com.tencent.mm.vfs.j;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public final class d
{
private static int[] mqq = { 2131822651, 2131822652, 2131822653, 2131822654, 2131822655 };
private static String H(com.tencent.mm.plugin.fav.a.g paramg)
{
Object localObject = null;
AppMethodBeat.i(20512);
if (paramg.field_favProto == null)
{
AppMethodBeat.o(20512);
paramg = localObject;
}
while (true)
{
return paramg;
if ((paramg.field_favProto.whA != null) && (!bo.isNullOrNil(paramg.field_favProto.whA.canvasPageXml)))
{
paramg = paramg.field_favProto.whA.canvasPageXml;
AppMethodBeat.o(20512);
}
else
{
paramg = paramg.field_favProto.wiv;
if ((paramg != null) && (paramg.size() == 1))
{
paramg = ((aar)paramg.get(0)).canvasPageXml;
AppMethodBeat.o(20512);
}
else
{
AppMethodBeat.o(20512);
paramg = localObject;
}
}
}
}
private static String I(com.tencent.mm.plugin.fav.a.g paramg)
{
Object localObject = null;
AppMethodBeat.i(20513);
if (paramg.field_favProto == null)
{
AppMethodBeat.o(20513);
paramg = localObject;
}
while (true)
{
return paramg;
if ((paramg.field_favProto.whA != null) && (!bo.isNullOrNil(paramg.field_favProto.whA.thumbUrl)))
{
paramg = paramg.field_favProto.whA.thumbUrl;
AppMethodBeat.o(20513);
}
else
{
paramg = paramg.field_favProto.wiv;
if ((paramg != null) && (paramg.size() == 1))
{
paramg = ((aar)paramg.get(0)).fgE;
AppMethodBeat.o(20513);
}
else
{
AppMethodBeat.o(20513);
paramg = localObject;
}
}
}
}
private static void a(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, boolean paramBoolean, abh paramabh)
{
AppMethodBeat.i(20509);
Intent localIntent = new Intent();
localIntent.putExtra("key_detail_info_id", paramg.field_localId);
localIntent.putExtra("show_share", paramBoolean);
localIntent.putExtra("prePublishId", "msgrecord_detail");
localIntent.putExtra("preChatTYPE", 15);
a(paramabh, localIntent);
i.el("FavRecordDetailUI", paramabh.cvF);
com.tencent.mm.bp.d.b(paramContext, "record", ".ui.FavRecordDetailUI", localIntent);
AppMethodBeat.o(20509);
}
private static void a(com.tencent.mm.plugin.fav.a.g paramg, abh paramabh, Intent paramIntent)
{
AppMethodBeat.i(20519);
a(paramabh, paramIntent);
paramIntent.putExtra("key_detail_info_id", paramg.field_localId);
AppMethodBeat.o(20519);
}
public static void a(g.a parama, Context paramContext, com.tencent.mm.plugin.fav.a.g paramg)
{
Object localObject1 = null;
Object localObject2 = null;
AppMethodBeat.i(20521);
if ((paramg == null) || (paramContext == null))
{
ab.w("MicroMsg.FavItemLogic", "getDisplayInfo favItemInfo is null");
AppMethodBeat.o(20521);
}
label32: aar localaar1;
label50: Object localObject3;
label53: Object localObject4;
while (true)
{
return;
localaar1 = com.tencent.mm.plugin.fav.a.b.c(paramg);
if (paramg == null)
{
ab.w("MicroMsg.FavItemLogic", "GetThumbUrlAndLocalPath favItemInfo is null");
localObject3 = null;
if (!(localObject3 instanceof String))
break label1413;
}
for (localObject3 = (String)localObject3; ; localObject3 = null)
{
localObject4 = paramg.field_favProto.whA;
switch (paramg.field_type)
{
case 3:
case 9:
case 10:
case 11:
case 12:
case 13:
case 15:
case 17:
default:
paramg = localObject2;
if (localObject4 != null)
{
paramg = localObject2;
if (!bo.isNullOrNil(((abu)localObject4).title))
paramg = ((abu)localObject4).title;
}
localObject3 = paramg;
if (bo.isNullOrNil(paramg))
localObject3 = localaar1.title;
parama.ajC(paramContext.getResources().getString(2131296527) + (String)localObject3);
AppMethodBeat.o(20521);
break label32;
aar localaar2 = com.tencent.mm.plugin.fav.a.b.c(paramg);
if (5 == paramg.field_type)
{
localObject3 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.c(localaar2));
if (((com.tencent.mm.vfs.b)localObject3).exists())
{
localObject3 = j.w(((com.tencent.mm.vfs.b)localObject3).dMD());
break label53;
}
localObject3 = paramg.field_favProto.whA;
if (localObject3 == null);
for (localObject3 = null; ; localObject3 = ((abu)localObject3).thumbUrl)
{
localObject4 = localObject3;
if (bo.isNullOrNil((String)localObject3))
localObject4 = localaar2.cvq;
localObject4 = com.tencent.mm.plugin.fav.a.b.LD((String)localObject4);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break;
localObject3 = Integer.valueOf(2131230820);
break;
}
}
if ((11 == paramg.field_type) || (10 == paramg.field_type))
{
localObject3 = paramg.field_favProto.whC;
if (localObject3 != null)
{
localObject4 = com.tencent.mm.plugin.fav.a.b.LD(((abe)localObject3).thumbUrl);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break label53;
localObject3 = Integer.valueOf(2131230813);
break label53;
}
}
if ((15 == paramg.field_type) || (12 == paramg.field_type))
{
localObject3 = paramg.field_favProto.whE;
if (localObject3 != null)
{
localObject4 = com.tencent.mm.plugin.fav.a.b.LD(((abo)localObject3).thumbUrl);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break label53;
localObject3 = Integer.valueOf(2131230813);
break label53;
}
}
if ((2 == paramg.field_type) || (7 == paramg.field_type) || (16 == paramg.field_type) || (4 == paramg.field_type))
{
localObject3 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.c(localaar2));
if (((com.tencent.mm.vfs.b)localObject3).exists())
{
localObject3 = j.w(((com.tencent.mm.vfs.b)localObject3).dMD());
break label53;
}
localObject3 = com.tencent.mm.plugin.fav.a.b.LD(localaar2.cvq);
localObject4 = localObject3;
if (bo.isNullOrNil((String)localObject3))
{
com.tencent.mm.plugin.fav.a.b.a(paramg, localaar2);
localObject4 = com.tencent.mm.plugin.fav.a.b.c(localaar2);
}
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break label53;
}
switch (paramg.field_type)
{
default:
localObject3 = Integer.valueOf(2131230817);
break;
case 2:
localObject3 = Integer.valueOf(2130837705);
break;
case 7:
localObject3 = Integer.valueOf(2131230800);
break;
if ((3 == paramg.field_type) || (6 == paramg.field_type))
break label50;
if (8 == paramg.field_type)
{
localObject3 = Integer.valueOf(com.tencent.mm.pluginsdk.d.ail(localaar2.wgo));
break;
}
if (17 == paramg.field_type)
{
aw.ZK();
localObject3 = com.tencent.mm.model.c.XO().Rn(localaar2.desc);
if ((((bi.a)localObject3).svN != null) && (((bi.a)localObject3).svN.length() != 0))
{
localObject3 = new SpannableString(((bi.a)localObject3).svN);
break;
}
localObject3 = Integer.valueOf(2130838444);
break;
}
if ((14 != paramg.field_type) || (paramg.field_favProto.wiv == null))
break label50;
localObject3 = paramg.field_favProto.wiv.iterator();
do
{
do
{
if (!((Iterator)localObject3).hasNext())
break;
localaar2 = (aar)((Iterator)localObject3).next();
}
while (localaar2.dataType == 1);
if (localaar2.dataType == 3)
{
localObject3 = Integer.valueOf(2131230819);
break label53;
}
if (localaar2.dataType == 6)
{
localObject3 = Integer.valueOf(2131230798);
break label53;
}
if (localaar2.dataType == 8)
{
localObject3 = Integer.valueOf(com.tencent.mm.pluginsdk.d.ail(localaar2.wgo));
break label53;
}
if ((localaar2.dataType == 2) || (localaar2.dataType == 7) || (localaar2.dataType == 15) || (localaar2.dataType == 4))
{
localObject3 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.c(localaar2));
if (((com.tencent.mm.vfs.b)localObject3).exists())
{
localObject3 = j.w(((com.tencent.mm.vfs.b)localObject3).dMD());
break label53;
}
localObject3 = com.tencent.mm.plugin.fav.a.b.LD(localaar2.cvq);
if (bo.isNullOrNil((String)localObject3))
switch (localaar2.dataType)
{
default:
localObject3 = Integer.valueOf(2131230817);
break;
case 2:
localObject3 = Integer.valueOf(2130837705);
break;
case 7:
localObject3 = Integer.valueOf(2131230800);
break;
}
break label53;
}
if (localaar2.dataType == 5)
{
localObject3 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.c(localaar2));
if (((com.tencent.mm.vfs.b)localObject3).exists())
{
localObject3 = j.w(((com.tencent.mm.vfs.b)localObject3).dMD());
break label53;
}
localObject3 = localaar2.wgT.whA;
if (localObject3 == null);
for (localObject3 = null; ; localObject3 = ((abu)localObject3).thumbUrl)
{
localObject4 = localObject3;
if (bo.isNullOrNil((String)localObject3))
localObject4 = localaar2.cvq;
localObject4 = com.tencent.mm.plugin.fav.a.b.LD((String)localObject4);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break;
localObject3 = Integer.valueOf(2131230820);
break;
}
}
if ((localaar2.dataType == 10) || (localaar2.dataType == 11))
{
localObject4 = localaar2.wgT.whC;
if (localObject4 != null)
{
localObject4 = com.tencent.mm.plugin.fav.a.b.LD(((abe)localObject4).thumbUrl);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break label53;
localObject3 = Integer.valueOf(2131230813);
break label53;
}
}
if ((localaar2.dataType == 12) || (localaar2.dataType == 14))
{
localObject4 = localaar2.wgT.whE;
if (localObject4 != null)
{
localObject4 = com.tencent.mm.plugin.fav.a.b.LD(((abo)localObject4).thumbUrl);
localObject3 = localObject4;
if (!bo.isNullOrNil((String)localObject4))
break label53;
localObject3 = Integer.valueOf(2131230813);
break label53;
}
}
}
while (localaar2.dataType != 16);
aw.ZK();
localObject3 = com.tencent.mm.model.c.XO().Rn(localaar2.desc);
if ((((bi.a)localObject3).svN != null) && (((bi.a)localObject3).svN.length() != 0))
{
localObject3 = new SpannableString(((bi.a)localObject3).svN);
break;
}
localObject3 = Integer.valueOf(2130838444);
break;
label1413: if ((localObject3 instanceof Integer))
((Integer)localObject3).intValue();
break;
}
break;
case 8:
case 1:
case 6:
case 5:
case 14:
case 2:
case 16:
case 4:
case 18:
case 7:
}
}
localObject3 = paramg.field_favProto.title;
paramg = (com.tencent.mm.plugin.fav.a.g)localObject3;
if (bo.isNullOrNil((String)localObject3))
paramg = localaar1.title;
parama.ajC(paramContext.getResources().getString(2131296942) + paramg);
AppMethodBeat.o(20521);
continue;
parama.ajC(paramg.field_favProto.desc);
parama.djw();
parama.a(new d.2(paramg, paramContext));
AppMethodBeat.o(20521);
continue;
paramg = paramg.field_favProto.why;
parama.ajC(paramContext.getString(2131296967) + paramg.label);
AppMethodBeat.o(20521);
}
if ((localObject4 != null) && (!bo.isNullOrNil(((abu)localObject4).title)))
{
paramg = ((abu)localObject4).title;
localObject3 = ((abu)localObject4).desc;
}
while (true)
{
localObject4 = paramg;
if (bo.isNullOrNil(paramg))
localObject4 = localaar1.title;
bo.isNullOrNil((String)localObject3);
parama.ajC(paramContext.getResources().getString(2131297071) + (String)localObject4);
AppMethodBeat.o(20521);
break;
paramg = i.a.a(paramContext, paramg).title;
parama.ajC(paramContext.getResources().getString(2131297030) + paramg);
AppMethodBeat.o(20521);
break;
parama.b(com.tencent.mm.sdk.platformtools.d.aml((String)localObject3), 3);
AppMethodBeat.o(20521);
break;
parama.b(com.tencent.mm.sdk.platformtools.d.aml((String)localObject3), 2);
AppMethodBeat.o(20521);
break;
parama.b(com.tencent.mm.sdk.platformtools.d.aml((String)localObject3), 2);
AppMethodBeat.o(20521);
break;
localObject3 = paramContext.getResources().getString(2131296993);
paramContext = i.a.a(paramContext, paramg).desc.replaceAll("\n", " ");
parama.ajC((String)localObject3 + paramContext);
AppMethodBeat.o(20521);
break;
paramg = localObject1;
if (localObject4 != null)
{
paramg = localObject1;
if (!bo.isNullOrNil(((abu)localObject4).title))
paramg = ((abu)localObject4).title;
}
localObject3 = paramg;
if (bo.isNullOrNil(paramg))
localObject3 = localaar1.title;
parama.ajC(paramContext.getResources().getString(2131296980) + (String)localObject3);
AppMethodBeat.o(20521);
break;
localObject3 = null;
paramg = null;
}
}
private static void a(abh paramabh, Intent paramIntent)
{
AppMethodBeat.i(20520);
paramIntent.putExtra("key_detail_fav_scene", paramabh.scene);
paramIntent.putExtra("key_detail_fav_sub_scene", paramabh.jSW);
paramIntent.putExtra("key_detail_fav_index", paramabh.index);
paramIntent.putExtra("key_detail_fav_query", paramabh.query);
paramIntent.putExtra("key_detail_fav_sessionid", paramabh.cvF);
paramIntent.putExtra("key_detail_fav_tags", paramabh.mfg);
AppMethodBeat.o(20520);
}
private static boolean a(Context paramContext, aar paramaar, com.tencent.mm.plugin.fav.a.g paramg)
{
boolean bool = true;
AppMethodBeat.i(20516);
aau localaau = paramaar.wgZ;
if ((localaau == null) || (bo.isNullOrNil(localaau.fiG)))
{
AppMethodBeat.o(20516);
bool = false;
}
while (true)
{
return bool;
m.a(m.a.mfu, paramg);
String str = com.tencent.mm.plugin.fav.a.b.c(paramaar);
Intent localIntent = new Intent();
localIntent.putExtra("IsAd", false);
localIntent.putExtra("KStremVideoUrl", localaau.fiG);
localIntent.putExtra("StreamWording", localaau.fiJ);
localIntent.putExtra("StremWebUrl", localaau.fiK);
localIntent.putExtra("KThumUrl", localaau.fiL);
localIntent.putExtra("KSta_StremVideoAduxInfo", localaau.fiM);
localIntent.putExtra("KSta_StremVideoPublishId", localaau.fiN);
localIntent.putExtra("KSta_SourceType", 2);
localIntent.putExtra("KSta_Scene", m.b.mfE.value);
localIntent.putExtra("KSta_FromUserName", paramg.field_fromUser);
localIntent.putExtra("KSta_FavID", paramg.field_id);
localIntent.putExtra("KSta_SnsStatExtStr", paramaar.cMn);
localIntent.putExtra("KBlockFav", true);
localIntent.putExtra("KMediaId", "fakeid_" + paramg.field_id);
localIntent.putExtra("KThumbPath", str);
localIntent.putExtra("KMediaVideoTime", localaau.wid);
localIntent.putExtra("KMediaTitle", localaau.fiI);
com.tencent.mm.bp.d.b(paramContext, "sns", ".ui.VideoAdPlayerUI", localIntent);
AppMethodBeat.o(20516);
}
}
public static void b(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, abh paramabh)
{
AppMethodBeat.i(20508);
if (paramContext == null)
{
ab.w("MicroMsg.FavItemLogic", "Context is null");
AppMethodBeat.o(20508);
}
while (true)
{
return;
if (paramg == null)
{
ab.w("MicroMsg.FavItemLogic", "Fav item is null");
AppMethodBeat.o(20508);
}
else
{
ab.i("MicroMsg.FavItemLogic", "Handler favItemInfo id %d, type %d", new Object[] { Long.valueOf(paramg.field_localId), Integer.valueOf(paramg.field_type) });
switch (paramg.field_type)
{
case -1:
case 0:
case 9:
case 13:
default:
ab.w("MicroMsg.FavItemLogic", "Do not match any type %d", new Object[] { Integer.valueOf(paramg.field_type) });
case 1:
case 2:
case 3:
case 16:
case 4:
case 5:
case 6:
case 7:
case 8:
case 10:
case 12:
case 15:
case 11:
case 14:
case 17:
do
{
AppMethodBeat.o(20508);
break;
localObject1 = new Intent();
((Intent)localObject1).putExtra("key_detail_text", paramg.field_favProto.desc);
((Intent)localObject1).putExtra("key_detail_info_id", paramg.field_localId);
((Intent)localObject1).putExtra("key_detail_can_share_to_friend", paramg.but());
((Intent)localObject1).putExtra("key_detail_time", paramg.field_updateTime);
if (paramg.field_sourceCreateTime <= 0L);
for (long l = paramg.field_updateTime; ; l = paramg.field_sourceCreateTime)
{
((Intent)localObject1).putExtra("key_detail_create_time", l);
a(paramabh, (Intent)localObject1);
i.el("FavoriteTextDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteTextDetailUI", (Intent)localObject1);
AppMethodBeat.o(20508);
break;
}
e(paramContext, paramg, paramabh);
AppMethodBeat.o(20508);
break;
localObject1 = new Intent();
a(paramg, paramabh, (Intent)localObject1);
((Intent)localObject1).putExtra("key_detail_create_time", paramg.field_favProto.wit.createTime);
i.el("FavoriteVoiceDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteVoiceDetailUI", (Intent)localObject1);
AppMethodBeat.o(20508);
break;
localObject1 = com.tencent.mm.plugin.fav.a.b.c(paramg);
if ((localObject1 != null) && (((aar)localObject1).wgZ != null) && ((!bo.isNullOrNil(((aar)localObject1).wgZ.fiG)) || (!bo.isNullOrNil(((aar)localObject1).wgZ.fiK))))
{
ab.i("MicroMsg.FavItemLogic", "it is ad sight.");
c(paramContext, paramg, paramabh);
AppMethodBeat.o(20508);
break;
}
d(paramContext, paramg, paramabh);
AppMethodBeat.o(20508);
break;
d(paramContext, paramg, paramabh);
AppMethodBeat.o(20508);
break;
d(paramContext, paramg, true, paramabh);
AppMethodBeat.o(20508);
break;
Object localObject2 = paramg.field_favProto.why;
Object localObject3 = paramg.field_favProto.hHV;
localObject1 = paramg.field_favProto.wit;
if ((localObject1 != null) && (!bo.isNullOrNil(((abl)localObject1).whU)));
for (localObject1 = s.mJ(((abl)localObject1).whU); ; localObject1 = s.mJ(paramg.field_fromUser))
{
ArrayList localArrayList = new ArrayList();
if (paramg.field_tagProto.wiJ != null)
localArrayList.addAll(paramg.field_tagProto.wiJ);
i.el("RedirectUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.a(paramg.field_localId, (aay)localObject2, (String)localObject1, (String)localObject3, localArrayList, paramContext);
AppMethodBeat.o(20508);
break;
}
localObject3 = paramg.field_favProto.wit;
localObject2 = com.tencent.mm.plugin.fav.a.b.c(paramg);
localObject1 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.c((aar)localObject2));
if (!((com.tencent.mm.vfs.b)localObject1).exists())
if (((aar)localObject2).cvq == null)
{
localObject1 = "";
localObject1 = f.a(6, null, ((aar)localObject2).title, ((aar)localObject2).desc, ((aar)localObject2).wgg, ((aar)localObject2).wgk, ((aar)localObject2).wgi, ((aar)localObject2).mnd, com.tencent.mm.plugin.fav.a.b.bul(), (String)localObject1, "", ((abl)localObject3).appId);
if (com.tencent.mm.plugin.fav.a.b.e((aar)localObject2))
break label893;
ab.i("MicroMsg.FavItemLogic", " start play music");
com.tencent.mm.aw.a.b((e)localObject1);
}
while (true)
{
((e)localObject1).fKs = String.valueOf(paramg.field_localId);
paramg = new Intent();
paramg.putExtra("key_scene", 2);
i.el("MusicMainUI", paramabh.cvF);
com.tencent.mm.bp.d.b(paramContext, "music", ".ui.MusicMainUI", paramg);
AppMethodBeat.o(20508);
break;
localObject1 = new com.tencent.mm.vfs.b(com.tencent.mm.plugin.fav.a.b.bue() + com.tencent.mm.a.g.x(((aar)localObject2).cvq.getBytes()));
if (((com.tencent.mm.vfs.b)localObject1).exists());
for (localObject1 = j.w(((com.tencent.mm.vfs.b)localObject1).dMD()); ; localObject1 = "")
break;
localObject1 = j.w(((com.tencent.mm.vfs.b)localObject1).dMD());
break label692;
ab.i("MicroMsg.FavItemLogic", "The music is playing, don't start play again");
}
c(paramContext, paramg, true, paramabh);
AppMethodBeat.o(20508);
break;
ab.d("MicroMsg.FavItemLogic", "start product ui, fav id %d, fav local id %d", new Object[] { Integer.valueOf(paramg.field_id), Long.valueOf(paramg.field_localId) });
l = paramg.field_localId;
paramg = paramg.field_favProto.whC.info;
paramabh = new Intent();
paramabh.putExtra("key_is_favorite_item", true);
paramabh.putExtra("key_favorite_local_id", l);
paramabh.putExtra("key_Product_xml", paramg);
paramabh.putExtra("key_can_delete_favorite_item", true);
paramabh.putExtra("key_ProductUI_getProductInfoScene", 3);
com.tencent.mm.bp.d.b(paramContext, "scanner", ".ui.ProductUI", paramabh);
AppMethodBeat.o(20508);
break;
ab.d("MicroMsg.FavItemLogic", "start tv ui, fav id %d, fav local id %d", new Object[] { Integer.valueOf(paramg.field_id), Long.valueOf(paramg.field_localId) });
l = paramg.field_localId;
paramg = paramg.field_favProto.whE.info;
paramabh = new Intent();
paramabh.putExtra("key_TV_getProductInfoScene", 3);
paramabh.putExtra("key_is_favorite_item", true);
paramabh.putExtra("key_favorite_local_id", l);
paramabh.putExtra("key_TV_xml", paramg);
paramabh.putExtra("key_can_delete_favorite_item", true);
com.tencent.mm.bp.d.b(paramContext, "shake", ".ui.TVInfoUI", paramabh);
AppMethodBeat.o(20508);
break;
ab.d("MicroMsg.FavItemLogic", "start product ui, fav id %d, fav local id %d", new Object[] { Integer.valueOf(paramg.field_id), Long.valueOf(paramg.field_localId) });
paramabh = new Intent();
paramabh.putExtra("key_product_scene", 4);
paramabh.putExtra("key_product_info", paramg.field_favProto.whC.info);
com.tencent.mm.bp.d.b(paramContext, "product", ".ui.MallProductUI", paramabh);
AppMethodBeat.o(20508);
break;
a(paramContext, paramg, true, paramabh);
AppMethodBeat.o(20508);
break;
paramg = com.tencent.mm.plugin.fav.a.b.c(paramg).desc;
aw.ZK();
paramg = com.tencent.mm.model.c.XO().Rn(paramg);
}
while (paramg == null);
Object localObject1 = new Intent();
((Intent)localObject1).putExtra("Contact_User", paramg.svN);
((Intent)localObject1).putExtra("Contact_Alias", paramg.dFl);
((Intent)localObject1).putExtra("Contact_Nick", paramg.nickname);
((Intent)localObject1).putExtra("Contact_QuanPin", paramg.gwG);
((Intent)localObject1).putExtra("Contact_PyInitial", paramg.gwF);
((Intent)localObject1).putExtra("Contact_Uin", paramg.pnz);
((Intent)localObject1).putExtra("Contact_Mobile_MD5", paramg.xZi);
((Intent)localObject1).putExtra("Contact_full_Mobile_MD5", paramg.xZj);
((Intent)localObject1).putExtra("Contact_QQNick", paramg.dtZ());
((Intent)localObject1).putExtra("User_From_Fmessage", false);
((Intent)localObject1).putExtra("Contact_Scene", paramg.scene);
((Intent)localObject1).putExtra("Contact_FMessageCard", true);
((Intent)localObject1).putExtra("Contact_RemarkName", paramg.gwK);
((Intent)localObject1).putExtra("Contact_VUser_Info_Flag", paramg.ufB);
((Intent)localObject1).putExtra("Contact_VUser_Info", paramg.duh);
((Intent)localObject1).putExtra("Contact_BrandIconURL", paramg.pln);
((Intent)localObject1).putExtra("Contact_Province", paramg.getProvince());
((Intent)localObject1).putExtra("Contact_City", paramg.getCity());
((Intent)localObject1).putExtra("Contact_Sex", paramg.dtS);
((Intent)localObject1).putExtra("Contact_Signature", paramg.signature);
((Intent)localObject1).putExtra("Contact_ShowUserName", false);
((Intent)localObject1).putExtra("Contact_KSnsIFlag", 0);
i.el("ContactInfoUI", paramabh.cvF);
com.tencent.mm.bp.d.b(paramContext, "profile", ".ui.ContactInfoUI", (Intent)localObject1);
com.tencent.mm.bq.a.Lu(paramg.scene);
AppMethodBeat.o(20508);
break;
case 18:
b(paramContext, paramg, true, paramabh);
AppMethodBeat.o(20508);
break;
case -2:
label692: label893: Toast.makeText(paramContext, 2131299758, 0).show();
AppMethodBeat.o(20508);
}
}
}
}
private static void b(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, boolean paramBoolean, abh paramabh)
{
AppMethodBeat.i(20510);
ab.i("MicroMsg.FavItemLogic", "click WNNoteItem, handleWNNoteItem");
ld localld = new ld();
localld.cGU.field_localId = paramg.field_localId;
if (paramg.field_localId == -1L)
localld.cGU.cHa = 4;
while (true)
{
localld.cGU.context = paramContext;
paramContext = new Bundle();
aaz localaaz = paramg.field_favProto.vzK;
if (localaaz != null)
{
paramContext.putString("noteauthor", localaaz.wim);
paramContext.putString("noteeditor", localaaz.win);
}
paramContext.putLong("edittime", paramg.field_updateTime);
localld.cGU.cGZ = paramContext;
localld.cGU.field_favProto = paramg.field_favProto;
localld.cGU.type = 2;
localld.cGU.cHc = paramBoolean;
localld.cGU.cHd = paramabh;
com.tencent.mm.sdk.b.a.xxA.m(localld);
i.el("NoteEditorUI", paramabh.cvF);
AppMethodBeat.o(20510);
return;
localld.cGU.cGW = paramg.field_xml;
}
}
public static void b(g.a parama, final Context paramContext, final com.tencent.mm.plugin.fav.a.g paramg)
{
AppMethodBeat.i(20522);
if ((paramg == null) || (paramContext == null))
{
ab.w("MicroMsg.FavItemLogic", "getDisplayInfo favItemInfo is null");
AppMethodBeat.o(20522);
return;
}
final aar localaar = com.tencent.mm.plugin.fav.a.b.c(paramg);
switch (paramg.field_type)
{
case 3:
case 7:
case 9:
case 10:
case 11:
case 12:
case 13:
case 15:
case 17:
default:
case 8:
case 1:
case 6:
case 5:
case 14:
case 2:
case 4:
case 16:
case 18:
}
while (true)
{
AppMethodBeat.o(20522);
break;
parama.a(new d.3(paramContext, paramg));
AppMethodBeat.o(20522);
break;
parama.a(new d.4(paramg, paramContext));
AppMethodBeat.o(20522);
break;
parama.a(new c.a.b()
{
public final void bwF()
{
AppMethodBeat.i(20503);
Intent localIntent = new Intent();
localIntent.putExtra("map_view_type", 1);
localIntent.putExtra("kwebmap_slat", this.mqr.lat);
localIntent.putExtra("kwebmap_lng", this.mqr.lng);
localIntent.putExtra("Kwebmap_locaion", this.mqr.label);
localIntent.putExtra("kShowshare", false);
com.tencent.mm.bp.d.b(paramContext, "location", ".ui.RedirectUI", localIntent);
AppMethodBeat.o(20503);
}
});
AppMethodBeat.o(20522);
break;
parama.a(new c.a.b()
{
public final void bwF()
{
AppMethodBeat.i(20504);
d.g(this.val$context, paramg, new abh());
AppMethodBeat.o(20504);
}
});
AppMethodBeat.o(20522);
break;
parama.a(new c.a.b()
{
public final void bwF()
{
AppMethodBeat.i(20505);
d.h(this.val$context, paramg, new abh());
AppMethodBeat.o(20505);
}
});
AppMethodBeat.o(20522);
break;
parama.a(new c.a.b()
{
public final void bwF()
{
AppMethodBeat.i(20506);
Intent localIntent = new Intent();
localIntent.putExtra("key_detail_info_id", this.meI.field_localId);
localIntent.putExtra("key_detail_data_id", localaar.mnd);
localIntent.putExtra("show_share", false);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.FavImgGalleryUI", localIntent);
AppMethodBeat.o(20506);
}
});
AppMethodBeat.o(20522);
break;
parama.a(new d.9(paramg, paramContext));
AppMethodBeat.o(20522);
break;
parama.a(new d.1(paramContext, paramg));
}
}
private static void c(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, abh paramabh)
{
AppMethodBeat.i(20515);
m.a(m.a.mfs, paramg);
Intent localIntent = new Intent();
localIntent.putExtra("key_detail_info_id", paramg.field_localId);
a(paramabh, localIntent);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteSightDetailUI", localIntent);
AppMethodBeat.o(20515);
}
private static void c(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, boolean paramBoolean, abh paramabh)
{
AppMethodBeat.i(20511);
Object localObject = com.tencent.mm.plugin.fav.a.b.c(paramg);
if ((paramabh != null) && (paramabh.cOi == 1))
{
localObject = new Intent();
((Intent)localObject).putExtra("key_detail_info_id", paramg.field_localId);
((Intent)localObject).putExtra("key_detail_open_way", true);
((Intent)localObject).putExtra("show_share", paramBoolean);
a(paramabh, (Intent)localObject);
i.el("FavoriteFileDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteFileDetailUI", (Intent)localObject);
AppMethodBeat.o(20511);
}
while (true)
{
return;
if ((paramabh != null) && (paramabh.cOi == 2))
{
com.tencent.mm.pluginsdk.ui.tools.a.b((Activity)paramContext, com.tencent.mm.plugin.fav.a.b.b((aar)localObject), ((aar)localObject).wgo, 2);
AppMethodBeat.o(20511);
}
else if (com.tencent.mm.plugin.fav.a.b.f((aar)localObject))
{
if (com.tencent.mm.plugin.fav.a.b.g((aar)localObject))
{
e(paramContext, paramg, paramabh);
AppMethodBeat.o(20511);
}
else if (!com.tencent.mm.pluginsdk.ui.tools.a.M(com.tencent.mm.plugin.fav.a.b.b((aar)localObject), ((aar)localObject).wgo, 2))
{
AppMethodBeat.o(20511);
}
}
else
{
localObject = new Intent();
((Intent)localObject).putExtra("key_detail_info_id", paramg.field_localId);
((Intent)localObject).putExtra("show_share", paramBoolean);
a(paramabh, (Intent)localObject);
i.el("FavoriteFileDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteFileDetailUI", (Intent)localObject);
AppMethodBeat.o(20511);
}
}
}
private static void d(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, abh paramabh)
{
AppMethodBeat.i(20517);
aar localaar = com.tencent.mm.plugin.fav.a.b.c(paramg);
if (a(paramContext, localaar, paramg))
AppMethodBeat.o(20517);
while (true)
{
return;
Object localObject2;
if ((bo.isNullOrNil(localaar.wgq)) || (localaar.wgu <= 0L))
{
ab.w("MicroMsg.FavItemLogic", "full md5[%s], fullsize[%d], start use url", new Object[] { localaar.wgq, Long.valueOf(localaar.wgu) });
Object localObject1 = com.tencent.mm.plugin.fav.a.b.c(paramg).wgg;
localObject2 = localObject1;
if (bo.isNullOrNil((String)localObject1))
localObject2 = com.tencent.mm.plugin.fav.a.b.c(paramg).wgk;
if (bo.isNullOrNil((String)localObject2))
{
ab.w("MicroMsg.FavItemLogic", "onClick video url null, return");
c(paramContext, paramg, paramabh);
AppMethodBeat.o(20517);
}
else
{
paramabh = new Intent();
localObject1 = new Bundle();
((Bundle)localObject1).putString("key_snsad_statextstr", localaar.cMn);
((Bundle)localObject1).putLong("favlocalid", paramg.field_localId);
paramabh.putExtra("jsapiargs", (Bundle)localObject1);
paramabh.putExtra("rawUrl", (String)localObject2);
paramabh.putExtra("is_favorite_item", true);
paramabh.putExtra("fav_local_id", paramg.field_localId);
paramabh.putExtra("geta8key_scene", 14);
ab.d("MicroMsg.FavItemLogic", "start video webview, fav id %d, fav local id %d", new Object[] { Integer.valueOf(paramg.field_id), Long.valueOf(paramg.field_localId) });
paramabh.putExtra("geta8key_scene", 14);
com.tencent.mm.bp.d.b(paramContext, "webview", ".ui.tools.WebViewUI", paramabh);
AppMethodBeat.o(20517);
}
}
else
{
localObject2 = new Intent();
a(paramg, paramabh, (Intent)localObject2);
i.el("FavoriteSightDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteSightDetailUI", (Intent)localObject2);
AppMethodBeat.o(20517);
}
}
}
private static void d(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, boolean paramBoolean, abh paramabh)
{
AppMethodBeat.i(20514);
Object localObject1 = H(paramg);
if (!bo.isNullOrNil((String)localObject1))
{
paramabh = new Intent();
paramabh.putExtra("sns_landing_pages_xml", (String)localObject1);
paramabh.putExtra("sns_landig_pages_from_source", 7);
paramabh.putExtra("sns_landing_pages_share_thumb_url", I(paramg));
paramabh.putExtra("sns_landing_favid", r.Yz() + "_" + paramg.field_id);
paramabh.addFlags(268435456);
com.tencent.mm.bp.d.b(paramContext, "sns", ".ui.SnsAdNativeLandingPagesPreviewUI", paramabh);
AppMethodBeat.o(20514);
}
while (true)
{
return;
abl localabl = paramg.field_favProto.wit;
Object localObject2 = "";
localObject1 = "";
Object localObject3 = "";
if (paramg.field_favProto.whA != null)
{
localObject3 = paramg.field_favProto.whA;
localObject2 = ((abu)localObject3).wiY;
localObject1 = ((abu)localObject3).title;
localObject3 = ((abu)localObject3).desc;
}
Object localObject4 = localObject2;
if (localabl != null)
{
localObject4 = localObject2;
if (bo.isNullOrNil((String)localObject2))
localObject4 = localabl.link;
}
if (bo.isNullOrNil((String)localObject4))
{
AppMethodBeat.o(20514);
}
else
{
aar localaar = com.tencent.mm.plugin.fav.a.b.c(paramg);
Object localObject5 = localObject1;
Object localObject6 = localObject3;
if (localaar != null)
{
localObject2 = localObject1;
if (bo.isNullOrNil((String)localObject1))
localObject2 = localaar.title;
localObject5 = localObject2;
localObject6 = localObject3;
if (bo.isNullOrNil((String)localObject3))
{
localObject6 = localaar.desc;
localObject5 = localObject2;
}
}
ab.d("MicroMsg.FavItemLogic", "start web view, fav id %d, fav local id %d", new Object[] { Integer.valueOf(paramg.field_id), Long.valueOf(paramg.field_localId) });
localObject1 = new Intent();
((Intent)localObject1).putExtra("rawUrl", (String)localObject4);
((Intent)localObject1).putExtra("showShare", paramBoolean);
((Intent)localObject1).putExtra("is_favorite_item", true);
((Intent)localObject1).putExtra("fav_local_id", paramg.field_localId);
((Intent)localObject1).putExtra("favorite_control_argument", paramg.buv());
((Intent)localObject1).putExtra("sentUsername", paramg.field_fromUser);
if ((localabl != null) && (!bo.isNullOrNil(localabl.csl)))
((Intent)localObject1).putExtra("srcDisplayname", s.mJ(localabl.csl));
((Intent)localObject1).putExtra("mode", 1);
((Intent)localObject1).putExtra("geta8key_scene", 14);
localObject3 = new Bundle();
((Bundle)localObject3).putString("key_snsad_statextstr", com.tencent.mm.plugin.fav.a.b.c(paramg).cMn);
((Bundle)localObject3).putLong("favlocalid", paramg.field_localId);
((Intent)localObject1).putExtra("jsapiargs", (Bundle)localObject3);
((Intent)localObject1).putExtra("from_scence", 4);
localObject3 = "fav_" + r.Yz() + "_" + paramg.field_id;
((Intent)localObject1).putExtra("KPublisherId", (String)localObject3);
((Intent)localObject1).putExtra("pre_username", paramg.field_fromUser);
((Intent)localObject1).putExtra("prePublishId", (String)localObject3);
((Intent)localObject1).putExtra("preChatTYPE", 14);
((Intent)localObject1).putExtra("share_report_pre_msg_url", (String)localObject4);
((Intent)localObject1).putExtra("share_report_pre_msg_title", localObject5);
((Intent)localObject1).putExtra("share_report_pre_msg_desc", (String)localObject6);
((Intent)localObject1).putExtra("share_report_pre_msg_icon_url", I(paramg));
((Intent)localObject1).putExtra("share_report_pre_msg_appid", "");
((Intent)localObject1).putExtra("share_report_from_scene", 4);
localObject3 = com.tencent.mm.modelstat.a.c.tL(com.tencent.mm.pluginsdk.model.d.class.getName());
((Bundle)localObject3).putInt("mm_rpt_fav_id", paramg.field_id);
((Bundle)localObject3).putInt("key_detail_fav_scene", paramabh.scene);
((Bundle)localObject3).putInt("key_detail_fav_sub_scene", paramabh.jSW);
((Bundle)localObject3).putInt("key_detail_fav_index", paramabh.index);
((Bundle)localObject3).putString("key_detail_fav_query", paramabh.query);
((Bundle)localObject3).putString("key_detail_fav_sessionid", paramabh.cvF);
((Bundle)localObject3).putString("key_detail_fav_tags", paramabh.mfg);
i.el("WebViewUI", paramabh.cvF);
((Intent)localObject1).putExtra("mm_report_bundle", (Bundle)localObject3);
((Intent)localObject1).putExtra("geta8key_scene", 14);
com.tencent.mm.bp.d.b(paramContext, "webview", ".ui.tools.WebViewUI", (Intent)localObject1);
AppMethodBeat.o(20514);
}
}
}
private static void e(Context paramContext, com.tencent.mm.plugin.fav.a.g paramg, abh paramabh)
{
AppMethodBeat.i(20518);
Intent localIntent = new Intent();
a(paramg, paramabh, localIntent);
i.el("FavoriteImgDetailUI", paramabh.cvF);
com.tencent.mm.plugin.fav.a.b.b(paramContext, ".ui.detail.FavoriteImgDetailUI", localIntent);
AppMethodBeat.o(20518);
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes7-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.favorite.d
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
07af367ca93e7cd0a271ec149b9d1447d405264f | 36fca6ee6e3d27b8568f3999fae89a443937ba6c | /daydream/com/google/vr/sdk/widgets/video/nano/SphericalMetadataOuterClass$StereoMeshConfig$Mesh$Vertex.java | ea103f03417021e9fa5661761d57e564060a2d63 | [] | no_license | wjfsanhe/ddwangjf | c2a9e61e5e1b22ec65b095dc2c5b4e9a5d1fe6ef | 95ee031abf532d837061e952683a71a500a2302c | refs/heads/master | 2021-01-11T14:26:54.481864 | 2017-02-09T06:08:44 | 2017-02-09T06:08:44 | 81,415,471 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,014 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3)
// Source File Name: SphericalMetadataOuterClass.java
package com.google.vr.sdk.widgets.video.nano;
import com.google.protobuf.nano.*;
import java.io.IOException;
// Referenced classes of package com.google.vr.sdk.widgets.video.nano:
// SphericalMetadataOuterClass
public static final class clear extends MessageNano
{
public static clear[] emptyArray()
{
if(_emptyArray == null)
synchronized(InternalNano.LAZY_INIT_LOCK)
{
if(_emptyArray == null)
_emptyArray = new _emptyArray[0];
}
return _emptyArray;
}
public _emptyArray clear()
{
x = 0.0F;
y = 0.0F;
z = 0.0F;
u = 0.0F;
v = 0.0F;
cachedSize = -1;
return this;
}
public void writeTo(CodedOutputByteBufferNano output)
throws IOException
{
if(Float.floatToIntBits(x) != Float.floatToIntBits(0.0F))
output.writeFloat(1, x);
if(Float.floatToIntBits(y) != Float.floatToIntBits(0.0F))
output.writeFloat(2, y);
if(Float.floatToIntBits(z) != Float.floatToIntBits(0.0F))
output.writeFloat(3, z);
if(Float.floatToIntBits(u) != Float.floatToIntBits(0.0F))
output.writeFloat(4, u);
if(Float.floatToIntBits(v) != Float.floatToIntBits(0.0F))
output.writeFloat(5, v);
super.writeTo(output);
}
protected int computeSerializedSize()
{
int size = super.computeSerializedSize();
if(Float.floatToIntBits(x) != Float.floatToIntBits(0.0F))
size += CodedOutputByteBufferNano.computeFloatSize(1, x);
if(Float.floatToIntBits(y) != Float.floatToIntBits(0.0F))
size += CodedOutputByteBufferNano.computeFloatSize(2, y);
if(Float.floatToIntBits(z) != Float.floatToIntBits(0.0F))
size += CodedOutputByteBufferNano.computeFloatSize(3, z);
if(Float.floatToIntBits(u) != Float.floatToIntBits(0.0F))
size += CodedOutputByteBufferNano.computeFloatSize(4, u);
if(Float.floatToIntBits(v) != Float.floatToIntBits(0.0F))
size += CodedOutputByteBufferNano.computeFloatSize(5, v);
return size;
}
public v mergeFrom(CodedInputByteBufferNano input)
throws IOException
{
do
{
int tag = input.readTag();
switch(tag)
{
case 0: // '\0'
return this;
default:
if(!WireFormatNano.parseUnknownField(input, tag))
return this;
break;
case 13: // '\r'
x = input.readFloat();
break;
case 21: // '\025'
y = input.readFloat();
break;
case 29: // '\035'
z = input.readFloat();
break;
case 37: // '%'
u = input.readFloat();
break;
case 45: // '-'
v = input.readFloat();
break;
}
} while(true);
}
public static v parseFrom(byte data[])
throws InvalidProtocolBufferNanoException
{
return (v)MessageNano.mergeFrom(new <init>(), data);
}
public static <init> parseFrom(CodedInputByteBufferNano input)
throws IOException
{
return (new <init>()).mergeFrom(input);
}
public volatile MessageNano mergeFrom(CodedInputByteBufferNano codedinputbytebuffernano)
throws IOException
{
return mergeFrom(codedinputbytebuffernano);
}
private static volatile mergeFrom _emptyArray[];
public float x;
public float y;
public float z;
public float u;
public float v;
public ()
{
clear();
}
}
| [
"wjfsanhe@126.com"
] | wjfsanhe@126.com |
5ca801d843d3b8dbcd66b1e07f3e84002a21d031 | f017d7635e4f6f40b9c50fb94033d9919b33a0d3 | /X_and_O/src/logic_x_o_server/Game.java | 700ccd3603322562af428ce39b55826c2d685185 | [] | no_license | sokolenko100/Study | 2da776b8bcfbfd9a39cc5c15151bd22d4a281994 | 80b88f7cf4257a824ed2fbcfa52cc313cf286eb1 | refs/heads/master | 2020-06-14T08:55:33.268217 | 2017-06-09T14:43:25 | 2017-06-09T14:43:25 | 75,208,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,228 | java | package logic_x_o_server;
public class Game extends Thread
{
static final int SIZE=3;
String[] field;
SClient client_1 =null;
SClient client_2 =null;
int x = 1;
int O = 2;
public Game(SClient client_1,SClient client_2)
{
field=new String[SIZE*SIZE];
for(int i=0;i<field.length;i++)
{
field[i]="";
}
this.client_1= client_1;
this.client_2 =client_2;
this.start();
}
@Override
public void run()
{
while (true)
{
if(client_1.rdsrv.answerFromClient.size()>0)
{
String str = client_1.rdsrv.answerFromClient.get(0);
client_2.wrtServ.sentResult(str);
client_1.rdsrv.answerFromClient.clear();
chouse(str);
}
if(client_2.rdsrv.answerFromClient.size()>0)
{
String str = client_2.rdsrv.answerFromClient.get(0);
client_1.wrtServ.sentResult(str);
client_2.rdsrv.answerFromClient.clear();
chouse(str);
}
try
{
Thread.sleep(100);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
public void chouse(String result)
{
String [] resultArray = result.split(":");
switch (resultArray[0])
{
case "push":
{
String nameP = resultArray[1];
String idButtonP = resultArray[2];
String type_x_or_o = resultArray[3];
if(!setFild( nameP, idButtonP, type_x_or_o ))
{
if(client_1.login.equals(nameP))
{
String play = "play:"+client_2.login;
//String push ="push:"+client_2.login+":"+resultArray[2]+":"+resultArray[3];
client_2.wrtServ.sentResult(play);
String wait = "wait:"+client_1.login;
client_1.wrtServ.sentResult(wait);
}
if(client_2.login.equals(nameP))
{
String play = "play:"+client_1.login;
// String push ="push:"+client_1.login+":"+resultArray[2]+":"+resultArray[3];
client_1.wrtServ.sentResult(play);
String wait = "wait:"+client_2.login;
client_2.wrtServ.sentResult(wait);
}
break;
}
}
}
}
public Boolean setFild(String nameP,String idButtonP,String type_x_or_o )
{
Boolean flag = true;
int id = Integer.parseInt(idButtonP);
if(type_x_or_o.equals("x"))
{
field[id]="X";
}
else
{
field[id]="O";
}
if(checkWin())
{
if(client_1.login.equals(nameP))
{
flag= false;
String win = "win:"+client_1.login;
client_1.wrtServ.sentResult(win);
String lost = "lost:"+client_2.login;
client_2.wrtServ.sentResult(lost);
}
if(client_2.login.equals(nameP))
{
flag= false;
String win = "win:"+client_2.login;
client_2.wrtServ.sentResult(win);
String lost = "lost:"+client_1.login;
client_1.wrtServ.sentResult(lost);
}
}
else if(checkDraw())
{
flag= false;
String draw = "draw:"+client_2.login;
client_2.wrtServ.sentResult(draw);
String draw2 = "draw:"+client_1.login;
client_1.wrtServ.sentResult(draw2);
}
return flag;
}
public Boolean checkDraw()
{
Boolean res = false;
int iter = 0;
for (int i = 0; i < field.length; i++)
{
if(!field[i].equals(""))
{
iter++;
}
}
if(iter==9)
{
res = true;
}
return res;
}
public Boolean checkWin()
{
Boolean res = false;
if( (field[0] + field[1] + field[2]).compareTo("XXX") == 0 || (field[0] + field[1] + field[2]).compareTo("OOO") == 0 )
res = true;
if( (field[3] + field[4] + field[5]).compareTo("XXX") == 0 || (field[3] + field[4] + field[5]).compareTo("OOO") == 0 )
res = true;
if( (field[6] + field[7] + field[8]).compareTo("XXX") == 0 || (field[6] + field[7] + field[8]).compareTo("OOO") == 0 )
res = true;
if( (field[0] + field[3] + field[6]).compareTo("XXX") == 0 || (field[0] + field[3] + field[6]).compareTo("OOO") == 0 )
res = true;
if( (field[1] + field[4] + field[7]).compareTo("XXX") == 0 || (field[1] + field[4] + field[7]).compareTo("OOO") == 0 )
res = true;
if( (field[2] + field[5] + field[8]).compareTo("XXX") == 0 || (field[2] + field[5] + field[8]).compareTo("OOO") == 0 )
res = true;
if( (field[0] + field[4] + field[8]).compareTo("XXX") == 0 || (field[0] + field[4] + field[8]).compareTo("OOO") == 0 )
res = true;
if( (field[2] + field[4] + field[6]).compareTo("XXX") == 0 || (field[2] + field[4] + field[6]).compareTo("OOO") == 0 )
res = true;
return res;
}
}
| [
"sokolenko100@gmail.com"
] | sokolenko100@gmail.com |
66270287fcfce6b170cc99985685d3c3a4b2f4be | a0a2c3f0e1c9445a28382cceb9a031c6627c7976 | /chap04/src/chap04_Exercise/Exercise05.java | c0ea3acabe784edbac74754ab89726079c53f527 | [] | no_license | yuhn126/Java | b8cb303d7e4e52bb83654b4f13eddd9be60aa258 | d5c9e74f71ef118535d701bf280136ddf0151551 | refs/heads/master | 2020-04-11T21:47:09.170244 | 2020-01-20T09:54:26 | 2020-01-20T09:54:26 | 162,115,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package chap04_Exercise;
public class Exercise05 {
public static void main(String[] args) {
//중첩 for문을 이용하여 방정식 4x+5y=60의 모든 해를 구해 (x,y)형태로 출력
int x = 0;
int y = 0;
for(x=1; x<=10; x++) {
for(y=1; y<=10; y++) {
if((4*x)+(5*y) == 60) {
System.out.println("(" + x + "," + y + ")");
}
}
}
}
}
| [
"yuhn126@naver.com"
] | yuhn126@naver.com |
8fb63a77831287feba00792798b42f85938a0ae9 | 758a627ad4de1ace49885034f08ba513beb69ed7 | /tirepressuremonitoringsystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/sensor/TestSensor.java | 705d7cd73648dc9311083a4553e160a7cae6f69a | [] | no_license | sebastianstoelen/codingkatas | debf0b6db47a832d2ec8221f4cbc7e94cfaa13c0 | 8f28c02e438502795917933b824e163c793e0167 | refs/heads/master | 2020-03-07T10:14:55.049299 | 2018-04-21T09:33:49 | 2018-04-21T09:33:49 | 127,426,926 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package tddmicroexercises.tirepressuremonitoringsystem.sensor;
public class TestSensor implements Sensor{
private double returnValue;
public void setReturnValue(double returnValue){
this.returnValue = returnValue;
}
public double popNextPressurePsiValue() {
return returnValue;
}
}
| [
"sebastian.stoelen@gmail.com"
] | sebastian.stoelen@gmail.com |
af72221717a13b4dab227ee429367ff54a3a3769 | f436ba4c05f3217c6e6f9e69cbe916b0b4de2310 | /source/spiralcraft/data/query/SetFilter.java | bfe9a55e598eafdaf78d0628ab7d716b3de13ca1 | [] | no_license | Spiralcraft/core | 0884fbaa790a1cb4260cc78766b083f873074585 | 94da8d1739238fe02d558d7e2c5073505551c451 | refs/heads/master | 2022-04-27T12:37:58.465986 | 2022-04-13T00:53:02 | 2022-04-13T00:53:02 | 17,853,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,424 | java | //
// Copyright (c) 2009 Michael Toth
// Spiralcraft Inc., All Rights Reserved
//
// This package is part of the Spiralcraft project and is licensed under
// a multiple-license framework.
//
// You may not use this file except in compliance with the terms found in the
// SPIRALCRAFT-LICENSE.txt file at the top of this distribution, or available
// at http://www.spiralcraft.org/licensing/SPIRALCRAFT-LICENSE.txt.
//
// Unless otherwise agreed to in writing, this software is distributed on an
// "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
//
package spiralcraft.data.query;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import spiralcraft.lang.Expression;
import spiralcraft.lang.Focus;
import spiralcraft.lang.Channel;
import spiralcraft.lang.BindException;
import spiralcraft.lang.IterationDecorator;
import spiralcraft.lang.TeleFocus;
//import spiralcraft.lang.parser.CurrentFocusNode;
//import spiralcraft.lang.parser.Node;
//import spiralcraft.lang.parser.ParentFocusNode;
//import spiralcraft.log.ClassLog;
import spiralcraft.log.Level;
import spiralcraft.data.DataException;
import spiralcraft.data.Tuple;
import spiralcraft.data.FieldSet;
import spiralcraft.data.Type;
import spiralcraft.data.access.ScrollableCursor;
import spiralcraft.data.access.SerialCursor;
/**
* <p>A Query operation which constrains the result of a source Query by
* testing a function of the result for inclusion in a set that is
* constant over the source result.
* </p>
*
* <p>The set is hash-indexed for a constant-time filter comparison
* </p>
*/
public class SetFilter<T>
extends Query
{
// private static final ClassLog log
// =ClassLog.getInstance(SetFilter.class);
private Expression<?> filterSetX;
private Expression<T> searchX;
private boolean excludeMatch;
{ mergeable=true;
}
public SetFilter()
{
}
/**
* Construct a Selection which reads data from the specified source Query and filters
* data according to the specified constraints expression.
*/
public SetFilter(Query source,Expression<?> filterSetX,Expression<T> searchX)
{
this.filterSetX=filterSetX;
this.searchX=searchX;
setSource(source);
}
@Override
public FieldSet getFieldSet()
{
if (sources.size()>0)
{ return sources.get(0).getFieldSet();
}
else
{ return null;
}
}
public SetFilter
(Selection baseQuery
,Expression<?> filterSetX
,Expression<T> searchX
)
{
super(baseQuery);
this.filterSetX=filterSetX;
this.searchX=searchX;
}
/**
* Specify the Expression which resolves to the set (something that can be
* iterated) that is used to filter the results.
*/
public void setFilterSetX(Expression<?> filterSetX)
{ this.filterSetX=filterSetX;
}
/**
* The Expression which resolves the value to search for within the set,
* as a function of the source tuple.
*
* @param searchX
*/
public void setSearchX(Expression<T> searchX)
{ this.searchX=searchX;
}
public void setSource(Query source)
{
type=source.getType();
addSource(source);
}
/**
*@return the Expression which resolves to the set
*/
public Expression<?> getFilterSetX()
{ return filterSetX;
}
/**
*@return the Expression which resolves the value to search for within the
* set, as a function of the source tuple.
*/
public Expression<T> getSearchX()
{ return searchX;
}
/**
* Specify that when the search value is found in the set, exclude the Tuple
* from the result instead of including it. Defaults to false.
*
* @param excludeMatch
*/
public void setExcludeMatch(boolean excludeMatch)
{ this.excludeMatch=excludeMatch;
}
public boolean getExcludeMatch()
{ return this.excludeMatch;
}
@Override
public <X extends Tuple> BoundQuery<?,X>
getDefaultBinding(Focus<?> focus,Queryable<?> store)
throws DataException
{ return new SetFilterBinding<T,X>(this,focus,store);
}
// private boolean referencesCurrentFocus(Node node)
// {
// if (node instanceof CurrentFocusNode)
// { return true;
// }
// if (node instanceof ParentFocusNode)
// { return false;
// }
//
// Node[] children=node.getSources();
// if (children!=null)
// {
// for (Node child:children)
// {
// if (child==null)
// { log.warning(node+" returned null child");
// }
// else if (referencesCurrentFocus(child))
// { return true;
// }
// }
// }
// return false;
// }
@Override
public String toString()
{ return super.toString()
+"[constraints="+filterSetX+"]: sources="
+getSources().toString();
}
}
class SetFilterBinding<Ti,Tt extends Tuple>
extends UnaryBoundQuery<SetFilter<Ti>,Tt,Tt>
{
private Focus<Tt> focus;
private IterationDecorator<?,Ti> decorator;
private Channel<Ti> searchChannel;
private boolean resolved;
private boolean excludeMatch;
public SetFilterBinding
(SetFilter<Ti> query
,Focus<?> paramFocus
,Queryable<?> store
)
throws DataException
{
super(query,query.getSources(),paramFocus,store);
this.excludeMatch=getQuery().getExcludeMatch();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void resolve() throws DataException
{
if (!resolved)
{
super.resolve();
try
{
Channel<?> setChannel=paramFocus.bind(getQuery().getFilterSetX());
decorator=setChannel.<IterationDecorator>decorate(IterationDecorator.class);
if (debugLevel.canLog(Level.FINE))
{ setChannel.setDebug(true);
}
}
catch (BindException x)
{ throw new DataException("Error binding searchX "+x,x);
}
focus= new TeleFocus<Tt>(paramFocus,sourceChannel);
if (debugLevel.canLog(Level.DEBUG))
{ log.fine("Binding searchX "+getQuery().getSearchX());
}
try
{
searchChannel=focus.bind(getQuery().getSearchX());
if (debugLevel.canLog(Level.FINE))
{ searchChannel.setDebug(true);
}
}
catch (BindException x)
{ throw new DataException("Error binding searchX "+x,x);
}
resolved=true;
}
}
@Override
protected SerialCursor<Tt> newSerialCursor(SerialCursor<Tt> source)
throws DataException
{ return new SelectionSerialCursor(source);
}
@Override
protected ScrollableCursor<Tt>
newScrollableCursor(ScrollableCursor<Tt> source)
throws DataException
{ return new SelectionScrollableCursor(source);
}
protected class SelectionSerialCursor
extends UnaryBoundQuerySerialCursor
{
protected final Collection<Ti> set;
public SelectionSerialCursor(SerialCursor<Tt> source)
throws DataException
{
super(source);
set=new HashSet<Ti>();
Iterator<Ti> iterator=decorator.iterator();
if (iterator!=null)
{
while (iterator.hasNext())
{ set.add(iterator.next());
}
}
}
@Override
protected boolean integrate()
{
Tt t=sourceChannel.get();
if (t==null)
{
if (debugFine)
{ log.fine(toString()+"BoundSetFilter: eod ");
}
return false;
}
if (set.contains(searchChannel.get()) ^ excludeMatch)
{
if (debugFine)
{ log.fine(toString()+"BoundSetFilter: passed "+t);
}
dataAvailable(t);
return true;
}
else
{
if (debugFine)
{ log.fine(toString()+"BoundSetFilter: filtered "+t);
}
return false;
}
}
@Override
public Type<?> getResultType()
{
Type<?> ret=sourceCursor.getResultType();
if (ret!=null)
{ return ret;
}
else
{
log.fine("Source cursor result type is null "+sourceCursor);
return null;
}
}
}
protected class SelectionScrollableCursor
extends UnaryBoundQueryScrollableCursor
{
protected final Collection<Ti> set;
public SelectionScrollableCursor(ScrollableCursor<Tt> source)
throws DataException
{
super(source);
set=new HashSet<Ti>();
Iterator<Ti> iterator=decorator.iterator();
if (iterator!=null)
{
while (iterator.hasNext())
{ set.add(iterator.next());
}
}
}
@Override
protected boolean integrate()
{
Tt t=sourceChannel.get();
if (t==null)
{
if (debugFine)
{ log.fine("BoundSetFilter: eod ");
}
return false;
}
if (set.contains(searchChannel.get()) ^ excludeMatch)
{
if (debugFine)
{ log.fine("BoundSetFilter: passed "+t);
}
dataAvailable(t);
return true;
}
else
{
if (debugFine)
{ log.fine("BoundSetFilter: filtered "+t);
}
return false;
}
}
@Override
public Type<?> getResultType()
{
Type<?> ret=scrollableSourceCursor.getResultType();
if (ret!=null)
{ return ret;
}
else
{
log.fine("Source cursor result type is null "+scrollableSourceCursor);
return null;
}
}
}
} | [
""
] | |
effd0a49c720164033e8a1c2882383093a39ccf4 | 1bc191fa50b0dd534c647fa00d81d240b52d1597 | /src/main/java/com/highfi/sys/collections/list/Shipment.java | 20afada43c0a7ce7b9db9ce4accb2f3639a78141 | [] | no_license | alimslimani/Java | fc3aaef4e33adcd6e817732ab14ad1386eaf7ee6 | d71b6b116b14fbaef0e2e64a7e2ee0a23fd914e2 | refs/heads/master | 2021-07-18T20:53:01.418173 | 2019-12-11T09:26:49 | 2019-12-11T09:26:49 | 223,439,290 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,999 | java | package com.highfi.sys.collections.list;
import com.highfi.sys.collections.Product;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;
public class Shipment implements Iterable<Product> {
private static final int LIGHT_VAN_MAX_WEIGHT = 20;
public static final int PRODUCT_NOT_PRESENT = -1;
private final List<Product> products = new ArrayList<>();
private List<Product> lightVanProducts;
private List<Product> heavyVanProducts;
@Override
public Iterator<Product> iterator() {
return products.iterator();
}
@Override
public void forEach(Consumer<? super Product> action) {
}
@Override
public Spliterator<Product> spliterator() {
return null;
}
public void add(Product product) {
products.add(product);
}
public void replace(Product oldProduct, Product newProduct) {
final int index = products.indexOf(oldProduct);
if (index != PRODUCT_NOT_PRESENT) {
products.set(index, newProduct);
}
}
public void prepare() {
// Sort our list of products by weight
products.sort(Product.BY_WEIGHT);
// find the product index that needs the heavy van
int splitPoint = findSplitPoint();
// assign views of the products list for heavy and light vans
lightVanProducts = products.subList(0, splitPoint);
heavyVanProducts = products.subList(splitPoint, products.size());
}
private int findSplitPoint() {
for (int i = 0; i < products.size(); i++) {
final Product product = products.get(i);
if (product.getWeight() > LIGHT_VAN_MAX_WEIGHT) {
return i;
}
}
return 0;
}
public List<Product> getLightVanProducts() {
return lightVanProducts;
}
public List<Product> getHeavyVanProducts() {
return heavyVanProducts;
}
}
| [
"slimanialim@yahoo.fr"
] | slimanialim@yahoo.fr |
21f9e43a969dff7cb019362d1a0d58934ec3f716 | 7cfddad05e763d6cc9ba4bb85f90035962544ecb | /src/Entities/Jaime.java | 55bb3c31340642a2d2d842b238b077f836c164af | [] | no_license | CharfeddineMohamedAli/GestionEcole | ad4dfdd47a0641084076b86f619007a117aae07c | 94ffa8a9a52422c50bf65ec69abb1b91121dc286 | refs/heads/master | 2022-04-06T13:23:52.793121 | 2020-02-27T03:16:56 | 2020-02-27T03:16:56 | 240,025,460 | 0 | 7 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Entities;
/**
*
* @author hp
*/
public class Jaime {
private int Id_User;
private int Id_Sujet;
private int valeur_jaime;
public Jaime() {
}
public Jaime(int Id_user, int Id_Sujet, int valeur_jaime) {
this.Id_User = Id_user;
this.Id_Sujet = Id_Sujet;
this.valeur_jaime = valeur_jaime;
}
public int getId_user() {
return Id_User;
}
public void setId_user(int Id_user) {
this.Id_User = Id_user;
}
public int getId_Sujet() {
return Id_Sujet;
}
public void setId_Sujet(int Id_Sujet) {
this.Id_Sujet = Id_Sujet;
}
public int getValeur_jaime() {
return valeur_jaime;
}
public void setValeur_jaime(int valeur_jaime) {
this.valeur_jaime = valeur_jaime;
}
}
| [
"38545873+CharfeddineMohamedAli@users.noreply.github.com"
] | 38545873+CharfeddineMohamedAli@users.noreply.github.com |
0073e492731984db8eb834f78a63fddf60542585 | 982461e1befc08adb70dd870cf326eed07ba1375 | /app/src/main/java/com/example/recipe_app/executors/AppExecutors.java | 328c327d3294e15be13d8626c8e9e3adbb38a592 | [] | no_license | younes778/Recipe_App | 1fb4b01077a6e3d603f9a2e6541025781e65c7ad | 811579529f767b235bd3919c33549c0f5a194fc3 | refs/heads/master | 2020-05-02T22:18:00.422910 | 2019-04-02T22:42:06 | 2019-04-02T22:42:06 | 178,247,895 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.example.recipe_app.executors;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
public class AppExecutors {
private static AppExecutors instance;
public static AppExecutors getInstance(){
if (instance==null)
instance = new AppExecutors();
return instance;
}
private final ScheduledExecutorService networkIO = Executors.newScheduledThreadPool(3);
public ScheduledExecutorService networkIO(){
return networkIO;
}
}
| [
"by_sennadj@esi.dz"
] | by_sennadj@esi.dz |
8da5abe192ba787b3f7452c584e71a74bcd965e9 | cd1f70fcb84e82667f4969093feed9138a94499a | /java8-streams/map/jbr/java8/streams/map/StreamsMapMapExample.java | 74961d08c46c33c5f04eb3b45158971169a9ad19 | [] | no_license | javabyranjith/java8 | e866d743b9f9acb6c59bfd45c08fcddbd2280b44 | 01bc66f40629714bff12c81c252cc52f77d2884e | refs/heads/master | 2021-06-18T17:59:17.539222 | 2020-02-20T17:34:28 | 2020-02-20T17:34:28 | 89,729,670 | 1 | 3 | null | 2020-10-13T02:44:44 | 2017-04-28T17:33:44 | Java | UTF-8 | Java | false | false | 1,544 | java | package jbr.java8.streams.map;
import java.util.HashMap;
import java.util.Map;
public class StreamsMapMapExample {
public static void main(String[] args) {
Map<String, Object> input = new HashMap<>();
input.put("A", "Anbu");
input.put("C", "Chandru");
input.put("B", "Bala");
Map<String, String> innerMap = new HashMap<>();
innerMap.put("E", "Edward");
innerMap.put("D", "Dinesh");
input.put("G", innerMap);
// print the map
System.out.println("===Original Map");
for (Map.Entry<String, Object> map : input.entrySet()) {
System.out.println("Key: " + map.getKey() + ", Value: " + map.getValue());
}
System.out.println("\n===Print Map Keys");
input.entrySet()
.stream()
.map(p -> p.getKey())
.forEach(System.out::println);
System.out.println("\n===Print Map Values");
input.entrySet()
.stream()
.map(p -> p.getValue())
.forEach(System.out::println);
System.out.println("\n===Print Inner Map Keys");
input.entrySet()
.stream()
.filter(v -> v.getKey()
.equals("G"))
// .flatMap(a -> a.) TODO
.forEach(System.out::println);
System.out.println("\n===Print Inner Map Values");
input.entrySet()
.stream()
.filter(v -> v.getKey()
.equals("G"))
.flatMap(a -> ((Map<String, String>) a.getValue()).values()
.stream())
.forEach(System.out::println);
}
}
| [
"java2ranjith@gmail.com"
] | java2ranjith@gmail.com |
c0b3b5ec4717d7fe6223055bbc2dfe047e7ef0dc | 32d27ea3a6edf4d9f772e6b5c23bf392d043f7ce | /java/src/main/java/codeforces/problem/old/dec/Task1359_C.java | 57907640eb61f0b07f2a3e83cd8a72cb51ae5033 | [] | no_license | 1ou/code_tasks | 1c6de938c55275bec8b06f4199d297c76a29ef34 | c0b9c90c9adb56424fdd2b9fc5f6f7a7a65c1cea | refs/heads/master | 2023-06-01T03:11:02.977210 | 2021-06-18T19:53:15 | 2021-06-18T19:53:15 | 202,960,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,509 | java | package codeforces.problem.old.dec;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.StringTokenizer;
/*
https://codeforces.com/problemset/problem/1359/B
1
41 15 30
*/
public class Task1359_C {
static void solve() {
long h = FS.nextLong();
long c = FS.nextLong();
long t = FS.nextLong();
if (h + c - 2 * t >= 0)
FS.pt.println("2");
else {
long a = h - t;
long b = 2 * t - c - h;
long k = 2 * (a / b) + 1;
long val1 = Math.abs(k / 2 * c + (k + 1) / 2 * h - t * k);
long val2 = Math.abs((k + 2) / 2 * c + (k + 3) / 2 * h - t * (k + 2));
FS.pt.println(val1 * (k + 2) <= val2 * k ? k : k + 2);
}
}
public static void main(String[] args) {
int T = FS.nextInt();
for (int tt = 0; tt < T; tt++) {
solve();
}
FS.pt.close();
}
static class FS {
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st = new StringTokenizer("");
static PrintWriter pt = new PrintWriter(System.out);
static String next() {
while (!st.hasMoreTokens())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
static int nextInt() {
return Integer.parseInt(next());
}
static int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
static double nextDouble() {
return Double.parseDouble(next());
}
static int[][] read2Array(int n, int m) {
int[][] a = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
a[i][j] = nextInt();
}
}
return a;
}
static long[][] read2ArrayL(int n, int m) {
long[][] a = new long[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
a[i][j] = nextLong();
}
}
return a;
}
void printArr(long[] arr) {
for (long value : arr) {
pt.print(value);
pt.print(" ");
}
pt.println();
}
static long[] readArrayL(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++) a[i] = nextLong();
return a;
}
static void printArr(int[] arr) {
for (int value : arr) {
pt.print(value);
pt.print(" ");
}
pt.println();
}
static void printArrL(int[] arr) {
for (int value : arr) {
pt.print(value);
pt.print(" ");
}
pt.println();
}
static void print2Arr(int[][] arr, int n, int m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
pt.print(arr[i][j]);
pt.print(" ");
}
pt.println();
}
pt.println();
}
static void print2Arr(long[][] arr, int n, int m) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
pt.print(arr[i][j]);
pt.print(" ");
}
pt.println();
}
pt.println();
}
static List<Long> readListLong(int n) {
List<Long> list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(nextLong());
}
return list;
}
static List<Integer> readListInt(int n) {
List<Integer> list = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
list.add(nextInt());
}
return list;
}
static <T> void printList(List<T> list) {
for (T value : list) {
pt.print(value);
pt.print(" ");
}
pt.println();
}
static void close() {
pt.close();
}
static long nextLong() {
return Long.parseLong(next());
}
}
static class NumberTheory {
public static long gcd(long a, long b) {
while (b != 0) {
long tmp = a % b;
a = b;
b = tmp;
}
return a;
}
public static long lcm(long a, long b) {
return a * b / gcd(a, b);
}
public static List<Long> primeFactors(long n) {
List<Long> ans = new ArrayList<>();
while (n % 2 == 0) {
ans.add(2L);
n /= 2;
}
// n must be odd at this point. So we can
// skip one element (Note i = i + 2)
for (long i = 3; i <= Math.sqrt(n); i += 2) {
// While i divides n, print i and divide n
while (n % i == 0) {
ans.add(i);
n /= i;
}
}
// This condition is to handle the case when
// n is a prime number greater than 2
if (n > 2) {
ans.add(n);
}
return ans;
}
}
static class Pair<T, K> {
T first;
K second;
public Pair(T first, K second) {
this.first = first;
this.second = second;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pair<?, ?> pair = (Pair<?, ?>) o;
return Objects.equals(first, pair.first) &&
Objects.equals(second, pair.second);
}
@Override
public int hashCode() {
return Objects.hash(first, second);
}
}
}
| [
"anton.skubyev@binance.com"
] | anton.skubyev@binance.com |
91f768b07c23bf3efabcb917df94c827ea614d97 | d06c35f0197cdb10aed87bd3af0c6e4ffcc54550 | /src/com/hdc/mycasino/model/MyObj.java | 746e2aa405ab37b3ee51f1f73eff32feac33a397 | [] | no_license | canh7antt8a/thanbai-giaodienmoi | f4f354d12db90c614553aa94ee87a7edb1811303 | d51db185dfd6058f28da53d5caed6df9dce29e4f | refs/heads/master | 2020-04-26T07:37:05.522123 | 2012-11-03T04:50:41 | 2012-11-03T04:50:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,034 | java | package com.hdc.mycasino.model;
import com.danh.standard.Graphics;
import com.hdc.mycasino.utilities.FrameImage;
public abstract class MyObj {
public String itemName = "";
public int itemId;
public abstract void paintIcon(Graphics g, int x, int y);
public abstract void paintInRow(Graphics g, int x, int y, int width, int height);
public abstract void paintInfo(Graphics g, int x, int y);
public abstract void paintInfo_Item(Graphics g, int x, int y, int width, int height,
MyObj myObj, int type, int m_widthItem);
public abstract void focusItem();
public abstract void paintItem(Graphics g, float x, float y, int m_IdFrame, int select,
FrameImage m_frame);
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final MyObj other = (MyObj) obj;
if (this.itemId != other.itemId) {
return false;
}
return true;
}
public int hashCode() {
int hash = 7;
return hash;
}
}
| [
"phanthanhdanh200605@gmail.com@aec43717-8996-1c64-2573-041b0b196689"
] | phanthanhdanh200605@gmail.com@aec43717-8996-1c64-2573-041b0b196689 |
257af3bdef5c404ec16905edd96c673d42094d30 | 65ce55309ddac51f8044b9378854e6312084542d | /gmall-manage-service/src/main/java/com/yuan/gmall/manage/mapper/PmsBaseCatalog1Mapper.java | 53223ed33d4119972e26593fe5ff558c8833c831 | [] | no_license | Daydream50/MyItem | cdb0614566e9c4ebed7ae239eb3efc3966db4001 | 79c3dd6a0510187ead067424de0cd6a0abe03227 | refs/heads/master | 2022-11-22T08:25:24.910111 | 2020-02-28T01:50:05 | 2020-02-28T01:50:05 | 227,843,394 | 0 | 0 | null | 2022-11-15T23:55:01 | 2019-12-13T13:12:47 | CSS | UTF-8 | Java | false | false | 199 | java | package com.yuan.gmall.manage.mapper;
import com.yuan.gmall.bean.PmsBaseCatalog1;
import tk.mybatis.mapper.common.Mapper;
public interface PmsBaseCatalog1Mapper extends Mapper<PmsBaseCatalog1> {
}
| [
"471852478@qq.com"
] | 471852478@qq.com |
fdb421f65894d325d99b536769312e94e7600fbc | 74f723bee36229fa9d447e63d99c70d2a62dc193 | /roncoo-education-course/roncoo-education-course-common/src/main/java/com/roncoo/education/course/common/bean/qo/AdvQO.java | dcbf6da42b5ea7fcf58882664b4199b80ac1b1ee | [
"MIT"
] | permissive | Arronzheng/roncoo-education | 714568d864d5098052c44b34d9c4f730fc551af9 | 1afb481d4269597e1cebc339a8d257caaad9279a | refs/heads/master | 2022-09-13T13:45:22.315597 | 2020-07-29T01:52:22 | 2020-07-29T01:52:22 | 220,367,025 | 1 | 0 | MIT | 2022-09-01T23:15:24 | 2019-11-08T02:05:26 | Java | UTF-8 | Java | false | false | 1,207 | java | package com.roncoo.education.course.common.bean.qo;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 广告信息
*/
@Data
@Accessors(chain = true)
public class AdvQO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 当前页
*/
private int pageCurrent;
/**
* 每页记录数
*/
private int pageSize;
/**
* 主键
*/
private Long id;
/**
* 创建时间
*/
private Date gmtCreate;
/**
* 修改时间
*/
private Date gmtModified;
/**
* 状态(1:正常,0:禁用)
*/
private Integer statusId;
/**
* 排序
*/
private Integer sort;
/**
* 广告标题
*/
private String advTitle;
/**
* 广告图片
*/
private String advImg;
/**
* 广告链接
*/
private String advUrl;
/**
* 广告跳转方式
*/
private String advTarget;
/**
* 广告位置(1首页轮播)
*/
private Integer advLocation;
/**
* 开始时间
*/
private Date beginTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 位置(0电脑端,1微信端)
*/
private Integer platShow;
private String beginTimeString;
private String endTimeString;
}
| [
"1175674846@qq.com"
] | 1175674846@qq.com |
fc618353304723cb20ccd8d25c2ffa1e498bd34b | 4d1a438ee0c80053e33431d10683ce4872118957 | /dumbhippo/branches/linux-client-1-1-32-bugfix/taste/src/main/com/planetj/taste/recommender/ItemFilter.java | 081333eea1e3f90c476d6f842aed38ad9f3792e9 | [
"Apache-2.0"
] | permissive | nihed/magnetism | 7a5223e7dd0ae172937358c1b72df7e9ec5f28b8 | c64dfb9b221862e81c9e77bb055f65dcee422027 | refs/heads/master | 2016-09-05T20:01:07.262277 | 2009-04-29T06:48:39 | 2009-04-29T06:48:39 | 39,454,577 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | /*
* Copyright 2005 Sean Owen
*
* 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.planetj.taste.recommender;
import com.planetj.taste.model.Item;
/**
* <p>A simple interface whose implementations define "item filters", some
* logic which accepts some items and rejects others. For example, an application
* might define an implementation that only accepts items in a certain category
* of items.</p>
*
* @author Sean Owen
* @see Recommender#recommend(Object, int, ItemFilter)
*/
public interface ItemFilter {
/**
* @param item
* @return true iff this filter accepts the {@link Item}
*/
boolean isAccepted(Item item);
}
| [
"otaylor@69951b7c-304f-11de-8daa-cfecb5f7ff5b"
] | otaylor@69951b7c-304f-11de-8daa-cfecb5f7ff5b |
1f449db87dce1727c429b0beed47e50befe492bf | d72c4c1ec969e9ef5092b2301c04741bc8198ee7 | /ssh/src/com/ssh/dao/StudentDao.java | 0ac39cd3c4fa267a0391dbf3ae32d2adc65122a4 | [] | no_license | Antlion1996/Student_sys | dc5feebce7193963328254bf1c08bbe5f3bb0a44 | e358fc2c953273d149c9b922b53e65b3e61a7eaa | refs/heads/master | 2020-03-21T15:07:17.590776 | 2018-06-26T07:06:54 | 2018-06-26T07:06:54 | 138,695,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.ssh.dao;
import java.util.List;
import com.ssh.model.Student;
/**
*
* 有关对学生信息CRUD管理的接口
*
*/
public interface StudentDao {
//添加学生信息
public Integer save(Student student);
//学号是否存在的验证
public boolean exists(int id);
//通过id获取学生信息
public Student getById(int id);
//获取学生信息列表
public List<Student> getStudents();
//修改学生信息
public void update(Student student);
//删除学生信息
public void delete(int id);
//修改登录密码
public void updatePwd(int id, String password);
}
| [
"1065853063@qq.com"
] | 1065853063@qq.com |
461a1412b22468d5cffcb761ee0b20ffa72f9a85 | 23604ffacfa0fd0cfaa1cae86946427199ca6593 | /src/main/java/utils/ThrottleCountBatcher.java | 05893e3ecf3c20a67eb9d7aafab06a2e5f54593a | [] | no_license | kleingomes-zz/throttle | 718615a3d788f341f5d39e968c8c4199b84b84eb | f02e8ab084f56c40c35e216e7ee32b6a2e4f5a75 | refs/heads/master | 2023-01-21T00:04:04.051636 | 2019-03-16T22:06:28 | 2019-03-16T22:06:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package utils;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.List;
public class ThrottleCountBatcher<T> {
private List<T> batchList;
private int batchCount;
public ThrottleCountBatcher(int batchCount) {
this.batchCount = batchCount;
this.batchList = new ArrayList<>();
}
public void append(T event) {
batchList.add(event);
}
public List<List<T>> getBatches() {
return Lists.partition(this.batchList, batchCount);
}
}
| [
"klein.gomes@samsung.com"
] | klein.gomes@samsung.com |
9c996015bcbe87eec39a58df7b38f8975c9f7280 | c151381a914d65ab637b40d2a0d824b21854036e | /src/test/java/edu/brown/cs/rfameli1_sdiwan2_tfernan4_tzaw/APIHandlers/dialectTranslation/TranslationsAPIHandlerTest.java | b081eb08bda56fbe7a96486358d3267b3b49e9c2 | [] | no_license | r-fameli/journaltexter | 5685d9804b3f9fc11620fcfc1e8b8dc8fc542829 | 5cd64b8914aaec59be4904f7cd797208c7544325 | refs/heads/backend-testing | 2023-05-31T15:57:09.227291 | 2021-04-15T15:19:04 | 2021-04-15T15:19:04 | 375,487,476 | 0 | 0 | null | 2021-06-09T21:03:13 | 2021-06-09T20:57:49 | Java | UTF-8 | Java | false | false | 1,226 | java | //package edu.brown.cs.rfameli1_sdiwan2_tfernan4_tzaw.APIHandlers.dialectTranslation;
//
//import edu.brown.cs.rfameli1_sdiwan2_tfernan4_tzaw.APIHandlers.wordSyonyms.WordnikAPIHandler;
//import org.junit.Test;
//
//import java.util.HashSet;
//import java.util.Set;
//
//import static org.junit.Assert.assertEquals;
//
//public class TranslationsAPIHandlerTest {
// @Test
// public void convertToDialect_OriginalText() {
// TranslationsAPIHandler trans = new TranslationsAPIHandler();
// String text = "Hello there everybody I'm really happy because haha yup I don't know why please help";
// String translated = trans.convertToDialect(text, DialectType.AMERICAN);
//
// assertEquals(text, translated);
// }
//
// @Test
// public void convertToDialect_PirateText() {
// TranslationsAPIHandler trans = new TranslationsAPIHandler();
// String text = "Hello there everybody I'm really happy because haha yup I don't know why please help";
// String translated = trans.convertToDialect(text, DialectType.PIRATE);
//
// String expectedTranslation = "Ahoy thar everybody I be mighty happy 'cause har har har aye I dunno why please help";
//
// assertEquals(expectedTranslation, translated);
// }
//}
| [
"rikifameli@gmail.com"
] | rikifameli@gmail.com |
0f85def9ca239298ec2ddddcd0ba6df21ba4a1fb | e6314f59dba1aaac8fe11ed36fcd2ab5c97dbf35 | /src/Player/RealTimePlayer.java | ecb78b0094bacdba8d1d914be610a3a1aa72d6d6 | [] | no_license | akashgarg98/Risk-game | 7794c03d60a4c76e6d85028c7cd9667c94978975 | 06e3859ab1a090d349b7e5b3e0e6009a2d0fe971 | refs/heads/master | 2022-01-22T15:19:38.848835 | 2019-08-02T13:24:04 | 2019-08-02T13:24:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,299 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Player;
import State.State;
import java.awt.Color;
import java.util.Collections;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Set;
import javax.swing.ImageIcon;
import static risk.game.RiskGame.currentPlayer;
import static risk.game.RiskGame.gameTerritory;
import static risk.game.RiskGame.getIcon;
import static risk.game.RiskGame.players;
import risk.game.Territory;
/**
*
* @author Ahmed
*/
public class RealTimePlayer extends AbstractPlayer {
public static ImageIcon AStarSearchIcon = getIcon("AStar Search.jpg");
private State nextState;
private boolean attackerSelected = false;
private boolean startAdding1 = true;
public RealTimePlayer(Color color) {
super(color);
}
@Override
public ImageIcon Icon() {
return AStarSearchIcon;
}
@Override
public String getName() {
return "realtime";
}
private void realTimeSearch(State initalState,boolean attacking)
{
PriorityQueue<State> frontier = new PriorityQueue(Collections.reverseOrder());
frontier.add(initalState);
Set<int[][]> explored = new HashSet<>();
explored.add(initalState.id);
State state = frontier.remove();
for(State neighbor:state.neighbors(attacking,true,1))
{
frontier.add(neighbor);
explored.add(neighbor.id);
}
while(!frontier.isEmpty())
{
this.T++;
state = frontier.remove();
if(state.enemyTerritories.isEmpty() || state.heuristic >= initalState.heuristic+10000)
{
setPath(state);
break;
}
for(State neighbor:state.neighbors(!state.endAttack,true,state.depth+1))
{
if(!explored.contains(neighbor.id))
{
frontier.add(neighbor);
explored.add(neighbor.id);
}
}
}
}
@Override
protected Territory getTerritoryToAdd() {
if(nextState != null &&nextState.noBounsArmies())
startAdding1 = true;
if(this.startAdding1)
{
realTimeSearch(new State(territories,players[(currentPlayer+1)%2].getTerritories(),gameTerritory,noOfAdditionalArmies),false);
startAdding1 = false;
}
return gameTerritory[nextState.getNextTerritoryToAdd().id];
}
@Override
public Territory getAttacker() {
if(!attackerSelected)
{
realTimeSearch(new State(territories,players[(currentPlayer+1)%2].getTerritories(),gameTerritory,noOfAdditionalArmies),true);
}
attackerSelected = false;
if(nextState.attacker != null)
return gameTerritory[nextState.attacker.id];
else
return null;
}
@Override
public Territory getDefender() {
return gameTerritory[nextState.defender.id];
}
private void setPath(State finalState)
{
State[] path = new State[finalState.depth+1];
State state= finalState;
while(state != null)
{
path[state.depth] = state;
state = state.parent;
}
nextState = path[1];
}
@Override
protected void setNOofAttackingArmies() {
attacker.noOfFightingArmies = nextState.attacker.noOfFightingArmies;
}
@Override
public boolean continueAttacking()
{
if(this.canAttack())
{
realTimeSearch(new State(territories,players[(currentPlayer+1)%2].getTerritories(),gameTerritory,noOfAdditionalArmies),true);
if(nextState.attacker != null && gameTerritory[nextState.attacker.id] == attacker && gameTerritory[nextState.defender.id] == defender)
return true;
attackerSelected = true;
}
return false;
}
}
| [
"Ahmed@DESKTOP-98381DK"
] | Ahmed@DESKTOP-98381DK |
7b375edb9cb7586c5508a61cb478be5ec5a5e980 | d86e10c0924b4b329b7e2b6bc34ee1aec17258df | /Java-Sequence/part6/Pair.java | fcc8faceef5635b7d9fdcab06e9a4402c1033c4d | [] | no_license | chauvincent/ProgrammingLanguages | 117896fa4db14e5dfe4c0a4b8b796dcb9f264b08 | a963ceb1f9338a2e2352fef8a86710a90a9b5515 | refs/heads/master | 2021-01-18T12:33:13.938016 | 2015-12-15T23:30:00 | 2015-12-15T23:30:00 | 48,074,723 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | public class Pair extends Element{
private MyChar key;
private Element value;
public Pair (MyChar c, Element d){ key = c; value = d;}
public MyChar getKey(){ return key; }
public Element getVal(){ return value; }
public void Print(){
System.out.print("(");
key.Print();
System.out.print(" ");
value.Print();
System.out.print(")");
}
}
| [
"vichau@ucdavis.edu"
] | vichau@ucdavis.edu |
5569b5650142fec75f1b1e3d495e41de240f4f3a | 410a6f10185526c56f3b299287e366d282d49b2a | /net.solarnetwork.external.ocpp/src/ocpp/domain/SchemaValidationException.java | 2ca8b3c6e6f4a45bb7a39691dd5b99d81d2d2ef9 | [] | no_license | SolarNetwork/solarnetwork-external | 9d9c1e30de6bf2f977da61c51175abada37766ad | 82e67fa18035f2448785609df73212f09d9c94b0 | refs/heads/master | 2023-08-18T07:54:31.164740 | 2023-08-11T20:14:03 | 2023-08-11T20:14:03 | 6,083,749 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,541 | java | /* ==================================================================
* SchemaValidationException.java - 3/02/2020 3:14:12 pm
*
* Copyright 2020 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/
package ocpp.domain;
/**
* Exception for when schema validation fails for an object or message.
*
* @author matt
* @version 1.0
*/
public class SchemaValidationException extends RuntimeException {
private static final long serialVersionUID = 5519379160853548931L;
private final Object source;
/**
* Default constructor.
*/
public SchemaValidationException(Object source) {
super();
this.source = source;
}
/**
* Constructor.
*
* @param source
* the source of the validation failure, for example the message
* object
* @param message
* the message
*/
public SchemaValidationException(Object source, String message) {
super(message);
this.source = source;
}
/**
* Constructor.
*
* @param source
* the source of the validation failure, for example the message
* object
* @param cause
* the cause
*/
public SchemaValidationException(Object source, Throwable cause) {
super(cause);
this.source = source;
}
/**
* Constructor.
*
* @param source
* the source of the validation failure, for example the message
* object
* @param message
* the message
* @param cause
* the cause
*/
public SchemaValidationException(Object source, String message, Throwable cause) {
super(message, cause);
this.source = source;
}
/**
* Get the source of the validation failure, for example the original
* message object.
*
* @return the source object
*/
public Object getSource() {
return source;
}
}
| [
"matt@solarnetwork.net"
] | matt@solarnetwork.net |
dd8ff0db4939cdbc628c89436bb4946ed000b70d | ea5aa123f6e02b67349ddbea975eaa077c15dbd6 | /src/main/java/com/example/demo/Controller.java | 3848dc53eb769784aa1d22741727fc95d6b2077f | [] | no_license | hariom-sinha58/SpringBootInterceptor | bf3ece123dec41cf7a01e5d3e7a645307805a976 | 96f9592b0ded64112342dd4bff3a976100180a05 | refs/heads/master | 2022-11-27T14:16:20.747241 | 2020-07-30T15:48:09 | 2020-07-30T15:48:09 | 283,815,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.example.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Controller {
@RequestMapping(value="/intercept", method=RequestMethod.GET)
public String intercept() {
return "Interceptor Works";
}
}
| [
"sinhahariom1@gmail.com"
] | sinhahariom1@gmail.com |
5f197cd20fad398307d0e3ac1c9e01026c740173 | 024d9ae1a4aed9a550554e64b3e1b8fa61e46ccc | /Server/src/server/ServerThread.java | 174a2d2676ac832b31995f1bb7f9eaeefbf54974 | [] | no_license | QuietOne/FONup | 37b44298a0cbad09551bb1b3c390d433000753c5 | 16c0e3a40ff9dcdf229e69d890287819a6890676 | refs/heads/master | 2016-09-06T20:00:24.169243 | 2014-11-04T12:03:19 | 2014-11-04T12:03:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,815 | java | package server;
import game.protocol.GameProtocol;
import game.protocol.Status;
import game.protocol.objects.ClientRequest;
import game.protocol.objects.ServerResponse;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Class for threading.
*
* @author Tihomir Radosavljevic
* @author Jelena Tabas
* @version 1.0
*/
public class ServerThread extends Thread {
Socket socket;
public ServerThread(Socket socket) {
this.socket = socket;
}
@Override
public void run() {
try {
startCommunication();
} catch (IOException | ClassNotFoundException ex) {
Logger.getLogger(ServerThread.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void startCommunication() throws IOException, ClassNotFoundException {
while (true) {
ObjectInputStream inputStream
= new ObjectInputStream(socket.getInputStream());
ClientRequest clientRequest
= (ClientRequest) inputStream.readObject();
processRequest(clientRequest);
}
}
private synchronized void processRequest(ClientRequest clientRequest) throws IOException {
GameProtocol protocol = clientRequest.getGameProtocol();
ServerResponse serverResponse = new ServerResponse();
serverResponse.setStatus(Status.NOT_COMPLETE);
System.out.println(clientRequest.getGameProtocol());
switch (protocol) {
case VALIDATION_CLIENT:
serverResponse.setObject(ServerController.getInstance().validationClient(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case LOGIN_CLIENT:
serverResponse.setObject(ServerController.getInstance().loadClient(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case LOAD_HIGHSCORES:
serverResponse.setObject(ServerController.getInstance().loadHighScores(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case LOAD_TOP_HIGHSCORES:
serverResponse.setObject(ServerController.getInstance().loadTopHighScores(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case ADD_RESULT:
serverResponse.setObject(ServerController.getInstance().addResult(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case PREPARE_REGISTER:
serverResponse = ServerController.getInstance().prepareRegister(clientRequest);
break;
case REGISTER:
ServerController.getInstance().register(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case LOAD_CATEGORY_TREE:
serverResponse.setObject(ServerController.getInstance().loadCategoryTree(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case CHANGE_CLIENT_INFO:
ServerController.getInstance().changeClientInformation(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case DELETE_CATEGORY:
ServerController.getInstance().deleteCategory(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case CHANGE_CATEGORY:
ServerController.getInstance().changeCategory(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case ADD_CATEGORY:
ServerController.getInstance().addCategory(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case AUTOCOMPLETE_CLIENT:
serverResponse.setObject(ServerController.getInstance().autocompleteClient(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case DELETE_CLIENT:
ServerController.getInstance().deleteClient(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case DELETE_CLIENTS:
ServerController.getInstance().deleteClients(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case APPROVE_CATEGORY:
ServerController.getInstance().approveCategory(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case APPROVE_CLIENT:
ServerController.getInstance().approveClient(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case APPROVE_QUESTION:
ServerController.getInstance().approveQuestion(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case ADD_QUESTION:
ServerController.getInstance().addQuestion(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case CHANGE_QUESTION:
ServerController.getInstance().changeQuestion(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case GET_QUESTIONS:
serverResponse.setObject(ServerController.getInstance().getQuestions(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case GET_ANSWERS:
serverResponse.setObject(ServerController.getInstance().getAnswers(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case SAVE_TEST:
ServerController.getInstance().saveTest(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case GET_CATEGORY:
serverResponse.setObject(ServerController.getInstance().getCategory(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case AUTOCOMPLETE_QUESTION:
serverResponse.setObject(ServerController.getInstance().autocompleteQuestion(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case GET_QUESTION:
serverResponse.setObject(ServerController.getInstance().getQuestion(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case AUTOCOMPLETE_CATEGORY:
serverResponse.setObject(ServerController.getInstance().autocompleteCategory(clientRequest));
serverResponse.setStatus(Status.COMPLETE);
break;
case CHANGE_QUESTIONS:
ServerController.getInstance().changeQuestions(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
case DELETE_QUESTION:
ServerController.getInstance().deleteQuestion(clientRequest);
serverResponse.setStatus(Status.COMPLETE);
break;
default:
serverResponse.setStatus(Status.PROTOCOL_UNKNOWN);
}
ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
outputStream.writeObject(serverResponse);
System.out.println(serverResponse.getStatus());
}
}
| [
"tihomir.radosavljevic@gmail.com"
] | tihomir.radosavljevic@gmail.com |
b1965cf381be000c7eeeab2ce817de72877e76ce | 6e5ea80e37dd92267a4fb4ca6b813d0b17f218d7 | /app/src/main/java/com/savare/funcoes/rotinas/LogRotinas.java | c66f0e089465b2b347f02878541aaf5d4116f5f3 | [] | no_license | ns-bruno/SAVARE | c01d1c189657bd0d4404dd5a9c2a48594822587d | 32477d85392a4790ef5837ddeebcf190840e4d14 | refs/heads/master | 2023-03-02T22:29:36.125345 | 2018-12-04T21:43:23 | 2018-12-04T21:43:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,939 | java | package com.savare.funcoes.rotinas;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.database.Cursor;
import com.savare.banco.funcoesSql.LogSql;
import com.savare.beans.LogBeans;
import com.savare.funcoes.Rotinas;
public class LogRotinas extends Rotinas {
public LogRotinas(Context context) {
super(context);
}
public List<LogBeans> listaTabela(String where, String[] listaTabelaRequerida){
List<LogBeans> listaTabela = new ArrayList<LogBeans>();
LogSql logSql = new LogSql(context);
String sql = "SELECT * FROM LOG ";
if(where != null){
sql += "WHERE (" + where + ") ";
}
if( (where != null) && (listaTabelaRequerida.length > 0)){
sql += " AND (LOG.TABELA = '";
int controle = 0;
for (String tabela : listaTabelaRequerida) {
controle ++;
sql += tabela;
if(controle < tabela.length()){
sql += "' OR LOG.TABELA = '";
} else {
sql += "')";
}
}
} else if(listaTabelaRequerida != null){
sql += " WHERE (LOG.TABELA = '";
int controle = 0;
for (String tabela : listaTabelaRequerida) {
controle ++;
sql += tabela;
if(controle < listaTabelaRequerida.length){
sql += "' OR LOG.TABELA = '";
} else {
sql += "') ";
}
}
}
// Adiciona um agrupador
sql += "GROUP BY TABELA ";
Cursor dadosLog = logSql.sqlSelect(sql);
if(dadosLog != null && dadosLog.getCount()> 0){
// Move para o primeiro
//dadosLog.moveToFirst();
while (dadosLog.moveToNext()) {
LogBeans log = new LogBeans();
log.setIdLog(dadosLog.getInt(dadosLog.getColumnIndex("ID_LOG")));
log.setIdTabela(dadosLog.getInt(dadosLog.getColumnIndex("ID_TABELA")));
log.setTabela(dadosLog.getString(dadosLog.getColumnIndex("TABELA")));
listaTabela.add(log);
}
}
return listaTabela;
}
public List<LogBeans> listaLogPorTabela(String where){
List<LogBeans> listaLog = new ArrayList<LogBeans>();
LogSql logSql = new LogSql(context);
String sql = "SELECT * FROM LOG ";
if(where != null){
sql += "WHERE (" + where + ") ";
}
sql += "ORDER BY DT_CAD ";
Cursor dadosLog = logSql.sqlSelect(sql);
if(dadosLog != null){
while (dadosLog.moveToNext()) {
LogBeans log = new LogBeans();
log.setIdLog(dadosLog.getInt(dadosLog.getColumnIndex("ID_LOG")));
log.setIdTabela(dadosLog.getInt(dadosLog.getColumnIndex("ID_TABELA")));
log.setDataCadastro(dadosLog.getString(dadosLog.getColumnIndex("DT_CAD")));
log.setTabela(dadosLog.getString(dadosLog.getColumnIndex("TABELA")));
log.setOperacao(dadosLog.getString(dadosLog.getColumnIndex("OPERACAO")));
log.setUsuario(dadosLog.getString(dadosLog.getColumnIndex("USUARIO")));
log.setValores(dadosLog.getString(dadosLog.getColumnIndex("VALORES")));
listaLog.add(log);
}
}
return listaLog;
}
}
| [
"ns.bruno@gmail.com"
] | ns.bruno@gmail.com |
0568dc2558bea2f9da50a7c0b5d3e5fd7ded86ad | 1187e7ada271f51ed2e7f7c3cf97bfe86fee67b4 | /src/inf-polyfills/src/main/java/com/syncprem/uprising/infrastructure/polyfills/ProcessingCallback.java | 6461bbdd922fc59c42676899663c6a1e6c88df4f | [
"MIT"
] | permissive | wellengineered-us/archive-uprising-java | ac27896c8b6445bd325b18fa15a7e871376f445a | 490d02dd9ec98dc06d4fe7522abc66a178aa8f30 | refs/heads/master | 2023-04-12T17:09:40.575871 | 2021-05-06T04:07:31 | 2021-05-06T04:07:31 | 364,781,631 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | /*
Copyright ©2017-2019 SyncPrem, all rights reserved.
Distributed under the MIT license: https://opensource.org/licenses/MIT
*/
package com.syncprem.uprising.infrastructure.polyfills;
public interface ProcessingCallback
{
void onProgress(long punctuateModulo, String sourceLabel, long itemIndex, boolean isCompleted, double rollingTiming);
}
| [
"daniel.bullington@wellengineered.us"
] | daniel.bullington@wellengineered.us |
3a1dd48adf42bff98131c1c7c0a1647aa2ec7e5a | 71d4e35ecaa46867c08957c2c5cfc5498bc88930 | /app/src/main/java/com/function/demo/dao/TBagFunctionItem.java | a447da78f8301d4064ba10663e641bc2dc648f9f | [] | no_license | xiaoyinliuyun/TBagAdapterDemo | afc1ce4bee8f042e6029176c0600436dd006f3ef | 76a3ae9c893a23ff12852041514ee5fc95844e85 | refs/heads/master | 2020-06-14T03:54:08.344074 | 2016-12-28T11:49:00 | 2016-12-28T11:49:00 | 75,520,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.function.demo.dao;
/**
* Created by yangkunjian on 2016/12/4.
*/
public class TBagFunctionItem {
String tv;
public TBagFunctionItem(String tv) {
this.tv = tv;
}
public String getTv() {
return tv;
}
public void setTv(String tv) {
this.tv = tv;
}
}
| [
"yangkj2013@163.com"
] | yangkj2013@163.com |
8be2b0282b5a59cb1e103db8c8884b0d7fd20be1 | df0d612d8d37f888af427adda5cc5a1502e48b0b | /app/src/main/java/com/example/myapplication/StringUtils.java | 9cdec03bf561336ee4c21c91e149c195ee6e4324 | [] | no_license | galibujianbusana/edit | f25109a5cbf6b642d5371af4c5ac0e6e767f8c6a | 03f4273b532fd9f88a0fa8ae03c4a284c2e3d47d | refs/heads/master | 2023-01-08T13:12:47.573259 | 2020-11-04T13:52:01 | 2020-11-04T13:52:01 | 310,017,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | package com.example.myapplication;
import android.widget.EditText;
class StringUtils {
public static String touzi_ed_values22 = "";
/**
* 在数字型字符串千分位加逗号
*
* @param str
* @param edtext
* @return sb.toString()
*/
public static String addComma(String str, EditText edtext) {
touzi_ed_values22 = edtext.getText().toString().trim().replaceAll(",", "");
boolean neg = false;
if (str.startsWith("-")) { //处理负数
str = str.substring(1);
neg = true;
}
String tail = null;
if (str.indexOf('.') != -1) { //处理小数点
tail = str.substring(str.indexOf('.'));
str = str.substring(0, str.indexOf('.'));
}
StringBuilder sb = new StringBuilder(str);
sb.reverse();
for (int i = 3; i < sb.length(); i += 4) {
sb.insert(i, ',');
}
sb.reverse();
if (neg) {
sb.insert(0, '-');
}
if (tail != null) {
sb.append(tail);
}
return sb.toString();
}
}
| [
"galibujianbusana@163.com"
] | galibujianbusana@163.com |
501e7993a3c352cc6818b983c43c3edc232cf9d8 | bead5c9388e0d70156a08dfe86d48f52cb245502 | /MyNotes/thread/c3/c_3_1/c_3_1_3/a11/T1.java | 370c2d65ca832b73bdd634ee5d9b31f260d9b75c | [] | no_license | LinZiYU1996/Learning-Java | bd96e2af798c09bc52a56bf21e13f5763bb7a63d | a0d9f538c9d373c3a93ccd890006ce0e5e1f2d5d | refs/heads/master | 2020-11-28T22:22:56.135760 | 2020-05-03T01:24:57 | 2020-05-03T01:24:57 | 229,930,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package thread.c3.c_3_1.c_3_1_3.a11;
/**
* \* Created with IntelliJ IDEA.
* \* User: LinZiYu
* \* Date: 2020/1/18
* \* Time: 18:12
* \* Description:
* \
*/
public class T1 {
public static void main(String[] args) {
System.out.println("使用关键字静态synchronized");
SyncThread syncThread = new SyncThread();
Thread thread1 = new Thread(syncThread, "SyncThread1");
Thread thread2 = new Thread(syncThread, "SyncThread2");
thread1.start();
thread2.start();
}
}
class SyncThread implements Runnable {
private static int count;
public SyncThread() {
count = 0;
}
public synchronized static void method() {
for (int i = 0; i < 5; i ++) {
try {
System.out.println(Thread.currentThread().getName() + ":" + (count++));
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public synchronized void run() {
method();
}
}
| [
"2669093302@qq.com"
] | 2669093302@qq.com |
c4760b0ef33b22485131b213ce3436cdf1e0447e | dfd84b268cb1d852cd35d5b40d22e9dac341bb63 | /src/test/java/maven/data/MarkLabelData/AreaLabelData/AreaLabelDataImplTest.java | 1cce6a0308f768581a0ceeec4c384ef719e2907c | [] | no_license | 161250092/SECIII_Phase_III | 8f8ee9e696e6b2549503f78c8551e1ee3075ffb9 | 6ff03e62394dec5fc78d46f0b7abadd8a4aa2faa | refs/heads/master | 2020-05-20T11:52:11.752376 | 2019-05-09T07:27:09 | 2019-05-09T07:27:11 | 185,555,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,467 | java | package maven.data.MarkLabelData.AreaLabelData;
import maven.data.TableInitializer;
import maven.model.label.areaLabel.Area;
import maven.model.label.areaLabel.AreaLabel;
import maven.model.label.areaLabel.Pixel;
import maven.model.primitiveType.TaskId;
import maven.model.primitiveType.UserId;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class AreaLabelDataImplTest {
private AreaLabelDataImpl impl = new AreaLabelDataImpl();
public AreaLabelDataImplTest() {
TableInitializer initializer = new TableInitializer();
initializer.cleanAllTable();
List<AreaLabel> l = new ArrayList<>();
List<Area> s1 = new ArrayList<>();
List<Pixel> p1 = new ArrayList<>();
p1.add(new Pixel(100, 100));
p1.add(new Pixel(200, 100));
p1.add(new Pixel(200, 200));
p1.add(new Pixel(100, 200));
p1.add(new Pixel(100, 100));
s1.add(new Area("tag0-1", p1));
List<Pixel> p2 = new ArrayList<>();
p2.add(new Pixel(400, 400));
p2.add(new Pixel(500, 600));
p2.add(new Pixel(400, 600));
p2.add(new Pixel(400, 400));
s1.add(new Area("tag0-2", p2));
l.add(new AreaLabel(s1));
List<Area> s2 = new ArrayList<>();
List<Pixel> p3 = new ArrayList<>();
p3.add(new Pixel(4000, 4000));
p3.add(new Pixel(5000, 6000));
p3.add(new Pixel(4000, 7000));
p3.add(new Pixel(3000, 5000));
s2.add(new Area("tag1-1", p3));
l.add(new AreaLabel(s2));
impl.saveLabelList(new UserId("wo1"), new TaskId("task1"), l);
List<AreaLabel> l2 = new ArrayList<>();
List<Area> s21 = new ArrayList<>();
List<Pixel> p21 = new ArrayList<>();
p21.add(new Pixel(10, 10));
p21.add(new Pixel(20, 10));
p21.add(new Pixel(20, 20));
p21.add(new Pixel(10, 20));
p21.add(new Pixel(10, 10));
s21.add(new Area("tag21-1", p21));
l2.add(new AreaLabel(s21));
impl.saveLabelList(new UserId("wo2"), new TaskId("task1"), l2);
}
@Test
public void deleteLabel() {
impl.deleteLabel(new UserId("wo1"), new TaskId("task1"));
List<AreaLabel> l1 = impl.getLabelList(new UserId("wo1"), new TaskId("task1"));
List<AreaLabel> l2 = impl.getLabelList(new UserId("wo2"), new TaskId("task1"));
assertEquals(0, l1.size());
assertEquals(1, l2.size());
}
@Test
public void getLabelList() {
double[][][][] i1 = {
{
{{100,100},{200,100},{200,200},{100,200},{100,100}}, {{400,400},{500,600},{400,600},{400,400}},
},
{
{{4000,4000},{5000,6000},{4000,7000},{3000,5000}}
}
};
String[][] s1 = {
{"tag0-1","tag0-2"},
{"tag1-1"}
};
List<AreaLabel> l1 = impl.getLabelList(new UserId("wo1"), new TaskId("task1"));
for (int i = 0; i < l1.size(); i++){
for (int j = 0; j < l1.get(i).getAreaList().size(); j++){
assertEquals(s1[i][j], l1.get(i).getAreaList().get(j).getTag());
for (int k = 0; k < l1.get(i).getAreaList().get(j).getAreaBorder().size(); k++){
assertEquals(i1[i][j][k][0], l1.get(i).getAreaList().get(j).getAreaBorder().get(k).x, 0.001);
assertEquals(i1[i][j][k][1], l1.get(i).getAreaList().get(j).getAreaBorder().get(k).y, 0.001);
}
}
}
double[][][][] i2 = {
{
{{10,10},{20,10},{20,20},{10,20},{10,10}}
}
};
String[][] s2 ={
{"tag21-1"}
};
List<AreaLabel> l2 = impl.getLabelList(new UserId("wo2"), new TaskId("task1"));
for (int i = 0; i < l2.size(); i++){
for (int j = 0; j < l2.get(i).getAreaList().size(); j++){
assertEquals(s2[i][j], l2.get(i).getAreaList().get(j).getTag());
for (int k = 0; k < l2.get(i).getAreaList().get(j).getAreaBorder().size(); k++){
assertEquals(i2[i][j][k][0], l2.get(i).getAreaList().get(j).getAreaBorder().get(k).x, 0.001);
assertEquals(i2[i][j][k][1], l2.get(i).getAreaList().get(j).getAreaBorder().get(k).y, 0.001);
}
}
}
}
} | [
"161250054@smail.nju.edu.cn"
] | 161250054@smail.nju.edu.cn |
b135bf45b706250a2a5e22793ec812ed41cfc84b | 41bac86d728e5f900e3d60b5a384e7f00c966f5b | /communote/plugins/rest-api/3.0/implementation/src/main/java/com/communote/plugins/api/rest/v30/resource/lastmodificationdate/LastModificationDateResourceHandler.java | 7dabbaee0079fe0fdc3653d2cde2116fc5163a95 | [
"Apache-2.0"
] | permissive | Communote/communote-server | f6698853aa382a53d43513ecc9f7f2c39f527724 | e6a3541054baa7ad26a4eccbbdd7fb8937dead0c | refs/heads/master | 2021-01-20T19:13:11.466831 | 2019-02-02T18:29:16 | 2019-02-02T18:29:16 | 61,822,650 | 27 | 4 | Apache-2.0 | 2018-12-08T19:19:06 | 2016-06-23T17:06:40 | Java | UTF-8 | Java | false | false | 3,308 | java | package com.communote.plugins.api.rest.v30.resource.lastmodificationdate;
import java.util.List;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import com.communote.plugins.api.rest.v30.resource.DefaultParameter;
import com.communote.plugins.api.rest.v30.resource.DefaultResourceHandler;
import com.communote.plugins.api.rest.v30.resource.user.UserResource;
import com.communote.plugins.api.rest.v30.response.ResponseHelper;
import com.communote.plugins.api.rest.v30.service.IllegalRequestParameterException;
import com.communote.server.api.ServiceLocator;
import com.communote.server.api.core.security.AuthorizationException;
import com.communote.server.core.lastmodifieddate.LastModificationDateManagement;
/**
* Handler for {@link UserResource}
*
* @author Communote GmbH - <a href="http://www.communote.com/">http://www.communote.com/</a>
*/
public class LastModificationDateResourceHandler
extends
DefaultResourceHandler<DefaultParameter, DefaultParameter, DefaultParameter, DefaultParameter,
GetCollectionLastModificationDateParameter> {
private final LastModificationDateResourceFactory lastModificationDateResourceFactory = new LastModificationDateResourceFactory();
private final LastModificationDateManagement lastModificationDateManagement = ServiceLocator
.findService(LastModificationDateManagement.class);
private List<LastModificationDateResource> getAttachmentLastModificationDates()
throws AuthorizationException {
return lastModificationDateManagement
.getAttachmentCrawlLastModificationDates(lastModificationDateResourceFactory);
}
private List<LastModificationDateResource> getNoteLastModificationDates()
throws AuthorizationException {
return lastModificationDateManagement
.getNoteCrawlLastModificationDates(lastModificationDateResourceFactory);
}
private List<LastModificationDateResource> getTopicLastModificationDates()
throws AuthorizationException {
return lastModificationDateManagement
.getTopicCrawlLastModificationDates(lastModificationDateResourceFactory);
}
@Override
protected Response handleListInternally(
GetCollectionLastModificationDateParameter listParameter, String requestedMimeType,
UriInfo uriInfo, String requestSessionId, Request request) throws Exception {
List<LastModificationDateResource> dates;
if (listParameter.getType() == null) {
throw new IllegalRequestParameterException("type", "null", "Invalid value.");
}
switch (listParameter.getType()) {
case ATTACHMENT:
dates = getAttachmentLastModificationDates();
break;
case NOTE:
dates = getNoteLastModificationDates();
break;
case TOPIC:
dates = getTopicLastModificationDates();
break;
default:
throw new IllegalRequestParameterException("type", String.valueOf(listParameter
.getType()), "Unknown type.");
}
return ResponseHelper.buildSuccessResponse(dates, request);
}
}
| [
"ronny.winkler@communote.com"
] | ronny.winkler@communote.com |
2458dd7c27655d57fd60782df598dcfb1ec057e8 | 46894f87ec762c35ea9284198a3d130de8586760 | /src/das/list/ExceptionPositionInvalid.java | 4b0eb8b76221650e47f23dbe078927a641a71f8d | [] | no_license | dllen/dsa | d187902d7d9a84691829156bdd4785749d0f5582 | adbddca387679d1c3242efbddfaa1ec3ffb630f7 | refs/heads/master | 2021-01-13T06:36:09.685577 | 2017-02-24T14:32:43 | 2017-02-24T14:32:43 | 81,219,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package das.list;
public class ExceptionPositionInvalid extends RuntimeException{
/**
*
*/
private static final long serialVersionUID = 7929490452693013786L;
public ExceptionPositionInvalid(String msg) {
super(msg);
}
}
| [
"shichaopeng@ilegong.com"
] | shichaopeng@ilegong.com |
c6f9b1a07f3dc74cee4c37e1dd9ffa603f007b52 | cf33668481cb8215b2bdbf82f39c0952f6159225 | /postgreSQL/postgresql-demo/src/main/java/com/postgresql/demo/util/CodeGenerator.java | e5334ebdef92b0b857d3c9b9efbef8b4ac761c86 | [] | no_license | malin1994515/my-learn-document | 0e63353cb3942262ea72bd320b531052b312f6c1 | fb9c4f1453f7445c2c70fd8a392582feac6c4996 | refs/heads/master | 2023-03-29T10:03:39.201576 | 2021-04-05T01:38:12 | 2021-04-05T01:38:12 | 312,979,704 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 6,269 | java | package com.postgresql.demo.util;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.FileOutConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.TemplateConfig;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class CodeGenerator {
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + ":");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotBlank(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
// 全局配置
private final static String projectPath = System.getProperty("user.dir");
private final static String outputDir = projectPath + "/src/main/java";
private final static String author = "malin";
// 数据源配置
private final static String url = "jdbc:postgresql://192.168.248.4:5432/postgres";
private final static String schemaName = "public";
private final static String driverName = "org.postgresql.Driver";
private final static String username = "postgres";
private final static String password = "123456";
// 包配置
private final static String parent = "com.postgresql.demo";
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setFileOverride(true);
gc.setOutputDir(outputDir);
gc.setAuthor(author);
gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl(url);
dsc.setSchemaName(schemaName);
dsc.setDriverName(driverName);
dsc.setUsername(username);
dsc.setPassword(password);
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setModuleName(scanner("模块名"));
pc.setParent(parent);
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
//String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
/*
cfg.setFileCreate(new IFileCreate() {
@Override
public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
// 判断自定义文件夹是否需要创建
checkDir("调用默认方法创建的目录,自定义目录用");
if (fileType == FileType.MAPPER) {
// 已经生成 mapper 文件判断存在,不想重新生成返回 false
return !new File(filePath).exists();
}
// 允许生成模板文件
return true;
}
});
*/
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
templateConfig.setController(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
//strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
// 公共父类
//strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
// strategy.setSuperEntityColumns("id");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
mpg.execute();
}
}
| [
"ml_china_515@163.com"
] | ml_china_515@163.com |
2cf538385a12f7ebc07783e290c195a091b227f5 | 09c12d179be0ddd27311820dcbc5dc0190b0e1b2 | /jonix-common/src/main/java/com/tectonica/jonix/common/struct/JonixFundingIdentifier.java | 49331c79b88fa8ce6a82746b2f37c07c68083c92 | [
"Apache-2.0"
] | permissive | zach-m/jonix | 3a2053309d8df96f406b0eca93de6b25b4aa3e98 | c7586ed7669ced7f26e937d98b4b437513ec1ea9 | refs/heads/master | 2023-08-23T19:42:15.570453 | 2023-07-31T19:02:35 | 2023-07-31T19:02:35 | 32,450,400 | 67 | 23 | Apache-2.0 | 2023-06-01T03:43:12 | 2015-03-18T09:47:36 | Java | UTF-8 | Java | false | false | 1,997 | java | /*
* Copyright (C) 2012-2023 Zach Melamed
*
* Latest version available online at https://github.com/zach-m/jonix
* Contact me at zach@tectonica.co.il
*
* 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.tectonica.jonix.common.struct;
import com.tectonica.jonix.common.JonixKeyedStruct;
import com.tectonica.jonix.common.JonixStruct;
import com.tectonica.jonix.common.codelist.GrantIdentifierTypes;
import java.io.Serializable;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT MANUALLY
*/
/**
* This class is a {@link JonixStruct} that represents Onix3 <code><FundingIdentifier></code>.
* <p>
* It can be retrieved from the composite by invoking its <code>asStruct()</code> method.
*/
@SuppressWarnings("serial")
public class JonixFundingIdentifier implements JonixKeyedStruct<GrantIdentifierTypes>, Serializable {
public static final JonixFundingIdentifier EMPTY = new JonixFundingIdentifier();
/**
* the key of this struct (by which it can be looked up)
*/
public GrantIdentifierTypes fundingIDType;
/**
* Raw Format: Variable length text, suggested maximum 100 characters
* <p>
* (type: dt.NonEmptyString)
*/
public String idTypeName;
/**
* Raw Format: According to the identifier type specified in <SenderIDType>
* <p>
* (type: dt.NonEmptyString)
*/
public String idValue;
@Override
public GrantIdentifierTypes key() {
return fundingIDType;
}
}
| [
"zach@tectonica.co.il"
] | zach@tectonica.co.il |
4eb31447cf2aa7fed40fed41cff0d93ba1bd1912 | 46eee222f55faca8877f8653ec343dde8a634ec2 | /src/main/java/com/rms/leetcode/Leetcode_148.java | e361c6379cc935a99643435888df50365cbd407c | [] | no_license | RanMaosong/LeetCode | db5e139abd029af3257f134e8a107aeda8824ace | cc99ba7099446ee4e6c0e0e838fa9754ea619ea0 | refs/heads/master | 2021-07-09T16:35:16.014480 | 2019-03-21T02:35:32 | 2019-03-21T02:35:32 | 151,026,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,285 | java | package com.rms.leetcode;
public class Leetcode_148 {
public ListNode sortList(ListNode head) {
return operation(head, null);
}
private ListNode operation(ListNode start, ListNode end) {
if (start == end || start.next == end)
return start;
ListNode l = start, r = start, mid = start, cur = start.next;
while (cur != end) {
ListNode pre = cur;
cur = cur.next;
if (pre.val < mid.val) {
pre.next = l;
l = pre;
} else {
r.next = pre;
r = pre;
}
}
r.next = end;
l = operation(l, mid);
mid.next = operation(mid.next, r.next);
return l;
}
public ListNode sortList1(ListNode head) {
if (head == null || head.next == null)
return head;
ListNode slow = head, fast = head, pre=null;
while (fast != null && fast.next != null) {
pre = slow;
slow = slow.next;
fast = fast.next.next;
}
fast = pre.next;
pre.next = null;
return merge(sortList1(head), sortList1(fast));
}
private ListNode merge(ListNode l1, ListNode l2) {
ListNode head=null, tail=null;
while (l1 != null && l2 != null) {
if (l1.val < l2.val) {
if (head == null) {
head = l1;
tail = l1;
} else {
tail.next = l1;
tail = l1;
}
l1 = l1.next;
} else {
if (head == null) {
head = l2;
tail = l2;
} else {
tail.next = l2;
tail = l2;
}
l2 = l2.next;
}
}
if (l2 != null)
l1 = l2;
tail.next = l1;
return head;
}
public static void main(String[] args) {
ListNode list = new ListNode(4);
list.next = new ListNode(2);
list.next.next = new ListNode(1);
list.next.next.next = new ListNode(3);
System.out.println(new Leetcode_148().sortList1(list).show());
}
}
| [
"maosongran@gmail.com"
] | maosongran@gmail.com |
198a2b4bf323923e86686b48b3d1f73d1a5fd07d | 59fbd8c304b28db7b18972468de6d8364a888a59 | /SoftwareYard/src/com/chillax/softwareyard/activity/LoginActivity.java | 44ca75833c3c318044259453f8e67c7a7f779eba | [] | no_license | wxdut/Duters | 1b0a5ab5cadbceff8b2fd55f03d50e69f25bfa34 | c60b04c39c7bc593c04333ee33ae6db59ae86a1c | refs/heads/master | 2021-01-19T00:57:44.653502 | 2016-06-20T13:23:26 | 2016-06-20T13:23:26 | 61,549,172 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | package com.chillax.softwareyard.activity;
import android.app.Dialog;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.widget.TextView;
import android.widget.Toast;
import com.chillax.config.Constant;
import com.chillax.softwareyard.R;
import com.chillax.softwareyard.network.TableDataLoader;
import com.chillax.softwareyard.utils.CusDialog;
import com.chillax.softwareyard.utils.StatesUtils;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
@EActivity(R.layout.login_layout)
public class LoginActivity extends BaseActivity {
private StatesUtils mUtils;
public static final int LOGIN_SUCESS = 0;//登陆成功
public static final int DATA_ERROR = 1;//用户名或者密码错误
public static final int NET_ERROR = 2;//网络不通
public static final int NET_ERROR_2 = 3;//网络正常,但是没有连接校园网
private String userNameStr;
private String userPwdStr;
@ViewById(R.id.stuId)
TextView userName;
@ViewById(R.id.stuPwd)
TextView userPwd;
@ViewById
TextView login;
private Dialog dialog;
@AfterViews
void initViews() {
mUtils = new StatesUtils(this);
mUtils.setFirstUse(false);
userNameStr = mUtils.getUserName();
if (!TextUtils.isEmpty(userNameStr)) {
userName.setText(userNameStr);
}
userPwdStr = mUtils.getUserPwd();
if (!TextUtils.isEmpty(userPwdStr)) {
userPwd.setText(userPwdStr);
}
initLoadingDialog();
}
private void initLoadingDialog() {
dialog = CusDialog.create(this, "登陆中...");
}
private Handler mHandler = new Handler(Looper.myLooper()) {
public void handleMessage(Message msg) {
switch (msg.what) {
case LOGIN_SUCESS:
// loginBmob();
dialog.cancel();
Toast.makeText(LoginActivity.this, "登陆成功~", Toast.LENGTH_SHORT).show();
mUtils.setLoginStates(true);
mUtils.setUserName(userNameStr);
mUtils.setUserPwd(userPwdStr);
MainActivity_.intent(LoginActivity.this).start();
LoginActivity.this.finish();
break;
case DATA_ERROR:
Toast.makeText(LoginActivity.this, "用户名或密码错误~", Toast.LENGTH_SHORT).show();
dialog.cancel();
break;
case NET_ERROR:
Toast.makeText(LoginActivity.this, "网络不可用~", Toast.LENGTH_SHORT).show();
dialog.cancel();
break;
case NET_ERROR_2:
showToast("请确保正确连接到校园网");
dialog.cancel();
break;
}
}
};
@Click
void login() {
userNameStr = userName.getText().toString();
userPwdStr = userPwd.getText().toString();
if (TextUtils.isEmpty(userNameStr) || TextUtils.isEmpty(userPwdStr)) {
Toast.makeText(this, "账号密码不可为空~", Toast.LENGTH_SHORT).show();
} else if (!checkLegal(userNameStr, userPwdStr)) {
Toast.makeText(this, "账号输入不合法~", Toast.LENGTH_SHORT).show();
} else {
mUtils.setUserName(userNameStr);
mUtils.setUserPwd(userPwdStr);
dialog.show();
new TableDataLoader(this, mHandler).execute(userNameStr, userPwdStr);
}
}
private boolean checkLegal(String userNameStr, String userPwdStr) {
boolean b1 = userNameStr.length() == Constant.userNameLength ? true : false;
boolean b2 = userNameStr.replaceAll("\\d", "").length() == 0 ? true : false;
return b1 && b2;
}
}
| [
"wxduter@gmail.com"
] | wxduter@gmail.com |
2bb0edff7d79c679b0a08ba4f414f648e0ccccbb | 56522f4280d3c5c69e0af95f32e354c5c820a066 | /src/main/java/de/mprengemann/intellij/plugin/androidicons/model/Resolution.java | 56c2a894187499d5948f3904d92f9a909155b4e9 | [
"Apache-2.0"
] | permissive | ligi/android-drawable-importer-intellij-plugin | ba61a05f4cb8243964261e376ac7d7f71ffecf34 | 5bb2363eea9d4c5bd19a1ba0e8457c0fee0672eb | refs/heads/develop | 2020-11-30T16:21:40.287785 | 2015-12-29T19:14:22 | 2015-12-29T19:14:22 | 52,488,365 | 0 | 0 | null | 2016-02-25T01:48:33 | 2016-02-25T01:48:32 | null | UTF-8 | Java | false | false | 2,231 | java | /*
* Copyright 2015 Marc Prengemann
*
* 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 de.mprengemann.intellij.plugin.androidicons.model;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import de.mprengemann.intellij.plugin.androidicons.util.TextUtils;
import java.lang.reflect.Type;
public enum Resolution {
LDPI,
MDPI,
HDPI,
XHDPI,
XXHDPI,
XXXHDPI,
TVDPI;
public static Resolution from(String value) {
if (TextUtils.isEmpty(value)) {
throw new IllegalArgumentException();
}
if (value.equalsIgnoreCase(LDPI.toString())) {
return LDPI;
} else if (value.equalsIgnoreCase(MDPI.toString())) {
return MDPI;
} else if (value.equalsIgnoreCase(HDPI.toString())) {
return HDPI;
} else if (value.equalsIgnoreCase(XHDPI.toString())) {
return XHDPI;
} else if (value.equalsIgnoreCase(XXHDPI.toString())) {
return XXHDPI;
} else if (value.equalsIgnoreCase(XXXHDPI.toString())) {
return XXXHDPI;
} else if (value.equalsIgnoreCase(TVDPI.toString())) {
return TVDPI;
}
return null;
}
public static class Deserializer implements JsonDeserializer<Resolution> {
@Override
public Resolution deserialize(JsonElement jsonElement,
Type type,
JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
return Resolution.from(jsonElement.getAsString());
}
}
}
| [
"marcprengemann@web.de"
] | marcprengemann@web.de |
1a017b8f4fbd2cbe8c4031d6294ce4b64ae70cb4 | bd8a4a7516591030a04959360c8ce656408958f6 | /editor/Sprite Editor Source/thetaeditor/SpriteFrame.java | 77ccedbdcf569f93f4a8d5f333b6bb110f0f0331 | [] | no_license | impiaaa/theta-12 | 9cdec34ca2c510f1c0d7b20b96d8363215065a35 | 5d886334c9562bc0554be8fa01576e46ca965723 | refs/heads/master | 2020-05-16T23:16:11.824641 | 2013-06-18T04:56:27 | 2013-06-18T04:56:27 | 32,187,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,329 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* SpriteFrame.java
*
* Created on Apr 14, 2010, 7:11:25 PM
*/
package thetaeditor;
import java.util.LinkedList;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JOptionPane;
import javax.swing.JFrame;
import java.util.Enumeration;
/**
*
* @author garrett
*/
public class SpriteFrame extends JFrame {
private LinkedList<SeqPanel> seqPanels = new LinkedList<SeqPanel>();
private Sprite editing;
public SpriteFrame() {
this(null);
}
/** Creates new form SpriteFrame */
public SpriteFrame(Sprite editing) {
initComponents();
if (editing == null) {
editing = new Sprite();
} else {
Enumeration<String> keys = editing.sequences.keys();
while (keys.hasMoreElements()) {
String k = keys.nextElement();
System.out.println("Loading Sequence " + k);
SeqPanel sp = new SeqPanel(
defaultSequenceGroup, editing.sequences.get(k));
if (k.equals(editing.defaultSequence))
sp.setDefault(true);
seqPanels.add(sp);
}
nameField.setText(editing.name);
}
this.editing = editing;
if (seqPanels.size() == 0)
addSequence(null);
sequencesPanel.setLayout(new GridBagLayout());
Listener l = new Listener();
addSeqButton.addActionListener(l);
removeSeqButton.addActionListener(l);
okayButton.addActionListener(l);
cancelButton.addActionListener(l);
layoutSequences();
}
/** 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() {
defaultSequenceGroup = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
nameField = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
sequencesPanel = new javax.swing.JPanel();
okayButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
addSeqButton = new javax.swing.JButton();
removeSeqButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Sprite");
jLabel1.setText("Name");
nameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nameFieldActionPerformed(evt);
}
});
javax.swing.GroupLayout sequencesPanelLayout = new javax.swing.GroupLayout(sequencesPanel);
sequencesPanel.setLayout(sequencesPanelLayout);
sequencesPanelLayout.setHorizontalGroup(
sequencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 372, Short.MAX_VALUE)
);
sequencesPanelLayout.setVerticalGroup(
sequencesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 215, Short.MAX_VALUE)
);
jScrollPane1.setViewportView(sequencesPanel);
okayButton.setText("Okay");
cancelButton.setText("Cancel");
addSeqButton.setText("Add Sequence");
removeSeqButton.setText("Remove Sequence");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(okayButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton))
.addGroup(layout.createSequentialGroup()
.addComponent(addSeqButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(removeSeqButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addSeqButton)
.addComponent(removeSeqButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(okayButton)
.addComponent(cancelButton)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void nameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_nameFieldActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
SpriteFrame sf = new SpriteFrame();
sf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
sf.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addSeqButton;
private javax.swing.JButton cancelButton;
private javax.swing.ButtonGroup defaultSequenceGroup;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField nameField;
private javax.swing.JButton okayButton;
private javax.swing.JButton removeSeqButton;
private javax.swing.JPanel sequencesPanel;
// End of variables declaration//GEN-END:variables
public Sprite getSprite() {
Sprite sprite = new Sprite();
sprite.name = nameField.getText();
for (SeqPanel sp : seqPanels) {
if (sp.isSequenceDefault())
sprite.defaultSequence = sp.getSequenceName();
sprite.sequences.put(sp.getSequenceName(), sp.getSequence());
}
return sprite;
}
private void layoutSequences() {
sequencesPanel.removeAll();
for (int i = 0; i < seqPanels.size(); i++) {
SeqPanel sp = seqPanels.get(i);
GridBagConstraints gc = new GridBagConstraints();
gc.gridx = 0;
gc.gridy = i;
gc.gridwidth = 1;
gc.gridheight = 1;
gc.insets = new Insets(0, 0, 0, 0);
gc.ipadx = gc.ipadx= 0;
sequencesPanel.add(sp, gc);
}
sequencesPanel.setVisible(false);
sequencesPanel.setVisible(true);
}
private void addSequence(Sequence seq) {
if (seq == null) seq = new Sequence();
SeqPanel sp = new SeqPanel(defaultSequenceGroup, seq);
seqPanels.add(sp);
layoutSequences();
}
private SpriteFrame getSelf() {
return this;
}
class Listener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addSeqButton) {
addSequence(null);
} else if (e.getSource() == removeSeqButton) {
int total = 0;
for (SeqPanel sp : seqPanels)
if (sp.isSelected())
total++;
if (total == 0) return;
if (total > 1) {
int confirm = JOptionPane.showConfirmDialog(getSelf(),
"Delete " + total + " frames?");
if (confirm != JOptionPane.YES_OPTION) return;
}
for (int i = 0; i < seqPanels.size(); i++) {
if (seqPanels.get(i).isSelected()) {
seqPanels.remove(i);
i--; // order may have changed
}
}
layoutSequences();
} else if (e.getSource() == okayButton) {
editing.read(getSprite().store());
setVisible(false);
dispose();
} else if (e.getSource() == cancelButton) {
setVisible(false);
dispose();
}
}
}
}
| [
"garrett.malmquist@9bc04876-1b4d-11df-8bc4-a52d3ea79963"
] | garrett.malmquist@9bc04876-1b4d-11df-8bc4-a52d3ea79963 |
50bc8b4d5e823c950665330db68a29226e4b4039 | ab1d3be9f0a3233feaa67e350b0d4b25a766cc90 | /app/src/main/java/nigel/com/werfleider/ui/document/LocationDetailDimensionsView.java | ec26edefd87f2d275dfeb418e329ac4ea02e2557 | [] | no_license | NigelHeylen/werfleider | c2182c891c96a06f750e8c0018e703231727ea00 | bf644aceb45ff15cb948dbb992407757e94fd8e4 | refs/heads/master | 2020-12-22T08:16:17.774270 | 2016-10-11T14:43:35 | 2016-10-11T14:43:35 | 30,886,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,404 | java | package nigel.com.werfleider.ui.document;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import butterknife.Bind;
import butterknife.OnTextChanged;
import com.rengwuxian.materialedittext.MaterialEditText;
import java.util.List;
import javax.inject.Inject;
import butterknife.ButterKnife;
import mortar.Mortar;
import nigel.com.werfleider.R;
/**
* Created by nigel on 26/12/15.
*/
public class LocationDetailDimensionsView extends RelativeLayout {
@Inject LocationDetailDimensionsPresenter presenter;
@Bind(R.id.document_length) MaterialEditText length;
@Bind(R.id.document_height) MaterialEditText height;
@Bind(R.id.document_width) MaterialEditText width;
@Bind(R.id.document_quantity) MaterialEditText quantity;
@Bind(R.id.document_ms) MaterialEditText ms;
@Bind(R.id.document_measuring_units) Spinner measuringUnits;
@Bind({ R.id.document_length, R.id.document_width, R.id.document_height}) List<MaterialEditText>
editTexts;
public LocationDetailDimensionsView(final Context context, final AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode()) {
Mortar.inject(context, this);
}
}
@Override protected void onFinishInflate() {
super.onFinishInflate();
if (!isInEditMode()) {
ButterKnife.bind(this);
presenter.takeView(this);
}
}
@Override protected void onAttachedToWindow() {
super.onAttachedToWindow();
if(!isInEditMode()){
ButterKnife.bind(this);
presenter.takeView(this);
}
}
@Override protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
presenter.dropView(this);
ButterKnife.unbind(this);
}
@OnTextChanged(R.id.document_width)
public void changeWidth(){
presenter.changeWidth(width.getText().toString());
}
@OnTextChanged(R.id.document_height)
public void changeHeight(){
presenter.changeHeight(height.getText().toString());
}
@OnTextChanged(R.id.document_length)
public void changeLength(){
presenter.changeLength(length.getText().toString());
}
@OnTextChanged(R.id.document_quantity)
public void changeQuantity(){
presenter.changeQuantity(quantity.getText().toString());
}
@OnTextChanged(R.id.document_ms)
public void changeMS(){
presenter.changeMS(ms.getText().toString());
}
}
| [
"nigel@webcomrades.be"
] | nigel@webcomrades.be |
a4e2ff16881a880a0401435213454d7a06292882 | c0d1f639768a0d6dcc607fe1d721bab44b2cdb2c | /windingapp/app/src/main/java/app/winding/com/windingapp/util/CProgressDialogUtils.java | fa967e1a01defe2c66d8aa8ee37a16a31a8f5f30 | [] | no_license | weijiaqi/-windingapp | 87f2e9f834422271b4cc25214c6a5c0ad651dffd | 45c22d29b75503e5d8c172faaff72f7e3a4b6532 | refs/heads/master | 2022-12-07T14:17:50.857021 | 2020-08-26T12:15:31 | 2020-08-26T12:15:31 | 290,486,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,155 | java | package app.winding.com.windingapp.util;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
/**
* Created by Vector on 2016/8/12 0012.
*/
public class CProgressDialogUtils {
private static final String TAG = CProgressDialogUtils.class.getSimpleName();
private static ProgressDialog sCircleProgressDialog;
private CProgressDialogUtils() {
throw new UnsupportedOperationException("cannot be instantiated");
}
public static void showProgressDialog(Activity activity) {
showProgressDialog(activity, "加载中", false, null);
}
public static void showProgressDialog(Activity activity, DialogInterface.OnCancelListener listener) {
showProgressDialog(activity, "加载中", true, listener);
}
public static void showProgressDialog(Activity activity, String msg) {
showProgressDialog(activity, msg, false, null);
}
public static void showProgressDialog(Activity activity, String msg, DialogInterface.OnCancelListener listener) {
showProgressDialog(activity, msg, true, listener);
}
public static void showProgressDialog(final Activity activity, String msg, boolean cancelable, DialogInterface.OnCancelListener listener) {
if (activity == null || activity.isFinishing()) {
return;
}
if (sCircleProgressDialog == null) {
sCircleProgressDialog = new ProgressDialog(activity);
sCircleProgressDialog.setMessage(msg);
sCircleProgressDialog.setOwnerActivity(activity);
sCircleProgressDialog.setOnCancelListener(listener);
sCircleProgressDialog.setCancelable(cancelable);
} else {
if (activity.equals(sCircleProgressDialog.getOwnerActivity())) {
sCircleProgressDialog.setMessage(msg);
sCircleProgressDialog.setCancelable(cancelable);
sCircleProgressDialog.setOnCancelListener(listener);
} else {
//不相等,所以取消任何ProgressDialog
cancelProgressDialog();
sCircleProgressDialog = new ProgressDialog(activity);
sCircleProgressDialog.setMessage(msg);
sCircleProgressDialog.setCancelable(cancelable);
sCircleProgressDialog.setOwnerActivity(activity);
sCircleProgressDialog.setOnCancelListener(listener);
}
}
if (!sCircleProgressDialog.isShowing()) {
sCircleProgressDialog.show();
}
}
public static void cancelProgressDialog(Activity activity) {
if (sCircleProgressDialog != null && sCircleProgressDialog.isShowing()) {
if (sCircleProgressDialog.getOwnerActivity() == activity) {
sCircleProgressDialog.cancel();
sCircleProgressDialog = null;
}
}
}
public static void cancelProgressDialog() {
if (sCircleProgressDialog != null && sCircleProgressDialog.isShowing()) {
sCircleProgressDialog.cancel();
sCircleProgressDialog = null;
}
}
}
| [
"84362113@qq.com"
] | 84362113@qq.com |
00d6416ae4f489721ed06c60c799e29056b8aec4 | e6fc814a76190683f758eb163ece6eab363cc40d | /src/main/java/com/hilti/recommendation/controller/AccountMasterController.java | 81eadc9ad05ec07bd569798a15b2c7a1bae69bdb | [] | no_license | vippujain/HiltiR | d55c20f94eddc8580795091d673f6522f7c046ba | c478f574f28c75a80430bfde8d7ae43d5cf48a7a | refs/heads/master | 2021-05-14T20:55:12.314414 | 2017-11-22T09:06:10 | 2017-11-22T09:06:10 | 111,660,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package com.hilti.recommendation.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.hilti.recommendation.model.AccountMaster;
import com.hilti.recommendation.service.AccountMasterService;
@RestController
@RequestMapping(value = "hilti/account/master", produces = "application/json")
public class AccountMasterController {
@Autowired
private AccountMasterService accountMasterService ;
@RequestMapping(value = "/save", method = RequestMethod.POST)
public List<AccountMaster> save(@RequestBody List<AccountMaster> accountMasters) {
return accountMasterService.save(accountMasters);
}
@RequestMapping(value = "/config", method = RequestMethod.POST)
public List<AccountMaster> config() {
return accountMasterService.config();
}
@RequestMapping(value = "/data", method = RequestMethod.POST)
public List<AccountMaster> getData() {
return accountMasterService.getData();
}
}
| [
"vippujain@gmail.com"
] | vippujain@gmail.com |
152e98bd9a3f4e041046c226f9b1fa4102f88ece | 3b133789e2dc649f5e3c018f4d521504f8f2a654 | /org.xtext.sdu.iot/src-gen/org/xtext/sdu/ioT/impl/SensorTypeImpl.java | 70c3b99a22703f334db73a00619dceae1343a6c1 | [
"MS-PL"
] | permissive | zdndk/iot-portfolio | b140f785136766d7d9d33d6ca098f4480e39a8ab | adb40a0af17fc5c9b79adb71247656f1ebd93c90 | refs/heads/master | 2020-05-24T08:10:22.421309 | 2019-05-27T17:08:01 | 2019-05-27T17:08:01 | 187,178,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,675 | java | /**
* generated by Xtext 2.16.0
*/
package org.xtext.sdu.ioT.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.xtext.sdu.ioT.IoTPackage;
import org.xtext.sdu.ioT.SensorType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Sensor Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.xtext.sdu.ioT.impl.SensorTypeImpl#getName <em>Name</em>}</li>
* </ul>
*
* @generated
*/
public class SensorTypeImpl extends MinimalEObjectImpl.Container implements SensorType
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SensorTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return IoTPackage.Literals.SENSOR_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, IoTPackage.SENSOR_TYPE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case IoTPackage.SENSOR_TYPE__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case IoTPackage.SENSOR_TYPE__NAME:
setName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case IoTPackage.SENSOR_TYPE__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case IoTPackage.SENSOR_TYPE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //SensorTypeImpl
| [
"damad08@student.sdu.dk"
] | damad08@student.sdu.dk |
de22016909aed0584f4569959dc5626b1ee79d19 | f62a0abc0ce79ca822b8653dc764d6ae113ea4bd | /initializr-generator/src/main/java/eu/xenit/alfred/initializr/generator/buildsystem/gradle/IGradleBuild.java | 5caf43a0f8c2b62d325fdbe45bcf8e70d04887e4 | [
"Apache-2.0"
] | permissive | xenit-eu/start.xenit.eu | b6ec6ffd4183a1d9e44184f11824a29b05d0ea1a | 4d4a8881a0f54337c7583e80f162ebe4a5c916b0 | refs/heads/master | 2023-06-11T18:16:42.781143 | 2021-07-15T12:42:02 | 2021-07-15T12:42:02 | 185,811,312 | 3 | 0 | Apache-2.0 | 2021-07-15T12:42:03 | 2019-05-09T14:06:37 | Java | UTF-8 | Java | false | false | 491 | java | package eu.xenit.alfred.initializr.generator.buildsystem.gradle;
import eu.xenit.alfred.initializr.generator.buildsystem.Build;
import io.spring.initializr.generator.buildsystem.gradle.GradlePluginContainer;
import io.spring.initializr.generator.buildsystem.gradle.GradleTaskContainer;
public interface IGradleBuild extends Build {
GradlePluginContainer plugins();
GradleTaskContainer tasks();
//void customizeTask(String taskName, Consumer<TaskCustomization> customizer);
}
| [
"toon.geens@xenit.eu"
] | toon.geens@xenit.eu |
5afcd6cf3b3f24abf1acb5f10c0f368e30111c33 | 990e614aff76621bc65881a6cd41447ff41da09e | /MULE/src/MuleModelPeterTest.java | e3483f4efba7b4f79c573585abdfa5bbe1547b76 | [] | no_license | jtrimm3/repository | 47519ce495c540c98d03cabbe17ef301e3d2892f | 340bab82211d2c69aeb1bed0b7ee5d243316771d | refs/heads/master | 2020-04-08T23:07:23.878935 | 2015-12-04T14:40:51 | 2015-12-04T14:40:51 | 41,610,124 | 0 | 1 | null | 2015-09-16T19:50:01 | 2015-08-29T23:08:23 | Java | UTF-8 | Java | false | false | 1,798 | java | import static org.junit.Assert.*;
import javafx.embed.swing.JFXPanel;
import javafx.stage.Stage;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.junit.Before;
import org.junit.Test;
import javafx.scene.paint.Color;
import java.util.ArrayList;
import java.util.HashMap;
import javafx.scene.control.Button;
import javafx.scene.text.Text;
/**
* Created by Peter on 11/2/2015.
*/
public class MuleModelPeterTest extends TestCase {
MuleModel m;
@Before
public void setup() {
m = new MuleModel(new Stage());
}
// @Test
// public void testBuy() {
// m = new MuleModel(null);
// m = new MuleModel(null);
// HashMap<String, Integer> resources = new HashMap<String, Integer>();
// Player p1 = new Player("Michael", 1, "Human", Color.RED, resources);
// Player p2 = new Player("Peter", 2, "Human", Color.BLUE, resources);
// ArrayList<Player> listOfPlayers = new ArrayList<>();
// listOfPlayers.add(p1);
// m.playerList = listOfPlayers;
// new JFXPanel();
// Button aButton = new Button();
// Text errText = new Text();
// m.setTurningPlayer(p1);
// m.validateBuy(aButton, "2","Mule", errText);
// assertEquals("Can't buy more than one mule", errText.getText(),"Can't buy more than one mule at a time");
// m.validateBuy(aButton, "1","Mule", errText);
// assertEquals("Buying one mule", errText.getText(), "");
// m.validateBuy(aButton, "100","Energy", errText);
// assertEquals("Not enough money: ", errText.getText(), "Not enough money!");
// m.validateBuy(aButton, "a","Energy", errText);
// assertEquals("Need a valid Quantity: ", errText.getText(), "Enter a valid quantity");
// }
} | [
"pkoplik24@gmail.com"
] | pkoplik24@gmail.com |
78bdf8af3e94fb06b8995873a912f3ee003da1d4 | 482fe32082940c1c2b6b78fedfcf967022564c6e | /Object_Oriented_Software_Construction/Assignment3/report/answers/a3_q1_samples/a.java | 323b4f2f785fee96129f6fa0972cf43a00c010cd | [] | no_license | ulfet/RWTH-Informatik | 9f33b3b8afca8d738119c25a6341b4707f3d8b32 | 38ae6779f97287b838d20caac1706ac3a1e8a183 | refs/heads/main | 2023-02-11T14:05:18.356824 | 2021-01-16T17:55:26 | 2021-01-16T17:55:26 | 330,211,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | public class Singleton<T> {
public T getInstance() {
if (instance == null)
instance = new Singleton<T>();
return instance;
}
private T instance = null;
}
| [
"ulfet.rwth@gmail.com"
] | ulfet.rwth@gmail.com |
94c1601549b6d916e28dadb3dc4fc4e0b6b1269f | 1a5950f64c53669c9dd0d9e903fbfd79829c6e6a | /src/main/java/com/clsaa/janus/admin/entity/vo/v1/RequestParamV1.java | 1ee8067b8835fd4366ab91568f8db93a62a47c3f | [
"Apache-2.0"
] | permissive | sdtm1016/janus-admin-server | 160df6185ba31e70b2217f62a0c80fa2d99e2bc9 | b17abb70e92b08f2f18a2eadd8cb835b522f4bab | refs/heads/master | 2020-04-07T15:46:50.337160 | 2018-05-29T20:05:57 | 2018-05-29T20:05:57 | 158,500,598 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package com.clsaa.janus.admin.entity.vo.v1;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* 客户端到网关的请求参数视图层对象
*
* @author 任贵杰 812022339@qq.com
* @since 2018-05-17
*/
@Getter
@Setter
public class RequestParamV1 implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private String id;
/**
* 参数名
*/
private String name;
/**
* 参数位置,1为path,2为query,3为head,4为body
*/
private Integer location;
/**
* 参数描述
*/
private String description;
/**
* 参数类型,1为String,2为Int,3为Long,4为Float,5为Double,6为Boolean
*/
private Integer type;
/**
* 是否必填,0为非必填,1为必填
*/
private Integer required;
/**
* 参数顺序
*/
private Integer sort;
}
| [
"812022339@qq.com"
] | 812022339@qq.com |
d1c35d9c9cacd611daec8c12989babc65178c263 | ac97058c3a9dceab0e2173aafa6ce0caa69d1c07 | /javaSE/src/main/java/com.silinx/source/effectivejava/chapter2/item9/trywithresources/TopLine.java | b5c307043388a1fb5c616cfaf851a9ff38dd51b7 | [
"Apache-2.0"
] | permissive | Swagger-Ranger/JavaSrc | 069d9ff800813df9b1000c2181027b956f6afd7c | 4ea91254e4910f67e322a941c81939196b0ea106 | refs/heads/master | 2023-05-26T18:30:08.714889 | 2022-04-23T15:14:41 | 2022-04-23T15:14:41 | 252,048,639 | 1 | 1 | Apache-2.0 | 2023-05-17T17:02:27 | 2020-04-01T02:14:31 | Java | UTF-8 | Java | false | false | 628 | java | package com.silinx.source.effectivejava.chapter2.item9.trywithresources;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class TopLine {
// try-with-resources - the the best way to close resources! (Page 35)
static String firstLineOfFile(String path) throws IOException {
try (BufferedReader br = new BufferedReader(
new FileReader(path))) {
return br.readLine();
}
}
public static void main(String[] args) throws IOException {
String path = args[0];
System.out.println(firstLineOfFile(path));
}
}
| [
"liufei32@outlook.com"
] | liufei32@outlook.com |
d4f13f3ad1049b9c38de99f11c17aa73c302050b | f841dc4362e616ab60cc8e6ba550f05fe5529ddd | /src/main/java/com/terraforged/api/material/state/States.java | 623c01e00b6a3ffd5a7f93b8ca3dc5c48a91f9eb | [
"MIT"
] | permissive | Sejjaa290/TerraForged | c3ff03bb781d557de056e4bf56123437ac6c7a4c | cf722a369253657664ef2689a33d92a49e6fa0b8 | refs/heads/0.1.x | 2023-02-17T11:52:24.047668 | 2020-12-18T10:46:15 | 2020-12-18T10:46:15 | 331,132,429 | 0 | 0 | MIT | 2021-01-19T23:00:30 | 2021-01-19T23:00:29 | null | UTF-8 | Java | false | false | 2,734 | java | /*
*
* MIT License
*
* Copyright (c) 2020 TerraForged
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.terraforged.api.material.state;
public class States {
public static final StateSupplier BEDROCK = DefaultState.of("minecraft:bedrock").cache();
public static final StateSupplier COARSE_DIRT = DefaultState.of("minecraft:coarse_dirt").cache();
public static final StateSupplier DIRT = DefaultState.of("minecraft:dirt").cache();
public static final StateSupplier GRASS_BLOCK = DefaultState.of("minecraft:grass_block").cache();
public static final StateSupplier PODZOL = DefaultState.of("minecraft:podzol").cache();
public static final StateSupplier CLAY = DefaultState.of("minecraft:clay").cache();
public static final StateSupplier GRAVEL = DefaultState.of("minecraft:gravel").cache();
public static final StateSupplier LAVA = DefaultState.of("minecraft:lava").cache();
public static final StateSupplier PACKED_ICE = DefaultState.of("minecraft:packed_ice").cache();
public static final StateSupplier SAND = DefaultState.of("minecraft:sand").cache();
public static final StateSupplier SMOOTH_SANDSTONE = DefaultState.of("minecraft:smooth_sandstone").cache();
public static final StateSupplier SMOOTH_RED_SANDSTONE = DefaultState.of("minecraft:smooth_red_sandstone").cache();
public static final StateSupplier SNOW_BLOCK = DefaultState.of("minecraft:snow_block").cache();
public static final StateSupplier STONE = DefaultState.of("minecraft:stone").cache();
public static final StateSupplier WATER = DefaultState.of("minecraft:water").cache();
public static void invalidate() {
CachedState.clearAll();
}
}
| [
"dags@dags.me"
] | dags@dags.me |
c238730ca06e97cb4e8b07c04956a8b6154033d8 | 2b71e49c38aa7196396a28612b269baa500ca474 | /signcar/signcar-service/src/main/java/com/yy/ent/platform/signcar/service/yyp/ActivityHandler.java | fba14ddf9fec121bf88d53b2654e6cbe15a7ed68 | [] | no_license | renmeng8875/java-yy | 055f01694b614518c332f4d2387857b3676c7b44 | 52f8d2e5c86e2ff04875ed95b9a5f8c00f4a468c | refs/heads/master | 2021-05-12T06:22:40.180490 | 2018-01-12T09:40:45 | 2018-01-12T09:40:45 | 117,217,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,071 | java | package com.yy.ent.platform.signcar.service.yyp;
import com.yy.ent.commons.protopack.util.Uint;
import com.yy.ent.platform.core.spring.SpringHolder;
import com.yy.ent.platform.signcar.common.constant.YYPConstant;
import com.yy.ent.platform.signcar.common.mongodb.ActivityConfig;
import com.yy.ent.platform.signcar.service.activity.ActivityConfigService;
import com.yy.ent.platform.signcar.service.car.ActivityService;
import com.yy.ent.platform.signcar.service.car.NotifyService;
import com.yy.ent.srv.builder.Dispatch;
import com.yy.ent.srv.protocol.Constants;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* ActivityHandler
*
* @author suzhihua
* @date 2015/11/11.
*/
public class ActivityHandler extends BaseYYPHandler {
ActivityConfigService activityConfigService = SpringHolder.getBean(ActivityConfigService.class);
NotifyService notifyService = SpringHolder.getBean(NotifyService.class);
ActivityService activityService = SpringHolder.getBean(ActivityService.class);
/**
* 活动是否进行中
*
* @throws Exception
*/
@Dispatch(uri = Constants.MSG_MAX_RECV_SERVER_PROXY_PC, max = YYPConstant.PC.MAX, min = YYPConstant.PC.REQUEST_CAR_IS_OPEN)
public void isOpenActivity() throws Exception {
getPublicComboYYHeaderPC("isOpenActivity");
Long activityId = activityConfigService.getCurrentActivityId();
Map<String, Object> result = new HashMap<String, Object>();
ActivityConfig activityConfig = activityConfigService.getActivityConfig(activityId);
if (activityId >= 0 && activityConfigService.isActivityOpen(activityId)) {
String url = activityConfig.getUrl();
if (StringUtils.isNotBlank(url)) result.put("url", url);
}
if (activityId < 0) {
result.put("isOpen", false);
responsePC(result);
return;
}
String clazz = activityConfig.getClazz();
if ("car".equals(clazz)) {
if (!isLivingRoom(getComboYYHeader().getTopCh().toString(), getComboYYHeader().getSubCh().toString())) {
result.put("isOpen", false);
responsePC(result);
return;
}
//正常流程
String chid = getChidPC();
Map<String, Object> result2 = activityService.getActivityResult(activityId, chid);
result.putAll(result2);
responsePC(result);
//广播用户进来
Uint uid = getComboYYHeader().getUid();
notifyService.addNotifyUserEntry(activityId, chid, uid.longValue());
} else {
result.put("isOpen", false);
responsePC(result);
}
}
/**
* 检测是否直播间
*
* @return
* @throws Exception
*/
private boolean isLivingRoom(String topCh, String subCh) throws Exception {
if (!topCh.equals(subCh)) {
return false;
}
return activityService.isLivingRoom(topCh, subCh);
}
}
| [
"453791694@qq.com"
] | 453791694@qq.com |
57337ecaaad325ad6843492ec392099e545f95fe | bb31ca75f982feab5b0c44911e525a3f9de74f3f | /src/com/hanyu/desheng/db/GroupDao.java | 1151082dd346d737f18c13c3e91f803481bd597d | [] | no_license | zhangshiqiang/desheng | 6b95045b2c19bf888cfa5cfe962281b48c5f9b6f | ced5a54916143f051421eaf7250753edb409e15e | refs/heads/master | 2021-01-10T01:44:08.533745 | 2015-12-23T06:29:21 | 2015-12-23T06:29:21 | 47,814,768 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 920 | java | package com.hanyu.desheng.db;
import java.util.List;
import com.hanyu.desheng.bean.GroupBean;
import com.hanyu.desheng.util.ShUtils;
import com.leaf.library.db.TemplateDAO;
public class GroupDao extends TemplateDAO<GroupBean,String>{
public GroupDao() {
super(ShUtils.getDbhelper());
}
private static GroupDao dao;
private static GroupDao getDao(){
if(dao==null){
dao=new GroupDao();
}
return dao;
}
public static void saveGroup(GroupBean gb){
getDao().insert(gb);
}
/**
* 是否已存在
* @param groupid
* @param hxusername
* @return
*/
public static boolean getGroup(String groupid,String hxusername){
String selection="groupid=? and hxusername=?";
String selectionArgs[]=new String[]{groupid,hxusername};
List<GroupBean> list=getDao().find(null, selection, selectionArgs,null,null,null,null);
if(list.size()>0){
return true;
}else{
return false;
}
}
}
| [
"978006106@qq.com"
] | 978006106@qq.com |
233aafaedb6df0de71adaf19e4e47907066f2815 | 8793801186f24e31d3421724bd671d5d3793515b | /eclipse/Collection_and_generic/src/Application.java | d2394109c124aa76771f7331857ac65cbfcaf8d2 | [] | no_license | mindsparker2158/Code_dump_yard | 2424a5b310109adcfed4ede5225f0ee35538e78b | f045be35ac606fb22b8094dccf1738c59115aac8 | refs/heads/master | 2023-08-21T14:53:12.313952 | 2021-09-08T17:24:57 | 2021-09-08T17:24:57 | 404,412,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 509 | java | import java.util.ArrayList;
import java.util.Scanner;
public class Application {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter First number : ");
int first= scan.nextInt();
System.out.println("Enter second number : ");
int second = scan.nextInt();
ArrayList<Integer> number = new ArrayList<Integer>();
number.add(first);
number.add(second);
int num1 = number.get(0);
int num2 = number.get(1);
System.out.println(num1 + num2);
}
}
| [
"asish@asish.com"
] | asish@asish.com |
9d59f38e40a342c8e3dce9fe9445d8b6177df466 | 4106c7799052b9bf1031095485602bdfa74f9b49 | /Java/Recursion-1/changePi.java | 7e01b745474601bfe3e2d4aa1225eb5635f70893 | [] | no_license | EfeOzG/CodingBatSolutions | d6a1b2affec3892434f538831afb5feb4248b86a | 56bf12c52d33817573cf6652cbcb745d73abf986 | refs/heads/main | 2023-08-17T05:44:10.931241 | 2021-09-19T21:29:21 | 2021-09-19T21:29:21 | 397,823,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | // Given a string, compute recursively (no loops) a new string where all appearances of "pi"
// have been replaced by "3.14".
public String changePi(String str) {
if (str.length() <= 1) return str;
if (str.substring(0, 2).equals("pi")) {
return "3.14" + changePi(str.substring(2));
} else {
return str.charAt(0) + changePi(str.substring(1));
}
} | [
"56230710+EfeOzG@users.noreply.github.com"
] | 56230710+EfeOzG@users.noreply.github.com |
72a8cd36f869e29a8d68bf52a888b5d1ee91113f | 30900a71d5a0dd8d1757b027355084ab3f84576c | /src/Connection/ConnectionManager.java | 06e183f3bc5ead1ca6f10dc799a0c08418a68c20 | [] | no_license | WangCrash/PirateTransmission | 6a0a5402b41cf4c787ad6d571073b633d255fd5c | 0a8fcc81f01b39fe8dc3dd14b7f9925f888ac8c4 | refs/heads/master | 2020-05-30T01:13:30.235816 | 2014-07-13T19:55:53 | 2014-07-13T19:55:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,173 | java | package Connection;
import java.util.List;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import error.ErrorDescription;
import Codification.Base64;
public class ConnectionManager {
public static final String METHOD_GET = "GET";
public static final String METHOD_POST = "POST";
public static final String TOKEN_NAME_BASIC_AUTH_KEY = "TOKEN_NAME";
public static final String TOKEN_ID_BASIC_AUTH_KEY = "TOKEN_ID";
public static final String USER_BASIC_AUTH_KEY = "USER";
public static final String PASSWORD_BASIC_AUTH_KEY = "PASSWORD";
public static final String BODY_TEXT_RESPONSE_KEY = "ResponseBody";
public static final String STATUS_CODE_RESPONSE_KEY = "ResponseCode";
public static final String USER_AGENT = "continental_1.0";//"orphean_navigator_2.0";
private List<String> cookiesList;
private Map<String, String> responseHeaders;
private int TIMEOUT_MILLI = 10000;
private String charset;
public ConnectionManager(){
this(10000, "ISO-8859-1");
}
public ConnectionManager(int timeout){
this(timeout, "ISO-8859-1");
}
public ConnectionManager(String charset){
this(10000, charset);
}
public ConnectionManager(int timeout, String charset){
this.TIMEOUT_MILLI = timeout;
this.charset = charset;
}
public Map<String, String> sendRequest(URL url, String method, boolean getBodyResponse, boolean watchCookies, boolean sendCookies){
return sendRequest(url, null, false, null, method, getBodyResponse, watchCookies, sendCookies, null);
}
public Map<String, String> sendRequest(URL url, String parameters, boolean encodeParams, Map<String, String> httpAuth, String method, boolean getBodyResponse, boolean watchCookies, boolean sendCookies){
return sendRequest(url, parameters, encodeParams, httpAuth, method, getBodyResponse, watchCookies, sendCookies, null);
}
public Map<String, String> sendRequest(URL url, String parameters, boolean encodeParams, Map<String, String> httpAuth, String method, boolean getBodyResponse, boolean watchCookies, boolean sendCookies, Map<String, String> addHeaders){
String cookieChain = "";
if(sendCookies){
if(cookiesList != null){
for (int i = 0; i < cookiesList.size(); i++) {
String[] cookieParts = cookiesList.get(i).split(";");
cookieChain += cookieParts[0] + ";";
}
cookieChain = cookieChain.substring(0, cookieChain.length() - 1);
}
}
/*if(encodeParams){
//encodeparams pero Fa no hace esas cosas
}*/
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection con;
try {
con = (HttpURLConnection)url.openConnection();
} catch (IOException e) {
e.printStackTrace();
return null;
}
con.setReadTimeout(TIMEOUT_MILLI);
con.setRequestProperty("User-Agent", USER_AGENT);
con.setRequestProperty("Accept-Language", "es-ES,es;q=0.8,en;q=0.6");
if(addHeaders != null){
for (Map.Entry<String, String> newHeader : addHeaders.entrySet()){
con.setRequestProperty(newHeader.getKey(), newHeader.getValue());
}
}
if(encodeParams){
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
}
if(!cookieChain.isEmpty()){
con.setRequestProperty("Cookie", cookieChain);
}
try {
con.setRequestMethod(method);
} catch (ProtocolException e) {
return null;
}
if(httpAuth != null){
if(httpAuth.containsKey(TOKEN_NAME_BASIC_AUTH_KEY)){
con.setRequestProperty(httpAuth.get(TOKEN_NAME_BASIC_AUTH_KEY), httpAuth.get(TOKEN_ID_BASIC_AUTH_KEY));
}
String authString = httpAuth.get(USER_BASIC_AUTH_KEY) + ":" + httpAuth.get(PASSWORD_BASIC_AUTH_KEY);
String authStringEnc = Base64.encodeBytes(authString.getBytes());
con.setRequestProperty("Authorization", "Basic " + authStringEnc);
}
con.setUseCaches (false);
con.setDoInput(true);
if(parameters != null){
con.setDoOutput(true);
try {
con.getOutputStream().write(parameters.getBytes());
con.getOutputStream().flush();
con.getOutputStream().close();
} catch (IOException e) {
return null;
}
}
int responseCode;
try {
responseCode = con.getResponseCode();
} catch (IOException e) {
responseCode = ErrorDescription.NO_INTERNET_CONNECTION;
}
Map<String, String> result = new HashMap<String, String>();
result.put(STATUS_CODE_RESPONSE_KEY, String.valueOf(responseCode));
catchHeadersResponse(con);
if((responseCode == HttpURLConnection.HTTP_OK) || (responseCode == HttpURLConnection.HTTP_MOVED_TEMP) || responseCode == HttpURLConnection.HTTP_MOVED_PERM){
if(responseCode == HttpURLConnection.HTTP_MOVED_TEMP || responseCode == HttpURLConnection.HTTP_MOVED_PERM){
result.put("Location", con.getHeaderField("Location"));
}
if((watchCookies) && con.getHeaderField("Set-Cookie") != null){
if(cookiesList != null){
cookiesList.clear();
}else{
cookiesList = new ArrayList<String>();
}
for (Map.Entry<String, List<String>> responseHeader : con.getHeaderFields().entrySet()){
if(responseHeader.getKey() == null){
continue;
}
List<String> value = responseHeader.getValue();
System.out.print("\n" + responseHeader.getKey() + ": ");
for (String valueElement : value) {
System.out.print(valueElement);
if(responseHeader.getKey().equals("Set-Cookie")){
cookiesList.add(valueElement);
}
}
}
}
}
if(getBodyResponse){
result.put(BODY_TEXT_RESPONSE_KEY, (retrieveBodyResponse(con, responseCode)));
}
con.disconnect();
return result;
}
private String retrieveBodyResponse(HttpURLConnection con, int responseCode){
BufferedReader in;
try {
if(responseCode >= 400){
try{
in = new BufferedReader(new InputStreamReader(con.getErrorStream()));
}catch(NullPointerException e){
try{
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
}catch(NullPointerException e2){
return null;
}
}
}else{
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
}
} catch (IOException e) {
return null;
}
String inputLine;
StringBuffer response = new StringBuffer();
try {
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
} catch (IOException e) {
return null;
}
try {
return new String(response.toString().getBytes(), this.charset);
} catch (UnsupportedEncodingException e) {
return null;
}
}
private void catchHeadersResponse(HttpURLConnection con){
responseHeaders = new HashMap<String, String>();
for (Map.Entry<String, List<String>> responseHeader : con.getHeaderFields().entrySet()){
if(responseHeader.getKey() == null || responseHeader.getKey().equals("Set-Cookie")){
continue;
}
List<String> value = responseHeader.getValue();
int i = 0;
for (String valueElement : value) {
if(i == 0){
responseHeaders.put(responseHeader.getKey(), valueElement);
}else{
responseHeaders.put(responseHeader.getKey(), responseHeaders.get(responseHeader.getKey()) + ";" + valueElement);
}
i++;
}
}
}
public Map<String, String> getResonseHeaders() {
return responseHeaders;
}
public void setResonseHeaders(Map<String, String> resonseHeaders) {
this.responseHeaders = resonseHeaders;
}
public static void main(String[] args){
URL url;
try {
url = new URL("http://thepiratebay.org");
} catch (MalformedURLException e) {
e.printStackTrace();
return;
}
ConnectionManager cm = new ConnectionManager();
Map<String, String> response = cm.sendRequest(url, ConnectionManager.METHOD_GET, true, false, false);
System.out.println(response);
}
public String getCharset() {
return charset;
}
public void setCharset(String charset) {
this.charset = charset;
}
}
| [
"juas83@gmail.com"
] | juas83@gmail.com |
48afb812eb7030f87a699b9a080b3af200173635 | fe8d5b6d9232a26e7003733e3d6c717bbde5a71a | /BeyondAR_Framework/src/com/beyondar/android/opengl/renderable/Renderable.java | 033329a113a99f4237c90a6143d549dbe2133972 | [] | no_license | mblancomu/mercappdillos | be6c909bf5b9cda7cf46fde52eacf3238af30914 | bf44c3e3d62459514b85631e24f24478b0a4a805 | refs/heads/master | 2021-01-23T22:06:19.727898 | 2015-09-23T15:56:19 | 2015-09-23T15:56:19 | 21,873,007 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,958 | java | /*
* Copyright (C) 2013 BeyondAR
*
* 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.beyondar.android.opengl.renderable;
import javax.microedition.khronos.opengles.GL10;
import com.beyondar.android.opengl.renderer.ARRenderer;
import com.beyondar.android.opengl.texture.Texture;
import com.beyondar.android.util.math.geom.Plane;
import com.beyondar.android.util.math.geom.Point3;
import com.beyondar.android.world.BeyondarObject;
public interface Renderable {
/** The draw method to be used by OpenGL */
public void draw(GL10 gl, Texture defaultTexture);
/**
* Update the renderer before the draw method is called.
*
* @param time
* The time mark.
* @param distance
* The distance form the camera in meters.
* @return True to force to paint the object, false otherwise. If false, the
* {@link ARRenderer} will draw it if it close enough to the camera
*/
public boolean update(long time, double distance,
BeyondarObject beyondarObject);
/**
* This method is called when the renderable is not painted because is too
* far
*/
public void onNotRendered(double dst);
public Texture getTexture();
public Plane getPlane();
public void setPosition(float x, float y, float z);
public Point3 getPosition();
public void setAngle(float x, float y, float z);
public Point3 getAngle();
public long getTimeFlag();
// public void setGeoObject(GeoObject object);
}
| [
"mblancomu@gmail.com"
] | mblancomu@gmail.com |
511d5d21a677a6e3c320a62c47f683d7906ada55 | 1c67c9d2da9fedb9e38d604cf08f7decf50fce31 | /pbn-app/src/main/java/pl/wat/inz/pbn/app/Application.java | 4313bd4fb907666b15c501b0f0c7e2a89f25e8fb | [] | no_license | kubazrb/PBN-APP | 06a0e65bf481f2390fc555dc442ff50ea426b27a | 50816279b117a2ce65a9635cb51840f9588fcbca | refs/heads/master | 2020-03-27T13:49:31.282293 | 2019-01-15T09:36:43 | 2019-01-15T09:36:43 | 146,629,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java | package pl.wat.inz.pbn.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"kuba.zrb@gmail.com"
] | kuba.zrb@gmail.com |
9ec60f8d9fd8ee90957666da22a5b0306f80e6ce | 8a49281e6921eec5e558bcb0e3959380c0ebe231 | /jimapp-core/captcha/src/main/java/com.jim.captcha/core/predefined/DiffuseRippleFilterFactory.java | 1d3f7213054e4a102aa2ae4e0b282db95d9755d7 | [] | no_license | liu1084/jim-app | 3daf3bbc86c27d5d0784784f19a13d6f51ad0e06 | 7d7088fc8615946986d12cb8c470ecd6b11d22e4 | refs/heads/master | 2020-12-24T11:46:57.297241 | 2017-04-05T19:25:17 | 2017-04-05T19:25:17 | 85,742,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | /*
* Copyright © 2016 JIM liu
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.jim.captcha.core.predefined;
import com.jim.captcha.core.library.DiffuseImageOp;
import java.awt.image.BufferedImageOp;
import java.util.ArrayList;
import java.util.List;
public class DiffuseRippleFilterFactory extends RippleFilterFactory {
protected DiffuseImageOp diffuse = new DiffuseImageOp();
@Override
protected List<BufferedImageOp> getPreRippleFilters() {
List<BufferedImageOp> list = new ArrayList<BufferedImageOp>();
list.add(diffuse);
return list;
}
}
| [
"liu1084@163.com"
] | liu1084@163.com |
d452f4338530faa0843fb0e3d20ff6ca4e263e6c | 608c604e3eb1aae31d622a206e2ac0e7fd95020c | /SnapShoot/app/src/main/java/com/dal_a/snapshoot/card/SelectableCardView.java | b62c768e2b00d65c5f89ac3f158ac5799a7133d5 | [] | no_license | JiaYoon/SweetProject | f9e39a14e1d0a82511d3b28a8efcd014b3ce30a8 | 24744357814bd869d6d92ec387eb4864b915fd2e | refs/heads/master | 2021-01-20T18:47:54.185148 | 2016-06-09T13:17:03 | 2016-06-09T13:17:03 | 60,775,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | package com.dal_a.snapshoot.card;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.dal_a.snapshoot.R;
import com.dal_a.snapshoot.model.SquareImageCardView;
/**
* Created by GA on 2015. 9. 20..
*/
public class SelectableCardView extends SquareImageCardView<SelectableCard> {
public SelectableCardView(Context context) {
super(context);
}
public SelectableCardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SelectableCardView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void build(SelectableCard card) {
super.build(card);
TextView name = (TextView)findViewById(R.id.name);
name.setText(card.getName());
if(card.isSelecting()) setSelected(true);
else setSelected(false);
}
@Override
public void setSelected(boolean selected) {
super.setSelected(selected);
}
}
| [
"yoon4591@gmail.com"
] | yoon4591@gmail.com |
fe6d43329eeac97e05d7726e48ae07b80a82e0d2 | 9151c663c6057949196f4a378b9a922d94b7dac6 | /app/src/main/java/com/example/fragmentindepthapp/Constant.java | 2ee8ad47a9eb7c195c2060598a3e08314cd2458e | [] | no_license | rajpoot-shikha/Fragment_AddToBackStack | 5f36264ed6c5193e853cc230cac054c7e6332376 | 442e3683cfb8f1b876873b2b5b25a858224c4277 | refs/heads/master | 2020-09-18T18:38:20.925089 | 2019-11-26T10:52:55 | 2019-11-26T10:52:55 | 224,166,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package com.example.fragmentindepthapp;
//contains the constants used in application
class Constant {
static final String FRAGMENT_ONE = "fragmentOne";
static final String FRAGMENT_TWO = "fragmentTwo";
}
| [
"shikha.rajpoot@globallogic.com"
] | shikha.rajpoot@globallogic.com |
46b27c6d0074d176b96ad1ce8b6c74addd4b2e72 | ef044f30543e4e7f36b15f9763a779e866e7c246 | /src/com/kh/cool/purchase/model/vo/CartIngredient.java | 752fc97d6086f9bdedc2fd42170140f130f31523 | [] | no_license | juhS/semipjtsjh | 89732bcee7fa0ff06eda08bf3613ef1c49d51dfe | 2dda1e636710be971582eebee39c23a18d322339 | refs/heads/master | 2023-04-21T06:48:20.346993 | 2021-05-21T15:51:40 | 2021-05-21T15:51:40 | 369,580,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | package com.kh.cool.purchase.model.vo;
public class CartIngredient implements java.io.Serializable{
private String iCode;
private int num;
public CartIngredient() {}
public CartIngredient(String iCode, int num) {
super();
this.iCode = iCode;
this.num = num;
}
public String getiCode() {
return iCode;
}
public void setiCode(String iCode) {
this.iCode = iCode;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
@Override
public String toString() {
return "CartIngredient [iCode=" + iCode + ", num=" + num + "]";
}
}
| [
"ju_hy@DESKTOP-1OR0E3A"
] | ju_hy@DESKTOP-1OR0E3A |
1b08dab2183a5f886c578ddfa1e69a5fd17aebb3 | 9d65a11c38247d9aed6ca47afc37b3b169affe8d | /HTMCEJB/ejbModule/SessionBeans/UnidadDependenciaFacadeLocal.java | 8ec760e3534ceea2bf9f9d99af50e8ebeaea4c2b | [] | no_license | lcevallo/HTMC | 2644c8a1306e08939ebed915949b2907e4e52496 | 13fc47e72384faae5755ab63eb688f71c6e7fbd8 | refs/heads/master | 2021-06-03T02:24:43.641973 | 2020-01-16T02:44:09 | 2020-01-16T02:44:09 | 96,184,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 698 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package SessionBeans;
import java.util.List;
import javax.ejb.Local;
import Entities.UnidadDependencia;
/**
*
* @author Bryan
*/
@Local
public interface UnidadDependenciaFacadeLocal {
void create(UnidadDependencia UnidadDependencia);
void edit(UnidadDependencia UnidadDependencia);
void remove(UnidadDependencia UnidadDependencia);
UnidadDependencia find(Object id);
List<UnidadDependencia> findAll();
List<UnidadDependencia> findRange(int[] range);
int count();
}
| [
"lcevallo@gmail.com"
] | lcevallo@gmail.com |
93a5e1fc6d24047f81665c28c145f8ac5956e256 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/TIME-7b-3-1-Single_Objective_GGA-WeightedSum-BasicBlockCoverage/org/joda/time/format/DateTimeParserBucket$SavedField_ESTest.java | 9d1977ec27a535e8f0dc63bde90eb0c1564a68ec | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | /*
* This file was automatically generated by EvoSuite
* Fri May 15 12:20:30 UTC 2020
*/
package org.joda.time.format;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.joda.time.DateTimeField;
import org.joda.time.chrono.BuddhistChronology;
import org.joda.time.field.DelegatedDateTimeField;
import org.joda.time.format.DateTimeParserBucket;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class DateTimeParserBucket$SavedField_ESTest extends DateTimeParserBucket$SavedField_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
BuddhistChronology buddhistChronology0 = BuddhistChronology.getInstance();
buddhistChronology0.getZone();
BuddhistChronology buddhistChronology1 = BuddhistChronology.getInstance();
DateTimeField dateTimeField0 = buddhistChronology1.dayOfMonth();
DelegatedDateTimeField delegatedDateTimeField0 = new DelegatedDateTimeField(dateTimeField0);
DateTimeParserBucket.SavedField dateTimeParserBucket_SavedField0 = new DateTimeParserBucket.SavedField(dateTimeField0, 4152);
boolean boolean0 = true;
// Undeclared exception!
dateTimeParserBucket_SavedField0.set((-1765L), true);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
d243ac7ada08f4da49b5c278a8995934d5c02307 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/29/org/apache/commons/math3/geometry/partitioning/utilities/AVLTree_insert_61.java | 4536b1890f1f14c25272759dc6c3f17c6e251542 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 1,246 | java |
org apach common math3 geometri partit util
avl tree
purpos sort element allow
duplic element code equal
code sort set sortedset
specif need null element allow
code equal method suffici
differenti element link delet delet method
implement equal oper
order mark method provid
semant
code sort set sortedset name
code add replac link insert insert
code remov replac link delet
delet
base implement georg kraml put
domain
href www purist org georg avltre index html page
exist
param type element
version
avl tree avltre compar
insert element tree
param element element insert silent
insert element
element
top
top node element
top insert element
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
ce9787b9d063ca12a03b4a93e336c11871710b1e | a2569cea7506488ee17d89a0f671bd30fb1ebdab | /ecsite-licca/src/com/internousdev/ecsite/dao/BuyItemCompleteDAO.java | 147ea02cc0566da3009b0f13a159f755aa42acc4 | [] | no_license | licca375/MyECsite | a7ff323bd126309a11b2c6444999c45fb2be3b0c | 419c932e6b4939275ef268097fff6df49b632b23 | refs/heads/master | 2020-03-10T10:20:49.555667 | 2018-06-01T04:44:19 | 2018-06-01T04:44:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.internousdev.ecsite.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.internousdev.ecsite.util.DBConnector;
import com.internousdev.ecsite.util.DateUtil;
public class BuyItemCompleteDAO {
private DBConnector dbConnector = new DBConnector();
private Connection connection = dbConnector.getConnection();
private DateUtil dateUtil = new DateUtil();
private String sql = "INSERT INTO user_buy_item_transaction (item_transaction_id, total_price, total_count, user_master_id, pay, insert_date)VALUES(?, ?, ?, ?, ?, ?)";
public void buyItemeInfo(String item_transaction_id, String user_master_id,
String total_price, String total_count, String pay) throws SQLException {
try {
PreparedStatement preparedStatement = connection.prepareStatement(sql);
preparedStatement.setString(1, item_transaction_id);
preparedStatement.setString(2, total_price);
preparedStatement.setString(3, total_count);
preparedStatement.setString(4, user_master_id);
preparedStatement.setString(5, pay);
preparedStatement.setString(6, dateUtil.getDate());
preparedStatement.execute();
} catch(Exception e) {
e.printStackTrace();
} finally {
connection.close();
}
}
}
| [
"lica375@icloud.com"
] | lica375@icloud.com |
d4858e296f14fa46fb0dd0e99bdb8d2101f059d8 | c45813bc216e4646caa5d654e7a6dd3cf0cdaeb7 | /engine/src/main/java/com/kinglloy/album/engine/video/VideoWallpaper.java | b69054b3c9a4e56dbc1d58a8a9c67cd4aab74ea8 | [] | no_license | paijwar/LWA | 732f5d0e44b3316bd538c0442cd4440fc12fd215 | 550ec5b6389ffee4a4b8e621970d7ebe4db89dc7 | refs/heads/master | 2022-03-24T04:57:39.346402 | 2019-09-30T07:40:54 | 2019-09-30T07:40:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.kinglloy.album.engine.video;
import android.content.Context;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.badlogic.gdx.backends.android.AndroidLiveWallpaperService;
import com.yalin.style.engine.GDXWallpaperServiceProxy;
import org.jetbrains.annotations.NotNull;
/**
* @author jinyalin
* @since 2017/11/8.
*/
public class VideoWallpaper extends GDXWallpaperServiceProxy {
private String filePath;
public VideoWallpaper(@NotNull Context host, String filePath) {
super(host);
this.filePath = filePath;
}
@Override
public void onCreateApplication() {
super.onCreateApplication();
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useGLSurfaceView20API18 = true;
config.useAccelerometer = false;
initialize(new VideoRenderer(this, filePath), config);
}
}
| [
"jinyalin@baidu.com"
] | jinyalin@baidu.com |
490338aabb9b45103e807895d0b162605f6f3ab3 | 951455c29450e65e23d7718bb75bd2448c2fc2fe | /test/com/app/junit/MyMathTest.java | 4a03ef858ab7a52d01ce9bc359ddc477c87fc5fd | [] | no_license | shivam6898/JunitTesting | 06bb9f0dd96a8a44a02c4b35d869fe8292efe396 | 1310146ef0c9c67b93dad473988ba27be08b4e58 | refs/heads/master | 2022-12-26T21:37:24.602398 | 2020-10-08T10:10:47 | 2020-10-08T10:10:47 | 302,301,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 763 | java | package com.app.junit;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.jupiter.api.Test;
//Absence if failure is success.
class MyMathTest {
@Test
public void sum_With3Number() {
MyMath myMath= new MyMath();
assertEquals(6, myMath.sum(new int[] {1,2,3})); //alt+shift+i to inline
}
//some of the anotations are
@Before
public void before() {
System.out.println("before...");
}
@After
public void after() {
System.out.println("after");
}
@BeforeClass
public static void beforeClass() {
System.out.println("before class");
}
@AfterClass
public void AfterClass() {
System.out.println("after class");
}
}
| [
"shivampatil727@gmail.com"
] | shivampatil727@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.