blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
9edf1e83f474bba940de3b6a8838ba3099c3b183
54204e3fb83d219819271788b77532f9fde33bdc
/rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbAbstractCustomerActionNode.java
3ee2127fde2df0f6f6c667fa24d292f2dc0c8d77
[ "Apache-2.0" ]
permissive
ziapple/thingsboard-side
66bef8dc8335edc4135884a6bb309fedfb4887fe
e91a4d3c8dc05a7b74b40747edbf0a67591755be
refs/heads/master
2023-01-22T15:50:23.580651
2020-03-06T06:12:07
2020-03-06T06:12:07
236,173,500
0
0
Apache-2.0
2023-01-01T15:42:29
2020-01-25T13:26:35
Java
UTF-8
Java
false
false
5,405
java
/** * Copyright © 2016-2020 The Thingsboard 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.thingsboard.rule.engine.action; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.thingsboard.rule.engine.api.TbContext; import org.thingsboard.rule.engine.api.TbNode; import org.thingsboard.rule.engine.api.TbNodeConfiguration; import org.thingsboard.rule.engine.api.TbNodeException; import org.thingsboard.rule.engine.api.util.TbNodeUtils; import org.thingsboard.server.common.data.Customer; import org.thingsboard.server.common.data.id.CustomerId; import org.thingsboard.server.common.msg.TbMsg; import org.thingsboard.server.dao.customer.CustomerService; import java.util.Optional; import java.util.concurrent.TimeUnit; import static org.thingsboard.common.util.DonAsynchron.withCallback; @Slf4j public abstract class TbAbstractCustomerActionNode<C extends TbAbstractCustomerActionNodeConfiguration> implements TbNode { protected C config; private LoadingCache<CustomerKey, Optional<CustomerId>> customerIdCache; @Override public void init(TbContext ctx, TbNodeConfiguration configuration) throws TbNodeException { this.config = loadCustomerNodeActionConfig(configuration); CacheBuilder cacheBuilder = CacheBuilder.newBuilder(); if (this.config.getCustomerCacheExpiration() > 0) { cacheBuilder.expireAfterWrite(this.config.getCustomerCacheExpiration(), TimeUnit.SECONDS); } customerIdCache = cacheBuilder .build(new CustomerCacheLoader(ctx, createCustomerIfNotExists())); } protected abstract boolean createCustomerIfNotExists(); protected abstract C loadCustomerNodeActionConfig(TbNodeConfiguration configuration) throws TbNodeException; @Override public void onMsg(TbContext ctx, TbMsg msg) { withCallback(processCustomerAction(ctx, msg), m -> ctx.tellNext(msg, "Success"), t -> ctx.tellFailure(msg, t), ctx.getDbCallbackExecutor()); } private ListenableFuture<Void> processCustomerAction(TbContext ctx, TbMsg msg) { ListenableFuture<CustomerId> customerIdFeature = getCustomer(ctx, msg); return Futures.transform(customerIdFeature, customerId -> { doProcessCustomerAction(ctx, msg, customerId); return null; }, ctx.getDbCallbackExecutor() ); } protected abstract void doProcessCustomerAction(TbContext ctx, TbMsg msg, CustomerId customerId); protected ListenableFuture<CustomerId> getCustomer(TbContext ctx, TbMsg msg) { String customerTitle = TbNodeUtils.processPattern(this.config.getCustomerNamePattern(), msg.getMetaData()); CustomerKey key = new CustomerKey(customerTitle); return ctx.getDbCallbackExecutor().executeAsync(() -> { Optional<CustomerId> customerId = customerIdCache.get(key); if (!customerId.isPresent()) { throw new RuntimeException("No customer found with name '" + key.getCustomerTitle() + "'."); } return customerId.get(); }); } @Override public void destroy() { } @Data @AllArgsConstructor private static class CustomerKey { private String customerTitle; } private static class CustomerCacheLoader extends CacheLoader<CustomerKey, Optional<CustomerId>> { private final TbContext ctx; private final boolean createIfNotExists; private CustomerCacheLoader(TbContext ctx, boolean createIfNotExists) { this.ctx = ctx; this.createIfNotExists = createIfNotExists; } @Override public Optional<CustomerId> load(CustomerKey key) { CustomerService service = ctx.getCustomerService(); Optional<Customer> customerOptional = service.findCustomerByTenantIdAndTitle(ctx.getTenantId(), key.getCustomerTitle()); if (customerOptional.isPresent()) { return Optional.of(customerOptional.get().getId()); } else if (createIfNotExists) { Customer newCustomer = new Customer(); newCustomer.setTitle(key.getCustomerTitle()); newCustomer.setTenantId(ctx.getTenantId()); Customer savedCustomer = service.saveCustomer(newCustomer); ctx.sendTbMsgToRuleEngine(ctx.customerCreatedMsg(savedCustomer, ctx.getSelfId())); return Optional.of(savedCustomer.getId()); } return Optional.empty(); } } }
[ "ziapple@126.com" ]
ziapple@126.com
65a9039205837e26693344980575725e4f87062b
403ab91ef5ced8333a856009875939ccae353704
/src/javaguide/Casting.java
abc8f820644f647e080966f675a2267ba1e6208b
[]
no_license
jmejiamu/java-guide
e95a2728d047423ebbcc861e79629dc9848cf566
e02af636efb6865aa338b53fd448ebffc944307e
refs/heads/master
2023-08-19T11:54:19.533899
2021-09-25T09:05:50
2021-09-25T09:05:50
408,002,320
0
0
null
2021-09-25T09:05:50
2021-09-19T01:09:18
Java
UTF-8
Java
false
false
557
java
package javaguide; /** * * @author JoseMejia62 */ public class Casting { public static void wideningCasting(){ int age = 20; double ageToDouble = age; System.out.println("Int - " + age); System.out.println("Casting age to double - " + ageToDouble); } public static void narrowCasting(){ double total = 23.70d; int totalToInt = (int) total; System.out.println("Double - " + total); System.out.println("Total to int - " + totalToInt); } }
[ "jmejiamu@gmail.com" ]
jmejiamu@gmail.com
82300fd01ee7e8a93135114effbee0799e6276e2
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2008-08-26/seasar2-2.4.28/seasar-benchmark/src/main/java/benchmark/many/b04/NullBean04755.java
51eeb0ae1637feb5236c5d10036e723e1707ef38
[]
no_license
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
62
java
package benchmark.many.b04; public class NullBean04755 { }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
7394fafaff1010e5372f7e830a263e77ee40b30c
90577e7daee3183e57a14c43f0a0e26c6616c6a6
/com.cssrc.ibms.core/src/main/java/com/cssrc/ibms/api/sysuser/intf/ISysOrgTacticService.java
416c30cf866a4aa727ba89c9a643b3dabd051e53
[]
no_license
xeon-ye/8ddp
a0fec7e10182ab4728cafc3604b9d39cffe7687e
52c7440b471c6496f505e3ada0cf4fdeecce2815
refs/heads/master
2023-03-09T17:53:38.427613
2021-02-18T02:18:55
2021-02-18T02:18:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package com.cssrc.ibms.api.sysuser.intf; import com.cssrc.ibms.api.sysuser.model.ISysOrgTactic; public interface ISysOrgTacticService { ISysOrgTactic getOrgTactic(); }
[ "john_qzl@163.com" ]
john_qzl@163.com
d5ae1e5b25fca773f7bcafadacffc8eb7bf51689
d04398a50504f51417781a375bbb7002a1173f38
/src/main/java/spring/model/Msg.java
a7c0e7da69fc977a7de0238f26b9403b6dae464c
[]
no_license
ShawFengZ/ssm-crud
b9a02318fa102cf9aac9c2059a7a3f4b7d4e3930
ad9637aef4c88bd585966abad2b5800691f2ef51
refs/heads/master
2020-03-24T06:30:01.880986
2018-07-27T05:26:45
2018-07-27T05:26:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,279
java
package spring.model; import java.util.HashMap; import java.util.Map; /** * @author zxf * @date 2018/7/23 19:51 */ public class Msg { //状态码,100-成功,200-失败 private int code; //提示信息 private String msg; //用户要返回给浏览器的数据 private Map<String, Object> extend = new HashMap<String, Object>(); public static Msg success(){ Msg result = new Msg(); result.setCode(100); result.setMsg("处理成功!"); return result; } public static Msg fail(){ Msg result = new Msg(); result.setCode(200); result.setMsg("处理失败!"); return result; } /* * 可以链式添加数据的方法 * */ public Msg add(String key, Object value){ this.getExtend().put(key, value); return this; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Map<String, Object> getExtend() { return extend; } public void setExtend(Map<String, Object> extend) { this.extend = extend; } }
[ "975981869@qq.com" ]
975981869@qq.com
acb0e266b7285a0d461fd44fccbefc36d4685f9a
ce7ab26d56064429deddb7428d7627d9a1f6468e
/src/test/java/io/github/classgraph/issues/issue289/Issue289.java
e7cd883d876487589742831ef7f498577d41077e
[ "MIT" ]
permissive
comfanworld/classgraph
02a9b81bc30350015abddef92c47013f5f53eea0
bd4c84bda97cf81c3bef56d833eac01fb69b4a13
refs/heads/master
2020-04-29T16:12:55.507666
2019-03-15T20:35:50
2019-03-15T20:35:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
907
java
package io.github.classgraph.issues.issue289; import static org.assertj.core.api.Assertions.assertThat; import java.net.URL; import java.net.URLClassLoader; import org.junit.Test; import io.github.classgraph.ClassGraph; import io.github.classgraph.ResourceList; import io.github.classgraph.ScanResult; /** * The Class Issue289. */ public class Issue289 { /** * Issue 289. */ @Test public void issue289() throws Exception { try (ScanResult scanResult = new ClassGraph() .overrideClassLoaders( new URLClassLoader(new URL[] { Issue289.class.getClassLoader().getResource("zip64.zip") })) .scan()) { for (int i = 0; i < 90000; i++) { final ResourceList resources = scanResult.getResourcesWithPath(i + ""); assertThat(resources).isNotEmpty(); } } } }
[ "luke.hutch@gmail.com" ]
luke.hutch@gmail.com
1c1435f2f4c388299a2c1bb0e93de514636c15ce
4be61634117a0aa988f33246d0f425047c027f4c
/zkredis-app/src/jdk6/com/sun/org/apache/xerces/internal/impl/XMLScanner.java
f177552e820aa4aeb281bad1875b0a64ce176158
[]
no_license
oldshipmaster/zkredis
c02e84719f663cd620f1a76fba38e4452d755a0c
3ec53d6904a47a5ec79bc7768b1ca6324facb395
refs/heads/master
2022-12-27T01:31:23.786539
2020-08-12T01:22:07
2020-08-12T01:22:07
34,658,942
1
3
null
2022-12-16T04:32:34
2015-04-27T09:55:48
Java
UTF-8
Java
false
false
57,487
java
/* * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * https://jaxp.dev.java.net/CDDLv1.0.html. * See the License for the specific language governing * permissions and limitations under the License. * * When distributing Covered Code, include this CDDL * HEADER in each file and include the License file at * https://jaxp.dev.java.net/CDDLv1.0.html * If applicable add the following below this CDDL HEADER * with the fields enclosed by brackets "[]" replaced with * your own identifying information: Portions Copyright * [year] [name of copyright owner] */ /* * $Id: XMLScanner.java,v 1.6 2006/06/06 06:28:41 sunithareddy Exp $ * @(#)XMLScanner.java 1.20 09/06/18 * * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. */ /* * Copyright 2005 The Apache Software Foundation. * * 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.sun.org.apache.xerces.internal.impl; import com.sun.xml.internal.stream.XMLEntityStorage; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import javax.xml.stream.events.XMLEvent; import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl; import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLAttributes; import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier; import com.sun.org.apache.xerces.internal.xni.XMLString; import com.sun.org.apache.xerces.internal.xni.XNIException; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent; import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; import com.sun.xml.internal.stream.Entity; //import com.sun.xml.stream.XMLEntityManager; //import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; /** * This class is responsible for holding scanning methods common to * scanning the XML document structure and content as well as the DTD * structure and content. Both XMLDocumentScanner and XMLDTDScanner inherit * from this base class. * * <p> * This component requires the following features and properties from the * component manager that uses it: * <ul> * <li>http://xml.org/sax/features/validation</li> * <li>http://apache.org/xml/features/scanner/notify-char-refs</li> * <li>http://apache.org/xml/properties/internal/symbol-table</li> * <li>http://apache.org/xml/properties/internal/error-reporter</li> * <li>http://apache.org/xml/properties/internal/entity-manager</li> * </ul> * * @author Andy Clark, IBM * @author Arnaud Le Hors, IBM * @author Eric Ye, IBM * @author K.Venugopal SUN Microsystems * @author Sunitha Reddy, SUN Microsystems * @version $Id: XMLScanner.java,v 1.6 2006/06/06 06:28:41 sunithareddy Exp $ */ public abstract class XMLScanner implements XMLComponent { // // Constants // // feature identifiers /** Feature identifier: namespaces. */ protected static final String NAMESPACES = Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE; /** Feature identifier: validation. */ protected static final String VALIDATION = Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE; /** Feature identifier: notify character references. */ protected static final String NOTIFY_CHAR_REFS = Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_CHAR_REFS_FEATURE; // property identifiers protected static final String PARSER_SETTINGS = Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS; /** Property identifier: symbol table. */ protected static final String SYMBOL_TABLE = Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY; /** Property identifier: error reporter. */ protected static final String ERROR_REPORTER = Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY; /** Property identifier: entity manager. */ protected static final String ENTITY_MANAGER = Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY; // debugging /** Debug attribute normalization. */ protected static final boolean DEBUG_ATTR_NORMALIZATION = false; //xxx: setting the default value as false, as we dont need to calculate this value //we should have a feature when set to true computes this value private boolean fNeedNonNormalizedValue = false; protected ArrayList attributeValueCache = new ArrayList(); protected ArrayList stringBufferCache = new ArrayList(); protected int fStringBufferIndex = 0; protected boolean fAttributeCacheInitDone = false; protected int fAttributeCacheUsedCount = 0; // // Data // // features /** * Validation. This feature identifier is: * http://xml.org/sax/features/validation */ protected boolean fValidation = false; /** Namespaces. */ protected boolean fNamespaces; /** Character references notification. */ protected boolean fNotifyCharRefs = false; /** Internal parser-settings feature */ protected boolean fParserSettings = true; // properties protected PropertyManager fPropertyManager = null ; /** Symbol table. */ protected SymbolTable fSymbolTable; /** Error reporter. */ protected XMLErrorReporter fErrorReporter; /** Entity manager. */ //protected XMLEntityManager fEntityManager = PropertyManager.getEntityManager(); protected XMLEntityManager fEntityManager = null ; /** xxx this should be available from EntityManager Entity storage */ protected XMLEntityStorage fEntityStore = null ; // protected data /** event type */ protected XMLEvent fEvent ; /** Entity scanner, this alwasy works on last entity that was opened. */ protected XMLEntityScanner fEntityScanner = null; /** Entity depth. */ protected int fEntityDepth; /** Literal value of the last character refence scanned. */ protected String fCharRefLiteral = null; /** Scanning attribute. */ protected boolean fScanningAttribute; /** Report entity boundary. */ protected boolean fReportEntity; // symbols /** Symbol: "version". */ protected final static String fVersionSymbol = "version".intern(); /** Symbol: "encoding". */ protected final static String fEncodingSymbol = "encoding".intern(); /** Symbol: "standalone". */ protected final static String fStandaloneSymbol = "standalone".intern(); /** Symbol: "amp". */ protected final static String fAmpSymbol = "amp".intern(); /** Symbol: "lt". */ protected final static String fLtSymbol = "lt".intern(); /** Symbol: "gt". */ protected final static String fGtSymbol = "gt".intern(); /** Symbol: "quot". */ protected final static String fQuotSymbol = "quot".intern(); /** Symbol: "apos". */ protected final static String fAposSymbol = "apos".intern(); // temporary variables // NOTE: These objects are private to help prevent accidental modification // of values by a subclass. If there were protected *and* the sub- // modified the values, it would be difficult to track down the real // cause of the bug. By making these private, we avoid this // possibility. /** String. */ private XMLString fString = new XMLString(); /** String buffer. */ private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); /** String buffer. */ private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); /** String buffer. */ private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer(); // temporary location for Resource identification information. protected XMLResourceIdentifierImpl fResourceIdentifier = new XMLResourceIdentifierImpl(); int initialCacheCount = 6; // // XMLComponent methods // /** * * * @param componentManager The component manager. * * @throws SAXException Throws exception if required features and * properties cannot be found. */ public void reset(XMLComponentManager componentManager) throws XMLConfigurationException { try { fParserSettings = componentManager.getFeature(PARSER_SETTINGS); } catch (XMLConfigurationException e) { fParserSettings = true; } if (!fParserSettings) { // parser settings have not been changed init(); return; } // Xerces properties fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE); fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER); fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER); //this step is extra because we have separated the storage of entity fEntityStore = fEntityManager.getEntityStore() ; // sax features try { fValidation = componentManager.getFeature(VALIDATION); } catch (XMLConfigurationException e) { fValidation = false; } try { fNamespaces = componentManager.getFeature(NAMESPACES); } catch (XMLConfigurationException e) { fNamespaces = true; } try { fNotifyCharRefs = componentManager.getFeature(NOTIFY_CHAR_REFS); } catch (XMLConfigurationException e) { fNotifyCharRefs = false; } init(); } // reset(XMLComponentManager) protected void setPropertyManager(PropertyManager propertyManager){ fPropertyManager = propertyManager ; } /** * Sets the value of a property during parsing. * * @param propertyId * @param value */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { // Xerces properties if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) { String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length()); if (property.equals(Constants.SYMBOL_TABLE_PROPERTY)) { fSymbolTable = (SymbolTable)value; } else if (property.equals(Constants.ERROR_REPORTER_PROPERTY)) { fErrorReporter = (XMLErrorReporter)value; } else if (property.equals(Constants.ENTITY_MANAGER_PROPERTY)) { fEntityManager = (XMLEntityManager)value; } } /*else if(propertyId.equals(Constants.STAX_PROPERTIES)){ fStaxProperties = (HashMap)value; //TODO::discuss with neeraj what are his thoughts on passing properties. //For now use this }*/ } // setProperty(String,Object) /* * Sets the feature of the scanner. */ public void setFeature(String featureId, boolean value) throws XMLConfigurationException { if (VALIDATION.equals(featureId)) { fValidation = value; } else if (NOTIFY_CHAR_REFS.equals(featureId)) { fNotifyCharRefs = value; } } /* * Gets the state of the feature of the scanner. */ public boolean getFeature(String featureId) throws XMLConfigurationException { if (VALIDATION.equals(featureId)) { return fValidation; } else if (NOTIFY_CHAR_REFS.equals(featureId)) { return fNotifyCharRefs; } throw new XMLConfigurationException(XMLConfigurationException.NOT_RECOGNIZED, featureId); } // // Protected methods // // anybody calling this had better have set Symtoltable! protected void reset() { init(); // DTD preparsing defaults: fValidation = true; fNotifyCharRefs = false; } public void reset(PropertyManager propertyManager) { init(); // Xerces properties fSymbolTable = (SymbolTable)propertyManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY); fErrorReporter = (XMLErrorReporter)propertyManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY); fEntityManager = (XMLEntityManager)propertyManager.getProperty(ENTITY_MANAGER); fEntityStore = fEntityManager.getEntityStore() ; fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner() ; //fEntityManager.reset(); // DTD preparsing defaults: fValidation = false; fNotifyCharRefs = false; } // common scanning methods /** * Scans an XML or text declaration. * <p> * <pre> * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' * [24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ") * [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ) * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* * [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") * | ('"' ('yes' | 'no') '"')) * * [77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' * </pre> * * @param scanningTextDecl True if a text declaration is to * be scanned instead of an XML * declaration. * @param pseudoAttributeValues An array of size 3 to return the version, * encoding and standalone pseudo attribute values * (in that order). * * <strong>Note:</strong> This method uses fString, anything in it * at the time of calling is lost. */ protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl, String[] pseudoAttributeValues) throws IOException, XNIException { // pseudo-attribute values String version = null; String encoding = null; String standalone = null; // scan pseudo-attributes final int STATE_VERSION = 0; final int STATE_ENCODING = 1; final int STATE_STANDALONE = 2; final int STATE_DONE = 3; int state = STATE_VERSION; boolean dataFoundForTarget = false; boolean sawSpace = fEntityScanner.skipSpaces(); while (fEntityScanner.peekChar() != '?') { dataFoundForTarget = true; String name = scanPseudoAttribute(scanningTextDecl, fString); switch (state) { case STATE_VERSION: { if (name.equals(fVersionSymbol)) { if (!sawSpace) { reportFatalError(scanningTextDecl ? "SpaceRequiredBeforeVersionInTextDecl" : "SpaceRequiredBeforeVersionInXMLDecl", null); } version = fString.toString(); state = STATE_ENCODING; if (!versionSupported(version)) { reportFatalError("VersionNotSupported", new Object[]{version}); } if (version.equals("1.1")) { Entity.ScannedEntity top = fEntityManager.getTopLevelEntity(); if (top != null && (top.version == null || top.version.equals("1.0"))) { reportFatalError("VersionMismatch", null); } fEntityManager.setScannerVersion(Constants.XML_VERSION_1_1); } } else if (name.equals(fEncodingSymbol)) { if (!scanningTextDecl) { reportFatalError("VersionInfoRequired", null); } if (!sawSpace) { reportFatalError(scanningTextDecl ? "SpaceRequiredBeforeEncodingInTextDecl" : "SpaceRequiredBeforeEncodingInXMLDecl", null); } encoding = fString.toString(); state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; } else { if (scanningTextDecl) { reportFatalError("EncodingDeclRequired", null); } else { reportFatalError("VersionInfoRequired", null); } } break; } case STATE_ENCODING: { if (name.equals(fEncodingSymbol)) { if (!sawSpace) { reportFatalError(scanningTextDecl ? "SpaceRequiredBeforeEncodingInTextDecl" : "SpaceRequiredBeforeEncodingInXMLDecl", null); } encoding = fString.toString(); state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; // TODO: check encoding name; set encoding on // entity scanner } else if (!scanningTextDecl && name.equals(fStandaloneSymbol)) { if (!sawSpace) { reportFatalError("SpaceRequiredBeforeStandalone", null); } standalone = fString.toString(); state = STATE_DONE; if (!standalone.equals("yes") && !standalone.equals("no")) { reportFatalError("SDDeclInvalid", null); } } else { reportFatalError("EncodingDeclRequired", null); } break; } case STATE_STANDALONE: { if (name.equals(fStandaloneSymbol)) { if (!sawSpace) { reportFatalError("SpaceRequiredBeforeStandalone", null); } standalone = fString.toString(); state = STATE_DONE; if (!standalone.equals("yes") && !standalone.equals("no")) { reportFatalError("SDDeclInvalid", null); } } else { reportFatalError("EncodingDeclRequired", null); } break; } default: { reportFatalError("NoMorePseudoAttributes", null); } } sawSpace = fEntityScanner.skipSpaces(); } // REVISIT: should we remove this error reporting? if (scanningTextDecl && state != STATE_DONE) { reportFatalError("MorePseudoAttributes", null); } // If there is no data in the xml or text decl then we fail to report error // for version or encoding info above. if (scanningTextDecl) { if (!dataFoundForTarget && encoding == null) { reportFatalError("EncodingDeclRequired", null); } } else { if (!dataFoundForTarget && version == null) { reportFatalError("VersionInfoRequired", null); } } // end if (!fEntityScanner.skipChar('?')) { reportFatalError("XMLDeclUnterminated", null); } if (!fEntityScanner.skipChar('>')) { reportFatalError("XMLDeclUnterminated", null); } // fill in return array pseudoAttributeValues[0] = version; pseudoAttributeValues[1] = encoding; pseudoAttributeValues[2] = standalone; } // scanXMLDeclOrTextDecl(boolean) /** * Scans a pseudo attribute. * * @param scanningTextDecl True if scanning this pseudo-attribute for a * TextDecl; false if scanning XMLDecl. This * flag is needed to report the correct type of * error. * @param value The string to fill in with the attribute * value. * * @return The name of the attribute * * <strong>Note:</strong> This method uses fStringBuffer2, anything in it * at the time of calling is lost. */ public String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException, XNIException { String name = fEntityScanner.scanName(); // XMLEntityManager.print(fEntityManager.getCurrentEntity()); if (name == null) { reportFatalError("PseudoAttrNameExpected", null); } fEntityScanner.skipSpaces(); if (!fEntityScanner.skipChar('=')) { reportFatalError(scanningTextDecl ? "EqRequiredInTextDecl" : "EqRequiredInXMLDecl", new Object[]{name}); } fEntityScanner.skipSpaces(); int quote = fEntityScanner.peekChar(); if (quote != '\'' && quote != '"') { reportFatalError(scanningTextDecl ? "QuoteRequiredInTextDecl" : "QuoteRequiredInXMLDecl" , new Object[]{name}); } fEntityScanner.scanChar(); int c = fEntityScanner.scanLiteral(quote, value); if (c != quote) { fStringBuffer2.clear(); do { fStringBuffer2.append(value); if (c != -1) { if (c == '&' || c == '%' || c == '<' || c == ']') { fStringBuffer2.append((char)fEntityScanner.scanChar()); } else if (XMLChar.isHighSurrogate(c)) { scanSurrogates(fStringBuffer2); } else if (isInvalidLiteral(c)) { String key = scanningTextDecl ? "InvalidCharInTextDecl" : "InvalidCharInXMLDecl"; reportFatalError(key, new Object[] {Integer.toString(c, 16)}); fEntityScanner.scanChar(); } } c = fEntityScanner.scanLiteral(quote, value); } while (c != quote); fStringBuffer2.append(value); value.setValues(fStringBuffer2); } if (!fEntityScanner.skipChar(quote)) { reportFatalError(scanningTextDecl ? "CloseQuoteMissingInTextDecl" : "CloseQuoteMissingInXMLDecl", new Object[]{name}); } // return return name; } // scanPseudoAttribute(XMLString):String /** * Scans a processing instruction. * <p> * <pre> * [16] PI ::= '&lt;?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>' * [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) * </pre> */ //CHANGED: //EARLIER: scanPI() //NOW: scanPI(XMLStringBuffer) //it makes things more easy if XMLStringBUffer is passed. Motivation for this change is same // as that for scanContent() protected void scanPI(XMLStringBuffer data) throws IOException, XNIException { // target fReportEntity = false; String target = fEntityScanner.scanName(); if (target == null) { reportFatalError("PITargetRequired", null); } // scan data scanPIData(target, data); fReportEntity = true; } // scanPI(XMLStringBuffer) /** * Scans a processing data. This is needed to handle the situation * where a document starts with a processing instruction whose * target name <em>starts with</em> "xml". (e.g. xmlfoo) * * This method would always read the whole data. We have while loop and data is buffered * until delimeter is encountered. * * @param target The PI target * @param data The string to fill in with the data */ //CHANGED: //Earlier:This method uses the fStringBuffer and later buffer values are set to //the supplied XMLString.... //Now: Changed the signature of this function to pass XMLStringBuffer.. and data would //be appended to that buffer protected void scanPIData(String target, XMLStringBuffer data) throws IOException, XNIException { // check target if (target.length() == 3) { char c0 = Character.toLowerCase(target.charAt(0)); char c1 = Character.toLowerCase(target.charAt(1)); char c2 = Character.toLowerCase(target.charAt(2)); if (c0 == 'x' && c1 == 'm' && c2 == 'l') { reportFatalError("ReservedPITarget", null); } } // spaces if (!fEntityScanner.skipSpaces()) { if (fEntityScanner.skipString("?>")) { // we found the end, there is no data just return return; } else { // if there is data there should be some space reportFatalError("SpaceRequiredInPI", null); } } // since scanData appends the parsed data to the buffer passed // a while loop would append the whole of parsed data to the buffer(data:XMLStringBuffer) //until all of the data is buffered. if (fEntityScanner.scanData("?>", data)) { do { int c = fEntityScanner.peekChar(); if (c != -1) { if (XMLChar.isHighSurrogate(c)) { scanSurrogates(data); } else if (isInvalidLiteral(c)) { reportFatalError("InvalidCharInPI", new Object[]{Integer.toHexString(c)}); fEntityScanner.scanChar(); } } } while (fEntityScanner.scanData("?>", data)); } } // scanPIData(String,XMLString) /** * Scans a comment. * <p> * <pre> * [15] Comment ::= '&lt!--' ((Char - '-') | ('-' (Char - '-')))* '-->' * </pre> * <p> * <strong>Note:</strong> Called after scanning past '&lt;!--' * <strong>Note:</strong> This method uses fString, anything in it * at the time of calling is lost. * * @param text The buffer to fill in with the text. */ protected void scanComment(XMLStringBuffer text) throws IOException, XNIException { //System.out.println( "XMLScanner#scanComment# In Scan Comment" ); // text // REVISIT: handle invalid character, eof text.clear(); while (fEntityScanner.scanData("--", text)) { int c = fEntityScanner.peekChar(); //System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() ); //System.out.println( "XMLScanner#scanComment#c == " + c ); if (c != -1) { if (XMLChar.isHighSurrogate(c)) { scanSurrogates(text); } if (isInvalidLiteral(c)) { reportFatalError("InvalidCharInComment", new Object[] { Integer.toHexString(c) }); fEntityScanner.scanChar(); } } } if (!fEntityScanner.skipChar('>')) { reportFatalError("DashDashInComment", null); } } // scanComment() /** * Scans an attribute value and normalizes whitespace converting all * whitespace characters to space characters. * * [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" * * @param value The XMLString to fill in with the value. * @param nonNormalizedValue The XMLString to fill in with the * non-normalized value. * @param atName The name of the attribute being parsed (for error msgs). * @param attributes The attributes list for the scanned attribute. * @param attrIndex The index of the attribute to use from the list. * @param checkEntities true if undeclared entities should be reported as VC violation, * false if undeclared entities should be reported as WFC violation. * * <strong>Note:</strong> This method uses fStringBuffer2, anything in it * at the time of calling is lost. **/ protected void scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, XMLAttributes attributes, int attrIndex, boolean checkEntities) throws IOException, XNIException { XMLStringBuffer stringBuffer = null; // quote int quote = fEntityScanner.peekChar(); if (quote != '\'' && quote != '"') { reportFatalError("OpenQuoteExpected", new Object[]{atName}); } fEntityScanner.scanChar(); int entityDepth = fEntityDepth; int c = fEntityScanner.scanLiteral(quote, value); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** scanLiteral -> \"" + value.toString() + "\""); } if(fNeedNonNormalizedValue){ fStringBuffer2.clear(); fStringBuffer2.append(value); } if(fEntityScanner.whiteSpaceLen > 0) normalizeWhitespace(value); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** normalizeWhitespace -> \"" + value.toString() + "\""); } if (c != quote) { fScanningAttribute = true; stringBuffer = getStringBuffer(); stringBuffer.clear(); do { stringBuffer.append(value); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** value2: \"" + stringBuffer.toString() + "\""); } if (c == '&') { fEntityScanner.skipChar('&'); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue ) { fStringBuffer2.append('&'); } if (fEntityScanner.skipChar('#')) { if (entityDepth == fEntityDepth && fNeedNonNormalizedValue ) { fStringBuffer2.append('#'); } int ch ; if (fNeedNonNormalizedValue) ch = scanCharReferenceValue(stringBuffer, fStringBuffer2); else ch = scanCharReferenceValue(stringBuffer, null); if (ch != -1) { if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** value3: \"" + stringBuffer.toString() + "\""); } } } else { String entityName = fEntityScanner.scanName(); if (entityName == null) { reportFatalError("NameRequiredInReference", null); } else if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append(entityName); } if (!fEntityScanner.skipChar(';')) { reportFatalError("SemicolonRequiredInReference", new Object []{entityName}); } else if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append(';'); } if (entityName == fAmpSymbol) { stringBuffer.append('&'); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** value5: \"" + stringBuffer.toString() + "\""); } } else if (entityName == fAposSymbol) { stringBuffer.append('\''); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** value7: \"" + stringBuffer.toString() + "\""); } } else if (entityName == fLtSymbol) { stringBuffer.append('<'); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** value9: \"" + stringBuffer.toString() + "\""); } } else if (entityName == fGtSymbol) { stringBuffer.append('>'); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** valueB: \"" + stringBuffer.toString() + "\""); } } else if (entityName == fQuotSymbol) { stringBuffer.append('"'); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** valueD: \"" + stringBuffer.toString() + "\""); } } else { if (fEntityStore.isExternalEntity(entityName)) { reportFatalError("ReferenceToExternalEntity", new Object[] { entityName }); } else { if (!fEntityStore.isDeclaredEntity(entityName)) { //WFC & VC: Entity Declared if (checkEntities) { if (fValidation) { fErrorReporter.reportError(fEntityScanner,XMLMessageFormatter.XML_DOMAIN, "EntityNotDeclared", new Object[]{entityName}, XMLErrorReporter.SEVERITY_ERROR); } } else { reportFatalError("EntityNotDeclared", new Object[]{entityName}); } } fEntityManager.startEntity(entityName, true); } } } } else if (c == '<') { reportFatalError("LessthanInAttValue", new Object[] { null, atName }); fEntityScanner.scanChar(); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append((char)c); } } else if (c == '%' || c == ']') { fEntityScanner.scanChar(); stringBuffer.append((char)c); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append((char)c); } if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** valueF: \"" + stringBuffer.toString() + "\""); } } else if (c == '\n' || c == '\r') { fEntityScanner.scanChar(); stringBuffer.append(' '); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append('\n'); } } else if (c != -1 && XMLChar.isHighSurrogate(c)) { if (scanSurrogates(fStringBuffer3)) { stringBuffer.append(fStringBuffer3); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append(fStringBuffer3); } if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** valueI: \"" + stringBuffer.toString() + "\""); } } } else if (c != -1 && isInvalidLiteral(c)) { reportFatalError("InvalidCharInAttValue", new Object[] {Integer.toString(c, 16)}); fEntityScanner.scanChar(); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append((char)c); } } c = fEntityScanner.scanLiteral(quote, value); if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) { fStringBuffer2.append(value); } if(fEntityScanner.whiteSpaceLen > 0) normalizeWhitespace(value); //Todo ::Move this check to Attributes , do conversion //only if attribute is being accessed. -Venu } while (c != quote || entityDepth != fEntityDepth); stringBuffer.append(value); if (DEBUG_ATTR_NORMALIZATION) { System.out.println("** valueN: \"" + stringBuffer.toString() + "\""); } value.setValues(stringBuffer); fScanningAttribute = false; } if(fNeedNonNormalizedValue) nonNormalizedValue.setValues(fStringBuffer2); // quote int cquote = fEntityScanner.scanChar(); if (cquote != quote) { reportFatalError("CloseQuoteExpected", new Object[]{atName}); } } // scanAttributeValue() /** * Scans External ID and return the public and system IDs. * * @param identifiers An array of size 2 to return the system id, * and public id (in that order). * @param optionalSystemId Specifies whether the system id is optional. * * <strong>Note:</strong> This method uses fString and fStringBuffer, * anything in them at the time of calling is lost. */ protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException, XNIException { String systemId = null; String publicId = null; if (fEntityScanner.skipString("PUBLIC")) { if (!fEntityScanner.skipSpaces()) { reportFatalError("SpaceRequiredAfterPUBLIC", null); } scanPubidLiteral(fString); publicId = fString.toString(); if (!fEntityScanner.skipSpaces() && !optionalSystemId) { reportFatalError("SpaceRequiredBetweenPublicAndSystem", null); } } if (publicId != null || fEntityScanner.skipString("SYSTEM")) { if (publicId == null && !fEntityScanner.skipSpaces()) { reportFatalError("SpaceRequiredAfterSYSTEM", null); } int quote = fEntityScanner.peekChar(); if (quote != '\'' && quote != '"') { if (publicId != null && optionalSystemId) { // looks like we don't have any system id // simply return the public id identifiers[0] = null; identifiers[1] = publicId; return; } reportFatalError("QuoteRequiredInSystemID", null); } fEntityScanner.scanChar(); XMLString ident = fString; if (fEntityScanner.scanLiteral(quote, ident) != quote) { fStringBuffer.clear(); do { fStringBuffer.append(ident); int c = fEntityScanner.peekChar(); if (XMLChar.isMarkup(c) || c == ']') { fStringBuffer.append((char)fEntityScanner.scanChar()); } else if (c != -1 && isInvalidLiteral(c)) { reportFatalError("InvalidCharInSystemID", new Object[] {Integer.toString(c, 16)}); } } while (fEntityScanner.scanLiteral(quote, ident) != quote); fStringBuffer.append(ident); ident = fStringBuffer; } systemId = ident.toString(); if (!fEntityScanner.skipChar(quote)) { reportFatalError("SystemIDUnterminated", null); } } // store result in array identifiers[0] = systemId; identifiers[1] = publicId; } /** * Scans public ID literal. * * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] * * The returned string is normalized according to the following rule, * from http://www.w3.org/TR/REC-xml#dt-pubid: * * Before a match is attempted, all strings of white space in the public * identifier must be normalized to single space characters (#x20), and * leading and trailing white space must be removed. * * @param literal The string to fill in with the public ID literal. * @return True on success. * * <strong>Note:</strong> This method uses fStringBuffer, anything in it at * the time of calling is lost. */ protected boolean scanPubidLiteral(XMLString literal) throws IOException, XNIException { int quote = fEntityScanner.scanChar(); if (quote != '\'' && quote != '"') { reportFatalError("QuoteRequiredInPublicID", null); return false; } fStringBuffer.clear(); // skip leading whitespace boolean skipSpace = true; boolean dataok = true; while (true) { int c = fEntityScanner.scanChar(); if (c == ' ' || c == '\n' || c == '\r') { if (!skipSpace) { // take the first whitespace as a space and skip the others fStringBuffer.append(' '); skipSpace = true; } } else if (c == quote) { if (skipSpace) { // if we finished on a space let's trim it fStringBuffer.length--; } literal.setValues(fStringBuffer); break; } else if (XMLChar.isPubid(c)) { fStringBuffer.append((char)c); skipSpace = false; } else if (c == -1) { reportFatalError("PublicIDUnterminated", null); return false; } else { dataok = false; reportFatalError("InvalidCharInPublicID", new Object[]{Integer.toHexString(c)}); } } return dataok; } /** * Normalize whitespace in an XMLString converting all whitespace * characters to space characters. */ protected void normalizeWhitespace(XMLString value) { int i=0; int j=0; int [] buff = fEntityScanner.whiteSpaceLookup; int buffLen = fEntityScanner.whiteSpaceLen; int end = value.offset + value.length; while(i < buffLen){ j = buff[i]; if(j < end ){ value.ch[j] = ' '; } i++; } } // // XMLEntityHandler methods // /** * This method notifies of the start of an entity. The document entity * has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]" * parameter entity names start with '%'; and general entities are just * specified by their name. * * @param name The name of the entity. * @param identifier The resource identifier. * @param encoding The auto-detected IANA encoding name of the entity * stream. This value will be null in those situations * where the entity encoding is not auto-detected (e.g. * internal entities or a document entity that is * parsed from a java.io.Reader). * * @throws XNIException Thrown by handler to signal an error. */ public void startEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs) throws XNIException { // keep track of the entity depth fEntityDepth++; // must reset entity scanner fEntityScanner = fEntityManager.getEntityScanner(); fEntityStore = fEntityManager.getEntityStore() ; } // startEntity(String,XMLResourceIdentifier,String) /** * This method notifies the end of an entity. The document entity has * the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]" * parameter entity names start with '%'; and general entities are just * specified by their name. * * @param name The name of the entity. * * @throws XNIException Thrown by handler to signal an error. */ public void endEntity(String name, Augmentations augs) throws IOException, XNIException { // keep track of the entity depth fEntityDepth--; } // endEntity(String) /** * Scans a character reference and append the corresponding chars to the * specified buffer. * * <p> * <pre> * [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' * </pre> * * <strong>Note:</strong> This method uses fStringBuffer, anything in it * at the time of calling is lost. * * @param buf the character buffer to append chars to * @param buf2 the character buffer to append non-normalized chars to * * @return the character value or (-1) on conversion failure */ protected int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws IOException, XNIException { // scan hexadecimal value boolean hex = false; if (fEntityScanner.skipChar('x')) { if (buf2 != null) { buf2.append('x'); } hex = true; fStringBuffer3.clear(); boolean digit = true; int c = fEntityScanner.peekChar(); digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); if (digit) { if (buf2 != null) { buf2.append((char)c); } fEntityScanner.scanChar(); fStringBuffer3.append((char)c); do { c = fEntityScanner.peekChar(); digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); if (digit) { if (buf2 != null) { buf2.append((char)c); } fEntityScanner.scanChar(); fStringBuffer3.append((char)c); } } while (digit); } else { reportFatalError("HexdigitRequiredInCharRef", null); } } // scan decimal value else { fStringBuffer3.clear(); boolean digit = true; int c = fEntityScanner.peekChar(); digit = c >= '0' && c <= '9'; if (digit) { if (buf2 != null) { buf2.append((char)c); } fEntityScanner.scanChar(); fStringBuffer3.append((char)c); do { c = fEntityScanner.peekChar(); digit = c >= '0' && c <= '9'; if (digit) { if (buf2 != null) { buf2.append((char)c); } fEntityScanner.scanChar(); fStringBuffer3.append((char)c); } } while (digit); } else { reportFatalError("DigitRequiredInCharRef", null); } } // end if (!fEntityScanner.skipChar(';')) { reportFatalError("SemicolonRequiredInCharRef", null); } if (buf2 != null) { buf2.append(';'); } // convert string to number int value = -1; try { value = Integer.parseInt(fStringBuffer3.toString(), hex ? 16 : 10); // character reference must be a valid XML character if (isInvalid(value)) { StringBuffer errorBuf = new StringBuffer(fStringBuffer3.length + 1); if (hex) errorBuf.append('x'); errorBuf.append(fStringBuffer3.ch, fStringBuffer3.offset, fStringBuffer3.length); reportFatalError("InvalidCharRef", new Object[]{errorBuf.toString()}); } } catch (NumberFormatException e) { // Conversion failed, let -1 value drop through. // If we end up here, the character reference was invalid. StringBuffer errorBuf = new StringBuffer(fStringBuffer3.length + 1); if (hex) errorBuf.append('x'); errorBuf.append(fStringBuffer3.ch, fStringBuffer3.offset, fStringBuffer3.length); reportFatalError("InvalidCharRef", new Object[]{errorBuf.toString()}); } // append corresponding chars to the given buffer if (!XMLChar.isSupplemental(value)) { buf.append((char) value); } else { // character is supplemental, split it into surrogate chars buf.append(XMLChar.highSurrogate(value)); buf.append(XMLChar.lowSurrogate(value)); } // char refs notification code if (fNotifyCharRefs && value != -1) { String literal = "#" + (hex ? "x" : "") + fStringBuffer3.toString(); if (!fScanningAttribute) { fCharRefLiteral = literal; } } return value; } // returns true if the given character is not // valid with respect to the version of // XML understood by this scanner. protected boolean isInvalid(int value) { return (XMLChar.isInvalid(value)); } // isInvalid(int): boolean // returns true if the given character is not // valid or may not be used outside a character reference // with respect to the version of XML understood by this scanner. protected boolean isInvalidLiteral(int value) { return (XMLChar.isInvalid(value)); } // isInvalidLiteral(int): boolean // returns true if the given character is // a valid nameChar with respect to the version of // XML understood by this scanner. protected boolean isValidNameChar(int value) { return (XMLChar.isName(value)); } // isValidNameChar(int): boolean // returns true if the given character is // a valid NCName character with respect to the version of // XML understood by this scanner. protected boolean isValidNCName(int value) { return (XMLChar.isNCName(value)); } // isValidNCName(int): boolean // returns true if the given character is // a valid nameStartChar with respect to the version of // XML understood by this scanner. protected boolean isValidNameStartChar(int value) { return (XMLChar.isNameStart(value)); } // isValidNameStartChar(int): boolean protected boolean versionSupported(String version ) { return version.equals("1.0") || version.equals("1.1"); } // version Supported /** * Scans surrogates and append them to the specified buffer. * <p> * <strong>Note:</strong> This assumes the current char has already been * identified as a high surrogate. * * @param buf The StringBuffer to append the read surrogates to. * @return True if it succeeded. */ protected boolean scanSurrogates(XMLStringBuffer buf) throws IOException, XNIException { int high = fEntityScanner.scanChar(); int low = fEntityScanner.peekChar(); if (!XMLChar.isLowSurrogate(low)) { reportFatalError("InvalidCharInContent", new Object[] {Integer.toString(high, 16)}); return false; } fEntityScanner.scanChar(); // convert surrogates to supplemental character int c = XMLChar.supplemental((char)high, (char)low); // supplemental character must be a valid XML character if (isInvalid(c)) { reportFatalError("InvalidCharInContent", new Object[]{Integer.toString(c, 16)}); return false; } // fill in the buffer buf.append((char)high); buf.append((char)low); return true; } // scanSurrogates():boolean /** * Convenience function used in all XML scanners. */ protected void reportFatalError(String msgId, Object[] args) throws XNIException { fErrorReporter.reportError(fEntityScanner, XMLMessageFormatter.XML_DOMAIN, msgId, args, XMLErrorReporter.SEVERITY_FATAL_ERROR); } // private methods private void init() { // initialize scanner fEntityScanner = null; // initialize vars fEntityDepth = 0; fReportEntity = true; fResourceIdentifier.clear(); if(!fAttributeCacheInitDone){ for(int i = 0; i < initialCacheCount; i++){ attributeValueCache.add(new XMLString()); stringBufferCache.add(new XMLStringBuffer()); } fAttributeCacheInitDone = true; } fStringBufferIndex = 0; fAttributeCacheUsedCount = 0; } XMLStringBuffer getStringBuffer(){ if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){ return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++); }else{ XMLStringBuffer tmpObj = new XMLStringBuffer(); fStringBufferIndex++; stringBufferCache.add(tmpObj); return tmpObj; } } } // class XMLScanner
[ "oldshipmaster@163.com" ]
oldshipmaster@163.com
6828448c55c21cb94accc8d79dcfc727257b891d
c0ab856562f6055eb038ebe171195091c63d5477
/elasticsearch/src/main/java/io/bissal/spring/elastic/test/service/StatusService.java
cc82b457c1dbce619a784193687c70c63ddf4711
[]
no_license
gwakokdong/springboot2
1e27d920f1032c8f53b495bdffbe4b6b10632376
6e05681370110a86d8a8e305ddaee8809d417660
refs/heads/master
2022-12-27T18:40:39.876041
2020-10-14T11:22:58
2020-10-14T11:22:58
289,871,288
0
0
null
2020-08-24T08:29:28
2020-08-24T08:29:27
null
UTF-8
Java
false
false
1,763
java
package io.bissal.spring.elastic.test.service; import io.bissal.spring.elastic.test.dao.CpuAndMemDao; import io.bissal.spring.elastic.test.dao.ProcessListDao; import io.bissal.spring.elastic.test.dao.ServerListDao; import io.bissal.spring.elastic.test.model.elastic.server.CpuAndMem; import io.bissal.spring.elastic.test.model.elastic.server.Server; import io.bissal.spring.elastic.test.model.elastic.server.ServerDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service public class StatusService { @Autowired private ServerListDao serverListDao; @Autowired private CpuAndMemDao cpuAndMemDao; @Autowired private ProcessListDao processListDao; public List<Server> list() { List<String> serverIds = serverListDao.searchEachServers(); List<Server> servers = new ArrayList<>(); for (String hostId : serverIds) { CpuAndMem cpuAndMem = cpuAndMemDao.stat(hostId); Server server = new Server(); server.setId(hostId); server.setCpu(cpuAndMem.getCpu()); server.setMemory(cpuAndMem.getMemory()); servers.add(server); } return servers; } public ServerDetail serverDetail(String serverId) { List<String> processes = processListDao.server(serverId); CpuAndMem cpuAndMem = cpuAndMemDao.stat(serverId); ServerDetail serverDetail = new ServerDetail(); serverDetail.setId(serverId); serverDetail.setProcesses(processes); serverDetail.setCpu(cpuAndMem.getCpu()); serverDetail.setMemory(cpuAndMem.getMemory()); return serverDetail; } }
[ "gwak.okdong@ucomp.co.kr" ]
gwak.okdong@ucomp.co.kr
f7acaf95fb08bde295bb28abbe2b567beb9a96c3
a0977800f50c65eb5c002de93ad05b6ba94eb6cf
/viikko09-Viikko09_159.OpiskelijatNimijarjestykseen/src/Opiskelija.java
8035a24aaaf087c1f47d872efbb739c01e0894af
[]
no_license
TeroPiironen/2016-nodl-ohjelmointi
f4988b74cce7ee549f33b0acfd2b7a2975312f29
73158359999ad9a974bc362cb39d3a8a6b8dabef
refs/heads/master
2020-05-02T18:42:41.573341
2016-11-20T20:18:07
2016-11-20T20:18:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
430
java
public class Opiskelija implements Comparable<Opiskelija> { private String nimi; public Opiskelija(String nimi) { this.nimi = nimi; } public String getNimi() { return nimi; } @Override public String toString() { return nimi; } @Override public int compareTo(Opiskelija opiskelija) { return this.nimi.compareToIgnoreCase(opiskelija.getNimi()); } }
[ "jaanamatil@gmail.com" ]
jaanamatil@gmail.com
209872a7497b3fca05971ef92857c79616b7404d
44da6761da6b60dbb99b7020aa4e788d7df0c865
/Android/dai0402/src/dai0402/Shoes.java
b92b8bb1193ea1c60bd54a44cbe80804b16c82aa
[]
no_license
nainainainai1/web
6a7fe8cb4db71755b79770c7e0c1e2862b6c11a0
087f756102b819b861563524942cf024cbcda06e
refs/heads/master
2020-04-13T04:40:40.222277
2019-07-29T04:51:14
2019-07-29T04:51:14
162,968,053
1
0
null
2019-10-30T23:52:27
2018-12-24T08:22:17
HTML
UTF-8
Java
false
false
76
java
package dai0402; public interface Shoes { public abstract void shoes(); }
[ "824978607@qq.com" ]
824978607@qq.com
3a193228ac5fa0f52bd6b6cd1a3aa410c38931a5
6ddf343c73318ebf74658a92cea53db0a2256553
/src/main/java/com/followspace/spaceshipinfo/Controller/SpaceshipController.java
c2a82ab1140c35d148bddbd5fab45447c85a3e69
[]
no_license
AliAnsari777/FollowSpace
350c81dfc09eeae1b0a82aee1199635fed279eea
f02ac8bdb9dc9e303a6998eef7b2e833813cce9c
refs/heads/master
2022-11-16T18:56:49.827522
2020-07-11T07:58:16
2020-07-11T07:58:16
270,078,154
1
0
null
2020-06-06T21:32:38
2020-06-06T19:10:28
Java
UTF-8
Java
false
false
3,011
java
package com.followspace.spaceshipinfo.Controller; import com.followspace.spaceshipinfo.Midelware.Jwiki; import com.followspace.spaceshipinfo.Models.AllInformation; import com.followspace.spaceshipinfo.Models.Crew; import com.followspace.spaceshipinfo.Models.Location; import com.followspace.spaceshipinfo.Models.Personnel; import com.followspace.spaceshipinfo.Services.RequestInfo; import com.followspace.spaceshipinfo.Services.impl.SpaceshipImplementation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Map; @RestController @RequestMapping("/api/v1/followspace") public class SpaceshipController { private RequestInfo requestInfo; private Crew crew; private List<Crew> listOfCrewInformation = new ArrayList<>(); private Location location; private AllInformation allInformation; private SpaceshipImplementation spaceshipImplementation; @Autowired public SpaceshipController(RequestInfo requestInfo, Crew crew, Location location, AllInformation allInformation, SpaceshipImplementation spaceshipImplementation) { this.requestInfo = requestInfo; this.crew = crew; this.location = location; this.allInformation = allInformation; this.spaceshipImplementation = spaceshipImplementation; } @GetMapping("/{ID}") public AllInformation getAllInformation(@PathVariable("ID") String ID){ location = requestInfo.getLocation(ID); crew = requestInfo.getCrew(ID); allInformation.setCrew(crew); allInformation.setLocation(location); return allInformation; } @GetMapping("/{ID}/location") public Location getLocation(@PathVariable("ID") String ID){ return requestInfo.getLocation(ID); } @GetMapping("/{ID}/crew") public Crew getCrew(@PathVariable("ID") String ID){ return requestInfo.getCrew(ID); } @GetMapping("/{ID}/personnel") public List<Crew> getPersonnel(@PathVariable("ID") String ID){ Personnel personnel = requestInfo.getPersonnel(ID); int crewSize = personnel.getPeople().size(); Map<String, String> person; for (int i = 0; i < crewSize; i++) { Crew onePerson = new Crew(); person = personnel.getPeople().get(i); onePerson.setName(person.get("name")); onePerson.setMember(person.get("craft")); onePerson.setNumber(personnel.getNumber()); Jwiki jwiki = new Jwiki(person.get("name")); onePerson.setAbout(jwiki.getExtractText()); onePerson.setProfilePic(jwiki.getImageURL()); listOfCrewInformation.add(onePerson); } return listOfCrewInformation; } @PostMapping(path = "/{ID}/crew/post") public Crew postCrew(@RequestBody Crew crew){ return spaceshipImplementation.postCrew(crew); } }
[ "alidk2013@gmail.com" ]
alidk2013@gmail.com
532611ce3e25ecadf905038351119ab06ea2c4a8
c62726a703d99a8510996e8cfbd152167b9ba80a
/buyerTool/src/main/java/com/nahuo/buyertool/BaseNoTitleActivity.java
fde0d65c559e52a60a4d4619b695fbff4ebbe302
[]
no_license
JameChen/buyertools
e16c833d513692ccba9abd69248d1911da172afc
cf0ae14a68bc68c8d1041d788ac6855952b7beb6
refs/heads/master
2020-07-12T20:14:46.000632
2019-08-28T09:54:24
2019-08-28T09:58:16
204,896,443
1
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.nahuo.buyertool; /** * @description 没标题activity:requestFeature(Window.FEATURE_NO_TITLE); * @created 2015-5-5 下午2:13:25 * @author ZZB */ public class BaseNoTitleActivity extends BaseActivity1{ @Override protected AbstractActivity getAbsActivity() { return new AbstractActivity(true); } }
[ "1210686304@qq.com" ]
1210686304@qq.com
82807b7b4c330a95113e4107b1e10b88f964d090
88c02d49d669c7637bbca9fd1f570cc7292f484f
/AndroidJniGenerate/GetJniCode/xwebruntime_javacode/android/support/v4/R.java
2c5a46d819b140f1d87dd08a27d1365d03431b04
[]
no_license
ghost461/AndroidMisc
1af360cf36ae212a81814f9a4057884290dbe12e
dfa4c9115c0198755c9ff6c5e5c9ea3b56c9daff
refs/heads/master
2020-09-07T19:17:00.028887
2019-11-11T02:55:33
2019-11-11T02:55:33
220,887,476
0
0
null
null
null
null
UTF-8
Java
false
false
9,985
java
package android.support.v4; public final class R { public final class attr { public static final int font = 0x7F020071; public static final int fontProviderAuthority = 0x7F020073; public static final int fontProviderCerts = 0x7F020074; public static final int fontProviderFetchStrategy = 0x7F020075; public static final int fontProviderFetchTimeout = 0x7F020076; public static final int fontProviderPackage = 0x7F020077; public static final int fontProviderQuery = 0x7F020078; public static final int fontStyle = 0x7F020079; public static final int fontWeight = 0x7F02007A; public attr() { super(); } } public final class bool { public static final int abc_action_bar_embed_tabs = 0x7F030000; public bool() { super(); } } public final class color { public static final int notification_action_color_filter = 0x7F040046; public static final int notification_icon_bg_color = 0x7F040047; public static final int notification_material_background_media_default_color = 0x7F040048; public static final int primary_text_default_material_dark = 0x7F04004D; public static final int ripple_material_light = 0x7F040052; public static final int secondary_text_default_material_dark = 0x7F040053; public static final int secondary_text_default_material_light = 0x7F040054; public color() { super(); } } public final class dimen { public static final int compat_button_inset_horizontal_material = 0x7F05004C; public static final int compat_button_inset_vertical_material = 0x7F05004D; public static final int compat_button_padding_horizontal_material = 0x7F05004E; public static final int compat_button_padding_vertical_material = 0x7F05004F; public static final int compat_control_corner_material = 0x7F050050; public static final int notification_action_icon_size = 0x7F05006A; public static final int notification_action_text_size = 0x7F05006B; public static final int notification_big_circle_margin = 0x7F05006C; public static final int notification_content_margin_start = 0x7F05006D; public static final int notification_large_icon_height = 0x7F05006E; public static final int notification_large_icon_width = 0x7F05006F; public static final int notification_main_column_padding_top = 0x7F050070; public static final int notification_media_narrow_margin = 0x7F050071; public static final int notification_right_icon_size = 0x7F050072; public static final int notification_right_side_padding_top = 0x7F050073; public static final int notification_small_icon_background_padding = 0x7F050074; public static final int notification_small_icon_size_as_large = 0x7F050075; public static final int notification_subtext_size = 0x7F050076; public static final int notification_top_pad = 0x7F050077; public static final int notification_top_pad_large_text = 0x7F050078; public dimen() { super(); } } public final class drawable { public static final int notification_action_background = 0x7F060064; public static final int notification_bg = 0x7F060065; public static final int notification_bg_low = 0x7F060066; public static final int notification_bg_low_normal = 0x7F060067; public static final int notification_bg_low_pressed = 0x7F060068; public static final int notification_bg_normal = 0x7F060069; public static final int notification_bg_normal_pressed = 0x7F06006A; public static final int notification_icon_background = 0x7F06006B; public static final int notification_template_icon_bg = 0x7F06006C; public static final int notification_template_icon_low_bg = 0x7F06006D; public static final int notification_tile_bg = 0x7F06006E; public static final int notify_panel_notification_icon_bg = 0x7F06006F; public drawable() { super(); } } public final class id { public static final int action0 = 0x7F070006; public static final int action_container = 0x7F07000E; public static final int action_divider = 0x7F070010; public static final int action_image = 0x7F070011; public static final int action_text = 0x7F070017; public static final int actions = 0x7F070018; public static final int async = 0x7F070020; public static final int blocking = 0x7F070024; public static final int cancel_action = 0x7F070027; public static final int chronometer = 0x7F070029; public static final int end_padder = 0x7F070044; public static final int forever = 0x7F070047; public static final int icon = 0x7F07004D; public static final int icon_group = 0x7F07004E; public static final int info = 0x7F070056; public static final int italic = 0x7F070057; public static final int line1 = 0x7F07005E; public static final int line3 = 0x7F07005F; public static final int media_actions = 0x7F070063; public static final int normal = 0x7F07006D; public static final int notification_background = 0x7F07006E; public static final int notification_main_column = 0x7F07006F; public static final int notification_main_column_container = 0x7F070070; public static final int right_icon = 0x7F07007E; public static final int right_side = 0x7F07007F; public static final int status_bar_latest_event_content = 0x7F0700A9; public static final int text = 0x7F0700AF; public static final int text2 = 0x7F0700B0; public static final int time = 0x7F0700B5; public static final int title = 0x7F0700B7; public id() { super(); } } public final class integer { public static final int cancel_button_image_alpha = 0x7F080002; public static final int status_bar_notification_info_maxnum = 0x7F080005; public integer() { super(); } } public final class layout { public static final int notification_action = 0x7F090025; public static final int notification_action_tombstone = 0x7F090026; public static final int notification_media_action = 0x7F090027; public static final int notification_media_cancel_action = 0x7F090028; public static final int notification_template_big_media = 0x7F090029; public static final int notification_template_big_media_custom = 0x7F09002A; public static final int notification_template_big_media_narrow = 0x7F09002B; public static final int notification_template_big_media_narrow_custom = 0x7F09002C; public static final int notification_template_custom_big = 0x7F09002D; public static final int notification_template_icon_group = 0x7F09002E; public static final int notification_template_lines_media = 0x7F09002F; public static final int notification_template_media = 0x7F090030; public static final int notification_template_media_custom = 0x7F090031; public static final int notification_template_part_chronometer = 0x7F090032; public static final int notification_template_part_time = 0x7F090033; public layout() { super(); } } public final class string { public static final int status_bar_notification_info_overflow = 0x7F0C0074; public string() { super(); } } public final class style { public static final int TextAppearance_Compat_Notification = 0x7F0D0106; public static final int TextAppearance_Compat_Notification_Info = 0x7F0D0107; public static final int TextAppearance_Compat_Notification_Info_Media = 0x7F0D0108; public static final int TextAppearance_Compat_Notification_Line2 = 0x7F0D0109; public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7F0D010A; public static final int TextAppearance_Compat_Notification_Media = 0x7F0D010B; public static final int TextAppearance_Compat_Notification_Time = 0x7F0D010C; public static final int TextAppearance_Compat_Notification_Time_Media = 0x7F0D010D; public static final int TextAppearance_Compat_Notification_Title = 0x7F0D010E; public static final int TextAppearance_Compat_Notification_Title_Media = 0x7F0D010F; public static final int Widget_Compat_NotificationActionContainer = 0x7F0D0178; public static final int Widget_Compat_NotificationActionText = 0x7F0D0179; public style() { super(); } } public final class styleable { public static final int[] FontFamily = null; public static final int[] FontFamilyFont = null; public static final int FontFamilyFont_font = 0; public static final int FontFamilyFont_fontStyle = 1; public static final int FontFamilyFont_fontWeight = 2; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; static { styleable.FontFamily = new int[]{0x7F020073, 0x7F020074, 0x7F020075, 0x7F020076, 0x7F020077, 0x7F020078}; styleable.FontFamilyFont = new int[]{0x7F020071, 0x7F020079, 0x7F02007A}; } public styleable() { super(); } } public R() { super(); } }
[ "lingmilch@sina.com" ]
lingmilch@sina.com
6439ba91e29b69bc8550b398cc43127c613b3cff
d7c612ce8b9c67887a19aa0de149a8572613a02b
/src/binary_search/P3_6_IdTester.java
e3f12b95d7e54f4a010593d5117d19e0f49340ec
[]
no_license
Kim-JunTae/Algorithm-DataStructure
804d16df241705998986c51c820b24dbd4b5cc5c
7e19afe0f65efe0c3cb0e188c4eccbebf3c350f9
refs/heads/master
2022-12-27T19:24:52.642213
2020-10-15T04:25:36
2020-10-15T04:25:36
264,686,892
0
0
null
null
null
null
UHC
Java
false
false
512
java
package binary_search; class Id{ private static int counter = 0; private int id; public Id() {id = ++counter;} public int getId() {return id;} public static int getCounter() {return counter;} } public class P3_6_IdTester { public static void main(String[] args) { Id a = new Id(); Id b = new Id(); System.out.println("a의 아이디 : " + a.getId()); System.out.println("b의 아이디 : " + b.getId()); System.out.println("부여한 아이디의 갯수 : " + Id.getCounter()); } }
[ "rardin@naver.com" ]
rardin@naver.com
836a3528389bc631bf9d3811ffd07d235a4db844
6bd216f265ad143a9e64fb2f1190eca11b22d97a
/src/main/java/cn/luowq/spider/executor/TestExecutor.java
a74b7f5861265b7d57271f31f4d124f9b6e25478
[]
no_license
rowankid/MySpider
31d9b788087971f5572c4ebb8ca8dc0ee9b96e4c
ab3cf5c5636f39139a52a281f9071759dfd0893b
refs/heads/master
2022-04-28T09:40:51.815800
2022-03-08T01:45:43
2022-03-08T01:45:43
153,245,458
0
0
null
2022-03-08T01:45:44
2018-10-16T07:56:34
Java
UTF-8
Java
false
false
1,340
java
package cn.luowq.spider.executor; import java.util.concurrent.*; /** * @Auther: rowan * @Date: 2018/9/29 14:23 * @Description: */ public class TestExecutor { private static volatile Integer count = 1; //执行标识 private static Boolean exeFlag = true; public static void main(String[] args) { //创建ExecutorService 连接池大小默认10个 //TODO ThreadPoolExecutor ExecutorService executorService = Executors.newFixedThreadPool(10); while(exeFlag){ executorService.execute(new Runnable() { synchronized public void run() { if(count<=100){ System.out.println("计数:"+count); count++; }else{ exeFlag=false; } } }); } //没有活动线程 if (((ThreadPoolExecutor)executorService).getActiveCount()==0){ executorService.shutdown(); System.out.println("结束:"+count); } // try { // Thread.sleep(100); // } catch (InterruptedException e) { // e.printStackTrace(); // } } }
[ "495872803@qq.com" ]
495872803@qq.com
b5363eb9f6bfcaf0b9b157d7c78b7d82ec0857a8
e7e9a2a58e01a0254552113e0817c7d7df763e38
/src/main/java/com/gsc/bm/service/view/ViewExtractorService.java
f2422058c82f54782fd3efb94e794dc22965ddea
[ "LicenseRef-scancode-generic-cla" ]
no_license
gesucca-official/bm-server
a7d391b88b0e83644c6a4474ea326f66057e45e5
0a9371e721244107163804319f44c6501c6db086
refs/heads/master
2023-03-26T22:18:52.131989
2021-03-03T11:01:35
2021-03-03T11:01:35
342,204,010
1
0
null
null
null
null
UTF-8
Java
false
false
513
java
package com.gsc.bm.service.view; import com.gsc.bm.model.Character; import com.gsc.bm.model.game.Game; import com.gsc.bm.service.view.model.client.ClientGameView; import com.gsc.bm.service.view.model.deck.CharacterCardView; import com.gsc.bm.service.view.model.logging.SlimGameView; public interface ViewExtractorService { SlimGameView extractGlobalSlimView(Game game); ClientGameView extractViewFor(Game game, String playerId); CharacterCardView extractDeckBuildingView(Character character); }
[ "gesucca.official@gmail.com" ]
gesucca.official@gmail.com
287c7ecacb6ad78f40916020ea0c58a4d2c2fa20
6838e6a3fa35642fa03e98f06371dc4a3da658d3
/atlasdb-cassandra/src/test/java/com/palantir/atlasdb/cassandra/QosCassandraClientTest.java
f31e14cab343facf4abaeef6f23ef037421975cd
[ "Apache-2.0" ]
permissive
EvilMcJerkface/atlasdb
9d1fff7ee5bb271dbbdaa1d8bf0b5fd77e408846
51f6982041ef80e153d6fb9b64c02334e36500cc
refs/heads/develop
2021-01-24T01:12:26.232843
2020-11-17T17:43:12
2020-11-17T17:43:12
48,127,911
0
0
null
2015-12-16T18:32:42
2015-12-16T18:32:41
null
UTF-8
Java
false
false
11,060
java
/* * (c) Copyright 2018 Palantir Technologies Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.palantir.atlasdb.cassandra; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.when; import com.google.common.base.Ticker; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.palantir.atlasdb.encoding.PtBytes; import com.palantir.atlasdb.keyvalue.api.TableReference; import com.palantir.atlasdb.keyvalue.cassandra.CassandraClient; import com.palantir.atlasdb.keyvalue.cassandra.CqlQuery; import com.palantir.atlasdb.keyvalue.cassandra.QosCassandraClient; import com.palantir.atlasdb.keyvalue.cassandra.thrift.QueryWeight; import com.palantir.atlasdb.keyvalue.cassandra.thrift.SlicePredicates; import com.palantir.atlasdb.keyvalue.cassandra.thrift.ThriftQueryWeighers; import com.palantir.atlasdb.qos.metrics.QosMetrics; import java.nio.ByteBuffer; import java.util.List; import java.util.Map; import javax.naming.LimitExceededException; import org.apache.cassandra.thrift.Column; import org.apache.cassandra.thrift.ColumnOrSuperColumn; import org.apache.cassandra.thrift.Compression; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.thrift.CqlResult; import org.apache.cassandra.thrift.KeyRange; import org.apache.cassandra.thrift.KeySlice; import org.apache.cassandra.thrift.Mutation; import org.apache.cassandra.thrift.SlicePredicate; import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; public class QosCassandraClientTest { private final CassandraClient mockClient = mock(CassandraClient.class); private final QosMetrics mockMetrics = mock(QosMetrics.class); private final Ticker ticker = mock(Ticker.class); private static final long NANOS_START = 1L; private static final long NANOS_END = 13L; private static final long NANOS_DURATION = NANOS_END - NANOS_START; private static final ByteBuffer ROW_KEY = ByteBuffer.wrap(PtBytes.toBytes("key")); private static final TableReference TEST_TABLE = TableReference.createFromFullyQualifiedName("foo.bar"); private static final SlicePredicate SLICE_PREDICATE = SlicePredicates.create(SlicePredicates.Range.ALL, SlicePredicates.Limit.ONE); private static final Map<ByteBuffer, List<ColumnOrSuperColumn>> MULTIGET_RESULT = ImmutableMap.of(ROW_KEY, ImmutableList.of(new ColumnOrSuperColumn())); private static final ImmutableMap<ByteBuffer, Map<String, List<Mutation>>> BATCH_MUTATE_ARG = ImmutableMap.of(ROW_KEY, ImmutableMap.of()); private static final CqlQuery CQL_QUERY = CqlQuery.builder() .safeQueryFormat("SELECT * FROM test_table LIMIT 1") .build(); private static final KeyRange KEY_RANGE = new KeyRange(); private CassandraClient client; @Before public void setUp() { client = new QosCassandraClient(mockClient, mockMetrics, ticker); when(ticker.read()).thenReturn(NANOS_START).thenReturn(NANOS_END); } @Test public void multigetSliceRecordsMetricsOnSuccess() throws TException, LimitExceededException { when(mockClient.multiget_slice(any(), any(), any(), any(), any())).thenReturn(MULTIGET_RESULT); QueryWeight expectedWeight = ThriftQueryWeighers.multigetSlice(ImmutableList.of(ROW_KEY)) .weighSuccess(MULTIGET_RESULT, NANOS_DURATION); client.multiget_slice("get", TEST_TABLE, ImmutableList.of(ROW_KEY), SLICE_PREDICATE, ConsistencyLevel.ANY); verify(mockClient, times(1)) .multiget_slice("get", TEST_TABLE, ImmutableList.of(ROW_KEY), SLICE_PREDICATE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void multigetSliceRecordsMetricsOnFailure() throws TException, LimitExceededException { when(mockClient.multiget_slice(any(), any(), any(), any(), any())).thenThrow(new RuntimeException()); QueryWeight expectedWeight = ThriftQueryWeighers.multigetSlice(ImmutableList.of(ROW_KEY)) .weighFailure(new RuntimeException(), NANOS_DURATION); assertThatThrownBy(() -> client.multiget_slice( "get", TEST_TABLE, ImmutableList.of(ROW_KEY), SLICE_PREDICATE, ConsistencyLevel.ANY)) .isInstanceOf(RuntimeException.class); verify(mockClient, times(1)) .multiget_slice("get", TEST_TABLE, ImmutableList.of(ROW_KEY), SLICE_PREDICATE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void batchMutateRecordsMetricsOnSuccess() throws TException, LimitExceededException { QueryWeight expectedWeight = ThriftQueryWeighers.batchMutate(BATCH_MUTATE_ARG).weighSuccess(null, NANOS_DURATION); client.batch_mutate("put", BATCH_MUTATE_ARG, ConsistencyLevel.ANY); verify(mockClient, times(1)).batch_mutate("put", BATCH_MUTATE_ARG, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordWrite(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void batchMutateRecordsMetricsOnFailure() throws TException, LimitExceededException { doThrow(new RuntimeException()).when(mockClient).batch_mutate(any(), any(), any()); QueryWeight expectedWeight = ThriftQueryWeighers.batchMutate(BATCH_MUTATE_ARG).weighSuccess(null, NANOS_DURATION); assertThatThrownBy(() -> client.batch_mutate("put", BATCH_MUTATE_ARG, ConsistencyLevel.ANY)) .isInstanceOf(RuntimeException.class); verify(mockClient, times(1)).batch_mutate("put", BATCH_MUTATE_ARG, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordWrite(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void executeCqlQueryRecordsMetricsOnSuccess() throws TException, LimitExceededException { CqlResult emptyResult = new CqlResult(); when(mockClient.execute_cql3_query(any(), any(), any())).thenReturn(emptyResult); QueryWeight expectedWeight = ThriftQueryWeighers.EXECUTE_CQL3_QUERY.weighSuccess(emptyResult, NANOS_DURATION); client.execute_cql3_query(CQL_QUERY, Compression.NONE, ConsistencyLevel.ANY); verify(mockClient, times(1)).execute_cql3_query(CQL_QUERY, Compression.NONE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void executeCqlQueryRecordsMetricsOnFailure() throws TException, LimitExceededException { when(mockClient.execute_cql3_query(any(), any(), any())).thenThrow(new RuntimeException()); QueryWeight expectedWeight = ThriftQueryWeighers.EXECUTE_CQL3_QUERY.weighFailure(new RuntimeException(), NANOS_DURATION); assertThatThrownBy(() -> client.execute_cql3_query(CQL_QUERY, Compression.NONE, ConsistencyLevel.ANY)) .isInstanceOf(RuntimeException.class); verify(mockClient, times(1)).execute_cql3_query(CQL_QUERY, Compression.NONE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void getRangeSlicesRecordsMetricsOnSuccess() throws TException, LimitExceededException { List<KeySlice> keySlices = ImmutableList.of(); when(mockClient.get_range_slices(any(), any(), any(), any(), any())).thenReturn(keySlices); QueryWeight expectedWeight = ThriftQueryWeighers.getRangeSlices(KEY_RANGE).weighSuccess(keySlices, NANOS_DURATION); client.get_range_slices("get", TEST_TABLE, SLICE_PREDICATE, KEY_RANGE, ConsistencyLevel.ANY); verify(mockClient, times(1)) .get_range_slices("get", TEST_TABLE, SLICE_PREDICATE, KEY_RANGE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void getRangeSlicesRecordsMetricsOnFailure() throws TException, LimitExceededException { when(mockClient.get_range_slices(any(), any(), any(), any(), any())).thenThrow(new RuntimeException()); QueryWeight expectedWeight = ThriftQueryWeighers.getRangeSlices(KEY_RANGE).weighFailure(new RuntimeException(), NANOS_DURATION); assertThatThrownBy(() -> client.get_range_slices("get", TEST_TABLE, SLICE_PREDICATE, KEY_RANGE, ConsistencyLevel.ANY)) .isInstanceOf(RuntimeException.class); verify(mockClient, times(1)) .get_range_slices("get", TEST_TABLE, SLICE_PREDICATE, KEY_RANGE, ConsistencyLevel.ANY); verifyNoMoreInteractions(mockClient); verify(mockMetrics, times(1)).recordRead(expectedWeight); verifyNoMoreInteractions(mockMetrics); } @Test public void casDoesNotUpdateMetrics() throws TException, LimitExceededException { client.cas( TEST_TABLE, ByteBuffer.allocate(1), ImmutableList.of(new Column()), ImmutableList.of(new Column()), ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL); verify(mockClient, times(1)) .cas( TEST_TABLE, ByteBuffer.allocate(1), ImmutableList.of(new Column()), ImmutableList.of(new Column()), ConsistencyLevel.SERIAL, ConsistencyLevel.SERIAL); verifyNoMoreInteractions(mockClient); verifyNoMoreInteractions(mockMetrics); } }
[ "noreply@github.com" ]
noreply@github.com
5b35328a90102d4a0b2c0fc797c03dce1b8c3e70
91c5f704129e44c501c46d60837b09f177bb3713
/20.1_TableSingleClassAnnotation/src/com/tpc/test/TableSingleClassTest.java
8d7fafc9928bea7b90af2803dedd1819bdaaae23
[]
no_license
shekhfiroz/orm_technology
54ec455a2363827b72a810c81925bd5662d8f6a5
41b0e25d1d15a4732b0e6bb6317c1959c10aad40
refs/heads/master
2020-03-14T21:53:07.140007
2018-07-11T18:36:45
2018-07-11T18:36:45
131,808,127
0
0
null
null
null
null
UTF-8
Java
false
false
1,713
java
package com.tpc.test; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import com.tpc.beans.CardPayment; import com.tpc.beans.ChequePayment; import com.tpc.beans.Payment; import com.tpc.helper.SessionHandler; public class TableSingleClassTest { public static void main(String[] args) { SessionFactory sessionFactory = null; Session session = null; Transaction transaction = null; boolean flag = false; try { sessionFactory = SessionHandler.getSessionFactory(); System.out.println("sessionFactory...." + sessionFactory); session = sessionFactory.openSession(); transaction = session.beginTransaction(); Payment payment = new Payment(); payment.setPaymentDate("18-june-18"); payment.setPaymentType("cash"); session.save(payment); ChequePayment chequePayment = new ChequePayment(); chequePayment.setPaymentDate("10-12-18"); chequePayment.setPaymentType("dd"); chequePayment.setChequeissueDate("23-june-18"); chequePayment.setChequeNo("as123"); chequePayment.setAmount(1234.4f); session.save(chequePayment); CardPayment cardPayment = new CardPayment(); cardPayment.setPaymentDate("10-21-18"); cardPayment.setPaymentType("in hand"); cardPayment.setCardNos("8978"); cardPayment.setCardAccountNo("spring"); cardPayment.setExpiryDate("12-nov-2018"); cardPayment.setCardLimit("500000"); session.save(cardPayment); flag = true; } finally { if (transaction != null) { if (flag) { transaction.commit(); } else { transaction.rollback(); } if (session != null) session.close(); } } // finally SessionHandler.closeSessionFactory(); } }
[ "firozhere@gmail.com" ]
firozhere@gmail.com
0258dc0d04741a4985aa3bbd70a434f2bfd6d5a4
34b713d69bae7d83bb431b8d9152ae7708109e74
/core/broadleaf-profile/src/main/java/org/broadleafcommerce/profile/core/dao/CustomerAddressDaoImpl.java
0738048393c0a3548ca70c1618ae8747c8d175ef
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sinotopia/BroadleafCommerce
d367a22af589b51cc16e2ad094f98ec612df1577
502ff293d2a8d58ba50a640ed03c2847cb6369f6
refs/heads/BroadleafCommerce-4.0.x
2021-01-23T14:14:45.029362
2019-07-26T14:18:05
2019-07-26T14:18:05
93,246,635
0
0
null
2017-06-03T12:27:13
2017-06-03T12:27:13
null
UTF-8
Java
false
false
3,400
java
/* * #%L * BroadleafCommerce Profile * %% * Copyright (C) 2009 - 2013 Broadleaf Commerce * %% * 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. * #L% */ package org.broadleafcommerce.profile.core.dao; import org.broadleafcommerce.common.persistence.EntityConfiguration; import org.broadleafcommerce.profile.core.domain.CustomerAddress; import org.broadleafcommerce.profile.core.domain.CustomerAddressImpl; import org.springframework.stereotype.Repository; import javax.annotation.Resource; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import java.util.List; @Repository("blCustomerAddressDao") public class CustomerAddressDaoImpl implements CustomerAddressDao { @PersistenceContext(unitName = "blPU") protected EntityManager em; @Resource(name = "blEntityConfiguration") protected EntityConfiguration entityConfiguration; @SuppressWarnings("unchecked") public List<CustomerAddress> readActiveCustomerAddressesByCustomerId(Long customerId) { Query query = em.createNamedQuery("BC_READ_ACTIVE_CUSTOMER_ADDRESSES_BY_CUSTOMER_ID"); query.setParameter("customerId", customerId); query.setParameter("archived", 'N'); return query.getResultList(); } public CustomerAddress save(CustomerAddress customerAddress) { return em.merge(customerAddress); } public CustomerAddress create() { return (CustomerAddress) entityConfiguration.createEntityInstance(CustomerAddress.class.getName()); } public CustomerAddress readCustomerAddressById(Long customerAddressId) { return (CustomerAddress) em.find(CustomerAddressImpl.class, customerAddressId); } public void makeCustomerAddressDefault(Long customerAddressId, Long customerId) { List<CustomerAddress> customerAddresses = readActiveCustomerAddressesByCustomerId(customerId); for (CustomerAddress customerAddress : customerAddresses) { customerAddress.getAddress().setDefault(customerAddress.getId().equals(customerAddressId)); em.merge(customerAddress); } } public void deleteCustomerAddressById(Long customerAddressId) { CustomerAddress customerAddress = readCustomerAddressById(customerAddressId); if (customerAddress != null) { em.remove(customerAddress); } } @SuppressWarnings("unchecked") public CustomerAddress findDefaultCustomerAddress(Long customerId) { Query query = em.createNamedQuery("BC_FIND_DEFAULT_ADDRESS_BY_CUSTOMER_ID"); query.setParameter("customerId", customerId); List<CustomerAddress> customerAddresses = query.getResultList(); return customerAddresses.isEmpty() ? null : customerAddresses.get(0); } }
[ "sinosie7en@gmail.com" ]
sinosie7en@gmail.com
66b49463e8fc7ac33a8ad2a578f225f74b70c269
29d7c196d243e5a4e5b3b86bfe78e1cee2a8324d
/src/pricipalPKG/Integracion.java
253f54fb097fa9b08365a5319efffb057e136db0
[]
no_license
Monterroza98/packAnalisis
b725e92e4783ecaf75de5faf0dd19098c416cc41
f786ad009af22120e4d22147382c6a772ffa77bf
refs/heads/master
2021-09-16T11:11:23.823798
2018-06-20T04:33:30
2018-06-20T04:33:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,184
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 pricipalPKG; import integracion_numerica.Regla_del_Trapecio; import integracion_numerica.Rosemberg; import integracion_numerica.Simpson_TresOctavos; import integracion_numerica.Simpson_UnTercio; import javax.swing.JOptionPane; /** * * @author kevin Figueroa */ public class Integracion extends javax.swing.JFrame { /** * Creates new form Integracion */ public Integracion() { initComponents(); this.setLocationRelativeTo(null); } public String getFuncion() { int funcion = cmbFuncion.getSelectedIndex() + 1; switch (funcion) { case 1: txtA.setText(""); txtB.setText(""); txtA.setText("1"); txtB.setText("1.4"); return "sin(x)"; case 2: txtA.setText(""); txtB.setText(""); txtA.setText("0"); txtB.setText("1.2"); return "x*(e^x)"; case 3: txtA.setText(""); txtB.setText(""); txtA.setText("-1"); txtB.setText("1"); return "sin(x)*(1/x)"; case 4: txtA.setText(""); txtB.setText(""); txtA.setText("2"); txtB.setText("3"); return "(x^2)*ln(x)"; case 5: txtA.setText(""); txtB.setText(""); txtA.setText("0"); txtB.setText("3.1415926"); return "(x^2)*sin(x) "; case 6: txtA.setText(""); txtB.setText(""); txtA.setText("0"); txtB.setText("3.1415926"); return "1/((x^2)+1)^(0.5)"; default: JOptionPane.showMessageDialog(null, "ERROR"); } return ""; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); cmbFuncion = new javax.swing.JComboBox<>(); jButton1 = new javax.swing.JButton(); spnr = new javax.swing.JSpinner(); jLabel1 = new javax.swing.JLabel(); pnlResult = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); txtB = new javax.swing.JTextField(); txtA = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); txtH = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); txtResp = new javax.swing.JTextField(); pnlRosemberg = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); JTextHoja = new javax.swing.JTextArea(); jLabel10 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(0, 153, 51)); jLabel2.setText("1.Regla del Trapecio"); jLabel3.setText("2.Regla 1/3 de Simpson"); jLabel4.setText("3.Regla 3/8 de Simpson"); jLabel5.setText("4.Rosemberg"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 8, Short.MAX_VALUE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(34, 34, 34) .addComponent(jLabel2) .addGap(34, 34, 34) .addComponent(jLabel3) .addGap(34, 34, 34) .addComponent(jLabel4) .addGap(34, 34, 34) .addComponent(jLabel5) .addContainerGap(47, Short.MAX_VALUE)) ); cmbFuncion.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " ∫sen(x) dx Limites: 1 a 1.4", " ∫x (e^x) dx Limites: 0 a 1.2", " ∫sen(x)/ x dx Limites: -1 a 1", " ∫x²Ln(x) dx Limites: 2 a 3", " ∫x²sen(x) dx Limites: 0 a π ", " ∫dx/√ (x²+1) Limites 0 a π " })); jButton1.setBackground(new java.awt.Color(153, 153, 255)); jButton1.setFont(new java.awt.Font("Monospaced", 1, 12)); // NOI18N jButton1.setText("Solución"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); spnr.setModel(new javax.swing.SpinnerNumberModel(0, 0, 4, 1)); jLabel1.setText("Seleccione el Método"); pnlResult.setBackground(new java.awt.Color(153, 153, 255)); jLabel6.setText("Limite Superior:"); jLabel7.setText("Limite Inferior:"); jLabel8.setText("H="); jLabel9.setText("Valor Apróximado:"); txtResp.setText(" "); javax.swing.GroupLayout pnlResultLayout = new javax.swing.GroupLayout(pnlResult); pnlResult.setLayout(pnlResultLayout); pnlResultLayout.setHorizontalGroup( pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlResultLayout.createSequentialGroup() .addContainerGap() .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(pnlResultLayout.createSequentialGroup() .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtB, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlResultLayout.createSequentialGroup() .addComponent(jLabel7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtA, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(pnlResultLayout.createSequentialGroup() .addComponent(jLabel9) .addGap(4, 4, 4) .addComponent(txtResp, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlResultLayout.createSequentialGroup() .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtH, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(33, Short.MAX_VALUE)) ); pnlResultLayout.setVerticalGroup( pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlResultLayout.createSequentialGroup() .addContainerGap() .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(txtB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txtA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnlResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(txtResp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(17, Short.MAX_VALUE)) ); pnlRosemberg.setBackground(new java.awt.Color(0, 0, 0)); JTextHoja.setColumns(20); JTextHoja.setRows(5); jScrollPane1.setViewportView(JTextHoja); jLabel10.setForeground(new java.awt.Color(255, 255, 255)); jLabel10.setText("Rosemberg"); javax.swing.GroupLayout pnlRosembergLayout = new javax.swing.GroupLayout(pnlRosemberg); pnlRosemberg.setLayout(pnlRosembergLayout); pnlRosembergLayout.setHorizontalGroup( pnlRosembergLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1) .addGroup(pnlRosembergLayout.createSequentialGroup() .addComponent(jLabel10) .addGap(0, 0, Short.MAX_VALUE)) ); pnlRosembergLayout.setVerticalGroup( pnlRosembergLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlRosembergLayout.createSequentialGroup() .addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spnr)) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton1) .addComponent(pnlResult, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnlRosemberg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGap(27, 27, 27) .addComponent(cmbFuncion, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(19, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(cmbFuncion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(spnr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(pnlResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnlRosemberg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap(152, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String funcion = getFuncion(); JTextHoja.setText(""); if (spnr.getValue().equals(1)) { int n = Integer.parseInt(JOptionPane.showInputDialog("Ingrse el número de intervalos: ")); double a = Double.parseDouble(txtA.getText()); double b = Double.parseDouble(txtB.getText()); Regla_del_Trapecio rt = new Regla_del_Trapecio(funcion, a, b); rt.setN(n); txtH.setText(rt.asche() + ""); if (n == 1) { txtResp.setText("" + rt.simple()); } else { txtResp.setText("" + rt.compuesto(rt.relleno(rt.asche()), rt.asche())); } } else if (spnr.getValue().equals(0)) { txtA.setText(""); txtB.setText(""); txtH.setText(""); txtResp.setText(""); JOptionPane.showMessageDialog(null, "Seleccione un método válido"); } else if (spnr.getValue().equals(2)) { // simpson 1/3 int n = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el número de intervalos: ")); double a = Double.parseDouble(txtA.getText()); double b = Double.parseDouble(txtB.getText()); Simpson_UnTercio sunt = new Simpson_UnTercio(funcion, a, b); sunt.setN(n); txtH.setText(sunt.asche() + ""); if (n == 1) { txtResp.setText(sunt.simpson_simple(sunt.asche()) + ""); } else { txtResp.setText("" + sunt.simpson_compuesto(sunt.asche(), sunt.sumatoria_uno(sunt.asche()), sunt.sumatoria_dos(sunt.asche()))); } } else if (spnr.getValue().equals(3)) { // simpson 3/8 JTextHoja.setText(""); int n = Integer.parseInt(JOptionPane.showInputDialog("Ingrese el número de intervalos: ")); double a = Double.parseDouble(txtA.getText()); double b = Double.parseDouble(txtB.getText()); Simpson_TresOctavos stOcv = new Simpson_TresOctavos(funcion, a, b); stOcv.setN(n); txtH.setText(stOcv.asche() + ""); if (n == 1) { txtResp.setText("" + stOcv.simpson_simple(stOcv.asche())); } else { txtResp.setText("" + stOcv.simpson_compuesto(stOcv.asche(), stOcv.sumatoria_uno(stOcv.asche()), stOcv.sumatoria_dos(stOcv.asche()), stOcv.sumatoria_tres(stOcv.asche()))); } } else if (spnr.getValue().equals(4)) { // Rosemberg JTextHoja.setText(""); int n = Integer.parseInt(JOptionPane.showInputDialog("¿Hasta que nivel de Rosemberg desea?: ")); double a = Double.parseDouble(txtA.getText()); double b = Double.parseDouble(txtB.getText()); Rosemberg ros = new Rosemberg(funcion, a, b); ros.setNivel(n); String cadena = "", eches = ""; for (int i = 0; i < ros.aches().length; i++) { eches = eches + ros.aches()[i] + ","; } txtH.setText(eches); for (int i = 0; i < n + 1; i++) { for (int j = 0; j < n + 2; j++) { if (ros.levels(ros.aches())[i][j] != 0.0) { cadena = cadena + (ros.levels(ros.aches())[i][j] + " "); txtResp.setText("" + ros.levels(ros.aches())[i][j]); } } cadena = cadena + ("\n"); } JTextHoja.setText("\n" + cadena); } }//GEN-LAST:event_jButton1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Integracion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Integracion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Integracion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Integracion.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Integracion().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextArea JTextHoja; private javax.swing.JComboBox<String> cmbFuncion; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JPanel pnlResult; private javax.swing.JPanel pnlRosemberg; private javax.swing.JSpinner spnr; private javax.swing.JTextField txtA; private javax.swing.JTextField txtB; private javax.swing.JTextField txtH; private javax.swing.JTextField txtResp; // End of variables declaration//GEN-END:variables }
[ "noreply@github.com" ]
noreply@github.com
ef08e4dd310ab53bf46651c7ffcab52ad45ceb6a
c2ee87d66459ec12dc7cf9a0fda28f73b3fa0e19
/src/Main.java
abd52136ec7018429881f5f093b23b9a160ac1a8
[]
no_license
HamzehMahmoudi/DiffieHellman
c25a4595565f64e37d4fd224b8feb59c27aa74d3
eee764d88366b432d4ba208b5b6ea2692c329c5e
refs/heads/master
2023-01-03T08:41:00.733594
2020-10-29T21:28:54
2020-10-29T21:28:54
308,450,363
3
0
null
null
null
null
UTF-8
Java
false
false
868
java
import java.math.BigInteger; public class Main { public static void main(String[]args){ DiffieHellman x = new DiffieHellman(); x.genPrimeAndPrimitiveRoot(); BigInteger a= new BigInteger("1101001010019203192312312312435234234131235457686756554434232325365645342323243"); BigInteger b= new BigInteger("2343423432473984729384792837492837498273984739847982"); BigInteger Alice=x.getAliceMessage(a); BigInteger Bob=x.getBobMessage(b); BigInteger S=x.aliceCalculationOfKey(Bob,a); BigInteger s=x.bobCalculationOfKey(Alice,b); System.out.println("Alice key =" + x.aliceCalculationOfKey(Bob,a)); System.out.println("Bob key =" + x.bobCalculationOfKey(Alice,b)); System.out.println(s.equals(S)); String str = s.toString(); System.out.println(str.length()); } }
[ "46393208+crooked2@users.noreply.github.com" ]
46393208+crooked2@users.noreply.github.com
86d0fcac519325cfec1a6e4bd604d6dc8099bf49
c9bdb41a5b732af87a320cbab63eab945cab7d52
/src/lectures/Lecture7/Circle.java
4032859e3cbd5fb07e526518c0fc749543fcbc75
[]
no_license
eddigavell/SkolrepoKYH
5a0f4d9acbe9268693420c7629540d4d83c72746
c4f0822e356a16f27ffcb6f7e6d0ef3645f253d9
refs/heads/master
2023-01-02T00:07:17.075974
2020-10-23T11:35:37
2020-10-23T11:35:37
296,307,082
1
0
null
null
null
null
UTF-8
Java
false
false
361
java
package lectures.Lecture7; public class Circle implements Shape{ private int radie; double pi = Math.PI; Circle(int radie) { this.radie = radie; } public int getArea() { return (int) ((this.radie*this.radie) * this.pi); } public int getCircumference() { return (int) ((this.radie+this.radie)*pi); } }
[ "eddi@live.se" ]
eddi@live.se
345ec5992dfb3305e61a6a77a733a36126ab7ca6
3adbfd824fc254c387fe5755f1e9bb78fd023091
/java/net/anvisys/xpen/Common/Utility.java
e924ecc06504fda7ebce177471ce139979810ec0
[]
no_license
Anvisys/xPen_Android
0e70c07b614ee7132425d8554bd62043e529ac52
bc757b27f8d0aa76a348a5c9b3ca5756c48ec72b
refs/heads/master
2020-04-19T04:29:32.710484
2019-01-28T13:23:18
2019-01-28T13:23:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,399
java
package net.anvisys.xpen.Common; import android.widget.Spinner; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.time.Month; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Utility { //static final String DATE_TIME_FORMAT = "dd/MM/yyyy HH:mm:ss"; //static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; static final String SERVER_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS"; static final String Alternate_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; public static String GetDateToString(Date date) { try{ SimpleDateFormat sdf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); String LocalTime = sdf.format(date); return LocalTime; } catch (Exception ex) { return ""; } } public static String GetCurrentDateTimeLocal() { try{ SimpleDateFormat sdf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); String LocalTime = sdf.format(new Date()); return LocalTime; } catch (Exception ex) { return ""; } } public static String GetCurrentDateTimeUTC() { SimpleDateFormat sdf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); String utcTime = sdf.format(new Date()); return utcTime; } public static String ServerToLocalFormat(String date_time) { String dTime=""; SimpleDateFormat ldf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); try{ SimpleDateFormat sdf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); Date inputDate= sdf.parse(date_time); dTime = ldf.format(inputDate); } catch (Exception ex) { dTime = ldf.format(new Date()); } return dTime; } public static String ChangeToTimeOnly(String inDate) { String outTime =""; try { Date dateTime; try { SimpleDateFormat idf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } catch (Exception ex) { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } Calendar c = Calendar.getInstance(Locale.getDefault()); c.setTime(dateTime); outTime = (c.get(Calendar.HOUR_OF_DAY))+":"+(c.get(Calendar.MINUTE)); //Integer.toString(c.get(c.HOUR))+":" + Integer.toString(c.get(c.MINUTE)); } catch (Exception ex) { } return outTime; } public static String GetDayOnly(String inDate) { String OutDate = ""; try { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); Date dateTime = idf.parse(inDate); Date localDate = new Date(dateTime.getTime() + TimeZone.getDefault().getRawOffset()); Calendar c = Calendar.getInstance(); c.setTime(localDate); int day = c.get(Calendar.DAY_OF_MONTH); int Month = c.get(Calendar.MONTH)+1; int year = c.get(Calendar.YEAR); return Integer.toString(day); } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String GetMonthOnly(String inDate) { String OutDate = ""; try { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); Date dateTime = idf.parse(inDate); Date localDate = new Date(dateTime.getTime() + TimeZone.getDefault().getRawOffset()); Calendar c = Calendar.getInstance(); c.setTime(localDate); int day = c.get(Calendar.DAY_OF_MONTH); int Month = c.get(Calendar.MONTH)+1; int year = c.get(Calendar.YEAR); return c.getDisplayName(Calendar.MONTH,Calendar.SHORT ,Locale.US); } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String GetYearOnly(String inDate) { String OutDate = ""; try { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); Date dateTime = idf.parse(inDate); Date localDate = new Date(dateTime.getTime() + TimeZone.getDefault().getRawOffset()); Calendar c = Calendar.getInstance(); c.setTime(localDate); int day = c.get(Calendar.DAY_OF_MONTH); int Month = c.get(Calendar.MONTH)+1; int year = c.get(Calendar.YEAR); return Integer.toString(year); } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String ChangeToDateTimeDisplayFormat(String inDate) { String OutDate = ""; try { Date dateTime; try { SimpleDateFormat idf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } catch (Exception ex) { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } Calendar c = Calendar.getInstance(Locale.getDefault()); int CurrentYear = c.get(Calendar.YEAR); int CurrentDay = c.get(Calendar.DAY_OF_YEAR); c.setTime(dateTime); int day = c.get(Calendar.DAY_OF_MONTH); String Month = c.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.ENGLISH); int year = c.get(Calendar.YEAR); int dayOfYear = c.get(Calendar.DAY_OF_YEAR); String min = Integer.toString(c.get(c.MINUTE)); if(min.length()==1) { min = "0"+ min; } String time = c.get(c.HOUR_OF_DAY) +":" + min; if(CurrentDay == dayOfYear) { return time; } else if (year == CurrentYear) { return Integer.toString(day) + "" + Month; //+ "\n" + time; } else { return Integer.toString(day) + Month +", \n" + Integer.toString(year).substring(2,4) + " at " + time; } } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String ChangeToDateOnlyDisplayFormat(String inDate) { String OutDate = ""; try { Date dateTime; try { SimpleDateFormat idf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } catch (Exception ex) { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } Calendar c = Calendar.getInstance(Locale.getDefault()); int CurrentYear = c.get(Calendar.YEAR); int CurrentDay = c.get(Calendar.DAY_OF_YEAR); c.setTime(dateTime); int day = c.get(Calendar.DAY_OF_MONTH); String Month = c.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.ENGLISH); int year = c.get(Calendar.YEAR); return Integer.toString(day) + Month ; } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String ChangeToMonthDisplayFormat(String inDate) { String OutDate = ""; try { Date dateTime; try { SimpleDateFormat idf = new SimpleDateFormat(SERVER_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } catch (Exception ex) { SimpleDateFormat idf = new SimpleDateFormat(Alternate_DATE_TIME_FORMAT); dateTime = idf.parse(inDate); } Calendar c = Calendar.getInstance(Locale.getDefault()); int CurrentYear = c.get(Calendar.YEAR); int CurrentDay = c.get(Calendar.DAY_OF_YEAR); c.setTime(dateTime); int day = c.get(Calendar.DAY_OF_MONTH); String Month = c.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.ENGLISH); int year = c.get(Calendar.YEAR); return Month + "," + year; } catch (Exception ex) { int a =5; return "1 Jan, 2000"; } } public static String getMonth(int month) { return new DateFormatSymbols().getMonths()[month-1]; } }
[ "noreply@github.com" ]
noreply@github.com
605146462448a6eb548c0e07bb2f3ac36aaab580
d3a34f3bfe03e623be5b894360d293081cbda032
/engine-core/src/main/java/com/gang/etl/engine/strategy/operation/PageStrategy.java
4a853841dcb5a60408c94ec8a19d2bbe34100491
[]
no_license
black-ant/expengine
113ecfdb0aeb01d22449bfa5c6468d2424f1c43f
b497f7cd13b849fce98301a61803139c31d7da7d
refs/heads/master
2023-08-09T01:43:23.032732
2021-03-14T15:29:33
2021-03-14T15:29:33
207,449,534
1
0
null
2023-07-22T15:48:39
2019-09-10T02:39:42
Java
UTF-8
Java
false
false
2,478
java
package com.gang.etl.engine.strategy.operation; import cn.hutool.core.collection.CollectionUtil; import com.gang.etl.engine.api.to.EngineConsumerBean; import com.gang.etl.engine.api.to.EngineProduceBean; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cglib.beans.BeanCopier; import org.springframework.cglib.core.Converter; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * @Classname PageStrategy * @Description 数据切分策略 * @Date 2021/2/28 13:05 * @Created by zengzg */ @Service public class PageStrategy { private Logger logger = LoggerFactory.getLogger(this.getClass()); /** * 把过大的数据进行切分 , 放置 * * @param produceBean * @return */ public List<EngineConsumerBean> splitBean(EngineConsumerBean produceBean) { List<EngineConsumerBean> respoonseList = new ArrayList<>(); if (produceBean.getData() != null && produceBean.getData().size() > getSize()) { List<List> splitResult = CollectionUtil.split(produceBean.getData(), getSize()); splitResult.forEach(itemList -> { try { EngineConsumerBean newResponseItem = new EngineConsumerBean(); BeanCopier beanCopier = BeanCopier.create(EngineConsumerBean.class, EngineConsumerBean.class, true); beanCopier.copy(produceBean, newResponseItem, new Converter() { @Override public Object convert(Object value, Class target, Object context) { if (value instanceof List) { return null; } else { return value; } } }); newResponseItem.setData(itemList); respoonseList.add(newResponseItem); } catch (Exception e) { e.printStackTrace(); logger.error("E----> error :{} -- content :{}", e.getClass(), e.getMessage()); } }); } else { respoonseList.add(produceBean); } return respoonseList; } /** * TODO : 根据 Business 类型获取 * * @return */ public int getSize() { return 3; } }
[ "1016930479@qq.com" ]
1016930479@qq.com
5df62c6eea7b098fab41b6d0424e89fdb8d15ba7
76f8ce9b7550d2a0df55975448b918ca456fd528
/src/main/java/br/com/piloto/web/websocket/package-info.java
244d733532c6a14e2794eb0849822b3d8ab80234
[]
no_license
allanmoreira8/piloto
61f3624a87722b458b0e38979e8ac03e4bc79de6
58bce3f1584a1fa16fd16b794a71201916ad195a
refs/heads/master
2020-06-14T02:46:14.582867
2018-05-15T03:56:25
2018-05-15T03:56:25
75,514,864
0
0
null
null
null
null
UTF-8
Java
false
false
92
java
/** * WebSocket services, using Spring Websocket. */ package br.com.piloto.web.websocket;
[ "allan.moreira@basis.com.br" ]
allan.moreira@basis.com.br
3aee5e6ba958f226376ac857e7c8275fa9afe424
e1986856414e7e6b91c993abbc3f21bc61707d64
/src/test/java/com/abc/accounts/MaxiSavingsAccountTest.java
4efe722a1cb8d97c6c73c3321ee0569e669874eb
[]
no_license
zberkes/my-bank
4359c1f14a6bae90fe1db9163305a5c352a6b745
a78a18b50ba06d4e93adca5603c6be9816a73a4c
refs/heads/master
2020-05-05T13:59:50.584457
2019-04-09T08:45:21
2019-04-09T08:45:21
180,102,911
0
0
null
2019-04-08T08:21:21
2019-04-08T08:21:21
null
UTF-8
Java
false
false
1,736
java
package com.abc.accounts; import com.abc.domain.Transaction; import org.junit.Test; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; public class MaxiSavingsAccountTest { private static final double DOUBLE_DELTA = 1e-15; private final List<Transaction> transactions = new ArrayList<>(); private final AccountType uut = MaxiSavingsAccount.INSTANCE; @Test public void testName() { assertEquals("Maxi Savings Account", uut.getName()); } @Test public void testInterest_emptyAccount() { // given final double balance = 0.0d; // when final double interest = uut.interestEarned(balance, transactions); // then assertEquals(0.0d, interest, DOUBLE_DELTA); } @Test public void testInterest_lastTransactionTenDaysAgo() { // given transactions.add(new Transaction(48.0d, LocalDate.now().minusDays(21))); transactions.add(new Transaction(42.0d, LocalDate.now().minusDays(10))); final double balance = 100.0d; // when final double interest = uut.interestEarned(balance, transactions); // then assertEquals(5.0d, interest, DOUBLE_DELTA); } @Test public void testInterest_lastTransactionElevenDaysAgo() { // given transactions.add(new Transaction(48.0d, LocalDate.now().minusDays(21))); transactions.add(new Transaction(42.0d, LocalDate.now().minusDays(11))); final double balance = 100.0d; // when final double interest = uut.interestEarned(balance, transactions); // then assertEquals(0.1d, interest, DOUBLE_DELTA); } }
[ "zoltan.berkes@accenture.com" ]
zoltan.berkes@accenture.com
e3a0e7fe6879ca1c256e28a93bcde7c4b2efcae2
dbca4148cbbb048a6782a0beec770e9811bd10df
/src/com/first/color.java
cbe5799c3454640b54452ab72f196ffb6312d899
[]
no_license
qinwq08/hello2
0d7947e2c2a816b2963449f0462e5ad3c32d307f
61317b9a22690704a7073382d88964e3c4026dbb
refs/heads/master
2020-06-04T19:33:13.998489
2019-06-14T08:23:04
2019-06-14T08:23:04
191,899,697
0
0
null
null
null
null
UTF-8
Java
false
false
204
java
package com.first; public class color { private String color; public void setColor(String color) { this.color = color; } public String getColor() { return color; } }
[ "853466060@qq.com" ]
853466060@qq.com
d9ece59bd5e2e77e4347ed1574683184872d8d65
d2cb1f4f186238ed3075c2748552e9325763a1cb
/methods_all/nonstatic_methods/java_awt_ScrollPane_setFocusTraversalPolicyProvider_boolean.java
83df9a440d797d6b286b44b3cca95944b785e947
[]
no_license
Adabot1/data
9e5c64021261bf181b51b4141aab2e2877b9054a
352b77eaebd8efdb4d343b642c71cdbfec35054e
refs/heads/master
2020-05-16T14:22:19.491115
2019-05-25T04:35:00
2019-05-25T04:35:00
183,001,929
4
0
null
null
null
null
UTF-8
Java
false
false
195
java
class java_awt_ScrollPane_setFocusTraversalPolicyProvider_boolean{ public static void function() {java.awt.ScrollPane obj = new java.awt.ScrollPane();obj.setFocusTraversalPolicyProvider(false);}}
[ "peter2008.ok@163.com" ]
peter2008.ok@163.com
93631af3259741cd9769674f79b4d4c92b49e4f5
9b2ffff7e544cbde25495b103de252828554d758
/app/src/main/java/cz/ejstn/learnlanguageapp/slovicka/Kategorie1Zvirata.java
c184aab7f601ae0e0dc202baf82ee705b5d87664
[]
no_license
egAhmed/LearnLanguageApp
a7a86e17f77761158730550e8a481f8f5673d8f2
c96c068ba8f406f359ab9b706bc8a645af5429c5
refs/heads/master
2020-03-24T08:41:25.721730
2017-03-05T15:39:16
2017-03-05T15:39:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,509
java
package cz.ejstn.learnlanguageapp.slovicka; import java.util.ArrayList; import cz.ejstn.learnlanguageapp.R; import cz.ejstn.learnlanguageapp.model.Slovicko; /** * Created by Martin Soukup on 27.1.2017. */ public final class Kategorie1Zvirata { private Kategorie1Zvirata() { } public static ArrayList<Slovicko> pripravKategorii() { ArrayList<Slovicko> slovicka = new ArrayList<>(); vytvorSlovicka(slovicka); return slovicka; } // zvířata private static ArrayList<Slovicko> vytvorSlovicka(ArrayList<Slovicko> slovicka) { // chybějící výslovnost // slovicka.add(new Slovicko("lady beetle", "beruška", R.drawable.zvirata_beruska, R.raw.lady_beetle)); // VODNÍ slovicka.add(new Slovicko("fish", "ryba", R.drawable.zvirata_ryba, R.raw.fish)); slovicka.add(new Slovicko("turtle", "želva", R.drawable.zvirata_zelva, R.raw.turtle)); slovicka.add(new Slovicko("penguin", "tučňák", R.drawable.zvirata_tucnak, R.raw.penguin)); slovicka.add(new Slovicko("duck", "kachna", R.drawable.zvirata_kachna, R.raw.duck)); slovicka.add(new Slovicko("squid", "oliheň", R.drawable.zvirata_olihen, R.raw.squid)); slovicka.add(new Slovicko("dolphin", "delfín", R.drawable.zvirata_delfin, R.raw.dolphin)); slovicka.add(new Slovicko("shark", "žralok", R.drawable.zvirata_zralok, R.raw.shark)); slovicka.add(new Slovicko("crab", "krab", R.drawable.zvirata_krab, R.raw.crab)); slovicka.add(new Slovicko("whale", "velryba", R.drawable.zvirata_velryba, R.raw.whale)); slovicka.add(new Slovicko("shrimp", "kreveta", R.drawable.zvirata_kreveta, R.raw.shrimp)); slovicka.add(new Slovicko("octopus", "chobotnice", R.drawable.zvirata_chobotnice, R.raw.octopus)); // KOŇOVITÍ slovicka.add(new Slovicko("rhinoceros", "nosorožec", R.drawable.zvirata_nosorozec, R.raw.rhinoceros)); slovicka.add(new Slovicko("horse", "kůň", R.drawable.zvirata_kun, R.raw.horse)); slovicka.add(new Slovicko("bull", "býk", R.drawable.zvirata_byk, R.raw.bull)); slovicka.add(new Slovicko("camel", "velbloud", R.drawable.zvirata_velbloud, R.raw.camel)); slovicka.add(new Slovicko("deer", "jelen", R.drawable.zvirata_jelen, R.raw.deer)); slovicka.add(new Slovicko("ram", "beran", R.drawable.zvirata_beran, R.raw.ram)); slovicka.add(new Slovicko("goat", "koza", R.drawable.zvirata_koza, R.raw.goat)); slovicka.add(new Slovicko("sheep", "ovce", R.drawable.zvirata_ovce, R.raw.sheep)); slovicka.add(new Slovicko("unicorn", "jednorožec", R.drawable.zvirata_jednorozec, R.raw.unicorn)); slovicka.add(new Slovicko("cow", "kráva", R.drawable.zvirata_krava, R.raw.cow)); // DOMÁCÍ MAZLÍČCI slovicka.add(new Slovicko("dog", "pes", R.drawable.zvirata_pes, R.raw.dog)); slovicka.add(new Slovicko("cat", "kočka", R.drawable.zvirata_kocka, R.raw.cat)); slovicka.add(new Slovicko("rabbit", "králík", R.drawable.zvirata_kralik, R.raw.rabbit)); slovicka.add(new Slovicko("hamster", "křeček", R.drawable.zvirata_krecek, R.raw.hamster)); slovicka.add(new Slovicko("mouse", "myš", R.drawable.zvirata_mys, R.raw.mouse)); // HMYZ slovicka.add(new Slovicko("ant", "mravenec", R.drawable.zvirata_mravenec, R.raw.ant)); slovicka.add(new Slovicko("spider", "pavouk", R.drawable.zvirata_pavouk, R.raw.spider)); slovicka.add(new Slovicko("butterfly", "motýl", R.drawable.zvirata_motyl, R.raw.butterfly)); slovicka.add(new Slovicko("snail", "šnek", R.drawable.zvirata_snek, R.raw.snail)); // LÍTACÍ ptáci slovicka.add(new Slovicko("bat", "netopýr", R.drawable.zvirata_netopyr, R.raw.bat)); slovicka.add(new Slovicko("eagle", "orel", R.drawable.zvirata_orel, R.raw.eagle)); slovicka.add(new Slovicko("turkey", "krocan", R.drawable.zvirata_krocan, R.raw.turkey)); slovicka.add(new Slovicko("chicken", "kuře", R.drawable.zvirata_kure, R.raw.chicken)); //PLAZI slovicka.add(new Slovicko("frog", "žába", R.drawable.zvirata_zaba, R.raw.frog)); slovicka.add(new Slovicko("lizard", "ještěrka", R.drawable.zvirata_jesterka, R.raw.lizard)); // ŠELMY slovicka.add(new Slovicko("lion", "lev", R.drawable.zvirata_lev, R.raw.lion)); slovicka.add(new Slovicko("fox", "liška", R.drawable.zvirata_liska, R.raw.fox)); slovicka.add(new Slovicko("wolf", "vlk", R.drawable.zvirata_vlk, R.raw.wolf)); // zatím nerozřazeno slovicka.add(new Slovicko("bear", "medvěd", R.drawable.zvirata_medved, R.raw.bear)); slovicka.add(new Slovicko("snake", "had", R.drawable.zvirata_had, R.raw.snake)); slovicka.add(new Slovicko("elephant", "slon", R.drawable.zvirata_slon, R.raw.elephant)); slovicka.add(new Slovicko("monkey", "opice", R.drawable.zvirata_opice, R.raw.monkey)); slovicka.add(new Slovicko("koala", "koala", R.drawable.zvirata_koala, R.raw.koala)); slovicka.add(new Slovicko("panda", "panda", R.drawable.zvirata_panda, R.raw.panda)); //slovicka.add(new Slovicko("squirrel", "veverka", R.drawable.zvirata_veverka, R.raw.squirrel)); slovicka.add(new Slovicko("pig", "prase", R.drawable.zvirata_prase, R.raw.pig)); slovicka.add(new Slovicko("gorilla", "gorila", R.drawable.zvirata_gorila, R.raw.gorilla)); return slovicka; } }
[ "aceton@centrum.cz" ]
aceton@centrum.cz
f5f7f01e770a0720e293a2078235204c7d4867fd
7c9dfa5266955a8d4b44c060c55ca11166448765
/Intelligent Transport System/bluetoothClient/src/ModeLauncher.java
34957b5524cd1e9800d7ff14fd6f492c70cfc910
[]
no_license
gauravsgr/publictransportsystem
061002bdb53898bd14dc6255102fe3f803cddae0
3f50835460124b25413f0eeb1ea64758c1173772
refs/heads/master
2021-01-10T11:12:38.494193
2015-12-20T01:43:43
2015-12-20T01:43:43
48,303,628
0
0
null
null
null
null
UTF-8
Java
false
false
2,982
java
import javax.bluetooth.*; import java.net.*; import java.io.*; import java.util.*; import javax.swing.*; import java.awt.event.*; public class ModeLauncher implements Runnable { String url=null; BufferedReader in; ArrayList<RemoteDevice> deviceList; public void sendRemoteDevices() throws Exception { RemoteDeviceDiscovery rdd= new RemoteDeviceDiscovery(); deviceList= rdd.searchDevices(); if(deviceList.size()==0) { synchronized(Login.lock) { Login.lock.notifyAll(); } Login.previousDeviceList=deviceList;//Stores devicelist for removing redundancy in the next iteration return; } URL url = new URL(Login.urladd+"/verify.do"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); int i=0; for(RemoteDevice rd: deviceList) if(!Login.previousDeviceList.contains(rd)) { out.write("param"+(i++)+"="+URLEncoder.encode(rd.getBluetoothAddress(),"UTF-8")+"&"); System.out.println(rd.getBluetoothAddress()); } out.write("station="+URLEncoder.encode(Login.station)); Login.previousDeviceList=deviceList;//Stores devicelist for removing redundancy in the next iteration out.close(); in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine=in.readLine(); if(!inputLine.equalsIgnoreCase("passed")) { new Thread(this).start(); } else { in.close(); synchronized(Login.lock) { Login.lock.notifyAll(); } } System.out.println("This ended now..."); } public void run() { ArrayList<String> bllist=new ArrayList<String>(); ArrayList<String> chlist=new ArrayList<String>(); String inputline=""; try { boolean lowbal=true; while ((inputline = in.readLine()) != null) { if(inputline.equalsIgnoreCase("cheaterslist")) { lowbal=false; continue; } if(lowbal) bllist.add(inputline); else chlist.add(inputline); } in.close(); File f=new File("Tracker.log"); f.createNewFile(); PrintWriter out = new PrintWriter(new FileWriter(f,true)) ; out.println(new Date()); out.println("C H E A T E R S L I S T"); for(String s: chlist) for(RemoteDevice rd: deviceList) if(rd.getBluetoothAddress().equals(s)) out.println(" "+s+" Friendly Name: "+rd.getFriendlyName(false)); //for(String s: chlist) out.println("\t"+s); out.println("L O W B A L A N C E L I S T"); for (String s: bllist) out.println(" "+s); out.println(); out.println(); out.println(); out.close() ; }catch(Exception e){System.out.println("Caught Exception now "+e);} synchronized(Login.lock) { Login.mlPlay=true; Login.lock.notifyAll(); new Thread(new Runnable() { public void run(){ new PlayWav().play(); //executing sound in a separate thread in order to complete d block by synchronous start n notify } }).start(); } } }
[ "gaurav.sgr@gmail.com" ]
gaurav.sgr@gmail.com
076c7d2524b17228a344bd24541655e934b21da3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_da4a8c0467b6d6be72393ac45f29c2c01f5bb806/CalculatorTest/4_da4a8c0467b6d6be72393ac45f29c2c01f5bb806_CalculatorTest_s.java
7dcb566a90fe77a4ddeea4975197371a09183037
[]
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
391
java
package com.packtpub; import junit.framework.Assert; import junit.framework.TestCase; public class CalculatorTest extends TestCase { public void testSum() throws Exception { Calculator calculator = new Calculator(); int sum = calculator.sum(1, 2); Assert.assertEquals(3, sum); } public void testBad() { fail("Oops!"); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
6516d2f77906c80cba9e554195bdea7f0a0eac1a
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Math/43/org/apache/commons/math/transform/FastFourierTransformer_verifyInterval_511.java
bb2b3b3a6a26936b56b5f6b2be5feff780a7c23f
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,765
java
org apach common math transform implement href http mathworld wolfram fast fourier transform fastfouriertransform html fast fourier transform transform dimension data set refer appli numer linear algebra isbn chapter convent definit fft invers fft coeffici expon equat list comment method requir length data set power greatli simplifi speed code user pad data zero meet requir flavor fft refer winograd comput discret fourier transform mathemat comput version fast fourier transform fastfouriertransform serializ verifi endpoint interv param lower lower endpoint param upper upper endpoint illeg argument except illegalargumentexcept interv verifi interv verifyinterv lower upper illeg argument except illegalargumentexcept lower upper math runtim except mathruntimeexcept creat illeg argument except createillegalargumentexcept local format localizedformat endpoint interv lower upper
[ "hvdthong@gmail.com" ]
hvdthong@gmail.com
9ebef190957913ede9c7242dd4a39bea0f9cad8d
3648fd5ed1dac3ab6932c758a4a1284f9886f49c
/src/main/java/de/dsi08/myfaces/forward/demo/HelloWorldBacking.java
b4e1c0bd54f5ae8caec152d2470e4bbbbb164511
[]
no_license
khujo/myfacesPassthroughAjax
6e53a39ff73b3a90f291317414e2c4df7f38305d
c2df40f168d40561b19c20b11ef4cd59bbfdd51f
refs/heads/master
2020-05-30T22:50:16.083348
2014-12-16T11:25:05
2014-12-16T11:25:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package de.dsi08.myfaces.forward.demo; import javax.faces.event.AjaxBehaviorEvent; public class HelloWorldBacking { private int count = 0; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public void headingClicked(AjaxBehaviorEvent event) { this.count++; System.out.println("test"); } }
[ "felix@dsi08.de" ]
felix@dsi08.de
18f5544bfa61f91185dd3ffe1945a3bb4e419c5a
af78e88957efc9bff0a4b20bfa537a9ef4fa0afd
/src/main/java/handler/decoder/StringDecoder.java
5aa5ad04cb3a582f226ea377d5f9fc3009b481a9
[ "Apache-2.0" ]
permissive
xiejiajun/netty-wheel
0f2251db2e180fe60f9ee0d779c1349f9d05185e
6b8b4a2005bd89718d8f20799cde3c85d5bf28fb
refs/heads/master
2022-11-15T04:18:13.999142
2020-07-14T13:18:25
2020-07-14T13:18:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
package handler.decoder; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import context.HandlerContext; import handler.InBoundHandlerAdapter; /** * 将ByteBuffer或byte[]转为字符串, 仅支持Heap ByteBuffer. * * @author skywalker * */ public class StringDecoder extends InBoundHandlerAdapter { private static final Charset defaultCharSet = StandardCharsets.UTF_8; private static final Logger logger = LoggerFactory.getLogger(StringDecoder.class); private final Charset charset; public StringDecoder() { this(null); } public StringDecoder(Charset charset) { if (charset != null) { this.charset = charset; } else { this.charset = defaultCharSet; } } @Override public void channelRead(Object message, HandlerContext context) { if (message == null) return; byte[] array = null; if (message instanceof ByteBuffer) { ByteBuffer buffer = (ByteBuffer) message; if (buffer.hasArray()) { array = buffer.array(); } else { logger.debug("We support heap ByteBuffer only."); } } else if (message instanceof byte[]) { array = (byte[]) message; } if (array != null) { message = new String(array, charset); } context.fireChannelRead(message); } }
[ "xsdwem7@hotmail.com" ]
xsdwem7@hotmail.com
e1e5fa78acd276e1b4c1f283a502dc7387ef6fe6
abc1785afbedfb31291ce164ea9a6e580dd27d2e
/ppms/ppms-admin/src/test/java/com/qhy/ppmsadmin/PpmsAdminApplicationTests.java
11c64182979f376076a43b92cfa32c59bb8de05f
[]
no_license
hongyouqin/ppms
d65c8a00b63bf655de9eda66c5759bffc01339f4
9062b493cdcbbcbd9677e8df4b0c884f568d5dd2
refs/heads/main
2023-04-19T21:13:21.772281
2021-05-20T15:36:20
2021-05-20T15:36:20
342,769,510
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package com.qhy.ppmsadmin; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class PpmsAdminApplicationTests { @Test void contextLoads() { } }
[ "yang.qq123@163.com" ]
yang.qq123@163.com
355f69c80e3c3f257cbe6c4f30087e02cc1974a6
073de32bc2fdec342902dd45be8cd164c3140515
/formTemplateMethod/formTemplateMethod/HtmlStatement.java
9fd76576d4436d6e988a2cd57208797d404e4187
[]
no_license
giuseppePeppe/refactoring
3eef763a62522d6589a9b6c781b1a3900752e8ec
f3c7aaadbb8b6f4bee54dd61910663fce6efd6b5
refs/heads/master
2021-08-08T04:25:43.720778
2017-11-09T15:26:54
2017-11-09T15:26:54
110,131,903
0
0
null
null
null
null
UTF-8
Java
false
false
653
java
package formTemplateMethod; class HtmlStatement extends Statement { @Override String addFooterLine(Customer aCustomer) { return "<P>You owe <EM>" +String.valueOf(aCustomer.getTotalCharge()) +"</EM><P>\n"+ "On this rental you earned <EM>"+String.valueOf(aCustomer.getTotalFrequentRenterPoints())+ "</EM> frequent renter points<P>"; } @Override String headertString(Customer aCustomer) { return "<H1>Rentals for <EM>" + aCustomer.getName() +"</EM></H1><P>\n"; } @Override String retriveEachRental(Rental each) { return each.getMovie().getTitle()+ ": " + String.valueOf(each.getCharge()) + "<BR>\n"; } }
[ "dev@wsx44.mfti" ]
dev@wsx44.mfti
eb22a4b2db351eda3bf26fd3d9b861f497a329e8
7a34e1e8849fc6e2ce398816c19fa0f661ac7708
/config/src/main/java/com/gl/ceir/config/repository/NullMsisdnRegularizedRepository.java
6e20927d4f2b15ed2c65461f4fe209e3558c25e5
[]
no_license
mehtagit/AndHalf
ff34df1297ca8442de7d9e79ce937a5e665d9a8e
9933dfb616c9511d1dbaa5773d2e875b97dd428d
refs/heads/master
2021-08-09T00:43:51.362339
2019-11-08T07:55:20
2019-11-08T07:55:20
184,991,596
0
0
null
2020-02-14T07:39:39
2019-05-05T06:51:41
Java
UTF-8
Java
false
false
337
java
package com.gl.ceir.config.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.gl.ceir.config.model.NullMsisdnRegularized; @Repository public interface NullMsisdnRegularizedRepository extends JpaRepository<NullMsisdnRegularized, Long> { }
[ "33978751+mehtagit@users.noreply.github.com" ]
33978751+mehtagit@users.noreply.github.com
60387a58e80155b4651a80dede435d64ea284c2d
97f8a5767c704b5bdb87d25bcf1ddeaa561effdf
/Sum of the array elements/Main.java
4a35dc20ce66dcf3e1ff6a0793ab9c01bc6e0c42
[]
no_license
iamshubhamnayak/Playground-1
b29ff04a7afcb2748eb1da91f63a31312d7be742
7b7002a6ce4c83606eec78b2f2264901ece888da
refs/heads/master
2022-06-14T06:15:39.921234
2020-05-09T16:50:18
2020-05-09T16:50:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
#include<iostream> using namespace std; int arrsum(int a[], int n) { if (n <= 0) return 0; return (arrsum(a, n-1) + a[n-1]); } int main() { int n; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; cout<<arrsum(a, n); //Type your code here. }
[ "sumankalyangiri786@gmail.com" ]
sumankalyangiri786@gmail.com
5523f5858aa08abbb238f6eae687e88c6f33bd6b
f23cbe7b46b36814ec7e4841e4c285ebb611a626
/src/main/java/com/bmi/springmvc/service/VehicleModelServiceImpl.java
9f9b2d9b5c367a4c3d7e98529a1bfb9d2f122cf9
[]
no_license
GaneshMaddipoti/BuyMI
de07c7c59404d87a31f2558d1e372e012ab7bb79
2cb094246ae71bf4b83c2845b162dbc53566dc8b
refs/heads/master
2020-03-21T16:26:47.074475
2018-06-26T17:22:13
2018-06-26T17:22:13
138,770,359
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
package com.bmi.springmvc.service; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.bmi.springmvc.dao.VehicleModelDAO; import com.bmi.springmvc.model.TMVehicleModel; @Service("vehicleModelService") @Transactional public class VehicleModelServiceImpl implements VehicleModelService { @Autowired private VehicleModelDAO dao; private Map<Integer, String> vehicleModelMap; public List<TMVehicleModel> findAllVehicleModels() { return dao.findAllVehicleModels(); } public Map<Integer, String> getAllVehicleModelMap() { if (vehicleModelMap == null) { vehicleModelMap = new HashMap<>(); for (TMVehicleModel vehicleModel : findAllVehicleModels()) { vehicleModelMap.put(vehicleModel.getVehicleModelLinkId(), vehicleModel.getVehicleModelName()); } } return vehicleModelMap; } }
[ "ganesh.maddipoti.ctr@sabre.com" ]
ganesh.maddipoti.ctr@sabre.com
0564ea443ba9788158452514eab68a0fb950751a
e1faa01a5f55f648db38d80a0bf4082cbf42c25d
/application/app-stockairepo/src/main/java/de/pearlbay/stockai/stockrepo/restcontroller/v1/package-info.java
61d5461efab7d19c0a9fec0e88bc9e9fcb806e40
[]
no_license
renegaat/StockAI
acc20bf1a0dd96027eebc0966aa8c99af9f7a011
df2d222dd094cd73743e0be6c2acaf817f75e378
refs/heads/master
2023-07-06T03:33:14.172263
2023-06-25T19:35:52
2023-06-25T19:35:52
134,223,057
0
1
null
2023-05-26T22:13:55
2018-05-21T05:39:05
Java
UTF-8
Java
false
false
128
java
/** * controller classes v1. * @author joern ross (pearlbay) 2020 */ package de.pearlbay.stockai.stockrepo.restcontroller.v1;
[ "joernross@gmx.net" ]
joernross@gmx.net
ab02401eb96a49fb5fc90d7d390dbd6264e7bc6b
0cd72b8e2c18c3a6a9a0e25c4a37810d6571288f
/src/main/java/com/acmutv/socstream/common/source/kafka/RichSensorEventKafkaSource.java
9b732542b5d7e414818cc84524d51ff673b565d1
[ "MIT" ]
permissive
zhangduo0729/socstream
91e885a30f15c29f26730628de867e278df18faa
c8f21c4b3283bb4d5fa54b7c15b48c6ed9204e43
refs/heads/master
2020-09-30T08:56:10.414313
2017-07-18T18:39:41
2017-07-18T18:39:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,254
java
/* The MIT License (MIT) Copyright (c) 2017 Giacomo Marciani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.acmutv.socstream.common.source.kafka; import com.acmutv.socstream.common.source.kafka.schema.RichSensorEventDeserializationSchema; import com.acmutv.socstream.common.tuple.RichSensorEvent; import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer010; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; import java.util.Properties; import java.util.Set; /** * A source that produces {@link RichSensorEvent} from a Kafka topic. * * @author Giacomo Marciani {@literal <gmarciani@acm.org>} * @since 1.0 */ public class RichSensorEventKafkaSource extends FlinkKafkaConsumer010<RichSensorEvent> { /** * The logger. */ private static final Logger LOG = LoggerFactory.getLogger(RichSensorEventKafkaSource.class); /** * The special tuple signaling the end of stream. */ public static final RichSensorEvent END_OF_STREAM = new RichSensorEvent(0, Long.MAX_VALUE, 0, 0, 0, 0, 0, 0, 0, 0); /** * Constructs a new Kafka source for sensor events with ignoring features. * * @param topic Kafka topics. * @param props Kafka properties. * @param tsStart the starting timestamp (events before this will be ignored). * @param tsEnd the ending timestamp (events after this will be ignored). * @param tsStartIgnore the starting timestamp to ignore (events between this and {@code tsEndIgnore} will be ignored). * @param tsEndIgnore the ending timestamp to ignore (events between {@code tsStartIgnore} and this will be ignored). * @param ignoredSensors the list of sensors id to be ignored. * @param sid2Pid the map (SID->(PID). */ public RichSensorEventKafkaSource(String topic, Properties props, long tsStart, long tsEnd, long tsStartIgnore, long tsEndIgnore, Set<Long> ignoredSensors, Map<Long,Long> sid2Pid) { super(topic, new RichSensorEventDeserializationSchema( tsStart, tsEnd, tsStartIgnore, tsEndIgnore, ignoredSensors, sid2Pid, END_OF_STREAM ), props); } }
[ "giacomo.marciani@gmail.com" ]
giacomo.marciani@gmail.com
1f37ea358dd3385b13c8f162db75d69e1d9e7122
1aab00ce8c6d2e6ae6bbbf4d06c529ded7f9a6de
/Day2/q2.java
d07ce257f92111f54fed1c27703ad77e254eab4f
[]
no_license
divya1509/30-Days-of-Code
82cdf05d1c7f66df1ab6d505fc9618d8daf80dbd
df41f81076cdbda2e07e966a81576cf618087ac4
refs/heads/master
2023-09-01T08:01:42.856776
2021-09-30T14:49:00
2021-09-30T14:49:00
412,104,000
1
0
null
null
null
null
UTF-8
Java
false
false
814
java
// Pascal's Triangle // Given an integer numRows, return the first numRows of Pascal's triangle. import java.util.*; class q2{ // use nCr = n! / (n - r)! * (r)! // find nC(r + 1) using pre-existing nCr -> nC(r+1) = nCr * (n - r) / (r + 1) public static List<List<Integer>> generate(int numRows) { List<List<Integer>> ans = new ArrayList<>(); for(int i = 0; i < numRows; i++) { int ncr = 1; List<Integer> temp = new ArrayList<>(); for(int j = 0; j <= i; j++) { temp.add(ncr); ncr = ncr * (i - j) / (j + 1) ; } ans.add(temp); } return ans; } public static void main(String[] args) { int n = 5; System.out.println(generate(n)); } }
[ "medivyachopra@gmail.com" ]
medivyachopra@gmail.com
626ee169469255227f122f1aae0803b24f842b53
10d2b63404cf2ddb56f120fbae552a90787ba3e0
/IdeaProjects/leetcode/src/stringpali.java
b6658e60f6817dd8a7c1005222d9296371789ed8
[]
no_license
knightsu/leetcode
903c1d23528850232b69c2d6afc6657227b4922c
02e735d897d349dac56fac3b71a8a4aca39fee93
refs/heads/master
2021-01-20T14:53:16.399153
2017-06-25T05:02:27
2017-06-25T05:02:27
90,685,110
0
0
null
null
null
null
UTF-8
Java
false
false
1,134
java
/** * Created by yingyang on 4/8/17. */ public class stringpali { public static boolean isPalindrome(String s) { StringBuilder sb = new StringBuilder(); for(int i=0;i<s.length();i++) { if(s.charAt(i)>='a'&&s.charAt(i)<='z') { sb.append(s.charAt(i)); } if(s.charAt(i)>='A'&&s.charAt(i)<='Z') { char c=(char)(s.charAt(i)+32); sb.append(c); } } String ns = sb.toString(); if(ns.length()%2==0) { for(int i=ns.length()/2-1;i>=0;i--) { if(s.charAt(i)!=s.charAt(ns.length()-1-i)) return false; } } else { int mid= ns.length()/2; for(int i=mid-1;i>=0;i--) { if(s.charAt(i)!=s.charAt(ns.length()-1-i)) return false; } } return true; } public static void main(String[] args) { String s="aA"; System.out.print(isPalindrome(s)); } }
[ "yingyang@nanyuandawangs-MacBook-Air.local" ]
yingyang@nanyuandawangs-MacBook-Air.local
7ed37f4444e2814c0e1d320a31ae90b43718529d
383b270e1c3a4eba1fb014b36f5f6f3584be3a09
/src/main/java/org/liquidengine/legui/system/renderer/nvg/NvgIconRenderer.java
3390fdec3be461233df1164609e86fa01f63d1d5
[ "MIT" ]
permissive
MultiWindow/breakoutapi
b9216fd9ba895b37a55b248a4191502747ba7541
f2f629114e6c0527a0255d81ec39257e408cc201
refs/heads/master
2023-05-11T09:19:57.716420
2021-03-07T04:49:36
2021-03-07T04:49:36
342,177,465
0
1
null
null
null
null
UTF-8
Java
false
false
2,046
java
package org.liquidengine.legui.system.renderer.nvg; import org.joml.Vector2f; import org.liquidengine.legui.component.Component; import org.liquidengine.legui.icon.Icon; import org.liquidengine.legui.system.context.Context; import org.liquidengine.legui.system.renderer.IconRenderer; import static org.liquidengine.legui.system.renderer.nvg.NvgRenderer.NVG_CONTEXT; /** * Abstract renderer for Icon implementations. */ public abstract class NvgIconRenderer<I extends Icon> extends IconRenderer<I> { /** * This method called by base abstract icon renderer. * * @param icon icon to render. * @param component component - icon owner. * @param context context. */ @Override public void renderIcon(I icon, Component component, Context context) { if (icon == null) { return; } long nanovgContext = (long) context.getContextData().get(NVG_CONTEXT); renderIcon(icon, component, context, nanovgContext); } /** * Used to render specific Icon. * * @param icon icon to render. * @param component component - icon owner. * @param context context. * @param nanovg nanoVG context. */ protected abstract void renderIcon(I icon, Component component, Context context, long nanovg); /** * Used to calculate on screen position of icon. * @param icon icon * @param component icon component * @param iconSize icon size * @return icon position */ protected Vector2f calculateIconPosition(I icon, Component component, Vector2f iconSize) { Vector2f size = component.getSize(); Vector2f p = new Vector2f(component.getAbsolutePosition()); if (icon.getPosition() == null) { p.x += icon.getHorizontalAlign().index * (size.x - iconSize.x) / 2f; p.y += icon.getVerticalAlign().index * (size.y - iconSize.y) / 2f; } else { p.x += icon.getPosition().x; p.y += icon.getPosition().y; } return p; } }
[ "raph.hennessy@gmail.com" ]
raph.hennessy@gmail.com
11af8845e2dda7521f01cc34cb608380d035352d
6c553459bfc3fac679716da09a8576d015289f01
/src/behaviordp/bdp09_strategy/SortedList.java
077ce0dbe67386897b1403f284b490bd87b7cca9
[]
no_license
hieuhth/DesignPatternStudy
d5c57effdc4728debf0d922bc1f080bfe368670a
a3f35ec8e37362ca3d96660eb13c123454cd8666
refs/heads/master
2023-07-17T23:14:43.388862
2021-08-28T10:50:41
2021-08-28T10:50:41
400,767,768
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package behaviordp.bdp09_strategy; import java.util.ArrayList; import java.util.List; public class SortedList { private SortStrategy strategy; private List<String> items = new ArrayList<>(); public void setSortStrategy(SortStrategy strategy) { this.strategy = strategy; } public void add(String name) { items.add(name); } public void sort() { strategy.sort(items); } }
[ "trunghieubk@gmail.com" ]
trunghieubk@gmail.com
779a67de6c665f4861cf64798a9cf0b8bb18d65b
c60edeb773bdd467569cb72fd5bb9a6a881ca3cf
/app-data-24/src/cn/edu360/app/log/mr/JsonToStringUtil.java
e2764aab10f08fb0b7e62178deb7e1b3bc3d616e
[]
no_license
zhalidong/AppDataLogAnalysis
3cbe23f684636aff8435debf52368be702c0cbbf
e3e718c1859bc6b8b1d85f6ce42b70b12eeb0740
refs/heads/master
2020-07-04T10:58:55.783819
2019-08-14T04:56:17
2019-08-14T04:56:17
202,266,004
0
0
null
null
null
null
UTF-8
Java
false
false
1,834
java
package cn.edu360.app.log.mr; import com.alibaba.fastjson.JSONObject; public class JsonToStringUtil { public static String toString(JSONObject jsonObj){ StringBuilder sb = new StringBuilder(); sb.append(jsonObj.get("sdk_ver")).append("\001").append(jsonObj.get("time_zone")).append("\001") .append(jsonObj.get("commit_id")).append("\001").append(jsonObj.get("commit_time")).append("\001") .append(jsonObj.get("pid")).append("\001").append(jsonObj.get("app_token")).append("\001") .append(jsonObj.get("app_id")).append("\001").append(jsonObj.get("device_id")).append("\001") .append(jsonObj.get("device_id_type")).append("\001").append(jsonObj.get("release_channel")) .append("\001").append(jsonObj.get("app_ver_name")).append("\001").append(jsonObj.get("app_ver_code")) .append("\001").append(jsonObj.get("os_name")).append("\001").append(jsonObj.get("os_ver")) .append("\001").append(jsonObj.get("language")).append("\001").append(jsonObj.get("country")) .append("\001").append(jsonObj.get("manufacture")).append("\001").append(jsonObj.get("device_model")) .append("\001").append(jsonObj.get("resolution")).append("\001").append(jsonObj.get("net_type")) .append("\001").append(jsonObj.get("account")).append("\001").append(jsonObj.get("app_device_id")) .append("\001").append(jsonObj.get("mac")).append("\001").append(jsonObj.get("android_id")) .append("\001").append(jsonObj.get("imei")).append("\001").append(jsonObj.get("cid_sn")).append("\001") .append(jsonObj.get("build_num")).append("\001").append(jsonObj.get("mobile_data_type")).append("\001") .append(jsonObj.get("promotion_channel")).append("\001").append(jsonObj.get("carrier")).append("\001") .append(jsonObj.get("city")).append("\001").append(jsonObj.get("user_id")); return sb.toString(); } }
[ "shunshy@126.com" ]
shunshy@126.com
ffa02a1c3a6aa3578657b137e6fd1cea1f6ee4c4
e745b91a52958165b479a9ec7d2a9705bd411033
/src/main/java/ro/parkingapp/restapi/backend/config/ModelMapperConfig.java
d0a8ab1464a7507cd590c28f671d0a3820470ad9
[]
no_license
andonealexandru/dpit-parking-app
5c94c41a03b070314e08433293715e6d62bf2a67
fdbf9a03a6182e646dff0700cfd7246ed8654eef
refs/heads/master
2022-09-20T23:24:28.945838
2019-10-22T18:40:33
2019-10-22T18:40:33
216,885,223
0
0
null
2022-09-08T01:03:11
2019-10-22T18:41:21
Java
UTF-8
Java
false
false
383
java
package ro.parkingapp.restapi.backend.config; import org.modelmapper.ModelMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class ModelMapperConfig { @Bean public ModelMapper modelMapper() { ModelMapper modelMapper = new ModelMapper(); return modelMapper; } }
[ "andonealexandru19@yahoo.com" ]
andonealexandru19@yahoo.com
f6c36fc25687dbdc4b2b9a9140d647ad85f4eb10
dc5a14b36fb58dce25a965145ee65e9f1be44b26
/src/main/java/br/com/acqio/challenge/ChallengeAcqioApplication.java
2f72e8122091ccf5e9e475ca3189fb31acdfae31
[]
no_license
brunoalbrito/acqio-challenge
b6e2e8b04af6b38fa7b345b4b620eeefcef3d82b
a9cc23fd8fd505b5680bb70fbb2a513df21cba3d
refs/heads/master
2020-12-04T04:32:57.797106
2020-01-03T15:22:48
2020-01-03T15:23:46
231,613,780
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package br.com.acqio.challenge; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ChallengeAcqioApplication { public static void main(String[] args) { SpringApplication.run(ChallengeAcqioApplication.class, args); } }
[ "brunoalbuquerquebrito@outlook.com" ]
brunoalbuquerquebrito@outlook.com
d4b049bff83ad16519753cc19e3eb9e1b53b044c
f61d7555de8870e2192c0ec0f72980fc290bc4ba
/src/test/java/org/organicdesign/fp/collections/ImSortedMapTest.java
59a69762454bb41a52adb2d442ada373a8423835
[ "EPL-1.0", "Apache-2.0" ]
permissive
seanf/Paguro
17a74355dc7495fadfa328da612c75e5df61f9f3
0b2496953c365455e4d6e8a15da0d7a0846f0de0
refs/heads/master
2020-03-27T04:58:02.973383
2018-08-13T02:27:00
2018-08-13T02:27:00
145,983,287
0
0
Apache-2.0
2018-08-24T11:29:08
2018-08-24T11:29:08
null
UTF-8
Java
false
false
548
java
package org.organicdesign.fp.collections; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ImSortedMapTest { @Test public void testCov() { ImSortedMap<String,Integer> m = PersistentTreeMap.empty(); m = m.assoc("Hello", 73); m = m.assoc("Goodbye", 74); m = m.assoc("Maybe", 75); assertEquals(Integer.valueOf(73), m.getOrElse("Hello", 37)); assertEquals(Integer.valueOf(37), m.getOrElse("Helloz", 37)); assertEquals(2, m.headMap("Maybe").size()); } }
[ "glen@organicdesign.org" ]
glen@organicdesign.org
9e1e54db93c44ea8d8d9c8ac628fde5185cb9680
4d7e368bffa01c1d5616eaff59281a002ef39541
/src/main/java/leiDina/biz/scene/MainScene.java
5da6b30fe02e26736c5488f441e49f3480c603ba
[]
no_license
lorik759/leiDina
da6dba79a00b9e4fde292630735fa8faf156f123
020c487e413192a7b66a0f417fab3e7fb01a52b5
refs/heads/master
2021-01-31T11:16:40.675868
2020-06-16T23:38:57
2020-06-16T23:38:57
243,514,920
0
0
null
2020-03-27T13:37:22
2020-02-27T12:33:04
Java
UTF-8
Java
false
false
516
java
package main.java.leiDina.biz.scene; import java.net.URL; import main.java.leiDina.tec.javafx.scene.Scenes; /** * @author vitor.alves */ public class MainScene implements Scenes { private static final String LOCATION = "/main/java/leiDina/biz/view/MainView.fxml"; private static final String TITLE = "Leitura Dinamica"; @Override public URL getLocation() { return this.getClass().getResource(LOCATION); } @Override public String getTitle() { return TITLE; } }
[ "vitors.alves@hotmail.com" ]
vitors.alves@hotmail.com
120f974f0da703511c4072c1e10153b9cbaf20f3
ed491ac6bf31c2bae1ebca7d8b1bcfa7cafd7e3f
/Demo01-Log/Log3-Log4j2/src/main/java/com/study/log/log4j21/test/LogTest.java
1b65e830bde745eec3d52b1d96c366d96fb63abe
[]
no_license
ropert911/study01_java_base
026f2569e0ec8a54e60ddd7d34168697badeacca
566ac96a2d1c2140cebd203680e834fa044934e8
refs/heads/master
2022-12-22T08:11:44.828233
2021-11-16T02:11:46
2021-11-16T02:11:46
142,754,027
0
0
null
2022-12-10T05:44:55
2018-07-29T11:10:11
Java
UTF-8
Java
false
false
435
java
package com.study.log.log4j21.test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LogTest { private static final Logger logger = LoggerFactory.getLogger(LogTest.class); public static void printlog(){ logger.trace("LogTest:trace"); logger.debug("LogTest:debug"); logger.info("LogTest: info"); logger.warn("LogTest:warn"); logger.error("LogTest:error"); } }
[ "ropert911@163.com" ]
ropert911@163.com
a432de69e22b875028e23106587e6d2176a72dc4
da325adc2c4e397125917b44d155b30b3c19b1bc
/src/main/java/com/wannabe/be/product/vo/PurchaseHistoryVO.java
70dda78a4daf908ff7b95be26397d735d02fcbee
[]
no_license
ajajee/SAGOGAGU
d637aa28ecd731666b2260eeb420614011025fbb
e43c42319059c7fa9374fad8ec49bb36f92937a1
refs/heads/master
2023-08-14T17:01:16.429571
2021-09-17T06:06:07
2021-09-17T06:06:07
385,141,209
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package com.wannabe.be.product.vo; import java.sql.Date; import com.wannabe.be.address.vo.AddressVO; import lombok.Data; @Data public class PurchaseHistoryVO { int product_no; int product_quantity; int product_price; int product_delivery_price; int product_sale_percent; int address_id; String address_message; String purchase_history_state; Date regdate; Date delivery_start_datetime; Date deliver_end_datetime; Date cancel_request_datetime; Date refund_request_datetime; Date refund_complete_datetime; String member_id; String product_title; }
[ "noreply@github.com" ]
noreply@github.com
b5ccec6aa0ce875ef14a4c66a2345c6d3f030b3d
515d2b04024825cbdf2bd03d9b1e194f247e1fb2
/helloworld/src/main/java/com/turkcell/bipai/helloworld/config/AppInitializer.java
02b861d1d0a83725f0f496be6a0fe62ddf99b406
[]
no_license
Hsx/BiP.AI
74677a8ad2a1598692d9042e592aa4e1bcc3b158
fcc71cdde1a10fc522e670fa16086de1545cdaf4
refs/heads/master
2020-04-07T18:11:29.020535
2016-11-25T13:20:06
2016-11-25T13:20:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,165
java
package com.turkcell.bipai.helloworld.config; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; public class AppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebMvcConfiguration.class); // Manage the lifecycle of the root application context servletContext.addListener(new ContextLoaderListener(rootContext)); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); } }
[ "saacbip@gmail.com" ]
saacbip@gmail.com
2a9b0229051a110e2a66bd403ccbddd4102d8cd1
2ce07565d7644586686aa63c256f3288a010c40b
/app/src/main/java/com/zuomei/auxiliary/MLAuxiliaryActivity.java
15139667f078df05b2d14a3227714db718778d51
[]
no_license
yundequanshi/TxQipei
42a3f13d3bf95ecf5681ac45c929aef09f082b88
17edbbc47a47f005ee9934c94a43e38bc2deb115
refs/heads/master
2021-02-19T09:05:13.905941
2020-03-06T09:12:01
2020-03-06T09:12:01
245,298,297
0
0
null
null
null
null
UTF-8
Java
false
false
20,212
java
package com.zuomei.auxiliary; import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager.BackStackEntry; import android.support.v4.app.FragmentTransaction; import android.view.KeyEvent; import com.txsh.R; import com.txsh.home.SecondSerach; import com.txsh.home.TXInfoDetailFrg; import com.zuomei.base.BaseActivity; import com.zuomei.base.BaseApplication; import com.zuomei.constants.MLConstants; import com.zuomei.home.MLAccidentDetailFrg; import com.zuomei.home.MLAccidentFrg; import com.zuomei.home.MLAccidentadd1Frg; import com.zuomei.home.MLAccidentadd2Frg; import com.zuomei.home.MLAccidentadd3Frg; import com.zuomei.home.MLAdvanDetailFrg; import com.zuomei.home.MLAdvanadd1Frg; import com.zuomei.home.MLAdvanadd2Frg; import com.zuomei.home.MLAdvanadd3Frg; import com.zuomei.home.MLHomeProductFrg; import com.zuomei.home.MLLeaveDetailFrg; import com.zuomei.home.MLLeaveadd1Frg; import com.zuomei.home.MLLeaveadd2Frg; import com.zuomei.home.MLLeaveadd3Frg; import com.zuomei.home.MLMessageAddFrg; import com.zuomei.home.MLMyAccidentFrg; import com.zuomei.home.MLMyAdvanFrg; import com.zuomei.home.MLMyBusinessFrg; import com.zuomei.home.MLMyCashFrg; import com.zuomei.home.MLMyCommentFrg; import com.zuomei.home.MLMyIntegralFrg; import com.zuomei.home.MLMyLeaveFrg; import com.zuomei.home.MLMyMessageFrg; import com.zuomei.home.MLMyMoneyFrg; import com.zuomei.home.MLMyPasswordFrg; import com.zuomei.home.MLMyProtectFrg; import com.zuomei.model.MLAddDeal; import com.zuomei.model.MLLogin; import cn.ml.base.utils.IEvent; /** * 附属Acitivity * * @author Marcello */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public class MLAuxiliaryActivity extends BaseActivity implements IEvent<Object> { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.auxiliary_main); // 系统回收后 恢复数据 if (savedInstanceState != null) { MLLogin user = (MLLogin) savedInstanceState.getSerializable("user"); BaseApplication.getInstance().set_user(user); BaseApplication._currentCity = savedInstanceState .getString("currentCity"); BaseApplication._messageLastId = savedInstanceState .getString("messageId"); BaseApplication._addDeal = (MLAddDeal) savedInstanceState .getSerializable("deal"); } Intent intent = getIntent(); if (intent != null) { int position = intent.getIntExtra("data", 0); Object obj = intent.getSerializableExtra("obj"); try { fillContent(obj, position); } catch (Exception e) { // 则返回到登录界面 Intent i = getBaseContext().getPackageManager() .getLaunchIntentForPackage( getBaseContext().getPackageName()); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } } } @Override protected void onNewIntent(Intent intent) { // TODO Auto-generated method stub super.onNewIntent(intent); if (intent != null) { int position = intent.getIntExtra("data", 0); fillContent(null, position); } } private Fragment oldFrg; private void fillContent(Object obj, int position) { Fragment fragment = null; FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); switch (position) { // 忘记密码-step1 case MLConstants.LOGIN_PWD1: fragment = MLLoginPwd1Frg.instance(); transaction.addToBackStack(null); break; // 忘记密码-step2 case MLConstants.LOGIN_PWD2: fragment = MLLoginPwd2Frg.instance(obj); transaction.addToBackStack(null); break; // 忘记密码-step2 case MLConstants.LOGIN_PWD3: fragment = MLLoginPwd3Frg.instance(obj); transaction.addToBackStack(null); break; // 首页搜索 case MLConstants.HOME_SEARCH: fragment = MLHomeSearchFrg.instance(obj); transaction.addToBackStack(null); break; // 首页选车 case MLConstants.HOME_CAR: fragment = MLHomeCarFrg.instance(obj); transaction.addToBackStack(null); break; // 首页选车-搜索 case MLConstants.HOME_CAR_SEARCH: fragment = MLHomeCarSearchListFrg.instance(obj); transaction.addToBackStack(null); break; // 商家列表 case MLConstants.HOME_BUSINESS_LIST: fragment = MLHomeBusinessListFrg.instance(obj); transaction.addToBackStack(null); break; // 商家列表 case MLConstants.HOME_BUSINESS_YOU_LIST: fragment = MLHomeBusinessYouListFrg.instance(); transaction.addToBackStack(null); break; // 商家评论 case MLConstants.HOME_COMMENT: fragment = MLBusinessCommentFrg.instance(obj); transaction.addToBackStack(null); break; // 商家信息 case MLConstants.HOME_BUSINESS_INFO: fragment = MLBusinessInfoFrg.instance(obj); transaction.addToBackStack(null); break; // 商家信息 case MLConstants.HOME_PRODUCT: fragment = MLHomeProductFrg.instance(obj); transaction.addToBackStack(null); break; // 互动-发表回复 case MLConstants.MESSAGE_REPLY_ADD: fragment = MLMessageAddFrg.instance(); transaction.addToBackStack(null); break; // 事故车详细 case MLConstants.ACCIDENT_DETAIL: fragment = MLAccidentDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 事故车发布-step1 case MLConstants.ACCIDENT_ADD: fragment = MLAccidentadd1Frg.instance(); transaction.addToBackStack(null); break; // 事故车发布-step2 case MLConstants.ACCIDENT_ADD2: fragment = MLAccidentadd2Frg.instance(obj); transaction.addToBackStack(null); break; // 事故车发布-step3 case MLConstants.ACCIDENT_ADD3: fragment = MLAccidentadd3Frg.instance(obj); transaction.addToBackStack(null); break; // 我的-商家基本信息 case MLConstants.MY_BUSINESS_INFO: fragment = MLMyBusinessFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-密码修改 case MLConstants.MY_PASSWORD: fragment = MLMyPasswordFrg.instance(); transaction.addToBackStack(null); break; // 我的-密保问题 case MLConstants.MY_PROTECT: fragment = MLMyProtectFrg.instance(); transaction.addToBackStack(null); break; // 我的-通话记录 case MLConstants.MY_PHONE_D: fragment = MLMyPhoneDFrg.instance(); transaction.addToBackStack(null); break; // 我的-通话记录--搜索 case MLConstants.MY_PHONE_D_SEARCH: fragment = MLMyPhoneDSearchFrg.instance(); transaction.addToBackStack(null); break; // 我的-商品管理 case MLConstants.MY_PRODUCT: fragment = MLMyProductFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-商品发布 case MLConstants.MY_PRODUCT_ADD: fragment = MLMyProductAddFrg.instance(); transaction.addToBackStack(null); break; // 我的- 钱包 case MLConstants.MY_MONEY: fragment = MLMyMoneyFrg.instance(); transaction.addToBackStack(null); break; // 我的-提现 case MLConstants.MY_CASH: { fragment = MLMyCashFrg.instance(); transaction.addToBackStack(null); break; } // 我的-用户量 case MLConstants.MY_USER: { fragment = MLMyUserFrg.instance(); transaction.addToBackStack(null); break; } // 我的-账单 case MLConstants.MY_BILL_D: fragment = MLMyBillDFrg.instance(); transaction.addToBackStack(null); break; // 我的-优惠信息列表 case MLConstants.MY_SPECIAL_LIST: fragment = MLMySpecialFrg.instance(); transaction.addToBackStack(null); break; // 我的-优惠信息详情 case MLConstants.MY_SPECIAL_DETAIL: fragment = MLMySpecialDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-通话记录详情 case MLConstants.MY_PHONE_DETAIL: fragment = MLMyPhoneDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-进货记录 case MLConstants.MY_STOCK: fragment = MLMyStockFrg.instance(); transaction.addToBackStack(null); break; // 我的-进货记录详情 case MLConstants.MY_STOCK_DETAIL: fragment = MLMyStockDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-进货记录添加 case MLConstants.MY_STOCK_ADD: fragment = MLMyStockAddFrg.instance(); transaction.addToBackStack(null); break; // 我的-汽修记录 case MLConstants.MY_REPAIR: fragment = MLMyRepairFrg.instance(); transaction.addToBackStack(null); break; // 我的-汽修详情 case MLConstants.MY_PRODUCT_DETAIL: fragment = MLMyRepairDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的-收藏 case MLConstants.MY_COLLECT: fragment = MLMyCollectFrg.instance(); transaction.addToBackStack(null); break; // 我的-汽修记录添加 case MLConstants.MY_REPAIR_ADD: fragment = MLMyRepairAddFrg.instance(); transaction.addToBackStack(null); break; // 我的-联系我们 case MLConstants.MY_CONTACT: fragment = MLMyContactFrg.instance(); transaction.addToBackStack(null); break; // 我的-绑定财付通 case MLConstants.MY_BIND: fragment = MLBindFrg.instance(obj); transaction.addToBackStack(null); break; // 汽修厂-返利 case MLConstants.MY_DEPOT_FANLI: fragment = MLMyFanliFrg.instance(); transaction.addToBackStack(null); break; // 拨打电话 case MLConstants.HOME_CALL: fragment = MLHomeCallFrg.instance(obj); transaction.addToBackStack(null); break; // 交易评论 case MLConstants.MY_DEAL_COMMENT: fragment = MLMyCommentFrg.instance(obj); transaction.addToBackStack(null); break; case MLConstants.MY_TOOLS: fragment = MLMyToolFrg.instance(); transaction.addToBackStack(null); break; // =======二期================= case MLConstants.MY_ACCIDENT: fragment = MLMyAccidentFrg.instance(); transaction.addToBackStack(null); break; // 我的-通话记录详情(时间段) case MLConstants.MY_PHONE_DETAIL2: fragment = MLMyPhoneDetail2Frg.instance(obj); transaction.addToBackStack(null); break; // 我的互动 case MLConstants.MY_MESSAGE: fragment = MLMyMessageFrg.instance(); transaction.addToBackStack(null); break; // 我的二手件 case MLConstants.MY_LEAVE: fragment = MLMyLeaveFrg.instance(); transaction.addToBackStack(null); break; // 二手件详情 case MLConstants.MY_LEAVE_DETAIL: fragment = MLLeaveDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的二手件-STEP1 case MLConstants.MY_LEAVE_ADD1: fragment = MLLeaveadd1Frg.instance(); transaction.addToBackStack(null); break; // 我的二手件-STEP2 case MLConstants.MY_LEAVE_ADD2: fragment = MLLeaveadd2Frg.instance(obj); transaction.addToBackStack(null); break; // 我的二手件-STEP3 case MLConstants.MY_LEAVE_ADD3: fragment = MLLeaveadd3Frg.instance(obj); transaction.addToBackStack(null); break; // 我的优势件 case MLConstants.MY_ADVAN: fragment = MLMyAdvanFrg.instance(); transaction.addToBackStack(null); break; // 我的优势件-STEP1 case MLConstants.MY_ADVAN_ADD1: fragment = MLAdvanadd1Frg.instance(); transaction.addToBackStack(null); break; // 我的优势件-STEP2 case MLConstants.MY_ADVAN_ADD2: fragment = MLAdvanadd2Frg.instance(obj); transaction.addToBackStack(null); break; // 我的优势件-STEP3 case MLConstants.MY_ADVAN_ADD3: fragment = MLAdvanadd3Frg.instance(obj); transaction.addToBackStack(null); break; // 我的优势件-详情 case MLConstants.MY_ADCAN_DETAIL: fragment = MLAdvanDetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的积分(签到) case MLConstants.MY_INTRGRAL: fragment = MLMyIntegralFrg.instance(); transaction.addToBackStack(null); break; // 抽奖 case MLConstants.MY_LOTTERY: fragment = MLLotteryFrg.instance(); transaction.addToBackStack(null); break; // 抽奖记录 case MLConstants.MY_LOTTERY_LIST: fragment = MLLotteryRecordFrg.instance(); transaction.addToBackStack(null); break; // 抽奖规则 case MLConstants.MY_LOTTERY_DETAIL: fragment = MLLotteryDetailFrg.instance(); transaction.addToBackStack(null); break; // 绑定银行卡 case MLConstants.MY_BANK_CARD: fragment = MLMyBankCardFrg.instance(); transaction.addToBackStack(null); break; // 企业宣言 case MLConstants.MY_MANIFESTO: fragment = MLMyManifestoFrg.instance(obj); transaction.addToBackStack(null); break; // 红包管理 case MLConstants.MY_PACKET: fragment = MLMyPacketFrg.instance(); transaction.addToBackStack(null); break; // 汽修厂-上传发货单 case MLConstants.MY_BILL2: fragment = MLMyBill2Frg.instance(); transaction.addToBackStack(null); break; // 我的账单-最近商家 case MLConstants.MY_BILL2_BUSINESS: fragment = MLMyPhoneBusinessFrg.instance(); transaction.addToBackStack(null); break; // 我的账单-历史账单 case MLConstants.MY_BILL2_BUSINESS_LIST: fragment = MLMyBill2ListFrg.instance(); transaction.addToBackStack(null); break; // 我的账单-账单详情 case MLConstants.MY_BILL2_BUSINESS_DETAIL: fragment = MLMyBill2DetailFrg.instance(obj); transaction.addToBackStack(null); break; // 我的--支付密码 case MLConstants.MY_PAY_PWD: fragment = MLMyPayPwdFrg.instance(obj); transaction.addToBackStack(null); break; // =======事故车报价模块---汽修厂========================== // 汽修厂-配件报价 case MLConstants.PART_DEPOT: fragment = MLDepotPartAdd.instance(); transaction.addToBackStack(null); break; // 汽修厂-商家报价详情 case MLConstants.PART_DEPOT_DETAIL: fragment = MLDepotOfferDetail.instance(obj); transaction.addToBackStack(null); break; // 汽修厂-我的 配件列表 case MLConstants.MY_ACCIDENT_PART: fragment = MLMyAccidentPart.instance(); transaction.addToBackStack(null); break; // 汽修厂-我的事故车报价--商家列表 case MLConstants.MY_ACCIDENT_BUSSINESS: fragment = MLMyAccidentBnList.instance(obj); transaction.addToBackStack(null); break; // 汽修厂-报价时 选择车型 case MLConstants.MY_PART_CAR: fragment = MLMyPartCarFrg.instance(obj); transaction.addToBackStack(null); break; // 上传时选择车型 case MLConstants.MY_PART_CAR1: fragment = MLMyPartCarFrg1.instance(); transaction.addToBackStack(null); break; // 行业资讯详情 case MLConstants.TX_INFO_DETAIL: fragment = TXInfoDetailFrg.instance(obj); transaction.addToBackStack(null); break; // =======事故车报价模块---商家========================== // 商家-我的报价管理 case MLConstants.MY_PART_OFFER: fragment = MLMyPartOffer.instance(); transaction.addToBackStack(null); break; // 报价管理- 商家报价 case MLConstants.MY_PART_OFFER_PRICE: fragment = MLMyPartOfferPrice.instance(obj); transaction.addToBackStack(null); break; // 报价二手车搜索 case MLConstants.Second_Serach: fragment = SecondSerach.instance(obj); transaction.addToBackStack(null); break; case MLConstants.HOME_SECOND_HAND_CAR: fragment = MLAccidentFrg.instance(); transaction.addToBackStack(null); break; default: break; } if (fragment == null) { return; } /* * transaction.replace(R.id.auxiliary_fl_content, fragment); * transaction.setCustomAnimations(android.R.animator.fade_in, * android.R.animator.fade_out); //transaction.show(fragment); * //transaction.commit(); transaction.commitAllowingStateLoss(); */ FragmentManager fragmentManager1 = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager1 .beginTransaction(); Fragment to_fragment = fragmentManager1.findFragmentByTag(fragment .getClass().getName()); if (to_fragment != null) { for (int i = 0; i < fragmentManager1.getBackStackEntryCount(); i++) { BackStackEntry entry = fragmentManager1.getBackStackEntryAt(i); if (fragment.getClass().getName().equals(entry.getName())) { fragmentManager1.popBackStack(entry.getName(), 1); } } } fragmentTransaction.addToBackStack(fragment.getClass().getName()); fragmentTransaction.replace(R.id.auxiliary_fl_content, fragment, fragment.getClass().getName()).commitAllowingStateLoss(); /* * if(oldFrg==null){ transaction.add(R.id.auxiliary_fl_content, * fragment); oldFrg = fragment; transaction.commit(); return; } if * (oldFrg != fragment) { if (!fragment.isAdded()) { // 先判断是否被add过 * transaction.hide(oldFrg).add(R.id.auxiliary_fl_content, * fragment).commit(); // 隐藏当前的fragment,add下一个到Activity中 } else { * transaction.hide(oldFrg).show(fragment).commit(); // * 隐藏当前的fragment,显示下一个 } oldFrg = fragment; * * } */ } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); MLLogin user = BaseApplication.getInstance().get_user(); String currentCity = BaseApplication._currentCity; String messageId = BaseApplication._messageLastId; MLAddDeal deal = BaseApplication._addDeal; outState.putSerializable("user", user); outState.putString("currentCity", currentCity); outState.putString("messageId", messageId); outState.putSerializable("deal", deal); } @Override public void onEvent(Object source, Object eventArg) { fillContent(source, (Integer) eventArg); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { // 按下的如果是BACK,同时没有重复 FragmentManager fragmentManager1 = getSupportFragmentManager(); int size = fragmentManager1.getBackStackEntryCount(); if (size == 1) { finish(); } else { return super.onKeyDown(keyCode, event); } return true; } return super.onKeyDown(keyCode, event); } }
[ "yundequanshi@126.com" ]
yundequanshi@126.com
923ccb7ca035d22bda54e4f667710d44f2177f99
e0ad03b29768fc7b418c51d68da7227894185336
/src/com/exploreAutomation/MergeIntervals.java
868a49236f2dcc32937bfc3965e262d67fb5ab37
[]
no_license
Amit-ExploreAutomation/CodePractice
5eac1632c60a13eb64fa43197723d18d9af1a1b3
fddbff2601c38fc8f10bb60b77af8934f8157f3c
refs/heads/master
2023-02-06T05:11:09.392333
2020-12-06T18:22:18
2020-12-06T18:22:18
258,336,577
0
0
null
null
null
null
UTF-8
Java
false
false
1,512
java
package com.exploreAutomation; /* Given a collection of intervals, merge all overlaping intervals * Example: * Input : [[1,3],[2,6],[8,10],[15,18]] * Output : [[1,6],[8,10],[15,18]] * */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class MergeIntervals { public static void main(String[] args){ int[][] arr = {{1,3},{2,6},{8,10},{15,18}}; System.out.println(merge(arr)); } public static int[][] merge(int[][] intervals){ if(intervals.length <=1){ return intervals; } // we take intervals as that what we are sorting and we will be passing current arr1 in next arr2 than compare // Integer of arr 1 1st element and arr2 1st element. Arrays.sort(intervals, (arr1, arr2) -> Integer.compare(arr1[0],arr2[0])); // as we do not know what will be the size of output, to deal with that situation we can use list List<int[]> output_array = new ArrayList<>(); int[] current_interval = intervals[0]; output_array.add(current_interval); for(int[] interval : intervals){ int current_begin = current_interval[0]; int current_end = current_interval[1]; int next_begin = interval[0]; int next_end = interval[1]; if(current_end >= next_begin){ current_interval[1] = Math.max(current_end,next_end); }else { current_interval = interval; output_array.add(current_interval); } } return output_array.toArray(new int[output_array.size()][]); } }
[ "amit.chaudhary@ticketmaster.com" ]
amit.chaudhary@ticketmaster.com
5485a683c60a91a47e99ebb2a463116d0422f458
4ae7b74bf2873de1b1138cacaee0fcf406f95e11
/irc2/src/info/peluka/ircbot2/userinfo/military/MassDestruction.java
0c6e73f9d0df076ba81a5dc2d04d8d63f209af69
[]
no_license
JoMiPeCa/WorkSpace
d8dddb1ec0e98b49df72bccd06b0a96a01b74227
31b95a0c81bd4d15f8d5ab9b5880aeb4f6a30dde
refs/heads/master
2021-01-20T19:52:34.724032
2016-06-14T17:44:27
2016-06-14T17:44:27
60,852,580
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package info.peluka.ircbot2.userinfo.military; import net.sf.json.JSONObject; /** * * @author Carlos Soza C <carlos.soza at profondos.com> */ public class MassDestruction { private int smallBombs; private int bigBombs; public static MassDestruction make(JSONObject joMassDestruction){ return new MassDestruction(joMassDestruction.getInt("small_bombs"), joMassDestruction.getInt("big_bombs")); } private MassDestruction(int smallBombs, int bigBombs) { this.smallBombs = smallBombs; this.bigBombs = bigBombs; } public int getSmallBombs() { return smallBombs; } public void setSmallBombs(int smallBombs) { this.smallBombs = smallBombs; } public int getBigBombs() { return bigBombs; } public void setBigBombs(int bigBombs) { this.bigBombs = bigBombs; } }
[ "jose.perez@peluka.info" ]
jose.perez@peluka.info
7b91cbfe3d3126f69b5e1dd52d0b42f3242f701f
c040ef231084380bef9565cb3b928f9854795c0e
/cloudalibaba-provider-payment9004/src/main/java/com/study/springcloud/controller/PaymentController.java
6029c09c0d7b0568e4d16ed8f8825770a34aad9d
[]
no_license
lonely-oyente/cloud2020
f8d79dab6f967b31b6cf6a0392409c3d6cf3a099
085fb57ea0d28ae89a58de1d1bb3d59c4c2a1d4b
refs/heads/master
2023-01-27T19:03:36.438541
2020-12-07T03:17:38
2020-12-07T03:17:38
319,190,642
0
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
package com.study.springcloud.controller; import com.study.springcloud.entity.CommonResult; import com.study.springcloud.entity.Payment; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; /** * @author Zh * @date 2020/12/05 15:29 */ @RestController public class PaymentController { public static HashMap<Long, Payment> hashMap = new HashMap<>(); static { hashMap.put(1L, new Payment(1L, "28a8c1e3bc2742d8848569891fb42181")); hashMap.put(2L, new Payment(2L, "bba8c1e3bc2742d8848569891ac32182")); hashMap.put(3L, new Payment(3L, "6ua8c1e3bc2742d8848569891xt92183")); } @Value("${server.port}") private String serverPort; @GetMapping(value = "/paymentSQL/{id}") public CommonResult<Payment> paymentSQL(@PathVariable("id") Long id) { Payment payment = hashMap.get(id); return new CommonResult<>(200, "from mysql,serverPort: " + serverPort, payment); } }
[ "2823969971@qq.com" ]
2823969971@qq.com
e41aa1ce306aacd6e0a7dcc79fd1c5ee8559d31a
46b1dbe5fdb21d28fb44df1a23f8a273f955558e
/src/main/java/morozov/ru/service/serviceimplement/StatisticsServiceImpl.java
d3d31190640499922f55b181069c3b9850e17b0f
[]
no_license
RomanMorozov88/Currency_Converter
eb4b91b7c30659610894b39f014b5c689318d108
ca9503cca1f35fb13e7904c30db4b94a0ccec642
refs/heads/master
2023-01-31T08:58:10.635166
2020-12-17T11:32:03
2020-12-17T11:32:03
313,223,295
0
0
null
null
null
null
UTF-8
Java
false
false
6,417
java
package morozov.ru.service.serviceimplement; import morozov.ru.model.workingmodel.ExchangeStatistics; import morozov.ru.model.workingmodel.Operation; import morozov.ru.model.workingmodel.pair.CurrencyPair; import morozov.ru.model.workingmodel.rate.ExchangeRate; import morozov.ru.service.repository.ExchangeRateRepository; import morozov.ru.service.repository.OperationRepository; import morozov.ru.service.serviceinterface.StatisticsService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; import static java.lang.Double.parseDouble; @Service public class StatisticsServiceImpl implements StatisticsService { private OperationRepository operationRepository; private ExchangeRateRepository exchangeRateRepository; private DecimalFormat decimalFormat; private SimpleDateFormat simpleDateFormat; @Autowired public StatisticsServiceImpl( OperationRepository operationRepository, ExchangeRateRepository exchangeRateRepository, DecimalFormat decimalFormat, @Qualifier("date_bean") SimpleDateFormat simpleDateFormat ) { this.operationRepository = operationRepository; this.exchangeRateRepository = exchangeRateRepository; this.decimalFormat = decimalFormat; this.simpleDateFormat = simpleDateFormat; } /** * Метод для сбора статистики за неделю. * Получает для работы Map<String, List<Operation>> и Map<String, ExchangeRate> * где операции соотносятся с курсами валют по датам- * Необходимо для того, что бы для каждой операции не приходилось идти в БД. * (стоит помнить- дата проведения операции * может отличаться от даты валютного курса- именно для избежания проблем с этим нюансом * и прописан такой образ действий) * * @param pair * @return */ @Transactional(isolation = Isolation.READ_COMMITTED) @Override public ExchangeStatistics getStatistics(CurrencyPair pair) { ExchangeStatistics result = new ExchangeStatistics(); result.setPair(pair); String fromId = pair.getFromCurrency().getId(); Calendar end = Calendar.getInstance(); Calendar start = Calendar.getInstance(); start.add(Calendar.WEEK_OF_YEAR, -1); Map<String, List<Operation>> operations = this.getGroupingOperationsInMap(pair, start, end); Map<String, ExchangeRate> rates = this.getRatesOperationsInMap(operations.keySet(), fromId); double totalFrom = 0; double totalTo = 0; double average = 0; int operationsCount = 0; List<Operation> operationsList = null; ExchangeRate rate = null; for (String stringDate : operations.keySet()) { operationsList = operations.get(stringDate); rate = rates.get(stringDate); for (Operation o : operationsList) { totalFrom += o.getFromAmount(); totalTo += o.getToAmount(); average += rate.getValue(); ++operationsCount; } } result.setTotalSumFrom(parseDouble(decimalFormat.format(totalFrom))); result.setTotalSumTo(parseDouble(decimalFormat.format(totalTo))); result.setAverageRate( parseDouble( decimalFormat.format(average / operationsCount) ) ); return result; } /** * На основе данных из карты(keySet), полученной из метода getGroupingOperationsInMap(...) * формирует карту с нужными ExchangeRate. * * @param stringKeys * @param fromId * @return */ private Map<String, ExchangeRate> getRatesOperationsInMap( Set<String> stringKeys, String fromId ) { Calendar bufferTime = Calendar.getInstance(); Map<String, ExchangeRate> result = null; result = stringKeys.stream() .collect(Collectors.toMap( stringDate -> stringDate, stringDate -> { try { bufferTime.setTime(simpleDateFormat.parse(stringDate)); } catch (ParseException e) { e.printStackTrace(); } return exchangeRateRepository.getNearestRate(fromId, bufferTime); } )); return result; } /** * Получает список операций за некоторый период и преобразует его в * карту со строковыи представлекнием даты с точногстью до дня * в качестве ключа. * Нужно для устранения необохдимости идти в БД за курсом для каждой операции. * * @param pair * @param start * @param end * @return */ private Map<String, List<Operation>> getGroupingOperationsInMap( CurrencyPair pair, Calendar start, Calendar end ) { List<Operation> operations = operationRepository.getOperations(pair, start, end); Map<String, List<Operation>> result = null; if (operations != null && operations.size() > 0) { result = operations.stream() .collect( Collectors.groupingBy( operation -> simpleDateFormat.format(operation.getDate().getTime()) ) ); } return result; } }
[ "MorozovRoman.88@mail.ru" ]
MorozovRoman.88@mail.ru
385b44c4140f8bbc307072697a4d93a01490b3aa
173e643f234838978f0fcfd381ec9c4ac7b50a0b
/src/main/java/com/jeta/forms/gui/form/FormContainerComponent.java
e16c813704e4263ca94fdb0122306f76bed2e40b
[]
no_license
wolcengit/abeille
7706590a0677690499513c8221beb992c9b07bef
70969d970aa84bfb74e38b3acc758059088a6d9a
refs/heads/master
2021-01-12T15:27:41.802897
2018-07-03T13:27:56
2018-07-03T13:27:56
71,789,067
2
1
null
null
null
null
UTF-8
Java
false
false
6,677
java
/* * Copyright (c) 2004 JETA Software, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * o Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * o Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * o Neither the name of JETA Software nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.jeta.forms.gui.form; import java.awt.Component; import java.awt.Container; import com.jeta.forms.components.panel.FormPanel; import com.jeta.forms.gui.beans.JETABean; /** * A FormContainerComponent is a standard Swing component that can have embedded * forms as children. An example of type type of component is a JTabbedPane. A * JTabbedPane is a StandardComponent in our architecture; however, it is the * only GridComponent besides a FormComponent that can have embedded forms as * children. We have this specialized class for the sole purpose of propagating * gridcomponent events up the forms hierarchy when in design mode. JSplitPanes * are not currrently supported, but they would also be an example of a * FormContainerComponent. * * @author Jeff Tassin */ public class FormContainerComponent extends StandardComponent implements GridViewListener { /** * Creates an uninitialized <code>FormContainerComponent</code> instance. */ public FormContainerComponent() { } /** * Creates a <code>FormContainerComponent</code> instance with the * specified parent view. * * @param parentView * the view that contains this component */ public FormContainerComponent(GridView parentView) { super(parentView); } /** * Creates a <code>FormContainerComponent</code> instance with the * specified jetabean and parent view. * * @param jbean * a JETABean that contains a Swing component that can contain an * embedded form. Currently, we are limited to JTabbedPane (or in * the future a JSplitPane). * @param parentView * the view that contains this component */ public FormContainerComponent(JETABean jbean, GridView parentView) { super(jbean, parentView); } /** * If this component is selected, then it is returned. Otherise, this call * is forwarded to any nested forms contained by this component. * * @returns the first selected component it finds in the component hierarhcy * of this container. */ public GridComponent getSelectedComponent() { if (isSelected()) return this; Component comp = getBeanDelegate(); if (comp instanceof Container) return getSelectedComponent((Container) comp); return null; } /** * Returns the first selected GridComponent found in the specified component * hierarchy. * * @returns the first selected component it finds in the component hierarhcy * of this container. */ public GridComponent getSelectedComponent(Container cc) { if (cc == null) return null; for (int index = 0; index < cc.getComponentCount(); index++) { Component comp = cc.getComponent(index); if (comp instanceof FormComponent) { FormComponent fc = (FormComponent) comp; GridComponent gc = fc.getSelectedComponent(); if (gc != null) return gc; } else if (comp instanceof FormContainerComponent) { FormContainerComponent fc = (FormContainerComponent) comp; GridComponent gc = fc.getSelectedComponent(); if (gc != null) return gc; } else if (comp instanceof GridComponent) { GridComponent gc = (GridComponent) comp; if (gc.isSelected()) return gc; } } return null; } /** * GridViewListener implementation. Forwards any GridView events from any * nested forms to any GridCellListeners on this component. */ public void gridChanged(GridViewEvent evt) { if (evt.getId() == GridViewEvent.EDIT_COMPONENT) { if (evt.getComponentEvent() != null) fireGridCellEvent(evt.getComponentEvent()); } else if (evt.getId() == GridViewEvent.CELL_SELECTED) { if (evt.getComponentEvent() != null) fireGridCellEvent(evt.getComponentEvent()); } else { if (evt.getComponentEvent() != null) fireGridCellEvent(evt.getComponentEvent()); } } /** * PostInitialize is called once after all components in a form have been * re-instantiated at runtime (not design time). This gives each property * and component a chance to do some last minute initializations that might * depend on the top level parent. FormComponent simply forwards the call to * any children. */ public void _postInitialize(FormPanel panel, Container cc) { if (cc == null) return; for (int index = 0; index < cc.getComponentCount(); index++) { Component comp = cc.getComponent(index); if (comp instanceof GridComponent) ((GridComponent) comp).postInitialize(panel); else if (comp instanceof Container) _postInitialize(panel, (Container) comp); } } /** * PostInitialize is called once after all components in a form have been * re-instantiated at runtime (not design time). This gives each property * and component a chance to do some last minute initializations that might * depend on the top level parent. FormComponent simply forwards the call to * any children. */ public void postInitialize(FormPanel panel) { super.postInitialize(panel); if (this.getBeanDelegate() instanceof Container) { _postInitialize(panel, (Container) this.getBeanDelegate()); } } }
[ "wolcen@msn.com" ]
wolcen@msn.com
fd9abd59da1875dda3a414e9f776668b43a6518a
c53ed26fee4164d4724e1ca77f1e87538e0d91c7
/src/com/mobius/legend/namegenerator/CategorizedTokenNameTemplate.java
ad6c62bc68441ee7c20cd45e2b2c43929c344256
[]
no_license
smattox/burnlegend
6e7a7664ab121e4db7488f5d455f3fe3687e2ac2
9f8989a5addd0f1d89cbd8e90a72ccea594a7e81
refs/heads/master
2016-09-16T12:48:24.380781
2013-09-08T18:37:57
2013-09-08T18:37:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package com.mobius.legend.namegenerator; public class CategorizedTokenNameTemplate implements ICategorizedTokenNameTemplate { private final TokenCategory[] categories; public CategorizedTokenNameTemplate(TokenCategory[] categories) { this.categories = categories; } public TokenCategory[] getCategories() { return categories; } }
[ "sean.mattox@gmail.com" ]
sean.mattox@gmail.com
39f23374b24a0d86065cdcc23447fd0e303287d9
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/反混淆后/src/main/java/p000a/p010i/p011b/p012a/p015c/p037i/p038b/C25171j.java
aa7aba34906004a1f6598f653e0e2c7596b3ef71
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,135
java
package p000a.p010i.p011b.p012a.p015c.p037i.p038b; import com.facebook.share.internal.ShareConstants; import com.tencent.matrix.trace.core.AppMethodBeat; import p000a.C37091y; import p000a.p005f.p007b.C25052j; import p000a.p010i.p011b.p012a.p015c.p018b.C25093y; import p000a.p010i.p011b.p012a.p015c.p045l.C25235p; import p000a.p010i.p011b.p012a.p015c.p045l.C46867w; import p000a.p010i.p011b.p012a.p015c.p045l.C8235ad; /* renamed from: a.i.b.a.c.i.b.j */ public abstract class C25171j extends C41432f<C37091y> { public static final C8199a BET = new C8199a(); /* renamed from: a.i.b.a.c.i.b.j$a */ public static final class C8199a { private C8199a() { } public /* synthetic */ C8199a(byte b) { this(); } public static C25171j awi(String str) { AppMethodBeat.m2504i(122090); C25052j.m39376p(str, ShareConstants.WEB_DIALOG_PARAM_MESSAGE); C25171j c25172b = new C25172b(str); AppMethodBeat.m2505o(122090); return c25172b; } } /* renamed from: a.i.b.a.c.i.b.j$b */ public static final class C25172b extends C25171j { private final String message; public C25172b(String str) { C25052j.m39376p(str, ShareConstants.WEB_DIALOG_PARAM_MESSAGE); AppMethodBeat.m2504i(122092); this.message = str; AppMethodBeat.m2505o(122092); } /* renamed from: b */ public final /* synthetic */ C46867w mo18011b(C25093y c25093y) { AppMethodBeat.m2504i(122091); C25052j.m39376p(c25093y, "module"); C8235ad awn = C25235p.awn(this.message); C25052j.m39375o(awn, "ErrorUtils.createErrorType(message)"); C46867w c46867w = awn; AppMethodBeat.m2505o(122091); return c46867w; } public final String toString() { return this.message; } } public C25171j() { super(C37091y.AUy); } public final /* synthetic */ Object getValue() { throw new UnsupportedOperationException(); } }
[ "alwangsisi@163.com" ]
alwangsisi@163.com
8c3b78cae3f6104d5f0d09744915fcabc582384d
c065d3c25c4c59a151a6fbb70a81bec6513fbc05
/semeru_jsf_maven/src/main/java/br/com/semeru/entities/TipoEndereco.java
7c97086e1afc1a8f210bfe0cab4c2c14901c92f4
[]
no_license
diegosilvasanchez/semeru_jsf_maven
9f3b6e116626b44c8a88d283df805b7b610970b0
f6ab671a6ff797561a4bbaa19105009284997169
refs/heads/master
2022-12-24T11:10:16.544708
2020-01-10T21:19:52
2020-01-10T21:19:52
226,911,713
0
0
null
2022-12-15T23:46:34
2019-12-09T16:04:55
Java
UTF-8
Java
false
false
2,285
java
package br.com.semeru.entities; import java.io.Serializable; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.ForeignKey; @Entity @Table(name="tipoendereco") public class TipoEndereco implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name="IdTipoEndereco", nullable = false, unique = true) private Integer idTipoEndereco; @Column(name="DescricaoTipoEndereco", nullable = false, length = 35) private String descricaoTipoEndereco; @OneToMany(mappedBy = "tipoendereco", fetch = FetchType.LAZY) @ForeignKey(name = "EnderecoTipoEndereco") private List<Endereco> enderecos; public TipoEndereco() { } public Integer getIdTipoEndereco() { return idTipoEndereco; } public void setIdTipoEndereco(Integer idTipoEndereco) { this.idTipoEndereco = idTipoEndereco; } public String getDescricaoTipoEndereco() { return descricaoTipoEndereco; } public void setDescricaoTipoEndereco(String descricaoTipoEndereco) { this.descricaoTipoEndereco = descricaoTipoEndereco; } public List<Endereco> getEnderecos() { return enderecos; } public void setEnderecos(List<Endereco> enderecos) { this.enderecos = enderecos; } @Override public int hashCode() { int hash = 7; hash = 79 * hash + (this.idTipoEndereco != null ? this.idTipoEndereco.hashCode() : 0); return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoEndereco other = (TipoEndereco) obj; if (this.idTipoEndereco != other.idTipoEndereco && (this.idTipoEndereco == null || !this.idTipoEndereco.equals(other.idTipoEndereco))) { return false; } return true; } }
[ "diego.sanchez@koin.com.br" ]
diego.sanchez@koin.com.br
c1164d9001ffd9dc851a095e6fa5a7839bc9c2b1
e303e188b477195d19872fc2ea0c1388d7acebcf
/app/src/main/java/com/dawn/shenzhoubb_mvvm/home/MarketVm.java
09d1d28d49a5a5ea1cfaa7d734fb223ef9011c6c
[]
no_license
wangxiongtao/shenzhoubb-mvvm
61363778f6edcaebebf57db12f81b0a97c07fae0
33cdaaadc5d862031b4ee8a480c7d9e76c076a60
refs/heads/master
2022-12-27T16:56:15.414086
2020-10-04T16:45:26
2020-10-04T16:45:26
300,565,148
0
0
null
null
null
null
UTF-8
Java
false
false
3,695
java
package com.dawn.shenzhoubb_mvvm.home; import android.graphics.Color; import android.widget.ImageView; import com.dawn.lib_common.base.BaseViewModel; import com.dawn.lib_common.bean.BaseResponse; import com.dawn.lib_common.bean.HomeInfoBean; import com.dawn.lib_common.bindingadapter.GlideApp; import com.dawn.lib_common.http.api.ApiRepository; import com.dawn.lib_common.util.ToastUtils; import com.dawn.lib_common.view.SimpleBannerPageChangeListener; import com.dawn.shenzhoubb_mvvm.RxHttpObserver; import com.youth.banner.adapter.BannerImageAdapter; import com.youth.banner.holder.BannerImageHolder; import com.youth.banner.listener.OnBannerListener; import com.youth.banner.listener.OnPageChangeListener; import java.util.Iterator; import java.util.List; import androidx.databinding.ObservableArrayList; import androidx.lifecycle.MutableLiveData; public class MarketVm extends BaseViewModel { public ObservableArrayList<HomeInfoBean.HomeItemBean> bannerList=new ObservableArrayList<>(); public MutableLiveData<Integer> statusBarColor=new MutableLiveData<>(-1); public MutableLiveData<Object> showDialog=new MutableLiveData<>(); public BannerImageAdapter<HomeInfoBean.HomeItemBean> bannerAdapter=new BannerImageAdapter<HomeInfoBean.HomeItemBean>(null) { @Override public void onBindView(BannerImageHolder holder, HomeInfoBean.HomeItemBean data, int position, int size) { ImageView imageView=holder.imageView; GlideApp.with(imageView.getContext()).load(data.img).placeholder(imageView.getDrawable()).error(imageView.getDrawable()).into(imageView); } }; public OnBannerListener<HomeInfoBean.HomeItemBean> bannerListener= (data, position) -> ToastUtils.showShortToast2("===>"+position); public OnPageChangeListener pageChangeListener=new SimpleBannerPageChangeListener(){ @Override public void onPageSelected(int position) { super.onPageSelected(position); try { String color="#"+bannerList.get(position).style; statusBarColor.postValue(Color.parseColor(color)); }catch (Exception e){ statusBarColor.postValue(-1); } } }; public MarketVm(){ getHomeAds(); } private void getHomeAds(){ ApiRepository.request(ApiRepository.get().getHomeAds("1,10","")) .subscribe(new RxHttpObserver<BaseResponse<List<HomeInfoBean>>>(this) { @Override public void onSuccess(BaseResponse<List<HomeInfoBean>> listBaseResponse) { List<HomeInfoBean> body=listBaseResponse.body; for (Iterator<HomeInfoBean> iterator = body.iterator(); iterator.hasNext(); ) { HomeInfoBean next = iterator.next(); switch (next.adCategoryCode){ case "1": bannerList.clear(); bannerList.addAll(next.adInfoList); String color="#"+bannerList.get(0).style; statusBarColor.postValue(Color.parseColor(color)); break; case "10": break; } } } }); } public void add(){ // getHomeAds(); showDialog.postValue(true); // HashMap<String,Object>map=new HashMap<>(); // map.put("class", DemandDetailActivity.class); // startActivity.postValue(map); } }
[ "1220577523@qq.com" ]
1220577523@qq.com
37457a4825634ad92bc169daea53a53fabeb2058
a735379102c77ae2c7e272a39ee6f80d0d2765ae
/src/main/java/com/example/dto/BaiduResult.java
251fd456ba5c27e1ad56e86393acd14d6b506707
[]
no_license
18826278312/Address
5f757f013805ce8281fa6db75ae837a2af728072
a0e0fc5aba41dc0ac718f6d8a704ee3c58f81938
refs/heads/master
2020-03-30T08:57:30.411984
2018-12-12T09:40:07
2018-12-12T09:40:07
151,052,167
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.example.dto; public class BaiduResult { private String name; private AddressLocation location; public String getName() { return name; } public void setName(String name) { this.name = name; } public AddressLocation getLocation() { return location; } public void setLocation(AddressLocation location) { this.location = location; } }
[ "xiang@192.168.0.101" ]
xiang@192.168.0.101
db581f965a661a3a6e4c788311517820068d5a45
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-forecast/src/main/java/com/amazonaws/services/forecast/model/ListForecastExportJobsRequest.java
4e6dff725656240cc7d27b15a19fa70a41f9333e
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
21,737
java
/* * Copyright 2015-2020 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.forecast.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/forecast-2018-06-26/ListForecastExportJobs" target="_top">AWS * API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListForecastExportJobsRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To retrieve * the next set of results, use the token in the next request. Tokens expire after 24 hours. * </p> */ private String nextToken; /** * <p> * The number of items to return in the response. * </p> */ private Integer maxResults; /** * <p> * An array of filters. For each filter, you provide a condition and a match statement. The condition is either * <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast export jobs * that match the statement from the list, respectively. The match statement consists of a key and a value. * </p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To * include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast * export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the following * filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * </p> */ private java.util.List<Filter> filters; /** * <p> * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To retrieve * the next set of results, use the token in the next request. Tokens expire after 24 hours. * </p> * * @param nextToken * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To * retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To retrieve * the next set of results, use the token in the next request. Tokens expire after 24 hours. * </p> * * @return If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To * retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours. */ public String getNextToken() { return this.nextToken; } /** * <p> * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To retrieve * the next set of results, use the token in the next request. Tokens expire after 24 hours. * </p> * * @param nextToken * If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To * retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours. * @return Returns a reference to this object so that method calls can be chained together. */ public ListForecastExportJobsRequest withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * <p> * The number of items to return in the response. * </p> * * @param maxResults * The number of items to return in the response. */ public void setMaxResults(Integer maxResults) { this.maxResults = maxResults; } /** * <p> * The number of items to return in the response. * </p> * * @return The number of items to return in the response. */ public Integer getMaxResults() { return this.maxResults; } /** * <p> * The number of items to return in the response. * </p> * * @param maxResults * The number of items to return in the response. * @return Returns a reference to this object so that method calls can be chained together. */ public ListForecastExportJobsRequest withMaxResults(Integer maxResults) { setMaxResults(maxResults); return this; } /** * <p> * An array of filters. For each filter, you provide a condition and a match statement. The condition is either * <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast export jobs * that match the statement from the list, respectively. The match statement consists of a key and a value. * </p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To * include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast * export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the following * filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * </p> * * @return An array of filters. For each filter, you provide a condition and a match statement. The condition is * either <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast * export jobs that match the statement from the list, respectively. The match statement consists of a key * and a value.</p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code> * . To include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude * matching forecast export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the * following filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> */ public java.util.List<Filter> getFilters() { return filters; } /** * <p> * An array of filters. For each filter, you provide a condition and a match statement. The condition is either * <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast export jobs * that match the statement from the list, respectively. The match statement consists of a key and a value. * </p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To * include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast * export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the following * filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * </p> * * @param filters * An array of filters. For each filter, you provide a condition and a match statement. The condition is * either <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast * export jobs that match the statement from the list, respectively. The match statement consists of a key * and a value.</p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. * To include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching * forecast export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the * following filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> */ public void setFilters(java.util.Collection<Filter> filters) { if (filters == null) { this.filters = null; return; } this.filters = new java.util.ArrayList<Filter>(filters); } /** * <p> * An array of filters. For each filter, you provide a condition and a match statement. The condition is either * <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast export jobs * that match the statement from the list, respectively. The match statement consists of a key and a value. * </p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To * include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast * export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the following * filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setFilters(java.util.Collection)} or {@link #withFilters(java.util.Collection)} if you want to override * the existing values. * </p> * * @param filters * An array of filters. For each filter, you provide a condition and a match statement. The condition is * either <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast * export jobs that match the statement from the list, respectively. The match statement consists of a key * and a value.</p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. * To include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching * forecast export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the * following filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * @return Returns a reference to this object so that method calls can be chained together. */ public ListForecastExportJobsRequest withFilters(Filter... filters) { if (this.filters == null) { setFilters(new java.util.ArrayList<Filter>(filters.length)); } for (Filter ele : filters) { this.filters.add(ele); } return this; } /** * <p> * An array of filters. For each filter, you provide a condition and a match statement. The condition is either * <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast export jobs * that match the statement from the list, respectively. The match statement consists of a key and a value. * </p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To * include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast * export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the following * filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * </p> * * @param filters * An array of filters. For each filter, you provide a condition and a match statement. The condition is * either <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the forecast * export jobs that match the statement from the list, respectively. The match statement consists of a key * and a value.</p> * <p> * <b>Filter properties</b> * </p> * <ul> * <li> * <p> * <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. * To include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching * forecast export jobs, specify <code>IS_NOT</code>. * </p> * </li> * <li> * <p> * <code>Key</code> - The name of the parameter to filter on. Valid values are <code>ForecastArn</code> and * <code>Status</code>. * </p> * </li> * <li> * <p> * <code>Value</code> - The value to match. * </p> * </li> * </ul> * <p> * For example, to list all jobs that export a forecast named <i>electricityforecast</i>, specify the * following filter: * </p> * <p> * <code>"Filters": [ { "Condition": "IS", "Key": "ForecastArn", "Value": "arn:aws:forecast:us-west-2:&lt;acct-id&gt;:forecast/electricityforecast" } ]</code> * @return Returns a reference to this object so that method calls can be chained together. */ public ListForecastExportJobsRequest withFilters(java.util.Collection<Filter> filters) { setFilters(filters); 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 (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()).append(","); if (getMaxResults() != null) sb.append("MaxResults: ").append(getMaxResults()).append(","); if (getFilters() != null) sb.append("Filters: ").append(getFilters()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListForecastExportJobsRequest == false) return false; ListForecastExportJobsRequest other = (ListForecastExportJobsRequest) obj; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; if (other.getMaxResults() == null ^ this.getMaxResults() == null) return false; if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false) return false; if (other.getFilters() == null ^ this.getFilters() == null) return false; if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode()); hashCode = prime * hashCode + ((getFilters() == null) ? 0 : getFilters().hashCode()); return hashCode; } @Override public ListForecastExportJobsRequest clone() { return (ListForecastExportJobsRequest) super.clone(); } }
[ "" ]
1b03c5a4c3a7c6be4d9891127b360576cd2ae895
a048965d9dbfafd5c963e051a45d1ccd53e57980
/app/src/main/java/com/crazyhitty/chdev/ks/predator/ui/activities/DashboardActivity.java
56e562ff76be13b7908d1eb9da184c9f2cc25cf8
[ "MIT" ]
permissive
CXL3/Capstone-Project
4f371bf85628d3efa1e233750b552795ddcbe51c
f65def00026f18f15b42f09a6edf3253352b8e95
refs/heads/master
2021-01-01T19:53:56.768607
2017-06-16T19:22:49
2017-06-16T19:22:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,555
java
/* * MIT License * * Copyright (c) 2016 Kartik Sharma * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.crazyhitty.chdev.ks.predator.ui.activities; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.ConnectivityManager; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.design.widget.NavigationView; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.Window; import com.crazyhitty.chdev.ks.predator.R; import com.crazyhitty.chdev.ks.predator.receivers.NetworkBroadcastReceiver; import com.crazyhitty.chdev.ks.predator.ui.base.BaseAppCompatActivity; import com.crazyhitty.chdev.ks.predator.ui.fragments.CollectionFragment; import com.crazyhitty.chdev.ks.predator.ui.fragments.PostsFragment; import butterknife.BindView; import butterknife.ButterKnife; /** * Author: Kartik Sharma * Email Id: cr42yh17m4n@gmail.com * Created: 12/24/2016 7:32 PM * Description: This activity holds a navigation menu as well as acts as a main container for mostly * the entire app. */ public class DashboardActivity extends BaseAppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private static final String TAG = "DashboardActivity"; @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.drawer_layout_dashboard) DrawerLayout drawerLayoutDashboard; @BindView(R.id.navigation_view_dashboard) NavigationView navigationView; private NetworkBroadcastReceiver mNetworkBroadcastReceiver; public static void startActivity(@NonNull Context context) { Intent intent = new Intent(context, DashboardActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } /** * Start this activity with any extra intent flags * * @param context Current context of the application * @param flags Intent flags */ public static void startActivity(@NonNull Context context, int flags) { Intent intent = new Intent(context, DashboardActivity.class); intent.setFlags(flags); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); applyTheme(); setContentView(R.layout.activity_dashboard); ButterKnife.bind(this); initNetworKBroadcastReceiver(); initToolbar(); initDrawer(); // Only set fragment when saved instance is null. // This is done inorder to stop reloading fragment on orientation changes. if (savedInstanceState == null) { initFragment(); } } private void applyTheme() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.setStatusBarColor(ContextCompat.getColor(getApplicationContext(), android.R.color.transparent)); } } /** * Initialize network braodcast receiver. */ private void initNetworKBroadcastReceiver() { mNetworkBroadcastReceiver = new NetworkBroadcastReceiver(); registerReceiver(mNetworkBroadcastReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); } /** * Initialize toolbar. */ private void initToolbar() { setSupportActionBar(toolbar); toolbar.setTitle(R.string.app_name); } /** * Initialize navigation drawer. */ private void initDrawer() { // Set up the hamburger icon which will open/close nav drawer ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayoutDashboard, toolbar, R.string.dashboard_open_nav_drawer, R.string.dashboard_close_nav_drawer); drawerLayoutDashboard.addDrawerListener(actionBarDrawerToggle); actionBarDrawerToggle.syncState(); // Set up navigation drawer item clicks navigationView.setNavigationItemSelectedListener(this); } /** * Initialize fragment. */ private void initFragment() { setFragment(R.id.frame_layout_dashboard_container, PostsFragment.newInstance(), false); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { drawerLayoutDashboard.closeDrawer(GravityCompat.START); switch (item.getItemId()) { case R.id.nav_posts: setFragmentOnDashboard(PostsFragment.newInstance()); return true; case R.id.nav_collections: setFragmentOnDashboard(CollectionFragment.newInstance()); return true; // TODO: Implement after bookmarks functionality is completed. /*case R.id.nav_bookmarks: return true;*/ // TODO: Implement after my profile functionality is completed. /*case R.id.nav_my_profile: return false;*/ case R.id.nav_settings: // Start activity after a delay new Handler().postDelayed(new Runnable() { @Override public void run() { SettingsActivity.startActivity(DashboardActivity.this, false); } }, 300); return false; case R.id.nav_about: // Start activity after a delay new Handler().postDelayed(new Runnable() { @Override public void run() { AboutActivity.startActivity(getApplicationContext()); } }, 300); return false; // TODO: Implement after donate(in app purchases) functionality is completed. /*case R.id.nav_donate: return false;*/ case R.id.nav_rating: rateApp(); return false; case R.id.nav_spread_love: shareApp(); return false; default: return false; } } @Override protected void onDestroy() { super.onDestroy(); unregisterReceiver(mNetworkBroadcastReceiver); } @Override public void onBackPressed() { if (drawerLayoutDashboard.isDrawerOpen(GravityCompat.START)) { drawerLayoutDashboard.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } private void setFragmentOnDashboard(final Fragment fragment) { if (!isFragmentVisible(fragment)) { new Handler().postDelayed(new Runnable() { @Override public void run() { setFragment(R.id.frame_layout_dashboard_container, fragment, false); } }, 300); } } }
[ "cr42yh17m4n@gmail.com" ]
cr42yh17m4n@gmail.com
dbc764925bd7c0348c0d21ac77c973456fa30ae9
f3d168ceaadf8783feeee70549dcef87403fc875
/threadsnpatterns/src/threads/Driver.java
2c1d00d7671da1edfd2d071c148e955e3cf877ac
[]
no_license
johnjj07/learning
34cccf4ea47eb2385953a6d5d984afbf50b63464
a699313d4543c5fa06caf6ed81c2fd55c962cdf4
refs/heads/master
2021-01-10T18:38:57.134903
2015-07-01T19:05:37
2015-07-01T19:05:37
38,287,221
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package threads; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; /** * Created by johnsonj on 5/13/15. */ public class Driver { private static final long EXECUTOR_TIMEOUT = 15; public static void main(String[] args) throws Exception{ ExecutorService executor = Executors.newFixedThreadPool(5); for (int i = 0; i < 10; i++) { Runnable worker = new WorkerThread("" + i); executor.execute(worker); } executor.shutdown(); executor.awaitTermination(EXECUTOR_TIMEOUT, TimeUnit.SECONDS); System.out.println("Finished all threads"); } }
[ "jjohnson@extensionhealthcare.com" ]
jjohnson@extensionhealthcare.com
addfe9d6016f190bd8f8a1940a2d8658a148327a
3fc503bed9e8ba2f8c49ebf7783bcdaa78951ba8
/TRAVACC_R5/ndcfacades/src/de/hybris/platform/ndcfacades/ndc/POAAirlineParticipantType.java
77278ff775131d9d2c9b14cae60f13a9550eb677
[]
no_license
RabeS/model-T
3e64b2dfcbcf638bc872ae443e2cdfeef4378e29
bee93c489e3a2034b83ba331e874ccf2c5ff10a9
refs/heads/master
2021-07-01T02:13:15.818439
2020-09-05T08:33:43
2020-09-05T08:33:43
147,307,585
0
0
null
null
null
null
UTF-8
Java
false
false
2,153
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2017.02.07 at 04:46:04 PM GMT // package de.hybris.platform.ndcfacades.ndc; import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * A data type for POA (Participating Offer Airline) Participant Role. Derived from AirlineMsgPartyCoreType. * * <p>Java class for POA_AirlineParticipantType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="POA_AirlineParticipantType"> * &lt;complexContent> * &lt;extension base="{http://www.iata.org/IATA/EDIST}AirlineMsgPartyCoreType"> * &lt;attribute name="SequenceNumber" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" /> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "POA_AirlineParticipantType") public class POAAirlineParticipantType extends AirlineMsgPartyCoreType { @XmlAttribute(name = "SequenceNumber", required = true) @XmlSchemaType(name = "positiveInteger") protected BigInteger sequenceNumber; /** * Gets the value of the sequenceNumber property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getSequenceNumber() { return sequenceNumber; } /** * Sets the value of the sequenceNumber property. * * @param value * allowed object is * {@link BigInteger } * */ public void setSequenceNumber(BigInteger value) { this.sequenceNumber = value; } }
[ "sebastian.rulik@gmail.com" ]
sebastian.rulik@gmail.com
03b49db7cf455ea00750c74387bfff1f4a3aaf0f
a6923e1e56cdbc8bc354cba3e4f699c5f132ae1a
/api/pms-da/pms-da-model/src/main/java/com/fenlibao/model/pms/da/statistics/authentication/AuthenticationForm.java
d5200a45c402cd02804f1c3f2c36906fc2054d9c
[]
no_license
mddonly/modules
851b8470069aca025ea63db4b79ad281e384216f
22dd100304e86a17bea733a8842a33123f892312
refs/heads/master
2020-03-28T03:26:51.960201
2018-05-11T02:24:37
2018-05-11T02:24:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
527
java
package com.fenlibao.model.pms.da.statistics.authentication; /** * Created by Louis Wang on 2015/12/30. */ public class AuthenticationForm { private String beginDate = null; private String endDate = null; public String getBeginDate() { return beginDate; } public void setBeginDate(String beginDate) { this.beginDate = beginDate; } public String getEndDate() { return endDate; } public void setEndDate(String endDate) { this.endDate = endDate; } }
[ "13632415004@163.com" ]
13632415004@163.com
e880565c231058bbc4fecd284cf1d2e93467ba5f
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Math-6/org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer/BBC-F0-opt-20/tests/28/org/apache/commons/math3/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer_ESTest.java
d90b9c25abd5daf2f32b8aef6149f93d84d0ddfa
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
2,177
java
/* * This file was automatically generated by EvoSuite * Sat Oct 23 16:50:03 GMT 2021 */ package org.apache.commons.math3.optim.nonlinear.vector.jacobian; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.apache.commons.math3.optim.ConvergenceChecker; import org.apache.commons.math3.optim.PointVectorValuePair; import org.apache.commons.math3.optim.SimpleVectorValueChecker; import org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class GaussNewtonOptimizer_ESTest extends GaussNewtonOptimizer_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { SimpleVectorValueChecker simpleVectorValueChecker0 = new SimpleVectorValueChecker(0.0, (-1081.7682)); GaussNewtonOptimizer gaussNewtonOptimizer0 = new GaussNewtonOptimizer(true, simpleVectorValueChecker0); // Undeclared exception! try { gaussNewtonOptimizer0.doOptimize(); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer", e); } } @Test(timeout = 4000) public void test1() throws Throwable { GaussNewtonOptimizer gaussNewtonOptimizer0 = new GaussNewtonOptimizer((ConvergenceChecker<PointVectorValuePair>) null); // Undeclared exception! try { gaussNewtonOptimizer0.doOptimize(); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // null is not allowed // verifyException("org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer", e); } } }
[ "pderakhshanfar@serg2.ewi.tudelft.nl" ]
pderakhshanfar@serg2.ewi.tudelft.nl
e7b6806f30344852b9398e945fac220c1545e258
d62b66e70b98018f761fafba097e1741d4b570f2
/app/src/main/java/com/example/zorkreader/MainActivity.java
332a83f12562328a1ed59f92187c7adee6eaf96b
[]
no_license
jphomick/ZorkReaderAndroid
8ff6549d966eefe76245f53e60523d36481922da
c3919ae74d3727385a8b28069f9f76c72da86927
refs/heads/master
2020-06-27T07:51:34.172186
2019-09-12T00:14:26
2019-09-12T00:14:26
199,889,639
0
0
null
null
null
null
UTF-8
Java
false
false
21,800
java
package com.example.zorkreader; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.Switch; import android.widget.TableLayout; import android.widget.TextView; import org.w3c.dom.Text; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class MainActivity extends AppCompatActivity { private long player = -1; private String name = ""; private boolean wait = false; private View defaultView; private MenuItem quit; private MenuItem help; private ArrayList<String> commands = new ArrayList<>(Arrays.asList("check", "move", "take", "use", "equip", "attack", "open", "status")); private ArrayList<String> used = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); used.add("room"); used.add("move"); used.add("north"); used.add("south"); used.add("east"); used.add("west"); setContentView(R.layout.activity_main); SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); long prevId = sharedPref.getLong("id", 0); if (prevId != 0) { TextView txtStart = findViewById(R.id.txtStart); txtStart.setText(String.valueOf(prevId)); } setTitle("Start a game of Zork"); defaultView = findViewById(R.id.layHolder); TextView txtCommand = findViewById(R.id.txtCommand); txtCommand.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { if (actionId == EditorInfo.IME_ACTION_GO) { submit(textView); return true; } return false; } }); txtCommand.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { LinearLayout keywords = findViewById(R.id.layPredict); if (charSequence.toString().contains(" ")) { keywords.removeAllViews(); if (used.size() > 0) { ArrayList<String> toUse = new ArrayList<>(used); if (charSequence.toString().startsWith("move")) { toUse = new ArrayList<>(Arrays.asList("north", "south", "east", "west")); } else if (charSequence.toString().contains("check")) { toUse = new ArrayList<>(Arrays.asList("room", "move")); } else if (charSequence.toString().contains("status")) { toUse = new ArrayList<>(); } for (String word : toUse) { String prev = ""; if (charSequence.toString().split(" ").length > 1) { prev = charSequence.toString().split(" ")[1].toLowerCase(); } if (word.toLowerCase().startsWith(prev) || word.replace(" ", "-").toLowerCase().startsWith(prev)) { Button btn = new Button(getApplicationContext()); btn.setText(word); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TextView txtCommand = findViewById(R.id.txtCommand); String text = txtCommand.getText().toString().split(" ")[0]; String btnText = ((Button) view).getText().toString() .replace(" ", "-"); if (btnText.contains(text)) { txtCommand.setText(""); txtCommand.append(btnText); } else { txtCommand.setText(text.trim() + " "); txtCommand.append(btnText); txtCommand.append(""); } } }); keywords.addView(btn); } } } if (keywords.getChildCount() == 0) { TextView tv = new TextView(getApplicationContext()); tv.setText("No predictions"); keywords.addView(tv); } } else { keywords.removeAllViews(); for (String word : commands) { if (word.toLowerCase().startsWith(charSequence.toString().toLowerCase())) { Button btn = new Button(getApplicationContext()); btn.setText(word); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { TextView txtCommand = findViewById(R.id.txtCommand); txtCommand.setText(""); txtCommand.append(((Button) view).getText() + " "); txtCommand.requestFocus(); HorizontalScrollView scrPredict = findViewById(R.id.scrPredict); scrPredict.post(new Runnable() { @Override public void run() { HorizontalScrollView scrPredict = findViewById(R.id.scrPredict); scrPredict.fullScroll(ScrollView.FOCUS_LEFT); } }); } }); keywords.addView(btn); } } } } @Override public void afterTextChanged(Editable editable) { } }); Switch show = findViewById(R.id.swtCommon); show.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { TableLayout layout = findViewById(R.id.layCommon); if (checked) { layout.setVisibility(View.VISIBLE); } else { layout.setVisibility(View.GONE); } } }); Switch predict = findViewById(R.id.swtPredict); predict.setOnCheckedChangeListener(new Switch.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { LinearLayout layout = findViewById(R.id.layPredict); if (checked) { layout.setVisibility(View.VISIBLE); } else { layout.setVisibility(View.GONE); } } }); findViewById(R.id.layCommon).setVisibility(View.GONE); findViewById(R.id.layGame).setVisibility(View.GONE); findViewById(R.id.layPredict).setVisibility(View.GONE); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); quit = menu.findItem(R.id.itemQuit); help = menu.findItem(R.id.itemHelp); return true; } public void submit(View view) { TextView txtCommand = findViewById(R.id.txtCommand); String text = txtCommand.getText().toString().toLowerCase(); if (wait || text.startsWith("load") || text.startsWith("play")) { return; } String[] splits = text.split(" "); if (splits.length > 1) { String toAdd = splits[1].replace("-", " "); if (used.contains(toAdd)) { used.remove(toAdd); used.add(0, toAdd); } toAdd = splits[0].replace("-", " "); if (commands.contains(toAdd)) { commands.remove(toAdd); commands.add(0, toAdd); } } else { String toAdd = text.replace("-", " "); if (commands.contains(toAdd)) { commands.remove(toAdd); commands.add(0, toAdd); } } wait = true; findViewById(R.id.prgSentCommand).setVisibility(View.VISIBLE); findViewById(R.id.btnSubmit).setVisibility(View.GONE); Thread t = new Thread(new Command(view, text.trim())); t.start(); } public void startNew(View view) { TextView txtStart = findViewById(R.id.txtStart); String text = txtStart.getText().toString(); if (wait) { return; } wait = true; findViewById(R.id.prgLoading).setVisibility(View.VISIBLE); name = text; findViewById(R.id.txtCommand).requestFocus(); Thread t = new Thread(new Start(view, "play " + text)); t.start(); } public void startLoad(View view) { TextView txtStart = findViewById(R.id.txtStart); String text = txtStart.getText().toString(); long id = -1; try { id = Long.parseLong(text); } catch (Exception e) { txtStart.setText(""); txtStart.setHint("Please enter a valid id"); } if (wait) { return; } wait = true; findViewById(R.id.prgLoading).setVisibility(View.VISIBLE); findViewById(R.id.txtCommand).requestFocus(); Thread t = new Thread(new Start(view, "load " + id)); t.start(); } public void buttonCommand(View view) { if (wait) { return; } Button btn = (Button) view; String text = btn.getText().toString().toLowerCase(); wait = true; Thread t = new Thread(new Command(view, text)); t.start(); } @Override public boolean onOptionsItemSelected(MenuItem item) { if (wait) { return false; } switch (item.getItemId()) { case R.id.itemQuit: TextView txtStart = findViewById(R.id.txtStart); txtStart.setText(""); txtStart.setHint("Enter a new name or load an id"); recreate(); return true; case R.id.itemReset: AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setMessage("Are you sure you want to reset the " + "entire Zork game, along with all players?"); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { wait = true; setTitle("Resetting Zork"); findViewById(R.id.prgLoading).setVisibility(View.VISIBLE); findViewById(R.id.layLogin).setVisibility(View.GONE); findViewById(R.id.layGame).setVisibility(View.GONE); Thread t = new Thread(new Command(defaultView, "reset")); t.start(); } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.create().show(); return true; case R.id.itemHelp: wait = true; findViewById(R.id.prgSentCommand).setVisibility(View.VISIBLE); findViewById(R.id.btnSubmit).setVisibility(View.GONE); Thread t = new Thread(new Command(defaultView, "help")); t.start(); return true; default: return super.onOptionsItemSelected(item); } } private String processCommand(String command) { String result = "Unknown Command"; try { if (player < 0 && !command.equals("reset")) { return "No current player!"; } else { if (!(command.startsWith("check") || command.startsWith("reset") || command.startsWith("help") || command.startsWith("status") || command.startsWith("move"))) { command = "act_" + command; } if (!(command.startsWith("reset") || command.startsWith("help"))) { command = player + "_" + command; } command = command.replace(" ", "_"); result = ReadHelper.readTextFromUrl("https://quiet-tundra-15027.herokuapp.com/" + command.trim()); if (command.equals("reset")) { player = -1; name = ""; return "Reset Completed"; } } } catch (IOException e) { return "Invalid Read"; } return result.trim() + "\n---"; } private String processStart(String command) { String result = "Unknown Command"; try { if (player < 0) { command = command.replace(" ", "_"); if (command.startsWith("play")) { result = ReadHelper.readTextFromUrl("https://quiet-tundra-15027.herokuapp.com/" + command.trim()); player = Long.parseLong(result); result = "Player created! Your id is '" + result + "'\nYou are in the Foyer."; } else if (command.startsWith("load") || command.startsWith("reset")) { result = ReadHelper.readTextFromUrl("https://quiet-tundra-15027.herokuapp.com/" + command.trim()); if (command.startsWith("load")) { player = Long.parseLong(command.substring(5)); name = result.substring(14, result.length() - 1); } } } } catch (IOException e) { return "Invalid Read"; } return result.trim() + "\n---"; } class Command implements Runnable { View view; String command; Command(View view, String command) { this.view = view; this.command = command; } @Override public void run() { String result = processCommand(command); runOnUiThread(new PostResult(view, result)); } } class Start implements Runnable { View view; String command; Start(View view, String command) { this.view = view; this.command = command; } @Override public void run() { String result = processStart(command); runOnUiThread(new PostStart(view, result)); } } class PostResult implements Runnable { View view; String result; PostResult(View view, String result) { this.view = view; this.result = result; } @Override public void run() { if (result.startsWith("Reset Completed")) { TextView txtStart = findViewById(R.id.txtStart); txtStart.setText(""); txtStart.setHint("Enter a new name or load an id"); recreate(); return; } else if (result.contains("Things in the")) { String[] words = result.split("\n"); for (int i = 1; i < words.length; i++) { if (words[i].contains("---")) { break; } if (words[i].length() > 0 && !words[i].contains("Things in the")) { String toAdd = words[i].replaceAll(" x\\d+", "") .toLowerCase(); used.remove(toAdd); used.add(0, toAdd); } } } else if (result.contains("Items in your inventory")) { String[] words = result.split("\n"); for (int i = 4; i < words.length; i++) { if (words[i].length() > 0 && !words[i].contains("Items in your inventory") && !words[i].contains("---")) { String toAdd = words[i].replaceAll(" x\\d+", "") .replace(" (equipped)", "") .toLowerCase(); used.remove(toAdd); used.add(0, toAdd); } } } TextView txtCommand = findViewById(R.id.txtCommand); LinearLayout layout = findViewById(R.id.layHistory); txtCommand.setText(""); TextView txtNew = new TextView(view.getContext()); txtNew.setId(layout.getChildCount()); txtNew.setText(result); txtNew.setTextColor(getColor(R.color.colorBlack)); txtNew.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); TextView prev = (TextView) layout.getChildAt(layout.getChildCount() - 1); prev.setTextColor(getColor(R.color.colorGrey)); layout.addView(txtNew); ScrollView scrHistory = findViewById(R.id.scrHistory); scrHistory.post(new Runnable() { @Override public void run() { ScrollView scrHistory = findViewById(R.id.scrHistory); scrHistory.fullScroll(ScrollView.FOCUS_DOWN); } }); wait = false; findViewById(R.id.prgSentCommand).setVisibility(View.GONE); findViewById(R.id.btnSubmit).setVisibility(View.VISIBLE); } } class PostStart implements Runnable { View view; String result; PostStart(View view, String result) { this.view = view; this.result = result; } @Override public void run() { TextView txtCommand = findViewById(R.id.txtCommand); LinearLayout layout = findViewById(R.id.layHistory); if (result.startsWith("Invalid Read")) { TextView txtStart = findViewById(R.id.txtStart); txtStart.setText(""); txtStart.setHint("Please enter a valid id"); } else { setTitle(name + " - " + player); findViewById(R.id.layGame).setVisibility(View.VISIBLE); findViewById(R.id.layLogin).setVisibility(View.GONE); quit.setVisible(true); help.setVisible(true); txtCommand.setText(""); TextView txtNew = new TextView(view.getContext()); txtNew.setId(layout.getChildCount()); txtNew.setText(result); txtNew.setTextColor(getColor(R.color.colorBlack)); txtNew.setTextAlignment(View.TEXT_ALIGNMENT_CENTER); TextView prev = (TextView) layout.getChildAt(layout.getChildCount() - 1); prev.setTextColor(getColor(R.color.colorGrey)); layout.addView(txtNew); ScrollView scrHistory = findViewById(R.id.scrHistory); scrHistory.post(new Runnable() { @Override public void run() { ScrollView scrHistory = findViewById(R.id.scrHistory); scrHistory.fullScroll(ScrollView.FOCUS_DOWN); } }); SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putLong("id", player); editor.apply(); } wait = false; findViewById(R.id.prgLoading).setVisibility(View.GONE); } } }
[ "jphomick@gmail.com" ]
jphomick@gmail.com
2d28f2733b5ed13940da6877ebeaf8a46431b884
f09e5f6db94ec938853226f5361f180b20fb5913
/GameServer/src/com/phoenix/common/messageQueue/DBMessageQueue.java
b8d4d3234c53a5dbdbc936510801293a588655e4
[]
no_license
JustSmallTestDemo1202/SystemServerProject
80f88b7bb38379df63203d667f13b04404a6a122
e01204aa299f0bf4896ea51aed562bddf06a1f2f
refs/heads/master
2016-09-05T10:20:25.745249
2014-04-08T03:26:13
2014-04-08T03:26:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.phoenix.common.messageQueue; import com.phoenix.common.message.dbMessage.DBMessage; import java.util.concurrent.LinkedTransferQueue; /** * 服务器数据库消息队列 * @author rachel */ public class DBMessageQueue { private static final LinkedTransferQueue<DBMessage> messsageQueue = new LinkedTransferQueue<>(); public static LinkedTransferQueue<DBMessage> queue() { return messsageQueue; } }
[ "4388193@qq.com" ]
4388193@qq.com
cf5016d12a1bb4055d2f0adf7180161201674183
4baa2dcf8132ef81ce11d71d5b07c52f78e58fe6
/app/src/main/java/com/lifemenu/eos_pocket_test/blockchain/cypto/util/Base58.java
11181e57f6d9400b691cb95b730ca6f4a6648434
[]
no_license
YYwishp/EOS_Pocket_Test
1881d84afe0057a4363055f31b287d56c2cda192
966180dc2612e09875dee4f8d4650636cb3cc2b6
refs/heads/master
2020-03-28T05:54:14.903517
2018-09-07T09:33:12
2018-09-07T09:33:12
147,802,376
9
4
null
null
null
null
UTF-8
Java
false
false
8,397
java
package com.lifemenu.eos_pocket_test.blockchain.cypto.util; /** * Copyright 2011 Google Inc. * * 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. */ import java.io.UnsupportedEncodingException; import java.math.BigInteger; /** * <p> * Base58 is a way to encode Bitcoin addresses as numbers and letters. Note that * this is not the same base58 as used by Flickr, which you may see reference to * around the internet. * </p> * * * <p> * Satoshi says: why base-58 instead of standard base-64 encoding? * <p> * * <ul> * <li>Don't want 0OIl characters that look the same in some fonts and could be * used to create visually identical looking account numbers.</li> * <li>A string with non-alphanumeric characters is not as easily accepted as an * account number.</li> * <li>E-mail usually won't line-break if there's no punctuation to break at.</li> * <li>Doubleclicking selects the whole number as one word if it's all * alphanumeric.</li> * </ul> */ public class Base58 { public static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray(); private static final int[] INDEXES = new int[128]; static { for (int i = 0; i < INDEXES.length; i++) { INDEXES[i] = -1; } for (int i = 0; i < ALPHABET.length; i++) { INDEXES[ALPHABET[i]] = i; } } /** Encodes the given bytes in base58. No checksum is appended. */ public static String encode(byte[] input) { if (input.length == 0) { return ""; } input = copyOfRange(input, 0, input.length); // Count leading zeroes. int zeroCount = 0; while (zeroCount < input.length && input[zeroCount] == 0) { ++zeroCount; } // The actual encoding. byte[] temp = new byte[input.length * 2]; int j = temp.length; int startAt = zeroCount; while (startAt < input.length) { byte mod = divmod58(input, startAt); if (input[startAt] == 0) { ++startAt; } temp[--j] = (byte) ALPHABET[mod]; } // Strip extra '1' if there are some after decoding. while (j < temp.length && temp[j] == ALPHABET[0]) { ++j; } // Add as many leading '1' as there were leading zeros. while (--zeroCount >= 0) { temp[--j] = (byte) ALPHABET[0]; } byte[] output = copyOfRange(temp, j, temp.length); try { return new String(output, "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // Cannot happen. } } /* swapnibble disabled * Encode an array of bytes as Base58 with an appended checksum as in Bitcoin * address encoding public static String encodeWithChecksum(byte[] input) { byte[] b = new byte[input.length + 4]; System.arraycopy(input, 0, b, 0, input.length); Sha256 checkSum = HashUtils.doubleSha256(b, 0, input.length); System.arraycopy(checkSum.getBytes(), 0, b, input.length, 4); return encode(b); }*/ public static byte[] decode(char[] input) { if (input.length == 0) { return new byte[0]; } // Get rid of any UTF-8 BOM marker. Those should not be present, but might have slipped in nonetheless, // since Java does not automatically discard them when reading a stream. Only remove it, if at the beginning // of the string. Otherwise, something is probably seriously wrong. int inputLen = input.length; int startIndex= 0; if (input[0] == '\uFEFF') { //input = input.substring(1); inputLen--; startIndex = 1; } byte[] input58 = new byte[inputLen]; // Transform the String to a base58 byte sequence for (int i = startIndex; i < inputLen; ++i) { char c = input[i]; int digit58 = -1; if (c >= 0 && c < 128) { digit58 = INDEXES[c]; } if (digit58 < 0) { return null; } input58[i] = (byte) digit58; } // Count leading zeroes int zeroCount = 0; while (zeroCount < input58.length && input58[zeroCount] == 0) { ++zeroCount; } // The encoding byte[] temp = new byte[inputLen]; int j = temp.length; int startAt = zeroCount; while (startAt < input58.length) { byte mod = divmod256(input58, startAt); if (input58[startAt] == 0) { ++startAt; } temp[--j] = mod; } // Do no add extra leading zeroes, move j to first non null byte. while (j < temp.length && temp[j] == 0) { ++j; } return copyOfRange(temp, j - zeroCount, temp.length); } public static byte[] decode(String input) { if (input.length() == 0) { return new byte[0]; } // Get rid of any UTF-8 BOM marker. Those should not be present, but might have slipped in nonetheless, // since Java does not automatically discard them when reading a stream. Only remove it, if at the beginning // of the string. Otherwise, something is probably seriously wrong. if (input.charAt(0) == '\uFEFF') input = input.substring(1); byte[] input58 = new byte[input.length()]; // Transform the String to a base58 byte sequence for (int i = 0; i < input.length(); ++i) { char c = input.charAt(i); int digit58 = -1; if (c >= 0 && c < 128) { digit58 = INDEXES[c]; } if (digit58 < 0) { return null; } input58[i] = (byte) digit58; } // Count leading zeroes int zeroCount = 0; while (zeroCount < input58.length && input58[zeroCount] == 0) { ++zeroCount; } // The encoding byte[] temp = new byte[input.length()]; int j = temp.length; int startAt = zeroCount; while (startAt < input58.length) { byte mod = divmod256(input58, startAt); if (input58[startAt] == 0) { ++startAt; } temp[--j] = mod; } // Do no add extra leading zeroes, move j to first non null byte. while (j < temp.length && temp[j] == 0) { ++j; } return copyOfRange(temp, j - zeroCount, temp.length); } public static BigInteger decodeToBigInteger(String input) { return new BigInteger(1, decode(input)); } // // number -> number / 58, returns number % 58 // private static byte divmod58(byte[] number, int startAt) { int remainder = 0; for (int i = startAt; i < number.length; i++) { int digit256 = (int) number[i] & 0xFF; int temp = remainder * 256 + digit256; number[i] = (byte) (temp / 58); remainder = temp % 58; } return (byte) remainder; } // // number -> number / 256, returns number % 256 // private static byte divmod256(byte[] number58, int startAt) { int remainder = 0; for (int i = startAt; i < number58.length; i++) { int digit58 = (int) number58[i] & 0xFF; int temp = remainder * 58 + digit58; number58[i] = (byte) (temp / 256); remainder = temp % 256; } return (byte) remainder; } private static byte[] copyOfRange(byte[] source, int from, int to) { byte[] range = new byte[to - from]; System.arraycopy(source, from, range, 0, range.length); return range; } }
[ "yywishp@gmail.com" ]
yywishp@gmail.com
a53badc983d36d7750c78fa41eb23a31a6530ba5
0570bf257dbe7be02ed56c3d01831839415446ee
/SocialMediaUserInterface.java
f207e15e1bf9a667fb52823f4dd2438b03641264
[]
no_license
lukepfeiffer/GuiceSample
059809d89c30d3f2ff853154c5500cac7ab91e16
8ce79559c3561cbf7b1335e298bce67983e97061
refs/heads/master
2020-03-15T08:57:34.533038
2018-05-04T00:18:43
2018-05-04T00:18:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package social; import java.util.LinkedList; public interface SocialMediaUserInterface { /* Returns a LinkedList of all the public posts a user has. * @returns LinkedList<String> allPosts * @params none; Each implementation should have a username string member variable * @author Luke Pfeiffer */ public LinkedList<String> getPosts(); /* Returns a LinkedList of the numPosts most recent the public posts a user has. * @returns LinkedList<String> allPosts * @params none; Each implementation should have a username string member variable * @author Luke Pfeiffer */ public LinkedList<String> getPosts( int numPosts ); /* * Returns the total likes on all posts a given user has * @returns an integer of the total likes a user has received * @params none * @author Luke Pfeiffer */ public int numberLikes(); /* * Returns the total comments on all posts a given user has * @returns an integer of the number of likes * @params none * @author Luke Pfeiffer */ public int numberComments(); /* * Returns both number of likes and number of comments * @returns number of Likes + number of comments * @params none * @author Luke Pfeiffer */ public int totalInteractions(); }
[ "lukerpfeiffer@gmail.com" ]
lukerpfeiffer@gmail.com
46f456f1a4707ef9d82ccb6c2dadd5037ac67461
363ddecdc6e4983adb54f2d12319dab0a303684d
/RateIt/src/RateIt/Utilities.java
30d5fd42cb3df09a0782db4b3497d4e1b2616ca0
[]
no_license
CharanSriAdmala/MoviePrediction
cb464de72dbbfe3c558c19bee1a50ef7e5e52b6c
e21ce218a4320b8dc9403eec60b2161d37737e1d
refs/heads/master
2021-08-22T11:34:37.977718
2017-11-30T04:24:30
2017-11-30T04:24:30
109,025,684
0
0
null
2017-11-27T21:43:20
2017-10-31T16:50:00
Java
UTF-8
Java
false
false
45
java
package RateIt; public class Utilities { }
[ "33261981+CharanSriAdmala@users.noreply.github.com" ]
33261981+CharanSriAdmala@users.noreply.github.com
feec97e0f01f264a82d53acf1b1ce23af9b062b7
12e8184493f961d70c109de852768106f59d5b8b
/src/com/utopia/lijiang/util/OsUtil.java
cb2bfa61e2a0ab3a0aee5ae5164bdea95ed72893
[]
no_license
sunxianchao/Lijiang
08becca53b8e93670b2e9937f62b398d3162638a
1512d57e4458b2fb5c7380e3d5f89667686c62c2
refs/heads/master
2021-01-24T04:29:04.086751
2012-06-06T09:22:57
2012-06-06T09:22:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
914
java
package com.utopia.lijiang.util; import java.util.ArrayList; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Vibrator; import android.telephony.SmsManager; public class OsUtil { public static void Dial(Context context,String number){ Uri telUri = Uri.parse("tel:"+number); Intent intent = new Intent(Intent.ACTION_DIAL,telUri); context.startActivity(intent); } public static void Vibrate(Context context){ Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); long[] pattern = {800, 50, 400, 30}; // OFF/ON/OFF/ON... vibrator.vibrate(pattern, 2); } public static void SendMessaqge(String address,String message){ SmsManager smsMgr = SmsManager.getDefault(); ArrayList<String> parts = smsMgr.divideMessage(message); smsMgr.sendMultipartTextMessage(address, null, parts, null, null); } }
[ "eebread@gmail.com" ]
eebread@gmail.com
77353c7f690337f59969056980c72c3fbebaf708
1ed0e7930d6027aa893e1ecd4c5bba79484b7c95
/gacha/source/java/com/vungle/publisher/kr.java
7e2bb19f77db0fa2925953928d8438d62af11be5
[]
no_license
AnKoushinist/hikaru-bottakuri-slot
36f1821e355a76865057a81221ce2c6f873f04e5
7ed60c6d53086243002785538076478c82616802
refs/heads/master
2021-01-20T05:47:00.966573
2017-08-26T06:58:25
2017-08-26T06:58:25
101,468,394
0
1
null
null
null
null
UTF-8
Java
false
false
1,131
java
package com.vungle.publisher; import com.vungle.publisher.ko.a; import dagger.MembersInjector; import javax.inject.Provider; /* compiled from: vungle */ public final class kr implements MembersInjector<a> { static final /* synthetic */ boolean a = (!kr.class.desiredAssertionStatus()); private final Provider<cf> b; private final Provider<ko> c; public final /* synthetic */ void injectMembers(Object obj) { a aVar = (a) obj; if (aVar == null) { throw new NullPointerException("Cannot inject members into a null reference"); } aVar.d = (cf) this.b.get(); aVar.a = this.c; } private kr(Provider<cf> provider, Provider<ko> provider2) { if (a || provider != null) { this.b = provider; if (a || provider2 != null) { this.c = provider2; return; } throw new AssertionError(); } throw new AssertionError(); } public static MembersInjector<a> a(Provider<cf> provider, Provider<ko> provider2) { return new kr(provider, provider2); } }
[ "09f713c@sigaint.org" ]
09f713c@sigaint.org
5b43ad3a44e6e64501c5213cb0ce67999d1a925a
12618e0190eb8615ca3f3ba710ec90913badd68a
/src/main/java/com/github/mmm1245/fabric/fabricserverside/mixin/EntityDisguiseMixin.java
91880e752ead84cb6f16b7b5f45e69cb17ff7278
[ "MIT" ]
permissive
mmm1245/FabricSlimefun
1016411327692e47f9536d9ae098b8144c3b4ea9
880c07211634f631ec4896d5bd21dfe5ff4be688
refs/heads/master
2023-07-07T12:59:45.542450
2021-08-03T12:38:41
2021-08-03T12:38:41
392,312,683
1
1
null
null
null
null
UTF-8
Java
false
false
1,084
java
package com.github.mmm1245.fabric.fabricserverside.mixin; import com.github.mmm1245.fabric.fabricserverside.customregistries.CustomEntityRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.ZombieEntity; import net.minecraft.network.packet.s2c.play.EntityS2CPacket; import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(EntitySpawnS2CPacket.class) public class EntityDisguiseMixin { @Shadow private EntityType<?> entityTypeId; @Inject(at = @At("TAIL"), method = "<init>(ILjava/util/UUID;DDDFFLnet/minecraft/entity/EntityType;ILnet/minecraft/util/math/Vec3d;)V") public void init(CallbackInfo info){ EntityType disguised = CustomEntityRegistry.getInstance().get(entityTypeId); if(disguised != null) this.entityTypeId = disguised; } }
[ "aaa123@pobox.sk" ]
aaa123@pobox.sk
15f595eacbec4568a014a2738db2d51f649c8ceb
710dfa6de7169a023a96c86087473c9531cec646
/Spring学习/学习源码/spring8_factory/src/test/java/com/wei/demo/PersonTest.java
aa05a348b3c3b855cb7eec8ca87f02015203a2da
[]
no_license
nangongchengfeng/chengfeng
7c3901af0ba7fa7e842078d03f323d7552c4e9da
8d78e54e1f6136e6339a3a2ce8d7dbcbb8ca44e7
refs/heads/master
2022-12-20T21:08:25.626471
2019-09-23T12:22:53
2019-09-23T12:22:53
194,624,424
5
0
null
2022-12-16T12:14:48
2019-07-01T07:45:41
Java
UTF-8
Java
false
false
587
java
package com.wei.demo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:applicationContext.xml") public class PersonTest { @Autowired Person person; @Autowired Person person2; @Test public void test(){ System.out.println(person); System.out.println(person2); } }
[ "1794748404@qq.com" ]
1794748404@qq.com
65f079541d36556708216a189eac973465d48062
7e0328bb5b291578ccfd6eec4bcf70a771375943
/mdapsp-final/simulation/Edvard_v3.3/src/experimentos/Experimento16.java
5e263e0653337ba05afe246d89d6aaef3eca554c
[]
no_license
edvard-oliveira/mdapsp
f7cc8cc9a612c1cad92e601caff4f5abcd3f39d9
2b38e8f07801eb508cca2d3b9a6a2c1fd0274daf
refs/heads/master
2020-03-19T06:52:55.338902
2018-06-06T18:44:18
2018-06-06T18:44:18
136,062,990
0
0
null
null
null
null
UTF-8
Java
false
false
27,958
java
package experimentos; import br.usp.icmc.lasdpc.BeQoS.classes.DatacenterConfiguration; import br.usp.icmc.lasdpc.BeQoS.classes.MonitorRecursos; import br.usp.icmc.lasdpc.BeQoS.classes.Utilidades; import br.usp.icmc.lasdpc.BeQoS.classes.VMConfiguration; import java.io.File; import java.util.Calendar; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.NetworkTopology; import org.cloudbus.cloudsim.core.CloudSim; import org.workflowsim.CondorVM; import org.workflowsim.Job; import org.workflowsim.WorkflowDatacenter; import org.workflowsim.WorkflowEngine; import org.workflowsim.WorkflowPlanner; import org.workflowsim.utils.ClusteringParameters; import org.workflowsim.utils.OverheadParameters; import org.workflowsim.utils.Parameters; import org.workflowsim.utils.ReplicaCatalog; /** * * @author Edvard Oliveira * @author Mario Pardo * @version 1.0 * * @Programa: Este programa possui a mesma sequência de Configurações da classe * TemplateProgram2.java, contudo, foram acrescidos comandos para adicionar os * delays de rede do ambiente simulado. * */ public class Experimento16 { public static void main(String[] args) { Experimento16 obj = new Experimento16(); String output = obj.executar(); } public String executar() { Log.printLine("Experimento 16"); //Parametrização do Experimento Parameters.SchedulingAlgorithm f1 = Parameters.SchedulingAlgorithm.EDVSCHED1; String f2 = "Montage_25.xml"; int f3 = Utilidades.APENAS_CLUSTER; //Registrando dados da Configuração do Experimento... Utilidades.escalonador = f1; Utilidades.nomeWorkflow = f2; Utilidades.selectInfra = f3; Log.printLine(f2); //Habilitando mensagens de saída do simulador. Log.disable(); //Define a Escala de Variação dos MI das Tarefas //Solução: uso de uma tabela com 5 valores referentes ao multiplicador usado no método //setRunTimeScale. O intervalo (range) de valores é o que segue: // Valor Sorteado | Tamanho da Escala // 1 | 10 // 2 | 25 // 3 | 50 // 4 | 100 int numEscalas = 5; int escala = (int) (1 + Math.random() * numEscalas); switch (escala) { case 1: escala = 10; break; case 2: escala = 25; break; case 3: escala = 50; break; case 4: escala = 75; break; case 5: escala = 100; break; } Parameters.setRuntimeScale(escala); Log.printLine("Escala gerada = " + escala); //*** //Variáveis de Controle booelanas - Uso: Ativação/Desativação de Datacenters - conforme plano experimental boolean a1 = true; boolean a2 = true; boolean a3 = true; boolean a4 = true; boolean a5 = true; //###################################################################### //CONFIGJRAÇÕES DE EXPERIMENTO //F1 - Algoritmo Parameters.SchedulingAlgorithm escalonador = f1; Utilidades.useDynamicParameterValues(true); //Configuração para uso de valores dinâmicos nos algoritmos EDV1 e EDV2. if (escalonador == Parameters.SchedulingAlgorithm.EDVSCHED1) { Utilidades.generateParameters(); } //F2 - Workflow (DAX File) String daxName = f2; String daxPath = "" + System.getProperty("user.dir") + "/config/dax/" + daxName; // List<String> daxPaths = new ArrayList<>(); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Montage_100.xml"); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Montage_25.xml"); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Montage_1000.xml"); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Protein1AGY_Final.xml"); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Protein1VII_Final.xml"); // daxPaths.add(System.getProperty("user.dir")+"/config/dax/Protein1EOD_Final.xml"); // File df; // for (String dp : daxPaths) { // df = new File(daxPath); // if (!df.exists()) { // Log.printLine("Warning: Please replace daxPath with the physical path in your working environment!"); // return null; // } // } //F3 - Infraestrutura - Tabela de Configuração: foram adotados valores inteiros //para ajudar a definir quais Datacenters da infraestrutura serão considerados em cada experimento. //Os valores considerados (assumidos pela variável selectInfra) são os que seguem: // Utilidades.SEM NUVEM - 0 (i.e., 4 Datacenters: A1, A2, A3 e A4) // Utilidades.COM NUVEM - 1 (i.e., 5 Datacenters: A1, A2, A3, A4 e A5) // Utilidades.APENAS CLUSTER - 2 (i.e., 3 Datacenters: A2, A3 e A4) Utilidades.selectInfra = f3; switch (Utilidades.selectInfra) { case Utilidades.SEM_NUVEM: a5 = false; Log.printLine("Experimento com infra: SEM_NUVEM"); break; case Utilidades.COM_NUVEM: //não precisa nenhum comandos... todos os DCs já estão ativados! Log.printLine("Experimento com infra: COM_NUVEM"); break; case Utilidades.APENAS_CLUSTER: Log.printLine("Experimento com infra: APENAS_CLUSTER"); a1 = false; a5 = false; break; } if (escalonador == Parameters.SchedulingAlgorithm.EDVSCHED2) { Utilidades.deadlineCalculation(daxPath); } //###################################################################### try { //***Configuração da Infraestrutura*** //********************************************************************** //Ambiente A1 - 01 WorkStation //Configuração do Datacenter do WorkStation - Ambiente A1 //Equipamento: //Dell Workstation //Processador Intel® Xeon® E3-1225 V5 (Quad Core, 3.3GHZ com turbo expansível para até 3.7GHZ, Cache de 8MB, HD GRAPHICS P530) //Number of computers Avg. cores/computer GFLOPS/core GFLOPs/computer // 14 3.86 3.19 12.29 int vmNumA1 = 0; DatacenterConfiguration confA1 = null; VMConfiguration vmConfA1 = null; if (a1) { confA1 = new DatacenterConfiguration(); confA1.hostId = 1; confA1.mips = 3200; confA1.num_cores = 4; confA1.num_hosts = 1; confA1.ram = 8000; //Mb confA1.bw = 1000; //MBit/s confA1.storage = 500000; //Mb confA1.arch = "x64"; confA1.os = "Linux"; confA1.vmm = "Xen"; confA1.time_zone = 10.0; //TimeZone onde está o Datacenter confA1.cost = 3.0; //USD confA1.costPerBw = 0.05; //USD confA1.costPerMem = 0.1; //USD confA1.costPerStorage = 0.1; //USD confA1.maxTransferRate = 15; //Configuração de VM para o Ambiente A1 vmNumA1 = 1; vmConfA1 = new VMConfiguration(); vmConfA1.idShift = 1; vmConfA1.bw = 1000; vmConfA1.pesNumber = 4; vmConfA1.mips = 3200; vmConfA1.vmm = "Xen"; vmConfA1.size = 250000; //Tamanho de Imagem em Mbytes vmConfA1.ram = 8000; //MBytes } //********************************************************************** //Ambiente A2 - Cluster de Computadores LaSDPC //Aglomerado computacional: Cosmos, Andromeda, Halley //Estimados: 35 Hosts //Configuração do Datacenter do Cluster - Ambiente A2 //Aglomerado Cosmos //Intel® Core™2 Quad Processor Q9400 (6M Cache, 2.66 GHz, 1333 MHz FSB) //Number of computers Avg. cores/computer GFLOPS/core GFLOPs/computer // 3 3.97 2.97 11.78 int vmNumA2Cosmos = 0; DatacenterConfiguration confCosmos = null; VMConfiguration vmConfCosmos = null; if (a2) { confCosmos = new DatacenterConfiguration(); confCosmos.hostId = 1000; confCosmos.mips = 2970; confCosmos.num_cores = 4; confCosmos.num_hosts = 10; confCosmos.ram = 8000; //Mb confCosmos.bw = 10000; //Mb Total confCosmos.storage = 500000; //Mb confCosmos.arch = "x64"; confCosmos.os = "Linux"; confCosmos.vmm = "Xen"; confCosmos.time_zone = 10.0; confCosmos.cost = 3.0; //USD confCosmos.costPerBw = 0.05; //USD confCosmos.costPerMem = 0.1; //USD confCosmos.costPerStorage = 0.1; //USD //Configuração de VMs Cosmos vmNumA2Cosmos = 10; vmConfCosmos = new VMConfiguration(); vmConfCosmos.idShift = 1000; vmConfCosmos.bw = 1000; vmConfCosmos.pesNumber = 4; vmConfCosmos.mips = 2970; vmConfCosmos.vmm = "Xen"; vmConfCosmos.size = 250000; //Tamanho de Imagem em Mbytes vmConfCosmos.ram = 4000; //MBytes } //********************************************************************** //Aglomerado Andromeda //Equipamento: //AMD Processor Vishera 4.2 Ghz FX(tm)-8350 Eight-Core Processor //Number of computers Avg. cores/computer GFLOPS/core GFLOPs/computer // 140 7.96 3.31 26.33 DatacenterConfiguration confAndromeda = null; VMConfiguration vmConfAndromeda = null; int vmNumA2Andromeda = 0; if (a3) { confAndromeda = new DatacenterConfiguration(); confAndromeda.hostId = 2000; confAndromeda.mips = 3300; confAndromeda.num_cores = 4; confAndromeda.num_hosts = 10; confAndromeda.ram = 8000; //Mb confAndromeda.bw = 10000; //MB Total confAndromeda.storage = 500000; //Mb confAndromeda.arch = "x64"; confAndromeda.os = "Linux"; confAndromeda.vmm = "Xen"; confAndromeda.time_zone = 10.0; confAndromeda.cost = 3.0; //USD confAndromeda.costPerBw = 0.05; //USD confAndromeda.costPerMem = 0.10; //USD confAndromeda.costPerStorage = 0.10; //USD //Configuração de VMs Andromeda vmNumA2Andromeda = 10; vmConfAndromeda = new VMConfiguration(); vmConfAndromeda.idShift = 2000; vmConfAndromeda.bw = 1000; vmConfAndromeda.pesNumber = 4; vmConfAndromeda.mips = 3300; vmConfAndromeda.vmm = "Xen"; vmConfAndromeda.size = 250000; //Tamanho de Imagem em Mbytes vmConfAndromeda.ram = 4000; //MBytes } //********************************************************************** //Aglomerado Halley //Equipamento: //Intel® Core™ I7 Processor – LGA -1150 – 4790 3.60GHZ DMI 5GT/S 8MB //Number of computers Avg. cores/computer GFLOPS/core GFLOPs/computer // 1785 7.93 4.27 33.86 DatacenterConfiguration confHalley = null; VMConfiguration vmConfHalley = null; int vmNumA2Halley = 0; if (a4) { confHalley = new DatacenterConfiguration(); confHalley.hostId = 3000; confHalley.mips = 4300; confHalley.num_cores = 4; confHalley.num_hosts = 15; confHalley.ram = 8000; //Mb confHalley.bw = 15000; //MB Total confHalley.storage = 500000; //Mb confHalley.arch = "x64"; confHalley.os = "Linux"; confHalley.vmm = "Xen"; confHalley.time_zone = 10.0; confHalley.cost = 3.0; //USD confHalley.costPerBw = 0.05; //USD confHalley.costPerMem = 0.10; //USD confHalley.costPerStorage = 0.10; //USD //Configuração de VMs Halley vmNumA2Halley = 15; vmConfHalley = new VMConfiguration(); vmConfHalley.idShift = 3000; vmConfHalley.bw = 1000; vmConfHalley.pesNumber = 4; vmConfHalley.mips = 4300; vmConfHalley.vmm = "Xen"; vmConfHalley.size = 250000; //Tamanho de Imagem em Mbytes vmConfHalley.ram = 4000; //MBytes } //********************************************************************** //Ambiente A3 - Nuvem Privada na SoftLayer //DC Nuvem Privada na SoftLayer //Equipamento: //Quad Intel Xeon E7-4850 v2 (48 Cores, 2.30 GHz) //Number of computers Avg. cores/computer GFLOPS/core GFLOPs/computer // 125 8.00 3.99 31.94 DatacenterConfiguration confSoftLayer = null; VMConfiguration vmConfSoftLayer = null; int vmNumA3SoftLayer = 0; if (a5) { confSoftLayer = new DatacenterConfiguration(); confSoftLayer.hostId = 4000; confSoftLayer.mips = 8000; confSoftLayer.num_cores = 8; confSoftLayer.num_hosts = 10; confSoftLayer.ram = 16000; //Mb confSoftLayer.bw = 10000; //MB Total confSoftLayer.storage = 500000; //Mb confSoftLayer.arch = "x64"; confSoftLayer.os = "Linux"; confSoftLayer.vmm = "Xen"; confSoftLayer.time_zone = 10.0; confSoftLayer.cost = 3.0; //USD confSoftLayer.costPerBw = 0.05; //USD confSoftLayer.costPerMem = 0.10; //USD confSoftLayer.costPerStorage = 0.10; //USD //********* //Configuração de VMs SoftLayer vmNumA3SoftLayer = 10; vmConfSoftLayer = new VMConfiguration(); vmConfSoftLayer.idShift = 4000; vmConfSoftLayer.bw = 1000; vmConfSoftLayer.pesNumber = 8; vmConfSoftLayer.mips = 8000; vmConfSoftLayer.vmm = "Xen"; vmConfSoftLayer.size = 250000; //Tamanho de Imagem em Mbytes vmConfSoftLayer.ram = 4000; //MBytes } //********************************************************************** // APLICAÇÃO - WORKFLOW - Pode ser representado por um List de daxPaths!! // OBS: Para uso de vários workflows, ver assinatura do método Parameteres.init(); // List<String> daxPaths = new ArrayList<>(); // daxPaths.add("/Users/weiweich/NetBeansProjects/WorkflowSim-1.0/config/dax/Montage_100.xml"); // daxPaths.add("/Users/weiweich/NetBeansProjects/WorkflowSim-1.0/config/dax/Montage_25.xml"); // daxPaths.add("/Users/weiweich/NetBeansProjects/WorkflowSim-1.0/config/dax/Montage_1000.xml"); //********************************************************************** File daxFile = new File(daxPath); if (!daxFile.exists()) { String err = "Warning: Please replace daxPath with the physical path in your working environment!"; Log.printLine(err); return err; } //********************************************************************** //Configuração de Geração Dinâmica de Workflow para o Simulador //Gerar valores dinâmicos para os parâmetros amin, pop e ger //Gerar o Workflow Dinâmico: lista de jobs e tasks em formato XML (DAX) //********************************************************************** //Parâmetros de Configuração do Ambiente de Simulação - WorkflowSim //Escalonamento e de Sistema de Arquivos Parameters.SchedulingAlgorithm sch_method = escalonador; Parameters.PlanningAlgorithm pln_method = Parameters.PlanningAlgorithm.EDVARD1; ReplicaCatalog.FileSystem file_system = ReplicaCatalog.FileSystem.SHARED; //ou LOCAL //********************************************************************** //Outros Parâmetros de Inicialização //Overhead OverheadParameters op = new OverheadParameters(0, null, null, null, null, 0); //Clustering ClusteringParameters.ClusteringMethod method = ClusteringParameters.ClusteringMethod.NONE; ClusteringParameters cp = new ClusteringParameters(0, 0, method, null); //Inicializando os Parâmetros do WorkflowSim int vmNum = vmNumA1 + vmNumA2Andromeda + vmNumA2Cosmos + vmNumA2Halley + vmNumA3SoftLayer; Parameters.init(vmNum, daxPath, null, null, op, cp, sch_method, pln_method, null, 0); ReplicaCatalog.init(file_system); //********************************************************************** //Inicialização do CloudSim int num_user = 1; // number of grid users Calendar calendar = Calendar.getInstance(); boolean trace_flag = false; // mean trace events // Initialize the CloudSim library CloudSim.init(num_user, calendar, trace_flag); //********************************************************************** //---> Criação dos Objetos do Cenário de Simulação <--- //Criação do Datacenter - Ambiente A1 WorkflowDatacenter dcA1WorkStation = null; WorkflowDatacenter dcA2Cosmos = null; WorkflowDatacenter dcA3Andromeda = null; WorkflowDatacenter dcA4Halley = null; WorkflowDatacenter dcA5SoftLayer = null; if (a1) { dcA1WorkStation = Utilidades.createCustomDatacenter("DC_WorkStation", confA1); } //Criação do Datacenter - Ambiente A2 - Cosmos if (a2) { dcA2Cosmos = Utilidades.createCustomDatacenter("DC_Cosmos", confCosmos); } //Criação do Datacenter - Ambiente A2 - Andromeda if (a3) { dcA3Andromeda = Utilidades.createCustomDatacenter("DC_Andromeda", confAndromeda); } //Criação do Datacenter - Ambiente A2 - Halley if (a4) { dcA4Halley = Utilidades.createCustomDatacenter("DC_Halley", confHalley); } //Criação do Datacenter - Ambiente A3 - SoftLayer if (a5) { dcA5SoftLayer = Utilidades.createCustomDatacenter("DC_SoftLayer", confSoftLayer); } //Inicialização do WorkflowSim - definição de 5 escalonadores WorkflowPlanner wfPlanner = new WorkflowPlanner("planner_0", 1); WorkflowEngine wfEngine = wfPlanner.getWorkflowEngine(); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ List<CondorVM> vmListA1 = null; List<CondorVM> vmListA2Cosmos = null; List<CondorVM> vmListA2Andromeda = null; List<CondorVM> vmListA2Halley = null; List<CondorVM> vmListA3SoftLayer = null; //Criando as listas de VMs para cada Datacenter if (a1) { vmListA1 = Utilidades.createCustomVM(wfEngine.getSchedulerId(0), vmNumA1, vmConfA1); } if (a2) { vmListA2Cosmos = Utilidades.createCustomVM(wfEngine.getSchedulerId(0), vmNumA2Cosmos, vmConfCosmos); } if (a3) { vmListA2Andromeda = Utilidades.createCustomVM(wfEngine.getSchedulerId(0), vmNumA2Andromeda, vmConfAndromeda); } if (a4) { vmListA2Halley = Utilidades.createCustomVM(wfEngine.getSchedulerId(0), vmNumA2Halley, vmConfHalley); } if (a5) { vmListA3SoftLayer = Utilidades.createCustomVM(wfEngine.getSchedulerId(0), vmNumA3SoftLayer, vmConfSoftLayer); } //Imprimindo tamanho das listas de VMs if (a1) { Log.printLine("vmLst1 = " + vmListA1.size()); } if (a2) { Log.printLine("vmLst2 = " + vmListA2Cosmos.size()); } if (a3) { Log.printLine("vmLst3 = " + vmListA2Andromeda.size()); } if (a4) { Log.printLine("vmLst4 = " + vmListA2Halley.size()); } if (a5) { Log.printLine("vmLst5 = " + vmListA3SoftLayer.size()); } //Enviando listas de VMs ao componente WorkFlowEngine if (a1) { wfEngine.submitVmList(vmListA1, 0); } if (a2) { wfEngine.submitVmList(vmListA2Cosmos, 0); } if (a3) { wfEngine.submitVmList(vmListA2Andromeda, 0); } if (a4) { wfEngine.submitVmList(vmListA2Halley, 0); } if (a5) { wfEngine.submitVmList(vmListA3SoftLayer, 0); } //Iniciar Simulação e coletar resultados de experimento if (a1) { wfEngine.bindSchedulerDatacenter(dcA1WorkStation.getId(), 0); } if (a2) { wfEngine.bindSchedulerDatacenter(dcA2Cosmos.getId(), 0); } if (a3) { wfEngine.bindSchedulerDatacenter(dcA3Andromeda.getId(), 0); } if (a4) { wfEngine.bindSchedulerDatacenter(dcA4Halley.getId(), 0); } if (a5) { wfEngine.bindSchedulerDatacenter(dcA5SoftLayer.getId(), 0); } //****************************************************************** //Configuração de Delays de Rede //* * * Valores definidos para Latência * * * //1. Do Broker (WorkFlowScheduler) para os DCs... 100 ms //2. Entre os Datacenters: 250 ms //3. Para Internet: 500 ms boolean delay = true; if (delay) { Log.printLine("---Network Delay ON..."); //Latência do WorkFlowScheduler (Broker) para os DCs... if (a1) { NetworkTopology.addLink(wfEngine.getSchedulerId(0), dcA1WorkStation.getId(), 1000, 0.10); } if (a2) { NetworkTopology.addLink(wfEngine.getSchedulerId(0), dcA2Cosmos.getId(), 1000, 0.10); } if (a3) { NetworkTopology.addLink(wfEngine.getSchedulerId(0), dcA3Andromeda.getId(), 1000, 0.10); } if (a4) { NetworkTopology.addLink(wfEngine.getSchedulerId(0), dcA4Halley.getId(), 1000, 0.10); } if (a5) { NetworkTopology.addLink(wfEngine.getSchedulerId(0), dcA5SoftLayer.getId(), 1000, 0.5); } //***** //Latência entre os DCs... if (a1 && a2) { NetworkTopology.addLink(dcA1WorkStation.getId(), dcA2Cosmos.getId(), 1000, 0.25); } if (a1 && a3) { NetworkTopology.addLink(dcA1WorkStation.getId(), dcA3Andromeda.getId(), 1000, 0.25); } if (a1 && a4) { NetworkTopology.addLink(dcA1WorkStation.getId(), dcA4Halley.getId(), 1000, 0.25); } if (a1 && a5) { NetworkTopology.addLink(dcA1WorkStation.getId(), dcA5SoftLayer.getId(), 1000, 0.5); } //*** if (a2 && a3) { NetworkTopology.addLink(dcA2Cosmos.getId(), dcA3Andromeda.getId(), 1000, 0.25); } if (a2 && a4) { NetworkTopology.addLink(dcA2Cosmos.getId(), dcA4Halley.getId(), 1000, 0.25); } if (a2 && a5) { NetworkTopology.addLink(dcA2Cosmos.getId(), dcA5SoftLayer.getId(), 1000, 0.5); } //*** if (a3 && a4) { NetworkTopology.addLink(dcA3Andromeda.getId(), dcA4Halley.getId(), 1000, 0.25); } if (a3 && a5) { NetworkTopology.addLink(dcA3Andromeda.getId(), dcA5SoftLayer.getId(), 1000, 0.5); } //*** if (a4 && a5) { NetworkTopology.addLink(dcA4Halley.getId(), dcA5SoftLayer.getId(), 1000, 0.5); } } //****************************************************************** Utilidades.preencherTabelaDatacenters(); //Ativando Monitor de Recursos MonitorRecursos mr = new MonitorRecursos("Mon_Recursos", wfEngine.getScheduler(0)); CloudSim.startSimulation(); List<Job> outputList0 = wfEngine.getJobsReceivedList(); CloudSim.stopSimulation(); //CloudSim.terminateSimulation(300); //Gerando a saída para o Monitor e Arquivos (pasta relatorios) String retorno = Utilidades.printJobList(outputList0); //Log.printLine(retorno); Utilidades.registraSaidaCloudSimReport(retorno); //Shishido - impressão do grafo de Workflow executado //Utilidades.printWorkflow(outputList0); return ""; } catch (Exception ex) { Logger.getLogger(Experimento16.class.getName()).log(Level.SEVERE, null, ex); } return ""; } }
[ "edvard@icmc.usp.br" ]
edvard@icmc.usp.br
52dcd9859fe530cca17c81b5053c2d9c1982a710
f386c2e2206fc045fc56185bd66675f4a51a0666
/network-programming/src/main/java/com/kingdomdong/www/kingstudy/URLEquality.java
85bd6374100b9dfd2e71d130d160bb8f4cd9f6dd
[]
no_license
kingdomdong/java
40f383aa402d16ebc8d385e758c1c99c47583af5
5a77763dc05db769ec9c5548569899f734ec5406
refs/heads/master
2022-12-21T00:29:21.541197
2021-10-10T16:28:47
2021-10-10T16:28:47
163,075,419
0
0
null
2022-12-16T04:59:23
2018-12-25T11:07:16
Java
UTF-8
Java
false
false
634
java
package com.kingdomdong.www.kingstudy; import java.net.MalformedURLException; import java.net.URL; public class URLEquality { public static void main(String[] args) { try { URL url = new URL("http://www.ibiblio.org/"); URL ibibilio = new URL("http://ibiblio.org/"); if (url.equals(ibibilio)) { System.out.println(url + " is the same as " + ibibilio); } else { System.out.println(url + " is not the same as " + ibibilio); } } catch (MalformedURLException ex) { System.err.println(ex); } } }
[ "847311033@qq.com" ]
847311033@qq.com
0c67e8c4f94b802265f7a6e0f492be6e8bd4eeaf
d5d649d358b72cc2c634b88945521fb1aefd4dd8
/IndyControllerDiagnostic/src/net/electroland/indy/gui/multicast/Sender2Thread.java
78e1057b70dca3191c72c19235408e6fb1c57b96
[]
no_license
damonseeley/electroland_repos
70dd6cad4361616d7d2bf8a10139ba949bed0a57
63b06daf1a5bc2d66e3fc80bf44a867796e7028b
refs/heads/master
2021-01-10T12:43:13.110448
2014-10-13T18:59:40
2014-10-13T18:59:40
50,899,790
0
0
null
null
null
null
UTF-8
Java
false
false
6,889
java
package net.electroland.indy.gui.multicast; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.SocketException; import java.text.ParseException; import net.electroland.indy.test.Util; /** * This is the workhorse. As mentioned in a few other places, this is currently * tightly coupled to MulticastRunner. A better implementation would have some * interfaces to pass in for the Logging and Environment variables that it's * querying and updating from here. * * @author geilfuss * */ public class Sender2Thread extends Thread { private Target2[] targets; private IndyControllerDiagnostic runner; private boolean running = false; private boolean single = false; private int seed = 0; /** * Create a thread that sends packets to the specified targets at the whim * of the runner, and using variables specified by the runner. * * @param targets * @param runner * @param single - if true, send a single packet and die. */ public Sender2Thread(Target2[] targets, IndyControllerDiagnostic runner, boolean single){ this.targets = targets; this.runner = runner; this.single = single; } /** * Same as above, however lets you specify a seed value, that let's you * continue a pattern you started with a previous thread (e.g, sync). If * you generate successive threads where single == true with seed * incrementing by one for each successive thread, they'll provide the same * behavior as if you'd called one single thread with single == false. * * @param targets * @param runner * @param single * @param seed */ public Sender2Thread(Target2[] targets, IndyControllerDiagnostic runner, boolean single, int seed){ this.targets = targets; this.runner = runner; this.single = single; this.seed = seed; } public void start(){ super.start(); running = true; } public void stopClean(){ running = false; } @Override public void run() { int current = runner.byteSlider.getValue(); int increment = 1; DatagramSocket socket; long d_send[] = new long[30]; long lastSent = System.currentTimeMillis(); int d_ptr = 1; byte[] buffer; int ctr = seed; try { socket = new DatagramSocket(); while (running){ if (runner.custom.isSelected()){ // if custom packet entirely from text input, // EVERYTHING else gets ignored. buffer = Util.hextToBytes(runner.customPacket.getText()); } else { // figure out how large our packet will be int packetSize = runner.pcktLengthSlider.getValue() + 3; // allocate the packet and set it's start, cmd, and end bytes buffer = new byte[packetSize]; buffer[0] = (byte)255; // start byte buffer[1] = (byte)runner.cmdSlider.getValue();// command byte buffer[packetSize-1] = (byte)254; // end byte if (runner.ascending.isSelected()){ // ascending for (int i = 2; i < packetSize -1 ; i++){ buffer[i] = (byte)((i-2) % 253); } }else if (runner.oscillating.isSelected()){ if (ctr%2 == 0){ for (int i = 2; i < packetSize - 1; i++){ //buffer[i] = (byte)32; //old code was full on for oscillating mode buffer[i] = (byte)253; } }// else do nothing. default is 'off' bytes. } else if (runner.stepThroughRecipients.isSelected()){ // trace pattern for (int i = 2; i < packetSize - 1; i++){ buffer[i] = (byte)0; } buffer[(ctr%(buffer.length-3)) + 2] = (byte)253; }else{ // packets that support complimentary bytes. if (runner.triangle.isSelected()){ // triangle // triangle wave current += increment; if (current > 252){ // don't use start or end byte. increment *= -1; current = 253; } if (current < 1){ increment *= -1; current = 2; } // update the display runner.byteSlider.setValue(current); }else if (runner.slider.isSelected()){ // constant (from slider) current = runner.byteSlider.getValue(); } // if odds bytes are complimentary for (int i = 2; i < packetSize - 1; i++){ if (runner.oddsCompliment.isSelected()){ buffer[i] = i%2==0 ? (byte)(254 - current) : (byte)current; }else{ buffer[i] = (byte)current; } } } } // calculate fps long sendTime = System.currentTimeMillis(); d_send[d_ptr++%30] = sendTime - lastSent; lastSent = sendTime; long avg = 0; for (int foo = 0; foo < d_send.length; foo++){ avg += d_send[foo]; } avg = avg / d_send.length; if (avg != 0) runner.fps.setText("" + (1000 / avg)); boolean isBroadcastTime = ctr == -1 || (runner.includeOffset.isSelected() && ctr%runner.offsetDelay.getValue() == 0); if (isBroadcastTime){ byte[] o = {(byte)255, (byte)128, (byte)0, (byte)0, (byte)254}; buffer = o; } // send the packet to each target for (int i = 0; i < targets.length; i++){ if (isBroadcastTime){ // copy the offset address for this target into // the packet System.arraycopy(targets[i].getOffset(), 0, buffer, 2, 2); }else if (runner.includeTimeing.isSelected() && buffer.length > 14){ sendTime = System.currentTimeMillis(); byte[] sendTimeBytes = Util.encodeTime(sendTime); // note that we're intentionally truncating this // 13 digit number. the first digit won't update // for a very, very long time. System.arraycopy(sendTimeBytes,1, buffer, 2, 12); } DatagramPacket packet = new DatagramPacket(buffer, buffer.length, targets[i].getAddress(), targets[i].getPort()); String toSend = Util.bytesToHex(buffer); if (runner.logSends.isSelected() && !isBroadcastTime) System.out.println(targets[i] + "\tUDP sent= " + toSend); if (runner.logOffsets.isSelected() && isBroadcastTime) System.out.println(targets[i] + "\tUDP Offset sent= " + toSend); try { socket.send(packet); } catch (IOException e) { System.out.println(targets[i] + "\t" + e); } } // sleep for the proper amount Thread.sleep(1000/runner.fpsSlider.getValue()); if (single){ running = false; } ctr++; } } catch (SocketException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (NumberFormatException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } finally { runner.streamButton.setSelected(false); runner.streamButton.setText(IndyControllerDiagnostic.START_STREAM); runner.oneButton.setEnabled(true); } } }
[ "dseeley@38cd337d-7a19-44a1-8cca-49443be78b0d" ]
dseeley@38cd337d-7a19-44a1-8cca-49443be78b0d
b47e7f7ce12842053e7090c69580800baf52459b
dcbf7fef8b382ec01034445b1b0576398744021b
/backend/src/main/java/com/devsuperior/dslearn/components/JwtTokenEnhancer.java
e204d1f14d8d87b3802b71744271f2dfa8468e5e
[]
no_license
Edufreitass/ds-learn
57ef2e71d36b0d6edaa62529109d664a5316bbd3
12bd45d4f0afcf221e0162d20e02c45c4d055dd6
refs/heads/main
2023-02-12T20:23:48.772250
2021-01-12T17:34:08
2021-01-12T17:34:08
325,341,992
0
0
null
null
null
null
UTF-8
Java
false
false
1,185
java
package com.devsuperior.dslearn.components; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.token.TokenEnhancer; import org.springframework.stereotype.Component; import com.devsuperior.dslearn.entities.User; import com.devsuperior.dslearn.repositories.UserRepository; @Component public class JwtTokenEnhancer implements TokenEnhancer { @Autowired private UserRepository userRepository; @Override public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { User user = userRepository.findByEmail(authentication.getName()); Map<String, Object> map = new HashMap<>(); map.put("userName", user.getName()); map.put("userId", user.getId()); DefaultOAuth2AccessToken token = (DefaultOAuth2AccessToken) accessToken; token.setAdditionalInformation(map); return accessToken; } }
[ "eduardoflorencio96@gmail.com" ]
eduardoflorencio96@gmail.com
68d92abfda29281fa3229fb0d410db48fe5ad30f
a34571d4093181a46673da7ced69137bc7e84520
/src/main/java/kg/tasks/modules/ws/cbr/BiCurBacketXML.java
7aabd30b74c9d5ed68b783cfac10bc293aa06500
[]
no_license
Hatik/modules
d7c862c1a369143f327323f33bb770eecae4fa6b
9b342a59fcb2b4daa0c3f68c83d2e44a951c1898
refs/heads/master
2023-04-28T23:07:51.018542
2022-05-20T21:34:45
2022-05-20T21:34:45
200,518,154
0
0
null
2023-04-14T17:48:18
2019-08-04T16:48:06
Java
UTF-8
Java
false
false
2,272
java
/** * BiCurBacketXML.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package kg.tasks.modules.ws.cbr; public class BiCurBacketXML implements java.io.Serializable { public BiCurBacketXML() { } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof BiCurBacketXML)) return false; BiCurBacketXML other = (BiCurBacketXML) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true; __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(BiCurBacketXML.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://web.cbr.ru/", ">BiCurBacketXML")); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "serikov.askhat@gmail.com" ]
serikov.askhat@gmail.com
fedb6238fbc1605f9ddd69ef6ac242665afe267e
0d05401f8680e90a8ed05cc509add56007692ff6
/AlgorithmToolkit/src/com/puspa/week2/FibonacciNumber.java
82192ea07341756459dde98c466c2a348ded4d41
[]
no_license
prazzusa/CourseEra
32a051696020dfdb457e684c17fb58e949bab65f
b69a9f95b7cfe721e504a177caa2198ecfeaedad
refs/heads/master
2021-01-23T11:59:27.237686
2017-09-26T04:38:15
2017-09-26T04:38:15
102,639,125
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package com.puspa.week2; import java.util.Scanner; public class FibonacciNumber { public static int getFibonacciNumber(int n) { if(n < 2) return n; int fibArray[] = new int[n+1]; fibArray[0] = 0; fibArray[1] = 1; for (int i = 2; i <= n; i++) { fibArray[i] = fibArray[i-1] + fibArray[i-2]; } return fibArray[n]; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); System.out.println(getFibonacciNumber(n)); } }
[ "puspakhanal@users.noreply.github.com" ]
puspakhanal@users.noreply.github.com
87c303c1661eaf2f6d8201e0a1278930adbf49e1
271ecfd4b55a72b1aa709a56f767a0b44e587572
/src/test/com/niuniu/TestUtils.java
a41917ec8034207babf81adefe44e5851b47478e
[]
no_license
OliverKehl/IE_Tool
ecbdbaea13e57c149563942109f9e0d34ad97d0c
f5a98d8bed54822760cd25a76016076158f0c182
refs/heads/master
2020-03-10T04:10:49.229474
2018-03-26T08:46:26
2018-03-26T08:46:26
129,185,201
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package test.com.niuniu; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import com.niuniu.CarResource; import com.niuniu.CarResourceGroup; import com.niuniu.ResourceMessageProcessor; import com.niuniu.USolr; import com.niuniu.Utils; import junit.framework.Assert; /* * 中规、国产车的测试用例 */ public class TestUtils { USolr solr_client; @BeforeClass public static void setUpBeforeClass() throws Exception { } @AfterClass public static void tearDownAfterClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } @Test public void testEscapeSpecialMultiplySign() { { String str = "飞度 888X6台 下4000"; String ans = Utils.escapeSpecialMultiplySign(str); Assert.assertEquals("飞度 888 6台 下4000", ans); } { String str = "飞度 888x6台 下4000"; String ans = Utils.escapeSpecialMultiplySign(str); Assert.assertEquals("飞度 888 6台 下4000", ans); } } }
[ "kangjihua_home@126.com" ]
kangjihua_home@126.com
b183f45d0ab7131bd2c336c330b4e7e50ff8db34
a0e4f155a7b594f78a56958bca2cadedced8ffcd
/sdk/src/main/java/org/zstack/sdk/iam2/api/QueryIAM2OrganizationResult.java
74f769a1b096b67425daae1816bafe4e19bb6015
[ "Apache-2.0" ]
permissive
zhao-qc/zstack
e67533eabbbabd5ae9118d256f560107f9331be0
b38cd2324e272d736f291c836f01966f412653fa
refs/heads/master
2020-08-14T15:03:52.102504
2019-10-14T03:51:12
2019-10-14T03:51:12
215,187,833
3
0
Apache-2.0
2019-10-15T02:27:17
2019-10-15T02:27:16
null
UTF-8
Java
false
false
501
java
package org.zstack.sdk.iam2.api; public class QueryIAM2OrganizationResult { public java.util.List inventories; public void setInventories(java.util.List inventories) { this.inventories = inventories; } public java.util.List getInventories() { return this.inventories; } public java.lang.Long total; public void setTotal(java.lang.Long total) { this.total = total; } public java.lang.Long getTotal() { return this.total; } }
[ "xin.zhang@mevoco.com" ]
xin.zhang@mevoco.com
b61b46a324cb97723bdc47efa04c197d492eec6f
704a8d5837187c7f16b371f68ca91454ebc69121
/信息安全实验/替换法.java
92a59923a6bbd6e12afd7b3887129ba325f04e23
[]
no_license
hsn951/Java-SE
ab6619097598616e59499c141a797e265b69b348
3b9b4f15e772a8122b56947baef2965d0ca52780
refs/heads/master
2023-08-31T14:33:23.122056
2021-10-17T02:57:57
2021-10-17T02:57:57
297,023,339
0
0
null
null
null
null
UTF-8
Java
false
false
2,999
java
@author hsn @2021.9.27 import java.io.*; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; public class FileTest { private static DecimalFormat df = new DecimalFormat("0.000"); private static int[] letters = new int[26]; //字母表 private static int[] letterNum = new int[26]; //字母频数数组 private static List<Character> list = new ArrayList<Character>(); //密文集合 public static void main(String[] args) throws IOException { //给字母表数组赋初值 for(int i = 0;i < 26;i++) { letters[i] = 'A' + i; } String filename = "D:\\data.txt"; FileReader filereader = new FileReader(filename); Reader fr = new FileReader(filename); int c = fr.read(); while(c!=-1) { if(c>='A'&&c<='Z') letterNum[c-65]++; //System.out.print((char)(c)); list.add((char)c); c = fr.read(); } swap(list,'C','E'); //update(); swap(list,'A','T'); swap(list,'I','O'); swap(list,'M','F'); exhaust(); for (int i:letters) { System.out.print((char)i+"\t"); } System.out.println(); for (int i:letterNum) { System.out.print(i+"\t"); } System.out.println(); for (int i:letterNum) { System.out.print(df.format(i/4.83)+"%"+"\t"); } fr.close(); filereader.close(); } //替换函数 public static void swap(List list,char letter1,char letter2) { //扫描密文,交换字母 for(int i = 0;i < list.size();i++) { if ((char) list.get(i) >= 'A' && (char) list.get(i) <= 'Z') { if (list.get(i).equals(letter1)) { list.set(i, letter2); continue; } else if (list.get(i).equals(letter2)) { list.set(i, letter1); } } } } //穷举函数 public static void exhaust() { //穷举法 for(int i = 0;i<26;i++) { for (char ch : list) { if (ch <= 'Z' && ch >= 'A') { if (ch + i > 90) System.out.print((char) ((ch + i) % 90 + 65)); else System.out.print((char) (ch + i)); }else { System.out.print(ch); } } System.out.println(); System.out.println(); } } //更新字母出现频率 public static void update() { //清空字母频数数组 for(int i = 0;i<letterNum.length;i++) letterNum[i] = 0; for(char c:list) { if(c<='Z'&&c>='A') { letterNum[c-65]++; } } for (int i:letterNum) { System.out.print(df.format(i/4.83)+"%"+"\t"); } } }
[ "noreply@github.com" ]
noreply@github.com
926f6d71ce8eaa8e99425bef0edb50d175968a17
17dd335c794d10250b8bfc9c7624d059a846266f
/src/c/AddSubMulDivEx.java
69773fd4209b2add40f05d46a4ac7afdea97c576
[]
no_license
polojune/JavaStudy
b5bb495ac100cdf8b66310f5622c43cb04e35303
cbee427d0c36171f05993638cb5de365cb93f2d0
refs/heads/master
2021-05-19T04:50:53.555280
2020-05-18T08:12:14
2020-05-18T08:12:14
251,535,327
0
0
null
null
null
null
UHC
Java
false
false
1,269
java
package c; import java.util.Scanner; abstract class Calc { protected int a, b; public void setValue(int a, int b) { this.a = a; this.b = b; } abstract int calculate(); } class Add extends Calc { @Override int calculate() { return a + b; } } class Sub extends Calc { @Override int calculate() { // TODO Auto-generated method stub return a - b; } } class Mul extends Calc { @Override int calculate() { // TODO Auto-generated method stub return a * b; } } class Div extends Calc { @Override int calculate() { if (b == 0) return -1; return a / b; } } public class AddSubMulDivEx { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int result = 0; System.out.print("두 정수와 연산자를 입력하시오>>"); int a = sc.nextInt(); int b = sc.nextInt(); char c = sc.next().charAt(0); Calc cal; switch (c) { case '+': cal = new Add(); break; case '-': cal = new Sub(); break; case '*': cal = new Mul(); break; case '/': cal = new Div(); break; default: System.out.println("잘못된 연산자 입니다."); sc.close(); return; } cal.setValue(a, b); result = cal.calculate(); System.out.println(result); sc.close(); } }
[ "crossfit@a.naver.com" ]
crossfit@a.naver.com
5d7af5bcee29252745ba9ea26aa3ecf2ed39fb70
4ee22e09273800603ceb02a246198651ee70c9c9
/src/main/java/stateless/spring/security/enums/Authority.java
1328b79eafaf80db8f6cd635009a5008f8df4283
[]
no_license
bjpaul/stateless-spring-security
1380b3b86776194fb87a085639702f433dd254ce
4fb6eefa5f66b220d208dd924c25c6bb8180f8c5
refs/heads/master
2020-05-20T23:24:11.844225
2017-05-14T19:41:37
2017-05-14T19:41:37
84,544,245
2
1
null
2017-05-13T13:23:26
2017-03-10T09:42:16
Java
UTF-8
Java
false
false
376
java
package stateless.spring.security.enums; import org.springframework.security.core.GrantedAuthority; public enum Authority implements GrantedAuthority{ ROLE_USER, ROLE_ADMIN; @Override public String getAuthority() { return this.toString(); } public static String roleHierarchyStringRepresentation(){ return Authority.ROLE_ADMIN +" > "+Authority.ROLE_USER; } }
[ "kgec.bijoypaul@gmail.com" ]
kgec.bijoypaul@gmail.com
82bcada2dc665eec4f476c7202e892a5dd830642
b5f8a8463bb895892a69ace0a08d75ffa0a740b8
/src/test/java/com/eviltester/webdriver/MyFirstChromeTest.java
f139d93a10a462db03edd63ed0b9822335bc0e53
[]
no_license
600rob/startUsingSeleniumWebDriver-master
8df7bf47ca5eecf33538e1c517af5972bc09e84f
94c58bbe08c4e829300ee8a39981fededa7daca3
refs/heads/master
2021-05-04T19:57:37.270902
2017-10-13T15:14:07
2017-10-13T15:14:07
106,827,318
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.eviltester.webdriver; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class MyFirstChromeTest { @Test public void startWebDriver(){ /* The following code is for the Chrome Driver You also need to download the ChromeDriver executable https://sites.google.com/a/chromium.org/chromedriver/ */ // String currentDir = System.getProperty("user.dir"); // String chromeDriverLocation = currentDir + "/tools/chromedriver/chromedriver.exe"; // System.setProperty("webdriver.chrome.driver", chromeDriverLocation); //If you add the folder with chromedriver.exe to the path then you only need the following line // and you don't need to set the property as listed in the 3 lines above // e.g. D:\Users\Alan\Documents\github\startUsingSeleniumWebDriver\tools\chromedriver WebDriver driver = new ChromeDriver(); driver.navigate().to("http://seleniumsimplified.com"); Assert.assertTrue("title should start differently", driver.getTitle().startsWith("Selenium Simplified")); driver.close(); driver.quit(); } }
[ "robby_hope@hotmail.com" ]
robby_hope@hotmail.com
19e0d7017249f50f7602997365681612285aab2f
974efb264990c7f32e65999348b798bf85cec1b3
/Test/com/company/SearchBookTest.java
ac45fca3ccd40eebdfe797a99c5e48a9181422f4
[]
no_license
jongyuni/2020swproject
9429b00294cb554e4ec61c39fd212f968cbb6d5b
4f7db362677a5ed5468ac2b6b4f899d1f67ce1fc
refs/heads/master
2023-01-03T19:15:12.336295
2020-11-03T09:36:28
2020-11-03T09:36:28
309,637,431
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package com.company; import org.junit.jupiter.api.Test; import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.*; class SearchBookTest { @Test void checkisBook() { SearchBook searchbook = new SearchBook(); BookInformation bookInformation = new BookInformation(); bookInformation.setTitle("title"); bookInformation.setPublisher("test"); bookInformation.setWriter(" "); bookInformation.setPublishedYear(" "); bookInformation.setPrice(" "); bookInformation.setBookState(" "); bookInformation.setISBNNumber(" "); bookInformation.setSellerID("test"); bookInformation.setSellerEmail("test"); ArrayList<BookInformation> checklist = new ArrayList<BookInformation>(); checklist.add(bookInformation); assertEquals(searchbook.CheckisBook(checklist),true); } }
[ "70887404+jongyuni@users.noreply.github.com" ]
70887404+jongyuni@users.noreply.github.com
d9f2b93b34f14540ca5bd3711b4479de16543289
202941d2a5550823cb77ab8f0034d7f6518acb28
/MyApplication2/app/src/main/java/com/example/kylinarm/multilisttest/Entity/MockDetailsEntity.java
b87414c03fde7cf276da37fd270e81ad34a9f3c9
[]
no_license
994866755/handsomeYe.multlist
b78a0c10037672c4222f6fbe4873082de1ae221f
59e1f2cc31f13b75605748007e8409756d25fbaf
refs/heads/master
2021-06-26T08:33:10.088853
2017-09-12T14:19:45
2017-09-12T14:19:45
103,279,436
0
0
null
null
null
null
UTF-8
Java
false
false
214
java
package com.example.kylinarm.multilisttest.Entity; /** * Created by Administrator on 2017/9/11. */ public class MockDetailsEntity { public String title; public String money; public String time; }
[ "994866755@qq.com" ]
994866755@qq.com
a098790e25a517ebfb0cb34869830821ff58f636
5ba813ffc018ccbdea346a42bcee54aa4a719f7b
/immocSecurityDemo/src/main/java/com/hui/controller/DemoControllerFirst.java
f73773ef5b2e65b9cdca9626376b781689e24e6f
[ "Apache-2.0" ]
permissive
CarlCZH/spring-boot-security-demo
5a89107c1991a5ff8189840a602a87af785e6c43
3b7144b2c8ea202bc488b87c7e44d8b79d7197a3
refs/heads/master
2020-05-19T13:06:17.001136
2019-05-05T12:59:38
2019-05-05T13:01:29
185,031,495
0
0
null
null
null
null
UTF-8
Java
false
false
1,878
java
package com.hui.controller; import com.fasterxml.jackson.annotation.JsonView; import com.hui.bean.User; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.security.core.Authentication; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.ResponseBody; /** * @Author: CarlChen * @Despriction: TODO * @Date: Create in 17:10 2019\2\6 0006 */ @Controller public class DemoControllerFirst { @GetMapping(value = "/me") @ResponseBody public Authentication securityAuthenticationContext(@AuthenticationPrincipal Authentication authentication){ //Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return authentication; } @GetMapping(value = "/user/{id:\\d+}") @ResponseBody @JsonView(User.ViewDetailView.class) @ApiOperation(value = "根据ID获取用户信息") public User getUserById(@ApiParam(value = "用户ID") @PathVariable int id){ User user = new User(); user.setName("张三"); user.setAge(25); user.setId(id); user.setSex("男"); user.setPwd("123456789"); return user; } @GetMapping(value = "/user") @ResponseBody @JsonView(User.ViewSimpleView.class) @ApiOperation(value = "获取所有用户信息") public User getUser(){ // throw new RuntimeException("this is a test exception"); User user = new User(); user.setName("李四"); user.setAge(25); user.setId(2); user.setSex("男"); user.setPwd("123456789"); return user; } }
[ "291717855@qq.com" ]
291717855@qq.com
fb4dcc2d728aaffbf3dfc024ed5d491734e277cf
9797912bca700d18e6fb823460c03c9ad300d3e1
/INCAR_server/src/main/java/ac/inhaventureclub/service/RequestService.java
2ec0e73cd5de4ad363a7ea7536eb97b9bf79c21b
[]
no_license
Inha-Venture-Club/INCAR
b1605fedb60446306c6af20465958d88ea22c1af
da4ce2f5cec6d354d0852bf70be87012373b67d7
refs/heads/main
2023-07-21T22:43:28.556236
2021-09-06T15:29:46
2021-09-06T15:29:46
403,671,581
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package ac.inhaventureclub.service; import org.springframework.stereotype.Service; import ac.inhaventureclub.vo.Posting; import ac.inhaventureclub.vo.Request; @Service public interface RequestService { /* find */ public String findAll(); public String findRequestWithUserid(String userid); public String findRequestWithPostingidx(int postingIdx); /* save */ public int saveRequest(Request request); /* Request and Posting */ public String findRequestsWithPostingUserid(String userid); }
[ "dazory@naver.com" ]
dazory@naver.com
3c27e9a8a62524d9fcc18c6ded450b854d55b8fc
9858fe61d2dcf7d407679c3a25863b5a0fec781f
/src/cn/itcast/estore/utils/MailUtils.java
eb179e6a1450fb7bf084d67ce8c78eab3d3a9d7a
[]
no_license
hemingkung/estore
17e092b0deb4380482eee0f20c53257b2c63a2a7
53d8f7f6413c9ec2e518b89ab36cea75baef2ce1
refs/heads/master
2021-01-01T03:38:47.772293
2016-05-15T07:13:08
2016-05-15T07:13:08
58,847,011
0
0
null
null
null
null
GB18030
Java
false
false
1,998
java
package cn.itcast.estore.utils; import java.util.Properties; import java.util.UUID; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import cn.itcast.estore.domain.User; /** * 发送邮件 工具方法 * * @author seawind * */ public class MailUtils { // 生成激活码 public static String generateActivecode() { return UUID.randomUUID().toString(); } // 发送邮件 public static void sendMail(Message message, Session session) throws Exception { Transport transport = session.getTransport(); transport.connect("service", "111"); transport.sendMessage(message, message.getAllRecipients()); } // 生成邮件 public static Message generateMessage(Session session, User user) throws Exception { MimeMessage message = new MimeMessage(session); // 邮件头 message.setFrom(new InternetAddress("service@estore.com"));// 发件人 message.setRecipient(Message.RecipientType.TO, new InternetAddress(user .getEmail())); // 收件人 message.setSubject("ESTORE商城 激活邮件"); // 邮件头 message .setContent( "<h2>欢迎" + user.getUsername() + "注册Estore商城,这里可以购买您需要商品!</h2><h3>请于2小时内点击下面链接完成账户激活:</h3><a href='http://www.estore.com/active?activecode=" + user.getActivecode() + "'>http://www.estore.com/active?activecode=" + user.getActivecode() + "</a>", "text/html;charset=utf-8"); return message; } // 创建会话 public static Session createSession() { Properties properties = new Properties(); properties.put("mail.transport.protocol", "smtp"); properties.put("mail.smtp.host", "localhost"); properties.put("mail.smtp.auth", "true"); Session session = Session.getInstance(properties); return session; } }
[ "hemingkung@126.com" ]
hemingkung@126.com
a2c4638e7bec131d4eca99acdca7232e2e55a355
fdb6e41d474c5416ce6448a91d0db73544cbb844
/src/de/xehpuk/disassembler/codes/F2D.java
bd95d75dd15a745b5cec5b621716d99c104969a0
[ "MIT" ]
permissive
xehpuk/java-disassembler
11cfd51b59935815089fc37752b0d53a80a675e7
9e99b0661e7be173de550fa85c7f701f2a88f2b9
refs/heads/main
2023-06-16T05:57:20.985561
2021-07-06T23:02:45
2021-07-06T23:02:45
383,617,701
0
0
null
null
null
null
UTF-8
Java
false
false
175
java
package de.xehpuk.disassembler.codes; /** * * @author xehpuk */ public class F2D implements Instruction { @Override public OpCode getOpCode() { return OpCode.F2D; } }
[ "github@xehpuk.com" ]
github@xehpuk.com
8a7055805d917a50b3f4e21878300cee1ac954be
cc35bbc9bda475fc3809c30b573ee2f0ffaeb06b
/Plugins/Instantiation/de.uni-hildesheim.sse.easy.instantiatorCore.tests/src/test/de/uni_hildesheim/sse/easy_producer/instantiator/model/vilTypes/OperationsIterator.java
6183fabc3afc6b35f30eca4432a53fba3a08c6c2
[ "Apache-2.0" ]
permissive
ahmedjaved2109/EASyProducer
833afd006feb6d2a1f1fcc9eb82b79db2aa51ae7
c08f831599a9f5993ed1bd144ccdadab3d1d97ed
refs/heads/master
2021-01-18T11:09:08.843648
2016-03-17T20:29:40
2016-03-17T20:29:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,259
java
package test.de.uni_hildesheim.sse.easy_producer.instantiator.model.vilTypes; import java.util.Iterator; import de.uni_hildesheim.sse.easy_producer.instantiator.model.vilTypes.OperationDescriptor; import de.uni_hildesheim.sse.easy_producer.instantiator.model.vilTypes.TypeDescriptor; /** * Iterates over the operations of a {@link TypeDescriptor} (simplyify testing). * * @author Holger Eichelberger */ class OperationsIterator implements Iterable<OperationDescriptor>, Iterator<OperationDescriptor> { private TypeDescriptor<?> descriptor; private int pos = 0; /** * Creates a new iterator. * * @param descriptor the descriptor to iterate over */ public OperationsIterator(TypeDescriptor<?> descriptor) { this.descriptor = descriptor; } @Override public boolean hasNext() { return pos < descriptor.getOperationsCount(); } @Override public OperationDescriptor next() { return descriptor.getOperation(pos++); } @Override public void remove() { throw new UnsupportedOperationException(); } @Override public Iterator<OperationDescriptor> iterator() { return this; } }
[ "elscha@sse.uni-hildesheim.de" ]
elscha@sse.uni-hildesheim.de
c73bca076e47a08c8d1a0abd59d239ea322eb8d7
79eaa803942c794ba083aa708cb47ba4a936d6af
/o2o/src/main/java/com/imooc/o2o/entity/ProductImg.java
fc80b77389832aecd1d1882afe6fe01853561390
[]
no_license
baizhendong/na9hao.project
105a8ca6293d7ffe226d56296466db30f7b127fc
ac5622521d4cad18673d92c3adc9704c32f6448c
refs/heads/master
2022-12-14T19:43:28.274250
2020-08-31T06:42:46
2020-08-31T06:42:46
290,172,381
0
0
null
null
null
null
UTF-8
Java
false
false
1,256
java
package com.imooc.o2o.entity; import java.util.Date; /** * @author shkstart * @create 2020-08-28 9:20 */ public class ProductImg { private Long productImgId; private String imgAddr; private String imgDesc; private Integer priority; private Date createTime; private Long productId; public Long getProductImgId() { return productImgId; } public void setProductImgId(Long productImgId) { this.productImgId = productImgId; } public String getImgAddr() { return imgAddr; } public void setImgAddr(String imgAddr) { this.imgAddr = imgAddr; } public String getImgDesc() { return imgDesc; } public void setImgDesc(String imgDesc) { this.imgDesc = imgDesc; } public Integer getPriority() { return priority; } public void setPriority(Integer priority) { this.priority = priority; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } }
[ "tianqi@centaur.cn" ]
tianqi@centaur.cn
5c2cb46edba8b48668cf6a20066f58321abb8229
9be993df9d82431fd00a68a17b4de0b3063266bf
/java/com/grupo3/cuidares/controlador/Login.java
cc86a762ffafc4bf99a80f3bfa2cc30b49a6372f
[]
no_license
Lmondaca/CaPet
daf1902a3273f6d4a9a9eb1f3eb258e660544ee7
8d4758ae20fcc6f4164daf7e64f93517a3744aef
refs/heads/main
2023-03-30T01:17:02.103939
2021-03-24T19:15:44
2021-03-24T19:15:44
351,186,477
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package com.grupo3.cuidares.controlador; import javax.servlet.http.HttpSession; import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import com.grupo3.cuidares.models.Usuario; import com.grupo3.cuidares.service.ServicioUsuarioDueno; @Controller @RequestMapping("/login") public class Login { private final ServicioUsuarioDueno servicio; public Login(ServicioUsuarioDueno servicio) { this.servicio = servicio; } @RequestMapping("") public String verLogin() { return "vistasFINAL/login.jsp"; } @RequestMapping(value="", method=RequestMethod.POST) public String registroMascota(@RequestParam(value="email") String a, @RequestParam(value="contra") String b, HttpSession sessions) { if(a.equals("") && b.equals("")) { return "redirect:/principal"; } Usuario usuarioPorEmail = servicio.encontrarUsuarioEail(a); if(servicio.cormprobarContrasena(usuarioPorEmail, b)) { sessions.setAttribute("usuarioActual", usuarioPorEmail); return"vistasFINAL/login.jsp"; } else { return "redirect:/principal"; } } }
[ "noreply@github.com" ]
noreply@github.com