blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
334f41b72d49fd2f072ed5aa8d52aa610276d4b5 | 503fbed63bf8319165de4db448fd439ab2319b89 | /Assignment 2/src/exercise2/MyItinerary.java | 0f983e146a2ac088669890b71a141887d49fcaa7 | []
| no_license | jrosenqvist/1DV516-Algorithms-and-Advanced-Data-Structures | a33fd322013b70582a9b0e003ad26db5b8c7ddc0 | 6e83b8b82e6a584d878f559541e30c8dda2a33ec | refs/heads/master | 2022-11-21T01:37:01.949189 | 2020-07-11T18:16:42 | 2020-07-11T18:16:42 | 215,030,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,564 | java | package exercise2;
import exercise1.MyHashTable;
public class MyItinerary implements A2Itinerary<A2Direction> {
private A2Direction[] itinerary;
A2Direction[] values;
public MyItinerary(A2Direction[] array) {
itinerary = array;
values = A2Direction.values();
}
@Override
public A2Direction[] rotateRight() {
A2Direction[] rotated = new A2Direction[itinerary.length];
for (int i = 0; i < itinerary.length; i++) {
int d = itinerary[i].ordinal() + 1;
if (d == values.length)
d = 0;
rotated[i] = values[d];
}
return rotated;
}
@Override
public int widthOfItinerary() {
return calculateSize(A2Direction.LEFT, A2Direction.RIGHT);
}
@Override
public int heightOfItinerary() {
return calculateSize(A2Direction.UP, A2Direction.DOWN);
}
@Override
public int[] getIntersections() {
boolean[] intersections = new boolean[itinerary.length];
MyHashTable<Coordinate> coordinatesTable = new MyHashTable<>();
int x = 0, y = 0, count = 0;
for (int i = 0; i < itinerary.length; i++) {
switch(itinerary[i]) {
case RIGHT: x++; break;
case LEFT: x--; break;
case UP: y++; break;
case DOWN: y--; break;
}
Coordinate c = new Coordinate(x, y);
if (coordinatesTable.contains(c)) {
intersections[i] = true;
count++;
}
coordinatesTable.insert(c);
}
int[] output = new int[count];
count = 0;
for (int i = 0; i < intersections.length; i++) {
if (intersections[i]) {
output[count++] = i;
}
}
return output;
}
private int calculateSize(A2Direction a, A2Direction b) {
int max = 0;
for (int i = 0; i < itinerary.length; i++) {
if (itinerary[i] == a) {
int n = 1;
int j = i + 1;
while (j < itinerary.length) {
if (itinerary[j] == b) break;
if (itinerary[j] == a) n++;
j++;
}
if (n > max) max = n;
}
if (itinerary[i] == b) {
int n = 1;
int j = i + 1;
while (j < itinerary.length) {
if (itinerary[j] == a) break;
if (itinerary[j] == b) n++;
j++;
}
if (n > max) max = n;
}
}
return max;
}
private class Coordinate {
private int x, y;
public Coordinate(int x, int y) {
this.x = x;
this.y = y;
}
public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof Coordinate) {
Coordinate c = (Coordinate) o;
return (c.x == x) && (c.y == y);
}
return false;
}
public int hashCode() {
return Math.abs(x) + Math.abs(y);
}
public String toString() {
return "(" + x + ", " + y + ")";
}
}
}
| [
"[email protected]"
]
| |
711c759f493252749dbc7a84b405580e8dbe1304 | 377e5e05fb9c6c8ed90ad9980565c00605f2542b | /bin/ext-accelerator/acceleratorcms/src/de/hybris/platform/acceleratorcms/services/impl/DefaultCMSDynamicAttributeService.java | 962b59527cda84801e2d231c2f902bb8fd91aa49 | []
| no_license | automaticinfotech/HybrisProject | c22b13db7863e1e80ccc29774f43e5c32e41e519 | fc12e2890c569e45b97974d2f20a8cbe92b6d97f | refs/heads/master | 2021-07-20T18:41:04.727081 | 2017-10-30T13:24:11 | 2017-10-30T13:24:11 | 108,957,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,622 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE or an SAP affiliate company.
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.acceleratorcms.services.impl;
import de.hybris.platform.acceleratorcms.services.CMSDynamicAttributeService;
import de.hybris.platform.cms2.model.contents.CMSItemModel;
import de.hybris.platform.cms2.model.contents.components.AbstractCMSComponentModel;
import de.hybris.platform.cms2.model.contents.contentslot.ContentSlotModel;
import java.util.Collections;
import java.util.Map;
import javax.servlet.jsp.PageContext;
/**
* Default implementation of {@link CMSDynamicAttributeService}.
*/
public class DefaultCMSDynamicAttributeService implements CMSDynamicAttributeService
{
@Override
public Map<String, String> getDynamicComponentAttributes(final AbstractCMSComponentModel component,
final ContentSlotModel contentSlot)
{
return Collections.emptyMap();
}
@Override
public Map<String, String> getDynamicContentSlotAttributes(final ContentSlotModel contentSlot, final PageContext pageContext,
final Map<String, String> initialMaps)
{
return Collections.emptyMap();
}
@Override
public void afterAllItems(final PageContext pageContext)
{
// no-op default implementation
}
@Override
public String getFallbackElement(final CMSItemModel cmsItemModel)
{
return null;
}
}
| [
"[email protected]"
]
| |
ad5f1dbe904a71da1fb77926a283ff4a10a36b54 | 86868ff5760d6230637dcab8bef6550a00676296 | /ShoppingCart/src/model/QaComparator.java | 575fb50fbe584b23a596c0bb70069f1e72d75e1d | []
| no_license | sagar005pawar/ShoppingCart | 00f954ab9d9524316cc5c6a1054c8283a0776cb0 | bca0a1cdd3f75870775da41ab934112803126257 | refs/heads/master | 2021-01-12T04:38:52.688132 | 2017-09-07T18:32:59 | 2017-09-07T18:32:59 | 77,695,148 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package model;
import java.util.Comparator;
public class QaComparator implements Comparator<Products> {
@Override
public int compare(Products p1, Products p2) {
if (p1.getQA() > p2.getQA()) {
return 1;
} else if(p1.getQA() < p2.getQA()){
return -1;
}else {
return 0;
}
}
}
| [
"sagar@Dell"
]
| sagar@Dell |
ccd74f22242832dd89b03646bb67c0817d9fc03f | e6fdfcc416b93521811988a3e496160a77c79445 | /Example.java | 7f1e5d1a185423f5caf381db80b280811785df33 | []
| no_license | AakarshitAgarwal/CORE_JAVA | 214bc0d91f7ce4301e22f545d75769b8ddc56383 | 7712025e7ede78598880a36dac21aa67b50dcc24 | refs/heads/master | 2023-05-24T07:32:42.887769 | 2021-06-04T18:02:15 | 2021-06-04T18:02:15 | 234,944,645 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package pack1;
import pack2.Student;
public class Example
{
public static void main(String []args)
{
Student s1=new Student();
s1.setRollno(100);
s1.setName("Saurabh");
System.out.println("Roll No. "+s1.getRollno());
System.out.println("Name "+s1.getName());
}
} | [
"[email protected]"
]
| |
0d40ea65dc17d525d2dbfa21977f7f06e4fec167 | 245d1f12fcf34bc7a1393617d8fcd6c968f9fd9d | /src/main/java/com/wuxin/visitor/ListVisitor.java | 8fbbd40c8e6d9b134a2b4b2f468609d5ef15e037 | []
| no_license | wuxin402/twentyThree-design-patterns | 5587ab4804da770cea5422b73a6195065c7feaec | 10b676d02e7cfd6432147dd98293f87de94cb126 | refs/heads/master | 2020-04-10T12:32:44.798272 | 2018-12-09T09:42:32 | 2018-12-09T09:42:32 | 161,025,860 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package com.wuxin.visitor;
import java.util.Iterator;
/**
* ConcreteVisitor(具体的访问者)
* 负责实现Visitor角色所定义的接口
* @author Administrator
*
*/
public class ListVisitor extends Visitor{
private String currentdir = "";
@Override
public void visit(File file) {
System.out.println(currentdir + "/" +file);
}
@Override
public void visit(Directory directory) {
System.out.println(currentdir + "/" +directory);
String savedir = currentdir;
currentdir = currentdir + "/" +directory.getName();
Iterator it = directory.iterator();
while (it.hasNext()) {
Entry entry = (Entry)it.next();
entry.accept(this);
}
currentdir = savedir;
}
}
| [
"[email protected]"
]
| |
ea250d78d293c17204fdfdb56076e88dc0a667f9 | 61ad3d65a3531b643a5ef59df26974c0b0173ce4 | /src/main/java/mirthandmalice/cards/mirth/basic/MirthDefend.java | 2cd33831cb82b550b0631055c5e447d13390fc90 | []
| no_license | yimengZJl/mirthandmalice | 18ebb6532ca2f41a46fb8770499d1276a6357f02 | 8a3cd43f1339d0f327eb5cd3c23d5ef04cc97134 | refs/heads/master | 2023-04-22T02:42:41.345001 | 2020-03-22T21:42:07 | 2020-03-22T21:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package mirthandmalice.cards.mirth.basic;
import com.megacrit.cardcrawl.actions.common.GainBlockAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mirthandmalice.abstracts.MirthCard;
import mirthandmalice.util.CardInfo;
import static basemod.helpers.BaseModCardTags.BASIC_DEFEND;
import static mirthandmalice.MirthAndMaliceMod.makeID;
public class MirthDefend extends MirthCard {
private final static CardInfo cardInfo = new CardInfo(
"M_Defend",
1,
CardType.SKILL,
CardTarget.SELF,
CardRarity.BASIC
);
public final static String ID = makeID(cardInfo.cardName);
private static final int BLOCK = 4;
private static final int UPG_BLOCK = 3;
public MirthDefend()
{
super(cardInfo, false);
setBlock(BLOCK, UPG_BLOCK);
tags.add(CardTags.STARTER_DEFEND);
}
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
AbstractDungeon.actionManager.addToBottom(new GainBlockAction(p, p, this.block));
}
@Override
public AbstractCard makeCopy() {
return new MirthDefend();
}
} | [
"[email protected]"
]
| |
56254b2ae01e13c6864a5974a6398ea28c4014cb | a9cf4118e0f032331542d38b7d29c60734a712bf | /src/Code_00_LeetCode_ShuaTi/Code_01_LinkList/Code_0142.java | c5afd9e45f956a628c638d077123f3e655749f03 | []
| no_license | jchen-96/leetCode | 5531571fb43ffc5023250f1ca21c1ebe5922aa8c | 4e411c9818d5d3194192b67016edafad36d75b29 | refs/heads/master | 2021-07-13T17:54:26.108694 | 2020-09-20T11:54:54 | 2020-09-20T11:54:54 | 176,665,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package Code_00_LeetCode_ShuaTi.Code_01_LinkList;
//https://leetcode-cn.com/problems/linked-list-cycle-ii/
//链表求环2
public class Code_0142 {
public ListNode detectCycle(ListNode head) {
if(!hasCircle(head))
return null;
ListNode fast=head;
ListNode slow=head;
while (fast.next!=null&&fast.next.next!=null&&slow.next!=null){
fast=fast.next.next;
slow=slow.next;
if(fast==slow)
break;
}
fast=head;
while (fast!=slow){
fast=fast.next;
slow=slow.next;
}
return fast;
}
private boolean hasCircle(ListNode head) {
if(head==null||head.next==null)
return false;
ListNode fast=head;
ListNode slow=head;
while (fast.next!=null&&fast.next.next!=null&&slow.next!=null){
fast=fast.next.next;
slow=slow.next;
if(fast==slow)
return true;
}
return false;
}
}
| [
"[email protected]"
]
| |
7fac566c3141a8258cadbd9c774989d645534466 | 1574e774c8695396810b1786d92603a083cc5e0b | /src/Sortbyroll.java | 009cbdc8a40e8d281f37c29fb913e48495b75ef4 | []
| no_license | prasad212/Server | 0a9d5a27d6511c8d5262fc4c4c36bd2c1dd05463 | 1c20ebe2e044d0b76403af3322aacc16678bf171 | refs/heads/master | 2020-03-27T03:37:16.057064 | 2018-08-23T15:58:37 | 2018-08-23T15:58:37 | 143,049,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java |
import java.util.Comparator;
public class Sortbyroll implements Comparator<Student>{
public int compare(Student s1, Student s2)
{
return s1.roll_no - s2.roll_no;
}
}
| [
"[email protected]"
]
| |
13fe8b9b6ba58b8618d748abc85ea288ffd81d57 | 9e26223d293d6715600a50aec5f7e3772881be11 | /BlueToothClient/app/src/main/java/com/ingwu/bluetoothclient/CusBtnActivity.java | f0af34c72a2955c44e5291c27be75c608ac99e21 | []
| no_license | w151275/BlueTooth | b10cef2d39a472c11418d1115a0161cfeb9d439f | 6f3ea497b0255b176b477ac76ff83ab28a9deaa6 | refs/heads/master | 2020-12-03T04:14:25.256782 | 2017-09-06T09:22:58 | 2017-09-06T09:22:58 | 95,837,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,065 | java | package com.ingwu.bluetoothclient;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.ingwu.bluetoothclient.adapter.CusBtnAdapter;
import com.ingwu.bluetoothclient.bean.CusBtnBean;
import java.util.List;
/**
* Created by Ing. Wu on 2017/3/28.
*/
public class CusBtnActivity extends BaseActivity implements View.OnClickListener, AdapterView.OnItemClickListener {
private RelativeLayout ivBack;
private TextView tvOK;
private GridView gridView;
private CusBtnAdapter cusBtnAdapter;
private List<CusBtnBean> list;
private CusBtnBean bean;
private String pos;
private String btnName;
private int cusPos = -1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cusbtn_lay);
if(getIntent()!= null){
pos = getIntent().getStringExtra("POS");
}
if("UP".equals(pos)){
btnName = spBaseUtil.getUpbtnPos();
if(TextUtils.isEmpty(btnName)){
btnName = "上";
}
list = cusBtnBgUtil.getUpList(btnName);
}else {
btnName = spBaseUtil.getDownbtnPos();
if(TextUtils.isEmpty(btnName)){
btnName = "下";
}
list = cusBtnBgUtil.getDownList(btnName);
}
initView();
initAction();
cusBtnAdapter = new CusBtnAdapter(this,list);
gridView.setAdapter(cusBtnAdapter);
}
private void initView(){
ivBack = (RelativeLayout) findViewById(R.id.rel_back);
tvOK = (TextView) findViewById(R.id.tv_cusbtn_ok);
gridView = (GridView) findViewById(R.id.grid_cus_btn);
}
private void initAction(){
gridView.setOnItemClickListener(this);
ivBack.setOnClickListener(this);
tvOK.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if(v.getId() == R.id.rel_back){
finish();
}else if(v.getId() == R.id.tv_cusbtn_ok){
if(cusPos != -1){
if("UP".equals(pos)){
spBaseUtil.setUpbtnPos(list.get(cusPos).getName());
}else {
spBaseUtil.setDownbtnPos(list.get(cusPos).getName());
}
}
finish();
}
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
bean = list.get(position);
for(int i = 0;i<list.size();i++){
bean = list.get(i);
if(i==position){
bean.setSelect(true);
}else {
bean.setSelect(false);
}
}
cusPos = position;
cusBtnAdapter.notifyDataSetChanged();
}
}
| [
"[email protected]"
]
| |
fb85a2387d81cb8e7c30bf53ae11a097a986b96d | 6b6e3901152ab5ef5e37ebb84e2f841db456703e | /src/main/java/com/example/application/backend/config/SecurityConfig.java | 66d47374810db3ddce10e59e70cfb0de0d4baf5e | [
"Unlicense"
]
| permissive | zirpindevs/ProyectoBancaVaadin | 814214dcd175c2df54a964c1711d65b84dc2cd09 | 5d25bfdb10604a7cff943ae7fadeac07614e17c3 | refs/heads/master | 2023-05-23T17:08:39.251478 | 2021-06-02T10:31:24 | 2021-06-02T10:31:24 | 370,612,280 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,532 | java | package com.example.application.backend.config;
import com.example.application.backend.security.jwt.JwtAuthEntryPoint;
import com.example.application.backend.security.jwt.JwtRequestFilter;
import com.example.application.backend.security.service.UserDetailsServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity // permite a Spring aplicar esta configuracion a la configuraicon de seguridad global
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private static final String LOGIN_PROCESSING_URL = "/login";
private static final String LOGIN_FAILURE_URL = "/login?error";
private static final String LOGIN_URL = "/login";
private static final String LOGOUT_SUCCESS_URL = "/login";
@Autowired
private UserDetailsServiceImpl userDetailsService;
@Autowired
private JwtAuthEntryPoint unauthorizedHandler;
@Bean
public JwtRequestFilter authenticationJwtTokenFilter() {
return new JwtRequestFilter();
}
// En caso de querer forzar HTTPS:
/*
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
http.requiresChannel()
.requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null)
.requiresSecure();
}
*/
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
}
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// Cross-Site Request Forgery CSRF
// CORS (Cross-origin resource sharing)
// http.cors().and().csrf().disable()
http.csrf().disable()
// .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// .anonymous().disable()
// Register our CustomRequestCache, that saves unauthorized access attempts, so
// the user is redirected after login.
.requestCache().requestCache(new CustomRequestCache())
.and().authorizeRequests().antMatchers("/api/auth/**").permitAll()
// Allow all flow internal requests.
.requestMatchers(SecurityUtils::isFrameworkInternalRequest).permitAll()
// .antMatchers("/login").permitAll()
.antMatchers("/VAADIN/**").permitAll()
.antMatchers("/api/**").permitAll()
.anyRequest().authenticated()
// Configure the login page.
.and().formLogin()
.loginPage("/login").permitAll()
.loginProcessingUrl(LOGIN_PROCESSING_URL)
.failureUrl(LOGIN_FAILURE_URL)
// Configure logout
.and().logout().logoutSuccessUrl(LOGOUT_SUCCESS_URL);
http.addFilterBefore(authenticationJwtTokenFilter(), UsernamePasswordAuthenticationFilter.class);
}
/**
* Allows access to static resources, bypassing Spring security.
*/
@Override
public void configure(WebSecurity web) {
web.ignoring().antMatchers(
// Vaadin Flow static resources
"/VAADIN/**",
// the standard favicon URI
"/favicon.ico",
// the robots exclusion standard
"/robots.txt",
// web application manifest
"/manifest.webmanifest",
"/sw.js",
"/offline-page.html",
// icons and images
"/icons/**",
"/images/**",
// (development mode) static resources
"/frontend/**",
// (development mode) webjars
"/webjars/**",
// (development mode) H2 debugging console
"/h2-console/**",
// (production mode) static resources
"/frontend-es5/**", "/frontend-es6/**");
}
}
| [
"[email protected]"
]
| |
63573ee32468ba6f225bcab695d93aaf3940e6d7 | b71cda837e3ceb793e3fe419697cc779384d0cc8 | /app/src/test/java/edu/cornell/zy337/ynotbikenavigation/ExampleUnitTest.java | 4f9720e1e556eba6fad1f0e1ca7d9c3ab34d5e97 | []
| no_license | zhidiyang/YNot-Bike-Navigation | ca6f2b8e20c2b11c3df89591f0a045cf6da7766d | 00530025aad7dc920d5e6c8b9e6b0502b78b7291 | refs/heads/master | 2020-03-19T00:13:26.909520 | 2018-05-30T16:50:41 | 2018-05-30T16:50:41 | 135,447,312 | 0 | 0 | null | 2018-05-30T13:42:25 | 2018-05-30T13:32:48 | null | UTF-8 | Java | false | false | 414 | java | package edu.cornell.zy337.ynotbikenavigation;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
e0c43a82e397707c503864cefae51e6b2c8896ae | 5eb6d893bb45b77f2db7177e0835dbba31ec871d | /backend/src/main/java/com/example/goalTracker/Goals/GoalServiceImpl.java | 255a1d07d12104adc7f7f3676dd994f25db68212 | []
| no_license | AppsLab-2/goal-tracker | 9be82dd66f61abeff8b5ab56dee0c319705aaaf7 | 4cad667c48c59f2700dd88c118db51ceab87f271 | refs/heads/master | 2023-05-11T16:15:44.331139 | 2021-06-01T07:10:28 | 2021-06-01T07:10:28 | 338,005,828 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package com.example.goalTracker.Goals;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@Service
public class GoalServiceImpl implements GoalService{
GoalRepository goalRepository;
public GoalServiceImpl(GoalRepository goalRepository){
this.goalRepository = goalRepository;
}
@Override
public void saveGoal(Goals goals) {
goalRepository.save(goals);
}
@Override
public Iterable<Goals> returnFinishedGoals(){
List<Goals> result = StreamSupport.stream(goalRepository.findAll().spliterator(), false).filter(n -> n.isFinished()).collect(Collectors.toList());
return result;
}
@Override
public void deleteGoal(Integer id){
goalRepository.deleteById(id);
}
@Override
public Goals getGoal(Integer id){
return goalRepository.findById(id).get();
}
@Override
public Iterable<Goals> returnGoals(){
return goalRepository.findAll();
}
}
| [
"[email protected]"
]
| |
c91f772f3cc8da777ef95800fc8cf9c8b309c03e | f0b891d941b8f96bd50d5fdbfd9b717ce4b9a41b | /src/com/bluegosling/reflect/model/CoreReflectionMarker.java | 32c567448694c8d91b68db68d5b7dd665d4b7541 | [
"Apache-2.0"
]
| permissive | shimaomao/bluegosling | 6ca90a847d43bc244c0605aedb7932f65c876e83 | 1cab407e8579331340f1d99d132a294b7d7520c3 | refs/heads/master | 2020-06-17T12:52:43.955586 | 2018-02-22T14:50:27 | 2018-02-22T14:50:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.bluegosling.reflect.model;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
/**
* A marker interface for implementations of {@link Element} and {@link TypeMirror} that are backed
* by core reflection.
*
* @author Joshua Humphries ([email protected])
*/
interface CoreReflectionMarker {
}
| [
"[email protected]"
]
| |
7101994065d83d86635a8967269369bbda19d612 | 6907dff5566e1e2419790724316cbe0702cb88f0 | /plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/SchemaObjectLoader.java | 520c96cdefca464e9bab9165dd94315676a4daad | [
"EPL-1.0",
"OLDAP-2.8",
"BSD-3-Clause",
"Apache-1.1",
"Apache-2.0"
]
| permissive | apache/directory-studio | 388b38d3d8793aa03adf060d1490c1a786f56375 | 2be96c08b29e5ffad7bc4bb78d75523099632c3f | refs/heads/master | 2023-09-03T07:05:39.365794 | 2023-07-26T15:37:38 | 2023-07-26T15:37:38 | 205,407 | 110 | 62 | Apache-2.0 | 2023-06-26T08:52:27 | 2009-05-20T01:52:19 | Java | UTF-8 | Java | false | false | 6,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.directory.studio.ldapbrowser.core.utils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.ObjectClass;
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
/**
* A class exposing some common methods on the schema.
*
* @author <a href="mailto:[email protected]">Apache Directory Project</a>
*/
public class SchemaObjectLoader
{
/** The browser connection */
private IBrowserConnection browserConnection;
/** The array of attributes names and OIDs */
private String[] attributeNamesAndOids;
/** The array of ObjectClasses and OIDs */
private String[] objectClassesAndOids;
/**
* An interface to allow the getSchemaObjectNamesAndOid() to be called for any schema object
*/
private interface SchemaAdder
{
/**
* Adds the schema object names and OIDs to the given set.
*
* @param schema the schema
* @param schemaObjectNamesList the schema object names list
* @param oidsList the OIDs name list
*/
void add( Schema schema, List<String> schemaObjectNamesList, List<String> oidsList );
}
/**
* Gets the array containing the objectClass names and OIDs.
*
* @return the array containing the objectClass names and OIDs
*/
public String[] getObjectClassNamesAndOids()
{
objectClassesAndOids = getSchemaObjectsAnddOids( objectClassesAndOids, new SchemaAdder()
{
@Override
public void add( Schema schema, List<String> objectClassNamesList, List<String> oidsList )
{
if ( schema != null )
{
for ( ObjectClass ocd : schema.getObjectClassDescriptions() )
{
// OID
if ( !oidsList.contains( ocd.getOid() ) )
{
oidsList.add( ocd.getOid() );
}
// Names
for ( String name : ocd.getNames() )
{
if ( !objectClassNamesList.contains( name ) )
{
objectClassNamesList.add( name );
}
}
}
}
}
});
return objectClassesAndOids;
}
/**
* Gets the array containing the attribute names and OIDs.
*
* @return the array containing the attribute names and OIDs
*/
public String[] getAttributeNamesAndOids()
{
attributeNamesAndOids = getSchemaObjectsAnddOids( attributeNamesAndOids, new SchemaAdder()
{
@Override
public void add( Schema schema, List<String> attributeNamesList, List<String> oidsList )
{
if ( schema != null )
{
for ( AttributeType atd : schema.getAttributeTypeDescriptions() )
{
// OID
if ( !oidsList.contains( atd.getOid() ) )
{
oidsList.add( atd.getOid() );
}
// Names
for ( String name : atd.getNames() )
{
if ( !attributeNamesList.contains( name ) )
{
attributeNamesList.add( name );
}
}
}
}
}
});
return attributeNamesAndOids;
}
/**
* Gets the array containing the schemaObjects and OIDs.
*
* @return the array containing the Schema objects and OIDs
*/
private String[] getSchemaObjectsAnddOids( String[] schemaObjects, SchemaAdder schemaAdder )
{
// Checking if the array has already be generated
if ( ( schemaObjects == null ) || ( schemaObjects.length == 0 ) )
{
List<String> schemaObjectNamesList = new ArrayList<String>();
List<String> oidsList = new ArrayList<String>();
if ( browserConnection == null )
{
// Getting all connections in the case where no connection is found
IBrowserConnection[] connections = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnections();
for ( IBrowserConnection connection : connections )
{
schemaAdder.add( connection.getSchema(), schemaObjectNamesList, oidsList );
}
}
else
{
// Only adding schema object names and OIDs from the associated connection
schemaAdder.add( browserConnection.getSchema(), schemaObjectNamesList, oidsList );
}
// Also adding schemaObject names and OIDs from the default schema
schemaAdder.add( Schema.DEFAULT_SCHEMA, schemaObjectNamesList, oidsList );
// Sorting the set
Collections.sort( schemaObjectNamesList );
Collections.sort( oidsList );
schemaObjects = new String[schemaObjectNamesList.size() + oidsList.size()];
System.arraycopy( schemaObjectNamesList.toArray(), 0, schemaObjects, 0, schemaObjectNamesList
.size() );
System.arraycopy( oidsList.toArray(), 0, schemaObjects, schemaObjectNamesList
.size(), oidsList.size() );
}
return schemaObjects;
}
}
| [
"[email protected]"
]
| |
829dfb79efff7fbc24ebb28cad3bfe233cb51b26 | 2afef6723dd972eee35c8ca59495a7278091b5b5 | /app/src/main/java/com/android/bignerdranch/testgit/MainActivity.java | dc70adef21f1ebc4d6bc0bee08fb139629f5ce9d | []
| no_license | Viacheslav1991/TestGit | eefe1c87d0c0309b7adb59e5f3300aa381cfae76 | 1040904bbb7fdef410544704ba32e96763af14c3 | refs/heads/master | 2021-01-09T17:52:40.343928 | 2020-02-22T20:16:51 | 2020-02-22T20:16:51 | 242,397,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.android.bignerdranch.testgit;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
]
| |
3cf43548689a479a7db5bf3881e3b8fc7b7052b9 | 4ffa4412f224cf5684a12ef1c27f30380f06de10 | /FreeCellSolitaire/src/freecell/model/hw02/OpenPile.java | cce89dbe477a3c9c9d1cdc0813cbca4d6f788c43 | []
| no_license | JWriter20/Solitaire | c0eb3713217f6298a1f4782bfb60021f428f0fca | 9e3567f9ac56f0321d0bdee5e0b14d32c7384d5f | refs/heads/main | 2023-07-15T09:51:12.099486 | 2021-08-21T03:20:25 | 2021-08-21T03:20:25 | 398,454,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | package cs3500.freecell.model.hw02;
import cs3500.freecell.model.ICard;
import java.util.Stack;
/**
* Represents a pile in the Open slot that can contain a maximum of one card.
*/
public class OpenPile extends Stack<ICard> {
@Override
public synchronized ICard pop() {
return super.pop();
}
/**
* Views the card in an OpenPile if there is one, otherwise returns null.
*
* @return the card in an OpenPile if there is one, otherwise returns null
*/
@Override
public synchronized ICard peek() {
if (isEmpty()) {
return null;
} else {
return super.peek();
}
}
/**
* Adds a card to the Openpile, or errors if you are trying to add to an already full pile.
*
* @param item The item to be added to the Openpile.
*
* @throws IllegalArgumentException If you add to an already full pile.
*
* @return The argument that was passed in.
*/
@Override
public ICard push(ICard item) throws IllegalArgumentException {
if (this.size() > 0) {
throw new IllegalArgumentException("Cannot add to a pile that already has an elem");
} else {
return super.push(item);
}
}
}
| [
"[email protected]"
]
| |
004e86a1ef97046111d808fa1f2c1d40c6fb0b6b | 4a92687bd10bd7bc77a8c59de53b3f677f5b9f1e | /assistant-tool/src/main/java/util/mybatis/comment/MethodWrapper.java | bf072ef93350c68710bddaa0c7c5300052219561 | []
| no_license | hanpang8983/assistant-tool | 3eae04b37954f8ae95a435c73cc9175fbac94916 | 92e962f4a8f6b9a91ffd477d569ce17c892054d9 | refs/heads/master | 2021-01-14T12:14:33.118940 | 2016-03-16T02:38:15 | 2016-03-16T02:54:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,486 | java | /*
* Copyright 2002-2013 the original author or 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 util.mybatis.comment;
import java.util.List;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.Method;
import org.mybatis.generator.api.dom.java.Parameter;
/**
* TODO.
*
* @author huanglicong
* @version V1.0
*/
public class MethodWrapper {
private Method method;
public MethodWrapper(Method method) {
this.method = method;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
List<Parameter> params = method.getParameters();
if (params != null) {
for (Parameter item : params) {
builder.append("\r\n* @param " + item.getName());
}
}
FullyQualifiedJavaType returnType = method.getReturnType();
if (returnType != null) {
builder.append("* @return " + returnType.getFullyQualifiedName());
}
return builder.toString();
}
}
| [
"[email protected]"
]
| |
d76160cefb1b581ae6eb6b48c1f6c979dd886f27 | 436e7c7050a1859fc856ed631427e1546c47c39d | /src/Boxes/Box_OPro.java | 2c05cbaef21f10a0857042be8aed31f051875878 | []
| no_license | YeMyintOo/UML | 684ba9d019fa0264dec10b3312827b25a1fbd5c0 | 7eb1284a764b145205967842fe7cc814ca3c1362 | refs/heads/master | 2021-01-18T21:18:58.800501 | 2016-06-14T14:27:39 | 2016-06-14T14:27:39 | 51,639,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package Boxes;
import java.io.File;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class Box_OPro extends Stage{
// New Project Box
private Button okB;
private Button closeB;
private Button resetB;
public Box_OPro(Stage owner) {
super();
setResizable(false);
initModality(Modality.WINDOW_MODAL); //Prevent click parent stage
initOwner(owner);
setTitle("Open Project");
BorderPane pane = new BorderPane();
// Button Panel
HBox btn = new HBox();
okB = new Button("Finish");
closeB = new Button("Cancel");
resetB = new Button("Reset");
File f = new File("Resources/Css/ButtonDesign.css");
okB.getStylesheets().add("file:///" + f.getAbsolutePath().replace("\\", "/"));
closeB.getStylesheets().add("file:///" + f.getAbsolutePath().replace("\\", "/"));
resetB.getStylesheets().add("file:///" + f.getAbsolutePath().replace("\\", "/"));
btn.getChildren().addAll(resetB, okB, closeB);
btn.setSpacing(4);
btn.setStyle("-fx-padding:10 10 10 10;" + "-fx-background-color:rgb(220,220,220);" + "-fx-cursor: hand;");
btn.setAlignment(Pos.BASELINE_RIGHT);
pane.setBottom(btn);
Scene scene = new Scene(pane, 400, 400, Color.WHITE);
setScene(scene);
}
}
| [
"[email protected]"
]
| |
386d4bb3c5ab44bff690f177ca341c4c25b6c6b7 | 63a38f9f708b0f8bddb781f6046d4222b63b3663 | /algo_2019_winter/_16_/BstPlusTwo.java | d54ffd7731fc7b5b7fb09c414c1156646e99810d | []
| no_license | yoonsung0711-1/BoA | dba9bba036ab84f1531b418b26efaa6d12b1a118 | e568e13ff5bf08da3c595a9ae4f4a14bd29ff1f2 | refs/heads/2019_winter | 2023-01-14T04:44:33.846778 | 2020-04-11T16:39:15 | 2020-04-12T01:33:59 | 231,178,165 | 0 | 0 | null | 2023-01-07T16:29:19 | 2020-01-01T05:15:40 | Java | UTF-8 | Java | false | false | 2,440 | java | import java.util.HashSet;
import java.util.LinkedList;
import java.util.stream.Collectors;
/*
Input:
5
/ \
3 6
/ \ \
2 4 7
Target = 9
Output: True
[5,3,6,2,4,null,7]
[]
[2]
[2, 3]
[2, 3, 4]
[2, 3, 4, 5]
[2, 3, 4, 5, 6]
[2, 3, 4, 5, 6, 7]
[2, 3] [2, 4] [2, 5] [2, 6] [2, 7]
-> 5, 6, 7, 8, 9
[3, 4] [3, 5] [3, 6] [3, 7]
-> 7, 8, 9, 10
[4, 5] [4, 6] [4, 7]
-> 9, 10, 11
[5, 6] [5, 7]
-> 11, 12
[6, 7]
-> 13
*/
public class BstPlusTwo {
LinkedList<Integer> sArr = new LinkedList<>();
LinkedList<Integer> comb = new LinkedList<>();
LinkedList<LinkedList<Integer>> snapshot = new LinkedList<>();
LinkedList<LinkedList<Integer>> combset= new LinkedList<>();
public static void main(String[] args) {
TreeNode root = new TreeNode(5);
root.left = new TreeNode(3);
root.right = new TreeNode(6);
root.left.left = new TreeNode(2);
root.left.right = new TreeNode(4);
root.right.right = new TreeNode(7);
// System.out.println("\ncomb:");
System.out.println(
new BstPlusTwo().findTarget(root, 9)
);
}
public boolean findTarget(TreeNode root, int k) {
traverse(root);
// /* log/ */System.out.println();
int n = sArr.size(); int d = 2; int start = 0;
dfs(n, d, start);
return combset.stream().map(x -> x.get(0) + x.get(1)).collect(Collectors.toCollection(HashSet::new)).contains(k);
}
private void dfs(int n, int d, int start) {
if (comb.size() == d) {
combset.add((LinkedList<Integer>) comb.clone());
// /* log/ */snapshot.add((LinkedList<Integer>) comb.clone());
// /* log/ */System.out.print(comb);
}
for (int i = start; i < n; i++) {
comb.add(sArr.get(i));
dfs(n, d, i + 1);
// if (comb.size() == d && i == n - 1) {
/*
System.out.println();
*/
// System.out.println("\n-> " + snapshot.stream().map(x -> x.get(0) + x.get(1)).map(y -> y.toString()).collect(Collectors.joining(", ")));
// snapshot.clear();
// }
comb.remove(comb.size() - 1);
}
}
public void traverse(TreeNode node) {
if (node == null) return;
traverse(node.left);
sArr.add(node.val);
// /* log/ */System.out.println(sArr);
traverse(node.right);
}
}
| [
"[email protected]"
]
| |
4ca4b99bd9fbb6d955354c042e8bfab1ce6eba41 | d47db999783097bb9ab8aa3a1415c4ba84206a88 | /app/src/main/java/com/moslemdev/kuypuasa/DataPuasa.java | bbbc849ac1e615613766653070a420d017bf2fdd | []
| no_license | alfarelzaki/KuyPuasa | 9335cfa5268773ac766db6a6a9919c294bf71a09 | dc259fc419948c454f82412c0f9fdd340c6d8c4f | refs/heads/master | 2022-03-31T03:49:40.708002 | 2019-12-16T08:42:34 | 2019-12-16T08:42:34 | 218,909,397 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package com.moslemdev.kuypuasa;
import java.util.ArrayList;
public class DataPuasa {
private static int[] tanda = {
R.drawable.mark_puasa_senin_kamis,
R.drawable.mark_puasa_ayyamul_bidh,
R.drawable.mark_puasa_arafah,
R.drawable.mark_puasa_asyura_tasua,
R.drawable.mark_puasa_ramadhan,
R.drawable.mark_haram_berpuasa,
};
private static String[] puasa = {
"Puasa Senin Kamis",
"Puasa Ayyamul Bidh",
"Puasa Arafah",
"Puasa Asyura Tasu'a",
"Puasa Ramadhan",
"Haram Berpuasa",
};
private static String[] deskripsi = {
"Puasa yang dilaksanakan setiap hari Senin dan Kamis",
"Puasa pada hari ke 13, 14, dan 15 bulan Hijriyah",
"Puasa yang dilaksanakan pada tanggal 9 Dzulhijjah",
"Puasa pada 10 Muharram dan satu hari sebelum atau sesudahnya",
"Puasa wajib umat islam pada bulan Ramadhan",
"Waktu Haram Berpuasa (Idul Fitri, Idul Adha dan Hari Tasyrik",
};
private static int[] experience = {
30,
50,
80,
80,
100,
20,
};
public static ArrayList<Puasa> getListData() {
ArrayList<Puasa> listPuasa = new ArrayList<>();
for (int i = 0; i < puasa.length; i++) {
Puasa item = new Puasa();
item.setPuasa(puasa[i]);
item.setDeskripsi(deskripsi[i]);
item.setExperience(experience[i]);
item.setTanda(tanda[i]);
listPuasa.add(item);
}
return listPuasa;
}
}
| [
"[email protected]"
]
| |
e66356835af8bf6d3e4d607e80abea136231f48d | 990df8ee6fb1c46140a9ba0bd2cef7d95bad2cbc | /src/datastructures/Lists.java | 149ff709d8b9cadf39b89bba005b6266ae547f62 | []
| no_license | rmorency40/java-developer-training | 9220bd0c64992e21cab128e9e8b18fbe50c74654 | d7809aca2f3fd948f1864154f619285b89037e4f | refs/heads/master | 2022-11-23T19:07:11.141764 | 2020-07-31T20:21:15 | 2020-07-31T20:21:15 | 278,474,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package datastructures;
import java.util.ArrayList;
public class Lists {
public static void main(String[] args) {
// 1. Crate a collection
ArrayList<String> cities = new ArrayList<String>();
// 2. add some elements
cities.add("Clevelant");
cities.add("Toronto");
cities.add("Chicago");
cities.add("Miami");
cities.add("Austin");
//3. Iterate teh collection
for (String city : cities) {
System.out.print(city + " ");
}
//4 . Get the size
int size = cities.size();
System.out.println("\n\nThere are " + size + " of elements in the collection ");
// 5 . retrive specific element
System.out.println("\n"+cities.get(4));
//5 . Remove element form the collection
cities.remove(0);
size = cities.size();
System.out.println("\n\nThere are now " + size + " of elements in the collection ");
for (String city : cities) {
System.out.println(city);
}
}
}
| [
"[email protected]"
]
| |
6873e255c02f6196151b64bdea6a485fe7c6d332 | 3c15e2e33a63e412867315953a24e60ae4e15e27 | /app_stt/app/src/main/java/com/example/sa/app_stt/MainActivity.java | 709c321048d2fce604234bd9c4abcb87231c5c4b | []
| no_license | rayee-github/android_project | 230529c36b6b87b6bb8cd0df9960f36d6ed60b55 | 8a2a7c37badc952e94470b6d7665c2619cd068c5 | refs/heads/master | 2021-10-26T02:48:34.347773 | 2019-04-10T02:32:56 | 2019-04-10T02:32:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,816 | java | package com.example.sa.app_stt;
import android.content.Intent;
import android.speech.RecognizerIntent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
Button btnDialog;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnDialog = (Button) this.findViewById(R.id.btn1);
textView = (TextView) this.findViewById(R.id.tv1);
btnDialog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//透過 Intent 的方式開啟內建的語音辨識 Activity...
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "請說話..."); //語音辨識 Dialog 上要顯示的提示文字
startActivityForResult(intent, 1);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode == RESULT_OK) {
//把所有辨識的可能結果印出來看一看,第一筆是最 match 的。
ArrayList result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String all = "";
all=result.toString();
textView.setText(all);
}
}
}
}
| [
"[email protected]"
]
| |
ff9c3bebc4d7b528512e919971884d1d73154679 | 77125f9fe31d0a2db8f1b440363d8be5ba30d54d | /rpc-register/src/main/java/com/github/houbb/rpc/register/domain/message/impl/DefaultRegisterMessage.java | 8357e9ec787b37da12595c484d044cbdce614d97 | [
"Apache-2.0"
]
| permissive | macrobussiness/rpc | 2447ee8367e85a51a1739bb4a54a00ac371a7141 | a40929fda09907743ffce4f662aa276905428f64 | refs/heads/master | 2022-12-26T01:41:55.252765 | 2019-11-08T05:54:00 | 2019-11-08T05:54:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,460 | java | package com.github.houbb.rpc.register.domain.message.impl;
import com.github.houbb.rpc.register.domain.message.RegisterMessage;
import com.github.houbb.rpc.register.domain.message.RegisterMessageHeader;
/**
* 默认注册消息
* @author binbin.hou
* @since 0.0.8
*/
class DefaultRegisterMessage implements RegisterMessage {
private static final long serialVersionUID = 3979588494064088927L;
/**
* 唯一序列号标识
* @since 0.0.8
*/
private String seqId;
/**
* 头信息
* @since 0.0.8
*/
private RegisterMessageHeader header;
/**
* 消息信息体
* @since 0.0.8
*/
private Object body;
@Override
public String seqId() {
return seqId;
}
@Override
public DefaultRegisterMessage seqId(String seqId) {
this.seqId = seqId;
return this;
}
@Override
public RegisterMessageHeader header() {
return header;
}
public DefaultRegisterMessage header(RegisterMessageHeader header) {
this.header = header;
return this;
}
@Override
public Object body() {
return body;
}
public DefaultRegisterMessage body(Object body) {
this.body = body;
return this;
}
@Override
public String toString() {
return "DefaultRegisterMessage{" +
"header=" + header +
", body=" + body +
'}';
}
}
| [
"[email protected]"
]
| |
f7f4186854b4abb5ddbed754da5d5166e7e128e2 | 9faa0b3e778c2c9fed3de4b7ccbceaaca06d8f41 | /core/src/main/java/com/netflix/msl/entityauth/PresharedKeyStore.java | 7b4cdf8fd33f2d56fa0386fd6d57f9e0151a6c1c | [
"Apache-2.0"
]
| permissive | Kryndex/msl | 0a45449373ec526f41171d867efe5c6154e44eb4 | ebd96018bd708f5bb001f49e7220377244bb0c46 | refs/heads/master | 2021-01-21T10:29:39.767050 | 2017-05-18T06:47:21 | 2017-05-18T06:47:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,930 | java | /**
* Copyright (c) 2014 Netflix, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.netflix.msl.entityauth;
import javax.crypto.SecretKey;
/**
* A preshared key store contains trusted preshared keys.
*
* @author Wesley Miaw <[email protected]>
*/
public interface PresharedKeyStore {
/**
* A set of encryption, HMAC, and wrapping keys.
*/
public static class KeySet {
/**
* Create a new key set with the given keys.
*
* @param encryptionKey the encryption key.
* @param hmacKey the HMAC key.
* @param wrappingKey the wrapping key.
*/
public KeySet(final SecretKey encryptionKey, final SecretKey hmacKey, final SecretKey wrappingKey) {
this.encryptionKey = encryptionKey;
this.hmacKey = hmacKey;
this.wrappingKey = wrappingKey;
}
/** Encryption key. */
public final SecretKey encryptionKey;
/** HMAC key. */
public final SecretKey hmacKey;
/** Wrapping key. */
public final SecretKey wrappingKey;
}
/**
* Return the encryption, HMAC, and wrapping keys for the given identity.
*
* @param identity key set identity.
* @return the keys set associated with the identity or null if not found.
*/
public KeySet getKeys(final String identity);
}
| [
"[email protected]"
]
| |
47b0362001181688ef4c6a6e15765a7d7a896754 | c9d4988bd302eb63245fa012bd493bd37f64168d | /src/structural/facade/ShippingService.java | a6fe8dec23a7e17aed07f74ff9da8115b8890444 | []
| no_license | skatesham/design-pattern-implementation | b34b04ead465dd8b2a2d5337d5b7500c09c0e727 | c877614767dabfff86fb2fa005b0a672194fe4e4 | refs/heads/master | 2020-04-15T19:57:54.923246 | 2019-01-15T20:01:48 | 2019-01-15T20:01:48 | 164,973,095 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package structural.facade;
public class ShippingService {
public static void shipProduct(final Product product) {
// Connect with external shipment service to ship product
}
}
| [
"[email protected]"
]
| |
62cef0c7e717f97ad419cd36f1b495e083b0e6dd | 97ead6dfbe1a6b569be08f7cd247161bc0a73121 | /utils/utils-api/src/main/java/com/redshape/utils/range/RangeUtils.java | beb6a23d37d56b2a00958ae4d9411af42476d3fb | [
"Apache-2.0"
]
| permissive | Redshape/Redshape-AS | 19f54bc0d54061b0302a7b3f63e600afb01168ea | cf3492919a35b868bc7045b35d38e74a3a2b8c01 | refs/heads/master | 2021-01-17T05:17:31.881177 | 2012-09-05T13:49:50 | 2012-09-05T13:49:50 | 1,390,510 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,079 | java | package com.redshape.utils.range;
import com.redshape.utils.Commons;
import com.redshape.utils.ILambda;
import com.redshape.utils.InvocationException;
import com.redshape.utils.Lambda;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* @author Cyril A. Karpenko <[email protected]>
* @package com.redshape.utils.range
* @date 8/14/11 6:37 PM
*/
public final class RangeUtils {
private static final String CHECK_INTERSECTIONS_METHOD = "checkIntersections";
private static final Map<Class<?>,Map<Class<?>, Lambda<Boolean>>> checkIntersectionsMapping
= new HashMap<Class<?>,Map<Class<?>, Lambda<Boolean>>>();
static {
checkIntersectionsMapping.put(
ListRange.class,
Commons.map(
Commons.<Class<?>, Lambda<Boolean>>pair(
ListRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
ListRange source = (ListRange) object[0];
ListRange target = (ListRange) object[1];
for ( IRange sourceSubRange : (Collection<IRange>) source.getSubRanges() ) {
for ( IRange targetSubRange : (Collection<IRange>) target.getSubRanges() ) {
if ( checkIntersections(
sourceSubRange,
targetSubRange ) ) {
return true;
}
}
}
return false;
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
SingularRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
ListRange<? extends Comparable> source = (ListRange<? extends Comparable>) object[0];
SingularRange<? extends Comparable> target = (SingularRange<? extends Comparable>) object[1];
return checkIntersections( target, source );
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
IntervalRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
ListRange source = (ListRange) object[0];
IntervalRange target = (IntervalRange) object[1];
for ( IRange subRange : (Collection<IRange>) source.getSubRanges() ) {
if ( checkIntersections( subRange, target ) ) {
return true;
}
}
return false;
}
}
)
)
);
checkIntersectionsMapping.put(
IntervalRange.class,
Commons.<Class<?>, Lambda<Boolean>>map(
Commons.<Class<?>, Lambda<Boolean>>pair(
SingularRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
assertArgumentsCount(object, 2);
return checkIntersections(
(SingularRange<? extends Comparable>) object[1],
(IntervalRange<? extends Comparable >) object[0]
);
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
ListRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
return checkIntersections( (ListRange<? extends Comparable>) object[1],
(IntervalRange<? extends Comparable>) object[0] );
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
IntervalRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
IntervalRange source = (IntervalRange) object[0];
IntervalRange target = (IntervalRange) object[1];
switch (source.getType()) {
case INCLUSIVE:
return source.getStart().compareTo(target.getEnd()) != 1
&& source.getEnd().compareTo(target.getStart()) != -1;
case EXCLUSIVE:
return source.getStart().compareTo(target.getEnd()) == -1
&& source.getEnd().compareTo(target.getStart()) == 1;
default:
throw new IllegalArgumentException("Unsupported interval range type");
}
}
}
)
)
);
checkIntersectionsMapping.put(
SingularRange.class,
Commons.<Class<?>, Lambda<Boolean>>map(
Commons.<Class<?>, Lambda<Boolean>>pair(
SingularRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
assertArgumentsCount(object, 2);
return ( (SingularRange<?>) object[0]).getValue()
.equals(((SingularRange<?>) object[1]).getValue());
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
IntervalRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
SingularRange source = (SingularRange) object[0];
IntervalRange target = (IntervalRange) object[1];
switch ( target.getType() ) {
case EXCLUSIVE:
return source.getValue().compareTo( target.getStart() ) == 1
&& source.getValue().compareTo( target.getEnd() ) == -1;
case INCLUSIVE:
return source.getValue().compareTo( target.getStart() ) != -1
&& source.getValue().compareTo( target.getEnd() ) != 1;
default:
throw new IllegalArgumentException("Unsupported interval range type");
}
}
}
),
Commons.<Class<?>, Lambda<Boolean>>pair(
ListRange.class,
new Lambda<Boolean>() {
@Override
public Boolean invoke(Object... object) throws InvocationException {
SingularRange source = (SingularRange) object[0];
ListRange target = (ListRange) object[1];
for ( IRange subRange : (Collection<IRange>) target.getSubRanges() ) {
if ( checkIntersections(source, subRange) ) {
return true;
}
}
return false;
}
}
)
)
);
}
public static <T extends Comparable<T>>
boolean checkIntersections( IRange<T> source, IRange<? extends Comparable> target ) {
if ( source.isEmpty() || target.isEmpty() ) {
return false;
}
if ( null == source || null == target ) {
throw new IllegalArgumentException("<null>");
}
Map<Class<?>, Lambda<Boolean>> mappings;
if ( null == ( mappings = checkIntersectionsMapping.get(source.getClass() ) ) ) {
throw new IllegalArgumentException("Unsupported range type "
+ target.getClass().getName() );
}
ILambda<Boolean> method;
if ( null == ( method = mappings.get( target.getClass() ) ) ) {
throw new IllegalArgumentException("Unsupported range type "
+ target.getClass().getName() );
}
try {
return method.invoke(source, target);
} catch ( Throwable e ) {
throw new RuntimeException("Unable to invoke method ", e );
}
}
}
| [
"[email protected]"
]
| |
5849f11c02f3cb0c5b30462a7747ec9051c47e5f | 42e3d47992e92af71df40ee52587d8de9454b63c | /src/main/java/com/work/mydaggarworld/doagain/GOT/House.java | ddd38373f909d1ed6a526ef4ddc3020b9db80ad1 | []
| no_license | rashel007/MyDaggarWorld | 29bd60b17bb9197d10d1d8874e6141a1c2a74337 | 5bee974331d0d3bb3c3ace862feb4c506a0bbb1e | refs/heads/master | 2020-05-30T05:19:34.738330 | 2019-07-27T06:21:21 | 2019-07-27T06:21:21 | 189,556,151 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 126 | java | package com.work.mydaggarworld.doagain.GOT;
public interface House {
void prepareForWar();
void reportForWar();
}
| [
"[email protected]"
]
| |
352f98e7c53a24b322a9d632b1a9e32221a33ec2 | d715d4ffff654a57e8c9dc668f142fb512b40bb5 | /workspace/glaf-dms/src/main/java/com/glaf/dms/mapper/DmsVolumeMapper.java | 0c1f84912a825a4b2debae6e0b3f6c221660c439 | []
| no_license | jior/isdp | c940d9e1477d74e9e0e24096f32ffb1430b841e7 | 251fe724dcce7464df53479c7a373fa43f6264ca | refs/heads/master | 2016-09-06T07:43:11.220255 | 2014-12-28T09:18:14 | 2014-12-28T09:18:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,385 | 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 com.glaf.dms.mapper;
import java.util.List;
import org.springframework.stereotype.Component;
import com.glaf.dms.domain.DmsVolume;
import com.glaf.dms.query.DmsVolumeQuery;
/**
*
* Mapper接口
*
*/
@Component
public interface DmsVolumeMapper {
void deleteDmsVolumes(DmsVolumeQuery query);
void deleteDmsVolumeById(String id);
DmsVolume getDmsVolumeById(String id);
int getDmsVolumeCount(DmsVolumeQuery query);
List<DmsVolume> getDmsVolumes(DmsVolumeQuery query);
void insertDmsVolume(DmsVolume model);
void updateDmsVolume(DmsVolume model);
}
| [
"[email protected]"
]
| |
90db77ab8d811ba75b8234c8ea37ced9f4acc624 | 5dc9b344fbaa771c61628706cc6b954628276cb1 | /watheq/app/src/main/java/com/watheq/watheq/prices/MyOrdersFragment.java | e667fbc5fe9c3123302eaec9057b0091231c9993 | []
| no_license | watheqapp/git-android | 6b83f4621197cdbc7250a920695ec31b0249eab0 | 4425a464ce14e60a9a8846df1007c25dfd4ecfaf | refs/heads/master | 2021-05-07T01:31:31.357211 | 2018-06-13T12:14:52 | 2018-06-13T12:14:52 | 110,346,917 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | package com.watheq.watheq.prices;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.View;
import android.view.ViewGroup;
import com.watheq.watheq.R;
import com.watheq.watheq.base.BaseFragment;
/**
* A simple {@link Fragment} subclass.
*/
public class MyOrdersFragment extends BaseFragment {
public static MyOrdersFragment getInstance(){
return new MyOrdersFragment();
}
@Override
public int getLayoutResource() {
return R.layout.fragment_prices;
}
@Override
public void inOnCreateView(View root, ViewGroup container, @Nullable Bundle savedInstanceState) {
//on create view
}
}
| [
"[email protected]"
]
| |
579aceb22f3eb75cff4193f030004035b8b20397 | b7341458809eb4a396b374250ab612dd3ca9bbbd | /src/main/java/org/jeecgframework/web/cgform/controller/upload/CgUploadController.java | 6e32b1ba972e3dc3c0e215982423edc2172fa953 | []
| no_license | 991576395/tukeWeb | de766f04a704ec9d044ba6d0790caf15d6581361 | 0f2a95d321e8adbb491f7ffae93c751f8ad7c67b | refs/heads/master | 2022-12-24T21:25:13.393827 | 2021-03-29T12:23:12 | 2021-03-30T12:22:36 | 157,946,787 | 1 | 0 | null | 2022-12-16T04:25:04 | 2018-11-17T03:25:20 | JavaScript | UTF-8 | Java | false | false | 11,227 | java | package org.jeecgframework.web.cgform.controller.upload;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
import org.jeecgframework.web.cgform.service.upload.CgUploadServiceI;
import org.jeecgframework.web.system.pojo.base.TSAttachment;
import org.jeecgframework.web.system.service.SystemService;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.extend.swftools.SwfToolsUtil;
import org.jeecgframework.core.util.DateUtils;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.PinyinUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
*
* @Title:CgUploadController
* @description:智能表单文件上传控制器
* @author 赵俊夫
* @date Jul 24, 2013 9:10:44 PM
* @version V1.0
*/
//@Scope("prototype")
@Controller
@RequestMapping("/cgUploadController")
public class CgUploadController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(CgUploadController.class);
@Autowired
private SystemService systemService;
@Autowired
private CgUploadServiceI cgUploadService;
/**
* 保存文件
* @param request
* @param response
* @param cgUploadEntity 智能表单文件上传实体
* @return
*/
@RequestMapping(params = "saveFiles", method = RequestMethod.POST)
@ResponseBody
public AjaxJson saveFiles(HttpServletRequest request, HttpServletResponse response, CgUploadEntity cgUploadEntity) {
AjaxJson j = new AjaxJson();
Map<String, Object> attributes = new HashMap<String, Object>();
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
String id = oConvertUtils.getString(request.getParameter("cgFormId"));//动态表主键ID
String tableName = oConvertUtils.getString(request.getParameter("cgFormName"));//动态表名
String cgField = oConvertUtils.getString(request.getParameter("cgFormField"));//动态表上传控件字段
logger.info("--cgUploadController--saveFiles--上传文件-----"+"{id:"+id+"} {tableName:"+tableName+"} {cgField:"+cgField+"}");
if(!StringUtil.isEmpty(id)){
cgUploadEntity.setCgformId(id);
cgUploadEntity.setCgformName(tableName);
cgUploadEntity.setCgformField(cgField);
}
if (StringUtil.isNotEmpty(fileKey)) {
cgUploadEntity.setId(fileKey);
cgUploadEntity = systemService.getEntity(CgUploadEntity.class, fileKey);
}
UploadFile uploadFile = new UploadFile(request, cgUploadEntity);
uploadFile.setCusPath("files");
uploadFile.setSwfpath("swfpath");
uploadFile.setByteField(null);//不存二进制内容
cgUploadEntity = systemService.uploadFile(uploadFile);
logger.info("--cgUploadController--saveFiles--上传文件----数据库保存转换成功-----");
String realPath = cgUploadEntity.getRealpath();
realPath = realPath.replace(File.separator, "/");
cgUploadService.writeBack(id, tableName, cgField, fileKey, realPath);
logger.info("--cgUploadController--saveFiles--上传文件----回写业务数据表字段文件路径-----");
attributes.put("url", realPath);
attributes.put("name", cgUploadEntity.getAttachmenttitle());
attributes.put("fileKey", cgUploadEntity.getId());
attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + cgUploadEntity.getId());
attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + cgUploadEntity.getId());
j.setMsg("操作成功");
j.setAttributes(attributes);
logger.info("--cgUploadController--saveFiles--上传文件----操作成功-----");
return j;
}
/**
* 删除文件
* @param request
* @return
*/
@RequestMapping(params = "delFile")
@ResponseBody
public AjaxJson delFile( HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
String id = request.getParameter("id");
CgUploadEntity file = systemService.getEntity(CgUploadEntity.class, id);
String sql = "select " + file.getCgformField() + " from " + file.getCgformName() + " where id = '" + file.getCgformId() + "'";
List<Object> cgformFieldResult = systemService.findListbySql(sql);
if(cgformFieldResult != null && !cgformFieldResult.isEmpty() && cgformFieldResult.get(0) != null){
String path = cgformFieldResult.get(0).toString();
String realPath = file.getRealpath();
realPath = realPath.replace(File.separator, "/");
boolean updateFlag = false;
if(path.equals(realPath)){
//获取这个关联的其他文件信息
String hql = "from CgUploadEntity where cgformId = '"+file.getCgformId()+"' "
+ " and cgformField = '"+file.getCgformField()+"' "
+ " and cgformName = '"+file.getCgformName()+"'";
List<CgUploadEntity> uploadList = systemService.findHql(hql);
if(uploadList != null && !uploadList.isEmpty() && uploadList.size() > 1){
for (CgUploadEntity cgUploadEntity : uploadList) {
if(!file.getId().equals(cgUploadEntity.getId())){
realPath = cgUploadEntity.getRealpath();
realPath = realPath.replace(File.separator, "/");
cgUploadService.writeBack(file.getCgformId(), file.getCgformName(), file.getCgformField(), file.getId(), realPath);
updateFlag = true;
break;
}
}
}
}
if(!updateFlag){
cgUploadService.writeBack(file.getCgformId(), file.getCgformName(), file.getCgformField(), file.getId(), "");
}
}
message = "" + file.getAttachmenttitle() + "被删除成功";
cgUploadService.deleteFile(file);
systemService.addLog(message, Globals.Log_Type_DEL,Globals.Log_Leavel_INFO);
j.setSuccess(true);
j.setMsg(message);
return j;
}
/**
* 自动上传保存附件资源的方式
* @return
*/
@RequestMapping(params = "ajaxSaveFile")
@ResponseBody
public AjaxJson ajaxSaveFile(MultipartHttpServletRequest request) {
AjaxJson ajaxJson = new AjaxJson();
Map<String, Object> attributes = new HashMap<String, Object>();
try {
Map<String, MultipartFile> fileMap = request.getFileMap();
String uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
// 文件数据库保存路径
String path = uploadbasepath + "/";// 文件保存在硬盘的相对路径
String realPath = request.getSession().getServletContext().getRealPath("/") + "/" + path;// 文件的硬盘真实路径
realPath += DateUtils.getDataString(DateUtils.yyyyMMdd) + "/";
path += DateUtils.getDataString(DateUtils.yyyyMMdd) + "/";
File file = new File(realPath);
if (!file.exists()) {
file.mkdirs();// 创建文件时间子目录
}
if(fileMap != null && !fileMap.isEmpty()){
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile mf = entity.getValue();// 获取上传文件对象
String fileName = mf.getOriginalFilename();// 获取文件名
String swfName = PinyinUtil.getPinYinHeadChar(oConvertUtils.replaceBlank(FileUtils.getFilePrefix(fileName)));// 取文件名首字母作为SWF文件名
String extend = FileUtils.getExtend(fileName);// 获取文件扩展名
String noextfilename=DateUtils.getDataString(DateUtils.yyyymmddhhmmss)+StringUtil.random(8);//自定义文件名称
String myfilename=noextfilename+"."+extend;//自定义文件名称
String savePath = realPath + myfilename;// 文件保存全路径
write2Disk(mf, extend, savePath);
TSAttachment attachment = new TSAttachment();
attachment.setId(UUID.randomUUID().toString().replace("-", ""));
attachment.setAttachmenttitle(fileName);
attachment.setCreatedate(new Timestamp(new Date().getTime()));
attachment.setExtend(extend);
attachment.setRealpath(path + myfilename);
attachment.setSwfpath( path + FileUtils.getFilePrefix(myfilename) + ".swf");
SwfToolsUtil.convert2SWF(savePath);
systemService.save(attachment);
attributes.put("id", attachment.getId());
attributes.put("url", path + myfilename);
attributes.put("name", fileName);
attributes.put("swfpath", attachment.getSwfpath());
}
}
ajaxJson.setAttributes(attributes);
} catch (Exception e) {
e.printStackTrace();
ajaxJson.setSuccess(false);
ajaxJson.setMsg(e.getMessage());
}
return ajaxJson;
}
/**
* 保存文件的具体操作
* @param mf
* @param extend
* @param savePath
* @throws IOException
* @throws UnsupportedEncodingException
* @throws FileNotFoundException
*/
private void write2Disk(MultipartFile mf, String extend, String savePath)
throws IOException, UnsupportedEncodingException, FileNotFoundException {
File savefile = new File(savePath);
if("txt".equals(extend)){
//利用utf-8字符集的固定首行隐藏编码原理
//Unicode:FF FE UTF-8:EF BB
byte[] allbytes = mf.getBytes();
try{
String head1 = toHexString(allbytes[0]);
String head2 = toHexString(allbytes[1]);
if("ef".equals(head1) && "bb".equals(head2)){
//UTF-8
String contents = new String(mf.getBytes(),"UTF-8");
if(StringUtils.isNotBlank(contents)){
OutputStream out = new FileOutputStream(savePath);
out.write(contents.getBytes());
out.close();
}
} else {
//GBK
String contents = new String(mf.getBytes(),"GBK");
OutputStream out = new FileOutputStream(savePath);
out.write(contents.getBytes());
out.close();
}
} catch(Exception e){
String contents = new String(mf.getBytes(),"UTF-8");
if(StringUtils.isNotBlank(contents)){
OutputStream out = new FileOutputStream(savePath);
out.write(contents.getBytes());
out.close();
}
}
} else {
FileCopyUtils.copy(mf.getBytes(), savefile);
}
}
private String toHexString(int index){
String hexString = Integer.toHexString(index);
// 1个byte变成16进制的,只需要2位就可以表示了,取后面两位,去掉前面的符号填充
hexString = hexString.substring(hexString.length() -2);
return hexString;
}
}
| [
"[email protected]"
]
| |
2199d295d9163c0efa787dc63d88d820ede10c57 | 20626ac5959668ce8ab8f9d9c92737881890e672 | /Retirement/src/application/view/inputs/ComboBoxList.java | f7a9073a7e49d570cc31b5b9f48246de87bdc489 | []
| no_license | DouglasSweeney/Retirement_v3 | 4b36c60346989aaa3e8c1b2da2d65376eb008936 | 57e33b8c551c31a694d46793099eea78a4819e3e | refs/heads/master | 2021-07-20T08:41:08.263008 | 2019-11-21T07:15:25 | 2019-11-21T07:15:25 | 223,100,059 | 0 | 1 | null | 2020-10-13T17:37:41 | 2019-11-21T06:01:36 | Java | UTF-8 | Java | false | false | 4,073 | java | package application.view.inputs;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import application.main.ExecuteObject;
public class ComboBoxList implements ActionListener {
private JComboBox<String> comboBox;
public ComboBoxList(final ComboBoxItems.ITEMS items, final String defaultValue) {
final ComboBoxItems comboBoxItems = new ComboBoxItems();
comboBox = new JComboBox<>(comboBoxItems.getItems(items));
comboBox.setEditable(true);
comboBox.setToolTipText("Select an entry from the dropdown list.");
comboBox.addActionListener(this);
final Dimension dimension = new Dimension(30, 35);
comboBox.setPreferredSize(dimension);
setValue(defaultValue);
}
@Override
public void actionPerformed(final ActionEvent e) {
final JComboBox<?> cb = (JComboBox<?>)e.getSource();
if (cb.equals(comboBox) && e.getActionCommand().equals("comboBoxChanged")) {
final Integer index = comboBox.getSelectedIndex();
if (index == -1) {
JOptionPane.showMessageDialog(null, "Invalid Number - please select from the dropdown list", null, JOptionPane.OK_OPTION);
cb.requestFocusInWindow();
}
else {
final InputsTabbedPane inputsTabbedPane = new InputsTabbedPane();
if (!inputsTabbedPane.isInitting()) {
final ExecuteObject execute = new ExecuteObject();
if (Focus.getInputsTabbedPane() != null && Focus.getResultsTabbedPane() != null) {
execute.runSimulation(Focus.getInputsTabbedPane(),
Focus.getResultsTabbedPane());
final KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.focusNextComponent();
}
}
}
}
}
public JComboBox<String> getComboBox() {
return comboBox;
}
public void setComboBox(final JComboBox<String> comboBox) {
this.comboBox = comboBox;
}
public String getValue() {
return (String)comboBox.getSelectedItem();
}
public void setValue(final String value) {
comboBox.setSelectedItem(value);
}
private static JPanel createComboBoxes() {
ComboBoxList ageComboBoxList;
ComboBoxList numberOfWithdrawalsComboBoxList;
ComboBoxList growthRateComboBoxList;
ComboBoxList meritIncreaseComboBoxList;
ComboBoxList taxRateComboBoxList;
final JPanel jPanel = new JPanel(new GridLayout(5, 2));
jPanel.add(new JLabel("Age:"));
ageComboBoxList = new ComboBoxList(ComboBoxItems.ITEMS.ITEMS_1_TO_95,"65");
jPanel.add(ageComboBoxList.getComboBox());
jPanel.add(new JLabel("Number of Withdrawals:"));
numberOfWithdrawalsComboBoxList = new ComboBoxList(ComboBoxItems.ITEMS.ITEMS_1_TO_50, "15");
jPanel.add(numberOfWithdrawalsComboBoxList.getComboBox());
jPanel.add(new JLabel("Growth Rate:"));
growthRateComboBoxList = new ComboBoxList(ComboBoxItems.ITEMS.ITEMS_1_TO_30_BY_ZERO_POINT_FIVE, "7.0");
jPanel.add(growthRateComboBoxList.getComboBox());
jPanel.add(new JLabel("Merit Increase:"));
meritIncreaseComboBoxList = new ComboBoxList(ComboBoxItems.ITEMS.ITEMS_1_TO_7_BY_ZERO_POINT_FIVE, "3.5");
jPanel.add(meritIncreaseComboBoxList.getComboBox());
jPanel.add(new JLabel("Federal Tax Rate:"));
taxRateComboBoxList = new ComboBoxList(ComboBoxItems.ITEMS.ITEMS_1_TO_50_BY_ZERO_POINT_FIVE, "20.0");
jPanel.add(taxRateComboBoxList.getComboBox());
return jPanel;
}
public static void main(final String[] args) {
final JFrame frame = new JFrame("JComboBox");
frame.add(createComboBoxes());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(380, 120); // width=380, height=120
frame.setVisible(true);
}
}
| [
"[email protected]"
]
| |
6af55e97b52806225a2d733accff71d624e16cdb | 4a6109597814ee38d8c21c057d731f224c778612 | /NdiayeMamadou/src/main/java/sn/ucad/master2soir/NdiayeMamadou/dao/NavireRepository.java | 52b35e11591200138512525bc4e8b8cb2a92411c | []
| no_license | Mounene90/NdiayeMamadou | ea2db088b031a6ee069d9a0f9ad019905708ba7e | db38e53c7740d152277272f5a2219c7489dbd94b | refs/heads/master | 2020-05-30T17:24:59.213174 | 2019-06-02T17:17:45 | 2019-06-02T17:17:45 | 189,874,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package sn.ucad.master2soir.NdiayeMamadou.dao;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import sn.ucad.master2soir.NdiayeMamadou.bo.Navire;
/**
*
* @author MAMADOU NDIAYE
*/
public interface NavireRepository extends JpaRepository<Navire, String> {
@Query("select n from Navire n where n.nomNavire like :x")
public Page<Navire> chercher(@Param("x")String mc,Pageable pageable);
}
| [
"MAMADOU NDIAYE@NDIAYE"
]
| MAMADOU NDIAYE@NDIAYE |
4ebdddf66f4d75ddd87cde3f4570719ec98734c5 | 20fbcd184e04d43fa25d200f08e8e60da5ed72a8 | /app/src/main/java/com/example/ojboba/inventoryapp/EditorActivity.java | 288d2f5214a7cb0ade2595f3d83ac780adcd8489 | []
| no_license | jatin11gidwani/Inventory_App | 77544c15ca9df8923033eb81e6bf5ff070879e21 | 835dc6a223b8eb72c022ac8d700b5ab425eabd90 | refs/heads/master | 2021-01-25T09:14:42.359283 | 2017-06-09T00:37:22 | 2017-06-09T00:37:22 | 93,803,271 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,540 | java | package com.example.ojboba.inventoryapp;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.LoaderManager;
import android.content.ContentValues;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.ojboba.inventoryapp.data.InventoryContract.InventoryEntry;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
public class EditorActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> {
private static final String LOG_TAG = EditorActivity.class.getSimpleName();
int quantity;
int inputQuantity = 0;
float calculatePrice = 0;
/** Identifier for the inventories data loader */
private static final int EXISTING_PET_LOADER = 0;
/** Content URI for the existing inventory (null if it's a new inventory) */
private Uri mCurrentProductUri;
/** EditText field to enter the product's name */
private EditText mNameEditText;
/** EditText field to enter the product's price */
private EditText mPriceEditText;
/** EditText field to enter the product's supplier */
private EditText mSupplierEditText;
/** EditText field to enter the product's quantity */
private EditText mQuantityEditText;
private TextView mAddQuantityButton;
private TextView mSubQuantityButton;
private TextView mOrderShipmentButton;
private TextView mChooseImageButton;
private TextView mQuantityTextView;
private EditText mShipmentQuantity;
private ImageView mProductImage;
private static final int SEND_MAIL_REQUEST = 1;
private static final int PICK_IMAGE_REQUEST = 1;
private Uri mUri = Uri.parse("");
String photoUri = mUri.toString();
/** Boolean flag that keeps track of whether the product has been edited (true) or not (false) */
private boolean mProductHasChanged = false;
/**
* OnTouchListener that listens for any user touches on a View, implying that they are modifying
* the view, and we change the mProductHasChanged boolean to true.
*/
private View.OnTouchListener mTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
mProductHasChanged = true;
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_editor);
// Examine the intent that was used to launch this activity,
// in order to figure out if we're creating a new product or editing an existing one.
Intent intent = getIntent();
mCurrentProductUri = intent.getData();
// If the intent DOES NOT contain a product content URI, then we know that we are
// creating a new inventory.
// This will happen when you click on the FAB button since it will not contain a URI
if (mCurrentProductUri == null) {
// This is a new inventory, so change the app bar to say "Add a product"
setTitle(getString(R.string.editor_activity_title_new_product));
// Invalidate the options menu, so the "Delete" menu option can be hidden.
// (It doesn't make sense to delete a product that hasn't been created yet.)
invalidateOptionsMenu();
} else {
// Otherwise this is an existing product, so change app bar to say "Edit the product"
setTitle(getString(R.string.editor_activity_title_edit_product));
// Initialize a loader to read the product data from the database
// and display the current values in the editor
getLoaderManager().initLoader(EXISTING_PET_LOADER, null, this);
}
// Find all relevant views that we will need to read user input from
mProductImage = (ImageView) findViewById(R.id.itemImage);
mNameEditText = (EditText) findViewById(R.id.inputName);
mPriceEditText = (EditText) findViewById(R.id.inputPrice);
mSupplierEditText = (EditText) findViewById(R.id.inputSupplier);
mQuantityEditText = (EditText) findViewById(R.id.inputQuantity);
mShipmentQuantity = (EditText) findViewById(R.id.inputShipmentQuantity);
mQuantityTextView = (TextView) findViewById(R.id.quantity_text_view);
mChooseImageButton = (TextView) findViewById(R.id.chooseImage);
mAddQuantityButton = (TextView) findViewById(R.id.addQuantity);
mSubQuantityButton = (TextView) findViewById(R.id.subQuantity);
mOrderShipmentButton = (TextView) findViewById(R.id.orderShipment);
// Setup OnTouchListeners on all the input fields, so we can determine if the user
// has touched or modified them. This will let us know if there are unsaved changes
// or not, if the user tries to leave the editor without saving.
mNameEditText.setOnTouchListener(mTouchListener);
mPriceEditText.setOnTouchListener(mTouchListener);
mSupplierEditText.setOnTouchListener(mTouchListener);
mQuantityEditText.setOnTouchListener(mTouchListener);
mChooseImageButton.setOnTouchListener(mTouchListener);
mAddQuantityButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
try{
inputQuantity = Integer.parseInt(mQuantityEditText.getText().toString());
quantity = quantity + inputQuantity;
displayQuantity(quantity);
}catch (NumberFormatException e){
mQuantityEditText.setError("Add Quantity");
}
}
});
mSubQuantityButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
try{
inputQuantity = Integer.parseInt(mQuantityEditText.getText().toString());
quantity = quantity - inputQuantity;
if (quantity < 0){
quantity = quantity + inputQuantity;
Toast.makeText(EditorActivity.this, "Quantity cannot be less than 0", Toast.LENGTH_SHORT).show();
}else{
displayQuantity(quantity);
}
}catch (NumberFormatException e){
mQuantityEditText.setError("Add Quantity");
}
}
});
mOrderShipmentButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String priceInput = mPriceEditText.getText().toString();
String nameInput = mNameEditText.getText().toString();
String supplierInput = mSupplierEditText.getText().toString();
String shipmentQuantityInput = mShipmentQuantity.getText().toString();
String uriString = mUri.toString().trim();
if(nameInput.matches("")){
mNameEditText.setError("Add Name");
}
if (priceInput.matches("")){
mPriceEditText.setError("Add Price");
}
if (supplierInput.matches("")) {
mSupplierEditText.setError("Add Supplier");
}
if (shipmentQuantityInput.matches("")){
mShipmentQuantity.setError("Add Quantity");
}
if (uriString.matches("")){
Snackbar.make(mChooseImageButton, "Image not selected", Snackbar.LENGTH_LONG)
.setAction("Select", new View.OnClickListener() {
@Override
public void onClick(View view) {
imageCode();
}
}).show();
}
if(TextUtils.isEmpty(priceInput) || TextUtils.isEmpty(nameInput) || TextUtils.isEmpty(supplierInput) || TextUtils.isEmpty(shipmentQuantityInput)) {
Toast.makeText(EditorActivity.this, "Please input all item information", Toast.LENGTH_SHORT).show();
}else{
calculatePrice = Integer.parseInt(shipmentQuantityInput) * Float.parseFloat(mPriceEditText.getText().toString());
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_SUBJECT, "Purchase Shipment for this Item :" + nameInput);
intent.putExtra(Intent.EXTRA_TEXT, createOrderSummary(mNameEditText, mShipmentQuantity, calculatePrice));
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
}
});
mChooseImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageCode();
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent resultData) {
// The ACTION_OPEN_DOCUMENT intent was sent with the request code READ_REQUEST_CODE.
// If the request code seen here doesn't match, it's the response to some other intent,
// and the below code shouldn't run at all.
if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK) {
// The document selected by the user won't be returned in the intent.
// Instead, a URI to that document will be contained in the return intent
// provided to this method as a parameter. Pull that uri using "resultData.getData()"
if (resultData != null) {
mUri = resultData.getData();
Log.i(LOG_TAG, "Uri: " + mUri.toString());
photoUri = mUri.toString();
// mTextView.setText(mUri.toString());
mProductImage.setImageBitmap(getBitmapFromUri(mUri));
}
} else if (requestCode == SEND_MAIL_REQUEST && resultCode == Activity.RESULT_OK) {
}
}
public Bitmap getBitmapFromUri(Uri uri) {
if (uri == null || uri.toString().isEmpty())
return null;
// Get the dimensions of the View
int targetW = mProductImage.getWidth();
int targetH = mProductImage.getHeight();
InputStream input = null;
try {
input = this.getContentResolver().openInputStream(uri);
// Get the dimensions of the bitmap
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
bmOptions.inJustDecodeBounds = true;
BitmapFactory.decodeStream(input, null, bmOptions);
input.close();
int photoW = bmOptions.outWidth;
int photoH = bmOptions.outHeight;
// Determine how much to scale down the image
int scaleFactor = Math.min(photoW / targetW, photoH / targetH);
// Decode the image file into a Bitmap sized to fill the View
bmOptions.inJustDecodeBounds = false;
bmOptions.inSampleSize = scaleFactor;
bmOptions.inPurgeable = true;
input = this.getContentResolver().openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(input, null, bmOptions);
input.close();
return bitmap;
} catch (FileNotFoundException fne) {
Log.e(LOG_TAG, "Failed to load image.", fne);
return null;
} catch (Exception e) {
Log.e(LOG_TAG, "Failed to load image.", e);
return null;
} finally {
try {
input.close();
} catch (IOException ioe) {
}
}
}
private void imageCode(){
Intent intent;
if (Build.VERSION.SDK_INT < 19) {
intent = new Intent(Intent.ACTION_GET_CONTENT);
} else {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
}
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
}
private String createOrderSummary(EditText name, EditText quantity, float calculatePrice){
String intentMessage = "Item Name:" + name.getText().toString();
intentMessage += "\nQuantity: " + quantity.getText().toString();
intentMessage = intentMessage + "\nTotal Cost: $" + calculatePrice;
intentMessage = intentMessage + "\nThank You!";
return intentMessage;
}
public void increment (View view){
if (quantity == 100){
// Gives error message to user
Toast.makeText(EditorActivity.this, "You can not have more than 100 items", Toast.LENGTH_SHORT).show();
// Exits method since quantity should stay at 100
return;
}
quantity = quantity +1;
displayQuantity(quantity);
}
public void decrement (View view) {
if (quantity == 0){
// Gives error message to user
Toast.makeText(EditorActivity.this, "You can not have less than 0 items", Toast.LENGTH_SHORT).show();
// Exits method since quantity should stay at 1
return;
}
quantity = quantity - 1;
displayQuantity(quantity);
}
private void displayQuantity(int number) {
mQuantityTextView.setText("" + number);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu options from the res/menu/menu_editor.xml file.
// This adds menu items to the app bar.
getMenuInflater().inflate(R.menu.menu_editor, menu);
return true;
}
/**
* This method is called after invalidateOptionsMenu(), so that the
* menu can be updated (some menu items can be hidden or made visible).
*/
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// If this is a new inventory, hide the "Delete" menu item.
if (mCurrentProductUri == null) {
MenuItem menuItem = menu.findItem(R.id.action_delete);
menuItem.setVisible(false);
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// User clicked on a menu option in the app bar overflow menu
switch (item.getItemId()) {
// Respond to a click on the "Save" menu option
case R.id.action_save:
// Save item to database
saveInventory();
// Exit activity
// finish();
return true;
// Respond to a click on the "Delete" menu option
case R.id.action_delete:
// Pop up confirmation dialog for deletion
showDeleteConfirmationDialog();
return true;
// Respond to a click on the "Up" arrow button in the app bar
case android.R.id.home:
// If the item hasn't changed, continue with navigating up to parent activity
// which is the {@link MainActivity}.
if (!mProductHasChanged) {
NavUtils.navigateUpFromSameTask(EditorActivity.this);
return true;
}
// Otherwise if there are unsaved changes, setup a dialog to warn the user.
// Create a click listener to handle the user confirming that
// changes should be discarded.
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, navigate to parent activity.
NavUtils.navigateUpFromSameTask(EditorActivity.this);
}
};
// Show a dialog that notifies the user they have unsaved changes
showUnsavedChangesDialog(discardButtonClickListener);
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* Get user input from editor and save item into database.
*/
private void saveInventory() {
// Read from input fields
// Use trim to eliminate leading or trailing white space
String nameString = mNameEditText.getText().toString().trim();
String priceString = mPriceEditText.getText().toString().trim();
String supplierString = mSupplierEditText.getText().toString().trim();
String quantityString = mQuantityTextView.getText().toString().trim();
String uriString = mUri.toString().trim();
// Check if this is supposed to be a new pet
// and check if all the fields in the editor are blank
// This code returns the code without creating a list view if nothing is entered
if (mCurrentProductUri == null &&
TextUtils.isEmpty(nameString) && TextUtils.isEmpty(priceString) &&
TextUtils.isEmpty(supplierString) && uriString.matches("") && quantityString.matches("0")) {
// Since no fields were modified, we can return early without creating a new pet.
// No need to create ContentValues and no need to do any ContentProvider operations.
finish();
return;
}
if (uriString.matches("")){
Snackbar.make(mChooseImageButton, "Image not selected", Snackbar.LENGTH_LONG)
.setAction("Select", new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent;
if (Build.VERSION.SDK_INT < 19) {
intent = new Intent(Intent.ACTION_GET_CONTENT);
} else {
intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
}
intent.setType("image/*");
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
}
}).show();
}
if (nameString.matches("")){
mNameEditText.setError("Add Name");
}
if (quantityString.matches("0")){
Toast.makeText(EditorActivity.this, "Quantity Cannot be Zero", Toast.LENGTH_SHORT).show();
}
if(priceString.matches("")){
mPriceEditText.setError("Add Price");
}
if (supplierString.matches("")) {
mSupplierEditText.setError("Add Supplier");
}
if(TextUtils.isEmpty(nameString) || TextUtils.isEmpty(priceString) || TextUtils.isEmpty(supplierString) || uriString.matches("") || quantityString.matches("0")) {
// Toast.makeText(EditorActivity.this, "Please input all item information", Toast.LENGTH_SHORT).show();
}else {
// Create a ContentValues object where column names are the keys,
// and pet attributes from the editor are the values.
ContentValues values = new ContentValues();
values.put(InventoryEntry.COLUMN_INVENTORY_NAME, nameString);
// values.put(InventoryEntry.COLUMN_INVENTORY_PRICE, priceString);
values.put(InventoryEntry.COLUMN_INVENTORY_SUPPLIER, supplierString);
// If the weight is not provided by the user, don't try to parse the string into an
// integer value. Use 0 by default.
// This also helps the app not crash because it cannot convert a blank space into an integer
float decimalPrice = Float.parseFloat(priceString);
values.put(InventoryEntry.COLUMN_INVENTORY_PRICE, decimalPrice);
values.put(InventoryEntry.COLUMN_INVENTORY_QUANTITY, quantityString);
values.put(InventoryEntry.COLUMN_INVENTORY_PHOTO, uriString);
// Determine if this is a new or existing pet by checking if mCurrentPetUri is null or not
if (mCurrentProductUri == null) {
// This is a NEW pet, so insert a new pet into the provider,
// returning the content URI for the new pet.
Uri newUri = getContentResolver().insert(InventoryEntry.CONTENT_URI, values);
// Show a toast message depending on whether or not the insertion was successful.
if (newUri == null) {
// If the new content URI is null, then there was an error with insertion.
Toast.makeText(this, getString(R.string.editor_insert_item_failed),
Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the insertion was successful and we can display a toast.
Toast.makeText(this, getString(R.string.editor_insert_item_successful),
Toast.LENGTH_SHORT).show();
}
} else {
// Otherwise this is an EXISTING pet, so update the pet with content URI: mCurrentPetUri
// and pass in the new ContentValues. Pass in null for the selection and selection args
// because mCurrentPetUri will already identify the correct row in the database that
// we want to modify.
int rowsAffected = getContentResolver().update(mCurrentProductUri, values, null, null);
// Show a toast message depending on whether or not the update was successful.
if (rowsAffected == 0) {
// If no rows were affected, then there was an error with the update.
Toast.makeText(this, getString(R.string.editor_update_item_failed),
Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the update was successful and we can display a toast.
Toast.makeText(this, getString(R.string.editor_update_item_successful),
Toast.LENGTH_SHORT).show();
}
}
finish();
}
}
/**
* This method is called when the back button is pressed.
*/
@Override
public void onBackPressed() {
// If the pet hasn't changed, continue with handling back button press
if (!mProductHasChanged) {
super.onBackPressed();
return;
}
// Otherwise if there are unsaved changes, setup a dialog to warn the user.
// Create a click listener to handle the user confirming that changes should be discarded.
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
finish();
}
};
// Show dialog that there are unsaved changes
showUnsavedChangesDialog(discardButtonClickListener);
}
private void showUnsavedChangesDialog(
DialogInterface.OnClickListener discardButtonClickListener) {
// Create an AlertDialog.Builder and set the message, and click listeners
// for the positive and negative buttons on the dialog.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.unsaved_changes_dialog_msg);
builder.setPositiveButton(R.string.discard, discardButtonClickListener);
builder.setNegativeButton(R.string.keep_editing, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Keep editing" button, so dismiss the dialog
// and continue editing the pet.
if (dialog != null) {
dialog.dismiss();
}
}
});
// Create and show the AlertDialog
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
/**
* Prompt the user to confirm that they want to delete this pet.
*/
private void showDeleteConfirmationDialog() {
// Create an AlertDialog.Builder and set the message, and click listeners
// for the positive and negative buttons on the dialog.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.delete_dialog_msg);
builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Delete" button, so delete the pet.
deletePet();
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked the "Cancel" button, so dismiss the dialog
// and continue editing the pet.
if (dialog != null) {
dialog.dismiss();
}
}
});
// Create and show the AlertDialog
AlertDialog alertDialog = builder.create();
alertDialog.show();
}
/**
* Perform the deletion of the pet in the database.
*/
private void deletePet() {
// Only perform the delete if this is an existing pet.
if (mCurrentProductUri != null) {
// Call the ContentResolver to delete the pet at the given content URI.
// Pass in null for the selection and selection args because the mCurrentPetUri
// content URI already identifies the pet that we want.
int rowsDeleted = getContentResolver().delete(mCurrentProductUri, null, null);
// Show a toast message depending on whether or not the delete was successful.
if (rowsDeleted == 0) {
// If no rows were deleted, then there was an error with the delete.
Toast.makeText(this, getString(R.string.editor_delete_item_failed),
Toast.LENGTH_SHORT).show();
} else {
// Otherwise, the delete was successful and we can display a toast.
Toast.makeText(this, getString(R.string.editor_delete_item_successful),
Toast.LENGTH_SHORT).show();
}
}
// Close the activity
finish();
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// Since the editor shows all pet attributes, define a projection that contains
// all columns from the pet table
String[] projection = {
InventoryEntry._ID,
InventoryEntry.COLUMN_INVENTORY_NAME,
InventoryEntry.COLUMN_INVENTORY_PRICE,
InventoryEntry.COLUMN_INVENTORY_SUPPLIER,
InventoryEntry.COLUMN_INVENTORY_QUANTITY,
InventoryEntry.COLUMN_INVENTORY_PHOTO,
// InventoryEntry.COLUMN_INVENTORY_SALES
};
// This loader will execute the ContentProvider's query method on a background thread
return new CursorLoader(this, // Parent activity context
mCurrentProductUri, // Query the content URI for the current pet
projection, // Columns to include in the resulting Cursor
null, // No selection clause
null, // No selection arguments
null); // Default sort order
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
// Bail early if the cursor is null or there is less than 1 row in the cursor
if (cursor == null || cursor.getCount() < 1) {
return;
}
// Proceed with moving to the first row of the cursor and reading data from it
// (This should be the only row in the cursor)
if (cursor.moveToFirst()) {
// Find the columns of pet attributes that we're interested in
int nameColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_INVENTORY_NAME);
int priceColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_INVENTORY_PRICE);
int supplierColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_INVENTORY_SUPPLIER);
int quantityColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_INVENTORY_QUANTITY);
int photoColumnIndex = cursor.getColumnIndex(InventoryEntry.COLUMN_INVENTORY_PHOTO);
// Extract out the value from the Cursor for the given column index
String name = cursor.getString(nameColumnIndex);
String supplier = cursor.getString(supplierColumnIndex);
float price = cursor.getFloat(priceColumnIndex);
int quantityNumber = cursor.getInt(quantityColumnIndex);
String currentUri = cursor.getString(photoColumnIndex);
// Update the views on the screen with the values from the database
mNameEditText.setText(name);
mSupplierEditText.setText(supplier);
mPriceEditText.setText(Float.toString(price));
mQuantityTextView.setText("" + quantityNumber);
quantity = quantityNumber;
photoUri = currentUri;
mUri = Uri.parse(photoUri);
mProductImage.setImageBitmap(getBitmapFromUri(mUri));
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
// If the loader is invalidated, clear out all the data from the input fields.
mNameEditText.setText("");
mPriceEditText.setText("");
mSupplierEditText.setText("");
mQuantityEditText.setText("");
mShipmentQuantity.setText("");
}
}
| [
"[email protected]"
]
| |
04614471eb79a49889ac4dcf6695a8293d9f03f8 | f2e9603b216e21d34f25d8f2ff38e092dc6cbcdf | /4.IoC/src/main/java/com/denglitong/beanfactory/GroovyApplicationContextTest.java | 6343e6045fe059e1ba9945638961b1d2d3c010c0 | []
| no_license | denglitong/proficient_in_4x_spring | 2da474277ca9bc7d4ea744249a3d57007b52bfa6 | d37eaac9db1fa3d167692bd9828f84ee379947f2 | refs/heads/master | 2023-06-16T07:09:12.860008 | 2021-07-11T09:02:01 | 2021-07-11T09:02:01 | 372,717,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | package com.denglitong.beanfactory;
import com.denglitong.reflect.Car;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericGroovyApplicationContext;
/**
* @author [email protected]
* @date 2021/6/3
*/
public class GroovyApplicationContextTest {
public static void main(String[] args) {
ApplicationContext ctx = new GenericGroovyApplicationContext("classpath:groovy-beans.groovy");
Car blueCar = ctx.getBean("blueCar", Car.class);
blueCar.introduce();
}
}
| [
"[email protected]"
]
| |
07b1fcd19ca06c9263fee095066610512531b2c4 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-new-fitness/results/LANG-1b-1-7-Single_Objective_GGA-IntegrationSingleObjective-BasicBlockCoverage-opt/org/apache/commons/lang3/math/NumberUtils_ESTest_scaffolding.java | 449285dc53f1993f712d5d62d569b1091c66be07 | [
"MIT",
"CC-BY-4.0"
]
| permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Oct 29 04:11:29 UTC 2021
*/
package org.apache.commons.lang3.math;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class NumberUtils_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.lang3.math.NumberUtils";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(NumberUtils_ESTest_scaffolding.class.getClassLoader() ,
"org.apache.commons.lang3.math.NumberUtils",
"org.apache.commons.lang3.StringUtils"
);
}
}
| [
"[email protected]"
]
| |
fffabaab7dd31a325fc5dffd0cb0638f63f09e6d | 17476e0163c9371e8a60b7c210018116cd700f78 | /app/src/main/java/com/games/bitworxx/engine/SplashActivity.java | 20df11df9ee1e8fc2926973c420626bf128a456e | []
| no_license | hubby1981/Engine | d41aa4b2ae249d28adb9fb78205008454252269c | 50f0fa03f0e3a2daeda9ef21ac5eb8e092cb5655 | refs/heads/master | 2021-01-10T20:22:59.860304 | 2015-08-28T10:07:40 | 2015-08-28T10:07:40 | 39,772,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.games.bitworxx.engine;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
if(MainActivity.readBuy(51)!=0)
{
findViewById(R.id.adView).setVisibility(View.INVISIBLE);
}
else
{
findViewById(R.id.adView).setVisibility(View.VISIBLE);
AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
adRequestBuilder.addTestDevice("2A399D156F5F2E0FEE7B0056DD3D0D56");
AdView view =(AdView) findViewById(R.id.adView);
AdRequest r = adRequestBuilder.build();
view.loadAd(r);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_splash, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
]
| |
9c1227cb4e258b532dba59ef0bc52714f72b2616 | 754132678372080f2d783ac0293e1a0ad5673488 | /src/test/java/nl/hu/bep/shopping/tests/ShopperTest.java | 554a515133b0e828cf5137e8eed39a39a59b6dcb | []
| no_license | anass0347/BigShopperDemo | fbdc72bbe7fedc0ef0bc7ad08b4f22bd4b3e1531 | 16782ba54faaba71feeb3ff27e403520dc94cf8b | refs/heads/main | 2023-06-02T05:59:48.842047 | 2021-06-07T16:51:19 | 2021-06-07T16:51:19 | 374,737,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 934 | java | package nl.hu.bep.shopping.tests;
import nl.hu.bep.shopping.model.Product;
import nl.hu.bep.shopping.model.Shopper;
import nl.hu.bep.shopping.model.ShoppingList;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class ShopperTest {
private Shopper p;
private ShoppingList il, al;
@BeforeEach
public void setup() {
p = new Shopper("Dum-Dum");
il = new ShoppingList("initialList", p);
al = new ShoppingList("anotherList", p);
p.addList(il);
p.addList(al);
il.addItem(new Product("Cola Zero"), 4);
il.addItem(new Product("Cola Zero"), 4);
il.addItem(new Product("Toiletpapier 6stk"), 1);
al.addItem(new Product("Paracetamol 30stk"), 3);
}
@Test
public void shouldHaveTwoLists() {
assertEquals(2, p.getAllLists().size());
}
}
| [
"66690702+github-classroom[bot]@users.noreply.github.com"
]
| 66690702+github-classroom[bot]@users.noreply.github.com |
64e1cbfbcd8fdddbfe69414603b253bb9ffd5d7f | 5c0bbc5f32202c9fa51fa30067cdd35d92f4ea1f | /src/test/java/Com/mt/pages/FlightFinderpage.java | 6fb261df0f19f478254ec2ae9df7021539f4ced3 | []
| no_license | bahakarashish/ashu | a8228549d5424e244774de51c6e3e4996dc3b505 | 2e652fe7634a9f39c9394b895e45f0e94914a5b0 | refs/heads/master | 2023-04-14T09:16:47.660711 | 2019-09-17T06:50:05 | 2019-09-17T06:50:05 | 208,979,107 | 0 | 0 | null | 2021-04-26T19:30:37 | 2019-09-17T06:45:05 | HTML | UTF-8 | Java | false | false | 1,297 | java | package Com.mt.pages;
import java.io.IOException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import Com.mt.config.Config;
import Com.mt.utility.LaunchApp;
public class FlightFinderpage
{
@FindBy(how=How.XPATH,using="//img[@src='/images/masts/mast_flightfinder.gif']")
WebElement objflightfinder;
@FindBy(how=How.LINK_TEXT,using="SIGN-OFF")
WebElement objsignoff;
public void loadFlightFinderpage()
{
PageFactory.initElements(Config.Driver, this);
}
public void verifyFlightFinderimg()
{
boolean flag=objflightfinder.isDisplayed();
System.out.println("Flight finder image is displayed");
}
public void clickonSignoff()
{
objsignoff.click();
}
public static void main(String[] args) throws IOException
{
LaunchApp lc= new LaunchApp();
lc.openBrowser("chrome");
lc.EnterApplicationURL("http://www.newtours.demoaut.com/mercurywelcome.php");
lc.maximizeBrowser();
lc.waittillLoginpageLoaded(15);
loginpage lg= new loginpage();
lg.loadLoginpage();
lg.enterUsername("Suvidyap1");
lg.enterPassword("P@ssword1");
lg.clickonLogin();
FlightFinderpage ff= new FlightFinderpage();
ff.loadFlightFinderpage();
ff.verifyFlightFinderimg();
ff.clickonSignoff();
}
}
| [
"[email protected]"
]
| |
13b39021e8a402fed72fac25508f21d4ed658e05 | 91557c8d91d94c40b1b8962dcd055d78ba68e964 | /src/java/com/arslorem/hamzah/mbs/CsSwTorCoMB.java | 8b8fb6189528bfa1cf50818c325a8542a1b5ef86 | [
"Apache-2.0"
]
| permissive | alkuhlani/cs | 6def1584877658311d13a24062437215f058ef1b | 0b66e090eae450a5e166184cf94ae636bf6bd2aa | refs/heads/master | 2020-04-21T23:37:59.464519 | 2019-02-10T07:08:01 | 2019-02-10T07:08:01 | 169,952,420 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,073 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.arslorem.hamzah.mbs;
import com.arslorem.hamzah.ejbs.CsContractBean;
import com.arslorem.hamzah.ejbs.CsSwTorCoBean;
import com.arslorem.hamzah.entities.CsContract;
import com.arslorem.hamzah.entities.CsSwTorCo;
import java.io.Serializable;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
/**
*
* @author said
*/
@Named(value = "csSwTorCoMB")
@ViewScoped
public class CsSwTorCoMB implements Serializable {
/**
* Creates a new instance of CsContractMB
*/
public CsSwTorCoMB() {
}
private CsSwTorCo item;
private List<CsSwTorCo> items;
@Inject
private CsSwTorCoBean bean;
public void prepareItems() {
items = bean.findAll();
}
public void prepareCreate() {
item = new CsSwTorCo();
}
public void prepareUpdate(Long id2) {
item = bean.find(id2);
}
public void create() {
bean.create(item);
}
public String update() {
bean.update(item);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Successfuly Updated"));
return "items?faces-redirect=true";
}
public String delete() {
bean.delete(item);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Successfuly Deleted"));
return "items?faces-redirect=true";
}
public CsSwTorCo getItem() {
return item;
}
public void setItem(CsSwTorCo item) {
this.item = item;
}
public List<CsSwTorCo> getItems() {
return items;
}
public void setItems(List<CsSwTorCo> items) {
this.items = items;
}
}
| [
"[email protected]"
]
| |
a903b1369760ae6bc8c118f16b82d292cf3a53f3 | c3aa40f242a8349571ab38e288956d6b181f836c | /src/main/java/cn/zhucongqi/proxy/Walk.java | a3aa5c476875ffa2ae9c5606a5601e670e1d0e27 | []
| no_license | LearnedHub/learning-patterns | 0a0fb0272a3ba4f23c1e712c2af2f04b1bdb1f7e | 0da6015bdac490d96e7569a0cf02ee1912b36647 | refs/heads/master | 2021-07-25T14:27:49.045759 | 2019-12-09T16:29:00 | 2019-12-09T16:29:00 | 226,298,642 | 0 | 0 | null | 2020-10-13T18:05:55 | 2019-12-06T10:00:55 | Java | UTF-8 | Java | false | false | 234 | java | package cn.zhucongqi.proxy;
/**
* @author :Jobsz
* @project :learning-patterns
* @date :Created in 2019/12/9 23:18
* @description:
* @modified By:
* @version:
*/
public interface Walk {
void to(String addr);
}
| [
"[email protected]"
]
| |
4902edb13365efe011ddd1144d358080122c0161 | cd8bc1dfa21a4cc0e353ded247e78be1874fb856 | /src/main/java/br/com/prox/repository/ApontamentoDAO.java | dd18a22fb79d39d3bb4f5d73dfba5d585883fcc6 | []
| no_license | leonardohaine/pro-x | 5de1409c41f4e4dee7ca58ddcf5f0db5b061a105 | eada79a2ca7528d87412a4403aabc7e8dae04a54 | refs/heads/master | 2021-08-24T03:53:58.448831 | 2017-12-08T00:06:04 | 2017-12-08T00:06:04 | 112,983,810 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,401 | java | package br.com.prox.repository;
import java.time.LocalTime;
import java.util.Date;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import br.com.prox.model.Apontamento;
import br.com.prox.model.AtividadeApontamento;
import br.com.prox.model.Projeto;
@Repository
public interface ApontamentoDAO extends JpaRepository<Apontamento, Long> {
@Query("select a from Apontamento a where projeto = :id")
public List<Apontamento> totalHoras(@Param("id") Projeto id);
//Busca por Projeto
public List<Apontamento> findByProjeto(Projeto id);
//Busca por projeto ou intervalo de datas
public List<Apontamento> findByProjetoAndDataBetween(Projeto id, Date dataInicial, Date dataFinal);
//Busca por atividade
public List<Apontamento> findByAtividade(AtividadeApontamento atividade);
//Busca por atividade e intervalo de datas
public List<Apontamento> findByAtividadeAndDataBetween(AtividadeApontamento atividade, Date dataInicial, Date dataFinal);
//Busca por projeto e atividade
public List<Apontamento> findByProjetoAndAtividade(Projeto id, AtividadeApontamento atividade);
//Busca por intervalo de datas
public List<Apontamento> findByDataBetween(Date dataInicial, Date dataFinal);
}
| [
"[email protected]"
]
| |
9e1ab8743ff388f39fc523b1c36d854679668164 | e322c20186561f075b25865302aa4bec976419a5 | /final_salon/src/main/java/dto/cartViewDTO.java | e293a09b8326a0adcebf822af3682370bd9991d6 | []
| no_license | SWTreeWolf/final_project | 14e173c312128c1fc15ced768460ff71c0233458 | b37e097f55e8e11378c9735d123acb7e32ee9574 | refs/heads/master | 2020-03-29T11:04:16.810986 | 2018-10-12T21:35:43 | 2018-10-12T21:35:43 | 149,834,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package dto;
import java.util.List;
public class cartViewDTO {
private int goods_code;
private String goods_name;
private String id;
private int goods_price;
private String goods_main;
////////////////////////////////////////
private List<Integer> goods_code2;
private List<Integer> cart_num;
private List<Integer> prod_count;
private List<OptionsDTO> odto;
public int getGoods_code() {
return goods_code;
}
public void setGoods_code(int goods_code) {
this.goods_code = goods_code;
}
public String getGoods_name() {
return goods_name;
}
public void setGoods_name(String goods_name) {
this.goods_name = goods_name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getGoods_price() {
return goods_price;
}
public void setGoods_price(int goods_price) {
this.goods_price = goods_price;
}
public String getGoods_main() {
return goods_main;
}
public void setGoods_main(String goods_main) {
this.goods_main = goods_main;
}
public List<Integer> getGoods_code2() {
return goods_code2;
}
public void setGoods_code2(List<Integer> goods_code2) {
this.goods_code2 = goods_code2;
}
public List<Integer> getCart_num() {
return cart_num;
}
public void setCart_num(List<Integer> cart_num) {
this.cart_num = cart_num;
}
public List<Integer> getProd_count() {
return prod_count;
}
public void setProd_count(List<Integer> prod_count) {
this.prod_count = prod_count;
}
public List<OptionsDTO> getOdto() {
return odto;
}
public void setOdto(List<OptionsDTO> odto) {
this.odto = odto;
}
}
| [
"[email protected]"
]
| |
d348a359d957dec13af44fe0743d6e95f37a4bee | c7f91277794bc0f11a7cc8e47c64071e9b1f8be9 | /imdb/src/main/java/org/training360/imdb/movies/MovieController.java | ef2925407c16bc37e3fba9a50ddc906a9b6b431a | []
| no_license | mityu85/practice-spring-boot | c1597017507724ef7fd93e3717a6156639aa9b2b | 04686f4da2c47f13fdc008d6107220daf762d88e | refs/heads/master | 2023-07-17T13:14:12.335641 | 2021-09-06T15:49:23 | 2021-09-06T15:49:23 | 401,013,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,101 | java | package org.training360.imdb.movies;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping("/api/movies")
public class MovieController {
private MovieService movieService;
public MovieController(MovieService movieService) {
this.movieService = movieService;
}
@GetMapping
public List<MovieDTO> getMoviesList() {
return movieService.getMoviesList();
}
@GetMapping("/stars")
public List<MovieDTO> getMovieByRate(@RequestParam Optional<Integer> rate) {
return movieService.getMovieByRate(rate);
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public MovieDTO createNewMovie(@Valid @RequestBody CreateMovieCommand command) {
return movieService.createNewMovie(command);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteMovieById(@PathVariable("id") Long id) {
movieService.deleteMovieById(id);
}
}
| [
"[email protected]"
]
| |
af1e340aecff682883c3930e8ce11b7a6f0e8c11 | 095cc7c4043b0de1cd5c61073a97d6bbcc8f6b1c | /src/generics/exercise13/Generators.java | 0b97f7986578179eda92b140f4a093441b1ee91c | []
| no_license | dragosbudrica/ThinkingInJava | 3c242b721b24d6a406a8da1df4ddfe6d95a0ae2a | 89dd9ec6bfd01cb0fde85190b81c2b8d858c6dba | refs/heads/master | 2020-03-30T10:17:53.992478 | 2018-10-19T13:28:17 | 2018-10-19T13:28:17 | 151,114,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,787 | java | package generics.exercise13;
import generics.Fibonacci;
import generics.coffee.*;
import java.util.*;
import net.mindview.util.*;
import java.util.ArrayList;
import java.util.Collection;
public class Generators {
public static <T> Collection<T>
fill(Collection<T> coll, Generator<T> gen, int n) {
for(int i = 0; i < n; i++)
coll.add(gen.next());
return coll;
}
public static <T> List<T>
fill(List<T> list, Generator<T> gen, int n) {
for(int i = 0; i < n; i++)
list.add(gen.next());
return list;
}
public static <T> Queue<T>
fill(Queue<T> queue, Generator<T> gen, int n) {
for(int i = 0; i < n; i++)
queue.add(gen.next());
return queue;
}
public static <T> Set<T>
fill(Set<T> set, Generator<T> gen, int n) {
for(int i = 0; i < n; i++)
set.add(gen.next());
return set;
}
// Yes, you can overload to distinguish between List and LinkedList
public static <T> LinkedList<T>
fill(LinkedList<T> coll, Generator<T> gen, int n) {
for(int i = 0; i < n; i++)
coll.add(gen.next());
return coll;
}
public static void main(String[] args) {
Collection<Coffee> coffee = fill(
new ArrayList<Coffee>(), new CoffeeGenerator(), 4);
List<Coffee> coffee2 = fill(
new ArrayList<Coffee>(), new CoffeeGenerator(), 4);
Queue<Coffee> coffee3 = fill(
new ArrayDeque<>(), new CoffeeGenerator(), 4);
Set<Coffee> coffee4 = fill(
new LinkedHashSet<>(), new CoffeeGenerator(), 4);
LinkedList<Coffee> coffee5 = fill(
new LinkedList<>(), new CoffeeGenerator(), 4);
for(Coffee c : coffee)
System.out.println(c);
System.out.println("=============================================");
for(Coffee c : coffee2)
System.out.println(c);
System.out.println("=============================================");
for(Coffee c : coffee3)
System.out.println(c);
System.out.println("=============================================");
for(Coffee c : coffee4)
System.out.println(c);
System.out.println("=============================================");
for(Coffee c : coffee5)
System.out.println(c);
System.out.println("=============================================");
Collection<Integer> fnumbers = fill(
new ArrayList<Integer>(), new Fibonacci(), 12);
List<Integer> fnumbers2 = fill(
new ArrayList<Integer>(), new Fibonacci(), 12);
Queue<Integer> fnumbers3 = fill(
new ArrayDeque<Integer>(), new Fibonacci(), 12);
Set<Integer> fnumbers4 = fill(
new LinkedHashSet<Integer>(), new Fibonacci(), 12);
LinkedList<Integer> fnumbers5 = fill(
new LinkedList<Integer>(), new Fibonacci(), 12);
for(int i : fnumbers)
System.out.print(i + ", ");
System.out.println("\n=============================================");
for(int i : fnumbers2)
System.out.print(i + ", ");
System.out.println("\n=============================================");
for(int i : fnumbers3)
System.out.print(i + ", ");
System.out.println("\n=============================================");
for(int i : fnumbers4)
System.out.print(i + ", ");
System.out.println("\n=============================================");
for(int i : fnumbers5)
System.out.print(i + ", ");
}
} | [
"[email protected]"
]
| |
b7bb52d4735d5bf2f21f87d08fca03251067d0bb | 8d0b5e750885cf278e44c41dc80e01578a971239 | /src/main/java/com/example/model/RoleBean.java | 69c8fa2de03f6a3e6e0c9516d9dad342e3d17826 | []
| no_license | liuqi368/spring-boot-demo | 2cbbe110e2dbfa873b847421bed682148047ea97 | d038abe6a5f80b85c9f9b1e330a801a236de05bf | refs/heads/master | 2022-12-16T22:45:36.242835 | 2019-12-19T12:55:30 | 2019-12-19T12:55:30 | 229,054,331 | 0 | 0 | null | 2022-09-01T23:17:34 | 2019-12-19T12:54:17 | HTML | UTF-8 | Java | false | false | 834 | java | package com.example.model;
import java.io.Serializable;
import java.util.List;
/**
* @author liuqi
* @Title: RoleBean
* @ProjectName alpay
* @Description: TODO
* @date 2019/6/415:09
*/
public class RoleBean implements Serializable {
private Integer id;
private String name;
private List<PermissionBean> permissionBeans;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public List<PermissionBean> getPermissionBeans() {
return this.permissionBeans;
}
public void setPermissionBeans(List<PermissionBean> permissionBeans) {
this.permissionBeans = permissionBeans;
}
}
| [
"[email protected]"
]
| |
5d403f55c33a6fb37c7c79ef301280a63ec19288 | 596ed7d7b5139dea6e867e4bb255344ea7c7181f | /app/src/test/java/com/example/ios_razrab/serializable/ExampleUnitTest.java | ac1ed0b59a450b9077026c17f071618023c46c39 | []
| no_license | pavel63/Serializable | e6bade6f9ac2ffea2ea5deb315526a565be9895a | 0973ebff24e9f6811014f6f9d032169608d701c7 | refs/heads/master | 2020-03-19T03:33:19.034784 | 2018-06-01T16:05:57 | 2018-06-01T16:05:57 | 135,738,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.example.ios_razrab.serializable;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
1702f8008d6f302f54ed108b7a4aaa2775746941 | d0cff0afee91e13b7b6649f329d0bc970eadcf05 | /core/src/main/java/fr/herman/wizz/mapping/Output.java | 8966f954c677c3ee55d10a4c0d999840a8f14260 | []
| no_license | garc33/wizz | c19a9e96c4c00fa6977ce5843f2700368b0c4679 | 40f990776be7dbe1eb0a9e431be26fb8fcad32ac | refs/heads/master | 2021-01-25T10:16:28.570416 | 2014-11-29T01:02:32 | 2014-11-29T01:02:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 94 | java | package fr.herman.wizz.mapping;
public interface Output<S, V> {
V getValue(S source);
}
| [
"[email protected]"
]
| |
a45232ee0252f7b47504a41c3b19686cd7eb80a2 | c6d26c7ca4c58cb36e8789a381de4293a5792c9e | /src/main/java/test/presentation/UtilityController.java | 99989fbc24d3d6ed6ce008d4a43954ff3461b1ef | []
| no_license | kasapoorna5/mvntest | 6829e756c68d17d4ff22c835dcd72d531d82607c | 7cceb22cf91d7b2d6a637f99eafa064852adf91f | refs/heads/master | 2020-03-18T06:31:27.214276 | 2018-05-22T10:49:03 | 2018-05-22T10:49:03 | 134,400,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,062 | java | package test.presentation;
import java.io.IOException;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
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.RequestPart;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import test.business.AvatarRequest;
import test.business.BusinessException;
import test.business.GenericResponseBody;
import test.business.GenericResponseBody.GenericResponseBodyState;
import test.business.UserService;
import test.business.model.Role;
import test.business.model.User;
import test.common.spring.security.AuthenticationHolder;
import test.common.utility.Utility;
@Controller
@RequestMapping("/utility")
public class UtilityController {
@Autowired
private UserService userService;
@RequestMapping(value = "/user/create", method = { RequestMethod.POST })
public String userCreate(@ModelAttribute User user) {
String originalPassword = user.getPassword();
Role userRole = new Role();
userRole.setId(Role.USER_ROLE_ID);
user.getRoles().add(userRole);
user.setActive(true);
user.setPassword(DigestUtils.md5Hex(originalPassword));
userService.create(user);
return "redirect:/login";
}
@RequestMapping(value = "/user/reset/password", method = { RequestMethod.POST })
public String userResetPassword(@ModelAttribute User user) {
String originalPassword = user.getPassword();
User persistentUser = userService.findByUsername(user.getUsername());
persistentUser.setPassword(DigestUtils.md5Hex(originalPassword));
persistentUser.setPasswordExpired(false);
userService.update(persistentUser);
return "redirect:/login";
}
@RequestMapping("/user/check/username")
public @ResponseBody GenericResponseBody userCheckUsername(@RequestParam("username") String username,
@RequestParam(value = "user_id", required = false) Long userId) {
try {
User persistentUserByUsername = userService.findByUsername(username);
if (userId != null && persistentUserByUsername.equals(userService.findByPK(userId))) {
return new GenericResponseBody(GenericResponseBodyState.SUCCESS);
}
return new GenericResponseBody(GenericResponseBodyState.ERROR);
} catch (BusinessException e) {
return new GenericResponseBody(GenericResponseBodyState.SUCCESS);
}
}
@RequestMapping("/user/check/email")
public @ResponseBody GenericResponseBody userCheckEmail(@RequestParam("email") String email,
@RequestParam(value = "user_id", required = false) Long userId) {
try {
User persistentUserByUsername = userService.findByEmail(email);
if (userId != null && persistentUserByUsername.equals(userService.findByPK(userId))) {
return new GenericResponseBody(GenericResponseBodyState.SUCCESS);
}
return new GenericResponseBody(GenericResponseBodyState.ERROR);
} catch (BusinessException e) {
return new GenericResponseBody(GenericResponseBodyState.SUCCESS);
}
}
@RequestMapping(value = "/user/avatar/show", produces = { "image/*" })
public @ResponseBody byte[] userAvatarShow() throws IOException {
User authenticatedUser = new AuthenticationHolder().getAuthenticatedUser();
User persistentUser = userService.findByPK(authenticatedUser.getId());
if (persistentUser.getPicture() == null || persistentUser.getPicture().length == 0) {
return null;
}
return persistentUser.getPicture();
}
@RequestMapping(value = "/user/avatar/update", method = RequestMethod.POST, consumes = { "multipart/form-data" })
public @ResponseBody GenericResponseBody userAvatarUpdate(@RequestPart("avatar_data") AvatarRequest avatarRequest,
@RequestPart("avatar_file") MultipartFile file) {
User authenticatedUser = new AuthenticationHolder().getAuthenticatedUser();
User persistentUser = userService.findByPK(authenticatedUser.getId());
try {
persistentUser.setPicture(Utility.cropImage(file.getBytes(), avatarRequest.getX().intValue(),
avatarRequest.getY().intValue(), avatarRequest.getWidth().intValue(),
avatarRequest.getHeight().intValue(), avatarRequest.getScaleX() == -1 ? true : false,
avatarRequest.getScaleY() == -1 ? true : false, avatarRequest.getRotate()));
} catch (BusinessException | IOException e) {
return new GenericResponseBody(GenericResponseBodyState.ERROR);
}
userService.update(persistentUser);
return new GenericResponseBody(GenericResponseBodyState.SUCCESS);
}
}
| [
"[email protected]"
]
| |
95ce48a1152f1b5b7cdca182e60e67f6d395226f | 5ede312cb538b860470423250fbd2b0dba82c671 | /src/test/java/com/tsmyk/wechatproject/WechatprojectApplicationTests.java | 241c6120a53dc00b40f024fd1d54c69eec8a3bee | []
| no_license | 76782875/wechatproject | 26c4e39eeaf7e4b374dfb533b856451b9ec83fc1 | af2681bebafe93e913a659ddc0679dd1e6ae3f23 | refs/heads/master | 2022-10-19T10:53:50.998601 | 2020-06-10T11:05:55 | 2020-06-10T11:05:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | package com.tsmyk.wechatproject;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class WechatprojectApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
9c0f668d2dbc573a6b3508a93a0081b38d4e85ef | 6b14c59fba946f80f261fcd83ac2ceba67bbecd2 | /plugin-document/src/main/java/nl/xillio/xill/plugins/mongodb/MongoExpressionIterator.java | 35e1aabaf857b3bed242541ac1157ce5e931f50a | [
"Apache-2.0"
]
| permissive | xillio/xill-platform | 30c7fcef5f0508a6875e60b9ac4ff00512fc61ab | d6315b96b9d0ce9b92f91f611042eb2a2dd9a6ff | refs/heads/master | 2022-09-15T09:38:24.601818 | 2022-08-03T14:37:29 | 2022-08-03T14:37:29 | 123,340,493 | 4 | 3 | Apache-2.0 | 2022-09-08T01:07:07 | 2018-02-28T20:46:52 | JavaScript | UTF-8 | Java | false | false | 1,782 | java | /**
* Copyright (C) 2014 Xillio ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.xillio.xill.plugins.mongodb;
import com.mongodb.MongoCursorNotFoundException;
import nl.xillio.xill.api.components.MetaExpression;
import nl.xillio.xill.api.components.MetaExpressionIterator;
import nl.xillio.xill.api.errors.RobotRuntimeException;
import java.util.Iterator;
import java.util.function.Function;
/**
* Specific iterator to iterate through MongoDB expressions
*
* @author Edward van Egdom
*/
public class MongoExpressionIterator<E> extends MetaExpressionIterator<E> {
public MongoExpressionIterator(Iterator<E> source, Function<E, MetaExpression> transformer) {
super(source, transformer);
}
@Override
public boolean hasNext() {
try {
return super.hasNext();
} catch (MongoCursorNotFoundException e) {
throw new RobotRuntimeException("Iteration failed: Mongo cursor was not found", e);
}
}
@Override
public MetaExpression next() {
try {
return super.next();
} catch (MongoCursorNotFoundException e) {
throw new RobotRuntimeException("Iteration failed: Mongo cursor was not found", e);
}
}
}
| [
"[email protected]"
]
| |
8c16c64ac0475a35773afb6707da0d4602ebf928 | 977832113151e66abe19fdfebe7d5be1a47154fd | /app/src/main/java/com/example/samrat/relax/QueryUtils.java | fc60d733642e301b45146ad93001e477e0e7e8c9 | [
"Apache-2.0"
]
| permissive | samrat19/MovieReview_with_demo_book_ticket | ac262556d1067ae0bcfff9666402f09dd6528631 | 8c1b9de990cf49b70aa9449ebff8ecfba342c077 | refs/heads/master | 2020-03-18T00:33:16.819505 | 2018-05-19T21:59:48 | 2018-05-19T21:59:48 | 134,100,751 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,035 | java | package com.example.samrat.relax;
import android.text.TextUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
public class QueryUtils {
private QueryUtils() {
}
public static List<MovieList> fetchmoviedata(String requestUrl) {
URL url = createUrl(requestUrl);
String jsonResponse = null;
try {
jsonResponse = makeHttpRequest(url);
} catch (IOException e) {
}
List<MovieList> movieLists = extractFeatureFromJson(jsonResponse);
return movieLists;
}
private static URL createUrl(String stringUrl) {
URL url = null;
try {
url = new URL(stringUrl);
} catch (MalformedURLException e) {
}
return url;
}
private static String makeHttpRequest(URL url) throws IOException {
String jsonResponse = "";
if (url == null) {
return jsonResponse;
}
HttpURLConnection urlConnection = null;
InputStream inputStream = null;
try {
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setReadTimeout(10000 /* milliseconds */);
urlConnection.setConnectTimeout(15000 /* milliseconds */);
urlConnection.setRequestMethod("GET");
urlConnection.connect();
if (urlConnection.getResponseCode() == 200) {
inputStream = urlConnection.getInputStream();
jsonResponse = readFromStream(inputStream);
} else {
}
} catch (IOException e) {
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
if (inputStream != null) {
inputStream.close();
}
}
return jsonResponse;
}
private static String readFromStream(InputStream inputStream) throws IOException {
StringBuilder output = new StringBuilder();
if (inputStream != null) {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8"));
BufferedReader reader = new BufferedReader(inputStreamReader);
String line = reader.readLine();
while (line != null) {
output.append(line);
line = reader.readLine();
}
}
return output.toString();
}
private static List<MovieList> extractFeatureFromJson(String earthquakeJSON) {
if (TextUtils.isEmpty(earthquakeJSON)) {
return null;
}
List<MovieList> movieLists = new ArrayList<>();
try {
JSONObject baseJsonResponse = new JSONObject(earthquakeJSON);
JSONArray movieArray = baseJsonResponse.getJSONArray("results");
for (int i = 0; i < movieArray.length(); i++) {
JSONObject movie = movieArray.getJSONObject(i);
// JSONObject properties = currentEarthquake.getJSONObject("properties");
String name = movie.getString("original_title");
String date=movie.getString("release_date");
int popularity = movie.getInt("vote_count");
String poster=movie.getString("poster_path");
String language=movie.getString("original_language");
double rate=movie.getDouble("vote_average");
String plot = movie.getString("overview");
MovieList movieList = new MovieList(name,date,popularity,poster,language,rate,plot);
movieLists.add(movieList);
}
} catch (JSONException e) {
}
return movieLists;
}
}
| [
"[email protected]"
]
| |
c9185cffe154a4f875cf75fccd847f65e2bbffef | dc3af1a8f12d2f0e5f335b213cf85fb904d16f75 | /cdfy/src/com/bsco/app/model/ItemApply.java | 0482dae263b72fc9e9f3d3c7218ab62d327d4e63 | []
| no_license | yezaiyong/cdfy | cee56000c6819e53b8578ace939f71ce1c164eb9 | 254fcc0fab9723e5aacded0cb946488a19b2967d | refs/heads/master | 2020-03-09T02:09:33.161202 | 2018-04-08T08:11:40 | 2018-04-08T08:11:40 | 128,533,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,035 | java | package com.bsco.app.model;
// default package
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* ItemApply entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name="item_apply"
)
public class ItemApply implements java.io.Serializable {
// Fields
private Integer applyId;
private DeputyItem deputyItem;
private String applyGard;
private Date applyDate =new Date();
private String applyBatch;
private Set<ItemApplyFiles> itemApplyFileses = new HashSet<ItemApplyFiles>(0);
// Constructors
/** default constructor */
public ItemApply() {
}
/** full constructor */
public ItemApply(DeputyItem deputyItem, String applyGard, Date applyDate, String applyBatch, Set<ItemApplyFiles> itemApplyFileses) {
this.deputyItem = deputyItem;
this.applyGard = applyGard;
this.applyDate = applyDate;
this.applyBatch = applyBatch;
this.itemApplyFileses = itemApplyFileses;
}
// Property accessors
@Id @GeneratedValue(strategy=IDENTITY)
@Column(name="APPLY_ID", unique=true, nullable=false)
public Integer getApplyId() {
return this.applyId;
}
public void setApplyId(Integer applyId) {
this.applyId = applyId;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="DEPUTY_ITEM_ID")
public DeputyItem getDeputyItem() {
return this.deputyItem;
}
public void setDeputyItem(DeputyItem deputyItem) {
this.deputyItem = deputyItem;
}
@Column(name="APPLY_GARD", length=50)
public String getApplyGard() {
return this.applyGard;
}
public void setApplyGard(String applyGard) {
this.applyGard = applyGard;
}
@Column(name="APPLY_DATE", length=19)
public Date getApplyDate() {
return this.applyDate;
}
public void setApplyDate(Date applyDate) {
this.applyDate = applyDate;
}
@Column(name="APPLY_BATCH", length=50)
public String getApplyBatch() {
return this.applyBatch;
}
public void setApplyBatch(String applyBatch) {
this.applyBatch = applyBatch;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="itemApply")
public Set<ItemApplyFiles> getItemApplyFileses() {
return this.itemApplyFileses;
}
public void setItemApplyFileses(Set<ItemApplyFiles> itemApplyFileses) {
this.itemApplyFileses = itemApplyFileses;
}
} | [
"[email protected]"
]
| |
d90a2c2337d7c224c419b95b6c49ad31602575d1 | d2153871fd35cd57c997cb30532ca3391b6531c1 | /org.smartmdsd.infrastructure/org.smartsoft.utils/src/org/smartsoft/utils/commands/DeploymentCommand.java | 4a5d8695297ad4091443049c6f97f4cd2ab76286 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
]
| permissive | ipa-nhg/SmartMDSD-Toolchain | e819425c19d96a37d780ae11350a2c2602eb4be0 | 4f6535864cbfc40b053de7100a42e85289a87696 | refs/heads/master | 2020-05-24T07:40:29.167647 | 2019-04-30T10:51:16 | 2019-04-30T10:51:16 | 187,166,004 | 0 | 1 | BSD-3-Clause | 2019-08-15T07:41:20 | 2019-05-17T07:13:34 | Java | UTF-8 | Java | false | false | 2,311 | java | //--------------------------------------------------------------------------
//
// Copyright (C) 2018 Alex Lotz
//
// [email protected]
//
// Servicerobotik Ulm
// Christian Schlegel
// University of Applied Sciences
// Prittwitzstr. 10
// 89075 Ulm
// Germany
//
// This file is part of the SmartSoft MDSD Toolchain.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//--------------------------------------------------------------------------
package org.smartsoft.utils.commands;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.IWorkbenchWindow;
public class DeploymentCommand extends AbstractBuildCommand {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final String genFolder = "smartsoft";
final String commandSuffix = "DeployAndRun";
final String commandName = "${system_path:bash}";
final String commandParams = "src-gen/deployment/deploy-all.sh";
// System.out.println("execute "+commandName);
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IProject currentProject = getCurrentProject(window);
if(currentProject == null) {
currentProject = getProjectFromDialog(window, commandSuffix);
}
if(currentProject != null) {
final boolean useBuild = false;
generateAndExecuteLauncherFor(currentProject, commandSuffix, genFolder, commandName, commandParams, useBuild);
}
return null;
}
}
| [
"[email protected]"
]
| |
625018e842245c2daf38a325d30c320da1750aba | 590f065619a7168d487eec05db0fd519cfb103b5 | /evosuite-tests/com/iluwatar/iterator/bst/BstIterator_ESTest_scaffolding.java | 0f2cff0331f3ff8710124ddb0a99480d3078a113 | []
| no_license | parthenos0908/EvoSuiteTrial | 3de131de94e8d23062ab3ba97048d01d504be1fb | 46f9eeeca7922543535737cca3f5c62d71352baf | refs/heads/master | 2023-02-17T05:00:39.572316 | 2021-01-18T00:06:01 | 2021-01-18T00:06:01 | 323,848,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,947 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Jan 11 08:43:55 GMT 2021
*/
package com.iluwatar.iterator.bst;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class BstIterator_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.iluwatar.iterator.bst.BstIterator";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "C:\\Users\\disto\\gitrepos\\EvoSuiteTrial");
java.lang.System.setProperty("java.io.tmpdir", "C:\\Users\\disto\\AppData\\Local\\Temp\\");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BstIterator_ESTest_scaffolding.class.getClassLoader() ,
"com.iluwatar.iterator.bst.TreeNode",
"com.iluwatar.iterator.Iterator",
"com.iluwatar.iterator.bst.BstIterator"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BstIterator_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.iluwatar.iterator.bst.BstIterator",
"com.iluwatar.iterator.bst.TreeNode"
);
}
}
| [
"[email protected]"
]
| |
7182aa946796a52dceb9c932079d8efd4348a5bb | a57547f60cf4db6df15d072a6a8ce7d6941f9971 | /src/com/movie/service/UserService.java | cf7d38aa0ef7a7c4b98e1c350264ed10c6bc2bba | []
| no_license | BHQMZ/Movie | f1024291b5694fe06e8084148cf1f942fa0fb5c8 | 69089511d1027f48cf73c11d2279ccc43cc2db21 | refs/heads/master | 2020-03-13T18:49:54.521725 | 2018-04-27T03:57:53 | 2018-04-27T03:57:53 | 131,243,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package com.movie.service;
import com.movie.Dao.impl.UserDaoImpl;
import com.movie.model.UserModel;
public class UserService {
public int userLogin(UserModel userModel) {
UserDaoImpl userDao = new UserDaoImpl();
return userDao.userLogin(userModel);
}
} | [
"[email protected]"
]
| |
fb4ef6ede42d5738707cc4acc87c64fa707b56ba | 35f211796a2f145dd9c2fd297669e92528911ba3 | /app/src/main/java/new10/example/com/movieshub/ItemDecorationAlbumColumns.java | 83b16f8bb94f1a40952931e4a0480f3cf15084ce | []
| no_license | minaNew10/MoviesHub | 7a5f0aae7fab9875f6b71308c5108b207a426bf3 | ed4ef860d095bc918c3e23beb3fc0e5097f9cedb | refs/heads/master | 2020-07-02T07:17:30.458460 | 2020-04-26T21:44:30 | 2020-04-26T21:44:30 | 200,353,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,100 | java | package new10.example.com.movieshub;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
public class ItemDecorationAlbumColumns extends RecyclerView.ItemDecoration {
private int mSizeGridSpacingPx;
private int mGridSize;
private boolean mNeedLeftSpacing = false;
public ItemDecorationAlbumColumns(int gridSpacingPx, int gridSize) {
mSizeGridSpacingPx = gridSpacingPx;
mGridSize = gridSize;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int frameWidth = (int) ((parent.getWidth() - (float) mSizeGridSpacingPx * (mGridSize - 1)) / mGridSize);
int padding = parent.getWidth() / mGridSize - frameWidth;
int itemPosition = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewAdapterPosition();
if (itemPosition < mGridSize) {
outRect.top = 0;
} else {
outRect.top = mSizeGridSpacingPx;
}
if (itemPosition % mGridSize == 0) {
outRect.left = 0;
outRect.right = padding;
mNeedLeftSpacing = true;
} else if ((itemPosition + 1) % mGridSize == 0) {
mNeedLeftSpacing = false;
outRect.right = 0;
outRect.left = padding;
} else if (mNeedLeftSpacing) {
mNeedLeftSpacing = false;
outRect.left = mSizeGridSpacingPx - padding;
if ((itemPosition + 2) % mGridSize == 0) {
outRect.right = mSizeGridSpacingPx - padding;
} else {
outRect.right = mSizeGridSpacingPx / 2;
}
} else if ((itemPosition + 2) % mGridSize == 0) {
mNeedLeftSpacing = false;
outRect.left = mSizeGridSpacingPx / 2;
outRect.right = mSizeGridSpacingPx - padding;
} else {
mNeedLeftSpacing = false;
outRect.left = mSizeGridSpacingPx / 2;
outRect.right = mSizeGridSpacingPx / 2;
}
outRect.bottom = 0;
}
}
| [
"[email protected]"
]
| |
04b01753b8c328f2a0c4e2518dfb6f4f03b0662e | 5d49d8027c1611f20e7c1ffdba713e1acc6c73de | /workJavaScript/src/main/java/controller/FileUploadForm2.java | a6d5c32d20a387eaeb5c029a76c8cc49efd17dc2 | []
| no_license | ansx86a/workTrunk | c30a0c25c2d30e7c4f64a466f1f4143d9aca6e52 | 70bea2a740ce93bbe5595dc7871ca8557f838272 | refs/heads/master | 2023-04-15T00:05:32.391337 | 2023-03-29T06:34:45 | 2023-03-29T06:34:45 | 53,563,304 | 0 | 0 | null | 2023-02-22T06:59:29 | 2016-03-10T07:07:54 | Java | UTF-8 | Java | false | false | 398 | java | package controller;
import org.springframework.web.multipart.MultipartFile;
public class FileUploadForm2 {
private MultipartFile myf;
private String myname;
public MultipartFile getMyf() {
return myf;
}
public void setMyf(MultipartFile myf) {
this.myf = myf;
}
public String getMyname() {
return myname;
}
public void setMyname(String myname) {
this.myname = myname;
}
}
| [
"[email protected]"
]
| |
2ad94475bfa3983a211361a426eacafc8e1fd0c4 | 39aa0dcc3431d143547f6472c204432ecccdbba0 | /messenger-platform-sdk/src/main/java/com/gerenvip/messenger/fm/exception/AccessSecretUndefinedException.java | c950bea73f6f37097097e56133443e9f232f865a | [
"Apache-2.0"
]
| permissive | gerenvip/messenger-platform-sdk | 1ddab75bf3fff27b0124d047ec58ef352aacb0aa | f261c8115d9078c09c9c9511f9df6301ece81cbd | refs/heads/master | 2020-04-25T09:01:44.841240 | 2019-02-26T08:40:36 | 2019-02-26T08:40:36 | 172,664,823 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | /*
* Copyright [2018] gerenvip
*
* 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.gerenvip.messenger.fm.exception;
public class AccessSecretUndefinedException extends RuntimeException {
}
| [
"[email protected]"
]
| |
c24901af933422c6d6d40502707a978a9b6cf25c | c9b27668a60a7e1dea7f3552bb116a9da47f43d7 | /src/test/java/com/example/activemqreceiver/ActivemqReceiverApplicationTests.java | 67f94e466ff0f95a7c1e217fa63059421bcfe69d | []
| no_license | grElena/activemq-receiver | adbfcc86b7c51575829683db8bd51bb600d08155 | f8a173608e676fd5493f5875ebffe00a37e79f09 | refs/heads/main | 2023-01-18T17:37:13.440573 | 2020-11-25T13:51:42 | 2020-11-25T13:51:42 | 315,953,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.example.activemqreceiver;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ActivemqReceiverApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
f7f5022c2bf9f3ac369608d0d84a6fcf97bcec68 | 90222b85ca0470c5faf8b5da27594dc100416de5 | /app/models/DbImage.java | 81e4047c35f1018e379c54464d0cdaa6d76aae09 | []
| no_license | OC-Git/LeanTemplate | 8745cd3d622fa4796475e5c71699c1e9ff30907c | 26e0c99809eb89998241d39fb60bb1bd62656b1e | refs/heads/master | 2021-01-22T12:08:23.027908 | 2013-04-19T15:47:43 | 2013-04-19T15:47:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,486 | java | package models;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToOne;
import play.data.validation.Constraints.Required;
import com.avaje.ebean.annotation.PrivateOwned;
@SuppressWarnings("serial")
@Entity
public class DbImage extends CrudModel<DbImage> {
public static final ModelFinder find = new ModelFinder();
@Required
private String filename;
@Required
@PrivateOwned
@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
private RawImage image;
@Required
@PrivateOwned
@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
private RawImage thumbnail;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public RawImage getImage() {
return image;
}
public void setImage(RawImage image) {
this.image = image;
}
public RawImage getThumbnail() {
return thumbnail;
}
public void setThumbnail(RawImage thumbnail) {
this.thumbnail = thumbnail;
}
@Override
public CrudFinder<DbImage> getCrudFinder() {
return find;
}
@Override
public String getLabel() {
return getFilename();
}
public static class ModelFinder extends CrudFinder<DbImage> {
public ModelFinder() {
super(new Finder<Long, DbImage>(Long.class, DbImage.class), "label");
}
public DbImage byFilename(String filename) {
return finder.where().eq("filename", filename).findUnique();
}
}
}
| [
"[email protected]"
]
| |
d38e9fad8f23debd29ea42490ec69ec3136c5b82 | 56f24db12b17f7880f9393b7b1153815cad5f8cb | /DocBlock_PatientApp/app/src/main/java/com/antailbaxt3r/docblock_patientapp/MainActivity.java | 0d97365d0381960631f2a134d43524d1bc57f206 | []
| no_license | antailbaxt3r/DocBlock_Runtim3T3rror | ab2275921eccf3396850e7af436773c4d115ddee | 3f7a6016c9cbfd7c4637261333782d5708c98512 | refs/heads/master | 2022-03-12T09:40:50.874994 | 2019-11-17T05:22:06 | 2019-11-17T05:22:06 | 222,057,463 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | package com.antailbaxt3r.docblock_patientapp;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Fresco.initialize(this);
FirebaseUser currentUser = mAuth.getInstance().getCurrentUser();
if (currentUser == null){
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}else{
Intent intent = new Intent(MainActivity.this, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
finish();
}
}
}
| [
"[email protected]"
]
| |
7de1d933134e84e287273ee910e26ad7493cfac0 | 5f2236736b19f78b49ff0067a7ed24b877b2b110 | /src/leetcode/tree/Problem_236_LowestCommonAncestor.java | 1f3bba47ccb94551834bee4a65392c5e9ba4660b | []
| no_license | nilzxq/suanfa | a22ae0d42deb1301d837ef103a60d5dd47f0d06a | ce2088148d04badded08890ce76134a70d37f7fd | refs/heads/master | 2021-07-22T12:29:13.290839 | 2021-07-08T02:57:31 | 2021-07-08T02:57:31 | 104,465,073 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,574 | java | package leetcode.tree;
/**
* 二叉树的最近公共祖先
* @Author nilzxq
* @Date 2020-08-14 9:28
*/
public class Problem_236_LowestCommonAncestor {
class TreeNode{
int val;
TreeNode left;
TreeNode right;
TreeNode(int x){
val=x;
}
}
/**
* 分情况讨论
* 结束条件 如果root为p或者q则直接返回root root==null 代表到了叶节点 直接返回即可
* 1.如果p,q在左侧 return left (right==null)也就是在左侧继续找
* 2.如果p,q在右侧 return right (left==null)也就是在右侧继续找
* 3.如果p,q异侧 直接 return root
* @param root
* @param p
* @param q
* @return
*/
public TreeNode lowestCommonAncestor(TreeNode root,TreeNode p,TreeNode q){
//当遍历到叶结点后就会返回null
if(root==null){
return root;
}
//当找到p或者q的是时候就会返回pq
/*当然,值得一提的是,如果公共祖先是自己(pq),并不需要寻找另外
一个,我们在执行前序遍历会先找上面的,后找下面的,我们会直接返回公共祖先。*/
if(root==p||root==q){
return root;
}
TreeNode left=lowestCommonAncestor(root.left,p,q);
TreeNode right=lowestCommonAncestor(root.right,p,q);
//2.
if(left==null){
return right;
}
//1.
if(right==null){
return left;
}
//3.
return root;
}
}
| [
"[email protected]"
]
| |
9f76cf7149a68d3139a473619fc390f9f652b20f | 8a930767dca3788dacd40b3cb34ecd0d79528640 | /src/main/java/com/exedosoft/plat/ui/bootstrap/form/DOResultListPopupPml.java | 56be30a6c3b3b179c4fcacf3295e473943e669a6 | []
| no_license | mamacmm/eeplat | 74c27603b8c34960ed909ce457ddab5c1dd6554f | 6757848f6d76ba3e17006d6ae1f1a79cabd27b91 | refs/heads/master | 2021-01-02T04:53:11.428932 | 2014-03-05T07:22:11 | 2014-03-05T07:22:11 | 17,425,665 | 10 | 7 | null | null | null | null | UTF-8 | Java | false | false | 7,890 | java | package com.exedosoft.plat.ui.bootstrap.form;
import java.util.Iterator;
import java.util.List;
import com.exedosoft.plat.bo.BOInstance;
import com.exedosoft.plat.bo.DOBO;
import com.exedosoft.plat.bo.DOService;
import com.exedosoft.plat.ui.DOFormModel;
import com.exedosoft.plat.ui.DOIModel;
import com.exedosoft.plat.ui.jquery.form.DOBaseForm;
import com.exedosoft.plat.ui.jquery.form.DOValueResultList;
import com.exedosoft.plat.util.DOGlobals;
import com.exedosoft.plat.util.Escape;
import com.exedosoft.plat.util.StringUtil;
public class DOResultListPopupPml extends DOBaseForm {
public DOResultListPopupPml() {
super();
}
public String getHtmlCode(DOIModel iModel) {
if(isUsingTemplate){
return super.getHtmlCode(iModel);
}
DOFormModel property = (DOFormModel) iModel;
return getPopupForm(property);
}
protected int max_pagesize = 50;
protected boolean default_data = false;
/**
* 获取动态列表形式的Select Form
*
* @param property
* TODO
* @param db
* @return
*/
String getPopupForm(DOFormModel fm) {
/**
* 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务
*/
boolean isDyn = false;
if (fm.getLinkForms() != null && !fm.getLinkForms().isEmpty()
&& fm.getInputConfig() != null) {
isDyn = true;
}
if (fm.getLinkService() == null && !isDyn) {
return " ";
}
StringBuffer buffer = new StringBuffer();
String theValue = fm.getValue();
BOInstance data = null;
if (fm.getL10n().equals("连接内容")) {
System.out.println("isDyn:::::::::::" + isDyn);
System.out.println("连接内容:::::::::::" + fm.getLinkForms());
System.out.println("fm.getInputConfig():::::::::::"
+ fm.getInputConfig());
}
if (theValue != null && !"".equals(theValue.trim())) {
DOBO corrBO = fm.getLinkBO();
if (corrBO == null && fm.getLinkService() != null) {
corrBO = fm.getLinkService().getBo();
}
/**
* 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务
*/
if (isDyn) {
DOFormModel linkFm = (DOFormModel) fm.getLinkForms().get(0);
String theLinkValue = fm.getData()
.getValue(linkFm.getColName());
if (theLinkValue != null) {
List list = StringUtil.getStaticList(fm.getInputConfig());
for (Iterator it = list.iterator(); it.hasNext();) {
String[] halfs = (String[]) it.next();
if ((theLinkValue != null && theLinkValue
.equals(halfs[0]))) {
DOService theCorrService = DOService
.getService(halfs[1]);
if (theCorrService != null) {
corrBO = theCorrService.getBo();
}
break;
}
}
}
data = DOValueResultList.getAInstance(null, corrBO, theValue);
} else {
data = DOValueResultList.getAInstance(fm, corrBO, theValue);
}
}
// if (default_data && data == null && fm.getLinkService() != null) {
// data = fm.getLinkService().getBo().getCorrInstance();
// if (data != null) {
// theValue = data.getUid();
// }
// }
buffer.append(" <div class='input-append'> <input type='hidden' class='resultlistpopup' name='")
.append(fm.getColName()).append("' id='")
.append(fm.getFullColID()).append("' serviceName='")
.append(fm.getLinkService().getName()).append("' ");
buffer.append(" title='").append(fm.getL10n().trim()).append("'");
if (theValue != null) {
buffer.append(" value='").append(theValue).append("'");
}
appendHtmlJs(buffer, fm,false);
buffer.append("/>");
buffer.append(
"<input type='text' onchange=\"if(this.value==''){this.previousSibling.value='';}\"'")
.append(" name='")
.append(fm.getFullColID()).append("_show' id='")
.append(fm.getFullColID()).append("_show' ");
buffer.append(this.appendValidateConfig(fm));
if (fm.getOnChangeJs() != null
&& !"".equals(fm.getOnChangeJs().trim())) {
buffer.append(" changejs='")
.append(Escape.unescape(fm.getOnChangeJs()))
.append("' ");
}
buffer.append(getDecoration(fm));
if (data != null) {
buffer.append(" value='").append(data.getName()).append("'");
}
// else{
// buffer.append(" value='").append(fm.getL10n())
// .append("'");
// }
if (data != null) {
buffer.append(" title='").append(data.getName()).append("'");
} else {
buffer.append(" title='").append(fm.getL10n()).append("'");
}
if (isReadOnly(fm)) {
buffer.append(" readonly='readonly' ");
}
buffer.append(" size='").append(getInputSize(fm)).append("' ");
/**
* 可变动态下拉列表, 根据连接的FORMMODEL,一般静态staticlist 确定使用的服务
*/
if (isDyn) {
DOFormModel linkFm = (DOFormModel) fm.getLinkForms().get(0);
buffer.append("linkformid='").append(linkFm.getFullColID())
.append("' inputconfig='").append(fm.getInputConfig())
.append("' ");
}
buffer.append("/>");
// 若有连接面板,则可弹出面板
if (fm.getLinkPaneModel() != null) {
// 下拉列表
buffer.append("<span class='add-on'> <img class='popupimg1' onclick=\"invokePopup(this")
.append(",'");
if (fm.getInputConstraint() != null) {
buffer.append(fm.getTargetForms());
}
buffer.append("','");
buffer.append(fm.getLinkService().getBo().getValueCol())
.append("',1,").append(max_pagesize);
if (fm.getInputConstraint() != null) {
buffer.append(",'").append(fm.getInputConstraint()).append("'");
}
buffer.append(")\" src='").append(DOGlobals.PRE_FULL_FOLDER)
.append("images/darraw.gif' align=absMiddle ");
buffer.append("/>");
// 连接面板
buffer.append("</span><span class='add-on'><img class='popupimg2' onclick=\"");
getInvokePmlJs(fm,buffer);
buffer.append("\" src='").append(DOGlobals.PRE_FULL_FOLDER)
.append("images/darraw2.gif' ");
buffer.append("/>");
} else {
buffer.append("<img class='popupimg' onclick=\"invokePopup(this")
.append(",'");
if (fm.getInputConstraint() != null) {
buffer.append(fm.getTargetForms());
}
buffer.append("','");
buffer.append(fm.getLinkService().getBo().getValueCol())
.append("',1,").append(max_pagesize);
if (fm.getInputConstraint() != null) {
buffer.append(",'").append(fm.getInputConstraint()).append("'");
}
buffer.append(")\" src='").append(DOGlobals.PRE_FULL_FOLDER)
.append("images/darraw.gif' ");
buffer.append("/>");
}
buffer.append("</span></div>");
if (fm.getNote() != null && !"".equals(fm.getNote())) {
buffer.append(fm.getNote());
}
if (fm.isNotNull()) {
buffer.append(" <font color='red'>*</font>");
}
return buffer.toString();
}
private void getInvokePmlJs(DOFormModel fm, StringBuffer buffer) {
if (fm.getLinkPaneModel() != null) {
buffer.append("invokePopupPml(this,'").append(fm.getFullColID());
buffer.append("','").append(fm.getLinkPaneModel().getName())
.append("'");
if (fm.getLinkPaneModel().getPaneWidth() != null) {
buffer.append(",'")
.append(fm.getLinkPaneModel().getPaneWidth())
.append("'");
} else {
buffer.append(",''");
}
if (fm.getLinkPaneModel().getPaneHeight() != null) {
buffer.append(",'")
.append(fm.getLinkPaneModel().getPaneHeight())
.append("'");
} else {
buffer.append(",''");
}
}
if (fm.getLinkPaneModel().getTitle() != null) {
buffer.append(",'").append(fm.getLinkPaneModel().getTitle())
.append("'");
} else {
buffer.append(",''");
}
if (fm.getGridModel() != null) {
buffer.append(",'a").append(fm.getGridModel().getObjUid())
.append("'");
} else {
buffer.append(",''");
}
if (fm.getTargetPaneModel() != null) {
buffer.append(",'").append(fm.getTargetPaneModel().getName())
.append("'");
} else {
buffer.append(",''");
}
buffer.append(")");
}
}
| [
"[email protected]"
]
| |
1e06dc9db8168c4227aacf2d109ca19c3fb87b8b | 465813c722e61ab0fb97645138ee5b6062b5fd65 | /src/test/java/com/oroboks/util/GeoCodingUtilityTest.java | 98c1141013473dcdce6415d3c38164a57e6ebb33 | []
| no_license | aditya-narain/oroboks-service | bd4a4a79559a085357ebb4b568d7d51bd82a5660 | 043adf2f9df726138f76f5b1eedc4aa556790031 | refs/heads/master | 2021-06-24T07:41:20.276357 | 2017-09-01T04:27:42 | 2017-09-01T04:27:42 | 55,564,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | package com.oroboks.util;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
/**
* Test for {@link GeoCodingUtility}
* @author Aditya Narain
*/
public class GeoCodingUtilityTest {
GeoCodingUtility utility;
/**
* Test setup for setting the default instance of {@link GeoCodingUtility}
*/
@Before
public void testSetup(){
utility = GeoCodingUtility.getInstance();
}
/**
* Ensuring to destroy singleton instance of {@link GeoCodingUtility}
*/
@After
public void destroyInstance(){
utility = null;
}
/**
* Test Google API call in {@link GeoCodingUtility} when string passed in null.
*/
@Test(expected = IllegalArgumentException.class)
public void testLocationCoordinateFromGoogleAPI_NullAddress(){
utility.getLocationCoordinatesFromGoogleAPI(null);
}
/**
*
*/
@Test(expected = IllegalArgumentException.class)
public void testLocationCoordinateFromGoogleAPI_EmptyAddress(){
utility.getLocationCoordinatesFromGoogleAPI(" ");
}
/**
*
*/
@Test(expected = IllegalArgumentException.class)
public void testZipCodeFromCoordinate_NullLocationCoordinate(){
utility.getZipCodeFromCoordinate(null);
}
@Ignore
@Test
public void testGetCoordinateLocationsFromGoogleAPI(){
utility.getLocationCoordinatesFromGoogleAPI("66213");
}
}
| [
"[email protected]"
]
| |
3c9fcf0d66a89e25c75553ba1e5a973d6d9030c9 | 277d58184aaaeb1223d4c06bc5f7c443c91ee7ef | /Seminar9/src/ro/ase/cts/proxy/clase/OperatorRezervare.java | 2dd92cceb161a32e775365dc2b23d4444278ee09 | []
| no_license | alexionpopescu/SeminarCTS | aa8f4bda69710e245ad93ef7a10268c0714aa236 | dd35d0f80ea582863f69e2d4ad1dde80aac3f74d | refs/heads/main | 2023-05-08T11:16:38.391232 | 2021-06-05T07:31:36 | 2021-06-05T07:31:36 | 342,800,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package ro.ase.cts.proxy.clase;
public class OperatorRezervare implements IOperatorRezervari{
private String numeRestaurant;
public OperatorRezervare(String numeRestaurant) {
super();
this.numeRestaurant = numeRestaurant;
}
@Override
public void rezerva(int numarPersoane) {
System.out.println("Rezervare pentru "+numarPersoane+" la restaurantul "+this.numeRestaurant);
}
}
| [
"[email protected]"
]
| |
2fcaa022bca72837da8d8953758c5990e6b512a3 | 574afb819e32be88d299835d42c067d923f177b0 | /src/net/minecraft/client/particle/ParticlePortal.java | c2151c687b6adaad8bf0143a5e529eaf9822cb53 | []
| no_license | SleepyKolosLolya/WintWare-Before-Zamorozka | 7a474afff4d72be355e7a46a38eb32376c79ee76 | 43bff58176ec7422e826eeaf3ab8e868a0552c56 | refs/heads/master | 2022-07-30T04:20:18.063917 | 2021-04-25T18:16:01 | 2021-04-25T18:16:01 | 361,502,972 | 6 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,297 | java | package net.minecraft.client.particle;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
public class ParticlePortal extends Particle {
private final float portalParticleScale;
private final double portalPosX;
private final double portalPosY;
private final double portalPosZ;
protected ParticlePortal(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn) {
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
this.posX = xCoordIn;
this.posY = yCoordIn;
this.posZ = zCoordIn;
this.portalPosX = this.posX;
this.portalPosY = this.posY;
this.portalPosZ = this.posZ;
float f = this.rand.nextFloat() * 0.6F + 0.4F;
this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F;
this.portalParticleScale = this.particleScale;
this.particleRed = f * 0.9F;
this.particleGreen = f * 0.3F;
this.particleBlue = f;
this.particleMaxAge = (int)(Math.random() * 10.0D) + 40;
this.setParticleTextureIndex((int)(Math.random() * 8.0D));
}
public void moveEntity(double x, double y, double z) {
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
this.resetPositionToBB();
}
public void renderParticle(BufferBuilder worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
f = 1.0F - f;
f *= f;
f = 1.0F - f;
this.particleScale = this.portalParticleScale * f;
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
public int getBrightnessForRender(float p_189214_1_) {
int i = super.getBrightnessForRender(p_189214_1_);
float f = (float)this.particleAge / (float)this.particleMaxAge;
f *= f;
f *= f;
int j = i & 255;
int k = i >> 16 & 255;
k += (int)(f * 15.0F * 16.0F);
if (k > 240) {
k = 240;
}
return j | k << 16;
}
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.particleAge / (float)this.particleMaxAge;
float f1 = -f + f * f * 2.0F;
float f2 = 1.0F - f1;
this.posX = this.portalPosX + this.motionX * (double)f2;
this.posY = this.portalPosY + this.motionY * (double)f2 + (double)(1.0F - f);
this.posZ = this.portalPosZ + this.motionZ * (double)f2;
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
}
}
public static class Factory implements IParticleFactory {
public Particle createParticle(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) {
return new ParticlePortal(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}
| [
"[email protected]"
]
| |
f09b43b54b1dcd90834440c11b1d9967e1b180fb | c785eb7d232d0be677fc916d4f08d2f3ca2514cf | /src/niuke/Basic.java | 389abafbba9f7feaed58ab40d267af9b73e705e9 | []
| no_license | AshelyXL/LearnJava | 21c4dabcdbeb79211457d54ee5fe57a0d66745e4 | 9a77523c751926b5976f3c13b158d2f0e535a8a7 | refs/heads/master | 2020-03-17T13:03:31.429452 | 2018-09-14T08:53:25 | 2018-09-14T08:53:25 | 133,615,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package niuke;
import java.util.*;
public class Basic {
public static void main(String[] args) {
//创建数组,必须指定数组长度
int[] a = new int[5];
a[4] = 67;
System.out.println(a[4]);
//直接初始化数组
int[] a_2 = {1,2,2,3,3,3};
//Array-->合并到-->List,
//先用Arrays.asList将数组转化成list,再调用list的方法:addAll
Integer[] b = {0,1,2,3,4,5};
List l = new ArrayList();
//List是接口,无法创建对象,因此需要使用其他类,如ArrayList
//List集合是对象的集合
l.add(2);
l.add(0,13);
//Arrays.asList对基本类型支持不好,所以前面使用的是Integer定义的数组b
System.out.println(l); //[13, 2]
l.addAll(Arrays.asList(b));
System.out.println(l); //[13, 2, 0, 1, 2, 3, 4, 5]
//List-->合并到-->Array
}
}
| [
"[email protected]"
]
| |
a1089610035b7c11a740434e821c8e9411d7b330 | bfea3a16030108abfb943d1e852365fb809ff465 | /Quiz2/src/ArrayProgram.java | 77ecac631ce9dc6740d492e57141d9f8818f4f81 | []
| no_license | DurgaPriyaKalam/308class | da023088dfc1d3658f28179eeb43c8580ef84095 | c240d485a08c2014612c555ab1c47af7bec32ed4 | refs/heads/master | 2020-03-27T16:31:46.819311 | 2018-08-30T18:50:26 | 2018-08-30T18:50:26 | 146,789,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | import java.lang.reflect.Array;
import java.util.Scanner;
public class ArrayProgram {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] a ;
int size;
System.out.println("Enter size of array");
Scanner obj = new Scanner(System.in);
size=obj.nextInt();
a=new int[size];
System.out.println("Enter the values of array");
for(int i=0;i<a.length;i++)
{
Scanner obj1 = new Scanner(System.in);
a[i]=obj1.nextInt();
}
System.out.println("Enter the number to find in array");
Scanner obj2 = new Scanner(System.in);
int number=obj2.nextInt();
int k=0;
for (int i=0;i<a.length;i++)
{
if(a[i]==number)
{
System.out.println(number + "found at location " + i);
k=1;
}
}
if(k==0)
{
System.out.println(number + " not found");
}
}
}
| [
"[email protected]"
]
| |
0ddeecdcd887e4c77de2ec88465053992e960108 | 40016d1677ea2fad8165d2fedcd541676161b4f4 | /src/com/lutao/america/model/User.java | 526b91425d7a10832ffef0c9316343b2a4a8806c | []
| no_license | MeCodepy/mxhhr | 893bac29d3c40662328cb25da86790ce0ef32013 | e7312a65fecee210597be6ec55f5f6155f1f550d | refs/heads/master | 2021-01-20T04:51:15.316285 | 2017-10-10T04:06:03 | 2017-10-11T07:13:27 | 101,389,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | java | package com.lutao.america.model;
import java.util.Date;
import com.lutao.common.utils.Cryption;
/**
* 用户
* @author liang
*
*/
public class User {
private Long id;
private String userName;
private String userCode;
private String userPwd;
private Date visitTime;
private String captcha;
public User(){
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public User(Long id, String name, String code, String pwd) {
super();
this.id = id;
this.userName = name;
this.userCode = code;
this.userPwd = pwd;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public String getUserPwd() {
return userPwd;
}
public String getUserPwdMd5(){
return Cryption.Md5(userPwd);
}
public void setUserPwd(String userPwd) {
this.userPwd = userPwd;
}
public Date getVisitTime() {
return visitTime;
}
public void setVisitTime(Date visitTime) {
this.visitTime = visitTime;
}
public String getCaptcha() {
return captcha;
}
public void setCaptcha(String captcha) {
this.captcha = captcha;
}
}
| [
"[email protected]"
]
| |
b53b9c2cdc7515499500ae1c5ce296d6f3542408 | 94deccb40db77b0fa82bec5b87a5e80b6bcd0350 | /src/main/java/programming/practise/design_pattern/facade/OldClassOne.java | c0485743b9d1267246becd515b1e124a9d5cedb7 | []
| no_license | cqupt-gsy/thinking-in-java | a5c219a8218fcf12036c739a5bcc88967d7c3b01 | e85551259c2428b0e0f62373e6eb2ba07926f868 | refs/heads/master | 2020-12-05T03:32:06.526887 | 2020-10-21T14:09:58 | 2020-10-21T14:09:58 | 66,089,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package programming.practise.design_pattern.facade;
public class OldClassOne {
public String methodCall() {
return null;
}
}
| [
"[email protected]"
]
| |
b110c7f56edd0cd1645bb68e103a2daceeb74113 | bc180e29f81626e01b3ecee283bf4d21f3739c6c | /app/src/main/java/com/m2049r/xmrwallet/service/exchange/ecb/ExchangeRateImpl.java | c02f89f70a98c29a289dcc5075c77785a17aa93c | [
"Apache-2.0"
]
| permissive | sumogr/sumo-android-wallet | 30ca71190d7b77249e9505c0d010d5193678dfab | 77f39022c0bc111796d7efec37b12c654f80d226 | refs/heads/master | 2021-07-12T02:26:34.174390 | 2020-02-26T19:35:52 | 2020-02-26T19:35:52 | 234,328,503 | 0 | 1 | Apache-2.0 | 2020-01-27T07:34:53 | 2020-01-16T13:39:57 | Java | UTF-8 | Java | false | false | 1,539 | java | /*
* Copyright (c) 2019 m2049r et al.
*
* 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.m2049r.xmrwallet.service.exchange.ecb;
import android.support.annotation.NonNull;
import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate;
import java.util.Date;
class ExchangeRateImpl implements ExchangeRate {
private final Date date;
private final String baseCurrency = "EUR";
private final String quoteCurrency;
private final double rate;
@Override
public String getServiceName() {
return "ecb.europa.eu";
}
@Override
public String getBaseCurrency() {
return baseCurrency;
}
@Override
public String getQuoteCurrency() {
return quoteCurrency;
}
@Override
public double getRate() {
return rate;
}
ExchangeRateImpl(@NonNull final String quoteCurrency, double rate, @NonNull final Date date) {
super();
this.quoteCurrency = quoteCurrency;
this.rate = rate;
this.date = date;
}
}
| [
"[email protected]"
]
| |
e6b7dd2dc632d31af3454bbd682024a143c77168 | 84e064c973c0cc0d23ce7d491d5b047314fa53e5 | /latest9.7/hej/net/sf/saxon/functions/ContextAccessorFunction.java | 329015f1bfbd620525ac6aacce49c16a04d519e9 | []
| no_license | orbeon/saxon-he | 83fedc08151405b5226839115df609375a183446 | 250c5839e31eec97c90c5c942ee2753117d5aa02 | refs/heads/master | 2022-12-30T03:30:31.383330 | 2020-10-16T15:21:05 | 2020-10-16T15:21:05 | 304,712,257 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2015 Saxonica Limited.
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
package net.sf.saxon.functions;
import net.sf.saxon.expr.XPathContext;
import net.sf.saxon.om.Function;
import net.sf.saxon.om.Sequence;
import net.sf.saxon.trans.XPathException;
/**
* A ContextAccessorFunction is a function that is dependent on the dynamic context. In the case
* of dynamic function calls, the context is bound at the point where the function is created,
* not at the point where the function is called.
*/
public abstract class ContextAccessorFunction extends SystemFunction {
/**
* Bind a context item to appear as part of the function's closure. If this method
* has been called, the supplied context item will be used in preference to the
* context item at the point where the function is actually called.
* @param context the context to which the function applies. Must not be null.
*/
public abstract Function bindContext(XPathContext context) throws XPathException;
/**
* Evaluate the expression
*
* @param context the dynamic evaluation context
* @param arguments the values of the arguments, supplied as Sequences
* @return the result of the evaluation, in the form of a Sequence
* @throws net.sf.saxon.trans.XPathException if a dynamic error occurs during the evaluation of the expression
*/
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException {
return bindContext(context).call(context, arguments);
}
}
| [
"[email protected]"
]
| |
324ad2f2903869e39d7de2e984cbc0cd9d52249a | c6da61303ea9ce1627bd5e338c586f5265aceeba | /src/main/java/com/mitocode/model/Signo.java | 6cff3aac24cf8622bc82b4c6f9adb04b05264450 | []
| no_license | cesarf283/tarea-mc-backend | bbfe2824d7433bb3ba976e92e00ce1b0e7dbae5d | 246c250530674cb4d77c8d35d84cd76cb69915f9 | refs/heads/main | 2022-12-30T09:39:02.738740 | 2020-10-19T00:59:07 | 2020-10-19T00:59:07 | 305,223,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,396 | java | package com.mitocode.model;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="signo")
public class Signo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer idSigno;
@ManyToOne // FK
@JoinColumn(name = "id_paciente", nullable = false, foreignKey = @ForeignKey(name = "FK_signo_paciente"))
private Paciente paciente;
@Column(name = "fecha", nullable = false)
private LocalDateTime fecha;
@Column(name = "temperatura", length = 100, nullable = true)
private String temperatura;
@Column(name = "pulso", length = 100, nullable = true)
private String pulso;
@Column(name = "ritmorespiratorio", length = 100, nullable = true)
private String ritmoRespiratorio;
public Integer getIdSigno() {
return idSigno;
}
public void setIdSigno(Integer idSigno) {
this.idSigno = idSigno;
}
public Paciente getPaciente() {
return paciente;
}
public void setPaciente(Paciente paciente) {
this.paciente = paciente;
}
public LocalDateTime getFecha() {
return fecha;
}
public void setFecha(LocalDateTime fecha) {
this.fecha = fecha;
}
public String getTemperatura() {
return temperatura;
}
public void setTemperatura(String temperatura) {
this.temperatura = temperatura;
}
public String getPulso() {
return pulso;
}
public void setPulso(String pulso) {
this.pulso = pulso;
}
public String getRitmoRespiratorio() {
return ritmoRespiratorio;
}
public void setRitmoRespiratorio(String ritmoRespiratorio) {
this.ritmoRespiratorio = ritmoRespiratorio;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((idSigno == null) ? 0 : idSigno.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Signo other = (Signo) obj;
if (idSigno == null) {
if (other.idSigno != null)
return false;
} else if (!idSigno.equals(other.idSigno))
return false;
return true;
}
}
| [
"[email protected]"
]
| |
3efa286e9caaa198d88aff1c3dc3295dd90ee41a | c648cb650eee67f951ece9b2ed70770ba86877d2 | /src/main/java/com/watchdata/common/netty/coder/TlsDecoder.java | 57165c72c74c9f26773fd06774a31fce69986067 | []
| no_license | huakaibai/nettytest | 4938a0728279233f9c55cc509050e3d4ff8537b8 | 1e99f7efa10abb19e2ed9538496aa8c5603b2bb3 | refs/heads/TLSRefect | 2020-04-11T21:08:57.953933 | 2020-01-03T08:09:10 | 2020-01-03T08:09:10 | 162,096,421 | 0 | 0 | null | 2020-01-08T13:49:11 | 2018-12-17T08:12:44 | Java | UTF-8 | Java | false | false | 6,579 | java | package com.watchdata.common.netty.coder;
import com.watchdata.common.ClietnHello;
import com.watchdata.common.ConstantValue;
import com.watchdata.common.TlsMessage;
import com.watchdata.common.netty.bean.BaseTls;
import com.watchdata.common.util.StringUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author zhibin.wang
* @create 2018-12-19 15:03
* @desc
**/
@Component
@ChannelHandler.Sharable
public class TlsDecoder extends MessageToMessageDecoder<ByteBuf> {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
/**
* *****************************************************************
* |protol|major version|minor version|length|type| 所有TLS数据都是这样的 *
* 16 03 03 01 clientHello *
* 16 03 03 10 clientKeyExchange *
* 16 03 03 0050 clientFinshed *
* 14 03 03 ChangerCipherSpec *
* 15 03 03 alert *
* 17 03 03 dataExchange *
*********************************************************************
*
*/
System.out.println(Thread.currentThread().getName()+"decoder");
// 可读长度必须大于基本长度
if (in.readableBytes() <= 5) {
return;
}
//防止字节流攻击
if (in.readableBytes() > 2048) {
in.skipBytes(in.readableBytes());
}
byte[] head = new byte[3];
//记录包头开始的index
int beginReader;
while (true) {
beginReader = in.readerIndex();
in.markReaderIndex();
in.readBytes(head);
//是正确的TLS头
if (isHead(head)) {
break;
}
in.resetReaderIndex(); //跳转到开头
in.readByte();//略过一个字节
if (in.readableBytes() <= 5) {
return;
}
}
/* in.markReaderIndex();
byte[] req = new byte[in.readableBytes()];
in.readBytes(req);
System.out.println(StringUtil.byte2hex(req));
System.out.println(req.length);
in.resetReaderIndex();*/
byte[] lengthByte = new byte[2];
in.readBytes(lengthByte);
String hexLength = StringUtil.byte2hex(lengthByte);
Integer intLength = Integer.valueOf(hexLength, 16);
if (in.readableBytes() < intLength) {
in.readerIndex(beginReader);
return;
}
// 是否是0x16开头
if (head[0] == 0x16) {
byte type = in.readByte();
//封装clientHello
if (isClientHello(head, type)) {
ClietnHello clietnHello = new ClietnHello();
clietnHello.setHead(head);
clietnHello.setLength(lengthByte);
clietnHello.setHanddshakeType(type);
byte[] length2Byte = new byte[3];
in.readBytes(length2Byte);
clietnHello.setLength2(length2Byte);
/* String hexLength2 = StringUtil.byte2hex(length2Byte);
if(in.readableBytes() < Integer.valueOf(hexLength2,16)){
in.resetReaderIndex();
return;
}
*/
clietnHello.setMajor_version(in.readByte());
clietnHello.setMinor_version(in.readByte());
byte[] randomByte = new byte[32];
in.readBytes(randomByte);
clietnHello.setRandomValue(randomByte);
clietnHello.setSessionIdLength(in.readByte());
byte[] cipherSuiteLength = new byte[2];
in.readBytes(cipherSuiteLength);
clietnHello.setCipherSuiteLength(cipherSuiteLength);
String hexCiperSuiteLength = StringUtil.byte2hex(cipherSuiteLength);
byte[] ciperSuite = new byte[Integer.valueOf(hexCiperSuiteLength, 16)];
in.readBytes(ciperSuite);
clietnHello.setCipherSuite(ciperSuite);
byte[] compressionByte = new byte[9];
in.readBytes(compressionByte);
clietnHello.setCompression(compressionByte);
BaseTls baseTls = new BaseTls();
baseTls.setType(ConstantValue.CLIENT_HELLO);
baseTls.setObject(clietnHello);
out.add(baseTls);
}
} else if (isDataExchange(head)) {
TlsMessage tlsMessage = new TlsMessage();
tlsMessage.setHead(head);
tlsMessage.setLength(lengthByte);
byte[] data = new byte[intLength];
in.readBytes(data);
tlsMessage.setData(data);
BaseTls baseTls = new BaseTls();
baseTls.setType(ConstantValue.TLS_MESSAGE);
baseTls.setObject(tlsMessage);
out.add(baseTls);
}
}
private boolean isHead(byte[] head) {
if (!(head[0] == 0x17 || head[0] == 0x16 || head[0] == 0x15 || head[0] == 0x14)) {
return false;
}
if (head[1] != 0x03)
return false;
if (head[2] != 0x03)
return false;
return true;
}
private boolean isClientHello(byte[] head, byte type) {
if (head[0] == 0x16 && type == 0x01)
return true;
return false;
}
private boolean isClientKeyExchange(byte[] head, byte type) {
if (head[0] == 0x16 && type == 0x10)
return true;
return false;
}
private boolean isClientFinshed(byte[] head, byte[] length) {
if (head[0] == 0x16 && length[1] == 0x50) {
return true;
}
return false;
}
private boolean isChangerCipherSpec(byte[] head) {
if (head[0] == 0x14)
return true;
return false;
}
private boolean isAlert(byte[] head) {
if (head[0] == 0x15)
return true;
return false;
}
private boolean isDataExchange(byte[] head) {
if (head[0] == 0x17)
return true;
return false;
}
}
| [
"[email protected]"
]
| |
d4d8a3a932979db402c75d0ecc67b479d1e45a22 | 170d17c3f77bf2b0231442491348b33c68df9ae7 | /Inscription/src/com/objs/demojdbc/DemoJdbc.java | 4d211723acaf30e24adaac6e934d29b11f5478c1 | []
| no_license | Bontino/inscriptions | 23173059130b37f0624328afee0b9616fbc00f13 | 8d2c8dfe418fe1a7ed7f21f9014c901b1efebc0c | refs/heads/master | 2020-06-17T16:25:55.879965 | 2017-04-26T12:21:44 | 2017-04-26T12:21:44 | 74,988,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.objs.demojdbc;
public class DemoJdbc {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
]
| |
6e88cc3e1e83d1e2bc8e9abb8fbbae65d59a25fd | 0ab32554deec7062417d77641f5e82d342f364c3 | /AlgorithmPrograms/src/com/bridgeit/programs/Question5.java | 8edba9c3e0509a097e954bc8062077822efb7ebd | []
| no_license | madhuri777/JavaPrograms | bd1157ed29bfc1ea3a137aa9578f3b0686c922e0 | 0daffd502afe6afb671f12db33ff3ef1e93aa7d1 | refs/heads/master | 2020-03-06T16:29:13.975629 | 2018-05-09T13:26:42 | 2018-05-09T13:26:42 | 126,974,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package com.bridgeit.programs;
import com.bridgeit.utility.Utility;
public class Question5 {
public static void main(String[] args) {
Utility utility=new Utility();
int N=utility.inputInteger();
Utility.findNumber(N);
}
}
| [
"[email protected]"
]
| |
c7c43b8dab0028335e9a80ff36f980cd8632e331 | 7f236d5cf06a8617fd76daa7bfbd91b02c0a0cbd | /src/com/book/cart/serviceImpl/CartServiceImpl.java | c62bfca637e1f3bad837723846bc456d9f6deb8c | []
| no_license | gavy1004/Book | 2efcb844de9936f321b218677eeabe671647e615 | b1c5434db9cc5ae6be01d7df38f3332ee065a081 | refs/heads/master | 2023-04-26T00:25:57.549406 | 2021-06-07T08:40:50 | 2021-06-07T08:40:50 | 371,544,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,164 | java | package com.book.cart.serviceImpl;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.book.cart.service.CartService;
import com.book.cart.vo.CartVO;
import com.book.common.DAO;
import com.book.product.vo.ProductVO;
public class CartServiceImpl extends DAO implements CartService {
Connection conn;
PreparedStatement psmt;
ResultSet rs;
String sql;
// 아이디에 일치하는 장바구니 상품 리스트 조회
@Override
public List<CartVO> selectCartList(String id) {
conn = DAO.getConnect();
sql = "select n.book_image, n.book_code,n.book_name, n.price, n.sale, n.sale_price,sum(c.book_qty) cnt, n.sale_price*sum(c.book_qty) ssum\r\n"
+ ", n.price*sum(c.book_qty) sum\r\n" + "from cart c ,book n \r\n"
+ "where c.BOOK_CODE= n.BOOK_CODE \r\n" + "and user_id=?\r\n"
+ "group by n.book_image,n.book_code, n.book_name, n.price, n.sale, n.sale_price ";
List<CartVO> list = new ArrayList<>();
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, id);
rs = psmt.executeQuery();
while (rs.next()) {
CartVO vo = new CartVO();
vo.setBookImage(rs.getString("book_image"));
vo.setBookCode(rs.getString("book_code"));
vo.setBookName(rs.getString("book_name"));
vo.setPrice(rs.getString("price"));
vo.setSalePrice(rs.getString("sale_price"));
vo.setSale(rs.getString("sale"));
vo.setSsum(rs.getInt("ssum"));
vo.setSum(rs.getInt("sum"));
vo.setCnt(rs.getInt("cnt"));
list.add(vo);
}
System.out.println(list);
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return list;
}
// 회원별 장바구니 상품 갯수
public int getCountCart(String id) {
conn = DAO.getConnect();
sql ="select sum(book_qty) cnt from cart where user_id=?";
int rCnt = 0;
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, id);
rs = psmt.executeQuery();
if(rs.next()) {
rCnt = rs.getInt(1);
}
} catch (SQLException e) {
e.printStackTrace();
}finally {
close();
}
return rCnt;
}
// 장바구니 중복체크 / 중복존재하면 true / 아니면 False
// 같은 상품이 담겨 있는지 조회
@Override
public boolean selectCart(CartVO vo) {
boolean exist = false;
conn = DAO.getConnect();
sql = "select * from cart where user_id =? and book_code=?";
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, vo.getUserId());
psmt.setString(2, vo.getBookCode());
rs = psmt.executeQuery();
if (rs.next()) {
exist = true;
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return exist;
}
// 같은 상품이 없다면 등록
@Override
public int insertCart(CartVO vo) {
conn = DAO.getConnect();
sql = "insert into cart values(? ,? ,1)";
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, vo.getUserId());
psmt.setString(2, vo.getBookCode());
psmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return 0;
}
// 같은 상품이 있다면 1 추가
@Override
public int updateCart(CartVO vo) {
conn = DAO.getConnect();
sql = "UPDATE cart set book_qty=book_qty+1 where user_id = ? and book_code=?";
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, vo.getUserId());
psmt.setString(2, vo.getBookCode());
psmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return 0;
}
@Override
public int updateCartPage(CartVO vo) {
conn = DAO.getConnect();
sql="update cart set book_qty=? where user_id=? and book_code=?";
try {
psmt = conn.prepareStatement(sql);
psmt.setInt(1, vo.getBookQty());
psmt.setString(2, vo.getUserId());
psmt.setString(3, vo.getBookCode());
int r =psmt.executeUpdate();
System.out.println(r+"건이 수정되었습니다");
} catch (SQLException e) {
e.printStackTrace();
}finally {
close();
}
return 0;
}
/*
* // 장바구니 조회 페이지에서 수량감소
*
* @Override public int DecQtyUpdate(CartVO vo) { conn = DAO.getConnect(); sql =
* "UPDATE cart set book_qty=book_qty-1 where user_id = ? and book_code=?"; int
* r = 0; try { psmt = conn.prepareStatement(sql); psmt.setString(1,
* vo.getUserId()); psmt.setString(2, vo.getBookCode());
*
* r =psmt.executeUpdate(); System.out.println(r+"건이 업데이트 되었습니다");
* System.out.println(vo.getBookCode()); System.out.println(vo.getUserId());
* System.out.println(vo.getBookQty()); } catch (SQLException e) {
* e.printStackTrace(); } finally { close(); } return r; }
*/
@Override
public int deleteCart(CartVO vo) {
conn = DAO.getConnect();
sql = "DELETE FROM cart WHERE user_id = ? AND book_code=?";
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, vo.getUserId());
psmt.setString(2, vo.getBookCode());
int r = psmt.executeUpdate();
System.out.println(r + "건이 카트에서 삭제되었습니다.");
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return 0;
}
@Override
public int deleteAllCart(CartVO vo) {
conn = DAO.getConnect();
sql = "DELETE FROM cart WHERE user_id = ?";
try {
psmt = conn.prepareStatement(sql);
psmt.setString(1, vo.getUserId());
int r = psmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
close();
}
return 0;
}
private void close() {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (psmt != null) {
try {
psmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
| [
"admin@YD02-16"
]
| admin@YD02-16 |
24e2dd51364c157606a0b6ebb66f536ece8a8eb6 | 847b523080fe191ffbdf4edc2640d4d4aee98493 | /Test/src/push/nio/netty/TimeServer.java | 809f69fa01aa7337432acfc06b76f46da8c0b51c | []
| no_license | pushbj/springcloud | d5ac04b08d343a39f7ac4a84eb50e629301612f1 | dfc44f5d3a63d1d3cb526f652d875b6dd0c5fe55 | refs/heads/master | 2021-01-01T19:31:16.924359 | 2017-07-28T03:48:42 | 2017-07-28T03:48:42 | 98,599,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,322 | java | package push.nio.netty;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
public class TimeServer {
public void bind(int port) throws Exception{
EventLoopGroup bossGroup =new NioEventLoopGroup();
EventLoopGroup workergroup=new NioEventLoopGroup();
try{
ServerBootstrap b=new ServerBootstrap();
b.group(bossGroup,workergroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_BACKLOG,1024)
.childHandler(new ChildChannelHandler());
ChannelFuture f=b.bind(port).sync();
f.channel().closeFuture().sync();
}finally{
bossGroup.shutdownGracefully();
workergroup.shutdownGracefully();
}
}
}
class ChildChannelHandler extends ChannelInitializer<SocketChannel>{
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new TimeServerHandler2());
}
public static void main(String[] args) throws Exception{
int port=8080;
new TimeServer().bind(port);
}
}
| [
"Think@ylf"
]
| Think@ylf |
b5eaadbec0e9637dc8a1771306ff7335978da3dc | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_b4da2cd498c4f7d3db22d69bc41baf0ebdbcb6bc/QuickContactActivity/2_b4da2cd498c4f7d3db22d69bc41baf0ebdbcb6bc_QuickContactActivity_s.java | 53ac22bbb96b114b5126ea114e10b40a79ba371d | []
| 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 | 4,214 | java | /*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.contacts.quickcontact;
import com.android.contacts.ContactsActivity;
import android.content.ContentUris;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.QuickContact;
import android.provider.ContactsContract.RawContacts;
import android.util.Log;
/**
* Stub translucent activity that just shows {@link QuickContactWindow} floating
* above the caller. This temporary hack should eventually be replaced with
* direct framework support.
*/
public final class QuickContactActivity extends ContactsActivity
implements QuickContactWindow.OnDismissListener {
private static final String TAG = "QuickContactActivity";
static final boolean LOGV = false;
static final boolean FORCE_CREATE = false;
private QuickContactWindow mQuickContact;
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
if (LOGV) Log.d(TAG, "onCreate");
this.onNewIntent(getIntent());
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (LOGV) Log.d(TAG, "onNewIntent");
if (QuickContactWindow.TRACE_LAUNCH) {
android.os.Debug.startMethodTracing(QuickContactWindow.TRACE_TAG);
}
if (mQuickContact == null || FORCE_CREATE) {
if (LOGV) Log.d(TAG, "Preparing window");
mQuickContact = new QuickContactWindow(this, this);
}
// Use our local window token for now
Uri lookupUri = intent.getData();
// Check to see whether it comes from the old version.
if (android.provider.Contacts.AUTHORITY.equals(lookupUri.getAuthority())) {
final long rawContactId = ContentUris.parseId(lookupUri);
lookupUri = RawContacts.getContactLookupUri(getContentResolver(),
ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId));
}
final Bundle extras = intent.getExtras();
// Read requested parameters for displaying
final Rect target = intent.getSourceBounds();
final int mode = extras.getInt(QuickContact.EXTRA_MODE, QuickContact.MODE_MEDIUM);
final String[] excludeMimes = extras.getStringArray(QuickContact.EXTRA_EXCLUDE_MIMES);
mQuickContact.show(lookupUri, target, mode, excludeMimes);
}
/** {@inheritDoc} */
@Override
public void onBackPressed() {
if (LOGV) Log.w(TAG, "Unexpected back captured by stub activity");
finish();
}
@Override
protected void onPause() {
super.onPause();
if (LOGV) Log.d(TAG, "onPause");
// Dismiss any dialog when pausing
mQuickContact.dismiss();
}
@Override
protected void onDestroy() {
super.onDestroy();
if (LOGV) Log.d(TAG, "onDestroy");
}
/** {@inheritDoc} */
@Override
public void onDismiss(QuickContactWindow dialog) {
if (LOGV) Log.d(TAG, "onDismiss");
if (isTaskRoot() && !FORCE_CREATE) {
// Instead of stopping, simply push this to the back of the stack.
// This is only done when running at the top of the stack;
// otherwise, we have been launched by someone else so need to
// allow the user to go back to the caller.
moveTaskToBack(false);
} else {
finish();
}
}
}
| [
"[email protected]"
]
| |
659a5940791ca2f94957a8ba9042a35b74af1ff9 | 3a4a5b9b5cab4fd58ba89363e711ad5e0f70f3b1 | /InfVis/src/org/jfree/chart/labels/ItemLabelAnchor.java | 4cd6effb7910f0d6a0047fb36e57d53ab9576b06 | []
| no_license | BackupTheBerlios/infvishot | bed574cd737cfe3c5c494dcc61c0798fd788254c | 409dc9b5831a2a01f950e263152967834eadcd7b | refs/heads/master | 2020-03-30T05:00:37.063072 | 2005-06-13T16:31:05 | 2005-06-13T16:31:05 | 40,073,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,497 | java | /* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* --------------------
* ItemLabelAnchor.java
* --------------------
* (C) Copyright 2003, 2004, by Object Refinery Limited.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
*
* $Id: ItemLabelAnchor.java,v 1.1 2005/04/28 16:29:18 harrym_nu Exp $
*
* Changes
* -------
* 29-Apr-2003 : Version 1 (DG);
* 19-Feb-2004 : Moved to org.jfree.chart.labels package, added readResolve() method (DG);
*
*/
package org.jfree.chart.labels;
import java.io.ObjectStreamException;
import java.io.Serializable;
/**
* An enumeration of the positions that a value label can take, relative to an item
* in a {@link org.jfree.chart.plot.CategoryPlot}.
*
* @author David Gilbert
*/
public final class ItemLabelAnchor implements Serializable {
/** Center. */
public static final ItemLabelAnchor CENTER = new ItemLabelAnchor("ItemLabelAnchor.CENTER");
/** INSIDE1. */
public static final ItemLabelAnchor INSIDE1 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE1");
/** INSIDE2. */
public static final ItemLabelAnchor INSIDE2 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE2");
/** INSIDE3. */
public static final ItemLabelAnchor INSIDE3 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE3");
/** INSIDE4. */
public static final ItemLabelAnchor INSIDE4 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE4");
/** INSIDE5. */
public static final ItemLabelAnchor INSIDE5 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE5");
/** INSIDE6. */
public static final ItemLabelAnchor INSIDE6 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE6");
/** INSIDE7. */
public static final ItemLabelAnchor INSIDE7 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE7");
/** INSIDE8. */
public static final ItemLabelAnchor INSIDE8 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE8");
/** INSIDE9. */
public static final ItemLabelAnchor INSIDE9 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE9");
/** INSIDE10. */
public static final ItemLabelAnchor INSIDE10 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE10");
/** INSIDE11. */
public static final ItemLabelAnchor INSIDE11 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE11");
/** INSIDE12. */
public static final ItemLabelAnchor INSIDE12 = new ItemLabelAnchor("ItemLabelAnchor.INSIDE12");
/** OUTSIDE1. */
public static final ItemLabelAnchor OUTSIDE1 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE1");
/** OUTSIDE2. */
public static final ItemLabelAnchor OUTSIDE2 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE2");
/** OUTSIDE3. */
public static final ItemLabelAnchor OUTSIDE3 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE3");
/** OUTSIDE4. */
public static final ItemLabelAnchor OUTSIDE4 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE4");
/** OUTSIDE5. */
public static final ItemLabelAnchor OUTSIDE5 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE5");
/** OUTSIDE6. */
public static final ItemLabelAnchor OUTSIDE6 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE6");
/** OUTSIDE7. */
public static final ItemLabelAnchor OUTSIDE7 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE7");
/** OUTSIDE8. */
public static final ItemLabelAnchor OUTSIDE8 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE8");
/** OUTSIDE9. */
public static final ItemLabelAnchor OUTSIDE9 = new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE9");
/** OUTSIDE10. */
public static final ItemLabelAnchor OUTSIDE10
= new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE10");
/** OUTSIDE11. */
public static final ItemLabelAnchor OUTSIDE11
= new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE11");
/** OUTSIDE12. */
public static final ItemLabelAnchor OUTSIDE12
= new ItemLabelAnchor("ItemLabelAnchor.OUTSIDE12");
/** The name. */
private String name;
/**
* Private constructor.
*
* @param name the name.
*/
private ItemLabelAnchor(String name) {
this.name = name;
}
/**
* Returns a string representing the object.
*
* @return The string.
*/
public String toString() {
return this.name;
}
/**
* Returns <code>true</code> if this object is equal to the specified object, and
* <code>false</code> otherwise.
*
* @param o the other object.
*
* @return A boolean.
*/
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ItemLabelAnchor)) {
return false;
}
final ItemLabelAnchor order = (ItemLabelAnchor) o;
if (!this.name.equals(order.toString())) {
return false;
}
return true;
}
/**
* Ensures that serialization returns the unique instances.
*
* @return the object.
*
* @throws ObjectStreamException if there is a problem.
*/
private Object readResolve() throws ObjectStreamException {
ItemLabelAnchor result = null;
if (this.equals(ItemLabelAnchor.CENTER)) {
result = ItemLabelAnchor.CENTER;
}
else if (this.equals(ItemLabelAnchor.INSIDE1)) {
result = ItemLabelAnchor.INSIDE1;
}
else if (this.equals(ItemLabelAnchor.INSIDE2)) {
result = ItemLabelAnchor.INSIDE2;
}
else if (this.equals(ItemLabelAnchor.INSIDE3)) {
result = ItemLabelAnchor.INSIDE3;
}
else if (this.equals(ItemLabelAnchor.INSIDE4)) {
result = ItemLabelAnchor.INSIDE4;
}
else if (this.equals(ItemLabelAnchor.INSIDE5)) {
result = ItemLabelAnchor.INSIDE5;
}
else if (this.equals(ItemLabelAnchor.INSIDE6)) {
result = ItemLabelAnchor.INSIDE6;
}
else if (this.equals(ItemLabelAnchor.INSIDE7)) {
result = ItemLabelAnchor.INSIDE7;
}
else if (this.equals(ItemLabelAnchor.INSIDE8)) {
result = ItemLabelAnchor.INSIDE8;
}
else if (this.equals(ItemLabelAnchor.INSIDE9)) {
result = ItemLabelAnchor.INSIDE9;
}
else if (this.equals(ItemLabelAnchor.INSIDE10)) {
result = ItemLabelAnchor.INSIDE10;
}
else if (this.equals(ItemLabelAnchor.INSIDE11)) {
result = ItemLabelAnchor.INSIDE11;
}
else if (this.equals(ItemLabelAnchor.INSIDE12)) {
result = ItemLabelAnchor.INSIDE12;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE1)) {
result = ItemLabelAnchor.OUTSIDE1;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE2)) {
result = ItemLabelAnchor.OUTSIDE2;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE3)) {
result = ItemLabelAnchor.OUTSIDE3;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE4)) {
result = ItemLabelAnchor.OUTSIDE4;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE5)) {
result = ItemLabelAnchor.OUTSIDE5;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE6)) {
result = ItemLabelAnchor.OUTSIDE6;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE7)) {
result = ItemLabelAnchor.OUTSIDE7;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE8)) {
result = ItemLabelAnchor.OUTSIDE8;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE9)) {
result = ItemLabelAnchor.OUTSIDE9;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE10)) {
result = ItemLabelAnchor.OUTSIDE10;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE11)) {
result = ItemLabelAnchor.OUTSIDE11;
}
else if (this.equals(ItemLabelAnchor.OUTSIDE12)) {
result = ItemLabelAnchor.OUTSIDE12;
}
return result;
}
//// DEPRECATED METHODS ///////////////////////////////////////////////////////////////////////
/**
* Returns the anchor point that is horizontally opposite the given anchor point.
*
* @param anchor an anchor point.
*
* @return The opposite anchor point.
*
* @deprecated Renderer now has positive and negative item label anchors.
*/
public static ItemLabelAnchor getHorizontalOpposite(ItemLabelAnchor anchor) {
if (anchor == ItemLabelAnchor.CENTER) {
return ItemLabelAnchor.CENTER;
}
else if (anchor == ItemLabelAnchor.INSIDE1) {
return ItemLabelAnchor.INSIDE11;
}
else if (anchor == ItemLabelAnchor.INSIDE2) {
return ItemLabelAnchor.INSIDE10;
}
else if (anchor == ItemLabelAnchor.INSIDE3) {
return ItemLabelAnchor.INSIDE9;
}
else if (anchor == ItemLabelAnchor.INSIDE4) {
return ItemLabelAnchor.INSIDE8;
}
else if (anchor == ItemLabelAnchor.INSIDE5) {
return ItemLabelAnchor.INSIDE7;
}
else if (anchor == ItemLabelAnchor.INSIDE6) {
return ItemLabelAnchor.INSIDE6;
}
else if (anchor == ItemLabelAnchor.INSIDE7) {
return ItemLabelAnchor.INSIDE5;
}
else if (anchor == ItemLabelAnchor.INSIDE8) {
return ItemLabelAnchor.INSIDE4;
}
else if (anchor == ItemLabelAnchor.INSIDE9) {
return ItemLabelAnchor.INSIDE3;
}
else if (anchor == ItemLabelAnchor.INSIDE10) {
return ItemLabelAnchor.INSIDE2;
}
else if (anchor == ItemLabelAnchor.INSIDE11) {
return ItemLabelAnchor.INSIDE1;
}
else if (anchor == ItemLabelAnchor.INSIDE12) {
return ItemLabelAnchor.INSIDE12;
}
else if (anchor == ItemLabelAnchor.OUTSIDE1) {
return ItemLabelAnchor.OUTSIDE11;
}
else if (anchor == ItemLabelAnchor.OUTSIDE2) {
return ItemLabelAnchor.OUTSIDE10;
}
else if (anchor == ItemLabelAnchor.OUTSIDE3) {
return ItemLabelAnchor.OUTSIDE9;
}
else if (anchor == ItemLabelAnchor.OUTSIDE4) {
return ItemLabelAnchor.OUTSIDE8;
}
else if (anchor == ItemLabelAnchor.OUTSIDE5) {
return ItemLabelAnchor.OUTSIDE7;
}
else if (anchor == ItemLabelAnchor.OUTSIDE6) {
return ItemLabelAnchor.OUTSIDE6;
}
else if (anchor == ItemLabelAnchor.OUTSIDE7) {
return ItemLabelAnchor.OUTSIDE5;
}
else if (anchor == ItemLabelAnchor.OUTSIDE8) {
return ItemLabelAnchor.OUTSIDE4;
}
else if (anchor == ItemLabelAnchor.OUTSIDE9) {
return ItemLabelAnchor.OUTSIDE3;
}
else if (anchor == ItemLabelAnchor.OUTSIDE10) {
return ItemLabelAnchor.OUTSIDE2;
}
else if (anchor == ItemLabelAnchor.OUTSIDE11) {
return ItemLabelAnchor.OUTSIDE1;
}
else if (anchor == ItemLabelAnchor.OUTSIDE12) {
return ItemLabelAnchor.OUTSIDE12;
}
return null;
}
/**
* Returns the anchor point that is vertically opposite the given anchor point.
*
* @param anchor an anchor point.
*
* @return The opposite anchor point.
*
* @deprecated Renderer now has positive and negative item label positions.
*/
public static ItemLabelAnchor getVerticalOpposite(ItemLabelAnchor anchor) {
if (anchor == ItemLabelAnchor.CENTER) {
return ItemLabelAnchor.CENTER;
}
else if (anchor == ItemLabelAnchor.INSIDE1) {
return ItemLabelAnchor.INSIDE5;
}
else if (anchor == ItemLabelAnchor.INSIDE2) {
return ItemLabelAnchor.INSIDE4;
}
else if (anchor == ItemLabelAnchor.INSIDE3) {
return ItemLabelAnchor.INSIDE3;
}
else if (anchor == ItemLabelAnchor.INSIDE4) {
return ItemLabelAnchor.INSIDE2;
}
else if (anchor == ItemLabelAnchor.INSIDE5) {
return ItemLabelAnchor.INSIDE1;
}
else if (anchor == ItemLabelAnchor.INSIDE6) {
return ItemLabelAnchor.INSIDE12;
}
else if (anchor == ItemLabelAnchor.INSIDE7) {
return ItemLabelAnchor.INSIDE11;
}
else if (anchor == ItemLabelAnchor.INSIDE8) {
return ItemLabelAnchor.INSIDE10;
}
else if (anchor == ItemLabelAnchor.INSIDE9) {
return ItemLabelAnchor.INSIDE9;
}
else if (anchor == ItemLabelAnchor.INSIDE10) {
return ItemLabelAnchor.INSIDE8;
}
else if (anchor == ItemLabelAnchor.INSIDE11) {
return ItemLabelAnchor.INSIDE7;
}
else if (anchor == ItemLabelAnchor.INSIDE12) {
return ItemLabelAnchor.INSIDE6;
}
else if (anchor == ItemLabelAnchor.OUTSIDE1) {
return ItemLabelAnchor.OUTSIDE5;
}
else if (anchor == ItemLabelAnchor.OUTSIDE2) {
return ItemLabelAnchor.OUTSIDE4;
}
else if (anchor == ItemLabelAnchor.OUTSIDE3) {
return ItemLabelAnchor.OUTSIDE3;
}
else if (anchor == ItemLabelAnchor.OUTSIDE4) {
return ItemLabelAnchor.OUTSIDE2;
}
else if (anchor == ItemLabelAnchor.OUTSIDE5) {
return ItemLabelAnchor.OUTSIDE1;
}
else if (anchor == ItemLabelAnchor.OUTSIDE6) {
return ItemLabelAnchor.OUTSIDE12;
}
else if (anchor == ItemLabelAnchor.OUTSIDE7) {
return ItemLabelAnchor.OUTSIDE11;
}
else if (anchor == ItemLabelAnchor.OUTSIDE8) {
return ItemLabelAnchor.OUTSIDE10;
}
else if (anchor == ItemLabelAnchor.OUTSIDE9) {
return ItemLabelAnchor.OUTSIDE9;
}
else if (anchor == ItemLabelAnchor.OUTSIDE10) {
return ItemLabelAnchor.OUTSIDE8;
}
else if (anchor == ItemLabelAnchor.OUTSIDE11) {
return ItemLabelAnchor.OUTSIDE7;
}
else if (anchor == ItemLabelAnchor.OUTSIDE12) {
return ItemLabelAnchor.OUTSIDE6;
}
return null;
}
}
| [
"harrym_nu"
]
| harrym_nu |
9242f73147963921030b17e0269ad80cff2da786 | af0354227cb21387265c757c376b0f967ee78d5b | /src/java/soaprmi/mapping/soaprmi/mapping/XmlMapException.java | e58f18c36ec175d2608efacbd56be8d3334820dc | [
"xpp",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | SZUE/xsoap | 7bec2b22d333414c01874a3c31ffb837e8cd29a1 | 6c282d0687afb6cd3678943b0758277302d08ba8 | refs/heads/master | 2021-01-25T14:58:54.968630 | 2018-03-04T00:35:44 | 2018-03-04T00:35:44 | 123,743,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,394 | java | /* -*- mode: Java; c-basic-offset: 4; indent-tabs-mode: nil; -*- //------100-columns-wide------>|*/
/*
* Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved.
*
* This software is open source. See the bottom of this file for the licence.
*
* $Id: XmlMapException.java,v 1.4 2003/04/06 00:04:10 aslom Exp $
*/
package soaprmi.mapping;
/**
* Signal mapping failure.
*
* @version $Revision: 1.4 $
* @author <a href="http://www.extreme.indiana.edu/~aslom/">Aleksander Slominski</a>
*/
public class XmlMapException extends Exception {
public Throwable detail;
public XmlMapException() {
}
public XmlMapException(String s) {
super(s);
}
public XmlMapException(String s, Throwable ex) {
super(s);
detail = ex;
}
public String getMessage() {
if(detail == null)
return super.getMessage();
else
return super.getMessage() + "; nested exception is: \n\t" + detail.toString();
}
public void printStackTrace(java.io.PrintStream ps) {
if (detail == null) {
super.printStackTrace(ps);
} else {
synchronized(ps) {
//ps.println(this);
ps.println(super.getMessage() + "; nested exception is:");
detail.printStackTrace(ps);
}
}
}
public void printStackTrace() {
printStackTrace(System.err);
}
public void printStackTrace(java.io.PrintWriter pw){
if (detail == null) {
super.printStackTrace(pw);
} else {
synchronized(pw) {
//pw.println(this);
pw.println(super.getMessage() + "; nested exception is:");
detail.printStackTrace(pw);
}
}
}
}
/*
* Indiana University Extreme! Lab Software License, Version 1.2
*
* Copyright (C) 2002 The Trustees of Indiana University.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1) All redistributions of source code must retain the above
* copyright notice, the list of authors in the original source
* code, this list of conditions and the disclaimer listed in this
* license;
*
* 2) All redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the disclaimer
* listed in this license in the documentation and/or other
* materials provided with the distribution;
*
* 3) Any documentation included with all redistributions must include
* the following acknowledgement:
*
* "This product includes software developed by the Indiana
* University Extreme! Lab. For further information please visit
* http://www.extreme.indiana.edu/"
*
* Alternatively, this acknowledgment may appear in the software
* itself, and wherever such third-party acknowledgments normally
* appear.
*
* 4) The name "Indiana University" or "Indiana University
* Extreme! Lab" shall not be used to endorse or promote
* products derived from this software without prior written
* permission from Indiana University. For written permission,
* please contact http://www.extreme.indiana.edu/.
*
* 5) Products derived from this software may not use "Indiana
* University" name nor may "Indiana University" appear in their name,
* without prior written permission of the Indiana University.
*
* Indiana University provides no reassurances that the source code
* provided does not infringe the patent or any other intellectual
* property rights of any other entity. Indiana University disclaims any
* liability to any recipient for claims brought by any other entity
* based on infringement of intellectual property rights or otherwise.
*
* LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
* NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
* UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
* SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
* OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
* SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
* DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE
* RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
* AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
* SOFTWARE.
*/
| [
"[email protected]"
]
| |
06ab12f918a7906184b3bedf2dbe545970de294d | 8dc84558f0058d90dfc4955e905dab1b22d12c08 | /content/public/android/java/src/org/chromium/content/app/SandboxedProcessService24.java | 15e1ffc0d7432962d9d24ab18c01ce1c3c125016 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
]
| permissive | meniossin/src | 42a95cc6c4a9c71d43d62bc4311224ca1fd61e03 | 44f73f7e76119e5ab415d4593ac66485e65d700a | refs/heads/master | 2022-12-16T20:17:03.747113 | 2020-09-03T10:43:12 | 2020-09-03T10:43:12 | 263,710,168 | 1 | 0 | BSD-3-Clause | 2020-05-13T18:20:09 | 2020-05-13T18:20:08 | null | UTF-8 | Java | false | false | 406 | java | // Copyright 2014 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.content.app;
/**
* This is needed to register multiple SandboxedProcess services so that we can have
* more than one sandboxed process.
*/
public class SandboxedProcessService24 extends SandboxedProcessService {
}
| [
"[email protected]"
]
| |
03ae41809ef451780852f597f7b0f73f4d4e0e0c | b12b2ca3aa65f01675e53a82cf9fabdfa2ff56fc | /lintcode/532-Reverse-Pairs/solution.java | 67770f85760ca07d732267cfa61c877b603ce302 | []
| no_license | RealForce1024/algorithms | 6dee61ed99a87419a9dd8cbb7c845adf9b8516ed | 70ff99615fe9d39cd2dbf78fd75086cd7fa63d90 | refs/heads/master | 2022-05-31T18:56:01.226134 | 2016-09-11T22:42:07 | 2016-09-11T22:42:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,362 | java | public class Solution {
/**
* @param A an array
* @return total of reverse pairs
*/
public long reversePairs(int[] A) {
return mergeSort(A, 0, A.length - 1);
}
private int mergeSort(int[] A, int start, int end) {
if (start >= end) {
return 0;
}
int mid = (start + end) / 2;
int sum = 0;
sum += mergeSort(A, start, mid);
sum += mergeSort(A, mid+1, end);
sum += merge(A, start, mid, end);
return sum;
}
private int merge(int[] A, int start, int mid, int end) {
int[] temp = new int[A.length];
int leftIndex = start;
int rightIndex = mid + 1;
int index = start;
int sum = 0;
while (leftIndex <= mid && rightIndex <= end) {
if (A[leftIndex] <= A[rightIndex]) {
temp[index++] = A[leftIndex++];
} else {
temp[index++] = A[rightIndex++];
sum += mid - leftIndex + 1;
}
}
while (leftIndex <= mid) {
temp[index++] = A[leftIndex++];
}
while (rightIndex <= end) {
temp[index++] = A[rightIndex++];
}
for (int i = start; i <= end; i++) {
A[i] = temp[i];
}
return sum;
}
} | [
"[email protected]"
]
| |
ad0d70d2a5298cd3afb64d149906c377d7af925c | a0109ba48edbbd83b4374140e6ed75464d5bc789 | /src/main/java/com/hapiniu/demo/springbootdocker/dao/LxmSysPermissionDAO.java | 0adf142c073d5ddc73b4b34181548ed3557d6478 | []
| no_license | lwz22psp/springbootdemo | 183ed0de7b1532515bbae80856206fb6a987b324 | f77bb0a3137ac27dcf7a34a00de31e6cdbc84294 | refs/heads/master | 2022-06-29T11:14:40.292138 | 2020-04-21T06:40:36 | 2020-04-21T06:40:36 | 176,914,827 | 2 | 1 | null | 2022-06-17T02:08:41 | 2019-03-21T09:41:32 | Java | UTF-8 | Java | false | false | 1,104 | java | package com.hapiniu.demo.springbootdocker.dao;
import com.hapiniu.demo.springbootdocker.entity.LxmSysPermission;
import com.hapiniu.demo.springbootdocker.entity.LxmSysPermissionExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Repository
public interface LxmSysPermissionDAO {
long countByExample(LxmSysPermissionExample example);
int deleteByExample(LxmSysPermissionExample example);
int deleteByPrimaryKey(Integer id);
int insert(LxmSysPermission record);
int insertSelective(LxmSysPermission record);
List<LxmSysPermission> selectByExample(LxmSysPermissionExample example);
LxmSysPermission selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") LxmSysPermission record, @Param("example") LxmSysPermissionExample example);
int updateByExample(@Param("record") LxmSysPermission record, @Param("example") LxmSysPermissionExample example);
int updateByPrimaryKeySelective(LxmSysPermission record);
int updateByPrimaryKey(LxmSysPermission record);
} | [
"[email protected]"
]
| |
b84087e02fe8225c29709769a8842737da241d00 | eaffeaac77f4390c84c0f17f91055b906c60cf49 | /src/ru/fizteh/fivt/students/olga_chupakhina/storeable/test/TestOTable.java | 7a1a6c8e07ed36e06ca2b49bb9611d4bfbc9d459 | [
"BSD-2-Clause"
]
| permissive | ol5478/fizteh-java-2014 | 6e3f0dd4b1da234622a6f4bb38e1d47b098516c3 | 9b3486f20e22dcb064b3d95a4b060d3a5ad43f95 | refs/heads/master | 2020-05-29T12:27:44.918051 | 2014-12-15T19:22:18 | 2014-12-15T19:22:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,424 | java | package ru.fizteh.fivt.students.olga_chupakhina.storeable.test;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ru.fizteh.fivt.storage.structured.Storeable;
import ru.fizteh.fivt.storage.structured.Table;
import ru.fizteh.fivt.students.olga_chupakhina.storeable.OTable;
import ru.fizteh.fivt.students.olga_chupakhina.storeable.OTableProvider;
import ru.fizteh.fivt.students.olga_chupakhina.storeable.OStoreable;
import java.io.File;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
public class TestOTable {
private final String testDir = System.getProperty("java.io.tmpdir") + File.separator + "DbTestDir";
private final String tableName = "table1";
private final int dirNumber = 1;
private final int fileNumber = 1;
private String correctKey;
private final String testKey1 = "ключ1";
private final String testKey2 = "ключ2";
private static final int DIR_AMOUNT = 16;
private static final int FILES_AMOUNT = 16;
private Table test;
private Storeable correctStoreable;
private Storeable uncorrectStoreable;
@Before
public void setUp() {
File dir = new File(testDir);
dir.mkdir();
byte[] b = {dirNumber + fileNumber * 16, 'k', 'e', 'y'};
correctKey = new String(b);
String tableDirectoryPath = testDir + File.separator + tableName;
File tableDir = new File(tableDirectoryPath);
tableDir.mkdir();
List<Class<?>> sig = new ArrayList<>();
sig.add(Integer.class);
sig.add(String.class);
List<Object> obj = new ArrayList<>();
obj.add(1);
obj.add("1");
correctStoreable = new OStoreable(obj, sig);
obj.add(true);
uncorrectStoreable = new OStoreable(obj, sig);
test = new OTable(tableName, testDir, sig);
((OTable) test).tableProvider = new OTableProvider(testDir);
}
@Test
public final void testGetReturnsNullIfKeyIsNotFound() throws Exception {
assertNull(test.get(testKey1));
}
@Test(expected = IllegalArgumentException.class)
public final void testGetThrowsIllegalArgumentExceptionCalledForNullKey() throws Exception {
test.get(null);
}
@Test
public final void testGetCalledForNonComittedKey() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(correctStoreable, test.get(testKey1));
}
@Test(expected = IllegalArgumentException.class)
public final void testGetCalledForNonComittedKeyNull() throws Exception {
assertNull(test.put(testKey1, null));
assertEquals(null, test.get(testKey1));
}
@Test
public final void testGetCalledForDeletedKeyBeforeCommit() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(correctStoreable, test.remove(testKey1));
assertNull(test.get(testKey1));
}
@Test(expected = IllegalArgumentException.class)
public final void testPutThrowsIllegalArgumentExceptionCalledForNullKey() throws Exception {
test.put(null, correctStoreable);
}
@Test(expected = IllegalArgumentException.class)
public final void testPutThrowsExceptionCalledForNullValue() throws Exception {
test.put(testKey1, null);
}
@Test
public final void testPutReturnsNullIfKeyHasNotBeenWrittenYet() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
}
@Test
public final void testPutReturnsOldValueIfKeyExists() throws Exception {
test.put(testKey1, correctStoreable);
assertEquals(correctStoreable, test.put(testKey1, correctStoreable));
}
@Test(expected = IllegalArgumentException.class)
public final void testRemoveThrowsExceptionCalledForNullKey() throws Exception {
test.remove(null);
}
@Test
public final void testRemoveReturnsNullIfKeyIsNotFound() throws Exception {
assertNull(test.remove(testKey1));
}
@Test
public final void testRemoveCalledForDeletedKeyBeforeCommit() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(correctStoreable, test.remove(testKey1));
assertNull(test.remove(testKey1));
}
@Test
public final void testRemoveCalledForDeletedKeyAfterCommit() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(correctStoreable, test.remove(testKey1));
test.commit();
assertNull(test.remove(testKey1));
}
@Test
public final void testCommitCreatesRealFileOnTheDisk()
throws Exception {
assertNull(test.put(testKey1, correctStoreable));
test.commit();
String subdirectoryName = Math.abs(testKey1.getBytes("UTF-8")[0]
% DIR_AMOUNT) + ".dir";
String fileName = Math.abs((testKey1.getBytes("UTF-8")[0]
/ DIR_AMOUNT) % FILES_AMOUNT)
+ ".dat";
Path filePath = Paths.get(testDir.toString(),
test.getName(),
subdirectoryName, fileName);
assertTrue(filePath.toFile().exists());
}
@Test
public final void testCommitReturnsNonZeroChangesPuttingNewOStoreable() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(1, test.commit());
}
@Test
public final void testCommitReturnsNotZeroChangesRewriting() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(correctStoreable, test.put(testKey1, correctStoreable));
assertEquals(1, test.commit());
}
@Test
public final void testCommitNoChanges() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertEquals(1, test.commit());
assertEquals(0, test.commit());
}
//RollbackTests.
@Test
public final void testRollbackAfterPuttingNewKey() throws Exception {
assertEquals(0, test.size());
assertNull(test.put(testKey1, correctStoreable));
assertEquals(1, test.size());
assertEquals(1, test.rollback());
assertEquals(0, test.size());
assertNull(test.get(testKey1));
}
@Test
public final void testRollbackNoChanges() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
test.rollback();
assertEquals(0, test.size());
assertEquals(0, test.rollback());
}
@Test
public final void testListCalledForEmptyTable() throws Exception {
assertTrue(test.list().isEmpty());
}
@Test
public final void testListCalledForNonEmptyNewTable() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertNull(test.put(testKey2, correctStoreable));
Set<String> expectedKeySet = new HashSet<>();
expectedKeySet.add(testKey1);
expectedKeySet.add(testKey2);
Set<String> tableKeySet = new HashSet<>();
tableKeySet.addAll(test.list());
assertEquals(expectedKeySet, tableKeySet);
}
@Test
public final void testListCalledForNonEmptyCommitedTable() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertNull(test.put(testKey2, correctStoreable));
test.commit();
assertEquals(correctStoreable, test.remove(testKey2));
Set<String> expectedKeySet = new HashSet<>();
expectedKeySet.add(testKey1);
Set<String> tableKeySet = new HashSet<>();
tableKeySet.addAll(test.list());
assertEquals(expectedKeySet, tableKeySet);
}
//Size tests.
@Test
public final void testGetReturnsLatestValueForUncommittedKey() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertNull(test.put(testKey2, correctStoreable));
assertEquals(correctStoreable, test.remove(testKey2));
assertEquals(1, test.size());
}
@Test
public final void testGetUncommittedKey() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertNull(test.put(testKey2, correctStoreable));
assertEquals(2, test.getNumberOfUncommittedChanges());
}
@Test
public final void testSizeCalledForNonEmptyCommitedTable() throws Exception {
assertNull(test.put(testKey1, correctStoreable));
assertNull(test.put(testKey2, correctStoreable));
test.commit();
assertEquals(correctStoreable, test.remove(testKey2));
assertEquals(1, test.size());
}
@After
public void tearDown() {
File dir = new File(testDir);
for (File currentTableDirectory : dir.listFiles()) {
if (currentTableDirectory.isDirectory()) {
for (File tableSubDirectory
:currentTableDirectory.listFiles()) {
if (tableSubDirectory.isDirectory()) {
for (File tableFile: tableSubDirectory.listFiles()) {
tableFile.delete();
}
}
tableSubDirectory.delete();
}
}
currentTableDirectory.delete();
}
dir.delete();
}
}
| [
"[email protected]"
]
| |
a3ba294d5e987b871f6a5af6fdc219f8fa089afe | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Spring/Spring7727.java | 842763a3be98225b8405dedfed52026c5bbd6fff | []
| no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | @Override
public void registerSynchronization(Synchronization synchronization) {
if (this.transactionSynchronizationRegistry != null) {
this.transactionSynchronizationRegistry.registerInterposedSynchronization(synchronization);
}
else {
try {
this.transactionManager.getTransaction().registerSynchronization(synchronization);
}
catch (Exception ex) {
throw new TransactionException("Could not access JTA Transaction to register synchronization", ex);
}
}
}
| [
"[email protected]"
]
| |
5680b78ab65964af14516483980db80b5f9c96ed | b0f2249198ba35cfe7f5e3cebbe4413eef264f14 | /src/main/java/nd/esp/service/lifecycle/daos/titan/TitanSyncTimerTask.java | 5695ba13b5bbf4ccd39d3576ae31251749780262 | []
| no_license | 434480761/wisdom_knowledge | f5f520cfb07685fd97d2d1a5970630a00b1fc69f | 1ee22a3536c1247f7b78f6815befbd104670119b | refs/heads/master | 2021-04-28T23:39:24.844625 | 2017-01-05T06:26:29 | 2017-01-05T06:26:29 | 77,729,017 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,001 | java | package nd.esp.service.lifecycle.daos.titan;
import nd.esp.service.lifecycle.repository.ds.ComparsionOperator;
import nd.esp.service.lifecycle.repository.ds.Item;
import nd.esp.service.lifecycle.repository.ds.LogicalOperator;
import nd.esp.service.lifecycle.repository.ds.ValueUtils;
import nd.esp.service.lifecycle.repository.exception.EspStoreException;
import nd.esp.service.lifecycle.repository.model.TitanSync;
import nd.esp.service.lifecycle.repository.sdk.TitanSyncRepository;
import nd.esp.service.lifecycle.services.titan.TitanSyncService;
import nd.esp.service.lifecycle.support.StaticDatas;
import nd.esp.service.lifecycle.support.busi.titan.TitanSyncType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.*;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.*;
/**
* Created by liuran on 2016/7/11.
*/
@Component
public class TitanSyncTimerTask {
private final static Logger LOG = LoggerFactory.getLogger(TitanSyncTimerTask.class);
public static int MAX_REPORT_TIMES = 10;
public static boolean TITAN_SYNC_SWITCH = false;
@Autowired
private TitanSyncService titanSyncService;
@Autowired
private TitanSyncRepository titanSyncRepository;
@Autowired
@Qualifier(value = "defaultJdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Scheduled(fixedDelay = 1000)
public void syncTask4SaveOrUpdate() {
if (!TITAN_SYNC_SWITCH) {
// LOG.info("titan_sync_save_or_update_closed");
return;
}
if (!StaticDatas.TITAN_SWITCH) {
LOG.info("titan_client_closed");
return;
}
try {
if (checkHaveData(TitanSyncType.SAVE_OR_UPDATE_ERROR)) {
syncData(TitanSyncType.SAVE_OR_UPDATE_ERROR);
}
} catch (Exception e) {
LOG.info("titan_sync_error {}", e.getLocalizedMessage());
}
}
@Scheduled(fixedDelay = 1000)
public void syncTask4VersionRepair() {
if (!TITAN_SYNC_SWITCH) {
return;
}
if (!StaticDatas.TITAN_SWITCH) {
LOG.info("titan_client_closed");
return;
}
try {
if (checkHaveData(TitanSyncType.VERSION_SYNC)) {
syncData(TitanSyncType.VERSION_SYNC);
}
} catch (Exception e) {
LOG.info("titan_version_repair_error {}", e.getLocalizedMessage());
}
}
private void syncData(TitanSyncType titanSyncType) {
int page = 0;
Page<TitanSync> resourcePage;
String fieldName = "createTime";
int row = 10;
List<TitanSync> entitylist;
List<Item<? extends Object>> items = new ArrayList<>();
Item<Integer> resourceTypeItem = new Item<>();
resourceTypeItem.setKey("executeTimes");
resourceTypeItem.setComparsionOperator(ComparsionOperator.LT);
resourceTypeItem.setLogicalOperator(LogicalOperator.AND);
resourceTypeItem.setValue(ValueUtils.newValue(MAX_REPORT_TIMES));
Item<String> resourceTypeItemType = new Item<>();
resourceTypeItemType.setKey("type");
resourceTypeItemType.setComparsionOperator(ComparsionOperator.EQ);
resourceTypeItemType.setLogicalOperator(LogicalOperator.AND);
resourceTypeItemType.setValue(ValueUtils.newValue(titanSyncType.toString()));
items.add(resourceTypeItem);
items.add(resourceTypeItemType);
Sort sort = new Sort(Sort.Direction.ASC, fieldName);
Pageable pageable = new PageRequest(page, row, sort);
try {
resourcePage = titanSyncRepository.findByItems(items, pageable);
} catch (EspStoreException e) {
e.printStackTrace();
return;
}
if (resourcePage == null) {
return;
}
entitylist = resourcePage.getContent();
if (entitylist == null) {
return;
}
for (TitanSync titanSync : entitylist) {
if (titanSyncType.equals(TitanSyncType.value(titanSync.getType()))) {
titanSyncService.reportResource(titanSync.getPrimaryCategory(), titanSync.getResource(), titanSyncType);
}
}
}
private boolean checkHaveData(TitanSyncType titanSyncType) {
String script = "select count(*) from titan_sync WHERE execute_times <" + MAX_REPORT_TIMES + " AND type = '" + titanSyncType.toString() + "'";
Long total = jdbcTemplate.queryForLong(script);
if (total > 0) {
return true;
}
return false;
}
}
| [
"[email protected]"
]
| |
bb13afa24dbe1725f6b50649d500438d47ce7e5e | bc4ba8e4bd1cae5fe1caf3a00d69f1fde3947538 | /src/main/java/voterinformation/handlers/SessionEndedRequestHandler.java | 48a3522a35db60869f37c92fb87720055d8aca31 | []
| no_license | alvinlin88/AlexaVoterInfo | c43db587a52d3fc442340b638cbb06ba0952e3ff | 2cbb4cd7998907c7795b797062a5af753c7002df | refs/heads/master | 2020-04-04T14:45:37.584627 | 2018-11-04T18:40:25 | 2018-11-04T18:40:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package voterinformation.handlers;
import com.amazon.ask.dispatcher.request.handler.HandlerInput;
import com.amazon.ask.dispatcher.request.handler.RequestHandler;
import com.amazon.ask.model.Response;
import com.amazon.ask.model.SessionEndedRequest;
import static com.amazon.ask.request.Predicates.requestType;
import java.util.Optional;
public class SessionEndedRequestHandler implements RequestHandler {
@Override
public boolean canHandle(HandlerInput input) {
return input.matches(requestType(SessionEndedRequest.class));
}
@Override
public Optional<Response> handle(HandlerInput input) {
//any cleanup logic goes here
return input.getResponseBuilder().build();
}
}
| [
"[email protected]"
]
| |
ca054b7e0e86ef8ab0c134dcdba86d3e9ea5d43c | 7199ee93c54d4fa9e108776ccd3af5c98fcfe876 | /src/main/java/com/joseteles/apiseasolutions/models/Trabalhador.java | 62cd8bd2032d86fefdac0ebaff8102ff0d4e9a3b | []
| no_license | jhteles/api-seasolutions | fbe9ca36f48e2fcabfd7439ac746d541c37f5857 | ba0124574f560bfafa33a9d4fdc815426bc87d60 | refs/heads/master | 2023-08-29T22:17:39.152788 | 2021-10-06T23:34:24 | 2021-10-06T23:34:24 | 414,401,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,779 | java | package com.joseteles.apiseasolutions.models;
import com.sun.istack.NotNull;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
@Entity
@Table(name="TRABALHADOR")
public class Trabalhador implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
@NotNull
private String nome;
@NotNull
private String cpf;
@NotNull
private String sexo;
@NotNull
private String setor;
@NotNull
private String cargo;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public String getSetor() {
return setor;
}
public void setSetor(String setor) {
this.setor = setor;
}
public String getCargo() {
return cargo;
}
public void setCargo(String cargo) {
this.cargo = cargo;
}
}
| [
"[email protected]"
]
| |
d93ce505eb8f3d1adbc0f5663b39dec23a9f09a8 | 0fdde9a173bda5b01eccb93045f8753eea9be550 | /ServerTest.java | e44a8bca2bb3b76694ed42b91b5ae406fa3a185d | []
| no_license | RaffalJ/Java-Gra-Chinczyk | 27690b4c5013ab34fca0a7ba06124cab70ee241c | 765db40a1b1f9ef23dd3a6ddfcd79cf000fe3f37 | refs/heads/master | 2021-01-20T17:03:53.204556 | 2017-05-10T12:29:11 | 2017-05-10T12:29:11 | 90,861,762 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package tests;
import org.junit.runner.RunWith;
import sample.Server;
import java.net.Socket;
import static junit.framework.TestCase.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Created by ruffy on 29.01.2017.
*/
public class ServerTest {
Socket socket=null;
Server server=null;
@org.junit.Before
public void setUp() throws Exception {
socket=null;
server = new Server(1,socket);
}
@org.junit.After
public void tearDown() throws Exception {
}
@org.junit.Test
public void Test_getRandom() throws Exception {
int min =0;
int max=9;
int a;
a=server.getRandom();
assertTrue(min <= a && a <= max);
}
@org.junit.Test
public void Test_getRandomRepeat() throws Exception {
for (int i = 0; i < 10; i++) {
Test_getRandom();
}
}
@org.junit.Test
public void Test_parseXML() throws Exception {
server.parseXML();
int a=9992;
assert(a==server.getPort());
}
} | [
"[email protected]"
]
| |
3390c5dcc51ed95b1d01b2dd4c34eadb4818761f | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/361/tar_1.java | 6b2ff7004084e2322cda7244cc5d8e3a3cc2c111 | []
| no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,375 | java | /*******************************************************************************
* Copyright (c) 2000, 2006 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.widgets;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
/**
* Instances of this class represent popup windows that are used
* used to inform or warn the user.
*
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>BALLOON, ICON_ERROR, ICON_INFORMATION, ICON_WARNING</dd>
* <dt><b>Events:</b></dt>
* <dd>Selection</dd>
* </dl>
* </p><p>
* IMPORTANT: This class is intended to be subclassed <em>only</em>
* within the SWT implementation.
* </p>
*
* @since 3.2
*/
/*public*/ class ToolTip extends Widget {
Shell parent;
TrayItem item;
String text = "", message = "";
int id, x, y;
boolean autoHide = true, hasLocation, visible;
static final int TIMER_ID = 100;
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* lists the style constants that are applicable to the class.
* Style bits are also inherited from superclasses.
* </p>
*
* @param parent a composite control which will be the parent of the new instance (cannot be null)
* @param style the style of control to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT#ERROR
* @see SWT#INFORMATION
* @see SWT#WARNING
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public ToolTip (Shell parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
checkOrientation (parent);
parent.createToolTip (this);
}
static int checkStyle (int style) {
int mask = SWT.ICON_ERROR | SWT.ICON_INFORMATION | SWT.ICON_WARNING;
if ((style & mask) == 0) return style;
return checkBits (style, SWT.ICON_INFORMATION, SWT.ICON_WARNING, SWT.ICON_ERROR, 0, 0, 0);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's value changes, by sending
* it one of the messages defined in the <code>SelectionListener</code>
* interface.
*
* @param listener the listener which should be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #removeSelectionListener
* @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener(listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);
}
void destroyWidget () {
if (parent != null) parent.destroyToolTip (this);
releaseHandle ();
}
/**
* Returns <code>true</code> if the receiver is automatically
* hidden by the platform, and <code>false</code> otherwise.
*
* @return the receiver's auto hide state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
*/
public boolean getAutoHide () {
checkWidget();
return autoHide;
}
/**
* Returns the receiver's message, which will be an empty
* string if it has never been set.
*
* @return the receiver's message
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public String getMessage () {
checkWidget();
return message;
}
/**
* Returns the receiver's parent, which must be a <code>Shell</code>.
*
* @return the receiver's parent
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Shell getParent () {
checkWidget ();
return parent;
}
/**
* Returns the receiver's text, which will be an empty
* string if it has never been set.
*
* @return the receiver's text
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public String getText () {
checkWidget();
return text;
}
/**
* Returns <code>true</code> if the receiver is visible, and
* <code>false</code> otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, this method
* may still indicate that it is considered visible even though
* it may not actually be showing.
* </p>
*
* @return the receiver's visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public boolean getVisible () {
checkWidget();
if (OS.IsWinCE) return false;
if (item != null) return visible;
int hwndToolTip = hwndToolTip ();
if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) {
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
return (lpti.uFlags & OS.TTF_IDISHWND) == 0 && lpti.uId == id;
}
}
return false;
}
int hwndToolTip () {
return (style & SWT.BALLOON) != 0 ? parent.balloonTipHandle () : parent.toolTipHandle ();
}
/**
* Returns <code>true</code> if the receiver is visible and all
* of the receiver's ancestors are visible and <code>false</code>
* otherwise.
*
* @return the receiver's visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getVisible
*/
public boolean isVisible () {
checkWidget ();
if (item != null) return getVisible () && item.getVisible ();
return getVisible ();
}
void releaseHandle () {
super.releaseHandle ();
parent = null;
item = null;
id = -1;
}
void releaseWidget () {
super.releaseWidget ();
if (item == null) {
if (autoHide) {
int hwndToolTip = hwndToolTip ();
if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) {
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
if ((lpti.uFlags & OS.TTF_IDISHWND) == 0) {
if (lpti.uId == id) OS.KillTimer (hwndToolTip, TIMER_ID);
}
}
}
}
}
if (item != null && item.toolTip == this) {
item.toolTip = null;
}
item = null;
text = message = null;
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the receiver's value changes.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #addSelectionListener
*/
public void removeSelectionListener (SelectionListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Selection, listener);
eventTable.unhook (SWT.DefaultSelection,listener);
}
/**
* Makes the receiver hide automatically when <code>true</code>,
* and remain visible when <code>false</code>.
*
* @param autoHide the auto hide state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getVisible
* @see #setVisible
*/
public void setAutoHide (boolean autoHide) {
checkWidget ();
this.autoHide = autoHide;
//TODO - update when visible
}
/**
* Sets the location of the receiver, which must be a tooltips,
* to the point specified by the arguments which are relative
* to the display.
* <p>
* Note that this is different from most widgets where the
* location of the widget is relative to the parent.
* </p>
*
* @param x the new x coordinate for the receiver
* @param y the new y coordinate for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLocation (int x, int y) {
checkWidget ();
this.x = x;
this.y = y;
hasLocation = true;
//TODO - update when visible
}
/**
* Sets the location of the receiver, which must be a tooltip,
* to the point specified by the argument which is relative
* to the display.
* <p>
* Note that this is different from most widgets where the
* location of the widget is relative to the parent.
* </p><p>
* Note that the platform window manager ultimately has control
* over the location of tooltips.
* </p>
*
* @param location the new location for the receiver
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the point is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLocation (Point location) {
checkWidget ();
if (location == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
setLocation (location.x, location.y);
}
/**
* Sets the receiver's message.
*
* @param string the new message
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the text is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setMessage (String string) {
checkWidget ();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
message = string;
//TODO - update when visible
}
/**
* Sets the receiver's text.
*
* @param string the new text
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the text is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setText (String string) {
checkWidget ();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
text = string;
//TODO - update when visible
}
/**
* Marks the receiver as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, marking
* it visible may not actually cause it to be displayed.
* </p>
*
* @param visible the new visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setVisible (boolean visible) {
checkWidget ();
if (OS.IsWinCE) return;
if (visible == getVisible ()) return;
if (item == null) {
int hwnd = parent.handle;
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
lpti.uId = id;
lpti.hwnd = hwnd;
int hwndToolTip = hwndToolTip ();
if (text.length () != 0) {
int icon = OS.TTI_NONE;
if ((style & SWT.ICON_INFORMATION) != 0) icon = OS.TTI_INFO;
if ((style & SWT.ICON_WARNING) != 0) icon = OS.TTI_WARNING;
if ((style & SWT.ICON_ERROR) != 0) icon = OS.TTI_ERROR;
TCHAR pszTitle = new TCHAR (parent.getCodePage (), text, true);
OS.SendMessage (hwndToolTip, OS.TTM_SETTITLE, icon, pszTitle);
} else {
OS.SendMessage (hwndToolTip, OS.TTM_SETTITLE, 0, 0);
}
int maxWidth = 0;
if (OS.WIN32_VERSION < OS.VERSION (4, 10)) {
RECT rect = new RECT ();
OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
maxWidth = (rect.right - rect.left) / 4;
} else {
int hmonitor = OS.MonitorFromWindow (hwnd, OS.MONITOR_DEFAULTTONEAREST);
MONITORINFO lpmi = new MONITORINFO ();
lpmi.cbSize = MONITORINFO.sizeof;
OS.GetMonitorInfo (hmonitor, lpmi);
maxWidth = (lpmi.rcWork_right - lpmi.rcWork_left) / 4;
}
OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, maxWidth);
if (visible) {
int nX = x, nY = y;
if (!hasLocation) {
POINT pt = new POINT ();
if (OS.GetCursorPos (pt)) {
nX = pt.x;
nY = pt.y;
}
}
int lParam = nX | (nY << 16);
OS.SendMessage (hwndToolTip, OS.TTM_TRACKPOSITION, 0, lParam);
/*
* Feature in Windows. Windows will not show a tool tip
* if the cursor is outside the parent window (even on XP,
* TTM_POPUP will not do this). The fix is to temporarily
* move the cursor into the tool window, show the tool tip,
* and then restore the cursor.
*/
POINT pt = new POINT ();
OS.GetCursorPos (pt);
RECT rect = new RECT ();
OS.GetClientRect (hwnd, rect);
OS.MapWindowPoints (hwnd, 0, rect, 2);
if (!OS.PtInRect (rect, pt)) {
int hCursor = OS.GetCursor ();
OS.SetCursor (0);
OS.SetCursorPos (rect.left, rect.top);
OS.SendMessage (hwndToolTip, OS.TTM_TRACKACTIVATE, 1, lpti);
OS.SetCursorPos (pt.x, pt.y);
OS.SetCursor (hCursor);
} else {
OS.SendMessage (hwndToolTip, OS.TTM_TRACKACTIVATE, 1, lpti);
}
int time = OS.SendMessage (hwndToolTip, OS.TTM_GETDELAYTIME, OS.TTDT_AUTOPOP, 0);
OS.SetTimer (hwndToolTip, TIMER_ID, time, 0);
} else {
OS.SendMessage (hwndToolTip, OS.TTM_TRACKACTIVATE, 0, lpti);
OS.SendMessage (hwndToolTip, OS.TTM_SETTITLE, 0, 0);
OS.SendMessage (hwndToolTip, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
OS.SendMessage (hwndToolTip, OS.TTM_POP, 0, 0);
OS.KillTimer (hwndToolTip, TIMER_ID);
}
return;
}
if (item != null && OS.SHELL32_MAJOR >= 5) {
if (visible) {
NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA ();
TCHAR buffer1 = new TCHAR (0, text, true);
TCHAR buffer2 = new TCHAR (0, message, true);
if (OS.IsUnicode) {
char [] szInfoTitle = ((NOTIFYICONDATAW) iconData).szInfoTitle;
int length1 = Math.min (szInfoTitle.length - 1, buffer1.length ());
System.arraycopy (buffer1.chars, 0, szInfoTitle, 0, length1);
char [] szInfo = ((NOTIFYICONDATAW) iconData).szInfo;
int length2 = Math.min (szInfo.length - 1, buffer2.length ());
System.arraycopy (buffer2.chars, 0, szInfo, 0, length2);
} else {
byte [] szInfoTitle = ((NOTIFYICONDATAA) iconData).szInfoTitle;
int length = Math.min (szInfoTitle.length - 1, buffer1.length ());
System.arraycopy (buffer1.bytes, 0, szInfoTitle, 0, length);
byte [] szInfo = ((NOTIFYICONDATAA) iconData).szInfo;
int length2 = Math.min (szInfo.length - 1, buffer2.length ());
System.arraycopy (buffer2.bytes, 0, szInfo, 0, length2);
}
Display display = item.getDisplay ();
iconData.cbSize = NOTIFYICONDATA.sizeof;
iconData.uID = item.id;
iconData.hWnd = display.hwndMessage;
iconData.uFlags = OS.NIF_INFO;
if ((style & SWT.ICON_INFORMATION) != 0) iconData.dwInfoFlags = OS.NIIF_INFO;
if ((style & SWT.ICON_WARNING) != 0) iconData.dwInfoFlags = OS.NIIF_WARNING;
if ((style & SWT.ICON_ERROR) != 0) iconData.dwInfoFlags = OS.NIIF_ERROR;
sendEvent (SWT.Show);
this.visible = OS.Shell_NotifyIcon (OS.NIM_MODIFY, iconData);
} else {
//TODO - hide the tray item
}
}
}
}
| [
"[email protected]"
]
| |
add2841156cdff516af7f20079e904d407df4ad7 | 2e547201ea9aa4b5f5243755144824e073b098f1 | /src/main/java/hello/hellospring/repository/SpringDataJpaMemberRepository.java | c1874f213f4de0df729ffe20704298e1c6013980 | []
| no_license | jikkun/hello-spring | ee41b5f550ac1d9b7685fd14a316321b6af4da9d | b717e1f8aa7504cc3724a3fcd108ff7a9000452a | refs/heads/master | 2023-05-06T18:30:36.532751 | 2021-06-02T06:41:49 | 2021-06-02T06:41:49 | 362,350,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package hello.hellospring.repository;
import hello.hellospring.domain.Member;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
// JpaRepository를 상속받고있으면 스프링에 자동으로 등록됨.
public interface SpringDataJpaMemberRepository extends JpaRepository<Member, Long>, MemberRepository {
//JPQL select m from member m where m.name = ?
@Override
Optional<Member> findByName(String name);
}
| [
"[email protected]"
]
| |
5760c3035887351dd08076979497a7fa3aeee2ef | 95e6bfb2cec83171b5bc80fd8789eff4f90efbe3 | /app/src/androidTest/java/com/amanirshad/chatapp/ExampleInstrumentedTest.java | 7964cd70011c7cebc40498fed095ada12a33abaf | []
| no_license | amanirshad/ChatApp | b6369b013ca6403c7567b602aa8c2be1742ae6bb | 42f3a99d441a433d3c4cef6016991da4381a1354 | refs/heads/master | 2023-04-26T20:23:12.590262 | 2021-05-26T17:35:39 | 2021-05-26T17:35:39 | 371,119,386 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.amanirshad.chatapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.amanirshad.chatapp", appContext.getPackageName());
}
} | [
"[email protected]"
]
| |
2bc6bd59bd75d9f62db0400c0f6da824f6980e98 | 8a19574856e9c1caa462f9a5debdaeb6560279c2 | /src/com/cts/programs/test/PrimeNumberTest.java | 9864703f14f684bf9ae16c9742bf4b3193fe1c49 | []
| no_license | saravanan00/CTSJavaAssignment | 3c18ed8466ee8bb5c113ac708d17298e86eda787 | 1ec9ab732b150c241116a9bdf501407c70f6a27b | refs/heads/master | 2020-03-18T09:03:53.179496 | 2018-06-02T08:13:31 | 2018-06-02T08:13:31 | 134,543,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.cts.programs.test;
import com.cts.programs.PrimeNumber;
public class PrimeNumberTest {
public static void main(String[] args) {
PrimeNumber primenumber=new PrimeNumber();
System.out.println(primenumber.prime(4));
}
}
| [
"[email protected]"
]
| |
74032b6b36e222256bc4c4379ca4cc3a5caac9f1 | 71a410a05e19d9a6ee3f4695331077c5b5c89241 | /springcloud_consumer_nacos_order_8083/src/main/java/com/chenzejie/springcloud/controller/OrderNacosController.java | 48796e90b52bfc93e2b88e8b556271a03ecbaa89 | []
| no_license | chenzejie-alt/springcloud-service | df37179ab1bebe402d7e9a8ba27f10b03bb51d72 | 37fd1913fc886c172e991b7ee352373e6322767d | refs/heads/master | 2023-04-20T11:21:19.265615 | 2021-05-17T15:12:00 | 2021-05-17T15:12:00 | 362,742,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.chenzejie.springcloud.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RestController
public class OrderNacosController {
@Autowired
private RestTemplate restTemplate;
@Value("${service-url.nacos-user-service}")
private String serverURL;
@GetMapping(value = "/consumer/payment/nacos/{id}")
public String paymentInfo(@PathVariable("id") Integer id) {
return restTemplate.getForObject(serverURL + "/payment/nacos/" + id,String.class);
}
}
| [
"[email protected]"
]
| |
be70bc0fdb0a32fb28b00bfcc327fe1398e4af72 | aa65801f91700d89d7c2704dce06376f2dd1e5ce | /src/main/java/com/nicholasadamou/demo/Application.java | 57baf941c94c539183a2e5297bf177e94c80efbc | []
| no_license | nicholasadamou/jwt-spring-security-demo | cbe186c384400dac802c51ea74fbd97ac93f1756 | 268bfd0331a73ac945f140a74b6837588980e77d | refs/heads/master | 2023-04-04T05:38:52.381761 | 2021-03-26T10:11:28 | 2021-03-26T10:11:28 | 351,601,962 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package com.nicholasadamou.demo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import static org.springframework.boot.SpringApplication.run;
/**
* Starting point of the application
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
run(Application.class, args);
}
}
| [
"[email protected]"
]
| |
f6c91f683456f5e6ea654f63b7e31ee708f20332 | e968a6c69e8ba517ff2aadb573c704ef1618734d | /src/main/java/com/example/adminpage/model/network/response/AdminUserApiResponse.java | 06737d6be6cc9b8d203fea4759ee9bef63edfead | []
| no_license | Lee-JaeHyuk/SpringBoot-adminpage | a0bf494d1abc543a3790577f2d13c9b7e27214c2 | 1046d4cd8864048abad1c377171ca7cb33e13a07 | refs/heads/master | 2023-06-19T21:29:00.811243 | 2021-07-22T14:26:25 | 2021-07-22T14:26:25 | 336,777,137 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.example.adminpage.model.network.response;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
public class AdminUserApiResponse {
private Long id;
private String account;
private String password;
private String status;
private String role;
private LocalDateTime lastLoginAt;
private LocalDateTime passwordUpdatedAt;
private int loginFailCount;
private LocalDateTime registeredAt;
private LocalDateTime unregisteredAt;
}
| [
"[email protected]"
]
| |
7d1fc45e92ac465a5c9e38eb853e469272938d17 | 42bb692d9140736c468e7ae328564c12b830b4be | /bitcamp-javabasic/src/step13/ex1/Member.java | 7fc1f331675b8e8e64d8c3586a407c2d32460004 | []
| no_license | kimkwanhee/bitcamp | b047f4cc391d2c43bad858f2ffb4f3a6a3779aa2 | 0245693f83b06d773365b9b5b6b3d4747877d070 | refs/heads/master | 2021-01-24T10:28:06.247239 | 2018-08-20T03:13:18 | 2018-08-20T03:13:18 | 123,054,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package step13.ex1;
public class Member {
String name;
int age;
public Member(String name, int age) {
this.name = name;
this.age = age;
}
@Override
public String toString() {
return "Member [name=" + name + ", age=" + age + "]";
}
} | [
"[email protected]"
]
| |
7171be9417f7814ca1eea672d0298e37b73c81bb | 9641cb1d6caf845081ec59575b9f134c29c39d53 | /src/com/peter/android/Ruler.java | bc3cfa1e9b3dcb574bc5e7fe2aa504c4f5f937fd | []
| no_license | tmdpzc/PeterAndroidUtil | 19c8cd22af7cab00b662b04765c3ca2749304e41 | c2e0888fa6c61bef72e2dec872da427a6a1dfbeb | refs/heads/master | 2016-09-05T19:22:38.029576 | 2013-11-08T12:25:05 | 2013-11-08T12:25:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package com.peter.android;
import com.peter.asyncui.core.EventManager;
import com.peter.asyncui.core.EventMangerImpl;
import com.peter.asyncui.watcher.WatcherManager;
import com.peter.asyncui.watcher.WatcherManagerHandlerImpl;
public class Ruler {
public static EventManager em() {
return EventMangerImpl.getInstance();
}
public static ConfigManager cm() {
return ConfigManager.getInstance();
}
public static WatcherManager wm() {
return WatcherManagerHandlerImpl.getInstance();
}
}
| [
"[email protected]"
]
| |
3200c03dd5b6b95e4c422d0191e4a2689f395bd8 | 45374faf42df237c195cbf895f7a598857b4d457 | /src/test/java/com/github/fartherp/shiro/CodecTypeTest.java | c755b1354e9d7739abcf3d2e5d375c2554bdd64b | [
"Apache-2.0"
]
| permissive | fartherp/shiro-redisson | 837d2704dee6ecf988e42fcf25162415fc65238c | 2ea0872835602cecd22578eb3cc261586065df55 | refs/heads/master | 2023-08-03T10:52:00.626068 | 2020-05-22T01:14:17 | 2020-05-22T01:14:17 | 163,499,832 | 8 | 4 | Apache-2.0 | 2023-07-24T12:46:37 | 2018-12-29T09:55:22 | Java | UTF-8 | Java | false | false | 3,972 | java | /**
* Copyright (c) 2019 CK.
*
* 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.github.fartherp.shiro;
import org.redisson.client.codec.ByteArrayCodec;
import org.redisson.client.codec.Codec;
import org.redisson.client.codec.LongCodec;
import org.redisson.client.codec.StringCodec;
import org.redisson.codec.AvroJacksonCodec;
import org.redisson.codec.CborJacksonCodec;
import org.redisson.codec.FstCodec;
import org.redisson.codec.IonJacksonCodec;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.codec.KryoCodec;
import org.redisson.codec.LZ4Codec;
import org.redisson.codec.MsgPackJacksonCodec;
import org.redisson.codec.SerializationCodec;
import org.redisson.codec.SmileJacksonCodec;
import org.redisson.codec.SnappyCodec;
import org.redisson.codec.SnappyCodecV2;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
/**
* Created by IntelliJ IDEA.
*
* @author CK
* @date 2019/6/18
*/
public class CodecTypeTest {
@Test
public void testFstCodecGetCodec() {
CodecType fst = CodecType.FST_CODEC;
Codec codec = fst.getCodec();
assertTrue(codec instanceof FstCodec);
assertEquals(fst.dependencyPackageName, "default");
}
@Test
public void testJsonJacksonCodecGetCodec() {
Codec codec = CodecType.JSON_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof JsonJacksonCodec);
}
@Test
public void testSerializationCodecGetCodec() {
Codec codec = CodecType.SERIALIZATION_CODEC.getCodec();
assertTrue(codec instanceof SerializationCodec);
}
@Test
public void testSnappyCodecGetCodec() {
Codec codec = CodecType.SNAPPY_CODEC.getCodec();
assertTrue(codec instanceof SnappyCodec);
}
@Test
public void testSnappyCodecV2GetCodec() {
Codec codec = CodecType.SNAPPY_CODEC_V_2.getCodec();
assertTrue(codec instanceof SnappyCodecV2);
}
@Test
public void testStringCodecGetCodec() {
Codec codec = CodecType.STRING_CODEC.getCodec();
assertTrue(codec instanceof StringCodec);
}
@Test
public void testLongCodecGetCodec() {
Codec codec = CodecType.LONG_CODEC.getCodec();
assertEquals(codec, LongCodec.INSTANCE);
}
@Test
public void testByteArrayCodecGetCodec() {
Codec codec = CodecType.BYTE_ARRAY_CODEC.getCodec();
assertEquals(codec, ByteArrayCodec.INSTANCE);
}
@Test
public void testAvroJacksonCodecGetCodec() {
Codec codec = CodecType.AVRO_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof AvroJacksonCodec);
}
@Test
public void testSmileJacksonCodecGetCodec() {
Codec codec = CodecType.SMILE_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof SmileJacksonCodec);
}
@Test
public void testCborJacksonCodecGetCodec() {
Codec codec = CodecType.CBOR_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof CborJacksonCodec);
}
@Test
public void testIonJacksonCodecGetCodec() {
Codec codec = CodecType.ION_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof IonJacksonCodec);
}
@Test
public void testKryoCodecGetCodec() {
Codec codec = CodecType.KRYO_CODEC.getCodec();
assertTrue(codec instanceof KryoCodec);
}
@Test
public void testMsgPackJacksonCodecGetCodec() {
Codec codec = CodecType.MSG_PACK_JACKSON_CODEC.getCodec();
assertTrue(codec instanceof MsgPackJacksonCodec);
}
@Test
public void testLZ4CodecGetCodec() {
Codec codec = CodecType.LZ_4_CODEC.getCodec();
assertTrue(codec instanceof LZ4Codec);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.