blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
9b607e6a16f9acb6682ab47b6c99000a1b2f9bef
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1111/u-11-111-1111-f4598.java
c0379bb17514d4424b0226a8b5301cb705714c0c
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 2648128479437
[ "jenkins@khan.paloaltonetworks.local" ]
jenkins@khan.paloaltonetworks.local
fb29d5b8f63f021b849237d153ff54111616e5e8
4e0755c99d28ac44aaeea265c397ff41365434d4
/FileOperations/src/filedetails/FileDetails.java
141bbca7f62e0a8bafbe7002bd568e6194346da3
[]
no_license
piyush14/eclipseProjects
62514734ad8f5c5762c840c61d3dc812818663dd
e390f60521e73bdcb2934f130ef12446d5f05946
refs/heads/master
2021-01-11T06:33:47.367463
2016-11-07T14:51:35
2016-11-07T14:51:35
71,875,113
0
0
null
null
null
null
UTF-8
Java
false
false
523
java
package filedetails; import java.io.File; import java.io.IOException; public class FileDetails { String path = "D:/study/StudyMaterial"; public void showDetails(File dir) throws IOException{ File currentDir = new File("."); File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { System.out.println("directory:" + file.getName() + file.getTotalSpace()); showDetails(file); } else { System.out.println(" file:" + file.getName()+ file.getTotalSpace()); } } } }
[ "piyushmulik14@gmail.com" ]
piyushmulik14@gmail.com
d72bc77213bd14ef3c699f47db70e1c58cf50b1b
44c38865fe9fbc9b0a65a0d57a129503935d47f6
/api/src/main/com/others/zxing/client/android/camera/open/CameraFacing.java
193165f23a99c9b72c773a0a65913cddecd5391d
[]
no_license
linurm/zt
38266f87f9ba96719c7c6547e7c8fa9095331ad7
4e91233fe944404eac0c981a75d5517b2eebfe49
refs/heads/master
2021-01-17T02:32:23.388711
2018-06-03T07:17:57
2018-06-03T07:17:57
54,465,549
2
0
null
null
null
null
UTF-8
Java
false
false
746
java
/* * Copyright (C) 2015 ZXing 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 com.others.zxing.client.android.camera.open; public enum CameraFacing { BACK, // must be value 0! FRONT, // must be value 1! }
[ "343600434@qq.com" ]
343600434@qq.com
2eb9fb697f530e3278126cbba547c29122541afd
8bc0f387a131507aa71127aa7874b47a9f2d5947
/src/main/java/Abstract_Factory/Trees/JapaneseMaple.java
9f582d3ed506751da85ba115b4b235d348e2bc9c
[]
no_license
mohammad-fattah/SE_LAB_4
a12a11a8db3a0b38e26b95a595681f67890ded10
0e9ec6789fbc42caf40d2d46f44de66ebcdae067
refs/heads/main
2023-08-26T00:00:47.508850
2021-11-09T18:22:40
2021-11-09T18:22:40
426,329,659
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
package Abstract_Factory.Trees; public class JapaneseMaple implements Tree { @Override public String getTree() { return "Japanese Maple"; } }
[ "m.p.fattahpour@gmail.com" ]
m.p.fattahpour@gmail.com
58d15254de3b796c22693430b6cd595f0f66e444
249d2ec159a37488ecdf22b3f7ac0d7c5426c651
/gchbpm - 副本/src/main/java/org/jeecgframework/tag/core/easyui/DataGridDefOptTag.java
b28ee44ee17a2f0897b61de3189e74745c67ba57
[]
no_license
chenxh23/sell
a3d38390bd68074fa7d5854a0a9033ba1005b150
a3e91ad9bacb189625c8427db54f579bd005463e
refs/heads/master
2022-11-09T22:13:17.182490
2018-01-19T09:05:46
2018-01-19T09:05:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package org.jeecgframework.tag.core.easyui; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.Tag; import javax.servlet.jsp.tagext.TagSupport; /** * * 类描述:列表默认操作项标签 * * * @date: 日期:2012-12-7 时间:上午10:17:45 * @version 1.0 */ public class DataGridDefOptTag extends TagSupport { protected String url; protected String title; private String exp;//判断链接是否显示的表达式 private String operationCode;//按钮的操作Code private String urlStyle;//样式 public int doStartTag() throws JspTagException { return EVAL_PAGE; } public int doEndTag() throws JspTagException { Tag t = findAncestorWithClass(this, DataGridTag.class); DataGridTag parent = (DataGridTag) t; parent.setDefUrl(url, title, exp,operationCode,urlStyle); return EVAL_PAGE; } public void setExp(String exp) { this.exp = exp; } public void setUrl(String url) { this.url = url; } public void setTitle(String title) { this.title = title; } public void setOperationCode(String operationCode) { this.operationCode = operationCode; } public void setUrlStyle(String urlStyle) { this.urlStyle = urlStyle; } public String getUrlStyle() { return urlStyle; } }
[ "cxh231196@163.com" ]
cxh231196@163.com
0023e074ce65a6f981b3200e2aa548daa1371820
242a20f49f7ac7a1feca89323ed0e834656e740c
/SimonSays/src/SimonSays.java
d1cab488f3c4560d087341390a831ead2482973c
[]
no_license
agatapouglof/Java
16db437c536a5be257be2308eb83dd4a6cdc2686
c8d154bb281aefdbe4ac07d6561f75c744a4b663
refs/heads/master
2021-01-20T03:16:53.469563
2017-05-11T20:06:28
2017-05-11T20:06:28
89,518,267
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
import java.util.*; public class SimonSays { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int nbr = sc.nextInt(); sc.skip("[\r\n]+"); String test; String phrase; // sc.nextLine(); for(int i=0;i<nbr;i++){ phrase = sc.nextLine(); if(phrase.length() >10){ test = phrase.substring(0,10); // System.out.println(test); if(test.equals("simon says")){ phrase = phrase.substring(11,phrase.length()); System.out.println(phrase); }else{ System.out.println(); } }else{ System.out.println(); } } } }
[ "ndj001@dev" ]
ndj001@dev
0745eff762fdbc111bd37d257ae4ebddc706b254
3f3a020d171a8b80171e48698fb5c13ca592e66b
/java_lab4_and_5_and_6/src/FractalGenerator.java
217a35badcb4db62918d7fe4ac17f6d965901e5a
[]
no_license
ArickLP/laboratory
7ea685862ca63588295dd683a2054b799b8187a8
f6c305beda82f64e19d525dcd42a96ae454092a7
refs/heads/main
2023-02-04T03:58:28.043963
2020-12-14T00:55:31
2020-12-14T00:55:31
318,359,981
0
0
null
null
null
null
UTF-8
Java
false
false
2,509
java
import java.awt.geom.Rectangle2D; /** * This class provides the common interface and operations for fractal * generators that can be viewed in the Fractal Explorer. */ public abstract class FractalGenerator { /** * This static helper function takes an integer coordinate and converts it * into a double-precision value corresponding to a specific range. It is * used to convert pixel coordinates into double-precision values for * computing fractals, etc. * * @param rangeMin the minimum value of the floating-point range * @param rangeMax the maximum value of the floating-point range * * @param size the size of the dimension that the pixel coordinate is from. * For example, this might be the image width, or the image height. * * @param coord the coordinate to compute the double-precision value for. * The coordinate should fall in the range [0, size]. */ public static double getCoord(double rangeMin, double rangeMax, int size, int coord) { assert size > 0; assert coord >= 0 && coord < size; double range = rangeMax - rangeMin; return rangeMin + (range * (double) coord / (double) size); } /** * Sets the specified rectangle to contain the initial range suitable for * the fractal being generated. */ public abstract void getInitialRange(Rectangle2D.Double range); /** * Updates the current range to be centered at the specified coordinates, * and to be zoomed in or out by the specified scaling factor. */ public static void recenterAndZoomRange(Rectangle2D.Double range, double centerX, double centerY, double scale) { double newWidth = range.width * scale; double newHeight = range.height * scale; range.x = centerX - newWidth / 2; range.y = centerY - newHeight / 2; range.width = newWidth; range.height = newHeight; } /** * Given a coordinate <em>x</em> + <em>iy</em> in the complex plane, * computes and returns the number of iterations before the fractal * function escapes the bounding area for that point. A point that * doesn't escape before the iteration limit is reached is indicated * with a result of -1. */ public abstract int numIterations(double x, double y); }
[ "noreply@github.com" ]
ArickLP.noreply@github.com
209fa6c5eb08121712b34025d6b99eed6b7986d9
83964a56c3d3fff94d0ff0e52386552d193aca03
/src/main/java/com/sun/jersey/server/impl/model/ResourceUriRules.java
b84ada235f1e005756cfb6515b68ad72be2eb3b4
[]
no_license
onurtokat/hal-streaming
9a0da5c050b9dd79984427a2594ef8726cae270a
63063991e94698d6588c1cf2170965f3991c78e3
refs/heads/master
2020-04-30T23:19:24.625158
2019-03-22T13:02:57
2019-03-22T13:02:57
177,141,138
0
0
null
null
null
null
UTF-8
Java
false
false
14,381
java
// // Decompiled by Procyon v0.5.30 // package com.sun.jersey.server.impl.model; import com.sun.jersey.server.impl.model.method.ResourceHttpOptionsMethod; import com.sun.jersey.server.impl.model.method.ResourceHeadWrapperMethod; import com.sun.jersey.server.impl.template.ViewResourceMethod; import com.sun.jersey.server.impl.model.method.ResourceMethod; import com.sun.jersey.server.impl.uri.rules.HttpMethodRule; import com.sun.jersey.api.model.AbstractResourceMethod; import com.sun.jersey.server.impl.model.method.ResourceHttpMethod; import com.sun.jersey.api.model.AbstractSubResourceMethod; import java.util.HashMap; import com.sun.jersey.spi.inject.Injectable; import java.util.Iterator; import com.sun.jersey.server.impl.uri.rules.RightHandPathRule; import com.sun.jersey.server.impl.uri.rules.SubLocatorRule; import java.lang.reflect.AccessibleObject; import com.sun.jersey.core.spi.component.ComponentScope; import com.sun.jersey.api.uri.UriTemplate; import com.sun.jersey.server.impl.uri.PathTemplate; import com.sun.jersey.api.model.AbstractSubResourceLocator; import com.sun.jersey.spi.container.ResourceFilter; import com.sun.jersey.core.header.QualitySourceMediaType; import java.util.List; import com.sun.jersey.server.impl.uri.rules.CombiningMatchingPatterns; import java.util.Arrays; import com.sun.jersey.server.impl.uri.rules.SequentialMatchingPatterns; import com.sun.jersey.server.impl.uri.rules.TerminatingRule; import com.sun.jersey.api.uri.UriPattern; import com.sun.jersey.spi.inject.InjectableProviderContext; import com.sun.jersey.core.spi.component.ComponentInjector; import com.sun.jersey.server.impl.template.ViewableRule; import com.sun.jersey.api.model.AbstractMethod; import com.sun.jersey.api.model.AbstractImplicitViewMethod; import com.sun.jersey.server.impl.uri.rules.PatternRulePair; import java.util.ArrayList; import java.util.Map; import com.sun.jersey.server.impl.uri.rules.UriRulesFactory; import com.sun.jersey.spi.inject.Errors; import com.sun.jersey.server.impl.uri.PathPattern; import com.sun.jersey.core.header.MediaTypes; import com.sun.jersey.api.view.ImplicitProduces; import com.sun.jersey.api.model.AbstractResource; import com.sun.jersey.spi.monitoring.DispatchingListener; import com.sun.jersey.server.impl.wadl.WadlFactory; import com.sun.jersey.server.impl.container.filter.FilterFactory; import com.sun.jersey.server.impl.inject.ServerInjectableProviderContext; import com.sun.jersey.spi.container.ResourceMethodDispatchProvider; import com.sun.jersey.api.core.ResourceConfig; import com.sun.jersey.spi.uri.rules.UriRule; import com.sun.jersey.spi.uri.rules.UriRules; public final class ResourceUriRules { private final UriRules<UriRule> rules; private final ResourceConfig resourceConfig; private final ResourceMethodDispatchProvider dp; private final ServerInjectableProviderContext injectableContext; private final FilterFactory ff; private final WadlFactory wadlFactory; private final DispatchingListener dispatchingListener; public ResourceUriRules(final ResourceConfig resourceConfig, final ResourceMethodDispatchProvider dp, final ServerInjectableProviderContext injectableContext, final FilterFactory ff, final WadlFactory wadlFactory, final DispatchingListener dispatchingListener, final AbstractResource resource) { this.resourceConfig = resourceConfig; this.dp = dp; this.injectableContext = injectableContext; this.ff = ff; this.wadlFactory = wadlFactory; this.dispatchingListener = dispatchingListener; final boolean implicitViewables = resourceConfig.getFeature("com.sun.jersey.config.feature.ImplicitViewables"); List<QualitySourceMediaType> implictProduces = null; if (implicitViewables) { final ImplicitProduces ip = resource.getAnnotation(ImplicitProduces.class); if (ip != null && ip.value() != null && ip.value().length > 0) { implictProduces = MediaTypes.createQualitySourceMediaTypes(ip.value()); } } final RulesMap<UriRule> rulesMap = new RulesMap<UriRule>(); this.processSubResourceLocators(resource, rulesMap); this.processSubResourceMethods(resource, implictProduces, rulesMap); this.processMethods(resource, implictProduces, rulesMap); rulesMap.processConflicts(new RulesMap.ConflictClosure() { @Override public void onConflict(final PathPattern p1, final PathPattern p2) { Errors.error(String.format("Conflicting URI templates. The URI templates %s and %s for sub-resource methods and/or sub-resource locators of resource class %s transform to the same regular expression %s", p1.getTemplate().getTemplate(), p2.getTemplate().getTemplate(), resource.getResourceClass().getName(), p1)); } }); final UriRules<UriRule> atomicRules = UriRulesFactory.create((Map<PathPattern, UriRule>)rulesMap); final List<PatternRulePair<UriRule>> patterns = new ArrayList<PatternRulePair<UriRule>>(); if (resourceConfig.getFeature("com.sun.jersey.config.feature.ImplicitViewables")) { final AbstractImplicitViewMethod method = new AbstractImplicitViewMethod(resource); final List<ResourceFilter> resourceFilters = ff.getResourceFilters(method); final ViewableRule r = new ViewableRule(implictProduces, FilterFactory.getRequestFilters(resourceFilters), FilterFactory.getResponseFilters(resourceFilters)); final ComponentInjector<ViewableRule> ci = new ComponentInjector<ViewableRule>(injectableContext, ViewableRule.class); ci.inject(r); patterns.add(new PatternRulePair<UriRule>(new UriPattern("/([^/]+)"), r)); patterns.add(new PatternRulePair<UriRule>(UriPattern.EMPTY, r)); } patterns.add(new PatternRulePair<UriRule>(new UriPattern(".*"), new TerminatingRule())); patterns.add(new PatternRulePair<UriRule>(UriPattern.EMPTY, new TerminatingRule())); final UriRules<UriRule> sequentialRules = new SequentialMatchingPatterns<UriRule>(patterns); final UriRules<UriRule> combiningRules = new CombiningMatchingPatterns<UriRule>((List<UriRules<UriRule>>)Arrays.asList(atomicRules, sequentialRules)); this.rules = combiningRules; } public UriRules<UriRule> getRules() { return this.rules; } private void processSubResourceLocators(final AbstractResource resource, final RulesMap<UriRule> rulesMap) { for (final AbstractSubResourceLocator locator : resource.getSubResourceLocators()) { PathPattern p = null; try { p = new PathPattern(new PathTemplate(locator.getPath().getValue())); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource locator %s: %s", locator.getMethod(), ex.getMessage())); continue; } final PathPattern conflict = rulesMap.hasConflict(p); if (conflict != null) { Errors.error(String.format("Conflicting URI templates. The URI template %s for sub-resource locator %s and the URI template %s transform to the same regular expression %s", p.getTemplate().getTemplate(), locator.getMethod(), conflict.getTemplate().getTemplate(), p)); } else { final List<Injectable> is = this.injectableContext.getInjectable(locator.getMethod(), locator.getParameters(), ComponentScope.PerRequest); if (is.contains(null)) { for (int i = 0; i < is.size(); ++i) { if (is.get(i) == null) { Errors.missingDependency(locator.getMethod(), i); } } } final List<ResourceFilter> resourceFilters = this.ff.getResourceFilters(locator); final UriRule r = new SubLocatorRule(p.getTemplate(), is, FilterFactory.getRequestFilters(resourceFilters), FilterFactory.getResponseFilters(resourceFilters), this.dispatchingListener, locator); rulesMap.put(p, new RightHandPathRule(this.resourceConfig.getFeature("com.sun.jersey.config.feature.Redirect"), p.getTemplate().endsWithSlash(), r)); } } } private void processSubResourceMethods(final AbstractResource resource, final List<QualitySourceMediaType> implictProduces, final RulesMap<UriRule> rulesMap) { final Map<PathPattern, ResourceMethodMap> patternMethodMap = new HashMap<PathPattern, ResourceMethodMap>(); for (final AbstractSubResourceMethod method : resource.getSubResourceMethods()) { PathPattern p; try { p = new PathPattern(new PathTemplate(method.getPath().getValue()), "(/)?"); } catch (IllegalArgumentException ex) { Errors.error(String.format("Illegal URI template for sub-resource method %s: %s", method.getMethod(), ex.getMessage())); continue; } final ResourceMethod rm = new ResourceHttpMethod(this.dp, this.ff, p.getTemplate(), method); ResourceMethodMap rmm = patternMethodMap.get(p); if (rmm == null) { rmm = new ResourceMethodMap(); patternMethodMap.put(p, rmm); } if (this.isValidResourceMethod(rm, rmm)) { rmm.put(rm); } rmm.put(rm); } for (final Map.Entry<PathPattern, ResourceMethodMap> e : patternMethodMap.entrySet()) { this.addImplicitMethod(implictProduces, e.getValue()); final PathPattern p = e.getKey(); final ResourceMethodMap rmm2 = e.getValue(); this.processHead(rmm2); this.processOptions(rmm2, resource, p); rmm2.sort(); rulesMap.put(p, new RightHandPathRule(this.resourceConfig.getFeature("com.sun.jersey.config.feature.Redirect"), p.getTemplate().endsWithSlash(), new HttpMethodRule(rmm2, true, this.dispatchingListener))); } } private void processMethods(final AbstractResource resource, final List<QualitySourceMediaType> implictProduces, final RulesMap<UriRule> rulesMap) { final ResourceMethodMap rmm = new ResourceMethodMap(); for (final AbstractResourceMethod resourceMethod : resource.getResourceMethods()) { final ResourceMethod rm = new ResourceHttpMethod(this.dp, this.ff, resourceMethod); if (this.isValidResourceMethod(rm, rmm)) { rmm.put(rm); } } this.addImplicitMethod(implictProduces, rmm); this.processHead(rmm); this.processOptions(rmm, resource, null); rmm.sort(); if (!rmm.isEmpty()) { rulesMap.put(PathPattern.EMPTY_PATH, new HttpMethodRule(rmm, this.dispatchingListener)); } } private void addImplicitMethod(final List<QualitySourceMediaType> implictProduces, final ResourceMethodMap rmm) { if (implictProduces != null) { final List<ResourceMethod> getList = ((HashMap<K, List<ResourceMethod>>)rmm).get("GET"); if (getList != null && !getList.isEmpty()) { rmm.put(new ViewResourceMethod(implictProduces)); } } } private boolean isValidResourceMethod(final ResourceMethod rm, final ResourceMethodMap rmm) { final List<ResourceMethod> rml = ((HashMap<K, List<ResourceMethod>>)rmm).get(rm.getHttpMethod()); if (rml != null) { boolean conflict = false; ResourceMethod erm = null; for (int i = 0; i < rml.size() && !conflict; conflict = (MediaTypes.intersects(rm.getConsumes(), erm.getConsumes()) && MediaTypes.intersects(rm.getProduces(), erm.getProduces())), ++i) { erm = rml.get(i); } if (conflict) { if (rm.getAbstractResourceMethod().hasEntity()) { Errors.error(String.format("Consuming media type conflict. The resource methods %s and %s can consume the same media type", rm.getAbstractResourceMethod().getMethod(), erm.getAbstractResourceMethod().getMethod())); } else { Errors.error(String.format("Producing media type conflict. The resource methods %s and %s can produce the same media type", rm.getAbstractResourceMethod().getMethod(), erm.getAbstractResourceMethod().getMethod())); } } if (conflict) { return false; } } return true; } private void processHead(final ResourceMethodMap methodMap) { final List<ResourceMethod> getList = ((HashMap<K, List<ResourceMethod>>)methodMap).get("GET"); if (getList == null || getList.isEmpty()) { return; } List<ResourceMethod> headList = ((HashMap<K, List<ResourceMethod>>)methodMap).get("HEAD"); if (headList == null) { headList = new ArrayList<ResourceMethod>(); } for (final ResourceMethod getMethod : getList) { if (!this.containsMediaOfMethod(headList, getMethod)) { final ResourceMethod headMethod = new ResourceHeadWrapperMethod(getMethod); methodMap.put(headMethod); headList = ((HashMap<K, List<ResourceMethod>>)methodMap).get("HEAD"); } } } private boolean containsMediaOfMethod(final List<ResourceMethod> methods, final ResourceMethod method) { for (final ResourceMethod m : methods) { if (method.mediaEquals(m)) { return true; } } return false; } private void processOptions(final ResourceMethodMap methodMap, final AbstractResource resource, final PathPattern p) { final List<ResourceMethod> l = ((HashMap<K, List<ResourceMethod>>)methodMap).get("OPTIONS"); if (l != null) { return; } ResourceMethod optionsMethod = this.wadlFactory.createWadlOptionsMethod(methodMap, resource, p); if (optionsMethod == null) { optionsMethod = new ResourceHttpOptionsMethod(methodMap); } methodMap.put(optionsMethod); } }
[ "onurtkt@gmail.com" ]
onurtkt@gmail.com
3e5b3e7d013834f9441c5481c20f989e61939edd
4a8392e73733630e1793ac30252bb5eb4d2f31a5
/src/main/java/com/sahamassurance/demo/config/JacksonConfiguration.java
8df4b56298499edba30f24f99f8659ae87ca16a6
[]
no_license
zekkaoui/jhipster-demo
ad0be3173cfd8b7d76f5f77d7e7a160919f96da0
d1f5baef7c360e90aaa0c6116195fffbc2b53803
refs/heads/master
2020-04-29T08:52:55.104334
2019-03-16T17:56:31
2019-03-16T17:56:31
176,002,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,652
java
package com.sahamassurance.demo.config; import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.module.afterburner.AfterburnerModule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.zalando.problem.ProblemModule; import org.zalando.problem.violations.ConstraintViolationProblemModule; @Configuration public class JacksonConfiguration { /** * Support for Java date and time API. * @return the corresponding Jackson module. */ @Bean public JavaTimeModule javaTimeModule() { return new JavaTimeModule(); } @Bean public Jdk8Module jdk8TimeModule() { return new Jdk8Module(); } /* * Support for Hibernate types in Jackson. */ @Bean public Hibernate5Module hibernate5Module() { return new Hibernate5Module(); } /* * Jackson Afterburner module to speed up serialization/deserialization. */ @Bean public AfterburnerModule afterburnerModule() { return new AfterburnerModule(); } /* * Module for serialization/deserialization of RFC7807 Problem. */ @Bean ProblemModule problemModule() { return new ProblemModule(); } /* * Module for serialization/deserialization of ConstraintViolationProblem. */ @Bean ConstraintViolationProblemModule constraintViolationProblemModule() { return new ConstraintViolationProblemModule(); } }
[ "zekkaoui@gmail.com" ]
zekkaoui@gmail.com
cf80d105fa8fe7612c20927bb73f23bbcfb4f056
2e24ec04301245ab28c4bbbedbe35d8f0d40c5cb
/src/com/programacion/Boletin7/Boletin7_3/Boletin7_3.java
c3096775779928c8f889d90c494edae31fb8dd0e
[]
no_license
Britza/Programacion
bef48b22d7476fe4a6c0eae6d1521cd53d9d43d1
61a5c36c4276df6656ae345cb3bad3bb4957dac0
refs/heads/master
2023-05-04T15:36:50.732927
2021-05-18T18:11:55
2021-05-18T18:11:55
307,660,961
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.programacion.Boletin7.Boletin7_3; import javax.swing.*; public class Boletin7_3 { public static void main(String[] args) { Simbolos obx = new Simbolos(); int num = Integer.parseInt(JOptionPane.showInputDialog("Introduce o numero: ")); obx.simbolos(num); } }
[ "bzegarraflores@danielcastelao.org" ]
bzegarraflores@danielcastelao.org
87ad6c77c78700158e4cd2b093a331774c529cce
eb6de94e24b6135af3f2227a4af9da924d528b94
/src/main/java/com/sampleservice/yyservice/ApplicationMain.java
ad80cb6486817fe3ea47ad003ab4ed3ed7f07cdc
[]
no_license
SampleService/yy-service
83d80e6ad0d75e927cc7b19aa0b582ea48fb0645
d2150f4114565282b65299a9ec7ed74f9e8145ac
refs/heads/master
2022-05-28T18:38:58.169760
2019-12-07T14:10:54
2019-12-07T14:10:54
225,338,368
0
0
null
2022-05-20T21:16:44
2019-12-02T09:40:32
Java
UTF-8
Java
false
false
541
java
package com.sampleservice.yyservice; import com.septemberhx.mclient.annotation.MClient; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; /** * @author SeptemberHX * @version 0.1 * @date 2019/11/25 */ @SpringBootApplication @MClient @EnableEurekaClient public class ApplicationMain { public static void main(String[] args) { SpringApplication.run(ApplicationMain.class, args); } }
[ "september_hx@outlook.com" ]
september_hx@outlook.com
493f0e3a12e33e3bea890e7846808688d2fed0f7
ef64281d7925f68f644f62bce404539e8a500b4c
/impl/src/test/java/com/github/osvaldopina/linkbuilder/hal/annotation/linkcreator/embedded/valuesdiscover/flatnizer/MapFlatnizerTest.java
8508e3a1ac69b7df5138f77d05b3a2cd75f0729b
[]
no_license
osvaldopina/linkbuilder
1f454a422e9953879e6728cc11f85e22c0d204be
6e30709eaa36607782dfec27612212b09a98dd41
refs/heads/master
2020-05-21T04:17:44.901078
2017-03-29T00:25:16
2017-03-29T00:25:16
49,434,452
10
2
null
null
null
null
UTF-8
Java
false
false
1,945
java
package com.github.osvaldopina.linkbuilder.hal.annotation.linkcreator.embedded.valuesdiscover.flatnizer; import org.easymock.EasyMockRule; import org.easymock.EasyMockSupport; import org.easymock.Mock; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import java.util.*; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.expectLastCall; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.core.Is.is; public class MapFlatnizerTest extends EasyMockSupport { @Rule public EasyMockRule mocks = new EasyMockRule(this); @Mock private FlatnizerRegistry flatnizerRegistry; @Mock private Flatnizer emptyFlatnizer; private Map<Object,Object> map = new HashMap<Object,Object>(); private Object nonMap = new Object(); private MapFlatnizer mapFlatnizer; @Before public void setUp() { map = new HashMap<Object, Object>(); map.put("key-1", "value-1"); map.put("key-2", "value-2"); mapFlatnizer = new MapFlatnizer(flatnizerRegistry); } @Test public void canFlat() throws Exception { assertThat(mapFlatnizer.canFlat(map), is(true)); } @Test public void canFlat_nonMap() throws Exception { assertThat(mapFlatnizer.canFlat(nonMap), is(false)); } @Test public void flatAndAddToSet() throws Exception { List<Object> values = new ArrayList<Object>(); expect(flatnizerRegistry.get("value-1")).andReturn(emptyFlatnizer); emptyFlatnizer.flatAndAddToSet("value-1",values); expectLastCall(); expect(flatnizerRegistry.get("value-2")).andReturn(emptyFlatnizer); emptyFlatnizer.flatAndAddToSet("value-2",values); expectLastCall(); replayAll(); mapFlatnizer.flatAndAddToSet(map,values); verifyAll(); } }
[ "osvaldo.pina@gmail.com" ]
osvaldo.pina@gmail.com
943b86c35230e0f3e7c055c558807f18824fd622
0f3b886b6e6935226aaa747c1ce6532999a88763
/src/main/java/com/stackroute/Movie.java
30f242b648e9334fc87fc4e0afa346e2db53f82d
[]
no_license
im-suhailkhan/SpringAnnotationTask
5f07bc9fdca09f57f5c7cea8c88ffe97daf4743b
2889377eda5522c70f9e940a82443ea909796607
refs/heads/master
2022-12-28T19:25:54.007134
2019-09-26T10:20:58
2019-09-26T10:20:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package com.stackroute; import org.springframework.stereotype.Component; @Component("movie") public class Movie { private Actor actor; public Movie(){ System.out.println("movie object created"); } public void setActor(Actor actor) { this.actor = actor; } public Actor getActor() { return actor; } }
[ "su.khan@cgi.com" ]
su.khan@cgi.com
a522231a24ef267bdffe2ac40b795f07d0750a59
87ac7c15ae10fcf960e0f6bbf78338644ff90740
/gen/com/PuckYeah/R.java
c6580bcbac3bd572b8d0c94002dcbabf6c1e61ae
[]
no_license
vpenemetsa/Atlas
6da33a3ada4a15731878722c9b42cbae8cd7a333
565b39245c70926cc9486846506993d5ac51cc5b
refs/heads/master
2020-06-05T05:10:08.612233
2013-09-23T20:18:15
2013-09-23T20:18:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,399
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.PuckYeah; public final class R { public static final class attr { /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarButtonStyle=0x7f010001; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarStyle=0x7f010000; } public static final class color { public static final int black_overlay=0x7f040000; } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f050000; public static final int activity_vertical_margin=0x7f050001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int app_list=0x7f090008; public static final int app_version=0x7f090009; public static final int app_version_list=0x7f090000; public static final int config_button=0x7f09000a; public static final int download_button=0x7f09000b; public static final int email=0x7f090004; public static final int login=0x7f090006; public static final int login_form=0x7f090003; public static final int login_status=0x7f090001; public static final int login_status_message=0x7f090002; public static final int menu_create_account=0x7f09000e; public static final int menu_forgot_password=0x7f09000f; public static final int menu_logout=0x7f090010; public static final int notes_webview=0x7f09000c; public static final int password=0x7f090005; public static final int sign_in_button=0x7f090007; public static final int text1=0x7f09000d; } public static final class layout { public static final int activity_app_versions=0x7f030000; public static final int activity_fullscreen=0x7f030001; public static final int activity_login=0x7f030002; public static final int activity_main=0x7f030003; public static final int activity_version_detail=0x7f030004; public static final int row_app=0x7f030005; } public static final class menu { public static final int login=0x7f080000; public static final int main=0x7f080001; } public static final class string { public static final int action_forgot_password=0x7f060015; public static final int action_sign_in_register=0x7f060013; public static final int action_sign_in_short=0x7f060014; public static final int alert_dialog_cancel=0x7f06000f; public static final int alert_dialog_ok=0x7f06000e; public static final int app_list_title=0x7f060001; public static final int app_name=0x7f060000; public static final int app_version_detail_title=0x7f060003; public static final int app_versions_title=0x7f060002; public static final int configure=0x7f060009; public static final int confirm_logout=0x7f06000d; public static final int download=0x7f06000a; public static final int error_field_required=0x7f06001a; public static final int error_incorrect_password=0x7f060019; public static final int error_invalid_email=0x7f060017; public static final int error_invalid_password=0x7f060018; public static final int login_message=0x7f06000c; public static final int login_progress_signing_in=0x7f060016; public static final int menu_create_account=0x7f060007; public static final int menu_forgot_password=0x7f060006; public static final int menu_logout=0x7f060004; public static final int menu_settings=0x7f060005; /** Strings related to login */ public static final int prompt_email=0x7f060011; public static final int prompt_password=0x7f060012; public static final int relese_notes=0x7f06000b; public static final int title_activity_login=0x7f060010; public static final int version=0x7f060008; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f070000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f070001; public static final int ButtonBar=0x7f070004; public static final int ButtonBarButton=0x7f070005; public static final int FullscreenActionBarStyle=0x7f070006; public static final int FullscreenTheme=0x7f070003; public static final int LoginFormContainer=0x7f070002; } public static final class styleable { /** Declare custom theme attributes that allow changing which styles are used for button bars depending on the API level. ?android:attr/buttonBarStyle is new as of API 11 so this is necessary to support previous API levels. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ButtonBarContainerTheme_buttonBarButtonStyle com.PuckYeah:buttonBarButtonStyle}</code></td><td></td></tr> <tr><td><code>{@link #ButtonBarContainerTheme_buttonBarStyle com.PuckYeah:buttonBarStyle}</code></td><td></td></tr> </table> @see #ButtonBarContainerTheme_buttonBarButtonStyle @see #ButtonBarContainerTheme_buttonBarStyle */ public static final int[] ButtonBarContainerTheme = { 0x7f010000, 0x7f010001 }; /** <p>This symbol is the offset where the {@link com.PuckYeah.R.attr#buttonBarButtonStyle} attribute's value can be found in the {@link #ButtonBarContainerTheme} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name android:buttonBarButtonStyle */ public static final int ButtonBarContainerTheme_buttonBarButtonStyle = 1; /** <p>This symbol is the offset where the {@link com.PuckYeah.R.attr#buttonBarStyle} attribute's value can be found in the {@link #ButtonBarContainerTheme} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name android:buttonBarStyle */ public static final int ButtonBarContainerTheme_buttonBarStyle = 0; }; }
[ "vijaypenemetsa@yahoo.com" ]
vijaypenemetsa@yahoo.com
b9da785d2719f6013aab709394ca5312c481db2a
7bb1ac72fe821b23f00b750e6b4da42491122740
/BrowserTest/src/browser/util/holder.java
bb86bb00e96302c21b4fef9349b12ae63fedfc7a
[]
no_license
dhiemaz/JDataMiningHTML
f10ce800619cdd1dde6ea0cb756af9fe68155bed
41acb5a9290f7ea50db2cffa8426e5736a085321
HEAD
2016-09-06T01:50:10.454655
2013-12-17T17:14:16
2013-12-17T17:14:16
15,260,706
1
0
null
null
null
null
UTF-8
Java
false
false
669
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package browser.util; /** * * @author Dimas */ public class holder { private String[][] data_row; public holder(int i, int j){ data_row = new String[i][j]; } public String[][] getData_row() { return this.data_row; } public String getData_row(int i, int j) { return this.data_row[i][j]; } public void setData_row(String[][] data_row) { this.data_row = data_row; } public void setData_row(int i, int j, String data) { this.data_row[i][j] = data; } }
[ "dhiemaz.mitnick@gmail.com" ]
dhiemaz.mitnick@gmail.com
2c50ebec943f02ee21ae145bcc74c7e175b9a120
53bd1008d98a50f8a5fc22e21bf0e93e4fe51daf
/src/main/java/com/template/security/AuthenticationSuccessHandlerService.java
df32795c6ceb7a6853f88b5283a03067a864cb75
[]
no_license
SergeyIBM47/YouNews
069a3d1aae1441d41d3292fb3c8ca4053082e6ad
c648980508469b8d66af89d23ff39e10be53fd5f
refs/heads/master
2021-01-21T03:21:42.241518
2017-08-30T22:27:48
2017-08-30T22:27:48
101,892,833
0
0
null
null
null
null
UTF-8
Java
false
false
884
java
package com.template.security; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by: Sergey Volokh * Date: 6/8/2016 * Time: 12:06 PM * Project: springmvcs */ @Component public class AuthenticationSuccessHandlerService implements AuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { System.out.println("Success!!!"); httpServletResponse.sendRedirect("/"); } }
[ "wolohsergey@gmail.com" ]
wolohsergey@gmail.com
342cf5700de156441e60db31ecc3e515cfe6db14
65c70ad6584ec55cb6ed63e18786cbfc68131a7a
/src/week2/Fibonacci.java
d53875d56698b9bf58511a777d34dc0b244115da
[]
no_license
nimishbajaj/algorithms-toolbox
db59668dba3e5b841479ae2596ff018ed55fd7a0
1737a63eed9ba63eeafbfc49833810c7d8df6236
refs/heads/master
2022-11-19T16:31:07.964871
2020-07-18T11:14:22
2020-07-18T11:14:22
276,717,962
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package src.week2; import java.util.Scanner; public class Fibonacci { private static long calc_fib(int n) { if (n <= 1) return n; long a = 0; long b = 1; long temp = 0; for (int i = 2; i <= n; i++) { temp = b; b = a + b; a = temp; } return b; } public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // for (int i = 1; i <= 100; i++) // System.out.println(i + " " + calc_fib(i)); System.out.println(calc_fib(n)); } }
[ "nmsbajaj@gmail.com" ]
nmsbajaj@gmail.com
32631585e3a177fbefbaf868127bb5e6a92c6b03
038ee6b20cae51169a2ed4ed64a7b8e99b5cbaad
/schemaOrgGson/src/org/kyojo/schemaorg/m3n5/gson/core/clazz/RestaurantDeserializer.java
3e562b2d690b243d7b12787d06a637d57b640a99
[ "Apache-2.0" ]
permissive
nagaikenshin/schemaOrg
3dec1626781913930da5585884e3484e0b525aea
4c9d6d098a2741c2dc2a814f1c708ee55c36e9a8
refs/heads/master
2021-06-25T04:52:49.995840
2019-05-12T06:22:37
2019-05-12T06:22:37
134,319,974
1
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package org.kyojo.schemaorg.m3n5.gson.core.clazz; import java.lang.reflect.Field; import java.lang.reflect.Type; import java.util.HashMap; import java.util.Map; import org.kyojo.gson.JsonDeserializationContext; import org.kyojo.gson.JsonDeserializer; import org.kyojo.gson.JsonElement; import org.kyojo.gson.JsonParseException; import org.kyojo.schemaorg.m3n5.core.impl.RESTAURANT; import org.kyojo.schemaorg.m3n5.core.Clazz.Restaurant; import org.kyojo.schemaorg.m3n5.gson.DeserializerTemplate; public class RestaurantDeserializer implements JsonDeserializer<Restaurant> { public static Map<String, Field> fldMap = new HashMap<>(); @Override public Restaurant deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { if(jsonElement.isJsonPrimitive()) { return new RESTAURANT(jsonElement.getAsString()); } return DeserializerTemplate.deserializeSub(jsonElement, type, context, new RESTAURANT(), Restaurant.class, RESTAURANT.class, fldMap); } }
[ "nagai@nagaikenshin.com" ]
nagai@nagaikenshin.com
40b0f7bc70ea43e05c9fb3f7cecc39d36b837b02
1990b27127c3f6590bc94814fcf0060c2156f4e6
/ShoppingPayment/src/main/java/com/fkgou/ShoppingPayment/web/util/PhoneVerifiCode.java
8f0baa779898d50bf8b53eeba68d577807409170
[]
no_license
Colbert337/learngit
a5a52d1a8a77c0facf31ff9c598aa9305523276a
5295c912412436cbc7a0780ad602e0d384cfc69f
refs/heads/master
2020-07-06T00:18:41.102024
2019-02-23T08:20:43
2019-02-23T08:20:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,548
java
package com.fkgou.ShoppingPayment.web.util; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.HttpClientBuilder; public class PhoneVerifiCode { String appid = "EUCP-EMY-SMS1-C8IYS";// 请联系销售,或者在页面中 获取 // 时间戳 String timestamp = PhoneVerifiCode.toString(new Date(), "yyyyMMddHHmmss"); // 密钥 String secretKey = "41E696DF11BDB95B";// 请联系销售,或者在页面中 获取 // 接口地址 String host = "http://shmtn.b2m.cn:80/simpleinter/sendSMS?";// 请联系销售获取 // 签名 String sign = PhoneVerifiCode.md5((appid + secretKey + timestamp).getBytes()); // String mobiles = "18715120649"; String content = "【蜂狂购】您的验证码是:"; // 扩展码(选填)最长支持12位,如果最终号码长度超长,会截取扩展码,请根据我司建议位数提交 String extendedCode = "123"; // 定时发送时间(选填,定时时间在90天之内)格式:yyyy-MM-dd HH:mm:ss、如果不填,则为即时发送 String timerTime = ""; // 自定义消息ID(选填)最长32位 String customSmsId = "10001"; // String // urlString="http://bjmtn.b2m.cn/simpleinter/sendSMS?"+"appId="+appid+"&timestamp="+timestamp+"&sign="+sign // +"&mobiles="+mobiles+"&content=【蜂狂购】"+"XXXXX"+"&extendedCode=123"+"&customSmsId=10001"; /** * 发送content内容,需要当前时间,所有不能做成static * * @param content * @return */ public Integer sendVerificationCode(String user_Mobile, String content) { HttpClient httpclient = HttpClientBuilder.create().build(); String urlString = "http://bjmtn.b2m.cn/simpleinter/sendSMS?" + "appId=" + appid + "&timestamp=" + timestamp + "&sign=" + sign + "&mobiles=" + user_Mobile + "&content=【蜂狂购】验证码:" + content + ",请输入后进行验证,请不要将验证码泄露给他人,谢谢!(验证码有效期10分钟)" + "&extendedCode=8" + "&customSmsId=10001"; HttpGet httpGet = new HttpGet(urlString); HttpResponse httpResponse; try { httpResponse = httpclient.execute(httpGet); int statusCode = httpResponse.getStatusLine().getStatusCode(); return statusCode; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 100; } public static String toString(Date date, String format) { String dateStr = null; try { SimpleDateFormat sdf = new SimpleDateFormat(format); dateStr = sdf.format(date); } catch (Exception e) { } return dateStr; } // 随机验证码 public static int randomCode() { int random = (int) (Math.random() * 9000 + 1000); return random; } public static String md5(byte[] bytes) { if (bytes == null || bytes.length == 0) return null; String s = null; char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(bytes); byte tmp[] = md.digest(); char str[] = new char[16 * 2]; int k = 0; for (int i = 0; i < 16; i++) { byte byte0 = tmp[i]; str[k++] = hexDigits[byte0 >>> 4 & 0xf]; str[k++] = hexDigits[byte0 & 0xf]; } s = new String(str); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return s; } }
[ "17521159490@163.com" ]
17521159490@163.com
9260633644923f8f069bba9947e2026834b3107e
4a1f7627c92f943d083ac41197ad2f1d480f75c3
/HangmanLexicon.java
778ee939366412e6b422354e59b7c4f0b3a13ca3
[]
no_license
gregdardis/Hangman-CS106A
05b8b03400713a35d29d4e6f745abc5667a7c3c6
94d22bded48580c16ea252983c35e16114047d15
refs/heads/master
2021-01-20T14:35:01.732172
2017-05-25T13:51:56
2017-05-25T13:51:56
90,630,786
0
0
null
null
null
null
UTF-8
Java
false
false
1,451
java
/* * File: HangmanLexicon.java * ------------------------- * This file contains a stub implementation of the HangmanLexicon * class that you will reimplement for Part III of the assignment. */ import acm.util.*; import java.io.*; import java.util.*; public class HangmanLexicon { public HangmanLexicon() { BufferedReader rd = createBufferedReader(); fillLexiconArray(rd); } /* Using an already opened BufferedReader, fills an ArrayList with * all of the words in it */ private void fillLexiconArray(BufferedReader rd) { try { while(true) { String line = rd.readLine(); if (line == null) break; hangmanLexiconArrayList.add(line); } rd.close(); } catch (IOException ex) { throw new ErrorException(ex); } } /* Opens a BufferedReader and returns that BufferedReader */ private BufferedReader createBufferedReader() { BufferedReader rd = null; while (rd == null) { try { rd = new BufferedReader(new FileReader("HangmanLexicon.txt")); } catch (IOException ex) { System.out.println("bad file name"); } } return rd; } /** Returns the number of words in the lexicon. */ public int getWordCount() { return hangmanLexiconArrayList.size(); } /** Returns the word at the specified index. */ public String getWord(int index) { String word = hangmanLexiconArrayList.get(index); return word; } ArrayList<String> hangmanLexiconArrayList = new ArrayList<String>(); }
[ "dardis.greg@gmail.com" ]
dardis.greg@gmail.com
3a4772350176ba2cd1f811fa48ca3161d3723faf
245cdd69428fb35318f51fb4e168c517c3c199b2
/00_Paint_2D/src/com/androider/demo00_paint_2d/DrawView.java
0edb212c53c56ee1ce8dbbbb214561ea8c5e650e
[]
no_license
mailat/android-base-2014-09-20
9fe0c0603c4d65f0a1ead902ca47527e85f02a01
d4daa7c8989ccde2f4f3e6bc598e723ff05259cf
refs/heads/master
2020-05-20T05:05:13.721699
2014-09-20T13:02:32
2014-09-20T13:02:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,353
java
package com.androider.demo00_paint_2d; import java.util.ArrayList; import java.util.List; import java.util.Random; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; public class DrawView extends View implements OnTouchListener { private static final String TAG = "DrawView"; List<Point> points = new ArrayList<Point>(); Paint paint = new Paint(); public DrawView(Context context) { super(context); setFocusable(true); setFocusableInTouchMode(true); this.setOnTouchListener(this); } @Override public void onDraw(Canvas canvas) { //draw the watermark if (points.size()>0) { Point pointSingle = points.get(points.size()-1); Paint paint = new Paint(); paint.setColor(Color.RED); //paint.setTextSize(35); paint.setAntiAlias(true); paint.setUnderlineText(true); //canvas.drawText("Sample watermark", pointSingle.x, pointSingle.y, paint); } //draw the trailing points paint.setColor(Color.BLACK); for (Point point : points) { //canvas.drawCircle(point.x, point.y, point.marime, paint); canvas.drawCircle(point.x, point.y, point.marime, paint); } // if (points!= null && points.size()>0) // { // paint.setColor(Color.BLACK); // Point point = points.get(points.size()-1); // canvas.drawCircle(point.x, point.y, getRandomSize(), paint); // } } public boolean onTouch(View view, MotionEvent event) { // append the point position to a list Point point = new Point(); point.x = event.getX(); point.y = event.getY(); point.marime= getRandomSize(); points.add(point); // add text on the screen invalidate(); Log.d(TAG, "point: " + point); return true; } int getRandomSize() { Random r = new Random(); int valRandom = r.nextInt(20-3) + 3; return (valRandom); } } class Point { float x, y; int marime; @Override public String toString() { return x + ", " + y; } }
[ "marius.mailat@appseleration.com" ]
marius.mailat@appseleration.com
8527442a409789b9f81d962964236f3dda01d938
e870cb9807a9a452069950483f2e906952c1c977
/src/com/tstine/pagolinprecision/ProductDetailsActivity.java
6bdf840630d5cd179678e3ea15a3b6bf9a1cc438
[]
no_license
taylorstine/Pangolin-Precision
6115e759cc5244f6fc147296920f7b15f4e5ffb2
810a24dfaab2d252fa80dfd562a20cfcab165cbf
refs/heads/master
2020-06-02T00:03:44.008901
2013-10-02T19:08:34
2013-10-02T19:08:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,208
java
package com.tstine.pangolinprecision; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import android.content.Context; import java.net.URISyntaxException; import java.net.URI; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.ViewManager; import android.content.Intent; import android.util.Log; import android.net.Uri; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.ArrayAdapter; import android.widget.Toast; import android.widget.ImageView; import android.widget.GridView; import android.widget.Spinner; import android.widget.AdapterView; import java.lang.InterruptedException; import java.util.concurrent.ExecutionException; import java.util.concurrent.CancellationException; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Paint; import org.json.JSONException; import java.lang.Exception; import android.view.View; public class ProductDetailsActivity extends Activity{ @Override public void onCreate( Bundle ringtail ){ super.onCreate( ringtail ); setContentView( R.layout.product_details ); if( ShowcaseActivity.mProgDialog.isShowing() ) ShowcaseActivity.mProgDialog.dismiss(); Intent intent = getIntent(); Uri uri = intent.getData(); ProductDetail prodDetail = null; try{ prodDetail = JSONParser.getProductDetail( uri ); }catch( Exception e ){ Intent intentSorry = new Intent( this, SorryActivity.class ); startActivity(intentSorry); finish(); } setupUI( prodDetail ); } private void setupUI( ProductDetail prodDetail ){ GridView grid = (GridView) findViewById( R.id.swatch_grid ); ImageView mainImg = (ImageView) findViewById( R.id.main_image ); final HashMap<String,ArrayList<String>> varOptions = prodDetail.getVariationOptions(); ArrayList<String>options = varOptions.get( prodDetail.getActiveVariation().getImage().getSrc() ); if( options == null || options.size() == 0 || options.get(0).equals("") ){ Spinner spinner = (Spinner) findViewById( R.id.options_spinner ); ((ViewManager)spinner.getParent()).removeView(spinner); ((ViewManager)grid.getParent()).removeView(grid); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams( 180, 180 ); relativeParams.addRule(RelativeLayout.CENTER_HORIZONTAL); relativeParams.addRule( RelativeLayout.BELOW, R.id.product_title ); mainImg.setLayoutParams( relativeParams ); }else{ Spinner spinner = (Spinner) findViewById( R.id.options_spinner ); List<String> list = options; ArrayAdapter<String> adapter = new ArrayAdapter<String>( this, R.layout.spinner_item, list ); adapter.setDropDownViewResource( R.layout.spinner_item ); spinner.setAdapter( adapter ); spinner.setOnItemSelectedListener( new SpinnerOnItemSelectedListener() ); grid.setAdapter( new ImageUrlAdapter( this, varOptions.keySet().toArray(new String[varOptions.size() ]) )); grid.setOnItemClickListener( new SwatchClicker( this, varOptions, prodDetail) ); } HashMap<String,String> img = prodDetail.getActiveVariationImageMap(0); try{ mainImg.setImageBitmap( new ImageLoader(this ).execute( new URI( (String) img.get("1x") ) ) .get() .get( img.get("1x") )); }catch( URISyntaxException e ){ e.printStackTrace(); }catch( InterruptedException e ){ e.printStackTrace(); }catch( ExecutionException e ){ e.printStackTrace(); }catch( CancellationException e ){ e.printStackTrace(); } TextView titleTV = (TextView) findViewById( R.id.product_title ); titleTV.setText( "\n\t"+prodDetail.getValue("title") +"\n"); TextView leadingEquityTV = (TextView) findViewById( R.id.product_leading_equity ); leadingEquityTV.setText( prodDetail.getValue("leadingEquity" ) ); TextView bulletsTV = (TextView) findViewById( R.id.product_bullets ); StringBuffer bullets = new StringBuffer(); ArrayList<String> prodBullets = prodDetail.getBullets(); for( String bullet : prodBullets ){ bullets.append("\t"); bullets.append(bullet); bullets.append("\n\n"); } bulletsTV.setMinLines( prodBullets.size() ); bulletsTV.setText( bullets.toString() ); TextView promosTV = (TextView) findViewById( R.id.promos ); StringBuffer promos = new StringBuffer(); ArrayList<String> prodPromos = prodDetail.getPromos(); for( String bullet : prodPromos ){ promos.append("\t"); promos.append(bullet); promos.append("\n\n"); } promosTV.setMinLines( prodPromos.size() ); promosTV.setText( promos.toString() ); GridView crossSaleGrid = (GridView) findViewById( R.id.cross_sales ); GridView upSalesGrid = (GridView) findViewById( R.id.up_sales ); ArrayList<Gridable> crossSales = prodDetail.getCrossSales(); ArrayList<Gridable> upSales = prodDetail.getUpsales(); if( crossSales.size() == 0 ){ TextView TV = (TextView) findViewById( R.id.cross_sale_label ); TV.setVisibility(View.GONE ); crossSaleGrid.setVisibility(View.GONE); } if( upSales.size() == 0 ){ TextView TV = (TextView) findViewById( R.id.up_sale_label ); TV.setVisibility(View.GONE ); upSalesGrid.setVisibility(View.GONE); } TextView retailTV = (TextView) findViewById( R.id.item_retail_price ); retailTV.setText( prodDetail.getActiveVariationValue("retail") ); if( prodDetail.getActiveVariationValue("retail") != null ) retailTV.setText( prodDetail.getActiveVariationValue("retail") ); else if ( prodDetail.getActiveVariationValue("value") != null ) retailTV.setText( prodDetail.getActiveVariationValue("value") ); else retailTV.setText("0.00"); TextView currencyTV = (TextView) findViewById( R.id.item_currency ); currencyTV.setText( prodDetail.getActiveVariationValue("currency") ); if( prodDetail.getActiveVariationValue("sale") != null ){ retailTV.setTextColor(Color.rgb(255, 20, 20 ) ); retailTV.setPaintFlags( retailTV.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG ); TextView saleTV = (TextView) findViewById( R.id.item_sale_price ); saleTV.setText( prodDetail.getActiveVariationValue("sale") ); } setupGridView( crossSaleGrid, crossSales, false ); setupGridView( upSalesGrid, upSales, false ); } public void setupGridView( GridView gridView, ArrayList<Gridable> gridItems, final boolean scrollable){ ArrayList<URI> uriArr = new ArrayList<URI>(); for( Gridable gridItem : gridItems){ try{ uriArr.add( new URI( gridItem.getImage().getSrc() ) ); }catch(URISyntaxException e){ e.printStackTrace(); } } HashMap<String,Bitmap> imgMap = null; try{ imgMap = new ImageLoader( this ).execute( uriArr.toArray( new URI[uriArr.size()]) ).get(); }catch( InterruptedException e ){ e.printStackTrace(); }catch( ExecutionException e ){ e.printStackTrace(); }catch( CancellationException e ){ e.printStackTrace(); } gridView.setAdapter( new GridableImageAdapter( this, gridItems, imgMap ) ); gridView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick( AdapterView<?> parent, final View view, int position, long id ){ Gridable selected = (Gridable) parent.getItemAtPosition( position ) ; Intent intent = getIntent(); intent.setData( Uri.parse( Const.HOST + selected.getValue("href") ) ); startActivity( intent ); } }); gridView.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_MOVE){ return scrollable; } return false; } }); } public void addToCartClick( View view ){ //String form = "id=12441070%11899507&qty=1"; //String form = "123456%7C7892012&qty=1"; //String form = "id=12441070&qty=1"; String form = "id=12441070%7C7892012\u0026qty=1"; String content_type ="application/x-www-form-urlencoded"; HttpGetter.post( form, content_type ); Toast.makeText( this, "Added to cart!", Toast.LENGTH_SHORT ).show(); } private class SwatchClicker implements AdapterView.OnItemClickListener{ private Context mCtx; private HashMap<String,ArrayList<String>> mVarOptions; private ProductDetail mProdDetail; public SwatchClicker( Context ctx, HashMap<String,ArrayList<String>> varOptions, ProductDetail productDetail){ mCtx = ctx; mVarOptions = varOptions; mProdDetail = productDetail; } @Override public void onItemClick( AdapterView<?> parent, final View view, int position, long id ){ String selected = (String) parent.getItemAtPosition( position ) ; ArrayList<String> options = mVarOptions.get(selected); Spinner spinner = (Spinner) findViewById( R.id.options_spinner ); ArrayAdapter<String> adapter = new ArrayAdapter<String>( view.getContext(), R.layout.spinner_item, options ); adapter.setDropDownViewResource( R.layout.spinner_item ); spinner.setAdapter( adapter ); mProdDetail.setActiveVariation( mProdDetail.getVariationBySwatch( selected ) ); TextView retailTV = (TextView) findViewById( R.id.item_retail_price ); retailTV.setText( mProdDetail.getActiveVariationValue("retail") ); if( mProdDetail.getActiveVariationValue("retail") != null ) retailTV.setText( mProdDetail.getActiveVariationValue("retail") ); else if ( mProdDetail.getActiveVariationValue("value") != null ) retailTV.setText( mProdDetail.getActiveVariationValue("value") ); else retailTV.setText("0.00"); TextView currencyTV = (TextView) findViewById( R.id.item_currency ); currencyTV.setText( mProdDetail.getActiveVariationValue("currency") ); if( mProdDetail.getActiveVariationValue("sale") != null ){ retailTV.setTextColor(Color.rgb(255, 20, 20 ) ); retailTV.setPaintFlags( retailTV.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG ); TextView saleTV = (TextView) findViewById( R.id.item_sale_price ); saleTV.setText( mProdDetail.getActiveVariationValue("sale") ); } ImageView mainImg = (ImageView) findViewById( R.id.main_image ); HashMap<String,String> img = mProdDetail.getActiveVariationImageMap(0); try{ mainImg.setImageBitmap( new ImageLoader((Activity)mCtx, false ).execute( new URI( (String) img.get("1x") ) ) .get() .get( img.get("1x") )); }catch( URISyntaxException e ){ e.printStackTrace(); }catch( InterruptedException e ){ e.printStackTrace(); }catch( ExecutionException e ){ e.printStackTrace(); }catch( CancellationException e ){ e.printStackTrace(); } } } private class SpinnerOnItemSelectedListener implements AdapterView.OnItemSelectedListener{ @Override public void onItemSelected( AdapterView<?> parent, View view, int pos, long id ){ } @Override public void onNothingSelected( AdapterView<?> av ){ } } }
[ "taylorstine@gmail.com" ]
taylorstine@gmail.com
2c652713a3d8bd5767920b4511bbc2e16811825b
5ff3dabe938ac700df7dffac8500a91e16eb55d1
/src/main/java/org/springside/modules/utils/ReflectionUtils.java
132eac81075d76d319f40dfa06bfcf20a44ca0e0
[]
no_license
stilremember/learngit
6c193abba5e9a4c9039ca2a1c97901a6db5dd403
16143f31b1b36f542b424b97381ae563b73fe8f7
refs/heads/master
2020-03-19T21:44:10.530344
2019-02-03T11:03:38
2019-02-03T11:03:38
136,948,505
2
0
null
null
null
null
UTF-8
Java
false
false
6,315
java
package org.springside.modules.utils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.*; public abstract class ReflectionUtils { public static final String CGLIB_CLASS_SEPARATOR = "$$"; private static Logger logger = LoggerFactory.getLogger(ReflectionUtils.class); public ReflectionUtils() { } public static Object invokeGetterMethod(Object obj, String propertyName) { String getterMethodName = "get" + StringUtils.capitalize(propertyName); return invokeMethod(obj, getterMethodName, new Class[0], new Object[0]); } public static void invokeSetterMethod(Object obj, String propertyName, Object value) { invokeSetterMethod(obj, propertyName, value, (Class)null); } public static void invokeSetterMethod(Object obj, String propertyName, Object value, Class<?> propertyType) { Class<?> type = propertyType != null ? propertyType : value.getClass(); String setterMethodName = "set" + StringUtils.capitalize(propertyName); invokeMethod(obj, setterMethodName, new Class[]{type}, new Object[]{value}); } public static Object getFieldValue(Object obj, String fieldName) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]"); } else { Object result = null; try { result = field.get(obj); } catch (IllegalAccessException var5) { logger.error("不可能抛出的异常{}", var5.getMessage()); } return result; } } public static void setFieldValue(Object obj, String fieldName, Object value) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new IllegalArgumentException("Could not find field [" + fieldName + "] on target [" + obj + "]"); } else { try { field.set(obj, value); } catch (IllegalAccessException var5) { logger.error("不可能抛出的异常:{}", var5.getMessage()); } } } public static Field getAccessibleField(Object obj, String fieldName) { AssertUtils.notNull(obj, "object不能为空"); AssertUtils.hasText(fieldName, "fieldName"); Class superClass = obj.getClass(); while(superClass != Object.class) { try { Field field = superClass.getDeclaredField(fieldName); field.setAccessible(true); return field; } catch (NoSuchFieldException var4) { superClass = superClass.getSuperclass(); } } return null; } public static Class<?> getUserClass(Class<?> clazz) { if (clazz != null && clazz.getName().contains("$$")) { Class<?> superClass = clazz.getSuperclass(); if (superClass != null && !Object.class.equals(superClass)) { return superClass; } } return clazz; } public static Object invokeMethod(Object obj, String methodName, Class<?>[] parameterTypes, Object[] args) { Method method = getAccessibleMethod(obj, methodName, parameterTypes); if (method == null) { throw new IllegalArgumentException("Could not find method [" + methodName + "] on target [" + obj + "]"); } else { try { return method.invoke(obj, args); } catch (Exception var6) { throw convertReflectionExceptionToUnchecked(var6); } } } public static Method getAccessibleMethod(Object obj, String methodName, Class... parameterTypes) { AssertUtils.notNull(obj, "object不能为空"); Class superClass = obj.getClass(); while(superClass != Object.class) { try { Method method = superClass.getDeclaredMethod(methodName, parameterTypes); method.setAccessible(true); return method; } catch (NoSuchMethodException var5) { superClass = superClass.getSuperclass(); } } return null; } public static <T> Class<T> getSuperClassGenricType(Class clazz) { return getSuperClassGenricType(clazz, 0); } public static Class getSuperClassGenricType(Class clazz, int index) { Type genType = clazz.getGenericSuperclass(); if (!(genType instanceof ParameterizedType)) { logger.warn(clazz.getSimpleName() + "'s superclass not ParameterizedType"); return Object.class; } else { Type[] params = ((ParameterizedType)genType).getActualTypeArguments(); if (index < params.length && index >= 0) { if (!(params[index] instanceof Class)) { logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); return Object.class; } else { return (Class)params[index]; } } else { logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length); return Object.class; } } } public static RuntimeException convertReflectionExceptionToUnchecked(Exception e) { if (!(e instanceof IllegalAccessException) && !(e instanceof IllegalArgumentException) && !(e instanceof NoSuchMethodException)) { if (e instanceof InvocationTargetException) { return new RuntimeException("Reflection Exception.", ((InvocationTargetException)e).getTargetException()); } else { return e instanceof RuntimeException ? (RuntimeException)e : new RuntimeException("Unexpected Checked Exception.", e); } } else { return new IllegalArgumentException("Reflection Exception.", e); } } }
[ "a7ters@163.com" ]
a7ters@163.com
d5dc62d5e03347477dcd8f7354ac745cb67b7e12
7b14665fac200f3f205dc5f2a50932c16318227f
/Core Java/day19.1/src/utils/CollectionUtils.java
4b09e733d56c0867d4d13052cb2404e430bad2fd
[]
no_license
kalemanoj2710/EDAC
c978251058a28f04ea9a356add0aeb71874fa140
3fae34a07a45e2d48101bf13c363af76ce592893
refs/heads/master
2023-04-06T06:07:15.579015
2021-04-14T10:42:16
2021-04-14T10:42:16
357,865,987
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
package utils; import java.util.Arrays; import java.util.List; import static com.app.core.AcType.*; import static java.time.LocalDate.parse; import com.app.core.BankAccount; public interface CollectionUtils { //add a static method to return fixed size populated list of banck accounts static List<BankAccount> populateAcctList() { return Arrays.asList(new BankAccount(10, "abc1", SAVING, 10000, parse("2020-01-19")), new BankAccount(100, "abc4", FD, 200000, parse("2019-01-19")), new BankAccount(34, "abc3", CURRENT, 5000, parse("2010-11-29")), new BankAccount(15, "abc6", SAVING, 12000, parse("2011-06-23")), new BankAccount(64, "abc8", SAVING, 9000, parse("2020-01-19")), new BankAccount(49, "abc2", DMAT, 13000, parse("2020-01-19")) ); } //add a method to ret a populated growable hashmap from above sample data ?????? }
[ "kalemanoj2710@gmail.com" ]
kalemanoj2710@gmail.com
bee25223ed84a755baf05dd2fa551769f622d481
47af37192b9b2f8ee4bfb103ac77296a395e4490
/PSproj/src/Model/Persoana.java
7f97188c93e9facecc92bbdbf206d4e6a842bb85
[]
no_license
viviana-sara/lantBiblioteci
3f7ba5ae61087ffaa28110633f905d76d1614b1e
eeaf4bbeed0fd17c1ea8fbc02768e615fc6a7b7c
refs/heads/main
2023-03-31T17:07:19.439835
2021-04-09T07:46:26
2021-04-09T07:46:26
356,181,571
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package Model; public class Persoana { protected String nume; protected String biblioteca; public Persoana(){ nume = ""; biblioteca= ""; } public Persoana(Persoana persoana){ nume = persoana.nume; biblioteca = persoana.biblioteca; } public Persoana(String nume, String biblioteca){ this.nume= nume; this.biblioteca=biblioteca; } public String getNume() {return nume; } public void setNume(String nume) { this.nume = nume; } public String getBiblioteca() { return biblioteca; } public void setBiblioteca(String biblioteca) { this.biblioteca = biblioteca; } }
[ "mesaros.viviana@yahoo.com" ]
mesaros.viviana@yahoo.com
566d2b9c374e09c920789c3414c3606e4ecf264f
279acecfbfcab662b3191f0192c24fe9efcc9a7a
/GhostBuster/app/src/main/java/com/example/GhostBuster/Checking.java
779913594e84ea64db89d6cdf36b2658b89ec6b4
[]
no_license
hnu-ajq/android-codes
10eee66c04d60caaa5a0cbc4c233374faf2a90ed
97ef37ee77654a9f1e1817cb2af6b8e7f8e8d832
refs/heads/master
2023-01-28T15:58:12.032614
2020-12-10T11:18:20
2020-12-10T11:18:20
311,599,254
1
0
null
null
null
null
UTF-8
Java
false
false
1,811
java
package com.example.GhostBuster; import com.aliyuncs.CommonRequest; import com.aliyuncs.CommonResponse; import com.aliyuncs.DefaultAcsClient; import com.aliyuncs.IAcsClient; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.exceptions.ServerException; import com.aliyuncs.http.MethodType; import com.aliyuncs.profile.DefaultProfile; public class Checking { public String RandCode() { int m_rand=(int)((Math.random()*9+1)*100000);//生成6位的随机验证码 return String.valueOf(m_rand); } public static String m_Fcode=""; public void Sendcode(String m_tnum) { DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI4GHypS5UhkDCDxMWAyS1", "RG7lki6yd0vXbUNvrVjsZqrjEogb8y"); IAcsClient client = new DefaultAcsClient(profile); String m_temp=new Checking().RandCode(); m_Fcode=m_temp; String m_s="{\"code\":\""+m_temp+"\"}"; CommonRequest request = new CommonRequest(); request.setMethod(MethodType.POST); request.setDomain("dysmsapi.aliyuncs.com"); request.setVersion("2017-05-25"); request.setAction("SendSms"); request.putQueryParameter("RegionId", "cn-hangzhou"); request.putQueryParameter("PhoneNumbers", m_tnum); request.putQueryParameter("SignName", "中小学试卷生成系统"); request.putQueryParameter("TemplateCode", "SMS_204111214"); request.putQueryParameter("TemplateParam", m_s);//获取正确格式 try { CommonResponse response = client.getCommonResponse(request); System.out.println(response.getData()); } catch (ServerException e) { e.printStackTrace(); } catch (ClientException e) { e.printStackTrace(); } } }
[ "2532587432@qq.com" ]
2532587432@qq.com
0734e0f0254a10775e6dd2bbd67c14bf9a0b0fc8
480139cec8a81ae4d781efec3741dc30ccf7c658
/src/main/java/me/kipling/springboot/mybatis/Application.java
c8f79e91789ce9ec95e001d856be5dd96e08a0ab
[]
no_license
KiplingGit/springboot-mybatis
1f726c60795b5c00126c6bc84df08d8f89d0a3b7
9f1acfc02846ade64d5b57623670852f0489e830
refs/heads/master
2021-09-17T13:53:10.287300
2018-07-02T08:12:48
2018-07-02T08:12:48
109,818,393
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
package me.kipling.springboot.mybatis; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import me.kipling.springboot.mybatis.common.util.SpringUtil2; import me.kipling.springboot.mybatis.common.util.SpringUtil3; @SpringBootApplication @Import(SpringUtil2.class) public class Application { protected static Logger logger = LoggerFactory.getLogger(Application.class); /*@Bean public SpringUtil2 getSpringUtil2() { return new SpringUtil2(); }*/ /*@Bean public SpringUtil3 getSpringUtil3() { return new SpringUtil3(); } */ public static void main(String[] args) { SpringApplication.run(Application.class, args); logger.info("SpringBoot Start Success"); } }
[ "zhangwei.168520@sohu.com" ]
zhangwei.168520@sohu.com
7c167d8439aba0d53a15a7164af002db2c2d0990
99e72c8c7e1ba5a3ef47e01a769b6b678a67327c
/kodilla-good-patterns/src/main/java/com/kodilla/good/patterns/challenges/Product.java
93c58d0025638c76aa79b5830976ae146c437728
[]
no_license
kris33293/first
907ae0125e531653edf8c0ebb737e9dea387f561
2aa304ceaa4bf61caf26ed8633a270ac14044527
refs/heads/master
2023-03-29T05:52:57.515667
2021-04-10T20:43:10
2021-04-10T20:43:10
301,182,770
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.kodilla.good.patterns.challenges; public class Product { private String name, description; private int price; public Product(final String name, final String description, final Integer price) { this.name = name; this.description = description; this.price = price; } @Override public String toString() { return "Product : " + description + ", Cena: " + price; } }
[ "rkrismann33@gmail.com" ]
rkrismann33@gmail.com
1b492d124d94ffe2d47d5f19489c35246553d51d
61c314db8e740dbb747b11475e59dce3cee4fe93
/src/main/java/com/wannaone/woowanote/support/HtmlFormDataBuilder.java
81683708fced0645d24109fdac557d4313c22f30
[]
no_license
wwh-techcamp-2018/team1-WannaOne
5f908a535bb41877bc81c0a16d7d0ad4ab5affae
f9b1219aee7198aade959c5dba9eff811ab866ca
refs/heads/develop
2020-03-24T22:34:35.330359
2018-09-06T15:16:13
2018-09-06T15:16:13
143,092,016
13
2
null
2018-08-30T14:04:57
2018-08-01T02:11:31
JavaScript
UTF-8
Java
false
false
1,437
java
package com.wannaone.woowanote.support; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import java.util.Arrays; public class HtmlFormDataBuilder { private HttpHeaders headers; private MultiValueMap<String, Object> params; private HtmlFormDataBuilder(HttpHeaders headers) { this.headers = headers; this.params = new LinkedMultiValueMap<>(); } public HtmlFormDataBuilder addParameter(String key, Object value) { this.params.add(key, value); return this; } public HttpEntity<MultiValueMap<String, Object>> build() { return new HttpEntity<MultiValueMap<String, Object>>(params, headers); } public static HtmlFormDataBuilder urlEncodedForm() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); return new HtmlFormDataBuilder(headers); } public static HtmlFormDataBuilder multipartFormData() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Arrays.asList(MediaType.TEXT_HTML)); headers.setContentType(MediaType.MULTIPART_FORM_DATA); return new HtmlFormDataBuilder(headers); } }
[ "tramyu@naver.com" ]
tramyu@naver.com
29e5c22571e55f13be98407b1a237e9b843338db
0cd7fd8c952926e47bb3b66166b986cafe1788fc
/src/hirondelle/formula/function/builtin/DaysUntilTEST.java
38916e802255f1bf705e43eeb1a02e9749429569
[]
no_license
johanley/formula4j
32d17f6bda11aed3d70decdfc087f9f2d3aa6fc8
0e2fa667a3d85e92036196389116659118f2261f
refs/heads/master
2022-11-16T20:42:15.524876
2020-07-14T12:44:37
2020-07-14T12:44:37
279,580,602
1
0
null
null
null
null
UTF-8
Java
false
false
527
java
package hirondelle.formula.function.builtin; import hirondelle.formula.function.Function; public final class DaysUntilTEST extends BaseTEST { public static void main(String args[]) { junit.textui.TestRunner.run(DaysUntilTEST.class); } public void testCases(){ Function func = new DaysUntil(); //these depend on hard-coded current dates and times /* testWith(func, "0", "2012", "12", "10"); testWith(func, "-2", "2012", "12", "8"); testWith(func, "2", "2012", "12", "12"); */ } }
[ "webmaster@javapractices.com" ]
webmaster@javapractices.com
f7adbe2b3362f3c1dc4d27ce558abaa8fb3ad3e4
9cdf4a803b5851915b53edaeead2546f788bddc6
/machinelearning/4.0.x/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/cdss/CDSSExample.java
5fbafec8cc292bda763ed4fc9a2900c04d70e998
[ "Apache-2.0" ]
permissive
kiegroup/droolsjbpm-contributed-experiments
8051a70cfa39f18bc3baa12ca819a44cc7146700
6f032d28323beedae711a91f70960bf06ee351e5
refs/heads/master
2023-06-01T06:11:42.641550
2020-07-15T15:09:02
2020-07-15T15:09:02
1,184,582
1
13
null
2021-06-24T08:45:52
2010-12-20T15:42:26
Java
UTF-8
Java
false
false
3,886
java
package org.drools.examples.cdss; import java.io.InputStreamReader; import java.io.Reader; import java.util.Iterator; import java.util.List; import org.drools.RuleBase; import org.drools.RuleBaseFactory; import org.drools.WorkingMemory; import org.drools.audit.WorkingMemoryFileLogger; import org.drools.compiler.PackageBuilder; import org.drools.examples.cdss.data.Diagnose; import org.drools.examples.cdss.data.Patient; import org.drools.examples.cdss.service.RecommendationService; import org.drools.rule.Package; /** * This is a sample file to launch a rule package from a rule source file. */ public class CDSSExample { public static final void main(String[] args) { try { //load up the rulebase RuleBase ruleBase = readRule(); WorkingMemory workingMemory = ruleBase.newStatefulSession(); WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(workingMemory); // set globals RecommendationService recommendationService = new RecommendationService(); workingMemory.setGlobal("recommendationService", recommendationService); // create patient Patient patient = new Patient(); patient.setName("John Doe"); patient.setAge(20); workingMemory.insert(patient); // Go! Diagnose diagnose = new Diagnose(Terminology.DIAGNOSE_X); workingMemory.insert(diagnose); workingMemory.fireAllRules(); // Print out recommendations List recommendations = recommendationService.getRecommendations(); for (Iterator iterator = recommendations.iterator(); iterator.hasNext(); ) { System.out.println(iterator.next()); } recommendations.clear(); // Simulate a diagnose: incomplete results diagnose = new Diagnose(Terminology.DIAGNOSE_X_TYPE_UNKNOWN); workingMemory.insert(diagnose); workingMemory.fireAllRules(); // Print out recommendations recommendations = recommendationService.getRecommendations(); for (Iterator iterator = recommendations.iterator(); iterator.hasNext(); ) { System.out.println(iterator.next()); } recommendations.clear(); // Simulate a diagnose: type2 diagnose = new Diagnose(Terminology.DIAGNOSE_X_TYPE2); workingMemory.insert(diagnose); workingMemory.fireAllRules(); logger.writeToDisk(); } catch (Throwable t) { t.printStackTrace(); } } private static RuleBase readRule() throws Exception { PackageBuilder builder = new PackageBuilder(); Reader reader = new InputStreamReader( CDSSExample.class.getResourceAsStream("/org/drools/examples/cdss/GenericRules.drl")); builder.addPackageFromDrl(reader); reader = new InputStreamReader( CDSSExample.class.getResourceAsStream("/org/drools/examples/cdss/ClinicalPathwayX.drl")); builder.addPackageFromDrl(reader); reader = new InputStreamReader( CDSSExample.class.getResourceAsStream("/org/drools/examples/cdss/ClinicalPathwayX.rfm")); builder.addRuleFlow(reader); reader = new InputStreamReader( CDSSExample.class.getResourceAsStream("/org/drools/examples/cdss/TreatmentX.rfm")); builder.addRuleFlow(reader); reader = new InputStreamReader( CDSSExample.class.getResourceAsStream("/org/drools/examples/cdss/TreatmentY.rfm")); builder.addRuleFlow(reader); Package pkg = builder.getPackage(); RuleBase ruleBase = RuleBaseFactory.newRuleBase(); ruleBase.addPackage( pkg ); return ruleBase; } }
[ "gizil.oguz@gmail.com" ]
gizil.oguz@gmail.com
afd6869ef3fc24a971064035125a6bf71da8b4c4
3f34ce62109330c202324e7f1c9ac5ea00b41040
/TablePerClassInheritance/src/info/owczarek/jpa/domain/Student.java
c0ad160a06d71acacba1501bae7e76bfe0df15ab
[]
no_license
hunter86rsl/JPA_i_Hibernate_AOwczarek
ea902ed27f4664ea66159240a3b4db51c074c40e
3979e473d30e1ff39be982f001fe48a4bc0f272f
refs/heads/master
2021-05-06T06:07:52.202324
2017-12-21T12:30:52
2017-12-21T12:30:52
113,817,395
0
0
null
null
null
null
UTF-8
Java
false
false
303
java
package info.owczarek.jpa.domain; import javax.persistence.Entity; @Entity public class Student extends Person { private double averageGrade; public double getAverageGrade() { return averageGrade; } public void setAverageGrade(double averageGrade) { this.averageGrade = averageGrade; } }
[ "adrian.nikiel@gmail.com" ]
adrian.nikiel@gmail.com
ecceb39b8ec9583973f804e586f17caa7291a5f4
9175da4fa386abd1922d5e5a187dfd86a7923984
/src/main/java/com/affordability/scripts/AffordableCalculationTC011.java
40ec393ff6104a8735fd27d6750fef96d0d9329a
[]
no_license
SubbaCigniti/Affordability
934f9abbd052527d4de617ec2b452f221213b281
5bacd033391c196bd4051b695bb2830c0f281df2
refs/heads/master
2021-04-12T07:17:37.231217
2017-06-16T05:47:17
2017-06-16T05:47:17
94,507,124
0
0
null
null
null
null
UTF-8
Java
false
false
2,400
java
package com.affordability.scripts; import org.testng.annotations.Test; import com.affordability.workflows.StandaloneBusinessFunctions; import com.testdata.MSODMTestData; import com.testdata.OrangeBusTestData; public class AffordableCalculationTC011 extends StandaloneBusinessFunctions{ @Test(groups="Standalone",priority=1) public void standaloneTC011 () throws Throwable{ reportTestCaseName = "Aff_11"; reportApplicationName = "Standalone"; child = extent.startTest("StandAlone", "Verification"); iterationReport(1, "StandAlone Test Case 011" ); runAPITestCase("StandAlone_TC011"); verifyAffordableAmountAndLoanTermForAPI("TC011"); parent.appendChild(child); iterationReport(1,"Test Case Completed"); } @Test (groups="MSO",priority=2) public void msoTC011() throws Throwable { reportTestCaseName = "Aff_11"; reportApplicationName = "MSO"; child = extent.startTest("MSO", "Verification"); iterationReport(1, "MSO Test Case 011" + " Started"); launchApplication(MSODMTestData.INTERMEDIARYURL); loginMSO(MSODMTestData.LOGINNAME, MSODMTestData.PASSWORD); createNewCase("TC011"); addApplicants("TC011","single"); getDecision(); addLoanRequirements("TC011"); additionalBorrowing("TC011"); personalDetailsSingle("TC011"); addressDetails("TC011"); currentIncome("TC011"); appBreakDownIncome("TC011","one","single"); committedExpenditure("TC011","single"); houseHoldExp("TC011"); futureChanges(""); getDip(); decison(); verifyMaxAffordableAmount("TC011"); verifyMinimumAffordableLoanTerm("TC011"); parent.appendChild(child); iterationReport(1,"Test Case Completed"); } @Test (groups="OrangeBus",priority=3) public void orangeBusTC011() throws Throwable { reportTestCaseName = "Aff_11"; reportApplicationName = "Orangebus"; child = extent.startTest("OrangeBus", "Verification"); iterationReport(1, "OrangeBus Test Case 011" + " Started"); launchApplication(OrangeBusTestData.ORANGEBUSURL); setPropertyAndLoanValues("TC011"); enterDOBAndRetirementAge("TC011", "1"); clickYesApplicant1("TC011"); setemployment_statusApplicant1("TC011"); setLastFullTradingYearsNetProfit_1("TC011"); setPreviousFullTradingYearsNetProfit_1("TC011"); enterExpenditures("TC011"); clickCalculateResults(); verifyAmountAndLoanTerm("TC011"); parent.appendChild(child); iterationReport(1, "Test Case Completed"); } }
[ "E003700@cigniti.com" ]
E003700@cigniti.com
db3ab1bf172e5d20ee59d9f9e396226384df3a04
eb631c27bcb96246e97e61478311ca6b2f28bfe8
/AdvancedProgramming/Past_Papers/2016/Reader.java
0883043f73d47587beb2d3453a9f78af7d043c32
[]
no_license
kevin0110w/Coursework
ec2d36b2b6b7a6959749a831d731cbb0701b1528
776dfa1705b918d1cf2130815c4f4074a471a8ea
refs/heads/master
2020-03-29T00:01:20.099605
2019-05-24T16:23:11
2019-05-24T16:23:11
149,320,620
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
import java.net.*; import java.io.*; import java.util.*; public class Reader implements Runnable { private Socket socket; public Reader(Socket s) { this.socket = s; } public void run() { try { Scanner sc = new Scanner(this.socket.getInputStream()); while(sc.hasNextLine()) { System.out.println(sc.nextLine()); } sc.close(); } catch (IOException e) { } } }
[ "0808148w@student.gla.ac.uk" ]
0808148w@student.gla.ac.uk
c504fcdb92a02770eb3a979ae96f52eafb0ab3e9
f6f1a75cc2eeec902cc04e25395da2137160912f
/Many Two One_0/src/Com/Vendor.java
12d2ae0b81ecb1a43e85453b2c15e78716d9b0a0
[]
no_license
Ankitsakatpuriya/Hibernate-All-AjaySir
9e92cd16dde6877c11e7d3750a7cf67dd905d8ec
73573fedf6fb14d7c4e115c46bbd4b12a7c6272c
refs/heads/master
2020-03-21T22:24:16.317988
2018-06-29T08:44:02
2018-06-29T08:44:02
139,124,213
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package Com; public class Vendor { private int vid; private String vname; public int getVid() { return vid; } public void setVid(int vid) { this.vid = vid; } public String getVname() { return vname; } public void setVname(String vname) { this.vname = vname; } }
[ "ankitsakatpuriya02@gmail.com" ]
ankitsakatpuriya02@gmail.com
015b8144a88ceda91f7824352231456f4c8b2492
2d055f47560287769ec5e69dda6877bd57cb1119
/src/main/java/com/les/LesHotel/rns/hospedagem/ValidarDadosObrigatoriosHospedagem.java
e2438c243098386be11ab2d933792f685f2ba7ee
[]
no_license
FabioYudi/leshospedagem
36149db370368ac2581a9cb4da830a915ed2f4aa
8840585049cb4e2517aeca57fe7d22d9b7ee4273
refs/heads/master
2020-04-25T00:47:55.530600
2019-06-24T14:02:11
2019-06-24T14:02:11
172,388,957
1
0
null
null
null
null
UTF-8
Java
false
false
2,235
java
package com.les.LesHotel.rns.hospedagem; import com.les.LesHotel.entities.EntidadeDominio; import com.les.LesHotel.entities.Hospedagem; import com.les.LesHotel.helper.StringHelper; import com.les.LesHotel.rns.IStrategy; public class ValidarDadosObrigatoriosHospedagem implements IStrategy{ @Override public String processar(EntidadeDominio entidade) { Hospedagem hospedagem = (Hospedagem) entidade; StringBuilder builder = new StringBuilder(); if(StringHelper.isNullOrEmpty(hospedagem.getCategoria())) { montaBuilder("categoria", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getDescricao())) { montaBuilder("descrição", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getTitulo())) { montaBuilder("titulo", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getLogradouro())) { montaBuilder("logradouro", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getCep())) { montaBuilder("cep", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getCidade())) { montaBuilder("cidade", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getComplemento())) { montaBuilder("complemento", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getEstado())) { montaBuilder("estado", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getBairro())) { montaBuilder("bairro", builder); } if(StringHelper.isNullOrEmpty(hospedagem.getEndereco().getNumero())) { montaBuilder("numero", builder); } if(hospedagem.getQtdHospedes() == 0) { montaBuilder("quantidade de hóspedes", builder); } if(hospedagem.getQtdQuartos() == 0) { montaBuilder("quantidade de quartos", builder); } if(hospedagem.getDiaria() == null) { montaBuilder("diaria", builder); } if(hospedagem.getDataFim() == null) { montaBuilder("data fim", builder); } if(hospedagem.getDataInicio() == null) { montaBuilder("data inicio", builder); } return builder.toString(); } private void montaBuilder(String campo, StringBuilder builder) { builder.append("O campo " + campo + " é obrigatório!<br>"); } }
[ "fabio.spada@fatec.sp.gov.br" ]
fabio.spada@fatec.sp.gov.br
d60af6ba1e251c60a314694b764ab053252485bd
684661cd459ece7d06feffec432610ba52defc5c
/app/src/main/java/com/example/plainolnotes/EditorActivity.java
23636c2399d7c9754cc6581c53076577d558740d
[]
no_license
bhaveshj21/Take-a-Note
2f493b23ff748efe1e1026ca2e85690f2381c28b
bffd8e21fd33618e297b163314795a904fafaa10
refs/heads/master
2021-01-10T14:12:42.587999
2015-10-31T14:20:29
2015-10-31T14:20:29
45,238,430
0
0
null
null
null
null
UTF-8
Java
false
false
3,722
java
package com.example.plainolnotes; import android.content.ContentValues; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.Toast; public class EditorActivity extends ActionBarActivity { private String action; private EditText editor; private String noteFilter; private String oldText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_editor); editor = (EditText) findViewById(R.id.editText); Intent intent = getIntent(); Uri uri = intent.getParcelableExtra(NotesProvider.CONTENT_ITEM_TYPE); if (uri == null) { action = Intent.ACTION_INSERT; setTitle(getString(R.string.new_note)); } else { action = Intent.ACTION_EDIT; noteFilter = DBOpenHelper.NOTE_ID + "=" + uri.getLastPathSegment(); Cursor cursor = getContentResolver().query(uri, DBOpenHelper.ALL_COLUMNS, noteFilter, null, null); cursor.moveToFirst(); oldText = cursor.getString(cursor.getColumnIndex(DBOpenHelper.NOTE_TEXT)); editor.setText(oldText); editor.requestFocus(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { if(action.equals(Intent.ACTION_EDIT)) { getMenuInflater().inflate(R.menu.menu_editor, menu); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); switch (item.getItemId()) { case android.R.id.home: finishEditing(); break; case R.id.action_delete: deleteNote(); break; } return true; } private void deleteNote() { getContentResolver().delete(NotesProvider.CONTENT_URI,noteFilter,null); Toast.makeText(this, R.string.Note_DELETED,Toast.LENGTH_SHORT).show(); setResult(RESULT_OK); finish(); } private void finishEditing() { String newText = editor.getText().toString().trim(); switch (action) { case Intent.ACTION_INSERT: if (newText.length() == 0) { setResult(RESULT_CANCELED); } else { insertNote(newText); } break; case Intent.ACTION_EDIT: if (newText.length() == 0) { deleteNote(); } else if (oldText.equals(newText)) { setResult(RESULT_CANCELED); } else { updateNote(newText); } } finish(); } private void updateNote(String noteText) { ContentValues values = new ContentValues(); values.put(DBOpenHelper.NOTE_TEXT, noteText); getContentResolver().update(NotesProvider.CONTENT_URI, values, noteFilter, null); Toast.makeText(this, getString(R.string.note_updated), Toast.LENGTH_SHORT).show(); setResult(RESULT_OK); } private void insertNote(String noteText) { ContentValues values = new ContentValues(); values.put(DBOpenHelper.NOTE_TEXT, noteText); getContentResolver().insert(NotesProvider.CONTENT_URI, values); setResult(RESULT_OK); } @Override public void onBackPressed() { finishEditing(); } }
[ "bhaveshj21@gmail.com" ]
bhaveshj21@gmail.com
763d8466726d48ab253e6f3543a26c12f75aa873
50f2dc7819f652f605fdd18523925d35801982e9
/src/main/java/utils/Sign.java
e57e6f8dbb85548632ca496475c00174b4f424f7
[ "Apache-2.0" ]
permissive
YouUWd/gaia-deployer
c1f56cea4fa58b4a75fd7f63208cc443e901b921
9adabccf3313db53090dc507046a4654d7177109
refs/heads/master
2020-05-24T00:25:53.596162
2019-06-17T09:43:33
2019-06-17T09:43:33
187,016,438
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package utils; import java.util.Map; import java.util.TreeMap; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; public class Sign { public static String buildSign(Map<String, String> params, String code) throws Exception { StringBuffer buffer = new StringBuffer(); Map<String, String> sortedMap = new TreeMap<>(params); for (Map.Entry<String, String> entry : sortedMap.entrySet()) { buffer.append(entry.getKey()); buffer.append(entry.getValue()); } //参数排序 Mac hmac = Mac.getInstance("HmacSHA1"); SecretKeySpec sec = new SecretKeySpec(code.getBytes(), "HmacSHA1"); hmac.init(sec); byte[] digest = hmac.doFinal(buffer.toString().getBytes("UTF-8")); return new String(new Hex().encode(digest), "UTF-8"); //sign加密 } }
[ "youyou.dyy@alibaba-inc.com" ]
youyou.dyy@alibaba-inc.com
c52da7770ee92aac166851b048b3a136f26e8e8b
bcdb1a24b822f2d88a854ee597785b7c935f759d
/app/src/main/java/fragment/cs522/fragment/util/EnumUtils.java
2b73f8b344812a0c4c4a5876c0a3e27147c325d1
[]
no_license
SoraLink/chatroom
ef651348b76d39ea3fc694781859b6cc363d629e
79c5e55f4efc55c820e842df9eb665147ba68a72
refs/heads/master
2020-03-31T22:42:21.195833
2018-10-11T17:12:53
2018-10-11T17:12:53
152,628,005
0
0
null
null
null
null
UTF-8
Java
false
false
1,005
java
package fragment.cs522.fragment.util; import android.os.Parcel; /** * Created by dduggan. */ public class EnumUtils { public static <E extends Enum<E>> int putEnum(E value) { if (value == null) { return -1; } else { return value.ordinal(); } } public static <E extends Enum<E>> E getEnum(Class<E> _class, Integer value) { if (value == null || value < 0) { return null; } else { return _class.getEnumConstants()[value]; } } public static <E extends Enum<E>> E getEnum(Class<E> _class, int value) { if (value < 0) { return null; } else { return _class.getEnumConstants()[value]; } } public static <E extends Enum<E>> E readEnum(Class<E> _class, Parcel in) { return getEnum(_class, in.readInt()); } public static <E extends Enum<E>> void writeEnum(Parcel out, E e) { out.writeInt(putEnum(e)); } }
[ "qitianye1104@gmail.com" ]
qitianye1104@gmail.com
d93ae633fab863e4ea27706e2a7e7fdbf3195e58
48ba2d45a85afa0f343dfb5058cbb11f9862734e
/commons/ihe/hl7v2/src/main/java/org/openehealth/ipf/commons/ihe/hl7v2/NakFactory.java
4271da3b161c80f9fe319ab66ab9579cb7fd4a6a
[ "Apache-2.0" ]
permissive
RicardoFigueroa/ipf
90426e06ddd3295130b52347a929e1959839322e
035168626e8b418b6f50579c8987f49a898ca7b1
refs/heads/master
2020-12-03T00:02:30.735842
2017-06-30T15:02:12
2017-06-30T15:02:12
95,977,462
1
0
null
2017-07-01T17:08:33
2017-07-01T17:08:33
null
UTF-8
Java
false
false
8,089
java
/* * Copyright 2016 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.openehealth.ipf.commons.ihe.hl7v2; import ca.uhn.hl7v2.AcknowledgmentCode; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.Message; import org.apache.commons.lang3.Validate; import org.openehealth.ipf.modules.hl7.message.MessageUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Stream; /** * Basic ACK and NAK factory for HL7v2-based transactions. * * @author Dmytro Rud */ public class NakFactory { private final Hl7v2TransactionConfiguration config; private final boolean useCAckTypeCodes; private final String defaultNakMsh9; /** * Generic constructor. * * @param config Configuration of the transaction served by this factory. * @param useCAckTypeCodes if <code>true</code>, HL7v2 acknowledgement codes * <tt>CA</tt>, <tt>CE</tt>, <tt>CR</tt> will be used instead of the default * <tt>AA</tt>, <tt>AE</tt>, <tt>AR</tt>. * @param defaultNakMsh9 desired contents of MSH-9 in this transaction's default NAKs. */ public NakFactory(Hl7v2TransactionConfiguration config, boolean useCAckTypeCodes, String defaultNakMsh9) { Validate.notNull(config); Validate.notEmpty(defaultNakMsh9); this.config = config; this.useCAckTypeCodes = useCAckTypeCodes; this.defaultNakMsh9 = defaultNakMsh9; } /** * Short constructor which corresponds to <code>NakFactory(config, false, "ACK")</code>. * * @param config Configuration of the transaction served by this factory. */ public NakFactory(Hl7v2TransactionConfiguration config) { this(config, false, "ACK"); } /** * Generates a transaction-specific HL7v2 ACK response message on the basis * of the original HAPI request message. * * @param originalMessage original HAPI request message. */ public Message createAck(Message originalMessage) throws HL7Exception, IOException { return originalMessage.generateACK(useCAckTypeCodes ? AcknowledgmentCode.CA : AcknowledgmentCode.AA, null); } /** * Generates an HL7v2 NAK response message on the basis * of the thrown exception and the original HAPI request message. * * @param exception thrown exception. * @param originalMessage original HAPI request message. * @param ackTypeCode HL7v2 acknowledgement type code. */ public Message createNak(Message originalMessage, HL7Exception exception, AcknowledgmentCode ackTypeCode) throws HL7Exception, IOException { return originalMessage.generateACK(ackTypeCode, exception); } /** * Generates an HL7v2 NAK response message on the basis * of the thrown exception and the original HAPI request message. * * @param t thrown exception. * @param originalMessage original HAPI request message. */ public Message createNak(Message originalMessage, Throwable t) throws HL7Exception, IOException { HL7Exception hl7Exception = getHl7Exception(t); return createNak(originalMessage, hl7Exception, getAckTypeCode(hl7Exception)); } /** * Generates a "default" HL7v2 NAK message on the basis * of the thrown exception. * * @param e thrown exception. */ public Message createDefaultNak(HL7Exception e) { HL7Exception hl7Exception = new HL7Exception( formatErrorMessage(e), config.getRequestErrorDefaultErrorCode(), e); return MessageUtils.defaultNak( hl7Exception, useCAckTypeCodes ? AcknowledgmentCode.CR : AcknowledgmentCode.AR, config.getHl7Versions()[0].getVersion(), config.getSendingApplication(), config.getSendingFacility(), defaultNakMsh9); } /** * Returns a HL7v2 exception that corresponds * to the given instance of {@link Throwable}. */ protected HL7Exception getHl7Exception(Throwable t) { return getException(HL7Exception.class, t).orElseGet(() -> new HL7Exception( formatErrorMessage(t), config.getRequestErrorDefaultErrorCode(), t)); } /** * Returns a HL7v2 acknowledgement type code that corresponds * to the given instance of {@link Throwable}. */ protected AcknowledgmentCode getAckTypeCode(Throwable t) { AcknowledgmentCode ackTypeCode = (t instanceof Hl7v2AcceptanceException) ? AcknowledgmentCode.AR : AcknowledgmentCode.AE; if (useCAckTypeCodes) { ackTypeCode = (ackTypeCode == AcknowledgmentCode.AR) ? AcknowledgmentCode.CR : AcknowledgmentCode.CE; } return ackTypeCode; } /** * Formats and returns error message of an exception. * <p> * In particular, all line break characters must be removed, * otherwise they will break the structure of an HL7 NAK. * * @param t thrown exception. * @return formatted error message from the given exception. */ public static String formatErrorMessage(Throwable t) { String s = t.getMessage(); if (s == null) { s = t.getClass().getName(); } s = s.replace('\n', ';'); s = s.replace('\r', ';'); return s; } /** * Returns configuration of the transaction served by this factory. */ protected Hl7v2TransactionConfiguration getConfig() { return config; } /** * Retrieves the given exception type from the exception. * <p/> * Is used to get the caused exception that typically have been wrapped in some sort * of Camel wrapper exception * <p/> * The strategy is to look in the exception hierarchy to find the first given cause that matches the type. * Will start from the bottom (the real cause) and walk upwards. * * @param type the exception type wanted to retrieve * @param exception the caused exception * @return the exception found (or <tt>null</tt> if not found in the exception hierarchy) */ private static <T extends Throwable> Optional<T> getException(Class<T> type, Throwable exception) { if (exception == null) { return null; } //check the suppressed exception first Optional<T> result = identifyException(Stream.of(exception.getSuppressed()), type); if (result.isPresent()) return result; return createExceptionStream(exception) .filter(type::isInstance) .map(type::cast) .findFirst(); } private static <T extends Throwable> Optional<T> identifyException(Stream<Throwable> stream, Class<T> type) { return stream .filter(type::isInstance) .map(type::cast) .findFirst(); } private static Stream<Throwable> createExceptionStream(Throwable exception) { List<Throwable> throwables = new ArrayList<>(); Throwable current = exception; while (current != null) { throwables.add(current); current = current.getCause(); } Collections.reverse(throwables); return throwables.stream(); } }
[ "christian.ohr@gmail.com" ]
christian.ohr@gmail.com
28d6f0a56b14f4891bb52bdfd416d15026fb59b2
11aea9ee3a93cf794b7f86f736d5763f6b814021
/src/test/java/com/asu/AppTest.java
cd4765655592dd0f306e035247e50a33c9d7ef25
[]
no_license
AparnaKundavaram/ASU
94cc1dc6e4de75f94c1ce23a60234da8fcafbf55
c98cb442301432e7828fa471a3ad0c06b3e716f4
refs/heads/master
2020-05-04T19:40:47.836626
2019-04-04T20:03:44
2019-04-04T20:03:44
179,402,931
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package com.asu; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "kundavaramaparna@gmail.com" ]
kundavaramaparna@gmail.com
16cb9a81a1e63a02a36a6b29b97ed470b3027437
fc922e02e063706e713c039351bfbb2d0706abe6
/seckill-graylog/src/main/java/com/karsa/controller/GraylogController.java
8b2add715f21a1de1d5b7eaa003867dac18b301e
[]
no_license
pythonking/seckill
d094a7ce00c50bcc0eb5f108c1cde7cd741d8750
4c5cea6b616f2a841f1c82979d4baa26639209cf
refs/heads/master
2021-12-02T02:38:39.184252
2021-07-27T07:45:07
2021-07-27T07:45:07
130,671,122
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.karsa.controller; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @Slf4j @RestController @RequestMapping("/seckill-graylog") public class GraylogController { @GetMapping("/query") public Object queryLog() { log.info("INFO查询学生信息"); log.warn("WARN查询学生信息"); log.error("ERROR查询学生信息"); return "success"; } }
[ "wqwking@126.com" ]
wqwking@126.com
d2b7d3c2fbbe02e14fb6afbd82ba5dfd0c218267
7ee8df9c8d5cb76d2313a2c050d320687509fe6c
/model-crawler/src/main/java/eu/arrowhead/crawler/provider/security/CrawlerProviderSecurityConfig.java
1b04b51a87a1b70b55ab291528fe45935c6caec4
[]
no_license
nszioual/MAAS
d5da3bbff33a1766d1c75e26e3d51e8540668be4
4e3c0a7748094343f183fbc87ca56c044a43951b
refs/heads/main
2023-08-18T17:22:19.985917
2021-10-16T11:24:09
2021-10-16T11:24:09
401,351,830
0
0
null
null
null
null
UTF-8
Java
false
false
1,699
java
package eu.arrowhead.crawler.provider.security; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter; import eu.arrowhead.client.library.config.DefaultSecurityConfig; import eu.arrowhead.client.library.util.ClientCommonConstants; @Configuration @EnableWebSecurity public class CrawlerProviderSecurityConfig extends DefaultSecurityConfig { //================================================================================================= // members @Value(ClientCommonConstants.$TOKEN_SECURITY_FILTER_ENABLED_WD) private boolean tokenSecurityFilterEnabled; private CrawlerProviderTokenSecurityFilter tokenSecurityFilter; //================================================================================================= // methods //------------------------------------------------------------------------------------------------- @Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); if (tokenSecurityFilterEnabled) { tokenSecurityFilter = new CrawlerProviderTokenSecurityFilter(); http.addFilterAfter(tokenSecurityFilter, SecurityContextHolderAwareRequestFilter.class); } } //------------------------------------------------------------------------------------------------- public CrawlerProviderTokenSecurityFilter getTokenSecurityFilter() { return tokenSecurityFilter; } }
[ "anass.zioual@gmail.com" ]
anass.zioual@gmail.com
bac08098ef2463b75c4d600ce5ca492e8334d8a1
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-voiceid/src/main/java/com/amazonaws/services/voiceid/model/Tag.java
17f5878383a144af865b8d260bc75a5f80ac8fb0
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
7,050
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.voiceid.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** * <p> * The tags used to organize, track, or control access for this resource. For example, { "tags": {"key1":"value1", * "key2":"value2"} }. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/voice-id-2021-09-27/Tag" target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Tag implements Serializable, Cloneable, StructuredPojo { /** * <p> * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the key is 'Department'. * </p> */ private String key; /** * <p> * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the value is 'Sales'. * </p> */ private String value; /** * <p> * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the key is 'Department'. * </p> * * @param key * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the * tag 'Department':'Sales', the key is 'Department'. */ public void setKey(String key) { this.key = key; } /** * <p> * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the key is 'Department'. * </p> * * @return The first part of a key:value pair that forms a tag associated with a given resource. For example, in the * tag 'Department':'Sales', the key is 'Department'. */ public String getKey() { return this.key; } /** * <p> * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the key is 'Department'. * </p> * * @param key * The first part of a key:value pair that forms a tag associated with a given resource. For example, in the * tag 'Department':'Sales', the key is 'Department'. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); return this; } /** * <p> * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the value is 'Sales'. * </p> * * @param value * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the * tag 'Department':'Sales', the value is 'Sales'. */ public void setValue(String value) { this.value = value; } /** * <p> * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the value is 'Sales'. * </p> * * @return The second part of a key:value pair that forms a tag associated with a given resource. For example, in * the tag 'Department':'Sales', the value is 'Sales'. */ public String getValue() { return this.value; } /** * <p> * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the tag * 'Department':'Sales', the value is 'Sales'. * </p> * * @param value * The second part of a key:value pair that forms a tag associated with a given resource. For example, in the * tag 'Department':'Sales', the value is 'Sales'. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withValue(String value) { setValue(value); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKey() != null) sb.append("Key: ").append("***Sensitive Data Redacted***").append(","); if (getValue() != null) sb.append("Value: ").append("***Sensitive Data Redacted***"); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Tag == false) return false; Tag other = (Tag) obj; if (other.getKey() == null ^ this.getKey() == null) return false; if (other.getKey() != null && other.getKey().equals(this.getKey()) == false) return false; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode()); return hashCode; } @Override public Tag clone() { try { return (Tag) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.voiceid.model.transform.TagMarshaller.getInstance().marshall(this, protocolMarshaller); } }
[ "" ]
413f559e4e736d44be51e4b746e8c84062193729
b912f504b8516c734aec2ac603419401260fa58b
/INFORMATICS/Task_3.2_3.5_3.6/src/com/company/IteratorForEndlessArray.java
7f4c839ba71040467027c420f29fe254cd0d8213
[]
no_license
Karim-Valeev/ITIS-undergraduate
4861e6c210945c38c94ce6d88b2fcf16ebb04716
47f68bbcfe32dc8bdd4825cbd1b915e48a2d4b3c
refs/heads/master
2020-09-12T14:12:17.373340
2020-07-27T00:02:36
2020-07-27T00:02:36
222,449,373
2
1
null
null
null
null
UTF-8
Java
false
false
1,036
java
package com.company; import java.util.Iterator; public class IteratorForEndlessArray<T> implements Iterator<T> { public T[] data; private int cursor; public IteratorForEndlessArray(T[] data){ this.cursor = 0; this.data = data; } @Override public boolean hasNext() { return cursor < data.length; } @Override public T next() { try{ cursor++; int n = cursor - 1; return data[n]; } catch (ArrayIndexOutOfBoundsException ex){ throw new java.util.NoSuchElementException(); } } @Override public void remove() { for(int i = cursor; i < data.length - 1; i++){ data[i] = data[i+1]; } cursor--; } public static void main(String[] args) { Integer[] a = {1,2,3,4,5}; IteratorForEndlessArray<Integer> it = new IteratorForEndlessArray<Integer>(a); while(it.hasNext()){ System.out.println(it.next()); } } }
[ "noreply@github.com" ]
Karim-Valeev.noreply@github.com
9a7d5843981b26c72d5e090df82493c1f9a25ded
eafc121b9fdfd11b36c448b30d1d7b4b400e8445
/src/Contest/WeekOfCode26/WOC27/DrawingBook/Solution.java
8d1f4f1c59f8484d86afedd1fcff37bfdcf43886
[]
no_license
robergimenez/HackerrankExercises
1939c0722a2b7ae7dd48f322758f435ee45844c8
584d52946cd56ccf6a285df7d18c42473651cebb
refs/heads/master
2021-01-20T07:35:43.481165
2017-12-27T14:55:56
2017-12-27T14:55:56
101,546,453
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package Contest.WeekOfCode26.WOC27.DrawingBook; /** * Created by rgimenez on 20/12/2016. * Ordering */ import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int p = in.nextInt(); // your code goes here if (p > n/2){ } } }
[ "robergimenez@gmail.com" ]
robergimenez@gmail.com
f147be2972778c5b99464cc37514f1b00aa63998
79e5503a9569129aa8ccb3705e96cf4a4a9241c2
/src/main/java/com/ryan/playertracker/Main.java
bb0c59d2bd36627fb8f30f29f4c7b326718d4d6f
[]
no_license
Rayn322/PlayerTracker
87d5c263a52a1096e5360c358b496db1e9943c47
f5538fc69b1f802996f01dbdcc3feb36257f5a3c
refs/heads/main
2023-06-04T07:40:39.217834
2021-06-20T02:34:58
2021-06-20T02:34:58
335,370,780
0
0
null
null
null
null
UTF-8
Java
false
false
5,970
java
package com.ryan.playertracker; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import org.bukkit.*; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.CompassMeta; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; import java.util.logging.Level; public class Main extends JavaPlugin implements Listener { private static Main plugin; private final String syntaxError = ChatColor.RED + "Syntax: /track or /track <player>"; public static Main getPlugin() { return plugin; } @Override public void onEnable() { getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(new GUIHandler(), this); plugin = this; } @Override public void onDisable() { } @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("This command is only for players!"); return true; } // makes sure it doesn't crash if there are no args if (args.length == 0) { Player player = (Player) sender; GUIHandler.openGUI(player); return true; } if (label.equalsIgnoreCase("track")) { Player player = (Player) sender; try { giveCompass(player, Bukkit.getPlayerExact(args[0])); } catch (NullPointerException exception) { player.sendMessage(ChatColor.RED + "Could not find that player."); } } else if (label.equalsIgnoreCase("help")) { sender.sendMessage(syntaxError); } else { sender.sendMessage(syntaxError); } return true; } // updates the compass when it is right clicked @EventHandler public void playerInteract(PlayerInteractEvent event) { if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR)) { if (!event.hasItem() || !event.getItem().getItemMeta().hasDisplayName()) { return; } Component displayName = event.getItem().getItemMeta().displayName(); // Convert displayName to string and then check if it contains "tracker" if (event.getMaterial() == Material.COMPASS && PlainTextComponentSerializer.plainText().serialize(displayName).contains("Tracker")) { CompassMeta compassMeta = (CompassMeta) event.getItem().getItemMeta(); PersistentDataContainer data = compassMeta.getPersistentDataContainer(); Player player = event.getPlayer(); NamespacedKey key = new NamespacedKey(this, "player"); // Check if it has a player name stored in case it got renamed with an anvil if (data.has(key, PersistentDataType.STRING)) { Player tracked = Bukkit.getPlayerExact(data.get(key, PersistentDataType.STRING)); if (tracked != null && tracked.isOnline()) { compassMeta.setLodestone(tracked.getLocation()); event.getItem().setItemMeta(compassMeta); player.sendMessage(ChatColor.GREEN + "Updated location of " + PlainTextComponentSerializer.plainText().serialize(tracked.displayName())); } else if (tracked != null && !tracked.isOnline()) { player.sendMessage(ChatColor.RED + "That player is offline!."); } else { player.sendMessage(ChatColor.RED + "That player couldn't be found!"); } } else { player.sendMessage(ChatColor.RED + "For whatever reason we can't find who to track. Please run /track again."); } } } } // gets a compass with data to keep track of the player to be tracked private ItemStack getCompass(Player tracked) { ItemStack compassItem = new ItemStack(Material.COMPASS); CompassMeta compassMeta = (CompassMeta) compassItem.getItemMeta(); PersistentDataContainer data = compassMeta.getPersistentDataContainer(); data.set(new NamespacedKey(this, "player"), PersistentDataType.STRING, tracked.getName()); compassMeta.setLodestoneTracked(false); compassMeta.setLodestone(tracked.getLocation()); compassMeta.displayName(Component.text(tracked.getName() + " Tracker")); compassItem.setItemMeta(compassMeta); return compassItem; } // gives the compass to the player public void giveCompass(Player tracker, Player tracked) { getLogger().log(Level.INFO, tracker.getName() + " is now tracking " + tracked.getName()); if (tracker.getInventory().firstEmpty() == -1) { Location location = tracker.getLocation(); World world = tracker.getWorld(); world.dropItemNaturally(location, getCompass(tracked)); } else { tracker.getInventory().addItem(getCompass(tracked)); } tracker.sendMessage(ChatColor.GREEN + "Now tracking " + tracked.getName()); } }
[ "16494880+Rayn322@users.noreply.github.com" ]
16494880+Rayn322@users.noreply.github.com
39cc0c70b341e96eb818b696f2ff329fea89a8e2
00c4b832862cb4264946c6f9c52a409043f72dcc
/src/a3_math/basic/A066_PlusOne.java
805e3f50ae997f75969d891db8a74108d7c1dc30
[]
no_license
YongGY/leetcode
e4c1ead4604f36f5fc9bad3127cba8e9b43cd5c9
9f399e0bb503f068663f5821d3308263c94fb012
refs/heads/master
2018-10-22T04:03:16.438335
2018-10-09T20:29:35
2018-10-09T20:29:35
108,002,486
0
0
null
null
null
null
UTF-8
Java
false
false
1,176
java
package a3_math.basic; import java.util.Arrays; /** * Given a non-empty array of digits representing a non-negative integer, plus one to the integer. * <p> * The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit. * <p> * You may assume the integer does not contain any leading zero, except the number 0 itself. * <p> * Example 1: * Input: [1,2,3] * Output: [1,2,4] * Explanation: The array represents the integer 123. * <p> * Example 2: * Input: [4,3,2,1] * Output: [4,3,2,2] * Explanation: The array represents the integer 4321. * * @author William */ public class A066_PlusOne { public static int[] plusOne(int[] digits) { for (int i = digits.length - 1; i >= 0; i++) { if (digits[i] != 9) { digits[i]++; return digits; } else { digits[i] = 0; } } int[] R = new int[digits.length + 1]; R[0] = 1; return R; } public static void main(String[] args) { System.out.println(Arrays.toString(plusOne(new int[]{9, 1}))); } }
[ "715guoyong@gmail.com" ]
715guoyong@gmail.com
6e9dd2a9420ba9c33b356ce3bc17b37956c04303
ac7e1177363f97627d7489ada798184a990fce06
/inma06/app/src/main/java/chat/chatRoom/ChatRoomMainActivity.java
31e937127b170ff1f3bdd5432638fa36462b8502
[]
no_license
inma06/NOVA
e0c7bdd7102a52008b4df165b0c2cf01eb1c260c
a9272084f346efff15e19632563677a5a5a82feb
refs/heads/master
2022-01-18T15:08:14.990480
2019-07-03T08:42:09
2019-07-03T08:42:09
172,613,924
0
0
null
null
null
null
UTF-8
Java
false
false
16,571
java
package chat.chatRoom; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.teamnova.nova.R; import org.json.JSONException; import org.json.JSONObject; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.util.ArrayList; import java.util.LinkedList; import main.HomeActivity; public class ChatRoomMainActivity extends AppCompatActivity { private RecyclerView mRecyclerView; private ImageView mButtonSend; private EditText mEditTextMessage; private ImageView mImageView; private ChatMessageAdapter mAdapter; /* TEST CODE start */ public static int PORT = 9999; // public static String IP_TEXT = "192.168.0.26"; // Test Server ( local ) public static String IP_TEXT = "13.124.10.133"; // Real Server public static String USER_ID = HomeActivity.mNickName; public static String ROOM_ID = "10"; public static String TARGET_ID = ""; Socket socket; ReceiveThread receive; SocketClient client = new SocketClient(ROOM_ID, USER_ID); Handler msgHandler; SendThread sendToServer; LinkedList<SocketClient> threadList; /* TEST CODE end */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat_room); mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); mButtonSend = (ImageView) findViewById(R.id.btn_send); mEditTextMessage = (EditText) findViewById(R.id.et_message); mImageView = (ImageView) findViewById(R.id.iv_image); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mAdapter = new ChatMessageAdapter(this, new ArrayList<ChatMessage>()); mRecyclerView.setAdapter(mAdapter); threadList = new LinkedList<ChatRoomMainActivity.SocketClient>(); // 소켓 연결 threadList.add(client); client.start(); // 메시지 수신 핸들러 msgHandler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == 1111) { // 여러 핸들러들을 구분하기 위한 고유번호 // 메시지가 수신되면 리사이클러뷰에 아이템을 추가한다. Log.e("받은 메시지", msg.obj.toString()); /* * 서버에서 보낸 Json Data 예시 * { "isImage" : false, "imageStr" : "BASE64 IMAGE String TEST...", "serverTime" : "오후 11:49", "userMsg" : "123", "userId" : "223", "roomId" : "10" } * * */ try { JsonParser jsonParser = new JsonParser(); JsonObject jsonObj = (JsonObject) jsonParser.parse(msg.obj.toString()); String userMsg = jsonObj.get("userMsg").getAsString(); String serverTime = jsonObj.get("serverTime").getAsString(); String userId = jsonObj.get("userId").getAsString(); String roomId = jsonObj.get("roomId").getAsString(); Boolean isImage = jsonObj.get("isImage").getAsBoolean(); // String imageStr = jsonObj.get("imageStr").getAsString(); mimicOtherMessage(userMsg, null, isImage); //메시지 수신시 아이템 추가 메서드 System.out.println("userMsg >> "+ userMsg); System.out.println("imageStr >> " ); System.out.println("isImage >> " + isImage); } catch(Exception e){ e.printStackTrace(); } } } }; // 메시지 보내기 버튼 리스너 mButtonSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String message = mEditTextMessage.getText().toString(); if (TextUtils.isEmpty(message)) { return; } //클라이언트에 먼저 보이게 하고, 서버로 채팅메시지를 보낸다. sendMessage(message, null, false); sendToServer = new SendThread(socket, message, null, false); sendToServer.start(); mEditTextMessage.setText(""); } }); // 이미지 보내기 버튼 리스너 // 앨범 액티비티로 이동한다. TODO : 다중이미지 전송 가능하게 mImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // sendMessage(); 테스트용 // 이미지를 BASE64로 변환하고 String image 에 담는다. String image = ""; // BASE64 to String Converting image = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApEAAAKPCAIAAAC6lQZ3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAP+lSURBVHhe7P0FlBXH2reNx4AEAoQIMtt13IfBBpgZdAR3C+5x9wSPu7s7EUiIkUDchSTE3UPknPd5nte/b63/dde9d02zZ+BwyMnJf9ZXvS6a6urq8rp/Vd29e/aIhcIOh8PhcDj+/x+n2Q6Hw+FwtA6cZjscDofD0Tpwmu1wOBwOR+vAabbD4XA4HK0Dp9kOh8PhcLQOnGY7HA6Hw9E6cJrtcDgcDkfrwGm2w+FwOBytA6fZDofD4XC0DpxmOxwOh8PROnCa7XA4HA5H68BptsPhcDgcrQOn2Q6Hw+FwtA6cZjscDofD0Tpwmu1wOBwOR+vAabbD4XA4HK0Dp9kOh8PhcLQOnGY7HA6Hw9E6+Ms0O+IPxXy+aCgcCkZC/mDU7w8Hw6FwNBIOR0OBWNAXD/n84WgwGImEorFwNBGOJsOJjEh2nUQoHA+GooFQJBCMBkPhQCgajkXD8UgoRvzBEMmGIhIyGguRYiAc8MXD0XgkRtIZUe0iUrRIOB4OJ4PBeIBCRmLhWCQYi0kGfKGgP+QPc5gIx+KhSCIUS4bjyWA0GYzE/dFYMJIR278EaiAWCMX84UQgSpljEYoWjRpiZCoYjVDdAX8kRMajYfIQDMkl5FyqJTM2DyGT4SiNFw2HKAslkkomnlA0HpK2i/j9IZ8vRLl9kXCA5KgfST3BVdRAwJ+g0bkqHJd4AsF4JBwLZ6TihcqMx01g0oqHpbrIOZkmD/FoNMH5YDjLHwgFJM4oAYIB2iIRIBVKlBHbriItFZYmi1KyYDAUCkq3CYc4pK4IID0pEIhGotRhWNzUZzhMozeLaheJhsg8HZX0AiQUkj11G44HQokwKQbDgTB9WModiFDVUXbkIhAMB4MZUe0iURIJBakrKUuIYcJwiHcP0HWJMJCgDiNRKlz6j/eq7Q//tUinkoKF6EV04ESYLhQK+IKBgFiMMBUQkewlGGjpNomRW39498cRHSYSi9J56JMhxoafstO7pLEDpmWlcRkptG8kHgwn6RsRWp2aJ3yz2HYZKpwCxPwhWjEhHZXeQ3eiXL5YNJKI0IH1LI0STEQipJsIYi3JXmZUFrIXDwgMurAvS8siw4HRzQiKSN1Rt3HqCqvo605nSpCHYCBMzM1i+/ORfhsNxbBIVAINIYM66Be7LeOdfPqSYfonzUJjRKSfBwOJoD/+B3Ir4ysYiAYCpBgnTfpYDAsZDPsQJmxmIOAjQIya1NoOBUSt/iQr/Q/5SzRbunXEH4gH0OxIbiJZWZjbvySnKCdZkpddlJ8DxXmJotxIdm6if2VZeVFhMoaVD/4Rzaa6c6Pxouycouzs/EQ8P5Eozs0rysnLjWfnJXLyc3ILshOFyWRJMqckJycvGRXNjqAKu29tgalBQXa8LCdenB3Pz84uyk6SgZLsWFFOtCA7lhfH9DMnkCSQrmQonkS5kbEAneNP6Q0YO8ZtLBDNDUrvR96Qn7xEdlFuTlEikR2nBshqIicWR7DFEDIYMFUyhHaWHwa80eCIyC+WJRQn/zLbCmE947EAkpNEgAuzY72KCnoVF/cuKipNxhFybGJCzC0FD2aLAiF18ajYDqzhzsVVJkBezZYBpjaUER4O0oAlubFepQV9Swt7FhbmxeMxP7PAaDLAmM+IaldRMxoPBXPj0YKcRG4ymoMjm05Lp8rJjcULc7KLc5MF2dHc7GRhdrQwNzs3HjOWd/dbU5ooFEvEo0X5iSJ6ZoEROekSWDy3SJpvGVEY/Bm0rGKS9Nwf5ZNEsWjVCzxx6352yqCOlKSA0xe5Wp/6Zi/lNoDJqcXO6JIeqpFo28OaTLWe+wsp3BBrARNsdetR3NgoHNjKmfID42D+mEMi/5I3hiTvU92CMWopp2BFUQ8EAWvWQE3lXi4SY8/hmRK00BNPyOM6M0heeQMBYbg7J9yJ2zG5XQFMCbqJeMYBmQUCTQlGIGmkpGhAr+nmCZ0PZmsG3XvWwfjYfpIik0CS6xsRHA9iRFY0tGWT3I/NTMH5mZhoDJqUzSWV4Ajh1BsB2ji/uWYeXh89uc61glJ9mxuCmXZt5bBKlPA1dlVos3vA5FjVCxhbUF18MM8PReYv21wu2pjACcxTx57gpmosntCI0EMvwlFfY7JiP8vwpvGZuTEVixp7ylsOVSrP/OseGpVQXPjNb0Eo/GkG25nRNiIRgCqRliMP4Zgb0J/QPSd4MET50rOyoRnpzVp0vN4VRG+H8KTbQFKL7WgDd1UxXwD7ufpXkVecuCu6lCMvAE21FgsteEJwmLliXDM4OmIreEJKRJbw/5IVFvSBthi73CGxJSo7hZubQsGkOLZESb4bNHMODfGf7tCAUgkGZngT3BWiDzQmjxwmCKcDCo2GCCuXC78IaMCBVvJGnS8XOJN7Be7sV7dvtK8EZoY5MIvRfaeP4pzIUmrUw0gM2DpmvzkLq8GSZwEEEliBLwBwSfgSm/tyDbl4ILRY9N9Ipqcyo2QmkkafAR5ZaRH8bdnKaQOyW0A+SsX7LE3p/lB8lSMAQMD9JN5dxk3uAL+JQsypVqei2g3x9oOuvz+/yQyp6pH8mwrTdvKWw9mHRNbXCYqhnyloL8mCxJDLbgflKXMHIvLkTFat0qwXTFN6W+czTpJp+m7Nk4m6FhdoAWYUc0JWTY7lSzqP4hUkzalNqQWpJ6sJUp8W8fOLN69RKbekuXCKl2ySRMZyEm06tTtY0/nVaaLGKjTSOXbJdE+tAbzPQ9RRtRkC5mSCVBSC2mxYTHke4M3v4gp/4INm9NmES1DtMJNeWWTDIgALcZwk0XpuJsqlXxNGFMc6TL0hSyCU2lORnBpPMbhzkrEYZpI20RSCWdUfmarsnqzjOcCp++xObcxqDp2gFomkzaRbARmti0w3jB03SSpvibFTAVv6I9agc0JZeKX+2GtIt/jwE9i3ZE/5bICONFAlQUKhmnvPSvKKoqL6iqKAQJnPIvHlBp8IT0kDprIt9hflKe6TxYSIizAyuLleYJNQX2eKZOtYQ9a+OUaG0Ak2KqdDukKbbm2PgzMalI7SkalV6SLpSNRDy9SO0VVRkk9bTb0r8ntSTgsO4UUsCS/j2Lq8rlQtMcJew57FtWUFWW378sb0B5/sDygoEVBdUVhdU9DRWFAyWqAkuVl4r8qoqmU80ZULETCgdWlkL/ipKqCsoFJWQGBvQslYxVEH9B/5awFSJVpC1VXtAPyvLZU0aJjb2ikVNe6+P1F4gnFUBpCpNmQM+Sgb3IbaoCq8pJUToAdSilkFOCqVIJI9hG2TGc7VdeCNoomk8llY3tw3vRyFuEs5KTHeFJIs12Z3dE8/w0JSq1YXqUqSITkhZMVZQUUMKnE5VKS9ebqTpz1otca93bZ3V7JMMmRW3HpvCeElnMJRLYNKJWu6AXGv/UhTZkuoDaTEqqsdJRpSDP+GuWUslJxryJ7oym/LdIs/Aas0lIr9V8NoXXw57F6UpOZSldLkMqe3JKO3A6mMmziaQpwnS6/xDJSapW5VDzmWrxSgb7dmdNAM2AzeF2+ZTw5hKp/LJU/UtVE0M6xXRuU4eaZw2WutyQLst2mGDenqARmsxY0glJeE9sUrQdkA6/3SjoV4aNKsDe7nH01GE7ZMrQo3YMZ7cPLOF3fkmKyUOOnDyEvZCO5xiYNhw0gKHZhVOGyoXNPFNMlrMtM2kwAdL5bHZhGs2/FMQWaqfhQbKdCjaMQ5OWJHeEwQZLx+ypMRN+ZzSrBI0Bx+ETBh0x0TBpMCk2VaNpgqbANq00csoGlpxLhcOxZn/0lMHHTB1yzLShcCxMH3acMoO9CUMkU6S8x06rO3Z6Xdpn6DFThhw7dchxlmlD2eNzrEQ4+JgZw+BoYejR0zORhHaLY6bWHz2l7tip9cdNb4RjptbpofEnV4OPJmkpjpRILpk+TEukhU1BDWjfM/WDz/GHNhw/o/44RcooxUwxve646Xiqv16ertvteoJpJk/3oxHT1TVcA9iGyCB1Ku32HraI9jdvm0IqJ80C7zoaQ4vYAmpaNrldwV6Solm6glRXumbUPdn01Wkp++BxpOpfa5jwmitNS5uMMKm0DHrK0uRpI0zH2dxfO4BCHjSMBLN9Y0b98YcKJ8xsFOhI6b5kL9Rgiscn5Wl9xFMhzjQmjAbOhPDerDajqcgpNM+GVGtq1ZnwNgPiSB+mwqtbz5qhIZd4a8yYFPFPHabRkIZUPHJ5i6Qy1pSox22j0myAVFG6qq2n+Ge45VpNXX1MrZoLaSkd1E21rRGaU+xTkZgmsP7ayk2H6Uv0sEX/VCOm09KzLXL8DAmcCu9xKHucNG3Qv4apg05Mg3snnDxt8CnThwAOwOfEqbUnTqk9YXKNMKUJPLeDYFNrJZKMpBVPEpkXTjFX6SkTSQo9K+7tM58R846RIkxvKoVke3LN8ZOqFZtoKuT2eOPJoClvnpxbrKfEQ03OGHLqjKFw2qHD2JMfqd4ZLWEDHzr09JnDz5hVd+bs+rPmNKSYW7dsXv2y+fXL5zesWNC4cuGIVYtGrl48avWSUWcvHXvO0vFnLxm3ZvHY1YvGrFo4esX8kVxCJKceOuyUmXUnzaw7EWlHIKcMOmZy7dGTa3EcO3UwPsdPHypMQ8szwfOEqYN3gxOn0nmGnjiFqqDmYciJZn/aoXVnzR2xfD40ZJRizZLRa5aOPnvpmDWLx2gRYOWCURRk+bwRy+Y1LpsrZHieNbeRYlJLWlEa7Ky54kPtUXytc2qVwzNm153u9Uz3cNDW4ZRC/eNJOx4/uRqkoU2HpOnx50Ib/hRCHjqkRTilaUly6WxIoqZD/hG8XTET08+9SFdMn5Wkd4jpfgbchqYUqQEz9nU8mkrw9uqZwyisVsVJMwafOH3QCdMGnTC19vgpNWAjOSntaIIKMRemmClRNWEHwmwZCLZN8YTTZg0/jQadXXfGnPoz5zWcRdPTrxaMXLFw1MpFo1cuHrNqibB6ydg1S8edfdj4cw6fcM4RwvlHTr7gyMnszz9i0nmHTzz3sAlwDgGWjj/38AnnHzX5vCMnnX34+NVLx65aMpbLufbcIyfhf+7hEwkjA40IYUkTa5aMk0R3wPKFo8jhjjh9Tp2Uxcvs4ZRLMYUddtpM6WzWIOhYOHNOvdSDPTu7LnVq3ghGhwwQE4artBMSRi6f28ApQu4IrlpBNTLEmtAxKzAAV5sRau2MBDBpMRhpgmULUq2wYtFoWLl49Cppi7HsqQr2tkXOlhaZeO6RE6lwoDmAprnwqCkXHj3loqOnwsXHTLvomGl4KucTLB1SoVFoLBr33CMkHprp/KOnXHDMlAuPmXrhsVNlf8zUC/A5eoq2LMnRB0hamvWwCXQAkKgk5skXHJVK/cKjp4pj55DDY6ZefOy0S46dfulxMy47/tDLT5gJe9x511074o4777zt9tubc/sddwBnM8J7ue/+"; if(TextUtils.isEmpty(image)) { return; } else { // 클라이언트에 보이는 이미지 sendMessage(null, image, true); // 서버로 보내지는 이미지 sendToServer = new SendThread(socket, null, image, true); sendToServer.start(); } Toast.makeText(ChatRoomMainActivity.this, "이미지전송 버튼, 앨범으로 이동합니다.", Toast.LENGTH_SHORT).show(); } }); } // 메시지 전송(텍스트 or 이미지) // 보낼텍스트( 없으면 null ), 보낼이미지( 없으면 null ), isImage (이미지 전송시 true) // 먼저 클라이언트의 뷰에 출력하는 메서드 private void sendMessage(String message, String image, Boolean isImage) { ChatMessage chatMessage = new ChatMessage(message, image, true, isImage); mAdapter.add(chatMessage); mRecyclerView.scrollToPosition(mAdapter.getItemCount() - 1); } // 메시지 수신(텍스트 or 이미지) // 뷰에 출력하는 메서드 private void mimicOtherMessage(String message, String image, Boolean isImage) { ChatMessage chatMessage = new ChatMessage(message, image, false, isImage); mAdapter.add(chatMessage); mRecyclerView.scrollToPosition(mAdapter.getItemCount() - 1); } // SocketClient 클래스 /* * 소켓연결을 하기 위한 클래스 * 방번호와 유저번호로 서버로 연결을 한다. * */ class SocketClient extends Thread { DataInputStream in = null; DataOutputStream out = null; String roomNo; String userNo; public SocketClient(String roomNo, String userNo) { this.roomNo = roomNo; this.userNo = userNo; } @Override public void run() { try { // 채팅 서버에 접속 ( 연결 ) ( 서버쪽 ip와 포트 ) socket = new Socket(IP_TEXT, PORT); // 메시지를 서버에 전달 할 수 있는 통로 out = new DataOutputStream(socket.getOutputStream()); in = new DataInputStream(socket.getInputStream()); Log.e("성공", "데이터 전송 성공11"); // 서버에 초기 데이터 전송 ( 방번호와 유저번호가 담겨서 간다 ) - 식별자 JSONObject jsonObject = new JSONObject(); try { jsonObject.put("roomNo", ROOM_ID); jsonObject.put("userNo", USER_ID); } catch (JSONException e) { e.printStackTrace(); } out.writeUTF(jsonObject.toString()); // out.writeUTF(roomNo + "&" + userNo); receive = new ReceiveThread(socket); receive.start(); Log.e("성공", "데이터 전송 성공22"); Log.e("성공", "방번호 : " + roomNo); Log.e("성공", "유저번호 : " + userNo); } catch (IOException e) { e.printStackTrace(); Log.e("실패", "ReceiveThread 시작 실패"); } } } // SocketClient 클래스 끝 //메시지 수신 하는 ReceiveThread 클래스 시작 class ReceiveThread extends Thread { Socket socket = null; DataInputStream input = null; public ReceiveThread(Socket socket) { this.socket = socket; try{ // 채팅서버로부터 메시지 받기 위한 스트림 생성. input = new DataInputStream(socket.getInputStream()); }catch(Exception e){ } } // 메세지 수신후 Handler 로 전달 public void run() { try { while (input != null) { // 채팅 서버로 부터 받은 메시지 String msg = input.readUTF(); if (msg != null) { // 핸들러에게 전달할 큐 객체 Message hdmsg = msgHandler.obtainMessage(); // hdmsg -> 핸들러 메시지 hdmsg.what = 1111; // 핸들러 큐를 구분하는 값(사용자 정의 값) // 서버에서 받은 메시지 hdmsg.obj = msg; // 핸들러에게 메시지 전달 ( 화면 처리 ) msgHandler.sendMessage(hdmsg); } } } catch (IOException e) { e.printStackTrace(); } } } // ReceiveThread 클래스 끝 // SendThread 클래스 시작 /* * 서버로 메시지를 발신하는 쓰레드 * * */ // 서버로 발신하는 쓰레드 class SendThread extends Thread { Socket socket; String sendMsg; String base64Image; Boolean isImage; DataOutputStream output; public SendThread(Socket socket, String sendMsg, String base64Image, Boolean isImage) { this.socket = socket; this.sendMsg = sendMsg; this.isImage = isImage; this.base64Image = base64Image; try { //채팅 서버로 메시지를 보내기 위한 스트림 생성 output = new DataOutputStream(socket.getOutputStream()); } catch (Exception e) { } } // 서버로 메시지 전송 ( 서버의 temp 변수로 전달된다. ) public void run() { try { if ( output != null ) { if (sendMsg != null) { // 서버로 메시지 전송하는 부분 // TODO: Json 으로 변환하여 보내기 // mRoomNo( 방번호 ) , userNo( 유저 번호 ), targetUserNo ( 상대방 번호 ), // sendMsg (보내는 메시지) , isImage( 이미지인지 텍스트인지 구분) // 구분 문자 "&" JSONObject jsonObject = new JSONObject(); jsonObject.put("roomId", ROOM_ID); jsonObject.put("userId", USER_ID); jsonObject.put("targetId", TARGET_ID); jsonObject.put("userMsg", sendMsg); jsonObject.put("isImage", isImage); jsonObject.put("userImage", base64Image); output.writeUTF(jsonObject.toString()); } } } catch (IOException e) { e.printStackTrace(); } catch (NullPointerException npe) { npe.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } } }
[ "pakbongho@gmail.com" ]
pakbongho@gmail.com
5352c17b910694831b3e0c87803c8620ab8172db
24c4d6d16247775af23a4094b4f5bec2652f12ac
/Collection Framework/Collection Framework/src/HashSet1.java
437a0c6e54ae3a31ea001cca620fc38abbb57dab
[]
no_license
Manas2909/Core-Java
75ab6aa34265fbdae45d7cc9b27194c532dc40a6
ce7632c73664d5605b30093c0228173f268f9d2c
refs/heads/master
2020-09-23T18:59:38.475996
2019-12-03T08:22:23
2019-12-03T08:22:23
225,563,714
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
//hashset pgm //over import java.util.*; class HashSet1 { HashSet<String> hs=new HashSet<String>(); void opns() { hs.add("kaveesh nadkarni"); hs.add("abc def"); hs.add("mno pqr"); hs.add("sangeeta nadkarni"); Iterator it=hs.iterator(); while(it.hasNext()) { String str=(String)(it.next()); System.out.println(str); } System.out.println("\n the fact that the element sangeeta nadkarni is present in the hash set is "+hs.contains("sangeeta nadkarni")+"\n the fact that the element sangeeta nadkarni is removed from the hashset is "+hs.remove("sangeeta nadkarni")); hs.clear(); System.out.println("\n the fact that the hashset is empty is "+hs.isEmpty()); } public static void main(String args[]) { HashSet1 hs1=new HashSet1(); hs1.opns(); } }
[ "noreply@github.com" ]
Manas2909.noreply@github.com
20ee0ba1ecd3b2334d3a49818a9614a6aa7e97d6
b5e992174be5250bcd999e17e4db6cb6e3e6aee7
/skytale-api-service/src/main/java/net/iceburg/skytale/apiservice/impl/SkytaleAdminImpl.java
35578c8fe4283c40a641b971325122193e508ba2
[]
no_license
briceburg/spring-boot-playground
cc8aeb8824d7a37fde8859b32f1d91bffdaf1764
8555d303e65ba8a71d6a5fc3656e02a91af92595
refs/heads/master
2022-06-08T03:27:28.112433
2020-05-03T23:02:11
2020-05-03T23:02:11
256,808,142
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package net.iceburg.skytale.apiservice.impl; import net.iceburg.skytale.openapi.server.api.AdminApi; import org.springframework.web.bind.annotation.RestController; @RestController public class SkytaleAdminImpl implements AdminApi { /* @Override public ResponseEntity<EncodeMessageResponse> encodeMessage(EncodeMessageRequest encodeMessageRequest) { return V1Api.super.encodeMessage(encodeMessageRequest); } */ }
[ "brice.burgess@phishme.com" ]
brice.burgess@phishme.com
0da80772e14aa2921fc567dfef6845fb2253fb66
1de611b4ae9a9e26fc265478f2632d00762290f8
/src/main/java/io/hobaskos/event/domain/util/FixedH2Dialect.java
3a4a33cbf3d92698b89edc8c69e6a1a46b01b453
[]
no_license
hobaskos/event.server
c2a1f4f8dd5e5a0eecf709a54b0f917542ce3504
7fce43b795551c3fd16047d2b2cd54c9da3e0786
refs/heads/develop
2021-01-11T20:03:08.580389
2017-05-11T16:08:34
2017-05-11T16:08:34
79,456,965
1
0
null
2017-05-11T16:08:35
2017-01-19T13:41:11
Java
UTF-8
Java
false
false
258
java
package io.hobaskos.event.domain.util; import java.sql.Types; import org.hibernate.dialect.H2Dialect; public class FixedH2Dialect extends H2Dialect { public FixedH2Dialect() { super(); registerColumnType(Types.FLOAT, "real"); } }
[ "alex@plastboks.net" ]
alex@plastboks.net
de8c3546f64a14413b4afcde5067d24e9500a927
0c75d874d73365c32882362bb080c52fb8f4aae4
/server-java/produtos-web/src/main/java/br/com/caelum/app/domain/Tarefa.java
ad7bac31bbcf95cd2e1db7729d5fbf241c16bb4e
[]
no_license
alessandrots/sgp-impacto-orcamento
84ff0f8d7067649fcac610dd76ca0e6b80e42102
38f3e7a5f48cdb85a017d3d4a416a8d7e0b6ed1b
refs/heads/master
2020-05-22T01:17:26.383718
2017-06-20T12:49:14
2017-06-20T12:49:14
53,086,810
0
0
null
null
null
null
UTF-8
Java
false
false
3,513
java
package br.com.caelum.app.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.validation.constraints.NotNull; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; /** * http://code.google.com/p/exemplos/wiki/jpaDezenove * * @author alessandrots * */ @Entity @Table(name="negocio.tb_tarefa") public class Tarefa implements Comparable<Tarefa>, Serializable ,Domain { /** * */ private static final long serialVersionUID = -5652715197735231887L; @Id @Generated(GenerationTime.INSERT) @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="icodigo", nullable=false) private Long codigo; @Column(name="snome", nullable=false, length=80) private String nome; @NotNull @Column(name="duracao", nullable=false) private Integer duracao; @NotNull @Column(name="data_inicio", nullable=false) @Temporal(TemporalType.TIMESTAMP) private Date dataInicio; @Column(name="data_entrega", nullable=true) @Temporal(TemporalType.TIMESTAMP) private Date dataEntrega; @Column(name="data_termino", nullable=true) @Temporal(TemporalType.TIMESTAMP) private Date dataTermino; @NotNull @Column(name="idWinTarefa", nullable=false, length=50) private String idWinTarefa; @NotNull @Column(name="ipacotetrabalho", nullable=false) private int pacote; /** * @return the codigo */ public Long getCodigo() { return codigo; } /** * @param codigo the codigo to set */ public void setCodigo(Long codigo) { this.codigo = codigo; } /** * @return the nome */ public String getNome() { return nome; } /** * @param nome the nome to set */ public void setNome(String nome) { this.nome = nome; } /** * @return the duracao */ public Integer getDuracao() { return duracao; } /** * @param duracao the duracao to set */ public void setDuracao(Integer duracao) { this.duracao = duracao; } /** * @return the dataInicio */ public Date getDataInicio() { return dataInicio; } /** * @param dataInicio the dataInicio to set */ public void setDataInicio(Date dataInicio) { this.dataInicio = dataInicio; } /** * @return the dataEntrega */ public Date getDataEntrega() { return dataEntrega; } /** * @param dataEntrega the dataEntrega to set */ public void setDataEntrega(Date dataEntrega) { this.dataEntrega = dataEntrega; } /** * @return the dataTermino */ public Date getDataTermino() { return dataTermino; } /** * @param dataTermino the dataTermino to set */ public void setDataTermino(Date dataTermino) { this.dataTermino = dataTermino; } /** * @return the idWinTarefa */ public String getIdWinTarefa() { return idWinTarefa; } /** * @param idWinTarefa the idWinTarefa to set */ public void setIdWinTarefa(String idWinTarefa) { this.idWinTarefa = idWinTarefa; } /** * @return the pacote */ public int getPacote() { return pacote; } /** * @param pacote the pacote to set */ public void setPacote(int pacote) { this.pacote = pacote; } public int compareTo(Tarefa o) { if (o instanceof Tarefa) { return getNome().compareTo(o.getNome()); } else { return 0; } } }
[ "alessandro.teixeira@gmail.com" ]
alessandro.teixeira@gmail.com
7de2147055ba35f26e9d942dbaf5d546413bb9ef
fe5c21128307417f25aec91e34923f57c93e07cd
/Task/src/main/java/com/task/service/AsyncService.java
7ba68377b2eb69023073a5455ed6d12fc83165ec
[]
no_license
RickUniverse/SpringBoot
60cb6e94d62720205cb1b7fc8773712831e127bd
c2d3784df3391bce2544eb56989f1ce59503566c
refs/heads/master
2023-02-16T04:07:42.602397
2021-01-10T13:37:01
2021-01-10T13:37:01
325,762,595
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package com.task.service; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; /** * @author lijichen * @date 2021/1/9 - 21:03 */ @Service public class AsyncService { @Async//这是一个异步方法 public void sayHello() { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("hello"); } }
[ "2388948195@qq.com" ]
2388948195@qq.com
2b55a2a72cdec8a1b370a1c49049f04a0596ef4b
8d882df7a74dc1b9480f4e7ca6d29fc616b4afc7
/cdm-api/commons/src/main/java/trueffect/truconnect/api/commons/util/GenericXlsSheetHeaderHandler.java
7f64953522e2f66f3d4b3ae39b2556ee153626f2
[]
no_license
asotogithub/JavaCDM
85ba0fa71a7ec2571969fd4f0bfbeccc4743a8e4
1420a0e9908ff99cc987db1a141507d1c73c434b
refs/heads/Develop
2020-05-31T09:26:34.755238
2017-08-04T23:08:50
2017-08-04T23:08:50
34,957,383
3
0
null
2017-08-04T23:08:51
2015-05-02T17:46:12
JavaScript
UTF-8
Java
false
false
6,646
java
package trueffect.truconnect.api.commons.util; import trueffect.truconnect.api.commons.exceptions.HeaderValidationProcessStoppedException; import trueffect.truconnect.api.commons.model.importexport.Column; import trueffect.truconnect.api.commons.model.importexport.XLSTemplateDescriptor; import trueffect.truconnect.api.resources.ResourceBundleUtil; import org.apache.commons.lang.StringUtils; import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; /** * Created by richard.jaldin on 5/12/2016. */ public class GenericXlsSheetHeaderHandler<E extends XLSTemplateDescriptor> extends GenericXlsSheetHandler<E> { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private Map<String, String> headers; private boolean isFirstColumn; private Map<String, Column> tableMapping; private XLSTemplateDescriptor alternativeDescriptor; public GenericXlsSheetHeaderHandler( SharedStringsTable sharedStringsTable, Class<E> clazz) { super(sharedStringsTable, clazz); headers = new HashMap<>(); isFirstColumn = true; } @Override public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException { if (name.equals("row")) {// row => row try { current = clazz.newInstance(); tableMapping = tableMapping != null ? tableMapping : current.getTemplateMapping(); currentCell = ""; currentRow = Integer.valueOf(attributes.getValue("r")); } catch (Exception e) { String message = "Illegal State. Cannot start reading row"; IllegalStateException ise = new IllegalStateException(message, e); logger.warn(message, ise); throw ise; } } else if (name.equals("c")) { // c => cell // Figure out if the value is an index in the SST String cellType = attributes.getValue("t"); currentCell = attributes.getValue("r"); nextIsString = cellType != null && "s".equals(cellType); } // Clear contents cache cellContent = ""; } @Override public void endElement(String uri, String localName, String name) throws SAXException { // Process the last contents as required. // Do now, as characters() may be called more than once if (nextIsString) { int idx = Integer.parseInt(cellContent); cellContent = new XSSFRichTextString(sharedStringsTable.getEntryAt(idx)).toString(); nextIsString = false; } if (name.equals("v")) { // v => contents of a cell String propertyName = fromCellReference(currentCell); if (currentRow == current.getHeaderRow()) { // If we are located in the header row, we must make sure // the header titles match the setter names. If so, it is a valid header // and the counter increases cellContent = cellContent.replaceAll("[ |-]", ""); if(isFirstColumn) { if("rowError".equalsIgnoreCase(cellContent)){ alternativeDescriptor = current.getAlternativeClassType(); tableMapping = getAlternativeTableMapping(); } isFirstColumn = false; } if (propertyName != null) { headers.put(cellContent.toLowerCase(), currentCell.replaceAll("[0-9]", "")); } } } else if (name.equals("row")) { if (currentRow == current.getHeaderRow()) { List<String> missing = new ArrayList<>(); boolean isWrongOrdered = false; for (Map.Entry<String, Column> entry : tableMapping.entrySet()) { Column property = entry.getValue(); String headerKey = headers.get(property.getProperty().toLowerCase()); if (headerKey == null) { missing.add(property.getProperty()); } else if (!headerKey.equals(entry.getKey())) { isWrongOrdered = true; } } if (missing.size() == current.getTemplateMapping().size()) { // Header row does not exist or it is in the wrong place throw new IllegalArgumentException(ResourceBundleUtil.getString( "importExport.error.noHeaderProvided")); } else if (!missing.isEmpty()) { // Check if missing some column throw new IllegalArgumentException(ResourceBundleUtil .getString("importExport.error.missingHeaderColumns", StringUtils.join(missing, ", "))); } else if (isWrongOrdered) { // Check if headers are disordered throw new IllegalArgumentException(ResourceBundleUtil.getString( "importExport.error.disorderedHeaders")); } else { // Utility exception to stop the check in // case of finding the headers // No need to localize this message as it will never be shown as a // visible response throw new HeaderValidationProcessStoppedException("Valid template structure"); } } } } @Override protected String fromCellReference(String s) { Column cell = tableMapping.get(s.replaceAll("[0-9]", "")); return cell != null ? cell.getProperty() : null; } private Map<String, Column> getAlternativeTableMapping() { Map<String, Column> result = new LinkedHashMap<>(); result.putAll(alternativeDescriptor.getTemplateMapping()); List<String> keys = new ArrayList<>(); keys.addAll(result.keySet()); for (int i = 0; i < 2; i++) { result.remove(keys.get(i)); } return result; } public Class<? extends XLSTemplateDescriptor> getAlternativeDescriptor(){ return alternativeDescriptor != null ? alternativeDescriptor.getClass() : null; } }
[ "abel.soto@TXBOMPONCE.bo.truextend.com" ]
abel.soto@TXBOMPONCE.bo.truextend.com
378af55be8d8f21f1ffc13885030b43adb986bfc
7dc01a867c2f392067688da050eb59437c83a269
/src/main/java/testcode/item/DvdItem.java
6898e816264ffaeddfc78a1172b6ce446e843ba4
[]
no_license
mae0003/unit_test
f38c95eacfff643eb32eef625c9e200d623be6b8
5d8267d3b696f21dfee33f189403b33e84b89717
refs/heads/master
2021-01-01T16:54:22.894602
2017-11-29T10:08:04
2017-11-29T10:08:04
97,950,048
0
0
null
null
null
null
UTF-8
Java
false
false
528
java
package testcode.item; import java.util.Map; public class DvdItem implements Item { String name; int price; Map<Integer, String> trackInfo; public DvdItem(String name, int price) { super(); this.name = name; this.price = price; } public static Item of(String name, int price) { return new DvdItem(name, price); } @Override public String getName() { return name; } @Override public int getPrice() { return price; } }
[ "mae0003@gmail.com" ]
mae0003@gmail.com
9d078d50af3e8289cee1ade7ebe11406ea0d125f
20a68bc8842f2de6f241da165f99650639dcf3f8
/007DesignPattern/HeadFirstDesignPattern/src/main/java/com/hef/design01/behaviors/QuackBehavior.java
ab4451d9323680ecd92c292eec741e21b4218e4c
[]
no_license
kinoko67/learning-area
6c7af64b677f60f0aa690348da7738615cf81711
6cf460938624833f6c7d586ffaae5c68fbbdae61
refs/heads/master
2023-02-17T14:17:11.059096
2019-10-23T05:39:13
2019-10-23T05:39:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package com.hef.design01.behaviors; /** * 叫的行为 * @Date 2019-05-28 * @Author lifei */ public interface QuackBehavior { /** * 叫的行为 */ void quack(); }
[ "hefrankeleyn@gamil.com" ]
hefrankeleyn@gamil.com
6f615a7dd3ac630dd77b1d1127a4c830acade0f1
828b905a3df6a9d92f9795ca2bfeb4a250eb415f
/app/src/main/java/test/bwie/com/zxingdemo/camera/CameraConfigurationManager.java
fee08fb3591ba65bba69003fb645a3faf2f0658b
[]
no_license
Chenruru/ZxingDemo
19e5d264fce5b21267bbffe2cac92157ac71a4b8
3c8a34dc53bd6c0689fad4666f484edf708bb198
refs/heads/master
2021-01-21T19:05:40.040282
2017-05-23T00:28:00
2017-05-23T00:28:00
92,111,353
0
0
null
null
null
null
UTF-8
Java
false
false
9,572
java
/* * Copyright (C) 2010 ZXing 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 test.bwie.com.zxingdemo.camera; import android.content.Context; import android.graphics.Point; import android.hardware.Camera; import android.os.Build; import android.util.Log; import android.view.Display; import android.view.WindowManager; import java.lang.reflect.Method; import java.util.regex.Pattern; final class CameraConfigurationManager { private static final String TAG = CameraConfigurationManager.class.getSimpleName(); private static final int TEN_DESIRED_ZOOM = 27; private static final int DESIRED_SHARPNESS = 30; private static final Pattern COMMA_PATTERN = Pattern.compile(","); private final Context context; private Point screenResolution; private Point cameraResolution; private int previewFormat; private String previewFormatString; CameraConfigurationManager(Context context) { this.context = context; } /** * Reads, one time, values from the camera that are needed by the app. */ void initFromCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); previewFormat = parameters.getPreviewFormat(); previewFormatString = parameters.get("preview-format"); Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); screenResolution = new Point(display.getWidth(), display.getHeight()); Log.d(TAG, "Screen resolution: " + screenResolution); cameraResolution = getCameraResolution(parameters, screenResolution); Log.d(TAG, "Camera resolution: " + screenResolution); } /** * Sets the camera up to take preview images which are used for both preview and decoding. * We detect the preview format here so that buildLuminanceSource() can build an appropriate * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest, * and the planar Y can be used for barcode scanning without a copy in some cases. */ void setDesiredCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); Log.d(TAG, "Setting preview size: " + cameraResolution); parameters.setPreviewSize(cameraResolution.x, cameraResolution.y); setFlash(parameters); setZoom(parameters); //setSharpness(parameters); //modify here // camera.setDisplayOrientation(90); //����2.1 setDisplayOrientation(camera, 90); camera.setParameters(parameters); } Point getCameraResolution() { return cameraResolution; } Point getScreenResolution() { return screenResolution; } int getPreviewFormat() { return previewFormat; } String getPreviewFormatString() { return previewFormatString; } private static Point getCameraResolution(Camera.Parameters parameters, Point screenResolution) { String previewSizeValueString = parameters.get("preview-size-values"); // saw this on Xperia if (previewSizeValueString == null) { previewSizeValueString = parameters.get("preview-size-value"); } Point cameraResolution = null; if (previewSizeValueString != null) { Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString); cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution); } if (cameraResolution == null) { // Ensure that the camera resolution is a multiple of 8, as the screen may not be. cameraResolution = new Point( (screenResolution.x >> 3) << 3, (screenResolution.y >> 3) << 3); } return cameraResolution; } private static Point findBestPreviewSizeValue(CharSequence previewSizeValueString, Point screenResolution) { int bestX = 0; int bestY = 0; int diff = Integer.MAX_VALUE; for (String previewSize : COMMA_PATTERN.split(previewSizeValueString)) { previewSize = previewSize.trim(); int dimPosition = previewSize.indexOf('x'); if (dimPosition < 0) { Log.w(TAG, "Bad preview-size: " + previewSize); continue; } int newX; int newY; try { newX = Integer.parseInt(previewSize.substring(0, dimPosition)); newY = Integer.parseInt(previewSize.substring(dimPosition + 1)); } catch (NumberFormatException nfe) { Log.w(TAG, "Bad preview-size: " + previewSize); continue; } int newDiff = Math.abs(newX - screenResolution.x) + Math.abs(newY - screenResolution.y); if (newDiff == 0) { bestX = newX; bestY = newY; break; } else if (newDiff < diff) { bestX = newX; bestY = newY; diff = newDiff; } } if (bestX > 0 && bestY > 0) { return new Point(bestX, bestY); } return null; } private static int findBestMotZoomValue(CharSequence stringValues, int tenDesiredZoom) { int tenBestValue = 0; for (String stringValue : COMMA_PATTERN.split(stringValues)) { stringValue = stringValue.trim(); double value; try { value = Double.parseDouble(stringValue); } catch (NumberFormatException nfe) { return tenDesiredZoom; } int tenValue = (int) (10.0 * value); if (Math.abs(tenDesiredZoom - value) < Math.abs(tenDesiredZoom - tenBestValue)) { tenBestValue = tenValue; } } return tenBestValue; } private void setFlash(Camera.Parameters parameters) { // FIXME: This is a hack to turn the flash off on the Samsung Galaxy. // And this is a hack-hack to work around a different value on the Behold II // Restrict Behold II check to Cupcake, per Samsung's advice //if (Build.MODEL.contains("Behold II") && // CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) { if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3) { // 3 = Cupcake parameters.set("flash-value", 1); } else { parameters.set("flash-value", 2); } // This is the standard setting to turn the flash off that all devices should honor. parameters.set("flash-mode", "off"); } private void setZoom(Camera.Parameters parameters) { String zoomSupportedString = parameters.get("zoom-supported"); if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString)) { return; } int tenDesiredZoom = TEN_DESIRED_ZOOM; String maxZoomString = parameters.get("max-zoom"); if (maxZoomString != null) { try { int tenMaxZoom = (int) (10.0 * Double.parseDouble(maxZoomString)); if (tenDesiredZoom > tenMaxZoom) { tenDesiredZoom = tenMaxZoom; } } catch (NumberFormatException nfe) { Log.w(TAG, "Bad max-zoom: " + maxZoomString); } } String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max"); if (takingPictureZoomMaxString != null) { try { int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString); if (tenDesiredZoom > tenMaxZoom) { tenDesiredZoom = tenMaxZoom; } } catch (NumberFormatException nfe) { Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString); } } String motZoomValuesString = parameters.get("mot-zoom-values"); if (motZoomValuesString != null) { tenDesiredZoom = findBestMotZoomValue(motZoomValuesString, tenDesiredZoom); } String motZoomStepString = parameters.get("mot-zoom-step"); if (motZoomStepString != null) { try { double motZoomStep = Double.parseDouble(motZoomStepString.trim()); int tenZoomStep = (int) (10.0 * motZoomStep); if (tenZoomStep > 1) { tenDesiredZoom -= tenDesiredZoom % tenZoomStep; } } catch (NumberFormatException nfe) { // continue } } // Set zoom. This helps encourage the user to pull back. // Some devices like the Behold have a zoom parameter if (maxZoomString != null || motZoomValuesString != null) { parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0)); } // Most devices, like the Hero, appear to expose this zoom parameter. // It takes on values like "27" which appears to mean 2.7x zoom if (takingPictureZoomMaxString != null) { parameters.set("taking-picture-zoom", tenDesiredZoom); } } public static int getDesiredSharpness() { return DESIRED_SHARPNESS; } /** * compatible 1.6 * @param camera * @param angle */ protected void setDisplayOrientation(Camera camera, int angle){ Method downPolymorphic; try { downPolymorphic = camera.getClass().getMethod("setDisplayOrientation", new Class[] { int.class }); if (downPolymorphic != null) downPolymorphic.invoke(camera, new Object[] { angle }); } catch (Exception e1) { } } }
[ "18410120856@163.com" ]
18410120856@163.com
6ad0d7a0cc823f51a98ffe9c7809c273254342c4
914627a00085fca71f36a27fbe68a97a25a0b3a6
/webService/sprinBoot/src/main/java/errorSimulator/TopErrorSimulator.java
3a7e844a591440ad6d6cc88c5273fecf40be01e1
[]
no_license
iamdeowanshi/ErrorSimulator
36f194a6e960b2f4d1d1a2c26fa6aa6f03b2b921
6207cc885d4465c6ac030d609f571c78f3b5ebb7
refs/heads/master
2021-01-25T09:20:46.798981
2017-06-09T04:24:03
2017-06-09T04:24:03
93,816,964
0
0
null
null
null
null
UTF-8
Java
false
false
3,004
java
package errorSimulator; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Scanner; import org.apache.http.impl.client.HttpClientBuilder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import com.google.gson.Gson; @Component public class TopErrorSimulator { @Autowired Gson gson; private Random randomGenerator = new Random(); private static List<ErrorModel> errors = new ArrayList<>(); public TopErrorSimulator() { // TODO Auto-generated constructor stub } public static void loadTopErrors(File file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null; Scanner scanner = null; int index = 0; while ((line = reader.readLine()) != null) { ErrorModel error = new ErrorModel(); List<String> tags = new ArrayList<>(); scanner = new Scanner(line); scanner.useDelimiter(","); while (scanner.hasNext()) { String data = scanner.next(); if (index == 0) tags.add(data); else if (index == 1 && data != "") tags.add(data); else if (index == 2 && data != "") tags.add(data); else if (index == 3 && data != "") tags.add(data); else if (index == 4 && data != "") tags.add(data); else if (index == 23) error.setId(data); else if (index == 26) error.setTitle(data); else if (index == 24) error.setLink(data); error.setTags(tags); index++; } index = 0; errors.add(error); } reader.close(); } public String getRandomError() { if (!errors.isEmpty()) { int index = randomGenerator.nextInt(errors.size()); if (index == 0) { index++; } Map<String, String> m = new HashMap<String, String>(); m.put("question", errors.get(index).getTitle()); return gson.toJson(m); } return null; } public String getSolution(String title) { String req_url = "https://api.stackexchange.com/2.2/search?order=desc&sort=activity&intitle="+ title + "?&site=stackoverflow"; return restTemplateImplementation(req_url); } private String restTemplateImplementation(String url) { HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create().build()); RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory); Answer answer = restTemplate.getForObject(url, Answer.class); if (answer == null || answer.getItems().isEmpty()){ return "ERROR OCCURED WHILE PROCESSING YOUR REQUEST, TRY AGAIN LATER"; } Link link = new Link(); link.setLink(answer.getItems().get(0).getLink()); return gson.toJson(link); } }
[ "aadityadeowanshi@hotmail.com" ]
aadityadeowanshi@hotmail.com
85b7002dec1c30698825461695fe00f9247b7822
0359575ed4909a91d810b535b5a455570795c327
/webconnect/src/main/java/com/example1/webconnect/MyWebSocket.java
0b5c816bf95dab691accc2fe539889b2500f6b86
[]
no_license
gtechgithub/Spring-integration
231077598416349fb65852772e3c0480515184c4
8462b2d1a2ddedb18e48f2df98407e8d5d2ee186
refs/heads/master
2020-03-10T17:32:10.103930
2019-01-23T18:30:48
2019-01-23T18:30:48
129,502,562
0
0
null
null
null
null
UTF-8
Java
false
false
1,180
java
package com.example1.webconnect; import java.io.IOException; import java.util.List; import java.util.Map; import javax.websocket.OnClose; import javax.websocket.OnError; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; import org.springframework.stereotype.Component; @ServerEndpoint("/endpoint") public class MyWebSocket { @OnOpen public void onOpen(Session session) { System.out.println("onOpen::" + session.getId()); } @OnClose public void onClose(Session session) { System.out.println("onClose::" + session.getId()); } @OnMessage public void onMessage(String message, Session session) { System.out.println("onMessage::From=" + session.getId() + " Message=" + message); try { session.getBasicRemote().sendText("Hello Client message from server" + session.getId() + "!"); } catch (IOException e) { e.printStackTrace(); } } @OnError public void onError(Throwable t) { System.out.println("onError::" + t.getMessage()); } }
[ "gopaltechcv@gmail.com" ]
gopaltechcv@gmail.com
121b847be6e3dc99021feeb7965e3a69dbd89d8a
38c5aa1996f77b191e0ab4c4ce3fdeb63b2f3b2d
/NOC/TEST/BaseModel/Message.java
c27b452ade7f49f10bc6373647869d53e9d0ab98
[]
no_license
Abde3/DEVS_Modeling
ae3e3b7b1025130c820cdaf70f7789444abbb170
5ede1ab03fafbffa046114838d6b5bd2013192fd
refs/heads/master
2020-03-21T21:04:06.224097
2019-05-27T01:53:27
2019-05-27T01:53:27
139,044,466
0
0
null
null
null
null
UTF-8
Java
false
false
919
java
package BaseModel; import NocTopology.NOCDirections.IPoint; import com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const; import java.util.Random; import java.util.Vector; public class Message { private static final int PACKET_PAYLOAD_SIZE = Constants.PACKET_PAYLOAD_SIZE; Vector<Packet> packets = new Vector<>(); public Message(String data, IPoint destination) { int id = new Random().nextInt(20); int computation_req = 2; for (int i = 0; i < data.length(); i += PACKET_PAYLOAD_SIZE) { boolean tail = false, header = false; if ( i == 0 ) { header = true; } if( i == data.length() - 1 ) { tail = true; } packets.add( new Packet(id, computation_req, data.substring(i, Math.min(i + PACKET_PAYLOAD_SIZE, data.length())) , destination, header, tail) ); } } }
[ "abde3.khe@gmail.com" ]
abde3.khe@gmail.com
6c69d28d3978f20e777afc112e6ff44b5ee3ecae
84572d5d682bd7e6973b8105fb921b0c448ff1f7
/projects/BouncyCastle/src/org/sandrob/bouncycastle/i18n/filter/TrustedInput.java
09ffb5fefc8947ddc663f8cffca48d4a0c2f4a17
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
liang47009/sandrop
806169c72a516b3191aae07c234a225db5343888
28045e53cec0f043d3aaf426f7055fbf8ca38a76
refs/heads/master
2020-04-13T18:24:58.767107
2018-12-28T09:32:53
2018-12-28T09:33:14
163,373,426
0
0
null
2018-12-28T06:15:22
2018-12-28T06:15:22
null
UTF-8
Java
false
false
342
java
package org.sandrob.bouncycastle.i18n.filter; public class TrustedInput { protected Object input; public TrustedInput(Object input) { this.input = input; } public Object getInput() { return input; } public String toString() { return input.toString(); } }
[ "supp.sandrob@gmail.com" ]
supp.sandrob@gmail.com
cd9732b14427d39134a95711ba85ccfae6c76b0b
6b85a97a8243096d2d788dfda781ff78cdda458f
/TestAuto/src/test/java/AutoWalletTest/Test_Beowulf_HomePage.java
a6ed5f4ae95eef3b0047d6448b0d467c1f9c96c2
[]
no_license
caophuong2012/CoreAutomationTest
ae75d4dfa1259f259a4585410702f7e9161abb49
75a11883cee8d34f7b9f5fb47cb69072ae35d123
refs/heads/master
2023-06-15T23:20:27.630060
2020-11-23T08:23:50
2020-11-23T08:23:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
package AutoWalletTest; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import CoreAutomation.BaseAutoTest.BaseTest; /** * Unit test for simple App. */ //@TestInstance(Lifecycle.PER_CLASS) public class Test_Beowulf_HomePage extends BaseTest{ // *********************** CODE BELOW *********************** @Test public void OpenWalletHomePage() { bHomePage_Electron.clickWalletButton(); } }
[ "lam.nguyenthanh84@gmail.com" ]
lam.nguyenthanh84@gmail.com
5e1d4d06086ea88651fc8d0b3c2755a10ab65369
cfaf970e2296bd19369e4177002a73450d7ae18e
/app/src/test/java/com/training/fragmentkostumapp/ExampleUnitTest.java
66e3dec18f6acf36b198115ee6241bd3848d7cae
[]
no_license
isoneday/Android_Me
26b5697347f54baea2400d6267867ea0e92548a7
d4fa3e519107a9ecb23aaf77f0a64546ebf0da91
refs/heads/master
2021-09-09T16:01:52.402518
2018-03-17T16:56:57
2018-03-17T16:56:57
125,650,537
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.training.fragmentkostumapp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "iswandi@imastudio.co.id" ]
iswandi@imastudio.co.id
aa3a5756609c196109fbfdc171be50f7973e2c37
eb8c37602469beacb9c7faa74d22b5fa46c5d6de
/app/src/main/java/com/example/sqlitedatabase/data/PetProvider.java
c3ea6f352f07c19407a416e1c8b0363c1e4176a5
[]
no_license
Yash-tyagi/pet_database
4a1e3eb462698fbe54f62cbafe5047d54374570a
92b3afd87088e6ad75835383d9857ac1d17a5deb
refs/heads/master
2023-06-03T10:44:34.086013
2021-06-17T19:44:00
2021-06-17T19:44:00
377,933,543
0
0
null
null
null
null
UTF-8
Java
false
false
7,765
java
package com.example.sqlitedatabase.data; import android.content.ContentProvider; import android.content.ContentUris; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.support.v4.os.IResultReceiver; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.example.sqlitedatabase.data.PetContract.PetEntry; public class PetProvider extends ContentProvider { private static final int PETS = 1; private static final int PET_ID = 2; public static final String LOG_TAG = PetProvider.class.getSimpleName(); // URI MATCHER private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sUriMatcher.addURI(PetEntry.CONTENT_AUTHORITY,PetEntry.PATH_PETS,PETS); sUriMatcher.addURI(PetEntry.CONTENT_AUTHORITY,PetEntry.PATH_PETS+"/#",PET_ID); } private DbHelper mDbHelper; @Override public boolean onCreate() { mDbHelper = new DbHelper(getContext()); // SQLiteDatabase db = mDbHelper.getReadableDatabase(); return false; } @Nullable @Override public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { SQLiteDatabase db = mDbHelper.getReadableDatabase(); Cursor cursor; int match = sUriMatcher.match(uri); switch (match){ case PETS: cursor = db.query(PetEntry.TABLE_NAME,projection,selection,selectionArgs,null,null,sortOrder); break; case PET_ID: selection = PetEntry._ID+"=?"; selectionArgs = new String[] {String.valueOf(ContentUris.parseId(uri))}; cursor = db.query(PetEntry.TABLE_NAME,projection,selection,selectionArgs,null,null,sortOrder); break; default: throw new IllegalArgumentException("cannot query unknown uri "+uri); } cursor.setNotificationUri(getContext().getContentResolver(),uri); return cursor; // return null; } @Nullable @Override public String getType(@NonNull Uri uri) { return null; } @Nullable @Override public Uri insert(@NonNull Uri uri, @Nullable ContentValues values){ String name = values.getAsString(PetEntry.COLUMN_PET_NAME); if (name == null) { throw new IllegalArgumentException("Pet requires a name"); } // Check that the gender is valid Integer gender = values.getAsInteger(PetEntry.COLUMN_PET_GENDER); if (gender == null || !PetEntry.isValidGender(gender)) { throw new IllegalArgumentException("Pet requires valid gender"); } // If the weight is provided, check that it's greater than or equal to 0 kg Integer weight = values.getAsInteger(PetEntry.COLUMN_PET_WEIGHT); if (weight != null && weight < 0) { throw new IllegalArgumentException("Pet requires valid weight"); } SQLiteDatabase db = mDbHelper.getWritableDatabase(); final int match = sUriMatcher.match(uri); switch (match){ case PETS: // return insertPet(uri,values); long id = db.insert(PetEntry.TABLE_NAME,null,values); // checking for the id... if (id == -1) { Log.e(LOG_TAG, "Failed to insert row for " + uri); return null; } // in observer if we fill null then CursorApdater will automatically get notified... // so that means the loader callbacks will still be automatically triggered getContext().getContentResolver().notifyChange(uri,null); return ContentUris.withAppendedId(uri,id); default: throw new IllegalArgumentException("cannot query unknown uri "+uri); } } int rowsDeleted; @Override public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { int match = sUriMatcher.match(uri); SQLiteDatabase db = mDbHelper.getWritableDatabase(); switch (match){ case PETS: rowsDeleted = db.delete(PetEntry.TABLE_NAME,selection,selectionArgs); case PET_ID: // Delete a single row given by the ID in the URI selection = PetEntry._ID + "=?"; selectionArgs = new String[] { String.valueOf(ContentUris.parseId(uri)) }; rowsDeleted = db.delete(PetEntry.TABLE_NAME, selection, selectionArgs); default: throw new IllegalArgumentException("cannot delete unknown uri "+uri); } // if ( rowsDeleted != 0) { // getContext().getContentResolver().notifyChange(uri, null); // } // return rowsDeleted; } @Override public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { int match = sUriMatcher.match(uri); switch (match){ case PETS: return updatePet(uri,values,selection,selectionArgs); case PET_ID: selection = PetEntry._ID+" =?"; selectionArgs = new String[] {String.valueOf(ContentUris.parseId(uri))}; return updatePet(uri,values,selection,selectionArgs); default: } return 0; } private int updatePet(Uri uri,ContentValues values, String selection, String[] selectionArgs){ // If the {@link PetEntry#COLUMN_PET_NAME} key is present, // check that the name value is not null. if (values.containsKey(PetEntry.COLUMN_PET_NAME)) { String name = values.getAsString(PetEntry.COLUMN_PET_NAME); if (name == null) { throw new IllegalArgumentException("Pet requires a name"); } } // If the {@link PetEntry#COLUMN_PET_GENDER} key is present, // check that the gender value is valid. if (values.containsKey(PetEntry.COLUMN_PET_GENDER)) { Integer gender = values.getAsInteger(PetEntry.COLUMN_PET_GENDER); if (gender == null || !PetEntry.isValidGender(gender)) { throw new IllegalArgumentException("Pet requires valid gender"); } } // If the {@link PetEntry#COLUMN_PET_WEIGHT} key is present, // check that the weight value is valid. if (values.containsKey(PetEntry.COLUMN_PET_WEIGHT)) { // Check that the weight is greater than or equal to 0 kg Integer weight = values.getAsInteger(PetEntry.COLUMN_PET_WEIGHT); if (weight != null && weight < 0) { throw new IllegalArgumentException("Pet requires valid weight"); } } // No need to check the breed, any value is valid (including null). // If there are no values to update, then don't try to update the database if (values.size() == 0) { return 0; } SQLiteDatabase db = mDbHelper.getWritableDatabase(); int rowsUpdated = db.update(PetEntry.TABLE_NAME,values,selection,selectionArgs); // If 1 or more rows were updated, then notify all listeners that the data at the // given URI has changed if (rowsUpdated != 0) { getContext().getContentResolver().notifyChange(uri, null); } return rowsUpdated; } }
[ "tyagiyash29@gmail.com" ]
tyagiyash29@gmail.com
830ff8b561b15f921b04c659139ee1c44f85d71d
3049f12fc3ff7150940f44bd0a8a16576f8df634
/src/main/java/it/engineering/springboot/application/customer/component/DatabaseCommandLineRunner.java
cfb622e87e47bbdbd380305f192929c068001c33
[]
no_license
PetarStankovic/customer-project
b3cd54aa79b670622f9aa2185005ab72864f1a17
779100636a8983359a733700e7562e32fb032e9b
refs/heads/master
2023-04-08T17:54:20.468441
2021-04-18T20:30:25
2021-04-18T20:30:25
359,246,592
0
0
null
null
null
null
UTF-8
Java
false
false
913
java
package it.engineering.springboot.application.customer.component; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import it.engineering.springboot.application.customer.entity.CityEntity; import it.engineering.springboot.application.customer.repository.CityRepository; @Component public class DatabaseCommandLineRunner implements CommandLineRunner { @Autowired private CityRepository cityRepository; @Override public void run(String... args) throws Exception { System.out.println("=========================================="); System.out.println("============DatabaseCommandLineRunner====="); System.out.println("=========================================="); cityRepository.save(new CityEntity(22000L, "Subotica")); cityRepository.save(new CityEntity(16000L, "Leskovac")); } }
[ "petar@PetarPC" ]
petar@PetarPC
9a8199cf7b5159a492f9d37702d72fe59dcbeb8f
e79d137f610a348c2960f7a41f9f950d5d0e2d87
/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsTopicSubscriberTest.java
12f1d5835a50c83e43e6daecadad150938ca18c5
[ "Apache-2.0" ]
permissive
michaelandrepearce/qpid-jms
3b42658ba902d154241dbb3626e33e76864e63e6
df50221a5db3ddeeb2ca150ab4dfc828bf4153a3
refs/heads/main
2021-12-02T00:26:37.139465
2021-06-15T15:54:38
2021-06-15T15:54:38
380,071,083
0
0
Apache-2.0
2021-06-24T23:09:30
2021-06-24T23:09:29
null
UTF-8
Java
false
false
2,661
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.qpid.jms.consumer; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.Topic; import javax.jms.TopicSession; import javax.jms.TopicSubscriber; import org.apache.qpid.jms.JmsConnectionTestSupport; import org.junit.Before; import org.junit.Test; /** * Test the basic contract of the TopicSubscriber */ public class JmsTopicSubscriberTest extends JmsConnectionTestSupport { protected TopicSession session; protected Topic topic; protected TopicSubscriber subscriber; @Override @Before public void setUp() throws Exception { super.setUp(); topicConnection = createTopicConnectionToMockProvider(); session = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); topic = session.createTopic(_testName.getMethodName()); subscriber = session.createSubscriber(topic); } @Test(timeout = 30000) public void testMultipleCloseCalls() throws Exception { subscriber.close(); subscriber.close(); } @Test(timeout = 30000) public void testGetQueue() throws Exception { assertEquals(topic, subscriber.getTopic()); } @Test(timeout = 30000) public void testGetMessageListener() throws Exception { assertNull(subscriber.getMessageListener()); subscriber.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { } }); assertNotNull(subscriber.getMessageListener()); } @Test(timeout = 30000) public void testGetMessageSelector() throws Exception { assertNull(subscriber.getMessageSelector()); } }
[ "tabish121@gmail.com" ]
tabish121@gmail.com
30cad41559ded021a7c19010fbca5ce4544bdd5e
6920eabea28b1bd9b4e00156c7b63cc7cb152d8a
/blog-manager/blog-manager-pojo/src/main/java/cn/tf/blog/po/STypeExample.java
800d50b96a0481b16f6f63eecbf5357e8d77234a
[]
no_license
sdksdk0/Blog
5d2f029576ec2c3d1841107581576afdab331a17
3755ffad38e9b45cdff9939e39cb181696188f1b
refs/heads/master
2020-06-13T01:55:44.246696
2016-12-10T11:53:10
2016-12-10T11:53:10
75,465,777
1
1
null
null
null
null
UTF-8
Java
false
false
14,400
java
package cn.tf.blog.po; import java.util.ArrayList; import java.util.List; public class STypeExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public STypeExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andTypeidIsNull() { addCriterion("typeId is null"); return (Criteria) this; } public Criteria andTypeidIsNotNull() { addCriterion("typeId is not null"); return (Criteria) this; } public Criteria andTypeidEqualTo(String value) { addCriterion("typeId =", value, "typeid"); return (Criteria) this; } public Criteria andTypeidNotEqualTo(String value) { addCriterion("typeId <>", value, "typeid"); return (Criteria) this; } public Criteria andTypeidGreaterThan(String value) { addCriterion("typeId >", value, "typeid"); return (Criteria) this; } public Criteria andTypeidGreaterThanOrEqualTo(String value) { addCriterion("typeId >=", value, "typeid"); return (Criteria) this; } public Criteria andTypeidLessThan(String value) { addCriterion("typeId <", value, "typeid"); return (Criteria) this; } public Criteria andTypeidLessThanOrEqualTo(String value) { addCriterion("typeId <=", value, "typeid"); return (Criteria) this; } public Criteria andTypeidLike(String value) { addCriterion("typeId like", value, "typeid"); return (Criteria) this; } public Criteria andTypeidNotLike(String value) { addCriterion("typeId not like", value, "typeid"); return (Criteria) this; } public Criteria andTypeidIn(List<String> values) { addCriterion("typeId in", values, "typeid"); return (Criteria) this; } public Criteria andTypeidNotIn(List<String> values) { addCriterion("typeId not in", values, "typeid"); return (Criteria) this; } public Criteria andTypeidBetween(String value1, String value2) { addCriterion("typeId between", value1, value2, "typeid"); return (Criteria) this; } public Criteria andTypeidNotBetween(String value1, String value2) { addCriterion("typeId not between", value1, value2, "typeid"); return (Criteria) this; } public Criteria andTypenameIsNull() { addCriterion("typeName is null"); return (Criteria) this; } public Criteria andTypenameIsNotNull() { addCriterion("typeName is not null"); return (Criteria) this; } public Criteria andTypenameEqualTo(String value) { addCriterion("typeName =", value, "typename"); return (Criteria) this; } public Criteria andTypenameNotEqualTo(String value) { addCriterion("typeName <>", value, "typename"); return (Criteria) this; } public Criteria andTypenameGreaterThan(String value) { addCriterion("typeName >", value, "typename"); return (Criteria) this; } public Criteria andTypenameGreaterThanOrEqualTo(String value) { addCriterion("typeName >=", value, "typename"); return (Criteria) this; } public Criteria andTypenameLessThan(String value) { addCriterion("typeName <", value, "typename"); return (Criteria) this; } public Criteria andTypenameLessThanOrEqualTo(String value) { addCriterion("typeName <=", value, "typename"); return (Criteria) this; } public Criteria andTypenameLike(String value) { addCriterion("typeName like", value, "typename"); return (Criteria) this; } public Criteria andTypenameNotLike(String value) { addCriterion("typeName not like", value, "typename"); return (Criteria) this; } public Criteria andTypenameIn(List<String> values) { addCriterion("typeName in", values, "typename"); return (Criteria) this; } public Criteria andTypenameNotIn(List<String> values) { addCriterion("typeName not in", values, "typename"); return (Criteria) this; } public Criteria andTypenameBetween(String value1, String value2) { addCriterion("typeName between", value1, value2, "typename"); return (Criteria) this; } public Criteria andTypenameNotBetween(String value1, String value2) { addCriterion("typeName not between", value1, value2, "typename"); return (Criteria) this; } public Criteria andOrdernoIsNull() { addCriterion("orderNo is null"); return (Criteria) this; } public Criteria andOrdernoIsNotNull() { addCriterion("orderNo is not null"); return (Criteria) this; } public Criteria andOrdernoEqualTo(String value) { addCriterion("orderNo =", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoNotEqualTo(String value) { addCriterion("orderNo <>", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoGreaterThan(String value) { addCriterion("orderNo >", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoGreaterThanOrEqualTo(String value) { addCriterion("orderNo >=", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoLessThan(String value) { addCriterion("orderNo <", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoLessThanOrEqualTo(String value) { addCriterion("orderNo <=", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoLike(String value) { addCriterion("orderNo like", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoNotLike(String value) { addCriterion("orderNo not like", value, "orderno"); return (Criteria) this; } public Criteria andOrdernoIn(List<String> values) { addCriterion("orderNo in", values, "orderno"); return (Criteria) this; } public Criteria andOrdernoNotIn(List<String> values) { addCriterion("orderNo not in", values, "orderno"); return (Criteria) this; } public Criteria andOrdernoBetween(String value1, String value2) { addCriterion("orderNo between", value1, value2, "orderno"); return (Criteria) this; } public Criteria andOrdernoNotBetween(String value1, String value2) { addCriterion("orderNo not between", value1, value2, "orderno"); return (Criteria) this; } public Criteria andStateIsNull() { addCriterion("state is null"); return (Criteria) this; } public Criteria andStateIsNotNull() { addCriterion("state is not null"); return (Criteria) this; } public Criteria andStateEqualTo(String value) { addCriterion("state =", value, "state"); return (Criteria) this; } public Criteria andStateNotEqualTo(String value) { addCriterion("state <>", value, "state"); return (Criteria) this; } public Criteria andStateGreaterThan(String value) { addCriterion("state >", value, "state"); return (Criteria) this; } public Criteria andStateGreaterThanOrEqualTo(String value) { addCriterion("state >=", value, "state"); return (Criteria) this; } public Criteria andStateLessThan(String value) { addCriterion("state <", value, "state"); return (Criteria) this; } public Criteria andStateLessThanOrEqualTo(String value) { addCriterion("state <=", value, "state"); return (Criteria) this; } public Criteria andStateLike(String value) { addCriterion("state like", value, "state"); return (Criteria) this; } public Criteria andStateNotLike(String value) { addCriterion("state not like", value, "state"); return (Criteria) this; } public Criteria andStateIn(List<String> values) { addCriterion("state in", values, "state"); return (Criteria) this; } public Criteria andStateNotIn(List<String> values) { addCriterion("state not in", values, "state"); return (Criteria) this; } public Criteria andStateBetween(String value1, String value2) { addCriterion("state between", value1, value2, "state"); return (Criteria) this; } public Criteria andStateNotBetween(String value1, String value2) { addCriterion("state not between", value1, value2, "state"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "690644511@qq.com" ]
690644511@qq.com
27e7a135070ff1b44005e266c1b3d03647930ff4
25afda4b104bd4a2979f52740ebd4969fea01b6a
/Java Advanced/L02_Intro_To_Java_Exercises/P03_Formatting_Numbers.java
e244e3ec0c4cc368849eed2affa4c9133b3d08da
[]
no_license
Stefan16394/JavaCourses
2896f54fc60d6777d3bbde3f5d2fa5d55916793e
df210aad66037f77f437b4f463ad81061e75972d
refs/heads/master
2021-09-10T06:41:56.559498
2018-03-21T18:19:40
2018-03-21T18:19:40
111,597,874
0
0
null
null
null
null
UTF-8
Java
false
false
963
java
package L02_Intro_To_Java_Exercises; import java.util.Scanner; public class P03_Formatting_Numbers { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); String hex=Integer.toHexString(a).toUpperCase(); String abyte=String.format("%10s", Integer.toBinaryString(a)).replace(" ", "0"); Double b=sc.nextDouble(); String bString=String.format("%.2f",b); int bb=0; int cc=0; bb=bString.length(); Double c=sc.nextDouble(); String cString=String.format("%.3f",c); cc=cString.length(); String repeated1 = new String(new char[10-hex.length()]).replace("\0", " "); String repeated2 = new String(new char[10-bb]).replace("\0", " "); String repeated3 = new String(new char[10-cc]).replace("\0", " "); System.out.printf("|%s%s|%s|%s%.2f|%.3f%s|",hex,repeated1,abyte,repeated2,b,c,repeated3); } }
[ "rangelov1994@gmail.com" ]
rangelov1994@gmail.com
03ad5a46a7ea364d91edf8286f274a0a437f9a91
2fd30a6294b653f01dbd685b3cac0273eb9c559b
/src/main/java/com/taiji/eap/common/shiro/bean/ShiroUser.java
1c15a433135e19fe4ab5b11687280785b930e097
[]
no_license
un-knower/eap
39cc84e0f9809323aa44919f287418ebb25fae33
b469ed0f503dc5076620a28f965ae9cfe7430850
refs/heads/master
2020-03-17T23:18:10.101165
2018-04-10T10:11:00
2018-04-10T10:11:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,441
java
package com.taiji.eap.common.shiro.bean; import java.util.List; import com.taiji.eap.common.base.BaseModel; public class ShiroUser extends BaseModel{ /** * */ private static final long serialVersionUID = -1662003069095823814L; private Long userId; private String userName; private String fullName; private List<String> resources;//资源列表 private List<Long> roles;//角色列表 private List<Long> organs;//部门列表 public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public List<String> getResources() { return resources; } public void setResources(List<String> resources) { this.resources = resources; } public List<Long> getRoles() { return roles; } public void setRoles(List<Long> roles) { this.roles = roles; } public List<Long> getOrgans() { return organs; } public void setOrgans(List<Long> organs) { this.organs = organs; } /** * 本函数输出将作为默认的<shiro:principal/>输出. */ @Override public String toString() { String name = userName; if(fullName!=null&&!fullName.equals("")) name = fullName; return name; } }
[ "panhongzhi02@163.com" ]
panhongzhi02@163.com
4b99d55fa4a8b1360a7c504c1dcce9883db76ba6
1505fc882c028b0765176d70f81b54f398b593fb
/RESTful/src/main/java/restservice/utils/Phones.java
8198a67afe05e632c63933d511ddd2eeaa1e089b
[]
no_license
deputat007/pcs
7ba6a51d58360f40c0ea52e5a2a1cb2b9e454dfc
31f246b33cf73981f024f1d53e86f0f17afaed58
refs/heads/master
2020-12-02T11:10:57.040283
2017-07-08T10:15:26
2017-07-08T10:15:26
96,611,408
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package restservice.utils; public class Phones { private String idMessage; private String variables; private String phone; public Phones(String idMessage, String variables, String phone) { this.phone = phone; this.variables = variables; this.idMessage = idMessage; } public String getIdMessage() { return this.idMessage; } public String getVariable() { return this.variables; } public String getPhone() { return this.phone; } }
[ "andriy.deputat@gmail.com" ]
andriy.deputat@gmail.com
d40a2807e9b254454dd8f546ce1fd4f5e5d1b393
8c4d781cefbfae72d340bebb42b37f908fbf6019
/src/Frame.java
670c7f78e68a2da9436ef84cfac1b4a12d162aad
[]
no_license
AlirezaGhafartehrani/Jpotify
d169fef27526a1f55f31e380ca9080e60842536a
22b1a90ef546e0d967cc534c6b5a90a07f858cc7
refs/heads/master
2023-06-11T23:34:20.859835
2021-07-06T12:54:32
2021-07-06T12:54:32
193,334,444
0
0
null
null
null
null
UTF-8
Java
false
false
9,517
java
import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; public class Frame { private JFrame frame; public Frame() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(new Dimension(900, 556)); frame.setLayout (new BorderLayout()); frame.setLocation (250,100); //left panel JPanel leftPanel = new JPanel(new FlowLayout()); Dimension leftPanelDim = new Dimension(150, 500); leftPanel.setPreferredSize(leftPanelDim); Font narrowFont = new Font ("arial",Font.BOLD,8); DefaultListModel listModelMenu = new DefaultListModel(); listModelMenu.addElement(" Home"); listModelMenu.addElement(" Browse"); listModelMenu.addElement(" Radio"); JList menuList = new JList(listModelMenu); menuList.setBackground(Color.DARK_GRAY); menuList.setForeground(Color.WHITE); menuList.setFont(narrowFont); DefaultListModel listModelLibrary = new DefaultListModel(); listModelLibrary.addElement(" Music"); listModelLibrary.addElement(" Album"); listModelLibrary.addElement(" Artist"); JList libraryList = new JList(listModelLibrary); libraryList.setBackground(Color.DARK_GRAY); libraryList.setForeground(Color.WHITE); libraryList.setFont(narrowFont); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); DefaultListModel listModelplaylist = new DefaultListModel(); JList playlistList = new JList(listModelplaylist); playlistList.setBackground(Color.DARK_GRAY); Dimension menuListDim = new Dimension(150, 70); Dimension libListdim = new Dimension(150, 70); Dimension playlisListdim = new Dimension(150, 100); menuList.setPreferredSize(menuListDim); libraryList.setPreferredSize(libListdim); playlistList.setPreferredSize(playlisListdim); Font boldFont = new Font ("arial",Font.BOLD,10); JLabel Menu = new JLabel(); JLabel library = new JLabel(" YOUR LIBRARY"); Dimension LabelSize = new Dimension(150, 15); library.setPreferredSize(LabelSize); library.setFont (boldFont); library.setForeground(Color.WHITE); JLabel playlistListLabel = new JLabel(" PLAYLIST"); playlistListLabel.setPreferredSize(LabelSize); playlistListLabel.setFont (boldFont); playlistListLabel.setForeground(Color.WHITE); leftPanel.add(Menu); leftPanel.add(menuList); leftPanel.add(library); leftPanel.add(libraryList); leftPanel.add(scrollPane); leftPanel.add(playlistListLabel); leftPanel.add(playlistList); JButton artworkP = new JButton(); artworkP.setBackground(Color.lightGray); try { BufferedImage img = ImageIO.read(new File("C:\\Users\\Alireza Tehrani\\Pictures\\LifeFrame\\1.jpg")); BufferedImage fimg = new BufferedImage(50,50, img.getType()); artworkP.setIcon(new ImageIcon(img)); } catch (Exception ex) { System.out.println("Image not found"); } Dimension artworkMaxDim = new Dimension(150, 150); artworkP.setPreferredSize(artworkMaxDim); leftPanel.add(artworkP); JLabel musicName = new JLabel(" Music Name"); JLabel artist = new JLabel(" Artist Name"); musicName.setPreferredSize(LabelSize); artist.setPreferredSize(LabelSize); leftPanel.add(musicName); leftPanel.add(artist); musicName.setForeground(Color.WHITE); musicName.setFont(boldFont); artist.setForeground(Color.WHITE); artist.setFont(boldFont); leftPanel.setBackground(Color.BLACK); frame.add(leftPanel, BorderLayout.WEST); //Center panel JPanel centerPanel = new JPanel(new FlowLayout()); centerPanel.setBackground(Color.BLACK); frame.add(centerPanel, BorderLayout.CENTER); //East panel JPanel eastPanel = new JPanel(new FlowLayout()); eastPanel.setPreferredSize(leftPanelDim); eastPanel.setBackground(Color.DARK_GRAY); JLabel fActivity = new JLabel(" Friend Activity"); fActivity.setForeground(Color.WHITE); fActivity.setFont(boldFont); eastPanel.add(fActivity); frame.add(eastPanel, BorderLayout.EAST); //South panel //Player Panel in southpanel JPanel southPanel = new JPanel(new BorderLayout()); JPanel playerPanel = new JPanel(new FlowLayout()); Dimension playerPanelSize = new Dimension(150, 40); southPanel.setPreferredSize(playerPanelSize); JButton play = new JButton(); Dimension playerButtonSize = new Dimension(30, 30); play.setPreferredSize(playerButtonSize); play.setBackground(Color.BLACK); try { Image img = ImageIO.read(new File("C:\\Users\\Alireza Tehrani\\Desktop\\pause.png")); play.setIcon(new ImageIcon(img)); } catch (Exception ex) { System.out.println("Image not found"); } JButton pNext = new JButton(); pNext.setPreferredSize(playerButtonSize); pNext.setBackground(Color.BLACK); try { Image img = ImageIO.read(new File("C:\\Users\\Alireza Tehrani\\Desktop\\next.png")); pNext.setIcon(new ImageIcon(img)); } catch (Exception ex) { System.out.println("Image not found"); } JButton previous = new JButton(); previous.setPreferredSize(playerButtonSize); previous.setBackground(Color.lightGray); try { Image img = ImageIO.read(new File("C:\\Users\\Alireza Tehrani\\Desktop\\previous.png")); previous.setIcon(new ImageIcon(img)); } catch (Exception ex) { System.out.println("Image not found"); } playerPanel.add(previous); playerPanel.add(play); playerPanel.add(pNext); playerPanel.setBackground(Color.lightGray); southPanel.add(playerPanel, BorderLayout.WEST); //Song slider JSlider musicSlider = new JSlider(); Dimension musicSliderDim = new Dimension(900 ,30); southPanel.add(musicSlider, BorderLayout.CENTER); musicSlider.setPreferredSize(musicSliderDim); //Volume slider //JPanel speakers = new JPanel(new FlowLayout()); //speakers.setPreferredSize(playerPanelSize); //JLabel volume = new JLabel("Volume"); //Dimension voloumLabelDim = new Dimension(50,30); //volume.setPreferredSize(voloumLabelDim); JSlider voloum = new JSlider(); Dimension voloumDim = new Dimension(150,30); voloum.setPreferredSize(voloumDim); // speakers.add(volume); // speakers.add(voloum); southPanel.add(voloum, BorderLayout.EAST); Dimension southPanelDim = new Dimension(900 , 100); southPanel.setBackground(Color.lightGray); frame.add(southPanel, BorderLayout.SOUTH); // North JPanel northPanel = new JPanel(new FlowLayout()); Dimension northPanelDim = new Dimension(900 , 30); northPanel.setPreferredSize(northPanelDim); JLabel add_music_to_libraryLabel = new JLabel("Add Music To Library"); add_music_to_libraryLabel.setForeground(Color.WHITE); add_music_to_libraryLabel.setFont(boldFont); Dimension addMtoL = new Dimension(150, 30); add_music_to_libraryLabel.setPreferredSize(addMtoL); northPanel.add(add_music_to_libraryLabel); JButton add = new JButton(" + "); Dimension addLabel = new Dimension(50, 30); add.setPreferredSize(addLabel); add.setBackground(Color.DARK_GRAY); northPanel.add(add); northPanel.setBackground(Color.DARK_GRAY); frame.add(northPanel, BorderLayout.NORTH); JButton signIn = new JButton("Sign in"); signIn.setForeground(Color.WHITE); signIn.setFont(boldFont); signIn.setPreferredSize(addMtoL); signIn.setBackground(Color.DARK_GRAY); northPanel.add(signIn); JLabel profileIcon = new JLabel(); try { BufferedImage img = ImageIO.read(new File("C:\\Users\\Alireza Tehrani\\Desktop\\pause.png")); BufferedImage fimg = new BufferedImage(30, 30, img.getType()); profileIcon.setIcon(new ImageIcon(fimg)); } catch (Exception ex) { System.out.println("Image not found"); } profileIcon.setPreferredSize(addLabel); northPanel.add(profileIcon); JCheckBox darkMode = new JCheckBox("Dark Mode"); darkMode.setPreferredSize(addMtoL); darkMode.setBackground(Color.DARK_GRAY); northPanel.add(darkMode); /////////// frame.setVisible(true); } public static void main(String[] args) { Frame mainGraph = new Frame(); } }
[ "noreply@github.com" ]
AlirezaGhafartehrani.noreply@github.com
1c6bd6728b73fe47cf80f190b8226a82136a1c34
9278a7e1fa23314f676f7a8b978fa31b1cf4950f
/src/main/java/com/example/ren/configuration/SwaggerPropertiesConfig.java
de8c32b9d484456e08ea029c3dc2cab3121ed388
[]
no_license
renqiang2016/demo
f79520ab63ac85ef66d77dd32584bf1896b737ee
7bf290fb8a2c68051279f03551768bcda5a1fff1
refs/heads/master
2020-03-11T17:40:29.481733
2018-04-27T07:16:12
2018-04-27T07:16:12
130,153,740
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package com.example.ren.configuration; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; /** * swagger * * @author qiang.ren on 2018/3/26 */ @Configuration public class SwaggerPropertiesConfig { @Value("${swagger.title}") private String swaggerTitle; @Value("${swagger.login.name}") private String swaggerLoginName; @Value("${swagger.login.password}") private String swaggerLoginPasswd; @Value("${spring.profiles.active}") private String environment; public String getSwaggerTitle() { return swaggerTitle; } public void setSwaggerTitle(String swaggerTitle) { this.swaggerTitle = swaggerTitle; } public String getSwaggerLoginName() { return swaggerLoginName; } public void setSwaggerLoginName(String swaggerLoginName) { this.swaggerLoginName = swaggerLoginName; } public String getSwaggerLoginPasswd() { return swaggerLoginPasswd; } public void setSwaggerLoginPasswd(String swaggerLoginPasswd) { this.swaggerLoginPasswd = swaggerLoginPasswd; } public String getEnvironment() { return environment; } public void setEnvironment(String environment) { this.environment = environment; } }
[ "qiang.ren@phicomm.com" ]
qiang.ren@phicomm.com
c2c16e2d72dd334b82f6a2daad85fef2a294480d
9db6efa2f14baa0f4172272e361e1ed0c9940065
/aliyun-java-sdk-vpc/src/main/java/com/aliyuncs/vpc/model/v20160428/ModifyHaVipAttributeResponse.java
0f61f3cb75b78dc0071a8b42dd64c110b7e6c194
[ "Apache-2.0" ]
permissive
ResetFull/aliyun-openapi-java-sdk
31fb2c2f7c2b939df4c9067f7a221c3f2c7cef2e
e299d1778d514cd555c870a3b1de117ae3b34474
refs/heads/master
2021-08-31T04:50:07.771585
2017-12-20T12:28:50
2017-12-20T12:28:50
114,978,860
1
0
null
2017-12-21T07:57:54
2017-12-21T07:57:54
null
UTF-8
Java
false
false
1,491
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package com.aliyuncs.vpc.model.v20160428; import com.aliyuncs.AcsResponse; import com.aliyuncs.vpc.transform.v20160428.ModifyHaVipAttributeResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class ModifyHaVipAttributeResponse extends AcsResponse { private String requestId; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } @Override public ModifyHaVipAttributeResponse getInstance(UnmarshallerContext context) { return ModifyHaVipAttributeResponseUnmarshaller.unmarshall(this, context); } }
[ "haowei.yao@alibaba-inc.com" ]
haowei.yao@alibaba-inc.com
fa0f54fe9af90a9866514a6eb77ab7e5be6603ff
64d06dc80dcd0b8b82ed07a6db0c1d1a56eb29e6
/src/main/java/com/spring/boot/redis/demoredis/controller/MainController.java
de040eae8c77f3b0022263ccb81fed5253b5d9ed
[]
no_license
dongheeJeong/spring-boot-redis
68b4028bc6bc518dd7c2fb8807221a2f0d46fef8
ad9becf0e5596f8aa8975c6fdeb88427dc868abd
refs/heads/master
2020-09-04T07:08:04.034547
2019-11-05T07:22:36
2019-11-05T07:22:36
219,681,656
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.spring.boot.redis.demoredis.controller; import com.spring.boot.redis.demoredis.service.GetSetService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class MainController { @Autowired private GetSetService getSetService; @GetMapping("/getset") public String getSet() { return getSetService.test(); } }
[ "donghee.jeong@linecorp.com" ]
donghee.jeong@linecorp.com
89a1b5a75aaa440140019de2426ad23fe6acc254
761a81020d9a1be2c9c892abf8f52298ceab18ae
/src/main/java/com/pzy/entity/osworkflow/CurrentStep.java
bcd59fe4925a73ff87be49a5b62a57b23caa9ed2
[]
no_license
zhaoyang0501/sswxgl
dd64e23765c5e1ec95b8cde382389d089f4d3b93
a0328e3fd05cef08a3e900c9e50b778dbb6446d0
refs/heads/master
2021-01-10T01:42:11.888619
2016-03-24T13:34:04
2016-03-24T13:34:04
54,483,004
0
0
null
null
null
null
UTF-8
Java
false
false
203
java
package com.pzy.entity.osworkflow; import javax.persistence.Entity; import javax.persistence.Table; @Entity @Table(name = "os_currentstep") public class CurrentStep extends WorkFlowStep { }
[ "zhaoyang0501@126.com" ]
zhaoyang0501@126.com
87f76c750c6ae3a6221eced45d02922163df8cfb
73bbf7df28a6c24e8d68e9950dff0524d7677d4e
/app/src/main/java/com/zcc/myapplication/draw/framework/RoundRectDrawable.java
73821f47f11c8dc119614bb479b678252422c9a2
[]
no_license
Neilcc/AndroidFeatureTestor
c0727564848f81c71e7871e8fbee9ee743811495
c1634a2bf342e82b39005dc14319fb14a3e12ff8
refs/heads/master
2020-08-03T16:38:54.614343
2020-01-10T07:25:12
2020-01-10T07:25:12
211,816,125
0
0
null
null
null
null
UTF-8
Java
false
false
5,736
java
package com.zcc.myapplication.draw.framework; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; @RequiresApi(21) public class RoundRectDrawable extends Drawable { private float mRadius; private final Paint mPaint; private final RectF mBoundsF; private final Rect mBoundsI; private float mPadding; private boolean mInsetForPadding = false; private boolean mInsetForRadius = true; private ColorStateList mBackground; private PorterDuffColorFilter mTintFilter; private ColorStateList mTint; private PorterDuff.Mode mTintMode = PorterDuff.Mode.SRC_IN; public RoundRectDrawable(ColorStateList backgroundColor, float radius) { mRadius = radius; mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG); setBackground(backgroundColor); mBoundsF = new RectF(); mBoundsI = new Rect(); } private void setBackground(ColorStateList color) { mBackground = (color == null) ? ColorStateList.valueOf(Color.TRANSPARENT) : color; mPaint.setColor(mBackground.getColorForState(getState(), mBackground.getDefaultColor())); } void setPadding(float padding, boolean insetForPadding, boolean insetForRadius) { if (padding == mPadding && mInsetForPadding == insetForPadding && mInsetForRadius == insetForRadius) { return; } mPadding = padding; mInsetForPadding = insetForPadding; mInsetForRadius = insetForRadius; updateBounds(null); invalidateSelf(); } float getPadding() { return mPadding; } @Override public void draw(Canvas canvas) { final Paint paint = mPaint; final boolean clearColorFilter; if (mTintFilter != null && paint.getColorFilter() == null) { paint.setColorFilter(mTintFilter); clearColorFilter = true; } else { clearColorFilter = false; } canvas.drawRoundRect(mBoundsF, mRadius, mRadius, paint); if (clearColorFilter) { paint.setColorFilter(null); } } private void updateBounds(Rect bounds) { if (bounds == null) { bounds = getBounds(); } mBoundsF.set(bounds.left, bounds.top, bounds.right, bounds.bottom); mBoundsI.set(bounds); if (mInsetForPadding) { // float vInset = RoundRectDrawableWithShadow.calculateVerticalPadding(mPadding, mRadius, mInsetForRadius); // float hInset = RoundRectDrawableWithShadow.calculateHorizontalPadding(mPadding, mRadius, mInsetForRadius); // mBoundsI.inset((int) Math.ceil(hInset), (int) Math.ceil(vInset)); // to make sure they have same bounds. mBoundsF.set(mBoundsI); } } @Override protected void onBoundsChange(Rect bounds) { super.onBoundsChange(bounds); updateBounds(bounds); } @Override public void getOutline(Outline outline) { outline.setRoundRect(mBoundsI, mRadius); } void setRadius(float radius) { if (radius == mRadius) { return; } mRadius = radius; updateBounds(null); invalidateSelf(); } @Override public void setAlpha(int alpha) { mPaint.setAlpha(alpha); } @Override public void setColorFilter(ColorFilter cf) { mPaint.setColorFilter(cf); } @Override public int getOpacity() { return PixelFormat.TRANSLUCENT; } public float getRadius() { return mRadius; } public void setColor(@Nullable ColorStateList color) { setBackground(color); invalidateSelf(); } public ColorStateList getColor() { return mBackground; } @Override public void setTintList(ColorStateList tint) { mTint = tint; mTintFilter = createTintFilter(mTint, mTintMode); invalidateSelf(); } @Override public void setTintMode(PorterDuff.Mode tintMode) { mTintMode = tintMode; mTintFilter = createTintFilter(mTint, mTintMode); invalidateSelf(); } @Override protected boolean onStateChange(int[] stateSet) { final int newColor = mBackground.getColorForState(stateSet, mBackground.getDefaultColor()); final boolean colorChanged = newColor != mPaint.getColor(); if (colorChanged) { mPaint.setColor(newColor); } if (mTint != null && mTintMode != null) { mTintFilter = createTintFilter(mTint, mTintMode); return true; } return colorChanged; } @Override public boolean isStateful() { return (mTint != null && mTint.isStateful()) || (mBackground != null && mBackground.isStateful()) || super.isStateful(); } /** * Ensures the tint filter is consistent with the current tint color and * mode. */ private PorterDuffColorFilter createTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) { if (tint == null || tintMode == null) { return null; } final int color = tint.getColorForState(getState(), Color.TRANSPARENT); return new PorterDuffColorFilter(color, tintMode); } }
[ "zhuchengcheng@netease.corp.com" ]
zhuchengcheng@netease.corp.com
01f94c63b085ba837149c8ca81c536e8f4734a64
c1c47f3f3a3cbf57aa3c11f46af89a677aef7374
/src/main/java/com/bokeproject/controller/AnnounceController.java
d7c140e4ba1772d9741ee41103a62ad5735d27b3
[]
no_license
ym652324/boke
8a5535247341cff249acf3c1b82e97f19ac4dde1
12a04b036ef2d795b355399718225e938d93d3e2
refs/heads/master
2023-08-16T08:16:42.123829
2021-09-28T02:59:24
2021-09-28T02:59:24
411,117,579
0
0
null
null
null
null
UTF-8
Java
false
false
6,123
java
package com.bokeproject.controller; import com.bokeproject.controller.viewobject.AnnounceVO; import com.bokeproject.controller.viewobject.BlogVO; import com.bokeproject.controller.viewobject.UserVO; import com.bokeproject.error.BusinessException; import com.bokeproject.response.CommonReturnType; import com.bokeproject.service.AnnounceService; import com.bokeproject.service.impl.model.AnnounceModel; import com.bokeproject.service.impl.model.BlogModel; import com.bokeproject.service.impl.model.DataReturnModel; import com.bokeproject.service.impl.model.UserModel; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.io.UnsupportedEncodingException; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @Controller("announce") @RequestMapping("/announce") @CrossOrigin(allowCredentials = "true",allowedHeaders = "*") public class AnnounceController extends BaseController { @Autowired private AnnounceService announceService; @RequestMapping(value = "/listannounce",method = {RequestMethod.GET}) @ResponseBody public CommonReturnType listannounce(){ List<AnnounceModel>announceModelList=announceService.listAnnounce(); List<AnnounceVO>announceVOList=announceModelList.stream().map(announceModel -> { AnnounceVO announceVO=this.convertFromModel(announceModel); return announceVO; }).collect(Collectors.toList()); DataReturnModel dataReturnModel=new DataReturnModel<AnnounceVO>(); dataReturnModel.setLength(announceModelList.size()); if(announceVOList.size()<8){ dataReturnModel.setData(announceVOList.subList(0,announceVOList.size())); } else{ dataReturnModel.setData(announceVOList.subList(0,8)); } return CommonReturnType.create(dataReturnModel); } @RequestMapping(value = "/click",method = {RequestMethod.POST}) @ResponseBody public CommonReturnType click(@RequestParam(name="announceid")Integer announceid, @RequestParam(name="announceclick")Integer announceclick) throws BusinessException { AnnounceModel announceModel = announceService.getAnnounceByAnnounceid(announceid); announceModel.setAnnounceclick(announceclick); AnnounceModel announceModelForReturn=announceService.clickAnnounce(announceModel); AnnounceVO announceVO=convertFromModel(announceModelForReturn); return CommonReturnType.create(announceVO); } private AnnounceVO convertFromModel(AnnounceModel announceModel){ if(announceModel==null){ return null; } AnnounceVO announceVO = new AnnounceVO(); BeanUtils.copyProperties(announceModel,announceVO); return announceVO; } @RequestMapping(value = "/addAnnounce",method = {RequestMethod.POST},consumes = {CONTENT_TRPE_FORMED}) @ResponseBody public CommonReturnType addAnnounce(@RequestParam(name="title")String title, @RequestParam(name="announcements")String announcements, @RequestParam(name="id")Integer id ) throws BusinessException { AnnounceModel announceModel =new AnnounceModel(); announceModel.setAnnouncetitle(title); announceModel.setAnnouncements(announcements); Date date = new Date(); //设置要获取到什么样的时间 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //获取String类型的时间 String createdate = sdf.format(date); announceModel.setAnnouncedate(createdate); announceModel.setId(id); AnnounceModel announceModelForReturn=announceService.addAnnounce(announceModel); AnnounceVO announceVO=convertFromModel(announceModelForReturn); return CommonReturnType.create(announceVO); } @RequestMapping(value = "/search",method = {RequestMethod.POST}) @ResponseBody public CommonReturnType search(@RequestParam(name="shuru")String shuru){ List<AnnounceModel> announceModelList=announceService.searchAnnounce(shuru); //使用stream api将list内的blogModel转化为BlogVO List<AnnounceVO>announceVOList=announceModelList.stream().map(announceModel -> { AnnounceVO announceVO=this.convertFromModel(announceModel); return announceVO; }).collect(Collectors.toList()); return CommonReturnType.create(announceVOList); } @RequestMapping(value = "/deleteAnnounce",method = {RequestMethod.POST}) @ResponseBody public CommonReturnType deleteAnnounce(@RequestParam(name="ids")String ids){ String[] str=ids.split("-"); Integer[] arr=new Integer[str.length]; for(Integer i=0;i<str.length;i++){ arr[i]=Integer.parseInt(str[i]); } boolean isSuccess=announceService.deleteAnnounceById(arr); if(isSuccess){ return listannounce(); } return CommonReturnType.create(null,"fail"); } @RequestMapping(value = "/pagechange",method = {RequestMethod.POST}) @ResponseBody public CommonReturnType pagechange(@RequestParam(name="page")Integer page) { Integer start=(page-1)*8; List<AnnounceModel> announceModelList=announceService.pagechange(start); //使用stream api将list内的blogModel转化为BlogVO List<AnnounceVO> announceVOList=announceModelList.stream().map(announceModel -> { AnnounceVO announceVO=this.convertFromModel(announceModel); return announceVO; }).collect(Collectors.toList()); return CommonReturnType.create(announceVOList); } }
[ "ym652324@163.com" ]
ym652324@163.com
b342943fe870e963ec8edcfe253f981e584af3cb
5434e0e87d948cfbf920dc8b1e229c3d96f26006
/com.creditease.uav.healthmanager/src/main/java/com/creditease/uav/feature/runtimenotify/task/JudgeNotifyTimerTask.java
08931fb78980767e1e47de261ce9f9bdb6566258
[ "Apache-2.0" ]
permissive
christinkaka/uavstack
5038b593973cfaced498f8e14f71dfddf8543824
b3a1ad95dd1e4990b27dc5ffeaf2aff14b5394da
refs/heads/master
2021-05-14T14:24:05.766523
2017-12-29T07:52:47
2017-12-29T07:52:47
115,969,238
1
2
null
null
null
null
UTF-8
Java
false
false
7,360
java
/*- * << * UAVStack * == * Copyright (C) 2016 - 2017 UAVStack * == * 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.creditease.uav.feature.runtimenotify.task; import java.util.Map; import java.util.Map.Entry; import com.creditease.agent.helpers.JSONHelper; import com.creditease.agent.helpers.NetworkHelper; import com.creditease.agent.monitor.api.NotificationEvent; import com.creditease.agent.spi.Abstract1NTask; import com.creditease.uav.cache.api.CacheManager; import com.creditease.uav.cache.api.CacheManager.CacheLock; import com.creditease.uav.feature.RuntimeNotifyCatcher; import com.creditease.uav.feature.runtimenotify.NotifyStrategy; import com.creditease.uav.feature.runtimenotify.Slice; import com.creditease.uav.feature.runtimenotify.StrategyJudgement; import com.creditease.uav.feature.runtimenotify.scheduler.RuntimeNotifyStrategyMgr; public class JudgeNotifyTimerTask extends Abstract1NTask { private NotifyStrategy stra; private long taskStart = System.currentTimeMillis(); private long judge_time; private static final String LOCK_REGION = "lock.region.uav"; private static final long LOCK_TIMEOUT = 60 * 1000; private CacheManager cm; public JudgeNotifyTimerTask(String name, String feature, long judge_time, NotifyStrategy stra) { super(name, feature); this.stra = stra; this.judge_time = judge_time - judge_time % 60000; cm = (CacheManager) this.getConfigManager().getComponent(feature, RuntimeNotifyCatcher.CACHE_MANAGER_NAME); } @Override public void run() { CacheLock lock = null; try { lock = cm.newCacheLock(LOCK_REGION, stra.getName(), LOCK_TIMEOUT); if (!lock.getLock()) { return; } /** * Step 1:find out instance */ for (String instance : stra.getInstances()) { /** * Step 2: judge the strategy */ StrategyJudgement judgement = (StrategyJudgement) getConfigManager().getComponent(feature, "StrategyJudgement"); Map<String, String> result = judgement.judge(new Slice(instance, judge_time), stra, null); /** * Step 3: if fire the event, build notification event */ if (result != null && !result.isEmpty()) { NotificationEvent event = this.newNotificationEvent(instance, result); // get context putContext(event); // get action putNotifyAction(event, stra); // get msg tempalte putNotifyMsg(event, stra); if (this.log.isTraceEnable()) { this.log.info(this, "RuntimeNotify Notification Event Happen: event=" + event.toJSONString()); } this.putNotificationEvent(event); } } } catch (Exception e) { log.err(this, "JudgeNotifyTimerTask" + stra.getName() + " RUN FAIL.", e); } finally { if (lock != null && lock.isLockInHand()) { lock.releaseLock(); } } if (log.isDebugEnable()) { long cost = System.currentTimeMillis() - taskStart; String detail = cost < 10 ? "" : " detail:strategy=" + JSONHelper.toString(stra); log.debug(this, "whole task lifecycle COST: (" + cost + ")ms" + detail); } } /** * get context * * TODO: we need support context param in strategy */ private void putContext(NotificationEvent event) { } /** * newNotificationEvent * * * @return */ private NotificationEvent newNotificationEvent(String instance, Map<String, String> result) { String ip = instance; String host = instance; String appgroup = "UNKNOWN"; instance = formatInstance(instance); Map<String, Object> infos = getInfoFromSliceCache(instance); if (infos != null) { ip = String.valueOf(infos.get("ip")); host = String.valueOf(infos.get("host")); appgroup = String.valueOf(infos.get("appgroup")); } StringBuilder desc = new StringBuilder(); StringBuilder conditionIndex = new StringBuilder(); for (Map.Entry<String, String> cause : result.entrySet()) { // description desc.append(instance + "触发条件[" + cause.getKey() + "]:").append(cause.getValue()).append("\r\n"); // condition index conditionIndex.append(" " + cause.getKey()); } String title = ip + "[" + instance + "]触发" + result.size() + "个报警(条件序号:" + conditionIndex.toString() + ")"; // fix &nbsp(\u00A0) can be shown in email String description = desc.toString().replace('\u00A0', ' '); NotificationEvent ne = new NotificationEvent(NotificationEvent.EVENT_RT_ALERT_THRESHOLD, title, description, judge_time, ip, host); // add appgroup ne.addArg("appgroup", appgroup); return ne; } private String formatInstance(String instance) { if (NetworkHelper.isIPV4(instance)) { instance += "_"; } instance = stra.getName().substring(0, stra.getName().lastIndexOf('@') + 1) + instance; return instance; } private Map<String, Object> getInfoFromSliceCache(String instance) { String cacheKey = "SLICE_" + instance + "_"; for (int index = 0; index < 60; index++) { String result = cm.lpop(RuntimeNotifyStrategyMgr.UAV_CACHE_REGION, cacheKey + index); if (result != null) { Slice s = new Slice(result); return s.getArgs(); } } return null; } private void putNotifyAction(NotificationEvent event, NotifyStrategy stra) { Map<String, String> actions = stra.getAction(); if (actions == null || actions.isEmpty()) { return; } for (Entry<String, String> act : actions.entrySet()) { event.addArg("action_" + act.getKey(), act.getValue()); } } private void putNotifyMsg(NotificationEvent event, NotifyStrategy stra) { String msgTemplate = stra.getMsgTemplate(); String msg = makeMsgByTemplate(msgTemplate, stra); if (msg != null) { event.addArg("msg", msg); } } /** * * @param template * @param slice * @return */ private String makeMsgByTemplate(String template, NotifyStrategy stra) { return ""; } }
[ "minglangyang@creditease.cn" ]
minglangyang@creditease.cn
5c88eff63b4811f376dc330955db5ac84304d02d
8d11cf068112317136f5cb58e9d6a21d50f5ebd2
/homework-gwt-client/src/main/java/com/github/nmorel/homework/client/screens/search/SearchViewImpl.java
d08f99ca6d15d6cbcf4f7da2aab8db92812d3dfd
[]
no_license
nmorel/homework
0cf1ce4f14e400ceb89ca1812a8ecabf7cd3c0bb
c83bb8d5b799b2a61f4cc73b1c069f3cfdda0880
refs/heads/master
2023-08-25T01:53:03.285736
2013-06-08T11:08:31
2013-06-08T11:08:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,149
java
package com.github.nmorel.homework.client.screens.search; import java.util.logging.Logger; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.TextBox; import com.github.nmorel.homework.client.model.Repository; import com.github.nmorel.homework.client.ui.AbstractView; import com.github.nmorel.homework.client.ui.KeyboardEventTranslator; import com.github.nmorel.homework.client.ui.State; import com.github.nmorel.homework.client.ui.cell.RepositoryCell; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JsArray; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.cellview.client.CellList; import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy; import com.google.gwt.user.client.ui.DeckPanel; import com.google.gwt.user.client.ui.Widget; import com.google.gwt.view.client.DefaultSelectionEventManager; import com.google.gwt.view.client.ListDataProvider; import com.google.gwt.view.client.SelectionChangeEvent; import com.google.gwt.view.client.SelectionChangeEvent.Handler; import com.google.gwt.view.client.SingleSelectionModel; import com.google.inject.Inject; import com.google.inject.Provider; /** * Default implementation of the view {@link SearchView}. * * @author Nicolas Morel */ public class SearchViewImpl extends AbstractView implements SearchView { interface ListResources extends CellList.Resources { /** * The styles used in this widget. */ @Source( "searchResultList.css" ) ListStyle cellListStyle(); } interface ListStyle extends CellList.Style { } interface Binder extends UiBinder<Widget, SearchViewImpl> { } private static final Logger logger = Logger.getLogger( SearchViewImpl.class.getName() ); private static final ListResources listResources = GWT.create( ListResources.class ); private static final Binder uiBinder = GWT.create( Binder.class ); private Presenter presenter; @UiField TextBox keyword; @UiField Button search; @UiField DeckPanel resultContainer; @UiField( provided = true ) CellList<Repository> resultList; ListDataProvider<Repository> resultDataProvider; @Inject private Provider<RepositoryCell> repositoryCellProvider; private String currentResultKeyword; @Override public void setPresenter( Presenter presenter ) { this.presenter = presenter; } @Override protected Widget initWidget() { resultList = new CellList<Repository>( repositoryCellProvider.get(), listResources ); // no pagination resultList.setPageSize( Integer.MAX_VALUE ); // user can navigate and select with keyboard resultList.setKeyboardSelectionPolicy( KeyboardSelectionPolicy.ENABLED ); resultDataProvider = new ListDataProvider<Repository>(); resultDataProvider.addDataDisplay( resultList ); final SingleSelectionModel<Repository> selectionModel = new SingleSelectionModel<Repository>(); selectionModel.addSelectionChangeHandler( new Handler() { @Override public void onSelectionChange( SelectionChangeEvent event ) { presenter.onSelectionRepository( selectionModel.getSelectedObject() ); } } ); resultList.setSelectionModel( selectionModel, DefaultSelectionEventManager.createCustomManager( new KeyboardEventTranslator<Repository>() ) ); Widget result = uiBinder.createAndBindUi( this ); // we removed the default style to be able to change them via css resultContainer.getElement().getStyle().clearPosition(); return result; } @Override public void setKeyword( String keyword ) { this.keyword.setValue( keyword ); } @UiHandler( "keyword" ) void onEnterKeyword( KeyUpEvent event ) { if ( event.getNativeKeyCode() == KeyCodes.KEY_ENTER ) { presenter.onSearch( keyword.getText() ); } } @UiHandler( "search" ) void onClickSearch( ClickEvent event ) { presenter.onSearch( keyword.getText() ); } @Override public void showResults( JsArray<Repository> repos ) { resultDataProvider.getList().clear(); for ( int i = 0; i < repos.length(); i++ ) { resultDataProvider.getList().add( repos.get( i ) ); } } @Override public void clear() { currentResultKeyword = null; keyword.setValue( null ); resultDataProvider.getList().clear(); } @Override public void setState( State state ) { logger.fine( "Updating state to " + state ); currentResultKeyword = null; switch ( state ) { case DEFAULT: setFormEnabled( true ); resultContainer.setVisible( false ); setFocusOnKeyword(); break; case LOADING: setFormEnabled( false ); resultContainer.showWidget( 0 ); resultContainer.setVisible( true ); // we set the focus on list to loose it setFocusOnList(); break; case LOADED: setFormEnabled( true ); if ( resultDataProvider.getList().isEmpty() ) { resultContainer.showWidget( 1 ); setFocusOnKeyword(); } else { currentResultKeyword = keyword.getValue(); resultContainer.showWidget( 3 ); setFocusOnList(); } resultContainer.setVisible( true ); break; case ERROR: setFormEnabled( true ); resultContainer.showWidget( 2 ); setFocusOnKeyword(); resultContainer.setVisible( true ); break; } } private void setFormEnabled( boolean enabled ) { keyword.setEnabled( enabled ); search.setEnabled( enabled ); } private void setFocusOnKeyword() { keyword.setFocus( true ); keyword.selectAll(); } private void setFocusOnList() { resultList.setFocus( true ); Scheduler.get().scheduleDeferred( new ScheduledCommand() { @Override public void execute() { resultList.setFocus( true ); } } ); } @Override public String getCurrentResultKeyword() { return currentResultKeyword; } }
[ "nmr.morel@gmail.com" ]
nmr.morel@gmail.com
37b0f9bdb8de01cd137c43d9ce5b39897fe73a32
75ef32e85c1e1c0236d2038d5a2d3abcf00cff81
/UMartV2/gui/UWaitingFrame.java
bd6653cf5008520029988ae5bcbe5efb2e129bae
[]
no_license
sejii/sysmode
469e5537d406f0e0f0381fe69cec779a3024461a
f6da1db487a9aee4403e8f3ff9e73741658552b3
refs/heads/master
2020-12-14T07:40:12.066948
2015-07-20T12:03:05
2015-07-20T12:03:05
39,017,589
0
0
null
null
null
null
SHIFT_JIS
Java
false
false
2,759
java
/** * Copyright (c) 2001-2008 U-Mart Project * * 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 gui; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class UWaitingFrame extends JFrame { JPanel contentPane; JLabel fWaitingLabel = new JLabel(); //フレームのビルド public UWaitingFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch (Exception e) { e.printStackTrace(); } } //コンポーネントの初期化 private void jbInit() throws Exception { contentPane = (JPanel)this.getContentPane(); contentPane.setLayout(null); this.setSize(new Dimension(300, 200)); this.setTitle("U-Mart Network Client"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); fWaitingLabel.setText("Please waiting for starting server..."); fWaitingLabel.setBounds(new Rectangle(44, 59, 214, 36)); contentPane.add(fWaitingLabel, null); } //ウィンドウが閉じられたときに終了するようにオーバーライド protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } }
[ "uesejii@yahoo.co.jp" ]
uesejii@yahoo.co.jp
cd09bd65e40512b72a91b529ed91cec73da7668f
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/26/26_791d2629c8136d2975a9db9924b9b44d1279e370/PanoramaModule/26_791d2629c8136d2975a9db9924b9b44d1279e370_PanoramaModule_t.java
2bed596cb5fe0046aef69373da591e515aed3adc
[]
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
50,717
java
/* * Copyright (C) 2011 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.camera; import android.annotation.TargetApi; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.ImageFormat; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.SurfaceTexture; import android.graphics.YuvImage; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.Camera.Parameters; import android.hardware.Camera.Size; import android.media.ExifInterface; import android.net.Uri; import android.os.AsyncTask; import android.os.Handler; import android.os.Message; import android.os.PowerManager; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.OrientationEventListener; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.android.camera.CameraManager.CameraProxy; import com.android.camera.ui.LayoutChangeNotifier; import com.android.camera.ui.LayoutNotifyView; import com.android.camera.ui.PopupManager; import com.android.camera.ui.Rotatable; import com.android.camera.ui.RotateLayout; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.ui.GLRootView; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.List; import java.util.TimeZone; /** * Activity to handle panorama capturing. */ @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) // uses SurfaceTexture public class PanoramaModule implements CameraModule, SurfaceTexture.OnFrameAvailableListener, ShutterButton.OnShutterButtonListener, LayoutChangeNotifier.Listener { public static final int DEFAULT_SWEEP_ANGLE = 160; public static final int DEFAULT_BLEND_MODE = Mosaic.BLENDTYPE_HORIZONTAL; public static final int DEFAULT_CAPTURE_PIXELS = 960 * 720; private static final int MSG_LOW_RES_FINAL_MOSAIC_READY = 1; private static final int MSG_GENERATE_FINAL_MOSAIC_ERROR = 2; private static final int MSG_RESET_TO_PREVIEW = 3; private static final int MSG_CLEAR_SCREEN_DELAY = 4; private static final int SCREEN_DELAY = 2 * 60 * 1000; private static final String TAG = "CAM PanoModule"; private static final int PREVIEW_STOPPED = 0; private static final int PREVIEW_ACTIVE = 1; private static final int CAPTURE_STATE_VIEWFINDER = 0; private static final int CAPTURE_STATE_MOSAIC = 1; private static final String GPS_DATE_FORMAT_STR = "yyyy:MM:dd"; private static final String GPS_TIME_FORMAT_STR = "kk/1,mm/1,ss/1"; private static final String DATETIME_FORMAT_STR = "yyyy:MM:dd kk:mm:ss"; // The unit of speed is degrees per frame. private static final float PANNING_SPEED_THRESHOLD = 2.5f; private ContentResolver mContentResolver; private GLRootView mGLRootView; private ViewGroup mPanoLayout; private LinearLayout mCaptureLayout; private View mReviewLayout; private ImageView mReview; private RotateLayout mCaptureIndicator; private PanoProgressBar mPanoProgressBar; private PanoProgressBar mSavingProgressBar; private LayoutNotifyView mPreviewArea; private View mLeftIndicator; private View mRightIndicator; private MosaicPreviewRenderer mMosaicPreviewRenderer; private TextView mTooFastPrompt; private ShutterButton mShutterButton; private Object mWaitObject = new Object(); private DateFormat mGPSDateStampFormat; private DateFormat mGPSTimeStampFormat; private DateFormat mDateTimeStampFormat; private String mPreparePreviewString; private String mDialogTitle; private String mDialogOkString; private String mDialogPanoramaFailedString; private String mDialogWaitingPreviousString; private int mIndicatorColor; private int mIndicatorColorFast; private boolean mUsingFrontCamera; private int mPreviewWidth; private int mPreviewHeight; private int mCameraState; private int mCaptureState; private PowerManager.WakeLock mPartialWakeLock; private MosaicFrameProcessor mMosaicFrameProcessor; private boolean mMosaicFrameProcessorInitialized; private AsyncTask <Void, Void, Void> mWaitProcessorTask; private long mTimeTaken; private Handler mMainHandler; private SurfaceTexture mCameraTexture; private boolean mThreadRunning; private boolean mCancelComputation; private float mHorizontalViewAngle; private float mVerticalViewAngle; // Prefer FOCUS_MODE_INFINITY to FOCUS_MODE_CONTINUOUS_VIDEO because of // getting a better image quality by the former. private String mTargetFocusMode = Parameters.FOCUS_MODE_INFINITY; private PanoOrientationEventListener mOrientationEventListener; // The value could be 0, 90, 180, 270 for the 4 different orientations measured in clockwise // respectively. private int mDeviceOrientation; private int mDeviceOrientationAtCapture; private int mCameraOrientation; private int mOrientationCompensation; private RotateDialogController mRotateDialog; private SoundClips.Player mSoundPlayer; private Runnable mOnFrameAvailableRunnable; private CameraActivity mActivity; private View mRootView; private CameraProxy mCameraDevice; private boolean mPaused; private class MosaicJpeg { public MosaicJpeg(byte[] data, int width, int height) { this.data = data; this.width = width; this.height = height; this.isValid = true; } public MosaicJpeg() { this.data = null; this.width = 0; this.height = 0; this.isValid = false; } public final byte[] data; public final int width; public final int height; public final boolean isValid; } private class PanoOrientationEventListener extends OrientationEventListener { public PanoOrientationEventListener(Context context) { super(context); } @Override public void onOrientationChanged(int orientation) { // We keep the last known orientation. So if the user first orient // the camera then point the camera to floor or sky, we still have // the correct orientation. if (orientation == ORIENTATION_UNKNOWN) return; mDeviceOrientation = Util.roundOrientation(orientation, mDeviceOrientation); // When the screen is unlocked, display rotation may change. Always // calculate the up-to-date orientationCompensation. int orientationCompensation = mDeviceOrientation + Util.getDisplayRotation(mActivity) % 360; if (mOrientationCompensation != orientationCompensation) { mOrientationCompensation = orientationCompensation; mActivity.getGLRoot().requestLayoutContentPane(); } } } @Override public void init(CameraActivity activity, View parent, boolean reuseScreenNail) { mActivity = activity; mRootView = (ViewGroup) parent; createContentView(); mContentResolver = mActivity.getContentResolver(); if (reuseScreenNail) { mActivity.reuseCameraScreenNail(true); } else { mActivity.createCameraScreenNail(true); } // This runs in UI thread. mOnFrameAvailableRunnable = new Runnable() { @Override public void run() { // Frames might still be available after the activity is paused. // If we call onFrameAvailable after pausing, the GL thread will crash. if (mPaused) return; if (mGLRootView.getVisibility() != View.VISIBLE) { mMosaicPreviewRenderer.showPreviewFrameSync(); mGLRootView.setVisibility(View.VISIBLE); } else { if (mCaptureState == CAPTURE_STATE_VIEWFINDER) { mMosaicPreviewRenderer.showPreviewFrame(); } else { mMosaicPreviewRenderer.alignFrameSync(); mMosaicFrameProcessor.processFrame(); } } } }; mGPSDateStampFormat = new SimpleDateFormat(GPS_DATE_FORMAT_STR); mGPSTimeStampFormat = new SimpleDateFormat(GPS_TIME_FORMAT_STR); mDateTimeStampFormat = new SimpleDateFormat(DATETIME_FORMAT_STR); TimeZone tzUTC = TimeZone.getTimeZone("UTC"); mGPSDateStampFormat.setTimeZone(tzUTC); mGPSTimeStampFormat.setTimeZone(tzUTC); PowerManager pm = (PowerManager) mActivity.getSystemService(Context.POWER_SERVICE); mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Panorama"); mOrientationEventListener = new PanoOrientationEventListener(mActivity); mMosaicFrameProcessor = MosaicFrameProcessor.getInstance(); Resources appRes = mActivity.getResources(); mPreparePreviewString = appRes.getString(R.string.pano_dialog_prepare_preview); mDialogTitle = appRes.getString(R.string.pano_dialog_title); mDialogOkString = appRes.getString(R.string.dialog_ok); mDialogPanoramaFailedString = appRes.getString(R.string.pano_dialog_panorama_failed); mDialogWaitingPreviousString = appRes.getString(R.string.pano_dialog_waiting_previous); mGLRootView = (GLRootView) mActivity.getGLRoot(); mMainHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case MSG_LOW_RES_FINAL_MOSAIC_READY: onBackgroundThreadFinished(); showFinalMosaic((Bitmap) msg.obj); saveHighResMosaic(); break; case MSG_GENERATE_FINAL_MOSAIC_ERROR: onBackgroundThreadFinished(); if (mPaused) { resetToPreview(); } else { mRotateDialog.showAlertDialog( mDialogTitle, mDialogPanoramaFailedString, mDialogOkString, new Runnable() { @Override public void run() { resetToPreview(); }}, null, null); } clearMosaicFrameProcessorIfNeeded(); break; case MSG_RESET_TO_PREVIEW: onBackgroundThreadFinished(); resetToPreview(); clearMosaicFrameProcessorIfNeeded(); break; case MSG_CLEAR_SCREEN_DELAY: mActivity.getWindow().clearFlags(WindowManager.LayoutParams. FLAG_KEEP_SCREEN_ON); break; } } }; } @Override public boolean dispatchTouchEvent(MotionEvent m) { return mActivity.superDispatchTouchEvent(m); } private void setupCamera() throws CameraHardwareException, CameraDisabledException { openCamera(); Parameters parameters = mCameraDevice.getParameters(); setupCaptureParams(parameters); configureCamera(parameters); } private void releaseCamera() { if (mCameraDevice != null) { mCameraDevice.setPreviewCallbackWithBuffer(null); CameraHolder.instance().release(); mCameraDevice = null; mCameraState = PREVIEW_STOPPED; } } private void openCamera() throws CameraHardwareException, CameraDisabledException { int cameraId = CameraHolder.instance().getBackCameraId(); // If there is no back camera, use the first camera. Camera id starts // from 0. Currently if a camera is not back facing, it is front facing. // This is also forward compatible if we have a new facing other than // back or front in the future. if (cameraId == -1) cameraId = 0; mCameraDevice = Util.openCamera(mActivity, cameraId); mCameraOrientation = Util.getCameraOrientation(cameraId); if (cameraId == CameraHolder.instance().getFrontCameraId()) mUsingFrontCamera = true; } private boolean findBestPreviewSize(List<Size> supportedSizes, boolean need4To3, boolean needSmaller) { int pixelsDiff = DEFAULT_CAPTURE_PIXELS; boolean hasFound = false; for (Size size : supportedSizes) { int h = size.height; int w = size.width; // we only want 4:3 format. int d = DEFAULT_CAPTURE_PIXELS - h * w; if (needSmaller && d < 0) { // no bigger preview than 960x720. continue; } if (need4To3 && (h * 4 != w * 3)) { continue; } d = Math.abs(d); if (d < pixelsDiff) { mPreviewWidth = w; mPreviewHeight = h; pixelsDiff = d; hasFound = true; } } return hasFound; } private void setupCaptureParams(Parameters parameters) { List<Size> supportedSizes = parameters.getSupportedPreviewSizes(); if (!findBestPreviewSize(supportedSizes, true, true)) { Log.w(TAG, "No 4:3 ratio preview size supported."); if (!findBestPreviewSize(supportedSizes, false, true)) { Log.w(TAG, "Can't find a supported preview size smaller than 960x720."); findBestPreviewSize(supportedSizes, false, false); } } Log.v(TAG, "preview h = " + mPreviewHeight + " , w = " + mPreviewWidth); parameters.setPreviewSize(mPreviewWidth, mPreviewHeight); List<int[]> frameRates = parameters.getSupportedPreviewFpsRange(); int last = frameRates.size() - 1; int minFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MIN_INDEX]; int maxFps = (frameRates.get(last))[Parameters.PREVIEW_FPS_MAX_INDEX]; parameters.setPreviewFpsRange(minFps, maxFps); Log.v(TAG, "preview fps: " + minFps + ", " + maxFps); List<String> supportedFocusModes = parameters.getSupportedFocusModes(); if (supportedFocusModes.indexOf(mTargetFocusMode) >= 0) { parameters.setFocusMode(mTargetFocusMode); } else { // Use the default focus mode and log a message Log.w(TAG, "Cannot set the focus mode to " + mTargetFocusMode + " becuase the mode is not supported."); } parameters.set(Util.RECORDING_HINT, Util.FALSE); mHorizontalViewAngle = parameters.getHorizontalViewAngle(); mVerticalViewAngle = parameters.getVerticalViewAngle(); } public int getPreviewBufSize() { PixelFormat pixelInfo = new PixelFormat(); PixelFormat.getPixelFormatInfo(mCameraDevice.getParameters().getPreviewFormat(), pixelInfo); // TODO: remove this extra 32 byte after the driver bug is fixed. return (mPreviewWidth * mPreviewHeight * pixelInfo.bitsPerPixel / 8) + 32; } private void configureCamera(Parameters parameters) { mCameraDevice.setParameters(parameters); } private void configMosaicPreview(int w, int h) { stopCameraPreview(); CameraScreenNail screenNail = (CameraScreenNail) mActivity.mCameraScreenNail; screenNail.setSize(w, h); if (screenNail.getSurfaceTexture() == null) { screenNail.acquireSurfaceTexture(); } else { screenNail.releaseSurfaceTexture(); screenNail.acquireSurfaceTexture(); mActivity.notifyScreenNailChanged(); } boolean isLandscape = (mActivity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE); if (mMosaicPreviewRenderer != null) mMosaicPreviewRenderer.release(); mMosaicPreviewRenderer = new MosaicPreviewRenderer( screenNail.getSurfaceTexture(), w, h, isLandscape); mCameraTexture = mMosaicPreviewRenderer.getInputSurfaceTexture(); if (!mPaused && !mThreadRunning && mWaitProcessorTask == null) { resetToPreview(); } } // Receives the layout change event from the preview area. So we can set // the camera preview screennail to the same size and initialize the mosaic // preview renderer. @Override public void onLayoutChange(View v, int l, int t, int r, int b) { Log.i(TAG, "layout change: "+(r - l) + "/" +(b - t)); mActivity.onLayoutChange(v, l, t, r, b); configMosaicPreview(r - l, b - t); } @Override public void onFrameAvailable(SurfaceTexture surface) { /* This function may be called by some random thread, * so let's be safe and jump back to ui thread. * No OpenGL calls can be done here. */ mActivity.runOnUiThread(mOnFrameAvailableRunnable); } private void hideDirectionIndicators() { mLeftIndicator.setVisibility(View.GONE); mRightIndicator.setVisibility(View.GONE); } private void showDirectionIndicators(int direction) { switch (direction) { case PanoProgressBar.DIRECTION_NONE: mLeftIndicator.setVisibility(View.VISIBLE); mRightIndicator.setVisibility(View.VISIBLE); break; case PanoProgressBar.DIRECTION_LEFT: mLeftIndicator.setVisibility(View.VISIBLE); mRightIndicator.setVisibility(View.GONE); break; case PanoProgressBar.DIRECTION_RIGHT: mLeftIndicator.setVisibility(View.GONE); mRightIndicator.setVisibility(View.VISIBLE); break; } } public void startCapture() { // Reset values so we can do this again. mCancelComputation = false; mTimeTaken = System.currentTimeMillis(); mActivity.setSwipingEnabled(false); mActivity.hideSwitcher(); mShutterButton.setImageResource(R.drawable.btn_shutter_recording); mCaptureState = CAPTURE_STATE_MOSAIC; mCaptureIndicator.setVisibility(View.VISIBLE); showDirectionIndicators(PanoProgressBar.DIRECTION_NONE); mMosaicFrameProcessor.setProgressListener(new MosaicFrameProcessor.ProgressListener() { @Override public void onProgress(boolean isFinished, float panningRateX, float panningRateY, float progressX, float progressY) { float accumulatedHorizontalAngle = progressX * mHorizontalViewAngle; float accumulatedVerticalAngle = progressY * mVerticalViewAngle; if (isFinished || (Math.abs(accumulatedHorizontalAngle) >= DEFAULT_SWEEP_ANGLE) || (Math.abs(accumulatedVerticalAngle) >= DEFAULT_SWEEP_ANGLE)) { stopCapture(false); } else { float panningRateXInDegree = panningRateX * mHorizontalViewAngle; float panningRateYInDegree = panningRateY * mVerticalViewAngle; updateProgress(panningRateXInDegree, panningRateYInDegree, accumulatedHorizontalAngle, accumulatedVerticalAngle); } } }); mPanoProgressBar.reset(); // TODO: calculate the indicator width according to different devices to reflect the actual // angle of view of the camera device. mPanoProgressBar.setIndicatorWidth(20); mPanoProgressBar.setMaxProgress(DEFAULT_SWEEP_ANGLE); mPanoProgressBar.setVisibility(View.VISIBLE); mDeviceOrientationAtCapture = mDeviceOrientation; keepScreenOn(); mActivity.getOrientationManager().lockOrientation(); } private void stopCapture(boolean aborted) { mCaptureState = CAPTURE_STATE_VIEWFINDER; mCaptureIndicator.setVisibility(View.GONE); hideTooFastIndication(); hideDirectionIndicators(); mMosaicFrameProcessor.setProgressListener(null); stopCameraPreview(); mCameraTexture.setOnFrameAvailableListener(null); if (!aborted && !mThreadRunning) { mRotateDialog.showWaitingDialog(mPreparePreviewString); // Hide shutter button, shutter icon, etc when waiting for // panorama to stitch mActivity.hideUI(); runBackgroundThread(new Thread() { @Override public void run() { MosaicJpeg jpeg = generateFinalMosaic(false); if (jpeg != null && jpeg.isValid) { Bitmap bitmap = null; bitmap = BitmapFactory.decodeByteArray(jpeg.data, 0, jpeg.data.length); mMainHandler.sendMessage(mMainHandler.obtainMessage( MSG_LOW_RES_FINAL_MOSAIC_READY, bitmap)); } else { mMainHandler.sendMessage(mMainHandler.obtainMessage( MSG_RESET_TO_PREVIEW)); } } }); } keepScreenOnAwhile(); } private void showTooFastIndication() { mTooFastPrompt.setVisibility(View.VISIBLE); // The PreviewArea also contains the border for "too fast" indication. mPreviewArea.setVisibility(View.VISIBLE); mPanoProgressBar.setIndicatorColor(mIndicatorColorFast); mLeftIndicator.setEnabled(true); mRightIndicator.setEnabled(true); } private void hideTooFastIndication() { mTooFastPrompt.setVisibility(View.GONE); // We set "INVISIBLE" instead of "GONE" here because we need mPreviewArea to have layout // information so we can know the size and position for mCameraScreenNail. mPreviewArea.setVisibility(View.INVISIBLE); mPanoProgressBar.setIndicatorColor(mIndicatorColor); mLeftIndicator.setEnabled(false); mRightIndicator.setEnabled(false); } private void updateProgress(float panningRateXInDegree, float panningRateYInDegree, float progressHorizontalAngle, float progressVerticalAngle) { mGLRootView.requestRender(); if ((Math.abs(panningRateXInDegree) > PANNING_SPEED_THRESHOLD) || (Math.abs(panningRateYInDegree) > PANNING_SPEED_THRESHOLD)) { showTooFastIndication(); } else { hideTooFastIndication(); } int angleInMajorDirection = (Math.abs(progressHorizontalAngle) > Math.abs(progressVerticalAngle)) ? (int) progressHorizontalAngle : (int) progressVerticalAngle; mPanoProgressBar.setProgress((angleInMajorDirection)); } private void setViews(Resources appRes) { mCaptureState = CAPTURE_STATE_VIEWFINDER; mPanoProgressBar = (PanoProgressBar) mRootView.findViewById(R.id.pano_pan_progress_bar); mPanoProgressBar.setBackgroundColor(appRes.getColor(R.color.pano_progress_empty)); mPanoProgressBar.setDoneColor(appRes.getColor(R.color.pano_progress_done)); mPanoProgressBar.setIndicatorColor(mIndicatorColor); mPanoProgressBar.setOnDirectionChangeListener( new PanoProgressBar.OnDirectionChangeListener () { @Override public void onDirectionChange(int direction) { if (mCaptureState == CAPTURE_STATE_MOSAIC) { showDirectionIndicators(direction); } } }); mLeftIndicator = mRootView.findViewById(R.id.pano_pan_left_indicator); mRightIndicator = mRootView.findViewById(R.id.pano_pan_right_indicator); mLeftIndicator.setEnabled(false); mRightIndicator.setEnabled(false); mTooFastPrompt = (TextView) mRootView.findViewById(R.id.pano_capture_too_fast_textview); // This mPreviewArea also shows the border for visual "too fast" indication. mPreviewArea = (LayoutNotifyView) mRootView.findViewById(R.id.pano_preview_area); mPreviewArea.setOnLayoutChangeListener(this); mSavingProgressBar = (PanoProgressBar) mRootView.findViewById(R.id.pano_saving_progress_bar); mSavingProgressBar.setIndicatorWidth(0); mSavingProgressBar.setMaxProgress(100); mSavingProgressBar.setBackgroundColor(appRes.getColor(R.color.pano_progress_empty)); mSavingProgressBar.setDoneColor(appRes.getColor(R.color.pano_progress_indication)); mCaptureIndicator = (RotateLayout) mRootView.findViewById(R.id.pano_capture_indicator); mReviewLayout = mRootView.findViewById(R.id.pano_review_layout); mReview = (ImageView) mRootView.findViewById(R.id.pano_reviewarea); View cancelButton = mRootView.findViewById(R.id.pano_review_cancel_button); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (mPaused || mCameraTexture == null) return; cancelHighResComputation(); } }); mShutterButton = mActivity.getShutterButton(); mShutterButton.setImageResource(R.drawable.btn_new_shutter); mShutterButton.setOnShutterButtonListener(this); if (mActivity.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { Rotatable[] rotateLayout = { (Rotatable) mRootView.findViewById(R.id.pano_pan_progress_bar_layout), (Rotatable) mRootView.findViewById(R.id.pano_capture_too_fast_textview_layout), (Rotatable) mRootView.findViewById(R.id.pano_review_saving_indication_layout), (Rotatable) mRootView.findViewById(R.id.pano_saving_progress_bar_layout), (Rotatable) mRootView.findViewById(R.id.pano_review_cancel_button_layout), (Rotatable) mRootView.findViewById(R.id.pano_rotate_reviewarea), mRotateDialog, mCaptureIndicator, }; for (Rotatable r : rotateLayout) { r.setOrientation(270, false); } } else { // Even if the orientation is 0, we still need to set because it might be previously // set when the configuration is portrait. mRotateDialog.setOrientation(0, false); } } private void createContentView() { mActivity.getLayoutInflater().inflate(R.layout.panorama_module, (ViewGroup) mRootView); Resources appRes = mActivity.getResources(); mCaptureLayout = (LinearLayout) mRootView.findViewById(R.id.camera_app_root); mIndicatorColor = appRes.getColor(R.color.pano_progress_indication); mIndicatorColorFast = appRes.getColor(R.color.pano_progress_indication_fast); mPanoLayout = (ViewGroup) mRootView.findViewById(R.id.pano_layout); mRotateDialog = new RotateDialogController(mActivity, R.layout.rotate_dialog); setViews(appRes); } @Override public void onShutterButtonClick() { // If mCameraTexture == null then GL setup is not finished yet. // No buttons can be pressed. if (mPaused || mThreadRunning || mCameraTexture == null) return; // Since this button will stay on the screen when capturing, we need to check the state // right now. switch (mCaptureState) { case CAPTURE_STATE_VIEWFINDER: if(mActivity.getStorageSpace() <= Storage.LOW_STORAGE_THRESHOLD) return; mSoundPlayer.play(SoundClips.START_VIDEO_RECORDING); startCapture(); break; case CAPTURE_STATE_MOSAIC: mSoundPlayer.play(SoundClips.STOP_VIDEO_RECORDING); stopCapture(false); } } @Override public void onShutterButtonFocus(boolean pressed) { } public void reportProgress() { mSavingProgressBar.reset(); mSavingProgressBar.setRightIncreasing(true); Thread t = new Thread() { @Override public void run() { while (mThreadRunning) { final int progress = mMosaicFrameProcessor.reportProgress( true, mCancelComputation); try { synchronized (mWaitObject) { mWaitObject.wait(50); } } catch (InterruptedException e) { throw new RuntimeException("Panorama reportProgress failed", e); } // Update the progress bar mActivity.runOnUiThread(new Runnable() { @Override public void run() { mSavingProgressBar.setProgress(progress); } }); } } }; t.start(); } private int getCaptureOrientation() { // The panorama image returned from the library is oriented based on the // natural orientation of a camera. We need to set an orientation for the image // in its EXIF header, so the image can be displayed correctly. // The orientation is calculated from compensating the // device orientation at capture and the camera orientation respective to // the natural orientation of the device. int orientation; if (mUsingFrontCamera) { // mCameraOrientation is negative with respect to the front facing camera. // See document of android.hardware.Camera.Parameters.setRotation. orientation = (mDeviceOrientationAtCapture - mCameraOrientation + 360) % 360; } else { orientation = (mDeviceOrientationAtCapture + mCameraOrientation) % 360; } return orientation; } public void saveHighResMosaic() { runBackgroundThread(new Thread() { @Override public void run() { mPartialWakeLock.acquire(); MosaicJpeg jpeg; try { jpeg = generateFinalMosaic(true); } finally { mPartialWakeLock.release(); } if (jpeg == null) { // Cancelled by user. mMainHandler.sendEmptyMessage(MSG_RESET_TO_PREVIEW); } else if (!jpeg.isValid) { // Error when generating mosaic. mMainHandler.sendEmptyMessage(MSG_GENERATE_FINAL_MOSAIC_ERROR); } else { int orientation = getCaptureOrientation(); Uri uri = savePanorama(jpeg.data, jpeg.width, jpeg.height, orientation); if (uri != null) { mActivity.addSecureAlbumItemIfNeeded(false, uri); Util.broadcastNewPicture(mActivity, uri); } mMainHandler.sendMessage( mMainHandler.obtainMessage(MSG_RESET_TO_PREVIEW)); } } }); reportProgress(); } private void runBackgroundThread(Thread thread) { mThreadRunning = true; thread.start(); } private void onBackgroundThreadFinished() { mThreadRunning = false; mRotateDialog.dismissDialog(); } private void cancelHighResComputation() { mCancelComputation = true; synchronized (mWaitObject) { mWaitObject.notify(); } } // This function will be called upon the first camera frame is available. private void reset() { mCaptureState = CAPTURE_STATE_VIEWFINDER; mActivity.getOrientationManager().unlockOrientation(); // We should set mGLRootView visible too. However, since there might be no // frame available yet, setting mGLRootView visible should be done right after // the first camera frame is available and therefore it is done by // mOnFirstFrameAvailableRunnable. mActivity.setSwipingEnabled(true); mShutterButton.setImageResource(R.drawable.btn_new_shutter); mReviewLayout.setVisibility(View.GONE); mPanoProgressBar.setVisibility(View.GONE); // Orientation change will trigger onLayoutChange->configMosaicPreview-> // resetToPreview. Do not show the capture UI in film strip. if (mActivity.mShowCameraAppView) { mCaptureLayout.setVisibility(View.VISIBLE); mActivity.showUI(); } mMosaicFrameProcessor.reset(); } private void resetToPreview() { reset(); if (!mPaused) startCameraPreview(); } private static class FlipBitmapDrawable extends BitmapDrawable { public FlipBitmapDrawable(Resources res, Bitmap bitmap) { super(res, bitmap); } @Override public void draw(Canvas canvas) { Rect bounds = getBounds(); int cx = bounds.centerX(); int cy = bounds.centerY(); canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(180, cx, cy); super.draw(canvas); canvas.restore(); } } private void showFinalMosaic(Bitmap bitmap) { if (bitmap != null) { int orientation = getCaptureOrientation(); if (orientation >= 180) { // We need to flip the drawable to compensate mReview.setImageDrawable(new FlipBitmapDrawable( mActivity.getResources(), bitmap)); } else { mReview.setImageBitmap(bitmap); } } mGLRootView.setVisibility(View.GONE); mCaptureLayout.setVisibility(View.GONE); mReviewLayout.setVisibility(View.VISIBLE); } private Uri savePanorama(byte[] jpegData, int width, int height, int orientation) { if (jpegData != null) { String filename = PanoUtil.createName( mActivity.getResources().getString(R.string.pano_file_name_format), mTimeTaken); Uri uri = Storage.addImage(mContentResolver, filename, mTimeTaken, null, orientation, jpegData, width, height); if (uri != null) { String filepath = Storage.generateFilepath(filename); try { ExifInterface exif = new ExifInterface(filepath); exif.setAttribute(ExifInterface.TAG_GPS_DATESTAMP, mGPSDateStampFormat.format(mTimeTaken)); exif.setAttribute(ExifInterface.TAG_GPS_TIMESTAMP, mGPSTimeStampFormat.format(mTimeTaken)); exif.setAttribute(ExifInterface.TAG_DATETIME, mDateTimeStampFormat.format(mTimeTaken)); exif.setAttribute(ExifInterface.TAG_ORIENTATION, getExifOrientation(orientation)); exif.saveAttributes(); } catch (IOException e) { Log.e(TAG, "Cannot set EXIF for " + filepath, e); } } return uri; } return null; } private static String getExifOrientation(int orientation) { switch (orientation) { case 0: return String.valueOf(ExifInterface.ORIENTATION_NORMAL); case 90: return String.valueOf(ExifInterface.ORIENTATION_ROTATE_90); case 180: return String.valueOf(ExifInterface.ORIENTATION_ROTATE_180); case 270: return String.valueOf(ExifInterface.ORIENTATION_ROTATE_270); default: throw new AssertionError("invalid: " + orientation); } } private void clearMosaicFrameProcessorIfNeeded() { if (!mPaused || mThreadRunning) return; // Only clear the processor if it is initialized by this activity // instance. Other activity instances may be using it. if (mMosaicFrameProcessorInitialized) { mMosaicFrameProcessor.clear(); mMosaicFrameProcessorInitialized = false; } } private void initMosaicFrameProcessorIfNeeded() { if (mPaused || mThreadRunning) return; mMosaicFrameProcessor.initialize( mPreviewWidth, mPreviewHeight, getPreviewBufSize()); mMosaicFrameProcessorInitialized = true; } @Override public void onPauseBeforeSuper() { mPaused = true; } @Override public void onPauseAfterSuper() { mOrientationEventListener.disable(); if (mCameraDevice == null) { // Camera open failed. Nothing should be done here. return; } // Stop the capturing first. if (mCaptureState == CAPTURE_STATE_MOSAIC) { stopCapture(true); reset(); } releaseCamera(); mCameraTexture = null; // The preview renderer might not have a chance to be initialized before // onPause(). if (mMosaicPreviewRenderer != null) { mMosaicPreviewRenderer.release(); mMosaicPreviewRenderer = null; } clearMosaicFrameProcessorIfNeeded(); if (mWaitProcessorTask != null) { mWaitProcessorTask.cancel(true); mWaitProcessorTask = null; } resetScreenOn(); if (mSoundPlayer != null) { mSoundPlayer.release(); mSoundPlayer = null; } CameraScreenNail screenNail = (CameraScreenNail) mActivity.mCameraScreenNail; if (screenNail.getSurfaceTexture() != null) { screenNail.releaseSurfaceTexture(); } System.gc(); } @Override public void onConfigurationChanged(Configuration newConfig) { Drawable lowResReview = null; if (mThreadRunning) lowResReview = mReview.getDrawable(); // Change layout in response to configuration change mCaptureLayout.setOrientation( newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); mCaptureLayout.removeAllViews(); LayoutInflater inflater = mActivity.getLayoutInflater(); inflater.inflate(R.layout.preview_frame_pano, mCaptureLayout); mPanoLayout.removeView(mReviewLayout); inflater.inflate(R.layout.pano_review, mPanoLayout); setViews(mActivity.getResources()); if (mThreadRunning) { mReview.setImageDrawable(lowResReview); mCaptureLayout.setVisibility(View.GONE); mReviewLayout.setVisibility(View.VISIBLE); } } @Override public void onOrientationChanged(int orientation) { } @Override public void onResumeBeforeSuper() { mPaused = false; } @Override public void onResumeAfterSuper() { mOrientationEventListener.enable(); mCaptureState = CAPTURE_STATE_VIEWFINDER; try { setupCamera(); } catch (CameraHardwareException e) { Util.showErrorAndFinish(mActivity, R.string.cannot_connect_camera); return; } catch (CameraDisabledException e) { Util.showErrorAndFinish(mActivity, R.string.camera_disabled); return; } // Set up sound playback for shutter button mSoundPlayer = SoundClips.getPlayer(mActivity); // Check if another panorama instance is using the mosaic frame processor. mRotateDialog.dismissDialog(); if (!mThreadRunning && mMosaicFrameProcessor.isMosaicMemoryAllocated()) { mGLRootView.setVisibility(View.GONE); mRotateDialog.showWaitingDialog(mDialogWaitingPreviousString); // If stitching is still going on, make sure switcher and shutter button // are not showing mActivity.hideUI(); mWaitProcessorTask = new WaitProcessorTask().execute(); } else { if (!mThreadRunning) mGLRootView.setVisibility(View.VISIBLE); // Camera must be initialized before MosaicFrameProcessor is // initialized. The preview size has to be decided by camera device. initMosaicFrameProcessorIfNeeded(); int w = mPreviewArea.getWidth(); int h = mPreviewArea.getHeight(); if (w != 0 && h != 0) { // The layout has been calculated. configMosaicPreview(w, h); } } keepScreenOnAwhile(); // Dismiss open menu if exists. PopupManager.getInstance(mActivity).notifyShowPopup(null); mRootView.requestLayout(); } /** * Generate the final mosaic image. * * @param highRes flag to indicate whether we want to get a high-res version. * @return a MosaicJpeg with its isValid flag set to true if successful; null if the generation * process is cancelled; and a MosaicJpeg with its isValid flag set to false if there * is an error in generating the final mosaic. */ public MosaicJpeg generateFinalMosaic(boolean highRes) { int mosaicReturnCode = mMosaicFrameProcessor.createMosaic(highRes); if (mosaicReturnCode == Mosaic.MOSAIC_RET_CANCELLED) { return null; } else if (mosaicReturnCode == Mosaic.MOSAIC_RET_ERROR) { return new MosaicJpeg(); } byte[] imageData = mMosaicFrameProcessor.getFinalMosaicNV21(); if (imageData == null) { Log.e(TAG, "getFinalMosaicNV21() returned null."); return new MosaicJpeg(); } int len = imageData.length - 8; int width = (imageData[len + 0] << 24) + ((imageData[len + 1] & 0xFF) << 16) + ((imageData[len + 2] & 0xFF) << 8) + (imageData[len + 3] & 0xFF); int height = (imageData[len + 4] << 24) + ((imageData[len + 5] & 0xFF) << 16) + ((imageData[len + 6] & 0xFF) << 8) + (imageData[len + 7] & 0xFF); Log.v(TAG, "ImLength = " + (len) + ", W = " + width + ", H = " + height); if (width <= 0 || height <= 0) { // TODO: pop up an error message indicating that the final result is not generated. Log.e(TAG, "width|height <= 0!!, len = " + (len) + ", W = " + width + ", H = " + height); return new MosaicJpeg(); } YuvImage yuvimage = new YuvImage(imageData, ImageFormat.NV21, width, height, null); ByteArrayOutputStream out = new ByteArrayOutputStream(); yuvimage.compressToJpeg(new Rect(0, 0, width, height), 100, out); try { out.close(); } catch (Exception e) { Log.e(TAG, "Exception in storing final mosaic", e); return new MosaicJpeg(); } return new MosaicJpeg(out.toByteArray(), width, height); } private void startCameraPreview() { if (mCameraDevice == null) { // Camera open failed. Return. return; } // This works around a driver issue. startPreview may fail if // stopPreview/setPreviewTexture/startPreview are called several times // in a row. mCameraTexture can be null after pressing home during // mosaic generation and coming back. Preview will be started later in // onLayoutChange->configMosaicPreview. This also reduces the latency. if (mCameraTexture == null) return; // If we're previewing already, stop the preview first (this will blank // the screen). if (mCameraState != PREVIEW_STOPPED) stopCameraPreview(); // Set the display orientation to 0, so that the underlying mosaic library // can always get undistorted mPreviewWidth x mPreviewHeight image data // from SurfaceTexture. mCameraDevice.setDisplayOrientation(0); if (mCameraTexture != null) mCameraTexture.setOnFrameAvailableListener(this); mCameraDevice.setPreviewTextureAsync(mCameraTexture); mCameraDevice.startPreviewAsync(); mCameraState = PREVIEW_ACTIVE; } private void stopCameraPreview() { if (mCameraDevice != null && mCameraState != PREVIEW_STOPPED) { Log.v(TAG, "stopPreview"); mCameraDevice.stopPreview(); } mCameraState = PREVIEW_STOPPED; } @Override public void onUserInteraction() { if (mCaptureState != CAPTURE_STATE_MOSAIC) keepScreenOnAwhile(); } @Override public boolean onBackPressed() { // If panorama is generating low res or high res mosaic, ignore back // key. So the activity will not be destroyed. if (mThreadRunning) return true; return false; } private void resetScreenOn() { mMainHandler.removeMessages(MSG_CLEAR_SCREEN_DELAY); mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } private void keepScreenOnAwhile() { mMainHandler.removeMessages(MSG_CLEAR_SCREEN_DELAY); mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mMainHandler.sendEmptyMessageDelayed(MSG_CLEAR_SCREEN_DELAY, SCREEN_DELAY); } private void keepScreenOn() { mMainHandler.removeMessages(MSG_CLEAR_SCREEN_DELAY); mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } private class WaitProcessorTask extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... params) { synchronized (mMosaicFrameProcessor) { while (!isCancelled() && mMosaicFrameProcessor.isMosaicMemoryAllocated()) { try { mMosaicFrameProcessor.wait(); } catch (Exception e) { // ignore } } } return null; } @Override protected void onPostExecute(Void result) { mWaitProcessorTask = null; mRotateDialog.dismissDialog(); mGLRootView.setVisibility(View.VISIBLE); initMosaicFrameProcessorIfNeeded(); int w = mPreviewArea.getWidth(); int h = mPreviewArea.getHeight(); if (w != 0 && h != 0) { // The layout has been calculated. configMosaicPreview(w, h); } resetToPreview(); } } @Override public void onFullScreenChanged(boolean full) { } @Override public void onStop() { } @Override public void installIntentFilter() { } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return false; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { return false; } @Override public void onSingleTapUp(View view, int x, int y) { } @Override public void onPreviewTextureCopied() { } @Override public void onCaptureTextureCopied() { } @Override public boolean updateStorageHintOnResume() { return false; } @Override public void updateCameraAppView() { } @Override public boolean collapseCameraControls() { return false; } @Override public boolean needsSwitcher() { return true; } @Override public void onShowSwitcherPopup() { } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
8f47877909598a14eaf038ae3544e2174bf06938
b4420eef1cb3289449cbcd52f98aa618332e53cf
/office/src/main/java/com/hunglv/office/fc/xls/Reader/shared/ThemeColorReader.java
d54d7e777a6b267d838c188b3a89399437b05785
[]
no_license
hunglvv/TestDocument
941a3bd9560ef3bef9a93eab70964a04cc03e620
d1cdce4c61377f0118440138acb7f0bf3f3d4b6d
refs/heads/main
2023-03-11T12:33:50.022945
2021-03-02T10:33:31
2021-03-02T10:33:31
342,557,038
0
0
null
null
null
null
UTF-8
Java
false
false
5,560
java
/* * 文件名称: Theme.java * * 编译器: android2.2 * 时间: 上午9:36:17 */ package com.hunglv.office.fc.xls.Reader.shared; import java.io.InputStream; import com.hunglv.office.constant.SchemeClrConstant; import com.hunglv.office.fc.dom4j.Document; import com.hunglv.office.fc.dom4j.Element; import com.hunglv.office.fc.dom4j.io.SAXReader; import com.hunglv.office.fc.openxml4j.opc.PackagePart; import com.hunglv.office.ss.model.baseModel.Workbook; import android.graphics.Color; /** * TODO: 文件注释 * <p> * <p> * Read版本: Read V1.0 * <p> * 作者: jqin * <p> * 日期: 2012-2-23 * <p> * 负责人: jqin * <p> * 负责小组: * <p> * <p> */ public class ThemeColorReader { private static ThemeColorReader reader = new ThemeColorReader(); /** * */ public static ThemeColorReader instance() { return reader; } /** * read theme color and add it to workbook * @param themeParts * @param book * @return theme color index */ public void getThemeColor(PackagePart themeParts, Workbook book) throws Exception { SAXReader saxreader = new SAXReader(); InputStream in = themeParts.getInputStream(); Document poiTheme = saxreader.read(in); in.close(); // Element root = poiTheme.getRootElement(); //theme elements Element themeElements = root.element("themeElements"); //theme color Element themeColorElement = themeElements.element("clrScheme"); Element ele = themeColorElement.element(SchemeClrConstant.SCHEME_LT1); int color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_LT1, color); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_BG1, color); //put theme index book.addThemeColorIndex(0, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_DK1); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_DK1, color); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_TX1, color); book.addThemeColorIndex(1, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_LT2); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_LT2, color); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_BG2, color); book.addThemeColorIndex(2, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_DK2); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_DK2, color); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_TX2, color); book.addThemeColorIndex(3, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT1); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT1, color); book.addThemeColorIndex(4, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT2); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT2, color); book.addThemeColorIndex(5, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT3); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT3, color); book.addThemeColorIndex(6, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT4); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT4, color); book.addThemeColorIndex(7, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT5); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT5, color); book.addThemeColorIndex(8, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_ACCENT6); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_ACCENT6, color); book.addThemeColorIndex(9, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_HLINK); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_HLINK, color); book.addThemeColorIndex(10, color); ele = themeColorElement.element(SchemeClrConstant.SCHEME_FOLHLINK); color = getColorIndex(ele, book); book.addSchemeColorIndex(SchemeClrConstant.SCHEME_FOLHLINK, color); book.addThemeColorIndex(11, color); } private int getColorIndex(Element colorEle, Workbook book) { //rgb int color = Color.BLACK; if(colorEle.element("srgbClr") != null) { color = Integer.parseInt(colorEle.element("srgbClr").attributeValue("val"), 16); } else if(colorEle.element("sysClr") != null) { color = Integer.parseInt(colorEle.element("sysClr").attributeValue("lastClr"), 16); } //rgb composed with alpha color = color | (0xFF << 24); color = book.addColor(color); return color; } }
[ "hunglv@solarapp.asia" ]
hunglv@solarapp.asia
e8e9c8f5cdc718e56b1c9d589c191d9833a9176e
01e7076c3f4435fbf623196a07ba2ffae2652255
/src/ec/edu/ups/entidades/OrdenMedica.java
0ef66a978602c94257132a4c4fdee7164144386e
[]
no_license
Juancarlos56/ProyectoIngSoftware-CitasMedicas
eee959ebc9e07148b6a66ab76e4f660fa9a66d53
2f7df6e752879d40f4de332c71c020c77e2972e7
refs/heads/master
2023-02-27T07:13:56.973966
2021-02-05T07:20:48
2021-02-05T07:20:48
336,152,362
0
0
null
null
null
null
UTF-8
Java
false
false
4,579
java
package ec.edu.ups.entidades; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import javax.persistence.*; /** * Entity implementation class for Entity: Orden * */ @Entity public class OrdenMedica implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "idOrdenMedica") private int idOrdenMedica; @Column(name="descripcionOrdenMedica", length=20, nullable=false) private String descripcion; @Column(name="diagnosticoOrdenMedica", length=20, nullable=false) private String diagnostico; @Temporal(TemporalType.DATE) @Column(name="fechaOrdenMedica", length=20, nullable=false) private Calendar fechaOrdenMedica; @ManyToOne @JoinColumn(name = "FK_OrdenMedica_Consulta") private Consulta ordenesMedicasDeUnaConsulta; public OrdenMedica() { super(); } public OrdenMedica(String descripcion, String diagnostico, Calendar fechaOrdenMedica) { super(); this.descripcion = descripcion; this.diagnostico = diagnostico; this.fechaOrdenMedica = fechaOrdenMedica; } public OrdenMedica(int idOrdenMedica, String descripcion, String diagnostico, Calendar fechaOrdenMedica, Consulta ordenesMedicasDeUnaConsulta) { super(); this.idOrdenMedica = idOrdenMedica; this.descripcion = descripcion; this.diagnostico = diagnostico; this.fechaOrdenMedica = fechaOrdenMedica; this.ordenesMedicasDeUnaConsulta = ordenesMedicasDeUnaConsulta; } //Constructor para orden medica sin codigo por autogeneracion public OrdenMedica(String descripcion, String diagnostico, Calendar fechaOrdenMedica, Consulta ordenesMedicasDeUnaConsulta) { super(); this.descripcion = descripcion; this.diagnostico = diagnostico; this.fechaOrdenMedica = fechaOrdenMedica; this.ordenesMedicasDeUnaConsulta = ordenesMedicasDeUnaConsulta; } public int getIdOrdenMedica() { return idOrdenMedica; } public void setIdOrdenMedica(int idOrdenMedica) { this.idOrdenMedica = idOrdenMedica; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public String getDiagnostico() { return diagnostico; } public void setDiagnostico(String diagnostico) { this.diagnostico = diagnostico; } public Calendar getFechaOrdenMedica() { return fechaOrdenMedica; } public void setFechaOrdenMedica(Calendar fechaOrdenMedica) { this.fechaOrdenMedica = fechaOrdenMedica; } public Consulta getOrdenesMedicasDeUnaConsulta() { return ordenesMedicasDeUnaConsulta; } public void setOrdenesMedicasDeUnaConsulta(Consulta ordenesMedicasDeUnaConsulta) { this.ordenesMedicasDeUnaConsulta = ordenesMedicasDeUnaConsulta; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((descripcion == null) ? 0 : descripcion.hashCode()); result = prime * result + ((diagnostico == null) ? 0 : diagnostico.hashCode()); result = prime * result + ((fechaOrdenMedica == null) ? 0 : fechaOrdenMedica.hashCode()); result = prime * result + idOrdenMedica; result = prime * result + ((ordenesMedicasDeUnaConsulta == null) ? 0 : ordenesMedicasDeUnaConsulta.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; OrdenMedica other = (OrdenMedica) obj; if (descripcion == null) { if (other.descripcion != null) return false; } else if (!descripcion.equals(other.descripcion)) return false; if (diagnostico == null) { if (other.diagnostico != null) return false; } else if (!diagnostico.equals(other.diagnostico)) return false; if (fechaOrdenMedica == null) { if (other.fechaOrdenMedica != null) return false; } else if (!fechaOrdenMedica.equals(other.fechaOrdenMedica)) return false; if (idOrdenMedica != other.idOrdenMedica) return false; if (ordenesMedicasDeUnaConsulta == null) { if (other.ordenesMedicasDeUnaConsulta != null) return false; } else if (!ordenesMedicasDeUnaConsulta.equals(other.ordenesMedicasDeUnaConsulta)) return false; return true; } @Override public String toString() { return "OrdenMedica [idOrdenMedica=" + idOrdenMedica + ", descripcion=" + descripcion + ", diagnostico=" + diagnostico + ", fechaOrdenMedica=" + fechaOrdenMedica + ", ordenesMedicasDeUnaConsulta=" + ordenesMedicasDeUnaConsulta + "]"; } }
[ "51795550+Juancarlos56@users.noreply.github.com" ]
51795550+Juancarlos56@users.noreply.github.com
7460aac7100a5265cf6e35d77e0227d66c3c3676
083744c6ef6f16e8322e816f736954657692fcc8
/SrcServer/FCBlockTorchBaseBurning.java
2e3be5ab57cb5dbd2ba93e8c92c45b99ec7bd6d0
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sargunv/better-than-wolves
0d45c5fac6e47b675bfa1c3b86431b69cc69337b
a1bb40f58d5e052a38e3c11a4c89d28be508630d
refs/heads/main
2023-04-10T03:23:40.762128
2021-04-11T22:05:21
2021-04-11T22:26:39
356,988,910
1
0
null
null
null
null
UTF-8
Java
false
false
946
java
// FCMOD package net.minecraft.src; import java.util.Random; public class FCBlockTorchBaseBurning extends FCBlockTorchBase { protected FCBlockTorchBaseBurning( int iBlockID ) { super( iBlockID ); } @Override public boolean GetCanBlockLightItemOnFire( IBlockAccess blockAccess, int i, int j, int k ) { return true; } @Override public void OnFluidFlowIntoBlock( World world, int i, int j, int k, BlockFluid newBlock ) { if ( newBlock.blockMaterial == Material.water ) { world.playAuxSFX( FCBetterThanWolves.m_iFireFizzSoundAuxFXID, i, j, k, 0 ); dropBlockAsItem_do( world, i, j, k, new ItemStack( FCBetterThanWolves.fcBlockTorchNetherUnlit.blockID, 1, 0 ) ); } else { super.OnFluidFlowIntoBlock( world, i, j, k, newBlock ); } } //----------- Client Side Functionality -----------// }
[ "sargun.vohra@gmail.com" ]
sargun.vohra@gmail.com
7dc877c4211024a217af797cdf9965ba9db2110a
524bc86bf48205ff48ac3d0c8b04e2fdd7a2ce72
/src/main/java/com/codepuran/sattv/actions/impl/ViewCurrentSubscriptionDetailsAction.java
275b245649b5fc14bca6a31739cbb5c24d711a3e
[]
no_license
pethaniakshay/satTV
9316645950cce4493ef99363fe58236882d2422b
45a2313a56ddead8f17c2d5ba972de031907a3fd
refs/heads/master
2022-04-11T06:13:51.691121
2020-03-17T14:36:30
2020-03-17T14:36:30
216,817,483
0
0
null
null
null
null
UTF-8
Java
false
false
1,938
java
package com.codepuran.sattv.actions.impl; import com.codepuran.sattv.actions.Action; import com.codepuran.sattv.dao.UserDao; import com.codepuran.sattv.models.Channel; import com.codepuran.sattv.models.SpecialService; import com.codepuran.sattv.models.Subscription; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; public class ViewCurrentSubscriptionDetailsAction implements Action { private UserDao userDao; public ViewCurrentSubscriptionDetailsAction(UserDao userDao) { this.userDao = userDao; } @Override public void perform(long userId) { Optional<Subscription> subscriptionOptional = userDao.getSubscriptionByUserId(userId); if (subscriptionOptional.isPresent()) { showResult(subscriptionOptional.get()); } else { System.out.println("You do not have any subscription going on"); } } private void showResult(Subscription subscription) { System.out.println("Currently subscribed packs and channels: "); if (subscription.getPack() != null) { System.out.println("Packs: "); System.out.print(subscription.getPack().getName()); } if (subscription.getChannels() != null) { System.out.println(); System.out.println("Channels: "); Set<Channel> channels = subscription.getChannels(); String commaSeparatedChannel = channels.stream().map(Channel::getName).collect(Collectors.toList()).stream().collect(Collectors.joining(",")); System.out.print(commaSeparatedChannel); } System.out.println(); System.out.println("Currently subscribed services: "); Set<SpecialService> specialServices = subscription.getSpecialServices(); if (specialServices != null) { String commaSeparatedServices = specialServices.stream().map(SpecialService::getName).collect(Collectors.toList()).stream().collect(Collectors.joining(",")); System.out.print(commaSeparatedServices); } } }
[ "patelaksh412@gmail.com" ]
patelaksh412@gmail.com
c3145a4fa4f5090a88bfb9a0a3305493074d92e8
2b02e551b8755423dd3f2370a9ba7bf763d11524
/app/src/main/java/com/weique/overhaul/v2/mvp/model/entity/InformationTypeOneSecondBean.java
63c825d7e8ecb7312d7bb3228338087e36a9ec69
[ "Apache-2.0" ]
permissive
xeon-ye/zongzhi
5fe0357561c30285d9cc3ab9596f4ddb8c82b3ed
bc81e7d769dd6bf057c648ba072fd00e05286d47
refs/heads/main
2023-02-27T07:50:10.706606
2021-02-05T02:45:49
2021-02-05T02:45:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
43,983
java
package com.weique.overhaul.v2.mvp.model.entity; import android.os.Parcel; import android.os.Parcelable; import com.chad.library.adapter.base.entity.AbstractExpandableItem; import com.weique.overhaul.v2.mvp.model.entity.interfaces.NameIdCheckedInterface; import java.util.ArrayList; import java.util.List; /** * 信息采集 下的两种数据 * * @author GreatKing */ public class InformationTypeOneSecondBean { /** * pageCount : 1 * elementTypeList : [{"Id":"9349a65f-14ce-4b77-9a34-45586170e726","Name":"公司信息填报","AnotherName":null,"PinYin":"GSXXTB","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/公司信息填报","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"姓名\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":false,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":1,\"initIdx\":2},\"name\":\"地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"addr\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":2,\"initIdx\":1},\"name\":\"备注\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"memo\"},{\"Identification\":{\"type\":\"SinglePic\",\"index\":3,\"initIdx\":5},\"name\":\"头像上传\",\"isRequired\":true,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false}],\"QueryFields\":[\"name\"],\"FieldsLength\":4,\"initIdx\":12}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"},{"Id":"a3c5b6e6-54c8-4bc6-b713-90e6cdaeb3f8","Name":"关怀对象","AnotherName":null,"PinYin":"GHDX","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/关怀对象","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"姓名\",\"isRequired\":true,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"Identification\":{\"type\":\"SingleLine\",\"index\":1,\"initIdx\":11},\"name\":\"身份证号\",\"isRequired\":false,\"isReveal\":true,\"propertyName\":\"SingleLine11\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":2,\"initIdx\":12},\"name\":\"手机号\",\"propertyName\":\"SingleLine12\",\"isReveal\":true,\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":3,\"initIdx\":2},\"name\":\"户籍地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"addr\"},{\"name\":\"人员类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":4,\"initIdx\":14},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"常住人口\",\"流动人口\",\"寄住人口\"],\"propertyName\":\"DropdownList14\",\"isNew\":false},{\"name\":\"人口类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":5,\"initIdx\":15},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"本地户籍人口\",\"非本地户籍人口\",\"境外来华停居留人员\",\"未落户人员\",\"其他\"],\"propertyName\":\"DropdownList15\",\"isNew\":false},{\"name\":\"性别\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":6,\"initIdx\":16},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"男性\",\"女性\",\"未知性别\"],\"propertyName\":\"DropdownList16\",\"isNew\":false},{\"name\":\"民族\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":7,\"initIdx\":17},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"汉\",\"壮\",\"白\",\"蒙古\",\"回\",\"朝鲜\",\"苗\",\"藏\",\"土\",\"满\"],\"propertyName\":\"DropdownList17\",\"isNew\":false},{\"name\":\"学历\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":8,\"initIdx\":18},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"文盲\",\"学龄前儿童\",\"小学\",\"初中\",\"高中\",\"中专\",\"大专\",\"本科\",\"研究生\",\"硕士\",\"博士\"],\"propertyName\":\"DropdownList18\",\"isNew\":false},{\"name\":\"政治面貌\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":9,\"initIdx\":19},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"群众\",\"团员\",\"党员\",\"其他\"],\"propertyName\":\"DropdownList19\",\"isNew\":false},{\"name\":\"婚姻状况\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":10,\"initIdx\":20},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"已婚\",\"未婚\",\"丧偶\",\"离异\",\"其他\"],\"propertyName\":\"DropdownList20\",\"isNew\":false},{\"name\":\"与房主关系\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":11,\"initIdx\":21},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"本人\",\"配偶\",\"子女\",\"亲属\",\"父子\",\"父女\"],\"propertyName\":\"DropdownList21\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":12,\"initIdx\":1},\"name\":\"备注\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"memo\"},{\"Identification\":{\"type\":\"SinglePic\",\"index\":13,\"initIdx\":5},\"name\":\"封面上传\",\"isRequired\":true,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false},{\"Identification\":{\"type\":\"MultiPics\",\"index\":14,\"initIdx\":22},\"name\":\"图片上传\",\"maxLength\":10,\"isReveal\":true,\"propertyName\":\"MultiPics22\",\"isNew\":false}],\"QueryFields\":[\"name\"],\"FieldsLength\":15,\"initIdx\":22}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"},{"Id":"4a37f9a2-bd64-4c97-a368-495fddd195ff","Name":"人员","AnotherName":null,"PinYin":"RY","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/人员","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"姓名\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":1,\"initIdx\":2},\"name\":\"身份证号码\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":false,\"partition\":false,\"propertyName\":\"addr\"},{\"name\":\"出生日期\",\"isRequired\":false,\"defaultTime\":\"2020-2-18\",\"isReveal\":false,\"partition\":false,\"IsDisabled\":false,\"Identification\":{\"type\":\"DateTime\",\"index\":2,\"initIdx\":14},\"propertyName\":\"DateTime14\",\"isNew\":false},{\"Identification\":{\"type\":\"Number\",\"index\":3,\"initIdx\":15},\"name\":\"联系方式\",\"isRequired\":true,\"placeholder\":\"\",\"defaultVal\":\"\",\"isReveal\":false,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"Number15\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":4,\"initIdx\":1},\"name\":\"户籍地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":false,\"partition\":false,\"propertyName\":\"memo\"},{\"name\":\"人员类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":5,\"initIdx\":16},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"常驻人口\",\"流动人口\",\"寄住人口\"],\"propertyName\":\"DropdownList16\",\"isNew\":false},{\"name\":\"性别\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":6,\"initIdx\":17},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"男\",\"女\",\"未知性别\"],\"propertyName\":\"DropdownList17\",\"isNew\":false},{\"name\":\"民族\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":7,\"initIdx\":18},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"汉\",\"壮\",\"朝鲜\",\"满\",\"白\",\"苗\",\"蒙古\",\"藏\"],\"propertyName\":\"DropdownList18\",\"isNew\":false},{\"name\":\"学历\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":8,\"initIdx\":19},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"学龄前儿童\",\"小学\",\"初中\",\"高中\",\"中专\",\"大专\",\"本科\",\"研究生\",\"硕士\",\"博士\",\"文盲\"],\"propertyName\":\"DropdownList19\",\"isNew\":false},{\"name\":\"政治面貌\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":9,\"initIdx\":20},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"群众\",\"团员\",\"党员\",\"其他\"],\"propertyName\":\"DropdownList20\",\"isNew\":false},{\"name\":\"婚姻状态\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":10,\"initIdx\":21},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"已婚\",\"未婚\",\"丧偶\",\"离异\",\"其他\"],\"propertyName\":\"DropdownList21\",\"isNew\":false},{\"name\":\"与户主关系\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":11,\"initIdx\":22},\"partition\":false,\"IsDisabled\":false,\"isReveal\":false,\"listType\":\"0\",\"option\":[\"本人\",\"配偶\",\"子女\",\"亲属\"],\"propertyName\":\"DropdownList22\",\"isNew\":false},{\"Identification\":{\"type\":\"SinglePic\",\"index\":12,\"initIdx\":5},\"name\":\"封面上传\",\"isRequired\":true,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false}],\"QueryFields\":[\"name\"],\"FieldsLength\":13,\"initIdx\":23}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"},{"Id":"9118f6f5-bc82-4e3d-b784-53fbcd02c0d6","Name":"实有人口","AnotherName":null,"PinYin":"SYRK","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/实有人口","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"名称\",\"isRequired\":true,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":1,\"initIdx\":1},\"name\":\"备注\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"memo\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":2,\"initIdx\":2},\"name\":\"地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"addr\"},{\"Identification\":{\"type\":\"SinglePic\",\"index\":3,\"initIdx\":5},\"name\":\"封面上传\",\"isRequired\":true,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false}],\"QueryFields\":[\"name\"],\"FieldsLength\":4,\"initIdx\":7}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"},{"Id":"44191d09-c56f-4f67-9d3a-38361782ef51","Name":"特殊人群","AnotherName":null,"PinYin":"TSRQ","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/特殊人群","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"姓名\",\"isRequired\":true,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"Identification\":{\"type\":\"SingleLine\",\"index\":1,\"initIdx\":9},\"name\":\"身份证号\",\"propertyName\":\"SingleLine9\",\"isReveal\":true,\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":2,\"initIdx\":10},\"name\":\"手机号\",\"propertyName\":\"SingleLine10\",\"isReveal\":true,\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":3,\"initIdx\":2},\"name\":\"户籍地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"addr\"},{\"name\":\"人员类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":4,\"initIdx\":11},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"常住人口\",\"流动人口\",\"寄住人口\"],\"propertyName\":\"DropdownList11\",\"isNew\":false},{\"name\":\"人口类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":5,\"initIdx\":12},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"本地户籍人口\",\"非本地户籍人口\",\"未落户人员\",\"境外来华停居留人员\",\"其他\"],\"propertyName\":\"DropdownList12\",\"isNew\":false},{\"name\":\"性别\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":6,\"initIdx\":13},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"男性\",\"女性\",\"未知性别\"],\"propertyName\":\"DropdownList13\",\"isNew\":false},{\"name\":\"民族\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":7,\"initIdx\":14},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"汉\",\"壮\",\"藏\",\"回\",\"土\",\"朝鲜\",\"苗\",\"满\",\"白\",\"蒙古\"],\"propertyName\":\"DropdownList14\",\"isNew\":false},{\"name\":\"学历\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":8,\"initIdx\":15},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"学龄前儿童\",\"小学\",\"初中\",\"高中\",\"中专\",\"大专\",\"本科\",\"研究生\",\"硕士\",\"博士\",\"文盲\"],\"propertyName\":\"DropdownList15\",\"isNew\":false},{\"name\":\"政治面貌\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":9,\"initIdx\":16},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"群众\",\"团员\",\"党员\",\"其他\"],\"propertyName\":\"DropdownList16\",\"isNew\":false},{\"name\":\"婚姻状况\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":10,\"initIdx\":17},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"已婚\",\"未婚\",\"丧偶\",\"离异\",\"其他\"],\"propertyName\":\"DropdownList17\",\"isNew\":false},{\"name\":\"与房主关系\",\"isRequired\":true,\"Identification\":{\"type\":\"DropdownList\",\"index\":11,\"initIdx\":18},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"本人\",\"配偶\",\"子女\",\"亲属\",\"父子\",\"父女\"],\"propertyName\":\"DropdownList18\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":12,\"initIdx\":1},\"name\":\"备注\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"memo\"},{\"Identification\":{\"type\":\"SinglePic\",\"index\":13,\"initIdx\":5},\"name\":\"封面上传\",\"isRequired\":true,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false}],\"QueryFields\":[\"name\"],\"FieldsLength\":14,\"initIdx\":19}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"},{"Id":"7a23ba63-c564-4bff-a2ff-d058a188b362","Name":"疫情人口","AnotherName":null,"PinYin":"YQRK","PId":"4fab2017-2a13-4bbf-8147-d6d8bbbcdc09","FullPath":"全部分类/人/疫情人口","Level":2,"DataStructureInJson":"{\"StructureInJson\":[{\"Identification\":{\"type\":\"SingleLine\",\"index\":0,\"initIdx\":0},\"name\":\"姓名\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":false,\"placeholder\":\"请输入内容\",\"isQueryField\":true,\"partition\":false,\"propertyName\":\"name\"},{\"name\":\"性别\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":1,\"initIdx\":13},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"男\",\"女\",\"未知性别\"],\"propertyName\":\"DropdownList13\",\"isNew\":false},{\"Identification\":{\"type\":\"Number\",\"index\":2,\"initIdx\":14},\"name\":\"年龄\",\"isRequired\":true,\"placeholder\":\"\",\"defaultVal\":\"\",\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"Number14\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":3,\"initIdx\":15},\"name\":\"身份证号码\",\"isRequired\":true,\"placeholder\":\"\",\"isQueryField\":true,\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"SingleLine15\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":4,\"initIdx\":2},\"name\":\"现住地址\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"addr\"},{\"Identification\":{\"type\":\"MultiLine\",\"index\":5,\"initIdx\":18},\"name\":\"户籍地\",\"isRequired\":false,\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"MultiLine18\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":6,\"initIdx\":19},\"name\":\"联系电话\",\"isRequired\":false,\"placeholder\":\"\",\"isQueryField\":false,\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"SingleLine19\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":7,\"initIdx\":20},\"name\":\"外出地点1\",\"propertyName\":\"MultiLine20\",\"isReveal\":true,\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":8,\"initIdx\":21},\"name\":\"外出地点2\",\"isReveal\":true,\"propertyName\":\"MultiLine21\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":9,\"initIdx\":22},\"name\":\"外出地点3\",\"isReveal\":true,\"propertyName\":\"MultiLine22\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":10,\"initIdx\":23},\"name\":\"交通工具(车次、路线)\",\"isRequired\":false,\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"MultiLine23\",\"isNew\":false},{\"name\":\"返徐日期\",\"isRequired\":false,\"defaultTime\":\"2020-2-3\",\"isReveal\":true,\"partition\":false,\"IsDisabled\":false,\"Identification\":{\"type\":\"DateTime\",\"index\":11,\"initIdx\":24},\"propertyName\":\"DateTime24\",\"isNew\":false},{\"Identification\":{\"type\":\"Number\",\"index\":12,\"initIdx\":25},\"name\":\"体温\",\"isRequired\":true,\"placeholder\":\"\",\"defaultVal\":\"\",\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"Number25\",\"isNew\":false},{\"name\":\"有无不适(发热、干咳)\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":13,\"initIdx\":26},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"无\",\"有\"],\"propertyName\":\"DropdownList26\",\"isNew\":false},{\"name\":\"人员类型\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":14,\"initIdx\":27},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"常住人口\",\"流动人口\",\"寄住人口\"],\"propertyName\":\"DropdownList27\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":15,\"initIdx\":28},\"name\":\"接触感染者姓名\",\"isRequired\":false,\"placeholder\":\"\",\"isQueryField\":false,\"isReveal\":true,\"partition\":false,\"encryption\":false,\"IsDisabled\":false,\"propertyName\":\"SingleLine28\",\"isNew\":false},{\"name\":\"解除观察\",\"isRequired\":false,\"Identification\":{\"type\":\"DropdownList\",\"index\":16,\"initIdx\":29},\"partition\":false,\"IsDisabled\":false,\"isReveal\":true,\"listType\":\"0\",\"option\":[\"是\",\"否\"],\"propertyName\":\"DropdownList29\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":17,\"initIdx\":30},\"name\":\"网格员姓名\",\"isReveal\":true,\"propertyName\":\"SingleLine30\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":18,\"initIdx\":31},\"name\":\"网格员电话\",\"isReveal\":true,\"propertyName\":\"SingleLine31\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":19,\"initIdx\":32},\"name\":\"办事处责任人姓名\",\"isReveal\":true,\"propertyName\":\"SingleLine32\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":20,\"initIdx\":33},\"name\":\"办事处责任人电话\",\"isReveal\":true,\"propertyName\":\"SingleLine33\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":21,\"initIdx\":34},\"name\":\"社区责任人姓名\",\"isReveal\":true,\"propertyName\":\"SingleLine34\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":22,\"initIdx\":35},\"name\":\"社区责任人电话\",\"propertyName\":\"SingleLine35\",\"isReveal\":true,\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":23,\"initIdx\":36},\"name\":\"责任民警姓名\",\"isReveal\":true,\"propertyName\":\"SingleLine36\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":24,\"initIdx\":37},\"name\":\"责任民警电话\",\"isReveal\":true,\"propertyName\":\"SingleLine37\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":25,\"initIdx\":38},\"name\":\"医生姓名\",\"isReveal\":true,\"propertyName\":\"SingleLine38\",\"isNew\":false},{\"Identification\":{\"type\":\"SingleLine\",\"index\":26,\"initIdx\":39},\"name\":\"医生电话\",\"isReveal\":true,\"propertyName\":\"SingleLine39\",\"isNew\":false},{\"Identification\":{\"type\":\"MultiLine\",\"index\":27,\"initIdx\":1},\"name\":\"备注\",\"isRequired\":false,\"encryption\":false,\"isNew\":false,\"isReveal\":true,\"partition\":false,\"propertyName\":\"memo\"},{\"Identification\":{\"type\":\"MultiPics\",\"index\":28,\"initIdx\":16},\"name\":\"照片\",\"isReveal\":true,\"maxLength\":5,\"propertyName\":\"MultiPics16\",\"isNew\":false},{\"Identification\":{\"type\":\"SinglePic\",\"index\":29,\"initIdx\":5},\"name\":\"封面上传\",\"isRequired\":false,\"partition\":false,\"default\":\"\",\"propertyName\":\"cover\",\"maxLength\":1,\"isNew\":false}],\"QueryFields\":[\"name\",\"SingleLine15\"],\"FieldsLength\":30,\"initIdx\":40}","ElementTypeIconURL":"/img/DefaultElementTypeIconURL.png","EnumElementProcType":0,"DefaultElementTypeGISIconUrl":"/img/GISIcon/DefaultElementTypeGISIcon.png"}] * elementList : [] */ private int pageCount; private int count; /** * 0 无 * 1 走访 * 2 巡检 */ private int type; public int getType() { return type; } public void setType(int type) { this.type = type; } private List<ElementTypeListBean> elementTypeList; private List<ElementListBean> elementList; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getPageCount() { return pageCount; } public void setPageCount(int pageCount) { this.pageCount = pageCount; } public List<ElementTypeListBean> getElementTypeList() { return elementTypeList; } public void setElementTypeList(List<ElementTypeListBean> elementTypeList) { this.elementTypeList = elementTypeList; } public List<ElementListBean> getElementList() { return elementList; } public void setElementList(List<ElementListBean> elementList) { this.elementList = elementList; } public static class ElementTypeListBean extends AbstractExpandableItem<ElementTypeListBean> implements Parcelable { /** * Name : 人 * PinYin : R * PId : 290abbf0-1517-4f1c-9e1f-7a38d82f0866 * FullPath : 全部分类/人 * Level : 1 * DataStructureInJson : {"StructureInJson":[{"Identification":{"type":"SingleLine","index":0},"name":"名称","isRequired":true,"isNew":false,"isReveal":true,"placeholder":"请输入内容","isQueryField":true,"partition":false,"propertyName":"name"},{"Identification":{"type":"MultiLine","index":1},"name":"备注","isRequired":false,"isNew":false,"isReveal":true,"partition":false,"propertyName":"memo"},{"Identification":{"type":"MultiLine","index":2},"name":"地址","isRequired":false,"isNew":false,"isReveal":true,"partition":false,"propertyName":"address"},{"Identification":{"type":"Option","index":3},"name":"性别","isRequired":true,"partition":false,"option":["男","女"],"propertyName":"Option3","isNew":false}],"QueryFields":["name"],"FieldsLength":4} * IsEnabled : true * EnumElementTypeSaveStatus : 1 * ElementTypeIconURL : /img/DefaultElementTypeIconURL.svg * EnumElementProcType : 0 * DBTableNameAlias : ctable_R * DBTableName : ctable_R_0 * MenuId : 63ee5940-0fb9-400c-a98f-0c372dbd4995 * InsertSql : null * DefaultElementTypeGISIconUrl : /Uploads/CustomerData/image/ren.png * Id : 89c6a8d0-1118-4a4e-a0d4-1ee4f59e5c22 * CreateUserId : 88a24b03-7a8b-440d-89e8-7595af7b3106 * UpdateUserId : 88a24b03-7a8b-440d-89e8-7595af7b3106 * CreateTime : /Date(1574750960350)/ * UpdateTime : /Date(1574750960350)/ * Memo : null * IsDeleted : false * DeletedTime : null */ private String Name; private String PinYin; private String AnotherName; private String PId; private String FullPath; private int Level; private String DataStructureInJson; private boolean IsEnabled; private int EnumElementTypeSaveStatus; private String ElementTypeIconURL; private int EnumElementProcType; private String DBTableNameAlias; private String DBTableName; private String MenuId; private String InsertSql; private String DefaultElementTypeGISIconUrl; private String Id; private String CreateUserId; private String UpdateUserId; private String CreateTime; private String UpdateTime; private String Memo; private boolean IsDeleted; private boolean IsLeaf; private String DeletedTime; private boolean HasResourece; private String Count; public String getCount() { return Count; } public void setCount(String count) { this.Count = count; } private List<ElementTypeListBean> lists; public boolean isExpand() { return super.isExpanded(); } public void setExpand(boolean expand) { super.setExpanded(expand); } public String getAnotherName() { return AnotherName; } public void setAnotherName(String anotherName) { AnotherName = anotherName; } public String getName() { return Name; } public void setName(String Name) { this.Name = Name; } public String getPinYin() { return PinYin; } public void setPinYin(String PinYin) { this.PinYin = PinYin; } public String getPId() { return PId; } public void setPId(String PId) { this.PId = PId; } public String getFullPath() { return FullPath; } public void setFullPath(String FullPath) { this.FullPath = FullPath; } @Override public int getLevel() { return Level; } public void setLevel(int Level) { this.Level = Level; } public String getDataStructureInJson() { return DataStructureInJson; } public void setDataStructureInJson(String DataStructureInJson) { this.DataStructureInJson = DataStructureInJson; } public boolean isIsEnabled() { return IsEnabled; } public void setIsEnabled(boolean IsEnabled) { this.IsEnabled = IsEnabled; } public int getEnumElementTypeSaveStatus() { return EnumElementTypeSaveStatus; } public void setEnumElementTypeSaveStatus(int EnumElementTypeSaveStatus) { this.EnumElementTypeSaveStatus = EnumElementTypeSaveStatus; } public String getElementTypeIconURL() { return ElementTypeIconURL; } public void setElementTypeIconURL(String ElementTypeIconURL) { this.ElementTypeIconURL = ElementTypeIconURL; } public int getEnumElementProcType() { return EnumElementProcType; } public void setEnumElementProcType(int EnumElementProcType) { this.EnumElementProcType = EnumElementProcType; } public String getDBTableNameAlias() { return DBTableNameAlias; } public void setDBTableNameAlias(String DBTableNameAlias) { this.DBTableNameAlias = DBTableNameAlias; } public String getDBTableName() { return DBTableName; } public void setDBTableName(String DBTableName) { this.DBTableName = DBTableName; } public String getMenuId() { return MenuId; } public void setMenuId(String MenuId) { this.MenuId = MenuId; } public String getInsertSql() { return InsertSql; } public void setInsertSql(String InsertSql) { this.InsertSql = InsertSql; } public String getDefaultElementTypeGISIconUrl() { return DefaultElementTypeGISIconUrl; } public void setDefaultElementTypeGISIconUrl(String DefaultElementTypeGISIconUrl) { this.DefaultElementTypeGISIconUrl = DefaultElementTypeGISIconUrl; } public String getId() { return Id; } public void setId(String Id) { this.Id = Id; } public String getCreateUserId() { return CreateUserId; } public void setCreateUserId(String CreateUserId) { this.CreateUserId = CreateUserId; } public String getUpdateUserId() { return UpdateUserId; } public void setUpdateUserId(String UpdateUserId) { this.UpdateUserId = UpdateUserId; } public String getCreateTime() { return CreateTime; } public void setCreateTime(String CreateTime) { this.CreateTime = CreateTime; } public String getUpdateTime() { return UpdateTime; } public void setUpdateTime(String UpdateTime) { this.UpdateTime = UpdateTime; } public String getMemo() { return Memo; } public void setMemo(String Memo) { this.Memo = Memo; } public boolean isIsDeleted() { return IsDeleted; } public void setIsDeleted(boolean IsDeleted) { this.IsDeleted = IsDeleted; } public String getDeletedTime() { return DeletedTime; } public void setDeletedTime(String DeletedTime) { this.DeletedTime = DeletedTime; } public boolean isLeaf() { return IsLeaf; } public void setLeaf(boolean leaf) { IsLeaf = leaf; } public List<ElementTypeListBean> getList() { return super.getSubItems(); } public void setList(List<ElementTypeListBean> list) { super.setSubItems(list); } public boolean isHasResourece() { return HasResourece; } public void setHasResourece(boolean hasResourece) { HasResourece = hasResourece; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.Count); dest.writeString(this.Name); dest.writeString(this.PinYin); dest.writeString(this.AnotherName); dest.writeString(this.PId); dest.writeString(this.FullPath); dest.writeInt(this.Level); dest.writeString(this.DataStructureInJson); dest.writeByte(this.IsEnabled ? (byte) 1 : (byte) 0); dest.writeInt(this.EnumElementTypeSaveStatus); dest.writeString(this.ElementTypeIconURL); dest.writeInt(this.EnumElementProcType); dest.writeString(this.DBTableNameAlias); dest.writeString(this.DBTableName); dest.writeString(this.MenuId); dest.writeString(this.InsertSql); dest.writeString(this.DefaultElementTypeGISIconUrl); dest.writeString(this.Id); dest.writeString(this.CreateUserId); dest.writeString(this.UpdateUserId); dest.writeString(this.CreateTime); dest.writeString(this.UpdateTime); dest.writeString(this.Memo); dest.writeByte(this.IsDeleted ? (byte) 1 : (byte) 0); dest.writeByte(this.IsLeaf ? (byte) 1 : (byte) 0); dest.writeString(this.DeletedTime); dest.writeByte(this.HasResourece ? (byte) 1 : (byte) 0); dest.writeList(this.lists); } public ElementTypeListBean() { } protected ElementTypeListBean(Parcel in) { this.Count = in.readString(); this.Name = in.readString(); this.PinYin = in.readString(); this.AnotherName = in.readString(); this.PId = in.readString(); this.FullPath = in.readString(); this.Level = in.readInt(); this.DataStructureInJson = in.readString(); this.IsEnabled = in.readByte() != 0; this.EnumElementTypeSaveStatus = in.readInt(); this.ElementTypeIconURL = in.readString(); this.EnumElementProcType = in.readInt(); this.DBTableNameAlias = in.readString(); this.DBTableName = in.readString(); this.MenuId = in.readString(); this.InsertSql = in.readString(); this.DefaultElementTypeGISIconUrl = in.readString(); this.Id = in.readString(); this.CreateUserId = in.readString(); this.UpdateUserId = in.readString(); this.CreateTime = in.readString(); this.UpdateTime = in.readString(); this.Memo = in.readString(); this.IsDeleted = in.readByte() != 0; this.IsLeaf = in.readByte() != 0; this.DeletedTime = in.readString(); this.HasResourece = in.readByte() != 0; this.lists = new ArrayList<ElementTypeListBean>(); in.readList(this.lists, ElementTypeListBean.class.getClassLoader()); } public static final Parcelable.Creator<ElementTypeListBean> CREATOR = new Parcelable.Creator<ElementTypeListBean>() { @Override public ElementTypeListBean createFromParcel(Parcel source) { return new ElementTypeListBean(source); } @Override public ElementTypeListBean[] newArray(int size) { return new ElementTypeListBean[size]; } }; } public static class ElementListBean implements Parcelable, NameIdCheckedInterface { /** * Id : 4c18ecd7-7432-4e0e-8302-3b8ec560c87e * DepartmentId : 27a8465b-4c18-47e0-b677-d12e6b414a44 * STANDARDADDRESSID : dfb1a8f6-9c55-4e81-92d9-e8547d3f4718 * ElementTypeId : 4fc63cbc-885a-4286-8f6d-257f81ef595b * name : 小红 * memo : 我不是人 * address : 非洲 * Option3 : 男 * PointsInJson : {"lng":117.188441,"lat":35.30215} * ElementTypeName : 全部分类/人/特殊人群 * FullPath : 鼓楼生态园/18号楼/3单元/801 * RowNum : 1 * total : 10 */ private String Id; private String DepartmentId; private String StandardAddressId; private String ElementTypeId; private String name; private String SingleLine0; private String memo; private String address; private String Option3; private String PointsInJson; private String ElementTypeName; private String FullPath; private int RowNum; private int total; private String RecordTime; private boolean checked = false; public String getRecordTime() { return RecordTime; } public void setRecordTime(String recordTime) { RecordTime = recordTime; } protected ElementListBean(Parcel in) { Id = in.readString(); DepartmentId = in.readString(); StandardAddressId = in.readString(); ElementTypeId = in.readString(); name = in.readString(); SingleLine0 = in.readString(); memo = in.readString(); address = in.readString(); Option3 = in.readString(); PointsInJson = in.readString(); ElementTypeName = in.readString(); FullPath = in.readString(); RowNum = in.readInt(); total = in.readInt(); RecordTime = in.readString(); checked = in.readByte() != 0; } public static final Creator<ElementListBean> CREATOR = new Creator<ElementListBean>() { @Override public ElementListBean createFromParcel(Parcel in) { return new ElementListBean(in); } @Override public ElementListBean[] newArray(int size) { return new ElementListBean[size]; } }; @Override public String getId() { return Id; } public void setId(String Id) { this.Id = Id; } public String getDepartmentId() { return DepartmentId; } public void setDepartmentId(String DepartmentId) { this.DepartmentId = DepartmentId; } public String getStandardAddressId() { return StandardAddressId; } public void setStandardAddressId(String StandardAddressId) { this.StandardAddressId = StandardAddressId; } public String getElementTypeId() { return ElementTypeId; } public void setElementTypeId(String ElementTypeId) { this.ElementTypeId = ElementTypeId; } @Override public String getName() { return name; } @Override public void setChecked(boolean checked) { this.checked = checked; } @Override public boolean getChecked() { return checked; } public void setName(String name) { this.name = name; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getOption3() { return Option3; } public void setOption3(String Option3) { this.Option3 = Option3; } public String getPointsInJson() { return PointsInJson; } public void setPointsInJson(String PointsInJson) { this.PointsInJson = PointsInJson; } public String getElementTypeName() { return ElementTypeName; } public void setElementTypeName(String ElementTypeName) { this.ElementTypeName = ElementTypeName; } public String getFullPath() { return FullPath; } public void setFullPath(String FullPath) { this.FullPath = FullPath; } public int getRowNum() { return RowNum; } public void setRowNum(int RowNum) { this.RowNum = RowNum; } public int getTotal() { return total; } public void setTotal(int total) { this.total = total; } public String getSingleLine0() { return SingleLine0; } public void setSingleLine0(String singleLine0) { SingleLine0 = singleLine0; } /** * Describe the kinds of special objects contained in this Parcelable * instance's marshaled representation. For example, if the object will * include a file descriptor in the output of {@link #writeToParcel(Parcel, int)}, * the return value of this method must include the * {@link #CONTENTS_FILE_DESCRIPTOR} bit. * * @return a bitmask indicating the set of special object types marshaled * by this Parcelable object instance. */ @Override public int describeContents() { return 0; } /** * Flatten this object in to a Parcel. * * @param dest The Parcel in which the object should be written. * @param flags Additional flags about how the object should be written. * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. */ @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(Id); dest.writeString(DepartmentId); dest.writeString(StandardAddressId); dest.writeString(ElementTypeId); dest.writeString(name); dest.writeString(SingleLine0); dest.writeString(memo); dest.writeString(address); dest.writeString(Option3); dest.writeString(PointsInJson); dest.writeString(ElementTypeName); dest.writeString(FullPath); dest.writeInt(RowNum); dest.writeInt(total); dest.writeString(RecordTime); dest.writeByte((byte) (checked ? 1 : 0)); } } }
[ "434604925@qq.com" ]
434604925@qq.com
2ef3c40ffd79cab23ccb6d9925a7dc75cdd07be8
08e4dae023d0fec0b7db5e00b59eeda595bf4e1e
/LinkedList/DeleteNode.java
87794dd8e78e1519d5da92f6c98a98202624170e
[ "MIT" ]
permissive
NITIN23329/LeetCode
bd037446ecf986a543da9667fd8e56e43e567d61
5c9a0a289042da607c51cc61fe79959d70d58a3d
refs/heads/main
2023-06-18T00:28:02.316329
2021-07-14T09:00:54
2021-07-14T09:00:54
300,907,275
2
0
null
null
null
null
UTF-8
Java
false
false
213
java
//problem link : https://leetcode.com/problems/delete-node-in-a-linked-list/ class Solution { public void deleteNode(ListNode node) { node.val=node.next.val; node.next=node.next.next; } }
[ "noreply@github.com" ]
NITIN23329.noreply@github.com
61d089c7e9039e26e3a8c5d7288bb4518fe74162
9fe7b2e58b46bf7ae287363303ce5b7d04b1c881
/projects/littlecontact/src/test/java/net/fschulte/littlecontact/LibraryTest.java
f65f7818e4f8e94f1a32f7b30d33fab32af07163
[]
no_license
amhambra/amhambra
86d03531d3c4386342450752818ba91115f6c786
f30aab9d02d502f50a86a566bbe028c891fc8560
refs/heads/master
2020-05-16T23:09:12.730208
2020-01-05T22:35:43
2020-01-05T22:35:43
2,065,334
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
/* * This Java source file was generated by the Gradle 'init' task. */ package net.fschulte.littlecontact; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class LibraryTest { @Test void testSomeLibraryMethod() { Library classUnderTest = new Library(); assertTrue(classUnderTest.someLibraryMethod(), "someLibraryMethod should return 'true'"); } }
[ "fschulte.de.dev@fschulte.net" ]
fschulte.de.dev@fschulte.net
a9a17c0f4d99fcba81143e46e0584c9d15ff959b
78c696de905e3f1a699b106c6f23893bd0e96fa3
/src/org/eclipse/ui/internal/themes/FontDefinition.java
9633694ccf38db0d7c836ec45b272ed3340771fc
[]
no_license
jiangyu2015/eclipse-4.5.2-source
71d1e0b45e744ce0038e5ba17b6c3c12fd3634c5
e4a90a19989564e28d73ff64a4a2ffc2cbfeaf9e
refs/heads/master
2021-01-10T09:07:58.554745
2016-03-03T13:18:11
2016-03-03T13:18:11
52,862,391
0
0
null
null
null
null
UTF-8
Java
false
false
3,988
java
/******************************************************************************* * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.internal.themes; import org.eclipse.e4.ui.internal.css.swt.definition.IFontDefinitionOverridable; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.StringConverter; import org.eclipse.swt.graphics.FontData; import org.eclipse.ui.PlatformUI; /** * The FontDefiniton is the representation of the fontDefinition * from the plugin.xml of a type. */ public class FontDefinition extends ThemeElementDefinition implements IHierarchalThemeElementDefinition, ICategorizedThemeElementDefinition, IEditable, IFontDefinitionOverridable { private String defaultsTo; private String value; private String defaultValue; private boolean isEditable; private FontData[] parsedValue; /** * Create a new instance of the receiver. * * @param fontName The name display * ed in the preference page. * @param uniqueId The id used to refer to this definition. * @param defaultsId The id of the font this defaults to. * @param fontDescription The description of the font in the preference page. */ public FontDefinition(String fontName, String uniqueId, String defaultsId, String value, String categoryId, boolean isEditable, String fontDescription) { super(uniqueId, fontName, fontDescription, categoryId); this.defaultsTo = defaultsId; this.value = value; this.isEditable = isEditable; } /** * Create a new instance of the receiver. * * @param originalFont the original definition. This will be used to populate * all fields except defaultsTo and value. defaultsTo will always be * <code>null</code>. * @param datas the FontData[] value */ public FontDefinition(FontDefinition originalFont, FontData[] datas) { super(originalFont.getId(), originalFont.getName(), originalFont.getDescription(), originalFont.getCategoryId()); this.isEditable = originalFont.isEditable(); this.parsedValue = datas; } /** * Returns the defaultsTo. This is the id of the text font * that this font defualts to. * @return String or <pre>null</pre>. */ @Override public String getDefaultsTo() { return defaultsTo; } /** * Returns the value. * * @return FontData [] */ @Override public FontData[] getValue() { if (value == null) { return null; } if (parsedValue == null) { parsedValue = JFaceResources.getFontRegistry().filterData( StringConverter.asFontDataArray(value), PlatformUI.getWorkbench().getDisplay()); } return parsedValue; } @Override public void resetToDefaultValue() { value = defaultValue; parsedValue = null; super.resetToDefaultValue(); } @Override public boolean isEditable() { return isEditable; } @Override public boolean equals(Object obj) { if (obj instanceof FontDefinition) { return getId().equals(((FontDefinition)obj).getId()); } return false; } @Override public int hashCode() { return getId().hashCode(); } @Override public void setValue(FontData[] data) { if (data != null && data.length > 0) { if (defaultValue == null) { defaultValue = value; } value = data[0].getName(); parsedValue = data; appendState(State.OVERRIDDEN); } } }
[ "187_6810_5877@sina.com" ]
187_6810_5877@sina.com
9fe2ea50d902282630acbbdb74acc262e604b714
a3e0cdfd506d0f3b780d1135359e4f55f9af92ad
/teavm-html4j/src/test/java/org/teavm/html4j/test/JavaScriptBodyConversionTest.java
b8b6910a7f373a8c979220974d8d875a61a7bc9b
[ "Apache-2.0" ]
permissive
RuedigerMoeller/teavm
739948602544c98443313e51c9c429a69a1824a6
70338531f58999f3080ff1578960112633ca0c01
refs/heads/master
2023-06-14T18:19:51.946286
2014-10-09T13:36:44
2014-10-09T13:36:44
24,997,400
2
0
null
null
null
null
UTF-8
Java
false
false
4,024
java
/* * Copyright 2014 Alexey Andreev. * * 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.teavm.html4j.test; import static org.junit.Assert.*; import net.java.html.js.JavaScriptBody; import org.junit.Test; /** * * @author Alexey Andreev <konsoletyper@gmail.com> */ public class JavaScriptBodyConversionTest { @Test public void convertsInteger() { assertEquals(23, returnAsInt(23)); assertEquals(Integer.valueOf(23), returnAsInteger(23)); assertEquals(23, returnAsObject(23)); assertEquals(24, addOne((Object)23)); assertEquals(Integer.valueOf(24), addOne(Integer.valueOf(23))); assertEquals(24, addOne(23)); } @Test public void convertsIntegerResult() { assertEquals(23, returnAsObject(23)); assertEquals(Integer.valueOf(23), returnAsInteger(23)); assertEquals(23, returnAsInt(23)); } @Test public void convertsBoolean() { assertTrue(returnAsBoolean(true)); assertTrue(returnAsBooleanWrapper(true)); assertEquals(Boolean.TRUE, returnAsObject(true)); } @Test public void convertsArray() { assertEquals(42, getArrayItem(new int[] { 23, 42 }, 1)); assertEquals(42, getArrayItem(new Integer[] { 23, 42 }, 1)); } @Test public void copiesArray() { Integer[] array = { 23, 42 }; Integer[] arrayCopy = (Integer[])modifyIntegerArray(array); assertEquals(Integer.valueOf(23), array[0]); assertEquals(Integer.valueOf(1), arrayCopy[0]); } @Test public void createsArrayOfProperType() { assertEquals(Object[].class, returnAsObject(new int[] { 23, 42 }).getClass()); assertEquals(Integer[].class, returnAsIntegerArray(new Integer[] { 23, 42 }).getClass()); assertEquals(int[].class, returnAsIntArray(new Integer[] { 23, 42 }).getClass()); } @JavaScriptBody(args = { "value" }, body = "return value;") private native int returnAsInt(Object value); @JavaScriptBody(args = { "value" }, body = "return value;") private native boolean returnAsBoolean(Object value); @JavaScriptBody(args = { "value" }, body = "return value;") private native Boolean returnAsBooleanWrapper(boolean value); @JavaScriptBody(args = { "value" }, body = "return value;") private native Integer returnAsInteger(Integer value); @JavaScriptBody(args = { "value" }, body = "return value;") private native Object returnAsObject(int value); @JavaScriptBody(args = { "value" }, body = "return value + 1;") private native int addOne(Object value); @JavaScriptBody(args = { "value" }, body = "return value + 1;") private native Integer addOne(Integer value); @JavaScriptBody(args = { "value" }, body = "return value + 1;") private native int addOne(int value); @JavaScriptBody(args = { "value" }, body = "return value;") private native Object returnAsObject(Object array); @JavaScriptBody(args = { "value" }, body = "return value;") private native int[] returnAsIntArray(Object array); @JavaScriptBody(args = { "value" }, body = "return value;") private native Integer[] returnAsIntegerArray(Object array); @JavaScriptBody(args = { "value" }, body = "value[0] = 1; return value;") private native Object modifyIntegerArray(Object value); @JavaScriptBody(args = { "array", "index" }, body = "return array[index];") private native Object getArrayItem(Object array, int index); }
[ "konsoletyper@gmail.com" ]
konsoletyper@gmail.com
f9861e0a4c7fe56fe0ac5a90b34ca44e02d33bd5
ef100e08c1c2d662d68421a206684560118f7f4c
/src/past/Baek_1260.java
41b15eb88da7ea60a7eda4fb7fd846c02443d00b
[]
no_license
ptm0304/algorithms
e31a17376c898f07c73b851d1185d0d5df96c634
b9a364eaac94ec6da634b53376178a24d475c1ad
refs/heads/master
2021-04-21T01:59:13.721735
2020-05-25T13:38:43
2020-05-25T13:38:43
249,738,778
0
0
null
null
null
null
UTF-8
Java
false
false
1,893
java
package past; import java.util.*; public class Baek_1260 { static boolean[] visited; static ArrayList[] edges; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nVertex = sc.nextInt(); int nEdge = sc.nextInt(); int startInd = sc.nextInt(); edges = new ArrayList[nVertex + 1]; for (int i = 0; i < nEdge; i++) { int ind1 = sc.nextInt(); int ind2 = sc.nextInt(); if (edges[ind1] == null) { edges[ind1] = new ArrayList<Integer>(); } if (edges[ind2] == null) { edges[ind2] = new ArrayList<Integer>(); } edges[ind1].add(ind2); edges[ind2].add(ind1); } for (ArrayList<Integer> edge : edges) { if (edge == null) continue; Collections.sort(edge); } // dfs visited = new boolean[nVertex + 1]; dfs(startInd); System.out.println(); // bfs visited = new boolean[nVertex + 1]; Queue<Integer> q = new LinkedList<>(); q.offer(startInd); while (!q.isEmpty()) { int curr = q.poll(); if (visited[curr]) continue; visited[curr] = true; System.out.print(curr + " "); ArrayList<Integer> neighbors = edges[curr]; if (neighbors == null) continue; for (Integer neighbor : neighbors) { q.offer(neighbor); } } } static void dfs(int currInd) { if (visited[currInd]) return; visited[currInd] = true; System.out.print(currInd + " "); ArrayList<Integer> neighbors = edges[currInd]; if (neighbors == null) return; for (Integer neighbor : neighbors) { dfs(neighbor); } } }
[ "tpark123@terpmail.umd.edu" ]
tpark123@terpmail.umd.edu
6540e950b38bf6e487eaf2932ff910b1e28b70f3
5287388c481896feca18fa34b06ac98fc11cdcf8
/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumper.java
e10d93cd2fb2053fd4c837648268320af4f93823
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
wyfunique/vespa
a9e0d3ad53739b6dabad8f1e25d19b6e8da5ce30
1bc2cca4b527bb9a5a8c67744b0796c9fafbe024
refs/heads/master
2023-08-13T11:45:05.277178
2021-09-29T14:20:45
2021-09-29T14:20:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
436
java
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext; /** * @author bjorncs */ public interface VespaServiceDumper { void processServiceDumpRequest(NodeAgentContext context); VespaServiceDumper DUMMY_INSTANCE = context -> {}; }
[ "bjorncs@verizonmedia.com" ]
bjorncs@verizonmedia.com
976bb68c90925511e0a6e2868c5bfd9934773667
09776e6f6e77fe4de6f3c897eeaae5be64ddc597
/edu.uniajc.logic/src/java/edu/uniajc/ideaBank/Utilities/SendMail.java
87cc2e11da01e93041d854f0e56f6049d7c90116
[]
no_license
preciadosandro/bancoDeIdeas
4e249408f8365ae281406849fcdfa9f538990800
ec12d9af9e4a638583167ee5baed30d8239be9fb
refs/heads/master
2021-01-19T20:18:22.458665
2017-06-08T22:56:32
2017-06-08T22:56:32
83,745,239
0
0
null
null
null
null
UTF-8
Java
false
false
592
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 edu.uniajc.ideaBank.Utilities; import java.io.File; /** * * @author Felipe */ public class SendMail { public boolean enviar_correo(String correo,String asunto,String mensaje){ Mail mail = new Mail("ideabank.uniajc@gmail.com", "1d34b4nk"); mail.setSubject(asunto); mail.setHtml(mensaje); return mail.mail(correo); } }
[ "felipeolis1985@gmail.com" ]
felipeolis1985@gmail.com
8f3fbd96447f22cda7bfa50ee60b9f518c8bf538
408b676a96b46a13d2f58a03734102e9fccde96f
/springboot001/springboot003-web-restful/src/main/java/java/com/atguigu/springboot/filter/MyFilter.java
0b6d7282557be6d84582ed017e3a6023e75f8e7d
[]
no_license
cyfreeman/springbootstudy
2045a9ecce5d6ff3dd2184a4997205815058b036
585c3d8cb1b09f2a1d894f7cacb3a49e96ec64d4
refs/heads/master
2022-12-14T21:57:39.194777
2020-09-21T09:07:44
2020-09-21T09:07:44
294,562,477
0
0
null
null
null
null
UTF-8
Java
false
false
536
java
package java.com.atguigu.springboot.filter; import javax.servlet.*; import java.io.IOException; public class MyFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { System.out.println("MyFilter process..."); chain.doFilter(request,response); } @Override public void destroy() { } }
[ "cywxm0118@126.com" ]
cywxm0118@126.com
6b2ec4e4165a67c62eece335ebb6d7d0f44a22c4
470d56b583caaf8878b72ab3543fb23323edc2bf
/PassTheBomb/app/src/test/java/com/thrane/simon/passthebomb/ExampleUnitTest.java
e1a5f26383dab39899fc66fc4e026d8b67d84996
[]
no_license
SimonThrane/AppProjectPassTheBomb
25df116957554e48d7a648834ec1caf3dbf9f62b
e4e2c875f48a0f9777790c9899ff9683092f6e9f
refs/heads/master
2021-09-05T01:26:45.041257
2018-01-23T11:33:29
2018-01-23T11:33:29
111,815,946
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.thrane.simon.passthebomb; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "minijordan23-virum@hotmail.com" ]
minijordan23-virum@hotmail.com
7511337cc6b80cdaa1a0190db648ebf4e1b22af1
0a6dd20710d97f8eabf2310d5873c0eb25853833
/foodie-dev-service/src/main/java/com/imooc/service/impl/AddressServiceImpl.java
59a9da51f2d245877f716af0a69a61d462942222
[]
no_license
luoyaozhong/foodie-dev-test
6d438618310d92e3530e917b441af337b6f730f7
eacb3b3ff845f74e8600d0b18d4079bb1a8cc424
refs/heads/master
2022-06-29T05:42:40.319970
2020-02-08T06:28:44
2020-02-08T06:28:44
238,890,468
0
0
null
2022-06-21T02:45:31
2020-02-07T09:50:57
Java
UTF-8
Java
false
false
3,921
java
package com.imooc.service.impl; import com.imooc.enums.YesOrNo; import com.imooc.mapper.UserAddressMapper; import com.imooc.pojo.UserAddress; import com.imooc.pojo.bo.AddressBO; import com.imooc.service.AddressService; import org.n3r.idworker.Sid; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @Service public class AddressServiceImpl implements AddressService { @Autowired private UserAddressMapper userAddressMapper; @Autowired private Sid sid; @Transactional(propagation = Propagation.SUPPORTS) @Override public List<UserAddress> queryAll(String userId) { UserAddress ua = new UserAddress(); ua.setUserId(userId); return userAddressMapper.select(ua); } @Transactional(propagation = Propagation.REQUIRED) @Override public void addNewUserAddress(AddressBO addressBO) { // 1. 判断当前用户是否存在地址,如果没有,则新增为‘默认地址’ Integer isDefault = 0; List<UserAddress> addressList = this.queryAll(addressBO.getUserId()); if (addressList == null || addressList.isEmpty() || addressList.size() == 0) { isDefault = 1; } String addressId = sid.nextShort(); // 2. 保存地址到数据库 UserAddress newAddress = new UserAddress(); BeanUtils.copyProperties(addressBO, newAddress); newAddress.setId(addressId); newAddress.setIsDefault(isDefault); newAddress.setCreatedTime(new Date()); newAddress.setUpdatedTime(new Date()); userAddressMapper.insert(newAddress); } @Transactional(propagation = Propagation.REQUIRED) @Override public void updateUserAddress(AddressBO addressBO) { String addressId = addressBO.getAddressId(); UserAddress pendingAddress = new UserAddress(); BeanUtils.copyProperties(addressBO, pendingAddress); pendingAddress.setId(addressId); pendingAddress.setUpdatedTime(new Date()); userAddressMapper.updateByPrimaryKeySelective(pendingAddress); } @Transactional(propagation = Propagation.REQUIRED) @Override public void deleteUserAddress(String userId, String addressId) { UserAddress address = new UserAddress(); address.setId(addressId); address.setUserId(userId); userAddressMapper.delete(address); } @Transactional(propagation = Propagation.REQUIRED) @Override public void updateUserAddressToBeDefault(String userId, String addressId) { // 1. 查找默认地址,设置为不默认 UserAddress queryAddress = new UserAddress(); queryAddress.setUserId(userId); queryAddress.setIsDefault(YesOrNo.YES.type); List<UserAddress> list = userAddressMapper.select(queryAddress); for (UserAddress ua : list) { ua.setIsDefault(YesOrNo.NO.type); userAddressMapper.updateByPrimaryKeySelective(ua); } // 2. 根据地址id修改为默认的地址 UserAddress defaultAddress = new UserAddress(); defaultAddress.setId(addressId); defaultAddress.setUserId(userId); defaultAddress.setIsDefault(YesOrNo.YES.type); userAddressMapper.updateByPrimaryKeySelective(defaultAddress); } @Transactional(propagation = Propagation.SUPPORTS) @Override public UserAddress queryUserAddres(String userId, String addressId) { UserAddress singleAddress = new UserAddress(); singleAddress.setId(addressId); singleAddress.setUserId(userId); return userAddressMapper.selectOne(singleAddress); } }
[ "yaozhongluo@qq.com" ]
yaozhongluo@qq.com
02a18a7903edd88fe2cfce79ae08641a9c8b7197
f9fa24b58a0f3312799ab4415f7886bdf9a2ad8e
/src/com/yestops/webgame/WebViewFragment.java
619715496f70051789cd76d687dab45a3d9fd7f5
[]
no_license
oyosting/WebGame
117924641dee731cad3a2a0c5c1c5d3583097769
9f0d80e9ef6fe21847b444a96503449e5c7da61a
refs/heads/master
2020-07-21T14:27:50.356287
2014-11-10T09:05:54
2014-11-10T09:05:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,032
java
/** * * Copyright 2014 Cisco. All rights reserved. * WebViewFragment.java * */ package com.yestops.webgame; import com.umeng.analytics.MobclickAgent; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.net.http.SslError; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.SslErrorHandler; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.TextView; /** * @author kevin * @date 2014年7月10日 */ public class WebViewFragment extends Fragment { public static final String WEB_ADDRESS = "web_url"; public static final String ACTION_BAR_TITLE = "action_bar_title"; private final String[] mSchemes = { "im://", "xmpp://", "ciscoim://", "ciscotel://", "tel://", "ciscojabber://" }; private String mWebUrl; private String mActionBarTitle; private WebView mWebView; private View mErrorView; @Override public void onPause() { super.onPause(); MobclickAgent.onPageEnd(WebViewFragment.class.toString()); } @Override public void onResume() { super.onResume(); MobclickAgent.onPageStart(WebViewFragment.class.toString()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_webview, null); mWebView = (WebView) rootView.findViewById(R.id.web); mErrorView = rootView.findViewById(R.id.error_layout); initWebView(); MyWebViewClient webViewClient = new MyWebViewClient(); mWebView.setWebViewClient(webViewClient); // set action bar title mActionBarTitle = getArguments().getString(ACTION_BAR_TITLE); getActivity().setTitle(mActionBarTitle); // load target url here mWebUrl = getArguments().getString(WEB_ADDRESS); mWebView.loadUrl(mWebUrl); // set actionbar title here return rootView; } private class MyWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url != null && isProvisionSupportedUrl(url)) { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { view.loadUrl(url); return false; } } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } /** start loading page, add tip later */ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } /** finish loading page */ @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); } private boolean isProvisionSupportedUrl(String url) { boolean result = false; for (String item : mSchemes) { if (url.startsWith(item)) { result = true; break; } } return result; } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { //cannot load the page, show error tip mWebView.setVisibility(View.GONE); mErrorView.setVisibility(View.VISIBLE); } } private void initWebView() { if (mWebView != null) { mWebView.getSettings().setJavaScriptEnabled(true); } } }
[ "sting.gao@gmail.com" ]
sting.gao@gmail.com
4cc44216d8505f98695ef7040bcb0b6716d67ec3
f8fba2ac05d6b58b9c49e921570ac27b440896a0
/helloworldmvc/View/src/main/java/helloworldmvc/view/View.java
f1469e92708a3aec2f8347a3797b6740d4dda66a
[]
no_license
Ushobti/Java_J2EE
33d527b249912986d32b575fa8b3cbec419d2d5d
6565da3ece684acb5ee61952799921781a0d6627
refs/heads/master
2020-06-09T16:28:51.194049
2019-06-25T06:48:16
2019-06-25T06:48:16
193,468,193
0
0
null
null
null
null
UTF-8
Java
false
false
168
java
package helloworldmvc.view; public class View implements IView{ @Override public void display(String message) { System.out.println(message); } }
[ "cldaunay@gmail.com" ]
cldaunay@gmail.com
76fb9a28404a05ba7f4b170c127357f984d84169
a3e06ad2e65c94d41056293b607649be4d1bac71
/demo-web/src/main/java/com/demo/DemoApplication.java
212549c9fc6cf3fbfb6f1228b3a3d6e2f6edf3fc
[]
no_license
lingtingGA/module01
c4737203a7f7c2d43b9ac988267e9608892e9e6d
34386292dd35173f2b47f4eff9f53a38d679ff79
refs/heads/master
2023-03-20T06:30:59.829572
2021-03-09T05:48:52
2021-03-09T05:48:52
345,893,568
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class); } }
[ "271092943@qq.com" ]
271092943@qq.com