blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
58f85ac7b8d42948ea2f53057ab1afaa32bde9a9
|
0290374216c09b3b8a914f24351114d4262353ac
|
/aliyun-java-sdk-cms/src/main/java/com/aliyuncs/cms/model/v20190101/DescribeMonitorGroupInstanceAttributeResponse.java
|
a3083915ed974c137d62d4f25f2318b709c6285a
|
[
"Apache-2.0"
] |
permissive
|
tanglong8848/aliyun-openapi-java-sdk
|
7ab06933afb468648d6eaefd0388f371cf066273
|
c01b826b7957745890439702c86832d956ca752b
|
refs/heads/master
| 2020-05-22T12:17:55.556803 | 2019-05-10T10:15:51 | 2019-05-10T10:15:51 | 186,335,507 | 1 | 0 | null | 2019-05-13T02:58:49 | 2019-05-13T02:58:49 | null |
UTF-8
|
Java
| false | false | 5,808 |
java
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.cms.model.v20190101;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.cms.transform.v20190101.DescribeMonitorGroupInstanceAttributeResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DescribeMonitorGroupInstanceAttributeResponse extends AcsResponse {
private String requestId;
private Boolean success;
private Integer code;
private String message;
private Integer pageNumber;
private Integer pageSize;
private Integer total;
private List<Resource> resources;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Integer getCode() {
return this.code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public Integer getPageNumber() {
return this.pageNumber;
}
public void setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
}
public Integer getPageSize() {
return this.pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotal() {
return this.total;
}
public void setTotal(Integer total) {
this.total = total;
}
public List<Resource> getResources() {
return this.resources;
}
public void setResources(List<Resource> resources) {
this.resources = resources;
}
public static class Resource {
private String instanceName;
private String instanceId;
private String desc;
private String networkType;
private String category;
private String dimension;
private List<Tag> tags;
private Region region;
private Vpc vpc;
public String getInstanceName() {
return this.instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public String getInstanceId() {
return this.instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public String getDesc() {
return this.desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getNetworkType() {
return this.networkType;
}
public void setNetworkType(String networkType) {
this.networkType = networkType;
}
public String getCategory() {
return this.category;
}
public void setCategory(String category) {
this.category = category;
}
public String getDimension() {
return this.dimension;
}
public void setDimension(String dimension) {
this.dimension = dimension;
}
public List<Tag> getTags() {
return this.tags;
}
public void setTags(List<Tag> tags) {
this.tags = tags;
}
public Region getRegion() {
return this.region;
}
public void setRegion(Region region) {
this.region = region;
}
public Vpc getVpc() {
return this.vpc;
}
public void setVpc(Vpc vpc) {
this.vpc = vpc;
}
public static class Tag {
private String key;
private String value;
public String getKey() {
return this.key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
public static class Region {
private String regionId;
private String availabilityZone;
public String getBizRegionId() {
return this.regionId;
}
public void setBizRegionId(String regionId) {
this.regionId = regionId;
}
/**
* @deprecated use getBizRegionId instead of this.
*/
@Deprecated
public String getRegionId() {
return this.regionId;
}
/**
* @deprecated use setBizRegionId instead of this.
*/
@Deprecated
public void setRegionId(String regionId) {
this.regionId = regionId;
}
public String getAvailabilityZone() {
return this.availabilityZone;
}
public void setAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
}
}
public static class Vpc {
private String vpcInstanceId;
private String vswitchInstanceId;
public String getVpcInstanceId() {
return this.vpcInstanceId;
}
public void setVpcInstanceId(String vpcInstanceId) {
this.vpcInstanceId = vpcInstanceId;
}
public String getVswitchInstanceId() {
return this.vswitchInstanceId;
}
public void setVswitchInstanceId(String vswitchInstanceId) {
this.vswitchInstanceId = vswitchInstanceId;
}
}
}
@Override
public DescribeMonitorGroupInstanceAttributeResponse getInstance(UnmarshallerContext context) {
return DescribeMonitorGroupInstanceAttributeResponseUnmarshaller.unmarshall(this, context);
}
}
|
[
"[email protected]"
] | |
73624b1c90b9be8c493caa08d9b996dc64f1ad95
|
00cb65b1c597ac9dcfb5777d9c2a53df4afb6fe0
|
/src/main/java/org/folio/cataloging/dao/persistence/IndexListKey.java
|
37d77e919dab89ce7224b704505594e3cb112738
|
[
"Apache-2.0"
] |
permissive
|
cchiama/mod-cataloging
|
35bb6d7a74cff436ce3482038eaad56bd3a2386c
|
03033567e708400fd9596cd79493bca503e1cca2
|
refs/heads/master
| 2020-03-28T17:00:51.976674 | 2018-09-20T13:24:17 | 2018-09-20T13:24:17 | 148,750,798 | 0 | 0 | null | 2018-09-14T07:17:23 | 2018-09-14T07:17:23 | null |
UTF-8
|
Java
| false | false | 2,127 |
java
|
/*
* (c) LibriCore
*
* Created on Jul 20, 2004
*
* IndexListKey.java
*/
package org.folio.cataloging.dao.persistence;
import java.io.Serializable;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Hibernate key class for IDX_LIST table
* @author paulm
* @version %I%, %G%
* @since 1.0
*/
public class IndexListKey implements Serializable {
private static final Pattern p = Pattern.compile("(\\d+)(.+)"); //digits then the rest
private int keyNumber;
private String typeCode;
private String language;
/**
* Class constructor
*
*
* @since 1.0
*/
public IndexListKey() {
}
/**
* Uses regexp to isolate the digits (group 1) from the rest (group 2)
* Class constructor
*
* @param key a concatenation of keyNumber and typeCode as used in BrowseManager's
* Maps
* @since 1.0
*/
public IndexListKey(String key) {
Matcher m = p.matcher(key);
m.find();
setKeyNumber(Integer.parseInt(m.group(1)));
setTypeCode(m.group(2));
setLanguage(Locale.ENGLISH.getISO3Language());
}
public int getKeyNumber() {
return keyNumber;
}
public String getTypeCode() {
return typeCode;
}
public void setKeyNumber(int i) {
keyNumber = i;
}
public void setTypeCode(String string) {
typeCode = string;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object anObject) {
IndexListKey aKey = (IndexListKey)anObject;
if (this.getKeyNumber() == aKey.getKeyNumber()) {
if (this.getTypeCode().compareTo(aKey.getTypeCode()) == 0){
return true;
}
}
return false;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return this.getKeyNumber();
}
/**
*
*
* @return
* @exception
* @see
* @since 1.0
*/
public String getLanguage() {
return language;
}
/**
*
*
* @param string
* @exception
* @see
* @since 1.0
*/
public void setLanguage(String string) {
language = string;
}
}
|
[
"[email protected]"
] | |
b1aae8aeef2cb4b45ad3449b0c939ae75c6fe547
|
82fc3a88c542b56867df091f8a444f6f56ec52ee
|
/gulimall-product/src/main/java/com/iamxgw/gulimall/product/GulimallProductApplication.java
|
3f11e711610277704af5de25fc6ea981d611c92b
|
[
"Apache-2.0"
] |
permissive
|
IamXGW/gulimall-IamXGW
|
e6cddfd6d1a3793105d22917c0f70d7818c5dd5c
|
af78cfec486c295ceddecebcc7d8ec902669ce93
|
refs/heads/main
| 2023-06-02T21:45:57.942885 | 2021-06-23T07:54:38 | 2021-06-23T07:54:38 | 378,596,523 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 542 |
java
|
package com.iamxgw.gulimall.product;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@EnableDiscoveryClient
@MapperScan("com.iamxgw.gulimall.product.dao")
@SpringBootApplication
public class GulimallProductApplication {
public static void main(String[] args) {
SpringApplication.run(GulimallProductApplication.class, args);
}
}
|
[
"[email protected]"
] | |
ea15cee3ca57c3091fa99ad1953c7e84aa7ea59a
|
01598a5236cf0432d8ae789c0874124606994955
|
/src/main/java/com/yu/theone/service/JPAService.java
|
273bc1f20db6be1c1174011a3cba397e0e107ced
|
[] |
no_license
|
YPeak/one
|
0dad43eafb23c35667f49e51fc407deefa5450c4
|
fdc18801aa7fcc961f22df42d3ad181011c0d15d
|
refs/heads/master
| 2022-06-09T01:10:20.366764 | 2019-12-12T06:28:05 | 2019-12-12T06:28:05 | 180,078,253 | 0 | 0 | null | 2022-05-20T21:17:29 | 2019-04-08T05:47:30 |
Java
|
UTF-8
|
Java
| false | false | 613 |
java
|
package com.yu.theone.service;
import com.yu.theone.entity.TestJPA;
import com.yu.theone.interfaceT.TestJPARepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Created by shuwei.yu.
* on 2019/12/12.
*/
@Service
public class JPAService {
@Transactional(value = "transactionManager",rollbackFor=Exception.class)
public void save(){
testJPARepository.save(new TestJPA("321","1","212"));
}
@Autowired
TestJPARepository testJPARepository;
}
|
[
"[email protected]"
] | |
321184912f5899b90c847ae454dd518ff2c02d21
|
0288f41ba95f6d7160d759da49935c102f096a49
|
/JavaEssentials/H13/src/be/pxl/H13/opdracht/Triangle.java
|
d1b8a4149b2e4f09922b0e255e75d80166029b56
|
[] |
no_license
|
IgnaceFrederix/PXL-1TIN-Java-Essentials
|
bfc187a2b77a9a9fd99820cd7825b65bf3882fc4
|
3e4efd8a0ea8d4cc52177b288d79859112fd8fc9
|
refs/heads/master
| 2022-01-19T21:37:35.476866 | 2019-07-19T21:30:21 | 2019-07-19T21:30:21 | 197,844,453 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,704 |
java
|
package be.pxl.H13.opdracht;
import java.awt.Graphics;
public class Triangle extends Shape implements Drawable{
private int width;
private int height;
private int perpendicular;
public static final int ANGLES = 3;
private static int count = 0;
{
count++;
}
public Triangle() {
this(0,0,0,0,0);
}
public Triangle(int width, int height, int perpendicular) {
this(width,height,perpendicular,0,0);
}
public Triangle(int width, int height, int perpendicular, int x, int y){
super(x,y);
setWidth(width);
setHeight(height);
setPerpendicular(perpendicular);
}
public Triangle(Triangle tri){
this(tri.width, tri.height, tri.perpendicular, tri.getX(), tri.getY());
}
public void setWidth(int width) {
if (width < 0) {
this.width = -width;
} else {
this.width = width;
}
}
public void setHeight(int height) {
if (height < 0) {
this.height = -height;
} else {
this.height = height;
}
}
public void setPerpendicular(int perpendicular){
this.perpendicular = perpendicular;
}
public double getArea() {
return (width * height)/2;
}
public double getPerimeter() {
return width + Math.hypot(height,perpendicular) + Math.hypot(height,(width-perpendicular));
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
public int getPerpendicular() {
return perpendicular;
}
public static int getCount() {
return count;
}
@Override
public String toString() {
return String.format(
"Triangle [width=%s, height=%s, perpendicular=%s, x=%s, y=%s]",
width, height, perpendicular, getX(), getY());
}
@Override
public boolean equals(Object obj) {
if (obj != null && this.getClass() == obj.getClass() && ((Triangle) obj).getX() == this.getX()
&& ((Triangle) obj).getY() == this.getY() && ((Triangle) obj).getHeight() == this.getHeight()
&& ((Triangle) obj).getWidth() == this.getWidth() && ((Triangle) obj).getPerpendicular() == this.perpendicular) {
return true;
} else {
return false;
}
}
@Override
public void scale(int factor) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
double f = Math.sqrt(factor/100.0);
height =(int) (height*f);
width = (int)(width*f);
}
@Override
public void draw(Graphics g) {
// TODO Auto-generated method stub
System.out.println("er wordt een driehoek getekend");
}
}
|
[
"[email protected]"
] | |
54f344703c19554c403d7325f8075093e52a51e9
|
61aa5251ede4df85e5ba4ae4835a9a5da937f5a9
|
/src/test/java/ru/appline/framework/baseTestsClass/BaseTests.java
|
a9f4b750945c5850632c177be61d3b30a53a16e9
|
[] |
no_license
|
nvbelan/HomeFrame
|
55d9ec5d5b99b1771c590a64f26346f268e644ce
|
c1797b01818563264b89cbb0bba68cd2caf0c915
|
refs/heads/master
| 2022-12-24T00:32:13.303568 | 2020-09-23T19:52:49 | 2020-09-23T19:52:49 | 298,037,346 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 457 |
java
|
package ru.appline.framework.baseTestsClass;
import org.junit.After;
import org.junit.Before;
import ru.appline.framework.managers.InitManager;
import ru.appline.framework.managers.ManagerPages;
public class BaseTests {
protected ManagerPages app = ManagerPages.getManagerPages();
@Before
public void beforeEach() {
InitManager.initFramework();
}
@After
public void afterEach() {
InitManager.quitFramework();
}
}
|
[
"[email protected]"
] | |
ceb39161ef36e695606229866c4d5a26fd5fd05b
|
9004c7b5e7086ab0f53d40d3ac9feae80fa3d1b9
|
/src/main/java/me/dags/copy/PlayerManager.java
|
059735902f6ff4495cc255d58b3e6055f6e52bc9
|
[] |
no_license
|
dags-/CopyPasta
|
9bf8ab4f97aec071db9d4125688a1959acb92621
|
d42d6c33b1ea1314a200cbcdad50a1b3a7a8f07e
|
refs/heads/master
| 2021-06-07T04:35:58.108319 | 2020-09-01T21:14:18 | 2020-09-01T21:14:18 | 90,264,705 | 0 | 2 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,959 |
java
|
package me.dags.copy;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Function;
import me.dags.copy.util.Utils;
import me.dags.copy.util.fmt;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.ConfigRoot;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.EventContext;
import org.spongepowered.api.event.cause.EventContextKeys;
import org.spongepowered.api.plugin.PluginContainer;
/**
* @author dags <[email protected]>
*/
public class PlayerManager {
private static final PlayerManager INSTANCE = new PlayerManager();
private final Path userDir;
private final PluginContainer container;
private final Function<UUID, PlayerData> factory;
private final Map<UUID, PlayerData> data = new HashMap<>();
private PlayerManager() {
PluginContainer plugin = Sponge.getPluginManager().getPlugin(CopyPasta.ID).orElseThrow(IllegalStateException::new);
Object instance = plugin.getInstance().orElseThrow(IllegalStateException::new);
ConfigRoot root = Sponge.getGame().getConfigManager().getPluginConfig(instance);
container = plugin;
userDir = Utils.getDir(root.getDirectory(), "users");
factory = uuid -> new PlayerData(userDir.resolve(uuid + ".conf"));
}
public PlayerData must(Player player) {
return data.computeIfAbsent(player.getUniqueId(), factory);
}
public Optional<PlayerData> get(Player player) {
return get(player.getUniqueId());
}
public Optional<PlayerData> get(UUID uuid) {
return Optional.ofNullable(data.get(uuid));
}
public void drop(Player player) {
drop(player.getUniqueId());
}
public void drop(UUID uuid) {
PlayerData playerData = data.remove(uuid);
if (playerData != null) {
playerData.save();
}
}
public void handle(Player player, Throwable t) {
handle(player.getUniqueId(), t);
}
public void handle(UUID uuid, Throwable t) {
PlayerData playerData = data.get(uuid);
if (playerData != null) {
playerData.setOperating(false);
CopyPasta.getInstance().submitSync(() -> {
t.printStackTrace();
Sponge.getServer().getPlayer(uuid)
.ifPresent(fmt.warn("An error occurred: %s, see console", t.getClass().getSimpleName())::tell);
});
}
}
public Cause getCause(Player player) {
EventContext context = EventContext.builder()
.add(EventContextKeys.NOTIFIER, player)
.add(EventContextKeys.OWNER, player)
.build();
return Cause.of(context, container);
}
public static PlayerManager getInstance() {
return INSTANCE;
}
}
|
[
"[email protected]"
] | |
c38aefab4bc9e9d61f7782a29d915ddfdd2b6ae9
|
db9fa5828346d6708fed0a311d9e6b713dda58c6
|
/app/src/main/java/vienan/app/journey/utils/WeatherSource.java
|
b494e2416c27a3f1cd15b32ea7c897fec216d689
|
[] |
no_license
|
ditclear/Journey
|
e7c3ec9762e57362ca5d4434d880481c82b37229
|
9ceec36eff5d303309a97a6b2a998ad5c956040a
|
refs/heads/master
| 2021-05-28T23:26:32.488798 | 2015-08-10T05:16:34 | 2015-08-10T05:16:34 | 39,492,664 | 4 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,718 |
java
|
package vienan.app.journey.utils;
import android.os.AsyncTask;
public class WeatherSource {
private boolean mIsFinish = false;
private String mResult;
private OnFinishListener mFinishListener = null;
private String mCity;
public WeatherSource(String city) {
mCity = city;
new GetSource().execute();
}
public boolean isFinish() {
return mIsFinish;
}
public String getResult() {
return mResult;
}
class GetSource extends AsyncTask<String, Integer, String> {
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
}
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
GlobalConstants.PrintLog_D("[GetSource->doInBackground]");
mIsFinish = false;
try { // http://www.weather.com.cn/data/sk/101280601.html 不再更新天气
String path = "http://api.map.baidu.com/telematics/v3/weather?location="
+ mCity
+ "&output=xml&ak=640f3985a6437dad8135dae98d775a09";
return NetworkUtils.HttpGet(path);
} catch (Exception e) {
System.out.println("doInBackground--Exception");
e.printStackTrace();
return null;
} // http://61.4.185.48:81/g/
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
mResult = result;
mIsFinish = true;
if (mFinishListener != null) {
mFinishListener.OnFinish(result);
}
GlobalConstants.PrintLog_D("[GetSource->onPostExecute]" + result);
}
}
public void setOnFinishListener(OnFinishListener listener) {
mFinishListener = listener;
}
public interface OnFinishListener {
public void OnFinish(String result);
}
}
|
[
"[email protected]"
] | |
012aeed9fea4f6e5c62ea8ec2b17475cf5a9efba
|
a7bd6e5e3d1ed8fd44c9368473c50b9ebf756135
|
/src/test/java/ua/ek/registration/AuthTest.java
|
f36b9e171e1f490d1dc1c7d91a30a3acbe4c87b7
|
[] |
no_license
|
vh-qa/Selenide
|
70e3140a941c72ef00c5f24b23dfbc7af778bb4e
|
70081a755c97542a6cf24e40c4ef8ca59904bbbf
|
refs/heads/master
| 2023-05-10T23:01:32.767453 | 2020-03-17T11:58:38 | 2020-03-17T11:58:38 | 243,779,541 | 0 | 0 | null | 2023-05-09T18:44:40 | 2020-02-28T14:21:14 |
Java
|
UTF-8
|
Java
| false | false | 4,755 |
java
|
package ua.ek.registration;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import ua.ek.model.User;
import ua.ek.pages.HomePage;
import ua.ek.pages.registration.AuthPage;
import ua.ek.registration.base.BaseAuthTest;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
public class AuthTest extends BaseAuthTest {
private AuthPage authPage = new AuthPage();
@BeforeTest
public void openRegistryFormBeforeTest(){
$(By.xpath(authPage.getAuthLinkXpath())).click();
}
// Positive scenario
@Test
public void authSuccessfulTestWithLogin(){
User user = getUserData();
SelenideElement loginElement = $(By.xpath(authPage.getLoginOrEmailAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(loginElement, user.getLogin());
SelenideElement passwordElement = $(By.xpath(authPage.getPasswordAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(passwordElement, user.getPassword());
$(By.xpath(authPage.getSubmitButtonAuthXpath())).click();
$(By.xpath(authPage.getNickXpath())).shouldHave(Condition.text("some_login_14"));
$(By.xpath(authPage.getLogOutFromUserProfileLinkXpath())).click();
$(By.xpath(authPage.getLinkEnterXpath())).shouldHave(Condition.text("Войти"));
}
@Test
public void authSuccessfulTestWithEmail(){
User user = getUserData();
SelenideElement loginElement = $(By.xpath(authPage.getLoginOrEmailAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(loginElement, user.getLogin());
SelenideElement passwordElement = $(By.xpath(authPage.getPasswordAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(passwordElement, user.getPassword());
$(By.xpath(authPage.getSubmitButtonAuthXpath())).click();
$(By.xpath(authPage.getNickXpath())).shouldHave(Condition.text("some_login_14"));
$(By.xpath(authPage.getLogOutFromUserProfileLinkXpath())).click();
$(By.xpath(authPage.getLinkEnterXpath())).shouldHave(Condition.text("Войти"));
}
// Negative scenario
@Test
public void authUnSuccessfulTestWithLogin() {
User user = getUserData();
SelenideElement loginElement = $(By.xpath(authPage.getLoginOrEmailAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(loginElement, "");
SelenideElement passwordElement = $(By.xpath(authPage.getPasswordAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(passwordElement, user.getPassword());
$(By.xpath(authPage.getSubmitButtonAuthXpath())).click();
$(By.xpath(authPage.getErrorLoginAuthXpath())).shouldHave(Condition.text("Введите логин/email!"));
$(By.xpath(authPage.getCloseLinkRegistrationFormXpath())).click();
}
@Test
public void authUnSuccessfulTestWithEmail() {
User user = getUserData();
SelenideElement loginElement = $(By.xpath(authPage.getLoginOrEmailAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(loginElement, "[email protected]");
SelenideElement passwordElement = $(By.xpath(authPage.getPasswordAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(passwordElement, user.getPassword());
$(By.xpath(authPage.getSubmitButtonAuthXpath())).click();
$(By.xpath(authPage.getErrorLoginAuthXpath())).shouldHave(Condition.text("Введите логин/email!"));
$(By.xpath(authPage.getCloseLinkRegistrationFormXpath())).click();
}
@Test
public void authUnSuccessfulTestWithPassword() {
User user = getUserData();
SelenideElement loginElement = $(By.xpath(authPage.getLoginOrEmailAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(loginElement, user.getLogin());
SelenideElement passwordElement = $(By.xpath(authPage.getPasswordAuthFieldXpath()));
authPage.getHelper().enterTextIntoTextField(passwordElement, "");
$(By.xpath(authPage.getSubmitButtonAuthXpath())).click();
$(By.xpath(authPage.getErrorPasswordAuthXpath())).shouldHave(Condition.text("Введите пароль!"));
$(By.xpath(authPage.getCloseLinkRegistrationFormXpath())).click();
}
private User getUserData(){
User user = new User();
user.setLogin("some_login_14");
user.setEmail("[email protected]");
user.setPassword("some_password_14");
return user;
}
}
|
[
"[email protected]"
] | |
7fef7c558ca581ce19709b3a7c1b6cd9e3cc82d8
|
134581bf28ed36991b2a79e4443751afd9d0fa5f
|
/common/src/main/java/com/free4lab/account/module/AuditModule.java
|
d900e7964310945a4547c31fa4f27d1fbfaf2dce
|
[
"MIT"
] |
permissive
|
zihanbobo/WebRTC
|
b6e8b111d71ef325a3ce8ac2895475c78461b19f
|
0044d07f8b96fb6ed8439b75864b65f525092800
|
refs/heads/master
| 2021-06-13T05:44:42.591871 | 2017-03-10T02:20:19 | 2017-03-10T02:20:19 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,307 |
java
|
package com.free4lab.account.module;
import java.util.List;
import org.apache.log4j.Logger;
//import com.free4lab.account.manager.LogUtilManager;
public class AuditModule {
private final static Logger logger = Logger.getLogger(AuditModule.class);
// private final static LogUtilManager lolmanager = new LogUtilManager(AuditModule.class);
public static String getClientIdValue(String client_id){
String clientId = "";
if(client_id.equalsIgnoreCase("userinfo")){
clientId = "Free账号";
}else if(client_id.equalsIgnoreCase("freeshare")){
clientId = "Free分享";
}else if(client_id.equalsIgnoreCase("appcloud")){
clientId = "云海(Paas)平台";
}else if(client_id.equalsIgnoreCase("iaas")){
clientId = "云海(Iaas)平台";
}else if(client_id.equalsIgnoreCase("webrtc")){
clientId = "WebRTC";
}else if(client_id.equalsIgnoreCase("freeshareadmin")){
clientId = "Free分享企业管理员门户";
}else if(client_id.equalsIgnoreCase("freeshare_mobile")){
clientId = "Free分享手机版";
}
return clientId;
}
public static void addLogin(int uid, String client_id, String code, String firstCode, String access_token){
String clientId = getClientIdValue(client_id);
if(code.equalsIgnoreCase(firstCode)){
try{
// lolmanager.info(uid, "用户登录'"+clientId+"'成功", "第一次登录",
// access_token, client_id);
}catch(Exception e){
logger.error(e.getMessage());
}
}else{
try{
// lolmanager.info(uid, "用户登录'"+clientId+"'成功", "登录",
// access_token, client_id);
}catch(Exception e){
logger.error(e.getMessage());
}
}
}
public static void addLogout(int uid,String access_token,String client_id) {
String clientId = getClientIdValue(client_id);
// List<String> results = LogUtilManager.calcLoginTime(uid, access_token);
// if(results != null && results.size() == 3){
// lolmanager.info(uid, "用户退出'"+clientId+"'成功,本次登录时常为:"+results.get(0)+"ms,共登录过"+results.get(1)+"个应用:"+results.get(2), "退出",
// access_token, client_id);
// }else{
// lolmanager.info(uid, "用户退出'"+clientId+"'成功", "退出",
// access_token, client_id);
}
}
|
[
"[email protected]"
] | |
8ef486ee1e36f1bd5b54fb7976278a652f474dc9
|
7480002c087993f255c6ea78591d66828df7a1b9
|
/app/src/main/java/com/bibiweather/android/Web2Activity.java
|
38ddb136d4d9d7b0a276e5d004b4f677bf574055
|
[
"Apache-2.0"
] |
permissive
|
menyiDoorOne/bibiweather
|
1a396cc5aef2f3882a9e3ef1bb240e214c947377
|
574bdbff27f4fa45727a035b5348f099a12e0c1c
|
refs/heads/master
| 2020-03-18T14:09:29.176039 | 2018-06-10T13:02:37 | 2018-06-10T13:02:37 | 134,833,062 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 725 |
java
|
package com.bibiweather.android;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class Web2Activity extends AppCompatActivity {
//跳转到我的微博主页,这次APP中没有用到
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web2);
WebView webView = findViewById(R.id.web_view2);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://weibo.com/my459198833?refer_flag=1001030101_&is_hot=1");
}
}
|
[
"[email protected]"
] | |
7e8576d41d21c5368d326de34340f93f6e035c4d
|
25f216fb4d00efccc36f1e71e8cb30e5f60ab304
|
/libraryBase/src/main/java/com/vincent/filepicker/adapter/NormalFilePickAdapter.java
|
63c8d309b8f71d771cee96344274da3e3ad7f313
|
[] |
no_license
|
zhengjirui/zjrdemo
|
9c116528ec345e253b4c09d467c0f4fbff25e997
|
314efa171c7cd5f8ceeb7f67dcfe630299c20058
|
refs/heads/master
| 2021-04-26T23:43:42.530204 | 2018-03-05T01:05:47 | 2018-03-05T01:05:47 | 123,845,362 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,789 |
java
|
package com.vincent.filepicker.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.ImageView;
import android.widget.TextView;
import com.kwan.base.R;
import com.vincent.filepicker.Util;
import com.vincent.filepicker.filter.entity.NormalFile;
import java.util.ArrayList;
/**
* Created by Vincent Woo
* Date: 2016/10/26
* Time: 10:23
*/
public class NormalFilePickAdapter extends BaseAdapter<NormalFile, NormalFilePickAdapter.NormalFilePickViewHolder> {
private int mMaxNumber;
private int mCurrentNumber = 0;
public NormalFilePickAdapter(Context ctx, int max) {
this(ctx, new ArrayList<NormalFile>(), max);
}
public NormalFilePickAdapter(Context ctx, ArrayList<NormalFile> list, int max) {
super(ctx, list);
mMaxNumber = max;
}
@Override
public NormalFilePickViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(R.layout.layout_item_normal_file_pick, parent, false);
return new NormalFilePickViewHolder(itemView);
}
@Override
public void onBindViewHolder(final NormalFilePickViewHolder holder, final int position) {
final NormalFile file = mList.get(position);
holder.mTvTitle.setText(file.getName());
holder.mTvTitle.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
if (holder.mTvTitle.getMeasuredWidth() >
Util.getScreenWidth(mContext) - Util.dip2px(mContext, 10 + 32 + 10 + 48 + 10 * 2)) {
holder.mTvTitle.setLines(2);
} else {
holder.mTvTitle.setLines(1);
}
if (file.isSelected()) {
holder.mCbx.setSelected(true);
} else {
holder.mCbx.setSelected(false);
}
if (file.getPath().endsWith("xls") || file.getPath().endsWith("xlsx")) {
holder.mIvIcon.setImageResource(R.mipmap.ic_excel);
} else if (file.getPath().endsWith("doc") || file.getPath().endsWith("docx")){
holder.mIvIcon.setImageResource(R.mipmap.ic_word);
} else if (file.getPath().endsWith("ppt") || file.getPath().endsWith("pptx")){
holder.mIvIcon.setImageResource(R.mipmap.ic_ppt);
} else if (file.getPath().endsWith("pdf")){
holder.mIvIcon.setImageResource(R.mipmap.ic_pdf);
} else if (file.getPath().endsWith("txt")){
holder.mIvIcon.setImageResource(R.mipmap.ic_txt);
} else {
holder.mIvIcon.setImageResource(R.mipmap.ic_file);
}
holder.mCbx.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!v.isSelected() && isUpToMax()) {
return;
}
if (v.isSelected()) {
holder.mCbx.setSelected(false);
mCurrentNumber--;
} else {
holder.mCbx.setSelected(true);
mCurrentNumber++;
}
mList.get(holder.getAdapterPosition()).setSelected(holder.mCbx.isSelected());
if (mListener != null) {
mListener.OnSelectStateChanged(holder.mCbx.isSelected(), mList.get(holder.getAdapterPosition()));
}
}
});
// holder.itemView.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Uri uri = Uri.parse("file://" + file.getPath());
// Intent intent = new Intent(Intent.ACTION_VIEW);
// intent.setDataAndType(uri, "audio/mp3");
// if (Util.detectIntent(mContext, intent)) {
// mContext.startActivity(intent);
// } else {
// Toast.makeText(mContext, "No Application exists for audio!", Toast.LENGTH_SHORT).show();
// }
// }
// });
}
@Override
public int getItemCount() {
return mList.size();
}
class NormalFilePickViewHolder extends RecyclerView.ViewHolder {
private ImageView mIvIcon;
private TextView mTvTitle;
private ImageView mCbx;
public NormalFilePickViewHolder(View itemView) {
super(itemView);
mIvIcon = (ImageView) itemView.findViewById(R.id.ic_file);
mTvTitle = (TextView) itemView.findViewById(R.id.tv_file_title);
mCbx = (ImageView) itemView.findViewById(R.id.cbx);
}
}
private boolean isUpToMax() {
return mCurrentNumber >= mMaxNumber;
}
}
|
[
"[email protected]"
] | |
15ff5e6174b83cbc166c841e89b082f66611eb27
|
931015d94934774b8309a1b19f2bb15c74d51dda
|
/Task4/src/main/java/ru/aplana/autotest/steps/SelectPolicySteps.java
|
58c87328797254bf7ea51146796e0ad85ce80bd5
|
[] |
no_license
|
JennySmirnova/SELENIUM
|
3ea903b1a4d950d395cde8ae24e0c2595ab4cbac
|
4b0853e76b3bf64c7dcbaef7e0f5619691571f6f
|
refs/heads/master
| 2023-06-28T01:38:14.975767 | 2021-07-22T14:00:12 | 2021-07-22T14:00:12 | 388,477,416 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 751 |
java
|
package ru.aplana.autotest.steps;
import ru.aplana.autotest.pages.SelectPolicyPages;
import ru.yandex.qatools.allure.annotations.Step;
import static org.junit.Assert.assertTrue;
public class SelectPolicySteps {
@Step("Выбрать полис {0}")
public void selectPolicy (String policyItem){
new SelectPolicyPages().selectPolicy(policyItem);
}
@Step("В заголовке имеется текст {0}")
public void pageTitle (String expectedTitle) {
String actualTitle = new SelectPolicyPages().pageTitle.getText();
assertTrue(String.format("Заголовок равен [%s]. Ожидалось - [%s]",
actualTitle, expectedTitle), actualTitle.contains(expectedTitle));
}
}
|
[
"[email protected]"
] | |
8c847e28b5e9df815bcd33d3115013c2e60c0c79
|
0af8b92686a58eb0b64e319b22411432aca7a8f3
|
/single-large-project/src/test/java/org/gradle/test/performancenull_498/Testnull_49798.java
|
f274cdfaa155cf3d3804e992539c7ce40228f15f
|
[] |
no_license
|
gradle/performance-comparisons
|
b0d38db37c326e0ce271abebdb3c91769b860799
|
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
|
refs/heads/master
| 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null |
UTF-8
|
Java
| false | false | 308 |
java
|
package org.gradle.test.performancenull_498;
import static org.junit.Assert.*;
public class Testnull_49798 {
private final Productionnull_49798 production = new Productionnull_49798("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
}
|
[
"[email protected]"
] | |
16009e042fa3d7512d26b600ca32638149cf4453
|
998d4f0f5120e2da14830c5c46c3c4c697bf13b5
|
/app/src/main/java/com/fikarnot/ui/main/AccountsFragment.java
|
f38e4b4197f0dd2b5929d8c6ef2ef9e2b6d69c0e
|
[
"MIT"
] |
permissive
|
hawk-lib/password-manager
|
9cd8cdbf9b2d272cc6cb496899985f7b85109dc3
|
253041d98dcf194d3a850d1b01c76d76ffa40962
|
refs/heads/master
| 2023-08-20T06:12:35.038578 | 2021-09-28T03:36:09 | 2021-09-28T03:36:09 | 398,974,447 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 27,122 |
java
|
package com.fikarnot.ui.main;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.StrictMode;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.fikarnot.MainActivity;
import com.fikarnot.R;
import com.fikarnot.SharedPrefManager;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.HttpsURLConnection;
import it.xabaras.android.recyclerview.swipedecorator.RecyclerViewSwipeDecorator;
import static android.widget.Toast.LENGTH_SHORT;
/**
* A simple {@link Fragment} subclass.
*/
public class AccountsFragment extends Fragment {
final String version = "1";
List<AccountsModel> accountsModelList;
AccountsRecyclerAdapter myAdapter;
RecyclerView recyclerView;
LinearLayout loading;
LinearLayout clear_screen;
SearchView searchView;
private boolean isNetworkAvailable;
private View view;
private AlertDialog alertDialog;
private ConnectivityManager connectivityManager;
public AccountsFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_accounts, container, false);
setOnNetworkChangeListener();
recyclerView = view.findViewById(R.id.recyclerView);
loading = view.findViewById(R.id.loading);
clear_screen = view.findViewById(R.id.clear_screen);
searchView = view.findViewById(R.id.search_view);
FirebaseDatabase db = FirebaseDatabase.getInstance();
DatabaseReference alert = db.getReference("ALERT");
alert.child("message").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
String message = snapshot.getValue().toString();
if (!message.equals("null")){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
AlertDialog dialog = builder.create();
dialog.setTitle("Note");
dialog.setMessage(message);
dialog.setCancelable(true);
dialog.setButton(Dialog.BUTTON_POSITIVE, "OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialog.dismiss();
}
});
dialog.show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
alert.child("version").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
String latest_version = snapshot.getValue().toString();
if (!version.equals(latest_version)){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
AlertDialog dialog = builder.create();
dialog.setTitle("Note");
dialog.setMessage("Download latest version of this app..");
dialog.setCancelable(false);
dialog.show();
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
DatabaseReference root = db.getReference("USERS")
.child(SharedPrefManager.getInstance(getContext()).getUid()).child("accounts");
root.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()) {
accountsModelList = new ArrayList<>();
clear_screen.setVisibility(View.GONE);
for (DataSnapshot dataSnapshot : snapshot.getChildren()) {
String title = dataSnapshot.getKey();
String username = String.valueOf(dataSnapshot.child("username").getValue());
String password = String.valueOf(dataSnapshot.child("password").getValue());
AccountsModel model = new AccountsModel(title, username, password);
accountsModelList.add(model);
}
myAdapter = new AccountsRecyclerAdapter(getContext(), accountsModelList, new AccountsRecyclerAdapter.SelectedAccount() {
@Override
public void selectedAccount(AccountsModel model) {
Dialog myDialog = new Dialog(getContext());
myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
myDialog.setContentView(R.layout.view_account_dialog);
myDialog.setCancelable(false);
myDialog.getWindow().setBackgroundDrawable(getContext().getDrawable(R.drawable.round_corners));
myDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
TextView title = myDialog.findViewById(R.id.titleTV);
title.setText(model.getTitle());
ImageView dismiss = myDialog.findViewById(R.id.dismiss);
dismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
myDialog.dismiss();
}
});
TextView username = myDialog.findViewById(R.id.usernameTV);
TextView password = myDialog.findViewById(R.id.passwordTV);
username.setText(model.getUsername());
password.setText(model.getPassword());
ImageView copy_username = myDialog.findViewById(R.id.copy_username);
ImageView copy_password = myDialog.findViewById(R.id.copy_password);
copy_username.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("username", model.getUsername());
clipboardManager.setPrimaryClip(clip);
Toast.makeText(getContext(), "Copied!", Toast.LENGTH_SHORT).show();
}
});
copy_password.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("password", model.getPassword());
clipboardManager.setPrimaryClip(clip);
Toast.makeText(getContext(), "Copied!", Toast.LENGTH_SHORT).show();
}
});
myDialog.show();
}
@Override
public void selectedAccountLongClick(AccountsModel model) {
}
});
searchView.setVisibility(View.VISIBLE);
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
myAdapter.getFilter().filter(newText);
return true;
}
});
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
recyclerView.setAdapter(myAdapter);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleCallback);
itemTouchHelper.attachToRecyclerView(recyclerView);
}else{
clear_screen.setVisibility(View.VISIBLE);
searchView.setVisibility(View.GONE);
}
loading.setVisibility(View.GONE);
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
/*root.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (!snapshot.exists()){
}else{
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});*/
return view;
}
ItemTouchHelper.SimpleCallback simpleCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
return false;
}
@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
int position = viewHolder.getAbsoluteAdapterPosition();
AccountsModel model = accountsModelList.get(position);
switch (direction){
case ItemTouchHelper.LEFT:
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
AlertDialog dialog = builder.create();
dialog.setTitle("Delete data?");
dialog.setMessage(model.getTitle() + " account login credentials");
dialog.setCancelable(true);
dialog.setButton(Dialog.BUTTON_POSITIVE, "YES", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (checkInternetConnection()) {
FirebaseDatabase db = FirebaseDatabase.getInstance();
DatabaseReference root = db.getReference("USERS")
.child(SharedPrefManager.getInstance(getContext()).getUid())
.child("accounts");
root.child(model.getTitle()).removeValue().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
dialog.dismiss();
myAdapter.notifyDataSetChanged();
Snackbar.make(recyclerView, "Deleted Successfully!", BaseTransientBottomBar.LENGTH_LONG)
.setAction("Undo", new View.OnClickListener() {
@Override
public void onClick(View view) {
root.child(model.getTitle())
.setValue(new AccountsModel(model.getUsername(), model.getPassword()))
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
myAdapter.notifyDataSetChanged();
Snackbar.make(recyclerView, "Undo Successfully!", BaseTransientBottomBar.LENGTH_SHORT).show();
} else {
Snackbar.make(recyclerView, "Undo Failed!", BaseTransientBottomBar.LENGTH_SHORT).show();
}
}
});
}
})
.setActionTextColor(Color.WHITE).show();
} else {
myAdapter.notifyDataSetChanged();
Snackbar.make(recyclerView, "Failed to delete!", BaseTransientBottomBar.LENGTH_SHORT).show();
}
}
});
}
}
});
dialog.setButton(Dialog.BUTTON_NEGATIVE, "NO", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
myAdapter.notifyDataSetChanged();
dialog.dismiss();
}
});
dialog.show();
break;
case ItemTouchHelper.RIGHT:
myAdapter.notifyDataSetChanged();
Dialog myDialog = new Dialog(getContext());
myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
myDialog.setContentView(R.layout.edit_account_dialog);
myDialog.setCancelable(false);
myDialog.getWindow().setBackgroundDrawable(getContext().getDrawable(R.drawable.round_corners));
myDialog.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
TextView title = myDialog.findViewById(R.id.titleTV);
title.setText(model.getTitle());
ImageView dismiss = myDialog.findViewById(R.id.dismiss2);
dismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
myDialog.dismiss();
}
});
TextInputEditText username = myDialog.findViewById(R.id.usernameET);
username.setText(model.getUsername());
username.setSelection(username.getText().length());
TextInputEditText password = myDialog.findViewById(R.id.passwordET);
password.setText(model.getPassword());
password.setSelection(password.getText().length());
Button update = myDialog.findViewById(R.id.update);
update.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String uname = username.getText().toString();
String pass = password.getText().toString();
if (uname.length() == 0) {
username.setError("Enter username...");
username.requestFocus();
} else if (pass.length() <= 3) {
password.setError("Enter your password...");
password.requestFocus();
} else {
Dialog dialog_new = new Dialog(getContext());
try {
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(password.getWindowToken(), 0);
dialog_new.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog_new.setContentView(R.layout.loading_layout);
dialog_new.setCancelable(false);
dialog_new.getWindow().setBackgroundDrawable(getContext().getDrawable(R.drawable.round_shape_card));
dialog_new.getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dialog_new.show();
}finally {
if (checkInternetConnection()) {
FirebaseDatabase db = FirebaseDatabase.getInstance();
DatabaseReference root = db.getReference("USERS")
.child(SharedPrefManager.getInstance(getContext()).getUid())
.child("accounts").child(model.getTitle());
root.setValue(new AccountsModel(uname, pass))
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
dialog_new.dismiss();
if (task.isSuccessful()) {
myDialog.dismiss();
Snackbar.make(recyclerView, "Updated Successfully.", BaseTransientBottomBar.LENGTH_SHORT).show();
} else {
Snackbar.make(recyclerView, "Failed to Update!", BaseTransientBottomBar.LENGTH_SHORT).show();
}
}
});
} else {
dialog_new.dismiss();
}
}
}
}
});
myDialog.show();
break;
}
}
@Override
public void onChildDraw(@NonNull Canvas c, @NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
new RecyclerViewSwipeDecorator.Builder(getContext(),c,recyclerView,viewHolder,dX,dY,actionState,isCurrentlyActive)
.addSwipeRightBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorGreen))
.addSwipeRightActionIcon(R.drawable.ic_edit)
.addSwipeLeftBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorRed))
.addSwipeLeftActionIcon(R.drawable.ic_delete)
.create()
.decorate();
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
}
};
private boolean hasNetworkAvailable() {
connectivityManager= (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo=connectivityManager.getActiveNetworkInfo();
return networkInfo != null && networkInfo.isConnected();
}
public void setOnNetworkChangeListener() {
if (hasNetworkAvailable()){
isNetworkAvailable = true;
}else {
isNetworkAvailable = false;
}
ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback(){
@Override
public void onLost(Network network){
isNetworkAvailable = false;
}
@Override
public void onAvailable(Network network){
if (alertDialog != null){
alertDialog.dismiss();
}
isNetworkAvailable = true;
}
};
NetworkRequest request = new NetworkRequest.Builder().build();
connectivityManager.registerNetworkCallback(request, networkCallback);
}
public boolean checkInternetConnection() {
if (!isNetworkAvailable) {
noInternetDialog();
return false;
} else {
if (isConnected()){
return true;
}else{
return poorConnectionDialog();
}
}
}
private void noInternetDialog() {
if (alertDialog != null){
alertDialog.dismiss();
}
view = LayoutInflater.from(getContext()).inflate(R.layout.network_dialog, null);
TextView status = view.findViewById(R.id.status);
Button actionBT = view.findViewById(R.id.actionBT);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
String status_text = "No Internet Connection";
String button_text = "Ok";
status.setText(status_text);
actionBT.setText(button_text);
actionBT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
}
});
builder.setView(view);
alertDialog = builder.create();
alertDialog.show();
}
private boolean poorConnectionDialog() {
if (alertDialog != null){
alertDialog.dismiss();
}
view = LayoutInflater.from(getContext()).inflate(R.layout.network_dialog, null);
TextView status = view.findViewById(R.id.status);
Button actionBT = view.findViewById(R.id.actionBT);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
String status_text = "Poor Network Connection";
String button_text = "Retry";
boolean[] result = new boolean[1];
status.setText(status_text);
actionBT.setText(button_text);
actionBT.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alertDialog.dismiss();
result[0] = checkInternetConnection();
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
alertDialog.dismiss();
result[0] = false;
}
});
builder.setView(view);
alertDialog = builder.create();
alertDialog.show();
return result[0];
}
private boolean isConnected() {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
try {
HttpsURLConnection url_conn = (HttpsURLConnection) new URL("https://clients3.google.com/generate_204").openConnection();
url_conn.setRequestProperty("User-Agent", "Android");
url_conn.setRequestProperty("Connection", "close");
url_conn.setConnectTimeout(1000);
url_conn.connect();
return url_conn.getResponseCode() == 204 && url_conn.getContentLength() == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
}
|
[
"[email protected]"
] | |
8f463f805a435d489ee4927901c0fd99129738ee
|
79100654124376dc5b9078b784c13f2fc64f205e
|
/app/src/main/java/com/aircall/app/Dialog/ForgotPasswordFragment.java
|
fc070f6a317212e7e57deb0ae03ff64f2d9b0c1a
|
[] |
no_license
|
AirCallInc/AirCall_Client_APP_Android
|
90a2a5cf32c7623b8d513d3111279a08d0959e00
|
d7dfaaa0fd3f9b819053f6ab9c14e6013ca2a692
|
refs/heads/master
| 2020-03-29T01:40:35.719089 | 2018-09-19T07:29:14 | 2018-09-19T07:29:14 | 149,400,686 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,654 |
java
|
package com.aircall.app.Dialog;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.app.DialogFragment;
import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.aircall.app.Common.ErrorMessages;
import com.aircall.app.Common.GlobalClass;
import com.aircall.app.Common.ServiceGenerator;
import com.aircall.app.Interfaces.DialogInterfaceClick;
import com.aircall.app.Interfaces.WebserviceApi;
import com.aircall.app.LoginActivity;
import com.aircall.app.Model.ForgotPassword.ForgotPasswordResponce;
import com.aircall.app.R;
import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;
@SuppressLint("ValidFragment")
public class ForgotPasswordFragment extends DialogFragment {
private DialogInterfaceClick dialogInterface;
Dialog new_dialog;
private GlobalClass globalClass;
public ForgotPasswordFragment(GlobalClass globalClass, DialogInterfaceClick dialogInterface) {
this.dialogInterface = dialogInterface;
this.globalClass = globalClass;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
LayoutInflater li = LayoutInflater.from(getActivity());
View promptsView = li.inflate(R.layout.alert_forgot_password, null);
new_dialog = new Dialog(getActivity());
new_dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
new_dialog.setContentView(promptsView);
final EditText edtEmailAddress = (EditText) new_dialog
.findViewById(R.id.edtForgotPassword);
final LinearLayout layout_submit = (LinearLayout) new_dialog.findViewById(R.id.layout_submit);
ImageView ivClose = (ImageView) new_dialog.findViewById(R.id.ivClose);
ivClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new_dialog.dismiss();
}
});
layout_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String estring = "";
ForegroundColorSpan fgcspan = new ForegroundColorSpan(Color.RED);
SpannableStringBuilder ssbuilder;
if (edtEmailAddress.getText().toString().trim()
.equals("")) {
ssbuilder = new SpannableStringBuilder(ErrorMessages.Email);
ssbuilder.setSpan(fgcspan, 0, estring.length(), 0);
edtEmailAddress.requestFocus();
edtEmailAddress.setError(ssbuilder);
} else if (!Patterns.EMAIL_ADDRESS.matcher(
edtEmailAddress.getText().toString().trim())
.matches()) {
ssbuilder = new SpannableStringBuilder(ErrorMessages.ValidEmail);
ssbuilder.setSpan(fgcspan, 0, estring.length(), 0);
edtEmailAddress.requestFocus();
edtEmailAddress.setError(ssbuilder);
} else {
forgotPassword(edtEmailAddress.getText().toString().trim());
}
}
});
return new_dialog;
}
/**
* Call WebAPI for request forgot password
*
* @param Email Clients email address entered in EditText
*/
public void forgotPassword(String Email) {
((LoginActivity) getActivity()).showProgressDailog("Please Wait...");
WebserviceApi webserviceApi = ServiceGenerator.createService(WebserviceApi.class);
webserviceApi.forgotPassword(Email, new Callback<ForgotPasswordResponce>() {
@Override
public void success(ForgotPasswordResponce forgotPasswordResponce, Response response) {
((LoginActivity) getActivity()).hideProgressDialog();
dialogInterface.dialogClick(forgotPasswordResponce.Message);
new_dialog.dismiss();
}
@Override
public void failure(RetrofitError error) {
((LoginActivity) getActivity()).hideProgressDialog();
dialogInterface.dialogClick(error.getMessage());
//dialogInterface.dialogClick(ErrorMessages.ServerError);
new_dialog.dismiss();
}
});
}
}
|
[
"[email protected]"
] | |
c9429972d333a641a9ebbda1028f58f638f2ac0b
|
64b47f83d313af33804b946d0613760b8ff23840
|
/tags/dev-3-1-4/weka/gui/explorer/AssociationsPanel.java
|
a2ae9eef2cb55f2418f7959c4aebfbb04783027e
|
[] |
no_license
|
hackerastra/weka
|
afde1c7ab0fbf374e6d6ac6d07220bfaffb9488c
|
c8366c454e9718d0e1634ddf4a72319dac3ce559
|
refs/heads/master
| 2021-05-28T08:25:33.811203 | 2015-01-22T03:12:18 | 2015-01-22T03:12:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,731 |
java
|
/*
* AssociationsPanel.java
* Copyright (C) 1999 Eibe Frank
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package weka.gui.explorer;
import weka.core.Instances;
import weka.core.OptionHandler;
import weka.core.Attribute;
import weka.core.Utils;
import weka.associations.Associator;
import weka.filters.Filter;
import weka.gui.Logger;
import weka.gui.SysErrLog;
import weka.gui.GenericObjectEditor;
import weka.gui.PropertyPanel;
import weka.gui.ResultHistoryPanel;
import weka.gui.SetInstancesPanel;
import java.util.Random;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeSupport;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JButton;
import javax.swing.BorderFactory;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.JFrame;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import javax.swing.JViewport;
import java.awt.Point;
/**
* This panel allows the user to select, configure, and run a scheme
* that learns associations.
*
* @author Eibe Frank ([email protected])
* @version $Revision: 1.5 $
*/
public class AssociationsPanel extends JPanel {
/** Lets the user configure the associator */
protected GenericObjectEditor m_AssociatorEditor =
new GenericObjectEditor();
/** The panel showing the current associator selection */
protected PropertyPanel m_CEPanel = new PropertyPanel(m_AssociatorEditor);
/** The output area for associations */
protected JTextArea m_OutText = new JTextArea(20, 40);
/** The destination for log/status messages */
protected Logger m_Log = new SysErrLog();
/** A panel controlling results viewing */
protected ResultHistoryPanel m_History = new ResultHistoryPanel(m_OutText);
/** Click to start running the associator */
protected JButton m_StartBut = new JButton("Start");
/** Click to stop a running associator */
protected JButton m_StopBut = new JButton("Stop");
/** The main set of instances we're playing with */
protected Instances m_Instances;
/** The user-supplied test set (if any) */
protected Instances m_TestInstances;
/** A thread that associator runs in */
protected Thread m_RunThread;
/* Register the property editors we need */
static {
java.beans.PropertyEditorManager
.registerEditor(weka.core.SelectedTag.class,
weka.gui.SelectedTagEditor.class);
java.beans.PropertyEditorManager
.registerEditor(weka.filters.Filter.class,
weka.gui.GenericObjectEditor.class);
java.beans.PropertyEditorManager
.registerEditor(weka.associations.Associator.class,
weka.gui.GenericObjectEditor.class);
}
/**
* Creates the associator panel
*/
public AssociationsPanel() {
// Connect / configure the components
m_OutText.setEditable(false);
m_OutText.setFont(new Font("Dialoginput", Font.PLAIN, 10));
m_OutText.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
m_OutText.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK)
!= InputEvent.BUTTON1_MASK) {
m_OutText.selectAll();
}
}
});
m_History.setBorder(BorderFactory.createTitledBorder("Result list"));
m_AssociatorEditor.setClassType(Associator.class);
m_AssociatorEditor.setValue(new weka.associations.Apriori());
m_AssociatorEditor.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
repaint();
}
});
m_StartBut.setToolTipText("Starts the associator");
m_StopBut.setToolTipText("Stops the associator");
m_StartBut.setEnabled(false);
m_StopBut.setEnabled(false);
m_StartBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
startAssociator();
}
});
m_StopBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
startAssociator();
}
});
// Layout the GUI
JPanel p1 = new JPanel();
p1.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Associator"),
BorderFactory.createEmptyBorder(0, 5, 5, 5)
));
p1.setLayout(new BorderLayout());
p1.add(m_CEPanel, BorderLayout.NORTH);
JPanel ssButs = new JPanel();
ssButs.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
ssButs.setLayout(new GridLayout(1, 2, 5, 5));
ssButs.add(m_StartBut);
ssButs.add(m_StopBut);
JPanel p3 = new JPanel();
p3.setBorder(BorderFactory.createTitledBorder("Associator output"));
p3.setLayout(new BorderLayout());
final JScrollPane js = new JScrollPane(m_OutText);
p3.add(js, BorderLayout.CENTER);
js.getViewport().addChangeListener(new ChangeListener() {
private int lastHeight;
public void stateChanged(ChangeEvent e) {
JViewport vp = (JViewport)e.getSource();
int h = vp.getViewSize().height;
if (h != lastHeight) { // i.e. an addition not just a user scrolling
lastHeight = h;
int x = h - vp.getExtentSize().height;
vp.setViewPosition(new Point(0, x));
}
}
});
GridBagLayout gbL = new GridBagLayout();
GridBagConstraints gbC = new GridBagConstraints();
JPanel mondo = new JPanel();
gbL = new GridBagLayout();
mondo.setLayout(gbL);
gbC = new GridBagConstraints();
gbC.anchor = GridBagConstraints.NORTH;
gbC.fill = GridBagConstraints.HORIZONTAL;
gbC.gridy = 1; gbC.gridx = 0;
gbL.setConstraints(ssButs, gbC);
mondo.add(ssButs);
gbC = new GridBagConstraints();
gbC.fill = GridBagConstraints.BOTH;
gbC.gridy = 2; gbC.gridx = 0; gbC.weightx = 0;
gbL.setConstraints(m_History, gbC);
mondo.add(m_History);
gbC = new GridBagConstraints();
gbC.fill = GridBagConstraints.BOTH;
gbC.gridy = 0; gbC.gridx = 1;
gbC.gridheight = 3;
gbC.weightx = 100; gbC.weighty = 100;
gbL.setConstraints(p3, gbC);
mondo.add(p3);
setLayout(new BorderLayout());
add(p1, BorderLayout.NORTH);
add(mondo, BorderLayout.CENTER);
}
/**
* Sets the Logger to receive informational messages
*
* @param newLog the Logger that will now get info messages
*/
public void setLog(Logger newLog) {
m_Log = newLog;
}
/**
* Tells the panel to use a new set of instances.
*
* @param inst a set of Instances
*/
public void setInstances(Instances inst) {
m_Instances = inst;
String [] attribNames = new String [m_Instances.numAttributes()];
for (int i = 0; i < attribNames.length; i++) {
String type = "";
switch (m_Instances.attribute(i).type()) {
case Attribute.NOMINAL:
type = "(Nom) ";
break;
case Attribute.NUMERIC:
type = "(Num) ";
break;
case Attribute.STRING:
type = "(Str) ";
break;
default:
type = "(???) ";
}
attribNames[i] = type + m_Instances.attribute(i).name();
}
m_StartBut.setEnabled(m_RunThread == null);
m_StopBut.setEnabled(m_RunThread != null);
}
/**
* Starts running the currently configured associator with the current
* settings. This is run in a separate thread, and will only start if
* there is no associator already running. The associator output is sent
* to the results history panel.
*/
protected void startAssociator() {
if (m_RunThread == null) {
m_StartBut.setEnabled(false);
m_StopBut.setEnabled(true);
m_RunThread = new Thread() {
public void run() {
// Copy the current state of things
m_Log.statusMessage("Setting up...");
Instances inst = new Instances(m_Instances);
Associator associator = (Associator) m_AssociatorEditor.getValue();
StringBuffer outBuff = new StringBuffer();
String name = (new SimpleDateFormat("HH:mm:ss - "))
.format(new Date());
String cname = associator.getClass().getName();
if (cname.startsWith("weka.associations.")) {
name += cname.substring("weka.associations.".length());
} else {
name += cname;
}
try {
// Output some header information
m_Log.logMessage("Started " + cname);
outBuff.append("=== Run information ===\n\n");
outBuff.append("Scheme: " + cname);
if (associator instanceof OptionHandler) {
String [] o = ((OptionHandler) associator).getOptions();
outBuff.append(" " + Utils.joinOptions(o));
}
outBuff.append("\n");
outBuff.append("Relation: " + inst.relationName() + '\n');
outBuff.append("Instances: " + inst.numInstances() + '\n');
outBuff.append("Attributes: " + inst.numAttributes() + '\n');
if (inst.numAttributes() < 100) {
for (int i = 0; i < inst.numAttributes(); i++) {
outBuff.append(" " + inst.attribute(i).name()
+ '\n');
}
} else {
outBuff.append(" [list of attributes omitted]\n");
}
m_History.addResult(name, outBuff);
m_History.setSingle(name);
// Build the model and output it.
m_Log.statusMessage("Building model on training data...");
associator.buildAssociations(inst);
outBuff.append("=== Associator model (full training set) ===\n\n");
outBuff.append(associator.toString() + '\n');
m_History.updateResult(name);
m_Log.logMessage("Finished " + cname);
m_Log.statusMessage("OK");
} catch (Exception ex) {
m_Log.logMessage(ex.getMessage());
m_Log.statusMessage("See error log");
} finally {
if (isInterrupted()) {
m_Log.logMessage("Interrupted " + cname);
m_Log.statusMessage("See error log");
}
m_RunThread = null;
m_StartBut.setEnabled(true);
m_StopBut.setEnabled(false);
}
}
};
m_RunThread.setPriority(Thread.MIN_PRIORITY);
m_RunThread.start();
}
}
/**
* Stops the currently running Associator (if any).
*/
protected void stopAssociator() {
if (m_RunThread != null) {
m_RunThread.interrupt();
// This is deprecated (and theoretically the interrupt should do).
m_RunThread.stop();
}
}
/**
* Tests out the Associator panel from the command line.
*
* @param args may optionally contain the name of a dataset to load.
*/
public static void main(String [] args) {
try {
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Knowledge Explorer: Associator");
jf.getContentPane().setLayout(new BorderLayout());
final AssociationsPanel sp = new AssociationsPanel();
jf.getContentPane().add(sp, BorderLayout.CENTER);
weka.gui.LogPanel lp = new weka.gui.LogPanel();
sp.setLog(lp);
jf.getContentPane().add(lp, BorderLayout.SOUTH);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
System.exit(0);
}
});
jf.pack();
jf.setVisible(true);
if (args.length == 1) {
System.err.println("Loading instances from " + args[0]);
java.io.Reader r = new java.io.BufferedReader(
new java.io.FileReader(args[0]));
Instances i = new Instances(r);
sp.setInstances(i);
}
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(ex.getMessage());
}
}
}
|
[
"(no author)@e0a1b77d-ad91-4216-81b1-defd5f83fa92"
] |
(no author)@e0a1b77d-ad91-4216-81b1-defd5f83fa92
|
6655b2595d349729d943acbd5cd4f17526da6fe0
|
211e970edb66a52b93cb89628db6a4c4295fa968
|
/Java/Java - Me/lez08/src/lez08/GiocoDadi.java
|
a43ab56d5e64e6c921b115ee1131fc30b2ff1b10
|
[] |
no_license
|
AlessandraArdissone/TSS2019
|
bdb5b35942672b131295bbb791158a142b86f3e1
|
a151e7d6e8f1929ddb254c08144c27e18f9e3af7
|
refs/heads/master
| 2020-04-28T09:21:55.146424 | 2019-07-04T12:28:37 | 2019-07-04T12:28:37 | 166,390,308 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,106 |
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 lez08;
/**
*
* @author tss
*/
public class GiocoDadi {
static int soldi;
private static int dB;
private static int dG;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
soldi = 10;
do {
gioca();
stampaGiocata();
} while (soldi > 0);
}
private static void gioca() {
dB = lanciaDado();
dG = lanciaDado();
if (dB < dG) {
soldi++;
} else {
soldi--;
}
}
private static int lanciaDado() {
return (int) (6 * Math.random()) + 1;
}
private static void stampaGiocata() {
System.out.println("---------------GIOCATA---------------");
System.out.println("Punti BANCO: " + dB);
System.out.println("Punti GIOCATORE: " + dG);
System.out.println("Soldi: " + soldi);
}
}
|
[
"[email protected]"
] | |
ba80f3703af0305d9e72f2a435ebc363aa7a8684
|
22b1fe6a0af8ab3c662551185967bf2a6034a5d2
|
/experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation2/Class_751.java
|
717aa06851bb8082c98e722cf7ca0fdf86c03500
|
[
"Apache-2.0"
] |
permissive
|
lesaint/experimenting-annotation-processing
|
b64ed2182570007cb65e9b62bb2b1b3f69d168d6
|
1e9692ceb0d3d2cda709e06ccc13290262f51b39
|
refs/heads/master
| 2021-01-23T11:20:19.836331 | 2014-11-13T10:37:14 | 2014-11-13T10:37:14 | 26,336,984 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 145 |
java
|
package fr.javatronic.blog.massive.annotation2;
import fr.javatronic.blog.processor.Annotation_002;
@Annotation_002
public class Class_751 {
}
|
[
"[email protected]"
] | |
83a4a85b8a6f94e71bdee5672a2a44c5dd2557db
|
522c2c230d14569b5f0147e56f97836397f6cd98
|
/Selenium/src/main/java/testCases/ExcelPOI.java
|
81e5fe60dc358332ded3d2750861793db658f125
|
[] |
no_license
|
YogeshJayaseelan/MyGit
|
2285520cd161c08552675d0058658e4eb7981660
|
4953685ed6a4cfb9cb2ca3d8343efb6c64e180bb
|
refs/heads/master
| 2021-11-26T06:34:28.509273 | 2021-11-19T07:03:43 | 2021-11-19T07:03:43 | 116,345,385 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,138 |
java
|
package testCases;
import java.io.File;
import java.io.IOException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelPOI {
public static void main(String[] args) throws InvalidFormatException, IOException {
File excel = new File("E:\\Workspace\\Selenium\\Data\\CreateLead.xlsx");
XSSFWorkbook workbook = new XSSFWorkbook(excel);
XSSFSheet sheet=workbook.getSheetAt(0);
XSSFRow row = sheet.getRow(1);
XSSFCell cell=row.getCell(0);
// System.out.println(cell);
int rowCount = sheet.getLastRowNum();
int columnCount =sheet.getRow(0).getLastCellNum();
for(int i=1; i<=rowCount;i++){
XSSFRow row1= sheet.getRow(i);
for(int j=0;j<columnCount;j++){
// int cellcount = sheet.getRow(0).getLastCellNum();
XSSFCell cell1=row1.getCell(j) ;
String cellvalue=cell1.getStringCellValue();
System.out.println(cellvalue);
}
}
} }
|
[
"Yogesh@DESKTOP-SJRV1GE"
] |
Yogesh@DESKTOP-SJRV1GE
|
5feec5b07cafcd88a6b56e56a12ba895618d64b3
|
815d989305f812e9f650fda567a8ab13a62d00f9
|
/merchant/src/code/com/qx/eakay/service/stake/StakeChargeService.java
|
b1367a0d5b3fcea892a3cf64f700c95cd93508db
|
[] |
no_license
|
jixf8507/test
|
e17924c455804b71c9331144cc464d1ba2320a4a
|
80fc1449fa8d616298a850a3e57d53777345cbc2
|
refs/heads/master
| 2021-01-10T09:10:32.058728 | 2015-12-26T06:21:54 | 2015-12-26T06:21:54 | 48,571,262 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,215 |
java
|
package com.qx.eakay.service.stake;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qx.common.highcharts.ChartsBO;
import com.qx.common.highcharts.SerieBO;
import com.qx.common.highcharts.SerieBO.SerieType;
import com.qx.eakay.dao.stake.StakeChargeDao;
import com.qx.eakay.service.BaseService;
import com.qx.eakay.util.DateUtil;
/**
* 充电统计
*
*/
@Service
public class StakeChargeService extends BaseService {
@Autowired
private StakeChargeDao stakeChargeDao;
/**
* 加载充电时间段统计图
*
* @param jsonObject
* @return
*/
public ChartsBO<Integer> getChargeTimeSeries(JSONObject jsonObject) {
ChartsBO<Integer> chartsBO = new ChartsBO<Integer>();
List<Map<String, Object>> list = stakeChargeDao.getChargeTimeSeries(jsonObject);
SerieBO<Integer> serieBO = new SerieBO<>("充电车辆");
Integer[] dataArray = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
for (Map<String, Object> dataMap : list) {
Integer startHour = Integer.parseInt(dataMap.get("h")+"");
Date startCharge = DateUtil.formatToDateM(dataMap.get("startCharge")+"");
Date lastCharge = DateUtil.formatToDateM(dataMap.get("lastCharge")+"");
Integer hours = DateUtil.computerDivideHour(startCharge,lastCharge);
if(hours>23){
for(int i = 0 ; i <= 23 ; i++){
dataArray[i]++;
}
}else{
for(int i = 0 ; i <= hours ; i++){
dataArray[startHour]++;
startHour++;
if(startHour>23){
startHour = 0;
}
}
}
}
for(int i = 0 ; i<dataArray.length; i++){
serieBO.getData().add(dataArray[i]);//数量
chartsBO.getxAxis().getCategories().add(i+"");//时间
}
chartsBO.getSeries().add(serieBO);
return chartsBO;
}
/**
* 加载充电方式统计图
*
* @param jsonObject
* @return
*/
public ChartsBO<Integer> getChargeWaySeries(JSONObject jsonObject) {
ChartsBO<Integer> chartsBO = new ChartsBO<Integer>();
List<Map<String, Object>> list = stakeChargeDao.getChargeWaySeries(jsonObject);
SerieBO<Integer> bookSerieBO = new SerieBO<>("预约充电");
SerieBO<Integer> cardSerieBO = new SerieBO<>("刷卡充电");
bookSerieBO.setType(SerieType.spline);
cardSerieBO.setType(SerieType.spline);
Map<String, Integer> bookMap = new HashMap<String, Integer>();
Map<String, Integer> cardMap = new HashMap<String, Integer>();
for (Map<String, Object> map : list) {
String month = map.get("month") + "";
String type = map.get("kind") + "";
Object obj = map.get("cs");
int cs = Integer.parseInt(obj + "");
if ("预约充电".equals(type)) {
bookMap.put(month, cs);
bookSerieBO.getData().add(cs);
} else {
cardMap.put(month, cs);
cardSerieBO.getData().add(cs);
}
chartsBO.getxAxis().getCategories().add(month);
}
chartsBO.getSeries().add(bookSerieBO);
chartsBO.getSeries().add(cardSerieBO);
return chartsBO;
}
}
|
[
"[email protected]"
] | |
d52283f042f87046fcb52d0dcc5fd5bb853ee80a
|
80afdb84c8bde3303f4c997917f77a2a576e0b94
|
/src/dao/orderlistDaoImpl.java
|
12e5caa15761968aaac1e2371e5d76bb29e56500
|
[] |
no_license
|
hdabing/JBIT_UNIT4_CRM
|
140346a7fdf9983e651466a31e3a472ca8e89742
|
332f6ffd1017989189dd9c26f6c42adabf9ad1d1
|
refs/heads/master
| 2020-07-29T12:41:59.666506 | 2014-11-22T03:00:15 | 2014-11-22T03:00:15 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,418 |
java
|
package dao;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import entity.Orderlist;
public class orderlistDaoImpl implements orderlistDao {
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public void add(Orderlist orderlist) {
Session session=sessionFactory.openSession();
Transaction tr=session.beginTransaction();
session.save(orderlist);
tr.commit();
}
@Override
public void del(int id) {
Session session=sessionFactory.openSession();
Transaction tr=session.beginTransaction();
session.delete(this.getOrderlist(id));
tr.commit();
}
@Override
public void edit(Orderlist orderlist) {
Session session=sessionFactory.openSession();
Transaction tr=session.beginTransaction();
session.update(orderlist);
tr.commit();
}
@Override
public Orderlist getOrderlist(int id) {
Session session=sessionFactory.openSession();
return (Orderlist) session.get(Orderlist.class, id);
}
@SuppressWarnings("unchecked")
@Override
public List<Orderlist> getOrderlistlist(String hql) {
Session session=sessionFactory.openSession();
Query query=session.createQuery(hql);
return (List<Orderlist>) query.list();
}
}
|
[
"[email protected]"
] | |
95686c61c5ad69344fe72ab6668c6a5b7ccaab8b
|
771f40c83ade20b0ff88c1a078fbc3c2966f7b36
|
/src/main/java/com/modulo/accidentes/service/GenericServiceImpl.java
|
79c8196900fe4a20d6d6430d3fbb5331551ea755
|
[] |
no_license
|
rudolfPaco/backend-final
|
5112bf98794e454402b972be2c0e97babeae5c18
|
eeb68be2cedc41bc0cc75f94046cf8dc9322ba60
|
refs/heads/master
| 2020-04-29T10:21:57.483908 | 2019-03-25T08:01:31 | 2019-03-25T08:01:31 | 176,059,863 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,141 |
java
|
package com.modulo.accidentes.service;
import com.modulo.accidentes.dto.DtoBase;
import com.modulo.accidentes.exception.NotFoundException;
import com.modulo.accidentes.model.ModelBase;
import com.modulo.accidentes.repositories.GenericRepository;
import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@Service
@SuppressWarnings("rawtypes")
public abstract class GenericServiceImpl<T extends ModelBase> implements GenericService<T> {
@Autowired
protected ModelMapper modelMapper;
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public List<T> findAll() {
return getRepository().findAll();
}
@Override
public T findById(Long id) {
final Optional<T> optional = getRepository().findById(id);
if (!optional.isPresent()) {
String typeName = (((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0])
.getTypeName();
typeName = typeName.substring(typeName.lastIndexOf('.') + 1);
throw new NotFoundException(String.format("%s Not found with id %s", typeName, id));
} else {
return optional.get();
}
}
@Override
public T save(T model) {
validateSave(model);
T t = getRepository().save(model);
return findById(t.getId());
}
@Override
public T update(T model) {
validateSave(model);
T t = getRepository().saveAndFlush(model);
return findById(t.getId());
}
@Override
public T patch(DtoBase dto, T model) {
processDtoToDomainPatch(dto, model);
return save(model);
}
protected void processDtoToDomainPatch(DtoBase dto, T updatedDomain) {
}
protected void validateSave(T model) {
}
@Override
public List<T> saveAll(Iterable<T> models) {
return StreamSupport.stream(models.spliterator(), false).map(this::save).collect(Collectors.toList());
}
@Override
public void deleteById(Long id) {
getRepository().deleteById(id);
}
@Override
public Byte[] getBytes(MultipartFile file) {
try {
Byte[] bytes = new Byte[file.getBytes().length];
int i = 0;
for (Byte aByte : file.getBytes()) {
bytes[i++] = aByte;
}
return bytes;
} catch (IOException e) {
logger.error("Error reading file", e);
}
return new Byte[0];
}
protected <E extends ModelBase> void appendModel(E model, Set<E> modelSet) {
if (model != null) {
modelSet.add(model);
}
}
protected abstract GenericRepository<T> getRepository();
}
|
[
"[email protected]"
] | |
0489385dd7d5c0a9d22b40e4768a56e581d72c5e
|
f0f87ffc18cb9732b88d8c3a0302792281948205
|
/piccws/src/main/java/org/xmlsoap/schemas/soap/encoding/StringDocument.java
|
4c361000e2949b2566897d8c5bef163257f697d2
|
[] |
no_license
|
songhaichao/piccws
|
519d52fe1c1f7efd3d3af84e2feb4411b74c217e
|
f8eca931212e32a29bc3fca279c047b663d7168a
|
refs/heads/master
| 2021-01-01T17:25:38.724518 | 2017-07-23T04:33:05 | 2017-07-23T04:33:05 | 98,069,958 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,721 |
java
|
/*
* An XML document type.
* Localname: string
* Namespace: http://schemas.xmlsoap.org/soap/encoding/
* Java type: org.xmlsoap.schemas.soap.encoding.StringDocument
*
* Automatically generated - do not modify.
*/
package org.xmlsoap.schemas.soap.encoding;
/**
* A document containing one string(@http://schemas.xmlsoap.org/soap/encoding/) element.
*
* This is a complex type.
*/
public interface StringDocument extends org.apache.xmlbeans.XmlObject
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(StringDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sDD9AF6D5010A21B488C8123298D8AC9A").resolveHandle("string92a7doctype");
/**
* Gets the "string" element
*/
org.xmlsoap.schemas.soap.encoding.String getString();
/**
* Sets the "string" element
*/
void setString(org.xmlsoap.schemas.soap.encoding.String string);
/**
* Appends and returns a new empty "string" element
*/
org.xmlsoap.schemas.soap.encoding.String addNewString();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.xmlsoap.schemas.soap.encoding.StringDocument newInstance() {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.StringDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.StringDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
|
[
"[email protected]"
] | |
2236dd7d1ebf3d22b471520fcd83cc422d8db320
|
2b72429387c2dce805343b6907500d14f0dd6454
|
/06_navigationDrawer/app/src/test/java/com/example/arribasd/a06_navigationdrawer/ExampleUnitTest.java
|
bfa1ff4b4039fced37170bd61005165eb4fc3888
|
[] |
no_license
|
DavidUps/android
|
b6c01623d383e6f2e11d05b4dbeb781a9c1de804
|
f683cfabb567cf98753787fbfb46f86761d03f8a
|
refs/heads/master
| 2021-09-12T14:11:11.485246 | 2018-04-17T12:33:44 | 2018-04-17T12:33:44 | 114,994,099 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 419 |
java
|
package com.example.arribasd.a06_navigationdrawer;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
7620d29ab45fb6304b97335de8e9cf6248091daa
|
097df92ce1bfc8a354680725c7d10f0d109b5b7d
|
/com/amazon/ws/emr/hadoop/fs/shaded/com/amazonaws/services/dynamodbv2/endpointdiscovery/AmazonDynamoDBEndpointCacheLoader.java
|
4f8b8fad4413de945da21f60abca40556bd00e79
|
[] |
no_license
|
cozos/emrfs-hadoop
|
7a1a1221ffc3aa8c25b1067cf07d3b46e39ab47f
|
ba5dfa631029cb5baac2f2972d2fdaca18dac422
|
refs/heads/master
| 2022-10-14T15:03:51.500050 | 2022-10-06T05:38:49 | 2022-10-06T05:38:49 | 233,979,996 | 2 | 2 | null | 2022-10-06T05:41:46 | 2020-01-15T02:24:16 |
Java
|
UTF-8
|
Java
| false | false | 1,705 |
java
|
package com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.endpointdiscovery;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.cache.CacheLoader;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model.DescribeEndpointsRequest;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model.DescribeEndpointsResult;
import com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.model.Endpoint;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AmazonDynamoDBEndpointCacheLoader
implements CacheLoader<String, Map<String, String>>
{
private final AmazonDynamoDB client;
public AmazonDynamoDBEndpointCacheLoader(AmazonDynamoDB client)
{
this.client = client;
}
public Map<String, String> load(String key)
{
DescribeEndpointsResult response = client.describeEndpoints(new DescribeEndpointsRequest());
List<Endpoint> endpoints = response.getEndpoints();
if ((endpoints == null) || (endpoints.size() == 0)) {
return null;
}
Endpoint endpoint = (Endpoint)endpoints.get(0);
Map<String, String> endpointDetail = new HashMap();
endpointDetail.put("CachePeriod", String.valueOf(endpoint.getCachePeriodInMinutes()));
endpointDetail.put("Endpoint", endpoint.getAddress());
return endpointDetail;
}
}
/* Location:
* Qualified Name: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.dynamodbv2.endpointdiscovery.AmazonDynamoDBEndpointCacheLoader
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
[
"[email protected]"
] | |
72cd8ac5a14d4588e36f52065a36b0b8bbfb6e58
|
f2488e535c7ae345e9f49e33433a6ebf567a8ba4
|
/Code/17/168/Project/2048Game/app/src/main/java/com/mingrisoft/a2048game/MainGame.java
|
4a632ea09c70a240ff416b80be5c77792fc5dae6
|
[] |
no_license
|
stytooldex/Test
|
d4f0241a0a35100219ba8c0b21b76200f16914b8
|
993080d7ec0032230b26563f01a1554ff7f8fe3d
|
refs/heads/master
| 2022-03-15T01:01:08.465767 | 2019-12-03T05:36:58 | 2019-12-03T05:36:58 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 11,173 |
java
|
package com.mingrisoft.a2048game;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MainGame {
public static final int SPAWN_ANIMATION = -1;
public static final int MOVE_ANIMATION = 0;
public static final int MERGE_ANIMATION = 1;
public static final int FADE_GLOBAL_ANIMATION = 0;
public static final long MOVE_ANIMATION_TIME = MainView.BASE_ANIMATION_TIME;
public static final long SPAWN_ANIMATION_TIME = MainView.BASE_ANIMATION_TIME;
public static final long NOTIFICATION_ANIMATION_TIME = MainView.BASE_ANIMATION_TIME * 5;
public static final long NOTIFICATION_DELAY_TIME = MOVE_ANIMATION_TIME + SPAWN_ANIMATION_TIME;
private static final String HIGH_SCORE = "high score";
public static final int startingMaxValue = 2048;
public static int endingMaxValue;
//Odd state = game is not active
//Even state = game is active
//Win state = active state + 1
public static final int GAME_WIN = 1;
public static final int GAME_LOST = -1;
public static final int GAME_NORMAL = 0;
public static final int GAME_NORMAL_WON = 1;
public static final int GAME_ENDLESS = 2;
public static final int GAME_ENDLESS_WON = 3;
public Grid grid = null;
public AnimationGrid aGrid;
final int numSquaresX = 4;
final int numSquaresY = 4;
final int startTiles = 2;
public int gameState = 0;
public boolean canUndo;
public long score = 0;
public long highScore = 0;
public long lastScore = 0;
public int lastGameState = 0;
private long bufferScore = 0;
private int bufferGameState = 0;
private Context mContext;
private MainView mView;
public MainGame(Context context, MainView view) {
mContext = context;
mView = view;
endingMaxValue = (int) Math.pow(2, view.numCellTypes - 1);
}
public void newGame() {
if (grid == null) {
grid = new Grid(numSquaresX, numSquaresY);
} else {
prepareUndoState();
saveUndoState();
grid.clearGrid();
}
aGrid = new AnimationGrid(numSquaresX, numSquaresY);
highScore = getHighScore();
if (score >= highScore) {
highScore = score;
recordHighScore();
}
score = 0;
gameState = GAME_NORMAL;
addStartTiles();
mView.refreshLastTime = true;
mView.resyncTime();
mView.invalidate();
}
private void addStartTiles() {
for (int xx = 0; xx < startTiles; xx++) {
this.addRandomTile();
}
}
private void addRandomTile() {
if (grid.isCellsAvailable()) {
int value = Math.random() < 0.9 ? 2 : 4;
Tile tile = new Tile(grid.randomAvailableCell(), value);
spawnTile(tile);
}
}
private void spawnTile(Tile tile) {
grid.insertTile(tile);
aGrid.startAnimation(tile.getX(), tile.getY(), SPAWN_ANIMATION,
SPAWN_ANIMATION_TIME, MOVE_ANIMATION_TIME, null); //Direction: -1 = EXPANDING
}
private void recordHighScore() {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = settings.edit();
editor.putLong(HIGH_SCORE, highScore);
editor.commit();
}
private long getHighScore() {
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mContext);
return settings.getLong(HIGH_SCORE, -1);
}
private void prepareTiles() {
for (Tile[] array : grid.field) {
for (Tile tile : array) {
if (grid.isCellOccupied(tile)) {
tile.setMergedFrom(null);
}
}
}
}
private void moveTile(Tile tile, Cell cell) {
grid.field[tile.getX()][tile.getY()] = null;
grid.field[cell.getX()][cell.getY()] = tile;
tile.updatePosition(cell);
}
private void saveUndoState() {
grid.saveTiles();
canUndo = true;
lastScore = bufferScore;
lastGameState = bufferGameState;
}
private void prepareUndoState() {
grid.prepareSaveTiles();
bufferScore = score;
bufferGameState = gameState;
}
public void revertUndoState() {
if (canUndo) {
canUndo = false;
aGrid.cancelAnimations();
grid.revertTiles();
score = lastScore;
gameState = lastGameState;
mView.refreshLastTime = true;
mView.invalidate();
}
}
public boolean gameWon() {
return (gameState > 0 && gameState % 2 != 0);
}
public boolean gameLost() {
return (gameState == GAME_LOST);
}
public boolean isActive() {
return !(gameWon() || gameLost());
}
public void move(int direction) {
aGrid.cancelAnimations();
// 0: up, 1: right, 2: down, 3: left
if (!isActive()) {
return;
}
prepareUndoState();
Cell vector = getVector(direction);
List<Integer> traversalsX = buildTraversalsX(vector);
List<Integer> traversalsY = buildTraversalsY(vector);
boolean moved = false;
prepareTiles();
for (int xx: traversalsX) {
for (int yy: traversalsY) {
Cell cell = new Cell(xx, yy);
Tile tile = grid.getCellContent(cell);
if (tile != null) {
Cell[] positions = findFarthestPosition(cell, vector);
Tile next = grid.getCellContent(positions[1]);
if (next != null && next.getValue() == tile.getValue() && next.getMergedFrom() == null) {
Tile merged = new Tile(positions[1], tile.getValue() * 2);
Tile[] temp = {tile, next};
merged.setMergedFrom(temp);
grid.insertTile(merged);
grid.removeTile(tile);
// Converge the two tiles' positions
tile.updatePosition(positions[1]);
int[] extras = {xx, yy};
aGrid.startAnimation(merged.getX(), merged.getY(), MOVE_ANIMATION,
MOVE_ANIMATION_TIME, 0, extras); //Direction: 0 = MOVING MERGED
aGrid.startAnimation(merged.getX(), merged.getY(), MERGE_ANIMATION,
SPAWN_ANIMATION_TIME, MOVE_ANIMATION_TIME, null);
// Update the score
score = score + merged.getValue();
highScore = Math.max(score, highScore);
// The mighty 2048 tile
if (merged.getValue() >= winValue() && !gameWon()) {
gameState = gameState + GAME_WIN; // Set win state
endGame();
}
} else {
moveTile(tile, positions[0]);
int[] extras = {xx, yy, 0};
aGrid.startAnimation(positions[0].getX(), positions[0].getY(), MOVE_ANIMATION, MOVE_ANIMATION_TIME, 0, extras); //Direction: 1 = MOVING NO MERGE
}
if (!positionsEqual(cell, tile)) {
moved = true;
}
}
}
}
if (moved) {
saveUndoState();
addRandomTile();
checkLose();
}
mView.resyncTime();
mView.invalidate();
}
private void checkLose() {
if (!movesAvailable() && !gameWon()) {
gameState = GAME_LOST;
endGame();
}
}
private void endGame() {
aGrid.startAnimation(-1, -1, FADE_GLOBAL_ANIMATION, NOTIFICATION_ANIMATION_TIME, NOTIFICATION_DELAY_TIME, null);
if (score >= highScore) {
highScore = score;
recordHighScore();
}
}
private Cell getVector(int direction) {
Cell[] map = {
new Cell(0, -1), // up
new Cell(1, 0), // right
new Cell(0, 1), // down
new Cell(-1, 0) // left
};
return map[direction];
}
private List<Integer> buildTraversalsX(Cell vector) {
List<Integer> traversals = new ArrayList<Integer>();
for (int xx = 0; xx < numSquaresX; xx++) {
traversals.add(xx);
}
if (vector.getX() == 1) {
Collections.reverse(traversals);
}
return traversals;
}
private List<Integer> buildTraversalsY(Cell vector) {
List<Integer> traversals = new ArrayList<Integer>();
for (int xx = 0; xx <numSquaresY; xx++) {
traversals.add(xx);
}
if (vector.getY() == 1) {
Collections.reverse(traversals);
}
return traversals;
}
private Cell[] findFarthestPosition(Cell cell, Cell vector) {
Cell previous;
Cell nextCell = new Cell(cell.getX(), cell.getY());
do {
previous = nextCell;
nextCell = new Cell(previous.getX() + vector.getX(),
previous.getY() + vector.getY());
} while (grid.isCellWithinBounds(nextCell) && grid.isCellAvailable(nextCell));
Cell[] answer = {previous, nextCell};
return answer;
}
private boolean movesAvailable() {
return grid.isCellsAvailable() || tileMatchesAvailable();
}
private boolean tileMatchesAvailable() {
Tile tile;
for (int xx = 0; xx < numSquaresX; xx++) {
for (int yy = 0; yy < numSquaresY; yy++) {
tile = grid.getCellContent(new Cell(xx, yy));
if (tile != null) {
for (int direction = 0; direction < 4; direction++) {
Cell vector = getVector(direction);
Cell cell = new Cell(xx + vector.getX(), yy + vector.getY());
Tile other = grid.getCellContent(cell);
if (other != null && other.getValue() == tile.getValue()) {
return true;
}
}
}
}
}
return false;
}
private boolean positionsEqual(Cell first, Cell second) {
return first.getX() == second.getX() && first.getY() == second.getY();
}
private int winValue() {
if (!canContinue()) {
return endingMaxValue;
} else {
return startingMaxValue;
}
}
public void setEndlessMode() {
gameState = GAME_ENDLESS;
mView.invalidate();
mView.refreshLastTime = true;
}
public boolean canContinue() {
return !(gameState == GAME_ENDLESS || gameState == GAME_ENDLESS_WON);
}
}
|
[
"[email protected]"
] | |
28be074aebbd3f2aab6024b3f5581b59c5e29d9d
|
e54e7c58f38bd7a0dd39626704a5c4c1a77a6d89
|
/src/main/java/com/jin/poetry/vo/NoticeVo.java
|
5ba9d79da8f644cd83ad28931ed9c4fce94f868d
|
[] |
no_license
|
Mlimit/poetry
|
4dbaf597ff8922db40ec2fb3ff616f4169061616
|
ffe0283eb03234419b55fe1e4a130f12f9eb029a
|
refs/heads/master
| 2022-12-26T21:14:05.580209 | 2020-10-13T11:16:54 | 2020-10-13T11:16:54 | 294,005,527 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 598 |
java
|
package com.jin.poetry.vo;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.jin.poetry.domain.Notice;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=false)
public class NoticeVo extends Notice{/**
*
*/
private static final long serialVersionUID = 1L;
private Integer page=1;
private Integer limit=10;
private Integer[] ids;//接收多个ID
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date startTime;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date endTime;
}
|
[
"[email protected]"
] | |
cb589dde448afb04e46ff8829bca3f5ef8157ed7
|
5a881d95dd592b6d51388c06961c4662cefc1248
|
/coupon/src/main/java/com/hsys/coupon/MockQueue.java
|
8f18fb3efbbc107e05ead7f598e2464d8edc6b26
|
[] |
no_license
|
xiaomaomao-xu/coupon
|
cf7af29e4e8c905ea4ec8be72fe311eb3deba9ae
|
cc67d378102d75bc9959ec97c0ddd6ce5d89cd8f
|
refs/heads/master
| 2022-06-30T03:59:23.115989 | 2019-11-13T03:27:33 | 2019-11-13T03:27:33 | 221,360,558 | 0 | 0 | null | 2022-06-17T02:38:22 | 2019-11-13T03:02:30 |
Java
|
UTF-8
|
Java
| false | false | 1,138 |
java
|
package com.hsys.coupon;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
/**
* 模拟消息队列 类
* Created by Fant.J.
*/
@Component
public class MockQueue {
//下单消息
private String placeOrder;
//订单完成消息
private String completeOrder;
public String getPlaceOrder() {
return placeOrder;
}
@Async
public void setPlaceOrder(String placeOrder) throws InterruptedException {
new Thread(()->{
System.out.println("接到下单请求"+placeOrder);
//模拟处理
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//给completeOrder赋值
this.completeOrder = placeOrder;
System.out.println("下单请求处理完毕"+placeOrder);
}).start();
}
public String getCompleteOrder() {
return completeOrder;
}
public void setCompleteOrder(String completeOrder) {
this.completeOrder = completeOrder;
}
}
|
[
"[email protected]"
] | |
ab29a9c2cbb569934e97426bb2e669b7d40e1463
|
d81498a7829c1c9dd49bfac6a04431b34ed9905b
|
/Week1/Union-Find/Union-Find/java/Union-Find/src/QuickFindTest.java
|
5a0c1052d8f90b659465ed44b81ef8e6202b8e6d
|
[] |
no_license
|
danielcu888/AlgorithmsI
|
e9bb84d5cd1fb80317d59ffe93580863a50e9911
|
39f08af62d99067dbfb4be29ce582884bf5bd5ad
|
refs/heads/master
| 2020-03-28T06:42:58.636638 | 2019-04-14T17:40:43 | 2019-04-14T17:40:43 | 145,209,820 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,315 |
java
|
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class QuickFindTest {
private QuickFind qf;
@Test
void testConstructor() {
qf = new QuickFind(5);
final String actual = qf.toString();
final String expected = "0 1 2 3 4 ";
assertEquals(actual.compareTo(expected), 0);
}
@Test
void testConnected() {
qf = new QuickFind(5);
assertTrue(qf.connected(0, 0));
assertFalse(qf.connected(0, 1));
assertFalse(qf.connected(0, 2));
assertFalse(qf.connected(0, 3));
assertFalse(qf.connected(0, 4));
assertTrue(qf.connected(1, 1));
assertFalse(qf.connected(1, 2));
assertFalse(qf.connected(1, 3));
assertFalse(qf.connected(1, 4));
assertTrue(qf.connected(2, 2));
assertFalse(qf.connected(2, 3));
assertFalse(qf.connected(2, 4));
assertTrue(qf.connected(3, 3));
assertFalse(qf.connected(3, 4));
assertTrue(qf.connected(4, 4));
}
@Test
public void testConstructorThrowsException() {
assertThrows( IllegalArgumentException.class
, ()->{ new QuickFind(-1); }
);
}
@Test
void testJoin() {
qf = new QuickFind(5);
qf.join(0, 3);
qf.join(1, 4);
qf.join(0, 2);
final String actual = qf.toString();
final String expected = "2 4 2 2 4 ";
assertEquals(actual.compareTo(expected), 0);
}
}
|
[
"[email protected]"
] | |
8a0bbafcf224a14a20b1fda186559b35a104abf9
|
fa51997f7d32d4ade39fd6f2d6cf7ee7a93121d8
|
/src/main/java/com/example/demobackend/DemobackendApplication.java
|
f51dd5f1160daadf7c35afb97410e8eee4a2a7ff
|
[] |
no_license
|
uxyz1/demobackend
|
89f7cf94e69eb17fb6cc9318210a24d9d477086d
|
5b3b1dbf5ee86288a9af25ebe377121d19526146
|
refs/heads/master
| 2022-07-16T08:22:40.825794 | 2020-05-13T01:59:49 | 2020-05-13T01:59:49 | 262,677,777 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 326 |
java
|
package com.example.demobackend;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemobackendApplication {
public static void main(String[] args) {
SpringApplication.run(DemobackendApplication.class, args);
}
}
|
[
"[email protected]"
] | |
0f52c4a11b4a176f4a421f80449af648a17c1a15
|
963a2d17f03a6c18a120687b03f9a624b78a7423
|
/crux-dev/src/main/java/org/cruxframework/crux/core/client/screen/RootViewContainer.java
|
9dee6a60a34413965612b2f03fe831349ac8e11f
|
[] |
no_license
|
MiskaRoming/crux
|
3f3026ec20d87d2808846dc10ea00c0d4479c496
|
03c02cc10866d6509112b7b5a5f577ff6e9aedf3
|
refs/heads/master
| 2021-01-24T15:33:31.007204 | 2015-06-02T18:08:42 | 2015-06-02T18:08:42 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,257 |
java
|
/*
* Copyright 2011 cruxframework.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.cruxframework.crux.core.client.screen;
import org.cruxframework.crux.core.client.screen.views.SingleViewContainer;
import org.cruxframework.crux.core.client.screen.views.View;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
/**
* @author Thiago da Rosa de Bustamante
*
*/
class RootViewContainer extends SingleViewContainer
{
private Panel containerPanel;
private View rootView;
public RootViewContainer()
{
super(null, true);
containerPanel = RootPanel.get();
bindToDOM();
}
public View getView()
{
return rootView;
}
@Override
protected boolean doAdd(View view, boolean lazy, Object parameter)
{
assert(views.isEmpty()):"RootViewContainer can not contain more then one view";
rootView = view;
boolean added = super.doAdd(view, lazy, parameter);
if (!added)
{//During view creation, a widget can make a reference to Screen static methods... So, it is better to
// set rootView reference before widgets creation...
rootView = null;
}
return added;
}
@Override
protected boolean doRemove(View view, boolean skipEvents)
{
boolean removed = super.doRemove(view, skipEvents);
if (removed)
{
rootView = null;
}
return removed;
}
@Override
protected Panel getContainerPanel(View view)
{
return getContainerPanel();
}
protected Panel getContainerPanel()
{
return containerPanel;
}
@Override
protected void handleViewTitle(String title, Panel containerPanel, String viewId)
{
Window.setTitle(title);
}
}
|
[
"[email protected]"
] | |
a98385d55590c833e518290991703521caf9c81c
|
c8682f670d46a897d42bc14be978dea9487371c3
|
/jhaws/swing/src/test/java/org/swingeasy/RoundedBorderDemo.java
|
3c7cd606be16006b130d952384f3134926061148
|
[
"MIT"
] |
permissive
|
jurgendl/jhaws
|
04322a1d7073b6e3509040ef2ddcaa587e5d365a
|
871af0de8a23f618bfd0d47b879a0e8de35b785d
|
refs/heads/master
| 2023-08-09T03:03:09.106795 | 2023-07-29T10:51:08 | 2023-07-29T10:51:08 | 32,465,714 | 4 | 0 |
MIT
| 2023-08-27T15:43:08 | 2015-03-18T15:03:58 |
JavaScript
|
UTF-8
|
Java
| false | false | 3,426 |
java
|
package org.swingeasy;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Window;
import java.text.DateFormat;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import javax.swing.WindowConstants;
import org.swingeasy.system.SystemSettings;
/**
* @author Jurgen
*/
public class RoundedBorderDemo {
private static Timer timer;
private static JFrame frame;
private static Timer time;
private static final DateFormat dtf = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, SystemSettings.getCurrentLocale());
private static float max = .65f;
public static void fadeIn(final Window w) {
w.setVisible(true);
UIUtils.translucent(w, 0.0f);
final int duration = 500;
final int delay = 1000;
final long start = delay + System.nanoTime() / 1000000;
RoundedBorderDemo.timer = new Timer(5, e -> {
long now = System.nanoTime() / 1000000;
long total = now - start;
float f = (float) total / duration;
if (total > duration) {
RoundedBorderDemo.timer.stop();
RoundedBorderDemo.fadeOut(w);
}
UIUtils.translucent(w, Math.min(RoundedBorderDemo.max, f * RoundedBorderDemo.max));
});
RoundedBorderDemo.timer.setInitialDelay(delay);
RoundedBorderDemo.timer.start();
}
public static void fadeOut(final Window w) {
final int duration = 1000;
final int delay = 10000;
final long start = delay + System.nanoTime() / 1000000;
RoundedBorderDemo.timer = new Timer(5, e -> {
long now = System.nanoTime() / 1000000;
long total = now - start;
float f = (float) total / duration;
if (total > duration) {
RoundedBorderDemo.timer.stop();
w.setVisible(false);
RoundedBorderDemo.frame.dispose();
RoundedBorderDemo.time.stop();
}
UIUtils.translucent(w, Math.max(0.0f, (1.0f - f) * RoundedBorderDemo.max));
});
RoundedBorderDemo.timer.setInitialDelay(delay);
RoundedBorderDemo.timer.start();
}
public static void main(String[] args) {
UIUtils.systemLookAndFeel();
RoundedBorderDemo.frame = new JFrame("forced exit");
RoundedBorderDemo.frame.setSize(300, 20);
RoundedBorderDemo.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
RoundedBorderDemo.frame.setVisible(true);
final Window w = new Window(RoundedBorderDemo.frame);
w.setLayout(new BorderLayout());
JPanel main = new JPanel(new BorderLayout());
main.setBackground(Color.lightGray);
final JLabel timel = new JLabel(RoundedBorderDemo.dtf.format(new Date()), null, SwingConstants.CENTER);
timel.setFont(timel.getFont().deriveFont(36f));
RoundedBorderDemo.time = new Timer(990, e -> timel.setText(RoundedBorderDemo.dtf.format(new Date())));
RoundedBorderDemo.time.start();
main.add(timel);
w.add(main);
w.setSize(470, 80);
UIUtils.bottomRight(w);
UIUtils.makeDraggable(main);
UIUtils.rounded(w, 40);
UIUtils.translucent(w);
RoundedBorderDemo.fadeIn(w);
}
}
|
[
"[email protected]"
] | |
ff10dcb0b15406b5f4abb6cf1244c93ce99462eb
|
fb14f232078235e351a2e64b74baae16b0f4b677
|
/src/main/java/com/refinitiv/ejvqa/service/SampleDataMigration.java
|
aec7436bdef977ed25288003db5d401931204f58
|
[] |
no_license
|
liuxiaopiao/database-compare-preprocessor-AWS
|
52287dfc1f574172832d59a26e38485e687a7d33
|
ca596e190778d221a0528b5df814b09beda5554a
|
refs/heads/master
| 2022-04-18T08:18:38.198855 | 2020-04-13T07:33:41 | 2020-04-13T07:33:41 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,536 |
java
|
package com.refinitiv.ejvqa.service;
import com.refinitiv.ejvqa.util.CommonUtil;
import java.sql.*;
public class SampleDataMigration {
public static void main(String[] args) {
try {
Connection conn = null;
conn = CommonUtil.createConnection("mssql", conn, "192.168.99.100:1433", "data_govcorp", "sa", "Wuaiyun22019;");
Statement statement = conn.createStatement();
String sql = "select * from id_obj_xref_hist";
ResultSet resultSet = statement.executeQuery(sql);
ResultSetMetaData rSMD = resultSet.getMetaData();
Connection conn2 = null;
conn2 = CommonUtil.createConnection("mssql", conn, "192.168.99.100:1433", "scratch", "sa", "Wuaiyun22019;");
StringBuilder sb = new StringBuilder();
StringBuilder sb1 = new StringBuilder();
int columnConuts = rSMD.getColumnCount();
for (int i = 1; i <= columnConuts; i++) {
if(rSMD.getColumnTypeName(i).equalsIgnoreCase("binary")){
sb.append("CONVERT(binary(8),?),");
}else if(rSMD.getColumnTypeName(i).equalsIgnoreCase("char")){
sb.append("CAST(? as char),");
}else if(rSMD.getColumnTypeName(i).equalsIgnoreCase("smalldatetime")||rSMD.getColumnTypeName(i).equalsIgnoreCase("datetime")){
sb.append("CONVERT(datetime,?),");
}else if(rSMD.getColumnTypeName(i).equalsIgnoreCase("int")||rSMD.getColumnTypeName(i).equalsIgnoreCase("smallint")){
sb.append("CONVERT(int,?),");
}else if(rSMD.getColumnTypeName(i).equalsIgnoreCase("float")){
sb.append("CONVERT(float,?),");
}else if(rSMD.getColumnTypeName(i).equalsIgnoreCase("double")){
sb.append("CONVERT(double,?),");
}
sb1.append(rSMD.getColumnTypeName(i)+"|");
}
String sql2 = "insert into id_obj_xref_hist values(" + sb.toString().substring(0, sb.length() - 1) + ")";
System.out.println(sql2);
System.out.println(sb1.toString());
PreparedStatement ps = conn2.prepareStatement(sql2);
while (resultSet.next()) {
for(int i=1;i<=columnConuts;i++){
ps.setString(i,resultSet.getString(i));
}
ps.executeUpdate();
}
}catch(Exception e){
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
d1a296fd251a4cd1445a70733f6d882e4232ee15
|
e5db3b9164f41a48ac19c334de67fd96e948f952
|
/ObjectOrientedProgramming/src/com/abhishek/Transaction.java
|
5907593a5fdee009a28d5064337258f0e38f7296
|
[] |
no_license
|
ysabhi1993/Java-Code
|
51004322721046b2f84f0c0647f46a88647232ce
|
68037b8e8e36d76fe6d2f5ca7a35227e5032724d
|
refs/heads/master
| 2021-04-30T08:27:15.023888 | 2018-02-13T12:03:55 | 2018-02-13T12:03:55 | 121,375,403 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,163 |
java
|
package com.abhishek;
public class Transaction {
private String typeOfTransaction;
private double depAmount;
private double withdrawAmount;
private String timeOfTransaction;
private String transactionBranch;
private Address branchAddress;
public Transaction(String typeOfTransaction, double depAmount, double withdrawAmount,
String timeOfTransaction, String transactionBranch, Address branchAddress) {
this.typeOfTransaction = typeOfTransaction;
this.depAmount = depAmount;
this.withdrawAmount = withdrawAmount;
this.timeOfTransaction = timeOfTransaction;
this.transactionBranch = transactionBranch;
this.branchAddress = branchAddress;
}
public void transDetails(String typeOfTransaction, String timeOfTransaction, String transactionBranch, Address branchAddress){
System.out.println("Transaction done ");
}
public String isTypeOfTransaction() {
return typeOfTransaction;
}
public void setTypeOfTransaction(String typeOfTransaction) {
this.typeOfTransaction = typeOfTransaction;
}
public double getDepAmount() {
return depAmount;
}
public void setDepAmount(double depAmount) {
this.depAmount = depAmount;
}
public double getWithdrawAmount() {
return withdrawAmount;
}
public void setWithdrawAmount(double withdrawAmount) {
this.withdrawAmount = withdrawAmount;
}
public String getTimeOfTransaction() {
return timeOfTransaction;
}
public void setTimeOfTransaction(String timeOfTransaction) {
this.timeOfTransaction = timeOfTransaction;
}
public String getTransactionBranch() {
return transactionBranch;
}
public void setTransactionBranch(String transactionBranch) {
this.transactionBranch = transactionBranch;
}
public Address getBranchAddress() {
return branchAddress;
}
public void setBranchAddress(Address branchAddress) {
this.branchAddress = branchAddress;
}
}
|
[
"[email protected]"
] | |
1b0b0ea4f1992ee08ba743adcf01e60a88196f14
|
b2b29aa9ac52ce9a5842d2e00cf2f1f211988caa
|
/Ordrit/src/com/ordrit/model/Order.java
|
6e09daafb69c6cfbf7af5ceea68de4c495d13850
|
[] |
no_license
|
tnyadav/NewOrdrIt
|
f033bd836e40f311d8f96929f6c3f2eabc872ad8
|
760c838d11b9229c30c3bc56a4146620a88b1767
|
refs/heads/master
| 2021-01-10T19:57:43.997974 | 2014-09-14T04:58:53 | 2014-09-14T04:58:53 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,325 |
java
|
package com.ordrit.model;
import java.io.Serializable;
import java.util.List;
public class Order implements Serializable{
private static final long serialVersionUID = 1L;
private String id;
private String status;
private String creationDate;
private List<Item> itemsInOrder;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public String toString() {
return "Order [id=" + id + ", status=" + status + ", creationDate="
+ creationDate + ", itemsInOrder=" + itemsInOrder
+ ", getId()=" + getId() + ", getStatus()=" + getStatus()
+ ", getCreationDate()=" + getCreationDate()
+ ", getItemsInOrder()=" + getItemsInOrder() + ", getClass()="
+ getClass() + ", hashCode()=" + hashCode() + ", toString()="
+ super.toString() + "]";
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreationDate() {
return creationDate;
}
public void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
public List<Item> getItemsInOrder() {
return itemsInOrder;
}
public void setItemsInOrder(List<Item> itemsInOrder) {
this.itemsInOrder = itemsInOrder;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
|
[
"[email protected]"
] | |
92d00103c832977da5056320524c625be90abf5c
|
48d7f3d820c6fe2924c0297d24f40fc70c5ff0e9
|
/vertx-gaia/vertx-co/src/main/java/io/vertx/up/util/Stream.java
|
4568385ad13d45d252dd5bb7d232da6f4dc7cf9b
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
evgreenhua/vertx-zero
|
a3ada0c7dbcc6a3b9e09fb8aed3094caa5ca35fd
|
637f4540c06a6b030c24354e298c2a10cfbd4b22
|
refs/heads/master
| 2023-03-17T13:06:34.294589 | 2022-09-29T02:44:55 | 2022-09-29T02:44:55 | 423,061,256 | 0 | 0 |
Apache-2.0
| 2021-10-31T05:26:05 | 2021-10-31T05:26:05 | null |
UTF-8
|
Java
| false | false | 9,170 |
java
|
package io.vertx.up.util;
import io.vertx.core.buffer.Buffer;
import io.vertx.up.eon.FileSuffix;
import io.vertx.up.eon.Protocols;
import io.vertx.up.eon.Strings;
import io.vertx.up.eon.Values;
import io.vertx.up.exception.heart.EmptyStreamException;
import io.vertx.up.fn.Actuator;
import io.vertx.up.fn.Fn;
import io.vertx.up.log.Log;
import io.vertx.up.runtime.EnvVariables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.JarURLConnection;
import java.net.URL;
import java.util.Objects;
import java.util.function.Supplier;
/**
* Stream read class.
*/
final class Stream {
/**
* 「DEAD-LOCK」LoggerFactory.getLogger
* Do not use `Annal` logger because of deadlock.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(Stream.class);
private Stream() {
}
/**
* Codec usage
*
* @param message The java object that will be converted from.
* @param <T> Target java object that will be converted to.
*
* @return Target java object ( Generic Type )
*/
static <T> byte[] to(final T message) {
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
return Fn.orJvm(new byte[0], () -> {
final ObjectOutputStream out = new ObjectOutputStream(bytes);
out.writeObject(message);
out.close();
return bytes.toByteArray();
}, bytes);
}
/**
* Codec usage
*
* @param pos The position of reading
* @param buffer The buffer to hold the data from reading.
* @param <T> The converted java object type, Generic Type
*
* @return Return to converted java object.
*/
@SuppressWarnings("unchecked")
static <T> T from(final int pos, final Buffer buffer) {
LOGGER.debug("[ Position ] {}", pos);
final ByteArrayInputStream stream = new ByteArrayInputStream(buffer.getBytes());
return Fn.orJvm(null, () -> {
final ObjectInputStream in = new ObjectInputStream(stream);
return (T) in.readObject();
}, stream);
}
/**
* @param filename The filename to describe source path
*
* @return Return the InputStream object mount to source path.
*/
static InputStream read(final String filename) {
InputStream in = read(filename, null);
if (Objects.isNull(in)) {
in = read(filename, Stream.class);
}
return in;
}
static String root() {
final URL rootUrl = Stream.class.getResource("/");
if (Objects.isNull(rootUrl)) {
return Strings.EMPTY;
} else {
final File rootFile = new File(rootUrl.getFile());
return rootFile.getAbsolutePath() + "/";
}
}
static byte[] readBytes(final String filename) {
final InputStream in = read(filename);
return Fn.orJvm(() -> {
final ByteArrayOutputStream out = new ByteArrayOutputStream(Values.CACHE_SIZE);
final byte[] temp = new byte[Values.CACHE_SIZE];
int size;
while ((size = in.read(temp)) != -1) {
out.write(temp, 0, size);
}
in.close();
return out.toByteArray();
});
}
/**
* Ensure read from path
* 1. Read from current folder
* 2. clazz == null: Read from class loader
* 3. clazz != null: Read from clazz's class loader
*
* @param filename The filename to describe source path
* @param clazz The class loader related class
*
* @return Return the InputStream object mount to source path.
*/
private static InputStream read(final String filename,
final Class<?> clazz) {
ioDebug(() -> Log.info(LOGGER, Info.__FILE_ROOT, root(), filename));
/*
* 0. new File(filename)
* new FileInputStream(File)
*/
final File file = new File(filename);
if (file.exists()) {
ioDebug(() -> Log.info(LOGGER, Info.INF_CUR, file.exists()));
return readSupplier(() -> in(file), filename);
} else {
/*
* filename re-calculate with root()
*/
final String refile = StringUtil.path(root(), filename);
final File fileResolved = new File(refile);
if (fileResolved.exists()) {
return readSupplier(() -> in(fileResolved), refile);
}
}
InputStream in;
if (Objects.isNull(clazz)) {
/*
* 1. Thread.currentThread().getContextClassLoader()
* loader.getResourceAsStream(filename)
*/
in = readSupplier(() -> in(filename), filename);
} else {
/*
* 2. clazz.getResourceAsStream(filename)
*/
in = readSupplier(() -> in(filename, clazz), filename);
if (Objects.isNull(in)) {
/*
* Switch to 1.
*/
in = readSupplier(() -> in(filename), filename);
}
}
// Stream.class get
if (Objects.isNull(in)) {
/*
* 3. Stream.class.getResourceAsStream(filename)
*/
ioDebug(() -> Log.info(LOGGER, Info.__CLASS_LOADER_STREAM, filename));
in = readSupplier(() -> Stream.class.getResourceAsStream(filename), filename);
}
// System.Class Loader
if (Objects.isNull(in)) {
/*
* 4. ClassLoader.getSystemResourceAsStream(filename)
*/
ioDebug(() -> Log.info(LOGGER, Info.__CLASS_LOADER_SYSTEM, filename));
in = readSupplier(() -> ClassLoader.getSystemResourceAsStream(filename), filename);
}
/*
* Jar reading
* Firstly, check whether it contains jar flag
*/
if (Objects.isNull(in) && filename.contains(FileSuffix.JAR_DIVIDER)) {
/*
* 5. readJar(filename)
*/
ioDebug(() -> Log.info(LOGGER, Info.__JAR_RESOURCE, filename));
in = readJar(filename);
}
if (null == in) {
throw new EmptyStreamException(filename);
}
return in;
}
private static InputStream readJar(final String filename) {
return readSupplier(() -> {
try {
final URL url = new URL(filename);
final String protocol = url.getProtocol();
if (Protocols.JAR.equals(protocol)) {
final JarURLConnection jarCon = (JarURLConnection) url.openConnection();
return jarCon.getInputStream();
} else {
return null; // Jar Error
}
} catch (final IOException e) {
Log.jvm(LOGGER, e);
return null;
}
}, filename);
}
private static InputStream readSupplier(final Supplier<InputStream> supplier,
final String filename) {
final InputStream in = supplier.get();
if (null != in) {
ioDebug(() -> Log.info(LOGGER, Info.INF_PATH, filename, in));
}
return in;
}
/**
* Stream read from up.god.file object
* new FileInputStream(up.god.file)
*
* @param file The up.god.file object to describe source path
*
* @return Return the InputStream object mount to source path.
*/
static InputStream in(final File file) {
ioDebug(() -> Log.info(LOGGER, Info.__FILE_INPUT_STREAM, Objects.isNull(file) ? null : file.getAbsolutePath()));
return Fn.orJvm(() -> (file.exists() && file.isFile()) ? new FileInputStream(file) : null, file);
}
/**
* Stream read from clazz
* clazz.getResourceAsStream(filename)
*
* @param filename The filename to describe source path
* @param clazz The class loader related class
*
* @return Return the InputStream object mount to source path.
*/
static InputStream in(final String filename, final Class<?> clazz) {
ioDebug(() -> Log.info(LOGGER, Info.__RESOURCE_AS_STREAM, filename));
return Fn.orJvm(() -> clazz.getResourceAsStream(filename), clazz, filename);
}
/**
* Stream read from Thread Class Loader
* Thread.currentThread().getContextClassLoader()
*
* @param filename The filename to describe source path
*
* @return Return the InputStream object mount to source path.
*/
static InputStream in(final String filename) {
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
ioDebug(() -> Log.info(LOGGER, Info.__CLASS_LOADER, filename));
return Fn.orJvm(() -> loader.getResourceAsStream(filename), filename);
}
private static void ioDebug(final Actuator executor) {
final boolean ioDebug = Env.readBool(EnvVariables.Z_IO_DEBUG);
if (ioDebug) {
executor.execute();
}
}
}
|
[
"[email protected]"
] | |
a588cef0227e9cd6138c4e4904debcecc97d24e7
|
6443580ba6a8015c0c5f0397b23fd9cd28b4d7bf
|
/guice/src/test/java/me/marianonavas/learningtests/guice/ScopesTest.java
|
09956234305d5e62258c68ac656ec552c0925824
|
[] |
no_license
|
marianudo/learningtests
|
ef74e834256c4f5914f0175c2ff5501cbd119aeb
|
4d0e4d777632f78058f11907f494edbc7de817f0
|
refs/heads/master
| 2020-06-09T01:37:00.421786 | 2014-02-03T13:25:39 | 2014-02-03T13:25:39 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 795 |
java
|
package me.marianonavas.learningtests.guice;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Singleton;
public class ScopesTest {
static class MyClass {}
static class Module extends AbstractModule {
@Override
protected void configure() {
bind(MyClass.class).in(Singleton.class);
}
}
private Injector injector;
@Before
public void setUp() {
injector = Guice.createInjector(new Module());
}
@Test
public void testInstanceSingleton() {
MyClass instance1 = injector.getInstance(MyClass.class);
MyClass instance2 = injector.getInstance(MyClass.class);
assertSame(instance1, instance2);
}
}
|
[
"[email protected]"
] | |
96462a1cb44d400bc0ba752b39076e465f43cb34
|
89afcfd9822ecfef1f696fd62c27218e0f874744
|
/app/src/main/java/com/whatmedia/ttia/response/GetRestaurantInfoResponse.java
|
599b578fb4ac3a36aecff1638a2e233b90252f74
|
[] |
no_license
|
ilikekobe0502/Airport
|
d99647a98abfda4ef42ed10613cdc07b380b943e
|
a346d59e411377045503d4bd8e48f12aa1461b64
|
refs/heads/master
| 2021-01-15T14:28:36.573681 | 2017-09-29T12:34:44 | 2017-09-29T12:34:44 | 99,692,168 | 0 | 1 | null | 2018-02-12T05:17:56 | 2017-08-08T12:49:42 |
Java
|
UTF-8
|
Java
| false | false | 969 |
java
|
package com.whatmedia.ttia.response;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.whatmedia.ttia.response.data.RestaurantInfoData;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
/**
* Created by neo_mac on 2017/8/5.
*/
public class GetRestaurantInfoResponse {
@SerializedName("data")
private List<RestaurantInfoData> data;
public static List<RestaurantInfoData> newInstance(String response) {
Gson gson = new Gson();
Type type = new TypeToken<ArrayList<RestaurantInfoData>>() {
}.getType();
GetRestaurantInfoResponse restaurantInfoResponse = gson.fromJson(response, GetRestaurantInfoResponse.class);
if (restaurantInfoResponse != null && restaurantInfoResponse.data != null) {
return restaurantInfoResponse.data;
} else
return new ArrayList<>();
}
}
|
[
"[email protected]"
] | |
0cbce173b773089ca12071a7462e8ff8c958173c
|
a4082921471f4a22f59b6698aef54900317f5709
|
/01SourceCode/lambda-mls/lambda-portal/src/main/java/com/yatop/lambda/portal/job/controller/JobController.java
|
37346925370af31811d86e7dde9030fa0f131e84
|
[] |
no_license
|
P79N6A/lambda-xxoo
|
3aae11893a78ce863a4f96b821a500dcb7f35500
|
75c41019282d53eaa59aaa220e6fff49a337d01f
|
refs/heads/master
| 2020-04-29T07:35:36.491014 | 2019-03-16T10:34:03 | 2019-03-16T10:34:03 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,696 |
java
|
package com.yatop.lambda.portal.job.controller;
import com.yatop.lambda.portal.common.annotation.Log;
import com.yatop.lambda.portal.common.controller.BaseController;
import com.yatop.lambda.portal.common.domain.QueryRequest;
import com.yatop.lambda.portal.common.exception.PortalException;
import com.yatop.lambda.portal.job.domain.Job;
import com.yatop.lambda.portal.job.service.JobService;
import com.wuwenze.poi.ExcelKit;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
//import org.quartz.CronExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
@Slf4j
//@Validated
//@RestController
//@RequestMapping("job")
public class JobController extends BaseController {
private String message;
/*@Autowired
private JobService jobService;
@GetMapping
@RequiresPermissions("job:view")
public Map<String, Object> jobList(QueryRequest request, Job job) {
return super.selectByPageNumSize(request, () -> this.jobService.findJobs(request, job));
}
@GetMapping("cron/check")
public boolean checkCron(String cron) {
try {
return CronExpression.isValidExpression(cron);
} catch (Exception e) {
return false;
}
}
@Log("新增定时任务")
@PostMapping
@RequiresPermissions("job:add")
public void addJob(@Valid Job job) throws PortalException {
try {
this.jobService.createJob(job);
} catch (Exception e) {
message = "新增定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@Log("删除定时任务")
@DeleteMapping("/{jobIds}")
@RequiresPermissions("job:delete")
public void deleteJob(@NotBlank(message = "{required}") @PathVariable String jobIds) throws PortalException {
try {
String[] ids = jobIds.split(",");
this.jobService.deleteJobs(ids);
} catch (Exception e) {
message = "删除定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@Log("修改定时任务")
@PutMapping
@RequiresPermissions("job:update")
public void updateJob(@Valid Job job) throws PortalException {
try {
this.jobService.updateJob(job);
} catch (Exception e) {
message = "修改定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@Log("执行定时任务")
@GetMapping("run/{jobId}")
@RequiresPermissions("job:run")
public void runJob(@NotBlank(message = "{required}") @PathVariable String jobId) throws PortalException {
try {
this.jobService.run(jobId);
} catch (Exception e) {
message = "执行定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@Log("暂停定时任务")
@GetMapping("pause/{jobId}")
@RequiresPermissions("job:pause")
public void pauseJob(@NotBlank(message = "{required}") @PathVariable String jobId) throws PortalException {
try {
this.jobService.pause(jobId);
} catch (Exception e) {
message = "暂停定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@Log("恢复定时任务")
@GetMapping("resume/{jobId}")
@RequiresPermissions("job:resume")
public void resumeJob(@NotBlank(message = "{required}") @PathVariable String jobId) throws PortalException {
try {
this.jobService.resume(jobId);
} catch (Exception e) {
message = "恢复定时任务失败";
log.error(message, e);
throw new PortalException(message);
}
}
@PostMapping("excel")
@RequiresPermissions("job:export")
public void export(Job job, QueryRequest request, HttpServletResponse response) throws PortalException {
try {
List<Job> jobs = this.jobService.findJobs(request, job);
ExcelKit.$Export(Job.class, response).downXlsx(jobs, false);
} catch (Exception e) {
message = "导出Excel失败";
log.error(message, e);
throw new PortalException(message);
}
}*/
}
|
[
"[email protected]"
] | |
01fa4438146c60e0e8c0ee64e5d32c1cc5572654
|
14e7c43264d2f33f4487ff5c2eac5ec07e687c9b
|
/aiga3/src/main/java/com/ai/aiga/view/controller/specialAdministration/dto/ArchDbConnectHeatBaseCoreTable.java
|
56d5238daa5f93639726075720283241b4ceddda
|
[] |
no_license
|
wang-shun/aiga3
|
0f7e822b28d910b7054f8feb2a81ca05decbd213
|
8eb83d19214dc3637a53178ccc670cb038c052a7
|
refs/heads/master
| 2020-04-02T06:48:10.308384 | 2018-08-27T10:29:20 | 2018-08-27T10:29:20 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 522 |
java
|
package com.ai.aiga.view.controller.specialAdministration.dto;
import java.io.Serializable;
import lombok.Data;
@Data
public class ArchDbConnectHeatBaseCoreTable implements Serializable {
private String indexName;
private String center;
private String module;
private String db;
private Long vesselNum;
private Long minIdle;
private Long maxIdle;
private Long gtminIdle;
private Long totalSession;
private double persentage;
private String insertTime;
}
|
[
"[email protected]"
] | |
d529487b5941b7dd9de2a568ee779bc127628b61
|
94d9c008f66200cd1127f8246d046ee16323e8d2
|
/app/src/main/java/com/example/ishaycena/tabfragments/SignupService/PlaceAutoCompleteAdapter.java
|
45315d18caf06d85a4830857447d0c461518dc86
|
[] |
no_license
|
ishay3000/Lost-it
|
95f1692cebce63ff0aa1cec31f673f75cde33142
|
166b8ec86469c4ba5a33ad23dddc9154b0eb90c2
|
refs/heads/master
| 2021-10-10T08:14:19.711991 | 2018-10-31T13:12:08 | 2018-10-31T13:12:08 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,127 |
java
|
package com.example.ishaycena.tabfragments.SignupService;
/*
* Copyright (C) 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.content.Context;
import android.graphics.Typeface;
import android.text.style.CharacterStyle;
import android.text.style.StyleSpan;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.data.DataBufferUtils;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.AutocompletePrediction;
import com.google.android.gms.location.places.AutocompletePredictionBufferResponse;
import com.google.android.gms.location.places.GeoDataClient;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.tasks.RuntimeExecutionException;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.Tasks;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Adapter that handles Autocomplete requests from the Places Geo Data Client.
* {@link AutocompletePrediction} results from the API are frozen and stored directly in this
* adapter. (See {@link AutocompletePrediction#freeze()}.)
*/
class PlaceAutocompleteAdapter
extends ArrayAdapter<AutocompletePrediction> implements Filterable {
private static final String TAG = "PlaceAutocompleteAdapter";
private static final CharacterStyle STYLE_BOLD = new StyleSpan(Typeface.BOLD);
/**
* Current results returned by this adapter.
*/
private ArrayList<AutocompletePrediction> mResultList;
/**
* Handles autocomplete requests.
*/
private GeoDataClient mGeoDataClient;
/**
* The bounds used for Places Geo Data autocomplete API requests.
*/
private LatLngBounds mBounds;
/**
* The autocomplete filter used to restrict queries to a specific set of place types.
*/
private AutocompleteFilter mPlaceFilter;
/**
* Initializes with a resource for text rows and autocomplete query bounds.
*
* @see ArrayAdapter#ArrayAdapter(Context, int)
*/
public PlaceAutocompleteAdapter(Context context, GeoDataClient geoDataClient,
LatLngBounds bounds, AutocompleteFilter filter) {
super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
mGeoDataClient = geoDataClient;
mBounds = bounds;
mPlaceFilter = filter;
}
/**
* Sets the bounds for all subsequent queries.
*/
public void setBounds(LatLngBounds bounds) {
mBounds = bounds;
}
/**
* Returns the number of results received in the last autocomplete query.
*/
@Override
public int getCount() {
return mResultList.size();
}
/**
* Returns an item from the last autocomplete query.
*/
@Override
public AutocompletePrediction getItem(int position) {
return mResultList.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = super.getView(position, convertView, parent);
// Sets the primary and secondary text for a row.
// Note that getPrimaryText() and getSecondaryText() return a CharSequence that may contain
// styling based on the given CharacterStyle.
AutocompletePrediction item = getItem(position);
TextView textView1 = (TextView) row.findViewById(android.R.id.text1);
TextView textView2 = (TextView) row.findViewById(android.R.id.text2);
textView1.setText(item.getPrimaryText(STYLE_BOLD));
textView2.setText(item.getSecondaryText(STYLE_BOLD));
return row;
}
/**
* Returns the filter for the current set of autocomplete results.
*/
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
// We need a separate list to store the results, since
// this is run asynchronously.
ArrayList<AutocompletePrediction> filterData = new ArrayList<>();
// Skip the autocomplete query if no constraints are given.
if (constraint != null) {
// Query the autocomplete API for the (constraint) search string.
filterData = getAutocomplete(constraint);
}
results.values = filterData;
if (filterData != null) {
results.count = filterData.size();
} else {
results.count = 0;
}
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
if (results != null && results.count > 0) {
// The API returned at least one result, update the data.
mResultList = (ArrayList<AutocompletePrediction>) results.values;
notifyDataSetChanged();
} else {
// The API did not return any results, invalidate the data set.
notifyDataSetInvalidated();
}
}
@Override
public CharSequence convertResultToString(Object resultValue) {
// Override this method to display a readable result in the AutocompleteTextView
// when clicked.
if (resultValue instanceof AutocompletePrediction) {
return ((AutocompletePrediction) resultValue).getFullText(null);
} else {
return super.convertResultToString(resultValue);
}
}
};
}
/**
* Submits an autocomplete query to the Places Geo Data Autocomplete API.
* Results are returned as frozen AutocompletePrediction objects, ready to be cached.
* Returns an empty list if no results were found.
* Returns null if the API client is not available or the query did not complete
* successfully.
* This method MUST be called off the main UI thread, as it will block until data is returned
* from the API, which may include a network request.
*
* @param constraint Autocomplete query string
* @return Results from the autocomplete API or null if the query was not successful.
* @see GeoDataClient#getAutocompletePredictions(String, LatLngBounds, AutocompleteFilter)
* @see AutocompletePrediction#freeze()
*/
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
Log.i(TAG, "Starting autocomplete query for: " + constraint);
// Submit the query to the autocomplete API and retrieve a PendingResult that will
// contain the results when the query completes.
Task<AutocompletePredictionBufferResponse> results =
mGeoDataClient.getAutocompletePredictions(constraint.toString(), mBounds,
mPlaceFilter);
// This method should have been called off the main UI thread. Block and wait for at most
// 60s for a result from the API.
try {
Tasks.await(results, 60, TimeUnit.SECONDS);
} catch (ExecutionException | InterruptedException | TimeoutException e) {
e.printStackTrace();
}
try {
AutocompletePredictionBufferResponse autocompletePredictions = results.getResult();
Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount()
+ " predictions.");
// Freeze the results immutable representation that can be stored safely.
return DataBufferUtils.freezeAndClose(autocompletePredictions);
} catch (RuntimeExecutionException e) {
// If the query did not complete successfully return null
Toast.makeText(getContext(), "Error contacting API: " + e.toString(),
Toast.LENGTH_SHORT).show();
Log.e(TAG, "Error getting autocomplete prediction API call", e);
return null;
}
}
}
|
[
"[email protected]"
] | |
9121545b5f8d8b29399674590daa98261d39885f
|
b6b3cc301bdc70efc8593519841add5f804a53fa
|
/src/evaluación/ObtieneInfo.java
|
767be8105c243b288e83aeb33ba7da1ec7712e6a
|
[] |
no_license
|
AValeriaCM/Evaluacion
|
52b89649630e28fd8b4a48c5f441d3c863faefc8
|
bb6a3b1fef142e92e1d6ce6c78391b2736429789
|
refs/heads/master
| 2021-06-23T16:21:34.762180 | 2017-09-10T01:14:43 | 2017-09-10T01:14:43 | 102,994,624 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 379 |
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 evaluación;
/**
*
* @author Angie Castañeda
*/
public class ObtieneInfo {
public ObtieneInfo() {
}
}
|
[
"SPC7Z@ANGIEVCM"
] |
SPC7Z@ANGIEVCM
|
62008ffd194e98f55efbaca4e5ea6716cf3c98fa
|
182f1864d76dc3bce121807c52080839d20eea1e
|
/wolips/core/plugins/org.objectstyle.wolips.wodclipse.core/java/jp/aonir/fuzzyxml/internal/Entities.java
|
9275d1586fccb31da695333b709eb3ca7b7cf368
|
[] |
no_license
|
adalbert-w/wolips
|
eaa08063190c6e514cde0ac4ed074d16ff0456c2
|
470f8f4516fbf062586e2b730f6d977d812f750c
|
refs/heads/master
| 2021-01-18T01:24:35.160339 | 2014-11-04T06:52:18 | 2014-11-04T06:52:18 | 26,087,553 | 2 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 39,913 |
java
|
/*
* Copyright 2002-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jp.aonir.fuzzyxml.internal;
import java.io.IOException;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/**
* <p>Provides HTML and XML entity utilities.</p>
*
* <p>
* <strong>Note:</strong> This class came from <a href="http://jakarta.apache.org/commons/lang/">Jakarta Commons Lang</a>,
* and applied small patches for standalone using.
* The original source code is <a href="http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java?rev=209978&view=markup">here</a>.
* </p>
*
* @see <a href="http://hotwired.lycos.com/webmonkey/reference/special_characters/">ISO Entities</a>
* @see <a href="http://www.w3.org/TR/REC-html32#latin1">HTML 3.2 Character Entities for ISO Latin-1</a>
* @see <a href="http://www.w3.org/TR/REC-html40/sgml/entities.html">HTML 4.0 Character entity references</a>
* @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3">HTML 4.01 Character References</a>
* @see <a href="http://www.w3.org/TR/html401/charset.html#code-position">HTML 4.01 Code positions</a>
*
* @author <a href="mailto:[email protected]">Alexander Day Chaffee</a>
* @author <a href="mailto:[email protected]">Gary Gregory</a>
*/
public class Entities {
private static final String[][] BASIC_ARRAY = {
{"quot", "34"}, // " - double-quote
{"amp", "38"}, // & - ampersand
{"lt", "60"}, // < - less-than
{"gt", "62"}, // > - greater-than
};
private static final String[][] APOS_ARRAY = {
{"apos", "39"}, // XML apostrophe
};
// package scoped for testing
static final String[][] ISO8859_1_ARRAY = {
{"nbsp", "160"}, // non-breaking space
{"iexcl", "161"}, //inverted exclamation mark
{"cent", "162"}, //cent sign
{"pound", "163"}, //pound sign
{"curren", "164"}, //currency sign
{"yen", "165"}, //yen sign = yuan sign
{"brvbar", "166"}, //broken bar = broken vertical bar
{"sect", "167"}, //section sign
{"uml", "168"}, //diaeresis = spacing diaeresis
{"copy", "169"}, // ? - copyright sign
{"ordf", "170"}, //feminine ordinal indicator
{"laquo", "171"}, //left-pointing double angle quotation mark = left pointing guillemet
{"not", "172"}, //not sign
{"shy", "173"}, //soft hyphen = discretionary hyphen
{"reg", "174"}, // ? - registered trademark sign
{"macr", "175"}, //macron = spacing macron = overline = APL overbar
{"deg", "176"}, //degree sign
{"plusmn", "177"}, //plus-minus sign = plus-or-minus sign
{"sup2", "178"}, //superscript two = superscript digit two = squared
{"sup3", "179"}, //superscript three = superscript digit three = cubed
{"acute", "180"}, //acute accent = spacing acute
{"micro", "181"}, //micro sign
{"para", "182"}, //pilcrow sign = paragraph sign
{"middot", "183"}, //middle dot = Georgian comma = Greek middle dot
{"cedil", "184"}, //cedilla = spacing cedilla
{"sup1", "185"}, //superscript one = superscript digit one
{"ordm", "186"}, //masculine ordinal indicator
{"raquo", "187"}, //right-pointing double angle quotation mark = right pointing guillemet
{"frac14", "188"}, //vulgar fraction one quarter = fraction one quarter
{"frac12", "189"}, //vulgar fraction one half = fraction one half
{"frac34", "190"}, //vulgar fraction three quarters = fraction three quarters
{"iquest", "191"}, //inverted question mark = turned question mark
{"Agrave", "192"}, // ? - uppercase A, grave accent
{"Aacute", "193"}, // ? - uppercase A, acute accent
{"Acirc", "194"}, // ? - uppercase A, circumflex accent
{"Atilde", "195"}, // ? - uppercase A, tilde
{"Auml", "196"}, // ? - uppercase A, umlaut
{"Aring", "197"}, // ? - uppercase A, ring
{"AElig", "198"}, // ? - uppercase AE
{"Ccedil", "199"}, // ? - uppercase C, cedilla
{"Egrave", "200"}, // ? - uppercase E, grave accent
{"Eacute", "201"}, // ? - uppercase E, acute accent
{"Ecirc", "202"}, // ? - uppercase E, circumflex accent
{"Euml", "203"}, // ? - uppercase E, umlaut
{"Igrave", "204"}, // ? - uppercase I, grave accent
{"Iacute", "205"}, // ? - uppercase I, acute accent
{"Icirc", "206"}, // ? - uppercase I, circumflex accent
{"Iuml", "207"}, // ? - uppercase I, umlaut
{"ETH", "208"}, // ? - uppercase Eth, Icelandic
{"Ntilde", "209"}, // ? - uppercase N, tilde
{"Ograve", "210"}, // ? - uppercase O, grave accent
{"Oacute", "211"}, // ? - uppercase O, acute accent
{"Ocirc", "212"}, // ? - uppercase O, circumflex accent
{"Otilde", "213"}, // ? - uppercase O, tilde
{"Ouml", "214"}, // ? - uppercase O, umlaut
{"times", "215"}, //multiplication sign
{"Oslash", "216"}, // ? - uppercase O, slash
{"Ugrave", "217"}, // ? - uppercase U, grave accent
{"Uacute", "218"}, // ? - uppercase U, acute accent
{"Ucirc", "219"}, // ? - uppercase U, circumflex accent
{"Uuml", "220"}, // ? - uppercase U, umlaut
{"Yacute", "221"}, // ? - uppercase Y, acute accent
{"THORN", "222"}, // ? - uppercase THORN, Icelandic
{"szlig", "223"}, // ? - lowercase sharps, German
{"agrave", "224"}, // ? - lowercase a, grave accent
{"aacute", "225"}, // ? - lowercase a, acute accent
{"acirc", "226"}, // ? - lowercase a, circumflex accent
{"atilde", "227"}, // ? - lowercase a, tilde
{"auml", "228"}, // ? - lowercase a, umlaut
{"aring", "229"}, // ? - lowercase a, ring
{"aelig", "230"}, // ? - lowercase ae
{"ccedil", "231"}, // ? - lowercase c, cedilla
{"egrave", "232"}, // ? - lowercase e, grave accent
{"eacute", "233"}, // ? - lowercase e, acute accent
{"ecirc", "234"}, // ? - lowercase e, circumflex accent
{"euml", "235"}, // ? - lowercase e, umlaut
{"igrave", "236"}, // ? - lowercase i, grave accent
{"iacute", "237"}, // ? - lowercase i, acute accent
{"icirc", "238"}, // ? - lowercase i, circumflex accent
{"iuml", "239"}, // ? - lowercase i, umlaut
{"eth", "240"}, // ? - lowercase eth, Icelandic
{"ntilde", "241"}, // ? - lowercase n, tilde
{"ograve", "242"}, // ? - lowercase o, grave accent
{"oacute", "243"}, // ? - lowercase o, acute accent
{"ocirc", "244"}, // ? - lowercase o, circumflex accent
{"otilde", "245"}, // ? - lowercase o, tilde
{"ouml", "246"}, // ? - lowercase o, umlaut
{"divide", "247"}, // division sign
{"oslash", "248"}, // ? - lowercase o, slash
{"ugrave", "249"}, // ? - lowercase u, grave accent
{"uacute", "250"}, // ? - lowercase u, acute accent
{"ucirc", "251"}, // ? - lowercase u, circumflex accent
{"uuml", "252"}, // ? - lowercase u, umlaut
{"yacute", "253"}, // ? - lowercase y, acute accent
{"thorn", "254"}, // ? - lowercase thorn, Icelandic
{"yuml", "255"}, // ? - lowercase y, umlaut
};
// http://www.w3.org/TR/REC-html40/sgml/entities.html
// package scoped for testing
static final String[][] HTML40_ARRAY = {
// <!-- Latin Extended-B -->
{"fnof", "402"}, //latin small f with hook = function= florin, U+0192 ISOtech -->
// <!-- Greek -->
{"Alpha", "913"}, //greek capital letter alpha, U+0391 -->
{"Beta", "914"}, //greek capital letter beta, U+0392 -->
{"Gamma", "915"}, //greek capital letter gamma,U+0393 ISOgrk3 -->
{"Delta", "916"}, //greek capital letter delta,U+0394 ISOgrk3 -->
{"Epsilon", "917"}, //greek capital letter epsilon, U+0395 -->
{"Zeta", "918"}, //greek capital letter zeta, U+0396 -->
{"Eta", "919"}, //greek capital letter eta, U+0397 -->
{"Theta", "920"}, //greek capital letter theta,U+0398 ISOgrk3 -->
{"Iota", "921"}, //greek capital letter iota, U+0399 -->
{"Kappa", "922"}, //greek capital letter kappa, U+039A -->
{"Lambda", "923"}, //greek capital letter lambda,U+039B ISOgrk3 -->
{"Mu", "924"}, //greek capital letter mu, U+039C -->
{"Nu", "925"}, //greek capital letter nu, U+039D -->
{"Xi", "926"}, //greek capital letter xi, U+039E ISOgrk3 -->
{"Omicron", "927"}, //greek capital letter omicron, U+039F -->
{"Pi", "928"}, //greek capital letter pi, U+03A0 ISOgrk3 -->
{"Rho", "929"}, //greek capital letter rho, U+03A1 -->
// <!-- there is no Sigmaf, and no U+03A2 character either -->
{"Sigma", "931"}, //greek capital letter sigma,U+03A3 ISOgrk3 -->
{"Tau", "932"}, //greek capital letter tau, U+03A4 -->
{"Upsilon", "933"}, //greek capital letter upsilon,U+03A5 ISOgrk3 -->
{"Phi", "934"}, //greek capital letter phi,U+03A6 ISOgrk3 -->
{"Chi", "935"}, //greek capital letter chi, U+03A7 -->
{"Psi", "936"}, //greek capital letter psi,U+03A8 ISOgrk3 -->
{"Omega", "937"}, //greek capital letter omega,U+03A9 ISOgrk3 -->
{"alpha", "945"}, //greek small letter alpha,U+03B1 ISOgrk3 -->
{"beta", "946"}, //greek small letter beta, U+03B2 ISOgrk3 -->
{"gamma", "947"}, //greek small letter gamma,U+03B3 ISOgrk3 -->
{"delta", "948"}, //greek small letter delta,U+03B4 ISOgrk3 -->
{"epsilon", "949"}, //greek small letter epsilon,U+03B5 ISOgrk3 -->
{"zeta", "950"}, //greek small letter zeta, U+03B6 ISOgrk3 -->
{"eta", "951"}, //greek small letter eta, U+03B7 ISOgrk3 -->
{"theta", "952"}, //greek small letter theta,U+03B8 ISOgrk3 -->
{"iota", "953"}, //greek small letter iota, U+03B9 ISOgrk3 -->
{"kappa", "954"}, //greek small letter kappa,U+03BA ISOgrk3 -->
{"lambda", "955"}, //greek small letter lambda,U+03BB ISOgrk3 -->
{"mu", "956"}, //greek small letter mu, U+03BC ISOgrk3 -->
{"nu", "957"}, //greek small letter nu, U+03BD ISOgrk3 -->
{"xi", "958"}, //greek small letter xi, U+03BE ISOgrk3 -->
{"omicron", "959"}, //greek small letter omicron, U+03BF NEW -->
{"pi", "960"}, //greek small letter pi, U+03C0 ISOgrk3 -->
{"rho", "961"}, //greek small letter rho, U+03C1 ISOgrk3 -->
{"sigmaf", "962"}, //greek small letter final sigma,U+03C2 ISOgrk3 -->
{"sigma", "963"}, //greek small letter sigma,U+03C3 ISOgrk3 -->
{"tau", "964"}, //greek small letter tau, U+03C4 ISOgrk3 -->
{"upsilon", "965"}, //greek small letter upsilon,U+03C5 ISOgrk3 -->
{"phi", "966"}, //greek small letter phi, U+03C6 ISOgrk3 -->
{"chi", "967"}, //greek small letter chi, U+03C7 ISOgrk3 -->
{"psi", "968"}, //greek small letter psi, U+03C8 ISOgrk3 -->
{"omega", "969"}, //greek small letter omega,U+03C9 ISOgrk3 -->
{"thetasym", "977"}, //greek small letter theta symbol,U+03D1 NEW -->
{"upsih", "978"}, //greek upsilon with hook symbol,U+03D2 NEW -->
{"piv", "982"}, //greek pi symbol, U+03D6 ISOgrk3 -->
// <!-- General Punctuation -->
{"bull", "8226"}, //bullet = black small circle,U+2022 ISOpub -->
// <!-- bullet is NOT the same as bullet operator, U+2219 -->
{"hellip", "8230"}, //horizontal ellipsis = three dot leader,U+2026 ISOpub -->
{"prime", "8242"}, //prime = minutes = feet, U+2032 ISOtech -->
{"Prime", "8243"}, //double prime = seconds = inches,U+2033 ISOtech -->
{"oline", "8254"}, //overline = spacing overscore,U+203E NEW -->
{"frasl", "8260"}, //fraction slash, U+2044 NEW -->
// <!-- Letterlike Symbols -->
{"weierp", "8472"}, //script capital P = power set= Weierstrass p, U+2118 ISOamso -->
{"image", "8465"}, //blackletter capital I = imaginary part,U+2111 ISOamso -->
{"real", "8476"}, //blackletter capital R = real part symbol,U+211C ISOamso -->
{"trade", "8482"}, //trade mark sign, U+2122 ISOnum -->
{"alefsym", "8501"}, //alef symbol = first transfinite cardinal,U+2135 NEW -->
// <!-- alef symbol is NOT the same as hebrew letter alef,U+05D0 although the
// same glyph could be used to depict both characters -->
// <!-- Arrows -->
{"larr", "8592"}, //leftwards arrow, U+2190 ISOnum -->
{"uarr", "8593"}, //upwards arrow, U+2191 ISOnum-->
{"rarr", "8594"}, //rightwards arrow, U+2192 ISOnum -->
{"darr", "8595"}, //downwards arrow, U+2193 ISOnum -->
{"harr", "8596"}, //left right arrow, U+2194 ISOamsa -->
{"crarr", "8629"}, //downwards arrow with corner leftwards= carriage return, U+21B5 NEW -->
{"lArr", "8656"}, //leftwards double arrow, U+21D0 ISOtech -->
// <!-- ISO 10646 does not say that lArr is the same as the 'is implied by'
// arrow but also does not have any other character for that function.
// So ? lArr canbe used for 'is implied by' as ISOtech suggests -->
{"uArr", "8657"}, //upwards double arrow, U+21D1 ISOamsa -->
{"rArr", "8658"}, //rightwards double arrow,U+21D2 ISOtech -->
// <!-- ISO 10646 does not say this is the 'implies' character but does not
// have another character with this function so ?rArr can be used for
// 'implies' as ISOtech suggests -->
{"dArr", "8659"}, //downwards double arrow, U+21D3 ISOamsa -->
{"hArr", "8660"}, //left right double arrow,U+21D4 ISOamsa -->
// <!-- Mathematical Operators -->
{"forall", "8704"}, //for all, U+2200 ISOtech -->
{"part", "8706"}, //partial differential, U+2202 ISOtech -->
{"exist", "8707"}, //there exists, U+2203 ISOtech -->
{"empty", "8709"}, //empty set = null set = diameter,U+2205 ISOamso -->
{"nabla", "8711"}, //nabla = backward difference,U+2207 ISOtech -->
{"isin", "8712"}, //element of, U+2208 ISOtech -->
{"notin", "8713"}, //not an element of, U+2209 ISOtech -->
{"ni", "8715"}, //contains as member, U+220B ISOtech -->
// <!-- should there be a more memorable name than 'ni'? -->
{"prod", "8719"}, //n-ary product = product sign,U+220F ISOamsb -->
// <!-- prod is NOT the same character as U+03A0 'greek capital letter pi'
// though the same glyph might be used for both -->
{"sum", "8721"}, //n-ary summation, U+2211 ISOamsb -->
// <!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
// though the same glyph might be used for both -->
{"minus", "8722"}, //minus sign, U+2212 ISOtech -->
{"lowast", "8727"}, //asterisk operator, U+2217 ISOtech -->
{"radic", "8730"}, //square root = radical sign,U+221A ISOtech -->
{"prop", "8733"}, //proportional to, U+221D ISOtech -->
{"infin", "8734"}, //infinity, U+221E ISOtech -->
{"ang", "8736"}, //angle, U+2220 ISOamso -->
{"and", "8743"}, //logical and = wedge, U+2227 ISOtech -->
{"or", "8744"}, //logical or = vee, U+2228 ISOtech -->
{"cap", "8745"}, //intersection = cap, U+2229 ISOtech -->
{"cup", "8746"}, //union = cup, U+222A ISOtech -->
{"int", "8747"}, //integral, U+222B ISOtech -->
{"there4", "8756"}, //therefore, U+2234 ISOtech -->
{"sim", "8764"}, //tilde operator = varies with = similar to,U+223C ISOtech -->
// <!-- tilde operator is NOT the same character as the tilde, U+007E,although
// the same glyph might be used to represent both -->
{"cong", "8773"}, //approximately equal to, U+2245 ISOtech -->
{"asymp", "8776"}, //almost equal to = asymptotic to,U+2248 ISOamsr -->
{"ne", "8800"}, //not equal to, U+2260 ISOtech -->
{"equiv", "8801"}, //identical to, U+2261 ISOtech -->
{"le", "8804"}, //less-than or equal to, U+2264 ISOtech -->
{"ge", "8805"}, //greater-than or equal to,U+2265 ISOtech -->
{"sub", "8834"}, //subset of, U+2282 ISOtech -->
{"sup", "8835"}, //superset of, U+2283 ISOtech -->
// <!-- note that nsup, 'not a superset of, U+2283' is not covered by the
// Symbol font encoding and is not included. Should it be, for symmetry?
// It is in ISOamsn --> <!ENTITY nsub", "8836"},
// not a subset of, U+2284 ISOamsn -->
{"sube", "8838"}, //subset of or equal to, U+2286 ISOtech -->
{"supe", "8839"}, //superset of or equal to,U+2287 ISOtech -->
{"oplus", "8853"}, //circled plus = direct sum,U+2295 ISOamsb -->
{"otimes", "8855"}, //circled times = vector product,U+2297 ISOamsb -->
{"perp", "8869"}, //up tack = orthogonal to = perpendicular,U+22A5 ISOtech -->
{"sdot", "8901"}, //dot operator, U+22C5 ISOamsb -->
// <!-- dot operator is NOT the same character as U+00B7 middle dot -->
// <!-- Miscellaneous Technical -->
{"lceil", "8968"}, //left ceiling = apl upstile,U+2308 ISOamsc -->
{"rceil", "8969"}, //right ceiling, U+2309 ISOamsc -->
{"lfloor", "8970"}, //left floor = apl downstile,U+230A ISOamsc -->
{"rfloor", "8971"}, //right floor, U+230B ISOamsc -->
{"lang", "9001"}, //left-pointing angle bracket = bra,U+2329 ISOtech -->
// <!-- lang is NOT the same character as U+003C 'less than' or U+2039 'single left-pointing angle quotation mark' -->
{"rang", "9002"}, //right-pointing angle bracket = ket,U+232A ISOtech -->
// <!-- rang is NOT the same character as U+003E 'greater than' or U+203A
// 'single right-pointing angle quotation mark' -->
// <!-- Geometric Shapes -->
{"loz", "9674"}, //lozenge, U+25CA ISOpub -->
// <!-- Miscellaneous Symbols -->
{"spades", "9824"}, //black spade suit, U+2660 ISOpub -->
// <!-- black here seems to mean filled as opposed to hollow -->
{"clubs", "9827"}, //black club suit = shamrock,U+2663 ISOpub -->
{"hearts", "9829"}, //black heart suit = valentine,U+2665 ISOpub -->
{"diams", "9830"}, //black diamond suit, U+2666 ISOpub -->
// <!-- Latin Extended-A -->
{"OElig", "338"}, // -- latin capital ligature OE,U+0152 ISOlat2 -->
{"oelig", "339"}, // -- latin small ligature oe, U+0153 ISOlat2 -->
// <!-- ligature is a misnomer, this is a separate character in some languages -->
{"Scaron", "352"}, // -- latin capital letter S with caron,U+0160 ISOlat2 -->
{"scaron", "353"}, // -- latin small letter s with caron,U+0161 ISOlat2 -->
{"Yuml", "376"}, // -- latin capital letter Y with diaeresis,U+0178 ISOlat2 -->
// <!-- Spacing Modifier Letters -->
{"circ", "710"}, // -- modifier letter circumflex accent,U+02C6 ISOpub -->
{"tilde", "732"}, //small tilde, U+02DC ISOdia -->
// <!-- General Punctuation -->
{"ensp", "8194"}, //en space, U+2002 ISOpub -->
{"emsp", "8195"}, //em space, U+2003 ISOpub -->
{"thinsp", "8201"}, //thin space, U+2009 ISOpub -->
{"zwnj", "8204"}, //zero width non-joiner,U+200C NEW RFC 2070 -->
{"zwj", "8205"}, //zero width joiner, U+200D NEW RFC 2070 -->
{"lrm", "8206"}, //left-to-right mark, U+200E NEW RFC 2070 -->
{"rlm", "8207"}, //right-to-left mark, U+200F NEW RFC 2070 -->
{"ndash", "8211"}, //en dash, U+2013 ISOpub -->
{"mdash", "8212"}, //em dash, U+2014 ISOpub -->
{"lsquo", "8216"}, //left single quotation mark,U+2018 ISOnum -->
{"rsquo", "8217"}, //right single quotation mark,U+2019 ISOnum -->
{"sbquo", "8218"}, //single low-9 quotation mark, U+201A NEW -->
{"ldquo", "8220"}, //left double quotation mark,U+201C ISOnum -->
{"rdquo", "8221"}, //right double quotation mark,U+201D ISOnum -->
{"bdquo", "8222"}, //double low-9 quotation mark, U+201E NEW -->
{"dagger", "8224"}, //dagger, U+2020 ISOpub -->
{"Dagger", "8225"}, //double dagger, U+2021 ISOpub -->
{"permil", "8240"}, //per mille sign, U+2030 ISOtech -->
{"lsaquo", "8249"}, //single left-pointing angle quotation mark,U+2039 ISO proposed -->
// <!-- lsaquo is proposed but not yet ISO standardized -->
{"rsaquo", "8250"}, //single right-pointing angle quotation mark,U+203A ISO proposed -->
// <!-- rsaquo is proposed but not yet ISO standardized -->
{"euro", "8364"}, // -- euro sign, U+20AC NEW -->
};
/**
* <p>The set of entities supported by standard XML.</p>
*/
public static final Entities XML;
/**
* <p>The set of entities supported by HTML 3.2.</p>
*/
public static final Entities HTML32;
/**
* <p>The set of entities supported by HTML 4.0.</p>
*/
public static final Entities HTML40;
static {
XML = new Entities();
XML.addEntities(BASIC_ARRAY);
XML.addEntities(APOS_ARRAY);
}
static {
HTML32 = new Entities();
HTML32.addEntities(BASIC_ARRAY);
HTML32.addEntities(ISO8859_1_ARRAY);
}
static {
HTML40 = new Entities();
fillWithHtml40Entities(HTML40);
}
/**
* <p>Fills the specified entities instance with HTML 40 entities.</p>
*
* @param entities the instance to be filled.
*/
static void fillWithHtml40Entities(Entities entities) {
entities.addEntities(BASIC_ARRAY);
entities.addEntities(ISO8859_1_ARRAY);
entities.addEntities(HTML40_ARRAY);
}
static interface EntityMap {
/**
* <p>Add an entry to this entity map.</p>
*
* @param name the entity name
* @param value the entity value
*/
void add(String name, int value);
/**
* <p>Returns the name of the entity identified by the specified value.</p>
*
* @param value the value to locate
* @return entity name associated with the specified value
*/
String name(int value);
/**
* <p>Returns the value of the entity identified by the specified name.</p>
*
* @param name the name to locate
* @return entity value associated with the specified name
*/
int value(String name);
}
static class PrimitiveEntityMap implements EntityMap {
private Map<String, Integer> mapNameToValue = new HashMap<String, Integer>();
private Map<Integer, String> mapValueToName = new HashMap<Integer, String>();
/**
* {@inheritDoc}
*/
public void add(String name, int value) {
mapNameToValue.put(name, new Integer(value));
mapValueToName.put(new Integer(value), name);
}
/**
* {@inheritDoc}
*/
public String name(int value) {
return mapValueToName.get(new Integer(value));
}
/**
* {@inheritDoc}
*/
public int value(String name) {
Integer value = mapNameToValue.get(name);
if (value == null) {
return -1;
}
return value.intValue();
}
}
static abstract class MapIntMap implements Entities.EntityMap {
protected Map<String, Integer> mapNameToValue;
protected Map<Integer, String> mapValueToName;
/**
* {@inheritDoc}
*/
public void add(String name, int value) {
mapNameToValue.put(name, new Integer(value));
mapValueToName.put(new Integer(value), name);
}
/**
* {@inheritDoc}
*/
public String name(int value) {
return mapValueToName.get(new Integer(value));
}
/**
* {@inheritDoc}
*/
public int value(String name) {
Integer value = mapNameToValue.get(name);
if (value == null) {
return -1;
}
return value.intValue();
}
}
static class HashEntityMap extends MapIntMap {
/**
* Constructs a new instance of <code>HashEntityMap</code>.
*/
public HashEntityMap() {
mapNameToValue = new HashMap<String, Integer>();
mapValueToName = new HashMap<Integer, String>();
}
}
static class TreeEntityMap extends MapIntMap {
/**
* Constructs a new instance of <code>TreeEntityMap</code>.
*/
public TreeEntityMap() {
mapNameToValue = new TreeMap<String, Integer>();
mapValueToName = new TreeMap<Integer, String>();
}
}
static class LookupEntityMap extends PrimitiveEntityMap {
private String[] lookupTable;
private int LOOKUP_TABLE_SIZE = 256;
/**
* {@inheritDoc}
*/
@Override
public String name(int value) {
if (value < LOOKUP_TABLE_SIZE) {
return lookupTable()[value];
}
return super.name(value);
}
/**
* <p>Returns the lookup table for this entity map. The lookup table is created if it has not been
* previously.</p>
*
* @return the lookup table
*/
private String[] lookupTable() {
if (lookupTable == null) {
createLookupTable();
}
return lookupTable;
}
/**
* <p>Creates an entity lookup table of LOOKUP_TABLE_SIZE elements, initialized with entity names.</p>
*/
private void createLookupTable() {
lookupTable = new String[LOOKUP_TABLE_SIZE];
for (int i = 0; i < LOOKUP_TABLE_SIZE; ++i) {
lookupTable[i] = super.name(i);
}
}
}
static class ArrayEntityMap implements EntityMap {
protected int growBy = 100;
protected int size = 0;
protected String[] names;
protected int[] values;
/**
* Constructs a new instance of <code>ArrayEntityMap</code>.
*/
public ArrayEntityMap() {
names = new String[growBy];
values = new int[growBy];
}
/**
* Constructs a new instance of <code>ArrayEntityMap</code>
* specifying the size by which the array should grow.
*
* @param growBy array will be initialized to and will grow by this amount
*/
public ArrayEntityMap(int growBy) {
this.growBy = growBy;
names = new String[growBy];
values = new int[growBy];
}
/**
* {@inheritDoc}
*/
public void add(String name, int value) {
ensureCapacity(size + 1);
names[size] = name;
values[size] = value;
size++;
}
/**
* Verifies the capacity of the entity array, adjusting the size if necessary.
*
* @param capacity size the array should be
*/
protected void ensureCapacity(int capacity) {
if (capacity > names.length) {
int newSize = Math.max(capacity, size + growBy);
String[] newNames = new String[newSize];
System.arraycopy(names, 0, newNames, 0, size);
names = newNames;
int[] newValues = new int[newSize];
System.arraycopy(values, 0, newValues, 0, size);
values = newValues;
}
}
/**
* {@inheritDoc}
*/
public String name(int value) {
for (int i = 0; i < size; ++i) {
if (values[i] == value) {
return names[i];
}
}
return null;
}
/**
* {@inheritDoc}
*/
public int value(String name) {
for (int i = 0; i < size; ++i) {
if (names[i].equals(name)) {
return values[i];
}
}
return -1;
}
}
static class BinaryEntityMap extends ArrayEntityMap {
/**
* Constructs a new instance of <code>BinaryEntityMap</code>.
*/
public BinaryEntityMap() {
super();
}
/**
* Constructs a new instance of <code>ArrayEntityMap</code>
* specifying the size by which the underlying array should grow.
*
* @param growBy array will be initialized to and will grow by this amount
*/
public BinaryEntityMap(int growBy) {
super(growBy);
}
/**
* Performs a binary search of the entity array for the specified key.
* This method is based on code in {@link java.util.Arrays}.
*
* @param key the key to be found
* @return the index of the entity array matching the specified key
*/
private int binarySearch(int key) {
int low = 0;
int high = size - 1;
while (low <= high) {
int mid = (low + high) >> 1;
int midVal = values[mid];
if (midVal < key) {
low = mid + 1;
} else if (midVal > key) {
high = mid - 1;
} else {
return mid; // key found
}
}
return -(low + 1); // key not found.
}
/**
* {@inheritDoc}
*/
@Override
public void add(String name, int value) {
ensureCapacity(size + 1);
int insertAt = binarySearch(value);
if (insertAt > 0) {
return; // note: this means you can't insert the same value twice
}
insertAt = -(insertAt + 1); // binarySearch returns it negative and off-by-one
System.arraycopy(values, insertAt, values, insertAt + 1, size - insertAt);
values[insertAt] = value;
System.arraycopy(names, insertAt, names, insertAt + 1, size - insertAt);
names[insertAt] = name;
size++;
}
/**
* {@inheritDoc}
*/
@Override
public String name(int value) {
int index = binarySearch(value);
if (index < 0) {
return null;
}
return names[index];
}
}
// package scoped for testing
EntityMap map = new Entities.LookupEntityMap();
/**
* <p>Adds entities to this entity.</p>
*
* @param entityArray array of entities to be added
*/
public void addEntities(String[][] entityArray) {
for (int i = 0; i < entityArray.length; ++i) {
addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1]));
}
}
/**
* <p>Add an entity to this entity.</p>
*
* @param name name of the entity
* @param value vale of the entity
*/
public void addEntity(String name, int value) {
map.add(name, value);
}
/**
* <p>Returns the name of the entity identified by the specified value.</p>
*
* @param value the value to locate
* @return entity name associated with the specified value
*/
public String entityName(int value) {
return map.name(value);
}
/**
* <p>Returns the value of the entity identified by the specified name.</p>
*
* @param name the name to locate
* @return entity value associated with the specified name
*/
public int entityValue(String name) {
return map.value(name);
}
/**
* <p>Escapes the characters in a <code>String</code>.</p>
*
* <p>For example, if you have called addEntity("foo", 0xA1),
* escape("\u00A1") will return "&foo;"</p>
*
* @param str The <code>String</code> to escape.
* @return A new escaped <code>String</code>.
*/
public String escape(String str) {
//todo: rewrite to use a Writer
StringBuffer buf = new StringBuffer(str.length() * 2);
int i;
for (i = 0; i < str.length(); ++i) {
char ch = str.charAt(i);
String entityName = this.entityName(ch);
if (entityName == null) {
if (ch > 0x7F) {
int intValue = ch;
buf.append("&#");
buf.append(intValue);
buf.append(';');
} else {
buf.append(ch);
}
} else {
buf.append('&');
buf.append(entityName);
buf.append(';');
}
}
return buf.toString();
}
/**
* <p>Escapes the characters in the <code>String</code> passed and writes the result
* to the <code>Writer</code> passed. </p>
*
* @param writer The <code>Writer</code> to write the results of the escaping to.
* Assumed to be a non-null value.
* @param str The <code>String</code> to escape. Assumed to be a non-null value.
* @throws IOException when <code>Writer</code> passed throws the exception from
* calls to the {@link Writer#write(int)} methods.
*
* @see #escape(String)
* @see Writer
*/
public void escape(Writer writer, String str) throws IOException {
int len = str.length();
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
String entityName = this.entityName(c);
if (entityName == null) {
if (c > 0x7F) {
writer.write("&#");
writer.write(Integer.toString(c, 10));
writer.write(';');
} else {
writer.write(c);
}
} else {
writer.write('&');
writer.write(entityName);
writer.write(';');
}
}
}
/**
* <p>Unescapes the entities in a <code>String</code>.</p>
*
* <p>For example, if you have called addEntity("foo", 0xA1),
* unescape("&foo;") will return "\u00A1"</p>
*
* @param str The <code>String</code> to escape.
* @return A new escaped <code>String</code>.
*/
public String unescape(String str) {
StringBuffer buf = new StringBuffer(str.length());
int i;
for (i = 0; i < str.length(); ++i) {
char ch = str.charAt(i);
if (ch == '&') {
int semi = str.indexOf(';', i + 1);
if (semi == -1) {
buf.append(ch);
continue;
}
String entityName = str.substring(i + 1, semi);
int entityValue;
if (entityName.length() == 0) {
entityValue = -1;
} else if (entityName.charAt(0) == '#') {
if (entityName.length() == 1) {
entityValue = -1;
} else {
char charAt1 = entityName.charAt(1);
try {
if (charAt1 == 'x' || charAt1=='X') {
entityValue = Integer.valueOf(entityName.substring(2), 16).intValue();
} else {
entityValue = Integer.parseInt(entityName.substring(1));
}
} catch (NumberFormatException ex) {
entityValue = -1;
}
}
} else {
entityValue = this.entityValue(entityName);
}
if (entityValue == -1) {
buf.append('&');
buf.append(entityName);
buf.append(';');
} else {
buf.append((char) (entityValue));
}
i = semi;
} else {
buf.append(ch);
}
}
return buf.toString();
}
/**
* <p>Unescapes the escaped entities in the <code>String</code> passed and
* writes the result to the <code>Writer</code> passed.</p>
*
* @param writer The <code>Writer</code> to write the results to; assumed to be non-null.
* @param string The <code>String</code> to write the results to; assumed to be non-null.
* @throws IOException when <code>Writer</code> passed throws the exception from
* calls to the {@link Writer#write(int)} methods.
*
* @see #escape(String)
* @see Writer
*/
public void unescape(Writer writer, String string) throws IOException {
int len = string.length();
if (len == 0) {
return;
}
for (int i = 0; i < len; i++) {
char c = string.charAt(i);
if (c == '&') {
int nextIdx = i+1;
int semiColonIdx = string.indexOf(';', nextIdx);
if (semiColonIdx == -1) {
writer.write(c);
continue;
}
String entityContent = string.substring(nextIdx, semiColonIdx);
int entityValue = -1;
int entityContentLen = entityContent.length();
if (entityContentLen > 0) {
if (entityContent.charAt(0) == '#') { //escaped value content is an integer (decimal or hexidecimal)
if (entityContentLen > 1) {
char isHexChar = entityContent.charAt(1);
try {
switch (isHexChar) {
case 'X' :
case 'x' : {
entityValue = Integer.parseInt(entityContent.substring(2), 16);
}
default : {
entityValue = Integer.parseInt(entityContent.substring(1), 10);
}
}
} catch (NumberFormatException e) {
// ignore the escaped value content
}
}
} else { //escaped value content is an entity name
entityValue = this.entityValue(entityContent);
}
}
if (entityValue == -1) {
writer.write('&');
writer.write(entityContent);
writer.write(';');
} else {
writer.write(entityValue);
}
i = semiColonIdx; //move index up to the semi-colon
} else {
writer.write(c);
}
}
}
}
|
[
"mschrag@930f2ab1-3212-0410-a8ea-d1eb4cc50a93"
] |
mschrag@930f2ab1-3212-0410-a8ea-d1eb4cc50a93
|
0ec1fe475b3cb6a885582c4db8670dfccf3a09f1
|
de7453cd7f99ef132a8f07ae4d8810260052f8e2
|
/src/com/rainbow/es/test/ESTools.java
|
a20d328ccc0a257aecbba0aa7ffcde98b872ff17
|
[] |
no_license
|
Xjun-j/rainbow
|
5e73461e05872feef06e4c965a5886643a5b8913
|
b431ed3c308c967e362e1716aea2f2333c4bfdfb
|
refs/heads/master
| 2021-01-18T03:35:05.840030 | 2017-03-22T09:23:30 | 2017-03-22T09:23:30 | 85,808,361 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,097 |
java
|
package com.rainbow.es.test;
import java.net.InetAddress;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
public class ESTools {
public final static Client client = build();
/**
* 创建一次
* @return
*/
private static Client build(){
if(null != client){
return client;
}
Client client = null;
String ip = "192.168.1.250";
try {
Settings settings = Settings
.settingsBuilder()
.put("cluster.name","sojson-application")
.put("client.transport.sniff", true)
.build();
client = TransportClient.builder().settings(settings).build()
.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(ip), 9300));
} catch (Exception e) {
}
return client;
}
/**
* 关闭
*/
public static void close(){
if(null != client){
try {
client.close();
} catch (Exception e) {
}
}
}
}
|
[
"[email protected]"
] | |
d041893c064514d2fcbf1aefb4855f1983a5eba5
|
5122a4619b344c36bfc969283076c12419f198ea
|
/src/test/java/com/snapwiz/selenium/tests/staf/learningspaces/testcases/IT15/R1593/HidingPerspectiveAsStudentForDWAssignmentWithGradeReleased.java
|
1bba97bac0c1e2f206174e58d4e009f4a24c0555
|
[] |
no_license
|
mukesh89m/automation
|
0c1e8ff4e38e8e371cc121e64aacc6dc91915d3a
|
a0b4c939204af946cf7ca7954097660b2a0dfa8d
|
refs/heads/master
| 2020-05-18T15:30:22.681006 | 2018-06-09T15:14:11 | 2018-06-09T15:14:11 | 32,666,214 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,579 |
java
|
package com.snapwiz.selenium.tests.staf.learningspaces.testcases.IT15.R1593;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.Click;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.MouseHover;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.snapwiz.selenium.tests.staf.learningspaces.Driver;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.DiscussionWidget;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.LoginUsingLTI;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.Navigator;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.RandomString;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.Screenshot;
import com.snapwiz.selenium.tests.staf.learningspaces.apphelper.TopicOpen;
import com.snapwiz.selenium.tests.staf.learningspaces.uihelper.TabClose;
public class HidingPerspectiveAsStudentForDWAssignmentWithGradeReleased extends Driver{
@Test
public void hidingPerspectiveAsStudentForDWAssignmentWithGradeReleased()
{
try
{
String perspective = new RandomString().randomstring(5);
new LoginUsingLTI().ltiLogin("170_1"); //create a student
new LoginUsingLTI().ltiLogin("170"); //login as instructor
new Navigator().NavigateTo("eTextbook"); //navigate to etextbook
new TopicOpen().openLessonWithDiscussionWidget();
new DiscussionWidget().assignDiscussionWidgetWithDefaultClassSection(170);
new LoginUsingLTI().ltiLogin("170_1"); //login as student
new Navigator().NavigateTo("Assignments"); //navigate to Assignments
driver.findElement(By.className("ls-stream-learing-activity-level")).click(); //click on DW assignment
Thread.sleep(2000);
new DiscussionWidget().addPerspectiveForDWAssignment(perspective);
new LoginUsingLTI().ltiLogin("170"); //login as instructor
new Navigator().NavigateTo("Assignments"); //navigate to Assignments
driver.findElement(By.className("ls-grade-book-assessment")).click(); //click on View Student Responses
Thread.sleep(3000);
new MouseHover().mouserhover("idb-question-manually-graded");
new WebDriverWait(driver,240).until(ExpectedConditions.presenceOfElementLocated(By.className("ls-view-response-link")));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.className("ls-view-response-link"))); //click on View Responses
Thread.sleep(2000);
driver.findElement(By.id("view-user-question-performance-feedback-box")).sendKeys("This is a FeedbackText"); //provide a feedback
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.className("view-user-discussion-performance-save-btn")));//click on save button
Thread.sleep(2000);
new TabClose().tabClose(2); //close the feedback tab
driver.findElement(By.cssSelector("div[class='idb-gradeBook-grades-section-release idb-gradeBook-release-grades-section idb-gradeBook-grades-release']")).click();//release the grades
Thread.sleep(2000);
new LoginUsingLTI().ltiLogin("170_1"); //login as student
new Navigator().NavigateTo("Assignments"); //navigate to Assignments
driver.findElement(By.className("ls-stream-learing-activity-level")).click(); //click on DW assignment
Thread.sleep(2000);
WebDriverWait wait=new WebDriverWait(driver,3500);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("a[class='ls-content-post__footer-perspective-link js-toggle-comments']")));
new Click().clickBycssselector("a[class='ls-content-post__footer-perspective-link js-toggle-comments']"); //click on the perspective
new Click().clickByclassname("navigate-to-jump-out-icon"); //clickon the enter submission
Thread.sleep(4500);
new DiscussionWidget().clickOnArrowIconForPerspective(0, 0);//click on arrow of Perspective //TC row no. 170
Thread.sleep(3000);
//TC row no. 171
boolean removePerspective= new DiscussionWidget().removePerspectiveTextVerify();
if(removePerspective == false)
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("\"Remove Perspective\" option is not there for student's own perspective after the grade is relesed for the DW.");
}
new DiscussionWidget().removePerspective(0, 0);//click on Remove Perspective
//TC row no. 172
String perspective1 = driver.findElement(By.className("ls-comment-entry")).getText();
System.out.println("perspective1: "+perspective1);
if(perspective1.contains(perspective))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("After clicking Remove Perspective for DW assignemnt whose grade has been released the perspective doesnt get removed.");
}
//TC row no. 172
String messageText = driver.findElement(By.className("removed-perspective-block")).getText();
if(!messageText.contains("This perspective has been removed."))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("After clicking Remove Perspective for DW assignemnt whose grade has been released the message for removal of perspective doesnt appear.");
}
//TC row no. 173
int feedbackText = driver.findElements(By.cssSelector("div[class='ls-comment-entry ls-feedback-comment']")).size();
if(feedbackText == 0)
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("After removing the perspective for DW the feedback text also disappears.");
}
new Navigator().NavigateTo("Assignments"); //navigate to Assignments
//TC row no. 174
String status = driver.findElement(By.className("ls-assignment-status")).getText();
if(!status.contains("Score"))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("After removing the perspective for DW assignment whose grade has been released the status doesnt remain \"Score\" in student side.");
}
new LoginUsingLTI().ltiLogin("170"); //login as instructor
new Navigator().NavigateTo("Assignments"); //navigate to Assignments
//TC row no. 175
String status1 = driver.findElement(By.className("ls-assignment-status")).getText();
if(!status1.contains("Graded"))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("After removing the perspective for DW whose grade has been released the status doesnt remain Graded in instructor side.");
}
driver.findElement(By.className("ls-grade-book-assessment")).click(); //click on View Student Responses
Thread.sleep(2000);
new MouseHover().mouserhover("idb-question-feedback-icon");
new WebDriverWait(driver,240).until(ExpectedConditions.presenceOfElementLocated(By.className("ls-view-response-link")));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", driver.findElement(By.className("ls-view-response-link"))); //click on View Responses
Thread.sleep(2000);
//TC row no. 176
int perspective2 = driver.findElements(By.className("ls-comment-entry")).size();
if(perspective2 == 0)
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("In gradebook page of DW assignment whose grade has been released the hidden perspectives are not shown.");
}
//TC row no. 177
String visualIndicator = driver.findElement(By.className("ls-perspective-visual-indicator")).getCssValue("background-image");
if(!visualIndicator.contains("perspective-visual-indicator.png"))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("In gradebook page of DW assignment whose grade has been released the visual indicator is not shown for hidden perspectives.");
}
//TC row no. 178
String perspectiveCount = driver.findElement(By.cssSelector("a[title='Perspectives']")).getText();
if(!perspectiveCount.contains("1"))
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("In gradebook page of DW assignment whose grade has been released the perspective count changes if the student removes his perspective.");
}
}
catch(Exception e)
{
new Screenshot().captureScreenshotFromTestCase();
Assert.fail("Exception in testcase hidingPerspectiveAsStudentForDWAssignmentWithGradeReleased in class HidingPerspectiveAsStudentForDWAssignmentWithGradeReleased",e);
}
}
}
|
[
"[email protected]"
] | |
b128779c632d7e675265376224c6a6e138dd2586
|
7a6a2800e3f9dbb0144cfa62d9d86a9842113b13
|
/sdk/eventhubs/azure-messaging-eventhubs-stress/src/main/java/com/azure/messaging/eventhubs/stress/scenarios/EventProcessorWithOptions.java
|
46e591fd6282e7f9de0fd134c22aa88af1ca6dab
|
[
"LGPL-2.1-or-later",
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
joshfree/azure-sdk-for-java
|
3f5d2cacee44d9bf8c0b16a4bbd54065e20a55cd
|
d96d0333112997b0ee5aa03aacfad2d0b0e7d1d4
|
refs/heads/main
| 2022-11-08T18:41:42.079175 | 2022-11-04T22:38:22 | 2022-11-04T22:38:22 | 298,635,515 | 0 | 0 |
MIT
| 2020-09-25T17:15:28 | 2020-09-25T17:15:27 | null |
UTF-8
|
Java
| false | false | 11,740 |
java
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.messaging.eventhubs.stress.scenarios;
import com.azure.core.util.logging.ClientLogger;
import com.azure.messaging.eventhubs.EventData;
import com.azure.messaging.eventhubs.EventHubClientBuilder;
import com.azure.messaging.eventhubs.EventHubConsumerClient;
import com.azure.messaging.eventhubs.EventHubProducerClient;
import com.azure.messaging.eventhubs.EventProcessorClient;
import com.azure.messaging.eventhubs.EventProcessorClientBuilder;
import com.azure.messaging.eventhubs.LoadBalancingStrategy;
import com.azure.messaging.eventhubs.checkpointstore.blob.BlobCheckpointStore;
import com.azure.messaging.eventhubs.models.ErrorContext;
import com.azure.messaging.eventhubs.models.EventBatchContext;
import com.azure.messaging.eventhubs.models.EventContext;
import com.azure.messaging.eventhubs.models.EventPosition;
import com.azure.storage.blob.BlobContainerAsyncClient;
import com.azure.storage.blob.BlobContainerClientBuilder;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
/**
* Process events with options from application arguments.
* <p>
* Support options:
* <pre>
* --UPDATE_CHECKPOINT boolean
* --NEED_SEND_EVENT_HUB boolean
* --RECEIVE_BATCH_SIZE int
* --RECEIVE_BATCH_TIMEOUT int
* </pre>
*/
@Service("EventProcessorWithOptions")
public class EventProcessorWithOptions extends EventHubsScenario {
private static final ClientLogger LOGGER = new ClientLogger(EventProcessorWithOptions.class);
private static final int PARTITION_NUMBER = 64;
private static final int EVENT_COUNT_THRESHOLD = 40;
private static final int ONE_SECOND_IN_NANO = 1000000000;
@Override
public void run() {
final String storageConnStr = options.getStorageConnectionString();
final String containerName = options.getStorageContainerName();
final String eventHubConnStr = options.getEventhubsConnectionString();
final String eventHub = options.getEventhubsEventHubName();
final String consumerGroup = options.getEventHubsConsumerGroup();
final boolean updateCheckpoint = options.isUpdateCheckpoint();
final boolean needSendEventHub = options.isNeedSendEventHub();
final String writeEventHub = options.getSecondEventhubsEventHubName();
EventHubProducerClient producerClient = new EventHubClientBuilder()
.connectionString(eventHubConnStr, writeEventHub)
.buildProducerClient();
final int batchSize = options.getReceiveBatchSize();
final int batchTimeoutMs = options.getReceiveBatchTimeout();
final int[] eventCounter = new int[PARTITION_NUMBER];
final List<ArrayList<EventData>> eventsFromPartitions = new ArrayList<>(PARTITION_NUMBER);
for (int i = 0; i < PARTITION_NUMBER; i++) {
eventsFromPartitions.add(new ArrayList<>(EVENT_COUNT_THRESHOLD));
}
Consumer<EventContext> processEvent = eventContext -> {
logEvent("Processing", eventContext);
if (updateCheckpoint) {
final int partitionIndex = Integer.parseInt(eventContext.getPartitionContext().getPartitionId());
eventsFromPartitions.get(partitionIndex).add(new EventData(eventContext.getEventData().getBody()));
eventCounter[partitionIndex]++;
if (eventCounter[partitionIndex] >= EVENT_COUNT_THRESHOLD) {
eventCounter[partitionIndex] = 0;
try {
long startTime = System.nanoTime();
eventContext.updateCheckpointAsync().block(Duration.ofSeconds(3));
long endTime = System.nanoTime();
if (needSendEventHub) {
producerClient.send(eventsFromPartitions.get(partitionIndex));
}
if (endTime - startTime > ONE_SECOND_IN_NANO) {
trackEvent(eventContext, startTime, endTime);
}
} catch (Throwable t) {
logEventError(eventContext, t);
}
}
}
trackMetric(eventContext);
logEvent("Processed", eventContext);
};
Consumer<EventBatchContext> processEventBatch = eventContext -> {
if (eventContext.getEvents().size() > 0) {
logEvent("Processing", eventContext);
if (updateCheckpoint) {
eventContext.updateCheckpoint();
}
trackMetric(eventContext);
logEvent("Processed", eventContext);
}
};
Consumer<ErrorContext> processError = errorContext -> {
LOGGER.error("Error while processing {}, {}, {}, {}",
errorContext.getPartitionContext().getEventHubName(),
errorContext.getPartitionContext().getConsumerGroup(),
errorContext.getPartitionContext().getPartitionId(),
getStackTrace(errorContext.getThrowable()));
telemetryClient.trackException(new Exception(errorContext.getThrowable()),
new HashMap<String, String>() {{
put("EventHub", errorContext.getPartitionContext().getEventHubName());
put("ConsumerGroup", errorContext.getPartitionContext().getConsumerGroup());
put("Partition", errorContext.getPartitionContext().getPartitionId());
put("ErrorTime", Instant.now().toString());
}}, null);
};
BlobContainerAsyncClient blobContainerAsyncClient = new BlobContainerClientBuilder()
.connectionString(storageConnStr)
.containerName(containerName)
.buildAsyncClient();
BlobCheckpointStore checkpointStore = new BlobCheckpointStore(blobContainerAsyncClient);
Map<String, EventPosition> initialPositions = new HashMap<>();
final int partitionCount = getNumberOfPartitions(eventHubConnStr, eventHub, consumerGroup);
for (int i = 0; i < partitionCount; i++) {
initialPositions.put(String.valueOf(i), EventPosition.earliest());
}
final EventProcessorClientBuilder eventProcessorClientBuilder = new EventProcessorClientBuilder()
.consumerGroup(consumerGroup)
.connectionString(eventHubConnStr, eventHub)
.loadBalancingStrategy(LoadBalancingStrategy.GREEDY)
.initialPartitionEventPosition(initialPositions)
.processError(processError)
.checkpointStore(checkpointStore);
if (batchSize != 0 && batchTimeoutMs != 0) {
eventProcessorClientBuilder.processEventBatch(processEventBatch, batchSize,
Duration.ofMillis(batchTimeoutMs));
} else if (batchSize != 0) {
eventProcessorClientBuilder.processEventBatch(processEventBatch, batchSize);
} else {
eventProcessorClientBuilder.processEvent(processEvent);
}
EventProcessorClient eventProcessorClient = eventProcessorClientBuilder.buildEventProcessorClient();
eventProcessorClient.start();
}
private void logEvent(String status, EventContext eventContext) {
LOGGER.verbose(
status + " event: Event Hub name = {}; consumer group name = {}; " +
"partition id = {}; sequence number = {}; offset = {}, enqueued time = {}",
eventContext.getPartitionContext().getEventHubName(),
eventContext.getPartitionContext().getConsumerGroup(),
eventContext.getPartitionContext().getPartitionId(),
eventContext.getEventData().getSequenceNumber(),
eventContext.getEventData().getOffset(),
eventContext.getEventData().getEnqueuedTime()
);
}
private void logEvent(String status, EventBatchContext eventContext) {
LOGGER.verbose(
status + " event: Event Hub name = {}; consumer group name = {};" +
" partition id = {}; last sequence number = {}, batch size = {}",
eventContext.getPartitionContext().getEventHubName(),
eventContext.getPartitionContext().getConsumerGroup(),
eventContext.getPartitionContext().getPartitionId(),
eventContext.getEvents().get(eventContext.getEvents().size() - 1).getSequenceNumber(),
eventContext.getEvents().size());
}
private void logEventError(EventContext eventContext, Throwable t) {
LOGGER.verbose(
"Checkpoint update failed: Event Hub name = {}; consumer group name = {};" +
" partition id = {}; sequence number = {}; offset = {}, enqueued time = {}, error = {}",
eventContext.getPartitionContext().getEventHubName(),
eventContext.getPartitionContext().getConsumerGroup(),
eventContext.getPartitionContext().getPartitionId(),
eventContext.getEventData().getSequenceNumber(),
eventContext.getEventData().getOffset(),
eventContext.getEventData().getEnqueuedTime(),
getStackTrace(t));
}
private void trackEvent(EventContext eventContext, long startTime, long endTime) {
telemetryClient.trackEvent("updateCheckpoint takes long",
new HashMap<String, String>() {{
put("Namespace", eventContext.getPartitionContext().getFullyQualifiedNamespace());
put("EventHub", eventContext.getPartitionContext().getEventHubName());
put("ConsumerGroup", eventContext.getPartitionContext().getConsumerGroup());
put("Partition", eventContext.getPartitionContext().getPartitionId());
put("TimeElapsed", String.valueOf(endTime - startTime));
}}, null);
}
private void trackMetric(EventContext eventContext) {
String metricKey = String.format("%s/%s/%s/%s",
eventContext.getPartitionContext().getFullyQualifiedNamespace(),
eventContext.getPartitionContext().getEventHubName(),
eventContext.getPartitionContext().getConsumerGroup(),
eventContext.getPartitionContext().getPartitionId()
);
rateMeter.add(metricKey, 1);
}
private void trackMetric(EventBatchContext eventContext) {
String metricKey = String.format("%s/%s/%s/%s",
eventContext.getPartitionContext().getFullyQualifiedNamespace(),
eventContext.getPartitionContext().getEventHubName(),
eventContext.getPartitionContext().getConsumerGroup(),
eventContext.getPartitionContext().getPartitionId()
);
rateMeter.add(metricKey, 1);
}
private int getNumberOfPartitions(String connectionString, String eventHub, String consumerGroup) {
try (EventHubConsumerClient consumerClient = new EventHubClientBuilder()
.connectionString(connectionString, eventHub)
.consumerGroup(consumerGroup)
.buildConsumerClient()) {
return (int) consumerClient.getEventHubProperties().getPartitionIds().stream().count();
}
}
private String getStackTrace(Throwable throwable) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
throwable.printStackTrace(pw);
return sw.getBuffer().toString();
}
}
|
[
"[email protected]"
] | |
af4cacc843b997c32ca9dc04536ddb53ce04696e
|
c998a1bb4ccc5d49fe36ef934500a740d5aefbf5
|
/src/main/java/com/myapp/entity/ec/budget/BudgetingDetailInfo.java
|
101141c0524f10fdba461de1e3fa1f3157b8607e
|
[] |
no_license
|
cqMySong/myapp
|
181d5e16f607a07f48cf40bff61068dac673bebe
|
77db2d414388ef6a6965d606c732b63ee4e2d59e
|
refs/heads/master
| 2021-01-20T13:22:21.488675 | 2018-06-19T14:55:12 | 2018-06-19T14:55:12 | 90,429,201 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,695 |
java
|
package com.myapp.entity.ec.budget;
import com.myapp.core.annotation.MyEntityAnn;
import com.myapp.core.base.entity.CoreBaseEntryInfo;
import com.myapp.core.entity.MaterialInfo;
import com.myapp.core.entity.MeasureUnitInfo;
import com.myapp.core.enums.MaterialType;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Set;
/**
* @path:com.myapp.entity.ec.budget
* @description:材料设备预算清单
* @author : ly
* @date: 2017-08-25 15:21
*/
@Entity
@MyEntityAnn(name="材料设备预算清单明细")
@Table(name="t_ec_budgeting_detail")
public class BudgetingDetailInfo extends CoreBaseEntryInfo<BudgetingInfo> {
/**
* 预算数量
*/
private BigDecimal quantity;
/**
* 预算单价
*/
private BigDecimal budgetaryPrice;
/**
* 预算物料信息
*/
private MaterialInfo material;
/**
* 预算物料类型
*/
private MaterialType materialType;
/**
* 规格
*/
private String specification;
/**
* 计量单位
*/
private MeasureUnitInfo measureUnitInfo;
/**
* 备注
*/
private String remark;
/**
* 物料名称
*/
private String materialName;
/**
* 预算询价信息
*/
private Set<EnquiryPriceDetailInfo> enquiryPriceDetailInfos;
@Column(name="fQuantity",precision = 10,scale = 2)
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
@Column(name="fBudgetaryPrice",precision = 10,scale = 4)
public BigDecimal getBudgetaryPrice() {
return budgetaryPrice;
}
public void setBudgetaryPrice(BigDecimal budgetaryPrice) {
this.budgetaryPrice = budgetaryPrice;
}
@ManyToOne
@JoinColumn(name = "fMaterialId")
public MaterialInfo getMaterial() {
return material;
}
public void setMaterial(MaterialInfo material) {
this.material = material;
}
@Column(name="fRemark")
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Column(name="fMaterialType",length = 20)
@Type(type="myEnum",parameters={@org.hibernate.annotations.Parameter(name="enumClass",value="com.myapp.core.enums.MaterialType")})
public MaterialType getMaterialType() {
return materialType;
}
public void setMaterialType(MaterialType materialType) {
this.materialType = materialType;
}
@Column(name="fSpecification",length = 50)
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
@ManyToOne
@JoinColumn(name = "fMeasureUnitId")
public MeasureUnitInfo getMeasureUnitInfo() {
return measureUnitInfo;
}
public void setMeasureUnitInfo(MeasureUnitInfo measureUnitInfo) {
this.measureUnitInfo = measureUnitInfo;
}
@Column(name="fMaterialName",length = 50)
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@OneToMany(cascade={CascadeType.ALL},mappedBy="budgetingDetailInfo")
public Set<EnquiryPriceDetailInfo> getEnquiryPriceDetailInfos() {
return enquiryPriceDetailInfos;
}
public void setEnquiryPriceDetailInfos(Set<EnquiryPriceDetailInfo> enquiryPriceDetailInfos) {
this.enquiryPriceDetailInfos = enquiryPriceDetailInfos;
}
}
|
[
"[email protected]"
] | |
f4b79de1006c3ca109c6eab084a6c72092be3fba
|
daa9c929ee9242b5cfdfeb3a9937aaaee68c3a31
|
/src/main/java/ioc/dao/UserDaoImpl.java
|
a4dcb185b1599f1f280d938e37e362921db1f0e3
|
[] |
no_license
|
bleach-beach/JavaLearning
|
e5aac30d2dd3ddddbc49d94cf90eab26b3ee7200
|
3ecf0d00756a6ca4f8f69fb7a121e812e6d0fc62
|
refs/heads/master
| 2021-08-26T04:46:30.500158 | 2021-08-25T16:16:35 | 2021-08-25T16:16:35 | 74,335,531 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 147 |
java
|
package ioc.dao;
public class UserDaoImpl implements UserDao {
@Override
public void query() {
System.out.println("dao");
}
}
|
[
"[email protected]"
] | |
915b233c9f251c490abfc40f9c1fc401f220a79e
|
6a6d6cbf921f9d6b1293e828e047ed1727b04962
|
/src/storage/MemoryStorage.java
|
80bcb435906132c7118f0a3bd98452b69643bded
|
[] |
no_license
|
cyrilleio/Kinetics
|
fee6315a568d4d5dfc37b3c1c908bc34eb93336d
|
5d7d49e0905fb18408efb0ede2e14cfb98db01f6
|
refs/heads/master
| 2022-11-21T20:10:20.992979 | 2020-07-29T13:55:46 | 2020-07-29T13:55:46 | 267,106,871 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 49 |
java
|
package storage;
public class MemoryStorage {
}
|
[
"[email protected]"
] | |
97a0a100198acea532863c896e2acd1f813a69bd
|
650b8ea492717651c4342ddf3aac633ff4ac1779
|
/src/test/java/jfxtras/labs/scene/control/triple/EmailConverter.java
|
9413d2e29ea09198af982f1219dda257692ef0af
|
[
"BSD-3-Clause"
] |
permissive
|
goto1134/jfxtras-labs
|
ab638f7a421cf2f80da0b0ff93ec77c2441b51f5
|
2c510a431e370237948469b0567c1d2b6220e0d4
|
refs/heads/8.0
| 2021-01-18T17:06:42.735051 | 2017-08-09T11:27:13 | 2017-08-09T11:27:13 | 100,485,846 | 0 | 0 | null | 2017-08-16T12:16:17 | 2017-08-16T12:16:17 | null |
UTF-8
|
Java
| false | false | 617 |
java
|
package jfxtras.labs.scene.control.triple;
import jfxtras.labs.scene.control.edittable.triple.Triple;
import jfxtras.labs.scene.control.edittable.triple.TripleConverter;
public class EmailConverter implements TripleConverter<Email,String,String,Boolean>
{
@Override
public Triple<String,String,Boolean> fromBeanElement(Email e) {
return new Triple<String,String,Boolean>()
.withName(e.getName())
.withValue(e.getEmailAddress())
.withPrimary(e.isPrimary());
}
@Override
public Email toBeanElement(Triple<String,String,Boolean> t) {
return new Email(t.getName(), t.getValue(), t.isPrimary());
}
}
|
[
"[email protected]"
] | |
e77f5dcd0c6fce35cebfa0cb49376c19ca5c8e97
|
6a226757400a447a8672ae1bc4f7fd7f5c97f844
|
/chess/DroidFish/src/com/chess/android/appdevthree/engine/cuckoochess/DroidEngineControl.java
|
180de4542c34585e1111e0c8b4b30663846c211c
|
[] |
no_license
|
freeandroapp/Ultimate-Chess
|
ffc4a3b6fb65bba95cfe2ff5abab0c4a8972a224
|
39c11b98d6abd19dfe788a87f4da6c67fad64925
|
refs/heads/master
| 2016-09-05T15:33:40.708990 | 2012-10-13T17:41:55 | 2012-10-13T17:41:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,326 |
java
|
/*
DroidFish - An Android chess program.
Copyright (C) 2011 Peter Österlund, [email protected]
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 3 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, see <http://www.gnu.org/licenses/>.
*/
package com.chess.android.appdevthree.engine.cuckoochess;
import chess.Book;
import chess.ComputerPlayer;
import chess.Move;
import chess.MoveGen;
import chess.Piece;
import chess.Position;
import chess.Search;
import chess.TextIO;
import chess.TranspositionTable;
import chess.TranspositionTable.TTEntry;
import chess.UndoInfo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import com.chess.android.appdevthree.engine.LocalPipe;
/**
* Control the search thread.
* @author petero
*/
public class DroidEngineControl {
LocalPipe os;
Thread engineThread;
private final Object threadMutex;
Search sc;
TranspositionTable tt;
MoveGen moveGen;
Position pos;
long[] posHashList;
int posHashListSize;
boolean ponder; // True if currently doing pondering
boolean onePossibleMove;
boolean infinite;
int minTimeLimit;
int maxTimeLimit;
int maxDepth;
int maxNodes;
List<Move> searchMoves;
// Options
int hashSizeMB = 2;
boolean ownBook = false;
boolean analyseMode = false;
boolean ponderMode = true;
// Reduced strength variables
private int strength = 1000;
private long randomSeed = 0;
private Random rndGen = new Random();
/**
* This class is responsible for sending "info" strings during search.
*/
static class SearchListener implements Search.Listener {
LocalPipe os;
SearchListener(LocalPipe os) {
this.os = os;
}
public void notifyDepth(int depth) {
os.printLine("info depth %d", depth);
}
public void notifyCurrMove(Move m, int moveNr) {
os.printLine("info currmove %s currmovenumber %d", moveToString(m), moveNr);
}
public void notifyPV(int depth, int score, int time, long nodes, int nps, boolean isMate,
boolean upperBound, boolean lowerBound, ArrayList<Move> pv) {
StringBuilder pvBuf = new StringBuilder();
for (Move m : pv) {
pvBuf.append(" ");
pvBuf.append(moveToString(m));
}
String bound = "";
if (upperBound) {
bound = " upperbound";
} else if (lowerBound) {
bound = " lowerbound";
}
os.printLine("info depth %d score %s %d%s time %d nodes %d nps %d pv%s",
depth, isMate ? "mate" : "cp", score, bound, time, nodes, nps, pvBuf.toString());
}
public void notifyStats(long nodes, int nps, int time) {
os.printLine("info nodes %d nps %d time %d", nodes, nps, time);
}
}
public DroidEngineControl(LocalPipe os) {
this.os = os;
threadMutex = new Object();
setupTT();
moveGen = new MoveGen();
}
final public void startSearch(Position pos, ArrayList<Move> moves, SearchParams sPar) {
setupPosition(new Position(pos), moves);
computeTimeLimit(sPar);
ponder = false;
infinite = (maxTimeLimit < 0) && (maxDepth < 0) && (maxNodes < 0);
searchMoves = sPar.searchMoves;
startThread(minTimeLimit, maxTimeLimit, maxDepth, maxNodes);
}
final public void startPonder(Position pos, List<Move> moves, SearchParams sPar) {
setupPosition(new Position(pos), moves);
computeTimeLimit(sPar);
ponder = true;
infinite = false;
startThread(-1, -1, -1, -1);
}
final public void ponderHit() {
Search mySearch;
synchronized (threadMutex) {
mySearch = sc;
}
if (mySearch != null) {
if (onePossibleMove) {
if (minTimeLimit > 1) minTimeLimit = 1;
if (maxTimeLimit > 1) maxTimeLimit = 1;
}
mySearch.timeLimit(minTimeLimit, maxTimeLimit);
}
infinite = (maxTimeLimit < 0) && (maxDepth < 0) && (maxNodes < 0);
ponder = false;
}
final public void stopSearch() {
stopThread();
}
final public void newGame() {
randomSeed = rndGen.nextLong();
tt.clear();
}
/**
* Compute thinking time for current search.
*/
final public void computeTimeLimit(SearchParams sPar) {
minTimeLimit = -1;
maxTimeLimit = -1;
maxDepth = -1;
maxNodes = -1;
if (sPar.infinite) {
minTimeLimit = -1;
maxTimeLimit = -1;
maxDepth = -1;
} else if (sPar.depth > 0) {
maxDepth = sPar.depth;
} else if (sPar.mate > 0) {
maxDepth = sPar.mate * 2 - 1;
} else if (sPar.moveTime > 0) {
minTimeLimit = maxTimeLimit = sPar.moveTime;
} else if (sPar.nodes > 0) {
maxNodes = sPar.nodes;
} else {
int moves = sPar.movesToGo;
if (moves == 0) {
moves = 999;
}
moves = Math.min(moves, 45); // Assume 45 more moves until end of game
if (ponderMode) {
final double ponderHitRate = 0.35;
moves = (int)Math.ceil(moves * (1 - ponderHitRate));
}
boolean white = pos.whiteMove;
int time = white ? sPar.wTime : sPar.bTime;
int inc = white ? sPar.wInc : sPar.bInc;
final int margin = Math.min(1000, time * 9 / 10);
int timeLimit = (time + inc * (moves - 1) - margin) / moves;
minTimeLimit = (int)(timeLimit * 0.85);
maxTimeLimit = (int)(minTimeLimit * (Math.max(2.5, Math.min(4.0, moves / 2.0))));
// Leave at least 1s on the clock, but can't use negative time
minTimeLimit = clamp(minTimeLimit, 1, time - margin);
maxTimeLimit = clamp(maxTimeLimit, 1, time - margin);
}
}
static final int clamp(int val, int min, int max) {
if (val < min) {
return min;
} else if (val > max) {
return max;
} else {
return val;
}
}
final private void startThread(final int minTimeLimit, final int maxTimeLimit,
int maxDepth, final int maxNodes) {
synchronized (threadMutex) {} // Must not start new search until old search is finished
sc = new Search(pos, posHashList, posHashListSize, tt);
sc.timeLimit(minTimeLimit, maxTimeLimit);
sc.setListener(new SearchListener(os));
sc.setStrength(strength, randomSeed);
sc.nodesBetweenTimeCheck = 500;
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
MoveGen.removeIllegal(pos, moves);
if ((searchMoves != null) && (searchMoves.size() > 0))
moves.filter(searchMoves);
final MoveGen.MoveList srchMoves = moves;
onePossibleMove = false;
if ((srchMoves.size < 2) && !infinite) {
onePossibleMove = true;
if (!ponder) {
if ((maxDepth < 0) || (maxDepth > 2)) maxDepth = 2;
}
}
tt.nextGeneration();
final int srchmaxDepth = maxDepth;
Runnable run = new Runnable() {
public void run() {
Move m = null;
if (ownBook && !analyseMode) {
Book book = new Book(false);
m = book.getBookMove(pos);
}
if (m == null) {
m = sc.iterativeDeepening(srchMoves, srchmaxDepth, maxNodes, false);
}
while (ponder || infinite) {
// We should not respond until told to do so. Just wait until
// we are allowed to respond.
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
break;
}
}
Move ponderMove = getPonderMove(pos, m);
synchronized (threadMutex) {
if (ponderMove != null) {
os.printLine("bestmove %s ponder %s", moveToString(m), moveToString(ponderMove));
} else {
os.printLine("bestmove %s", moveToString(m));
}
engineThread = null;
sc = null;
}
}
};
ThreadGroup tg = new ThreadGroup("searcher");
engineThread = new Thread(tg, run, "searcher", 32768);
engineThread.start();
}
final public void stopThread() {
Thread myThread;
Search mySearch;
synchronized (threadMutex) {
myThread = engineThread;
mySearch = sc;
}
if (myThread != null) {
mySearch.timeLimit(0, 0);
infinite = false;
ponder = false;
try {
myThread.join();
} catch (InterruptedException ex) {
throw new RuntimeException();
}
}
}
private final void setupTT() {
int nEntries = hashSizeMB > 0 ? hashSizeMB * (1 << 20) / 24 : 1024;
int logSize = (int) Math.floor(Math.log(nEntries) / Math.log(2));
tt = new TranspositionTable(logSize);
}
final void setupPosition(Position pos, List<Move> moves) {
UndoInfo ui = new UndoInfo();
posHashList = new long[200 + moves.size()];
posHashListSize = 0;
for (Move m : moves) {
posHashList[posHashListSize++] = pos.zobristHash();
pos.makeMove(m, ui);
}
this.pos = pos;
}
/**
* Try to find a move to ponder from the transposition table.
*/
final Move getPonderMove(Position pos, Move m) {
if (m == null)
return null;
Move ret = null;
UndoInfo ui = new UndoInfo();
pos.makeMove(m, ui);
TTEntry ent = tt.probe(pos.historyHash());
if (ent.type != TTEntry.T_EMPTY) {
ret = new Move(0, 0, 0);
ent.getMove(ret);
MoveGen.MoveList moves = moveGen.pseudoLegalMoves(pos);
MoveGen.removeIllegal(pos, moves);
if (!Arrays.asList(moves.m).contains(ret)) {
ret = null;
}
}
pos.unMakeMove(m, ui);
return ret;
}
static final String moveToString(Move m) {
if (m == null)
return "0000";
String ret = TextIO.squareToString(m.from);
ret += TextIO.squareToString(m.to);
switch (m.promoteTo) {
case Piece.WQUEEN:
case Piece.BQUEEN:
ret += "q";
break;
case Piece.WROOK:
case Piece.BROOK:
ret += "r";
break;
case Piece.WBISHOP:
case Piece.BBISHOP:
ret += "b";
break;
case Piece.WKNIGHT:
case Piece.BKNIGHT:
ret += "n";
break;
default:
break;
}
return ret;
}
static void printOptions(LocalPipe os) {
os.printLine("option name Hash type spin default 2 min 1 max 2048");
os.printLine("option name OwnBook type check default false");
os.printLine("option name Ponder type check default true");
os.printLine("option name UCI_AnalyseMode type check default false");
os.printLine("option name UCI_EngineAbout type string default %s by Peter Osterlund, see http://web.comhem.se/petero2home/javachess/index.html",
ComputerPlayer.engineName);
os.printLine("option name Strength type spin default 1000 min 0 max 1000");
}
final void setOption(String optionName, String optionValue) {
try {
if (optionName.equals("hash")) {
hashSizeMB = Integer.parseInt(optionValue);
setupTT();
} else if (optionName.equals("ownbook")) {
ownBook = Boolean.parseBoolean(optionValue);
} else if (optionName.equals("ponder")) {
ponderMode = Boolean.parseBoolean(optionValue);
} else if (optionName.equals("uci_analysemode")) {
analyseMode = Boolean.parseBoolean(optionValue);
} else if (optionName.equals("strength")) {
strength = Integer.parseInt(optionValue);
}
} catch (NumberFormatException nfe) {
}
}
}
|
[
"[email protected]"
] | |
ddfcebdbab748d802cf49c55b3449d64f900215e
|
f5ba09b5f6c56fda153ad162c5991daad0a23e6a
|
/app/src/main/java/com/example/jacekpodwysocki/soundie/MarkerTag.java
|
bc7d01610f380d7e3b82a0bd4c8f2d1a037d6b5b
|
[] |
no_license
|
jacekpodwysocki/aplikacjamgr
|
af225643b56473f2388bf635a3733ddb43d31eb5
|
03d335386675b78943d998ff329724dd9d8e87a2
|
refs/heads/master
| 2021-01-18T23:57:07.926566 | 2019-03-15T14:08:41 | 2019-03-15T14:08:41 | 44,387,035 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 418 |
java
|
package com.example.jacekpodwysocki.soundie;
/**
* Created by jacekpodwysocki on 04/11/2016.
*/
public class MarkerTag {
private Integer userid;
private Boolean activearker;
public MarkerTag(Integer userId,Boolean activeMarker) {
userid=userId;
activearker=activeMarker;
}
public Integer getUserId(){return userid;}
public Boolean getIsActive(){return activearker;}
}
|
[
"[email protected]"
] | |
cb81677444275d9cc9a7dddf8408825433ab8bc7
|
8890bed3cbef089a970661878c17474b0040d0af
|
/src/main/duke/command/DoneCommand.java
|
5a6074114d8da40ed13545f28e89ff933c164778
|
[] |
no_license
|
jazerler/ip
|
49099bd432da93f731b45356b7ddbe3745a0ad53
|
a494fd63e7642b3dab964366167fc42ddfa782f0
|
refs/heads/master
| 2022-12-19T10:22:40.449744 | 2020-09-12T11:05:20 | 2020-09-12T11:05:27 | 287,671,790 | 0 | 0 | null | 2020-08-15T03:42:36 | 2020-08-15T03:42:35 | null |
UTF-8
|
Java
| false | false | 1,872 |
java
|
package duke.command;
import duke.exception.DukeArgumentException;
import duke.exception.DukeExecutionException;
import duke.exception.DukeIoException;
import duke.storage.Storage;
/**
* Represents an request by the user to mark a Task object at the given index from the list of Tasks as completed.
*/
public class DoneCommand extends Command {
private final int index;
/**
* Constructor for a DoneCommand
*
* @param args the input string to be parsed for the index of the list to be marked as complete.
* @throws DukeArgumentException if the index provided in the input string is invalid.
*/
public DoneCommand(String args) throws DukeArgumentException {
assert !args.isBlank() : "Input is empty.";
try {
int index = Integer.parseInt(args);
this.index = index - 1;
} catch (NumberFormatException ne) {
throw new DukeArgumentException("Invalid index");
}
}
/**
* Attempts to mark the Task object at the index of the Storage object as completed.
*
* @param storage The Storage object in which to mark the Task at the index given as complete.
* @throws DukeExecutionException if the index is out of range, or the program runs into an IOException
*/
@Override
public String execute(Storage storage) throws DukeExecutionException {
try {
return String.format(storage.complete(index).toString());
} catch (DukeArgumentException e) {
throw new DukeExecutionException(String.format("Could not execute command due to the index %d being out "
+ "of range", index));
} catch (DukeIoException die) {
throw new DukeExecutionException("Could not execute command due to IO exception.");
}
}
}
|
[
"[email protected]"
] | |
c69bec555c5829a6071fde7bc763e34e7748a209
|
8fb8beccd82c8fbe259fe4cddb32fad47a6716f3
|
/JavaLanguage/Strings/String2/src/OrderLexicographically.java
|
068addbf300b3402b027687f473c89d65c2cb5d8
|
[] |
no_license
|
BrandstadterViktoria/JavaExercises
|
588dec21e3163a0bba94048dfaec35d8b3d98c9d
|
d0da134f99a987768a25939879295ce58518650e
|
refs/heads/master
| 2021-01-01T18:19:53.895297 | 2018-10-26T14:25:27 | 2018-10-26T14:25:27 | 98,305,689 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 889 |
java
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class OrderLexicographically {
public static String getSmallestAndLargest(String s, int k) {
String smallest = "";
String largest = "";
List<String> list = new ArrayList<String>();
for (int i = 0; i < s.length(); i = i + 1) {
if (s.length() - i >= k) {
list.add(s.substring(i, k + i));
}
}
Collections.sort(list);
smallest= list.get(0);
largest= list.get(list.size()-1);
return smallest + "\n" + largest;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.next();
int k = scan.nextInt();
scan.close();
System.out.println(getSmallestAndLargest(s, k));
}
}
|
[
"[email protected]"
] | |
efe48426c7c84e610609c08e043d31b30b198856
|
947f32edb502fa95511ad2ed10841d7e082fd6a4
|
/common/src/main/java/com/serenegiant/mediastore/MediaStoreImageAdapter.java
|
c443d8c1676c63054585c55f391d8dac6ace6c1c
|
[
"Apache-2.0"
] |
permissive
|
xvsd247/libcommon
|
15a44b5b9f28030d33c39bcbdd47e594b4a6d1ec
|
f0fa8e3384bb76ecc40cd69a11d2fc3fdeb892d1
|
refs/heads/master
| 2020-12-01T06:46:22.108886 | 2020-08-21T08:30:13 | 2020-08-21T08:30:13 | 230,576,313 | 0 | 0 |
Apache-2.0
| 2020-08-21T08:30:14 | 2019-12-28T07:37:39 | null |
UTF-8
|
Java
| false | false | 12,706 |
java
|
package com.serenegiant.mediastore;
/*
* libcommon
* utility/helper classes for myself
*
* Copyright (c) 2014-2020 saki [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.PagerAdapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.serenegiant.common.R;
import com.serenegiant.graphics.BitmapHelper;
import com.serenegiant.utils.ThreadPool;
import com.serenegiant.view.ViewUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.serenegiant.mediastore.MediaStoreUtils.*;
/**
* MediaStore内の静止画をViewPagerで表示するためのPagerAdapter実装
* こっちはサムネイルではなくファイルからBitmapを指定サイズで読み込む
*/
public class MediaStoreImageAdapter extends PagerAdapter {
private static final boolean DEBUG = false; // FIXME 実働時はfalseにすること
private static final String TAG = MediaStoreImageAdapter.class.getSimpleName();
@NonNull
private final Context mContext;
@NonNull
private final LayoutInflater mInflater;
private final int mLayoutId;
@NonNull
private final ContentResolver mCr;
@NonNull
private final MyAsyncQueryHandler mQueryHandler;
protected boolean mDataValid;
protected ChangeObserver mChangeObserver;
protected DataSetObserver mDataSetObserver;
private Cursor mCursor;
private String mSelection = SELECTIONS[MEDIA_IMAGE]; // 静止画のみ有効
private String[] mSelectionArgs = null;
@NonNull
private final MediaInfo info = new MediaInfo();
/**
* 読み込み可能なレコードの位置を保持するList
*/
@NonNull
private final List<Integer> mValues = new ArrayList<>();
private boolean mNeedValidate;
private boolean mShowTitle;
/**
* コンストラクタ
* すぐにデータ取得要求する
* @param context
* @param id_layout
*/
public MediaStoreImageAdapter(@NonNull final Context context,
@LayoutRes final int id_layout) {
this(context, id_layout, true);
}
/**
* コンストラクタ
* @param context
* @param id_layout
* @param refreshNow true: すぐにデータ取得要求する, false: refreshを呼ぶまでデータ取得しない
*/
public MediaStoreImageAdapter(@NonNull final Context context,
@LayoutRes final int id_layout, final boolean refreshNow) {
mContext = context;
mInflater = LayoutInflater.from(context);
mLayoutId = id_layout;
mCr = context.getContentResolver();
mQueryHandler = new MyAsyncQueryHandler(mCr, this);
mNeedValidate = true;
if (refreshNow) {
refresh();
}
}
@Override
protected void finalize() throws Throwable {
try {
changeCursor(null);
} finally {
super.finalize();
}
}
@Override
public int getCount() {
synchronized (mValues) {
return mValues.size();
}
}
@NonNull
@Override
public Object instantiateItem(@NonNull final ViewGroup container,
final int position) {
if (DEBUG) Log.v(TAG, "instantiateItem:position=" + position);
final View view = mInflater.inflate(mLayoutId, container, false);
ViewHolder holder;
if (view != null) {
container.addView(view);
holder = (ViewHolder)view.getTag();
if (holder == null) {
holder = new ViewHolder();
}
holder.mImageView = ViewUtils.findIconView(view);
holder.mTitleView = ViewUtils.findTitleView(view);
info.loadFromCursor(getCursor(position));
// ローカルキャッシュ
Drawable drawable = holder.mImageView.getDrawable();
if (!(drawable instanceof LoaderDrawable)) {
drawable = createLoaderDrawable(mContext, info);
holder.mImageView.setImageDrawable(drawable);
}
((LoaderDrawable)drawable).startLoad(info);
if (holder.mTitleView != null) {
holder.mTitleView.setVisibility(mShowTitle ? View.VISIBLE : View.GONE);
if (mShowTitle) {
holder.mTitleView.setText(info.title);
}
}
}
return view;
}
@Override
public void destroyItem(@NonNull final ViewGroup container,
final int position, @NonNull final Object object) {
if (DEBUG) Log.v(TAG, "destroyItem:position=" + position);
if (object instanceof View) {
container.removeView((View)object);
}
}
@Override
public int getItemPosition(@NonNull final Object object) {
// FIXME ここはobject=ViewからMediaInfo#idを取得してpositionを検索し直さないとだめかも
return super.getItemPosition(object);
}
/**
* 読み込みできないデータをオミットするかどうか
* 次回のrefresh呼び出しから有効
* @param needValidate
*/
public void setValidateItems(final boolean needValidate) {
if (mNeedValidate != needValidate) {
mNeedValidate = needValidate;
}
}
public int getItemPositionFromID(final long id) {
if (DEBUG) Log.v(TAG, "getItemPositionFromID:id=" + id);
int result = -1;
final Cursor cursor = mCr.query(QUERY_URI_FILES, PROJ_MEDIA, mSelection, mSelectionArgs, null);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
for (int ix = 0 ; ; ix++) {
if (cursor.getLong(PROJ_INDEX_ID) == id) {
if (DEBUG) Log.v(TAG, "getItemPositionFromID:found=" + ix);
result = ix;
break;
}
if (!cursor.moveToNext()) break;
}
}
} finally {
cursor.close();
}
}
return result;
}
@Override
public boolean isViewFromObject(@NonNull final View view,
@NonNull final Object object) {
return view.equals(object);
}
/**
* get MediaInfo at specified position
* @param position
* @return
*/
@NonNull
public MediaInfo getMediaInfo(final int position) {
return getMediaInfo(position, null);
}
/**
* get MediaInfo at specified position
* @param position
* @param info
* @return
*/
@NonNull
public synchronized MediaInfo getMediaInfo(
final int position, @Nullable final MediaInfo info) {
final MediaInfo _info = info != null ? info : new MediaInfo();
final int pos;
synchronized (mValues) {
pos = mValues.get(position);
}
/* // if you don't need to frequently call this method, temporary query may be better to reduce memory usage.
// but it will take more time.
final Cursor cursor = mCr.query(
ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, getItemId(position)),
PROJ_IMAGE, mSelection, mSelectionArgs, MediaStore.Images.Media.DEFAULT_SORT_ORDER);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
info = readMediaInfo(cursor, new MediaInfo());
}
} finally {
cursor.close();
}
} */
if (mCursor == null) {
throw new IllegalStateException("Cursor is not ready!");
// mCursor = mCr.query(
// QUERY_URI, PROJ_MEDIA,
// mSelection, mSelectionArgs, null);
}
if (mCursor.moveToPosition(pos)) {
_info.loadFromCursor(mCursor);
}
return _info;
}
protected void changeCursor(@Nullable final Cursor cursor) {
final Cursor old = swapCursor(cursor);
if ((old != null) && !old.isClosed()) {
old.close();
}
}
protected Cursor getCursor(final int position) {
if (mDataValid && mCursor != null) {
mCursor.moveToPosition(position);
return mCursor;
} else {
return null;
}
}
@Nullable
protected Cursor swapCursor(@Nullable final Cursor newCursor) {
if (newCursor == mCursor) {
return null;
}
Cursor oldCursor = mCursor;
if (oldCursor != null) {
if (mChangeObserver != null) {
oldCursor.unregisterContentObserver(mChangeObserver);
}
if (mDataSetObserver != null) {
oldCursor.unregisterDataSetObserver(mDataSetObserver);
}
}
mCursor = newCursor;
if (newCursor != null) {
if (mChangeObserver != null) {
newCursor.registerContentObserver(mChangeObserver);
}
if (mDataSetObserver != null) {
newCursor.registerDataSetObserver(mDataSetObserver);
}
synchronized (mValues) {
mValues.clear();
if (newCursor.moveToFirst()) {
int pos = 0;
do {
info.loadFromCursor(newCursor);
if (!mNeedValidate || info.canRead(mCr)) {
mValues.add(pos);
}
pos++;
} while (newCursor.moveToNext());
}
}
mDataValid = true;
// notify the observers about the new cursor
notifyDataSetChanged();
} else {
synchronized (mValues) {
mValues.clear();
}
mDataValid = false;
// notify the observers about the lack of a data set
notifyDataSetInvalidated();
}
return oldCursor;
}
public void notifyDataSetInvalidated() {
// mDataSetObservable.notifyInvalidated();
}
public void refresh() {
ThreadPool.preStartAllCoreThreads();
mQueryHandler.requery();
}
protected LoaderDrawable createLoaderDrawable(
@NonNull final Context context, @NonNull final MediaInfo info) {
return new ImageLoaderDrawable(context, info.width, info.height);
}
private static final class ViewHolder {
TextView mTitleView;
ImageView mImageView;
}
private static final class MyAsyncQueryHandler extends AsyncQueryHandler {
@NonNull
private final MediaStoreImageAdapter mAdapter;
public MyAsyncQueryHandler(
@NonNull final ContentResolver cr,
@NonNull final MediaStoreImageAdapter adapter) {
super(cr);
mAdapter = adapter;
}
public void requery() {
synchronized (mAdapter) {
startQuery(0, mAdapter, QUERY_URI_IMAGES, PROJ_MEDIA_IMAGE,
mAdapter.mSelection, mAdapter.mSelectionArgs, null);
}
}
@Override
protected void onQueryComplete(final int token,
final Object cookie, final Cursor cursor) {
// super.onQueryComplete(token, cookie, cursor); // this is empty method
final Cursor oldCursor = mAdapter.swapCursor(cursor);
if ((oldCursor != null) && !oldCursor.isClosed())
oldCursor.close();
}
}
private class ChangeObserver extends ContentObserver {
public ChangeObserver() {
super(new Handler());
}
@Override
public boolean deliverSelfNotifications() {
return true;
}
@Override
public void onChange(boolean selfChange) {
refresh();
}
}
private class MyDataSetObserver extends DataSetObserver {
@Override
public void onChanged() {
mDataValid = true;
notifyDataSetChanged();
}
@Override
public void onInvalidated() {
mDataValid = false;
notifyDataSetInvalidated();
}
}
private static class ImageLoaderDrawable extends LoaderDrawable {
public ImageLoaderDrawable(@NonNull final Context context,
final int width, final int height) {
super(context, width, height);
}
@NonNull
@Override
protected ImageLoader createImageLoader() {
return new MyImageLoader(this);
}
@Override
protected Bitmap checkCache(final long id) {
return null;
}
}
private static class MyImageLoader extends ImageLoader {
public MyImageLoader(final ImageLoaderDrawable parent) {
super(parent);
}
@Override
protected Bitmap loadBitmap(@NonNull final Context context,
@NonNull final MediaInfo info,
final int requestWidth, final int requestHeight) {
Bitmap result = null;
try {
result = BitmapHelper.asBitmap(
context.getContentResolver(), info.id,
requestWidth, requestHeight);
if (result != null) {
final int w = result.getWidth();
final int h = result.getHeight();
final Rect bounds = new Rect();
mParent.copyBounds(bounds);
final int cx = bounds.centerX();
final int cy = bounds.centerY();
bounds.set(cx - w / 2, cy - h / w, cx + w / 2, cy + h / 2);
mParent.onBoundsChange(bounds);
}
} catch (final IOException e) {
if (DEBUG) Log.w(TAG, e);
}
if (result == null) {
result = loadDefaultBitmap(context, R.drawable.ic_error_outline_red_24dp);
}
return result;
}
}
}
|
[
"[email protected]"
] | |
09775e90550c7a9ce6e16ebbd302cd9c1a6efbb4
|
6b63ef1bf7bf75b90d520c2b16d7f74bf8358ceb
|
/ResearchPortlet/src/th/ac/kmutt/research/form/PositionMasterForm.java
|
b7b0c15fb7df5ec1ec7f71abac6d69108e40f99e
|
[] |
no_license
|
GJ-jirayu/Kmutt-Research
|
868ec5d28e68a930d9d267ca733c91eadab108be
|
e5c929e7b609d9ef3477a8be1e7954de63ffce80
|
refs/heads/master
| 2021-01-17T10:23:49.339311 | 2016-06-15T10:54:52 | 2016-06-15T10:54:52 | 58,120,639 | 3 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 747 |
java
|
package th.ac.kmutt.research.form;
import java.io.Serializable;
import th.ac.kmutt.research.model.PositionM;
public class PositionMasterForm extends CommonForm implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private PositionM positionM;
public PositionMasterForm(PositionM positionM) {
super();
this.positionM = positionM;
}
public PositionMasterForm() {
super();
positionM = new PositionM();
// TODO Auto-generated constructor stub
}
public PositionM getPositionM() {
return positionM;
}
public void setPositionM(PositionM positionM) {
this.positionM = positionM;
}
}
|
[
"[email protected]"
] | |
432184521298bc555b4e7bdb72ca426ee66fdb80
|
fdcf2d186639aabd6f112c954cd8f4a304b03264
|
/attence-service/attence-employee-service/src/main/java/com/attence/employee/controller/ConfigController.java
|
7ba24ec58908c4927ab01a29b4c4b449cfdb523c
|
[] |
no_license
|
softthink-csp/attence-server
|
cc81751540185411bff15e0bff0273e9a9c3bf13
|
bd1580c119ce839b7bca65785dd9679dc8d89122
|
refs/heads/master
| 2023-02-08T09:27:28.004691 | 2021-01-05T02:00:21 | 2021-01-05T02:00:21 | 324,958,279 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 791 |
java
|
package com.attence.employee.controller;
import com.attence.employee.service.RouteService;
import com.attence.employee.vo.Route;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class ConfigController {
@Autowired
private RouteService routeService;
@ResponseBody
@RequestMapping("/getMenuData")
public List<Route> login(@RequestParam String username) {
List<Route> routeData = routeService.getRouteData(username);
return routeData;
}
}
|
[
"[email protected]"
] | |
a087b55a2bcd0f16289928c56c1fb19a8b90bf9b
|
674f464c8cf8ae6724fd67c36d41e96f89074ca5
|
/datetime/src/main/java/com/github/nhojpatrick/hamcrest/datetime/IsAfterDateTime.java
|
e40755c0e644fd3ab652e9679f59d1da6900c685
|
[
"Apache-2.0"
] |
permissive
|
nhojpatrick/nhojpatrick-hamcrest
|
9ee7683b0bbb775338338f99a0ce9ae1d5684e9f
|
825b1b4235e5ff5b8560c19db928d8d00de96b44
|
refs/heads/develop
| 2023-08-22T23:42:42.652945 | 2023-08-14T22:38:42 | 2023-08-14T22:53:31 | 146,892,518 | 0 | 1 |
Apache-2.0
| 2023-09-10T20:02:44 | 2018-08-31T13:00:29 |
Java
|
UTF-8
|
Java
| false | false | 6,941 |
java
|
package com.github.nhojpatrick.hamcrest.datetime;
import com.github.nhojpatrick.hamcrest.datetime.flags.CompareType;
import com.github.nhojpatrick.hamcrest.datetime.flags.RoundingType;
import com.github.nhojpatrick.hamcrest.datetime.internal.after.IsAfterLocalDateTime;
import com.github.nhojpatrick.hamcrest.datetime.internal.after.IsAfterOffsetDateTime;
import com.github.nhojpatrick.hamcrest.datetime.internal.after.IsAfterZonedDateTime;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.hamcrest.Matcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.OffsetDateTime;
import java.time.chrono.ChronoLocalDateTime;
import java.time.chrono.ChronoZonedDateTime;
import static com.github.nhojpatrick.hamcrest.datetime.flags.CompareType.EXCLUSIVE;
import static com.github.nhojpatrick.hamcrest.datetime.flags.RoundingType.NONE;
public final class IsAfterDateTime {
private static final Logger LOGGER = LoggerFactory.getLogger(IsAfterDateTime.class);
public static <T> Matcher<T> afterLocalDateTime(final ChronoLocalDateTime expected) {
LOGGER.debug("IsAfterTime#afterLocalDateTime((After) {})", expected);
return doAfterLocalDateTime(expected, EXCLUSIVE, NONE);
}
public static <T> Matcher<T> afterLocalDateTime(final ChronoLocalDateTime expected,
final CompareType compareType) {
LOGGER.debug("IsAfterTime#afterLocalDateTime((After) {}, (CompareType) {})", expected, compareType);
return doAfterLocalDateTime(expected, compareType, NONE);
}
public static <T> Matcher<T> afterLocalDateTime(final ChronoLocalDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterLocalDateTime((After) {}, (CompareType) {}, (RoundingType) {})",
expected, compareType, roundingType);
return doAfterLocalDateTime(expected, compareType, roundingType);
}
public static <T> Matcher<T> afterLocalDateTime(final ChronoLocalDateTime expected,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterLocalDateTime((After) {}, (RoundingType) {})",
expected, roundingType);
return doAfterLocalDateTime(expected, EXCLUSIVE, roundingType);
}
public static <T> Matcher<T> afterOffsetDateTime(final OffsetDateTime expected) {
LOGGER.debug("IsAfterTime#afterOffsetDateTime((After) {})", expected);
return doAfterOffsetDateTime(expected, EXCLUSIVE, NONE);
}
public static <T> Matcher<T> afterOffsetDateTime(final OffsetDateTime expected,
final CompareType compareType) {
LOGGER.debug("IsAfterTime#afterOffsetDateTime((After) {}, (CompareType) {})", expected, compareType);
return doAfterOffsetDateTime(expected, compareType, NONE);
}
public static <T> Matcher<T> afterOffsetDateTime(final OffsetDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterOffsetDateTime((After) {}, (CompareType) {}, (RoundingType) {})",
expected, compareType, roundingType);
return doAfterOffsetDateTime(expected, compareType, roundingType);
}
public static <T> Matcher<T> afterOffsetDateTime(final OffsetDateTime expected,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterOffsetDateTime((After) {}, (RoundingType) {})",
expected, roundingType);
return doAfterOffsetDateTime(expected, EXCLUSIVE, roundingType);
}
@SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "Accepted will look at changing")
private static <T> Matcher<T> doAfterOffsetDateTime(final OffsetDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
return new IsAfterOffsetDateTime(expected, compareType, roundingType);
}
public static <T> Matcher<T> afterZonedDateTime(final ChronoZonedDateTime expected) {
LOGGER.debug("IsAfterTime#afterZonedDateTime((After) {})", expected);
return doAfterZonedDateTime(expected, EXCLUSIVE, NONE);
}
public static <T> Matcher<T> afterZonedDateTime(final ChronoZonedDateTime expected,
final CompareType compareType) {
LOGGER.debug("IsAfterTime#afterZonedDateTime((After) {}, (CompareType) {})", expected, compareType);
return doAfterZonedDateTime(expected, compareType, NONE);
}
public static <T> Matcher<T> afterZonedDateTime(final ChronoZonedDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterZonedDateTime((After) {}, (CompareType) {}, (RoundingType) {})",
expected, compareType, roundingType);
return doAfterZonedDateTime(expected, compareType, roundingType);
}
public static <T> Matcher<T> afterZonedDateTime(final ChronoZonedDateTime expected,
final RoundingType roundingType) {
LOGGER.debug("IsAfterTime#afterZonedDateTime((After) {}, (RoundingType) {})",
expected, roundingType);
return doAfterZonedDateTime(expected, EXCLUSIVE, roundingType);
}
@SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "Accepted will look at changing")
private static <T> Matcher<T> doAfterLocalDateTime(final ChronoLocalDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
return new IsAfterLocalDateTime(expected, compareType, roundingType);
}
@SuppressFBWarnings(value = "OCP_OVERLY_CONCRETE_PARAMETER", justification = "Accepted will look at changing")
private static <T> Matcher<T> doAfterZonedDateTime(final ChronoZonedDateTime expected,
final CompareType compareType,
final RoundingType roundingType) {
return new IsAfterZonedDateTime(expected, compareType, roundingType);
}
public IsAfterDateTime() {
throw new AssertionError("Static utility class - cannot be instantiated.");
}
}
|
[
"[email protected]"
] | |
197adda4badb154c9b635143b4659d8353635081
|
f596d88e46a859b3ccc8fe0deabc9b7e017be682
|
/app/src/main/java/com/project/group2/attendancetool/response/GetTermByTeacherResponse.java
|
91feb3df39a70f17a0d4096c3e87595466c2cef2
|
[] |
no_license
|
minhnq97/PRM391
|
cbeba3280fbcc0cb89cf747a680c907d4d3a7e5a
|
9eb7522baea6e460212eef3ffcd5c45bddb6ca1d
|
refs/heads/master
| 2020-03-23T15:06:43.811733 | 2018-03-26T02:54:33 | 2018-03-26T02:54:33 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 436 |
java
|
package com.project.group2.attendancetool.response;
import com.project.group2.attendancetool.model.Slot;
import com.project.group2.attendancetool.model.SlotInformation;
import java.util.List;
/**
* Created by User on 3/3/2018.
*/
public class GetTermByTeacherResponse {
private List<SlotInformation> SlotInformationList;
public List<SlotInformation> getSlotInformationList() {
return SlotInformationList;
}
}
|
[
"[email protected]"
] | |
d8ea033596dcb3ae6e07eac3e64a98e69d036e2b
|
aa6e7d0d396d9f0e6419887500e4fe4c044a3aed
|
/app/src/main/java/com/example/administrator/myapplication/MainActivity.java
|
70b1559bc8023b0ce1063bef088a24d4145691d6
|
[] |
no_license
|
fhdis/androidstudioworkspace
|
092750c10ada9f82b3b2f555bd1d3f5c37aff6c6
|
083060bf7a58290fbfbed67517ae2f58c712ac34
|
refs/heads/master
| 2020-03-19T09:27:28.961567 | 2018-06-30T09:05:06 | 2018-06-30T09:05:06 | 136,290,361 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,827 |
java
|
package com.example.administrator.myapplication;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.util.Log;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
// private TextView topBar;
private TextView tabDeal;
private TextView tabPoi;
private TextView tabMore;
private TextView tabUser;
private FrameLayout ly_content;
// private FirstFragment f1;
private MenuDeal f1;
//private MenuQuery f2;
private MenuQueryUpdate f2;
private ThirdFragment f3;
private FouthFragment f4;
private FragmentManager fragmentManager;
//private FragmentTransaction transaction = getFragmentManager().beginTransaction();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.linearlayout_exam);
bindView();
FragmentTransaction transaction1 =getSupportFragmentManager().beginTransaction();
if(f1==null) {
tabDeal.setSelected(true);
f1 = new MenuDeal();
//FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction1.add(R.id.fragment_container, f1);
}else {
transaction1.show(f1);
}
Log.d("BBBB","MainActivity="+"onCreate");
transaction1.commit();
/* Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});*/
}
//UI组件初始化与事件绑定
private void bindView() {
// topBar = (TextView)this.findViewById(R.id.txt_top);
tabDeal = (TextView)this.findViewById(R.id.txt_deal);
tabPoi = (TextView)this.findViewById(R.id.txt_poi);
tabUser = (TextView)this.findViewById(R.id.txt_user);
tabMore = (TextView)this.findViewById(R.id.txt_more);
ly_content = (FrameLayout) findViewById(R.id.fragment_container);
tabDeal.setOnClickListener(this);
tabMore.setOnClickListener(this);
tabUser.setOnClickListener(this);
tabPoi.setOnClickListener(this);
}
@Override
public void onClick(View v) {
FragmentTransaction transaction =getSupportFragmentManager().beginTransaction();
hideAllFragment(transaction);
switch(v.getId()){
case R.id.txt_deal:
selected();
tabDeal.setSelected(true);
if(f1==null){
// f1 = new FirstFragment();
f1 = new MenuDeal();
transaction.add(R.id.fragment_container,f1);
}else{
transaction.show(f1);
}
break;
case R.id.txt_more:
selected();
tabMore.setSelected(true);
if(f4==null){
f4 = new FouthFragment();
transaction.add(R.id.fragment_container,f4);
}else{
transaction.show(f4);
}
break;
case R.id.txt_poi:
selected();
tabPoi.setSelected(true);
if(f2==null){
//f2 = new MenuQuery();
f2 = new MenuQueryUpdate();
transaction.add(R.id.fragment_container,f2);
}else{
transaction.show(f2);
}
break;
case R.id.txt_user:
selected();
tabUser.setSelected(true);
if(f3==null){
f3 = new ThirdFragment();
transaction.add(R.id.fragment_container,f3);
}else{
transaction.show(f3);
}
break;
}
transaction.commit();
}
//重置所有文本的选中状态
public void selected(){
tabDeal.setSelected(false);
tabMore.setSelected(false);
tabPoi.setSelected(false);
tabUser.setSelected(false);
}
//隐藏所有Fragment
public void hideAllFragment(FragmentTransaction transaction){
if(f1!=null){
transaction.hide(f1);
}
if(f2!=null){
transaction.hide(f2);
}
if(f3!=null){
transaction.hide(f3);
}
if(f4!=null){
transaction.hide(f4);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
/*if (id == R.id.action_settings) {
return true;
}*/
return super.onOptionsItemSelected(item);
}
}
|
[
"[email protected]"
] | |
901df3a5e8c5f8d51251fdde7bce3ef5a77f66ca
|
440bd74d0acaa9a2d68dfae4b85ae4999a71b9a9
|
/app/src/main/java/com/model/andreymurzin/modelapp/navigation/SplashActivityNavigator.java
|
2f2a10f432968dd93d13a0ec2846c693e59e78d4
|
[] |
no_license
|
rapprotest/model
|
19620e8b4f86e37fbd305eb9368c41dab808f7f1
|
dbede02ebf96630b408d42eaaf10e750b7c8ab7f
|
refs/heads/master
| 2021-01-25T13:28:35.659322 | 2018-03-02T13:30:09 | 2018-03-02T13:30:09 | 123,575,074 | 0 | 0 | null | 2018-03-02T13:30:09 | 2018-03-02T12:12:02 |
Java
|
UTF-8
|
Java
| false | false | 979 |
java
|
package com.model.andreymurzin.modelapp.navigation;
import android.content.Intent;
import android.support.v4.app.Fragment;
import com.model.andreymurzin.modelapp.presentation.main.MainActivity;
import com.model.andreymurzin.modelapp.presentation.splash.StartActivity;
import ru.terrakok.cicerone.android.SupportAppNavigator;
public class SplashActivityNavigator extends SupportAppNavigator {
private StartActivity activity;
public SplashActivityNavigator(StartActivity activity, int containerId) {
super(activity, containerId);
this.activity = activity;
}
@Override
protected Intent createActivityIntent(String screenKey, Object data) {
switch (screenKey) {
case Screen.MAIN_SCREEN: {
return new Intent(activity, MainActivity.class);
}
}
return null;
}
@Override
protected Fragment createFragment(String screenKey, Object data) {
return null;
}
}
|
[
"[email protected]"
] | |
f0f28e7f50706eebc8b869daeca238d1a2418cac
|
768f506ef2a4bd9099dda9e7e4a51679dea7efa5
|
/stc05.studentsMVC-master/src/main/controllers/HelloServlet.java
|
a92a03d96ab2fcd8dcf410dab05565f2a546201b
|
[] |
no_license
|
wohan/PracticeAdapterObserver-master
|
a5a211dace48931d1598a3dd8a9183f4238a6cf2
|
a68c963792e79dbd029c72f15c55fbddf024d8cc
|
refs/heads/master
| 2021-01-20T12:23:13.548655 | 2017-05-05T09:10:44 | 2017-05-05T09:10:44 | 90,357,992 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 841 |
java
|
package main.controllers;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by admin on 18.04.2017.
*/
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//resp.getWriter().print("lalala");
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/login.jsp");
dispatcher.forward(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}
}
|
[
"[email protected]"
] | |
ea13bda7a3683ba0cef850c8195aab1ff1a92970
|
b404ef9c6b4cbe4e97031f53f4202e25e744e61d
|
/src/Commande/Telecommande.java
|
339f3ed64369e567f53a775698191afbd8a5c0ee
|
[] |
no_license
|
profyao90/ACODPCommand
|
a6e0fd017fe607c82fcef814b197d542ffa8960d
|
fd06baafab4e4cd241c9f303bb0f608f51702364
|
refs/heads/master
| 2021-05-07T22:31:13.423316 | 2017-10-17T21:00:30 | 2017-10-17T21:00:30 | 107,328,843 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 211 |
java
|
package Commande;
public class Telecommande {
Commands commande0;
public Telecommande(Commands commande0) {
super();
this.commande0 = commande0;
}
public void lancer(){
commande0.execute();
}
}
|
[
"[email protected]"
] | |
869bd72db579f1b0fc96ed3389b32c478a34beb5
|
a4a0979dd18d16d9a53d7f26f39044dda2a48f78
|
/app/src/main/java/com/example/apple/lingyongqian/xianjindai/entity/ImagerBean.java
|
0c19da6d02a6599fd17e288c0ad43d797d9faed6
|
[] |
no_license
|
doubletan/51lingyongqian
|
29ba57467c2cbd6820ae0eabcfeabae6415c7bd8
|
6c7e5301eafa1aaf7aa2333577a0e42a49999032
|
refs/heads/master
| 2021-08-22T13:49:46.949842 | 2017-11-30T10:30:48 | 2017-11-30T10:30:48 | 112,590,955 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,646 |
java
|
package com.example.apple.lingyongqian.xianjindai.entity;
import android.support.annotation.NonNull;
import java.io.Serializable;
import java.util.ArrayList;
/**
* Created by apple on 2017/4/11.
*/
public class ImagerBean implements Serializable {
private ArrayList<DaohangProduct> Daohang;
public ArrayList<DaohangProduct> getDaohang() {
return Daohang;
}
public void setDaohang(ArrayList<DaohangProduct> Daohang) {
this.Daohang = Daohang;
}
public static class DaohangProduct implements Comparable<DaohangProduct>{
/**
* link : https://www.yangqianguan.com/flexible/index?act=EnWKU8
* advpath : /SysManage/UploadFile/Adv/20170412110528778121151.png
* orderpm : 2
*/
private String link;
private String advpath;
private String orderpm;
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getAdvpath() {
return advpath;
}
public void setAdvpath(String advpath) {
this.advpath = advpath;
}
public String getOrderpm() {
return orderpm;
}
public void setOrderpm(String orderpm) {
this.orderpm = orderpm;
}
@Override
public int compareTo(@NonNull DaohangProduct o) {
return orderpm.compareTo(o.getOrderpm());
}
}
@Override
public String toString() {
return "ImagerBean{" +
"Daohang=" + Daohang +
'}';
}
}
|
[
"[email protected]"
] | |
64310a05c5baa7ca247c26309c1612c8de9a5d51
|
55f87e1ca4880be185c2b8e5fa87a8d075a71fdb
|
/app/src/main/java/com/android/lq/p2p/lili/adapter/AddNewFeatuersAdapter.java
|
f5dfd3695a209331a967c39793d2ddfde077cabe
|
[] |
no_license
|
AndroidLQ/AiLi
|
4dc7b4dcf9af61a3136239ee110b41f0fce342dc
|
e9a2e6483f5c05545ee02655750f993ffdb441fe
|
refs/heads/master
| 2021-01-12T06:32:33.415169 | 2016-12-29T12:26:28 | 2016-12-29T12:26:28 | 77,379,635 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,959 |
java
|
package com.android.lq.p2p.lili.adapter;
import android.graphics.BitmapFactory;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;
import com.android.lq.p2p.lili.R;
import com.android.lq.p2p.lili.base.Constants;
import com.android.lq.p2p.lili.model.InvestGirdModel;
import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
/**
* Created by a on 2016/12/27.
*/
public class AddNewFeatuersAdapter extends BGARecyclerViewAdapter<InvestGirdModel> {
private int itemWidth;
private String type;
public AddNewFeatuersAdapter(RecyclerView recyclerView, int itemWidth,String type) {
super(recyclerView,R.layout.griditem_item);
this.itemWidth = itemWidth;
this.type = type;
}
@Override
protected void setItemChildListener(BGAViewHolderHelper helper, int viewType) {
helper.setItemChildClickListener(R.id.iv_image);
}
@Override
protected void fillData(BGAViewHolderHelper helper, int position, InvestGirdModel model) {
//动态设置item的宽度
helper.getConvertView().setLayoutParams(new ViewGroup.LayoutParams(itemWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
if(Constants.RECYCLERVIEWADPTER_TYPE.equals(type)){
if(position == 0 || position == 2 || position == 3){
helper.setText(R.id.tv_text, model.getTitle()).setTextColor(R.id.tv_text,0xffff9900);
}else{
helper.setText(R.id.tv_text, model.getTitle()).setTextColor(R.id.tv_text,0xff000000);
}
helper.setImageBitmap(R.id.iv_image,BitmapFactory.decodeResource(mContext.getResources(), model.getImageId()));
}else{
helper.setText(R.id.tv_text, model.getTitle());
helper.setImageBitmap(R.id.iv_image,BitmapFactory.decodeResource(mContext.getResources(), model.getImageId()));
}
}
}
|
[
"[email protected]"
] | |
9e1cb2078b7026afc2a2ec6f3bf4cd46a4353398
|
ff3dfce1e20ad81adcd57c706d975d8a47151882
|
/src/Ship.java
|
418f9788179e40c9b676b1cdd84e0e9a1d19b7a8
|
[] |
no_license
|
Keos99/MySeaBattle
|
c33c4158a83e7d4d80045377bcaade32ff94b809
|
8046767a0454ced47804bb4c9370fa8903f54e92
|
refs/heads/master
| 2020-06-27T11:34:01.145627 | 2017-08-15T20:24:15 | 2017-08-15T20:24:15 | 97,043,391 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,273 |
java
|
/**
* Created by Keos99 on 15.06.2017.
*/
public class Ship {
private int decknum = 0; // Количество палуб
private int count = 0; // Счетчик
Field field;
Verification verifi;
void shipGeneration(Field field, Verification verifi, char[][] gamefield) {
int decknum;
int count;
int shipnumber = 0;
for (decknum = 4; decknum > 0; decknum--) {
shipnumber++;
for (count = 4; count >= decknum; count--) {
do {
field.setRandomDirection();
field.setRandomYX(decknum);
field.readCells(decknum, field.getRandomY(), field.getRandomX(), field.getRandomDirection(),gamefield);
} while (verifi.isCellEmpty(field.returncelltc(), decknum));
field.placeShip(decknum, field.getRandomY(), field.getRandomX(), field.getRandomDirection(),gamefield);
field.indent(decknum, field.getRandomY(), field.getRandomX(), field.getRandomDirection(),gamefield);
System.out.println("Корабль № " + shipnumber + ", c " + decknum + " палубами, занял свое место!");
}
}
System.out.println();
}
}
|
[
"[email protected]"
] | |
294c7c958028c10fdceccb254282b3ec018ff9d3
|
c13f289ee178097e75bc253ee55b7261ee23fb53
|
/AndBCompileError.java
|
660a749c9f3dc09d03049d9f9ddb31198074aa71
|
[] |
no_license
|
Luciferved/Codeforces
|
84e2d97ad1abe9433b4eb6079299f7a503283ed5
|
6b3010bdc6caf4c1216b63a930c8c9aec307b534
|
refs/heads/master
| 2021-01-10T16:56:55.134471 | 2016-03-06T17:59:12 | 2016-03-06T17:59:12 | 53,268,092 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,318 |
java
|
import java.util.*;
import java.io.*;
class AndBCompileError
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
//String str = br.readLine();
ArrayList<Integer>ts1 = new ArrayList<Integer>();
ArrayList<Integer>ts2 = new ArrayList<Integer>();
ArrayList<Integer>ts3 = new ArrayList<Integer>();
ArrayList<Integer>ts4 = new ArrayList<Integer>();
ts1 = toArray(n,br.readLine());
ts2 = toArray(n-1,br.readLine());
ts3 = toArray(n-2,br.readLine());
//ts1.removeAll(ts2);
//ts2.removeAll(ts3);
//System.out.println(ts1);
//System.out.println(ts2);
int count = 0;
for(int i=0;i<ts1.size();i++)
{
if(count!=ts2.size())
{
count++;
if(ts1.contains(ts2.get(i)))
ts2.remove(ts1.get(i));
else
ts4.add(ts1.get(i));
}
else
{
ts4.add(ts1.get(i));
}
}
System.out.println(ts4);
}
private static ArrayList<Integer> toArray(int n,String str)
{
String split[] = str.split(" ");
Integer a[] = new Integer[n];
for(int i=0;i<a.length;i++)
a[i] = Integer.parseInt(split[i]);
ArrayList<Integer> ts = new ArrayList<Integer>(Arrays.asList(a));
//System.out.println(ts);
return ts;
}
}
|
[
"[email protected]"
] | |
dfa975a65eb4699557ece73cd0a4460acd614fbc
|
97fd02f71b45aa235f917e79dd68b61c62b56c1c
|
/src/main/java/com/tencentcloudapi/dasb/v20191018/models/ResetUserResponse.java
|
c1d13473533dfb0cf151bbb62c5d6f44500881b1
|
[
"Apache-2.0"
] |
permissive
|
TencentCloud/tencentcloud-sdk-java
|
7df922f7c5826732e35edeab3320035e0cdfba05
|
09fa672d75e5ca33319a23fcd8b9ca3d2afab1ec
|
refs/heads/master
| 2023-09-04T10:51:57.854153 | 2023-09-01T03:21:09 | 2023-09-01T03:21:09 | 129,837,505 | 537 | 317 |
Apache-2.0
| 2023-09-13T02:42:03 | 2018-04-17T02:58:16 |
Java
|
UTF-8
|
Java
| false | false | 2,433 |
java
|
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.tencentcloudapi.dasb.v20191018.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class ResetUserResponse extends AbstractModel{
/**
* 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
@SerializedName("RequestId")
@Expose
private String RequestId;
/**
* Get 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @return RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public String getRequestId() {
return this.RequestId;
}
/**
* Set 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
* @param RequestId 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
*/
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
public ResetUserResponse() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public ResetUserResponse(ResetUserResponse source) {
if (source.RequestId != null) {
this.RequestId = new String(source.RequestId);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "RequestId", this.RequestId);
}
}
|
[
"[email protected]"
] | |
5d579b8dd790b9d9dd32f1f4e5f79801c8a57d05
|
04efca1e7edc5abe498434d9923736326f16c367
|
/src/ru/geekbrains/Dz/Dz4/Worksheet.java
|
d753aa368e8bf3665baddb42733399d69f6f9571
|
[] |
no_license
|
Jhon-Mosk/EvgenyPolitiko
|
fa296c67c1012755b919c2e230af5d85c761b68d
|
28033924553856b39748531ad9b35f279be10e0e
|
refs/heads/master
| 2020-03-22T17:44:29.300534 | 2018-08-08T14:59:59 | 2018-08-08T14:59:59 | 139,558,416 | 0 | 0 | null | 2018-07-10T09:33:48 | 2018-07-03T09:15:40 |
Java
|
UTF-8
|
Java
| false | false | 5,603 |
java
|
package ru.geekbrains.Dz.Dz4;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/*Создать окно с тремя полями и кнопкой (поля не активные)
при нажатии на копку появляется новое окно куда можно внести ФИО нажимаем кнопку ОК и окно скрывается
данные переходят в наше первое окно.*/
public class Worksheet {
public static void main(String[] args) {
new Form();
}
}
class Form extends JFrame {
private String surnameText = Form2.getSurnameText();
private String nameText = Form2.getNameText();
private String patronymicText = Form2.getPatronymicText();
public Form() {
setTitle("First Form");
setBounds(800, 300, 400, 400);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
JPanel surnameField = new JPanel();
JPanel nameField = new JPanel();
JPanel patronymicField = new JPanel();
JPanel buttonPanel = new JPanel();
surnameField.setBackground(Color.gray.darker());
nameField.setBackground(Color.gray.darker());
patronymicField.setBackground(Color.gray.darker());
// buttonPanel.setBackground(Color.magenta);
Font font = new Font("Verdana", Font.BOLD, 15);
JLabel jLabSurname = new JLabel(" Surname");
jLabSurname.setFont(font);
JLabel jLabname = new JLabel(" Name");
jLabname.setFont(font);
JLabel jLabPatronymic = new JLabel(" Patronymic");
jLabPatronymic.setFont(font);
setLayout(new GridLayout(7, 1));
add(jLabSurname);
add(surnameField);
add(jLabname);
add(nameField);
add(jLabPatronymic);
add(patronymicField);
// add(new JPanel());
add(buttonPanel);
JTextField surname = new JTextField(surnameText);
JTextField name = new JTextField(nameText);
JTextField patronymic = new JTextField(patronymicText);
JButton jb = new JButton("OK");
surnameField.add(surname);
nameField.add(name);
patronymicField.add(patronymic);
buttonPanel.add(jb);
surname.setPreferredSize(new Dimension(300, 30));
name.setPreferredSize(new Dimension(300, 30));
patronymic.setPreferredSize(new Dimension(300, 30));
surname.setEditable(false);
name.setEditable(false);
patronymic.setEditable(false);
jb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Form2();
setVisible(false);
}
});
setVisible(true);
}
}
class Form2 extends JFrame {
private static String surnameText;
private static String nameText;
private static String patronymicText;
public static String getSurnameText() {
return surnameText;
}
public static String getNameText() {
return nameText;
}
public static String getPatronymicText() {
return patronymicText;
}
public Form2() {
final String[] valueOfFields = new String[3];
setTitle("Second Form");
setBounds(800, 300, 400, 400);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
JPanel surnameField = new JPanel();
JPanel nameField = new JPanel();
JPanel patronymicField = new JPanel();
JPanel buttonPanel = new JPanel();
surnameField.setBackground(Color.gray.darker());
nameField.setBackground(Color.gray.darker());
patronymicField.setBackground(Color.gray.darker());
// buttonPanel.setBackground(Color.magenta);
Font font = new Font("Verdana", Font.BOLD, 15);
JLabel jLabSurname = new JLabel(" Surname");
jLabSurname.setFont(font);
JLabel jLabname = new JLabel(" Name");
jLabname.setFont(font);
JLabel jLabPatronymic = new JLabel(" Patronymic");
jLabPatronymic.setFont(font);
setLayout(new GridLayout(8, 1));
add(new JLabel(" Print your data"));
add(jLabSurname);
add(surnameField);
add(jLabname);
add(nameField);
add(jLabPatronymic);
add(patronymicField);
// add(new JPanel());
add(buttonPanel);
JTextField surname = new JTextField();
JTextField name = new JTextField();
JTextField patronymic = new JTextField();
JButton jb = new JButton("OK");
surnameField.add(surname);
nameField.add(name);
patronymicField.add(patronymic);
buttonPanel.add(jb);
surname.setPreferredSize(new Dimension(300, 30));
name.setPreferredSize(new Dimension(300, 30));
patronymic.setPreferredSize(new Dimension(300, 30));
jb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
valueOfFields[0] = surname.getText();
valueOfFields[1] = name.getText();
valueOfFields[2] = patronymic.getText();
surnameText = valueOfFields[0];
nameText = valueOfFields[1];
patronymicText = valueOfFields[2];
new Form();
setVisible(false);
}
});
setVisible(true);
}
}
|
[
"[email protected]"
] | |
6d37628cc0720f91ebaefdd567a4f67b717bd466
|
b35416bc8d54516e19ffe9d883bc7b886e65bfe5
|
/J_WB-master/src/workbook/StepD/D08.java
|
14cf8283df95870f98d930433997768d3773034c
|
[] |
no_license
|
Hyunoopark/java-workbook-2019
|
7d777097624fc83165886c26f08ddb90fa57dc84
|
eb1eb16e0712ee290bea8778f12ac6aba4d8974c
|
refs/heads/master
| 2020-04-11T18:15:50.803328 | 2019-01-27T06:46:52 | 2019-01-27T06:46:52 | 161,991,892 | 0 | 0 | null | null | null | null |
UHC
|
Java
| false | false | 709 |
java
|
package workbook.StepD;
import java.util.Scanner;
public class D08 {
private int a, b, c;
private int x_begin, x_end;
private int x, y;
public D08() {
input();
}
public void print2() {
for(x = x_begin; x <= x_end; x++) {
y = a * x * x + b * x + c;
System.out.printf("좌표 (%d, %d) \n",x,y);
}
}
void input() {
Scanner s = new Scanner(System.in);
System.out.print("1차 함수 y=ax^2+bx+c의 계수 a와 b, c를 입력하시오");
this.a = s.nextInt();
this.b = s.nextInt();
this.c = s.nextInt();
System.out.print("x좌표의 시작 값과 끝 값을 입력하시오");
this.x_begin = s.nextInt();
this.x_end = s.nextInt();
}
}
|
[
"현우@192.168.25.30"
] |
현우@192.168.25.30
|
fa52363a44234e032b1a75924f98b9f052bdf2f6
|
8777c33487e92efc05e4c73bc82289687e88447d
|
/src/main/java/com/weather/model/WeatherDetails.java
|
50ac804b154b233a4eab8e6357beb85f175c719b
|
[] |
no_license
|
kamalmeetsingh/weatherapi
|
1870d92c706102a0801adef717bf1c542fc01bfc
|
26df23dafc6aa32125695b46dcfd9bedfd1b3095
|
refs/heads/master
| 2022-11-13T14:19:00.678803 | 2020-07-11T11:49:43 | 2020-07-11T11:49:43 | 278,822,298 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 731 |
java
|
package com.weather.model;
/**
* Model class to manager Weather Details data
* @author kamalmeet.s
*
*/
public class WeatherDetails {
String prediction;
double minimumTemprature;
double maximumTemprature;
public double getMinimumTemprature() {
return minimumTemprature;
}
public void setMinimumTemprature(double minimumTemprature) {
this.minimumTemprature = minimumTemprature;
}
public double getMaximumTemprature() {
return maximumTemprature;
}
public void setMaximumTemprature(double maximumTemprature) {
this.maximumTemprature = maximumTemprature;
}
public String getPrediction() {
return prediction;
}
public void setPrediction(String prediction) {
this.prediction = prediction;
}
}
|
[
"[email protected]"
] | |
34d6ec86b230e099a6d7a11388ea3d12bdc22094
|
635b5f6b5de61514df171b0bee305bed2f6443e6
|
/app/src/test/java/de/rvwbk/eit72/bombenentschaerfenapp/ExampleUnitTest.java
|
627d336c7b3cf7eba43de3333813e0a9d578804b
|
[] |
no_license
|
eit72/BombenEntschaerfenApp
|
0ccd0af2af03d996c1124cfbce68ac22aafd4175
|
f4df00cd2f6b6f2ae34f75b1ff84b20833fdc17d
|
refs/heads/develop
| 2020-05-28T00:09:36.073616 | 2019-06-17T09:49:28 | 2019-06-17T09:49:28 | 188,828,146 | 0 | 2 | null | 2019-06-17T09:38:04 | 2019-05-27T11:10:59 |
Java
|
UTF-8
|
Java
| false | false | 397 |
java
|
package de.rvwbk.eit72.bombenentschaerfenapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
eae0a8b7789b25175f95a01ee7c96ea49189c93b
|
412c0219b8b005ca2cfa8a53b78e755e96232de6
|
/MyBatisLearn/src/com/sxt/mybatislearn/TbContentExample.java
|
aac8b94d957096568da58da65729773ea28b839c
|
[] |
no_license
|
hackaming/btoc
|
d72d73606361c470e4709cb90da99271b4678034
|
5f5f4dadd0bb6d9cc8ecdb48f95e0f8f0298ab26
|
refs/heads/master
| 2022-12-19T13:21:51.018801 | 2019-10-22T00:23:17 | 2019-10-22T00:23:17 | 203,745,754 | 0 | 0 | null | 2022-12-16T05:46:24 | 2019-08-22T08:09:03 |
Java
|
UTF-8
|
Java
| false | false | 30,066 |
java
|
package com.sxt.mybatislearn;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class TbContentExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public TbContentExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCategoryIdIsNull() {
addCriterion("category_id is null");
return (Criteria) this;
}
public Criteria andCategoryIdIsNotNull() {
addCriterion("category_id is not null");
return (Criteria) this;
}
public Criteria andCategoryIdEqualTo(Long value) {
addCriterion("category_id =", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotEqualTo(Long value) {
addCriterion("category_id <>", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThan(Long value) {
addCriterion("category_id >", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThanOrEqualTo(Long value) {
addCriterion("category_id >=", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdLessThan(Long value) {
addCriterion("category_id <", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdLessThanOrEqualTo(Long value) {
addCriterion("category_id <=", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdIn(List<Long> values) {
addCriterion("category_id in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotIn(List<Long> values) {
addCriterion("category_id not in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdBetween(Long value1, Long value2) {
addCriterion("category_id between", value1, value2, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotBetween(Long value1, Long value2) {
addCriterion("category_id not between", value1, value2, "categoryId");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andSubTitleIsNull() {
addCriterion("sub_title is null");
return (Criteria) this;
}
public Criteria andSubTitleIsNotNull() {
addCriterion("sub_title is not null");
return (Criteria) this;
}
public Criteria andSubTitleEqualTo(String value) {
addCriterion("sub_title =", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotEqualTo(String value) {
addCriterion("sub_title <>", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleGreaterThan(String value) {
addCriterion("sub_title >", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleGreaterThanOrEqualTo(String value) {
addCriterion("sub_title >=", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLessThan(String value) {
addCriterion("sub_title <", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLessThanOrEqualTo(String value) {
addCriterion("sub_title <=", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleLike(String value) {
addCriterion("sub_title like", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotLike(String value) {
addCriterion("sub_title not like", value, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleIn(List<String> values) {
addCriterion("sub_title in", values, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotIn(List<String> values) {
addCriterion("sub_title not in", values, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleBetween(String value1, String value2) {
addCriterion("sub_title between", value1, value2, "subTitle");
return (Criteria) this;
}
public Criteria andSubTitleNotBetween(String value1, String value2) {
addCriterion("sub_title not between", value1, value2, "subTitle");
return (Criteria) this;
}
public Criteria andTitleDescIsNull() {
addCriterion("title_desc is null");
return (Criteria) this;
}
public Criteria andTitleDescIsNotNull() {
addCriterion("title_desc is not null");
return (Criteria) this;
}
public Criteria andTitleDescEqualTo(String value) {
addCriterion("title_desc =", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescNotEqualTo(String value) {
addCriterion("title_desc <>", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescGreaterThan(String value) {
addCriterion("title_desc >", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescGreaterThanOrEqualTo(String value) {
addCriterion("title_desc >=", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescLessThan(String value) {
addCriterion("title_desc <", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescLessThanOrEqualTo(String value) {
addCriterion("title_desc <=", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescLike(String value) {
addCriterion("title_desc like", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescNotLike(String value) {
addCriterion("title_desc not like", value, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescIn(List<String> values) {
addCriterion("title_desc in", values, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescNotIn(List<String> values) {
addCriterion("title_desc not in", values, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescBetween(String value1, String value2) {
addCriterion("title_desc between", value1, value2, "titleDesc");
return (Criteria) this;
}
public Criteria andTitleDescNotBetween(String value1, String value2) {
addCriterion("title_desc not between", value1, value2, "titleDesc");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andPicIsNull() {
addCriterion("pic is null");
return (Criteria) this;
}
public Criteria andPicIsNotNull() {
addCriterion("pic is not null");
return (Criteria) this;
}
public Criteria andPicEqualTo(String value) {
addCriterion("pic =", value, "pic");
return (Criteria) this;
}
public Criteria andPicNotEqualTo(String value) {
addCriterion("pic <>", value, "pic");
return (Criteria) this;
}
public Criteria andPicGreaterThan(String value) {
addCriterion("pic >", value, "pic");
return (Criteria) this;
}
public Criteria andPicGreaterThanOrEqualTo(String value) {
addCriterion("pic >=", value, "pic");
return (Criteria) this;
}
public Criteria andPicLessThan(String value) {
addCriterion("pic <", value, "pic");
return (Criteria) this;
}
public Criteria andPicLessThanOrEqualTo(String value) {
addCriterion("pic <=", value, "pic");
return (Criteria) this;
}
public Criteria andPicLike(String value) {
addCriterion("pic like", value, "pic");
return (Criteria) this;
}
public Criteria andPicNotLike(String value) {
addCriterion("pic not like", value, "pic");
return (Criteria) this;
}
public Criteria andPicIn(List<String> values) {
addCriterion("pic in", values, "pic");
return (Criteria) this;
}
public Criteria andPicNotIn(List<String> values) {
addCriterion("pic not in", values, "pic");
return (Criteria) this;
}
public Criteria andPicBetween(String value1, String value2) {
addCriterion("pic between", value1, value2, "pic");
return (Criteria) this;
}
public Criteria andPicNotBetween(String value1, String value2) {
addCriterion("pic not between", value1, value2, "pic");
return (Criteria) this;
}
public Criteria andPic2IsNull() {
addCriterion("pic2 is null");
return (Criteria) this;
}
public Criteria andPic2IsNotNull() {
addCriterion("pic2 is not null");
return (Criteria) this;
}
public Criteria andPic2EqualTo(String value) {
addCriterion("pic2 =", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2NotEqualTo(String value) {
addCriterion("pic2 <>", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2GreaterThan(String value) {
addCriterion("pic2 >", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2GreaterThanOrEqualTo(String value) {
addCriterion("pic2 >=", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2LessThan(String value) {
addCriterion("pic2 <", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2LessThanOrEqualTo(String value) {
addCriterion("pic2 <=", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2Like(String value) {
addCriterion("pic2 like", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2NotLike(String value) {
addCriterion("pic2 not like", value, "pic2");
return (Criteria) this;
}
public Criteria andPic2In(List<String> values) {
addCriterion("pic2 in", values, "pic2");
return (Criteria) this;
}
public Criteria andPic2NotIn(List<String> values) {
addCriterion("pic2 not in", values, "pic2");
return (Criteria) this;
}
public Criteria andPic2Between(String value1, String value2) {
addCriterion("pic2 between", value1, value2, "pic2");
return (Criteria) this;
}
public Criteria andPic2NotBetween(String value1, String value2) {
addCriterion("pic2 not between", value1, value2, "pic2");
return (Criteria) this;
}
public Criteria andCreatedIsNull() {
addCriterion("created is null");
return (Criteria) this;
}
public Criteria andCreatedIsNotNull() {
addCriterion("created is not null");
return (Criteria) this;
}
public Criteria andCreatedEqualTo(Date value) {
addCriterion("created =", value, "created");
return (Criteria) this;
}
public Criteria andCreatedNotEqualTo(Date value) {
addCriterion("created <>", value, "created");
return (Criteria) this;
}
public Criteria andCreatedGreaterThan(Date value) {
addCriterion("created >", value, "created");
return (Criteria) this;
}
public Criteria andCreatedGreaterThanOrEqualTo(Date value) {
addCriterion("created >=", value, "created");
return (Criteria) this;
}
public Criteria andCreatedLessThan(Date value) {
addCriterion("created <", value, "created");
return (Criteria) this;
}
public Criteria andCreatedLessThanOrEqualTo(Date value) {
addCriterion("created <=", value, "created");
return (Criteria) this;
}
public Criteria andCreatedIn(List<Date> values) {
addCriterion("created in", values, "created");
return (Criteria) this;
}
public Criteria andCreatedNotIn(List<Date> values) {
addCriterion("created not in", values, "created");
return (Criteria) this;
}
public Criteria andCreatedBetween(Date value1, Date value2) {
addCriterion("created between", value1, value2, "created");
return (Criteria) this;
}
public Criteria andCreatedNotBetween(Date value1, Date value2) {
addCriterion("created not between", value1, value2, "created");
return (Criteria) this;
}
public Criteria andUpdatedIsNull() {
addCriterion("updated is null");
return (Criteria) this;
}
public Criteria andUpdatedIsNotNull() {
addCriterion("updated is not null");
return (Criteria) this;
}
public Criteria andUpdatedEqualTo(Date value) {
addCriterion("updated =", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotEqualTo(Date value) {
addCriterion("updated <>", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedGreaterThan(Date value) {
addCriterion("updated >", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedGreaterThanOrEqualTo(Date value) {
addCriterion("updated >=", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedLessThan(Date value) {
addCriterion("updated <", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedLessThanOrEqualTo(Date value) {
addCriterion("updated <=", value, "updated");
return (Criteria) this;
}
public Criteria andUpdatedIn(List<Date> values) {
addCriterion("updated in", values, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotIn(List<Date> values) {
addCriterion("updated not in", values, "updated");
return (Criteria) this;
}
public Criteria andUpdatedBetween(Date value1, Date value2) {
addCriterion("updated between", value1, value2, "updated");
return (Criteria) this;
}
public Criteria andUpdatedNotBetween(Date value1, Date value2) {
addCriterion("updated not between", value1, value2, "updated");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_content
*
* @mbg.generated do_not_delete_during_merge Sun Aug 26 18:16:17 CST 2018
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table tb_content
*
* @mbg.generated Sun Aug 26 18:16:17 CST 2018
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
|
[
"[email protected]"
] | |
8fc29b295af16f8c07ce1b9d59df4e3255c43b8d
|
21a603d64cd1d27d1d81de1bc901e4e1f2c4fce0
|
/ITE Release/eu.fittest.fbk/eu.fittest.cte2selenium/src/main/java/eu/fbk/se/transform/IProgressListener.java
|
0c70c3be2973908d688542ed446c1e823ccc2d98
|
[] |
no_license
|
alebagnato/FITTEST
|
3dc511146a134c0f8d836a8a6af67fcce498cca9
|
b8839c5bd8186b79f3668a4b195836315a8929a0
|
refs/heads/master
| 2016-09-11T07:03:22.224713 | 2014-02-10T12:12:10 | 2014-02-10T12:12:10 | 32,155,665 | 5 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 170 |
java
|
package eu.fbk.se.transform;
public interface IProgressListener {
public void start(int totalWorkLoad);
public void progress(int workload);
public void finish();
}
|
[
"urko.rueda"
] |
urko.rueda
|
2ea5d64ba0a30fce572340b897ff0508d5a0d6d5
|
e7f289bc0e5a6478eafa559546dde0d83ebca470
|
/src/main/java/mate/exception/IllegalArgumentException.java
|
5533c5d1d3e4ee39128f76b68279d9c7d50ff9b6
|
[] |
no_license
|
VladGural/taxi-service
|
988bbd3d3c289ef482ae90c1698f667c08fee580
|
372b8a2513cff7bbc21bd6e8e6be5eb1a45d7dc3
|
refs/heads/master
| 2023-08-19T21:07:43.371314 | 2021-10-21T08:23:34 | 2021-10-21T08:23:34 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 169 |
java
|
package mate.exception;
public class IllegalArgumentException extends Exception {
public IllegalArgumentException(String message) {
super(message);
}
}
|
[
"[email protected]"
] | |
c86580dc8d0395a3e006f6eaa6f461680850ea0e
|
f7def0ab5b7bfbb0f2f9fbb989238f09bf18a93f
|
/servlet/src/test/java/io/undertow/servlet/test/listener/request/async/onError/AsyncServlet3.java
|
8dd8b49205c6087291662cf31acf5d031ef81327
|
[
"Apache-2.0"
] |
permissive
|
stuartwdouglas/undertow
|
9f12ead5426c05b7414dac33b66663fc8112298d
|
1609b26b67030f9ca5a62869f5088087f2d1ecbf
|
refs/heads/master
| 2023-01-11T00:33:15.464202 | 2020-07-28T06:26:37 | 2020-07-28T06:26:37 | 5,106,225 | 1 | 1 |
Apache-2.0
| 2020-07-30T11:07:44 | 2012-07-19T06:22:19 |
Java
|
UTF-8
|
Java
| false | false | 1,551 |
java
|
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* 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 io.undertow.servlet.test.listener.request.async.onError;
import java.io.IOException;
import javax.servlet.AsyncContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AsyncServlet3 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
final AsyncContext ctx = req.startAsync();
ctx.addListener(new SimpleAsyncListener());
ctx.addListener(new AsyncEventListener());
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
ctx.dispatch("/async2");
}
});
thread.start();
}
}
|
[
"[email protected]"
] | |
5dcd5dfd96f48a4e72d82203863f701fbda73ba1
|
8da8939acab7f01279b78e09bc7c4536187694d7
|
/src/main/java/com/bridgelabz/fundoo/note/controller/LabelController.java
|
dfbabdaa05191332cf3429fa929a97eb2de858e8
|
[] |
no_license
|
poojatodkar1407/GlobalException
|
560aaa032c4efffcbe2df7b6a2ed81bfba2ca8d7
|
6169dd545660b1c12db0a9c7242dac112befeaf5
|
refs/heads/master
| 2020-06-30T13:52:24.440168 | 2019-08-06T12:34:12 | 2019-08-06T12:34:12 | 200,846,928 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,524 |
java
|
package com.bridgelabz.fundoo.note.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.bridgelabz.fundoo.note.dto.LabelDTO;
import com.bridgelabz.fundoo.note.dto.NoteDTO;
import com.bridgelabz.fundoo.note.model.Label;
import com.bridgelabz.fundoo.note.service.LabelService;
import com.bridgelabz.fundoo.response.Response;
@RestController
@CrossOrigin(allowedHeaders = "*", origins = "*")
@RequestMapping("/user")
public class LabelController {
@Autowired
private LabelService LabelService;
@PostMapping("/createLabel")
public ResponseEntity<Response> createLabel(@RequestBody LabelDTO labeldto, @RequestHeader String token) {
Response response = LabelService.createLabel(labeldto, token);
return new ResponseEntity<Response>(response, HttpStatus.OK);
}
@PutMapping("/updateLabel")
public ResponseEntity<Response> updateLabel(@RequestBody LabelDTO labeldto, @RequestHeader String token,
@RequestParam long labelId) {
Response response = LabelService.updateLabel(labeldto, token, labelId);
return new ResponseEntity<Response>(response, HttpStatus.ACCEPTED);
}
@PutMapping("/deleteLabel")
public ResponseEntity<Response> deleteLabel(@RequestHeader String token, @RequestParam long labelId) {
Response response = LabelService.deleteLabel(token, labelId);
return new ResponseEntity<Response>(response, HttpStatus.OK);
}
@GetMapping("/getlabel")
List<Label> getLabel(@RequestHeader String token) {
List<Label> listLabel = LabelService.getAllLabelFromUser(token);
return listLabel;
}
@GetMapping("/getLabelwithoutNotes")
List<LabelDTO> getLabel1(@RequestHeader String token)
{
List<LabelDTO> listLabel = LabelService.getAllLabelFromUser1(token);
return listLabel;
}
@PutMapping("/removeLabelFromNote")
public ResponseEntity<Response> removeFromNote(@RequestParam long labelId, @RequestHeader String token,
@RequestParam long noteId) {
Response response = LabelService.removeLabelFromNote(labelId, token, noteId);
return new ResponseEntity<Response>(response, HttpStatus.OK);
}
@PutMapping("/addLabelToNote")
public ResponseEntity<Response> addLabelToNote(@RequestParam long labelId, @RequestHeader String token,
@RequestParam long noteId) {
Response response = LabelService.addLabelToNote(labelId, token, noteId);
return new ResponseEntity<Response>(response, HttpStatus.OK);
}
@GetMapping("/getlabelofnote")
List<LabelDTO> getLebelOfNote(@RequestHeader String token, @RequestParam long noteId) {
List<LabelDTO> listLabel = LabelService.getLabelsOfNote(token, noteId);
return listLabel;
}
@GetMapping("/getNoteOfLabel")
List<NoteDTO> getNoteOfLabel(@RequestHeader String token,@RequestParam long labelId) throws IllegalArgumentException
{
List<NoteDTO>labelList=LabelService.getNotesOfLabel(token, labelId);
return labelList;
}
}
|
[
"[email protected]"
] | |
757e305d7aa11c5a028e45813da465d4de3fc46b
|
b4683f30f29e64b33589a12e1e9b67fc91ec59c1
|
/BigProject/Code/winterShop/src/main/java/com/winterShop/service/model/product/RidingLevelDTO.java
|
77df475e79a0a26f842e71444b3b8cd7220504c6
|
[] |
no_license
|
VictorO10/SoftwareDesign
|
2a548993815712ccf9f4e3cd5e34aa50968109cf
|
65dcdd2b6b6bdb7e1a69354c869e8699befa4fdc
|
refs/heads/master
| 2021-04-15T12:02:34.614296 | 2018-05-28T22:48:48 | 2018-05-28T22:48:48 | 126,187,457 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,499 |
java
|
package com.winterShop.service.model.product;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.winterShop.service.model.product.snowboard.SnowboardBaseDTO;
import com.winterShop.service.model.product.snowboardBoots.SnowboardBootsBaseDTO;
import java.util.Set;
public class RidingLevelDTO {
private Long ridingLevelId;
private String level;
private String levelDescription;
@JsonBackReference(value = "ridingLevelSnowboardBoots")
private Set<SnowboardBootsBaseDTO> snowboardBootsBaseDTOSet;
@JsonBackReference(value = "ridingLevelSnowboard")
private Set<SnowboardBaseDTO> snowboardBaseDTOSet;
public RidingLevelDTO() {
}
public Long getRidingLevelId() {
return ridingLevelId;
}
public void setRidingLevelId(Long ridingLevelId) {
this.ridingLevelId = ridingLevelId;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getLevelDescription() {
return levelDescription;
}
public void setLevelDescription(String levelDescription) {
this.levelDescription = levelDescription;
}
public Set<SnowboardBootsBaseDTO> getSnowboardBootsBaseDTOSet() {
return snowboardBootsBaseDTOSet;
}
public void setSnowboardBootsBaseDTOSet(Set<SnowboardBootsBaseDTO> snowboardBootsBaseDTOSet) {
this.snowboardBootsBaseDTOSet = snowboardBootsBaseDTOSet;
}
public Set<SnowboardBaseDTO> getSnowboardBaseDTOSet() {
return snowboardBaseDTOSet;
}
public void setSnowboardBaseDTOSet(Set<SnowboardBaseDTO> snowboardBaseDTOSet) {
this.snowboardBaseDTOSet = snowboardBaseDTOSet;
}
@Override
public String toString() {
ObjectMapper objectMapper = new ObjectMapper();
try {
return objectMapper.writeValueAsString(this);
} catch (JsonProcessingException e) {
// e.printStackTrace();
return "ridingLevelDTO to jackson error\n";
}
}
@Override
public boolean equals(Object obj) {
RidingLevelDTO ridingLevelDTO = (RidingLevelDTO)obj;
return ridingLevelDTO.getRidingLevelId().intValue() == this.getRidingLevelId().intValue();
}
@Override
public int hashCode() {
return ridingLevelId.intValue();
}
}
|
[
"[email protected]"
] | |
286e65ebc6db509964a2c674bf2b9b192a37fa06
|
c5700d50a420daa2439ae9aad30b31eae59fa430
|
/src/patterns/behavioral/memento/wihte/CareTaker.java
|
a3f10236ec23f823812f3a074e93ae9a2ce38252
|
[] |
no_license
|
lemon-trees/design-pattern
|
bd0d228a071cad4843e0d29791215536efac4dca
|
ab05549212fb290d3142a6d1c74a887047b3cc1a
|
refs/heads/master
| 2020-08-03T03:27:34.025644 | 2019-11-10T12:09:09 | 2019-11-10T12:09:09 | 211,611,657 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 296 |
java
|
package patterns.behavioral.memento.wihte;
public class CareTaker
{
private Memento memento;
public Memento retrieveMemento()
{
return this.memento;
}
public void saveMemento(Memento memento)
{
this.memento = memento;
}
}
|
[
"[email protected]"
] | |
f7f2497f46cd3e3607cc5c0ec5940dca647e71c8
|
fb1843a5eb11059b5b399bb2f75d18ba7c057aa0
|
/src/test/java/com/downloader/image/AppTest.java
|
9d01108d4a720003228645c205f61d80b2f70775
|
[] |
no_license
|
smaximiliano/ImageDownloader
|
f2f45c4079710d5a304d7f5ecb3fab8ddc67d1ed
|
5f043ac2ebb130702a368eaa4445553d80970393
|
refs/heads/master
| 2021-01-10T03:24:41.768561 | 2015-06-02T20:48:09 | 2015-06-02T20:48:09 | 36,759,819 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 648 |
java
|
package com.downloader.image;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
|
[
"[email protected]"
] | |
995a672c9d29774bcfb66145058ef11195b7d385
|
0fc4f527c4ecc706382be7927931ded11d1e74ee
|
/src/main/java/com/example/techthink/persistence/model/Role.java
|
99310109a06395c0235d6ec99799af38cf9244c1
|
[] |
no_license
|
vahe523/techthink
|
6875e47e38d503e438c8ad356744f70b91dc7128
|
72b002eab34d0202eac468a78a1dacc6d8f43aad
|
refs/heads/main
| 2023-07-31T12:11:00.879820 | 2021-09-22T07:28:32 | 2021-09-22T07:28:32 | 400,742,336 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 596 |
java
|
package com.example.techthink.persistence.model;
import javax.persistence.*;
@Entity
public class Role {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Enumerated(EnumType.STRING)
private RoleName name;
public Role() {
}
public Role(RoleName name) {
this.name = name;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public RoleName getName() {
return name;
}
public void setName(RoleName name) {
this.name = name;
}
}
|
[
"[email protected]"
] | |
bf1b86e640fa952673aea33f9ed360ab8a1a2f25
|
3913a14e2cc38ffc08f5ac46b47494170ed451dd
|
/java/src/main/java/com/ibm/watson/data/client/model/SearchResultCategories.java
|
f057e88072d08ae42e4480d9d725e2740147f6db
|
[
"Apache-2.0"
] |
permissive
|
samirvikash/watson-data-api-clients
|
0c143e16ebe7b94f4c643c4748d8e641562e56a6
|
a871aad7d4189ea28b04c2887a63592ae24034fd
|
refs/heads/master
| 2023-06-12T09:27:41.854074 | 2021-05-24T10:05:44 | 2021-05-24T10:05:44 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 7,124 |
java
|
/*
* Copyright 2020 IBM Corp. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.ibm.watson.data.client.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Objects;
/**
* SearchResultCategories
*/
public class SearchResultCategories {
private List<String> secondaryCategoryIds;
private Long lastUpdatedAt;
private List<String> secondaryCategoryGlobalIds;
private String primaryCategoryGlobalId;
private String primaryCategoryId;
private String primaryCategoryName;
private List<String> secondaryCategoryNames;
public SearchResultCategories secondaryCategoryIds(List<String> secondaryCategoryIds) {
this.secondaryCategoryIds = secondaryCategoryIds;
return this;
}
@javax.annotation.Nullable
@JsonProperty("secondary_category_ids")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public List<String> getSecondaryCategoryIds() { return secondaryCategoryIds; }
public void setSecondaryCategoryIds(List<String> secondaryCategoryIds) { this.secondaryCategoryIds = secondaryCategoryIds; }
public SearchResultCategories lastUpdatedAt(Long lastUpdatedAt) {
this.lastUpdatedAt = lastUpdatedAt;
return this;
}
@javax.annotation.Nullable
@JsonProperty("last_updated_at")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public Long getLastUpdatedAt() { return lastUpdatedAt; }
public void setLastUpdatedAt(Long lastUpdatedAt) { this.lastUpdatedAt = lastUpdatedAt; }
public SearchResultCategories secondaryCategoryGlobalIds(List<String> secondaryCategoryGlobalIds) {
this.secondaryCategoryGlobalIds = secondaryCategoryGlobalIds;
return this;
}
@javax.annotation.Nullable
@JsonProperty("secondary_category_global_ids")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public List<String> getSecondaryCategoryGlobalIds() { return secondaryCategoryGlobalIds; }
public void setSecondaryCategoryGlobalIds(List<String> secondaryCategoryGlobalIds) { this.secondaryCategoryGlobalIds = secondaryCategoryGlobalIds; }
public SearchResultCategories primaryCategoryGlobalId(String primaryCategoryGlobalId) {
this.primaryCategoryGlobalId = primaryCategoryGlobalId;
return this;
}
@javax.annotation.Nullable
@JsonProperty("primary_category_global_id")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public String getPrimaryCategoryGlobalId() { return primaryCategoryGlobalId; }
public void setPrimaryCategoryGlobalId(String primaryCategoryGlobalId) { this.primaryCategoryGlobalId = primaryCategoryGlobalId; }
public SearchResultCategories primaryCategoryId(String primaryCategoryId) {
this.primaryCategoryId = primaryCategoryId;
return this;
}
@javax.annotation.Nullable
@JsonProperty("primary_category_id")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public String getPrimaryCategoryId() { return primaryCategoryId; }
public void setPrimaryCategoryId(String primaryCategoryId) { this.primaryCategoryId = primaryCategoryId; }
public SearchResultCategories primaryCategoryName(String primaryCategoryName) {
this.primaryCategoryName = primaryCategoryName;
return this;
}
@javax.annotation.Nullable
@JsonProperty("primary_category_name")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public String getPrimaryCategoryName() { return primaryCategoryName; }
public void setPrimaryCategoryName(String primaryCategoryName) { this.primaryCategoryName = primaryCategoryName; }
public SearchResultCategories secondaryCategoryNames(List<String> secondaryCategoryNames) {
this.secondaryCategoryNames = secondaryCategoryNames;
return this;
}
@javax.annotation.Nullable
@JsonProperty("secondary_category_names")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public List<String> getSecondaryCategoryNames() { return secondaryCategoryNames; }
public void setSecondaryCategoryNames(List<String> secondaryCategoryNames) { this.secondaryCategoryNames = secondaryCategoryNames; }
@Override
public boolean equals(java.lang.Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
SearchResultCategories that = (SearchResultCategories)o;
return Objects.equals(this.secondaryCategoryIds, that.secondaryCategoryIds) &&
Objects.equals(this.lastUpdatedAt, that.lastUpdatedAt) &&
Objects.equals(this.secondaryCategoryGlobalIds, that.secondaryCategoryGlobalIds) &&
Objects.equals(this.primaryCategoryGlobalId, that.primaryCategoryGlobalId) &&
Objects.equals(this.primaryCategoryId, that.primaryCategoryId) &&
Objects.equals(this.primaryCategoryName, that.primaryCategoryName) &&
Objects.equals(this.secondaryCategoryNames, that.secondaryCategoryNames);
}
@Override
public int hashCode() {
return Objects.hash(secondaryCategoryIds, lastUpdatedAt, secondaryCategoryGlobalIds,
primaryCategoryGlobalId, primaryCategoryId, primaryCategoryName, secondaryCategoryNames);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SearchResultCategories {\n");
sb.append(" secondaryCategoryIds: ").append(toIndentedString(secondaryCategoryIds)).append("\n");
sb.append(" lastUpdatedAt: ").append(toIndentedString(lastUpdatedAt)).append("\n");
sb.append(" secondaryCategoryGlobalIds: ").append(toIndentedString(secondaryCategoryGlobalIds)).append("\n");
sb.append(" primaryCategoryGlobalId: ").append(toIndentedString(primaryCategoryGlobalId)).append("\n");
sb.append(" primaryCategoryId: ").append(toIndentedString(primaryCategoryId)).append("\n");
sb.append(" primaryCategoryName: ").append(toIndentedString(primaryCategoryName)).append("\n");
sb.append(" secondaryCategoryNames: ").append(toIndentedString(secondaryCategoryNames)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) { return "null"; }
return o.toString().replace("\n", "\n ");
}
}
|
[
"[email protected]"
] | |
2a7be519e6f5538ec251973c56ec9f8a829d76fa
|
97b7aff209ae51cbeed468258e99605b4722736e
|
/PM/app/src/androidTest/java/com/pofilemanager/wasif/pm/ExampleInstrumentedTest.java
|
725ae99be9ed8c88ab910bb7bda6a62975cf413c
|
[] |
no_license
|
Wasifur96/Profile-Manager-Android
|
b8aa3d17f1cd0b5ebd08e35bb6f53387b78d16d6
|
10efb71cff7af2ff6d5569638d03e09b15fb8b3f
|
refs/heads/master
| 2020-03-28T21:16:42.987446 | 2018-09-17T15:04:55 | 2018-09-17T15:04:55 | 149,143,578 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 753 |
java
|
package com.pofilemanager.wasif.pm;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.pofilemanager.wasif.pm", appContext.getPackageName());
}
}
|
[
"[email protected]"
] | |
fe7ef85ee3f262cf3c63f72b1439cb0d6068fb94
|
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
|
/src/number_of_direct_superinterfaces/i5501.java
|
124c00d51115ea72261c51a14afc25823c889d9e
|
[] |
no_license
|
vincentclee/jvm-limits
|
b72a2f2dcc18caa458f1e77924221d585f23316b
|
2fd1c26d1f7984ea8163bc103ad14b6d72282281
|
refs/heads/master
| 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 68 |
java
|
package number_of_direct_superinterfaces;
public interface i5501 {}
|
[
"[email protected]"
] | |
7e5e65c3865b2670dbbf000069e6f0eea06eb595
|
d992804c678e744e50583d736764c296f3f1ce8f
|
/analyzer-service/src/main/java/com/qianyitian/hope2/analyzer/engine/function/Grl2YearFunction.java
|
d44ece2a446ca1399e439c3956de004e7948bbeb
|
[
"Apache-2.0"
] |
permissive
|
jedixxx007/hope2
|
cb2fe8269bd67a42ac360a079287c6c53f79d1a6
|
aa532258da05a8fbecafda9e31e3061354d15a77
|
refs/heads/master
| 2023-06-28T19:35:13.117567 | 2021-08-03T12:48:11 | 2021-08-03T12:48:11 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 672 |
java
|
package com.qianyitian.hope2.analyzer.engine.function;
import com.googlecode.aviator.runtime.function.AbstractFunction;
import com.googlecode.aviator.runtime.type.AviatorDouble;
import com.googlecode.aviator.runtime.type.AviatorObject;
import com.qianyitian.hope2.analyzer.funds.model.FundProfileInfo;
import java.util.Map;
public class Grl2YearFunction extends AbstractFunction {
@Override
public AviatorObject call(Map<String, Object> env) {
FundProfileInfo fundDetail = (FundProfileInfo) env.get("fund");
return new AviatorDouble(fundDetail.getGrl2Year());
}
@Override
public String getName() {
return "grl2Year";
}
}
|
[
"[email protected]"
] | |
28794666241ead2ae846adee89c5bccb69ce0660
|
ce83a5410333611a1564daceaec103a571549926
|
/WelcometoUT/app/src/test/java/jdo589/welcometout/ExampleUnitTest.java
|
d18e4b3548da084f9d8dac475fc571d97e73e0cb
|
[] |
no_license
|
savethequinn/MobileHW4
|
a02ac022ce9f70aa5d80fe29fec7692f3183ebc7
|
ac21669410263c88bcaa7e05c48fbb49c7cf9b8b
|
refs/heads/master
| 2016-09-14T08:03:42.162010 | 2016-04-25T00:04:16 | 2016-04-25T00:04:16 | 56,599,141 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 311 |
java
|
package jdo589.welcometout;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"[email protected]"
] | |
a1a93233ff7b569fd99fa5fdbb4b2eef58d6e9e1
|
592e33fd3bce23548b55d8a239937876d4b26be1
|
/Lesson15 Introduction to OOP. Classes and Objects/telephone/DemoPhone.java
|
faa6f79eb622639515b3fc8ebdfbb5e2b61c1fd1
|
[] |
no_license
|
yordanovMario/ITTalentsTrainingCamp
|
0c3c35ec304cd0be30cf7524f6124e58da5dc744
|
14160d3087ec3f14f9b0d864e0f360dcca52e307
|
refs/heads/master
| 2021-01-21T11:23:04.800171 | 2017-05-16T11:32:55 | 2017-05-16T11:32:55 | 83,560,502 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 627 |
java
|
package telephone;
public class DemoPhone {
public static void main(String[] args) {
Gsm iphone = new Gsm("iPhone 6");
Gsm samsung = new Gsm("Samsung Galaxy S4");
iphone.insertSimCard("0888732573");
samsung.insertSimCard("0879274037");
iphone.call(samsung, 6);
samsung.call(iphone, 3.5);
iphone.call(samsung, 4.3);
iphone.printInfoForTheLastIncomingCall();
iphone.printInfoForTheLastOutgoingCall();
samsung.printInfoForTheLastIncomingCall();
samsung.printInfoForTheLastOutgoingCall();
System.out.println(iphone.getSumForCall());
System.out.println(samsung.getSumForCall());
}
}
|
[
"[email protected]"
] | |
ae744b70c256ef787a2dfacd4d2f4ca67b1b3407
|
79595075622ded0bf43023f716389f61d8e96e94
|
/app/src/main/java/com/android/org/bouncycastle/crypto/signers/ECDSASigner.java
|
4defa02c4906be09b88f8c5cd37d74b7bb593f78
|
[] |
no_license
|
dstmath/OppoR15
|
96f1f7bb4d9cfad47609316debc55095edcd6b56
|
b9a4da845af251213d7b4c1b35db3e2415290c96
|
refs/heads/master
| 2020-03-24T16:52:14.198588 | 2019-05-27T02:24:53 | 2019-05-27T02:24:53 | 142,840,716 | 7 | 4 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,576 |
java
|
package com.android.org.bouncycastle.crypto.signers;
import com.android.org.bouncycastle.crypto.CipherParameters;
import com.android.org.bouncycastle.crypto.DSA;
import com.android.org.bouncycastle.crypto.params.ECDomainParameters;
import com.android.org.bouncycastle.crypto.params.ECKeyParameters;
import com.android.org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import com.android.org.bouncycastle.crypto.params.ECPublicKeyParameters;
import com.android.org.bouncycastle.crypto.params.ParametersWithRandom;
import com.android.org.bouncycastle.math.ec.ECAlgorithms;
import com.android.org.bouncycastle.math.ec.ECConstants;
import com.android.org.bouncycastle.math.ec.ECCurve;
import com.android.org.bouncycastle.math.ec.ECFieldElement;
import com.android.org.bouncycastle.math.ec.ECMultiplier;
import com.android.org.bouncycastle.math.ec.ECPoint;
import com.android.org.bouncycastle.math.ec.FixedPointCombMultiplier;
import java.math.BigInteger;
import java.security.SecureRandom;
public class ECDSASigner implements ECConstants, DSA {
private final DSAKCalculator kCalculator;
private ECKeyParameters key;
private SecureRandom random;
public ECDSASigner() {
this.kCalculator = new RandomDSAKCalculator();
}
public ECDSASigner(DSAKCalculator kCalculator) {
this.kCalculator = kCalculator;
}
public void init(boolean forSigning, CipherParameters param) {
SecureRandom providedRandom = null;
if (!forSigning) {
this.key = (ECPublicKeyParameters) param;
} else if (param instanceof ParametersWithRandom) {
ParametersWithRandom rParam = (ParametersWithRandom) param;
this.key = (ECPrivateKeyParameters) rParam.getParameters();
providedRandom = rParam.getRandom();
} else {
this.key = (ECPrivateKeyParameters) param;
}
this.random = initSecureRandom(forSigning ? this.kCalculator.isDeterministic() ^ 1 : false, providedRandom);
}
public BigInteger[] generateSignature(byte[] message) {
ECDomainParameters ec = this.key.getParameters();
BigInteger n = ec.getN();
BigInteger e = calculateE(n, message);
BigInteger d = ((ECPrivateKeyParameters) this.key).getD();
if (this.kCalculator.isDeterministic()) {
this.kCalculator.init(n, d, message);
} else {
this.kCalculator.init(n, this.random);
}
ECMultiplier basePointMultiplier = createBasePointMultiplier();
while (true) {
BigInteger k = this.kCalculator.nextK();
BigInteger r = basePointMultiplier.multiply(ec.getG(), k).normalize().getAffineXCoord().toBigInteger().mod(n);
if (!r.equals(ZERO)) {
if (!k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n).equals(ZERO)) {
return new BigInteger[]{r, k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)};
}
}
}
}
public boolean verifySignature(byte[] message, BigInteger r, BigInteger s) {
ECDomainParameters ec = this.key.getParameters();
BigInteger n = ec.getN();
BigInteger e = calculateE(n, message);
if (r.compareTo(ONE) < 0 || r.compareTo(n) >= 0) {
return false;
}
if (s.compareTo(ONE) < 0 || s.compareTo(n) >= 0) {
return false;
}
BigInteger c = s.modInverse(n);
ECPoint point = ECAlgorithms.sumOfTwoMultiplies(ec.getG(), e.multiply(c).mod(n), ((ECPublicKeyParameters) this.key).getQ(), r.multiply(c).mod(n));
if (point.isInfinity()) {
return false;
}
ECCurve curve = point.getCurve();
if (curve != null) {
BigInteger cofactor = curve.getCofactor();
if (cofactor != null && cofactor.compareTo(EIGHT) <= 0) {
ECFieldElement D = getDenominator(curve.getCoordinateSystem(), point);
if (!(D == null || (D.isZero() ^ 1) == 0)) {
ECFieldElement X = point.getXCoord();
while (curve.isValidFieldElement(r)) {
if (curve.fromBigInteger(r).multiply(D).equals(X)) {
return true;
}
r = r.add(n);
}
return false;
}
}
}
return point.normalize().getAffineXCoord().toBigInteger().mod(n).equals(r);
}
protected BigInteger calculateE(BigInteger n, byte[] message) {
int log2n = n.bitLength();
int messageBitLength = message.length * 8;
BigInteger e = new BigInteger(1, message);
if (log2n < messageBitLength) {
return e.shiftRight(messageBitLength - log2n);
}
return e;
}
protected ECMultiplier createBasePointMultiplier() {
return new FixedPointCombMultiplier();
}
protected ECFieldElement getDenominator(int coordinateSystem, ECPoint p) {
switch (coordinateSystem) {
case 1:
case 6:
case 7:
return p.getZCoord(0);
case 2:
case 3:
case 4:
return p.getZCoord(0).square();
default:
return null;
}
}
protected SecureRandom initSecureRandom(boolean needed, SecureRandom provided) {
if (needed) {
return provided == null ? new SecureRandom() : provided;
} else {
return null;
}
}
}
|
[
"[email protected]"
] | |
2a3a15e3210edd0154202e552809f5be0ee5fc73
|
4bec34f9f496db1f092d71b3dedbc77e2b9d2ee1
|
/cbs.api.contest.dao/src/main/java/com/lifeix/cbs/contest/dto/fb/FbContestExt.java
|
b873db3182ba34d118465aae9ed39c994432795e
|
[] |
no_license
|
888xin/cbs.api
|
08ec358363f1d7a0fc9037cf6746cc441c879497
|
d9667aa1933fd9f0e02d2be97bc8aa7b8c8fe782
|
refs/heads/master
| 2020-03-27T07:14:56.367782 | 2018-08-26T11:49:04 | 2018-08-26T11:50:00 | 146,175,221 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,430 |
java
|
package com.lifeix.cbs.contest.dto.fb;
import java.io.Serializable;
public class FbContestExt implements Serializable {
private static final long serialVersionUID = -8991527363577124824L;
private Long contestId;
private Long targetId;
private String homeTeamExt;
private String awayTeamExt;
private String lineups;
private String scores;
private Integer status;
private String goals;
private String penalties;
private String cards;
private String substitutions;
private String referee;
private String venue;
public FbContestExt() {
super();
}
public Long getContestId() {
return contestId;
}
public void setContestId(Long contestId) {
this.contestId = contestId;
}
public Long getTargetId() {
return targetId;
}
public void setTargetId(Long targetId) {
this.targetId = targetId;
}
public String getHomeTeamExt() {
return homeTeamExt;
}
public void setHomeTeamExt(String homeTeamExt) {
this.homeTeamExt = homeTeamExt;
}
public String getAwayTeamExt() {
return awayTeamExt;
}
public void setAwayTeamExt(String awayTeamExt) {
this.awayTeamExt = awayTeamExt;
}
public String getScores() {
return scores;
}
public void setScores(String scores) {
this.scores = scores;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getGoals() {
return goals;
}
public void setGoals(String goals) {
this.goals = goals;
}
public String getPenalties() {
return penalties;
}
public void setPenalties(String penalties) {
this.penalties = penalties;
}
public String getCards() {
return cards;
}
public void setCards(String cards) {
this.cards = cards;
}
public String getSubstitutions() {
return substitutions;
}
public void setSubstitutions(String substitutions) {
this.substitutions = substitutions;
}
public String getReferee() {
return referee;
}
public void setReferee(String referee) {
this.referee = referee;
}
public String getVenue() {
return venue;
}
public void setVenue(String venue) {
this.venue = venue;
}
public String getLineups() {
return lineups;
}
public void setLineups(String lineups) {
this.lineups = lineups;
}
}
|
[
"[email protected]"
] | |
1d9549402825f5782f1d9ce3cb49dc3b7dda71fa
|
070a7be0909cda4df4ed88af531e8b0d7111d239
|
/WEB-INF/src/Action/ChatRoomAction.java
|
50251e8eb068bcd17887b7e08772c49efb8776f7
|
[] |
no_license
|
shitake4/ChatSystem
|
5c15c264724cb53a8ca0fbc50a754da36b328172
|
cf0581887bedca7671a05558538dcfff7978071c
|
refs/heads/master
| 2021-01-10T18:26:11.186699 | 2015-04-08T05:07:47 | 2015-04-08T05:07:47 | 30,230,290 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 8,171 |
java
|
package Action;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ResourceBundle;
import javax.mail.internet.AddressException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import Entity.AccountInfo;
import Entity.AllInfo;
import Entity.ChatContents;
import Entity.ChatRoomInfo;
import Entity.ErrorMessage;
import Interface.BaseAction;
import Interface.BaseLoginout;
import Model.GetLoginUserInfo;
import Model.Notice;
import Model.SelectDBManager;
import Model.SetRequest;
import Model.UpdateDBManager;
public class ChatRoomAction implements BaseAction, BaseLoginout {
private static Logger logger = LoggerFactory.getLogger(ChatRoomAction.class
.getName());
private static ResourceBundle property = ResourceBundle
.getBundle("SetPhrases");
private static UpdateDBManager UpdateDBManager = new UpdateDBManager();
private static SelectDBManager SelectDBManager = new SelectDBManager();
@Override
public String register(HttpServletRequest req, Object ob) {
// TODO Auto-generated method stub
ArrayList<AllInfo> accountAllInfo = (ArrayList<AllInfo>) ob;
int sqlResult = 0;
String url = null;
// DB入れる用変数
String roomName = accountAllInfo.get(0).getRoomName();
String roomPass = accountAllInfo.get(0).getRoomPass();
List<Integer> chatMember = new ArrayList<Integer>();
for (int i = 0; i < accountAllInfo.size(); i++) {
chatMember.add(i, accountAllInfo.get(i).getAccountId());
}
try {
sqlResult = Model.UpdateDBManager.creatChatRoom(roomName, chatMember,
roomPass);
int accountId = accountAllInfo.get(0).getAccountId();
sqlResult = UpdateDBManager.giveAuthority(accountId);
HttpSession session = req.getSession();
String message = "チャットルームを作成しました";
Notice notice = new Notice();
String fromName = SelectDBManager.getAccountName(accountId);
for (int i = 1; i < chatMember.size(); i++) {
int memmberId = chatMember.get(i);
try {
notice.sendMail(memmberId, roomName, fromName);
} catch (AddressException e) {
// TODO Auto-generated catch block
logger.error(property.getString("sql"), e);
}
}
session.setAttribute("result", message);
url = property.getString("chatListServlet");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn(property.getString("sql"), e);
}
if (sqlResult == 0) {
logger.warn(property.getString("sqlInsert"));
} else {
logger.info(property.getString("SuccessSql"));
}
return url;
}
@Override
public String moidfy(HttpServletRequest req, Object ob) {
// TODO Auto-generated method stub
return null;
}
@Override
public String remove(HttpServletRequest req, Object ob) {
// TODO Auto-generated method stub
return null;
}
@Override
public String reload(HttpServletRequest req, Object ob) {
// TODO Auto-generated method stub
AllInfo allInfo = (AllInfo) ob;
String url = null;
int chatId = allInfo.getChatId();
int accountId = allInfo.getAccountId();
if (chatId == 0) {
HttpSession session = req.getSession();
chatId = (int) session.getAttribute("chatId");
}
int sqlResult = 0;
try {
sqlResult = Model.UpdateDBManager.insertChatRoomMember(chatId, accountId);
} catch (SQLException e) {
}
if (sqlResult != 0) {
String joinMessage = "チャットルームに参加しました。";
String name = GetLoginUserInfo.getName(req);
try {
Model.UpdateDBManager.insertAdminContentJoin(chatId, name);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn(property.getString("sql"), e);
}
HttpSession session = req.getSession();
session.setAttribute("joinMessage", joinMessage);
}
try {
List<ChatContents> chatContentsList = new ArrayList<ChatContents>();
ArrayList<AccountInfo> chatMemberList = new ArrayList<AccountInfo>();
ChatRoomInfo chatRoomInfo = new ChatRoomInfo();
AllInfo authorityInfo = new AllInfo();
ArrayList<AccountInfo> chatRoomfriendsList = new ArrayList<AccountInfo>();
chatContentsList = Model.SelectDBManager.selectChatContents(chatId);
chatMemberList = Model.SelectDBManager.selectChatRoomMember(chatId);
chatRoomInfo = Model.SelectDBManager.selectChatInfo(chatId);
authorityInfo = SelectDBManager.chechChatRoomAuthority(chatId, accountId);
chatRoomfriendsList = Model.SelectDBManager.getChatRoomFriendsList(
chatId, accountId);
if (chatRoomfriendsList.size() == 0) {
logger.info("friendsListは空です");
String tmp = null;
req.setAttribute("friendsListIsNull", tmp);
} else {
logger.info("friendsListは中身が入ってます");
int tmp = 1;
req.setAttribute("friendsListIsNull", tmp);
}
// session から requestにセット
SetRequest setRequest = new SetRequest();
setRequest.setError(req);
setRequest.setStatus(req);
setRequest.setJoinMessage(req);
Collections.reverse(chatContentsList);
req.setAttribute("friendsList", chatRoomfriendsList);
req.setAttribute("chatContentsList", chatContentsList);
req.setAttribute("chatMemberList", chatMemberList);
req.setAttribute("chatRoomInfo", chatRoomInfo);
req.setAttribute("authorityInfo", authorityInfo);
url = property.getString("chatRoomJsp");
} catch (SQLException e) {
url = property.getString("errorJsp");
logger.error(property.getString("sql"), e);
}
return url;
}
@Override
public String login(HttpServletRequest req, Object ob) {
// TODO Auto-generated method stub
AllInfo allInfo = (AllInfo) ob;
int chatId = allInfo.getChatId();
String roomPass = allInfo.getRoomPass();
String accountName = allInfo.getName();
int accountId = allInfo.getAccountId();
int sqlResult = 0;
SelectDBManager dbManager = new SelectDBManager();
if (roomPass == null || roomPass.equals("")) {
try {
sqlResult = dbManager.checkRoomPassIsNull(chatId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn(property.getString("sqlSelect"), e);
}
} else {
try {
sqlResult = dbManager.checkRoomPass(chatId, roomPass);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.warn(property.getString("sqlSelect"), e);
}
}
String url = null;
// sqlチェック
if (sqlResult == 0) {
ErrorMessage error = new ErrorMessage();
error.setMessage("パスワードが一致しません");
HttpSession session = req.getSession();
session.setAttribute("error", error);
url = property.getString("chatListServlet");
} else {
boolean Result = false;
try {
Result = Model.SelectDBManager.checkRoomMemberOrNot(chatId, accountId);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (!Result) {
try {
Model.UpdateDBManager.insertAdminContentJoin(chatId, accountName);
Model.UpdateDBManager.insertChatRoomMember(chatId, accountId);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
req.setAttribute("chatId", chatId);
url = property.getString("chatRoomServlet") + "?chatId=" + chatId;
}
return url;
}
@Override
public String logout(HttpServletRequest req) {
// TODO Auto-generated method stub
return null;
}
@Override
public String reload(HttpServletRequest req) {
// TODO Auto-generated method stub
return null;
}
}
|
[
"[email protected]"
] | |
4197f186fc9c598be629caca7ab46f1538695fb9
|
e9cd71322a57685336933b5e9500feed10783faf
|
/src/org/apache/catalina/util/LifecycleSupport.java
|
19f0b013ad674ba513cadd1e2e5e2faef1592283
|
[] |
no_license
|
thewangzl/tomcat_learn
|
bceaa19e0839fac1acfbd77dfbf65c11861d6c6e
|
e34758912fe8eeabfece3032e1cb69f74579853f
|
refs/heads/master
| 2020-12-02T12:46:11.806326 | 2017-07-26T03:49:06 | 2017-07-26T03:49:06 | 96,507,848 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,626 |
java
|
package org.apache.catalina.util;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
public final class LifecycleSupport {
private Lifecycle lifecycle;
private LifecycleListener[] listeners = new LifecycleListener[0];
public LifecycleSupport(Lifecycle lifecycle) {
this.lifecycle = lifecycle;
}
public void fireLifecycleEvent(String type, Object data){
LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
LifecycleListener[] interested = null;
synchronized (listeners) {
interested = listeners.clone();
}
for (int i = 0; i < interested.length; i++) {
interested[i].lifecycleEvent(event);
}
}
public void addLifecycleListener(LifecycleListener listener){
synchronized (listeners) {
LifecycleListener[] results = new LifecycleListener[listeners.length + 1];
for (int i = 0; i < listeners.length; i++) {
results[i] = listeners[i];
}
results[listeners.length] = listener;
listeners = results;
}
}
public LifecycleListener[] findLifecycleListeners(){
return this.listeners;
}
public void removeLifecycleListener(LifecycleListener listener){
synchronized (listeners) {
int n = -1;
for (int i = 0; i < listeners.length; i++) {
if(listeners[i] == listener){
n = i;
break;
}
}
if(n < 0){
return;
}
LifecycleListener[] results = new LifecycleListener[listeners.length - 1];
int j = 0;
for (int i = 0; i < listeners.length; i++) {
if(i != n){
results[j++] = listeners[i];
}
}
listeners = results;
}
}
}
|
[
"[email protected]"
] | |
47726d21b603f381abadef5a1851771670a3bdf2
|
97a0bb5f403470f5dda239002651f7b3bbca5bf6
|
/SillyChildClient/app/src/main/java/com/sillykid/app/mine/myorder/charterorder/OngoingCharterFragment.java
|
d21bd150a948dd4632cf2a2c6c13a376083a7d59
|
[
"Apache-2.0"
] |
permissive
|
921668753/SillyChildClient-Android
|
c71fdf11bd5202fc4cc6dba1e001f00fc2480079
|
6b195724ea0537a399d16e8ab0d5bbfa1e8692f3
|
refs/heads/master
| 2020-03-15T03:08:04.858691 | 2018-08-02T11:47:04 | 2018-08-02T11:47:04 | 131,935,279 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 12,304 |
java
|
package com.sillykid.app.mine.myorder.charterorder;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.common.cklibrary.common.BaseFragment;
import com.common.cklibrary.common.BindView;
import com.common.cklibrary.common.StringConstants;
import com.common.cklibrary.common.ViewInject;
import com.common.cklibrary.utils.JsonUtil;
import com.common.cklibrary.utils.RefreshLayoutUtil;
import com.kymjs.common.PreferenceHelper;
import com.sillykid.app.R;
import com.sillykid.app.adapter.CharterOrderAdapter;
import com.sillykid.app.constant.NumericConstants;
import com.sillykid.app.constant.StringNewConstants;
import com.sillykid.app.custominterfaces.FragmentJumpBetween;
import com.sillykid.app.dialog.PublicPromptDialog;
import com.sillykid.app.entity.CharterOrderAngleBean;
import com.sillykid.app.entity.CharterOrderBean;
import com.sillykid.app.entity.CharterOrderBean.ResultBean.ListBean;
import com.sillykid.app.loginregister.LoginActivity;
import com.sillykid.app.mine.myorder.MyOrderActivity;
import java.util.List;
import cn.bingoogolapple.androidcommon.adapter.BGAOnItemChildClickListener;
import cn.bingoogolapple.refreshlayout.BGARefreshLayout;
/**
* 我的订单----包车订单---进行中
* Created by Administrator on 2017/9/2.
*/
public class OngoingCharterFragment extends BaseFragment implements AdapterView.OnItemClickListener, BGARefreshLayout.BGARefreshLayoutDelegate, CharterOrderContract.View, BGAOnItemChildClickListener {
private MyOrderActivity aty;
private CharterOrderAdapter mAdapter;
@BindView(id = R.id.mRefreshLayout)
private BGARefreshLayout mRefreshLayout;
@BindView(id = R.id.lv_order)
private ListView lv_order;
/**
* 错误提示页
*/
@BindView(id = R.id.ll_commonError, click = true)
private LinearLayout ll_commonError;
@BindView(id = R.id.img_err)
private ImageView img_err;
@BindView(id = R.id.tv_hintText)
private TextView tv_hintText;
private CharterOrderBean charterOrderBean;
private List<ListBean> databean;
private CharterOrderFragment charterOrderFragment;
/**
* 当前页码
*/
private int mMorePageNumber = NumericConstants.START_PAGE_NUMBER;
/**
* 总页码
*/
private int totalPageNumber = NumericConstants.START_PAGE_NUMBER;
/**
* 是否加载更多
*/
private boolean isShowLoadingMore = false;
private int finishPosition=0;//确认订单结束按钮的位置
private PublicPromptDialog publicPromptDialog;
private FragmentJumpBetween fragmentJumpBetween;
private CharterOrderAngleBean charterOrderAngleBean;
@Override
protected View inflaterView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
aty = (MyOrderActivity) getActivity();
return View.inflate(aty, R.layout.fragment_obligationcharter, null);
}
@Override
protected void initData() {
super.initData();
mPresenter = new CharterOrderPresenter(this);
mAdapter = new CharterOrderAdapter(aty);
mAdapter.setOnItemChildClickListener(this);
charterOrderFragment = (CharterOrderFragment) getParentFragment();
fragmentJumpBetween=new FragmentJumpBetween() {
@Override
public void fragmentPosition() {
mRefreshLayout.beginRefreshing();
}
@Override
public void doAttention() {
}
@Override
public void doCancleAttention() {
}
};
}
@Override
protected void initWidget(View parentView) {
super.initWidget(parentView);
RefreshLayoutUtil.initRefreshLayout(mRefreshLayout, this, aty, true);
lv_order.setAdapter(mAdapter);
lv_order.setOnItemClickListener(this);
}
@Override
protected void widgetClick(View v) {
super.widgetClick(v);
switch (v.getId()) {
case R.id.ll_commonError:
if (tv_hintText.getText().toString().equals(getString(R.string.login1))) {
PreferenceHelper.write(aty, StringConstants.FILENAME, "id", 0);
PreferenceHelper.write(aty, StringConstants.FILENAME, "accessToken", "");
PreferenceHelper.write(aty, StringConstants.FILENAME, "refreshToken", "");
PreferenceHelper.write(aty, StringConstants.FILENAME, "expireTime", "0");
PreferenceHelper.write(aty, StringConstants.FILENAME, "timeBefore", "0");
// PreferenceHelper.write(aty, StringConstants.FILENAME, "refreshName", "getCompanyGuideMessageFragment");
Intent intent = new Intent(aty, LoginActivity.class);
aty.showActivity(aty, intent);
break;
}
// ViewInject.toast("onBGARefreshLayoutBeginRefreshing");
mRefreshLayout.beginRefreshing();
break;
}
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
((CharterOrderPresenter) mPresenter).toDetails(aty, databean.get(i).getAir_id());
}
@Override
public void onBGARefreshLayoutBeginRefreshing(BGARefreshLayout refreshLayout) {
mRefreshLayout.endRefreshing();
showLoadingDialog(getString(R.string.dataLoad));
mMorePageNumber = NumericConstants.START_PAGE_NUMBER;
((CharterOrderPresenter)mPresenter).getOrderAround();
}
@Override
public boolean onBGARefreshLayoutBeginLoadingMore(BGARefreshLayout refreshLayout) {
mRefreshLayout.endLoadingMore();
if (!isShowLoadingMore) {
return false;
}
mMorePageNumber++;
if (mMorePageNumber > totalPageNumber) {
ViewInject.toast(getString(R.string.noMoreData));
return false;
}
showLoadingDialog(getString(R.string.dataLoad));
((CharterOrderPresenter) mPresenter).getChartOrder(StringNewConstants.DOING, mMorePageNumber);
return true;
}
@Override
public void setPresenter(CharterOrderContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
public void getSuccess(String success, int flag) {
if (flag==2){//确认结束订单
dismissLoadingDialog();
((CharterOrderContract.Presenter) mPresenter).toDetails(aty, databean.get(finishPosition).getAir_id());
return;
}else if (flag==3){
charterOrderAngleBean = (CharterOrderAngleBean) JsonUtil.getInstance().json2Obj(success, CharterOrderAngleBean.class);
if (charterOrderAngleBean!=null&&charterOrderAngleBean.getData()!=null){
charterOrderFragment.initAngle(charterOrderAngleBean.getData().getUN_PAY()+"",charterOrderAngleBean.getData().getDOING()+"",charterOrderAngleBean.getData().getUN_COMMENT()+"");
}
((CharterOrderPresenter) mPresenter).getChartOrder(StringNewConstants.DOING, mMorePageNumber);
}else {
charterOrderBean = (CharterOrderBean) JsonUtil.getInstance().json2Obj(success, CharterOrderBean.class);
if (charterOrderBean == null) {
ll_commonError.setVisibility(View.VISIBLE);
tv_hintText.setText(getString(R.string.otherError) + getString(R.string.clickRefresh));
dismissLoadingDialog();
return;
}
if (charterOrderBean.getData().getList() == null || charterOrderBean.getData().getList().size() == 0) {
ll_commonError.setVisibility(View.VISIBLE);
tv_hintText.setText(getString(R.string.youNo));
dismissLoadingDialog();
return;
}
isShowLoadingMore = true;
ll_commonError.setVisibility(View.GONE);
mRefreshLayout.setVisibility(View.VISIBLE);
databean = charterOrderBean.getData().getList();
totalPageNumber = charterOrderBean.getData().getTotalPages();
if (mMorePageNumber == NumericConstants.START_PAGE_NUMBER) {
mRefreshLayout.endRefreshing();
mAdapter.clear();
mAdapter.addNewData(databean);
} else {
mRefreshLayout.endLoadingMore();
mAdapter.addMoreData(databean);
}
databean = mAdapter.getData();
dismissLoadingDialog();
}
}
@Override
public void errorMsg(String msg, int flag) {
if (flag == 1) {
dismissLoadingDialog();
ViewInject.toast(msg);
}else if (flag==4){
isShowLoadingMore = false;
if (mMorePageNumber == NumericConstants.START_PAGE_NUMBER) {
mRefreshLayout.endRefreshing();
} else {
mRefreshLayout.endLoadingMore();
}
dismissLoadingDialog();
if (isLogin(msg)){
ViewInject.toast(getString(R.string.reloginPrompting));
PreferenceHelper.write(aty, StringConstants.FILENAME, "isRefreshMineFragment", false);
PreferenceHelper.write(aty, StringConstants.FILENAME, "isReLogin", true);
aty.showActivity(aty,LoginActivity.class);
return;
}
ViewInject.toast(msg);
} else {
isShowLoadingMore = false;
mRefreshLayout.setVisibility(View.GONE);
ll_commonError.setVisibility(View.VISIBLE);
if (mMorePageNumber == NumericConstants.START_PAGE_NUMBER) {
mRefreshLayout.endRefreshing();
} else {
mRefreshLayout.endLoadingMore();
}
if (isLogin(msg)) {
PreferenceHelper.write(aty, StringConstants.FILENAME, "isRefreshMineFragment", false);
PreferenceHelper.write(aty, StringConstants.FILENAME, "isReLogin", true);
dismissLoadingDialog();
tv_hintText.setText(getString(R.string.login1));
// aty.showActivity(aty, LoginActivity.class);
return;
}
tv_hintText.setText(msg);
dismissLoadingDialog();
}
}
@Override
public void onResume() {
super.onResume();
if (charterOrderFragment.getChageIcon() == 1) {
mRefreshLayout.beginRefreshing();
}
}
@Override
public void onItemChildClick(ViewGroup parent, View childView, int position) {
switch (childView.getId()) {
case R.id.tv_leftbtn:
((CharterOrderPresenter) mPresenter).CallPhone(aty, databean.get(position).getDrv_phone());
break;
case R.id.tv_rightbtn:
((CharterOrderPresenter) mPresenter).toChart(aty, databean.get(position).getHx_user_name(), databean.get(position).getNickname(),databean.get(position).getDrv_phone(), databean.get(position).getAvatar());
break;
case R.id.tv_rightbtn2:
//确认完成
finishPosition=position;
initDialog();
break;
}
}
private void initDialog(){
if (publicPromptDialog==null) {
publicPromptDialog=new PublicPromptDialog(aty) {
@Override
public void doAction() {
showLoadingDialog(getString(R.string.submissionLoad));
((CharterOrderContract.Presenter) mPresenter).orderConfirmCompleted(aty,databean.get(finishPosition).getAir_id(),2);
}
};
}
publicPromptDialog.show();
publicPromptDialog.setContent(getString(R.string.orderFinishPrompt));
publicPromptDialog.setContentSmallShow(true);
publicPromptDialog.setBtnContent(getString(R.string.confirm));
}
public FragmentJumpBetween getFragmentJumpBetween() {
return fragmentJumpBetween;
}
}
|
[
"[email protected]"
] | |
1560e2815ad291ce1c6fa25c759a974540fce7c9
|
783ec023a43eef000c741d8ceaa97d5d5f1c20fa
|
/java/MultiThreadTest/src/com/wardensky/multithread/waitnotify/WaitNotifyDemo2.java
|
4061fc8ea333f342a2c2251a2a6791fb05732028
|
[
"Apache-2.0"
] |
permissive
|
wardensky/wardensky-demo
|
da21e1e1757e5eec6fa41b4a54ef6c3261f42259
|
9faf1653e8d648799104fe21a4ddd08b0c43a240
|
refs/heads/master
| 2021-09-14T07:02:53.037353 | 2018-05-09T05:37:29 | 2018-05-09T05:37:29 | 107,880,183 | 0 | 0 |
Apache-2.0
| 2018-05-09T06:45:15 | 2017-10-22T15:51:02 |
JavaScript
|
UTF-8
|
Java
| false | false | 1,414 |
java
|
package com.wardensky.multithread.waitnotify;
public class WaitNotifyDemo2 {
public static Object obj = new Object();
public static void main(String[] args) {
Thread2_1 t1 = new Thread2_1();
Thread2_2 t2 = new Thread2_2("Thread Apple");
Thread2_2 t3 = new Thread2_2("Thread Orange");
t2.start();
t3.start();
try {
// 必须sleep一下
Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
t1.start();
System.out.println("完成");
}
}
class Thread2_1 extends Thread {
@Override
public void run() {
try {
synchronized (WaitNotifyDemo2.obj) {
for (int i = 1; i < 5; i++) {
Thread.sleep(1000);
System.out.println("I'm thread111. I'm doing something " + i);
}
WaitNotifyDemo2.obj.notifyAll();
System.out.println("I'm thread111. The object notify");
}
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
class Thread2_2 extends Thread {
String name;
public Thread2_2(String name) {
this.name = name;
}
@Override
public void run() {
try {
System.out.println("I'm " + this.name + " . I'm waiting");
synchronized (WaitNotifyDemo2.obj) {
WaitNotifyDemo2.obj.wait();
System.out.println( this.name +" Finish wait");
//如果不加这句话,就叫不醒别人了。
//WaitNotifyDemo.obj.notify();
}
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
5586bcc98438f20941c4622ee9b5bb87831260d2
|
ec8aaa2f14318741f2aa06d43fd7ef1d5d5d0bf7
|
/src/main/java/com/vague/code_challenge/repository/UserRepository.java
|
04201110bc8ccfbfb8a0d37fcf33cdae5a3815b7
|
[
"MIT"
] |
permissive
|
lgfcruz/code_challenge
|
0537c087dc3acfa8bd28e5d3606f82d1fbd890d4
|
c05eec9c86402e215150554b01431ce7ca5bf0d8
|
refs/heads/master
| 2020-03-17T12:50:35.316564 | 2018-06-03T02:24:43 | 2018-06-03T02:24:43 | 133,605,539 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 593 |
java
|
package com.vague.code_challenge.repository;
import java.util.List;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import com.vague.code_challenge.model.entity.User;
@RepositoryRestResource(collectionResourceRel = "users", path = "users")
public interface UserRepository extends PagingAndSortingRepository<User, Long> {
List<User> findByName(@Param("name") String name);
List<User> findByRole(@Param("role") String role);
}
|
[
"[email protected]"
] | |
ccb4136cf647607feaebb986cc2f2e58b515aff3
|
39eb7fb0a70928e424845b91ef74f6accc687299
|
/JavaProjects/JavaLanguageExercises/src/streams/courses/shared/CourseType.java
|
42f1cf604a3ded78190bb699d4da1acfe5b7a2b0
|
[] |
no_license
|
michaldurinik/Liberty-training-academy
|
8b15518fca13d326a1abb56b70689da47a97b414
|
0f48b77571deb15c24891e5d4d0b21d8ea1f94e9
|
refs/heads/master
| 2023-01-23T15:03:42.901945 | 2019-07-24T16:23:21 | 2019-07-24T16:23:21 | 195,797,287 | 0 | 0 | null | 2023-01-07T07:36:42 | 2019-07-08T11:19:34 |
JavaScript
|
UTF-8
|
Java
| false | false | 96 |
java
|
package streams.courses.shared;
public enum CourseType {
BEGINNER,
INTERMEDIATE,
ADVANCED
}
|
[
"[email protected]"
] | |
84c1512728cbe3db30b56547e367bf34b67563da
|
ec3c73907aaacc3b7edfd6607a0e4b38cfe36f2f
|
/src/test/java/com/chriswlucas/echo/EchoServerIntegrationTest.java
|
3024ebe4a2e506ae5d2427f6c48ca686081bfd8c
|
[] |
no_license
|
cwlucas41/measurement-server
|
e650190b86dc1c69f83c2ea9f605ff080753d12b
|
bc25f22e5a143aacbd8cd0418dba1c865bf2a2f0
|
refs/heads/master
| 2021-01-12T10:40:17.844710 | 2017-02-22T05:42:06 | 2017-02-22T05:42:06 | 81,367,021 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 830 |
java
|
package com.chriswlucas.echo;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.chriswlucas.client_server_arch.AppHandlerInegrationLogic;
public class EchoServerIntegrationTest extends AppHandlerInegrationLogic{
@Before
public void setup() throws IOException {
commonSetup();
handler = new EchoServerHandler(
new BufferedReader(new FileReader(in)),
actOutWriter
);
}
@Test
public void basicTest() {
inWriter.println("hello world");
expOutWriter.println("hello world");
}
@Test
public void sequenceTest() {
for (int i = 0; i < 100; i++) {
inWriter.println(i);
expOutWriter.println(i);
}
}
@After
public void clean() throws IOException {
commonClean();
}
}
|
[
"[email protected]"
] | |
0c0176852fb721b6bc588f47cad009b0fbd13601
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/16/16_b15d8f142327a74c90f47701153318b4f0431fbc/RINManager/16_b15d8f142327a74c90f47701153318b4f0431fbc_RINManager_s.java
|
ca6c32efc4d1e60ae6748b4e88352d76bf160443
|
[] |
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 | 38,582 |
java
|
package edu.ucsf.rbvi.structureViz2.internal.model;
import java.awt.Color;
import java.awt.Paint;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyEdge.Type;
import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkFactory;
import org.cytoscape.model.CyNode;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
public class RINManager {
private StructureManager structureManager;
private ChimeraManager chimeraManager;
// Edge types
private static final String HBONDEDGE = "hbond";
private static final String CONTACTEDGE = "contact";
private static final String CLASHEDGE = "clash";
private static final String COMBIEDGE = "combi";
private static final String DISTEDGE = "distance";
private static final String BBEDGE = "backbone";
private static final String SUBTYPEDELIM = "_";
// Edge attributes
private static final String DISTANCE_ATTR = "Distance";
private static final String OVERLAP_ATTR = "Overlap";
private static final String INTSUBTYPE_ATTR = "InteractionSubtype";
private static final String INTATOMS_ATTR = "InteractingAtoms";
private static final String NUMINT_ATTR = "NumberInteractions";
// Node attributes
private static final String SMILES_ATTR = "SMILES";
private static final String STRUCTURE_ATTR = "pdbFileName";
private static final String SEED_ATTR = "SeedResidues";
private static final String CHAIN_ATTR = "Chain";
// static final String BACKBONE_ATTR = "BackboneInteraction";
// static final String SIDECHAIN_ATTR = "SideChainInteraction";
public static final Map<String, String> residueAttrCommandMap = new HashMap<String, String>();
static {
residueAttrCommandMap.put("SecondaryStructure", "");
residueAttrCommandMap.put("Coordinates", "");
}
public RINManager(StructureManager structureManager) {
this.structureManager = structureManager;
this.chimeraManager = structureManager.getChimeraManager();
}
public void includeContacts(CyNetwork rin, Map<String, CyNode> nodeMap,
int includeInteractions, boolean ignoreWater, boolean removeRedContacts,
double overlapCutoff, double hbondAllowance, int bondSep) {
System.out.println("Getting contacts");
List<String> replyList = chimeraManager.sendChimeraCommand(
getContactCommand(includeInteractions, overlapCutoff, hbondAllowance, bondSep),
true);
if (replyList != null) {
parseContactReplies(replyList, rin, nodeMap, ignoreWater, removeRedContacts,
CONTACTEDGE);
}
}
public void includeClashes(CyNetwork rin, Map<String, CyNode> nodeMap, int includeInteractions,
boolean ignoreWater, boolean removeRedContacts, double overlapCutoff,
double hbondAllowance, int bondSep) {
System.out.println("Getting clashes");
List<String> replyList = chimeraManager.sendChimeraCommand(
getContactCommand(includeInteractions, overlapCutoff, hbondAllowance, bondSep),
true);
if (replyList != null) {
parseContactReplies(replyList, rin, nodeMap, ignoreWater, removeRedContacts, CLASHEDGE);
}
}
public void includeHBonds(CyNetwork rin, Map<String, CyNode> nodeMap, int includeInteractions,
boolean ignoreWater, boolean removeRedContacts, boolean addHydrogens,
boolean relaxHBonds, double angleSlop, double distSlop) {
System.out.println("Getting Hydrogen Bonds");
List<String> replyList = chimeraManager.sendChimeraCommand(
getHBondCommand(includeInteractions, relaxHBonds, angleSlop, distSlop), true);
if (replyList != null) {
parseHBondReplies(replyList, rin, nodeMap, ignoreWater, removeRedContacts, addHydrogens);
}
}
public void includeConnectivity(CyNetwork rin) {
System.out.println("Getting connectivity ...");
List<String> replyList = chimeraManager.sendChimeraCommand("list physicalchains", true);
if (replyList != null) {
parseConnectivityReplies(replyList, rin);
}
}
public void includeDistances(CyNetwork rin, Map<String, CyNode> nodeMap,
int includeInteractions, boolean ignoreWater, boolean removeRedContacts,
double distCutoff) {
System.out.println("Getting distances ...");
List<String> replyList = chimeraManager.sendChimeraCommand(
getDistanceCommand(includeInteractions), true);
if (replyList != null) {
parseDistanceReplies(replyList, rin, nodeMap, ignoreWater, removeRedContacts,
distCutoff, includeInteractions);
}
}
public void addCombinedEdges(CyNetwork rin) {
System.out.println("Getting combined edges");
if (rin == null || rin.getEdgeCount() == 0) {
return;
}
List<CyNode> nodes = rin.getNodeList();
for (int i = 0; i < rin.getNodeCount(); i++) {
CyNode source = nodes.get(i);
for (int j = i + 1; j < rin.getNodeCount(); j++) {
CyNode target = nodes.get(j);
List<CyEdge> edges = rin.getConnectingEdgeList(source, target, Type.ANY);
if (edges.size() > 0) {
CyEdge edge = rin.addEdge(source, target, true);
rin.getRow(edge).set(
CyNetwork.NAME,
rin.getRow(source).get(CyNetwork.NAME, String.class) + " (" + COMBIEDGE
+ ")" + rin.getRow(target).get(CyNetwork.NAME, String.class));
rin.getRow(edge).set(CyEdge.INTERACTION, COMBIEDGE);
rin.getRow(edge)
.set(INTSUBTYPE_ATTR, COMBIEDGE + " all" + SUBTYPEDELIM + "all");
rin.getRow(edge).set(NUMINT_ATTR, edges.size());
// rin.getRow(edge).set(INTATOMS_ATTR, "");
}
}
}
}
private String getContactCommand(int includeInteractions, double overlapCutoff,
double hbondAllowance, int bondSep) {
String atomspec1 = "";
String atomspec2 = "";
// "Within selection"
if (includeInteractions == 0) {
// among the specified atoms
atomspec1 = "sel";
atomspec2 = "test self";
}
// "Between selection and all other atoms"
else if (includeInteractions == 1) {
// between the specified atoms and all other atoms
atomspec1 = "sel";
atomspec2 = "test other";
}
// "All of the above"
else if (includeInteractions == 2) {
// intra-model interactions between the specified atoms and all
// other atoms
atomspec1 = "sel";
atomspec2 = "test model";
}
// "Between models"
// else if (includeInteracions.getSelectedValue() ==
// interactionArray[3]) {
// // between the specified atoms and all other atoms
// atomspec1 = "#" + chimeraManager.getChimeraModel().getModelNumber();
// atomspec2 = "test other";
// }
// // Between and within all models
// else {
// atomspec1 = "#*";
// atomspec2 = "test self";
// }
// Create the command
String command = "findclash " + atomspec1
+ " makePseudobonds false log true namingStyle command overlapCutoff "
+ overlapCutoff + " hbondAllowance " + hbondAllowance + " bondSeparation "
+ bondSep + " " + atomspec2;
return command;
}
private String getHBondCommand(int includeInteractions, boolean relaxHBonds, double angleSlop,
double distSlop) {
// for which atoms to find hydrogen bonds
String atomspec = "";
// intermodel: whether to look for H-bonds between models
// intramodel: whether to look for H-bonds within models.
String modelrestr = "";
// "Within selection"
if (includeInteractions == 0) {
// Limit H-bond detection to H-bonds with both atoms selected
atomspec = "selRestrict both";
modelrestr = "intramodel true intermodel true";
}
// "Between selection and all atoms"
else if (includeInteractions == 1) {
// Limit H-bond detection to H-bonds with at least one atom selected
atomspec = "selRestrict any";
modelrestr = "intramodel false intermodel true";
}
// "Within selection and all atoms"
else if (includeInteractions == 2) {
// Limit H-bond detection to H-bonds with at least one atom selected
atomspec = "selRestrict any";
modelrestr = "intramodel true intermodel true";
}
// "Between models"
// else if (includeInteracions.getSelectedValue() ==
// interactionArray[3]) {
// // Restrict H-bond detection to the specified model
// atomspec = "spec #*";
// modelrestr = "intramodel false intermodel true";
// }
// // Between and within models
// else {
// atomspec = "spec #*";
// modelrestr = "intramodel true intermodel true";
// }
String command = "findhbond " + atomspec + " " + modelrestr
+ " makePseudobonds false log true namingStyle command";
if (relaxHBonds) {
command += " relax true distSlop " + distSlop + " angleSlop " + angleSlop;
}
return command;
}
private String getDistanceCommand(int includeInteractions) {
String atomspec = "";
// "Within selection"
if (includeInteractions == 0) {
// among the specified atoms
atomspec = "@CA&sel";
}
// "Between selection and all other atoms" or "All of the above"
else if (includeInteractions == 1 || includeInteractions == 2) {
// between the specified atoms and all other atoms
atomspec = "@CA";
}
// Create the command
String command = "list distmat " + atomspec;
return command;
}
/**
* Clash replies look like: *preamble* *header line* *clash lines* where preamble is: Allowed
* overlap: -0.4 H-bond overlap reduction: 0 Ignore contacts between atoms separated by 4 bonds
* or less Ignore intra-residue contacts 44 contacts and the header line is: atom1 atom2 overlap
* distance and the clash lines look like: :2470.A@N :323.A@OD2 -0.394 3.454
*/
private List<CyEdge> parseContactReplies(List<String> replyLog, CyNetwork rin,
Map<String, CyNode> nodeMap, boolean ignoreWater, boolean removeRedContacts,
String edgeType) {
// Scan for our header line
boolean foundHeader = false;
int index = 0;
for (index = 0; index < replyLog.size(); index++) {
String str = replyLog.get(index);
if (str.trim().startsWith("atom1")) {
foundHeader = true;
break;
}
}
if (!foundHeader)
return null;
Map<CyEdge, Double> distanceMap = new HashMap<CyEdge, Double>();
Map<CyEdge, Double> overlapMap = new HashMap<CyEdge, Double>();
for (++index; index < replyLog.size(); index++) {
// System.out.println(replyLog.get(index));
String[] line = replyLog.get(index).trim().split("\\s+");
if (line.length != 4)
continue;
CyEdge edge = createEdge(rin, nodeMap, ignoreWater, removeRedContacts, line[0],
line[1], edgeType);
if (edge == null) {
continue;
}
// We want the smallest distance
updateMap(distanceMap, edge, line[3], -1);
// We want the largest overlap
updateMap(overlapMap, edge, line[2], 1);
}
// OK, now update the edge attributes we want
for (CyEdge edge : distanceMap.keySet()) {
rin.getRow(edge).set(DISTANCE_ATTR, distanceMap.get(edge));
rin.getRow(edge).set(OVERLAP_ATTR, overlapMap.get(edge));
}
return new ArrayList<CyEdge>(distanceMap.keySet());
}
// H-bonds (donor, acceptor, hydrogen, D..A dist, D-H..A dist):
/**
* Finding acceptors in model '1tkk' Building search tree of acceptor atoms Finding donors in
* model '1tkk' Matching donors in model '1tkk' to acceptors Finding intermodel H-bonds Finding
* intramodel H-bonds Constraints relaxed by 0.4 angstroms and 20 degrees Models used: #0 1tkk
* H-bonds (donor, acceptor, hydrogen, D..A dist, D-H..A dist): ARG 24.A NH1 GLU 2471.A OE1 no
* hydrogen 3.536 N/A LYS 160.A NZ GLU 2471.A O no hydrogen 2.680 N/A LYS 162.A NZ ALA 2470.A O
* no hydrogen 3.022 N/A LYS 268.A NZ GLU 2471.A O no hydrogen 3.550 N/A ILE 298.A N GLU 2471.A
* OE2 no hydrogen 3.141 N/A ALA 2470.A N THR 135.A OG1 no hydrogen 2.814 N/A ALA 2470.A N ASP
* 321.A OD1 no hydrogen 2.860 N/A ALA 2470.A N ASP 321.A OD2 no hydrogen 3.091 N/A ALA 2470.A N
* ASP 323.A OD1 no hydrogen 2.596 N/A ALA 2470.A N ASP 323.A OD2 no hydrogen 3.454 N/A GLU
* 2471.A N SER 296.A O no hydrogen 2.698 N/A HOH 2541.A O GLU 2471.A OE1 no hydrogen 2.746 N/A
* HOH 2577.A O GLU 2471.A O no hydrogen 2.989 N/A
*/
private List<CyEdge> parseHBondReplies(List<String> replyLog, CyNetwork rin,
Map<String, CyNode> nodeMap, boolean ignoreWater, boolean removeRedContacts,
boolean addHydrogens) {
// Scan for our header line
boolean foundHeader = false;
int index = 0;
for (index = 0; index < replyLog.size(); index++) {
String str = replyLog.get(index);
if (str.trim().startsWith("H-bonds")) {
foundHeader = true;
break;
}
}
if (!foundHeader) {
return null;
}
Map<CyEdge, Double> distanceMap = new HashMap<CyEdge, Double>();
for (++index; index < replyLog.size(); index++) {
// System.out.println(replyLog.get(index));
String[] line = replyLog.get(index).trim().split("\\s+");
if (line.length != 5 && line.length != 6)
continue;
CyEdge edge = createEdge(rin, nodeMap, ignoreWater, removeRedContacts, line[0],
line[1], HBONDEDGE);
if (edge == null) {
continue;
}
// System.out.println(rin.getRow(edge).get(CyNetwork.NAME,
// String.class));
String distance = line[3];
if ((line[2].equals("no") && line[3].equals("hydrogen")) || addHydrogens) {
distance = line[4];
}
updateMap(distanceMap, edge, distance, -1); // We want the smallest
// distance
}
// OK, now update the edge attributes we want
for (CyEdge edge : distanceMap.keySet()) {
rin.getRow(edge).set(DISTANCE_ATTR, distanceMap.get(edge));
}
return new ArrayList<CyEdge>(distanceMap.keySet());
}
/**
* Parse the connectivity information from Chimera. The data is of the form: physical chain
* #0:283.A #0:710.A physical chain #0:283.B #0:710.B physical chain #0:283.C #0:710.C
*
* We don't use this data to create new nodes -- only new edges. If two nodes are within the
* same physical chain, we connect them with a "Connected" edge
*/
private List<CyEdge> parseConnectivityReplies(List<String> replyLog, CyNetwork rin) {
List<CyEdge> edgeList = new ArrayList<CyEdge>();
List<ChimeraResidue[]> rangeList = new ArrayList<ChimeraResidue[]>();
for (String line : replyLog) {
String[] tokens = line.split(" ");
if (tokens.length != 4)
continue;
String start = tokens[2];
String end = tokens[3];
ChimeraResidue[] range = new ChimeraResidue[2];
// Get the residues from the reside spec
range[0] = ChimUtils.getResidue(start, chimeraManager);
range[1] = ChimUtils.getResidue(end, chimeraManager);
if (range[0] != null && range[1] != null) {
rangeList.add(range);
}
}
// For each node pair, figure out if the pair is connected
List<CyNode> nodes = rin.getNodeList();
for (int i = 0; i < nodes.size(); i++) {
CyNode node1 = nodes.get(i);
// System.out.println("Getting the range for the first node..."+node1);
ChimeraResidue[] range = getRange(rangeList, node1, rin);
if (range == null)
continue;
for (int j = i + 1; j < nodes.size(); j++) {
CyNode node2 = nodes.get(j);
// System.out.println("Seeing if node2 "+node2+" is in the range...");
if (inRange2(range, node1, node2, rin)) {
// System.out.println("....it is");
// These two nodes are connected
edgeList.add(createConnectivityEdge(rin, node1, node2));
}
}
}
// Now, make the edges based on whether any pair of nodes are in the
// same range
return edgeList;
}
/**
*
* distmat #0:36.A@CA #0:37.A@CA 3.777 distmat #0:36.A@CA #0:38.A@CA 6.663
*
* @param replyLog
* @param rin
* @param nodeMap
* @return
*/
private List<CyEdge> parseDistanceReplies(List<String> replyLog, CyNetwork rin,
Map<String, CyNode> nodeMap, boolean ignoreWater, boolean removeRedContacts,
double distCutoff, int includeInteractions) {
List<String> selectedResidues = chimeraManager.getSelectedResidueSpecs();
List<CyEdge> distEdges = new ArrayList<CyEdge>();
for (int index = 0; index < replyLog.size(); index++) {
// System.out.println(replyLog.get(index));
String[] line = replyLog.get(index).trim().split("\\s+");
if (line.length != 4)
continue;
String distance = line[3];
// try to read distance and create an edge if distance between atoms smaller than cutoff
// special case of cutoff = 0: create all edges
try {
Double distNum = Double.parseDouble(distance);
String res1 = line[1].substring(0, line[1].indexOf("@"));
String res2 = line[2].substring(0, line[2].indexOf("@"));
// continue
// if distance is below cutoff or if cutoff is not set, i.e. equal to 0 (to retrieve
// all distance) and
// 1) if retrieve only for selected residues
// 2) if retrieve for selected and neighbors and the first residue is selected and
// the second is not
// 3) if retrieve for both selected and neighbors and the first residue is selected
if ((distCutoff == 0.0 || distNum <= distCutoff)
&& (includeInteractions == 0
|| (includeInteractions == 1
&& ((selectedResidues.contains(res1) && !selectedResidues
.contains(res2))) || (selectedResidues
.contains(res2) && !selectedResidues.contains(res1))) || (includeInteractions == 2 && (selectedResidues
.contains(res1) || selectedResidues.contains(res2))))) {
CyEdge edge = createEdge(rin, nodeMap, ignoreWater, removeRedContacts, line[1],
line[2], DISTEDGE);
if (edge == null) {
continue;
}
rin.getRow(edge).set(DISTANCE_ATTR, distNum);
}
} catch (Exception ex) {
// ignore
}
}
return distEdges;
}
private CyEdge createEdge(CyNetwork rin, Map<String, CyNode> nodeMap, boolean ignoreWater,
boolean removeRedContacts, String sourceAlias, String targetAlias, String type) {
// Create our two nodes. Note that makeResidueNode also adds three
// attributes:
// 1) FunctionalResidues; 2) Seed; 3) SideChainOnly
CyNode source = createResidueNode(rin, nodeMap, ignoreWater, sourceAlias);
CyNode target = createResidueNode(rin, nodeMap, ignoreWater, targetAlias);
if (source == null || target == null) {
return null;
}
String interactingAtoms = sourceAlias + "," + targetAlias;
String sourceAtom = ChimUtils.getAtomName(sourceAlias);
String targetAtom = ChimUtils.getAtomName(targetAlias);
String interactionSubtype = type
+ " "
+ ChimUtils.getIntSubtype(rin.getRow(source).get(CyNetwork.NAME, String.class),
sourceAtom)
+ SUBTYPEDELIM
+ ChimUtils.getIntSubtype(rin.getRow(target).get(CyNetwork.NAME, String.class),
targetAtom);
// Create our edge
CyEdge edge = null;
if (removeRedContacts && type.equals(HBONDEDGE)) {
List<CyEdge> existingEdges = rin.getConnectingEdgeList(source, target, Type.ANY);
if (existingEdges.size() > 0) {
for (CyEdge exEdge : existingEdges) {
if (rin.getRow(exEdge).get(CyEdge.INTERACTION, String.class)
.equals(CONTACTEDGE)
&& rin.getRow(exEdge).get(INTATOMS_ATTR, String.class)
.equals(interactingAtoms)) {
edge = exEdge;
rin.getRow(edge).set(OVERLAP_ATTR, null);
break;
}
}
}
}
if (edge == null) {
edge = rin.addEdge(source, target, true);
}
String edgeName = rin.getRow(source).get(CyNetwork.NAME, String.class) + " (" + type + ") "
+ rin.getRow(target).get(CyNetwork.NAME, String.class);
rin.getRow(edge).set(CyNetwork.NAME, edgeName);
rin.getRow(edge).set(CyEdge.INTERACTION, type);
rin.getRow(edge).set(INTATOMS_ATTR, interactingAtoms);
rin.getRow(edge).set(INTSUBTYPE_ATTR, interactionSubtype);
return edge;
}
private CyEdge createConnectivityEdge(CyNetwork rin, CyNode node1, CyNode node2) {
CyEdge edge = rin.addEdge(node1, node2, true);
String edgeName = rin.getRow(node1).get(CyNetwork.NAME, String.class) + " (" + BBEDGE + ")"
+ rin.getRow(node2).get(CyNetwork.NAME, String.class);
rin.getRow(edge).set(CyNetwork.NAME, edgeName);
rin.getRow(edge).set(CyEdge.INTERACTION, BBEDGE);
rin.getRow(edge).set(INTSUBTYPE_ATTR, BBEDGE + " mc" + SUBTYPEDELIM + "mc");
return edge;
}
private CyNode createResidueNode(CyNetwork rin, Map<String, CyNode> nodeMap,
boolean ignoreWater, String alias) {
// alias is a atomSpec of the form [#model]:residueNumber@atom
// We want to convert that to a node identifier of [pdbid#]ABC nnn
// and add FunctionalResidues and BackboneOnly attributes
// boolean singleModel = false;
ChimeraModel model = ChimUtils.getModel(alias, chimeraManager);
if (model == null) {
model = chimeraManager.getChimeraModel();
// singleModel = true;
}
ChimeraResidue residue = ChimUtils.getResidue(alias, model);
if (ignoreWater && residue.getType().equals("HOH")) {
return null;
}
// boolean backbone = ChimUtils.isBackbone(alias);
int displayType = ChimeraResidue.getDisplayType();
ChimeraResidue.setDisplayType(ChimeraResidue.THREE_LETTER);
// OK, now we have everything we need, create the node
String nodeName = residue.toString().trim();
if (residue.getChainId() != "_") {
nodeName += "." + residue.getChainId();
}
ChimeraResidue.setDisplayType(displayType);
// if (!singleModel)
nodeName = model.getModelName() + "#" + nodeName;
// Create the node if it does not already exist in the network
CyNode node = null;
if (!nodeMap.containsKey(nodeName)) {
node = rin.addNode();
rin.getRow(node).set(CyNetwork.NAME, nodeName);
nodeMap.put(nodeName, node);
// Add attributes from Chimera
String chimRes = model.getModelName() + "#" + residue.getIndex();
if (residue.getChainId() != "_") {
chimRes += "." + residue.getChainId();
}
rin.getRow(node).set(ChimUtils.RESIDUE_ATTR, chimRes);
rin.getRow(node).set(
ChimUtils.RINALYZER_ATTR,
model.getModelName() + ":" + residue.getChainId() + ":" + residue.getIndex()
+ ":_:" + residue.getType());
rin.getRow(node).set(SEED_ATTR, Boolean.valueOf(residue.isSelected()));
rin.getRow(node).set(CHAIN_ATTR, residue.getChainId());
// if (backbone)
// rin.getRow(node).set(BACKBONE_ATTR, Boolean.TRUE);
// else
// rin.getRow(node).set(SIDECHAIN_ATTR, Boolean.TRUE);
// Add structureViz attributes
String smiles = ChimUtils.toSMILES(residue.getType());
if (smiles != null) {
rin.getRow(node).set(SMILES_ATTR, smiles);
}
rin.getRow(node).set(STRUCTURE_ATTR, model.getModelName());
} else {
node = nodeMap.get(nodeName);
}
return node;
}
private void updateMap(Map<CyEdge, Double> map, CyEdge edge, String value, int comparison) {
// Save the minimum distance between atoms
Double v = Double.valueOf(value);
if (map.containsKey(edge)) {
if (comparison < 0 && map.get(edge).compareTo(v) > 0)
map.put(edge, v);
else if (comparison > 0 && map.get(edge).compareTo(v) < 0)
map.put(edge, v);
} else {
map.put(edge, v);
}
}
private ChimeraResidue[] getRange(List<ChimeraResidue[]> rangeList, CyNode node, CyNetwork rin) {
for (ChimeraResidue[] range : rangeList) {
if (inRange(range, node, rin))
return range;
}
return null;
}
private boolean inRange(ChimeraResidue[] range, CyNode node, CyNetwork rin) {
String residueAttr = rin.getRow(node).get(ChimUtils.RESIDUE_ATTR, String.class);
ChimeraStructuralObject cso = ChimUtils.fromAttribute(residueAttr, chimeraManager);
// Models can't be in a range...
if (cso == null || cso instanceof ChimeraModel)
return false;
// A chain might be in a range -- check this
if (cso instanceof ChimeraChain) {
String chainID = ((ChimeraChain) cso).getChainId();
return inChainRange(range, chainID);
}
// OK, we have a residue, but we need to be careful to make
// sure that the chains match
ChimeraResidue residue = (ChimeraResidue) cso;
if (inChainRange(range, residue.getChainId())) {
return true;
}
int startIndex = Integer.parseInt(range[0].getIndex());
int endIndex = Integer.parseInt(range[1].getIndex());
int residueIndex = Integer.parseInt(residue.getIndex());
if (endIndex < startIndex) {
if (endIndex <= residueIndex && residueIndex <= startIndex)
return true;
} else {
if (startIndex <= residueIndex && residueIndex <= endIndex)
return true;
}
return false;
}
private boolean inRange2(ChimeraResidue[] range, CyNode node1, CyNode node2, CyNetwork rin) {
ChimeraStructuralObject cso1 = ChimUtils.fromAttribute(
rin.getRow(node1).get(ChimUtils.RESIDUE_ATTR, String.class), chimeraManager);
ChimeraStructuralObject cso2 = ChimUtils.fromAttribute(
rin.getRow(node2).get(ChimUtils.RESIDUE_ATTR, String.class), chimeraManager);
// Models can't be in a range...
if (cso1 == null || cso1 instanceof ChimeraModel || cso1 instanceof ChimeraChain
|| cso2 == null || cso2 instanceof ChimeraModel || cso2 instanceof ChimeraChain)
return false;
// OK, we have a residue, but we need to be careful to make
// sure that the chains match
ChimeraResidue residue1 = (ChimeraResidue) cso1;
ChimeraResidue residue2 = (ChimeraResidue) cso2;
int startIndex = Integer.parseInt(range[0].getIndex());
int endIndex = Integer.parseInt(range[1].getIndex());
int residueIndex1 = Integer.parseInt(residue1.getIndex());
int residueIndex2 = Integer.parseInt(residue2.getIndex());
int diff = Math.abs(residueIndex1 - residueIndex2);
if (endIndex < startIndex) {
if (diff == 1 && endIndex <= residueIndex1 && residueIndex1 <= startIndex
&& endIndex <= residueIndex2 && residueIndex2 <= startIndex)
return true;
} else {
if (diff == 1 && startIndex <= residueIndex1 && residueIndex1 <= endIndex
&& startIndex <= residueIndex2 && residueIndex2 <= endIndex)
return true;
}
return false;
}
private boolean inChainRange(ChimeraResidue[] range, String chainID) {
String start = range[0].getChainId();
String end = range[1].getChainId();
if (start.equals(end))
return false;
if (start.compareTo(end) > 0) {
end = range[0].getChainId();
start = range[1].getChainId();
}
if (start.compareTo(chainID) <= 0 && chainID.compareTo(end) <= 0)
return true;
return false;
}
public CyNetwork createRIN(Map<String, CyNode> nodeMap, String networkName,
boolean ignoreWater, boolean includeCombiEdges) {
// get factories, etc.
CyNetworkFactory cyNetworkFactory = (CyNetworkFactory) structureManager
.getService(CyNetworkFactory.class);
// Create the network
CyNetwork rin = cyNetworkFactory.createNetwork();
rin.getRow(rin).set(CyNetwork.NAME, networkName);
// Create new attributes
rin.getDefaultNodeTable().createColumn(ChimUtils.RESIDUE_ATTR, String.class, false);
rin.getDefaultNodeTable().createColumn(ChimUtils.RINALYZER_ATTR, String.class, false);
rin.getDefaultNodeTable().createColumn(SMILES_ATTR, String.class, false);
rin.getDefaultNodeTable().createColumn(STRUCTURE_ATTR, String.class, false);
rin.getDefaultNodeTable().createColumn(SEED_ATTR, Boolean.class, false);
rin.getDefaultNodeTable().createColumn(CHAIN_ATTR, String.class, false);
rin.getDefaultEdgeTable().createColumn(DISTANCE_ATTR, Double.class, false);
rin.getDefaultEdgeTable().createColumn(OVERLAP_ATTR, Double.class, false);
rin.getDefaultEdgeTable().createColumn(INTSUBTYPE_ATTR, String.class, false);
rin.getDefaultEdgeTable().createColumn(INTATOMS_ATTR, String.class, false);
if (includeCombiEdges) {
rin.getDefaultEdgeTable().createColumn(NUMINT_ATTR, Integer.class, false);
}
// add all selected nodes
List<String> residues = chimeraManager.getSelectedResidueSpecs();
for (String res : residues) {
// System.out.println("get selected residue");
createResidueNode(rin, nodeMap, ignoreWater, res);
}
// return network
return rin;
}
public String getAttrCommand(String resAttr) {
return residueAttrCommandMap.get(resAttr);
}
public Collection<String> getResAttrs() {
return residueAttrCommandMap.keySet();
}
public void annotate(CyNetwork network, String resAttr, String command) {
// get models
Set<ChimeraStructuralObject> chimObjs = structureManager.getAssociatedChimObjs(network);
if (chimObjs == null) {
return;
}
for (ChimeraStructuralObject chimObj : chimObjs) {
if (chimObj instanceof ChimeraModel) {
// get attribute values
Map<ChimeraResidue, Object> resValues = chimeraManager.getAttrValues(command,
chimObj.getChimeraModel());
if (resValues.size() == 0) {
continue;
}
Object testObj = resValues.values().iterator().next();
if (testObj == null) {
continue;
}
// create attribute
if (network.getDefaultNodeTable().getColumn(resAttr) != null
&& network.getDefaultNodeTable().getColumn(resAttr).getType() != testObj
.getClass()) {
network.getDefaultNodeTable().deleteColumn(resAttr);
} else if (network.getDefaultNodeTable().getColumn(resAttr) == null) {
network.getDefaultNodeTable().createColumn(resAttr, testObj.getClass(), false);
}
// save all the values
for (ChimeraResidue res : resValues.keySet()) {
Set<CyIdentifiable> cyObjs = structureManager.getAssociatedCyObjs(res);
if (cyObjs == null) {
continue;
}
for (CyIdentifiable cyId : cyObjs) {
if (cyId instanceof CyNode && network.containsNode((CyNode) cyId)) {
network.getRow(cyId).set(resAttr, resValues.get(res));
}
}
}
}
}
}
public void annotateSS(CyNetwork network) {
// get models
final String ssColumn = "SS";
Set<ChimeraStructuralObject> chimObjs = structureManager.getAssociatedChimObjs(network);
if (chimObjs == null) {
return;
}
if (network.getDefaultNodeTable().getColumn(ssColumn) == null) {
network.getDefaultNodeTable().createColumn(ssColumn, String.class, false, "");
}
for (ChimeraStructuralObject chimObj : chimObjs) {
if (chimObj instanceof ChimeraModel) {
chimeraManager.sendChimeraCommand("ksdssp", false);
Map<ChimeraResidue, Object> hResidues = chimeraManager.getAttrValues("isHelix",
chimObj.getChimeraModel());
Map<ChimeraResidue, Object> sResidues = chimeraManager.getAttrValues("isSheet",
chimObj.getChimeraModel());
for (ChimeraResidue res : hResidues.keySet()) {
Set<CyIdentifiable> cyObjs = structureManager.getAssociatedCyObjs(res);
if (cyObjs == null) {
continue;
}
for (CyIdentifiable cyId : cyObjs) {
if (cyId instanceof CyNode && network.containsNode((CyNode) cyId)) {
if (hResidues.get(res).equals(Boolean.TRUE)) {
network.getRow(cyId).set(ssColumn, "Helix");
} else if (sResidues.containsKey(res)
&& sResidues.get(res).equals(Boolean.TRUE)) {
network.getRow(cyId).set(ssColumn, "Sheet");
} else {
network.getRow(cyId).set(ssColumn, "Loop");
}
}
}
}
}
}
}
public void annotateCoord(CyNetwork network, String resAttr) {
Set<ChimeraStructuralObject> chimObjs = structureManager.getAssociatedChimObjs(network);
if (chimObjs == null) {
return;
}
if (network.getDefaultNodeTable().getColumn(resAttr + ".x") == null) {
network.getDefaultNodeTable().createColumn(resAttr + ".x", Double.class, false);
}
if (network.getDefaultNodeTable().getColumn(resAttr + ".y") == null) {
network.getDefaultNodeTable().createColumn(resAttr + ".y", Double.class, false);
}
if (network.getDefaultNodeTable().getColumn(resAttr + ".z") == null) {
network.getDefaultNodeTable().createColumn(resAttr + ".z", Double.class, false);
}
// get coordinates
Map<ChimeraResidue, Double[]> resCoords = new HashMap<ChimeraResidue, Double[]>();
for (ChimeraStructuralObject model : chimObjs) {
if (model instanceof ChimeraModel) {
List<String> reply = chimeraManager.sendChimeraCommand("getcrd xf "
+ model.getChimeraModel().toSpec(), true);
if (reply == null) {
continue;
}
String[] lineParts = null;
for (String inputLine : reply) {
// response from chimera should look like this:
// Atom #0:355.A@C 36.598 78.221 2.056
// Atom #0:355.A@CA 35.276 77.803 1.543
lineParts = inputLine.split("\\s+");
if (lineParts.length != 5) {
continue;
}
ChimeraResidue residue = ChimUtils.getResidue(lineParts[1],
model.getChimeraModel());
String atom = ChimUtils.getAtomName(lineParts[1]);
if (residue == null) {
continue;
}
Double[] coord = null;
try {
coord = new Double[3];
for (int i = 0; i < 3; i++) {
coord[i] = new Double(lineParts[i + 2]);
}
if (!resCoords.containsKey(residue) || atom.equals("CA")) {
resCoords.put(residue, coord);
}
} catch (NumberFormatException ex) {
// no coordinates for this node, ignore
// ex.printStackTrace();
}
}
}
}
// save coordinates as attributes
for (CyNode node : network.getNodeList()) {
Set<ChimeraStructuralObject> nodeChimObjs = structureManager
.getAssociatedChimObjs(node);
if (nodeChimObjs == null) {
continue;
}
for (ChimeraStructuralObject chimObj : nodeChimObjs) {
if (resCoords.containsKey(chimObj)) {
final Double[] coord = resCoords.get(chimObj);
network.getRow(node).set(resAttr + ".x", coord[0]);
network.getRow(node).set(resAttr + ".y", coord[1]);
network.getRow(node).set(resAttr + ".z", coord[2]);
}
}
}
}
public void syncColors() {
Map<Integer, ChimeraModel> models = chimeraManager.getSelectedModels();
for (ChimeraModel selModel : models.values()) {
ChimeraModel model = chimeraManager.getChimeraModel(selModel.getModelNumber(),
selModel.getSubModelNumber());
if (model != null) {
for (CyIdentifiable obj : model.getCyObjects().keySet()) {
if (obj instanceof CyNetwork) {
CyNetworkViewManager manager = (CyNetworkViewManager) structureManager
.getService(CyNetworkViewManager.class);
for (CyNetworkView view : manager.getNetworkViews((CyNetwork) obj)) {
syncChimToCyColors(view);
}
}
}
}
}
}
public void syncChimToCyColors(CyNetworkView networkView) {
// get models
CyNetwork network = networkView.getModel();
Set<ChimeraStructuralObject> chimObjs = structureManager.getAssociatedChimObjs(network);
if (chimObjs == null) {
return;
}
for (ChimeraStructuralObject chimObj : chimObjs) {
if (chimObj instanceof ChimeraModel) {
// get attribute values
Map<ChimeraResidue, Object> resValues = chimeraManager.getAttrValues("ribbonColor",
chimObj.getChimeraModel());
if (resValues.size() == 0) {
continue;
}
// save all the values
for (ChimeraResidue res : resValues.keySet()) {
Set<CyIdentifiable> cyObjs = structureManager.getAssociatedCyObjs(res);
if (cyObjs == null) {
continue;
}
for (CyIdentifiable cyId : cyObjs) {
if (cyId instanceof CyNode && network.containsNode((CyNode) cyId)) {
String[] rgb = ((String) resValues.get(res)).split(",");
if (rgb.length == 3) {
try {
Paint resColor = new Color(Float.valueOf(rgb[0]),
Float.valueOf(rgb[1]), Float.valueOf(rgb[2]));
networkView.getNodeView((CyNode) cyId).clearValueLock(
BasicVisualLexicon.NODE_FILL_COLOR);
networkView.getNodeView((CyNode) cyId).setVisualProperty(
BasicVisualLexicon.NODE_FILL_COLOR, resColor);
} catch (NumberFormatException ex) {
// ignore
}
}
}
}
}
networkView.updateView();
}
}
}
public void syncCyToChimColors(CyNetworkView networkView) {
final Map<Color, String> color2res = new HashMap<Color, String>();
for (final View<CyNode> nodeView : networkView.getNodeViews()) {
final CyNode node = nodeView.getModel();
final Color color = (Color) nodeView
.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR);
final Set<ChimeraStructuralObject> chimObjs = structureManager
.getAssociatedChimObjs(node);
if (color != null && chimObjs != null) {
for (ChimeraStructuralObject chimObj : chimObjs) {
if (!color2res.containsKey(color)) {
color2res.put(color, chimObj.toSpec());
} else {
color2res.put(color, color2res.get(color) + chimObj.toSpec());
}
}
}
}
for (final Color color : color2res.keySet()) {
String colorDef = "";
try {
float[] rgbColorCodes = color.getRGBColorComponents(null);
for (int i = 0; i < rgbColorCodes.length; i++) {
colorDef += rgbColorCodes[i] + ",";
}
} catch (Exception e) {
continue;
}
colorDef += "r,a"; // ribbons and atoms
chimeraManager.sendChimeraCommand("color " + colorDef + " " + color2res.get(color),
false);
}
}
}
|
[
"[email protected]"
] | |
15947139c0042acd19c795547897ff4b502131f2
|
0c8d6027fe35e700bbf8bb1a5a7932b9b4f1a051
|
/ENI-Enchere/src/dal/CategorieDAO.java
|
c703ec0f03d579462874210b3700f1f00b63fc88
|
[] |
no_license
|
eHervouet/ENI-Enchere
|
67dafd8d4ea46642e61f03714bbdac818947b70b
|
e37fa6116cdc2588d012712828699a4711480e3d
|
refs/heads/master
| 2022-12-02T22:34:12.853445 | 2020-08-14T08:11:31 | 2020-08-14T08:11:31 | 284,653,348 | 0 | 0 | null | 2020-08-14T08:11:32 | 2020-08-03T09:06:19 |
Java
|
UTF-8
|
Java
| false | false | 131 |
java
|
package dal;
import java.util.List;
import bo.Categorie;
public interface CategorieDAO {
public List<Categorie> selectAll();
}
|
[
"[email protected]"
] | |
4b1196d0ff862798a261cf25c730762ef5d187ae
|
67efd2f4dfd0e516b4382b316c7ca03c2e2f80c1
|
/JavaTest/src/Slogan/Slogan.java
|
89719e68d5b2e43edf9f6aa3d724fe6638bb67f5
|
[
"MIT"
] |
permissive
|
mhcrnl/NetBeansProjectsUbuntu2016
|
cf3661ea2983a94ff041af0e6ccd947843b747d1
|
f5c5587bdcb7134784adb9dad5e27f2726c41dee
|
refs/heads/master
| 2020-03-12T05:14:27.789920 | 2018-04-22T06:53:32 | 2018-04-22T06:53:32 | 130,459,881 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 849 |
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 Slogan;
/**
* Slogan.java
* @author mhcrnl
* Reprezinta o clasa care returneaza un string.
*/
public class Slogan {
private String fraza;
private static int count=0;
/**
* Constructorul clasei care seteaza sloganul si mentine numarul de instante.
* @param str
*/
public Slogan(String str){
fraza = str;
count++;
}
/**
* Metoda returneaza sloganul ca un string
* @return
*/
@Override
public String toString(){
return fraza;
}
/**
* Returnaza numarul de instante a obiectului.
*/
public static int getCount(){
return count;
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.