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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7bddbe0633cf4af506bb9e9e40ca56e806689125 | 0f05870a76f41c2aafe69d72f869d2f010870379 | /app/src/main/java/br/com/etechoracio/navegationdrawer/CustomFragment.java | 09b7557279933d314c4b8aa27c9bd6d67b95e075 | [] | no_license | nicoleduarteluna/ETEC-NavigationDrawer | a70cdc1f73c97fc4cf015f2fca6d13c769e898c4 | f9938d9107cc47a9806e47bb84b1215071b79ced | refs/heads/master | 2022-03-03T18:52:28.811143 | 2019-10-16T23:31:17 | 2019-10-16T23:31:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package br.com.etechoracio.navegationdrawer;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class CustomFragment extends Fragment {
private String nome;
private int idImagem;
public static CustomFragment newInstance(String nome, int idImagem) {
CustomFragment fragment = new CustomFragment();
fragment.nome = nome;
fragment.idImagem = idImagem;
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_custom, container, false);
ImageView imageView = view.findViewById(R.id.image);
imageView.setImageResource(idImagem);
getActivity().setTitle(nome);
return view;
}
}
| [
"nicoleduarteluna@hotmail.com"
] | nicoleduarteluna@hotmail.com |
23d8123c1795e0498aa27ae129b3c14e06eb7c7e | ae1513dfbf9a6d94b8aaa8db701b19b9defd3f1b | /Auction_Narubina-war/build/generated-sources/jax-ws/client/rate/Edit.java | b8c2c7b2a31245ff4bda0b7598d5b4f350b51170 | [] | no_license | Tanjusja/KURSACH | e51c4a1d14bc46be3a240edcfc09f2485c894d2a | 9326f5bdab3bd14cd98d33c4b8a05fd27920ea2d | refs/heads/master | 2021-01-23T14:05:29.824363 | 2013-11-25T22:45:37 | 2013-11-25T22:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,304 | java |
package client.rate;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for edit complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="edit">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="rate" type="{http://rate.ws/}rate" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "edit", propOrder = {
"rate"
})
public class Edit {
protected Rate rate;
/**
* Gets the value of the rate property.
*
* @return
* possible object is
* {@link Rate }
*
*/
public Rate getRate() {
return rate;
}
/**
* Sets the value of the rate property.
*
* @param value
* allowed object is
* {@link Rate }
*
*/
public void setRate(Rate value) {
this.rate = value;
}
}
| [
"tanyxxxl91@mail.ru"
] | tanyxxxl91@mail.ru |
a433cc03dffaf08284432d537b6af35dfcdbdd83 | 6f37eaffdaa808db45d55e4fd99f44b097eaefa0 | /src/main/java/com/JWmes/project/system/menu/mapper/MenuMapper.java | 555a6febf0f51a583cdd66524ce04f7134cf25b5 | [] | no_license | MinJW/shiroWithVelocity | 37836e314b8228634587eaf7b26155fe3c4f0457 | 68c74b18ccab0da23e91d544086b7b858ceebf9e | refs/heads/master | 2020-03-17T17:17:46.483129 | 2018-05-17T08:27:32 | 2018-05-17T08:27:32 | 133,782,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,844 | java | package com.JWmes.project.system.menu.mapper;
import com.JWmes.project.system.menu.entity.MenuEntity;
import java.util.List;
/**
* 菜单表 数据层
*
* @author zhong
*/
public interface MenuMapper
{
/**
* 根据用户ID查询菜单
*
* @param userId 用户ID
* @return 菜单列表
*/
public List<MenuEntity> selectMenusByUserId(Long userId);
/**
* 根据用户ID查询权限
*
* @param userId 用户ID
* @return 权限列表
*/
public List<String> selectPermsByUserId(Long userId);
/**
* 根据角色ID查询菜单
*
* @param roleId 角色ID
* @return 菜单列表
*/
public List<String> selectMenuTree(Long roleId);
/**
* 查询系统所有菜单
*
* @return 菜单列表
*/
public List<MenuEntity> selectMenuAll();
/**
* 删除菜单管理信息
*
* @param menuId 菜单ID
* @return 结果
*/
public int deleteMenuById(Long menuId);
/**
* 根据菜单ID查询信息
*
* @param menuId 菜单ID
* @return 菜单信息
*/
public MenuEntity selectMenuById(Long menuId);
/**
* 查询菜单数量
*
* @param parentId 菜单父ID
* @return 结果
*/
public int selectCountMenuByParentId(Long parentId);
/**
* 新增菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int insertMenu(MenuEntity menu);
/**
* 修改菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int updateMenu(MenuEntity menu);
/**
* 校验菜单名称是否唯一
*
* @param menuName 菜单名称
* @return 结果
*/
public MenuEntity checkMenuNameUnique(String menuName);
}
| [
"Min_jw@aliyun.com"
] | Min_jw@aliyun.com |
0b2f5bd97e0910dbfdff06f9a6f296ec21ac27cc | e0b5ad594b1ce9c1be268979573371223a5e8359 | /Secao_10_Exercicio_03_Fixacao/src/Matriz.java | c5f5d76211503a1c5030d678ddb942f4f282d2a9 | [] | no_license | Jaspion45/Java-Completo-2020-Programacao-Orientada-a-Objetos | c22d5ca597f0bb5d36b0d8d098b04fb4f1612f6b | 7a56a4188fe04fee6935541c9cf1ec4e8d94b554 | refs/heads/master | 2023-03-26T09:51:07.696406 | 2021-03-25T00:25:34 | 2021-03-25T00:25:34 | 350,890,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 967 | java | import java.util.Locale;
import java.util.Scanner;
public class Matriz {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
int M = sc.nextInt();
int N = sc.nextInt();
int[][] mat = new int[M][N];
for (int i = 0; i < mat.length; i++) {
for (int j = 0; j < mat[i].length; j++) {
mat[i][j] = sc.nextInt();
}
}
int x = sc.nextInt();
for (int i = 0; i < mat.length; i++) {
for (int j = 0; j < mat[i].length; j++) {
if (mat[i][j] == x) {
System.out.println("Position " + i + "," + j + ":");
if (j > 0) {
System.out.println("Left: " + mat[i][j-1]);
}
if (i > 0) {
System.out.println("Up: " + mat[i-1][j]);
}
if (j < mat[i].length-1) {
System.out.println("Right: " + mat[i][j+1]);
}
if (i < mat.length-1) {
System.out.println("Down: " + mat[i+1][j]);
}
}
}
}
sc.close();
}
}
| [
"jaspion_45@hotmail.com"
] | jaspion_45@hotmail.com |
283b7109fe0cc33ea78ba2c53e8f1dac81c63671 | f66e9ce73c8dfcab523e680b59bb1e55f5ebe5d1 | /src/DynamicProgramming/CompleteKnapsack.java | df96d8e8e0ba5fd3afbd771f7e61b61438d34a6f | [] | no_license | kqiu10/LeetcodeSolutionJava | b8ca84df4e7ada2ad6be3bf1a34b19054ebb3b60 | f4609cc2c1fc9d1c21180bc1162bc1a538c4c6e5 | refs/heads/master | 2023-05-31T07:19:51.896361 | 2021-06-19T20:44:57 | 2021-06-19T20:44:57 | 280,535,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package DynamicProgramming;
/**
* Date: 10/25/20
* Question Description
*/
/**
* Description: TODO
* Time complexity:O();
* Space complexity: O();
*/
public class CompleteKnapsack {
public int knapsackComplete(int[] weight, int[] value, int C, int N) {
int[][] memo = new int[N + 1][C + 1];
for (int i = 1; i <= N; i++) {
for (int j = 0; j <= C; j++) {
if (j < weight[i - 1]) {
memo[i][j] = memo[i - 1][j];
} else {
memo[i][j] = Math.max(memo[i - 1][j], value[i - 1] + memo[i - 1][j - weight[i - 1]]);
}
}
}
return memo[N - 1][C];
}
public int knapsackCompleteII(int[] weight, int[] value, int C, int N) {
int[] memo = new int[C + 1];
for (int i = 1; i < N; i++) {
for (int j = weight[i]; j <= C; j++) {
memo[j] = Math.max(memo[j], value[i] + memo[j - weight[i]]);
}
}
return memo[C];
}
}
| [
"qiukan97@gmail.com"
] | qiukan97@gmail.com |
7b7ce3ca96d9cdc9f5c0208c56fcfe9812a89d93 | a7ba399fc75f31383ae78579fc3acb33ad81d2d4 | /src/main/java/com/radkevich/bookreader/repository/CommentRepo.java | 016ec9678bc007976bdf5d1ba192f2250f35dd92 | [] | no_license | Vitold-sys/bookreader1 | cf34513c575f9a62bb94254c714332122fad5b6b | a6f29123cf75c5f7b426bd9b28313169d2c4a398 | refs/heads/master | 2020-11-25T08:53:42.787602 | 2019-12-23T13:14:09 | 2019-12-23T13:14:09 | 228,581,324 | 0 | 0 | null | 2020-10-13T18:23:05 | 2019-12-17T09:31:26 | Java | UTF-8 | Java | false | false | 290 | java | package com.radkevich.bookreader.repository;
import com.radkevich.bookreader.model.Comment;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface CommentRepo extends CrudRepository<Comment, Long> {
List<Comment> findByTag(String tag);
} | [
"52232795+Vitold-sys@users.noreply.github.com"
] | 52232795+Vitold-sys@users.noreply.github.com |
d63ee4af24f21c9dddc91a4afd8ac4ba5a32d6fc | e0fa5aa195bafcf0386a6bed8969026fa10ba6ec | /src/composition/loader/ATXParser.java | b1ffd2e8681b8a0799d2e6637e17d814aca1e641 | [] | no_license | WHOmagoo/SoundEngine | dfca4f9b8b484111692bb522e53af1b524c32f30 | 2cbbe34c685535b35f7f6a2200f31daaf173e20a | refs/heads/master | 2021-01-09T17:26:02.324772 | 2020-02-23T18:06:15 | 2020-02-23T18:06:15 | 242,387,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package composition.loader;
import sound.Clip;
import sound.TimeSignature;
import sound.loader.SongLoader;
import sound.song.Clips;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ATXParser {
public static Clips ParseATX(String s){
String[] lines = s.split(System.lineSeparator());
Pattern p = Pattern.compile("^\"(.*)\".*");
ArrayList<String> filePaths = new ArrayList<>();
for(String line : lines){
Matcher m = p.matcher(line);
if(m.matches()) {
filePaths.add(m.group(1));
}
}
return SongLoader.loadClips(filePaths.toArray(String[]::new), new TimeSignature(4,4,120,44100, 12));
}
}
| [
"hrmagoo@gmail.com"
] | hrmagoo@gmail.com |
29762e16d7a68af2317b364abdbf227039adaba9 | 9d998e1f469630fc4104280c454472f34b618cc5 | /app/src/main/java/com/wjx/android/wanandroidmvp/presenter/collect/CollectPresenter.java | b8d9f585c12a2de3e095e4732f6b92d0da8139ad | [
"Apache-2.0"
] | permissive | htl1104/WanAndroidMvp | 8b79896b129344718b04f62fec65eb2e53979827 | 504f7993e693f8a0f55a6a1597442a26cdef1b97 | refs/heads/master | 2022-11-07T22:00:03.313170 | 2020-06-27T10:06:05 | 2020-06-27T10:06:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,789 | java | package com.wjx.android.wanandroidmvp.presenter.collect;
import com.wjx.android.wanandroidmvp.base.presenter.BasePresenter;
import com.wjx.android.wanandroidmvp.bean.collect.AddCollect;
import com.wjx.android.wanandroidmvp.bean.db.Collect;
import com.wjx.android.wanandroidmvp.contract.collect.Contract;
import com.wjx.android.wanandroidmvp.model.CollectModel;
import java.util.List;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* Created with Android Studio.
* Description:
*
* @author: Wangjianxian
* @date: 2020/01/01
* Time: 22:39
*/
public class CollectPresenter extends BasePresenter<Contract.ICollectView> implements Contract.ICollectPresenter {
Contract.ICollectModel iCollectModel;
public CollectPresenter() {
iCollectModel = new CollectModel();
}
@Override
public void loadCollectData(int pageNum) {
if (isViewAttached() && pageNum == 0) {
getView().onLoading();
}
iCollectModel.loadCollectData(pageNum)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<List<Collect>>() {
@Override
public void onSubscribe(Disposable d) {
mCompositeDisposable.add(d);
}
@Override
public void onNext(List<Collect> collectBean) {
if (isViewAttached()) {
getView().onLoadCollectData(collectBean);
getView().onLoadSuccess();
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (isViewAttached()) {
getView().onLoadFailed();
}
}
@Override
public void onComplete() {
}
});
}
@Override
public void refreshCollectData(int pageNum) {
iCollectModel.refreshCollectData(pageNum)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<List<Collect>>() {
@Override
public void onSubscribe(Disposable d) {
mCompositeDisposable.add(d);
}
@Override
public void onNext(List<Collect> collectBean) {
if (isViewAttached()) {
getView().onRefreshCollectData(collectBean);
getView().onLoadSuccess();
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (isViewAttached()) {
getView().onLoadFailed();
}
}
@Override
public void onComplete() {
}
});
}
@Override
public void addCollect(String title, String author, String link) {
iCollectModel.addCollect(title, author, link)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<Collect>() {
@Override
public void onSubscribe(Disposable d) {
mCompositeDisposable.add(d);
}
@Override
public void onNext(Collect addCollect) {
if (isViewAttached()) {
getView().onAddCollect(addCollect);
getView().onLoadSuccess();
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (isViewAttached()) {
getView().onLoadFailed();
}
}
@Override
public void onComplete() {
}
});
}
@Override
public void unCollect(int articleId, int originId) {
iCollectModel.unCollect(articleId, originId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<com.wjx.android.wanandroidmvp.bean.collect.Collect>() {
@Override
public void onSubscribe(Disposable d) {
mCompositeDisposable.add(d);
}
@Override
public void onNext(com.wjx.android.wanandroidmvp.bean.collect.Collect collect) {
if (isViewAttached()) {
getView().onUnCollect(collect, articleId);
getView().onLoadSuccess();
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (isViewAttached()) {
getView().onLoadFailed();
}
}
@Override
public void onComplete() {
}
});
}
}
| [
"jianxianwang198@163.com"
] | jianxianwang198@163.com |
8d1da57f67981ed045020c4a077b1d7c2595e3e2 | 608c81924efd2a6a9789eae0f757967d5e3a9dfa | /leetcode/ValidPalindrome.java | d624a1c247f6e9aeca2a49d2b06956990501f744 | [] | no_license | SixPathsSage/100DaysOfCompetitiveCoding | 87bda93463171148b59fcae022e60348fa2c96c9 | f3bd69f5e4e0a67352e553828856d594bcb13bed | refs/heads/master | 2021-06-30T13:21:37.207594 | 2020-09-10T16:48:32 | 2020-09-10T16:48:32 | 146,382,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | 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 leetcode;
/**
*
* @author Siddharth
*/
public class ValidPalindrome
{
public static void main(String[] args) {
String s = "A man, a plan, a canal: Panama";
System.out.println(new ValidPalindrome().isPalindrome(s));
}
public boolean isPalindrome(String s) {
int i = 0;
int j = s.length()-1;
s = s.toLowerCase();
while(i < j)
{
if(!isValid(s.charAt(i)))
{
i ++;
}
else if(!isValid(s.charAt(j)))
{
j --;
}
else if(s.charAt(i) != s.charAt(j))
{
return false;
}
else
{
i ++;
j --;
}
}
return true;
}
public boolean isValid(char c)
{
if((c >= 48 && c <= 57) || (c >= 97 && c <= 122 ))
{
return true;
}
return false;
}
}
| [
"esiddharth1894@gmail.com"
] | esiddharth1894@gmail.com |
0a684eda14c41811c6dace63921d69d5040124c2 | 277dfe4114bca7646dfe2f71a3d939984dace4e8 | /PayrolltestingSorceCode/src/addEmployeePackage/EmailTesting.java | 3ba76faec731ccca57a3f2459dbc6cf2dcf588f2 | [] | no_license | amiransarii/PayrollSystem | 042abe87ddede7ee21d593b650443bb87d394ac1 | d17ee6ee3d420f8285d9916185dae34494bdc844 | refs/heads/master | 2020-08-02T20:42:21.277675 | 2019-09-28T13:08:08 | 2019-09-28T13:08:08 | 211,500,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,983 | java | package addEmployeePackage;
import static org.junit.Assert.*;
import org.junit.Test;
public class EmailTesting {
@Test
public void test() {
/* Employees Page correct input form */
String obj1 = "EMP201";
String obj3 = "Jackson";
String obj5 = "Bond";
String obj7 = "01/21/1989";
String obj9 = "Male";
String obj11= "jackson@yahoo.com";
String obj13 = "Male";
String obj16= "0172345658";
String obj17= "H.N0 34,Jack Street,Malaysia";
String obj19= "Developer";
String obj21= "ICT";
String obj23= "6000";
String obj25="02/21/2004";
/* Error When User enter some other form of value or
* submit page without any parameter*/
String obj2 = "EMP201";
String obj4 = "Jackson";
String obj6 = "Bond";
String obj8 = "01/21/1989";
String obj10 = "Male";
String obj12= "jackson@yahoo.com";
/*String obj12= "jackso.com";*/
String obj14 = "Male";
String obj15= "0172345658";
/* String obj15= "";*/
String obj18 = "H.N0 34,Jack Street,Malaysia";
String obj20= "Developer";
String obj22 = "ICT";
/*int obj22 = 22;*/
String obj24= "6000";
String obj26="02/21/2004";
/*Testing paramter when entering values are in correct form*/
/*assertEquals(obj1, obj2);*/
assertEquals(obj3, obj4);
assertEquals(obj5, obj6);
assertEquals(obj7, obj8);
assertEquals(obj9, obj10);
assertEquals(obj11, obj12);
assertEquals(obj13, obj14);
assertEquals(obj15, obj16);
assertEquals(obj17, obj18);
assertEquals(obj19, obj20);
assertEquals(obj21, obj22);
assertEquals(obj23, obj24);
assertEquals(obj25, obj26);
/*assertNull(obj15);*/
}
}
| [
"amiransari.my@gmail.com"
] | amiransari.my@gmail.com |
c3351d53f10cb21160699ec9fac9ff24b897e043 | 34cf7a41d0c7dc2485146852e700129497b68c8d | /result/MethodsFromColt/traditional_mutants/double_logGamma(double)/VDL_218/MethodsFromColt.java | 61c403fe29eead6ced261bc8bc21be9ce7b7d677 | [] | no_license | CruorVolt/mu | 59c3ea8937561a86cf17beb8ae0e0e93d41de307 | 49a181ba80121640d908c14bc1361a72b6da052f | refs/heads/master | 2021-03-12T23:25:45.815280 | 2015-09-22T18:44:58 | 2015-09-22T18:44:58 | 41,647,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,695 | java | // This is a mutant program.
// Author : ysma
package Test;
import java.util.Random;
import java.util.Arrays;
import org.apache.commons.math3.stat.StatUtils;
import org.apache.commons.math3.stat.descriptive.*;
public class MethodsFromColt
{
public static double autoCorrelation( double[] data, int lag, double mean, double variance )
{
int N = data.length;
double run = 0;
for (int i = lag; i < N; ++i) {
run += (data[i] - mean) * (data[i - lag] - mean);
}
return run / (N - lag) / variance;
}
public static int binarySearchFromTo( double[] elements, double key, int from, int to )
{
int low = from;
int high = to;
while (low <= high) {
int mid = (low + high) / 2;
double midVal = elements[mid];
if (midVal < key) {
low = mid + 1;
} else {
if (midVal > key) {
high = mid - 1;
} else {
return mid;
}
}
}
return -(low + 1);
}
public static double covariance( double[] elements1, double[] elements2 )
{
int size = elements1.length;
double sumx = elements1[0];
double sumy = elements2[0];
double Sxy = 0;
for (int i = 1; i < size; ++i) {
double x = elements1[i];
double y = elements2[i];
sumx += x;
Sxy += (x - sumx / (i + 1)) * (y - sumy / i);
sumy += y;
}
return Sxy / (size - 1);
}
public static double durbinWatson( double[] elements )
{
int size = elements.length;
double run = 0;
for (int i = 1; i < size; ++i) {
double x = elements[i] - elements[i - 1];
run += x * x;
}
return run;
}
public static double lag1( double[] elements, double mean )
{
int size = elements.length;
double r1;
double q = 0;
double v = (elements[0] - mean) * (elements[0] - mean);
for (int i = 1; i < size; i++) {
double delta0 = elements[i - 1] - mean;
double delta1 = elements[i] - mean;
q += (delta0 * delta1 - q) / (i + 1);
v += (delta1 * delta1 - v) / (i + 1);
}
r1 = q / v;
return r1;
}
public static double max( double[] elements )
{
int size = elements.length;
double max = elements[size - 1];
for (int i = size - 1; --i >= 0;) {
if (elements[i] > max) {
max = elements[i];
}
}
return max;
}
public static double meanDeviation( double[] elements, double mean )
{
int size = elements.length;
double sum = 0;
for (int i = size; --i >= 0;) {
sum += Math.abs( elements[i] - mean );
}
return sum / size;
}
public static double min( double[] elements )
{
int size = elements.length;
double min = elements[size - 1];
for (int i = size - 1; --i >= 0;) {
if (elements[i] < min) {
min = elements[i];
}
}
return min;
}
public static double product( double[] elements )
{
int size = elements.length;
double product = 1;
for (int i = size; --i >= 0;) {
product *= elements[i];
}
return product;
}
public static double quantile( double[] sortedElements, double phi )
{
int n = sortedElements.length;
double index = phi * (n - 1);
int lhs = (int) index;
double delta = index - lhs;
double result;
if (n == 0) {
return 0.0;
}
if (lhs == n - 1) {
result = sortedElements[lhs];
} else {
result = (1 - delta) * sortedElements[lhs] + delta * sortedElements[lhs + 1];
}
return result;
}
public static double sampleKurtosis( int size, double moment4, double sampleVariance )
{
int n = size;
double s2 = sampleVariance;
double m4 = moment4 * n;
return m4 * n * (n + 1) / ((n - 1) * (n - 2) * (n - 3) * s2 * s2) - 3.0 * (n - 1) * (n - 1) / ((n - 2) * (n - 3));
}
public static double sampleKurtosisStandardError( int size )
{
int n = size;
return Math.sqrt( 24.0 * n * (n - 1) * (n - 1) / ((n - 3) * (n - 2) * (n + 3) * (n + 5)) );
}
public static double sampleSkew( int size, double moment3, double sampleVariance )
{
int n = size;
double s = Math.sqrt( sampleVariance );
double m3 = moment3 * n;
return n * m3 / ((n - 1) * (n - 2) * s * s * s);
}
public static double sampleVariance( double[] elements, double mean )
{
int size = elements.length;
double sum = 0;
for (int i = size; --i >= 0;) {
double delta = elements[i] - mean;
sum += delta * delta;
}
return sum / (size - 1);
}
public static double sumOfLogarithms( double[] elements )
{
double logsum = 0;
for (int i = 0; i < elements.length; i++) {
logsum += Math.log( elements[i] );
}
return logsum;
}
public static double trimmedMean( double[] sortedElements, double mean, int left, int right )
{
int N = sortedElements.length;
int N0 = N;
for (int i = 0; i < left; ++i) {
mean += (mean - sortedElements[i]) / --N;
}
for (int i = 0; i < right; ++i) {
mean += (mean - sortedElements[N0 - 1 - i]) / --N;
}
return mean;
}
public static double weightedMean( double[] elements, double[] theWeights )
{
int size = elements.length;
double sum = 0.0;
double weightsSum = 0.0;
for (int i = size; --i >= 0;) {
double w = theWeights[i];
sum += elements[i] * w;
weightsSum += w;
}
return sum / weightsSum;
}
public static int binarySearchFromTo( int[] list, int key, int from, int to )
{
int midVal;
while (from <= to) {
int mid = (from + to) / 2;
midVal = list[mid];
if (midVal < key) {
from = mid + 1;
} else {
if (midVal > key) {
to = mid - 1;
} else {
return mid;
}
}
}
return -(from + 1);
}
public static double binomial( double n, long k )
{
if (k < 0) {
return 0;
}
if (k == 0) {
return 1;
}
if (k == 1) {
return n;
}
double a = n - k + 1;
double b = 1;
double binomial = 1;
for (long i = k; i-- > 0;) {
binomial *= a++ / b++;
}
return binomial;
}
public static double link( double r )
{
if (r < 0.0) {
double s = Math.exp( r );
return s / (1.0 + s);
} else {
double s = Math.exp( -r );
return 1.0 / (1.0 + s);
}
}
public static double winsorizedMean( double[] sortedElements, int left, int right )
{
int N = sortedElements.length;
double sum = 0;
for (int i = 0; i < sortedElements.length; i++) {
sum += sortedElements[i];
}
double mean = sum / sortedElements.length;
double leftElement = sortedElements[left];
for (int i = 0; i < left; ++i) {
mean += (leftElement - sortedElements[i]) / N;
}
double rightElement = sortedElements[N - 1 - right];
for (int i = 0; i < right; ++i) {
mean += (rightElement - sortedElements[N - 1 - i]) / N;
}
return mean;
}
public static double geometricPdf( int k, double p )
{
return p * Math.pow( 1 - p, k );
}
public static double kurtosis( double[] data )
{
double sum = 0;
double sumPD = 0;
double sumSq = 0;
for (int i = 0; i < data.length; i++) {
sum += data[i];
sumSq += data[i] * data[i];
}
double mean = sum / data.length;
double standardDeviation = Math.sqrt( (sumSq - mean * sum) / data.length );
for (int i = 0; i < data.length; i++) {
sumPD += Math.pow( data[i] - mean, 4 );
}
double moment4 = sumPD / data.length;
return -3 + moment4 / (standardDeviation * standardDeviation * standardDeviation * standardDeviation);
}
public static double logGamma( double xx )
{
double[] cof = { 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 };
double x = xx - 1.0;
double tmp = x + 5.5;
tmp -= (x + 0.5) * Math.log( tmp );
double ser = 1.000000000190015;
double[] coeff = cof;
for (int j = 0; j <= 5; j++) {
;
ser += coeff[j] / x;
}
return -tmp + Math.log( 2.5066282746310005 * ser );
}
public static double pooledMean( double[] data1, double[] data2 )
{
double sum1 = 0;
for (int i = 0; i < data1.length; i++) {
sum1 += data1[i];
}
double mean1 = sum1 / data1.length;
double sum2 = 0;
for (int i = 0; i < data2.length; i++) {
sum2 += data2[i];
}
double mean2 = sum2 / data2.length;
return (data1.length * mean1 + data2.length * mean2) / (data1.length + data2.length);
}
public static double pooledVariance( double[] data1, double[] data2 )
{
double sum1 = 0;
double sumSq1 = 0;
for (int i = 0; i < data1.length; i++) {
sum1 += data1[i];
sumSq1 += data1[i] * data1[i];
}
double mean1 = sum1 / data1.length;
double var1 = (sumSq1 - mean1 * sum1) / data1.length;
double sum2 = 0;
double sumSq2 = 0;
for (int i = 0; i < data2.length; i++) {
sum2 += data2[i];
sumSq2 += data2[i] * data2[i];
}
double mean2 = sum2 / data2.length;
double var2 = (sumSq2 - mean2 * sum2) / data2.length;
return (data1.length * var1 + data2.length * var2) / (data1.length + data2.length);
}
public static double polevl( double x, double[] coef, int N )
throws java.lang.ArithmeticException
{
double ans;
ans = coef[0];
for (int i = 1; i <= N; i++) {
ans = ans * x + coef[i];
}
return ans;
}
public static double rankInterpolated( double[] sortedList, double element, int index )
{
if (index >= 0) {
int to = index + 1;
int s = sortedList.length;
while (to < s && sortedList[to] == element) {
to++;
}
return to;
}
int insertionPoint = -index - 1;
if (insertionPoint == 0 || insertionPoint == sortedList.length) {
return insertionPoint;
}
double from = sortedList[insertionPoint - 1];
double to = sortedList[insertionPoint];
double delta = (element - from) / (to - from);
return insertionPoint + delta;
}
public static double sampleWeightedVariance( double[] data, double[] weights )
{
double sumOfWeights = 0;
double sumOfProducts = 0;
double sumOfSquaredProducts = 0;
for (int i = 0; i < data.length; i++) {
sumOfWeights += weights[i];
sumOfProducts += data[i] * weights[i];
sumOfSquaredProducts += data[i] * data[i] * weights[i];
}
return (sumOfSquaredProducts - sumOfProducts * sumOfProducts / sumOfWeights) / (sumOfWeights - 1);
}
public static double skew( double[] data )
{
double sum = 0;
double sumPD = 0;
double sumSq = 0;
for (int i = 0; i < data.length; i++) {
sum += data[i];
sumSq += data[i] * data[i];
}
double mean = sum / data.length;
double standardDeviation = Math.sqrt( (sumSq - mean * sum) / data.length );
for (int i = 0; i < data.length; i++) {
sumPD += Math.pow( data[i] - mean, 3 );
}
double moment3 = sumPD / data.length;
return moment3 / (standardDeviation * standardDeviation * standardDeviation);
}
public static double[] standardize( double[] data )
{
double sum = 0;
double sumSq = 0;
for (int i = 0; i < data.length; i++) {
sum += data[i];
sumSq += data[i] * data[i];
}
double mean = sum / data.length;
double sd = Math.sqrt( (sumSq - mean * sum) / data.length );
for (int i = 0; i < data.length; i++) {
data[i] = (data[i] - mean) / sd;
}
return data;
}
public static double weightedRMS( double[] data, double[] weights )
{
double sumOfProducts = 0;
double sumOfSquaredProducts = 0;
for (int i = 0; i < data.length; i++) {
sumOfProducts += data[i] * weights[i];
sumOfSquaredProducts = data[i] * data[i] * weights[i];
}
return sumOfProducts / sumOfSquaredProducts;
}
public static double harmonicMean( double[] data )
{
double sumOfInversions = 0;
for (int i = 0; i < data.length; i++) {
sumOfInversions += 1 / data[i];
}
return data.length / sumOfInversions;
}
public static double sumOfPowerOfDeviations( double[] data, int k, double c )
{
double sum = 0;
for (int i = 0; i < data.length; i++) {
sum += Math.pow( data[i] - c, k );
}
return sum;
}
public static double[] power( double[] data, int k )
{
for (int i = 0; i < data.length; i++) {
data[i] = Math.pow( data[i], k );
}
return data;
}
public static double[] square( double[] data )
{
for (int i = 0; i < data.length; i++) {
data[i] = data[i] * data[i];
}
return data;
}
public static void main( java.lang.String[] args )
{
double[] d = { 12, 13, 25, 11, 10 };
System.out.println( durbinWatson( d ) );
double[] d1 = { 25, 11, 12, 13, 10 };
System.out.println( durbinWatson( d1 ) );
}
}
| [
"lundgren.am@gmail.com"
] | lundgren.am@gmail.com |
39e10ef3a116be8a353a6fda9002ff54ccdd8fb1 | 4efa872e8aa0df351a7a857beb9b50e97d05b243 | /spring/src/main/java/spring/demo/App.java | acf620df92d59c232c2212bbe4932e1de9e26b27 | [] | no_license | zealpane/ssm-book-code | f63600248840c662ef1d3ea31284a4d7dc00be79 | a23be8edca3d3be6d7e0b9be6b00ed01bdfbe5b4 | refs/heads/master | 2022-12-24T09:54:38.814848 | 2019-09-08T13:10:28 | 2019-09-08T13:10:28 | 198,553,313 | 0 | 0 | null | 2022-12-16T00:01:50 | 2019-07-24T03:43:01 | Java | UTF-8 | Java | false | false | 187 | java | package spring.demo;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"zealpane"
] | zealpane |
7349259a00b0138e66a777ea03dc24c053b273a6 | 4158401bd6b66b0ee59fab2d027f80ae0337eb74 | /cognive-core/src/main/java/com/cognive/core/model/BasicBo.java | 6b7f267c33cb3975ab1bb96e86f5086b40e1a42f | [] | no_license | AlexUsovGit/cognive | 830b595b4964a8a9d72786f3294ab2615c4e022c | 28324e66912e67f75a50402b458f815e1225b773 | refs/heads/master | 2022-12-16T18:44:35.959407 | 2018-05-28T22:19:34 | 2018-05-28T22:19:34 | 194,631,880 | 0 | 0 | null | 2022-12-07T11:45:20 | 2019-07-01T08:27:48 | Java | UTF-8 | Java | false | false | 500 | java | package com.cognive.core.model;
import com.cognive.core.model.base.BaseModifiableBusinessObject;
import com.fasterxml.jackson.databind.JsonNode;
public class BasicBo extends BaseModifiableBusinessObject {
private String value;
private JsonNode ext;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public JsonNode getExt() {
return ext;
}
public void setExt(JsonNode ext) {
this.ext = ext;
}
}
| [
"AndreyGabrinovich@fico.com"
] | AndreyGabrinovich@fico.com |
99fe9d4e184337c5fa2ec7661834226d3b6da50d | dc5459ac2dfd8647cdbed41b2f41607f7007e660 | /app/src/main/java/com/vvm/sh/util/constantes/Testes.java | ae5dd26157d1075429422d16b9b787fe325f5a17 | [] | no_license | ArtemisSoftware/VVM-SH | 5961540712193620291ecf3427181579bb6229b9 | d433a6821bcd4c4f9a41ab25f664e72251b83d63 | refs/heads/master | 2021-07-05T06:57:05.535395 | 2021-02-22T15:53:14 | 2021-02-22T15:54:10 | 237,837,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,246 | java | package com.vvm.sh.util.constantes;
import com.vvm.sh.baseDados.entidades.Utilizador;
import java.util.ArrayList;
import java.util.List;
public class Testes {
public static List<Utilizador> obterUtilizadores(){
List<Utilizador> resultado = new ArrayList();
resultado.add(new Utilizador("500005", "7765", "SA", "Super administrador", "gustavomaia@vivamais.com"));
resultado.add(new Utilizador("12724", "58077278", "SA", "Marisa Mendonça", "gustavomaia@vivamais.com"));
resultado.add(new Utilizador("12010", "58077278", "SA", "Samuel Portela", "amuelportela@vivamais.com"));
resultado.add(new Utilizador("7187", "785678", "SA", "Paulo Braz", "paulobraz@vivamais.com"));
resultado.add(new Utilizador("12705", "1993", "SA", "Sara Leão", "paulobraz@vivamais.com"));
resultado.add(new Utilizador("12706", "23270", "SA", "Marta Ruxa (inativo)", "paulobraz@vivamais.com"));
resultado.add(new Utilizador("7543", "706269", "SA", "Ricardo Pereira (21-09 termico)", "paulobraz@vivamais.com"));
resultado.add(new Utilizador("1456", "5826268", "SA", "Ana Tomé (02-10 - Averiguacao)", "paulobraz@vivamais.com"));
return resultado;
}
//public String UTILIZADOR_TESTE []= {"12762", "12762", "Pedro Costa"};
//public String UTILIZADOR_TESTE []= {"4298", "10082019", "Rita Lima"}; //(o meu utilizador)
//public String UTILIZADOR_TESTE []= {"500005", "7765", "EU"}; //(o meu utilizador)
//public String UTILIZADOR_TESTE []= {"12759", "1991", "Marisa Ramos Ribeiro"}; //(o meu utilizador)
//public String UTILIZADOR_TESTE []= {"1951", "1207", "Lucia alves (TESTE)"};
//public String UTILIZADOR_TESTE []= {"1515", " 7744452", "Iolanda Serra"};
//public String UTILIZADOR_TESTE []= {"7510", " 779787", "Irina Torres"};
//public String UTILIZADOR_TESTE []= {"12788", "7353486", "Maria Ferreira"};
//public String UTILIZADOR_TESTE []= {"7409", "284908", "Dora"};
//public String UTILIZADOR_TESTE []= {"7869", "131117", "Ana Correira"};
//public String UTILIZADOR_TESTE []= {"12724", "58077278", "Marisa Mendonça"}; //12345 //58077278
//public String UTILIZADOR_TESTE []= {"1441", "1087713", "Debora Baltasar)"};
//public String UTILIZADOR_TESTE []= {"1927", "1379", "Diogo Ferreira (TESTE)"};
//public String UTILIZADOR_TESTE []= {"1496", "82444823", "Sandra Tome (TESTE)"};
//public String UTILIZADOR_TESTE []= {"1465", "8648441", "João Valente (TESTE)"};
//public String UTILIZADOR_TESTE []= {"7791", "779100", "Ana Cavalcanti"};
//public String UTILIZADOR_TESTE []= {"4035", "4035", "Alexandrina Ramalho"}; //(Alexandrina Ramalho)
//public String UTILIZADOR_TESTE []= {"1798", "12345", "Luis Pereira"}; //961 376 499
//public String UTILIZADOR_TESTE []= {"12786", "12345", "Dora Tomas"}; //961 394 110
//public String UTILIZADOR_TESTE []= {"1370", "19011981", "Natália Ferros"};
//public String UTILIZADOR_TESTE []= {"1468", "6648440", "bruno fonseca"};
//--public String UTILIZADOR_TESTE []= {"1006", "9205263", "Ana Garcia"};
//public String UTILIZADOR_TESTE []= {"12793", "12345", "Ana Sousa"};
//public String UTILIZADOR_TESTE []= {"9189", "12345", "bda"};
//public String UTILIZADOR_TESTE []= {"12759", "12345", "Marisa Ramos Ribeiro"};
//public String UTILIZADOR_TESTE []= {"7258", "652874", "Silvia Alves"};
//--
//public String UTILIZADOR_TESTE []= {"1420", "1408", "Helena Correia"};
//public String UTILIZADOR_TESTE []= {"12709", "54020860", "Lídia Mateus"};
//public String UTILIZADOR_TESTE []= {"1720", "108099", "Patricia Barbosa"};
//public String UTILIZADOR_TESTE []= {"7393", "648255", "Rita Freitas"};
//public String UTILIZADOR_TESTE []= {"1686", "190779", "Alexandrina Cunha"};
//public String UTILIZADOR_TESTE []= {"1680", "1680", "Sílvia Falcão"};
//public String UTILIZADOR_TESTE []= {"7730", "471466", "Carla Correia"};
//public String UTILIZADOR_TESTE []= {"7411", "412369", "Luisa Duarte"};
//public String UTILIZADOR_TESTE []= {"7591", "7591", "Ana Martins"};
//public String UTILIZADOR_TESTE []= {"7187", "26049", "Paulo Braz"};
//public String UTILIZADOR_TESTE []= {"7231", "917564", "Ivone Azevedo"};
//public String UTILIZADOR_TESTE []= {"7366", "76505732", "Silvia Cruz"};
//public String UTILIZADOR_TESTE []= {"1537", "86805161", "Magda Martins"};
//public String UTILIZADOR_TESTE []= {"7730", "471466", "Carla Correia"};
//public String UTILIZADOR_TESTE []= {"7758", "7758", "Patricio Sineiro"};
//public String UTILIZADOR_TESTE []= {"1456", "5826268", "Ana Tomé"};
//public String UTILIZADOR_TESTE []= {"1441", "1087713", "Debora Baltazar"};
//public String UTILIZADOR_TESTE []= {"12717", "50882672", "Elisabete Belfo"};
//public String UTILIZADOR_TESTE []= {"1472", "1231472", "andreia araujo"};
//public String UTILIZADOR_TESTE []= {"1465", "8648441", "Joao valente"};
//public String UTILIZADOR_TESTE []= {"7721", "519574", "Ana Corais"};
//public String UTILIZADOR_TESTE []= {"12704", "32048373", "Natalia Torres"};
//public String UTILIZADOR_TESTE []= {"1408", "1408", "Helena Correia"};
//public int UTILIZADOR_TESTE = 0;
//public int UTILIZADOR_TESTE = 2; //luis vigia
//public int UTILIZADOR_TESTE = 3;
//public int UTILIZADOR_TESTE = 4;
//public int UTILIZADOR_TESTE = 5;
//public int UTILIZADOR_TESTE = 6; //andreia araujo
//public int UTILIZADOR_TESTE = 7; //maria joao
//public int UTILIZADOR_TESTE = 8; //samuel portela
//public int UTILIZADOR_TESTE = 9; //Claudia Santos
//public int UTILIZADOR_TESTE = 10; //Magda Martins
//public int UTILIZADOR_TESTE = 11; //Rita Freitas
//public int UTILIZADOR_TESTE = 12; //elsa Miranda
//public int UTILIZADOR_TESTE = 13; //laura andrade
//public int UTILIZADOR_TESTE = 14; //desiderio
//public int UTILIZADOR_TESTE = 15; //miguel paixao
//public int UTILIZADOR_TESTE = 16; //silvia cruz
//public int UTILIZADOR_TESTE = 17; //joana nobre
//public int UTILIZADOR_TESTE = 18; //Helena correia
}
| [
"gustavo.maia@b2b.com.pt"
] | gustavo.maia@b2b.com.pt |
2c7ae31c53155d44f85b32a480bf4d693d54ac3b | a40bc7f0e3ca1c8ba4588029fc4a67b490f79d8e | /app/src/androidTest/java/com/example/labirynt2/ExampleInstrumentedTest.java | abf2735b959cc72ee90f2403cf67282ea8bed68e | [] | no_license | JaroszMichal/Maze | 528f7584bc334b74262ff04a057af1f87837704c | 9e05d3114caf1a8d8fc96e85626ac296c74a3b83 | refs/heads/master | 2023-01-13T11:56:43.798165 | 2020-11-07T21:18:37 | 2020-11-07T21:18:37 | 309,085,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.example.labirynt2;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.labirynt2", appContext.getPackageName());
}
}
| [
"jkm@jkm.pl"
] | jkm@jkm.pl |
625b9006eab02fd9cc9f75a3896092d194a88a9b | 3d7f60a174c38d6c8d4dba7a5cd47d1ac5c3cba3 | /Semana4/Proyecto/ProyectoMascotas/app/src/main/java/com/knaujolimac/proyectomascotas/restApi/model/MascotaLikeInstagramResponse.java | d8f3d47d2c5b3cca3fc00939e8274a2a76ce291e | [] | no_license | knaujolimac/Curso4_AplicacionesMovilesAndroid | e65d60a84c3ba08c74865eaa9315884ba94fb533 | d6faee41ebf851bae25c3828ee82a15c35f2f097 | refs/heads/master | 2021-01-11T03:25:04.896361 | 2016-11-07T05:14:49 | 2016-11-07T05:14:49 | 71,033,989 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package com.knaujolimac.proyectomascotas.restApi.model;
/**
* Created by Camilo Chaparro on 26/10/2016.
*/
public class MascotaLikeInstagramResponse {
private String codigoRespuesta;
public String getCodigoRespuesta() {
return codigoRespuesta;
}
public void setCodigoRespuesta(String codigoRespuesta) {
this.codigoRespuesta = codigoRespuesta;
}
}
| [
"knaujolimac@gmail.com"
] | knaujolimac@gmail.com |
43fa9c9ce25e95574f4e05554e20ceb6d3be4ba6 | 5ed9eff4c7ae1f49e383fb1a446e2ca3d86586a4 | /src/main/java/wiremock/MetricsExtension.java | fd61c32513fdc61f4c097f96081d079a509e31e6 | [] | no_license | mihaita-tinta/wiremock-metrics | 0ddd1c9b0cfe0107f3a9af8072f842f82733dd83 | 70efde037531e769b0bf15505529dd56eba976ec | refs/heads/master | 2022-09-29T08:57:23.393265 | 2020-06-03T19:17:41 | 2020-06-03T19:17:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,957 | java | package wiremock;
import com.github.tomakehurst.wiremock.core.Admin;
import com.github.tomakehurst.wiremock.extension.Parameters;
import com.github.tomakehurst.wiremock.extension.PostServeAction;
import com.github.tomakehurst.wiremock.stubbing.ServeEvent;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;
public class MetricsExtension extends PostServeAction {
@Override
public void doAction(ServeEvent serveEvent, Admin admin, Parameters parameters) {
super.doAction(serveEvent, admin, parameters);
}
@Override
public void doGlobalAction(ServeEvent serveEvent, Admin admin) {
super.doGlobalAction(serveEvent, admin);
try {
String path = "";
StubMapping stabMapping = serveEvent.getStubMapping();
if (stabMapping != null) {
if (stabMapping.getRequest() != null) {
try {
path = stabMapping.getRequest().getUrlPattern();
if(path == null){
path = stabMapping.getRequest().getUrlPathPattern();
}
} catch (Exception e){
MetricsRegistry.getInstance().increaseError("FailedParsingURLPattern");
}
}
}
if (path == null || path.length() == 0) {
try {
String url = serveEvent.getRequest().getUrl();
if(url == null){
MetricsRegistry.getInstance().increaseError("URLIsNull");
} else {
path = serveEvent.getRequest().getUrl().split("\\?")[0];
if(path == null){
MetricsRegistry.getInstance().increaseError("URLNotNullPathNull");
}
}
} catch (Exception e){
MetricsRegistry.getInstance().increaseError("FailedParsingURL");
}
}
MetricsRegistry.getInstance().recordTime(
path,
serveEvent.getRequest().getMethod().getName(),
serveEvent.getResponse().getStatus(),
serveEvent.getTiming().getTotalTime());
} catch (Exception e){
MetricsRegistry.getInstance().increaseError(e.getClass().getName());
}
}
@Override
public String getName() {
return this.getClass().getName();
}
}
| [
"michael.sklyar@cyren.com"
] | michael.sklyar@cyren.com |
593ff83ca108ccb94d18561b1d6d708191c38f88 | d28005b2c3738f4e8d892e4eff3a075afb2b8bc3 | /app/src/main/java/mq/com/chuohapps/ui/xbase/BaseModel.java | 8d6df095048746460f247e0e30ce0aa27bde695b | [] | no_license | Huyenchu26/Demo-Chu | 003ee73275580798f439b1a1e1784adda8242b51 | 0e833c7950b01e09d4c52ba08a42812dc894dadc | refs/heads/master | 2020-03-20T04:07:32.786702 | 2019-01-14T16:53:17 | 2019-01-14T16:53:17 | 137,171,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package mq.com.chuohapps.ui.xbase;
/**
* Created by nguyen.dang.tho on 10/31/2017.
*/
public class BaseModel {
}
| [
"chu.thi.ngoc.huyen@mqsolutions.com.vn"
] | chu.thi.ngoc.huyen@mqsolutions.com.vn |
cba8bcc29d676563e011dbde7a3ac7df18e6a0be | b5f332d8096ab0b65f51fe2d197cb7a70b48f759 | /src/test/java/guickito/core/DependencyInjectionTest.java | f817f2aa999022c75828910bd81a1b70b055c71d | [] | no_license | fhiegel/injeckto | 787606b560fd045dc046a42fe2cee34a04fb989f | ff889805fc8daa8df3bf05354262ddeb27b6c326 | refs/heads/master | 2021-05-10T08:55:52.326595 | 2018-01-25T13:04:19 | 2018-01-25T13:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package guickito.core;
import guickito.samples.MyInjectedObject;
import guickito.samples.MyMockedObject;
import guickito.samples.MySpyiedObject;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.MethodRule;
import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.internal.util.MockUtil;
import javax.inject.Inject;
import static org.assertj.core.api.Assertions.assertThat;
public class DependencyInjectionTest {
@ClassRule
public static InjectClassRule application = Guickito.injectClassRule().build();
@Rule
public MethodRule injection = application.inject();
@Mock
private MyMockedObject mocked;
@Spy
private MySpyiedObject spyied;
@Inject
private MyInjectedObject injectedObject;
@Test
public void should_inject_dependencies() throws Exception {
assertThat(injectedObject).isNotNull();
}
@Test
public void should_inject_mocked_dependencies() throws Exception {
assertThat(MockUtil.isMock(mocked)).isTrue();
}
@Test
public void should_inject_spied_dependencies() throws Exception {
assertThat(MockUtil.isSpy(spyied)).isTrue();
}
}
| [
"fabien.hiegel@gmail.com"
] | fabien.hiegel@gmail.com |
296a1c6bc3a67067db09c90b64b1159b9b8e3475 | 39f3492b6b515d8070cbebb3499790f7bc47f10f | /src/main/java/ru/geekbrains/market/error_handling/ResourceNotFoundException.java | 00d32ed8847f7f234ae03402d8e145648d46120f | [] | no_license | illa911/market | 4c29ac8546ca8fb9a0cee739c7768dc01673d9bc | a76f5cba3fb2a1fff330cb7393cee0eb8865fbf6 | refs/heads/master | 2023-05-28T19:05:00.149548 | 2021-06-15T15:38:16 | 2021-06-15T15:38:16 | 377,213,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package ru.geekbrains.market.error_handling;
public class ResourceNotFoundException extends RuntimeException {
public ResourceNotFoundException(String message) {
super(message);
}
}
| [
"78314860+illa911@users.noreply.github.com"
] | 78314860+illa911@users.noreply.github.com |
c9bd3c5ed88fa0cfbd9be8c25e48c0cd8ecb46d2 | e8cd907e1dc61220fafd4ea5a8c0fda2cd18963d | /src/main/java/com/dash/it/solution/viewmodel/AuthCredentials.java | 9ea93cd76fb0d63860430d3b47d7cc33815db031 | [] | no_license | jasonmanda/indeed-clone-api | 8c9e2cc2c752275c2b7f362342320c112e9c3b27 | 3eea9e59ac642708799060f1a93218bf22688215 | refs/heads/main | 2023-08-05T07:33:32.350682 | 2021-09-16T21:06:42 | 2021-09-16T21:06:42 | 407,314,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 520 | java | package com.dash.it.solution.viewmodel;
public class AuthCredentials {
private String email;
private String password;
private boolean remember;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isRemember() {
return remember;
}
public void setRemember(boolean remember) {
this.remember = remember;
}
}
| [
"jasonmandabrandja@gmail.com"
] | jasonmandabrandja@gmail.com |
08e7a176a0f840e34ff12f4ff10cd7aed2e47af7 | 14bdd78beb8dda0a756b26f8134dec94a2677e2d | /build/generated/not_namespaced_r_class_sources/debug/generateDebugRFile/out/com/google/gvr/permissionsupport/R.java | f15a5280cfa57445760f6054bf61b3cae9a30133 | [] | no_license | SzigetiBlanka/Presentation_measurement | ec6783be3acfb1c37f1d4df8184fb1dec39132ce | 3f8d8b9be28287ef9efd1ae856c84a1e34e8b25f | refs/heads/master | 2020-09-29T18:23:30.720429 | 2019-12-10T10:41:12 | 2019-12-10T10:41:12 | 227,092,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,234 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.google.gvr.permissionsupport;
public final class R {
private R() {}
public static final class color {
private color() {}
public static int alignment_marker_color = 0x7f060001;
public static int white_transparent = 0x7f060002;
}
public static final class dimen {
private dimen() {}
public static int alignment_marker_height = 0x7f080001;
public static int alignment_marker_thickness = 0x7f080002;
public static int transition_bottom_bar_height = 0x7f080003;
}
public static final class drawable {
private drawable() {}
public static int quantum_ic_close_white_24 = 0x7f090001;
public static int quantum_ic_settings_white_24 = 0x7f090002;
public static int rippleable = 0x7f090003;
public static int transition = 0x7f090004;
}
public static final class id {
private id() {}
public static int back_button = 0x7f0c0001;
public static int divider = 0x7f0c0002;
public static int transition_bottom_frame = 0x7f0c0003;
public static int transition_frame = 0x7f0c0004;
public static int transition_icon = 0x7f0c0005;
public static int transition_question_text = 0x7f0c0006;
public static int transition_switch_action = 0x7f0c0007;
public static int transition_text = 0x7f0c0008;
public static int transition_top_frame = 0x7f0c0009;
public static int ui_alignment_marker = 0x7f0c000a;
public static int ui_back_button = 0x7f0c000b;
public static int ui_back_button_holder = 0x7f0c000c;
public static int ui_settings_button = 0x7f0c000d;
public static int ui_settings_button_holder = 0x7f0c000e;
}
public static final class layout {
private layout() {}
public static int back_button = 0x7f0f0001;
public static int settings_button = 0x7f0f0002;
public static int transition_view = 0x7f0f0003;
public static int ui_layer = 0x7f0f0004;
public static int ui_layer_with_portrait_support = 0x7f0f0005;
}
public static final class string {
private string() {}
public static int app_name = 0x7f150001;
public static int back_button_content_description = 0x7f150002;
public static int cancel_button = 0x7f150003;
public static int dialog_button_got_it = 0x7f150004;
public static int dialog_button_open_help_center = 0x7f150005;
public static int dialog_message_incompatible_phone = 0x7f150006;
public static int dialog_message_no_cardboard = 0x7f150007;
public static int dialog_title = 0x7f150008;
public static int dialog_title_incompatible_phone = 0x7f150009;
public static int dialog_title_vr_core_not_enabled = 0x7f15000a;
public static int dialog_title_vr_core_not_installed = 0x7f15000b;
public static int dialog_title_warning = 0x7f15000c;
public static int dialog_vr_core_not_enabled = 0x7f15000d;
public static int dialog_vr_core_not_installed = 0x7f15000e;
public static int go_to_playstore_button = 0x7f150010;
public static int go_to_vr_listeners_settings_button = 0x7f150011;
public static int gvr_vr_mode_component = 0x7f150012;
public static int no_browser_text = 0x7f150013;
public static int place_your_phone_into_cardboard = 0x7f150014;
public static int place_your_viewer_into_viewer_format = 0x7f150015;
public static int settings_button_content_description = 0x7f150016;
public static int setup_button = 0x7f150017;
public static int switch_viewer_action = 0x7f150018;
public static int switch_viewer_prompt = 0x7f150019;
}
public static final class style {
private style() {}
public static int GvrDialogTheme = 0x7f160002;
public static int NoSystemUI = 0x7f160003;
public static int UiButton = 0x7f160004;
public static int VrActivityTheme = 0x7f160007;
}
}
| [
"szigetiblanka7@gmail.com"
] | szigetiblanka7@gmail.com |
629ccf66c484e95780f7b526f9ea30e52e0c605b | c9625e6fe112097630a9ae789b3534e132b00da1 | /src/main/java/com/march/libs/adapterlibs/QuickAdapter.java | 18c0ab831231de89c7d0b43a62a4c0afde160762 | [] | no_license | Darksiderl/cdlibs | 0efe31b23ca315a0d22c3051146943ec308d98fc | 1b69da7dee200327f100913193abc139af75a781 | refs/heads/master | 2021-01-22T08:48:16.740992 | 2016-03-08T06:04:53 | 2016-03-08T06:04:53 | 53,423,414 | 1 | 0 | null | 2016-03-08T15:34:15 | 2016-03-08T15:34:12 | Java | UTF-8 | Java | false | false | 2,294 | java | package com.march.libs.adapterlibs;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import java.util.List;
/**
* 抽象适配器,使用了模板方法模式,将设置item显示内容的部分抽象到了类外 这是单类型的抽象适配
*
* @author chendong
*
* @param <T>
* 泛型
*/
public abstract class QuickAdapter<T> extends BaseAdapter {
private LayoutInflater layoutInflater;
private int resId;
private List<T> datas;
private int viewCount = 3;
private Context context;
/**
* @param context
* 上下文对象,建议使用getApplicationContext();
* @param resId
* item布局id
* @param datas
* 数据集
*/
public QuickAdapter(Context context, int resId, List<T> datas) {
super();
this.layoutInflater = LayoutInflater.from(context);
this.resId = resId;
this.datas = datas;
this.context =context;
}
public Context getContext(){
return this.context;
}
public List<T> getData(){
return datas;
}
public void swapData(List<T> datas){
this.datas = datas;
notifyDataSetChanged();
}
public int getCount() {
return datas.size();
}
public Object getItem(int position) {
return datas.get(position);
}
public long getItemId(int position) {
return position;
}
int prePos = -1;
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = layoutInflater.inflate(resId, parent, false);
holder = new ViewHolder(convertView, viewCount);
convertView.setTag(holder);
//在这里绑定监听
bindListener4View(holder,datas.get(position),position);
} else {
holder = (ViewHolder) convertView.getTag();
}
//if (parent.getChildCount() == position&&prePos!=position)
bindData4View(holder, datas.get(position), position);
prePos = position;
return convertView;
}
/**
* 绑定数据
* @param holder
* @param data
*/
public abstract void bindData4View(ViewHolder holder, T data,int pos);
/**
* 绑定监听
* @param holder
* @param pos
*/
public abstract void bindListener4View(ViewHolder holder, T data,int pos);
}
| [
"1101873740@qq.com"
] | 1101873740@qq.com |
750ac602944513bf673f8aea583aed522dd9e0ad | 18e14014eb96679be37b5736ae54a4e6a30bf64c | /t-tian-service-api-impl/t-tian-service-api-impl-member/src/main/java/com/luyitian/son/member/mapper/entity/UserTokenDo.java | 5574b765fd3dc5b6c559fd682866196236d7a273 | [] | no_license | luyitiger2019/t-tian-super | 8963025377a065aa5bec802cf3bb684caf04d6b4 | 742dae37a9c7b64b997d358378b4f6e2be7bc751 | refs/heads/master | 2022-12-12T21:26:18.721654 | 2019-08-30T05:23:23 | 2019-08-30T05:23:23 | 204,616,534 | 1 | 0 | null | 2022-12-06T00:32:43 | 2019-08-27T04:01:02 | Java | UTF-8 | Java | false | false | 411 | java | package com.luyitian.son.member.mapper.entity;
import com.luyitian.son.base.entity.BaseDo;
import lombok.Data;
@Data
public class UserTokenDo extends BaseDo {
/**
* id
*/
private Long id;
/**
* 用户token
*/
private String token;
/**
* 登陆类型
*/
private String loginType;
/**
* 设备信息
*/
private String deviceInfor;
/**
* 用户userId
*/
private Long userId;
}
| [
"413852131@qqcom"
] | 413852131@qqcom |
9d0463b64cfa1bc88ec8305bacfd7f9e4bb78b46 | 09277a6f618f841187cd3c3c0a76d083b994a65e | /src/test/java/FizzBuzz.java | bc3d5ab7ef31ad5ac147d0e59aad1b48ceecd4a0 | [] | no_license | dzh1024/fizzbuzz-maven-scaffold | 6f6182e7265f511afb5d50357f007e94b44c2318 | 27504832aabb5c90ebd968fad8375224be4dbc02 | refs/heads/master | 2020-12-08T12:49:17.950848 | 2020-01-14T14:30:40 | 2020-01-14T14:30:40 | 232,985,402 | 0 | 0 | null | 2020-01-10T06:55:44 | 2020-01-10T06:55:44 | null | UTF-8 | Java | false | false | 272 | java |
public class FizzBuzz {
public static String getStr(int i) {
if (i % 3 == 0 && i % 5 == 0) {
return "FizzBuzz";
} else if (i % 3 == 0) {
return "Fizz";
} else if (i % 5 == 0) {
return "Buzz";
} else {
return String.valueOf(i);
}
}
}
| [
"1170669295@qq.com"
] | 1170669295@qq.com |
c03041f1823ed9ea2dd55997bbc8cfebb1647d7f | d3905f4dc0869daa8410ccad02d41cd0688f3146 | /app/src/main/java/bd/piniti/service_pro/PestControlSecondActivity.java | fa62ecca210e5f6ff7afc669c411dbf53463e488 | [] | no_license | Piniti-Project-Development/PinitiServicePro | 1b8874353e05b506dfcb23b144d25340c312e018 | e4828fcc1efc5bfe1e5ea97b2ded210fa8a1750f | refs/heads/master | 2021-04-13T23:42:44.228407 | 2020-03-22T15:44:37 | 2020-03-22T15:44:37 | 249,195,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,996 | java | package bd.piniti.service_pro;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import at.grabner.circleprogress.CircleProgressView;
public class PestControlSecondActivity extends AppCompatActivity {
TextView title, type;
ImageView back_img, search;
Button button;
CircleProgressView circleProgressView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pest_control_second);
circleProgressView = findViewById(R.id.circleView);
circleProgressView.setVisibility(View.VISIBLE);
circleProgressView.setOuterContourColor(getResources().getColor(R.color.blue));
circleProgressView.setTextSize(20);
circleProgressView.setBarColor(getResources().getColor(R.color.blue));
circleProgressView.setSpinBarColor(getResources().getColor(R.color.blue));
circleProgressView.setValue(Float.parseFloat("28"));
type = findViewById(R.id.type);
type.setText("Pest Control");
title = findViewById(R.id.title);
title.setText("Cockroach Control");
search = findViewById(R.id.search);
search.setVisibility(View.GONE);
back_img = findViewById(R.id.back_img);
back_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(PestControlSecondActivity.this,PestControlThirdActivity.class);
startActivity(intent);
}
});
}
}
| [
"Iyitechteam@gmail.com"
] | Iyitechteam@gmail.com |
8c27d83d5c07d4bdecfa3130b32c52e65ef268e4 | e68ae05928a08625d30a6e57abcdcbfaae612123 | /src/main/java/com/nttdata/myztl/service/dto/GruppoVarchiCriteria.java | 200a938dc9b78aaf845cfd561788823da8f26ed1 | [] | no_license | wolfang007/ZTL4 | 22c9e4dbf2d80224209cb4d6131eca6602bdf375 | 4ad466a124c11e54f148884f654ac3a2333aa051 | refs/heads/main | 2023-01-23T22:18:40.172458 | 2020-11-23T12:12:46 | 2020-11-23T12:12:46 | 315,301,750 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,351 | java | package com.nttdata.myztl.service.dto;
import com.nttdata.myztl.domain.enumeration.EntityStatus;
import io.github.jhipster.service.Criteria;
import io.github.jhipster.service.filter.BooleanFilter;
import io.github.jhipster.service.filter.DoubleFilter;
import io.github.jhipster.service.filter.Filter;
import io.github.jhipster.service.filter.FloatFilter;
import io.github.jhipster.service.filter.IntegerFilter;
import io.github.jhipster.service.filter.LongFilter;
import io.github.jhipster.service.filter.StringFilter;
import java.io.Serializable;
import java.util.Objects;
/**
* Criteria class for the {@link com.nttdata.myztl.domain.GruppoVarchi} entity. This class is used
* in {@link com.nttdata.myztl.web.rest.GruppoVarchiResource} to receive all the possible filtering options from
* the Http GET request parameters.
* For example the following could be a valid request:
* {@code /gruppo-varchis?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
* As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
* fix type specific filters.
*/
public class GruppoVarchiCriteria implements Serializable, Criteria {
/**
* Class for filtering EntityStatus
*/
public static class EntityStatusFilter extends Filter<EntityStatus> {
public EntityStatusFilter() {}
public EntityStatusFilter(EntityStatusFilter filter) {
super(filter);
}
@Override
public EntityStatusFilter copy() {
return new EntityStatusFilter(this);
}
}
private static final long serialVersionUID = 1L;
private LongFilter id;
private StringFilter nome;
private StringFilter descrizione;
private StringFilter descrioneIntervalli;
private EntityStatusFilter stato;
private LongFilter posizioneId;
private LongFilter zonaId;
public GruppoVarchiCriteria() {}
public GruppoVarchiCriteria(GruppoVarchiCriteria other) {
this.id = other.id == null ? null : other.id.copy();
this.nome = other.nome == null ? null : other.nome.copy();
this.descrizione = other.descrizione == null ? null : other.descrizione.copy();
this.descrioneIntervalli = other.descrioneIntervalli == null ? null : other.descrioneIntervalli.copy();
this.stato = other.stato == null ? null : other.stato.copy();
this.posizioneId = other.posizioneId == null ? null : other.posizioneId.copy();
this.zonaId = other.zonaId == null ? null : other.zonaId.copy();
}
@Override
public GruppoVarchiCriteria copy() {
return new GruppoVarchiCriteria(this);
}
public LongFilter getId() {
return id;
}
public void setId(LongFilter id) {
this.id = id;
}
public StringFilter getNome() {
return nome;
}
public void setNome(StringFilter nome) {
this.nome = nome;
}
public StringFilter getDescrizione() {
return descrizione;
}
public void setDescrizione(StringFilter descrizione) {
this.descrizione = descrizione;
}
public StringFilter getDescrioneIntervalli() {
return descrioneIntervalli;
}
public void setDescrioneIntervalli(StringFilter descrioneIntervalli) {
this.descrioneIntervalli = descrioneIntervalli;
}
public EntityStatusFilter getStato() {
return stato;
}
public void setStato(EntityStatusFilter stato) {
this.stato = stato;
}
public LongFilter getPosizioneId() {
return posizioneId;
}
public void setPosizioneId(LongFilter posizioneId) {
this.posizioneId = posizioneId;
}
public LongFilter getZonaId() {
return zonaId;
}
public void setZonaId(LongFilter zonaId) {
this.zonaId = zonaId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final GruppoVarchiCriteria that = (GruppoVarchiCriteria) o;
return (
Objects.equals(id, that.id) &&
Objects.equals(nome, that.nome) &&
Objects.equals(descrizione, that.descrizione) &&
Objects.equals(descrioneIntervalli, that.descrioneIntervalli) &&
Objects.equals(stato, that.stato) &&
Objects.equals(posizioneId, that.posizioneId) &&
Objects.equals(zonaId, that.zonaId)
);
}
@Override
public int hashCode() {
return Objects.hash(id, nome, descrizione, descrioneIntervalli, stato, posizioneId, zonaId);
}
// prettier-ignore
@Override
public String toString() {
return "GruppoVarchiCriteria{" +
(id != null ? "id=" + id + ", " : "") +
(nome != null ? "nome=" + nome + ", " : "") +
(descrizione != null ? "descrizione=" + descrizione + ", " : "") +
(descrioneIntervalli != null ? "descrioneIntervalli=" + descrioneIntervalli + ", " : "") +
(stato != null ? "stato=" + stato + ", " : "") +
(posizioneId != null ? "posizioneId=" + posizioneId + ", " : "") +
(zonaId != null ? "zonaId=" + zonaId + ", " : "") +
"}";
}
}
| [
"wolfang.leoni@nttdata.com"
] | wolfang.leoni@nttdata.com |
9b870c9e56fe761d97524487f8542e8f85326f39 | 8117fb5f96bd117a844d8ab6ba986dfffd976bbb | /de.unisiegen.gtitool.core/source/de/unisiegen/gtitool/core/exceptions/state/StateException.java | f5f2a6b74ceb01dde39c7ba4760bd134ef117cfd | [
"MIT"
] | permissive | cbsa-informatik-uni-siegen/gtitool | 1bcb4bd8f15630b581f9f9a1faa542748de96b13 | d3d8d9db1737f2d1cd7b0c2efa24d7f77e3e32da | refs/heads/master | 2021-01-02T08:32:20.336020 | 2011-08-29T15:24:21 | 2011-08-29T15:24:21 | 2,287,830 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | package de.unisiegen.gtitool.core.exceptions.state;
import de.unisiegen.gtitool.core.entities.Symbol;
import de.unisiegen.gtitool.core.exceptions.CoreException;
/**
* The {@link StateException} is used if the {@link Symbol} is not correct.
*
* @author Christian Fehler
* @version $Id$
*/
public abstract class StateException extends CoreException
{
/**
* The serial version uid.
*/
private static final long serialVersionUID = -1337383732135123383L;
/**
* Allocates a new {@link StateException}.
*/
public StateException ()
{
super ();
}
}
| [
"christian.fehler@gmx.de"
] | christian.fehler@gmx.de |
136e242b54154850fa66621b9b7dec40d0fe6176 | a2be26256789090c8b419e407dab2152b4da9ff2 | /app/src/main/java/com/cubikosolutions/dampgl/ejemplopcpartes/proveedor/ProveedorDeContenido.java | 9bc3fda5bb85f89461f5d9500a48d81c5bd5fed6 | [] | no_license | davidcbk/OApp | 90e60b7aa56cb5c413f4b2d9bdfa1bfe4fcb2bfa | c7f6ffe879ddab7368b062bbf38ecfd0fbd14134 | refs/heads/master | 2021-01-25T12:49:04.186578 | 2018-03-04T17:41:41 | 2018-03-04T17:41:41 | 123,511,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,393 | java | package com.cubikosolutions.dampgl.ejemplopcpartes.proveedor;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import java.util.ArrayList;
public class ProveedorDeContenido extends ContentProvider {
private static final int PARTE_ONE_REG = 1;
private static final int PARTE_ALL_REGS = 2;
private static final int BITACORA_ONE_REG = 3;
private static final int BITACORA_ALL_REGS = 4;
private SQLiteDatabase sqlDB;
public DatabaseHelper dbHelper;
private static final String DATABASE_NAME = "PartesOnline.db";
private static final int DATABASE_VERSION = 309;
private static final String PARTE_TABLE_NAME = "Parte"; // nombre de la tabla
private static final String BITACORA_TABLE_NAME = "Bitacora"; // nombre de la tabla
// Indicates an invalid content URI
public static final int INVALID_URI = -1;
// Defines a helper object that matches content URIs to table-specific parameters
private static final UriMatcher sUriMatcher;
// Stores the MIME types served by this provider
private static final SparseArray<String> sMimeTypes;
/*
* Initializes meta-data used by the content provider:
* - UriMatcher that maps content URIs to codes
* - MimeType array that returns the custom MIME type of a table
*/
static {
// Creates an object that associates content URIs with numeric codes
sUriMatcher = new UriMatcher(0);
/*
* Sets up an array that maps content URIs to MIME types, via a mapping between the
* URIs and an integer code. These are custom MIME types that apply to tables and rows
* in this particular provider.
*/
sMimeTypes = new SparseArray<String>();
// Adds a URI "match" entry that maps picture URL content URIs to a numeric code
sUriMatcher.addURI(
Contrato.AUTHORITY,
PARTE_TABLE_NAME,
PARTE_ALL_REGS);
sUriMatcher.addURI(
Contrato.AUTHORITY,
PARTE_TABLE_NAME + "/#",
PARTE_ONE_REG);
sUriMatcher.addURI(
Contrato.AUTHORITY,
BITACORA_TABLE_NAME,
BITACORA_ALL_REGS);
sUriMatcher.addURI(
Contrato.AUTHORITY,
BITACORA_TABLE_NAME + "/#",
BITACORA_ONE_REG);
// Specifies a custom MIME type for the picture URL table
sMimeTypes.put(
PARTE_ALL_REGS,
"vnd.android.cursor.dir/vnd." +
Contrato.AUTHORITY + "." + PARTE_TABLE_NAME);
sMimeTypes.put(
PARTE_ONE_REG,
"vnd.android.cursor.item/vnd."+
Contrato.AUTHORITY + "." + PARTE_TABLE_NAME);
sMimeTypes.put(
BITACORA_ALL_REGS,
"vnd.android.cursor.dir/vnd." +
Contrato.AUTHORITY + "." + BITACORA_TABLE_NAME);
sMimeTypes.put(
BITACORA_ONE_REG,
"vnd.android.cursor.item/vnd."+
Contrato.AUTHORITY + "." + BITACORA_TABLE_NAME);
}
public static class DatabaseHelper extends SQLiteOpenHelper {
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onOpen(SQLiteDatabase db) {
super.onOpen(db);
//if (!db.isReadOnly()){
//Habilitamos la integridad referencial
// db.execSQL("PRAGMA foreign_keys=ON;");
// }
}
// Añadimos esto para resolver el problema de la integridad referencial ya que a partir de la API 16 el método ha cambiado
@Override
public void onConfigure(SQLiteDatabase db){
db.setForeignKeyConstraintsEnabled(true);
}
@Override
public void onCreate(SQLiteDatabase db) {
// create table to store
db.execSQL("Create table "
+ PARTE_TABLE_NAME
+ "( _id INTEGER PRIMARY KEY ON CONFLICT ROLLBACK AUTOINCREMENT, "
+ Contrato.Parte.FECHA + " TEXT , "
+ Contrato.Parte.CLIENTE + " TEXT , "
+ Contrato.Parte.MOTIVO + " TEXT , "
+ Contrato.Parte.RESOLUCION + " TEXT ); "
);
db.execSQL("Create table "
+ BITACORA_TABLE_NAME
+ "( _id INTEGER PRIMARY KEY ON CONFLICT ROLLBACK AUTOINCREMENT, "
+ Contrato.Bitacora.ID_PARTE + " INTEGER , "
+ Contrato.Bitacora.OPERACION + " INTEGER ); "
);
// inicializarDatos(db);
}
void inicializarDatos(SQLiteDatabase db){
db.execSQL("INSERT INTO " + PARTE_TABLE_NAME + " (" + Contrato.Parte._ID + "," + Contrato.Parte.FECHA + "," + Contrato.Parte.CLIENTE+ "," + Contrato.Parte.MOTIVO + "," + Contrato.Parte.RESOLUCION + ") " +
"VALUES (1,'01/11/17','Cubiko Solutions','Implementacion Servidor','Actualizaciones')");
db.execSQL("INSERT INTO " + PARTE_TABLE_NAME + " (" + Contrato.Parte._ID + "," + Contrato.Parte.FECHA + "," + Contrato.Parte.CLIENTE+ "," + Contrato.Parte.MOTIVO + "," + Contrato.Parte.RESOLUCION + ") " +
"VALUES (2,'02/11/17','Cubiko Solutions','Implementacion Servidor 2','Creacion dominio')");
db.execSQL("INSERT INTO " + PARTE_TABLE_NAME + " (" + Contrato.Parte._ID + "," + Contrato.Parte.FECHA + "," + Contrato.Parte.CLIENTE+ "," + Contrato.Parte.MOTIVO + "," + Contrato.Parte.RESOLUCION + ") " +
"VALUES (3,'01/11/17','VM Consulting','Impresora no imprime','Reinstalacion')");
db.execSQL("INSERT INTO " + PARTE_TABLE_NAME + " (" + Contrato.Parte._ID + "," + Contrato.Parte.FECHA + "," + Contrato.Parte.CLIENTE+ "," + Contrato.Parte.MOTIVO + "," + Contrato.Parte.RESOLUCION + ") " +
"VALUES (4,'04/11/17','L7VE Magazine','Actualizacion BD','Actualiza BD')");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + PARTE_TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + BITACORA_TABLE_NAME);
onCreate(db);
}
}
public ProveedorDeContenido() {
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public boolean onCreate() {
dbHelper = new DatabaseHelper(getContext());
return (dbHelper == null) ? false : true;
}
public void resetDatabase() {
dbHelper.close();
dbHelper = new DatabaseHelper(getContext());
}
@Override
public Uri insert(Uri uri, ContentValues values) {
sqlDB = dbHelper.getWritableDatabase();
String table = "";
switch (sUriMatcher.match(uri)) {
case PARTE_ALL_REGS:
table = PARTE_TABLE_NAME;
break;
case BITACORA_ALL_REGS:
table = BITACORA_TABLE_NAME;
break;
}
long rowId = sqlDB.insert(table, "", values);
if (rowId > 0) {
Uri rowUri = ContentUris.appendId(
uri.buildUpon(), rowId).build();
getContext().getContentResolver().notifyChange(rowUri, null);
return rowUri;
}
throw new SQLException("Fallo al insertar fila en " + uri);
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
sqlDB = dbHelper.getWritableDatabase();
// insertRecord record in user table and get the row number of recently inserted record
String table = "";
switch (sUriMatcher.match(uri)) {
case PARTE_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Parte._ID + " = "
+ uri.getLastPathSegment();
table = PARTE_TABLE_NAME;
break;
case PARTE_ALL_REGS:
table = PARTE_TABLE_NAME;
break;
case BITACORA_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Bitacora._ID + " = "
+ uri.getLastPathSegment();
table = BITACORA_TABLE_NAME;
break;
case BITACORA_ALL_REGS:
table = BITACORA_TABLE_NAME;
break;
}
int rows = sqlDB.delete(table, selection, selectionArgs);
if (rows > 0) {
getContext().getContentResolver().notifyChange(uri, null);
return rows;
}
throw new SQLException("Fallo al insertar fila en " + uri);
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
SQLiteDatabase db = dbHelper.getReadableDatabase();
String query = null;
switch (sUriMatcher.match(uri)) {
case PARTE_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Parte._ID + " = "
+ uri.getLastPathSegment();
qb.setTables(PARTE_TABLE_NAME);
break;
case PARTE_ALL_REGS:
if (TextUtils.isEmpty(sortOrder)) sortOrder =
Contrato.Parte._ID + " ASC";
qb.setTables(PARTE_TABLE_NAME);
break;
case BITACORA_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Bitacora._ID + " = "
+ uri.getLastPathSegment();
qb.setTables(BITACORA_TABLE_NAME);
break;
case BITACORA_ALL_REGS:
if (TextUtils.isEmpty(sortOrder)) sortOrder =
Contrato.Bitacora._ID + " ASC";
qb.setTables(BITACORA_TABLE_NAME);
break;
}
Cursor c;
c = qb.query(db, projection, selection, selectionArgs, null, null,
sortOrder);
// c.setNotificationUri(getContext().getContentResolver(), uri);
return c;
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
sqlDB = dbHelper.getWritableDatabase();
// insertRecord record in user table and get the row number of recently inserted record
String table = "";
switch (sUriMatcher.match(uri)) {
case PARTE_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Parte._ID + " = "
+ uri.getLastPathSegment();
table = PARTE_TABLE_NAME;
break;
case PARTE_ALL_REGS:
table = PARTE_TABLE_NAME;
break;
case BITACORA_ONE_REG:
if (null == selection) selection = "";
selection += Contrato.Bitacora._ID + " = "
+ uri.getLastPathSegment();
table = BITACORA_TABLE_NAME;
break;
case BITACORA_ALL_REGS:
table = BITACORA_TABLE_NAME;
break;
}
int rows = sqlDB.update(table, values, selection, selectionArgs);
if (rows > 0) {
getContext().getContentResolver().notifyChange(uri, null);
return rows;
}
throw new SQLException("Failed to updateRecord row into " + uri);
}
}
| [
"dmedina@cubikosolutions.com"
] | dmedina@cubikosolutions.com |
a48fde858c6b7db9d153a52a35e152b66f18a1ea | ab69bef51daa7f4e44b927df0a28bfec6a61e351 | /MethodDef.java | e3521a47b90d296cef689b6de90e9f54e3e8ad87 | [] | no_license | swethaqa/JAVASamples | da05bbe42aa153a278aab80b3ab5dea9f37cd7eb | 2332a6ba53492c9b5e9c92f6371dcac1798aefff | refs/heads/master | 2021-05-04T08:01:06.045957 | 2016-09-25T02:27:17 | 2016-09-25T02:27:17 | 69,139,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package assignment;
public class MethodDef {
public int division(int a,int b) {
int c = a / b;
return c;
}
public int multiply(int a, int b) {
int c = a * b;
return c;
}
}
| [
"noreply@github.com"
] | swethaqa.noreply@github.com |
ec5221f6e67f95303973cbd5607b97a8270f7f9e | 995e655293513d0b9f93d62e28f74b436245ae74 | /src/com/htc/gc/companion/settings/ui/gn.java | 51c00ef6b8dd51f5f78c8a1bbf0066083274d395 | [] | no_license | JALsnipe/HTC-RE-YouTube-Live-Android | 796e7c97898cac41f0f53120e79cde90d3f2fab1 | f941b64ad6445c0a0db44318651dc76715291839 | refs/heads/master | 2021-01-17T09:46:50.725810 | 2015-01-09T23:32:14 | 2015-01-09T23:32:14 | 29,039,855 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,076 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.htc.gc.companion.settings.ui;
import android.app.NotificationManager;
import android.util.Log;
import com.htc.gc.companion.b.q;
import com.htc.gc.companion.service.GCFirmwareUpdateService;
import com.htc.gc.companion.service.bv;
import com.htc.gc.companion.ui.ee;
import com.htc.gc.interfaces.bw;
// Referenced classes of package com.htc.gc.companion.settings.ui:
// go, UpdateAvailableActivity, gt, gs,
// gu, gv, gw, gx,
// gy, gz, gp, gq,
// gr
public class gn
implements q
{
final UpdateAvailableActivity a;
public gn(UpdateAvailableActivity updateavailableactivity)
{
a = updateavailableactivity;
super();
}
public void a()
{
Log.d("UpdateAvailableActivity", "on download complete !");
a.runOnUiThread(new go(this));
}
public void a(int i1)
{
try
{
UpdateAvailableActivity.o(a).a(i1);
return;
}
catch (Exception exception)
{
Log.d("UpdateAvailableActivity", "update download progress error !");
exception.printStackTrace();
return;
}
}
public void b()
{
Log.w("UpdateAvailableActivity", "on cancel download !");
UpdateAvailableActivity.a(a, true);
((NotificationManager)a.getSystemService("notification")).cancel("HTC_GC_COMPANION_REQUEST_PERMISSION", 1408);
UpdateAvailableActivity.p(a);
}
public void b(int i1)
{
a.runOnUiThread(new gt(this, i1));
}
public void c()
{
Log.w("UpdateAvailableActivity", "on download error !");
UpdateAvailableActivity.a(a, true);
UpdateAvailableActivity.p(a);
a.runOnUiThread(new gs(this));
}
public void c(int i1)
{
try
{
UpdateAvailableActivity.s(a).a(i1 / 1024);
return;
}
catch (Exception exception)
{
Log.d("UpdateAvailableActivity", "update upload progress error !");
exception.printStackTrace();
return;
}
}
public void d()
{
Log.d("UpdateAvailableActivity", "on upload complete !");
UpdateAvailableActivity.a(a, true);
try
{
UpdateAvailableActivity.s(a).a(0);
if (UpdateAvailableActivity.s(a) != null && UpdateAvailableActivity.s(a).isShowing())
{
UpdateAvailableActivity.s(a).dismiss();
}
UpdateAvailableActivity.b(a, null);
return;
}
catch (Exception exception)
{
Log.d("UpdateAvailableActivity", "dismiss upload progress dialog error");
exception.printStackTrace();
return;
}
}
public void e()
{
Log.w("UpdateAvailableActivity", "on cancel upload !");
UpdateAvailableActivity.a(a, true);
((NotificationManager)a.getSystemService("notification")).cancel("HTC_GC_COMPANION_REQUEST_PERMISSION", 1411);
UpdateAvailableActivity.p(a);
}
public void f()
{
Log.w("UpdateAvailableActivity", "on upload error !");
UpdateAvailableActivity.a(a, true);
UpdateAvailableActivity.p(a);
a.runOnUiThread(new gu(this));
}
public void g()
{
UpdateAvailableActivity.a(a, false);
a.runOnUiThread(new gv(this));
}
public void h()
{
Log.d("UpdateAvailableActivity", "start Update");
a.runOnUiThread(new gw(this));
}
public void i()
{
Log.w("UpdateAvailableActivity", "on update complete !");
UpdateAvailableActivity.a(a, false);
a.runOnUiThread(new gx(this));
}
public void j()
{
Log.w("UpdateAvailableActivity", "on update error !");
UpdateAvailableActivity.a(a, true);
UpdateAvailableActivity.p(a);
a.runOnUiThread(new gy(this));
}
public void k()
{
Log.w("UpdateAvailableActivity", "show unzip dialog !");
UpdateAvailableActivity.a(a, false);
a.runOnUiThread(new gz(this));
}
public void l()
{
Log.w("UpdateAvailableActivity", "stop unzip dialog !");
a.runOnUiThread(new gp(this));
}
public void m()
{
Log.w("UpdateAvailableActivity", "unzip error !");
UpdateAvailableActivity.p(a);
UpdateAvailableActivity.a(a, true);
a.runOnUiThread(new gq(this));
}
public void n()
{
if (bv.d().c().A() == bw.a)
{
if (UpdateAvailableActivity.a != null)
{
UpdateAvailableActivity.a.c();
}
return;
} else
{
a.runOnUiThread(new gr(this));
UpdateAvailableActivity.d(a, true);
bv.d().y();
return;
}
}
}
| [
"josh.lieberman92@gmail.com"
] | josh.lieberman92@gmail.com |
7fa7ca1e9d175b03e59aadc251551d26241013c4 | 6df071afab942a6932a6d6bc6bca691b44e16d6c | /src/main/java/br/com/compasso/web/cadastroclientes/domain/Cidade.java | 834a08843663f7c60bffcf08683f2dba167d847c | [] | no_license | Nadiane/CadastroCliente | c6b541aa711c2fd58f2263eaad61ffc9cb66a554 | 4d768e9eccc96213817d0656aa4ac49cdfb04e02 | refs/heads/master | 2020-06-25T15:41:32.630385 | 2019-07-31T03:10:53 | 2019-07-31T03:10:53 | 199,356,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,745 | java | package br.com.compasso.web.cadastroclientes.domain;
import org.hibernate.validator.constraints.NotBlank;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Objects;
@Entity
@Table(name = "tb_cidade")
public class Cidade implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Size(max = 100, message = "Nome possui limite de 100 Caracteres.")
@NotBlank(message = "Por favor, informe o nome da Cidade.")
@Column(nullable = false, length = 100, unique = true)
private String nome;
@Size(max = 100, message = "Estado possui limite de 100 Caracteres.")
@NotBlank(message = "Por favor, informe o estado da Cidade.")
@Column(nullable = false, length = 100)
private String estado;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEstado() {
return estado;
}
public void setEstado(String estado) {
this.estado = estado;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Cidade cidade = (Cidade) o;
return id == cidade.id &&
Objects.equals(nome, cidade.nome) &&
Objects.equals(estado, cidade.estado);
}
@Override
public int hashCode() {
return Objects.hash(id, nome, estado);
}
}
| [
"nadiane.t.ferreira@accenture.com"
] | nadiane.t.ferreira@accenture.com |
63de61165ce65096befc0d5b5f157b1ffaf7b6dc | 02d55c6099fe1398fe27fc446dc050d3856d92f6 | /ThinkingInJava10/src/Test26.java | 99a2b5d6f6e43765df78c653388c68926ff3db49 | [
"Apache-2.0"
] | permissive | wu-sicheng/Thinking-in-Java-4th | 398b54802cbabbc32737f4368929ef022c974c0a | 8a0dbc52a7f879f3c6998f32d0e8c88dfe143372 | refs/heads/master | 2021-05-31T11:40:18.479659 | 2016-02-29T13:09:37 | 2016-02-29T13:09:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | class A26{
class A26In{
public A26In(int i){
System.out.println(i);
}
}
}
public class Test26 {
public class Test26In extends A26.A26In{
public Test26In(A26 a26, int i) {
a26.super(i);
}
}
public static void main(String args[]){
Test26 t=new Test26();
Test26.Test26In i=t.new Test26In(new A26(),1);
}
}
| [
"1656423700@qq.com"
] | 1656423700@qq.com |
d37815737a8f8b0b73be96d584089216f04f1bd2 | a7534992c482b656cfb9924f2cdbad8bb29416a7 | /app/src/main/java/com/buildmyapp/android/DevDetailsActivity.java | 16e3507b4da9c81e1fc7d3b0df3364e32b51881b | [
"MIT"
] | permissive | labs13-build-my-app/Android | 33b7b92b6db52627356e520ba359feabb5ec5874 | 55fd93ab7b52776a15ffd9bdff0a66fecc9d203e | refs/heads/master | 2020-05-30T00:04:36.440895 | 2019-06-28T19:52:45 | 2019-06-28T19:52:45 | 189,450,540 | 2 | 1 | MIT | 2019-06-28T20:07:10 | 2019-05-30T16:53:39 | HTML | UTF-8 | Java | false | false | 1,665 | java | package com.buildmyapp.android;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import com.buildmyapp.android.innerActivity.MessageSeller;
import com.bumptech.glide.Glide;
public class DevDetailsActivity extends AppCompatActivity {
private ImageView profile;
private AppCompatTextView name, desc;
private Button sendMessage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dev_details);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
profile = findViewById(R.id.profile);
name = findViewById(R.id.name);
desc = findViewById(R.id.description);
sendMessage = findViewById(R.id.messageDev);
desc.setText(getIntent().getStringExtra("desc"));
name.setText(getIntent().getStringExtra("name"));
try {
Glide.with(this).load(getIntent().getStringExtra("profile")).into(profile);
} catch (Exception e) {
}
sendMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent messageDev = new Intent(DevDetailsActivity.this, MessageSeller.class);
startActivity(messageDev);
}
});
}
}
| [
"pabloogata@gmail.com"
] | pabloogata@gmail.com |
2736942758651c46a65b445db16692dab5ca3d28 | 4ca107f8d2b1eb07159204d8b8cb36aed296532e | /TangoRosStreamer/app/src/main/java/eu/intermodalics/tango_ros_streamer/Logger.java | fb65ee0ce54c7955d432524d4695a227f1de95b1 | [
"Apache-2.0"
] | permissive | gitunit/tango_ros | 52981979e9f0fe2689c6ad65cc6da34e503d930b | 56472428c9d27af60105e4f693b4fb5eb8de26d0 | refs/heads/master | 2021-01-11T16:40:16.992166 | 2017-01-25T13:30:40 | 2017-01-25T13:30:40 | 80,135,397 | 2 | 0 | null | 2017-01-26T17:07:20 | 2017-01-26T17:07:20 | null | UTF-8 | Java | false | false | 5,058 | java | /*
* Copyright 2016 Intermodalics 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 eu.intermodalics.tango_ros_streamer;
import android.app.Activity;
import android.os.Environment;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* This class is responsible for retrieving the logcat text and writing it to file.
*/
public class Logger {
private static final String TAG = Logger.class.getSimpleName();
private static final long LOG_THREAD_DURATION = 15000; // ms
private static final int LOG_THREAD_SLEEP_DURATION = 500; // ms
private Activity mActivity;
private TextView mLogTextView;
private String mLogCommand;
private String mLogFileName;
private int mLogTextMaxLength;
private StringBuilder mLogStringBuilder;
private File mLogFile;
private Thread mLogThread;
public Logger(Activity activity, TextView logTextView, String tagsToLog,
String logFileName, int logTextMaxLength) {
mActivity = activity;
mLogTextView = logTextView;
mLogCommand = "logcat -d -s " + tagsToLog;
mLogFileName = logFileName;
mLogTextMaxLength = logTextMaxLength;
mLogStringBuilder = new StringBuilder();
mLogThread = new Thread(new Runnable() {
@Override
public void run() {
long endTime = System.currentTimeMillis() + (LOG_THREAD_DURATION);
while (System.currentTimeMillis() <= endTime) {
updateLogText();
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
mLogTextView.setText(getLogText());
}
});
try {
mLogThread.sleep(LOG_THREAD_SLEEP_DURATION);
} catch (InterruptedException e) {
Log.e(TAG, e.toString());
}
}
}
});
}
public void start() {
mLogThread.start();
}
public void updateLogText() {
try {
Process process = Runtime.getRuntime().exec(mLogCommand);
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line = "";
while ((line = bufferedReader.readLine()) != null) {
mLogStringBuilder.append(line + "\n");
}
// The following allows to keep only the end of the logcat text.
mLogStringBuilder.reverse();
mLogStringBuilder.setLength(mLogTextMaxLength);
mLogStringBuilder.reverse();
} catch (IOException e) {
Log.e(TAG, e.toString());
}
}
public void setLogFileName(String logFileName) {
mLogFileName = logFileName;
}
public String getLogText() {
return mLogStringBuilder.toString();
}
public void saveLogToFile() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
mLogFile = new File(Environment.getExternalStorageDirectory().getPath(), mLogFileName
+ "_" + dateFormat.format(new Date()) + ".txt");
if (!mLogFile.exists()) {
try {
mLogFile.createNewFile();
} catch (IOException e) {
Log.e(TAG, e.toString());
}
}
try {
BufferedWriter buf = new BufferedWriter(new FileWriter(mLogFile, false));
buf.write(getLogText());
Log.i(TAG, "Saved log to file: " + mLogFile.getAbsolutePath());
buf.close();
} catch (IOException e) {
Log.e(TAG, e.toString());
}
}
public File getLogFile() {
if (mLogFile == null) {
Log.e(TAG, "Log file is null");
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(mActivity.getApplicationContext(), "Unexpected error : log file is null", Toast.LENGTH_SHORT).show();
}
});
return null;
}
return mLogFile;
}
} | [
"perrine.aguiar@intermodalics.eu"
] | perrine.aguiar@intermodalics.eu |
353755b67fc3167e1cbbad8469580072179f1424 | ce889aed95bdd6669f5ee380b98113c28511c00f | /src.main.java/com/bit2015/bitin/interceptor/AuthInterceptor.java | 9888214ea28d854353558f9d18247c18c9a689e8 | [] | no_license | bebop84/Stubit | d4a13f4db1603b618c1fe60a10efcfd8004183f9 | 565d0dbd1e804d5df646488490018a3c7eb89331 | refs/heads/master | 2016-08-11T21:49:40.434910 | 2016-02-15T09:15:56 | 2016-02-15T09:15:56 | 51,742,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,554 | java | package com.bit2015.bitin.interceptor;
import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.bit2015.bitin.annotation.Auth;
import com.bit2015.bitin.vo.UserVo;
public class AuthInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler ) throws Exception {
//TODO: 실행은되는데 에러가뜸 "cannot be cast to org.springframework.web.method.HandlerMethod" 선생님한테 물어보기
/*
-----------원인-------------
<mvc:interceptor>
<mvc:mapping path="/**" />
<mvc:exclude-mapping path="/user/login" />
<mvc:exclude-mapping path="/user/logout" />
<mvc:exclude-mapping path="/assets/**" />
<bean class="com.bit2015.bitin.interceptor.AuthInterceptor" />
</mvc:interceptor>
위에서 login,logout, assets에 있는 자료들은 exclude하는데 jsp파일에서 assets에 존재하지않는데 assets에 있어야할 데이터들이 읽히면 그데이터들을exclude해주지못하기 때문에 우리가 설정해준 ServletHttpRequestHandler으로
가지 않고 DefaultServletHttpRequestHandler으로가 게되서 생기는 에러이다.
*/
if (handler instanceof HandlerMethod == false) {
// HandlerMethod maControl = (HandlerMethod) handler;
// Method pmrResolver = (Method) maControl.getMethod();
// String methodName = pmrResolver.getName();
System.out.println( "------------------>> jsp파일에있는 assets안에 없는 데이터들을 assets안에 넣어 줄것" + handler.getClass().getName() );
return false;
}
Auth auth = ( ( HandlerMethod ) handler ).getMethodAnnotation( Auth.class );
if( auth == null ) {
return true;
}
HttpSession session = request.getSession();
if( session == null ) { //로그인 안함
//TODO : 로그인부 만들고 수정
response.sendRedirect( "/bitin/main/loginform" );
//
return false;
}
UserVo authUser = (UserVo)session.getAttribute( "authUser" );
if( authUser == null ) { //로그인 안함
//TODO : 로그인부 만들고 수정
response.sendRedirect( "/bitin/main/loginform" );
//
return false;
}
return true;
}
}
| [
"Minyoung_PC@192.168.0.5"
] | Minyoung_PC@192.168.0.5 |
76e2b18478bd137d483d9cffb3fad3ca7f189c95 | aa54520d3f852c634d5639ea93bdcd149b178d8e | /MvcPcbMaker/Application/src/main/java/com/mvcpcbmaker/daos/ClosestParentDao.java | 6e48c8957ea6ac067fc58fa1fbeb6df11c28ab38 | [] | no_license | artgineer2/MvcPcbMaker | 35b696ee021c9ba0a06a9c82edf229f0caf3ac3b | 6c619f92507d4e6102bf0abacd4b46c1c226cd67 | refs/heads/master | 2023-01-05T22:26:06.206402 | 2020-05-11T15:42:02 | 2020-05-11T15:42:02 | 232,858,250 | 1 | 1 | null | 2023-01-05T05:36:21 | 2020-01-09T16:51:52 | Java | UTF-8 | Java | false | false | 222 | java | package com.mvcpcbmaker.daos;
public interface ClosestParentDao {
public void runClosestParentProc(String childPart);
public String getClosestParentPackage(String parentPart);
public void clearClosestParentData();
}
| [
"bachmoog2@gmail.com"
] | bachmoog2@gmail.com |
29add1fd2574126d44f1e4a29650dc48b67fec16 | ffad04827217659d32675bf61708465b0702082c | /src/main/java/com/prakash/messaging/service/ReactService.java | ad983a8d8a141f5a68facea25c298d372471e1a5 | [] | no_license | prakash24/messagePostApplication | ed45e5086146ac72d735113a8219d338eeaba4a0 | 7c8aafc784358bc8e2a3e5a859ce52eae955f734 | refs/heads/main | 2023-06-29T17:31:45.948806 | 2021-07-28T06:46:40 | 2021-07-28T06:46:40 | 384,254,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 71 | java | package com.prakash.messaging.service;
public class ReactService {
}
| [
"prakashps6666@gmail.com"
] | prakashps6666@gmail.com |
cf0948bf05f5eee2407303fe888ccab92fe587c2 | 96a3182c3c26fa012101624741a5d57294baa4f0 | /app/src/main/java/com/example/fahad/neurobuds/activities/GraphActivity.java | 9c92de22c06da974ee812aaf90c4aa251192407d | [] | no_license | shaheenkdr/fahadpk92-neurobuds-f588e83c2d8f | 3308ad35245dc8f57f8df862837ed988d83b356b | aac75203f33d820d04623fed0247240275b22985 | refs/heads/master | 2021-01-09T05:41:29.188273 | 2017-02-06T03:16:23 | 2017-02-06T03:16:23 | 80,813,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,037 | java | package com.example.fahad.neurobuds.activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.example.fahad.neurobuds.R;
import com.example.fahad.neurobuds.RealtimeUpdates;
public class GraphActivity extends AppCompatActivity {
/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
/**
* The {@link ViewPager} that will host the section contents.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_graph);
SectionsPagerAdapter mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
ViewPager mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
// Click listener to open Music Activity
Button musicButton = (Button)findViewById(R.id.musicButton);
musicButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent mIntent = new Intent(GraphActivity.this,MusicActivity.class);
startActivity(mIntent);
}
});
// Click listener to open Breathe Activity
Button breatheButton = (Button)findViewById(R.id.breatheButton);
breatheButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent mIntent = new Intent(GraphActivity.this,BreatheActivity.class);
startActivity(mIntent);
}
});
// Click listener to open Meditate Activity
Button meditateButton = (Button)findViewById(R.id.meditateButton);
meditateButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent mIntent = new Intent(GraphActivity.this,MeditateActivity.class);
startActivity(mIntent);
}
});
}
/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {
public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return RealtimeUpdates.newInstance(position + 1);
}
@Override
public int getCount() {
// Show 3 total pages.
return 1;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "SECTION 1";
case 1:
return "SECTION 2";
case 2:
return "SECTION 3";
}
return null;
}
}
}
| [
"shaheenkader@outlook.com"
] | shaheenkader@outlook.com |
236a51328cf1090424e9920312ea9df6e3a96429 | 9f984fc65f65743ae1c89e07fd6ac0f5ab2a2a91 | /src/http/HttpClientSample1.java | eec227c8e781fd4057d70178aeeea82fc70b796d | [] | no_license | jjoylee/PersonalJavaStudy | ce8f4421d5e4755ec040f0ff40381021fb7c0e3d | beb968cd74d04dd32c43a56a1df74eeedd3b6289 | refs/heads/master | 2020-03-20T14:00:06.468988 | 2018-07-05T01:09:32 | 2018-07-05T01:09:32 | 137,472,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package http;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
public class HttpClientSample1 {
public static void main(String[] args){
HttpClientSample1 sample = new HttpClientSample1();
sample.getResult();
}
private void getResult() {
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://www.google.com");
InputStream is = null;
BufferedInputStream bis = null;
try{
HttpResponse response = httpClient.execute(httpGet);
System.out.println(response.getStatusLine().toString());
is = response.getEntity().getContent();
bis = new BufferedInputStream(is);
byte[] buffer = new byte[1024];
while((bis.read(buffer))!=-1){
String str = new String(buffer, "utf-8");
System.out.println(str);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(bis != null)
bis.close();
if(is != null)
is.close();
}catch(IOException ignorable){}
}
}
}
| [
"ekdnlt1995@gmail.com"
] | ekdnlt1995@gmail.com |
ea520bcecc451c9c010731a54c6fbe7dfe4ac07c | aad40f08eeb44ab50d34a900c94e77394ce1067b | /blogpessoal/src/main/java/org/generation/blogpessoal/model/Tema.java | 7a8144e42b240abfa7e52f87a6ad9827e901fe02 | [] | no_license | carolcrisel/CRUD_Introduction | c684d44b601cb7f93ed47af34415fbdb80680f63 | 8ca30b75bd172aef631193feedf747087cd3079b | refs/heads/master | 2022-12-11T22:56:50.070542 | 2020-09-09T17:49:59 | 2020-09-09T17:49:59 | 293,879,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | package org.generation.blogpessoal.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@Entity
@Table(name = "tb_tema")
public class Tema {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@NotNull
private String descricao;
@OneToMany(mappedBy = "tema", cascade = CascadeType.ALL)
@JsonIgnoreProperties("tema")
private List<Postagem> postagem;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public List<Postagem> getPostagem() {
return postagem;
}
public void setPostagem(List<Postagem> postagem) {
this.postagem = postagem;
}
}
| [
"portocrisel@hotmail.com"
] | portocrisel@hotmail.com |
bdefab5c2ed2f393646f1206d12bc185848038d2 | 0069b860a293c29ed5aa9686c285b7a84b659388 | /TestJdbc/src/cn/mcandroid/jdbc/Test01.java | 93b839f777ec8e7e555221604cb946aad9d7eedc | [] | no_license | LCQ622/Eclipse-Java-Web-Exercise | 0e14de587d76585fb79b5aa6b02702311921c874 | 3ffc971a485269c62e9670df2545bbeab046bae6 | refs/heads/master | 2020-05-30T14:43:48.970997 | 2019-06-02T02:51:21 | 2019-06-02T02:51:21 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 770 | java | package cn.mcandroid.jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
public class Test01 {
public static void main(String[] args) throws Exception {
//1.
Class.forName("com.mysql.jdbc.Driver");
//2.
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/lcq", "root", "root");
//3.
java.sql.Statement stm=conn.createStatement();
ResultSet resultSet=stm.executeQuery("SELECT id,CONCAT(first_name,last_name) AS NAME,IF(sex='M','ÄÐ','Å®')AS sex FROM stus");
while(resultSet.next()) {
int id=resultSet.getInt("id");
String name=resultSet.getString("name");
String sex=resultSet.getString("sex");
System.out.println("id:"+id+",name:"+name+",sex:"+sex);
}
}
}
| [
"1780082826@qq.com"
] | 1780082826@qq.com |
71cb884f0a5cd9a60fc63bb6a2044b9d2bc8c052 | a2029b2d789073d6b2835fb0fa11acb611d639b6 | /newreg/src/java/nic/vahan/form/bean/fileMonitoring/FilePendingReportBean.java | 2a68a1900ce7b57e9fa61958d58b001473497b8a | [] | no_license | Kennywest3/vahan | 89a5007749ea23d8bdca7572d033966ef3dc5a3e | 656844679b37fb0736c3f7966dc474b4b0e44161 | refs/heads/main | 2023-02-17T13:43:35.529756 | 2021-01-04T09:05:55 | 2021-01-04T09:05:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,797 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nic.vahan.form.bean.fileMonitoring;
import java.util.Iterator;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import nic.java.util.DateUtils;
import nic.rto.vahan.common.VahanException;
import nic.vahan.db.TableConstants;
import nic.vahan.form.dobj.fileMonitoring.FilePendingReportDO;
import nic.vahan.form.impl.fileMonitoring.FilePendingReportImpl;
import org.apache.log4j.Logger;
/**
*
* @author Deepak
*/
@ManagedBean(name = "filespendingreportbean")
@ViewScoped
public class FilePendingReportBean extends FilePendingReportDO {
private static final Logger LOGGER = Logger.getLogger(FilePendingReportBean.class);
static String whereami = "FilePendingReportBean";
public void getPendingFiles() {
try {
if (getFromdate() == null || getToDate() == null) {
FilePendingReportImpl.sendMessage("From Date or To Date is blank, Please select the date.");
setFromdate(null);
setToDate(null);
} else {
if (DateUtils.getDate1MinusDate2_Days(getFromdate(), getToDate()) > 60) {
FilePendingReportImpl.sendMessage("Difference between from date and upto date can not be more than 60 days.");
return;
}
setFilelist(FilePendingReportImpl.getPendingFiles(this));
if (!getFilelist().isEmpty()) {
setRenderTbl(true);
} else {
FilePendingReportImpl.sendMessage("No pending files.");
setRenderTbl(false);
}
}
} catch (VahanException ex) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(ex.getMessage()));
} catch (Exception ex) {
LOGGER.error(ex.toString() + "-" + ex.getStackTrace()[0]);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(TableConstants.SomthingWentWrong));
}
}
public String save() {
boolean flag = false;
String error = "";
FilePendingReportDO usr1 = null;
String status = null;
boolean linkflg = false;
try {
if (error.equalsIgnoreCase("")) {
Iterator itr = null;
itr = getFilelist().iterator();
while (itr.hasNext()) {
FilePendingReportDO lmst = (FilePendingReportDO) itr.next();
if (lmst.isEnter()) {
linkflg = true;
}
}
if (!linkflg) {
flag = true;
FilePendingReportImpl.sendMessage("Please Select Atleast One File");
}
if (flag == false) {
if (error.equalsIgnoreCase("")) {
boolean testflag = FilePendingReportImpl.saveFileDetail(getFilelist(), this);
if (testflag) {
FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null, "printFilesPendingPdf");
}
}
}
}
if (!error.equalsIgnoreCase("")) {
FilePendingReportImpl.sendMessage(error);
}
} catch (Exception ex) {
LOGGER.error(ex.toString() + " " + ex.getStackTrace()[0]);
}
return status;
}
}
| [
"sshende@taashee.com"
] | sshende@taashee.com |
3a3c79086a7738df6a3ffde92851d3b0c951dbf1 | 2b14a8dcdefbe45a22cf4750a39c30aaa891883e | /AppFGA_Piloto/gen/com/example/tonlib/R.java | baca9f86d4eba8cf1e926976a1ef7075bbb393cd | [] | no_license | EstudosLivres/AppFGA-Android | 695020ffb8cef5cfc63689b9753a0e796e5e01cd | 8740003f57c30e7beb5a1d248c0836fc318f737f | refs/heads/master | 2019-01-19T06:40:24.345109 | 2014-01-28T15:18:12 | 2014-01-28T15:18:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.example.tonlib;
public final class R {
public static final class style {
public static final int AppBaseTheme = 0x7f050000;
public static final int AppTheme = 0x7f050001;
}
public static final class string {
public static final int app_name = 0x7f040000;
public static final int menu_settings = 0x7f040002;
public static final int hello_world = 0x7f040001;
}
public static final class layout {
public static final int activity_main = 0x7f030000;
}
public static final class drawable {
public static final int ic_launcher = 0x7f020008;
}
}
| [
"ton_unb@hotmail.com"
] | ton_unb@hotmail.com |
d00021c5a6aeb088f4bd6b70a328c00052111ccd | 97fc2985aa336d4c369300d652aab3dba31bd46c | /app/src/main/java/com/qzr/augustplayer/render/WaterMarkRenderDrawer.java | a4a1cc60ad681dce9a2406c25b956881d132bbbb | [
"Apache-2.0"
] | permissive | qzhuorui/AugustPlayer | 0d6161b90b1bdb63ffd2116029da9e0565896542 | cc9afbc6758117acc002d11968e1f3ba6574d698 | refs/heads/master | 2023-01-01T20:57:41.813016 | 2020-11-01T03:36:15 | 2020-11-01T03:36:15 | 287,882,088 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,551 | java | package com.qzr.augustplayer.render;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLES30;
import com.qzr.augustplayer.R;
import com.qzr.augustplayer.base.Base;
import com.qzr.augustplayer.utils.AssetsUtils;
import com.qzr.augustplayer.utils.GlesUtil;
/**
* @ProjectName: AugustPlayer
* @Package: com.qzr.augustplayer.render
* @ClassName: WaterMarkRenderDrawer
* @Description: 水印渲染管理
* @Author: qzhuorui
* @CreateDate: 2020/9/19 11:01
*/
public class WaterMarkRenderDrawer extends BaseRenderDrawer {
private static final String TAG = "WaterMarkRenderDrawer";
private int mMarkTextureId;
private int mInputTextureId;
private Bitmap mBitmap;
private int avPosition;
private int afPosition;
private int sTexture;
public WaterMarkRenderDrawer(Context context) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.RGB_565;
options.inSampleSize = 2;
mBitmap = BitmapFactory.decodeResource(context.getResources(), R.mipmap.watermark, options);
}
@Override
protected void onCreated() {
}
@Override
protected void onChanged(int width, int height) {
mMarkTextureId = GlesUtil.loadBitmapTexture(mBitmap);
avPosition = GLES30.glGetAttribLocation(mProgram, "av_Position");
afPosition = GLES30.glGetAttribLocation(mProgram, "af_Position");
sTexture = GLES30.glGetUniformLocation(mProgram, "sTexture");
}
@Override
public void draw(long timestamp, float[] transformMatrix) {
//渲染绘制水印图片,Blend颜色混合
useProgram();
viewPort(40, 75, mBitmap.getWidth() * 2, mBitmap.getHeight() * 2);
GLES30.glDisable(GLES30.GL_DEPTH_TEST);
GLES30.glEnable(GLES30.GL_BLEND);
GLES30.glBlendFunc(GLES30.GL_SRC_COLOR, GLES30.GL_ONE);//源因子,目的因子。源*源因子+目的&目的因子
onDraw(transformMatrix);
GLES30.glDisable(GLES30.GL_BLEND);
}
@Override
protected void onDraw(float[] transformMatrix) {
GLES30.glEnableVertexAttribArray(avPosition);
GLES30.glEnableVertexAttribArray(afPosition);
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, mVertexBufferId);
GLES30.glVertexAttribPointer(avPosition, CoordsPerVertexCount, GLES30.GL_FLOAT, false, 0, 0);
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, mFrameTextureBufferId);
GLES30.glVertexAttribPointer(afPosition, CoordsPerTextureCount, GLES30.GL_FLOAT, false, 0, 0);
GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0);
GLES30.glActiveTexture(GLES30.GL_TEXTURE0);
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, mMarkTextureId);
GLES30.glUniform1i(sTexture, 0);
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, VertexCount);
GLES30.glDisableVertexAttribArray(avPosition);
GLES30.glDisableVertexAttribArray(afPosition);
}
@Override
public void setInputTextureId(int textureId) {
this.mInputTextureId = textureId;
}
@Override
public int getOutputTextureId() {
return mInputTextureId;
}
@Override
protected String getVertexSource() {
return AssetsUtils.getVertexStrFromAssert(Base.CURRENT_APP, "vertex_watermark");
}
@Override
protected String getFragmentSource() {
return AssetsUtils.getFragmentStrFromAssert(Base.CURRENT_APP, "fragment_watermark");
}
}
| [
"qzhuorui@163.com"
] | qzhuorui@163.com |
d1ac866820298ac41b4d8c7cf66722be2b56f11f | f854deb050e81c91d3eb5f834180fe33e439fbdb | /src/com/habboproject/server/game/rooms/objects/items/types/floor/others/SeatFloorItem.java | cd958d23b99f43edaab18d2eab601693ff8cac87 | [] | no_license | dank074/CometEmulator | 9cedfd7c01ead997a99b8a3aa9d9530d9a809090 | 5e0123fdd1a54b448f0702af9d674e311ad9f339 | refs/heads/master | 2020-12-01T07:10:07.767081 | 2018-01-22T04:31:00 | 2018-01-22T04:31:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,753 | java | package com.habboproject.server.game.rooms.objects.items.types.floor.others;
import com.habboproject.server.game.rooms.objects.entities.RoomEntity;
import com.habboproject.server.game.rooms.objects.entities.RoomEntityStatus;
import com.habboproject.server.game.rooms.objects.entities.types.PetEntity;
import com.habboproject.server.game.rooms.objects.entities.types.PlayerEntity;
import com.habboproject.server.game.rooms.objects.items.RoomItemFloor;
import com.habboproject.server.game.rooms.objects.items.types.floor.adjustable.AdjustableHeightSeatFloorItem;
import com.habboproject.server.game.rooms.types.Room;
import com.habboproject.server.network.messages.outgoing.room.avatar.AvatarUpdateMessageComposer;
public class SeatFloorItem extends RoomItemFloor {
public SeatFloorItem(long id, int itemId, Room room, int owner, int groupId, int x, int y, double z, int rotation, String data) {
super(id, itemId, room, owner, groupId, x, y, z, rotation, data);
}
@Override
public boolean onInteract(RoomEntity entity, int requestData, boolean isWiredTrigger) {
if (!isWiredTrigger) {
if (!(entity instanceof PlayerEntity)) {
return false;
}
PlayerEntity pEntity = (PlayerEntity) entity;
if (!pEntity.getRoom().getRights().hasRights(pEntity.getPlayerId())
&& !pEntity.getPlayer().getPermissions().getRank().roomFullControl()) {
return false;
}
}
this.toggleInteract(true);
this.sendUpdate();
if (this instanceof AdjustableHeightSeatFloorItem) {
for (RoomEntity sitter : this.getEntitiesOnItem()) {
this.onEntityStepOn(sitter, true);
}
}
this.saveData();
return true;
}
public void onEntityStepOn(RoomEntity entity, boolean instantUpdate) {
double height = (entity instanceof PetEntity || entity.hasAttribute("transformation")) ? this.getSitHeight() / 2 : this.getSitHeight();
entity.addStatus(RoomEntityStatus.SIT, String.valueOf(height).replace(',', '.'));
if (instantUpdate)
this.getRoom().getEntities().broadcastMessage(new AvatarUpdateMessageComposer(entity));
else
entity.markNeedsUpdate();
}
@Override
public void onEntityStepOn(RoomEntity entity) {
this.onEntityStepOn(entity, false);
}
@Override
public void onEntityStepOff(RoomEntity entity) {
if (entity.hasStatus(RoomEntityStatus.SIT)) {
entity.removeStatus(RoomEntityStatus.SIT);
}
entity.markNeedsUpdate();
}
public double getSitHeight() {
return this.getDefinition().getHeight();
}
}
| [
"orracosta@icloud.com"
] | orracosta@icloud.com |
2af88da75b947c418586516834f37372d6aea6a9 | 4c630ffd7d428fb772413de36860616f242c45ac | /backend/src/main/java/com/it/p/lodz/pl/masi/model/NumericQuestion.java | de7f69ac46adbbb25b466617c100b0142f84eafa | [] | no_license | lodz-university-of-technology-masi/Violet | 37925f338fcf4e82e3f20306c13de91ffbe453b2 | 231e91513e4c8c41882d998e3f03e9ad99aa9e4b | refs/heads/master | 2023-01-22T15:46:41.327343 | 2019-06-03T16:05:13 | 2019-06-03T16:05:13 | 176,295,695 | 0 | 0 | null | 2023-01-07T04:51:50 | 2019-03-18T13:47:30 | Java | UTF-8 | Java | false | false | 88 | java | package com.it.p.lodz.pl.masi.model;
public class NumericQuestion extends Question {
}
| [
"228021@edu.p.lodz.pl"
] | 228021@edu.p.lodz.pl |
05ebfea4fdbcf75b5312cf9b183322f045134957 | 46104235aea027f54d2945968979048150eedb97 | /src/main/java/libgdx/implementations/iqtest/spec/IqTestBaseLevelCreator.java | cf80b734e1c97c5736a35b50f39f125a31bef4f0 | [] | no_license | horeab/SkelClassicGame | 2aed9e53535688246ff06a83f36d8e4ace35fa44 | 789d48f90d1fd08c9ac154eb86e9c22ae539d229 | refs/heads/master | 2021-06-26T04:36:05.520593 | 2021-06-11T13:13:12 | 2021-06-11T13:13:12 | 229,983,033 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,707 | java | package libgdx.implementations.iqtest.spec;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import libgdx.controls.animations.ActorAnimation;
import libgdx.controls.button.ButtonBuilder;
import libgdx.controls.button.MainButtonSize;
import libgdx.controls.button.MyButton;
import libgdx.controls.label.MyWrappedLabel;
import libgdx.controls.label.MyWrappedLabelConfigBuilder;
import libgdx.game.Game;
import libgdx.graphics.GraphicUtils;
import libgdx.implementations.SkelClassicButtonSize;
import libgdx.implementations.SkelClassicButtonSkin;
import libgdx.implementations.iqtest.screens.IqTestGameOverScreen;
import libgdx.resources.MainResource;
import libgdx.resources.ResourceService;
import libgdx.resources.dimen.MainDimen;
import libgdx.resources.gamelabel.MainGameLabel;
import libgdx.utils.ScreenDimensionsManager;
import libgdx.utils.Utils;
import libgdx.utils.model.FontConfig;
import libgdx.utils.model.RGBColor;
public abstract class IqTestBaseLevelCreator {
protected final static String MAIN_TABLE_NAME = "MAIN_TABLE_NAME";
protected IqTestPreferencesManager iqTestPreferencesManager = new IqTestPreferencesManager();
protected ResourceService resourceService = Game.getInstance().getMainDependencyManager().createResourceService();
protected MyWrappedLabel scoreLabel;
protected MyButton newGameBtn;
public abstract void refreshLevel();
public abstract boolean isGameOver();
protected abstract IqTestGameType getIqTestGameType();
protected abstract int getCurrentQuestionToDisplay();
protected abstract void startNewGame();
public abstract void addQuestionScreen(int currentQuestion);
protected abstract String getScore();
private Image createMugImg(float mugDimen) {
final Image mug = GraphicUtils.getImage(MainResource.mug_black_border);
mug.setWidth(mugDimen);
mug.setHeight(mugDimen);
new ActorAnimation(Game.getInstance().getAbstractScreen()).animateZoomInZoomOut(mug);
mug.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
IqTestGameOverScreen.displayInAppPurchasesPopup(new Runnable() {
@Override
public void run() {
refreshLevel();
}
}, getInAppPurchaseTextToBeShown());
}
});
if (Utils.isValidExtraContent()) {
mug.setVisible(false);
}
return mug;
}
protected abstract String getInAppPurchaseTextToBeShown();
protected Table createHeader() {
Table table = new Table();
MyButton newGameBtn = createNewGameBtn();
MyButton skipBtn = createSkipBtn();
float horizDimen = MainDimen.horizontal_general_margin.getDimen();
float mugDimen = horizDimen * 7;
final Image mug = createMugImg(mugDimen);
Table firstRow = new Table();
firstRow.add(mug).padLeft(MainButtonSize.BACK_BUTTON.getWidth() * 1.2f).growX().width(mugDimen).height(mugDimen);
firstRow.add().growX();
firstRow.add().growX();
firstRow.add(newGameBtn).pad(horizDimen).width(newGameBtn.getWidth()).height(newGameBtn.getHeight());
if (skipBtn != null) {
firstRow.add(skipBtn).pad(horizDimen).width(skipBtn.getWidth()).height(skipBtn.getHeight());
}
Table secondRow = createHeaderSecondRow();
table.add(firstRow).growX();
table.row();
table.add(secondRow).growX();
return table;
}
private Table createHeaderSecondRow() {
scoreLabel = new MyWrappedLabel(new MyWrappedLabelConfigBuilder()
.setText(getScore())
.setFontConfig(new FontConfig(RGBColor.LIGHT_GREEN.toColor(), RGBColor.GREEN.toColor(),
FontConfig.FONT_SIZE * 2.1f, FontConfig.STANDARD_BORDER_WIDTH * 8.5f))
.setSingleLineLabel().build());
scoreLabel.setTransform(true);
MyWrappedLabel currentQLabel = new MyWrappedLabel(new MyWrappedLabelConfigBuilder()
.setText(getCurrentQuestionToDisplay() + "/" + getIqTestGameType().totalQuestions)
.setFontConfig(new FontConfig(Color.WHITE, Color.BLACK,
FontConfig.FONT_SIZE * 1.5f, FontConfig.STANDARD_BORDER_WIDTH * 8.5f))
.setSingleLineLabel().build());
MyWrappedLabel descr = null;
if (getIqTestGameType().descr != null) {
descr = new MyWrappedLabel(new MyWrappedLabelConfigBuilder()
.setText(getIqTestGameType().descr.getText())
.setWrappedLineLabel(ScreenDimensionsManager.getScreenWidth(55))
.setFontConfig(new FontConfig(Color.BLACK,
FontConfig.FONT_SIZE * 1.1f)).build());
}
Table secondRow = new Table();
float marginDimen = MainDimen.horizontal_general_margin.getDimen();
float scoreLevelWidth = ScreenDimensionsManager.getScreenWidth(20);
secondRow.add(scoreLabel).padLeft(marginDimen).width(scoreLevelWidth);
secondRow.add().growX();
if (descr != null) {
secondRow.add(descr).growX();
} else {
secondRow.add().growX();
}
secondRow.add().growX();
secondRow.add(currentQLabel).padRight(marginDimen).width(scoreLevelWidth);
return secondRow;
}
protected void processCorrectAnswerPressed(Runnable afterAnimation) {
float scaleFactor = 0.3f;
float duration = 0.2f;
if (scoreLabel != null) {
scoreLabel.addAction(Actions.sequence(Actions.scaleBy(scaleFactor, scaleFactor, duration),
Actions.scaleBy(-scaleFactor, -scaleFactor, duration), Utils.createRunnableAction(afterAnimation)));
}
}
private MyButton createNewGameBtn() {
newGameBtn = new ButtonBuilder()
.setButtonSkin(SkelClassicButtonSkin.IQTEST_NEW_GAME_BTN)
.setFixedButtonSize(SkelClassicButtonSize.IQTEST_HEADER_IMG_BUTTON).build();
newGameBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
startNewGame();
}
});
return newGameBtn;
}
protected MyButton createSkipBtn() {
return null;
}
}
| [
"horea.bucerzan@gmail.com"
] | horea.bucerzan@gmail.com |
50a80f61c60f5010336bd02cbdcefb7c8e67cc36 | 7b4fd58090aa7013137ba2734d7f256b812861e1 | /src/Ellias/rm/com/tencent/msdk/communicator/IHttpRequestListener.java | 3312ecb67d4996db3b71200577f1d88698e883c6 | [] | no_license | daihuabin/Ellias | e37798a6a2e63454f80de512319ece885b6a2237 | fd010991a5677e6aa104b927b82fc3d6da801887 | refs/heads/master | 2023-03-16T21:12:33.908495 | 2020-02-10T15:42:22 | 2020-02-10T15:42:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package com.tencent.msdk.communicator;
public abstract interface IHttpRequestListener
{
public abstract void onFailure(String paramString, int paramInt1, int paramInt2);
public abstract void onSuccess(String paramString, int paramInt1, int paramInt2);
}
/* Location: D:\rm_src\classes_dex2jar\
* Qualified Name: com.tencent.msdk.communicator.IHttpRequestListener
* JD-Core Version: 0.6.0
*/ | [
"sevarsti@sina.com"
] | sevarsti@sina.com |
147cbbe17012ffae128471a0fc2a06a32d7f103c | 5748d8e5ab80776e6f565f0dd1f5029d4af5b65e | /codeforces/1466/D.java | 62248e5cedc940392f4a35f328c243a71b31d62c | [] | no_license | lokiysh/cp | f50394a98eec42aa4e9ae997aa4852253fff012f | 99cbf19c9db16f51de5a68a8c4989f5de36678c8 | refs/heads/master | 2023-02-10T21:18:51.987872 | 2011-07-22T13:04:00 | 2021-01-11T02:39:17 | 328,587,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,394 | java | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
TaskD solver = new TaskD();
int testCount = Integer.parseInt(in.next());
for (int i = 1; i <= testCount; i++)
solver.solve(i, in, out);
out.close();
}
static class TaskD {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int N = in.nextInt();
List<Integer> graph[] = new List[N];
long weight[] = new long[N];
for (int i = 0; i < N; i++) {
graph[i] = new ArrayList<>();
}
for (int i = 0; i < N; i++) {
weight[i] = in.nextInt();
}
for (int i = 1; i < N; i++) {
int u = in.nextInt() - 1, v = in.nextInt() - 1;
graph[u].add(v);
graph[v].add(u);
}
long ans[] = new long[N];
PriorityQueue<Node> queue = new PriorityQueue<>(new Comparator<Node>() {
public int compare(Node o1, Node o2) {
if (o1.val != o2.val) {
return Long.compare(o1.val, o2.val);
}
return Long.compare(o1.times, o2.times);
}
});
long cur = 0;
for (int i = 0; i < N; i++) {
cur += weight[i] * graph[i].size();
queue.add(new Node(weight[i], graph[i].size()));
}
ans[N - 1] = cur;
int i = N - 2;
while (i >= 1) {
Node element = queue.poll();
while (element.times > 1) {
element.times--;
cur -= element.val;
ans[i--] = cur;
}
}
for (i = 1; i < N; i++) {
out.print(ans[i] + " ");
}
out.printLine();
}
class Node {
long val;
long times;
public Node(long val, long times) {
this.val = val;
this.times = times;
}
}
}
static class OutputWriter {
PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object... objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0) {
writer.print(' ');
}
writer.print(objects[i]);
}
}
public void printLine(Object... objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
}
static class InputReader {
BufferedReader in;
StringTokenizer tokenizer = null;
public InputReader(InputStream inputStream) {
in = new BufferedReader(new InputStreamReader(inputStream));
}
public String next() {
try {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(in.readLine());
}
return tokenizer.nextToken();
} catch (IOException e) {
return null;
}
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
| [
"lokesh.khandelwal92@gmail.com"
] | lokesh.khandelwal92@gmail.com |
93d700f891988bb54aa5220f11abcfb2431b0d48 | 6ae784cfe38b143f2106e64f3a64799ba92eb884 | /app/src/main/java/com/kedacom/rxjavaactiondemo/model/net/NewsApi.java | eccadcd743c01648a25531b630a930d2f1156165 | [] | no_license | zhoutianjie/RxJavaAction | f2b85ce72900cffc03e3673cbc375eea85403335 | d126a3c104f2bc7aab4180e7284fa3b7a2c165aa | refs/heads/master | 2020-05-14T23:01:45.912199 | 2019-04-18T00:44:40 | 2019-04-18T00:44:40 | 181,989,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.kedacom.rxjavaactiondemo.model.net;
import com.kedacom.rxjavaactiondemo.model.entity.NewsEntity;
import com.kedacom.rxjavaactiondemo.model.entity.NewsResultApi;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Path;
/**
* Created by zhoutianjie on 2019/4/17.
*/
public interface NewsApi {
@GET("api/data/{category}/{count}/{page}")
Observable<NewsResultApi> getNews(@Path("category") String category, @Path("count") int count, @Path("page") int page);
}
| [
"kkledvcent@126.com"
] | kkledvcent@126.com |
b4e7b57d4bf92be458ef48d32253613487bf9388 | 10afc658d77076aa360b9114aecb8464b8126975 | /java_gui/QKH_079/SuspResum.java | af53b32cc6223d5a8b86844d268c13b4bd72167f | [] | no_license | sametcem/Java-GUI | 41c868c9f575840ce5fb755dc3e05890125815da | 1f6b273107e0bd1e12a03e3a3fe1c8549916b57a | refs/heads/master | 2020-09-28T17:52:53.383645 | 2019-12-09T09:08:17 | 2019-12-09T09:08:17 | 226,828,535 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,879 | java | package java_gui.QKH_079;
// QKH-SuspResum/SuspResum.java
import javax.swing.JOptionPane;
class MyThread extends Thread {
volatile boolean stopped = false;
volatile boolean suspended = false;
public void run() {
int num = 0;
while(!stopped) {
try {
synchronized(this) {
while (suspended) wait();
}
} catch (InterruptedException exc) {
System.out.println(
"Interrupted on wait");
}
if (suspended) System.out.println(
"Still suspended");
else System.out.println(++num);
}
}
public void stopThread() { stopped = true; }
public void suspendThread() { suspended = true; }
public boolean isSusp() { return suspended; }
public boolean isStop() { return stopped; }
public void resumeThread() {
suspended = false;
synchronized(this) {
notify();
}
}
}
public class SuspResum {
public static void main(String args[]) {
String msg = "I = interrupt\n" +
"E = end\n" +
"S = suspend\n" +
"R = resume\n" +
"N = new start";
MyThread t = new MyThread();
t.start();
while (true) {
String cmd = JOptionPane.showInputDialog(msg);
if (cmd == null) break;
if (cmd.trim().length() == 0) continue;
char c = Character.toUpperCase(cmd.charAt(0));
switch (c) {
case 'I' : t.interrupt(); break;
case 'E' : t.stopThread(); break;
case 'S' : t.suspendThread(); break;
case 'R' : t.resumeThread(); break;
case 'N' :
if (t.isAlive())
JOptionPane.showMessageDialog(
null, "Thread alive!!!");
else {
t = new MyThread();
t.start();
}
break;
default : break;
}
JOptionPane.showMessageDialog(null,
"Command " + cmd + " executed.\n" +
"Thread alive? " +
(t.isAlive() ? "Y\n" : "N\n") +
"Thread interrupted? " +
(t.isInterrupted() ? "Y\n" : "N\n") +
"Thread suspended? " +
(t.isSusp() ? "Y\n" : "N\n") +
"Thread stopped? " +
(t.isStop() ? "Y\n" : "N")
);
}
System.exit(0);
}
}
| [
"noreply@github.com"
] | sametcem.noreply@github.com |
c6ed164116dfe98f08bd673c053fb7be60f1e46e | 853bab87ad4a61332383f860ed45da334078d4de | /src/main/java/com/yheeing/webservice/domain/posts/Posts.java | fc5f18366970a565e778323b3710634c299dc8fa | [] | no_license | yheeing/spring-webservice | 02690934273bbf31b44f208d10b988224cc6f0fb | 4fbf937c0a532f2984b48dcc22636f335d2e7e39 | refs/heads/master | 2022-11-09T02:29:15.153798 | 2020-06-24T01:34:33 | 2020-06-24T01:34:33 | 271,146,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.yheeing.webservice.domain.posts;
import javax.persistence.*;
import com.yheeing.webservice.domain.BaseTimeEntity;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Entity
public class Posts extends BaseTimeEntity {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@Column(length = 500, nullable = false)
private String title;
@Column(columnDefinition = "TEXT", nullable = false)
private String content;
private String author;
@Builder
public Posts(String title, String content, String author) {
this.title = title;
this.content = content;
this.author = author;
}
}
| [
"yheeing@tvstorm.com"
] | yheeing@tvstorm.com |
a4a0b6b0aba84a0c319ab2f9fb97ac6e81d2ae54 | 7e556ff4d83e7c4f5a0a58cb9e3bd536fcf0dabe | /geoide-print/src/test/java/nl/idgis/geoide/commons/report/template/HtmlTemplateDocumentProviderTest.java | 066400efb03dc5389cb545378b282b651110ebea | [] | no_license | IDgis/geoide-commons | bd27bf73379660f53e39a62b42f592cf74aada7e | ada3aef20c3858f24090069c891a4a83b87f0799 | refs/heads/master | 2023-05-28T14:17:21.234342 | 2023-05-23T09:23:43 | 2023-05-23T09:23:43 | 24,757,641 | 0 | 0 | null | 2023-05-23T09:23:45 | 2014-10-03T12:31:01 | Java | UTF-8 | Java | false | false | 10,323 | java | package nl.idgis.geoide.commons.report.template;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.net.URI;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Before;
import org.junit.Test;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import com.fasterxml.jackson.databind.JsonNode;
import akka.util.ByteString;
import akka.util.ByteString.ByteStrings;
import nl.idgis.geoide.commons.domain.ExternalizableJsonNode;
import nl.idgis.geoide.commons.domain.MimeContentType;
import nl.idgis.geoide.commons.domain.document.Document;
import nl.idgis.geoide.commons.domain.report.TemplateDocument;
import nl.idgis.geoide.documentcache.service.DelegatingStore;
import nl.idgis.geoide.documentcache.service.FileStore;
import nl.idgis.geoide.util.streams.PublisherReference;
import nl.idgis.geoide.util.streams.SingleValuePublisher;
import nl.idgis.geoide.util.streams.StreamProcessor;
public class HtmlTemplateDocumentProviderTest {
private DelegatingStore documentStore;
private FileStore fileStore;
private StreamProcessor streamProcessor;
private HtmlTemplateDocumentProvider provider;
private final static String[] templateContent = new String[] {
"<html><head><meta name=\"description\" content=\"template-1 description\"></head><body></body></html>",
"<html><head></head><body></body></html>",
"<html data-pageformat=\"A4\" data-left-margin=\"10\" data-right-margin=\"10\" data-top-margin=\"10\" data-bottom-margin=\"10\" data-page-orientation=\"portrait\" data-gutter-h=\"2\" data-gutter-v=\"2\"><meta name=\"description\" content=\"template-3 description\"><head></head><body></body></html>",
"<html data-pageformat=\"A4\" data-left-margin=\"10\" data-right-margin=\"10\" data-top-margin=\"10\" data-bottom-margin=\"10\" data-page-orientation=\"portrait\" data-gutter-h=\"2\" data-gutter-v=\"2\"><meta name=\"description\" content=\"template-4 description\"><head></head><body><div class=\"block text\" id=\"title\"></div></body></html>"
};
@SuppressWarnings("unchecked")
@Before
public void init () {
documentStore = mock (DelegatingStore.class);
fileStore = mock (FileStore.class);
streamProcessor = mock (StreamProcessor.class);
// Mock the document store:
when (documentStore.fetch (any (URI.class))).then (invocation -> {
final String uri = invocation.getArgumentAt (0, URI.class).toString ();
for (int i = 0; i < templateContent.length; ++ i) {
if (uri.contains ("template-" + (i + 1))) {
return CompletableFuture.completedFuture (new Document (
invocation.getArgumentAt (0, URI.class),
new MimeContentType ("text/html"),
streamProcessor.createPublisherReference (
new SingleValuePublisher<ByteString> (ByteStrings.fromArray (templateContent[i].getBytes ())),
5000
)));
}
}
final PublisherReference<ByteString> body = streamProcessor.createPublisherReference (
new SingleValuePublisher<ByteString> (ByteStrings.empty ()),
5000
);
return CompletableFuture.completedFuture (new Document (
invocation.getArgumentAt (0, URI.class),
new MimeContentType ("text/html"),
body
));
});
// Mock the fileStore:
when (fileStore.getDirectories ()).then (invocation -> new File[] {
new File ("template-1"),
new File ("template-2"),
new File ("template-3"),
new File ("template-4")
});
// Mock the stream processor:
when (streamProcessor.asInputStream (any (), anyLong ())).then (invocation -> {
final Publisher<ByteString> publisher = (Publisher<ByteString>)invocation.getArgumentAt (0, Publisher.class);
final ByteString byteString = extractByteString (publisher);
return new ByteArrayInputStream (byteString.toArray ());
});
when (streamProcessor.createPublisherReference (any (), anyLong ()))
.then (invocation -> new StaticPublisherReference<> (invocation.getArgumentAt (0, Publisher.class)));
when (streamProcessor.resolvePublisherReference (any (), anyLong ()))
.then (invocation -> invocation.getArgumentAt (0, StaticPublisherReference.class).getPublisher ());
provider = new HtmlTemplateDocumentProvider (documentStore, fileStore, streamProcessor);
}
@Test
public void testGetTemplateDocument () throws Throwable {
final TemplateDocument template = provider.getTemplateDocument ("template-1").get ();
assertNotNull (template);
assertEquals ("template-1", template.getTemplate ());
assertEquals ("template-1 description", template.getDescription ());
}
@Test
public void testGetTemplateDocumentWithoutDescription () throws Throwable {
final TemplateDocument template = provider.getTemplateDocument ("template-2").get ();
assertNotNull (template);
assertEquals ("template-2", template.getTemplate ());
assertEquals ("", template.getDescription ());
}
@Test
public void testGetTemplateDocumentWithProperties () throws Throwable {
final TemplateDocument template = provider.getTemplateDocument ("template-3").get ();
assertNotNull (template);
assertEquals ("template-3", template.getTemplate ());
assertEquals ("template-3 description", template.getDescription ());
assertEquals ("A4", template.getPageFormat ());
assertEquals (10, template.getLeftMargin (), .001);
assertEquals (10, template.getRightMargin (), .001);
assertEquals (10, template.getTopMargin (), .001);
assertEquals (10, template.getBottomMargin (), .001);
assertEquals ("portrait", template.getPageOrientation ());
assertEquals (2, template.getGutterH (), .001);
assertEquals (2, template.getGutterV (), .001);
assertEquals (0, template.getVariables ().size ());
}
@Test
public void testGetTemplateDocumentWithVariable () throws Throwable {
final TemplateDocument template = provider.getTemplateDocument ("template-4").get ();
assertNotNull (template);
assertEquals ("template-4", template.getTemplate ());
assertEquals ("template-4 description", template.getDescription ());
assertEquals ("A4", template.getPageFormat ());
assertEquals (10, template.getLeftMargin (), .001);
assertEquals (10, template.getRightMargin (), .001);
assertEquals (10, template.getTopMargin (), .001);
assertEquals (10, template.getBottomMargin (), .001);
assertEquals ("portrait", template.getPageOrientation ());
assertEquals (2, template.getGutterH (), .001);
assertEquals (2, template.getGutterV (), .001);
assertEquals (1, template.getVariables ().size ());
assertEquals ("", template.getVariables ().get (0).getDefaultValue ());
assertEquals ("title", template.getVariables ().get (0).getName ());
assertEquals (0, template.getVariables ().get (0).getMaxwidth ());
}
@Test
public void testGetTemplateProperties () throws Throwable {
final TemplateDocument template = provider.getTemplateDocument ("template-4").get ();
final ExternalizableJsonNode node = provider.getTemplateProperties (template).get ();
assertNotNull (node);
final JsonNode props = node.getJsonNode ();
assertTemplate4 (props);
}
@Test
public void testGetTemplates () throws Throwable {
final ExternalizableJsonNode node = provider.getTemplates ().get ();
assertNotNull (node);
final JsonNode templates = node.getJsonNode ();
assertEquals (4, templates.path ("templates").size ());
assertEquals ("template-1", templates.path ("templates").path (0).path ("template").asText ());
assertEquals ("template-2", templates.path ("templates").path (1).path ("template").asText ());
assertEquals ("template-3", templates.path ("templates").path (2).path ("template").asText ());
assertEquals ("template-4", templates.path ("templates").path (3).path ("template").asText ());
assertTemplate4 (templates.path ("templates").path (3));
}
private void assertTemplate4 (final JsonNode props) {
assertEquals ("A4", props.path ("pageFormat").asText ());
assertEquals (10, props.path ("leftMargin").asDouble (), .001);
assertEquals (10, props.path ("rightMargin").asDouble (), .001);
assertEquals (10, props.path ("topMargin").asDouble (), .001);
assertEquals (10, props.path ("bottomMargin").asDouble (), .001);
assertEquals ("portrait", props.path ("pageOrientation").asText ());
assertEquals (2, props.path ("gutterH").asDouble (), .001);
assertEquals (2, props.path ("gutterV").asDouble (), .001);
assertEquals (1, props.path ("variables").size ());
assertEquals ("", props.path ("variables").get (0).path ("defaultValue").asText ());
assertEquals ("title", props.path ("variables").get (0).path ("name").asText ());
assertEquals (0, props.path ("variables").get (0).path ("maxwidth").asInt ());
}
private ByteString extractByteString (final Publisher<ByteString> publisher) {
final AtomicReference<ByteString> result = new AtomicReference<ByteString> (null);
publisher.subscribe (new Subscriber<ByteString> () {
@Override
public void onComplete () {
}
@Override
public void onError (Throwable t) {
}
@Override
public void onNext (final ByteString byteString) {
result.set (byteString);
}
@Override
public void onSubscribe (final Subscription subscription) {
subscription.request (1);
}
});
assertNotNull (result.get ());
return result.get ();
}
private final static class StaticPublisherReference<T> implements PublisherReference<T> {
private static final long serialVersionUID = 8177248641720307658L;
private final Publisher<T> publisher;
public StaticPublisherReference (final Publisher<T> publisher) {
this.publisher = publisher;
}
public Publisher<T> getPublisher () {
return publisher;
}
}
}
| [
"erik.orbons@idgis.nl"
] | erik.orbons@idgis.nl |
a6dafadf243ff1954346cc1ffcc7ce89618a5500 | 721e67ce4aeb1c750ab5eb355e26494423307ae3 | /FreeCRM/src/main/java/ExcelUtility/ReadWriteExcel.java | efbac968c8a4f65caa50fd7af94454fb56d63f86 | [] | no_license | vishal180887/ExcelReadWrite | 4b6b2f4a888ef548debfd9fb38ababfa452e6c9d | 8f6901844a4b313ad3d8d7c8906387e6be5231e2 | refs/heads/master | 2021-07-04T00:03:15.454568 | 2020-01-01T17:28:47 | 2020-01-01T17:28:47 | 231,244,251 | 0 | 0 | null | 2021-04-26T19:50:29 | 2020-01-01T17:27:02 | HTML | UTF-8 | Java | false | false | 2,790 | java | package ExcelUtility;
import org.apache.poi.ss.usermodel.*;
import java.io.FileInputStream;
import java.util.Vector;
public class ReadWriteExcel {
private Vector<String> columnNames;
private Vector<Vector<String>> data;
private DataFormatter dataFormatter = new DataFormatter();
public ReadWriteExcel(Sheet sheet) {
this.columnNames = new Vector<String>();
this.data = new Vector<Vector<String>>();
int firstRow = sheet.getFirstRowNum();
Row colNamesRow = sheet.getRow(firstRow);
int firstCol = colNamesRow.getFirstCellNum();
int lastColP1 = colNamesRow.getLastCellNum();
for (int c = firstCol; c < lastColP1; c++) {
Cell cell = colNamesRow.getCell(c);
String columnName = dataFormatter.formatCellValue(cell);
this.columnNames.add(columnName);
}
int lastRow = sheet.getLastRowNum();
for (int r = firstRow + 1; r < lastRow + 1; r++) {
Vector<String> cells = new Vector<String>();
Row row = sheet.getRow(r);
if (row == null) {
row = sheet.createRow(r);
}
for (int c = firstCol; c < lastColP1; c++) {
Cell cell = row.getCell(c);
String cellValue = dataFormatter.formatCellValue(cell);
cells.add(cellValue);
}
this.data.add(cells);
}
}
public int getColumnCount() {
return this.columnNames.size();
}
public int getRowCount() {
return this.data.size();
}
public String getColumnName(int columnIndex) {
return this.columnNames.get(columnIndex);
}
public String getValueAt(int rowIndex, int columnIndex) {
return this.data.get(rowIndex).get(columnIndex);
}
public Vector getColumnNames() {
return this.columnNames;
}
public Vector getData() {
return this.data;
}
// More getters and setters...
public static void main(String[] args) throws Exception {
Workbook workbook = WorkbookFactory.create(new FileInputStream("D:\\JavaProgram\\FreeCRM\\src\\main\\resources\\Data.xlsx"));
Sheet sheet = workbook.getSheetAt(0);
ReadWriteExcel excelTableModel = new ReadWriteExcel(sheet);
System.out.println(excelTableModel.getColumnCount());
System.out.println(excelTableModel.getRowCount());
System.out.println(excelTableModel.getColumnNames());
System.out.println(excelTableModel.getData());
//System.out.println(excelTableModel.getColumnName(0));
System.out.println(excelTableModel.getValueAt(6, 4));
workbook.close();
}
} | [
"noreply@github.com"
] | vishal180887.noreply@github.com |
893f00302a4ec6ad318ef6cb52f37b1fa33c9756 | a1b4906a54ba81c24da4483f02110645e3807a30 | /Assignments/Week 4/ShapesAndPerimeters/src/main/java/com/sg/shapesandperimeters/Square.java | 78515062450c29ab82b48bd63cf9319d03cdff36 | [] | no_license | mdrozdz17/personalwork | 3b4177fa6d3a4a29ee9314f6ed033863e077aa0b | 49d12e6262349e0b0b663f1d5485609564c05f53 | refs/heads/master | 2020-06-10T14:04:11.866899 | 2016-12-08T16:10:45 | 2016-12-08T16:10:45 | 75,952,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sg.shapesandperimeters;
import java.math.BigInteger;
/**
*
* @author apprentice
*/
public class Square extends Shape {
private String color;
private double side;
public Square (String color, double side ) {
this.color=color;
this.side=side;
}
@Override
public double area() {
return side * side;
}
@Override
public double perimeter() {
return side * 4;
}
}
| [
"Matthew.Drozdz@LibertyMutual.com"
] | Matthew.Drozdz@LibertyMutual.com |
326b192ab0e7e5d48522ee8f94c7fa9b29cdf5eb | a09e55b66585b448b8fd51ea55a24b6b4252f877 | /Software-Architecture-01/src/com/baerwang/carp/MySqlConnection.java | 6aa70cc8b9c036381e9f9bfc67927ff073657ba5 | [] | no_license | baerwang/learn-java | 8224a44b52c2b8dd085df2e1305a21f541c6add8 | 963e8ad151f3434eff7602af94a0dee7dfad8c20 | refs/heads/master | 2023-04-18T20:56:28.443615 | 2021-04-27T07:49:39 | 2021-04-27T07:49:39 | 289,679,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.baerwang.carp;
/**
* @author baerwang
* @since 2020/8/26 6:38
*/
public class MySqlConnection extends DBConnection {
@Override
public String getConnection() {
return "MySql数据库连接";
}
}
| [
"bearwang_global@bearwang.com"
] | bearwang_global@bearwang.com |
58aec7d08c57f6e40e73276ba70cd4c8b5fa1330 | e12739407f4ef4d064b3b91b70627343364b8fde | /01-springboot-dubbo-interface/src/main/java/com/thunder/pojo/Pet.java | c27cc5fa80c63c3217c354e15426d35512dfd08d | [] | no_license | LaiXingJie/SpringBoot-Dubbo | 959aa451640998a79a2cae2a1c2db81536840028 | 98ec81922d521d4cb4beaf75569e82932a12bf7a | refs/heads/master | 2022-12-05T13:35:46.218525 | 2020-08-19T10:58:57 | 2020-08-19T10:58:57 | 288,705,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,658 | java | package com.thunder.pojo;
import java.io.Serializable;
import java.util.Date;
/**
* @author Think
*/
public class Pet implements Serializable {
private Long petid;
private String petname;
private Integer petbreed;
private Integer petsex;
private Date birthday;
private String description;
public Long getPetid() {
return petid;
}
public void setPetid(Long petid) {
this.petid = petid;
}
public String getPetname() {
return petname;
}
public void setPetname(String petname) {
this.petname = petname == null ? null : petname.trim();
}
public Integer getPetbreed() {
return petbreed;
}
public void setPetbreed(Integer petbreed) {
this.petbreed = petbreed;
}
public Integer getPetsex() {
return petsex;
}
public void setPetsex(Integer petsex) {
this.petsex = petsex;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
@Override
public String toString() {
return "Pet{" +
"petid=" + petid +
", petname='" + petname + '\'' +
", petbreed=" + petbreed +
", petsex=" + petsex +
", birthday=" + birthday +
", description='" + description + '\'' +
'}';
}
}
| [
"185752822@qq.com"
] | 185752822@qq.com |
b92e81746bd58371f7d8d09df78ea5565a483e17 | 71f463f19e4efa01ddfecf84c540bc9ba5021941 | /Chapter10/src/main/java/com/course/config/SwaggerConfig.java | 6fecf872044730c04cf9b2260667259fb37a6fd5 | [] | no_license | StefanieLily/InterfaceTest | 9e86ea5a06a4c2efbaace32e86d119ef1eb3a525 | 2642f8238a52f3775224105172765a2f97117338 | refs/heads/master | 2020-03-22T21:13:47.701441 | 2018-08-08T06:03:26 | 2018-08-08T06:03:26 | 140,669,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,208 | java | package com.course.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.pathMapping("/")
.select()
.paths(PathSelectors.regex("/.*"))
.build();
}
public ApiInfo apiInfo(){
return new ApiInfoBuilder().title("我的接口文档")
.contact(new Contact("dazhou","","42197393@qq.com"))
.description("这是我的swaggerui生成的接口文档")
.version("1.0.0.0")
.build();
}
}
| [
"ll@choicesoft.com.cn"
] | ll@choicesoft.com.cn |
6dd162db35294bfa486bc8dd9674ac5cca0fbfbe | fec4c1754adce762b5c4b1cba85ad057e0e4744a | /jf-base/src/main/java/com/jf/dao/VideoTipOffMapper.java | c85b078a665d6ce1877f6c0679088794892ad1bd | [] | no_license | sengeiou/workspace_xg | 140b923bd301ff72ca4ae41bc83820123b2a822e | 540a44d550bb33da9980d491d5c3fd0a26e3107d | refs/heads/master | 2022-11-30T05:28:35.447286 | 2020-08-19T02:30:25 | 2020-08-19T02:30:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,032 | java | package com.jf.dao;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.jf.common.base.BaseDao;
import com.jf.entity.VideoTipOff;
import com.jf.entity.VideoTipOffExample;
@Repository
public interface VideoTipOffMapper extends BaseDao<VideoTipOff, VideoTipOffExample> {
int countByExample(VideoTipOffExample example);
int deleteByExample(VideoTipOffExample example);
int deleteByPrimaryKey(Integer id);
int insert(VideoTipOff record);
int insertSelective(VideoTipOff record);
List<VideoTipOff> selectByExample(VideoTipOffExample example);
VideoTipOff selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") VideoTipOff record, @Param("example") VideoTipOffExample example);
int updateByExample(@Param("record") VideoTipOff record, @Param("example") VideoTipOffExample example);
int updateByPrimaryKeySelective(VideoTipOff record);
int updateByPrimaryKey(VideoTipOff record);
}
| [
"397716215@qq.com"
] | 397716215@qq.com |
53fbd7b53b43c25f33549c55bf8973170bf72931 | 73de05b9d422057078cd206ff0c6539141ba6927 | /src/main/java/com/bourse/societe/entities/Societe.java | 8a1c36d2a28cd775d76b96c0e4146275632eed84 | [] | no_license | AbdelbassetNoomene/SpringBoot | 4539c1d7c438420b3dca534363e3e42f3b263082 | ff63edd57677e2b7307f4b3a6d3bf1cb5351df03 | refs/heads/master | 2021-01-11T11:07:52.771878 | 2016-03-15T06:24:35 | 2016-03-15T06:24:35 | 53,274,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.bourse.societe.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Societe implements Serializable{
@Id
@GeneratedValue
private Long id;
private String nomSociete;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the nomSociete
*/
public String getNomSociete() {
return nomSociete;
}
/**
* @param nomSociete the nomSociete to set
*/
public void setNomSociete(String nomSociete) {
this.nomSociete = nomSociete;
}
/**
* @param nomSociete
*/
public Societe(String nomSociete) {
super();
this.nomSociete = nomSociete;
}
/**
*
*/
public Societe() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"noomene.abdelbasset@gmail.com"
] | noomene.abdelbasset@gmail.com |
65f4319e5d0f0cd19fc9736dc21c5275a5fb2a90 | 35776e2603ffc43c77e71d7ef093763f8611bd29 | /build/generated/src/org/apache/jsp/trail_jsp.java | a070a75ce07b215385a3a5f293eff58f280d395f | [] | no_license | praveenk0705/OnlineBusReservationApp | 81bfe91de74ee3e89528e0adbddf381d5ef1b2d9 | a9b75758e42151149b09dd70dbc5128728b09777 | refs/heads/master | 2021-01-20T06:44:51.276750 | 2017-08-26T20:57:18 | 2017-08-26T20:57:18 | 101,512,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,415 | java | package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class trail_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.Vector _jspx_dependants;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_form_action;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_select_property;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_option_value_key_nobody;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_logic_iterate_id_collection;
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_html_submit_value_property_nobody;
private org.apache.jasper.runtime.ResourceInjector _jspx_resourceInjector;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_jspx_tagPool_html_form_action = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_html_select_property = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_html_option_value_key_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_logic_iterate_id_collection = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_jspx_tagPool_html_submit_value_property_nobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
}
public void _jspDestroy() {
_jspx_tagPool_html_form_action.release();
_jspx_tagPool_html_select_property.release();
_jspx_tagPool_html_option_value_key_nobody.release();
_jspx_tagPool_logic_iterate_id_collection.release();
_jspx_tagPool_html_submit_value_property_nobody.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html;charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
_jspx_resourceInjector = (org.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
out.write("\n");
out.write("\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
out.write(" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
forms.HibernateBean bean = null;
synchronized (_jspx_page_context) {
bean = (forms.HibernateBean) _jspx_page_context.getAttribute("bean", PageContext.PAGE_SCOPE);
if (bean == null){
bean = new forms.HibernateBean();
_jspx_page_context.setAttribute("bean", bean, PageContext.PAGE_SCOPE);
}
}
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<!-- DW6 -->\n");
out.write("<head>\n");
out.write("<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->\n");
out.write("<title>Home Page</title>\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n");
out.write("<link rel=\"stylesheet\" href=\"mm_travel2.css\" type=\"text/css\" />\n");
out.write("<script language=\"JavaScript\" type=\"text/javascript\">\n");
out.write("//--------------- LOCALIZEABLE GLOBALS ---------------\n");
out.write("var d=new Date();\n");
out.write("var monthname=new Array(\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\");\n");
out.write("//Ensure correct for language. English is \"January 1, 2004\"\n");
out.write("var TODAY = monthname[d.getMonth()] + \" \" + d.getDate() + \", \" + d.getFullYear();\n");
out.write("//--------------- END LOCALIZEABLE ---------------\n");
out.write("</script>\n");
out.write("<style type=\"text/css\">\n");
out.write("<!--\n");
out.write(".style1 {\n");
out.write("\tfont-size: 12px;\n");
out.write("\tfont-weight: bold;\n");
out.write("}\n");
out.write(".style5 {font-size: 12px; font-weight: bold; color: #3366CC; }\n");
out.write("-->\n");
out.write("</style>\n");
out.write("</head>\n");
out.write("<body bgcolor=\"#C0DFFD\">\n");
out.write("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
out.write(" <tr bgcolor=\"#3366CC\">\n");
out.write(" <td colspan=\"3\" rowspan=\"2\"><img src=\"mm_travel_photo.jpg\" alt=\"Header image\" width=\"382\" height=\"127\" border=\"0\" /></td>\n");
out.write(" <td height=\"63\" colspan=\"3\" id=\"logo\" valign=\"bottom\" align=\"center\" nowrap=\"nowrap\">Get Set Go...</td>\n");
out.write(" <td width=\"21\"> </td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" <tr bgcolor=\"#3366CC\">\n");
out.write(" <td height=\"64\" colspan=\"3\" id=\"tagline\" valign=\"top\" align=\"right\">at your place</td>\n");
out.write("\t<td width=\"21\"> </td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" <tr>\n");
out.write(" <td colspan=\"7\" bgcolor=\"#003366\"><img src=\"mm_spacer.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" /></td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" <tr bgcolor=\"#CCFF99\">\n");
out.write(" \t<td colspan=\"7\" id=\"dateformat\" height=\"25\"> <script language=\"JavaScript\" type=\"text/javascript\">\n");
out.write(" document.write(TODAY);\t</script>\t</td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td colspan=\"7\" bgcolor=\"#003366\"><img src=\"mm_spacer.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" /></td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\" valign=\"top\" bgcolor=\"#E6F3FF\">\n");
out.write("\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"165\" id=\"navigation\">\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"> <br />\n");
out.write("\t\t <br /></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">HOME</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">CHANGE PASSWORD</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">VIEW PROFILE</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">MY TICKETS</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">FEEDBACK</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">FAQ</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">CONTACT US</a></td>\n");
out.write(" </tr>\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"><a href=\"javascript:;\" class=\"navText\">LOGOUT</a></td>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" \t<br />\n");
out.write(" \t <br />\n");
out.write(" \t <br />\n");
out.write(" \t <br /> \t</td>\n");
out.write(" <td width=\"50\"><img src=\"mm_spacer.gif\" alt=\"\" width=\"50\" height=\"1\" border=\"0\" /></td>\n");
out.write(" <td colspan=\"2\" valign=\"top\"><img src=\"mm_spacer.gif\" alt=\"\" width=\"305\" height=\"1\" border=\"0\" /><br />\n");
out.write("\t <br />\n");
out.write("\t <br />\n");
out.write("\n");
out.write(" ");
// html:form
org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0 = (org.apache.struts.taglib.html.FormTag) _jspx_tagPool_html_form_action.get(org.apache.struts.taglib.html.FormTag.class);
_jspx_th_html_form_0.setPageContext(_jspx_page_context);
_jspx_th_html_form_0.setParent(null);
_jspx_th_html_form_0.setAction("bus_info.do");
int _jspx_eval_html_form_0 = _jspx_th_html_form_0.doStartTag();
if (_jspx_eval_html_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\n");
out.write(" <table width=\"617\" height=\"132\" border=\"1\" cellpadding=\"5\" cellspacing=\"2\">\n");
out.write(" <caption> \n");
out.write(" </caption>\n");
out.write(" <tr>\n");
out.write(" <td width=\"96\" height=\"42\" align=\"center\" class=\"style5\">From Stop</td>\n");
out.write(" <td width=\"121\">\n");
out.write(" ");
// html:select
org.apache.struts.taglib.html.SelectTag _jspx_th_html_select_0 = (org.apache.struts.taglib.html.SelectTag) _jspx_tagPool_html_select_property.get(org.apache.struts.taglib.html.SelectTag.class);
_jspx_th_html_select_0.setPageContext(_jspx_page_context);
_jspx_th_html_select_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
_jspx_th_html_select_0.setProperty("stopone");
int _jspx_eval_html_select_0 = _jspx_th_html_select_0.doStartTag();
if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_html_select_0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_html_select_0.doInitBody();
}
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_select_0, _jspx_page_context))
return;
out.write("\n");
out.write(" ");
// logic:iterate
org.apache.struts.taglib.logic.IterateTag _jspx_th_logic_iterate_0 = (org.apache.struts.taglib.logic.IterateTag) _jspx_tagPool_logic_iterate_id_collection.get(org.apache.struts.taglib.logic.IterateTag.class);
_jspx_th_logic_iterate_0.setPageContext(_jspx_page_context);
_jspx_th_logic_iterate_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_0);
_jspx_th_logic_iterate_0.setId("list");
_jspx_th_logic_iterate_0.setCollection((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${bean.stopList}", java.lang.Object.class, (PageContext)_jspx_page_context, null));
int _jspx_eval_logic_iterate_0 = _jspx_th_logic_iterate_0.doStartTag();
if (_jspx_eval_logic_iterate_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
java.lang.Object list = null;
if (_jspx_eval_logic_iterate_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_logic_iterate_0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_logic_iterate_0.doInitBody();
}
list = (java.lang.Object) _jspx_page_context.findAttribute("list");
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_1((javax.servlet.jsp.tagext.JspTag) _jspx_th_logic_iterate_0, _jspx_page_context))
return;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_logic_iterate_0.doAfterBody();
list = (java.lang.Object) _jspx_page_context.findAttribute("list");
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_logic_iterate_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = _jspx_page_context.popBody();
}
if (_jspx_th_logic_iterate_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_logic_iterate_id_collection.reuse(_jspx_th_logic_iterate_0);
return;
}
_jspx_tagPool_logic_iterate_id_collection.reuse(_jspx_th_logic_iterate_0);
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_html_select_0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = _jspx_page_context.popBody();
}
if (_jspx_th_html_select_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_0);
return;
}
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_0);
out.write("\n");
out.write("\n");
out.write(" </td>\n");
out.write("\t <td width=\"102\" align=\"center\"><span class=\"style5\">To Stop</span></td>\n");
out.write(" <td width=\"149\">\n");
out.write("\n");
out.write(" ");
// html:select
org.apache.struts.taglib.html.SelectTag _jspx_th_html_select_1 = (org.apache.struts.taglib.html.SelectTag) _jspx_tagPool_html_select_property.get(org.apache.struts.taglib.html.SelectTag.class);
_jspx_th_html_select_1.setPageContext(_jspx_page_context);
_jspx_th_html_select_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
_jspx_th_html_select_1.setProperty("stoptwo");
int _jspx_eval_html_select_1 = _jspx_th_html_select_1.doStartTag();
if (_jspx_eval_html_select_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_html_select_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_html_select_1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_html_select_1.doInitBody();
}
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_2((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_select_1, _jspx_page_context))
return;
out.write("\n");
out.write(" ");
// logic:iterate
org.apache.struts.taglib.logic.IterateTag _jspx_th_logic_iterate_1 = (org.apache.struts.taglib.logic.IterateTag) _jspx_tagPool_logic_iterate_id_collection.get(org.apache.struts.taglib.logic.IterateTag.class);
_jspx_th_logic_iterate_1.setPageContext(_jspx_page_context);
_jspx_th_logic_iterate_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_1);
_jspx_th_logic_iterate_1.setId("list");
_jspx_th_logic_iterate_1.setCollection((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${bean.stopList}", java.lang.Object.class, (PageContext)_jspx_page_context, null));
int _jspx_eval_logic_iterate_1 = _jspx_th_logic_iterate_1.doStartTag();
if (_jspx_eval_logic_iterate_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
java.lang.Object list = null;
if (_jspx_eval_logic_iterate_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_logic_iterate_1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_logic_iterate_1.doInitBody();
}
list = (java.lang.Object) _jspx_page_context.findAttribute("list");
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_3((javax.servlet.jsp.tagext.JspTag) _jspx_th_logic_iterate_1, _jspx_page_context))
return;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_logic_iterate_1.doAfterBody();
list = (java.lang.Object) _jspx_page_context.findAttribute("list");
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_logic_iterate_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = _jspx_page_context.popBody();
}
if (_jspx_th_logic_iterate_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_logic_iterate_id_collection.reuse(_jspx_th_logic_iterate_1);
return;
}
_jspx_tagPool_logic_iterate_id_collection.reuse(_jspx_th_logic_iterate_1);
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_html_select_1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_html_select_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = _jspx_page_context.popBody();
}
if (_jspx_th_html_select_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_1);
return;
}
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_1);
out.write("\n");
out.write(" </td>\n");
out.write("\t </tr>\n");
out.write(" <tr>\n");
out.write("\n");
out.write(" <td height=\"48\" align=\"center\"><span class=\"style5\">Journey Date</span></td>\n");
out.write(" <td>\n");
out.write(" <script type=\"text/javascript\" src=\"Datetimepicker/datetimepicker_css.js\"></script>\n");
out.write(" <input id=demo1 maxLength=20 size=20/> <img style=\"CURSOR:pointer\" onclick=\"javascript:NewCssCal('demo1')\" alt=\"\" src=\"images/cal.gif\"/>\n");
out.write(" </td>\n");
out.write("\n");
out.write(" <td align=\"center\"><span class=\"style5\">Bus Service </span></td>\n");
out.write("<td><span class=\"style5\"> ");
if (_jspx_meth_html_select_2((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_form_0, _jspx_page_context))
return;
out.write("</td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write("\n");
out.write(" <tr>\n");
out.write(" <td height=\"30\" colspan=\"2\" align=\"center\">");
if (_jspx_meth_html_submit_0((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_form_0, _jspx_page_context))
return;
out.write("</td>\n");
out.write(" <td height=\"30\" colspan=\"2\" align=\"center\">");
if (_jspx_meth_html_submit_1((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_form_0, _jspx_page_context))
return;
out.write("</td>\n");
out.write(" </tr>\n");
out.write(" </table>\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_html_form_0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_html_form_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_form_action.reuse(_jspx_th_html_form_0);
return;
}
_jspx_tagPool_html_form_action.reuse(_jspx_th_html_form_0);
out.write("\n");
out.write("\t<br /> </td>\n");
out.write(" </tr>\n");
out.write("\n");
out.write(" <tr>\n");
out.write(" <td width=\"165\"> </td>\n");
out.write(" <td width=\"50\"> </td>\n");
out.write(" <td width=\"203\"> </td>\n");
out.write(" <td width=\"305\"> </td>\n");
out.write(" <td width=\"4\"> </td>\n");
out.write(" <td width=\"4\"> </td>\n");
out.write(" <td width=\"21\"> </td>\n");
out.write(" </tr>\n");
out.write("</table>\n");
out.write("</body>\n");
out.write("</html>\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_html_option_0(javax.servlet.jsp.tagext.JspTag _jspx_th_html_select_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_0 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_0.setPageContext(_jspx_page_context);
_jspx_th_html_option_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_0);
_jspx_th_html_option_0.setKey("select");
_jspx_th_html_option_0.setValue("Select Choice...");
int _jspx_eval_html_option_0 = _jspx_th_html_option_0.doStartTag();
if (_jspx_th_html_option_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_0);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_0);
return false;
}
private boolean _jspx_meth_html_option_1(javax.servlet.jsp.tagext.JspTag _jspx_th_logic_iterate_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_1 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_1.setPageContext(_jspx_page_context);
_jspx_th_html_option_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_logic_iterate_0);
_jspx_th_html_option_1.setKey((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${list}", java.lang.String.class, (PageContext)_jspx_page_context, null));
_jspx_th_html_option_1.setValue((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${list}", java.lang.String.class, (PageContext)_jspx_page_context, null));
int _jspx_eval_html_option_1 = _jspx_th_html_option_1.doStartTag();
if (_jspx_th_html_option_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_1);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_1);
return false;
}
private boolean _jspx_meth_html_option_2(javax.servlet.jsp.tagext.JspTag _jspx_th_html_select_1, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_2 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_2.setPageContext(_jspx_page_context);
_jspx_th_html_option_2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_1);
_jspx_th_html_option_2.setKey("select");
_jspx_th_html_option_2.setValue("Select Choice...");
int _jspx_eval_html_option_2 = _jspx_th_html_option_2.doStartTag();
if (_jspx_th_html_option_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_2);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_2);
return false;
}
private boolean _jspx_meth_html_option_3(javax.servlet.jsp.tagext.JspTag _jspx_th_logic_iterate_1, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_3 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_3.setPageContext(_jspx_page_context);
_jspx_th_html_option_3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_logic_iterate_1);
_jspx_th_html_option_3.setKey((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${list}", java.lang.String.class, (PageContext)_jspx_page_context, null));
_jspx_th_html_option_3.setValue((java.lang.String) org.apache.jasper.runtime.PageContextImpl.evaluateExpression("${list}", java.lang.String.class, (PageContext)_jspx_page_context, null));
int _jspx_eval_html_option_3 = _jspx_th_html_option_3.doStartTag();
if (_jspx_th_html_option_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_3);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_3);
return false;
}
private boolean _jspx_meth_html_select_2(javax.servlet.jsp.tagext.JspTag _jspx_th_html_form_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:select
org.apache.struts.taglib.html.SelectTag _jspx_th_html_select_2 = (org.apache.struts.taglib.html.SelectTag) _jspx_tagPool_html_select_property.get(org.apache.struts.taglib.html.SelectTag.class);
_jspx_th_html_select_2.setPageContext(_jspx_page_context);
_jspx_th_html_select_2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
_jspx_th_html_select_2.setProperty("servicetype");
int _jspx_eval_html_select_2 = _jspx_th_html_select_2.doStartTag();
if (_jspx_eval_html_select_2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_html_select_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_html_select_2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_html_select_2.doInitBody();
}
do {
out.write("</span>\n");
out.write(" ");
if (_jspx_meth_html_option_4((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_select_2, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_5((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_select_2, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_html_option_6((javax.servlet.jsp.tagext.JspTag) _jspx_th_html_select_2, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_html_select_2.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_html_select_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = _jspx_page_context.popBody();
}
if (_jspx_th_html_select_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_2);
return true;
}
_jspx_tagPool_html_select_property.reuse(_jspx_th_html_select_2);
return false;
}
private boolean _jspx_meth_html_option_4(javax.servlet.jsp.tagext.JspTag _jspx_th_html_select_2, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_4 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_4.setPageContext(_jspx_page_context);
_jspx_th_html_option_4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_2);
_jspx_th_html_option_4.setKey("select");
_jspx_th_html_option_4.setValue("Select Choice...");
int _jspx_eval_html_option_4 = _jspx_th_html_option_4.doStartTag();
if (_jspx_th_html_option_4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_4);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_4);
return false;
}
private boolean _jspx_meth_html_option_5(javax.servlet.jsp.tagext.JspTag _jspx_th_html_select_2, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_5 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_5.setPageContext(_jspx_page_context);
_jspx_th_html_option_5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_2);
_jspx_th_html_option_5.setKey("A/C");
_jspx_th_html_option_5.setValue("A/C");
int _jspx_eval_html_option_5 = _jspx_th_html_option_5.doStartTag();
if (_jspx_th_html_option_5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_5);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_5);
return false;
}
private boolean _jspx_meth_html_option_6(javax.servlet.jsp.tagext.JspTag _jspx_th_html_select_2, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:option
org.apache.struts.taglib.html.OptionTag _jspx_th_html_option_6 = (org.apache.struts.taglib.html.OptionTag) _jspx_tagPool_html_option_value_key_nobody.get(org.apache.struts.taglib.html.OptionTag.class);
_jspx_th_html_option_6.setPageContext(_jspx_page_context);
_jspx_th_html_option_6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_select_2);
_jspx_th_html_option_6.setKey("Semi-Luxury");
_jspx_th_html_option_6.setValue("Semi-Luxury");
int _jspx_eval_html_option_6 = _jspx_th_html_option_6.doStartTag();
if (_jspx_th_html_option_6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_6);
return true;
}
_jspx_tagPool_html_option_value_key_nobody.reuse(_jspx_th_html_option_6);
return false;
}
private boolean _jspx_meth_html_submit_0(javax.servlet.jsp.tagext.JspTag _jspx_th_html_form_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:submit
org.apache.struts.taglib.html.SubmitTag _jspx_th_html_submit_0 = (org.apache.struts.taglib.html.SubmitTag) _jspx_tagPool_html_submit_value_property_nobody.get(org.apache.struts.taglib.html.SubmitTag.class);
_jspx_th_html_submit_0.setPageContext(_jspx_page_context);
_jspx_th_html_submit_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
_jspx_th_html_submit_0.setProperty("action");
_jspx_th_html_submit_0.setValue("Search");
int _jspx_eval_html_submit_0 = _jspx_th_html_submit_0.doStartTag();
if (_jspx_th_html_submit_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_submit_value_property_nobody.reuse(_jspx_th_html_submit_0);
return true;
}
_jspx_tagPool_html_submit_value_property_nobody.reuse(_jspx_th_html_submit_0);
return false;
}
private boolean _jspx_meth_html_submit_1(javax.servlet.jsp.tagext.JspTag _jspx_th_html_form_0, PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// html:submit
org.apache.struts.taglib.html.SubmitTag _jspx_th_html_submit_1 = (org.apache.struts.taglib.html.SubmitTag) _jspx_tagPool_html_submit_value_property_nobody.get(org.apache.struts.taglib.html.SubmitTag.class);
_jspx_th_html_submit_1.setPageContext(_jspx_page_context);
_jspx_th_html_submit_1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
_jspx_th_html_submit_1.setProperty("action");
_jspx_th_html_submit_1.setValue("Reset");
int _jspx_eval_html_submit_1 = _jspx_th_html_submit_1.doStartTag();
if (_jspx_th_html_submit_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_jspx_tagPool_html_submit_value_property_nobody.reuse(_jspx_th_html_submit_1);
return true;
}
_jspx_tagPool_html_submit_value_property_nobody.reuse(_jspx_th_html_submit_1);
return false;
}
}
| [
"praveenk0705@gmail.com"
] | praveenk0705@gmail.com |
af6d4767940fb54b3d60a1ce577b8fa8c277b633 | aeb5606519c49392c3fa92fdbc049aa8a30107bb | /src-gen/streamprocessingapplication/Decompressor.java | 3d407e9c85d8d27c821acfe3c20c1753206590da | [] | no_license | tsokkisl/Asynchronous-Stream-Processing-Applications-DSL | 01ea6cc184b1dcb6a3f26d9c9029bb3d89b89517 | 4aae1f3f74ea500cee2e70ffa64bae7b354703a9 | refs/heads/master | 2023-03-18T16:55:29.444606 | 2021-03-15T23:42:48 | 2021-03-15T23:42:48 | 347,583,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package streamprocessingapplication;
/* protected region Imports on begin */
/* protected region Imports end */
public class Decompressor implements Runnable {
/* protected region Task on begin */
public static void thread(Runnable runnable, boolean daemon) {
Thread brokerThread = new Thread(runnable);
brokerThread.setDaemon(daemon);
brokerThread.start();
}
public void run() {
}
/* protected region Task end */
} | [
"tsokkis.l@gmail.com"
] | tsokkis.l@gmail.com |
c7a829ad90c6023ae8edbf9e214e1b1abab15e7c | 5a695501348546ffc57ad5e4d79f4f3fb45c699b | /projects/batfish/src/test/java/org/batfish/bddreachability/transition/EraseAndSetTest.java | 2d34cb469c6c13ae35d2a2d222244b35b2e86a4f | [
"Apache-2.0"
] | permissive | HewlettPackard/batfish | 372114b3451b70872c92ef2d88493d55fc7c6edb | d7fe613df3ab5082b547a5de34e575bd55eb5a08 | refs/heads/master | 2023-08-09T09:18:51.328254 | 2019-02-04T19:19:51 | 2019-02-04T19:19:51 | 169,150,959 | 2 | 0 | null | 2019-02-04T21:14:50 | 2019-02-04T21:14:49 | null | UTF-8 | Java | false | false | 2,112 | java | package org.batfish.bddreachability.transition;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.util.Arrays;
import net.sf.javabdd.BDD;
import org.batfish.common.bdd.BDDPacket;
import org.batfish.datamodel.Ip;
import org.junit.Test;
/** Tests of {@link EraseAndSet}. */
public class EraseAndSetTest {
private static final BDDPacket PKT = new BDDPacket();
private static final BDD ONE = PKT.getFactory().one();
private static final BDD ZERO = PKT.getFactory().zero();
private static BDD dstIp(String ip) {
return PKT.getDstIp().value(Ip.parse(ip).asLong());
}
private static BDD srcIp(String ip) {
return PKT.getSrcIp().value(Ip.parse(ip).asLong());
}
@Test
public void testEraseAndSet() {
BDD setBdd = dstIp("1.1.1.1");
BDD vars = Arrays.stream(PKT.getDstIp().getBitvec()).reduce(PKT.getFactory().one(), BDD::and);
Transition transition = new EraseAndSet(vars, setBdd);
assertThat(transition.transitForward(ONE), equalTo(setBdd));
assertThat(transition.transitBackward(ONE), equalTo(ONE));
assertThat(transition.transitForward(setBdd), equalTo(setBdd));
assertThat(transition.transitBackward(setBdd), equalTo(ONE));
assertThat(transition.transitForward(setBdd.not()), equalTo(setBdd));
assertThat(transition.transitBackward(setBdd.not()), equalTo(ZERO));
// more interesting example
BDD bdd = setBdd.ite(srcIp("5.5.5.5"), srcIp("6.6.6.6"));
/* transitForward: After erasing setBdd, we end up with srcIp("5.5.5.5").or(srcIp("6.6.6.6")).
* Then we and the setBdd constraint back in.
*/
assertThat(
transition.transitForward(bdd), equalTo(setBdd.and(srcIp("5.5.5.5").or(srcIp("6.6.6.6")))));
/* transitBackward: After applying the setBdd constraint, we have setBdd.and(srcIp("5.5.5.5")).
* The false branch of the ite is inconsistent with the outputs of the transition. Then we erase
* the dstIp vars and are left with just srcIp("5.5.5.5").
*/
assertThat(transition.transitBackward(bdd), equalTo(srcIp("5.5.5.5")));
}
}
| [
"noreply@github.com"
] | HewlettPackard.noreply@github.com |
e5a1502f3f929468d1a403c72dac9381d70af8c3 | 2ebc961c529def3f23512434cebdce4a3ae9dfde | /src/com/model/dao/DeleteProductDao.java | 2d6529789e5f833ef1153c3eb916853061d7dcca | [] | no_license | bobby1823/InventoryApp | 32d15df4d912116804e9a73a96579b54950eb96a | 3b99baf088244039bff39e16e7450c2e842ed333 | refs/heads/master | 2021-09-27T07:41:27.113165 | 2018-08-04T20:41:31 | 2018-08-04T20:41:31 | 138,378,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package com.model.dao;
import com.exception.InventoryAppException;
public interface DeleteProductDao {
public void deleteProduct(String userName, int productId) throws InventoryAppException;
public void deleteInventory(String userName, int productId) throws InventoryAppException;
public void deleteFromInventory(String userName, int productId) throws InventoryAppException;
}
| [
"Sayanta.Roy@wnco.com"
] | Sayanta.Roy@wnco.com |
1e25cb99cdac9b60e0fdbbc6c75e66391c1d4e58 | 4973c88915010ec3129ada49baedb3e9329a0db0 | /plugin/src/main/java/com/softrice/systrace/Util.java | d057b74b890262a95c94b378a938eee601634883 | [] | no_license | softrice/SystracePlugin | 5be2d23a3c78d9e9bd547553288c7e5f90acddab | 8ea24eb2175b7ca15c06415c54069b0d1d232aa1 | refs/heads/master | 2022-10-02T04:12:12.464296 | 2020-06-09T08:44:24 | 2020-06-09T08:44:24 | 270,555,015 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,350 | java | package com.softrice.systrace;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Field;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
public final class Util {
private static final String TAG = "Util";
public static final int BUFFER_SIZE = 16384;
private Util() {
}
public static void addZipEntry(ZipOutputStream zipOutputStream, ZipEntry zipEntry, InputStream inputStream) throws Exception {
try {
zipOutputStream.putNextEntry(zipEntry);
byte[] buffer = new byte[BUFFER_SIZE];
int length = -1;
while ((length = inputStream.read(buffer, 0, buffer.length)) != -1) {
zipOutputStream.write(buffer, 0, length);
zipOutputStream.flush();
}
} catch (ZipException e) {
Log.e(TAG, "addZipEntry err!");
} finally {
closeQuietly(inputStream);
zipOutputStream.closeEntry();
}
}
public static boolean isNullOrNil(String str) {
return str == null || str.isEmpty();
}
public static Field getDeclaredFieldRecursive(Object clazz, String fieldName) throws NoSuchFieldException, ClassNotFoundException {
Class<?> realClazz = null;
if (clazz instanceof String) {
realClazz = Class.forName((String) clazz);
} else if (clazz instanceof Class) {
realClazz = (Class<?>) clazz;
} else {
throw new IllegalArgumentException("Illegal clazz type: " + clazz.getClass());
}
Class<?> currClazz = realClazz;
while (true) {
try {
Field field = currClazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
} catch (NoSuchFieldException e) {
if (currClazz.equals(Object.class)) {
throw e;
}
currClazz = currClazz.getSuperclass();
}
}
}
public static boolean isRealZipOrJar(File input) {
ZipFile zf = null;
try {
zf = new ZipFile(input);
return true;
} catch (Exception e) {
return false;
} finally {
Util.closeQuietly(zf);
}
}
/**
* Close {@code target} quietly.
*
* @param obj
* Object to be closed.
*/
public static void closeQuietly(Object obj) {
if (obj == null) {
return;
}
if (obj instanceof Closeable) {
try {
((Closeable) obj).close();
} catch (Throwable ignored) {
// ignore
}
} else if (obj instanceof AutoCloseable) {
try {
((AutoCloseable) obj).close();
} catch (Throwable ignored) {
// ignore
}
} else if (obj instanceof ZipFile) {
try {
((ZipFile) obj).close();
} catch (Throwable ignored) {
// ignore
}
} else {
throw new IllegalArgumentException("obj " + obj + " is not closeable");
}
}
public static String readFileAsString(String filePath) {
StringBuffer fileData = new StringBuffer();
Reader fileReader = null;
InputStream inputStream = null;
try {
inputStream = new FileInputStream(filePath);
fileReader = new InputStreamReader(inputStream, "UTF-8");
char[] buf = new char[BUFFER_SIZE];
int numRead = 0;
while ((numRead = fileReader.read(buf)) != -1) {
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
} catch (Exception e) {
Log.e(TAG, "file op readFileAsString e type:%s, e msg:%s, filePath:%s",
e.getClass().getSimpleName(), e.getMessage(), filePath);
} finally {
try {
closeQuietly(fileReader);
closeQuietly(inputStream);
} catch (Exception e) {
Log.e(TAG, "file op readFileAsString close e type:%s, e msg:%s, filePath:%s",
e.getClass().getSimpleName(), e.getMessage(), filePath);
}
}
return fileData.toString();
}
public static void copyFileUsingStream(File source, File dest) throws IOException {
FileInputStream is = null;
FileOutputStream os = null;
File parent = dest.getParentFile();
if (parent != null && (!parent.exists())) {
parent.mkdirs();
}
try {
is = new FileInputStream(source);
os = new FileOutputStream(dest, false);
byte[] buffer = new byte[BUFFER_SIZE];
int length;
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
} finally {
closeQuietly(is);
closeQuietly(os);
}
}
}
| [
"huangzhangshuai@weidian.com"
] | huangzhangshuai@weidian.com |
df3a8f1c54e4159855b8000e351bec6288fa33b8 | ec857b9f104af4800a8beb4d9fd4ffcab90197c9 | /src/com/presupuesto/control/TrasladoRubroJpaController.java | ecc6fbc1f646fa7721b26b5aa44d5f1a5b3652dc | [] | no_license | lfleiva/Presupuesto | accace00d1b1ba45ba53ab53a7de5fbc2ff3a622 | 52323aee7ac6e52e554c30d15095a4bc3ab9dffc | refs/heads/master | 2021-03-30T17:32:43.738766 | 2017-03-15T21:26:25 | 2017-03-15T21:26:25 | 67,344,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,577 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.presupuesto.control;
import com.presupuesto.control.exceptions.NonexistentEntityException;
import java.io.Serializable;
import javax.persistence.Query;
import javax.persistence.EntityNotFoundException;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import com.presupuesto.modelo.Traslado;
import com.presupuesto.modelo.Rubro;
import com.presupuesto.modelo.TrasladoRubro;
import com.presupuesto.modelo.Vigencia;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
*
* @author Luis Fernando Leiva
*/
public class TrasladoRubroJpaController implements Serializable {
private static EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("PresupuestoPU");
private EntityManager entityManager;
public TrasladoRubroJpaController(){}
public TrasladoRubroJpaController(EntityManagerFactory emf) {
this.emf = emf;
}
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return entityManagerFactory.createEntityManager();
}
public void create(TrasladoRubro trasladoRubro) {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
Traslado traslado = trasladoRubro.getTraslado();
if (traslado != null) {
traslado = em.getReference(traslado.getClass(), traslado.getIdTraslado());
trasladoRubro.setTraslado(traslado);
}
Rubro rubro = trasladoRubro.getRubro();
if (rubro != null) {
rubro = em.getReference(rubro.getClass(), rubro.getIdRubro());
trasladoRubro.setRubro(rubro);
}
Vigencia vigencia = trasladoRubro.getVigencia();
if (vigencia != null) {
vigencia = em.getReference(vigencia.getClass(), vigencia.getIdVigencia());
trasladoRubro.setVigencia(vigencia);
}
em.persist(trasladoRubro);
if (traslado != null) {
traslado.getTrasladoRubroList().add(trasladoRubro);
traslado = em.merge(traslado);
}
if (rubro != null) {
rubro.getTrasladoRubroList().add(trasladoRubro);
rubro = em.merge(rubro);
}
if (vigencia != null) {
vigencia.getTrasladoRubroList().add(trasladoRubro);
vigencia = em.merge(vigencia);
}
em.getTransaction().commit();
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(TrasladoRubro trasladoRubro) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
TrasladoRubro persistentTrasladoRubro = em.find(TrasladoRubro.class, trasladoRubro.getIdTrasladoRubro());
Traslado trasladoOld = persistentTrasladoRubro.getTraslado();
Traslado trasladoNew = trasladoRubro.getTraslado();
Rubro rubroOld = persistentTrasladoRubro.getRubro();
Rubro rubroNew = trasladoRubro.getRubro();
Vigencia vigenciaOld = persistentTrasladoRubro.getVigencia();
Vigencia vigenciaNew = trasladoRubro.getVigencia();
if (trasladoNew != null) {
trasladoNew = em.getReference(trasladoNew.getClass(), trasladoNew.getIdTraslado());
trasladoRubro.setTraslado(trasladoNew);
}
if (rubroNew != null) {
rubroNew = em.getReference(rubroNew.getClass(), rubroNew.getIdRubro());
trasladoRubro.setRubro(rubroNew);
}
if (vigenciaNew != null) {
vigenciaNew = em.getReference(vigenciaNew.getClass(), vigenciaNew.getIdVigencia());
trasladoRubro.setVigencia(vigenciaNew);
}
trasladoRubro = em.merge(trasladoRubro);
if (trasladoOld != null && !trasladoOld.equals(trasladoNew)) {
trasladoOld.getTrasladoRubroList().remove(trasladoRubro);
trasladoOld = em.merge(trasladoOld);
}
if (trasladoNew != null && !trasladoNew.equals(trasladoOld)) {
trasladoNew.getTrasladoRubroList().add(trasladoRubro);
trasladoNew = em.merge(trasladoNew);
}
if (rubroOld != null && !rubroOld.equals(rubroNew)) {
rubroOld.getTrasladoRubroList().remove(trasladoRubro);
rubroOld = em.merge(rubroOld);
}
if (rubroNew != null && !rubroNew.equals(rubroOld)) {
rubroNew.getTrasladoRubroList().add(trasladoRubro);
rubroNew = em.merge(rubroNew);
}
if (vigenciaOld != null && !vigenciaOld.equals(vigenciaNew)) {
vigenciaOld.getTrasladoRubroList().remove(trasladoRubro);
vigenciaOld = em.merge(vigenciaOld);
}
if (vigenciaNew != null && !vigenciaNew.equals(vigenciaOld)) {
vigenciaNew.getTrasladoRubroList().add(trasladoRubro);
vigenciaNew = em.merge(vigenciaNew);
}
em.getTransaction().commit();
} catch (Exception ex) {
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
BigDecimal id = trasladoRubro.getIdTrasladoRubro();
if (findTrasladoRubro(id) == null) {
throw new NonexistentEntityException("The trasladoRubro with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(TrasladoRubro trasladoRubro) throws NonexistentEntityException {
entityManager = null;
try {
entityManager = getEntityManager();
entityManager.getTransaction().begin();
try {
trasladoRubro.getIdTrasladoRubro();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The trasladoRubro with id " + trasladoRubro.getIdTrasladoRubro() + " no longer exists.", enfe);
}
Traslado traslado = trasladoRubro.getTraslado();
if (traslado != null) {
traslado.getTrasladoRubroList().remove(trasladoRubro);
traslado = entityManager.merge(traslado);
}
Rubro rubro = trasladoRubro.getRubro();
if (rubro != null) {
rubro.getTrasladoRubroList().remove(trasladoRubro);
rubro = entityManager.merge(rubro);
}
Vigencia vigencia = trasladoRubro.getVigencia();
if (vigencia != null) {
vigencia.getTrasladoRubroList().remove(trasladoRubro);
vigencia = entityManager.merge(vigencia);
}
entityManager.remove(entityManager.contains(trasladoRubro) ? trasladoRubro : entityManager.merge(trasladoRubro));
entityManager.getTransaction().commit();
} finally {
if (entityManager != null) {
entityManager.close();
}
}
}
public List<TrasladoRubro> findTrasladoRubroEntities() {
return findTrasladoRubroEntities(true, -1, -1);
}
public List<TrasladoRubro> findTrasladoRubroEntities(int maxResults, int firstResult) {
return findTrasladoRubroEntities(false, maxResults, firstResult);
}
private List<TrasladoRubro> findTrasladoRubroEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(TrasladoRubro.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public TrasladoRubro findTrasladoRubro(BigDecimal id) {
EntityManager em = getEntityManager();
try {
return em.find(TrasladoRubro.class, id);
} finally {
em.close();
}
}
public int getTrasladoRubroCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<TrasladoRubro> rt = cq.from(TrasladoRubro.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
}
| [
"Luis Fernando Leiva@DESKTOP-E7N9NND"
] | Luis Fernando Leiva@DESKTOP-E7N9NND |
931b1c76645fc7b9f4e165dd434a4df1da6991d0 | 6f736ff77d23c7e0c2c57e170bad8e6d371ab9f9 | /array-manipulation/src/com/basic/sample/ex4/ReverseArray.java | 370abad8c05d8cdb81b02edc13dc7dc63590a9b5 | [] | no_license | thanh-vt/java-se-basic-exercise | 3870fb1cdbf294711a01b5c6e514d28b25a8a264 | 51804e0f1c3dd6035e58e7f192634a7053276b3d | refs/heads/main | 2023-01-23T02:07:45.754108 | 2020-12-04T10:43:21 | 2020-12-04T10:43:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,202 | java | package com.basic.sample.ex4;
import common.Exercise;
import java.util.Scanner;
public class ReverseArray implements Exercise {
@Override
public void start() {
int size;
int[] array;
Scanner scanner = new Scanner(System.in);
do {
System.out.print("Enter a size:");
size = scanner.nextInt();
if (size > 20) {
System.out.println("Size does not exceed 20");
}
} while (size > 20);
array = new int[size];
int i = 0;
while (i < array.length) {
System.out.print("Enter element " + (i + 1) + ": ");
array[i] = scanner.nextInt();
i++;
}
System.out.printf("%-20s%s", "Elements in array: ", "");
for (int value : array) {
System.out.print(value + "\t");
}
for (int j = 0; j < array.length / 2; j++) {
int temp = array[j];
array[j] = array[size - 1 - j];
array[size - 1 - j] = temp;
}
System.out.printf("%-20s%s", "Reverse array: ", "");
for (int value : array) {
System.out.print(value + "\t");
}
}
}
| [
"thanhvt@vissoft.vn"
] | thanhvt@vissoft.vn |
a1d0d28ceabb749050eb09011ced795861786dde | 612b1b7f5201f3ff1a550b09c96218053e195519 | /modules/core/test/com/haulmont/cuba/core/sys/querymacro/EnumQueryMacroHandlerTest.java | 40b6de4e32c36e99e2d6c3f1e363820c740389a9 | [
"Apache-2.0"
] | permissive | cuba-platform/cuba | ffb83fe0b089056e8da11d96a40c596d8871d832 | 36e0c73d4e3b06f700173c4bc49c113838c1690b | refs/heads/master | 2023-06-24T02:03:12.525885 | 2023-06-19T14:13:06 | 2023-06-19T14:13:06 | 54,624,511 | 1,434 | 303 | Apache-2.0 | 2023-08-31T18:57:38 | 2016-03-24T07:55:56 | Java | UTF-8 | Java | false | false | 1,751 | java | /*
* Copyright (c) 2008-2016 Haulmont.
*
* 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.haulmont.cuba.core.sys.querymacro;
import junit.framework.TestCase;
public class EnumQueryMacroHandlerTest extends TestCase {
public void testExpandMacro() throws Exception {
EnumQueryMacroHandler handler = new EnumQueryMacroHandler();
String s = handler.expandMacro("select s from taxi$SpecialInstructionType s where s.parameterType = 10 order by s.name");
assertEquals("select s from taxi$SpecialInstructionType s where s.parameterType = 10 order by s.name", s);
s = handler.expandMacro("select s from taxi$SpecialInstructionType s " +
"where s.parameterType = @enum(com.haulmont.cuba.security.entity.RoleType.SUPER) order by s.name");
assertEquals("select s from taxi$SpecialInstructionType s where s.parameterType = 10 order by s.name", s);
s = handler.expandMacro("select s from taxi$SpecialInstructionType s " +
"where s.parameterType = @enum(com.haulmont.cuba.core.entity.FtsChangeType.UPDATE) order by s.name");
assertEquals("select s from taxi$SpecialInstructionType s where s.parameterType = 'U' order by s.name", s);
}
} | [
"krivopustov@haulmont.com"
] | krivopustov@haulmont.com |
8dfec219929df291c18e9950cfd7949f1507142c | eae21bede0bfd833d519131dd7f5d5aa01d47bc8 | /src/View.java | 893721c95a5c6e4343170b8392fee2c483ae9fe5 | [] | no_license | sayyes0928/TeamDB | a4cdecc9df6f22392ad66f8d7cdc8d4b6b8f973c | 0a42b5c8c146e93469ea7408fa8c17895df5141d | refs/heads/master | 2022-07-06T09:38:50.739209 | 2020-05-14T09:25:51 | 2020-05-14T09:25:51 | 263,290,240 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,278 | java |
public class View {
void start() {
System.out.println("[1]회원가입");
System.out.println("[2]로그인");
System.out.println("[3]종료");
}
void view(int i, String rs) { // 로그인시 출력되는 회원정보
String list[] = { "Null", "ID", "PassWord", "Name", "Birth", "Age", "Mail", "Tel", "Address", "Genfer" };
System.out.println(list[i] + " : " + rs);
}
void viewSelectUpdate() {
System.out.println("=======================");
System.out.println();
System.out.println("수정이나 삭제 선택해주세요");
System.out.println("[1]수정");
System.out.println("[2]삭제");
System.out.println("[3]초기 화면으로");
}
void viewUpdate() {
System.out.println("수정하고 싶은신 내용의 번호를 입력해주세요");
System.out.println("[1]pw");
System.out.println("[2]name");
System.out.println("[3]birth");
System.out.println("[4]age");
System.out.println("[5]mail");
System.out.println("[6]tel");
System.out.println("[7]addr");
System.out.println("[8]gender");
System.out.println("[0]종료");
}
void deleteSelect() {
System.out.println("정말로 삭제하시겠습니까?");
System.out.println("[1]예");
System.out.println("[2]아니오");
}
}
| [
"sayyes0928@gmail.com"
] | sayyes0928@gmail.com |
ff9f9215556b2e4e55d32d0ccb9e8324e01e1436 | 5ab17d80f118bff5627e79306b22700bc9637b85 | /app/src/androidTest/java/com/example/android/sunshine/app/data/TestDb.java | 080c3e5b5ef5e54d36b110bd847434cb8185e5e5 | [
"Apache-2.0"
] | permissive | c0state/udacity-nanodegree-androiddeveloper-sunshine | 158c67f84cc094da52488b3ec6dbf98facada489 | 13bf085bba8e73ce7d74a876e5e116bf56f8de06 | refs/heads/master | 2020-06-13T18:18:36.552925 | 2016-12-27T19:00:07 | 2016-12-27T19:00:07 | 75,570,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,058 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.sunshine.app.data;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.test.AndroidTestCase;
import java.util.HashSet;
import static com.example.android.sunshine.app.data.TestUtilities.IOLANI_LOCATION;
import static com.example.android.sunshine.app.data.TestUtilities.IOLANI_LOCATION_NAME;
import static com.example.android.sunshine.app.data.TestUtilities.validateCurrentRecord;
public class TestDb extends AndroidTestCase {
public static final String LOG_TAG = TestDb.class.getSimpleName();
// Since we want each test to start with a clean slate
void deleteTheDatabase() {
mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME);
}
/*
This function gets called before each test is executed to delete the database. This makes
sure that we always have a clean test.
*/
public void setUp() {
deleteTheDatabase();
}
/*
Students: Uncomment this test once you've written the code to create the Location
table. Note that you will have to have chosen the same column names that I did in
my solution for this test to compile, so if you haven't yet done that, this is
a good time to change your column names to match mine.
Note that this only tests that the Location table has the correct columns, since we
give you the code for the weather table. This test does not look at the
*/
public void testCreateDb() throws Throwable {
// build a HashSet of all of the table names we wish to look for
// Note that there will be another table in the DB that stores the
// Android metadata (db version information)
final HashSet<String> tableNameHashSet = new HashSet<String>();
tableNameHashSet.add(WeatherContract.LocationEntry.TABLE_NAME);
tableNameHashSet.add(WeatherContract.WeatherEntry.TABLE_NAME);
mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME);
SQLiteDatabase db = new WeatherDbHelper(
this.mContext).getWritableDatabase();
assertEquals(true, db.isOpen());
// have we created the tables we want?
Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null);
assertTrue("Error: This means that the database has not been created correctly",
c.moveToFirst());
// verify that the tables have been created
do {
tableNameHashSet.remove(c.getString(0));
} while( c.moveToNext() );
// if this fails, it means that your database doesn't contain both the location entry
// and weather entry tables
assertTrue("Error: Your database was created without both the location entry and weather entry tables",
tableNameHashSet.isEmpty());
// now, do our tables contain the correct columns?
c = db.rawQuery("PRAGMA table_info(" + WeatherContract.LocationEntry.TABLE_NAME + ")",
null);
assertTrue("Error: This means that we were unable to query the database for table information.",
c.moveToFirst());
// Build a HashSet of all of the column names we want to look for
final HashSet<String> locationColumnHashSet = new HashSet<String>();
locationColumnHashSet.add(WeatherContract.LocationEntry._ID);
locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_CITY_NAME);
locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LAT);
locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LONG);
locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING);
int columnNameIndex = c.getColumnIndex("name");
do {
String columnName = c.getString(columnNameIndex);
locationColumnHashSet.remove(columnName);
} while(c.moveToNext());
// if this fails, it means that your database doesn't contain all of the required location
// entry columns
assertTrue("Error: The database doesn't contain all of the required location entry columns",
locationColumnHashSet.isEmpty());
db.close();
}
/*
Students: Here is where you will build code to test that we can insert and query the
location database. We've done a lot of work for you. You'll want to look in TestUtilities
where you can uncomment out the "createNorthPoleLocationValues" function. You can
also make use of the ValidateCurrentRecord function from within TestUtilities.
*/
public void testLocationTable() {
// First step: Get reference to writable database
SQLiteDatabase db = new WeatherDbHelper(this.mContext).getWritableDatabase();
// Insert ContentValues into database and get a row ID back
long insertedId = insertLocation();
// Query the database and receive a Cursor back
Cursor cursor = db.query(WeatherContract.LocationEntry.TABLE_NAME,
null,
WeatherContract.LocationEntry._ID + " = " + String.valueOf(insertedId),
null, null, null, null, null);
// Move the cursor to a valid database row
assertTrue("Could not get inserted location entry!", cursor.moveToNext());
// Validate data in resulting Cursor with the original ContentValues
// (you can use the validateCurrentRecord function in TestUtilities to validate the
// query if you like)
validateCurrentRecord("Queried location does not match inserted one!", cursor,
getTestLocationContentValues());
assertFalse("Unexpected extra location entry!", cursor.moveToNext());
// Finally, close the cursor and database
cursor.close();
db.close();
}
/*
Students: Here is where you will build code to test that we can insert and query the
database. We've done a lot of work for you. You'll want to look in TestUtilities
where you can use the "createWeatherValues" function. You can
also make use of the validateCurrentRecord function from within TestUtilities.
*/
public void testWeatherTable() {
// First insert the location, and then use the locationRowId to insert
// the weather. Make sure to cover as many failure cases as you can.
// Instead of rewriting all of the code we've already written in testLocationTable
// we can move this code to insertLocation and then call insertLocation from both
// tests. Why move it? We need the code to return the ID of the inserted location
// and our testLocationTable can only return void because it's a test.
// First step: Get reference to writable database
SQLiteDatabase db = new WeatherDbHelper(this.mContext).getWritableDatabase();
long insertedId = insertLocation();
// Create ContentValues of what you want to insert
// (you can use the createWeatherValues TestUtilities function if you wish)
ContentValues weatherValues = TestUtilities.createWeatherValues(insertedId);
// Insert ContentValues into database and get a row ID back
long insertedWeatherId = db.insert(WeatherContract.WeatherEntry.TABLE_NAME, null, weatherValues);
// Query the database and receive a Cursor back
Cursor cursor = db.query(WeatherContract.WeatherEntry.TABLE_NAME, null,
WeatherContract.WeatherEntry._ID + "=" + String.valueOf(insertedId),
null, null, null, null);
// Move the cursor to a valid database row
assertTrue("Could not find inserted weather row", cursor.moveToNext());
// Validate data in resulting Cursor with the original ContentValues
// (you can use the validateCurrentRecord function in TestUtilities to validate the
// query if you like)
validateCurrentRecord("Returned weather row does not match what was inserted!",
cursor, weatherValues);
assertFalse("Unexpected extra weather row found", cursor.moveToNext());
// Finally, close the cursor and database
cursor.close();
db.close();
}
/*
Students: This is a helper method for the testWeatherTable quiz. You can move your
code from testLocationTable to here so that you can call this code from both
testWeatherTable and testLocationTable.
*/
public long insertLocation() {
SQLiteDatabase db = new WeatherDbHelper(this.mContext).getWritableDatabase();
ContentValues testValues = getTestLocationContentValues();
return db.insert(WeatherContract.LocationEntry.TABLE_NAME, null, testValues);
}
public ContentValues getTestLocationContentValues() {
ContentValues testValues = new ContentValues();
testValues.put(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING, IOLANI_LOCATION);
testValues.put(WeatherContract.LocationEntry.COLUMN_CITY_NAME, IOLANI_LOCATION_NAME);
testValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LAT,
21.306 /* 827 TODO: need to fix float comparison in validateCurrentRecord */);
testValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LONG, -157.858 /* 813 */);
return testValues;
}
}
| [
"stephen.liu@alumni.stanford.edu"
] | stephen.liu@alumni.stanford.edu |
4ec0836a398881944c65d973562139e91d168bea | 86742d8bb627beda035b5398e5206dfd601df085 | /src/main/java/com/ngonhuhai/service/impl/BrandService.java | 670092d4d95de49f01e59cab024df4c9f39ab92f | [] | no_license | ngohai98/hai | bde914d945e6f7524cb532932263b265145d29c0 | e76568f87f20564e47371725422037ec9b0f40db | refs/heads/main | 2023-04-07T12:22:04.549094 | 2021-04-06T13:29:27 | 2021-04-06T13:29:27 | 354,918,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package com.ngonhuhai.service.impl;
import java.util.List;
import javax.inject.Inject;
import com.ngonhuhai.DAO.iBrandDAO;
import com.ngonhuhai.DAO.impl.BrandDAO;
import com.ngonhuhai.model.BrandModel;
import com.ngonhuhai.service.iBrandService;
public class BrandService implements iBrandService {
private iBrandDAO brandDAO = new BrandDAO();
@Override
public List<BrandModel> findAll() {
// TODO Auto-generated method stub
return brandDAO.findAll();
}
@Override
public BrandModel findOne(Long id) {
// TODO Auto-generated method stub
return brandDAO.findOne(id);
}
}
| [
"73178801+haiphutmot@users.noreply.github.com"
] | 73178801+haiphutmot@users.noreply.github.com |
3a0b3f365d6ef2b1600b8b4a9244d67f4def16c8 | 5860abdf102a174648722dadbb1e26154b340c05 | /src/main/java/com/starmcc/qmsecurity/utils/QmSignTools.java | 14c6209866413bd0ffbef766090a78ae21302cc8 | [
"Apache-2.0"
] | permissive | starmcc/qm-security | 6f1ac038839ccc1b06842a38dae637084764cec9 | 7cd2799a3901594aefda32e8e9c89b4522e99f74 | refs/heads/master | 2022-12-23T04:27:05.048186 | 2020-10-30T08:02:29 | 2020-10-30T08:02:29 | 188,813,604 | 2 | 0 | Apache-2.0 | 2022-12-16T00:45:45 | 2019-05-27T09:30:18 | Java | UTF-8 | Java | false | false | 1,143 | java | package com.starmcc.qmsecurity.utils;
import com.starmcc.qmsecurity.config.SecurityConstants;
import java.security.MessageDigest;
/**
* @author qm
* @date 2019/5/18 15:19
* @Description 签名工具
*/
public class QmSignTools {
/**
* 签名
*
* @param str
* @return
*/
protected static String signMD5(String str) {
if (str == null || str.length() == 0) {
return null;
}
try {
MessageDigest mdTemp = MessageDigest.getInstance(SecurityConstants.SIGN_TYPE);
mdTemp.update(str.getBytes(SecurityConstants.ENC_DEC_ENCODING));
byte[] md = mdTemp.digest();
int j = md.length;
char[] buf = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
buf[k++] = SecurityConstants.SIGN_DIGITS[byte0 >>> 4 & 0xf];
buf[k++] = SecurityConstants.SIGN_DIGITS[byte0 & 0xf];
}
return new String(buf);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| [
"starczt1992@163.com"
] | starczt1992@163.com |
8a829e3d9881cb8be9107954d513225907fedbaa | f4fbaa6329d948954907112614ec0da0655e18b9 | /src/test/java/com/broglog/account/UserAuthenticationIntegrationTest.java | a5bad2e0c7f0e253e39bb7d93af4b45417e5a43d | [] | no_license | dishant/BrogLog | b5d9b357ca314b945986a80b284a08fc52d53d48 | d42e7be5f3aa8c18bed0625e09259e4c5c8b1bc7 | refs/heads/master | 2021-01-15T18:00:58.456986 | 2014-03-05T22:47:17 | 2014-03-05T22:47:17 | 17,457,900 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,575 | java | package com.broglog.account;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultMatcher;
import javax.servlet.http.HttpSession;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl;
import com.broglog.config.WebSecurityConfigurationAware;
public class UserAuthenticationIntegrationTest extends WebSecurityConfigurationAware {
private static String SEC_CONTEXT_ATTR = HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY;
@Test
public void requiresAuthentication() throws Exception {
mockMvc.perform(get("/account/current"))
.andExpect(redirectedUrl("http://localhost/signin"));
}
@Test
public void userAuthenticates() throws Exception {
final String username = "user";
ResultMatcher matcher = new ResultMatcher() {
public void match(MvcResult mvcResult) throws Exception {
HttpSession session = mvcResult.getRequest().getSession();
SecurityContext securityContext = (SecurityContext) session.getAttribute(SEC_CONTEXT_ATTR);
Assert.assertEquals(securityContext.getAuthentication().getName(), username);
}
};
mockMvc.perform(post("/j_spring_security_check").param("j_username", username).param("j_password", "demo"))
.andExpect(redirectedUrl("/"))
.andExpect(matcher);
}
@Test
public void userAuthenticationFails() throws Exception {
final String username = "user";
mockMvc.perform(post("/j_spring_security_check").param("j_username", username).param("j_password", "invalid"))
.andExpect(redirectedUrl("/signin?error=1"))
.andExpect(new ResultMatcher() {
public void match(MvcResult mvcResult) throws Exception {
HttpSession session = mvcResult.getRequest().getSession();
SecurityContext securityContext = (SecurityContext) session.getAttribute(SEC_CONTEXT_ATTR);
Assert.assertNull(securityContext);
}
});
}
}
| [
"dailawadi@walmartlabs.com"
] | dailawadi@walmartlabs.com |
c64a05d3c781f7df21c07fad8e9e87f96766e8d3 | eca96f314090d24f7ca8a8734f348c39db2e4a93 | /app/src/main/java/com/example/sweet_life/Icecream.java | 1d85b613dd068f79fa74bd7db4914f0a9b580c8a | [] | no_license | Overbyaka/Sweet-Life | 5b45c593ea13c6c7a8acd5e95b418414b9d47307 | 9c27811c60f624f1dd693f3bcfa6c2963e2e7088 | refs/heads/master | 2020-09-15T05:49:10.567465 | 2019-11-28T01:32:21 | 2019-11-28T01:32:21 | 223,360,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,204 | java | package com.example.sweet_life;
import android.widget.ImageButton;
public class Icecream extends Dish implements Paint, Posypka{
boolean isAutomat;
boolean isPosypka;
boolean isIce;
public Icecream(int colour, boolean isColour, boolean isIce, boolean isAutomat, boolean isPosypka){
this.colour = colour;
this.isColour = isColour;
this.isIce = isIce;
this.isAutomat = isAutomat;
this.isPosypka = isPosypka;
}
public boolean equals(Icecream icecream){
if(icecream.colour==this.colour && icecream.isColour == this.isColour &&
icecream.isAutomat == this.isAutomat && icecream.isPosypka == this.isPosypka && icecream.isIce == this.isIce)
return true;
else return false;
}
public void setPosypka(boolean posypka, ImageButton imageButton) {
isPosypka = posypka;
switch (colour){
case 1:
imageButton.setImageResource(R.drawable.icecreamwithposypkavanille);
break;
case 2:
imageButton.setImageResource(R.drawable.icecreamwithposypkachocolate);
break;
case 3:
imageButton.setImageResource(R.drawable.icecreamwithposypkastrawberry);
break;
}
}
public void setAutomat(boolean automat, ImageButton imageButton) {
isAutomat = automat;
imageButton.setImageResource(R.drawable.nothing);
}
public void setIce(boolean ice, ImageButton imageButton) {
isIce = ice;
imageButton.setImageResource(R.drawable.hornoficecreamonstandart);
}
public void paint(int colour,ImageButton imageButton){
switch (colour){
case 1:
imageButton.setImageResource(R.drawable.hornoficecreamonvanille);
break;
case 2:
imageButton.setImageResource(R.drawable.hornoficecreamonchocolate);
break;
case 3:
imageButton.setImageResource(R.drawable.hornoficecreamonstrawberry);
break;
}
isColour = true;
this.colour = colour;
}
public void setImage(ImageButton imageButton, boolean flag){
if(flag){
if(!isIce){
imageButton.setImageResource(R.drawable.hornoficecream);
} else if(!isColour){
imageButton.setImageResource(R.drawable.hornoficecreamonstandart);
} else if(!isAutomat){
switch (colour){
case 1:
imageButton.setImageResource(R.drawable.hornoficecreamonvanille);
break;
case 2:
imageButton.setImageResource(R.drawable.hornoficecreamonchocolate);
break;
case 3:
imageButton.setImageResource(R.drawable.hornoficecreamonstrawberry);
break;
}
} else if(!isPosypka){
switch (colour){
case 1:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkavanille);
break;
case 2:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkachocolate);
break;
case 3:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkastrawberry);
break;
}
} else{
switch (colour){
case 1:
imageButton.setImageResource(R.drawable.icecreamwithposypkavanille);
break;
case 2:
imageButton.setImageResource(R.drawable.icecreamwithposypkachocolate);
break;
case 3:
imageButton.setImageResource(R.drawable.icecreamwithposypkastrawberry);
break;
}
}
}
else {
if (!isIce) {
imageButton.setImageResource(R.drawable.hornoficecreamon);
} else if (!isColour) {
imageButton.setImageResource(R.drawable.hornoficecreamonstandarton);
} else if (!isAutomat) {
switch (colour) {
case 1:
imageButton.setImageResource(R.drawable.hornoficecreamonvanilleon);
break;
case 2:
imageButton.setImageResource(R.drawable.hornoficecreamonchocolateon);
break;
case 3:
imageButton.setImageResource(R.drawable.hornoficecreamonstrawberryon);
break;
}
} else if (!isPosypka) {
switch (colour) {
case 1:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkavanilleon);
break;
case 2:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkachocolateon);
break;
case 3:
imageButton.setImageResource(R.drawable.icecreamwithoutposypkastrawberryon);
break;
}
} else {
switch (colour) {
case 1:
imageButton.setImageResource(R.drawable.icecreamwithposypkavanilleon);
break;
case 2:
imageButton.setImageResource(R.drawable.icecreamwithposypkachocolateon);
break;
case 3:
imageButton.setImageResource(R.drawable.icecreamwithposypkastrawberryon);
break;
}
}
}
}
}
| [
"malenkayaelfiyka@yandex.ru"
] | malenkayaelfiyka@yandex.ru |
66b974a447f454c725eb98ca01f897db110652d3 | ac36b981e539f0f69c59743bd81162167a76ba4b | /src/test/java/info/repy/dynamodb/DynamoDBJsonConvertTest.java | d309da5805a6202d28fd17ea370dc3b3f913014a | [] | no_license | Repy/dynamodb-converter | d76647b1d3856f540bad8e774d6d08be76e641c4 | 71b7980515de3e70e12ab9d3123db3bbb79dcb92 | refs/heads/master | 2020-07-31T19:09:06.612145 | 2019-10-04T00:31:52 | 2019-10-04T00:31:52 | 210,722,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package info.repy.dynamodb;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Test;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import java.io.IOException;
import java.util.Map;
public class DynamoDBJsonConvertTest {
@Test
public void test() throws IOException {
String json = "{\"n\":null,\"s\":\"\",\"a\":\"a\",\"b\":[\"b\",\"b2\"],\"c\":{\"c1\":\"c1\",\"c2\":[\"c21\",\"c22\"]}}";
JsonNode jsonNode = DynamoDBJsonConvert.mapper.readTree(json);
System.out.println(json);
System.out.println(jsonNode.toString());
Map<String, AttributeValue> attributeValueB = DynamoDBJsonConvert.toAttributeMap(jsonNode);
JsonNode jsonNode2 = DynamoDBJsonConvert.toJson(attributeValueB);
System.out.println(jsonNode2.toString());
}
}
| [
"gamecube02+git@gmail.com"
] | gamecube02+git@gmail.com |
6033afb104cc0540753474df3f25ad2d05ea018f | 9c5e72fe0b141ce013b3a4faecfb4d172ae69cd1 | /src/main/java/ru/fitnessmanager/ActiveUser.java | 9c590ab23ef4a9b6110e9539e40fe76d72369f21 | [] | no_license | 1cebear/FitnessManager | d00af88f275029c19db23b1111b67d972cedcde9 | a65184dd468fb0583516bd6dbd50b69ba37fc4fe | refs/heads/master | 2021-05-11T20:36:02.527269 | 2018-02-19T18:41:50 | 2018-02-19T18:41:50 | 117,443,617 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package ru.fitnessmanager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import static java.util.Objects.requireNonNull;
import ru.fitnessmanager.model.User;
public class ActiveUser extends org.springframework.security.core.userdetails.User {
private static final long serialVersionUID = 1L;
private final User user;
public ActiveUser(User user) {
super(user.getEmail(), user.getPassword(), user.isEnabled(), true, true, true, user.getRoles());
this.user = user;
}
public static ActiveUser safeGet() {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth == null) {
return null;
}
Object principal = auth.getPrincipal();
return (principal instanceof ActiveUser) ? (ActiveUser) principal : null;
}
public static ActiveUser get() {
ActiveUser user = safeGet();
requireNonNull(user, "No authorized user found");
return user;
}
public static int id() {
return get().user.getId();
}
public User getUser() {
return user;
}
@Override
public String toString() {
return user.toString();
}
}
| [
"ghost1515@yandex.ru"
] | ghost1515@yandex.ru |
a506470e1770714d0f59cdc5ca0116c4726b5655 | 7971da56d8f6717c3346cbb6756c01cc98ff9cdf | /EDMS3/src/kr/co/exsoft/eframework/util/MailSendUtil.java | de48d8f3a683da6b4db27a029fb83cee856a9061 | [] | no_license | asiojs/finotek | 36793a9b0230ca327f9d758451f7c584c2df91c1 | fd44e392355e03ad718cb247b35cd0f18be52679 | refs/heads/master | 2021-01-21T21:50:38.132873 | 2016-08-03T04:28:44 | 2016-08-03T04:28:44 | 56,277,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,971 | java | package kr.co.exsoft.eframework.util;
import java.util.List;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
import javax.mail.PasswordAuthentication;
import javax.mail.MessagingException;
import kr.co.exsoft.eframework.util.ConfigData;
/**
* 메일발송 클래스
*
* @author 패키지팀
* @since 2014. 9. 30.
* @version 1.0
*
*/
public class MailSendUtil {
/**
*
* <pre>
* 1. 개용 : 대량감사정책 메일발송처리
* 2. 처리내용 : GMAIL RELAY
* </pre>
* @Method Name : sendAuditMail
* @param subject
* @param receiverAddress
* @param messageText
* @throws Exception void
*/
public static void sendAuditMail(String subject,List<String> receiverAddress,String messageText)
throws Exception {
Properties props = new Properties();
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.host", ConfigData.getString("REPORT_MAIL_SERVER_NAME"));
props.put("mail.smtp.port", ConfigData.getString("REPORT_MAIL_SERVER_PORT"));
props.put("mail.smtp.auth", "true");
Session session = Session.getInstance(props,new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(ConfigData.getString("REPORT_MAIL_SENDER_ADDRESS"),ConfigData.getString("REPORT_MAIL_SENDER_PWD"));
}
});
try {
// 수신인 목록 세팅.
InternetAddress _receiverAddress[] = new InternetAddress[receiverAddress.size()];
for (int i = 0; i < receiverAddress.size(); i++) {
_receiverAddress[i] = new InternetAddress(receiverAddress.get(i));
}
// 메시지 세팅.
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(ConfigData.getString("REPORT_MAIL_SENDER_ADDRESS"),ConfigData.getString("REPORT_MAIL_SENDER_NAME")));
message.setRecipients(Message.RecipientType.TO, _receiverAddress);
message.setSubject(MimeUtility.encodeText(subject, "UTF-8", "B"));
message.setContent(messageText.toString(), "text/html; charset=UTF-8");
Transport.send(message);
}catch (MessagingException e) {
throw new RuntimeException(e);
}
}
/**
* <pre>
* 1. 개용 : 내문서 - 작업카트 - URL메일발송 (참조, 숨은참조 추가)
* 2. 처리내용 :
* </pre>
* @Method Name : sendURLMail
* @param subject
* @param receiverAddress
* @param ccAddress
* @param hccAddress
* @param messageText
* @throws Exception void
*/
public static void sendURLMail(String subject,List<String> receiverAddress,List<String> ccAddress,List<String> hccAddress,String messageText)
throws Exception {
Properties props = new Properties();
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.host", ConfigData.getString("REPORT_MAIL_SERVER_NAME"));
props.put("mail.smtp.port", ConfigData.getString("REPORT_MAIL_SERVER_PORT"));
props.put("mail.smtp.auth", "true");
Session session = Session.getInstance(props,new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(ConfigData.getString("REPORT_MAIL_SENDER_ADDRESS"),ConfigData.getString("REPORT_MAIL_SENDER_PWD"));
}
});
try {
// 수신인 목록 세팅.
InternetAddress _receiverAddress[] = new InternetAddress[receiverAddress.size()];
for (int i = 0; i < receiverAddress.size(); i++) {
_receiverAddress[i] = new InternetAddress(receiverAddress.get(i));
}
// 참조 목록 세팅.
InternetAddress _ccAddress[] = new InternetAddress[ccAddress.size()];
for (int i = 0; i < ccAddress.size(); i++) {
_ccAddress[i] = new InternetAddress(ccAddress.get(i));
}
// 숨은참조 목록 세팅.
InternetAddress _hccAddress[] = new InternetAddress[hccAddress.size()];
for (int i = 0; i < hccAddress.size(); i++) {
_hccAddress[i] = new InternetAddress(hccAddress.get(i));
}
// 메시지 세팅.
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(ConfigData.getString("REPORT_MAIL_SENDER_ADDRESS"),ConfigData.getString("REPORT_MAIL_SENDER_NAME")));
message.setRecipients(Message.RecipientType.TO, _receiverAddress);
message.setRecipients(Message.RecipientType.CC, _ccAddress);
message.setRecipients(Message.RecipientType.BCC, _hccAddress);
message.setSubject(MimeUtility.encodeText(subject, "UTF-8", "B"));
message.setContent(messageText.toString(), "text/html; charset=UTF-8");
Transport.send(message);
}catch (MessagingException e) {
throw new RuntimeException(e);
}
}
}
| [
"ellepark@192.168.20.24"
] | ellepark@192.168.20.24 |
77e71d7aeebcd7866c15cfd5eb8df458baee0dc7 | f9335b80a493718f62a879a40440616854f84941 | /rxjava2_android_sample/src/main/java/com/rxjava2/android/samples/ui/operators/FlowableExampleActivity.java | 51c205b74ed1f79275f25f2eb5a830f68543b7d0 | [
"Apache-2.0"
] | permissive | KevenT/RxJava2-Android-Samples | ddd9aa3c4f7d595a8a371a371249b53ea4dc6ce8 | 005b308407e9cccdb563d93d1637a67f31da9747 | refs/heads/master | 2020-05-26T08:41:39.595059 | 2019-05-23T09:26:56 | 2019-05-23T09:26:56 | 188,171,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,383 | java | package com.rxjava2.android.samples.ui.operators;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.rxjava2.android.samples.R;
import com.rxjava2.android.samples.utils.AppConstant;
import android.support.v7.app.AppCompatActivity;
import io.reactivex.Flowable;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.BiFunction;
/**
* Created by amitshekhar on 27/08/16.
*/
public class FlowableExampleActivity extends AppCompatActivity {
private static final String TAG = FlowableExampleActivity.class.getSimpleName();
Button btn;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
btn = findViewById(R.id.btn);
textView = findViewById(R.id.textView);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
doSomeWork();
}
});
}
/*
* simple example using Flowable
*/
private void doSomeWork() {
Flowable<Integer> observable = Flowable.just(1, 2, 3, 4);
observable.reduce(50, new BiFunction<Integer, Integer, Integer>() {
@Override
public Integer apply(Integer t1, Integer t2) {
return t1 + t2;
}
}).subscribe(getObserver());
}
private SingleObserver<Integer> getObserver() {
return new SingleObserver<Integer>() {
@Override
public void onSubscribe(Disposable d) {
Log.d(TAG, " onSubscribe : " + d.isDisposed());
}
@Override
public void onSuccess(Integer value) {
textView.append(" onSuccess : value : " + value);
textView.append(AppConstant.LINE_SEPARATOR);
Log.d(TAG, " onSuccess : value : " + value);
}
@Override
public void onError(Throwable e) {
textView.append(" onError : " + e.getMessage());
textView.append(AppConstant.LINE_SEPARATOR);
Log.d(TAG, " onError : " + e.getMessage());
}
};
}
} | [
"tv2014@126.com"
] | tv2014@126.com |
7b134a94dd4d3d16be574293b5d8283c50aa5a56 | ffc93724532ee421d1ba146412b5f4cd7b64e8e9 | /mockito-2.18.6/src/test/java/org/mockitousage/annotation/MockInjectionUsingConstructorIssue421Test.java | 0e693be455164c449d66269d53961c8c7d65bdd5 | [
"MIT"
] | permissive | abalon1210/Mockito-PITest | 996ef3a5049fded9fdaf108a263abe1cde3b9cc8 | 096791ef7852a0e3509c945d04b0519031a1bf2f | refs/heads/master | 2020-03-19T01:33:58.798818 | 2018-05-31T08:34:05 | 2018-05-31T08:34:05 | 135,554,752 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,121 | java | /*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockitousage.annotation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.main.InjectMocks;
import org.mockito.main.Mock;
import org.mockito.internal.util.MockUtil;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockitousage.examples.use.ArticleCalculator;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(MockitoJUnitRunner.class)
public class MockInjectionUsingConstructorIssue421Test {
@Mock private ArticleCalculator calculator;
@InjectMocks private Issue421 issue421;
@Test
public void mockJustWorks() {
issue421.checkIfMockIsInjected();
}
static class Issue421 {
private ArticleCalculator calculator;
public Issue421(int a) {
}
public Issue421(ArticleCalculator calculator) {
this.calculator = calculator;
}
public void checkIfMockIsInjected(){
assertThat(MockUtil.isMock(calculator)).isTrue();
}
}
}
| [
"abalon1210@daum.net"
] | abalon1210@daum.net |
5e1d2dd5307be2155c60a1066a6ba3024e20ed86 | 84000834bb94b433ad7e3c9f3be9188bf304f1e1 | /dma-network-client/src/main/java/dk/dma/navnet/client/connection/ClientConnection.java | 24a216d0e4a6b54db94cbd11561c15ce0bfe4a85 | [] | no_license | dma-graveyard/eNav-network | 5f9ce587fea4e814b6096d4205b2111d7b24ea21 | 1a1d3d85fcc635b53f7d9bacd4bb70a410d4f112 | refs/heads/master | 2021-01-01T17:10:18.616574 | 2014-03-25T15:54:31 | 2014-03-25T15:54:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,280 | java | /* Copyright (c) 2011 Danish Maritime Authority
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
package dk.dma.navnet.client.connection;
import java.util.concurrent.locks.ReentrantLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import dk.dma.enav.maritimecloud.ClosingCode;
import dk.dma.navnet.messages.ConnectionMessage;
/**
*
* @author Kasper Nielsen
*/
public class ClientConnection {
/** The logger. */
static final Logger LOG = LoggerFactory.getLogger(ClientConnection.class);
private volatile ClientConnectFuture connectingFuture;
volatile String connectionId;
final ConnectionManager connectionManager;
private volatile ClientDisconnectFuture disconnectingFuture;
final ReentrantLock retrieveLock = new ReentrantLock();
final ReentrantLock sendLock = new ReentrantLock();
/* State managed objects */
volatile ClientTransport transport;
final Worker worker = new Worker(this);
private ClientConnection(ConnectionManager connectionManager) {
this.connectionManager = connectionManager;
}
void connect() {
connectionManager.lock.lock();
try {
if (transport == null && connectingFuture == null) {
LOG.info("Trying to connect");
connectingFuture = new ClientConnectFuture(this, -1);
Thread t = new Thread(connectingFuture);
t.setDaemon(true);
t.start();
}
} finally {
connectionManager.lock.unlock();
}
}
/**
* Invoked when we have successfully connected to the server.
*
* @param transport
*/
void connected(ClientConnectFuture future, ClientTransport transport) {
connectionManager.lock.lock();
try {
if (future == connectingFuture) {
this.connectingFuture = null;
this.transport = transport;
connectionManager.stateChange.signalAll();
}
} finally {
connectionManager.lock.unlock();
}
}
static ClientConnection create(ConnectionManager cm) {
ClientConnection cc = new ClientConnection(cm);
new Thread(cc.worker).start();
return cc;
}
void disconnect() {
connectionManager.lock.lock();
try {
if (transport != null) {
LOG.info("Trying to disconnect");
disconnectingFuture = new ClientDisconnectFuture(this, transport);
Thread t = new Thread(disconnectingFuture);
t.setDaemon(true);
t.start();
} else if (connectingFuture != null) {
LOG.info("Trying to disconnect");
// We are in the process of connecting, just cancel the connect
connectingFuture.cancelConnectUnderLock();
}
connectionManager.stateChange.signalAll();
} finally {
connectionManager.lock.unlock();
}
}
void disconnected(ClientDisconnectFuture future) {
connectionManager.lock.lock();
try {
if (future == disconnectingFuture && connectingFuture == null && transport == null) {
this.disconnectingFuture = null;
}
} finally {
connectionManager.lock.unlock();
}
}
/**
* @return the transport
*/
public ClientTransport getTransport() {
return transport;
}
public boolean isConnected() {
connectionManager.lock.lock();
try {
return transport != null && disconnectingFuture == null;
} finally {
connectionManager.lock.unlock();
}
}
void messageReceive(ClientTransport transport, ConnectionMessage m) {
retrieveLock.lock();
try {
worker.messageReceived(m);
} finally {
retrieveLock.unlock();
}
}
public ConnectionMessageBus getBus() {
return connectionManager.hub;
}
/**
* Invoked whenever we want to send a message
*
* @param message
* the message to send
*/
OutstandingMessage messageSend(ConnectionMessage message) {
return worker.messageSend(message);
//
// sendLock.lock();
// try {
//
// OutstandingMessage m = rq.write(message);
// if (transport != null) {
// System.out.println("Sending " + m.msg);
// transport.sendText(m.msg);
// } else {
// System.out.println("Not sending " + m.msg);
// }
//
// return m;
// } finally {
// sendLock.unlock();
// }
}
void transportDisconnected(ClientTransport transport, ClosingCode cr) {
connectionManager.lock.lock();
try {
this.transport = null;
if (cr.getId() == 1000) {
connectionManager.connection = null;
worker.shutdown();
} else if (cr.getId() == ClosingCode.DUPLICATE_CONNECT.getId()) {
System.out.println("Dublicate connect detected, will not reconnect");
connectionManager.state = ConnectionManager.State.SHOULD_STAY_DISCONNECTED;
} else {
System.out.println(cr.getMessage());
System.out.println("OOPS, lets reconnect");
connectingFuture = null;// need to clear it if we are already connecting
}
connectionManager.stateChange.signalAll();
} finally {
connectionManager.lock.unlock();
}
}
}
| [
"kasperni@gmail.com"
] | kasperni@gmail.com |
feddc2ca28eb972f772a567dc8d4eaac67e320a9 | e1673667bed4ccc8d4ab92e2d42898799405907d | /jplat-user/src/test/java/com/jwell/JplatUserApplicationTests.java | 47a10b08b170108e6bb4cedb75f112a8167aa556 | [] | no_license | lbyjwwyqt147/spring-cloud-zipkin-demo | aa247f749846399a3c347c8aa6f5564677bc2d42 | 45771c64718a51f3caa92919aab2183b1307d757 | refs/heads/master | 2020-03-18T11:51:59.256391 | 2018-05-25T09:21:39 | 2018-05-25T09:21:39 | 134,695,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package com.jwell;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class JplatUserApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"lbyjwwyqt147@163.com"
] | lbyjwwyqt147@163.com |
dc7528003e8e89a71e474418c661668159f3f5bb | c6d17d235fe26c9ce861794ac2192f2488c0fd80 | /src/de/openhpi/capstone1/game/exceptions/OutOfDisplayException.java | ffc9c29d6f28ca5bd30f3671d676f15e83cc070a | [] | no_license | RaphaelKunis/openhpi_capstone1_TheProject | b907a3e4156483c5ad43d6fc63b29052105efb55 | 50a19f5ce7bd19637dab35b413fd2777f5a298aa | refs/heads/master | 2020-03-28T21:49:29.373107 | 2018-09-25T20:52:01 | 2018-09-25T20:52:01 | 149,185,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package de.openhpi.capstone1.game.exceptions;
public class OutOfDisplayException extends Exception {
/**
* UID
*/
private static final long serialVersionUID = -476269679752153851L;
@Override
public String getMessage() {
return "Ball went out of display";
}
}
| [
"krap81@gmail.com"
] | krap81@gmail.com |
cda6d8d94735e549bb27eaf4998403925fb233e8 | 3aa70b532528cd868f97cbd8b1cb2cc20f52cdbd | /app/src/main/java/com/goodreads/api/v1/Event.java | a29f547e77f9dddc8799c30e5ff74bafbb9365db | [] | no_license | alfredsamy/BestRead | b1ea5a0e5e15f127ce946153c7219675c52aeb74 | c7a2952b9e33e831e07e77ccdebb0d8a0bc49966 | refs/heads/master | 2021-06-10T13:15:50.084311 | 2016-12-21T02:59:58 | 2016-12-21T02:59:58 | 75,544,500 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,086 | java | //===============================================================================
// Copyright (c) 2010 Adam C Jones
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//===============================================================================
package com.goodreads.api.v1;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import android.sax.Element;
import android.sax.EndElementListener;
import android.sax.EndTextElementListener;
public class Event implements Serializable
{
private static final long serialVersionUID = 0L;
private String mAccess;
private String mAddress;
private boolean mCanInvite;
private String mCity;
private String mCountryCode;
private String mCreatedAt;
private String mEventAt;
private int mEventAttendingCount;
private int mEventResponseCount;
private String mEventType;
private String mId;
private String mPostalCode;
private int mPublicFlag;
private String mReminderAt;
private int mResourceId;
private String mResourceType;
private String mSource;
private String mSourceUrl;
private String mStateCode;
private String mTitle;
private String mUpdatedAt;
private String mUserId;
private String mVenue;
private String mImageUrl;
private String mLink;
private String mDescription;
public void clear()
{
this.setAccess("");
this.setAddress("");
this.setCanInvite(false);
this.setCity("");
this.setCountryCode("");
this.setCreatedAt("");
this.setEventAt("");
this.setEventAttendingCount(0);
this.setEventResponseCount(0);
this.setEventType("");
this.setId("");
this.setPostalCode("");
this.setPublicFlag(0);
this.setReminderAt("");
this.setResourceId(0);
this.setResourceType("");
this.setSource("");
this.setSourceUrl("");
this.setStateCode("");
this.setTitle("");
this.setUpdatedAt("");
this.setUserId("");
this.setVenue("");
this.setImageUrl("");
this.setLink("");
this.setDescription("");
}
public Event copy()
{
Event eventCopy = new Event();
eventCopy.setAccess(this.getAccess());
eventCopy.setAddress(this.getAddress());
eventCopy.setCanInvite(this.getCanInvite());
eventCopy.setCity(this.getCity());
eventCopy.setCountryCode(this.getCountryCode());
eventCopy.setCreatedAt(this.getCreatedAt());
eventCopy.setEventAt(this.getEventAt());
eventCopy.setEventAttendingCount(this.getEventAttendingCount());
eventCopy.setEventResponseCount(this.getEventResponseCount());
eventCopy.setEventType(this.getEventType());
eventCopy.setId(this.getId());
eventCopy.setPostalCode(this.getPostalCode());
eventCopy.setPublicFlag(this.getPublicFlag());
eventCopy.setReminderAt(this.getReminderAt());
eventCopy.setResourceId(this.getResourceId());
eventCopy.setResourceType(this.getResourceType());
eventCopy.setSource(this.getSource());
eventCopy.setSourceUrl(this.getSourceUrl());
eventCopy.setStateCode(this.getStateCode());
eventCopy.setTitle(this.getTitle());
eventCopy.setUpdatedAt(this.getUpdatedAt());
eventCopy.setUserId(this.getUserId());
eventCopy.setVenue(this.getVenue());
eventCopy.setImageUrl(this.getImageUrl());
eventCopy.setLink(this.getLink());
eventCopy.setDescription(this.getDescription());
return eventCopy;
}
public static Event appendListener(Element parentElement, int depth)
{
final Event event = new Event();
final Element eventElement = parentElement.getChild("event");
appendCommonListeners(eventElement, event, depth);
return event;
}
public static List<Event> appendArrayListener(Element parentElement, int depth)
{
final List<Event> events = new ArrayList<Event>();
final Element eventsElement = parentElement.getChild("events");
final Event event = new Event();
final Element eventElement = eventsElement.getChild("event");
eventElement.setEndElementListener(new EndElementListener()
{
@Override
public void end()
{
events.add(event.copy());
event.clear();
}
});
appendCommonListeners(eventElement, event, depth);
return events;
}
private static void appendCommonListeners(final Element eventElement, final Event event, int depth)
{
eventElement.getChild("access").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setAccess(body);
}
});
eventElement.getChild("address").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setAddress(body);
}
});
eventElement.getChild("can_invite_flag").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
boolean parsedBoolean = false;
try
{
parsedBoolean = Boolean.parseBoolean(body);
}
catch (Exception e){}
event.setCanInvite(parsedBoolean);
}
});
eventElement.getChild("city").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setCity(body);
}
});
eventElement.getChild("country_code").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setCountryCode(body);
}
});
eventElement.getChild("created_at").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setCreatedAt(body);
}
});
eventElement.getChild("event_at").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setEventAt(body);
}
});
eventElement.getChild("event_attending_count").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
int count = 0;
try
{
count = Integer.parseInt(body);
}
catch (Exception e) {}
event.setEventAttendingCount(count);
}
});
eventElement.getChild("event_responses_count").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
int count = 0;
try
{
count = Integer.parseInt(body);
}
catch (Exception e) {}
event.setEventResponseCount(count);
}
});
eventElement.getChild("event_type").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setEventType(body);
}
});
eventElement.getChild("id").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setId(body);
}
});
eventElement.getChild("postal_code").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setPostalCode(body);
}
});
eventElement.getChild("public_flag").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
int count = 0;
try
{
count = Integer.parseInt(body);
}
catch (Exception e) {}
event.setPublicFlag(count);
}
});
eventElement.getChild("reminder_at").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setReminderAt(body);
}
});
eventElement.getChild("resource_id").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
int count = 0;
try
{
count = Integer.parseInt(body);
}
catch (Exception e) {}
event.setResourceId(count);
}
});
eventElement.getChild("resource_type").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setResourceType(body);
}
});
eventElement.getChild("source").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setSource(body);
}
});
eventElement.getChild("source_url").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setSourceUrl(body);
}
});
eventElement.getChild("state_code").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setStateCode(body);
}
});
eventElement.getChild("title").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setTitle(body);
}
});
eventElement.getChild("updated_at").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setUpdatedAt(body);
}
});
eventElement.getChild("user_id").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setUserId(body);
}
});
eventElement.getChild("venue").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setVenue(body);
}
});
eventElement.getChild("image_url").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setImageUrl(body);
}
});
eventElement.getChild("link").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setLink(body);
}
});
eventElement.getChild("description").setEndTextElementListener(new EndTextElementListener()
{
@Override
public void end(String body)
{
event.setDescription(body);
}
});
}
public String getAccess()
{
return mAccess;
}
public void setAccess(String access)
{
mAccess = access;
}
public String getAddress()
{
return mAddress;
}
public void setAddress(String address)
{
mAddress = address;
}
public boolean getCanInvite()
{
return mCanInvite;
}
public void setCanInvite(boolean canInvite)
{
mCanInvite = canInvite;
}
public String getCity()
{
return mCity;
}
public void setCity(String city)
{
mCity = city;
}
public String getCountryCode()
{
return mCountryCode;
}
public void setCountryCode(String countryCode)
{
mCountryCode = countryCode;
}
public String getCreatedAt()
{
return mCreatedAt;
}
public void setCreatedAt(String createdAt)
{
mCreatedAt = createdAt;
}
public String getEventAt()
{
return mEventAt;
}
public void setEventAt(String eventAt)
{
mEventAt = eventAt;
}
public int getEventAttendingCount()
{
return mEventAttendingCount;
}
public void setEventAttendingCount(int eventAttendingCount)
{
mEventAttendingCount = eventAttendingCount;
}
public int getEventResponseCount()
{
return mEventResponseCount;
}
public void setEventResponseCount(int eventResponseCount)
{
mEventResponseCount = eventResponseCount;
}
public String getId()
{
return mId;
}
public void setId(String id)
{
mId = id;
}
public String getPostalCode()
{
return mPostalCode;
}
public void setPostalCode(String postalCode)
{
mPostalCode = postalCode;
}
public int getPublicFlag()
{
return mPublicFlag;
}
public void setPublicFlag(int publicFlag)
{
mPublicFlag = publicFlag;
}
public String getReminderAt()
{
return mReminderAt;
}
public void setReminderAt(String reminderAt)
{
mReminderAt = reminderAt;
}
public int getResourceId()
{
return mResourceId;
}
public void setResourceId(int resourceId)
{
mResourceId = resourceId;
}
public String getResourceType()
{
return mResourceType;
}
public void setResourceType(String resourceType)
{
mResourceType = resourceType;
}
public String getSource()
{
return mSource;
}
public void setSource(String source)
{
mSource = source;
}
public String getSourceUrl()
{
return mSourceUrl;
}
public void setSourceUrl(String sourceUrl)
{
mSourceUrl = sourceUrl;
}
public String getStateCode()
{
return mStateCode;
}
public void setStateCode(String stateCode)
{
mStateCode = stateCode;
}
public String getTitle()
{
return mTitle;
}
public void setTitle(String title)
{
mTitle = title;
}
public String getUpdatedAt()
{
return mUpdatedAt;
}
public void setUpdatedAt(String updatedAt)
{
mUpdatedAt = updatedAt;
}
public String getUserId()
{
return mUserId;
}
public void setUserId(String userId)
{
mUserId = userId;
}
public String getVenue()
{
return mVenue;
}
public void setVenue(String venue)
{
mVenue = venue;
}
public String getImageUrl()
{
return mImageUrl;
}
public void setImageUrl(String imageUrl)
{
mImageUrl = imageUrl;
}
public String getLink()
{
return mLink;
}
public void setLink(String link)
{
mLink = link;
}
public String getDescription()
{
return mDescription;
}
public void setDescription(String description)
{
mDescription = description;
}
public String getEventType()
{
return mEventType;
}
public void setEventType(String eventType)
{
mEventType = eventType;
}
}
| [
"Alfred Samy"
] | Alfred Samy |
bcabdf8ba2d5180f7e2ada5301cbac3dc2744b09 | 9909045fe8b2dac379dcf49f793c99b732f627cc | /src/main/java/nl/rutgerkok/bo3tools/util/PlayerDataCache.java | 5b358516896397fbbf3ec4f0495fdb3ba32b6e54 | [
"BSD-3-Clause",
"MIT"
] | permissive | rutgerkok/BO3Tools | e6461efe95ad906ca5d49610c5ebaa9b556504d6 | 9839914e2909586396e34fee83b913042a90e5da | refs/heads/master | 2021-01-17T13:30:40.906183 | 2018-11-17T10:29:28 | 2018-11-17T10:29:28 | 7,720,818 | 2 | 9 | MIT | 2018-11-17T10:29:29 | 2013-01-20T19:40:50 | Java | UTF-8 | Java | false | false | 4,389 | java | package nl.rutgerkok.bo3tools.util;
import java.util.Calendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
/**
* Represents a cache of Player data that keeps data in memory for at least the
* given number of miliseconds.
* <p>
* Every time the {@link #hearthBeat()} is called, all old data is removed. You
* have to call that method, otherwise old data <strong>will not be
* removed</strong>. The data is only kept in memory. never saved to disk. Data
* of offline players will be pruned automatically.
* <p>
* Implementation detail: the player instances aren't referenced here, instead
* their names are used.
*
* @param <T>
* The type of data to store.
*/
public class PlayerDataCache<T> {
private static class DataEntry {
private final Object data;
private final long date;
private DataEntry(Object data) {
date = Calendar.getInstance().getTimeInMillis();
this.data = data;
}
}
private final Map<String, DataEntry> data;
private final long timeToLive;
/**
* Constructs a new cache.
*
* @param timeToLive
* The time to live for the data, in milliseconds. Setting this
* to 0 or a negative value will cause the data to be removed
* only when the player logs off.
*/
public PlayerDataCache(long timeToLive) {
data = new HashMap<String, DataEntry>();
this.timeToLive = timeToLive;
}
/**
* Gets a value for that player. Returns null if the value is not found.
* Expired data will never be returned, even if {@link #hearthBeat()} hasn't
* been called yet.
*
* @param player
* The player to look up.
* @return The data, or null if not found.
*/
@SuppressWarnings("unchecked")
// Safe, because this is the only class that modifies it.
public T get(Player player) {
DataEntry dataEntry = data.get(player.getName());
if (dataEntry == null) {
return null;
}
if (timeToLive <= 0 || Calendar.getInstance().getTimeInMillis() - dataEntry.date <= timeToLive) {
return (T) dataEntry.data;
} else {
// Outdated data that was not yet pruned
data.remove(player.getName());
}
return null;
}
/**
* Gets a value for that player. Returns null if the value is not found.
* Expired data will never be returned, even if {@link #hearthBeat()} hasn't
* been called yet. The value for the player will immediately be removed
* from the cache.
*
* @param player
* The player get the value of.
* @return The value, or null if not found.
*/
public T getAndRemove(Player player) {
T value = get(player);
remove(player);
return value;
}
/**
* Cleans up old data. You need to call this every now and then.
*/
public void hearthBeat() {
// Make a set of all online player names
Set<String> playerNames = new HashSet<String>();
for (Player player : Bukkit.getOnlinePlayers()) {
playerNames.add(player.getName());
}
long currentTime = Calendar.getInstance().getTimeInMillis();
for (Iterator<Entry<String, DataEntry>> it = data.entrySet().iterator(); it.hasNext();) {
Entry<String, DataEntry> entry = it.next();
if (timeToLive > 0 && currentTime - entry.getValue().date > timeToLive) {
it.remove();
} else if (!playerNames.contains(entry.getKey())) {
it.remove();
}
}
}
/**
* Removes the value for that player. If the player had nothing stored, this
* won't do anything.
*
* @param player
* The player.
*/
public void remove(Player player) {
data.remove(player.getName());
}
/**
* Sets a new value for that player.
*
* @param player
* The player.
* @param value
* The value.
*/
public void set(Player player, T value) {
data.put(player.getName(), new DataEntry(value));
}
}
| [
"rutger.kok@live.com"
] | rutger.kok@live.com |
02a45d3d2d58ec659c46b75689da655cc68b81cc | 01a314ea79ae516e3bee967f76c9950217a58551 | /crittercaptors/src/com/blastedstudios/crittercaptors/creature/StatusEffectEnum.java | 5f538a816f0d57fd7d7b76ac01cfe4d2c891378c | [
"Beerware"
] | permissive | narfman0/CritterCaptors | c5c8ddd2a818427f84b6ec1e654d309915c9f813 | f62ccd19fce103593b4e5d89aeed7b775456773e | refs/heads/master | 2016-09-05T20:28:50.218725 | 2012-04-28T01:25:40 | 2012-04-28T01:25:40 | 3,236,787 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.blastedstudios.crittercaptors.creature;
public enum StatusEffectEnum {
None, Burn, Freeze, Paralyze, Poison, Sleep, Confusion/*, Attraction, Flinch, Trapping*/
}
| [
"narfman0@yahoo.com"
] | narfman0@yahoo.com |
844fe3dbbcc0f3d2299bbf37fe8a01be64135e25 | 5b487427e314cd8ffe3bca3e2a0c9177a156b4f3 | /src/main/java/com/mwb/web/framework/mybatis/BasePackageRetrievableMapperScannerConfigurer.java | 3d05a695fe80ae5695369e98d70be7d13494d29d | [] | no_license | mwbGit/mwb-web-framework | 7e6a59c04754998cec0943078ec59cb036555bd7 | 652e1365751e567cc7c76faf5d2fd2aafa24b3e8 | refs/heads/master | 2021-01-11T20:55:20.314237 | 2017-03-23T10:54:13 | 2017-03-23T10:54:13 | 79,213,070 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.mwb.web.framework.mybatis;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import java.util.Properties;
public class BasePackageRetrievableMapperScannerConfigurer extends MapperScannerConfigurer {
private static final String BASE_PACKAGE = "mybatis.mapper.base.package";
private String basePackage;
public String getBasePackage() {
return basePackage;
}
public void setConfig(Properties properties) {
basePackage = properties.getProperty(BASE_PACKAGE);
super.setBasePackage(basePackage);
}
}
| [
"mengweibo@shbj.com"
] | mengweibo@shbj.com |
8ab8d11953e3c92c39e91b5b7bd92b52b2f79b48 | 70bb0620d2b5432888848cc50f7d415c692e0b9c | /diplomska-jpeg-encoder-new/src/test/java/org/diplomska/jpeg/huffman/JpegHuffmanEncoderWithDefaultTablesTest.java | 2322f8f876fca7f7d7b0d6f2ce5fa300cf64235c | [] | no_license | ales-kunst/diplomska-steganography | 21a2dd45d7c39a5510c76655387530e4aaf13102 | 2cb2db43bd09922021f56d00742edc17ebab5610 | refs/heads/master | 2021-06-13T16:59:34.511197 | 2021-06-08T05:14:45 | 2021-06-08T05:14:45 | 192,041,109 | 2 | 0 | null | 2021-06-08T06:18:47 | 2019-06-15T05:35:57 | Java | UTF-8 | Java | false | false | 8,751 | java | package org.diplomska.jpeg.huffman;
import org.diplomska.jpeg.huffman.HuffmanOutputStructure;
import org.diplomska.jpeg.huffman.JpegHuffmanEncoderWithDefaultTables;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
//~--- classes ----------------------------------------------------------------
/**
* Class description
*
*
* @version Enter version here..., 15/07/23
* @author Enter your name here...
*/
public class JpegHuffmanEncoderWithDefaultTablesTest {
/**
* Method description
*
*
* @throws Exception
*/
@Before
public void setUp() throws Exception {}
//~--- methods -------------------------------------------------------------
/**
* Method description
*
*
* @throws Exception
*/
@After
public void tearDown() throws Exception {}
/**
* Method description
*
*/
@Test
public void testEncode() {
JpegHuffmanEncoderWithDefaultTables jpegHuffencoder = new JpegHuffmanEncoderWithDefaultTables();
HuffmanOutputStructure huffmanOutputStructure =
jpegHuffencoder.encode(getZigZagBitsArrayOfTestBlackWhitePngImage());
Assert.assertEquals(48, huffmanOutputStructure.getHuffmanEncodedBitsArray().length);
}
/**
* Method description
*
*/
@Test
public void testInitializeHuffmanElementsCollections() {
JpegHuffmanEncoderWithDefaultTables jpegHuffencoder = new JpegHuffmanEncoderWithDefaultTables();
jpegHuffencoder.initializeHuffmanElementsCollections();
checkLumaDcHuffmanElements(jpegHuffencoder);
checkLumaAcHuffmanElements(jpegHuffencoder);
// checkChromaDcHuffmanElements(jpegHuffencoder);
checkChromaAcHuffmanElements(jpegHuffencoder);
}
/**
* Method description
*
*
*
* @param aJpegHuffencoder
*/
private void checkChromaAcHuffmanElements(JpegHuffmanEncoderWithDefaultTables aJpegHuffencoder) {
List<HuffmanElement> chromaAcElements = aJpegHuffencoder.getChromaAcHuffmanElements();
int index = 0;
for (short huffmanElementValue : getRefChromaAcHuffmanTableValues()) {
byte refByteHuffmanElementValue = (byte) huffmanElementValue;
byte actByteHuffmanElementValue = chromaAcElements.get(index).getValue();
Assert.assertEquals(refByteHuffmanElementValue, actByteHuffmanElementValue);
index++;
}
}
/**
* Method description
*
*
* @param aJpegHuffencoder
*/
private void checkLumaAcHuffmanElements(JpegHuffmanEncoderWithDefaultTables aJpegHuffencoder) {
List<HuffmanElement> lumaAcElements = aJpegHuffencoder.getLumaAcHuffmanElements();
int index = 0;
for (short huffmanElementValue : getRefLumaAcHuffmanTableValues()) {
byte refByteHuffmanElementValue = (byte) huffmanElementValue;
byte actByteHuffmanElementValue = lumaAcElements.get(index).getValue();
Assert.assertEquals(refByteHuffmanElementValue, actByteHuffmanElementValue);
index++;
}
}
/**
* Method description
*
*
*
* @param aJpegHuffencoder
*/
private void checkLumaDcHuffmanElements(JpegHuffmanEncoderWithDefaultTables aJpegHuffencoder) {
List<HuffmanElement> lumaDcElements = aJpegHuffencoder.getLumaDcHuffmanElements();
int index = 0;
for (short huffmanElementValue : getRefLumaDcHuffmanTableValues()) {
byte refByteHuffmanElementValue = (byte) huffmanElementValue;
byte actByteHuffmanElementValue = lumaDcElements.get(index).getValue();
Assert.assertEquals(refByteHuffmanElementValue, actByteHuffmanElementValue);
index++;
}
}
//~--- get methods ---------------------------------------------------------
/**
* Method description
*
*
* @return
*/
private short[] getRefChromaAcHuffmanTableValues() {
return new short[] { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61,
0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, 0xA1, 0xB1, 0xC1, 0x09, 0x23, 0x33,
0x52, 0xF0, 0x15, 0x62, 0x72, 0xD1, 0x0A, 0x16, 0x24, 0x34, 0xE1, 0x25, 0xF1, 0x17, 0x18,
0x19, 0x1A, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44,
0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63,
0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A,
0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
0x98, 0x99, 0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4,
0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA,
0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
0xE8, 0xE9, 0xEA, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA };
}
/**
* Method description
*
*
* @return
*/
private short[] getRefLumaAcHuffmanTableValues() {
return new short[] { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61,
0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xA1, 0x08, 0x23, 0x42, 0xB1, 0xC1, 0x15, 0x52,
0xD1, 0xF0, 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0A, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x25,
0x26, 0x27, 0x28, 0x29, 0x2A, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49, 0x4A, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x63, 0x64,
0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x83,
0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
0x9A, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6,
0xB7, 0xB8, 0xB9, 0xBA, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xD2, 0xD3,
0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8,
0xE9, 0xEA, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA };
}
/**
* Method description
*
*
* @return
*/
private short[] getRefLumaDcHuffmanTableValues() {
return new short[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B };
}
/**
* Method description
*
*
* @return
*/
private byte[] getZigZagBitsArrayOfTestBlackWhitePngImage() {
ByteArrayOutputStream returnByteArrayOutStream = new ByteArrayOutputStream();
// byte[] eobArray = { 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] yLumaZigZagBits_0_0 = { 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] cbChromaZigZagBits_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] crChromaZigZagBits_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] yLumaZigZagBits_0_1 = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] cbChromaZigZagBits_0_1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] crChromaZigZagBits_0_1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
try {
// eob after is not needed because the whole array has only 0
returnByteArrayOutStream.write(yLumaZigZagBits_0_0);
returnByteArrayOutStream.write(cbChromaZigZagBits_0_0);
returnByteArrayOutStream.write(crChromaZigZagBits_0_0);
returnByteArrayOutStream.write(yLumaZigZagBits_0_1);
returnByteArrayOutStream.write(cbChromaZigZagBits_0_1);
returnByteArrayOutStream.write(crChromaZigZagBits_0_1);
} catch (IOException e) {
Assert.assertTrue(false);
}
// return
return returnByteArrayOutStream.toByteArray();
}
}
| [
"ales.kunst@gmail.com"
] | ales.kunst@gmail.com |
eb88a028806a31f4fa24b393179f526e103cf86b | 7926a1c4fb7ae6e0ae44bd1d1382f22eca30a360 | /src/main/java/org/richardinnocent/feefo/api/v10/reviews/reviews/shared/dto/ProductThreadEntry.java | 754c7d725ab704560d7f1c3e277cbc7f9a60031d | [] | no_license | RichardInnocent/feefo-client-java | 4ee583ca3d7db5e28c92432385f24a9e8b854dfd | d7c1e3c452b9a2a621f9a5c6d65b50d2c1258448 | refs/heads/master | 2023-03-28T15:19:45.694562 | 2021-04-01T08:05:26 | 2021-04-01T08:05:26 | 353,490,643 | 0 | 0 | null | 2021-04-01T08:05:27 | 2021-03-31T21:07:34 | Java | UTF-8 | Java | false | false | 1,415 | java | package org.richardinnocent.feefo.api.v10.reviews.reviews.shared.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Contains an audit history for some product feedback, including changes to the review and the
* conversation between the consumer and merchant.
*/
public class ProductThreadEntry extends ThreadEntry {
@JsonProperty("attributes")
private final List<ReRatedProductAttribute> reRatedProductAttributes = new ArrayList<>();
public List<ReRatedProductAttribute> getReRatedProductAttributes() {
return new ArrayList<>(reRatedProductAttributes);
}
public void setReRatedProductAttributes(List<ReRatedProductAttribute> reRatedProductAttributes) {
this.reRatedProductAttributes.clear();
if (reRatedProductAttributes != null) {
this.reRatedProductAttributes.addAll(reRatedProductAttributes);
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
ProductThreadEntry that = (ProductThreadEntry) o;
return Objects.equals(reRatedProductAttributes, that.reRatedProductAttributes);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), reRatedProductAttributes);
}
}
| [
"richardinnocent@sky.com"
] | richardinnocent@sky.com |
199892db38511460dc2b7563dd4ed321f339c330 | 87040048f6ecde5b87ef6a8582b804ceefdedf1f | /astar/ArrayHeapMinPQ.java | 3281632a446b05f79d9da38ed4f20aa12e4910de | [] | no_license | changer666666/CSE373-Data-Structure-Algrithom | 122178c5789860763fb2aee44a16f72ac8eeec98 | 6341afc2db0ea48b9d5d5d6540f4ea864dc60206 | refs/heads/master | 2020-09-09T09:12:06.390688 | 2019-11-13T09:20:55 | 2019-11-13T09:20:55 | 221,408,816 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,914 | java | package astar;
import heap.ExtrinsicMinPQ;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
public class ArrayHeapMinPQ<T> implements ExtrinsicMinPQ<T> {
private PriorityNode[] priorityNode;
private Map<T, Integer> map;
private int BORDER = 10;
private int SIZE = 0;
public ArrayHeapMinPQ() {
priorityNode = makeArray(BORDER);
map = new HashMap<>();
}
/*
Here's a helper method and a method stub that may be useful. Feel free to change or remove
them, if you wish.
*/
/**
* A helper method to create arrays of T, in case you're using an array to represent your heap.
* You shouldn't need this if you're using an ArrayList instead.
*/
@SuppressWarnings("unchecked")
private PriorityNode[] makeArray(int newCapacity) {
return new ArrayHeapMinPQ.PriorityNode[newCapacity];
}
/**
* A helper method for swapping the items at two indices of the array heap.
*/
private void swap(int a, int b) {
map.put(priorityNode[a].item, b);
map.put(priorityNode[b].item, a);
PriorityNode temp = priorityNode[a];
priorityNode[a] = priorityNode[b];
priorityNode[b] = temp;
}
/**
* Adds an item with the given priority value.
* Assumes that item is never null.
* Runs in O(log N) time (except when resizing).
*
* @throws IllegalArgumentException if item is already present in the PQ
*/
@Override
public void add(T item, double priority) {
if (item == null) {
throw new IllegalArgumentException("Item is null!");
}
if (this.size() != 0) {
if (this.contains(item)) {
throw new IllegalArgumentException("Item is already present in the PQ!");
}
}
if (this.size() >= BORDER - 1) {
resize(2 * BORDER);
}
PriorityNode p = new PriorityNode(item, priority);
int index = this.size() + 1;
priorityNode[index] = p;
map.put(item, index);
while (index > 1 && (priorityNode[index].compareTo(priorityNode[this.getParent(index)]) < 0)) {
swap(this.getParent(index), index);
index = this.getParent(index);
}
SIZE++;
}
private void resize(int arrLength) {
PriorityNode[] newArr = makeArray(arrLength + 1);
for (int i = 1; i <= this.size(); i++) {
newArr[i] = priorityNode[i];
}
priorityNode = newArr;
BORDER = arrLength;
}
/**
* Returns true if the PQ contains the given item; false otherwise.
* Runs in O(log N) time.
*/
@Override
public boolean contains(T item) {
return (map.containsKey(item));
}
/**
* Returns the item with the smallest priority.
* Runs in O(log N) time.
*
* @throws NoSuchElementException if the PQ is empty
*/
@Override
public T getSmallest() {
if (this.isEmpty()) {
throw new NoSuchElementException("PQ is empty!");
}
return priorityNode[1].getItem();
}
/**
* Removes and returns the item with the smallest priority.
* Runs in O(log N) time (except when resizing).
*
* @throws NoSuchElementException if the PQ is empty
*/
@Override
public T removeSmallest() {
if (this.isEmpty()) {
throw new NoSuchElementException("PQ is empty!");
}
//remove
PriorityNode removeNode = priorityNode[1];
priorityNode[1] = priorityNode[this.size()];
priorityNode[this.size()] = null;
SIZE--;
map.remove(removeNode.item);
//sink
int index = 1;
while (index < this.size()) {
if (this.size() < this.getLeftChild(index)) {
break;
}
if (priorityNode[this.getLeftChild(index)].compareTo(priorityNode[this.getRightChild(index)]) < 0) {
if (priorityNode[index].compareTo(priorityNode[this.getLeftChild(index)]) > 0) {
swap(index, this.getLeftChild(index));
index = this.getLeftChild(index);
continue;
}
if (priorityNode[index].compareTo(priorityNode[this.getRightChild(index)]) > 0) {
swap(index, this.getRightChild(index));
index = this.getRightChild(index);
continue;
}
break;
} else {
if (priorityNode[index].compareTo(priorityNode[this.getRightChild(index)]) > 0) {
swap(index, this.getRightChild(index));
index = this.getRightChild(index);
continue;
}
if (priorityNode[index].compareTo(priorityNode[this.getLeftChild(index)]) > 0) {
swap(index, this.getLeftChild(index));
index = this.getLeftChild(index);
continue;
}
break;
}
}
//resize
if (this.size() <= BORDER / 4 + 1) {
resize(BORDER / 4 + 1);
}
return removeNode.getItem();
}
/**
* Changes the priority of the given item.
* Runs in O(log N) time.
*
* @throws NoSuchElementException if the item is not present in the PQ
*/
@Override
public void changePriority(T item, double priority) {
if (!this.contains(item)) {
throw new NoSuchElementException("Item is not present in the PQ!");
}
int index = map.get(item);
priorityNode[index] = new PriorityNode(item, priority);
//compare to parent
while (index > 1 && (priorityNode[index].compareTo(priorityNode[this.getParent(index)]) < 0)) {
swap(this.getParent(index), index);
index = this.getParent(index);
}
//compare to children
while (index < this.size()) {
if (this.size() < this.getLeftChild(index)) {
break;
}
if (priorityNode[this.getLeftChild(index)].compareTo(priorityNode[this.getRightChild(index)]) < 0) {
if (priorityNode[index].compareTo(priorityNode[this.getLeftChild(index)]) > 0) {
swap(index, this.getLeftChild(index));
index = this.getLeftChild(index);
continue;
}
if (priorityNode[index].compareTo(priorityNode[this.getRightChild(index)]) > 0) {
swap(index, this.getRightChild(index));
index = this.getRightChild(index);
continue;
}
break;
} else {
if (priorityNode[index].compareTo(priorityNode[this.getRightChild(index)]) > 0) {
swap(index, this.getRightChild(index));
index = this.getRightChild(index);
continue;
}
if (priorityNode[index].compareTo(priorityNode[this.getLeftChild(index)]) > 0) {
swap(index, this.getLeftChild(index));
index = this.getLeftChild(index);
continue;
}
break;
}
}
}
/**
* Returns the number of items in the PQ.
* Runs in O(log N) time.
*/
@Override
public int size() {
return SIZE;
}
private int getParent(int n) {
return n / 2;
}
private int getLeftChild(int n) {
return n * 2;
}
private int getRightChild(int n) {
return n * 2 + 1;
}
private class PriorityNode implements Comparable<ArrayHeapMinPQ.PriorityNode> {
private T item;
private double priority;
PriorityNode(T e, double p) {
this.item = e;
this.priority = p;
}
T getItem() {
return item;
}
double getPriority() {
return priority;
}
void setPriority(double priority) {
this.priority = priority;
}
@Override
public int compareTo(ArrayHeapMinPQ.PriorityNode other) {
if (other == null) {
return -1;
}
return Double.compare(this.getPriority(), other.getPriority());
}
@Override
@SuppressWarnings("unchecked")
public boolean equals(Object o) {
if (o == null || o.getClass() != this.getClass()) {
return false;
} else {
return ((ArrayHeapMinPQ.PriorityNode) o).getItem().equals(getItem());
}
}
@Override
public int hashCode() {
return item.hashCode();
}
}
}
| [
"30694064+changer666666@users.noreply.github.com"
] | 30694064+changer666666@users.noreply.github.com |
b3e716dc01f49615957370a5a19c045a7020bded | 03aedc66284c42b891a368f3135ec50af483a2a0 | /ch06/examples/GiveChangeCoinsMod.java | 439e2fe5b5c24d3c352c72dec059f31e967fff3d | [] | no_license | Meira1427/learnJavaByTheByte | a04136f6474296aeeea612ac700f26c7ae6b8155 | fe85761a66f0fae651ec95bddba9a58bbc1a64e1 | refs/heads/master | 2021-01-21T14:43:21.475795 | 2017-06-26T23:38:54 | 2017-06-26T23:38:54 | 95,326,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,376 | java | package examples;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class GiveChangeCoinsMod {
public static void main(String[] args) {
double amountDue, amountTendered;
BigDecimal num20, num10, num5, num1, numQuarter, numDime, numNickel, numPenny, leftover, tocheck;
BigDecimal twenty = new BigDecimal("20.00");
BigDecimal ten = new BigDecimal("10.00");
BigDecimal five = new BigDecimal("5.00");
BigDecimal one = new BigDecimal("1.00");
BigDecimal quarter = new BigDecimal("0.25");
BigDecimal dime = new BigDecimal("0.10");
BigDecimal nickel = new BigDecimal("0.05");
BigDecimal penny = new BigDecimal("0.01");
System.out.print("Enter the amount due: ");
amountDue = GetCleanDouble();
amountTendered = CheckAmountTendered(amountDue);
BigDecimal change = BigDecimal.valueOf(amountTendered - amountDue).setScale(2, RoundingMode.HALF_UP);
num20 = MakeChange(change, twenty);
leftover = change.remainder(twenty);
System.out.println(leftover);
num10 = MakeChange(leftover, ten);
leftover = leftover.remainder(ten);
System.out.println(leftover);
num5 = MakeChange(leftover, five);
leftover = leftover.remainder(five);
System.out.println(leftover);
num1 = MakeChange(leftover, one);
leftover = leftover.remainder(one);
System.out.println(leftover);
numQuarter = MakeChange(leftover, quarter);
leftover = leftover.remainder(quarter);
System.out.println(leftover);
numDime = MakeChange(leftover, dime);
leftover = leftover.remainder(dime);
System.out.println(leftover);
numNickel = MakeChange(leftover, nickel);
leftover = leftover.remainder(nickel);
System.out.println(leftover);
numPenny = MakeChange(leftover, penny);
leftover = leftover.remainder(penny);
System.out.println(leftover);
tocheck = (num20.multiply(twenty)).add(num10.multiply(ten)).add(num5.multiply(five)).add(num1.multiply(one)).add(numQuarter.multiply(quarter)).add(numDime.multiply(dime)).add(numNickel.multiply(nickel)).add(numPenny.multiply(penny));
System.out.println("Your change is " + change);
System.out.println("Verifying number" + tocheck);
System.out.println("Number of 20s returned is " + num20);
System.out.println("Number of 10s returned is " + num10);
System.out.println("Number of 5s returned is " + num5);
System.out.println("Number of 1s returned is " + num1);
System.out.println("Number of Quarters returned is " + numQuarter);
System.out.println("Number of Dimes returned is " + numDime);
System.out.println("Number of Nickels returned is " + numNickel);
System.out.println("Number of Pennies returned is " + numPenny);
}
public static double GetCleanDouble () {
java.util.Scanner scanner = new java.util.Scanner(System.in);
while (!scanner.hasNextDouble()) {
System.out.print("Enter a number please: ");
scanner.next();
}
return scanner.nextDouble();
}
public static double CheckAmountTendered (double num) {
double temp = 0;
while (temp < num) {
System.out.print("Enter amount tendered: ");
temp=GetCleanDouble();
}
return temp;
}
public static BigDecimal MakeChange(BigDecimal amount, BigDecimal currency) {
BigDecimal temp = new BigDecimal("0");
if (amount.doubleValue() < currency.doubleValue()) {
return temp;
}
else {
return amount.divide(currency).setScale(0, RoundingMode.FLOOR);
}
}
}
| [
"meira@meirapentermann.com"
] | meira@meirapentermann.com |
94e495010e452a3d249351a70fcb1e78aff8e538 | 3030c25834fed3ef823cfa7ad309615b8ff0f62b | /shoppingcartest/src/test/java/com/bwei/shoppingcartest/ExampleUnitTest.java | a39e20f2a626514ec41ca89822886d6da65bf27f | [] | no_license | shixuerenxin/Qizhiwei20171120 | 98fda98ea9996518f533793c4bc004eaf48ecc28 | 20a8dd42ceb3bab9b8ec03a3be9ae78f390507e2 | refs/heads/master | 2021-08-30T15:09:06.495411 | 2017-12-18T11:37:39 | 2017-12-18T11:37:39 | 114,633,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.bwei.shoppingcartest;
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);
}
} | [
"2418122543@qq.com"
] | 2418122543@qq.com |
b9206758ea98b30c145ace3e3f0d417cc536e435 | 6b4934d101743bb61391b4cb41f4e6f40a76952f | /app/src/main/java/project/mvp/com/socket/model/LabelDetail.java | a0ea62caaadde87ccfbfa315eec9074facceebff | [] | no_license | zhangyanyange/WorkshopPlane | 3317fa174a71b22bf325dbd1b78b6c4cf7ec3ffc | 7a25eb95d6eb8d5e5e841674a0cffb1d729405f8 | refs/heads/master | 2021-03-31T14:33:08.079108 | 2020-04-27T06:23:27 | 2020-04-27T06:23:27 | 248,112,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,931 | java | package project.mvp.com.socket.model;
import android.content.Intent;
import android.support.annotation.NonNull;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
public class LabelDetail {
/**
* Datas : [{"Pname":"Gprinter GP-1524D","Mark":"尾箱-1","PackageInfo":{"ID":"00000000-0000-0000-0000-000000000000","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":0,"Number":1,"CreateDate":"2019-11-05T09:03:14.8795228+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"个","SourceBillNo":"PRC2019091602","Description":"1测试盒零0个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-3","PackageInfo":{"ID":"f982c886-4e0b-4e4c-8903-bc302a369211","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T09:02:59.0956272+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-2","PackageInfo":{"ID":"cec07153-0a3d-48df-af9d-bd4d0db48f66","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:14:47.8138982+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-1","PackageInfo":{"ID":"2a011b5d-2efc-428b-9757-eaa8af4df9a8","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:14:46.8440982+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-3","PackageInfo":{"ID":"5925db3f-8baa-43cb-8c8c-aa26cac93b97","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:14:51.493613+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-1","PackageInfo":{"ID":"89d6f21b-b42e-4552-b335-4eb61b75a637","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:45:08.0151262+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-2","PackageInfo":{"ID":"8cb3e50a-bc80-4e98-bd4a-86847bedf2fd","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T09:02:58.0833687+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-3","PackageInfo":{"ID":"f59a064f-86b4-48b2-b6f8-ee2536382cd7","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:45:10.6960556+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"尾箱-1","PackageInfo":{"ID":"00000000-0000-0000-0000-000000000000","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":0,"Number":1,"CreateDate":"2019-11-05T05:45:22.3413983+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"个","SourceBillNo":"PRC2019091602","Description":"1测试盒零0个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-1","PackageInfo":{"ID":"06cbb5a1-57f4-41f6-b9c8-fc1e3c0a0641","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T09:02:57.1669188+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-1","PackageInfo":{"ID":"96e4ae8f-e0d6-43c4-ba80-02cdac03c663","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-06T01:25:29.9661471+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"},{"Pname":"Gprinter GP-1524D","Mark":"测试盒-2","PackageInfo":{"ID":"afecd351-34df-473a-b1e4-687079c24b14","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":2,"Number":1,"CreateDate":"2019-11-05T05:45:09.4819872+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"测试盒","SourceBillNo":"PRC2019091602","Description":"2.00个(2.00个)"},"PrintHost":"192.168.60.36"}]
* PageIndex : 1
* Total : 12
* Success : true
* Message : Success
* ErrorInfo : null
* Code : 200
*/
private int PageIndex;
private int Total;
private boolean Success;
private String Message;
private String ErrorInfo;
private int Code;
private List<DatasBean> Datas;
public int getPageIndex() {
return PageIndex;
}
public void setPageIndex(int PageIndex) {
this.PageIndex = PageIndex;
}
public int getTotal() {
return Total;
}
public void setTotal(int Total) {
this.Total = Total;
}
public boolean isSuccess() {
return Success;
}
public void setSuccess(boolean Success) {
this.Success = Success;
}
public String getMessage() {
return Message;
}
public void setMessage(String Message) {
this.Message = Message;
}
public String getErrorInfo() {
return ErrorInfo;
}
public void setErrorInfo(String ErrorInfo) {
this.ErrorInfo = ErrorInfo;
}
public int getCode() {
return Code;
}
public void setCode(int Code) {
this.Code = Code;
}
public List<DatasBean> getDatas() {
return Datas;
}
public void setDatas(List<DatasBean> Datas) {
this.Datas = Datas;
}
public static class DatasBean {
/**
* Pname : Gprinter GP-1524D
* Mark : 尾箱-1
* PackageInfo : {"ID":"00000000-0000-0000-0000-000000000000","BatchCode":"11111","GoodNumbers":"2202.04.0603","GoodName":"修护唇乳bc","ModelCode":"PR-L06","Sacler":0,"Number":1,"CreateDate":"2019-11-05T09:03:14.8795228+00:00","StoreId":"276","WorkPalceId":"0","UnitName":"个","SourceBillNo":"PRC2019091602","Description":"1测试盒零0个(2.00个)"}
* PrintHost : 192.168.60.36
*/
private String Pname;
private String Mark;
private PackageInfoBean PackageInfo;
private String PrintHost;
public String getPname() {
return Pname;
}
public void setPname(String Pname) {
this.Pname = Pname;
}
public String getMark() {
return Mark;
}
public void setMark(String Mark) {
this.Mark = Mark;
}
public PackageInfoBean getPackageInfo() {
return PackageInfo;
}
public void setPackageInfo(PackageInfoBean PackageInfo) {
this.PackageInfo = PackageInfo;
}
public String getPrintHost() {
return PrintHost;
}
public void setPrintHost(String PrintHost) {
this.PrintHost = PrintHost;
}
public static class PackageInfoBean {
/**
* ID : 00000000-0000-0000-0000-000000000000
* BatchCode : 11111
* GoodNumbers : 2202.04.0603
* GoodName : 修护唇乳bc
* ModelCode : PR-L06
* Sacler : 0
* Number : 1
* CreateDate : 2019-11-05T09:03:14.8795228+00:00
* StoreId : 276
* WorkPalceId : 0
* UnitName : 个
* SourceBillNo : PRC2019091602
* Description : 1测试盒零0个(2.00个)
*/
private String ID;
private String BatchCode;
private String GoodNumbers;
private String GoodName;
private String ModelCode;
private int Sacler;
private int Number;
private String CreateDate;
private String StoreId;
private String WorkPalceId;
private String UnitName;
private String SourceBillNo;
private String Description;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public String getBatchCode() {
return BatchCode;
}
public void setBatchCode(String BatchCode) {
this.BatchCode = BatchCode;
}
public String getGoodNumbers() {
return GoodNumbers;
}
public void setGoodNumbers(String GoodNumbers) {
this.GoodNumbers = GoodNumbers;
}
public String getGoodName() {
return GoodName;
}
public void setGoodName(String GoodName) {
this.GoodName = GoodName;
}
public String getModelCode() {
return ModelCode;
}
public void setModelCode(String ModelCode) {
this.ModelCode = ModelCode;
}
public int getSacler() {
return Sacler;
}
public void setSacler(int Sacler) {
this.Sacler = Sacler;
}
public int getNumber() {
return Number;
}
public void setNumber(int Number) {
this.Number = Number;
}
public String getCreateDate() {
return CreateDate;
}
public void setCreateDate(String CreateDate) {
this.CreateDate = CreateDate;
}
public String getStoreId() {
return StoreId;
}
public void setStoreId(String StoreId) {
this.StoreId = StoreId;
}
public String getWorkPalceId() {
return WorkPalceId;
}
public void setWorkPalceId(String WorkPalceId) {
this.WorkPalceId = WorkPalceId;
}
public String getUnitName() {
return UnitName;
}
public void setUnitName(String UnitName) {
this.UnitName = UnitName;
}
public String getSourceBillNo() {
return SourceBillNo;
}
public void setSourceBillNo(String SourceBillNo) {
this.SourceBillNo = SourceBillNo;
}
public String getDescription() {
return Description;
}
public void setDescription(String Description) {
this.Description = Description;
}
}
}
}
| [
"157763766@qq.com"
] | 157763766@qq.com |
8274fd8ca2ff263534f151f0b2d1d2407289a6b5 | 67322ffaef15475611b410685097bd138be28c54 | /timesheet/src/main/java/com/fastcode/timesheet/restcontrollers/extended/TimeofftypeControllerExtended.java | 166e6fcf49dc0e017c10adcfabf53fcb40588807 | [] | no_license | fastcoderepos/usman5-sampleApplication4 | f094d4919b9cd416e3fa0cb04583ecd3887dcbcf | ad6df9a472981a860a0bab4af4f0b5afc77302f5 | refs/heads/master | 2023-03-21T04:02:53.642221 | 2021-03-18T08:44:27 | 2021-03-18T08:44:27 | 349,000,392 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.fastcode.timesheet.restcontrollers.extended;
import com.fastcode.timesheet.application.extended.timeofftype.ITimeofftypeAppServiceExtended;
import com.fastcode.timesheet.application.extended.timesheetdetails.ITimesheetdetailsAppServiceExtended;
import com.fastcode.timesheet.commons.logging.LoggingHelper;
import com.fastcode.timesheet.restcontrollers.core.TimeofftypeController;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/timeofftype/extended")
public class TimeofftypeControllerExtended extends TimeofftypeController {
public TimeofftypeControllerExtended(
ITimeofftypeAppServiceExtended timeofftypeAppServiceExtended,
ITimesheetdetailsAppServiceExtended timesheetdetailsAppServiceExtended,
LoggingHelper helper,
Environment env
) {
super(timeofftypeAppServiceExtended, timesheetdetailsAppServiceExtended, helper, env);
}
//Add your custom code here
}
| [
"info@nfinityllc.com"
] | info@nfinityllc.com |
66338709c1d8a5b650f39709e0e02795f0c8be21 | fbc6f5d5b3ce181f5625de631c2ef08fe650e217 | /src/deadlock/Deadlock.java | eec5820055cf2bd2a673e505e1409fc234185602 | [] | no_license | FedorovPavel1990/Multithreading | b36a4eeef388746b455afbe0c8d5218e9bcaf488 | 24362569695bbec8bfda1af568b0056d38201ee7 | refs/heads/master | 2023-03-26T07:16:51.543997 | 2021-03-23T22:22:03 | 2021-03-23T22:22:03 | 330,160,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package deadlock;
/**
* Получаем deadlock
*/
public class Deadlock {
public static void main(String args[]) {
TestObject object = new TestObject("Объект 1");
TestObject anotherObject = new TestObject("Объект 2");
new Thread(() -> object.lockAnotherObject(anotherObject)).start();
new Thread(() -> anotherObject.lockAnotherObject(object)).start();
}
// Результат выполнения:
//
// Thread-1 собирается залочить Объект 2
// Thread-0 собирается залочить Объект 1
// Thread-1 залочил Объект 2
// Thread-0 залочил Объект 1
// Статус Объект 2 - Залочен
// Статус Объект 1 - Залочен
// Thread-1 что-то делает с Объект 2
// Thread-0 что-то делает с Объект 1
// Thread-1 собирается залочить Объект 1
// Thread-0 собирается залочить Объект 2
} | [
"p.fedorov@tinkoff.ru"
] | p.fedorov@tinkoff.ru |
d3dcb0a3b30b6e0f9329030dc0680f99751ea82e | 48534cc8f8e19b97ed72fa6133a697c0db86b243 | /app/src/main/java/com/utabitwallet/tools/animation/SpringAnimator.java | 4588fb63e5c89df897967010ae57284ae94a1aba | [
"MIT"
] | permissive | mirzaei-ce/android-ausbit | b19a39a69599e93c2690bd4a22d893f233659214 | 358df363525bcb3e2d19a51b75bf1f357177438b | refs/heads/master | 2021-08-19T09:33:14.325249 | 2017-11-25T15:51:44 | 2017-11-25T15:51:44 | 112,015,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,587 | java | package com.ausbitwallet.tools.animation;
import android.app.Activity;
import android.os.Handler;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import com.ausbitwallet.R;
/**
* BreadWallet
* <p>
* Created by Mihail Gutan <mihail@breadwallet.com> on 6/24/15.
* Copyright (c) 2016 breadwallet LLC
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
public class SpringAnimator {
private static final String TAG = SpringAnimator.class.getName();
public static void showExpandCameraGuide(final View view) {
if (view != null) {
view.setVisibility(View.GONE);
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ScaleAnimation trans = new ScaleAnimation(0.0f, 1f, 0.0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
trans.setDuration(800);
trans.setInterpolator(new DecelerateOvershootInterpolator(1.5f, 2.5f));
if (view != null) {
view.setVisibility(View.VISIBLE);
view.startAnimation(trans);
}
}
}, 200);
}
/**
* Shows the springy animation on views
*/
public static void showAnimation(final View view) {
if (view == null) return;
ScaleAnimation trans = new ScaleAnimation(0.6f, 1f, 0.6f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
trans.setDuration(500);
trans.setInterpolator(new DecelerateOvershootInterpolator(1.3f, 3f));
view.setVisibility(View.VISIBLE);
view.startAnimation(trans);
}
/**
* Shows the springy bubble animation on views
*/
public static void showBubbleAnimation(final View view) {
if (view == null) return;
ScaleAnimation trans = new ScaleAnimation(0.75f, 1f, 0.75f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
trans.setDuration(300);
trans.setInterpolator(new DecelerateOvershootInterpolator(1.0f, 1.85f));
view.setVisibility(View.VISIBLE);
view.startAnimation(trans);
}
public static void failShakeAnimation(Activity context, View view) {
if (view == null) return;
Animation shake = AnimationUtils.loadAnimation(context, R.anim.shake);
view.setVisibility(View.VISIBLE);
view.startAnimation(shake);
}
} | [
"mirzaei@ce.sharif.edu"
] | mirzaei@ce.sharif.edu |
3632d82a7ecabd80650ea49cf958d0c1214137b1 | 6266feae67e1d615c875bdd10344e7eaff193f27 | /tm-client/src/main/java/ru/burmistrov/tm/command/task/TaskListCommand.java | bc8d53b84d0a77085e1867fbe392879e8a8e649b | [] | no_license | DenisBurmistrov/Task-Manager | 7fb0fec4444e37bf228b8c926c52c1cde9ef4f00 | 4b85aa0e74f97bac7b6054b51e39bbfa97f3104b | refs/heads/master | 2022-12-09T00:44:13.973572 | 2019-04-08T15:07:48 | 2019-04-08T15:07:48 | 173,142,619 | 0 | 1 | null | 2022-11-16T11:37:58 | 2019-02-28T16:01:32 | Java | UTF-8 | Java | false | false | 1,862 | java | package ru.burmistrov.tm.command.task;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import ru.burmistrov.tm.api.loader.ServiceLocator;
import ru.burmistrov.tm.command.AbstractCommand;
import ru.burmistrov.tm.endpoint.Exception_Exception;
import ru.burmistrov.tm.endpoint.Session;
import ru.burmistrov.tm.endpoint.TaskDto;
import ru.burmistrov.tm.endpoint.TaskEndpoint;
import ru.burmistrov.tm.service.TerminalCommandService;
import java.util.List;
import java.util.Objects;
@Component
public final class TaskListCommand extends AbstractCommand {
@Autowired
private ServiceLocator serviceLocator;
@Autowired
private TaskEndpoint taskEndpoint;
@NotNull
@Override
public String getName() {
return "-printTasks";
}
@NotNull
@Override
public String getDescription() {
return "Print tasks of project by project ID";
}
@Override
public void execute() throws Exception_Exception {
System.out.println("Введите ID проекта:");
@NotNull final String id = serviceLocator.getTerminalCommandService().nextLine();
@NotNull final List<TaskDto> taskList = taskEndpoint.findAllTasksInProject
(serviceLocator.getSession(), Objects.requireNonNull(serviceLocator.getSession()).getUserId(), id);
for (TaskDto task : taskList) {
System.out.println("ID: " + task.getId() +
"; Название: " + task.getName() +
"; Описание: " + task.getDescription() +
"; ID проекта: " + task.getProjectId() +
"; Статус: " + task.getStatus());
}
}
@Override
public boolean isSecure() {
return true;
}
}
| [
"6y6yka1997@gmail.com"
] | 6y6yka1997@gmail.com |
51346b763c9cee70e17bd41849a86f2f2a591954 | c89839e2b326aa953c3d4621b15a81692ad7e7f1 | /src/com/uv/utils/threadpool/UvExecutor.java | eda45936c032758e13fd361388e0a02271b4e8ab | [] | no_license | rogetsun/UVUtil | 4117128018c50d1e294c80c3a7a8f38bb268afd3 | 834698a2acb66b6a0ff072b424d48df2518b6908 | refs/heads/master | 2022-12-30T00:41:12.728906 | 2020-03-18T07:33:12 | 2020-03-18T07:33:12 | 48,096,427 | 0 | 0 | null | 2022-12-16T04:22:20 | 2015-12-16T08:07:38 | Java | UTF-8 | Java | false | false | 7,807 | java | package com.uv.utils.threadpool;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created by uv2sun on 2017/5/17.
* 自定义线程池
* 普通线程池当核心线程满了, 会先进队列, 队列满了才加线程数, 直到线程数达到max-pool-size.
* 本线程池当核心线程满了, 会先加线程执行, 直到达到max-pool-size, 才进队列.
*/
public class UvExecutor extends ThreadPoolExecutor {
//默认尝试次数
private static final int DEFAULT_TRY_EXEC_TIMES = 100;
//默认尝试时间间隔
private static final int DEFAULT_TRY_DURATION = 1000;
//默认空闲线程存活时长
private static final int DEFAULT_KEEP_ALIVE_TIME = 120;
/**
* 尝试加入执行队列执行,如果报异常执行队列满,则每隔 tryDuration毫秒再执行一次,执行 tryExecTimes次。
*/
private int tryExecTimes;
/**
* 尝试加入执行队列执行,如果报异常执行队列满,则每隔 tryDuration毫秒再执行一次,执行 tryExecTimes次。
*/
private int tryDuration;
/**
* 定义一个成员变量,用于记录当前线程池中已提交的任务数量
*/
private final AtomicInteger submittedTaskCount = new AtomicInteger(0);
@Override
protected void afterExecute(Runnable r, Throwable t) {
// ThreadPoolExecutor的勾子方法,在task执行完后需要将池中已提交的任务数 - 1
submittedTaskCount.decrementAndGet();
}
@Override
public void execute(Runnable command) {
if (command == null) {
throw new NullPointerException();
}
// do not increment in method beforeExecute!
// 将池中已提交的任务数 + 1
submittedTaskCount.incrementAndGet();
try {
super.execute(command);
} catch (RejectedExecutionException rx) {
// retry to offer the task into queue.
final TaskQueue queue = (TaskQueue) super.getQueue();
try {
boolean offerOk = false;
for (int i = 0; i < this.getTryExecTimes(); i++) {
offerOk = queue.retryOffer(command, this.getTryDuration(), TimeUnit.MILLISECONDS);
if (offerOk) {
break;
}
}
if (!offerOk) {
submittedTaskCount.decrementAndGet();
//todo 不会被下面的Throwable截获到么?
throw new RejectedExecutionException("Queue capacity is full.", rx);
}
} catch (InterruptedException x) {
submittedTaskCount.decrementAndGet();
throw new RejectedExecutionException(x);
}
} catch (Throwable t) {
// decrease any way
submittedTaskCount.decrementAndGet();
throw t;
}
}
public int getSubmittedTaskCount() {
return submittedTaskCount.get();
}
public UvExecutor(int corePoolSize, int maximumPoolSize, int queueSize) {
super(corePoolSize, maximumPoolSize, UvExecutor.DEFAULT_KEEP_ALIVE_TIME, TimeUnit.SECONDS, new TaskQueue<>(queueSize));
((TaskQueue) this.getQueue()).setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, int queueSize, String threadPoolName) {
super(corePoolSize, maximumPoolSize, UvExecutor.DEFAULT_KEEP_ALIVE_TIME, TimeUnit.SECONDS, new TaskQueue<>(queueSize), new ThreadFactory(threadPoolName));
((TaskQueue) this.getQueue()).setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, int queueSize) {
super(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.SECONDS, new TaskQueue<>(queueSize));
((TaskQueue) this.getQueue()).setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, int queueSize, String threadPoolName) {
super(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.SECONDS, new TaskQueue<>(queueSize), new ThreadFactory(threadPoolName));
((TaskQueue) this.getQueue()).setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, TaskQueue<Runnable> workQueue) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
workQueue.setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, TaskQueue<Runnable> workQueue, ThreadFactory threadFactory) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory);
workQueue.setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, TaskQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, handler);
workQueue.setExecutor(this);
}
public UvExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, TaskQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
workQueue.setExecutor(this);
}
public int getTryExecTimes() {
return this.tryExecTimes == 0 ? UvExecutor.DEFAULT_TRY_EXEC_TIMES : this.tryExecTimes;
}
/**
* 尝试加入执行队列执行,如果报异常执行队列满,则每隔 tryDuration 毫秒再执行一次,执行 tryExecTimes次。
*/
public void setTryExecTimes(int tryExecTimes) {
this.tryExecTimes = tryExecTimes;
}
public int getTryDuration() {
return this.tryDuration == 0 ? UvExecutor.DEFAULT_TRY_DURATION : this.tryDuration;
}
/**
* 尝试加入执行队列执行,如果报异常执行队列满,则每隔 tryDuration毫秒再执行一次,执行 tryExecTimes次。
*/
public void setTryDuration(int tryDuration) {
this.tryDuration = tryDuration;
}
// public static void main(String[] args) throws InterruptedException {
// UvExecutor executor = new UvExecutor(2, 4, 2);
// System.out.println(executor);
// for (int i = 0; i < 10; i++) {
// UvRun r = new UvRun();
// r.setIdx(i);
// executor.execute(r);
// System.out.println(executor.getSubmittedTaskCount() + "\t" + executor);
// }
// for (int i = 0; i < 20; i++) {
// TimeUnit.SECONDS.sleep(1);
// System.out.println(executor.getSubmittedTaskCount() + "\t" + executor);
//
// }
// System.out.println(executor.getSubmittedTaskCount() + "\t" + executor);
// executor.shutdown();
// }
//
// private static class UvRun implements Runnable {
// private int idx;
//
// @Override
// public void run() {
// System.out.println(idx + ": begin");
// try {
// TimeUnit.SECONDS.sleep(10);
// } catch (InterruptedException e) {
//
// }
// System.out.println(idx + ": end");
// }
//
// public int getIdx() {
// return idx;
// }
//
// public void setIdx(int idx) {
// this.idx = idx;
// }
//
// @Override
// public String toString() {
// return "UvRun{" +
// "idx=" + idx +
// '}';
// }
// }
}
| [
"songyw163@163.com"
] | songyw163@163.com |
b6479a838453982b5538b29fb3bcd3babf693fd6 | 4abc11616311077cb670011ef5b6d7e5e8022d1e | /com.ibm.streamsx.kafka/impl/java/src/com/ibm/streamsx/kafka/clients/producer/TupleProcessedHook.java | 8433940691702dccd0041f5b95fd5e6b52a03693 | [
"Apache-2.0"
] | permissive | IBMStreams/streamsx.kafka | ba6068be5795b12ea51587171d35f3f9a3e75146 | 68f1d4facbbfe0035afcceb3930d04d044904081 | refs/heads/develop | 2022-08-18T14:10:49.215009 | 2022-07-22T18:32:18 | 2022-07-22T18:32:18 | 87,198,773 | 15 | 9 | Apache-2.0 | 2020-10-27T12:13:18 | 2017-04-04T14:48:33 | Java | UTF-8 | Java | false | false | 1,338 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this 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.streamsx.kafka.clients.producer;
import com.ibm.streams.operator.Tuple;
/**
* Interface for a Hook that can be set to implement actions
* when a tuple has been successufully produced or that failed.
* @author The IBM Kafka Toolkit maintainers
* @since toolkit version 2.2
*/
public interface TupleProcessedHook {
/**
* Called after a tuple has been sucessfully processed, i.e. produced.
* @param tuple The tuple that has been processed
*/
void onTupleProduced (Tuple tuple);
/**
* Called when a tuple could not be produced on all topics.
* @param tuple The tuple that failed.
* @param failure the failure what went wrong with the tuple
*/
void onTupleFailed (Tuple tuple, FailureDescription failure);
}
| [
"rolef.heinrich@de.ibm.com"
] | rolef.heinrich@de.ibm.com |
e833097fb618da73778c5669f60e950206f4d7dd | e4410b5306d755f307d4c514d318bb7ea200ac36 | /src/main/java/com/ss/onlineTest/bean/Menu.java | 4d9b533df3203ecfa34ed366867f5bcd45bdb86f | [] | no_license | ssqiji/onlineTest | 574dd0df59cfe3554a7555c237278212351863da | 4d2955de392d40594dd47be6fed27d7e18f43b36 | refs/heads/master | 2021-09-02T14:44:40.848882 | 2018-01-03T08:30:12 | 2018-01-03T08:30:12 | 115,784,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package com.ss.onlineTest.bean;
import java.io.Serializable;
import java.util.List;
/**
* 一级菜单类
* @author 神兽
*/
public class Menu implements Serializable{
private static final long serialVersionUID = 7935649839472394259L;
private Integer id;
private String text;
private List<MenuItem> children;
@Override
public String toString() {
return "Menu [id=" + id + ", text=" + text + ", children=" + children + "]";
}
}
| [
"203535142@qq.com"
] | 203535142@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.