blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
07668c1669f41a88f690eb9a0339d2bec7aaa65a | 335e8ad5423289fa07f694ec23bba5fc4997998a | /src/main/java/com/cpy/website/api/controller/UploadController.java | 3f53e5d68b06cc51497925f8287ff9178cb42a85 | [] | no_license | liuxinxin95/website | 498acd1c4202870bca71653d11c8971edb51dc89 | bbf19791a43f7436e2a5b2cbe07b105246500c4e | refs/heads/master | 2022-06-22T22:42:24.740320 | 2019-11-18T10:14:29 | 2019-11-18T10:14:29 | 222,413,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,084 | java | package com.cpy.website.api.controller;
import com.cpy.website.center.util.UploadUtil;
import com.cpy.website.framework.ApiResponse;
import com.cpy.website.framework.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
* @author Carl
* @ClassName UploadController
* @Description
* @date 2019-11-13 21:58
**/
@Api("上传")
@RestController
@RequestMapping("upload")
public class UploadController extends BaseController {
/**
* 上传
*/
@ApiOperation("上传")
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public ApiResponse<String> uploadFile(@RequestParam("file") MultipartFile file) {
String upload = UploadUtil.upload(file);
return success(upload);
}
}
| [
"18634318474@163.com"
] | 18634318474@163.com |
bc4362eded95d8b6b70000f57051c98fdaf93055 | a65a9a61542732b35c0da1f3a08cfb075296698f | /src/DAO/UsuarioDAO.java | a9bf107e0aa1f74e9f349900aa4ea4a3adb54a6d | [] | no_license | hamohseni/LoginApplication | d06d7fe7acc7420cf008bdf60aeae5bf3c631c5b | 62b067db76322fd95ff18d5cfe6573b9bdbd67b5 | refs/heads/master | 2022-07-16T05:24:19.827745 | 2020-05-13T23:19:56 | 2020-05-13T23:19:56 | 261,370,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,957 | 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 DAO;
import Entidad.Usuario;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.NonUniqueResultException;
import javax.persistence.Persistence;
import javax.persistence.Query;
/**
*
* @author Hamed
*/
public class UsuarioDAO {
private static EntityManagerFactory
emf = Persistence.createEntityManagerFactory("LoginApp_JPAPU");
public void crear(Usuario object){
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
try{
em.persist(object);
em.getTransaction().commit();
}catch (Exception e){
e.printStackTrace();
em.getTransaction().rollback();
}finally {
em.close();
}
}
public boolean eliminar(Usuario object){
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
boolean ret = false;
try{
em.remove(object);
em.getTransaction().commit();
ret = true;
}catch (Exception e){
e.printStackTrace();
em.getTransaction().rollback();
}finally{
em.close();
return ret;
}
}
public Usuario leer(Usuario par){
EntityManager em = emf.createEntityManager();
Usuario usuario = null;
Query q = em.createQuery("Select u FROM Usuario u " +
"WHERE u.nombre LIKE :nombre" +
" AND u.password LIKE :password")
.setParameter("nombre", par.getNombre())
.setParameter("password", par.getPassword());
try{
usuario = (Usuario) q.getSingleResult();
} catch (NonUniqueResultException e){
usuario = (Usuario) q.getResultList().get(0);
} catch (Exception e) {
e.printStackTrace();
}finally {
em.close();
return usuario;
}
}
public boolean actualizar(Usuario object, Usuario nuevoObjeto){
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
boolean ret = false;
try{
object = leer(object);
object.setNombre(nuevoObjeto.getNombre());
object.setPassword(nuevoObjeto.getPassword());
em.merge(object);
em.getTransaction().commit();
ret = true;
} catch (Exception e) {
e.printStackTrace();
em.getTransaction().rollback();
}finally {
em.close();
return ret;
}
}
}
| [
"Hamed@192.168.0.21"
] | Hamed@192.168.0.21 |
0fe53e4199c4ae10262e03c369dab69506601e17 | 5ead5bdc6bd0af919cf123ffd3dc51f0a426c7e0 | /baseWeb/baseWeb-dao/src/main/java/com/liusoft/baseWeb/dao/user/UserDao.java | 0157caf2b2e04f4dabcdeb82da49454306e8c9d1 | [] | no_license | liuinsect/BaseWeb | 2b3082fe25b73781eb28d1b5f9774a64bf3dc434 | 10fca3666eedf8a966365b8db941b30ef760c682 | refs/heads/master | 2021-03-12T23:52:03.631825 | 2014-11-09T09:34:38 | 2014-11-09T09:34:38 | 20,485,502 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,207 | java | package com.liusoft.baseWeb.dao.user;
import java.util.List;
import com.liusoft.baseWeb.client.common.PageQuery;
import com.liusoft.baseWeb.client.user.User;
/**
* UserDao接口
*
* @author liukunyang
* @date 2014-10-03 10:29:17
*
*/
public interface UserDao {
/**
* 添加并返回设置id的User对象
*
* @param user
* @return
*/
public User addUser(User user);
/**
* 更新User
*
* @param user
*/
public void updateUser(User user);
/**
* 根据主键删除User
*
* @param id
*/
public void deleteUser(Integer id);
/**
* 根据example取得User列表
*
* @param user
* @return
*/
public List<User> getListByExample(User user);
/**
* 根据主键获取User
*
* @param id
* @return
*/
public User getUserById(Integer id);
/**
* 分页取得User列表
*
* @param pageQuery
* @return
*/
public List<User> getUserByPage(PageQuery pageQuery);
/**
* 根据查询条件返回数量
*
* @param pageQuery
* @return
*/
public int count(PageQuery pageQuery);
} | [
"liu.insect@gmail.com"
] | liu.insect@gmail.com |
aded5d07818c80157a3cf26af294526fcae44c6c | 4a37c711a730ef74a37f496672e26e824b93c01f | /src/com/evmtv/epg/constants/Constants.java | 1fcaaf62c6938e23a6f7e05c858581fd6241e66f | [] | no_license | cnsunfocus/EMAS | dbefdb91962591fbcb6605196aa54995fd9d0e9c | 853c6c14ddbcaccd68b9a78c62508f52b5627efe | refs/heads/master | 2020-03-23T19:43:06.926395 | 2013-12-12T08:26:52 | 2013-12-12T08:26:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | /**
* @project_name EAMS
* @file_name Constants.java
* @package_name com.evmtv.epg.constants
* @date_time 2013年11月27日下午1:28:57
* @type_name Constants
*/
package com.evmtv.epg.constants;
/**
*
* <p>Title: 常量</p>
* <p>Description: 封装部分常量</p>
* <p>Date: 2013年11月27日下午1:28:57</p>
* <p>Copyright: Copyright (c) 2013</p>
* <p>Company: www.evmtv.com</p>
* @author fangzhu@evmtv.com
* @version 1.0
*/
public class Constants {
/***
* ffmpeg文件路径
*/
public final static String FFMPEG_PATH = Constants.class.getResource("/").getFile().toString() + "../../ffmpeg/ffmpeg.exe";
}
| [
"772184414@qq.com"
] | 772184414@qq.com |
f37ba22bf966c498e9486b869639e0b494894a4c | fb680f751baf00631e42fc7c68fb4b828c8b5cd0 | /backend/sge/src/main/java/com/basis/sge/sge/servico/mapper/EventoPerguntaMapper.java | e84bd1d79c38ca14f1850af00c71d9ca68a15b03 | [] | no_license | william-ferreira/sge-equipe1-basis | 5fdd694220824d7787a9215bd2725ff08cbe242a | 537768516e32ef9b679f9b40451323910f8076c8 | refs/heads/main | 2023-03-02T19:29:24.361842 | 2021-02-09T00:32:42 | 2021-02-09T00:32:42 | 329,074,156 | 0 | 1 | null | 2021-02-09T00:32:43 | 2021-01-12T18:18:31 | Java | UTF-8 | Java | false | false | 855 | java | package com.basis.sge.sge.servico.mapper;
import com.basis.sge.sge.dominio.EventoPergunta;
import com.basis.sge.sge.servico.dto.EventoPerguntaDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper(componentModel = "spring", uses = {})
public interface EventoPerguntaMapper extends EntityMapper<EventoPerguntaDTO, EventoPergunta>{
@Override
@Mapping(source = "idEvento", target = "evento.id")
@Mapping(source = "idPergunta", target = "pergunta.id")
@Mapping(source = "idEvento", target = "id.eventoId")
@Mapping(source = "idPergunta", target = "id.perguntaId")
EventoPergunta toEntity(EventoPerguntaDTO eventoPerguntaDTO);
@Override
@Mapping(source = "evento.id", target = "idEvento")
@Mapping(source = "pergunta.id", target = "idPergunta")
EventoPerguntaDTO toDto(EventoPergunta eventoPergunta);
}
| [
"williamferreiragt@gmail.com"
] | williamferreiragt@gmail.com |
8aa888508a0f03606c327e6d61b20ed8e638e388 | 49fc07c1171615f5dd8d9a789e90836c30d52b49 | /Proxy/src/main/java/ru/gaidamaka/dns/DNSQueueOperationsWithBlockStrategy.java | bd37c9286187c334b5240af7a34dd15361539f8f | [] | no_license | Dross0/Network-Labs | bf88ef3ffc9b279ee29da1b9f518a14225ff67a9 | 3928a37bacf6241bab8d9c3d29407715800f877a | refs/heads/master | 2023-01-30T16:59:53.674055 | 2020-12-17T15:44:12 | 2020-12-17T15:44:12 | 296,841,120 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 912 | java | package ru.gaidamaka.dns;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.BlockingQueue;
public class DNSQueueOperationsWithBlockStrategy implements DNSQueueStrategy {
@Override
public void appendResolveRequest(@NotNull BlockingQueue<DNSResolveRequest> queue, @NotNull DNSResolveRequest dnsResolveRequest) {
try {
queue.put(dnsResolveRequest);
} catch (InterruptedException e) {
throw new IllegalStateException("Thread was interrupted while waiting put request to queue", e);
}
}
@Override
@NotNull
public DNSResolveRequest takeResolveRequest(@NotNull BlockingQueue<DNSResolveRequest> queue) {
try {
return queue.take();
} catch (InterruptedException e) {
throw new IllegalStateException("Thread was interrupted while waiting take request from queue", e);
}
}
}
| [
"andrew.gaidamaka@gmail.com"
] | andrew.gaidamaka@gmail.com |
ef364d7eade3a9a723d7594f2a99bc174018e8c9 | 67cd0de8f0e5262a110a8474cdd688e1903e8115 | /src/main/java/br/unb/cic/goda/RTRegexBaseVisitor.java | f5261e20cc8428aec74cf27a4144ae177d6d0b9a | [] | no_license | leandrobergmann/pistargodaintegration | 8149b233c25b55803ab7d7bba366d5ac5af037be | c054ef95b4c8c154f73b1bf57b6d8782bac16320 | refs/heads/master | 2021-09-08T01:16:01.447526 | 2018-03-05T01:06:10 | 2018-03-05T01:06:10 | 119,530,394 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,057 | java | // Generated from br/unb/cic/RTRegex.g4 by ANTLR 4.3
package br.unb.cic.goda;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
/**
* This class provides an empty implementation of {@link RTRegexVisitor},
* which can be extended to create a visitor which only needs to handle a subset
* of the available methods.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public class RTRegexBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements RTRegexVisitor<T> {
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParens(@NotNull RTRegexParser.ParensContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBlank(@NotNull RTRegexParser.BlankContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGId(@NotNull RTRegexParser.GIdContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGTry(@NotNull RTRegexParser.GTryContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGSkip(@NotNull RTRegexParser.GSkipContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGTime(@NotNull RTRegexParser.GTimeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGOpt(@NotNull RTRegexParser.GOptContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGCard(@NotNull RTRegexParser.GCardContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitGAlt(@NotNull RTRegexParser.GAltContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPrintExpr(@NotNull RTRegexParser.PrintExprContext ctx) { return visitChildren(ctx); }
} | [
"leandro.bergmann@hotmail.com"
] | leandro.bergmann@hotmail.com |
8dfdba2049b083b2e40983460f49ad6b1a367f9e | 1766b0ceabc719e640a2c4aabd510fdf662ebf67 | /app/src/main/java/com/example/todoy/Task.java | 13c6781ee1f9304f817d317ac98842b95048338c | [] | no_license | rahul-yoganand/TodoY | 0b9fd749f81c916231ad29a3c2b35a8c68e28049 | 21e6b9a07a0d150bbe5431488c56d53cbc8aa55b | refs/heads/master | 2023-07-04T04:35:13.708737 | 2021-08-06T12:37:18 | 2021-08-06T12:37:18 | 390,674,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.example.todoy;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;
@Entity
public class Task {
@PrimaryKey(autoGenerate = true)
int uid;
@ColumnInfo
String taskTitle;
public Task(String taskTitle) {
this.taskTitle = taskTitle;
}
public String toString() {
return taskTitle;
}
}
| [
"pry10@iitbbs.ac.in"
] | pry10@iitbbs.ac.in |
1f212298659d28525e3739d6651b3235af0c798c | a8df8a0d5181f301470c8d6d2571a2029b820d68 | /javatests/com/google/gerrit/acceptance/rest/PluginsCapabilityIT.java | af947f8a8668350092b03938cce476eda10bab12 | [
"Apache-2.0"
] | permissive | CharlotteFallices/Gerrit | f59a7cbcf0328b7ae298cf4de75d9bdeff7e1ef1 | 6c04245cd05e101870b3375e4c85973f484070f5 | refs/heads/master | 2023-01-12T06:53:47.191352 | 2022-01-10T11:44:01 | 2022-01-10T11:44:01 | 240,635,623 | 1 | 0 | Apache-2.0 | 2023-01-05T07:19:49 | 2020-02-15T02:58:57 | Java | UTF-8 | Java | false | false | 3,117 | java | // Copyright (C) 2019 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.google.gerrit.acceptance.rest;
import static com.google.gerrit.acceptance.rest.TestPluginModule.PLUGIN_CAPABILITY;
import static com.google.gerrit.acceptance.rest.TestPluginModule.PLUGIN_COLLECTION;
import com.google.common.collect.ImmutableMap;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
import com.google.gerrit.acceptance.TestPlugin;
import com.google.gerrit.acceptance.rest.CreateTestPlugin.Input;
import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.extensions.api.access.AccessSectionInfo;
import com.google.gerrit.extensions.api.access.PermissionInfo;
import com.google.gerrit.extensions.api.access.PermissionRuleInfo;
import com.google.gerrit.extensions.api.access.ProjectAccessInput;
import com.google.gerrit.server.group.SystemGroupBackend;
import org.junit.Before;
import org.junit.Test;
@TestPlugin(
name = PluginsCapabilityIT.PLUGIN_NAME,
sysModule = "com.google.gerrit.acceptance.rest.TestPluginModule")
public class PluginsCapabilityIT extends LightweightPluginDaemonTest {
public static final String PLUGIN_NAME = "test";
public String restEndpoint;
@Override
@Before
public void setUpTestPlugin() throws Exception {
super.setUpTestPlugin();
this.setUpPluginPermission();
this.restEndpoint = "/config/server/" + PLUGIN_NAME + "~" + PLUGIN_COLLECTION;
}
@Test
public void testGet() throws Exception {
adminRestSession.get(this.restEndpoint).assertOK();
userRestSession.get(this.restEndpoint).assertOK();
}
@Test
public void testCreate() throws Exception {
Input input = new Input();
input.input = "test";
adminRestSession.post(this.restEndpoint + "/notexisting", input).assertCreated();
userRestSession.post(this.restEndpoint + "/notexisting", input).assertCreated();
}
private void setUpPluginPermission() throws Exception {
ProjectAccessInput accessInput = new ProjectAccessInput();
AccessSectionInfo accessSectionInfo = new AccessSectionInfo();
PermissionInfo email = new PermissionInfo(null, null);
PermissionRuleInfo pri = new PermissionRuleInfo(PermissionRuleInfo.Action.ALLOW, false);
email.rules = ImmutableMap.of(SystemGroupBackend.REGISTERED_USERS.get(), pri);
accessSectionInfo.permissions = ImmutableMap.of(PLUGIN_NAME + "-" + PLUGIN_CAPABILITY, email);
accessInput.add = ImmutableMap.of(AccessSection.GLOBAL_CAPABILITIES, accessSectionInfo);
gApi.projects().name(allProjects.get()).access(accessInput);
}
}
| [
"luca.milanesio@gmail.com"
] | luca.milanesio@gmail.com |
bfece7198a2927e8e5fb6ba0f03b245705dbe29c | 3e1703c707eb0332b9d86ef78a33f294524ae1a1 | /New folder/app/src/main/java/com/example/justjava/fragments/ProfileFragment.java | 4a0c9f68ad9cee6fd76e08f108c36a8b8f7d2e55 | [] | no_license | Shagun15/Coffee-ordering- | c01be6baa4e532a0cb7ec82e3295705d35db2ea5 | 8b08b03984461f4cc7811f7b9335dea73f91a0ad | refs/heads/main | 2023-02-16T20:44:49.732246 | 2021-01-13T19:12:58 | 2021-01-13T19:12:58 | 326,432,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,731 | java | package com.example.justjava.fragments;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.justjava.MainActivity;
import com.example.justjava.R;
import com.example.justjava.UserDetails;
import com.example.justjava.WelcomeActivity;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class ProfileFragment extends Fragment {
TextView Name,Email;
LinearLayout signOut;
FirebaseAuth auth;
private DatabaseReference ref;
String userId;
FirebaseUser firebaseUser;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_profile, container, false);
auth=FirebaseAuth.getInstance();
firebaseUser=FirebaseAuth.getInstance().getCurrentUser();
userId=firebaseUser.getUid();
Name=view.findViewById(R.id.Name);
Email=view.findViewById(R.id.Email);
signOut=view.findViewById(R.id.SignOut);
signOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
auth.signOut();
Intent intent=new Intent(getActivity(), WelcomeActivity.class);
startActivity(intent);
getActivity().finish();
}
});
// auth.signOut();
// Intent intent=new Intent(getActivity(), WelcomeActivity.class);
// startActivity(intent);
// getActivity().finish();
ref= FirebaseDatabase.getInstance().getReference().child("Users").child(userId);
ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
UserDetails user=snapshot.getValue(UserDetails.class);
Name.setText(user.getName());
Email.setText(user.getEmail());
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
return view;
}
} | [
"kartikmanchanda1901@gmail.com"
] | kartikmanchanda1901@gmail.com |
dd4ae6b025ac2868a85e0b444ea2c2c165f6007c | aaae903de52d2dfc345d33c5509ef791bc1a05ab | /src/main/java/org/bearmug/spark/SparkApp.java | 3952a0ee8bb1b79f8eeea23ef5581ebf5190782b | [] | no_license | bearmug/portfolio-bench | db1b343ebec5c4f5caf581a01d4e95dc511194d6 | 8c6ffb6cdfd943e0a1552923ee677d164902d590 | refs/heads/master | 2021-01-10T13:24:40.218311 | 2017-07-26T22:28:56 | 2017-07-26T22:28:56 | 53,701,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package org.bearmug.spark;
import org.bearmug.FibonacciCalc;
import static spark.Spark.*;
public class SparkApp {
public static void main(String[] args) {
port(8060);
get("/fibonacci-spark/get/:base", (req, res) ->
new FibonacciCalc().fibonacci(Integer.parseInt(req.params(":base"))));
}
}
| [
"pavel.fadeev@gmail.com"
] | pavel.fadeev@gmail.com |
c9e7f3232cd6e8876e57cadc365a936f7848966f | e70eb4b70b484e1f9f00019f4cbf32488f38d40d | /src/org/refactoringminer/rm2/analysis/EntityMatcher.java | c8be1d15dd70d59d0d507e63c5cc9b1234506b78 | [] | no_license | MatinMan/RefactoringMiner | 3d4033c53cfcbbca4a23ed0153faa8d0346f4cc5 | 6d2895ca96ec71394a2bff4d1b6f12eeccddc01e | refs/heads/master | 2020-04-08T14:31:20.874512 | 2016-05-18T14:01:49 | 2016-05-18T14:01:49 | 60,316,879 | 1 | 0 | null | 2016-06-03T03:53:19 | 2016-06-03T03:53:18 | null | UTF-8 | Java | false | false | 5,661 | java | package org.refactoringminer.rm2.analysis;
import java.util.ArrayList;
import java.util.Collections;
import org.refactoringminer.rm2.model.RelationshipType;
import org.refactoringminer.rm2.model.SDEntity;
import org.refactoringminer.rm2.model.SDModel;
public class EntityMatcher<T extends SDEntity> {
private final ArrayList<Criterion<T>> criteria = new ArrayList<Criterion<T>>();
private final ArrayList<SimilarityIndex<? super T>> similarityIndexes = new ArrayList<SimilarityIndex<? super T>>();
public EntityMatcher<T> addCriterion(Criterion<T> criterion) {
this.criteria.add(criterion);
return this;
}
public EntityMatcher<T> using(SimilarityIndex<? super T> similarity) {
this.similarityIndexes.add(similarity);
return this;
}
protected int getPriority(SDModel m, T entityBefore, T entityAfter) {
return 0;
}
// protected double similarity(SDModel m, T entityBefore, T entityAfter) {
// return entityBefore.sourceCode().similarity(entityAfter.sourceCode());
// }
public void match(SDModel m, Iterable<T> unmatchedBefore, Iterable<T> unmatchedAfter) {
ArrayList<MatchCandidate<T>> candidates = new ArrayList<MatchCandidate<T>>();
for (T eBefore : unmatchedBefore) {
for (T eAfter : unmatchedAfter) {
for (int i = 0; i < criteria.size(); i++) {
Criterion<T> matcher = criteria.get(i);
if (matcher.canMatch(m, eBefore, eAfter)) {
double maxSim = 0.0;
double averageSim = 0.0;
for (SimilarityIndex<? super T> index : similarityIndexes) {
double sim = index.similarity(eBefore, eAfter);
averageSim += sim;
maxSim = Math.max(sim, maxSim);
}
averageSim = averageSim / similarityIndexes.size();
if (maxSim >= matcher.threshold) {
candidates.add(new MatchCandidate<T>(eBefore, eAfter, matcher, getPriority(m, eBefore, eAfter), i, averageSim));
}
break;
}
}
}
}
Collections.sort(candidates);
for (MatchCandidate<T> candidate : candidates) {
T entityBefore = candidate.before;
T entityAfter = candidate.after;
RelationshipType relationshipType = candidate.criterion.relationshipType;
if (m.addRelationship(relationshipType, entityBefore, entityAfter, 1)) {
candidate.criterion.onMatch(m, entityBefore, entityAfter);
}
// if (beforeMatch == null && afterMatch == null) {
// } else {
// if (beforeMatch == null && relationshipType.isMultisource() && afterMatch.getType() == relationshipType) {
// m.addRelationship(relationshipType, true, typeBefore, typeAfter, 1);
// }
// if (afterMatch == null && relationshipType.isMultitarget() && beforeMatch.getType() == relationshipType) {
// m.addRelationship(relationshipType, true, typeBefore, typeAfter, 1);
// }
// }
// if (!m.isMatched(typeBefore) && !m.isMatched(typeAfter)) {
// m.matchEntities(typeBefore, typeAfter);
//
// }
}
}
public static class Criterion<T extends SDEntity> {
private final double threshold;
private final RelationshipType relationshipType;
public Criterion(RelationshipType relType, double threshold) {
this.relationshipType = relType;
this.threshold = threshold;
}
public RelationshipType getRelationshipType() {
return relationshipType;
}
protected boolean canMatch(SDModel m, T entityBefore, T entityAfter) {
return true;
}
protected void onMatch(SDModel m, T entityBefore, T entityAfter) {
// override
}
}
private static class MatchCandidate<T extends SDEntity> implements Comparable<MatchCandidate<T>> {
private final T before;
private final T after;
private final Criterion<T> criterion;
private final int mainPriority;
private final int matcherPriority;
private final double contentSimilarity;
public MatchCandidate(T before, T after, Criterion<T> criterion, int mainPriority, int matcherPriority, double similarity) {
this.before = before;
this.after = after;
this.criterion = criterion;
this.mainPriority = mainPriority;
this.matcherPriority = matcherPriority;
this.contentSimilarity = similarity;
}
@Override
public int compareTo(MatchCandidate<T> o) {
int c = Integer.compare(mainPriority, o.mainPriority);
if (c != 0) return c;
c = Integer.compare(matcherPriority, o.matcherPriority);
if (c != 0) return c;
return -Double.compare(contentSimilarity, o.contentSimilarity);
}
@Override
public String toString() {
return "b: " + before + ", a:" + after + ", sim:" + contentSimilarity;
}
}
}
| [
"danilofes@gmail.com"
] | danilofes@gmail.com |
0416dcb38e7306a8548d8b60c99af2ce7d07f2e5 | ff7ab481ee0f824a328bfd6071d96dc61e7e4fe4 | /src/main/java/com/sciits/devops/poc/util/ValidationUtils.java | 8845a4a8ca4a9a545257d669afcfb186e516b140 | [] | no_license | jpmanne/um | 8db2b8d748ea4ae173deedcd19cc2e5416f30b59 | 58a9c8b341c6a5ff343e455f7afca2350d124378 | refs/heads/master | 2021-01-19T16:36:54.702671 | 2018-02-15T12:18:46 | 2018-02-15T12:18:46 | 88,274,930 | 0 | 2 | null | 2018-02-15T12:18:47 | 2017-04-14T14:34:57 | Java | UTF-8 | Java | false | false | 2,229 | java |
package com.sciits.devops.poc.util;
import java.util.List;
import org.springframework.util.StringUtils;
import com.sciits.devops.poc.model.UserDetails;
public class ValidationUtils {
private static final ValidationResponse SUCCESS = new ValidationResponse(true, null);
//========================================================================
public static ValidationResponse validateUser(UserDetails user) {
if (StringUtils.isEmpty(user.getEmail())) {
return new ValidationResponse(false, "User Email is empty");
} else if (user.getPassword() == null ) {
return new ValidationResponse(false, "Password is empty");
} else if (user.getUserName() == null) {
return new ValidationResponse(false, "user name is null");
} else if (user.getFirstName() == null) {
return new ValidationResponse(false, "first name is null");
}else if (user.getLastName() == null) {
return new ValidationResponse(false, "last name is null");
}/*else if (user.getGender() == null) {
return new ValidationResponse(false, "gender is null");
}*/ else if (user.getPhoneNumber() == null) {
return new ValidationResponse(false, "phone number is null");
}
return SUCCESS;
}
//========================================================================
public static ValidationResponse validateLoginUser(UserDetails user) {
if (StringUtils.isEmpty(user.getUserName())) {
return new ValidationResponse(false, "User name is empty");
} else if (user.getPassword() == null ) {
return new ValidationResponse(false, "Password is empty");
}
return SUCCESS;
}
//========================================================================
/*public static ValidationResponse validateVendorEmails(List<VendorDetails> vendors, VendorDetails vendorDetails) {
for(VendorDetails vendorListItem : vendors){
if(vendorListItem.getVendorDetailsId()!=vendorDetails.getVendorDetailsId()) {
if( vendorDetails.getToEmail()!=null && vendorDetails.getToEmail().equals(vendorListItem.getToEmail())){
return new ValidationResponse(false, "To Email is already exists");
}
}
}
return SUCCESS;
}*/
//========================================================================
}
| [
"jayaprakash.manne@sciits.com"
] | jayaprakash.manne@sciits.com |
3927450f0f3702d41a084c19c35ca3b702fe1ce7 | d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb | /PROMISE/archives/xalan/2.4/org/apache/xml/utils/BoolStack.java | bb8df0b620b97a18fb4c275bb4ab37bbbafb0316 | [] | no_license | hvdthong/DEFECT_PREDICTION | 78b8e98c0be3db86ffaed432722b0b8c61523ab2 | 76a61c69be0e2082faa3f19efd76a99f56a32858 | refs/heads/master | 2021-01-20T05:19:00.927723 | 2018-07-10T03:38:14 | 2018-07-10T03:38:14 | 89,766,606 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,578 | java | package org.apache.xml.utils;
import java.util.EmptyStackException;
/**
* <meta name="usage" content="internal"/>
* Simple stack for boolean values.
*/
public final class BoolStack implements Cloneable
{
/** Array of boolean values */
private boolean m_values[];
/** Array size allocated */
private int m_allocatedSize;
/** Index into the array of booleans */
private int m_index;
/**
* Default constructor. Note that the default
* block size is very small, for small lists.
*/
public BoolStack()
{
this(32);
}
/**
* Construct a IntVector, using the given block size.
*
* @param size array size to allocate
*/
public BoolStack(int size)
{
m_allocatedSize = size;
m_values = new boolean[size];
m_index = -1;
}
/**
* Get the length of the list.
*
* @return Current length of the list
*/
public final int size()
{
return m_index + 1;
}
/**
* Pushes an item onto the top of this stack.
*
*
* @param val the boolean to be pushed onto this stack.
* @return the <code>item</code> argument.
*/
public final boolean push(boolean val)
{
if (m_index == m_allocatedSize - 1)
grow();
return (m_values[++m_index] = val);
}
/**
* Removes the object at the top of this stack and returns that
* object as the value of this function.
*
* @return The object at the top of this stack.
* @throws EmptyStackException if this stack is empty.
*/
public final boolean pop()
{
return m_values[m_index--];
}
/**
* Removes the object at the top of this stack and returns the
* next object at the top as the value of this function.
*
*
* @return Next object to the top or false if none there
*/
public final boolean popAndTop()
{
m_index--;
return (m_index >= 0) ? m_values[m_index] : false;
}
/**
* Set the item at the top of this stack
*
*
* @param b Object to set at the top of this stack
*/
public final void setTop(boolean b)
{
m_values[m_index] = b;
}
/**
* Looks at the object at the top of this stack without removing it
* from the stack.
*
* @return the object at the top of this stack.
* @throws EmptyStackException if this stack is empty.
*/
public final boolean peek()
{
return m_values[m_index];
}
/**
* Looks at the object at the top of this stack without removing it
* from the stack. If the stack is empty, it returns false.
*
* @return the object at the top of this stack.
*/
public final boolean peekOrFalse()
{
return (m_index > -1) ? m_values[m_index] : false;
}
/**
* Looks at the object at the top of this stack without removing it
* from the stack. If the stack is empty, it returns true.
*
* @return the object at the top of this stack.
*/
public final boolean peekOrTrue()
{
return (m_index > -1) ? m_values[m_index] : true;
}
/**
* Tests if this stack is empty.
*
* @return <code>true</code> if this stack is empty;
* <code>false</code> otherwise.
*/
public boolean isEmpty()
{
return (m_index == -1);
}
/**
* Grows the size of the stack
*
*/
private void grow()
{
m_allocatedSize *= 2;
boolean newVector[] = new boolean[m_allocatedSize];
System.arraycopy(m_values, 0, newVector, 0, m_index + 1);
m_values = newVector;
}
public Object clone()
throws CloneNotSupportedException
{
return super.clone();
}
}
| [
"hvdthong@github.com"
] | hvdthong@github.com |
d05a7bbcb171d8e8442292871a41184c3a10be35 | bdeac396df52d4ec4d8d290988d58bf49b83036c | /app/src/main/java/com/example/architpanwar/wordsplay/HELP.java | 541923fc8493f7110caa4ee35dfabac8136ba5ec | [] | no_license | archit17282/WordsPlay | 9fd2e5a0a3ba55de378bc691373fef458cfb35da | 4fd1c5e1aef93b301141e081a5b24b0049e888c8 | refs/heads/master | 2021-05-09T04:49:09.443442 | 2018-01-28T19:07:01 | 2018-01-28T19:07:01 | 119,288,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.example.architpanwar.wordsplay;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class HELP extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
}
}
| [
"architpanwar@Archits-MacBook-Air.local"
] | architpanwar@Archits-MacBook-Air.local |
47b50d770d2895c0a0569a8c0df62c931c948474 | 1c1bf758927e3be3cfa12afd145bba12e7fdf867 | /Java_Essential/Input_Output/src/com/javalec/output/InputStreamEx.java | 6b8e1e1f58234c0c55e8ab834f3a8f30498da982 | [] | no_license | johncmk/Java | b9808f15f4f8fe6ed6c4214553a21a25f001db51 | 0c7d4493489ccd12adf7b34f1bba2f8c43f53fbf | refs/heads/master | 2021-04-26T13:49:42.711346 | 2016-04-22T03:20:07 | 2016-04-22T03:20:07 | 51,797,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | package com.javalec.output;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class InputStreamEx {
private static InputStream input;
public static void read_data(String address) {
if(address.isEmpty())
return;
try {
input = new FileInputStream(address);
while(true) {
int data = input.read();
System.out.println("Data: "+ data);
if( data == -1)
break;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if(input != null)
try {
input.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}//End
}//End
| [
"changmin_k@yahoo.com"
] | changmin_k@yahoo.com |
0fcfc5e42e2883115770688a934abc3438e5e6d5 | 65dd8501b89ac74211b8b809c40593343101ea6d | /app/src/main/java/messenger/com/craneglee/messenger/CreateMessageActivity.java | 274873c5904573dbe59f010046e1c5edead56821 | [] | no_license | Wishtrader/messenger_app | 869f87bfa95135f98d44a621129d0bc849308ec1 | 69da6cae17199601bb706cdd75c8e7801fd1dd09 | refs/heads/master | 2020-08-03T21:24:48.911757 | 2016-11-12T08:14:08 | 2016-11-12T08:14:08 | 73,537,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,156 | java | package messenger.com.craneglee.messenger;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.content.Intent;
import android.widget.EditText;
public class CreateMessageActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_message);
}
//Вызвать onSendMessage() прищелчке на кнопке
public void onSendMessage(View view) {
EditText messageView = (EditText)findViewById(R.id.message);
String messageText = messageView.getText().toString();
Intent intent = new Intent(Intent. ACTION_SEND);
intent.setType("text/plan");
intent.putExtra(Intent.EXTRA_TEXT, messageText);
String chooserTitle = getString(R.string.chooser);
//Получить текст заголовка
Intent chosenIntent = Intent.createChooser(intent, chooserTitle);
//Вывести диалоговое окно выбора
startActivity(chosenIntent);
}
}
| [
"mr.akomarov@gmail.com"
] | mr.akomarov@gmail.com |
63903f377a45ab962609acf78ab680c140fa5af6 | 8efb888fc2df81912f2ba06cd058e57220988744 | /core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java | 91761fba030c85f24cd01b4c8cd14bf18f075cce | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | haonguyen123/sis-geotiff | d701240ce9646b91819d626c93054a6ac5f5e066 | bb738dd80531e4bc5afd809d3c11c3f17de220ea | refs/heads/master | 2020-12-31T06:32:37.943809 | 2016-05-08T16:12:15 | 2016-05-08T16:12:15 | 58,319,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,865 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.sis.referencing.factory.sql;
import java.util.Set;
import java.util.Locale;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.sql.Connection;
import java.io.BufferedReader;
import java.io.LineNumberReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.nio.charset.Charset;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.setup.InstallationResources;
import org.apache.sis.internal.system.DataDirectory;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.CollectionsExt;
import org.apache.sis.internal.util.Constants;
// Branch-dependent imports
import org.apache.sis.internal.jdk7.StandardCharsets;
import org.apache.sis.internal.jdk7.DirectoryStream;
import org.apache.sis.internal.jdk7.Files;
import org.apache.sis.internal.jdk7.Path;
/**
* Provides SQL scripts needed for creating a local copy of a dataset. This class allows Apache SIS users
* to bundle the EPSG or other datasets in their own product for automatic installation when first needed.
* Implementations of this class can be declared in the following file for automatic discovery by {@link EPSGFactory}:
*
* {@preformat text
* META-INF/services/org.apache.sis.setup.InstallationResources
* }
*
* <div class="section">How this class is used</div>
* The first time that an {@link EPSGDataAccess} needs to be instantiated,
* {@link EPSGFactory} verifies if the EPSG database exists. If it does not, then:
* <ol>
* <li>{@link EPSGFactory#install(Connection)} searches for the first instance of {@link InstallationResources}
* (the parent of this class) for which the {@linkplain #getAuthorities() set of authorities} contains {@code "EPSG"}.</li>
* <li>The {@linkplain #getLicense license} may be shown to the user if the application allows that
* (for example when running as a {@linkplain org.apache.sis.console console application}).</li>
* <li>If the installation process is allowed to continue, it will iterate over all readers provided by
* {@link #openScript(String, int)} and execute the SQL statements (not necessarily verbatim;
* the installation process may adapt to the target database).</li>
* </ol>
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
* @version 0.7
* @module
*/
public abstract class InstallationScriptProvider extends InstallationResources {
/**
* A sentinel value for the content of the script to execute before the SQL scripts provided by the authority.
* This is an Apache SIS build-in script for constraining the values of some {@code VARCHAR} columns
* to enumerations of values recognized by {@link EPSGDataAccess}. Those enumerations are not required
* for proper working of {@link EPSGFactory}, but can improve data integrity.
*/
protected static final String PREPARE = "Prepare";
/**
* A sentinel value for the content of the script to execute after the SQL scripts provided by the authority.
* This is an Apache SIS build-in script for creating indexes or performing any other manipulation that help
* SIS to use the dataset. Those indexes are not required for proper working of {@link EPSGFactory},
* but can significantly improve performances.
*/
protected static final String FINISH = "Finish";
/**
* The authorities to be returned by {@link #getAuthorities()}.
*/
private final Set<String> authorities;
/**
* The names of the SQL scripts to read.
*/
private final String[] resources;
/**
* Creates a new provider which will read script files of the given names in that order.
* The given names are often filenames, but not necessarily
* (it is okay to use those names only as labels).
*
* <table class="sis">
* <caption>Typical argument values</caption>
* <tr>
* <th>Authority</th>
* <th class="sep">Argument values</th>
* </tr><tr>
* <td>{@code EPSG}</td>
* <td class="sep"><code>
* {{@linkplain #PREPARE}, "EPSG_Tables.sql", "EPSG_Data.sql", "EPSG_FKeys.sql", {@linkplain #FINISH}}
* </code></td>
* </tr>
* </table>
*
* @param authority The authority (typically {@code "EPSG"}), or {@code null} if not available.
* @param resources Names of the SQL scripts to read.
*
* @see #getResourceNames(String)
* @see #openStream(String)
*/
protected InstallationScriptProvider(final String authority, final String... resources) {
ArgumentChecks.ensureNonNull("resources", resources);
authorities = CollectionsExt.singletonOrEmpty(authority);
this.resources = resources;
}
/**
* Returns the identifiers of the dataset installed by the SQL scripts.
* The values currently recognized by SIS are:
*
* <ul>
* <li>{@code "EPSG"} for the EPSG geodetic dataset.</li>
* </ul>
*
* The default implementation returns the authority given at construction time, or an empty set
* if that authority was {@code null}. An empty set means that the provider does not have all
* needed resources or does not have permission to distribute the installation scripts.
*
* @return Identifiers of SQL scripts that this instance can distribute.
*/
@Override
@SuppressWarnings("ReturnOfCollectionOrArrayField")
public Set<String> getAuthorities() {
return authorities;
}
/**
* Verifies that the given authority is one of the expected values.
*/
private void verifyAuthority(final String authority) {
if (!authorities.contains(authority)) {
throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentValue_2, "authority", authority));
}
}
/**
* Returns the names of all SQL scripts to execute.
* This is a copy of the array of names given to the constructor.
* Those names are often filenames, but not necessarily (they may be just labels).
*
* @param authority The value given at construction time (e.g. {@code "EPSG"}).
* @return The names of all SQL scripts to execute.
* @throws IllegalArgumentException if the given {@code authority} argument is not the expected value.
* @throws IOException if fetching the script names required an I/O operation and that operation failed.
*/
@Override
public String[] getResourceNames(String authority) throws IOException {
verifyAuthority(authority);
return resources.clone();
}
/**
* Returns a reader for the SQL script at the given index. Contents may be read from files in a local directory,
* or from resources in a JAR file, or from entries in a ZIP file, or any other means at implementor choice.
* The {@link BufferedReader} instances shall be closed by the caller.
*
* <div class="section">EPSG case</div>
* In the EPSG dataset case, the iterator should return {@code BufferedReader} instances for the following files
* (replace {@code <version>} by the EPSG version number and {@code <product>} by the target database) in same order.
* The first and last files are provided by Apache SIS.
* All other files can be downloaded from <a href="http://www.epsg.org/">http://www.epsg.org/</a>.
*
* <ol>
* <li>Content of {@link #PREPARE}, an optional data definition script that define the enumerations expected by {@link EPSGDataAccess}.</li>
* <li>Content of {@code "EPSG_<version>.mdb_Tables_<product>.sql"}, a data definition script that create empty tables.</li>
* <li>Content of {@code "EPSG_<version>.mdb_Data_<product>.sql"}, a data manipulation script that populate the tables.</li>
* <li>Content of {@code "EPSG_<version>.mdb_FKeys_<product>.sql"}, a data definition script that create foreigner key constraints.</li>
* <li>Content of {@link #FINISH}, an optional data definition and data control script that create indexes and set permissions.</li>
* </ol>
*
* Implementors are free to return a different set of scripts with equivalent content.
*
* <div class="section">Default implementation</div>
* The default implementation invokes {@link #openStream(String)} – except for {@link #PREPARE} and {@link #FINISH}
* in which case an Apache SIS build-in script is used – and wrap the result in a {@link LineNumberReader}.
* The file encoding is ISO LATIN-1 (the encoding used in the scripts distributed by EPSG).
*
* @param authority The value given at construction time (e.g. {@code "EPSG"}).
* @param resource Index of the SQL script to read, from 0 inclusive to
* <code>{@linkplain #getResourceNames getResourceNames}(authority).length</code> exclusive.
* @return A reader for the content of SQL script to execute.
* @throws IllegalArgumentException if the given {@code authority} argument is not the expected value.
* @throws IndexOutOfBoundsException if the given {@code resource} argument is out of bounds.
* @throws IOException if an error occurred while creating the reader.
*/
@Override
public BufferedReader openScript(final String authority, final int resource) throws IOException {
verifyAuthority(authority);
ArgumentChecks.ensureValidIndex(resources.length, resource);
if (!Constants.EPSG.equals(authority)) {
throw new IllegalStateException(Errors.format(Errors.Keys.UnknownAuthority_1, authority));
}
String name = resources[resource];
final Charset charset;
final InputStream in;
if (PREPARE.equals(name) || FINISH.equals(name)) {
name = authority + '_' + name + ".sql";
in = InstallationScriptProvider.class.getResourceAsStream(name);
charset = StandardCharsets.UTF_8;
} else {
in = openStream(name);
charset = StandardCharsets.ISO_8859_1;
}
if (in == null) {
throw new FileNotFoundException(Errors.format(Errors.Keys.FileNotFound_1, name));
}
return new LineNumberReader(new InputStreamReader(in, charset));
}
/**
* Opens the input stream for the SQL script of the given name.
* This method is invoked by the default implementation of {@link #openScript(String, int)}
* for all scripts except {@link #PREPARE} and {@link #FINISH}.
*
* <div class="note"><b>Example 1:</b>
* if this {@code InstallationScriptProvider} instance gets the SQL scripts from files in a well-known directory
* and if the names given at {@linkplain #InstallationScriptProvider(String, String...) construction time} are the
* filenames in that directory, then this method can be implemented as below:
*
* {@preformat java
* protected InputStream openStream(String name) throws IOException {
* return Files.newInputStream(directory.resolve(name));
* }
* }
* </div>
*
* <div class="note"><b>Example 2:</b>
* if this {@code InstallationScriptProvider} instance rather gets the SQL scripts from resources bundled
* in the same JAR files than and in the same package, then this method can be implemented as below:
*
* {@preformat java
* protected InputStream openStream(String name) {
* return MyClass.getResourceAsStream(name);
* }
* }
* </div>
*
* @param name Name of the script file to open. Can be {@code null} if the resource is not found.
* @return An input stream opened of the given script file.
* @throws IOException if an error occurred while opening the file.
*/
protected abstract InputStream openStream(final String name) throws IOException;
/**
* Logs the given record. This method pretend that the record has been logged by
* {@code EPSGFactory.install(…)} because it is the public API using this class.
*/
static void log(final LogRecord record) {
record.setLoggerName(Loggers.CRS_FACTORY);
Logging.log(EPSGFactory.class, "install", record);
}
/**
* The default implementation which use the scripts in the {@code $SIS_DATA/Databases/ExternalSources}
* directory, if present. This class expects the files to have those exact names where {@code *} stands
* for any characters provided that there is no ambiguity:
*
* <ul>
* <li>{@code EPSG_*Tables.sql}</li>
* <li>{@code EPSG_*Data.sql}</li>
* <li>{@code EPSG_*FKeys.sql}</li>
* </ul>
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
* @version 0.7
* @module
*/
static final class Default extends InstallationScriptProvider {
/**
* The directory containing the scripts, or {@code null} if it does not exist.
*/
private Path directory;
/**
* Index of the first real file in the array given to the constructor.
* We set the value to 1 for skipping the {@code PREPARE} pseudo-file.
*/
private static final int FIRST_FILE = 1;
/**
* Creates a default provider.
*/
Default(final Locale locale) throws IOException {
super(Constants.EPSG,
PREPARE,
"Tables",
"Data",
"FKeys",
FINISH);
Path dir = DataDirectory.DATABASES.getDirectory();
if (dir != null) {
dir = dir.resolve("ExternalSources");
if (Files.isDirectory(dir)) {
final String[] resources = super.resources;
final String[] found = new String[resources.length - FIRST_FILE - 1];
DirectoryStream stream = Files.newDirectoryStream(dir, "EPSG_*.sql");
try {
for (final Path path : stream) {
final String name = path.getFileName().toString();
for (int i=0; i<found.length; i++) {
final String part = resources[FIRST_FILE + i];
if (name.contains(part)) {
if (found[i] != null) {
log(Errors.getResources(locale)
.getLogRecord(Level.WARNING, Errors.Keys.DuplicatedElement_1, part));
return; // Stop the search because of duplicated file.
}
found[i] = name;
}
}
}
} finally {
stream.close();
}
for (int i=0; i<found.length; i++) {
final String file = found[i];
if (file != null) {
resources[FIRST_FILE + i] = file;
} else {
dir = null;
}
}
directory = dir;
}
}
}
/**
* Returns {@code "EPSG"} if the scripts exist in the {@code ExternalSources} subdirectory,
* or {@code "unavailable"} otherwise.
*
* @return {@code "EPSG"} if the SQL scripts for installing the EPSG dataset are available,
* or {@code "unavailable"} otherwise.
*/
@Override
public Set<String> getAuthorities() {
return (directory != null) ? super.getAuthorities() : Collections.<String>emptySet();
}
/**
* Returns {@code null} since the user is presumed to have downloaded the files himself.
*
* @return The terms of use in plain text or HTML, or {@code null} if the license is presumed already accepted.
*/
@Override
public String getLicense(String authority, Locale locale, String mimeType) {
return null;
}
/**
* Opens the input stream for the SQL script of the given name.
*
* @param name Name of the script file to open.
* @return An input stream opened of the given script file, or {@code null} if the resource was not found.
* @throws IOException if an error occurred while opening the file.
*/
@Override
protected InputStream openStream(final String name) throws IOException {
return (directory != null) ? Files.newInputStream(directory.resolve(name)) : null;
}
}
}
| [
"nguyenthiphuonghao243@gmail.com"
] | nguyenthiphuonghao243@gmail.com |
f49e299e710555c9eb13ad8627b40f89db93de36 | 8587c56663e50e0703c5b6e47ec879ac0272f5d4 | /src/leetCode/ClassicalThinking/DoublePointer/TrapWater_42.java | f111eedc17ddda1f48c0b387ae99343eca93f66f | [] | no_license | choumei1006/Algorithms | f443477d728f5213a6ae1224d89326a5f931be73 | 186decef21e5f56d7438e549ed16b850267ce558 | refs/heads/master | 2021-07-22T18:15:33.885572 | 2020-10-16T16:09:05 | 2020-10-16T16:09:05 | 224,449,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,428 | java | package leetCode.ClassicalThinking.DoublePointer;
import org.junit.Test;
/**
* @author:choumei
* @date:2020/4/4 23:23
* @Description:
* 给定 n 个非负整数表示每个宽度为 1 的柱子的高度图,计算按此排列的柱子,下雨之后能接多少雨水。
*
*
*
* 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图,
* 在这种情况下,可以接 6 个单位的雨水(蓝色部分表示雨水)。 感谢 Marcos 贡献此图。
*
* 示例:
*
* 输入: [0,1,0,2,1,0,1,3,2,1,2,1]
* 输出: 6
*
*/
public class TrapWater_42 {
@Test
public void test(){
System.out.println(trap2(new int[]{0,1,0,2,1,0,1,3,2,1,2,1}));
}
/**
* 方法一:暴力法
* @param height
* @return
*/
public int trap1(int[] height){
if(null == height || height.length == 0){
return 0;
}
int res = 0;
int minMax = 0;
for (int i = 1; i < height.length-1 ; i++) {
int maxLeft = 0;
for(int j = 0; j < i; j++){
if(height[j] > maxLeft){
maxLeft = height[j];
}
}
int maxRight = 0;
for(int j = i+1; j < height.length; j++){
if(height[j] > maxRight){
maxRight = height[j];
}
}
minMax = Math.min(maxLeft,maxRight);
res += minMax > height[i] ? minMax - height[i] : 0;
}
return res;
}
/**
* 方法二:动态规划
* 备注:将上述暴力解法中的左右最大值存储起来,避免重复执行
* @param height
* @return
*/
public int trap2(int[] height){
if(null == height || height.length == 0){
return 0;
}
int res = 0;
int[] maxLeft = new int[height.length];
int[] maxRight = new int[height.length];
for (int i = 1; i < height.length-1; i++) {
maxLeft[i] = Math.max(maxLeft[i-1],height[i-1]);
}
for (int i = height.length-2; i >= 0 ; i--) {
maxRight[i] = Math.max(maxRight[i+1],height[i+1]);
}
int maxMin = 0;
for (int i = 1; i < height.length-1 ; i++) {
maxMin = Math.min(maxLeft[i],maxRight[i]);
res += maxMin > height[i] ? maxMin - height[i] : 0;
}
return res;
}
/**
* 方法三:双指针
* @param height
* @return
*/
public int trap3(int[] height){
int sum = 0;
int max_left = 0;
int max_right = 0;
int left = 1;
int right = height.length - 2; // 加右指针进去
for (int i = 1; i < height.length - 1; i++) {
//从左到右更
if (height[left - 1] < height[right + 1]) {
max_left = Math.max(max_left, height[left - 1]);
int min = max_left;
if (min > height[left]) {
sum = sum + (min - height[left]);
}
left++;
//从右到左更
} else {
max_right = Math.max(max_right, height[right + 1]);
int min = max_right;
if (min > height[right]) {
sum = sum + (min - height[right]);
}
right--;
}
}
return sum;
}
}
| [
"1479784599@qq.com"
] | 1479784599@qq.com |
d80394857d746c4e5a045cf88e8935f4e9fe4d81 | 3e519985adc42b000f3888b9ba00e59bfe6ccee9 | /mall_system/src/main/java/com/ningpai/system/util/StockWarnSpec.java | 61a4ae910076937e0538dad8e46339901b1e3ded | [] | no_license | zhenchai/mall | 8475077cf7a5fe5208510a3408502143667e9f17 | c6fa070691bd62c53dbaa0b467bcb389bc66a373 | refs/heads/master | 2020-04-13T10:10:49.514859 | 2018-11-18T10:45:42 | 2018-11-18T10:45:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | /*
* Copyright 2013 NINGPAI, Inc.All rights reserved.
* NINGPAI PROPRIETARY / CONFIDENTIAL.USE is subject to licence terms.
*/
package com.ningpai.system.util;
/**
* 货品规格
* @author jiping
* @since 2015年8月21日 下午7:37:54
* @version 0.0.1
*/
public class StockWarnSpec {
//货品的id
private Long id;
//货品规格
private String specname;
/*货品值**/
private String specvalue;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSpecname() {
return specname;
}
public void setSpecname(String specname) {
this.specname = specname;
}
public String getSpecvalue() {
return specvalue;
}
public void setSpecvalue(String specvalue) {
this.specvalue = specvalue;
}
}
| [
"wdpxl@sina.com"
] | wdpxl@sina.com |
06ba6110132a98541c946acc3e2fe5b64ace2e84 | 8a6eda3eb94a802282bfa55a1fcce0a73175fc18 | /Micro/src/com/micro/view/annotation/event/OnItemLongClick.java | 38d8a084fed3a327df949f92d030b1ad56a5d093 | [] | no_license | wherego/Micro | 3966c820789a5f917903b1f78c004969ad029547 | 76015776384f470094850ed0723b6090ef05c091 | refs/heads/master | 2021-01-20T12:55:36.081302 | 2016-10-27T03:08:59 | 2016-10-27T03:08:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | /*
* Copyright (c) 2013 Chengel_HaltuD
*
* 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.micro.view.annotation.event;
import android.widget.AdapterView;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @ClassName: OnItemLongClick
* @Description: TODO
* @Author:Chengel_HaltuD
* @Date:2015-5-30 下午3:11:15
* @version V1.0
*
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@EventBase(
listenerType = AdapterView.OnItemLongClickListener.class,
listenerSetter = "setOnItemLongClickListener",
methodName = "onItemLongClick")
public @interface OnItemLongClick {
int[] value();
int[] parentId() default 0;
}
| [
"chengel_haltud@126.com"
] | chengel_haltud@126.com |
1442162aca133642de6aef0cec647c816ac1ead5 | 35f02045b2fa1058ab9d62aef1d0c26ff18b7b64 | /wxs/src/com/cx/wxs/action/image/ImageAction.java | 34314a1301bd5fb123462befef7600f3de48fa1c | [] | no_license | zwkkevin92/roychenyi.github.io | a51e46e45d6f9b18ce2a7cd1adceea997df109b1 | f98e8d3dc18f30e6f4da03adb20a712006c1da90 | refs/heads/master | 2021-01-15T15:53:50.246355 | 2016-05-22T09:00:44 | 2016-05-22T09:00:44 | 57,217,204 | 0 | 0 | null | 2016-05-17T13:52:48 | 2016-04-27T13:52:23 | Java | UTF-8 | Java | false | false | 6,290 | java | package com.cx.wxs.action.image;
import java.io.File;
import java.sql.Timestamp;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.cx.wxs.dto.BSiteDto;
import com.cx.wxs.dto.IAlbumDto;
import com.cx.wxs.dto.IImageDto;
import com.cx.wxs.dto.UUserDto;
import com.cx.wxs.service.BSiteService;
import com.cx.wxs.service.IImageService;
import com.cx.wxs.service.UUserService;
import com.cx.wxs.utils.DateUtils;
import com.cx.wxs.utils.ClientInfo;
import com.cx.wxs.utils.imageUtils;
/**
* @author 陈义
* @date 2016-3-29 下午9:22:01
*/
@Controller
@RequestMapping("/{vip}/image")
public class ImageAction {
@Resource
private IImageService iImageService;
@Resource
private BSiteService bSiteService;
@Resource
private UUserService uUserService;
/**
* @return the bSiteService
*/
public BSiteService getbSiteService() {
return bSiteService;
}
/**
* @param bSiteService the bSiteService to set
*/
public void setbSiteService(BSiteService bSiteService) {
this.bSiteService = bSiteService;
}
/**
* @return the uUserService
*/
public UUserService getuUserService() {
return uUserService;
}
/**
* @param uUserService the uUserService to set
*/
public void setuUserService(UUserService uUserService) {
this.uUserService = uUserService;
}
/**
* @return the iImageService
*/
public IImageService getiImageService() {
return iImageService;
}
/**
* @param iImageService the iImageService to set
*/
public void setiImageService(IImageService iImageService) {
this.iImageService = iImageService;
}
@RequestMapping(value="/updateuserlogo")
@ResponseBody
public IImageDto updateUserLogo( @PathVariable("vip") String vip,
Integer x, Integer y, Integer width, Integer height,Integer degree,
@RequestParam(value = "avatar_file") MultipartFile imageFile, HttpServletRequest request,HttpServletResponse response){
IImageDto imageDto=new IImageDto();
//获取服务器的实际路径
String realPath = request.getSession().getServletContext().getRealPath("/");
System.out.println("x:"+x+"y:"+y+"width:"+width+"height:"+height+"degree:"+degree);
System.out.println(realPath);
//需要上传的路径,我的路径根据用户的和当前日期划分路径
String resourcePath="upload/image";
UUserDto userDto=(UUserDto) request.getSession().getAttribute("user");
resourcePath+="/"+userDto.getUserId();
if(imageFile!=null){
try{
//文件名
String name= imageFile.getOriginalFilename();
//获取时间的路径
Date date=new Date();
int year=DateUtils.getYear(date);
int month=DateUtils.getMonth(date);
int day=DateUtils.getDay(date);
resourcePath+="/"+year+"/"+month+"/"+day+"/";
File dir=new File(realPath+resourcePath);
if(!dir.exists()){
dir.mkdirs();
}
//先把用户上传到原图保存到服务器上
File file=new File(dir,date.getTime()+".jpg");
imageFile.transferTo(file);
if(file.exists()){
String src=realPath+resourcePath+date.getTime();
boolean[] flag=new boolean[6];
//旋转后剪裁图片
imageUtils.convert(src+".jpg", "jpg", src+".jpg");
flag[0]=imageUtils.cutAndRotateImage(src+".jpg", src+"_s.jpg", x, y, width, height, degree);
//缩放图片,生成不同大小的图片,应用于不同的大小的头像显示
flag[1]= imageUtils.scale2(src+"_s.jpg", src+"_s_200.jpg", 200, 200, true);
flag[2]= imageUtils.scale2(src+"_s.jpg", src+"_s_100.jpg", 100, 100, true);
flag[3]= imageUtils.scale2(src+"_s.jpg", src+"_s_50.jpg", 50, 50, true);
flag[4]= imageUtils.scale2(src+"_s.jpg", src+"_s_30.jpg", 30, 30, true);
//生成预览图
flag[5]= imageUtils.scale2(src+".jpg", src+"_200.jpg", 200, 200, true);
if(flag[0]&&flag[1]&&flag[2]&&flag[3]&&flag[4]&&flag[5]){
//图像处理完成,将数据写入数据库中
imageDto.setYear((short) year);
imageDto.setMount((short)month);
imageDto.setDay((short)day);
imageDto.setUUserDto(userDto);
imageDto.setName(date.getTime()+".jpg");
imageDto.setFileName(name);
imageDto.setUrl(resourcePath+"/"+date.getTime()+".jpg");
imageDto.setPreviewUrl(resourcePath+"/"+date.getTime()+"_200.jpg");
imageDto.setTime(new Timestamp(date.getTime()));
imageDto.setWidth((short)imageUtils.getImageWidth(file.getPath()));
imageDto.setHeight((short)imageUtils.getImageHeight(file.getPath()));
imageDto.setClientIp(ClientInfo.getIpAddr(request));
imageDto.setClientAgent(ClientInfo.getAgent(request));
imageDto.setClientType((short)(ClientInfo.isMoblie(request)?1:0));
imageDto.setStatus((short)1);
imageDto.setExt3(resourcePath+"/"+date.getTime()+"_s_200.jpg");
imageDto.setExt4(resourcePath+"/"+date.getTime()+"_s_100.jpg");
//设置相册,头像设置进入默认相册
IAlbumDto albumDto=new IAlbumDto();
albumDto.setAlbumId(1);
imageDto.setIAlbumDto(albumDto);
int id= iImageService.addIImage(imageDto);
if(id>0){
BSiteDto siteDto=userDto.getBSiteDto();
siteDto.setLogo(resourcePath+"/"+date.getTime()+"_s_100.jpg");
siteDto.setLastTime( new Timestamp(date.getTime()));
bSiteService.updateBSite(siteDto);
userDto.setPortrait(resourcePath+"/"+date.getTime()+"_s_50.jpg");
uUserService.updateUuser(userDto);
userDto=uUserService.getUuser(userDto);
imageDto.setStatusFlag("1");
return imageDto;
}
}
}
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return imageDto;
}
}
return imageDto;
}
}
| [
"852416288@qq.com"
] | 852416288@qq.com |
bdb91fb8a8558c980f7b81d8d1d72aeab2160cb1 | f632803ab46c7870642b0480ffe882ac3296f6b5 | /spring-data-gremlin-test/src/main/java/org/springframework/data/gremlin/object/core/domain/Person.java | f380435e807e45b0e53ce43ddd91fc2d324416de | [] | no_license | gjrwebber/spring-data-gremlin | 3f608ca21754f9523ec8c65587eacdc59ab2ade5 | 5d0cf06af1cfebbc0f0d1371ad999b96b6578844 | refs/heads/develop | 2021-01-13T16:15:11.148378 | 2016-05-12T03:43:39 | 2016-05-12T03:43:39 | 38,870,542 | 79 | 50 | null | 2023-02-09T10:02:42 | 2015-07-10T08:45:00 | Java | UTF-8 | Java | false | false | 6,621 | java | package org.springframework.data.gremlin.object.core.domain;
import org.springframework.data.gremlin.annotation.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static com.tinkerpop.blueprints.Direction.IN;
import static com.tinkerpop.blueprints.Direction.OUT;
import static org.springframework.data.gremlin.annotation.Enumerated.EnumeratedType.STRING;
@Vertex
public class Person extends Bipod<Area> {
public enum AWESOME {
YES,
NO
}
public enum VEHICLE {
CAR,
MOTORBIKE,
BICYLE,
SKATEBOARD,
HOVERCRAFT,
SPACESHIP
}
private String firstName;
private String lastName;
@Link(name = "lives_at", direction = OUT)
private Address address;
@LinkVia
private Set<Located> locations;
@LinkVia
private Located currentLocation;
private Boolean active;
@Enumerated(STRING)
private AWESOME awesome = AWESOME.YES;
private HashSet<VEHICLE> vehicles;
@EnumeratedCollection(HashSet.class)
private Set<VEHICLE> wantedVehicles;
@LinkVia
private Set<Likes> likes;
@Property(type = Property.SerialisableType.SERIALIZABLE)
private House owns;
private Set<House> owned;
@Property(type = Property.SerialisableType.JSON, jsonMixin = PetMxin.class)
private Set<Pet> pets;
@Property(type = Property.SerialisableType.JSON, jsonMixin = PetMxin.class)
private Pet favouritePet;
@Dynamic(name="Randoms", linkName = "has_random")
private Map<String, Object> randoms;
@Dynamic(name = "OtherStuff", linkName = "has_other_stuff")
private Map<String, Object> otherStuff;
public Person() {
}
public Person(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public Person(String firstName, String lastName, Address address, Boolean active) {
this(firstName, lastName, address, active, new HashMap<String, Object>());
}
public Person(String firstName, String lastName, Address address, Boolean active, Map<String, Object> randoms) {
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.active = active;
if (address != null) {
address.getPeople().add(this);
}
this.randoms = randoms;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Boolean getActive() {
return active;
}
public void setActive(Boolean active) {
this.active = active;
}
public Set<Located> getLocations() {
return locations;
}
public void setLocations(Set<Located> locations) {
this.locations = locations;
}
public AWESOME getAwesome() {
return awesome;
}
public void setAwesome(AWESOME awesome) {
this.awesome = awesome;
}
public Located getCurrentLocation() {
return currentLocation;
}
public void setCurrentLocation(Located currentLocation) {
this.currentLocation = currentLocation;
}
public Set<VEHICLE> getVehicles() {
return vehicles;
}
public void addVehicle(VEHICLE vehicle) {
if (vehicles == null) {
vehicles = new HashSet<>();
}
vehicles.add(vehicle);
}
public Set<VEHICLE> getWantedVehicles() {
return wantedVehicles;
}
public void addWantedVehicle(VEHICLE vehicle) {
if (wantedVehicles == null) {
wantedVehicles = new HashSet<>();
}
wantedVehicles.add(vehicle);
}
public Set<Likes> getLikes() {
if (likes == null) {
likes = new HashSet<Likes>();
}
return likes;
}
public House getOwns() {
return owns;
}
public void setOwns(House owns) {
this.owns = owns;
}
public Set<House> getOwned() {
if (owned == null) {
owned = new HashSet<House>();
}
return owned;
}
public Set<Pet> getPets() {
if (pets == null) {
pets = new HashSet<>();
}
return pets;
}
public Pet getFavouritePet() {
return favouritePet;
}
public void setFavouritePet(Pet favouritePet) {
this.favouritePet = favouritePet;
}
public Map<String, Object> getRandoms() {
return randoms;
}
public void setRandoms(Map<String, Object> randoms) {
this.randoms = randoms;
}
public Map<String, Object> getOtherStuff() {
return otherStuff;
}
public void setOtherStuff(Map<String, Object> otherStuff) {
this.otherStuff = otherStuff;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Person{");
sb.append(", firstName='").append(firstName).append('\'');
sb.append(", lastName='").append(lastName).append('\'');
sb.append(", active=").append(active);
sb.append(", awesome=").append(awesome);
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Person person = (Person) o;
if (firstName != null ? !firstName.equals(person.firstName) : person.firstName != null) {
return false;
}
if (lastName != null ? !lastName.equals(person.lastName) : person.lastName != null) {
return false;
}
if (active != null ? !active.equals(person.active) : person.active != null) {
return false;
}
return awesome == person.awesome;
}
@Override
public int hashCode() {
int result = 10;
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (active != null ? active.hashCode() : 0);
result = 31 * result + (awesome != null ? awesome.hashCode() : 0);
return result;
}
}
| [
"mail@grahamwebber.com"
] | mail@grahamwebber.com |
4bf291f7ad304396d85c8909d405d7301754d236 | 59999d306075d381015f84b7be31cbbf2b509000 | /src/main/java/designpattern/proxy/dynamicproxy/Client.java | b0dac7aa5882eb81d202a54d9e8d71b3bfdfea77 | [] | no_license | LuckyShawn/studyDemo | dfee6f7bc97e2890a7db683ec22e9522eaa048d9 | 1c1c4f9e48d44bd50d178f4ee0371b94bd17c8da | refs/heads/master | 2022-08-16T04:18:45.777236 | 2022-08-05T07:46:51 | 2022-08-05T07:46:51 | 164,975,245 | 1 | 0 | null | 2022-06-17T03:37:26 | 2019-01-10T02:32:18 | JavaScript | UTF-8 | Java | false | false | 571 | java | package designpattern.proxy.dynamicproxy;
import java.lang.reflect.Proxy;
/**
* @Description 动态创建代理类调用明星唱歌方法
* @Author shawn
* @create 2019/3/6 0006
*/
public class Client {
public static void main(String[] args){
Star star = new RealStar();
StarHandler starHandler = new StarHandler(star);
//通过类加载器,明星接口,动态代理处理器
Star proxy = (Star) Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(), new Class[]{Star.class}, starHandler);
proxy.sing();
}
}
| [
"LuckyShawn@foxmail.com"
] | LuckyShawn@foxmail.com |
e415f0fc00951836a2232ed84283197af58a80ee | 94450a3fcd41bc472a84d7199a14f4e49f1d7c9b | /src/main/java/com/store/controller/commands/CartCommand.java | 38bb983c8203a434e0cb6b36eab8f639300357f9 | [] | no_license | AlexBringston/Online-Store-Java-Servlet | 93094a6977a366597f9357e75adc9e244ca3d817 | a52e5088f113617ced8dab9e346755fc781c389c | refs/heads/master | 2023-05-22T21:41:55.756419 | 2021-06-15T11:50:36 | 2021-06-15T11:50:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,744 | java | package com.store.controller.commands;
import com.store.controller.commands.products.ProductListCommand;
import com.store.model.entity.OrderItem;
import com.store.model.exception.DatabaseException;
import com.store.model.service.ProductService;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
/**
* Cart command.
* This command implements functionality of operations with cart. There are multiple actions which give user
* opportunity to delete a product from cart, to create an order or to simply get to the cart page.
*
* @author Alexander Mulyk
* @since 2021-06-14
*/
public class CartCommand implements Command{
/**
* Local variable to use product service in command
*/
private final ProductService productService;
/**
* Logger instance to control proper work
*/
private static final Logger log = Logger.getLogger(ProductListCommand.class);
/**
* Constructor, which initializes productService variable
* @param productService - product service instance
*/
public CartCommand(ProductService productService) {
this.productService = productService;
}
/**
* Implementation of execute command of Command interface. Depending on action, returns either page path, on which
* user can make order, or delete a product from cart.
* @param request HttpServletRequest instance
* @param response HttpServletResponse instance
* @return path to the page
* @throws DatabaseException if service methods get errors
*/
@Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws DatabaseException {
String action = request.getParameter("action");
String forward = null;
if (action == null) {
forward = "/WEB-INF/shopping-cart.jsp";
} else {
if (action.equalsIgnoreCase("buy")) {
forward = doBuyAction(request);
} else if (action.equalsIgnoreCase("remove")) {
forward = doRemoveAction(request);
}
}
return forward;
}
/**
* Method to implement functionality of remove product action, which gets a cart from current session, looks for
* product by index and removes it, after that sets new cart to the session.
* @param request HttpServletRequest instance
* @return redirect path to the cart
*/
protected String doRemoveAction(HttpServletRequest request) {
HttpSession session = request.getSession();
List<OrderItem> cart = (List<OrderItem>)session.getAttribute("cart");
int index = CommandUtils.isExisting(Integer.parseInt(request.getParameter("id")), cart);
cart.remove(index);
session.setAttribute("cart", cart);
return "redirect:/cart";
}
/**
* Method to implement functionality of creating an order, by checking cart in session and, if it's not set yet,
* creating new cart, adding product and setting back to session. If the cart has anything in it, it will be read
* as list, given product will be added to it. After that new list will be set in session. In case of this action
* user will be redirected to the page where 'buy' button was clicked.
* @param request HttpServletRequest instance
* @return redirect path to the cart
*/
protected String doBuyAction(HttpServletRequest request) throws DatabaseException {
HttpSession session = request.getSession();
String locale = CommandUtils.checkForLocale(request);
if (session.getAttribute("cart") == null) {
List<OrderItem> cart = new ArrayList<>();
int id = Integer.parseInt(request.getParameter("id"));
cart.add(new OrderItem(productService.getProductById(id, locale),1));
session.setAttribute("cart", cart);
} else {
List<OrderItem> cart = (List<OrderItem>)session.getAttribute("cart");
int index = CommandUtils.isExisting(Integer.parseInt(request.getParameter("id")), cart);
if (index == -1) {
cart.add(new OrderItem(productService.getProductById(Integer.parseInt(request.getParameter("id")),
locale),1));
} else {
int quantity = cart.get(index).getQuantity() + 1;
cart.get(index).setQuantity(quantity);
}
session.setAttribute("cart", cart);
}
return "redirect:"+request.getHeader("referer").substring(request.getHeader("referer").indexOf("/products"));
}
}
| [
"alexander11mulyk@gmail.com"
] | alexander11mulyk@gmail.com |
baecc4f30815af50254f839214394a0cfcc85885 | 5741045375dcbbafcf7288d65a11c44de2e56484 | /reddit-decompilada/com/reddit/datalibrary/frontpage/service/api/UploadService$$Lambda$0.java | e8bdeb04bcffd48ec689138cbc0b73d889251f68 | [] | no_license | miarevalo10/ReporteReddit | 18dd19bcec46c42ff933bb330ba65280615c281c | a0db5538e85e9a081bf268cb1590f0eeb113ed77 | refs/heads/master | 2020-03-16T17:42:34.840154 | 2018-05-11T10:16:04 | 2018-05-11T10:16:04 | 132,843,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package com.reddit.datalibrary.frontpage.service.api;
import java.util.concurrent.Callable;
final /* synthetic */ class UploadService$$Lambda$0 implements Callable {
private final UploadService arg$1;
private final String arg$2;
private final String arg$3;
UploadService$$Lambda$0(UploadService uploadService, String str, String str2) {
this.arg$1 = uploadService;
this.arg$2 = str;
this.arg$3 = str2;
}
public final Object call() {
return this.arg$1.lambda$getFileUploadLease$0$UploadService(this.arg$2, this.arg$3);
}
}
| [
"mi.arevalo10@uniandes.edu.co"
] | mi.arevalo10@uniandes.edu.co |
99cae2f3f0f56a698b7605408cf0c84464198198 | 146e23b52f39a83ad6d0fdc93ebefe745029a319 | /src/main/java/com/MADProductions/MADProductions/Repository/DetailsRepository.java | aa6991f8821aef0010db1dba5f542e7cbd1b71f7 | [] | no_license | arfas/spring-batch | 3dddc56b08516deb6f6966d73bc5802531f3730e | 341acb066a6b4aadd8d1ca8dcf06b31a6e36f65b | refs/heads/master | 2023-03-26T08:52:15.594811 | 2021-03-27T18:51:38 | 2021-03-27T18:51:38 | 349,919,189 | 0 | 0 | null | 2021-03-27T18:51:39 | 2021-03-21T06:37:25 | Java | UTF-8 | Java | false | false | 253 | java | package com.MADProductions.MADProductions.Repository;
import com.MADProductions.MADProductions.model.Details;
import org.springframework.data.jpa.repository.JpaRepository;
public interface DetailsRepository extends JpaRepository<Details,Integer> {
}
| [
"arfas@ymail.com"
] | arfas@ymail.com |
941acc2360f3560df43612d17362bb97d73c8591 | ad5268789124e1a412ca34f68dc89bd872ba228b | /backend/src/main/java/net/es/oscars/resv/beans/DesignResponse.java | 0da9280a20993b557a627845a1760446de919717 | [] | no_license | 1010101012101/oscars-newtech | 4f37ec029a0c22207aec94c221ff19555f17b92c | ab0a8c0c0d81e97127416897361f3684f4e4421d | refs/heads/master | 2020-04-15T18:18:10.128741 | 2019-01-09T17:12:16 | 2019-01-09T17:12:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package net.es.oscars.resv.beans;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.es.oscars.resv.ent.Design;
import java.time.Instant;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(suppressConstructorProperties=true)
public class DesignResponse {
private Design design;
private List<String> errors;
private boolean valid;
} | [
"h8XntUEBNae6"
] | h8XntUEBNae6 |
b940e66e2eb43f2561b362490176c666a00bf233 | ea6e3c324cf36d9b59a14598bb619a7a8f14329e | /addons/jobs/automatiko-jobs-api/src/main/java/io/automatiko/engine/jobs/api/Job.java | db800fc76d86528777712a284da781a8d68522a6 | [
"Apache-2.0"
] | permissive | automatiko-io/automatiko-engine | 9eaf3a8f5945e645ca704aa317c97c32ea4011da | af7e315d73895798b8b8bdd0fa5d7fcce64d289d | refs/heads/main | 2023-08-24T21:25:17.045726 | 2023-08-16T08:20:56 | 2023-08-16T08:41:53 | 332,492,696 | 60 | 7 | Apache-2.0 | 2023-09-14T00:44:40 | 2021-01-24T16:06:36 | Java | UTF-8 | Java | false | false | 5,264 | java |
package io.automatiko.engine.jobs.api;
import java.time.ZonedDateTime;
import java.util.Objects;
import java.util.StringJoiner;
/**
* Job describes the actual entity that should be scheduled and executed upon
* given expiration time. The job requires following information
* <ul>
* <li>id - unique UUID based identifier</li>
* <li>expirationTime - the time when this job should be executed</li>
* <li>callbackEndpoint - the callback endpoint (http/https) that will be
* invoked upon expiration</li>
* </ul>
*
* On top of that there are additional meta data that points the job to the
* owner - such as process instance.
* <ul>
* <li>processInstanceId - process instance that owns the job</li>
* <li>rootProcessInstanceId - root process instance that the job is part of -
* is owned as one of the subprocesses of the root process instance</li>
* <li>processId - process id of the process instance owning the job</li>
* <li>rootProcessId - root process id of the process instance that owns the
* job</li>
* </ul>
*/
public class Job {
private String id;
private ZonedDateTime expirationTime;
private Integer priority;
private String callbackEndpoint;
private String processInstanceId;
private String rootProcessInstanceId;
private String processId;
private String rootProcessId;
private Long repeatInterval;
private Integer repeatLimit;
public Job() {
}
@SuppressWarnings("squid:S00107")
public Job(String id, ZonedDateTime expirationTime, Integer priority, String callbackEndpoint,
String processInstanceId, String rootProcessInstanceId, String processId, String rootProcessId,
Long repeatInterval, Integer repeatLimit) {
this.id = id;
this.expirationTime = expirationTime;
this.priority = priority;
this.callbackEndpoint = callbackEndpoint;
this.processInstanceId = processInstanceId;
this.rootProcessInstanceId = rootProcessInstanceId;
this.processId = processId;
this.rootProcessId = rootProcessId;
this.repeatInterval = repeatInterval;
this.repeatLimit = repeatLimit;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public ZonedDateTime getExpirationTime() {
return expirationTime;
}
public void setExpirationTime(ZonedDateTime expirationTime) {
this.expirationTime = expirationTime;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public String getCallbackEndpoint() {
return callbackEndpoint;
}
public void setCallbackEndpoint(String callbackEndpoint) {
this.callbackEndpoint = callbackEndpoint;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
public String getRootProcessInstanceId() {
return rootProcessInstanceId;
}
public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
public String getProcessId() {
return processId;
}
public void setProcessId(String processId) {
this.processId = processId;
}
public String getRootProcessId() {
return rootProcessId;
}
public void setRootProcessId(String rootProcessId) {
this.rootProcessId = rootProcessId;
}
public Long getRepeatInterval() {
return repeatInterval;
}
public void setRepeatInterval(Long repeatInterval) {
this.repeatInterval = repeatInterval;
}
public Integer getRepeatLimit() {
return repeatLimit;
}
public void setRepeatLimit(Integer repeatLimit) {
this.repeatLimit = repeatLimit;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Job)) {
return false;
}
Job job = (Job) o;
return Objects.equals(getId(), job.getId()) && Objects.equals(getExpirationTime(), job.getExpirationTime())
&& Objects.equals(getPriority(), job.getPriority())
&& Objects.equals(getCallbackEndpoint(), job.getCallbackEndpoint())
&& Objects.equals(getProcessInstanceId(), job.getProcessInstanceId())
&& Objects.equals(getRootProcessInstanceId(), job.getRootProcessInstanceId())
&& Objects.equals(getProcessId(), job.getProcessId())
&& Objects.equals(getRootProcessId(), job.getRootProcessId())
&& Objects.equals(getRepeatLimit(), job.getRepeatLimit())
&& Objects.equals(getRepeatInterval(), job.getRepeatInterval());
}
@Override
public int hashCode() {
return Objects.hash(getId(), getExpirationTime(), getPriority(), getCallbackEndpoint(), getProcessInstanceId(),
getRootProcessInstanceId(), getProcessId(), getRootProcessId(), getRepeatLimit(), getRepeatInterval());
}
@Override
public String toString() {
return new StringJoiner(", ", Job.class.getSimpleName() + "[", "]").add("id='" + id + "'")
.add("expirationTime=" + expirationTime).add("priority=" + priority)
.add("callbackEndpoint='" + callbackEndpoint + "'").add("processInstanceId='" + processInstanceId + "'")
.add("rootProcessInstanceId='" + rootProcessInstanceId + "'").add("processId='" + processId + "'")
.add("rootProcessId='" + rootProcessId + "'").add("repeatInterval=" + repeatInterval)
.add("repeatLimit=" + repeatLimit).toString();
}
}
| [
"swiderski.maciej@gmail.com"
] | swiderski.maciej@gmail.com |
9143eeb78583603be390aabdce8e0c3bab05dd33 | 65215587cf1f675583624c57001380edd0cc88de | /src/main/java/com/hangdaoju/model/Company.java | 1dc93cba51e42e25cc79c6b7581738944fa175d0 | [] | no_license | liudaqiang/springBoot | b6206c338b468d39eeb9bc37ef3503bd0fe2e860 | debb3b5b625bbe8e30e1b344198bb8a7de25be66 | refs/heads/master | 2021-01-21T14:49:39.978094 | 2017-06-25T07:00:09 | 2017-06-25T07:00:09 | 95,343,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,730 | java | package com.hangdaoju.model;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Field;
/**
* 公司表
* @author l.q
*
*/
public class Company extends BaseModel{
@Id
private String id;
private String name;//公司名称/部门名称
private String address;//公司地址
private String description;//公司详细信息
@Field("company_type")
private String companyType;
@Field("parent_id")
private String parentId;//父公司
private Integer sort;//排序号
@Transient
private List<Company> companyList = new ArrayList<Company>();//子公司列表
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public List<Company> getCompanyList() {
return companyList;
}
public void setCompanyList(List<Company> companyList) {
this.companyList = companyList;
}
public String getCompanyType() {
return companyType;
}
public void setCompanyType(String companyType) {
this.companyType = companyType;
}
}
| [
"827244716@qq.com"
] | 827244716@qq.com |
fa6922e5de163d73f200d39dacdd1ba643968897 | e3850f03d1f6a443710e7ed2a589e1086490fdc7 | /.svn/pristine/a2/a2ef2dfd840ad7cdef1e02ec19164579d2daddba.svn-base | f145552ce31b79c995e543ce477c6d09f8ccf1bd | [] | no_license | Kesevin/Hdforman | 70371819ce91926fa7e716e0c24ddbf1c8f8cc28 | 7742a4c8c7dab871242fc88d3883701270875a9b | refs/heads/master | 2021-01-22T07:53:02.125834 | 2017-05-27T08:51:15 | 2017-05-27T08:51:15 | 92,584,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | package com.dgg.hdforeman.app.config;
/**
* 常量
*/
public class Constants
{
public static final String REFRESH_FRAGMENT = "refresh_fragment";
}
| [
"379352157@qq.com"
] | 379352157@qq.com | |
57bdd67d13973bf1dab119184636e67f0e694178 | ccbccbde57a2440fdd42b37085946e61be313470 | /app/src/androidTest/java/b/udacity/reshu/bakingapp/DetailActivityTest.java | abac710da7b88874babf66af7e587519e52c1728 | [] | no_license | Rratio/BakeTime | 2803474f345d98cc194811dab9ba002e427698ba | fec0d5efa1c94e01a4f48cadcb8cfe292ad954a0 | refs/heads/master | 2021-07-24T06:05:45.048894 | 2018-11-28T18:22:15 | 2018-11-28T18:22:15 | 144,585,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,917 | java | package b.udacity.reshu.bakingapp;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.test.espresso.IdlingRegistry;
import android.support.test.espresso.IdlingResource;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.rule.ActivityTestRule;
import android.view.View;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import b.udacity.reshu.bakingapp.activity.MainBakingActivity;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isAssignableFrom;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.core.AllOf.allOf;
public class DetailActivityTest {
private static final String RECIPE_NAME = "Nutella Pie";
private static final String SHORT_DESCRIPTION = "Recipe Introduction";
@Rule
public final ActivityTestRule<MainBakingActivity> mActivityTestRule =
new ActivityTestRule<>(MainBakingActivity.class);
private IdlingResource mIdlingResource;
private static Matcher<View> withIndex(final Matcher<View> matcher, final int index) {
return new TypeSafeMatcher<View>() {
int currentIndex = 0;
@Override
public void describeTo(Description description) {
description.appendText("with index: ");
description.appendValue(index);
matcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
return matcher.matches(view) && currentIndex++ == index;
}
};
}
@NonNull
private static ViewAction selectTabAtPosition(final int position) {
return new ViewAction() {
@Override
public Matcher<View> getConstraints() {
return allOf(isDisplayed(), isAssignableFrom(TabLayout.class));
}
@Override
public String getDescription() {
return "with tab at index" + String.valueOf(position);
}
@Override
public void perform(UiController uiController, View view) {
if (view instanceof TabLayout) {
TabLayout tabLayout = (TabLayout) view;
TabLayout.Tab tab = tabLayout.getTabAt(position);
if (tab != null) {
tab.select();
}
}
}
};
}
@Before
public void registerIdlingResource() {
mIdlingResource = mActivityTestRule.getActivity().getIdlingResource();
IdlingRegistry.getInstance().register(mIdlingResource);
}
@Test
public void ClickOnTabLayoutAndSeeIfViewPagerChanges() {
onView(withId(R.id.recycler_view))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));
onView(withId(R.id.ingredients_list)).check(matches(withText(RECIPE_NAME)));
onView(withIndex(withId(R.id.step_short_description), 0)).check(matches(withText(SHORT_DESCRIPTION)));
}
@After
public void unregisterIdlingResource() {
if (mIdlingResource != null) {
IdlingRegistry.getInstance().register(mIdlingResource);
}
}
}
| [
"reshu1207@gmail.com"
] | reshu1207@gmail.com |
735705865f13340dc9350c6d0a624ee370169b1f | 23dedd51881e8f722166ce390b49d6d67c277c85 | /src/com/greenhouseclient/controller/ShowGatewayListTask.java | 4a3e607820cea7220c665713877a8305242b532f | [] | no_license | icprog/GreenHouse | a67a4976a0b93486095daa705632d7d51cfd9e65 | 802b1f41fc9f847d7f2aa1e6503f26f7449ff8d3 | refs/heads/master | 2020-07-16T05:33:22.059766 | 2015-03-23T14:03:57 | 2015-03-23T14:03:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,514 | java | package com.greenhouseclient.controller;
import com.greenhouseclient.GreenHouseApplication;
import com.greenhouseclient.databean.GatewayListDataBean;
import com.greenhouseclient.network.HttpManager;
import com.greenhouseclient.util.Constants;
import com.greenhouseclient.util.L;
import android.content.Context;
import android.os.Handler;
/**
* 列出网关列表的Task
* @author RyanHu
*
*/
final class ShowGatewayListTask extends BaseTask
{
private static final int TASK_TAG = TaskConstants.SHOW_GATEWAY_TASK;
public ShowGatewayListTask(Handler handler, Context _context)
{
super(handler, _context);
}
@Override
public void run()
{
int index = 1;//页码从1开始
// 第二步登录成功,开始获取网关列表
GatewayListDataBean gatewayListDataBean = new GatewayListDataBean();
gatewayListDataBean.cid = GreenHouseApplication.cid;
gatewayListDataBean.cToken = GreenHouseApplication.cToken;
gatewayListDataBean.page = index;
gatewayListDataBean = (GatewayListDataBean) httpManager.requestServer(Constants.GwList_Url, gatewayListDataBean, true);
if(gatewayListDataBean.status.equals(Constants.Status_Success))
{
L.d("Get Gateway success!");
GreenHouseApplication.gatawayListBean = gatewayListDataBean;
sendResultMessage(TASK_TAG, gatewayListDataBean, TaskConstants.TASK_SUCCESS, 0);
}else
{
L.e("获取网关列表出错 ---->" + gatewayListDataBean.status);
sendResultMessage(TASK_TAG, gatewayListDataBean, TaskConstants.TASK_FAILED, 0);
}
}
}
| [
"241855834@qq.com"
] | 241855834@qq.com |
f278f133f9c67af37b6ae5f49799b83cb2480446 | 68328cca87f4f5272528b75035ccefdbc8f0a3f8 | /app/src/androidTest/java/com/example/jenny/bitsandpizzas/ExampleInstrumentedTest.java | 4028a0846130533f7e147929563c8659b71d77da | [] | no_license | jmbober/CardViews | 63a9a6aaf08b2c7d9e0ef83612fe3d16bd6e09ea | ec0861edec39417820e60cc44ef7fea1f227e1fb | refs/heads/master | 2021-05-08T04:47:18.424629 | 2017-10-26T19:23:03 | 2017-10-26T19:23:03 | 108,451,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.example.jenny.bitsandpizzas;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.jenny.bitsandpizzas", appContext.getPackageName());
}
}
| [
"jmbober@svsu.edu"
] | jmbober@svsu.edu |
00bdfbb85f8863ce7efe406aa2eeb0e999c5fb39 | ca23001fc62f8ba8f7844a82f10455d390797099 | /app/src/androidTest/java/hapapps/bigcow/ExampleInstrumentedTest.java | 352fc14321a54066a0dd3839e12b6ffec5d54049 | [] | no_license | AvniFatehpuria/BigCow | 29680d4fe33f36427af780bb9033813336a136d3 | 05c9e77ca9e9247b66bcb1a334156663c1fac2bf | refs/heads/master | 2021-05-01T05:29:14.474647 | 2017-09-19T14:48:38 | 2017-09-19T14:48:38 | 79,756,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | package hapapps.bigcow;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("hapapps.bigcow", appContext.getPackageName());
}
}
| [
"afatehp1@Danawell-1.local"
] | afatehp1@Danawell-1.local |
e3612a697002c98d74d89fd2df10d01fd5cdd698 | 2a7d62cd07e269b404bfa22ac7b70a2e26d9e813 | /i9-defence-parent/i9-defence-dao/src/main/java/i9/defence/platform/dao/vo/ApplyDto.java | 4d0e1bdeb8b72e52f4be5078509797774781b3eb | [] | no_license | vinohsueh/i9-defence-parent | 61b3a15c79e89e993e2025473ce288b84b55f895 | 709d34e820bb0671e0338210d488ce11cf12a25f | refs/heads/master | 2023-01-05T17:09:15.764520 | 2019-05-26T01:08:50 | 2019-05-26T01:08:50 | 116,075,038 | 1 | 3 | null | 2022-12-10T01:07:27 | 2018-01-03T01:17:51 | Java | UTF-8 | Java | false | false | 1,163 | java | package i9.defence.platform.dao.vo;
/**
* ApplyDto
* @ClassName: ApplyDto
* @Description: TODO
* @author: luobo
* @date: 2018年4月18日 上午9:32:51
*/
public class ApplyDto {
/**
* 申请类型(0:删除项目,1:删除设备)
*/
private Integer type;
/**
* 申请状态(0:未处理,1:已处理)
*/
private Integer state;
/**
* 类型
*/
private Integer destriId;
//数据库ORDER BY 排序
private String orderByClause;
public String getOrderByClause() {
return orderByClause;
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Integer getDestriId() {
return destriId;
}
public void setDestriId(Integer destriId) {
this.destriId = destriId;
}
}
| [
"877783692@qq.com"
] | 877783692@qq.com |
490ba76b5156c72402a9958c491fda83da8bc4cd | eb6fb198c9058a4b1e4c5b5af27c9fcb4bc9c535 | /spring2/src/main/java/com/dharma/springmvc/model/Product.java | 0a82d5fa75d1a92a918b5b2cd799155aeca6de6b | [] | no_license | slicing/CatView | 5d78517e7b64ee26f300088c9e3133ec2b06d22a | 14a784d57c45c7f42466b6bdf43bd2fbd58d8c2a | refs/heads/master | 2021-07-18T23:21:29.458392 | 2018-11-28T09:42:36 | 2018-11-28T09:42:36 | 143,260,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,123 | java | package com.dharma.springmvc.model;
public class Product {
private long id;
private String name;
private double price;
private int count;
public Product(long id, String name, double price, int count) {
this.id = id;
this.name = name;
this.price = price;
this.count = count;
}
public Product() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
@Override
public String toString() {
return "Product{" +
"id=" + id +
", name='" + name + '\'' +
", price=" + price +
", count=" + count +
'}';
}
}
| [
"sunjiaoyong@xiyouant.org"
] | sunjiaoyong@xiyouant.org |
42281aead8600312f4c17425ab47b1a41156b23c | 8947225473279b562962806a47a04f8fb856927e | /android-master/AM028_View/app/src/main/java/com/example/genji/am028_view/RandomUtils.java | bf40c93083650aafb595107e4d2439f329c72452 | [] | no_license | ambrosdavid/Informatica | 2ae33169800de7fc41fd2566254702f9e0bed236 | b9e571e88e744ea3288c2d938618175917008c3d | refs/heads/master | 2021-10-22T00:01:04.493231 | 2018-12-19T00:42:24 | 2018-12-19T00:42:24 | 110,166,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.example.genji.am028_view;
import java.util.Random;
/**
* Created by genji on 2/25/16.
*/
public class RandomUtils {
private static Random r = new Random();
public static int randomInt(int range) {
return(r.nextInt(range));
}
/** Returns a random index of an array. */
public static int randomIndex(Object[] array) {
return(randomInt(array.length));
}
/** Returns a random element from an array. Uses generics, so no typecast is
* required for the return value.
*/
public static <T> T randomElement(T[] array) {
return(array[randomIndex(array)]);
}
/** Returns a random float between 0 (inclusive) and n (exclusive). */
public static float randomFloat(int n) {
return((float)Math.random()*n);
}
}
| [
"ambrosdavid99@gmail.com"
] | ambrosdavid99@gmail.com |
8910b1f1204ddcc3003cac08c455b31cf43b0db1 | a3e7a42292886e24a6ae59142a7f2c20d873470c | /src/main/java/com/skmm/app/example/dao/UserDAOImpl.java | 9e963ca29f91a9f163deef0023d4cc5d6ce1a5ca | [] | no_license | sanu767/student-portal | 429b0765dd8b3f2c10560c429dafbf13edc1563c | f9fd47b9bf2165122b42a083448ebb5dc562e6ff | refs/heads/master | 2020-12-25T00:55:05.394379 | 2013-04-14T11:02:07 | 2013-04-14T11:02:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.skmm.app.example.dao;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.skmm.app.example.model.User;
public class UserDAOImpl extends HibernateDaoSupport implements UserDAO{
@Override
public User findByCode(String code) {
List findByNamedQuery = getHibernateTemplate().loadAll(User.class);
System.out.println(findByNamedQuery);
return (User) findByNamedQuery.get(0);
}
}
| [
"mksmsr@gmail.com"
] | mksmsr@gmail.com |
cdd5e5262b62084a52d7f4f1d29f2dfe2b51f492 | c244119362dcd5758f479c9c77ea43f003070763 | /src/main/java/spg/lgdev/uhc/nms/v1_8_R3/Sit1_8.java | c44ad99dfda825f53eaf5e1be49347eed4650a43 | [] | no_license | Mirez-Network/iUHC | 50b41887429eca5687c5299064f08fb74fea7f41 | 85f61fe8948de667a24c671e71649231ff7db3f2 | refs/heads/master | 2022-03-16T22:29:08.731202 | 2019-11-30T08:29:28 | 2019-11-30T08:29:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,848 | java | package spg.lgdev.uhc.nms.v1_8_R3;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import spg.lgdev.uhc.nms.common.SitHandler;
import spg.lgdev.uhc.util.FastUUID;
import net.minecraft.server.v1_8_R3.EntityPig;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
public class Sit1_8 implements SitHandler {
public static Map<String, Integer> horses = new HashMap<>();
@Override
public void spawn(final Player p, final Location loc) {
final Location l = p.getLocation();
final EntityPig horse = new EntityPig(((CraftWorld) l.getWorld()).getHandle());
horse.setLocation(l.getX(), l.getY(), l.getZ(), 0, 0);
horse.setInvisible(true);
final PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(horse);
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
horses.put(FastUUID.toString(p.getUniqueId()), horse.getId());
final PacketPlayOutAttachEntity sit = new PacketPlayOutAttachEntity(0,
((CraftPlayer) p).getHandle(), horse);
((CraftPlayer) p).getHandle().playerConnection.sendPacket(sit);
}
@Override
public void removeHorses(final Player p) {
final String uuid = FastUUID.toString(p.getUniqueId());
if (horses.containsKey(uuid)) {
final PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(horses.get(uuid));
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
horses.remove(uuid);
}
}
@Override
public boolean isSet(final UUID u) {
return horses.containsKey(FastUUID.toString(u));
}
} | [
"lee20040919@gmail.com"
] | lee20040919@gmail.com |
51fb3e2f8341bff321d0fdfac68eea655b28b51c | 5e224ff6d555ee74e0fda6dfa9a645fb7de60989 | /database/src/main/java/adila/db/fji13_isw13f.java | e5f7ea43ce35c8609fef13817eee53e970826d31 | [
"MIT"
] | permissive | karim/adila | 8b0b6ba56d83f3f29f6354a2964377e6197761c4 | 00f262f6d5352b9d535ae54a2023e4a807449faa | refs/heads/master | 2021-01-18T22:52:51.508129 | 2016-11-13T13:08:04 | 2016-11-13T13:08:04 | 45,054,909 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | // This file is automatically generated.
package adila.db;
/*
* Fujitsu ARROWS Z ISW13F
*
* DEVICE: FJI13
* MODEL: ISW13F
*/
final class fji13_isw13f {
public static final String DATA = "Fujitsu|ARROWS Z ISW13F|";
}
| [
"keldeeb@gmail.com"
] | keldeeb@gmail.com |
c6e7ec8ddfc960ae1bbb7306202baa8844b1f7ca | 96585db21c78194dc9cb7c288d0c06ed5cbff4e9 | /app/src/main/java/com/example/administrator/report/Report_Ar_Dispose.java | 833bc8a7f471c31ef29102a763c8b3d17cdc229c | [] | no_license | yayo292916/tantan | a01130bb3e7e2e03dae1374beaefbb32a36674f1 | 2e3c12cc51c07696e3dcd296db9797b57ea7d2da | refs/heads/master | 2021-01-22T07:52:42.463149 | 2017-05-27T09:02:59 | 2017-05-27T09:02:59 | 92,583,441 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | package com.example.administrator.report;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
/**
* Created by Administrator on 2017/5/16.
*/
public class Report_Ar_Dispose extends AppCompatActivity {
private ImageView rp_ar_di_back;
private Button rp_sure;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.rp_article_dispose);
ActivityStack.getInstance().addActivity(this);
initView();
viewListener();
}
private void viewListener() {
rp_ar_di_back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
rp_sure.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityStack.getInstance().finishAllActivity();
}
});
}
private void initView() {
rp_sure= (Button) findViewById(R.id.rp_sure);
rp_ar_di_back= (ImageView) findViewById(R.id.rp_ar_di_back);
}
} | [
"824343111@qq.com"
] | 824343111@qq.com |
fb736dbea99e0c2626ac1b44dc6b3f7067a4006c | 29b72f6cc5730f990262cb24a336adf8d13a5a31 | /sdk/src/test/java/com/finbourne/lusid/model/EquitySwapTest.java | 074c1881dabe1f130143f15c8d08cce011bce02f | [
"MIT"
] | permissive | bogdanLicaFinbourne/lusid-sdk-java-preview | 0c956b453f5dd37888f11e0128d8a2e32abda236 | 3e6d1ed20bf398fafed58364360895a1f2f0476f | refs/heads/master | 2023-04-06T06:21:49.057202 | 2021-04-19T18:50:06 | 2021-04-19T18:50:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,644 | java | /*
* LUSID API
* # Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages and frameworks: * [C#](https://github.com/finbourne/lusid-sdk-csharp) * [Java](https://github.com/finbourne/lusid-sdk-java) * [JavaScript](https://github.com/finbourne/lusid-sdk-js) * [Python](https://github.com/finbourne/lusid-sdk-python) * [Angular](https://github.com/finbourne/lusid-sdk-angular) # Data Model The LUSID API has a relatively lightweight but extremely powerful data model. One of the goals of LUSID was not to enforce on clients a single rigid data model but rather to provide a flexible foundation onto which clients can map their own data models. The core entities in LUSID provide a minimal structure and set of relationships, and the data model can be extended using Properties. The LUSID data model is exposed through the LUSID APIs. The APIs provide access to both business objects and the meta data used to configure the systems behaviours. The key business entities are: - * **Portfolios** A portfolio is a container for transactions and holdings (a **Transaction Portfolio**) or constituents (a **Reference Portfolio**). * **Derived Portfolios**. Derived Portfolios allow Portfolios to be created based on other Portfolios, by overriding or adding specific items. * **Holdings** A Holding is a quantity of an Instrument or a balance of cash within a Portfolio. Holdings can only be adjusted via Transactions. * **Transactions** A Transaction is an economic event that occurs in a Portfolio, causing its holdings to change. * **Corporate Actions** A corporate action is a market event which occurs to an Instrument and thus applies to all portfolios which holding the instrument. Examples are stock splits or mergers. * **Constituents** A constituent is a record in a Reference Portfolio containing an Instrument and an associated weight. * **Instruments** An instrument represents a currency, tradable instrument or OTC contract that is attached to a transaction and a holding. * **Properties** All major entities allow additional user defined properties to be associated with them. For example, a Portfolio manager may be associated with a portfolio. Meta data includes: - * **Transaction Types** Transactions are booked with a specific transaction type. The types are client defined and are used to map the Transaction to a series of movements which update the portfolio holdings. * **Properties Types** Types of user defined properties used within the system. ## Scope All data in LUSID is segregated at the client level. Entities in LUSID are identifiable by a unique code. Every entity lives within a logical data partition known as a Scope. Scope is an identity namespace allowing two entities with the same unique code to co-exist within individual address spaces. For example, prices for equities from different vendors may be uploaded into different scopes such as `client/vendor1` and `client/vendor2`. A portfolio may then be valued using either of the price sources by referencing the appropriate scope. LUSID Clients cannot access scopes of other clients. ## Instruments LUSID has its own built-in instrument master which you can use to master your own instrument universe. Every instrument must be created with one or more unique market identifiers, such as [FIGI](https://openfigi.com/). For any non-listed instruments (eg OTCs), you can upload an instrument against a custom ID of your choosing. In addition, LUSID will allocate each instrument a unique 'LUSID instrument identifier'. The LUSID instrument identifier is what is used when uploading transactions, holdings, prices, etc. The API exposes an `instrument/lookup` endpoint which can be used to lookup these LUSID identifiers using their market identifiers. Cash can be referenced using the ISO currency code prefixed with \"`CCY_`\" e.g. `CCY_GBP` ## Instrument Data Instrument data can be uploaded to the system using the [Instrument Properties](#operation/UpsertInstrumentsProperties) endpoint. | Field|Type|Description | | ---|---|--- | | Key|propertykey|The key of the property. This takes the format {domain}/{scope}/{code} e.g. 'Instrument/system/Name' or 'Transaction/strategy/quantsignal'. | | Value|string|The value of the property. | | EffectiveFrom|datetimeoffset|The effective datetime from which the property is valid. | | EffectiveUntil|datetimeoffset|The effective datetime until which the property is valid. If not supplied this will be valid indefinitely, or until the next 'effectiveFrom' datetime of the property. | ## Transaction Portfolios Portfolios are the top-level entity containers within LUSID, containing transactions, corporate actions and holdings. The transactions build up the portfolio holdings on which valuations, analytics profit & loss and risk can be calculated. Properties can be associated with Portfolios to add in additional data. Portfolio properties can be changed over time, for example to allow a Portfolio Manager to be linked with a Portfolio. Additionally, portfolios can be securitised and held by other portfolios, allowing LUSID to perform \"drill-through\" into underlying fund holdings ### Derived Portfolios LUSID also allows for a portfolio to be composed of another portfolio via derived portfolios. A derived portfolio can contain its own transactions and also inherits any transactions from its parent portfolio. Any changes made to the parent portfolio are automatically reflected in derived portfolio. Derived portfolios in conjunction with scopes are a powerful construct. For example, to do pre-trade what-if analysis, a derived portfolio could be created a new namespace linked to the underlying live (parent) portfolio. Analysis can then be undertaken on the derived portfolio without affecting the live portfolio. ### Transactions A transaction represents an economic activity against a Portfolio. Transactions are processed according to a configuration. This will tell the LUSID engine how to interpret the transaction and correctly update the holdings. LUSID comes with a set of transaction types you can use out of the box, or you can configure your own set(s) of transactions. For more details see the [LUSID Getting Started Guide for transaction configuration.](https://support.lusid.com/configuring-transaction-types) | Field|Type|Description | | ---|---|--- | | TransactionId|string|The unique identifier for the transaction. | | Type|string|The type of the transaction e.g. 'Buy', 'Sell'. The transaction type should have been pre-configured via the System Configuration API endpoint. If it hasn't been pre-configured the transaction will still be updated or inserted however you will be unable to generate the resultant holdings for the portfolio that contains this transaction as LUSID does not know how to process it. | | InstrumentIdentifiers|map|A set of instrument identifiers to use to resolve the transaction to a unique instrument. | | TransactionDate|dateorcutlabel|The date of the transaction. | | SettlementDate|dateorcutlabel|The settlement date of the transaction. | | Units|decimal|The number of units transacted in the associated instrument. | | TransactionPrice|transactionprice|The price for each unit of the transacted instrument in the transaction currency. | | TotalConsideration|currencyandamount|The total value of the transaction in the settlement currency. | | ExchangeRate|decimal|The exchange rate between the transaction and settlement currency (settlement currency being represented by the TotalConsideration.Currency). For example if the transaction currency is in USD and the settlement currency is in GBP this this the USD/GBP rate. | | TransactionCurrency|currency|The transaction currency. | | Properties|map|Set of unique transaction properties and associated values to store with the transaction. Each property must be from the 'Transaction' domain. | | CounterpartyId|string|The identifier for the counterparty of the transaction. | | Source|string|The source of the transaction. This is used to look up the appropriate transaction group set in the transaction type configuration. | From these fields, the following values can be calculated * **Transaction value in Transaction currency**: TotalConsideration / ExchangeRate * **Transaction value in Portfolio currency**: Transaction value in Transaction currency * TradeToPortfolioRate #### Example Transactions ##### A Common Purchase Example Three example transactions are shown in the table below. They represent a purchase of USD denominated IBM shares within a Sterling denominated portfolio. * The first two transactions are for separate buy and fx trades * Buying 500 IBM shares for $71,480.00 * A spot foreign exchange conversion to fund the IBM purchase. (Buy $71,480.00 for £54,846.60) * The third transaction is an alternate version of the above trades. Buying 500 IBM shares and settling directly in Sterling. | Column | Buy Trade | Fx Trade | Buy Trade with foreign Settlement | | ----- | ----- | ----- | ----- | | TransactionId | FBN00001 | FBN00002 | FBN00003 | | Type | Buy | FxBuy | Buy | | InstrumentIdentifiers | { \"figi\", \"BBG000BLNNH6\" } | { \"CCY\", \"CCY_USD\" } | { \"figi\", \"BBG000BLNNH6\" } | | TransactionDate | 2018-08-02 | 2018-08-02 | 2018-08-02 | | SettlementDate | 2018-08-06 | 2018-08-06 | 2018-08-06 | | Units | 500 | 71480 | 500 | | TransactionPrice | 142.96 | 1 | 142.96 | | TradeCurrency | USD | USD | USD | | ExchangeRate | 1 | 0.7673 | 0.7673 | | TotalConsideration.Amount | 71480.00 | 54846.60 | 54846.60 | | TotalConsideration.Currency | USD | GBP | GBP | | Trade/default/TradeToPortfolioRate* | 0.7673 | 0.7673 | 0.7673 | [* This is a property field] ##### A Forward FX Example LUSID has a flexible transaction modelling system, meaning there are a number of different ways of modelling forward fx trades. The default LUSID transaction types are FwdFxBuy and FwdFxSell. Using these transaction types, LUSID will generate two holdings for each Forward FX trade, one for each currency in the trade. An example Forward Fx trade to sell GBP for USD in a JPY-denominated portfolio is shown below: | Column | Forward 'Sell' Trade | Notes | | ----- | ----- | ---- | | TransactionId | FBN00004 | | | Type | FwdFxSell | | | InstrumentIdentifiers | { \"Instrument/default/Currency\", \"GBP\" } | | | TransactionDate | 2018-08-02 | | | SettlementDate | 2019-02-06 | Six month forward | | Units | 10000.00 | Units of GBP | | TransactionPrice | 1 | | | TradeCurrency | GBP | Currency being sold | | ExchangeRate | 1.3142 | Agreed rate between GBP and USD | | TotalConsideration.Amount | 13142.00 | Amount in the settlement currency, USD | | TotalConsideration.Currency | USD | Settlement currency | | Trade/default/TradeToPortfolioRate | 142.88 | Rate between trade currency, GBP and portfolio base currency, JPY | Please note that exactly the same economic behaviour could be modelled using the FwdFxBuy Transaction Type with the amounts and rates reversed. ### Holdings A holding represents a position in an instrument or cash on a given date. | Field|Type|Description | | ---|---|--- | | InstrumentUid|string|The unqiue Lusid Instrument Id (LUID) of the instrument that the holding is in. | | SubHoldingKeys|map|The sub-holding properties which identify the holding. Each property will be from the 'Transaction' domain. These are configured when a transaction portfolio is created. | | Properties|map|The properties which have been requested to be decorated onto the holding. These will be from the 'Instrument' or 'Holding' domain. | | HoldingType|string|The type of the holding e.g. Position, Balance, CashCommitment, Receivable, ForwardFX etc. | | Units|decimal|The total number of units of the holding. | | SettledUnits|decimal|The total number of settled units of the holding. | | Cost|currencyandamount|The total cost of the holding in the transaction currency. | | CostPortfolioCcy|currencyandamount|The total cost of the holding in the portfolio currency. | | Transaction|transaction|The transaction associated with an unsettled holding. | | Currency|currency|The holding currency. | ## Corporate Actions Corporate actions are represented within LUSID in terms of a set of instrument-specific 'transitions'. These transitions are used to specify the participants of the corporate action, and the effect that the corporate action will have on holdings in those participants. ### Corporate Action | Field|Type|Description | | ---|---|--- | | CorporateActionCode|code|The unique identifier of this corporate action | | Description|string| | | AnnouncementDate|datetimeoffset|The announcement date of the corporate action | | ExDate|datetimeoffset|The ex date of the corporate action | | RecordDate|datetimeoffset|The record date of the corporate action | | PaymentDate|datetimeoffset|The payment date of the corporate action | | Transitions|corporateactiontransition[]|The transitions that result from this corporate action | ### Transition | Field|Type|Description | | ---|---|--- | | InputTransition|corporateactiontransitioncomponent|Indicating the basis of the corporate action - which security and how many units | | OutputTransitions|corporateactiontransitioncomponent[]|What will be generated relative to the input transition | ### Example Corporate Action Transitions #### A Dividend Action Transition In this example, for each share of IBM, 0.20 units (or 20 pence) of GBP are generated. | Column | Input Transition | Output Transition | | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"ccy\" : \"CCY_GBP\" } | | Units Factor | 1 | 0.20 | | Cost Factor | 1 | 0 | #### A Split Action Transition In this example, for each share of IBM, we end up with 2 units (2 shares) of IBM, with total value unchanged. | Column | Input Transition | Output Transition | | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | | Units Factor | 1 | 2 | | Cost Factor | 1 | 1 | #### A Spinoff Action Transition In this example, for each share of IBM, we end up with 1 unit (1 share) of IBM and 3 units (3 shares) of Celestica, with 85% of the value remaining on the IBM share, and 5% in each Celestica share (15% total). | Column | Input Transition | Output Transition 1 | Output Transition 2 | | ----- | ----- | ----- | ----- | | Instrument Identifiers | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000BLNNH6\" } | { \"figi\" : \"BBG000HBGRF3\" } | | Units Factor | 1 | 1 | 3 | | Cost Factor | 1 | 0.85 | 0.15 | ## Reference Portfolios Reference portfolios are portfolios that contain constituents with weights. They are designed to represent entities such as indices and benchmarks. ### Constituents | Field|Type|Description | | ---|---|--- | | InstrumentIdentifiers|map|Unique instrument identifiers | | InstrumentUid|string|LUSID's internal unique instrument identifier, resolved from the instrument identifiers | | Currency|decimal| | | Weight|decimal| | | FloatingWeight|decimal| | ## Portfolio Groups Portfolio groups allow the construction of a hierarchy from portfolios and groups. Portfolio operations on the group are executed on an aggregated set of portfolios in the hierarchy. For example: * Global Portfolios _(group)_ * APAC _(group)_ * Hong Kong _(portfolio)_ * Japan _(portfolio)_ * Europe _(group)_ * France _(portfolio)_ * Germany _(portfolio)_ * UK _(portfolio)_ In this example **Global Portfolios** is a group that consists of an aggregate of **Hong Kong**, **Japan**, **France**, **Germany** and **UK** portfolios. ## Properties Properties are key-value pairs that can be applied to any entity within a domain (where a domain is `trade`, `portfolio`, `security` etc). Properties must be defined before use with a `PropertyDefinition` and can then subsequently be added to entities. ## Schema A detailed description of the entities used by the API and parameters for endpoints which take a JSON document can be retrieved via the `schema` endpoint. ## Meta data The following headers are returned on all responses from LUSID | Name | Purpose | | --- | --- | | lusid-meta-duration | Duration of the request | | lusid-meta-success | Whether or not LUSID considered the request to be successful | | lusid-meta-requestId | The unique identifier for the request | | lusid-schema-url | Url of the schema for the data being returned | | lusid-property-schema-url | Url of the schema for any properties | # Error Codes | Code|Name|Description | | ---|---|--- | | <a name=\"-10\">-10</a>|Server Configuration Error| | | <a name=\"-1\">-1</a>|Unknown error|An unexpected error was encountered on our side. | | <a name=\"102\">102</a>|Version Not Found| | | <a name=\"103\">103</a>|Api Rate Limit Violation| | | <a name=\"104\">104</a>|Instrument Not Found| | | <a name=\"105\">105</a>|Property Not Found| | | <a name=\"106\">106</a>|Portfolio Recursion Depth| | | <a name=\"108\">108</a>|Group Not Found| | | <a name=\"109\">109</a>|Portfolio Not Found| | | <a name=\"110\">110</a>|Property Schema Not Found| | | <a name=\"111\">111</a>|Portfolio Ancestry Not Found| | | <a name=\"112\">112</a>|Portfolio With Id Already Exists| | | <a name=\"113\">113</a>|Orphaned Portfolio| | | <a name=\"119\">119</a>|Missing Base Claims| | | <a name=\"121\">121</a>|Property Not Defined| | | <a name=\"122\">122</a>|Cannot Delete System Property| | | <a name=\"123\">123</a>|Cannot Modify Immutable Property Field| | | <a name=\"124\">124</a>|Property Already Exists| | | <a name=\"125\">125</a>|Invalid Property Life Time| | | <a name=\"126\">126</a>|Property Constraint Style Excludes Properties| | | <a name=\"127\">127</a>|Cannot Modify Default Data Type| | | <a name=\"128\">128</a>|Group Already Exists| | | <a name=\"129\">129</a>|No Such Data Type| | | <a name=\"130\">130</a>|Undefined Value For Data Type| | | <a name=\"131\">131</a>|Unsupported Value Type Defined On Data Type| | | <a name=\"132\">132</a>|Validation Error| | | <a name=\"133\">133</a>|Loop Detected In Group Hierarchy| | | <a name=\"134\">134</a>|Undefined Acceptable Values| | | <a name=\"135\">135</a>|Sub Group Already Exists| | | <a name=\"138\">138</a>|Price Source Not Found| | | <a name=\"139\">139</a>|Analytic Store Not Found| | | <a name=\"141\">141</a>|Analytic Store Already Exists| | | <a name=\"143\">143</a>|Client Instrument Already Exists| | | <a name=\"144\">144</a>|Duplicate In Parameter Set| | | <a name=\"147\">147</a>|Results Not Found| | | <a name=\"148\">148</a>|Order Field Not In Result Set| | | <a name=\"149\">149</a>|Operation Failed| | | <a name=\"150\">150</a>|Elastic Search Error| | | <a name=\"151\">151</a>|Invalid Parameter Value| | | <a name=\"153\">153</a>|Command Processing Failure| | | <a name=\"154\">154</a>|Entity State Construction Failure| | | <a name=\"155\">155</a>|Entity Timeline Does Not Exist| | | <a name=\"156\">156</a>|Concurrency Conflict Failure| | | <a name=\"157\">157</a>|Invalid Request| | | <a name=\"158\">158</a>|Event Publish Unknown| | | <a name=\"159\">159</a>|Event Query Failure| | | <a name=\"160\">160</a>|Blob Did Not Exist| | | <a name=\"162\">162</a>|Sub System Request Failure| | | <a name=\"163\">163</a>|Sub System Configuration Failure| | | <a name=\"165\">165</a>|Failed To Delete| | | <a name=\"166\">166</a>|Upsert Client Instrument Failure| | | <a name=\"167\">167</a>|Illegal As At Interval| | | <a name=\"168\">168</a>|Illegal Bitemporal Query| | | <a name=\"169\">169</a>|Invalid Alternate Id| | | <a name=\"170\">170</a>|Cannot Add Source Portfolio Property Explicitly| | | <a name=\"171\">171</a>|Entity Already Exists In Group| | | <a name=\"173\">173</a>|Entity With Id Already Exists| | | <a name=\"174\">174</a>|Derived Portfolio Details Do Not Exist| | | <a name=\"176\">176</a>|Portfolio With Name Already Exists| | | <a name=\"177\">177</a>|Invalid Transactions| | | <a name=\"178\">178</a>|Reference Portfolio Not Found| | | <a name=\"179\">179</a>|Duplicate Id| | | <a name=\"180\">180</a>|Command Retrieval Failure| | | <a name=\"181\">181</a>|Data Filter Application Failure| | | <a name=\"182\">182</a>|Search Failed| | | <a name=\"183\">183</a>|Movements Engine Configuration Key Failure| | | <a name=\"184\">184</a>|Fx Rate Source Not Found| | | <a name=\"185\">185</a>|Accrual Source Not Found| | | <a name=\"186\">186</a>|Access Denied| | | <a name=\"187\">187</a>|Invalid Identity Token| | | <a name=\"188\">188</a>|Invalid Request Headers| | | <a name=\"189\">189</a>|Price Not Found| | | <a name=\"190\">190</a>|Invalid Sub Holding Keys Provided| | | <a name=\"191\">191</a>|Duplicate Sub Holding Keys Provided| | | <a name=\"192\">192</a>|Cut Definition Not Found| | | <a name=\"193\">193</a>|Cut Definition Invalid| | | <a name=\"194\">194</a>|Time Variant Property Deletion Date Unspecified| | | <a name=\"195\">195</a>|Perpetual Property Deletion Date Specified| | | <a name=\"196\">196</a>|Time Variant Property Upsert Date Unspecified| | | <a name=\"197\">197</a>|Perpetual Property Upsert Date Specified| | | <a name=\"200\">200</a>|Invalid Unit For Data Type| | | <a name=\"201\">201</a>|Invalid Type For Data Type| | | <a name=\"202\">202</a>|Invalid Value For Data Type| | | <a name=\"203\">203</a>|Unit Not Defined For Data Type| | | <a name=\"204\">204</a>|Units Not Supported On Data Type| | | <a name=\"205\">205</a>|Cannot Specify Units On Data Type| | | <a name=\"206\">206</a>|Unit Schema Inconsistent With Data Type| | | <a name=\"207\">207</a>|Unit Definition Not Specified| | | <a name=\"208\">208</a>|Duplicate Unit Definitions Specified| | | <a name=\"209\">209</a>|Invalid Units Definition| | | <a name=\"210\">210</a>|Invalid Instrument Identifier Unit| | | <a name=\"211\">211</a>|Holdings Adjustment Does Not Exist| | | <a name=\"212\">212</a>|Could Not Build Excel Url| | | <a name=\"213\">213</a>|Could Not Get Excel Version| | | <a name=\"214\">214</a>|Instrument By Code Not Found| | | <a name=\"215\">215</a>|Entity Schema Does Not Exist| | | <a name=\"216\">216</a>|Feature Not Supported On Portfolio Type| | | <a name=\"217\">217</a>|Quote Not Found| | | <a name=\"218\">218</a>|Invalid Quote Identifier| | | <a name=\"219\">219</a>|Invalid Metric For Data Type| | | <a name=\"220\">220</a>|Invalid Instrument Definition| | | <a name=\"221\">221</a>|Instrument Upsert Failure| | | <a name=\"222\">222</a>|Reference Portfolio Request Not Supported| | | <a name=\"223\">223</a>|Transaction Portfolio Request Not Supported| | | <a name=\"224\">224</a>|Invalid Property Value Assignment| | | <a name=\"230\">230</a>|Transaction Type Not Found| | | <a name=\"231\">231</a>|Transaction Type Duplication| | | <a name=\"232\">232</a>|Portfolio Does Not Exist At Given Date| | | <a name=\"233\">233</a>|Query Parser Failure| | | <a name=\"234\">234</a>|Duplicate Constituent| | | <a name=\"235\">235</a>|Unresolved Instrument Constituent| | | <a name=\"236\">236</a>|Unresolved Instrument In Transition| | | <a name=\"237\">237</a>|Missing Side Definitions| | | <a name=\"299\">299</a>|Invalid Recipe| | | <a name=\"300\">300</a>|Missing Recipe| | | <a name=\"301\">301</a>|Dependencies| | | <a name=\"304\">304</a>|Portfolio Preprocess Failure| | | <a name=\"310\">310</a>|Valuation Engine Failure| | | <a name=\"311\">311</a>|Task Factory Failure| | | <a name=\"312\">312</a>|Task Evaluation Failure| | | <a name=\"313\">313</a>|Task Generation Failure| | | <a name=\"314\">314</a>|Engine Configuration Failure| | | <a name=\"315\">315</a>|Model Specification Failure| | | <a name=\"320\">320</a>|Market Data Key Failure| | | <a name=\"321\">321</a>|Market Resolver Failure| | | <a name=\"322\">322</a>|Market Data Failure| | | <a name=\"330\">330</a>|Curve Failure| | | <a name=\"331\">331</a>|Volatility Surface Failure| | | <a name=\"332\">332</a>|Volatility Cube Failure| | | <a name=\"350\">350</a>|Instrument Failure| | | <a name=\"351\">351</a>|Cash Flows Failure| | | <a name=\"352\">352</a>|Reference Data Failure| | | <a name=\"360\">360</a>|Aggregation Failure| | | <a name=\"361\">361</a>|Aggregation Measure Failure| | | <a name=\"370\">370</a>|Result Retrieval Failure| | | <a name=\"371\">371</a>|Result Processing Failure| | | <a name=\"372\">372</a>|Vendor Result Processing Failure| | | <a name=\"373\">373</a>|Vendor Result Mapping Failure| | | <a name=\"374\">374</a>|Vendor Library Unauthorised| | | <a name=\"375\">375</a>|Vendor Connectivity Error| | | <a name=\"376\">376</a>|Vendor Interface Error| | | <a name=\"377\">377</a>|Vendor Pricing Failure| | | <a name=\"378\">378</a>|Vendor Translation Failure| | | <a name=\"379\">379</a>|Vendor Key Mapping Failure| | | <a name=\"380\">380</a>|Vendor Reflection Failure| | | <a name=\"390\">390</a>|Attempt To Upsert Duplicate Quotes| | | <a name=\"391\">391</a>|Corporate Action Source Does Not Exist| | | <a name=\"392\">392</a>|Corporate Action Source Already Exists| | | <a name=\"393\">393</a>|Instrument Identifier Already In Use| | | <a name=\"394\">394</a>|Properties Not Found| | | <a name=\"395\">395</a>|Batch Operation Aborted| | | <a name=\"400\">400</a>|Invalid Iso4217 Currency Code| | | <a name=\"401\">401</a>|Cannot Assign Instrument Identifier To Currency| | | <a name=\"402\">402</a>|Cannot Assign Currency Identifier To Non Currency| | | <a name=\"403\">403</a>|Currency Instrument Cannot Be Deleted| | | <a name=\"404\">404</a>|Currency Instrument Cannot Have Economic Definition| | | <a name=\"405\">405</a>|Currency Instrument Cannot Have Lookthrough Portfolio| | | <a name=\"406\">406</a>|Cannot Create Currency Instrument With Multiple Identifiers| | | <a name=\"407\">407</a>|Specified Currency Is Undefined| | | <a name=\"410\">410</a>|Index Does Not Exist| | | <a name=\"411\">411</a>|Sort Field Does Not Exist| | | <a name=\"413\">413</a>|Negative Pagination Parameters| | | <a name=\"414\">414</a>|Invalid Search Syntax| | | <a name=\"415\">415</a>|Filter Execution Timeout| | | <a name=\"420\">420</a>|Side Definition Inconsistent| | | <a name=\"450\">450</a>|Invalid Quote Access Metadata Rule| | | <a name=\"451\">451</a>|Access Metadata Not Found| | | <a name=\"452\">452</a>|Invalid Access Metadata Identifier| | | <a name=\"460\">460</a>|Standard Resource Not Found| | | <a name=\"461\">461</a>|Standard Resource Conflict| | | <a name=\"462\">462</a>|Calendar Not Found| | | <a name=\"463\">463</a>|Date In A Calendar Not Found| | | <a name=\"464\">464</a>|Invalid Date Source Data| | | <a name=\"465\">465</a>|Invalid Timezone| | | <a name=\"601\">601</a>|Person Identifier Already In Use| | | <a name=\"602\">602</a>|Person Not Found| | | <a name=\"603\">603</a>|Cannot Set Identifier| | | <a name=\"617\">617</a>|Invalid Recipe Specification In Request| | | <a name=\"618\">618</a>|Inline Recipe Deserialisation Failure| | | <a name=\"619\">619</a>|Identifier Types Not Set For Entity| | | <a name=\"620\">620</a>|Cannot Delete All Client Defined Identifiers| | | <a name=\"650\">650</a>|The Order requested was not found.| | | <a name=\"654\">654</a>|The Allocation requested was not found.| | | <a name=\"655\">655</a>|Cannot build the fx forward target with the given holdings.| | | <a name=\"656\">656</a>|Group does not contain expected entities.| | | <a name=\"667\">667</a>|Relation definition already exists| | | <a name=\"673\">673</a>|Missing entitlements for entities in Group| | | <a name=\"674\">674</a>|Next Best Action not found| | | <a name=\"676\">676</a>|Relation definition not defined| | | <a name=\"677\">677</a>|Invalid entity identifier for relation| | | <a name=\"681\">681</a>|Sorting by specified field not supported|One or more of the provided fields to order by were either invalid or not supported. | | <a name=\"682\">682</a>|Too many fields to sort by|The number of fields to sort the data by exceeds the number allowed by the endpoint | | <a name=\"684\">684</a>|Sequence Not Found| | | <a name=\"685\">685</a>|Sequence Already Exists| | | <a name=\"686\">686</a>|Non-cycling sequence has been exhausted| | | <a name=\"687\">687</a>|Legal Entity Identifier Already In Use| | | <a name=\"688\">688</a>|Legal Entity Not Found| | | <a name=\"689\">689</a>|The supplied pagination token is invalid| | | <a name=\"690\">690</a>|Property Type Is Not Supported| | | <a name=\"691\">691</a>|Multiple Tax-lots For Currency Type Is Not Supported| | | <a name=\"692\">692</a>|This endpoint does not support impersonation| | | <a name=\"693\">693</a>|Entity type is not supported for Relationship| | | <a name=\"694\">694</a>|Relationship Validation Failure| | | <a name=\"695\">695</a>|Relationship Not Found| | | <a name=\"697\">697</a>|Derived Property Formula No Longer Valid| | | <a name=\"698\">698</a>|Story is not available| | | <a name=\"703\">703</a>|Corporate Action Does Not Exist| |
*
* The version of the OpenAPI document: 0.11.2863
* Contact: info@finbourne.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.finbourne.lusid.model;
import com.finbourne.lusid.model.EquitySwapAllOf;
import com.finbourne.lusid.model.FlowConventions;
import com.finbourne.lusid.model.InstrumentLeg;
import com.finbourne.lusid.model.LusidInstrument;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.time.OffsetDateTime;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* Model tests for EquitySwap
*/
public class EquitySwapTest {
private final EquitySwap model = new EquitySwap();
/**
* Model tests for EquitySwap
*/
@Test
public void testEquitySwap() {
// TODO: test EquitySwap
}
/**
* Test the property 'instrumentType'
*/
@Test
public void instrumentTypeTest() {
// TODO: test instrumentType
}
}
| [
"concourse@finbourne.com"
] | concourse@finbourne.com |
6c785c855ec0af6874f69962af418eb4f8317f53 | 424881094f61dd15de07871a0fc53902d8c34c38 | /app/src/main/java/com/tiangou/douxiaomi/Utils.java | b5fcb3c9449c7856fc9eb1d3b023413a78a7a56a | [] | no_license | stormbirds/doubaofen | 8becc97ada00a2e505198e41cc72d12e91daa397 | 7f12371139b8944ad28448bf3d2bd5ae1908b481 | refs/heads/master | 2022-06-14T14:38:49.467883 | 2020-04-21T10:05:43 | 2020-04-21T10:05:43 | 257,167,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,984 | java | package com.tiangou.douxiaomi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class Utils {
public static void openDouYin(Context context) {
Intent intent = new Intent("android.intent.action.MAIN", (Uri) null);
intent.addCategory("android.intent.category.LAUNCHER");
PackageManager packageManager = context.getApplicationContext().getPackageManager();
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 0);
Collections.sort(queryIntentActivities, new ResolveInfo.DisplayNameComparator(packageManager));
for (ResolveInfo next : queryIntentActivities) {
String str = next.activityInfo.packageName;
String str2 = next.activityInfo.name;
if (str.contains("com.ss.android.ugc.aweme")) {
ComponentName componentName = new ComponentName(str, str2);
Intent intent2 = new Intent();
intent2.setComponent(componentName);
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent2);
}
}
}
public static void openFlyChat(Context context) {
Intent intent = new Intent("android.intent.action.MAIN", (Uri) null);
intent.addCategory("android.intent.category.LAUNCHER");
PackageManager packageManager = context.getApplicationContext().getPackageManager();
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 0);
Collections.sort(queryIntentActivities, new ResolveInfo.DisplayNameComparator(packageManager));
for (ResolveInfo next : queryIntentActivities) {
String str = next.activityInfo.packageName;
String str2 = next.activityInfo.name;
if (str.contains("com.feiliao.flipchat.android")) {
ComponentName componentName = new ComponentName(str, str2);
Intent intent2 = new Intent();
intent2.setComponent(componentName);
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent2);
}
}
}
public static int getNum(int i, int i2) {
return i2 > i ? new Random().nextInt(i2 - i) + i : i;
}
public static int dp2Px(Context context, float f) {
return (int) TypedValue.applyDimension(1, f, context.getResources().getDisplayMetrics());
}
public static boolean isSettingOpen(Class cls, Context context) {
try {
if (Settings.Secure.getInt(context.getContentResolver(), "accessibility_enabled", 0) != 1) {
return false;
}
String string = Settings.Secure.getString(context.getContentResolver(), "enabled_accessibility_services");
if (!TextUtils.isEmpty(string)) {
TextUtils.SimpleStringSplitter simpleStringSplitter = new TextUtils.SimpleStringSplitter(':');
simpleStringSplitter.setString(string);
while (simpleStringSplitter.hasNext()) {
String next = simpleStringSplitter.next();
if (next.equalsIgnoreCase(context.getPackageName() + "/" + cls.getName())) {
return true;
}
}
}
return false;
} catch (Throwable th) {
Log.e("qyh", "isSettingOpen: " + th.getMessage());
}
return false;
}
/* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|9) */
/* JADX WARNING: Code restructure failed: missing block: B:5:0x0019, code lost:
r2 = move-exception;
*/
/* JADX WARNING: Code restructure failed: missing block: B:6:0x001a, code lost:
android.util.Log.e("qyh", "jumpToSetting: " + r2.getMessage());
*/
/* JADX WARNING: Code restructure failed: missing block: B:7:?, code lost:
return;
*/
/* JADX WARNING: Code restructure failed: missing block: B:8:?, code lost:
return;
*/
/* JADX WARNING: Failed to process nested try/catch */
/* JADX WARNING: Missing exception handler attribute for start block: B:3:0x000b */
/* Code decompiled incorrectly, please refer to instructions dump. */
public static void jumpToSetting(android.content.Context r2) {
/*
java.lang.String r0 = "android.settings.ACCESSIBILITY_SETTINGS"
android.content.Intent r1 = new android.content.Intent // Catch:{ all -> 0x000b }
r1.<init>(r0) // Catch:{ all -> 0x000b }
r2.startActivity(r1) // Catch:{ all -> 0x000b }
goto L_0x0034
L_0x000b:
android.content.Intent r1 = new android.content.Intent // Catch:{ all -> 0x0019 }
r1.<init>(r0) // Catch:{ all -> 0x0019 }
r0 = 268435456(0x10000000, float:2.5243549E-29)
r1.addFlags(r0) // Catch:{ all -> 0x0019 }
r2.startActivity(r1) // Catch:{ all -> 0x0019 }
goto L_0x0034
L_0x0019:
r2 = move-exception
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r1 = "jumpToSetting: "
r0.append(r1)
java.lang.String r2 = r2.getMessage()
r0.append(r2)
java.lang.String r2 = r0.toString()
java.lang.String r0 = "qyh"
android.util.Log.e(r0, r2)
L_0x0034:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.tiangou.douxiaomi.Utils.jumpToSetting(android.content.Context):void");
}
public static int getDisplayWidth(Context context) {
return context.getResources().getDisplayMetrics().widthPixels;
}
public static int getDisplayHeight(Context context) {
return context.getResources().getDisplayMetrics().heightPixels;
}
public static boolean isEmptyArray(List list) {
return list == null || list.size() == 0;
}
public static int getTime() {
return Integer.parseInt(String.valueOf(System.currentTimeMillis() / 1000));
}
public Boolean checkSusPermiss(Context context) {
return false;
}
public static void LogV(String str) {
Log.v("xx", str);
}
public static String getVersionName(Context context) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| [
"xbaojun@gmail.com"
] | xbaojun@gmail.com |
11d794468acb4e5a8e1aec9a28063d9f4ea541ec | bc2447d244eec49e54db1de8a1bbeb7afa83f477 | /src/pl/krystiano/Wallet.java | 23b81d8c3d3b9d6f043a767dbff0727bb33cd76c | [] | no_license | KTryCode/SimpleBlockchain | eadcc9fbf7193307475597f2c71f42bfa1f71fa3 | 37c674e770615ce02d1ef14d96018e4f79111df2 | refs/heads/master | 2021-04-30T15:42:04.752195 | 2018-02-13T11:25:41 | 2018-02-13T11:25:41 | 121,247,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,706 | java | package pl.krystiano;
import java.security.*;
import java.security.spec.ECGenParameterSpec;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Wallet {
public PrivateKey privateKey;
public PublicKey publicKey;
//only UTXOs owned by this wallet.
public HashMap<String,TransactionOutput> UTXOs = new HashMap<String,TransactionOutput>();
public Wallet() {
generateKeyPair();
}
public void generateKeyPair() {
try {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDSA", "BC");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
ECGenParameterSpec ecSpec = new ECGenParameterSpec("prime192v1");
// Initialize the key generator and generate a KeyPair
keyGen.initialize(ecSpec, random); //256 bytes provides an acceptable security level
KeyPair keyPair = keyGen.generateKeyPair();
// Set the public and private keys from the keyPair
privateKey = keyPair.getPrivate();
publicKey = keyPair.getPublic();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public float getBalance() {
float total = 0;
for (Map.Entry<String, TransactionOutput> item: NoobChain.UTXOs.entrySet()){
TransactionOutput UTXO = item.getValue();
if(UTXO.isMine(publicKey)) { //if output belongs to me ( if coins belong to me )
UTXOs.put(UTXO.id,UTXO); //add it to our list of unspent transactions.
total += UTXO.value ;
}
}
return total;
}
//Generates and returns a new transaction from this wallet.
public Transaction sendFunds(PublicKey _recipient,float value ) {
if(getBalance() < value) { //gather balance and check funds.
System.out.println("#Not Enough funds to send transaction. Transaction Discarded.");
return null;
}
//create array list of inputs
ArrayList<TransactionInput> inputs = new ArrayList<TransactionInput>();
float total = 0;
for (Map.Entry<String, TransactionOutput> item: UTXOs.entrySet()){
TransactionOutput UTXO = item.getValue();
total += UTXO.value;
inputs.add(new TransactionInput(UTXO.id));
if(total > value) break;
}
Transaction newTransaction = new Transaction(publicKey, _recipient , value, inputs);
newTransaction.generateSignature(privateKey);
for(TransactionInput input: inputs){
UTXOs.remove(input.transactionOutputId);
}
return newTransaction;
}
} | [
"krystian.leszczewski@nask.pl"
] | krystian.leszczewski@nask.pl |
8c5f106a1348a8a6b2bd18f9ecb0f1b57c2fef09 | 9ca48d8518bab33306470479e68bd16849bd0cca | /2_Java Fundamentals/04.Java-Fundamentals-Methods/src/vowelsCount.java | 2597bac09f862870395f98f922e1340730fa1e17 | [] | no_license | nenoS1/FirstProject | ccd1752d014a932c8dd6ccf6a81c9e98ba044684 | 5d1ccbf7a5552f2f0ec53f1bf05f404bef633ddd | refs/heads/master | 2020-06-09T15:07:38.100504 | 2019-11-26T08:45:14 | 2019-11-26T08:45:14 | 193,456,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | import java.util.Scanner;
public class vowelsCount {
static void printVowelsCount(String input){
String[] vowels = {"a", "e", "i", "o", "u"};
String s = input;
String[] word = s.split("");
int count = 0;
for (String word1 : vowels) {
for (String word2 : word) {
if(word1.equals(word2)){
count += 1;
}
}
}
System.out.print(count);
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String text = scanner.nextLine().toLowerCase();
printVowelsCount(text);
}
}
| [
"neno.shirtev@gmail.com"
] | neno.shirtev@gmail.com |
f792fe4f906f4d2ab4abd9af16dc119d3a79e5fc | dae1fc272bf5ba506f24e68bf9193117c77199d3 | /XRecyclerView-master/xrecyclerview/src/main/java/com/yanxuwen/xrecyclerview/progressindicator/indicator/BallPulseIndicator.java | 1488b868bd54605d3a901f63d43e95e43a3b850f | [
"Apache-2.0"
] | permissive | tubeuchiha/XRecyclerView | 1aa53bbc44e61cc3aaa80ac1233f81a62ff537bb | 3a85fd98b29444e1fcb5319ba61018caff6f28f5 | refs/heads/master | 2020-05-23T10:11:13.379859 | 2016-08-25T01:10:34 | 2016-08-25T01:10:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,021 | java | package com.yanxuwen.xrecyclerview.progressindicator.indicator;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jack on 2015/10/16.
*/
public class BallPulseIndicator extends BaseIndicatorController{
public static final float SCALE=1.0f;
//scale x ,y
private float[] scaleFloats=new float[]{SCALE,
SCALE,
SCALE};
@Override
public void draw(Canvas canvas, Paint paint) {
float circleSpacing=4;
float radius=(Math.min(getWidth(),getHeight())-circleSpacing*2)/6;
float x = getWidth()/ 2-(radius*2+circleSpacing);
float y=getHeight() / 2;
for (int i = 0; i < 3; i++) {
canvas.save();
float translateX=x+(radius*2)*i+circleSpacing*i;
canvas.translate(translateX, y);
canvas.scale(scaleFloats[i], scaleFloats[i]);
canvas.drawCircle(0, 0, radius, paint);
canvas.restore();
}
}
@Override
public List<Animator> createAnimation() {
List<Animator> animators=new ArrayList<>();
int[] delays=new int[]{120,240,360};
for (int i = 0; i < 3; i++) {
final int index=i;
ValueAnimator scaleAnim=ValueAnimator.ofFloat(1,0.3f,1);
scaleAnim.setDuration(750);
scaleAnim.setRepeatCount(-1);
scaleAnim.setStartDelay(delays[i]);
scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
scaleFloats[index] = (float) animation.getAnimatedValue();
postInvalidate();
}
});
scaleAnim.start();
animators.add(scaleAnim);
}
return animators;
}
}
| [
"yanxuwen@bbxpc-PC"
] | yanxuwen@bbxpc-PC |
a6d56b584cd14f6eeee8fc29824fa9b73c9452a7 | 6b49674a1c586640d4ed5307daac1bd83239bf43 | /src/main/java/com/opp/domain/ux/RrResultResponse.java | 44eda4de5330450e577e0784e109c3a6d59da73a | [] | no_license | craig2017/opp-jenkins-plugin | 31b173d3a9f828ae6ddb5061673c87ff2ebefec1 | 26fc94de9d9c685edd94307e832cc010c3cf3d06 | refs/heads/master | 2020-12-30T09:11:41.316450 | 2017-08-15T15:54:48 | 2017-08-15T15:54:48 | 100,394,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.opp.domain.ux;
import java.util.Map;
/**
* Created by ctobe on 1/4/16.
*/
public class RrResultResponse {
private SlaResult slaResult;
private Map<String, Object> slas;
private Map<String, Object> test;
public SlaResult getSlaResult() {
return slaResult;
}
public void setSlaResult(SlaResult slaResult) {
this.slaResult = slaResult;
}
public Map<String, Object> getSlas() {
return slas;
}
public void setSlas(Map<String, Object> slas) {
this.slas = slas;
}
public Map<String, Object> getTest() {
return test;
}
public void setTest(Map<String, Object> test) {
this.test = test;
}
}
| [
"ctobe@constantcontact.com"
] | ctobe@constantcontact.com |
40155062e955b0b39258a3858f7f1033832cbe55 | 316eb3b31173490aa7dc0947000e25aa25ef6702 | /src/com/class20/Variables.java | 198586620e7480e3abb3f6e2a567ba5cfada04b4 | [] | no_license | Farrah77/JavaClass | a45b1ae2285a016ed500000492000a543db9d690 | 2e9432a8b6030a01846554e5de6ba5ba7612d4f0 | refs/heads/master | 2020-05-03T00:08:19.929418 | 2019-05-04T18:57:48 | 2019-05-04T18:57:48 | 178,301,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package com.class20;
public class Variables {
/* Variables in Java:
* Local variable - declared and accessed only inside the method { }
*
* public void hello(String name) { // first executes this method
name="Jack";
System.out.println("Hello "+name); }
* We CAN"T USE LOCAL VARIABLES ACCESS MODIFIERS
*
* dataType nameOfTheMethod - syntax
*
* Instance (global) variable - declared inside the class but outside of method, constructor
* or block; accessible within a class.
*
* We can access them through OBJECT
*
* Static/Class (global) - declared inside the class but outside the method, constructor,block and
* they use STATIC keyword
* for classes that have similar attributes e can use static variables: like human have 2 hands,
* 2 legs, 2 eyes, etc.. but names are different
*
* 3 ways to access static variable:
* just by variable name breed
* by class name Dog.breed
* through the object obj.breed - not preferred way
*
*/
}
| [
"farangizmamadieva@gmail.com"
] | farangizmamadieva@gmail.com |
43ec633598eeb96cf6746623f2612e7260f12e78 | 94d0ae644f53f76dabf71d6c29e2b5dfe7698a11 | /luban-portal/src/main/java/com/luban/portal/component/trade/alipay/model/hb/PosTradeInfo.java | d97eac933daf7e91fe1d370c94a4d0590d008df3 | [] | no_license | Amselx/mall-dcs | c71576c87285c663b08e62647d08c974e3fb6598 | 3a06d9f4a12dcf736112b38b69d523d3746af1b5 | refs/heads/master | 2023-05-03T01:54:26.068740 | 2021-05-14T01:28:39 | 2021-05-14T01:28:39 | 367,217,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | package com.luban.portal.component.trade.alipay.model.hb;
public class PosTradeInfo implements TradeInfo {
private HbStatus status;
private String time;
private int timeConsume;
private PosTradeInfo() {
// no public constructor.
}
public static PosTradeInfo newInstance(HbStatus status, String time, int timeConsume) {
PosTradeInfo info = new PosTradeInfo();
if (timeConsume > 99 || timeConsume < 0) {
timeConsume = 99;
}
info.setTimeConsume(timeConsume);
info.setStatus(status);
info.setTime(time);
return info;
}
@Override
public String toString() {
return new StringBuilder(status.name())
.append(time)
.append(String.format("%02d", timeConsume))
.toString();
}
@Override
public HbStatus getStatus() {
return status;
}
public void setStatus(HbStatus status) {
this.status = status;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public double getTimeConsume() {
return (double) timeConsume;
}
public void setTimeConsume(int timeConsume) {
this.timeConsume = timeConsume;
}
}
| [
"123"
] | 123 |
4e2f71ff2ced4e4ad47d526689d8c0e32d075d0c | 75a8892e4be8c81cbebc07153d53ccc379528287 | /capitulo2/Exemplo_DoWhile.java | 830e542fe7ff2f018fdb28f1820068bffeabdc55 | [] | no_license | lfbessegato/Estudos-Java | da2d50c5965eae6b804306fef0457885341f7ac1 | d358a777feb967147c125bf10cf302a1e9b96e43 | refs/heads/master | 2020-08-07T02:04:22.877913 | 2019-10-06T22:26:50 | 2019-10-06T22:26:50 | 213,252,991 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package course.capitulo2;
import java.util.Locale;
import java.util.Scanner;
public class Exemplo_DoWhile {
public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner sc = new Scanner(System.in);
char resp;
do {
System.out.print("Enter a number: ");
double n = sc.nextDouble();
double sq = Math.sqrt(n);
System.out.printf("Square root = %.3f%n", sq);
System.out.print("Repeat <y/n>? ");
resp = sc.next().charAt(0);
} while (resp != 'n');
sc.close();
}
}
| [
"lfrbessegato@gmail.com"
] | lfrbessegato@gmail.com |
aa89fd60f0ee1f6f799e015ecfc60746e075c52d | 010af329f73332ff36476c38f749fd6805086acc | /app/src/main/java/com/ruanjie/donkey/api/TestService.java | b011df8481fb37e0a7058c670aaac3007a3319e1 | [] | no_license | Superingxz/YellowDonkey | f577feed32485b49ccab06660121af6a43a37320 | a47691c815d4f25d1298f2f3b68f17f8961d4ad5 | refs/heads/master | 2023-02-01T10:03:38.011876 | 2020-12-18T09:07:53 | 2020-12-18T09:07:53 | 322,543,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,775 | java | package com.ruanjie.donkey.api;
import com.ruanjie.donkey.bean.AgreementBean;
import com.ruanjie.donkey.bean.AliLoginBean;
import com.ruanjie.donkey.bean.ConfigBean;
import com.ruanjie.donkey.bean.CouponBean;
import com.ruanjie.donkey.bean.CurrentTodayHeaderBean;
import com.ruanjie.donkey.bean.ExCurrentTodayHeaderBean;
import com.ruanjie.donkey.bean.ExRealNameBean;
import com.ruanjie.donkey.bean.ExTodayDatasBean;
import com.ruanjie.donkey.bean.FenceListBean;
import com.ruanjie.donkey.bean.GankBaseBean;
import com.ruanjie.donkey.bean.ImageBean;
import com.ruanjie.donkey.bean.IndexBean;
import com.ruanjie.donkey.bean.JoinAreaInfoBean;
import com.ruanjie.donkey.bean.JoinCityInfoBean;
import com.ruanjie.donkey.bean.LockBean;
import com.ruanjie.donkey.bean.LoginBean;
import com.ruanjie.donkey.bean.MainTainBean;
import com.ruanjie.donkey.bean.MessageListBean;
import com.ruanjie.donkey.bean.NotifyMessageBean;
import com.ruanjie.donkey.bean.ParkingAreaBean;
import com.ruanjie.donkey.bean.ParkingListBean;
import com.ruanjie.donkey.bean.PriceBean;
import com.ruanjie.donkey.bean.RechargeBean;
import com.ruanjie.donkey.bean.RegisterBean;
import com.ruanjie.donkey.bean.TodayDatasBean;
import com.ruanjie.donkey.bean.TodayDatasDetailBean;
import com.ruanjie.donkey.bean.TokenBean;
import com.ruanjie.donkey.bean.TravelDetailBean;
import com.ruanjie.donkey.bean.TravelStatisticsBean;
import com.ruanjie.donkey.bean.UnReadBean;
import com.ruanjie.donkey.bean.UnlockBean;
import com.ruanjie.donkey.bean.UploadBean;
import com.ruanjie.donkey.bean.UseHelpBean;
import com.ruanjie.donkey.bean.VehicleDetailBean;
import com.ruanjie.donkey.bean.VehicleListBean;
import com.ruanjie.donkey.bean.VersionBean;
import com.ruanjie.donkey.bean.WalletDetailBean;
import com.softgarden.baselibrary.network.BaseBean;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Url;
public interface TestService {
/**
* 测试接口
*
* @return
*/
//接口有参数时 要写上该注解
// @FormUrlEncoded
@POST(HostUrl.HOST_Gank_Image)
Observable<BaseBean<List<ImageBean>>> getData(/*@Field("is_new") int is_new*/);
/**
* gank 图片列表
*
* @param page
* @param pageSize
* @return
*/
@GET(HostUrl.HOST_Gank_Image)
Observable<GankBaseBean<List<ImageBean>>> getImages(@Path("page") int page, @Path("pageSize") int pageSize);
@POST
Observable<BaseBean<List<ImageBean>>> getData(@Url String url/*@Field("is_new") int is_new*/);
@FormUrlEncoded
@POST(HostUrl.LOGIN_URL)
Observable<BaseBean<LoginBean>> getLoginData(@Field("phone") String phone, @Field("password") String password);
@FormUrlEncoded
@POST(HostUrl.REGISTER_URL)
Observable<BaseBean<RegisterBean>> getRegisterData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.SEND_VERIFICATION_CODE_URL)
Observable<BaseBean<String>> getVerificationCodeData(@Field("phone") String phone, @Field("type") int type);
@FormUrlEncoded
@POST(HostUrl.SERVICE_AGREEMENT_URL)
Observable<BaseBean<AgreementBean>> getAgreementData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.CHECK_VERIFICATION_CODE_URL)
Observable<BaseBean<String>> checkVerificationCodeData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.GET_COUPON_URL)
Observable<BaseBean<String>> getCouponData(@Field("message_id") int message_id, @Field("coupon_id") int coupon_id);
@FormUrlEncoded
@POST(HostUrl.UPLOAD_IMAGES_BASE64)
Observable<BaseBean<UploadBean>> uploadImage(
@Field("content") String content
);
@Multipart
@POST(HostUrl.UPLOAD_IMAGES_STREAM)
Observable<BaseBean<String>> uploadImage2(
@Part() List<MultipartBody.Part> parts
// @Part("type") RequestBody type,
// @Part("code") RequestBody code
);
@FormUrlEncoded
@POST(HostUrl.CHANGE_HEAD)
Observable<BaseBean<UploadBean>> changeHead(
@Field("avatar") String avatar
);
@FormUrlEncoded
@POST(HostUrl.CHANGE_USERINFO)
Observable<BaseBean<String>> changeUserInfo(
@Field("sex") int sex,
@Field("nickname") String nickname,
@Field("birthday") String birthday
);
@POST(HostUrl.GET_USERINFO)
Observable<BaseBean<LoginBean>> getUserInfo(
);
@FormUrlEncoded
@POST(HostUrl.CHANGE_PHONE)
Observable<BaseBean<String>> changePhone(
@Field("new_phone") String new_phone,
@Field("new_code") String new_code
);
@FormUrlEncoded
@POST(HostUrl.SEND_VERIFICATION_CODE_URL)
Observable<BaseBean<String>> getCode(
@Field("phone") String phone,
@Field("type") int type
);
@FormUrlEncoded
@POST(HostUrl.REAL_NAME_APPLY)
Observable<BaseBean<String>> realNameApply(
@Field("username") String username,
@Field("idcard") String idcard,
@Field("idcard_font") String idcard_font,
@Field("idcard_back") String idcard_back,
@Field("idcard_hand") String idcard_hand
);
@FormUrlEncoded
@POST(HostUrl.CHANGE_PWD)
Observable<BaseBean<TokenBean>> changePwd(
@Field("old_password") String old_password,
@Field("new_password") String new_password,
@Field("re_password") String re_password
);
//重置密码
@FormUrlEncoded
@POST(HostUrl.CHANGE_RESET_PASSWORD)
Observable<BaseBean<String>> resetPwd(
@Field("phone") String phone,
@Field("code") String code,
@Field("password") String password,
@Field("repassword") String repassword
);
@FormUrlEncoded
@POST(HostUrl.JOIN_AREA)
Observable<BaseBean<String>> joinArea(
@Field("name") String name,
@Field("phone") String phone,
@Field("area_code") String area_code,
@Field("area_id") String area_id
);
@FormUrlEncoded
@POST(HostUrl.JOIN_CITY)
Observable<BaseBean<String>> joinCity(
@Field("name") String name,
@Field("phone") String phone,
@Field("num") String num
);
@POST(HostUrl.GET_JOIN_AREA_INFO)
Observable<BaseBean<JoinAreaInfoBean>> getJoinAreaInfo();
@POST(HostUrl.GET_JOIN_CITY_INFO)
Observable<BaseBean<JoinCityInfoBean>> getJoinCityInfo();
@FormUrlEncoded
@POST(HostUrl.GET_CURRENT_TODAY_HEADER)
Observable<BaseBean<CurrentTodayHeaderBean>> getCurrentTodayHeader(
@Field("date") String date
);
@FormUrlEncoded
@POST(HostUrl.GET_EX_CURRENT_TODAY_HEADER)
Observable<BaseBean<ExCurrentTodayHeaderBean>> getExCurrentTodayHeader(
@Field("date") String date
);
@FormUrlEncoded
@POST(HostUrl.GET_CURRENT_TODAY_DATAS)
Observable<BaseBean<List<TodayDatasBean>>> getCurrentTodayDatas(
@Field("date") String date,
@Field("page") String page,
@Field("pageSize") String pageSize
);
@FormUrlEncoded
@POST(HostUrl.GET_EX_CURRENT_TODAY_DATAS)
Observable<BaseBean<List<ExTodayDatasBean>>> getExCurrentTodayDatas(
@Field("date") String date,
@Field("page") String page,
@Field("pageSize") String pageSize
);
@FormUrlEncoded
@POST(HostUrl.GET_CONFIG_INFO)
Observable<BaseBean<ConfigBean>> getConfigInfo(
@Field("name") String name
);
@FormUrlEncoded
@POST(HostUrl.DELETE_TODAY_DATAS)
Observable<BaseBean<String>> deleteTodayDatas(
@Field("id") int id,
@Field("date") String date
);
@FormUrlEncoded
@POST(HostUrl.GET_TODAY_DATAS)
Observable<BaseBean<List<TodayDatasDetailBean>>> getTodayDatas(
@Field("id") int id,
@Field("date") String date
);
@FormUrlEncoded
@POST(HostUrl.INDEX_URL)
Observable<BaseBean<IndexBean>> getIndexData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.VEHICLE_LIST_URL)
Observable<BaseBean<List<VehicleListBean>>> getVehicleListData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.SCAN_UNLOCK_URL)
Observable<BaseBean<UnlockBean>> getScanUnlockData(@Field("code") String code);
@FormUrlEncoded
@POST(HostUrl.VEHICLE_DETAIL_URL)
Observable<BaseBean<VehicleDetailBean>> getVehicleDetailData(@Field("code") String code);
@FormUrlEncoded
@POST(HostUrl.MESSAGE_LIST_URL)
Observable<BaseBean<List<MessageListBean>>> getMessageListData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.MESSAGE_LIST_URL)
Observable<BaseBean<List<NotifyMessageBean>>> getNotifyMessageData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.USE_HELP_URL)
Observable<BaseBean<List<UseHelpBean>>> getUseHelpData(@FieldMap Map<String, Object> params);
@FormUrlEncoded
@POST(HostUrl.SUBMIT_BREAKDOWN_URL)
Observable<BaseBean<String>> uploadFault(@Field("content") String content, @Field("images") String images);
@FormUrlEncoded
@POST(HostUrl.ILLEGAL_DECLARATION_URL)
Observable<BaseBean<String>> uploadIllegal(@Field("content") String content, @Field("images") String images);
@GET(HostUrl.PAUSE_USE_VEHICLE_URL)
Observable<BaseBean<String>> getPauseUseVehicleData();
@GET(HostUrl.CONTINUE_USE_VEHICLE_URL)
Observable<BaseBean<String>> getContinueUseVehicleData();
@FormUrlEncoded
@POST(HostUrl.TRANS_VEHICLE_URL)
Observable<BaseBean<String>> getTransVehicleData(@Field("code")String code,@Field("lng")String lng,@Field("lat")String lat);
@FormUrlEncoded
@POST(HostUrl.LOCK_VENHICLE_URL)
Observable<BaseBean<LockBean>> getLockVehicleData(@Field("lng")String lng,@Field("lat")String lat);
@FormUrlEncoded
@POST(HostUrl.PAY_ORDER_URL)
Observable<BaseBean<RechargeBean>> getPayOrderData(@Field("pay_type") int pay_type);
@GET(HostUrl.SHOW_PRICE_URL)
Observable<BaseBean<String>> getShowPriceData();
@FormUrlEncoded
@POST(HostUrl.PARKING_LIST_URL)
Observable<BaseBean<List<ParkingListBean>>> getParkingListData(@Field("lng")String lng,@Field("lat")String lat,@Field("distance")int distance);
@FormUrlEncoded
@POST(HostUrl.IS_PARKING_AREA_URL)
Observable<BaseBean<ParkingAreaBean>> getIsParkingAreaData(@FieldMap Map<String, Object> params);
@GET(HostUrl.FENCE_LIST_URL)
Observable<BaseBean<List<FenceListBean>>> getFenceListData();
@FormUrlEncoded
@POST(HostUrl.RECHARGE)
Observable<BaseBean<RechargeBean>> recharge(
@Field("money") String money,
@Field("pay_type") int pay_type,
@Field("coupon_id") int coupon_id
);
@FormUrlEncoded
@POST(HostUrl.GET_COUPONS)
Observable<BaseBean<List<CouponBean>>> getCoupons(
@Field("type") int type,
@Field("tab_type") int tab_type,
@Field("status") int status,
@Field("page") int page,
@Field("pageSize") int pageSize
);
@FormUrlEncoded
@POST(HostUrl.DELETE_COUPONS)
Observable<BaseBean<String>> deleteCoupon(
@Field("coupon_id") int coupon_id
);
@FormUrlEncoded
@POST(HostUrl.WITH_DRAW)
Observable<BaseBean<String>> withDraw(
@Field("money") String money,
@Field("bankcard") String bankcard,
@Field("bank") String bank
);
@FormUrlEncoded
@POST(HostUrl.WALLET_DETAIL)
Observable<BaseBean<List<WalletDetailBean>>> walletDetail(
@Field("page") int page,
@Field("pageSize") int pageSize
);
@FormUrlEncoded
@POST(HostUrl.PAY_DEPOSIT)
Observable<BaseBean<RechargeBean>> payDeposit(
@Field("pay_type") int pay_type
);
@FormUrlEncoded
@POST(HostUrl.CONFIG_URL)
Observable<BaseBean<PriceBean>> getPrice(@Field("name") String name);
@POST(HostUrl.MY_TRAVEL_STATISTICS)
Observable<BaseBean<TravelStatisticsBean>> getMyTravelStatistics(
);
@FormUrlEncoded
@POST(HostUrl.MY_TRAVEL_STATISTICS_DATAS)
Observable<BaseBean<List<TravelDetailBean>>> getMyTravelDatas(
@Field("page") int page,
@Field("pageSize") int pageSize
);
@FormUrlEncoded
@POST(HostUrl.TRAVEL_DETAIL)
Observable<BaseBean<TravelDetailBean>> getTravelDetail(
@Field("id") int id
);
@FormUrlEncoded
@POST(HostUrl.GET_ALI_LOGIN_DATAS)
Observable<BaseBean<AliLoginBean>> getAliLoginData(
@Field("pid") String pid
);
@FormUrlEncoded
@POST(HostUrl.ALI_LOGIN)
Observable<BaseBean<LoginBean>> alipayLogin(
@Field("authCode") String authCode
);
@FormUrlEncoded
@POST(HostUrl.WECHAT_LOGIN)
Observable<BaseBean<LoginBean>> wechatLogin(
@Field("type") String type,
@Field("access_token") String access_token,
@Field("openid") String openid
);
@FormUrlEncoded
@POST(HostUrl.GET_MAINTAIN_HISTORY)
Observable<BaseBean<List<MainTainBean>>> getMainHistorys(
@Field("page") int page,
@Field("pageSize") int pageSize
);
@FormUrlEncoded
@POST(HostUrl.UPLOAD_MAINTAIN)
Observable<BaseBean<String>> uploadMaintain(
@Field("content") String content,
@Field("images") String images
);
@FormUrlEncoded
@POST(HostUrl.EX_REAL_NAME_APPLY)
Observable<BaseBean<String>> exRealNameApply(
@Field("real_name") String real_name,
@Field("id_card") String id_card,
@Field("id_card_photo") String id_card_photo,
@Field("id_card_photo2") String id_card_photo2,
@Field("id_card_photo3") String id_card_photo3
);
@POST(HostUrl.GET_EX_REAL_NAME_DATA)
Observable<BaseBean<ExRealNameBean>> getExRealNameApplyData(
);
@FormUrlEncoded
@POST(HostUrl.GET_EX_CHANGE_TASK)
Observable<BaseBean<String>> getExChangeTask(
@Field("code") String code
);
@FormUrlEncoded
@POST(HostUrl.SCAN_EX_CHANGE)
Observable<BaseBean<String>> scanExChange(
@Field("code") String code
);
@FormUrlEncoded
@POST(HostUrl.BACK_DEPOSIT)
Observable<BaseBean<String>> backDeposit(
@Field("refund_reason") String refund_reason
);
@FormUrlEncoded
@POST(HostUrl.BIND_PHONE)
Observable<BaseBean<LoginBean>> bindPhone(
@Field("phone") String phone,
@Field("code") String code,
@Field("password") String password,
@Field("repassword") String repassword
);
@FormUrlEncoded
@POST(HostUrl.MESSAGE_LIST_URL)
Observable<BaseBean<List<MessageListBean>>> getMessageList(
@Field("type") int type,
@Field("page") int page,
@Field("pageSize") int pageSize
);
@FormUrlEncoded
@POST(HostUrl.DELTETE_MESSAGE)
Observable<BaseBean<String>> deleteMessage(
@Field("id") int id
);
@FormUrlEncoded
@POST(HostUrl.GET_MESSAGE_DETAIL)
Observable<BaseBean<MessageListBean>> getMessageDetail(
@Field("id") int id
);
@POST(HostUrl.GET_UN_READ_COUNT)
Observable<BaseBean<UnReadBean>> getUnReadCount(
);
@POST(HostUrl.CHECK_UPLOAD)
Observable<BaseBean<VersionBean>> checkUpload(
);
}
| [
"moyaozhi@anjiu-tech.com"
] | moyaozhi@anjiu-tech.com |
371dd4d0392310ecedce2389450eb03fecb57be9 | 1c9589d4e3bc1523ba1e745a2155433e4bd4b85c | /src/com/javarush/test/level10/lesson04/task05/Solution.java | 65d1ca4c267fdc63bf615f74247dda52da99e72b | [] | no_license | Adeptius/JavaRushHomeWork | 230a7dfd48b063bf7e62d5b50e7fc3f4b529fc0a | ee587724a7d579463d5deb5211b8e2f4bf902fdb | refs/heads/master | 2020-05-22T06:42:56.780076 | 2019-09-12T15:43:25 | 2019-09-12T15:43:25 | 65,140,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package com.javarush.test.level10.lesson04.task05;
/* Задача №5 на преобразование целых типов
Расставьте правильно операторы приведения типа, чтобы получился ответ: c=256
int a = (byte)44;
int b = (byte)300;
short c = (byte)(b - a);
*/
public class Solution
{
public static void main(String[] args)
{
int a = (byte)44;
int b = 300;
short c = (short) (b - a);
System.out.println(c);
}
} | [
"adeptius@gmail.com"
] | adeptius@gmail.com |
c5d2b3931e9d3c8c048d667ff938add103f0a94c | 9186ed673d998368c715bd95accd02cda4880342 | /src/main/java/org/gwtproject/event/dom/client/ScrollEvent.java | 3ff31731f6d03926d958ff20c38468ce389f3555 | [
"Apache-2.0"
] | permissive | TDesjardins/gwt-event-dom | 82056f5fa6582f8cb853705416953dec2c8fb468 | d86b8762218335ee0f56308d6d95a969df872e86 | refs/heads/master | 2020-11-30T16:39:48.863625 | 2019-10-17T20:09:07 | 2019-10-17T20:09:07 | 230,444,381 | 0 | 0 | Apache-2.0 | 2019-12-27T12:57:58 | 2019-12-27T12:57:58 | null | UTF-8 | Java | false | false | 1,579 | java | /*
* Copyright 2018 The GWT Project Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwtproject.event.dom.client;
import org.gwtproject.dom.client.BrowserEvents;
/** Represents a native scroll event. */
public class ScrollEvent extends DomEvent<ScrollHandler> {
/** Event type for scroll events. Represents the meta-data associated with this event. */
private static final Type<ScrollHandler> TYPE =
new Type<>(BrowserEvents.SCROLL, new ScrollEvent());
/**
* Protected constructor, use {@link
* DomEvent#fireNativeEvent(org.gwtproject.dom.client.NativeEvent,
* org.gwtproject.event.shared.HasHandlers)} to fire scroll events.
*/
protected ScrollEvent() {}
/**
* Gets the event type associated with scroll events.
*
* @return the handler type
*/
public static Type<ScrollHandler> getType() {
return TYPE;
}
@Override
public final Type<ScrollHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ScrollHandler handler) {
handler.onScroll(this);
}
}
| [
"frank.hossfeld@googlemail.com"
] | frank.hossfeld@googlemail.com |
f56cab5f4172eb21b282c3f05c3b11f69ba3fa6d | f39b1d6f2f30193e4c28940b75f84a569e19590b | /src/main/java/br/com/sistema/horas/CrossCuting/Security/Open.java | 7fe7355ad9a639d88a9dceadd76c4c47919e45c5 | [] | no_license | andersonluizpereira/VRAPTOR | 8d3920eecb59a85488fa5ca46a04dd20aa6e835d | 43906ae71ca603675b0faeeec9c0681532753839 | refs/heads/master | 2020-05-22T13:40:43.501019 | 2017-10-18T00:50:21 | 2017-10-18T00:50:21 | 41,517,460 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package br.com.sistema.horas.CrossCuting.Security;
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Open {
}
| [
"andy2903.alp@gmail.com"
] | andy2903.alp@gmail.com |
c82dbe5527ab9305f3d870ff19ae2ee531a9ea0a | 3ffca14a82dd1aa24208b62f3e3d8210f803aefb | /src/main/java/edu/utdallas/hltri/data/clinical_trials/jaxb/SponsorsStruct.java | 8f2aa850ca42b25a51d28b23bfd3c202be6f2dea | [] | no_license | kaptainkoder/trec-pm | 94e1bff559ecbc72a639febea81fd59def3fbbe9 | 1ae69ffba877982afd113655e30261eba1dd99d3 | refs/heads/master | 2020-07-24T04:20:48.546625 | 2019-05-13T16:16:43 | 2019-05-13T16:16:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,037 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.08.25 at 12:59:43 PM CDT
//
package edu.utdallas.hltri.data.clinical_trials.jaxb;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for sponsors_struct complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="sponsors_struct">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="lead_sponsor" type="{}sponsor_struct"/>
* <element name="collaborator" type="{}sponsor_struct" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sponsors_struct", propOrder = {
"leadSponsor",
"collaborator"
})
public class SponsorsStruct
implements Serializable
{
private final static long serialVersionUID = 1L;
@XmlElement(name = "lead_sponsor", required = true)
protected SponsorStruct leadSponsor;
protected List<SponsorStruct> collaborator;
/**
* Gets the value of the leadSponsor property.
*
* @return
* possible object is
* {@link SponsorStruct }
*
*/
public SponsorStruct getLeadSponsor() {
return leadSponsor;
}
/**
* Sets the value of the leadSponsor property.
*
* @param value
* allowed object is
* {@link SponsorStruct }
*
*/
public void setLeadSponsor(SponsorStruct value) {
this.leadSponsor = value;
}
/**
* Gets the value of the collaborator property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the collaborator property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCollaborator().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SponsorStruct }
*
*
*/
public List<SponsorStruct> getCollaborator() {
if (collaborator == null) {
collaborator = new ArrayList<SponsorStruct>();
}
return this.collaborator;
}
}
| [
"goodwintrr@nih.gov"
] | goodwintrr@nih.gov |
81d7df559173aebb71b30c1ac7a3ce1aa6dc549e | fc9ad440b600971a8a19d5e759322ee5f8d6ef95 | /Stack/StockSpan.java | 9f5059bf8835360c8683baa70ceaa55f3ff2a268 | [] | no_license | Ag9991323/DSA | ed565ac6212f89e55b99c2dfc01e6cd4e634fe47 | 0cb777260cb548aec784a966554f67172d6e79bb | refs/heads/master | 2021-01-07T19:49:35.815508 | 2020-06-19T15:47:16 | 2020-06-19T15:47:16 | 241,803,302 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package Stack;
import java.util.*;
class Stockspan{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
while(t-- >0){
int N= scan.nextInt();
int arr[] = new int[N];
for(int i=0;i<N;i++)
arr[i]= scan.nextInt();
Stack<Integer> st = new Stack<Integer>();
st.push(0);
System.out.println(1);
for(int i=1;i<N;i++){
while(!st.isEmpty()&&arr[st.peek()]<=arr[i]){
st.pop();
}
int span =st.isEmpty()? i+1:i-st.peek();
System.out.print(span+" ");
st.push(i);
}
System.out.println();
}
}
} | [
"ag9991323@gmail.com"
] | ag9991323@gmail.com |
b887b8ea8ba05d435d671329f68f5778596b4f47 | 3af91c4d9827847718e148cdfd47faa88ff43730 | /cmpay/pay-service-quartz/src/main/java/com/cmpay/service/quartz/model/SettTotalBean.java | cd080cf1ccf60d6a06e47d8b6563f117a35b833d | [] | no_license | gengkangkang/cmpay | fc5077f98eef1de3491a86309090a1267809ee14 | 7ee78c73e277dbb4da20771dd8503fd2f6bbb196 | refs/heads/master | 2022-12-31T11:55:28.423363 | 2020-10-23T07:20:47 | 2020-10-23T07:20:47 | 306,558,557 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 572 | java | package com.cmpay.service.quartz.model;
import java.math.BigDecimal;
/**
* @author gengkangkang
* @E-mail gengkangkang@cm-inv.com
*
* 2017年1月11日 上午10:49:50
*
*/
public class SettTotalBean {
private String merId;
private BigDecimal settToatlAmt;
public String getMerId() {
return merId;
}
public void setMerId(String merId) {
this.merId = merId;
}
public BigDecimal getSettToatlAmt() {
return settToatlAmt;
}
public void setSettToatlAmt(BigDecimal settToatlAmt) {
this.settToatlAmt = settToatlAmt;
}
}
| [
"tjeagle@163.com"
] | tjeagle@163.com |
97cf1c4e3b798db8e68fa54383433b567aeaacb5 | e56a23db4ec01368982a5eef7cadc99c0f7479e8 | /src/main/java/com/pranav/projects/crossword/SelectionOperators.java | 7f64e4b02267ef7c1d1baf79ecf7c56c1275eb42 | [] | no_license | pranavgupta21/Crossword-Generator | 03645c4fe8e44151848ef108c6771aa8fbe57b09 | 08228ce9a4cf2ee4265c0afd4fb62d15b4f73cd1 | refs/heads/master | 2018-12-29T02:21:25.785124 | 2013-04-13T11:20:09 | 2013-04-13T11:20:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,929 | java | package com.pranav.projects.crossword;
import java.util.ArrayList;
import java.util.List;
public class SelectionOperators {
public List<Integer> RWS_SUS(List<Individual> P, int numSelect){
double totalFitness = 0;
for (int indNo = 0; indNo < P.size(); indNo++){
totalFitness += P.get(indNo).getFitness();
}
List<Integer> selected = new ArrayList<Integer>();
double increment = totalFitness/P.size();
// place the pointer at some random initial position //
double wheelPosition = Math.random() * totalFitness;
double totalWheelPosition = wheelPosition;
// add the fitness values starting from the first individual on the wheel till the pointer position is reached //
double cumulativeProb = P.get(0).getFitness();
double totalCumulativeProb = cumulativeProb;
int indNo = 1;
for (int selectionNo = 0; selectionNo < numSelect; selectionNo++){
while (totalWheelPosition > totalCumulativeProb){
totalCumulativeProb += totalCumulativeProb + P.get(indNo).getFitness();
cumulativeProb = totalCumulativeProb % totalFitness;
indNo = (indNo + 1) % P.size();
}
selected.add(indNo);
totalWheelPosition += increment;
wheelPosition = totalWheelPosition % totalFitness;
}
return selected;
}
public List<Integer> SRWS_SUS(List<Individual> P, int numSelect){
double sumFitness = 0;
for (int indNo = 0; indNo < P.size(); indNo++){
sumFitness += P.get(indNo).getFitness();
}
double totalFitness = 0;
double fitness[] = new double[P.size()];
List<Integer> selected = new ArrayList<Integer>();
for (int indNo = 0; indNo < P.size(); indNo++){
double expected = (P.get(indNo).getFitness()/sumFitness) * numSelect;
int assign = (int) Math.floor(expected);
fitness[indNo] = expected - assign;
for (int addNo = 0; addNo < assign; addNo++){
selected.add(indNo);
}
totalFitness += fitness[indNo];
}
int assigned = selected.size();
//System.out.println("NumSelect : " + numSelect + " " + "Assigned : " + assigned);
// place the pointer at some random initial position //
double wheelPosition = Math.random() * totalFitness;
double totalWheelPosition = wheelPosition;
double increment = totalFitness/fitness.length;
// add the fitness values starting from current individual till the pointer position is reached, then increment //
double cumulativeProb = fitness[0];
double totalCumulativeProb = cumulativeProb;
int indNo = 1;
for (int selectionNo = 0; selectionNo < (numSelect - assigned); selectionNo++){
while (totalWheelPosition > totalCumulativeProb){
totalCumulativeProb += totalCumulativeProb + fitness[indNo];
cumulativeProb = totalCumulativeProb % totalFitness;
indNo = (indNo + 1) % P.size();
}
selected.add(indNo);
totalWheelPosition += increment;
wheelPosition = totalWheelPosition % totalFitness;
}
//System.out.println("SRWS_SUS completed !");
return selected;
}
}
| [
"partholikesit@gmail.com"
] | partholikesit@gmail.com |
3a3e805f187824fab059395e983490f11a141ebc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/35/35_f58fa40a8d6429e12d9ae5b8959a1d5c686f73ef/AmenServiceImpl/35_f58fa40a8d6429e12d9ae5b8959a1d5c686f73ef_AmenServiceImpl_t.java | 752f774b91db984c92de213d140bd0f8416e1c76 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 27,219 | java | package com.jaeckel.amenoid.api;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.params.CoreProtocolPNames;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.jaeckel.amenoid.api.model.Amen;
import com.jaeckel.amenoid.api.model.Comment;
import com.jaeckel.amenoid.api.model.DateSerializer;
import com.jaeckel.amenoid.api.model.Objekt;
import com.jaeckel.amenoid.api.model.ServerError;
import com.jaeckel.amenoid.api.model.Statement;
import com.jaeckel.amenoid.api.model.Topic;
import com.jaeckel.amenoid.api.model.User;
/**
* User: biafra
* Date: 9/23/11
* Time: 8:35 PM
*/
public class AmenServiceImpl implements AmenService {
private final static Logger log = LoggerFactory.getLogger("Amen");
// private final static String serviceUrl = "http://getamen.com/";
private final static String serviceUrl = "https://getamen.com/";
// private final static String serviceUrl = "https://staging.getamen.com/";
private String authName;
private String authPassword;
private User me;
private ServerError lastError;
private String authToken;
private HttpClient httpclient;
public AmenServiceImpl(HttpClient httpClient) {
// HttpParams params = new BasicHttpParams();
// params.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109);
// params.setParameter(CoreProtocolPNames.USER_AGENT, "Amenoid/1.0 HttpClient/4.0.1 Android");
//
// final SchemeRegistry schemeRegistry = new SchemeRegistry();
// Scheme scheme = new Scheme("https", SSLSocketFactory.getSocketFactory(), 443);
// schemeRegistry.register(scheme);
//
// httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager(params, schemeRegistry), params);
this.httpclient = httpClient;
// this.httpclient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "Amen/1.2.0 CFNetwork/548.1.4 Darwin/11.0.0");
this.httpclient.getParams().setParameter(CoreProtocolPNames.USER_AGENT, "Amenoid/1.0 HttpClient/4.2.1 Android");
}
private Gson gson = new GsonBuilder()
.registerTypeAdapter(Date.class, new DateSerializer())
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.serializeNulls()
.create();
@Override
public AmenService init(String authName, String authPassword) throws IOException {
log.debug("init");
this.authName = authName;
this.authPassword = authPassword;
User result = authenticate(authName, authPassword);
if (result == null) {
log.error("authentication failed");
} else {
me = result;
}
return this;
}
@Override
public AmenService init(String authToken, User me) {
this.me = me;
this.authToken = authToken;
return this; //To change body of implemented methods use File | Settings | File Templates.
}
private User authenticate(String authName, String authPassword) throws IOException {
User user;
String authJSON = "{\"password\":\"" + authPassword + "\",\"email\":\"" + authName + "\"}";
// log.trace("authJSON: " + authJSON);
HttpPost httpPost = new HttpPost(serviceUrl + "authentication.json");
// httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/json");
try {
httpPost.setEntity(new ByteArrayEntity(authJSON.getBytes("UTF8")));
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\"")) {
//TODO: rethink this! will cause trouble in multi threaded environment. What would Buddha recommend? An Exception?
lastError = gson.fromJson(responseString, ServerError.class);
throw new InvalidCredentialsException(lastError.getError());
}
user = gson.fromJson(responseString, User.class);
authToken = user.getAuthToken();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Unsupported Encoding", e);
} catch (ClientProtocolException e) {
throw new RuntimeException("Exception while authenticating", e);
}
return user;
}
public List<Amen> getFeed(int type) throws IOException {
return getFeed(0, 25, type);
}
@Override
public List<Amen> getFeed(long sinceId, int limit, int type) throws IOException {
return getFeed(0, sinceId, limit, type);
}
public List<Amen> getFeed(long beforeId, long sinceId, int limit, int type) throws IOException {
log.debug("getFeed");
ArrayList<Amen> result = new ArrayList<Amen>();
HashMap<String, String> params = createAuthenticatedParams();
if (sinceId > 0) {
params.put("last_amen_id", "" + sinceId);
}
if (sinceId > 0) {
params.put("first_amen_id", "" + beforeId);
}
params.put("limit", "" + limit);
String interesting = "";
if (type == FEED_TYPE_RECENT) {
interesting = "/recent";
} else if (type == FEED_TYPE_POPULAR) {
interesting = "/popular";
}
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "amen" + interesting + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getFeed produced error: " + responseString);
}
Type collectionType = new TypeToken<List<Amen>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
@Override
public boolean follow(User u) throws IOException {
log.debug("follow");
boolean result = false;
String json = "{\"user_id\":" + u.getId() + ",\"kind_id\":1, \"auth_token\":\"" + authToken + "\"}";
HttpUriRequest httpPost = RequestFactory.createJSONPOSTRequest(serviceUrl + "follows.json", json);
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("follow produced error: " + responseString);
}
if (" ".equals(responseString)) {
result = true;
}
log.debug("responseString: [" + responseString + "]");
return result; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public boolean unfollow(User u) throws IOException {
log.debug("unfollow");
boolean result = false;
Map<String, String> params = createAuthenticatedParams();
HttpUriRequest httpDelete = RequestFactory.createDELETERequest(serviceUrl + "follows/" + u.getId() + ".json", params);
HttpResponse response = httpclient.execute(httpDelete);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (" ".equals(responseString)) {
result = true;
}
log.debug("responseString: [" + responseString + "]");
return result;
}
@Override
public Amen amen(Long amenId) throws IOException {
log.debug("amen(" + amenId + ")");
Amen a = null;
String json = "{\"referring_amen_id\":" + amenId + ",\"kind_id\":1, \"auth_token\":\"" + authToken + "\"}";
HttpUriRequest httpPost = RequestFactory.createJSONPOSTRequest(serviceUrl + "amen.json", json);
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("amen produced error: " + responseString);
}
a = gson.fromJson(responseString, Amen.class);
return a;
}
@Override
public Amen amen(Statement statement) throws IOException {
log.debug("amen(Statement)");
Amen a = null;
String json = "{\"referring_amen_id\":" + statement.getId() + ",\"kind_id\":1, \"auth_token\":\"" + authToken + "\"}";
HttpUriRequest httpPost = RequestFactory.createJSONPOSTRequest(serviceUrl + "amen.json", json);
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("amen produced error: " + responseString);
}
a = gson.fromJson(responseString, Amen.class);
return a;
}
@Override
public Long dispute(Amen dispute) throws IOException {
//remove ranked_statements
// dispute.getStatement().setAgreeingNetwork(new ArrayList<User>());
Map<String, String> map = new HashMap<String, String>();
// map.put("share_to_facebook", "false");
// map.put("share_to_twitter", "false");
// map.put("has_photo", "false");
// map.put("shared_to_twitter_on_client", "false");
// map.put("local_time", "2012-04-22T00:01:24+020");
map.put("auth_token", authToken);
String amenJsonString = addKeyValueToJSON(dispute, map);
HttpUriRequest httpPost = RequestFactory.createJSONPOSTRequest(serviceUrl + "amen.json", amenJsonString);
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
log.trace("dispute: responseString: " + responseString);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("dispute produced error: " + responseString);
}
Amen a = gson.fromJson(responseString, Amen.class);
if (a != null && a.getKindId() == AMEN_KIND_DISPUTE) {
final boolean sameObjekt = a.getStatement().getObjekt().getName().equals(dispute.getStatement().getObjekt().getName());
if (sameObjekt) {
return a.getId();
} else {
log.trace("Not the same Objekt");
}
} else {
return null;
}
return null;
}
@Override
public Amen addStatement(Statement statement) throws IOException {
final String body = addAuthTokenToJSON(new Amen(statement), authToken);
HttpUriRequest httpPost = RequestFactory.createJSONPOSTRequest(serviceUrl + "amen.json", body);
HttpResponse response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException(responseString);
}
return gson.fromJson(responseString, Amen.class);
}
@Override
public Amen getAmenForId(Long id) throws IOException {
Amen amen;
HashMap<String, String> params = createAuthenticatedParams();
params.put("full", "true");
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/amen/" + id + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getAmenForId produced error: " + responseString);
}
amen = gson.fromJson(responseString, Amen.class);
if (amen.getCommentsCount() > 5) {
//get all the comments
ArrayList<Comment> comments = getCommentsForAmenId(amen.getId());
amen.setComments(comments);
}
return amen;
}
@Override
public ArrayList<Comment> getCommentsForAmenId(Long amenId) throws IOException {
ArrayList<Comment> result;
Map params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/amen/" + amenId + "/comments", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getAmenForId produced error: " + responseString);
}
Type collectionType = new TypeToken<List<Comment>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
@Override
public Statement getStatementForId(Long id) throws IOException {
log.debug("getStatementForId");
Statement statement;
HashMap<String, String> params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/statements/" + id + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
statement = gson.fromJson(responseString, Statement.class);
return statement;
}
@Override
public Topic getTopicsForId(String id, Long includeStatementId) throws IOException {
log.debug("getTopicsForId");
Topic topic;
HashMap<String, String> params = createAuthenticatedParams();
if (includeStatementId != null) {
params.put("include_statement_id", "" + includeStatementId);
}
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/topics/" + id + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
topic = gson.fromJson(responseString, Topic.class);
return topic;
}
@Override
public boolean takeBack(Long statementId) throws IOException {
log.debug("takeBack(): statementId: " + statementId);
boolean result = false;
HashMap<String, String> params = createAuthenticatedParams();
final String url = serviceUrl + "amen/" + statementId + ".json";
log.trace("DELETE " + url);
HttpUriRequest httpDelete = RequestFactory.createDELETERequest(url, params);
log.trace("httpDelete: " + httpDelete);
HttpResponse response = httpclient.execute(httpDelete);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (" ".equals(responseString)) {
result = true;
}
return result;
}
private HashMap<String, String> createAuthenticatedParams() {
HashMap<String, String> params = new HashMap<String, String>();
params.put("auth_token", authToken);
return params;
}
@Override
public List<Amen> getAmenForUser(Long userId, Long lastAmenId) throws IOException {
log.debug("getAmenForUser(User)");
if (lastAmenId == null) {
return getUserForId(userId).getRecentAmen();
}
log.debug("getFeed");
ArrayList<Amen> result;
HashMap<String, String> params = createAuthenticatedParams();
if (lastAmenId > 0) {
params.put("last_amen_id", "" + lastAmenId);
}
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "users/" + userId + "/amen.json", params);
// Header cookie = new BasicHeader("set-cookie", "_getamen_session_production=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJWQ1NGJjNzJhOTkyZTg5MzQ5NjhhZmFhNzRmNDE3Yzk2BjsAVA%3D%3D--59eb5438c0f48c1314caf043f4cd2a36c12ed26e");
// httpGet.addHeader(cookie);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getAmenForUser produced error: " + responseString);
}
Type collectionType = new TypeToken<List<Amen>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
@Override
public List<Amen> getAmenForUser(String userName, Long lastAmenId) throws IOException {
log.debug("getAmenForUser(User)");
log.debug("getFeed");
ArrayList<Amen> result;
User u;
HashMap<String, String> params = createAuthenticatedParams();
if (lastAmenId > 0) {
params.put("last_amen_id", "" + lastAmenId);
}
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + userName + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getAmenForUser produced error: " + responseString);
}
Type collectionType = new TypeToken<List<Amen>>() {
}.getType();
u = gson.fromJson(responseString, User.class);
return u.getRecentAmen();
}
@Override
public User getUserForId(Long userId) throws IOException {
log.debug("getUserInfo(User)");
User result;
HashMap<String, String> params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/users/" + userId + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
result = gson.fromJson(responseString, User.class);
return result; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public User getUserForId(String userName) throws IOException {
log.debug("getUserInfo(UserName)");
User result;
HashMap<String, String> params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + userName + ".json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
result = gson.fromJson(responseString, User.class);
return result; //To change body of implemented methods use File | Settings | File Templates.
}
private String makeStringFromEntity(HttpEntity responseEntity) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent(), "utf-8"));
StringBuilder builder = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
log.trace("makeStringFromEntity | " + line);
if ("<!DOCTYPE html>".equals(line)) {
//no JSON => Server error
log.error("Received HTML!");
return "{\"error\": \"Server error\"}";
}
builder.append(line);
}
return builder.toString();
}
private String extractCookie(String value) {
int semicolonIndex = value.indexOf(";");
return value.substring(0, semicolonIndex);
}
@Override
public User getMe() {
return me;
}
public List<User> followers(Long id) throws IOException {
List<User> result = new ArrayList<User>();
log.debug("followers()");
HashMap<String, String> params = createAuthenticatedParams();
// params.put("limit", "" + 40);
params.put("last_user_id", "" + 11181);
//https://getamen.com/users/12665/followers.json
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/users/" + id + "/followers.json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Collection<User>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
public List<User> following(Long id) throws IOException {
List<User> result = new ArrayList<User>();
log.debug("followers()");
HashMap<String, String> params = createAuthenticatedParams();
// params.put("limit", "" + 40);
// params.put("last_user_id", "" + 11181);
//https://getamen.com/users/12665/followers.json
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/users/" + id + "/following.json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Collection<User>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
public List<Objekt> objektsForQuery(CharSequence query, int kindId, Double lat, Double lon) throws IOException {
List<Objekt> result = null;
log.debug("objektsForQuery() lat: " + lat + " lon: " + lon);
HashMap<String, String> params = createAuthenticatedParams();
if (query != null) {
params.put("q", query.toString());
}
params.put("kind_id", "" + kindId);
if (lat != null) {
params.put("lat", "" + lat);
}
if (lon != null) {
params.put("lng", "" + lon);
}
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "objekts.json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Collection<Objekt>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
@Override
public String getAuthToken() {
return authToken;
}
@Override
public void removeAuthToken() {
authToken = null;
}
@Override
public List<Amen> getAmenForObjekt(Long objektId) throws IOException {
List<Amen> result;
// https://getamen.com/things/97282
log.debug("AmenForObjekt() if: " + objektId);
HashMap<String, String> params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "o/" + objektId + "/amens.json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Collection<Amen>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
public static String addKeyValueToJSON(Amen amen, Map<String, String> map) {
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
JsonElement element = gson.toJsonTree(amen);
JsonObject object = element.getAsJsonObject();
for (Map.Entry<String, String> entry : map.entrySet()) {
object.addProperty(entry.getKey(), entry.getValue());
}
return object.toString();
}
public static String addAuthTokenToJSON(Amen amen, String authToken) {
Map<String, String> map = new HashMap<String, String>();
map.put("auth_token", authToken);
return addKeyValueToJSON(amen, map);
}
@Override
public List<Amen> search(String query) throws IOException {
List<Amen> result;
// https://getamen.com/things/97282
log.debug("search(): " + query);
HashMap<String, String> params = createAuthenticatedParams();
params.put("q", query);
HttpUriRequest httpGet = RequestFactory.createGETRequest(serviceUrl + "/search.json", params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Collection<Amen>>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
return result;
}
@Override
public Comment createComment(int amenId, String body) {
Comment result = null;
log.debug("createComment(): " + body);
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("auth_token", authToken);
jsonObject.addProperty("body", body);
jsonObject.addProperty("amen_id", amenId);
HttpUriRequest jsonPostRequest = RequestFactory.createJSONPOSTRequest(serviceUrl + "/comments.json", jsonObject.toString());
HttpResponse response = null;
try {
response = httpclient.execute(jsonPostRequest);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
Type collectionType = new TypeToken<Comment>() {
}.getType();
result = gson.fromJson(responseString, collectionType);
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
return result;
}
@Override
public Boolean deleteComment(int commentId) {
return false;
}
public Amen getAmenByUrl(String url) throws IOException {
Amen amen;
HashMap<String, String> params = createAuthenticatedParams();
HttpUriRequest httpGet = RequestFactory.createGETRequest(url, params);
HttpResponse response = httpclient.execute(httpGet);
HttpEntity responseEntity = response.getEntity();
final String responseString = makeStringFromEntity(responseEntity);
if (responseString.startsWith("{\"error\":")) {
throw new RuntimeException("getAmenForId produced error: " + responseString);
}
amen = gson.fromJson(responseString, Amen.class);
return amen;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3b8b23437643e868218e8656595664f592e893b0 | 2fd218f764eb74af8e23dde8f18f4a3e71e40009 | /core/src/com/pignic/spacegrinder/pojo/Light.java | 0393504de97eb906168802d0d18dbf7b7820fc1f | [] | no_license | Pignic/SpaceGrinder | 3fd071384db3788146f1a32440f30dc153e944e3 | 4cc9d996064dbcf06810508c0df7973107683d1b | refs/heads/master | 2021-01-23T00:48:57.626644 | 2017-07-14T16:04:57 | 2017-07-14T16:04:57 | 92,850,051 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package com.pignic.spacegrinder.pojo;
public class Light extends ShipPart {
public float maxArc;
public float maxRange;
}
| [
"arcanicsoft@gmail.com"
] | arcanicsoft@gmail.com |
18f61bdb9d1e5bd8c57503b69c81478288bfd520 | 5b32059a1ff9e8a8dedc311bc68bba5f5375c381 | /src/travel_20190406/order/domain/Order.java | c77de46056bf50680f589f73dc5a32c0a34421e1 | [] | no_license | morristech/Travel | 7c24b053473f75b9cbbdb373edf4f75440d95d61 | 1164fb93fbd840daf6347eb57726b1cda09c7ab9 | refs/heads/master | 2020-07-20T13:33:00.429622 | 2019-04-14T22:43:11 | 2019-04-14T22:43:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,213 | 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 travel_20190406.order.domain;
import travel_20190406.common.business.domain.BaseDomain;
import travel_20190406.country.domain.BaseCountry;
import travel_20190406.user.domain.User;
import java.util.List;
/**
*
* @author Виталий
*/
public class Order extends BaseDomain<Long> {
private User user;
private double price;
private List<BaseCountry> countries;
public Order(User user, double price, List<BaseCountry> countries) {
super();
this.user = user;
this.price = price;
this.countries = countries;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public List<BaseCountry> getCountries() {
return countries;
}
public void setCountries(List<BaseCountry> countries) {
this.countries = countries;
}
}
| [
"morozov_spmt@mail.ru"
] | morozov_spmt@mail.ru |
d610f847266750e6dde885d597ffdde5531bea8a | 5a3526f39e9632a571f7ca45b6227968a2981747 | /app/src/main/java/com/juked/app/utils/Utils.java | fdd7ad2eeee537d0ab80081fe5f6a442fb6189c1 | [] | no_license | jbrathony/jukedapp_android | b187c4cf004f95aea7e7993c76bb051728c42b22 | 4224b4757bdb93d4cd1f0422b818790d39751246 | refs/heads/master | 2023-05-13T19:44:09.484480 | 2020-07-26T22:27:33 | 2020-07-26T22:27:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,690 | java | package com.juked.app.utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import android.content.Context;
import android.content.SharedPreferences;
import com.juked.app.module.JukedUser;
public class Utils {
static String kPreferenceName = "SMELT";
public static void CopyStream(InputStream is, OutputStream os)
{
final int buffer_size=1024;
try
{
byte[] bytes=new byte[buffer_size];
for(;;)
{
int count=is.read(bytes, 0, buffer_size);
if(count==-1)
break;
os.write(bytes, 0, count);
}
}
catch(Exception ex){}
}
public static void saveTimeStamp(Context con, String strTime){
SharedPreferences sp = con.getSharedPreferences(kPreferenceName,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putString("time", strTime);
editor.commit();
}
public static String getTimeStamp(Context con){
SharedPreferences sp = con.getSharedPreferences(kPreferenceName,
Context.MODE_PRIVATE);
return sp.getString("time", "");
}
public static void saveUserInfo(Context con, boolean status, JukedUser user){
SharedPreferences sp = con.getSharedPreferences(kPreferenceName,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("logged", status);
try {
editor.putString("userinfo", ObjectSerializer.serialize(user));
} catch (IOException e) {
e.printStackTrace();
}
editor.commit();
}
public static Boolean getUserStatus(Context con){
SharedPreferences sp = con.getSharedPreferences(kPreferenceName,
Context.MODE_PRIVATE);
return sp.getBoolean("logged", false);
}
public static JukedUser getUserinfo(Context con) throws IOException {
SharedPreferences sp = con.getSharedPreferences(kPreferenceName,
Context.MODE_PRIVATE);
return (JukedUser) ObjectSerializer
.deserialize(sp.getString("userinfo", ""));
}
public static String formatToYesterdayOrToday(Date dateTime) throws ParseException {
// Date dateTime = new SimpleDateFormat("EEE hh:mma MMM d, yyyy").parse(date);
Calendar cal = Calendar.getInstance();
TimeZone tz = cal.getTimeZone();
String strLocal = tz.getDisplayName();
Calendar calendar = Calendar.getInstance();
calendar.setTimeZone(tz);
calendar.setTime(dateTime);
Calendar today = Calendar.getInstance();
Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DATE, -1);
DateFormat timeFormatter = new SimpleDateFormat("hh:mma");
timeFormatter.setTimeZone(tz);
if (calendar.get(Calendar.YEAR) == today.get(Calendar.YEAR) && calendar.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)) {
return "Today " + timeFormatter.format(dateTime);
} else if (calendar.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR) && calendar.get(Calendar.DAY_OF_YEAR) == yesterday.get(Calendar.DAY_OF_YEAR)) {
return "Yesterday " + timeFormatter.format(dateTime);
} else {
SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy/MM/dd hh:mma");
simpleDate.setTimeZone(tz);
String strDt = simpleDate.format(dateTime);
return strDt;
}
}
} | [
"peacehoney425@gmail.com"
] | peacehoney425@gmail.com |
0fa2039ea1d0e0b3c48c434b14396b36e83768f8 | 16da6b928e0e19c85b5d7fe57ecb48232f955185 | /src/main/java/DependencyExample.java | 27f56fa9191a237ddeb5dceef949ab6bbfae3783 | [] | no_license | yipeiw/hw0-yipeiw | 18928dd67ea4b5630a52b417bb9e0fb645e7cb23 | 183318aed7e186b36d8b348af0057c9b84e0d9ea | refs/heads/master | 2016-09-11T15:02:30.514474 | 2012-09-10T20:38:00 | 2012-09-10T20:38:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | import java.io.StringReader;
import edu.stanford.nlp.ling.Word;
import edu.stanford.nlp.objectbank.TokenizerFactory;
import edu.stanford.nlp.process.PTBTokenizer.PTBTokenizerFactory;
import edu.stanford.nlp.process.Tokenizer;
/**
* 9 * An example for Homework 0 of 11791 F12
*
* 11 * @author Zi Yang <ziy@cs.cmu.edu>
*/
public class DependencyExample {
/**
* Tokenize a sentence in the argument, and print out the tokens to the
* console.
*
* @param args
* Set the first argument as the sentence to be tokenized.
*/
public static void main(String[] args) {
TokenizerFactory<Word> factory = PTBTokenizerFactory
.newTokenizerFactory();
Tokenizer<Word> tokenizer = factory.getTokenizer(new StringReader(
args[0]));
System.out.println(tokenizer.tokenize().toString());
}
}
| [
"yipeiw@andrew.cmu.edu"
] | yipeiw@andrew.cmu.edu |
0db4bf6b029548bbf5d4e7a157da88f412cf5899 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/javax_swing_DefaultListSelectionModel_getLeadSelectionIndex.java | e7b820e1d72ae97947ac8ddb98fdcd2f225ff274 | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | class javax_swing_DefaultListSelectionModel_getLeadSelectionIndex{ public static void function() {javax.swing.DefaultListSelectionModel obj = new javax.swing.DefaultListSelectionModel();obj.getLeadSelectionIndex();}} | [
"peter2008.ok@163.com"
] | peter2008.ok@163.com |
12115fb3e73e79e6a2da46e7ffb0aee8f3da614b | 8e07f254cc920bf1203fd8c59b9e82e67aa82d8c | /src/main/java/com/yanmai/controller/CoreController.java | 45c18a784cc9f2b256c3b51bcef7a3173ed6d1a0 | [] | no_license | wuyong1992/WeChatSpringmvc | 9e52ee246e61c1fc146852e5ecadb33df77f4aa7 | 5a1c0daffd986ac66afcdfb35ff301468a553ca4 | refs/heads/master | 2021-01-19T05:00:14.116070 | 2017-06-14T11:45:30 | 2017-06-14T11:45:30 | 87,408,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,015 | java | package com.yanmai.controller;
import com.yanmai.service.CoreService;
import com.yanmai.util.ReturnModel;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
public class CoreController extends GenericController {
@Autowired
private WxMpConfigStorage configStorage;
@Autowired
private WxMpService wxMpService;
@Autowired
private CoreService coreService;
@RequestMapping(value = "test")
public String testWeb() {
return "test";
}
/**
* 微信公众号webservice主服务接口,提供与微信服务器的信息交互
*
* @param request
* @param response
* @throws Exception
*/
@ResponseBody
@RequestMapping(value = "core")
public String wechatCore(HttpServletRequest request, HttpServletResponse response) throws Exception {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
String signature = request.getParameter("signature");
String nonce = request.getParameter("nonce");
String timestamp = request.getParameter("timestamp");
if (!this.wxMpService.checkSignature(timestamp, nonce, signature)) {
// 消息签名不正确,说明不是公众平台发过来的消息
return "非法请求";
}
String echoStr = request.getParameter("echostr");
if (StringUtils.isNotBlank(echoStr)) {
// 说明是一个仅仅用来验证的请求,回显echostr
String echoStrOut = String.copyValueOf(echoStr.toCharArray());
return echoStrOut;
}
//如果传递的参数没有encrypt_type这个值,说明是明文传输
String encryptType = StringUtils.isBlank(request.getParameter("encrypt_type"))
? "raw"
: request.getParameter("encrypt_type");
if ("raw".equals(encryptType)) {
// 明文传输的消息
WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(request.getInputStream());
WxMpXmlOutMessage outMessage = this.coreService.route(inMessage);
return outMessage.toXml();
}
if ("aes".equals(encryptType)) {
// 是aes加密的消息
String msgSignature = request.getParameter("msg_signature");
WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(
request.getInputStream(), this.configStorage, timestamp, nonce,
msgSignature);
this.logger.debug("\n消息解密后内容为:\n{} ", inMessage.toString());
WxMpXmlOutMessage outMessage = this.coreService.route(inMessage);
this.logger.info(response.toString());
return outMessage.toEncryptedXml(this.configStorage);
}
response.getWriter().println("不可识别的加密类型");
return "不可识别的加密类型";
}
@RequestMapping(value = "myMiniWeb")
public String goMyMiniWeb(){
System.out.println("正在访问");
return "myMiniWeb";
}
/**
* 通过openid获得基本用户信息
* 详情请见: http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html
*
* @param response
* @param openid openid
* @param lang zh_CN, zh_TW, en
*/
@RequestMapping(value = "getUserInfo")
public WxMpUser getUserInfo(HttpServletResponse response, @RequestParam(value = "openid") String openid, @RequestParam(value = "lang") String lang) {
ReturnModel returnModel = new ReturnModel();
WxMpUser wxMpUser = null;
try {
wxMpUser = this.wxMpService.getUserService().userInfo(openid, lang);
returnModel.setResult(true);
returnModel.setDatum(wxMpUser);
renderString(response, returnModel);
} catch (WxErrorException e) {
returnModel.setResult(false);
returnModel.setReason(e.getError().toString());
renderString(response, returnModel);
this.logger.error(e.getError().toString());
}
return wxMpUser;
}
/**
* 通过code获得基本用户信息
* 详情请见: http://mp.weixin.qq.com/wiki/14/bb5031008f1494a59c6f71fa0f319c66.html
*
* @param response
* @param code code
* @param lang zh_CN, zh_TW, en
*/
@RequestMapping(value = "getOAuth2UserInfo")
public void getOAuth2UserInfo(HttpServletResponse response, @RequestParam(value = "code") String code, @RequestParam(value = "lang") String lang) {
ReturnModel returnModel = new ReturnModel();
WxMpOAuth2AccessToken accessToken;
WxMpUser wxMpUser;
try {
accessToken = this.wxMpService.oauth2getAccessToken(code);
wxMpUser = this.wxMpService.getUserService()
.userInfo(accessToken.getOpenId(), lang);
returnModel.setResult(true);
returnModel.setDatum(wxMpUser);
renderString(response, returnModel);
} catch (WxErrorException e) {
returnModel.setResult(false);
returnModel.setReason(e.getError().toString());
renderString(response, returnModel);
this.logger.error(e.getError().toString());
}
}
/**
* 用code换取oauth2的openid
* 详情请见: http://mp.weixin.qq.com/wiki/1/8a5ce6257f1d3b2afb20f83e72b72ce9.html
*
* @param response
* @param code code
*/
@RequestMapping(value = "getOpenid")
public void getOpenid(HttpServletResponse response, @RequestParam(value = "code") String code) {
ReturnModel returnModel = new ReturnModel();
WxMpOAuth2AccessToken accessToken;
try {
accessToken = this.wxMpService.oauth2getAccessToken(code);
returnModel.setResult(true);
returnModel.setDatum(accessToken.getOpenId());
renderString(response, returnModel);
} catch (WxErrorException e) {
returnModel.setResult(false);
returnModel.setReason(e.getError().toString());
renderString(response, returnModel);
this.logger.error(e.getError().toString());
}
}
}
| [
"627522616@qq.com"
] | 627522616@qq.com |
d81be3a19210173566f5d69d66e134783fe6b3e0 | c2edb32ab60fb91aa6be73a1c0fe6fdc45e9a22a | /src/main/java/org/bot/discord/command/CommandReminder.java | ec6013df1cb71c9c7f31a132729856c3fdd4f042 | [] | no_license | Khoz0/toDoBot | 738af99c8261f97b6991ab9fcab9b5accca87762 | 03c2920d5d7e2baf897a5a526786fd6d7941aad8 | refs/heads/main | 2023-08-15T22:14:48.813408 | 2021-10-22T15:06:22 | 2021-10-22T15:06:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,876 | java | package org.bot.discord.command;
import org.javacord.api.event.message.MessageCreateEvent;
import java.io.*;
/**
* @author Roberge-Mentec Corentin
*/
public class CommandReminder implements CommandExecutor {
private File fileTodo;
/**
* @param event the message listened by the bot
* @param command the command adapted to the message
* @param args the information to complete the command
*/
@Override
public void run(MessageCreateEvent event, Command command, String[] args) {
try {
createFile();
String printTasks = browseFile();
event.getChannel().sendMessage("Tasks to do:\n```"+printTasks+"```");
}
catch (Exception e) {
System.err.println(e);
}
}
/**
* The method to verify if a to-do file already exists and to create it if not
* @throws IOException the exception thrown by the file creation
*/
private void createFile() throws IOException {
fileTodo = new File("todo.txt");
if (fileTodo.createNewFile()) {
System.out.println("File created");
} else {
System.out.println("File already exists");
}
}
/**
* The method to browse the to-do tasks in the to-do file
* @return the concatenated list of the to-do tasks
* @throws IOException the exception thrown by the reading of the file
*/
private String browseFile() throws IOException {
FileReader fr = new FileReader(fileTodo);
StringBuilder stringBuilder = new StringBuilder();
BufferedReader br = new BufferedReader(fr);
String line;
while((line = br.readLine()) != null){
stringBuilder.append(line);
stringBuilder.append("\n");
}
fr.close();
return stringBuilder.toString();
}
}
| [
"c.robergementec@outlook.fr"
] | c.robergementec@outlook.fr |
af24fa357fb25ceb4b7f29f80a41c9f4ac5e4abe | ebc942e6549f5d36dc2e134040e4f1a5fd8cfbfb | /src/Inventarios/JFrameVistaPrevia.java | 74932309608719ed7d071fd5c483ac5c66c0ff4e | [] | no_license | lscauv/siuv | 00ff02d304355fb10967c56991161b14cba8736c | c43413354b94099933c788c932a384f44142bde3 | refs/heads/master | 2016-09-05T13:22:25.227051 | 2013-06-02T21:56:03 | 2013-06-02T21:56:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,946 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Inventarios;
import com.mysql.jdbc.*;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.*;
import java.util.Calendar;
//Imports de las Fechas Agregados
import java.text.SimpleDateFormat;
import java.util.Date;
//
/**
*
* @author Giovanni
*/
public class JFrameVistaPrevia extends javax.swing.JFrame {
private java.sql.Connection cnn;
private java.sql.Statement stmt;
private java.sql.PreparedStatement pstmt;
/**
* Creates new form JFrameVistaPrevia
*/
public JFrameVistaPrevia() {
initComponents();
setLocationRelativeTo(null);
setResizable(false);
setDefaultCloseOperation(0);
setTitle("Informe de Inventario");
loadProduct();
LabelFecha.setText(fechaActual());
}
private void loadProduct()
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
cnn = DriverManager.getConnection("jdbc:mysql://localhost/siuv", "root", "uv");
stmt = cnn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM PRODUCTO");
java.sql.ResultSetMetaData metadata = rs.getMetaData();
DefaultTableModel dataModel = new DefaultTableModel();
jTable1.setModel(dataModel);
//create an array of column names
java.sql.ResultSetMetaData mdata = rs.getMetaData();
int colCount = mdata.getColumnCount();
String[] colNames = new String[colCount];
for (int i = 1; i <= colCount; i++) {
colNames[i - 1] = mdata.getColumnName(i);
}
dataModel.setColumnIdentifiers(colNames);
//now populate the data
while (rs.next()) {
String[] rowData = new String[colCount];
for (int i = 1; i <= colCount; i++) {
rowData[i - 1] = rs.getString(i);
}
dataModel.addRow(rowData);
}
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(this, ex.getMessage());
}
}
public static String fechaActual() {
Date fecha = new Date();
SimpleDateFormat formatoFecha = new SimpleDateFormat("dd/MM/YYYY");
return formatoFecha.format(fecha);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton5 = new javax.swing.JButton();
LabelFecha = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel2.setBackground(new java.awt.Color(0, 153, 204));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Vista Previa del Inventario");
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 529, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(289, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
.addContainerGap())
);
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7"
}
));
jTable1.setEnabled(false);
jScrollPane1.setViewportView(jTable1);
jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventarios/Images/back2.png"))); // NOI18N
jButton5.setText("Regresar");
jButton5.setBorder(null);
jButton5.setBorderPainted(false);
jButton5.setContentAreaFilled(false);
jButton5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton5.setIconTextGap(-5);
jButton5.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventarios/Images/back3.png"))); // NOI18N
jButton5.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Inventarios/Images/back1.png"))); // NOI18N
jButton5.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel5.setText("Fecha:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(LabelFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton5))
.addComponent(jScrollPane1))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton5))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(LabelFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 407, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(31, Short.MAX_VALUE))
);
jPanel3.setBackground(new java.awt.Color(0, 153, 204));
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 828, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 42, Short.MAX_VALUE)
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 579, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 19, Short.MAX_VALUE)))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
JFrameInformedeInventario obj = new JFrameInformedeInventario();
obj.setVisible(true);
dispose();
}//GEN-LAST:event_jButton5ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(JFrameVistaPrevia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(JFrameVistaPrevia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(JFrameVistaPrevia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(JFrameVistaPrevia.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new JFrameVistaPrevia().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel LabelFecha;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
}
| [
"gj_garciac10@hotmail.com"
] | gj_garciac10@hotmail.com |
d49e19b885316062684dc30fb8250a8bea99051e | bb870a8c9d9a9fda85e91c36536e7d2450afdde7 | /Tema 7/Arrays Unidimensionales/S07Ejercicio03.java | 1bb2e302787c55356d3ea70367da8e3721dd5a96 | [] | no_license | Fabiobr27/Ejercicios-java | 77bbbf9f32a6dff15e2a8b128a92aac421f29127 | d832f45fa5c74cac74d27ba2653987a30a44cd27 | refs/heads/master | 2020-04-01T17:31:50.080616 | 2019-05-17T23:46:17 | 2019-05-17T23:46:17 | 153,434,830 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | public class S07Ejercicio03 {
public static void main (String [] args) {
int [] num = new int [10];
int i;
System.out.println("Introduce 10 números enteros");
for (i = 0; i <10;i++){
num[i] = Integer.parseInt(System.console().readLine());
}
System.out.println("Los números introducidos al reves son :");
for (i = 9; i >=0;i--){
System.out.println(num[i]);
}
}
}
| [
"Fabio2000br@gmail.com"
] | Fabio2000br@gmail.com |
9175d392c7ce33d069bfac0f92a7545ae6fa70f8 | c50943a5c11d6af158c774f6ab4d453541017e48 | /src/teapot_saga_iv/files/OptionMenu.java | f75e9df7af52e983ded5be009445761ce1101d2f | [] | no_license | Olhcim/Teapot-Saga-IV | 7c73accfb2728f77559da21e8a277686dbb3f42c | 635d94ba69669e44ce8d5f4249db3964680daa77 | refs/heads/master | 2020-12-24T15:49:42.561256 | 2013-11-24T20:12:37 | 2013-11-24T20:12:37 | 12,671,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,082 | java |
package teapot_saga_iv.files;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import org.jdesktop.layout.GroupLayout;
import teapot_saga_iv.Main;
public class OptionMenu extends JFrame{
private JButton exitButton;
private JButton restartButton;
private JButton continueButton;
private JTextArea textArea;
public OptionMenu(String text)
{
addComponents();
this.setLocationRelativeTo(null);
this.setAlwaysOnTop(true);
textArea.setText(text);
this.setVisible(true);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void addComponents() {
exitButton = new javax.swing.JButton();
restartButton = new javax.swing.JButton();
continueButton = new javax.swing.JButton();
textArea = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
exitButton.setText("Exit");
exitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { exitButtonActionPerformed(evt); }
});
restartButton.setText("Restart");
restartButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { restartButtonActionPerformed(evt); }
});
continueButton.setText("Continue");
continueButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { continueButtonActionPerformed(evt); }
});
textArea.setColumns(20);
textArea.setRows(5);
textArea.setEditable(false);
textArea.setOpaque(false);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(restartButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(continueButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 90, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(0, 0, Short.MAX_VALUE))
.add(layout.createSequentialGroup()
.addContainerGap()
.add(textArea)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.add(textArea)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(exitButton)
.add(restartButton)
.add(continueButton)))
);
pack();
}
private void exitButtonActionPerformed(ActionEvent evt) {
System.exit(0);
}
private void restartButtonActionPerformed(ActionEvent evt) {
Main.setupGame();
}
private void continueButtonActionPerformed(ActionEvent evt) {
}
public static void main(String[] args)
{
JFrame frame = new OptionMenu("Hello, my name is nathen and i think this line of text is too long.");
}
}
| [
"Najumicom@gmail.com"
] | Najumicom@gmail.com |
d1244c945043fbc4d07a4271b24227ca1c379ad6 | 7a4a62721df0daf92a50f2f79ea73767c594ffc7 | /app/src/main/java/com/elfefe/mynews/utils/NYTCalls.java | 7b0c82e76df502f522210bf81296bb76b2a213b2 | [] | no_license | elfefe/MyNews | b0dc3362cc93bc8d192d5c80f2484edaabbe61fb | 422b9966f2dadfa77418f8e6ba34507bdf01a5fa | refs/heads/toRebase | 2020-05-14T08:49:11.136713 | 2019-08-29T11:11:06 | 2019-08-29T11:11:06 | 181,729,160 | 0 | 1 | null | 2019-06-19T00:41:25 | 2019-04-16T16:42:29 | Java | UTF-8 | Java | false | false | 2,302 | java | package com.elfefe.mynews.utils;
import com.elfefe.mynews.models.mostpopular.MostPopularQuery;
import com.elfefe.mynews.models.search.SearchQuery;
import com.elfefe.mynews.models.topstory.TopStoryQuery;
import java.io.IOException;
import java.util.Map;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class NYTCalls {
private final NYTService nytService;
private final String key;
public NYTCalls() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://api.nytimes.com/svc/")
.client(client)
.addConverterFactory(GsonConverterFactory.create())
.build();
nytService = retrofit.create(NYTService.class);
key = "7beqz304Fmqzmbi3GxAQxanKShTgNCRb";
}
TopStoryQuery fetchTopStoriesFollowing() {
Call<TopStoryQuery> call = nytService.getTopStories(key);
try {
return call.execute().body();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
MostPopularQuery fetchMostPopularFollowing() {
Call<MostPopularQuery> call = nytService.getMostPopular(key);
try {
return call.execute().body();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
TopStoryQuery fetchFavoriteFollowing() {
Call<TopStoryQuery> call = nytService.getFavorite("sports", key);
try {
return call.execute().body();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public SearchQuery fetchSearchArticleFollowing(Map<String, String> search) {
Call<SearchQuery> call = nytService.getSearchArticle(search, key);
try {
return call.execute().body();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
} | [
"f.bou-reiff@orange.fr"
] | f.bou-reiff@orange.fr |
af55faef47d9f49bf251bf5eb0dcf80c301799b9 | a216e319f89065521e0f316b750ae6c1a03446b5 | /gen/com/mg/customlistview/BuildConfig.java | 551ea207857ccb8ae1683b5aa30a43afff66845a | [] | no_license | MesutGunes/CustomListview | 5a5fe61a6b234c9fa03d103a32a0191a181fdb15 | db9068ba853bdfebeb6a7b3aa6465befafe112aa | refs/heads/master | 2020-05-17T03:03:58.998795 | 2014-09-25T18:08:07 | 2014-09-25T18:08:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | /** Automatically generated file. DO NOT MODIFY */
package com.mg.customlistview;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"mstgns1701@gmail.com"
] | mstgns1701@gmail.com |
979675ad95f626dacbcb65bcd22712dac4ff33ca | d3ded4991f56dbd406ee5c591e58d0ea0cfb4acb | /src/main/java/com/Main.java | 9de016652f65311bc9106d1d3365ea79eaa14614 | [] | no_license | Critalic/Algorithms_lab_2 | 16e03c57d30599fcf26728270a3ae6df8163fda6 | 6e4887725e8377681374ec70bc4d614ca9976a25 | refs/heads/master | 2023-08-16T00:59:41.784465 | 2021-10-19T17:14:57 | 2021-10-19T17:14:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 326 | java | package com;
import com.DataBase.DBInterface;
import java.util.Scanner;
public class Main {
static String path = "C:\\Users\\START\\Documents\\DataBase";
public static void main(String[] args) {
DBInterface dbInterface = new DBInterface(new Scanner(System.in), path);
dbInterface.startUp();
}
}
| [
"vitalikkryvonosiuk@gmail.com"
] | vitalikkryvonosiuk@gmail.com |
c5cd1f7f96f35fccf8e8dc12255a0bc6e680596b | 640f6e02c8e38e1deca7eec2ccdd22b5e64e4394 | /src/test/java/org/example/steps/ProfilePageSteps.java | 0b96e7d2039d90ca22c8d0c325d20626180f7561 | [] | no_license | joenvemu/Prueba_Choucair | 0bc921c148a5ec5a36736624b17832088ec16a13 | 0f1e2c9441ccabf94145297362a381a620838f33 | refs/heads/master | 2022-12-19T05:12:11.440083 | 2020-09-22T02:21:36 | 2020-09-22T02:21:36 | 296,963,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 532 | java | package org.example.steps;
import cucumber.api.java.en.And;
import cucumber.api.java.en.Then;
import org.example.pages.ProfilePage;
public class ProfilePageSteps {
private ProfilePage profilePage;
@Then("^I should be taken to the Profile page$")
public void i_should_be_taken_to_the_Home_page() {
profilePage.checkProfilePage();
}
@And("^The message this play \"([^\"]*)\"$")
public void theMessageThisPlayMensajeDeValidacion(String mensaje) {
profilePage.validateMessage(mensaje);
}
}
| [
"jorgevelez_02@hotmail.com"
] | jorgevelez_02@hotmail.com |
120b05571b58ec92a486e45c94c6e9b65f016e6e | d9118226ba5fd92e8e05b7818357b27e1cc89c5a | /src/main/java/rabbit/proxy/CacheChecker.java | 0212cb43708ef25b2049905489b824177bc35704 | [] | no_license | vpupkin/rabblt | bfe0589ef99e75b5492e943cb9bd0cae9198968f | 2daa4086efcdd0b25115fd94d5b7121eda984a89 | refs/heads/master | 2016-09-11T02:04:39.978718 | 2011-12-08T13:38:41 | 2011-12-08T13:38:41 | 32,385,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,330 | java | package rabbit.proxy;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import rabbit.cache.Cache;
import rabbit.cache.CacheEntry;
import rabbit.cache.CacheException;
import rabbit.http.HttpDateParser;
import rabbit.http.HttpHeader;
/** A class to verify if a cache entry can be used.
*
* @author <a href="mailto:robo@khelekore.org">Robert Olofsson</a>
*/
class CacheChecker {
private static final String EXP_ERR = "No expected header found";
HttpHeader checkExpectations (Connection con,
HttpHeader header,
HttpHeader webheader) {
String exp = header.getHeader ("Expect");
if (exp == null)
return null;
if (exp.equals ("100-continue")) {
String status = webheader.getStatusCode ();
if (status.equals ("200") || status.equals ("304"))
return null;
return con.getHttpGenerator ().get417 (exp);
}
String[] sts = exp.split (";");
for (String e : sts) {
int i = e.indexOf ('=');
if (i == -1 || i == e.length () -1)
return con.getHttpGenerator ().get417 (e);
String type = e.substring (0, i);
String value = e.substring (i + 1);
if (type.equals ("expect")) {
String h = webheader.getHeader (value);
if (h == null)
return con.getHttpGenerator ().get417 (EXP_ERR);
}
}
return con.getHttpGenerator ().get417 (exp);
}
private HttpHeader checkIfMatch (Connection con,
HttpHeader header,
RequestHandler rh) {
CacheEntry<HttpHeader, HttpHeader> entry = rh.getEntry ();
if (entry == null)
return null;
HttpHeader oldresp = rh.getDataHook ();
HttpHeader expfail = checkExpectations (con, header, oldresp);
if (expfail != null)
return expfail;
String im = header.getHeader ("If-Match");
if (im == null)
return null;
String et = oldresp.getHeader ("Etag");
if (!ETagUtils.checkStrongEtag (et, im))
return con.getHttpGenerator ().get412 ();
return null;
}
/** Check if we can use the cached entry.
* @param con the Connection handling the request
* @param header the reques.
* @param rh the RequestHandler
* @return true if the request was handled, false otherwise.
*/
public boolean checkCachedEntry (Connection con,
HttpHeader header,
RequestHandler rh) {
con.getCounter ().inc ("Cache hits");
con.setKeepalive (true);
HttpHeader resp = checkIfMatch (con, header, rh);
if (resp == null) {
NotModifiedHandler nmh = new NotModifiedHandler ();
resp = nmh.is304 (header, con.getHttpGenerator (), rh);
}
if (resp != null) {
con.sendAndRestart (resp);
return true;
}
con.setMayCache (false);
try {
resp = con.setupCachedEntry (rh);
if (resp != null) {
con.sendAndClose (resp);
return true;
}
} catch (FileNotFoundException e) {
// ignore sorta, to pull resource from the web.
rh.setContent (null);
rh.setEntry (null);
} catch (IOException e) {
rh.setContent (null);
rh.setEntry (null);
}
return false;
}
/*
If-None-Match: "tag-hbhpjfvtsy"\r\n
If-Modified-Since: Thu, 11 Apr 2002 20:56:16 GMT\r\n
If-Range: "tag-hbhpjfvtsy"\r\n
-----------------------------------
If-Unmodified-Since: Thu, 11 Apr 2002 20:56:16 GMT\r\n
If-Match: "tag-ajbqyucqaf"\r\n
If-Range: "tag-ajbqyucqaf"\r\n
*/
public boolean checkConditions (HttpHeader header, HttpHeader webheader) {
String inm = header.getHeader ("If-None-Match");
if (inm != null) {
String etag = webheader.getHeader ("ETag");
if (!ETagUtils.checkWeakEtag (inm, etag))
return false;
}
Date dm = null;
String sims = header.getHeader ("If-Modified-Since");
if (sims != null) {
Date ims = HttpDateParser.getDate (sims);
String lm = webheader.getHeader ("Last-Modified");
if (lm != null) {
dm = HttpDateParser.getDate (lm);
if (dm.getTime () - ims.getTime () < 60000) //dm.after (ims))
return false;
}
}
String sums = header.getHeader ("If-Unmodified-Since");
if (sums != null) {
Date ums = HttpDateParser.getDate (sums);
if (dm != null) {
if (dm.after (ums))
return false;
} else {
String lm = webheader.getHeader ("Last-Modified");
if (lm != null) {
dm = HttpDateParser.getDate (lm);
if (dm.after (ums))
return false;
}
}
}
return true;
}
private void removeCaches (HttpHeader request,
HttpHeader webHeader, String type,
Cache<HttpHeader, HttpHeader> cache) {
String loc = webHeader.getHeader (type);
if (loc == null)
return;
try {
URL u = new URL (request.getRequestURI ());
URL u2 = new URL (u, loc);
String host1 = u.getHost ();
String host2 = u.getHost ();
if (!host1.equals (host2))
return;
int port1 = u.getPort ();
if (port1 == -1)
port1 = 80;
int port2 = u2.getPort ();
if (port2 == -1)
port2 = 80;
if (port1 != port2)
return;
HttpHeader h = new HttpHeader ();
h.setRequestURI (u2.toString ());
cache.remove (h);
} catch (CacheException e) {
Logger logger = Logger.getLogger (getClass ().getName ());
logger.log (Level.WARNING,
"RemoveCaches failed to remove cache entry: " +
request.getRequestURI () + ", " + loc,
e);
} catch (MalformedURLException e) {
Logger logger = Logger.getLogger (getClass ().getName ());
logger.log (Level.WARNING,
"RemoveCaches got bad url: " +
request.getRequestURI () + ", " + loc,
e);
}
}
private void removeCaches (HttpHeader request, HttpHeader webHeader,
Cache<HttpHeader, HttpHeader> cache) {
removeCaches (request, webHeader, "Location", cache);
removeCaches (request, webHeader, "Content-Location", cache);
}
void removeOtherStaleCaches (HttpHeader request, HttpHeader webHeader,
Cache<HttpHeader, HttpHeader> cache) {
String method = request.getMethod ();
String status = webHeader.getStatusCode ();
if ((method.equals ("PUT") || method.equals ("POST"))
&& status.equals ("201")) {
removeCaches (request, webHeader, cache);
} else if (method.equals ("DELETE") && status.equals ("200")) {
removeCaches (request, webHeader, cache);
}
}
}
| [
"V.i.P@localhost"
] | V.i.P@localhost |
b4aca4e74c6ed134b9c7ae35a0bc5d0d80d5e056 | 6f68f2052821be90e4520c8815609b653a7e59aa | /src/flappyDot/PipePair.java | 8b649db8e986c360aa239383e58d8c82d697ac61 | [] | no_license | takkasila/OOPLab_Week3_FlappyDotGame | 078a40ac38fa3f9c86205d491d2e4bf195c26630 | 99567abe76ace7970c3113c98396738469f66e38 | refs/heads/master | 2018-12-29T17:54:56.230192 | 2014-09-07T06:26:04 | 2014-09-07T06:26:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,371 | java | package flappyDot;
import java.util.Random;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
public class PipePair {
final static String PIPE_TOP = "res/pipe-top.png";
final static String PIPE_BOTTOM = "res/pipe-bottom.png";
final static public float GAP_SIZE = 200;
final static float VELOCITY_X = -4;
final static float RANDOM_RANGE = 100;
public Image pipe_top;
public Image pipe_bottom;
public float pos_x, pos_y;
public float vel_x;
public PipePair(float start_pos_x, float start_pos_y) throws SlickException
{
pos_x = start_pos_x;
pos_y = start_pos_y;
vel_x = VELOCITY_X;
pipe_top = new Image(PIPE_TOP);
pipe_bottom = new Image(PIPE_BOTTOM);
}
public static float GetRandomRange()
{
Random rand = new Random();
return rand.nextFloat()*RANDOM_RANGE - RANDOM_RANGE/2;
}
public void Update()
{
pos_x += vel_x;
//reset position to right of screen
if(pos_x < 0 - pipe_top.getWidth()/2)
{
pos_x = FlappyDotGame.SCREEN_WIDTH + pipe_top.getWidth()/2;
pos_y = FlappyDotGame.SCREEN_HEIGHT/2 + GetRandomRange();
}
}
public void Render()
{
pipe_top.draw(pos_x - pipe_top.getWidth()/2
, pos_y - pipe_top.getHeight() - GAP_SIZE/2);
pipe_bottom.draw(pos_x - pipe_bottom.getWidth()/2
, pos_y + GAP_SIZE/2);
}
}
| [
"takkasila@outlook.com"
] | takkasila@outlook.com |
eee5a4728495110bb8f7f7e0e6a0e8250e3c1b96 | 619cb0b35fcb7efbf6cb66278fdba2d1e39e5670 | /Chess/src/Pieces/Jester.java | 14c1c10a649f8b36614a33a7c8c217e89616db77 | [] | no_license | ahchang6/chess | 9b9737c659f249b2c06eb5ab63a28ca42db4ed9d | 1cf44c4c389498babb0760a733bdb35f7dc89aee | refs/heads/master | 2020-09-14T06:52:48.766399 | 2017-02-20T19:19:36 | 2017-02-20T19:19:36 | 94,469,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | package Pieces;
import game.Board;
import game.Move;
import javax.swing.*;
/**
* Created by ahchang6 on 2/9/17.
*
* Moves as a King, however, when it captures a non-Pawn/King piece, it becomes that piece of your color
*/
public class Jester extends Piece {
public Jester(Color color){
super(color);
}
public boolean canMoveTo(Move move, Board board){
if(Math.abs(move.endX()-move.startX())>1 || Math.abs(move.endY()-move.startY())>1)
return false;
return true;
}
public boolean canCapture(Move move, Board board){
if(canMoveTo(move, board)) {
Piece promote = board.getPiece(move.endX(), move.endY());
Piece promotee;
if(promote instanceof Knight)
promotee = new Knight(color);
else if(promote instanceof Rook)
promotee = new Rook(color);
else if(promote instanceof Bishop)
promotee = new Bishop(color);
else if(promote instanceof Queen)
promotee = new Queen(color);
else if(promote instanceof Cannon)
promotee = new Cannon(color);
else
promotee = new Pawn(color);
board.remove(move.startX(),move.startY());
board.place(promotee,move.startX(),move.startY());
return true;
}
return false;
}
public boolean blocked(Move move, Board board){
return true;
}
public Icon getIcon(Color color){
Icon icon;
if(color == Color.WHITE){
icon = new ImageIcon("src/game/images/whiteJester.jpg");
}
else{
icon = new ImageIcon("src/game/images/blackJester.jpg");
}
return icon;
}
}
| [
"ahchang6@d9c94b55-221a-4017-ad66-301122ff4019"
] | ahchang6@d9c94b55-221a-4017-ad66-301122ff4019 |
9ba1f3269587d82b6166abf5207c6b6304bd75ba | 0f0f6b0f8074e3b7441ea7571eae156a349e8356 | /food-delivery-app/payment-service/src/main/java/demo/service/Impl/PaymentServiceImpl.java | 51ec9bdc4fa76543f7dcd046898de9969d227811 | [
"MIT"
] | permissive | AlexFlanker/Food-Delivery-Application | 61c747e0f8b523ef50eb5ffa1b70b152096706f3 | 12509dd8c6983e0eb5184472f00e6bc1b010b97e | refs/heads/master | 2020-03-28T08:37:57.811667 | 2018-09-08T23:42:24 | 2018-09-08T23:42:24 | 147,977,886 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,633 | java | package demo.service.Impl;
import demo.domain.Payment;
import demo.domain.PaymentRepository;
import demo.service.AuthorizationRequest;
import demo.service.AuthorizationResponse;
import demo.service.OrderStatusUpdateMessage;
import demo.service.PaymentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.AsyncRabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.client.RestTemplate;
import static demo.service.PaymentProducerConfig.PAYMENT_EXCHANGE_NAME;
import static demo.service.PaymentProducerConfig.ROUTING_KEY_NAME;
@Service
public class PaymentServiceImpl implements PaymentService {
private static final Logger log = LoggerFactory.getLogger(PaymentServiceImpl.class);
private static final long DEFAULT_RESPONSE_RECEIVE_TIMEOUT = 6000L;
private PaymentRepository paymentRepository;
private AsyncRabbitTemplate asyncRabbitTemplate;
private RestTemplate restTemplate;
@Autowired
public PaymentServiceImpl(PaymentRepository paymentRepository,
AsyncRabbitTemplate asyncRabbitTemplate,
RestTemplate restTemplate) {
this.paymentRepository = paymentRepository;
this.asyncRabbitTemplate = asyncRabbitTemplate;
this.restTemplate = restTemplate;
}
@Override
public Payment savePayment(Payment payment) {
return this.paymentRepository.save(payment);
}
@Override
public ListenableFuture<AuthorizationResponse> makePayment(Payment payment) {
AuthorizationRequest request = new AuthorizationRequest(payment.getCreditCard(), payment.getAmount());
log.info("getting authorization from payment processing service...");
asyncRabbitTemplate.setReceiveTimeout(DEFAULT_RESPONSE_RECEIVE_TIMEOUT);
return asyncRabbitTemplate.convertSendAndReceive(PAYMENT_EXCHANGE_NAME, ROUTING_KEY_NAME, request);
}
@Override
public void updateOrderStatusAfterPayment(String orderId, OrderStatusUpdateMessage orderStatusUpdateMessage) {
String url = "http://localhost:8989/order/";
restTemplate.postForLocation(url+orderId, orderStatusUpdateMessage);
}
@Override
public Payment getPaymentById(String paymentId) {
return this.paymentRepository.findOne(paymentId);
}
@Override
public Payment getPaymentByOrderId(String orderId) {
return this.paymentRepository.findByOrderId(orderId);
}
}
| [
"tianjiesun@Tianjies-MacBook-Pro.local"
] | tianjiesun@Tianjies-MacBook-Pro.local |
0e352ebde4e4d0a24d5ef731d95708dfcdaec443 | a41dd598aaa4b1eee476ccfb73a685cbff17d911 | /MiniTuho/src/test/java/com/muumilaakso/management/ReferenceTest.java | 4276d0b885fc66133b8ccbcb8186728a14dd5eb4 | [] | no_license | jpsalo/minituho | a61e5f4319e16ff83759afd4081f80c3b3400705 | f12e224a77b260506ea7bd336fd0ef3456deaf35 | refs/heads/master | 2021-01-10T21:15:37.819854 | 2012-04-29T16:15:31 | 2012-04-29T16:15:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.muumilaakso.management;
import java.util.ArrayList;
import java.util.HashMap;
import junit.framework.TestCase;
/**
*
* @author tkairola
*/
public class ReferenceTest extends TestCase {
ArrayList<String> nimi1;
ArrayList<String> nimi2;
ArrayList<String> nimi3;
HashMap<Integer, ArrayList<String>> nameList;
Reference testRef;
public ReferenceTest(String testName) {
super(testName);
}
@Override
protected void setUp() throws Exception {
}
}
| [
"taru.airola@helsinki.fi"
] | taru.airola@helsinki.fi |
e30f2e6e315fdaf2102a9ec1f7272859de383da0 | cc043539f78bbcf8a2e5433f51d111ce4544816a | /src/main/java/cn/com/djin/ssm/entity/InRoomInfo.java | 84d50eef6a730eebfc019cbef9e0280d78358adc | [] | no_license | djin123/k0502_hotel_test1 | fc6201ad1b0ef3d863b44070402ec7860ee48f4d | 44d05bbd2989f5aca65682e00b184e35074c48bc | refs/heads/master | 2022-12-18T03:32:02.480770 | 2020-09-15T07:21:51 | 2020-09-15T07:21:51 | 295,647,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,643 | java | package cn.com.djin.ssm.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.Date;
/**
* 入住信息实体封装类
*/
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class InRoomInfo {
/** 主键 */
private Integer id;
/** 客人姓名 */
private String customerName;
/** 性别(1男 0女) */
private String gender;
/** 0普通,1vip */
private String isVip;
/** 身份证号 */
private String idcard;
/** 手机号 */
private String phone;
/** 押金 */
private Float money;
/** 入住时间 */
@JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss" ,timezone = "GMT+8")
private Date createDate;
/** 房间表主键 */
private Integer roomId;
/** 显示状态:1显示,0隐藏 */
private String status;
/** 退房状态:0未退房 1已经退房 */
private String outRoomStatus;
//客房属性对象
private Rooms rooms;
public Rooms getRooms() {
return rooms;
}
public void setRooms(Rooms rooms) {
this.rooms = rooms;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName == null ? null : customerName.trim();
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender == null ? null : gender.trim();
}
public String getIsVip() {
return isVip;
}
public void setIsVip(String isVip) {
this.isVip = isVip == null ? null : isVip.trim();
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard == null ? null : idcard.trim();
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public Float getMoney() {
return money;
}
public void setMoney(Float money) {
this.money = money;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Integer getRoomId() {
return roomId;
}
public void setRoomId(Integer roomId) {
this.roomId = roomId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getOutRoomStatus() {
return outRoomStatus;
}
public void setOutRoomStatus(String outRoomStatus) {
this.outRoomStatus = outRoomStatus == null ? null : outRoomStatus.trim();
}
@Override
public String toString() {
return "InRoomInfo{" +
"id=" + id +
", customerName='" + customerName + '\'' +
", gender='" + gender + '\'' +
", isVip='" + isVip + '\'' +
", idcard='" + idcard + '\'' +
", phone='" + phone + '\'' +
", money=" + money +
", createDate=" + createDate +
", roomId=" + roomId +
", status='" + status + '\'' +
", outRoomStatus='" + outRoomStatus + '\'' +
'}';
}
} | [
"502037675@qq.com"
] | 502037675@qq.com |
11450b3467b6dfea0de918b53b2a9cec34132bdc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_a7b270b7663c684b356be58ff6c1ee85e1adc6a6/TasksUiInternal/10_a7b270b7663c684b356be58ff6c1ee85e1adc6a6_TasksUiInternal_t.java | 16fc789c1f57557602e2ddd05bed901456b836c2 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 31,793 | java | /*******************************************************************************
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tasktop Technologies - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.ui.util;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.ProgressMonitorWrapper;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.AbstractTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.ITaskJobFactory;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.core.UncategorizedTaskContainer;
import org.eclipse.mylyn.internal.tasks.core.UnsubmittedTaskContainer;
import org.eclipse.mylyn.internal.tasks.ui.OpenRepositoryTaskJob;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.CategoryEditorInput;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.internal.tasks.ui.wizards.MultiRepositoryAwareWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewAttachmentWizardDialog;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewTaskWizard;
import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.sync.SynchronizationJob;
import org.eclipse.mylyn.tasks.core.sync.TaskJob;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
/**
* @author Steffen Pingel
*/
public class TasksUiInternal {
private static final String LABEL_CREATE_TASK = "Create Task";
// TODO e3.4 replace with SWT.NO_SCROLL constant
public static final int SWT_NO_SCROLL = 1 << 4;
public static MultiRepositoryAwareWizard createNewTaskWizard(ITaskMapping taskSelection) {
return new NewTaskWizard(taskSelection);
}
public static ImageDescriptor getPriorityImage(ITask task) {
if (task.isCompleted()) {
return CommonImages.COMPLETE;
} else {
return TasksUiImages.getImageDescriptorForPriority(PriorityLevel.fromString(task.getPriority()));
}
}
public static List<TaskEditor> getActiveRepositoryTaskEditors() {
List<TaskEditor> repositoryTaskEditors = new ArrayList<TaskEditor>();
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow window : windows) {
IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
for (IEditorReference editorReference : editorReferences) {
try {
if (editorReference.getEditorInput() instanceof TaskEditorInput) {
TaskEditorInput input = (TaskEditorInput) editorReference.getEditorInput();
if (input.getTask() != null) {
IEditorPart editorPart = editorReference.getEditor(false);
if (editorPart instanceof TaskEditor) {
repositoryTaskEditors.add((TaskEditor) editorPart);
}
}
}
} catch (PartInitException e) {
// ignore
}
}
}
return repositoryTaskEditors;
}
public static IProgressMonitor getUiMonitor(IProgressMonitor monitor) {
return new ProgressMonitorWrapper(monitor) {
@Override
public void beginTask(final String name, final int totalWork) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
getWrappedProgressMonitor().beginTask(name, totalWork);
}
});
}
@Override
public void done() {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
getWrappedProgressMonitor().done();
}
});
}
@Override
public void subTask(final String name) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
getWrappedProgressMonitor().subTask(name);
}
});
}
@Override
public void worked(final int work) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
getWrappedProgressMonitor().worked(work);
}
});
}
};
}
public static void openEditor(TaskCategory category) {
final IEditorInput input = new CategoryEditorInput(category);
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
TasksUiUtil.openEditor(input, CategoryEditor.ID_EDITOR, page);
}
}
});
}
public static void refreshAndOpenTaskListElement(IRepositoryElement element) {
if (element instanceof ITask) {
final AbstractTask task = (AbstractTask) element;
if (task instanceof LocalTask) {
TasksUiUtil.openTask(task);
} else {
String repositoryKind = task.getConnectorKind();
final AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
repositoryKind);
TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryKind,
task.getRepositoryUrl());
if (repository == null) {
StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
"No repository found for task. Please create repository in "
+ TasksUiPlugin.LABEL_VIEW_REPOSITORIES + "."));
return;
}
if (connector != null) {
boolean opened = false;
if (TasksUiPlugin.getTaskDataManager().hasTaskData(task)) {
opened = TasksUiUtil.openTask(task);
}
if (!opened) {
if (connector.canSynchronizeTask(repository, task)) {
// TODO consider moving this into the editor, i.e. have the editor refresh the task if task data is missing
TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
TasksUiUtil.openTask(task);
}
});
}
});
} else {
TasksUiUtil.openTask(task);
}
}
}
}
} else if (element instanceof TaskCategory) {
TasksUiInternal.openEditor((TaskCategory) element);
} else if (element instanceof IRepositoryQuery) {
RepositoryQuery query = (RepositoryQuery) element;
AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(query.getConnectorKind());
TasksUiInternal.openEditQueryDialog(connectorUi, query);
}
}
public static TaskJob updateRepositoryConfiguration(final TaskRepository taskRepository) {
synchronized (taskRepository) {
taskRepository.setUpdating(true);
}
AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
taskRepository.getConnectorKind());
final TaskJob job = TasksUiInternal.getJobFactory().createUpdateRepositoryConfigurationJob(connector,
taskRepository);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
synchronized (taskRepository) {
taskRepository.setUpdating(false);
}
if (job.getStatus() != null) {
Display display = PlatformUI.getWorkbench().getDisplay();
if (!display.isDisposed()) {
TasksUiInternal.displayStatus("Configuration Refresh Failed", job.getStatus());
}
}
}
});
job.schedule();
return job;
}
private static void joinIfInTestMode(SynchronizationJob job) {
// FIXME the client code should join the job
if (CoreUtil.TEST_MODE) {
try {
job.join();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
public static final Job synchronizeQueries(AbstractRepositoryConnector connector, TaskRepository repository,
Set<RepositoryQuery> queries, IJobChangeListener listener, boolean force) {
Assert.isTrue(queries.size() > 0);
TaskList taskList = TasksUiPlugin.getTaskList();
for (RepositoryQuery query : queries) {
query.setSynchronizing(true);
}
taskList.notifySynchronizationStateChanged(queries);
SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeQueriesJob(connector, repository,
queries);
job.setUser(force);
if (listener != null) {
job.addJobChangeListener(listener);
}
if (force) {
final RepositoryQuery query = queries.iterator().next();
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (query.getStatus() != null) {
TasksUiInternal.asyncDisplayStatus("Query Synchronization Failed", query.getStatus());
}
}
});
}
job.schedule();
joinIfInTestMode(job);
return job;
}
/**
* For synchronizing a single query. Use synchronize(Set, IJobChangeListener) if synchronizing multiple queries at a
* time.
*/
public static final Job synchronizeQuery(AbstractRepositoryConnector connector, RepositoryQuery repositoryQuery,
IJobChangeListener listener, boolean force) {
TaskRepository repository = TasksUi.getRepositoryManager().getRepository(repositoryQuery.getConnectorKind(),
repositoryQuery.getRepositoryUrl());
return synchronizeQueries(connector, repository, Collections.singleton(repositoryQuery), listener, force);
}
public static SynchronizationJob synchronizeAllRepositories(boolean force) {
Set<TaskRepository> repositories = new HashSet<TaskRepository>(TasksUi.getRepositoryManager()
.getAllRepositories());
SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeRepositoriesJob(repositories);
job.setUser(force);
job.schedule();
joinIfInTestMode(job);
return job;
}
public static SynchronizationJob synchronizeRepository(TaskRepository repository, boolean force) {
return TasksUiPlugin.getSynchronizationScheduler().synchronize(repository);
}
/**
* Synchronize a single task. Note that if you have a collection of tasks to synchronize with this connector then
* you should call synchronize(Set<Set<AbstractTask> repositoryTasks, ...)
*
* @param listener
* can be null
*/
public static Job synchronizeTask(AbstractRepositoryConnector connector, ITask task, boolean force,
IJobChangeListener listener) {
return synchronizeTasks(connector, Collections.singleton(task), force, listener);
}
/**
* @param listener
* can be null
*/
public static Job synchronizeTasks(AbstractRepositoryConnector connector, Set<ITask> tasks, boolean force,
IJobChangeListener listener) {
ITaskList taskList = TasksUiInternal.getTaskList();
for (ITask task : tasks) {
((AbstractTask) task).setSynchronizing(true);
}
((TaskList) taskList).notifySynchronizationStateChanged(tasks);
// TODO notify task list?
SynchronizationJob job = TasksUiPlugin.getTaskJobFactory().createSynchronizeTasksJob(connector, tasks);
job.setUser(force);
job.setPriority(Job.DECORATE);
if (listener != null) {
job.addJobChangeListener(listener);
}
if (force && tasks.size() == 1) {
final ITask task = tasks.iterator().next();
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (task instanceof AbstractTask && ((AbstractTask) task).getStatus() != null) {
TasksUiInternal.asyncDisplayStatus("Task Synchronization Failed",
((AbstractTask) task).getStatus());
}
}
});
}
job.schedule();
joinIfInTestMode(job);
return job;
}
public static ITaskJobFactory getJobFactory() {
return TasksUiPlugin.getTaskJobFactory();
}
public static NewAttachmentWizardDialog openNewAttachmentWizard(Shell shell, TaskRepository taskRepository,
ITask task, TaskAttribute taskAttribute, TaskAttachmentWizard.Mode mode, AbstractTaskAttachmentSource source) {
TaskAttachmentWizard attachmentWizard = new TaskAttachmentWizard(taskRepository, task, taskAttribute);
attachmentWizard.setSource(source);
attachmentWizard.setMode(mode);
NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(shell, attachmentWizard, false);
dialog.setBlockOnOpen(false);
dialog.create();
dialog.open();
return dialog;
}
private static MessageDialog createDialog(Shell shell, String title, String message, int type) {
return new MessageDialog(shell, title, null, message, type, new String[] { IDialogConstants.OK_LABEL }, 0);
}
public static void displayStatus(Shell shell, final String title, final IStatus status) {
if (status.getCode() == RepositoryStatus.ERROR_INTERNAL) {
StatusHandler.fail(status);
} else {
if (status instanceof RepositoryStatus && ((RepositoryStatus) status).isHtmlMessage()) {
WebBrowserDialog.openAcceptAgreement(shell, title, status.getMessage(),
((RepositoryStatus) status).getHtmlMessage());
} else {
switch (status.getSeverity()) {
case IStatus.CANCEL:
case IStatus.INFO:
createDialog(shell, title, status.getMessage(), MessageDialog.INFORMATION).open();
break;
case IStatus.WARNING:
createDialog(shell, title, status.getMessage(), MessageDialog.WARNING).open();
break;
case IStatus.ERROR:
default:
createDialog(shell, title, status.getMessage(), MessageDialog.ERROR).open();
break;
}
}
}
}
public static void asyncDisplayStatus(final String title, final IStatus status) {
Display display = PlatformUI.getWorkbench().getDisplay();
if (!display.isDisposed()) {
display.asyncExec(new Runnable() {
public void run() {
displayStatus(title, status);
}
});
} else {
StatusHandler.log(status);
}
}
public static void displayStatus(final String title, final IStatus status) {
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench != null && !workbench.getDisplay().isDisposed()) {
displayStatus(getShell(), title, status);
} else {
StatusHandler.log(status);
}
}
/**
* Creates a new local task and schedules for today
*
* @param summary
* if null DEFAULT_SUMMARY (New Task) used.
*/
public static LocalTask createNewLocalTask(String summary) {
if (summary == null) {
summary = LocalRepositoryConnector.DEFAULT_SUMMARY;
}
TaskList taskList = TasksUiPlugin.getTaskList();
LocalTask newTask = new LocalTask("" + taskList.getNextLocalTaskId(), summary);
newTask.setPriority(PriorityLevel.P3.toString());
TasksUiInternal.getTaskList().addTask(newTask);
TasksUiPlugin.getTaskActivityManager().scheduleNewTask(newTask);
Object selectedObject = null;
TaskListView view = TaskListView.getFromActivePerspective();
if (view != null) {
selectedObject = ((IStructuredSelection) view.getViewer().getSelection()).getFirstElement();
}
if (selectedObject instanceof TaskCategory) {
taskList.addTask(newTask, (TaskCategory) selectedObject);
} else if (selectedObject instanceof ITask) {
ITask task = (ITask) selectedObject;
AbstractTaskContainer container = TaskCategory.getParentTaskCategory(task);
if (container instanceof TaskCategory) {
taskList.addTask(newTask, container);
} else if (view != null && view.getDrilledIntoCategory() instanceof TaskCategory) {
taskList.addTask(newTask, view.getDrilledIntoCategory());
} else {
taskList.addTask(newTask, TasksUiPlugin.getTaskList().getDefaultCategory());
}
} else if (view != null && view.getDrilledIntoCategory() instanceof TaskCategory) {
taskList.addTask(newTask, view.getDrilledIntoCategory());
} else {
if (view != null && view.getDrilledIntoCategory() != null) {
MessageDialog.openInformation(Display.getCurrent().getActiveShell(), LABEL_CREATE_TASK,
"The new task will be added to the " + UncategorizedTaskContainer.LABEL
+ " container, since tasks can not be added to a query.");
}
taskList.addTask(newTask, TasksUiPlugin.getTaskList().getDefaultCategory());
}
return newTask;
}
public static Set<AbstractTaskContainer> getContainersFromWorkingSet(Set<IWorkingSet> containers) {
Set<AbstractTaskContainer> allTaskContainersInWorkingSets = new HashSet<AbstractTaskContainer>();
for (IWorkingSet workingSet : containers) {
IAdaptable[] elements = workingSet.getElements();
for (IAdaptable adaptable : elements) {
if (adaptable instanceof AbstractTaskContainer) {
allTaskContainersInWorkingSets.add(((AbstractTaskContainer) adaptable));
}
}
}
return allTaskContainersInWorkingSets;
}
/**
* @since 3.0
*/
public static void openEditQueryDialog(AbstractRepositoryConnectorUi connectorUi, IRepositoryQuery query) {
try {
TaskRepository repository = TasksUi.getRepositoryManager().getRepository(query.getConnectorKind(),
query.getRepositoryUrl());
if (repository == null) {
return;
}
IWizard wizard = connectorUi.getQueryWizard(repository, query);
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.setTitle("Edit Repository Query");
dialog.setBlockOnOpen(true);
if (dialog.open() == Window.CANCEL) {
dialog.close();
return;
}
}
} catch (Exception e) {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to open query dialog", e));
}
}
public static ITaskList getTaskList() {
return TasksUiPlugin.getTaskList();
}
public static boolean isAnimationsEnabled() {
IPreferenceStore store = PlatformUI.getPreferenceStore();
return store.getBoolean(IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS);
}
public static boolean hasValidUrl(ITask task) {
return isValidUrl(task.getUrl());
}
public static boolean isValidUrl(String url) {
if (url != null && !url.equals("") && !url.equals("http://") && !url.equals("https://")) {
try {
new URL(url);
return true;
} catch (MalformedURLException e) {
return false;
}
}
return false;
}
/**
* @since 3.0
*/
public static void closeEditorInActivePage(ITask task, boolean save) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
task.getRepositoryUrl());
IEditorInput input = new TaskEditorInput(taskRepository, task);
IEditorPart editor = page.findEditor(input);
if (editor != null) {
page.closeEditor(editor, save);
}
}
public static void importTasks(Collection<AbstractTask> tasks, Set<TaskRepository> repositories, File zipFile,
Shell shell) {
TasksUiPlugin.getRepositoryManager().insertRepositories(repositories,
TasksUiPlugin.getDefault().getRepositoriesFilePath());
for (AbstractTask loadedTask : tasks) {
// need to deactivate since activation is managed centrally
loadedTask.setActive(false);
TaskList taskList = TasksUiPlugin.getTaskList();
try {
if (taskList.getTask(loadedTask.getHandleIdentifier()) != null) {
boolean confirmed = MessageDialog.openConfirm(shell, "Import Task", "Task '"
+ loadedTask.getSummary()
+ "' already exists. Do you want to override it's context with the source?");
if (confirmed) {
ContextCore.getContextStore().importContext(loadedTask.getHandleIdentifier(), zipFile);
}
} else {
ContextCore.getContextStore().importContext(loadedTask.getHandleIdentifier(), zipFile);
getTaskList().addTask(loadedTask);
}
} catch (CoreException e) {
StatusHandler.log(new Status(IStatus.INFO, TasksUiPlugin.ID_PLUGIN,
"Task context not found for import", e));
}
}
}
public static boolean hasLocalCompletionState(ITask task) {
TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
task.getRepositoryUrl());
AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
task.getConnectorKind());
return connector.hasLocalCompletionState(taskRepository, task);
}
/**
* Return the modal shell that is currently open. If there isn't one then return null.
* <p>
* <b>Note: Applied from patch on bug 99472.</b>
*
* @param shell
* A shell to exclude from the search. May be <code>null</code>.
*
* @return Shell or <code>null</code>.
*/
private static Shell getModalShellExcluding(Shell shell) {
IWorkbench workbench = PlatformUI.getWorkbench();
Shell[] shells = workbench.getDisplay().getShells();
int modal = SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL;
for (Shell shell2 : shells) {
if (shell2.equals(shell)) {
break;
}
// Do not worry about shells that will not block the user.
if (shell2.isVisible()) {
int style = shell2.getStyle();
if ((style & modal) != 0) {
return shell2;
}
}
}
return null;
}
/**
* Utility method to get the best parenting possible for a dialog. If there is a modal shell create it so as to
* avoid two modal dialogs. If not then return the shell of the active workbench window. If neither can be found
* return null.
* <p>
* <b>Note: Applied from patch on bug 99472.</b>
*
* @return Shell or <code>null</code>
*/
public static Shell getShell() {
if (!PlatformUI.isWorkbenchRunning() || PlatformUI.getWorkbench().isClosing()) {
return null;
}
Shell modal = getModalShellExcluding(null);
if (modal != null) {
return modal;
}
return getNonModalShell();
}
/**
* Get the active non modal shell. If there isn't one return null.
* <p>
* <b>Note: Applied from patch on bug 99472.</b>
*
* @return Shell
*/
private static Shell getNonModalShell() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
if (windows.length > 0) {
return windows[0].getShell();
}
} else {
return window.getShell();
}
return null;
}
public static TaskData createTaskData(TaskRepository taskRepository, ITaskMapping initializationData,
ITaskMapping selectionData, IProgressMonitor monitor) throws CoreException {
AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
taskRepository.getConnectorKind());
AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(taskRepository);
TaskData taskData = new TaskData(mapper, taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl(),
"");
taskDataHandler.initializeTaskData(taskRepository, taskData, initializationData, monitor);
if (selectionData != null) {
connector.getTaskMapping(taskData).merge(selectionData);
}
return taskData;
}
public static void createAndOpenNewTask(TaskData taskData) throws CoreException {
ITask task = TasksUiUtil.createOutgoingNewTask(taskData.getConnectorKind(), taskData.getRepositoryUrl());
AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
taskData.getConnectorKind());
ITaskMapping mapping = connector.getTaskMapping(taskData);
String summary = mapping.getSummary();
if (summary != null && summary.length() > 0) {
task.setSummary(summary);
}
UnsubmittedTaskContainer unsubmitted = ((TaskList) getTaskList()).getUnsubmittedContainer(taskData.getRepositoryUrl());
if (unsubmitted != null) {
TasksUiInternal.getTaskList().addTask(task, unsubmitted);
}
ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(task, taskData);
workingCopy.save(null, null);
TaskRepository localTaskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
task.getRepositoryUrl());
TaskEditorInput editorInput = new TaskEditorInput(localTaskRepository, task);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
TasksUiUtil.openEditor(editorInput, TaskEditor.ID_EDITOR, page);
}
/**
* Only override if task should be opened by a custom editor, default behavior is to open with a rich editor,
* falling back to the web browser if not available.
*
* @return true if the task was successfully opened
*/
public static boolean openRepositoryTask(String connectorKind, String repositoryUrl, String id) {
IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(connectorKind);
String taskUrl = connector.getTaskUrl(repositoryUrl, id);
if (taskUrl == null) {
return false;
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
if (windows != null && windows.length > 0) {
window = windows[0];
}
}
if (window == null) {
return false;
}
IWorkbenchPage page = window.getActivePage();
OpenRepositoryTaskJob job = new OpenRepositoryTaskJob(connectorKind, repositoryUrl, id, taskUrl, page);
job.schedule();
return true;
}
/**
* @since 3.0
*/
public static boolean openTaskInBackground(ITask task, boolean bringToTop) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IEditorPart activeEditor = null;
IWorkbenchPart activePart = null;
IWorkbenchPage activePage = window.getActivePage();
if (activePage != null) {
activeEditor = activePage.getActiveEditor();
activePart = activePage.getActivePart();
}
boolean opened = TasksUiUtil.openTask(task);
if (opened && activePage != null) {
if (!bringToTop && activeEditor != null) {
activePage.bringToTop(activeEditor);
}
if (activePart != null) {
activePage.activate(activePart);
}
}
return opened;
} else {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unable to open editor for \""
+ task.getSummary() + "\": no active workbench window"));
}
return false;
}
/**
* Returns text masking the &-character from decoration as an accelerator in SWT labels.
*/
public static String escapeLabelText(String text) {
return (text != null) ? text.replace("&", "&&") : null; // mask & from SWT
}
public static void preservingSelection(final TreeViewer viewer, Runnable runnable) {
final ISelection selection = viewer.getSelection();
runnable.run();
if (selection != null) {
ISelection newSelection = viewer.getSelection();
if ((newSelection == null || newSelection.isEmpty()) && !(selection == null || selection.isEmpty())) {
// delay execution to ensure that any delayed tree updates such as expand all have been processed and the selection is revealed properly
Display.getDefault().asyncExec(new Runnable() {
public void run() {
viewer.setSelection(selection, true);
}
});
} else if (newSelection instanceof ITreeSelection && !newSelection.isEmpty()) {
viewer.reveal(((ITreeSelection) newSelection).getFirstElement());
}
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
65ac03929542885705be8ace2e29d6c3397693af | b2b337f1c7dde153e71dfeea3a87ecc9dcc534c5 | /src/Boundary/BoundaryPaciente.java | 695c212a25d12ac936d0ada07344e02d13a8c108 | [] | no_license | vihugoos/doctor-s-office-system | 9d630e74faf7faaef2b45aacbcc1c222a3693d15 | f1091009b192827b534e4adc09ea3541bdf9c6a0 | refs/heads/master | 2020-12-21T23:45:31.240078 | 2020-02-23T02:34:19 | 2020-02-23T02:34:19 | 222,522,634 | 0 | 0 | null | 2020-01-27T19:34:49 | 2019-11-18T19:02:26 | Java | ISO-8859-1 | Java | false | false | 8,782 | java | package Boundary;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
import Controler.PacienteControl;
import Entidade.Paciente;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.DatePicker;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.TilePane;
public class BoundaryPaciente implements BoundaryConteudo {
private Label lblIdPaciente = new Label("Id");
private TextField txtIdPaciente = new TextField();
private Label lblNomePaciente = new Label("Nome");
private TextField txtNomePaciente = new TextField();
private Label lblSexoPaciente = new Label("Sexo");
private RadioButton rbSexoFeminino = new RadioButton("Feminino");
private RadioButton rbSexoMasculino = new RadioButton("Masculino");
private Label lblRgPaciente = new Label("RG");
private TextField txtRgPaciente = new TextField();
private Label lblCpfPaciente = new Label("CPF");
private TextField txtCpfPaciente = new TextField();
private Label lblDataNascPaciente = new Label("Data Nasc.");
private DatePicker dpDataNascPaciente = new DatePicker();
private Label lblEnderecoPaciente = new Label("Endereço");
private TextField txtEnderecoPaciente = new TextField();
private Label lblTelefonePaciente = new Label("Telefone");
private TextField txtTelefonePaciente = new TextField();
private Button btnAdicionar = new Button("Adicionar");
private Button btnPesquisar = new Button("Pesquisar");
private Button btnNovo = new Button("Novo");
private Button btnCancelar = new Button("Cancelar");
private ToggleGroup tgsexo = new ToggleGroup();
private RadioButton sexoSelecionado;
private TableView <Paciente> tabela = new TableView<>();
private PacienteControl pacienteControl = new PacienteControl();
@Override
public Pane gerarBoundary() {
BorderPane painelPrincipal = new BorderPane();
GridPane painelCampos = new GridPane();
TilePane painelBotao = new TilePane();
rbSexoFeminino.setToggleGroup(tgsexo);
rbSexoMasculino.setToggleGroup(tgsexo);
painelPrincipal.setTop(painelCampos);
painelPrincipal.setCenter(painelBotao);
painelCampos.add(lblIdPaciente, 0, 0);
painelCampos.add(txtIdPaciente, 1, 0);
txtIdPaciente.setDisable(true);
painelCampos.add(lblNomePaciente, 0, 1);
painelCampos.add(txtNomePaciente, 1, 1);
painelCampos.add(lblSexoPaciente, 0, 2);
painelCampos.add(rbSexoMasculino, 1, 2);
painelCampos.add(rbSexoFeminino, 2, 2);
painelCampos.add(lblRgPaciente, 0, 3);
painelCampos.add(txtRgPaciente, 1, 3);
painelCampos.add(lblCpfPaciente, 0, 4);
painelCampos.add(txtCpfPaciente, 1, 4);
painelCampos.add(lblDataNascPaciente, 0, 5);
painelCampos.add(dpDataNascPaciente, 1, 5);
painelCampos.add(lblEnderecoPaciente, 0, 6);
painelCampos.add(txtEnderecoPaciente, 1, 6);
painelCampos.add(lblTelefonePaciente, 0, 7);
painelCampos.add(txtTelefonePaciente, 1, 7);
btnNovo.setPrefWidth(80);
btnAdicionar.setPrefWidth(80);
btnPesquisar.setPrefWidth(80);
btnCancelar.setPrefWidth(80);
painelBotao.getChildren().addAll(btnNovo,btnAdicionar,btnPesquisar,btnCancelar);
TableColumn<Paciente, Long> colIdPacinte = new TableColumn<>("Id");
colIdPacinte.setCellValueFactory(new PropertyValueFactory<Paciente, Long>("idPaciente"));
TableColumn<Paciente,String> colNomePaciente = new TableColumn<>("Nome");
colNomePaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("nomePaciente"));
TableColumn<Paciente, String> colRgPaciente = new TableColumn<>("RG");
colRgPaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("rgPaciente"));
TableColumn<Paciente, String> colCpfPaciente = new TableColumn<>("CPF");
colCpfPaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("cpfPaciente"));
TableColumn<Paciente, String> colSexoPaciente = new TableColumn<>("Sexo");
colSexoPaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("sexoPaciente"));
TableColumn<Paciente, Date> colDataNasc = new TableColumn<>("Data Nasc.");
colDataNasc.setCellValueFactory(new PropertyValueFactory<Paciente,Date>("dataNascPaciente"));
TableColumn<Paciente, String> colTelefonePaciente = new TableColumn<>("Telefone");
colTelefonePaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("telefonePaciente"));
TableColumn<Paciente, String> colEnderecoPaciente = new TableColumn<>("Endereço");
colEnderecoPaciente.setCellValueFactory(new PropertyValueFactory<Paciente, String>("enderecoPaciente"));
tabela.getColumns().addAll(colIdPacinte,colNomePaciente,colSexoPaciente,
colRgPaciente,colCpfPaciente,colDataNasc,colTelefonePaciente,colEnderecoPaciente);
tabela.setItems(pacienteControl.getLista());
tabela.getSelectionModel().selectedItemProperty()
.addListener(new ChangeListener<Paciente>() {
@Override
public void changed(ObservableValue<? extends Paciente> observable,
Paciente oldValue,
Paciente newValue) {
doPacienteParaFormulario(newValue);
}
});
painelPrincipal.setBottom(tabela);
btnAdicionar.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
Paciente p = doFormularioParaPaciente();
pacienteControl.adicionarPaciente(p);
limparFormulario();
btnPesquisar.setDisable(false);
btnNovo.setDisable(false);
Alert a = new Alert(AlertType.INFORMATION);
a.setTitle("Confirmação");
a.setHeaderText("Paciente Adicionado com Sucesso!!");
a.showAndWait();
}
});
btnPesquisar.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
List<Paciente> lista =
pacienteControl.pesquisaPorNome(txtNomePaciente.getText());
System.out.println("Tamanho da Lista " + lista.size());
if (lista.size() > 0) {
doPacienteParaFormulario(lista.get(0));
}
btnAdicionar.setDisable(true);
}
});
btnNovo.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
limparFormulario();
btnAdicionar.setDisable(false);
btnPesquisar.setDisable(true);
btnNovo.setDisable(true);
}
});
btnCancelar.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event) {
limparFormulario();
btnAdicionar.setDisable(false);
btnPesquisar.setDisable(false);
btnNovo.setDisable(false);
}
});
return painelPrincipal;
}
public Paciente doFormularioParaPaciente() {
Paciente p = new Paciente();
sexoSelecionado = (RadioButton) tgsexo.getSelectedToggle();
p.setNomePaciente(txtNomePaciente.getText());
p.setRgPaciente(txtRgPaciente.getText());
p.setCpfPaciente(txtCpfPaciente.getText());
p.setTelefonePaciente(txtTelefonePaciente.getText());
p.setEnderecoPaciente(txtEnderecoPaciente.getText());
p.setSexoPaciente(sexoSelecionado.getText());
LocalDate dt = dpDataNascPaciente.getValue();
Date data = Date.from(
dt.atStartOfDay(ZoneId.systemDefault()).toInstant());
p.setDataNascPaciente(data);
return p;
}
public void doPacienteParaFormulario(Paciente p) {
txtIdPaciente.setText(String.valueOf(p.getIdPaciente()));
txtNomePaciente.setText(p.getNomePaciente());
txtRgPaciente.setText(p.getRgPaciente());
txtCpfPaciente.setText(p.getCpfPaciente());
txtEnderecoPaciente.setText(p.getEnderecoPaciente());
txtTelefonePaciente.setText(p.getTelefonePaciente());
if(p.getSexoPaciente().equals(rbSexoFeminino.getText())) {
rbSexoFeminino.setSelected(true);
}else {
rbSexoMasculino.setSelected(true);
}
LocalDate localDate = p.getDataNascPaciente()
.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDate();
dpDataNascPaciente.setValue(localDate);
}
public void limparFormulario() {
txtIdPaciente.setText("");
txtNomePaciente.setText("");
txtRgPaciente.setText("");
txtCpfPaciente.setText("");
txtEnderecoPaciente.setText("");
txtTelefonePaciente.setText("");
rbSexoFeminino.setSelected(false);
rbSexoMasculino.setSelected(false);
dpDataNascPaciente.setValue(null);
}
}
| [
"victorhugoos@live.com"
] | victorhugoos@live.com |
2f3cc7f126ebf9f66fd2081626fc7c6a9c2cc277 | 4036ba022486615e0dff1437201e398fb0921a67 | /src/main/java/com/lsy/hbase/HBasePutGetExample.java | db7d8ef2dd15998ec3010135b3054c9e4efd3958 | [] | no_license | simonlisiyu/hbase-test | dc84c3e158bffd1cf0bdb31f5621a0d44b2d097e | 373d1e859f0386d15ef7758c9c561f36f7146686 | refs/heads/master | 2021-01-12T02:45:22.685937 | 2017-03-03T10:45:18 | 2017-03-03T10:45:18 | 78,087,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,332 | java | package com.lsy.hbase;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
import java.util.List;
/**
* Created by lisiyu on 2016/12/20.
* HBase的Put和Get的例子
*/
public class HBasePutGetExample {
void putExample() throws IOException {
// 创建put
Put put = new Put(Bytes.toBytes("rowkey"));
// 添加字段
put.add(Bytes.toBytes("cf"), Bytes.toBytes("col"), Bytes.toBytes("value"));
long putTimeStamp = 10000L;
put.add(Bytes.toBytes("cf"), Bytes.toBytes("col"), putTimeStamp, Bytes.toBytes("value"));
KeyValue keyValue = new KeyValue(Bytes.toBytes("rowkey"), Bytes.toBytes("cf"), Bytes.toBytes("col"), putTimeStamp, KeyValue.Type.Put, Bytes.toBytes("value"));
put.add(keyValue);
// 获取键值对
List<Cell> cellList = put.get(Bytes.toBytes("cf"), Bytes.toBytes("col"));
// 判断是否存在
boolean isExist = put.has(Bytes.toBytes("cf"), Bytes.toBytes("col"));
isExist = put.has(Bytes.toBytes("cf"), Bytes.toBytes("col"), Bytes.toBytes("value"));
isExist = put.has(Bytes.toBytes("cf"), Bytes.toBytes("col"), putTimeStamp, Bytes.toBytes("value"));
}
}
| [
"lisiyu3@jd.com"
] | lisiyu3@jd.com |
b4f6741d7b941a5044a5bc39ae8c8f85c6b2c02f | 866d5e0ac194dd71b5e37102ec629eebed230354 | /server/codestudy/src/com/test/codestudy/chat/Ex03.java | e12318cfdd9373cef6d7220834245b14c4c4644f | [] | no_license | kimdeagle/class-source | 108c34d7ffa4a9acbd553173a71423ffb48e9e9b | 3dd862cd6404cc68ba168bb5dea03673e3d447f2 | refs/heads/master | 2023-06-02T01:15:06.956818 | 2021-06-19T02:36:28 | 2021-06-19T02:36:28 | 378,295,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.test.codestudy.chat;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/chat/ex03.do")
public class Ex03 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
RequestDispatcher dispatcher = req.getRequestDispatcher("/WEB-INF/views/chat/ex03.jsp");
dispatcher.forward(req, resp);
}
}
| [
"juhyeok.dev@gmail.com"
] | juhyeok.dev@gmail.com |
9080008b518d895b9d000c4cbf6553cf925bc1cb | b3c353915444476069acad2120e7952668ebd554 | /src/sun/jvm/hotspot/oops/TBObjectHistogramElement.java | 96e8cf89a42d66eb3e34e421a6fda6e3186c9e68 | [] | no_license | trofoto/TBJMap | 187d784c7462a78c256e30f3584de0a2f9ea456f | 7f04dc6efa57e1d0c0d2c43a402455c797b9d858 | refs/heads/master | 2021-01-11T19:58:57.869729 | 2017-01-20T08:52:35 | 2017-01-20T08:52:35 | 79,437,690 | 0 | 0 | null | 2017-01-19T09:33:08 | 2017-01-19T09:33:07 | null | UTF-8 | Java | false | false | 8,621 | java | package sun.jvm.hotspot.oops;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSOldGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSPermGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSYoungGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.ParallelScavengeHeap;
import sun.jvm.hotspot.gc_interface.CollectedHeap;
import sun.jvm.hotspot.memory.DefNewGeneration;
import sun.jvm.hotspot.memory.GenCollectedHeap;
import sun.jvm.hotspot.memory.Generation;
import sun.jvm.hotspot.runtime.VM;
public class TBObjectHistogramElement {
private Klass klass;
private long count; // Number of instances of klass
private long size; // Total size of all these instances
private long edenCount; // Number of instances of klass in eden
private long edenSize; // Total size of all instances in eden
private long survivorCount; // ditto in survivor
private long survivorSize; // ditto in survivor
private long oldCount; // ditto in old generation
private long oldSize; // ditto in old generation
private long permCount; // ditto in permanent generation
private long permSize; // ditto in permanent generation
private final static int Unknown = 0;
private final static int InEden = 1;
private final static int InSurvivor = 2;
private final static int InOld = 3;
private final static int InPerm = 4;
public TBObjectHistogramElement(Klass k) {
klass = k;
}
public void updateWith(Oop obj) {
long objSize = obj.getObjectSize();
count += 1;
size += objSize;
int result = getLocation(obj);
switch (result) {
case Unknown:
break;
case InEden:
edenCount += 1;
edenSize += objSize;
break;
case InSurvivor:
survivorCount += 1;
survivorSize += objSize;
break;
case InOld:
oldCount += 1;
oldSize += objSize;
break;
case InPerm:
permCount += 1;
permSize += objSize;
break;
default:
break;
}
}
public int compare(TBObjectHistogramElement other) {
return (int) (other.size - size);
}
/**
* Klass for this ObjectHistogramElement
*/
public Klass getKlass() {
return klass;
}
/**
* Number of instances of klass
*/
public long getCount() {
return count;
}
/**
* Total size of all these instances
*/
public long getSize() {
return size;
}
/**
* Number of old instances of klass
*/
public long getOldCount() {
return oldCount;
}
/**
* Total size of all old instances
*/
public long getOldSize() {
return oldSize;
}
/**
* Number of perm instances of klass
*/
public long getPermCount() {
return permCount;
}
/**
* Total size of all perm instances
*/
public long getPermSize() {
return permSize;
}
private String getInternalName(Klass k) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
getKlass().printValueOn(new PrintStream(bos));
// '*' is used to denote VM internal klasses.
return "* " + bos.toString();
}
/**
* Human readable description *
*/
public String getDescription() {
Klass k = getKlass();
if (k instanceof InstanceKlass) {
return k.getName().asString().replace('/', '.');
} else if (k instanceof ArrayKlass) {
ArrayKlass ak = (ArrayKlass) k;
if (k instanceof TypeArrayKlass) {
TypeArrayKlass tak = (TypeArrayKlass) ak;
return tak.getElementTypeName() + "[]";
} else if (k instanceof ObjArrayKlass) {
ObjArrayKlass oak = (ObjArrayKlass) ak;
// See whether it's a "system objArray"
if (oak.equals(VM.getVM().getUniverse().systemObjArrayKlassObj())) {
return "* System ObjArray";
}
Klass bottom = oak.getBottomKlass();
int dim = (int) oak.getDimension();
StringBuffer buf = new StringBuffer();
if (bottom instanceof TypeArrayKlass) {
buf.append(((TypeArrayKlass) bottom).getElementTypeName());
} else if (bottom instanceof InstanceKlass) {
buf.append(bottom.getName().asString().replace('/', '.'));
} else {
throw new RuntimeException("should not reach here");
}
for (int i = 0; i < dim; i++) {
buf.append("[]");
}
return buf.toString();
}
}
return getInternalName(k);
}
public static void titleOn(PrintStream tty) {
tty.println("Object Histogram:");
tty.println();
tty.println("#num" + "\t" + "#all instances/bytes" + "\t"
+ "#eden instances/bytes" + "\t" + "#survivor instances/bytes" + "\t" + "#old instances/bytes"
+ "\t" + "#perm instances/bytes" + "\t" + "#Class description");
tty.println("-----------------------------------------------------------------------------------");
}
public static void titleOnOld(PrintStream tty) {
tty.println("Old Object Histogram:");
tty.println();
tty.println("#num" + "\t" + "#all instances/bytes" + "\t"
+ "#old instances/bytes" + "\t" + "#Class description");
tty.println("-----------------------------------------------------------------------------------");
}
public static void titleOnPerm(PrintStream tty) {
tty.println("Perm Object Histogram:");
tty.println();
tty.println("#num" + "\t" + "#all instances/bytes" + "\t"
+ "#Perm instances/bytes" + "\t" + "#Class description");
tty.println("-----------------------------------------------------------------------------------");
}
public void printOn(PrintStream tty) {
tty.print(count + "/" + size + "\t");
tty.print(edenCount + "/" + edenSize + "\t" + survivorCount + "/" + survivorSize + "\t" + oldCount + "/"
+ oldSize + "\t" + permCount + "/" + permSize + "\t");
tty.print(getDescription());
tty.println();
}
public void printOnOld(PrintStream tty) {
tty.print(count + "/" + size + "\t");
tty.print(oldCount + "/" + oldSize + "\t");
tty.print(getDescription());
tty.println();
}
public void printOnPerm(PrintStream tty) {
tty.print(count + "/" + size + "\t");
tty.print(permCount + "/" + permSize + "\t");
tty.print(getDescription());
tty.println();
}
private static int getLocation(Oop obj) {
if (obj == null)
return Unknown;
CollectedHeap heap = VM.getVM().getUniverse().heap();
if (heap instanceof GenCollectedHeap) {
DefNewGeneration gen0 = (DefNewGeneration) ((GenCollectedHeap) heap).getGen(0);
if (gen0.eden().contains(obj.getHandle())) {
return InEden;
} else if (gen0.from().contains(obj.getHandle())) {
return InSurvivor;
}
Generation gen1 = ((GenCollectedHeap) heap).getGen(1);
if (gen1.isIn(obj.getHandle())) {
return InOld;
}
Generation permGen = ((GenCollectedHeap) heap).permGen();
if (permGen.isIn(obj.getHandle())) {
return InPerm;
}
} else if (heap instanceof ParallelScavengeHeap) {
PSYoungGen youngGen = ((ParallelScavengeHeap) heap).youngGen();
if (youngGen.edenSpace().contains(obj.getHandle())) {
return InEden;
} else if (youngGen.fromSpace().contains(obj.getHandle())) {
return InSurvivor;
}
PSOldGen oldGen = ((ParallelScavengeHeap) heap).oldGen();
if (oldGen.isIn(obj.getHandle())) {
return InOld;
}
PSPermGen permGen = ((ParallelScavengeHeap) heap).permGen();
if (permGen.isIn(obj.getHandle())) {
return InPerm;
}
}
return Unknown;
}
}
| [
"jlusdy@gmail.com"
] | jlusdy@gmail.com |
923de118b58e0c92195139edaab8f344db8f97e4 | 6cacffc9f96170cdac53680938111e484bc72626 | /battleships/src/main/java/com/psamatt/challenges/battleships/board/CellStatus.java | a9c0e25a89f85410459dc1b1ab77d2b59fe84f71 | [] | no_license | psamatt/hackerrank | c8da788a743b1c7b4b90247a24a6cde1343f95b5 | b0e0cb70c0e315d676f38a69d4b9d7c9da849f5b | refs/heads/main | 2023-03-30T16:20:06.737499 | 2021-04-07T19:59:59 | 2021-04-07T19:59:59 | 351,209,648 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package com.psamatt.challenges.battleships.board;
public enum CellStatus {
INACTIVE('-'),
HIT('h'),
MISS('m'),
SUNK('s');
private final char c;
CellStatus(char c) {
this.c = c;
}
public char getChar() {
return c;
}
}
| [
"matt.goodwin491@gmail.com"
] | matt.goodwin491@gmail.com |
a190c96e85c5c67043b7fedf8f265b47968e2fb5 | 202db0275b44448ad7a8aa1d78b23fb6873df02d | /EditeurUML/testPackage/OKButtonNewAssociationControllerTest.java | 613575ae687a607bc966a0bf0a54840f3f4ce088 | [
"MIT"
] | permissive | Projets-DUT/EditeurUML | 87cf1f8562bcefc534aba113845f027e224de07a | c1e40add86bb77710c8d7b2c6b15e005421ba5b3 | refs/heads/master | 2020-05-19T17:15:42.527054 | 2015-02-05T17:47:23 | 2015-02-05T17:47:23 | 19,026,067 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,584 | java | package testPackage;
import static org.junit.Assert.*;
import javax.swing.JButton;
import model.ProjectUML;
import model.TypeObject;
import org.junit.Before;
import org.junit.Test;
import view.NewAssociationView;
import controller.OkButtonNewAssociationController;
public class OKButtonNewAssociationControllerTest {
OkButtonNewAssociationController ok;
JButton button;
ProjectUML model;
@Before
public void before(){
model = new ProjectUML();
button = new JButton();
}
@Test
public void testAssociation() {
NewAssociationView view = new NewAssociationView(model, 0);
model.addObjectUml(TypeObject.CLASS);
model.addObjectUml(TypeObject.CLASS);
view.getClass1ComboBox().setSelectedIndex(0);
view.getClass2ComboBox().setSelectedIndex(1);
ok = new OkButtonNewAssociationController(model, view, 0);
button.addActionListener(ok);
button.doClick();
assertEquals(1, model.getAssociationList().size());
assertEquals(0, model.getAssociationList().get(0).getTypeOfAssociation());
}
@Test
public void testExtend() {
NewAssociationView view = new NewAssociationView(model, 0);
model.addObjectUml(TypeObject.CLASS);
model.addObjectUml(TypeObject.CLASS);
view.getClass1ComboBox().setSelectedIndex(0);
view.getClass2ComboBox().setSelectedIndex(1);
ok = new OkButtonNewAssociationController(model, view, 1);
button.addActionListener(ok);
button.doClick();
assertEquals(1, model.getAssociationList().size());
assertEquals(1, model.getAssociationList().get(0).getTypeOfAssociation());
}
@Test
public void testImplement() {
NewAssociationView view = new NewAssociationView(model, 0);
model.addObjectUml(TypeObject.CLASS);
model.addObjectUml(TypeObject.CLASS);
view.getClass1ComboBox().setSelectedIndex(0);
view.getClass2ComboBox().setSelectedIndex(1);
ok = new OkButtonNewAssociationController(model, view, 2);
button.addActionListener(ok);
button.doClick();
assertEquals(1, model.getAssociationList().size());
assertEquals(2, model.getAssociationList().get(0).getTypeOfAssociation());
}
@Test
public void testDependence() {
NewAssociationView view = new NewAssociationView(model, 0);
model.addObjectUml(TypeObject.CLASS);
model.addObjectUml(TypeObject.CLASS);
view.getClass1ComboBox().setSelectedIndex(0);
view.getClass2ComboBox().setSelectedIndex(1);
ok = new OkButtonNewAssociationController(model, view, 3);
button.addActionListener(ok);
button.doClick();
assertEquals(1, model.getAssociationList().size());
assertEquals(3, model.getAssociationList().get(0).getTypeOfAssociation());
}
}
| [
"aurelie.digeon@gmail.com"
] | aurelie.digeon@gmail.com |
a9add31857af2276de60b513b8f49f3a09e4834e | 5c9487f5a0f5af173baec2800c0b8c30be09933b | /ndr-api/src/main/java/com/jiuyi/ndr/dto/iplan/mobile/IPlanAppCreditDto.java | 0e30a41d522f2a93b688b12eb3e779054a3fd657 | [] | no_license | guohuan0126/newInvest | 56081f1aa400f38860e9930de40bacea24546a03 | 20996adc92e5d6ca8c75d34bafa8651a76222c04 | refs/heads/master | 2020-03-22T09:15:53.816945 | 2018-07-05T09:39:52 | 2018-07-05T09:40:02 | 139,826,083 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,761 | java | package com.jiuyi.ndr.dto.iplan.mobile;
import java.io.Serializable;
/**
* Created by lixiaolei on 2017/6/16.
*/
public class IPlanAppCreditDto implements Serializable {
private static final long serialVersionUID = 6920867082853175140L;
private String creditId;// 债权编号
private String subjectId;//标的编号
private String holdingPrincipal;//持有本金
private String protocol;//合同
private String subjectName;//标的名称
private String borrowName;//借款人姓名
private String borrowIdCard;//借款人身份证号
public String getBorrowName() {
return borrowName;
}
public void setBorrowName(String borrowName) {
this.borrowName = borrowName;
}
public String getBorrowIdCard() {
return borrowIdCard;
}
public void setBorrowIdCard(String borrowIdCard) {
this.borrowIdCard = borrowIdCard;
}
public String getSubjectName() {
return subjectName;
}
public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}
public String getCreditId() {
return creditId;
}
public void setCreditId(String creditId) {
this.creditId = creditId;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public String getHoldingPrincipal() {
return holdingPrincipal;
}
public void setHoldingPrincipal(String holdingPrincipal) {
this.holdingPrincipal = holdingPrincipal;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
}
| [
"guohuan0126@163.com"
] | guohuan0126@163.com |
27c9fbb1c31ad1a179952a91c033f26456d3782d | d602b720e255ebe750faf73ffeb6b917621bf443 | /src/main/java/com/dh/entity/Role.java | e327859635ce86323626aca66e5eb56262cac562 | [] | no_license | lujianSir/maven-shiro | c0968f8bdedab3f8d1c03e2bfeceebd9d213f79f | d7702756134bc178ea0ee2c9f1ad549c523f7a44 | refs/heads/master | 2020-05-23T20:18:40.043060 | 2019-05-16T06:04:25 | 2019-05-16T06:04:25 | 186,926,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package com.dh.entity;
public class Role {
private Integer id;
private String username;
private String role;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role == null ? null : role.trim();
}
} | [
"Administrator@PC-20181116XMTZ"
] | Administrator@PC-20181116XMTZ |
12f201bc0928ddf7b3f9efefb8892573152755d5 | 5317b9dd6cabee5e299c2f0bc1a5a3a4adf0f188 | /sample/src/main/java/com/yashoid/yashson/sample/AG.java | ca1cccd78cc31b45b5f5760871ac2696259f274d | [] | no_license | yasharpm/Yashson | cb3f9f94593a0416580149ea28816f905ab511a3 | 1cddd303b59a80287fb680559ee01881dcbc48a2 | refs/heads/master | 2022-04-24T09:03:00.115066 | 2020-04-27T13:55:21 | 2020-04-27T13:55:21 | 112,600,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 108 | java | package com.yashoid.yashson.sample;
/**
* Created by Yashar on 11/17/2017.
*/
public class AG<T> {
}
| [
"yasharpm@gmail.com"
] | yasharpm@gmail.com |
7d8997d0f51e30c7ea7bc6dec62e194f5ce4f23b | 6910de77bb6f99bf17920b148b18aa56b2315a98 | /springboot-mybatis/sbm-storage-service/src/main/java/io/seata/samples/storage/config/DataSourceConfig.java | 2855e234acbfed2a03be08773cfd41a409dc12fb | [
"Apache-2.0"
] | permissive | AzureOrange/seata-samples | baf5ebba64f41d721b4085b728d9a09472588887 | cb0c9b89be5da0351d70e3d687b542994989d47f | refs/heads/master | 2020-08-27T00:34:18.627792 | 2019-10-22T09:25:43 | 2019-10-22T09:25:43 | 217,195,471 | 1 | 0 | Apache-2.0 | 2019-10-24T02:35:53 | 2019-10-24T02:35:53 | null | UTF-8 | Java | false | false | 1,592 | java | package io.seata.samples.storage.config;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
@Configuration
public class DataSourceConfig {
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource druidDataSource() {
DruidDataSource druidDataSource = new DruidDataSource();
return druidDataSource;
}
@Primary
@Bean("dataSource")
public DataSourceProxy dataSource(DataSource druidDataSource) {
return new DataSourceProxy(druidDataSource);
}
@Bean
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
factoryBean.setDataSource(dataSourceProxy);
factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources("classpath*:/mapper/*.xml"));
factoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
return factoryBean.getObject();
}
}
| [
"slievrly@gmail.com"
] | slievrly@gmail.com |
b75b9250789385814d46e9e759c8bcf776ed4d78 | 0c1e4974bb409be9e02638f065162390ebb24d49 | /app/src/main/java/com/example/bakingapp/data/network/RetrofitClientInstance.java | d761a38fa0213649e66ed2ed572827a5d7e518b4 | [] | no_license | polarizat/ud_baking_app | afc49e3ceebee44aa846e7f8f05683f82b241f93 | e12dceba6621b4fe0f1085ddb349e6417a1c7fd7 | refs/heads/master | 2022-10-05T17:37:20.974227 | 2020-06-05T07:07:24 | 2020-06-05T07:07:24 | 269,530,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package com.example.bakingapp.data.network;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClientInstance {
private static Retrofit retrofit;
private static final String BASE_URL = "https://d17h27t6h515a5.cloudfront.net";
public static Retrofit getRetrofitInstance() {
if (retrofit == null) {
retrofit = new retrofit2.Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
}
| [
"sergiu.apostul@gmail.com"
] | sergiu.apostul@gmail.com |
4f5554b6e26f249aefc86f463726e9d22d50d77f | f693f1b3eff89922ffa4b8e729a4cfb4de6dc10f | /sandbox-providers/tmrk-enterprisecloud/src/main/java/org/jclouds/tmrk/enterprisecloud/domain/network/NetworkAdapterSetting.java | 96e307b051de293401013a287843e9abaaf5e05b | [
"Apache-2.0"
] | permissive | alasdairhodge/jclouds | affb87ab3fa94c348750f26c17d7b0e7bdf94111 | b7ab393b10fd4498402c911e62f40fc780c77bd8 | refs/heads/master | 2021-01-17T08:17:15.587663 | 2011-12-20T17:33:30 | 2011-12-20T17:33:30 | 2,488,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,516 | java | /**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.tmrk.enterprisecloud.domain.network;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.tmrk.enterprisecloud.domain.NamedResource;
import javax.xml.bind.annotation.XmlElement;
/**
* <xs:complexType name="NetworkAdapterSettingType">
* @author Jason King
*/
public class NetworkAdapterSetting {
@SuppressWarnings("unchecked")
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromNetworkAdapterSetting(this);
}
public static class Builder {
private NamedResource network;
private String ipAddress;
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getNetwork
*/
public Builder network(NamedResource network) {
this.network = network;
return this;
}
/**
* @see org.jclouds.tmrk.enterprisecloud.domain.network.NetworkAdapterSetting#getIpAddress
*/
public Builder ipAddress(String ipAddress) {
this.ipAddress = ipAddress;
return this;
}
public NetworkAdapterSetting build() {
return new NetworkAdapterSetting(ipAddress, network);
}
public Builder fromNetworkAdapterSetting(NetworkAdapterSetting in) {
return ipAddress(in.getIpAddress()).network(in.getNetwork());
}
}
@XmlElement(name = "Network", required = false)
private NamedResource network;
@XmlElement(name = "IpAddress", required = false)
private String ipAddress;
public NetworkAdapterSetting(@Nullable String ipAddress, @Nullable NamedResource network) {
this.ipAddress = ipAddress;
this.network = network;
}
protected NetworkAdapterSetting() {
//For JAXB
}
@Nullable
public String getIpAddress() {
return ipAddress;
}
@Nullable
public NamedResource getNetwork() {
return network;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NetworkAdapterSetting that = (NetworkAdapterSetting) o;
if (ipAddress != null ? !ipAddress.equals(that.ipAddress) : that.ipAddress != null)
return false;
if (network != null ? !network.equals(that.network) : that.network != null)
return false;
return true;
}
@Override
public int hashCode() {
int result = network != null ? network.hashCode() : 0;
result = 31 * result + (ipAddress != null ? ipAddress.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "[ipAddress="+ ipAddress +",network="+ network +"]";
}
} | [
"jason.king@cloudsoftcorp.com"
] | jason.king@cloudsoftcorp.com |
2d04c39319b34ab07532dad433d3419b495fdc2e | f9c8fe9f50878c3bbf1adcfa7009955bfb831399 | /src/main/java/com/mudule/mumzonemarketcal/component/po/base/BaseProductFunctionExample.java | 6d1b354892716c6a36d6d8e4674daa25d4dd7ff2 | [] | no_license | 15131009532qq/market_cal | 303a490ddaa99063eb6d7e17cb35cc6759279783 | c2d5f39223089eb3ab0e7d77689e0fd194d2b80f | refs/heads/master | 2022-07-12T19:56:33.759865 | 2020-04-26T03:04:28 | 2020-04-26T03:04:28 | 257,486,997 | 1 | 1 | null | 2023-09-12T13:55:56 | 2020-04-21T05:13:13 | Java | UTF-8 | Java | false | false | 16,170 | java | package com.mudule.mumzonemarketcal.component.po.base;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class BaseProductFunctionExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public BaseProductFunctionExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andProductIdIsNull() {
addCriterion("product_id is null");
return (Criteria) this;
}
public Criteria andProductIdIsNotNull() {
addCriterion("product_id is not null");
return (Criteria) this;
}
public Criteria andProductIdEqualTo(String value) {
addCriterion("product_id =", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotEqualTo(String value) {
addCriterion("product_id <>", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdGreaterThan(String value) {
addCriterion("product_id >", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdGreaterThanOrEqualTo(String value) {
addCriterion("product_id >=", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdLessThan(String value) {
addCriterion("product_id <", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdLessThanOrEqualTo(String value) {
addCriterion("product_id <=", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdLike(String value) {
addCriterion("product_id like", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotLike(String value) {
addCriterion("product_id not like", value, "productId");
return (Criteria) this;
}
public Criteria andProductIdIn(List<String> values) {
addCriterion("product_id in", values, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotIn(List<String> values) {
addCriterion("product_id not in", values, "productId");
return (Criteria) this;
}
public Criteria andProductIdBetween(String value1, String value2) {
addCriterion("product_id between", value1, value2, "productId");
return (Criteria) this;
}
public Criteria andProductIdNotBetween(String value1, String value2) {
addCriterion("product_id not between", value1, value2, "productId");
return (Criteria) this;
}
public Criteria andFunctionIdIsNull() {
addCriterion("function_id is null");
return (Criteria) this;
}
public Criteria andFunctionIdIsNotNull() {
addCriterion("function_id is not null");
return (Criteria) this;
}
public Criteria andFunctionIdEqualTo(String value) {
addCriterion("function_id =", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdNotEqualTo(String value) {
addCriterion("function_id <>", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdGreaterThan(String value) {
addCriterion("function_id >", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdGreaterThanOrEqualTo(String value) {
addCriterion("function_id >=", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdLessThan(String value) {
addCriterion("function_id <", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdLessThanOrEqualTo(String value) {
addCriterion("function_id <=", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdLike(String value) {
addCriterion("function_id like", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdNotLike(String value) {
addCriterion("function_id not like", value, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdIn(List<String> values) {
addCriterion("function_id in", values, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdNotIn(List<String> values) {
addCriterion("function_id not in", values, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdBetween(String value1, String value2) {
addCriterion("function_id between", value1, value2, "functionId");
return (Criteria) this;
}
public Criteria andFunctionIdNotBetween(String value1, String value2) {
addCriterion("function_id not between", value1, value2, "functionId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"douzetian@princeegg.com"
] | douzetian@princeegg.com |
5da52c5447f222e76dabd9f10a31fac32a858ab7 | 990157acfb29a1be8afca3c62ae880c31db4d658 | /main/java/zaneextras/items/ItemList.java | f0daf3b5853222ff09fea9a05037599b92ccd5b5 | [] | no_license | crazyhand89/ZaneXtras | 11385b9d3b9b088f97ba3231ed040cfd4fef518e | e9ce8d0e94e2f36aa5dfe946e1c4d324352c000a | refs/heads/master | 2021-01-20T05:14:35.341951 | 2017-06-25T04:40:09 | 2017-06-25T04:40:09 | 89,764,440 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 23,013 | java | package zaneextras.items;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import zaneextras.blocks.BlockList;
import zaneextras.items.armor.ZaneArmorMaterials;
import zaneextras.items.armor.butter.ButterArmor;
import zaneextras.items.armor.emerald.EmeraldArmor;
import zaneextras.items.armor.foolstaria.FoolStariaArmor;
import zaneextras.items.armor.radite.RaditeArmor;
import zaneextras.items.armor.skyium.SkyiumArmor;
import zaneextras.items.armor.staria.StariaArmor;
import zaneextras.items.armor.zanium.ZaniumArmor;
import zaneextras.items.armor.zogite.ZogiteArmor;
import zaneextras.items.bow.AngelBow;
import zaneextras.items.bow.EmeraldBow;
import zaneextras.items.bow.EnderBow;
import zaneextras.items.bow.LightBow;
import zaneextras.items.bow.SkeletonKingBow;
import zaneextras.items.food.ItemFoodFrenchSalad;
import zaneextras.items.food.ItemFoodGhostPepper;
import zaneextras.items.food.ItemFoodGlowingFlesh;
import zaneextras.items.food.ItemFoodItalianSalad;
import zaneextras.items.food.ItemFoodPepper;
import zaneextras.items.food.ItemFoodRanchSalad;
import zaneextras.items.food.ItemFoodSalad;
import zaneextras.items.food.ZaneItemFood;
import zaneextras.items.food.seeds.NetherSeed;
import zaneextras.items.food.seeds.Seed;
import zaneextras.items.food.seeds.SeedFood;
import zaneextras.items.tool.damnhardbutter.ItemToolDamnHardButterAxe;
import zaneextras.items.tool.damnhardbutter.ItemToolDamnHardButterHoe;
import zaneextras.items.tool.damnhardbutter.ItemToolDamnHardButterPickaxe;
import zaneextras.items.tool.damnhardbutter.ItemToolDamnHardButterShovel;
import zaneextras.items.tool.emerald.ItemToolEmeraldAxe;
import zaneextras.items.tool.emerald.ItemToolEmeraldHoe;
import zaneextras.items.tool.emerald.ItemToolEmeraldPickaxe;
import zaneextras.items.tool.emerald.ItemToolEmeraldShovel;
import zaneextras.items.tool.foolstaria.ItemToolFoolStariaAxe;
import zaneextras.items.tool.foolstaria.ItemToolFoolStariaHoe;
import zaneextras.items.tool.foolstaria.ItemToolFoolStariaPickaxe;
import zaneextras.items.tool.foolstaria.ItemToolFoolStariaShovel;
import zaneextras.items.tool.skyium.ItemToolSkyiumAxe;
import zaneextras.items.tool.skyium.ItemToolSkyiumHoe;
import zaneextras.items.tool.skyium.ItemToolSkyiumPickaxe;
import zaneextras.items.tool.skyium.ItemToolSkyiumShovel;
import zaneextras.items.tool.staria.ItemToolStariaAxe;
import zaneextras.items.tool.staria.ItemToolStariaHoe;
import zaneextras.items.tool.staria.ItemToolStariaPickaxe;
import zaneextras.items.tool.staria.ItemToolStariaShovel;
import zaneextras.items.tool.zanium.ItemToolZaniumAxe;
import zaneextras.items.tool.zanium.ItemToolZaniumHoe;
import zaneextras.items.tool.zanium.ItemToolZaniumPickaxe;
import zaneextras.items.tool.zanium.ItemToolZaniumShovel;
import zaneextras.items.weapon.ItemWeaponAngelSword;
import zaneextras.items.weapon.ItemWeaponDamnHardButterSword;
import zaneextras.items.weapon.ItemWeaponEmeraldSword;
import zaneextras.items.weapon.ItemWeaponFoolStariaSword;
import zaneextras.items.weapon.ItemWeaponSkyiumSword;
import zaneextras.items.weapon.ItemWeaponStariaSword;
import zaneextras.items.weapon.ItemWeaponUrielSword;
import zaneextras.items.weapon.ItemWeaponZaniumSword;
import zaneextras.items.weapon.ItemWeaponZograditeScythe;
public class ItemList {
// Everything Else
public static final Item knife = new ItemChefKnife();
public static final Item lightEye = new ItemLightEye();
public static final Item lightBone = new ZaneItem("lightbone");
public static final Item lightFlesh = new ItemFoodGlowingFlesh();
public static final Item lightBoneMeal = new ZaneItem("lightbonemeal");
public static final Item starCoal = new ZaneItem("starcoal");
// ignots
public static final Item butterItem = new ItemRarity("damnhardbutteringot",
EnumRarity.common);
public static final Item raditeIngot = new ItemRarity("raditeingot",
EnumRarity.uncommon);
public static final Item zogiteIngot = new ItemRarity("zogiteingot",
EnumRarity.uncommon);
public static final Item zograditeIgnot = new ZaneAnimatedItem(
"zograditeingot", EnumRarity.epic);
public static final Item lightIngot = new ZaneItem("lightingot");
// Materials
public static final Item sodium = new ZaneItem("sodium");
public static final Item zanium = new ItemRarity("zanium", EnumRarity.epic);
public static final Item staria = new ItemRarity("staria", EnumRarity.epic);
public static final Item skyium = new ZaneItem("skyium");
public static final Item chargedStaria = new ZaneAnimatedItem(
"charged_staria", EnumRarity.epic);
public static final Item chargedZanium = new ZaneAnimatedItem(
"charged_zanium", EnumRarity.epic);
public static final Item foolStaria = new ZaneItem("foolstaria");
public static final Item empoweredStaria = new ItemRarity(
"empowered_staria", EnumRarity.epic);
public static final Item empoweredZanium = new ItemRarity(
"empowered_zanium", EnumRarity.epic);
// Dust
public static final Item butterDust = new ZaneItem("butterdust");
public static final Item redGlowStoneDust = new ZaneItem(
"redglowstonedust");
public static final Item skyiumDust = new ZaneItem("skyiumdust");
public static final Item zogiteDust = new ItemRarity("zogitedust",
EnumRarity.uncommon);
public static final Item raditeDust = new ItemRarity("raditedust",
EnumRarity.uncommon);
public static final Item zograditeBlend = new ZaneAnimatedItem(
"zograditeblend", EnumRarity.rare);
// Sticks
public static final Item glowStick = new ZaneItem("glowstick");
public static final Item netherStick = new ZaneItem("netherstick");
public static final Item raditeInfusedStick = new ItemRarity(
"raditeinfusedstick", EnumRarity.rare);
public static final Item lightStick = new ItemRarity("lightstick",
EnumRarity.uncommon);
// Bottles
public static final Item mixedBottle = new ZaneItem("mixturebottle");
public static final Item acidBottle = new ZaneItem("acidbottle");
public static final Item chlorineBottle = new ZaneBottleItem(
"chlorinebottle");
public static final Item french = new ZaneBottleItem("frenchbottle");
public static final Item ranch = new ZaneBottleItem("ranchbottle");
public static final Item italian = new ZaneBottleItem("italianbottle");
public static final Item salt = new ZaneBottleItem("salt");
public static final Item blackPepper = new ZaneBottleItem("blackpepper");
public static final Item vinegar = new ZaneBottleItem("vinegar");
// Buckets
public static final Item chlorineBucket = new ZaneItemBucket(
BlockList.chlorineFluidBlock, "bucket_chlorine");
public static final Item acidBucket = new ZaneItemBucket(
BlockList.acidFluidBlock, "bucket_acid");
public static final Item raditeBucket = new ZaneRarityBucket(
BlockList.raditeFluidBlock, "bucket_radite", EnumRarity.rare);
// Non edible food
public static final Item crushedPeppercorn = new ZaneItem(
"crushedpeppercorn");
public static final Item tomatoPaste = new ZaneItem("tomatopaste");
public static final Item ketchup = new ZaneItem("ketchup");
// food
public static final Item butterFood = new ZaneItemFood("butteringot", 1,
0.5F, false);
public static final Item butterPotato = new ZaneItemFood("butterpotato", 8,
0.7F, false);
public static final Item rawSweet = new ZaneItemFood("rawsweetpotatofry", 1,
0.1F, false);
public static final Item cookedSweet = new ZaneItemFood(
"cookedsweetpotatofry", 2, 0.5F, false);
public static final Item rawFry = new ZaneItemFood("rawfry", 1, 0.1F,
false);
public static final Item cookedFry = new ZaneItemFood("cookedfry", 2, 0.5F,
false);
public static final Item greenBean = new ZaneItemFood("greenbean", 2, 0.5F,
false);
public static final Item spinach = new ZaneItemFood("spinach", 2, 0.5F,
false);
public static final Item lettuce = new ZaneItemFood("lettuce", 2, 0.5F,
false);
public static final Item cheese = new ZaneItemFood("cheese", 2, 0.5F,
false);
public static final Item tomato = new ZaneItemFood("tomato", 2, 0.5F,
false);
public static final Item garlic = new ZaneItemFood("garlic", 2, 0.5F,
false);
public static final Item onion = new ZaneItemFood("onion", 2, 0.5F, false);
public static final Item salad = new ItemFoodSalad();
public static final Item ghost = new ItemFoodGhostPepper();
public static final Item pepper = new ItemFoodPepper();
public static final Item italianSalad = new ItemFoodItalianSalad();
public static final Item frenchSalad = new ItemFoodFrenchSalad();
public static final Item ranchSalad = new ItemFoodRanchSalad();
public static final Item barrierApple = new ItemBarrierApple()
.setAlwaysEdible();
// Seeds
public static final Item pepperSeeds = new Seed("pepperseeds",
BlockList.pepperCrop);
public static final Item ghostSeeds = new NetherSeed("ghostpepperseeds",
BlockList.ghostCrop);
public static final Item greenSeeds = new Seed("greenbeanseeds",
BlockList.greenBeanCrop);
public static final Item spinachSeeds = new Seed("spinachseeds",
BlockList.spinachCrop);
public static final Item lettuceSeeds = new Seed("lettuce_seeds",
BlockList.lettuceStem);
public static final Item tomatoSeeds = new Seed("tomato_seeds",
BlockList.tomatoStem);
public static final Item onionSeeds = new Seed("onionseeds",
BlockList.onionCrop);
public static final Item garlicSeeds = new Seed("garlicseeds",
BlockList.garlicCrop);
// Crops
public static final Item sweetPotato = new SeedFood(2, 0.3F,
BlockList.sweetPotatoCrop, Blocks.farmland, "sweetpotato");
public static final Item peppercorn = new SeedFood(2, 0.3F,
BlockList.peppercornCrop, Blocks.farmland, "peppercorn");
// Butter Tools and Sword
public static final Item butterHoe = new ItemToolDamnHardButterHoe();
public static final Item butterAxe = new ItemToolDamnHardButterAxe();
public static final Item butterShovel = new ItemToolDamnHardButterShovel();
public static final Item butterPickaxe = new ItemToolDamnHardButterPickaxe();
public static final Item butterSword = new ItemWeaponDamnHardButterSword();
// Butter Armor Set
public static final Item butterHelmet = new ButterArmor(
ZaneArmorMaterials.BUTTER, "butterhelmet", 0);
public static final Item butterChestPlate = new ButterArmor(
ZaneArmorMaterials.BUTTER, "butterchestplate", 1);
public static final Item butterLeggings = new ButterArmor(
ZaneArmorMaterials.BUTTER, "butterleggings", 2);
public static final Item butterBoots = new ButterArmor(
ZaneArmorMaterials.BUTTER, "butterboots", 3);
// Emerald Tools and Sword
public static final Item emeraldHoe = new ItemToolEmeraldHoe();
public static final Item emeraldAxe = new ItemToolEmeraldAxe();
public static final Item emeraldShovel = new ItemToolEmeraldShovel();
public static final Item emeraldPickaxe = new ItemToolEmeraldPickaxe();
public static final Item emeraldSword = new ItemWeaponEmeraldSword();
// Emerald Armor Set
public static final Item emeraldHelmet = new EmeraldArmor(
ZaneArmorMaterials.EMERALD, "emeraldhelmet", 0);
public static final Item emeraldChestPlate = new EmeraldArmor(
ZaneArmorMaterials.EMERALD, "emeraldchestplate", 1);
public static final Item emeraldLeggings = new EmeraldArmor(
ZaneArmorMaterials.EMERALD, "emeraldleggings", 2);
public static final Item emeraldBoots = new EmeraldArmor(
ZaneArmorMaterials.EMERALD, "emeraldboots", 3);
// Staria Armor Set
public static final Item stariaHelmet = new StariaArmor(
ZaneArmorMaterials.STARIA, "stariahelmet", 0,
Enchantment.respiration, 4, Enchantment.protection, 4);
public static final Item stariaChestPlate = new StariaArmor(
ZaneArmorMaterials.STARIA, "stariachestplate", 1,
Enchantment.protection, 4, Enchantment.blastProtection, 4);
public static final Item stariaLeggings = new StariaArmor(
ZaneArmorMaterials.STARIA, "starialeggings", 2,
Enchantment.protection, 4, Enchantment.projectileProtection, 4);
public static final Item stariaBoots = new StariaArmor(
ZaneArmorMaterials.STARIA, "stariaboots", 3,
Enchantment.featherFalling, 4, Enchantment.protection, 4);
// Staria Tools and Sword
public static final Item stariaHoe = new ItemToolStariaHoe();
public static final Item stariaAxe = new ItemToolStariaAxe();
public static final Item stariaShovel = new ItemToolStariaShovel();
public static final Item stariaPickaxe = new ItemToolStariaPickaxe();
public static final Item stariaSword = new ItemWeaponStariaSword();
// Zanium Armor Set
public static final Item zaniumHelmet = new ZaniumArmor(
ZaneArmorMaterials.ZANIUM, "zaniumhelmet", 0,
Enchantment.respiration, 4, Enchantment.thorns, 4);
public static final Item zaniumChestPlate = new ZaniumArmor(
ZaneArmorMaterials.ZANIUM, "zaniumchestplate", 1,
Enchantment.blastProtection, 4, Enchantment.thorns, 4);
public static final Item zaniumLeggings = new ZaniumArmor(
ZaneArmorMaterials.ZANIUM, "zaniumleggings", 2, Enchantment.thorns,
4, Enchantment.projectileProtection, 4);
public static final Item zaniumBoots = new ZaniumArmor(
ZaneArmorMaterials.ZANIUM, "zaniumboots", 3,
Enchantment.featherFalling, 4, Enchantment.thorns, 4);
// Zanium Tools and Sword
public static final Item zaniumHoe = new ItemToolZaniumHoe();
public static final Item zaniumAxe = new ItemToolZaniumAxe();
public static final Item zaniumShovel = new ItemToolZaniumShovel();
public static final Item zaniumPickaxe = new ItemToolZaniumPickaxe();
public static final Item zaniumSword = new ItemWeaponZaniumSword();
// Skyium Armor Set
public static final Item skyiumHelmet = new SkyiumArmor(
ZaneArmorMaterials.SKYIUM, "skyiumhelmet", 0,
Enchantment.protection, 3);
public static final Item skyiumChestPlate = new SkyiumArmor(
ZaneArmorMaterials.SKYIUM, "skyiumchestplate", 1,
Enchantment.projectileProtection, 3);
public static final Item skyiumLeggings = new SkyiumArmor(
ZaneArmorMaterials.SKYIUM, "skyiumleggings", 2,
Enchantment.blastProtection, 3);
public static final Item skyiumBoots = new SkyiumArmor(
ZaneArmorMaterials.SKYIUM, "skyiumboots", 3,
Enchantment.featherFalling, 4);
// Skyium Tools and Sword
public static final Item skyiumHoe = new ItemToolSkyiumHoe();
public static final Item skyiumAxe = new ItemToolSkyiumAxe();
public static final Item skyiumShovel = new ItemToolSkyiumShovel();
public static final Item skyiumPickaxe = new ItemToolSkyiumPickaxe();
public static final Item skyiumSword = new ItemWeaponSkyiumSword();
// Zogite Armor Set
public static final Item zogiteHelmet = new ZogiteArmor(
ZaneArmorMaterials.ZOGITE, "zogitehelmet", 0, Enchantment.thorns,
3);
public static final Item zogiteChestPlate = new ZogiteArmor(
ZaneArmorMaterials.ZOGITE, "zogitechestplate", 1,
Enchantment.thorns, 3);
public static final Item zogiteLeggings = new ZogiteArmor(
ZaneArmorMaterials.ZOGITE, "zogiteleggings", 2, Enchantment.thorns,
3);
public static final Item zogiteBoots = new ZogiteArmor(
ZaneArmorMaterials.ZOGITE, "zogiteboots", 3, Enchantment.thorns, 3);
// Radite Armor Set
public static final Item raditeHelmet = new RaditeArmor(
ZaneArmorMaterials.RADITE, "raditehelmet", 0,
Enchantment.protection, 4);
public static final Item raditeChestPlate = new RaditeArmor(
ZaneArmorMaterials.RADITE, "raditechestplate", 1,
Enchantment.protection, 4);
public static final Item raditeLeggings = new RaditeArmor(
ZaneArmorMaterials.RADITE, "raditeleggings", 2,
Enchantment.protection, 4);
public static final Item raditeBoots = new RaditeArmor(
ZaneArmorMaterials.RADITE, "raditeboots", 3, Enchantment.protection,
4);
// Zogradite Scythe
public static final Item zograditeScythe = new ItemWeaponZograditeScythe();
// Bows
public static final Item emeraldBow = new EmeraldBow();
public static final Item enderBow = new EnderBow();
public static final Item skeleBow = new SkeletonKingBow();
public static final Item lightBow = new LightBow();
// Arrows
public static final Item emeraldArrow = new ItemRarity("emeraldarrow",
EnumRarity.uncommon);
public static final Item enderArrow = new ItemRarity("enderarrow",
EnumRarity.uncommon);
public static final Item goldenArrow = new ItemRarity("goldenarrow",
EnumRarity.rare);
public static final Item lightArrow = new ItemRarity("lightarrow",
EnumRarity.rare);
// Fool Staria Armor Set
public static final Item foolStariaHelmet = new FoolStariaArmor(
ZaneArmorMaterials.FOOL_STARIA, "foolstariahelmet", 0);
public static final Item foolStariaChestPlate = new FoolStariaArmor(
ZaneArmorMaterials.FOOL_STARIA, "foolstariachestplate", 1);
public static final Item foolStariaLeggings = new FoolStariaArmor(
ZaneArmorMaterials.FOOL_STARIA, "foolstarialeggings", 2);
public static final Item foolStariaBoots = new FoolStariaArmor(
ZaneArmorMaterials.FOOL_STARIA, "foolstariaboots", 3);
// Fool Staria Tools and Sword
public static final Item foolStariaHoe = new ItemToolFoolStariaHoe();
public static final Item foolStariaAxe = new ItemToolFoolStariaAxe();
public static final Item foolStariaShovel = new ItemToolFoolStariaShovel();
public static final Item foolStariaPickaxe = new ItemToolFoolStariaPickaxe();
public static final Item foolStariaSword = new ItemWeaponFoolStariaSword();
// Angel Items
public static final Item angelSword = new ItemWeaponAngelSword();
public static final Item angelArrow = new ItemRarity("angelarrow",
EnumRarity.uncommon);
public static final Item angelBow = new AngelBow();
public static final Item pureFeather = new ZaneItem("purefeather");
public static final Item angelHalo = new ItemRarity("angelhalo",
EnumRarity.epic);
public static final Item angelKey = new ItemRarity("angelkey",
EnumRarity.epic);
public static final Item urielSword = new ItemWeaponUrielSword();
public static final Item lightNugget = new ZaneItem("lightnugget");
public static void init() {
addItem(butterItem, "i1");
addItem(butterFood, "i2");
addItem(butterPotato, "i3");
addItem(butterDust, "i4");
addItem(butterHoe, "i5");
addItem(butterShovel, "i6");
addItem(butterPickaxe, "i7");
addItem(butterAxe, "i8");
addItem(butterSword, "i9");
addItem(butterHelmet, "i10");
addItem(butterChestPlate, "i11");
addItem(butterLeggings, "i12");
addItem(butterBoots, "i13");
addItem(redGlowStoneDust, "i14");
addItem(emeraldHelmet, "i15");
addItem(emeraldChestPlate, "i16");
addItem(emeraldLeggings, "i17");
addItem(emeraldBoots, "i18");
addItem(emeraldHoe, "i19");
addItem(emeraldShovel, "i20");
addItem(emeraldPickaxe, "i21");
addItem(emeraldAxe, "i22");
addItem(emeraldSword, "i23");
addItem(sweetPotato, "i24");
addItem(rawSweet, "i25");
addItem(cookedSweet, "i26");
addItem(rawFry, "i27");
addItem(cookedFry, "i28");
addItem(knife, "i29");
addItem(ghost, "i30");
addItem(greenBean, "i31");
addItem(pepper, "i32");
addItem(greenSeeds, "i33");
addItem(ghostSeeds, "i34");
addItem(pepperSeeds, "i35");
addItem(spinach, "i36");
addItem(spinachSeeds, "i37");
addItem(lettuce, "i38");
addItem(lettuceSeeds, "i39");
addItem(salad, "i40");
addItem(staria, "i41");
addItem(stariaHelmet, "i42");
addItem(stariaChestPlate, "i43");
addItem(stariaLeggings, "i44");
addItem(stariaBoots, "i45");
addItem(stariaHoe, "i46");
addItem(stariaShovel, "i47");
addItem(stariaPickaxe, "i48");
addItem(stariaAxe, "i49");
addItem(stariaSword, "i50");
addItem(zanium, "i51");
addItem(zaniumHelmet, "i52");
addItem(zaniumChestPlate, "i53");
addItem(zaniumLeggings, "i54");
addItem(zaniumBoots, "i55");
addItem(zaniumHoe, "i56");
addItem(zaniumShovel, "i57");
addItem(zaniumPickaxe, "i58");
addItem(zaniumAxe, "i59");
addItem(zaniumSword, "i60");
addItem(glowStick, "i61");
addItem(netherStick, "i62");
addItem(emeraldBow, "i63");
addItem(emeraldArrow, "i64");
addItem(enderArrow, "i65");
addItem(enderBow, "i66");
addItem(cheese, "i67");
addItem(tomato, "i68");
addItem(garlic, "i69");
addItem(salt, "i70");
addItem(blackPepper, "i71");
addItem(onion, "i72");
addItem(vinegar, "i73");
addItem(acidBucket, "i74");
addItem(acidBottle, "i75");
addItem(peppercorn, "i76");
addItem(crushedPeppercorn, "i77");
addItem(tomatoSeeds, "i78");
addItem(onionSeeds, "i79");
addItem(garlicSeeds, "i80");
addItem(mixedBottle, "i81");
addItem(tomatoPaste, "i82");
addItem(ketchup, "i83");
addItem(sodium, "i84");
addItem(chlorineBucket, "i85");
addItem(french, "i86");
addItem(ranch, "i87");
addItem(italian, "i88");
addItem(chlorineBottle, "i89");
addItem(italianSalad, "i90");
addItem(frenchSalad, "i91");
addItem(ranchSalad, "i92");
addItem(skyium, "i93");
addItem(skyiumHelmet, "i94");
addItem(skyiumChestPlate, "i95");
addItem(skyiumLeggings, "i96");
addItem(skyiumBoots, "i97");
addItem(skyiumHoe, "i98");
addItem(skyiumShovel, "i199");
addItem(skyiumPickaxe, "i100");
addItem(skyiumAxe, "i101");
addItem(skyiumSword, "i102");
addItem(skyiumDust, "i103");
addItem(skeleBow, "i04");
addItem(goldenArrow, "i105");
addItem(chargedStaria, "i106");
addItem(chargedZanium, "i107");
addItem(zogiteDust, "i108");
addItem(raditeDust, "i109");
addItem(raditeIngot, "i110");
addItem(zogiteIngot, "i111");
addItem(zograditeIgnot, "i112");
addItem(zograditeBlend, "i113");
addItem(raditeBucket, "i114");
addItem(zogiteHelmet, "i115");
addItem(zogiteChestPlate, "i116");
addItem(zogiteLeggings, "i117");
addItem(zogiteBoots, "i118");
addItem(raditeHelmet, "i119");
addItem(raditeChestPlate, "i120");
addItem(raditeLeggings, "i121");
addItem(raditeBoots, "i122");
addItem(zograditeScythe, "i123");
addItem(raditeInfusedStick, "i124");
addItem(lightEye, "i125");
addItem(lightArrow, "i126");
addItem(lightBow, "i127");
addItem(lightFlesh, "i128");
addItem(lightBone, "i129");
addItem(lightBoneMeal, "i130");
addItem(lightStick, "i131");
addItem(barrierApple, "i132");
addItem(starCoal, "i133");
addItem(foolStaria, "i134");
addItem(foolStariaHelmet, "i135");
addItem(foolStariaChestPlate, "i136");
addItem(foolStariaLeggings, "i137");
addItem(foolStariaBoots, "i138");
addItem(foolStariaHoe, "i139");
addItem(foolStariaShovel, "i140");
addItem(foolStariaPickaxe, "i141");
addItem(foolStariaAxe, "i142");
addItem(foolStariaSword, "i143");
addItem(pureFeather, "i144");
addItem(angelHalo, "i145");
addItem(angelKey, "i146");
addItem(urielSword, "i147");
addItem(angelBow, "i148");
addItem(angelArrow, "i149");
addItem(lightIngot, "i150");
addItem(angelSword, "i151");
addItem(lightNugget, "i152");
addItem(empoweredStaria, "i153");
addItem(empoweredZanium, "i154");
}
public static void addItem(Item item, String name) {
GameRegistry.registerItem(item, name);
}
} | [
"masterhand89@gmail.com"
] | masterhand89@gmail.com |
7153aedeb583431f80a34a6651bf0495ca261420 | 8c0eaa0706c974e394d913ca3a1bae6fe7676df6 | /design-patterns/src/state/EstadoDeUmOrcamento.java | bed579064aa3dcd3b86ec3421af5212a70ecd82e | [] | no_license | mmcgoncalves/alura-design-patterns | 6e0d14fbb9e9b28954acce8b954ae7b1b867acca | ee076e2ccfd0695d9561ea51b4d6feb02cf8a296 | refs/heads/master | 2021-01-19T03:13:10.716379 | 2015-03-24T01:38:43 | 2015-03-24T01:38:43 | 32,769,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package state;
public interface EstadoDeUmOrcamento {
void aplicaDescontoExtra(Orcamento orcamento);
void aprova(Orcamento orcamento);
void reprova(Orcamento orcamento);
void finaliza(Orcamento orcamento);
}
| [
"mau.michel@gmail.com"
] | mau.michel@gmail.com |
4ad9ebfe0171d0ab1f656a9e188224e1710c4d32 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /chrome/android/java/src/org/chromium/chrome/browser/crash/PureJavaExceptionHandler.java | 75f710df37700f63d1ce02a42ed063c11e9b9151 | [
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | Java | false | false | 2,088 | java | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.crash;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.MainDex;
import org.chromium.components.crash.CrashKeys;
/**
* This UncaughtExceptionHandler will upload the stacktrace when there is an uncaught exception.
*
* This happens before native is loaded, and will replace by JavaExceptionReporter after native
* finishes loading.
*/
@MainDex
public class PureJavaExceptionHandler implements Thread.UncaughtExceptionHandler {
private final Thread.UncaughtExceptionHandler mParent;
private boolean mHandlingException;
private static boolean sIsDisabled;
private PureJavaExceptionHandler(Thread.UncaughtExceptionHandler parent) {
mParent = parent;
}
@Override
public void uncaughtException(Thread t, Throwable e) {
if (!mHandlingException && !sIsDisabled) {
mHandlingException = true;
reportJavaException(e);
}
if (mParent != null) {
mParent.uncaughtException(t, e);
}
}
public static void installHandler() {
if (!sIsDisabled) {
Thread.setDefaultUncaughtExceptionHandler(
new PureJavaExceptionHandler(Thread.getDefaultUncaughtExceptionHandler()));
}
}
@CalledByNative
private static void uninstallHandler() {
// The current handler can be in the middle of an exception handler chain. We do not know
// about handlers before it. If resetting the uncaught exception handler to mParent, we lost
// all the handlers before mParent. In order to disable this handler, globally setting a
// flag to ignore it seems to be the easiest way.
sIsDisabled = true;
CrashKeys.getInstance().flushToNative();
}
private void reportJavaException(Throwable e) {
PureJavaExceptionReporter.reportJavaException(e);
}
}
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
ab513471531a93450fbac42058add89f5099b943 | f0578e1cfaeac329f4daf2069d103de6025d029b | /ServiceTicketResolutionSystem/src/main/java/service/AdminService.java | fe0da0464b9c805ebf5a9f2758acefdd00225642 | [] | no_license | MajorProject123/Back-end | dc211aff248e2f6208379b309b98150d59e56b6c | 9a3f601b0a8fd782fc671a1c37cc8088d1c4a4ac | refs/heads/master | 2022-04-20T11:34:44.903808 | 2020-04-18T10:08:05 | 2020-04-18T10:08:05 | 244,148,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,299 | java | package service;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import bean.Departments;
import bean.LoginCredentials;
import bean.Priorities;
import bean.Roles;
import bean.ServiceEngineerDetails;
import bean.TicketDetails;
import interfaces.AdminServiceInterface;
import repository.DepartmentsRepository;
import repository.LoginCredentialsRepository;
import repository.PrioritiesRepository;
import repository.RolesRepository;
import repository.ServiceEngineerDetailsRepository;
import repository.TicketDetailsRepository;
@Service
public class AdminService implements AdminServiceInterface {
@Autowired
RolesRepository rolesRepository;
@Autowired
LoginCredentialsRepository loginCredentialsRepository;
@Autowired
PrioritiesRepository prioritiesRepository;
@Autowired
DepartmentsRepository departmentsRepository;
@Autowired
ServiceEngineerDetailsRepository serviceEngineerDetailsRepository;
@Autowired
TicketDetailsRepository ticketDetailsRepository;
/*
* Admin Can register User here
*/
public String registerUser(LoginCredentials user) {
Optional<LoginCredentials> credentials = loginCredentialsRepository.findById(user.getUsername());
if (!credentials.isPresent()) {
Optional<Roles> roles = rolesRepository.findById(1);
user.setRoles(roles.get());
loginCredentialsRepository.save(user);
return "Account for User " + user.getUsername() + " is created successfully";
} else {
return "Username already exists, try a different one";
}
}
/*
* Admin can register ServiceEngineer here
*/
public String registerServiceEngineer(LoginCredentials user) {
Optional<LoginCredentials> credentials = loginCredentialsRepository.findById(user.getUsername());
if (!credentials.isPresent()) {
Optional<Roles> roles = rolesRepository.findById(2);
user.setRoles(roles.get());
loginCredentialsRepository.save(user);
return "Account for ServiceEngineer " + user.getUsername() + " is created successfully";
} else {
return "Username already exists, try a different one";
}
}
/*
* This function is called following the addition of service engineer in the
* LoginCredentials table, Here we add the new service engineer into the
* ServiceEngineerDetails table by setting default values
*/
public void insertIntoServiceEngineerDetails(ServiceEngineerDetails engineerDetails) {
Optional<Priorities> priorities = prioritiesRepository.findById(0);
Optional<Departments> departments = departmentsRepository
.findById(engineerDetails.getDepartments().getDepartmentID());
engineerDetails.setPriorities(priorities.get());
engineerDetails.setDepartments(departments.get());
engineerDetails.setTotalTicketsWorkedOn(0);
engineerDetails.setCurrentHighPriorityTicketID("0");
serviceEngineerDetailsRepository.save(engineerDetails);
}
/*
* Extracts Roles table
*/
public List<Roles> getRoles() {
return rolesRepository.findAll();
}
/*
* Extracts only users from LoginCredentials table
*/
public List<LoginCredentials> getUsers() {
return loginCredentialsRepository.getUsers(1);
}
/*
* Extracts ServiceEngineerDetails table
*/
public List<ServiceEngineerDetails> getServiceEngineers() {
return serviceEngineerDetailsRepository.findAll();
}
/*
* This function is called when admin wants to delete a service engineer And the
* process is as follows: First we check if the Service Engineer is free, Then
* we check if the department has more than one service engineer, Only if the
* above two cases satisfy can an admin delete a service engineer
*/
public String deleteServiceEngineer(ServiceEngineerDetails engineerDetails) {
Optional<ServiceEngineerDetails> optionalEngineerDetails = serviceEngineerDetailsRepository
.findById(engineerDetails.getID());
engineerDetails = optionalEngineerDetails.get();
Optional<LoginCredentials> optionalCredentials = loginCredentialsRepository
.findById(engineerDetails.getCredentials().getUsername());
LoginCredentials credentials = optionalCredentials.get();
if (!engineerDetails.getCurrentHighPriorityTicketID().equals("0")) {
return "ServiceEngineer " + engineerDetails.getCredentials().getUsername()
+ " cannot be deleted because he is currently working on some ticket";
} else if (serviceEngineerDetailsRepository
.getCountOfEngineersForDepartment(engineerDetails.getDepartments().getDepartmentID()) > 1) {
ticketDetailsRepository.replaceWithDeletedServiceEngineer(10580834400L, engineerDetails.getID());
serviceEngineerDetailsRepository.delete(engineerDetails);
loginCredentialsRepository.delete(credentials);
return "Deleted";
}
return "ServiceEngineer " + engineerDetails.getCredentials().getUsername()
+ " cannot be deleted because there is only one ServiceEngineer for that Department";
}
/*
* This function is called when admin wants to delete user And the process is as
* follows: First we change the Customer username of the user to be deleted to a
* Dummy username which is present in the LoginCredentials mapped to the
* TicketDetails table, Then we delete the user from the LoginCredentials, Then
* we get the list of service engineers working on the tickets raised by the
* deleted user, We delete those tickets and set the CurrentHighPriorityTicketId
* and CurrentTicketPriority of the service engineers as required,
*/
public String deleteUser(LoginCredentials loginCredentials) {
Optional<LoginCredentials> optionalCredentials = loginCredentialsRepository
.findById(loginCredentials.getUsername());
LoginCredentials credentials = optionalCredentials.get();
Optional<LoginCredentials> Deleted = loginCredentialsRepository.findById("Deleted");
ticketDetailsRepository.updateUserDeleted(Deleted.get(), credentials.getUsername());
loginCredentialsRepository.delete(credentials);
List<TicketDetails> ticketDetails = ticketDetailsRepository
.getServiceEngineersListWorkingOnDeletedUser("Deleted", "InProgress");
for (int i = 0; i < ticketDetails.size(); i++) {
ServiceEngineerDetails serviceEngineerDetails = serviceEngineerDetailsRepository
.getServiceEngineersListWorkingOnDeletedUser(ticketDetails.get(i).getDetails().getID());
ticketDetailsRepository.deleteOpenTicketsWhichAreNotClosedOrInProgress("Deleted", "Closed", "InProgress");
List<TicketDetails> respectiveTickets = ticketDetailsRepository
.getServiceEngineerTickets(ticketDetails.get(i).getDetails().getCredentials().getUsername());
if (respectiveTickets.size() > 1) {
respectiveTickets.get(1).setTicketStatus("InProgress");
serviceEngineerDetails.setCurrentHighPriorityTicketID(respectiveTickets.get(1).getTicketID());
Optional<Priorities> priorities = prioritiesRepository
.findById(respectiveTickets.get(1).getPriorities().getPriorityID());
serviceEngineerDetails.setPriorities(priorities.get());
ticketDetailsRepository.save(respectiveTickets.get(1));
serviceEngineerDetailsRepository.save(serviceEngineerDetails);
ticketDetailsRepository.delete(respectiveTickets.get(0));
} else if (respectiveTickets.size() == 1) {
serviceEngineerDetails.setCurrentHighPriorityTicketID("0");
Optional<Priorities> priorities = prioritiesRepository.findById(0);
serviceEngineerDetails.setPriorities(priorities.get());
ticketDetailsRepository.delete(respectiveTickets.get(0));
} else {
}
}
return "Deleted";
}
/*
* This function is called when admin wants to add department And the process is
* as follows: First we check if the given departmentID is not present in the
* Departments table, then we check if the departmentName is not present in the
* Departments table, only if the above two cases satisfy can an admin add a
* Department
*/
public String addDepartment(Departments department) {
if (departmentsRepository.findById(department.getDepartmentID()).isPresent()) {
return "departmentID already exists";
} else if (departmentsRepository.findByName(department.getDepartmentName()) != null) {
return "departmentName already exists";
}
departmentsRepository.save(department);
return "Department " + department.getDepartmentName() + " is created";
}
}
| [
"strs.majorproject@gmail.com"
] | strs.majorproject@gmail.com |
ae5e9fb91963ab818afd40b7a580b1f8be45f424 | 9e3abb2caeb30b811b7f053d09acaf599e668a55 | /Customer/src/main/java/com/example/demo/model/Vehicle.java | 8375eee8ba9598f7f0f87f1c13cbf6a57d45406a | [] | no_license | AbbyBounty/customer-backend | 768e2b229cd8fc1cc749142f2a6ab528cad5b2ff | 0cdf95517cac1fa2b58da23bac9e6cddb0f368b3 | refs/heads/master | 2023-02-23T14:18:15.410972 | 2020-11-27T11:14:06 | 2020-11-27T11:14:06 | 315,974,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,472 | java | package com.example.demo.model;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonBackReference;
//Already Input Data Into The Database
@Entity
@Table(name="vehicle")
public class Vehicle {
private int v_id;
private String v_company_name; //Vehicle Name --> [YAMAHA,HERO,HONDA]
private String v_model; //Vehicle Model --> [FZ-SFI,SZ,ACTIVA,UNICORN]
private String v_regNo; //Vehicle Reg Number
private User v_user;
public Vehicle() {
System.out.println("In The Default Constructor of Vehicle"+this.v_id);
}
public Vehicle(int v_id) {
System.out.println("\n\nVehicle With ID Constructor Server\n\n");
}
public Vehicle(String v_company_name, String v_model, String v_regNo) {
super();
this.v_company_name = v_company_name;
this.v_model = v_model;
this.v_regNo = v_regNo;
}
public Vehicle(String v_company_name, String v_model, String v_regNo, User v_user) {
super();
this.v_company_name = v_company_name;
this.v_model = v_model;
this.v_regNo = v_regNo;
this.v_user = v_user;
}
public Vehicle(int v_id, String v_company_name, String v_model, String v_regNo, User v_user) {
super();
this.v_id = v_id;
this.v_company_name = v_company_name;
this.v_model = v_model;
this.v_regNo = v_regNo;
this.v_user = v_user;
}
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public int getV_id() {
return v_id;
}
public void setV_id(int v_id) {
this.v_id = v_id;
}
@Column(length=30)
public String getV_company_name() {
return v_company_name;
}
public void setV_company_name(String v_company_name) {
this.v_company_name = v_company_name;
}
@Column(length=30)
public String getV_model() {
return v_model;
}
public void setV_model(String v_model) {
this.v_model = v_model;
}
@Column(length=20,unique=true)
public String getV_regNo() {
return v_regNo;
}
public void setV_regNo(String v_regNo) {
this.v_regNo = v_regNo;
}
@ManyToOne/*(fetch=FetchType.EAGER)*/
@JoinColumn(name="u_id")
@JsonBackReference
public User getV_user() {
return v_user;
}
public void setV_user(User v_user) {
this.v_user = v_user;
}
@Override
public String toString() {
return "Vehicle [v_id=" + v_id + ", v_company_name=" + v_company_name + ", v_model=" + v_model + ", v_regNo="
+ v_regNo + "]";
}
}
| [
"abhilash.kamble376@gmail.com"
] | abhilash.kamble376@gmail.com |
2de11fa19a77c829957675871922fe20059d9037 | 4f4d906cba81a5f03d08b51232c1d8d84790f913 | /NotThreadSafe/src/MyRunnable.java | 976abb89ac1ace950a7fd19f8d88d2da85224a73 | [] | no_license | rodrigoms2004/JavaThreads | e2436f376aaf755dd6607146a95398e304c81948 | 634ba26970a452387d6de6bb1e724764bd4a5c6d | refs/heads/master | 2020-05-02T16:35:48.736609 | 2019-03-27T20:59:45 | 2019-03-27T20:59:45 | 178,073,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java |
public class MyRunnable implements Runnable {
NotThreadSafe instance = null;
public MyRunnable(NotThreadSafe instance) {
this.instance = instance;
}
public void run() {
this.instance.add("some text");
}
} // end class
| [
"rodrigoms2004@gmail.com"
] | rodrigoms2004@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.