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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0a8084fa836a979f9f41ceb3193535de057d4d76 | dc7f14bde3bf01b20ddb293ff5e627db32813198 | /src/main/java/org/example/web/view/impl/ShotInfoViewImpl.java | 7e19a8a0f424883d25637af092c8cdd1555c77a3 | [] | no_license | storytime/gwt-task-infps | ed1d64443d45180b243be5ef8f75923f9a442de3 | 55a1a7aa9470591744d2b89c3447e9a91b004cf4 | refs/heads/master | 2020-06-04T07:08:32.235470 | 2015-10-08T11:20:08 | 2015-10-08T11:20:08 | 42,679,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,607 | java | package org.example.web.view.impl;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.TextBox;
import org.example.event.handler.RowSelectionEvenHandler;
import org.example.event.impl.RowSelectionEvent;
import org.example.model.User;
import org.example.web.ObjectsHolder;
import org.example.web.presenter.Presenter;
import org.example.web.presenter.ShotInfoPresenter;
import org.example.web.view.ShotInfoView;
import org.fusesource.restygwt.client.Method;
import org.fusesource.restygwt.client.MethodCallback;
public class ShotInfoViewImpl extends Composite implements ShotInfoView {
private ShotInfoPresenter presenter;
private static final String EMPTY_STRING = "";
@UiField(provided = true)
public TextBox email;
@UiField(provided = true)
public TextBox surname;
@Override
public void setPresenter(Presenter presenter) {
this.presenter = (ShotInfoPresenter) presenter;
}
interface ShotInfoUiBinder extends UiBinder<HTMLPanel, ShotInfoViewImpl> {
}
private static ShotInfoUiBinder ourUiBinder = GWT.create(ShotInfoUiBinder.class);
public ShotInfoViewImpl() {
initTextBoxes();
addEventBusHandlers();
initWidget(ourUiBinder.createAndBindUi(this));
}
private void initTextBoxes() {
email = new TextBox();
surname = new TextBox();
}
private void addEventBusHandlers() {
ObjectsHolder.getEventBus().addHandler(RowSelectionEvent.TYPE, new RowSelectionEvenHandler() {
@Override
public void select(RowSelectionEvent event) {
final Integer userId = event.getUserId();
if (userId == null) {
email.setValue(EMPTY_STRING);
surname.setValue(EMPTY_STRING);
return;
} else {
presenter.loadUserData(userId, new MethodCallback<User>() {
@Override
public void onFailure(Method method, Throwable throwable) {
}
@Override
public void onSuccess(Method method, User user) {
email.setText(user.getEmail());
surname.setText(user.getSurName());
}
});
}
}
});
}
} | [
"[email protected]"
] | |
b2abd923ffa2d94ff2b655b030cbaf46c804a111 | a47bfcf728e13cfef4a37c0b04b752bb53789dd1 | /dsmlean-consumer/src/main/java/org/dsm/DsmleanConsumer.java | cbd17e60073b4f8de4d2122bc9901079c0c35b72 | [] | no_license | lbingk/dsmlean | 59901fa6c40947687b1031fe2517ae93b7be267c | 3b512c5c146f9aedfbf0a385d042a9ee58c6e299 | refs/heads/master | 2022-07-02T12:03:50.411699 | 2019-10-18T06:45:09 | 2019-10-18T06:45:10 | 214,589,942 | 0 | 0 | null | 2022-06-29T19:44:06 | 2019-10-12T06:18:39 | Java | UTF-8 | Java | false | false | 607 | java | package org.dsm;
import com.alibaba.dubbo.spring.boot.annotation.EnableDubboConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
/**
* @author luobingkai
* @create 2019/10/11
* @since 1.0.0
*/
@SpringBootApplication
@EnableDubboConfiguration
@ImportResource(locations = "classpath:META-INF/dubbo/dubbo-consumer.xml")
public class DsmleanConsumer {
public static void main(String[] args) {
SpringApplication.run(DsmleanConsumer.class);
}
}
| [
"[email protected]"
] | |
7d576789ceb934770644eea4edbb998fe7aa32ad | a217123228e3015da161eebb1848bd39081e7095 | /marathon-javafx/marathon-javafx-recorder/src/main/java/net/sourceforge/marathon/javafxrecorder/component/RIgnoreComponent.java | 6e200f30b828caa940f998be1b661e5095069e6a | [
"Apache-2.0"
] | permissive | matamehta/marathonv5 | 7455c90817e7b9bcb07e9fc88ceddbe5890b35e6 | abb640eb2a447a45560351f4c77113a052064688 | refs/heads/master | 2021-01-25T14:49:33.496503 | 2018-02-12T07:06:56 | 2018-02-12T07:06:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,560 | java | /*******************************************************************************
* Copyright 2016 Jalian Systems Pvt. Ltd.
*
* 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 net.sourceforge.marathon.javafxrecorder.component;
import java.util.logging.Logger;
import javafx.geometry.Point2D;
import javafx.scene.Node;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
import net.sourceforge.marathon.javafxrecorder.IJSONRecorder;
import net.sourceforge.marathon.javafxrecorder.JSONOMapConfig;
public class RIgnoreComponent extends RFXComponent {
public static final Logger LOGGER = Logger.getLogger(RIgnoreComponent.class.getName());
public RIgnoreComponent(Node source, JSONOMapConfig omapConfig, Point2D point, IJSONRecorder recorder) {
super(source, omapConfig, point, recorder);
}
@Override protected void mousePressed(MouseEvent me) {
}
@Override protected void keyPressed(KeyEvent ke) {
}
}
| [
"[email protected]"
] | |
9a4da3d24262b92121954bffd44cfbedd8f4b7c5 | d77964aa24cfdca837fc13bf424c1d0dce9c70b9 | /spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/PortProvider.java | 158d97a6a371004ce01ec4dfcbe894893ee8582c | [] | no_license | Suryakanta97/Springboot-Project | 005b230c7ebcd2278125c7b731a01edf4354da07 | 50f29dcd6cea0c2bc6501a5d9b2c56edc6932d62 | refs/heads/master | 2023-01-09T16:38:01.679446 | 2018-02-04T01:22:03 | 2018-02-04T01:22:03 | 119,914,501 | 0 | 1 | null | 2022-12-27T14:52:20 | 2018-02-02T01:21:45 | Java | UTF-8 | Java | false | false | 1,001 | java | /*
* Copyright 2012-2017 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 org.springframework.boot.devtools.tunnel.server;
/**
* Strategy interface to provide access to a port (which may change if an existing
* connection is closed).
*
* @author Phillip Webb
* @since 1.3.0
*/
@FunctionalInterface
public interface PortProvider {
/**
* Return the port number.
*
* @return the port number
*/
int getPort();
}
| [
"[email protected]"
] | |
395f161b7bb11c1672548766f36c976a6898c47a | 52c86c289fc5647ca1569dad22a03c8068e8cf71 | /testWorkplace/myjava/src/builder/HouseBuilder.java | 2b6b301a02fe8c34ad0930fe2352e0cf703294df | [] | no_license | yyCheno/java | 7caced747ceae19c6bf716c5be4a669c3cff5469 | 6114e31d505721e0e92b7c244ba3910a594d1953 | refs/heads/master | 2023-03-23T17:10:07.945110 | 2021-03-21T15:56:13 | 2021-03-21T15:56:13 | 318,528,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package builder;
public abstract class HouseBuilder {
protected House house = new House();
public abstract void buildBase();
public abstract void buildWall();
public abstract void roofed();
public House buildHouse() {
return house;
}
}
| [
"[email protected]"
] | |
322889b228786c8063693f45e17f72d8552a4241 | 4ba232784c97be8796044e4bfe297c8936a5f0ff | /pet2/app/src/main/java/com/test/pet/bean/User.java | cacab20fb2350697331faae619a423d5dee5d896 | [] | no_license | one-xianyu/pet | 6d31c7175e7cd76330b4267e3dc6a9ee219a25c2 | ec2c6eb7fcfd7b4ff26b31477deb253e48811c19 | refs/heads/master | 2021-09-12T14:04:59.197323 | 2018-04-17T11:33:43 | 2018-04-17T11:33:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,062 | java | /**
*
*/
package com.test.pet.bean;
/**
* @author 黄东东
* @date 2017年10月4日
* @version 1.0
* @Description 这是user用户实体类
*/
public class User {
private Integer uid;
private String username;
private String password;
private String sex;
private String city;
private String address;
private String email;
private String tel;
private byte[] image;
private String petid;
private String petname;
private String petage;
private String petsex;
private String petcategory;
private byte[] petimage;
private String freeze;
/**
* 无参构造器
*/
public User() {
}
/**
* 全部参数的构造器
*/
public User(Integer uid, String username, String password, String sex, String city, String address, String email,
String tel, byte[] image, String petid, String petname, String petage, String petsex, String petcategory,
byte[] petimage) {
this.uid = uid;
this.username = username;
this.password = password;
this.sex = sex;
this.city = city;
this.address = address;
this.email = email;
this.tel = tel;
this.image = image;
this.petid = petid;
this.petname = petname;
this.petage = petage;
this.petsex = petsex;
this.petcategory = petcategory;
this.petimage = petimage;
}
public User(Integer uid, String username, String password, String sex, String city, String address, String email,
String tel, byte[] image, String petname, String petage, String petsex, String petcategory,
byte[] petimage) {
this.uid = uid;
this.username = username;
this.password = password;
this.sex = sex;
this.city = city;
this.address = address;
this.email = email;
this.tel = tel;
this.image = image;
this.petname = petname;
this.petage = petage;
this.petsex = petsex;
this.petcategory = petcategory;
this.petimage = petimage;
}
public User(String username, String password,String tel,String email) {
this.username = username;
this.password = password;
this.email = email;
this.tel = tel;
}
public User(String username, String password) {
this.username = username;
this.password = password;
}
/**
* 不含uid的构造器
*/
public User(String username, String password, String sex, String city, String address, String email,
String tel, byte[] image, String petid, String petname, String petage, String petsex, String petcategory,
byte[] petimage) {
this.username = username;
this.password = password;
this.sex = sex;
this.city = city;
this.address = address;
this.email = email;
this.tel = tel;
this.image = image;
this.petid = petid;
this.petname = petname;
this.petage = petage;
this.petsex = petsex;
this.petcategory = petcategory;
this.petimage = petimage;
}
/**
* @return the uid
*/
public Integer getUid() {
return uid;
}
/**
* @param uid the uid to set
*/
public void setUid(Integer uid) {
this.uid = uid;
}
/**
* @return the username
*/
public String getUsername() {
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the sex
*/
public String getSex() {
return sex;
}
/**
* @param sex the sex to set
*/
public void setSex(String sex) {
this.sex = sex;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the tel
*/
public String getTel() {
return tel;
}
/**
* @param tel the tel to set
*/
public void setTel(String tel) {
this.tel = tel;
}
/**
* @return the image
*/
public byte[] getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(byte[] image) {
this.image = image;
}
/**
* @return the petid
*/
public String getPetid() {
return petid;
}
/**
* @param petid the petid to set
*/
public void setPetid(String petid) {
this.petid = petid;
}
/**
* @return the petname
*/
public String getPetname() {
return petname;
}
/**
* @param petname the petname to set
*/
public void setPetname(String petname) {
this.petname = petname;
}
/**
* @return the petage
*/
public String getPetage() {
return petage;
}
/**
* @param petage the petage to set
*/
public void setPetage(String petage) {
this.petage = petage;
}
/**
* @return the petsex
*/
public String getPetsex() {
return petsex;
}
/**
* @param petsex the petsex to set
*/
public void setPetsex(String petsex) {
this.petsex = petsex;
}
/**
* @return the petcategory
*/
public String getPetcategory() {
return petcategory;
}
/**
* @param petcategory the petcategory to set
*/
public void setPetcategory(String petcategory) {
this.petcategory = petcategory;
}
/**
* @return the blob
*/
public byte[] getpetimage() {
return petimage;
}
/**
* @param blob the blob to set
*/
public void setBlob(byte[] petimage) {
this.petimage = petimage;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "User [uid=" + uid + ", username=" + username + ", password=" + password + ", sex=" + sex + ", city=" + city
+ ", address=" + address + ", email=" + email + ", tel=" + tel + ", image=" + image + ", petid=" + petid
+ ", petname=" + petname + ", petage=" + petage + ", petsex=" + petsex + ", petcategory=" + petcategory
+ ", petimage=" + petimage + "]";
}
/**
* @return the freeze
*/
public String getFreeze() {
return freeze;
}
/**
* @param freeze the freeze to set
*/
public void setFreeze(String freeze) {
this.freeze = freeze;
}
}
| [
"[email protected]"
] | |
c0760fd98ff311a4cf6574d48ebe4732e4ac0808 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/neo4j--neo4j/1ba7202f896b04d53bb14a68972dca170895617c/before/TestShellServerExtension.java | 93d53d645d4ff97c6b924748121916acbe40d0f8 | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,688 | java | /*
* Copyright (c) 2002-2015 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.shell.impl;
import java.util.Map;
import org.neo4j.helpers.Settings;
import org.neo4j.kernel.extension.KernelExtensionFactoryContractTest;
import org.neo4j.shell.ShellSettings;
public class TestShellServerExtension extends
KernelExtensionFactoryContractTest
{
public TestShellServerExtension()
{
super( ShellServerExtensionFactory.KEY, ShellServerExtensionFactory.class );
}
@Override
protected Map<String, String> configuration( boolean shouldLoad, int instance )
{
Map<String, String> configuration = super.configuration( shouldLoad, instance );
if ( shouldLoad )
{
configuration.put( ShellSettings.remote_shell_enabled.name(), Settings.TRUE );
configuration.put( ShellSettings.remote_shell_name.name(), "neo4j-shell-" + instance );
}
return configuration;
}
} | [
"[email protected]"
] | |
998be8c99228add2fe0f37563a57f1544afdde8e | 1fdaaccf1fff4c4825fb1519bf90fdca4af498c1 | /src/main/java/de/ludwig/finx/command/Stackable.java | 9cbef036bbe0f53d354f65f4cb031b8331a8373a | [] | no_license | laubfall/finx | adde642df270d1858ecb0aa131f06c7c3fac1750 | e764632d24ac94c83e3ff358e90dd1ad0e89a3bf | refs/heads/master | 2021-01-01T15:36:36.830654 | 2013-04-10T15:20:12 | 2013-04-10T15:20:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package de.ludwig.finx.command;
import java.util.List;
/**
* Steht noch nicht fest ob das bleibt.
*
* Ist dazu gedacht, spezielle Commands vor dem Command laufen zu lassen welches dieses interface
* implementiert.
*
* @author Daniel
*
*/
public interface Stackable
{
/**
* Commands that should run before the implementing command is executed
*
* @return
*/
List<Command<?>> runTheseCmdsBefore();
/**
* called before the implementing command is executed.
*
* @param payload
* the payloads of all commands that were returned by {@link #runTheseCmdsBefore()}
*/
void beforeExecute(final List<Object> payload);
}
| [
"[email protected]"
] | |
303d766916dd7016d70ec671cf3f965634a33791 | 7ff7d9f7902ce8e7745613c9028264233611e9ce | /LT_IngegneriaDelSw/eclipseWorkspace/it.unibo.envBaseAwt/src/it/unibo/baseEnv/basicgui/input/EchoListener.java | 2228a72fc89522344877ea63d404e13cb150cdbb | [] | no_license | metaphori/uni-projects | bca9a13204a25cee4ab778c1441cd27ba2485e4e | c2de0bd679037126fcc06726cf24d52944f738eb | refs/heads/master | 2021-01-10T06:30:15.111227 | 2017-05-27T09:22:30 | 2017-05-27T09:22:30 | 55,056,709 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package it.unibo.baseEnv.basicgui.input;
import it.unibo.is.interfaces.IBasicEnv;
/**
* A listener of button events that writes the event name (action command) on
* the virtual output device of the environment <tt>env</tt> given in the
* construction phase.
* @author <em>ANatali</em>, DEIS, University of Bologna
*/
public class EchoListener implements java.awt.event.ActionListener{
protected IBasicEnv env;
public EchoListener( IBasicEnv env ){
this.env = env;
}
/**
* Reacts to a button click by echoing on the virtual output device
* the name of the button.
*/
public void actionPerformed(java.awt.event.ActionEvent evt){
String arg=evt.getActionCommand();
env.println(arg);
}
}//ButtonListener | [
"[email protected]"
] | |
cf7361098ba93e73275926d0254de5f881042da2 | 3129e3ccb28421269aa6472e3014590703af60cf | /medclin/src/main/java/br/com/medclin/model/Usuario.java | aa2f2efec290ab5b3a5e7d38d28d7f83dbe885ff | [] | no_license | marceloau/medclin | 9aec748bd272073961817d29509deafff6a6ed49 | 2e3d7f8e8580037f9cd9304b185c3c43262bb99f | refs/heads/master | 2020-03-28T18:11:37.752539 | 2019-04-03T03:22:46 | 2019-04-03T03:22:46 | 148,859,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,030 | java | package br.com.medclin.model;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import br.com.medclin.common.PerfilEnum;
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1)
public class Usuario implements UserDetails {
/**
*
*/
private static final long serialVersionUID = 1L;
public Usuario() {}
public Usuario(BigInteger codigoUsuario, String email, String login, String senha, Pessoa pessoa, Set<PerfilEnum> perfis) {
super();
this.codigoUsuario = codigoUsuario;
this.email = email;
this.login = login;
this.pessoa = pessoa;
this.senha = senha;
this.perfis = perfis.stream().map(perfilRetorno -> perfilRetorno.getCodigo()).collect(Collectors.toSet());
}
public Usuario(Usuario usuario) {
this.codigoUsuario = usuario.getCodigoUsuario();
this.email = usuario.getEmail();
this.login = usuario.getLogin();
this.pessoa = usuario.getPessoa();
this.senha = usuario.getSenha();
this.perfis = usuario.getPerfis().stream().map(perfilRetorno -> perfilRetorno.getCodigo()).collect(Collectors.toSet());
this.flagAtivo = usuario.getFlagAtivo();
}
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "USUARIO_SEQ")
@Column(name = "codigo_usuario", nullable = false, updatable = false, precision = 22, scale = 0)
private BigInteger codigoUsuario;
@Column(unique=true, nullable = false)
private String email;
@Column(unique=true, nullable = false)
private String login;
/**
* Bcrypt encode 10 Rounds
* encode: https://www.browserling.com/tools/bcrypt
*/
@Column(nullable = false)
private String senha;
@OneToOne
@JoinColumn(name = "codigo_pessoa", referencedColumnName = "codigo_pessoa", insertable = true, updatable = true)
private Pessoa pessoa;
@ElementCollection(fetch=FetchType.EAGER)
@CollectionTable(name="GrupoAcesso")
private Set<Integer> perfis = new HashSet<>();
private String flagAtivo;
private String usuarioUltimaAlteracao;
@Temporal(TemporalType.TIMESTAMP)
private Date dataUltimaAlteracao;
@Temporal(TemporalType.TIMESTAMP)
private Date dataCriacao;
public BigInteger getCodigoUsuario() {
return codigoUsuario;
}
public void setCodigoUsuario(BigInteger codigoUsuario) {
this.codigoUsuario = codigoUsuario;
}
public Set<PerfilEnum> getPerfis() {
return perfis.stream().map(perfilRetorno -> PerfilEnum.toEnum(perfilRetorno)).collect(Collectors.toSet());
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public Pessoa getPessoa() {
return pessoa;
}
public void setPessoa(Pessoa pessoa) {
this.pessoa = pessoa;
}
public String getFlagAtivo() {
return flagAtivo;
}
public void setFlagAtivo(String flagAtivo) {
this.flagAtivo = flagAtivo;
}
public String getUsuarioUltimaAlteracao() {
return usuarioUltimaAlteracao;
}
public void setUsuarioUltimaAlteracao(String usuarioUltimaAlteracao) {
this.usuarioUltimaAlteracao = usuarioUltimaAlteracao;
}
public Date getDataUltimaAlteracao() {
return dataUltimaAlteracao;
}
public void setDataUltimaAlteracao(Date dataUltimaAlteracao) {
this.dataUltimaAlteracao = dataUltimaAlteracao;
}
public Date getDataCriacao() {
return dataCriacao;
}
public void setDataCriacao(Date dataCriacao) {
this.dataCriacao = dataCriacao;
}
public boolean hasRole(PerfilEnum perfil) {
return this.perfis.contains(perfil.getCodigo());
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return null;
}
@Override
public String getPassword() {
return senha;
}
@Override
public String getUsername() {
return login;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"[email protected]"
] | |
6cfb7ab25a9439a3fc60b8b308420b81fcd3525a | 9099901f3edfc44aab82b9eb87a030f6088ab352 | /app/src/main/java/com/remon/books/Data/Data_Join_People.java | dc526b73cb8a3677c36f0ea9d04c1fbd0ccf8f1c | [] | no_license | superphs333/Books_ | 65c09f027350724ab942b27d32e62cadea8470f8 | c2ebcd123316d53bd05717d680606cf91fd881b3 | refs/heads/master | 2023-05-05T06:06:40.431746 | 2021-05-17T15:38:17 | 2021-05-17T15:38:17 | 324,981,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,341 | java | package com.remon.books.Data;
public class Data_Join_People {
boolean follow; // 내가 상대를 팔로우 하고 있는지 (팔로우 하고 있다면 : 1, 아니라면 : 0)
String nickname, profile_url,login_value;
int room_idx;
public Data_Join_People(boolean follow, String nickname, String profile_url, String login_value, int room_idx) {
this.follow = follow;
this.nickname = nickname;
this.profile_url = profile_url;
this.login_value = login_value;
this.room_idx = room_idx;
}
public boolean isFollow() {
return follow;
}
public void setFollow(boolean follow) {
this.follow = follow;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getProfile_url() {
return profile_url;
}
public void setProfile_url(String profile_url) {
this.profile_url = profile_url;
}
public String getLogin_value() {
return login_value;
}
public void setLogin_value(String login_value) {
this.login_value = login_value;
}
public int getRoom_idx() {
return room_idx;
}
public void setRoom_idx(int room_idx) {
this.room_idx = room_idx;
}
}
| [
"[email protected]"
] | |
71100ef41f8987fdbbe95c2fcf948fc32d2353ec | e19959dc8f94e45570ce636cde0d2b4a37f11251 | /src/main/java/com/animalcrossing/tp1_animalcrossing/dao/BatimentDao.java | 474ae4a18aabbfbb648ae34a7d6c11a79a83d240 | [] | no_license | adrienbgcz/animal_crossing | 6aedc504179aecc84172517c57a9da652f66a310 | 2d6e51e58ff9114d7352880e4b652917e15bc08f | refs/heads/main | 2023-07-19T16:08:04.644810 | 2021-09-30T10:00:42 | 2021-09-30T10:00:42 | 410,851,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,050 | java | package com.animalcrossing.tp1_animalcrossing.dao;
import com.animalcrossing.tp1_animalcrossing.map.BatimentMapper;
import com.animalcrossing.tp1_animalcrossing.map.IleMapper;
import com.animalcrossing.tp1_animalcrossing.modele.Batiment;
import com.animalcrossing.tp1_animalcrossing.modele.Ile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;
@Repository
@Transactional
public class BatimentDao extends JdbcDaoSupport {
@Autowired
public BatimentDao(DataSource dataSource) {
this.setDataSource(dataSource);
}
public List<Batiment> getBatimentList(int idIle) {
String sql = BatimentMapper.BASE_SQL + " WHERE id_ile = ? ORDER BY id";
try {
List<Batiment> batimentList = new ArrayList<>();
batimentList = this.getJdbcTemplate().query(sql, new BatimentMapper(), idIle);
return batimentList;
} catch (EmptyResultDataAccessException e) {
return null;
}
}
public Batiment createBatiment(Batiment batiment) {
String sql = BatimentMapper.CREATE_SQL + " VALUES (?,?,?)";
try {
int batiment2 = this.getJdbcTemplate().update(sql,new Object[]{batiment.getNom(), batiment.getIdIle(), batiment.getIdTypeBatiment()});
Batiment batimentToInsert = new Batiment();
batimentToInsert.setNom(batiment.getNom());
batimentToInsert.setIdIle(batiment.getIdIle());
batimentToInsert.setIdTypeBatiment(batiment.getIdTypeBatiment());
return batimentToInsert;
} catch (EmptyResultDataAccessException e) {
return null;
}
}
public Batiment updateBatiment(Batiment batiment) {
String sql = BatimentMapper.UPDATE_SQL + " SET nom = ?, id_ile = ?, id_type_batiment = ? WHERE id = ?";
try {
int batiment2 = this.getJdbcTemplate().update(sql,new Object[]{batiment.getNom(), batiment.getIdIle(), batiment.getIdTypeBatiment(), batiment.getId()});
Batiment batimentToUpdate = new Batiment();
batimentToUpdate.setNom(batiment.getNom());
batimentToUpdate.setIdIle(batiment.getIdIle());
batimentToUpdate.setIdTypeBatiment(batiment.getIdTypeBatiment());
return batimentToUpdate;
} catch (EmptyResultDataAccessException e) {
return null;
}
}
public int deleteBatiment(Batiment batiment) {
String sql = BatimentMapper.DELETE_SQL + " WHERE id = ?";
try {
int batiment2 = this.getJdbcTemplate().update(sql,new Object[]{batiment.getId()});
return batiment2 ;
} catch (EmptyResultDataAccessException e) {
return 0;
}
}
}
| [
"[email protected]"
] | |
2b5d8c914b35db92925dc8a83a1f689f8f900adb | 1003f86b20d07a4df28a32496095dd3f4414298e | /Tarea01Roberto/src/tarea01roberto/Tarea01Roberto.java | 29c0c752c13cd56fbb9e26c5dea8547c857aed64 | [] | no_license | Ale193/tarea01 | 73181b5b6bb8529e9ed84b0f29eabfba21a60ae0 | d41121b65b3af065a358665cfb80880ade436c7e | refs/heads/master | 2021-05-30T16:05:53.514474 | 2016-03-17T20:08:24 | 2016-03-17T20:08:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | 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 tarea01roberto;
/**
*
* @author Alejandro
*/
public class Tarea01Roberto {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"Alejandro@Alejandro-PC"
] | Alejandro@Alejandro-PC |
885b5f212fe431223540ce1d741b31bece1a5f14 | 159ba85ccf6d0484eacd893454ad6a3a4d9af02c | /app/src/main/java/ru/ok/android/ui/search/fragment/SearchResultsAdapter.java | f0a9dd25152928a01084c0dbd8805e5751bc8e8d | [] | no_license | kronar/OK | 71cee4639d090a0883767c4a932cc5bab2058482 | 8883fc78bac291f82e96a10215f5071c9d532b89 | refs/heads/master | 2021-05-31T19:47:54.639316 | 2016-03-25T11:52:52 | 2016-03-25T11:54:37 | 109,688,978 | 1 | 0 | null | 2017-11-06T11:52:48 | 2017-11-06T11:52:48 | null | UTF-8 | Java | false | false | 10,605 | java | package ru.ok.android.ui.search.fragment;
import android.content.Context;
import android.support.v7.widget.RecyclerView.Adapter;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import ru.ok.android.proto.MessagesProto.Message;
import ru.ok.android.ui.adapters.friends.ItemClickListenerControllerProvider;
import ru.ok.android.ui.custom.RecyclerItemClickListenerController;
import ru.ok.android.ui.custom.cards.listcard.CardListAdapter.DividerBlockItem;
import ru.ok.android.ui.custom.cards.listcard.CardListAdapter.DividerItem;
import ru.ok.android.ui.custom.cards.listcard.CardListAdapter.FooterCardItem;
import ru.ok.android.ui.custom.cards.listcard.CardListAdapter.UserCardItem;
import ru.ok.android.ui.custom.cards.listcard.CardViewHolder;
import ru.ok.android.ui.custom.cards.search.CommunityViewsHolder;
import ru.ok.android.ui.custom.cards.search.ExpandViewsHolder;
import ru.ok.android.ui.custom.cards.search.GroupViewsHolder;
import ru.ok.android.ui.custom.cards.search.HeaderTitleViewsHolder;
import ru.ok.android.ui.custom.cards.search.UserViewsHolder;
import ru.ok.android.ui.utils.AdapterItemViewTypeMaxValueProvider;
import ru.ok.android.utils.localization.LocalizationManager;
import ru.ok.model.GroupInfo;
import ru.ok.model.UserInfo;
import ru.ok.model.search.SearchResult;
import ru.ok.model.search.SearchResult.SearchScope;
import ru.ok.model.search.SearchResultCommunity;
import ru.ok.model.search.SearchResultGroup;
import ru.ok.model.search.SearchResultUser;
import ru.ok.model.search.SearchType;
public abstract class SearchResultsAdapter extends Adapter<CardViewHolder> implements ItemClickListenerControllerProvider, AdapterItemViewTypeMaxValueProvider {
private Context context;
private final RecyclerItemClickListenerController itemClickListenerController;
protected final ArrayList<SearchAdapterItem> items;
private OnAdapterItemClickListener onAdapterItemClickListener;
protected final SearchAdapterItemsRecycler recycler;
protected final ArrayList<SearchResult> searchResults;
protected final ArrayList<SearchResultsGroup> searchResultsGroups;
public interface OnAdapterItemClickListener {
void onCommunityClicked(GroupInfo groupInfo);
void onExpandClicked(SearchType searchType);
void onGroupClicked(GroupInfo groupInfo);
void onUserClicked(UserInfo userInfo);
}
protected static final class SearchResultsGroup {
public boolean expandable;
public ArrayList<SearchResult> results;
public SearchScope scope;
public SearchType type;
protected SearchResultsGroup() {
this.results = new ArrayList();
this.expandable = false;
}
}
protected abstract void splitInGroups(ArrayList<SearchResult> arrayList, ArrayList<SearchResultsGroup> arrayList2);
public SearchResultsAdapter(Context context, List<SearchResult> searchResults) {
this.itemClickListenerController = new RecyclerItemClickListenerController();
this.items = new ArrayList();
this.searchResults = new ArrayList();
this.searchResultsGroups = new ArrayList();
this.recycler = new SearchAdapterItemsRecycler();
this.context = context.getApplicationContext();
addResults(searchResults);
}
public int getItemCount() {
return this.items.size();
}
public long getItemId(int position) {
return (long) position;
}
public int getItemViewType(int position) {
return getItemType(getItemInternal(position));
}
public int getItemViewTypeMaxValue() {
return 7;
}
public int getItemType(SearchAdapterItem item) {
if (item.getType() == UserItem.TYPE) {
return 0;
}
if (item.getType() == GroupItem.TYPE) {
return 1;
}
if (item.getType() == HeaderTitleItem.TYPE) {
return 2;
}
if (item.getType() == FooterItem.TYPE) {
return 3;
}
if (item.getType() == ExpandItem.TYPE) {
return 4;
}
if (item.getType() == BlocksDividerItem.TYPE) {
return 5;
}
if (item.getType() == DividerItem.TYPE) {
return 6;
}
if (item.getType() == CommunityItem.TYPE) {
return 7;
}
return -1;
}
private SearchAdapterItem getItemInternal(int position) {
return (SearchAdapterItem) this.items.get(position);
}
public CardViewHolder onCreateViewHolder(ViewGroup parent, int type) {
switch (type) {
case RECEIVED_VALUE:
return new UserViewsHolder(UserCardItem.newViewTypeSearch(parent));
case Message.TEXT_FIELD_NUMBER /*1*/:
return new GroupViewsHolder(GroupItem.newView(parent));
case Message.AUTHORID_FIELD_NUMBER /*2*/:
return new HeaderTitleViewsHolder(HeaderTitleItem.newView(parent));
case Message.TYPE_FIELD_NUMBER /*3*/:
return new CardViewHolder(FooterCardItem.newView(parent));
case Message.CAPABILITIES_FIELD_NUMBER /*4*/:
return new ExpandViewsHolder(ExpandItem.newView(parent));
case Message.UUID_FIELD_NUMBER /*5*/:
return new CardViewHolder(DividerBlockItem.newView(parent));
case Message.REPLYTO_FIELD_NUMBER /*6*/:
return new CardViewHolder(DividerItem.newView(parent));
case Message.ATTACHES_FIELD_NUMBER /*7*/:
return new CommunityViewsHolder(CommunityItem.newView(parent));
default:
return null;
}
}
public void onBindViewHolder(CardViewHolder holder, int position) {
((SearchAdapterItem) this.items.get(position)).bindViewHolder(holder, this);
this.itemClickListenerController.onBindViewHolder(holder, position);
}
public void addResults(List<SearchResult> results) {
if (results != null && !results.isEmpty()) {
this.searchResults.addAll(results);
recycle();
this.items.clear();
this.searchResultsGroups.clear();
splitInGroups(this.searchResults, this.searchResultsGroups);
fillAdapterItems();
this.recycler.clear();
notifyDataSetChanged();
}
}
public void clear() {
this.recycler.clear();
this.items.clear();
this.searchResults.clear();
this.searchResultsGroups.clear();
notifyDataSetChanged();
}
private void recycle() {
if (this.items != null && !this.items.isEmpty()) {
Iterator i$ = this.items.iterator();
while (i$.hasNext()) {
this.recycler.recycle((SearchAdapterItem) i$.next());
}
}
}
private void fillAdapterItems() {
Iterator i$ = this.searchResultsGroups.iterator();
while (i$.hasNext()) {
fillGroup((SearchResultsGroup) i$.next());
}
}
private void fillGroup(SearchResultsGroup group) {
this.items.add(this.recycler.getHeaderTitleItem(getTitleForResultsGroup(group)));
int lastResultIdx = group.results.size() - 1;
for (int i = 0; i < group.results.size(); i++) {
SearchResult result = (SearchResult) group.results.get(i);
if (result.getType() == SearchType.USER) {
this.items.add(this.recycler.getUserItem((SearchResultUser) result));
} else if (result.getType() == SearchType.GROUP) {
this.items.add(this.recycler.getGroupItem((SearchResultGroup) result));
} else if (result.getType() == SearchType.COMMUNITY) {
this.items.add(this.recycler.getCommunityItem((SearchResultCommunity) result));
}
if (i != lastResultIdx) {
this.items.add(this.recycler.getDividerItem());
}
}
if (group.expandable) {
this.items.add(this.recycler.getExpandItemItem(LocalizationManager.getString(getContext(), 2131166564), group.type));
}
this.items.add(this.recycler.getFooterItem());
}
protected String getTitleForResultsGroup(SearchResultsGroup resultsGroup) {
if (resultsGroup.type == SearchType.USER) {
if (resultsGroup.scope == SearchScope.OWN) {
return LocalizationManager.getString(getContext(), 2131166244);
}
return LocalizationManager.getString(getContext(), 2131166805);
} else if (resultsGroup.type == SearchType.GROUP) {
if (resultsGroup.scope == SearchScope.OWN) {
return LocalizationManager.getString(getContext(), 2131166245);
}
return LocalizationManager.getString(getContext(), 2131165961);
} else if (resultsGroup.type != SearchType.COMMUNITY) {
return null;
} else {
if (resultsGroup.scope == SearchScope.OWN) {
return LocalizationManager.getString(getContext(), 2131166243);
}
return LocalizationManager.getString(getContext(), 2131165614);
}
}
public void triggerAdapterItemClick(int position) {
if (this.onAdapterItemClickListener != null) {
SearchAdapterItem item = (SearchAdapterItem) this.items.get(position);
int type = getItemType(item);
if (type == 0) {
this.onAdapterItemClickListener.onUserClicked(((UserItem) item).userSearchResult.getUserInfo());
} else if (type == 1) {
this.onAdapterItemClickListener.onGroupClicked(((GroupItem) item).groupSearchResult.getGroupInfo());
} else if (type == 4) {
this.onAdapterItemClickListener.onExpandClicked(((ExpandItem) item).type);
} else if (type == 7) {
this.onAdapterItemClickListener.onCommunityClicked(((CommunityItem) item).searchResult.getGroupInfo());
}
}
}
public void setOnAdapterItemClickListener(OnAdapterItemClickListener onAdapterItemClickListener) {
this.onAdapterItemClickListener = onAdapterItemClickListener;
}
public Context getContext() {
return this.context;
}
public RecyclerItemClickListenerController getItemClickListenerController() {
return this.itemClickListenerController;
}
protected boolean shouldLoadMore(int position) {
return getItemCount() - position == 6;
}
}
| [
"[email protected]"
] | |
3df28af5ac1c0269af9c9dc78f5ce3bbd096cb82 | f6da6446b327e70de395a53e99919775ca004689 | /gallery-model/src/main/java/lt/insoft/gallery/gallerymodel/repository/PictureRepository.java | 962583f003b49841448efb6c6812f888496a0409 | [] | no_license | MantasVis/PhotoGallery | 2d3a961a8d106020477d22694a3ec78bd9756e33 | 95ce9a0b3539a7d108d5c4eeb71ba15ee2a32769 | refs/heads/master | 2020-04-02T18:01:48.889571 | 2018-10-29T09:38:11 | 2018-10-29T09:38:11 | 154,682,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,876 | java | package lt.insoft.gallery.gallerymodel.repository;
import java.util.List;
import java.util.Set;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import lt.insoft.gallery.gallerymodel.model.Picture;
import lt.insoft.gallery.gallerymodel.model.Tag;
@Repository
public interface PictureRepository extends JpaRepository<Picture, Long> {
List<Picture> getAllBy();
@Query("select p.pictureBytes from Picture p join p.tags t where t.tag_id = :tag")
List<byte[]> getAllByTagsMatches(@Param("tag") Long tag);
@Query("select pictureBytes from Picture where upper(description) like upper(concat('%', :search, '%')) or upper(date) like upper(concat('%', :search, '%'))")
List<byte[]> getAllByDescriptionContaining(@Param("search") String search);
@Query("select p.picture_id from Picture p join p.tags t where t.tag_id = :tag")
List<Long> getPictureIdsByTagsMatches(@Param("tag") Long tag);
@Query("select picture_id from Picture where upper(description) like upper(concat('%', :search, '%')) or upper(date) like upper(concat('%', :search, '%'))")
List<Long> getPictureIdsByDescriptionContaining(@Param("search") String search);
@Query("select p from Picture p where picture_id = :id")
Picture getPictureById(@Param("id") Long id);
@Transactional
@Modifying
@Query("delete from Picture where picture_id = :id")
//Query("select 1 from dual")
void deleteByPicture_id(@Param("id") Long id);
@Query("select p.tags from Picture p where p.picture_id = :id")
Set<Tag> pictureTagsByPictureId(@Param("id") Long id);
} | [
"[email protected]"
] | |
62293b70de44aac59667040fc253ccbd844d4e5e | e4d8c7488f1d30f51e2ddc8261504931ff059319 | /GeniusApp/gen/com/illuminz/geniusapp/R.java | 3ed3045ef72e6a9bc3d1a3a6e210288c1834f439 | [] | no_license | shailyrajput/codeDemo | 5411d8ecc4498e69b67f1c9262568f0682242f94 | 92694132dd67c13493fb576b5653a9cc89d854a0 | refs/heads/master | 2020-03-09T05:50:31.499343 | 2018-04-09T09:06:30 | 2018-04-09T09:06:30 | 128,623,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,597 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.illuminz.geniusapp;
public final class R {
public static final class anim {
public static final int push_down_in=0x7f040000;
public static final int push_down_out=0x7f040001;
public static final int push_up_in=0x7f040002;
public static final int push_up_out=0x7f040003;
public static final int slide_in_left=0x7f040004;
public static final int slide_in_right=0x7f040005;
public static final int slide_out_left=0x7f040006;
public static final int slide_out_right=0x7f040007;
}
public static final class attr {
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dividerWidth=0x7f010000;
}
public static final class color {
public static final int Water_mark=0x7f050001;
public static final int background_color=0x7f050000;
public static final int black=0x7f050003;
public static final int list_row_default_bg=0x7f05000a;
public static final int list_row_pressed_bg=0x7f05000b;
public static final int list_row_selected_bg=0x7f05000c;
public static final int lost_text_color1=0x7f050008;
public static final int lost_text_color2=0x7f050009;
public static final int red_blur=0x7f050005;
public static final int transparent=0x7f050004;
public static final int white=0x7f050002;
public static final int won_text_color=0x7f050007;
public static final int yellow=0x7f050006;
}
public static final class dimen {
public static final int action_button_content_margin=0x7f07000d;
public static final int action_button_margin=0x7f07000e;
public static final int action_button_size=0x7f07000c;
public static final int action_menu_radius=0x7f07000f;
/** Default screen margins, per the Android Design guidelines.
*/
public static final int activity_horizontal_margin=0x7f070000;
public static final int activity_vertical_margin=0x7f070001;
public static final int blue_sub_action_button_content_margin=0x7f070008;
public static final int blue_sub_action_button_size=0x7f070007;
public static final int radius_large=0x7f070009;
public static final int radius_medium=0x7f07000b;
public static final int radius_small=0x7f07000a;
public static final int red_action_button_content_margin=0x7f070005;
public static final int red_action_button_content_size=0x7f070004;
public static final int red_action_button_margin=0x7f070003;
public static final int red_action_button_size=0x7f070002;
public static final int red_action_menu_radius=0x7f070006;
public static final int sub_action_button_content_margin=0x7f070011;
public static final int sub_action_button_size=0x7f070010;
}
public static final class drawable {
public static final int accept=0x7f020000;
public static final int age_selector_bg=0x7f020001;
public static final int back_button_disable=0x7f020002;
public static final int back_button_enable=0x7f020003;
public static final int back_selector_button=0x7f020004;
public static final int back_white=0x7f020005;
public static final int black_red_border_bg=0x7f020006;
public static final int bleck_border_bg=0x7f020007;
public static final int bluestom_toast=0x7f020008;
public static final int button_action=0x7f020009;
public static final int button_action_dark=0x7f02000a;
public static final int button_action_dark_selector=0x7f02000b;
public static final int button_action_dark_touch=0x7f02000c;
public static final int button_action_selector=0x7f02000d;
public static final int button_action_touch=0x7f02000e;
public static final int button_sub_action=0x7f02000f;
public static final int button_sub_action_dark=0x7f020010;
public static final int button_sub_action_dark_selector=0x7f020011;
public static final int button_sub_action_dark_touch=0x7f020012;
public static final int button_sub_action_selector=0x7f020013;
public static final int button_sub_action_touch=0x7f020014;
public static final int camera=0x7f020015;
public static final int close=0x7f020016;
public static final int com_facebook_close=0x7f020017;
public static final int cross=0x7f020018;
public static final int delete=0x7f020019;
public static final int dp=0x7f02001a;
public static final int dp1=0x7f02001b;
public static final int dp2=0x7f02001c;
public static final int drop_down_arrow=0x7f02001d;
public static final int facebook_disable=0x7f02001e;
public static final int facebook_enable=0x7f02001f;
public static final int facebook_selector_button=0x7f020020;
public static final int five=0x7f020021;
public static final int forgot_password_bg=0x7f020022;
public static final int gallery=0x7f020023;
public static final int gender_selector_bg=0x7f020024;
public static final int gender_selector_female=0x7f020025;
public static final int gender_selector_male=0x7f020026;
public static final int genius_logo=0x7f020027;
public static final int genius_text=0x7f020028;
public static final int google_plus_disable=0x7f020029;
public static final int google_plus_enable=0x7f02002a;
public static final int google_plus_selector_button=0x7f02002b;
public static final int ic_launcher=0x7f02002c;
public static final int icon_group=0x7f02002d;
public static final int leaderboard_button_selector=0x7f02002e;
public static final int list_selector_flatcolor=0x7f02002f;
public static final int login=0x7f020030;
public static final int login_box=0x7f020031;
public static final int login_button=0x7f020032;
public static final int login_button_disable=0x7f020033;
public static final int login_button_enable=0x7f020034;
public static final int login_down=0x7f020035;
public static final int login_main_button_disable=0x7f020036;
public static final int login_main_button_enable=0x7f020037;
public static final int login_main_selector_button=0x7f020038;
public static final int login_selector_button=0x7f020039;
public static final int logout=0x7f02003a;
public static final int logout_button=0x7f02003b;
public static final int logout_down=0x7f02003c;
public static final int lost_bg=0x7f02003d;
public static final int lost_icon=0x7f02003e;
public static final int main_play_selector_button=0x7f02003f;
public static final int mask_copy=0x7f020040;
public static final int next_on_profile_disable=0x7f020041;
public static final int next_on_profile_enable=0x7f020042;
public static final int next_selector_button=0x7f020043;
public static final int one=0x7f020044;
public static final int play_again_button_selector=0x7f020045;
public static final int play_again_disable=0x7f020046;
public static final int play_again_enable=0x7f020047;
public static final int play_button=0x7f020048;
public static final int play_button_enable=0x7f020049;
public static final int playagain_selector_button=0x7f02004a;
public static final int plus_selector_button=0x7f02004b;
public static final int question_bg=0x7f02004c;
public static final int red_bg_drawable=0x7f02004d;
public static final int red_plus_button=0x7f02004e;
public static final int red_white_border_bg=0x7f02004f;
public static final int register_bg=0x7f020050;
public static final int rounded_image=0x7f020051;
public static final int signup_bottom_button_disable=0x7f020052;
public static final int signup_bottom_button_enable=0x7f020053;
public static final int signup_disable=0x7f020054;
public static final int signup_enable=0x7f020055;
public static final int signup_main_selector_button=0x7f020056;
public static final int signup_selector_button=0x7f020057;
public static final int small_g_right_corner=0x7f020058;
public static final int splash_screen=0x7f020059;
public static final int start_button=0x7f02005a;
public static final int start_button_enable=0x7f02005b;
public static final int start_selector_button=0x7f02005c;
public static final int ten=0x7f02005d;
public static final int toggle_button_selector=0x7f02005e;
public static final int toggle_button_selector1=0x7f02005f;
public static final int twenty_five=0x7f020060;
public static final int twitter_disable=0x7f020061;
public static final int twitter_enable=0x7f020062;
public static final int twitter_selector_button=0x7f020063;
public static final int two=0x7f020064;
public static final int user1=0x7f020065;
public static final int verify_email_button=0x7f020066;
public static final int white_border_bg=0x7f020067;
public static final int white_corner_round_bg=0x7f020068;
public static final int win_icon=0x7f020069;
public static final int yellow=0x7f02006a;
}
public static final class id {
public static final int MenuList=0x7f0a0022;
public static final int Text=0x7f0a000b;
public static final int TextView_question1=0x7f0a0072;
public static final int TextView_question2=0x7f0a0073;
public static final int TopBar=0x7f0a0024;
public static final int action_settings=0x7f0a00ac;
public static final int animation_layout=0x7f0a0020;
public static final int animation_layout_content=0x7f0a0023;
public static final int animation_layout_sidebar=0x7f0a0021;
public static final int base_layout=0x7f0a0029;
public static final int btn_No=0x7f0a004c;
public static final int btn_Yes=0x7f0a004d;
public static final int btn_accept=0x7f0a008e;
public static final int btn_deny=0x7f0a008d;
public static final int button1=0x7f0a001f;
public static final int cancel=0x7f0a002a;
public static final int centerActionButton=0x7f0a0012;
public static final int checkBox=0x7f0a000c;
public static final int clickbutton=0x7f0a00aa;
public static final int com_facebook_login_activity_progress_bar=0x7f0a000a;
public static final int container=0x7f0a0092;
public static final int dob_txt=0x7f0a0084;
public static final int editTxt_email=0x7f0a0044;
public static final int editTxt_forgotpassword=0x7f0a0010;
public static final int editTxt_name=0x7f0a0089;
public static final int editTxt_password=0x7f0a0046;
public static final int editTxt_search=0x7f0a001e;
public static final int editTxt_verificationCode=0x7f0a008b;
public static final int email_txt=0x7f0a0086;
public static final int fakeView=0x7f0a0018;
public static final int fakeView1=0x7f0a0025;
public static final int gender_txt=0x7f0a0085;
public static final int gridView=0x7f0a003d;
public static final int header=0x7f0a002c;
public static final int image=0x7f0a00a9;
public static final int imageView1=0x7f0a0068;
public static final int imageView_backArrow=0x7f0a0099;
public static final int imageView_camera=0x7f0a002f;
public static final int imageView_gallary=0x7f0a0032;
public static final int image_g=0x7f0a003a;
public static final int image_profile=0x7f0a0015;
public static final int imgNetwork=0x7f0a0014;
public static final int imgView_Next=0x7f0a00a8;
public static final int imgView_Ok=0x7f0a0011;
public static final int imgView_back=0x7f0a0035;
public static final int imgView_facebook=0x7f0a0005;
public static final int imgView_googleplus=0x7f0a0006;
public static final int imgView_leaderboard=0x7f0a00ab;
public static final int imgView_login=0x7f0a0009;
public static final int imgView_logo=0x7f0a0001;
public static final int imgView_playAgain=0x7f0a004f;
public static final int imgView_plus=0x7f0a009c;
public static final int imgView_profilePic=0x7f0a0082;
public static final int imgView_room_bg=0x7f0a0091;
public static final int imgView_signup=0x7f0a0002;
public static final int imgView_twitter=0x7f0a0007;
public static final int imgView_verificetion=0x7f0a008c;
public static final int imgView_won=0x7f0a0051;
public static final int img_cross=0x7f0a006c;
public static final int img_mask_copy=0x7f0a006b;
public static final int img_start=0x7f0a003c;
public static final int invite_btn=0x7f0a0017;
public static final int itemLayout=0x7f0a0093;
public static final int lblListHeader=0x7f0a003e;
public static final int line1=0x7f0a005a;
public static final int line2=0x7f0a005d;
public static final int line3=0x7f0a0060;
public static final int line4=0x7f0a0063;
public static final int line5=0x7f0a0066;
public static final int llayout_buttons=0x7f0a0004;
public static final int mainLayout=0x7f0a0013;
public static final int main_layout=0x7f0a000d;
public static final int match_text=0x7f0a0019;
public static final int menuIcon=0x7f0a0027;
public static final int myHzntListView=0x7f0a006e;
public static final int myListView=0x7f0a001b;
public static final int name_txt=0x7f0a0083;
public static final int nametxt=0x7f0a0094;
public static final int offText=0x7f0a00a6;
public static final int onOffLayout=0x7f0a00a4;
public static final int onText=0x7f0a00a7;
public static final int played_txt=0x7f0a0087;
public static final int progressBar_profile=0x7f0a009d;
public static final int rLayot_ans=0x7f0a0074;
public static final int rLayot_quest=0x7f0a0071;
public static final int rLayout1=0x7f0a0075;
public static final int rLayout2=0x7f0a0078;
public static final int rLayout3=0x7f0a007b;
public static final int rLayout4=0x7f0a007e;
public static final int rLayoutData=0x7f0a006a;
public static final int rLayout_Button=0x7f0a004b;
public static final int rLayout_information=0x7f0a0081;
public static final int rLayout_line=0x7f0a004a;
public static final int rLayout_main=0x7f0a002b;
public static final int rLayout_main1=0x7f0a000e;
public static final int rLayout_scoretxt=0x7f0a0053;
public static final int ranktxt=0x7f0a0096;
public static final int rlayout_Buttons=0x7f0a001d;
public static final int rlayout_Line=0x7f0a001a;
public static final int rlayout_ageDropdown=0x7f0a00a0;
public static final int rlayout_back=0x7f0a0041;
public static final int rlayout_bg=0x7f0a0090;
public static final int rlayout_bottomView=0x7f0a006f;
public static final int rlayout_dropdown=0x7f0a00a1;
public static final int rlayout_edittxt=0x7f0a0043;
public static final int rlayout_edittxt1=0x7f0a0088;
public static final int rlayout_forgotpassword=0x7f0a000f;
public static final int rlayout_gridView=0x7f0a003b;
public static final int rlayout_header=0x7f0a0097;
public static final int rlayout_headerBack=0x7f0a0098;
public static final int rlayout_imageView=0x7f0a009b;
public static final int rlayout_listView=0x7f0a006d;
public static final int rlayout_main=0x7f0a0000;
public static final int rlayout_middleView=0x7f0a0037;
public static final int rlayout_password=0x7f0a0045;
public static final int rlayout_search=0x7f0a001c;
public static final int rlayout_topView=0x7f0a0034;
public static final int rlayout_verificationCode=0x7f0a008a;
public static final int rlayout_wonView=0x7f0a004e;
public static final int rowLayout0=0x7f0a0056;
public static final int rowLayout1=0x7f0a0058;
public static final int rowLayout2=0x7f0a005b;
public static final int rowLayout3=0x7f0a005e;
public static final int rowLayout4=0x7f0a0061;
public static final int rowLayout5=0x7f0a0064;
public static final int rowLayout6=0x7f0a0067;
public static final int scoretxt=0x7f0a0095;
public static final int sliderButtonLayout=0x7f0a0026;
public static final int takePic=0x7f0a002e;
public static final int textView1=0x7f0a0069;
public static final int textView_ageHolder=0x7f0a00a2;
public static final int textView_displayMsg=0x7f0a0049;
public static final int textView_headerText=0x7f0a009a;
public static final int textView_one=0x7f0a002d;
public static final int textView_play=0x7f0a008f;
public static final int textView_players=0x7f0a0036;
public static final int textView_three=0x7f0a0033;
public static final int textView_two=0x7f0a0030;
public static final int title=0x7f0a0028;
public static final int title0=0x7f0a0057;
public static final int title1=0x7f0a0059;
public static final int title2=0x7f0a005c;
public static final int title3=0x7f0a005f;
public static final int title4=0x7f0a0062;
public static final int title5=0x7f0a0065;
public static final int toggleButton=0x7f0a00a5;
public static final int txtView_Date=0x7f0a0040;
public static final int txtView_age=0x7f0a009f;
public static final int txtView_forgotPassword=0x7f0a0048;
public static final int txtView_gameName=0x7f0a003f;
public static final int txtView_gender=0x7f0a00a3;
public static final int txtView_haveAccount=0x7f0a0008;
public static final int txtView_login=0x7f0a0042;
public static final int txtView_photo=0x7f0a009e;
public static final int txtView_show=0x7f0a0047;
public static final int txtView_signWith=0x7f0a0003;
public static final int txtView_youLost=0x7f0a0052;
public static final int txtView_youWon=0x7f0a0050;
public static final int txtView_yourScore1=0x7f0a0054;
public static final int txtView_yourScore2=0x7f0a0055;
public static final int txt_joining_player=0x7f0a0039;
public static final int txt_option_1=0x7f0a0077;
public static final int txt_option_2=0x7f0a007a;
public static final int txt_option_3=0x7f0a007d;
public static final int txt_option_4=0x7f0a0080;
public static final int txt_option_A=0x7f0a0076;
public static final int txt_option_B=0x7f0a0079;
public static final int txt_option_C=0x7f0a007c;
public static final int txt_option_D=0x7f0a007f;
public static final int txt_please_wait=0x7f0a0038;
public static final int txt_timer=0x7f0a0070;
public static final int useExisting=0x7f0a0031;
public static final int user_txt=0x7f0a0016;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int com_facebook_login_activity_layout=0x7f030001;
public static final int drop_down_list=0x7f030002;
public static final int forgot_password_dialog=0x7f030003;
public static final int fragment_menu_with_custom_action_button=0x7f030004;
public static final int friend_item=0x7f030005;
public static final int friend_list_row=0x7f030006;
public static final int friend_request_screen=0x7f030007;
public static final int friend_screen=0x7f030008;
public static final int home_screen=0x7f030009;
public static final int imagepic_or_take_layout=0x7f03000a;
public static final int joining_room_item=0x7f03000b;
public static final int joining_room_screen=0x7f03000c;
public static final int list_group=0x7f03000d;
public static final int list_item=0x7f03000e;
public static final int login_screen=0x7f03000f;
public static final int logout_popup=0x7f030010;
public static final int lost_score_screen=0x7f030011;
public static final int menu_list_screen=0x7f030012;
public static final int mycustom_toast=0x7f030013;
public static final int myhorizontal_item=0x7f030014;
public static final int play_screen=0x7f030015;
public static final int profile_screen=0x7f030016;
public static final int register_screen=0x7f030017;
public static final int request_list_row=0x7f030018;
public static final int room_screen=0x7f030019;
public static final int score_item=0x7f03001a;
public static final int score_screen=0x7f03001b;
public static final int splash_screen=0x7f03001c;
public static final int update_profile_screen=0x7f03001d;
public static final int viewitem=0x7f03001e;
public static final int win_screen=0x7f03001f;
}
public static final class menu {
public static final int main=0x7f090000;
}
public static final class string {
public static final int action_settings=0x7f060004;
public static final int app_id=0x7f060001;
public static final int app_name=0x7f060002;
/**
This file is automatically generated by Crashlytics to uniquely
identify individual builds of your Android application.
Do NOT modify, delete, or commit to source control!
*/
public static final int com_crashlytics_android_build_id=0x7f060000;
public static final int com_facebook_internet_permission_error_message=0x7f060014;
public static final int com_facebook_internet_permission_error_title=0x7f060013;
public static final int com_facebook_loading=0x7f06000c;
public static final int com_facebook_requesterror_password_changed=0x7f06000e;
public static final int com_facebook_requesterror_permissions=0x7f060011;
public static final int com_facebook_requesterror_reconnect=0x7f06000f;
public static final int com_facebook_requesterror_relogin=0x7f060012;
public static final int com_facebook_requesterror_web_login=0x7f060010;
public static final int dont_have_account=0x7f06000a;
public static final int forgot_password=0x7f060009;
public static final int have_account=0x7f060006;
public static final int hello_world=0x7f060003;
public static final int joinRoom=0x7f06000d;
public static final int login=0x7f060007;
public static final int logout_msg=0x7f060016;
public static final int question=0x7f060015;
public static final int sign_with=0x7f060005;
public static final int signup=0x7f060008;
public static final int upload_text=0x7f06000b;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f080000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f080001;
}
public static final class styleable {
/** Defines the custom XML attributes supported for a HorizontalListView
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #HorizontalListView_android_divider android:divider}</code></td><td></td></tr>
<tr><td><code>{@link #HorizontalListView_android_fadingEdgeLength android:fadingEdgeLength}</code></td><td></td></tr>
<tr><td><code>{@link #HorizontalListView_android_requiresFadingEdge android:requiresFadingEdge}</code></td><td></td></tr>
<tr><td><code>{@link #HorizontalListView_dividerWidth com.illuminz.geniusapp:dividerWidth}</code></td><td></td></tr>
</table>
@see #HorizontalListView_android_divider
@see #HorizontalListView_android_fadingEdgeLength
@see #HorizontalListView_android_requiresFadingEdge
@see #HorizontalListView_dividerWidth
*/
public static final int[] HorizontalListView = {
0x010100e0, 0x01010129, 0x010103a5, 0x7f010000
};
/**
<p>This symbol is the offset where the {@link android.R.attr#divider}
attribute's value can be found in the {@link #HorizontalListView} array.
@attr name android:divider
*/
public static final int HorizontalListView_android_divider = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#fadingEdgeLength}
attribute's value can be found in the {@link #HorizontalListView} array.
@attr name android:fadingEdgeLength
*/
public static final int HorizontalListView_android_fadingEdgeLength = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#requiresFadingEdge}
attribute's value can be found in the {@link #HorizontalListView} array.
@attr name android:requiresFadingEdge
*/
public static final int HorizontalListView_android_requiresFadingEdge = 2;
/**
<p>This symbol is the offset where the {@link com.illuminz.geniusapp.R.attr#dividerWidth}
attribute's value can be found in the {@link #HorizontalListView} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.illuminz.geniusapp:dividerWidth
*/
public static final int HorizontalListView_dividerWidth = 3;
};
}
| [
"[email protected]"
] | |
974c907cc51ee855f501fc832ee7a5e7e237b5cb | 7fbb8fca1fab2a33e56e9f899bb327c1e956739e | /Basic5Class/src/network2/thread/Client.java | 4dcd09a8bfcb19e0af6eb0629cb4221d77b79ecd | [] | no_license | jinkstudy/javalearn | 2d86f5ac4f25c8c1269608b74ba9237c237cb3c1 | ce79b094d0f58e3c61b5b606a6f7d1e034d8ad5f | refs/heads/master | 2020-05-16T02:23:36.952887 | 2019-05-23T07:27:26 | 2019-05-23T07:27:26 | 182,628,942 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,205 | java | package network2.thread;
import java.io.*;
import java.net.*;
public class Client{
public final static int PORT = 3333;
public final static String HOST = "192.168.0.34"; //
static int a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
static int b[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
public static void main( String args[] ) {
Socket cl = null;
DataInputStream br = null;
DataOutputStream dos = null;
int result[] = new int[10];
/***********************************************
* 소켓 객체, 입력스트림과 출력 스트림 객체 생성
*/
try{
//1. 소켓 객체 생성
cl = new Socket(HOST,PORT);
//2. 입력 스트림 생성
br = new DataInputStream(cl.getInputStream());
//3. 출력 스트림 생성
dos = new DataOutputStream(cl.getOutputStream());
} catch ( Exception ex ) {
System.out.println("Error is " + ex );
}
/***********************************************
* 숫자 배열을 서버에 전송
*/
try{
for( int i=0; i<a.length ; i++ ){
// 1. a 배열을 서버에 전송
dos.writeInt(a[i]);
}
for( int i=0; i<b.length ; i++ ){
// 2. b 배열을 서버에 전송
dos.writeInt(b[i]);
}
} catch( Exception ex ) {
System.out.println("error writing to server.." + ex );
}
/***********************************************
* 서버로부터 결과를 읽어 옴
*/
try{
for( int i=0 ; i<result.length; i++ ){
// 1. 서버에서 읽어와서 result 배열에 저장
result[i] = br.readInt();
}
} catch ( Exception ex ) {
ex.printStackTrace();
}
/***********************************************
* 결과를 화면에 출력
*/
System.out.println("The sum of the two arrays : " );
for( int i=0 ; i < result.length ; i++ )
System.out.println( result[i] + " " );
/***********************************************
* 출력 스트림, 입력 스트림, 소켓 객체 닫기
*/
try{
// 1. 출력 스트림 닫기
dos.close();
// 2. 입력 스트림 닫기
br.close();
// 3. 소켓 닫기
cl.close();
} catch( Exception ex ) {
System.out.println("Error close.... " + ex );
}
}
} | [
"[email protected]"
] | |
29de18dd0b75586385d187db0f192f967ecc3576 | 35e442cefdb428df94d553ce5ccb2b5ddf716ec2 | /code/src/Studentpg.java | 94487a46498c125283690e121340a22b008d212c | [] | no_license | poohsun/Blockchain-based-Certificate-Validation | cbb05112527e20afc06cb824bb7c9bfea799144b | ebf7589eab406c1fd04c9e6a55fa5dfe445135ff | refs/heads/main | 2023-02-10T15:05:39.451381 | 2021-01-05T20:25:47 | 2021-01-05T20:25:47 | 327,109,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,586 | java |
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class Studentpg
*/
@WebServlet("/Studentpg")
public class Studentpg extends HttpServlet {
private static final long serialVersionUID = 1L;
public Studentpg() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("hello");
String roll= request.getParameter("uname");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/student", "root", "poori");
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from register where Rollno='"+roll+"'");
out.println("hello");
while(rs.next())
{
out.println("<html>");
out.println("<body>");
out.println("<h1 align='center'> <div style=\'background: skyblue;\'> Student Information </div></h1>");
out.println("<table border='1' align='center'>");
out.println("<tr><td> Student Name: "+rs.getString(1).concat(rs.getString(2))+"</td></tr>");
out.println("<tr><td> DOB: "+rs.getString(3)+"</td></tr>");
out.println("<tr><td>Last Completed Grade: "+rs.getString(4)+"</td></tr>");
out.println("<tr><td>School studied in 10th Grade: "+rs.getString(5)+"</td></tr>");
out.println("<tr><td>Phone: "+rs.getString(7)+"</td></tr>");
out.println("<tr><td>E-mail: "+rs.getString(8)+"</td></tr>");
out.println("</table>");
out.println("<a href='http://localhost:3001/block-explorer'> Click here to view certificate </a> <br><br>");
out.println("<a href='institlogin.jsp'>Logout </a> <br><br>");
}
}
catch(Exception e)
{
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
2ca8475b4f4f32f64c89cd82330b617dec8a077d | 624cd5b75023e03731d4ab511117f8e3df5821d0 | /BestMovieByDecade.java | 271735626ce86d28f17f7035455152cc2df402c5 | [] | no_license | jaganathv/Hadoop-Movie-Data-Analysis | 5b96cd2f4f1fd3d220a334afa77a7873b71cad35 | 37a5bb76e65d99aec7b15d272a740ee422e4fe5e | refs/heads/master | 2021-01-17T19:25:52.196519 | 2016-07-26T08:09:45 | 2016-07-26T08:09:45 | 64,202,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,942 | java | package Project1;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import Project1.TextPair;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import com.google.common.collect.Ordering;
import com.google.common.collect.SortedSetMultimap;
import com.google.common.collect.TreeMultimap;
public class BestMovieByDecade
{
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "BestMovieByDecade");
job.setJarByClass(BestMovieByDecade.class);
job.setInputFormatClass(TextInputFormat.class);
job.setMapperClass(movieMapper.class);
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(TextPair.class);
job.setNumReduceTasks(9);
job.setReducerClass(movieReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
// File Input Format
FileInputFormat.addInputPath(job, new Path(args[0]));
// File Output Format
FileOutputFormat.setOutputPath(job, new Path(args[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
class movieMapper extends Mapper<LongWritable, Text, IntWritable, TextPair>
{
@Override
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
{
String delim1 = ";";
String[] line= value.toString().split(delim1);
if((!line[2].equals("Title") && !line[7].equals("Popularity") && !line[0].equals("Year")) &&
(!line[2].equals("STRING") && !line[7].equals("CAT") && !line[0].equals("INT")) &&
(!line[2].equals("") && !line[7].equals("") && !line[0].equals("")))
{
String Movie_Popularity_Year = line[2]+";"+line[7]+";"+line[0];
int Year = Integer.parseInt(line[0]);
if (Year>=1920 && Year<=1929)
{ context.write(new IntWritable(1),new TextPair(new Text(Movie_Popularity_Year),new Text("1920-1929"))); }
else if (Year>=1930 && Year<=1939)
{ context.write(new IntWritable(2),new TextPair(new Text(Movie_Popularity_Year),new Text("1930-1939")));}
else if (Year>=1940 && Year<=1949)
{ context.write(new IntWritable(3),new TextPair(new Text(Movie_Popularity_Year),new Text("1940-1949")));}
else if (Year>=1950 && Year<=1959)
{ context.write(new IntWritable(4),new TextPair(new Text(Movie_Popularity_Year),new Text("1950-1959")));}
else if (Year>=1960 && Year<=1969)
{ context.write(new IntWritable(5),new TextPair(new Text(Movie_Popularity_Year),new Text("1960-1969")));}
else if (Year>=1970 && Year<=1979)
{ context.write(new IntWritable(6),new TextPair(new Text(Movie_Popularity_Year),new Text("1970-1979")));}
else if (Year>=1980 && Year<=1989)
{ context.write(new IntWritable(7),new TextPair(new Text(Movie_Popularity_Year),new Text("1980-1989")));}
else if (Year>=1990 && Year<=1999)
{ context.write(new IntWritable(8),new TextPair(new Text(Movie_Popularity_Year),new Text("1990-1999")));}
else { context.write(new IntWritable(9),new TextPair(new Text(Movie_Popularity_Year),new Text("2000 or greator")));}
}
}
}
class movieReducer extends Reducer<IntWritable,TextPair,Text,Text>
{
String delim2 =";";
String header1 = "MOVIE_YEAR", header3="POPULARITY",header2="";
// Creating SortedSetMultiMap to store values in reverse order
SortedSetMultimap<Integer,String> sortmulMap=TreeMultimap.create(Ordering.natural().reverse(), Ordering.natural());
public void reduce(IntWritable key, Iterable<TextPair> values,Context context) throws IOException, InterruptedException
{
String[] value1 = new String[100];
String value2="";
int value1_pop=0;
for (TextPair val:values)
{
// Storing the Movie, Popularity & Year in Value1 field
value1 = val.getFirst().toString().split(delim2);
value1_pop=Integer.parseInt(value1[1]);
// Storing the Year Range in Value2 field
value2 = val.getSecond().toString();
// Writing the Popularity as key and (Movie & Year) values in value in sortedMap
sortmulMap.put(value1_pop,value1[0]+"\t"+value1[2]);
}
// Creating Headers for Output File
header2=value2+"\t";
}
public void cleanup(Context context) throws IOException, InterruptedException
{
// Set<Entry<Integer, String>> s= sortedMap.entrySet();
Set<Integer> keys = sortmulMap.keySet();
int loop=0;
for (Integer key : keys)
{
loop+=1;
Iterator<String> c = sortmulMap.get(key).iterator();
while(c.hasNext())
{
String op_value = c.next().toString();
context.write(new Text(key.toString()),new Text(op_value));
}
if(loop==1)
{
break;
}
}
}
}
| [
"[email protected]"
] | |
63275809451dca3b657e88b5fa719b15f38bed4c | 5ec06dab1409d790496ce082dacb321392b32fe9 | /clients/java-undertow-server/generated/src/main/java/org/openapitools/model/ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo.java | 37605179477ae69b889d58c5169bd28c25070ef8 | [
"Apache-2.0"
] | permissive | shinesolutions/swagger-aem-osgi | e9d2385f44bee70e5bbdc0d577e99a9f2525266f | c2f6e076971d2592c1cbd3f70695c679e807396b | refs/heads/master | 2022-10-29T13:07:40.422092 | 2021-04-09T07:46:03 | 2021-04-09T07:46:03 | 190,217,155 | 3 | 3 | Apache-2.0 | 2022-10-05T03:26:20 | 2019-06-04T14:23:28 | null | UTF-8 | Java | false | false | 4,016 | java | package org.openapitools.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.openapitools.model.ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerProperties;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaUndertowServerCodegen", date = "2019-08-05T00:56:20.785Z[GMT]")
public class ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo {
private String pid = null;
private String title = null;
private String description = null;
private ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerProperties properties = null;
/**
**/
public ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo pid(String pid) {
this.pid = pid;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("pid")
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
/**
**/
public ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo title(String title) {
this.title = title;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("title")
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/**
**/
public ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo description(String description) {
this.description = description;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("description")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
/**
**/
public ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo properties(ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerProperties properties) {
this.properties = properties;
return this;
}
@ApiModelProperty(value = "")
@JsonProperty("properties")
public ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerProperties getProperties() {
return properties;
}
public void setProperties(ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerProperties properties) {
this.properties = properties;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo comDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo = (ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo) o;
return Objects.equals(pid, comDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo.pid) &&
Objects.equals(title, comDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo.title) &&
Objects.equals(description, comDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo.description) &&
Objects.equals(properties, comDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo.properties);
}
@Override
public int hashCode() {
return Objects.hash(pid, title, description, properties);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ComDayCqWcmContentsyncImplHandlerPagesUpdateHandlerInfo {\n");
sb.append(" pid: ").append(toIndentedString(pid)).append("\n");
sb.append(" title: ").append(toIndentedString(title)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" properties: ").append(toIndentedString(properties)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
d251f5c5191c1a5a3411c0f3e25ec6570774d30d | 25adf7d9183c2d036c8d838d87aa741c79817cdd | /src/main/java/br/cefetmg/vitor/sappserver/models/AccessHistoryId.java | 7b52784bf6362c67d3ff8b708884f05454595fa4 | [] | no_license | vitorsm/sapp-server | 4fd53d9fe8fdc8b44c5f3d2a2caefa62cf39645f | 9fd7eee9340a1734a6215deece88ef330635f756 | refs/heads/master | 2020-03-27T08:00:50.830504 | 2018-11-28T11:04:16 | 2018-11-28T11:04:16 | 146,212,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package br.cefetmg.vitor.sappserver.models;
import java.io.Serializable;
import java.util.Date;
public class AccessHistoryId implements Serializable {
private Date time;
private int doorLock;
}
| [
"[email protected]"
] | |
ece0d72cb6178ec91317dd6ff6aadf3fa80884f5 | 472f39fff86b74708811c25863f266f4c96fb99a | /src/com/wahdahislamiyah/android/kitabuljami/InfoActivity.java | 616ec115df8f1f35b29a663a2073dbfbbff31068 | [] | no_license | baihakidwi/kitabuljami | 0059ab0b45c224816a8578798e615bbbe528a028 | 465a80e1b1c52787dd15c906f91674ef3fdfb13d | refs/heads/master | 2021-08-28T11:23:19.153188 | 2017-12-12T04:03:34 | 2017-12-12T04:03:34 | 113,941,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,293 | java | package com.wahdahislamiyah.android.kitabuljami;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.RelativeSizeSpan;
import android.widget.TextView;
import com.wahdahislamiyah.android.kitabuljami.R;
public class InfoActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Typeface amiri = Typeface.createFromAsset(getAssets(),
"amiri-regular.ttf");
Typeface arabesque = Typeface.createFromAsset(getAssets(),
"arabesque_ii.ttf");
TextView bismillahView = (TextView) findViewById(R.id.activity_info_bismillah);
bismillahView.setTypeface(amiri);
String muqaddimah = getString(R.string.muqaddimah);
SpannableStringBuilder ssMuqaddimah = new SpannableStringBuilder(
muqaddimah);
String[] honorifics = { " I ", " r ", " t ", " C ", " z ", " V " };
int pos = 0;
for (String honorific : honorifics) {
pos = muqaddimah.indexOf(honorific, 0);
while (pos != -1) {
ssMuqaddimah.setSpan(new CustomTypefaceSpan("", arabesque),
pos, pos + 3, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
ssMuqaddimah.setSpan(new RelativeSizeSpan(1.6f), pos + 1,
pos + 2, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
pos = muqaddimah.indexOf(honorific, pos + 3);
}
}
TextView muqaddimahView = (TextView) findViewById(R.id.activity_info_muqaddimah);
muqaddimahView.setText(ssMuqaddimah);
}
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.info, 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();
// if (id == R.id.action_settings) {
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
}
| [
"[email protected]"
] | |
da219d1d40db0194cb954737fb14161b93e59616 | a51778ee2a96630785541ce331e178ce15bdc7c4 | /skola/Fel_bc/1.semestr/Algoritmizace/Java/Programy1250/Kap06/07/TestLom.java | 4db76b1cd91d4c2925b22f1e5df2545da6b42710 | [] | no_license | majacQ/migrace_databaze | 45ed405ab0f0fc31578264c983a4f2e4beacb528 | 51cc735d7db6db1a6454e51ae596e09711783104 | refs/heads/master | 2023-05-08T19:01:09.294920 | 2021-05-24T20:15:33 | 2021-05-24T20:15:33 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,342 | java | // Soubor Kap06\07\TestLom.java
// Balení ve spojitosti s parametizovanými kontejnery
// Jen JDK 5
import java.util.ArrayList;
// Třída představující lomenou čáru
class LomenaCara
{
private ArrayList<Integer> X, Y;
public LomenaCara(int[] XX, int[] YY)
{
X = new ArrayList<Integer>();
Y = new ArrayList<Integer>();
int i = 0;
while(i < XX.length)
{
X.add(XX[i]);
Y.add(YY[i++]);
}
}
public void nakresli()
{
// Oblíbený tik: kreslení nahradíme výpisem
System.out.print("Lomena cara [");
int i = 0;
while(i < X.size())
{
System.out.printf("(%d, %d)", X.get(i), Y.get(i));
i++;
}
System.out.println("]");
}
// metody pro změnu X, resp. Y o D
// Využívají balení a vybalování
public void posunX(int d)
{
int i = 0;
while(i < X.size())
{
X.add(i, X.remove(i)+d);
i++;
}
}
public void posunY(int d)
{
int i = 0;
while(i < Y.size())
{
Y.add(i, Y.remove(i)+d);
i++;
}
}
}
public class TestLom
{
public static void main(String[] s)
{
int[] A = {1, 3, 6};
int[] B = {2, 4, 7};
LomenaCara lc = new LomenaCara(A, B);
lc.nakresli();
lc.posunX(5);
lc.nakresli();
}
} | [
"[email protected]"
] | |
1a250978e4c8b8eecab9a441f55997dec7a1efe2 | 834a1a3583dce9a3b076899c177d5f07488f8aa1 | /src/uk/gov/gsi/childmaintenance/www/futurescheme/interfaces/CMECGetEmployerDetailsWebService/CMECePortalGetEmployerWebService_ServiceLocator.java | 5e11e05b416158d7fdd0f271ab48295cb3eac56b | [] | no_license | deekumar18/cmg_mock_final | fe95cb978efbb4b1bbaefb5adde3d40e0515a845 | 13e74030e9446c374795a233239203d88a488d5c | refs/heads/master | 2020-07-16T19:15:47.724346 | 2019-09-03T09:25:37 | 2019-09-03T09:25:37 | 205,850,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,854 | java | /**
* CMECePortalGetEmployerWebService_ServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService;
public class CMECePortalGetEmployerWebService_ServiceLocator extends org.apache.axis.client.Service implements uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECePortalGetEmployerWebService_Service {
public CMECePortalGetEmployerWebService_ServiceLocator() {
}
public CMECePortalGetEmployerWebService_ServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public CMECePortalGetEmployerWebService_ServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for CMECePortalGetEmployerWebService
private java.lang.String CMECePortalGetEmployerWebService_address = "http://10.30.20.15:8080/CMECGetEmployerDetailsePortalEsbWeb/sca/CMECePortalGetEmployerWebServiceExport";
public java.lang.String getCMECePortalGetEmployerWebServiceAddress() {
return CMECePortalGetEmployerWebService_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String CMECePortalGetEmployerWebServiceWSDDServiceName = "CMECePortalGetEmployerWebService";
public java.lang.String getCMECePortalGetEmployerWebServiceWSDDServiceName() {
return CMECePortalGetEmployerWebServiceWSDDServiceName;
}
public void setCMECePortalGetEmployerWebServiceWSDDServiceName(java.lang.String name) {
CMECePortalGetEmployerWebServiceWSDDServiceName = name;
}
public uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECePortalGetEmployerWebService_PortType getCMECePortalGetEmployerWebService() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(CMECePortalGetEmployerWebService_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getCMECePortalGetEmployerWebService(endpoint);
}
public uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECePortalGetEmployerWebService_PortType getCMECePortalGetEmployerWebService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECGetEmployerDetailsWebServiceSOAPStub _stub = new uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECGetEmployerDetailsWebServiceSOAPStub(portAddress, this);
_stub.setPortName(getCMECePortalGetEmployerWebServiceWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setCMECePortalGetEmployerWebServiceEndpointAddress(java.lang.String address) {
CMECePortalGetEmployerWebService_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECePortalGetEmployerWebService_PortType.class.isAssignableFrom(serviceEndpointInterface)) {
uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECGetEmployerDetailsWebServiceSOAPStub _stub = new uk.gov.gsi.childmaintenance.www.futurescheme.interfaces.CMECGetEmployerDetailsWebService.CMECGetEmployerDetailsWebServiceSOAPStub(new java.net.URL(CMECePortalGetEmployerWebService_address), this);
_stub.setPortName(getCMECePortalGetEmployerWebServiceWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("CMECePortalGetEmployerWebService".equals(inputPortName)) {
return getCMECePortalGetEmployerWebService();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://www.childmaintenance.gsi.gov.uk/futurescheme/interfaces/CMECGetEmployerDetailsWebService", "CMECePortalGetEmployerWebService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("http://www.childmaintenance.gsi.gov.uk/futurescheme/interfaces/CMECGetEmployerDetailsWebService", "CMECePortalGetEmployerWebService"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("CMECePortalGetEmployerWebService".equals(portName)) {
setCMECePortalGetEmployerWebServiceEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
| [
"[email protected]"
] | |
e0e65989541360a35487d2842737b8a935038e2a | 7672dee2c6b5a4d71760b43c56be6314bf5654b5 | /src/test/java/PhoneNumberBuilderTest.java | 235456b9d1a95c30b4472ea0e823a556b1912a4e | [] | no_license | hainnguyen-kms/effective-java | d516e0fda907bf48f5c5e45e09981ea80b8450dc | 826135061c23e2e7f985be01f04820a4aa1c6270 | refs/heads/master | 2023-02-19T14:33:55.593176 | 2021-01-04T02:42:15 | 2021-01-04T02:42:15 | 326,550,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | import company.factory.PhoneNumber;
import org.junit.Test;
public class PhoneNumberBuilderTest {
@Test
public void testBuilder() {
PhoneNumber phoneNumber = PhoneNumber.builder()
.number(1)
.area(2)
.build();
System.out.println(phoneNumber);
}
} | [
"[email protected]"
] | |
6b013ad30744853873889e53c5aea44948d563e9 | 8a22584f5cda331504dd467443d6ddef3b286598 | /sinicum-server/src/main/java/com/dievision/sinicum/server/resources/providers/SinicumObjectProvider.java | 7722078190a05f50ddd8a23c97fc786aebd88f66 | [
"Apache-2.0"
] | permissive | dievision/sinicum-server | e3292a03d05d35b90ef0047c6597cd57c2600b24 | 181476f736d89cce7f6bb9a1fec1d5f0c593f5bf | refs/heads/master | 2021-01-18T21:10:05.302605 | 2018-10-24T12:17:26 | 2018-10-24T12:17:26 | 18,876,327 | 3 | 5 | NOASSERTION | 2018-10-24T12:17:27 | 2014-04-17T11:39:46 | Java | UTF-8 | Java | false | false | 1,557 | java | package com.dievision.sinicum.server.resources.providers;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.dievision.sinicum.server.jaxrs.filters.PrettyPrintContext;
@Provider
public class SinicumObjectProvider implements ContextResolver<ObjectMapper> {
private final ObjectMapper defaultObjectMapper;
private final ObjectMapper prettyPrintObjectMapper;
private static final JsonFactory JASON_FACTORY = new JsonFactory();
private static final Logger logger = LoggerFactory.getLogger(SinicumObjectProvider.class);
public SinicumObjectProvider() {
this.defaultObjectMapper = createDefaultObjectMapper();
this.prettyPrintObjectMapper = createPrettyPrintObjectMapper();
}
public ObjectMapper getContext(Class<?> type) {
if (PrettyPrintContext.getInstance().getPrettyPrint()) {
return prettyPrintObjectMapper;
} else {
return defaultObjectMapper;
}
}
private ObjectMapper createDefaultObjectMapper() {
ObjectMapper mapper = new ObjectMapper(JASON_FACTORY);
return mapper;
}
private ObjectMapper createPrettyPrintObjectMapper() {
ObjectMapper mapper = createDefaultObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
return mapper;
}
}
| [
"[email protected]"
] | |
1165c50be6d16a924f949e60e62d3a290401aaf9 | 1cca6a37d3a0e239613c242cf9578994903ff815 | /hibernate-mindtree-master/Hibernate-Project/src/Day7/CriteriaTest.java | 37d67e985530d104f926aafc2481bfddd93de929 | [] | no_license | awantik/hibernate-mindtree3 | bd3f61e839897f968bfce7a55b68ebeacadb035e | 8343a25bfbe3857dfcb3a641b655e355212d63e8 | refs/heads/master | 2021-01-17T18:35:55.901566 | 2016-11-08T10:50:43 | 2016-11-08T10:50:43 | 71,549,526 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,108 | java | package Day7;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Restrictions;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
public class CriteriaTest {
SessionFactory factory;
public void setup(){
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistryBuilder srb = new ServiceRegistryBuilder();
srb.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = srb.buildServiceRegistry();
factory = configuration.buildSessionFactory(serviceRegistry);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
CriteriaTest et = new CriteriaTest();
et.setup();
Session session = et.factory.openSession();
Criteria cr = session.createCriteria(Employee.class);
cr.add(Restrictions.eq("salary", 1000));
cr.add(Restrictions.eq("name","Awantik"));
List results = cr.list();
}
}
| [
"[email protected]"
] | |
d28a1f79ccd18a6107da24ee659f73a4a97f6453 | 13e4b1073f22e558795e30489bb3bfee969dbe02 | /ServerSide/src/mysql/dayObserver.java | def5cd81077455e655867b8a686d28ac87ba58d9 | [] | no_license | ruijiege/DataCollectionSystem | 225b63f98a49ca6193d203bb20be09419522cf66 | 4f1fdb6857038dd2c3205d4854753ac2ecfab9d6 | refs/heads/master | 2020-04-12T13:27:22.821530 | 2014-02-15T20:13:09 | 2014-02-15T20:13:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package mysql;
import data.MyData;
public class dayObserver implements Observer{
private int count=0;
public dayObserver(Subject subject){
subject.registerObserver(this);
}
@Override
public void update(MyData mydata) {
// TODO Auto-generated method stub
count++;
if(count==86400){
count=0;
MyDatabase.writeDatabase(mydata, "hourTable");
}
}
}
| [
"[email protected]"
] | |
a60f365834492219f20bb5ffc5a0b91733263958 | adfd01af273f883bdf3354dea4345ee00d797e07 | /src/main/java/com/b1a9idps/loggingsample/Application.java | 902495c62218683b82cfb5386ca1e0cbba6eb2e6 | [] | no_license | b1a9id/logging-sample | b34f08e6cf0f48153a9ed7bf98691a358b07b014 | 29c829340f642851ee30880a6b9c24cf9ea183b4 | refs/heads/main | 2023-03-23T10:23:13.759635 | 2021-03-21T12:20:29 | 2021-03-21T12:20:29 | 349,259,812 | 0 | 0 | null | 2021-03-21T12:20:29 | 2021-03-19T00:56:53 | Java | UTF-8 | Java | false | false | 307 | java | package com.b1a9idps.loggingsample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"[email protected]"
] | |
3e15173b73b7b9fdf5ca61af45ce3b67bb9c4f07 | ecb8b37613fb3c41bb58e90a23c5383a0444e490 | /clients/src/main/java/com/simplyti/service/clients/channel/handler/ChannelInitializedHandler.java | 5e3ee13c0b6e302d6565422ec889d6460e7d1710 | [] | no_license | simplyti/simple-server | 56d232ded25198a17c92c9b732b7a5986933aff8 | edb32f6db6d3bb38ce3400a904f8e942817d385b | refs/heads/master | 2022-12-22T10:38:54.273652 | 2022-04-10T19:31:25 | 2022-04-10T19:31:25 | 129,148,945 | 6 | 1 | null | 2022-12-12T21:44:11 | 2018-04-11T20:15:54 | Java | UTF-8 | Java | false | false | 1,432 | java | package com.simplyti.service.clients.channel.handler;
import com.simplyti.service.clients.channel.ClientChannel;
import com.simplyti.service.clients.channel.ClientChannelEvent;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.AttributeKey;
import io.netty.util.concurrent.Promise;
public class ChannelInitializedHandler extends ChannelInboundHandlerAdapter {
private static final AttributeKey<Boolean> INITIALIZED = AttributeKey.valueOf("clients.init");
private final Promise<ClientChannel> promise;
private final ClientChannel clientChannel;
public ChannelInitializedHandler(ClientChannel clientChannel, Promise<ClientChannel> promise) {
this.clientChannel=clientChannel;
this.promise=promise;
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if(evt==ClientChannelEvent.INIT) {
clientChannel.attr(INITIALIZED).set(true);
ctx.pipeline().remove(this);
promise.setSuccess(clientChannel);
} else {
ctx.fireUserEventTriggered(evt);
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
ctx.close();
clientChannel.release();
promise.setFailure(cause);
}
public static boolean isNew(Channel channel) {
return channel.attr(INITIALIZED).get() != Boolean.TRUE;
}
}
| [
"[email protected]"
] | |
9e52194cfb83fc3acd8eb1ffb472ddabacf548fb | f9b8fc60816c83fe41b2748c4b241f9d9cd4103a | /app/src/main/java/com/np/areebwaseem/horriblefriends/settings_fragment_view.java | b7fee0ac80856516d5c76decfaaa12ae0868ee3f | [] | no_license | 8secz-johndpope/Horrible-Friends | 1bef333af8f5942ab0f0063fc1ec51583a41db73 | 507d33ee964e03e78868c74d854b392ba0315852 | refs/heads/master | 2020-07-10T23:14:33.159501 | 2019-08-23T23:51:21 | 2019-08-23T23:51:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 132,265 | java | package com.np.areebwaseem.horriblefriends;
import android.Manifest;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.media.ExifInterface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.constraint.ConstraintLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.text.InputFilter;
import android.text.InputType;
import android.text.Spanned;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.firebase.ui.storage.images.FirebaseImageLoader;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.UserProfileChangeRequest;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ThrowOnExtraProperties;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.functions.FirebaseFunctions;
import com.google.firebase.functions.FirebaseFunctionsException;
import com.google.firebase.functions.HttpsCallableResult;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.hbb20.CountryCodePicker;
import com.soundcloud.android.crop.Crop;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.security.spec.ECField;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by areebwaseem on 10/28/17.
*/
public class settings_fragment_view extends Fragment {
private static final String TAG = "settings_fragment_view";
private FirebaseAuth mAuth;
DatabaseReference databaseReference;
FirebaseStorage firebaseStorage;
volatile boolean is_activity_running;
Context context;
ConnectivityManager connMgr;
NetworkInfo networkInfo;
String current_uid="";
ProgressBar progressBar;
Switch friend_request_switch;
Switch new_message_switch;
Switch new_comment_switch;
Switch message_favourite_switch;
String current_name="";
String current_nick="";
String current_city="";
String current_phone="";
Button sele_camera;
Button select_image;
Uri imageUri;
boolean is_deleting;
boolean is_suspending;
DataSnapshot personal_data_snap;
ConstraintLayout delete_account_button;
ConstraintLayout suspend_account_button;
ConstraintLayout log_out_button;
ConstraintLayout change_name_button;
ConstraintLayout change_nick_button;
ConstraintLayout change_mobile_button;
ConstraintLayout change_city_button;
ConstraintLayout change_password_button;
String my_selected_city_code="";
TextView name_view;
TextView nick_view;
TextView loc_view;
TextView phone_view;
TextView email_view;
DataSnapshot personal_auth;
CircleImageView prof_image_view;
ContentValues values;
boolean new_pic_selected;
Button resend_email;
Button update_email;
ConstraintLayout un_veri_layout;
TextView veri_em_text_view;
private FirebaseFunctions mFunctions;
SwipeRefreshLayout swipeRefreshLayout;
SharedPreferences sharedPreferences;
boolean isDownloading;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.settings_fragment_layout, container, false);
context = this.getActivity();
connMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
networkInfo = connMgr.getActiveNetworkInfo();
new_pic_selected=false;
is_deleting=false;
is_activity_running=true;
sharedPreferences = getActivity().getSharedPreferences("com.example.areebwaseem.horriblefriendsfinal", Context.MODE_PRIVATE);
////////////////// Layout Elements ////////////////////////
friend_request_switch = view.findViewById(R.id.switch1);
new_message_switch = view.findViewById(R.id.switch2);
new_comment_switch = view.findViewById(R.id.switch3);
message_favourite_switch = view.findViewById(R.id.switch4);
delete_account_button = view.findViewById(R.id.settings_fragment_delete_account_button);
suspend_account_button = view.findViewById(R.id.settings_fragment_suspend_account_button);
log_out_button = view.findViewById(R.id.settings_fragment_logout_button);
change_name_button = view.findViewById(R.id.settings_fragment_edit_name_view);
change_nick_button = view.findViewById(R.id.settings_fragment_edit_nick_view);
change_city_button = view.findViewById(R.id.settings_fragment_edit_city_view);
change_mobile_button = view.findViewById(R.id.settings_fragment_edit_mobile_view);
change_password_button = view.findViewById(R.id.settings_fragment_edit_password_view);
name_view = view.findViewById(R.id.settings_fragment_name_text_view);
nick_view = view.findViewById(R.id.settings_fragment_nick_view);
loc_view = view.findViewById(R.id.settings_fragment_location_view);
phone_view = view.findViewById(R.id.settings_fragment_phone_view);
email_view = view.findViewById(R.id.settings_fragment_email_view);
swipeRefreshLayout = view.findViewById(R.id.settings_swipe_refresh);
progressBar = view.findViewById(R.id.swipe_refresh_progres_bar);
prof_image_view = view.findViewById(R.id.profile_pic_settings_fragment);
sele_camera = view.findViewById(R.id.sele_camera_settings);
select_image = view.findViewById(R.id.sele_gallery_settings);
resend_email = view.findViewById(R.id.resend_email_button_under_cons_layout);
update_email = view.findViewById(R.id.update_email_under_cons_layout);
un_veri_layout = view.findViewById(R.id.veri_email_cons_layout);
veri_em_text_view = view.findViewById(R.id.verify_email_text_view);
my_selected_city_code= "+1";
////////////// Firebase Elements Initialization ////////////
mAuth = FirebaseAuth.getInstance();
mFunctions = FirebaseFunctions.getInstance();
databaseReference = FirebaseDatabase.getInstance().getReference();
firebaseStorage = FirebaseStorage.getInstance();
isDownloading=false;
is_suspending=false;
///////////// Arraylist/ Adapter Initialization /////////////////////
if (mAuth!=null && mAuth.getCurrentUser()!=null)
{
current_uid= mAuth.getCurrentUser().getUid();
}
if (is_connected())
{
try {
final StorageReference storageReference_one = firebaseStorage.getReference();
Glide.with(getActivity())
.using(new FirebaseImageLoader())
.load(storageReference_one.child(current_uid)).error(R.drawable.asset_four).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(prof_image_view);
} catch (Exception e) {
e.printStackTrace();
}
}
friend_request_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (get_activity_state() && is_connected()) {
if (isChecked) {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("friend_requests").setValue(true).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
} else {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("friend_requests").setValue(false).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
}
}else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
});
new_message_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (get_activity_state() && is_connected()) {
if (isChecked) {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("new_message").setValue(true).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
} else {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("new_message").setValue(false).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
}
}else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
});
change_name_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show_change_name_alert();
}
});
change_nick_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show_change_nick_alert();
}
});
change_mobile_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show_change_phone_alert();
}
});
change_city_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show_change_city_alert();
}
});
change_password_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
check_for_auth_type();
}
});
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeRefreshLayout.setRefreshing(false);
if (!isDownloading)
{
try {
final StorageReference storageReference_one = firebaseStorage.getReference();
Glide.with(getActivity())
.using(new FirebaseImageLoader())
.load(storageReference_one.child(current_uid)).error(R.drawable.asset_four).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(prof_image_view);
} catch (Exception e) {
e.printStackTrace();
}
remove_email_view();
remove_location();
remove_nick();
remove_name();
remove_phone_view();
get_profile_data();
}
}
});
new_comment_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (get_activity_state() && is_connected()) {
if (isChecked) {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("new_comment").setValue(true).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
} else {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("new_comment").setValue(false).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
}
}
else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
});
message_favourite_switch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (get_activity_state() && is_connected()) {
if (isChecked) {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("favourite_message").setValue(true).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
} else {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("notifications").child("favourite_message").setValue(false).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
});
}
}
else {
if (getActivity() != null) {
((home_activity) getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection), true);
}
}
}
});
delete_account_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (current_uid!=null && !is_deleting) {
final AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(getActivity());
}
builder.setTitle(getResources().getString(R.string.confirm_string))
.setMessage(getResources().getString(R.string.are_you_sure_want_to_delete))
.setPositiveButton(getResources().getString(R.string.yes_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (get_activity_state() && is_connected()) {
// continue with delete
is_deleting = true;
delete_account_button.setClickable(false);
progressBar.setVisibility(View.VISIBLE);
Map<String, Object> data = new HashMap<>();
data.put("text", current_uid);
mFunctions.getHttpsCallable("delete_user")
.call(data).addOnCompleteListener(new OnCompleteListener<HttpsCallableResult>() {
@Override
public void onComplete(@NonNull Task<HttpsCallableResult> task) {
if (task.isSuccessful()) {
// Log.d(TAG, task.getResult().getData().toString());
sharedPreferences.edit().putString("token_set", "false").apply();
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.success_string), Toast.LENGTH_SHORT).show();
is_deleting = false;
mAuth.signOut();
} else {
progressBar.setVisibility(View.INVISIBLE);
delete_account_button.setClickable(true);
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
is_deleting = false;
}
}
});
}else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
})
.setNegativeButton(getResources().getString(R.string.no_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
dialog.dismiss();
}
}).show();
/*
delete_user(current_uid)
.addOnCompleteListener(new OnCompleteListener<String>() {
@Override
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Exception e = task.getException();
if (e instanceof FirebaseFunctionsException) {
FirebaseFunctionsException ffe = (FirebaseFunctionsException) e;
FirebaseFunctionsException.Code code = ffe.getCode();
Object details = ffe.getDetails();
}
// ...
}
else {
Toast.makeText(getActivity(),"Success",Toast.LENGTH_SHORT).show();
}
// ...
}
});
*/
}
}
});
suspend_account_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (get_activity_state() && is_connected())
{
if (current_uid != null && !is_suspending) {
final AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(getActivity());
}
builder.setTitle(getResources().getString(R.string.confirm_string))
.setMessage(getResources().getString(R.string.are_you_sure_suspend_account_string))
.setPositiveButton(getResources().getString(R.string.yes_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// continue with delete
dialog.dismiss();
if (get_activity_state() && is_connected())
{
suspend_account_button.setClickable(false);
is_suspending = true;
Map<String, Object> taskMap = new HashMap<>();
taskMap.put("token", "");
taskMap.put("is_suspended", true);
databaseReference.child("users_auth").child(mAuth.getCurrentUser().getUid()).child("is_suspended").setValue(true).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
sharedPreferences.edit().putString("token_set", "false").apply();
Toast.makeText(getActivity(), getResources().getString(R.string.account_suspended), Toast.LENGTH_SHORT).show();
is_suspending = false;
mAuth.signOut();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_try_again), Toast.LENGTH_SHORT).show();
suspend_account_button.setClickable(true);
is_suspending = false;
}
}
});
}else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
})
.setNegativeButton(getResources().getString(R.string.no_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
dialog.dismiss();
}
}).show();
}
}
else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
});
sele_camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (check_storage_permission()) {
values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "New Picture");
values.put(MediaStore.Images.Media.DESCRIPTION, "From your Camera");
imageUri = getActivity().getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, 3);
}
else {
if (getActivity()!=null) {
Toast.makeText(getActivity(), getResources().getString(R.string.grant_storage_permission_string), Toast.LENGTH_SHORT).show();
}
}
}
});
select_image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 2);
}
});
log_out_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
remove_token();
}
});
get_profile_data();
return view;
}
private void get_profile_data(){
if (is_connected() && current_uid!=null && !isDownloading && get_activity_state())
{
check_verification();
progressBar.setVisibility(View.VISIBLE);
isDownloading=true;
databaseReference.child("users_auth").child(current_uid).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
personal_auth=dataSnapshot;
databaseReference.child("users").child(current_uid).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
isDownloading=false;
if (get_activity_state() && dataSnapshot!=null)
{
personal_data_snap=dataSnapshot;
if (dataSnapshot.hasChild("notifications"))
{
if (dataSnapshot.child("notifications").hasChild("friend_requests"))
{
try {
boolean is_request = (Boolean) dataSnapshot.child("notifications").child("friend_requests").getValue();
if (is_request)
{
friend_request_switch.setChecked(true);
}
else {
friend_request_switch.setChecked(false);
}
}catch (Exception e)
{
e.printStackTrace();
}
}
else {
friend_request_switch.setChecked(false);
}
if (dataSnapshot.child("notifications").hasChild("new_message"))
{
try {
boolean is_request = (Boolean) dataSnapshot.child("notifications").child("new_message").getValue();
if (is_request)
{
new_message_switch.setChecked(true);
}
else {
new_message_switch.setChecked(false);
}
}catch (Exception e)
{
e.printStackTrace();
}
}
else {
new_message_switch.setChecked(false);
}
if (dataSnapshot.child("notifications").hasChild("favourite_message"))
{
try {
boolean is_request = (Boolean) dataSnapshot.child("notifications").child("favourite_message").getValue();
if (is_request)
{
message_favourite_switch.setChecked(true);
}
else {
message_favourite_switch.setChecked(false);
}
}catch (Exception e)
{
e.printStackTrace();
}
}
else {
message_favourite_switch.setChecked(false);
}
if (dataSnapshot.child("notifications").hasChild("new_comment"))
{
try {
boolean is_request = (Boolean) dataSnapshot.child("notifications").child("new_comment").getValue();
if (is_request)
{
new_comment_switch.setChecked(true);
}
else {
new_message_switch.setChecked(false);
}
}catch (Exception e)
{
e.printStackTrace();
}
}
else {
new_message_switch.setChecked(false);
}
}
else {
// all buttons off
}
if (dataSnapshot.hasChild("full_name") && !dataSnapshot.child("full_name").getValue().toString().trim().equals(""))
{
set_name(dataSnapshot.child("full_name").getValue().toString());
}
if (dataSnapshot.hasChild("name") && !dataSnapshot.child("name").getValue().toString().trim().equals(""))
{
set_nick(dataSnapshot.child("name").getValue().toString());
}
if (dataSnapshot.hasChild("City") && !dataSnapshot.child("City").getValue().toString().trim().equals(""))
{
set_location(dataSnapshot.child("City").getValue().toString());
}
if (dataSnapshot.hasChild("Email") && !dataSnapshot.child("Email").getValue().toString().trim().equals(""))
{
set_email_view(dataSnapshot.child("Email").getValue().toString());
}
if (dataSnapshot.hasChild("phone") && !dataSnapshot.child("phone").getValue().toString().trim().equals(""))
{
set_phone_view(dataSnapshot.child("phone").getValue().toString());
}
progressBar.setVisibility(View.INVISIBLE);
isDownloading=false;
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
isDownloading=false;
Toast.makeText(getActivity(), getResources().getString(R.string.error_loading_profile), Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public void onCancelled(DatabaseError databaseError) {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
isDownloading=false;
Toast.makeText(getActivity(), getResources().getString(R.string.error_loading_profile), Toast.LENGTH_SHORT).show();
}
}
});
}
else {
if (get_activity_state()) {
if (!is_connected()) {
((home_activity) getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection), true);
}
}
progressBar.setVisibility(View.INVISIBLE);
isDownloading=false;
// Toast.makeText(getActivity(),"null",Toast.LENGTH_SHORT).show();
}
}
private boolean is_connected()
{
if (getActivity()!=null) {
connMgr = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
return true;
} else {
return false;
}
}else {
return false;
}
}
@Override
public void setUserVisibleHint(boolean visible)
{
super.setUserVisibleHint(visible);
Log.d(TAG, "First Resume");
if (visible && isResumed())
{
Log.d(TAG, "First Resume with visible");
//Only manually call onResume if fragment is already visible
//Otherwise allow natural fragment lifecycle to call onResume
onResume();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2 && resultCode == getActivity().RESULT_OK && null != data) {
Uri selectedImage = data.getData();
/*
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
*/
// new_pic_selected=true;
try {
/*
Bitmap thumbnail = MediaStore.Images.Media.getBitmap(
getContentResolver(), selectedImage);
// Bitmap rotatedBitmap = rotateImage(thumbnail, -90);
// profile_view.setImageBitmap(rotatedBitmap);
// String imageurl = getRealPathFromURI(imageUri);
// profile_view.setImageURI(imageurl);
ExifInterface ei = new ExifInterface(getRealPathFromURI(selectedImage));
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
Bitmap rotatedBitmap = null;
switch(orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
rotatedBitmap = rotateImage(thumbnail, 90);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotatedBitmap = rotateImage(thumbnail, 180);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
rotatedBitmap = rotateImage(thumbnail, 270);
break;
case ExifInterface.ORIENTATION_NORMAL:
default:
rotatedBitmap = thumbnail;
}
*/
//
// profile_view.setImageBitmap(rotatedBitmap);
Uri myUri = Uri.fromFile(new File(getActivity().getCacheDir(),"cropped"));
Crop.of(selectedImage, myUri).asSquare().start(getActivity(),settings_fragment_view.this);
// profile_view.setImageURI(Crop.getOutput(data));
} catch (Exception e) {
// profile_view.setImageBitmap(BitmapFactory.decodeFile(picturePath));
e.printStackTrace();
}
}
else if (requestCode==Crop.REQUEST_CROP)
{
handleCrop(resultCode,data);
}
/*
else if (requestCode == 1000) {
if(resultCode == RESULT_OK){
String result=data.getStringExtra("result");
// Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_SHORT).show();
getLocation();
// Log.d(TAG, result);
} if (resultCode == RESULT_CANCELED) {
//Write your code if there's no result
}
}
*/
else if (requestCode == 3 && resultCode == getActivity().RESULT_OK)
{
// new_pic_selected=true;
/*
try {
Bitmap thumbnail = MediaStore.Images.Media.getBitmap(
getContentResolver(), imageUri);
profile_view.setImageBitmap(thumbnail);
// imageurl = getRealPathFromURI(imageUri);
} catch (Exception e) {
e.printStackTrace();
}
*/
/*
Bundle extras = data.getExtras();
// get bitmap
Bitmap bitMap = (Bitmap) extras.get("data");
profile_view.setImageBitmap(bitMap);
*/
try {
Bitmap thumbnail = MediaStore.Images.Media.getBitmap(
getActivity().getContentResolver(), imageUri);
// Bitmap rotatedBitmap = rotateImage(thumbnail, -90);
// profile_view.setImageBitmap(rotatedBitmap);
// String imageurl = getRealPathFromURI(imageUri);
// profile_view.setImageURI(imageurl);
ExifInterface ei = new ExifInterface(getRealPathFromURI(imageUri));
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
Bitmap rotatedBitmap = null;
switch(orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
rotatedBitmap = rotateImage(thumbnail, 90);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotatedBitmap = rotateImage(thumbnail, 180);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
rotatedBitmap = rotateImage(thumbnail, 270);
break;
case ExifInterface.ORIENTATION_NORMAL:
default:
rotatedBitmap = thumbnail;
}
// profile_view.setImageBitmap(rotatedBitmap);
Uri myUri = Uri.fromFile(new File(getActivity().getCacheDir(),"cropped"));
Crop.of(imageUri, myUri).asSquare().start(getActivity(),settings_fragment_view.this);
} catch (Exception e) {
e.printStackTrace();
}
/*
Bitmap photo = (Bitmap) data.getExtras().get("data");
profile_view.setImageBitmap(photo);
*/
}
else {
// Toast.makeText(getApplicationContext(), "No data!", Toast.LENGTH_SHORT).show();
/*
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
profImage = (BitmapFactory.decodeFile(picturePath));
profile_view.setImageBitmap(profImage);
*/
/*
Uri uri=data.getData();
String[]projection ={MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(uri, projection, null, null,null);
cursor.moveToFirst();
int columnIndex= cursor.getColumnIndex(projection[0]);
String filepath = cursor.getString(columnIndex);
cursor.close();
Bitmap sele_image = BitmapFactory.decodeFile(filepath);
Drawable d= new BitmapDrawable(sele_image);
profile_view.setBackground(d);
*/
}
}
private void handleCrop(int code, Intent result)
{
if (code==getActivity().RESULT_OK) {
// profile_view.setImageURI(Crop.getOutput(result));
Uri selectedImage = Crop.getOutput(result);
/*
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
*/
new_pic_selected=true;
try {
/*
Bitmap thumbnail = MediaStore.Images.Media.getBitmap(
getContentResolver(), selectedImage);
// Bitmap rotatedBitmap = rotateImage(thumbnail, -90);
// profile_view.setImageBitmap(rotatedBitmap);
// String imageurl = getRealPathFromURI(imageUri);
// profile_view.setImageURI(imageurl);
ExifInterface ei = new ExifInterface(Crop.getOutput(result).getPath());
int orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION,
ExifInterface.ORIENTATION_UNDEFINED);
Bitmap rotatedBitmap = null;
switch(orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
rotatedBitmap = rotateImage(thumbnail, 90);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
rotatedBitmap = rotateImage(thumbnail, 180);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
rotatedBitmap = rotateImage(thumbnail, 270);
break;
case ExifInterface.ORIENTATION_NORMAL:
default:
rotatedBitmap = thumbnail;
}
*/
//
// profile_view.setImageBitmap(rotatedBitmap);
Glide.with(this).load(selectedImage).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true).into(prof_image_view);
final AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Material_Dialog_Alert);
} else {
builder = new AlertDialog.Builder(getActivity());
}
builder.setTitle(getResources().getString(R.string.confirm_string))
.setMessage(getResources().getString(R.string.profile_photo_alert_dialog))
.setPositiveButton(getResources().getString(R.string.yes_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (get_activity_state() && is_connected()) {
// continue with delete
save_image_to_db();
}
else {
if (getActivity()!=null && get_activity_state())
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
})
.setNegativeButton(getResources().getString(R.string.no_string), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// do nothing
new_pic_selected=false;
dialog.dismiss();
}
}).show();
} catch (Exception e) {
// profile_view.setImageBitmap(BitmapFactory.decodeFile(picturePath));
if (get_activity_state()) {
Toast.makeText(getActivity(), "Exception", Toast.LENGTH_SHORT).show();
e.printStackTrace();
Log.d(TAG, "Exception: " + e.getMessage());
}
}
}
else {
if (get_activity_state()) {
Toast.makeText(getActivity(), "Error crop", Toast.LENGTH_SHORT).show();
Log.d(TAG, "Error in Cropping");
}
}
}
public String getRealPathFromURI(Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = getActivity().managedQuery(contentUri, proj, null, null, null);
int column_index = cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
public static Bitmap rotateImage(Bitmap source, float angle) {
Matrix matrix = new Matrix();
matrix.postRotate(angle);
return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(),
matrix, true);
}
private void save_image_to_db()
{
if (mAuth!=null && mAuth.getCurrentUser()!=null) {
/*
profile_view.setDrawingCacheEnabled(true);
profile_view.buildDrawingCache();
*/
if (mAuth.getCurrentUser().getPhotoUrl() == null || new_pic_selected == true) {
try {
Bitmap bitmap = ((BitmapDrawable) prof_image_view.getDrawable()).getBitmap();
// Bitmap bitmap = ((GlideBitmapDrawable) profile_view.getDrawable().getCurrent()).getBitmap();
// Bitmap bitmap = profile_view.getDrawingCache();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
byte[] data = baos.toByteArray();
StorageReference storageReference = firebaseStorage.getReference();
StorageReference prof_reference = storageReference.child(mAuth.getCurrentUser().getUid());
start_bar();
UploadTask uploadTask = prof_reference.putBytes(data);
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception exception) {
// Handle unsuccessful uploads
// Toast.makeText(getActivity(), "Error 1", Toast.LENGTH_SHORT).show();
error_bar_new();
}
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
// taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL.
Uri downloadUrl = taskSnapshot.getDownloadUrl();
UserProfileChangeRequest myRequest = new UserProfileChangeRequest.Builder().setPhotoUri(downloadUrl).build();
mAuth.getCurrentUser().updateProfile(myRequest).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
new_pic_selected = false;
error_bar_new();
Toast.makeText(getActivity(), getResources().getString(R.string.image_saved_string), Toast.LENGTH_SHORT).show();
// Intent i = new Intent(Main3Activity.this,Main4Activity.class);
// startActivity(i);
} else {
error_bar_new();
// Toast.makeText(getActivity(), "Error 2", Toast.LENGTH_SHORT).show();
}
}
});
Log.d(TAG, downloadUrl.toString());
}
});
}catch (Exception e)
{
// Toast.makeText(getActivity(),"Error getting Bitmap",Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(),getResources().getString(R.string.error_string),Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
}
else{
error_bar_new();
}
}
else {
error_bar_new();
}
}
public void error_bar_new()
{
try {
progressBar.setVisibility(View.INVISIBLE);
select_image.setClickable(true);
sele_camera.setClickable(true);
}catch (Exception e)
{
e.printStackTrace();
}
}
public void start_bar()
{
try {
sele_camera.setClickable(false);
select_image.setClickable(false);
progressBar.setVisibility(View.VISIBLE);
}catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void onResume() {
super.onResume();
Log.d(TAG, "Second Resume");
if (!getUserVisibleHint()) {
Log.d(TAG, "Second Resume Inside");
return;
}
if (getActivity()!=null) {
((home_activity)getActivity()).set_bottom_settings();
}
}
@Override
public void onDestroy() {
super.onDestroy();
is_activity_running = false;
}
private boolean get_activity_state() {
if (getActivity()!=null && mAuth != null && mAuth.getCurrentUser() != null && is_activity_running ) {
return true;
} else {
return false;
}
}
private void error_bar()
{
if (getActivity()!=null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
try {
if (getActivity() != null) {
isDownloading = false;
if (progressBar != null) {
progressBar.setVisibility(View.INVISIBLE);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
private void show_may_bar()
{
/*
try {
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) may_know_progress_bar.getLayoutParams();
layoutParams.height= (LinearLayout.LayoutParams.WRAP_CONTENT);
may_know_progress_bar.setLayoutParams(layoutParams);
may_know_progress_bar.setVisibility(View.VISIBLE);
}catch (Exception e)
{
e.printStackTrace();
}
*/
}
private void hide_may_bar()
{
/*
try {
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) may_know_progress_bar.getLayoutParams();
layoutParams.height= 0;
may_know_progress_bar.setLayoutParams(layoutParams);
may_know_progress_bar.setVisibility(View.INVISIBLE);
}catch (Exception e)
{
e.printStackTrace();
}
*/
}
private Task<String> delete_user(String text) {
// Create the arguments to the callable function, which is just one string
Map<String, Object> data = new HashMap<>();
data.put("text", text);
return mFunctions
.getHttpsCallable("delete_user")
.call(data)
.continueWith(new Continuation<HttpsCallableResult, String>() {
@Override
public String then(@NonNull Task<HttpsCallableResult> task) throws Exception {
// This continuation runs on either success or failure, but if the task
// has failed then getResult() will throw an Exception which will be
// propagated down.
String result = (String) task.getResult().getData();
return result;
}
});
}
private void set_name(String text)
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) name_view.getLayoutParams();
layoutParams.height= LinearLayout.LayoutParams.WRAP_CONTENT;
name_view.setLayoutParams(layoutParams);
name_view.setText(text);
}
private void remove_name()
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) name_view.getLayoutParams();
layoutParams.height= 0;
name_view.setLayoutParams(layoutParams);
}
private void set_nick(String text)
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) nick_view.getLayoutParams();
layoutParams.height= LinearLayout.LayoutParams.WRAP_CONTENT;
nick_view.setLayoutParams(layoutParams);
nick_view.setText("@ " + text);
}
private void remove_nick()
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) nick_view.getLayoutParams();
layoutParams.height= 0;
nick_view.setLayoutParams(layoutParams);
}
private void set_location(String text)
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) loc_view.getLayoutParams();
layoutParams.height= LinearLayout.LayoutParams.WRAP_CONTENT;
loc_view.setLayoutParams(layoutParams);
loc_view.setText(" " + text);
}
private void remove_location()
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) loc_view.getLayoutParams();
layoutParams.height= 0;
loc_view.setLayoutParams(layoutParams);
}
private void set_phone_view(String ph)
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) phone_view.getLayoutParams();
layoutParams.height= LinearLayout.LayoutParams.WRAP_CONTENT;
phone_view.setLayoutParams(layoutParams);
phone_view.setText(ph);
}
private void remove_phone_view()
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams)phone_view.getLayoutParams();
layoutParams.height= 0;
phone_view.setLayoutParams(layoutParams);
}
private void set_email_view(String em)
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) email_view.getLayoutParams();
layoutParams.height= LinearLayout.LayoutParams.WRAP_CONTENT;
email_view.setLayoutParams(layoutParams);
email_view.setText(em);
}
private void remove_email_view()
{
LinearLayout.LayoutParams layoutParams =(LinearLayout.LayoutParams) email_view.getLayoutParams();
layoutParams.height= 0;
email_view.setLayoutParams(layoutParams);
}
private void check_for_auth_type()
{
if (get_activity_state()&&is_connected()) {
databaseReference.child("users_auth").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (get_activity_state()) {
if (dataSnapshot.hasChild("type")) {
if (dataSnapshot.child("type").getValue().toString().equals("email")) {
if (dataSnapshot.hasChild("email") && !dataSnapshot.child("email").getValue().toString().equals("")) {
send_email_for_forget_password(dataSnapshot.child("email").getValue().toString());
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_retrieving_email), Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.password_cant_be_changed_for_accoutn_s_email), Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_retrieving_email), Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
private void send_email_for_forget_password(String res_email)
{
if (get_activity_state() && is_connected()) {
mAuth.sendPasswordResetEmail(res_email).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
if (task.isSuccessful()) {
progressBar.setVisibility(View.INVISIBLE);
change_password_button.setVisibility(View.VISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.email_sent), Toast.LENGTH_SHORT).show();
/*
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("token").setValue("").addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
{
progressBar.setVisibility(View.INVISIBLE);
change_password_button.setVisibility(View.VISIBLE);
sharedPreferences.edit().putString("token_set","false").apply();
mAuth.signOut();
}else {
progressBar.setVisibility(View.INVISIBLE);
change_password_button.setVisibility(View.VISIBLE);
Toast.makeText(getActivity(),"Error, signing out",Toast.LENGTH_SHORT).show();
}
}
});
*/
} else {
if (get_activity_state()) {
Toast.makeText(getActivity(), task.getException().getMessage(), Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
change_password_button.setVisibility(View.VISIBLE);
}
}
}
}
});
}
else {
if (getActivity()!=null)
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
private void show_change_name_alert()
{
if (personal_data_snap!=null) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View mView = getActivity().getLayoutInflater().inflate(R.layout.update_email_alert_dialog_layout, null);
final EditText updated_email = mView.findViewById(R.id.upated_email_home_top_view);
TextView tit_view = mView.findViewById(R.id.top_title_emai_alert_text_view);
tit_view.setText(getResources().getString(R.string.please_update_your_full_name));
if (personal_data_snap.hasChild("full_name")) {
current_name =personal_data_snap.child("full_name").getValue().toString();
updated_email.setHint(current_name);
}
ConstraintLayout dialog_cancel_button = mView.findViewById(R.id.cancel_button_email_alert_dialog);
ConstraintLayout dialog_update_button = mView.findViewById(R.id.confirm_button_email_alert_dialog);
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog_update_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_name) ) {
dialog.dismiss();
if (is_connected()) {
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("full_name").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.name_changed), Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
}
});
} else {
if (get_activity_state()) {
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
} else {
if (get_activity_state()) {
if (up_name.equals("")) {
Toast.makeText(getActivity(), getResources().getString(R.string.name_cant_be_blank), Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_name)) {
Toast.makeText(getActivity(), getResources().getString(R.string.same_name), Toast.LENGTH_SHORT).show();
}
}
}
}
});
dialog_cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
// builder.setTitle("Horrible Friends").setMessage("Please update your full name.");
// builder.setIcon(R.drawable.logo_icon_horrbile_very_small);
/*
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_name) ) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("full_name").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
{
Toast.makeText(getActivity(), "Name changed!", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
}
else {
Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "No Internet Connection!", Toast.LENGTH_SHORT).show();
}
} else {
if (up_name.equals("")) {
Toast.makeText(getActivity(), "Name can't be blank!", Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_name)) {
Toast.makeText(getActivity(), "Same Name!", Toast.LENGTH_SHORT).show();
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
*/
}
}
private void show_change_nick_alert()
{
if (personal_data_snap!=null) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View mView = getActivity().getLayoutInflater().inflate(R.layout.update_email_alert_dialog_layout, null);
final EditText updated_email = mView.findViewById(R.id.upated_email_home_top_view);
TextView tit_view = mView.findViewById(R.id.top_title_emai_alert_text_view);
tit_view.setText(getResources().getString(R.string.please_up_your_nick_name));
if (personal_data_snap.hasChild("name")) {
current_name =personal_data_snap.child("name").getValue().toString();
updated_email.setHint(current_name);
}
ConstraintLayout dialog_cancel_button = mView.findViewById(R.id.cancel_button_email_alert_dialog);
ConstraintLayout dialog_update_button = mView.findViewById(R.id.confirm_button_email_alert_dialog);
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog_update_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_name) ) {
dialog.dismiss();
if (is_connected()) {
progressBar.setVisibility(View.VISIBLE);
new Thread(new Runnable() {
@Override
public void run() {
databaseReference.child("users").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
boolean found =false;
for (DataSnapshot dataSnapshot1: dataSnapshot.getChildren())
{
for (DataSnapshot dataSnapshot2:dataSnapshot1.getChildren())
{
if (dataSnapshot2.getKey().equals("name"))
{
if (dataSnapshot2.getValue().equals(up_name))
{
found=true;
break;
}
}
}
if (found)
{
break;
}
}
if (!found)
{
if (get_activity_state())
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("name").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.nick_changed), Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
}
});
}
});
}
}else {
if (get_activity_state()) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.nick_already_exitsts), Toast.LENGTH_SHORT).show();
}
});
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
if (get_activity_state())
{
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(),getResources().getString(R.string.error_string),Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
}
});
}
}
});
}
}).start();
} else {
if (getActivity()!=null) {
((home_activity) getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection), true);
}
}
} else {
if (get_activity_state()) {
if (up_name.equals("")) {
Toast.makeText(getActivity(), getResources().getString(R.string.nick_cant_be_blank), Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_name)) {
Toast.makeText(getActivity(), getResources().getString(R.string.same_nick), Toast.LENGTH_SHORT).show();
}
}
}
}
});
dialog_cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
/*
builder.setTitle("Horrible Friends");
builder.setIcon(R.drawable.logo_icon_horrbile_very_small);
builder.setMessage("Please update your Nick name.");
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_name) ) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("name").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
{
Toast.makeText(getActivity(), "Nick changed!", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
}
else {
Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "No Internet Connection!", Toast.LENGTH_SHORT).show();
}
} else {
if (up_name.equals("")) {
Toast.makeText(getActivity(), "Nick can't be blank!", Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_name)) {
Toast.makeText(getActivity(), "Same Nick!", Toast.LENGTH_SHORT).show();
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog.show();
*/
}
}
private void show_change_phone_alert() {
if (get_activity_state() && is_connected())
{
databaseReference.child("users_auth").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (get_activity_state() && dataSnapshot.hasChild("type")) {
if (!dataSnapshot.child("type").getValue().toString().equals("phone_auth")) {
if (personal_data_snap != null) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View mView = getActivity().getLayoutInflater().inflate(R.layout.update_phone_alert_dialog_layout, null);
final EditText updated_email = mView.findViewById(R.id.phone_no_edit_text_update_alert);
final CountryCodePicker myCcp = mView.findViewById(R.id.ccp_update_alert);
updated_email.setFilters(new InputFilter[]{filter});
myCcp.setOnCountryChangeListener(new CountryCodePicker.OnCountryChangeListener() {
@Override
public void onCountrySelected() {
my_selected_city_code = myCcp.getSelectedCountryCode();
}
});
// updated_email.setInputType(InputType.TYPE_CLASS_NUMBER);
if (personal_data_snap.hasChild("phone") && !personal_data_snap.child("phone").getValue().toString().equals("")) {
current_phone = personal_data_snap.child("phone").getValue().toString();
StringBuilder my_str = new StringBuilder(current_phone);
StringBuilder new_str = new StringBuilder();
for (int i = 0; i < my_str.length(); i++) {
if (my_str.charAt(0) == ' ') {
my_str.deleteCharAt(0);
break;
} else {
new_str.append(my_str.charAt(0));
my_str.deleteCharAt(0);
}
}
if (new_str != null && new_str.length() > 0) {
myCcp.setCountryForPhoneCode(Integer.valueOf(new_str.toString()));
}
// myCcp.resetToDefaultCountry();
if (my_str != null && my_str.length() > 0) {
current_phone = my_str.toString();
updated_email.setHint(current_phone);
}
}
ConstraintLayout dialog_cancel_button = mView.findViewById(R.id.cancel_button_phone_alert_dialog);
ConstraintLayout dialog_update_button = mView.findViewById(R.id.confirm_button_phone_alert_dialog);
TextView tit_view = mView.findViewById(R.id.top_title_phone_alert_text_view);
tit_view.setText(getResources().getString(R.string.please_up_your_phone));
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog_update_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_phone)) {
dialog.dismiss();
if (is_connected()) {
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("phone").setValue("+" + my_selected_city_code + " " + updated_email.getText().toString()).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.phone_num_changed), Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
}
});
} else {
if (get_activity_state()) {
((home_activity) getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection), true);
}
}
} else {
if (get_activity_state()) {
if (up_name.equals("")) {
Toast.makeText(getActivity(), getResources().getString(R.string.phoen_no_cant_be_blank), Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_phone)) {
Toast.makeText(getActivity(), getResources().getString(R.string.same_phone_num), Toast.LENGTH_SHORT).show();
}
}
}
}
});
dialog_cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
/*
builder.setTitle("Horrible Friends");
builder.setIcon(R.drawable.logo_icon_horrbile_very_small);
builder.setMessage("Please update your Phone no.");
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_phone) ) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("phone").setValue( "+" + my_selected_city_code + " " + updated_email.getText().toString()).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
{
Toast.makeText(getActivity(), "Phone no. changed!", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
}
else {
Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "No Internet Connection!", Toast.LENGTH_SHORT).show();
}
} else {
if (up_name.equals("")) {
Toast.makeText(getActivity(), "Phone no. can't be blank!", Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_phone)) {
Toast.makeText(getActivity(), "Same Phone no!", Toast.LENGTH_SHORT).show();
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog.show();
*/
}
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.phone_num_cant_change_for_phone_auth), Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_retrieving_phone_num), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
else {
if (get_activity_state())
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
private void show_change_city_alert()
{
if (personal_data_snap!=null) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View mView = getActivity().getLayoutInflater().inflate(R.layout.update_email_alert_dialog_layout, null);
final EditText updated_email = mView.findViewById(R.id.upated_email_home_top_view);
TextView tit_view = mView.findViewById(R.id.top_title_emai_alert_text_view);
tit_view.setText(getResources().getString(R.string.please_up_your_city));
if (personal_data_snap.hasChild("City")) {
current_city =personal_data_snap.child("City").getValue().toString();
updated_email.setHint(current_city);
}
ConstraintLayout dialog_cancel_button = mView.findViewById(R.id.cancel_button_email_alert_dialog);
ConstraintLayout dialog_update_button = mView.findViewById(R.id.confirm_button_email_alert_dialog);
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog_update_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_city) ) {
dialog.dismiss();
if (is_connected()) {
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("City").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.city_changed), Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
}
});
} else {
if (get_activity_state()) {
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
} else {
if (get_activity_state()) {
if (up_name.equals("")) {
Toast.makeText(getActivity(), getResources().getString(R.string.city_cant_blank), Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_phone)) {
Toast.makeText(getActivity(), getResources().getString(R.string.same_city), Toast.LENGTH_SHORT).show();
}
}
}
}
});
dialog_cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
/*
builder.setTitle("Horrible Friends");
builder.setIcon(R.drawable.logo_icon_horrbile_very_small);
builder.setMessage("Please update your City");
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String up_name = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_name.equals(current_city) ) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("City").setValue(up_name).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful())
{
Toast.makeText(getActivity(), "City changed!", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.INVISIBLE);
get_profile_data();
}
else {
Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
}
}
});
} else {
Toast.makeText(getActivity(), "No Internet Connection!", Toast.LENGTH_SHORT).show();
}
} else {
if (up_name.equals("")) {
Toast.makeText(getActivity(), "City can't be blank!", Toast.LENGTH_SHORT).show();
} else if (up_name.equals(current_phone)) {
Toast.makeText(getActivity(), "Same City!", Toast.LENGTH_SHORT).show();
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog.show();
*/
}
}
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,
Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (Character.isWhitespace(source.charAt(i))) {
return "";
}
}
return null;
}
};
private void remove_token()
{
if (mAuth!=null && mAuth.getCurrentUser()!=null && is_connected())
{
progressBar.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users").child(mAuth.getCurrentUser().getUid()).child("token").setValue("").addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
if (task.isSuccessful()) {
sharedPreferences.edit().putString("token_set", "false").apply();
mAuth.signOut();
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.error_try_again), Toast.LENGTH_SHORT).show();
}
}
}
});
}
else{
if (get_activity_state())
{
((home_activity)getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection),true);
}
}
}
private void check_verification()
{
if (mAuth!=null && mAuth.getCurrentUser()!=null && !(mAuth.getCurrentUser().isEmailVerified())) {
if (is_connected())
{
databaseReference.child("users_auth").child(mAuth.getCurrentUser().getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (get_activity_state())
{
if (dataSnapshot.hasChild("type")) {
if (dataSnapshot.child("type").getValue().toString().equals("email")) {
final String current_email = dataSnapshot.child("email").getValue().toString();
veri_em_text_view.setText(getResources().getString(R.string.please_verify_your_email)+" (" + dataSnapshot.child("email").getValue().toString() + "), "+ getResources().getString(R.string.with_the_link_set));
resend_email.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mAuth != null && mAuth.getCurrentUser() != null) {
mAuth.getCurrentUser().sendEmailVerification().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
// error_bar();
}
}).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.email_sent_please_verify), Toast.LENGTH_SHORT).show();
} else {
// error_bar();
Toast.makeText(getActivity(), getResources().getString(R.string.error_sending_email), Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
update_email.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
View mView = getActivity().getLayoutInflater().inflate(R.layout.update_email_alert_dialog_layout, null);
final EditText updated_email = mView.findViewById(R.id.upated_email_home_top_view);
ConstraintLayout dialog_cancel_button = mView.findViewById(R.id.cancel_button_email_alert_dialog);
ConstraintLayout dialog_update_button = mView.findViewById(R.id.confirm_button_email_alert_dialog);
TextView tit_view = mView.findViewById(R.id.top_title_emai_alert_text_view);
updated_email.setHint(current_email);
// builder.setTitle("Horrible Friends");
tit_view.setText(getResources().getString(R.string.please_update_your_email_address));
// builder.setIcon(R.drawable.logo_icon_horrbile_very_small);
// builder.setMessage("Please update your email address.");
builder.setView(mView);
final AlertDialog dialog = builder.create();
dialog_update_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final String up_email = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_email.equals(current_email) && isEmailValid(up_email)) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users_auth").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (get_activity_state()) {
boolean dup_check = false;
for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
if (dataSnapshot1.hasChild("email")) {
if (dataSnapshot1.child("email").getValue().toString().equals(up_email)) {
dup_check = true;
break;
}
}
}
if (dup_check) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.email_already_exists), Toast.LENGTH_SHORT).show();
} else {
Map<String, Object> data = new HashMap<>();
data.put("uid", current_uid);
data.put("email", up_email);
mFunctions.getHttpsCallable("update_email")
.call(data).addOnCompleteListener(new OnCompleteListener<HttpsCallableResult>() {
@Override
public void onComplete(@NonNull Task<HttpsCallableResult> task) {
if (task.isSuccessful()) {
if (get_activity_state()) {
// Log.d(TAG, task.getResult().getData().toString());
progressBar.setVisibility(View.INVISIBLE);
// email updated
Toast.makeText(getActivity(), getResources().getString(R.string.email_up_successfully), Toast.LENGTH_SHORT).show();
send_password_reset_email();
}
} else {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
}
}
});
/*
mAuth.getCurrentUser().updateEmail(up_email).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
progressBar.setVisibility(View.INVISIBLE);
// email updated
Toast.makeText(getActivity(), "Email updated Successfully", Toast.LENGTH_SHORT).show();
check_verification();
} else {
progressBar.setVisibility(View.INVISIBLE);
// task failed
Toast.makeText(getActivity(), task.getException().getMessage(), Toast.LENGTH_LONG).show();
}
}
});
*/
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), getResources().getString(R.string.error_string), Toast.LENGTH_SHORT).show();
}
// error
}
});
} else {
Toast.makeText(getActivity(), getResources().getString(R.string.no_internet_connection), Toast.LENGTH_SHORT).show();
}
} else {
if (up_email.equals("")) {
Toast.makeText(getActivity(), getResources().getString(R.string.email_cant_be_empty), Toast.LENGTH_SHORT).show();
} else if (!isEmailValid(up_email)) {
Toast.makeText(getActivity(), getResources().getString(R.string.please_enter_a_valid_email), Toast.LENGTH_SHORT).show();
} else if (up_email.equals(current_email)) {
Toast.makeText(getActivity(), getResources().getString(R.string.same_email_address), Toast.LENGTH_SHORT).show();
}
}
}
});
dialog_cancel_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
/*
builder.setPositiveButton("Update", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String up_email = updated_email.getText().toString().trim();
if (!(updated_email.getText().toString().trim().equals("")) && !up_email.equals(current_email) && isEmailValid(up_email)) {
if (is_connected()) {
dialog.dismiss();
progressBar.setVisibility(View.VISIBLE);
databaseReference.child("users_auth").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (get_activity_state()) {
boolean dup_check = false;
for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
if (dataSnapshot1.hasChild("email")) {
if (dataSnapshot1.child("email").getValue().toString().equals(up_email)) {
dup_check = true;
break;
}
}
}
if (dup_check) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), "Email already exists!", Toast.LENGTH_SHORT).show();
} else {
Map<String, Object> data = new HashMap<>();
data.put("uid", current_uid);
data.put("email", up_email);
mFunctions.getHttpsCallable("update_email")
.call(data).addOnCompleteListener(new OnCompleteListener<HttpsCallableResult>() {
@Override
public void onComplete(@NonNull Task<HttpsCallableResult> task) {
if (task.isSuccessful()) {
if (get_activity_state()) {
// Log.d(TAG, task.getResult().getData().toString());
progressBar.setVisibility(View.INVISIBLE);
// email updated
Toast.makeText(getActivity(), "Email updated Successfully", Toast.LENGTH_SHORT).show();
send_password_reset_email();
}
} else {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), "Failure", Toast.LENGTH_SHORT).show();
}
}
}
});
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
if (get_activity_state()) {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(getActivity(), "Error!", Toast.LENGTH_SHORT).show();
}
// error
}
});
} else {
Toast.makeText(getActivity(), "No Internet Connection!", Toast.LENGTH_SHORT).show();
}
} else {
if (up_email.equals("")) {
Toast.makeText(getActivity(), "Email can't be empty!", Toast.LENGTH_SHORT).show();
} else if (!isEmailValid(up_email)) {
Toast.makeText(getActivity(), "Please enter a valid email address!", Toast.LENGTH_SHORT).show();
} else if (up_email.equals(current_email)) {
Toast.makeText(getActivity(), "Same Email Address!", Toast.LENGTH_SHORT).show();
}
}
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
*/
}
});
LinearLayout.LayoutParams LayoutParams = (LinearLayout.LayoutParams) un_veri_layout.getLayoutParams();
LayoutParams.height = LayoutParams.WRAP_CONTENT;
un_veri_layout.setLayoutParams(LayoutParams);
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
//cancelled
}
});
}else {
if (get_activity_state()) {
((home_activity) getActivity()).show_snackbar(getResources().getString(R.string.no_internet_connection), true);
}
}
}
else {
if (get_activity_state()) {
LinearLayout.LayoutParams LayoutParams = (LinearLayout.LayoutParams) un_veri_layout.getLayoutParams();
LayoutParams.height = 0;
un_veri_layout.setLayoutParams(LayoutParams);
}
}
}
private void send_password_reset_email()
{
if (mAuth != null && mAuth.getCurrentUser() != null) {
mAuth.getCurrentUser().sendEmailVerification().addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
check_verification();
// error_bar();
}
}).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
check_verification();
if (task.isSuccessful()) {
Toast.makeText(getActivity(), getResources().getString(R.string.email_sent_please_verify), Toast.LENGTH_SHORT).show();
} else {
// error_bar();
Toast.makeText(getActivity(), getResources().getString(R.string.error_sending_email), Toast.LENGTH_SHORT).show();
}
}
});
}
}
public static boolean isEmailValid(String email) {
String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
public boolean check_storage_permission()
{
if (getActivity()!=null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//int permissionCheck = this.checkSelfPermission("Manifest.permission.ACCESS_FINE_LOCATION");
// permissionCheck +=this.checkSelfPermission("Manifest.permission.ACCESS_COARSE_LOCATION");
// Toast.makeText(this,String.valueOf(permissionCheck),Toast.LENGTH_SHORT).show();
// if(permissionCheck!=0){
if ((ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) || ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
return false;
} else {
return true;
}
}
else {
return true;
}
}
else {
return false;
}
}
}
| [
"[email protected]"
] | |
f0f5355b3cdd5733b9fb36848e516b0c3672c98b | 0869ca5baeb9b38d554101fb55e0857c97ad3623 | /app/src/main/java/com/wallet/crypto/trustapp/service/rpc/tron/entity/GetTrasactionsToThisResponse.java | 905168bb3218cf299ff7ad3a830c5639b1ebbcf0 | [] | no_license | alitong/oldTrust | a4c9198d6a9f7c632129247173ccb9ee908c72a7 | cdce6c1acbc6f848b171718f57920cf07dafc816 | refs/heads/master | 2022-03-03T22:48:59.970155 | 2019-10-08T09:34:41 | 2019-10-08T09:34:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,479 | java | package com.wallet.crypto.trustapp.service.rpc.tron.entity;
import java.util.Arrays;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: GetTrasactionsToThisResponse.kt */
public final class GetTrasactionsToThisResponse {
private final GetTrasactionsToThisTransaction[] transaction;
public GetTrasactionsToThisResponse(GetTrasactionsToThisTransaction[] getTrasactionsToThisTransactionArr) {
Intrinsics.checkParameterIsNotNull(getTrasactionsToThisTransactionArr, "transaction");
this.transaction = getTrasactionsToThisTransactionArr;
}
public static /* synthetic */ GetTrasactionsToThisResponse copy$default(GetTrasactionsToThisResponse getTrasactionsToThisResponse, GetTrasactionsToThisTransaction[] getTrasactionsToThisTransactionArr, int i, Object obj) {
if ((i & 1) != 0) {
getTrasactionsToThisTransactionArr = getTrasactionsToThisResponse.transaction;
}
return getTrasactionsToThisResponse.copy(getTrasactionsToThisTransactionArr);
}
public final GetTrasactionsToThisTransaction[] component1() {
return this.transaction;
}
public final GetTrasactionsToThisResponse copy(GetTrasactionsToThisTransaction[] getTrasactionsToThisTransactionArr) {
Intrinsics.checkParameterIsNotNull(getTrasactionsToThisTransactionArr, "transaction");
return new GetTrasactionsToThisResponse(getTrasactionsToThisTransactionArr);
}
public boolean equals(Object obj) {
if (this != obj) {
if (obj instanceof GetTrasactionsToThisResponse) {
if (Intrinsics.areEqual(this.transaction, ((GetTrasactionsToThisResponse) obj).transaction)) {
return true;
}
}
return false;
}
return true;
}
public final GetTrasactionsToThisTransaction[] getTransaction() {
return this.transaction;
}
public int hashCode() {
GetTrasactionsToThisTransaction[] getTrasactionsToThisTransactionArr = this.transaction;
return getTrasactionsToThisTransactionArr != null ? Arrays.hashCode(getTrasactionsToThisTransactionArr) : 0;
}
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("GetTrasactionsToThisResponse(transaction=");
stringBuilder.append(Arrays.toString(this.transaction));
stringBuilder.append(")");
return stringBuilder.toString();
}
}
| [
"[email protected]"
] | |
48f30b655adc60ad67b14ad3b6d092d3766600e3 | 669daed9753733a4613bfe6ff3974990376ed3df | /revapi-java/comparisons/code/v1/src/comparison/methods/Final.java | 8abb194bca8f867c4c32f64d8014f550bc811db8 | [
"Apache-2.0"
] | permissive | revapi/revapi | 3016fc2b9bb1c5f21caa6248f2068c5ca1f71611 | 4d862015c357ffda74f6cba86603a9162330ac3a | refs/heads/main | 2023-09-03T00:36:15.496592 | 2022-12-08T12:12:56 | 2022-12-08T12:12:56 | 26,486,958 | 182 | 54 | Apache-2.0 | 2023-08-15T17:43:33 | 2014-11-11T13:50:08 | Java | UTF-8 | Java | false | false | 738 | java | /*
* Copyright $year Lukas Krejci
*
* 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 comparison.methods;
public class Final {
public final void finalMethod() {
}
public void nonFinalMethod() {
}
}
| [
"[email protected]"
] | |
2c26552e1fcc1a5d5735aa8b2d610b0092bd0256 | 971fd37f1f17de6d68a83cfcab7d90fa5c312c74 | /src/main/java/superlord/prehistoricfauna/client/model/fossil/DesmatosuchusSkullModel.java | d369a41c856004abdbf4ce48d640bed4827e1c3b | [] | no_license | superlord9362/Prehistoric-Fauna | 0d7643f38866ebc57fb4c06064866c50b685a16c | 66663c099d9789c552b4b491b0cf84fd98eeddcf | refs/heads/1.16 | 2023-08-10T00:09:19.755712 | 2023-04-06T05:21:14 | 2023-04-06T05:21:14 | 159,386,846 | 15 | 13 | null | 2023-02-02T11:46:56 | 2018-11-27T19:17:54 | Java | UTF-8 | Java | false | false | 2,575 | java | package superlord.prehistoricfauna.client.model.fossil;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import superlord.prehistoricfauna.common.entities.fossil.DesmatosuchusSkullEntity;
/**
* DesmatosuchusSkull - Obsolerus
* Created using Tabula 8.0.0
*/
@OnlyIn(Dist.CLIENT)
public class DesmatosuchusSkullModel extends EntityModel<DesmatosuchusSkullEntity> {
public ModelRenderer Head;
public ModelRenderer Nose;
public ModelRenderer Head_1;
public ModelRenderer Dentary;
public DesmatosuchusSkullModel() {
this.textureWidth = 160;
this.textureHeight = 160;
this.Nose = new ModelRenderer(this, 67, 1);
this.Nose.setRotationPoint(0.0F, 0.0F, -3.0F);
this.Nose.addBox(-1.0F, -1.0F, -4.0F, 2.0F, 2.0F, 4.0F, 0.0F, 0.0F, 0.0F);
this.Dentary = new ModelRenderer(this, 69, 20);
this.Dentary.setRotationPoint(0.0F, 0.0F, -3.0F);
this.Dentary.addBox(-1.0F, 0.0F, -3.0F, 2.0F, 1.0F, 3.0F, 0.0F, 0.0F, 0.0F);
this.setRotateAngle(Dentary, 0.0F, 0.001745329278001762F, 0.0F);
this.Head = new ModelRenderer(this, 65, 11);
this.Head.setRotationPoint(0.0F, 21.0F, 3.0F);
this.Head.addBox(-2.0F, -1.0F, -3.0F, 4.0F, 2.0F, 3.0F, 0.0F, 0.0F, 0.0F);
this.Head_1 = new ModelRenderer(this, 66, 26);
this.Head_1.setRotationPoint(0.0F, 1.0F, 0.0F);
this.Head_1.addBox(-2.0F, 0.0F, -3.0F, 4.0F, 2.0F, 3.0F, 0.0F, 0.0F, 0.0F);
this.Head.addChild(this.Nose);
this.Head_1.addChild(this.Dentary);
this.Head.addChild(this.Head_1);
}
@Override
public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
ImmutableList.of(this.Head).forEach((modelRenderer) -> {
modelRenderer.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
});
}
@Override
public void setRotationAngles(DesmatosuchusSkullEntity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {}
/**
* This is a helper function from Tabula to set the rotation of model parts
*/
public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
modelRenderer.rotateAngleX = x;
modelRenderer.rotateAngleY = y;
modelRenderer.rotateAngleZ = z;
}
}
| [
"[email protected]"
] | |
1c12d28b7cf7e2112bfda30817b8ffbca4056a33 | 420f6058565ea51c4afba4cd08b505f9501e7a90 | /api/src/main/java/net/inetalliance/lutra/elements/PElementChild.java | f63b35f6425f7bfb363956ff27a3f5f89d545209 | [] | no_license | inetalliance/lutra | 62b90dc3fcf5103b26fc4fe18b8790cffb0daf26 | 6fafd5bff50b513207a2cd897f59ba095295bdd2 | refs/heads/master | 2023-02-19T00:35:50.257874 | 2023-02-16T18:53:25 | 2023-02-16T18:53:25 | 165,093,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 90 | java | package net.inetalliance.lutra.elements;
public interface PElementChild extends Child
{
} | [
"[email protected]"
] | |
cb8d05deef7e199464864d10939d6a0a1272128c | 8ce1065df8b7edcc9fa8fc4fb5a1572153a53aed | /messaging/src/main/java/no/hig/imt3281/ludo/messaging/Message.java | b340adce5e2fb3e8ed49f48b11188f34a5fe42a8 | [] | no_license | martinmine/ludo | 14eb2afbe9ccfb62241d91793b3257d0b76418a9 | 1ab3c6dd0e85cc8da4f0933b012ebe12943cade3 | refs/heads/master | 2020-05-24T16:54:51.383829 | 2014-11-29T10:44:41 | 2014-11-29T10:44:41 | 84,860,672 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package no.hig.imt3281.ludo.messaging;
import java.io.Serializable;
/**
* Message class.
*/
public abstract class Message implements Serializable {
}
| [
"[email protected]"
] | |
95176521073f34c0d0de6a5c6e0f4665b941d698 | 60bb4f5a1bec3d956aa800648f20f7ed5f6dc439 | /src/main/java/edu/brown/cs/student/main/Main.java | 1ca6c98add10522b230a6ae578d18c3791d74cfb | [] | no_license | jbernar3/lab-databases | 81ad35a08d4441803443f3e4ac01e194225caa13 | d9d8c69478797c2411e50a8e86ae2faa647a0e0f | refs/heads/master | 2021-02-10T15:59:23.717512 | 2020-02-02T21:19:56 | 2020-02-02T21:19:56 | 244,396,650 | 0 | 0 | null | 2020-03-02T14:50:50 | 2020-03-02T14:50:50 | null | UTF-8 | Java | false | false | 6,635 | java | package edu.brown.cs.student.main;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.ImmutableMap;
import freemarker.template.Configuration;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import spark.ExceptionHandler;
import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.Spark;
import spark.TemplateViewRoute;
import spark.template.freemarker.FreeMarkerEngine;
/**
* The Main class of our project. This is where execution begins.
*/
public final class Main {
private static final int DEFAULT_PORT = 4567;
/**
* The initial method called when execution begins.
*
* @param args An array of command line arguments
*/
public static void main(String[] args) throws SQLException, ClassNotFoundException {
new Main(args).run();
}
private String[] args;
private Main(String[] args) {
this.args = args;
}
private void run() throws SQLException, ClassNotFoundException {
OptionParser parser = new OptionParser();
parser.accepts("gui");
parser.accepts("port").withRequiredArg().ofType(Integer.class)
.defaultsTo(DEFAULT_PORT);
parser.accepts("prefix");
parser.accepts("whitespace");
parser.accepts("stats");
OptionSpec<Integer> ledSpec =
parser.accepts("led").withRequiredArg().ofType(Integer.class);
OptionSpec<String> dataSpec =
parser.accepts("data").withRequiredArg().ofType(String.class);
OptionSpec<String> databaseSpec =
parser.accepts("database").withRequiredArg().ofType(String.class);
OptionSpec<String> deleteSpec = parser.accepts("delete").withRequiredArg().ofType(String.class);
OptionSet options = parser.parse(args);
if (options.has("gui")) {
runSparkServer((int) options.valueOf("port"));
} else if (options.has("data") || options.has("database")) {
boolean prefix = false;
boolean whitespace = false;
int led = 0;
if (options.has("prefix")) {
prefix = true;
}
if (options.has("whitespace")) {
whitespace = true;
}
if (options.has("led")) {
led = (int) options.valueOf(ledSpec);
}
Autocorrector ac = null;
Database db;
if (options.has("database")) {
try {
db = new Database(options.valueOf(databaseSpec));
if (options.has("data")) {
String files = options.valueOf(dataSpec);
List<String> fileNames = new ArrayList<String>(Arrays.asList(files.split(",")));
for (String file : fileNames) {
db.readCorpus(file);
}
} else {
db.readAll();
}
ac = new Autocorrector(db, prefix, whitespace, led);
if (options.has("stats")) {
Map<String, Integer> freq = db.getFrequencyMap();
System.out.println("\u001b[35mCorpus Statistics:\u001b[0m");
for (String key: freq.keySet()) {
System.out.println(key + " : " + freq.get(key));
}
Map<String, Integer> occur = db.getInstanceMap();
System.out.println("\u001b[35mWord Statistics:\u001b[0m");
for (String key: occur.keySet()) {
System.out.println(key + " : " + occur.get(key));
}
}
} catch (SQLException e) {
System.err.println("SQLite error: " + e.getMessage());
System.exit(1);
}
} else {
String files = options.valueOf(dataSpec);
ac = new Autocorrector(files, prefix, whitespace, led);
}
// Create autocorrector using files and flags passed in.
// For each line of input from user, output autocorrect suggestions.
try (BufferedReader br = new BufferedReader(
new InputStreamReader(System.in))) {
String input;
while ((input = br.readLine()) != null) {
Set<String> suggestions = ac.suggest(input);
for (String s : suggestions) {
System.out.println(s);
}
}
br.close();
} catch (Exception e) {
System.out.println("ERROR: Invalid input for REPL");
System.out.println(e.getClass());
for (StackTraceElement i : e.getStackTrace()) {
System.out.println(i.toString());
}
}
} else {
System.out.println("ERROR: usage");
System.out.print("./run --data=<list of files> \n[--prefix] [--whitespace] [--led=<led>]\n");
}
}
private static FreeMarkerEngine createEngine() {
Configuration config = new Configuration();
File templates = new File("src/main/resources/spark/template/freemarker");
try {
config.setDirectoryForTemplateLoading(templates);
} catch (IOException ioe) {
System.out.printf("ERROR: Unable use %s for template loading.%n",
templates);
System.exit(1);
}
return new FreeMarkerEngine(config);
}
private void runSparkServer(int port) {
Spark.port(port);
Spark.externalStaticFileLocation("src/main/resources/static");
Spark.exception(Exception.class, new ExceptionPrinter());
FreeMarkerEngine freeMarker = createEngine();
// Setup Spark Routes
Spark.get("/autocorrect", new AutocorrectHandler(), freeMarker);
}
/**
* Display an error page when an exception occurs in the server.
*/
private static class ExceptionPrinter implements ExceptionHandler {
@Override
public void handle(Exception e, Request req, Response res) {
res.status(500);
StringWriter stacktrace = new StringWriter();
try (PrintWriter pw = new PrintWriter(stacktrace)) {
pw.println("<pre>");
e.printStackTrace(pw);
pw.println("</pre>");
}
res.body(stacktrace.toString());
}
}
/**
* A handler to produce our autocorrect service site.
*
* @return ModelAndView to render.
* (autocorrect.ftl).
*/
private static class AutocorrectHandler implements TemplateViewRoute {
@Override
public ModelAndView handle(Request req, Response res) {
Map<String, Object> variables = ImmutableMap.of("title",
"Autocorrect: Generate suggestions", "message", "Build your Autocorrector here!");
return new ModelAndView(variables, "autocorrect.ftl");
}
}
}
| [
"[email protected]"
] | |
bb34fe77ecbf202fd10b5ebe933a12ddabf1d58a | bc33d15dec934780c2686982870136bae706c772 | /DataStructures/src/LinkedList/LinkedListTwo.java | 1126f7796bdeb4eaf32068d6abc5601a6fc27df0 | [] | no_license | ignesious/MyDataStructures | e3f6fa982c59878cd1c4a554499ff4fe8e527a19 | 9e6a97022dafc4a673bde130604ee0ea3cd6e8ef | refs/heads/master | 2021-04-27T03:35:42.688918 | 2019-01-29T07:19:46 | 2019-01-29T07:19:46 | 122,717,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,573 | java | package LinkedList;
import java.util.ArrayList;
public class LinkedListTwo {
ListNode head;
ListNode headTwo;
ListNode slowPointPali;
ListNode fastPointPali;
ListNode reverseCheck;
ListNode newHead;
ListNode slowcut ;
int reorderSwitch=1;
ArrayList<Integer> storeNodeValue = new ArrayList<Integer>();
static LinkedListTwo demo;
static class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
}
public void traversalList(ListNode n) {
// ListNode n = head;
while (n != null) {
System.out.print(n.val + "------>");
n = n.next;
}
System.out.println("NULL");
}
public String findelemRecursive(ListNode findElem, int key) {
if (findElem == null)
return "Not Found";
else if (key == findElem.val)
return "Found the value " + key;
else
return findelemRecursive(findElem.next, key);
}
public ListNode reversUtil(ListNode curr, ListNode prev) {
if (curr.next == null) {
demo.reverseCheck = curr;
curr.next = prev;
return null;
} else {
ListNode next = curr.next;
curr.next = prev;
reversUtil(next, curr);
}
return null;
}
public ListNode reversUtilPali(ListNode curr, ListNode prev) {
if (curr.next == null) {
demo.head = curr;
curr.next = prev;
return null;
} else {
ListNode next = curr.next;
curr.next = prev;
reversUtil(next, curr);
}
return null;
}
public ListNode returnSlowFastPalindrome(ListNode curr) {
slowPointPali = curr;
slowcut = slowPointPali;
fastPointPali = slowPointPali;
while (fastPointPali != null && fastPointPali.next != null) {
slowcut = slowPointPali;
slowPointPali = slowPointPali.next;
fastPointPali = fastPointPali.next.next;
}
slowcut.next = null;
return slowPointPali;
}
// Floyd Cycle Detection Algorithm.
public void detectLoop(ListNode slowPoint, ListNode fastPoint) {
// ListNode slowPoint = demo.head;
// ListNode fastPoint = demo.head;
while (slowPoint != null && fastPoint != null && fastPoint.next != null) {
slowPoint = slowPoint.next;
fastPoint = fastPoint.next.next;
if (slowPoint == fastPoint) {
System.out.println("Cycle detected" + slowPoint.val);
break;
}
}
return;
}
public ListNode mergeSortedList(ListNode a, ListNode b) {
ListNode result = null;
if (a == null)
return b;
if (b == null)
return a;
if (a.val <= b.val) {
result = a;
result.next = mergeSortedList(a.next, b);
} else {
result = b;
result.next = mergeSortedList(a, b.next);
}
return result;
}
public void isPalindrome(ListNode check) {
boolean isEven = (this.findCount(check) % 2 == 0 ? true : false);
boolean isPalindrome = true;
ListNode tempNode;
ListNode firstPoint, secondPoint;
// System.out.println("Middle element is"+(this.returnSlowFastPalindrome(check)).val);
this.returnSlowFastPalindrome(check);
if (isEven) {
// TODO for even block
// Reverse the second half;
this.reversUtilPali(demo.slowPointPali, null);
firstPoint = demo.head;
secondPoint = demo.reverseCheck;
while (firstPoint != null && secondPoint != null) {
if (firstPoint.val != secondPoint.val) {
isPalindrome = false;
break;
} else {
firstPoint = firstPoint.next;
secondPoint = secondPoint.next;
}
}
System.out.println("The palindrome result is " + isPalindrome);
} else {
// TODO for odd block
tempNode = demo.slowPointPali;
demo.slowPointPali = demo.slowPointPali.next;
tempNode.next = null;
this.reversUtilPali(demo.slowPointPali, null);
firstPoint = demo.headTwo;
secondPoint = demo.reverseCheck;
while (firstPoint != null && secondPoint != null) {
if (firstPoint.val != secondPoint.val) {
isPalindrome = false;
break;
} else {
firstPoint = firstPoint.next;
secondPoint = secondPoint.next;
}
}
System.out.println("The palindrome result is " + isPalindrome);
}
}
public void removeDuplicates(ListNode dupli) {
while (dupli != null && dupli.next != null) {
if (dupli.val == dupli.next.val) {
dupli.next = dupli.next.next;
} else {
dupli = dupli.next;
}
}
}
public void removeDuplicatesUnsorted(ListNode dupli) {
while (dupli != null && dupli.next != null) {
if ((dupli.val != dupli.next.val)
&& !(demo.storeNodeValue.contains(dupli.next.val))) {
System.out.println("distint first value storing in array"
+ dupli.val);
demo.storeNodeValue.add(dupli.val);
dupli = dupli.next;
} else {
System.out.println("elem of array-->" + demo.storeNodeValue
+ "Duplicate element" + dupli.next.val);
dupli.next = dupli.next.next;
}
}
}
public void rotateList(ListNode rotatelist, int k) {
// Determine k should be mod of length
k = k % demo.findCount(rotatelist);
if(k!=0){
ListNode slowPoint, fastPoint;
slowPoint = rotatelist;
fastPoint = slowPoint;
while (k != 0) {
fastPoint = fastPoint.next;
k--;
}
// Traverse till end of the list
while (fastPoint.next != null) {
slowPoint = slowPoint.next;
fastPoint = fastPoint.next;
}
// System.out.println("fastpoint in this node" + fastPoint.val + "SlowPoint in " + slowPoint.val);
demo.newHead = slowPoint.next;
slowPoint.next = null;
fastPoint.next = demo.head;
}
else
{
System.out.println("Nothing to modify");
}
}
/*
* public void createIntersectionList(ListNode first, ListNode second) {
*
* while (first != null) { // System.out.print(n.val + "------>");
* demo.storeNodeValue.add(first.val); first = first.next; } while (second
* != null) { // System.out.print(n.val + "------>"); if
* (demo.storeNodeValue.contains(second.val)) {
*
* System.out.println("i will add this shit" + second.val); }
*
* second = second.next; }
*
* }
*
* Junk method hence commenting.....!!!
*/
public void createIntersectionList(ListNode first, ListNode second) {
while (first != null && second != null) {
if (first.val == second.val) {
System.out.println("Intersecting hence will add" + first.val
+ "second val" + second.val);
first = first.next;
second = second.next;
} else if (first.val < second.val) {
first = first.next;
} else
second = second.next;
}
}
public void reorderList(ListNode check)
{
boolean isEven = (this.findCount(check) % 2 == 0 ? true : false);
ListNode p1, p2,preMiddle;
this.returnSlowFastPalindrome(check);
if (isEven) {
// TODO for even block
// Reverse the second half;
this.reversUtil(demo.slowPointPali, null);
p1 = demo.head;
p2 = demo.reverseCheck;
preMiddle=demo.slowcut;
while(p1!=preMiddle){
preMiddle.next=p2.next;
p2.next=p1.next;
p1.next=p2;
p1=p2.next;
p2=preMiddle.next;
}
}
}
public int findCount(ListNode n) {
// ListNode n = head;
int listCount = 0;
while (n != null) {
// System.out.print(n.val+"------>");
n = n.next;
listCount++;
}
return listCount;
}
public double traversalandGiveresultList(ListNode n,int lenght) {
// ListNode n = head;
double finalRes=0;
while (n != null) {
double calculate=0;
//System.out.print(n.val + "------>");
calculate = n.val * Math.pow(10, --lenght);
finalRes+=calculate;
n = n.next;
}
return finalRes;
}
public ListNode createNewList(double finalListvalue)
{
ListNode finalListhead;
String numWihoutDecimal = String.valueOf(finalListvalue).split("\\.")[0];
//System.out.println(numWihoutDecimal);
//System.out.println(numWihoutDecimal.length());
char numWithoutDecimalChar[]=numWihoutDecimal.toCharArray();
/*for(char newvalue : numWithoutDecimalChar)
{
System.out.println(newvalue);
}*/
finalListhead=this.createListRecursive(numWithoutDecimalChar, (numWithoutDecimalChar.length)-1, 0);
return finalListhead;
}
public ListNode createListRecursive(char[] tocreate,int lenght,int piker)
{
ListNode newNode=null;
if(lenght == 0)
{
//last node
newNode=new ListNode(Integer.parseInt(tocreate[piker]+""));
return newNode;
}
else
{
newNode=new ListNode(Integer.parseInt(tocreate[piker]+""));
piker++;
lenght--;
newNode.next=this.createListRecursive(tocreate, lenght, piker);
}
return newNode;
}
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
// int x=0;
//int y=0;
// System.out.println("Math.pow(" + x + "," + y + ")=" + Math.pow(x, y));
ListNode finalV=null;
int firstListLength = this.findCount(l1);
int secondListLength = this.findCount(l2);
double firstListVal=this.traversalandGiveresultList(l1, firstListLength);
double secondListVal=this.traversalandGiveresultList(l2, secondListLength);
System.out.println("firstlistval" + firstListVal + "seconListValue"+ secondListVal);
double finalListVal = firstListVal+secondListVal;
System.out.println("FinalListVal"+finalListVal);
finalV=this.createNewList(finalListVal);
return finalV;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
String list1="9";
String list2="1999999999";
demo = new LinkedListTwo();
demo.head = demo.createListRecursive(list1.toCharArray(), list1.length()-1, 0);
demo.headTwo=demo.createListRecursive(list2.toCharArray(), list2.length()-1, 0);
demo.traversalList(demo.head);
demo.traversalList(demo.headTwo);
// demo.traversalList(demo.head);
// System.out.println("\n");
// demo.traversalList(demo.head);
// demo.createIntersectionList(demo.head, demo.headTwo);
//demo.rotateList(demo.head, 17);
//System.out.println(" ");
// demo.traversalList(demo.newHead);
// demo.reorderList(demo.head);
// System.out.println(" ");
// demo.traversalList(demo.head);
//System.out.println(" ");
// demo.traversalList(demo.reverseCheck);
// System.out.println(" ");
demo.addTwoNumbers(demo.head, demo.headTwo);
}
}
| [
"[email protected]"
] | |
5434fc812844c7e47bf6dd031fb4aca022d98b62 | 151155296522361d1be86d11de98f6b320f62542 | /JAVA/reverse.java | 85032d4d34b65e9b00ce152b2e55da7e423e4a65 | [] | no_license | Sona58/Practice-Programming | 2950b53f8d6fc69341b986a950fea5436d763fdf | 1b93b4a2cf2d87ab361b8c7767d5313cb37aa693 | refs/heads/master | 2020-04-21T18:33:21.515346 | 2016-12-11T19:27:01 | 2016-12-11T19:27:01 | 67,288,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | import java.lang.*;
class reverse
{
public static void main(String ar[])
{
int n,r,p,m;
n=321;
r=0;
m=n;
while(m!=0)
{
p=m%10;
r=(r*10)+p;
m=m/10;
}
System.out.println("Reverse of "+n+" is "+r);
}
}; | [
"[email protected]"
] | |
ad04e53e861655c3b01654cb6107cc948a44ce36 | f5668ec4668973e3b983115cf664c7b29fa23477 | /eai/eai-camel-magento/src/main/java/magento/CatalogProductTagRemoveRequestParam.java | 1971a7b5ff48b04c619276e19e137a11e13df6ae | [] | no_license | jcpantunes/puc-projetos | 61373777cb38ea379881f1c0cdbd6a3bf7987721 | f7cc6b8433c21aa8dfae5638706245e4f54dd088 | refs/heads/master | 2022-12-23T00:16:47.831648 | 2019-05-29T02:40:52 | 2019-05-29T02:40:52 | 37,751,387 | 0 | 0 | null | 2022-12-09T22:36:33 | 2015-06-19T23:58:04 | Java | UTF-8 | Java | false | false | 2,207 | java |
package magento;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="tagId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"sessionId",
"tagId"
})
@XmlRootElement(name = "catalogProductTagRemoveRequestParam")
public class CatalogProductTagRemoveRequestParam {
@XmlElement(required = true)
protected String sessionId;
@XmlElement(required = true)
protected String tagId;
/**
* Gets the value of the sessionId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSessionId() {
return sessionId;
}
/**
* Sets the value of the sessionId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSessionId(String value) {
this.sessionId = value;
}
/**
* Gets the value of the tagId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTagId() {
return tagId;
}
/**
* Sets the value of the tagId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTagId(String value) {
this.tagId = value;
}
}
| [
"[email protected]"
] | |
b3668d558420ebd512d0c40b5159ef7d5cc7ca6d | 6d8c85ad62e7634ab39bd0711b521c1110badc69 | /src/main/java/com/zhoubi/graindepot/controller/InoutBaseController.java | 8e677c71ae210227940e90e8bc8e75122d81e2ec | [] | no_license | fredma1987/graindepot-inout | 7b7d8d92f01bd7910106ab9bd0735ac1ff5449ff | 295f4d32c883339c19098e2facfc01f4b2863dc5 | refs/heads/master | 2020-04-13T14:23:09.381953 | 2019-04-03T11:11:09 | 2019-04-03T11:11:09 | 163,261,136 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.zhoubi.graindepot.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
//graindeopot-inout公用的请求
@Controller
@RequestMapping("base")
public class InoutBaseController extends BaseController{
//根据billcode获取billid
}
| [
"[email protected]"
] | |
795f15211ddc347ecf86124dfd1b6bdab24f189d | 3d86fc4d944591ef4c91fd0db55edcac42331ed4 | /Teque.java | 84e1a147a826dc4140001dd2b974d096d8e83f74 | [] | no_license | CeciliaYSui/Kattis-Solutions | 51bb377cf9e84f1897daf569cd046b71088e2053 | 10937055be9cf87dff0ce536903d45ae72911a74 | refs/heads/master | 2022-11-21T14:41:06.252493 | 2020-07-22T19:18:33 | 2020-07-22T19:18:33 | 174,606,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,443 | java | // Java Implementation --> Python speed limit *
import java.util.*;
import java.io.*;
public class Teque {
private static HashMap<Integer, Integer> df = new HashMap<>();
private static HashMap<Integer, Integer> db = new HashMap<>();
static int fmin, fmax, bmin, bmax = 0;
public static void main(String[] args) throws IOException{
// Scanner sc = new Scanner(System.in); // I/O too slow???
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
// StringTokenizer st;
int n = Integer.parseInt(sc.readLine());
for (int i = 0; i < n; i++) {
String[] act = sc.readLine().split(" ");
int val = Integer.parseInt(act[1]);
int tmp;
if (act[0].charAt(0) == 'p') {
switch(act[0].charAt(5)) {
case 'b':
db.put(bmax, val);
bmax++;
break;
case 'f':
fmin--;
df.put(fmin, val);
break;
default: // push_middle
if (df.size() == db.size()) {
bmin--;
db.put(bmin, val);
}
else {
df.put(fmax, db.get(bmin));
fmax++;
db.put(bmin, val);
}
}
// clean up
if (df.size() > db.size()) {
bmin--;
fmax--;
db.put(bmin, df.get(fmax));
df.remove(fmax);
}
else if (db.size() > df.size()+1) {
df.put(fmax, db.get(bmin));
db.remove(bmin);
bmin++;
fmax++;
}
}
else {
if (val < fmax - fmin){
tmp = df.get(fmin + val);
}
else {
val -= fmax - fmin;
tmp = db.get(bmin + val);
}
out.write(Integer.toString(tmp) + "\n");
//System.out.println(tmp);
}
}
out.flush();
}
} | [
"[email protected]"
] | |
9a2017f38605a4d26b37cf046abd776dd901726c | 74d50fc37a5043e50cb06266caefb017ba8c1461 | /src/main/java/com/nexttechnologies/nexttechnologiesserver/exception/ExceptionHandlerAdvise.java | ef5b134bb2dccc359a8ea091a469d99fe2a8713f | [] | no_license | namorytraore1984/next-technologies-server | 0eaa8aeff320e17ed38b7b6b619256e166a0bab3 | e4434edfb28004c7c57c0ecba5a7cae3d0f7535c | refs/heads/master | 2023-02-09T08:03:19.643839 | 2020-12-31T16:49:04 | 2020-12-31T16:49:04 | 324,651,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.nexttechnologies.nexttechnologiesserver.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class ExceptionHandlerAdvise {
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(Exception.class)
public ErrorEntity unknowExceptionHandler(Exception e) {
return new ErrorEntity("500", "Exception gere");
}
}
| [
"[email protected]"
] | |
2bec466a55d88de98672fbfc4813db97c83c026d | 1f9738dce660ef85d0cdbd8275e7a0e3bc84e1d2 | /app/src/main/java/com/example/love_people/coolweather/MainActivity.java | c0e18873f109aa24a58c87eb5632c6a5694e7c14 | [] | no_license | Hairresser/CoolWeather | 963e2baf892d8bef4386b37d9036359a7c251f16 | dd9ea2c5b787be00b08490b26b9e049adb605b87 | refs/heads/master | 2021-05-14T15:05:27.445024 | 2018-01-05T01:34:20 | 2018-01-05T01:34:20 | 115,969,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package com.example.love_people.coolweather;
import android.content.Intent;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
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);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getString("weather", null) != null){
Intent intent = new Intent(this, WeatherActivity.class);
startActivity(intent);
finish();
}
}
}
| [
"[email protected]"
] | |
d7bd679e1098ac759b4fa1bb767d73190e9f1cc6 | 621f1dcbeb8fb52be6559769934c2cafc237fb5b | /doiter-android/src/main/java/com/lutshe/doiter/views/common/CanvasView.java | dc2d3f6a1aaaac64af126a803a75166cd2fcf000 | [] | no_license | arsen-adzhiametov/doiter | 379a0e93a0511bcc5d4d1340acc7cb2ae5d65a85 | fc5d4c9f3feafecc908090870e538ea7ca3f5da4 | refs/heads/master | 2022-12-21T09:49:52.844127 | 2014-08-03T13:32:41 | 2014-08-03T13:32:41 | 248,626,315 | 0 | 1 | null | 2022-12-16T00:48:31 | 2020-03-19T23:33:49 | Java | UTF-8 | Java | false | false | 2,578 | java | package com.lutshe.doiter.views.common;
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import com.lutshe.doiter.R;
public class CanvasView extends SurfaceView implements SurfaceHolder.Callback {
private volatile boolean isReady = false;
private SurfaceHolder surfaceHolder;
private Drawable bg;
private Activity activity;
public CanvasView(Activity activity) {
super(activity);
this.activity = activity;
prepare();
setWillNotDraw(false);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
bg.setBounds(getHolder().getSurfaceFrame());
bg.draw(canvas);
}
private void prepare() {
bg = getResources().getDrawable(R.drawable.bg_repeatable);
surfaceHolder = getHolder();
surfaceHolder.addCallback(this);
}
public void startShowingMap() {
setSetWillNotDraw(true);
}
public void startShowingBg() {
setSetWillNotDraw(false);
}
private void setSetWillNotDraw(final boolean willNotDraw) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
CanvasView.this.setWillNotDraw(willNotDraw);
} catch (Exception e) {
Log.e("ERROR", "setwillnotdraw failed", e);
}
}
});
}
public boolean isReady() {
return isReady;
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
isReady = true;
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
isReady = false;
}
public Canvas getCanvas() {
Surface surface = surfaceHolder.getSurface();
if (surface == null || !surface.isValid()) {
return null;
}
return surfaceHolder.lockCanvas();
}
public void releaseCanvas(Canvas canvas) {
surfaceHolder.unlockCanvasAndPost(canvas);
}
public Rect getViewBounds() {
waitForViewToBeReady();
return getHolder().getSurfaceFrame();
}
protected void waitForViewToBeReady() {
while (!isReady()) {
Log.d("waiting", "waiting for view to initialize");
try {
Thread.sleep(20);
} catch (InterruptedException e) {
}
}
}
} | [
"[email protected]"
] | |
d66f8cf1f0dfb18439cf773c635b0450f0b72847 | 7c3ca8ecaadc27c9d76f189b0ca3cac231cc0a8d | /src/ComplexNumber.java | 9af773d69fcc4d2ba7a056a62d7c7de7230ebb6f | [] | no_license | AmonUCF/Mandelbrot-Visualizer | fb3f73d855945acb769fa6bf06869833bdc402f4 | 64d34c896b700b04e62f87c398d47c252a64f5da | refs/heads/master | 2021-01-13T00:50:36.005675 | 2015-10-21T01:36:26 | 2015-10-21T01:36:26 | 44,644,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java |
public class ComplexNumber {
private double real, imag;
public ComplexNumber(double a, double b){
real=a;
imag=b;
}
public ComplexNumber multiply(ComplexNumber c){
double tempR =this.real*c.real-this.imag*c.imag;
double tempI =this.real*c.imag+this.imag*c.real;
this.real = tempR;
this.imag = tempI;
return this;
}
public ComplexNumber add(ComplexNumber c){
this.real+=c.real;
this.imag+=c.imag;
return this;
}
public double GetReal(){
return real;
}
public double GetImag(){
return imag;
}
public double magnitude() {
double x = this.GetReal(), y = this.GetImag();
return Math.sqrt(x*x+y*y);
}
public void SetReal(double r) {
this.real=r;
}
public void SetImag(double i){
this.imag=i;
}
}
| [
"[email protected]"
] | |
3ea34f9911c99abb4cc269b478d27ac26cb4485e | 202cd298430d3d0db62618ee7b944286d3cde12d | /platform/diff-api/src/com/intellij/diff/vcs/DiffVcsFacade.java | 0da8d7f621c4fe197b6db3f96ca287e09ac71f6f | [
"Apache-2.0"
] | permissive | llzxcv2014/intellij-community | 2e4c9fc7339d92216961262f7272c6b0bc17c4c3 | 7aedec109e6dba1393fe067171633efa30da4fda | refs/heads/master | 2021-08-06T23:08:26.280264 | 2020-09-29T08:01:22 | 2020-09-29T08:01:22 | 222,669,602 | 1 | 0 | Apache-2.0 | 2020-09-29T08:01:31 | 2019-11-19T10:27:26 | null | UTF-8 | Java | false | false | 944 | java | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diff.vcs;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.LocalFilePath;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@ApiStatus.Internal
public class DiffVcsFacade {
@NotNull
public static DiffVcsFacade getInstance() {
return ServiceManager.getService(DiffVcsFacade.class);
}
@NotNull
public FilePath getFilePath(@NotNull @NonNls String path) {
return new LocalFilePath(path, false);
}
@NotNull
public FilePath getFilePath(@NotNull VirtualFile virtualFile) {
return new LocalFilePath(virtualFile.getPath(), virtualFile.isDirectory());
}
}
| [
"[email protected]"
] | |
ebc31d1c4d8c6fb7e1f837a647c50e2d793f400e | 17bc9a9cae1a37296f6e0423c560c2b760569500 | /app/src/main/java/filipe/pires/me/images/main/data/datatransferobject/Datum.java | d20e9d6c49d01ae54c3dd069a263d327b93696c3 | [] | no_license | filipepires/Nasa-Images | 107814376c3bb0406fd59587b8170a254f65226f | 7a71a2bd4bbe2f3b5dba4101e80048be5fdb6783 | refs/heads/master | 2021-04-29T23:33:56.798819 | 2018-09-25T23:38:17 | 2018-09-25T23:38:17 | 121,557,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,824 | java |
package filipe.pires.me.images.main.data.datatransferobject;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class Datum {
@SerializedName("keywords")
@Expose
private List<String> keywords = null;
@SerializedName("media_type")
@Expose
private String mediaType;
@SerializedName("title")
@Expose
private String title;
@SerializedName("center")
@Expose
private String center;
@SerializedName("nasa_id")
@Expose
private String nasaId;
@SerializedName("date_created")
@Expose
private String dateCreated;
@SerializedName("description")
@Expose
private String description;
public List<String> getKeywords() {
return keywords;
}
public void setKeywords(List<String> keywords) {
this.keywords = keywords;
}
public String getMediaType() {
return mediaType;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCenter() {
return center;
}
public void setCenter(String center) {
this.center = center;
}
public String getNasaId() {
return nasaId;
}
public void setNasaId(String nasaId) {
this.nasaId = nasaId;
}
public String getDateCreated() {
return dateCreated;
}
public void setDateCreated(String dateCreated) {
this.dateCreated = dateCreated;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
] | |
26bcf6d348f96223f7cfb05a37a4692f57bfc881 | dd66c4b381f898da8173a07f158f8e3250a396c3 | /src/main/java/com/cheetahlabs/minequest/questcore/PartyTarget.java | d1c6372663e671b7bf67860b0b1f7b1baa07b0c2 | [] | no_license | Mathis-1/Minequest-Reloaded-Core | e55afcc18a89f8d821a6bd2ef98d9df095b84cd9 | ae8b5ecdabe236597039da9f0ee990d70af04d0f | refs/heads/master | 2021-01-18T05:26:12.992294 | 2012-02-28T22:21:37 | 2012-02-28T22:21:37 | 3,577,486 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,169 | java | /*
* MineQuest - Bukkit Plugin for adding RPG characteristics to minecraft
* Copyright (C) 2011 Jason Monk
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package com.cheetahlabs.minequest.questcore;
import java.util.List;
import org.monksanctum.MineQuest.Quester.Quester;
public class PartyTarget extends Target {
private Party party;
public PartyTarget(Party party) {
this.party = party;
}
@Override
public List<Quester> getTargets() {
return party.getQuesters();
}
}
| [
"[email protected]"
] | |
0b37c150d66f93db3be75e0b339baf1d72c31da5 | 54d90fb822da1fbd4f47e5f5e691f763097681da | /rpc-core/src/main/java/com/imnoob/transport/netty/handler/RateCGProxy.java | 94cfe48aabe4a99958537fe3795029d3e0712274 | [] | no_license | chenkang-noob/codenoob-rpc | 36ddaf601c90b0516587c7145c374895660854ac | 9a658a1dbe0a818d3d4e552e0d6df722d07e5182 | refs/heads/master | 2023-06-16T10:32:51.129687 | 2021-07-03T15:16:25 | 2021-07-03T15:16:25 | 370,247,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,507 | java | package com.imnoob.transport.netty.handler;
import com.google.common.util.concurrent.RateLimiter;
import com.imnoob.transport.netty.annotation.RateLimit;
import com.imnoob.transport.netty.cache.RateLimitCache;
import com.imnoob.transport.netty.enums.CustomizeException;
import com.imnoob.transport.netty.exception.CommonException;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;
//cglib 动态代理
public class RateCGProxy implements MethodInterceptor {
private Enhancer enhancer = new Enhancer();
private final RateLimiter rateLimiter;
public RateCGProxy(RateLimiter rateLimiter) {
this.rateLimiter = rateLimiter;
}
public Object getProxy(Class clazz){
//设置需要创建子类的类
enhancer.setSuperclass(clazz);
enhancer.setCallback(this);
//通过字节码技术动态创建子类实例
return enhancer.create();
}
@Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
Object result = null;
try {
if (rateLimiter.tryAcquire()) {
result = methodProxy.invokeSuper(o, objects);
}
} catch (Throwable throwable) {
throwable.printStackTrace();
throw new CommonException(CustomizeException.LIMITE_RATE_ERROR);
}
return result;
}
}
| [
"[email protected]"
] | |
31e6772ffd2eb60bad34bde9749c5671670c600b | 89ae65c5b7f4d72bfd439a20f3be58f90b5bf7a0 | /src/main/java/org/cytoscape/aMatReader/internal/util/MatrixParser.java | 4ecff95a66d368ac3977f6549e6f8b0945e39b36 | [] | no_license | cytoscape/aMatReader | 4ffb6b89c4ccdb63a48b15520e2e8b0d5ef59a4b | 719ebe32a68b408139ad8b4ea4a7c4ec9e08b189 | refs/heads/master | 2023-03-23T21:35:14.150782 | 2022-01-07T02:01:14 | 2022-01-07T02:01:14 | 105,055,800 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,404 | java | package org.cytoscape.aMatReader.internal.util;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
public class MatrixParser {
private Vector<String> rowNames;
private PrefixedVector columnNames;
private final HashMap<Integer, Map<Integer, Double>> edgeMap;
private final MatrixParameters parameters;
public class MatrixParseException extends Exception {
/**
*
*/
private static final long serialVersionUID = 2747259808393035815L;
public MatrixParseException(String message) {
super(message);
}
}
public MatrixParser(MatrixParameters params)
throws IOException, MatrixParseException {
this.parameters = params;
this.rowNames = new Vector<String>();
this.columnNames = new PrefixedVector();
edgeMap = new HashMap<Integer, Map<Integer, Double>>();
}
public int edgeCount() {
int count = 0;
for (int src : edgeMap.keySet()) {
Map<Integer, Double> map = edgeMap.get(src);
count += map.size();
}
return count;
}
public String getRowName(int i) {
if (rowNames.isEmpty())
return "Node " + i;
return rowNames.get(i);
}
public int getRowCount() {
return rowNames.size();
}
public int getColumnCount() {
return columnNames.size();
}
public String getColumnName(int i) {
if (columnNames.isEmpty())
return "Node " + i;
return columnNames.get(i);
}
public Map<Integer, Map<Integer, Double>> getEdges() {
return edgeMap;
}
private void readColumnNames(String[] names) {
for (int start = parameters.hasRowNames ? 1 : 0; start < names.length; start++) {
if (!names[start].isEmpty()) {
String name = names[start];
if (name.startsWith(parameters.columnPrefix)) {
name = name.substring(parameters.columnPrefix.length(), name.length());
}
columnNames.add(name);
}
}
}
private void parseRow(int rowNumber, String[] row, boolean undirected) {
int start = undirected ? rowNumber + 1 : 0;
HashMap<Integer, Double> tgtMap = new HashMap<Integer, Double>();
for (; start < row.length; start++) {
Double value = getValue(row[start]);
if (value != null && !(parameters.ignoreZeros && value == 0)) {
tgtMap.put(start, value);
}
}
edgeMap.put(rowNumber, tgtMap);
}
public boolean buildNetwork(final ResettableBufferedReader reader) throws IOException, MatrixParseException {
String[] row;
int rowNumber = 0;
boolean pastColumnLine = !parameters.hasColumnNames;
while ((row = readRow(reader, parameters.delimiter)) != null) {
// comment line or empty line
if (row.length == 0) {
continue;
}
// column names line
if (!pastColumnLine) {
readColumnNames(row);
if (!parameters.hasRowNames) {
rowNames = columnNames;
}
pastColumnLine = true;
continue;
}
String name = "";
if (parameters.hasRowNames) {
name = row[0];
rowNames.add(name);
row = Arrays.copyOfRange(row, 1, row.length);
if (!parameters.hasColumnNames) {
if (columnNames.isEmpty()) {
for (int i = 1; i <= row.length; i++) {
columnNames.add("Node " + i);
}
}
columnNames.set(rowNumber, name);
}
}
if (name.isEmpty()) {
name = getColumnName(rowNumber);
}
parseRow(rowNumber, row, parameters.undirected);
rowNumber++;
}
return true;
}
private String[] readRow(ResettableBufferedReader input, Delimiter delimiter) throws IOException {
String row = input.readLine();
if (row == null)
return null;
if (row.startsWith("#"))
return new String[0];
String[] columns;
String delim = delimiter.getDelimiter();
columns = row.split(delim, -1);
return columns;
}
private static Double getValue(String value) {
Double v = null;
if (value == null)
return null;
try {
v = new Double(value);
if (v.isNaN()) {
v = null;
}
} catch (NumberFormatException nfe) {
}
return v;
}
public static class MatrixParameters {
public MatrixParameters(Delimiter delimiter, boolean ignoreZeros, boolean hasRowNames, boolean hasColumnNames,
boolean undirected) {
this.delimiter = delimiter;
this.hasRowNames = hasRowNames;
this.hasColumnNames = hasColumnNames;
this.ignoreZeros = ignoreZeros;
this.undirected = undirected;
}
public MatrixParameters() {
};
public Delimiter delimiter = Delimiter.TAB;
public boolean hasRowNames = false, hasColumnNames = false;
public String columnPrefix = "";
public boolean ignoreZeros = true;
public boolean undirected = false;
}
public static MatrixParameters predictParameters(ResettableBufferedReader reader) throws IOException {
MatrixParameters prediction = new MatrixParameters();
try {
String firstLine = "#";
while (firstLine.startsWith("#")) {
reader.peekLine();
firstLine = reader.readLine();
}
String secondLine = "#";
while (secondLine.startsWith("#")) {
reader.peekLine();
secondLine = reader.readLine();
}
int numItems = 0;
for (Delimiter delim : Delimiter.values()) {
String[] secondRow = secondLine.split(delim.delimiter, -1);
if (secondRow.length > numItems) {
numItems = secondRow.length;
prediction.delimiter = delim;
}
}
String[] firstRow = firstLine.split(prediction.delimiter.delimiter, -1);
String[] secondRow = secondLine.split(prediction.delimiter.delimiter, -1);
for (int i = 1; i < firstRow.length; i++) {
String col = firstRow[i];
if (!col.isEmpty() && getValue(col) == null) {
prediction.hasColumnNames = true;
break;
}
}
if (!secondRow[0].isEmpty() && getValue(secondRow[0]) == null)
prediction.hasRowNames = true;
if (prediction.hasRowNames)
firstRow = Arrays.copyOfRange(firstRow, 1, firstRow.length);
PrefixedVector pv = new PrefixedVector(firstRow);
if (pv.hasPrefix())
prediction.columnPrefix = pv.getPrefix();
if (prediction.hasColumnNames && prediction.hasRowNames) {
if (secondRow[0].startsWith(prediction.columnPrefix)) {
prediction.columnPrefix = "";
}
}
} catch (IOException e) {
e.printStackTrace();
}
reader.reset();
return prediction;
}
private Vector<String> getEdgeStrings() {
Vector<String> edges = new Vector<String>();
for (int s : edgeMap.keySet()) {
Map<Integer, Double> tgtMap = edgeMap.get(s);
for (int t : tgtMap.keySet()) {
double value = tgtMap.get(t);
edges.add(getRowName(s) + " - " + getColumnName(t) + " = " + value);
}
}
return edges;
}
public void removeColumnPrefix() {
if (columnNames.hasPrefix()){
parameters.columnPrefix = columnNames.getPrefix();
}
if (parameters.columnPrefix != null && !parameters.columnPrefix.isEmpty())
for (int i = 0; i < columnNames.size(); i++) {
String name = columnNames.get(i);
if (name.startsWith(parameters.columnPrefix)) {
name = name.substring(parameters.columnPrefix.length());
columnNames.set(i, name);
}
}
}
public static void main(String[] args) throws Exception {
String[] files = new String[] {
"/Users/bsettle/git/aMatReader/samples/sample.mat",
"/Users/bsettle/git/aMatReader/samples/sampleNoHeaderRow.mat",
"/Users/bsettle/git/aMatReader/samples/sampleNoHeaderColumn.mat",
"/Users/bsettle/git/aMatReader/samples/crazyTest.csv",
"/Users/bsettle/git/aMatReader/samples/crazyTest2.txt",
"/Users/bsettle/git/aMatReader/samples/crazyTest3.txt"
};
String outputAnswer = null;
for (String f : files) {
System.out.println(f);
FileInputStream in = new FileInputStream(f);
ResettableBufferedReader reader = new ResettableBufferedReader(new BufferedInputStream(in));
MatrixParameters pred = MatrixParser.predictParameters(reader);
pred.ignoreZeros = true;
pred.undirected = false;
MatrixParser p = new MatrixParser(pred);
p.buildNetwork(reader);
reader.close();
Vector<String> strs = p.getEdgeStrings();
String[] strsArr = new String[strs.size()];
strs.toArray(strsArr);
Arrays.sort(strsArr);
String output = String.join("\n", strsArr);
if (outputAnswer == null) {
System.out.println(" = \n" + output);
outputAnswer = output;
} else {
if (!output.equals(outputAnswer)) {
System.out.println(" mismatch = \n" + output);
break;
} else {
System.out.println("match");
}
}
}
}
}
| [
"[email protected]"
] | |
7b839ac20f97af0c51a131946007215cfe218951 | f232c2c7966e5769d1f68af87c83615fe4202870 | /frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/AddStorageDomainRM.java | 074cba38844b191004f3464e864f1ba3aa1d5a1f | [] | no_license | BillTheBest/ovirt-engine | 54d0d3cf5b103c561c4e72e65856948f252b41a1 | 7d5d711b707e080a69920eb042f6f547dfa9443f | refs/heads/master | 2016-08-05T16:52:16.557733 | 2011-11-07T02:49:42 | 2011-11-07T02:49:42 | 2,938,776 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,215 | java | package org.ovirt.engine.ui.uicommonweb.models.hosts;
import java.util.Collections;
import org.ovirt.engine.core.compat.*;
import org.ovirt.engine.ui.uicompat.*;
import org.ovirt.engine.core.common.businessentities.*;
import org.ovirt.engine.core.common.vdscommands.*;
import org.ovirt.engine.core.common.queries.*;
import org.ovirt.engine.core.common.action.*;
import org.ovirt.engine.ui.frontend.*;
import org.ovirt.engine.ui.uicommonweb.*;
import org.ovirt.engine.ui.uicommonweb.models.*;
import org.ovirt.engine.core.common.*;
import org.ovirt.engine.ui.uicommonweb.models.clusters.*;
import org.ovirt.engine.ui.uicommonweb.models.common.*;
import org.ovirt.engine.ui.uicommonweb.models.configure.*;
import org.ovirt.engine.ui.uicommonweb.models.datacenters.*;
import org.ovirt.engine.ui.uicommonweb.models.tags.*;
import org.ovirt.engine.ui.uicompat.*;
import org.ovirt.engine.core.common.interfaces.*;
import org.ovirt.engine.core.common.businessentities.*;
import org.ovirt.engine.core.common.queries.*;
import org.ovirt.engine.core.common.*;
import org.ovirt.engine.ui.uicommonweb.dataprovider.*;
import org.ovirt.engine.ui.uicommonweb.*;
import org.ovirt.engine.ui.uicommonweb.models.*;
@SuppressWarnings("unused")
public class AddStorageDomainRM extends BaseRM
{
private static final int WaitInterval = 5000;
private static final int WaitTries = 6;
public AddStorageDomainRM(HostListModel model, DataBag data)
{
super(model, data);
Transaction.Current.EnlistVolatile(this, EnlistmentOptions.None);
}
@Override
public void Prepare(PreparingEnlistment preparingEnlistment) throws TransactionAbortedException
{
VDS host = (VDS)getModel().getSelectedItem();
ConfigureLocalStorageModel model = (ConfigureLocalStorageModel)getModel().getWindow();
//Activate host.
VdcReturnValueBase returnValue = Frontend.RunAction(VdcActionType.ActivateVds, new VdsActionParameters(host.getvds_id()));
if (returnValue == null || !returnValue.getSucceeded())
{
preparingEnlistment.ForceRollback();
return;
}
//Wait for a host to be Up.
for (int i = 0; i <= WaitTries; i++)
{
if (i == WaitTries)
{
preparingEnlistment.ForceRollback();
return;
}
VDS tmpHost = DataProvider.GetHostById(host.getvds_id());
if (tmpHost.getstatus() != VDSStatus.Up)
{
//Wrap Thread.Sleep with try/catch to pass conversion to Java.
try
{
Thread.sleep(WaitInterval);
}
catch (InterruptedException e)
{
}
}
else
{
break;
}
}
//Add storage domain.
storage_server_connections tempVar = new storage_server_connections();
tempVar.setconnection((String)model.getStorage().getPath().getEntity());
tempVar.setstorage_type(StorageType.LOCALFS);
storage_server_connections connection = tempVar;
storage_domain_static storageDomain = new storage_domain_static();
storageDomain.setstorage_type(StorageType.LOCALFS);
storageDomain.setstorage_domain_type(StorageDomainType.Data);
storageDomain.setstorage_name((String)model.getFormattedStorageName().getEntity());
returnValue = Frontend.RunAction(VdcActionType.AddStorageServerConnection, new StorageServerConnectionParametersBase(connection, host.getvds_id()));
if (returnValue == null || !returnValue.getSucceeded())
{
//Don't rollback, just throw exception to indicate failure at this step.
throw new TransactionAbortedException();
}
storageDomain.setstorage((String)returnValue.getActionReturnValue());
StorageDomainManagementParameter tempVar2 = new StorageDomainManagementParameter(storageDomain);
tempVar2.setVdsId(host.getvds_id());
returnValue = Frontend.RunAction(VdcActionType.AddLocalStorageDomain, tempVar2);
//Clean up connection.
if (returnValue == null || !returnValue.getSucceeded())
{
Frontend.RunAction(VdcActionType.RemoveStorageServerConnection, new StorageServerConnectionParametersBase(connection, host.getvds_id()));
throw new TransactionAbortedException();
}
preparingEnlistment.Prepared();
}
@Override
public void Commit(Enlistment enlistment)
{
enlistment.Done();
}
@Override
public void Rollback(Enlistment enlistment)
{
}
@Override
public void InDoubt(Enlistment enlistment)
{
}
} | [
"[email protected]"
] | |
b5074f86f144f40ffd2115d1c076a33e800c6e33 | ab5974b50aad656bcd5ed974eadb7fbe4d8e8939 | /Lab1/Enhance.java | 6f121ac8415a4a66b9b03507887f3d1b787bea6b | [] | no_license | yoga1308/capgJava | 2cac2a6cdc1030d7d7b555e2e306258d883e3be6 | 934ece9aab1a787d6d2c9b3251287dfb19ecb023 | refs/heads/master | 2020-04-29T06:44:54.739733 | 2019-03-26T05:30:06 | 2019-03-26T05:30:06 | 175,927,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package com.capg.models;
public class Enhance
{
public int add(int a,int b)
{
return a+b;
}
public int sub(int a,int b)
{
return a-b;
}
public static void main(String []args)
{
Enhance en =new Enhance();
System.out.println(en.add(10,23));
}
} | [
"[email protected]"
] | |
1960396acdd6fa7d738eb0aa3c72e9ca74df3be9 | b39020356707efb501c35be2a91fa52ac757e94c | /src/main/java/com/ssau/demo/Repository/CarshopRepository.java | ffa026c5a9667c7039d96efa48c4f5cf4d032bea | [] | no_license | megachelovek/SoftwareDevelopment | 561fa2f358038e82e7d0d4fa09df4d0928c1414d | 56c97a8269d1861c5a420f81f12afcbe91da7521 | refs/heads/master | 2023-05-15T02:33:39.438399 | 2020-11-17T20:49:40 | 2020-11-17T20:49:40 | 216,029,441 | 0 | 0 | null | 2023-05-07T01:34:12 | 2019-10-18T13:24:04 | Java | UTF-8 | Java | false | false | 320 | java | package com.ssau.demo.Repository;
import com.ssau.demo.Entity.CarshopEntity;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CarshopRepository extends CrudRepository<CarshopEntity, Long> {
CarshopEntity findById(Integer id);
} | [
"[email protected]"
] | |
20151ee884ae7f763668229ba36361ba63839c34 | 5ab5fa0e498626cea51b3b351dfb3c8e65f840a9 | /src/main/java/io/pivotal/pal/tracker/TimeEntryController.java | a5c2107a2804f8c7a3b62b01ac85ac46fe040f3a | [] | no_license | leonardopordeus/pal-tracker | a77d24387805e4449617ddc187f714413640eba6 | 4b23aa0b3ddbe99f8b991f28b3aa6ed5df954e0a | refs/heads/master | 2020-06-02T15:03:18.183675 | 2019-06-12T21:40:52 | 2019-06-12T21:40:52 | 191,199,832 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,613 | java | package io.pivotal.pal.tracker;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.DistributionSummary;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/time-entries")
public class TimeEntryController {
//@Autowired
TimeEntryRepository timeEntryRepository;
private final DistributionSummary timeEntrySummary;
private final Counter actionCounter;
public TimeEntryController(
TimeEntryRepository timeEntryRepository,
MeterRegistry meterRegistry
) {
this.timeEntryRepository = timeEntryRepository;
timeEntrySummary = meterRegistry.summary("timeEntry.summary");
actionCounter = meterRegistry.counter("timeEntry.actionCounter");
}
@PostMapping
public ResponseEntity<TimeEntry> create(@RequestBody TimeEntry timeEntry) {
TimeEntry createdTimeEntry = timeEntryRepository.create(timeEntry);
actionCounter.increment();
timeEntrySummary.record(timeEntryRepository.list().size());
return new ResponseEntity<>(createdTimeEntry, HttpStatus.CREATED);
}
@GetMapping("/{timeEntryId}")
public ResponseEntity<TimeEntry> read(@PathVariable("timeEntryId") Long timeEntryId) {
TimeEntry result = timeEntryRepository.find(timeEntryId);
if(result != null)
{
actionCounter.increment();
return ResponseEntity.ok(result);
}
return ResponseEntity.notFound().build();
}
@GetMapping
public ResponseEntity<List<TimeEntry>> list() {
actionCounter.increment();
return ResponseEntity.ok(timeEntryRepository.list());
}
@PutMapping("/{timeEntryId}")
public ResponseEntity<TimeEntry> update(@PathVariable("timeEntryId") Long timeEntryId, @RequestBody TimeEntry timeEntry) {
TimeEntry result = timeEntryRepository.update(timeEntryId,timeEntry);
if(result != null)
{
actionCounter.increment();
return ResponseEntity.ok(result);
}
return ResponseEntity.notFound().build();
}
@DeleteMapping("/{timeEntryId}")
public ResponseEntity delete(@PathVariable("timeEntryId") Long timeEntryId) {
timeEntryRepository.delete(timeEntryId);
actionCounter.increment();
timeEntrySummary.record(timeEntryRepository.list().size());
return ResponseEntity.noContent().build();
}
}
| [
"[email protected]"
] | |
f39e632b91da750f058c92d5d1e4b9faaba1ef2c | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /fg/fc/src/main/java/org.wp.fc/models/ReaderRecommendBlogList.java | 1992945a8fd4545e607feebb5600ad837de73c40 | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 1,363 | java | package org.wp.fc.models;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.ArrayList;
public class ReaderRecommendBlogList extends ArrayList<ReaderRecommendedBlog> {
@Override
public Object clone() {
return super.clone();
}
public static ReaderRecommendBlogList fromJson(JSONObject json) {
ReaderRecommendBlogList blogs = new ReaderRecommendBlogList();
if (json == null) {
return blogs;
}
JSONArray jsonBlogs = json.optJSONArray("blogs");
if (jsonBlogs != null) {
for (int i = 0; i < jsonBlogs.length(); i++)
blogs.add(ReaderRecommendedBlog.fromJson(jsonBlogs.optJSONObject(i)));
}
return blogs;
}
private int indexOfBlogId(long blogId) {
for (int i = 0; i < size(); i++) {
if (this.get(i).blogId == blogId)
return i;
}
return -1;
}
public boolean isSameList(ReaderRecommendBlogList blogs) {
if (blogs == null || blogs.size() != this.size()) {
return false;
}
for (ReaderRecommendedBlog blog: blogs) {
int index = indexOfBlogId(blog.blogId);
if (index == -1 || !this.get(index).isSameAs(blog)) {
return false;
}
}
return true;
}
}
| [
"[email protected]"
] | |
8eb4c43a3d5c91812012f15ebfc422e2848462c8 | f77f4f49b8ff369ceac96972717dd3be8ec0580a | /spring-cloud/spring-cloud-dome/user-server/src/main/java/com/yqh/controller/UserController.java | 05b2154bd971affbebe52ce23253f4b584fac2ee | [
"Apache-2.0"
] | permissive | yanghui0212/java-dome | 48987475f5f81aac2d4127428f312331789c3a4c | 6993897a6b34357f6b93e2a62295fc548fc44ba9 | refs/heads/master | 2021-06-26T16:53:45.518442 | 2020-07-08T08:11:40 | 2020-07-08T08:11:40 | 206,244,943 | 0 | 1 | Apache-2.0 | 2021-04-26T19:29:46 | 2019-09-04T06:12:29 | Java | UTF-8 | Java | false | false | 1,183 | java | package com.yqh.controller;
import com.yqh.dto.UserDto;
import com.yqh.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
/**
* @author yangq
* Create time in 2019-09-20 16:08
*/
@RestController
public class UserController {
@Autowired
private HttpServletRequest request;
@Autowired
private UserService userService;
@PostMapping("/register")
public UserDto register(@RequestBody @Valid UserDto userDto) {
return userService.register(userDto);
}
@PostMapping("/login")
public String login(@RequestBody @Valid UserDto userDto, HttpServletResponse response) {
return userService.login(userDto, request, response);
}
@PostMapping("/logout")
public void logout(UserDto userDto, HttpServletResponse response) {
userService.logout(userDto, request, response);
}
}
| [
"[email protected]"
] | |
2197fb088f5dec58019553874653d1d03e57720d | 36627641c1d06637a2867a5c0b1fe989d01e39d6 | /filter/SessionCheckFilter.java | 71e7ba23a62d9f19337f83dfba8ba4b7c993b646 | [] | no_license | Neeraj121296/ServletDemoApp | 2010c9e4219dd3d12cbc770231d6566b94fa2d8d | 58577d1bbfd49b92edbc43a64c87821e4f58120b | refs/heads/master | 2021-08-23T16:30:32.206134 | 2017-12-05T17:42:26 | 2017-12-05T17:42:26 | 113,213,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,568 | java | package com.srivastava.onlineapp.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet Filter implementation class SessionCheckFilter
*/
@WebFilter("*.online")
public class SessionCheckFilter implements Filter {
/**
* Default constructor.
*/
public SessionCheckFilter() {
// TODO Auto-generated constructor stub
}
/**
* @see Filter#destroy()
*/
public void destroy() {
// TODO Auto-generated method stub
}
/**
* @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
// place your code here
HttpSession session=((HttpServletRequest)request).getSession(false);
if(session==null){
((HttpServletResponse)response).sendRedirect("Home");
}
else{
// pass the request along the filter chain
chain.doFilter(request, response);
}}
/**
* @see Filter#init(FilterConfig)
*/
public void init(FilterConfig fConfig) throws ServletException {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
00a46b6e62f0e7dfb06f50478c4292c69e8ce330 | 685dc4b885992632ad108ff1c0209fcf061926ee | /TestItea/src/test/java/page/objects/MainPage.java | 3aa6e232bc402097939fdf82109c41718f53fbd4 | [] | no_license | serhiynikolskiy/selenium-tests | ddac73df7b620b16ede69730ec4f6dcc9a4a60f4 | 24844bc527758a6c0eb8be5d0ca9cefb23bfd8ad | refs/heads/master | 2021-01-13T01:41:41.433592 | 2015-08-09T10:38:13 | 2015-08-09T10:38:13 | 40,430,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,543 | java | package page.objects;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/**
* Created by NikolS on 8/8/2015.
*/
public class MainPage {
private WebDriver driver;
@FindBy(linkText = "Расписание")
WebElement linkNews;
@FindBy(linkText = "Контакты")
WebElement linkContacts;
@FindBy(linkText = "Услуги")
WebElement linkTeachers;
@FindBy(linkText = "Получить бесплатную консультацию")
WebElement linkSend;
@FindBy(name = "userName")
WebElement fieldName;
@FindBy(id = "phone")
WebElement fieldPhone;
@FindBy(name = "userEmail")
WebElement fieldEmail;
@FindBy(xpath = ".//*[@name='course']")
Select course;
@FindBy(xpath = ".//*[@id='main-form']/form/select/option[5]")
WebElement courseCase4;
@FindBy(xpath = ".//*[@id='main-form']/form/input[4]")
WebElement submit;
public void login(){
linkNews.click();
linkContacts.click();
linkTeachers.click();
}
public void send(String userName, String userPhone, String userEmail) {
linkSend.click();
fieldName.sendKeys(userName);
fieldPhone.clear();
fieldPhone.sendKeys(userPhone);
fieldEmail.sendKeys(userEmail);
//new Select(driver.findElement(By.name("course"))).selectByVisibleText("Backend");
submit.click();
}
}
| [
"[email protected]"
] | |
309e6daf7ed86d506456a43257cddc8441311af3 | 1c8afb5e81294eb893e77d085533a92baf4a6eba | /src/com/luv2code/springdemo/MyApp.java | 1407df518547cbca2da7d3b7ee48fc41b801c44d | [] | no_license | IngridCBarbosa/spring-demo-onde | 7cbe9c5930456cc3adf52c715949415160df4f6f | b332f608453b458e793bfda89b7d5fbd19b69e4b | refs/heads/master | 2020-12-15T15:52:01.261205 | 2020-01-20T18:13:30 | 2020-01-20T18:13:30 | 235,164,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.luv2code.springdemo;
public class MyApp {
public static void main(String[] args) {
// create the Object
Coach theCoach = new BaseballCoach();
// Use the Object
System.out.println(theCoach.getDailyWorkout());
}
}
| [
"[email protected]"
] | |
06b002f504055395bddb22edc2b7e9e151fd9dc7 | 9a49cb59779cffd1c02d3a3ece2a1d3fcc5e2cdc | /PROXY/Gumball/src/ge/gov/smartlogic/proxy/gumball/GumballMonitor.java | 584fef36e3e1eeb9f31e53c975a2eba70a2aa1b6 | [] | no_license | lukaogadze/HeadFirstDesignPatterns | 71168fbacd2ec1eeccd8f68fe46ee03aa7f8f77e | 2c3859357ba8bdf3f1c61d030463042108082b75 | refs/heads/master | 2020-04-12T20:10:06.963081 | 2018-12-21T15:11:49 | 2018-12-21T15:11:49 | 162,728,129 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package ge.gov.smartlogic.proxy.gumball;
import java.rmi.*;
public class GumballMonitor {
GumballMachineRemote machine;
public GumballMonitor(GumballMachineRemote machine) {
this.machine = machine;
}
public void report() {
try {
System.out.println("Gumball Machine: " + machine.getLocation());
System.out.println("Current inventory: " + machine.getCount() + " gumballs");
System.out.println("Current state: " + machine.getState());
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
683be7164ec0db7de705f2160d68a3a8714be04c | 861c1c6947ccc2b336ac1f3f74ddc9f43e222857 | /app/src/main/java/com/wq/andoidlearning/pattern/adapter/demo3/IDst.java | 3da3eee751a6a0d435c6ff4d3fe4bfc46cb669da | [] | no_license | vivianwq/AndroidLearn | b2a3595c24260b7227631f112fe4559731efe941 | 246c4bc575960677d60c2fffb3b4f1d8164014b7 | refs/heads/master | 2022-09-22T03:27:27.524477 | 2020-06-07T02:01:04 | 2020-06-07T02:01:04 | 255,264,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package com.wq.andoidlearning.pattern.adapter.demo3;
public interface IDst {
void dstMethod1();
void dstMethod2();
void dstMethod3();
}
| [
"[email protected]"
] | |
078587c49422b17129d61707dce02d881a87e8e4 | 70bb32291861636f6b5f34745122c3f129067039 | /ConcertVenueManagement_Backend/src/Event.java | 1652b7df2e88d183a22ef47538d39ef216f94d3e | [] | no_license | JamesAllahMensah/CPSC440_ConcertVenueManagement | d73fc4d28b8fc91625fde0b97d56c3514bd4e439 | 888df49566387af0c0ee762c22c9d7af602e5d22 | refs/heads/main | 2023-01-24T20:27:07.189553 | 2020-12-01T08:57:45 | 2020-12-01T08:57:45 | 317,472,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,242 | java |
public class Event {
private String ID;
private String startTime;
private String endTime;
private String numTicketsAvailable;
private String genre;
private String venue;
private String name;
private String date;
public Event(String ID, String startTime, String endTime, String numTicketsAvailable,
String genre, String venue, String name, String date) {
this.ID = ID;
this.startTime = startTime;
this.endTime = endTime;
this.numTicketsAvailable = numTicketsAvailable;
this.genre = genre;
this.venue = venue;
this.name = name;
this.date = date;
}
public String getVenueID() {
return venue;
}
public String getName() {
return name;
}
public String getVenue() {
return venue;
}
public void setVenue(String venue) {
this.venue = venue;
}
public void decrementTicket(String newTicketCount) {
int newTicketCnt = Integer.parseInt(newTicketCount);
newTicketCnt--;
String strNewTicketCnt = String.valueOf(newTicketCnt);
this.numTicketsAvailable = strNewTicketCnt;
}
public String toString() {
return this.ID + ";" + this.startTime + ";" + this.endTime + ";" + this.numTicketsAvailable + ";" +
this.genre + ";" + this.venue + ";" + this.name + ";" + this.date;
}
}
| [
"[email protected]"
] | |
26ff425641d7689907d46ba92db4c9426cc4bac8 | 5912bad6eaa5b89f3c046b401effa3f5ff5c9d17 | /src/main/java/com/adongs/windows/components/ColourLabel.java | 9937d3e40af3e611e0563c5343d9e62c379f5be7 | [] | no_license | adongs/jenkins-puls | e3f77f2cca037d4e6dcea012e4d1ff4c3aae183c | 57abe7052622f698650cd6e282c5b76620a7d902 | refs/heads/main | 2023-01-05T11:48:53.487534 | 2020-11-09T07:22:16 | 2020-11-09T07:22:16 | 303,673,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,662 | java | package com.adongs.windows.components;
import org.apache.commons.lang3.StringUtils;
import javax.swing.JPanel;
import java.awt.*;
/**
* @author yudong
* @version 1.0
* @date 2020/11/6 11:35 上午
* @modified By
*/
public class ColourLabel extends JPanel {
private String content;
private Color backgroundColor;
public ColourLabel(String content, Color backgroundColor) {
this.content = content;
this.backgroundColor = backgroundColor;
}
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D graphics2d = (Graphics2D) g;
graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
int x=0,y=0,width=0,height=0,fontSize=0,arcWidth=0,arcHeight=0;
final Dimension size = getSize();
width = size.width;
height = size.height;
if (size.width>size.height){
fontSize = size.height/2;
arcWidth = size.height;
arcHeight = size.height;
}else{
fontSize = size.width/2;
arcWidth = size.width;
arcHeight = size.width;
}
graphics2d.setColor(backgroundColor);
graphics2d.fillRoundRect(x,y,width,height,arcWidth, arcHeight);
graphics2d.setFont(new Font("黑体", Font.BOLD,fontSize));
FontMetrics fontMetrics = graphics2d.getFontMetrics();
int digitalWidth=fontMetrics.stringWidth(content),digitalAscent = fontMetrics.getAscent();
graphics2d.setColor(Color.black);
graphics2d.drawString(content,getWidth()/2-digitalWidth/2,getHeight()/2+digitalAscent/2);
}
}
| [
"[email protected]"
] | |
f7b29b658e8f4cde544345cc2a0703acfd8d28e2 | 3a62d196e2ec4f95d1bc8802fa77a90b1e0cf2b0 | /SQLite : Content Providers/app/src/main/java/wburles/uk/sqlite/BirdDAO.java | 52623395cc07d82b3daadeddfe3dc75ba4a62e37 | [] | no_license | billwurles/apps-in-general | a9a4bdf90494b44440fdb103badc91141e07b2f8 | 402e6d5d9c5d78dbd3e2968aa71c4aede9d6820e | refs/heads/master | 2021-06-27T16:19:02.452284 | 2017-09-12T17:40:10 | 2017-09-12T17:40:10 | 103,301,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,853 | java | package wburles.uk.sqlite;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Will on 07/03/2016.
*/
public class BirdDAO {
private BirdDBHelper dbHelper;
private SQLiteDatabase db;
public BirdDAO(Context context){
dbHelper = new BirdDBHelper(context);
}
public void open(){
db = dbHelper.getWritableDatabase();
}
public void addBird(String binomialName, String commonName){
Log.d("BIRDS","add bird called");
ContentValues values = new ContentValues();
values.put(BirdContract.COLUMN_NAME_BONOMIAL_NAME, binomialName);
values.put(BirdContract.COLUMN_NAME_COMMON_NAME, commonName);
long newRowID = db.insert(BirdContract.TABLE_NAME_BIRD,null,values);
}
public ArrayList<Bird> getBirds(ArrayList<Bird> birds){
Cursor cursor = db.query(
BirdContract.TABLE_NAME_BIRD,
null,null,null,null,null,null);
String col1 = cursor.getColumnName(0);
String col2 = cursor.getColumnName(1);
Log.d("BIRDS","Columns: "+col1 + " "+col2);
cursor.moveToFirst();
while(!cursor.isAfterLast()){
String binomialName = cursor.getString(
BirdContract.COLUMN_INDEX_BINOMIAL_NAME);
String commonName = cursor.getString(
BirdContract.COLUMN_INDEX_COMMON_NAME);
birds.add(new Bird(binomialName, commonName));
cursor.moveToNext();
}
return birds;
}
}
| [
"[email protected]"
] | |
17bdbd50163c690ec32197a981a713c0d43c6e9a | 3370a0d2a9e3c73340b895de3566f6e32aa3ca4a | /alwin-middleware-grapescode/alwin-core-api/src/main/java/com/codersteam/alwin/core/api/model/tag/TagInputDto.java | db421d299808b6c26e3ee65a61f2e69eced52c90 | [] | no_license | Wilczek01/alwin-projects | 8af8e14601bd826b2ec7b3a4ce31a7d0f522b803 | 17cebb64f445206320fed40c3281c99949c47ca3 | refs/heads/master | 2023-01-11T16:37:59.535951 | 2020-03-24T09:01:01 | 2020-03-24T09:01:01 | 249,659,398 | 0 | 0 | null | 2023-01-07T16:18:14 | 2020-03-24T09:02:28 | Java | UTF-8 | Java | false | false | 2,885 | java | package com.codersteam.alwin.core.api.model.tag;
import com.codersteam.alwin.core.api.model.customer.TagTypeDto;
/**
* Etykieta dla zlecenia bez identyfikatora
*
* @author Michal Horowic
*/
public class TagInputDto {
private String name;
private String color;
private boolean predefined;
private TagTypeDto type;
private String description;
private TagIconDto tagIcon;
public boolean isPredefined() {
return predefined;
}
public void setPredefined(final boolean predefined) {
this.predefined = predefined;
}
public TagTypeDto getType() {
return type;
}
public void setType(final TagTypeDto type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getColor() {
return color;
}
public void setColor(final String color) {
this.color = color;
}
public String getDescription() {
return description;
}
public void setDescription(final String description) {
this.description = description;
}
public TagIconDto getTagIcon() {
return tagIcon;
}
public void setTagIcon(final TagIconDto tagIcon) {
this.tagIcon = tagIcon;
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final TagInputDto that = (TagInputDto) o;
if (predefined != that.predefined) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (color != null ? !color.equals(that.color) : that.color != null) return false;
if (type != that.type) return false;
if (description != null ? !description.equals(that.description) : that.description != null) return false;
return tagIcon != null ? tagIcon.equals(that.tagIcon) : that.tagIcon == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (color != null ? color.hashCode() : 0);
result = 31 * result + (predefined ? 1 : 0);
result = 31 * result + (type != null ? type.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (tagIcon != null ? tagIcon.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "TagInputDto{" +
"name='" + name + '\'' +
", color='" + color + '\'' +
", predefined=" + predefined +
", type=" + type +
", description='" + description + '\'' +
", tagIcon=" + tagIcon +
'}';
}
}
| [
"[email protected]"
] | |
5251fa8f6c48448f360f13b45002d740ef480418 | f8a6481acd17129f9e6d1fdc088c58147fea1d0a | /src/main/java/com/ms/printing/bookprint/enums/PaymentMethod.java | 82aea32cfe77cb6cbf81996b3ec5f1435fcd7044 | [] | no_license | manojsharma27/book-print | f876d4a4031cb78d9cbf69c37d4df185c2327272 | 1602491338cf44bae041268b78aa9b64169ae3d8 | refs/heads/master | 2023-08-29T00:55:59.507084 | 2021-10-10T11:52:04 | 2021-10-10T11:52:04 | 412,871,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package com.ms.printing.bookprint.enums;
public enum PaymentMethod {
CARD("Card");
private final String value;
PaymentMethod(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
| [
"[email protected]"
] | |
14a938db79deca191f96e4768fc971e12e72951a | 88a2924b33df50ca37b0a73cb76624c4f23dc7e8 | /src/main/java/com/batteryshop/repository/PaymentDetailsRepository.java | 45e53439e0ee4d5f1996f727f469080db28031dc | [] | no_license | JRiyaz/Battery-Shop | c68994497763ce4f7d99297c39634b282852951b | ceec017f3ed1960a12a94c55a8e174c82a12b4ab | refs/heads/master | 2023-01-14T00:53:07.516907 | 2020-11-14T15:02:38 | 2020-11-14T15:02:38 | 312,841,310 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.batteryshop.repository;
import com.batteryshop.entity.PaymentDetailsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PaymentDetailsRepository extends JpaRepository<PaymentDetailsEntity, Integer> {
}
| [
"[email protected]"
] | |
939bb20f0af7d8628896dc185e8780957078b537 | 6eac15a4f10be8bdd254478004aba0e6e9c12195 | /android-news-application/app/src/main/java/com/dnkilic/newsreader/RssFeedParser.java | dbe3affafdb7eafd787ad1b722fb0ad9c570be52 | [] | no_license | MuratU/ismek-android-samples | f7e51272b5106f9fc7e755e3083941375fb71ff2 | df9b0747adb54f2158466f7842369c899d73a19d | refs/heads/master | 2021-01-23T22:06:14.942539 | 2017-02-20T13:39:56 | 2017-02-20T13:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,499 | java | package com.dnkilic.newsreader;
import org.w3c.dom.CharacterData;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.net.URL;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
public class RssFeedParser {
private ArrayList<NewsEntry> mFeeds;
public final static int ERROR = 0;
public final static int SUCCESS = 1;
public final static int CHECK_RSS_SOURCE = 2;
public RssFeedParser() {
}
public Integer parseCurrencyXml() {
mFeeds = new ArrayList<>();
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
URL rssUrl = new URL("http://www.ntv.com.tr/gundem.rss");
Document doc = builder.parse(rssUrl.openStream());
NodeList nodesEntry = doc.getElementsByTagName("entry");
for (int i = 0; i < nodesEntry.getLength(); i++) {
NodeList nodesElement = nodesEntry.item(i).getChildNodes();
for (int j = 0; j < nodesElement.getLength(); j++) {
Element element = (Element) nodesEntry.item(j);
NewsEntry newsEntry = new NewsEntry();
newsEntry.setId(getElementValue(element,"id"));
newsEntry.setLink(getElementValue(element, "link"));
newsEntry.setPublishDate(getElementValue(element, "published"));
newsEntry.setSummary(getElementValue(element, "summary"));
newsEntry.setUpdateDate(getElementValue(element, "updated"));
newsEntry.setTitle(getElementValue(element,"title"));
mFeeds.add(newsEntry);
}
}
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
if(mFeeds == null || mFeeds.isEmpty())
{
return CHECK_RSS_SOURCE;
}
return SUCCESS;
}
private String getCharacterDataFromElement(Element element) {
try {
Node child = element.getFirstChild();
if (child instanceof CharacterData) {
CharacterData data = (CharacterData) child;
return data.getData();
}
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
protected String getElementValue(Element parent, String label) {
return getCharacterDataFromElement((Element) parent
.getElementsByTagName(label).item(0));
}
public ArrayList<NewsEntry> getNews() {
return mFeeds;
}
}
| [
"[email protected]"
] | |
d0cc41f858b55dd99cfa4f6f3eabbebcb65b6cf5 | 4571af49d62a54b4bbd2249cc28692532c3bd091 | /app/src/main/java/com/krunal/camgal_library/CameraActivity.java | 0f8506c0e7c85f660f9d957f39629073d4ad7af8 | [] | no_license | KruBakhal/CamGal_Library | 3658508aefb9afabca6dd62195a3129636019086 | c158c14dd9541c45942e060c7f1c1978e2fc5aba | refs/heads/master | 2023-09-02T17:19:39.214079 | 2021-09-29T08:57:24 | 2021-09-29T08:57:24 | 411,599,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,540 | java | package com.krunal.camgal_library;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.google.gson.Gson;
import com.krunal.camgal_library.Adapter.SelectedImageAdapter_Native;
import com.krunal.camgal_library.Intermediate.SelectedAdapterListener;
import com.krunal.camgal_library.Model.ImageModel;
import com.krunal.camgal_library.Utils.BookStore;
import com.krunal.camgal_library.Utils.Constant;
import com.krunal.camgal_library.Utils.FileUtils;
import com.krunal.camgal_library.Utils.HelperResizer;
import com.krunal.camgal_library.databinding.ActivityCameraBinding;
import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraLogger;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.controls.Facing;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import static com.krunal.camgal_library.Utils.Utility.ARG_PARAM1;
import static com.krunal.camgal_library.Utils.Utility.checkCameraFront;
import static com.krunal.camgal_library.Utils.Utility.checkCameraRear;
import static com.krunal.camgal_library.Utils.Utility.displayToast;
import static com.krunal.camgal_library.Utils.Utility.getPicNameByPosition;
import static com.krunal.camgal_library.Utils.Utility.onClickEvent;
public class CameraActivity extends AppCompatActivity implements SelectedAdapterListener {
public int selectedPosition = 0;
private ActivityCameraBinding viewBinding;
private SelectedImageAdapter_Native imageSelectedAdapter;
private ArrayList<ImageModel> list_new_pic_selected;
private FileUtils utilsStorage;
private BookStore bookStore;
private int ImgCount = 5;
private int Facing_MODE = 0;
Context context;
private boolean compressStatus;
private int compressionSize;
private String compression_Type;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_camera);
viewBinding = ActivityCameraBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
context = this;
new FileUtils().cacheFolder(context);
setupCamera();
initData();
}
private void initData() {
utilsStorage = new FileUtils();
utilsStorage.cacheFolder(context);
bookStore = new BookStore(context);
ImgCount = getIntent().getIntExtra(Constant.IMAGE_Selection_COUNT, bookStore.get_Image_Selection_Count());
Facing_MODE = getIntent().getIntExtra(Constant.FACING_MODE, bookStore.get_FACING_MODE());
compressStatus = getIntent().getBooleanExtra(Constant.COMPRESS_STATUS, bookStore.get_COMPRESS_STATUS());
compressionSize = getIntent().getIntExtra(Constant.COMPRESSION_SIZE, bookStore.get_COMPRESSION_SIZE());
String c_type = getIntent().getStringExtra(Constant.COMPRESSION_SIZE_Type);
if (!TextUtils.isEmpty(c_type)) {
if (c_type.equals("MB")) {
compression_Type = "MB";
} else if (c_type.equals("KB")) {
compression_Type = "KB";
}
}
if (TextUtils.isEmpty(compression_Type)) {
compression_Type = bookStore.get_COMPRESSION_Type();
}
switch (Facing_MODE) {
case 0:
viewBinding.switchCamera.setVisibility(View.VISIBLE);
break;
case 1:
viewBinding.switchCamera.setVisibility(View.GONE);
viewBinding.camera.setFacing(Facing.BACK);
if (checkCameraFront(context)) {
viewBinding.camera.setFacing(Facing.BACK);
} else if (checkCameraRear()) {
viewBinding.camera.setFacing(Facing.FRONT);
}
break;
case 2:
viewBinding.switchCamera.setVisibility(View.GONE);
viewBinding.camera.setFacing(Facing.FRONT);
if (checkCameraRear()) {
viewBinding.camera.setFacing(Facing.FRONT);
} else if (checkCameraFront(context)) {
viewBinding.camera.setFacing(Facing.BACK);
}
break;
}
/*if (!checkCameraFront(context) || !checkCameraRear()) {
viewBinding.switchCamera.setVisibility(View.GONE);
if (!checkCameraFront(context)) {
viewBinding.camera.setFacing(Facing.BACK);
} else if (!checkCameraRear()) {
viewBinding.camera.setFacing(Facing.FRONT);
}
}*/
setSelectedImageList();
resize();
click();
}
private void click() {
viewBinding.layBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setResult(RESULT_CANCELED);
finish();
onClickEvent(v);
}
});
viewBinding.switchCamera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (Facing_MODE == 0)
if (viewBinding.camera.getFacing() == Facing.BACK) {
viewBinding.camera.setFacing(Facing.FRONT);
} else
viewBinding.camera.setFacing(Facing.BACK);
onClickEvent(v);
}
});
viewBinding.capturePictureSnapshot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (checkSlot_AreFull()) {
displayToast(context, getResources().getString(R.string.all_image_selected));
return;
} else if (!TextUtils.isEmpty(list_new_pic_selected.get(selectedPosition).getfPath())) {
displayToast(context, getResources().getString(R.string.str_all_selected_images));
return;
}
viewBinding.camera.takePictureSnapshot();
onClickEvent(v);
}
});
viewBinding.layDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (list_new_pic_selected != null && list_new_pic_selected.size() != 0) {
ArrayList<ImageModel> picList1 = new ArrayList<>();
for (int i = 0; i < list_new_pic_selected.size(); i++) {
if (!TextUtils.isEmpty(list_new_pic_selected.get(i).getfPath())) {
picList1.add(list_new_pic_selected.get(i));
}
}
if (picList1 == null || picList1.size() <= 0) {
displayToast(context, getResources().getString(R.string.capture_image_first));
return;
}
// Bundle bundle = new Bundle();
// bundle.putString(ARG_PARAM1, new Gson().toJson(picList1));
/* startActivity(new Intent(context, CompressionResizerActivity.class)
.putExtra(ARG_PARAM1, new Gson().toJson(picList1)));*/
someActivityResultLauncher.launch(new Intent(context, CompressionResizerActivity.class)
.putExtra(ARG_PARAM1, new Gson().toJson(picList1))
.putExtra(Constant.COMPRESS_STATUS, compressStatus)
.putExtra(Constant.COMPRESSION_SIZE_Type, compression_Type)
.putExtra(Constant.COMPRESSION_SIZE, compressionSize)
);
}
onClickEvent(v);
}
});
}
ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() == Activity.RESULT_OK) {
ArrayList<String> listSaved = result.getData().getStringArrayListExtra("selectedImages");
setResult(RESULT_OK, new Intent().putStringArrayListExtra("selectedImages", listSaved));
finish();
} else if (result.getResultCode() == Activity.RESULT_FIRST_USER) {
}
}
});
private void resize() {
HelperResizer.getInstance(context);
HelperResizer.setSize(viewBinding.btnBack, 70, 70, true);
HelperResizer.setSize(viewBinding.btnDone, 80, 80, true);
HelperResizer.setHeight(context, viewBinding.innerLay, 250);
HelperResizer.setHeight(context, viewBinding.actionBar, 150);
HelperResizer.setHeight(context, viewBinding.layText, 120);
}
private void setupCamera() {
//camera
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
viewBinding.camera.addCameraListener(new Listener());
}
private void setSelectedImageList() {
viewBinding.textView.setText("You can take upto" + ImgCount + " images");
list_new_pic_selected = new ArrayList<>();
for (int i = 0; i < ImgCount; i++) {
list_new_pic_selected.add(new ImageModel());
}
imageSelectedAdapter = new SelectedImageAdapter_Native(CameraActivity.this, list_new_pic_selected, this);
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
viewBinding.rvSelectedImageList.setLayoutManager(layoutManager);
viewBinding.rvSelectedImageList.setAdapter(imageSelectedAdapter);
viewBinding.rvSelectedImageList.scrollToPosition(selectedPosition);
viewBinding.rvSelectedImageList.setScrollX(viewBinding.rvSelectedImageList.computeHorizontalScrollOffset());
setBottomText();
}
private void setBottomText() {
int count = 0;
if (list_new_pic_selected != null && list_new_pic_selected.size() != 0)
for (int i = 0; i < list_new_pic_selected.size(); i++) {
if (list_new_pic_selected.get(i).getfPath() != null && list_new_pic_selected.get(i).getfPath().length() != 0) {
count++;
}
}
viewBinding.tv1.setText("Please Choose 1-" + list_new_pic_selected.size() + " Photos");
viewBinding.tv2.setText("(" + count + "/" + ImgCount + ")");
if (count != 0) {
viewBinding.btnDone.setSelected(true);
} else {
viewBinding.btnDone.setSelected(false);
}
}
public boolean checkSlot_AreFull() {
if (list_new_pic_selected == null || list_new_pic_selected.size() == 0)
return false;
int count = 0;
for (ImageModel imageModel : list_new_pic_selected) {
if (imageModel != null && !TextUtils.isEmpty(imageModel.getfPath())) {
count++;
}
}
if (count == 0 || count < list_new_pic_selected.size()) {
return false;
} else
return true;
}
@Override
public void onRemove_From_Selected_list(ImageModel imageModel, int position) {
if (!TextUtils.isEmpty(imageModel.getfPath()) && new File(imageModel.getfPath()).exists()) {
try {
org.apache.commons.io.FileUtils.forceDeleteOnExit(new File(imageModel.getfPath()));
} catch (IOException e) {
e.printStackTrace();
}
}
list_new_pic_selected.set(position, new ImageModel());
imageSelectedAdapter.notifyItemChanged(position);
setBottomText();
}
class Listener extends CameraListener {
@Override
public void onPictureTaken(@NonNull @NotNull PictureResult result) {
super.onPictureTaken(result);
// If planning to save a file on a background thread,
// just use toFile. Ensure you have permissions.
File file = new File(getFilesDir(), "images");
if (!file.exists()) {
file.mkdirs();
}
file = new File(file, getPicNameByPosition(selectedPosition));
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable @org.jetbrains.annotations.Nullable File file) {
ImageModel iteam = new ImageModel(file.getName(), file.getAbsolutePath(), false);
if (list_new_pic_selected == null)
list_new_pic_selected = new ArrayList<>();
list_new_pic_selected.set(selectedPosition, iteam);
imageSelectedAdapter.notifyListChange(list_new_pic_selected, selectedPosition - 1);
if (!checkSlot_AreFull())
selectedPosition = getEmptySlotPosition(list_new_pic_selected);
imageSelectedAdapter.notifyDataSetChanged();
setBottomText();
viewBinding.rvSelectedImageList.smoothScrollToPosition(selectedPosition);
}
});
}
private int getEmptySlotPosition(ArrayList<ImageModel> selected_originalImageList) {
for (int i = 0; i < selected_originalImageList.size(); i++) {
ImageModel imageModel = selected_originalImageList.get(i);
if (imageModel != null && TextUtils.isEmpty(imageModel.getfPath())) {
return i;
}
}
return 0;
}
public boolean checkSlot_AreFull() {
if (list_new_pic_selected == null || list_new_pic_selected.size() == 0)
return false;
int count = 0;
for (ImageModel imageModel : list_new_pic_selected) {
if (imageModel != null && !TextUtils.isEmpty(imageModel.getfPath())) {
count++;
}
}
if (count == 0 || count < list_new_pic_selected.size()) {
return false;
} else
return true;
}
@Override
public void onPictureShutter() {
super.onPictureShutter();
}
}
@Override
public void onResume() {
super.onResume();
viewBinding.camera.open();
}
@Override
public void onPause() {
super.onPause();
viewBinding.camera.close();
}
@Override
public void onDestroy() {
super.onDestroy();
viewBinding.camera.destroy();
}
} | [
"[email protected]"
] | |
ac0cf3ea59599abb9700fa26bd587bf2a0d9c962 | 23ec52180e445c39a0b357d5b3a99154ba681ed7 | /LearningJCIP/src/net/jcip/examples/chap4/composingobject/NumberRange.java | 507168bb5b2a39bb377d52a37e77a8e84a6e1f0b | [] | no_license | pisces312/MyJavaProjects | 1408c5f33f1f39fc3929ebe34d39b6bcd6a5d166 | 0529ba813350e710d8aaca2d89c453570b244a64 | refs/heads/master | 2021-01-18T03:59:42.190929 | 2017-12-16T15:58:13 | 2017-12-16T15:58:13 | 84,271,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java | package net.jcip.examples.chap4.composingobject;
import java.util.concurrent.atomic.*;
import net.jcip.annotations.NotThreadSafe;
/**
* NumberRange
* <p/>
* Number range class that does not sufficiently protect its invariants
*
* @author Brian Goetz and Tim Peierls
*/
@NotThreadSafe
public class NumberRange {
// INVARIANT: lower <= upper
private final AtomicInteger lower = new AtomicInteger(0);
private final AtomicInteger upper = new AtomicInteger(0);
public void setLower(int i) {
// Warning -- unsafe check-then-act
if (i > upper.get())
throw new IllegalArgumentException("can't set lower to " + i + " > upper");
lower.set(i);
}
public void setUpper(int i) {
// Warning -- unsafe check-then-act
if (i < lower.get())
throw new IllegalArgumentException("can't set upper to " + i + " < lower");
upper.set(i);
}
public boolean isInRange(int i) {
return (i >= lower.get() && i <= upper.get());
}
}
| [
"[email protected]"
] | |
082e844aafa6542b76552811396d4f8ef5087cf8 | bf8d80833e32391edbb6722ef1c80affa870536a | /src/main/java/com/baiwangmaoyi/luckydraw/config/JerseyConfig.java | f073bcab408133aff0bb1b06c4883232929b50aa | [] | no_license | ts-huyao/Lucky-Draw-Service | 0b8cddb95ac831d0103007afa696bc457de3bb00 | e8a67fd5f546058e9bf14dcdfdaebf7930ce5345 | refs/heads/master | 2021-03-22T04:47:10.558815 | 2017-01-05T08:02:15 | 2017-01-05T08:02:15 | 77,834,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.baiwangmaoyi.luckydraw.config;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
import com.baiwangmaoyi.luckydraw.rest.NY2017Resource;
@Component
@ApplicationPath("api")
public class JerseyConfig extends ResourceConfig {
public JerseyConfig() {
register(NY2017Resource.class);
}
}
| [
"[email protected]"
] | |
84e116e47a46676622510aabccf9736a1b5467a2 | 03a3b5f9fdac075cbdb4f82cd53c517549a11b95 | /day04/src/Demo11_1_Overload.java | 4b246f2e9c2bf7fe6b9cf44aed578a56c9f6215b | [] | no_license | j415/JavaSE | 8ceb4867a3991c411ea74b39b8e3ceac1a941632 | 931aac914825a777e75e7d68faacb970ea850843 | refs/heads/master | 2020-04-01T14:37:17.669006 | 2019-02-18T15:16:47 | 2019-02-18T15:16:47 | 153,301,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | /*
重载:方法名相同,参数列表不同,与返回值类型无关
重载的分类
1.参数个数不同
2.参数类型不同
顺序不同
*/
public class Demo11_1_Overload { // overload重载
public static void main(String[] args) {
double sum = add(10,20.2);
System.out.println("sum = "+ sum);
int sum1 = add(10,20,30);
System.out.println("sum1 = "+ sum1);
double sum2 = add(20.9,32);
System.out.println("sum2 = " + sum2);
}
/* 求两个整数的和
1.返回值类型int
2.参数列表 int a, int b
*/
public static double add(int a, double b) {
return a + b;
}
/* 求三个整数的和
1.返回值类型int
2.参数列表 int a, int b, int c
*/
public static int add(int a, int b, int c) {
return a + b + c;
}
/* 求两个小数的和
1.返回值类型double
2.参数列表 double a, double b
*/
public static double add(double a, int b) {
return a + b;
}
}
| [
"[email protected]"
] | |
55fd41825b0bc467f6954c185ce0f93dc49f85b5 | c20aa51dfe0141d511352004e48e1f2e2f6d39bb | /textile/src/main/java/com/mvc/service/CustomerFillManager.java | dc1d47af3bd66006ba207a2370203e0c7fc7e298 | [] | no_license | SriMaddy/SpringMVC_TextilesERP | 1cfb49d1da7b4421862083abd6ad25175815be22 | 9a5fa32977f9c46274ef58a3c4613671bef1fab9 | refs/heads/master | 2020-03-11T23:26:51.969936 | 2018-04-17T11:15:04 | 2018-04-17T11:15:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,105 | java | package com.mvc.service;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.beans.factory.annotation.Autowired;
import com.mvc.model.CustomerBean;
public class CustomerFillManager {
@Autowired
static CustomerMasterDaoService cusDao;
/**
* Fills the report with content
*
* @param worksheet
* @param startRowIndex starting row offset
* @param startColIndex starting column offset
* @param datasource the data source
*/
public static void fillReport(HSSFSheet worksheet, int startRowIndex, int startColIndex, List<CustomerBean> datasource) {
// Row offset
startRowIndex += 2;
// Create cell style for the body
HSSFCellStyle bodyCellStyle = worksheet.getWorkbook().createCellStyle();
bodyCellStyle.setAlignment(CellStyle.ALIGN_CENTER);
bodyCellStyle.setWrapText(true);
// Create body
for (int i=startRowIndex; i+startRowIndex-2< datasource.size()+2; i++) {
// Create a new row
HSSFRow row = worksheet.createRow((short) i+1);
HSSFCell cell1 = row.createCell(startColIndex+0);
cell1.setCellValue(datasource.get(i-2).getCusId());
cell1.setCellStyle(bodyCellStyle);
HSSFCell cell2 = row.createCell(startColIndex+1);
cell2.setCellValue(datasource.get(i-2).getCus_name());
cell2.setCellStyle(bodyCellStyle);
HSSFCell cell3 = row.createCell(startColIndex+5);
cell3.setCellValue(datasource.get(i-2).getContact_no());
cell3.setCellStyle(bodyCellStyle);
//Address
HSSFCell cell4 = row.createCell(startColIndex+3);
cell4.setCellValue(datasource.get(i-2).getAddress());
cell4.setCellStyle(bodyCellStyle);
HSSFCell cell5 = row.createCell(startColIndex+7);
cell5.setCellValue(datasource.get(i-2).getBalance().toString());
cell5.setCellStyle(bodyCellStyle);
}
}
} | [
"[email protected]"
] | |
58249562f1980cc7ab0d7e854199157bca8afb9b | cb36cc37e1eaff2843f84eba4f2697f519f5862f | /src/main/java/com/japharr/referral/entity/key/MemberProductPK.java | adc376d5a0f53eb058c00ac72e7bd5a37a66683a | [] | no_license | japharr/vertx-referral | 59bcaae56ac8c82a5b4ec9b514ce09336c85bde8 | c6dd2d88cb1cb35bef4ee20d1223a74640238d73 | refs/heads/master | 2023-07-25T13:38:33.773760 | 2021-09-08T16:15:34 | 2021-09-08T16:15:34 | 404,415,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package com.japharr.referral.entity.key;
import com.japharr.referral.entity.Member;
import com.japharr.referral.entity.Product;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;
import java.util.Objects;
@Setter @Getter
@AllArgsConstructor(staticName = "of")
@NoArgsConstructor
@Embeddable
public class MemberProductPK implements Serializable {
@Column(name = "member_id")
private Long memberId;
@Column(name = "product_id")
private Long productId;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MemberProductPK that = (MemberProductPK) o;
return memberId.equals(that.memberId) && productId.equals(that.productId);
}
@Override
public int hashCode() {
return Objects.hash(memberId, productId);
}
}
| [
"[email protected]"
] | |
6ce81bae2a449e3442f2c2c2a47159f5e4b97943 | ac09cb401391fafe7079482dce20672b6238d1c2 | /mobile_interface_1/src/main/java/zxjt/inte/testng/listener/HTMLReporter.java | b982f39cc9cc8cbd16989803191bac442556be4c | [] | no_license | liyanru910102/useful | 0f2809bb8c17b78a43e11b9838ddeb4a6b0ed861 | 975b77567aa8d62c176bf2fca3e6070cc2139371 | refs/heads/master | 2021-01-25T04:50:10.061218 | 2017-11-06T07:00:33 | 2017-11-06T07:00:33 | 93,490,852 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,629 | java | package zxjt.inte.testng.listener;
import java.io.File;
import java.sql.Connection;
import java.util.List;
import org.apache.commons.logging.LogFactory;
import org.testng.ITestResult;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.model.Test;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
import com.aventstack.extentreports.reporter.configuration.ChartLocation;
import com.aventstack.extentreports.reporter.configuration.Theme;
import zxjt.inte.report.DBConnection;
import zxjt.inte.report.StepBean;
import zxjt.inte.report.StepDao;
import zxjt.inte.report.TestBean;
import zxjt.inte.report.TestDao;
import zxjt.inte.util.FolderTypes;
import zxjt.inte.util.GetFolderPath;
public abstract class HTMLReporter {
private static final String TITLE_RESULT = "执行结果";
private static final String TITLE_CONFIRM = "参数信息";
private static final String TITLE_EX = "异常信息";
private static int exNum;
public static void generate() {
LogFactory.getLog(HTMLReporter.class).info("generate html report");
ExtentReports extent = initExtent();
Connection conn = null;
try {
conn = DBConnection.getConnection();
} catch (Exception e) {
throw new RuntimeException(e);
}
TestDao testDao = new TestDao(conn);
StepDao stepDao = new StepDao(conn);
ExtentTest exTest;
Test model;
String html;
List<StepBean> steps;
StepBean step;
for (TestBean test : testDao.getAll()) {
exTest = extent.createTest(test.getName());
model = exTest.getModel();
model.setStartTime(test.getStartTime());
steps = stepDao.getAll(test.getId());
for (int i = 0; i < steps.size(); ++i) {
html = getStepDescription(steps.get(i));
step = steps.get(i);
switch (step.getStatus()) {
case ITestResult.SUCCESS:
exTest.pass(html);
break;
case ITestResult.FAILURE:
exTest.fail(html);
break;
case ITestResult.SKIP:
exTest.skip(html);
break;
default:
System.err.println("未知状态,结果未写入报告: " + step.getStatus());
break;
}
model.getLogContext().get(i).setTimestamp(step.getTimeStamp());
}
model.setEndTime(test.getEndTime());
}
DBConnection.close();
extent.flush();
}
private static ExtentReports initExtent() {
//String folder = LightContext.getFolderPath(FolderTypes.REPORT);
//String folder =System.getProperty("user.dir")+"/report";
String folder = GetFolderPath.getFolderPath(FolderTypes.REPORT);
File file = new File(folder);
if (!file.exists()) {
file.mkdirs();
}
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(folder + "/report.html");
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
htmlReporter.config().setChartVisibilityOnOpen(true);
htmlReporter.config().setTheme(Theme.STANDARD);
htmlReporter.config().setDocumentTitle("自动化测试报告");
htmlReporter.config().setEncoding("utf-8");
htmlReporter.config().setReportName("自动化测试报告");
htmlReporter.config().setCSS(CssHelper.getCSS());
ExtentReports extent = new ExtentReports();
extent.setReportUsesManualConfiguration(true);
extent.attachReporter(htmlReporter);
//extent.setSystemInfo("Platform", LightContext.getPlatform().name());
extent.setSystemInfo("OS", System.getProperty("os.name"));
extent.setSystemInfo("Arch", System.getProperty("os.arch"));
extent.setSystemInfo("JDK", System.getProperty("java.version"));
return extent;
}
private static String getStepDescription(StepBean step) {
StringBuilder paramBuilder = wrapWithHTML(step.getParam(), HTMLReporter.TITLE_CONFIRM);
StringBuilder resultBuilder;
if (step.getStatus() == ITestResult.SUCCESS) {
resultBuilder = wrapWithHTML(step.getResult(), HTMLReporter.TITLE_RESULT);
} else {
resultBuilder = wrapFailInfoWithHTML(TITLE_EX, step);
}
return wrapTable(paramBuilder, resultBuilder);
}
private static StringBuilder wrapWithHTML(String str, String title) {
if (str == null)
return null;
StringBuilder sb = new StringBuilder("<b>");
sb.append(title).append("</b><pre>").append(str).append("</pre>");
return sb;
}
private static StringBuilder wrapFailInfoWithHTML(String title, StepBean step) {
String tr = step.getResult();
if (tr == null)
return null;
StringBuilder sb = new StringBuilder("<b>");
sb.append(title).append("</b>");
int num = ++exNum;
// <a href="#" data-featherlight="#ex1" class="box-trigger">堆栈信息</a>
sb.append("<a href=\"#\" data-featherlight=\"#ex").append(num).append("\" class=\"box-trigger\">堆栈信息</a>");
// <div class="msgbox" id="ex1">
sb.append("<div class=\"msgbox\" id=\"ex").append(num).append("\">");
sb.append("<h6>堆栈信息</h6><pre>").append(step.getStackTrace()).append("</pre></div>");
// <a href="#" data-featherlight="screenshot/1.png"
// class="box-trigger">截图</a>
String screenshot = step.getScreenshot();
if (screenshot != null) {
sb.append("<a href=\"#\" data-featherlight=\"").append(screenshot)
.append("\" class=\"box-trigger\">截图</a>");
}
sb.append("<pre>").append(tr).append("</pre>");
return sb;
}
private static String wrapTable(StringBuilder confirm, StringBuilder result) {
StringBuilder ret = new StringBuilder();
ret.append("<table><tr><td class=\"td-top td-width\">");
ret.append(confirm);
ret.append("</td>");
if (result != null) {
ret.append("<td class=\"td-top\">");
ret.append(result);
ret.append("</td>");
}
ret.append("</tr></table>");
return ret.toString();
}
}
| [
"[email protected]"
] | |
70799d301a1cc271a733cdf19902234eecaaf6c5 | 5296b2dd5d66e14c1951aca2c511067555363da1 | /crypto/src/main/java/tian/pusen/crypto/AES.java | b6c79601ef813d1887266cf9ca6795f3fe1847ad | [
"MIT"
] | permissive | pustian/learn-java | 75c883627d393a2a35b02cd1c8bbf590ca03daaa | efef1e0d98e66ad90eb6d7e89674d462a093adb0 | refs/heads/master | 2021-12-30T22:13:54.610229 | 2021-02-12T07:48:03 | 2021-02-12T07:48:03 | 248,968,911 | 0 | 0 | MIT | 2021-12-14T21:55:16 | 2020-03-21T12:12:30 | Java | UTF-8 | Java | false | false | 260 | java | package tian.pusen.crypto;
/**
* 〈一句话功能简述〉<br>
* 〈功能详细描述〉
* Date: 2017/12/28 13:12
*
* @author tianpusen
* @see [相关类/方法](可选)
* @since [产品/模块版本] (可选)
*/
public final class AES {
}
| [
"[email protected]"
] | |
6abde9735fef78d24aae4127496376bf75575f1c | caa4861222fac1a2d502b2b9c2dad5cc44620a77 | /hexie/src/main/java/com/yumu/hexie/web/shequ/LocationController.java | f200c056674afdfd3ebbd69a0042105765c1a88b | [] | no_license | linknabor/hexie | 4013e68719a255428a273c6f210ad9def3368e2c | 1b99deddd9fa2f3da869ffeb7b0f2eed502eed5f | refs/heads/product | 2023-08-31T04:08:40.293512 | 2023-08-09T07:09:33 | 2023-08-09T07:09:33 | 142,155,558 | 0 | 0 | null | 2023-09-12T05:30:08 | 2018-07-24T12:30:03 | Java | UTF-8 | Java | false | false | 1,258 | java | package com.yumu.hexie.web.shequ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yumu.hexie.integration.baidu.vo.RegionVo;
import com.yumu.hexie.service.shequ.LocationService;
import com.yumu.hexie.web.BaseController;
import com.yumu.hexie.web.BaseResult;
@RestController
public class LocationController extends BaseController {
@Autowired
private LocationService locationService;
//查询所有环境路径
@SuppressWarnings("unchecked")
@RequestMapping(value = "/getRegionUrl", method = RequestMethod.GET)
public BaseResult<RegionVo> getRegionUrl(@RequestParam(required=false) String coordinate) throws Exception {
return BaseResult.successResult(locationService.getRegionUrl(coordinate));
}
@RequestMapping(value = "/regionUrl", method = RequestMethod.PUT)
public String regionUrlCache(@RequestParam String code){
if (StringUtils.isEmpty(code)) {
return "";
}else {
return "success";
}
}
}
| [
"[email protected]"
] | |
ebc11b8e488e193aadf3441c909ed9fd722fef54 | 742207cad229db7dafba90d94c7d17b3d15ff522 | /server/Server.java | e05b986857c04d6531d8d2a4cd120f3dcf7c288b | [] | no_license | LukeANewton/File-Transfer-System | 0b9075ae9af5e9d3191f9eb0b8ec4a47cedce327 | 4bd0282a6975967f959cb9c52195b3a80480ac1c | refs/heads/master | 2020-05-07T15:39:49.231680 | 2019-04-10T19:21:06 | 2019-04-10T19:21:06 | 180,647,136 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,799 | java | package server;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;
/**
* a class representing the server for the server-client-intermediate host system. has
* Capability to receive requests, and create threads to process and send appropriate
* responses
*
* @author Luke Newton, Kevin Sun, Joe Frederick Samuel, Ryan Ribeiro
*
*/
public class Server {
//the port the server is located on
private static final int SERVER_PORT_NUMBER = 69;
//change this to turn on/off timeouts for the server
private static final boolean TIMEOUTS_ON = false;
//Milliseconds until server times out while waiting for response
private static final int TIMEOUT_MILLISECONDS = 5000;
//max size for data in a DatagramPacket
private static final int MAX_PACKET_SIZE = 516;
//change this to turn on/off pauses for the server request processing
private static final boolean PAUSES_ON = true;
/*number of milliseconds server pauses for each time
*(note that setting this too high with timeouts on may
*timeout client before message is processed)*/
private static final int PAUSE_MILLISECONDS = 1000;
//socket to receive messages
private DatagramSocket receiveSocket;
//port number of client to send response to
private int clientPort;
//buffer to contain data to send to client
private DatagramPacket receivePacket;
//thread created to handle a client request
private static Thread serverLogicThread;
//boolean indicating whther server should be shutting down
private volatile boolean quitPreperation;
//integer representing the number of messages currently being processed
private volatile int numberOfMessagesBeingProcessed;
/**
* Constructor
*
* @throws SocketException indicate failed to create socket for the intermediate host
*/
public Server() throws SocketException{
receiveSocket = new DatagramSocket();
//turn on timeout if required
if(TIMEOUTS_ON)
receiveSocket.setSoTimeout(TIMEOUT_MILLISECONDS);
//create packet of max size to guarantee it fits a received message
receivePacket = new DatagramPacket(new byte[MAX_PACKET_SIZE], MAX_PACKET_SIZE);
quitPreperation = false;
numberOfMessagesBeingProcessed = 0;
}
/**
* Constructor
*
* @param port integer representing the port number to bind intermediate host's socket to
* @throws SocketException indicate failed to create socket for the intermediate host
*/
public Server(int port) throws SocketException{
this();
receiveSocket = new DatagramSocket(port);
}
/**
* Sends the receive socket to the thread to be reused.
*
* @return receiveSocket
*/
public DatagramSocket getReceiveSocket() {
return receiveSocket;
}
/**
* informs the caller of whether or not the server is shutting down
*
* @return true if server is shutting down, otherwise false
*/
public boolean isQuitTime() {
return quitPreperation;
}
/**
* inform the server to begin shutting down
*
* @author Luke Newton
*/
public synchronized void setQuitTime() {
this.quitPreperation = true;
receiveSocket.close();
}
/**
* create a new thread to deal with a specified message
*
* @author Luke Newton
* @param request the message received to process
*/
public void newMessageToProcess(DatagramPacket request){
System.out.println("Server: received message");
serverLogicThread = new Thread(new ServerSpawnThread(this, request));
//priorities are set low to make shutdown occur in a timely manner
serverLogicThread.setPriority(Thread.MIN_PRIORITY);
serverLogicThread.start();
numberOfMessagesBeingProcessed++;
}
/**
* decrememnt the number of messages being processed when done
*
* @author Luke Newton
*/
public void messageProcessed(){
numberOfMessagesBeingProcessed--;
}
/**
* returns the number of messages currently being processed
*
* @author Luke Newton
* @return the number of messages currently being processed
*/
private int getNumberOfMessagesBeingProcessed() {
return numberOfMessagesBeingProcessed;
}
/**
*Return the data in the datagram packet received
*
* @return the data in the datagram packet received
*/
public byte[] getreceivePacketData(){
return receivePacket.getData();
}
/**
* returns the port number of the latest client to send a message here
*
* @return the port number of the latest client to send a message here
*/
public int getClientPort(){
return clientPort;
}
/**
* client waits until it receives a message, which is parsed, stored in receivePacket and returned
*
* @return the message received as a DatagramPacket
* @throws IOException indicated an I/O error has occurred
*/
public DatagramPacket waitReceiveMessage() throws IOException{
receiveSocket.receive(receivePacket);
return receivePacket;
}
/**
* pauses execution breiefly so output can be read as it is created
*/
public void pause(){
if(PAUSES_ON){
try {
Thread.sleep(PAUSE_MILLISECONDS);
} catch (InterruptedException e) {
System.out.println("Server interrupted while pausing execution");
e.printStackTrace();
System.exit(1);
}
}
}
/**
* main method for server program containing specified server algorithm
*
* @param args any arguements passed to Server main are not used
*/
public static void main(String[] args) {
/*attempt to create server*/
Server server = null;
try {
server = new Server(SERVER_PORT_NUMBER);
} catch (SocketException e) {
System.err.println("SocketException: failed to create socket for server");
e.printStackTrace();
System.exit(1);
}
//create thread to handle user commands
Thread serverQuitThread = new Thread(new ServerQuitRunnable(server));
//priority is set high to make shutdown occur in a timely manner
serverQuitThread.setPriority(Thread.MAX_PRIORITY);
serverQuitThread.start();
System.out.println("Enter 'quit' to begin server shutdown procedures");
/*Recieve packet and create a thread to handle the request.
* Do this while the server is not trying to shut down*/
while(!server.isQuitTime()) {
DatagramPacket request = null;
try {
request = server.waitReceiveMessage();
} catch (SocketException e){
System.out.println("\nSocketException: server receive socket closed");
break;
} catch (IOException e) {
System.err.println("IOException: I/O error occured while server waiting to receive message");
e.printStackTrace();
System.exit(1);
}
server.newMessageToProcess(request);
}
//server now shuting down, do not stop until no more messages are being processed
while(server.getNumberOfMessagesBeingProcessed() != 0){}
System.out.println("\nServer successfully quit due to user command");
System.exit(0);
}
} | [
"[email protected]"
] | |
aaf8dc8612199ec77a1e1f5868193f1c47c3f831 | 2483baf7776403777a90c8f3a2bedbc74d61b904 | /src/test/org/h2/test/unit/TestFtp.java | 63a2b22d6610ae959392432f49d67c937de3a1c1 | [] | no_license | angusmacdonald/h2o | 06e4b87d38912f07625e5d0c7f1375ced38894c5 | d16665c7470953ee524c09fa9a90a3f476db4387 | refs/heads/master | 2021-01-18T18:08:30.860163 | 2012-03-21T20:16:29 | 2012-03-21T20:16:29 | 3,790,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,707 | java | /*
* Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License, Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html). Initial Developer: H2 Group
*/
package org.h2.test.unit;
import org.h2.server.ftp.FtpEvent;
import org.h2.server.ftp.FtpEventListener;
import org.h2.server.ftp.FtpServer;
import org.h2.test.TestBase;
import org.h2.tools.Server;
/**
* Tests the FTP server tool.
*/
public class TestFtp extends TestBase implements FtpEventListener {
private FtpEvent lastEvent;
/**
* Run just this test.
*
* @param a
* ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception {
test(baseDir);
}
private void test(String dir) throws Exception {
Server server = Server.createFtpServer(new String[] { "-ftpDir", dir, "-ftpPort", "8121" }).start();
FtpServer ftp = (FtpServer) server.getService();
ftp.setEventListener(this);
FtpClient client = FtpClient.open("localhost:8121");
client.login("sa", "sa");
client.makeDirectory("test");
client.changeWorkingDirectory("test");
assertEquals(lastEvent.getCommand(), "CWD");
client.makeDirectory("hello");
client.changeWorkingDirectory("hello");
client.changeDirectoryUp();
assertEquals(lastEvent.getCommand(), "CDUP");
client.nameList("hello");
client.removeDirectory("hello");
client.close();
server.stop();
}
public void beforeCommand(FtpEvent event) {
lastEvent = event;
}
public void afterCommand(FtpEvent event) {
lastEvent = event;
}
public void onUnsupportedCommand(FtpEvent event) {
lastEvent = event;
}
}
| [
"[email protected]"
] | |
38c2f1fb078768703b065fc77d7354ab6bd06228 | bed3d9d1f190fa5ed06a9b5c77e48a0d2edf6770 | /blog-core/src/main/java/com/zyd/blog/business/util/LinksUtil.java | aea84da5fc301fac8fc62c5634d261f700a11e70 | [
"MIT"
] | permissive | linsng/DBlog | 2ce5cb850da81bdc2126cefa5b597650612bc2bf | 18cf152a14934bfe36d9b26c027f4e4f03413a37 | refs/heads/master | 2020-03-23T11:32:21.835212 | 2018-09-03T09:15:07 | 2018-09-03T09:15:07 | 141,509,320 | 0 | 0 | MIT | 2018-07-19T01:37:50 | 2018-07-19T01:37:50 | null | UTF-8 | Java | false | false | 7,801 | java | /**
* MIT License
* Copyright (c) 2018 yadong.zhang
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.zyd.blog.business.util;
import com.zyd.blog.business.consts.HttpConsts;
import com.zyd.blog.util.HtmlUtil;
import com.zyd.blog.util.RestClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.springframework.http.HttpMethod;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 友情链接工具类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2018/4/16 16:26
* @since 1.0
*/
@Slf4j
public class LinksUtil {
/**
* 单位b,1kb = 1024b
*/
private static final int DEFAULT_FACICON_MAX_SIZE = 1024 * 5;
private static final int DEFAULT_FACICON_MIN_SIZE = 1;
/**
* 获取网站favicon图标的正则表达式
*/
private static final Pattern[] ICON_PATTERNS = new Pattern[]{
Pattern.compile("rel=[\"']icon[\"'][^\r\n>]+?((?<=href=[\"']).+?(?=[\"']))"),
Pattern.compile("((?<=href=[\"']).+?(?=[\"']))[^\r\n<]+?rel=[\"']icon[\"']")};
/**
* 获取网站的favicon图标<br>
* https站点可能存在问题
*
* @param url
* 网站地址
* @return favicon地址
* @deprecated 当前版本为前台用户手动录入favicon,可考虑后台应用使用该接口
*/
@Deprecated
public static String getFavicon(String url) {
if (!url.startsWith(HttpConsts.HTTP_PROROCOL) && !url.startsWith(HttpConsts.HTTPS_PROROCOL)) {
url = HttpConsts.HTTP_PROROCOL + url;
}
String html = RestClientUtil.get(url);
for (Pattern iconPattern : ICON_PATTERNS) {
Matcher matcher = iconPattern.matcher(html);
if (matcher.find()) {
return matcher.group(1);
}
}
return null;
}
/**
* 检查favicon的有效性
*
* @param faviocnUrl
* favicon地址
* @return true favicon大小合适,false favicon过大或者过小
*/
public static boolean checkFavicon(String faviocnUrl) {
int faviconLength = getFaviconSize(faviocnUrl);
return faviconLength >= DEFAULT_FACICON_MIN_SIZE && faviconLength < DEFAULT_FACICON_MAX_SIZE;
}
/**
* 获取网站的favicon图标大小
*
* @param faviocnUrl
* favicon地址
* @return favicon图标大小
*/
private static int getFaviconSize(String faviocnUrl) {
int contentLength = 0;
try {
final URL url = new URL(faviocnUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(HttpMethod.GET.name());
connection.setDoOutput(true);
// 必须设置false,否则会自动redirect到Location的地址
connection.setInstanceFollowRedirects(false);
contentLength = connection.getContentLength();
log.debug("Favicon size : {}", contentLength);
} catch (MalformedURLException e) {
e.printStackTrace();
log.error("请求地址不对", e);
} catch (ProtocolException e) {
e.printStackTrace();
log.error("请求地址协议异常", e);
} catch (IOException e) {
e.printStackTrace();
log.error("数据传输异常", e);
}
return contentLength;
}
/**
* 爬取url所在的页面,查找是否添加了本站友情链接
*
* @param url
* 目标站地址
* @param domainName
* 本站地址
* @return true 已链接本站,false 未链接
*/
public static boolean hasLinkByHtml(String url, String domainName) {
if (!url.startsWith(HttpConsts.HTTP_PROROCOL) && !url.startsWith(HttpConsts.HTTPS_PROROCOL)) {
url = HttpConsts.HTTP_PROROCOL + url;
}
String html = RestClientUtil.get(url);
return !StringUtils.isEmpty(html) && html.contains(domainName);
}
/**
* 通过Chinaz接口
* 查找是否添加了本站友情链接
*
* @param url
* 目标站地址
* @param domainName
* 本站地址
* @return true 已链接本站,false 未链接
*/
public static boolean hasLinkByChinaz(String url, String domainName) {
if (url.startsWith(HttpConsts.HTTP_PROROCOL) || url.startsWith(HttpConsts.HTTPS_PROROCOL)) {
url = url.replace(HttpConsts.HTTP_PROROCOL, "");
url = url.replace(HttpConsts.HTTPS_PROROCOL, "");
}
try {
Document htmlDocument = Jsoup.parse(RestClientUtil.get("http://link.chinaz.com/" + url));
Element ulElement = HtmlUtil.getElementById(htmlDocument, "ulLink");
int maxRequestCount = 2;
while (ulElement == null) {
if (maxRequestCount == 0) {
return false;
}
System.err.println("没有获取到element.还剩" + maxRequestCount + "次获取机会.");
htmlDocument = Jsoup.parse(RestClientUtil.get("http://link.chinaz.com/" + url));
ulElement = HtmlUtil.getElementById(htmlDocument, "ulLink");
maxRequestCount--;
}
Elements liElements = ulElement.getElementsByTag("li");
if (liElements == null || liElements.size() <= 0) {
return false;
}
for (int i = 1; i < liElements.size(); i++) {
Element liElement = liElements.get(i);
if (liElement == null) {
continue;
}
String text = liElement.getElementsByClass("tl").get(0).getElementsByTag("span").get(1).getElementsByTag("a").get(0).text();
if (text.startsWith(domainName) || text.startsWith("www." + domainName)
|| text.startsWith(HttpConsts.HTTP_PROROCOL + domainName) || text.startsWith(HttpConsts.HTTP_PROROCOL + "www." + domainName)
|| text.startsWith(HttpConsts.HTTPS_PROROCOL + domainName) || text.startsWith(HttpConsts.HTTPS_PROROCOL + "www." + domainName)) {
return true;
}
}
} catch (Exception e) {
log.error("访问Chinaz网站失败!", e);
}
return false;
}
}
| [
"[email protected]"
] | |
8f31bf1301f7465c7eef39a091a9c3455c7ab319 | 8eb628f3ccaa35a0b0a70d5dfb1d38e1e306b690 | /javaProgramming/modelul Swing/JSSplitPane/mainPack/Fereastra3.java | 0f4f79d921eeb9dcd3de3f3e4ffeb89a216807ea | [] | no_license | nicolaemariuta/bachelorHomeworkAndStudy | 66ebf6259e7831f394e198530dcef9900828178d | f4e6c707e99c4618d570c5c687f5c4ca44ddfe02 | refs/heads/master | 2021-01-10T21:59:48.406018 | 2016-04-11T11:54:51 | 2016-04-11T11:54:51 | 31,667,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package mainPack;
import java.awt.*;
import javax.swing.*;
public class Fereastra3 extends JFrame
{
Fereastra3 (String titlu)
{
super(titlu);
String elem[] = {"Unu", "Doi", "Trei"};
JList list = new JList (elem);
JPanel panel = new JPanel (new GridLayout(3,1));
panel.add(new JButton("Adauga"));
panel.add(new JButton("Salveaza"));
panel.add(new JButton("Sterge"));
JTextArea text = new JTextArea("Mai multe componente separate prin \n" + "intermediul containerelor JSplitPane");
// separam lista de grupul celor 3 butoane
JSplitPane sp1 = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, list, panel);
// separam containerul cu lista si butoanele de componenta de editare text
JSplitPane sp2 = new JSplitPane (JSplitPane.VERTICAL_SPLIT, sp1 , text);
getContentPane().add(sp2);
pack();
}
}
| [
"[email protected]"
] | |
3760287af7cd13b3ef2f2c16e0806401eb3821b1 | b6b25324b233350f89bf98d0e87c21d004d113f7 | /src/main/java/lt/kono/exchange/domain/ExchangeRequest.java | 6e3d9bf3d7199388c7ba7431282f1aa6759da5a8 | [] | no_license | ekonopliov/currency-exchange | 0ea0cc9ff4e7eede803be971503f5279f4b716e9 | 573a1e8878afc2cc7bb5d6c782ede55debcf9cf2 | refs/heads/master | 2022-12-18T18:53:33.624024 | 2020-09-13T17:13:35 | 2020-09-13T17:13:35 | 294,323,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package lt.kono.exchange.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import lt.kono.exchange.validations.CurrencyCode;
import lt.kono.exchange.validations.SupportedCurrencyCode;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* Exchange request domain class
* Custom validators: @CurrencyCode, @SupportedCurrencyCode
*
* @author ekonopliov
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExchangeRequest {
@CurrencyCode
@SupportedCurrencyCode
@NotEmpty(message = "Sell currency code must be provided")
private String from;
@CurrencyCode
@SupportedCurrencyCode
@NotEmpty(message = "Exchange currency code must be provided")
private String to;
@NotNull(message = "Amount must be set")
private BigDecimal amount;
}
| [
"[email protected]"
] | |
6552a77d03797f7d194b4a5c85ed80ac7b31e04b | 1c34fd6d27766bc48960bd88797d7f2f123f775b | /java-turorial/src/main/java/com/outlook/dev/service/PagedResult.java | 24cd8152c0fe15242c61119b01cf29b8ec854868 | [] | no_license | emmanueliv2/sinergia | 10dfe22da0b3bfa55bd12e4bb888d1116e0ba5f3 | c680544159035380e3e69f75cba8c16bcc16c7d1 | refs/heads/master | 2020-03-19T03:46:05.600323 | 2018-06-01T20:41:01 | 2018-06-01T20:41:01 | 135,749,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | package com.outlook.dev.service;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PagedResult<T> {
@JsonProperty("@odata.context")
private String context;
@JsonProperty("@odata.nextLink")
private String nextPageLink;
private T[] value;
public String getNextPageLink() {
return nextPageLink;
}
public void setNextPageLink(String nextPageLink) {
this.nextPageLink = nextPageLink;
}
public T[] getValue() {
return value;
}
public void setValue(T[] value) {
this.value = value;
}
public String getContext() {
return context;
}
public void setContext(String context) {
this.context = context;
}
} | [
"[email protected]"
] | |
e41a23c2491da1f5631d8160ed3cbf9f5577dab2 | 14a14840f553e10be95f723ded738d5f8ce71333 | /my-tiny-spring/src/main/java/com/yrb/tinyioc/aop/ClassFilter.java | 354ec45ca511cae3479ee4b1c7277afa8ed46b88 | [] | no_license | yangrubing/my-tiny-spring | 26c2a7d7dc14f3dd001def6047dff3a513e5bae4 | 60b011d8b8fa4844d16ea81a4fb68c0c04f30d2a | refs/heads/master | 2021-01-06T20:40:16.539277 | 2017-08-08T08:20:39 | 2017-08-08T08:20:39 | 65,347,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.yrb.tinyioc.aop;
/**
* @author bjyangrubing
* @createTime 2017/8/8 11:02
* Description:
*/
public interface ClassFilter
{
boolean matches(Class targetClass);
}
| [
"[email protected]"
] | |
c534654412df17e318a93e30548536882fc8f950 | abb775368f029588e9cba6affdac467cadd1d0c4 | /src/Prioridade.java | 831eb87dee5f9625efe83e91c38900fdb98ef2b2 | [] | no_license | pablo-vicente/Fila-Atendimento-THREAD | 76a8bb62430ca768d1e20a76d49d4052ff53385a | a817d11d475901bb117571c3d5f5fac150555c76 | refs/heads/master | 2020-04-28T01:13:24.294530 | 2019-03-10T16:06:35 | 2019-03-10T16:06:35 | 174,846,571 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | 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.
*/
/**
*
* @author pablo
*/
public class Prioridade {
private int cod;
private Prioridade prioridade;
private Cidadao cidadao;
private int qntAtendidoSequen;
public Prioridade(int cod){
this.cod = cod;
}
public int getCod() {
return cod;
}
public void setCod(int cod) {
this.cod = cod;
}
public Prioridade getPrioridade() {
return prioridade;
}
public void setPrioridade(Prioridade prioridade) {
this.prioridade = prioridade;
}
public Cidadao getCidadao() {
return cidadao;
}
public void setCidadao(Cidadao cidadao) {
this.cidadao = cidadao;
}
public int getQntAtendidoSequen() {
return qntAtendidoSequen;
}
public void setQntAtendidoSequen(int qntAtendidoSqn) {
this.qntAtendidoSequen = qntAtendidoSqn;
}
}
| [
"[email protected]"
] | |
518c8dbf6ac222a5e6cba19b449c84b28e6981a8 | 6de8e916104251db149fcea44e10c662e8405ce5 | /android/app/src/main/java/com/rigel/MainActivity.java | a6659b507fe3ab23c02dc54449e5fd97361a3cec | [] | no_license | mustafaskyer/rigel-rn | 8f5e42990195ffb0f9404f63a7f869c6d6eefaf9 | 411ad0115090dd785ff267c150c946b3b24b5efd | refs/heads/master | 2021-07-05T06:46:49.728266 | 2020-08-17T09:02:47 | 2020-08-17T09:02:47 | 158,963,525 | 5 | 0 | null | 2020-08-17T09:03:36 | 2018-11-24T18:35:42 | JavaScript | UTF-8 | Java | false | false | 585 | java | package com.rigel;
import com.facebook.react.ReactActivity;
import android.os.Bundle;
import org.devio.rn.splashscreen.SplashScreen; // here
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "Rigel";
}
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// SplashScreen.show(this); // here
// super.onCreate(savedInstanceState);
// }
}
| [
"[email protected]"
] | |
016e88d143f6bf3a4023930b3c9d1759fcea7331 | 291463a9794ee81bc69dd08123a2b76d7c1f239e | /src/org/anddev/andengine/opengl/texture/source/TextureSourceDecorator.java | 13fa4e07ff3524841a2b1cacedec50d980174fbf | [] | no_license | Cypherkhris/Poly_Ref | cd4b6ced8a14b722432a4486a80007e4544b22d6 | f000c123c01d017226f402b364d4f897aa8e8717 | refs/heads/master | 2021-06-16T06:27:35.660814 | 2017-05-25T23:44:23 | 2017-05-25T23:44:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,256 | java | package org.anddev.andengine.opengl.texture.source;
import android.graphics.Bitmap;
import android.graphics.Canvas;
/**
* @author Nicolas Gramlich
* @since 16:43:29 - 06.08.2010
*/
public abstract class TextureSourceDecorator implements ITextureSource {
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
protected final ITextureSource mTextureSource;
// ===========================================================
// Constructors
// ===========================================================
public TextureSourceDecorator(final ITextureSource pTextureSource) {
this.mTextureSource = pTextureSource;
}
@Override
public abstract TextureSourceDecorator clone();
// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
protected abstract void onDecorateBitmap(final Canvas pCanvas);
@Override
public int getWidth() {
return this.mTextureSource.getWidth();
}
@Override
public int getHeight() {
return this.mTextureSource.getHeight();
}
@Override
public Bitmap onLoadBitmap() {
final Bitmap bitmap = this.ensureLoadedBitmapIsMutable(this.mTextureSource.onLoadBitmap());
final Canvas canvas = new Canvas(bitmap);
this.onDecorateBitmap(canvas);
return bitmap;
}
// ===========================================================
// Methods
// ===========================================================
private Bitmap ensureLoadedBitmapIsMutable(final Bitmap pBitmap) {
if(pBitmap.isMutable()) {
return pBitmap;
} else {
final Bitmap mutableBitmap = pBitmap.copy(pBitmap.getConfig(), true);
pBitmap.recycle();
return mutableBitmap;
}
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
| [
"[email protected]"
] | |
816cd63dd00a7098258dc995dee5e7129003648d | 6392035b0421990479baf09a3bc4ca6bcc431e6e | /RefactoringMiner-1.0.0/src/org/refactoringminer/api/GitHistoryRefactoringMiner.java | ca455debc5c385874011340e5d889d246c22eec0 | [] | no_license | ameyaKetkar/RMinerEvaluationTools | 4975130072bf1d4940f9aeb6583eba07d5fedd0a | 6102a69d1b78ae44c59d71168fc7569ac1ccb768 | refs/heads/master | 2020-09-26T00:18:38.389310 | 2020-05-28T17:34:39 | 2020-05-28T17:34:39 | 226,119,387 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,584 | java | package org.refactoringminer.api;
import org.eclipse.jgit.lib.Repository;
/**
* Detect refactorings in the git history.
*
*/
public interface GitHistoryRefactoringMiner {
/**
* Iterate over each commit of a git repository and detect all refactorings performed in the
* entire repository history. Merge commits are ignored to avoid detecting the same refactoring
* multiple times.
*
* @param repository A git repository (from JGit library).
* @param branch A branch to start the log lookup. If null, commits from all branches are analyzed.
* @param handler A handler object that is responsible to process the detected refactorings and
* control when to skip a commit.
* @throws Exception propagated from JGit library.
*/
void detectAll(Repository repository, String branch, RefactoringHandler handler) throws Exception;
/**
* Iterate over commits between two release tags of a git repository and detect refactorings performed
* in the entire repository history. Merge commits are ignored to avoid detecting the same refactoring
* multiple times.
*
* @param repository A git repository (from JGit library).
* @param startTag An annotated tag to start the log lookup.
* @param endTag An annotated tag to end the log lookup.
* @param handler A handler object that is responsible to process the detected refactorings and
* control when to skip a commit.
* @throws Exception propagated from JGit library.
*/
void detectBetweenTags(Repository repository, String startTag, String endTag, RefactoringHandler handler)
throws Exception;
/**
* Iterate over commits between two commits of a git repository and detect refactorings performed
* in the entire repository history. Merge commits are ignored to avoid detecting the same refactoring
* multiple times.
*
* @param repository A git repository (from JGit library).
* @param startCommitId The SHA key that identifies the commit to start the log lookup.
* @param endCommitId The SHA key that identifies the commit to end the log lookup.
* @param handler A handler object that is responsible to process the detected refactorings and
* control when to skip a commit.
* @throws Exception propagated from JGit library.
*/
void detectBetweenCommits(Repository repository, String startCommitId, String endCommitId, RefactoringHandler handler)
throws Exception;
/**
* Fetch new commits from the remote repo and detect all refactorings performed in these
* commits.
*
* @param repository A git repository (from JGit library).
* @param handler A handler object that is responsible to process the detected refactorings and
* control when to skip a commit.
* @throws Exception propagated from JGit library.
*/
void fetchAndDetectNew(Repository repository, RefactoringHandler handler) throws Exception;
/**
* Detect refactorings performed in the specified commit.
*
* @param repository A git repository (from JGit library).
* @param cloneURL The clone URL of the repository.
* @param commitId The SHA key that identifies the commit.
* @param handler A handler object that is responsible to process the detected refactorings.
*/
void detectAtCommit(Repository repository, String cloneURL, String commitId, RefactoringHandler handler);
void detectAtCommit(String cloneURL, String commitId, RefactoringHandler handler);
/**
* @return An ID that represents the current configuration for the Refactoring Miner algorithm in use.
*/
String getConfigId();
}
| [
"[email protected]"
] | |
146f6b090db0581aa6bbb625bf4f44e79cdc5892 | 9feca72566435b2af3563e5d015cf5f33867e050 | /shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/lock/manager/internal/ExclusiveInternalLock.java | e5dbf653742dc30c283b80428c5e0abb4e2af3e3 | [
"Apache-2.0"
] | permissive | heychengjw/shardingsphere | d93c1a6ef4058ce0e381b19ed8f24d66f2dff83c | 043dc7939d824c5429a6e63788851ca4be14ad2a | refs/heads/master | 2023-03-15T07:53:59.482619 | 2022-07-14T08:10:40 | 2022-07-14T08:10:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,020 | 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.shardingsphere.mode.manager.cluster.coordinator.lock.manager.internal;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.lock.LockState;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.service.LockRegistryService;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.LockNodeUtil;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.lock.util.TimeoutMilliseconds;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
/**
* Exclusive lock.
*/
@Slf4j
@RequiredArgsConstructor
public final class ExclusiveInternalLock implements InternalLock, LockAckAble {
private final String lockName;
private final InternalLock sequencedInternalLock;
private final LockRegistryService lockService;
private final ComputeNodeInstance currentInstance;
private final Collection<ComputeNodeInstance> computeNodeInstances;
private final AtomicBoolean isOwner = new AtomicBoolean(false);
private final AtomicReference<LockState> synchronizedLockState = new AtomicReference<>(LockState.UNLOCKED);
private final Set<String> lockedInstances = new CopyOnWriteArraySet<>();
@Override
public boolean tryLock() {
return tryLock(TimeoutMilliseconds.MAX_TRY_LOCK);
}
@Override
public boolean tryLock(final long timeoutMillis) {
if (!sequencedInternalLock.tryLock(TimeoutMilliseconds.DEFAULT_REGISTRY)) {
log.debug("Exclusive lock acquire sequenced failed, lock name: {}", lockName);
return false;
}
try {
long timeoutMilliseconds = Math.max(timeoutMillis, TimeoutMilliseconds.MIN_TRY_LOCK);
log.debug("Exclusive lock acquire sequenced success, lock name: {}, timeout milliseconds: {}ms", lockName, timeoutMilliseconds);
return innerTryLock(lockName, timeoutMilliseconds);
} finally {
sequencedInternalLock.unlock();
log.debug("Exclusive lock release sequenced success, database name: {}", lockName);
}
}
private boolean innerTryLock(final String lockName, final long timeout) {
if (!synchronizedLockState.compareAndSet(LockState.UNLOCKED, LockState.LOCKING)) {
log.debug("Exclusive lock try Lock set lock state failed, lock name: {}, lock state: {}", lockName, synchronizedLockState.get().name());
return false;
}
if (!isOwner.compareAndSet(false, true)) {
log.debug("Exclusive lock try Lock set lock owner failed, lock name: {}, lock is owner: {}", lockName, isOwner.get());
return false;
}
if (acquire(lockName, timeout)) {
if (synchronizedLockState.compareAndSet(LockState.LOCKING, LockState.LOCKED)) {
log.debug("Exclusive lock try Lock acquire lock success, lock name: {}", lockName);
return true;
}
}
reSetLockState();
log.debug("Inter mutex lock try Lock acquire lock failed, lock name: {}", lockName);
return false;
}
private boolean acquire(final String lockName, final long timeout) {
long acquireStart = System.currentTimeMillis();
boolean isLocked = lockService.tryLock(lockName, timeout);
if (isLocked) {
lockedInstances.add(currentInstance.getCurrentInstanceId());
long acquireEnd = System.currentTimeMillis();
long acquireExpend = acquireEnd - acquireStart;
log.debug("inter mutex lock acquire lock success then await for ack, lock name: {}, expend time millis {}ms", lockName, acquireExpend);
if (isAckOK(timeout - acquireExpend)) {
long ackExpend = System.currentTimeMillis() - acquireEnd;
log.debug("inter mutex lock acquire lock success and ack success, lock name: {}, expend time millis {}ms", lockName, ackExpend);
return true;
} else {
lockService.releaseLock(lockName);
return false;
}
}
log.debug("inter mutex lock acquire lock timeout. lock name: {}, timeout millis {}ms", lockName, timeout);
return false;
}
private boolean isAckOK(final long timeout) {
long expend = 0;
do {
if (isAckCompleted(expend)) {
return true;
}
TimeoutMilliseconds.sleepInterval(TimeoutMilliseconds.DEFAULT_REGISTRY);
expend += TimeoutMilliseconds.DEFAULT_REGISTRY;
} while (timeout > expend);
log.debug("inter mutex ack lock timeout, timeout millis {}ms", timeout);
return false;
}
private boolean isAckCompleted(final long expend) {
if (expend > TimeoutMilliseconds.MAX_ACK_EXPEND) {
lockedInstances.addAll(lockService.acquireAckLockedInstances(LockNodeUtil.generateAckPathName(lockName)));
}
if (computeNodeInstances.size() > lockedInstances.size()) {
return false;
}
for (ComputeNodeInstance each : computeNodeInstances) {
if (!lockedInstances.contains(each.getInstanceMetaData().getId())) {
return false;
}
}
return true;
}
@Override
public void unlock() {
LockState lockState = synchronizedLockState.get();
if (LockState.LOCKED == lockState) {
log.debug("inter mutex lock unlock. lock name: {}", lockName);
if (isOwner.get()) {
lockService.releaseLock(lockName);
log.debug("inter mutex lock owner lock release lock success. lock name: {}", lockName);
} else {
lockService.removeLock(lockName);
log.debug("inter mutex lock not owner remove lock success. lock name: {}", lockName);
}
reSetLockState();
return;
}
log.debug("inter mutex lock ignore unlock, lock name: {} lock state: {}", lockName, lockState);
}
@Override
public boolean isLocked() {
return LockState.LOCKED == synchronizedLockState.get();
}
@Override
public void ackLock(final String ackLockName, final String lockedInstanceId) {
LockState lockState = synchronizedLockState.get();
boolean owner = isOwner.get();
if (!owner && LockState.UNLOCKED == lockState) {
lockService.ackLock(ackLockName, lockedInstanceId);
lockedInstances.add(lockedInstanceId);
synchronizedLockState.compareAndSet(LockState.UNLOCKED, LockState.LOCKED);
log.debug("inter mutex lock ack lock success, ack lock name: {}", ackLockName);
}
log.debug("inter mutex lock ignore ack lock, ack lock name: {}, lock state: {}, lock owner: {}", ackLockName, lockState, owner);
}
@Override
public void releaseAckLock(final String ackLockName, final String lockedInstanceId) {
boolean owner = isOwner.get();
if (!owner) {
lockService.releaseAckLock(ackLockName);
log.debug("inter mutex lock not owner release ack lock success, ack lock name: {}, locked instanceId: {}", ackLockName, lockedInstanceId);
}
reSetLockState();
}
@Override
public void addLockedInstance(final String lockedInstanceId) {
lockedInstances.add(lockedInstanceId);
log.debug("inter mutex lock add locked instance id, id: {}", lockedInstanceId);
}
@Override
public void removeLockedInstance(final String lockedInstanceId) {
lockedInstances.remove(lockedInstanceId);
log.debug("inter mutex lock remove locked instance id, id: {}", lockedInstanceId);
}
@Override
public void reSetLockState() {
lockedInstances.clear();
isOwner.set(false);
synchronizedLockState.set(LockState.UNLOCKED);
}
}
| [
"[email protected]"
] | |
48de89b50f6f448850d82e1c5726010e55eaad7c | c753b739b8e5484c0251113b797c442ef0b3bb49 | /src/org/greatfree/framework/player/tcc/slave/StartSlave.java | 034464a1687a31e89ca894e53ade7bec9cccd156 | [] | no_license | 640351963/Wind | 144c0e9e9f3fdf3ee398f9f1a26a3434ca2dfabf | 0493d95a1fa8de2de218e651e8ce16be00b8ba38 | refs/heads/master | 2023-05-03T03:17:06.737980 | 2021-05-22T19:24:41 | 2021-05-22T19:24:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | package org.greatfree.framework.player.tcc.slave;
import java.io.IOException;
import org.greatfree.concurrency.threading.PlayerSystem;
import org.greatfree.concurrency.threading.ThreadConfig;
import org.greatfree.data.ServerConfig;
import org.greatfree.exceptions.RemoteReadException;
import org.greatfree.framework.threading.PrintTask;
import org.greatfree.util.TerminateSignal;
// Created: 09/30/2019, Bing Li
class StartSlave
{
public static void main(String[] args) throws ClassNotFoundException, IOException, RemoteReadException, InterruptedException
{
System.out.println("Player Slave starting up ...");
// PlayerSystem.THREADING().startSlave(ThreadConfig.SLAVE, ThreadConfig.THREAD_PORT, ThreadConfig.MASTER);
PlayerSystem.THREADING().startSlave(ThreadConfig.SLAVE, ThreadConfig.THREAD_PORT);
System.out.println("Player Slave started ...");
PlayerSystem.THREADING().addTask(new PrintTask());
while (!TerminateSignal.SIGNAL().isTerminated())
{
try
{
// If the terminating flag is false, it is required to sleep for some time. Otherwise, it might cause the high CPU usage. 08/22/2014, Bing Li
Thread.sleep(ServerConfig.TERMINATE_SLEEP);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
d6490c48453192f01f14296e5867ce3caebd2902 | ee7a5b6ab1c48d2727cd733e0d2b5bc2e431a92b | /src/main/java/com/yiyi/JsonObject.java | 82000bdf2228551a99d2a683ba8189d034d85fca | [] | no_license | jialiu123/yiyi-json | 0ea8ddc3838b0e1f2a81f144a7f2495e0481fbb0 | d86311b21174568b484b0cfc287256dbb44341bb | refs/heads/master | 2023-04-01T12:34:04.338669 | 2020-07-15T09:46:15 | 2020-07-15T09:46:15 | 279,233,656 | 0 | 0 | null | 2020-10-13T23:32:49 | 2020-07-13T06:51:04 | Java | UTF-8 | Java | false | false | 872 | java | package com.yiyi;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @author :liujia
* @date :Created in 2020/6/8 10:39
* @version: 1.0
*/
public class JsonObject extends AbstractJson {
private final Map<String, Object> map;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public JsonObject() {
this(DEFAULT_INITIAL_CAPACITY, false);
}
public JsonObject(Map<String, Object> map) {
if (map == null) {
throw new IllegalArgumentException("map is null.");
}
this.map = map;
}
public JsonObject(int defaultInitialCapacity, boolean order) {
if (order) {
map = new LinkedHashMap<String, Object>(defaultInitialCapacity);
} else {
map = new HashMap<String, Object>(defaultInitialCapacity);
}
}
}
| [
"[email protected]"
] | |
ab147a6a0046b03b5c5174f7da5e36b0bd092504 | 4d87bdbe8cc583f1ab10b593e6ef194ba38a7230 | /app/src/main/java/com/example/huaif/myfiletransfer/ShowFilesActivity.java | 3c40f377cdb1e90b84aa110578649422370ba6cd | [] | no_license | justinzhf/Android-File-Transfer | 2a0acc98e062ab36684d8f98b1490ef154cbf9a9 | 068a397095886342bc17b8db72e425b0c960543a | refs/heads/master | 2021-06-02T15:09:10.802187 | 2018-02-05T06:44:30 | 2018-02-05T06:44:30 | 59,103,297 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,852 | java | package com.example.huaif.myfiletransfer;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Looper;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by huaif on 2016/4/15.
*/
public class ShowFilesActivity extends Activity {
private ListView listView;
private ArrayList<String> fileNames;
private ProgressDialog pd;
private ProgressDialog pds;
private Looper mainLooper;
private EHandler mainHandler;
private String selectedFile;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_showfiles);
listView=(ListView)findViewById(R.id.lv_showfiles);
Intent intent=getIntent();
fileNames=intent.getStringArrayListExtra("fileNames");
pd=new ProgressDialog(this);
pds=new ProgressDialog(this);
mainLooper = Looper.getMainLooper();
mainHandler = new EHandler(mainLooper);
listView.setAdapter(new MyAdapter());
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectedFile=fileNames.get(position);
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setTitle("正在下载");
final CSDownload csDownload=new CSDownload(mainHandler,pd,pds,getApplicationContext());
Thread thread=new Thread(){
@Override
public void run() {
csDownload.startDownload(selectedFile);
}
};
pd.show();
thread.start();
}
});
}
private class MyAdapter extends BaseAdapter {
@Override
public int getCount() {
return fileNames.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView tv = new TextView(getApplicationContext());
String fileName = fileNames.get(position).split("/")[5];
tv.setTextSize(25);
tv.setTextColor(Color.BLACK);
tv.setText(fileName);
return tv;
}
}
}
| [
"[email protected]"
] | |
a2b9f689933d534e62258d1d79b4e8ea90f04cd9 | 2e750e3f76e2ee65229d3cb54a58b4f4f34f808c | /panz-commons/src/main/java/com/pwz/util/FileUtil.java | dbebae492eb7d93860cddf61a8d8df673033cee4 | [] | no_license | panwenzhuo2016/panz | 2948a197b61d2d2d15ea66e271acb0dcdc0a1283 | 42161490fece0d9ce9f576f87d0c60a82efa3fbc | refs/heads/master | 2021-05-12T01:48:08.974187 | 2018-12-02T12:51:31 | 2018-12-02T12:51:31 | 117,569,097 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,562 | java | package com.pwz.util;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* 类说明:
*
* @Author panwenzhuo
* @Date created in 2018/8/17 22:40
**/
public class FileUtil {
public static final String MAVEN_PATH = "src" + File.separator + "main" + File.separator + "java";
public static final String TABLE = "table";
public static String getThisFilePath(Class c) {
return getBasePath(c) + File.separator + MAVEN_PATH + File.separator + packageName2Path(c.getPackage().getName() + File.separator);
}
public static String getTableFile(Class c) {
File[] allFiles = getAllFiles(c);
for (File file : allFiles) {
if (TABLE.equals(getFileType(file))) {
return getThisFilePath(c) + file.getName();
}
}
return "";
}
public static String[] getTableFileContent(Class c) {
return getFileContent(getTableFile(c));
}
public static File[] getAllFiles(Class c) {
File file = new File(getThisFilePath(c));
File[] tempList = file.listFiles();
return tempList;
}
public static String getFileType(File file) {
String type = file.getName().substring(file.getName().indexOf(".") + 1);
return type;
}
public static String getBasePath(Class c) {
String classpath = c.getClass().getResource("/").getPath();
if (classpath.contains("/")) {
classpath = classpath.replace("/", File.separator);
}
if (classpath.contains("target")) {
return classpath.substring(0, classpath.indexOf("target"));
}
return classpath;
}
public static String packageName2Path(String packageName) {
return packageName.replace(".", File.separator);
}
public static String[] getFileContent(String path) {
StringBuffer sb = new StringBuffer("");
try {
// read file content from file
FileReader reader = new FileReader(path);
BufferedReader br = new BufferedReader(reader);
String str = null;
while ((str = br.readLine()) != null) {
sb.append(str + "\r\n");
}
br.close();
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
String[] split = sb.toString().split("\r\n");
return split;
}
/**
* 获取路径下的所有文件/文件夹
*
* @param directoryPath 需要遍历的文件夹路径
* @param isAddDirectory 是否将子文件夹的路径也添加到list集合中
* @return
*/
public static List<String> getAllFile(String directoryPath, boolean isAddDirectory, boolean nameorpathname) {
List<String> list = new ArrayList<String>();
File baseFile = new File(directoryPath);
if (baseFile.isFile() || !baseFile.exists()) {
return list;
}
File[] files = baseFile.listFiles();
for (File file : files) {
if (file.isDirectory()) {
if (isAddDirectory) {
list.add(nameorpathname ? file.getName() : file.getAbsolutePath());
}
list.addAll(getAllFile(file.getAbsolutePath(), isAddDirectory, nameorpathname));
} else {
list.add(nameorpathname ? file.getName() : file.getAbsolutePath());
}
}
return list;
}
}
| [
"[email protected]"
] | |
c83e8d59abf8d9b8301606e1092975c30fbbbcb4 | 5ad358dab7db7317ca5bafafd7f5ce970bb902f6 | /src/main/java/com/cbd/weixin/controller/WeixinController.java | c03b9160e7f950f60847458525c15f580192e7ad | [] | no_license | zxj1314/weixin-shop | 1893aedddb00453e7319b3708d21b3ab2ba04381 | 869b7e68fe792ac90a17cda285301b02f76a55e5 | refs/heads/master | 2021-09-10T12:15:28.852985 | 2018-03-26T05:38:28 | 2018-03-26T05:38:28 | 126,114,970 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,910 | java | package com.cbd.weixin.controller;
import com.cbd.weixin.config.weixin.WeixinConfigure;
import com.cbd.weixin.domain.Client;
import com.cbd.weixin.domain.TextMessage;
import com.cbd.weixin.domain.XmlMessageEntity;
import com.cbd.weixin.service.IClientService;
import com.cbd.weixin.utils.HttpUtil;
import com.cbd.weixin.utils.SecurityUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
/**
* @ClassName
* @Description 微信的事件,如关注,自动回复
* @author zhuxiaojin
* @Date 2018-03-19
*/
@Controller
public class WeixinController {
@Autowired
private IClientService clientService;
@Autowired
private WeixinConfigure config;
//get验证
@RequestMapping(value = "/weixin", method = RequestMethod.GET)
@ResponseBody
public String checkSignature(String signature, String timestamp, String nonce, String echostr) {
//微信加密签名
System.out.println(signature);
//时间戳
System.out.println(timestamp);
//随机数
System.out.println(nonce);
//随机字符串
System.out.println(echostr);
//加密/校验流程如下:
String[] arr = { config.getToken(), timestamp, nonce };
//1)将token、timestamp、nonce三个参数进行字典序排序
Arrays.sort(arr);
String str = "";
//2)将三个参数字符串拼接成一个字符串进行sha1加密
for (String temp : arr) {
str += temp;
}
//3)开发者获得加密后的字符串可与signature对比,标识该请求来源于微信
if (signature.equals(SecurityUtil.SHA1(str))) {
System.out.println("接入成功!");
return echostr;
}
System.out.println("接入失败!");
return null;
}
//post消息处理
@RequestMapping(value = "/weixin", method = RequestMethod.POST)
@ResponseBody
public String handlerMessage(@RequestBody XmlMessageEntity entity) throws Exception{
System.out.println(entity.getMsgType()+entity.getContent());
//要发送的对象
XmlMessageEntity newEntity = new XmlMessageEntity();
//设置发送方
newEntity.setFromUserName(entity.getToUserName());
//设置接收方
newEntity.setToUserName(entity.getFromUserName());
//设置发送时间
newEntity.setCreateTime(new Date().getTime()+"");
//=================================
//要发送的对象
TextMessage text=null;
//关注事件(点击关注事件相关的业务/取消关注相关的业务)
if ("event".equals(entity.getMsgType())) {
//如果是关注事件
if ("subscribe".equals(entity.getEvent())) {
//获取用户信息
String result = HttpUtil.get(config.getUserinfoUrl().replace("ACCESS_TOKEN",
config.getWeb_accesstoken_url()).replace("OPENID", entity.getFromUserName()));
//转成json对象
JSONObject json = JSON.parseObject(result);
String openid = json.getString("openid");
String nickname = json.getString("nickname");
Client client = new Client();
//查询数据库中是否已经存在该用户
Long id = clientService.getClientId(openid);
if (clientService.getClientId(openid) != null) {
//客户已经存在数据库中,只需要修改客户的状态和关注时间,和客户的昵称
client.setStatus("关注");//设置关注状态
client.setConcernTime(new Date());//重新设置关注时间
client.setCancelTime(null);//设置取消关注时间为null
client.setId(id);
//修改信息
clientService.update(client);
} else {
//数据库中不存在该客户,需要新增该客户
client.setConcernTime(new Date());//设置关注时间
client.setStatus("关注");//设置关注状态
client.setOpenID(openid);//设置用户的openid
client.setCancelTime(null);//设置取消关注时间为null
client.setNickname(nickname);//设置昵称
clientService.insert(client);
}
//发送内容
newEntity.setContent("来啦,亮仔!");
} else if ("unsubscribe".equals(entity.getEvent())) {
System.out.println("================");
String fromUserName = entity.getFromUserName();//获取要取消的关注的客户的账号
//去数据库中查询该客户id,后修改取消关注的客户的关注状态
Long id = clientService.getClientId(fromUserName);
//取消关注事件
Client client = new Client();
client.setId(id);
client.setStatus("取消关注");//设置关注状态
client.setConcernTime(null);//设置关注时间为null
client.setCancelTime(new Date());//设置取消时间
clientService.update(client);
}
newEntity.setMsgType("text");
return " ";
}
if(entity.getMsgType()!=null && "推荐".equals(entity.getContent())){
/*text=new TextMessage();
text.setContent("澳门首家皇家线上赌场开业啦!");
text.setToUserName(entity.getToUserName());
text.setFromUserName(entity.getFromUserName());
text.setCreateTime(new Date().getTime());
text.setMsgType("text");
String respMessage = MessageUtil.textMessageToXml(text);*/
//System.out.println("=============accessToken:"+WeixinUtil.getAccessToken());
newEntity.setMsgType("text");
newEntity.setContent("上传成功");
return newEntity.toString();
}
//发送类型
return " ";
}
//用于测试
@ResponseBody()
@RequestMapping(value = "/123" ,method = RequestMethod.POST)
public String Reply2(HttpServletRequest request) throws IOException {
return config.getToken();
}
}
| [
"[email protected]"
] | |
93c9f38614dd5fd8cdc7d5f1be5860e01fc502a0 | dccad3e1179aa8a55c155cce67603150552eaa32 | /commonlibrary/src/main/java/com/yundao/ydwms/common/avoidonresult/ActivityResultInfo.java | bfec1da2afb3a7e98d7aca6ecdc32caa3d3d2ac7 | [] | no_license | FengBiao888/YDWMS | 0835178b8dbe45f183fb0cc1ff938a389a38d632 | 17fe97eec78c0faadab859186b893d8bcbecf4b6 | refs/heads/master | 2022-11-19T21:24:55.585201 | 2020-07-23T09:24:53 | 2020-07-23T09:24:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package com.yundao.ydwms.common.avoidonresult;
import android.content.Intent;
/**
* Created by jack on 2017/12/27.
* modify by https://guofeng007.github.io remove request code ,instead use callback.hashcode as requestcode 2017/1/10
*/
public class ActivityResultInfo {
private int resultCode;
private Intent data;
public ActivityResultInfo(int resultCode, Intent data) {
this.resultCode = resultCode;
this.data = data;
}
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
public Intent getData() {
return data;
}
public void setData(Intent data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
e4fc2bc6b66c3252277a6a5bd07f363bd99e833e | 0e06e096a9f95ab094b8078ea2cd310759af008b | /classes22-dex2jar/com/vungle/warren/tasks/VungleJobCreator.java | 8346136b8e121931694c76e6a51c055995d578a7 | [] | no_license | Manifold0/adcom_decompile | 4bc2907a057c73703cf141dc0749ed4c014ebe55 | fce3d59b59480abe91f90ba05b0df4eaadd849f7 | refs/heads/master | 2020-05-21T02:01:59.787840 | 2019-05-10T00:36:27 | 2019-05-10T00:36:27 | 185,856,424 | 1 | 2 | null | 2019-05-10T00:36:28 | 2019-05-09T19:04:28 | Java | UTF-8 | Java | false | false | 1,330 | java | //
// Decompiled by Procyon v0.5.34
//
package com.vungle.warren.tasks;
import android.text.TextUtils;
import com.vungle.warren.Storage;
import com.vungle.warren.persistence.Designer;
public class VungleJobCreator implements JobCreator
{
private final Designer designer;
private final ReconfigJob.ReconfigCall reconfigCall;
private final Storage storage;
public VungleJobCreator(final Storage storage, final Designer designer, final ReconfigJob.ReconfigCall reconfigCall) {
this.storage = storage;
this.designer = designer;
this.reconfigCall = reconfigCall;
}
@Override
public Job create(final String s) {
if (TextUtils.isEmpty((CharSequence)s)) {
throw new IllegalArgumentException("Job tag is not specified");
}
if (s.startsWith(ReconfigJob.TAG)) {
return new ReconfigJob(this.reconfigCall);
}
if (s.startsWith(DownloadJob.TAG)) {
return new DownloadJob(this.storage);
}
if (s.startsWith(SendReportsJob.TAG)) {
return new SendReportsJob(this.storage);
}
if (s.startsWith(CleanupJob.TAG)) {
return new CleanupJob(this.designer, this.storage);
}
throw new IllegalArgumentException("Unknown Job Type " + s);
}
}
| [
"[email protected]"
] | |
6c2220727b65358247011b21027ceb738e982ee3 | 62e6c3e3fd850fa09cde0a549ddab682a27221b0 | /android/src/game/CUnits.java | 6967860303bf6ce9b5348d716ea0c34dbcd6eb20 | [
"MIT"
] | permissive | mrhampson/FortNitta | 45985cdc70c23b7c0edc185cf485f7d9f5ade822 | cef38b8eb481a0756779a541223718a65b967d12 | refs/heads/master | 2020-06-30T04:42:49.641720 | 2015-03-17T02:58:27 | 2015-03-17T02:58:27 | 32,367,090 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,238 | java | package game;
import com.badlogic.gdx.math.Vector2;
import java.util.LinkedList;
import game.utils.CMathUtil;
public class CUnits {
public final void Reset() {
DShip.clear();
DSiegeWeapons.clear();
}
public final void Draw2DShip(CGame game) {
//std::cout<<"Ship Size: " << DShip.size() << std::endl;
for (CShip ship : DShip) {
ship.Draw2D(game);
}
}
public final void Draw3DShip(CGame game, Vector2 position) {
//std::cout<<"Ship Size: " << DShip.size() << std::endl;
for (CShip ship : DShip) {
if (position.equals(new Vector2((int)ship.DPosition.x, (int)ship.DPosition.y))) {
ship.Draw3D(game);
}
}
}
public final void Draw2DSiege(CGame game) {
//std::cout<<"Ship Size: " << DShip.size() << std::endl;
for (CSiegeWeapons siegeWeapon : DSiegeWeapons) {
siegeWeapon.Draw2D(game);
}
}
public final void Draw3DSiege(CGame game, int XPos, int YPos) {
//std::cout<<"Ship Size: " << DShip.size() << std::endl;
for (CSiegeWeapons siegeWeapon : DSiegeWeapons) {
if (new Vector2((int)siegeWeapon.DPosition.x, (int)siegeWeapon.DPosition.y).equals(new Vector2(XPos, YPos))) {
siegeWeapon.Draw3D(game);
}
}
}
public final boolean IsSpaceFreeOfShip(Vector2 position, Vector2 size) {
for (CShip ship : DShip) {
if (CMathUtil.DoRectanglesOverlap(ship.DPosition, ship.CShipSize, position, size)) {
return false;
}
}
return true;
}
public final boolean IsSpaceFreeOfSiege(CGame game, Vector2 position, Vector2 size) {
for (CSiegeWeapons siegeWeapon : DSiegeWeapons) {
if (CMathUtil.DoRectanglesOverlap(siegeWeapon.DPosition, siegeWeapon.CSiegeWeaponSize, position, size)) {
return false;
}
CTerrainMap TerrainMap = game.GameState().TerrainMap();
float XPos = siegeWeapon.DPosition.x;
float YPos = siegeWeapon.DPosition.y;
boolean IsBetweenXTiles = 0 != XPos - (int) XPos && TerrainMap.Width() - 2 >= XPos;
boolean IsBetweenYTiles = 0 != YPos - (int) YPos && TerrainMap.Height() - 2 >= YPos;
if (IsBetweenXTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos + 1f, YPos), siegeWeapon.CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return false;
}
}
if (IsBetweenYTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos, YPos + 1), siegeWeapon.CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return false;
}
}
if (IsBetweenXTiles && IsBetweenYTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos + 1, YPos + 1), siegeWeapon.CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return false;
}
}
}
return true;
}
public final void DestroyShip(CShip ship) {
boolean Advance = true;
for (int i = DShip.size() - 1; i >= 0 && Advance; i--) {
CShip currShip = DShip.get(i);
if (currShip == ship) {
DShip.remove(i);
Advance = false;
}
}
}
public final void DestroySiege(CSiegeWeapons siege) {
boolean Advance = true;
for (int i = DSiegeWeapons.size() - 1; i >= 0 && Advance; i--) {
CSiegeWeapons currSiegeWeapon = DSiegeWeapons.get(i);
if (currSiegeWeapon == siege) {
DSiegeWeapons.remove(i);
Advance = false;
}
}
}
public final CShip GetShipAt(Vector2 position) {
Vector2 size = new Vector2(CShip.CShipSize);
for (CShip ship : DShip) {
if (CMathUtil.DoRectanglesOverlap(ship.DPosition, ship.CShipSize, position, size)) {
return ship;
}
}
return null;
}
public final CSiegeWeapons GetSiegeAt(CGame game, Vector2 position) {
Vector2 size = new Vector2(CSiegeWeapons.CSiegeWeaponSize);
for (CSiegeWeapons siegeWeapon : DSiegeWeapons) {
if (CMathUtil.DoRectanglesOverlap(siegeWeapon.DPosition, siegeWeapon.CSiegeWeaponSize, position, size)) {
return siegeWeapon;
}
CTerrainMap TerrainMap = game.GameState().TerrainMap();
float XPos = (siegeWeapon).DPosition.x;
float YPos = (siegeWeapon).DPosition.y;
boolean IsBetweenXTiles = 0 != XPos - (int) XPos && TerrainMap.Width() - 2 >= XPos;
boolean IsBetweenYTiles = 0 != YPos - (int) YPos && TerrainMap.Height() - 2 >= YPos;
if (IsBetweenXTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos + 1, YPos), (siegeWeapon).CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return siegeWeapon;
}
}
if (IsBetweenYTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos, YPos + 1), (siegeWeapon).CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return siegeWeapon;
}
}
if (IsBetweenXTiles && IsBetweenYTiles) {
if (CMathUtil.DoRectanglesOverlap(new Vector2(XPos + 1, YPos + 1), (siegeWeapon).CSiegeWeaponSize, new Vector2(position), new Vector2(size))) {
return siegeWeapon;
}
}
}
return null;
}
public final LinkedList<CShip> Ship() {
return DShip;
}
public final LinkedList<CSiegeWeapons> SiegeWeapons() {
return DSiegeWeapons;
}
public final LinkedList<CSiegeWeapons> MovingSiege() {
return DMovingSiege;
}
public LinkedList<CShip> DShip = new LinkedList<CShip>();
public LinkedList<CSiegeWeapons> DSiegeWeapons = new LinkedList<CSiegeWeapons>();
public LinkedList<CSiegeWeapons> DMovingSiege = new LinkedList<CSiegeWeapons>();
} | [
"[email protected]"
] | |
91edd2a2b003d3e9f5f55d9fdafab4b7f8814481 | c4802c887d2ece27a2ee99675163f5dff774d3ae | /MÓDULO 1 PROGRAMACIÓN BÁSICA EN JAVA/Unidad 11 - 12 - 13 - 14 - proyecto final/Proyecto final/Código/src/View/Alumno/ViewAlumno.java | b3ae4709194197d6b00aaeb4794e827e3e699909 | [] | no_license | YorchXD/Curso-de-Desarrollo-de-aplicaciones-moviles-Android-Trainee | 83238d2938dd9877cb150fd12f8b0af92bb7a485 | d2f79c2fad5f3b3251c8ecccbf196707ca570e37 | refs/heads/master | 2023-07-28T04:10:05.138527 | 2021-09-11T12:55:35 | 2021-09-11T12:55:35 | 362,313,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,037 | java | package View.Alumno;
import Utilidades.Utilidades;
import Controller.AlumnoController;
import Model.Alumno;
public class ViewAlumno
{
public static String solicitarNombre()
{
String nombre;
System.out.print("Ingrese el nombre del alumno: ");
nombre = Utilidades.extracted().nextLine();
return nombre;
}
public static String solicitarRun(String rol)
{
String run;
boolean validar;
do
{
System.out.print("Ingrese el run del " + rol + ", formato (XX.XXX.XXX-X): ");
run = Utilidades.extracted().nextLine();
validar = Utilidades.validarRun(run);
if (!validar)
{
System.out.println("Debe ingresar un run valido. Favor de ingresar nuevamente.\n");
}
}
while (!validar);
run = run.replace(".", "");
run = Utilidades.formatearRun(run);
return run;
}
public static int solicitarEdad()
{
int edad = 0;
do
{
try
{
System.out.print("Ingrese la edad del alumno: ");
edad = Utilidades.extracted().nextInt();
}
catch (Exception e)
{
System.out.print("Debe ingresar un numero, ");
}
}
while (edad == 0);
return edad;
}
public static boolean solicitarRespuesta()
{
String mensaje = "NO";
boolean respuesta = false;
do
{
System.out.print("Desea modificar al alumno (SI o NO): ");
mensaje = Utilidades.extracted().nextLine().toUpperCase();
}
while (!mensaje.equals("SI") && !mensaje.equals("NO"));
if (mensaje.equals("SI"))
respuesta = true;
return respuesta;
}
public static void crear()
{
System.out.println("\n********************************************************");
System.out.println("* Crear alumno *");
System.out.println("********************************************************\n");
Alumno alumno = null;
int edad;
String nombre, run;
String mensaje = "";
run = solicitarRun("Alumno");
alumno = AlumnoController.buscarAlumno(run);
if (alumno == null)
{
nombre = solicitarNombre();
edad = solicitarEdad();
mensaje = AlumnoController.registrarAlumno(nombre, run, edad);
System.out.println("\n********************************************************");
System.out.println(mensaje);
System.out.println("********************************************************\n");
}
else
{
System.out.println("\n********************************************************");
System.out.println("* El alumno ya se encuentra registrado *");
System.out.println("********************************************************\n");
}
}
public static void ver()
{
Alumno alumno = null;
String run;
run = solicitarRun("Alumno");
alumno = AlumnoController.buscarAlumno(run);
if (alumno != null)
{
System.out.println("\n********************************************************");
System.out.println("* Datos del alumno *");
System.out.println("********************************************************\n");
System.out.println(alumno.mostrarDatos());
System.out.println("********************************************************\n");
}
else
{
System.out.println("\n********************************************************");
System.out.println("* El alumno no se encuentra registrado *");
System.out.println("********************************************************\n");
}
}
public static void modificar()
{
System.out.println("\n********************************************************");
System.out.println("* Modificar alumno *");
System.out.println("********************************************************\n");
Alumno alumno = null;
String run;
Boolean confirmacion = false;
run = solicitarRun("Alumno");
alumno = AlumnoController.buscarAlumno(run);
if (alumno != null)
{
System.out.println("\n********************************************************");
System.out.println("* Datos del alumno *");
System.out.println("********************************************************\n");
System.out.println(alumno.mostrarDatos());
System.out.println("********************************************************\n");
confirmacion = solicitarRespuesta();
if (confirmacion)
{
alumno.setNombre(solicitarNombre());
alumno.setEdad(solicitarEdad());
System.out.println("\n********************************************************");
System.out.println(AlumnoController.actualizarAlumno(alumno));
System.out.println("********************************************************\n");
}
}
else
{
System.out.println("\n********************************************************");
System.out.println("* El alumno no se encuentra registrado *");
System.out.println("********************************************************\n");
}
}
public static void cambiarEstado()
{
System.out.println("\n********************************************************");
System.out.println("* Habilitar o Deshabilitar un Alumno *");
System.out.println("********************************************************\n");
Alumno alumno = null;
String run, mensaje = "";
Boolean confirmacion = false;
run = solicitarRun("Alumno");
alumno = AlumnoController.buscarAlumno(run);
if (alumno != null)
{
System.out.println("\n********************************************************");
System.out.println("* Datos del alumno *");
System.out.println("********************************************************\n");
System.out.println(alumno.mostrarDatos());
System.out.println("********************************************************\n");
confirmacion = solicitarRespuesta();
if (confirmacion)
{
mensaje = AlumnoController.modificarEstadoAlumno(alumno);
System.out.println("\n********************************************************");
System.out.println(mensaje);
System.out.println("********************************************************\n");
}
}
else
{
System.out.println("\n********************************************************");
System.out.println("* El alumno no se encuentra registrado *");
System.out.println("********************************************************\n");
}
}
public static void asociarApoderado()
{
System.out.println("\n********************************************************");
System.out.println("* Asociar apoderado a un alumno *");
System.out.println("********************************************************\n");
String runAlumno = solicitarRun("Alumno");
String runApoderado = solicitarRun("Apoderado");
System.out.println("\n********************************************************");
System.out.println(AlumnoController.asociarApoderadoAlumno(runAlumno, runApoderado));
System.out.println("********************************************************\n");
}
}
| [
"[email protected]"
] | |
6b5ba599adab4c88c7e7cd6146b84e8a215cef9c | 261c917f328df69ec4c789070d4212fdb16a81b6 | /src/main/java/com/kite/intellij/backend/json/deserializer/SymbolReportResponseDeserializer.java | 3319a54cd3a1556b22553e421da461ef13b0424f | [
"BSD-3-Clause"
] | permissive | aikozijlemans/intellij-plugin | d6383c10b97cc98e63c5232a11c5c898739a1e0b | dc1361bb3da33f4cc2e2b7ea8aeb9fa4c3b6e0ab | refs/heads/main | 2023-09-05T04:57:54.513160 | 2021-11-23T19:48:46 | 2021-11-23T19:50:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package com.kite.intellij.backend.json.deserializer;
import com.google.gson.*;
import com.kite.intellij.backend.model.Report;
import com.kite.intellij.backend.model.SymbolExt;
import com.kite.intellij.backend.response.SymbolReportResponse;
import java.lang.reflect.Type;
public class SymbolReportResponseDeserializer implements JsonDeserializer<SymbolReportResponse> {
@Override
public SymbolReportResponse deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
JsonObject json = jsonElement.getAsJsonObject();
SymbolExt symbol = context.deserialize(json.get("symbol"), SymbolExt.class);
Report report = context.deserialize(json.get("report"), Report.class);
return new SymbolReportResponse(symbol, report);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.