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
690db6b428a69a33b0d9ddf6a39c09b28d91c457
a04c05522de846cb151f0787eef8aa4b0a85cebb
/cablePortal/src/com/cablevision/vo/CvUsuarioPortal.java
1b8c474270924fff00f1232c01d8940bea639a5d
[]
no_license
Diana23/Portal-Web
859fb5577d6c8d0c2ca3358d4dbbd56576eb9fd7
57a61aa5f40b6fc8e234b06cc6b76657aabbdb1a
refs/heads/master
2016-09-16T09:58:17.363856
2011-12-05T19:40:47
2011-12-05T19:40:47
1,455,679
1
0
null
null
null
null
UTF-8
Java
false
false
3,212
java
package com.cablevision.vo; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; /** * The persistent class for the CV_USUARIO_PORTAL database table. * * @author BEA Workshop */ public class CvUsuarioPortal implements Serializable { //default serial version id, required for serializable classes. private static final long serialVersionUID = 1L; private String cupIdusuario; private String cupContrato; private java.sql.Timestamp cupFechaUltimaContrasena; private java.sql.Timestamp cupFechaUltimoIntentoLogin; private Integer cupIntentos; private String cupSessionId; private String cupFoto; private java.util.Set<CvContrasenaHistorial> cvContrasenaHistorials; public CvUsuarioPortal() { } public String getCupIdusuario() { return this.cupIdusuario; } public void setCupIdusuario(String cupIdusuario) { this.cupIdusuario = cupIdusuario; } public String getCupContrato() { return this.cupContrato; } public void setCupContrato(String cupContrato) { this.cupContrato = cupContrato; } public java.sql.Timestamp getCupFechaUltimaContrasena() { return this.cupFechaUltimaContrasena; } public void setCupFechaUltimaContrasena(java.sql.Timestamp cupFechaUltimaContrasena) { this.cupFechaUltimaContrasena = cupFechaUltimaContrasena; } public java.sql.Timestamp getCupFechaUltimoIntentoLogin() { return this.cupFechaUltimoIntentoLogin; } public void setCupFechaUltimoIntentoLogin(java.sql.Timestamp cupFechaUltimoIntentoLogin) { this.cupFechaUltimoIntentoLogin = cupFechaUltimoIntentoLogin; } public Integer getCupIntentos() { return this.cupIntentos; } public void setCupIntentos(Integer cupIntentos) { this.cupIntentos = cupIntentos; } public String getCupSessionId() { return cupSessionId; } public void setCupSessionId(String cupSessionId) { this.cupSessionId = cupSessionId; } //bi-directional many-to-one association to CvContrasenaHistorial public String getCupFoto() { return cupFoto; } public void setCupFoto(String cupFoto) { this.cupFoto = cupFoto; } public java.util.Set<CvContrasenaHistorial> getCvContrasenaHistorials() { return this.cvContrasenaHistorials; } public void setCvContrasenaHistorials(java.util.Set<CvContrasenaHistorial> cvContrasenaHistorials) { this.cvContrasenaHistorials = cvContrasenaHistorials; } public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof CvUsuarioPortal)) { return false; } CvUsuarioPortal castOther = (CvUsuarioPortal)other; return new EqualsBuilder() .append(this.getCupIdusuario(), castOther.getCupIdusuario()) .isEquals(); } public int hashCode() { return new HashCodeBuilder() .append(getCupIdusuario()) .toHashCode(); } public String toString() { return new ToStringBuilder(this) .append("cupIdusuario", getCupIdusuario()) .toString(); } }
e74e57d9b232aeb8e95f3c3774ed843d4d73f3ab
2b9c526c076585a8e83dc9f585e4bd55655f3193
/이것이 자바다 07장/src/sec08/exam01_abstract_class_call/SmartPhone.java
4ae7d1d9e55d5c19fc9ea2978a88bffc9407d0b9
[]
no_license
jacksuhkr/this_is_java
42d6d659c1aed67ee444bfc1ca9a733501f7ac4d
4ac8acea946b8a786dbf71e745775fc32d85970f
refs/heads/master
2020-12-01T18:19:18.074247
2016-08-20T13:48:35
2016-08-20T13:48:35
66,146,889
0
0
null
null
null
null
UHC
Java
false
false
271
java
package sec08.exam01_abstract_class_call; public class SmartPhone extends Phone { //생성자 public SmartPhone(String owner) { super(owner); } //메소드 public void internetSearch() { System.out.println("인터넷 검색을 합니다."); } }
5ec228112a9cd1d65f2744f41fe715fa2400eed2
23a56004c7c2c7e72942a24e6eb6ece2b2a1aa48
/FSComClient/src/windows/forms/form_abstract.java
835a0d785ca56a07e5dfa9993840e218f01ab318
[]
no_license
nerzhul/FSCom_JavaTut
e4e999f6669e8a238421504c52ecd41509280f28
72ab08f4f0e3a7ba321ec27df6c81d636825e08e
refs/heads/master
2020-04-28T20:28:17.717553
2010-03-11T01:08:07
2010-03-11T01:08:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package windows.forms; import javax.swing.JFrame; public abstract class form_abstract extends JFrame{ /** * */ protected static final long serialVersionUID = 1L; protected abstract void BuildWindow(); protected abstract void BuildMenuBar(); protected abstract void BuildFrame(); }
fd44af5a5824f3ec03d56b94d107a7dfd95c97b2
d1b917df8ea6f3b12e7a8283950ab2e57fb6cd96
/src/com/dborisenko/math/optimization/problems/generators/utils/IntegerGeneratorParamAdapter.java
5cfba5507f9007bf85e2e286bc13bb6aa1109ae3
[]
no_license
wannasmile/ilp-optimization-lib
2a8236d7c185022e5048bbc5df6e235137d46a99
dc42b3a9ce561efad0d9a929f8e6227b66ebf578
refs/heads/master
2021-05-04T17:45:36.292768
2011-07-05T15:45:21
2011-07-05T15:45:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.dborisenko.math.optimization.problems.generators.utils; import com.dborisenko.math.optimization.problems.generators.params.GeneratorParameter; import com.dborisenko.math.vo.RangeVO; import java.util.ArrayList; import java.util.Collection; import java.util.List; import net.sourceforge.jeval.EvaluationException; /** * * @author Denis */ public class IntegerGeneratorParamAdapter extends GeneratorParamAdapter<Integer> { public IntegerGeneratorParamAdapter(GeneratorParameter<Integer> param) { super(param); } @Override protected Collection<Integer> createValuesFromRange(RangeVO<Integer> range) { List<Integer> result = new ArrayList<Integer>(); int coeff = (range.getStopValue() >= range.getStartValue() ? 1 : -1); for (Integer i = range.getStartValue(); coeff * i <= coeff * range.getStopValue(); i += range.getStep()) { result.add(i); } return result; } @Override protected Integer evaluateValue(String evalValue, Collection<EvalVariableVO> variables) throws EvaluationException, IllegalArgumentException { String result = evaluate(evalValue, variables); return Math.round(Float.parseFloat(result)); } }
0d37950c39f4a2f6ddb03c2f6284c539cefd00c5
df1e79f12a5da1d7639f0705b8cdb7626fc571f3
/Test_JPA/src/main/java/com/test/repository/OrderRepository.java
96490786bc502a6b645bbdccd7ad33155b9ce218
[]
no_license
mafeorj/prueba1
720ba0d0506df1a1250841f883648a7f0fd4e4c3
811f852f83e69d38f535e5d6523652ae2d8d2e41
refs/heads/master
2021-01-20T16:10:34.434216
2017-05-10T06:09:22
2017-05-10T06:09:22
90,822,585
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.test.repository; import org.springframework.data.repository.PagingAndSortingRepository; import com.test.entity.Order; public interface OrderRepository extends PagingAndSortingRepository<Order, Long>{ }
47a49e9792a3231352b0687eafd352a643c4095a
badf34524b3a82fbd503a6acf9280c1bcbaba404
/src/main/java/behavior/chain_of_responsibility/HR.java
aa1d371521d7832ca9a856b587fc59c10e5b2c7b
[]
no_license
Robert-JQ/design-pattern
3907d80c23ffa60e72f2f0d978e20c584935d600
0e0a305adc46e0a63a2a7615190c90b1e6726772
refs/heads/master
2023-01-08T22:46:55.079824
2020-10-29T08:30:17
2020-10-29T08:30:17
268,410,764
0
0
null
null
null
null
UTF-8
Java
false
false
773
java
package behavior.chain_of_responsibility; public class HR implements ApproveHandler { private ApproveHandler nextHandler; private static final int MAX_LEAVES_CAN_APPROVE = 30; @Override public void setNextHandler(ApproveHandler nextHandler) { this.nextHandler = nextHandler; } @Override public void approve(Leave leave) { if (leave.getNumberOfDays() < MAX_LEAVES_CAN_APPROVE) { String output = String.format("LeaveId:%d,Days:%d,Approver:%s", leave.getLeaveId(), leave.getNumberOfDays(), "HR"); System.out.println(output); } else { if (nextHandler != null) { nextHandler.approve(leave); } } } }
823ea6102a73b132f0266198842308266cd47c85
3e5969f8f82b797e6738466336ffb5f0d6e9cca1
/src/main/java/cl/javierchacana/domain/Authority.java
920439321e190a1978c3ebc82dd278befcd82500
[]
no_license
jchacana-jhipster-conference-demo/jhipster-conference-gateway
6da9117d799c9be9b7b8a286a002121a2c947ce3
36f3994bd37de5f4df8ef6d751249d97c39e8cb0
refs/heads/master
2020-03-20T04:12:44.152148
2018-06-12T08:12:40
2018-06-12T08:12:40
137,174,952
0
0
null
null
null
null
UTF-8
Java
false
false
1,454
java
package cl.javierchacana.domain; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Column; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.io.Serializable; /** * An authority (a security role) used by Spring Security. */ @Entity @Table(name = "jhi_authority") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Authority implements Serializable { private static final long serialVersionUID = 1L; @NotNull @Size(max = 50) @Id @Column(length = 50) private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Authority authority = (Authority) o; return !(name != null ? !name.equals(authority.name) : authority.name != null); } @Override public int hashCode() { return name != null ? name.hashCode() : 0; } @Override public String toString() { return "Authority{" + "name='" + name + '\'' + "}"; } }
ca0c3421acd908e5e2fca20939c4cb99df658068
10d714f1c8bdf8655779e263f1748c3c4b368b23
/src/main/java/com/james/springbootoauth2starter/config/Oauth2AuthorizationConfiguration.java
88ad72a7b3822c2fb3e5c2822ce9ed04b9a7f88a
[]
no_license
Jamesxu182/Spring-Boot-Oauth2-Starter
63802f56bb61c013a9f62b798a23872c0eb7a0a6
0ede4e03c3639bf339558ff1e30925406fddce5b
refs/heads/master
2021-07-17T16:43:54.900895
2017-10-26T13:48:01
2017-10-26T13:48:01
107,279,269
1
0
null
null
null
null
UTF-8
Java
false
false
2,833
java
package com.james.springbootoauth2starter.config; import com.james.springbootoauth2starter.enumeration.CustomAuthorityName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter; import org.springframework.security.oauth2.provider.token.store.JwtTokenStore; @Configuration @EnableAuthorizationServer public class Oauth2AuthorizationConfiguration extends AuthorizationServerConfigurerAdapter { @Autowired @Qualifier("authenticationManagerBean") private AuthenticationManager authenticationManager; @Autowired private JwtAccessTokenConverter tokenConverter; @Autowired private JwtTokenStore tokenStore; @Autowired private UserDetailsService userDetailsService; @Bean public JwtAccessTokenConverter tokenConverter() { JwtAccessTokenConverter converter = new JwtAccessTokenConverter(); converter.setSigningKey("secret"); return converter; } @Bean public JwtTokenStore tokenStore() { return new JwtTokenStore(tokenConverter); } @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints .authenticationManager(authenticationManager) .accessTokenConverter(tokenConverter) .tokenStore(tokenStore) .userDetailsService(userDetailsService); } @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients .inMemory().withClient("oauth2-client").secret("secret") .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") .authorities(CustomAuthorityName.ROLE_ADMIN.name(), CustomAuthorityName.ROLE_USER.name()) .scopes("read", "write", "trust") .resourceIds("oauth2-starter") .accessTokenValiditySeconds(60) .refreshTokenValiditySeconds(60); } }
[ "[email protected] config --global user.name jamesxu182git config --global user.email [email protected] config --global user.email [email protected]" ]
[email protected] config --global user.name jamesxu182git config --global user.email [email protected] config --global user.email [email protected]
e8e09f38063ed2853f9e23e99b4342beded61b2f
dbde1a04eed06f35b247ebfebfe538ef1d675f8e
/WorkflowService/src/main/java/org/analytik/workflow/repository/ActivityRepository.java
c9c9c221aad77378d0af3233e7f07db4beb6a67d
[]
no_license
harshitatiwariprojects/Analytik-WorkflowService
7f67daeac298a47b1db327054afca3b6ead41eb4
0b923963dc6f63d9dd31db58f01ba57f2bf8fb65
refs/heads/master
2021-01-05T06:25:18.390144
2020-02-16T15:36:37
2020-02-16T15:36:37
240,914,142
1
0
null
null
null
null
UTF-8
Java
false
false
412
java
package org.analytik.workflow.repository; import org.analytik.workflow.model.Activity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * * @author Harshita Tiwari * Copyright 2020 by Harshita Tiwari. All rights reserved. * */ @Repository public interface ActivityRepository extends JpaRepository<Activity,Integer>{ }
afc8daf8e950e218c14732d21e668a86eeca4368
6768a1f342e31cec26d132375a33f31629999ca0
/src/main/java/com/nielsen/confirmit/webservices/authoring/SssQuantum.java
57ff1226316108bc31f4d9bba63b7d8483d600f2
[]
no_license
BairamNaresh/ci-wf-spring
4362fc514f00f97edf368ffc4fd9627521f3e4b6
91da3eff9c976b682bdedd6cb1965edc3e9d561d
refs/heads/master
2020-09-05T22:37:25.156061
2019-11-20T12:31:32
2019-11-20T12:31:32
220,233,394
0
0
null
null
null
null
UTF-8
Java
false
false
5,469
java
package com.nielsen.confirmit.webservices.authoring; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for SssQuantum complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="SssQuantum"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;attribute name="quantumoptions" type="{http://www.w3.org/2001/XMLSchema}string" /&gt; * &lt;attribute name="maxcardsize" use="required" type="{http://www.w3.org/2001/XMLSchema}int" /&gt; * &lt;attribute name="seriallen" use="required" type="{http://www.w3.org/2001/XMLSchema}int" /&gt; * &lt;attribute name="cardtypelen" use="required" type="{http://www.w3.org/2001/XMLSchema}int" /&gt; * &lt;attribute name="exportsingleprecode" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /&gt; * &lt;attribute name="exportmultipleprecode" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /&gt; * &lt;attribute name="splitmultiplesovercardsborder" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /&gt; * &lt;attribute name="splitcharactersovercardsborder" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SssQuantum") public class SssQuantum { @XmlAttribute(name = "quantumoptions") protected String quantumoptions; @XmlAttribute(name = "maxcardsize", required = true) protected int maxcardsize; @XmlAttribute(name = "seriallen", required = true) protected int seriallen; @XmlAttribute(name = "cardtypelen", required = true) protected int cardtypelen; @XmlAttribute(name = "exportsingleprecode", required = true) protected boolean exportsingleprecode; @XmlAttribute(name = "exportmultipleprecode", required = true) protected boolean exportmultipleprecode; @XmlAttribute(name = "splitmultiplesovercardsborder", required = true) protected boolean splitmultiplesovercardsborder; @XmlAttribute(name = "splitcharactersovercardsborder", required = true) protected boolean splitcharactersovercardsborder; /** * Gets the value of the quantumoptions property. * * @return * possible object is * {@link String } * */ public String getQuantumoptions() { return quantumoptions; } /** * Sets the value of the quantumoptions property. * * @param value * allowed object is * {@link String } * */ public void setQuantumoptions(String value) { this.quantumoptions = value; } /** * Gets the value of the maxcardsize property. * */ public int getMaxcardsize() { return maxcardsize; } /** * Sets the value of the maxcardsize property. * */ public void setMaxcardsize(int value) { this.maxcardsize = value; } /** * Gets the value of the seriallen property. * */ public int getSeriallen() { return seriallen; } /** * Sets the value of the seriallen property. * */ public void setSeriallen(int value) { this.seriallen = value; } /** * Gets the value of the cardtypelen property. * */ public int getCardtypelen() { return cardtypelen; } /** * Sets the value of the cardtypelen property. * */ public void setCardtypelen(int value) { this.cardtypelen = value; } /** * Gets the value of the exportsingleprecode property. * */ public boolean isExportsingleprecode() { return exportsingleprecode; } /** * Sets the value of the exportsingleprecode property. * */ public void setExportsingleprecode(boolean value) { this.exportsingleprecode = value; } /** * Gets the value of the exportmultipleprecode property. * */ public boolean isExportmultipleprecode() { return exportmultipleprecode; } /** * Sets the value of the exportmultipleprecode property. * */ public void setExportmultipleprecode(boolean value) { this.exportmultipleprecode = value; } /** * Gets the value of the splitmultiplesovercardsborder property. * */ public boolean isSplitmultiplesovercardsborder() { return splitmultiplesovercardsborder; } /** * Sets the value of the splitmultiplesovercardsborder property. * */ public void setSplitmultiplesovercardsborder(boolean value) { this.splitmultiplesovercardsborder = value; } /** * Gets the value of the splitcharactersovercardsborder property. * */ public boolean isSplitcharactersovercardsborder() { return splitcharactersovercardsborder; } /** * Sets the value of the splitcharactersovercardsborder property. * */ public void setSplitcharactersovercardsborder(boolean value) { this.splitcharactersovercardsborder = value; } }
3036234827232a9c79892a31d6ff33980b08c44b
d4f810c500b513dc5eba632511fa441908746dc3
/app/src/test/java/com/prathameshmore/listviewapp/ExampleUnitTest.java
cb688b7b4860ef382f1b905975b9f0e1fbf73204
[ "MIT" ]
permissive
pprathameshmore/ListViewApp
fada62fa3159663a2616617b47230aa2ddcae2eb
72d1189c8da0a45cbfdd1156a91082e9a33a6daf
refs/heads/master
2020-04-05T05:12:52.351119
2018-11-19T19:52:26
2018-11-19T19:52:26
156,586,127
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.prathameshmore.listviewapp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
d8f94427c547db419af855370e0504b666206bdd
27be4f437b964f7921a689f3ff75b6f902c4faa3
/test/PreOrderTraversalTest.java
8df4b03a0c052fd3f0626f8dcc4df394b253a074
[]
no_license
cloudmation/Fundamentals
ca35ff18631ba31c827ef3b844739e5c803d5e58
3027a057a594443918f9e855ef4b23531b05d2ef
refs/heads/master
2020-03-17T16:34:27.598146
2018-06-15T02:28:20
2018-06-15T02:28:20
133,753,836
0
0
null
null
null
null
UTF-8
Java
false
false
1,058
java
import org.junit.Assert; import org.junit.Test; import java.util.ArrayList; public class PreOrderTraversalTest { @Test public void testPreOrderTraversalRecursive() { Node root = new Node(1); root.left = new Node(2); root.right = new Node(3); root.right.left = new Node(4); root.right.right = new Node(5); BinaryTreeTraversal traversal = new PreOrderTraversal(); ArrayList<Integer> results = traversal.recursive(root); Assert.assertArrayEquals(new int[] {1, 2, 3, 4, 5}, Utility.convertIntegers(results)); } @Test public void testPreOrderTraversalIterative() { Node root = new Node(1); root.left = new Node(2); root.right = new Node(3); root.right.left = new Node(4); root.right.right = new Node(5); BinaryTreeTraversal traversal = new PreOrderTraversal(); ArrayList<Integer> results = traversal.iterative(root); Assert.assertArrayEquals(new int[] {1, 2, 3, 4, 5}, Utility.convertIntegers(results)); } }
ed6ce59ac091c9d8865b1632aeac4135fda23f7c
55fd75151de7e7afb7118fe3cc0d49dff329645e
/src/minecraft/net/minecraft/client/gui/SelectionListBase.java
c4b767097f6e7aa1ddfe8cee7163496b731db611
[]
no_license
DraconisIra/MFBridge
ded956980905328a2d728c8f8f083e10d6638706
fa77fe09f2872b7feae52fb814e1920c98d10e91
refs/heads/master
2021-01-23T04:49:08.935654
2017-01-30T04:39:40
2017-01-30T04:39:40
80,393,957
2
0
null
null
null
null
UTF-8
Java
false
false
12,715
java
package net.minecraft.client.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public abstract class SelectionListBase { private final Minecraft mc; private final int field_96619_e; private final int field_96616_f; private final int field_96617_g; private final int field_96627_h; protected final int field_96620_b; protected int field_96621_c; protected int field_96618_d; private float field_96628_i = -2.0F; private float field_96625_j; private float field_96626_k; private int field_96623_l = -1; private long field_96624_m; public SelectionListBase(Minecraft par1Minecraft, int par2, int par3, int par4, int par5, int par6) { this.mc = par1Minecraft; this.field_96616_f = par3; this.field_96627_h = par3 + par5; this.field_96620_b = par6; this.field_96619_e = par2; this.field_96617_g = par2 + par4; } protected abstract int func_96608_a(); protected abstract void func_96615_a(int i, boolean flag); protected abstract boolean func_96609_a(int i); protected int func_96613_b() { return this.func_96608_a() * this.field_96620_b; } protected abstract void func_96611_c(); protected abstract void func_96610_a(int i, int j, int k, int l, Tessellator tessellator); private void func_96614_f() { int i = this.func_96607_d(); if (i < 0) { i = 0; } if (this.field_96626_k < 0.0F) { this.field_96626_k = 0.0F; } if (this.field_96626_k > (float)i) { this.field_96626_k = (float)i; } } public int func_96607_d() { return this.func_96613_b() - (this.field_96627_h - this.field_96616_f - 4); } public void func_96612_a(int par1, int par2, float par3) { this.field_96621_c = par1; this.field_96618_d = par2; this.func_96611_c(); int k = this.func_96608_a(); int l = this.func_96606_e(); int i1 = l + 6; int j1; int k1; int l1; int i2; int j2; if (Mouse.isButtonDown(0)) { if (this.field_96628_i == -1.0F) { boolean flag = true; if (par2 >= this.field_96616_f && par2 <= this.field_96627_h) { int k2 = this.field_96619_e + 2; j1 = this.field_96617_g - 2; k1 = par2 - this.field_96616_f + (int)this.field_96626_k - 4; l1 = k1 / this.field_96620_b; if (par1 >= k2 && par1 <= j1 && l1 >= 0 && k1 >= 0 && l1 < k) { boolean flag1 = l1 == this.field_96623_l && Minecraft.getSystemTime() - this.field_96624_m < 250L; this.func_96615_a(l1, flag1); this.field_96623_l = l1; this.field_96624_m = Minecraft.getSystemTime(); } else if (par1 >= k2 && par1 <= j1 && k1 < 0) { flag = false; } if (par1 >= l && par1 <= i1) { this.field_96625_j = -1.0F; j2 = this.func_96607_d(); if (j2 < 1) { j2 = 1; } i2 = (int)((float)((this.field_96627_h - this.field_96616_f) * (this.field_96627_h - this.field_96616_f)) / (float)this.func_96613_b()); if (i2 < 32) { i2 = 32; } if (i2 > this.field_96627_h - this.field_96616_f - 8) { i2 = this.field_96627_h - this.field_96616_f - 8; } this.field_96625_j /= (float)(this.field_96627_h - this.field_96616_f - i2) / (float)j2; } else { this.field_96625_j = 1.0F; } if (flag) { this.field_96628_i = (float)par2; } else { this.field_96628_i = -2.0F; } } else { this.field_96628_i = -2.0F; } } else if (this.field_96628_i >= 0.0F) { this.field_96626_k -= ((float)par2 - this.field_96628_i) * this.field_96625_j; this.field_96628_i = (float)par2; } } else { while (!this.mc.gameSettings.touchscreen && Mouse.next()) { int l2 = Mouse.getEventDWheel(); if (l2 != 0) { if (l2 > 0) { l2 = -1; } else if (l2 < 0) { l2 = 1; } this.field_96626_k += (float)(l2 * this.field_96620_b / 2); } } this.field_96628_i = -1.0F; } this.func_96614_f(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); Tessellator tessellator = Tessellator.instance; this.mc.getTextureManager().bindTexture(Gui.optionsBackground); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float f1 = 32.0F; tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(2105376); tessellator.addVertexWithUV((double)this.field_96619_e, (double)this.field_96627_h, 0.0D, (double)((float)this.field_96619_e / f1), (double)((float)(this.field_96627_h + (int)this.field_96626_k) / f1)); tessellator.addVertexWithUV((double)this.field_96617_g, (double)this.field_96627_h, 0.0D, (double)((float)this.field_96617_g / f1), (double)((float)(this.field_96627_h + (int)this.field_96626_k) / f1)); tessellator.addVertexWithUV((double)this.field_96617_g, (double)this.field_96616_f, 0.0D, (double)((float)this.field_96617_g / f1), (double)((float)(this.field_96616_f + (int)this.field_96626_k) / f1)); tessellator.addVertexWithUV((double)this.field_96619_e, (double)this.field_96616_f, 0.0D, (double)((float)this.field_96619_e / f1), (double)((float)(this.field_96616_f + (int)this.field_96626_k) / f1)); tessellator.draw(); j1 = this.field_96619_e + 2; k1 = this.field_96616_f + 4 - (int)this.field_96626_k; int i3; for (l1 = 0; l1 < k; ++l1) { j2 = k1 + l1 * this.field_96620_b; i2 = this.field_96620_b - 4; if (j2 + this.field_96620_b <= this.field_96627_h && j2 - 4 >= this.field_96616_f) { if (this.func_96609_a(l1)) { i3 = this.field_96619_e + 2; int j3 = this.field_96617_g - 2; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(8421504); tessellator.addVertexWithUV((double)i3, (double)(j2 + i2 + 2), 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)j3, (double)(j2 + i2 + 2), 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)j3, (double)(j2 - 2), 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)i3, (double)(j2 - 2), 0.0D, 0.0D, 0.0D); tessellator.setColorOpaque_I(0); tessellator.addVertexWithUV((double)(i3 + 1), (double)(j2 + i2 + 1), 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)(j3 - 1), (double)(j2 + i2 + 1), 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)(j3 - 1), (double)(j2 - 1), 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)(i3 + 1), (double)(j2 - 1), 0.0D, 0.0D, 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); } this.func_96610_a(l1, j1, j2, i2, tessellator); } } GL11.glDisable(GL11.GL_DEPTH_TEST); byte b0 = 4; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 0); tessellator.addVertexWithUV((double)this.field_96619_e, (double)(this.field_96616_f + b0), 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)this.field_96617_g, (double)(this.field_96616_f + b0), 0.0D, 1.0D, 1.0D); tessellator.setColorRGBA_I(0, 255); tessellator.addVertexWithUV((double)this.field_96617_g, (double)this.field_96616_f, 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)this.field_96619_e, (double)this.field_96616_f, 0.0D, 0.0D, 0.0D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 255); tessellator.addVertexWithUV((double)this.field_96619_e, (double)this.field_96627_h, 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)this.field_96617_g, (double)this.field_96627_h, 0.0D, 1.0D, 1.0D); tessellator.setColorRGBA_I(0, 0); tessellator.addVertexWithUV((double)this.field_96617_g, (double)(this.field_96627_h - b0), 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)this.field_96619_e, (double)(this.field_96627_h - b0), 0.0D, 0.0D, 0.0D); tessellator.draw(); j2 = this.func_96607_d(); if (j2 > 0) { i2 = (this.field_96627_h - this.field_96616_f) * (this.field_96627_h - this.field_96616_f) / this.func_96613_b(); if (i2 < 32) { i2 = 32; } if (i2 > this.field_96627_h - this.field_96616_f - 8) { i2 = this.field_96627_h - this.field_96616_f - 8; } i3 = (int)this.field_96626_k * (this.field_96627_h - this.field_96616_f - i2) / j2 + this.field_96616_f; if (i3 < this.field_96616_f) { i3 = this.field_96616_f; } tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(0, 255); tessellator.addVertexWithUV((double)l, (double)this.field_96627_h, 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)i1, (double)this.field_96627_h, 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)i1, (double)this.field_96616_f, 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)l, (double)this.field_96616_f, 0.0D, 0.0D, 0.0D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(8421504, 255); tessellator.addVertexWithUV((double)l, (double)(i3 + i2), 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)i1, (double)(i3 + i2), 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)i1, (double)i3, 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)l, (double)i3, 0.0D, 0.0D, 0.0D); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setColorRGBA_I(12632256, 255); tessellator.addVertexWithUV((double)l, (double)(i3 + i2 - 1), 0.0D, 0.0D, 1.0D); tessellator.addVertexWithUV((double)(i1 - 1), (double)(i3 + i2 - 1), 0.0D, 1.0D, 1.0D); tessellator.addVertexWithUV((double)(i1 - 1), (double)i3, 0.0D, 1.0D, 0.0D); tessellator.addVertexWithUV((double)l, (double)i3, 0.0D, 0.0D, 0.0D); tessellator.draw(); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); } protected int func_96606_e() { return this.field_96617_g - 8; } }
fafe904ed73a5283fe5b8682027f68fb3d1676d5
60920b7b1d15503eec49cfa24eb954a1f3a644ae
/network-core/src/main/java/click/tomasz/network/model/LayerBase.java
32c931938155a05aab2a070488f459dc3577dbff
[]
no_license
faraon79/alexaro
ceaf97916485d077c9e986b26eecc006ea315f3d
8af35102c1bf0afa82a57200fac9a23996f7d415
refs/heads/master
2021-01-11T07:04:05.723782
2016-12-04T09:17:06
2016-12-04T09:17:06
69,328,125
0
0
null
null
null
null
UTF-8
Java
false
false
309
java
package click.tomasz.network.model; public abstract class LayerBase extends Model { protected Neuron[] neurons; protected int size; public int getSize() { return size; } public Neuron[] getNeurons() { return neurons; } public int getWeightSize(){ return neurons[0].getWeights().length; } }
[ "Justyna1" ]
Justyna1
c18ffbe046638d6fbbca1434deb8d61ef96756f7
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/transform/CostEstimateJsonUnmarshaller.java
2925b73077fb1f17675187d6438814379abc38de
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
3,018
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.lightsail.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.lightsail.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * CostEstimate JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class CostEstimateJsonUnmarshaller implements Unmarshaller<CostEstimate, JsonUnmarshallerContext> { public CostEstimate unmarshall(JsonUnmarshallerContext context) throws Exception { CostEstimate costEstimate = new CostEstimate(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("usageType", targetDepth)) { context.nextToken(); costEstimate.setUsageType(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("resultsByTime", targetDepth)) { context.nextToken(); costEstimate.setResultsByTime(new ListUnmarshaller<EstimateByTime>(EstimateByTimeJsonUnmarshaller.getInstance()) .unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return costEstimate; } private static CostEstimateJsonUnmarshaller instance; public static CostEstimateJsonUnmarshaller getInstance() { if (instance == null) instance = new CostEstimateJsonUnmarshaller(); return instance; } }
[ "" ]
62f7f963f3f055e151cb084084787d939e5f93c7
706eb633c1154d090b14d0448de5878ddcb31405
/src/chapter1/LinkedQueue.java
da5522d39510a711015f9a66efd8666b73cff5e8
[]
no_license
CodeW1zard/algorithms4
e4335beb251fca64cdbdebf4b03b0036e8a8a64f
4d4d72cbcff4782cea214c9fec99662cc7822a97
refs/heads/master
2020-05-07T11:50:46.276903
2019-04-25T15:04:37
2019-04-25T15:04:37
180,477,913
0
0
null
null
null
null
UTF-8
Java
false
false
1,866
java
package chapter1; import java.util.Iterator; public class LinkedQueue<Item> implements Iterable<Item> { Node first, last; public void enqueue(Item item) { Node node = last; last = new Node(item); last.next = null; if (isEmpty()) { first = last; } else { node.next = last; } } public Item dequeue() { Item item = first.item; first = first.next; if (isEmpty()) last = null; return item; } public boolean isEmpty() { return first == null; } public Iterator<Item> iterator() { return new LinkedListIterator(); } private class LinkedListIterator implements Iterator<Item> { private Node node; public LinkedListIterator() { node = first; } public boolean hasNext() { return node != null; } public Item next() { if (!hasNext()) throw new IndexOutOfBoundsException("index out of bounds"); Item item = node.item; node = node.next; return item; } public void remove() { throw new UnsupportedOperationException("the remove method is not supported"); } } private class Node { Item item; Node next; Node(Item val) { item = val; } } public static void main(String[] args) { LinkedQueue<Integer> queue = new LinkedQueue<>(); for (int i = 0; i < 10; i++) { queue.enqueue(i); System.out.println("enqueue: " + i); if ((i + 1) % 2 == 0) { int k = queue.dequeue(); System.out.println("dequeue: " + k); } } for (int i : queue) { System.out.println(i); } } }
4797cf506caae9b490b4a9ca87e2bd75d1460d14
4211dd2f7b11df966bfc8740863d640f3d13dc21
/cobapercabangan/cobapercabangan.java
e400f67361057bc786aaee050510ebc0b8907076
[]
no_license
Lathifahdhiya/cobacoba
c82579765b0c9bd6162e692afa8324c104e5ee78
0994e051241f0e276b57ab9522aa98bff4f6142a
refs/heads/master
2021-01-19T22:52:22.933932
2017-03-03T09:30:35
2017-03-03T09:30:35
83,781,203
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
import java.util.Scanner; public class cobapercabangan { public static void main(String [] args) { Scanner s = new Scanner(System.in); int x; System.out.println("Masukkan sebuah angka"); x = s.nextInt(); if (x > 0) { System.out.println("angka yang dimasukkan merupakan bilangan positif"); } else if (x < 0) { System.out.println("angka yang dimasukkan merupakan bilangan negatif"); } else { System.out.println("angka yang dimasukkan adalah 0"); } } }
4affd9450b0dc90ab440075fa1c75db2f10edc64
99c7920038f551b8c16e472840c78afc3d567021
/aliyun-java-sdk-iot-v5/src/main/java/com/aliyuncs/v5/iot/model/v20180120/SetProductCertInfoResponse.java
05fb5e8487ad053d05e0049aa6f18e29500a16c1
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk-v5
9fa211e248b16c36d29b1a04662153a61a51ec88
0ece7a0ba3730796e7a7ce4970a23865cd11b57c
refs/heads/master
2023-03-13T01:32:07.260745
2021-10-18T08:07:02
2021-10-18T08:07:02
263,800,324
4
2
NOASSERTION
2022-05-20T22:01:22
2020-05-14T02:58:50
Java
UTF-8
Java
false
false
1,756
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.aliyuncs.v5.iot.model.v20180120; import com.aliyuncs.v5.AcsResponse; import com.aliyuncs.v5.iot.transform.v20180120.SetProductCertInfoResponseUnmarshaller; import com.aliyuncs.v5.transform.UnmarshallerContext; /** * @author auto create * @version */ public class SetProductCertInfoResponse extends AcsResponse { private String requestId; private Boolean success; private String code; private String errorMessage; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public Boolean getSuccess() { return this.success; } public void setSuccess(Boolean success) { this.success = success; } public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } public String getErrorMessage() { return this.errorMessage; } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } @Override public SetProductCertInfoResponse getInstance(UnmarshallerContext context) { return SetProductCertInfoResponseUnmarshaller.unmarshall(this, context); } }
0a6943519591d560444e31bba35e2c662afc6dd2
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/990ca39eaee2551c21494d936ff26a6715aafc7f/after/LineTooltipRenderer.java
84a7f7d1a2f00d80c0d3bc04f0b76d02edcec609
[]
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
11,459
java
/* * Copyright 2000-2009 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.codeInsight.hint; import com.intellij.ide.BrowserUtil; import com.intellij.util.ui.Html; import com.intellij.ide.IdeTooltipManager; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CustomShortcutSet; import com.intellij.openapi.actionSystem.IdeActions; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.keymap.KeymapManager; import com.intellij.openapi.util.Ref; import com.intellij.ui.HintHint; import com.intellij.ui.LightweightHint; import com.intellij.ui.ScrollPaneFactory; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.update.ComparableObject; import org.jetbrains.annotations.NonNls; import javax.swing.*; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * @author cdr */ public class LineTooltipRenderer extends ComparableObject.Impl implements TooltipRenderer { @NonNls protected String myText; private boolean myActiveLink = false; private int myCurrentWidth; @NonNls protected static final String BORDER_LINE = "<hr size=1 noshade>"; public LineTooltipRenderer(String text, Object[] comparable) { super(comparable); myText = text; } public LineTooltipRenderer(final String text, final int width, Object[] comparable) { this(text, comparable); myCurrentWidth = width; } public LightweightHint show(final Editor editor, final Point p, final boolean alignToRight, final TooltipGroup group, final HintHint hintHint) { if (myText == null) return null; //setup text myText = myText.replaceAll(String.valueOf(UIUtil.MNEMONIC), ""); final boolean expanded = myCurrentWidth > 0 && dressDescription(editor); final HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl(); final JComponent contentComponent = editor.getContentComponent(); final JComponent editorComponent = editor.getComponent(); final JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane(); final JEditorPane pane = IdeTooltipManager.initPane(new Html(myText).setKeepFont(true), hintHint, layeredPane); hintHint.setContentActive(isActiveHtml(myText)); if (!hintHint.isAwtTooltip()) { correctLocation(editor, pane, p, alignToRight, expanded, myCurrentWidth); } final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(pane); scrollPane.setBorder(null); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setOpaque(hintHint.isOpaqueAllowed()); scrollPane.getViewport().setOpaque(hintHint.isOpaqueAllowed()); scrollPane.setBackground(hintHint.getTextBackground()); scrollPane.getViewport().setBackground(hintHint.getTextBackground()); scrollPane.setViewportBorder(null); final Ref<AnAction> anAction = new Ref<AnAction>(); final LightweightHint hint = new LightweightHint(scrollPane) { public void hide() { onHide(pane); super.hide(); final AnAction action = anAction.get(); if (action != null) { action.unregisterCustomShortcutSet(contentComponent); } } }; anAction .set(new AnAction() { //action to expand description when tooltip was shown after mouse move; need to unregister from editor component { registerCustomShortcutSet( new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)), contentComponent); } public void actionPerformed(final AnActionEvent e) { expand(hint, editor, p, pane, alignToRight, group, hintHint); } }); pane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent e) { myActiveLink = true; if (e.getEventType() == HyperlinkEvent.EventType.EXITED) { myActiveLink = false; return; } if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (!expanded) { // more -> less expand(hint, editor, p, pane, alignToRight, group, hintHint); if (e.getURL() != null) { BrowserUtil.launchBrowser(e.getURL().toString()); } } else { //less -> more if (e.getURL() != null) { BrowserUtil.launchBrowser(e.getURL().toString()); return; } stripDescription(); hint.hide(); TooltipController.getInstance().showTooltip(editor, new Point(p.x - 3, p.y - 3), createRenderer(myText, 0), false, group, hintHint); } } } }); // This listener makes hint transparent for mouse events. It means that hint is closed // by MousePressed and this MousePressed goes into the underlying editor component. pane.addMouseListener(new MouseAdapter() { public void mouseReleased(final MouseEvent e) { if (!myActiveLink) { MouseEvent newMouseEvent = SwingUtilities.convertMouseEvent(e.getComponent(), e, contentComponent); hint.hide(); contentComponent.dispatchEvent(newMouseEvent); } } public void mouseExited(final MouseEvent e) { if (!expanded) { hint.hide(); } } }); hintManager.showEditorHint(hint, editor, p, HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_OTHER_HINT | HintManager.HIDE_BY_SCROLLING, 0, false, hintHint); return hint; } private void expand(LightweightHint hint, Editor editor, Point p, JEditorPane pane, boolean alignToRight, TooltipGroup group, HintHint hintHint) { hint.hide(); if (myCurrentWidth > 0) { stripDescription(); } TooltipController.getInstance().showTooltip(editor, new Point(p.x - 3, p.y - 3), createRenderer(myText, myCurrentWidth > 0 ? 0 : pane.getWidth()), alignToRight, group, hintHint); } public static void correctLocation(Editor editor, JComponent tooltipComponent, Point p, boolean alignToRight, boolean expanded, int currentWidth) { final JComponent editorComponent = editor.getComponent(); final JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane(); int widthLimit = layeredPane.getWidth() - 10; int heightLimit = layeredPane.getHeight() - 5; Dimension dimension = correctLocation(editor, p, alignToRight, expanded, tooltipComponent, layeredPane, widthLimit, heightLimit, currentWidth); // in order to restrict tooltip size tooltipComponent.setSize(dimension); tooltipComponent.setMaximumSize(dimension); tooltipComponent.setMinimumSize(dimension); tooltipComponent.setPreferredSize(dimension); } private static Dimension correctLocation(Editor editor, Point p, boolean alignToRight, boolean expanded, JComponent tooltipComponent, JLayeredPane layeredPane, int widthLimit, int heightLimit, int currentWidth) { Dimension preferredSize = tooltipComponent.getPreferredSize(); int width = expanded ? 3 * currentWidth / 2 : preferredSize.width; int height = expanded ? Math.max(preferredSize.height, 150) : preferredSize.height; Dimension dimension = new Dimension(width, height); if (alignToRight) { p.x = Math.max(0, p.x - width); } // try to make cursor outside tooltip. SCR 15038 p.x += 3; p.y += 3; if (p.x >= widthLimit - width) { p.x = widthLimit - width; width = Math.min(width, widthLimit); height += 20; dimension = new Dimension(width, height); } if (p.x < 3) { p.x = 3; } if (p.y > heightLimit - height) { p.y = heightLimit - height; height = Math.min(heightLimit, height); dimension = new Dimension(width, height); } if (p.y < 3) { p.y = 3; } locateOutsideMouseCursor(editor, layeredPane, p, width, height, heightLimit); return dimension; } private static void locateOutsideMouseCursor(Editor editor, JComponent editorComponent, Point p, int width, int height, int heightLimit) { Point mouse = MouseInfo.getPointerInfo().getLocation(); SwingUtilities.convertPointFromScreen(mouse, editorComponent); Rectangle tooltipRect = new Rectangle(p, new Dimension(width, height)); // should show at least one line apart tooltipRect.setBounds(tooltipRect.x, tooltipRect.y - editor.getLineHeight(), width, height + 2 * editor.getLineHeight()); if (tooltipRect.contains(mouse)) { if (mouse.y + height + editor.getLineHeight() > heightLimit && mouse.y - height - editor.getLineHeight() > 0) { p.y = mouse.y - height - editor.getLineHeight(); } else { p.y = mouse.y + editor.getLineHeight(); } } } protected String convertTextOnLinkHandled(String text) { return text; } protected void onHide(JComponent contentComponent) { } protected LineTooltipRenderer createRenderer(String text, int width) { return new LineTooltipRenderer(text, width, getEqualityObjects()); } protected boolean dressDescription(Editor editor) { return false; } protected void stripDescription() { } static boolean isActiveHtml(String html) { return html.indexOf("</a>") >= 0; } public void addBelow(String text) { @NonNls String newBody; if (myText == null) { newBody = UIUtil.getHtmlBody(text); } else { String html1 = UIUtil.getHtmlBody(myText); String html2 = UIUtil.getHtmlBody(text); newBody = html1 + BORDER_LINE + html2; } myText = "<html><body>" + newBody + "</body></html>"; } public String getText() { return myText; } }
cab44b5e2e708c1d4ff960eed2414afa24792394
3f7c7d559a5743ab38012a92ea35a2a5410f18ee
/services/Dynamohr126tabs/src/com/test_25feb/dynamohr126tabs/RolePermission.java
69bfc4be8254a0874e5e2d9e7786ac6fef3a6506
[]
no_license
Sushma-M/tes25feb
427a8d2d875a894ffaa45170ff62fbcd37ecc74a
2adc594a0a12673349463fd328e2beb89586b3a5
refs/heads/master
2021-01-10T15:09:35.906779
2016-02-25T08:40:21
2016-02-25T08:40:21
52,509,627
0
0
null
null
null
null
UTF-8
Java
false
false
4,464
java
/*Copyright (c) 2016-2017 gmail.com All Rights Reserved. This software is the confidential and proprietary information of gmail.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with gmail.com*/ package com.test_25feb.dynamohr126tabs; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import javax.persistence.PrimaryKeyJoinColumn; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import java.util.Arrays; import javax.persistence.Transient; import javax.persistence.CascadeType; import javax.persistence.UniqueConstraint; /** * RolePermission generated by hbm2java */ @Entity @Table(name="`role_permission`" ) public class RolePermission implements java.io.Serializable { private Integer idRolePermission; private String rolePermissionName; private String spanishLabel; private String englishLabel; private String category; private Integer modUser; private Date modDate; private Set<ListRolePermission> listRolePermissions = new HashSet<ListRolePermission>(0); public RolePermission() { } @Id @GeneratedValue(strategy=IDENTITY) @Column(name="`id_role_permission`", nullable=false, precision=10) public Integer getIdRolePermission() { return this.idRolePermission; } public void setIdRolePermission(Integer idRolePermission) { this.idRolePermission = idRolePermission; } @Column(name="`role_permission_name`", nullable=false, length=32) public String getRolePermissionName() { return this.rolePermissionName; } public void setRolePermissionName(String rolePermissionName) { this.rolePermissionName = rolePermissionName; } @Column(name="`spanish_label`", nullable=false, length=32) public String getSpanishLabel() { return this.spanishLabel; } public void setSpanishLabel(String spanishLabel) { this.spanishLabel = spanishLabel; } @Column(name="`english_label`", nullable=false, length=32) public String getEnglishLabel() { return this.englishLabel; } public void setEnglishLabel(String englishLabel) { this.englishLabel = englishLabel; } @Column(name="`category`", nullable=false, length=32) public String getCategory() { return this.category; } public void setCategory(String category) { this.category = category; } @Column(name="`mod_user`", nullable=false, precision=10) public Integer getModUser() { return this.modUser; } public void setModUser(Integer modUser) { this.modUser = modUser; } @Temporal(TemporalType.TIMESTAMP) @Column(name="`mod_date`", nullable=false, length=19) public Date getModDate() { return this.modDate; } public void setModDate(Date modDate) { this.modDate = modDate; } @OneToMany(fetch=FetchType.LAZY, cascade = {CascadeType.ALL}, mappedBy="rolePermission") public Set<ListRolePermission> getListRolePermissions() { return this.listRolePermissions; } public void setListRolePermissions(Set<ListRolePermission> listRolePermissions) { this.listRolePermissions = listRolePermissions; } public boolean equals(Object o) { if (this == o) return true; if ( (o == null )) return false; if ( !(o instanceof RolePermission) ) return false; RolePermission that = (RolePermission) o; return ( (this.getIdRolePermission()==that.getIdRolePermission()) || ( this.getIdRolePermission()!=null && that.getIdRolePermission()!=null && this.getIdRolePermission().equals(that.getIdRolePermission()) ) ); } public int hashCode() { int result = 17; result = 37 * result + ( getIdRolePermission() == null ? 0 : this.getIdRolePermission().hashCode() ); return result; } }
4d66ff9fa5bda2d768d229939fc76ba1f8a55f01
427118bf9b86f982c292de749eba5665a08d3d72
/monitor/src/main/java/com/star/cloud/monitor/daemon/DataCollectionThread.java
b60cbc7142a6476e2b101ac71b5dd1c8a179d122
[]
no_license
zhengsl/starcloud
f24b774a2f523ecfd1946fad367a18045f8eb3f3
7cce30e001739d1f941dbe281564d24c8e7c482b
refs/heads/master
2016-09-03T07:41:58.672511
2014-09-23T08:41:36
2014-09-23T08:41:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,827
java
package com.star.cloud.monitor.daemon; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.util.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.star.cloud.monitor.icinga.IcingaResponseData; import com.star.cloud.monitor.icinga.IcingaRestResponse; import com.star.cloud.monitor.model.StarCloudMonitorException; public class DataCollectionThread extends Thread { private static final Logger log = LoggerFactory.getLogger(DataCollectionThread.class); private static final ObjectMapper objMapper = new ObjectMapper(); private final CloseableHttpClient httpClient; private final List<String> urls; private final MonitoringDataHandlerChain handlerChain; private final String taskName; public DataCollectionThread(CloseableHttpClient httpClient, List<String> urls, MonitoringDataHandlerChain handlerChain, String taskName) { this.httpClient = httpClient; this.urls = urls; this.handlerChain = handlerChain; this.taskName = taskName; } @Override public void run() { CloseableHttpResponse response = null; try { Map<String, Map<String, String>> resultAll = new HashMap<String, Map<String, String>>(); for (String url : urls) { HttpGet httpget = new HttpGet(url); response = httpClient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { String jsonResponse = EntityUtils.toString(entity); log.debug("Has got data from Icinga: " + jsonResponse); Map<String, Object> resultMap = objMapper.readValue(jsonResponse, Map.class); IcingaRestResponse icingaResponse = new IcingaRestResponse(resultMap); IcingaResponseData icingaResponseData = new IcingaResponseData(icingaResponse); Map<String, Map<String, String>> result = icingaResponseData.extractResult(); for (String hostName : result.keySet()) { Map<String, String> perfData = result.get(hostName); if (resultAll.containsKey(hostName)) { resultAll.get(hostName).putAll(perfData); } else { resultAll.putAll(result); } } } } handlerChain.process(resultAll); } catch (Exception e) { log.error("Error happened while requesting Icinga in " + taskName + ".", e); throw new StarCloudMonitorException(e); } finally { try { response.close(); } catch (IOException e) { log.error("Error happened while closing response from Icinga in " + taskName + ".", e); throw new StarCloudMonitorException(e); } } } }
0550c75a98c34739a5331d7eda5dbabf0a26fcac
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/20/20_612e2af21fdf0061b04ac493e0d9b3c89785aeda/GameScreen/20_612e2af21fdf0061b04ac493e0d9b3c89785aeda_GameScreen_t.java
26664d8ed5089b6714670e56e61df68a26d06d64
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,059
java
package ch.zhaw.arsphema.screen; import java.util.ArrayList; import java.util.List; import ch.zhaw.arsphema.MyGdxGame; import ch.zhaw.arsphema.controller.HeroController; import ch.zhaw.arsphema.model.Background; import ch.zhaw.arsphema.model.Hero; import ch.zhaw.arsphema.model.NavigationOverlay; import ch.zhaw.arsphema.model.enemies.AbstractEnemy; import ch.zhaw.arsphema.model.enemies.EnemyFactory; import ch.zhaw.arsphema.model.shot.OverHeatBar; import ch.zhaw.arsphema.model.shot.Shot; import ch.zhaw.arsphema.services.Services; import ch.zhaw.arsphema.services.SoundManager; import ch.zhaw.arsphema.util.Paths; import ch.zhaw.arsphema.util.Sizes; import ch.zhaw.arsphema.util.Textures; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureRegion; public class GameScreen extends AbstractScreen { private float ppuX; // pixels per unit on the X axis private float ppuY; // pixels per unit on the Y axis private boolean showOverlay = true; private Hero hero; private HeroController controller; private NavigationOverlay overlay; private List<AbstractEnemy> enemies, killedEnemies; private List<Shot> heroShots, enemyShots, shotsToRemove; private EnemyFactory enemyFactory; private float elapsed = 0; private Background bg1,bg2; private OverHeatBar overheatbar; public GameScreen(MyGdxGame game) { super(game); } @Override public void show() { loadTextures(); controller = new HeroController(hero); enemies = new ArrayList<AbstractEnemy>(); killedEnemies = new ArrayList<AbstractEnemy>(); heroShots = new ArrayList<Shot>(); enemyShots = new ArrayList<Shot>(); shotsToRemove = new ArrayList<Shot>(); enemyFactory = EnemyFactory.getInstance(); Gdx.input.setInputProcessor(controller); Services.setSoundManager(new SoundManager()); } private void loadTextures() { hero = new Hero(5, Sizes.DEFAULT_WORLD_HEIGHT / 2 + Sizes.SHIP_HEIGHT / 2, Textures.HERO); overlay = new NavigationOverlay(Textures.OVERLAY_SPRITE); bg1 = new Background(new TextureRegion(Textures.BACKGROUND_STARS),0,0,Sizes.DEFAULT_WORLD_WIDTH,Sizes.DEFAULT_WORLD_HEIGHT); bg2 = new Background(new TextureRegion(Textures.BACKGROUND_STARS),bg1.getWidth(),0,Sizes.DEFAULT_WORLD_WIDTH,Sizes.DEFAULT_WORLD_HEIGHT); overheatbar = OverHeatBar.getInstance(); //TODO create one wide file for background and move with textureregion? } @Override public void render(float delta) { elapsed += delta; drawGame(delta); //hero stuff hero.move(delta); heroShots.addAll(hero.shoot(delta)); heroSuffering(); killEnemies(); enemies.addAll(enemyFactory.dropEnemy(delta, elapsed)); computeEnemyMovements(delta); enemies.addAll(enemyFactory.dropEnemy(delta, elapsed)); controller.update(delta); updateShots(); } private void drawGame(float delta) { Gdx.gl.glClearColor(0f, 0f, 0f, 0); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); bg1.draw(batch,delta, elapsed,ppuX,ppuY); // draw Background bg2.draw(batch,delta, elapsed,ppuX,ppuY); // draw Background hero.draw(batch,delta, elapsed,ppuX,ppuY); overheatbar.draw(batch,delta, elapsed,ppuX,ppuY); for(AbstractEnemy enemy : enemies) { enemy.move(delta);//TODO remove out of view enemies } for(AbstractEnemy enemy : enemies) { enemy.draw(batch, delta, elapsed, ppuX, ppuY); } drawShots(delta); // start overlay is displayed 5 sec if(showOverlay) { // start overlay is displayed 5 sec batch.draw(overlay.getTexture(NavigationOverlay.START), ppuX * overlay.x, ppuY * overlay.y, ppuX * overlay.width, ppuY * overlay.height); if (elapsed >= 5) { enemyFactory.setDropEnemies(true); showOverlay = false; } } else { batch.draw(overlay.getTexture(NavigationOverlay.GAME), ppuX * overlay.x, ppuY * overlay.y, ppuX * overlay.width, ppuY * overlay.height); } batch.end(); } private void drawShots(float delta) { for (Shot shot : heroShots) { shot.draw(batch, delta, elapsed, ppuX, ppuY); if (shot.shouldBeRemoved()) { shotsToRemove.add(shot); } } for (Shot shot : enemyShots) { shot.draw(batch, delta, elapsed, ppuX, ppuY); if (shot.shouldBeRemoved()) { shotsToRemove.add(shot); } } } @Override public void resize(int width, int height) { super.resize(width, height); controller.resize(width, height); ppuX = (float) width / Sizes.DEFAULT_WORLD_WIDTH; ppuY = (float) height / Sizes.DEFAULT_WORLD_HEIGHT; } private void heroSuffering() { for(Shot shot : enemyShots) { if(shot.overlaps(hero)) { if(hero.lowerHealth(shot.getDamage())){ //TODO gameover screen... hero suffered too much :'( } } } } private void computeEnemyMovements(float delta) { for(AbstractEnemy enemy : enemies) { if(enemy.move(delta)) killedEnemies.add(enemy); } killEnemies(); enemies.removeAll(killedEnemies); killedEnemies.clear(); } private void killEnemies() { for(Shot shot : heroShots) { for(AbstractEnemy enemy : enemies) if(shot.overlaps(enemy)) { if(enemy.lowerHealth(shot.getDamage())){ //TODO enemy is dead... loot him!!! (point berechnung) // enemy.getBasePoints(); killedEnemies.add(enemy); } shotsToRemove.add(shot); } } enemies.removeAll(killedEnemies); killedEnemies.clear(); } private void updateShots() { heroShots.removeAll(shotsToRemove); enemyShots.removeAll(shotsToRemove); shotsToRemove.clear(); } @Override public void hide() {} @Override public void pause() {} @Override public void resume() {} }
95a653a5ee5c36e41782ddc4e2e022e2af369aaa
8060413d5d6e9d8e8dc108580ff22b888aa4fdaf
/client/src/main/java/com/example/client/view/GameView.java
dd0830bdcde5c5a70c692f2c9b980ef5c64b38ee
[]
no_license
ilkyazar/alien-shooter-game
fbcfd26c76db6a84adb9dd15197deb507ff3e90f
20915d308701b00afe50379fcd7f8a1a9ebcbb9d
refs/heads/master
2023-04-06T10:33:53.507370
2020-07-07T12:37:42
2020-07-07T12:37:42
277,804,205
1
0
null
2021-04-26T20:27:22
2020-07-07T11:59:57
Java
UTF-8
Java
false
false
10,104
java
package com.example.client.view; import com.example.client.WebService; import com.example.client.constants.GameConstants; import com.example.client.constants.UIConstants; import com.example.client.controller.GameEngine; import com.example.client.model.Player; import com.example.client.model.Alien; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.control.Button; import javafx.geometry.Pos; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.image.ImageView; import javafx.scene.image.Image; import javafx.scene.input.KeyCombination; import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyCode; /** * This is the Game View class. It contains a gamePane which holds all the game components. * Player starts shooting automatically when the game starts. Player moves with the mouse move event. * When all aliens are dead, GameView increments the level in GameEngine and new aliens are created. * * When Level 4 is finished without getting killed, the GameView stops until a match for the multiplayer * level is found. Then it resumes for level 5. * When the game ends, score of the player is saved to the leaderboard. And the * gamepane is cleaned and all variables are set to idle for the next game. * * Also Ctrl+Shift+9 cheat is implemented here. (But it is not applicable for Level 5!) * */ public class GameView { private static Scene gameViewScene; public static Pane gamePane; private static Text level; private static Text health; private static Text score; private static Text health2; private static Text score2; public static Player player2; public static boolean levelOver = false; public static boolean gameOver = false; public static void create() { gamePane = new Pane(); gameViewScene = new Scene(gamePane, UIConstants.WIDTH, UIConstants.HEIGHT); try { Image image = new Image(UIConstants.BACKGROUND_PATH); ImageView background = new ImageView(image); background.setFitHeight(UIConstants.HEIGHT); background.setFitWidth(UIConstants.WIDTH); gamePane.getChildren().add(background); } catch (Exception e) { System.out.println(e); } initLabels(); } static void play() { if(GameEngine.getLevel()<5){ GameEngine.newLevel(); } Player player = GameEngine.player; gamePane.getChildren().add(player.getShip()); if (GameEngine.getLevel() < 5){ player.startShooting(); addAliens(); } else{ player2 = GameEngine.player2; gamePane.getChildren().add(player2.getShip()); } gameViewScene.setOnMouseMoved(event-> { if (levelOver == false) { clearAliens(false); if (!GameEngine.isAliensAlive()) { System.out.println(UIConstants.LEVEL_PASSED_LABEL); GameEngine.setLevel(GameEngine.getLevel()+1); showLevelOver(UIConstants.LEVEL_PASSED_LABEL); levelOver = true; return; } if (player.isAlive()) { player.getShip().setTranslateX(event.getX()); player.getShip().setTranslateY(event.getY()); } else { levelOver = true; clearAliens(true); if(GameEngine.getLevel() < 5){ //finish single player game finishGame(false); } return; } } }); KeyCombination keyComb1 = new KeyCodeCombination(KeyCode.NUMPAD9, KeyCombination.SHIFT_DOWN, KeyCombination.CONTROL_DOWN); KeyCombination keyComb2 = new KeyCodeCombination(KeyCode.DIGIT9, KeyCombination.SHIFT_DOWN, KeyCombination.CONTROL_DOWN); gameViewScene.addEventHandler(KeyEvent.KEY_RELEASED, event-> { if (keyComb1.match(event) || keyComb2.match(event) ) { if (GameEngine.getLevel() != 5) { levelOver = true; clearAliens(true); GameEngine.setLevel(GameEngine.getLevel()+1); showLevelOver(UIConstants.LEVEL_PASSED_LABEL); } } }); } public static void clearAliens(boolean killAll){ for (Alien alien : GameEngine.getAliens() ){ if (killAll) alien.setIsDead(); if (!alien.isAlive()) { gamePane.getChildren().remove(alien.getAlienShip()); } } } public static void initLabels(){ level = new Text(); level.setX(UIConstants.WIDTH /2.0 - 40); level.setY(30); level.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 20)); level.setFill(Color.WHITE); updateLevelLabel(1); health = new Text(); health.setX(UIConstants.WIDTH /2.0 - 200); health.setY(60); health.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 15)); health.setFill(Color.WHITE); updateHealthLabel(GameConstants.PLAYER_HEALTH); score = new Text(); score.setX(UIConstants.WIDTH /2.0 + 100); score.setY(60); score.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 15)); score.setFill(Color.WHITE); updateScoreLabel(0); health2 = new Text(); health2.setX(UIConstants.WIDTH /2.0 - 200); health2.setY(100); health2.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 15)); health2.setFill(Color.WHITE); score2 = new Text(); score2.setX(UIConstants.WIDTH /2.0 + 100); score2.setY(100); score2.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 15)); score2.setFill(Color.WHITE); gamePane.getChildren().addAll(level, health, score, health2, score2); } static void addAliens() { //System.out.println("Adding aliens for level: " + GameEngine.getLevel()); for(Alien alien : GameEngine.getAliens()){ if(alien.isAlive()){ gamePane.getChildren().add(alien.getAlienShip()); alien.startShooting(); alien.startMoving(); } } } public static void addGiantAlien() { for(Alien alien : GameEngine.getAliens()){ if(alien.isAlive()){ gamePane.getChildren().add(alien.getAlienShip()); alien.startShooting(); } } } static void showLevelOver(String s) { Button overButton = new Button(); String buttonTxt = UIConstants.NEXT_LEVEL_LABEL; String infoText = s; overButton.setText(buttonTxt); overButton.prefWidthProperty().bind(UIConstants.window.widthProperty().multiply(0.60)); VBox vb = new VBox(); vb.getChildren().add(new Text(infoText)); vb.getChildren().addAll(overButton); vb.setSpacing(20); vb.setAlignment(Pos.CENTER); overButton.setAlignment(Pos.CENTER); String style = "-fx-background-color: rgba(255, 255, 255, 0.5);"; vb.setStyle(style); gamePane.getChildren().add(vb); vb.setLayoutX(200); vb.setLayoutY(850); vb.prefWidthProperty().bind(UIConstants.window.widthProperty().multiply(0.60)); overButton.setOnAction(e-> { levelOver = false; GameEngine.newLevel(); if (GameEngine.getLevel() != 5) addAliens(); gamePane.getChildren().remove(vb); }); } public static void finishGame(boolean isMultiplayer){ Player player1 = GameEngine.player; Player player2 = GameEngine.player2; GameEngine.player.setIsDead(); GameEngine.player2.setIsDead(); WebService.addToLeaderboard(LoginView.getPlayerId(),GameEngine.player.getScore()); gamePane.getChildren().remove(GameEngine.player.getShip()); if(isMultiplayer){ gamePane.getChildren().remove(GameEngine.player2.getShip()); } for (Alien alien: GameEngine.aliens) { gamePane.getChildren().remove(alien.getAlienShip()); } updateScoreLabel(0); updateHealthLabel(GameConstants.PLAYER_HEALTH); score2.setText(""); health2.setText(""); gameOver = false; levelOver = false; gameViewScene.setOnMouseMoved(null); GameOverView.show(player1, player2, isMultiplayer); System.out.println("Game engine stopped"); GameEngine.stop(); } public static void updateLevelLabel(int newLevel) { level.setText(UIConstants.LEVEL_LABEL + String.valueOf(newLevel)); } public static void updateHealthLabel(int newHealth){ health.setText(UIConstants.HEALTH_LABEL + String.valueOf(newHealth)); } public static void updateScoreLabel(int newScore){ score.setText(UIConstants.SCORE_LABEL + String.valueOf(newScore)); } public static void updateHealth2Label(int newHealth){ health2.setText(UIConstants.HEALTH_LABEL_2 + String.valueOf(newHealth)); } public static void updateScore2Label(int newScore){ score2.setText(UIConstants.SCORE_LABEL_2 + String.valueOf(newScore)); } public static void show() { play(); UIConstants.window.setScene(gameViewScene); } }
9f445d4f70ada78bb1ddaadc7937d071f1584548
b40e9b2cbd5423e79d3198c78e4454920195013b
/maker-checker-dashboard/components/human-task-service/src/main/java/org/oasis_open/docs/ns/bpel4people/ws_humantask/types/_200803/GroupDocument.java
4694e58881d09363b0f83798c9c17f4eb81a014f
[]
no_license
WSO2Telco/product-ids-extensions
f8ccddccbb9d9b710d748f1590e9e33214966e3f
d8e43b853578d026b80bb037a58b843c5c2c0128
refs/heads/master
2021-06-16T15:11:41.234982
2018-10-29T05:46:43
2018-10-29T05:46:43
147,296,690
1
11
null
2021-01-30T13:42:11
2018-09-04T06:12:38
Java
UTF-8
Java
false
false
9,798
java
/* * An XML document type. * Localname: group * Namespace: http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803 * Java type: org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument * * Automatically generated - do not modify. */ package org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803; /** * A document containing one group(@http://docs.oasis-open.org/ns/bpel4people/ws-humantask/types/200803) element. * * This is a complex type. */ public interface GroupDocument extends org.apache.xmlbeans.XmlObject { public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType) org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(GroupDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s7B376691F9828D2A29ED491729187FB4").resolveHandle("group94b4doctype"); /** * Gets the "group" element */ java.lang.String getGroup(); /** * Gets (as xml) the "group" element */ org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.TGroup xgetGroup(); /** * Sets the "group" element */ void setGroup(java.lang.String group); /** * Sets (as xml) the "group" element */ void xsetGroup(org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.TGroup group); /** * A factory class with static methods for creating instances * of this type. */ public static final class Factory { public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument newInstance() { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument newInstance(org.apache.xmlbeans.XmlOptions options) { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); } /** @param xmlAsString the string value to parse */ public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); } /** @param file the file from which to load an xml document */ public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); } public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (org.oasis_open.docs.ns.bpel4people.ws_humantask.types._200803.GroupDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } private Factory() { } // No instance of this class allowed } }
87e616877f48eb7012d7a092dbf7412ae981cc5c
aa594ca85dbe3efdadf02301ad824ec30e38f03d
/HadoopDemo/protobufDemo/src/test/java/Test.java
fd722468655c99f823ad9fde59905d4b80644da9
[]
no_license
boluoge/-
0719e434d192ac0b9bb290d1e3a1eea52b3d6575
57a9e887f76fd027493ed8e64710d15826873c73
refs/heads/master
2022-12-23T01:43:58.526179
2018-12-01T04:50:36
2018-12-01T04:50:36
159,902,457
1
0
null
2022-12-16T10:19:24
2018-12-01T02:48:09
JavaScript
UTF-8
Java
false
false
645
java
import com.example.tutorial.People; import java.io.FileOutputStream; import java.io.ObjectOutputStream; public class Test { @org.junit.Test public void testInJava() throws Exception { long start = System.currentTimeMillis(); People people = new People(); people.setId(1); people.setName("tom"); people.setEmail("123@123"); people.setPhone("+433 399 399"); ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream("e:/java.data")); stream.writeObject(people); stream.close(); System.out.println(System.currentTimeMillis() - start); } }
0a5dbd5631554a0398f591264e7b2c5eda564331
2fbfaa691c6a69fea30726c643932e3cb6f92c63
/src/app/Application.java
e1a40c8fa3e9a09d5e6832f507af5f20dd19a9fa
[]
no_license
wsadrak/rock-paper-scissors
adad3def7ae0e4fbf7b6c961c215bc642a273851
a1e3332e4dbbbd69ae2777948b38bfc319f3ad6e
refs/heads/master
2020-05-29T22:01:03.639979
2019-06-28T10:42:10
2019-06-28T10:45:09
189,398,992
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package app; import game.GameController; public class Application { public static void main(String[] args) { GameController game = new GameController(); game.mainLoop(); } }
8467d026e19868b9079becb7c3f67c4a0639bec2
34534c55ab572859c1bd605874cbc05119c5b4ee
/app/src/main/java/com/example/senai/xtudoandroid/xtudo/EmpresaFornecedor.java
396ea50439168489d2c8be415dbc6940ce6584c6
[]
no_license
fernandonakagawa/projetoXTudo
8bff15d2cdd1970d97db2d06fac832efc7ada2eb
f8aacdc3ba6f3eaf8ee9b1573b279d7274933d90
refs/heads/master
2020-05-07T11:23:10.035237
2019-04-19T15:29:08
2019-04-19T15:29:08
180,459,132
0
0
null
null
null
null
UTF-8
Java
false
false
975
java
package com.example.senai.xtudoandroid.xtudo; import java.util.ArrayList; public class EmpresaFornecedor extends Empresa { ArrayList<Pedido> aPedidos; public EmpresaFornecedor(int id, String nome, String nomeFantasia, String cnpj, AvaliacaoGeral ag, String linkFoto, ArrayList<Pedido> aPedidos) { super(id, nome, nomeFantasia, cnpj, ag, linkFoto); this.aPedidos = aPedidos; } public boolean aceitarPedido(boolean aceite, Pedido p) { return true; } public boolean cancelarEntrega(Pedido p) { return true; } public boolean entregar(Pedido p) { return true; } public boolean cadastrarProduto(Pedido p) { return true; } public boolean removerProduto(Pedido p) { return true; } public ArrayList<Produto> listarProdutos() { return null; } public boolean alterarProdutos(Pedido p) { return true; } }
07141c2e834ff65c639f053aed1722a3e712d20d
91b9f6e6824e7655c37f66ce5755fee9aacf9b00
/src/main/java/br/com/soujava/dinamico/JavaDinamicoException.java
34c54aaa2c63b2b356540890eae78d0d2dc65931
[ "Apache-2.0" ]
permissive
assaduzzaman-dsi/java_dinamico
f6b4bf4b2da3c3b0619441819a832e9a3b309929
5c9f64d6b44fd4ba763806f78ad7baef287a4fc9
refs/heads/master
2021-01-18T02:04:33.756940
2014-01-20T09:34:52
2014-01-20T09:34:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package br.com.soujava.dinamico; import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; import javax.tools.JavaFileObject; /** * Classe Exceção para a compilacao dinamica. * Seu objetivo é apenas reportar os erros de compilação em tempo real */ public class JavaDinamicoException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; /** * O coletor de informações da compilação */ private DiagnosticCollector<JavaFileObject> collector; public JavaDinamicoException(String message) { super(message); } public JavaDinamicoException(String message, DiagnosticCollector<JavaFileObject> collector) { super(message); this.collector = collector; } public JavaDinamicoException(Throwable e, DiagnosticCollector<JavaFileObject> collector) { super(e); this.collector = collector; } public String getCompilationError() { StringBuilder sb = new StringBuilder(); for (Diagnostic<? extends JavaFileObject> diagnostic : collector.getDiagnostics()) { sb.append(diagnostic.getMessage(null)); } return sb.toString(); } @Override public String toString() { return getCompilationError(); } }
07be419ab466cbf5d76d97af421d9c8d1a405926
ea55d914861379f2db27656d37e3cfc18ebef0d4
/Proyecto_jad/src/proyecto_jade/conexiones.java
ae314c433077ada20195f498cdd4163ca3cacda4
[]
no_license
avcarrion4/Inteligencia_Artificial
ebef783286cd57f43192276ab2567599c9e0e89a
aa5e85299f4ba4ca2ce8d2cf4bc4603eae8e1cfe
refs/heads/master
2020-04-19T22:12:20.042233
2019-01-31T04:36:56
2019-01-31T04:36:56
168,463,015
0
0
null
null
null
null
UTF-8
Java
false
false
885
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 proyecto_jade; import java.sql.*; import java.sql.Connection; /** * * @author Andy */ public class conexiones { public Connection con; public Connection conectar() throws SQLException, ClassNotFoundException { String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/db_agente"; Class.forName(driver); return DriverManager.getConnection(url, "root", ""); } public Connection AbrirConexion() throws ClassNotFoundException, SQLException { con = conectar(); return con; } public void CerrarConexion() throws SQLException { con.close(); } }
b8ecc7097ffa970357118f61ffd4dd5f74f8f9f7
18dddba416dc0842360c7322af68d7695f3ea104
/Blues/src/main/java/tn/esprit/Blues/Services/BankShareServices.java
db01ae391b1cf001bef618cc906ca66dc8ebbd25
[]
no_license
Medalizml/BestTrader-EJB
ca55b142887f8769d53a4faf379707790474ad94
ab5bda976f8f275593c46e7ba091d37408cc869f
refs/heads/master
2016-08-05T12:28:47.309866
2015-06-01T01:26:18
2015-06-01T01:26:18
42,369,390
0
0
null
null
null
null
UTF-8
Java
false
false
607
java
package tn.esprit.Blues.Services; import java.util.List; import javax.ejb.Remote; import tn.esprit.Blues.entities.Bank; import tn.esprit.Blues.entities.Currency; import tn.esprit.Blues.entities.Currencybank; import tn.esprit.Blues.entities.Share; @Remote public interface BankShareServices { public void add(Bank b,Share s); public void remove(Bank a); public void update(Bank a,Share s); public List<Bank> findAll(); public void addCurrency(Currency c,Currencybank currencybank); public Bank findById(int id); public void editCurrency(Currencybank cb); }
b9937195c5e06689ceadecafaf53c84bcace65c2
45b0dcc076eddad55a62014e51ce72d9b8d301c5
/app/src/main/java/innopolis/less/registration/activites/LoginActivity.java
18cdf3b79b7f4bd7ee9a673e14eb395fa21398a5
[]
no_license
pashaigood/less-innopolis-android-students
6e537686efb71b7392493c3d869b5a473910790a
0c49877439ae534933e3ba701eca4e752d70e077
refs/heads/master
2020-04-05T13:34:32.956940
2017-06-29T16:39:49
2017-06-29T16:39:49
94,893,037
0
0
null
null
null
null
UTF-8
Java
false
false
1,780
java
package innopolis.less.registration.activites; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import android.widget.Toast; import innopolis.less.registration.R; import innopolis.less.registration.collections.Users; public class LoginActivity extends AppCompatActivity { private EditText login; private EditText password; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); login = (EditText) findViewById(R.id.login_login); password = (EditText) findViewById(R.id.login_password); } @Override public void onBackPressed() { if (Users.isAuthorized()) { super.onBackPressed(); } } public void signIn(View view) { if (Users.auth(login.getText().toString(), password.getText().toString())) { Toast.makeText(this, "Hello!", Toast.LENGTH_LONG).show(); Intent resultIntent = new Intent(); setResult(Activity.RESULT_OK, resultIntent); finish(); } else { Toast.makeText(this, "Sorry, can't sing in, are you singed up?", Toast.LENGTH_LONG).show(); } } public void signUp(View view) { startActivity(new Intent(getApplicationContext(), RegistrationActivity.class)); } // TODO: Temporary :) public void forceSingIn(View view) { Users.auth("admin", "admin"); Intent resultIntent = new Intent(); setResult(Activity.RESULT_OK, resultIntent); finish(); } }
a74c1bc0da06603b8fe1660f443873f9e7858b1b
d2de3073a3b646e42bc3bb3c08f7d075a1aad6eb
/empleos/src/test/java/com/danicode/EmpleosApplicationTests.java
cca266235fa15caa1c56f753e9148de067aa0c47
[]
no_license
daniocen777/proyectos-spring
0f657cfbe9cd835ddc1c4dc2a1f8066bf06e1af7
b7ec8a1e7c0ad12c3a40f3229636c87e604a9b73
refs/heads/main
2023-01-22T09:17:50.098113
2020-12-01T13:35:24
2020-12-01T13:35:24
317,551,061
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.danicode; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class EmpleosApplicationTests { @Test public void contextLoads() { } }
bd6e55bfe7b67d2537d9495acfd6f575e66ba569
d086056eac60f2d9e9a55bf45cff31fe5615a425
/Nutriapp_Android/src/com/nutriapp_android/internal_storage/ImageFileHelper.java
c051221621156c806b13e6056e24eb842ee03dd0
[]
no_license
JesusEduardo2028/nutriapp
1105de8b8eb4fa287398a9285cb7d738c7d6caf1
af56b9565dd255a518db184e5ea02e23267b0ac2
refs/heads/master
2016-09-06T01:26:20.504852
2013-11-06T02:30:31
2013-11-06T02:30:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,065
java
package com.nutriapp_android.internal_storage; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; import android.util.Log; public class ImageFileHelper { Context context; String estado; public ImageFileHelper(Context context) { this.context = context; estado = Environment.getExternalStorageState(); } public void setImageFile(Bitmap bitmap, String name) { if(estado.equals(Environment.MEDIA_MOUNTED)) { try { FileOutputStream out = new FileOutputStream(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)+"/"+name+".png"); bitmap.compress(Bitmap.CompressFormat.PNG, 90, out); out.close(); Log.i("imageHelper", "-> archivo almacenado"); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } public Bitmap getImageFile(String name) { Bitmap bitmap = null; if(estado.equals(Environment.MEDIA_MOUNTED)) { try { File tempFile = new File(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)+"/", name+".png"); if(tempFile.exists()) { Log.i("imageHelper", "-> existe archivo"); FileInputStream is = new FileInputStream(context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)+"/"+name+".png"); bitmap = BitmapFactory.decodeStream(is); is.close(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return bitmap; } public void removeImagesFile() { File images = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES); if (images.exists()) { images.delete(); } } }
30025d4433d58908d1fe87babfd6bdc66e8fdab0
8f5afac63d83f4da878b6341927024d060c72f67
/executor/src/main/java/ru/avklimenko/hedgehog/HHConnectionPool.java
27835ee1a47e88abdf568b21375af26db15ebe63
[ "BSD-2-Clause" ]
permissive
alklimenko/hedgehog
2dd12380b455ab9ddd2ec829a2dda2e6a7c48706
2315eb45ce56671006f946252bbdeea778d426ae
refs/heads/master
2020-03-14T10:40:51.992760
2018-08-23T16:10:01
2018-08-23T16:10:01
131,572,808
0
0
null
null
null
null
UTF-8
Java
false
false
2,977
java
package ru.avklimenko.hedgehog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import static ru.avklimenko.hedgehog.Utils.delay; /** * Connection pool to databases. * @author Alexey Klimenko * @since 2018.05.04 **/ public final class HHConnectionPool extends Thread { private ConcurrentHashMap<String, List<HHConnection>> connections = new ConcurrentHashMap<>(); private static HHConnectionPool instance = null; private static Logger logger = LoggerFactory.getLogger(HHConnectionPool.class); private static boolean isLogged = false; public static void debug(String text) { if (isLogged) { logger.debug(text); } } public static void setLogger(boolean isLoggedVal) { isLogged = isLoggedVal; } private HHConnectionPool() { // } public static HHConnectionPool getInstance() { if (instance == null) { synchronized (HHConnectionPool.class) { if (instance == null) { instance = new HHConnectionPool(); instance.start(); } } } return instance; } public int getTotalSize() { int size = 0; for (String key : connections.keySet()) { size += connections.get(key).size(); } return size; } public HHConnection getConnection(String connectionString) { if (!connections.containsKey(connectionString)) { connections.put(connectionString, new ArrayList<>()); } if (connections.get(connectionString).size() > 0) { synchronized (HHConnectionPool.class) { for (HHConnection connection : connections.get(connectionString)) { if (connection.isFree()) { connection.setBusy(); debug("Get connection " + connectionString + "from pool"); return connection; } } } } HHConnection connection = new HHConnection(connectionString); connections.get(connectionString).add(connection); debug("Create new connection " + connectionString); return connection; } /** * Every second check all connections and remove overdue. */ @Override public void run() { while (true) { if (!delay(10000)) { return; } for (String key : connections.keySet()) { for (int i = connections.get(key).size() - 1; i > -1; i--) { if (connections.get(key).get(i).isTimeForKill()) { debug("Remove connection " + key + "from pool"); connections.get(key).remove(i); } } } } } }
413f8737b267d23aa9c54b31aaf4134b41dfd2fa
2d02a3a650cb4ce2425858c1d3ef2dfd294c6cd7
/src/main/java/com/mycompany/filmgo/config/ApplicationProperties.java
e6e253b06e09c8485f2338c9659ecae7f2de0047
[]
no_license
jslowbro/filmgo
6c1f65ed3cfb93b3e5aa0e427ae7326bc4c1ad90
47441f0cba46ae2d9b22daf1b566943eab7f99ed
refs/heads/master
2022-09-03T07:31:51.721245
2020-05-29T08:20:20
2020-05-29T08:20:20
267,804,620
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package com.mycompany.filmgo.config; import org.springframework.boot.context.properties.ConfigurationProperties; /** * Properties specific to Filmgo. * <p> * Properties are configured in the {@code application.yml} file. * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. */ @ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) public class ApplicationProperties {}
607f1b4a75004fbc5f98085e58c802bbe56adbc3
56263e2136040b16fead6786795e0af948e63114
/module/module-security/src/main/java/com/whenling/module/security/captcha/CaptchaRobotPrevention.java
3a6c912269afde8b6331f213f789615d1a2285e2
[ "Apache-2.0" ]
permissive
xingganfengxing/java-platform
52c8c671453eadc8b13b8c72c3722258e3bf762b
fa03c4314a1a3946162a91a7ce547a458d2b7370
refs/heads/master
2021-01-19T04:56:12.366307
2016-11-08T14:44:42
2016-11-08T14:44:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package com.whenling.module.security.captcha; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import com.google.common.base.Strings; import com.octo.captcha.service.CaptchaService; import com.whenling.module.base.SpringContext; import com.whenling.module.security.RobotPrevention; public class CaptchaRobotPrevention implements RobotPrevention { @Override public boolean validateRequest(ServletRequest request, ServletResponse response) { String captchaCode = request.getParameter("captcha"); return !Strings.isNullOrEmpty(captchaCode) && SpringContext.getBean(CaptchaService.class) .validateResponseForID(((HttpServletRequest) request).getSession(true).getId(), captchaCode.toUpperCase()); } }
06797b0844aed22eb7a05584c13d835699ef75cd
c1f13d2a0236496b3d8f68f033127e9e3fcf9586
/src/main/java/com/aayush/view/ButtonPanel.java
9238b773c0c972a264460906a1b3d1ed62cb6733
[]
no_license
adira9/Download-Manager
eae6df50cbd1ca640646a51f0d7c82c7b50263fa
aec38c497551b32f1ae85242cd566b87a6b43a37
refs/heads/master
2020-04-29T08:21:43.361544
2018-07-26T08:41:38
2018-07-26T08:41:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,221
java
package com.aayush.view; import com.aayush.model.template.Download; import com.aayush.util.DownloadStatus; import javax.swing.*; import java.awt.*; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; /** * Panel that contains all the buttons that control download status * * @author Aayush * @see javax.swing.JPanel */ class ButtonPanel extends JPanel { /** * Cancel button */ private final JButton cancelButton; /** * Pause button */ private final JButton pauseButton; /** * Resume button */ private final JButton resumeButton; private final JButton removeButton; /** * Exit button */ private final JButton exitButton; /** * Constructor */ ButtonPanel() { cancelButton = new JButton("Cancel"); pauseButton = new JButton("Pause"); resumeButton = new JButton("Resume"); removeButton = new JButton("Remove"); exitButton = new JButton("Exit"); Dimension preferredSize = resumeButton.getPreferredSize(); cancelButton.setPreferredSize(preferredSize); pauseButton.setPreferredSize(preferredSize); removeButton.setPreferredSize(preferredSize); exitButton.setPreferredSize(preferredSize); cancelButton.setEnabled(false); pauseButton.setEnabled(false); resumeButton.setEnabled(false); setLayout(new FlowLayout(FlowLayout.RIGHT)); add(pauseButton); add(resumeButton); add(cancelButton); add(removeButton); add(exitButton); } /** * Add action listener to the desired button * * @param button name of button to which listener must be added * @param listener listener to be added */ void addActionListener(String button, ActionListener listener) { switch (button) { case "Cancel": cancelButton.addActionListener(listener); break; case "Pause": pauseButton.addActionListener(listener); break; case "Resume": resumeButton.addActionListener(listener); break; case "Remove": removeButton.addActionListener(listener); case "Exit": exitButton.addActionListener(listener); break; default: Logger.getLogger(ButtonPanel.class.getSimpleName()).log(Level.WARNING, "How " + "is this even possible?"); } } /** * Update button states depending on download status * * @param download download whose status alters the state of the buttons */ void updateButtons(Download download) { if (download == null) { pauseButton.setEnabled(false); resumeButton.setEnabled(false); removeButton.setEnabled(false); cancelButton.setEnabled(false); } else { DownloadStatus status = download.getStatus(); switch (status) { case DOWNLOADING: pauseButton.setEnabled(true); resumeButton.setEnabled(false); removeButton.setEnabled(false); cancelButton.setEnabled(true); break; case PAUSED: pauseButton.setEnabled(false); resumeButton.setEnabled(true); removeButton.setEnabled(false); cancelButton.setEnabled(true); break; case ERROR: pauseButton.setEnabled(false); resumeButton.setEnabled(true); removeButton.setEnabled(true); cancelButton.setEnabled(false); break; default: // COMPLETE or CANCELLED pauseButton.setEnabled(false); resumeButton.setEnabled(false); removeButton.setEnabled(true); cancelButton.setEnabled(false); } } } }
96cb07c10c1cdf218212aef20425066178ebabcf
2f3c04382a66dbf222c8587edd67a5df4bc80422
/src/com/cedar/cp/dto/model/virement/VirementAuthPointCK.java
e0e5add509ed24a92bf87b11dff95c306907da0d
[]
no_license
arnoldbendaa/cppro
d3ab6181cc51baad2b80876c65e11e92c569f0cc
f55958b85a74ad685f1360ae33c881b50d6e5814
refs/heads/master
2020-03-23T04:18:00.265742
2018-09-11T08:15:28
2018-09-11T08:15:28
141,074,966
0
0
null
null
null
null
UTF-8
Java
false
false
3,749
java
/* */ package com.cedar.cp.dto.model.virement; /* */ /* */ import com.cedar.cp.dto.base.PrimaryKey; /* */ import com.cedar.cp.dto.model.ModelCK; /* */ import com.cedar.cp.dto.model.ModelPK; /* */ import java.io.Serializable; /* */ /* */ public class VirementAuthPointCK extends VirementRequestCK /* */ implements Serializable /* */ { /* */ protected VirementAuthPointPK mVirementAuthPointPK; /* */ /* */ public VirementAuthPointCK(ModelPK paramModelPK, VirementRequestPK paramVirementRequestPK, VirementAuthPointPK paramVirementAuthPointPK) /* */ { /* 32 */ super(paramModelPK, paramVirementRequestPK); /* */ /* 36 */ this.mVirementAuthPointPK = paramVirementAuthPointPK; /* */ } /* */ /* */ public VirementAuthPointPK getVirementAuthPointPK() /* */ { /* 44 */ return this.mVirementAuthPointPK; /* */ } /* */ /* */ public PrimaryKey getPK() /* */ { /* 52 */ return this.mVirementAuthPointPK; /* */ } /* */ /* */ public int hashCode() /* */ { /* 60 */ return this.mVirementAuthPointPK.hashCode(); /* */ } /* */ /* */ public boolean equals(Object obj) /* */ { /* 69 */ if ((obj instanceof VirementAuthPointPK)) { /* 70 */ return obj.equals(this); /* */ } /* 72 */ if (!(obj instanceof VirementAuthPointCK)) { /* 73 */ return false; /* */ } /* 75 */ VirementAuthPointCK other = (VirementAuthPointCK)obj; /* 76 */ boolean eq = true; /* */ /* 78 */ eq = (eq) && (this.mModelPK.equals(other.mModelPK)); /* 79 */ eq = (eq) && (this.mVirementRequestPK.equals(other.mVirementRequestPK)); /* 80 */ eq = (eq) && (this.mVirementAuthPointPK.equals(other.mVirementAuthPointPK)); /* */ /* 82 */ return eq; /* */ } /* */ /* */ public String toString() /* */ { /* 90 */ StringBuffer sb = new StringBuffer(); /* 91 */ sb.append(super.toString()); /* 92 */ sb.append("["); /* 93 */ sb.append(this.mVirementAuthPointPK); /* 94 */ sb.append("]"); /* 95 */ return sb.toString(); /* */ } /* */ /* */ public String toTokens() /* */ { /* 103 */ StringBuffer sb = new StringBuffer(); /* 104 */ sb.append("VirementAuthPointCK|"); /* 105 */ sb.append(super.getPK().toTokens()); /* 106 */ sb.append('|'); /* 107 */ sb.append(this.mVirementAuthPointPK.toTokens()); /* 108 */ return sb.toString(); /* */ } /* */ /* */ public static ModelCK getKeyFromTokens(String extKey) /* */ { /* 113 */ String[] token = extKey.split("[|]"); /* 114 */ int i = 0; /* 115 */ checkExpected("VirementAuthPointCK", token[(i++)]); /* 116 */ checkExpected("ModelPK", token[(i++)]); /* 117 */ i++; /* 118 */ checkExpected("VirementRequestPK", token[(i++)]); /* 119 */ i++; /* 120 */ checkExpected("VirementAuthPointPK", token[(i++)]); /* 121 */ i = 1; /* 122 */ return new VirementAuthPointCK(ModelPK.getKeyFromTokens(token[(i++)] + '|' + token[(i++)]), VirementRequestPK.getKeyFromTokens(token[(i++)] + '|' + token[(i++)]), VirementAuthPointPK.getKeyFromTokens(token[(i++)] + '|' + token[(i++)])); /* */ } /* */ /* */ private static void checkExpected(String expected, String found) /* */ { /* 131 */ if (!expected.equals(found)) /* 132 */ throw new IllegalArgumentException("expected=" + expected + " found=" + found); /* */ } /* */ } /* Location: /home/oracle/coa/cp.ear/cp-extracted/utc.war/cp-common.jar * Qualified Name: com.cedar.cp.dto.model.virement.VirementAuthPointCK * JD-Core Version: 0.6.0 */
2af7de74a8678b8aeb16f85f43da646ea195ad54
37c281ee00e643d0ccf36630c0367d21cd4c0a6e
/src/main/java/uk/ac/ebi/intact/jami/model/extension/factory/IntactBinaryInteractionFactory.java
709c65787a76ae38494a5dcbe63f8297a423c257
[]
no_license
EBI-IntAct/intact-jami
34ec21fe0d53deb8fcc7f611e2f734fc8b34dc62
352155804856fd1415e731afb979a148f6d58bf8
refs/heads/master
2023-08-03T14:17:13.836990
2022-08-25T17:30:34
2022-08-25T17:30:34
61,366,681
0
0
null
2023-04-05T08:26:09
2016-06-17T10:40:27
Java
UTF-8
Java
false
false
6,146
java
package uk.ac.ebi.intact.jami.model.extension.factory; import psidev.psi.mi.jami.binary.BinaryInteraction; import psidev.psi.mi.jami.binary.BinaryInteractionEvidence; import psidev.psi.mi.jami.binary.ModelledBinaryInteraction; import psidev.psi.mi.jami.binary.impl.BinaryInteractionWrapper; import psidev.psi.mi.jami.binary.impl.DefaultBinaryInteraction; import psidev.psi.mi.jami.factory.BinaryInteractionFactory; import psidev.psi.mi.jami.model.*; import psidev.psi.mi.jami.utils.clone.InteractionCloner; import uk.ac.ebi.intact.jami.model.extension.IntactComplex; import uk.ac.ebi.intact.jami.model.extension.IntactInteractionEvidence; import uk.ac.ebi.intact.jami.model.extension.binary.IntactBinaryInteractionEvidence; import uk.ac.ebi.intact.jami.model.extension.binary.IntactBinaryInteractionEvidenceWrapper; import uk.ac.ebi.intact.jami.model.extension.binary.IntactModelledBinaryInteraction; import uk.ac.ebi.intact.jami.model.extension.binary.IntactModelledBinaryInteractionWrapper; /** * Intact extension of BinaryInteractionFactory * * @author Marine Dumousseau ([email protected]) * @version $Id$ * @since <pre>16/10/13</pre> */ public class IntactBinaryInteractionFactory implements BinaryInteractionFactory { public BinaryInteractionEvidence createSelfBinaryInteractionEvidenceFrom(InteractionEvidence interaction) { IntactBinaryInteractionEvidence binary = instantiateNewBinaryInteractionEvidence(); InteractionCloner.copyAndOverrideParticipantsEvidencesToBinary(interaction, binary, false, true); copyIntactEvidenceProperties(interaction, binary); return binary; } public BinaryInteraction createBasicBinaryInteractionFrom(Interaction interaction, Participant p1, Participant p2, CvTerm expansionMethod) { BinaryInteraction binary = instantiateNewBinaryInteraction(); binary.setComplexExpansion(expansionMethod); InteractionCloner.copyAndOverrideBasicInteractionProperties(interaction, binary, false, true); binary.setParticipantA(p1); binary.setParticipantB(p2); return binary; } public BinaryInteractionEvidence createBinaryInteractionEvidenceFrom(InteractionEvidence interaction, ParticipantEvidence p1, ParticipantEvidence p2, CvTerm expansionMethod) { IntactBinaryInteractionEvidence binary = instantiateNewBinaryInteractionEvidence(); binary.setComplexExpansion(expansionMethod); copyIntactEvidenceProperties(interaction, binary); binary.setParticipantA(p1); binary.setParticipantB(p2); return binary; } public BinaryInteraction createSelfBinaryInteractionFrom(Interaction interaction) { BinaryInteraction<Participant> binary = instantiateNewBinaryInteraction(); InteractionCloner.copyAndOverrideBasicInteractionProperties(interaction, binary, false, true); InteractionCloner.copyAndOverrideBasicParticipantsToBinary(interaction, binary, false, true); return binary; } public ModelledBinaryInteraction createModelledBinaryInteractionFrom(ModelledInteraction interaction, ModelledParticipant p1, ModelledParticipant p2, CvTerm expansionMethod) { IntactModelledBinaryInteraction binary = instantiateNewModelledBinaryInteraction(); binary.setComplexExpansion(expansionMethod); copyIntactModelledInteractionProperties(interaction, binary); binary.setParticipantA(p1); binary.setParticipantB(p2); return binary; } public ModelledBinaryInteraction createSelfModelledBinaryInteractionFrom(ModelledInteraction interaction) { IntactModelledBinaryInteraction binary = instantiateNewModelledBinaryInteraction(); InteractionCloner.copyAndOverrideModelledParticipantsToBinary(interaction, binary, false, true); copyIntactModelledInteractionProperties(interaction, binary); return binary; } public BinaryInteraction createBinaryInteractionWrapperFrom(Interaction interaction) { return new BinaryInteractionWrapper(interaction); } public BinaryInteractionEvidence createBinaryInteractionEvidenceWrapperFrom(InteractionEvidence interaction) { return new IntactBinaryInteractionEvidenceWrapper((IntactInteractionEvidence)interaction); } public ModelledBinaryInteraction createModelledBinaryInteractionWrapperFrom(ModelledInteraction interaction) { return new IntactModelledBinaryInteractionWrapper((IntactComplex)interaction); } public BinaryInteraction instantiateNewBinaryInteraction() { return new DefaultBinaryInteraction(); } public IntactBinaryInteractionEvidence instantiateNewBinaryInteractionEvidence() { return new IntactBinaryInteractionEvidence(); } public IntactModelledBinaryInteraction instantiateNewModelledBinaryInteraction() { return new IntactModelledBinaryInteraction(); } private void copyIntactEvidenceProperties(InteractionEvidence interaction, IntactBinaryInteractionEvidence binary) { IntactInteractionEvidence intactSource = (IntactInteractionEvidence)interaction; InteractionCloner.copyAndOverrideInteractionEvidenceProperties(interaction, binary, false, true); binary.setAc(intactSource.getAc()); binary.setCreator(intactSource.getCreator()); binary.setUpdator(intactSource.getUpdator()); } private void copyIntactModelledInteractionProperties(ModelledInteraction interaction, IntactModelledBinaryInteraction binary) { IntactModelledBinaryInteraction intactSource = (IntactModelledBinaryInteraction)interaction; InteractionCloner.copyAndOverrideModelledInteractionProperties(interaction, binary, false, true); binary.setAc(intactSource.getAc()); binary.setCreator(intactSource.getCreator()); binary.setUpdator(intactSource.getUpdator()); binary.getLifecycleEvents().addAll(intactSource.getLifecycleEvents()); binary.setStatus(intactSource.getStatus()); binary.setCurrentOwner(intactSource.getCurrentOwner()); binary.setCurrentReviewer(intactSource.getCurrentReviewer()); } }
[ "[email protected]@cf1f37f2-6a01-11de-ba0c-230037762ff9" ]
[email protected]@cf1f37f2-6a01-11de-ba0c-230037762ff9
bf684290d0b970d6c019768cbe7d26ad51758e0d
b07fcfcf86d76389bf94348d2b1285a3530df380
/joss/src/main/java/org/javaswift/joss/client/core/TempURL.java
46c97fa08ec6477b3c8bdb1511fdc7c5ba5d3659
[ "Apache-2.0" ]
permissive
mouse3150/blooming
61db3b28ecbcd3340e3f6d860d451f4451a04d20
d919008dbc3a9891c0047b5be949ae8a7b783e76
refs/heads/master
2022-11-18T11:48:52.146037
2020-11-16T09:08:30
2020-11-16T09:08:30
41,457,550
0
0
Apache-2.0
2022-11-16T03:32:53
2015-08-27T01:00:43
Java
UTF-8
Java
false
false
2,171
java
package org.javaswift.joss.client.core; import org.javaswift.joss.util.HashSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TempURL { public static final Logger LOG = LoggerFactory.getLogger(TempURL.class); final private AbstractStoredObject object; final private String prefix; final private String method; private long expiry; public TempURL(final String method, final String prefix, final AbstractStoredObject object) { this.method = method; this.prefix = prefix; this.object = object; } public TempURL setServerTimeExpiry(final long seconds) { this.expiry = this.object.getAccount().getActualServerTimeInSeconds(seconds); return this; } public TempURL setFixedExpiry(final long seconds) { this.expiry = seconds; return this; } protected String getSignaturePlainText() { // Note that we're not making use here of the standard getPath() because we don't want the URL encoded names, // but the pure names. Swift uses the same approach to compose a signature plaintext with container/object names. String objectPath = this.prefix + "/" + this.object.getContainer().getName() + "/" + this.object.getName(); return this.method + "\n" + this.expiry + "\n" + objectPath; } protected String getSignature() { String plainText = getSignaturePlainText(); LOG.debug("Text to hash for the signature (CRLF replaced by readable \\n): "+plainText.replaceAll("\n", "\\n")); return HashSignature.getSignature(this.object.getContainer().getAccount().getHashPassword(), plainText); } public String getTempUrl() { return this.object.getPublicURL()+ "?temp_url_sig="+getSignature()+ "&temp_url_expires="+this.expiry; } @SuppressWarnings("SimplifiableIfStatement") public boolean verify(String signature, long expiry) { if (signature == null || !signature.equals(getSignature())) { return false; } return expiry > this.object.getAccount().getActualServerTimeInSeconds(0); } }
4d9b80f560a0c372f1d4af5518e770a90f6d8aa4
25a63d72461ceea7aeba01130cec39b0bc3fee61
/src/main/java/com/sjyy/jhy/photodemo2/A.java
882a156874e4427a034ddc1fa0ceaae1b1ad71d1
[]
no_license
Linymar/photodemo2
ee702b371ab9075c109cbc8ec267ebdcf99c762d
dfe5903d3d52ecccd8baa802966923a9689fbfd6
refs/heads/master
2020-04-07T20:21:48.937968
2018-11-22T11:07:19
2018-11-22T11:07:19
158,560,968
0
0
null
null
null
null
UTF-8
Java
false
false
779
java
package com.sjyy.jhy.photodemo2; import android.graphics.Bitmap; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; /** * Created by Administrator on 2017/4/23. */ public class A extends AppCompatActivity { private ImageView mPlayPicture; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_a); mPlayPicture = (ImageView) findViewById(R.id.imageView); //将intent1的数据传递到intent2 Bundle extras = getIntent().getExtras(); Bitmap zp = (Bitmap) extras.get("zp"); mPlayPicture.setImageBitmap(zp); } }
e7e95915b68c8d9d04f84d752819d0b8ffce7a8f
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_42_buggy/mutated/727/Tokeniser.java
164347ff87adb2c172563954cb97ad08a6ee5db1
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,098
java
package org.jsoup.parser; import org.jsoup.helper.Validate; import org.jsoup.nodes.Entities; import java.util.ArrayList; import java.util.List; /** * Readers the input stream into tokens. */ class Tokeniser { static final char replacementChar = '\uFFFD'; // replaces null character private CharacterReader reader; // html input private ParseErrorList errors; // errors found while tokenising private TokeniserState state = TokeniserState.Data; // current tokenisation state private Token emitPending; // the token we are about to emit on next read private boolean isEmitPending = false; private StringBuilder charBuffer = new StringBuilder(); // buffers characters to output as one token StringBuilder dataBuffer; // buffers data looking for </script> Token.Tag tagPending; // tag we are building up Token.Doctype doctypePending; // doctype building up Token.Comment commentPending; // comment building up private Token.StartTag lastStartTag; // the last start tag emitted, to test appropriate end tag private boolean selfClosingFlagAcknowledged = true; Tokeniser(CharacterReader reader, ParseErrorList errors) { this.reader = reader; this.errors = errors; } Token read() { if (!selfClosingFlagAcknowledged) { error("Self closing flag not acknowledged"); selfClosingFlagAcknowledged = true; } while (!isEmitPending) state.read(this, reader); // if emit is pending, a non-character token was found: return any chars in buffer, and leave token for next read: if (charBuffer.length() > 0) { String str = charBuffer.toString(); charBuffer.delete(0, charBuffer.length()); return new Token.Character(str); } else { isEmitPending = false; return emitPending; } } void emit(Token token) { Validate.isFalse(isEmitPending, "There is an unread token pending!"); emitPending = token; isEmitPending = true; if (token.type == Token.TokenType.StartTag) { Token.StartTag startTag = (Token.StartTag) token; lastStartTag = startTag; if (startTag.selfClosing) selfClosingFlagAcknowledged = false; } else if (token.type == Token.TokenType.EndTag) { Token.EndTag endTag = (Token.EndTag) token; if (endTag.attributes.size() > 0) error("Attributes incorrectly present on end tag"); } } void emit(String str) { // buffer strings up until last string token found, to emit only one token for a run of character refs etc. // does not set isEmitPending; read checks that charBuffer.append(str); } void emit(char c) { charBuffer.append(c); } TokeniserState getState() { return state; } void transition(TokeniserState state) { this.state = state; } void advanceTransition(TokeniserState state) { reader.advance(); this.state = state; } void acknowledgeSelfClosingFlag() { selfClosingFlagAcknowledged = true; } Character consumeCharacterReference(Character additionalAllowedCharacter, boolean inAttribute) { if (reader.isEmpty()) return null; if (additionalAllowedCharacter != null && additionalAllowedCharacter == reader.current()) return null; if (reader.matchesAny('\t', '\n', '\f', ' ', '<', '&')) return null; reader.mark(); if (reader.matchConsume("#")) { // numbered boolean isHexMode = reader.matchConsumeIgnoreCase("X"); String numRef = isHexMode ? reader.consumeHexSequence() : reader.consumeDigitSequence(); if (numRef.length() == 0) { // didn't match anything characterReferenceError("numeric reference with no numerals"); reader.rewindToMark(); return null; } if (!reader.matchConsume(";")) characterReferenceError("missing semicolon"); // missing semi int charval = -1; try { int base = isHexMode ? 16 : 10; charval = Integer.valueOf(numRef, base); } catch (NumberFormatException e) { } // skip if (charval == -1 || (charval >= 0xD800 && charval <= 0xDFFF) || charval > 0x10FFFF) { characterReferenceError("character outside of valid range"); return replacementChar; } else { // todo: implement number replacement table // todo: check for extra illegal unicode points as parse errors return (char) charval; } } else { // named // get as many letters as possible, and look for matching entities. unconsume backwards till a match is found String nameRef = reader.consumeLetterThenDigitSequence(); String origNameRef = new String(nameRef); // for error reporting. nameRef gets chomped looking for matches boolean looksLegit = reader.matches(';'); boolean found = false; while (nameRef.length() > 0 && !found) { if (Entities.isNamedEntity(nameRef)) found = true; else { nameRef = nameRef.substring(0, nameRef.length()-1); reader.unconsume(); } } if (!found) { if (looksLegit) // named with semicolon characterReferenceError(String.format("invalid named referenece '%s'", origNameRef)); reader.rewindToMark(); return null; } if (inAttribute && (reader.matchesLetter() || reader.matchesDigit() || reader.matchesAny('=', '-', '_'))) { // don't want that to match reader.rewindToMark(); return null; } if (!reader.matchConsume(";")) characterReferenceError("missing semicolon"); // missing semi return Entities.getCharacterByName(nameRef); } } Token.Tag createTagPending(boolean start) { tagPending = start ? new Token.StartTag() : new Token.EndTag(); return tagPending; } void emitTagPending() { tagPending.finaliseTag(); emit(tagPending); } void createCommentPending() { commentPending = new Token.Comment(); } void emitCommentPending() { emit(commentPending); } void createDoctypePending() { doctypePending = new Token.Doctype(); } void emitDoctypePending() { emit(doctypePending); } void createTempBuffer() { charBuffer = new StringBuilder(); } boolean isAppropriateEndTagToken() { return tagPending.tagName.equals(lastStartTag.tagName); } String appropriateEndTagName() { return lastStartTag.tagName; } void error(TokeniserState state) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), "Unexpected character '%s' in input state [%s]", reader.current(), state)); } void eofError(TokeniserState state) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), "Unexpectedly reached end of file (EOF) in input state [%s]", state)); } private void characterReferenceError(String message) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), "Invalid character reference: %s", message)); } private void error(String errorMsg) { if (errors.canAddError()) errors.add(new ParseError(reader.pos(), errorMsg)); } boolean currentNodeInHtmlNS() { // todo: implememnt namespaces correctly return true; // Element currentNode = currentNode(); // return currentNode != null && currentNode.namespace().equals("HTML"); } }
71a4002e9affe00a8e6a6ca6a13d3595a5b710fe
90c614d0c0678a7afd6990b5d84f381710b3ce07
/org/dicebag/modules/CombatTracker.java
69db20f91d48453891929cc217d6615cf6be81d2
[ "MIT" ]
permissive
Dyndrilliac/dice-bag
e877693c31bf449cd0a5f29af4dbc4109be699b9
e6968f7f85c86a2ec70927185ead32ef6f9371b7
refs/heads/master
2021-06-10T21:03:14.175112
2019-03-14T07:57:11
2019-03-14T07:57:11
9,109,558
1
0
null
null
null
null
UTF-8
Java
false
false
36,373
java
/* * Title: CombatTracker * Author: Matthew Boyette * Date: 2/19/2014 * * This class is an add-on module for DiceBag which allows a DM to track combat information like health, initiative, and the current round. * It interfaces with the DiceBag class so that initiative die rolls are recorded in the log automatically. * Currently only the v3.5 d20 rules are implemented but in a future version users will be able to seamlessly switch configurations. * Saving and loading combatants is also an option, as is only resetting characters or monsters if desired. * CombatTracker can also be used to track battlefield position. */ package org.dicebag.modules; import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.io.Serializable; import java.util.Collections; import java.util.LinkedList; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.KeyStroke; import org.dicebag.objects.Constants35E; import org.dicebag.objects.Creature; import org.dicebag.objects.Creature35E; import org.dicebag.objects.StatBlock35E; import api.gui.swing.ApplicationWindow; import api.gui.swing.RichTextPane; import api.util.EventHandler; import api.util.Support; public class CombatTracker implements Serializable { private final static long serialVersionUID = 1L; public final static String WINDOW_TITLE = "Combat Tracker" + " - " + "Round: "; private JComboBox<Creature> cboCreatureList = null; private LinkedList<Creature> characterList = null; private LinkedList<Creature> creatureList = null; private Creature curCreature = null; private int curCreatureIndex = 0; private boolean isDebugging = false; private JLabel lblCurrentCreature = null; private LinkedList<Creature> monsterList = null; private int numCharacters = 0; private int numMonsterTypes = 0; private int numRounds = 0; private DiceBag parent = null; private ApplicationWindow window = null; public CombatTracker(final DiceBag parent, final boolean isDebugging) { this.setParent(parent); this.setDebugging(isDebugging); this.reset(1); // Define a self-contained ActionListener event handler. // @formatter:off EventHandler<CombatTracker> myActionPerformed = new EventHandler<CombatTracker>(this) { private final static long serialVersionUID = 1L; @Override public final void run(final AWTEvent event) { ActionEvent actionEvent = (ActionEvent)event; CombatTracker cTracker = this.getParent(); ApplicationWindow cWindow = cTracker.getWindow(); RichTextPane output = cTracker.getParent().getOutput(); Creature current = null; Creature target = null; if (cTracker.getCboCreatureList() != null) { target = (Creature)cTracker.getCboCreatureList().getSelectedItem(); } if (cTracker.getCurrentCreature() != null) { current = cTracker.getCurrentCreature(); } if ((target != null) && (current != null)) { /* * JDK 7 allows string objects as the expression in a switch statement. This generally produces more efficient byte code compared * to a chain of if statements. http://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html */ switch (actionEvent.getActionCommand()) { case "Save Target": if (target != null) { target.openOrSaveFile(cWindow, false, cTracker.isDebugging()); } break; case "Damage Target": if (target != null) { int amount = cTracker.getIntegerInputString("How much?\nEnter zero to cancel.", "Damage " + target.getStatBlock() .getName()); if (amount != 0) { target.damage(amount); cWindow.reDrawGUI(); } } break; case "Heal Target": if (target != null) { int amount = cTracker.getIntegerInputString("How much?\nEnter zero to cancel.", "Heal " + target.getStatBlock() .getName()); if (amount != 0) { target.heal(amount); cWindow.reDrawGUI(); } } break; case "Move Target": if (target != null) { String prevPosition = target.getStatBlock().getPosition(); String nextPosition = cTracker.getCoordinateInputString("Where to? Prompt expects XX:YY coordinates." + "\nEnter " + prevPosition + " to cancel.", "Move " + target.getStatBlock().getName()); if (!nextPosition.equals(prevPosition)) { target.getStatBlock().setPosition(nextPosition); output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLUE, Color.WHITE, "Moving " + target.getStatBlock().getName() + " from " + prevPosition + " to " + nextPosition + ".\n\n"); cWindow.reDrawGUI(); } } break; case "Save Current": if (current != null) { current.openOrSaveFile(cTracker.getWindow(), false, cTracker.isDebugging()); } break; case "Damage Current": if (current != null) { int amount = cTracker.getIntegerInputString("How much?\nEnter zero to cancel.", "Damage " + current.getStatBlock() .getName()); if (amount != 0) { current.damage(amount); cWindow.reDrawGUI(); } } break; case "Heal Current": if (current != null) { int amount = cTracker.getIntegerInputString("How much?\nEnter zero to cancel.", "Heal " + current.getStatBlock() .getName()); if (amount != 0) { current.heal(amount); cWindow.reDrawGUI(); } } break; case "Move Current": if (current != null) { String prevPosition = current.getStatBlock().getPosition(); String nextPosition = cTracker.getCoordinateInputString("Where to? Prompt expects XX:YY coordinates." + "\nEnter " + prevPosition + " to cancel.", "Move " + current.getStatBlock().getName()); if (!nextPosition.equals(prevPosition)) { current.getStatBlock().setPosition(nextPosition); output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLUE, Color.WHITE, "Moving " + current.getStatBlock().getName() + " from " + prevPosition + " to " + nextPosition + ".\n\n"); cWindow.reDrawGUI(); } } break; case "Next Combatant": try { Creature next = cTracker.nextCombatant(); output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Next Combatant:\n", Color.GRAY, Color.WHITE, "\t\t\t " + next.toString() + "\n\n"); } catch (final Exception e) { break; } break; case "Reset All Creatures": output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Resetting All Parameters...\n\n"); cTracker.reset(1); cWindow.reDrawGUI(); break; case "Reset Characters Only": output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Resetting Character Parameters...\n\n"); cTracker.reset(2); cWindow.reDrawGUI(); break; case "Reset Monsters Only": output.append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Resetting Monster Parameters...\n\n"); cTracker.reset(3); cWindow.reDrawGUI(); break; default: break; } } } }; // Define a self-contained interface construction event handler. EventHandler<CombatTracker> myDrawGUI = new EventHandler<CombatTracker>(this) { private final static long serialVersionUID = 1L; @Override public final void run(final ApplicationWindow cWindow) { CombatTracker cTracker = this.getParent(); Container contentPane = cWindow.getContentPane(); JMenuBar menuBar = new JMenuBar(); JMenu targetMenu = new JMenu("Target Actions"); JMenuItem optSave = new JMenuItem("Save Target"); JMenuItem optDamage = new JMenuItem("Damage Target"); JMenuItem optHeal = new JMenuItem("Heal Target"); JMenuItem optMove = new JMenuItem("Move Target"); JMenu currentMenu = new JMenu("Current Actions"); JMenuItem opcSave = new JMenuItem("Save Current"); JMenuItem opcDamage = new JMenuItem("Damage Current"); JMenuItem opcHeal = new JMenuItem("Heal Current"); JMenuItem opcMove = new JMenuItem("Move Current"); JMenuItem opcNext = new JMenuItem("Next Combatant"); JMenu resetMenu = new JMenu("Reset Combat"); JMenuItem oprAll = new JMenuItem("Reset All Creatures"); JMenuItem oprChars = new JMenuItem("Reset Characters Only"); JMenuItem oprMons = new JMenuItem("Reset Monsters Only"); JLabel curLabel = new JLabel("Current: " + cTracker.getCurrentCreature().toString()); JPanel curPanel = new JPanel(); JLabel cboLabel = new JLabel("Target: "); JPanel cboPanel = new JPanel(); menuBar.setFont(Support.DEFAULT_TEXT_FONT); targetMenu.setFont(Support.DEFAULT_TEXT_FONT); optSave.setFont(Support.DEFAULT_TEXT_FONT); optSave.addActionListener(cWindow); optDamage.setFont(Support.DEFAULT_TEXT_FONT); optDamage.addActionListener(cWindow); optHeal.setFont(Support.DEFAULT_TEXT_FONT); optHeal.addActionListener(cWindow); optMove.setFont(Support.DEFAULT_TEXT_FONT); optMove.addActionListener(cWindow); currentMenu.setFont(Support.DEFAULT_TEXT_FONT); opcSave.setFont(Support.DEFAULT_TEXT_FONT); opcSave.addActionListener(cWindow); opcDamage.setFont(Support.DEFAULT_TEXT_FONT); opcDamage.addActionListener(cWindow); opcHeal.setFont(Support.DEFAULT_TEXT_FONT); opcHeal.addActionListener(cWindow); opcMove.setFont(Support.DEFAULT_TEXT_FONT); opcMove.addActionListener(cWindow); opcNext.setFont(Support.DEFAULT_TEXT_FONT); opcNext.addActionListener(cWindow); resetMenu.setFont(Support.DEFAULT_TEXT_FONT); oprAll.setFont(Support.DEFAULT_TEXT_FONT); oprAll.addActionListener(cWindow); oprChars.setFont(Support.DEFAULT_TEXT_FONT); oprChars.addActionListener(cWindow); oprMons.setFont(Support.DEFAULT_TEXT_FONT); oprMons.addActionListener(cWindow); targetMenu.setMnemonic('T'); optSave.setMnemonic('S'); optSave.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.KeyEvent.ALT_DOWN_MASK)); optDamage.setMnemonic('D'); optDamage.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.KeyEvent.ALT_DOWN_MASK)); optHeal.setMnemonic('H'); optHeal.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.KeyEvent.ALT_DOWN_MASK)); optMove.setMnemonic('M'); optMove.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.KeyEvent.ALT_DOWN_MASK)); currentMenu.setMnemonic('C'); opcSave.setMnemonic('S'); opcSave.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.KeyEvent.CTRL_DOWN_MASK)); opcDamage.setMnemonic('D'); opcDamage.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.KeyEvent.CTRL_DOWN_MASK)); opcHeal.setMnemonic('H'); opcHeal.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H, java.awt.event.KeyEvent.CTRL_DOWN_MASK)); opcMove.setMnemonic('M'); opcMove.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.KeyEvent.CTRL_DOWN_MASK)); opcNext.setMnemonic('N'); opcNext.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.KeyEvent.CTRL_DOWN_MASK)); resetMenu.setMnemonic('R'); oprAll.setMnemonic('A'); oprAll.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.KeyEvent.SHIFT_DOWN_MASK)); oprChars.setMnemonic('C'); oprChars.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.KeyEvent.SHIFT_DOWN_MASK)); oprMons.setMnemonic('M'); oprMons.setAccelerator(KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.KeyEvent.SHIFT_DOWN_MASK)); targetMenu.add(optSave); targetMenu.add(optDamage); targetMenu.add(optHeal); targetMenu.add(optMove); currentMenu.add(opcSave); currentMenu.add(opcDamage); currentMenu.add(opcHeal); currentMenu.add(opcMove); currentMenu.addSeparator(); currentMenu.add(opcNext); resetMenu.add(oprAll); resetMenu.add(oprChars); resetMenu.add(oprMons); menuBar.add(targetMenu); menuBar.add(currentMenu); menuBar.add(resetMenu); cTracker.setCboCreatureList(new JComboBox<Creature>()); cTracker.getCboCreatureList().setFont(Support.DEFAULT_TEXT_FONT); cTracker.getCboCreatureList().setEditable(false); cboLabel.setFont(Support.DEFAULT_TEXT_FONT); cboPanel.setLayout(new FlowLayout()); cboPanel.add(cboLabel); cboPanel.add(cTracker.getCboCreatureList()); curLabel.setFont(Support.DEFAULT_TEXT_FONT); curPanel.setLayout(new FlowLayout()); curPanel.add(curLabel); contentPane.setLayout(new BorderLayout()); contentPane.add(curPanel, BorderLayout.NORTH); contentPane.add(cboPanel, BorderLayout.CENTER); cTracker.setLblCurrentCreature(curLabel); for (int i = 0; i < cTracker.getCreatureList().size(); i++) { cTracker.getCboCreatureList().addItem(cTracker.getCreatureList().get(i)); } cTracker.getCboCreatureList().setSelectedIndex(cTracker.getCreatureList().indexOf(cTracker.getCurrentCreature())); cWindow.setJMenuBar(menuBar); cWindow.setTitle(CombatTracker.WINDOW_TITLE + cTracker.getNumRounds()); } }; this.setWindow(new ApplicationWindow(this.getParent().getWindow(), CombatTracker.WINDOW_TITLE + this.getNumRounds(), new Dimension(1100, 125), this.isDebugging(), false, myActionPerformed, myDrawGUI)); this.getWindow().reDrawGUI(); this.getWindow().setIconImageByResourceName("icon.png"); this.getWindow().pack(); // @formatter:on } public final JComboBox<Creature> getCboCreatureList() { return this.cboCreatureList; } public final LinkedList<Creature> getCharacterList() { return this.characterList; } public final boolean getChoiceInput(final String message, final String title) { return Support.getChoiceInput(this.getWindow(), message, title); } public String getCoordinateInputString(final String message, final String title) { String s; do { s = this.getInputString(message, title); } while (!s.matches("[0-9][0-9]:[0-9][0-9]")); final String[] coords = s.split(":"); if ((Integer.parseInt(coords[0]) < 1) || (Integer.parseInt(coords[1]) < 1)) { if (Integer.parseInt(coords[0]) < 1) { coords[0] = "01"; } if (Integer.parseInt(coords[1]) < 1) { coords[1] = "01"; } s = coords[0] + ":" + coords[1]; } return s; } public final LinkedList<Creature> getCreatureList() { return this.creatureList; } public final int getCurCreatureIndex() { return this.curCreatureIndex; } public final Creature getCurrentCreature() { return this.curCreature; } public final String getInputString(final String message, final String title) { return Support.getInputString(this.getWindow(), message, title); } public final int getIntegerInputString(final String message, final String title) { return Support.getIntegerInputString(this.getWindow(), message, title); } public final JLabel getLblCurrentCreature() { return this.lblCurrentCreature; } public final LinkedList<Creature> getMonsterList() { return this.monsterList; } public final int getNumCharacters() { return this.numCharacters; } public final int getNumMonsterTypes() { return this.numMonsterTypes; } public final int getNumRounds() { return this.numRounds; } public final DiceBag getParent() { return this.parent; } public final ApplicationWindow getWindow() { if (this.window != null) { return this.window; } else { return this.getParent().getWindow(); } } public final boolean isDebugging() { return this.isDebugging; } public Creature nextCombatant() { int index = this.getCurCreatureIndex(); Creature creature = null; do { index++; if (index >= this.getCreatureList().size()) { this.setNumRounds(this.getNumRounds() + 1); index = 0; this.getParent() .getOutput() .append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.MAGENTA, Color.WHITE, "- Round " + this.getNumRounds() + " -\n\n"); } creature = this.getCreatureList().get(index); } while (((Creature35E)creature).getStatBlock().getStatus() == Constants35E.Status.DEAD); this.setCurCreatureIndex(index); this.setCurrentCreature(this.getCreatureList().get(index)); this.getWindow().reDrawGUI(); return this.getCurrentCreature(); } public void reset(final int numMode) { this.setNumRounds(1); switch (numMode) { case 1: this.resetCharacters(); this.resetMonsters(); break; case 2: this.resetCharacters(); break; case 3: this.resetMonsters(); break; default: this.resetCharacters(); this.resetMonsters(); break; } this.setCreatureList(new LinkedList<Creature>()); this.getCreatureList().addAll(this.getCharacterList()); this.getCreatureList().addAll(this.getMonsterList()); Collections.sort(this.getCreatureList()); this.setCurrentCreature(this.getCreatureList().getFirst()); this.setCurCreatureIndex(this.getCreatureList().indexOf(this.getCurrentCreature())); this.getParent() .getOutput() .append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "Initial Combatants:\n"); for (int i = 0; i < this.getCreatureList().size(); i++) { this.getParent().getOutput().append(Color.GRAY, Color.WHITE, "\t\t\t " + this.getCreatureList().get(i).toString() + "\n"); } this.getParent().getOutput().append(Color.BLACK, Color.WHITE, "\n"); this.getParent() .getOutput() .append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.MAGENTA, Color.WHITE, "- Round " + this.getNumRounds() + " -\n\n"); this.getParent() .getOutput() .append(Color.BLACK, Color.WHITE, "[" + Support.getDateTimeStamp() + "]: ", Color.BLACK, Color.WHITE, "First Combatant:\n", Color.GRAY, Color.WHITE, "\t\t\t " + this.getCurrentCreature().toString() + "\n\n"); } public void resetCharacters() { LinkedList<Creature> characterList = new LinkedList<Creature>(); this.setNumCharacters(this.getIntegerInputString("How many characters?", "Characters Setup")); for (int i = 1; i <= this.getNumCharacters(); i++) { Creature character = null; if (this.getChoiceInput("Would you like to load a previously saved character?", "Load Previously Saved Character?")) { character = new Creature35E(this.getParent(), this, new StatBlock35E()); character.openOrSaveFile(this.getWindow(), true, this.isDebugging()); if (this.getChoiceInput("Would you like to change this character's current HP?", "Change HP?")) { final int curHealth = this.getIntegerInputString("What is the current HP of " + character.getStatBlock().getName() + "?", "Characters Setup"); character.getStatBlock().setCurHealth(curHealth); character.updateStatus(); } if (this.getChoiceInput("Would you like to change this character's current position?", "Change Position?")) { final String position = this.getCoordinateInputString("What is the battle grid position of " + character.getStatBlock().getName() + "?" + "\nPrompt expects XX:YY coordinates.", "Characters Setup"); character.getStatBlock().setPosition(position); } if (this.getChoiceInput("Would you like to change this character's current initiative?", "Change Initiative?")) { character.rollInitiative(false); } } else { final String name = this.getInputString("What is the name of character " + i + "?", "Characters Setup"); final String position = this.getCoordinateInputString("What is the battle grid position of " + name + "?" + "\nPrompt expects XX:YY coordinates.", "Characters Setup"); final int curHealth = this.getIntegerInputString("What is the current HP of " + name + "?", "Characters Setup"); final int maxHealth = this.getIntegerInputString("What is the maximum HP of " + name + "?", "Characters Setup"); final int initBonus = this.getIntegerInputString("What is the initiative modifier of " + name + "?", "Characters Setup"); character = new Creature35E(this.getParent(), this, new StatBlock35E(curHealth, initBonus, maxHealth, name, position)); character.updateStatus(); character.rollInitiative(false); } if (character != null) { characterList.add(character); } } this.setCharacterList(characterList); } public void resetMonsters() { LinkedList<Creature> monsterList = new LinkedList<Creature>(); this.setNumMonsterTypes(this.getIntegerInputString("How many types of monsters?", "Monsters Setup")); for (int i = 1; i <= this.getNumMonsterTypes(); i++) { final int numMonsters = this.getIntegerInputString("How many are there of monster type " + i + "?", "Monsters Setup"); if (numMonsters > 0) { Creature monster = null; if (this.getChoiceInput("Would you like to load previously saved monsters of type " + i + "?", "Load Previously Saved Monsters?")) { for (int j = 1; j <= numMonsters; j++) { monster = new Creature35E(this.getParent(), this, new StatBlock35E()); monster.openOrSaveFile(this.getWindow(), true, this.isDebugging()); if (this.getChoiceInput("Would you like to rename this loaded monster in sequential order?", "Rename Loaded Monster?")) { final int numberIndex = (monster.getStatBlock().getName().length() - 1); monster.getStatBlock().setName(monster.getStatBlock().getName().substring(0, numberIndex) + j); } if (this.getChoiceInput("Would you like to change this monster's current HP?", "Change HP?")) { final int curHealth = this.getIntegerInputString("What is the current HP of " + monster.getStatBlock().getName() + "?", "Monsters Setup"); monster.getStatBlock().setCurHealth(curHealth); monster.updateStatus(); } if (this.getChoiceInput("Would you like to change this monster's current position?", "Change Position?")) { String position = this.getCoordinateInputString("What is the battle grid position of " + monster.getStatBlock().getName() + "?" + "\nPrompt expects XX:YY coordinates.", "Monsters Setup"); monster.getStatBlock().setPosition(position); } if (this.getChoiceInput("Would you like to change this monster's current initiative?", "Change Initiative?")) { monster.rollInitiative(false); } if (monster != null) { monsterList.add(monster); } } } else { final String name = this.getInputString("What is the name of monster type " + i + "?", "Monsters Setup"); final int maxHealth = this.getIntegerInputString("What is the maximum HP of monster type " + i + "?", "Monsters Setup"); final int initBonus = this.getIntegerInputString("What is the initiative modifier of monster type " + i + "?", "Monsters Setup"); for (int j = 1; j <= numMonsters; j++) { final String sequencedName = (name + " " + j); final String position = this.getCoordinateInputString("What is the battle grid position of " + sequencedName + "?\nPrompt expects XX:YY coordinates.", "Monsters Setup"); monster = new Creature35E(this.getParent(), this, new StatBlock35E(initBonus, maxHealth, sequencedName, position)); if (this.getChoiceInput("Would you like to change this monster's current HP?", "Change HP?")) { final int curHealth = this.getIntegerInputString("What is the current HP of " + monster.getStatBlock().getName() + "?", "Monsters Setup"); monster.getStatBlock().setCurHealth(curHealth); } monster.updateStatus(); monster.rollInitiative(false); if (monster != null) { monsterList.add(monster); } } } } } this.setMonsterList(monsterList); } public final void setCboCreatureList(final JComboBox<Creature> cboCreatureList) { this.cboCreatureList = cboCreatureList; } public final void setCharacterList(final LinkedList<Creature> characterList) { this.characterList = characterList; } public final void setCreatureList(final LinkedList<Creature> creatureList) { this.creatureList = creatureList; } public final void setCurCreatureIndex(final int curCreatureIndex) { this.curCreatureIndex = curCreatureIndex; } public final void setCurrentCreature(final Creature creature) { this.curCreature = creature; } public final void setDebugging(final boolean isDebugging) { this.isDebugging = isDebugging; } public final void setLblCurrentCreature(final JLabel lblCurrentCreature) { this.lblCurrentCreature = lblCurrentCreature; } public final void setMonsterList(final LinkedList<Creature> monsterList) { this.monsterList = monsterList; } public final void setNumCharacters(final int numCharacters) { this.numCharacters = numCharacters; } public final void setNumMonsterTypes(final int numMonsterTypes) { this.numMonsterTypes = numMonsterTypes; } public final void setNumRounds(final int numRounds) { this.numRounds = numRounds; } public final void setParent(final DiceBag parent) { this.parent = parent; } public final void setWindow(final ApplicationWindow window) { this.window = window; } }
640f8c06f406d641323ddd410a7f6151928925b1
138053e09c5a67ce1890e006b75f796667976baa
/src/main/java/com/ptit/restaurantmanagement/ui/InvoiceReportDialog.java
636e74f4e7206fbf0496b72f172cd0696af6f25f
[]
no_license
linhvnguyen9/restaurant-management
c873aa26cc5b68ada2c7fcb113d55aa955fec936
7c7ad4b258e16dd96087399e2cdf248c92404d5a
refs/heads/master
2022-06-26T16:13:40.002220
2019-11-17T06:32:22
2019-11-17T06:32:22
215,780,538
0
0
null
2022-06-21T02:14:53
2019-10-17T11:54:52
Java
UTF-8
Java
false
false
5,692
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.ptit.restaurantmanagement.ui; import com.ptit.restaurantmanagement.dao.CustomerDao; import com.ptit.restaurantmanagement.database.dto.CustomerIdAndInvoiceSumDto; import javax.swing.table.DefaultTableModel; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author linh */ public class InvoiceReportDialog extends javax.swing.JDialog { /** * Creates new form InvoiceReportDialog */ public InvoiceReportDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); try { CustomerDao dao = new CustomerDao(); DefaultTableModel dtm = (DefaultTableModel)TableInvoiceReport.getModel(); for (CustomerIdAndInvoiceSumDto dto : dao.displayCustomerTotalAmountPurchased()) { dtm.addRow(dto.toObject()); } } catch (SQLException ex) { Logger.getLogger(InvoiceReportDialog.class.getName()).log(Level.SEVERE, null, ex); } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); TableInvoiceReport = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); TableInvoiceReport.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Customer ID", "Customer Name", "Total amount" } )); jScrollPane1.setViewportView(TableInvoiceReport); if (TableInvoiceReport.getColumnModel().getColumnCount() > 0) { TableInvoiceReport.getColumnModel().getColumn(2).setResizable(false); } javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(InvoiceReportDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(InvoiceReportDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(InvoiceReportDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(InvoiceReportDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the dialog */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { InvoiceReportDialog dialog = new InvoiceReportDialog(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTable TableInvoiceReport; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration//GEN-END:variables }
a1f0b4a710e35e52c75350567176b7c190beabb7
076c9297901f6363d499b17040a67c601baa06ff
/src/main/java/com/shallowan/spring/boot/repository/impl/UserRepositoryImpl.java
1f14c393f770533176034fd4221df7bc6765a496
[]
no_license
b2stry/thymeleaf-demo
67e871497be6e9e03a933cc32a95950a09f514fa
bc8122cfa88efd7f96d32fc74c234da119a46545
refs/heads/master
2021-05-11T11:49:45.954485
2018-01-16T14:25:30
2018-01-16T14:25:30
117,645,691
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
package com.shallowan.spring.boot.repository.impl; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicLong; import org.springframework.stereotype.Repository; import com.shallowan.spring.boot.domain.User; import com.shallowan.spring.boot.repository.UserRepository; @Repository public class UserRepositoryImpl implements UserRepository { private static AtomicLong counter = new AtomicLong(); // 计数器 private final ConcurrentMap<Long, User> userMap = new ConcurrentHashMap<>(); @Override public User saveOrUpdateUser(User user) { Long id = user.getId(); if (id == null) { // 新建 id = counter.incrementAndGet(); user.setId(id); } this.userMap.put(id, user); return user; } @Override public void deleteUser(Long id) { this.userMap.remove(id); } @Override public User getUserById(Long id) { return this.userMap.get(id); } @Override public List<User> listUsers() { return new ArrayList<User>(this.userMap.values()); } }
8e4275ef192da287f01196f66f19ecec50354998
3a9d8bb425c768e2bda667b25455ab4d7bcd01f7
/Calc3D/src/com/calc3d/app/panels/JSliderWithTextField.java
9b3fc9ce44e487605b057a0a8b0f0a6fd072f106
[]
no_license
lucasasecas/Procrustes3D
c804e61788c65f55fbb3972eacf13b07e340d5a7
9fae4f1d4ecc30dba340f008525b0af1184f34cd
refs/heads/master
2020-09-22T16:43:57.839287
2015-02-11T16:43:04
2015-02-11T16:43:04
21,001,410
0
0
null
null
null
null
UTF-8
Java
false
false
9,149
java
/* */ package com.calc3d.app.panels; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.text.DecimalFormat; import java.text.NumberFormat; import javax.swing.GroupLayout; import javax.swing.JFormattedTextField; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; /** * Represents a slider control with an attached text field. * <p> */ public class JSliderWithTextField extends JPanel implements PropertyChangeListener, ChangeListener { /** The version id */ private static final long serialVersionUID = 1397687871572398181L; /** The slider control */ private JSlider slider; /** The text field control */ private JFormattedTextField textField; /** The minimum value */ private int min; /** The maximum value */ private int max; /** The value scale (used to allow not int values) */ private double scale; /** Pre-inverted scale value */ private double invScale; /** The format used by the text field */ private NumberFormat format; /** * Optional constructor. * @param min the minimum value * @param max the maximum value * @param initialValue the initial value * @see #JSliderWithTextField(int, int, int, double, DecimalFormat) */ public JSliderWithTextField(int min, int max, int initialValue) { this(min, max, initialValue, 1.0, null); } /** * Full constructor. * @param min the minimum value * @param max the maximum value * @param initialValue the initial value * @param scale the scale factor between 0.0 and 1.0 * @param format the decimal format */ public JSliderWithTextField(int min, int max, int initialValue, double scale, NumberFormat format) { this.min = min; this.max = max; GroupLayout layout = new GroupLayout(this); this.setLayout(layout); this.slider = new JSlider(SwingConstants.HORIZONTAL, min, max, initialValue); this.slider.addChangeListener(this); if (scale == 1.0) { this.textField = new JFormattedTextField(NumberFormat.getIntegerInstance()); this.textField.setValue(initialValue); } else { this.textField = new JFormattedTextField(format); this.textField.setValue(initialValue * scale); } this.textField.addPropertyChangeListener(this); this.format = format; this.scale = scale; this.invScale = 1.0 / scale; layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup() .addComponent(this.slider) .addComponent(this.textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); layout.setVerticalGroup(layout.createParallelGroup() .addComponent(this.slider) .addComponent(this.textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); } /* (non-Javadoc) * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ @Override public void propertyChange(PropertyChangeEvent event) { if ("value".equals(event.getPropertyName())) { Number value = (Number)event.getNewValue(); if (value != null) { int val = 0; if (this.scale != 1.0) { val = (int)(value.doubleValue() * this.invScale); } else { val = value.intValue(); } // check the value against the min and max if (this.max >= val) { if (this.min <= val) { this.slider.setValue(val); } else { if (this.scale == 1.0) { this.textField.setValue(this.min); } else { this.textField.setValue(this.min * this.scale); } } } else { if (this.scale == 1.0) { this.textField.setValue(this.max); } else { this.textField.setValue(this.max * this.scale); } } } } } /* (non-Javadoc) * @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) */ @Override public void stateChanged(ChangeEvent event) { JSlider slider = (JSlider)event.getSource(); double value = slider.getValue() * this.scale; // update the text box if (!slider.getValueIsAdjusting()) { this.textField.setValue(value); } else { if (this.format != null) { this.textField.setText(this.format.format(value)); } else { this.textField.setText(String.valueOf((int)value)); } } // forward an event to the change listeners ChangeListener[] listeners = this.getListeners(ChangeListener.class); for (int i = 0; i < listeners.length; i++) { listeners[i].stateChanged(new ChangeEvent(this)); } } /** * Adds a change listener to this component to be notified when the value changes. * @param changeListener the change listener to add */ public void addChangeListener(ChangeListener changeListener) { this.listenerList.add(ChangeListener.class, changeListener); } /** * Sets the number of columns for the text field. * @param columns the number of columns */ public void setColumns(int columns) { this.textField.setColumns(columns); } /** * Returns the raw value of this component. * @return int */ public int getValue() { return this.slider.getValue(); } /** * Returns the scaled value of this component. * @return double */ public double getScaledValue() { return this.slider.getValue() * this.scale; } /** * Sets the current value of this component. * @param value the value */ public void setValue(int value) { this.slider.setValue(value); } /** * Returns the scale. * @return double */ public double getScale() { return this.scale; } /** * Sets the scale. * @param scale the scale */ public void setScale(double scale) { this.scale = scale; this.invScale = 1.0 / scale; } /** * Sets the number format used by the text field. * @param format the format */ public void setNumberFormat(NumberFormat format) { this.format = format; } /** * Returns the number format used by the text field. * @return NumberFormat */ public NumberFormat getNumberFormat() { return this.format; } /** * Returns the maximum value the slider will accept. * @return int */ public int getMaximum() { return this.slider.getMaximum(); } /** * Sets the maximum value the slider will accept. * @param value the maximum value */ public void setMaximum(int value) { this.slider.setMaximum(value); } /** * Returns the maximum value the slider will accept. * @return int */ public int getMinimum() { return this.slider.getMinimum(); } /** * Sets the minimum value the slider will accept. * @param value the minimum value */ public void setMinimum(int value) { this.slider.setMinimum(value); } /** * Returns the major tick spacing. * @return int */ public int getMajorTickSpacing() { return this.slider.getMajorTickSpacing(); } /** * Sets the major tick spacing. * @param spacing the spacing between major tick marks */ public void setMajorTickSpacing(int spacing) { this.slider.setMajorTickSpacing(spacing); } /** * Returns the minor tick spacing. * @return int */ public int getMinorTickSpacing() { return this.slider.getMinorTickSpacing(); } /** * Sets the minor tick spacing. * @param spacing the spacing between minor tick marks */ public void setMinorTickSpacing(int spacing) { this.slider.setMinorTickSpacing(spacing); } /** * Returns true if the labels should be shown. * @return boolean */ public boolean getPaintLabels() { return this.slider.getPaintLabels(); } /** * Sets the paint labels property of the slider. * @param flag true if the labels should be drawn */ public void setPaintLabels(boolean flag) { this.slider.setPaintLabels(flag); } /** * Returns true if the ticks should be shown. * @return boolean */ public boolean getPaintTicks() { return this.slider.getPaintTicks(); } /** * Sets the paint ticks property of the slider. * @param flag true if the ticks should be drawn */ public void setPaintTicks(boolean flag) { this.slider.setPaintTicks(flag); } /** * Returns true if the track should be shown. * @return boolean */ public boolean getPaintTrack() { return this.slider.getPaintTrack(); } /** * Sets the paint track property of the slider. * @param flag true if the track should be drawn */ public void setPaintTrack(boolean flag) { this.slider.setPaintTrack(flag); } /** * Returns true if the slider should snap to tick values. * @return boolean */ public boolean getSnapToTicks() { return this.slider.getSnapToTicks(); } /** * Sets the snap to ticks property of the slider. * @param flag true if the slider should snap to ticks */ public void setSnapToTicks(boolean flag) { this.slider.setSnapToTicks(flag); } }
3f98dd3d041b2e5edd67bfbd3c05b5ec04c6cb35
761d270dc0d8e37c79b61488e10d9b1664aebfbc
/SiteMonitorWidget/gen/com/msi/unlockingandroid/sitemonitor/R.java
7c99afc6d47e870ce69ae16c6dd6f12bb24fb3f1
[]
no_license
darwelX/Anaya-Android
87da419b5452dfeffca979732ed8ba129d56386a
18da0d2fae796e80a28ad065cbb536c3bf6ac3ab
refs/heads/master
2021-01-12T07:56:42.909544
2016-12-21T14:38:13
2016-12-21T14:38:13
77,056,636
0
0
null
null
null
null
UTF-8
Java
false
false
1,680
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.msi.unlockingandroid.sitemonitor; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class id { public static final int btnSaveSite=0x7f060003; public static final int btnVisitSite=0x7f060004; public static final int etSiteHomePageURL=0x7f060002; public static final int etSiteName=0x7f060000; public static final int etSiteURL=0x7f060001; public static final int siteMessage=0x7f060009; public static final int siteName=0x7f060007; public static final int tvSiteMessage=0x7f060005; public static final int updateTime=0x7f060008; public static final int widgetLayout=0x7f060006; } public static final class layout { public static final int main=0x7f030000; public static final int monitor=0x7f030001; } public static final class string { public static final int app_name=0x7f050001; public static final int instructions=0x7f050000; public static final int save_site=0x7f050005; public static final int site_homepage_url=0x7f050004; public static final int site_name=0x7f050002; public static final int site_url=0x7f050003; public static final int visit_site=0x7f050006; } public static final class xml { public static final int sitemonitorwidget=0x7f040000; } }
703f80de1e55b4005544ef919c6b51a34ae3439b
95c49f466673952b465e19a5ee3ae6eff76bee00
/src/main/java/com/zhihu/android/topic/widget/MovieMetaBottomCard.java
39b419317a9f96dabc3d5d0f968c37cb869c6286
[]
no_license
Phantoms007/zhihuAPK
58889c399ae56b16a9160a5f48b807e02c87797e
dcdbd103436a187f9c8b4be8f71bdf7813b6d201
refs/heads/main
2023-01-24T01:34:18.716323
2020-11-25T17:14:55
2020-11-25T17:14:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,527
java
package com.zhihu.android.topic.widget; import android.content.Context; import android.net.Uri; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.cardview.widget.CardView; import com.secneo.apkwrapper.C6969H; import com.zhihu.android.R; import com.zhihu.android.api.model.Topic; import com.zhihu.android.app.p1311ui.fragment.BaseFragment; import com.zhihu.android.app.router.RouterUrl; import com.zhihu.android.app.router.ZRouter; import com.zhihu.android.app.util.Dp2Px; import com.zhihu.android.app.util.GuestUtils; import com.zhihu.android.base.widget.ZHConstraintLayout; import com.zhihu.android.data.analytics.ZA; import com.zhihu.android.data.analytics.ZAEvent; import com.zhihu.android.topic.p1945h.TopicCommonUtil; import com.zhihu.android.topic.p1945h.TopicJumpHelper; import com.zhihu.android.topic.p1950k.ZUIZAUtils; import com.zhihu.p2177za.proto.C31346k; import com.zhihu.p2177za.proto.proto3.p2180a.C31368a; import com.zhihu.p2177za.proto.proto3.p2180a.C31382e; import kotlin.Metadata; import kotlin.p2243e.p2245b.C32569u; import kotlin.p2243e.p2245b.DefaultConstructorMarker; @Metadata /* compiled from: MovieMetaBottomCard.kt */ public final class MovieMetaBottomCard extends CardView { /* renamed from: a */ private ZHConstraintLayout f90564a; /* renamed from: b */ private ZHConstraintLayout f90565b; /* renamed from: c */ private Topic f90566c; /* renamed from: d */ private BaseFragment f90567d; /* access modifiers changed from: package-private */ @Metadata /* renamed from: com.zhihu.android.topic.widget.MovieMetaBottomCard$a */ /* compiled from: MovieMetaBottomCard.kt */ public static final class View$OnClickListenerC25928a implements View.OnClickListener { /* renamed from: a */ public static final View$OnClickListenerC25928a f90568a = new View$OnClickListenerC25928a(); View$OnClickListenerC25928a() { } public final void onClick(View view) { } } public MovieMetaBottomCard(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0, 4, null); } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ MovieMetaBottomCard(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker pVar) { this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public MovieMetaBottomCard(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); C32569u.m150519b(context, C6969H.m41409d("G6A8CDB0EBA28BF")); m126497a(context, attributeSet, i); } /* renamed from: a */ private final void m126497a(Context context, AttributeSet attributeSet, int i) { removeAllViews(); View inflate = LayoutInflater.from(context).inflate(R.layout.zv, (ViewGroup) this, false); addView(inflate); View findViewById = inflate.findViewById(R.id.launch_question_layout); C32569u.m150513a((Object) findViewById, "view.findViewById(R.id.launch_question_layout)"); this.f90564a = (ZHConstraintLayout) findViewById; View findViewById2 = inflate.findViewById(R.id.write_answer_layout); C32569u.m150513a((Object) findViewById2, "view.findViewById(R.id.write_answer_layout)"); this.f90565b = (ZHConstraintLayout) findViewById2; setOnClickListener(View$OnClickListenerC25928a.f90568a); ZHConstraintLayout zHConstraintLayout = this.f90564a; if (zHConstraintLayout == null) { C32569u.m150520b("launchQuestionLayout"); } zHConstraintLayout.setOnClickListener(new View$OnClickListenerC25929b(this)); ZHConstraintLayout zHConstraintLayout2 = this.f90565b; if (zHConstraintLayout2 == null) { C32569u.m150520b("writeAnswerLayout"); } zHConstraintLayout2.setOnClickListener(new View$OnClickListenerC25930c(this)); setCardElevation((float) Dp2Px.m83490a(3)); setRadius((float) Dp2Px.m83490a(27)); } /* access modifiers changed from: package-private */ @Metadata /* renamed from: com.zhihu.android.topic.widget.MovieMetaBottomCard$b */ /* compiled from: MovieMetaBottomCard.kt */ public static final class View$OnClickListenerC25929b implements View.OnClickListener { /* renamed from: a */ final /* synthetic */ MovieMetaBottomCard f90569a; View$OnClickListenerC25929b(MovieMetaBottomCard movieMetaBottomCard) { this.f90569a = movieMetaBottomCard; } public final void onClick(View view) { this.f90569a.m126496a(); } } /* access modifiers changed from: package-private */ @Metadata /* renamed from: com.zhihu.android.topic.widget.MovieMetaBottomCard$c */ /* compiled from: MovieMetaBottomCard.kt */ public static final class View$OnClickListenerC25930c implements View.OnClickListener { /* renamed from: a */ final /* synthetic */ MovieMetaBottomCard f90570a; View$OnClickListenerC25930c(MovieMetaBottomCard movieMetaBottomCard) { this.f90570a = movieMetaBottomCard; } public final void onClick(View view) { this.f90570a.m126499b(); } } /* renamed from: a */ public final void mo110747a(Topic topic, BaseFragment baseFragment) { this.f90566c = topic; this.f90567d = baseFragment; ZHConstraintLayout zHConstraintLayout = this.f90564a; if (zHConstraintLayout == null) { C32569u.m150520b(C6969H.m41409d("G6582C014BC389A3CE31D8441FDEBEFD6708CC00E")); } Topic topic2 = topic; ZUIZAUtils.m125246a(zHConstraintLayout, "发起提问", C6969H.m41409d("G5E91DC0EBA01BE2CF51A9947FC"), C31368a.EnumC31371c.OpenUrl, (C31382e.EnumC31385c) null, topic2); ZHConstraintLayout zHConstraintLayout2 = this.f90565b; if (zHConstraintLayout2 == null) { C32569u.m150520b("writeAnswerLayout"); } ZUIZAUtils.m125246a(zHConstraintLayout2, "写影评", C6969H.m41409d("G5E91DC0EBA16A225EB3C955EFBE0D4"), C31368a.EnumC31371c.OpenUrl, (C31382e.EnumC31385c) null, topic2); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: a */ private final void m126496a() { String str; Topic topic = this.f90566c; if (topic == null || (str = topic.f40366id) == null) { str = ""; } if (TopicCommonUtil.m123941a(this.f90567d, str, getContext().getString(R.string.dlr), C25931d.f90571a)) { ZRouter.m72966a(getContext(), new RouterUrl.C14428a(Uri.parse(C6969H.m41409d("G738BDC12AA6AE466E71D9B07"))).mo76341a(C6969H.m41409d("G6F91DA178024A439EF0D"), str).mo76344a(false).mo76345a()); } } /* access modifiers changed from: package-private */ @Metadata /* renamed from: com.zhihu.android.topic.widget.MovieMetaBottomCard$d */ /* compiled from: MovieMetaBottomCard.kt */ public static final class C25931d implements GuestUtils.PrePromptAction { /* renamed from: a */ public static final C25931d f90571a = new C25931d(); C25931d() { } @Override // com.zhihu.android.app.util.GuestUtils.PrePromptAction public final void call() { ZAEvent a = ZA.m91617a(C31346k.EnumC31349c.Upvote); C32569u.m150513a((Object) a, C6969H.m41409d("G53A29B1FA935A53DAE2F935CFBEACD995D9AC51FF105BB3FE91A9501")); a.mo87714f().mo87673e(); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ /* renamed from: b */ private final void m126499b() { String str; Topic topic = this.f90566c; if (topic == null || (str = topic.f40366id) == null) { str = ""; } if (TopicCommonUtil.m123941a(this.f90567d, str, getContext().getString(R.string.dlp), null)) { String string = getContext().getString(R.string.dpr); C32569u.m150513a((Object) string, "context.getString(R.stri…itor_title_write_comment)"); TopicJumpHelper.f88360a.mo109564a(getContext(), this.f90566c, string, "_3"); } } }
285b1938053693efa5802f4db70a2ba17c0b8caf
f55259cff31b62794ce11be5c5317661b88df9b0
/SonarBat/Engines/Engine 128/src/sonar/gamestates/states/Inventory.java
feb04eb1e8accce590b6e09a4434526188af3e1f
[]
no_license
ebeecroft/SonarBat
465c8c56e632b36cd758757da8418c75a4302c81
0a1836e432c023f821a07e1c0b632e6a93997d1b
refs/heads/master
2020-04-05T23:03:58.480158
2016-01-23T08:21:30
2016-01-23T08:21:30
23,338,566
0
0
null
null
null
null
UTF-8
Java
false
false
1,721
java
package sonar.gamestates.states; import sonar.GSM; import sonar.GameState; import sonar.Screen; import sonar.StateBuilder; import sonar.gamestates.states.levels.stages.entities.SpriteManager; import sonar.gamestates.states.levels.stages.entities.animations.energies.EnergyManager; import sonar.gamestates.states.levels.stages.entities.animations.tiles.TileManager; import sonar.gamestates.states.levels.stages.entities.animations.weapons.WeaponManager; public class Inventory extends GameState { //A class that will hold all energy for the player. private WeaponManager wmanage; private EnergyManager emanage; public Inventory(StateBuilder buildState) //Extends the GameState class { GameState.createGameState(buildState); } protected void update() { if(getKey() == null) { initKey(); setSmanage(new SpriteManager(getIdentity())); setTmanage(new TileManager(getSmanage())); wmanage = new WeaponManager(getSmanage()); emanage = new EnergyManager(getSmanage()); } getKey().update(); if(getKey().a) { resetKeyboard(); resetSmanage(); resetTmanage(); wmanage = null; emanage = null; GSM.switchStates(GSM.getPastState(), GSM.getCurrentState()); } } public void renderEnergies(Screen screen) { if(emanage != null) { for(int i = 0; i < emanage.getEnergies().length; i++) { if(emanage.getEnergies()[i] != null) emanage.getEnergies()[i].render(screen); } } } public void renderWeapons(Screen screen) { if(wmanage != null) { for(int i = 0; i < wmanage.getWeapons().length; i++) { if(wmanage.getWeapons()[i] != null) wmanage.getWeapons()[i].render(screen); } } } }
172bf412a8ff107e94baa2e26a5a0822117b5141
c9a51188b3dfb6f95a34c70e64feae85de10ff82
/gym-master/src/main/java/cn/edu/nwafu/cie/se2019/gym/model/TestOrder.java
0e58c2ac594177bf16f5cbb0e3e9b8efff3297f4
[]
no_license
CaiSinging/gym-system
440fc1c24dd2644a97c9f2974f1a1ce394888964
7805a74d3ff3d98d8fd85286e9fd118d380e2a88
refs/heads/master
2022-12-16T11:04:06.025792
2020-09-11T02:55:06
2020-09-11T02:55:06
294,577,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
package cn.edu.nwafu.cie.se2019.gym.model; import javax.persistence.*; import java.util.Date; @Entity @Table(name = "TestOrder") public class TestOrder {//体测预约表 @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long tno;//预约表编号 private Long gid;//客户编号 private Long tid;//教练编号 private Date tstart;//预约开始时间 public TestOrder() { } public TestOrder(Long gid, Long tid, Date tstart) { this.gid = gid; this.tid = tid; this.tstart = tstart; } public Long getTno() { return tno; } public void setTno(Long tno) { this.tno = tno; } public Long getGid() { return gid; } public void setGid(Long gid) { this.gid = gid; } public Long getTid() { return tid; } public void setTid(Long tid) { this.tid = tid; } public Date getTstart() { return tstart; } public void setTstart(Date tstart) { this.tstart = tstart; } }
4131c2ede43c0dcb2d389d0cde06075bfc5a9c9b
ad908c65c00d8618e63ce43b36a8b2ecfb181f51
/app/src/main/java/com/example/stopwatchapp/StopWatchAct.java
fc2c2ec1b11f62545453155a6d3dd290e4c687ab
[]
no_license
ctthanh123/StopWatchApp
33e9b8827f77ab57dbcbed35b3d6392be952b26c
3c39d0dc5f36e9aceb55461797750f038e947710
refs/heads/master
2022-06-23T15:26:07.275932
2020-05-07T14:23:18
2020-05-07T14:23:18
262,070,458
0
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
package com.example.stopwatchapp; import androidx.appcompat.app.AppCompatActivity; import android.graphics.Typeface; import android.os.Bundle; import android.os.SystemClock; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.Chronometer; import android.widget.ImageView; public class StopWatchAct extends AppCompatActivity { Button btnstart; Button btnstop; ImageView icanchor; Animation roundingalone; Chronometer timerhere; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stop_watch); btnstart = findViewById(R.id.btnstart); btnstop = findViewById(R.id.btnstop); icanchor = findViewById(R.id.icanchor); timerhere = findViewById(R.id.timerHere); btnstop.setAlpha(0); //import animation roundingalone = AnimationUtils.loadAnimation(this, R.anim.roundingalone); //import font chứ Typeface MMedium = Typeface.createFromAsset(getAssets(), "fonts/MMedium.ttf"); //custom font chữ btnstart.setTypeface(MMedium); btnstop.setTypeface(MMedium); //event btnstart btnstart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //start animation icanchor.startAnimation(roundingalone); btnstop.animate().alpha(1).translationY(-80).setDuration(300).start(); btnstart.animate().alpha(0).setDuration(300).start(); //start time timerhere.setBase(SystemClock.elapsedRealtime()); timerhere.start(); } }); //event btnstop btnstop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { icanchor.clearAnimation(); timerhere.stop(); } }); } }
ea6cb92908858748b577c54f8dcd975c00e1f2ce
28cdebb42eac139e1754d51b685547996eb2e541
/src/main/java/lyt/jingqi/badminton/service/JqBadmintonIndexConfigService.java
365b52bc79691feab4e525d1af8106132c750cf3
[]
no_license
ControlTaoGX/jqbmt
0263fa273f77678d892cf3b6251df5a50da87a73
5f6f2c7e88ec97a5cdec3596e4faf53b6b2167f6
refs/heads/master
2022-11-11T06:41:08.527598
2020-06-21T09:56:31
2020-06-21T09:56:31
273,875,981
1
0
null
null
null
null
UTF-8
Java
false
false
677
java
package lyt.jingqi.badminton.service; import lyt.jingqi.badminton.controller.vo.JqBadmintonIndexConfigGoodsVO; import lyt.jingqi.badminton.entity.IndexConfig; import lyt.jingqi.badminton.util.PageQueryUtil; import lyt.jingqi.badminton.util.PageResult; import java.util.List; public interface JqBadmintonIndexConfigService { PageResult getConfigsPage(PageQueryUtil pageQueryUtil); String saveIndexConfig(IndexConfig indexConfig); String updateIndexConfig(IndexConfig indexConfig); IndexConfig getIndexConfigById(Long id); List<JqBadmintonIndexConfigGoodsVO> getConfigGoodsForIndex(int configType, int number); Boolean deleteBatch(Long[] ids); }
1ac6c93a1f28c555eb28709a376a490faac740af
2272c2898df32ac8eef15186cbf89b792f5a9dd0
/src/base/EnumWarningType.java
8954b8cb11fecb8e50248ebb34599735a0e3963b
[]
no_license
nphoang1102/CS3733
90c67925a7e12deb6b0b68538e56d085aa89d90d
0f70d3c97b86830f693c5d03838fefbf2245161d
refs/heads/master
2020-03-25T22:17:51.181885
2018-08-09T23:59:43
2018-08-09T23:59:43
107,352,948
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package base; /** * Created by Bailey Sostek on 4/3/17. */ public enum EnumWarningType { NOTE ("[NOTE] " ), WARNING ("[WARNING] " ), ERROR ("[ERROR] " ); protected String prefix; EnumWarningType(String prefix){ this.prefix = prefix; } public String getPrefix(){ return this.prefix; } }
2c04a7fa3f3032c822767fba9c5a712b7bec5f58
47b2427cac6c4069324337cccdcdfdb1aaf3bb01
/src/main/java/com/task/databaseinspector/config/RoutingDataSourceConfig.java
3b3151d4c956defb4fae1bce2aaab6cc771e6c74
[]
no_license
rockarxiv/databaseinspector
f6bfd977f72a04bd711a2f39740cf1408f8fed16
bcb38a0c3d020ab1962affc2c1cb0e40a57bac07
refs/heads/master
2020-12-21T09:34:12.417086
2020-02-25T13:19:55
2020-02-25T13:19:55
236,386,065
0
0
null
null
null
null
UTF-8
Java
false
false
2,687
java
package com.task.databaseinspector.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy; import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import javax.sql.DataSource; import java.util.HashMap; @Configuration @EnableJpaRepositories( basePackages = "com.task.databaseinspector.dao.routing", entityManagerFactoryRef = "routingEntityManager", transactionManagerRef = "routingTransactionManager" ) public class RoutingDataSourceConfig { @Autowired @Qualifier("routingDataSource") private DataSource dataSource; @Value("${spring.jpa.database-platform}") private String dialect; @Bean public LocalContainerEntityManagerFactoryBean routingEntityManager() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource); em.setPackagesToScan("com.task.databaseinspector.busobj.entity.routing"); HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); HashMap<String, Object> properties = new HashMap<>(); properties.put("hibernate.hbm2ddl.auto", "none"); properties.put("hibernate.dialect", dialect); properties.put("hibernate.temp.use_jdbc_metadata_defaults", false); properties.put("showSql", true); properties.put("hibernate.implicit_naming_strategy", SpringImplicitNamingStrategy.class.getName()); properties.put("hibernate.physical_naming_strategy", SpringPhysicalNamingStrategy.class.getName()); em.setJpaPropertyMap(properties); return em; } @Bean public PlatformTransactionManager routingTransactionManager() { JpaTransactionManager transactionManager = new JpaTransactionManager(); transactionManager.setEntityManagerFactory(routingEntityManager().getObject()); return transactionManager; } }
5c6a48e3cc5f6ff7557751a96f5037ea26b7517f
5f0e3e77d1a9e49e6937202e52fd6ef6fcafc103
/src/test/java/es/pmg/tennisjazz/web/rest/UserResourceIT.java
49e7214e6eec8b25da77cbb48b1afe0f8133f97b
[]
no_license
PacoMunoz/tennis-jazz
735b0cdc1b6852bb84aafa864216d69bdf0ca8a9
8a5a2ad85969965fb798bf5e9ac0dc8bc29d43e5
refs/heads/master
2023-06-08T17:35:54.329938
2023-03-19T20:54:27
2023-03-19T20:54:27
197,720,205
0
0
null
2023-05-24T01:40:01
2019-07-19T07:03:50
Java
UTF-8
Java
false
false
26,187
java
package es.pmg.tennisjazz.web.rest; import es.pmg.tennisjazz.TennisJazzApp; import es.pmg.tennisjazz.domain.Authority; import es.pmg.tennisjazz.domain.User; import es.pmg.tennisjazz.repository.UserRepository; import es.pmg.tennisjazz.security.AuthoritiesConstants; import es.pmg.tennisjazz.service.MailService; import es.pmg.tennisjazz.service.UserService; import es.pmg.tennisjazz.service.dto.UserDTO; import es.pmg.tennisjazz.service.mapper.UserMapper; import es.pmg.tennisjazz.web.rest.errors.ExceptionTranslator; import es.pmg.tennisjazz.web.rest.vm.ManagedUserVM; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cache.CacheManager; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.time.Instant; import java.util.*; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Integration tests for the {@link UserResource} REST controller. */ @SpringBootTest(classes = TennisJazzApp.class) public class UserResourceIT { private static final String DEFAULT_LOGIN = "johndoe"; private static final String UPDATED_LOGIN = "jhipster"; private static final Long DEFAULT_ID = 1L; private static final String DEFAULT_PASSWORD = "passjohndoe"; private static final String UPDATED_PASSWORD = "passjhipster"; private static final String DEFAULT_EMAIL = "johndoe@localhost"; private static final String UPDATED_EMAIL = "jhipster@localhost"; private static final String DEFAULT_FIRSTNAME = "john"; private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; private static final String DEFAULT_LASTNAME = "doe"; private static final String UPDATED_LASTNAME = "jhipsterLastName"; private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; private static final String DEFAULT_LANGKEY = "en"; private static final String UPDATED_LANGKEY = "fr"; @Autowired private UserRepository userRepository; @Autowired private MailService mailService; @Autowired private UserService userService; @Autowired private UserMapper userMapper; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; @Autowired private CacheManager cacheManager; private MockMvc restUserMockMvc; private User user; @BeforeEach public void setup() { cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear(); cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear(); UserResource userResource = new UserResource(userService, userRepository, mailService); this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter) .build(); } /** * Create a User. * * This is a static method, as tests for other entities might also need it, * if they test an entity which has a required relationship to the User entity. */ public static User createEntity(EntityManager em) { User user = new User(); user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5)); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); user.setFirstName(DEFAULT_FIRSTNAME); user.setLastName(DEFAULT_LASTNAME); user.setImageUrl(DEFAULT_IMAGEURL); user.setLangKey(DEFAULT_LANGKEY); return user; } @BeforeEach public void initTest() { user = createEntity(em); user.setLogin(DEFAULT_LOGIN); user.setEmail(DEFAULT_EMAIL); } @Test @Transactional public void createUser() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); // Create the User ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin(DEFAULT_LOGIN); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isCreated()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate + 1); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); } @Test @Transactional public void createUserWithExistingId() throws Exception { int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(1L); managedUserVM.setLogin(DEFAULT_LOGIN); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // An entity with an existing ID cannot be created, so this API call must fail restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void createUserWithExistingLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin(DEFAULT_LOGIN);// this login should already be used managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail("anothermail@localhost"); managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void createUserWithExistingEmail() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeCreate = userRepository.findAll().size(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setLogin("anotherlogin"); managedUserVM.setPassword(DEFAULT_PASSWORD); managedUserVM.setFirstName(DEFAULT_FIRSTNAME); managedUserVM.setLastName(DEFAULT_LASTNAME); managedUserVM.setEmail(DEFAULT_EMAIL);// this email should already be used managedUserVM.setActivated(true); managedUserVM.setImageUrl(DEFAULT_IMAGEURL); managedUserVM.setLangKey(DEFAULT_LANGKEY); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Create the User restUserMockMvc.perform(post("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllUsers() throws Exception { // Initialize the database userRepository.saveAndFlush(user); // Get all the users restUserMockMvc.perform(get("/api/users?sort=id,desc") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); } @Test @Transactional public void getUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); // Get the user restUserMockMvc.perform(get("/api/users/{login}", user.getLogin())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.login").value(user.getLogin())) .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull(); } @Test @Transactional public void getNonExistingUser() throws Exception { restUserMockMvc.perform(get("/api/users/unknown")) .andExpect(status().isNotFound()); } @Test @Transactional public void updateUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findById(user.getId()).get(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(updatedUser.getLogin()); managedUserVM.setPassword(UPDATED_PASSWORD); managedUserVM.setFirstName(UPDATED_FIRSTNAME); managedUserVM.setLastName(UPDATED_LASTNAME); managedUserVM.setEmail(UPDATED_EMAIL); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(UPDATED_IMAGEURL); managedUserVM.setLangKey(UPDATED_LANGKEY); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test @Transactional public void updateUserLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeUpdate = userRepository.findAll().size(); // Update the user User updatedUser = userRepository.findById(user.getId()).get(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(UPDATED_LOGIN); managedUserVM.setPassword(UPDATED_PASSWORD); managedUserVM.setFirstName(UPDATED_FIRSTNAME); managedUserVM.setLastName(UPDATED_LASTNAME); managedUserVM.setEmail(UPDATED_EMAIL); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(UPDATED_IMAGEURL); managedUserVM.setLangKey(UPDATED_LANGKEY); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isOk()); // Validate the User in the database List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeUpdate); User testUser = userList.get(userList.size() - 1); assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); } @Test @Transactional public void updateUserExistingEmail() throws Exception { // Initialize the database with 2 users userRepository.saveAndFlush(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); // Update the user User updatedUser = userRepository.findById(user.getId()).get(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin(updatedUser.getLogin()); managedUserVM.setPassword(updatedUser.getPassword()); managedUserVM.setFirstName(updatedUser.getFirstName()); managedUserVM.setLastName(updatedUser.getLastName()); managedUserVM.setEmail("jhipster@localhost");// this email should already be used by anotherUser managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(updatedUser.getImageUrl()); managedUserVM.setLangKey(updatedUser.getLangKey()); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test @Transactional public void updateUserExistingLogin() throws Exception { // Initialize the database userRepository.saveAndFlush(user); User anotherUser = new User(); anotherUser.setLogin("jhipster"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); anotherUser.setEmail("jhipster@localhost"); anotherUser.setFirstName("java"); anotherUser.setLastName("hipster"); anotherUser.setImageUrl(""); anotherUser.setLangKey("en"); userRepository.saveAndFlush(anotherUser); // Update the user User updatedUser = userRepository.findById(user.getId()).get(); ManagedUserVM managedUserVM = new ManagedUserVM(); managedUserVM.setId(updatedUser.getId()); managedUserVM.setLogin("jhipster");// this login should already be used by anotherUser managedUserVM.setPassword(updatedUser.getPassword()); managedUserVM.setFirstName(updatedUser.getFirstName()); managedUserVM.setLastName(updatedUser.getLastName()); managedUserVM.setEmail(updatedUser.getEmail()); managedUserVM.setActivated(updatedUser.getActivated()); managedUserVM.setImageUrl(updatedUser.getImageUrl()); managedUserVM.setLangKey(updatedUser.getLangKey()); managedUserVM.setCreatedBy(updatedUser.getCreatedBy()); managedUserVM.setCreatedDate(updatedUser.getCreatedDate()); managedUserVM.setLastModifiedBy(updatedUser.getLastModifiedBy()); managedUserVM.setLastModifiedDate(updatedUser.getLastModifiedDate()); managedUserVM.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform(put("/api/users") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(managedUserVM))) .andExpect(status().isBadRequest()); } @Test @Transactional public void deleteUser() throws Exception { // Initialize the database userRepository.saveAndFlush(user); int databaseSizeBeforeDelete = userRepository.findAll().size(); // Delete the user restUserMockMvc.perform(delete("/api/users/{login}", user.getLogin()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isNoContent()); assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); // Validate the database is empty List<User> userList = userRepository.findAll(); assertThat(userList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void getAllAuthorities() throws Exception { restUserMockMvc.perform(get("/api/users/authorities") .accept(TestUtil.APPLICATION_JSON_UTF8) .contentType(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$").isArray()) .andExpect(jsonPath("$").value(hasItems(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN))); } @Test @Transactional public void testUserEquals() throws Exception { TestUtil.equalsVerifier(User.class); User user1 = new User(); user1.setId(1L); User user2 = new User(); user2.setId(user1.getId()); assertThat(user1).isEqualTo(user2); user2.setId(2L); assertThat(user1).isNotEqualTo(user2); user1.setId(null); assertThat(user1).isNotEqualTo(user2); } @Test public void testUserDTOtoUser() { UserDTO userDTO = new UserDTO(); userDTO.setId(DEFAULT_ID); userDTO.setLogin(DEFAULT_LOGIN); userDTO.setFirstName(DEFAULT_FIRSTNAME); userDTO.setLastName(DEFAULT_LASTNAME); userDTO.setEmail(DEFAULT_EMAIL); userDTO.setActivated(true); userDTO.setImageUrl(DEFAULT_IMAGEURL); userDTO.setLangKey(DEFAULT_LANGKEY); userDTO.setCreatedBy(DEFAULT_LOGIN); userDTO.setLastModifiedBy(DEFAULT_LOGIN); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); User user = userMapper.userDTOToUser(userDTO); assertThat(user.getId()).isEqualTo(DEFAULT_ID); assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(user.getActivated()).isEqualTo(true); assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(user.getCreatedBy()).isNull(); assertThat(user.getCreatedDate()).isNotNull(); assertThat(user.getLastModifiedBy()).isNull(); assertThat(user.getLastModifiedDate()).isNotNull(); assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER); } @Test public void testUserToUserDTO() { user.setId(DEFAULT_ID); user.setCreatedBy(DEFAULT_LOGIN); user.setCreatedDate(Instant.now()); user.setLastModifiedBy(DEFAULT_LOGIN); user.setLastModifiedDate(Instant.now()); Set<Authority> authorities = new HashSet<>(); Authority authority = new Authority(); authority.setName(AuthoritiesConstants.USER); authorities.add(authority); user.setAuthorities(authorities); UserDTO userDTO = userMapper.userToUserDTO(user); assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID); assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME); assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL); assertThat(userDTO.isActivated()).isEqualTo(true); assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY); assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate()); assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN); assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate()); assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER); assertThat(userDTO.toString()).isNotNull(); } @Test public void testAuthorityEquals() { Authority authorityA = new Authority(); assertThat(authorityA).isEqualTo(authorityA); assertThat(authorityA).isNotEqualTo(null); assertThat(authorityA).isNotEqualTo(new Object()); assertThat(authorityA.hashCode()).isEqualTo(0); assertThat(authorityA.toString()).isNotNull(); Authority authorityB = new Authority(); assertThat(authorityA).isEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.ADMIN); assertThat(authorityA).isNotEqualTo(authorityB); authorityA.setName(AuthoritiesConstants.USER); assertThat(authorityA).isNotEqualTo(authorityB); authorityB.setName(AuthoritiesConstants.USER); assertThat(authorityA).isEqualTo(authorityB); assertThat(authorityA.hashCode()).isEqualTo(authorityB.hashCode()); } }
1e19650a992722d0fdf172caeda5970ca79317ec
b66bdee811ed0eaea0b221fea851f59dd41e66ec
/src/com/google/android/gms/common/ag$1.java
062affc99786f6f4b30cc9c2cbd6912ac45b6ddc
[]
no_license
reverseengineeringer/com.grubhub.android
3006a82613df5f0183e28c5e599ae5119f99d8da
5f035a4c036c9793483d0f2350aec2997989f0bb
refs/heads/master
2021-01-10T05:08:31.437366
2016-03-19T20:41:23
2016-03-19T20:41:23
54,286,207
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
package com.google.android.gms.common; final class ag$1 extends bl { ag$1(byte[] paramArrayOfByte) { super(paramArrayOfByte); } protected byte[] b() { return j.a("0‚\003¹0‚\002¡ \003\002\001\002\002\t\000¥\t4\006\f1Íþ0\r\006\t*†H†÷\r\001\001\005\005\0000s1\0130\t\006\003U\004\006\023\002US1\0230\021\006\003U\004\b\f\nCalifornia1\0260\024\006\003U\004\007\f\rMountain View1\0240\022\006\003U\004\n\f\013Google Inc.1\0200\016\006\003U\004\013\f\007Android1\0170\r\006\003U\004\003\f\006huddle0\036\027\r140729173141Z\027\r411214173141Z0s1\0130\t\006\003U\004\006\023\002US1\0230\021\006\003U\004\b\f\nCalifornia1\0260\024\006\003U\004\007\f\rMountain View1\0240\022\006\003U\004\n\f\013Google Inc.1\0200\016\006\003U\004\013\f\007Android1\0170\r\006\003U\004\003\f\006huddle0‚\001\"0\r\006\t*†H†÷\r\001\001\001\005\000\003‚\001\017\0000‚\001\n\002‚\001\001\000®8-6÷5w•\026Ç?²g‚è\032ʛïìçø\n¹_æeÕ04µòȜ€\005+ÌÁ'i{ÌõL}Aˆ#g(à[ÏæDúc¶rõ¡3¯øf4Ni‚*9”XO}ØAÐ\nm\027\002U\034„\026\032œ²äGai\036pÞ\032“†\006ÈÂL2Iz=¥Sûj¢t\033—¢\032ˆ.\006WÐl^KöV\024.øL'Çä°¶äQèc½ÜX\035kȀŒëAu\006ËF\006?žI2*p È®‹\n=\023ˆW$Ñâ}Ó<uÝYžFÛ/¤;XÛ\tސÿ°h\016ÌÉôBnü6ñI\003Š*ˆæ‚+Þê±µPfÖ³„'`\022\b\013!ºŒ\013ïrW±!ß ÜßgýøpͅªÈ,\021Œägk…\002\003\001\000\001£P0N0\035\006\003U\035\016\004\026\004\024\016\006„n’#¢Ä+\036Ÿ\0070îÜ\"*e0\037\006\003U\035#\004\0300\026€\024\016\006„n’#¢Ä+\036Ÿ\0070îÜ\"*e0\f\006\003U\035\023\004\0050\003\001\001ÿ0\r\006\t*†H†÷\r\001\001\005\005\000\003‚\001\001\0004Ì6œ\031Ÿ›ú)ܮúÏt9MŽ\005ø²øµ~¸Š°r—ß<åò$Ú`yæßd·Û/êƒ\006C|žÑj°Æ löÆÍ»ŽU\032\031…\030Y˜U6o!ïE}ʋ8Dz„]‘mäC\021\021úè*—\004R¢ŽW5\n¢‚UH\037¾t$V\021\f’Šãƒ¯æñ¥\007>·Z¤û(\005´RåbîÖy>Va\021\f¿ŸÕ\000£Qwê%àgàŒZ3¾I\024îÚÞHk\025ç£ÎýlmòÓ\bƒ\034\016®ÚÀpW¶IôÝÉj„à\005R~ä”-( MN|E“ÞÜìB\031œºç¥ôŽ1M‚¼\007TÑ®™“ÐŒÄê\002™Ýq\0166gß\006N½þë?È/P~í]àޛ¸ŸH"); } } /* Location: * Qualified Name: com.google.android.gms.common.ag.1 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
d4e018cfcdf14af96a6a938d11fb3ae9d99082f9
1b4deabc159295141abf067c3d46da63aa8c4104
/Chapter05/Chapter05_29.java
a189aa54d7a82b5be2de88176efeb4eb08af11bf
[]
no_license
masukgungor/JAVA
36f77e1a95ccce394f5bc3327bbb243699c098e6
e1828d2a79f809ea774a51423c4764f3b09f9458
refs/heads/master
2020-05-24T05:21:31.995649
2019-06-30T22:57:41
2019-06-30T22:57:41
187,113,633
0
0
null
null
null
null
UTF-8
Java
false
false
5,270
java
package chapter05; /* * (Display calendars) Write a program that prompts the user to enter the year and first day of the year and displays the calendar table for the year on the console. For example, if the user entered the year 2013, and 2 for Tuesday, January 1, 2013, your program should display the calendar for each month in the year, as follows: */ import java.util.Scanner; public class Chapter05_29 { public static void main(String[] args) { // create a scanner Scanner input = new Scanner(System.in); System.out.println("Please enter the year , and the first day of theyear ( For example 2013 ,Tuesday)"); int year = input.nextInt(); String day = input.next().toLowerCase(); System.out.println("Please enter the month you want to see the calendar table "); String calendarMonth = input.next().toLowerCase(); String[] selectDay = "monday tuesday wednesday thursday friday saturday sunday".split(" "); String[] selectMounth = "January February March April May June July August September October November December" .split(" "); String[] showMounth = "January February March April May June July August September October November December" .split(" "); int determineMonthDayNumber = 0; if (selectMounth[0].toLowerCase().contentEquals(calendarMonth)) { determineMonthDayNumber = 31; } int indexOfDay = -1; // for index // to determine which index in week for (int i = 0; i < 7; i++) { if (day.contains(selectDay[i])) { indexOfDay = i; } } // 1 January year and day String[] dayOfmonth = selectMounth; dayOfmonth[0] = day; // determine leap year boolean isLeapYear = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); int temp = 0; int selectDayIndex = 0; // determine day for (int i = 1; i < 12; i++) { // 31 months if (i == 4 || i == 6 || i == 9 || i == 11) { if (selectMounth[i].toLowerCase().contentEquals(calendarMonth)) determineMonthDayNumber = 30; temp = 2; } else if (i == 2 && isLeapYear) { // for february if (selectMounth[i].toLowerCase().contentEquals(calendarMonth)) determineMonthDayNumber = 31; temp = 1; } else if (i == 2) { // for february if (selectMounth[i].toLowerCase().contentEquals(calendarMonth)) determineMonthDayNumber = 31; temp = 0; } else { // 30 months if (selectMounth[i].toLowerCase().contentEquals(calendarMonth)) determineMonthDayNumber = 31; temp = 3; } if (i == 1) { if (selectMounth[i].toLowerCase().contentEquals(calendarMonth)) determineMonthDayNumber = 29; } // calculation of the week head if ((indexOfDay + temp) > 6) { selectDayIndex = indexOfDay + temp - 7; indexOfDay = selectDayIndex; } else { selectDayIndex = indexOfDay + temp; indexOfDay = selectDayIndex; } dayOfmonth[i] = selectDay[selectDayIndex]; } int indexOfdayTheMounth = 0; for (int i = 1; i < 12; i++) { if (showMounth[i].toLowerCase().contentEquals(calendarMonth)) { indexOfdayTheMounth = i; } } System.out.printf("\t\t%5s %d \n", showMounth[indexOfdayTheMounth], year); System.out.println("-------------------------------------------"); int counter = 0; System.out.println("Sun Mon Tue Wed Thu Fri Sat"); for (int i = 1; i <= determineMonthDayNumber; i++) { if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[6])) { System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[0])) { if (i == 1) { System.out.print(" "); counter++; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[1])) { if (i == 1) { System.out.print(" "); counter += 2; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[2])) { if (i == 1) { System.out.print(" "); counter += 3; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[3])) { if (i == 1) { System.out.print(" "); counter += 4; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[4])) { if (i == 1) { System.out.print(" "); counter += 5; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } else if (dayOfmonth[indexOfdayTheMounth].contentEquals(selectDay[5])) { if (i == 1) { System.out.print(" "); counter += 6; } System.out.printf("%-4d", i); counter++; if (counter % 7 == 0) { System.out.println(); counter = 0; } } } } }
5897c042446fcf9e18bb49f506681b28dc635f40
8e8bb2e013c4f3fb8de732785184e636b372ba5d
/src/main/java/database/PropertyUtils.java
c35ba976e8ce956641767d33420bea889bf2df8e
[]
no_license
mopdzz/ivr-platform
72064014a0f0d3998f27bdbabe030351690f54a6
c831697721db4b6a335db5e730c46122b8adfef9
refs/heads/master
2021-01-20T12:15:16.975391
2015-12-20T14:39:40
2015-12-20T14:39:40
28,712,353
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
package database; import java.util.Locale; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.stereotype.Repository; import util.AppContextHolder; @Repository public class PropertyUtils { @Autowired private MessageSource messageSource; private static final String default_val = ""; public String getProperty(String key) { return messageSource.getMessage(key, null, default_val, Locale.CHINA).trim(); } public String getProperty(String key, String defaultValue) { return messageSource.getMessage(key, null, defaultValue, Locale.CHINA).trim(); } public int getInteger(String key) { return getInteger(key, 0); } public int getInteger(String key, int i) { if (StringUtils.isEmpty(key)) return i; try { return Integer.parseInt(messageSource.getMessage(key, null, default_val, Locale.CHINA)); } catch (Exception e) { return i; } } public static PropertyUtils getPropertyUtils() { return AppContextHolder.getContext().getBean("propertyUtils", PropertyUtils.class); } }
a84fb5d43f37cf980bb3512ad43dd07046a81375
811c7325ebcd4cc73923354be71083308824d9a4
/ShortVideoFunctionDemo/app/src/main/java/com/qiniu/pili/droid/shortvideo/demo/transition/Transition3.java
6c38207b695419b14ca7c0855d5fb23bebc5be52
[ "Apache-2.0" ]
permissive
pili-engineering/PLDroidShortVideo
23edde5dd9bd0b5c85fa2a0fa529d614b21878e8
09729a681ea0598df0b8a865953c21e5b91a350b
refs/heads/master
2023-07-13T07:12:07.618641
2022-05-31T06:17:31
2022-05-31T06:17:31
98,138,485
1,818
355
Apache-2.0
2022-05-31T06:17:32
2017-07-24T01:51:42
Java
UTF-8
Java
false
false
3,539
java
package com.qiniu.pili.droid.shortvideo.demo.transition; import android.graphics.Color; import android.view.View; import android.view.ViewGroup; import com.qiniu.pili.droid.shortvideo.PLFadeTransition; import com.qiniu.pili.droid.shortvideo.PLImageView; import com.qiniu.pili.droid.shortvideo.PLPositionTransition; import com.qiniu.pili.droid.shortvideo.PLVideoEncodeSetting; import com.qiniu.pili.droid.shortvideo.demo.R; import com.qiniu.pili.droid.shortvideo.demo.view.TransitionTextView; public class Transition3 extends TransitionBase { private static final int MOVE_DISTANCE = 100; private static final String TEXT_DISPLAY = "村上春树1949年1月12日出生在日本京都市伏见区,为国语教师村上千秋、村上美幸夫妇的长子。出生不久,家迁至兵库县西宫市夙川。村上春树1949年1月12日出生在日本京都市伏见区,为国语教师村上千秋、村上美幸夫妇的长子。出生不久,家迁至兵库县西宫市夙川。"; private PLImageView mImageView; public Transition3(ViewGroup viewGroup, PLVideoEncodeSetting setting) { super(viewGroup, setting); } @Override protected void initPosAndTrans() { //you should init positions and transitions in post runnable , because the view has been layout at that moment. mImageView.post(new Runnable() { @Override public void run() { initPosition(); initTransitions(); } }); } @Override protected void initViews() { mTitle = new TransitionTextView(mContext); mTitle.setText(TEXT_DISPLAY); mTitle.setPadding(0, 0, 0, 0); mTitle.setTextColor(Color.parseColor("#339900")); mTitle.setTextSize(16); mImageView = new PLImageView(mContext); mImageView.setImageDrawable(mContext.getResources().getDrawable(R.drawable.green_quot)); addViews(); setViewsVisible(View.INVISIBLE); } private void initTransitions() { PLPositionTransition positionTransition = new PLPositionTransition(0, DURATION / 2, (int) mTitle.getX(), (int) mTitle.getY(), (int) mTitle.getX(), (int) mTitle.getY() - MOVE_DISTANCE); mTransitionMaker.addTransition(mTitle, positionTransition); PLFadeTransition fadeTransition = new PLFadeTransition(0, DURATION / 2, 0, 1); mTransitionMaker.addTransition(mTitle, fadeTransition); positionTransition = new PLPositionTransition(0, DURATION / 2, (int) mImageView.getX(), (int) mImageView.getY(), (int) mImageView.getX(), (int) mImageView.getY() - MOVE_DISTANCE); mTransitionMaker.addTransition(mImageView, positionTransition); fadeTransition = new PLFadeTransition(0, DURATION / 2, 0, 1); mTransitionMaker.addTransition(mImageView, fadeTransition); mTransitionMaker.play(); setViewsVisible(View.VISIBLE); } private void initPosition() { int titleY = mHeight / 2 - mTitle.getHeight() / 2 + MOVE_DISTANCE; mTitle.setTranslationX(0); mTitle.setTranslationY(titleY); int imageY = titleY - mImageView.getHeight(); mImageView.setTranslationY(imageY); mImageView.setTranslationX(0); } @Override protected void addViews() { super.addViews(); mTransitionMaker.addImage(mImageView); } @Override protected void setViewsVisible(int visible) { super.setViewsVisible(visible); mImageView.setVisibility(visible); } }
8528a61bcb57a9fe9b49797429e66fdcefec370f
1d8f9ae3178e671abeeb5635e648eadfd779b58e
/app/src/main/java/edu/sjsu/android/StockSearch/FavoriteAdapter.java
e80ffe857b34943f179fe719119c3b5de63620fa
[]
no_license
SaneelDaniel/AndroidStockApp
8c8dc9dc4af6230813f15f23978f4e4fb5573313
f5d664c37c6cf67534e577ed7929ac0b65b4c28c
refs/heads/main
2023-03-11T06:49:36.990523
2021-03-03T01:01:35
2021-03-03T01:01:35
329,504,233
1
0
null
null
null
null
UTF-8
Java
false
false
3,359
java
package edu.sjsu.android.StockSearch; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; /** * Adapter class that fills the Favorite Section RecyclerView */ public class FavoriteAdapter extends RecyclerView.Adapter<FavoriteAdapter.FavoriteViewHolder> { private LayoutInflater inflator; List<StockInfo> favoriteList = new ArrayList<>(); private Context context; public FavoriteAdapter(Context context, List<StockInfo> favoriteList){ inflator = LayoutInflater.from(context); this.context = context; this.favoriteList = favoriteList; } @NonNull @Override public FavoriteViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = inflator.inflate(R.layout.custom_favorite_row, parent,false); FavoriteViewHolder holder = new FavoriteViewHolder(context, view); return holder; } @Override public void onBindViewHolder(@NonNull FavoriteViewHolder holder, int position) { final StockInfo current = favoriteList.get(position); holder.symbol.setText(current.ticker); holder.price.setText(current.price); holder.favoritesRow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(((MainActivity)context), activity_StockDetail.class); intent.putExtra("my_data", current.ticker); intent.putExtra("favorite", true); context.startActivity(intent); } }); } @Override public int getItemCount() { return 0; } public void newFavorites(List<StockInfo> newList) { favoriteList.clear(); favoriteList.addAll(newList); notifyDataSetChanged(); } public void removeFavorites(String str) { for(StockInfo favorite : favoriteList) { if(favorite.ticker.equals(str)) { favoriteList.remove(favorite); notifyDataSetChanged(); break; } } } public void clearData() { favoriteList.clear(); notifyDataSetChanged(); } public void addFav(StockInfo favInfo) { favoriteList.add(favInfo); notifyDataSetChanged(); } /** * Inner View holder Class that holds the row view for stock in the favorite section */ public class FavoriteViewHolder extends RecyclerView.ViewHolder { TextView symbol; TextView price; TextView changeRate; LinearLayout favoritesRow; public FavoriteViewHolder(final Context context, View itemView){ super(itemView); favoritesRow = (LinearLayout)itemView.findViewById(R.id.favoriteRow); symbol = (TextView)itemView.findViewById(R.id.favoriteTicker); price = (TextView)itemView.findViewById(R.id.favoritePrice); changeRate = (TextView)itemView.findViewById(R.id.favoriteChangeRate); } } }
3798d26fc1cda0bc6bf1019a329f7533ddb88505
1e72c46f0c8ef0ac764eaf01d796536f1401802b
/EasyTorch/app/src/main/java/com/apps/akaya/easytorch/Pattern.java
036699d82f373a86014a1b4b18a654d2a875d87d
[]
no_license
Agshin43/AndroidStudioProjects
0288325ceabae194e7a2273d7e815e24d2adc5cb
565cc1bcc93703c3f3c35b90ad6267fd7226dfd1
refs/heads/master
2021-01-21T04:33:12.324791
2016-01-13T23:37:31
2016-01-13T23:37:31
32,261,571
0
0
null
null
null
null
UTF-8
Java
false
false
1,959
java
package com.apps.akaya.easytorch; import java.util.ArrayList; /** * Created by agshin on 5/23/15. */ public class Pattern { public ArrayList<Integer> runPauseIntervals; public boolean repeat; private int repeatCount; private int repeatCursor; int sensityMSecs; private boolean goingOn; private Pattern compWith; public Pattern(int sensityMSecs, int firstPlay) { runPauseIntervals = new ArrayList<Integer>(); runPauseIntervals.add(firstPlay); this.sensityMSecs = sensityMSecs; goingOn = true; } public Pattern(int sensityMSecs, Pattern compWith) { this.compWith = compWith; runPauseIntervals = new ArrayList<Integer>(); this.sensityMSecs = sensityMSecs; goingOn = true; } public void addPair(int pause, int run) { if(!isGoingOn()) return; int size = this.runPauseIntervals.size(); if( this.runPauseIntervals.size() > compWith.runPauseIntervals.size()-2 ) { return; } if(compWith.runPauseIntervals.get(size - 2) <= (pause+sensityMSecs) && compWith.runPauseIntervals.get(size - 2) >= (pause-sensityMSecs) && compWith.runPauseIntervals.get(size - 2) <= (run+sensityMSecs) && compWith.runPauseIntervals.get(size - 2) >= (run-sensityMSecs)) { runPauseIntervals.add(pause); runPauseIntervals.add(run); this.setGoingOn(true); } else { this.setGoingOn(false); } } public void setRepeat(boolean repeat) { this.repeat = repeat; } public void setRepeatCount(int repeatCount) { this.repeatCount = repeatCount; } public boolean isGoingOn() { return goingOn; } public void setGoingOn(boolean goingOn) { this.goingOn = goingOn; } public void forwardCursor() { repeatCursor++; } }
7d0d01f0021c671c9bc7ff7387e96b8272078116
2a662cfdf91e0cded6b9d272cbcea8a2d4377d4c
/Matrix Client/src/main/java/com/jagex/Class298_Sub32_Sub12.java
6dfd28113ed6c20d0708354b3083e10b0d15d217
[]
no_license
primnoprotogen/718_RS_Build
38293df71eb08d0cc64bce5e19cc64b46172463a
84ddd7138d8ea7dede51814e62868696932ec303
refs/heads/master
2023-04-04T04:21:25.263022
2021-04-20T22:17:11
2021-04-20T22:17:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
602
java
package com.jagex;/* Class298_Sub32_Sub12 - Decompiled by JODE * Visit http://jode.sourceforge.net/ */ public class Class298_Sub32_Sub12 extends Class298_Sub32 { int[] method3209(int i) { return Class250.anIntArray2762; } public Class298_Sub32_Sub12() { super(0, true); } int[] method3210(int i) { return Class250.anIntArray2762; } int[] method3131(int i, int i_0_) { try { return Class250.anIntArray2762; } catch (RuntimeException runtimeexception) { throw Class346.method4175(runtimeexception, new StringBuilder() .append("aha.i(").append(')').toString()); } } }
4331f3611ad41ffc9c0b480a3716b8e05555b483
586dad5a6d6313896ba275b8ee5b2dea302c4148
/freetuts-backend/src/main/java/net/freetuts/backend/security/JwtAuthenticationEntryPoint.java
5b31b72619a7453ee1fb4a9caa186dede23ab50a
[]
no_license
phatnt99/thuctap
4cffb0dfae72edba78f4f86de000800afcd0f395
21e36b26855d770f47de0b45312e459eedf5f886
refs/heads/main
2023-09-01T09:18:40.429289
2021-10-15T04:26:34
2021-10-15T04:26:34
381,909,809
0
0
null
null
null
null
UTF-8
Java
false
false
1,524
java
package net.freetuts.backend.security; import com.fasterxml.jackson.databind.ObjectMapper; import net.freetuts.backend.exception.ExceptionResponse; import static org.springframework.http.HttpStatus.FORBIDDEN; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.Http403ForbiddenEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; @Component public class JwtAuthenticationEntryPoint extends Http403ForbiddenEntryPoint { @Autowired private ObjectMapper mapper; @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException { ExceptionResponse httpResponse = new ExceptionResponse(); httpResponse.setTimestamp(new Date()); httpResponse.setStatus(FORBIDDEN.value()); httpResponse.setError(FORBIDDEN.getReasonPhrase()); httpResponse.setMessage(SecurityConstant.FORBIDDEN_MESSAGE); response.setContentType(APPLICATION_JSON_VALUE); response.setStatus(FORBIDDEN.value()); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); out.print(mapper.writeValueAsString(httpResponse)); out.flush(); } }
91029b7899f36dd912fa627b43696d45bb52bcbb
c21366701c21545451b9b311f325eee1c72d1f3a
/src/util/PathHelper.java
6caf838e2ea58ccc352a6df5752e00eddbe1bfe6
[]
no_license
zelucasr/projetoGrafos
a41b772fbaf3595ac309eda63a78e63bad5ef740
9938dedda947eda29f703e18b7591d7a11b7a9dd
refs/heads/master
2020-03-19T10:27:30.417160
2018-06-12T05:38:59
2018-06-12T05:38:59
136,372,116
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
package util; public class PathHelper { private int cost; private int sourceNode; public PathHelper(int cost, int sourceNode) { super(); this.cost = cost; this.sourceNode = sourceNode; } public int getCost() { return cost; } public void setCost(int cost) { this.cost = cost; } public int getSourceNode() { return sourceNode; } public void setSourceNode(int sourceNode) { this.sourceNode = sourceNode; } }
5289a4d2f88983bfc03a97d3418bec42025c03ca
3795844e266e08ae35b021a431ec5787cb58440e
/src/test/Whil.java
55d5f44ba4b047e5a627010d9273a9a21373409a
[]
no_license
liangrui1988/thinking-java
1b1583def6d4e6e19b5215308747c59e2d7ae159
eec5e238ccb2b37e3034a99ff7e10e6d8db57c41
refs/heads/master
2021-01-10T08:43:39.186440
2015-07-26T12:53:29
2015-07-26T12:53:29
36,554,837
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package test; class A{int i=10;} interface B{int i=1;} public class Whil/* extends A implements B*/ { /*public void p(){ System.out.println(i); }*/ public static void main(String[] args) { int i = 1, j = 10; do { //System.out.println(i); if (j < i) continue; j--; } while (++i < 6); System.out.println(i+"\t"+j); } }
43efdb729bcf6c33cba6c56bb4822a821d180c56
7704837b9a4560dd38d752849eb23c82e5c0f01e
/app/src/main/java/cn/sxh/utilsdemo/view/NinePointView.java
48209566cbccc4f0cf0b38ab0c6c48bbe06b9bda
[]
no_license
CheckTiger/UtilsDemo
cfe334175a9b2f87810364da0ca31517917968dd
92b5ed5580e4bd384e1bfa5be7827b77924f683e
refs/heads/master
2021-01-20T06:44:05.344742
2017-05-04T02:48:05
2017-05-04T02:48:05
89,922,378
0
0
null
null
null
null
UTF-8
Java
false
false
11,649
java
package cn.sxh.utilsdemo.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Paint.Cap; import android.graphics.Path; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import cn.sxh.utilsdemo.R; /** * @auther snowTiger * @mail [email protected] * @time 2017/5/2 17:36 */ public class NinePointView extends View { Paint linePaint = new Paint(); Paint textPaint = new Paint(); Path path = new Path(); // 由于两个图片都是正方形,所以获取一个长度就行了 Bitmap defaultBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.lock); int defaultBitmapRadius = defaultBitmap.getWidth() / 2; // 初始化被选中图片的直径、半径 Bitmap selectedBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.indicator_lock_area); int selectedBitmapDiameter = selectedBitmap.getWidth(); int selectedBitmapRadius = selectedBitmapDiameter / 2; // 初始化指示器的图片 Bitmap indicateBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.indicator_lock_area_next); Bitmap tempBitmap = null; // 定义好9个点的数组 PointInfo[] points = new PointInfo[9]; // 屏幕的宽高 int width, height; // 当ACTION_MOVE时获取的X,Y坐标 int moveX, moveY; // 是否发生ACTION_UP boolean isUp = false; // 最终生成的用户锁序列 StringBuffer lockString = new StringBuffer(); Matrix matrix = new Matrix(); public NinePointView(Context context) { super(context); this.setBackgroundColor(Color.WHITE); initLinePaint(linePaint); initTextPaint(textPaint); } public NinePointView(Context context, AttributeSet attrs) { super(context, attrs); this.setBackgroundColor(Color.WHITE); initLinePaint(linePaint); initTextPaint(textPaint); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { width = getWidth(); height = getHeight(); if (width != 0 && height != 0) { initPoints(points); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); } private int startX = 0, startY = 0; @Override protected void onDraw(Canvas canvas) { canvas.drawText("用户的滑动顺序:" + lockString, 0, 40, textPaint); if (moveX != 0 && moveY != 0 && startX != 0 && startY != 0) { // 绘制当前活动的线段 canvas.drawLine(startX, startY, moveX, moveY, linePaint); } drawNinePoint(canvas, linePaint); super.onDraw(canvas); } // 记住,这个DOWN和MOVE、UP是成对的,如果没从UP释放,就不会再获得DOWN; // 而获得DOWN时,一定要确认消费该事件,否则MOVE和UP不会被这个VIEW的onTouchEvent接收 @Override public boolean onTouchEvent(MotionEvent event) { boolean flag = true; if (isUp) {// 如果已滑完,则把整个Canvas重置 finishDraw(); // 当UP后,要返回false,把事件释放给系统,否则无法获得Down事件 flag = false; } else {// 没滑完,则继续绘制 handlingEvent(event); // 这里要返回true,否则代表该View不消耗此事件,交给系统处理,则不会再收到MOVE和UP事件 flag = true; } return flag; } private void handlingEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_MOVE: moveX = (int) event.getX(); moveY = (int) event.getY(); for (PointInfo temp : points) { if (temp.isInMyPlace(moveX, moveY) && temp.isNotSelected()) { temp.setSelected(true); startX = temp.getCenterX(); startY = temp.getCenterY(); int len = lockString.length(); if (len != 0) { int preId = lockString.charAt(len - 1) - 48; points[preId].setNextId(temp.getId()); } lockString.append(temp.getId()); break; } } invalidate(0, height - width, width, height); break; case MotionEvent.ACTION_DOWN: int downX = (int) event.getX(); int downY = (int) event.getY(); for (PointInfo temp : points) { if (temp.isInMyPlace(downX, downY)) { temp.setSelected(true); startX = temp.getCenterX(); startY = temp.getCenterY(); lockString.append(temp.getId()); break; } } invalidate(0, height - width, width, height); break; case MotionEvent.ACTION_UP: startX = startY = moveX = moveY = 0; isUp = true; invalidate(); break; default: break; } } private void finishDraw() { for (PointInfo temp : points) { temp.setSelected(false); temp.setNextId(temp.getId()); } lockString.delete(0, lockString.length()); isUp = false; invalidate(); } private void initPoints(PointInfo[] points) { int len = points.length; int seletedSpacing = (width - selectedBitmapDiameter * 3) / 4; // 被选择时显示图片的左上角坐标 int seletedX = seletedSpacing; int seletedY = height - width + seletedSpacing; // 没被选时图片的左上角坐标 int defaultX = seletedX + selectedBitmapRadius - defaultBitmapRadius; int defaultY = seletedY + selectedBitmapRadius - defaultBitmapRadius; for (int i = 0; i < len; i++) { if (i == 3 || i == 6) { seletedX = seletedSpacing; seletedY += selectedBitmapDiameter + seletedSpacing; defaultX = seletedX + selectedBitmapRadius - defaultBitmapRadius; defaultY += selectedBitmapDiameter + seletedSpacing; } points[i] = new PointInfo(i, defaultX, defaultY, seletedX, seletedY); seletedX += selectedBitmapDiameter + seletedSpacing; defaultX += selectedBitmapDiameter + seletedSpacing; } } private void initTextPaint(Paint paint) { textPaint.setTextSize(30); textPaint.setAntiAlias(true); textPaint.setTypeface(Typeface.MONOSPACE); } /** * 初始化线画笔 * * @param paint */ private void initLinePaint(Paint paint) { paint.setColor(Color.GRAY); paint.setStrokeWidth(defaultBitmap.getWidth()); paint.setAntiAlias(true); paint.setStrokeCap(Cap.ROUND); } /** * 绘制已完成的部分 * * @param canvas */ private void drawNinePoint(Canvas canvas, Paint paint) { // 先把用户画出的线绘制好 for (PointInfo pointInfo : points) { if (pointInfo.hasNextId()) { int n = pointInfo.getNextId(); canvas.drawLine(pointInfo.getCenterX(), pointInfo.getCenterY(), points[n].getCenterX(), points[n].getCenterY(), paint); } } // 绘制每个点的图片 for (PointInfo pointInfo : points) { if (pointInfo.isSelected()) { if (pointInfo.hasNextId()) { matrix.reset(); int i = (int) Math.abs(Math.random() * 1000 - 640); matrix.setRotate(i); tempBitmap = Bitmap.createBitmap(indicateBitmap, 0, 0, indicateBitmap.getWidth(), indicateBitmap.getHeight(), matrix, false); canvas.drawBitmap(tempBitmap, pointInfo.getSeletedX(), pointInfo.getSeletedY(), paint); } else { canvas.drawBitmap(selectedBitmap, pointInfo.getSeletedX(), pointInfo.getSeletedY(), paint); } } canvas.drawBitmap(defaultBitmap, pointInfo.getDefaultX(), pointInfo.getDefaultY(), paint); } } private class PointInfo { // 一个点的ID private int id; // 当前点所指向的下一个点的ID,当没有时为自己ID private int nextId; // 是否被选中 private boolean selected; // 默认时图片的左上角X坐标 private int defaultX; // 默认时图片的左上角Y坐标 private int defaultY; // 被选中时图片的左上角X坐标 private int seletedX; // 被选中时图片的左上角Y坐标 private int seletedY; public PointInfo(int id, int defaultX, int defaultY, int seletedX, int seletedY) { this.id = id; this.nextId = id; this.defaultX = defaultX; this.defaultY = defaultY; this.seletedX = seletedX; this.seletedY = seletedY; } public boolean isSelected() { return selected; } public boolean isNotSelected() { return !isSelected(); } public void setSelected(boolean selected) { this.selected = selected; } public int getId() { return id; } public int getDefaultX() { return defaultX; } public int getDefaultY() { return defaultY; } public int getSeletedX() { return seletedX; } public int getSeletedY() { return seletedY; } public int getCenterX() { return seletedX + selectedBitmapRadius; } public int getCenterY() { return seletedY + selectedBitmapRadius; } public boolean hasNextId() { return nextId != id; } public int getNextId() { return nextId; } public void setNextId(int nextId) { this.nextId = nextId; } /** * 坐标(x,y)是否在当前点的范围内 * * @param x * @param y * @return */ public boolean isInMyPlace(int x, int y) { boolean inX = x > seletedX && x < (seletedX + selectedBitmapDiameter); boolean inY = y > seletedY && y < (seletedY + selectedBitmapDiameter); if (inX && inY) { return true; } else { return false; } } } }
1d5af3240dedc08656544a1fc7e156f4e4b26f3b
79f2dac07e5f9f3e84ee2890f57e334a52b83b3b
/tweetnoisemutation/app/models/Search.java
960ee0cb456b8442b045b84c507c857d29310c4a
[]
no_license
aswinbharadwaj/code_for_india
da4991fc0731518678c9ffa3b4fafdae7daa9c69
8534e607847e7e8dc8322ed37a9628e11268604e
refs/heads/master
2021-06-26T16:32:01.021312
2013-04-19T20:37:14
2013-04-19T20:37:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
64
java
package models; public class Search{ public String query; }
8f636e7d1d1339d7da27d59022bf466de4b2efd4
bcb8f48276bc7d3434c1655c0896bfc73ebf40ac
/app/src/androidTest/java/com/example/wwf/karthik/materialdesign/ExampleInstrumentedTest.java
238f9354d083933160d33af6b196c73fb541753c
[]
no_license
maturiKarthik/MaterialDesignProject
5de6d43d824793dbc78152c68edf93b50bc004e2
959d8b147ee88878e17b5131e72b30270dccd7da
refs/heads/master
2020-03-27T09:09:29.813731
2018-08-27T15:30:02
2018-08-27T15:30:02
146,317,769
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.example.wwf.karthik.materialdesign; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.wwf.karthik.materialdesign", appContext.getPackageName()); } }
17fe47ba507741fb82fe51503aff5ed1dd54dda4
82019dbd61bc71dafb60baeb736e3733fb4ffd4a
/src/Java0513/ex07_reverseStar.java
2c602572132c3841d6a639353a553aefb0804d07
[]
no_license
ohr5446/Java
969c78eada08dd39d426f80dde90a97ab4fcc532
a3984726f51b17fcc477e630f84fd95ef93c2337
refs/heads/master
2022-12-28T05:04:59.594896
2020-10-13T10:00:50
2020-10-13T10:00:50
263,823,119
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
/* Date : 2020.05.13 Author : HyeongRok Description : reverseStar Version : 1.3 */ package Java0513; public class ex07_reverseStar { public static void main(String[] args) { for (int i = 1; i <= 5; i++) { for (int j = 5; j >= i; j--) { System.out.print("*"); } System.out.println(); } } }
[ "1@1-PC" ]
1@1-PC
4b74d06284cbba0c6dd3d59976a68bbcd5f66aab
2dfd33a21a8f1f9fbd077d4190e8840d8669073e
/spark-apps/machine-learning/social-recommendation/src/main/java/com/dla/foundation/socialReco/ProfileCalc.java
a596d224bb4ea9b6f59cf910ce17ae0c4979a3c3
[]
no_license
nandanshah/foundation-2
2bbfd1f931b81c8e9e6c57efdf1a845b53c238d2
dd22c9300e9c2f6d10467bb202355aaa4ef7bfff
refs/heads/master
2021-01-01T18:37:46.039683
2014-09-27T08:12:24
2014-09-27T08:12:24
24,451,505
0
1
null
null
null
null
UTF-8
Java
false
false
10,196
java
package com.dla.foundation.socialReco; import java.io.IOException; import java.io.Serializable; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function; import org.apache.spark.api.java.function.PairFunction; import scala.Tuple2; import com.dla.foundation.socialReco.model.SocialScore; import com.dla.foundation.socialReco.model.UserScore; import com.dla.foundation.socialReco.util.SocialRecoPostprocessing; public class ProfileCalc implements Serializable{ /** * */ private static final long serialVersionUID = 1L; private static final String DELIMITER_PROPERTY = "#"; public static JavaPairRDD<Map<String, ByteBuffer>, List<ByteBuffer>> regionCalculations(JavaPairRDD<String, UserScore> dayScoreRDDPerUserMovie, JavaPairRDD<String, String> profileInfo,final Integer topEntryCnt,final long timestamp){ //Convert the PrimaryKey of dayScoreRDDPerUserMovie to ProfileId from TenantId#RegionId#ProfileId JavaPairRDD<String, UserScore> requiredPrimaryKey = changePrimaryKey(dayScoreRDDPerUserMovie); //Join dayScoreRDDPerUserMovie with profileInfo JavaPairRDD<String, Tuple2<UserScore,String>> joinedData=requiredPrimaryKey.join(profileInfo); // Filter if RegionId from dayScoreRDDPerUserMovie with profileInfo are equal then return Entry JavaPairRDD<String, Tuple2<UserScore,String>> filteredRDD= filterBasedOnRegion(joinedData); // Convert the data to JPRDD<String, UserScore> JavaPairRDD<String, UserScore> requiredRDD= convertToReaquiredRDD(filteredRDD); //Get top n records in sorted order based on movies score. ... JavaPairRDD<String, UserScore> topRecords= getTopMovies(requiredRDD, topEntryCnt ); // Normalization of Score ... JavaPairRDD<String, UserScore> normalizedScore= getNormalizedMovieScore(topRecords); //JavaPairRDD<String, Social> finalScore= finalScore(normalizedScore); JavaRDD<SocialScore> normalizedItemTrendScoreRDD= finalScore(normalizedScore, timestamp); //Post-processing of data to store it in Cassandra. JavaPairRDD<Map<String, ByteBuffer>, List<ByteBuffer>> finalScore = SocialRecoPostprocessing.processingForSocialScore(normalizedItemTrendScoreRDD); return finalScore; } /** * * This methods return the top n records in sorted order based on movies score. * * @param requiredRDD * @param topEntryCnt * @return */ private static JavaPairRDD<String, UserScore> getTopMovies( JavaPairRDD<String, UserScore> requiredRDD, final Integer topEntryCnt ) { JavaPairRDD<String, UserScore> topRecords = requiredRDD .mapToPair(new PairFunction<Tuple2<String,UserScore>, String, UserScore>() { /** * */ private static final long serialVersionUID = 1L; @Override public Tuple2<String, UserScore> call( Tuple2<String, UserScore> records) throws Exception { String primaryKey = records._1; UserScore userScore = null; Map<String, Double> movieScore = new HashMap<String, Double>(); Map<String, Map<String, Double>> eventTypeAggregate = new HashMap<String, Map<String, Double>>(); movieScore = getTopMovieScore(records._2.getMovieScore(), topEntryCnt ); for(String key : movieScore.keySet()) { eventTypeAggregate.put( key, records._2.getEventTypeAggregate().get(key)); } userScore = new UserScore(records._2.getTenantId(),records._2.getRegionId(), primaryKey, movieScore, eventTypeAggregate); return new Tuple2<String, UserScore>(primaryKey, userScore); } }); return topRecords; } /** * * This methods return the top n records in sorted order based on movies score. * * @param movieScore * @param topEntryCnt * @return * @throws IOException */ private static Map<String, Double> getTopMovieScore( Map<String, Double> movieScore,final Integer topEntryCnt ) throws IOException { LinkedList<Entry<String, Double>> largestList = new LinkedList<Entry<String, Double>>(movieScore.entrySet()); Collections.sort(largestList, new Comparator<Entry<String,Double>>(){ public int compare(Entry<String, Double>o1, Entry<String, Double>o2) { return o1.getValue().compareTo(o2.getValue()); } }); Map<String, Double> sortedMap = new LinkedHashMap<String, Double>(); Integer count = 0; for(Iterator<Entry<String,Double>> itr = largestList.iterator(); itr.hasNext();) { if(count>=topEntryCnt) { break; }Map.Entry<String, Double> entry = (Map.Entry<String, Double>)itr.next(); sortedMap.put(entry.getKey(), entry.getValue()); count++; } return sortedMap; } /** * * This method convert the data into required format. * * @param filteredRDD * @return */ public static JavaPairRDD<String, UserScore> convertToReaquiredRDD(JavaPairRDD<String, Tuple2<UserScore,String>> filteredRDD){ JavaPairRDD<String, UserScore> requiredRDD = filteredRDD .mapToPair(new PairFunction<Tuple2<String,Tuple2<UserScore,String>>, String, UserScore>() { /** * */ private static final long serialVersionUID = 1L; @Override public Tuple2<String, UserScore> call( Tuple2<String, Tuple2<UserScore, String>> records) throws Exception { String primaryKey = records._1; return new Tuple2<String, UserScore>(primaryKey, records._2._1); } }); return requiredRDD; } /** * * This method Convert the PrimaryKey of dayScoreRDDPerUserMovie to ProfileId from TenantId#RegionId#ProfileId * * @param userScore * @return */ public static JavaPairRDD<String, UserScore> changePrimaryKey(JavaPairRDD<String, UserScore> userScore){ JavaPairRDD<String, UserScore> requiredFormatUserScoreRDD = userScore .mapToPair(new PairFunction<Tuple2<String, UserScore>, String, UserScore>() { /** * */ private static final long serialVersionUID = 1L; public Tuple2<String, UserScore> call( Tuple2<String, UserScore> records) throws Exception { String[] keys = records._1.split(DELIMITER_PROPERTY); String primaryKey = keys[2]; return new Tuple2<String, UserScore>(primaryKey, records._2); } }); return requiredFormatUserScoreRDD; } /** * * This method filetr the records based on regionID. If regionId of movie is same as regionId of profile * then only recommended this movie to that profile. * * @param scoreRDD * @return */ public static JavaPairRDD<String, Tuple2<UserScore,String>> filterBasedOnRegion( JavaPairRDD<String, Tuple2<UserScore,String>> scoreRDD) { JavaPairRDD<String, Tuple2<UserScore,String>> filteredScoreRDD = scoreRDD .filter(new Function<Tuple2<String, Tuple2<UserScore,String>>, Boolean>() { /** * */ private static final long serialVersionUID = -6160930803403593402L; @Override public Boolean call( Tuple2<String, Tuple2<UserScore, String>> record) throws Exception { if(record._2._1.getRegionId().equals(record._2._2)) { return true; } // TODO Auto-generated method stub return false; } }); return filteredScoreRDD; } /** * * This method return the score in proper format (2 numbers after decimal digit ) * * @param topRecords * @return */ private static JavaPairRDD<String, UserScore> getNormalizedMovieScore( JavaPairRDD<String, UserScore> topRecords) { JavaPairRDD<String, UserScore> normalizedScore = topRecords. mapToPair(new PairFunction<Tuple2<String,UserScore>, String, UserScore>() { /** * */ private static final long serialVersionUID = 1L; @Override public Tuple2<String, UserScore> call( Tuple2<String, UserScore> records) throws Exception { Map<String, Double> movieScore = new HashMap<String, Double>(); Collection c= records._2.getMovieScore().values(); Double maxValue = Collections.max(c); for(String key : records._2.getMovieScore().keySet()) { movieScore.put(key, (double) Math.round((records._2.getMovieScore().get(key)/maxValue)*100)/100); } UserScore userScore = new UserScore(records._2.getTenantId(),records._2.getRegionId(), records ._1, movieScore, records._2.getEventTypeAggregate()); return new Tuple2<String, UserScore>(records._1, userScore); } }); return normalizedScore; } /** * * This method convert the data in SocialScore format. * * @param normalizedScore * @param timestamp * @return */ private static JavaRDD<SocialScore> finalScore( JavaPairRDD<String, UserScore> normalizedScore, final long timestamp) { return normalizedScore. flatMap(new FlatMapFunction<Tuple2<String,UserScore>, SocialScore>(){ /** * */ private static final long serialVersionUID = 1L; List< SocialScore> recommendItem = new ArrayList<SocialScore>(); @Override public Iterable<SocialScore> call( Tuple2<String, UserScore> records) throws Exception { SocialScore socialScore = null; Map<String, Double> movieScore = new HashMap<String, Double>(); movieScore = records._2.getMovieScore(); for(String itemId : movieScore.keySet()) { socialScore = new SocialScore(records._1, records._2.getTenantId(), records._2.getRegionId(), itemId, records._2.getMovieScore().get(itemId), timestamp , records._2.getEventTypeAggregate().get(itemId).toString()); recommendItem.add(socialScore); } return recommendItem; } }); } }
[ "dlauser@dla-ubuntu-vm.(none)" ]
dlauser@dla-ubuntu-vm.(none)
b2239f04c95e9343fb114e786185c3befdbd0d23
b1ae90bc2f504a508b20d0be55a7c38cec2624d1
/app/src/main/java/porta/neec/fct/com/neecapp/request/isvalid.java
6e07d6db45373ce4a18110c37c2e9fd5ec14bf7d
[ "MIT" ]
permissive
NEEC-FCT/NEEC_APP
8cd8078a2f7c2086492ca51b8a08603c394f19b6
c17b39b9c3dfcc976432ef98f034a4d662a6ad25
refs/heads/master
2020-03-21T10:16:07.458149
2019-10-12T12:49:28
2019-10-12T12:49:28
138,441,870
0
1
null
null
null
null
UTF-8
Java
false
false
817
java
package porta.neec.fct.com.neecapp.request; import com.android.volley.Response; import com.android.volley.toolbox.StringRequest; import java.util.HashMap; import java.util.Map; public class isvalid extends StringRequest { private static final String REGISTER_LOGIN_URL = "https://neecapp.neec-fct.com/isvalid.php"; private Map<String, String> params; public isvalid(String email, String cargo, String token, String IMEI, Response.Listener<String> listener) { super(Method.POST, REGISTER_LOGIN_URL, listener, null); params = new HashMap<>(); params.put("email", email); params.put("cargo", cargo); params.put("token", token); params.put("IMEI", IMEI); } @Override public Map<String, String> getParams() { return params; } }
f767112e68351b315ac491e1ef337070e983590e
1803d51df1f63d46d66b6a63db5f6a7358f7f075
/src/main/java/mocksenario/pk1/AccountManager.java
4d00409cc06c53bfdd94a8aa57a8350077981ec7
[]
no_license
jacoob/junit5
d67014b24e765498b45247091cae94f505c408ac
44951eb4efc8e3f5a953760e1465932e7d925bea
refs/heads/master
2023-07-24T11:45:31.588696
2021-09-05T07:00:07
2021-09-05T07:00:07
402,471,950
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package mocksenario.pk1; public interface AccountManager { Account findAccountForUser(String userId); void updateAccount(Account account); }
0b4f955c06154d2d98584b82a3c1d51f927801aa
bb98dcaadb19953d63285e4fc0c3391cbad4cdda
/source/QuickKar/src/QuickKarModel/facade/SongRateModel.java
d3e0938b463e6e78ea11e15507dae861060e486a
[]
no_license
s3275058/QUICKAR-karaoke-manager
175bbc0df6c74307214379ba4a501e8ea14b9444
f69018daa1d4d8f0f5356c3292cb9f07ca5eb3d4
refs/heads/master
2021-01-01T19:25:45.311758
2013-12-02T07:45:23
2013-12-02T07:45:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
715
java
/** * Course: Software Development: Process & Tools * Lecturer: Quang Tran * Assignment: 2-2012B * Assignment Title: QuickKar2012 * * RMIT International University Vietnam * Bachelor of Information Technology - Application * */ package QuickKarModel.facade; import java.io.Serializable; /** * Responsible for handling rating data. * * @author vuongdothanhhuy */ public class SongRateModel implements Serializable { private int ratingStar; public SongRateModel(int ratingStar) { this.ratingStar = ratingStar; } public int getRatingStar() { return ratingStar; } public void setRatingStar(int ratingStar) { this.ratingStar = ratingStar; } }
b9833fefa738b1397817bc308193cf6137e200ae
550ce2cf765c9d8afdd10d5cccb28749a9ee3e70
/app/src/main/java/pharaoh/com/weshare/models/Home.java
adc19a331195d82f144e9e7e8e8ded632f44c1ce
[]
no_license
NessmaYasser/WeShare-
e2fba48dbcb1932f03b803f4aa33ecbdf468dcce
edcea94ba3015b0a34cd41991de427e23c7f2db0
refs/heads/master
2021-03-22T05:18:26.414309
2018-03-04T18:12:06
2018-03-04T18:12:06
121,615,644
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package pharaoh.com.weshare.models; import java.util.Date; /** * Created by Comptia Ware on 2/8/2018. */ public class Home { public int img; public String body; public String posterName; public String date; public int getImg() { return img; } public void setImg(int img) { this.img = img; } public String getBody() { return body; } public void setBody(String body) { this.body = body; } public String getPosterName() { return posterName; } public void setPosterName(String posterName) { this.posterName = posterName; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } }
b6ccd4726bd1b7f3f8bf7b4a7f350dd5caa753ba
61d9043962365080bd8a5f6150d93fcb289ce4f5
/201703/src/_001.java
9318eaeaf43d65651427296268e8c824314a632e
[]
no_license
welikeyou/CCFExercise
fc137a42a515f8ece650facf5f7c797e99e3c1a8
1367d557b9e7bb8c057990026232c20e088c6b14
refs/heads/master
2020-04-27T17:58:35.506496
2020-02-25T01:33:26
2020-02-25T01:33:26
174,547,539
2
0
null
null
null
null
UTF-8
Java
false
false
850
java
import java.util.Scanner; /** * Created with IDEA * author:LiLan * Date:2019/3/15 * Time:14:28 * Introduction:分蛋糕 */ public class _001 { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int k = input.nextInt(); int[] cakes = new int[n]; for(int i=0; i<n; i++){ cakes[i] = input.nextInt(); } int num = 0; for(int i=0; i<n-1; i++){ int cur = cakes[i]; if(cur>=k){ num++; cur = cakes[i]; }else{ cur = cur + cakes[i]; while(cur<k){ i++; cur = cur + cakes[i]; } num++; } } System.out.print(num); } }
baabcc41b3f2145525ba02700f33727b84d30618
d96bef4c2cadc6caab4aeedcca3e083468f39c5c
/Ramya Kondapalli/src/ScannerClasses/FloatValidation.java
8b66071c0d1636417e825dbfdaabeae25a29ce47
[]
no_license
TechieFrogs-Achievers/JavaBasics
a06d46a9b912c587982a52975d61c84722b5b1b1
9a5c5653610449dc7265406fb4343079089328e9
refs/heads/main
2023-03-20T20:42:30.820354
2021-03-12T06:17:19
2021-03-12T06:17:19
313,300,339
4
0
null
null
null
null
UTF-8
Java
false
false
543
java
package ScannerClasses; import java.util.Scanner; public class FloatValidation { public static void main(String[] args) { float number; Scanner s = new Scanner(System.in); do{ System.out.println("Enter a Float number"); while(!s.hasNextFloat());{ System.out.println("The Entered number is not float number"); s.next(); } number = s.nextFloat(); } while(number<0); System.out.print(number + " is float number"); } }
71e441c17dedd8a6b7f7bfc7f2efbfa466f1c03f
57e8e784cf6743d340885cfc0f54b614c6ed087e
/src/br/com/sysfar/imobileweb/dao/CorretorDAO.java
97b7828b29f4b48864460324bd2144eaf0405c28
[]
no_license
Zenon172/ImobileWeb
34f8ef223fdcc7c58061fb1cde56dfe667283941
edd8b5cd6e8cecf92288ee7f3a0bd063062fc6b3
refs/heads/master
2023-01-06T20:53:40.274625
2020-11-05T13:39:15
2020-11-05T13:39:15
310,307,109
0
0
null
null
null
null
UTF-8
Java
false
false
5,430
java
package br.com.sysfar.imobileweb.dao; import java.sql.Timestamp; import java.util.List; import br.com.sysfar.imobileweb.model.CorretorContatoModel; import br.com.sysfar.imobileweb.model.CorretorModel; import br.com.sysfar.imobileweb.util.Utilitario; import br.com.topsys.database.TSDataBaseBrokerIf; import br.com.topsys.database.factory.TSDataBaseBrokerFactory; import br.com.topsys.exception.TSApplicationException; import br.com.topsys.util.TSUtil; public final class CorretorDAO implements CrudDAO<CorretorModel> { public CorretorModel obter(final CorretorModel model) { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.setSQL("SELECT C.ID, C.NOME, C.DATA_CADASTRO, C.USUARIO_CADASTRO_ID, (SELECT U.NOME FROM USUARIO U WHERE U.ID = C.USUARIO_CADASTRO_ID) FROM CORRETOR C WHERE C.ID = ?", model.getId()); return (CorretorModel) broker.getObjectBean(CorretorModel.class, "id", "nome", "dataCadastro", "usuarioCadastroModel.id", "usuarioCadastroModel.nome"); } @SuppressWarnings("unchecked") public List<CorretorModel> pesquisar(final CorretorModel model) { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.setSQL("SELECT C.ID, C.NOME, C.DATA_CADASTRO, C.USUARIO_CADASTRO_ID, (SELECT U.NOME FROM USUARIO U WHERE U.ID = C.USUARIO_CADASTRO_ID) FROM CORRETOR C WHERE SEM_ACENTOS(BUSCA_CORRETOR(C.ID)) ILIKE SEM_ACENTOS(COALESCE(?, SEM_ACENTOS(BUSCA_CORRETOR(C.ID)))) ORDER BY C.NOME", Utilitario.getStringIlike(model.getNome(), true)); return broker.getCollectionBean(CorretorModel.class, "id", "nome", "dataCadastro", "usuarioCadastroModel.id", "usuarioCadastroModel.nome"); } public CorretorModel inserir(final CorretorModel model) throws TSApplicationException { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.beginTransaction(); model.setId(broker.getSequenceNextValue("corretor_id_seq")); broker.setSQL("INSERT INTO CORRETOR(ID, NOME, DATA_CADASTRO, USUARIO_CADASTRO_ID) VALUES (?, ?, ?, ?)", model.getId(), model.getNome(), new Timestamp(model.getDataCadastro().getTime()), model.getUsuarioCadastroModel().getId()); broker.execute(); for (CorretorContatoModel contato : model.getContatos()) { if (!TSUtil.isEmpty(contato.getTelefone()) || !TSUtil.isEmpty(contato.getEmail())) { if (TSUtil.isEmpty(contato.getId())) { this.inserir(contato, broker); } } } broker.endTransaction(); return model; } public CorretorModel alterar(final CorretorModel model) throws TSApplicationException { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.beginTransaction(); broker.setSQL("UPDATE CORRETOR SET NOME = ? WHERE ID = ?", model.getNome(), model.getId()); broker.execute(); for (CorretorContatoModel contato : model.getContatos()) { if (TSUtil.isEmpty(contato.getTelefone()) && TSUtil.isEmpty(contato.getEmail())) { this.excluir(contato, broker); } else { if (TSUtil.isEmpty(contato.getId())) { this.inserir(contato, broker); } else { this.alterar(contato, broker); } } } broker.endTransaction(); return model; } @SuppressWarnings("unchecked") public List<CorretorContatoModel> pesquisarContatos(final CorretorModel model) { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.setSQL("SELECT CC.ID, CC.CORRETOR_ID, CC.NOME, CC.TELEFONE, CC.EMAIL, CC.OPERADORA_ID FROM CORRETOR_CONTATO CC WHERE CC.CORRETOR_ID = ? ORDER BY CC.ID", model.getId()); return broker.getCollectionBean(CorretorContatoModel.class, "id", "corretorModel.id", "nome", "telefone", "email", "operadoraModel.id"); } public void inserir(final CorretorContatoModel model, TSDataBaseBrokerIf broker) throws TSApplicationException { model.setId(broker.getSequenceNextValue("corretor_contato_id_seq")); broker.setSQL("INSERT INTO CORRETOR_CONTATO (ID, CORRETOR_ID, NOME, TELEFONE, EMAIL, OPERADORA_ID) VALUES (?, ?, ?, ?, ?, ?)", model.getId(), model.getCorretorModel().getId(), model.getNome(), model.getTelefone(), model.getEmail(), model.getOperadoraModel().getId()); broker.execute(); } public void alterar(final CorretorContatoModel model, TSDataBaseBrokerIf broker) throws TSApplicationException { broker.setSQL("UPDATE CORRETOR_CONTATO SET NOME = ?, TELEFONE = ?, EMAIL = ?, OPERADORA_ID = ? WHERE ID = ?", model.getNome(), model.getTelefone(), model.getEmail(), model.getOperadoraModel().getId(), model.getId()); broker.execute(); } public CorretorModel excluir(final CorretorModel model) throws TSApplicationException { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.setSQL("DELETE FROM CORRETOR WHERE ID = ?", model.getId()); broker.execute(); return model; } public void excluir(final CorretorContatoModel model, TSDataBaseBrokerIf broker) throws TSApplicationException { broker.setSQL("DELETE FROM CORRETOR_CONTATO WHERE ID = ?", model.getId()); broker.execute(); } public Boolean isExisteCorretor(String campo) { TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf(); broker.setSQL("SELECT EXISTS(SELECT 1 FROM CORRETOR C WHERE SEM_ACENTOS(BUSCA_CORRETOR(C.ID)) ILIKE SEM_ACENTOS(COALESCE(?, SEM_ACENTOS(BUSCA_CORRETOR(C.ID))))) ", Utilitario.getStringIlike(campo, true)); return (Boolean) broker.getObject(); } }
79bfc2410e033e21dc0def696062ce72f39bcfe0
405d2d94951b0286c74ac22403a25f2101dd9f1b
/src/main/java/com/yitong/weixin/modules/gen/web/GenTableController.java
dca83c1375d71f6049c462be53b414bef488caf3
[ "Apache-2.0" ]
permissive
xielina/wechatMBank
c721b1ab0460ab4b88782c7b095a5c4a0461e0a6
65746f9359eb716bec2311277e5c3c6a8a877492
refs/heads/master
2020-12-02T16:29:40.970121
2016-03-01T09:53:18
2016-03-01T09:53:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,897
java
/** * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package com.yitong.weixin.modules.gen.web; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.yitong.weixin.common.persistence.Page; import com.yitong.weixin.common.utils.StringUtils; import com.yitong.weixin.common.web.BaseController; import com.yitong.weixin.modules.sys.entity.User; import com.yitong.weixin.modules.sys.utils.UserUtils; import com.yitong.weixin.modules.gen.entity.GenTable; import com.yitong.weixin.modules.gen.service.GenTableService; import com.yitong.weixin.modules.gen.util.GenUtils; /** * 业务表Controller * @author ThinkGem * @version 2013-10-15 */ @Controller @RequestMapping(value = "${adminPath}/gen/genTable") public class GenTableController extends BaseController { @Autowired private GenTableService genTableService; @ModelAttribute public GenTable get(@RequestParam(required=false) String id) { if (StringUtils.isNotBlank(id)){ return genTableService.get(id); }else{ return new GenTable(); } } @RequiresPermissions("gen:genTable:view") @RequestMapping(value = {"list", ""}) public String list(GenTable genTable, HttpServletRequest request, HttpServletResponse response, Model model) { User user = UserUtils.getUser(); if (!user.isAdmin()){ genTable.setCreateBy(user); } Page<GenTable> page = genTableService.find(new Page<GenTable>(request, response), genTable); model.addAttribute("page", page); return "modules/gen/genTableList"; } @RequiresPermissions("gen:genTable:view") @RequestMapping(value = "form") public String form(GenTable genTable, Model model) { // 获取物理表列表 List<GenTable> tableList = genTableService.findTableListFormDb(new GenTable()); model.addAttribute("tableList", tableList); // 验证表是否存在 if (StringUtils.isBlank(genTable.getId()) && !genTableService.checkTableName(genTable.getName())){ addMessage(model, "下一步失败!" + genTable.getName() + " 表已经添加!"); genTable.setName(""); } // 获取物理表字段 else{ genTable = genTableService.getTableFormDb(genTable); } model.addAttribute("genTable", genTable); model.addAttribute("config", GenUtils.getConfig()); return "modules/gen/genTableForm"; } @RequiresPermissions("gen:genTable:edit") @RequestMapping(value = "save") public String save(GenTable genTable, Model model, RedirectAttributes redirectAttributes) { if (!beanValidator(model, genTable)){ return form(genTable, model); } // 验证表是否已经存在 if (StringUtils.isBlank(genTable.getId()) && !genTableService.checkTableName(genTable.getName())){ addMessage(model, "保存失败!" + genTable.getName() + " 表已经存在!"); genTable.setName(""); return form(genTable, model); } genTableService.save(genTable); addMessage(redirectAttributes, "保存业务表'" + genTable.getName() + "'成功"); return "redirect:" + adminPath + "/gen/genTable/?repage"; } @RequiresPermissions("gen:genTable:edit") @RequestMapping(value = "delete") public String delete(GenTable genTable, RedirectAttributes redirectAttributes) { genTableService.delete(genTable); addMessage(redirectAttributes, "删除业务表成功"); return "redirect:" + adminPath + "/gen/genTable/?repage"; } }
490ac26488d292f46f36c716a9f0f9972f7b6ce0
2d93c27772c7e51d51ec05d6e7621a22a5eb6db6
/app/src/main/java/com/tyiroad/tyiroad/yjbs/YsbsPopowindow.java
9911d31e757d8e19de5638560a229016ac6b6bc6
[]
no_license
zhangchengku/TYiroad
75e2e91e49910d3d0b9de26b780a3e4e5c2c87f6
03b26598fc9f3beb217e43ccaa614a39fb6a4ca2
refs/heads/master
2022-02-26T00:12:21.298317
2019-08-26T08:33:07
2019-08-26T08:33:07
198,362,292
0
0
null
null
null
null
UTF-8
Java
false
false
3,473
java
package com.tyiroad.tyiroad.yjbs; /** * Created by 张成昆 on 2019-5-21. */ import android.app.Activity; import android.graphics.drawable.ColorDrawable; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import com.tooklkit.Tooklkit; import com.tyiroad.tyiroad.R; import com.tyiroad.tyiroad.popuwindo.EditSearchAdapter; import com.tyiroad.tyiroad.utils.DiseaseNewSelectObjectListener; import com.tyiroad.tyiroad.utils.Utils; import java.util.ArrayList; import java.util.ArrayList; public class YsbsPopowindow extends PopupWindow { private Activity activity; private ArrayList<String> listDataStr; private ListView listView; private TextView vTitleTxt; private EditSearchAdapter adapter; private DiseaseNewSelectObjectListener listener; private String titleStr; public YsbsPopowindow(Activity activity, String titleStr, ArrayList<String> listDataStr, DiseaseNewSelectObjectListener listener){ this.activity = activity; this.listDataStr=listDataStr; this.listener=listener; this.titleStr=titleStr; View contentView = LayoutInflater.from(activity).inflate( R.layout.disease_new_sel_obj_pop, null); setContentView(contentView); setWidth(Tooklkit.getWidth(activity)- Tooklkit.dip2px(activity,25)); setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); setFocusable(true); setTouchable(true); setOutsideTouchable(true); setBackgroundDrawable(new ColorDrawable(0)); setAnimationStyle(R.style.mypopwindow_anim_style); initViews(contentView); } private void initViews(View contentView){ vTitleTxt=(TextView)contentView.findViewById(R.id.disease_new_sel_obj_title_txt); listView=contentView.findViewById(R.id.disease_new_sel_obj_list); adapter=new EditSearchAdapter(activity,listDataStr); listView.setAdapter(adapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { listener.selectPosition(position); close(); } }); if(!Utils.isNull(titleStr)){ vTitleTxt.setVisibility(View.VISIBLE); vTitleTxt.setText(titleStr); }else{ vTitleTxt.setVisibility(View.GONE); } setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { if(activity instanceof YjbsActivity){ ((YjbsActivity)activity).hideZheZhaoView(); } } }); } /** * 显示筛选窗口 */ public void show(View anchor) { if (isShowing()) { return; } if (anchor != null) { showAtLocation(anchor, Gravity.BOTTOM, 0, 0); } if (activity instanceof YjbsActivity) { ((YjbsActivity)activity).showZheZhaoView(); } } /** * 关闭筛选窗口 */ public void close() { if (isShowing()) { dismiss(); } } public void notifityData(){ adapter.notifyDataSetChanged(); } }
44226cc53b39cc4f1ed093c601dc7804b9a45385
12094751300c93b67b87b597b3634b81318a6120
/src/main/java/projekti/repositories/CommentsRepository.java
af84e156a3f3e5ef5bbc7518b3c34a1635555ca4
[]
no_license
jompero/wepa_projekti
8d80c9eef9dacb3cdca67bc6a642919ee08c782d
0cb6751ef5403c090f1d070b1bb4e0904f00489b
refs/heads/master
2020-05-07T20:14:09.295371
2019-05-04T09:02:19
2019-05-04T09:02:19
180,850,096
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package projekti.repositories; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import projekti.entities.Comment; import projekti.entities.GenericEntity; public interface CommentsRepository extends JpaRepository<Comment, Long> { public Page<Comment> findByTo(GenericEntity to, Pageable pr); }
a991a92aaede5cfce3076d8d6789d9c8c85f27ef
201a57d01d7ee2e341c7da967ec7efa9b08f3e12
/aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/model/DeleteFieldLevelEncryptionProfileRequest.java
7247857a1dc2d8c0312355ed3fa750cbb03a08d1
[ "Apache-2.0" ]
permissive
winsonrich/aws-sdk-java
0d848273de23e6eff556052022e45e2237154123
17d17222bf662a9f11787fd4244550bbc709f1a6
refs/heads/master
2020-04-01T19:55:29.700960
2018-12-07T14:51:50
2018-12-07T14:51:50
153,578,604
0
0
Apache-2.0
2018-10-18T07:05:29
2018-10-18T07:05:29
null
UTF-8
Java
false
false
5,834
java
/* * Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.cloudfront.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2018-06-18/DeleteFieldLevelEncryptionProfile" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DeleteFieldLevelEncryptionProfileRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * Request the ID of the profile you want to delete from CloudFront. * </p> */ private String id; /** * <p> * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For example: * <code>E2QWRUHAPOMQZL</code>. * </p> */ private String ifMatch; /** * <p> * Request the ID of the profile you want to delete from CloudFront. * </p> * * @param id * Request the ID of the profile you want to delete from CloudFront. */ public void setId(String id) { this.id = id; } /** * <p> * Request the ID of the profile you want to delete from CloudFront. * </p> * * @return Request the ID of the profile you want to delete from CloudFront. */ public String getId() { return this.id; } /** * <p> * Request the ID of the profile you want to delete from CloudFront. * </p> * * @param id * Request the ID of the profile you want to delete from CloudFront. * @return Returns a reference to this object so that method calls can be chained together. */ public DeleteFieldLevelEncryptionProfileRequest withId(String id) { setId(id); return this; } /** * <p> * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For example: * <code>E2QWRUHAPOMQZL</code>. * </p> * * @param ifMatch * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For * example: <code>E2QWRUHAPOMQZL</code>. */ public void setIfMatch(String ifMatch) { this.ifMatch = ifMatch; } /** * <p> * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For example: * <code>E2QWRUHAPOMQZL</code>. * </p> * * @return The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For * example: <code>E2QWRUHAPOMQZL</code>. */ public String getIfMatch() { return this.ifMatch; } /** * <p> * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For example: * <code>E2QWRUHAPOMQZL</code>. * </p> * * @param ifMatch * The value of the <code>ETag</code> header that you received when retrieving the profile to delete. For * example: <code>E2QWRUHAPOMQZL</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public DeleteFieldLevelEncryptionProfileRequest withIfMatch(String ifMatch) { setIfMatch(ifMatch); return this; } /** * Returns a string representation of this object; useful for testing and debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getIfMatch() != null) sb.append("IfMatch: ").append(getIfMatch()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DeleteFieldLevelEncryptionProfileRequest == false) return false; DeleteFieldLevelEncryptionProfileRequest other = (DeleteFieldLevelEncryptionProfileRequest) obj; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getIfMatch() == null ^ this.getIfMatch() == null) return false; if (other.getIfMatch() != null && other.getIfMatch().equals(this.getIfMatch()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getIfMatch() == null) ? 0 : getIfMatch().hashCode()); return hashCode; } @Override public DeleteFieldLevelEncryptionProfileRequest clone() { return (DeleteFieldLevelEncryptionProfileRequest) super.clone(); } }
[ "" ]
84016607777919fafeeab555b66aa6c00b9fed84
45f3c51fa1a59184e1d9dfb5d91115bd89c9fe1a
/Java and MySQL/Java/loops/digitCount.java
262d9caba726402742c642006144256eca30fc33
[]
no_license
artibiradar/Data
5d9a2b5817f636bd85581aa177991bac28170811
7b9079f57480b215bb18bb813884e8bf60acf3f2
refs/heads/master
2021-05-15T11:04:01.128688
2017-10-25T13:31:03
2017-10-25T13:31:03
108,274,527
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
//WAP to count the number of digits in a number.// import java.util.Scanner; class digitCount { public static void main(String args[]) { int n, i=0; System.out.print("Enter a Number:"); Scanner get = new Scanner(System.in); n = get.nextInt(); while(n>0) { n=n/10; i++; } System.out.println(); System.out.println("Number of Digits present : "+i); } }
c14b135db8c719305fcd1f7cdd25f908f18f1a3d
a7cc23e37cf49971b1fa757d9b51200434b90bca
/src/main/java/com/csy/util/algorithm/DesUtil.java
6b095b0070900bb9ab276262d34861c1c07e3d67
[]
no_license
Bigbin212/ForCSY
96c28f366ca76ea057e2ec704779d537e42a5d8a
221f9c1d77094c32ba27666b4bafb9f1ad7e0b65
refs/heads/master
2021-01-19T09:38:47.895080
2016-09-21T09:57:25
2016-09-21T09:57:25
82,131,468
0
0
null
2017-11-28T05:45:34
2017-02-16T02:47:16
Java
UTF-8
Java
false
false
5,020
java
package com.csy.util.algorithm; import java.security.Key; import java.security.Security; import javax.crypto.Cipher; import com.sun.crypto.provider.SunJCE; /** * DES加密和解密工具,可以对字符串进行加密和解密操作 */ public class DesUtil { /** 字符串默认键值 */ private static String strDefaultKey = "D542BC5FD18DCC70"; /** 加密工具 */ private Cipher encryptCipher = null; /** 解密工具 */ private Cipher decryptCipher = null; /** * 将byte数组转换为表示16进制值的字符串, 如:byte[]{8,18}转换为:0813, 和public static byte[] * hexStr2ByteArr(String strIn) 互为可逆的转换过程 * * @param arrB * 需要转换的byte数组 * @return 转换后的字符串 * @throws Exception * 本方法不处理任何异常,所有异常全部抛出 */ public static String byteArr2HexStr(byte[] arrB) throws Exception { int iLen = arrB.length; // 每个byte用两个字符才能表示,所以字符串的长度是数组长度的两倍 StringBuffer sb = new StringBuffer(iLen * 2); for (int i = 0; i < iLen; i++) { int intTmp = arrB[i]; // 把负数转换为正数 while (intTmp < 0) { intTmp = intTmp + 256; } // 小于0F的数需要在前面补0 if (intTmp < 16) { sb.append("0"); } sb.append(Integer.toString(intTmp, 16)); } return sb.toString(); } /** * 将表示16进制值的字符串转换为byte数组, 和public static String byteArr2HexStr(byte[] arrB) * 互为可逆的转换过程 * * @param strIn * 需要转换的字符串 * @return 转换后的byte数组 * @throws Exception * 本方法不处理任何异常,所有异常全部抛出 * @author <a href="mailto:[email protected]">LiGuoQing</a> */ public static byte[] hexStr2ByteArr(String strIn) throws Exception { byte[] arrB = strIn.getBytes(); int iLen = arrB.length; // 两个字符表示一个字节,所以字节数组长度是字符串长度除以2 byte[] arrOut = new byte[iLen / 2]; for (int i = 0; i < iLen; i = i + 2) { String strTmp = new String(arrB, i, 2); arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16); } return arrOut; } /** * 默认构造方法,使用默认密钥 * * @throws Exception */ public DesUtil() throws Exception { this(strDefaultKey); } /** * 指定密钥构造方法 * * @param strKey * 指定的密钥 * @throws Exception */ public DesUtil(String strKey) throws Exception { Security.addProvider(new SunJCE()); Key key = getKey(strKey.getBytes()); encryptCipher = Cipher.getInstance("DES"); encryptCipher.init(Cipher.ENCRYPT_MODE, key); decryptCipher = Cipher.getInstance("DES"); decryptCipher.init(Cipher.DECRYPT_MODE, key); } /** * 加密字节数组 * * @param arrB * 需加密的字节数组 * @return 加密后的字节数组 * @throws Exception */ public byte[] encrypt(byte[] arrB) throws Exception { return encryptCipher.doFinal(arrB); } /** * 加密字符串 * * @param strIn * 需加密的字符串 * @return 加密后的字符串 * @throws Exception */ public String encrypt(String strIn) throws Exception { return byteArr2HexStr(encrypt(strIn.getBytes())); } /** * 解密字节数组 * * @param arrB * 需解密的字节数组 * @return 解密后的字节数组 * @throws Exception */ public byte[] decrypt(byte[] arrB) throws Exception { return decryptCipher.doFinal(arrB); } /** * 解密字符串 * * @param strIn * 需解密的字符串 * @return 解密后的字符串 * @throws Exception */ public String decrypt(String strIn) throws Exception { return new String(decrypt(hexStr2ByteArr(strIn))); } /** * 从指定字符串生成密钥,密钥所需的字节数组长度为8位 不足8位时后面补0,超出8位只取前8位 * * @param arrBTmp * 构成该字符串的字节数组 * @return 生成的密钥 * @throws java.lang.Exception */ private Key getKey(byte[] arrBTmp) throws Exception { // 创建一个空的8位字节数组(默认值为0) byte[] arrB = new byte[8]; // 将原始字节数组转换为8位 for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) { arrB[i] = arrBTmp[i]; } // 生成密钥 Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES"); return key; } }
a164183b9255716ba351c06ab10427e25a10e754
ed63f4b1d0abfeca34faa25c3cee0597510137ab
/spring-boot-durid/src/main/java/com/example/druid/DruidApplication.java
295c9be9e1b14eba9cef6dee645db06cba320e64
[]
no_license
xplx/SpringBoot
7e2f21718a3fe3b7e169aaf8e418e5625e3b05fb
fdcf19596c152d687237bb481bb4034b8a9cc850
refs/heads/master
2022-09-16T10:21:56.793157
2021-12-27T08:30:18
2021-12-27T08:30:18
143,109,663
0
0
null
2022-09-01T23:21:37
2018-08-01T05:50:23
Java
UTF-8
Java
false
false
936
java
package com.example.druid; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.scheduling.annotation.EnableScheduling; import tk.mybatis.spring.annotation.MapperScan; @SpringBootApplication //mapper包扫描@MapperScan @MapperScan("com.example.druid.mapper") @EnableScheduling public class DruidApplication extends SpringBootServletInitializer { /** * 启动类需要添加Servlet的支持 * @param application * @return */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(DruidApplication.class); } public static void main(String[] args) { SpringApplication.run(DruidApplication.class, args); } }
c949ffa342c890ec1cfa333eb344316f56d7a0c8
ace2ea5de7a0aa155868a303a64e5735924a196e
/gameProject/src/Models/Hero.java
723cc4b8b7da8b7287b722327dd621ce0d94bfb2
[]
no_license
green-fox-academy/iaroslavm
b0e102a806fc0f7b87f78cfb129a0fe86913cb32
12e725db9d94ff424a3cf4945e0f77b2f1313b7c
refs/heads/master
2020-05-04T16:42:39.590145
2019-06-06T17:40:56
2019-06-06T17:40:56
179,285,635
0
1
null
2019-06-06T17:40:58
2019-04-03T12:29:38
Java
UTF-8
Java
false
false
2,913
java
package Models; public class Hero extends Character{ int HP = this.maxHP; boolean hasKey; boolean killedBoss; Hero(){ this.cX = 0; this.cY = 0; this.image = "img/hero-down.png"; this.level = 1; this.maxHP = 20 + 3 *((int) (1 + Math.random()*6)); this.HP = this.maxHP; this.dp = 2 * ((int) (1 + Math.random()*6)); this.sp = 5 + ((int) (1 + Math.random()*6)); } Hero(Hero oldHero){ this.cX = 0; this.cY = 0; this.image = "img/hero-down.png"; this.level = oldHero.getLevel(); int randDraw = (int) (1 + Math.random()*10); this.maxHP = oldHero.maxHP; if(randDraw < 1) { this.HP = this.maxHP; } else if (randDraw >= 1 & randDraw < 5){ this.HP = oldHero.HP + ((oldHero.maxHP - oldHero.HP)/3); } else { this.HP = oldHero.HP + ((oldHero.maxHP - oldHero.HP)/10); } this.dp = 2 * ((int) (1 + Math.random()*6)); this.sp = 5 + ((int) (1 + Math.random()*6)); } @Override public void moveUP() { this.cY--; this.image = "img/hero-up.png"; } @Override public void moveDown() { this.cY++; this.image = "img/hero-down.png"; } @Override public void moveLeft() { this.cX--; this.image = "img/hero-left.png"; } @Override public void moveRight() { this.cX++; this.image = "img/hero-right.png"; } public boolean isKilledBoss() { return killedBoss; } public void attackMonster(Monster monster){ while(this.isAlive() & monster.isAlive()) { int heroStrike = this.sp + 2 * (int) (Math.random() * 7); int monsterStrike = monster.sp + +2 * (int) (Math.random() * 7); if (heroStrike > monster.dp) { monster.maxHP += (monster.dp - heroStrike); } if (monsterStrike > this.dp) { this.HP += (this.dp - monsterStrike); } if (this.HP < 0) { this.die(); } if (monster.maxHP < 0) { monster.die(); this.levelUp(); if (monster.hasKey){ monster.setHasKey(false); this.setHasKey(true); } if(monster.isBoss){ this.killedBoss = true; } } } } public void levelUp(){ this.level++; int randIncrease = (int) (1 + Math.random()*6); this.maxHP += randIncrease; this.HP += randIncrease; this.dp += (int) (1 + Math.random()*6); this.sp += (int) (1 + Math.random()*6); } public void lookUp(){ this.image = "img/hero-up.png"; } public void lookDown(){ this.image = "img/hero-down.png"; } public void lookLeft(){ this.image = "img/hero-left.png"; } public void lookRight(){ this.image = "img/hero-right.png"; } public int getHP() { return HP; } public void setHP(int HP) { this.HP = HP; } public boolean isHasKey() { return hasKey; } public void setHasKey(boolean hasKey) { this.hasKey = hasKey; } }
438a3ae752a1701a019c5315f09771296160d5d3
bf0a75000b5ea69f6ec9e9d1cf5300cb769d10ce
/src/main/java/com/dinhthanhphu/movieticketadmin/payload/request/LoginRequest.java
d21b9fde9cb0b2240a4508ba7d809d4439210095
[]
no_license
ThanhPhu-Dev/Movie-Ticket-Admin
c9fa0be8e44b24876a74975303bf17d4be6cd1fe
583a7b227fb2beb7f3eac8b949d0352055f461fa
refs/heads/main
2023-07-28T04:35:29.081189
2021-09-09T07:41:00
2021-09-09T07:41:00
365,652,005
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.dinhthanhphu.movieticketadmin.payload.request; import lombok.Data; import javax.validation.constraints.Email; @Data public class LoginRequest { @Email(message = "email không hợp lệ.") private String email; private String motdepass; }
12c3d5510916660da3c50f7348cb979a9ae69605
bd246fa46cfcab2a7e1f85d2dd4adf6832ef4d67
/P5/src/edu/colostate/cs/cs414/p5/util/FileUtils.java
bafd42bdd13496ce23ff3fa8a85a39aab2322e04
[]
no_license
Pflagert/cs414-f17-301-GenericTeamName
3b16d827f0285fa04c342875af80e17614767a83
3d8354c2adbd6aa9c037e954be46f755eaf0b7fc
refs/heads/master
2021-09-06T22:33:50.035779
2017-12-06T18:22:23
2017-12-06T18:22:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,534
java
package edu.colostate.cs.cs414.p5.util; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; import edu.colostate.cs.cs414.p5.client_server.logger.Logger; public class FileUtils { private static final Logger LOG = Logger.getInstance(); public static void copyFileUsingStream(File source, File dest) { FileInputStream is = null; FileOutputStream os = null; try { is = new FileInputStream(source); os = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } catch(IOException e) { LOG.error("IOException occurred when copying: " + source.getAbsolutePath() + " to " + dest.getAbsolutePath());; } finally { closeFileStream(is); closeFileStream(os); } } public static void copyFileUsingChannel(File source, File dest) { FileChannel sourceChannel = null; FileChannel destChannel = null; FileInputStream sourceStream = null; FileOutputStream destStream = null; try { sourceStream = new FileInputStream(source); sourceChannel = sourceStream.getChannel(); destStream = new FileOutputStream(dest); destChannel = destStream.getChannel(); destChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); LOG.info("Successfully copied: " + source.getAbsolutePath() + " to " + dest.getAbsolutePath()); } catch(IOException e) { LOG.error("IOException occurred when copying: " + source.getAbsolutePath() + " to " + dest.getAbsolutePath());; } finally{ closeFileChannel(sourceChannel); closeFileChannel(destChannel); closeFileStream(sourceStream); closeFileStream(destStream); } } public static void closeFileChannel(FileChannel channel) { if(channel != null && channel.isOpen()) { try { channel.close(); } catch (IOException e) { LOG.error("IOException occurred when closing the file channel"); } } } public static void closeFileStream(FileInputStream stream) { if(stream != null) { try { stream.close(); } catch(Exception e) { LOG.error("An error occurred when closing the file input stream."); } } } public static void closeFileStream(FileOutputStream stream) { if(stream != null) { try { stream.close(); } catch(Exception e) { LOG.error("An error occurred when closing the file output stream."); } } } }
0ab988fe8e10a4cb21b6edecb280117cca3ee4a9
6eaa4f2edafc9ee8e556dd1f4a183b1874ad2952
/app/src/main/java/com/stuart/fileexplorer/manager/TaskChooser.java
95f2a7e5e3be718d2dc0b37f844466835731b74b
[]
no_license
stuart-zhu/FileExplorer
0121d7bd4fd72d5b006def6589a672de2e37cc43
3002aaa5eaf30b3009030a6f95da460e6d0d81d3
refs/heads/master
2020-09-24T23:03:21.620477
2016-09-26T00:58:33
2016-09-26T00:58:33
67,094,463
1
0
null
null
null
null
UTF-8
Java
false
false
2,194
java
package com.stuart.fileexplorer.manager; import android.content.Context; import android.util.Log; import com.stuart.fileexplorer.utils.BitmapCache; import java.util.Queue; import java.util.Stack; import java.util.concurrent.LinkedBlockingQueue; /** * Created by stuart on 2016/9/2. */ public class TaskChooser { private static TaskChooser mInstacne; private Queue<LoadImageTask> mTask; private LoadImageTask mCurrentLoadImageTask; public static TaskChooser getTaskChooser() { if (mInstacne == null) mInstacne = new TaskChooser(); return mInstacne; } public void addTask(LoadImageTask list) { if (mTask == null) { mTask = new LinkedBlockingQueue<>(); } if (!mTask.contains(list)) mTask.offer(list); checkList(); } public void clearTask() { while (mTask.size() > 0) { LoadImageTask task = mTask.poll(); task.cancle(); } } private synchronized void checkList() { while (mTask.size() > 10) { LoadImageTask task = mTask.poll(); task.cancle(); } if (mCurrentLoadImageTask != null) { return; } if (mTask.isEmpty()) { return; } mCurrentLoadImageTask = mTask.poll(); mCurrentLoadImageTask.startOnLoadImageListener(new LoadImageTask.onLoadImageListener() { @Override public void onLoadStart() { Log.i("stuart", "" + mCurrentLoadImageTask + "onLoadStart"); } @Override public void onLoading() { Log.i("stuart", "" + mCurrentLoadImageTask + "onLoading"); } @Override public void onLoadFinish() { Log.i("stuart", "" + mCurrentLoadImageTask + "onLoadFinish"); mCurrentLoadImageTask = null; checkList(); } }); Log.i("stuart", mTask.size() + "," + mCurrentLoadImageTask); if (!mCurrentLoadImageTask.isUsed()) mCurrentLoadImageTask.execute(); else checkList(); } }
30ffb2c486f16eb5f605ef438edf64ba967457fd
3f7fa776fcc5671ca098066dfbd7b9aa4487efc8
/src/main/java/com/gtl/message/service/GtlSawonServiceImpl.java
cf5a92114dc147956d06637132bc7738df831207
[]
no_license
damndog18/GTLWebSpring
faf34f01cd9d52617a489e0e435b8bf36e0b993b
92421c532c54d9f04f1a7310bf5ccb22c6ad7581
refs/heads/master
2020-12-10T04:29:32.660535
2017-06-28T08:22:50
2017-06-28T08:22:50
83,446,493
0
0
null
null
null
null
UTF-8
Java
false
false
660
java
package com.gtl.message.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.gtl.message.domain.GtlSawonDto; import com.gtl.message.persistence.GtlSawonDao; @Component("gtlSawonService") public class GtlSawonServiceImpl implements GtlSawonService { @Autowired private GtlSawonDao gtlSawonDao; @Override public String getTime() { return gtlSawonDao.getTime(); } @Override public String inputDataSawon(GtlSawonDto gtlSawonDto, String sawon_id, String _inputFlag) { return gtlSawonDao.inputDataSawon(gtlSawonDto, sawon_id, _inputFlag); } }
915b40aa71e2c245a20452f143d19f9a5b6f752d
eadeab7061c98f25934ee1b61faac70702345da0
/src/sample/dialogs/DialogColorChooser.java
af716ade5169f86a13afaf725e3148dfed10bf9b
[]
no_license
AngelaVv/EditGraph-master
42ba1cef6f1bdbd2eabe5545b86765c2195b35d0
be62d69d88e7d8ebd9df6ed2f7d0a49ef6727f35
refs/heads/master
2020-05-27T09:12:02.841117
2019-05-25T12:19:39
2019-05-25T12:19:39
188,561,834
0
0
null
null
null
null
UTF-8
Java
false
false
2,134
java
package sample.dialogs; import javafx.fxml.FXML; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.Slider; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.stage.Stage; public class DialogColorChooser { // gui @FXML private Slider rSlider; @FXML private Slider gSlider; @FXML private Slider bSlider; @FXML private Canvas colorPreview; // vars private Color defaultColor; private boolean status; private GraphicsContext graphicsContextCanvas; private Stage _this; @FXML public void initialize(){ graphicsContextCanvas = colorPreview.getGraphicsContext2D(); } public void setPrimaryStage(Stage _this) { this._this = _this; } public Color getDefaultColor() { return defaultColor; } public void setDefaultColor(Color defaultColor) { this.defaultColor = defaultColor; editColorPreview(defaultColor); rSlider.setValue(getColor255(defaultColor.getRed())); gSlider.setValue(getColor255(defaultColor.getGreen())); bSlider.setValue(getColor255(defaultColor.getBlue())); } public boolean isStatus() { return status; } public void btnOkClick(MouseEvent mouseEvent) { status = true; defaultColor = Color.rgb((int)rSlider.getValue(), (int)gSlider.getValue(), (int)bSlider.getValue()); _this.close(); } public void btnCancelClick(MouseEvent mouseEvent) { status = false; _this.close(); } public void dragSlider(MouseEvent mouseEvent) { editColorPreview(Color.rgb((int)rSlider.getValue(), (int)gSlider.getValue(), (int)bSlider.getValue())); } private void editColorPreview(Color cl){ graphicsContextCanvas.setFill(cl); graphicsContextCanvas.fillRect(0,0,colorPreview.getWidth(), colorPreview.getHeight()); } private double getColor255(double cannel){ double pr = 1 / 100.d; double proc = cannel / pr; return Math.round(255 / 100 * proc); } }
8c3ed072da8bddbea3d0045968f8af781ed548f3
6c52903f326b43f5339b18b1525a6623a4f9de0f
/src/leetcode/datastructure/tree/ValidateBinaryTreeNodes1361.java
98865202c5bf31f370cc4981dcb8476d7183ea78
[]
no_license
underwindfall/Algorithme
19f31710cc2a6bf2f4e3f0652225c7ab8858e5ac
2284b7791c99354a3132366131290e2f37aae6dc
refs/heads/master
2022-10-17T14:25:52.815940
2022-09-29T08:32:20
2022-09-29T08:32:20
203,821,259
1
0
null
null
null
null
UTF-8
Java
false
false
2,511
java
package leetcode.datastructure.tree; import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.Set; // https://leetcode.cn/problems/validate-binary-tree-nodes/ public class ValidateBinaryTreeNodes1361 { /** * 查找入度为0的节点 * 即root点 可能会有多个 如果有多个就不是二叉树 * 然后再判断连通性 用广搜统计每个节点遍历的情况 如果一个节点遍历次数为0或者大于1则都不是二叉树 * 此时也算是对有两个root的情况下做了判断 因为只遍历一个root 另一个节点的访问次数肯定为0 * leftChild[i]=j 表明i节点指向j */ public boolean validateBinaryTreeNodes(int n, int[] leftChild, int[] rightChild) { int[] in = new int[n];// 记录每个节点的入度 for (int i = 0; i < n; i++) { if (leftChild[i] != -1) in[leftChild[i]]++; if (rightChild[i] != -1) in[rightChild[i]]++; } int root = -1;// 看看根节点是哪个 for (int i = 0; i < n; i++) { if (in[i] == 0) { root = i; break; } } if (root == -1) { // 没有入度为0的 也就是没有根节点 return false; } // 开始广搜 Queue<Integer> queue = new LinkedList<>(); Set<Integer> set = new HashSet<>();// 记录访问过的节点 如果有重复说明不是二叉树 queue.offer(root); set.add(root); while (!queue.isEmpty()) { int temp = queue.poll(); if (leftChild[temp] != -1) { // 左子树不为空 if (set.contains(leftChild[temp])) { // 左子节点 被访问过 return false; } queue.offer(leftChild[temp]); set.add(leftChild[temp]); } if (rightChild[temp] != -1) { // 右子树不为空 if (set.contains(rightChild[temp])) { // 有子节点 被访问过 return false; } queue.offer(rightChild[temp]); set.add(rightChild[temp]); } } // 如果set里节点数量就为n那么说明全部节点被访问 因为上面有重复的已经判断了 只剩下没访问的没判断 return set.size() == n; } }
39770261b46934abb2605afa15a631e27d63a3dd
b96ccadab093048299a206e4510a13e793a1b636
/src/t2/redes/Chart.java
daef50dac14f46fc8af7f7673550c7a986eb7670
[]
no_license
felcastro/t2-redes
3673255914423c8d37b2791a82e09e9a0942101c
2908acb483ad53b7c244f8bafb7afcfa8e1a576a
refs/heads/master
2021-01-11T00:21:49.934234
2016-10-19T23:19:15
2016-10-19T23:19:15
70,538,913
0
0
null
null
null
null
UTF-8
Java
false
false
2,567
java
package t2.redes; import java.awt.BasicStroke; import java.awt.BorderLayout; import java.awt.Color; import java.util.ArrayList; import javax.swing.JFrame; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYDataset; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; public class Chart { ChartPanel chartPanel = null; JFrame frame = null; public void criaGrafico(String titulo, String tituloGrafico, ArrayList<Point> lista) { JFreeChart xylineChart = ChartFactory.createXYLineChart( tituloGrafico, "Tempo", "Valor", createDataset(lista), PlotOrientation.VERTICAL, true, true, false); if (chartPanel == null) { chartPanel = new ChartPanel(xylineChart); } else { chartPanel.setChart(xylineChart); } chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); final XYPlot plot = xylineChart.getXYPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.BLUE); renderer.setSeriesPaint(1, Color.GREEN); renderer.setSeriesStroke(0, new BasicStroke(4.0f)); renderer.setSeriesStroke(1, new BasicStroke(4.0f)); plot.setRenderer(renderer); if (frame == null) { frame = new JFrame(titulo); frame.setTitle(tituloGrafico); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLayout(new BorderLayout(0, 5)); frame.add(chartPanel, BorderLayout.CENTER); } else { frame.add(chartPanel, BorderLayout.CENTER); } frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private XYDataset createDataset(ArrayList<Point> lista) { final XYSeries in = new XYSeries("In"); final XYSeries out = new XYSeries("Out"); for (int i = 0; i < lista.size(); i++) { in.add(lista.get(i).getInX(), lista.get(i).getInY()); out.add(lista.get(i).getOutX(), lista.get(i).getOutY()); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(in); dataset.addSeries(out); return dataset; } }
0e947c3b341e4856ad12dd71e23f3053b185f9bc
45cd443e5e98d644403c00624e8a076536365dce
/src/main/java/com/fourfinance/repository/FindAllMerged.java
84295d7a3e285638a7a614afe99aaccbe2f8be04
[]
no_license
simeonbin/Intervals_gradle
b47ace39985a201751eddf8d2a68466987229955
8ea141f8187aa7d40cc88291440adb2a34e97801
refs/heads/master
2021-01-01T04:23:17.169844
2017-07-13T21:26:04
2017-07-13T21:26:04
97,165,085
0
0
null
null
null
null
UTF-8
Java
false
false
1,769
java
package com.fourfinance.repository; import com.fourfinance.service.Interval; import com.fourfinance.service.IntervalComparator; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Created by Simeon on 7/13/2017. */ public class FindAllMerged implements IntervalRepository { public List<Interval> findAll(ArrayList<Interval> intervals) { if (intervals.isEmpty() || intervals.size() == 1) return intervals; Collections.sort(intervals, new IntervalComparator()); Interval first = intervals.get(0); int start = first.getStart(); int end = first.getEnd(); ArrayList<Interval> result = new ArrayList<>(); for (int i = 1; i < intervals.size(); i++) { Interval current = intervals.get(i); // if Interval[i].start <= Interval[i-1].end, overlapping interval if (current.getStart() <= end) { // Got Overlapping!! // end = max(Interval[i].end, Interval[i-1].end), // 'end' gets the bigger value of the two, // then keep moving the LOOP. 'start' NOT changing yet!! end = Math.max(current.getEnd(), end); } else // Non-overlapping interval, insert previous (start,end) to result List { result.add(new Interval(start, end)); // non-overlapping interval, 'start' now is about to become larger than previous 'end' // brand new (start,end) exists in current interval. start = current.getStart(); end = current.getEnd(); } } result.add(new Interval(start, end)); return result; } }
8bfede98b8868dbfb2b8e4c5a750db755589bc66
fa79eef892b8ead367b4ab501298d829e426c698
/nifi-toolkit/nifi-toolkit-cli/src/test/java/org/apache/nifi/toolkit/cli/impl/result/TestVersionedFlowSnapshotMetadataResult.java
c36409663932d6656e5169eb3fc0d97f242c7db5
[ "Apache-2.0", "MIT", "ISC" ]
permissive
marklogic-community/marklogic-nifi-incubator
b0d5b936117446908facd5061710e40d4d2b893c
2cce388255fad9dd957b089a3acaa32685c8d2b4
refs/heads/ml-release
2022-10-15T12:26:58.541007
2021-05-25T00:40:17
2021-05-25T00:40:17
172,793,159
5
15
Apache-2.0
2022-10-05T03:06:20
2019-02-26T21:26:39
Java
UTF-8
Java
false
false
3,389
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.nifi.toolkit.cli.impl.result; import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata; import org.apache.nifi.toolkit.cli.api.ResultType; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; public class TestVersionedFlowSnapshotMetadataResult { private ByteArrayOutputStream outputStream; private PrintStream printStream; @Before public void setup() { this.outputStream = new ByteArrayOutputStream(); this.printStream = new PrintStream(outputStream, true); } @Test public void testWriteSimpleVersionedFlowSnapshotResult() throws ParseException, IOException { final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); final VersionedFlowSnapshotMetadata vfs1 = new VersionedFlowSnapshotMetadata(); vfs1.setVersion(1); vfs1.setAuthor("user1"); vfs1.setTimestamp(dateFormat.parse("2018-02-14T12:00:00").getTime()); vfs1.setComments("This is a long comment, longer than the display limit for comments"); final VersionedFlowSnapshotMetadata vfs2 = new VersionedFlowSnapshotMetadata(); vfs2.setVersion(2); vfs2.setAuthor("user2"); vfs2.setTimestamp(dateFormat.parse("2018-02-14T12:30:00").getTime()); vfs2.setComments("This is v2"); final List<VersionedFlowSnapshotMetadata> versions = new ArrayList<>(); versions.add(vfs1); versions.add(vfs2); final VersionedFlowSnapshotMetadataResult result = new VersionedFlowSnapshotMetadataResult(ResultType.SIMPLE, versions); result.write(printStream); final String resultOut = new String(outputStream.toByteArray(), StandardCharsets.UTF_8); //System.out.println(resultOut); // can't get the time zone to line up on travis, so ignore this for now final String expectedPattern = "^\\n" + "Ver +Date + Author + Message +\\n" + "-+ +-+ +-+ +-+ +\\n" + //"1 Wed, Feb 14 2018 12:00 EST user1 This is a long comment, longer than t... \n" + //"2 Wed, Feb 14 2018 12:30 EST user2 This is v2 \n" + "(.|\\n)+$"; Assert.assertTrue(resultOut.matches(expectedPattern)); } }
9b3f62869296bc29a13dab2b086e27415197f74e
255f530d9ca800418a40c54eee3dbb362f60b4ed
/desktop/src/com/futuristech/powpow/desktop/DesktopLauncher.java
51bb831d641e83a54be1c20b4312f0038fa7c3d4
[]
no_license
greggisgood/powpows-adventure
b979c5b045c304a6c245d873f05e749f4ca6769e
8695209065dd0768f79c06689b899a3e2996d333
refs/heads/master
2021-01-01T18:15:05.662564
2017-07-25T09:37:19
2017-07-25T09:37:19
98,287,745
0
0
null
2017-07-25T09:29:30
2017-07-25T09:14:22
null
UTF-8
Java
false
false
534
java
package com.futuristech.powpow.desktop; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; import com.futuristech.powpow.MyGame; import com.futuristech.powpow.utils.Constants; public class DesktopLauncher { public static void main (String[] arg) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = Constants.APP_WIDTH; config.height = Constants.APP_HEIGHT; new LwjglApplication(new MyGame(), config); } }
05395030bc3a4b76812101b3b988e716cc5a3dfb
3353b711562b4152390bb6a0f2361f51daadca55
/RatingsSimulation/src/persistence/User.java
75caa3474cca8bea67e87c280ec471337a46963b
[]
no_license
pgrefviau/CodeTrix-INB302
8ab442945f86a75d1c8a1b8d4f6dc921e808f060
26bdefee95e2a701347cd927539299ef3d301306
refs/heads/master
2021-01-10T20:10:41.848643
2014-03-26T06:56:37
2014-03-26T06:56:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package persistence; import java.util.LinkedList; import java.util.List; public class User { private String userId; private List<Item> ratedItems = new LinkedList<Item>(); public User(String id){ this.userId = id; } public List<ItemUserPair> getPairs() { List<ItemUserPair> pairs = new LinkedList<ItemUserPair>(); for(Item item : ratedItems) pairs.add(new ItemUserPair(item,this)); return pairs; } @Override public String toString() { return userId; } public void addItem(Item newItem) { ratedItems.add(newItem); } public String getId() { return this.userId; } }
7cd7ae8796a06e70d4ccbbf62acc4770f54ae749
b018ace7ef2a13b3c550552735b14b9dbbd2d418
/java-project1/src/lecture_classes/day40_accessModifiers_Final_Hiding_2/CarTest.java
ef1576dd12502732414ed74f080e0997edc985e9
[]
no_license
kilytunc/javaclasses
8c47720a77a7ef1e5d79fbc78c7ef28451043820
025bdf53626ec17fb4a2ddb3913921fe3e6ca676
refs/heads/master
2023-04-26T00:48:27.027540
2021-06-07T14:37:47
2021-06-07T14:37:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package lecture_classes.day40_accessModifiers_Final_Hiding_2; import lecture_classes.day40_accessModifiers_Final_Hiding.Car; public class CarTest { public static void main(String[] args) { // TODO Auto-generated method stub Car c = new Car(); //c.model="M3"; //default c.year=2018; // public //c.door=4; weil private ist. //c.engine=2.0; } }
a4744f8f73425572281bf83ad8c88efc217404cd
aa2f56c3a108da41dafcf53b12e39f520032ca30
/wsclient/src/main/java/org/hpccsystems/ws/client/gen/wsdfu/v1_34/DFUFileProtect.java
53a411e974ea506c89b81054e1b37a89314d4e90
[]
no_license
drealeed/HPCC-JAPIs
459e6c0ab0bbf8d7893fafb775167197567cc573
ee652f4d5163d0f7daa7949015dc4d815b64749d
refs/heads/master
2022-06-24T13:46:14.497602
2019-05-21T18:24:47
2019-05-21T18:24:47
23,236,635
0
0
null
null
null
null
UTF-8
Java
false
false
5,823
java
/** * DFUFileProtect.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package org.hpccsystems.ws.client.gen.wsdfu.v1_34; public class DFUFileProtect implements java.io.Serializable { private java.lang.String owner; private java.lang.Integer count; private java.lang.String modified; public DFUFileProtect() { } public DFUFileProtect( java.lang.String owner, java.lang.Integer count, java.lang.String modified) { this.owner = owner; this.count = count; this.modified = modified; } /** * Gets the owner value for this DFUFileProtect. * * @return owner */ public java.lang.String getOwner() { return owner; } /** * Sets the owner value for this DFUFileProtect. * * @param owner */ public void setOwner(java.lang.String owner) { this.owner = owner; } /** * Gets the count value for this DFUFileProtect. * * @return count */ public java.lang.Integer getCount() { return count; } /** * Sets the count value for this DFUFileProtect. * * @param count */ public void setCount(java.lang.Integer count) { this.count = count; } /** * Gets the modified value for this DFUFileProtect. * * @return modified */ public java.lang.String getModified() { return modified; } /** * Sets the modified value for this DFUFileProtect. * * @param modified */ public void setModified(java.lang.String modified) { this.modified = modified; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof DFUFileProtect)) return false; DFUFileProtect other = (DFUFileProtect) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.owner==null && other.getOwner()==null) || (this.owner!=null && this.owner.equals(other.getOwner()))) && ((this.count==null && other.getCount()==null) || (this.count!=null && this.count.equals(other.getCount()))) && ((this.modified==null && other.getModified()==null) || (this.modified!=null && this.modified.equals(other.getModified()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getOwner() != null) { _hashCode += getOwner().hashCode(); } if (getCount() != null) { _hashCode += getCount().hashCode(); } if (getModified() != null) { _hashCode += getModified().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(DFUFileProtect.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("urn:hpccsystems:ws:wsdfu", "DFUFileProtect")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("owner"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:wsdfu", "Owner")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("count"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:wsdfu", "Count")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("modified"); elemField.setXmlName(new javax.xml.namespace.QName("urn:hpccsystems:ws:wsdfu", "Modified")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
0f1915880125d4b80933da2f454fd8d4ceca3591
b86d6f241815eb0d0d300bc932f48f4ecffc10d4
/src/practica6_JAVA/Habitacion.java
359b316053704567a4321788be273d3863bccd0a
[]
no_license
ermigele/Programacion2019_2020
ac9a1e4908ca9241db73e274a90cf157b36d9b1a
8da40452d768cdc0c80c136b6b6146c1f93e5d5d
refs/heads/master
2020-09-13T19:23:45.146744
2020-05-06T15:05:32
2020-05-06T15:05:32
222,880,920
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,625
java
package practica6_JAVA; class Habitacion { // ATRIBUTOS private static int totalHabitaciones; private int numHabitacion; private Reserva[] reservasHabitacion; private int posicionLibre; // CONSTRUCTOR Habitacion(int numHabitacion, int maxReservas) { this.numHabitacion = numHabitacion; totalHabitaciones++; this.reservasHabitacion = new Reserva[maxReservas]; this.posicionLibre = 0; } // GETTERS & SETTERS public int getTotalHabitaciones() { return totalHabitaciones; } public int getNumHabitacion() { return numHabitacion; } public void setNumHabitacion(int numHabitacion) { this.numHabitacion = numHabitacion; } /* * Esta clase tendrá getters para todos los atributos (ten en cuenta que para el * vector reservasHabitacion el getter debe devolver la habitación de la * posición que se pase como parámetro si es que existe, si no, ha de devolver * null). Y el único setter que tiene es el del atributo del número de * habitación. */ public Reserva getReservasHabitacion(int posicion) { return reservasHabitacion[posicion]; } public int getPosicionLibre() { return posicionLibre; } // METODOS /* * o Hay hueco en el vector de reservas * * o Si la fecha de entrada es menor que la fecha de salida de la reserva pasada * como parámetro (te serán útiles los métodos de la clase fecha, esMenor, * esMayor, esMenorIgual, esMayorIgual..). * * o Si las fechas de la reserva pasada como parámetro no se solapa con ninguna * otra reserva de las que ya hay hechas. * * Si la reserva puede hacerse, se mete el objeto Reserva en la primera posición * libre que haya en el vector (aumentando el atributo que indica la posición * libre) y devolverá TRUE. En caso contrario ha de devolver FALSE. */ public boolean anyadeReserva(Reserva r1) { if (this.posicionLibre < 0) return false; Reserva temp; for (int i = 0; i < this.posicionLibre; i++) { temp = reservasHabitacion[i]; if ( // Si se solapan las fechas temp != null && r1.getFechaEntrada().esMenorOIgual(temp.getFechaSalida()) && r1.getFechaSalida().esMayorOIgual(temp.getFechaEntrada())) { return false; } } reservasHabitacion[this.posicionLibre] = r1; this.posicionLibre = (reservasHabitacion.length == posicionLibre + 1) ? -1 : posicionLibre + 1; return true; } public void imprimirReservas() { for (int i = 0; i < reservasHabitacion.length; i++) { System.out.println("Reserva nº:" + i); reservasHabitacion[i].imprimeReserva(); } } }
01dc6213270a92ebfa1fe8612d0aa9f45affea21
c416e00dc55710c18b94eab0800a7b4bf40d05e1
/app/src/main/java/com/example/win7/ytdemo/activity/JiankongActivity.java
3415a55fd42ca65576a81d4e0ef4d9d67a843178
[]
no_license
AndyYan1010/yuetong
f71d13d41b2975e5ee17b9736bb9c46f7c5eae61
c67aa052fb021d3751c40b5d5f213a61a011b966
refs/heads/master
2020-03-10T05:34:27.552963
2018-04-12T07:49:11
2018-04-12T07:49:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,172
java
package com.example.win7.ytdemo.activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.View; import com.example.win7.ytdemo.R; public class JiankongActivity extends AppCompatActivity { Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jiankong); setTool(); setViews(); setListeners(); } protected void setTool(){ toolbar = (Toolbar)findViewById(R.id.id_toolbar); toolbar.setTitle(getResources().getString(R.string.jiankong)); toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary)); setSupportActionBar(toolbar); toolbar.setNavigationIcon(android.R.drawable.ic_menu_revert); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } protected void setViews(){ } protected void setListeners(){ } }