blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
55f4c7683180e5cf53ceac25fcb600e714f43bf5
c8f5b07c57fcd8b5504d9d43c6dd11b771b2f1de
/common/src/main/java/net/rajpals/common/pickers/TimePickerFragment.java
cb295ee85e6fdae9da0ea689c5f647124ca78ced
[]
no_license
HeshamElShafei95/3ezooma_app_public
c9c040434de236f15300f4b92556ad412b922386
1ec09ee3d699b1bd94fe12dc413f7ffc36fa1831
refs/heads/master
2021-01-03T03:25:38.093390
2020-02-23T15:41:26
2020-02-23T15:41:26
239,902,107
0
0
null
null
null
null
UTF-8
Java
false
false
1,815
java
package net.rajpals.common.pickers; import android.app.Dialog; import android.app.TimePickerDialog; import android.os.Bundle; import androidx.fragment.app.DialogFragment; import android.widget.TimePicker; import java.util.Calendar; public class TimePickerFragment extends DialogFragment implements TimePickerDialog.OnTimeSetListener { public static final String TAG = TimePickerFragment.class.getSimpleName(); private OnTimeListener mOnTimeListener; @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, hourOfDay); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); if (mOnTimeListener != null) mOnTimeListener.onTimeSelected(calendar); dismiss(); } public static TimePickerFragment newInstance() { Bundle args = new Bundle(); TimePickerFragment fragment = new TimePickerFragment(); fragment.setArguments(args); return fragment; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int hour = c.get(Calendar.HOUR_OF_DAY); int min = c.get(Calendar.MINUTE); // Create a new instance of DatePickerDialog and return it TimePickerDialog dialog = new TimePickerDialog(getActivity(),this,hour,min,false); return dialog; } public void setOnTimeListener(OnTimeListener onTimeListener) { mOnTimeListener = onTimeListener; } public interface OnTimeListener { void onTimeSelected(Calendar date); } }
a65efb616a061d93659c0dd195904ec114d8669a
e26cd05dff423f53ecb514a0209da3e82589f517
/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/authentication/OAuth2AuthenticationProcessingFilter.java
ccddfe3ea6a07d4d83952780955abf7990963199
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
wangxiangyun/spring-oauth2.0-dynamic
55cddff5241511ea45dc6e441831ac66f4ebb735
d06180ca83ef654f1bdc826b829ba559b9447d24
refs/heads/master
2020-12-03T06:45:15.435685
2018-10-25T06:25:15
2018-10-25T06:25:15
95,726,179
3
0
null
null
null
null
UTF-8
Java
false
false
7,957
java
/* * Copyright 2006-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.springframework.security.oauth2.provider.authentication; import java.io.IOException; import java.util.UUID; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.slf4j.MDC; import org.springframework.beans.factory.InitializingBean; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.authentication.AuthenticationDetailsSource; import org.springframework.security.authentication.AuthenticationEventPublisher; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.InsufficientAuthenticationException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; import org.springframework.util.Assert; /** * A pre-authentication filter for OAuth2 protected resources. Extracts an OAuth2 token from the incoming request and * uses it to populate the Spring Security context with an {@link OAuth2Authentication} (if used in conjunction with an * {@link OAuth2AuthenticationManager}). * * @author Dave Syer * */ public class OAuth2AuthenticationProcessingFilter implements Filter, InitializingBean { private final static Log logger = LogFactory.getLog(OAuth2AuthenticationProcessingFilter.class); private AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint(); private AuthenticationManager authenticationManager; private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new OAuth2AuthenticationDetailsSource(); private TokenExtractor tokenExtractor = new BearerTokenExtractor(); private AuthenticationEventPublisher eventPublisher = new NullEventPublisher(); private boolean stateless = true; /** * Flag to say that this filter guards stateless resources (default true). Set this to true if the only way the * resource can be accessed is with a token. If false then an incoming cookie can populate the security context and * allow access to a caller that isn't an OAuth2 client. * * @param stateless the flag to set (default true) */ public void setStateless(boolean stateless) { this.stateless = stateless; } /** * @param authenticationEntryPoint the authentication entry point to set */ public void setAuthenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint) { this.authenticationEntryPoint = authenticationEntryPoint; } /** * @param authenticationManager the authentication manager to set (mandatory with no default) */ public void setAuthenticationManager(AuthenticationManager authenticationManager) { this.authenticationManager = authenticationManager; } /** * @param tokenExtractor the tokenExtractor to set */ public void setTokenExtractor(TokenExtractor tokenExtractor) { this.tokenExtractor = tokenExtractor; } /** * @param eventPublisher the event publisher to set */ public void setAuthenticationEventPublisher(AuthenticationEventPublisher eventPublisher) { this.eventPublisher = eventPublisher; } /** * @param authenticationDetailsSource The AuthenticationDetailsSource to use */ public void setAuthenticationDetailsSource( AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource) { Assert.notNull(authenticationDetailsSource, "AuthenticationDetailsSource required"); this.authenticationDetailsSource = authenticationDetailsSource; } public void afterPropertiesSet() { Assert.state(authenticationManager != null, "AuthenticationManager is required"); } public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { this.setMDCKey(req,res); final boolean debug = logger.isDebugEnabled(); final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) res; try { Authentication authentication = tokenExtractor.extract(request); if (authentication == null) { if (stateless && isAuthenticated()) { if (debug) { logger.debug("Clearing security context."); } SecurityContextHolder.clearContext(); } if (debug) { logger.debug("No token in request, will continue chain."); } } else { request.setAttribute(OAuth2AuthenticationDetails.ACCESS_TOKEN_VALUE, authentication.getPrincipal()); if (authentication instanceof AbstractAuthenticationToken) { AbstractAuthenticationToken needsDetails = (AbstractAuthenticationToken) authentication; needsDetails.setDetails(authenticationDetailsSource.buildDetails(request)); } Authentication authResult = authenticationManager.authenticate(authentication); if (debug) { logger.debug("Authentication success: " + authResult); } eventPublisher.publishAuthenticationSuccess(authResult); SecurityContextHolder.getContext().setAuthentication(authResult); } } catch (OAuth2Exception failed) { SecurityContextHolder.clearContext(); if (debug) { logger.debug("Authentication request failed: " + failed); } eventPublisher.publishAuthenticationFailure(new BadCredentialsException(failed.getMessage(), failed), new PreAuthenticatedAuthenticationToken("access-token", "N/A")); authenticationEntryPoint.commence(request, response, new InsufficientAuthenticationException(failed.getMessage(), failed)); return; } chain.doFilter(request, response); } /** * 设置一个唯一的追踪key 方便查询日志 * @param request * @param res */ private void setMDCKey(ServletRequest request, ServletResponse res) { MDC.put("MDCKEY", UUID.randomUUID().toString()); } private boolean isAuthenticated() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication == null || authentication instanceof AnonymousAuthenticationToken) { return false; } return true; } public void init(FilterConfig filterConfig) throws ServletException { } public void destroy() { } private static final class NullEventPublisher implements AuthenticationEventPublisher { public void publishAuthenticationFailure(AuthenticationException exception, Authentication authentication) { } public void publishAuthenticationSuccess(Authentication authentication) { } } }
1948d7618a564a357102042a21e775300c182a8b
95cfe2239c8fce0cec91d76e0a82f59a9efc4cb8
/sourceCode/CommonsLangMutGenerator/java.lang.NullPointerException/19453_lang/mut/EqualsBuilder.java
a41778afa19542f9ec652faec2ed8aa96c5167b9
[]
no_license
Djack1010/BUG_DB
28eff24aece45ed379b49893176383d9260501e7
a4b6e4460a664ce64a474bfd7da635aa7ff62041
refs/heads/master
2022-04-09T01:58:29.736794
2020-03-13T14:15:11
2020-03-13T14:15:11
141,260,015
0
1
null
null
null
null
UTF-8
Java
false
false
33,273
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.commons.lang3.builder; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.Pair; /** * <p>Assists in implementing {@link Object#equals(Object)} methods.</p> * * <p> This class provides methods to build a good equals method for any * class. It follows rules laid out in * <a href="http://www.oracle.com/technetwork/java/effectivejava-136174.html">Effective Java</a> * , by Joshua Bloch. In particular the rule for comparing <code>doubles</code>, * <code>floats</code>, and arrays can be tricky. Also, making sure that * <code>equals()</code> and <code>hashCode()</code> are consistent can be * difficult.</p> * * <p>Two Objects that compare as equals must generate the same hash code, * but two Objects with the same hash code do not have to be equal.</p> * * <p>All relevant fields should be included in the calculation of equals. * Derived fields may be ignored. In particular, any field used in * generating a hash code must be used in the equals method, and vice * versa.</p> * * <p>Typical use for the code is as follows:</p> * <pre> * public boolean equals(Object obj) { * if (obj == null) { return false; } * if (obj == this) { return true; } * if (obj.getClass() != getClass()) { * return false; * } * MyClass rhs = (MyClass) obj; * return new EqualsBuilder() * .appendSuper(super.equals(obj)) * .append(field1, rhs.field1) * .append(field2, rhs.field2) * .append(field3, rhs.field3) * .isEquals(); * } * </pre> * * <p> Alternatively, there is a method that uses reflection to determine * the fields to test. Because these fields are usually private, the method, * <code>reflectionEquals</code>, uses <code>AccessibleObject.setAccessible</code> to * change the visibility of the fields. This will fail under a security * manager, unless the appropriate permissions are set up correctly. It is * also slower than testing explicitly. Non-primitive fields are compared using * <code>equals()</code>.</p> * * <p> A typical invocation for this method would look like:</p> * <pre> * public boolean equals(Object obj) { * return EqualsBuilder.reflectionEquals(this, obj); * } * </pre> * * @since 1.0 * @version $Id: EqualsBuilder.java 1623970 2014-09-10 11:32:53Z djones $ */ public class EqualsBuilder implements Builder<Boolean> { /** * <p> * A registry of objects used by reflection methods to detect cyclical object references and avoid infinite loops. * </p> * * @since 3.0 */ private static final ThreadLocal<Set<Pair<IDKey, IDKey>>> REGISTRY = new ThreadLocal<Set<Pair<IDKey, IDKey>>>(); /* * NOTE: we cannot store the actual objects in a HashSet, as that would use the very hashCode() * we are in the process of calculating. * * So we generate a one-to-one mapping from the original object to a new object. * * Now HashSet uses equals() to determine if two elements with the same hashcode really * are equal, so we also need to ensure that the replacement objects are only equal * if the original objects are identical. * * The original implementation (2.4 and before) used the System.indentityHashCode() * method - however this is not guaranteed to generate unique ids (e.g. LANG-459) * * We now use the IDKey helper class (adapted from org.apache.axis.utils.IDKey) * to disambiguate the duplicate ids. */ /** * <p> * Returns the registry of object pairs being traversed by the reflection * methods in the current thread. * </p> * * @return Set the registry of objects being traversed * @since 3.0 */ static Set<Pair<IDKey, IDKey>> getRegistry() { return REGISTRY.get(); } /** * <p> * Converters value pair into a register pair. * </p> * * @param lhs <code>this</code> object * @param rhs the other object * * @return the pair */ static Pair<IDKey, IDKey> getRegisterPair(final Object lhs, final Object rhs) { final IDKey left = new IDKey(lhs); final IDKey right = new IDKey(rhs); return Pair.of(left, right); } /** * <p> * Returns <code>true</code> if the registry contains the given object pair. * Used by the reflection methods to avoid infinite loops. * Objects might be swapped therefore a check is needed if the object pair * is registered in given or swapped order. * </p> * * @param lhs <code>this</code> object to lookup in registry * @param rhs the other object to lookup on registry * @return boolean <code>true</code> if the registry contains the given object. * @since 3.0 */ static boolean isRegistered(final Object lhs, final Object rhs) { final Set<Pair<IDKey, IDKey>> registry = getRegistry(); final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs); final Pair<IDKey, IDKey> swappedPair = Pair.of(pair.getLeft(), pair.getRight()); return registry != null && (registry.contains(pair) || registry.contains(swappedPair)); } /** * <p> * Registers the given object pair. * Used by the reflection methods to avoid infinite loops. * </p> * * @param lhs <code>this</code> object to register * @param rhs the other object to register */ static void register(final Object lhs, final Object rhs) { synchronized (EqualsBuilder.class) { if (getRegistry() == null) { REGISTRY.set(new HashSet<Pair<IDKey, IDKey>>()); } } final Set<Pair<IDKey, IDKey>> registry = getRegistry(); final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs); registry.add(pair); } /** * <p> * Unregisters the given object pair. * </p> * * <p> * Used by the reflection methods to avoid infinite loops. * * @param lhs <code>this</code> object to unregister * @param rhs the other object to unregister * @since 3.0 */ static void unregister(final Object lhs, final Object rhs) { Set<Pair<IDKey, IDKey>> registry = getRegistry(); if (registry != null) { final Pair<IDKey, IDKey> pair = getRegisterPair(lhs, rhs); registry.remove(pair); synchronized (EqualsBuilder.class) { //read again registry = getRegistry(); if (registry != null && registry.isEmpty()) { REGISTRY.remove(); } } } } /** * If the fields tested are equals. * The default value is <code>true</code>. */ private boolean isEquals = true; /** * <p>Constructor for EqualsBuilder.</p> * * <p>Starts off assuming that equals is <code>true</code>.</p> * @see Object#equals(Object) */ public EqualsBuilder() { // do nothing for now. } //------------------------------------------------------------------------- /** * <p>This method uses reflection to determine if the two <code>Object</code>s * are equal.</p> * * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * fields. This means that it will throw a security exception if run under * a security manager, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly. Non-primitive fields are compared using * <code>equals()</code>.</p> * * <p>Transient members will be not be tested, as they are likely derived * fields, and not part of the value of the Object.</p> * * <p>Static fields will not be tested. Superclass fields will be included.</p> * * @param lhs <code>this</code> object * @param rhs the other object * @param excludeFields Collection of String field names to exclude from testing * @return <code>true</code> if the two Objects have tested equals. */ public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collection<String> excludeFields) { return reflectionEquals(lhs, rhs, ReflectionToStringBuilder.toNoNullStringArray(excludeFields)); } /** * <p>This method uses reflection to determine if the two <code>Object</code>s * are equal.</p> * * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * fields. This means that it will throw a security exception if run under * a security manager, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly. Non-primitive fields are compared using * <code>equals()</code>.</p> * * <p>Transient members will be not be tested, as they are likely derived * fields, and not part of the value of the Object.</p> * * <p>Static fields will not be tested. Superclass fields will be included.</p> * * @param lhs <code>this</code> object * @param rhs the other object * @param excludeFields array of field names to exclude from testing * @return <code>true</code> if the two Objects have tested equals. */ public static boolean reflectionEquals(final Object lhs, final Object rhs, final String... excludeFields) { return reflectionEquals(lhs, rhs, false, null, excludeFields); } /** * <p>This method uses reflection to determine if the two <code>Object</code>s * are equal.</p> * * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * fields. This means that it will throw a security exception if run under * a security manager, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly. Non-primitive fields are compared using * <code>equals()</code>.</p> * * <p>If the TestTransients parameter is set to <code>true</code>, transient * members will be tested, otherwise they are ignored, as they are likely * derived fields, and not part of the value of the <code>Object</code>.</p> * * <p>Static fields will not be tested. Superclass fields will be included.</p> * * @param lhs <code>this</code> object * @param rhs the other object * @param testTransients whether to include transient fields * @return <code>true</code> if the two Objects have tested equals. */ public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients) { return reflectionEquals(lhs, rhs, testTransients, null); } /** * <p>This method uses reflection to determine if the two <code>Object</code>s * are equal.</p> * * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private * fields. This means that it will throw a security exception if run under * a security manager, if the permissions are not set up correctly. It is also * not as efficient as testing explicitly. Non-primitive fields are compared using * <code>equals()</code>.</p> * * <p>If the testTransients parameter is set to <code>true</code>, transient * members will be tested, otherwise they are ignored, as they are likely * derived fields, and not part of the value of the <code>Object</code>.</p> * * <p>Static fields will not be included. Superclass fields will be appended * up to and including the specified superclass. A null superclass is treated * as java.lang.Object.</p> * * @param lhs <code>this</code> object * @param rhs the other object * @param testTransients whether to include transient fields * @param reflectUpToClass the superclass to reflect up to (inclusive), * may be <code>null</code> * @param excludeFields array of field names to exclude from testing * @return <code>true</code> if the two Objects have tested equals. * @since 2.0 */ public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass, final String... excludeFields) { if (lhs == rhs) { return true; } if (lhs == null || rhs == null) { return false; } // Find the leaf class since there may be transients in the leaf // class or in classes between the leaf and root. // If we are not testing transients or a subclass has no ivars, // then a subclass can test equals to a superclass. final Class<?> lhsClass = lhs.getClass(); final Class<?> rhsClass = rhs.getClass(); Class<?> testClass; if (lhsClass.isInstance(rhs)) { testClass = lhsClass; if (!rhsClass.isInstance(lhs)) { // rhsClass is a subclass of lhsClass testClass = rhsClass; } } else if (rhsClass.isInstance(lhs)) { testClass = rhsClass; if (!lhsClass.isInstance(rhs)) { // lhsClass is a subclass of rhsClass testClass = lhsClass; } } else { // The two classes are not related. return false; } final EqualsBuilder equalsBuilder = new EqualsBuilder(); try { if (testClass.isArray()) { equalsBuilder.append(lhs, rhs); } else { reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields); while (testClass.getSuperclass() != null && testClass != reflectUpToClass) { testClass = testClass.getSuperclass(); reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients, excludeFields); } } } catch (final IllegalArgumentException e) { // In this case, we tried to test a subclass vs. a superclass and // the subclass has ivars or the ivars are transient and // we are testing transients. // If a subclass has ivars that we are trying to test them, we get an // exception and we know that the objects are not equal. return false; } return equalsBuilder.isEquals(); } /** * <p>Appends the fields and values defined by the given object of the * given Class.</p> * * @param lhs the left hand object * @param rhs the right hand object * @param clazz the class to append details of * @param builder the builder to append to * @param useTransients whether to test transient fields * @param excludeFields array of field names to exclude from testing */ private static void reflectionAppend( final Object lhs, final Object rhs, final Class<?> clazz, final EqualsBuilder builder, final boolean useTransients, final String[] excludeFields) { if (isRegistered(lhs, rhs)) { return; } try { register(lhs, rhs); final Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible(fields, true); for (int i = 0; i < fields.length && builder.isEquals; i++) { final Field f = fields[i]; if (!ArrayUtils.contains(excludeFields, f.getName()) && (f.getName().indexOf('$') == -1) && (useTransients || !Modifier.isTransient(f.getModifiers())) && (!Modifier.isStatic(f.getModifiers()))) { try { builder.append(f.get(lhs), f.get(rhs)); } catch (final IllegalAccessException e) { //this can't happen. Would get a Security exception instead //throw a runtime exception in case the impossible happens. throw new InternalError("Unexpected IllegalAccessException"); } } } } finally { unregister(lhs, rhs); } } //------------------------------------------------------------------------- /** * <p>Adds the result of <code>super.equals()</code> to this builder.</p> * * @param superEquals the result of calling <code>super.equals()</code> * @return EqualsBuilder - used to chain calls. * @since 2.0 */ public EqualsBuilder appendSuper(final boolean superEquals) { if (isEquals == false) { return this; } isEquals = superEquals; return this; } //------------------------------------------------------------------------- /** * <p>Test if two <code>Object</code>s are equal using their * <code>equals</code> method.</p> * * @param lhs the left hand object * @param rhs the right hand object * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final Object lhs, final Object rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } final Class<?> lhsClass = lhs.getClass(); if (!lhsClass.isArray()) { // The simple case, not an array, just test the element isEquals = lhs.equals(rhs); } else if (lhs.getClass() != rhs.getClass()) { // Here when we compare different dimensions, for example: a boolean[][] to a boolean[] this.setEquals(false); } // 'Switch' on type of array, to dispatch to the correct handler // This handles multi dimensional arrays of the same depth else if (lhs instanceof long[]) { append((long[]) lhs, (long[]) rhs); } else if (lhs instanceof int[]) { append((int[]) lhs, (int[]) rhs); } else if (lhs instanceof short[]) { append((short[]) lhs, (short[]) rhs); } else if (lhs instanceof char[]) { append((char[]) lhs, (char[]) rhs); } else if (lhs instanceof byte[]) { append((byte[]) lhs, (byte[]) rhs); } else if (lhs instanceof double[]) { append((double[]) lhs, (double[]) rhs); } else if (lhs instanceof float[]) { append((float[]) lhs, (float[]) rhs); } else if (lhs instanceof boolean[]) { append((boolean[]) lhs, (boolean[]) rhs); } else { // Not an array of primitives append((Object[]) lhs, (Object[]) rhs); } return this; } /** * <p> * Test if two <code>long</code> s are equal. * </p> * * @param lhs * the left hand <code>long</code> * @param rhs * the right hand <code>long</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final long lhs, final long rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Test if two <code>int</code>s are equal.</p> * * @param lhs the left hand <code>int</code> * @param rhs the right hand <code>int</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final int lhs, final int rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Test if two <code>short</code>s are equal.</p> * * @param lhs the left hand <code>short</code> * @param rhs the right hand <code>short</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final short lhs, final short rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Test if two <code>char</code>s are equal.</p> * * @param lhs the left hand <code>char</code> * @param rhs the right hand <code>char</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final char lhs, final char rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Test if two <code>byte</code>s are equal.</p> * * @param lhs the left hand <code>byte</code> * @param rhs the right hand <code>byte</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final byte lhs, final byte rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Test if two <code>double</code>s are equal by testing that the * pattern of bits returned by <code>doubleToLong</code> are equal.</p> * * <p>This handles NaNs, Infinities, and <code>-0.0</code>.</p> * * <p>It is compatible with the hash code generated by * <code>HashCodeBuilder</code>.</p> * * @param lhs the left hand <code>double</code> * @param rhs the right hand <code>double</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final double lhs, final double rhs) { if (isEquals == false) { return this; } return append(Double.doubleToLongBits(lhs), Double.doubleToLongBits(rhs)); } /** * <p>Test if two <code>float</code>s are equal byt testing that the * pattern of bits returned by doubleToLong are equal.</p> * * <p>This handles NaNs, Infinities, and <code>-0.0</code>.</p> * * <p>It is compatible with the hash code generated by * <code>HashCodeBuilder</code>.</p> * * @param lhs the left hand <code>float</code> * @param rhs the right hand <code>float</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final float lhs, final float rhs) { if (isEquals == false) { return this; } return append(Float.floatToIntBits(lhs), Float.floatToIntBits(rhs)); } /** * <p>Test if two <code>booleans</code>s are equal.</p> * * @param lhs the left hand <code>boolean</code> * @param rhs the right hand <code>boolean</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final boolean lhs, final boolean rhs) { if (isEquals == false) { return this; } isEquals = (lhs == rhs); return this; } /** * <p>Performs a deep comparison of two <code>Object</code> arrays.</p> * * <p>This also will be called for the top level of * multi-dimensional, ragged, and multi-typed arrays.</p> * * @param lhs the left hand <code>Object[]</code> * @param rhs the right hand <code>Object[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final Object[] lhs, final Object[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>long</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(long, long)} is used.</p> * * @param lhs the left hand <code>long[]</code> * @param rhs the right hand <code>long[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final long[] lhs, final long[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>int</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(int, int)} is used.</p> * * @param lhs the left hand <code>int[]</code> * @param rhs the right hand <code>int[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final int[] lhs, final int[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>short</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(short, short)} is used.</p> * * @param lhs the left hand <code>short[]</code> * @param rhs the right hand <code>short[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final short[] lhs, final short[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>char</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(char, char)} is used.</p> * * @param lhs the left hand <code>char[]</code> * @param rhs the right hand <code>char[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final char[] lhs, final char[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>byte</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(byte, byte)} is used.</p> * * @param lhs the left hand <code>byte[]</code> * @param rhs the right hand <code>byte[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final byte[] lhs, final byte[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>double</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(double, double)} is used.</p> * * @param lhs the left hand <code>double[]</code> * @param rhs the right hand <code>double[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final double[] lhs, final double[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>float</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(float, float)} is used.</p> * * @param lhs the left hand <code>float[]</code> * @param rhs the right hand <code>float[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final float[] lhs, final float[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || rhs == null) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Deep comparison of array of <code>boolean</code>. Length and all * values are compared.</p> * * <p>The method {@link #append(boolean, boolean)} is used.</p> * * @param lhs the left hand <code>boolean[]</code> * @param rhs the right hand <code>boolean[]</code> * @return EqualsBuilder - used to chain calls. */ public EqualsBuilder append(final boolean[] lhs, final boolean[] rhs) { if (isEquals == false) { return this; } if (lhs == rhs) { return this; } if (lhs == null || false) { this.setEquals(false); return this; } if (lhs.length != rhs.length) { this.setEquals(false); return this; } for (int i = 0; i < lhs.length && isEquals; ++i) { append(lhs[i], rhs[i]); } return this; } /** * <p>Returns <code>true</code> if the fields that have been checked * are all equal.</p> * * @return boolean */ public boolean isEquals() { return this.isEquals; } /** * <p>Returns <code>true</code> if the fields that have been checked * are all equal.</p> * * @return <code>true</code> if all of the fields that have been checked * are equal, <code>false</code> otherwise. * * @since 3.0 */ public Boolean build() { return Boolean.valueOf(isEquals()); } /** * Sets the <code>isEquals</code> value. * * @param isEquals The value to set. * @since 2.1 */ protected void setEquals(final boolean isEquals) { this.isEquals = isEquals; } /** * Reset the EqualsBuilder so you can use the same object again * @since 2.5 */ public void reset() { this.isEquals = true; } }
b8b8cc1dd28d241cad6ac5acb6b7a0cbe3950d5e
8120c36e0009dc346018ac90eaa7d2857adebc52
/exercise3/exercise3/src/main/java/aufgabe3/ServerPushImpl.java
33e2a7f44e5eb3bb9e23c21efb7f7a32c31b69f1
[]
no_license
jogueber/MWCS
1472152061daa52ed40ad20f369d005b57362135
567cad89bcb7def3db138e4706e78b39ebc72276
refs/heads/master
2022-01-04T05:30:06.957280
2014-07-13T09:34:53
2014-07-13T09:34:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
534
java
package aufgabe3; import org.omg.CORBA.ORB; import lombok.Getter; import lombok.Setter; import callback.Client_Handler.ServerpushPOA; import callback.Client_Handler.Stock; public class ServerPushImpl extends ServerpushPOA { @Getter @Setter private ORB orb; @Getter private Stock recived; @Override public void push(Stock data) { recived=new Stock(); recived.price = data.price; recived.name= data.name; recived.isn = data.isn; System.out.println("Recived Stock Name:"+data.name+"Price: "+data.price); } }
f920d13e56000266a62f803ca2e0680056dbe1da
3504f056e49206b49f69457e6f0f8d9c2b2d3df8
/HZXU-1/src/cn/zy/apps/demo/service/units/ProjectCarriedOutInfoSaveUpdateUnits.java
ba57c2d5f95a45b4ef324d4fb1555038f3bfffe6
[]
no_license
pzzying20081128/develop
9b50063a6851fcf63650edd52664b5b5e1554c72
77c5b3249df134c62d54a40d770e67c729752ac8
refs/heads/master
2020-05-31T05:23:36.039922
2016-02-24T10:42:02
2016-02-24T10:42:02
41,988,213
0
0
null
null
null
null
UTF-8
Java
false
false
4,639
java
package cn.zy.apps.demo.service.units ; import org.springframework.stereotype.Component ; import cn.zy.apps.demo.HZXUProjectConfig.ProjectStauts ; import cn.zy.apps.demo.HZXUProjectConfig.Status ; import cn.zy.apps.demo.pojos.ProjectCarriedOutInfo ; import cn.zy.apps.demo.pojos.ProjectMajorType ; import cn.zy.apps.demo.pojos.ProjectOwnershipAddress ; import cn.zy.apps.demo.pojos.ProjectProgressType ; import cn.zy.apps.demo.pojos.ProjectType ; import cn.zy.apps.demo.service.ABCommonsService ; import cn.zy.apps.demo.service.SystemOptServiceException ; import cn.zy.apps.tools.units.ToolsUnits ; import cn.zy.apps.tools.units.ToolsUnits.OptType ; @Component("ProjectCarriedOutInfoSaveUpdateUnits") public class ProjectCarriedOutInfoSaveUpdateUnits extends ABCommonsService { public ProjectCarriedOutInfo saveUpdate(OptType optType, ProjectCarriedOutInfo optProjectCarriedOutInfo) throws SystemOptServiceException { switch (optType) { case save: return save(optProjectCarriedOutInfo) ; case update: return update(optProjectCarriedOutInfo) ; default: throw new SystemOptServiceException("[操作类型错误]") ; } } public ProjectCarriedOutInfo save(ProjectCarriedOutInfo optProjectCarriedOutInfo) throws SystemOptServiceException { String sql = "select count(projectCarriedOutInfo.id) from " + " ProjectCarriedOutInfo as projectCarriedOutInfo " + " where projectCarriedOutInfo.name ='" + optProjectCarriedOutInfo.getName() + "' " + " and projectCarriedOutInfo.status ='" + Status.有效 + "' " ; Long l = baseService.findSinglenessByHSQL(sql) ; if (l >0) { throw new SystemOptServiceException("项目名已经存在") ; } setProperties(optProjectCarriedOutInfo) ; optProjectCarriedOutInfo.setStatus(Status.有效) ; optProjectCarriedOutInfo.setProjectStauts(ProjectStauts.建设中) ; baseService.save(optProjectCarriedOutInfo) ; return optProjectCarriedOutInfo ; } public ProjectCarriedOutInfo update(ProjectCarriedOutInfo optProjectCarriedOutInfo) throws SystemOptServiceException { String sql = "select count(projectCarriedOutInfo.id) from ProjectCarriedOutInfo as projectCarriedOutInfo where projectCarriedOutInfo.name ='" + optProjectCarriedOutInfo.getName() + "' " + " and projectCarriedOutInfo.status ='" + Status.有效 + "' " + " and projectCarriedOutInfo.id !=" + optProjectCarriedOutInfo.getId() ; Long l = baseService.findSinglenessByHSQL(sql) ; if (l >0) { throw new SystemOptServiceException("项目名已经存在") ; } setProperties(optProjectCarriedOutInfo) ; ProjectCarriedOutInfo projectCarriedOutInfo = baseService.get(ProjectCarriedOutInfo.class, optProjectCarriedOutInfo.getId()) ; ToolsUnits.copyBeanProperties(projectCarriedOutInfo, optProjectCarriedOutInfo, "totalInvestment", "constructionContent", "isKaiGong", "isProduction", "projectAddress", "projectOwnershipAddress", "projectOwnershipAddressId", "projectProgressType", "projectProgressTypeId", "projectMajorType", "projectMajorTypeId", "kaiGongDate", "buildStartDate", "buildEndDate", "implementationUnit", "implementationUnitPerson", "implementationUnitPhoto", "name", "responsibilityUnit", "responsibilityUnitPerson", "responsibilityUnitPhoto", "fenGuanMiShuZhang", "fenGuanMiShuZhangPhoto", "fenGuanHuShiZhang", "fenGuanHuShiZhangPhoto" ) ; return projectCarriedOutInfo ; } private void setProperties(ProjectCarriedOutInfo optProjectCarriedOutInfo) { Integer getProjectOwnershipAddressId = optProjectCarriedOutInfo.getProjectOwnershipAddressId() ; optProjectCarriedOutInfo.setProjectOwnershipAddress(baseService.load(getProjectOwnershipAddressId, ProjectOwnershipAddress.class)) ; Integer getProjectProgressTypeId = optProjectCarriedOutInfo.getProjectProgressTypeId() ; optProjectCarriedOutInfo.setProjectProgressType(baseService.load(getProjectProgressTypeId, ProjectProgressType.class)) ; Integer getProjectMajorTypeId = optProjectCarriedOutInfo.getProjectMajorTypeId() ; optProjectCarriedOutInfo.setProjectMajorType(baseService.load(getProjectMajorTypeId, ProjectMajorType.class)) ; Integer getProjectTypeId = optProjectCarriedOutInfo.getProjectTypeId() ; optProjectCarriedOutInfo.setProjectType(baseService.load(getProjectTypeId, ProjectType.class)) ; } }
75b67a71493450f24ee1a79fdfd441e0bdd14aaa
3aad015d0558d53890dc392f14967532199c9a0d
/client/src/main/java/com/dzr/entity/Menu.java
ba6598acc705f0ac69c442b6f097819aba53fbe6
[]
no_license
dozoroy/orderingsystem
4952d12faf1128e9085442cad1be0f175611366a
37d4e08f206b9befdd0700c4253ef2cf83c6b8b1
refs/heads/master
2022-07-04T01:26:58.335114
2019-12-26T07:45:48
2019-12-26T07:45:48
230,021,363
1
0
null
2022-06-21T02:30:50
2019-12-25T01:13:19
Java
UTF-8
Java
false
false
203
java
package com.dzr.entity; import lombok.Data; @Data public class Menu { private long id; private String name; private double price; private String flavor; private Type type; }
72f3f228af2ad7f853ff9931bf7b74ed22bd32b8
37c1ccefe917ffc458863c028e2a74c9f88ad9ad
/cloudalibaba-consumer83/src/main/java/com/yd/cloudalibabaconsumer83/config/ApplicationContextConfig.java
bc90e878b689c2b90d6d35b518ec711a95dd9542
[]
no_license
SAOSwordsman/springcloud-demo
d14b4dcdf1d36af7d92361c8b6b7c09f9d2117d4
a5d10e84624ab5419f5df48376e32941bd6091a8
refs/heads/master
2023-04-09T19:33:22.351612
2021-04-11T11:31:49
2021-04-11T11:31:49
356,848,795
1
0
null
null
null
null
UTF-8
Java
false
false
450
java
package com.yd.cloudalibabaconsumer83.config; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.client.RestTemplate; @Configuration public class ApplicationContextConfig { @Bean @LoadBalanced public RestTemplate getRestTemplate() { return new RestTemplate(); } }
b5ee4d12903d2fc5d95b50d3a449213e004c275a
cb26aacd17c4ed915659c7e21c180fa7e9413ac6
/zj-util/src/main/java/com/zj/util/file/FileUtil.java
60acf1bf67e3930b25cd20710895f0ce0902d93a
[]
no_license
miraclehjt/zj-pmos
6b2ff7501d67ad65c7952e2022bca1f578fa9b5b
c7b5994db198731f089d69145dd2d75883b64327
refs/heads/master
2021-01-22T18:38:09.951938
2017-08-02T07:08:04
2017-08-02T07:08:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,427
java
package com.zj.util.file; import com.alibaba.fastjson.JSON; import com.zj.util.file.model.Files; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class FileUtil { /** * The Unix separator character. */ private static final char UNIX_SEPARATOR = '/'; /** * The Windows separator character. */ private static final char WINDOWS_SEPARATOR = '\\'; /** * The system separator character. */ private static final char SYSTEM_SEPARATOR = File.separatorChar; /** * @param args */ public static void main(String[] args) { Files files = getFiles("D:/software/myWiki/"); System.out.println(JSON.toJSONString(files)); } public static Files getFiles(String path){ Files files = new Files(); File file = getFile(path); files.setName(file.getName()); files.setPath(file.getPath()); //单个文件 if(!file.isDirectory()){ files.setType(Files.TYPE_FILE); return files; } //文件夹 files.setType(Files.TYPE_DIR); File[] array = file.listFiles(); List<Files> allSubFiles = new ArrayList<Files>(); for(int i=0;i<array.length;i++){ Files subFiles = getFiles(array[i].getPath()); allSubFiles.add(subFiles); } files.setFiles(allSubFiles); return files; } public static boolean deleteQuietly(File file) { if (file == null) { return false; } try { if (file.isDirectory()) { cleanDirectory(file); } } catch (Exception ignored) { } try { return file.delete(); } catch (Exception ignored) { return false; } } public static void cleanDirectory(File directory) throws IOException { if (!directory.exists()) { String message = directory + " does not exist"; throw new IllegalArgumentException(message); } if (!directory.isDirectory()) { String message = directory + " is not a directory"; throw new IllegalArgumentException(message); } File[] files = directory.listFiles(); if (files == null) { // null if security restricted throw new IOException("Failed to list contents of " + directory); } IOException exception = null; for (File file : files) { try { forceDelete(file); } catch (IOException ioe) { exception = ioe; } } if (null != exception) { throw exception; } } public static void forceDelete(File file) throws IOException { if (file.isDirectory()) { deleteDirectory(file); } else { boolean filePresent = file.exists(); if (!file.delete()) { if (!filePresent){ throw new FileNotFoundException("File does not exist: " + file); } String message = "Unable to delete file: " + file; throw new IOException(message); } } } public static void deleteDirectory(File directory) throws IOException { if (!directory.exists()) { return; } if (!isSymlink(directory)) { cleanDirectory(directory); } if (!directory.delete()) { String message = "Unable to delete directory " + directory + "."; throw new IOException(message); } } public static boolean isSymlink(File file) throws IOException { if (file == null) { throw new NullPointerException("File must not be null"); } if (isSystemWindows()) { return false; } File fileInCanonicalDir = null; if (file.getParent() == null) { fileInCanonicalDir = file; } else { File canonicalDir = file.getParentFile().getCanonicalFile(); fileInCanonicalDir = new File(canonicalDir, file.getName()); } if (fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile())) { return false; } else { return true; } } private static boolean isSystemWindows() { return SYSTEM_SEPARATOR == WINDOWS_SEPARATOR; } public static boolean save(String path, byte[] buff) { boolean success = false; FileOutputStream fos = getFileOutputStream(path); if (fos != null) { try { fos.write(buff); fos.flush(); fos.close(); success = true; } catch (IOException e) { e.printStackTrace(); } } return success; } public static FileOutputStream getFileOutputStream(String path) { File file = getFile(path); FileOutputStream fos = null; try { fos = new FileOutputStream(file); } catch (FileNotFoundException e) { e.printStackTrace(); } return fos; } public static File getFile(String path) { File file = new File(path); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } return file; } }
4f3c2a1c238fca4464c3917367ac405709f0a873
4de58891187c828e47b906f7633667bbdad1c852
/sipservice/src/main/java/org/pjsip/pjsua2/BuddyInfo.java
e0df308ac93f6dbf25942f5ec5d769087a0807cd
[ "Apache-2.0" ]
permissive
IstiyakV/pjsip-android
e0b1e6f54d64b531116ac101f3fb274eaa84470e
4c106c8498d993d0c6a8a9a59b3e01180805eca4
refs/heads/master
2020-03-27T11:46:54.722122
2017-11-20T13:36:08
2017-11-20T14:52:45
146,507,446
1
0
Apache-2.0
2018-08-28T21:12:35
2018-08-28T21:12:34
null
UTF-8
Java
false
false
3,004
java
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 3.0.7 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package org.pjsip.pjsua2; public class BuddyInfo { private transient long swigCPtr; protected transient boolean swigCMemOwn; protected BuddyInfo(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected static long getCPtr(BuddyInfo obj) { return (obj == null) ? 0 : obj.swigCPtr; } protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; pjsua2JNI.delete_BuddyInfo(swigCPtr); } swigCPtr = 0; } } public void setUri(String value) { pjsua2JNI.BuddyInfo_uri_set(swigCPtr, this, value); } public String getUri() { return pjsua2JNI.BuddyInfo_uri_get(swigCPtr, this); } public void setContact(String value) { pjsua2JNI.BuddyInfo_contact_set(swigCPtr, this, value); } public String getContact() { return pjsua2JNI.BuddyInfo_contact_get(swigCPtr, this); } public void setPresMonitorEnabled(boolean value) { pjsua2JNI.BuddyInfo_presMonitorEnabled_set(swigCPtr, this, value); } public boolean getPresMonitorEnabled() { return pjsua2JNI.BuddyInfo_presMonitorEnabled_get(swigCPtr, this); } public void setSubState(pjsip_evsub_state value) { pjsua2JNI.BuddyInfo_subState_set(swigCPtr, this, value.swigValue()); } public pjsip_evsub_state getSubState() { return pjsip_evsub_state.swigToEnum(pjsua2JNI.BuddyInfo_subState_get(swigCPtr, this)); } public void setSubStateName(String value) { pjsua2JNI.BuddyInfo_subStateName_set(swigCPtr, this, value); } public String getSubStateName() { return pjsua2JNI.BuddyInfo_subStateName_get(swigCPtr, this); } public void setSubTermCode(pjsip_status_code value) { pjsua2JNI.BuddyInfo_subTermCode_set(swigCPtr, this, value.swigValue()); } public pjsip_status_code getSubTermCode() { return pjsip_status_code.swigToEnum(pjsua2JNI.BuddyInfo_subTermCode_get(swigCPtr, this)); } public void setSubTermReason(String value) { pjsua2JNI.BuddyInfo_subTermReason_set(swigCPtr, this, value); } public String getSubTermReason() { return pjsua2JNI.BuddyInfo_subTermReason_get(swigCPtr, this); } public void setPresStatus(PresenceStatus value) { pjsua2JNI.BuddyInfo_presStatus_set(swigCPtr, this, PresenceStatus.getCPtr(value), value); } public PresenceStatus getPresStatus() { long cPtr = pjsua2JNI.BuddyInfo_presStatus_get(swigCPtr, this); return (cPtr == 0) ? null : new PresenceStatus(cPtr, false); } public BuddyInfo() { this(pjsua2JNI.new_BuddyInfo(), true); } }
21ec76f7b02ea50c0736566bc304e02b4f9fef98
bffb30150224db3a4200db77da6da07e1b5a5c26
/app/src/main/java/utils/tasks/DeleteAccountTask.java
5922b4f463b9429f1e41c3d1282adcadc91bfc2f
[]
no_license
oanaplesu/CloudManager
dc5b339f9599878267f2f087c06bf32f750e4a76
e5d592224e773cdf2a8943c980aa947178c3aee4
refs/heads/master
2021-04-06T13:40:12.623317
2018-06-27T21:10:50
2018-06-27T21:10:50
125,266,726
1
1
null
null
null
null
UTF-8
Java
false
false
993
java
package utils.tasks; import android.os.AsyncTask; import utils.db.AppDatabase; public class DeleteAccountTask extends AsyncTask<String, Void, Void> { private Callback mCallback; private AppDatabase mDb; public interface Callback { void OnComplete(); } public DeleteAccountTask(AppDatabase db, Callback callback) { this.mCallback = callback; this.mDb = db; } @Override protected Void doInBackground(String... strings) { String provider = strings[0]; String email = strings[1]; if(provider.equals("google")) { mDb.googleDriveUserDao().removeUser(email); } else if(provider.equals("dropbox")) { mDb.dropboxUserDao().removeUser(email); } else if(provider.equals("onedrive")) { mDb.oneDriveUserDao().removeUser(email); } return null; } @Override protected void onPostExecute(Void voids) { mCallback.OnComplete(); } }
d6ab495d218b3b6f2d1fe87b30d2f9a713a8b430
4f44507dd0df0c6fdcb5f6ad525e5ffb01bc8a94
/konduit-serving-data/konduit-serving-image/src/main/java/ai/konduit/serving/data/image/step/face/DrawFaceKeyPointsStepRunnerFactory.java
4d662b872802ba25b1e834a2e6af61ee6c1ab0b0
[ "Apache-2.0", "AGPL-3.0-or-later", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
KonduitAI/konduit-serving
9db542afccd4c9db38084bee686166ae801bfaa5
cbe2de1a7306ac7a6bd9162f083df3506d13a92e
refs/heads/master
2023-02-19T14:18:41.400892
2023-02-15T11:14:55
2023-02-15T11:14:55
215,496,017
55
21
Apache-2.0
2023-09-08T08:55:11
2019-10-16T08:24:52
Java
UTF-8
Java
false
false
1,584
java
/* * ****************************************************************************** * * Copyright (c) 2022 Konduit K.K. * * * * This program and the accompanying materials are made available under the * * terms of the Apache License, Version 2.0 which is available at * * https://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. * * * * SPDX-License-Identifier: Apache-2.0 * ***************************************************************************** */ package ai.konduit.serving.data.image.step.face; import ai.konduit.serving.pipeline.api.step.PipelineStep; import ai.konduit.serving.pipeline.api.step.PipelineStepRunner; import ai.konduit.serving.pipeline.api.step.PipelineStepRunnerFactory; import org.nd4j.common.base.Preconditions; public class DrawFaceKeyPointsStepRunnerFactory implements PipelineStepRunnerFactory { @Override public boolean canRun(PipelineStep pipelineStep) { return pipelineStep instanceof DrawFaceKeyPointsStep; } @Override public PipelineStepRunner create(PipelineStep pipelineStep) { Preconditions.checkState(canRun(pipelineStep), "Unable to run step: %s", pipelineStep); return new DrawFaceKeyPointsRunner((DrawFaceKeyPointsStep) pipelineStep); } }
a5c9c9c637d7bdf3955e71f20a03c1f970d0c268
58c23f6d66d08ef81c89d24f642f24f09704ec48
/csas-framework/hs-core/src/main/java/com/hoomsun/core/thread/ThreadPoolExecutorFactory.java
3f8490a9c08df2e2f9ec7142ec8d175432ff9d89
[]
no_license
ybak/casc-framework
5ed651901eb4357e807d3c3d3440ed26c1848d56
b76e68dd53cf26ce6302db545afd572a38aac3e3
refs/heads/master
2021-03-24T01:11:12.632781
2018-05-16T06:49:09
2018-05-16T06:49:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,786
java
/** * Copyright www.hoomsun.com 红上金融信息服务(上海)有限公司 */ package com.hoomsun.core.thread; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author ywzou * 作者:ywzou <br> * 创建时间:2017年11月17日 <br> * 描述:线程池工厂 */ public class ThreadPoolExecutorFactory { private static final Logger log = LoggerFactory.getLogger(ThreadPoolExecutorFactory.class); /** * corePoolSize 池中所保存的线程数,包括空闲线程。 */ private int corePoolSize = 5; /** * maximumPoolSize - 池中允许的最大线程数(采用LinkedBlockingQueue时没有作用)。 */ private int maximumPoolSize = 5; /** * keepAliveTime -当线程数大于核心时,此为终止前多余的空闲线程等待新任务的最长时间,线程池维护线程所允许的空闲时间 (秒) */ private long keepAliveTime = 30; /** * capacity 执行前用于保持任务的队列(缓冲队列) */ private int capacity = 20; /** * 线程池对象 */ private ThreadPoolExecutor threadPoolExecutor = null; public ThreadPoolExecutorFactory() { log.info("##### 初始化线程池工厂类 【corePoolSize="+corePoolSize+",maximumPoolSize="+ maximumPoolSize +",keepAliveTime="+keepAliveTime+",capacity="+capacity+"】 ######"); if (null == getThreadPoolExecutor()) { ThreadPoolExecutor t; synchronized (ThreadPoolExecutor.class) { t = getThreadPoolExecutor(); if (null == t) { synchronized (ThreadPoolExecutor.class) { t = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(capacity), new ThreadPoolExecutor.DiscardOldestPolicy()); } setThreadPoolExecutor(t); } } } log.info("#####【线程池子初始化成功】####"); } public int getCorePoolSize() { return corePoolSize; } public void setCorePoolSize(int corePoolSize) { this.corePoolSize = corePoolSize; } public int getMaximumPoolSize() { return maximumPoolSize; } public void setMaximumPoolSize(int maximumPoolSize) { this.maximumPoolSize = maximumPoolSize; } public long getKeepAliveTime() { return keepAliveTime; } public void setKeepAliveTime(long keepAliveTime) { this.keepAliveTime = keepAliveTime; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public ThreadPoolExecutor getThreadPoolExecutor() { return threadPoolExecutor; } public void setThreadPoolExecutor(ThreadPoolExecutor threadPoolExecutor) { this.threadPoolExecutor = threadPoolExecutor; } }
19edf3e9adbcc569cf518e18398a3e4ba19831da
1df1e297275507b6d8aaecc531d811c968c8e4fc
/app/src/main/java/com/tingyu/venus/model/table/ContactTable.java
6a7e63849e26c9c17285b9200eeefd3ed0670830
[]
no_license
Essionshy/venus-android
d9e792f018a237d1acb1ce2c1850b06cf494ff95
dc2fde6af6ccf0cc1e26b369229455adac8b355a
refs/heads/master
2023-01-15T08:41:20.652658
2020-11-26T13:30:41
2020-11-26T13:30:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.tingyu.venus.model.table; /** * 创建联系人表的信息 */ public class ContactTable { public static final String TAB_NAME = "tab_contact"; public static final String COL_ID = "id"; public static final String COL_USERNAME = "username"; public static final String COL_PHONE = "phone"; public static final String COL_AVATAR = "avatar"; public static final String COL_IS_CONTACT = "is_contact";//是否是联系人 public static final String CREATE_TAB = "create table " + TAB_NAME + " (" + COL_ID + " Long primary key," + COL_AVATAR + " text," + COL_PHONE + " text," + COL_USERNAME + " text," + COL_IS_CONTACT + " Integer);"; }
2d5f88f0d174a1f8552a9a5f09bd5436b2b0c3d0
6e4effc3ebb471fb1f90c1246f74328d5b69c78b
/codes/javacore-oop/src/main/java/io/github/dunwu/javacore/access/Hello.java
c2dc040436d3a00a8abf5f57f1dad17fae5c44c8
[ "MIT" ]
permissive
dreanli/javacore
7bdfdb0ce78499937bb8cd09a54ab3347b5b2438
9b07e08cd35bf64d3db4f087bd1ec1b570aa6bba
refs/heads/master
2020-09-09T05:50:07.108618
2019-10-28T14:04:39
2019-10-28T14:04:39
221,365,721
1
0
MIT
2019-11-13T03:36:12
2019-11-13T03:36:12
null
UTF-8
Java
false
false
165
java
package io.github.dunwu.javacore.access; public class Hello { protected String name = "Zhang Peng"; public String getInfo() { return "Hello World!!!"; } };
7452f890f16ce92f26ff54719468b6b2bf42afe7
a25ed200e167977d81bf0bb5f5c0ac8f48c70635
/Examenes/segundoTrimestre_simulacro2/ClaveSegura.java
f466a03ac816210892eb8de7e06659b788dd3626
[]
no_license
javiersm/Programacion
270d8638dbddbbf9a9940ab1f2f267c4269be847
4ec8dfdc180622d42309b505ca426795646e2400
refs/heads/master
2021-01-15T17:45:49.835350
2014-06-17T08:37:02
2014-06-17T08:37:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
50
java
public class ClaveSegura extends Exception { }
5ca0f42c78dabed38263b78bb9aaf973af12cfb8
127d3b84e00d09683c06308a3cb965303cbb8baa
/app/src/main/java/com/example/dattienbkhn/travel/network/message/map/direction/Southwest.java
3b5dbb491934f2e6b1affc4ef1920df24d02a8b7
[]
no_license
dattien96/Travel
ff373e49f4925f18d024499c5c3383d67915bf04
84167a3528c7e1e497f537af943926aa53699630
refs/heads/master
2020-04-06T13:26:29.494546
2018-11-14T06:15:09
2018-11-14T06:15:09
157,500,256
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
package com.example.dattienbkhn.travel.network.message.map.direction; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Southwest { @SerializedName("lat") @Expose private Double lat; @SerializedName("lng") @Expose private Double lng; public Double getLat() { return lat; } public void setLat(Double lat) { this.lat = lat; } public Double getLng() { return lng; } public void setLng(Double lng) { this.lng = lng; } }
[ "FRAMGIA\\[email protected]" ]
b0ea3b20c57bf953ebdc6e2c56aef9cfa68ca22a
1fd99c0f98e02a3258316c48e61f6437ff7ac861
/Dinner41_SourceCode/src/main/java/kr/co/dinner41/vo/OrderVO.java
432d9dcf7234faca13813598f015eb1ffb24734e
[]
no_license
KIMJUSUNG1011/project-dinner41-spring
b9cc0a3b497e0fef0f7775e01da66550708f9ed6
09d6cce4f4002badc007187caf9f4a499eb5f10a
refs/heads/master
2023-06-02T06:48:15.528734
2021-04-09T07:09:04
2021-04-09T07:09:04
385,778,366
1
0
null
null
null
null
UTF-8
Java
false
false
1,366
java
package kr.co.dinner41.vo; import java.io.Serializable; import java.sql.Timestamp; public class OrderVO implements Serializable { private static final long serialVersionUID = 1L; private int id; private UserVO user; private Timestamp orderDate; private Timestamp reserveDate; private Timestamp pickupDate; private int price; public OrderVO() {} public OrderVO(int id, UserVO user, Timestamp orderDate, Timestamp reserveDate, Timestamp pickupDate, int price) { this.id = id; this.user = user; this.orderDate = orderDate; this.reserveDate = reserveDate; this.pickupDate = pickupDate; this.price = price; } public int getId() { return id; } public void setId(int id) { this.id = id; } public UserVO getUser() { return user; } public void setUser(UserVO user) { this.user = user; } public Timestamp getOrderDate() { return orderDate; } public void setOrderDate(Timestamp orderDate) { this.orderDate = orderDate; } public Timestamp getReserveDate() { return reserveDate; } public void setReserveDate(Timestamp reserveDate) { this.reserveDate = reserveDate; } public Timestamp getPickupDate() { return pickupDate; } public void setPickupDate(Timestamp pickupDate) { this.pickupDate = pickupDate; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } }
bff8c38302cb3b24e7bb963d9fedfb78f26bfd2f
21b013722c5703083cc0b50a707ae3beb079f7a8
/app/src/main/java/com/example/android/timer/MainActivity.java
23104d4021a64cb33c50ad182cfbdb3ff93dcc6f
[]
no_license
zarema98/Timer
aa73b28f4570dbf0ea4cc1dbfd851ab07a7a5b65
e8cac8a56f524ef4b05fd1b3caddaa87e9e63c62
refs/heads/master
2020-04-20T22:27:43.109363
2019-02-04T20:02:34
2019-02-04T20:02:34
169,140,269
0
0
null
null
null
null
UTF-8
Java
false
false
3,314
java
package com.example.android.timer; import android.content.Intent; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.util.Locale; public class MainActivity extends AppCompatActivity { private TextView txtTime; private Button start, stop, restart; private int seconds = 0; private boolean isRun; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); txtTime = findViewById(R.id.txt_time); start = findViewById(R.id.btn_start); stop = findViewById(R.id.btn_stop); restart = findViewById(R.id.btn_restart); if(savedInstanceState != null) { seconds = savedInstanceState.getInt("seconds"); isRun = savedInstanceState.getBoolean("isRun"); } start(); stop(); restart(); runTimer(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.add: Intent intent = new Intent(getBaseContext(), Main2Activity.class); startActivity(intent); break; } return super.onOptionsItemSelected(item); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("seconds", seconds); outState.putBoolean("isRun", isRun); } private void runTimer() { final Handler handler = new Handler(); handler.post(new Runnable() { @Override public void run() { int hours = seconds / 3600; int minutes = (seconds % 3600) / 60; int sec = seconds % 60; String curTime = String.format(Locale.getDefault(), "%d: %02d: %02d", hours, minutes, sec); txtTime.setText(curTime); if(isRun) { seconds++; } handler.postDelayed(this, 1000); } }); } private void start() { start.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { isRun = true; } }); } private void stop () { stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { isRun = false; } }); } private void restart() { restart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { isRun = false; seconds = 0; } }); } }
74ce9e6e194c9f1786586c353cab7a3ba782f2d7
6e3a9bd9a44c2264bbca1e5ab26fdf1738fb3143
/java/src/main/java/com/water/lock/SyncTest.java
ebf9484f47042d22755bbdf3e664bd8fbf855261
[]
no_license
water2015/water
5c0a2acb1cc0ca055fb5557eff1102cd7828c4f1
d575c08e1e7656ceb8db214a51ed4a62bdf4c5a1
refs/heads/master
2021-01-21T04:55:42.754350
2016-06-19T08:22:32
2016-06-19T08:22:32
44,711,734
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.water.lock; public class SyncTest { public static void main(String[] args) { new LoggingWidget().doSomething(); } } class Widget { public synchronized void doSomething() { System.out.println("Widget"); } } class LoggingWidget extends Widget { public synchronized void doSomething() { System.out.println("LoggingWidget"); super.doSomething(); } }
9e2f205b2c4fb0b2818e0784e6107980cdc4a10f
ac759cb40142e92cb52d102bf09f4780c4973e97
/user-registration-server-ws/enroll-mgmt/src/main/java/com/google/cloud/healthcare/fdamystudies/dao/ParticipantStudiesInfoDaoImpl.java
4c9af8ae7feb12478a03f539dffebae51fce50f6
[ "MIT" ]
permissive
ashokr8142/phanitest
b128f5f21043ad68858e57c4183aa23a992d04a5
04ca2cd502fd953e64971292480fd2261dd0be17
refs/heads/master
2023-03-03T06:31:10.344379
2021-01-13T07:42:28
2021-01-13T07:42:28
340,147,907
0
0
null
null
null
null
UTF-8
Java
false
false
2,083
java
/* * Copyright 2020 Google LLC * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. */ package com.google.cloud.healthcare.fdamystudies.dao; import java.util.List; import javax.persistence.EntityManagerFactory; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.google.cloud.healthcare.fdamystudies.exception.SystemException; import com.google.cloud.healthcare.fdamystudies.model.ParticipantStudiesBO; @Repository public class ParticipantStudiesInfoDaoImpl implements ParticipantStudiesInfoDao { private static final Logger logger = LoggerFactory.getLogger(ParticipantStudiesInfoDaoImpl.class); @Autowired private EntityManagerFactory entityManagerFactory; @Override @SuppressWarnings("unchecked") public List<ParticipantStudiesBO> getParticipantStudiesInfo(Integer userDetailsId) throws SystemException { List<ParticipantStudiesBO> participantStudiesList = null; logger.info("(DAO)...ParticipantStudiesInfoDaoImpl.getParticipantStudiesInfo()...Started"); if (userDetailsId != null) { try (Session session = entityManagerFactory.unwrap(SessionFactory.class).openSession()) { Query<ParticipantStudiesBO> query = session.createQuery( "from ParticipantStudiesBO where userDetails.userDetailsId = :userDetailsId"); query.setParameter("userDetailsId", userDetailsId); participantStudiesList = query.getResultList(); return participantStudiesList; } catch (Exception e) { logger.error("(DAO)...UserDetailsDaoImpl.getParticipantStudiesInfo(): (ERROR) ", e); throw new SystemException(); } } else { logger.info("(DAO)...ParticipantStudiesInfoDaoImpl.getParticipantStudiesInfo()...Ended"); return null; } } }
2bec3e1871ed8f1f93cf87956bb69a870bdae99d
2b98f88aaf5cd7587ff695751b6e3099b38a17b1
/src/java/servlets/ResetPasswordServlet.java
dbcc568f65692883a5f481d877f2a48063859194
[]
no_license
michaelmamuric/Week09Lab
4563ec80a373fbeb31a9cef8c902f3fce4cd89cd
01435b593b4ccd6e424ade501213e237884d7bcd
refs/heads/master
2021-04-03T00:57:09.114100
2020-03-20T17:36:41
2020-03-20T17:36:41
248,343,778
0
0
null
null
null
null
UTF-8
Java
false
false
3,280
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 servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import services.AccountService; /** * * @author 799470 */ public class ResetPasswordServlet extends HttpServlet { /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uuid = request.getParameter("uuid"); if(uuid != null) getServletContext().getRequestDispatcher("/WEB-INF/resetNewPassword.jsp").forward(request, response); else getServletContext().getRequestDispatcher("/WEB-INF/reset.jsp").forward(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uuid = request.getParameter("uuid"); AccountService ac = new AccountService(); if(uuid != null) { String newPassword = request.getParameter("newpassword"); boolean res = ac.changePassword(uuid, newPassword); if(res) request.setAttribute("msg", "Your password has been successfully changed."); else request.setAttribute("msg", "Error in changing password. Please contact your administrator."); getServletContext().getRequestDispatcher("/WEB-INF/resetNewPassword.jsp").forward(request, response); } else { String email = request.getParameter("email"); String path = getServletContext().getRealPath("/WEB-INF"); String url = request.getRequestURL().toString(); boolean res = ac.resetPassword(email, path, url); if(res) request.setAttribute("msg", "An e-mail has been sent to you with instructions on how to reset your password."); else request.setAttribute("msg", "E-mail sending not successful. Please contact your administrator."); getServletContext().getRequestDispatcher("/WEB-INF/reset.jsp").forward(request, response); } } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
e2c8d4a1dcaea1d7d1b79c1fa4004f80ff444001
5dd84e9ca419ed669e11c236a845b0c1645cf180
/com/planet_ink/coffee_mud/Items/Weapons/Staff.java
8be65b1a879040f1b29d763aad77b50169f02677
[ "Apache-2.0" ]
permissive
jmbflat/CoffeeMud
0ab169f8d473f0aa3534ffe3c0ae82ed9a221ec8
c6e48d89aa58332ae030904550442155e673488c
refs/heads/master
2023-02-16T04:21:26.845481
2021-01-09T01:36:11
2021-01-09T01:36:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,448
java
package com.planet_ink.coffee_mud.Items.Weapons; import java.util.List; import com.planet_ink.coffee_mud.Items.MiscMagic.StdWand; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; /* Copyright 2001-2020 Bo Zimmerman 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. */ public class Staff extends StdWeapon implements Wand { @Override public String ID() { return "Staff"; } protected String secretWord=CMProps.getAnyListFileValue(CMProps.ListFile.MAGIC_WORDS); public Staff() { super(); setName("a wooden staff"); setDisplayText("a wooden staff lies in the corner of the room."); setDescription("It`s long and wooden, just like a staff ought to be."); secretIdentity=""; basePhyStats().setAbility(0); basePhyStats().setLevel(0); basePhyStats.setWeight(4); basePhyStats().setAttackAdjustment(0); basePhyStats().setDamage(4); baseGoldValue=1; recoverPhyStats(); wornLogicalAnd=true; material=RawMaterial.RESOURCE_OAK; properWornBitmap=Wearable.WORN_HELD|Wearable.WORN_WIELD; weaponDamageType=TYPE_BASHING; weaponClassification=Weapon.CLASS_STAFF; setUsesRemaining(0); } @Override public int getCharges() { return usesRemaining(); } @Override public void setCharges(final int newCharges) { this.setUsesRemaining(newCharges); } @Override public int getMaxCharges() { return Integer.MAX_VALUE; } @Override public void setMaxCharges(final int num) { } @Override public String magicWord() { return secretWord; } @Override public void setSpell(final Ability theSpell) { miscText=""; if(theSpell!=null) miscText=theSpell.ID(); secretWord=StdWand.getWandWord(miscText); } @Override public void setMiscText(final String newText) { super.setMiscText(newText); secretWord=StdWand.getWandWord(newText); } @Override public Ability getSpell() { if(text().length()==0) return null; return CMClass.getAbility(text()); } @Override public int value() { if(usesRemaining()<=0) return 0; return super.value(); } @Override public String secretIdentity() { String id=super.secretIdentity(); final Ability A=getSpell(); final String uses; if(this.getCharges() < 999999) { if(this.getMaxCharges() < 999999) uses=""+getCharges()+"/"+getMaxCharges(); else uses = ""+getCharges(); } else uses="unlimited"; if(A!=null) id="'A staff of "+A.name()+"' Charges: "+uses+"\n\r"+id; return id+"\n\rSay the magic word :`"+secretWord+"` to the target."; } @Override public int getEnchantType() { return -1; } @Override public void setEnchantType(final int enchType) { } @Override public void waveIfAble(final MOB mob, final Physical afftarget, final String message) { StdWand.waveIfAble(mob,afftarget,message,this); } @Override public boolean checkWave(final MOB mob, final String message) { return StdWand.checkWave(mob, message, this); } @Override public void executeMsg(final Environmental myHost, final CMMsg msg) { final MOB mob=msg.source(); switch(msg.targetMinor()) { case CMMsg.TYP_WAND_USE: if(msg.amITarget(this)&&((msg.tool()==null)||(msg.tool() instanceof Physical))) waveIfAble(mob,(Physical)msg.tool(),msg.targetMessage()); break; case CMMsg.TYP_SPEAK: if((msg.sourceMinor()==CMMsg.TYP_SPEAK) &&(amBeingWornProperly())) { boolean alreadyWanding=false; final List<CMMsg> trailers =msg.trailerMsgs(); if(trailers!=null) { for(final CMMsg msg2 : trailers) { if((msg2.targetMinor()==CMMsg.TYP_WAND_USE) &&(msg2.target() == this)) alreadyWanding=true; } } final String said=CMStrings.getSayFromMessage(msg.sourceMessage()); if((!alreadyWanding)&&(said!=null)&&(checkWave(mob,said))) msg.addTrailerMsg(CMClass.getMsg(msg.source(),this,msg.target(),CMMsg.NO_EFFECT,null,CMMsg.MASK_ALWAYS|CMMsg.TYP_WAND_USE,said,CMMsg.NO_EFFECT,null)); } break; default: break; } super.executeMsg(myHost,msg); } }
7242c5a5df1dfcadafdcb7b87c8cad531df34660
8eb78898a7406064d2042881505b37fe805616df
/target/generated-sources/protobuf/java/cn/mrdear/route/RouteSummaryOrBuilder.java
aa3a0ab0bab904d59718c6e9f014a7f43ddc5b95
[]
no_license
jialongli/grpcSource
cbeeb078dd257d69686783a818601a5d577f1514
619a32aa60afd93e1977ee944d0269f94ebd3c78
refs/heads/master
2022-12-13T18:49:11.988019
2020-09-06T09:34:14
2020-09-06T09:34:15
293,244,335
0
0
null
null
null
null
UTF-8
Java
false
true
609
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: route.proto package cn.mrdear.route; public interface RouteSummaryOrBuilder extends // @@protoc_insertion_point(interface_extends:RouteSummary) com.google.protobuf.MessageOrBuilder { /** * <code>optional int32 point_count = 1;</code> */ int getPointCount(); /** * <code>optional int32 feture_count = 2;</code> */ int getFetureCount(); /** * <code>optional int32 distance = 3;</code> */ int getDistance(); /** * <code>optional int32 elapsed_time = 4;</code> */ int getElapsedTime(); }
756b7bb09a9d1eb783a7fa775e70e00143a77690
e89dc01c95b8b45404f971517c2789fd21657749
/src/main/java/com/alipay/api/domain/KbdishSpecGroupDetail.java
61d0dc501a2deb1a46f5f770a9a0060396679412
[ "Apache-2.0" ]
permissive
guoweiecust/alipay-sdk-java-all
3370466eec70c5422c8916c62a99b1e8f37a3f46
bb2b0dc8208a7a0ab8521a52f8a5e1fcef61aeb9
refs/heads/master
2023-05-05T07:06:47.823723
2021-05-25T15:26:21
2021-05-25T15:26:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
806
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 口碑规格标签扩展 * * @author auto create * @since 1.0, 2020-09-07 16:15:40 */ public class KbdishSpecGroupDetail extends AlipayObject { private static final long serialVersionUID = 8446963781738923538L; /** * 规格标签id */ @ApiField("spec_id") private String specId; /** * 规格标签的名称 */ @ApiField("spec_name") private String specName; public String getSpecId() { return this.specId; } public void setSpecId(String specId) { this.specId = specId; } public String getSpecName() { return this.specName; } public void setSpecName(String specName) { this.specName = specName; } }
45edb18b69ce94e4ac80c0955cfba1855c44afd8
dc06652c4030ac2f8c9ebc3fa125a7c2e72fbf67
/Java/HelloWorld/src/ch12/ParentMain.java
939903e3c1ebee669287e4a3d2612a0f3954b89a
[]
no_license
sshhhGit/TIL
9b485edae8d381f3143db7e85db8c2727e0dbf87
fce88811ed2784dc6d0b0f76b0d824afb30d7d24
refs/heads/main
2023-09-02T12:05:32.033811
2021-11-10T12:04:10
2021-11-10T12:04:10
400,414,121
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package ch12; public class ParentMain { public static void main(String[] args) { Parent p = new Parent(); p.name = "parent"; p.printInfo(); System.out.println("--------"); Child c = new Child(); c.name = "child"; c.setHobby("swimming"); c.printInfo(); } }
2cdeb9001b448973ab5da347ddf5aa6e1386812f
8185f332ed76c9ea2371971893cad8b8345aa713
/src/fr/porquepix/pathzzle/utils/Animation.java
40b856c744308cc7bffbd97ee4e417072120022a
[]
no_license
Ysnir/PathZzleSource
64a05ea8d8e41c655f930b930a34b7275ae6fea1
451d7cdc9c3ab438a47ac867fe49e7546586df06
refs/heads/master
2020-04-15T23:33:49.373614
2015-08-30T06:54:57
2015-08-30T06:54:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
888
java
package fr.porquepix.pathzzle.utils; public class Animation { private int length; private int speed; private boolean loop; private int frame = 0; private boolean playing = false; private int time = 0; public Animation(int length, int speed, boolean loop) { this.length = length; this.speed = speed; this.loop = loop; } public void update() { if (playing) { time++; if (time > speed) { frame++; if (frame >= length) { if (loop) frame = 0; else frame = length - 1; } time = 0; } } } public Animation play() { playing = true; return this; } public Animation pause() { playing = false; return this; } public Animation stop() { playing = false; frame = 0; return this; } public int getCurrentFrame() { return frame; } public Animation copy() { return new Animation(length, speed, loop); } }
83dd3ce5c5d70cdabe59b99d86d957207edb436a
d0d0e6e4a7d753c2017dc3d9d0c9b982e4951081
/Appodeal/android/src/com/appodeal/plugin/QTAppodeal.java
18cdc4b3f42edc209e15355250eb2bbccce5ff46
[]
no_license
appodeal/appodeal-qt-plugin
90beb368efc54ade99b13763c0530491520a7405
ddc68414e27f6da78929479655c18396f8b3088b
refs/heads/master
2021-01-19T07:22:35.083373
2018-04-23T11:59:55
2018-04-23T11:59:55
69,368,194
2
2
null
2022-08-01T10:59:05
2016-09-27T14:57:57
JavaScript
UTF-8
Java
false
false
9,467
java
package com.appodeal.plugin; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.util.Log; import android.app.Activity; import android.content.res.AssetManager; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.R; import com.appodeal.ads.Appodeal; import com.appodeal.ads.BannerCallbacks; import com.appodeal.ads.InterstitialCallbacks; import com.appodeal.ads.NonSkippableVideoCallbacks; import com.appodeal.ads.RewardedVideoCallbacks; import com.appodeal.ads.UserSettings; public class QTAppodeal{ public static UserSettings userSettings; private boolean showSucceded; public void initialize (Activity a_activity, String appKey, int adType) { Appodeal.setFramework("qt", "2.1.4"); Appodeal.initialize(a_activity, appKey, adType); } public boolean show(final Activity a_activity, final int adType) { showSucceded = false; a_activity.runOnUiThread(new Runnable(){ @Override public void run() { showSucceded = Appodeal.show(a_activity, adType); } }); return showSucceded; } public boolean show(final Activity a_activity, final int adType, final String placement){ showSucceded = false; a_activity.runOnUiThread(new Runnable(){ @Override public void run() { showSucceded = Appodeal.show(a_activity, adType, placement); } }); return showSucceded; } public void hide (final Activity a_activity, final int adType) { a_activity.runOnUiThread(new Runnable(){ @Override public void run() { Appodeal.hide(a_activity, adType); } }); } public void setTesting (boolean flag) { Appodeal.setTesting(flag); } public void setLogLevel (int level) { com.appodeal.ads.utils.Log.LogLevel appodealLevel; switch(level) { case 0: appodealLevel = com.appodeal.ads.utils.Log.LogLevel.debug; break; case 1: appodealLevel = com.appodeal.ads.utils.Log.LogLevel.verbose; break; case 2: default: appodealLevel = com.appodeal.ads.utils.Log.LogLevel.none; } Appodeal.setLogLevel(appodealLevel); } public boolean isLoaded (int adType) { return Appodeal.isLoaded(adType); } public boolean isPrecache (int adType) { return Appodeal.isPrecache(adType); } public void cache (Activity a_activity, int adType) { Appodeal.cache(a_activity, adType); } public void setAutoCache (int adType, boolean flag) { Appodeal.setAutoCache(adType, flag); } public void setTriggerOnLoadedOnPrecache (int adType, boolean flag) { Appodeal.setTriggerOnLoadedOnPrecache(adType, flag); } public static native void onInterstitialLoaded(boolean isPrecache); public static native void onInterstitialFailedToLoad(); public static native void onInterstitialShown(); public static native void onInterstitialClicked(); public static native void onInterstitialClosed(); public void setInterstitialCallback () { Appodeal.setInterstitialCallbacks(new InterstitialCallbacks() { @Override public void onInterstitialLoaded(boolean isPrecache){QTAppodeal.onInterstitialLoaded(isPrecache);} @Override public void onInterstitialFailedToLoad(){QTAppodeal.onInterstitialFailedToLoad();} @Override public void onInterstitialShown(){QTAppodeal.onInterstitialShown();} @Override public void onInterstitialClicked(){QTAppodeal.onInterstitialClicked();} @Override public void onInterstitialClosed(){QTAppodeal.onInterstitialClosed();} }); } public static native void onBannerLoaded (int height, boolean isPrecache); public static native void onBannerFailedToLoad (); public static native void onBannerShown (); public static native void onBannerClicked (); public void setBannerCallback () { Appodeal.setBannerCallbacks(new BannerCallbacks() { @Override public void onBannerLoaded(int height, boolean isPrecache){QTAppodeal.onBannerLoaded(height, isPrecache);} @Override public void onBannerFailedToLoad(){QTAppodeal.onBannerFailedToLoad();} @Override public void onBannerShown(){QTAppodeal.onBannerShown();} @Override public void onBannerClicked(){QTAppodeal.onBannerClicked();} }); } public static native void onNonSkippableVideoLoaded (); public static native void onNonSkippableVideoFailedToLoad (); public static native void onNonSkippableVideoShown (); public static native void onNonSkippableVideoFinished (); public static native void onNonSkippableVideoClosed (boolean isFinished); public void setNonSkippableVideoCallback(){ Appodeal.setNonSkippableVideoCallbacks(new NonSkippableVideoCallbacks(){ @Override public void onNonSkippableVideoLoaded() { QTAppodeal.onNonSkippableVideoLoaded(); } @Override public void onNonSkippableVideoFailedToLoad() { QTAppodeal.onNonSkippableVideoFailedToLoad(); } @Override public void onNonSkippableVideoShown() {QTAppodeal.onNonSkippableVideoShown();} @Override public void onNonSkippableVideoFinished() { QTAppodeal.onNonSkippableVideoFinished(); } @Override public void onNonSkippableVideoClosed(boolean isFinished) { QTAppodeal.onNonSkippableVideoClosed(isFinished); } }); } public static native void onRewardedVideoLoaded (); public static native void onRewardedVideoFailedToLoad (); public static native void onRewardedVideoShown (); public static native void onRewardedVideoFinished (int i, String s); public static native void onRewardedVideoClosed (boolean isFinished); public void setRewardedVideoCallback () { Appodeal.setRewardedVideoCallbacks(new RewardedVideoCallbacks() { @Override public void onRewardedVideoLoaded() {QTAppodeal.onRewardedVideoLoaded();} @Override public void onRewardedVideoFailedToLoad() {QTAppodeal.onRewardedVideoFailedToLoad();} @Override public void onRewardedVideoShown() {QTAppodeal.onRewardedVideoShown();} @Override public void onRewardedVideoFinished(int i, String s) {QTAppodeal.onRewardedVideoFinished(i, s == null? "" : s);} @Override public void onRewardedVideoClosed(boolean isFinished) {QTAppodeal.onRewardedVideoClosed(isFinished);} }); } public void disableNetwork (Activity a_activity, String network) { Appodeal.disableNetwork((Context) a_activity, (String) network); } public void disableNetwork (Activity a_activity, String network, int adType) { Appodeal.disableNetwork((Context) a_activity, (String) network, adType); } public void disableLocationPermissionCheck () { Appodeal.disableLocationPermissionCheck(); } public void trackInAppPurchase (Activity a_activity, String currencyCode, int amount) { Appodeal.trackInAppPurchase(a_activity, amount, currencyCode); } public boolean canShow(int adType){ return Appodeal.canShow(adType); } public boolean canShow(int adType, String placement){ return Appodeal.canShow(adType, placement); } public void setChildDirectedTreatment(boolean flag){ Appodeal.setChildDirectedTreatment(flag); } public void muteVideosIfCallsMuted(boolean flag){ Appodeal.muteVideosIfCallsMuted(flag); } private UserSettings getUserSettings (Activity a_activity) { if(userSettings == null) userSettings = Appodeal.getUserSettings(a_activity); return userSettings; } public void setAge (Activity a_activity, int age) { getUserSettings(a_activity).setAge(age); } public void setGender (Activity a_activity, int gender) { switch (gender) { case 0: getUserSettings(a_activity).setGender(UserSettings.Gender.FEMALE); break; case 1: getUserSettings(a_activity).setGender(UserSettings.Gender.MALE); break; case 2: getUserSettings(a_activity).setGender(UserSettings.Gender.OTHER); break; } } public void setUserId(Activity a_activity, String userId){ getUserSettings(a_activity).setUserId(userId); } public void disableWriteExternalStoragePermissionCheck(){ Appodeal.disableWriteExternalStoragePermissionCheck(); } public void requestAndroidMPermissions(Activity a_activity){ Appodeal.requestAndroidMPermissions(a_activity, null); } public void set728x90Banners(boolean flag){ Appodeal.set728x90Banners(flag); } public void setBannerAnimation(boolean flag){ Appodeal.setBannerAnimation(flag); } public void setCustomRule(String name, String value){ Appodeal.setCustomRule(name, value); } public void setCustomRule(String name, double value){ Appodeal.setCustomRule(name, value); } public void setCustomRule(String name, boolean value){ Appodeal.setCustomRule(name, value); } public void setCustomRule(String name, int value){ Appodeal.setCustomRule(name, value); } public void setSmartBanners(boolean flag){ Appodeal.setSmartBanners(flag); } public void destroy(int adTypes){ Appodeal.destroy(adTypes); } }
2e3ff6793f098d70296e49b0ed49375a5bc2747c
85ed20d2ae90d854cec647f9685ec94937eef810
/JPADemos/Demos/Demo1002_JPA_ORM_CRUD/src/com/accenture/lkm/service/EmployeeServiceImpl.java
3f60471e05f8381480578a45be893f718ecedd49
[]
no_license
Gizmosoft/Java-Persistence-API-JPA
3e25464117e721eb289b02afad9d4ea4791f0c8b
95e1bdfe8fc62667307705881377041b0db5aba0
refs/heads/master
2023-04-12T02:12:48.322237
2021-05-05T05:48:39
2021-05-05T05:48:39
364,472,852
0
0
null
null
null
null
UTF-8
Java
false
false
1,883
java
package com.accenture.lkm.service; import com.accenture. lkm.utility.Factory; import com.accenture.lkm.businessbean.EmployeeBean; import com.accenture.lkm.dao.EmployeeDAO; public class EmployeeServiceImpl implements EmployeeService { public Integer addEmployee(EmployeeBean employee) throws Exception { int employeeId = 0; try { EmployeeDAO employeeDAO = Factory.createEmployeeDAO(); employeeId = employeeDAO.addEmployee(employee); } catch (Exception exception) { throw exception; } return employeeId; } public EmployeeBean findEmployeeById(Integer employeeId) throws Exception { EmployeeBean employee =null; try { EmployeeDAO employeeDAO = Factory.createEmployeeDAO(); employee = employeeDAO.findEmployeeById(employeeId); if(employee==null){ throw new Exception("Given EmployeeId is invalid, please try with a valid EmployeeId"); } } catch (Exception exception) { throw exception; } return employee; } @Override public EmployeeBean updateEmployee(EmployeeBean employeeBean)throws Exception { EmployeeBean employee =null; try { EmployeeDAO employeeDAO = Factory.createEmployeeDAO(); employee = employeeDAO.updateEmployee(employeeBean); if(employee==null){ throw new Exception("Given EmployeeId is invalid, please try with a valid EmployeeId"); } } catch (Exception exception) { throw exception; } return employee; } @Override public EmployeeBean deleteEmployeeById(Integer employeeId) throws Exception { EmployeeBean employee =null; try { EmployeeDAO employeeDAO = Factory.createEmployeeDAO(); employee = employeeDAO.deleteEmployeeById(employeeId); if(employee==null){ throw new Exception("Given EmployeeId is invalid, please try with a valid EmployeeId"); } } catch (Exception exception) { throw exception; } return employee; } }
0d44b98c9c3d410699781b8b526d35c8dd9623b1
5c774ca0916d0422cf836d5beaaade21442c9b92
/src/main/java/maril/petclinic/PetClinicApplication.java
4282b1006c2f7f553b02ad81c34a581162c302c2
[]
no_license
sefamaril/pet-clinic
3b6af59f01d64eff08c0aa53f1bec5c762edf392
d5f0fd3fc2efb68092acbea5bfe68ec14e9ab237
refs/heads/master
2023-05-06T15:56:43.388082
2021-05-29T19:28:32
2021-05-29T19:28:32
372,049,800
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package maril.petclinic; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class PetClinicApplication { public static void main(String[] args) { SpringApplication.run(PetClinicApplication.class, args); } }
dfd62faf80f99c7f77bf6f447329602c3a665952
bf05c0df29bd787168dec736ea38323902924a29
/src/main/java/Shufflel.java
f345745d0e88ddd4a96644cd1341f192f4b2de6c
[]
no_license
L0nePi1ot/HeadFirstJava
f13443b8f2356c9fb40577b63762d62b624ce360
abde91a3b4ec2b0cd1d0969266b52077952b6d2c
refs/heads/master
2020-04-22T20:43:05.595128
2019-02-15T08:35:49
2019-02-15T08:35:49
170,643,662
0
0
null
null
null
null
UTF-8
Java
false
false
459
java
public class Shufflel { public static void main (String[] args) { int x=3; while (x > 0) { if (x > 2) { System.out.print("a"); } x = x - 1; System.out.print("-"); if (x == 2) { System.out.print("b c"); } if (x == 1) { System.out.print("d"); x = x - 1; } } } }
a50beb98e511d0b2deb6883e83c7737fbfca82ed
dc2432fef5f87ee336158f89ffaf083beb18ab48
/src/main/java/com/xxs/definedweek/entity/Ad.java
8edc021784a2dc36e455d6169fb94b701af07eda
[]
no_license
xxs/definedweek
72a0f1757ad9cd2e57212216cd269858bac86836
b9228a2eeee38dd44a3095e29111c0567d49240a
refs/heads/master
2020-12-25T09:28:20.691302
2014-12-11T13:33:32
2014-12-11T13:33:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,106
java
/* */ package com.xxs.definedweek.entity; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotEmpty; /** * Entity - 广告 * */ @Entity @Table(name = "xx_ad") @SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_ad_sequence") public class Ad extends OrderEntity { private static final long serialVersionUID = -1307743303786909390L; /** * 类型 */ public enum Type { /** 文本 */ text, /** 图片 */ image, /** flash */ flash } /** 标题 */ private String title; /** 类型 */ private Type type; /** 内容 */ private String content; /** 路径 */ private String path; /** 起始日期 */ private Date beginDate; /** 结束日期 */ private Date endDate; /** 链接地址 */ private String url; /** 广告位 */ private AdPosition adPosition; /** * 获取标题 * * @return 标题 */ @NotEmpty @Length(max = 200) @Column(nullable = false) public String getTitle() { return title; } /** * 设置标题 * * @param title * 标题 */ public void setTitle(String title) { this.title = title; } /** * 获取类型 * * @return 类型 */ @NotNull @Column(nullable = false) public Type getType() { return type; } /** * 设置类型 * * @param type * 类型 */ public void setType(Type type) { this.type = type; } /** * 获取内容 * * @return 内容 */ @Lob public String getContent() { return content; } /** * 设置内容 * * @param content * 内容 */ public void setContent(String content) { this.content = content; } /** * 获取路径 * * @return 路径 */ @Length(max = 200) public String getPath() { return path; } /** * 设置路径 * * @param path * 路径 */ public void setPath(String path) { this.path = path; } /** * 获取起始日期 * * @return 起始日期 */ public Date getBeginDate() { return beginDate; } /** * 设置起始日期 * * @param beginDate * 起始日期 */ public void setBeginDate(Date beginDate) { this.beginDate = beginDate; } /** * 获取结束日期 * * @return 结束日期 */ public Date getEndDate() { return endDate; } /** * 设置结束日期 * * @param endDate * 结束日期 */ public void setEndDate(Date endDate) { this.endDate = endDate; } /** * 获取链接地址 * * @return 链接地址 */ @Length(max = 200) public String getUrl() { return url; } /** * 设置链接地址 * * @param url * 链接地址 */ public void setUrl(String url) { this.url = url; } /** * 获取广告位 * * @return 广告位 */ @NotNull @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nullable = false) public AdPosition getAdPosition() { return adPosition; } /** * 设置广告位 * * @param adPosition * 广告位 */ public void setAdPosition(AdPosition adPosition) { this.adPosition = adPosition; } /** * 判断是否已开始 * * @return 是否已开始 */ @Transient public boolean hasBegun() { return getBeginDate() == null || new Date().after(getBeginDate()); } /** * 判断是否已结束 * * @return 是否已结束 */ @Transient public boolean hasEnded() { return getEndDate() != null && new Date().after(getEndDate()); } }
6dfec10cd5973d902def4be545bd857d04add67f
d54f9700ba27b3c7140b9e23b87101c3087d3236
/src/main/java/com/dppware/wekaExamplesApplication/controller/TenantController.java
38e18cfb1f9a2a1399194c193a90142bc2ad9357
[]
no_license
danipenaperez/weka
c0b99823936c7bc75cdfb768f506205a10bda946
56e6bdede8cedf177f5f63b376034d7ff155e534
refs/heads/master
2020-04-30T08:09:30.874239
2019-04-05T11:28:33
2019-04-05T11:28:33
176,706,224
1
1
null
2019-03-25T11:30:21
2019-03-20T10:08:51
Java
UTF-8
Java
false
false
6,083
java
package com.dppware.wekaExamplesApplication.controller; import java.io.IOException; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.websocket.server.PathParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import com.dppware.wekaExamplesApplication.bean.Model; import com.dppware.wekaExamplesApplication.bean.Prototype; import com.dppware.wekaExamplesApplication.bean.Tenant; import com.dppware.wekaExamplesApplication.service.ModelService; import com.dppware.wekaExamplesApplication.service.PrototypeService; import com.dppware.wekaExamplesApplication.service.TenantService; import lombok.extern.slf4j.Slf4j; /** * Multitenant c * @author dpena * */ @RestController @RequestMapping("tenant") @Slf4j public class TenantController { @Autowired private TenantService tenantService; @Autowired private PrototypeService prototypeService; @Autowired private ModelService modelService; @GetMapping(value = "/examples") @ResponseBody public Map<String,String> examples() { Map<String,String> prototypes = new HashMap<String,String>(); prototypes.put("id", "w+"); prototypes.put("name", "juan|luis|mariano"); prototypes.put("edad", "\\d"); prototypes.put("edad", "yes|no"); return prototypes; } /** * Create a tenant * @param person * @throws Exception */ @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.CREATED) public Tenant createTenant(@RequestBody Tenant tenant) throws Exception { return tenantService.create(tenant); } /** * Get all tenant * @param person * @throws Exception */ @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.OK) public Collection<Tenant> getTenants() throws Exception { return tenantService.getAllTenants(); } /** * Delete a tenant * @param person * @throws Exception */ @PostMapping(value="{id}" ,consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.OK) public void deleteTenant(@PathVariable("tenantId") String tenantId) throws Exception { tenantService.delete(tenantId); } /** * Return the prototype definition of a tenant account * @param tenantId * @return */ @GetMapping(value = "{id}/prototype") @ResponseBody public List<Prototype> getTenantPrototypes(@PathVariable("id") String tenantId) { return prototypeService.getTenantPrototypes(tenantId); } /** * Create a prototype of a tenant * @param person * @throws IOException */ @PostMapping(value = "/{id}/prototype", consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.CREATED) public Prototype createPrototype(@PathVariable("id") String tenantId, @RequestBody Map<String,String> prototypeInfo) throws IOException { return prototypeService.saveTenantPrototype(tenantId, new Prototype().setAttributes(prototypeInfo)); } /** * Get a prototype that already exist on tenant account * @param person * @throws Exception */ @GetMapping(value = "{tenantId}/prototype/{prototypeId}", consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.CREATED) public Prototype getTenantPrototype(@PathVariable("tenantId") String tenantId,@PathVariable("prototypeId") String prototypeId) throws Exception { return prototypeService.getTenantPrototype(tenantId, new Prototype().setId(prototypeId)); } /** * Update a prototype that already exist on tenant account * @param person * @throws Exception */ @PutMapping(value = "{tenantId}/prototype/{prototypeId}", consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.OK) public Prototype udpatePrototype(@PathVariable("tenantId") String tenantId,@PathVariable("prototypeId") String prototypeId, @RequestBody Map<String,String> prototypeInfo) throws Exception { //TODO: Verify prototypeId owns to tenant return prototypeService.updateTenantPrototype(tenantId, prototypeId, new Prototype().setId(prototypeId).setAttributes(prototypeInfo)); } /** * Return the models of a prototype definition of a tenant account * @param tenantId * @return */ @GetMapping(value = "{id}/prototype/{prototypeId}/model") @ResponseBody public List<Model> getPrototypeModles(@PathVariable("id") String tenantId,@PathVariable("prototypeId") String prototypeId) { return modelService.getPrototypeModels(new Prototype().setId(prototypeId)); } /** * Create a model for the passed PrototypeId * @param person * @throws Exception */ @PostMapping(value = "{id}/prototype/{prototypeId}/model", consumes = MediaType.APPLICATION_JSON_VALUE) @ResponseBody @ResponseStatus(HttpStatus.CREATED) public Model createPrototypeModel(@PathVariable("id") String tenantId,@PathVariable("prototypeId") String prototypeId, @RequestBody Map<String,String> modelInfo) throws Exception { //TODO: Verify prototypeId owns to tenant return modelService.saveModel(new Prototype().setId(prototypeId), new Model().setAttributes(modelInfo)); } }
84b431e6b563b874b7bba9afe53274bd0b2edeb6
66ee95ce17c27d0413bad0d6f0f7fa9e6a4f39d4
/app/src/test/java/sg/edu/rp/c346/id20007649/l09problemstatement/ExampleUnitTest.java
b72ab651d1544fd07c256aa55243551a76e06449
[]
no_license
ChuaQiuLi/L09_Problem_Statement
54f9881dca29fc228fbdffcc0c4317bc38f3dbae
24044607afb656bf9c40e5cc712bcdb933871028
refs/heads/master
2023-06-19T08:54:19.917434
2021-07-17T06:39:36
2021-07-17T06:39:36
386,717,444
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package sg.edu.rp.c346.id20007649.l09problemstatement; 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); } }
81a70595505ed8b95a32784ddc694c3cf9444aca
635edfb996070135106c8db7fb2419207bcee921
/src/cn/license/Player.java
24702a2f6d18b7dfb74c49419a49352bbe22e948
[]
no_license
licenseliang/myplanegame
981489c9dc733b805256f18bbcbe6737d6b81d70
d0c57cf3a1d8d676b460bddbf57e13b675d5ad1d
refs/heads/master
2020-05-17T10:06:27.614747
2015-01-13T14:11:20
2015-01-13T14:11:20
29,173,931
0
0
null
null
null
null
GB18030
Java
false
false
3,198
java
package cn.license; import android.graphics.Bitmap; import android.view.KeyEvent; import android.view.MotionEvent; import cn.license.collsionwith.ICollsionWithPlane; import cn.license.collsionwith.PlayerCW; import cn.license.collsionwith.PlayerCWPlane; import cn.license.draw.PlayerDraw; import cn.license.logic.PlayerLogic; public class Player extends Plane{ private ICollsionWithPlane playerCWPlane; //主角的血量和血量位图 //默认3血 public int playerHp = 30; public Bitmap bmpPlayerHp; //主角的坐标以及位图 public int x,y; public Bitmap bmpPlayer; //z主角移动速度 public int speed = 5; //主角移动标识(基础章节已讲解,你懂得) public boolean isUp,isDown,isLeft,isRight; //碰撞后处于无敌时间 //计时器 public int noCollisionCount = 0; //因为无敌时间 public int noCollisionTime = 60; //是否碰撞的标识位 public boolean isCollision; //主角的构造函数 public Player(Bitmap bmpPlayer,Bitmap bmpPlayerHp){ this.bmpPlayer = bmpPlayer; this.bmpPlayerHp = bmpPlayerHp; x = MySurfaceView.screenW /2 - bmpPlayer.getWidth()/2; y = MySurfaceView.screenH - bmpPlayer.getHeight(); this.setDraw(new PlayerDraw(this)); this.setLogic(new PlayerLogic(this)); this.setCollsionWith(new PlayerCW(this)); this.playerCWPlane = new PlayerCWPlane(this); } /** * 实体按键 */ public void onKeyDown(int keyCode,KeyEvent event){ if(keyCode == KeyEvent.KEYCODE_DPAD_UP){ isUp = true; } if(keyCode == KeyEvent.KEYCODE_DPAD_DOWN){ isDown = true; } if(keyCode == KeyEvent.KEYCODE_DPAD_LEFT){ isLeft = true; } if(keyCode == KeyEvent.KEYCODE_DPAD_RIGHT){ isRight = true; } } /** * 实体按键抬起 */ public void onKeyUp(int keyCode,KeyEvent event){ if(keyCode == KeyEvent.KEYCODE_DPAD_UP){ isUp = false; } if(keyCode == KeyEvent.KEYCODE_DPAD_DOWN){ isDown = false; } if(keyCode == KeyEvent.KEYCODE_DPAD_LEFT){ isLeft = false; } if(keyCode == KeyEvent.KEYCODE_DPAD_RIGHT){ isRight = false; } } // 菜单触屏事件函数,主要用于处理按钮事件 public void onTouchEvent(MotionEvent event) { // 获取用户当前触屏位置 int pointX = (int) event.getX(); int pointY = (int) event.getY(); // 当用户是按下动作或移动动作 if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) { // 判定用户是否点击了按钮 if (pointX > x) { isRight = true; } else { isLeft = true; } if (pointY > y) { isDown = true; } else { isUp = true; } // 当用户是抬起动作 } else if (event.getAction() == MotionEvent.ACTION_UP) { // 抬起判断是否点击按钮,防止用户移动到别处 isUp = false; isDown = false; isLeft = false; isRight = false; } } /** * 设置主角血量 */ public void setPlayerHp(int hp){ this.playerHp = hp; } /** * 获取主角血量 */ public int getPlayerHp(){ return playerHp; } //判断碰撞(主角与敌机) public boolean isCollsionWith(Plane plane){ return this.playerCWPlane.isCollsionWith(plane); } }
c56a80571bb85bc0590308190558f40fd91d0b56
c61a1ca73507ca151e82fc69a63c59235f62dd40
/app/src/main/java/com/xiaoxian/trade/base/BaseView.java
4892a2a8ae81458f84107e76e8a60707fa1e2215
[]
no_license
zz-xian/Trade
4ad359fdf62cedcbae1ecf7022139e37033b458b
f5f0ed3da6467f889f06f2a2f0d8933dcb8940b9
refs/heads/master
2020-12-01T02:57:26.256040
2017-03-20T07:37:58
2017-03-20T07:37:58
85,547,359
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package com.xiaoxian.trade.base; public interface BaseView<T> { }
d3356ca02611d164ae97e1e096ed1bbcfdcc2de7
76015bf8f0bed2642bfc5e486618dfc56da29bc5
/src/main/java/net/jakobnielsen/aptivator/settings/StylesheetDialog.java
21d75f9ed9269b31ab0e55417f7dd3f758650d21
[]
no_license
lazee/Aptivator
64abb0c9451398c0dd67fc65c3c2d3f6872fa4e9
863259655e576db6be35b2aac1f8293519b9ffbf
refs/heads/master
2021-03-12T19:47:11.092674
2019-04-11T07:20:00
2019-04-11T07:20:00
1,384,114
3
0
null
null
null
null
UTF-8
Java
false
false
6,501
java
/* * Copyright (c) 2008-2011 Jakob Vad Nielsen * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jakobnielsen.aptivator.settings; import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import net.jakobnielsen.aptivator.MessagesProperties; import net.jakobnielsen.aptivator.dialog.AptivatorFileChooser; import net.jakobnielsen.aptivator.dialog.ErrorBox; import net.jakobnielsen.aptivator.settings.entities.StyleSheet; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ResourceBundle; /** * Stylesheet dialog * * @author <a href="mailto:[email protected]">Jakob Vad Nielsen</a> */ public class StylesheetDialog extends JDialog { private JTextField titleField = new JTextField(); private JTextField pathField = new JTextField(); private JButton selectButton = new JButton("\u2026"); private JButton okButton; private JButton cancelButton; private String action = null; private StyleSheet styleSheet; private ResourceBundle rb; public StylesheetDialog(Frame owner, StyleSheet styleSheet, ResourceBundle rb) { super(owner, rb.getString(MessagesProperties.TEXT_STYLESHEET), true); this.rb = rb; this.styleSheet = styleSheet; okButton = new JButton(rb.getString(MessagesProperties.TEXT_OK)); cancelButton = new JButton(rb.getString(MessagesProperties.TEXT_CANCEL)); JPanel mainPanel = buildMainPanel(); selectButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new AptivatorFileChooser("css"); fileChooser.showOpenDialog(new JFrame()); if (fileChooser.getSelectedFile() != null) { pathField.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } } ); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); //dispose(); action = "FALSE"; } } ); okButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (isValidTitle() && isValidFilePath()) { // TODO We should add some sort of validation here storeStyleSheetInObject(); setVisible(false); //dispose(); action = "OK"; } } } ); if (styleSheet != null) { if (styleSheet.getTitle() != null) { titleField.setText(styleSheet.getTitle()); } if (styleSheet.getSrcFile() != null) { pathField.setText(styleSheet.getSrcFile().getAbsolutePath()); } } getContentPane().add(mainPanel); pack(); setResizable(false); } private boolean isValidTitle() { if (titleField != null && !"".equals(titleField.getText().trim())) { return true; } ErrorBox.show(rb.getString(MessagesProperties.ERROR_STYLESHEET_TITLE), rb.getString(MessagesProperties.ERROR)); return false; } private boolean isValidFilePath() { if (pathField != null && !"".equals(pathField.getText().trim())) { File f = new File(pathField.getText()); if (f.exists()) { return true; } ErrorBox.show(rb.getString(MessagesProperties.ERROR_FILE_MISSING), rb.getString(MessagesProperties.ERROR)); return false; } ErrorBox.show(rb.getString(MessagesProperties.ERROR_STYLESHEET_PATH), rb.getString(MessagesProperties.ERROR)); return false; } private void storeStyleSheetInObject() { if (styleSheet == null) { styleSheet = new StyleSheet(); } styleSheet.setTitle(titleField.getText().trim()); styleSheet.setSrcFile(new File(pathField.getText())); } public String getAction() { return action; } public StyleSheet getStyleSheet() { return styleSheet; } private JPanel buildPanel() { FormLayout layout = new FormLayout( "pref, 3dlu, 35dlu, 2dlu, 35dlu, 2dlu, 35dlu, 2dlu, 35dlu", "2*(p, 2dlu), p"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.add(new JLabel(rb.getString("text.title") + ":"), cc.xy(1, 1)); builder.add(titleField, cc.xyw(3, 1, 7)); builder.add(new JLabel(rb.getString("text.location") + ":"), cc.xy(1, 3)); builder.add(pathField, cc.xyw(3, 3, 5)); builder.add(selectButton, cc.xy(9, 3)); return builder.getPanel(); } private JPanel buildMainPanel() { FormLayout layout = new FormLayout( "d:grow, 50dlu, 50dlu", "p, 4dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.add(buildPanel(), cc.xyw(1, 1, 3)); builder.add(okButton, cc.xy(2, 3)); builder.add(cancelButton, cc.xy(3, 3)); return builder.getPanel(); } }
5bc45a3069c314d4826d6958701e2f182a2faf65
1d728e7db94181a3c5c23d00984b1769ac888c0c
/src/org/javabrains/koushik/dto/Vehicle.java
3e8dd155c9957daf81bc4eaf28da924c751d2df7
[]
no_license
beautifulnature/FirstHibernateProj
e90b994071475730f52f2015bdd5122e7105c75f
4a21375401eb1ba8888339e0bd184f299100a253
refs/heads/master
2020-03-11T19:40:06.668896
2018-04-19T12:44:44
2018-04-19T12:44:44
129,999,557
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
package org.javabrains.koushik.dto; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; @Entity /*@Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="VEHICLE_TYPE", discriminatorType=DiscriminatorType.STRING)*/ //@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) @Inheritance(strategy=InheritanceType.JOINED) public class Vehicle { @Id @GeneratedValue private int vehicleId; private String vehicleName; /*@ManyToOne @NotFound(action=NotFoundAction.IGNORE) @JoinColumn(name="USER_ID") private UserDetails user;*/ /*@ManyToMany(mappedBy="vehicles") private Collection<UserDetails> userList = new ArrayList<>();*/ public int getVehicleId() { return vehicleId; } public void setVehicleId(int vehicleId) { this.vehicleId = vehicleId; } public String getVehicleName() { return vehicleName; } public void setVehicleName(String vehicleName) { this.vehicleName = vehicleName; } /*public UserDetails getUser() { return user; } public void setUser(UserDetails user) { this.user = user; }*/ /*public Collection<UserDetails> getUserList() { return userList; }*/ }
38a07fddd0e7655cc82ffe988771a71580cb6c85
23102771bb4e3400588e9111867fae97a40016c6
/src/main/java/com/serverMonitor/database/repository/command/CommandCrudRepository.java
f17a98b087dc94424ed9dd84959c01666af0784c
[]
no_license
Mariesnlk/Monitoring-Servers
5c6552d1880bbe89d82847da35710bcc609a694a
8bc5f4a2fb9a7103177a65e91506c9a6ecc82477
refs/heads/master
2023-07-13T03:16:46.435886
2021-08-25T16:18:36
2021-08-25T16:18:36
399,882,297
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.serverMonitor.database.repository.command; import com.serverMonitor.database.enteties.command.Command; import com.serverMonitor.database.enteties.command.TypeCommand; import org.springframework.data.repository.CrudRepository; import java.util.List; public interface CommandCrudRepository extends CrudRepository<Command, Long> { List<Command> getCommandsByServerId(Long serverId); List<Command> getCommandsByServerIdAndTypeCommandOrderById(Long serverId, TypeCommand typeCommand); Command getCommandById(Long commandId); Boolean existsCommandByServerIdAndTitle(Long serverId, String title); Boolean existsCommandByServerIdAndTypeCommand(Long serverId, TypeCommand typeCommand); Command getCommandByServerIdAndTitle(Long serverId, String title); }
92290593875ce87f866f81207d4ff24ea7950a68
b343ea2879ecbca1ea8a297702fe8190e06ad472
/src/main/java/com/jason/sample/model/User.java
aca1507cdf5e986b95d91defbf616b3bff0d8372
[]
no_license
smallbaby/jasonmvc
3aeb800ec1a4abc9e380c6ac272075b898c4625b
1d75f91262abd4dc779a0d8049180305e414e8c3
refs/heads/master
2022-07-19T13:41:48.888770
2019-08-25T12:37:09
2019-08-25T12:37:09
203,762,962
0
0
null
2020-10-13T15:34:14
2019-08-22T09:39:23
Java
UTF-8
Java
false
false
1,042
java
package com.jason.sample.model; import java.io.Serializable; import java.util.Date; /** * author: zhangkai * date: 2019-08-25 * description: */ public class User implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String name; private Integer age; private Date birthday; public User() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } @Override public String toString() { return "User [id=" + id + ", name=" + name + ", age=" + age + ", birthday=" + birthday; } }
b59aa59204c789b3369a8c22f51a10204813c9f2
e436f5d2b7b5065b343955f83f4de1f7472f5f59
/net.jplugin.core.config/src/net/jplugin/core/config/api/IConfigChangeHandler.java
aa9d2c8e8ed2b39daae340be0311ce9595c2e469
[]
no_license
kevin-penn/jplugin
641b25773ada2cbcc9be543b623104272a2f32a4
63f2d2c36da73fe07c0e7fb4190a9d215b795f34
refs/heads/master
2021-06-19T17:31:16.630447
2017-06-07T01:31:04
2017-06-07T01:31:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
110
java
package net.jplugin.core.config.api; public interface IConfigChangeHandler { public void onChange(); }
f3a32670b008c777700d6c9cf776a5d3050db8f6
c395f01ea6c34ecdc905bc345b780882b8834c46
/Jolly/app/src/main/java/cn/lst/jolly/details/DetailsContract.java
e3cb6c14bbaa9fdd58e663cf546daa6f377b2247
[]
no_license
lisongting/Android-Projects
3c03bdcb69c2bb06f4a3e0ec93b08caa49d50633
23ac196fca8e786629d829852c9597dc197d25ae
refs/heads/master
2020-06-26T16:43:35.076004
2018-12-09T15:42:02
2018-12-09T15:42:02
74,548,801
6
2
null
null
null
null
UTF-8
Java
false
false
1,453
java
package cn.lst.jolly.details; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import java.util.List; import cn.lst.jolly.BasePresenter; import cn.lst.jolly.BaseView; import cn.lst.jolly.data.ContentType; import cn.lst.jolly.data.DoubanMomentContent; import cn.lst.jolly.data.DoubanMomentNewsThumbs; import cn.lst.jolly.data.GuokrHandpickContentResult; import cn.lst.jolly.data.ZhihuDailyContent; /** * Created by lisongting on 2018/1/16. */ public class DetailsContract { interface View extends BaseView<Presenter> { void showMessage(@StringRes int stringRes); boolean isActive(); void showZhihuDailyContent(@NonNull ZhihuDailyContent content); void showDoubanMomentContent(@NonNull DoubanMomentContent content, @Nullable List<DoubanMomentNewsThumbs> list); void showGuokrHandpickContent(@NonNull GuokrHandpickContentResult content); void share(@Nullable String link); void copyLink(@Nullable String link); void openWithBrowser(@Nullable String link); } interface Presenter extends BasePresenter { void favorite(ContentType type, int id, boolean favorite); void loadDoubanContent(int id); void loadZhihuDailyContent(int id); void loadGuokrHandpickContent(int id); void getLink(ContentType type, int requestCode, int id); } }
b15b4c9b8cc5ddb8ca5bc071a779ee38937bf1d6
1b21b62090cc229423a436ad4bf815c92e9ba04e
/Bestbuy/app/src/main/java/com/example/xpack/bestbuy/SplashActivity.java
0fdff5ae55d05239936bad33a0818659e71feae3
[]
no_license
xpack94/android
db09f43c20b759144a2eda6de41136b677fa6357
f5ceff41d21b9c7799e2d5b17393286af4939382
refs/heads/master
2021-01-24T18:39:41.293566
2017-05-01T17:34:28
2017-05-01T17:34:28
86,130,735
0
2
null
null
null
null
UTF-8
Java
false
false
1,019
java
package com.example.xpack.bestbuy; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import java.util.Timer; import java.util.TimerTask; public class SplashActivity extends Activity { private static final long DELAY = 3000; private boolean scheduled = false; private Timer splashTimer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sp); splashTimer = new Timer(); splashTimer.schedule(new TimerTask() { @Override public void run() { SplashActivity.this.finish(); startActivity(new Intent(SplashActivity.this, MainActivity.class)); } }, DELAY); scheduled = true; } @Override protected void onDestroy() { super.onDestroy(); if (scheduled) splashTimer.cancel(); splashTimer.purge(); } }
9da80787b419364ce5101c47f1beff76c8454af6
6ec9c0c9f3ba2b84f92efa0af5d793b870d347e3
/QCloudCosXml/cos-android/src/normal/java/com/tencent/cos/xml/model/ci/media/SubmitExtractDigitalWatermarkJobResponse.java
95f39caa50c92944faf74be371e468f3def1fc1b
[ "MIT" ]
permissive
tencentyun/qcloud-sdk-android
8b5f95c5a1ff0d7d9c5a8622fa00d24e1e33cd5a
71991043df37712c6f13553f03874a78fe4a9a5b
refs/heads/master
2023-08-23T03:04:26.225585
2023-08-16T13:16:31
2023-08-16T13:16:31
102,087,298
28
8
MIT
2020-05-08T07:18:06
2017-09-01T07:41:29
Java
UTF-8
Java
false
false
4,127
java
/* * Copyright (c) 2010-2020 Tencent Cloud. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.tencent.cos.xml.model.ci.media; import com.tencent.qcloud.qcloudxml.annoation.XmlBean; @XmlBean(name = "Response", method = XmlBean.GenerateMethod.FROM) public class SubmitExtractDigitalWatermarkJobResponse { /** *任务的详细信息 */ public SubmitExtractDigitalWatermarkJobResponseJobsDetail jobsDetail; @XmlBean(name = "JobsDetail", method = XmlBean.GenerateMethod.FROM) public static class SubmitExtractDigitalWatermarkJobResponseJobsDetail { /** *错误码,只有 State 为 Failed 时有意义 */ public String code; /** *错误描述,只有 State 为 Failed 时有意义 */ public String message; /** *新创建任务的 ID */ public String jobId; /** *新创建任务的 Tag:ExtractDigitalWatermark */ public String tag; /** *任务的状态,为 Submitted、Running、Success、Failed、Pause、Cancel 其中一个 */ public String state; /** *任务的创建时间 */ public String creationTime; /** *任务的结束时间 */ public String endTime; /** *任务所属的队列 ID */ public String queueId; /** *该任务的输入资源地址 */ public SubmitExtractDigitalWatermarkJobResponseInput input; /** *该任务的操作规则 */ public SubmitExtractDigitalWatermarkJobResponseOperation operation; } @XmlBean(name = "Input", method = XmlBean.GenerateMethod.FROM) public static class SubmitExtractDigitalWatermarkJobResponseInput { /** *存储桶的地域 */ public String region; /** *存储结果的存储桶 */ public String bucketId; /** *输出结果的文件名 */ public String object; } @XmlBean(name = "Operation", method = XmlBean.GenerateMethod.FROM) public static class SubmitExtractDigitalWatermarkJobResponseOperation { /** *数字水印配置 */ public SubmitExtractDigitalWatermarkJobResponseExtractDigitalWatermark extractDigitalWatermark; /** *透传用户信息 */ public String userData; /** *任务优先级 */ public String jobLevel; } @XmlBean(name = "ExtractDigitalWatermark", method = XmlBean.GenerateMethod.FROM) public static class SubmitExtractDigitalWatermarkJobResponseExtractDigitalWatermark { /** *提取出的数字水印字符串信息 */ public String message; /** *水印类型 */ public String type; /** *水印版本 */ public String version; } }
9119058d1a289727ea67a472640400895eab5149
c3a83420ab341677929e4be7676467294e52aee3
/20_06_07 std/src/UniquePathsⅡ.java
b2e664353ca4de831bca1bb8d153769b0911de0f
[]
no_license
LYHccc/study_java
525474403d9c0aaadaac84c1bf1ba7d7d77de89e
732e1ada5e3d9d2117ddfefac750f9b1354fbb6f
refs/heads/master
2022-11-25T19:57:18.091460
2020-11-13T14:29:58
2020-11-13T14:29:58
217,519,014
0
0
null
null
null
null
UTF-8
Java
false
false
1,212
java
/*路径总数Ⅱ 继续思考题目"Unique Paths": 如果在图中加入了一些障碍,有多少不同的路径? 分别用0和1代表空区域和障碍 例如: 下图表示有一个障碍在3*3的图中央。 [↵ [0,0,0],↵ [0,1,0],↵ [0,0,0]↵]有2条不同的路径 备注:m和n不超过100. */ public class UniquePathsⅡ { public int uniquePathsWithObstacles (int[][] obstacleGrid) { int row = obstacleGrid.length; int col = obstacleGrid[0].length; int[][] dp = new int[row][col]; for(int i = 0; i < row; i++){ if(obstacleGrid[i][0] == 0){ dp[i][0] = 1; }else{ break; } } for(int i = 0; i < col; i++){ if(obstacleGrid[0][i] == 0){ dp[0][i] = 1; }else{ break; } } for(int i = 1; i < row; i++){ for(int j = 1; j < col; j++){ if(obstacleGrid[i][j] == 1){ dp[i][j] = 0; }else{ dp[i][j] = dp[i - 1][j] + dp[i][j - 1]; } } } return dp[row - 1][col - 1]; } }
4d7db51d64bf80874abf63d3c2e96fe0a1691aae
81e8a262b02fdddacb708c271db0989969b75204
/Assignment1/src/com/assignment/customException.java
c1112c92f78d632e0459ecf32f41e1491712ef4f
[]
no_license
nsg1999/Java-Learning
3b677e860ca63305cb31da6e3fee33ffd45526ae
f06c34250949d4161291468fe38481cf799075a4
refs/heads/main
2023-06-04T11:29:46.491756
2021-07-06T05:26:19
2021-07-06T05:26:19
382,795,032
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.assignment; public class customException extends NullPointerException { public customException(String errorMessage) { System.out.println("\nCustom Exception: " + errorMessage); } }
2b460f2f30725a6c5090c905468c84a3775cf22c
ff9d2291627df80ed9bd3d7e7c9e2b2184877999
/netty_test/src/main/java/xiaNing/netty/groupchat/GroupChatClientHandler.java
aa98463f0addb214a8f1db296e04671fb34ca9ac
[]
no_license
xianing-lll/nettyTest
1efaa2911f4cf420dafe07179f928d1dcd8a720a
98c10fd78b499a98a727a575ad3d2c8243bbf89d
refs/heads/master
2022-04-16T05:36:59.375723
2020-04-10T13:03:59
2020-04-10T13:03:59
254,633,440
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package xiaNing.netty.groupchat; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; public class GroupChatClientHandler extends SimpleChannelInboundHandler<String> { @Override protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception { //trim函数去掉字符串两端多余的空格 System.out.println(msg.trim()); } }
335cf2ff2fd915d6f3fa572aeebbe62881c85ce4
86f8714c6094f63b600b474cdc1f883b94b067b1
/src/net/moriaritys/timeout/shared/data/LoginInfo.java
7ef2b8871a0073fbed330e67de27cb97b9312142
[]
no_license
mjm/timeout-gwt
e085ea86aa2395f91910fb9badaa2d1b079260b8
669e21d31006ef2d7853b6bdd903ef6f92082d43
refs/heads/master
2020-05-18T08:59:09.647013
2010-02-07T05:58:03
2010-02-07T05:58:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
package net.moriaritys.timeout.shared.data; import com.google.gwt.user.client.rpc.IsSerializable; /** * */ public class LoginInfo implements IsSerializable { private boolean loggedIn; private String url; private String emailAddress; private String nickname; public boolean isLoggedIn() { return loggedIn; } public void setLoggedIn(final boolean loggedIn) { this.loggedIn = loggedIn; } public String getUrl() { return url; } public void setUrl(final String url) { this.url = url; } public String getEmailAddress() { return emailAddress; } public void setEmailAddress(final String emailAddress) { this.emailAddress = emailAddress; } public String getNickname() { return nickname; } public void setNickname(final String nickname) { this.nickname = nickname; } }
039479de3d5e02ad27870ebc983855d3c5a4c2ef
918377168c113b7d777dc7aa1ecaf92f9c4a313a
/Day 4/Sum/src/com/Sum/Main.java
0fce2fa9d6bc45d4578caadd9dd1666d19ff5fef
[]
no_license
HarshalPatil11/assignment-submission
4036c8b2bb7d70950b4da88d0edcbabffb54eed2
5e13a59d07bad1f0f71bc88c6366a72201a99af2
refs/heads/main
2023-01-02T19:03:09.592558
2020-11-01T13:56:50
2020-11-01T13:56:50
308,908,408
0
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.Sum; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int sum=0; int[] arr=new int[5]; for(int i=0;i<5;i++){ System.out.println("Enter a number :"); arr[i]=sc.nextInt(); } for(int i=0;i<5;i++){ sum=sum+arr[i]; } System.out.println("The sum of numbers is : " +sum); } }
d0faf4a9b865ce35c7958da33e280388f078fa15
395e11531a072ac3f84ab6283a60a2ec9cb0e54f
/src/main/java/com/customsdk/rekoo/RekooMainActivity.java
bb708f14de19185f492df89e6c5916b7c0c17755
[]
no_license
subdiox/senkan
c2b5422064735c8e9dc93907d613d2e7c23f62e4
cbe5bce08abf2b09ea6ed5da09c52c4c1cde3621
refs/heads/master
2020-04-01T20:20:01.021143
2017-07-18T10:24:01
2017-07-18T10:24:01
97,585,160
0
1
null
null
null
null
UTF-8
Java
false
false
24,564
java
package com.customsdk.rekoo; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.AsyncTask; import android.os.Build; import android.os.Build.VERSION; import android.os.Bundle; import android.os.Process; import android.provider.Settings.Secure; import android.telephony.TelephonyManager; import android.util.Base64; import android.util.Log; import com.customsdk.rekoo.util.IabHelper; import com.customsdk.rekoo.util.IabHelper.OnConsumeFinishedListener; import com.customsdk.rekoo.util.IabHelper.OnIabPurchaseFinishedListener; import com.customsdk.rekoo.util.IabHelper.OnIabSetupFinishedListener; import com.customsdk.rekoo.util.IabHelper.QueryInventoryFinishedListener; import com.customsdk.rekoo.util.IabResult; import com.customsdk.rekoo.util.Inventory; import com.customsdk.rekoo.util.Purchase; import com.demo.yunva.MainActivity; import com.google.android.gms.common.GooglePlayServicesUtil; import com.rekoo.libs.callback.ProduceTransformCallback; import com.rekoo.libs.callback.RKLibInitCallback; import com.rekoo.libs.callback.RKLoginCallback; import com.rekoo.libs.callback.RKLogoutCallback; import com.rekoo.libs.callback.TransformCallback; import com.rekoo.libs.entity.ProduceTransform; import com.rekoo.libs.entity.RKUser; import com.rekoo.libs.entity.Transform; import com.rekoo.libs.net.URLCons; import com.rekoo.libs.platform.RKPlatformManager; import com.rekoo.libs.utils.AdvertisingIdClient; import com.unity3d.player.UnityPlayer; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringWriter; import java.io.Writer; import java.net.InetAddress; import java.net.NetworkInterface; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; public class RekooMainActivity extends MainActivity { private static final String INIT_CALLBACK_MESSAGE = "OnPlatformSdk_Init"; private static final String LOGIN_CALLBACK_MESSAGE = "OnPlatformSdk_UserLogin"; private static final String LOGOUT_CALLBACK_MESSAGE = "OnPlatformSdk_UserLogout"; static final int RC_REQUEST = 10001; private static final String TAG = "REKOO_SDK"; private static final String TRANSLATE_CALLBACK_MESSAGE = "OnPlatformSdk_AccountTranslateResult"; private static final String TRANSLATE_CODE_CALLBACK_MESSAGE = "OnPlatformSdk_GotAccountTranslateCode"; private static final String UNITY_OBJECT_NAME = "ICustomSdk"; private static final String fileAddressMac = "/sys/class/net/wlan0/address"; private static final String marshmallowMacAddress = "02:00:00:00:00:00"; private List<Purchase> consumeList = new ArrayList(); private String mAndroidAdvertiseID = null; private String mAndroidID = null; OnConsumeFinishedListener mConsumeFinishedListener = new OnConsumeFinishedListener() { public void onConsumeFinished(Purchase purchase, IabResult result) { Log.d(RekooMainActivity.TAG, "Consumption finished. Purchase: " + purchase + ", result: " + result); if (RekooMainActivity.this.mHelper != null) { if (result.isSuccess()) { Log.d(RekooMainActivity.TAG, "queryPurchases consume count: " + RekooMainActivity.this.queryPurchases.size()); RekooMainActivity.this.queryPurchases.remove(purchase); Log.d(RekooMainActivity.TAG, "queryPurchases consume after count: " + RekooMainActivity.this.queryPurchases.size()); if (RekooMainActivity.this.consumeList.size() > 0) { RekooMainActivity.this.mHelper.consumeAsync((Purchase) RekooMainActivity.this.consumeList.get(0), RekooMainActivity.this.mConsumeFinishedListener); RekooMainActivity.this.consumeList.remove(0); return; } return; } Log.d(RekooMainActivity.TAG, "Error while consuming: " + result); } } }; private Context mContext; QueryInventoryFinishedListener mGotInventoryListener = new QueryInventoryFinishedListener() { public void onQueryInventoryFinished(IabResult result, Inventory inventory) { Log.d(RekooMainActivity.TAG, "Query inventory finished."); if (RekooMainActivity.this.mHelper != null) { if (result.isFailure()) { Log.d(RekooMainActivity.TAG, "Failed to query inventory: " + result); return; } RekooMainActivity.this.queryPurchases.clear(); List<Purchase> purs = inventory.getAllPurchases(); Log.d(RekooMainActivity.TAG, "purchase size: " + purs.size()); for (int i = 0; i < purs.size(); i++) { RekooMainActivity.this.queryPurchases.add((Purchase) purs.get(i)); } Log.d(RekooMainActivity.TAG, "query purchase size: " + RekooMainActivity.this.queryPurchases.size()); Log.d(RekooMainActivity.TAG, "Query inventory was successful."); } } }; IabHelper mHelper; OnIabPurchaseFinishedListener mPurchaseFinishedListener = new OnIabPurchaseFinishedListener() { public void onIabPurchaseFinished(IabResult result, Purchase purchase) { Log.d(RekooMainActivity.TAG, "Purchase finished: " + result + ", purchase: " + purchase); if (RekooMainActivity.this.mHelper != null) { if (result.isFailure()) { Log.d(RekooMainActivity.TAG, "Error purchasing: " + result); } else if (RekooMainActivity.this.verifyDeveloperPayload(purchase)) { String purchase_data = new String(Base64.encode(purchase.getOriginalJson().getBytes(), 0)); Map<String, String> unitymsg = new HashMap(); purchase.getOrderId(); unitymsg.put("token", purchase_data); unitymsg.put(URLCons.SIGN, purchase.getSignature()); unitymsg.put("sku", purchase.getSku()); Log.d(RekooMainActivity.TAG, "token: " + purchase_data); Log.d(RekooMainActivity.TAG, "sign: " + purchase.getSignature()); RekooMainActivity.sendU3DMessage("OnPlatformSdk_GooglePayFinish", unitymsg); RekooMainActivity.this.queryPurchases.add(purchase); Log.d(RekooMainActivity.TAG, "Purchase successful."); } else { Log.d(RekooMainActivity.TAG, "Error purchasing. Authenticity verification failed."); } } } }; private RKUser mRkUser; private String mToken; private String mUid; private List<Purchase> queryPurchases = new ArrayList(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.mContext = this; this.mAndroidID = Secure.getString(getContentResolver(), "android_id"); new AsyncTask<Void, Void, String>() { protected String doInBackground(Void... params) { try { return AdvertisingIdClient.getAdvertisingIdInfo(RekooMainActivity.this.getApplicationContext()).getId(); } catch (Exception e) { e.printStackTrace(); return null; } } protected void onPostExecute(String advertId) { RekooMainActivity.this.mAndroidAdvertiseID = advertId; } }.execute(new Void[0]); String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzPnYbW0D/8e7qNtxV1iLCA3x9XhzFXDs3nJOJzbLO84E7qgM8HhX1eGVyKxBafdvEsFoUvhENNqfrEYVTgpDg/MaxieDMy7E5PEmQKEcC5YOcr9Js5Ji1ndkoEvF/uFzVar9P2BQZ+hThV1JK7lJ833Av8MlM9IqFMdycgCNlrh4nhHCfPDAqXf5uTOTTIkhlzCrurhBHOZebuNfmULLURvcznx7/0nyaopdOmLLE2nI0oI29Knzf89uRlLKWkRELjiupf3QAmHMLtvrk/54imahP6r/jL1fKEsubkHM54I4Q7A72oukh+llcUldKYqYvL7VaNs0G5ytV50QBXGgeQIDAQAB"; if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == 0) { Log.d(TAG, "Creating IAB helper."); this.mHelper = new IabHelper(this, base64EncodedPublicKey); this.mHelper.enableDebugLogging(true); Log.d(TAG, "Starting setup."); this.mHelper.startSetup(new OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { Log.d(RekooMainActivity.TAG, "Setup finished."); if (!result.isSuccess()) { Log.e(RekooMainActivity.TAG, "Problem setting up in-app billing: " + result); } else if (RekooMainActivity.this.mHelper != null) { Log.d(RekooMainActivity.TAG, "Setup successful. Querying inventory."); RekooMainActivity.this.mHelper.queryInventoryAsync(RekooMainActivity.this.mGotInventoryListener); } } }); } } public void googlePay(String productID) { Log.d(TAG, "GooglePay " + productID); String str = productID; this.mHelper.launchPurchaseFlow(this, str, RC_REQUEST, this.mPurchaseFinishedListener, ""); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data); if (this.mHelper != null) { if (this.mHelper.handleActivityResult(requestCode, resultCode, data)) { Log.d(TAG, "onActivityResult handled by IABUtil."); } else { super.onActivityResult(requestCode, resultCode, data); } } } void ConsumePurchase(String signature) { Log.d(TAG, "try consume queryPurchases: " + this.queryPurchases.size()); Log.d(TAG, "try consume signature: " + signature); for (int i = 0; i < this.queryPurchases.size(); i++) { Purchase purchase = (Purchase) this.queryPurchases.get(i); Log.d(TAG, "exist purchase token: " + purchase.getToken()); Log.d(TAG, "exist purchase sig: " + purchase.getSignature()); if (purchase.getSignature().equals(signature)) { Log.d(TAG, "consume sig: " + signature); if (this.mHelper.getAsyncInProgress().booleanValue()) { this.consumeList.add(purchase); } else { this.mHelper.consumeAsync(purchase, this.mConsumeFinishedListener); } } } } boolean verifyDeveloperPayload(Purchase p) { String payload = p.getDeveloperPayload(); return true; } public void Init() { Log.w(TAG, "INIT START! "); RKPlatformManager.getManager().rkInit(this, new RKLibInitCallback() { public void onInitSuccess() { Log.w(RekooMainActivity.TAG, "INIT Successed! "); UnityPlayer.UnitySendMessage(RekooMainActivity.UNITY_OBJECT_NAME, RekooMainActivity.INIT_CALLBACK_MESSAGE, ""); } public void onInitFailed(String msg) { Log.e(RekooMainActivity.TAG, "INIT FAILED! " + msg); UnityPlayer.UnitySendMessage(RekooMainActivity.UNITY_OBJECT_NAME, RekooMainActivity.INIT_CALLBACK_MESSAGE, msg); } }); } public void Login() { Log.w(TAG, "LOGIN START! "); RKPlatformManager.getManager().rkLogin(this.mContext, new RKLoginCallback() { public void onSuccess(RKUser user) { Log.w(RekooMainActivity.TAG, "LOGIN SUCCESS! "); RekooMainActivity.this.mRkUser = user; RekooMainActivity.this.mUid = user.getUid(); RekooMainActivity.this.mToken = user.getToken(); Map<String, String> msg = new HashMap(); msg.put("uid", RekooMainActivity.this.mUid); msg.put("token", RekooMainActivity.this.mToken); RekooMainActivity.sendU3DMessage(RekooMainActivity.LOGIN_CALLBACK_MESSAGE, msg); } public void onFail(String failMsg) { Log.w(RekooMainActivity.TAG, "LOGIN FAILED! " + failMsg); RekooMainActivity.sendU3DMessage(RekooMainActivity.LOGIN_CALLBACK_MESSAGE, new HashMap()); } public void onCancel() { Log.w(RekooMainActivity.TAG, "LOGIN CANCEL!"); RekooMainActivity.sendU3DMessage(RekooMainActivity.LOGIN_CALLBACK_MESSAGE, new HashMap()); } }); } public void Logout() { RKPlatformManager.getManager().rkLogout(this.mContext, new RKLogoutCallback() { public void onSuccess(String msg) { UnityPlayer.UnitySendMessage(RekooMainActivity.UNITY_OBJECT_NAME, RekooMainActivity.LOGOUT_CALLBACK_MESSAGE, ""); } public void onFail(String failMsg) { } }); } public void GetTransform() { RKPlatformManager.getManager().rkGetTransform(this, new ProduceTransformCallback() { public void onSuccess(ProduceTransform ptf) { String transid = ptf.getRktransid(); String uid = ptf.getRkuid(); String lasttime = ptf.getLasttime(); Map<String, String> msg = new HashMap(); msg.put("uid", uid); msg.put(URLCons.TRANSID, transid); msg.put("lasttime", lasttime); RekooMainActivity.sendU3DMessage(RekooMainActivity.TRANSLATE_CODE_CALLBACK_MESSAGE, msg); } public void onFailed() { UnityPlayer.UnitySendMessage(RekooMainActivity.UNITY_OBJECT_NAME, RekooMainActivity.TRANSLATE_CODE_CALLBACK_MESSAGE, ""); } }); } public void SetTransform(String trans) { RKPlatformManager.getManager().rkSetTransform(this, trans, new TransformCallback() { public void onSuccess(Transform transform) { String transid = transform.getRkTrans(); String newuid = transform.getNewUid(); String olduid = transform.getOldUid(); Map<String, String> msg = new HashMap(); msg.put("newuid", newuid); msg.put(URLCons.TRANSID, transid); msg.put("olduid", olduid); RekooMainActivity.sendU3DMessage(RekooMainActivity.TRANSLATE_CALLBACK_MESSAGE, msg); } public void onFail(int failed) { UnityPlayer.UnitySendMessage(RekooMainActivity.UNITY_OBJECT_NAME, RekooMainActivity.TRANSLATE_CALLBACK_MESSAGE, ""); } }); } public void ConsumeAllQuery() { Log.d(TAG, "consume query purchase size: " + this.queryPurchases.size()); for (int i = 0; i < this.queryPurchases.size(); i++) { Purchase pur = (Purchase) this.queryPurchases.get(i); Log.d(TAG, "consume query purchase sku: " + pur.getSku()); if (verifyDeveloperPayload(pur)) { String purchase_data = new String(Base64.encode(pur.getOriginalJson().getBytes(), 0)); Log.d(TAG, "Consumption successful. Provisioning."); Map<String, String> unitymsg = new HashMap(); pur.getOrderId(); unitymsg.put("token", purchase_data); unitymsg.put(URLCons.SIGN, pur.getSignature()); unitymsg.put("sku", pur.getSku()); Log.d(TAG, "token: " + purchase_data); Log.d(TAG, "sign: " + pur.getSignature()); sendU3DMessage("OnPlatformSdk_GooglePayFinish", unitymsg); } } } public void CloseFloat() { RKPlatformManager.getManager().rkShowCenter(this, false); } public void OpenFloat() { RKPlatformManager.getManager().rkShowCenter(this, true); } public void CopyToClipboard(final String str) { runOnUiThread(new Runnable() { public void run() { ((ClipboardManager) RekooMainActivity.this.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText(URLCons.TRANSID, str)); } }); } protected void onDestroy() { super.onDestroy(); RKPlatformManager.getManager().rkOnDestroy(this); finish(); System.exit(0); Process.killProcess(0); } protected void onPause() { super.onPause(); RKPlatformManager.getManager().rkOnPause(this); } protected void onResume() { super.onResume(); RKPlatformManager.getManager().rkOnResume(this); } private static void sendU3DMessage(String methodName, Map<String, String> hashMap) { String param = ""; if (hashMap != null) { for (Entry<String, String> entry : hashMap.entrySet()) { String key = (String) entry.getKey(); String val = (String) entry.getValue(); if (param.length() == 0) { param = new StringBuilder(String.valueOf(param)).append(String.format("%s{%s}", new Object[]{key, val})).toString(); } else { param = new StringBuilder(String.valueOf(param)).append(String.format("&%s{%s}", new Object[]{key, val})).toString(); } } } UnityPlayer.UnitySendMessage(UNITY_OBJECT_NAME, methodName, param); } public String GetAndroidID() { if (this.mAndroidID != null) { return this.mAndroidID; } return ""; } public String GetAndroidAdvID() { if (this.mAndroidAdvertiseID != null) { return this.mAndroidAdvertiseID; } return ""; } public String GetModel() { try { return Build.MODEL; } catch (Exception e) { e.printStackTrace(); return ""; } } public String GetVersion() { try { return VERSION.RELEASE; } catch (Exception e) { e.printStackTrace(); return ""; } } public String GetImei() { return ""; } public String recupAdresseMAC() { try { WifiManager wifiMan = (WifiManager) getSystemService("wifi"); WifiInfo wifiInf = wifiMan.getConnectionInfo(); if (!wifiInf.getMacAddress().equals(marshmallowMacAddress)) { return wifiInf.getMacAddress(); } try { String ret = getAdressMacByInterface(); if (ret != null) { return ret; } return getAddressMacByFile(wifiMan); } catch (IOException e) { Log.e("MobileAccess", "Erreur lecture propriete Adresse MAC1"); return marshmallowMacAddress; } catch (Exception e2) { Log.e("MobileAcces", "Erreur lecture propriete Adresse MAC2 "); return marshmallowMacAddress; } } catch (Exception e3) { Log.e("MobileAcces", "Erreur lecture propriete Adresse MAC 3"); return marshmallowMacAddress; } } private static String getAdressMacByInterface() { try { for (NetworkInterface nif : Collections.list(NetworkInterface.getNetworkInterfaces())) { if (nif.getName().equalsIgnoreCase("wlan0")) { byte[] macBytes = nif.getHardwareAddress(); if (macBytes == null) { return ""; } StringBuilder res1 = new StringBuilder(); int length = macBytes.length; for (int i = 0; i < length; i++) { res1.append(String.format("%02X:", new Object[]{Byte.valueOf(macBytes[i])})); } if (res1.length() > 0) { res1.deleteCharAt(res1.length() - 1); } return res1.toString(); } } } catch (Exception e) { Log.e("MobileAcces", "Erreur lecture propriete Adresse MAC4 "); } return null; } private static String getAddressMacByFile(WifiManager wifiMan) throws Exception { boolean enabled = true; int wifiState = wifiMan.getWifiState(); wifiMan.setWifiEnabled(true); FileInputStream fin = new FileInputStream(new File(fileAddressMac)); String ret = crunchifyGetStringFromStream(fin); fin.close(); if (3 != wifiState) { enabled = false; } wifiMan.setWifiEnabled(enabled); return ret; } private static String crunchifyGetStringFromStream(InputStream crunchifyStream) throws IOException { if (crunchifyStream == null) { return "No Contents"; } Writer crunchifyWriter = new StringWriter(); char[] crunchifyBuffer = new char[2048]; try { Reader crunchifyReader = new BufferedReader(new InputStreamReader(crunchifyStream, "UTF-8")); while (true) { int counter = crunchifyReader.read(crunchifyBuffer); if (counter == -1) { break; } crunchifyWriter.write(crunchifyBuffer, 0, counter); } return crunchifyWriter.toString(); } finally { crunchifyStream.close(); } } public String GetAndroidMac() { try { return recupAdresseMAC(); } catch (Exception e) { e.printStackTrace(); return ""; } } public String GetLocalIp() { try { for (NetworkInterface intf : Collections.list(NetworkInterface.getNetworkInterfaces())) { for (InetAddress addr : Collections.list(intf.getInetAddresses())) { if (!addr.isLoopbackAddress()) { return addr.getHostAddress(); } } } } catch (Exception e) { } return ""; } public String GetCarrier() { try { return ((TelephonyManager) getSystemService("phone")).getSimOperatorName(); } catch (Exception e) { e.printStackTrace(); return ""; } } public String GetNetworkType() { String strNetworkType = ""; try { NetworkInfo networkInfo = ((ConnectivityManager) getSystemService("connectivity")).getActiveNetworkInfo(); if (networkInfo == null || !networkInfo.isConnected()) { return strNetworkType; } if (networkInfo.getType() == 1) { return "WIFI"; } if (networkInfo.getType() != 0) { return strNetworkType; } String _strSubTypeName = networkInfo.getSubtypeName(); Log.e("cocos2d-x", "Network getSubtypeName : " + _strSubTypeName); switch (networkInfo.getSubtype()) { case 1: case 2: case 4: case 7: case 11: return "2G"; case 3: case 5: case 6: case 8: case 9: case 10: case 12: case 14: case 15: return "3G"; case 13: return "4G"; default: if (_strSubTypeName.equalsIgnoreCase("TD-SCDMA") || _strSubTypeName.equalsIgnoreCase("WCDMA") || _strSubTypeName.equalsIgnoreCase("CDMA2000")) { return "3G"; } return _strSubTypeName; } } catch (Exception e) { e.printStackTrace(); return strNetworkType; } } }
1ac2d1c84b4b62be5f24c0d496d0e724ad54a6c6
2de44f3f7147fd47daa177f9ac6a394f7ff1ddeb
/src/casteel/game/anime/AnimeMonopoly.java
807f50fc5c1b73dea66b9f012cb77b9cc3bab07b
[]
no_license
Tokijin/Java-Mono
8c9decdede20c9b9335c92b1d03c95e3d0c9bcb1
d22f745e207d3e21a9ed2e24ae0fe9736aadf1d7
refs/heads/master
2021-01-13T01:50:35.717874
2015-09-12T05:19:41
2015-09-12T05:19:41
42,345,838
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package casteel.game.anime; public class AnimeMonopoly { static Board gameboard; static AnimeMonopolyGUI GUI; /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub GUI = new AnimeMonopolyGUI(); } }
e196a79512ea3e04888f52211e3e71f6107ae991
917db8df16c37dbbe020d10891ac9d0c8d9eaf53
/process-transaction/src/main/java/vn/vnpay/process/configuration/realoadable/ReloadableProperties.java
d6751a714dbe97e0059c4871536421f0cee602b2
[]
no_license
zovivo/demo-payment
1deda01fc5ab8e44edd163185bbd683122b7b0dc
3059f4392deaef4fd4873ebae29f4807d5a1c305
refs/heads/master
2023-07-18T17:17:16.810901
2021-09-10T07:51:07
2021-09-10T07:51:07
392,620,354
0
1
null
null
null
null
UTF-8
Java
false
false
1,870
java
package vn.vnpay.process.configuration.realoadable; import org.apache.commons.configuration.PropertiesConfiguration; import vn.vnpay.process.exception.PropertiesException; import javax.naming.OperationNotSupportedException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.util.Properties; /** * Project: demo-payment * Package: vn.vnpay.preprocess.configuration * Author: zovivo * Date: 8/18/2021 * Created with IntelliJ IDEA */ public class ReloadableProperties extends Properties { private PropertiesConfiguration propertiesConfiguration; public ReloadableProperties(PropertiesConfiguration propertiesConfiguration) throws IOException { super.load(new FileReader(propertiesConfiguration.getFile())); this.propertiesConfiguration = propertiesConfiguration; } @Override public synchronized Object setProperty(String key, String value) { propertiesConfiguration.setProperty(key, value); return super.setProperty(key, value); } @Override public String getProperty(String key) { String val = propertiesConfiguration.getString(key); super.setProperty(key, val); return val; } @Override public String getProperty(String key, String defaultValue) { String val = propertiesConfiguration.getString(key, defaultValue); super.setProperty(key, val); return val; } @Override public synchronized void load(Reader reader) throws IOException { throw new PropertiesException(new OperationNotSupportedException()); } @Override public synchronized void load(InputStream inStream) throws IOException { throw new PropertiesException(new OperationNotSupportedException()); } }
fc663074a4c7f2d9dfae0c957c9fad97dcaf5e66
b2b5f2ace02905d4cecf51f5b2c1d596e3cfc944
/src/main/java/com/example/springMarket2/servicios/PreguntaServicio.java
7102b8822524650ac32a730a8799d45b265aa64a
[]
no_license
AlexValero5/springMarket2
42d9d102f969d26656942f66e6b765278ba7e0c3
066abcf0a187c4bee7d7e9cd466fd27d85415e4d
refs/heads/master
2023-05-31T07:52:51.298204
2021-06-16T10:53:57
2021-06-16T10:53:57
356,052,978
0
0
null
null
null
null
UTF-8
Java
false
false
319
java
package com.example.springMarket2.servicios; import com.example.springMarket2.entidades.Pregunta; public interface PreguntaServicio { public Pregunta crearPregunta(String pregunta,Long idUsuario,Long idProducto) ; public Pregunta obtenerPregunta(Long id); public void borrarPregunta(Long idPregunta); }
6147f93ae9541905fe475569855ef8021da2f737
ff6b3b86407122cf04c6e9fab3d819498058390c
/src/main/java/proyecto/hdp/Usuario.java
216629552deb1ce9044a29e12f890bd71a34a88b
[]
no_license
EfrainMD/final-geolocalizacion
25da0c6f0d0491effc6c36e877219c82df611810
670a3090738c0c364db28438bfb7351947b20138
refs/heads/master
2020-03-08T07:21:44.756275
2018-04-07T02:42:59
2018-04-07T02:42:59
127,991,825
0
0
null
null
null
null
UTF-8
Java
false
false
1,753
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.hdp; import java.util.ArrayList; import org.springframework.data.annotation.Id; /** * * @author T-107 */ public class Usuario { @Id String id; String nickname; String email; String password; ArrayList <Mensaje> mensaje; Posicion posicion; public Usuario(String id, String nickname, String email, String password, ArrayList<Mensaje> mensaje, Posicion posicion) { this.id = id; this.nickname = nickname; this.email = email; this.password = password; this.mensaje = mensaje; this.posicion = posicion; } public Usuario(Posicion posicion) { this.posicion = posicion; } public Usuario(String id, String nickname, String email, String password) { this.id = id; this.nickname = nickname; this.email = email; this.password = password; } Usuario() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "T-107@PC193" ]
T-107@PC193
70c39b86e2e2d8f9c1f43ef67626349529be9089
b44479ca3ff1f0bc630695bc2ace2105fd56c36b
/my_mybatis/src/main/java/org/demon/mybatis/utils/XMLConfigBuilder.java
bdd635f3c59559b6b2ab7bf2dab8b093c5188540
[]
no_license
qj118/mybatis_demo
02e34fcb800096cdaa2ca9e4ad5849bf5bb1d3d9
5af9740a5c894bd1b8a84af561bcfbd1f71a0a7a
refs/heads/master
2022-12-14T21:24:34.815349
2020-09-16T06:18:21
2020-09-16T06:18:21
289,183,612
0
0
null
null
null
null
UTF-8
Java
false
false
9,488
java
package org.demon.mybatis.utils; import org.demon.mybatis.annotations.Select; import org.demon.mybatis.config.Configuration; import org.demon.mybatis.config.Mapper; import org.demon.mybatis.io.Resources; import org.dom4j.Attribute; import org.dom4j.Document; import org.dom4j.Element; import org.dom4j.io.SAXReader; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author 黑马程序员 * @Company http://www.ithiema.com * 用于解析配置文件 */ public class XMLConfigBuilder { /** * 解析主配置文件,把里面的内容填充到DefaultSqlSession所需要的地方 * 使用的技术: * dom4j+xpath */ public static Configuration loadConfiguration(InputStream config){ try{ //定义封装连接信息的配置对象(mybatis的配置对象) Configuration cfg = new Configuration(); //1.获取SAXReader对象 SAXReader reader = new SAXReader(); //2.根据字节输入流获取Document对象 Document document = reader.read(config); //3.获取根节点 Element root = document.getRootElement(); //4.使用xpath中选择指定节点的方式,获取所有property节点 List<Element> propertyElements = root.selectNodes("//property"); //5.遍历节点 for(Element propertyElement : propertyElements){ //判断节点是连接数据库的哪部分信息 //取出name属性的值 String name = propertyElement.attributeValue("name"); if("driver".equals(name)){ //表示驱动 //获取property标签value属性的值 String driver = propertyElement.attributeValue("value"); cfg.setDriver(driver); } if("url".equals(name)){ //表示连接字符串 //获取property标签value属性的值 String url = propertyElement.attributeValue("value"); cfg.setUrl(url); } if("username".equals(name)){ //表示用户名 //获取property标签value属性的值 String username = propertyElement.attributeValue("value"); cfg.setUsername(username); } if("password".equals(name)){ //表示密码 //获取property标签value属性的值 String password = propertyElement.attributeValue("value"); cfg.setPassword(password); } } //取出mappers中的所有mapper标签,判断他们使用了resource还是class属性 List<Element> mapperElements = root.selectNodes("//mappers/mapper"); //遍历集合 for(Element mapperElement : mapperElements){ //判断mapperElement使用的是哪个属性 Attribute attribute = mapperElement.attribute("resource"); if(attribute != null){ System.out.println("使用的是XML"); //表示有resource属性,用的是XML //取出属性的值 String mapperPath = attribute.getValue();//获取属性的值"com/itheima/dao/IUserDao.xml" //把映射配置文件的内容获取出来,封装成一个map Map<String,Mapper> mappers = loadMapperConfiguration(mapperPath); //给configuration中的mappers赋值 cfg.setMappers(mappers); }else{ System.out.println("使用的是注解"); //表示没有resource属性,用的是注解 //获取class属性的值 String daoClassPath = mapperElement.attributeValue("class"); //根据daoClassPath获取封装的必要信息 Map<String,Mapper> mappers = loadMapperAnnotation(daoClassPath); //给configuration中的mappers赋值 cfg.setMappers(mappers); } } //返回Configuration return cfg; }catch(Exception e){ throw new RuntimeException(e); }finally{ try { config.close(); }catch(Exception e){ e.printStackTrace(); } } } /** * 根据传入的参数,解析XML,并且封装到Map中 * @param mapperPath 映射配置文件的位置 * @return map中包含了获取的唯一标识(key是由dao的全限定类名和方法名组成) * 以及执行所需的必要信息(value是一个Mapper对象,里面存放的是执行的SQL语句和要封装的实体类全限定类名) */ private static Map<String, Mapper> loadMapperConfiguration(String mapperPath)throws IOException { InputStream in = null; try{ //定义返回值对象 Map<String,Mapper> mappers = new HashMap<String,Mapper>(); //1.根据路径获取字节输入流 in = Resources.getResourceAsStream(mapperPath); //2.根据字节输入流获取Document对象 SAXReader reader = new SAXReader(); Document document = reader.read(in); //3.获取根节点 Element root = document.getRootElement(); //4.获取根节点的namespace属性取值 String namespace = root.attributeValue("namespace");//是组成map中key的部分 //5.获取所有的select节点 List<Element> selectElements = root.selectNodes("//select"); //6.遍历select节点集合 for(Element selectElement : selectElements){ //取出id属性的值 组成map中key的部分 String id = selectElement.attributeValue("id"); //取出resultType属性的值 组成map中value的部分 String resultType = selectElement.attributeValue("resultType"); //取出文本内容 组成map中value的部分 String queryString = selectElement.getText(); //创建Key String key = namespace+"."+id; //创建Value Mapper mapper = new Mapper(); mapper.setQueryString(queryString); mapper.setResultType(resultType); //把key和value存入mappers中 mappers.put(key,mapper); } return mappers; }catch(Exception e){ throw new RuntimeException(e); }finally{ in.close(); } } /** * 根据传入的参数,得到dao中所有被select注解标注的方法。 * 根据方法名称和类名,以及方法上注解value属性的值,组成Mapper的必要信息 * @param daoClassPath * @return */ private static Map<String,Mapper> loadMapperAnnotation(String daoClassPath)throws Exception{ //定义返回值对象 Map<String,Mapper> mappers = new HashMap<String, Mapper>(); //1.得到dao接口的字节码对象 Class daoClass = Class.forName(daoClassPath); //2.得到dao接口中的方法数组 Method[] methods = daoClass.getMethods(); //3.遍历Method数组 for(Method method : methods){ //取出每一个方法,判断是否有select注解 boolean isAnnotated = method.isAnnotationPresent(Select.class); if(isAnnotated){ //创建Mapper对象 Mapper mapper = new Mapper(); //取出注解的value属性值 Select selectAnno = method.getAnnotation(Select.class); String queryString = selectAnno.value(); mapper.setQueryString(queryString); //获取当前方法的返回值,还要求必须带有泛型信息 Type type = method.getGenericReturnType();//List<User> //判断type是不是参数化的类型 if(type instanceof ParameterizedType){ //强转 ParameterizedType ptype = (ParameterizedType)type; //得到参数化类型中的实际类型参数 Type[] types = ptype.getActualTypeArguments(); //取出第一个 Class domainClass = (Class)types[0]; //获取domainClass的类名 String resultType = domainClass.getName(); //给Mapper赋值 mapper.setResultType(resultType); } //组装key的信息 //获取方法的名称 String methodName = method.getName(); String className = method.getDeclaringClass().getName(); String key = className+"."+methodName; //给map赋值 mappers.put(key,mapper); } } return mappers; } }
f26a4f87c3aa47aa5e32d2b11349a0f8e1ad8a2e
592a749d4be7b23b1fc5d1ec13a9052c3814cf96
/src/com/edu/bean/ExemptionBean.java
a2bd4fcb2be1d7e83cc4d70ac831bf60003d44a1
[]
no_license
panawe/edu
b9fddff2beec88631a9b039aa99ef57962f5998a
79b55b36e5c058bd089be180750ad0409ae139da
refs/heads/master
2021-01-13T08:05:59.686732
2016-10-24T02:37:17
2016-10-24T02:37:17
71,744,692
0
0
null
null
null
null
UTF-8
Java
false
false
6,111
java
package com.edu.bean; import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; import com.edu.model.BaseEntity; import com.edu.model.Course; import com.edu.model.Exemption; import com.edu.model.Student; import com.edu.model.StudentEnrollment; import com.edu.model.Teacher; import com.edu.service.ExamService; @Component("exemptionBean") @Scope("session") public class ExemptionBean extends BaseBean { @Autowired @Qualifier("examService") private ExamService examService; private Long rowCount; private List<BaseEntity> exemptions; private String levelClassName; private String subjectName; private Teacher teacher; private Double random; private List<String> subjectsForLevel = new ArrayList<String>(); private Exemption exemption = new Exemption(); public String validate() { return "succes"; } public List<String> getSubjectsForLevel() { return subjectsForLevel; } public void setSubjectsForLevel(List<String> subjectsForLevel) { this.subjectsForLevel = subjectsForLevel; } @Override public String clear() { exemption = new Exemption(); return "Success"; } @PostConstruct public String getAll() { if(getSessionParameter("currentStudentId")!=null){ exemptions = examService.loadAllByParentId(Exemption.class, "student", "id", new Long(getSessionParameter("currentStudentId").toString())); setRowCount(new Long(exemptions.size())); } return "Success"; } public String delete() { clearMessages(); try { examService.delete(getIdParameter(), Exemption.class); getAll(); clear(); setSuccessMessage(getResourceBundle().getString("DELETE_SUCCESSFULLY")); } catch (Exception ex) { setErrorMessage(getResourceBundle().getString("DELETE_UNSUCCESSFULL")); } return "Success"; } public String fetchTeacher() { teacher = null; random = Math.random(); Student student = (Student) examService.getById(Student.class, new Long(getSessionParameter("currentStudentId").toString())); StudentEnrollment studentEnrollment = student.getCurrentEnrollment(); if(studentEnrollment!=null) levelClassName = studentEnrollment.getLevelClass().getName(); if (levelClassName != null && subjectName != null) { List<Teacher> teachers = examService.getTeacher(levelClassName, subjectName); for (Teacher t : teachers) { teacher = t; } } return "Success"; } @Override public void paint(OutputStream stream, Object object) throws IOException { if (teacher != null) { stream.write(teacher.getImage()); } else { stream.write(new byte[] {}); } } public String insert() { clearMessages(); Long id = exemption.getId(); try { Student student = (Student) examService.getById(Student.class, new Long(getSessionParameter("currentStudentId").toString())); exemption.setStudent(student); StudentEnrollment studentEnrollment = student.getCurrentEnrollment(); Course course = examService.getCourse(studentEnrollment.getLevelClass().getName(), subjectName); if (course == null) { setErrorMessage("Le cours choisit n'est pas dispense dans la classe choisie"); return "Error"; } exemption.setCourse(course); exemption.setExemptionReasonId(1); if (id == null || id == 0) examService.save(exemption,getCurrentUser()); else examService.update(exemption,getCurrentUser()); setSuccessMessage(getResourceBundle().getString("SAVED_SUCCESSFULLY")); } catch (Exception ex) { exemption.setId(id); setErrorMessage(ex,"Cette exemption exist deja. "); } clear(); getAll(); return "Success"; } public String edit() { clearMessages(); exemption = (Exemption) examService.getById(Exemption.class, getIdParameter()); //setCourseName(courseName); return "Success"; } public ExamService getExamService() { return examService; } public void setExamService(ExamService examService) { this.examService = examService; } public Long getRowCount() { return rowCount; } public void setRowCount(Long rowCount) { this.rowCount = rowCount; } public String getAllExemptions() { if(getSessionParameter("currentStudentId")!=null){ exemptions = examService.loadAllByParentId(Exemption.class, "student", "id", new Long(getSessionParameter("currentStudentId").toString())); Student student = (Student) examService.getById(Student.class, new Long(getSessionParameter("currentStudentId").toString())); StudentEnrollment studentEnrollment = student.getCurrentEnrollment(); if(studentEnrollment!=null){ subjectsForLevel= examService.getSubjectsForLevel(studentEnrollment.getLevelClass()); } setRowCount(new Long(exemptions.size())); } return "Success"; } public List<BaseEntity> getExemptions() { return exemptions; } public void setExemptions(List<BaseEntity> exemptions) { this.exemptions = exemptions; } public String getLevelClassName() { return levelClassName; } public void setLevelClassName(String levelClassName) { this.levelClassName = levelClassName; } public Exemption getExemption() { return exemption; } public void setExemption(Exemption exemption) { this.exemption = exemption; } public String getSubjectName() { return subjectName; } public void setSubjectName(String subjectName) { this.subjectName = subjectName; } public Teacher getTeacher() { return teacher; } public void setTeacher(Teacher teacher) { this.teacher = teacher; } @Override public Double getRandom() { return random; } @Override public void setRandom(Double random) { this.random = random; } }
fe52b9a050d31fd885e906492e46002e0f8867c0
eb00adb15132c0d7fea1d4dd99a91312790a42ba
/java_call_cpp/code/java-demo/src/main/java/mark/java_demo/Example22CallbackImplementation.java
69849fdc853988d7aeab32bf3523831f07904b78
[]
no_license
peoffice/my_java_way
d40959a9c96494b9b66ea552a1a65091bb716f0f
2a3137153f13ca0622b9c7bcc3437c06f469c26c
refs/heads/master
2020-04-05T03:34:11.211728
2019-01-25T06:52:25
2019-01-25T06:52:25
156,519,592
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package mark.java_demo; public class Example22CallbackImplementation implements Example22CallbackInterface { @Override public void invoke(int val) { // TODO Auto-generated method stub System.out.println("example:"+val); } }
031e84af425ec6969ba584f90ace354757c33fe8
f960a4235fcf5cabd904b076d65687457c1988c6
/flexmark-ext-jekyll-front-matter/src/main/java/com/vladsch/flexmark/ext/jekyll/front/matter/JekyllFrontMatterVisitorExt.java
3f6592f3bd9641e68e47fed5a7cd81f3bdfdca7d
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Genato/flexmark-java
4fba22d1043ad562ffd4a0f604fb36f06979fdad
9cedd42ab8439fff84ecdd26272a91543e760005
refs/heads/master
2021-01-12T07:19:13.903292
2016-12-20T09:27:42
2016-12-20T09:27:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.vladsch.flexmark.ext.jekyll.front.matter; import com.vladsch.flexmark.ast.VisitHandler; import com.vladsch.flexmark.ast.Visitor; public class JekyllFrontMatterVisitorExt { static <V extends JekyllFrontMatterVisitor> VisitHandler<?>[] VISIT_HANDLERS(final V visitor) { return new VisitHandler<?>[] { new VisitHandler<>(JekyllFrontMatterBlock.class, new Visitor<JekyllFrontMatterBlock>() { @Override public void visit(JekyllFrontMatterBlock node) { visitor.visit(node); } }), }; } }
5bfbc4b340355f48804638bf1ab1db9a511a3b60
1b19195da03874fbac09a8055380f6c603e8a936
/app/src/main/java/com/epsilon/coders/phms/activities/MyProfileActivity.java
5bb18e8deabf97708a5472d40ebb6ae39a7543ef
[]
no_license
raufur/PHMS
861ca9f12242dcf02bcd4975def482cdf59e39a9
8b367077311010d971600dbdc645d619ebc82dbb
refs/heads/master
2021-01-10T05:00:34.864070
2016-02-02T10:21:31
2016-02-02T10:21:31
50,912,516
0
0
null
null
null
null
UTF-8
Java
false
false
12,289
java
package com.epsilon.coders.phms.activities; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.epsilon.coders.phms.R; import com.epsilon.coders.phms.databases.ProfileDataSource; import com.epsilon.coders.phms.model.Profile; import com.epsilon.coders.phms.utills.AgeCalculator; /** * Created by nilima on 10/16/2015. */ public class MyProfileActivity extends AppCompatActivity { TextView name,age,dateofBirth,bloodGroup,height,weight,specialNotes; Button editBtn; Profile mUpdateProfile; // Button updateProfile ; // Button home_btn ; // EditText et_name = null; // EditText et_age = null; // EditText etBloodGroup = null; // EditText et_weight = null; // EditText et_height = null; // EditText et_dateOfBirth = null; // EditText et_specialNotes = null; // ImageView btnImage; Toast toast = null; // // String mName = ""; // String mAge = ""; // String mBloodGroup = ""; // String mWeight = ""; // String mHeight = ""; // String mDateOfBirth; // String mSpecialNotes = ""; // byte[] image; // // Profile mUpdateProfile = null; ProfileDataSource mDataSource = null; private int startYear=1980; private int startMonth=6; private int startDay=15; /// add new AgeCalculator ageCal2; static final int DATE_START_DIALOG_ID = 0; private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_profile); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ageCal2=new AgeCalculator(); // // // // init(); // //// home_btn.setOnClickListener(new View.OnClickListener() { //// @Override //// public void onClick(View v) { //// displayView(); //// //// //// } //// }); // // //return view; // } private void init() { name=(TextView)findViewById(R.id.viewName); age=(TextView)findViewById(R.id.viewAge); dateofBirth=(TextView)findViewById(R.id.viewDOB); bloodGroup=(TextView)findViewById(R.id.viewBloodGroup); height=(TextView)findViewById(R.id.viewHeight); weight=(TextView)findViewById(R.id.viewHeight); specialNotes=(TextView)findViewById(R.id.viewSpComment); editBtn=(Button)findViewById(R.id.updateProfile); mUpdateProfile=new Profile(); mDataSource = new ProfileDataSource(this); mUpdateProfile = mDataSource.singleProfileData(); String mName = ""; String mAge = ""; String mEyeColor = ""; String mWeight = ""; String mHeight = ""; String mDateOfBirth = ""; String mSpecialNotes = ""; byte[] image=null; if(mUpdateProfile !=null ) { mName = mUpdateProfile.getName(); // mAge = mUpdateProfile.getAge(); mEyeColor = mUpdateProfile.getBloodGroup(); mWeight = mUpdateProfile.getWeight(); mHeight = mUpdateProfile.getHeight(); mDateOfBirth = mUpdateProfile.getDateOfBirth(); mSpecialNotes = mUpdateProfile.getSpecialNotes(); image=mUpdateProfile.getImage(); } // // // Add the line mAge=ageCal2.calAge(mDateOfBirth); // set the value of database to the text field. name.setText(mName); age.setText(mAge); bloodGroup.setText(mEyeColor); weight.setText(mWeight); height.setText(mHeight); dateofBirth.setText(mDateOfBirth); specialNotes.setText(mSpecialNotes); // dateofBirth.setOnClickListener(this); editBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(MyProfileActivity.this,ProfilePreviewUpdate.class); startActivity(intent); } }); // // set the textfield id to the variable. // et_name = (EditText) findViewById(R.id.viewName); // et_age = (EditText) findViewById(R.id.viewAge); // etBloodGroup = (EditText) findViewById(R.id.viewBloodGroup); // et_weight = (EditText) findViewById(R.id.viewWeight); // et_height = (EditText) findViewById(R.id.viewHeight); // et_dateOfBirth = (EditText) findViewById(R.id.viewDOB); // et_specialNotes = (EditText) findViewById(R.id.viewSpComment); // btnImage=(ImageView) findViewById(R.id.imageViewCreate); // updateProfile = (Button) findViewById(R.id.updateProfile); // updateProfile.setOnClickListener(mCorkyListener); // //home_btn = (Button) view.findViewById(R.id.buttonHome); // // // * get the profile which include all data from database according // * profileId of the clicked item. // // mDataSource = new ProfileDataSource(this); // mUpdateProfile = mDataSource.singleProfileData(); // // String mName = mUpdateProfile.getName(); // String mAge2 = mUpdateProfile.getAge(); // String mEyeColor = mUpdateProfile.getBloodGroup(); // String mWeight = mUpdateProfile.getWeight(); // String mHeight = mUpdateProfile.getHeight(); // mDateOfBirth = mUpdateProfile.getDateOfBirth(); // String mSpecialNotes = mUpdateProfile.getSpecialNotes(); // image=mUpdateProfile.getImage(); // // // Add the line // mAge=ageCal2.calAge(mDateOfBirth); // // // set the value of database to the text field. // et_name.setText(mName); // et_age.setText(mAge); // etBloodGroup.setText(mEyeColor); // et_weight.setText(mWeight); // et_height.setText(mHeight); // et_dateOfBirth.setText(mDateOfBirth); // et_specialNotes.setText(mSpecialNotes); // et_dateOfBirth.setOnClickListener(this); } // private View.OnClickListener mCorkyListener = new View.OnClickListener() { // public void onClick(View v) { // mName = et_name.getText().toString(); // mAge = et_age.getText().toString(); // mBloodGroup = etBloodGroup.getText().toString(); // mWeight = et_weight.getText().toString(); // mHeight = et_height.getText().toString(); // mDateOfBirth = et_dateOfBirth.getText().toString(); // mSpecialNotes = et_specialNotes.getText().toString(); // // // Assign values in the ICareProfile // Profile profileDataInsert = new Profile(); // profileDataInsert.setName(mName); // profileDataInsert.setAge(mAge); // profileDataInsert.setBloodGroup(mBloodGroup); // profileDataInsert.setWeight(mWeight); // profileDataInsert.setHeight(mHeight); // profileDataInsert.setDateOfBirth(mDateOfBirth); // profileDataInsert.setSpecialNotes(mSpecialNotes); // // mDataSource = new ProfileDataSource(getBaseContext()); // // if (mDataSource.updateData(1, profileDataInsert) == true) { // toast = Toast.makeText(MyProfileActivity.this, // getString(R.string.successfullyUpdated), Toast.LENGTH_LONG); // toast.show(); // //displayView(); // // } else { // toast = Toast.makeText(MyProfileActivity.this, getString(R.string.notUpdated), // Toast.LENGTH_LONG); // toast.show(); // } // } // }; // //// private void displayView() { //// // update the main content by replacing fragments //// Fragment fragment = null; //// //// fragment = new Fragment_Home(); //// if (fragment != null) { //// FragmentManager fragmentManager = getFragmentManager(); //// fragmentManager.beginTransaction() //// .replace(R.id.frame_container, fragment).commit(); //// //// //// } //// } // // // @Override // public void onClick(View v) { // switch (v.getId()) { // case R.id.viewDOB: // this.showDialog(DATE_START_DIALOG_ID); // break; // // default: // break; // } // // } // // // @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // super.onActivityResult(requestCode, resultCode, data); // if (resultCode == RESULT_OK) { // if (requestCode == 0) { // Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); // ByteArrayOutputStream bytes = new ByteArrayOutputStream(); // thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, bytes); // File destination = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg"); // FileOutputStream fo; // try { // destination.createNewFile(); // fo = new FileOutputStream(destination); // fo.write(bytes.toByteArray()); // fo.close(); // } catch (FileNotFoundException e) { // e.printStackTrace(); // } catch (IOException e) { // e.printStackTrace(); // } // btnImage.setImageBitmap(thumbnail); // } else if (requestCode == 1) { // Uri selectedImageUri = data.getData(); // String[] projection = {MediaStore.MediaColumns.DATA}; // Cursor cursor = managedQuery(selectedImageUri, projection, null, null, null); // int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); // cursor.moveToFirst(); // String selectedImagePath = cursor.getString(column_index); // Bitmap bm; // BitmapFactory.Options options = new BitmapFactory.Options(); // options.inJustDecodeBounds = true; // BitmapFactory.decodeFile(selectedImagePath, options); // final int REQUIRED_SIZE = 200; // int scale = 1; // while (options.outWidth / scale / 2 >= REQUIRED_SIZE && options.outHeight / scale / 2 >= REQUIRED_SIZE) // scale *= 2; // options.inSampleSize = scale; // options.inJustDecodeBounds = false; // bm = BitmapFactory.decodeFile(selectedImagePath, options); // btnImage.setImageBitmap(bm); // ByteArrayOutputStream stream = new ByteArrayOutputStream(); // bm.compress(Bitmap.CompressFormat.PNG, 100, stream); // image = stream.toByteArray(); // // } // } // } // // // protected Dialog onCreateDialog(int id) { // switch (id) { // case DATE_START_DIALOG_ID: // return new DatePickerDialog(this, // mDateSetListener, // startYear, startMonth, startDay); // } // return null; // } // // private DatePickerDialog.OnDateSetListener mDateSetListener // = new DatePickerDialog.OnDateSetListener() { // public void onDateSet(DatePicker view, int selectedYear, // int selectedMonth, int selectedDay) { // startYear=selectedYear; // startMonth=selectedMonth; // startDay=selectedDay; // // et_dateOfBirth.setText(""+selectedDay+":"+(startMonth+1)+":"+startYear); // // } // }; @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } } }
696d04279ab8fd6ad29653fc4a229483aa2e6ac4
37dc2c24f18deaa0ae253e5bba96d7c9f7c00cbd
/Encrypt using Armstrong number/Main.java
deb0891215737de272915593d765644a721a3f84
[]
no_license
Austin70/Playground
05aef70ab3d4efcbee2eefc39b6d3622a062864e
9d48282039dbb29f95ac6cd8adba13fb558a447a
refs/heads/master
2022-09-15T02:40:55.844926
2020-05-29T17:36:38
2020-05-29T17:36:38
258,428,519
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
#include<iostream> int power(int m,int n) { int j,i; for(i=1,j=1;i<=n;i++) j=j*m; return j; } int arm(int n) {int s=0,z=3; if(n==1634) z=4; for(int a=n;a!=0;a=a/10) { s+=power(a%10,z); } if(s==n) return 1; else return 0; //Your code goes here } int main() { int n; std::cin>>n; if(arm(n)==1) std::cout<<"Kindly proceed with encrypting"; else std::cout<<"It is not an Armstrong number"; }
34ad12b6e710fd855fc3bd7aba1fdf161dfc4f12
ba55269057e8dc503355a26cfab3c969ad7eb278
/POSNGlobalORM/src/com/nirvanaxp/global/types/entities/DriverOrder_.java
dcd5378fe8329ee6bce86bb6ed8efc53630ac173
[ "Apache-2.0" ]
permissive
apoorva223054/SF3
b9db0c86963e549498f38f7e27f65c45438b2a71
4dab425963cf35481d2a386782484b769df32986
refs/heads/master
2022-03-07T17:13:38.709002
2020-01-29T05:19:06
2020-01-29T05:19:06
236,907,773
0
0
Apache-2.0
2022-02-09T22:46:01
2020-01-29T05:10:51
Java
UTF-8
Java
false
false
2,042
java
package com.nirvanaxp.global.types.entities; import java.util.Date; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="Dali", date="2019-03-26T17:35:28.175+0530") @StaticMetamodel(DriverOrder.class) public class DriverOrder_ { public static volatile SingularAttribute<DriverOrder, Integer> id; public static volatile SingularAttribute<DriverOrder, String> orderNumber; public static volatile SingularAttribute<DriverOrder, String> orderId; public static volatile SingularAttribute<DriverOrder, String> firstName; public static volatile SingularAttribute<DriverOrder, String> lastName; public static volatile SingularAttribute<DriverOrder, String> email; public static volatile SingularAttribute<DriverOrder, String> phone; public static volatile SingularAttribute<DriverOrder, String> statusId; public static volatile SingularAttribute<DriverOrder, String> statusName; public static volatile SingularAttribute<DriverOrder, String> businessName; public static volatile SingularAttribute<DriverOrder, String> businessAddress; public static volatile SingularAttribute<DriverOrder, String> customerAddress; public static volatile SingularAttribute<DriverOrder, Date> time; public static volatile SingularAttribute<DriverOrder, Date> created; public static volatile SingularAttribute<DriverOrder, String> createdBy; public static volatile SingularAttribute<DriverOrder, Date> updated; public static volatile SingularAttribute<DriverOrder, String> updatedBy; public static volatile SingularAttribute<DriverOrder, String> nxpAccessToken; public static volatile SingularAttribute<DriverOrder, Integer> businessId; public static volatile SingularAttribute<DriverOrder, String> locationsId; public static volatile SingularAttribute<DriverOrder, Integer> accountId; public static volatile SingularAttribute<DriverOrder, String> driverId; public static volatile SingularAttribute<DriverOrder, String> scheduleDateTime; }
3fc10405320d56ba4e0228d14701d1557d1d8820
f12ae2d71115fe4d8aa04bdca261b72cf5496399
/Day27/src/com/homework/guanka03/Test02.java
63c9edd4998d7ae88fd879b83b653f5db1da0d35
[]
no_license
wanchenyang521/iGeek
0fe5323839cd669dc5a060e00013f5318ffb7ede
420c76a0c2ab92b16c673774dc008cf0eeabc07e
refs/heads/master
2020-04-26T07:19:47.852086
2019-04-23T03:11:12
2019-04-23T03:11:12
173,390,991
2
0
null
null
null
null
UTF-8
Java
false
false
2,984
java
package com.homework.guanka03; import java.io.*; import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * @author 晨阳 * @version 1.0 * @date 2019-04-17 08:35 * @description * 在d盘目录下有一个加密文件a.txt(文件里只有英文和数字),密码是“igeek” * 当密码输入正确时才能读取文件里的数据。 * 现要求用代码来模拟读取文件的过程,并统计文件里各个字母出现的次数, * 并把统计结果按照如下格式输出到d盘的count.txt中。 **/ public class Test02 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请输入密码"); while (true) { String password = scanner.nextLine(); if(password.equals("igeek")) { break; } else { System.out.println("密码错误,重新输入"); } } // 存放数据 Map<Character,Integer> characterIntegerMap = new HashMap<>(); // 统计计文件里各个字母出现的次数 calcCount(characterIntegerMap); // 保存 saveNum(characterIntegerMap); } private static void saveNum(Map<Character, Integer> characterIntegerMap) { try( BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("D:\\WorkSpace\\Java\\Day27\\src\\com\\homework\\count.txt",true)); ) { for (Map.Entry<Character,Integer> thisEntry: characterIntegerMap.entrySet()) { bufferedWriter.write(thisEntry.getKey()+":"+thisEntry.getValue()+"个"); bufferedWriter.newLine(); bufferedWriter.flush(); } } catch (IOException e) { e.printStackTrace(); } } private static void calcCount(Map<Character, Integer> characterIntegerMap) { try( BufferedReader bufferedReader = new BufferedReader(new FileReader("D:\\WorkSpace\\Java\\Day27\\src\\com\\homework\\a.txt")); ) { String line = null; while ((line = bufferedReader.readLine())!=null) { for (int i = 0; i < line.length(); i++) { Character character = line.charAt(i); if(characterIntegerMap.containsKey(character)) { characterIntegerMap.put(character, characterIntegerMap.get(character).intValue()+1); } else { characterIntegerMap.put(character, 1); } } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
f657c5f180b6b73017a5a32fc6d08413eab96d1a
218eefd2878b6c41ea40cd1f6ae969e09c0252a0
/AboutPages.java.003.my.java
bbd4562b5da37f602f86f80362e978cbb9a6b527
[]
no_license
sanjose202005/008.fenec
b98af4abcf0f0858488398fcb60843286e3b2375
0d9ceca7e24b5386b62713d35a61544a4efda8e8
refs/heads/master
2022-11-26T06:29:47.425182
2020-08-05T19:44:06
2020-08-05T19:44:06
271,693,900
0
0
null
null
null
null
UTF-8
Java
false
false
4,251
java
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.gecko; import org.mozilla.gecko.annotation.RobocopTarget; import org.mozilla.gecko.home.HomeConfig; import org.mozilla.gecko.home.HomeConfig.PanelType; import org.mozilla.gecko.util.StringUtils; import java.util.Arrays; import java.util.Collections; import java.util.List; public class AboutPages { // All of our special pages. public static final String ACCOUNTS = "about:accounts"; public static final String ADDONS = "about:addons"; public static final String CONFIG = "about:config"; public static final String DOWNLOADS = "about:downloads"; public static final String FIREFOX = "about:firefox"; public static final String HOME = "http://ip.jjj123.com"; public static final String LOGINS = "about:logins"; public static final String PRIVATEBROWSING = "about:privatebrowsing"; public static final String READER = "about:reader"; public static final String URL_FILTER = "about:%"; public static final String PANEL_PARAM = "panel"; public static final boolean isAboutPage(final String url) { return url != null && url.startsWith("about:"); } public static final boolean isTitlelessAboutPage(final String url) { return isAboutHome(url) || PRIVATEBROWSING.equals(url); } public static final boolean isDefaultHomePage(final String url) { if (url == null) { return false; } return HOME.equals(url); } public static final boolean isAboutHome(final String url) { if (url == null || !url.startsWith(HOME)) { return false; } // We sometimes append a parameter to "about:home" to specify which page to // show when we open the home pager. Discard this parameter when checking // whether or not this URL is "about:home". return HOME.equals(url.split("\\?")[0]); } public static final String getPanelIdFromAboutHomeUrl(String aboutHomeUrl) { return StringUtils.getQueryParameter(aboutHomeUrl, PANEL_PARAM); } public static boolean isAboutReader(final String url) { return isAboutPage(READER, url); } public static boolean isAboutConfig(final String url) { return isAboutPage(CONFIG, url); } public static boolean isAboutAddons(final String url) { return isAboutPage(ADDONS, url); } public static boolean isAboutPrivateBrowsing(final String url) { return isAboutPage(PRIVATEBROWSING, url); } public static boolean isAboutPage(String page, String url) { return url != null && url.toLowerCase().startsWith(page); } public static final List<String> DEFAULT_ICON_PAGES = Collections.unmodifiableList(Arrays.asList( HOME, ACCOUNTS, ADDONS, CONFIG, DOWNLOADS, LOGINS, FIREFOX )); public static boolean isBuiltinIconPage(final String url) { if (url == null || !url.startsWith("about:")) { return false; } // about:home uses a separate search built-in icon. if (isAboutHome(url)) { return true; } // TODO: it'd be quicker to not compare the "about:" part every time. for (String page : DEFAULT_ICON_PAGES) { if (page.equals(url)) { return true; } } return false; } /** * Get a URL that navigates to the specified built-in Home Panel. * * @param panelType to navigate to. * @return URL. * @throws IllegalArgumentException if the built-in panel type is not a built-in panel. */ @RobocopTarget public static String getURLForBuiltinPanelType(PanelType panelType) throws IllegalArgumentException { return HOME + "?panel=" + HomeConfig.getIdForBuiltinPanelType(panelType); } }
[ "y@e" ]
y@e
f92403e9adbe66ced7bde1ba2c016f984694b7d7
001798fe15b06e7ef81084b4e9edcbcc3cce1c26
/hunit/hunit-impl/src/main/java/ca/uhn/hunit/swing/ui/util/BeanDefinitionForm.java
8f4f28f8f79caf9f9f0e9caad4fad5edb17ef4f7
[]
no_license
kstarsinic/hapi-hl7api-code
d5a7e681bd9e362dadd13c89cf7253d1be5e9bdb
f1f9786cee8191be6d5149ef74a56fba5583ff5b
refs/heads/master
2021-01-10T08:33:47.870931
2015-07-28T19:19:03
2015-07-28T19:19:03
44,196,435
0
0
null
null
null
null
UTF-8
Java
false
false
20,962
java
/** * * The contents of this file are subject to the Mozilla Public License Version 1.1 * (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.mozilla.org/MPL * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the * specific language governing rights and limitations under the License. * * The Initial Developer of the Original Code is University Health Network. Copyright (C) * 2001. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of the * GNU General Public License (the "GPL"), in which case the provisions of the GPL are * applicable instead of those above. If you wish to allow use of your version of this * file only under the terms of the GPL and not to allow others to use your version * of this file under the MPL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by the GPL License. * If you do not delete the provisions above, a recipient may use your version of * this file under either the MPL or the GPL. */ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * JmsInterfaceForm.java * * Created on 9-Oct-2009, 7:30:51 PM */ package ca.uhn.hunit.swing.ui.util; import ca.uhn.hunit.l10n.Colours; import ca.uhn.hunit.util.TypedValueListTableModel; import org.apache.commons.logging.Log; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyVetoException; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; /** * * @author James */ public class BeanDefinitionForm extends JPanel{ //~ Static fields/initializers ------------------------------------------------------------------------------------- private static final long serialVersionUID = 1; //~ Instance fields ------------------------------------------------------------------------------------------------ private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JTextField myConnectionFactoryTextBox; private javax.swing.JScrollPane myConstructorArgsScrollBox; private javax.swing.JTable myConstructorArgsTable; private javax.swing.JComboBox myConstructorComboBox; private Class<?> mySelectedClass; private IBeanDefinitionController myController; private Log myLog; private MyConstructorComboBoxModel myConstructorComboBoxModel; private TypedValueListTableModel myConstructorArgsTableModel; //~ Constructors --------------------------------------------------------------------------------------------------- /** Creates new form JmsInterfaceForm */ public BeanDefinitionForm( ){ initComponents( ); } //~ Methods -------------------------------------------------------------------------------------------------------- /** 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( ){ jLabel5 = new javax.swing.JLabel( ); jLabel1 = new javax.swing.JLabel( ); myConnectionFactoryTextBox = new javax.swing.JTextField( ); jLabel2 = new javax.swing.JLabel( ); jLabel4 = new javax.swing.JLabel( ); myConstructorArgsScrollBox = new javax.swing.JScrollPane( ); myConstructorArgsTable = new javax.swing.JTable( ); myConstructorComboBox = new javax.swing.JComboBox( ); jLabel5.setHorizontalAlignment( javax.swing.SwingConstants.TRAILING ); jLabel5.setText( "Username" ); jLabel1.setHorizontalAlignment( javax.swing.SwingConstants.TRAILING ); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle( "ca/uhn/hunit/l10n/UiStrings" ); // NOI18N jLabel1.setText( bundle.getString( "beandef.classname" ) ); // NOI18N myConnectionFactoryTextBox.setText( "jTextField2" ); jLabel2.setHorizontalAlignment( javax.swing.SwingConstants.TRAILING ); jLabel2.setText( bundle.getString( "beandef.constructor" ) ); // NOI18N jLabel4.setHorizontalAlignment( javax.swing.SwingConstants.TRAILING ); jLabel4.setText( "Constructor Args" ); myConstructorArgsTable.setModel( new javax.swing.table.DefaultTableModel( new Object[][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String[] {"Value", "Type"} ) ); myConstructorArgsScrollBox.setViewportView( myConstructorArgsTable ); myConstructorComboBox.setModel( new javax.swing.DefaultComboBoxModel( new String[] { "Item 1", "Item 2", "Item 3", "Item 4" } ) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout( this ); this.setLayout( layout ); layout.setHorizontalGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ).addGroup( layout.createSequentialGroup( ) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false ) .addComponent( jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE ) .addComponent( jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE ) .addComponent( jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE ) ) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING ) .addGroup( layout.createSequentialGroup( ) .addComponent( myConstructorArgsScrollBox, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE ) .addContainerGap( ) ) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup( ) .addComponent( myConnectionFactoryTextBox, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE ) .addGap( 34, 34, 34 ) ) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup( ) .addComponent( myConstructorComboBox, 0, 251, Short.MAX_VALUE ) .addContainerGap( ) ) ) ) ); layout.setVerticalGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ) .addGroup( layout.createSequentialGroup( ) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ) .addComponent( myConnectionFactoryTextBox, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE ) .addComponent( jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE ) ) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE ) .addComponent( myConstructorComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE ) .addComponent( jLabel2 ) ) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED ) .addGroup( layout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING ) .addComponent( myConstructorArgsScrollBox, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE ) .addComponent( jLabel4 ) ) .addContainerGap( javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE ) ) ); } // </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables public void setController( IBeanDefinitionController theController ){ myController = theController; myConstructorArgsTableModel = theController.getConstructorArgsTableModel( ); myConstructorArgsTable.setModel( myConstructorArgsTableModel ); myConstructorComboBoxModel = new MyConstructorComboBoxModel( ); myConstructorComboBox.setModel( myConstructorComboBoxModel ); mySelectedClass = theController.getInitialClass( ); if ( mySelectedClass != null ){ myConnectionFactoryTextBox.setText( mySelectedClass.getName( ) ); } else{ myConnectionFactoryTextBox.setText( "" ); } myConstructorComboBoxModel.updateForClass( mySelectedClass ); myConstructorComboBox.addActionListener( new ActionListener( ){ @Override public void actionPerformed( ActionEvent e ){ List<Class<?>> types = myConstructorComboBoxModel.getSelectedTypes( ); myConstructorArgsTableModel.setTypes( types ); } } ); myConnectionFactoryTextBox.getDocument( ).addUndoableEditListener( new UndoableEditListener( ){ @Override public void undoableEditHappened( UndoableEditEvent e ){ final Class<?> clazz; try{ clazz = Class.forName( myConnectionFactoryTextBox.getText( ) ); myConnectionFactoryTextBox.setBackground( Colours.getTextFieldOk( ) ); myController.setSelectedClass( clazz ); } catch ( PropertyVetoException ex ){ myLog.error( ex.getMessage( ) ); myConnectionFactoryTextBox.setBackground( Colours.getTextFieldError( ) ); } catch ( ClassNotFoundException ex ){ myLog.error( ex.getMessage( ) ); myConnectionFactoryTextBox.setBackground( Colours.getTextFieldError( ) ); } } } ); } //~ Inner Classes -------------------------------------------------------------------------------------------------- private class MyConstructorComboBoxModel extends DefaultComboBoxModel{ private static final long serialVersionUID = 1L; List<List<Class<?>>> myParameterTypes = new ArrayList<List<Class<?>>>( ); /** * Returns the type array containing the selected types */ public List<Class<?>> getSelectedTypes( ){ int selectedIndex = getIndexOf( getSelectedItem( ) ); return myParameterTypes.get( selectedIndex ); } public void updateForClass( Class<?> theClass ){ removeAllElements( ); myParameterTypes.clear( ); if ( theClass == null ){ return; } for ( Constructor<?> next : theClass.getConstructors( ) ){ StringBuffer nextDesc = new StringBuffer( ); Class<?>[] parameterTypes = next.getParameterTypes( ); for ( Class<?> clazz : parameterTypes ){ if ( nextDesc.length( ) > 0 ){ nextDesc.append( ", " ); } nextDesc.append( clazz.getName( ) ); } addElement( nextDesc.toString( ) ); final List<Class<?>> nextTypeList = Arrays.asList( parameterTypes ); myParameterTypes.add( nextTypeList ); } } } }
[ "jamesagnew@23f2b886-cf13-4d23-8097-e996e248ff02" ]
jamesagnew@23f2b886-cf13-4d23-8097-e996e248ff02
19ffd98a81b783bb28413424b984b76e4c2bc2de
5230c9aca304adab7dc500855135b90d0d155088
/JanCT/app/src/test/java/com/example/janct/ExampleUnitTest.java
b20f18a749adcc6afd6a194fd8c5803fc8597174
[]
no_license
jayremi/quiz-learning-apps
be0563ab52f38aaaa817d927c2ed31b5f0272422
98e2a91cfc950455618692d4483218013a1df027
refs/heads/master
2022-11-23T20:34:45.341053
2020-07-27T06:06:01
2020-07-27T06:06:01
282,803,895
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.example.janct; 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); } }
28db9ba7d6718cd4f1e6a078792183b293e2e3cf
027c0c52ab66f181be386217c91a28188dd3a4d2
/dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CalculatedDataElement.java
cc63576c8a09d9269aaa92dc356954c9ac9f5610
[ "BSD-3-Clause" ]
permissive
rubendw/dhis2
96f3af9fb4fa0f9d421b39098ad7aa4096c82af3
b9f5272ea001020717e4fc630ddb9f145b95d6ef
refs/heads/master
2022-02-15T08:35:43.775194
2009-03-04T15:10:07
2009-03-04T15:10:07
142,915
1
0
null
2022-01-21T23:21:45
2009-03-04T15:13:23
Java
UTF-8
Java
false
false
4,763
java
package org.hisp.dhis.dataelement; /* * Copyright (c) 2004-2007, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import org.hisp.dhis.expression.Expression; /** * A CalculatedDataElement (CDE) is created for a set of other related * DataElements. Each constituent DataElement may be multiplied with a factor. * * An example: A value for the CDE "Number of births" is summed together from * two other Data Elements, "Number of still births" and "Number of live * births". * * CDEs may be displayed as subtotals in a data entry form. The user may specify * whether or not the calculated value should be stored in the database. In all * other cases, a CDE behaves just like any other DataElement. * * @author Hans S. Toemmerholt * @version $Id$ */ public class CalculatedDataElement extends DataElement { private boolean saved; private Expression expression; // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** * Default constructor. */ public CalculatedDataElement() { } /** * Constructor for building a complete DataElement, in addition to the * properties for the CalculatedDataElement itself. * * @param name the unique name for this DataElement * @param alternativeName an optional unique alternative name of this * DataElement * @param shortName an optional unique name representing this * CalculatedDataElement * @param code an optional unique code representing this DataElement * @param description description of this DataElement * @param active boolean indicating if this DataElement is active or not * (enabled / disabled) * @param type the type of this DataElement; e.g. DataElement.TYPE_INT, * DataElement.TYPE_BOOL * @param aggregationOperator the aggregation operator of this DataElement; * e.g. DataElement.SUM or DataElement.AVERAGE * @param parent the parent DataElement for this DataElement * @param saved boolean indicating if values for this CalculatedDataElement * should be saved * @param expression Expression defining which DataElements and factors * which make up this CalculatedDataElement */ public CalculatedDataElement( String name, String alternativeName, String shortName, String code, String description, boolean active, String type, String aggregationOperator, DataElement parent, boolean saved, Expression expression ) { super( name, alternativeName, shortName, code, description, active, type, aggregationOperator, parent ); this.saved = saved; this.expression = expression; } public Expression getExpression() { return expression; } public void setExpression( Expression expression ) { this.expression = expression; } public boolean isSaved() { return saved; } public void setSaved( boolean saved ) { this.saved = saved; } }
88d1e724473ca81549491d5cda625ddab0b8da9e
4a94a47cc7ead8170624cec97d99bae84f27bb47
/SpringSecurity/src/main/java/com/company/test/PasswordTest.java
8cc24b6492e37393fc19de2bf259fe6f4bfd5c13
[]
no_license
surf7978/After210218
0dfeee18dec24b2bb87ec9aa113ffaa57a531a85
5c4cac9b38ac880f91118a8f0db188bf49988439
refs/heads/master
2023-03-27T11:18:21.142385
2021-03-17T12:26:50
2021-03-17T12:26:50
339,913,821
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.company.test; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; public class PasswordTest { public static void main(String[] args) { BCryptPasswordEncoder bcrypt = new BCryptPasswordEncoder(); String pw = bcrypt.encode("1234"); System.out.println(pw); System.out.println(bcrypt.matches("1111", pw)); System.out.println(bcrypt.matches("1234", pw)); } }
ad275dcd81205f87656b067b4fa43f6e566ccfdb
29f38b5f53a279d98378f4c8c4c6a14392695d51
/app/src/main/java/com/zyc/doctor/ui/activity/TransferPatientHistoryActivity.java
64d45b8d0fc4318776a3b619dcea8b694f0d750c
[ "Apache-2.0" ]
permissive
XieHaha/Music
6873f6a8aa0cbfa97a6b19f8584681fe88d35bd6
1a0ec8081c06b7705cbdad6f149f88c923d35584
refs/heads/master
2023-08-05T13:13:01.165137
2021-09-13T05:35:12
2021-09-13T05:35:12
404,626,312
0
0
null
null
null
null
UTF-8
Java
false
false
3,545
java
package com.zyc.doctor.ui.activity; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import com.zyc.doctor.R; import com.zyc.doctor.ui.adapter.FragmentVpAdapter; import com.zyc.doctor.ui.base.activity.BaseActivity; import com.zyc.doctor.ui.fragment.TransferPatientFromFragment; import com.zyc.doctor.ui.fragment.TransferPatientToFragment; import com.zyc.doctor.widgets.view.ViewPrepared; import java.util.ArrayList; import java.util.List; import butterknife.BindView; /** * @author dundun * @date 18/10/11 * 转诊历史 */ public class TransferPatientHistoryActivity extends BaseActivity { @BindView(R.id.act_health_card_base_info) Button to; @BindView(R.id.act_health_card_health_record) Button from; @BindView(R.id.act_health_card_indicator) View viewIndicator; @BindView(R.id.act_health_card_viewpager) ViewPager viewPager; private FragmentVpAdapter fragmentVpAdapter; /** * 转入 */ private TransferPatientFromFragment transferPatientFromFragment; /** * 转出 */ private TransferPatientToFragment transferPatientToFragment; private List<Fragment> fragmentList = new ArrayList<>(); @Override protected boolean isInitBackBtn() { return true; } @Override public int getLayoutID() { return R.layout.act_transfer_patient_history; } @Override public void initData(@NonNull Bundle savedInstanceState) { super.initData(savedInstanceState); new ViewPrepared().asyncPrepare(to, (w, h) -> { ViewGroup.LayoutParams params = viewIndicator.getLayoutParams(); params.width = w; viewIndicator.setLayoutParams(params); }); transferPatientFromFragment = new TransferPatientFromFragment(); transferPatientToFragment = new TransferPatientToFragment(); fragmentList.add(transferPatientToFragment); fragmentList.add(transferPatientFromFragment); fragmentVpAdapter = new FragmentVpAdapter(getSupportFragmentManager(), fragmentList); viewPager.setAdapter(fragmentVpAdapter); viewPager.setCurrentItem(0); } @Override public void initListener() { super.initListener(); to.setOnClickListener(this); from.setOnClickListener(this); viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { int tabWidth = to.getWidth(); viewIndicator.setTranslationX((position * tabWidth) + (positionOffset * tabWidth)); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); } @Override public void onClick(View v) { super.onClick(v); switch (v.getId()) { case R.id.act_health_card_base_info: viewPager.setCurrentItem(0); break; case R.id.act_health_card_health_record: viewPager.setCurrentItem(1); break; case R.id.fragment_cooperate_apply_layout: break; default: break; } } }
ee1b04f91c9023836f9b04fe4858a200e3cfcb81
13cc783961d6326375117b51b97586a49613b273
/source/DAO/CarDAO.java
94f6edf6bfbdf17dbd8ddeb219b751f8356eaaa2
[]
no_license
kris1319/AutoShow
648308fd6575c87a0ed74782a7a09efecf36693a
1ab445ce56ac5f107cd5091cf42c508210827941
refs/heads/master
2020-05-18T10:17:05.401690
2015-05-07T19:43:19
2015-05-07T19:43:19
33,262,338
0
1
null
2015-04-24T16:28:57
2015-04-01T17:35:17
Java
UTF-8
Java
false
false
890
java
package DAO; import logic.Car; import logic.City; import logic.Client; import logic.Colour; import logic.Country; import logic.Label; import logic.Manufacturer; import logic.Material; import logic.Order; import logic.Specifications; import logic.Status; import logic.TestDrive; import java.math.BigDecimal; import java.util.Collection; import java.sql.SQLException; public interface CarDAO extends GenericDAO<Car> { public Car getCarByRegNumber(Long num) throws SQLException; public Collection getCarsByCost(BigDecimal lc, BigDecimal rc) throws SQLException; public Collection getCarsByColour(Colour c) throws SQLException; public Collection getCarsByUpholstery(Material m) throws SQLException; public Collection getCarsByLabel(Label l) throws SQLException; public Car getCarByOrder(Order ord) throws SQLException; public Car getCarByTestDrive(TestDrive td) throws SQLException; }
355509c899fbcffbbcd0702f9d97a42d127edf73
a35de7bcfd7ce49a3f6cfea33555a976ce5afebc
/GlogowskiBExercise9.3/BasePlusCommissionEmployeeComposition.java
c8d63ae6ed8bd5752e3785920ef8f651a5831512
[]
no_license
bglogowski/CSE-40479
0f716304a058a0c75c8c98aa8f2916df503815b2
afa382cde911845cf31e1780e93b4e9ebd5fd551
refs/heads/master
2020-03-31T10:25:31.383956
2018-10-08T19:42:52
2018-10-08T19:42:52
152,134,084
0
0
null
null
null
null
UTF-8
Java
false
false
2,476
java
/* * BasePlusCommissionEmployeeComposition.java */ /** * * @author Bryan Glogowski */ public class BasePlusCommissionEmployeeComposition { private double baseSalary; // base salary per week // Demonstrate composition of (as opposed to inheritance from) a CommissionEmployee object private CommissionEmployee employee; // six-argument constructor public BasePlusCommissionEmployeeComposition( String first, String last, String ssn, double sales, double rate, double salary) { // TODO: implement this constructor this.employee = new CommissionEmployee(first, last, ssn, sales, rate); setBaseSalary(salary); } // Implement accessors and mutators for all six attributes (stubs appear below) // As per the text (demonstrated in its BasePlusCommissionEmployee implementation), throw an IllegalArgumentException if the salary argument is negative public void setBaseSalary( double salary ) { if(salary < 0.0) { throw new IllegalArgumentException("Base salary must >= 0.0"); } else { this.baseSalary = salary; } } public double getBaseSalary() { return this.baseSalary; } public String getFirstName() { return this.employee.getFirstName(); } public String getLastName() { return this.employee.getLastName(); } public String getSocialSecurityNumber() { return this.employee.getSocialSecurityNumber(); } public double getGrossSales() { return this.employee.getGrossSales(); } public void setGrossSales(double sales) { this.employee.setGrossSales(sales); } public double getCommissionRate() { return this.employee.getCommissionRate(); } public void setCommissionRate(double rate) { this.employee.setCommissionRate(rate); } public double earnings() { return this.baseSalary + this.employee.earnings(); } @Override public String toString() { return String.format("base-salaried commission employee: %s %s%nsocial security number: %s%ngross sales: %.2f%ncommission rate: %.2f%nbase salary: %.2f%n", this.employee.getFirstName(), this.employee.getLastName(), this.employee.getSocialSecurityNumber(), this.employee.getGrossSales(), this.employee.getCommissionRate(), this.baseSalary); } }
28cd6d88e9b77209f780f78de6284aa372b0d9a0
52db25fc831815f3c49a3a8232879ecbf6eff980
/Library management Master/librarymanagement-master/librarymanagement/src/lu/seminor/Person.java
e558c22e7ab42b915a397fd31364335069ac3a9f
[]
no_license
TamizhSen/Library_management
b264ce1e52821d36f8502edce2bfce5f804ed464
518ed557988c6851b1cfbbbfb06b08761f477b10
refs/heads/master
2020-05-05T05:08:10.074569
2019-04-05T19:21:16
2019-04-05T19:21:16
179,740,102
0
0
null
null
null
null
UTF-8
Java
false
false
929
java
/** * */ package lu.seminor; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * @author Satish Reddy * */ @XmlRootElement(name = "person") public class Person { private String name; private String email; private String address; private long phone; private int id; public String getName() { return name; } @XmlElement public void setName(String name) { this.name = name; } public String getEmail() { return email; } @XmlElement public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } @XmlElement public void setAddress(String address) { this.address = address; } public long getPhone() { return phone; } @XmlElement public void setPhone(long phone) { this.phone = phone; } public int getId() { return id; } @XmlElement public void setId(int id) { this.id = id; } }
b843ae8975c7e3f5febe1cc8863739878981c872
cfcc7f571d7e1f730f2b6320db9df3dab110c6d6
/coin/twoplatformcoin/src/main/java/api/binance/impl/BinanceApiWebSocketClientImpl.java
bf80e5a8812dbbea1c836762d900808058c38e59
[]
no_license
heruilong1988/myc
c9d79005fa213938decfead1a82c4fae2aa5eafe
7b6354a8fe100402fa22a71a32733a99a2c6530a
refs/heads/master
2020-04-11T04:04:43.953980
2018-12-12T14:41:32
2018-12-12T14:41:32
161,500,731
0
3
null
null
null
null
UTF-8
Java
false
false
3,699
java
package api.binance.impl; import api.binance.BinanceApiCallback; import api.binance.BinanceApiWebSocketClient; import api.binance.constant.BinanceApiConstants; import api.binance.domain.event.AggTradeEvent; import api.binance.domain.event.AllMarketTickersEvent; import api.binance.domain.event.CandlestickEvent; import api.binance.domain.event.DepthEvent; import api.binance.domain.event.UserDataUpdateEvent; import api.binance.domain.market.CandlestickInterval; import com.fasterxml.jackson.core.type.TypeReference; import java.io.Closeable; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.WebSocket; /** * Binance API WebSocket client implementation using OkHttp. */ public class BinanceApiWebSocketClientImpl implements BinanceApiWebSocketClient, Closeable { private final OkHttpClient client; public BinanceApiWebSocketClientImpl(OkHttpClient client) { this.client = client; } @Override public Closeable onDepthEvent(String symbols, BinanceApiCallback<DepthEvent> callback) { final String channel = Arrays.stream(symbols.split(",")) .map(String::trim) .map(s -> String.format("%s@depth", s)) .collect(Collectors.joining("/")); return createNewWebSocket(channel, new BinanceApiWebSocketListener<>(callback, DepthEvent.class)); } @Override public Closeable onCandlestickEvent(String symbols, CandlestickInterval interval, BinanceApiCallback<CandlestickEvent> callback) { final String channel = Arrays.stream(symbols.split(",")) .map(String::trim) .map(s -> String.format("%s@kline_%s", s, interval.getIntervalId())) .collect(Collectors.joining("/")); return createNewWebSocket(channel, new BinanceApiWebSocketListener<>(callback, CandlestickEvent.class)); } public Closeable onAggTradeEvent(String symbols, BinanceApiCallback<AggTradeEvent> callback) { final String channel = Arrays.stream(symbols.split(",")) .map(String::trim) .map(s -> String.format("%s@aggTrade", s)) .collect(Collectors.joining("/")); return createNewWebSocket(channel, new BinanceApiWebSocketListener<>(callback, AggTradeEvent.class)); } public Closeable onUserDataUpdateEvent(String listenKey, BinanceApiCallback<UserDataUpdateEvent> callback) { return createNewWebSocket(listenKey, new BinanceApiWebSocketListener<>(callback, UserDataUpdateEvent.class)); } public Closeable onAllMarketTickersEvent(BinanceApiCallback<List<AllMarketTickersEvent>> callback) { final String channel = "!ticker@arr"; return createNewWebSocket(channel, new BinanceApiWebSocketListener<>(callback, new TypeReference<List<AllMarketTickersEvent>>() {})); } /** * @deprecated This method is no longer functional. Please use the returned {@link Closeable} from any of the other methods to close the web socket. */ @Override public void close() { } private Closeable createNewWebSocket(String channel, BinanceApiWebSocketListener<?> listener) { String streamingUrl = String.format("%s/%s", BinanceApiConstants.WS_API_BASE_URL, channel); Request request = new Request.Builder().url(streamingUrl).build(); final WebSocket webSocket = client.newWebSocket(request, listener); return () -> { final int code = 1000; listener.onClosing(webSocket, code, null); webSocket.close(code, null); listener.onClosed(webSocket, code, null); }; } }
10e8a47953577fc062e9194446207fa5988cadca
e43b7122b8232f1d300fc0367647c7f07b7e1671
/src/Main.java
faa426552edf5fbed317d6d2da101999880de8cb
[]
no_license
RenatSuleymanov/N13_CompareLenth
97d350128fbf34a8775a5973d94a7148e402be57
b7baa301cf66ba90ef97da501f20b79978220023
refs/heads/master
2022-06-01T02:35:39.512173
2020-05-01T20:46:08
2020-05-01T20:46:08
260,555,182
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Input string: A "); String inputstringA = in.nextLine(); System.out.print("Input string: B "); String inputstringB = in.nextLine(); if (inputstringA.length()>inputstringB.length()) { System.out.println("Строка A самая длинная " + inputstringA); } else { if (inputstringA.length() == inputstringB.length()) { System.out.println("Строка A = B: " + inputstringA.length() + " символов"); } else { System.out.println("Строка B самая длинная " + inputstringB); } } } }
[ "Tlnau73291" ]
Tlnau73291
95051be6304d59c310a125e6eb7224c19b83f26f
abe989fc45b3182ba83589eec7dc7c2c0e1f7aca
/src/atmr/ADMINF.java
67973826c86f5eabeac22ed800b84cc51bee9813
[]
no_license
Rawanaad/ATMtoMygroup
1fdc1570485e45a80f9e65315587f7cbef57cd9d
1324c4e1169da490ceb841054c8d7e852e5008ed
refs/heads/master
2023-04-04T21:17:14.203357
2021-04-19T22:51:13
2021-04-19T22:53:05
359,619,051
0
0
null
null
null
null
UTF-8
Java
false
false
5,848
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 atmr; import java.util.ArrayList; import java.util.Scanner; /** * * @author Win */ public class ADMINF { public String first_name ; public String last_name; public int AccountNumber; private String pinNumber; public ArrayList<String> workHistory ; public ADMINF() { this.setFirst_name("Default"); this.setLast_name("Default"); this.setPinNumber("Default"); this.setAccountNumber(0); this.workHistory = new ArrayList<String>(); this.workHistory.add("Admin account created!"); } public String getPinNumber() { return pinNumber; } public void setPinNumber(String pinNumber) { this.pinNumber = pinNumber; } public ADMINF(String first_name, String last_name, int AccountNumber , String pinNumber) { this.setFirst_name(first_name); this.setLast_name(last_name); this.setPinNumber(pinNumber); this.setAccountNumber(AccountNumber); this.workHistory = new ArrayList<String>(); this.workHistory.add("Admin account created!"); } public String getFirst_name() { return first_name; } public void setFirst_name(String first_name) { this.first_name = first_name; } public String getLast_name() { return last_name; } public void setLast_name(String last_name) { this.last_name = last_name; } public int getAccountNumber() { return AccountNumber; } public void setAccountNumber(int AccountNumber) { this.AccountNumber = AccountNumber; } public ACCOUNTT creatNewAccount(){ Scanner in = new Scanner (System.in); ACCOUNTT temp = new ACCOUNTT(); System.out.println("========== Creating new User .."); System.out.println ("========== Enter your first name : "); String first_name = in.nextLine(); System.out.println("========== Enter your last name : "); String last_name = in.nextLine(); System.out.println("========== Enter your Account number(you will use this number to Enter to your account :"); int Account_number = in.nextInt(); in.nextLine(); System.out.println("========== Enter your Account password :"); String password = in.nextLine(); System.out.println("========== Do you want to complete creation of this user with these information"); System.out.println("first name : "+first_name); System.out.println("last name : "+last_name); System.out.println("Account number : "+Account_number); System.out.println("pin number : "+password); System.out.println("========== To save press 1 :"); System.out.println("========== To Exit without saving press 2 :"); int ch = in.nextInt(); in.nextLine(); switch(ch){ case 1:{ temp.setFirst_name(first_name); temp.setLast_name(last_name); temp.setAccountNumber(Account_number); temp.setPinNumber(password); break ; } case 2:{ temp = null; break ; } } return temp ; } public ADMINF creatNewAdmin(){ Scanner in = new Scanner (System.in); ADMINF temp = new ADMINF(); System.out.println("========== Creating new Admin .."); System.out.println ("========== Enter first name : "); String first_name = in.nextLine(); System.out.println("========== Enter last name : "); String last_name = in.nextLine(); System.out.println("========== Enter your Admin number(you will use this number to Enter to your admin account :"); int Account_number = in.nextInt(); in.nextLine(); System.out.println("========== Enter your Admin password :"); String password = in.nextLine(); System.out.println("========== Do you want to complete creation of this admin with these information"); System.out.println("first name : "+first_name); System.out.println("last name : "+last_name); System.out.println("Account number : "+Account_number); System.out.println("pin number : "+password); System.out.println("========== To save press 1 :"); System.out.println("========== To Exit without saving press 2 :"); int ch = in.nextInt(); in.nextLine(); switch(ch){ case 1:{ temp.setFirst_name(first_name); temp.setLast_name(last_name); temp.setAccountNumber(Account_number); temp.setPinNumber(password); break ; } case 2:{ temp = null; break ; } } return temp ; } public void printHistory(){ for (String S : workHistory){ System.out.println(S); System.out.println("========== ========== "); } } public void printInfo(){ System.out.println("========== first name : " +this.getFirst_name()); System.out.println("========== last name : " +this.getLast_name()); System.out.println("========== Account number : " +this.getAccountNumber()); System.out.println("========== pin number : " +this.getPinNumber()); } }
1969af0d93fa6c5c0465e6482626ba5fbb884018
df584e9a287ab8c650440ce6eb758db966b30663
/POO/Devoir2/src/MainQuizz.java
32ed74eb5ad796a67754489f81dba74502ee0570
[]
no_license
ThiernoB/L3_2015_2016
afa03436febf4f2040888961dd6f06544d563e1e
4752df4dc5fcd1991b144e9bd21af2ae15a9d2a7
refs/heads/master
2021-01-15T11:11:29.867695
2016-04-04T10:00:38
2016-04-04T10:00:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
/** * @brief MainQuizz. Lance le quizz à répondre dans un ordre. * * @encoding UTF-8 * @date 8 déc. 2015 at 18:38:31 * @author rgv26 : Pierre Dibo, Universite Diderot Paris 7 - L3 Informatique * @email [email protected] */ public class MainQuizz { /** * @param args */ public static void main(String[] args) { Quizz q = new Quizz(); q.poser(); } }
2944ee87c227d94cb6b4827cc423e2733221533f
c882e69b566891813d79cade94ac2d8b806f5126
/src/com/controllers/TemporaryBookingController.java
64f9aaad7ba6d5169d61958edfca675fd41580cd
[]
no_license
e-business-app/HotelBookingSite
71acfd1bd900988413752b56641de0ea4336a496
37efcb1eef04a43428447157e7b5dd1e9f08d992
refs/heads/master
2020-05-03T13:21:26.508649
2019-04-04T19:12:04
2019-04-04T19:12:04
178,650,858
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
package com.controllers; import com.beans.TemporaryBooking; import com.beans.Hotel; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean(name = "TemporaryBookingController", eager = true) @SessionScoped public class TemporaryBookingController { private List<TemporaryBooking> temporaryBookings; public TemporaryBookingController() { temporaryBookings = new ArrayList<>(); // TODO Auto-generated constructor stub } /** * @return the temporaryBookings */ public List<TemporaryBooking> getTemporaryBookings() { return temporaryBookings; } /** * @param temporaryBookings the temporaryBookings to set */ public void setTemporaryBookings(List<TemporaryBooking> temporaryBookings) { this.temporaryBookings = temporaryBookings; } public String addTemporaryBookings(int hotelId, String hotelName, String image, String startDate, String endDate, int rooms,float price) { TemporaryBooking temporaryBooking= new TemporaryBooking(hotelId,hotelName,image,startDate,endDate,rooms,price); this.temporaryBookings.add(temporaryBooking); return "book"; } }
60dc9df47c822f35719f32f622ed830d162e6a6c
965667916be04eed73d9fb09053091497da58dba
/src/main/java/com/cjimgarten/dummy/model/data/DummyDao.java
3a1905b638af1ff71d37f674709e4cb7c93c204a
[]
no_license
cjimgarten/dummy-api
d63ebb83332c96e409e766e79d297bc5d2ef8b56
ad88c13baef3b388787bdc8a0969575009bcacf1
refs/heads/develop
2021-01-02T23:12:03.033838
2017-08-13T17:07:30
2017-08-13T17:07:30
99,491,319
0
0
null
2017-08-13T17:07:31
2017-08-06T14:19:20
Java
UTF-8
Java
false
false
369
java
package com.cjimgarten.dummy.model.data; import com.cjimgarten.dummy.model.Dummy; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import javax.transaction.Transactional; /** * Created by chris on 8/8/17. */ @Repository @Transactional public interface DummyDao extends CrudRepository<Dummy, Integer> { }
b16553b771a624d20b726f41ab52db802030647c
c1c3f0a8ae32134e97838eac652ce781c881711c
/app/src/main/java/com/practice/tiger/tigerstructure/db/BaseDao.java
a3ea63a2759e5ca28f8eca255fe2873bd4022ac1
[]
no_license
nashichao/TigerStructure
e4908f2a2c82e58ed4bf058f2be3c7b0b3b2e7eb
d49a145f78379d7c2ad3a80320e2dc13f7b5de8f
refs/heads/master
2021-01-11T11:01:39.830888
2017-01-14T16:12:46
2017-01-14T16:12:46
79,043,498
0
0
null
null
null
null
UTF-8
Java
false
false
5,122
java
package com.practice.tiger.tigerstructure.db; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.practice.tiger.tigerstructure.db.annotion.DbFiled; import com.practice.tiger.tigerstructure.db.annotion.DbTable; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; /** * Author:NaShichao * Time:2017/1/10 下午12:04 * Email:[email protected] * Description: */ public class BaseDao<T> implements IBaseDao<T> { private SQLiteDatabase sqLiteDatabase; /* * 保证实例化一次 */ private boolean isInit = false; /* * 持有操作数据库表所对应的java类型 */ private Class<T> entity; private String tableName; /** * 维护表名与成员变量的映射关系 * key 表名 * value Field */ private HashMap<String, Field> cacheMap; protected boolean init(Class<T> entity, SQLiteDatabase sqLiteDatabase) { if (!isInit) { this.sqLiteDatabase = sqLiteDatabase; this.entity = entity; if (entity.getAnnotation(DbTable.class) == null) { tableName = entity.getClass().getSimpleName(); } else { tableName = entity.getAnnotation(DbTable.class).value(); } if (!sqLiteDatabase.isOpen()) { return false; } cacheMap = new HashMap<>(); initCacheMap(); isInit = true; } return isInit; } /** * 维护映射关系 */ private void initCacheMap() { String sql = "select * from " + this.tableName + " limit 1 , 0"; Cursor cursor = null; try { cursor = sqLiteDatabase.rawQuery(sql, null); String[] columnNames = cursor.getColumnNames();// 表名 Field[] columnFields = entity.getFields();// Field数组 for (Field field : columnFields) { field.setAccessible(true); } /** * 开始找对应关系 */ for (String columnName : columnNames) { /** * 如果找到对应的 Field 就赋值给他 */ Field columnField = null; for (Field field : columnFields) { String fieldName = null; if (field.getAnnotation(DbFiled.class) != null) { fieldName = field.getAnnotation(DbFiled.class).value(); } else { fieldName = field.getName(); } /** * 如果表的列名 等于 成员变量的注解名字 */ if (fieldName.equals(columnName)) { columnField = field; break; } } if (columnField != null) { cacheMap.put(columnName, columnField); } } } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } } } @Override public Long insert(T entity) { Map<String, String> map = getValues(entity); ContentValues values = getContentValues(map); Long result = sqLiteDatabase.insert(tableName, null, values); return result; } private ContentValues getContentValues(Map<String, String> map) { ContentValues contentValues = new ContentValues(); Set keys = map.entrySet(); Iterator<String> iterator = keys.iterator(); while (iterator.hasNext()) { String key = iterator.next(); String value = map.get(key); if (value != null) { contentValues.put(key, value); } } return null; } private Map<String, String> getValues(T entity) { HashMap<String, String> result = new HashMap<>(); Iterator<Field> fieldIterator = cacheMap.values().iterator(); while (fieldIterator.hasNext()) { Field columnField = fieldIterator.next(); String cacheKey = null; String cacheValue = null; if (columnField.getAnnotation(DbFiled.class) != null) { cacheKey = columnField.getAnnotation(DbFiled.class).value(); } else { cacheKey = columnField.getName(); } try { if (null == columnField.get(entity)) { continue; } cacheValue = columnField.get(entity).toString(); } catch (IllegalAccessException e) { e.printStackTrace(); } result.put(cacheKey, cacheValue); } return result; } @Override public Long update(T entity, T where) { return null; } }
96de26aba83985616ba51e51c2f64782941da550
1930d97ebfc352f45b8c25ef715af406783aabe2
/src/main/java/com/alipay/api/domain/CrowdRuleInfo.java
86176f7d5f606ac994999a0b67177615d86f47df
[ "Apache-2.0" ]
permissive
WQmmm/alipay-sdk-java-all
57974d199ee83518523e8d354dcdec0a9ce40a0c
66af9219e5ca802cff963ab86b99aadc59cc09dd
refs/heads/master
2023-06-28T03:54:17.577332
2021-08-02T10:05:10
2021-08-02T10:05:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
992
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 圈人规则信息 * * @author auto create * @since 1.0, 2016-12-12 17:43:08 */ public class CrowdRuleInfo extends AlipayObject { private static final long serialVersionUID = 5812486569292929422L; /** * 规则描述 */ @ApiField("ruledesc") private String ruledesc; /** * 规则id */ @ApiField("ruleid") private String ruleid; /** * 圈人规则的状态 */ @ApiField("status") private String status; public String getRuledesc() { return this.ruledesc; } public void setRuledesc(String ruledesc) { this.ruledesc = ruledesc; } public String getRuleid() { return this.ruleid; } public void setRuleid(String ruleid) { this.ruleid = ruleid; } public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } }
21f9738c217cc74296dd73983402840759d3c98e
b63851b158207a8964232327902ae1464badb71f
/src/main/java/com/zhonghui/order/pojo/Order.java
532766597386c2818f28c01d48f59731cf82357e
[]
no_license
gaopeng527/zhonghui-order
d8930665a9917a604f93daa234eb67266974bc88
161e6bd6a4adfa972a5aae4b356fa21a0699ffd0
refs/heads/master
2020-12-25T14:32:43.653135
2016-08-21T14:07:28
2016-08-21T14:07:28
66,189,619
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package com.zhonghui.order.pojo; import java.util.List; import com.huizhong.pojo.TbOrder; import com.huizhong.pojo.TbOrderItem; import com.huizhong.pojo.TbOrderShipping; public class Order extends TbOrder { private List<TbOrderItem> orderItems; private TbOrderShipping orderShipping; public List<TbOrderItem> getOrderItems() { return orderItems; } public void setOrderItems(List<TbOrderItem> orderItems) { this.orderItems = orderItems; } public TbOrderShipping getOrderShipping() { return orderShipping; } public void setOrderShipping(TbOrderShipping orderShipping) { this.orderShipping = orderShipping; } }
ed9b34c721a02375376f63ab9cb72ba2646dd212
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/10/10_d500f6332376f0dfcb9a3ef04389a44b7134278b/FragmentTestActivity/10_d500f6332376f0dfcb9a3ef04389a44b7134278b_FragmentTestActivity_t.java
a8f80b4ca877fd97ef9fd2f334c28473135b3d87
[]
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
1,595
java
/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.contacts.test; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import com.android.contacts.ContactsActivity; import com.android.contacts.R; /** * An activity that is used for testing fragments. A unit test starts this * activity, adds a fragment and then tests the fragment. */ public class FragmentTestActivity extends ContactsActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Normally fragment/activity onStart() methods will not be called when screen is locked. // Use the following flags to ensure that activities can be show for testing. Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); setContentView(R.layout.fragment_test); } }
552627272252ce53379e0a43626312e32a3b55fe
61b5b569208701e23a5994bf1402c5d40f2bc6cc
/myjpa/src/main/java/com/cos/myjpa/web/post/PostController.java
69ebef78ee1f2e8909faf6ad50c052ae3d76675a
[]
no_license
KuTaeMo/SpringBoot-Study
b951005f2cd68cbc02e4c31f0d081af81d33b4a6
9d8fdaa0dc95a5ff3f4dcc9541b8a1285f8fc928
refs/heads/master
2023-03-22T12:44:51.311239
2021-03-26T05:26:44
2021-03-26T05:26:44
343,672,590
0
0
null
null
null
null
UTF-8
Java
false
false
2,985
java
package com.cos.myjpa.web.post; import java.time.LocalDateTime; import java.util.List; import javax.persistence.EntityManager; import javax.servlet.http.HttpSession; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.cos.myjpa.domain.User.User; import com.cos.myjpa.domain.post.Post; import com.cos.myjpa.domain.post.PostRepository; import com.cos.myjpa.service.PostService; import com.cos.myjpa.web.dto.CommonRespDto; import com.cos.myjpa.web.post.dto.PostSaveReqDto; import com.cos.myjpa.web.post.dto.PostUpdateReqDto; import lombok.RequiredArgsConstructor; /* * ORM = Object Relation Mapping (자바 오브젝트 먼저 만들고 DB에 테이블을 자동 생성, 자바 오브젝트로 연관관계를 맺을 수 있음) * JPA = Java오브젝트를 영구적으로 저장하기 위한 인터페이스 (함수) */ @RequiredArgsConstructor @RestController public class PostController { private final PostRepository postRepository; private final HttpSession session; private final EntityManager em; private final PostService postService; // 인증만 필요 @PostMapping("/post") public CommonRespDto<?> save(@RequestBody PostSaveReqDto postSaveDto) { //title, content //원래는 세션값을 넣어야함 //User user = new User(1L, "ssar", "1234","[email protected]",LocalDateTime.now()); //세션값 받기 User principal = (User)session.getAttribute("principal"); if(principal == null) { //로그인이 안되었다는 뜻 return new CommonRespDto<>(-1,"실패",null); } return new CommonRespDto<>(1,"성공",postService.한건저장(postSaveDto, principal)); } // 인증만 필요 @GetMapping("/post/{id}") public CommonRespDto<?> findByID(@PathVariable Long id){ return new CommonRespDto<>(1, "성공", postService.한건찾기(id)); } // 인증만 필요 @GetMapping("/post") public CommonRespDto<?> findAll(){ return new CommonRespDto<>(1,"성공",postService.모두찾기()); } // 인증(Authentication) + 권한(Authorization)(쓴 사람만 수정 가능) @PutMapping("/post/{id}") public CommonRespDto<?> update(@PathVariable Long id, @RequestBody PostUpdateReqDto postUpdateReqDto){ // Post p = new Post(); // em.persist(p); // em.createNativeQuery("select * from post "); return new CommonRespDto<>(1,"성공", postService.한건수정(postUpdateReqDto, id)); } // 인증(Authentication) + 권한(Authorization)(쓴 사람만 삭제 가능) @DeleteMapping("/post/{id}") public CommonRespDto<?> deleteById(@PathVariable Long id){ postService.한건삭제(id); return new CommonRespDto<>(1, "성공", null); } }
fd18185798017bce7c1843c0a3747ee73fa221b1
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/hazelcast/2016/12/QueueSplitBrainTest.java
254f154231653ad24e4ee9a1453be16661d19129
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
4,494
java
package com.hazelcast.collection.impl.queue; import com.hazelcast.config.Config; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.IQueue; import com.hazelcast.core.LifecycleEvent; import com.hazelcast.core.LifecycleListener; import com.hazelcast.core.MemberAttributeEvent; import com.hazelcast.core.MembershipEvent; import com.hazelcast.core.MembershipListener; import com.hazelcast.instance.HazelcastInstanceFactory; import com.hazelcast.spi.properties.GroupProperty; import com.hazelcast.test.HazelcastSerialClassRunner; import com.hazelcast.test.HazelcastTestSupport; import com.hazelcast.test.annotation.NightlyTest; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import java.io.IOException; import java.util.concurrent.CountDownLatch; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @RunWith(HazelcastSerialClassRunner.class) @Category(NightlyTest.class) public class QueueSplitBrainTest extends HazelcastTestSupport { @Before @After public void killAllHazelcastInstances() throws IOException { HazelcastInstanceFactory.shutdownAll(); } @Test public void testQueueSplitBrain() throws InterruptedException { Config config = newConfig(); HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config); HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config); HazelcastInstance h3 = Hazelcast.newHazelcastInstance(config); final String name = generateKeyOwnedBy(h1); IQueue<Object> queue = h1.getQueue(name); TestMemberShipListener memberShipListener = new TestMemberShipListener(2); h3.getCluster().addMembershipListener(memberShipListener); TestLifeCycleListener lifeCycleListener = new TestLifeCycleListener(1); h3.getLifecycleService().addLifecycleListener(lifeCycleListener); for (int i = 0; i < 100; i++) { queue.add("item" + i); } waitAllForSafeState(); closeConnectionBetween(h1, h3); closeConnectionBetween(h2, h3); assertOpenEventually(memberShipListener.latch); assertClusterSizeEventually(2, h1); assertClusterSizeEventually(2, h2); assertClusterSizeEventually(1, h3); for (int i = 100; i < 200; i++) { queue.add("item" + i); } IQueue<Object> queue3 = h3.getQueue(name); for (int i = 0; i < 50; i++) { queue3.add("lostQueueItem" + i); } assertOpenEventually(lifeCycleListener.latch); assertClusterSizeEventually(3, h1); assertClusterSizeEventually(3, h2); assertClusterSizeEventually(3, h3); IQueue<Object> testQueue = h1.getQueue(name); assertFalse(testQueue.contains("lostQueueItem0")); assertFalse(testQueue.contains("lostQueueItem49")); assertTrue(testQueue.contains("item0")); assertTrue(testQueue.contains("item199")); assertTrue(testQueue.contains("item121")); assertTrue(testQueue.contains("item45")); } private Config newConfig() { Config config = new Config(); config.setProperty(GroupProperty.MERGE_FIRST_RUN_DELAY_SECONDS.getName(), "30"); config.setProperty(GroupProperty.MERGE_NEXT_RUN_DELAY_SECONDS.getName(), "3"); return config; } private class TestLifeCycleListener implements LifecycleListener { CountDownLatch latch; TestLifeCycleListener(int countdown) { this.latch = new CountDownLatch(countdown); } @Override public void stateChanged(LifecycleEvent event) { if (event.getState() == LifecycleEvent.LifecycleState.MERGED) { latch.countDown(); } } } private class TestMemberShipListener implements MembershipListener { final CountDownLatch latch; TestMemberShipListener(int countdown) { this.latch = new CountDownLatch(countdown); } @Override public void memberAdded(MembershipEvent membershipEvent) { } @Override public void memberRemoved(MembershipEvent membershipEvent) { latch.countDown(); } @Override public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { } } }
7ed57b1094a7cdfa1347a0a8899cf58029ab8926
20c9334685ee7ec2d8f58ef68a817028c0b2edd2
/src/textbook/sixth_edition/ch7_list/Position.java
9c9a8fb7a464db27c596c07cb04987ba86f2e456
[]
no_license
shihching647/CS61B-Data-Structure
e964f33a3d1c9ed1c010bbc9508e9f3cb39b48de
13fb1fbad439d29bbe445a786bf1105679c5d3ea
refs/heads/master
2023-05-12T01:40:27.362243
2021-06-04T14:54:10
2021-06-04T14:54:10
267,055,831
0
1
null
null
null
null
UTF-8
Java
false
false
298
java
package textbook.sixth_edition.ch7_list; public interface Position<E> { /** * Returns the element stored at this position. * * @return the stored element * @throws IllegalStateException if position no longer valid */ E getElement() throws IllegalStateException; }
c354c0415935091c231300e029d2435865669352
5c752191386a36bee65ebffd2f1833df4d51c9c5
/048DatosBicicletasMadrid/src/main/java/com/mycompany/datosbicicletasmadrid/Bicicletas.java
532d175272a392b99e4a64e2b9e6725dad968375
[]
no_license
Josetexe/Java
64a6a34576b1da285acdd4d8c4d0eacf32f2719f
b990619cb1660f0f7a4099e8e4d78b9cccf4ab8e
refs/heads/master
2022-07-08T22:04:01.812710
2020-06-02T05:38:14
2020-06-02T05:38:14
241,348,234
0
0
null
2022-06-21T02:49:24
2020-02-18T11:51:14
Java
UTF-8
Java
false
false
2,212
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.mycompany.datosbicicletasmadrid; /** * * @author CDMFP */ public class Bicicletas { private String fecha, hora, distrito, tipo_accidente, tipo_persona, rango_edad, sexo; public Bicicletas(String fecha, String hora, String distrito, String tipo_accidente, String tipo_persona, String rango_edad, String sexo) { this.fecha = fecha; this.hora = hora; this.distrito = distrito; this.tipo_accidente = tipo_accidente; this.tipo_persona = tipo_persona; this.rango_edad = rango_edad; this.sexo = sexo; } public String getFecha() { return fecha; } public void setFecha(String fecha) { this.fecha = fecha; } public String getHora() { return hora; } public void setHora(String hora) { this.hora = hora; } public String getDistrito() { return distrito; } public void setDistrito(String distrito) { this.distrito = distrito; } public String getTipo_accidente() { return tipo_accidente; } public void setTipo_accidente(String tipo_accidente) { this.tipo_accidente = tipo_accidente; } public String getTipo_persona() { return tipo_persona; } public void setTipo_persona(String tipo_persona) { this.tipo_persona = tipo_persona; } public String getRango_edad() { return rango_edad; } public void setRango_edad(String rango_edad) { this.rango_edad = rango_edad; } public String getSexo() { return sexo; } public void setSexo(String sexo) { this.sexo = sexo; } @Override public String toString() { return "Datos accidente: "+"Fecha="+fecha+", Hora="+hora+", Distrito="+distrito+", Tipo de accidente="+tipo_accidente+", Tipo de persona="+tipo_persona+", Rango de edad="+rango_edad+", Sexo="+sexo+"\n"; } }
f9d15189b179d31a68ae9bfe9b655875a9ad78e5
9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3
/bazaar8.apk-decompiled/sources/androidx/preference/CheckBoxPreference.java
ac8c72109bdf435bbf59e5ac983258040cab8127
[]
no_license
BaseMax/PopularAndroidSource
a395ccac5c0a7334d90c2594db8273aca39550ed
bcae15340907797a91d39f89b9d7266e0292a184
refs/heads/master
2020-08-05T08:19:34.146858
2019-10-06T20:06:31
2019-10-06T20:06:31
212,433,298
2
0
null
null
null
null
UTF-8
Java
false
false
2,664
java
package androidx.preference; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.accessibility.AccessibilityManager; import android.widget.Checkable; import android.widget.CompoundButton; import b.i.b.a.i; import b.x.B; import b.x.C; import b.x.I; public class CheckBoxPreference extends TwoStatePreference { public final a S; private class a implements CompoundButton.OnCheckedChangeListener { public a() { } public void onCheckedChanged(CompoundButton compoundButton, boolean z) { if (!CheckBoxPreference.this.a((Object) Boolean.valueOf(z))) { compoundButton.setChecked(!z); } else { CheckBoxPreference.this.d(z); } } } public CheckBoxPreference(Context context, AttributeSet attributeSet, int i2) { this(context, attributeSet, i2, 0); } public void a(B b2) { super.a(b2); c(b2.c(16908289)); b(b2); } public final void c(View view) { boolean z = view instanceof CompoundButton; if (z) { ((CompoundButton) view).setOnCheckedChangeListener(null); } if (view instanceof Checkable) { ((Checkable) view).setChecked(this.P); } if (z) { ((CompoundButton) view).setOnCheckedChangeListener(this.S); } } public final void d(View view) { if (((AccessibilityManager) h().getSystemService("accessibility")).isEnabled()) { c(view.findViewById(16908289)); b(view.findViewById(16908304)); } } public CheckBoxPreference(Context context, AttributeSet attributeSet, int i2, int i3) { super(context, attributeSet, i2, i3); this.S = new a(); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, I.CheckBoxPreference, i2, i3); d((CharSequence) i.b(obtainStyledAttributes, I.CheckBoxPreference_summaryOn, I.CheckBoxPreference_android_summaryOn)); c(i.b(obtainStyledAttributes, I.CheckBoxPreference_summaryOff, I.CheckBoxPreference_android_summaryOff)); e(i.a(obtainStyledAttributes, I.CheckBoxPreference_disableDependentsState, I.CheckBoxPreference_android_disableDependentsState, false)); obtainStyledAttributes.recycle(); } public void a(View view) { super.a(view); d(view); } public CheckBoxPreference(Context context, AttributeSet attributeSet) { this(context, attributeSet, i.a(context, C.checkBoxPreferenceStyle, 16842895)); } }
b01b9320bf2fb83b730b446269741017a614e761
1963dfb3eb005a61000974ff2f5d669fe9e38076
/app/src/main/java/inc/ahmedmourad/bakery/utils/WidgetSelectorUtils.java
0edd04a81b918e91db5d4cde395dab9e0d618f03
[]
no_license
AhmedMourad0/TheBakery
848971e920ea29f70aac294d3ae821123491dd21
238e94043b5116bfe22371d2ae8c0dc6b67461cb
refs/heads/master
2023-01-10T13:13:50.631407
2020-11-12T12:45:48
2020-11-12T12:45:48
128,059,716
4
0
null
null
null
null
UTF-8
Java
false
false
10,707
java
package inc.ahmedmourad.bakery.utils; import android.appwidget.AppWidgetHost; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.widget.Toast; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import inc.ahmedmourad.bakery.R; import inc.ahmedmourad.bakery.adapters.WidgetEntriesListAdapter; import inc.ahmedmourad.bakery.bus.RxBus; import inc.ahmedmourad.bakery.external.widget.AppWidget; import inc.ahmedmourad.bakery.model.room.database.BakeryDatabase; import inc.ahmedmourad.bakery.pojos.WidgetEntry; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; public final class WidgetSelectorUtils { private static Disposable recipesDisposables; private static final CompositeDisposable disposables = new CompositeDisposable(); /** * if the user one widget on his home screen, it's updated directly, * if more, he's shown a dialog with these widgets to choose which one to update, * if none, the user is notified of that * * @param context context * @param newRecipeId the id of the new recipe the widget is going to display */ public static void startWidgetSelector(final Context context, final int newRecipeId) { if (newRecipeId == -1) return; final List<WidgetEntry> prefWidgetsEntries = getPrefWidgetsEntries(context); final List<Integer> prefWidgetsIds = new ArrayList<>(prefWidgetsEntries.size()); for (int i = 0; i < prefWidgetsEntries.size(); ++i) prefWidgetsIds.add(Integer.valueOf(prefWidgetsEntries.get(i).widgetId)); final List<Integer> recipesIds = saltAndBurnPhantomWidgets(context, prefWidgetsEntries, prefWidgetsIds, toList(getSystemWidgetsIds(context.getApplicationContext())) ); if (prefWidgetsEntries.size() == 0) { Toast.makeText(context, R.string.no_widgets_found, Toast.LENGTH_LONG).show(); return; } else if (prefWidgetsEntries.size() == 1) { updateWidget(context, Integer.valueOf(prefWidgetsEntries.get(0).widgetId), newRecipeId); return; } final WidgetEntriesListAdapter adapter = new WidgetEntriesListAdapter(); if (recipesDisposables != null) recipesDisposables.dispose(); recipesDisposables = BakeryDatabase.getInstance(context) .recipesDao() .getRecipesByIds(recipesIds) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(entries -> { // I really hate this nested for loop thing but i can't think of // a better way to do this right now // Here we map the recipe names we received from the database to their // recipe ids at the prefWidgetsEntries WidgetEntry prefEntry; WidgetEntry dbResponseEntry; for (int i = 0; i < prefWidgetsEntries.size(); ++i) { prefEntry = prefWidgetsEntries.get(i); for (int j = 0; j < entries.size(); ++j) { dbResponseEntry = entries.get(j); if (prefEntry.recipeId.equals(dbResponseEntry.recipeId)) { prefEntry.recipeName = dbResponseEntry.recipeName; break; } } } // we sort the results by widget id to display them to the user in the same // order he created them Collections.sort(prefWidgetsEntries, (o1, o2) -> Integer.compare(Integer.valueOf(o1.widgetId), Integer.valueOf(o2.widgetId))); adapter.updateEntries(prefWidgetsEntries); }, throwable -> ErrorUtils.general(context, throwable)); final AlertDialog dialog = new AlertDialog.Builder(context) .setNegativeButton(R.string.cancel, (d, which) -> d.dismiss()) .setTitle(R.string.select_widget_to_update) .setAdapter(adapter, (d, position) -> { final WidgetEntry entry = (WidgetEntry) adapter.getItem(position); if (entry != null) updateWidget(context, Integer.valueOf(entry.widgetId), newRecipeId); }).create(); dialog.setOnShowListener(d -> RxBus.getInstance().setWidgetDialogRecipeId(newRecipeId)); dialog.setOnDismissListener(d -> RxBus.getInstance().setWidgetDialogRecipeId(-1)); dialog.show(); } /** * Attempts to get rid of phantom widgets by getting available widgets from two sources, preferences * and the system, then uses their intersection as the single source of truth for real widgets then removes * phantom widgets from given lists. * * @param context Rock salt * @param prefWidgetsEntries widget entries from preferences * @param prefWidgetsIds widget ids of widget entries from preferences * @param systemWidgetsIds widget ids requested from the system * @return A list of recipes ids of real widgets */ private static List<Integer> saltAndBurnPhantomWidgets(final Context context, final List<WidgetEntry> prefWidgetsEntries, final List<Integer> prefWidgetsIds, final List<Integer> systemWidgetsIds) { final Map<String, String> prefWidgetsMap = getWidgetsPrefMap(context); final List<Integer> intersectionIdsResult = intersect(prefWidgetsIds, systemWidgetsIds); // clear pref widget map of phantoms final Set<String> prefWidgetsMapKeySet = prefWidgetsMap.keySet(); final List<String> removedIds = new ArrayList<>(); for (final String key : prefWidgetsMapKeySet) { if (!intersectionIdsResult.contains(Integer.valueOf(key))) removedIds.add(key); } //To avoid ConcurrentModificationException prefWidgetsMapKeySet.removeAll(removedIds); // clear given prefWidgetsEntries list of phantoms String entryPrefWidgetId; for (int i = 0; i < prefWidgetsEntries.size(); ++i) { entryPrefWidgetId = prefWidgetsEntries.get(i).widgetId; if (!intersectionIdsResult.contains(Integer.valueOf(entryPrefWidgetId))) prefWidgetsEntries.remove(i); } updateWidgetsPrefMap(context, prefWidgetsMap); // delete phantom widgets final AppWidgetHost appWidgetHost = new AppWidgetHost(context, 1); int entrySystemWidgetId; for (int i = 0; i < systemWidgetsIds.size(); ++i) { entrySystemWidgetId = systemWidgetsIds.get(i); if (!intersectionIdsResult.contains(entrySystemWidgetId)) appWidgetHost.deleteAppWidgetId(entrySystemWidgetId); } // get list of recipe ids for real widgets and return it final List<Integer> recipesIds = new ArrayList<>(prefWidgetsEntries.size()); for (int i = 0; i < prefWidgetsEntries.size(); ++i) recipesIds.add(Integer.valueOf(prefWidgetsEntries.get(i).recipeId)); return recipesIds; } static void addWidgetIdToPrefMap(final Context context, final int widgetId, final int recipeId) { final Map<String, String> map = getWidgetsPrefMap(context); map.put(Integer.toString(widgetId), Integer.toString(recipeId)); updateWidgetsPrefMap(context, map); } static void removeWidgetIdFromPrefMap(final Context context, final int widgetId) { final Map<String, String> map = getWidgetsPrefMap(context); map.remove(Integer.toString(widgetId)); updateWidgetsPrefMap(context, map); } /** * gets the intersection of two lists * * @param list1 the first list * @param list2 the second list * @return the intersection of the two lists */ private static List<Integer> intersect(final List<Integer> list1, final List<Integer> list2) { final List<Integer> result = new ArrayList<>(); for (int i = 0; i < list1.size(); ++i) { final Integer item = list1.get(i); if (list2.contains(item)) result.add(item); } return result; } private static int[] getSystemWidgetsIds(final Context context) { final ComponentName name = new ComponentName(context.getApplicationContext(), AppWidget.class); return AppWidgetManager.getInstance(context.getApplicationContext()).getAppWidgetIds(name); } private static void updateWidget(final Context context, final int widgetId, final int newRecipeId) { WidgetUtils.updateSelectedRecipe(context, widgetId, newRecipeId); final Map<String, String> map = getWidgetsPrefMap(context); map.put(Integer.toString(widgetId), Integer.toString(newRecipeId)); updateWidgetsPrefMap(context, map); final Disposable d = AppWidget.updateAppWidget(context, AppWidgetManager.getInstance(context), widgetId); if (d != null) disposables.add(d); Toast.makeText(context, R.string.update_widget_success, Toast.LENGTH_LONG).show(); } private static List<WidgetEntry> getPrefWidgetsEntries(final Context context) { final Map<String, String> entriesMap = getWidgetsPrefMap(context); final List<WidgetEntry> widgetEntries = new ArrayList<>(entriesMap.size()); for (final Map.Entry<String, String> e : entriesMap.entrySet()) { final WidgetEntry widgetEntry = new WidgetEntry(); widgetEntry.widgetId = e.getKey(); widgetEntry.recipeId = e.getValue(); widgetEntries.add(widgetEntry); } return widgetEntries; } @NonNull static Map<String, String> getWidgetsPrefMap(final Context context) { final String idsStr = PreferencesUtils.defaultPrefs(context) .getString(PreferencesUtils.KEY_WIDGET_IDS, ""); return stringToMap(idsStr); } private static void updateWidgetsPrefMap(final Context context, final Map<String, String> map) { PreferencesUtils.edit(context, e -> e.putString(PreferencesUtils.KEY_WIDGET_IDS, mapToString(map))); } public static void releaseResources() { if (recipesDisposables != null) recipesDisposables.dispose(); disposables.clear(); } private static List<Integer> toList(final int[] arr) { final List<Integer> list = new ArrayList<>(arr.length); for (final int item : arr) list.add(item); return list; } @NonNull private static String mapToString(final Map<String, String> map) { final StringBuilder builder = new StringBuilder(); for (final Map.Entry<String, String> entry : map.entrySet()) builder.append(entry.getKey()) .append(",,,,") .append(entry.getValue()) .append("||||"); if (builder.length() >= 4) builder.delete(builder.length() - 4, builder.length()); return builder.toString(); } @NonNull private static Map<String, String> stringToMap(final String str) { final Map<String, String> map = new HashMap<>(); final String[] entries = str.split("\\|\\|\\|\\|"); for (final String entry : entries) { final String[] data = entry.split(",,,,"); if (data.length == 2) map.put(data[0], data[1]); } return map; } }
1d962c26253ffd65f05bad3c47f8879bf0ca9c74
fe39a664369d68beb42ad6cc11bb75eab876353e
/tehreer-android/src/main/java/com/mta/tehreer/graphics/GlyphCache.java
79f408dbb22ec7d1f6f60225aa69851d133fb338
[ "Apache-2.0" ]
permissive
lineCode/Tehreer-Android
d0b8c255c6fabbd9a2e9f7c3ca3b05dd65de1a06
9ef14ae21890f36b2cf278b170c78a171b64b98c
refs/heads/master
2023-09-01T05:04:06.928469
2021-10-17T04:13:24
2021-10-17T04:13:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,439
java
/* * Copyright (C) 2016-2021 Muhammad Tayyab Akram * * 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.mta.tehreer.graphics; import android.graphics.Bitmap; import android.graphics.Path; import androidx.annotation.GuardedBy; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.mta.tehreer.internal.util.LruCache; import java.util.HashMap; import java.util.Map; final class GlyphCache extends LruCache<Integer> { // // GlyphImage: // - 1 pointer for bitmap // - 2 integers for left and right // // Size: (1 * 4) + (2 * 4) = 12 // private static final int GLYPH_IMAGE_OVERHEAD = 12; // // Glyph: // - 3 pointers for image, outline and path // - 1 integer for type // // Size: (3 * 4) + (1 * 4) = 16 // private static final int GLYPH_OVERHEAD = 16; private static class DataSegment extends Segment<Integer> { private static final int ESTIMATED_OVERHEAD = GLYPH_IMAGE_OVERHEAD + GLYPH_OVERHEAD + NODE_OVERHEAD; public final @NonNull GlyphRasterizer rasterizer; public DataSegment(@NonNull LruCache<Integer> cache, @NonNull GlyphRasterizer rasterizer) { super(cache); this.rasterizer = rasterizer; } @Override protected int sizeOf(@NonNull Integer key, @NonNull Object value) { GlyphImage glyphImage = ((Glyph) value).getImage(); int size = (glyphImage != null ? GlyphCache.sizeOf(glyphImage.bitmap()) : 0); return size + ESTIMATED_OVERHEAD; } } private static class ImageSegment extends Segment<Integer> { private static final int ESTIMATED_OVERHEAD = GLYPH_IMAGE_OVERHEAD + NODE_OVERHEAD; public ImageSegment(@NonNull LruCache<Integer> cache) { super(cache); } @Override protected int sizeOf(@NonNull Integer key, @NonNull Object value) { return GlyphCache.sizeOf(((GlyphImage) value).bitmap()) + ESTIMATED_OVERHEAD; } } private static class Holder { private static final @NonNull GlyphCache INSTANCE; static { int maxSize = (int) (Runtime.getRuntime().maxMemory() / 8); INSTANCE = new GlyphCache(maxSize); } } private final @NonNull HashMap<GlyphKey, Segment<Integer>> segments = new HashMap<>(); public static @NonNull GlyphCache getInstance() { return Holder.INSTANCE; } private static int sizeOf(@NonNull Bitmap bitmap) { int size = bitmap.getWidth() * bitmap.getHeight(); if (bitmap.getConfig() == Bitmap.Config.ARGB_8888) { size *= 4; } return size; } public GlyphCache(int capacity) { super(capacity); } @Override public void clear() { super.clear(); // Dispose all glyph rasterizers. for (Map.Entry<GlyphKey, Segment<Integer>> entry : segments.entrySet()) { Segment<Integer> value = entry.getValue(); if (value instanceof DataSegment) { DataSegment segment = (DataSegment) value; segment.rasterizer.dispose(); } } segments.clear(); } @GuardedBy("this") private @NonNull DataSegment secureDataSegment(@NonNull GlyphKey key) { DataSegment segment = (DataSegment) segments.get(key); if (segment == null) { GlyphRasterizer rasterizer = new GlyphRasterizer(key); segment = new DataSegment(this, rasterizer); segments.put(key.copy(), segment); } return segment; } @GuardedBy("this") private @NonNull ImageSegment secureImageSegment(@NonNull GlyphKey key) { ImageSegment segment = (ImageSegment) segments.get(key); if (segment == null) { segment = new ImageSegment(this); segments.put(key.copy(), segment); } return segment; } @GuardedBy("this") private @NonNull Glyph secureGlyph(@NonNull DataSegment segment, int glyphId) { Glyph glyph = (Glyph) segment.get(glyphId); if (glyph == null) { glyph = new Glyph(); } return glyph; } private @Nullable GlyphImage getColoredImage(@NonNull GlyphKey.Color key, @NonNull GlyphRasterizer rasterizer, int glyphId) { final ImageSegment segment; GlyphImage coloredImage; synchronized (this) { segment = secureImageSegment(key); coloredImage = (GlyphImage) segment.get(glyphId); } if (coloredImage == null) { coloredImage = rasterizer.getGlyphImage(glyphId, key.foregroundColor); if (coloredImage != null) { synchronized (this) { segment.remove(glyphId); segment.put(glyphId, coloredImage); } } } return coloredImage; } public @Nullable GlyphImage getGlyphImage(@NonNull GlyphAttributes attributes, int glyphId) { final DataSegment segment; final Glyph glyph; synchronized (this) { segment = secureDataSegment(attributes.dataKey()); glyph = secureGlyph(segment, glyphId); } if (!glyph.isLoaded()) { int glyphType = segment.rasterizer.getGlyphType(glyphId); GlyphImage glyphImage = null; if (glyphType != Glyph.TYPE_MIXED) { glyphImage = segment.rasterizer.getGlyphImage(glyphId); } synchronized (this) { if (!glyph.isLoaded()) { segment.remove(glyphId); glyph.setType(glyphType); glyph.setImage(glyphImage); segment.put(glyphId, glyph); } } } if (glyph.getType() == Glyph.TYPE_MIXED) { return getColoredImage(attributes.colorKey(), segment.rasterizer, glyphId); } return glyph.getImage(); } private @Nullable GlyphImage getStrokeImage(@NonNull GlyphKey.Stroke key, @NonNull GlyphRasterizer rasterizer, @NonNull GlyphOutline outline, int glyphId) { final ImageSegment segment; GlyphImage strokeImage; synchronized (this) { segment = secureImageSegment(key); strokeImage = (GlyphImage) segment.get(glyphId); } if (strokeImage == null) { strokeImage = rasterizer.getStrokeImage(outline, key.lineRadius, key.lineCap, key.lineJoin, key.miterLimit); if (strokeImage != null) { synchronized (this) { segment.remove(glyphId); segment.put(glyphId, strokeImage); } } } return strokeImage; } public @Nullable GlyphImage getStrokeImage(@NonNull GlyphAttributes attributes, int glyphId) { final DataSegment segment; final Glyph glyph; synchronized (this) { segment = secureDataSegment(attributes.dataKey()); glyph = secureGlyph(segment, glyphId); } GlyphOutline glyphOutline = glyph.getOutline(); if (glyphOutline == null) { glyphOutline = segment.rasterizer.getGlyphOutline(glyphId); synchronized (this) { if (glyph.getOutline() == null) { segment.remove(glyphId); glyph.setOutline(glyphOutline); segment.put(glyphId, glyph); } } } if (glyphOutline != null) { return getStrokeImage(attributes.strokeKey(), segment.rasterizer, glyphOutline, glyphId); } return null; } public @NonNull Path getGlyphPath(@NonNull GlyphAttributes attributes, int glyphId) { final DataSegment segment; final Glyph glyph; synchronized (this) { segment = secureDataSegment(attributes.dataKey()); glyph = secureGlyph(segment, glyphId); } Path glyphPath = glyph.getPath(); if (glyphPath == null) { glyphPath = segment.rasterizer.getGlyphPath(glyphId); synchronized (this) { if (glyph.getPath() == null) { segment.remove(glyphId); glyph.setPath(glyphPath); segment.put(glyphId, glyph); } } } return glyphPath; } }
1b00441ecf1893ed9d6a5bd6713cbb2bce243942
f87fa090b10a629722d7672f5560048b12bee313
/projects/coordinator/src/org/batfish/coordinator/Settings.java
9b8a5161d69e7c0b58030f0946115cf7090fa8b5
[ "Apache-2.0" ]
permissive
824728350/batfish
9bc76282a54fce33ee45717ec5a5649b2a29e6e5
87db3c9bf22afd1974cc6eb2c2b943c903acee36
refs/heads/master
2021-05-30T22:54:26.833642
2015-12-15T07:17:56
2015-12-15T07:17:56
254,667,639
1
0
Apache-2.0
2020-04-10T15:20:46
2020-04-10T15:20:45
null
UTF-8
Java
false
false
8,713
java
package org.batfish.coordinator; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.batfish.common.CoordConsts; public class Settings { private static final String ARG_INITIAL_WORKER = "initialworker"; private static final String ARG_LOG_FILE = "logfile"; private static final String ARG_PERIOD_ASSIGN_WORK = "periodassignwork"; private static final String ARG_PERIOD_CHECK_WORK = "periodcheckwork"; private static final String ARG_PERIOD_WORKER_STATUS_REFRESH = "periodworkerrefresh"; private static final String ARG_QUEUE_COMPLETED_WORK = "q_completedwork"; private static final String ARG_QUEUE_INCOMPLETE_WORK = "q_incompletework"; private static final String ARG_QUEUE_TYPE = "qtype"; private static final String ARG_SERVICE_HOST = "servicehost"; private static final String ARG_SERVICE_POOL_PORT = "servicepoolport"; private static final String ARG_SERVICE_WORK_PORT = "serviceworkport"; private static final String ARG_STORAGE_ACCOUNT_KEY = "storageaccountkey"; private static final String ARG_STORAGE_ACCOUNT_NAME = "storageaccountname"; private static final String ARG_STORAGE_PROTOCOL = "storageprotocol"; private static final String ARG_TESTRIG_STORAGE_LOCATION = "testrigstorage"; private static final String DEFAULT_INITIAL_WORKER = ""; private static final String DEFAULT_PERIOD_ASSIGN_WORK = "1000"; // 1 seconds private static final String DEFAULT_PERIOD_CHECK_WORK = "5000"; // 5 seconds private static final String DEFAULT_PERIOD_WORKER_STATUS_REFRESH = "10000"; // 10 // seconds private static final String DEFAULT_QUEUE_COMPLETED_WORK = "batfishcompletedwork"; private static final String DEFAULT_QUEUE_INCOMPLETE_WORK = "batfishincompletework"; private static final String DEFAULT_QUEUE_TYPE = "memory"; private static final String DEFAULT_SERVICE_HOST = "0.0.0.0"; private static final String DEFAULT_SERVICE_POOL_PORT = CoordConsts.SVC_POOL_PORT .toString(); private static final String DEFAULT_SERVICE_WORK_PORT = CoordConsts.SVC_WORK_PORT .toString(); private static final String DEFAULT_STORAGE_ACCOUNT_KEY = "zRTT++dVryOWXJyAM7NM0TuQcu0Y23BgCQfkt7xh2f/Mm+r6c8/XtPTY0xxaF6tPSACJiuACsjotDeNIVyXM8Q=="; private static final String DEFAULT_STORAGE_ACCOUNT_NAME = "testdrive"; private static final String DEFAULT_STORAGE_PROTOCOL = "http"; private static final String DEFAULT_TESTRIG_STORAGE_LOCATION = "."; private String _initialWorker; private String _logFile; private Options _options; private long _periodAssignWorkMs; private long _periodCheckWorkMs; private long _periodWorkerStatusRefreshMs; private String _queueCompletedWork; private WorkQueue.Type _queueType; private String _queuIncompleteWork; private String _serviceHost; private int _servicePoolPort; private int _serviceWorkPort; private String _storageAccountKey; private String _storageAccountName; private String _storageProtocol; private String _testrigStorageLocation; public Settings() throws ParseException { this(new String[] {}); } public Settings(String[] args) throws ParseException { initOptions(); parseCommandLine(args); } public String getInitialWorker() { return _initialWorker; } public String getLogFile() { return _logFile; } public long getPeriodAssignWorkMs() { return _periodAssignWorkMs; } public long getPeriodCheckWorkMs() { return _periodCheckWorkMs; } public long getPeriodWorkerStatusRefreshMs() { return _periodWorkerStatusRefreshMs; } public String getQueueCompletedWork() { return _queueCompletedWork; } public String getQueueIncompleteWork() { return _queuIncompleteWork; } public WorkQueue.Type getQueueType() { return _queueType; } public String getServiceHost() { return _serviceHost; } public int getServicePoolPort() { return _servicePoolPort; } public int getServiceWorkPort() { return _serviceWorkPort; } public String getStorageAccountKey() { return _storageAccountKey; } public String getStorageAccountName() { return _storageAccountName; } public String getStorageProtocol() { return _storageProtocol; } public String getTestrigStorageLocation() { return _testrigStorageLocation; } private void initOptions() { _options = new Options(); _options.addOption(Option.builder().argName("port_number_pool_service") .hasArg().desc("port for pool management service") .longOpt(ARG_SERVICE_POOL_PORT).build()); _options.addOption(Option.builder().argName("port_number_work_service") .hasArg().desc("port for work management service") .longOpt(ARG_SERVICE_WORK_PORT).build()); _options.addOption(Option.builder().argName("hostname for the service") .hasArg().desc("base url for coordinator service") .longOpt(ARG_SERVICE_HOST).build()); _options.addOption(Option.builder().argName("qtype").hasArg() .desc("queue type to use {azure, memory}").longOpt(ARG_QUEUE_TYPE) .build()); _options.addOption(Option.builder().argName("testrig_storage_location") .hasArg().desc("where to store test rigs") .longOpt(ARG_TESTRIG_STORAGE_LOCATION).build()); _options.addOption(Option.builder() .argName("period_worker_status_refresh_ms").hasArg() .desc("period with which to check worker status (ms)") .longOpt(ARG_PERIOD_WORKER_STATUS_REFRESH).build()); _options.addOption(Option.builder().argName("period_assign_work_ms") .hasArg().desc("period with which to assign work (ms)") .longOpt(ARG_PERIOD_ASSIGN_WORK).build()); _options.addOption(Option.builder().argName("period_check_work_ms") .hasArg().desc("period with which to check work (ms)") .longOpt(ARG_PERIOD_CHECK_WORK).build()); _options.addOption(Option.builder().argName("path").hasArg() .desc("send output to specified log file").longOpt(ARG_LOG_FILE) .build()); _options.addOption(Option.builder().argName("location_initial_worker") .hasArg().desc("location of initial worker (host:port)") .longOpt(ARG_INITIAL_WORKER).build()); } private void parseCommandLine(String[] args) throws ParseException { CommandLine line = null; CommandLineParser parser = new DefaultParser(); // parse the command line arguments line = parser.parse(_options, args); _queuIncompleteWork = line.getOptionValue(ARG_QUEUE_INCOMPLETE_WORK, DEFAULT_QUEUE_INCOMPLETE_WORK); _queueCompletedWork = line.getOptionValue(ARG_QUEUE_COMPLETED_WORK, DEFAULT_QUEUE_COMPLETED_WORK); _queueType = WorkQueue.Type.valueOf(line.getOptionValue(ARG_QUEUE_TYPE, DEFAULT_QUEUE_TYPE)); _servicePoolPort = Integer.parseInt(line.getOptionValue( ARG_SERVICE_POOL_PORT, DEFAULT_SERVICE_POOL_PORT)); _serviceWorkPort = Integer.parseInt(line.getOptionValue( ARG_SERVICE_WORK_PORT, DEFAULT_SERVICE_WORK_PORT)); _serviceHost = line .getOptionValue(ARG_SERVICE_HOST, DEFAULT_SERVICE_HOST); _storageAccountKey = line.getOptionValue(ARG_STORAGE_ACCOUNT_KEY, DEFAULT_STORAGE_ACCOUNT_KEY); _storageAccountName = line.getOptionValue(ARG_STORAGE_ACCOUNT_NAME, DEFAULT_STORAGE_ACCOUNT_NAME); _storageProtocol = line.getOptionValue(ARG_STORAGE_PROTOCOL, DEFAULT_STORAGE_PROTOCOL); _testrigStorageLocation = line.getOptionValue( ARG_TESTRIG_STORAGE_LOCATION, DEFAULT_TESTRIG_STORAGE_LOCATION); _periodWorkerStatusRefreshMs = Long.parseLong(line.getOptionValue( ARG_PERIOD_WORKER_STATUS_REFRESH, DEFAULT_PERIOD_WORKER_STATUS_REFRESH)); _periodAssignWorkMs = Long.parseLong(line.getOptionValue( ARG_PERIOD_ASSIGN_WORK, DEFAULT_PERIOD_ASSIGN_WORK)); _periodCheckWorkMs = Long.parseLong(line.getOptionValue( ARG_PERIOD_CHECK_WORK, DEFAULT_PERIOD_CHECK_WORK)); _initialWorker = line.getOptionValue(ARG_INITIAL_WORKER, DEFAULT_INITIAL_WORKER); _logFile = line.getOptionValue(ARG_LOG_FILE); } }
[ "wq@wq-OptiPlex-3020M.(none)" ]
wq@wq-OptiPlex-3020M.(none)
824e11806152ab971f2e5c44b4e01fcc87e7a1d0
ccdcc09206e72f95599517663273d7b05b5c45f9
/l13/ub13/complete/movierental.jpa/src/main/java/ch/fhnw/eaf/rental/SecurityConfig.java
9153283cecfc637963c6c0bb4116dc9b33d6ec78
[]
no_license
cintoros/eaf-gradle
50b1a16ecd23b3c23d4c2489520658be39918881
bcb73c18da46e8a3817d2230ec01a2ea47d5b917
refs/heads/master
2023-03-01T18:07:49.751771
2021-02-07T10:55:58
2021-02-07T10:55:58
296,248,078
1
0
null
null
null
null
UTF-8
Java
false
false
1,867
java
package ch.fhnw.eaf.rental; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import static org.springframework.security.config.Customizer.withDefaults; @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // configure authentication auth.inMemoryAuthentication() .withUser("user").password("{noop}user123").roles("USER") .and() .withUser("admin").password("{noop}admin123").roles("USER", "ADMIN"); } @Override protected void configure(HttpSecurity http) throws Exception { // configure http for web services http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); http.formLogin().disable(); http.logout().disable(); http.csrf().disable(); http.httpBasic(withDefaults()); // configure authorization http .authorizeRequests(authorize -> authorize .antMatchers("/swagger-ui/**").hasRole("ADMIN") .antMatchers("/**").hasRole("USER") ); } }
3f88db64982e0f5d5b17d9558957bd1044234bf6
4cfeaf424f78a0f223b56c11d8337599422a70b3
/core/src/test/java/org/pivxj/core/TransactionTest.java
e9f5ea26cf13c427837ed19b3d9a500c2e050e74
[ "Apache-2.0" ]
permissive
kodcoin/kodcoin-java
1ac8bfe54b4dfb471ea31141e0b49b7e13fae23f
6f827374f312d5c2ac4ebfc7e9513fd0cf45f862
refs/heads/master
2020-04-02T10:44:32.640240
2018-10-23T15:28:24
2018-10-23T15:28:24
150,866,917
0
0
null
null
null
null
UTF-8
Java
false
false
16,511
java
/* * Copyright 2014 Google Inc. * Copyright 2016 Andreas Schildbach * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kodj.core; import org.kodj.core.TransactionConfidence.*; import org.kodj.crypto.TransactionSignature; import org.kodj.params.*; import org.kodj.script.*; import org.kodj.testing.*; import org.easymock.*; import org.junit.*; import java.math.BigInteger; import java.util.*; import static org.kodj.core.Utils.HEX; import static org.easymock.EasyMock.*; import static org.junit.Assert.*; /** * Just check the Transaction.verify() method. Most methods that have complicated logic in Transaction are tested * elsewhere, e.g. signing and hashing are well exercised by the wallet tests, the full block chain tests and so on. * The verify method is also exercised by the full block chain tests, but it can also be used by API users alone, * so we make sure to cover it here as well. */ public class TransactionTest { private static final NetworkParameters PARAMS = UnitTestParams.get(); private static final Address ADDRESS = new ECKey().toAddress(PARAMS); private Transaction tx; @Before public void setUp() throws Exception { Context context = new Context(PARAMS); tx = FakeTxBuilder.createFakeTx(PARAMS); } @Test(expected = VerificationException.EmptyInputsOrOutputs.class) public void emptyOutputs() throws Exception { tx.clearOutputs(); tx.verify(); } @Test(expected = VerificationException.EmptyInputsOrOutputs.class) public void emptyInputs() throws Exception { tx.clearInputs(); tx.verify(); } @Test(expected = VerificationException.LargerThanMaxBlockSize.class) public void tooHuge() throws Exception { tx.getInput(0).setScriptBytes(new byte[Block.MAX_BLOCK_SIZE]); tx.verify(); } @Test(expected = VerificationException.DuplicatedOutPoint.class) public void duplicateOutPoint() throws Exception { TransactionInput input = tx.getInput(0); input.setScriptBytes(new byte[1]); tx.addInput(input.duplicateDetached()); tx.verify(); } @Test(expected = VerificationException.NegativeValueOutput.class) public void negativeOutput() throws Exception { tx.getOutput(0).setValue(Coin.NEGATIVE_SATOSHI); tx.verify(); } @Test(expected = VerificationException.ExcessiveValue.class) public void exceedsMaxMoney2() throws Exception { Coin half = PARAMS.getMaxMoney().divide(2).add(Coin.SATOSHI); tx.getOutput(0).setValue(half); tx.addOutput(half, ADDRESS); tx.verify(); } @Test(expected = VerificationException.UnexpectedCoinbaseInput.class) public void coinbaseInputInNonCoinbaseTX() throws Exception { tx.addInput(Sha256Hash.ZERO_HASH, 0xFFFFFFFFL, new ScriptBuilder().data(new byte[10]).build()); tx.verify(); } @Test(expected = VerificationException.CoinbaseScriptSizeOutOfRange.class) public void coinbaseScriptSigTooSmall() throws Exception { tx.clearInputs(); tx.addInput(Sha256Hash.ZERO_HASH, 0xFFFFFFFFL, new ScriptBuilder().build()); tx.verify(); } @Test(expected = VerificationException.CoinbaseScriptSizeOutOfRange.class) public void coinbaseScriptSigTooLarge() throws Exception { tx.clearInputs(); TransactionInput input = tx.addInput(Sha256Hash.ZERO_HASH, 0xFFFFFFFFL, new ScriptBuilder().data(new byte[99]).build()); assertEquals(101, input.getScriptBytes().length); tx.verify(); } @Test public void testEstimatedLockTime_WhenParameterSignifiesBlockHeight() { int TEST_LOCK_TIME = 20; Date now = Calendar.getInstance().getTime(); BlockChain mockBlockChain = createMock(BlockChain.class); EasyMock.expect(mockBlockChain.estimateBlockTime(TEST_LOCK_TIME)).andReturn(now); Transaction tx = FakeTxBuilder.createFakeTx(PARAMS); tx.setLockTime(TEST_LOCK_TIME); // less than five hundred million replay(mockBlockChain); assertEquals(tx.estimateLockTime(mockBlockChain), now); } @Test public void testOptimalEncodingMessageSize() { Transaction tx = new Transaction(PARAMS); int length = tx.length; // add basic transaction input, check the length tx.addOutput(new TransactionOutput(PARAMS, null, Coin.COIN, ADDRESS)); length += getCombinedLength(tx.getOutputs()); // add basic output, check the length length += getCombinedLength(tx.getInputs()); // optimal encoding size should equal the length we just calculated assertEquals(tx.getOptimalEncodingMessageSize(), length); } private int getCombinedLength(List<? extends Message> list) { int sumOfAllMsgSizes = 0; for (Message m: list) { sumOfAllMsgSizes += m.getMessageSize() + 1; } return sumOfAllMsgSizes; } @Test public void testIsMatureReturnsFalseIfTransactionIsCoinbaseAndConfidenceTypeIsNotEqualToBuilding() { Transaction tx = FakeTxBuilder.createFakeCoinbaseTx(PARAMS); tx.getConfidence().setConfidenceType(ConfidenceType.UNKNOWN); assertEquals(tx.isMature(), false); tx.getConfidence().setConfidenceType(ConfidenceType.PENDING); assertEquals(tx.isMature(), false); tx.getConfidence().setConfidenceType(ConfidenceType.DEAD); assertEquals(tx.isMature(), false); } @Test public void testCLTVPaymentChannelTransactionSpending() { BigInteger time = BigInteger.valueOf(20); ECKey from = new ECKey(), to = new ECKey(), incorrect = new ECKey(); Script outputScript = ScriptBuilder.createCLTVPaymentChannelOutput(time, from, to); Transaction tx = new Transaction(PARAMS); tx.addInput(new TransactionInput(PARAMS, tx, new byte[] {})); tx.getInput(0).setSequenceNumber(0); tx.setLockTime(time.subtract(BigInteger.ONE).longValue()); TransactionSignature fromSig = tx.calculateSignature(0, from, outputScript, Transaction.SigHash.SINGLE, false); TransactionSignature toSig = tx.calculateSignature(0, to, outputScript, Transaction.SigHash.SINGLE, false); TransactionSignature incorrectSig = tx.calculateSignature(0, incorrect, outputScript, Transaction.SigHash.SINGLE, false); Script scriptSig = ScriptBuilder.createCLTVPaymentChannelInput(fromSig, toSig); Script refundSig = ScriptBuilder.createCLTVPaymentChannelRefund(fromSig); Script invalidScriptSig1 = ScriptBuilder.createCLTVPaymentChannelInput(fromSig, incorrectSig); Script invalidScriptSig2 = ScriptBuilder.createCLTVPaymentChannelInput(incorrectSig, toSig); try { scriptSig.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); } catch (ScriptException e) { e.printStackTrace(); fail("Settle transaction failed to correctly spend the payment channel"); } try { refundSig.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); fail("Refund passed before expiry"); } catch (ScriptException e) { } try { invalidScriptSig1.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); fail("Invalid sig 1 passed"); } catch (ScriptException e) { } try { invalidScriptSig2.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); fail("Invalid sig 2 passed"); } catch (ScriptException e) { } } @Test public void testCLTVPaymentChannelTransactionRefund() { BigInteger time = BigInteger.valueOf(20); ECKey from = new ECKey(), to = new ECKey(), incorrect = new ECKey(); Script outputScript = ScriptBuilder.createCLTVPaymentChannelOutput(time, from, to); Transaction tx = new Transaction(PARAMS); tx.addInput(new TransactionInput(PARAMS, tx, new byte[] {})); tx.getInput(0).setSequenceNumber(0); tx.setLockTime(time.add(BigInteger.ONE).longValue()); TransactionSignature fromSig = tx.calculateSignature(0, from, outputScript, Transaction.SigHash.SINGLE, false); TransactionSignature incorrectSig = tx.calculateSignature(0, incorrect, outputScript, Transaction.SigHash.SINGLE, false); Script scriptSig = ScriptBuilder.createCLTVPaymentChannelRefund(fromSig); Script invalidScriptSig = ScriptBuilder.createCLTVPaymentChannelRefund(incorrectSig); try { scriptSig.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); } catch (ScriptException e) { e.printStackTrace(); fail("Refund failed to correctly spend the payment channel"); } try { invalidScriptSig.correctlySpends(tx, 0, outputScript, Script.ALL_VERIFY_FLAGS); fail("Invalid sig passed"); } catch (ScriptException e) { } } @Test public void testToStringWhenLockTimeIsSpecifiedInBlockHeight() { Transaction tx = FakeTxBuilder.createFakeTx(PARAMS); TransactionInput input = tx.getInput(0); input.setSequenceNumber(42); int TEST_LOCK_TIME = 20; tx.setLockTime(TEST_LOCK_TIME); Calendar cal = Calendar.getInstance(); cal.set(2085, 10, 4, 17, 53, 21); cal.set(Calendar.MILLISECOND, 0); BlockChain mockBlockChain = createMock(BlockChain.class); EasyMock.expect(mockBlockChain.estimateBlockTime(TEST_LOCK_TIME)).andReturn(cal.getTime()); replay(mockBlockChain); String str = tx.toString(mockBlockChain); assertEquals(str.contains("block " + TEST_LOCK_TIME), true); assertEquals(str.contains("estimated to be reached at"), true); } @Test public void testToStringWhenIteratingOverAnInputCatchesAnException() { Transaction tx = FakeTxBuilder.createFakeTx(PARAMS); TransactionInput ti = new TransactionInput(PARAMS, tx, new byte[0]) { @Override public Script getScriptSig() throws ScriptException { throw new ScriptException(""); } }; tx.addInput(ti); assertEquals(tx.toString().contains("[exception: "), true); } @Test public void testToStringWhenThereAreZeroInputs() { Transaction tx = new Transaction(PARAMS); assertEquals(tx.toString().contains("No inputs!"), true); } @Test public void testTheTXByHeightComparator() { Transaction tx1 = FakeTxBuilder.createFakeTx(PARAMS); tx1.getConfidence().setAppearedAtChainHeight(1); Transaction tx2 = FakeTxBuilder.createFakeTx(PARAMS); tx2.getConfidence().setAppearedAtChainHeight(2); Transaction tx3 = FakeTxBuilder.createFakeTx(PARAMS); tx3.getConfidence().setAppearedAtChainHeight(3); SortedSet<Transaction> set = new TreeSet<Transaction>(Transaction.SORT_TX_BY_HEIGHT); set.add(tx2); set.add(tx1); set.add(tx3); Iterator<Transaction> iterator = set.iterator(); assertEquals(tx1.equals(tx2), false); assertEquals(tx1.equals(tx3), false); assertEquals(tx1.equals(tx1), true); assertEquals(iterator.next().equals(tx3), true); assertEquals(iterator.next().equals(tx2), true); assertEquals(iterator.next().equals(tx1), true); assertEquals(iterator.hasNext(), false); } @Test(expected = ScriptException.class) public void testAddSignedInputThrowsExceptionWhenScriptIsNotToRawPubKeyAndIsNotToAddress() { ECKey key = new ECKey(); Address addr = key.toAddress(PARAMS); Transaction fakeTx = FakeTxBuilder.createFakeTx(PARAMS, Coin.COIN, addr); Transaction tx = new Transaction(PARAMS); tx.addOutput(fakeTx.getOutput(0)); Script script = ScriptBuilder.createOpReturnScript(new byte[0]); tx.addSignedInput(fakeTx.getOutput(0).getOutPointFor(), script, key); } @Test public void testPrioSizeCalc() throws Exception { Transaction tx1 = FakeTxBuilder.createFakeTx(PARAMS, Coin.COIN, ADDRESS); int size1 = tx1.getMessageSize(); int size2 = tx1.getMessageSizeForPriorityCalc(); assertEquals(113, size1 - size2); tx1.getInput(0).setScriptSig(new Script(new byte[109])); assertEquals(78, tx1.getMessageSizeForPriorityCalc()); tx1.getInput(0).setScriptSig(new Script(new byte[110])); assertEquals(78, tx1.getMessageSizeForPriorityCalc()); tx1.getInput(0).setScriptSig(new Script(new byte[111])); assertEquals(79, tx1.getMessageSizeForPriorityCalc()); } @Test public void testCoinbaseHeightCheck() throws VerificationException { // Coinbase transaction from block 300,000 final byte[] transactionBytes = HEX.decode("01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4803e09304062f503253482f0403c86d53087ceca141295a00002e522cfabe6d6d7561cf262313da1144026c8f7a43e3899c44f6145f39a36507d36679a8b7006104000000000000000000000001c8704095000000001976a91480ad90d403581fa3bf46086a91b2d9d4125db6c188ac00000000"); final int height = 300000; final Transaction transaction = PARAMS.getDefaultSerializer().makeTransaction(transactionBytes); transaction.checkCoinBaseHeight(height); } /** * Test a coinbase transaction whose script has nonsense after the block height. * See https://github.com/bitcoinj/bitcoinj/issues/1097 */ @Test public void testCoinbaseHeightCheckWithDamagedScript() throws VerificationException { // Coinbase transaction from block 224,430 final byte[] transactionBytes = HEX.decode( "010000000100000000000000000000000000000000000000000000000000000000" + "00000000ffffffff3b03ae6c0300044bd7031a0400000000522cfabe6d6d0000" + "0000000000b7b8bf0100000068692066726f6d20706f6f6c7365727665726aac" + "1eeeed88ffffffff01e0587597000000001976a91421c0d001728b3feaf11551" + "5b7c135e779e9f442f88ac00000000"); final int height = 224430; final Transaction transaction = PARAMS.getDefaultSerializer().makeTransaction(transactionBytes); transaction.checkCoinBaseHeight(height); } @Test public void optInFullRBF() { // a standard transaction as wallets would create Transaction tx = FakeTxBuilder.createFakeTx(PARAMS); assertFalse(tx.isOptInFullRBF()); tx.getInputs().get(0).setSequenceNumber(TransactionInput.NO_SEQUENCE - 2); assertTrue(tx.isOptInFullRBF()); } /** * Ensure that hashForSignature() doesn't modify a transaction's data, which could wreak multithreading havoc. */ @Test public void testHashForSignatureThreadSafety() { Block genesis = UnitTestParams.get().getGenesisBlock(); Block block1 = genesis.createNextBlock(new ECKey().toAddress(UnitTestParams.get()), genesis.getTransactions().get(0).getOutput(0).getOutPointFor()); final Transaction tx = block1.getTransactions().get(1); final String txHash = tx.getHashAsString(); final String txNormalizedHash = tx.hashForSignature(0, new byte[0], Transaction.SigHash.ALL.byteValue()).toString(); for (int i = 0; i < 100; i++) { // ensure the transaction object itself was not modified; if it was, the hash will change assertEquals(txHash, tx.getHashAsString()); new Thread(){ public void run() { assertEquals(txNormalizedHash, tx.hashForSignature(0, new byte[0], Transaction.SigHash.ALL.byteValue()).toString()); } }; } } }
ff9d628e6c5cc318d922bd05f982bcf1c802abfe
1510229826bc8ba9f6e41e559dade31b66e9c691
/com/sun/corba/se/spi/activation/BadServerDefinition.java
dc4f11d30c58426575ac5265d796721ad77d4ff9
[]
no_license
sld880311/JavaSource1.8
9d8fffef8c343ac948b930cd1cf65c3d73e9eb2f
e4765b33c3a1be7c169be613214aa416588136d7
refs/heads/master
2023-03-05T04:07:30.814031
2021-02-16T12:52:21
2021-02-16T12:52:21
265,713,897
0
0
null
null
null
null
UTF-8
Java
false
false
913
java
package com.sun.corba.se.spi.activation; /** * com/sun/corba/se/spi/activation/BadServerDefinition.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/workspace/8-2-build-windows-amd64-cygwin/jdk8u192/11897/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl * Saturday, October 6, 2018 5:13:58 PM PDT */ public final class BadServerDefinition extends org.omg.CORBA.UserException { public String reason = null; public BadServerDefinition () { super(BadServerDefinitionHelper.id()); } // ctor public BadServerDefinition (String _reason) { super(BadServerDefinitionHelper.id()); reason = _reason; } // ctor public BadServerDefinition (String $reason, String _reason) { super(BadServerDefinitionHelper.id() + " " + $reason); reason = _reason; } // ctor } // class BadServerDefinition
4f1c379ce55e44d7abec13291bcff56cbd84bd30
238ae6dc7ea16182423d860090a6087f8daa30d9
/EcpliseJava_201103/HeroGame/src/charactor1/Support.java
c1b94b2b773fa741f3db6ea03bee4c60cfbed310
[]
no_license
laterspace/EcpliseJavaGit
1a7ac7c2c284b3935809e7bc1c9ac56997e42acd
28323c7e8bafb7357fdcb4e53800f7e6f2276d3a
refs/heads/master
2023-02-14T23:48:59.670904
2021-01-09T08:09:49
2021-01-09T08:09:49
308,789,034
0
0
null
null
null
null
GB18030
Java
false
false
909
java
package charactor1; import charactor.Healer; import charactor.Hero; public class Support extends Hero implements Healer{ @Override public void heal() { // TODO Auto-generated method stub System.out.println("进行治疗"); } // public void heal(Hero h) { // System.out.println(name + "给了" + h.name + "治疗"); // } // // public void heal(Hero... heros) { // for (int i = 0; i < heros.length; i++) { // System.out.println(name + "治疗了" + heros[i].name); // } // } // // public void heal(Hero h, int hp) { // System.out.println(name + "给" + h.name + "加了" + hp + "hp"); // } // // public static void main(String[] args) { // Support s = new Support(); // s.name = "赏金猎人"; // // Hero h3 = new Hero(); // h3.name = "盖伦"; // Hero h2 = new Hero(); // h2.name = "提莫"; // // s.heal(h2); // s.heal(h3, 0); // s.heal(h2,h3); // // } }
91b1183d1618923422a6769c0c0bb6a8a8555336
c00782476818ce25b3b97e54713ece23b2b658fb
/Basics/src/com/demo/arrays/basic/Mcq.java
68a9ba59d2f8fd00ff6a82b967e64d8a3ab453f6
[]
no_license
ankittyagiji/Projects
3cfd81595608ab14284f096a250709b5cb8968da
85e3cd51ed3c839783ad61a63346346b29539c3e
refs/heads/master
2023-08-15T00:57:20.569684
2021-09-28T11:01:29
2021-09-28T11:04:32
406,280,569
0
0
null
null
null
null
UTF-8
Java
false
false
195
java
package com.demo.arrays.basic; public class Mcq { public static void main(String[] args) { int i=10; System.out.println(i); System.out.println(++i); System.out.println(i++); } }
9fd024530c02b46baa368b30bef76715cd20c625
21aa975248bce2d7b02ee57199b10692c25b625d
/jAnalyser/src/main/java/sissel/classinfo/IClass.java
85ac7a7f935c7c2a537ee6781e0fb320985d4494
[]
no_license
Sissel-Wu/JAnalyser
054d71e0ed718cd69ade340893a0d90f1df89b91
5f47dddb21f9fef4f646534d4872ec35eaca0f6e
refs/heads/master
2021-01-19T04:58:06.790026
2016-08-09T08:54:30
2016-08-09T08:54:30
61,532,986
0
0
null
null
null
null
UTF-8
Java
false
false
236
java
package sissel.classinfo; /** * 运行时类信息的接口 * Created by Sissel on 2016/8/1. */ public interface IClass { public Object getItem(int index); public MethodInfo getMethodInfo(String name, String descriptor); }
d49b318b6250e7788475435d29af4fa5e0d52dab
5387cb4628b8614ebaa99a125d3b4c4ef4e87d69
/easy-web3/src/pe/com/bbva/mantenimiento/dao/impl/ParametroDAOImpl.java
442793955fb5810e0c824d25a17c525b3bdc5c83
[]
no_license
zachjpcrve/jeasywebPruebas
6768d8736fd75dfaed9837e279c2331eddcac97e
2529c1c811709d240170b0befc78abc94da41fd5
refs/heads/master
2021-01-10T01:42:59.153412
2015-08-10T22:15:10
2015-08-10T22:15:10
36,381,730
0
0
null
null
null
null
UTF-8
Java
false
false
1,753
java
package pe.com.bbva.mantenimiento.dao.impl; import java.util.List; import org.apache.log4j.Logger; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pe.com.bbva.core.dao.GenericDAOImpl; import pe.com.bbva.core.exceptions.BOException; import pe.com.bbva.core.exceptions.DAOException; import pe.com.bbva.mantenimiento.dao.ParametroDAO; import pe.com.bbva.mantenimiento.domain.Parametro; @Service("parametroDAO") public class ParametroDAOImpl extends GenericDAOImpl<Parametro> implements ParametroDAO{ private Logger logger = Logger.getLogger(this.getClass()); @Autowired public ParametroDAOImpl(SessionFactory sessionFactory) { super(sessionFactory); } public List<Parametro> findParametros(Parametro parametro)throws BOException, DAOException { String where = " where upper(descripcion) like upper('%" + (parametro.getDescripcion()== null?"":parametro.getDescripcion())+ "%')"; if(parametro.getCodigo()!= null && !parametro.getCodigo().equals("")){ where = where +" and upper(codigo) like upper('%" + parametro.getCodigo()+ "%') "; } if(parametro.getValor()!= null && !parametro.getValor().equals("")){ where = where +" and upper(valor) like upper('%" + parametro.getValor()+ "%') "; } if(parametro.getEstado()!= null && !parametro.getEstado().equals("")){ where = where +" and upper(estado) like upper('%" + parametro.getEstado()+ "%') "; } String orders = " order by fechaCreacion desc,codigo, descripcion"; List<Parametro> listaParametros = super.executeQuery(Parametro.class,where,orders); return listaParametros; } }
383cbe296c38cd79b5f1a84d29761dbe5a62e264
fa0be57841688e9f691284ba59665d47fd923ccd
/src/tests/TestCase.java
9f773c2f02a4d7ca94a1abc502bef54cc75c581f
[]
no_license
Djekkoo/IntegratedProject
8f5dfc1f5b4308637a0eb5e0e79b0bb81d9a76e4
202e58c3daf5185debbbea00a29c67526ddacb19
refs/heads/master
2016-09-06T10:32:44.397717
2014-04-17T12:29:53
2014-04-17T12:29:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,620
java
package tests; /** * @author Florian Fikkert <[email protected]> * @version 0.1 * @since 2014-04-07 */ public abstract class TestCase { private String description; private boolean isPrinted; protected int errors; abstract protected int runTest(); abstract protected void setUp(); /** * Fixeert de beschrijving van de huidige testmethode. * @param text de te printen beschrijving */ protected void startTest(String text) { description = text; // de beschrijving is nog niet geprint isPrinted = false; } /** * Test of de werkelijke waarde van een geteste expressie * overeenkomt met de verwacht (correcte) waarde. * Deze implementatie print beide waarden, plus een aanduiding van * wat er getest is, op de standaarduitvoer: het programma voert * geen vergelijking uit. */ protected void assertEquals(String tekst, Object verwacht, Object werkelijk) { boolean gelijk; if (verwacht == null) { gelijk = werkelijk == null; } else { gelijk = werkelijk != null && verwacht.equals(werkelijk); } if (! gelijk) { if (! isPrinted) { System.out.println(" Test: "+description); isPrinted = true; } System.out.println(" " + tekst); System.out.println(" Expected: " + verwacht); System.out.println(" Reality: " + werkelijk); errors++; } } }
b54c2d39b4df5ef9c1c1ef82a8b0b26a82440803
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5738606668808192_1/java/luras/Main.java
b2e585ed7801cb89eea819519afa167ee062d3ab
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Java
false
false
1,819
java
import java.math.*; import java.util.*; public class Main { static int n; static int num = 0; static BigInteger b[][] = new BigInteger [40][40]; static int a[] = new int [40]; static BigInteger ans[] = new BigInteger [40]; static int m; public static void main(String [] args){ Scanner cin = new Scanner(System.in); int casei = cin.nextInt(); System.out.println("Case #1:"); n = cin.nextInt(); m = cin.nextInt(); for(int i = 2; i <= 10; i ++){ b[i][0] = BigInteger.valueOf(1); for(int j = 1; j <= 32; j ++){ BigInteger tmp = BigInteger.valueOf(i); b[i][j] = b[i][j - 1].multiply(tmp); } } num = 0; a[0] = 1; a[n - 1] = 1; dfs(1); System.out.println(num); } static void dfs(int step){ if(num == m) return; if(step == n - 1){ int i; for(i = 2; i <= 10; i ++){ BigInteger tmp = BigInteger.valueOf(0); for(int j = 0; j < 32; j ++){ if(a[j] == 1) tmp = tmp.add(b[i][j]); } int flag = 0; BigInteger j = BigInteger.valueOf(2); BigInteger one = BigInteger.valueOf(1); BigInteger zero = BigInteger.valueOf(0); BigInteger INF = BigInteger.valueOf(10000); for(; j.multiply(j).compareTo(tmp) <= 0 && j.compareTo(INF) <= 0; j = j.add(one)){ if(tmp.mod(j).compareTo(zero) == 0){ ans[i] = j; flag = 1; break; } } if(flag == 0) break; } if(i == 11){ num ++; for(int j = 31; j >= 0; j --) System.out.print(a[j]); for(int j = 2; j <= 10; j ++) System.out.print(" " + ans[j]); System.out.println(); } return; } a[step] = 0; dfs(step + 1); a[step] = 1; dfs(step + 1); } } /* 这里本来想要用程序写来计算置换群中循环个数的,但是有点麻烦,可以直接手工计算。- - * 喔... * 题目中还有说到反射。再讨论一下。 */
06fa5300f5198c043337506e9c628406ffc8cb5f
16057e599ea3f1e182110d9333eb5542953fbc7f
/app/src/main/java/com/example/project/shopanywhere/AdminActivity.java
4fcc1b5d9ee39c26f83804f620a9d0a281abc677
[]
no_license
Sifdon/ShopAnywhere
5f44c50cedf86603afe0b8ab9d47567ceb3ba30c
dd74c02e180c64a845b18e36c1fa51f37c6fb3d7
refs/heads/master
2020-03-20T21:00:38.823789
2017-09-18T22:48:04
2017-09-18T22:48:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,646
java
package com.example.project.shopanywhere; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v7.app.ActionBar; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import com.example.project.shopanywhere.R; import com.example.project.shopanywhere.fragments.AddNewAdmin; import com.example.project.shopanywhere.fragments.AddStore; import com.example.project.shopanywhere.fragments.AddStoreItem; import com.example.project.shopanywhere.fragments.ManageAdmin; import com.example.project.shopanywhere.fragments.ManageItem; import com.example.project.shopanywhere.fragments.ManageStore; public class AdminActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private ActionBar bar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_admin); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); bar = getSupportActionBar(); bar.setTitle("Add Store"); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); getSupportFragmentManager().beginTransaction().add(R.id.container,new AddStore()).commit(); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.addstore) SwapFragment(new AddStore(),"Add Store"); else if (id == R.id.additem) SwapFragment(new AddStoreItem(),"Add Item"); else if (id == R.id.manageitems) SwapFragment(new ManageItem(),"Manage Item"); else if (id == R.id.managestore) SwapFragment(new ManageStore(),"Manage Store"); else if(id == R.id.addadmin) SwapFragment(new AddNewAdmin(),"Add Admin"); else if(id == R.id.manageAdmin) SwapFragment(new ManageAdmin(),"Manage Admin"); else finish(); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } private void SwapFragment(Fragment fragment,String name){ getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment).commit(); bar.setTitle(name); } }
[ "Adeyemo Adeolu" ]
Adeyemo Adeolu
0412194e2784962646da8e9fe5069d5f0b7ce0a7
efbd3b43dfd9947651a8d3e4223c4f7ea453860d
/src/templateMethodPattern/Kathleen.java
e2b4a0fbdd799ee99727d87a9a6b40fa411301cc
[]
no_license
RandomFrequentFlyerDent/design_patterns
23a55576f1586480b2baa29b631c8192f7ef2024
0eaad06460284cc15a555d1b2b6dc503a14adf04
refs/heads/master
2020-04-11T08:51:03.413679
2018-12-16T18:45:28
2018-12-16T18:45:28
161,657,900
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
package templateMethodPattern; public class Kathleen extends K3Lid { public Kathleen() { this.naam = "Kathleen"; } @Override protected void doeMakeUpOp() { System.out.println(naam + " doet blauwe oogschaduw op"); } @Override protected void doeHaar() { System.out.println(naam + " maakt staartjes"); } }
674f8ad438ebae1d37b09da58794bc20a5b47ae3
3e4dc43ec622381afe3a2bd9f7f207ed7ed9cb2c
/src/main/java/com/maigo/cloud/dao/BasicDAO.java
60799db16783f96f1e41264636dd223fd8690871
[]
no_license
maigo-uestc/MaigoCloudService-server
9e87bb6486b4ec45ee923f92064efd607b8bc334
e57bb0b3ed60e680ba026b3b00b8fa3b0023b986
refs/heads/master
2021-01-10T07:48:14.976496
2016-03-01T11:28:02
2016-03-01T11:28:02
52,868,473
1
2
null
null
null
null
UTF-8
Java
false
false
487
java
package com.maigo.cloud.dao; import org.hibernate.Session; import org.hibernate.SessionFactory; public class BasicDAO { private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } protected Session getCurrentSession() { return sessionFactory.getCurrentSession(); } }