blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
f7df4a66b12f7f8cfc1ea23a785d30957a7ccc7b
fa5f6e22135b233d9fdb8bf5415886f2f490f1eb
/SenderTimeTask/src/com/webservice/gy/ws/DataAccessException_Exception.java
e4ccc51beeb36c3011725d10ef4a1cbac2462397
[]
no_license
popwang/SenderTimeTask
dd2c54fc8499c8c4d169ed487efa5e212a07f6f0
2fe0d9a307e525c7ed879225dd528e462cd894fe
refs/heads/master
2021-06-08T20:18:47.758139
2019-11-07T02:53:10
2019-11-07T02:53:10
119,821,973
0
1
null
null
null
null
UTF-8
Java
false
false
1,308
java
package com.webservice.gy.ws; import javax.xml.ws.WebFault; /** * This class was generated by Apache CXF 3.1.11 * 2018-05-14T14:22:38.550+08:00 * Generated source version: 3.1.11 */ @WebFault(name = "DataAccessException", targetNamespace = "http://service.tblycjc.webservice.client.dekn.com.cn") public class DataAccessException_Exception extends Exception { private static final long serialVersionUID = 1L; private com.webservice.gy.ws.DataAccessException dataAccessException; public DataAccessException_Exception() { super(); } public DataAccessException_Exception(String message) { super(message); } public DataAccessException_Exception(String message, Throwable cause) { } public DataAccessException_Exception(String message, com.webservice.gy.ws.DataAccessException dataAccessException) { super(message); this.dataAccessException = dataAccessException; } public DataAccessException_Exception(String message, com.webservice.gy.ws.DataAccessException dataAccessException, Throwable cause) { this.dataAccessException = dataAccessException; } public com.webservice.gy.ws.DataAccessException getFaultInfo() { return this.dataAccessException; } }
[ "274388924@qq.com" ]
274388924@qq.com
ef632c92c99922ed1b82fb4d71493501ab473cf7
7e0364dce3cb7ec041c5824ec68adc4bcc47568a
/aistorefront/web/src/com/acn/ai/storefront/controllers/cms/ProductCarouselComponentController.java
27acb27fafd31f1199b67e71632bbff559293493
[]
no_license
aitp2/a1
055abd53719aec422134b19265634cb301f9027b
40ccbbd480cbc0893db5a04af97fc8a6dc150690
refs/heads/master
2021-07-23T06:23:38.889348
2018-10-17T01:01:45
2018-10-17T01:01:45
113,840,157
1
0
null
null
null
null
UTF-8
Java
false
false
3,360
java
/* * [y] hybris Platform * * Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.acn.ai.storefront.controllers.cms; import de.hybris.platform.acceleratorfacades.productcarousel.ProductCarouselFacade; import de.hybris.platform.cms2lib.model.components.ProductCarouselComponentModel; import de.hybris.platform.commercefacades.product.ProductOption; import de.hybris.platform.commercefacades.product.data.ProductData; import de.hybris.platform.commercefacades.search.ProductSearchFacade; import de.hybris.platform.commercefacades.search.data.SearchQueryData; import de.hybris.platform.commercefacades.search.data.SearchStateData; import de.hybris.platform.commerceservices.search.pagedata.PageableData; import com.acn.ai.storefront.controllers.ControllerConstants; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; /** * Controller for CMS ProductReferencesComponent. */ @Controller("ProductCarouselComponentController") @RequestMapping(value = ControllerConstants.Actions.Cms.ProductCarouselComponent) public class ProductCarouselComponentController extends AbstractAcceleratorCMSComponentController<ProductCarouselComponentModel> { protected static final List<ProductOption> PRODUCT_OPTIONS = Arrays.asList(ProductOption.BASIC, ProductOption.PRICE); @Resource(name = "productSearchFacade") private ProductSearchFacade<ProductData> productSearchFacade; @Resource(name = "productCarouselFacade") private ProductCarouselFacade productCarouselFacade; @Override protected void fillModel(final HttpServletRequest request, final Model model, final ProductCarouselComponentModel component) { final List<ProductData> products = new ArrayList<>(); products.addAll(collectLinkedProducts(component)); products.addAll(collectSearchProducts(component)); model.addAttribute("title", component.getTitle()); model.addAttribute("productData", products); } protected List<ProductData> collectLinkedProducts(final ProductCarouselComponentModel component) { return productCarouselFacade.collectProducts(component); } protected List<ProductData> collectSearchProducts(final ProductCarouselComponentModel component) { final SearchQueryData searchQueryData = new SearchQueryData(); searchQueryData.setValue(component.getSearchQuery()); final String categoryCode = component.getCategoryCode(); if (searchQueryData.getValue() != null && categoryCode != null) { final SearchStateData searchState = new SearchStateData(); searchState.setQuery(searchQueryData); final PageableData pageableData = new PageableData(); pageableData.setPageSize(100); // Limit to 100 matching results return productSearchFacade.categorySearch(categoryCode, searchState, pageableData).getResults(); } return Collections.emptyList(); } }
[ "mingming.wang@accenture.com" ]
mingming.wang@accenture.com
b4ce94ecba6b085f4ad473e394aeee08b2c578a2
b899c2934a02043cfbc2d13b544be6ee664422bb
/src/main/java/com/imooc/service/impl/CategoryServiceImpl.java
f27da93d024cab3a9d99e8c1cd54a17dfd9a6e2d
[]
no_license
patience2013/sell
791f841ae1cbe2e192dd6048e5e235f0a7b57902
a04bbf89d9acffaa721f6aa0ba43b06baba6bf5e
refs/heads/master
2023-05-25T08:43:58.170634
2018-05-11T02:38:58
2018-05-11T02:38:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package com.imooc.service.impl; import com.imooc.dataobject.ProductCategory; import com.imooc.respository.ProductCategoryRespository; import com.imooc.service.CategoryService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @author: Administrator * @date: 2018/4/26/026 * @description: */ @Service public class CategoryServiceImpl implements CategoryService { @Autowired ProductCategoryRespository respository; @Override public ProductCategory findOne(Integer categroyId) { return respository.getOne(categroyId); } @Override public List<ProductCategory> findAll() { return respository.findAll(); } @Override public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) { return respository.findByCategoryTypeIn(categoryTypeList); } @Override public ProductCategory save(ProductCategory productCategory) { return respository.save(productCategory); } }
[ "624162385@qq.com" ]
624162385@qq.com
7a64bafe657af759ea6fb8eb984a971737f06df8
5f0fe5a94e102d2c8a2c6fde91e3e3c0e1f54c32
/src/java/picard/sam/SamToFastq.java
83172d01dbcf5d6204e0559a8715e6e6fc91798b
[]
no_license
zhaoq0563/Improved-Picard
bed7171f072e7e986374f62d72f20e534e76f0a5
37f8f7cf5c9a6e9b04acdd23a5cbf860c4e41f0d
refs/heads/master
2021-01-10T01:46:00.099226
2016-01-29T02:45:44
2016-01-29T02:45:44
50,631,180
1
1
null
null
null
null
UTF-8
Java
false
false
22,976
java
/* * The MIT License * * Copyright (c) 2009 The Broad Institute * * 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 picard.sam; import htsjdk.samtools.SAMReadGroupRecord; import htsjdk.samtools.SAMRecord; import htsjdk.samtools.SAMUtils; import htsjdk.samtools.SAMValidationError; import htsjdk.samtools.SamReader; import htsjdk.samtools.SamReaderFactory; import htsjdk.samtools.fastq.FastqRecord; import htsjdk.samtools.fastq.FastqWriter; import htsjdk.samtools.fastq.FastqWriterFactory; import htsjdk.samtools.util.CloserUtil; import htsjdk.samtools.util.IOUtil; import htsjdk.samtools.util.Lazy; import htsjdk.samtools.util.Log; import htsjdk.samtools.util.ProgressLogger; import htsjdk.samtools.util.SequenceUtil; import htsjdk.samtools.util.StringUtil; import picard.PicardException; import picard.cmdline.CommandLineProgram; import picard.cmdline.CommandLineProgramProperties; import picard.cmdline.Option; import picard.cmdline.StandardOptionDefinitions; import picard.cmdline.programgroups.SamOrBam; import java.io.File; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; /** * <p/> * Extracts read sequences and qualities from the input SAM/BAM file and writes them into * the output file in Sanger fastq format. * See <a href="http://maq.sourceforge.net/fastq.shtml">MAQ FastQ specification</a> for details. * In the RC mode (default is True), if the read is aligned and the alignment is to the reverse strand on the genome, * the read's sequence from input sam file will be reverse-complemented prior to writing it to fastq in order restore correctly * the original read sequence as it was generated by the sequencer. */ @CommandLineProgramProperties( usage = "Extracts read sequences and qualities from the input SAM/BAM file and writes them into " + "the output file in Sanger fastq format. In the RC mode (default is True), if the read is aligned and the alignment is to the reverse strand on the genome, " + "the read's sequence from input SAM file will be reverse-complemented prior to writing it to fastq in order restore correctly" + "the original read sequence as it was generated by the sequencer.", usageShort = "Converts a SAM/BAM into a FASTQ", programGroup = SamOrBam.class ) public class SamToFastq extends CommandLineProgram { @Option(doc = "Input SAM/BAM file to extract reads from", shortName = StandardOptionDefinitions.INPUT_SHORT_NAME) public File INPUT; @Option(shortName = "F", doc = "Output fastq file (single-end fastq or, if paired, first end of the pair fastq).", mutex = {"OUTPUT_PER_RG"}) public File FASTQ; @Option(shortName = "F2", doc = "Output fastq file (if paired, second end of the pair fastq).", optional = true, mutex = {"OUTPUT_PER_RG"}) public File SECOND_END_FASTQ; @Option(shortName = "FU", doc = "Output fastq file for unpaired reads; may only be provided in paired-fastq mode", optional = true, mutex = {"OUTPUT_PER_RG"}) public File UNPAIRED_FASTQ; @Option(shortName = "OPRG", doc = "Output a fastq file per read group (two fastq files per read group if the group is paired).", optional = true, mutex = {"FASTQ", "SECOND_END_FASTQ", "UNPAIRED_FASTQ"}) public boolean OUTPUT_PER_RG; @Option(shortName="RGT", doc = "The read group tag (PU or ID) to be used to output a fastq file per read group.") public String RG_TAG = "PU"; @Option(shortName = "ODIR", doc = "Directory in which to output the fastq file(s). Used only when OUTPUT_PER_RG is true.", optional = true) public File OUTPUT_DIR; @Option(shortName = "RC", doc = "Re-reverse bases and qualities of reads with negative strand flag set before writing them to fastq", optional = true) public boolean RE_REVERSE = true; @Option(shortName = "INTER", doc = "Will generate an interleaved fastq if paired, each line will have /1 or /2 to describe which end it came from") public boolean INTERLEAVE = false; @Option(shortName = "NON_PF", doc = "Include non-PF reads from the SAM file into the output " + "FASTQ files. PF means 'passes filtering'. Reads whose 'not passing quality controls' " + "flag is set are non-PF reads.") public boolean INCLUDE_NON_PF_READS = false; @Option(shortName = "CLIP_ATTR", doc = "The attribute that stores the position at which " + "the SAM record should be clipped", optional = true) public String CLIPPING_ATTRIBUTE; @Option(shortName = "CLIP_ACT", doc = "The action that should be taken with clipped reads: " + "'X' means the reads and qualities should be trimmed at the clipped position; " + "'N' means the bases should be changed to Ns in the clipped region; and any " + "integer means that the base qualities should be set to that value in the " + "clipped region.", optional = true) public String CLIPPING_ACTION; @Option(shortName = "R1_TRIM", doc = "The number of bases to trim from the beginning of read 1.") public int READ1_TRIM = 0; @Option(shortName = "R1_MAX_BASES", doc = "The maximum number of bases to write from read 1 after trimming. " + "If there are fewer than this many bases left after trimming, all will be written. If this " + "value is null then all bases left after trimming will be written.", optional = true) public Integer READ1_MAX_BASES_TO_WRITE; @Option(shortName = "R2_TRIM", doc = "The number of bases to trim from the beginning of read 2.") public int READ2_TRIM = 0; @Option(shortName = "R2_MAX_BASES", doc = "The maximum number of bases to write from read 2 after trimming. " + "If there are fewer than this many bases left after trimming, all will be written. If this " + "value is null then all bases left after trimming will be written.", optional = true) public Integer READ2_MAX_BASES_TO_WRITE; @Option(doc = "If true, include non-primary alignments in the output. Support of non-primary alignments in SamToFastq " + "is not comprehensive, so there may be exceptions if this is set to true and there are paired reads with non-primary alignments.") public boolean INCLUDE_NON_PRIMARY_ALIGNMENTS = false; private final Log log = Log.getInstance(SamToFastq.class); public static void main(final String[] argv) { System.exit(new SamToFastq().instanceMain(argv)); } protected int doWork() { IOUtil.assertFileIsReadable(INPUT); final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(REFERENCE_SEQUENCE).open(INPUT); final Map<String, SAMRecord> firstSeenMates = new HashMap<String, SAMRecord>(); final FastqWriterFactory factory = new FastqWriterFactory(); factory.setCreateMd5(CREATE_MD5_FILE); final Map<SAMReadGroupRecord, FastqWriters> writers = generateWriters(reader.getFileHeader().getReadGroups(), factory); final ProgressLogger progress = new ProgressLogger(log); for (final SAMRecord currentRecord : reader) { if (currentRecord.isSecondaryOrSupplementary() && !INCLUDE_NON_PRIMARY_ALIGNMENTS) continue; // Skip non-PF reads as necessary if (currentRecord.getReadFailsVendorQualityCheckFlag() && !INCLUDE_NON_PF_READS) continue; final FastqWriters fq = writers.get(currentRecord.getReadGroup()); if (currentRecord.getReadPairedFlag()) { final String currentReadName = currentRecord.getReadName(); final SAMRecord firstRecord = firstSeenMates.remove(currentReadName); if (firstRecord == null) { firstSeenMates.put(currentReadName, currentRecord); } else { assertPairedMates(firstRecord, currentRecord); final SAMRecord read1 = currentRecord.getFirstOfPairFlag() ? currentRecord : firstRecord; final SAMRecord read2 = currentRecord.getFirstOfPairFlag() ? firstRecord : currentRecord; writeRecord(read1, 1, fq.getFirstOfPair(), READ1_TRIM, READ1_MAX_BASES_TO_WRITE); final FastqWriter secondOfPairWriter = fq.getSecondOfPair(); if (secondOfPairWriter == null) { throw new PicardException("Input contains paired reads but no SECOND_END_FASTQ specified."); } writeRecord(read2, 2, secondOfPairWriter, READ2_TRIM, READ2_MAX_BASES_TO_WRITE); } } else { writeRecord(currentRecord, null, fq.getUnpaired(), READ1_TRIM, READ1_MAX_BASES_TO_WRITE); } progress.record(currentRecord); } CloserUtil.close(reader); // Close all the fastq writers being careful to close each one only once! for (final FastqWriters writerMapping : new HashSet<FastqWriters>(writers.values())) { writerMapping.closeAll(); } if (firstSeenMates.size() > 0) { SAMUtils.processValidationError(new SAMValidationError(SAMValidationError.Type.MATE_NOT_FOUND, "Found " + firstSeenMates.size() + " unpaired mates", null), VALIDATION_STRINGENCY); } return 0; } /** * Generates the writers for the given read groups or, if we are not emitting per-read-group, just returns the single set of writers. */ private Map<SAMReadGroupRecord, FastqWriters> generateWriters(final List<SAMReadGroupRecord> samReadGroupRecords, final FastqWriterFactory factory) { final Map<SAMReadGroupRecord, FastqWriters> writerMap = new HashMap<SAMReadGroupRecord, FastqWriters>(); final FastqWriters fastqWriters; if (!OUTPUT_PER_RG) { IOUtil.assertFileIsWritable(FASTQ); final FastqWriter firstOfPairWriter = factory.newWriter(FASTQ); final FastqWriter secondOfPairWriter; if (INTERLEAVE) { secondOfPairWriter = firstOfPairWriter; } else if (SECOND_END_FASTQ != null) { IOUtil.assertFileIsWritable(SECOND_END_FASTQ); secondOfPairWriter = factory.newWriter(SECOND_END_FASTQ); } else { secondOfPairWriter = null; } /** Prepare the writer that will accept unpaired reads. If we're emitting a single fastq - and assuming single-ended reads - * then this is simply that one fastq writer. Otherwise, if we're doing paired-end, we emit to a third new writer, since * the other two fastqs are accepting only paired end reads. */ final FastqWriter unpairedWriter = UNPAIRED_FASTQ == null ? firstOfPairWriter : factory.newWriter(UNPAIRED_FASTQ); fastqWriters = new FastqWriters(firstOfPairWriter, secondOfPairWriter, unpairedWriter); // For all read groups we may find in the bam, register this single set of writers for them. writerMap.put(null, fastqWriters); for (final SAMReadGroupRecord rg : samReadGroupRecords) { writerMap.put(rg, fastqWriters); } } else { // When we're creating a fastq-group per readgroup, by convention we do not emit a special fastq for unpaired reads. for (final SAMReadGroupRecord rg : samReadGroupRecords) { final FastqWriter firstOfPairWriter = factory.newWriter(makeReadGroupFile(rg, "_1")); // Create this writer on-the-fly; if we find no second-of-pair reads, don't bother making a writer (or delegating, // if we're interleaving). final Lazy<FastqWriter> lazySecondOfPairWriter = new Lazy<FastqWriter>(new Lazy.LazyInitializer<FastqWriter>() { @Override public FastqWriter make() { return INTERLEAVE ? firstOfPairWriter : factory.newWriter(makeReadGroupFile(rg, "_2")); } }); writerMap.put(rg, new FastqWriters(firstOfPairWriter, lazySecondOfPairWriter, firstOfPairWriter)); } } return writerMap; } private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; } void writeRecord(final SAMRecord read, final Integer mateNumber, final FastqWriter writer, final int basesToTrim, final Integer maxBasesToWrite) { final String seqHeader = mateNumber == null ? read.getReadName() : read.getReadName() + "/" + mateNumber; String readString = read.getReadString(); String baseQualities = read.getBaseQualityString(); // If we're clipping, do the right thing to the bases or qualities if (CLIPPING_ATTRIBUTE != null) { final Integer clipPoint = (Integer) read.getAttribute(CLIPPING_ATTRIBUTE); if (clipPoint != null) { if (CLIPPING_ACTION.equalsIgnoreCase("X")) { readString = clip(readString, clipPoint, null, !read.getReadNegativeStrandFlag()); baseQualities = clip(baseQualities, clipPoint, null, !read.getReadNegativeStrandFlag()); } else if (CLIPPING_ACTION.equalsIgnoreCase("N")) { readString = clip(readString, clipPoint, 'N', !read.getReadNegativeStrandFlag()); } else { final char newQual = SAMUtils.phredToFastq( new byte[]{(byte) Integer.parseInt(CLIPPING_ACTION)}).charAt(0); baseQualities = clip(baseQualities, clipPoint, newQual, !read.getReadNegativeStrandFlag()); } } } if (RE_REVERSE && read.getReadNegativeStrandFlag()) { readString = SequenceUtil.reverseComplement(readString); baseQualities = StringUtil.reverseString(baseQualities); } if (basesToTrim > 0) { readString = readString.substring(basesToTrim); baseQualities = baseQualities.substring(basesToTrim); } if (maxBasesToWrite != null && maxBasesToWrite < readString.length()) { readString = readString.substring(0, maxBasesToWrite); baseQualities = baseQualities.substring(0, maxBasesToWrite); } writer.write(new FastqRecord(seqHeader, readString, "", baseQualities)); } /** * Utility method to handle the changes required to the base/quality strings by the clipping * parameters. * * @param src The string to clip * @param point The 1-based position of the first clipped base in the read * @param replacement If non-null, the character to replace in the clipped positions * in the string (a quality score or 'N'). If null, just trim src * @param posStrand Whether the read is on the positive strand * @return String The clipped read or qualities */ private String clip(final String src, final int point, final Character replacement, final boolean posStrand) { final int len = src.length(); String result = posStrand ? src.substring(0, point - 1) : src.substring(len - point + 1); if (replacement != null) { if (posStrand) { for (int i = point; i <= len; i++) { result += replacement; } } else { for (int i = 0; i <= len - point; i++) { result = replacement + result; } } } return result; } private void assertPairedMates(final SAMRecord record1, final SAMRecord record2) { if (!(record1.getFirstOfPairFlag() && record2.getSecondOfPairFlag() || record2.getFirstOfPairFlag() && record1.getSecondOfPairFlag())) { throw new PicardException("Illegal mate state: " + record1.getReadName()); } } /** * Put any custom command-line validation in an override of this method. * clp is initialized at this point and can be used to print usage and access argv. * Any options set by command-line parser can be validated. * * @return null if command line is valid. If command line is invalid, returns an array of error * messages to be written to the appropriate place. */ protected String[] customCommandLineValidation() { if (INTERLEAVE && SECOND_END_FASTQ != null) { return new String[]{ "Cannot set INTERLEAVE to true and pass in a SECOND_END_FASTQ" }; } if (UNPAIRED_FASTQ != null && SECOND_END_FASTQ == null) { return new String[]{ "UNPAIRED_FASTQ may only be set when also emitting read1 and read2 fastqs (so SECOND_END_FASTQ must also be set)." }; } if ((CLIPPING_ATTRIBUTE != null && CLIPPING_ACTION == null) || (CLIPPING_ATTRIBUTE == null && CLIPPING_ACTION != null)) { return new String[]{ "Both or neither of CLIPPING_ATTRIBUTE and CLIPPING_ACTION should be set."}; } if (CLIPPING_ACTION != null) { if (CLIPPING_ACTION.equals("N") || CLIPPING_ACTION.equals("X")) { // Do nothing, this is fine } else { try { Integer.parseInt(CLIPPING_ACTION); } catch (NumberFormatException nfe) { return new String[]{"CLIPPING ACTION must be one of: N, X, or an integer"}; } } } if ((OUTPUT_PER_RG && OUTPUT_DIR == null) || ((!OUTPUT_PER_RG) && OUTPUT_DIR != null)) { return new String[]{ "If OUTPUT_PER_RG is true, then OUTPUT_DIR should be set. " + "If "}; } if (OUTPUT_PER_RG) { if (RG_TAG == null) { return new String[]{"If OUTPUT_PER_RG is true, then RG_TAG should be set."}; } else if (! (RG_TAG.equalsIgnoreCase("PU") || RG_TAG.equalsIgnoreCase("ID")) ){ return new String[]{"RG_TAG must be: PU or ID"}; } } return null; } /** * A collection of {@link htsjdk.samtools.fastq.FastqWriter}s for particular types of reads. * <p/> * Allows for lazy construction of the second-of-pair writer, since when we are in the "output per read group mode", we only wish to * generate a second-of-pair fastq if we encounter a second-of-pair read. */ static class FastqWriters { private final FastqWriter firstOfPair, unpaired; private final Lazy<FastqWriter> secondOfPair; /** Constructor if the consumer wishes for the second-of-pair writer to be built on-the-fly. */ private FastqWriters(final FastqWriter firstOfPair, final Lazy<FastqWriter> secondOfPair, final FastqWriter unpaired) { this.firstOfPair = firstOfPair; this.unpaired = unpaired; this.secondOfPair = secondOfPair; } /** Simple constructor; all writers are pre-initialized.. */ private FastqWriters(final FastqWriter firstOfPair, final FastqWriter secondOfPair, final FastqWriter unpaired) { this(firstOfPair, new Lazy<FastqWriter>(new Lazy.LazyInitializer<FastqWriter>() { @Override public FastqWriter make() { return secondOfPair; } }), unpaired); } public FastqWriter getFirstOfPair() { return firstOfPair; } public FastqWriter getSecondOfPair() { return secondOfPair.get(); } public FastqWriter getUnpaired() { return unpaired; } public void closeAll() { final Set<FastqWriter> fastqWriters = new HashSet<FastqWriter>(); fastqWriters.add(firstOfPair); fastqWriters.add(unpaired); // Make sure this is a no-op if the second writer was never fetched. if (secondOfPair.isInitialized()) fastqWriters.add(secondOfPair.get()); for (final FastqWriter fastqWriter : fastqWriters) { fastqWriter.close(); } } } }
[ "zhaoq0563@gmail.com" ]
zhaoq0563@gmail.com
cfd3cbc9ae79716799affcc47db9d3d9e43d6ea0
740b339e388049befa961d29282c4f2a56ed1363
/src/main/java/praca/inzynierska/goExplore/loginModule/repository/UserRepository.java
06d45c7a31a7c06b10d2d4b56b7e5437b314a717
[]
no_license
Jvrek/goExploreBe
b728c334cb4fc652e89a2a595a42db7df40d9b1b
c510fd2c7707910c179e3420380f9044739a0678
refs/heads/master
2023-02-24T10:49:55.947916
2021-01-30T02:20:10
2021-01-30T02:20:10
327,339,762
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package praca.inzynierska.goExplore.loginModule.repository; import org.springframework.data.mongodb.repository.MongoRepository; import praca.inzynierska.goExplore.userModule.models.User; import java.util.Optional; public interface UserRepository extends MongoRepository<User, String> { Optional<User> findByUsername(String username); Boolean existsByUsername(String username); Boolean existsByEmail(String email); }
[ "spyrka.jarek@gmail.com" ]
spyrka.jarek@gmail.com
0ac9092c9db06b692bc043a4657a2fb55b5be2be
f6c8f69d7dd094b65e354bed0d519bed5e5f9468
/Veisky/src/cn/harrysean/veisky/ViewStartScreen.java
7e731d0a86beee78e3a65354887c5f870e418150
[]
no_license
zleehomc/android
acb1b68a4ae53b9e6d88618b6dfb2c7ba386a25c
385edc4796edcc596713ba427be8f316bdf38c53
refs/heads/master
2021-01-10T01:47:07.088799
2017-06-13T08:16:45
2017-06-13T08:16:45
54,306,259
0
0
null
null
null
null
UTF-8
Java
false
false
2,732
java
package cn.harrysean.veisky; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.view.SurfaceHolder.Callback; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.animation.Animation; public class ViewStartScreen extends SurfaceView implements Callback, Runnable {// 备注1 private SurfaceHolder sfh; private Thread th; private Canvas canvas; private Paint paint, p; private int ScreenW, ScreenH; private int picalpha=0; private Resources res; private Bitmap bmp; private String copyright; public ViewStartScreen(Context context) { super(context); th = new Thread(this); sfh = this.getHolder(); sfh.addCallback(this); // 备注1 paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.BLACK); p = new Paint(); p.setColor(Color.YELLOW); p.setAntiAlias(true); this.setKeepScreenOn(true);// 保持屏幕常亮 res = this.getResources(); bmp = BitmapFactory.decodeResource(res, R.drawable.scstudio); copyright = res.getText(R.string.copyright).toString(); } @Override public void startAnimation(Animation animation) { super.startAnimation(animation); } public void surfaceCreated(SurfaceHolder holder) { ScreenW = this.getWidth();// 备注2 ScreenH = this.getHeight(); th.start(); } private void draw() { try { canvas = sfh.lockCanvas(); // 得到一个canvas实例 canvas.drawColor(Color.WHITE);// 刷屏 // TextPaint paint = TextView.getPaint(); Rect rect = new Rect(); paint.getTextBounds(copyright, 0, copyright.length(), rect); canvas.drawText(copyright, (ScreenW - rect.width()) / 2, (ScreenH - rect.height()), paint); Rect src = new Rect(); Rect dst = new Rect(); int w = (int) (bmp.getWidth() * 0.8), h = (int) (0.8 * bmp.getHeight()); src.set(0, 0, bmp.getWidth(), bmp.getHeight()); dst.set((ScreenW - w) / 2, ScreenH / 4, (ScreenW - w) / 2 + w, ScreenH / 4 + h); p.setAlpha(picalpha); canvas.drawBitmap(bmp, src, dst, p); picalpha=picalpha<235?picalpha+20:255; } catch (Exception e) { } finally { // 备注3 if (canvas != null) sfh.unlockCanvasAndPost(canvas); // 将画好的画布提交 } } public void run() { while (true) { draw(); try { Thread.sleep(40); } catch (InterruptedException e) { e.printStackTrace(); } } } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceDestroyed(SurfaceHolder holder) { // TODO Auto-generated method stub } }
[ "zleehomc@outlook.com" ]
zleehomc@outlook.com
bec6d838ebcf1fcf3d3355110eaf7789ef474c97
445162a28dc60148d87aa155ab18812d170762f6
/app/src/main/java/za/co/robusttech/sewa_in/activities/LoginActivity.java
798b7370197d2edf3afc0e82d1c67071aeb1e372
[]
no_license
Joesta/sewa-in
5bbb51153d2055ad466108a3333702ca1086713c
d14fa31a03d82a32169f665de300a74a6f7d2aec
refs/heads/main
2023-07-01T10:41:06.771169
2021-04-23T17:06:15
2021-04-23T17:06:15
332,714,902
0
0
null
2021-04-23T17:06:16
2021-01-25T10:49:07
Java
UTF-8
Java
false
false
4,573
java
package za.co.robusttech.sewa_in.activities; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import za.co.robusttech.sewa_in.R; public class LoginActivity extends AppCompatActivity { EditText email, password; Button btn_login; FirebaseAuth auth; TextView forgot_password , sign_in; private FirebaseAuth.AuthStateListener mAuthStateListener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); auth = FirebaseAuth.getInstance(); email = findViewById(R.id.email); password = findViewById(R.id.password); btn_login = findViewById(R.id.btn_login); forgot_password = findViewById(R.id.forgot_password); sign_in = findViewById(R.id.sign_in_login); forgot_password.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent resetPWD = new Intent(LoginActivity.this, ForgotPasswordActivity.class); startActivity(resetPWD); } }); sign_in.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent Reg = new Intent(LoginActivity.this, RegisterActivity.class); startActivity(Reg); } }); mAuthStateListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser mFirebaseUser = auth.getCurrentUser(); if( mFirebaseUser != null){ Toast.makeText(LoginActivity.this, "You Are Logged In", Toast.LENGTH_SHORT).show(); Intent i = new Intent (LoginActivity.this, HomeActivity.class); startActivity(i); } else{ Toast.makeText(LoginActivity.this, "Please Login", Toast.LENGTH_SHORT).show(); } } }; btn_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String txt_email = email.getText().toString(); String txt_password = password.getText().toString(); if (txt_email.equals("devsewa-inrobbusttech") || txt_password.equals("shalom@robbusttech")){ Intent intent = new Intent(LoginActivity.this , UploadDataActivity.class); startActivity(intent); } if (TextUtils.isEmpty(txt_email) || TextUtils.isEmpty(txt_password)){ Toast.makeText(LoginActivity.this, "All fileds are required", Toast.LENGTH_SHORT).show(); } else { auth.signInWithEmailAndPassword(txt_email, txt_password) .addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()){ Intent intent = new Intent(LoginActivity.this, HomeActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } else { Toast.makeText(LoginActivity.this, "Authentication failed!", Toast.LENGTH_SHORT).show(); } } }); } } }); } @Override protected void onStart(){ super.onStart(); auth.addAuthStateListener(mAuthStateListener); } }
[ "assish@aca3.assish" ]
assish@aca3.assish
21401635fff270fe7f651d2b1f6b8a949c30752c
cb4f66e56db15d8c327a06dfa4bbb39a4c313a3e
/app/src/main/java/com/mg/axe/androiddevelop/develop/TestActivity.java
d9e35d9e0fefc5347f55c75986c3b58769e524b8
[]
no_license
AxeChen/axe
47a784aa0667a5236bb5e2b73d192084fafb9e17
b261e40a32832165f63907c351717e45210e8878
refs/heads/master
2021-04-29T01:01:46.945254
2017-04-06T03:54:45
2017-04-06T03:54:45
77,787,187
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package com.mg.axe.androiddevelop.develop; import android.app.Activity; /** * Created by Administrator on 2016/11/27 0027. */ public class TestActivity extends Activity { }
[ "1137366723@qq.com" ]
1137366723@qq.com
18f862c4081b37c0c3b14e3e32671d22090471b8
4e55045a272db79ad0ecc3703305fc308715992d
/Lesson7/NotEnoughMoneyException.java
902b11a48f0f77888244fa21b054527093aced12
[]
no_license
abilashenko/Java_study
d6814a04952094949229cae9862e888226f39364
e75e9af732ecec895d0d297dad4d2ca3413b03a6
refs/heads/master
2023-01-08T21:24:32.177167
2020-11-12T16:42:19
2020-11-12T16:42:19
293,518,858
0
0
null
2020-09-24T15:11:13
2020-09-07T12:14:44
Java
UTF-8
Java
false
false
159
java
package Lesson7; public class NotEnoughMoneyException extends Exception { public NotEnoughMoneyException(String message) { super(message); } }
[ "a.bilashenko@x5.ru" ]
a.bilashenko@x5.ru
ce4fea73dffa5c7d5d5841367ab14e8fcbed0627
ec22447463851a262516d2523d675e5b19c5e3fb
/recommendation-service/src/main/java/se/lockin/microservices/core/recommendation/persistence/RecommendationEntity.java
5adaac26101d5df2924a011ae4348d8f444149b5
[]
no_license
lockinDev/compose-products-service
b9779dc1406e8cba50740c43a0d8215d0478d08f
5f342ca5ee9f7fee1d6ecf7261aa0a69f76d0490
refs/heads/main
2023-04-19T14:21:17.965701
2021-05-12T12:13:27
2021-05-12T12:13:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,078
java
package se.lockin.microservices.core.recommendation.persistence; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Version; import org.springframework.data.mongodb.core.index.CompoundIndex; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection="recommendations") @CompoundIndex(name = "prod-rec-id", unique = true, def = "{'productId': 1, 'recommendationId' : 1}") public class RecommendationEntity { @Id private String id; @Version private Integer version; private int productId; private int recommendationId; private String author; private int rating; private String content; public RecommendationEntity() { } public RecommendationEntity(int productId, int recommendationId, String author, int rating, String content) { this.productId = productId; this.recommendationId = recommendationId; this.author = author; this.rating = rating; this.content = content; } public String getId() { return id; } public Integer getVersion() { return version; } public int getProductId() { return productId; } public int getRecommendationId() { return recommendationId; } public String getAuthor() { return author; } public int getRating() { return rating; } public String getContent() { return content; } public void setId(String id) { this.id = id; } public void setVersion(Integer version) { this.version = version; } public void setProductId(int productId) { this.productId = productId; } public void setRecommendationId(int recommendationId) { this.recommendationId = recommendationId; } public void setAuthor(String author) { this.author = author; } public void setRating(int rating) { this.rating = rating; } public void setContent(String content) { this.content = content; } }
[ "javieralmario12@gmail.com" ]
javieralmario12@gmail.com
ea4a8eb142c7c5d3ec20e4ff3f7103110ea00fd2
382d0914b30e5c7a0a6611f929bdcc76259747ed
/GameUtil/src/game/vn/common/queue/QueueServiceApi.java
c937808df4012dad82b7a7b52aa3e2d3a8ffe93c
[]
no_license
Mrkenvin1982/viet13
874dbb02cb4d8659ac677a6b9f46d9315d1f1df8
d63aefaacf879df26441af625354bd9183a0820c
refs/heads/master
2022-04-09T06:53:04.807008
2020-03-24T16:24:58
2020-03-24T16:24:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,492
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 game.vn.common.queue; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Address; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.ShutdownListener; import com.rabbitmq.client.ShutdownSignalException; import game.vn.common.config.QueueConfig; import game.vn.util.GsonUtil; import java.nio.charset.Charset; import java.util.Arrays; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Queue sử dụng tương tác với TTKT * @author tuanp */ public class QueueServiceApi { private final static Logger LOGGER = LoggerFactory.getLogger(QueueService.class); private static final QueueServiceApi _instance = new QueueServiceApi(); private Connection conn; private Channel channel; private AMQP.BasicProperties prop; public static QueueServiceApi getInstance(){ return _instance; } public void init() { try { ConnectionFactory factory = new ConnectionFactory(); factory.setUsername(QueueConfig.getInstance().getQueueApiUserName()); factory.setPassword(QueueConfig.getInstance().getQueueApiPassWord()); factory.setAutomaticRecoveryEnabled(true); ExecutorService es = Executors.newFixedThreadPool(QueueConfig.getInstance().getQueueApiPoolSize()); conn = factory.newConnection(es, getHosts()); conn.addShutdownListener(new ShutdownListener() { @Override public void shutdownCompleted(ShutdownSignalException paramShutdownSignalException) { LOGGER.warn("------------ RabbitMQ Service shutdown complete: " + paramShutdownSignalException); } }); channel = conn.createChannel(); AMQP.BasicProperties.Builder builder = new AMQP.BasicProperties.Builder(); prop = builder.deliveryMode(2).build(); LOGGER.info("---------------- QueueServiceApi init done, connected to: " + conn.getAddress() + ":" + conn.getPort() + " ----------------"); } catch (Exception ex) { LOGGER.error("QueueServiceApi init error", ex); } } private Address[] getHosts() { List<String> listHost = Arrays.asList(QueueConfig.getInstance().getQueueApiHost().split(";")); if (listHost.size() > 0) { Address[] queueHosts = new Address[listHost.size()]; for (int i = 0; i < listHost.size(); i++) { queueHosts[i] = new Address(listHost.get(i), QueueConfig.getInstance().getQueueApiPort()); } return queueHosts; } return null; } public void sendData(String routingKey, boolean isPersistance, Object obj) { try { String data = GsonUtil.toJson(obj); LOGGER.info(data); channel.basicPublish(QueueConfig.getInstance().getQueueApiExchange(), routingKey, isPersistance ? prop : null, data.getBytes(Charset.forName("UTF-8"))); } catch (Exception ex) { LOGGER.error("-----RabbitMQ error:", ex); } } }
[ "hanv@mecorp.vn" ]
hanv@mecorp.vn
01289128d555671bba90aae8226d3b740531e80a
f33ebcaafc5022adce34e06245c81443f153d36f
/barrelcounter/src/main/java/ru/inno/innopicker/ExtendedNumberPicker.java
9df01d6570e040857fa049093ab0305e39eecc7f
[]
no_license
Gaket/barrelCounter
8ca756f2b9ee34b4e5c35784b52339b44783c592
a2e276da3d266986acd1881e9d3e9c91657ed8c1
refs/heads/master
2020-12-02T21:25:16.260308
2017-07-05T19:33:30
2017-07-05T19:33:30
96,313,734
0
0
null
null
null
null
UTF-8
Java
false
false
5,013
java
package ru.inno.innopicker; import android.content.Context; import android.graphics.Paint; import android.os.Handler; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.widget.EditText; import android.widget.NumberPicker; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * @author Artur Badretdinov (Gaket) * 20.12.2016. */ public class ExtendedNumberPicker extends NumberPicker { public static final String TAG = "ExtendedNumberPicker"; public static final int SCROLL_DELAY_MS = 150; private Handler handler = new Handler(); public ExtendedNumberPicker(Context context) { super(context); } public ExtendedNumberPicker(Context context, AttributeSet attrs) { super(context, attrs); } public ExtendedNumberPicker(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); handler.removeCallbacks(null); } /** * Increment value showing animation */ public void increment() { changeValueByOne(true); } /** * Increment value showing animation several times * * @param times - number of increments */ public void increment(int times) { Runnable runnable = new IncrementDigit(this); times = Math.abs(times); for (int i = 0; i < times; i++) { handler.postDelayed(runnable, SCROLL_DELAY_MS * i); } } /** * Decrement value showing animation */ public void decrement() { changeValueByOne(false); } /** * Decrement value showing animation several times * * @param times - number of decrements */ public void decrement(int times) { Runnable runnable = new DecrementDigit(this); times = Math.abs(times); for (int i = 0; i < times; i++) { handler.postDelayed(runnable, SCROLL_DELAY_MS * i); } } /** * Using reflection to change the value because * changeValueByOne is a private function and setValue * doesn't call the onValueChange listener. * <p> * Rationale: https://stackoverflow.com/questions/13500852/how-to-change-numberpickers-value-with-animation * * @param increment - true if it should be incremented, else - decremented */ private void changeValueByOne(final boolean increment) { Method method; try { method = this.getClass().getSuperclass().getDeclaredMethod("changeValueByOne", boolean.class); method.setAccessible(true); method.invoke(this, increment); // Here would be a call to Timber that would send trace to Crashlytics, if it is real app and not the test one } catch (final NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) { Log.e(TAG, "change value by one error", e); } } /** * Set text size in pixels * <p> * Using reflection to change the value because * there is no such setter in NumberPicker * * @param textSize - text size in pixels */ public void setTextSize(float textSize) { final int count = getChildCount(); for (int i = 0; i < count; i++) { View child = getChildAt(i); if (child instanceof EditText) { setTextSize(textSize, (EditText) child); } else { Log.e(TAG, "Unexpected view type"); } } } private void setTextSize(float textSize, EditText numberView) { try { Field selectorWheelPaintField = this.getClass().getSuperclass().getDeclaredField("mSelectorWheelPaint"); selectorWheelPaintField.setAccessible(true); Paint paint = (Paint) selectorWheelPaintField.get(this); paint.setTextSize(textSize); numberView.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); this.invalidate(); } catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) { Log.e(TAG, "Problem getting view field", e); } } private static class IncrementDigit implements Runnable { private final ExtendedNumberPicker picker; IncrementDigit(ExtendedNumberPicker picker) { this.picker = picker; } @Override public void run() { picker.increment(); } } private class DecrementDigit implements Runnable { private final ExtendedNumberPicker picker; DecrementDigit(ExtendedNumberPicker picker) { this.picker = picker; } @Override public void run() { picker.decrement(); } } }
[ "artursletter@gmail.com" ]
artursletter@gmail.com
a454fc4f3d49db79cb5da1778b55b562540653f6
150faada6d96cf3477a9f01ebe4a92875a98e209
/app/src/main/java/magnet/com/magnet/backboard/imitator/EventImitator.java
88f2c8bd928a47894bf8abc4296b6248d53c8cd7
[]
no_license
TeruyaHaroldo/FloatWidget
3d922587c9bb55f57d0f018fe33285d824a7d574
e8db7bfb29ca0c6e4d143a7fb1d988b7a053f6b3
refs/heads/master
2020-03-23T10:46:29.311247
2018-07-27T18:48:51
2018-07-27T18:48:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,600
java
package magnet.com.magnet.backboard.imitator; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.MotionEvent; import android.view.View; import com.facebook.rebound.Spring; /** * Maps a {@link MotionEvent} to a {@link Spring}, * although it does not pick a property to map. * <p> * Created by ericleong on 5/30/14. */ public abstract class EventImitator extends Imitator { /** * Constructor. * * @param spring * the spring to use. * @param restValue * the rest value for the spring. * @param trackStrategy * the tracking strategy. * @param followStrategy * the follow strategy. */ public EventImitator(@NonNull final Spring spring, final double restValue, final int trackStrategy, final int followStrategy) { super(spring, restValue, trackStrategy, followStrategy); } /** * Constructor. Note that the spring must be set with {@link #setSpring(Spring)}. * * @param restValue * the rest value for the spring. * @param trackStrategy * the tracking strategy. * @param followStrategy * the follow strategy. */ protected EventImitator(final double restValue, final int trackStrategy, final int followStrategy) { super(restValue, trackStrategy, followStrategy); } /** * Called when the user touches ({@link MotionEvent#ACTION_DOWN}). * * @param event * the motion event */ public void constrain(final MotionEvent event) { if (mSpring != null && mFollowStrategy == FOLLOW_EXACT) { mSpring.setVelocity(0); } } /** * Called when the user moves their finger ({@link MotionEvent#ACTION_MOVE}). * * @param offset * the value offset * @param value * the current value * @param delta * the change in the value * @param dt * the change in time * @param event * the motion event */ public void mime(final float offset, final float value, final float delta, final float dt, final MotionEvent event) { if (mSpring != null) { mSpring.setEndValue(mapToSpring(offset + value)); if (mFollowStrategy == FOLLOW_EXACT) { mSpring.setCurrentValue(mSpring.getEndValue()); if (dt > 0) { mSpring.setVelocity(delta / dt); } } } } /** * Called when the user releases their finger ({@link MotionEvent#ACTION_UP}). * * @param event * the motion event */ public void release(final MotionEvent event) { if (mSpring != null) { mSpring.setEndValue(mRestValue); } } /** * Called by a {@link MotionImitator} (or another {@link * View.OnTouchListener}) when a {@link MotionEvent} occurs. * * @param offset * the value offset * @param value * the current value * @param delta * the change in the value * @param event * the motion event */ protected void imitate(final float offset, final float value, final float delta, @Nullable final MotionEvent event) { if (event != null) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: constrain(event); case MotionEvent.ACTION_MOVE: if (event.getHistorySize() > 0) { mime(offset, value, delta, event.getEventTime() - event.getHistoricalEventTime(0), event); } else { mime(offset, value, delta, 0, event); } break; default: case MotionEvent.ACTION_UP: release(event); break; } } } /** * Maps a user's motion to {@link View} via a {@link Spring}. * * @param view * the view to perturb. * @param event * the motion to imitate. */ public abstract void imitate(final View view, @NonNull final MotionEvent event); }
[ "haroldo.s.teruya@gmail.com" ]
haroldo.s.teruya@gmail.com
01e9455ae3a7e02f7fd72d1a3ed5a9a8762596f7
8fc495c451e85122e6bcc4478960004149fc66e0
/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/spi/QuarkusAnnotationProvider.java
ad0fdb0cae48c1271b9bc742781861bfd030e338
[ "Apache-2.0" ]
permissive
apache/myfaces
4d9f0b17fb5057d61dc015a4dae0f58e42a1d914
f003bb4794c88ec91b27a28b8a4e34b6fd53edbd
refs/heads/main
2023-09-05T13:01:05.750503
2023-09-05T11:35:32
2023-09-05T11:35:32
132,600,378
116
89
null
2023-09-05T11:35:34
2018-05-08T11:41:08
Java
UTF-8
Java
false
false
1,694
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.myfaces.core.extensions.quarkus.runtime.spi; import java.io.IOException; import java.lang.annotation.Annotation; import java.net.URL; import java.util.Collections; import java.util.Map; import java.util.Set; import jakarta.faces.context.ExternalContext; import org.apache.myfaces.spi.AnnotationProvider; import org.apache.myfaces.core.extensions.quarkus.runtime.MyFacesRecorder; /** * AnnotationProvider which uses the collected classes from the Quarkus Deployment-time. */ public class QuarkusAnnotationProvider extends AnnotationProvider { @Override public Map<Class<? extends Annotation>, Set<Class<?>>> getAnnotatedClasses(ExternalContext ctx) { return MyFacesRecorder.ANNOTATED_CLASSES; } @Override public Set<URL> getBaseUrls(ExternalContext ctx) throws IOException { return Collections.emptySet(); } }
[ "bommel@apache.org" ]
bommel@apache.org
5dbb57bdf3bf868e40263b2f5b230837f2dc062c
a5db572ceff8977cdae27aa7be47aab4db5a3d56
/apis/api-web/api-web-fo-mcommerce/src/main/java/org/hoteia/qalingo/web/mvc/controller/common/ConditionsOfUseController.java
212b7bde402bf31e330bff698b834bde4579ff1b
[ "Apache-2.0" ]
permissive
srisaiudaykota/qalingo-b2c-engine
f2960a634518bc45212738de16ad822cdb18c0be
121a6e4bbfbc82e9500279a61821af7b405494ea
refs/heads/master
2020-12-03T09:19:36.035446
2013-11-21T13:35:15
2013-11-21T13:35:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,015
java
/** * Most of the code in the Qalingo project is copyrighted Hoteia and licensed * under the Apache License Version 2.0 (release version 0.7.0) * http://www.apache.org/licenses/LICENSE-2.0 * * Copyright (c) Hoteia, 2012-2013 * http://www.hoteia.com - http://twitter.com/hoteia - contact@hoteia.com * */ package org.hoteia.qalingo.web.mvc.controller.common; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import org.hoteia.qalingo.core.ModelConstants; import org.hoteia.qalingo.core.domain.enumtype.FoUrls; import org.hoteia.qalingo.core.i18n.FoMessageKey; import org.hoteia.qalingo.core.i18n.enumtype.ScopeWebMessage; import org.hoteia.qalingo.core.web.servlet.ModelAndViewThemeDevice; import org.hoteia.qalingo.web.mvc.controller.AbstractMCommerceController; /** * */ @Controller("conditionsOfUseController") public class ConditionsOfUseController extends AbstractMCommerceController { @RequestMapping(FoUrls.CONDITIONS_OF_USE_URL) public ModelAndView conditionsOfUse(final HttpServletRequest request, final HttpServletResponse response) throws Exception { ModelAndViewThemeDevice modelAndView = new ModelAndViewThemeDevice(getCurrentVelocityPath(request), FoUrls.CONDITIONS_OF_USE.getVelocityPage()); final Locale locale = requestUtil.getCurrentLocale(request); final String pageKey = FoUrls.CONDITIONS_OF_USE.getKey(); final String title = getSpecificMessage(ScopeWebMessage.SEO, getMessageTitleKey(pageKey), locale); overrideSeoTitle(request, modelAndView, title); final String contentText = getSpecificMessage(ScopeWebMessage.CONDITIONS_OF_USE, FoMessageKey.MAIN_CONTENT_TEXT, getCurrentLocale(request)); modelAndView.addObject(ModelConstants.CONTENT_TEXT, contentText); return modelAndView; } }
[ "denis@Hoteia-Laptop.home" ]
denis@Hoteia-Laptop.home
22e8026da8dfd30e21661de0a75b46f62297b7e7
c5efc44c9f6517ad5f9f2676077dc38f527fdc7c
/Server/NatureWatchServer/src/main/java/at/jku/se/web/ViewAddAnimalController.java
fa14a26017679168ee21f5c00c7669a7729ade9e
[]
no_license
maxms93/NatureWatch
eba860a9bd45ac0a38b441541f851b9217917e61
7236e4b6f18b29d61ae96ba0d7da69b0ca62ea7e
refs/heads/master
2021-09-06T09:14:53.333614
2018-02-04T21:47:22
2018-02-04T21:47:22
111,825,386
0
3
null
null
null
null
UTF-8
Java
false
false
1,362
java
package at.jku.se.web; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class ViewAddAnimalController */ public class ViewAddAnimalController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ViewAddAnimalController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub RequestDispatcher dispatcher = getServletContext() .getRequestDispatcher("/WEB-INF/add_animal.jsp"); dispatcher.forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "msandberger@gmail.com" ]
msandberger@gmail.com
2488d261176274d0b5d78d38ddd84f8694d2b535
b5276ac6bf44fb6d5e44f3ebf9056e27bf635acc
/bone-core/src/main/java/site/zido/bone/core/beans/annotation/Beans.java
71be56af4e0d97f7fa2378708bf2bdeeb46ea6ce
[ "MIT" ]
permissive
zidoshare/bone
d2624508c744dcad5ae3d49a92948288fef28efb
d5f826240809d02aa2e32785f2a739b5905177e6
refs/heads/master
2020-06-25T07:57:23.362057
2018-05-10T07:21:26
2018-05-10T07:21:26
96,965,758
3
2
null
2018-03-26T08:06:24
2017-07-12T04:37:10
Java
UTF-8
Java
false
false
263
java
package site.zido.bone.core.beans.annotation; import java.lang.annotation.*; /** * 用于标记类中包含bean * * @author zido * @date 2018 /05/10 */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Beans { }
[ "wuhongxu1208@gmail.com" ]
wuhongxu1208@gmail.com
94970ef69460479c3888fc0d2b2a3057ec284c8b
c9e7efa81cae6ca5f90ccd20a62745d148dac13e
/src/helper/CidadeDAO.java
83c5f2b04cade51a431e6f4181313bf63e82b924
[]
no_license
cesarfmc/FinAppJava
a87ecaa25bdfb9f62d426f18a61ada2b09c861d4
a2ce044eac0a84515e866379b3fd1a3743560152
refs/heads/master
2020-06-12T10:54:30.727191
2020-03-04T21:54:01
2020-03-04T21:54:01
194,276,939
0
0
null
null
null
null
UTF-8
Java
false
false
1,765
java
package helper; import java.util.ArrayList; import java.util.List; import org.hibernate.Hibernate; import org.hibernate.Session; import model.Cidade; import model.Estado; public class CidadeDAO { public void addCidade(Cidade cidade) { Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); s.save(cidade); s.getTransaction().commit(); s.close(); } public List<Cidade> listCidade() { List<Cidade> list = new ArrayList<Cidade>(); Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); list = s.createQuery("from Cidade",Cidade.class).list(); s.getTransaction().commit(); return list; } public void removeCidade(Integer id) { Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); Cidade c = (Cidade) s.load(Cidade.class, id); s.delete(c); s.getTransaction().commit(); s.close(); } public void updateCidade(Cidade cidade) { Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); s.update(cidade); s.getTransaction().commit(); } public Cidade retornaCidade(Integer id) { Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); Cidade c = (Cidade) s.get(Cidade.class, id); Hibernate.initialize(c.getEstado()); s.getTransaction().commit(); s.close(); return c; } public List<Cidade> retornaCidadeEstado(Estado estado) { List<Cidade> list = new ArrayList<Cidade>(); Session s = HibernateUtil2.getSessionFactory().openSession(); s.beginTransaction(); list = s.createQuery("from Cidade",Cidade.class).list(); s.getTransaction().commit(); return list; } }
[ "Joao Paulo@192.168.0.103" ]
Joao Paulo@192.168.0.103
fce0bd473baa8c3548122a9b7abd88e1e58b340f
5be4e28391f8909a55bc18a182a50a8405068350
/src/main/java/com/oytu/darwinismo/Individuo.java
5a4e03403eb188fb3db01693bc6c5e0a68f04310
[]
no_license
Vinicius-8/Darwinismo
2a132a03b03ab9a3b4622e113dc9bc25ec85c8d5
15662092cf56c5b847f95bcfa9b52b9e9b1728db
refs/heads/master
2020-06-12T02:20:15.245674
2019-09-28T18:12:39
2019-09-28T18:12:39
194,165,389
0
0
null
null
null
null
UTF-8
Java
false
false
5,780
java
package com.oytu.darwinismo; import java.util.ArrayList; import java.util.List; /** * * @author Vinicius */ class Individuo implements Comparable<Individuo> { private List espacos = new ArrayList<>(); private List valores = new ArrayList<>(); private Double limiteEspacos; // limite do espaço em metros cúbicos do caminhão private Double notaAvaliacao; // somatório em reais dos produtos que estão no cromossomo do indivíduo; private Double espacoUsado; // armazena os metros cúbicos que o cromossomo do indivíduo está armazenando private int geracao; private List cromossomo = new ArrayList<>(); public Individuo(List espacos, List valores, Double limiteEspacos){ this.espacos = espacos; this.valores = valores; this.limiteEspacos = limiteEspacos; this.notaAvaliacao = 0.0; this.espacoUsado = 0.0; this.geracao = 0; for(int i=0; i < this.espacos.size(); i++){ if (java.lang.Math.random() < 0.5 ){ // na primeira geração é criado o cromossomo com valores aleatórios this.cromossomo.add("0"); }else{ this.cromossomo.add("1"); } } } public void avaliacao(){ // função fitness para avaliação de cada indivíduo Double nota = 0.0; Double somaEspacos = 0.0; for (int i =0; i < this.cromossomo.size(); i++){ if(this.cromossomo.get(i).equals("1")){ nota += (Double) this.valores.get(i); somaEspacos += (Double) this.espacos.get(i); } } if(somaEspacos > this.limiteEspacos){ nota = 1.0; } this.notaAvaliacao = nota; this.espacoUsado = somaEspacos; } /* Operador CROSSOVER responsável pelo cruzamento de indivíduos de uma população. Utiliza o método de um ponto para sortiar o ponto de corte, onde o primeiro filho é composto pela concatenação da parte do primeiro pai à esquerda do ponto de corte com a parte do segundo pai à direita do ponto de corte e o segundo filho pelas partes restantes. */ public List crossover(Individuo outroIndividuo){ // função para cruzamento dos indivíduos e geração de novas soluções int corte = (int) Math.round(Math.random() * this.cromossomo.size()); // ponto de corte no cromossomo, função Math.random retorna um valor entre 0 e 1 List filho1 = new ArrayList<>(); filho1.addAll(outroIndividuo.getCromossomo().subList(0, corte)); filho1.addAll(this.cromossomo.subList(corte, this.cromossomo.size())); List filho2 = new ArrayList<>(); filho2.addAll(this.cromossomo.subList(0, corte)); filho2.addAll(outroIndividuo.getCromossomo().subList(corte, this.cromossomo.size())); List<Individuo> filhos = new ArrayList<>(); filhos.add(new Individuo(this.espacos, this.valores, this.limiteEspacos)); filhos.add(new Individuo(this.espacos, this.valores, this.limiteEspacos)); filhos.get(0).setCromossomo(filho1); filhos.get(0).setGeracao(this.geracao + 1); filhos.get(1).setCromossomo(filho2); filhos.get(1).setGeracao(this.geracao + 1); return filhos; } /* Operador de MUTAÇÃO que faz a mutação de um cromossomo com base na taxa de mutação passada para o método. A mutação é a operação realizada após a operação crossover. O método de mutação utiliza o operador Random Resetting: é escolhido um novo valor, aleatoriamente, a partir do conjunto de valores inteiros para cada posição. */ public Individuo mutacao(Double taxaMutacao){ //System.out.println("Antes da mutação: " + this.cromossomo); for(int i = 0; i < this.cromossomo.size(); i++){ if(Math.random() < taxaMutacao){ if(this.cromossomo.get(i).equals("1")){ this.cromossomo.set(i, "0"); }else{ this.cromossomo.set(i, "1"); } } } //System.out.println("Depois da mutação: " + this.cromossomo); return this; } public Double getEspacoUsado() { return espacoUsado; } public void setEspacoUsado(Double espacoUsado) { this.espacoUsado = espacoUsado; } public List getEspacos() { return espacos; } public void setEspacos(List espacos) { this.espacos = espacos; } public List getValores() { return valores; } public void setValores(List valores) { this.valores = valores; } public Double getLimiteEspacos() { return limiteEspacos; } public void setLimiteEspacos(Double limiteEspacos) { this.limiteEspacos = limiteEspacos; } public Double getNotaAvaliacao() { return notaAvaliacao; } public void setNotaAvaliacao(Double notaAvaliacao) { this.notaAvaliacao = notaAvaliacao; } public int getGeracao() { return geracao; } public void setGeracao(int geracao) { this.geracao = geracao; } public List getCromossomo() { return cromossomo; } public void setCromossomo(List cromossomo) { this.cromossomo = cromossomo; } @Override public int compareTo(Individuo o) { if(this.notaAvaliacao > o.getNotaAvaliacao()){ return -1; } if(this.notaAvaliacao < o.getNotaAvaliacao()){ return 1; } return 0; } } // fim classe Individuo
[ "viniciusvieira55@gmail.com" ]
viniciusvieira55@gmail.com
89c5f6c1fe3313853a8411c1c5a1e9f33fb5ea5d
3257e10093804fbc1e39cbe09d62137df6b9db2a
/src/main/java/com/bionic4/inputOutput/ScanWr.java
4b6e3b23c15efab1ac3c60aa508a2924eea70a3f
[]
no_license
lpyavka/OReilly
33647884d61f29d657bf4ede5aec93135f546161
7b788a57809e3be3d3bcaa3aa2b48df991cd7d58
refs/heads/master
2021-01-10T07:38:02.487925
2015-12-27T09:14:34
2015-12-27T09:14:34
46,606,417
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package com.bionic4.inputOutput; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.Scanner; /** * Created by Sony on 09.11.2015. */ public class ScanWr { public static void main(String[] args) { File file = new File("test32.doc"); Scanner scanner = new Scanner(System.in); String str = scanner.next(); try { FileWriter wrt = null; try { wrt = new FileWriter(file); } catch (IOException e) { e.printStackTrace(); } wrt.write(str); wrt.close(); } catch (IOException e) { e.printStackTrace(); } } }
[ "lpyavka@gmail.com" ]
lpyavka@gmail.com
8e175dea58b82b8130d68ca5f0de08ea5594935c
e295d70fb8f25d07832fbf494fe2e87d10a0ff86
/src/TestCar.java
893358b9dc55b03ea45b48affb54d170b1d4cf78
[]
no_license
fvales/LabExam_ISA1
817f829c698243656be2a6af23f319b1993ae583
0e6481d127a0d1330367e2cb691be89d84e7a9f2
refs/heads/master
2021-01-20T15:04:04.415545
2017-05-09T07:14:52
2017-05-09T07:14:52
90,711,808
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
import static org.junit.Assert.*; import org.junit.Test; public class TestCar { @Test public void testForFail() { Car c = new Car(); c.setEngineCapacity(120); assertEquals(200,c.getEngineCapacity()); } @Test public void testForSuccess() { Car c = new Car(); c.setEngineCapacity(120); assertEquals(120,c.getEngineCapacity()); } @Test public void testForTrue() { Car c = new Car(); c.setEngineCapacity(120); assertTrue(c.getEngineCapacity() > 100); } @Test public void testForFalse() { Car c = new Car(); c.setEngineCapacity(120); assertTrue(c.getEngineCapacity() < 100); } }
[ "freedavales28@gmail.com" ]
freedavales28@gmail.com
d99c8746b68eb8da17988a5a3ffbc0e76696fd91
ca030864a3a1c24be6b9d1802c2353da4ca0d441
/classes7.dex_source_from_JADX/com/facebook/notifications/protocol/FetchNotificationsGraphQL$DeltaNotificationsQueryString.java
2d32f298ef9674cfc89008f7e3ae48582be50a70
[]
no_license
pxson001/facebook-app
87aa51e29195eeaae69adeb30219547f83a5b7b1
640630f078980f9818049625ebc42569c67c69f7
refs/heads/master
2020-04-07T20:36:45.758523
2018-03-07T09:04:57
2018-03-07T09:04:57
124,208,458
4
0
null
null
null
null
UTF-8
Java
false
false
15,174
java
package com.facebook.notifications.protocol; import com.facebook.common.util.TriState; import com.facebook.graphql.query.TypedGraphQlQueryString; import com.facebook.notifications.protocol.FetchNotificationsGraphQLModels.DeltaNotificationsQueryModel; import com.google.common.collect.RegularImmutableSet; /* compiled from: negativeFeedbackActions */ public class FetchNotificationsGraphQL$DeltaNotificationsQueryString extends TypedGraphQlQueryString<DeltaNotificationsQueryModel> { public FetchNotificationsGraphQL$DeltaNotificationsQueryString() { super(DeltaNotificationsQueryModel.class, false, "DeltaNotificationsQuery", "6cdd3f80c7ec53375fe2867bbfa3f2b6", "viewer", "10154690955191729", RegularImmutableSet.a); } public final TriState m10035g() { return TriState.NO; } public final String m10033a(String str) { switch (str.hashCode()) { case -2123990406: return "31"; case -2111250185: return "70"; case -2069553567: return "107"; case -2018573478: return "114"; case -1966188374: return "52"; case -1849402738: return "10"; case -1831222590: return "110"; case -1780769805: return "19"; case -1778558196: return "47"; case -1777441434: return "55"; case -1773565470: return "33"; case -1745741354: return "18"; case -1718813234: return "127"; case -1701012587: return "1"; case -1700233621: return "29"; case -1663499699: return "42"; case -1651445858: return "85"; case -1547457328: return "24"; case -1469598440: return "32"; case -1460262781: return "129"; case -1441879856: return "91"; case -1397293948: return "54"; case -1391624807: return "93"; case -1369016405: return "2"; case -1363693170: return "57"; case -1362584798: return "80"; case -1333184300: return "76"; case -1332962213: return "105"; case -1332654029: return "103"; case -1284189600: return "113"; case -1284099636: return "61"; case -1164126817: return "3"; case -1150725321: return "17"; case -1116221284: return "72"; case -1109830290: return "68"; case -1101600581: return "8"; case -1091844130: return "82"; case -1080181817: return "92"; case -1012194872: return "64"; case -986526968: return "115"; case -971327749: return "100"; case -969292942: return "99"; case -945993139: return "62"; case -817257615: return "48"; case -803442217: return "87"; case -799736697: return "83"; case -790388762: return "53"; case -783752827: return "96"; case -769681656: return "6"; case -680727674: return "63"; case -631654088: return "13"; case -621921156: return "86"; case -561505403: return "21"; case -538773735: return "46"; case -493674687: return "84"; case -461877888: return "43"; case -442704260: return "79"; case -378761310: return "106"; case -317710003: return "45"; case -291906585: return "119"; case -217290325: return "112"; case -164645908: return "108"; case -164083748: return "118"; case -154818044: return "35"; case -113788560: return "60"; case -92787706: return "15"; case -19268531: return "78"; case -16226492: return "58"; case -11314776: return "95"; case 13780415: return "4"; case 20000209: return "117"; case 25209764: return "0"; case 41001321: return "128"; case 78777218: return "5"; case 109250890: return "30"; case 169846802: return "16"; case 169997180: return "124"; case 293932680: return "102"; case 297456968: return "66"; case 355809903: return "75"; case 388662790: return "111"; case 421050507: return "34"; case 447915951: return "77"; case 485031261: return "109"; case 557908192: return "44"; case 580042479: return "20"; case 609122022: return "12"; case 613692368: return "74"; case 651215103: return "22"; case 656444234: return "126"; case 689802720: return "25"; case 692733304: return "98"; case 721571967: return "88"; case 774983793: return "59"; case 797640206: return "51"; case 810737919: return "37"; case 825224060: return "67"; case 860214447: return "97"; case 899150587: return "71"; case 943726811: return "89"; case 996172250: return "36"; case 1028378801: return "121"; case 1037267417: return "104"; case 1091074225: return "101"; case 1108260124: return "28"; case 1139691781: return "130"; case 1145249444: return "81"; case 1162067831: return "94"; case 1262925297: return "38"; case 1282232523: return "39"; case 1408059794: return "122"; case 1414179291: return "116"; case 1417678934: return "90"; case 1420616515: return "125"; case 1423926404: return "56"; case 1520778617: return "65"; case 1585010628: return "23"; case 1598177384: return "9"; case 1639748947: return "40"; case 1642411190: return "123"; case 1673542407: return "14"; case 1675091374: return "120"; case 1827871700: return "27"; case 1831224761: return "41"; case 1896402612: return "69"; case 1911442659: return "50"; case 1939875509: return "11"; case 1963391292: return "49"; case 2024508229: return "73"; case 2059544769: return "26"; case 2107106619: return "7"; default: return str; } } protected final boolean m10034a(String str, Object obj) { boolean z = true; switch (str.hashCode()) { case 1601: if (str.equals("23")) { z = true; break; } break; case 1630: if (str.equals("31")) { z = true; break; } break; case 1631: if (str.equals("32")) { z = true; break; } break; case 1636: if (str.equals("37")) { z = false; break; } break; case 1728: if (str.equals("66")) { z = true; break; } break; case 1759: if (str.equals("76")) { z = true; break; } break; case 1784: if (str.equals("80")) { z = true; break; } break; case 1787: if (str.equals("83")) { z = true; break; } break; case 1790: if (str.equals("86")) { z = true; break; } break; case 1793: if (str.equals("89")) { z = true; break; } break; case 48694: if (str.equals("127")) { z = true; break; } break; case 48695: if (str.equals("128")) { z = true; break; } break; } switch (z) { case false: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; case true: if (obj instanceof String) { return "false".equals(obj); } if (!(obj instanceof Boolean)) { return false; } if (((Boolean) obj).booleanValue()) { return false; } return true; default: return false; } } }
[ "son.pham@jmango360.com" ]
son.pham@jmango360.com
b99c55b072e2bea4542b2d168bb1c11d1fdd94aa
6b9b7f9abcdb400bd258a7d5f09cced3c97a36f1
/lol/lol/src/report/youngha/r0009/MapExam2.java
735d28ece5341326dcf8f90240c473e6e2cac597
[]
no_license
younghaa/lol
20bf8a0457eaaac875fcf69c0b3ed1a9497f05a4
20880b6f9fb86feb2634b28a39939d5262923253
refs/heads/master
2020-12-03T09:22:52.134495
2017-08-22T09:39:21
2017-08-22T09:39:21
95,615,989
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package report.youngha.r0009; import java.util.HashMap; import report.youngha.r0009.MapExam2; public class MapExam2 { HashMap<String,Integer> hm; MapExam2() { hm = new HashMap<String,Integer>(); } public static void main(String[] args) { MapExam2 me = new MapExam2(); me.hm.put("1", 1); } }
[ "joug0584@naver.com" ]
joug0584@naver.com
6bf2b2898040827ca53b093952412ab0be301523
6dd795822de8167582dd5d96ea25aab908e0503a
/chapter10/complete/src/test/java/darr/mirr/utils/testrunner_helpers/parallel_computer/ExecutorsFactory.java
64216b8085c0fe7a86df8aa2c2b7108d6f877137
[]
no_license
DarrMirr/autotest-story
801ea438bf751e91afc1da4b4958f8e66333fcbb
73afca4039dc6912393a6c8d00430ff4558d6296
refs/heads/master
2020-05-21T16:12:17.049795
2019-05-24T06:14:45
2019-05-24T06:14:45
186,108,155
0
0
null
2019-11-13T10:14:11
2019-05-11T08:35:52
Java
UTF-8
Java
false
false
1,266
java
package darr.mirr.utils.testrunner_helpers.parallel_computer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static darr.mirr.data.SystemProperties.THREAD_COUNT; /** * Created by Pol Mir on 30.09.17. * * Получение ThreadPool executor */ public class ExecutorsFactory { private static final Logger logger = LoggerFactory.getLogger(ExecutorsFactory.class); private ExecutorsFactory() { } public static ExecutorService getFixedThreadPool(int threadCount) { return Executors.newFixedThreadPool(threadCount); } public static ExecutorService getFixedThreadPool() { int threadCount = getThreadCount(); return getFixedThreadPool(threadCount); } private static int getThreadCount() { int thread_count = Runtime.getRuntime().availableProcessors() * 2; if (THREAD_COUNT != null) { int thread_count_param = Integer.valueOf(THREAD_COUNT); if (thread_count_param > 0) { thread_count = thread_count_param; } } logger.debug("Количество потоков : {}", thread_count); return thread_count; } }
[ "polukeev.v.s@yandex.ru" ]
polukeev.v.s@yandex.ru
91efc1a7c1f67c6ffb7e90b60ef56992e7e627e3
e7480a9275ed534c4f44c8bc01755a341c62bb71
/InspirationRewards/app/src/main/java/com/yizheng/inspirationrewards/AwardActivity.java
0be7aad82d984a5fda9fce97ffe38175761d44b9
[]
no_license
davidzhengcs/inspiration
a36d696fc4427716b340f2835b8d2e7010bd2f63
23b4a4852a03f209c522afca88063c6f7f3e1c37
refs/heads/main
2022-12-30T19:03:58.051275
2020-10-11T19:08:22
2020-10-11T19:08:22
303,193,018
0
1
null
null
null
null
UTF-8
Java
false
false
5,092
java
package com.yizheng.inspirationrewards; import androidx.appcompat.app.AppCompatActivity; import android.app.AlertDialog; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; import android.util.Base64; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import static com.yizheng.inspirationrewards.CommonInfo.makeCustomToast; public class AwardActivity extends AppCompatActivity { private TextView nameTxt, pointsAwarded, dept, pos, story; private EditText pointsToSend, comment; private ImageView imageView; private Profile sender, receiver; private final static int MAX_LEN = 80; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_award); Intent intent = getIntent(); if (intent.hasExtra("sender")){ sender = (Profile) intent.getSerializableExtra("sender"); } if (intent.hasExtra("receiver")){ receiver = (Profile) intent.getSerializableExtra("receiver"); } nameTxt = findViewById(R.id.textView25); pointsAwarded = findViewById(R.id.textView27); dept = findViewById(R.id.textView29); pos = findViewById(R.id.textView31); story = findViewById(R.id.textView33); nameTxt.setText(receiver.getLastname()+", "+receiver.getFirstname()); pointsAwarded.setText(new Integer(receiver.totalPointsAwarded()).toString()); dept.setText(receiver.getDepartment()); pos.setText(receiver.getPosition()); story.setText(receiver.getStory()); imageView = findViewById(R.id.imageView8); doConvert(receiver.getPhoto()); pointsToSend = findViewById(R.id.editText10); comment = findViewById(R.id.editText9); setupTextView(); } private void setupTextView() { EditText editText = findViewById(R.id.editText9); editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(MAX_LEN) }); editText.addTextChangedListener( new TextWatcher() { @Override public void afterTextChanged(Editable s) { int len = s.toString().length(); String countText = "Comment: (" + len + " of " + MAX_LEN + ")"; ((TextView) findViewById(R.id.textView35)).setText(countText); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } }); } private void doConvert(String imgString) { byte[] imageBytes = Base64.decode(imgString, Base64.DEFAULT); //Log.d(TAG, "doConvert: Image byte array length: " + imgString.length()); Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length); //Log.d(TAG, "doConvert: Bitmap created from Base 64 text"); imageView.setImageBitmap(bitmap); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.create_profile_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { String pointsString = pointsToSend.getText().toString(); int points = Integer.valueOf(pointsString); if (!sender.hasEnough(points)){ makeCustomToast(this, "Insufficient Points", Toast.LENGTH_LONG); return true; } String commentString = comment.getText().toString(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(R.drawable.logo); builder.setPositiveButton("OK", (dialog, id) -> { addRewards(points, commentString); }); builder.setNegativeButton("CANCEL", (dialog, id) -> { }); builder.setTitle("Save Changes?"); AlertDialog dialog = builder.create(); dialog.show(); return true; } public void processResult(String s){ if (s.startsWith("Error")) { makeCustomToast(this, s, Toast.LENGTH_LONG); return; } Intent intent = new Intent(this, LeaderboardActivity.class); setResult(RESULT_OK, intent); finish(); return; } private void addRewards(int points, String commentString){ new AwardAsyncTask(this, commentString, points).execute(sender, receiver); } }
[ "noreply@github.com" ]
davidzhengcs.noreply@github.com
c053a1a9990eeaa61d242559e3fd2032b2d618ed
b49d56ae4b22eba2f5b04b7f16b6db8d18022fe8
/VehicleRegistration/src/main/java/com/appzoneltd/lastmile/microservice/vehicleregistration/TokenServiceConfiguration.java
8c4faf7ab456a6f5ff615a12db946f51b250beaa
[]
no_license
hashish93/last-mile-backend
15259d7bbeadcf6c1b10fde4917279cd208b30cf
b15f29ac6aea277941b386e7ba8019d0ecf206ab
refs/heads/master
2020-04-07T14:31:54.409913
2018-11-20T21:15:09
2018-11-20T21:15:09
158,450,997
0
1
null
null
null
null
UTF-8
Java
false
false
956
java
package com.appzoneltd.lastmile.microservice.vehicleregistration; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.oauth2.provider.token.RemoteTokenServices; @Configuration public class TokenServiceConfiguration { @Value("${oauth2.tokenServiceEndpointUrl}") private String tokenServiceEndpointUrl; @Value("${oauth2.clientId}") private String clientId; @Value("${oauth2.clientSecret}") private String clientSecret; @Bean public RemoteTokenServices tokenService() { RemoteTokenServices tokenService = new RemoteTokenServices(); tokenService.setCheckTokenEndpointUrl( tokenServiceEndpointUrl); tokenService.setClientId(clientId); tokenService.setClientSecret(clientSecret); return tokenService; } }
[ "m.hashish93@gmail.com" ]
m.hashish93@gmail.com
5fa0cf8f1628fc9f21889a8c27b696e2bd81b99c
7d3024b61305dfa08c7244f20756ab5b90eadd05
/ShopKeepers/app/src/main/java/com/example/shopkeepers/CustomerName_entry_Popup.java
705831a3f113d642a2811f17f62e68df930e965d
[]
no_license
MinhazBicon/ShopKeepers_Payment_Due_list
f3539a9ca4212500450fe2b5bca1873f6e7e24dc
a789f7b94fda8889296a52c35510a2c51af28cf8
refs/heads/master
2022-11-23T04:05:32.860329
2020-07-28T05:06:03
2020-07-28T05:06:03
276,439,148
0
0
null
null
null
null
UTF-8
Java
false
false
2,508
java
package com.example.shopkeepers; import androidx.appcompat.app.AppCompatActivity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class CustomerName_entry_Popup extends Activity { private EditText name; private Button done; MySQL_DataBase_helper mySQL_dataBase_helper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_customer_name_entry__popup); name = findViewById(R.id.Customer_Name); done = findViewById(R.id.Name_submit_btn); // PopUp Window Work DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int width = displayMetrics.widthPixels; int height = displayMetrics.heightPixels; // getWindow().setBackgroundDrawableResource(flag); getWindow().setLayout((int) (width*.7),(int) (height*.29)); //setting the Popup window position WindowManager.LayoutParams params = getWindow().getAttributes(); params.gravity = Gravity.CENTER; params.x = 0; params.y = -80; getWindow().setAttributes(params); mySQL_dataBase_helper= new MySQL_DataBase_helper(this); done.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String Name = name.getText().toString(); if(Name.isEmpty()){ Toast.makeText(getApplicationContext(),"Please enter the name",Toast.LENGTH_SHORT).show(); }else { try { mySQL_dataBase_helper.Customer_Details_Name_Insertion(Name,"0"); Toast.makeText(getApplicationContext(),"Customer added successful",Toast.LENGTH_SHORT).show(); startActivity(new Intent(CustomerName_entry_Popup.this,Customer_List_Activity.class)); finish(); }catch (Exception e){ e.getStackTrace(); Toast.makeText(getApplicationContext(),"Customer added failed",Toast.LENGTH_SHORT).show(); } } } }); } }
[ "minhazu.alam142@northsouth.edu" ]
minhazu.alam142@northsouth.edu
0fe731583323f8d093adf0132357683ec7e009a2
fddcb503d557ba999df90e363c622cb9ac760b48
/src/com/TermProject/EbookReader/Main_activity.java
60f3c48d9e3eae3b1089232aa6792f9ddb62239d
[]
no_license
sultanoid/Ebook_Reader
a91cca37d30017ee847cf1a91f417337a0a0dd07
2483eec855f7b186a179a955686d5de047662b85
refs/heads/master
2022-04-29T03:16:07.521999
2020-04-24T13:25:22
2020-04-24T13:25:22
258,518,388
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.TermProject.EbookReader; import android.app.Activity; public class Main_activity extends Activity { // public static final String Reader_Preferences = "Reader_Preferences"; public static final String APP_PREFERENCES = "AppPrefs"; public static final String LAST_READ = "BOOK_NAME_OF_LAST_READ"; }
[ "sultan.ahmed.sagor@gmail.com" ]
sultan.ahmed.sagor@gmail.com
093479e632a4e60122cecd9ab8d348318f4bf76c
78f8919425e3d282cef9f36780a731a21ea0a066
/app/models/internal/scheduling/Job.java
dadd318541a7fbe80a1bdaeaa2202353c6e5cd1c
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
swhite-at-smartsheet/metrics-portal
7ad66628a9982b943820f6153b87370b0f049d93
d02c6a7c5575c4cc4fcada7bb66b952cfef4025f
refs/heads/master
2020-04-22T13:27:56.871944
2019-02-09T00:16:32
2019-02-09T00:16:32
170,410,528
0
0
null
2019-04-29T20:49:35
2019-02-13T00:02:31
Java
UTF-8
Java
false
false
2,002
java
/* * Copyright 2018 Dropbox, 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. */ package models.internal.scheduling; import akka.actor.ActorRef; import com.arpnetworking.metrics.portal.scheduling.Schedule; import java.time.Instant; import java.util.UUID; import java.util.concurrent.CompletionStage; /** * A (possibly recurring) job describing a task to perform and how often to repeat. * * @param <T> The type of result the Job computes. * * @author Spencer Pearson (spencerpearson at dropbox dot com) */ public interface Job<T> { /** * The unique identifier of the job. * * @return The UUID. */ UUID getId(); /** * Gets an <a href="https://en.wikipedia.org/wiki/HTTP_ETag">ETag</a> that changes each time the job changes. * * @return The ETag. */ String getETag(); /** * Returns the schedule on which the Job should be repeated. * * @return The schedule. */ Schedule getSchedule(); /** * Starts a particular instant's execution of the job running. * * @param scheduler The Akka actor that's scheduling this job to be run. * @param scheduled The instant that the job is running for. (Should probably have come from {@code getSchedule().nextRun(...)}.) * @return A {@link CompletionStage} that completes with the job's result, or with the exception the job encounters (if any). */ CompletionStage<T> execute(ActorRef scheduler, Instant scheduled); }
[ "ville@koskelafamily.com" ]
ville@koskelafamily.com
56f07434c33c9092b5f63a82c0f3760b310f66bc
f1b5080800af0b4c3a6c436bd02002682e196a1f
/app/src/main/java/org/techtown/apt_1025/MyApart/MyApartAdapter.java
1e411f18689a2935c4f34537887b3e438fdf1a21
[]
no_license
hololol-101/Apart
25d52083ab62b1e090cd1de4798734a9ce11a476
9936059919d925fdb7aea09d374b2d75704bc9b4
refs/heads/master
2023-06-12T06:01:10.650251
2021-07-12T04:26:19
2021-07-12T04:26:19
385,124,096
0
0
null
null
null
null
UTF-8
Java
false
false
4,376
java
package org.techtown.apt_1025.MyApart; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import org.techtown.apt_1025.KActivity.ChangeLikes; import org.techtown.apt_1025.KActivity.DeleteStore; import org.techtown.apt_1025.KActivity.DetailInfoActivity; import org.techtown.apt_1025.KNetwork.SerialApartInfo; import org.techtown.apt_1025.R; import java.util.List; public class MyApartAdapter extends RecyclerView.Adapter<MyApartAdapter.ViewHolder> { private Context context; private List<SerialApartInfo.ApartRecommend> apartList; private int u_id; private OnItemClickListener onItemClickListener; View v; public interface OnItemClickListener{ void onDeleteClick(int position); } public MyApartAdapter(Context context, List<SerialApartInfo.ApartRecommend> apartList, int u_id) { this.context = context; this.apartList = apartList; this.u_id = u_id; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { v = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_item, parent, false); MyApartAdapter.ViewHolder evh = new MyApartAdapter.ViewHolder(v); return evh; } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { SerialApartInfo.ApartRecommend d=apartList.get(position); Log.d("위치" , d.apt_location); holder.total_address.setText(d.apt_location); holder.apart_name.setText(d.apt_name); String ar = d.area; for(int i = 0; i<ar.length();i++){ if(ar.charAt(i)==46){ if((ar.length()-i)>2) ar = ar.substring(0,i+3); } } holder.area.setText(ar+"m2"); holder.year_built.setText(d.builtyear); if(d.scale.equals("0")) holder.scale.setText("알 수 없음"); else holder.scale.setText(d.scale.split("\n")[1]); holder.a_id=d.a_id; holder.store=d.store; } @Override public long getItemId(int i) { return i; } @Override public int getItemCount() { return apartList.size(); } public void setOnItemClickListener(OnItemClickListener itemClickListener){ onItemClickListener=itemClickListener; } public class ViewHolder extends RecyclerView.ViewHolder { TextView total_address, area, scale,year_built,apart_name, deleteButton; int a_id, store; public ViewHolder(@NonNull View itemView) { super(itemView); apart_name = (TextView) itemView.findViewById(R.id.apart_name); total_address=itemView.findViewById(R.id.total_address); area = (TextView)itemView.findViewById(R.id.area); scale= (TextView)itemView.findViewById(R.id.scale); year_built = (TextView) itemView.findViewById(R.id.year_built); deleteButton = (Button) itemView.findViewById(R.id.deleteButton); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, DetailInfoActivity.class); intent.putExtra("u_id", u_id); intent.putExtra("a_id", a_id); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); v.getContext().startActivity(intent); } }); deleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (onItemClickListener != null) { int position = getAdapterPosition(); if (position != RecyclerView.NO_POSITION) { onItemClickListener.onDeleteClick(position); } } } }); } } }
[ "gkrbs1010" ]
gkrbs1010
00d1971e276be0a64b61eab8847224f4a0157552
9623f83defac3911b4780bc408634c078da73387
/powercraft/temp/src/minecraft/net/minecraft/src/StatFileWriter.java
bf0c2fab33f2ea979c6b64bc021972260edc8241
[]
no_license
BlearStudio/powercraft-legacy
42b839393223494748e8b5d05acdaf59f18bd6c6
014e9d4d71bd99823cf63d4fbdb65c1b83fde1f8
refs/heads/master
2021-01-21T21:18:55.774908
2015-04-06T20:45:25
2015-04-06T20:45:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,337
java
package net.minecraft.src; import argo.jdom.JdomParser; import argo.jdom.JsonNode; import argo.jdom.JsonRootNode; import argo.jdom.JsonStringNode; import argo.saj.InvalidSyntaxException; import cpw.mods.fml.common.Side; import cpw.mods.fml.common.asm.SideOnly; import java.io.File; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.minecraft.src.Achievement; import net.minecraft.src.MD5String; import net.minecraft.src.Session; import net.minecraft.src.StatBase; import net.minecraft.src.StatList; import net.minecraft.src.StatsSyncher; @SideOnly(Side.CLIENT) public class StatFileWriter { private Map field_77457_a = new HashMap(); private Map field_77455_b = new HashMap(); private boolean field_77456_c = false; private StatsSyncher field_77454_d; public StatFileWriter(Session p_i3218_1_, File p_i3218_2_) { File var3 = new File(p_i3218_2_, "stats"); if(!var3.exists()) { var3.mkdir(); } File[] var4 = p_i3218_2_.listFiles(); int var5 = var4.length; for(int var6 = 0; var6 < var5; ++var6) { File var7 = var4[var6]; if(var7.getName().startsWith("stats_") && var7.getName().endsWith(".dat")) { File var8 = new File(var3, var7.getName()); if(!var8.exists()) { System.out.println("Relocating " + var7.getName()); var7.renameTo(var8); } } } this.field_77454_d = new StatsSyncher(p_i3218_1_, this, var3); } public void func_77450_a(StatBase p_77450_1_, int p_77450_2_) { this.func_77451_a(this.field_77455_b, p_77450_1_, p_77450_2_); this.func_77451_a(this.field_77457_a, p_77450_1_, p_77450_2_); this.field_77456_c = true; } private void func_77451_a(Map p_77451_1_, StatBase p_77451_2_, int p_77451_3_) { Integer var4 = (Integer)p_77451_1_.get(p_77451_2_); int var5 = var4 == null?0:var4.intValue(); p_77451_1_.put(p_77451_2_, Integer.valueOf(var5 + p_77451_3_)); } public Map func_77445_b() { return new HashMap(this.field_77455_b); } public void func_77447_a(Map p_77447_1_) { if(p_77447_1_ != null) { this.field_77456_c = true; Iterator var2 = p_77447_1_.keySet().iterator(); while(var2.hasNext()) { StatBase var3 = (StatBase)var2.next(); this.func_77451_a(this.field_77455_b, var3, ((Integer)p_77447_1_.get(var3)).intValue()); this.func_77451_a(this.field_77457_a, var3, ((Integer)p_77447_1_.get(var3)).intValue()); } } } public void func_77452_b(Map p_77452_1_) { if(p_77452_1_ != null) { Iterator var2 = p_77452_1_.keySet().iterator(); while(var2.hasNext()) { StatBase var3 = (StatBase)var2.next(); Integer var4 = (Integer)this.field_77455_b.get(var3); int var5 = var4 == null?0:var4.intValue(); this.field_77457_a.put(var3, Integer.valueOf(((Integer)p_77452_1_.get(var3)).intValue() + var5)); } } } public void func_77448_c(Map p_77448_1_) { if(p_77448_1_ != null) { this.field_77456_c = true; Iterator var2 = p_77448_1_.keySet().iterator(); while(var2.hasNext()) { StatBase var3 = (StatBase)var2.next(); this.func_77451_a(this.field_77455_b, var3, ((Integer)p_77448_1_.get(var3)).intValue()); } } } public static Map func_77453_b(String p_77453_0_) { HashMap var1 = new HashMap(); try { String var2 = "local"; StringBuilder var3 = new StringBuilder(); JsonRootNode var4 = (new JdomParser()).parse(p_77453_0_); List var5 = var4.getArrayNode(new Object[]{"stats-change"}); Iterator var6 = var5.iterator(); while(var6.hasNext()) { JsonNode var7 = (JsonNode)var6.next(); Map var8 = var7.getFields(); Entry var9 = (Entry)var8.entrySet().iterator().next(); int var10 = Integer.parseInt(((JsonStringNode)var9.getKey()).getText()); int var11 = Integer.parseInt(((JsonNode)var9.getValue()).getText()); StatBase var12 = StatList.func_75923_a(var10); if(var12 == null) { System.out.println(var10 + " is not a valid stat"); } else { var3.append(StatList.func_75923_a(var10).field_75973_g).append(","); var3.append(var11).append(","); var1.put(var12, Integer.valueOf(var11)); } } MD5String var14 = new MD5String(var2); String var15 = var14.func_75899_a(var3.toString()); if(!var15.equals(var4.getStringValue(new Object[]{"checksum"}))) { System.out.println("CHECKSUM MISMATCH"); return null; } } catch (InvalidSyntaxException var13) { var13.printStackTrace(); } return var1; } public static String func_77441_a(String p_77441_0_, String p_77441_1_, Map p_77441_2_) { StringBuilder var3 = new StringBuilder(); StringBuilder var4 = new StringBuilder(); boolean var5 = true; var3.append("{\r\n"); if(p_77441_0_ != null && p_77441_1_ != null) { var3.append(" \"user\":{\r\n"); var3.append(" \"name\":\"").append(p_77441_0_).append("\",\r\n"); var3.append(" \"sessionid\":\"").append(p_77441_1_).append("\"\r\n"); var3.append(" },\r\n"); } var3.append(" \"stats-change\":["); Iterator var6 = p_77441_2_.keySet().iterator(); while(var6.hasNext()) { StatBase var7 = (StatBase)var6.next(); if(var5) { var5 = false; } else { var3.append("},"); } var3.append("\r\n {\"").append(var7.field_75975_e).append("\":").append(p_77441_2_.get(var7)); var4.append(var7.field_75973_g).append(","); var4.append(p_77441_2_.get(var7)).append(","); } if(!var5) { var3.append("}"); } MD5String var8 = new MD5String(p_77441_1_); var3.append("\r\n ],\r\n"); var3.append(" \"checksum\":\"").append(var8.func_75899_a(var4.toString())).append("\"\r\n"); var3.append("}"); return var3.toString(); } public boolean func_77443_a(Achievement p_77443_1_) { return this.field_77457_a.containsKey(p_77443_1_); } public boolean func_77442_b(Achievement p_77442_1_) { return p_77442_1_.field_75992_c == null || this.func_77443_a(p_77442_1_.field_75992_c); } public int func_77444_a(StatBase p_77444_1_) { Integer var2 = (Integer)this.field_77457_a.get(p_77444_1_); return var2 == null?0:var2.intValue(); } public void func_77446_d() { this.field_77454_d.func_77420_c(this.func_77445_b()); } public void func_77449_e() { if(this.field_77456_c && this.field_77454_d.func_77425_c()) { this.field_77454_d.func_77418_a(this.func_77445_b()); } this.field_77454_d.func_77422_e(); } }
[ "nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c" ]
nils.h.emmerich@gmail.com@ed9f5d1b-00bb-0f29-faab-e8ebad1a710c
32e54cb3c7a4f09d61472b054e5551f461c030c6
92990342355cf7f8bcc24fcce6346a54ff423e1b
/commons/src/at/illecker/storm/commons/dict/SlangCorrection.java
9f6fdd42167dff9d76c15f205ff84789e2763e3f
[ "Apache-2.0" ]
permissive
ShuhaoZhangTony/storm-apps
5fd32f690fee218ebea5b99b1b0c5eb544e3fb57
3a2b921a7c4bf9676d71f10534228586e205bfa6
refs/heads/master
2021-05-29T06:40:31.622700
2015-04-08T12:49:40
2015-04-08T12:49:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,893
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package at.illecker.storm.commons.dict; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.illecker.storm.commons.Configuration; import at.illecker.storm.commons.util.io.FileUtils; public class SlangCorrection { private static final Logger LOG = LoggerFactory .getLogger(SlangCorrection.class); private static final SlangCorrection INSTANCE = new SlangCorrection(); private Map<String, String[]> m_slangWordList = new HashMap<String, String[]>(); private SlangCorrection() { List<Map> slangWordLists = Configuration.getSlangWordlists(); for (Map slangWordListEntry : slangWordLists) { String file = (String) slangWordListEntry.get("path"); String separator = (String) slangWordListEntry.get("delimiter"); boolean isEnabled = (Boolean) slangWordListEntry.get("enabled"); if (isEnabled) { LOG.info("Load SlangLookupTable from: " + file); Map<String, String> slangWordList = FileUtils.readFile(file, separator); for (Map.Entry<String, String> entry : slangWordList.entrySet()) { if (!m_slangWordList.containsKey(entry.getKey())) { m_slangWordList.put(entry.getKey(), entry.getValue().split(" ")); } } } } } public static SlangCorrection getInstance() { return INSTANCE; } public String[] getCorrection(String token) { // LOG.info("getCorrection('" + token + "'): " // + Arrays.toString(m_slangWordList.get(token))); return m_slangWordList.get(token); } public static void main(String[] args) { SlangCorrection slangCorrection = SlangCorrection.getInstance(); // test testSlangCorrection String[] testSlangCorrection = new String[] { "afaik", "cum", "w/", "Fri", "fri", "Sat", "sat", "Sun", "sun", "U.S.", "U.K." }; for (String s : testSlangCorrection) { System.out.println("slang correction of '" + s + "': '" + Arrays.toString(slangCorrection.getCorrection(s)) + "'"); } } }
[ "martin.illecker@gmail.com" ]
martin.illecker@gmail.com
63980f3a32c9c0ec9cf7c284355471d379a3c803
1d5ab8ee741f4d28370db12f1e725ddcfb14ae29
/garden/livetribe-slp/tags/2.1.1/core/src/main/java/org/livetribe/slp/spi/AttrRplyPerformer.java
ceb10c4657064d3f13d2026bda979aa270c2d74f
[ "Apache-2.0" ]
permissive
codehaus/livetribe
5dfec6bef4c5a5687ed8edc5a8e80e1622a41f7a
9742f427717f321d7a2101d5f62f4394b00a0362
refs/heads/master
2023-07-20T01:31:46.001231
2011-06-23T07:35:06
2011-06-23T07:35:06
36,526,523
0
0
null
null
null
null
UTF-8
Java
false
false
1,859
java
/* * Copyright 2008-2008 the original author or authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.livetribe.slp.spi; import org.livetribe.slp.Attributes; import org.livetribe.slp.SLPError; import org.livetribe.slp.spi.msg.AttrRply; import org.livetribe.slp.spi.msg.Message; /** * @version $Revision$ $Date$ */ public class AttrRplyPerformer { protected AttrRply newAttrRply(Message message, Attributes attributes) { return newAttrRply(message, attributes, Integer.MAX_VALUE); } protected AttrRply newAttrRply(Message message, Attributes attributes, int maxLength) { AttrRply attrRply = newAttrRply(message, SLPError.NO_ERROR); attrRply.setAttributes(attributes); byte[] attrRplyBytes = attrRply.serialize(); if (attrRplyBytes.length > maxLength) { attrRply.setAttributes(Attributes.NONE); attrRply.setOverflow(true); } return attrRply; } protected AttrRply newAttrRply(Message message, SLPError error) { AttrRply attrRply = new AttrRply(); // Replies must have the same language and XID as the request (RFC 2608, 8.0) attrRply.setLanguage(message.getLanguage()); attrRply.setXID(message.getXID()); attrRply.setSLPError(error); return attrRply; } }
[ "maguro@6db1a190-aa03-0410-869d-8543fcd43261" ]
maguro@6db1a190-aa03-0410-869d-8543fcd43261
16fc0bf32865db76e6ed64e1b32417e7c0347ef6
8e5ef78b85c8b36340816b0221bcc7cbdafe56d4
/nike-riposte-integration-core-code/src/test/java/com/undefinedlabs/nikeriposteintegration/componenttest/VerifyBasicAuthIsConfiguredCorrectlyComponentTest.java
67999e1a8bd258568333c2ec6d23a0da68f71fdc
[ "Apache-2.0" ]
permissive
scope-demo/scope-demo-riposte
2508d6ba3a5e83e79c8014a3a43e513a145d669f
d3bc2f2b01a5d939f7017ef12cfcccd7b8e9e0bf
refs/heads/master
2020-07-31T09:33:16.712357
2020-04-03T07:21:03
2020-04-03T07:21:03
210,561,513
0
0
Apache-2.0
2020-03-12T15:00:11
2019-09-24T09:16:53
Java
UTF-8
Java
false
false
3,836
java
package com.undefinedlabs.nikeriposteintegration.componenttest; import com.nike.backstopper.apierror.sample.SampleCoreApiError; import com.nike.internal.util.Pair; import com.nike.riposte.server.Server; import com.undefinedlabs.nikeriposteintegration.endpoints.ExampleBasicAuthProtectedEndpoint; import com.undefinedlabs.nikeriposteintegration.testutils.TestUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import java.util.Base64; import io.netty.util.CharsetUtil; import io.restassured.response.ExtractableResponse; import static com.undefinedlabs.nikeriposteintegration.testutils.TestUtils.verifyExpectedError; import static io.netty.handler.codec.http.HttpHeaderNames.AUTHORIZATION; import static io.restassured.RestAssured.given; /** * Component test that verifies the basic auth security is configured correctly on the server. * * <p>TODO: EXAMPLE CLEANUP - If your app does not use any security validation (e.g. basic auth for the examples) then * you can delete this class entirely. If you do use security validation then you'll want to adjust these tests * to tests your real endpoint security rather than the example stuff. * * @author Nic Munroe */ public class VerifyBasicAuthIsConfiguredCorrectlyComponentTest { private static Server realRunningServer; private static TestUtils.AppServerConfigForTesting serverConfig; private static String basicAuthHeaderValueRequired; @BeforeClass public static void setup() throws Exception { Pair<Server, TestUtils.AppServerConfigForTesting> serverAndConfigPair = TestUtils.createServerForTesting(); serverConfig = serverAndConfigPair.getRight(); realRunningServer = serverAndConfigPair.getLeft(); realRunningServer.startup(); String basicAuthUsername = serverConfig.getTestingAppConfig().getString("exampleBasicAuth.username"); String basicAuthPassword = serverConfig.getTestingAppConfig().getString("exampleBasicAuth.password"); basicAuthHeaderValueRequired = "Basic " + Base64.getEncoder().encodeToString( (basicAuthUsername + ":" + basicAuthPassword).getBytes(CharsetUtil.UTF_8) ); } @AfterClass public static void teardown() throws Exception { realRunningServer.shutdown(); } @Test public void endpoint_call_should_work_with_valid_basic_auth_header() { given() .baseUri("http://localhost") .port(serverConfig.endpointsPort()) .header(AUTHORIZATION.toString(), basicAuthHeaderValueRequired) .log().all() .when() .basePath(ExampleBasicAuthProtectedEndpoint.MATCHING_PATH) .post() .then() .log().all() .statusCode(201); } @Test public void endpoint_call_should_fail_with_invalid_basic_auth_header() { ExtractableResponse response = given() .baseUri("http://localhost") .port(serverConfig.endpointsPort()) .header(AUTHORIZATION.toString(), "foo" + basicAuthHeaderValueRequired) .log().all() .when() .basePath(ExampleBasicAuthProtectedEndpoint.MATCHING_PATH) .post() .then() .log().all() .extract(); verifyExpectedError(response, SampleCoreApiError.UNAUTHORIZED); } @Test public void healthcheck_call_should_not_require_basic_auth() { given() .baseUri("http://localhost") .port(serverConfig.endpointsPort()) .log().all() .when() .basePath("/healthcheck") .get() .then() .log().all() .statusCode(200) .extract().asString(); } }
[ "daniel.rguez.hdez.github@gmail.com" ]
daniel.rguez.hdez.github@gmail.com
8498d621714cce841928c3d72808bba7540eaa46
fc6d3d31657f4248e2de17d64856f7f0612a96f3
/app/src/main/java/com/lewis/broadcastbestpractice/LoginActivity.java
1d6900d40032f6503e29347d52ee45dd43e7881d
[]
no_license
LewisJoe/BroadcastBestPractice
ae3865a09dcb8ca394f211f5c32d844db9234006
8d763fd49913734b1ef22ae2075466d8fff81868
refs/heads/master
2021-01-22T17:14:13.101932
2015-09-17T02:13:55
2015-09-17T02:13:55
41,289,822
0
0
null
null
null
null
UTF-8
Java
false
false
2,792
java
package com.lewis.broadcastbestpractice; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Toast; /** * 登录活动界面 * Created by Administrator on 15-8-24. */ public class LoginActivity extends BaseActivity{ private SharedPreferences pref; private SharedPreferences.Editor editor; private CheckBox rememberPass; private EditText accountEdit; private EditText passwordEdit; private Button login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); pref = PreferenceManager.getDefaultSharedPreferences(this); accountEdit = (EditText)findViewById(R.id.account); passwordEdit = (EditText) findViewById(R.id.password); rememberPass = (CheckBox) findViewById(R.id.remember_pass); login = (Button) findViewById(R.id.login); boolean isRemember = pref.getBoolean("remember_password",false); if (isRemember){ //将账号和密码都设置到文本框中 String account = pref.getString("account",""); String password = pref.getString("password",""); accountEdit.setText(account); passwordEdit.setText(password); rememberPass.setChecked(true); } login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String account = accountEdit.getText().toString(); String password = passwordEdit.getText().toString(); //如果账户是admin并且密码是123456,就认为登录成功 if (account.equals("admin") && password.equals("123456")){ editor = pref.edit(); if (rememberPass.isChecked()){//检查复选框是否被选中 editor.putBoolean("remember_password",true); editor.putString("account",account); editor.putString("password",password); }else { editor.clear(); } editor.commit(); Intent intent = new Intent(LoginActivity.this,MainActivity.class); startActivity(intent); finish(); }else { Toast.makeText(LoginActivity.this,"account or password is invalid", Toast.LENGTH_SHORT).show(); } } }); } }
[ "zhouy0131@gmail.com" ]
zhouy0131@gmail.com
dec9545d3e091fbf98df3bf4f1820f8e4c1fceed
ce8bfeb62a94af88553e5239cb66dd2a818803e1
/app/src/main/java/com/meishe/yangquan/bean/FeedGoodsParamInfo.java
88d36cce6ae207a4c9036b7408812326275fe581
[]
no_license
liupanfeng/YangQuanClien
97c7040bfaf3fe5954a4ec531a867a03c0b018a0
3bfdbbbf3f5f07fe86e86296bb4b900104a8de69
refs/heads/master
2021-06-23T01:44:50.776778
2021-06-09T07:00:06
2021-06-09T07:00:06
215,986,356
1
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.meishe.yangquan.bean; /** * * @Author : LiuPanFeng * @CreateDate : 2021/3/16 16:50 * @Description : 订单商品paramInfo */ public class FeedGoodsParamInfo { // "goodsId": 3, // "amount": 1 private int goodsId; private int amount; public int getGoodsId() { return goodsId; } public void setGoodsId(int goodsId) { this.goodsId = goodsId; } public int getAmount() { return amount; } public void setAmount(int amount) { this.amount = amount; } }
[ "569307092@qq.com" ]
569307092@qq.com
a80a6182414793ce04bdba22d7fb8ad25c4e5a45
d09f9e40995836ef8c50bb6a4a4321504ab6ca0c
/localfileselectionlibrary/src/main/java/com/gkpoter/localfileselectionlibrary/impl/SelectionVideoImpl.java
86f769b9e78e261072791e2cebe0102cd51a2b6f
[]
no_license
BoyGK/Android-File-Selection
07e80b77cdd9abfc9c4822c33f798bce329afad6
30ac2579bbc03e97fdbdb13ad72233b01b5e9034
refs/heads/master
2020-06-13T01:29:45.411167
2019-09-28T11:59:56
2019-09-28T11:59:56
194,488,534
2
0
null
null
null
null
UTF-8
Java
false
false
1,368
java
package com.gkpoter.localfileselectionlibrary.impl; import android.app.Activity; import com.gkpoter.localfileselectionlibrary.Type; import com.gkpoter.localfileselectionlibrary.base.SelectVideo; import com.gkpoter.localfileselectionlibrary.base.SimpleBase; import com.gkpoter.localfileselectionlibrary.callback.CallBack; import com.gkpoter.localfileselectionlibrary.interface_.SelectionVideo; import java.util.List; public class SelectionVideoImpl<T> extends SelectionBase<T> implements SelectionVideo<T> { public SelectionVideoImpl(Activity activity) { super(activity); } @Override public void select(CallBack<T> callBack) { setCallBack(callBack); if (Type.RETURN_TYPE.equals(SelectVideo.RETURN_TYPE_FILE)) { getActivity().getIntent().putExtra(SimpleBase.RETURN_FUNCTION, SelectVideo.RETURN_FUNCTION_GET_FILE); } else if (Type.RETURN_TYPE.equals(SelectVideo.RETURN_TYPE_PATH)) { getActivity().getIntent().putExtra(SimpleBase.RETURN_FUNCTION, SelectVideo.RETURN_FUNCTION_GET_PATH); } getActivity().startActivityForResult(SelectVideo.getIntent(), SimpleBase.REQUEST_CODE_VIDEO); } @Override public void selects(CallBack<List<T>> callBack) { setCallBack(callBack); // TODO: 2019/6/29 视频未考虑多个同时选取,可自定义添加 } }
[ "1215356195@qq.com" ]
1215356195@qq.com
64d9f2b747e0f2810e531f2870b1ce07aafe47ac
a4417ec2bcbb4764ecc5ce24896e2f27aadbcf63
/mantis-tests/src/test/java/sft/bar/mantis/tests/LoginTests.java
ec4d023824a35d6511f51a4e486bbf02fe7625df
[ "Apache-2.0" ]
permissive
crypticcat/java_sft_bar
fa9f99029c1acec7456cb5bef2080f7cbebc2b2f
2714e07b920828d7158a945dc3925d87808d30a3
refs/heads/master
2020-11-26T01:17:00.201428
2020-03-09T18:27:15
2020-03-09T18:27:15
228,918,094
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package sft.bar.mantis.tests; import org.testng.annotations.Test; import sft.bar.mantis.appmanager.HttpSession; import javax.xml.rpc.ServiceException; import java.io.IOException; import static org.testng.Assert.assertTrue; public class LoginTests extends TestBase { @Test public void testLogin() throws IOException, ServiceException { int issueId = 2442; skipIfNotFixed(issueId); HttpSession session = app.newSession(); assertTrue(session.login("administrator", "root")); assertTrue(session.isLoggedInAs("administrator")); } }
[ "87na.vi@gmail.com" ]
87na.vi@gmail.com
71e484e56b9cf1a94e877b0fca85dd59f84db6b3
04d334eed366e5ca40186129ab37f33db2f4bf03
/workspace_2013/chapter19/src/chapter19/GenericDemo2.java
e90e8506dadb24aef8dbd6df8bdeb5c8fa561794
[]
no_license
jungsoolim77/workspace_2013
318d8e05e9b347f537bad01376c9a780e47f433d
f65dbbd1dd042f7cca355cb2e754525a0f69d8dd
refs/heads/master
2021-01-23T09:11:04.031099
2017-09-06T05:01:39
2017-09-06T05:01:39
102,565,120
0
0
null
null
null
null
UTF-8
Java
false
false
135
java
package chapter19; public class GenericDemo2 { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "jlim34@calstatela.edu" ]
jlim34@calstatela.edu
c2741bff5ba08629624eee1c169bebf4c6c9d607
a5283d6191d6b069193e3f3eea8cf7e9fb1a0373
/me/superblaubeere27/minecraft/generators/entities/EntityCreeper.java
9490dd17d807d61dcbef6fc2e2a788f8822b6195
[]
no_license
gragonvlad/MinecraftCommandLibrary
59339c901de262de024288d254e70a4a7ae0b3d7
5d8f813d483ea399f981a05c51d3f14bd1e38d49
refs/heads/master
2021-06-15T07:49:56.984076
2017-02-19T13:42:10
2017-02-19T13:42:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,673
java
package me.superblaubeere27.minecraft.generators.entities; import net.minecraft.nbt.NBTTagCompound; public class EntityCreeper extends Entity { private boolean powered; private boolean ignited; private short fuse; private byte explosionRadius; @Override public NBTTagCompound writeToNBT() { NBTTagCompound tag = super.writeToNBT(); if (powered) { tag.setBoolean("powered", powered); } if (ignited) { tag.setBoolean("ignited", ignited); } if (fuse != 0) { tag.setShort("Fuse", fuse); } if (explosionRadius != 0) { tag.setByte("ExplosionRadius", explosionRadius); } return tag; } public boolean isPowered() { return powered; } public void setPowered(boolean powered) { this.powered = powered; } public boolean isIgnited() { return ignited; } public void setIgnited(boolean ignited) { this.ignited = ignited; } public short getFuse() { return fuse; } public void setFuse(short fuse) { this.fuse = fuse; } public byte getExplosionRadius() { return explosionRadius; } public void setExplosionRadius(byte explosionRadius) { this.explosionRadius = explosionRadius; } @Override public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); powered = tag.getBoolean("powered"); ignited = tag.getBoolean("ignited"); fuse = tag.getShort("Fuse"); explosionRadius = tag.getByte("ExplosionRadius"); } @Override public String toString() { return String.format("EntityCreeper [powered=%s, ignited=%s, fuse=%s, explosionRadius=%s, toString()=%s]", powered, ignited, fuse, explosionRadius, super.toString()); } @Override public String getName() { return "Creeper"; } }
[ "arschwixxa123@gmail.com" ]
arschwixxa123@gmail.com
2a56b49e67eeb7ee20a5f10a4ac3778eedf2a3ac
5d05dde26208ce26c0559ca5898e925e840b260a
/src/main/java/cn/ideacs/business/wx/learn/utils/HttpUtil.java
2917d58cc88ec8fa1033bf3ce7d88220068d7249
[]
no_license
zgsoft0happy/wx-learn
68d0d2c53a3ddda215e2f8d12f247cc32e915156
d2987c2ece943780b179dbcd531f64f51e90a158
refs/heads/master
2023-05-24T18:28:21.949132
2023-02-07T03:21:29
2023-02-07T03:21:29
170,097,598
0
0
null
2023-05-23T20:11:07
2019-02-11T08:58:20
Java
UTF-8
Java
false
false
70
java
package cn.ideacs.business.wx.learn.utils; public class HttpUtil { }
[ "zgsoft_happy@126.com" ]
zgsoft_happy@126.com
18931df6b4c1c461ce9b9653bdbc647ffa7a80a4
317cb97af3188aa11cbcff0a9de37b8a0c528d3e
/ManuEvaluation/eclipse.jdt.core/6/cloneMethod1.java
c90158212d7b7f95deae8c51f3a6b60c33e89d22
[]
no_license
pldesei/CloneRefactoring
cea58e06abfcf049da331d7bf332dd05278dbafc
c989422ea3aab79b4b87a270d7ab948307569f11
refs/heads/master
2021-01-19T17:37:29.938335
2018-07-11T02:56:29
2018-07-11T02:56:29
101,065,962
0
0
null
null
null
null
UTF-8
Java
false
false
1,663
java
This clone method is located in File: org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java The line range of this clone method is: 5275-5300 The content of this clone method is as follows: public void test0167() throws CoreException { ICompilationUnit sourceUnit = getCompilationUnit("Converter15" , "src", "test0167", "X.java"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ASTNode result = runJLS3Conversion(sourceUnit, true, true); assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.COMPILATION_UNIT); CompilationUnit compilationUnit = (CompilationUnit) result; assertProblemsSize(compilationUnit, 0); ASTNode node = getASTNode(compilationUnit, 1, 0); assertEquals("Not a method declaration", ASTNode.METHOD_DECLARATION, node.getNodeType()); MethodDeclaration methodDeclaration = (MethodDeclaration) node; List parameters = methodDeclaration.parameters(); assertEquals("wrong size", 4, parameters.size()); SingleVariableDeclaration param = (SingleVariableDeclaration)parameters.get(3); Type t = param.getType(); String typeName = ((SimpleType)t).getName().getFullyQualifiedName(); IType[] types = sourceUnit.getTypes(); assertEquals("wrong size", 2, types.length); IType mainType = types[1]; String[][] typeMatches = mainType.resolveType( typeName ); assertNotNull(typeMatches); assertEquals("wrong size", 1, typeMatches.length); String[] typesNames = typeMatches[0]; assertEquals("wrong size", 2, typesNames.length); assertEquals("Wrong part 1", "java.lang", typesNames[0]); assertEquals("Wrong part 2", "Object", typesNames[1]); }
[ "XXX@XXX" ]
XXX@XXX
bdbaf5994d100f36e7aa57d57d4786feca874722
9d1870a895c63f540937f04a6285dd25ada5e52a
/chromecast-app-reverse-engineering/src/from-androguard-dad-broken-but-might-help/cbd.java
cb63b9dbad8432897c9949393043d088b4d1ac37
[]
no_license
Churritosjesus/Chromecast-Reverse-Engineering
572aa97eb1fd65380ca0549b4166393505328ed4
29fae511060a820f2500a4e6e038dfdb591f4402
refs/heads/master
2023-06-04T10:27:15.869608
2015-10-27T10:43:11
2015-10-27T10:43:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
static final Lcah a static cbd() { cah[] v0_1 = new cah[2]; v0_1[0] = new cbe(cah.a("0\u0082\u0003\u00cd0\u0082\u0002\u00b5\u00a0\u0003\u0002\u0001\u0002\u0002\t\u0000\u00e2\u0091\u00c9\u00ca\r\u00b2\u0004/0")); v0_1[1] = new cbf(cah.a("0\u0082\u0003\u00cd0\u0082\u0002\u00b5\u00a0\u0003\u0002\u0001\u0002\u0002\t\u0000\u00b3+\u001c\u00ef0O\u000c\u00b90")); cbd.a = v0_1; return; }
[ "v.richomme@gmail.com" ]
v.richomme@gmail.com
9f9ee33a860279fb499148caf50847303f6a1fef
bde9061dd6bb5c83a74a3106b99ad2ece5ac7492
/LifeApplication/webviewlibrary/src/main/java/com/android/webviewlibrary/interface1/VideoWebListener.java
86c4429a96d735a06e11a3dac56b04a8b7d70c8c
[]
no_license
1006891880/life
9df616658f1ae8ff1d9ba1b7a1ac9d9cc6b7a98d
e4748c4f634c054bda32884af9073d62273fa6a4
refs/heads/master
2022-09-11T19:43:14.759500
2020-06-04T03:27:11
2020-06-04T03:27:11
264,885,553
0
0
null
null
null
null
UTF-8
Java
false
false
1,053
java
/* Copyright 2017 yangchong211(github.com/yangchong211) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.android.webviewlibrary.interface1; /** * web的接口回调,主要是视频相关回调,比如全频,取消全频,隐藏和现实webView */ public interface VideoWebListener { /** * 显示全屏view */ void showVideoFullView(); /** * 隐藏全屏view */ void hindVideoFullView(); /** * 显示webview */ void showWebView(); /** * 隐藏webview */ void hindWebView(); }
[ "yudl2@lenovo.com" ]
yudl2@lenovo.com
a0fb74cf02bb87515adc430b3fb0ef9da05536bc
7f138dd0a59c965f43e0f77cd52b4596e2767dcb
/sprout-web/src/main/java/net/savantly/sprout/security/oauth/LinkedinPrincipalExtractor.java
b3e944bbf174fbe1ead6699b923534f20186e155
[]
no_license
savantly-net/sprout
271f0f976089f7c70f998f99fa1d56e6f5fb884b
47c0f95d435b2b220d1c0eb35a3ad181f6bbef80
refs/heads/master
2023-08-31T10:04:27.620291
2020-04-16T21:33:52
2020-04-16T21:33:52
45,894,970
1
1
null
null
null
null
UTF-8
Java
false
false
1,781
java
package net.savantly.sprout.security.oauth; import java.util.Arrays; import java.util.List; import java.util.Map; import org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor; import org.springframework.security.oauth2.client.OAuth2RestTemplate; import net.savantly.sprout.domain.emailAddress.EmailAddress; import net.savantly.sprout.domain.user.OAuthAccount; import net.savantly.sprout.domain.user.SproutUser; import net.savantly.sprout.domain.user.repository.UserRepository; import net.savantly.sprout.domain.user.security.SproutUserDetailsService; public class LinkedinPrincipalExtractor implements PrincipalExtractor { private UserRepository userRepository; private OAuth2RestTemplate restTemplate; private SproutUserDetailsService userDetailsService; public LinkedinPrincipalExtractor(UserRepository userRepository, SproutUserDetailsService userDetailsService, OAuth2RestTemplate oAuth2RestTemplate) { this.userRepository = userRepository; this.restTemplate = oAuth2RestTemplate; this.userDetailsService = userDetailsService; } @Override public Object extractPrincipal(Map<String, Object> authMap) { String emailString = (String)authMap.get("emailAddress"); List<EmailAddress> emailList = Arrays.asList(new EmailAddress((String) emailString, false)); String firstName = (String) authMap.getOrDefault("firstName", "Linkedin"); String lastName = (String) authMap.getOrDefault("lastName", "User"); OAuthAccount oAuthAccount = new OAuthAccount("linkedin", authMap); SproutUser user = userDetailsService.loadByEmailAddress(emailString.toLowerCase()); if(user == null){ return this.userRepository.getOrInsertForOAuth(firstName, lastName, oAuthAccount, emailList); } else { return user; } } }
[ "JDBranham@Hotmail.com" ]
JDBranham@Hotmail.com
dde85864f0cac2712e1819e58387e298cf52851e
f569ce7051039ce55de257e6d127cdc532171229
/src/dev/Sandefur/fear/tiles/House/W4BM.java
f8210c2c9f669a26e0f15e71b89fba4fa55e7543
[]
no_license
Draonc/10thFear
f68c924c43b9c1e34ee23f00dff15d33c4f12056
a9c57129153e1ad5d9911dc968f4d0f29dd3152d
refs/heads/master
2020-04-23T17:47:47.956639
2019-02-18T20:08:34
2019-02-18T20:08:34
171,344,906
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package dev.Sandefur.fear.tiles.House; import dev.Sandefur.fear.gfx.Assets; import dev.Sandefur.fear.tiles.Tile; public class W4BM extends Tile { public W4BM(int id) { super(Assets.w4BotMid, id); } @Override public boolean isSolid(){ return true; } }
[ "Draonc02@gmial.com" ]
Draonc02@gmial.com
69140206a151c3d03c62ab8daa000f78a7f80918
f9d97bf62f114687fc47908e8de95b573a45d113
/程序/Code/Android/ProductionPlan/app/src/main/java/dialog/DownloadNewVersionDialog.java
d6c24140d97cab7159cdd66b305ef52e72fef1d9
[]
no_license
1611272792/NanTong
3c9ec3d421659de6abe15e89db075a220ef222ce
9cd11d56fe8102451f973f8d11a51c62f6899eef
refs/heads/master
2020-04-12T00:56:14.102968
2018-12-18T06:57:56
2018-12-18T06:57:56
162,217,129
0
0
null
null
null
null
UTF-8
Java
false
false
8,103
java
package dialog; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.icu.text.UnicodeSet; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.liulishuo.filedownloader.BaseDownloadTask; import com.liulishuo.filedownloader.FileDownloadLargeFileListener; import com.liulishuo.filedownloader.FileDownloader; import com.sunpn.productionplan.R; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; /** * Created by guhh on 2018/3/23. */ public class DownloadNewVersionDialog extends AlertDialog { private Activity activity; private ProgressBar progressBar; private TextView status_tv ; private String url ; private String downPath; private Button retry_btn; private Button cancel_btn; public DownloadNewVersionDialog(Context context) { super(context); setCancelable(false); activity = (Activity) context; } protected DownloadNewVersionDialog(Context context, boolean cancelable, OnCancelListener cancelListener) { super(context, cancelable, cancelListener); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_download); progressBar = findViewById(R.id.loading_progress); progressBar.setMax(100); status_tv = findViewById(R.id.status_tv); downPath = getContext().getExternalCacheDir().getPath()+(url.substring(url.lastIndexOf("/"))); retry_btn = findViewById(R.id.retry_btn); cancel_btn = findViewById(R.id.cancel_btn); FileDownloader.getImpl().create(url) .setForceReDownload(true) .setPath(downPath) .setListener(new FileDownloadLargeFileListener() { @Override protected void pending(BaseDownloadTask task, long soFarBytes, long totalBytes) { Log.i("sssddd-download","pending"); status_tv.setText("准备中..."); retry_btn.setVisibility(View.GONE); cancel_btn.setVisibility(View.GONE); } @Override protected void progress(BaseDownloadTask task, long soFarBytes, long totalBytes) { retry_btn.setVisibility(View.GONE); cancel_btn.setVisibility(View.GONE); Log.i("sssddd-download",soFarBytes+"--"+totalBytes); status_tv.setText("下载中..."); progressBar.setProgress((int) ((((float) soFarBytes)/totalBytes)*100)); } @Override protected void paused(BaseDownloadTask task, long soFarBytes, long totalBytes) { Log.i("sssddd-download","paused"); status_tv.setText("暂停中..."); } @Override protected void completed(BaseDownloadTask task) { Log.i("sssddd-download","completed"); status_tv.setText("已完成"); retry_btn.setVisibility(View.GONE); cancel_btn.setVisibility(View.GONE); dismiss(); install(); } @Override protected void error(BaseDownloadTask task, Throwable e) { Log.i("sssddd-download","error"+e.getMessage()); status_tv.setText("下载出错\n"+e.getMessage()+"\n"+url); retry_btn.setVisibility(View.VISIBLE); cancel_btn.setVisibility(View.VISIBLE); } @Override protected void warn(BaseDownloadTask task) { Log.i("sssddd-download","warn"); } }) .start(); cancel_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dismiss(); } }); retry_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); } private void install(){ Intent intentInstall = new Intent(android.content.Intent.ACTION_VIEW); intentInstall.setDataAndType(Uri.parse("file://"+downPath), "application/vnd.android.package-archive"); intentInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); activity.startActivity(intentInstall); } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public static int installSilent(String filePath) { File file = new File(filePath); if (filePath == null || filePath.length() == 0 || file == null || file.length() <= 0 || !file.exists() || !file.isFile()) { return 1; } String[] args = { "pm", "install", "-r", filePath }; ProcessBuilder processBuilder = new ProcessBuilder(args); Process process = null; BufferedReader successResult = null; BufferedReader errorResult = null; StringBuilder successMsg = new StringBuilder(); StringBuilder errorMsg = new StringBuilder(); int result; try { process = processBuilder.start(); successResult = new BufferedReader(new InputStreamReader(process.getInputStream())); errorResult = new BufferedReader(new InputStreamReader(process.getErrorStream())); String s; while ((s = successResult.readLine()) != null) { successMsg.append(s); } while ((s = errorResult.readLine()) != null) { errorMsg.append(s); } } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (successResult != null) { successResult.close(); } if (errorResult != null) { errorResult.close(); } } catch (IOException e) { e.printStackTrace(); } if (process != null) { process.destroy(); } } // TODO should add memory is not enough here if (successMsg.toString().contains("Success") || successMsg.toString().contains("success")) { result = 0; } else { result = 2; } Log.d("test-test", "successMsg:" + successMsg + ", ErrorMsg:" + errorMsg); return result; } public static boolean runRootCommand(String command) { Process process = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getOutputStream()); os.writeBytes(command+"\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor(); } catch (Exception e) { Log.d("*** DEBUG ***", "Unexpected error - Here is what I know: "+e.getMessage()); return false; } finally { try { if (os != null) { os.close(); } process.destroy(); } catch (Exception e) { // nothing } } return true; } }
[ "1611272792@qq.com" ]
1611272792@qq.com
704a8d1bcab2573c8ae9bc74883e74dd1163a757
85a77ee6955a3cb37e9ce5667ebec58ba3dce6c3
/src/BSTInterface.java
0babc3b432b93da0bc29ea17f5a3396453187bd7
[]
no_license
cadywsq/Data-Structures
52c5a94ed19012cbfcf65512fb309a0dd08ab4ed
07f4b188bc554569c9c3254cb9eefbb2df6338af
refs/heads/master
2020-04-09T06:58:10.799653
2016-07-16T21:20:18
2016-07-16T21:20:18
60,864,432
0
0
null
2019-10-04T18:18:09
2016-06-10T17:11:51
Java
UTF-8
Java
false
false
199
java
/** * @author Siqi Wang siqiw1 on 6/29/16. */ public interface BSTInterface { boolean find(int key); void insert(int key, double value); void delete(int key); void traverse(); }
[ "siqiw1@andrew.cmu.edu" ]
siqiw1@andrew.cmu.edu
23ffc29b2e6a5073834c1719cd1fd32e9f4f29f0
18c4172288432a6fbafffe2c94c9246ae4f5aa77
/src/main/java/com/imooc/o2o/util/ImageUtil.java
69c1c9ed3e65f25f3ecd6211fb1390c7ea9d18ea
[]
no_license
susansys/SSM-Spring-web-Application
d4775ac613b866bf4c837bca4758da079c38aebb
27622967cf10a39e71a5c16e6f8167340c7014d3
refs/heads/main
2023-01-20T10:15:55.109281
2020-11-20T11:33:48
2020-11-20T11:33:48
312,763,616
1
0
null
null
null
null
UTF-8
Java
false
false
4,776
java
package com.imooc.o2o.util; import net.coobird.thumbnailator.Thumbnails; import net.coobird.thumbnailator.geometry.Positions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Random; public class ImageUtil { private static String basePath = "F:/Muke Projects/SSM+Spring/src/main/resources"; private static final SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); private static final Random r = new Random(); private static Logger logger = LoggerFactory.getLogger(ImageUtil.class); /** * transfer CommonsMultipartFile to File * @param cFile CommonsMultipartFile * @return newFile */ public static File transferCommonsMultipartFileToFile(CommonsMultipartFile cFile){ File newFile = new File(cFile.getOriginalFilename()); try { cFile.transferTo(newFile); } catch (IllegalStateException e) { logger.error(e.toString()); e.printStackTrace(); } catch (IOException e) { logger.error(e.toString()); e.printStackTrace(); } return newFile; } /** * solve pressed img, return the new created img's relative path * @param thumbnailInputStream Input stream * @param targetAddr the target address of the img. * @return relativeAddr, created img's relative path */ public static String generateThumbnail(InputStream thumbnailInputStream, String fileName, String targetAddr){ String realFileName = getRandomFileName(); String extension = getFileExtension(fileName); makeDirPath(targetAddr); String relativeAddr = targetAddr + realFileName + extension; logger.debug("current relativeAddr is: " + relativeAddr); File dest = new File(PathUtil.getImgBasePath() + relativeAddr); logger.debug("current complete is: " + PathUtil.getImgBasePath() + relativeAddr); try { Thumbnails.of(thumbnailInputStream).size(200, 200) .watermark(Positions.BOTTOM_RIGHT, ImageIO. read(new File(basePath + "/watermark.jpg")), 0.25f) .outputQuality(0.8f).toFile(dest); } catch (IOException e){ logger.error(e.toString()); e.printStackTrace(); } return relativeAddr; } /** * create the directory of the dest path. /home/work/sunsys/xxx.jpg * home, work, sunsys should be created automatically. * @param targetAddr the target address of the img. */ private static void makeDirPath(String targetAddr) { String realFileParentPath = PathUtil.getImgBasePath() + targetAddr; File dirPath = new File(realFileParentPath); if (!dirPath.exists()) { dirPath.mkdirs(); } } /** * get input file stream extension * @param fileName input file * @return fileExtension */ private static String getFileExtension(String fileName) { return fileName.substring(fileName.lastIndexOf(".")); } /** * create random file name, yyyyMMddHHmmss+random5digits * @return the random file name */ public static String getRandomFileName() { //get random 5 digits int rannum = r.nextInt(89999) + 10000; String nowTimeStr = sDateFormat.format(new Date()); return nowTimeStr + rannum; } /** * storePath is or not the file path * if storePath is the file path, delete the file * if storePath is the directory, delete all files under this directory. * @param storePath the path of storing file. */ public static void deleteFileOrPath(String storePath) { File fileOrPath = new File(PathUtil.getImgBasePath() + storePath); if (fileOrPath.exists()) { if(fileOrPath.isDirectory()) { File files[] = fileOrPath.listFiles(); for(int i = 0; i < files.length; i++) { files[i].delete(); } } fileOrPath.delete(); } } public static void main(String[] args) throws IOException { Thumbnails.of(new File("F:/Class-Project Resources/image SSMSrping/xiaohuangren.jpg")) .size(200,200).watermark(Positions.BOTTOM_RIGHT, ImageIO .read(new File(basePath + "/watermark.jpg")),0.25f) .outputQuality(0.8f) .toFile("F:/Class-Project Resources/image SSMSrping/xiaohuangrennew.jpg"); } }
[ "sun447@purdue.edu" ]
sun447@purdue.edu
1828197b76a91fa158e3f4ebcaf91a6bdda20baf
a6ab069d9fa34bd05c2eb7f90d8b7936e2b9b3da
/projekt/lurajcevi_projekt/lurajcevi_aplikacija_1/src/java/org/foi/nwtis/lurajcevi/web/Kontroler.java
dc047e3103945c5cdcc393d76ca7043189982876
[]
no_license
epson121/nwtis_projekt
9e275375f81e8d6799e70c8ba5dc58e9e12321c4
e8216f87fe7e128d6047586407d0e0b4fa396ea7
refs/heads/master
2020-06-13T05:22:46.993905
2013-06-18T15:33:44
2013-06-18T15:33:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,644
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.foi.nwtis.lurajcevi.web; import java.io.IOException; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.foi.nwtis.lurajcevi.ServerKomanda; import org.foi.nwtis.lurajcevi.db.DBConnector; import org.foi.nwtis.lurajcevi.ws.MeteoPodaci; /** * * @author Luka Rajcevic */ public class Kontroler extends HttpServlet { /** * Processes requests for both HTTP * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String zahtjev = request.getServletPath(); String odrediste = null; if (zahtjev.equals("/Kontroler")) odrediste = "/index.jsp"; else if (zahtjev.equals("/PrijavaKorisnika")) odrediste = "/login.jsp"; else if (zahtjev.equals("/OdjavaKorisnika")){ HttpSession sesija = request.getSession(); sesija.removeAttribute("korisnik"); odrediste = "/Kontroler"; } else if (zahtjev.equals("/ProvjeraKorisnika")) { String korIme = request.getParameter("kor_ime"); String lozinka = request.getParameter("lozinka"); HttpSession sesija = null; if (korIme == null || korIme.trim().length() == 0 || lozinka == null || lozinka.trim().length() == 0){ odrediste = "/PrijavaKorisnika"; } else { boolean b = false; try { b = DBConnector.provjeriKorisnika("lurajcevi_admin_podaci", korIme, lozinka); } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } if (b){ sesija = request.getSession(); sesija.setAttribute("korisnik", korIme); odrediste = "/Kontroler"; } else{ odrediste = "/PrijavaKorisnika"; } } } else if (zahtjev.equals("/PregledMeteoPodataka")){ HttpSession sesija = request.getSession(); int brojStranica = 5; if (sesija.getAttribute("broj_stranica") == null) sesija.setAttribute("broj_stranica", brojStranica); try { if (sesija.getAttribute("meteo_podaci") == null){ List<MeteoPodaci> podaci = DBConnector.dohvatiMeteoPodatke(); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss"); for (MeteoPodaci mp : podaci){ String d = df.format(df2.parse(mp.getDatum())); mp.setDatum(d); } sesija.setAttribute("meteo_podaci", podaci); } } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } odrediste = "/jsp/pregledMeteoPodataka.jsp"; } else if (zahtjev.equals("/PregledDnevnikaSocketServera")){ HttpSession sesija = request.getSession(); List<ServerKomanda> pregled_zahtjeva = null; try { pregled_zahtjeva = DBConnector.dohvatiPopisSocketServerKomandi("lurajcevi_dnevnik_servera", 0, ""); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss"); for (ServerKomanda sk : pregled_zahtjeva){ String d = df.format(df2.parse(sk.getDatum())); sk.setDatum(d); } } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } sesija.setAttribute("dnevnik_socket_servera", pregled_zahtjeva); odrediste = "/jsp/pregledDnevnikaSocketServera.jsp"; } else if (zahtjev.equals("/PregledDnevnikaSocketServeraFilter")){ HttpSession sesija = request.getSession(); String status = request.getParameter("status"); List<ServerKomanda> pregled_zahtjeva = null; try { pregled_zahtjeva = DBConnector.dohvatiPopisSocketServerKomandi("lurajcevi_dnevnik_servera", 1, status); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss"); for (ServerKomanda sk : pregled_zahtjeva){ String d = df.format(df2.parse(sk.getDatum())); sk.setDatum(d); } } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } sesija.setAttribute("dnevnik_socket_servera", pregled_zahtjeva); odrediste = "/jsp/pregledDnevnikaSocketServera.jsp"; } else if (zahtjev.equals("/PregledZahtjevaServera")){ HttpSession sesija = request.getSession(); List<HttpZahtjev> pregled_zahtjeva = null; try { pregled_zahtjeva = DBConnector.dohvatiPopisZahtjevaPremaServeru("lurajcevi_dnevnik_zahtjeva"); } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } sesija.setAttribute("pregled_zahtjeva", pregled_zahtjeva); odrediste = "/jsp/pregledZahtjevaServera.jsp"; } else if (zahtjev.equals("/MeteoPodaciStranicenje")){ int brojStranica = Integer.parseInt(request.getParameter("broj_stranica")); HttpSession sesija = request.getSession(); sesija.setAttribute("broj_stranica", brojStranica); odrediste = "/jsp/pregledMeteoPodataka.jsp"; } else if (zahtjev.equals("/MeteoPodaciZipFilter")){ HttpSession sesija = request.getSession(); String zip = request.getParameter("zip"); SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss"); if (zip != null && !zip.trim().equals("")){ List<MeteoPodaci> podaci = null; try { podaci = DBConnector.dohvatiNajnovijePodatke("lurajcevi_podaci_zip", zip, 0, 1); for (MeteoPodaci mp : podaci){ String d = df.format(df2.parse(mp.getDatum())); mp.setDatum(d); } } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } sesija.setAttribute("meteo_podaci", podaci); } else { try{ List<MeteoPodaci> podaci = DBConnector.dohvatiMeteoPodatke(); for (MeteoPodaci mp : podaci){ String d = df.format(df2.parse(mp.getDatum())); mp.setDatum(d); } sesija.setAttribute("meteo_podaci", podaci); } catch (ParseException pe){ pe.printStackTrace(); } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } } odrediste = "/jsp/pregledMeteoPodataka.jsp"; } else if (zahtjev.equals("/MeteoPodaciInterval")){ HttpSession sesija = request.getSession(); String zip = request.getParameter("zip"); String datum1 = request.getParameter("datum1"); String datum2 = request.getParameter("datum2"); if (zip != null && !zip.trim().equals("") && datum1 != null && !datum1.trim().equals("") && datum2 != null && !datum2.trim().equals("")){ SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy HH.mm.ss");//02.06.2013 18:10:47 try{ String dat1 = df2.format(df.parse(datum1)); String dat2 = df2.format(df.parse(datum2)); List<MeteoPodaci> podaci = DBConnector.dohvatiPodatkeInterval("lurajcevi_podaci_zip", zip, dat1, dat2); for (MeteoPodaci mp : podaci){ String d = df.format(df2.parse(mp.getDatum())); mp.setDatum(d); } sesija.setAttribute("meteo_podaci", podaci); } catch (ClassNotFoundException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(Kontroler.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException e){ e.printStackTrace(); } } odrediste = "/jsp/pregledMeteoPodataka.jsp"; } else{ ServletException up = new ServletException("Zahtjev nije poznat"); throw up; } RequestDispatcher rd = getServletContext().getRequestDispatcher(odrediste); rd.forward(request, response); } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP * <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP * <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "traxdater12@gmail.com" ]
traxdater12@gmail.com
0735f8054384aa5610d6aabc76cadf83feb5a2e4
1d0279ae389e19fa3c0f6afa4f146bcb5f4135f4
/pipelines/fetching/AirAPI/src/main/java/JSONWriter.java
093f5208a4b243d1771cc6b5fc6b2fc27c0bea7a
[]
no_license
vickyd885/UDL
494e0728c0292bd928c94ff2d15c1d44f32448b1
939b12544ad301b14fbd91726bd6d03ab9f363bb
refs/heads/master
2021-03-24T13:33:43.690076
2018-04-29T09:12:45
2018-04-29T09:12:45
113,975,120
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
import java.io.FileWriter; import java.io.File; import org.json.simple.JSONArray; import org.json.simple.JSONObject; /* * JSONWriter handles writing data to file */ public class JSONWriter{ /** * Writes data to a file given a file path and a filename * * @param data json data as a string * @param filePath destination file location * @param fileName name of file */ public static void writeToJsonFile(String data, String filePath, String fileName){ try { File f = new File(filePath); if(!f.exists()){ f.mkdirs(); } FileWriter fileWriter = new FileWriter(filePath + "/" + fileName); fileWriter.write(data); fileWriter.flush(); } catch (Exception e) { e.printStackTrace(); } } }
[ "vickyd885@gmail.com" ]
vickyd885@gmail.com
6bbcad876273f7fe45f40d8c99817d83cab9ee26
00f46071a5d472eec35535be02f665e8d5853263
/app/src/main/java/com/example/datingapp/BtnDisLikeActivity.java
700677710f7e47a9ac3eccdc8e8177fff15befc0
[]
no_license
vietphu0123/dating_app
7080ac56029afa624663fa49a003abb90045f096
2a52ab78a2924a45094a2d430f3026ec6def8ed1
refs/heads/master
2023-06-02T11:02:29.818205
2021-06-24T08:59:07
2021-06-24T08:59:07
367,994,223
0
0
null
2021-06-24T08:59:08
2021-05-16T22:05:11
Java
UTF-8
Java
false
false
2,151
java
package com.example.datingapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx; public class BtnDisLikeActivity extends AppCompatActivity { private static final String TAG="BtnDisLikeActivity"; private static final int ACTIVITY_NUM=1; private Context mContext=BtnDisLikeActivity.this; private ImageView dislike; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_btn_dis_like); setupTopNavigationView(); dislike = findViewById(R.id.dislike); Intent intent = getIntent(); String profileUrl = intent.getStringExtra("url"); switch (profileUrl) { case "default": Glide.with(mContext).load(R.drawable.profile).into(dislike); break; default: Glide.with(mContext).load(profileUrl).into(dislike); break; } new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } Intent mainIntent=new Intent(BtnDisLikeActivity.this,MainActivity.class); startActivity(mainIntent); } }).start(); } private void setupTopNavigationView() { BottomNavigationViewEx tvEx=findViewById(R.id.topNavViewBar); TopNavigationViewHelper.SetupTopNavigationView(tvEx); TopNavigationViewHelper.enableNavigation(mContext,tvEx); Menu menu=tvEx.getMenu(); MenuItem menuItem=menu.getItem(ACTIVITY_NUM); menuItem.setChecked(true); } public void LikeBtn(View view) { } }
[ "nguyentrson123@gmail.com" ]
nguyentrson123@gmail.com
9b674de98797569c9b59fddfdd8969b7f09b05b2
da9b4acbac667698073efdeb34ffedaa538085ee
/src/test/java/com/cybertek/runners/CukesRunner.java
28ab7ae90b48fffd599822daab15819724e511dd
[]
no_license
Ainur519/cybertek22-cucumber-junit
68cc98c16d4ddcde6240fa4f65b4c8a1b9e3af26
2b7bf21bbbd023541b1a7f3b3164ad963e9103aa
refs/heads/master
2023-06-16T21:00:18.840932
2021-07-11T14:12:41
2021-07-11T14:12:41
384,966,683
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.cybertek.runners; import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions( plugin = "html:target/cucumber-report.html", features = "src/test/resources/features", glue = "com/cybertek/step_definitions", dryRun = false, tags = "@regression" ) public class CukesRunner { }
[ "runya579@gmail.com" ]
runya579@gmail.com
09a3af0f616987746adc1c3d24d72e94d0a05070
fd992c4730edfd3b88fa6017e4e0c8c3cca89b4f
/dportenis-datacap-client/src/com/dportenis/wtm/bean/Upload.java
6f77ef93917fef422ce913b65f39f016b87ff480
[]
no_license
ubaidmt/Emergys
a815377d0763ebf0e3a177e569d25eae534b9046
0f9842d117925e59128d0293554f4dde69f3289b
refs/heads/master
2020-04-08T04:40:15.712455
2017-08-20T18:58:43
2017-08-20T18:58:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
425
java
package com.dportenis.wtm.bean; public class Upload { private String originalFileName = null; private String pageId = null; public String getOriginalFileName() { return originalFileName; } public void setOriginalFileName(String originalFileName) { this.originalFileName = originalFileName; } public String getPageId() { return pageId; } public void setPageId(String pageId) { this.pageId = pageId; } }
[ "juansaad@excelecm.com" ]
juansaad@excelecm.com
73ecf53b08f8787a89bf3cce989b498567647510
797e0c25084f259d4413c37e5bbabbb9bbd6b05c
/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractNodeVisitor.java
18bbdf0e0109d89fabd699ef0376683d0c310fae
[ "Apache-2.0" ]
permissive
radtriste-bot-account/kogito-runtimes
884b99a9ce4e26ff548ec48d2f8ce8f3784e99ff
1c73f3dd11a38496601cb013c80e31937ce58739
refs/heads/master
2023-08-21T11:52:15.845473
2020-07-17T15:47:54
2020-07-17T15:47:54
281,125,237
0
0
Apache-2.0
2020-07-20T13:34:07
2020-07-20T13:34:06
null
UTF-8
Java
false
false
8,822
java
/* * Copyright 2020 Red Hat, Inc. and/or its affiliates. * * 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.jbpm.compiler.canonical; import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; import com.github.javaparser.ast.body.Parameter; import com.github.javaparser.ast.expr.AssignExpr; import com.github.javaparser.ast.expr.CastExpr; import com.github.javaparser.ast.expr.EnclosedExpr; import com.github.javaparser.ast.expr.Expression; import com.github.javaparser.ast.expr.LambdaExpr; import com.github.javaparser.ast.expr.LongLiteralExpr; import com.github.javaparser.ast.expr.MethodCallExpr; import com.github.javaparser.ast.expr.NameExpr; import com.github.javaparser.ast.expr.StringLiteralExpr; import com.github.javaparser.ast.expr.VariableDeclarationExpr; import com.github.javaparser.ast.stmt.BlockStmt; import com.github.javaparser.ast.stmt.ExpressionStmt; import com.github.javaparser.ast.stmt.ReturnStmt; import com.github.javaparser.ast.stmt.Statement; import com.github.javaparser.ast.type.ClassOrInterfaceType; import com.github.javaparser.ast.type.UnknownType; import org.drools.core.util.StringUtils; import org.jbpm.process.core.context.variable.Mappable; import org.jbpm.process.core.context.variable.Variable; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.workflow.core.impl.ConnectionImpl; import org.jbpm.workflow.core.node.HumanTaskNode; import org.jbpm.workflow.core.node.StartNode; import org.kie.api.definition.process.Connection; import org.kie.api.definition.process.Node; import static com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType; import static org.jbpm.ruleflow.core.Metadata.CUSTOM_AUTO_START; import static org.jbpm.ruleflow.core.Metadata.HIDDEN; import static org.jbpm.ruleflow.core.factory.MappableNodeFactory.METHOD_IN_MAPPING; import static org.jbpm.ruleflow.core.factory.MappableNodeFactory.METHOD_OUT_MAPPING; import static org.jbpm.ruleflow.core.factory.NodeFactory.METHOD_DONE; import static org.jbpm.ruleflow.core.factory.NodeFactory.METHOD_NAME; public abstract class AbstractNodeVisitor<T extends Node> extends AbstractVisitor { protected abstract String getNodeKey(); public void visitNode(T node, BlockStmt body, VariableScope variableScope, ProcessMetaData metadata) { visitNode(FACTORY_FIELD_NAME, node, body, variableScope, metadata); if (isAdHocNode(node) && !(node instanceof HumanTaskNode)) { metadata.addSignal(node.getName(), null); } } private boolean isAdHocNode(Node node) { return (node.getIncomingConnections() == null || node.getIncomingConnections().isEmpty()) && !(node instanceof StartNode) && !Boolean.parseBoolean((String) node.getMetaData().get(CUSTOM_AUTO_START)); } protected String getNodeId(T node) { return getNodeKey() + node.getId(); } public void visitNode(String factoryField, T node, BlockStmt body, VariableScope variableScope, ProcessMetaData metadata) { } protected MethodCallExpr getNameMethod(T node, String defaultName) { return getFactoryMethod(getNodeId(node), METHOD_NAME, new StringLiteralExpr(getOrDefault(node.getName(), defaultName))); } protected MethodCallExpr getDoneMethod(String object) { return getFactoryMethod(object, METHOD_DONE); } protected AssignExpr getAssignedFactoryMethod(String factoryField, Class<?> typeClass, String variableName, String methodName, Expression... args) { ClassOrInterfaceType type = new ClassOrInterfaceType(null, typeClass.getCanonicalName()); MethodCallExpr variableMethod = new MethodCallExpr(new NameExpr(factoryField), methodName); for (Expression arg : args) { variableMethod.addArgument(arg); } return new AssignExpr( new VariableDeclarationExpr(type, variableName), variableMethod, AssignExpr.Operator.ASSIGN); } public static Statement makeAssignment(Variable v) { String name = v.getSanitizedName(); return makeAssignment(name, v); } public static Statement makeAssignment(String targetLocalVariable, Variable processVariable) { ClassOrInterfaceType type = parseClassOrInterfaceType(processVariable.getType().getStringType()); // `type` `name` = (`type`) `kcontext.getVariable AssignExpr assignExpr = new AssignExpr( new VariableDeclarationExpr(type, targetLocalVariable), new CastExpr( type, new MethodCallExpr( new NameExpr(KCONTEXT_VAR), "getVariable") .addArgument(new StringLiteralExpr(targetLocalVariable))), AssignExpr.Operator.ASSIGN); return new ExpressionStmt(assignExpr); } protected Statement makeAssignmentFromModel(Variable v) { return makeAssignmentFromModel(v, v.getSanitizedName()); } protected Statement makeAssignmentFromModel(Variable v, String name) { ClassOrInterfaceType type = parseClassOrInterfaceType(v.getType().getStringType()); // `type` `name` = (`type`) `model.get<Name> AssignExpr assignExpr = new AssignExpr( new VariableDeclarationExpr(type, name), new CastExpr( type, new MethodCallExpr( new NameExpr("model"), "get" + StringUtils.capitalize(name))), AssignExpr.Operator.ASSIGN); return new ExpressionStmt(assignExpr); } protected void addNodeMappings(Mappable node, BlockStmt body, String variableName) { for (Entry<String, String> entry : node.getInMappings().entrySet()) { body.addStatement(getFactoryMethod(variableName, METHOD_IN_MAPPING, new StringLiteralExpr(entry.getKey()), new StringLiteralExpr(entry.getValue()))); } for (Entry<String, String> entry : node.getOutMappings().entrySet()) { body.addStatement(getFactoryMethod(variableName, METHOD_OUT_MAPPING, new StringLiteralExpr(entry.getKey()), new StringLiteralExpr(entry.getValue()))); } } protected String extractVariableFromExpression(String variableExpression) { if (variableExpression.startsWith("#{")) { return variableExpression.substring(2, variableExpression.indexOf('.')); } return variableExpression; } protected void visitConnections(String factoryField, Node[] nodes, BlockStmt body) { List<Connection> connections = new ArrayList<>(); for (Node node : nodes) { for (List<Connection> connectionList : node.getIncomingConnections().values()) { connections.addAll(connectionList); } } for (Connection connection : connections) { visitConnection(factoryField, connection, body); } } protected void visitConnection(String factoryField, Connection connection, BlockStmt body) { // if the connection is a hidden one (compensations), don't dump Object hidden = ((ConnectionImpl) connection).getMetaData(HIDDEN); if (hidden != null && ((Boolean) hidden)) { return; } body.addStatement(getFactoryMethod(factoryField, "connection", new LongLiteralExpr(connection.getFrom().getId()), new LongLiteralExpr(connection.getTo().getId()), new StringLiteralExpr(getOrDefault((String) connection.getMetaData().get("UniqueId"), "")))); } protected static LambdaExpr createLambdaExpr(String consequence, VariableScope scope) { BlockStmt conditionBody = new BlockStmt(); List<Variable> variables = scope.getVariables(); variables.stream() .map(ActionNodeVisitor::makeAssignment) .forEach(conditionBody::addStatement); conditionBody.addStatement(new ReturnStmt(new EnclosedExpr(new NameExpr(consequence)))); return new LambdaExpr( new Parameter(new UnknownType(), KCONTEXT_VAR), // (kcontext) -> conditionBody ); } }
[ "noreply@github.com" ]
radtriste-bot-account.noreply@github.com
75c99b8cacf925fa268c35c5382ca64b856d6627
b8d8f2461643f49f7acebb112c1339c62c7dde25
/popgog/java/com/qinnuan/engine/adapter/BlacklistAdapter.java
db8e7e9c3c11ab6b6a3ea072fd3e5b0ce09dbb1a
[]
no_license
johndpope/firstproject
cf1d387da32016ff4594339a3938e45c867a7c72
d28bf29c0b7798b8e2e39209adcec708cb0e739b
refs/heads/master
2021-12-02T16:49:28.902405
2013-11-07T01:33:29
2013-11-07T01:33:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,410
java
package com.qinnuan.engine.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.qinnuan.common.http.image.util.ImageFetcher; import com.qinnuan.common.util.GUIUtil; import com.qinnuan.common.util.TextUtil; import com.qinnuan.engine.R; import com.qinnuan.engine.bean.Fan; import com.qinnuan.engine.listener.IOnItemClickListener; import java.util.HashMap; import java.util.List; import java.util.Map; public class BlacklistAdapter extends BaoguBaseAdapter<Fan> { private Context mContext; private Map<Fan, View> mapView = new HashMap<Fan, View>(); private ImageFetcher fetcher; private LayoutInflater mInflater; public BlacklistAdapter(Context context, List<Fan> fans, ImageFetcher fetcher) { super(context, fans); modelList = fans; mContext = context; this.fetcher=fetcher; initInflater(mContext); } public BlacklistAdapter(Context context, List<Fan> fans) { super(context, fans); mContext = context; initInflater(mContext); } public BlacklistAdapter(Context context) { super(context); initInflater(mContext); } private void initInflater(Context context) { mInflater = LayoutInflater.from(context); } public void initAdapter(List<Fan> fans, AdapterView adpterV) { adpterV.setAdapter(this); } public void notifyAdapter(List<Fan> list) { getModelList().addAll(list); notifyDataSetChanged(); } private Fan deleteFan; public void notifyAdapter() { getModelList().remove(deleteFan); notifyDataSetChanged(); } private ViewHolder holder; @Override public View getView(int position, View cView, ViewGroup parent) { Fan fan = getItem(position); if(mapView.get(fan)!=null){ return mapView.get(fan) ; } holder = new ViewHolder(); cView = mInflater.inflate(R.layout.item_blacklist, null); cView.setTag(holder); holder.nickname = (TextView)cView.findViewById(R.id.item_nearby_person_nickname); holder.head = (ImageView)cView.findViewById(R.id.item_nearby_person_head); holder.unblack = (Button)cView.findViewById(R.id.item_blacklist_unblack); mapView.put(fan, cView); String imgUrl = fan.getProfileimg(); if (imgUrl != null && !imgUrl.equals("")) { fetcher.loadImage(imgUrl,holder.head, GUIUtil.getDpi(mContext, R.dimen.margin_8)); } holder.nickname.setText(TextUtil.getProcessText(fan.getNickname(), mContext)); holder.unblack.setTag(fan); holder.unblack.setOnClickListener(onClickL); return cView; } private View.OnClickListener onClickL = new View.OnClickListener() { @Override public void onClick(View v) { deleteFan = (Fan) v.getTag(); onIteml.onClick(deleteFan); } }; private IOnItemClickListener onIteml; public void setUnblackListener(IOnItemClickListener l) { onIteml = l; } private class ViewHolder { private TextView nickname; private Button unblack; private ImageView head; } }
[ "lihongbo2011@gmail.com" ]
lihongbo2011@gmail.com
336b493dfb0d89f39392d32c7d2e14ec31fdd904
fd83b71d0027d2c9a08852bbc224fbf7a7aa3da7
/yc/yc-server-eureka/src/main/java/com/ep/yc/ycservereureka/YcServerEurekaApplication.java
684bfa74ad2f55e29b769bc14d4ab9da870330ac
[]
no_license
WPZC/epallcompany
9c039aa1888d4867d289d9147f55b7c9b49135c4
635516cc143a5d5196560cb2a626bb0c264bb06d
refs/heads/master
2022-06-22T13:31:46.853599
2019-11-19T06:25:51
2019-11-19T06:25:51
222,620,773
0
0
null
2019-11-19T06:15:44
2019-11-19T06:05:16
Java
UTF-8
Java
false
false
440
java
package com.ep.yc.ycservereureka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class YcServerEurekaApplication { public static void main(String[] args) { SpringApplication.run(YcServerEurekaApplication.class, args); } }
[ "1272722954@qq.com" ]
1272722954@qq.com
65f81fc50d805c638d48ad95a12c47f123894d39
6c56457cd4bcabf7e2c5001bbd5c2ac46a89a1be
/android/app/src/main/java/com/anyformsproject/MainApplication.java
8223d4f01f6024022f433df7f3c42c89095d7831
[]
no_license
mnkozhin/anyFormsProject
77af87eb394103975776fcfc50ae9712f9e472b1
425d8065f1858dae91aed7476c35057d6a572096
refs/heads/master
2023-09-05T01:05:46.917379
2021-11-15T06:57:54
2021-11-15T06:57:54
428,155,192
0
0
null
null
null
null
UTF-8
Java
false
false
2,613
java
package com.anyformsproject; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.anyformsproject.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "mnkozhin@gmail.com" ]
mnkozhin@gmail.com
4a6153dbf1a5d2f918485f497abe5b4b7fda0b36
b60ce57f8daf874bb75ce2340a873798bd03a536
/programmers/src/level1/체육복도난.java
c1fd64e0845775a1b95026c875d0bc963bea911f
[]
no_license
rheehot/algorithm-48
ed67c9fbf55a271be01bbb52b36d0e625c8b38df
5dfdd87d789865ce44975ae1970fd62fa0618999
refs/heads/master
2023-05-07T20:05:25.452989
2021-05-23T05:00:52
2021-05-23T05:00:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
729
java
package level1; public class 체육복도난 { public static int solution(int n, int[] lost, int[] reserve) { int answer = n - lost.length; for (int i = 0; i < lost.length; i++) { for (int f = 0; f < reserve.length; f++) { if (lost[i] == reserve[f]) { reserve[f] = -1; lost[i] = -1; answer++; break; } } } for (int i : lost) { for (int j = 0; j < reserve.length; j++) { if (i + 1 == reserve[j] || i - 1 == reserve[j]) { reserve[j] = -1; answer++; break; } } } return answer; } public static void main(String[] args) { int n = 5; int[] lost = { 1, 2, 4, 5 }; int[] reserve = { 2, 3, 4 }; System.out.println(solution(n, lost, reserve)); } }
[ "69306907+BoBaeSeo@users.noreply.github.com" ]
69306907+BoBaeSeo@users.noreply.github.com
4a29a6c00becdcc477e9881ac81cfe95f5f7af15
6efbcb658d8d00c98bb55c8671e0f4baa8383910
/src/main/java/com/example/demo/DemoApplication.java
31f37d228332f9f6dddb6a9e6e798d9f39dff8d6
[]
no_license
syt123450/testAppEngine
ea027e51c31cce9d86d890089a0614f01ca3c6e7
e2a63d10eaae5bb761888cfdec1dfe5c787472c2
refs/heads/master
2021-08-19T16:48:22.840732
2017-11-27T00:57:51
2017-11-27T00:57:51
112,113,053
0
1
null
null
null
null
UTF-8
Java
false
false
426
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "421537891@qq.com" ]
421537891@qq.com
0f1a788d9cf1737f02306f1ba1330ae1356eb42b
60c7b8acdfed7743de85e3735deb9094b522cc48
/src/domainV2/bet/promotion/Promotion.java
8d8309f34e9eaf5faa32e3ee306a1af187a24f9b
[ "MIT" ]
permissive
srsuper/Gambling-webpage-BetAndRuin
416e291758956dbcbf1064481e510ec3927cd62b
2dc3492650d9a8a4f670c5b9197075106a24f054
refs/heads/master
2022-12-22T00:33:13.737526
2020-09-22T18:36:02
2020-09-22T18:36:02
297,738,831
0
0
MIT
2020-09-22T18:35:04
2020-09-22T18:35:03
null
UTF-8
Java
false
false
124
java
package domainV2.bet.promotion; public interface Promotion { public double promoReturn(long originalBet, float payoff); }
[ "carlosdbmac@gmail.com" ]
carlosdbmac@gmail.com
873e6946bd2d9677a8b584d899f3cd6e33bd6510
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_0202faf7f918a85ba314d23ac3f92689894097fc/EstablishmentManager/23_0202faf7f918a85ba314d23ac3f92689894097fc_EstablishmentManager_t.java
bb5bd6b8e62086ace64e354a854d4e34a9b1b2f7
[]
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
53,146
java
package net.i2p.router.transport.udp; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import net.i2p.crypto.DHSessionKeyBuilder; import net.i2p.data.Base64; import net.i2p.data.Hash; import net.i2p.data.RouterAddress; import net.i2p.data.RouterIdentity; import net.i2p.data.SessionKey; import net.i2p.data.i2np.DatabaseStoreMessage; import net.i2p.data.i2np.DeliveryStatusMessage; import net.i2p.data.i2np.I2NPMessage; import net.i2p.router.OutNetMessage; import net.i2p.router.Router; import net.i2p.router.RouterContext; import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade; import net.i2p.util.I2PThread; import net.i2p.util.Log; import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleTimer; /** * Coordinate the establishment of new sessions - both inbound and outbound. * This has its own thread to add packets to the packet queue when necessary, * as well as to drop any failed establishment attempts. * */ class EstablishmentManager { private final RouterContext _context; private final Log _log; private final UDPTransport _transport; private final PacketBuilder _builder; /** map of RemoteHostId to InboundEstablishState */ private final ConcurrentHashMap<RemoteHostId, InboundEstablishState> _inboundStates; /** map of RemoteHostId to OutboundEstablishState */ private final ConcurrentHashMap<RemoteHostId, OutboundEstablishState> _outboundStates; /** map of RemoteHostId to List of OutNetMessage for messages exceeding capacity */ private final ConcurrentHashMap<RemoteHostId, List<OutNetMessage>> _queuedOutbound; /** map of nonce (Long) to OutboundEstablishState */ private final ConcurrentHashMap<Long, OutboundEstablishState> _liveIntroductions; private boolean _alive; private final Object _activityLock; private int _activity; /** max outbound in progress */ private static final int DEFAULT_MAX_CONCURRENT_ESTABLISH = 20; private static final String PROP_MAX_CONCURRENT_ESTABLISH = "i2np.udp.maxConcurrentEstablish"; /** max pending outbound connections (waiting because we are at MAX_CONCURRENT_ESTABLISH) */ private static final int MAX_QUEUED_OUTBOUND = 50; /** max queued msgs per peer while the peer connection is queued */ private static final int MAX_QUEUED_PER_PEER = 3; public EstablishmentManager(RouterContext ctx, UDPTransport transport) { _context = ctx; _log = ctx.logManager().getLog(EstablishmentManager.class); _transport = transport; _builder = new PacketBuilder(ctx, transport); _inboundStates = new ConcurrentHashMap(); _outboundStates = new ConcurrentHashMap(); _queuedOutbound = new ConcurrentHashMap(); _liveIntroductions = new ConcurrentHashMap(); _activityLock = new Object(); _context.statManager().createRateStat("udp.inboundEstablishTime", "How long it takes for a new inbound session to be established", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.outboundEstablishTime", "How long it takes for a new outbound session to be established", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.inboundEstablishFailedState", "What state a failed inbound establishment request fails in", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.outboundEstablishFailedState", "What state a failed outbound establishment request fails in", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.sendIntroRelayRequest", "How often we send a relay request to reach a peer", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.sendIntroRelayTimeout", "How often a relay request times out before getting a response (due to the target or intro peer being offline)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.receiveIntroRelayResponse", "How long it took to receive a relay response", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.establishRejected", "How many pending outbound connections are there when we refuse to add any more?", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.establishOverflow", "How many messages were queued up on a pending connection when it was too much?", "udp", UDPTransport.RATES); // following are for PeerState _context.statManager().createRateStat("udp.congestionOccurred", "How large the cwin was when congestion occurred (duration == sendBps)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.congestedRTO", "retransmission timeout after congestion (duration == rtt dev)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.sendACKPartial", "Number of partial ACKs sent (duration == number of full ACKs in that ack packet)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.sendBps", "How fast we are transmitting when a packet is acked", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.receiveBps", "How fast we are receiving when a packet is fully received (at most one per second)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.mtuIncrease", "How many retransmissions have there been to the peer when the MTU was increased (period is total packets transmitted)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.mtuDecrease", "How many retransmissions have there been to the peer when the MTU was decreased (period is total packets transmitted)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.rejectConcurrentActive", "How many messages are currently being sent to the peer when we reject it (period is how many concurrent packets we allow)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.allowConcurrentActive", "How many messages are currently being sent to the peer when we accept it (period is how many concurrent packets we allow)", "udp", UDPTransport.RATES); _context.statManager().createRateStat("udp.rejectConcurrentSequence", "How many consecutive concurrency rejections have we had when we stop rejecting (period is how many concurrent packets we are on)", "udp", UDPTransport.RATES); //_context.statManager().createRateStat("udp.queueDropSize", "How many messages were queued up when it was considered full, causing a tail drop?", "udp", UDPTransport.RATES); //_context.statManager().createRateStat("udp.queueAllowTotalLifetime", "When a peer is retransmitting and we probabalistically allow a new message, what is the sum of the pending message lifetimes? (period is the new message's lifetime)?", "udp", UDPTransport.RATES); } public void startup() { _alive = true; I2PThread t = new I2PThread(new Establisher(), "UDP Establisher", true); t.start(); } public void shutdown() { _alive = false; notifyActivity(); } /** * Grab the active establishing state */ InboundEstablishState getInboundState(RemoteHostId from) { InboundEstablishState state = _inboundStates.get(from); // if ( (state == null) && (_log.shouldLog(Log.DEBUG)) ) // _log.debug("No inbound states for " + from + ", with remaining: " + _inboundStates); return state; } OutboundEstablishState getOutboundState(RemoteHostId from) { OutboundEstablishState state = _outboundStates.get(from); // if ( (state == null) && (_log.shouldLog(Log.DEBUG)) ) // _log.debug("No outbound states for " + from + ", with remaining: " + _outboundStates); return state; } private int getMaxConcurrentEstablish() { return _context.getProperty(PROP_MAX_CONCURRENT_ESTABLISH, DEFAULT_MAX_CONCURRENT_ESTABLISH); } /** * Send the message to its specified recipient by establishing a connection * with them and sending it off. This call does not block, and on failure, * the message is failed. * */ public void establish(OutNetMessage msg) { RouterAddress ra = msg.getTarget().getTargetAddress(_transport.getStyle()); if (ra == null) { _transport.failed(msg, "Remote peer has no address, cannot establish"); return; } if (msg.getTarget().getNetworkId() != Router.NETWORK_ID) { _context.shitlist().shitlistRouter(msg.getTarget().getIdentity().calculateHash()); _transport.markUnreachable(msg.getTarget().getIdentity().calculateHash()); _transport.failed(msg, "Remote peer is on the wrong network, cannot establish"); return; } UDPAddress addr = new UDPAddress(ra); RemoteHostId to = null; InetAddress remAddr = addr.getHostAddress(); int port = addr.getPort(); if ( (remAddr != null) && (port > 0) ) { to = new RemoteHostId(remAddr.getAddress(), port); if (!_transport.isValid(to.getIP())) { _transport.failed(msg, "Remote peer's IP isn't valid"); _transport.markUnreachable(msg.getTarget().getIdentity().calculateHash()); //_context.shitlist().shitlistRouter(msg.getTarget().getIdentity().calculateHash(), "Invalid SSU address", UDPTransport.STYLE); return; } if (_log.shouldLog(Log.DEBUG)) _log.debug("Add outbound establish state to: " + to); } else { if (_log.shouldLog(Log.DEBUG)) _log.debug("Add indirect outbound establish state to: " + addr); to = new RemoteHostId(msg.getTarget().getIdentity().calculateHash().getData()); } OutboundEstablishState state = null; int deferred = 0; boolean rejected = false; int queueCount = 0; state = _outboundStates.get(to); if (state == null) { if (_outboundStates.size() >= getMaxConcurrentEstablish()) { if (_queuedOutbound.size() > MAX_QUEUED_OUTBOUND) { rejected = true; } else { List<OutNetMessage> newQueued = new ArrayList(MAX_QUEUED_PER_PEER); List<OutNetMessage> queued = _queuedOutbound.putIfAbsent(to, newQueued); if (queued == null) queued = newQueued; // this used to be inside a synchronized (_outboundStates) block, // but that's now a CHM, so protect the ArrayList // There are still races possible but this should prevent AIOOBE and NPE synchronized (queued) { queueCount = queued.size(); if (queueCount < MAX_QUEUED_PER_PEER) { queued.add(msg); // increment for the stat below queueCount++; } deferred = _queuedOutbound.size(); } } } else { // must have a valid session key byte[] keyBytes = addr.getIntroKey(); if (keyBytes == null) { _transport.markUnreachable(msg.getTarget().getIdentity().calculateHash()); _transport.failed(msg, "Peer has no key, cannot establish"); return; } SessionKey sessionKey; try { sessionKey = new SessionKey(keyBytes); } catch (IllegalArgumentException iae) { _transport.markUnreachable(msg.getTarget().getIdentity().calculateHash()); _transport.failed(msg, "Peer has bad key, cannot establish"); return; } state = new OutboundEstablishState(_context, remAddr, port, msg.getTarget().getIdentity(), sessionKey, addr); OutboundEstablishState oldState = _outboundStates.putIfAbsent(to, state); boolean isNew = oldState == null; if (!isNew) // whoops, somebody beat us to it, throw out the state we just created state = oldState; else SimpleScheduler.getInstance().addEvent(new Expire(to, state), 10*1000); } } if (state != null) { state.addMessage(msg); List<OutNetMessage> queued = _queuedOutbound.remove(to); if (queued != null) { // see comments above synchronized (queued) { for (OutNetMessage m : queued) { state.addMessage(m); } } } } if (rejected) { _transport.failed(msg, "Too many pending outbound connections"); _context.statManager().addRateData("udp.establishRejected", deferred, 0); return; } if (queueCount >= MAX_QUEUED_PER_PEER) { _transport.failed(msg, "Too many pending messages for the given peer"); _context.statManager().addRateData("udp.establishOverflow", queueCount, deferred); return; } if (deferred > 0) msg.timestamp("too many deferred establishers: " + deferred); else if (state != null) msg.timestamp("establish state already waiting " + state.getLifetime()); notifyActivity(); } private class Expire implements SimpleTimer.TimedEvent { private RemoteHostId _to; private OutboundEstablishState _state; public Expire(RemoteHostId to, OutboundEstablishState state) { _to = to; _state = state; } public void timeReached() { // remove only if value == state boolean removed = _outboundStates.remove(_to, _state); if (removed) { _context.statManager().addRateData("udp.outboundEstablishFailedState", _state.getState(), _state.getLifetime()); if (_log.shouldLog(Log.WARN)) _log.warn("Timing out expired outbound: " + _state); processExpired(_state); } } } /** * How many concurrent inbound sessions to deal with */ private int getMaxInboundEstablishers() { return getMaxConcurrentEstablish()/2; } /** * Got a SessionRequest (initiates an inbound establishment) * */ void receiveSessionRequest(RemoteHostId from, UDPPacketReader reader) { if (!_transport.isValid(from.getIP())) return; int maxInbound = getMaxInboundEstablishers(); boolean isNew = false; if (_inboundStates.size() >= maxInbound) return; // drop the packet InboundEstablishState state = _inboundStates.get(from); if (state == null) { if (_context.blocklist().isBlocklisted(from.getIP())) { if (_log.shouldLog(Log.WARN)) _log.warn("Receive session request from blocklisted IP: " + from); return; // drop the packet } if (!_transport.allowConnection()) return; // drop the packet state = new InboundEstablishState(_context, from.getIP(), from.getPort(), _transport.getLocalPort()); state.receiveSessionRequest(reader.getSessionRequestReader()); InboundEstablishState oldState = _inboundStates.putIfAbsent(from, state); isNew = oldState == null; if (!isNew) // whoops, somebody beat us to it, throw out the state we just created state = oldState; } if (isNew) { // we don't expect inbound connections when hidden, but it could happen // Don't offer if we are approaching max connections. While Relay Intros do not // count as connections, we have to keep the connection to this peer up longer if // we are offering introductions. if ((!_context.router().isHidden()) && (!_transport.introducersRequired()) && _transport.haveCapacity() && !((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled()) { // ensure > 0 long tag = 1 + _context.random().nextLong(MAX_TAG_VALUE); state.setSentRelayTag(tag); if (_log.shouldLog(Log.INFO)) _log.info("Received session request from " + from + ", sending relay tag " + tag); } else { if (_log.shouldLog(Log.INFO)) _log.info("Received session request, but our status is " + _transport.getReachabilityStatus()); } } if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session request from: " + state.getRemoteHostId().toString()); notifyActivity(); } /** * got a SessionConfirmed (should only happen as part of an inbound * establishment) */ void receiveSessionConfirmed(RemoteHostId from, UDPPacketReader reader) { InboundEstablishState state = _inboundStates.get(from); if (state != null) { state.receiveSessionConfirmed(reader.getSessionConfirmedReader()); notifyActivity(); if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session confirmed from: " + state.getRemoteHostId().toString()); } } /** * Got a SessionCreated (in response to our outbound SessionRequest) * */ void receiveSessionCreated(RemoteHostId from, UDPPacketReader reader) { OutboundEstablishState state = _outboundStates.get(from); if (state != null) { state.receiveSessionCreated(reader.getSessionCreatedReader()); notifyActivity(); if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session created from: " + state.getRemoteHostId().toString()); } } /** * Got a SessionDestroy on an established conn * @since 0.8.1 */ void receiveSessionDestroy(RemoteHostId from, PeerState state) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session destroy (EST) from: " + from); _transport.dropPeer(state, false, "received destroy message"); } /** * Got a SessionDestroy during outbound establish * @since 0.8.1 */ void receiveSessionDestroy(RemoteHostId from, OutboundEstablishState state) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session destroy (OB) from: " + from); _outboundStates.remove(from); Hash peer = state.getRemoteIdentity().calculateHash(); _transport.dropPeer(peer, false, "received destroy message"); } /** * Got a SessionDestroy - maybe after an inbound establish * @since 0.8.1 */ void receiveSessionDestroy(RemoteHostId from) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Receive session destroy (IB) from: " + from); InboundEstablishState state = _inboundStates.remove(from); if (state != null) { Hash peer = state.getConfirmedIdentity().calculateHash(); if (peer != null) _transport.dropPeer(peer, false, "received destroy message"); } } /** * A data packet arrived on an outbound connection being established, which * means its complete (yay!). This is a blocking call, more than I'd like... * */ PeerState receiveData(OutboundEstablishState state) { state.dataReceived(); //int active = 0; //int admitted = 0; //int remaining = 0; //active = _outboundStates.size(); _outboundStates.remove(state.getRemoteHostId()); // there shouldn't have been queued messages for this active state, but just in case... List<OutNetMessage> queued = _queuedOutbound.remove(state.getRemoteHostId()); if (queued != null) { // see comments above synchronized (queued) { for (OutNetMessage m : queued) { state.addMessage(m); } } } //admitted = locked_admitQueued(); //remaining = _queuedOutbound.size(); //if (admitted > 0) // _log.log(Log.CRIT, "Admitted " + admitted + " with " + remaining + " remaining queued and " + active + " active"); if (_log.shouldLog(Log.INFO)) _log.info("Outbound established completely! yay: " + state); PeerState peer = handleCompletelyEstablished(state); notifyActivity(); return peer; } /******** private int locked_admitQueued() { int admitted = 0; while ( (!_queuedOutbound.isEmpty()) && (_outboundStates.size() < getMaxConcurrentEstablish()) ) { // ok, active shrunk, lets let some queued in. duplicate the synchronized // section from the add( RemoteHostId to = (RemoteHostId)_queuedOutbound.keySet().iterator().next(); List queued = (List)_queuedOutbound.remove(to); if (queued.isEmpty()) continue; OutNetMessage msg = (OutNetMessage)queued.get(0); RouterAddress ra = msg.getTarget().getTargetAddress(_transport.getStyle()); if (ra == null) { for (int i = 0; i < queued.size(); i++) _transport.failed((OutNetMessage)queued.get(i), "Cannot admit to the queue, as it has no address"); continue; } UDPAddress addr = new UDPAddress(ra); InetAddress remAddr = addr.getHostAddress(); int port = addr.getPort(); OutboundEstablishState qstate = new OutboundEstablishState(_context, remAddr, port, msg.getTarget().getIdentity(), new SessionKey(addr.getIntroKey()), addr); _outboundStates.put(to, qstate); SimpleScheduler.getInstance().addEvent(new Expire(to, qstate), 10*1000); for (int i = 0; i < queued.size(); i++) { OutNetMessage m = (OutNetMessage)queued.get(i); m.timestamp("no longer deferred... establishing"); qstate.addMessage(m); } admitted++; } return admitted; } *******/ private void notifyActivity() { synchronized (_activityLock) { _activity++; _activityLock.notifyAll(); } } /** kill any inbound or outbound that takes more than 30s */ private static final int MAX_ESTABLISH_TIME = 30*1000; /** * ok, fully received, add it to the established cons and queue up a * netDb store to them * */ private void handleCompletelyEstablished(InboundEstablishState state) { if (state.complete()) return; long now = _context.clock().now(); RouterIdentity remote = state.getConfirmedIdentity(); PeerState peer = new PeerState(_context, _transport, state.getSentIP(), state.getSentPort(), remote.calculateHash(), true); peer.setCurrentCipherKey(state.getCipherKey()); peer.setCurrentMACKey(state.getMACKey()); peer.setWeRelayToThemAs(state.getSentRelayTag()); // 0 is the default //peer.setTheyRelayToUsAs(0); if (_log.shouldLog(Log.DEBUG)) _log.debug("Handle completely established (inbound): " + state.getRemoteHostId().toString() + " - " + peer.getRemotePeer().toBase64()); //if (true) // for now, only support direct // peer.setRemoteRequiresIntroduction(false); _transport.addRemotePeerState(peer); _transport.inboundConnectionReceived(); _transport.setIP(remote.calculateHash(), state.getSentIP()); _context.statManager().addRateData("udp.inboundEstablishTime", state.getLifetime(), 0); sendInboundComplete(peer); } /** * dont send our info immediately, just send a small data packet, and 5-10s later, * if the peer isnt shitlisted, *then* send them our info. this will help kick off * the oldnet * The "oldnet" was < 0.6.1.10, it is long gone. * The delay really slows down the network. * The peer is unshitlisted and marked reachable by addRemotePeerState() which calls markReachable() * so the check below is fairly pointless. * If for some strange reason an oldnet router (NETWORK_ID == 1) does show up, * it's handled in UDPTransport.messageReceived() * (where it will get dropped, marked unreachable and shitlisted at that time). */ private void sendInboundComplete(PeerState peer) { // SimpleTimer.getInstance().addEvent(new PublishToNewInbound(peer), 10*1000); if (_log.shouldLog(Log.INFO)) _log.info("Completing to the peer after confirm: " + peer); DeliveryStatusMessage dsm = new DeliveryStatusMessage(_context); dsm.setArrival(Router.NETWORK_ID); // overloaded, sure, but future versions can check this // This causes huge values in the inNetPool.droppedDeliveryStatusDelay stat // so it needs to be caught in InNetMessagePool. dsm.setMessageExpiration(_context.clock().now()+10*1000); dsm.setMessageId(_context.random().nextLong(I2NPMessage.MAX_ID_VALUE)); _transport.send(dsm, peer); SimpleScheduler.getInstance().addEvent(new PublishToNewInbound(peer), 0); } private class PublishToNewInbound implements SimpleTimer.TimedEvent { private PeerState _peer; public PublishToNewInbound(PeerState peer) { _peer = peer; } public void timeReached() { Hash peer = _peer.getRemotePeer(); if ((peer != null) && (!_context.shitlist().isShitlisted(peer)) && (!_transport.isUnreachable(peer))) { // ok, we are fine with them, send them our latest info if (_log.shouldLog(Log.INFO)) _log.info("Publishing to the peer after confirm plus delay (without shitlist): " + peer.toBase64()); sendOurInfo(_peer, true); } else { // nuh uh. fuck 'em. if (_log.shouldLog(Log.WARN)) _log.warn("NOT publishing to the peer after confirm plus delay (WITH shitlist): " + (peer != null ? peer.toBase64() : "unknown")); } _peer = null; } } /** * ok, fully received, add it to the established cons and send any * queued messages * */ private PeerState handleCompletelyEstablished(OutboundEstablishState state) { if (state.complete()) { RouterIdentity rem = state.getRemoteIdentity(); if (rem != null) return _transport.getPeerState(rem.getHash()); } long now = _context.clock().now(); RouterIdentity remote = state.getRemoteIdentity(); PeerState peer = new PeerState(_context, _transport, state.getSentIP(), state.getSentPort(), remote.calculateHash(), false); peer.setCurrentCipherKey(state.getCipherKey()); peer.setCurrentMACKey(state.getMACKey()); peer.setTheyRelayToUsAs(state.getReceivedRelayTag()); // 0 is the default //peer.setWeRelayToThemAs(0); if (_log.shouldLog(Log.DEBUG)) _log.debug("Handle completely established (outbound): " + state.getRemoteHostId().toString() + " - " + peer.getRemotePeer().toBase64()); _transport.addRemotePeerState(peer); _transport.setIP(remote.calculateHash(), state.getSentIP()); _context.statManager().addRateData("udp.outboundEstablishTime", state.getLifetime(), 0); sendOurInfo(peer, false); int i = 0; while (true) { OutNetMessage msg = state.getNextQueuedMessage(); if (msg == null) break; if (now - Router.CLOCK_FUDGE_FACTOR > msg.getExpiration()) { msg.timestamp("took too long but established..."); _transport.failed(msg, "Took too long to establish, but it was established"); } else { msg.timestamp("session fully established and sent " + i); _transport.send(msg); } i++; } return peer; } private void sendOurInfo(PeerState peer, boolean isInbound) { if (_log.shouldLog(Log.INFO)) _log.info("Publishing to the peer after confirm: " + (isInbound ? " inbound con from " + peer : "outbound con to " + peer)); DatabaseStoreMessage m = new DatabaseStoreMessage(_context); m.setEntry(_context.router().getRouterInfo()); m.setMessageExpiration(_context.clock().now() + 10*1000); _transport.send(m, peer); } /** the relay tag is a 4-byte field in the protocol */ public static final long MAX_TAG_VALUE = 0xFFFFFFFFl; private void sendCreated(InboundEstablishState state) { long now = _context.clock().now(); // This is usually handled in receiveSessionRequest() above, except, I guess, // if the session isn't new and we are going through again. // Don't offer if we are approaching max connections (see comments above) // Also don't offer if we are floodfill, as this extends the max idle time // and we will have lots of incoming conns if ((!_context.router().isHidden()) && (!_transport.introducersRequired()) && _transport.haveCapacity() && !((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled()) { // offer to relay // (perhaps we should check our bw usage and/or how many peers we are // already offering introducing?) if (state.getSentRelayTag() == 0) { // ensure > 0 state.setSentRelayTag(1 + _context.random().nextLong(MAX_TAG_VALUE)); } else { // don't change it, since we've already prepared our sig } } else { // don't offer to relay state.setSentRelayTag(0); } if (_log.shouldLog(Log.DEBUG)) _log.debug("Send created to: " + state.getRemoteHostId().toString()); try { state.generateSessionKey(); } catch (DHSessionKeyBuilder.InvalidPublicParameterException ippe) { if (_log.shouldLog(Log.ERROR)) _log.error("Peer " + state.getRemoteHostId() + " sent us an invalid DH parameter (or were spoofed)", ippe); _inboundStates.remove(state.getRemoteHostId()); return; } _transport.send(_builder.buildSessionCreatedPacket(state, _transport.getExternalPort(), _transport.getIntroKey())); // if they haven't advanced to sending us confirmed packets in 1s, // repeat state.setNextSendTime(now + 1000); } private void sendRequest(OutboundEstablishState state) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Send request to: " + state.getRemoteHostId().toString()); UDPPacket packet = _builder.buildSessionRequestPacket(state); if (packet != null) { _transport.send(packet); } else { if (_log.shouldLog(Log.WARN)) _log.warn("Unable to build a session request packet for " + state.getRemoteHostId()); } state.requestSent(); } private static final long MAX_NONCE = 0xFFFFFFFFl; /** if we don't get a relayResponse in 3 seconds, try again */ private static final int INTRO_ATTEMPT_TIMEOUT = 3*1000; private void handlePendingIntro(OutboundEstablishState state) { long nonce = _context.random().nextLong(MAX_NONCE); while (true) { OutboundEstablishState old = _liveIntroductions.putIfAbsent(Long.valueOf(nonce), state); if (old != null) { nonce = _context.random().nextLong(MAX_NONCE); } else { break; } } SimpleScheduler.getInstance().addEvent(new FailIntroduction(state, nonce), INTRO_ATTEMPT_TIMEOUT); state.setIntroNonce(nonce); _context.statManager().addRateData("udp.sendIntroRelayRequest", 1, 0); UDPPacket requests[] = _builder.buildRelayRequest(_transport, state, _transport.getIntroKey()); for (int i = 0; i < requests.length; i++) { if (requests[i] != null) _transport.send(requests[i]); } if (_log.shouldLog(Log.DEBUG)) _log.debug("Send intro for " + state.getRemoteHostId().toString() + " with our intro key as " + _transport.getIntroKey().toBase64()); state.introSent(); } private class FailIntroduction implements SimpleTimer.TimedEvent { private long _nonce; private OutboundEstablishState _state; public FailIntroduction(OutboundEstablishState state, long nonce) { _nonce = nonce; _state = state; } public void timeReached() { // remove only if value equal to state boolean removed = _liveIntroductions.remove(Long.valueOf(_nonce), _state); if (removed) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Send intro for " + _state.getRemoteHostId().toString() + " timed out"); _context.statManager().addRateData("udp.sendIntroRelayTimeout", 1, 0); notifyActivity(); } } } void receiveRelayResponse(RemoteHostId bob, UDPPacketReader reader) { long nonce = reader.getRelayResponseReader().readNonce(); OutboundEstablishState state = _liveIntroductions.remove(Long.valueOf(nonce)); if (state == null) return; // already established int sz = reader.getRelayResponseReader().readCharlieIPSize(); byte ip[] = new byte[sz]; reader.getRelayResponseReader().readCharlieIP(ip, 0); InetAddress addr = null; try { addr = InetAddress.getByAddress(ip); } catch (UnknownHostException uhe) { if (_log.shouldLog(Log.WARN)) _log.warn("Introducer for " + state + " (" + bob + ") sent us an invalid IP for our targer: " + Base64.encode(ip), uhe); // these two cause this peer to requeue for a new intro peer state.introductionFailed(); notifyActivity(); return; } _context.statManager().addRateData("udp.receiveIntroRelayResponse", state.getLifetime(), 0); int port = reader.getRelayResponseReader().readCharliePort(); if (_log.shouldLog(Log.INFO)) _log.info("Received relay intro for " + state.getRemoteIdentity().calculateHash().toBase64() + " - they are on " + addr.toString() + ":" + port + " (according to " + bob.toString(true) + ")"); RemoteHostId oldId = state.getRemoteHostId(); state.introduced(addr, ip, port); _outboundStates.remove(oldId); _outboundStates.put(state.getRemoteHostId(), state); notifyActivity(); } private void sendConfirmation(OutboundEstablishState state) { boolean valid = state.validateSessionCreated(); if (!valid) // validate clears fields on failure return; if (!_transport.isValid(state.getReceivedIP()) || !_transport.isValid(state.getRemoteHostId().getIP())) { state.fail(); return; } // gives us the opportunity to "detect" our external addr _transport.externalAddressReceived(state.getRemoteIdentity().calculateHash(), state.getReceivedIP(), state.getReceivedPort()); // signs if we havent signed yet state.prepareSessionConfirmed(); // BUG - handle null return UDPPacket packets[] = _builder.buildSessionConfirmedPackets(state, _context.router().getRouterInfo().getIdentity()); if (_log.shouldLog(Log.DEBUG)) _log.debug("Send confirm to: " + state.getRemoteHostId().toString()); for (int i = 0; i < packets.length; i++) _transport.send(packets[i]); state.confirmedPacketsSent(); } /** * Drive through the inbound establishment states, adjusting one of them * as necessary * @return next requested time or -1 */ private long handleInbound() { long now = _context.clock().now(); long nextSendTime = -1; InboundEstablishState inboundState = null; //if (_log.shouldLog(Log.DEBUG)) // _log.debug("# inbound states: " + _inboundStates.size()); for (Iterator<InboundEstablishState> iter = _inboundStates.values().iterator(); iter.hasNext(); ) { InboundEstablishState cur = iter.next(); if (cur.getState() == InboundEstablishState.STATE_CONFIRMED_COMPLETELY) { // completely received (though the signature may be invalid) iter.remove(); inboundState = cur; if (_log.shouldLog(Log.DEBUG)) _log.debug("Removing completely confirmed inbound state"); break; } else if (cur.getLifetime() > MAX_ESTABLISH_TIME) { // took too long, fuck 'em iter.remove(); _context.statManager().addRateData("udp.inboundEstablishFailedState", cur.getState(), cur.getLifetime()); if (_log.shouldLog(Log.DEBUG)) _log.debug("Removing expired inbound state"); } else if (cur.getState() == InboundEstablishState.STATE_FAILED) { iter.remove(); _context.statManager().addRateData("udp.inboundEstablishFailedState", cur.getState(), cur.getLifetime()); } else { if (cur.getNextSendTime() <= now) { // our turn... inboundState = cur; // if (_log.shouldLog(Log.DEBUG)) // _log.debug("Processing inbound that wanted activity"); break; } else { // nothin to do but wait for them to send us // stuff, so lets move on to the next one being // established long when = -1; if (cur.getNextSendTime() <= 0) { when = cur.getEstablishBeginTime() + MAX_ESTABLISH_TIME; } else { when = cur.getNextSendTime(); } if (when < nextSendTime) nextSendTime = when; } } } if (inboundState != null) { //if (_log.shouldLog(Log.DEBUG)) // _log.debug("Processing for inbound: " + inboundState); switch (inboundState.getState()) { case InboundEstablishState.STATE_REQUEST_RECEIVED: sendCreated(inboundState); break; case InboundEstablishState.STATE_CREATED_SENT: // fallthrough case InboundEstablishState.STATE_CONFIRMED_PARTIALLY: // if its been 5s since we sent the SessionCreated, resend if (inboundState.getNextSendTime() <= now) sendCreated(inboundState); break; case InboundEstablishState.STATE_CONFIRMED_COMPLETELY: RouterIdentity remote = inboundState.getConfirmedIdentity(); if (remote != null) { if (_context.shitlist().isShitlistedForever(remote.calculateHash())) { if (_log.shouldLog(Log.WARN)) _log.warn("Dropping inbound connection from permanently shitlisted peer: " + remote.calculateHash().toBase64()); // So next time we will not accept the con, rather than doing the whole handshake _context.blocklist().add(inboundState.getSentIP()); inboundState.fail(); break; } handleCompletelyEstablished(inboundState); break; } else { if (_log.shouldLog(Log.WARN)) _log.warn("confirmed with invalid? " + inboundState); inboundState.fail(); break; } case InboundEstablishState.STATE_FAILED: break; // already removed; case InboundEstablishState.STATE_UNKNOWN: // fallthrough default: // wtf if (_log.shouldLog(Log.ERROR)) _log.error("hrm, state is unknown for " + inboundState); } // ok, since there was something to do, we want to loop again nextSendTime = now; } return nextSendTime; } /** * Drive through the outbound establishment states, adjusting one of them * as necessary * @return next requested time or -1 */ private long handleOutbound() { long now = _context.clock().now(); long nextSendTime = -1; OutboundEstablishState outboundState = null; //int admitted = 0; //int remaining = 0; //int active = 0; //active = _outboundStates.size(); //if (_log.shouldLog(Log.DEBUG)) // _log.debug("# outbound states: " + _outboundStates.size()); for (Iterator<OutboundEstablishState> iter = _outboundStates.values().iterator(); iter.hasNext(); ) { OutboundEstablishState cur = iter.next(); if (cur == null) continue; if (cur.getState() == OutboundEstablishState.STATE_CONFIRMED_COMPLETELY) { // completely received iter.remove(); outboundState = cur; if (_log.shouldLog(Log.DEBUG)) _log.debug("Removing confirmed outbound: " + cur); break; } else if (cur.getLifetime() > MAX_ESTABLISH_TIME) { // took too long, fuck 'em iter.remove(); outboundState = cur; _context.statManager().addRateData("udp.outboundEstablishFailedState", cur.getState(), cur.getLifetime()); if (_log.shouldLog(Log.DEBUG)) _log.debug("Removing expired outbound: " + cur); break; } else { if (cur.getNextSendTime() <= now) { // our turn... outboundState = cur; // if (_log.shouldLog(Log.DEBUG)) // _log.debug("Outbound wants activity: " + cur); break; } else { // nothin to do but wait for them to send us // stuff, so lets move on to the next one being // established long when = -1; if (cur.getNextSendTime() <= 0) { when = cur.getEstablishBeginTime() + MAX_ESTABLISH_TIME; } else { when = cur.getNextSendTime(); } if ( (nextSendTime <= 0) || (when < nextSendTime) ) nextSendTime = when; // if (_log.shouldLog(Log.DEBUG)) // _log.debug("Outbound doesn't want activity: " + cur + " (next=" + (when-now) + ")"); } } } //admitted = locked_admitQueued(); //remaining = _queuedOutbound.size(); //if (admitted > 0) // _log.log(Log.CRIT, "Admitted " + admitted + " in push with " + remaining + " remaining queued and " + active + " active"); if (outboundState != null) { if (outboundState.getLifetime() > MAX_ESTABLISH_TIME) { processExpired(outboundState); } else { switch (outboundState.getState()) { case OutboundEstablishState.STATE_UNKNOWN: sendRequest(outboundState); break; case OutboundEstablishState.STATE_REQUEST_SENT: // no response yet (or it was invalid), lets retry if (outboundState.getNextSendTime() <= now) sendRequest(outboundState); break; case OutboundEstablishState.STATE_CREATED_RECEIVED: // fallthrough case OutboundEstablishState.STATE_CONFIRMED_PARTIALLY: if (outboundState.getNextSendTime() <= now) sendConfirmation(outboundState); break; case OutboundEstablishState.STATE_CONFIRMED_COMPLETELY: handleCompletelyEstablished(outboundState); break; case OutboundEstablishState.STATE_PENDING_INTRO: handlePendingIntro(outboundState); break; default: // wtf } } //if (_log.shouldLog(Log.DEBUG)) // _log.debug("Since something happened outbound, next=now"); // ok, since there was something to do, we want to loop again nextSendTime = now; } else { //if (_log.shouldLog(Log.DEBUG)) // _log.debug("Nothing happened outbound, next is in " + (nextSendTime-now)); } return nextSendTime; } private void processExpired(OutboundEstablishState outboundState) { if (outboundState.getState() != OutboundEstablishState.STATE_CONFIRMED_COMPLETELY) { if (_log.shouldLog(Log.INFO)) _log.info("Lifetime of expired outbound establish: " + outboundState.getLifetime()); while (true) { OutNetMessage msg = outboundState.getNextQueuedMessage(); if (msg == null) break; _transport.failed(msg, "Expired during failed establish"); } String err = null; switch (outboundState.getState()) { case OutboundEstablishState.STATE_CONFIRMED_PARTIALLY: err = "Took too long to establish remote connection (confirmed partially)"; break; case OutboundEstablishState.STATE_CREATED_RECEIVED: err = "Took too long to establish remote connection (created received)"; break; case OutboundEstablishState.STATE_REQUEST_SENT: err = "Took too long to establish remote connection (request sent)"; break; case OutboundEstablishState.STATE_PENDING_INTRO: err = "Took too long to establish remote connection (intro failed)"; break; case OutboundEstablishState.STATE_UNKNOWN: // fallthrough default: err = "Took too long to establish remote connection (unknown state)"; } Hash peer = outboundState.getRemoteIdentity().calculateHash(); //_context.shitlist().shitlistRouter(peer, err, UDPTransport.STYLE); _transport.markUnreachable(peer); _transport.dropPeer(peer, false, err); //_context.profileManager().commErrorOccurred(peer); } else { while (true) { OutNetMessage msg = outboundState.getNextQueuedMessage(); if (msg == null) break; _transport.send(msg); } } } /** * Driving thread, processing up to one step for an inbound peer and up to * one step for an outbound peer. This is prodded whenever any peer's state * changes as well. * */ private class Establisher implements Runnable { public void run() { while (_alive) { try { doPass(); } catch (OutOfMemoryError oom) { throw oom; } catch (RuntimeException re) { _log.log(Log.CRIT, "Error in the establisher", re); } } } } private void doPass() { _activity = 0; long now = _context.clock().now(); long nextSendTime = -1; long nextSendInbound = handleInbound(); long nextSendOutbound = handleOutbound(); if (nextSendInbound > 0) nextSendTime = nextSendInbound; if ( (nextSendTime < 0) || (nextSendOutbound < nextSendTime) ) nextSendTime = nextSendOutbound; long delay = nextSendTime - now; if ( (nextSendTime == -1) || (delay > 0) ) { if (delay > 1000) delay = 1000; boolean interrupted = false; try { synchronized (_activityLock) { if (_activity > 0) return; if (nextSendTime == -1) _activityLock.wait(1000); else _activityLock.wait(delay); } } catch (InterruptedException ie) { interrupted = true; } // if (_log.shouldLog(Log.DEBUG)) // _log.debug("After waiting w/ nextSend=" + nextSendTime // + " and delay=" + delay + " and interrupted=" + interrupted); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
38126e30725603c71d2a370e401259cc45ac3814
759ea122400f6a3c74a1cec4139c7b01ea26f8c5
/app/src/main/java/com/example/helplah/adapters/JobRequestsAdapter.java
61bf642f66b6d91ee6a50c77d9b342a7f4cadb37
[]
no_license
Jeyxiang/HelpLah
6ce89c00060af9eea3e7de939c909b8f2ea52ce1
c5a2dcb721080fd4714f221c55cf707a201b7e10
refs/heads/master
2023-06-22T01:42:26.690757
2021-07-26T10:26:07
2021-07-26T10:26:07
389,579,925
0
0
null
null
null
null
UTF-8
Java
false
false
25,551
java
package com.example.helplah.adapters; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.view.ActionMode; import androidx.cardview.widget.CardView; import androidx.core.content.ContextCompat; import androidx.navigation.Navigation; import androidx.recyclerview.widget.RecyclerView; import com.example.helplah.R; import com.example.helplah.models.ChatFunction; import com.example.helplah.models.JobRequests; import com.example.helplah.models.Listings; import com.example.helplah.models.ProfilePictureHandler; import com.firebase.ui.firestore.FirestoreRecyclerAdapter; import com.firebase.ui.firestore.FirestoreRecyclerOptions; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; import com.google.firebase.firestore.CollectionReference; import com.google.firebase.firestore.FirebaseFirestore; import java.util.ArrayList; import de.hdodenhof.circleimageview.CircleImageView; /** * A recycler view adapter that fills the Job Request adapter. This adapter is used for both * the consumer and business job request fragment. To distinguish between whether the adapter is * being used for business or consumer or interface, a boolean isBusiness is passed into the adapter's * constructor. * Clicking a job request item in the recycler view will expand it to review more information and * clicking it again will hide the extra information. Long clicking a job request item will enter * multi-select mode where the user can select multiple request and delete them. */ public class JobRequestsAdapter extends FirestoreRecyclerAdapter<JobRequests, JobRequestsAdapter.RequestsViewHolder> implements ActionMode.Callback { private static final String TAG = "Job requests adapter"; public interface RequestClickedListener { void onChatClicked(View v, JobRequests request); void deleteSelection(ArrayList<JobRequests> arrayList); void configureSupportAction(ActionMode.Callback callback); void actionTwoClicked(View v, JobRequests requests, String requestId); void actionOneClicked(JobRequests request, String documentId); } private final RequestClickedListener mListener; private final RecyclerView rv; private int mExpandedPosition = RecyclerView.NO_POSITION; private boolean multiSelect = false; private int numberOfSelected = 0; private ArrayList<JobRequests> selectedItems = new ArrayList<>(); private ActionMode actionMode; private Context context; private final boolean isBusiness; /** * Creates a new recycler view adapter that listens to firestore query in real time. * @param options The firestore options for the adapter. * @param listener The listener responsible for actions in the adspter's viewholder. * @param isBusiness Whether the adapter is being used in the business or consuemr interface. * @param rv The recycler view of the constructed adapter. */ public JobRequestsAdapter(@NonNull FirestoreRecyclerOptions<JobRequests> options, RequestClickedListener listener, boolean isBusiness, RecyclerView rv) { super(options); this.mListener = listener; this.isBusiness = isBusiness; this.rv = rv; } @NonNull @Override public RequestsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { this.context = parent.getContext(); LayoutInflater inflater = LayoutInflater.from(this.context); return new RequestsViewHolder(inflater.inflate(R.layout.job_request_list_item, parent, false)); } @Override protected void onBindViewHolder(@NonNull RequestsViewHolder holder, int position, @NonNull JobRequests model) { LinearLayout layout = holder.itemView.findViewById(R.id.expandedLayout); boolean isExpanded = position == mExpandedPosition; layout.setVisibility(isExpanded ? View.VISIBLE : View.GONE); layout.setActivated(isExpanded); holder.itemView.setActivated(isExpanded); String documentId = getSnapshots().getSnapshot(position).getId(); JobRequests request = getItem(position); holder.bind(request, documentId); holder.itemView.setOnClickListener(v -> { if (this.multiSelect) { selectRequest(holder, request); return; } mExpandedPosition = isExpanded ? -1 : position; notifyItemChanged(position); if (position + 1 == getItemCount()) { this.rv.smoothScrollToPosition(position); } }); holder.itemView.setOnLongClickListener(v -> { if (request.getStatus() == JobRequests.STATUS_CONFIRMED) { Toast.makeText(this.context, "You can only perform actions a confirmed request manually", Toast.LENGTH_SHORT).show(); return true; } if (!this.multiSelect) { this.multiSelect = true; this.mListener.configureSupportAction(JobRequestsAdapter.this); selectRequest(holder, request); } return true; }); } private void selectRequest(RequestsViewHolder holder, JobRequests selectedRequest) { if (selectedRequest.getStatus() == JobRequests.STATUS_CONFIRMED) { Toast.makeText(this.context, "You can only delete a confirmed request manually", Toast.LENGTH_SHORT).show(); return; } CardView card = holder.itemView.findViewById(R.id.requestCardView); if (this.selectedItems.contains(selectedRequest)) { this.selectedItems.remove(selectedRequest); this.numberOfSelected--; card.setAlpha(1.0f); } else { this.selectedItems.add(selectedRequest); this.numberOfSelected++; card.setAlpha(0.3f); } if (this.actionMode != null) { if (this.numberOfSelected == 0) { onDestroyActionMode(this.actionMode); } else { actionMode.setTitle(this.numberOfSelected + " selected"); } } } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { this.actionMode = mode; MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.job_request_contextual_action_bar, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == R.id.job_request_action_bar_delete) { Log.d(TAG, "onActionItemClicked: Deleting items"); deleteSelectedItems(); } return true; } @Override public void onDestroyActionMode(ActionMode mode) { this.multiSelect = false; this.numberOfSelected = 0; this.selectedItems.clear(); mode.finish(); notifyDataSetChanged(); } /** * Calls the listeners delete selection method. */ private void deleteSelectedItems() { new MaterialAlertDialogBuilder(this.context) .setTitle("Are you sure you want to remove selected requests?") .setMessage("All uncancelled requests will be cancelled and removed. This" + " action is irreversible.") .setPositiveButton("Delete", ((dialog, which) -> { this.mListener.deleteSelection(this.selectedItems); onDestroyActionMode(actionMode); })) .setNegativeButton("Dismiss", (dialog, which) -> dialog.dismiss()) .show(); } /** * ViewHolder responsible for displaying a job request information. Each job request also * has 2 action methods that differs based on the status of the job request and whether the adapter * is being used in the consumer or business context. */ public class RequestsViewHolder extends RecyclerView.ViewHolder { private static final float DEACTIVATED = 0.3f; private final CardView requestCardView; private final TextView requestName; private final TextView requestDate; private final TextView requestTime; private final TextView requestDescription; private final TextView requestTimingNote; private final TextView requestAddress; private final TextView requestContactNumber; private final TextView cancellationReason; private final TextView cancellationTitle; private final TextView optionsButton; private final CircleImageView image; private final ExtendedFloatingActionButton actionOneButton; private final ExtendedFloatingActionButton actionTwoButton; private final ExtendedFloatingActionButton chatButton; private String actionOneErrorMessage; private String actionTwoErrorMessage; public RequestsViewHolder(@NonNull View itemView) { super(itemView); this.requestCardView = itemView.findViewById(R.id.requestCardView); this.requestName = itemView.findViewById(R.id.requestName); this.requestDate = itemView.findViewById(R.id.requestDate); this.requestTime = itemView.findViewById(R.id.requestTiming); this.requestDescription = itemView.findViewById(R.id.requestDescription); this.requestTimingNote = itemView.findViewById(R.id.requestTimingNote); this.requestAddress = itemView.findViewById(R.id.requestAddress); this.requestContactNumber = itemView.findViewById(R.id.requestContactNumber); this.cancellationReason = itemView.findViewById(R.id.requestCancellationReason); this.cancellationTitle = itemView.findViewById(R.id.requestCancellationTitle); this.optionsButton = itemView.findViewById(R.id.requestOptionsButton); this.actionOneButton = itemView.findViewById(R.id.requestCancelButton); this.actionTwoButton = itemView.findViewById(R.id.requestEditButton); this.chatButton = itemView.findViewById(R.id.requestChatButton); this.image = itemView.findViewById(R.id.requestImage); Log.d(TAG, "RequestsViewHolder: created"); } public void bind(final JobRequests request, final String documentId) { Log.d(TAG, "bind: Binding called" + request.getDateOfJob()); if (selectedItems.contains(documentId)) { this.requestCardView.setAlpha(0.3f); } else { this.requestCardView.setAlpha(1f); } // set color of cardView based on status of job request this.requestCardView.setCardBackgroundColor(getColor(request)); if (isBusiness) { this.requestName.setText(request.getCustomerName()); this.requestContactNumber.setText(request.getPhoneNumber() + ""); ProfilePictureHandler.setProfilePicture(this.image, request.getCustomerId(), context); } else { this.requestName.setText(request.getBusinessName()); this.requestContactNumber.setText(request.getBusinessPhoneNumber() + ""); this.image.setOnClickListener(x -> goToListing(request)); ProfilePictureHandler.setProfilePicture(this.image, request.getBusinessId(), context); } setActionOneText(request); setActionTwoText(request); setActionOneAlpha(request); setActionTwoAlpha(request); this.requestDescription.setText(request.getJobDescription()); this.cancellationReason.setText(request.getDeclineMessage()); this.requestAddress.setText(request.getAddress()); if (request.getDeclineMessage() == null) { this.cancellationReason.setVisibility(View.GONE); this.cancellationTitle.setVisibility(View.GONE); } else { this.cancellationReason.setVisibility(View.VISIBLE); this.cancellationTitle.setVisibility(View.VISIBLE); } this.requestDate.setText(JobRequests.dateToString(request.getDateOfJob())); String time = request.getConfirmedTiming(); this.requestTime.setText(time == null ? "To be confirmed" : time); this.requestTimingNote.setText(request.getTimingNote()); configureActionTwo(request, documentId); configureActionOne(request, documentId); configureOptions(request); this.chatButton.setOnClickListener(v -> mListener.onChatClicked(v, request)); } /** * Sets the color of the view holder depending on the status of the job request. * @param request The request displayed in the viewHolder. * @return The resource id of the respective status color. */ private int getColor(JobRequests request) { if (request.getStatus() == JobRequests.STATUS_PENDING) { return ContextCompat.getColor(context, R.color.jobRequestPending); } else if (request.getStatus() == JobRequests.STATUS_CONFIRMED) { return ContextCompat.getColor(context, R.color.jobRequestAccepted); } else if (request.getStatus() == JobRequests.STATUS_FINISHED) { return ContextCompat.getColor(context, R.color.jobRequestFinished); } else { return ContextCompat.getColor(context, R.color.jobRequestCancelled); } } /** * Go to the listing of the job request in the viewHolder. This method is activated when * the user clicks the profile picture of the viewHolder. This method is only available to * consumer users and not business users. * @param request The request of the viewHolder. */ private void goToListing(JobRequests request) { String businessId = request.getBusinessId(); CollectionReference listingsDb = FirebaseFirestore.getInstance().collection(Listings.DATABASE_COLLECTION); Bundle bundle = new Bundle(); listingsDb.document(businessId).get().addOnSuccessListener(snapshot -> { Listings listing = snapshot.toObject(Listings.class); bundle.putParcelable("listing", listing); bundle.putString("id", businessId); bundle.putString("category", request.getService()); Navigation.findNavController(itemView) .navigate(R.id.action_jobRequests_to_listingDescription, bundle); }); } /** * Configures the action one button based on the isBusiness boolean. It then * calls the listener action one clicked method if the button is activated. * @param request The request of the viewHolder. * @param documentId The firestore id of the job request. */ private void configureActionOne(JobRequests request, String documentId) { this.actionOneButton.setOnClickListener(x -> { if (this.actionOneErrorMessage == null) { new MaterialAlertDialogBuilder(context) .setTitle(isBusiness ? "Are you sure you want to decline this job request?" : "Are you sure you want to cancel this job request") .setPositiveButton(isBusiness ? "Decline request" : "Cancel request", (dialog, which) -> { mListener.actionOneClicked(request, documentId); notifyDataSetChanged(); }) .setNegativeButton("Dismiss", (dialog, which) -> dialog.dismiss()) .show(); } else { Log.d(TAG, "Action one failed " + this.actionOneErrorMessage); Toast.makeText(context, this.actionOneErrorMessage, Toast.LENGTH_SHORT).show(); } }); } /** * Configures the action two button based on the isBusiness boolean. It then * calls the listener action two clicked method if the button is activated. * @param request The request of the viewHolder. * @param documentId The firestore id of the job request. */ private void configureActionTwo(JobRequests request, String documentId) { this.actionTwoButton.setOnClickListener(v -> { if (actionTwoErrorMessage != null) { Log.d(TAG, "Action two failed " + this.actionTwoErrorMessage); Toast.makeText(context, this.actionTwoErrorMessage, Toast.LENGTH_SHORT).show(); return; } mListener.actionTwoClicked(v, request, documentId); notifyItemChanged(getBindingAdapterPosition()); }); } /** * Sets the text for the action one button. * @param request The request in the viewHolder. */ private void setActionOneText(JobRequests request) { if (isBusiness) { this.actionOneButton.setText(R.string.action_one_decline); } else { this.actionOneButton.setText(R.string.action_one_cancel); } } /** * Sets the text for the action two button. * @param request The request in the viewHolder. */ private void setActionTwoText(JobRequests request) { if (isBusiness) { if (request.getStatus() == JobRequests.STATUS_CONFIRMED || request.getStatus() == JobRequests.STATUS_FINISHED) { this.actionTwoButton.setText(R.string.action_two_mark_finished); } else { this.actionTwoButton.setText(R.string.action_two_confirm); } } else { if (request.getStatus() == JobRequests.STATUS_FINISHED) { this.actionTwoButton.setText(R.string.action_two_leave_review); } else { this.actionTwoButton.setText(R.string.action_two_edit); } } } /** * Sets whether the action button is activated or not depending on the status of the * respective job request. If the button is not activated, it becomes translucent and * clicking it, will show the user the error message for the action one button about why the * action item cannot be clicked. If the action one button is activated, it will not * have an error message. * @param request The request of the ViewHolder */ private void setActionOneAlpha(JobRequests request) { if (request.getStatus() == JobRequests.STATUS_CANCELLED) { this.actionOneButton.setAlpha(DEACTIVATED); this.actionOneErrorMessage = "This request has been cancelled"; } else if (request.getStatus() == JobRequests.STATUS_FINISHED) { this.actionOneButton.setAlpha(DEACTIVATED); this.actionOneErrorMessage = "This request has already been completed"; } else if (JobRequests.isJobOver(request)) { this.actionOneButton.setAlpha(DEACTIVATED); this.actionOneErrorMessage = "Unable to cancel as Job date has passed"; } else { this.actionOneButton.setAlpha(1f); this.actionOneErrorMessage = null; } } /** * Sets whether the action button is activated or not depending on the status of the * respective job request. If the button is not activated, it becomes translucent and * clicking it, will show the user the error message for the action two button about why the * action item cannot be clicked. If the action two button is activated, it will not * have an error message. * @param request The request of the ViewHolder */ private void setActionTwoAlpha(JobRequests request) { if (isBusiness) { if (request.getStatus() == JobRequests.STATUS_FINISHED) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "This request is already marked as finished"; } else if (request.getStatus() == JobRequests.STATUS_CONFIRMED && !JobRequests.isJobOver(request)) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "You can only mark the request as finished after the job date"; } else if (request.getStatus() == JobRequests.STATUS_PENDING && JobRequests.isJobOver(request)) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "Scheduled job date has passed"; } else if (request.getStatus() == JobRequests.STATUS_CANCELLED) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "This request has been cancelled"; } else { this.actionTwoButton.setAlpha(1f); this.actionTwoErrorMessage = null; } } else { if (JobRequests.isJobOver(request) && request.getStatus() != JobRequests.STATUS_FINISHED) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "Unable to edit as job date has passed. Send a new request instead"; } else if (request.getStatus() == JobRequests.STATUS_CANCELLED) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "This request has been cancelled"; } else if (request.getStatus() == JobRequests.STATUS_FINISHED && request.isReviewed()) { this.actionTwoButton.setAlpha(DEACTIVATED); this.actionTwoErrorMessage = "This request has been reviewed"; } else { this.actionTwoButton.setAlpha(1f); this.actionTwoErrorMessage = null; } } } /** * Configures each viewHolder overflow options pop up tab. The tab provides different options * for each respective job request. * @param requests */ private void configureOptions(JobRequests requests) { this.optionsButton.setOnClickListener(v -> { PopupMenu popupMenu = new PopupMenu(context, optionsButton); if (isBusiness) { popupMenu.inflate(R.menu.business_job_request_options); } else { popupMenu.inflate(R.menu.user_job_request_options); } popupMenu.setOnMenuItemClickListener((PopupMenu.OnMenuItemClickListener) item -> { if (item.getItemId() == R.id.addRequestToCalendar && ! isBusiness) { // Open calendar Log.d(TAG, "configureOptions: Adding to calendar"); JobRequests.goToCalendar(requests, context); return true; } else if (item.getItemId() == R.id.goToLocation) { // Open google maps Log.d(TAG, "configureOptions: Going to job address location " + requests.getAddress()); JobRequests.goToAddress(requests, context); return true; } else if (item.getItemId() == R.id.call) { int number = isBusiness ? requests.getPhoneNumber() : requests.getBusinessPhoneNumber(); Intent call = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)); context.startActivity(call); } else if (item.getItemId() == R.id.chat) { String recipientName = isBusiness ? requests.getCustomerName() : requests.getBusinessName(); String recipientId = isBusiness ? requests.getCustomerId() : requests.getBusinessId(); ChatFunction.createChat(recipientId, recipientName, context); } return false; }); popupMenu.show(); }); } } }
[ "teyhaoze@gmail.com" ]
teyhaoze@gmail.com
a728d7087db8d2380d7456f62d260a0495d04599
5751de2e0ddd6822a47e031803c52c5f69447097
/jOOR-java-6/src/test/java/org/joor/test/CompileTest.java
69d54625cc99cd5db0b9c850b86b460f6a756eb7
[ "Apache-2.0" ]
permissive
selfimprW/jOOR
d08845a262ea52554b97b1404249ef8c374e897c
330f98aab8c2cfbac04ab73305dd2a71df7afe39
refs/heads/master
2020-04-07T13:37:42.829700
2018-11-19T11:44:35
2018-11-19T11:44:35
158,414,664
1
0
null
2018-11-20T15:52:35
2018-11-20T15:52:35
null
UTF-8
Java
false
false
752
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.joor.test;
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
0f87e20259aa37aea5ea47ca169f116064bce039
69d75d3198f4855b71c83550afdb8ce26101f0cd
/app/src/test/java/org/yang/verticaldrawer/ExampleUnitTest.java
d3f41c3156970f9d7375f832a467a07ea9d03aed
[]
no_license
NianyiYang/VerticalDrawer
6a3778d09164ccb3283f500c09e12f2deeb14da4
d73ff507cd4990636ae125f84598c22f0758370d
refs/heads/master
2020-05-19T13:41:32.448502
2019-05-07T11:14:29
2019-05-07T11:14:29
185,046,121
7
2
null
null
null
null
UTF-8
Java
false
false
384
java
package org.yang.verticaldrawer; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "269977322@qq.com" ]
269977322@qq.com
28f43949d7cd5ae50dbb32ec760f6b56c860cba8
ba2fa5dbf047f8ee0126001537204c880002f90a
/Wifi-direct/D2D/app/src/main/java/ee/oulu/fi/ubicomp/network/WiFiDirectBroadcastReceiver.java
8511142d1a41af051ad5f08cd8c8161194348a46
[]
no_license
huberflores/AndroidApps
4cffce6a3420ae9ba266f21133ef90f708bb21b3
f7b4290a949cb5d0a420275ff7732c3a8df0e6c5
refs/heads/master
2021-01-22T23:15:38.687701
2015-11-05T14:14:58
2015-11-05T14:14:58
14,256,198
0
0
null
null
null
null
UTF-8
Java
false
false
3,096
java
package ee.oulu.fi.ubicomp.network; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.NetworkInfo; import android.net.wifi.p2p.WifiP2pManager; import ee.oulu.fi.ubicomp.d2d.D2DWifi; /** * Created by huber on 11/3/15. */ public class WiFiDirectBroadcastReceiver extends BroadcastReceiver { private WifiP2pManager mManager; private WifiP2pManager.Channel mChannel; private D2DWifi mActivity; WifiP2pManager.PeerListListener mPeerListListener; WifiP2pManager.ConnectionInfoListener mPeerConnectionListener; public WiFiDirectBroadcastReceiver(WifiP2pManager manager, WifiP2pManager.Channel channel, D2DWifi activity, WifiP2pManager.PeerListListener mPeerListListener, WifiP2pManager.ConnectionInfoListener mPeerConnectionListener) { super(); this.mManager = manager; this.mChannel = channel; this.mActivity = activity; this.mPeerListListener = mPeerListListener; this.mPeerConnectionListener = mPeerConnectionListener; } @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { // Check to see if Wi-Fi is enabled and notify appropriate activity System.out.println("1"); int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) { // Wifi P2P is enabled System.out.println("Wifi direct is enabled"); } else { // Wi-Fi P2P is not enabled System.out.println("Wifi direct is not enabled"); } } else if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) { // Call WifiP2pManager.requestPeers() to get a list of current peers System.out.println("2"); if (mManager != null) { mManager.requestPeers(mChannel, mPeerListListener); } } else if (WifiP2pManager.WIFI_P2P_CONNECTION_CHANGED_ACTION.equals(action)) { // Respond to new connection or disconnections System.out.println("3"); if (mManager == null){ return; } NetworkInfo networkInfo = (NetworkInfo) intent.getParcelableExtra(WifiP2pManager.EXTRA_NETWORK_INFO); if (networkInfo!=null){ System.out.println(networkInfo.getState()); } if (networkInfo.isConnected()){ System.out.println("This device is connected with other device"); mManager.requestConnectionInfo(mChannel, mPeerConnectionListener); }else{ System.out.println("Something went wrong"); } } else if (WifiP2pManager.WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) { // Respond to this device's wifi state changing System.out.println("4"); } } }
[ "kyoraul@gmail.com" ]
kyoraul@gmail.com
020a3649caeee1dfed49db905c8bf0d7a54a863e
bfc29714435ded20a4814d4aa48d15e35f80771a
/src/main/java/ru/itsjava/core/patterns/creational/builder/builders/CarBuilder.java
b0a0f684d1663fa31e50509f0bb38ec112fcf577
[]
no_license
NatlieIva/java-foundations
23f71a58e0e43bc3c69c53285e8203323cb3c0b2
837c9cdf45fd916cfa426efa4a81d3b72d363d8a
refs/heads/master
2023-03-06T17:28:51.459139
2021-02-16T12:23:42
2021-02-16T12:23:42
298,633,228
0
0
null
null
null
null
UTF-8
Java
false
false
1,621
java
package ru.itsjava.core.patterns.creational.builder.builders; import ru.itsjava.core.patterns.creational.builder.cars.Car; import ru.itsjava.core.patterns.creational.builder.cars.CarType; import ru.itsjava.core.patterns.creational.builder.components.Engine; import ru.itsjava.core.patterns.creational.builder.components.GPSNavigator; import ru.itsjava.core.patterns.creational.builder.components.Transmission; import ru.itsjava.core.patterns.creational.builder.components.TripComputer; /** * Конкретные строители реализуют шаги, объявленные в общем интерфейсе. */ public class CarBuilder implements Builder { private CarType type; private int seats; private Engine engine; private Transmission transmission; private TripComputer tripComputer; private GPSNavigator gpsNavigator; public void setCarType(CarType type) { this.type = type; } @Override public void setSeats(int seats) { this.seats = seats; } @Override public void setEngine(Engine engine) { this.engine = engine; } @Override public void setTransmission(Transmission transmission) { this.transmission = transmission; } @Override public void setTripComputer(TripComputer tripComputer) { this.tripComputer = tripComputer; } @Override public void setGPSNavigator(GPSNavigator gpsNavigator) { this.gpsNavigator = gpsNavigator; } public Car getResult() { return new Car(type, seats, engine, transmission, tripComputer, gpsNavigator); } }
[ "natalie_iva@icloud.com" ]
natalie_iva@icloud.com
ca59a9c68c2b1b14baf9677615484588ae5d7718
c66c319e830ebb6b17cb72ff21233b1011f3701f
/mdd-core/src/main/java/io/mateu/mdd/core/interfaces/VoidStylist.java
759d5d72b4381b772b93cb0271dd26a88edf8bd4
[ "Beerware" ]
permissive
javierdotnet/mateu-mdd
d853ce7df6df3987c47dce7b94f669d8df227228
096854d5f102c750979b19faf76b1ab3838aa763
refs/heads/master
2020-03-22T20:10:43.234945
2018-07-05T04:58:53
2018-07-05T04:58:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package io.mateu.mdd.core.interfaces; import io.mateu.mdd.core.reflection.FieldInterfaced; import javafx.util.Pair; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class VoidStylist extends AbstractStylist { @Override public List<String> style(FieldInterfaced field, Object model) { return null; } }
[ "miguelperezcolom@gmail.com" ]
miguelperezcolom@gmail.com
4c318d10dd731279c4ac123217017e2438b8460d
24c62923c9622a94972687ba841200cf4eefd25b
/src/com/kafka/example/Run.java
6bad4c8725236484c9e59fc4c6c52352cd495ee0
[]
no_license
kingmaker7/kafkademo1
8dab33fc9e9c1ce1a774784aa90ccdff213727a9
2ee9dfddbb580b9c4e857e02e0b2917066a65416
refs/heads/master
2022-06-22T23:03:52.731635
2020-05-14T10:37:21
2020-05-14T10:37:21
263,883,356
0
0
null
null
null
null
UTF-8
Java
false
false
1,337
java
package com.kafka.example; import java.io.IOException; public class Run { public static void main(String[] args) throws IOException { /* * if(args.length < 3) { usage(); } */ // Get the brokers String brokers = "localhost:9092"; String topicName = "mysqldata"; String run="consumer"; switch(run.toLowerCase()) { case "producer": Producer.produce(brokers, topicName); break; case "consumer": String groupId = "SampleProducer"; Consumer.consume(brokers, groupId, topicName); break; case "describe": AdminClientWrapper.describeTopics(brokers, topicName); break; case "create": AdminClientWrapper.createTopics(brokers, topicName); break; case "delete": AdminClientWrapper.deleteTopics(brokers, topicName); break; default: usage(); } System.exit(0); } // Display usage public static void usage() { System.out.println("Usage:"); System.out.println("kafka-example.jar <producer|consumer|describe|create|delete> <topicName> brokerhosts [groupid]"); System.exit(1); } }
[ "viewprasad7@gmail.com" ]
viewprasad7@gmail.com
182f5c5a75daf4a724276fa1ca6065ea7949b330
878c385d794183f0b97d49602d30c640c77e78eb
/MensajesWhatsapp/app/src/main/java/com/roberto/mensajeswhatsapp/ListadoMensajesAdapter.java
2efa46e0f2ad87e4179ef80c02ceef9275b06d9e
[]
no_license
robertomorera/MensajesWhatsapp
47a8af442d54c14738c08f35f0379c1a6067e997
59ae887f8156eef2c17b215aa032029c6df82ab0
refs/heads/master
2021-01-22T19:40:55.033156
2017-03-16T17:45:38
2017-03-16T17:45:38
85,225,362
0
0
null
null
null
null
UTF-8
Java
false
false
2,386
java
package com.roberto.mensajeswhatsapp; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; /** * Created by Usr on 14/03/2017. */ public class ListadoMensajesAdapter extends BaseAdapter { private Context context; public ListadoMensajesAdapter(Context context){ this.context=context; } @Override public int getCount() { //Guardamos en un SharedPreferences el mensaje enviado al WhatsApp. SharedPreferences sp=context.getSharedPreferences("historicoMensajes", Context.MODE_PRIVATE); //Recuperamos el numero de mensajes enviados. int numMensajes=sp.getInt("numMensajes",0); return numMensajes; } @Override public View getView(int position, View convertView, ViewGroup parent) { View filaInflada=null; Log.d(getClass().getCanonicalName(),"Entrada al método getView() se añade el elemento en la posición "+position); if(convertView==null){ Activity activity=(Activity)context; LayoutInflater layoutInflater=activity.getLayoutInflater(); Log.d(getClass().getCanonicalName(),"Creamos la vista de nuevo"); filaInflada=layoutInflater.inflate(R.layout.fila,parent,false); }else{ Log.d(getClass().getCanonicalName(),"Reciclamos la vista"); filaInflada=convertView; } //Obtenemos el TextView de la fila inflada. TextView tvMensaje=(TextView)filaInflada.findViewById(R.id.mensaje_recuperado); SharedPreferences sp=context.getSharedPreferences("historicoMensajes", Context.MODE_PRIVATE); //Recuperamos el numero de mensaje enviado. int contador=position+1; String mensajeRecuperado=sp.getString("mensaje"+contador,""); Log.d(getClass().getCanonicalName(),"Se ha recuperado del SP el mensaje: "+mensajeRecuperado); //Seteamos el mensaje recuperado. tvMensaje.setText(mensajeRecuperado); return filaInflada; } @Override public Object getItem(int position) { return null; } @Override public long getItemId(int position) { return 0; } }
[ "r.moreralopez@gmail.com" ]
r.moreralopez@gmail.com
1f49233cba0a42548b7910cdcdde1691f37a6a14
5664c88f0c1b8ca54165f6c048d2a546e8673e32
/shakespeare-core/src/test/java/org/hombro/acting/shakespeare/example/murder/KillExample.java
599337ca1958cafdab9e44e8706bb79ed2ecc69f
[]
no_license
nhomble/shakespeare
5066cf134430b731d87c93d2af4107a4e6f985cb
c4ec128d6dd618c30e0815bcaf08c1f09817ffaa
refs/heads/master
2020-04-13T19:51:24.375670
2018-12-29T11:11:07
2018-12-29T11:11:07
163,414,268
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package org.hombro.acting.shakespeare.example.murder; import org.hombro.acting.shakespeare.Theatre; import org.hombro.acting.shakespeare.runtime.RootClientActor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class KillExample { private static final Logger log = LoggerFactory.getLogger(KillExample.class); public static void main(String... args) throws InterruptedException { Theatre theatre = Theatre.builder() .setName("killing") .build() .start(); theatre.spawn(OwnerActor.class); Thread.sleep(1_000); log.info("list={}", theatre.getActors()); theatre.kill(RootClientActor.REFERENCE.append(OwnerActor.class)); Thread.sleep(1_000); log.info("list={}", theatre.getActors()); theatre.shutdown(); } }
[ "nhomble@terpmail.umd.edu" ]
nhomble@terpmail.umd.edu
7f4e9a22e9335639f4262f0b853307e2caa6afdd
5da95ea6ccd47c4d9f95bf95a30a2fbd8e9b4fa2
/src/main/java/klm/model/http_response/Itinerary.java
4430eb5b441edcb8b642f4a92afaa4bd91ea35d6
[]
no_license
ionut-pruteanu/klm-testerum
29ccaaeff1f0178afecced4ad6955332b97d7184
f8b3e613d3e29ccea7cb0e28085e34c7ea110529
refs/heads/master
2022-12-29T23:34:34.516389
2020-10-23T10:43:01
2020-10-23T10:43:01
301,164,865
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package klm.model.http_response; import java.util.List; public class Itinerary { public List<FlightProduct> flightProducts; public List<Connection> connections; }
[ "ionut.pruteneau@ah.nl" ]
ionut.pruteneau@ah.nl
145ce56f538830bd8dd9d57c3a686d1a6e8d37eb
5fbe0cba86b6a681049574e717c33484fa505057
/BabaGame_program/src/OldMaid.java
bb0cba9f1237c13f44c7ea8a8a3785eca5194868
[]
no_license
krystalmm/Java_ObjectStudy
b29544395fe46c0a2a60282d64846ab19398008a
47ca8bc5739c033366161a56dd7749c20f17a80c
refs/heads/master
2023-07-01T05:20:58.536279
2021-07-26T14:03:01
2021-07-26T14:03:01
384,865,385
0
0
null
null
null
null
UTF-8
Java
false
false
1,330
java
/* * ババ抜きプログラム */ public class OldMaid { public static void main(String[] args) { // 進行役の生成 Master master = new Master(); // テーブルの生成 Table field = new Table(); // プレイヤーの生成 Player murata = new Player("村田", master, field); Player yamada = new Player("山田", master, field); Player saito = new Player("斉藤", master, field); // 進行役へプレイヤーを登録 master.registerPlayer(murata); master.registerPlayer(yamada); master.registerPlayer(saito); // トランプを生成する Hand trump = createTrump(); // ゲームの準備をする master.prepareGame(trump); // ゲームを開始する master.startGame(); } /** * 53枚のトランプを生成する * * @return トランプを格納したHand */ private static Hand createTrump() { Hand trump = new Hand(); // 各スート53枚のカードを生成する for (int number = 1; number <= 13; number++) { trump.addCard(new Card(Card.SUIT_CLUB, number)); trump.addCard(new Card(Card.SUIT_DIAMOND, number)); trump.addCard(new Card(Card.SUIT_HEART, number)); trump.addCard(new Card(Card.SUIT_SPADE, number)); } // ジョーカーの作成 trump.addCard(new Card(0, Card.JOKER)); return trump; } }
[ "taeyeon_aina@live.jp" ]
taeyeon_aina@live.jp
d57454e2a86ce294facb5863b8cdc42025af0479
8da9476ba9f5320d5031883ed7afc9153d7c7b95
/Demo/src/main/java/cn/xishan/oftenporter/demo/oftendb/test1/TestForMem2.java
8dfdd37cd8aad570827f0a9c2793dc603d44b5c6
[ "Apache-2.0" ]
permissive
gzxishan/OftenPorter
84de9d3e6fcd8e9706809ab63ce3e01cb3d8568d
a854f55feebb14baea27c5bb5229b9cfcefb4910
refs/heads/master
2023-04-29T19:07:17.829277
2021-09-10T02:56:47
2021-09-10T02:56:47
77,967,732
7
5
Apache-2.0
2023-04-17T19:37:29
2017-01-04T01:19:35
Java
UTF-8
Java
false
false
612
java
package cn.xishan.oftenporter.demo.oftendb.test1; /** * @author Created by https://github.com/CLovinr on 2018/9/22. */ public class TestForMem2 { static class TempObject{ Object object = new Object(); public TempObject() { System.out.println(this.hashCode()); } } public static void main(String[] args) throws InterruptedException { while (true){ test(); Thread.sleep(500); } } static void test(){ for (int i = 0; i < 1000; i++) { new TempObject(); } } }
[ "zggzcyg@qq.xom" ]
zggzcyg@qq.xom
3bc3870f4613206b6603a1fbdb41524599fc6b53
6b0a5c5a695ed9333e4260b9e5fcca82bc91b34d
/src/main/zhangliang/subdomainvisits/SubdomainVisits.java
09447726426413b872bf5635f728b217f714d683
[]
no_license
cliuyide/suanfa
bc136ab2940b994cb46e0a2eccf77704f01bc3e9
0056198446169021e8a4659f0b63d122569e01f5
refs/heads/master
2021-06-16T19:58:22.229511
2019-08-08T00:10:15
2019-08-08T00:10:15
134,652,307
1
0
null
null
null
null
UTF-8
Java
false
false
2,012
java
package main.zhangliang.subdomainvisits; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; /** * https://leetcode.com/problems/subdomain-visit-count/description/ */ public class SubdomainVisits { public static void main(String[] args) { System.out.println(new SubdomainVisits().subdomainVisits(new String[] { "9001 discuss.leetcode.com" })); } /** * 52 / 52 test cases passed.Runtime: 28 ms * * @param cpdomains * @return */ public List<String> subdomainVisits(String[] cpdomains) { List<String> result = new ArrayList<>(); Map<String, Integer> map = new HashMap<>(); if (cpdomains != null && cpdomains.length > 0) { for (String cpdomain : cpdomains) { countDomainVisists(cpdomain, map); } } Iterator<Entry<String, Integer>> iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, Integer> entry = iterator.next(); result.add(entry.getValue() + " " + entry.getKey()); } return result; } private static void countDomainVisists(String cpdomain, Map<String, Integer> map) { String[] arr = cpdomain.split(" "); Integer count = Integer.valueOf(arr[0]); cpdomain = arr[1]; Integer existedCount = map.get(cpdomain); if (existedCount == null) { map.put(cpdomain, count); } else { map.put(cpdomain, count + existedCount); } while (true) { int index = cpdomain.indexOf("."); if (index < 0) break; cpdomain = cpdomain.substring(index + 1); existedCount = map.get(cpdomain); if (existedCount == null) { map.put(cpdomain, count); } else { map.put(cpdomain, count + existedCount); } } } }
[ "zl1230456zl@126.com" ]
zl1230456zl@126.com
0137485c423bff84d109aa23b4868e7aacf49e73
7d5473008bc25b88bdc5197f34d19e7ef4a1256c
/src/main/java/net/hollowbit/archipeloserver/tools/inventory/InfiniteInventory.java
3273f454c15ce2ec70fbd5f894aada24fbc47d35
[ "MIT" ]
permissive
hollowbit/ArchipeloServer
3172a9360814d33abb69144cf60aabf371b056a9
0b222400e11eea0b42f43fa4a59dfc1c31a6c2f4
refs/heads/master
2021-03-24T12:49:24.989782
2019-01-01T19:14:51
2019-01-01T19:14:51
73,635,061
5
1
null
null
null
null
UTF-8
Java
false
false
5,166
java
package net.hollowbit.archipeloserver.tools.inventory; import java.util.ArrayList; import java.util.LinkedList; import net.hollowbit.archipeloserver.items.Item; import net.hollowbit.archipeloserver.tools.StaticTools; /** * Inventory with an infinite amount of space. Can never run out. * @author Nathanael * */ public class InfiniteInventory extends Inventory { private ArrayList<Item> storage; public InfiniteInventory () { storage = new ArrayList<Item>(); } public InfiniteInventory (ArrayList<Item> startItems) { storage = startItems; } public InfiniteInventory (Inventory inventoryToDuplicate) { this.storage = new ArrayList<Item>(); for (int i = 0; i < inventoryToDuplicate.getRawStorage().length; i++) { if (inventoryToDuplicate.getRawStorage()[i] != null) this.storage.add(new Item(inventoryToDuplicate.getRawStorage()[i])); } } @Override public Item add (Item item) { for (Item storageItem : storage) { if (storageItem.isSameType(item)) { int spaceLeftInSlot = storageItem.getType().maxStackSize - storageItem.quantity; if (item.quantity > spaceLeftInSlot) { storageItem.quantity += spaceLeftInSlot; item.quantity -= spaceLeftInSlot; } else { storageItem.quantity += item.quantity; item.quantity = 0; } if (item.quantity <= 0) { return null; } } } if (item.quantity > item.getType().maxStackSize) { while (item.quantity > item.getType().maxStackSize) { Item itemToAdd = new Item(item); itemToAdd.quantity = item.getType().maxStackSize; storage.add(itemToAdd); item.quantity -= item.getType().maxStackSize; } storage.add(item); clean(); } else { storage.add(item); } return null; } @Override public boolean remove (Item item) { return this.remove(item, true); } @Override public boolean remove (Item item, boolean ignoreStyle) { if (!hasItem(item, ignoreStyle)) return false; for (Item storageItem : storage) { if (storageItem.isSame(item, ignoreStyle)) { if (storageItem.quantity < item.quantity) { item.quantity -= storageItem.quantity; storageItem.quantity = 0; } else { storageItem.quantity -= item.quantity; item.quantity = 0; } if (item.quantity <= 0) break; } } clean(); return true; } @Override public boolean move(int fromSlot, int toSlot) { return this.move(fromSlot, toSlot, true); } @Override public boolean move(int fromSlot, int toSlot, boolean ignoreStyle) { if (!doesSlotExists(toSlot) || isSlotEmpty(fromSlot)) return false; Item fromItem = storage.get(fromSlot); Item toItem = storage.get(toSlot); if (fromItem.isSame(toItem, ignoreStyle)) { int spaceLeftInSlot = toItem.getType().maxStackSize - toItem.quantity; if (fromItem.quantity > spaceLeftInSlot) { toItem.quantity += spaceLeftInSlot; fromItem = new Item(fromItem); storage.get(fromSlot).quantity = 0; add(fromItem); } else { toItem.quantity += fromItem.quantity; fromItem.quantity = 0; } } else { storage.set(toSlot, fromItem); storage.set(fromSlot, toItem); } return true; } @Override public boolean hasItem(Item item, boolean ignoreStyle) { int quantityFound = 0; for (Item storageItem : storage) { if (storageItem.isSame(item, ignoreStyle)) { quantityFound += storageItem.quantity; if (quantityFound >= item.quantity) return true; } } return quantityFound >= item.quantity; } @Override public boolean isInventoryFull() { return false;//Infinite space means never full } @Override public boolean isSlotEmpty (int slot) { if (doesSlotExists(slot)) return storage.get(slot) == null; else return true; } @Override protected void clean() { LinkedList<Item> itemsToRemove = new LinkedList<Item>(); for (Item item : storage) { if (item.quantity <= 0) itemsToRemove.add(item); } storage.removeAll(itemsToRemove); } @Override public boolean doesSlotExists (int slot) { return slot < storage.size() && slot >= 0; } @Override public String getJson() { return StaticTools.getJson().toJson(storage); } @Override public Item setSlot (int slot, Item item) { if (!doesSlotExists(slot)) return null; Item replacedItem = removeFromSlot(slot); storage.set(slot, item); return replacedItem; } @Override public Item removeFromSlot (int slot) { if (!doesSlotExists(slot)) return null; Item item = storage.get(slot); storage.set(slot, null); return item; } @Override public Item[] getRawStorage() { Item[] storageArray = new Item[storage.size()]; storageArray = storage.toArray(storageArray); return storageArray; } @Override public Inventory duplicate () { return new InfiniteInventory(this); } @Override public void deleteItemInSlot(int slot) { if (doesSlotExists(slot)) storage.remove(slot); } }
[ "vedioboy07@gmail.com" ]
vedioboy07@gmail.com
364ead4f332e94c5996ed68f9b3602af03c9242d
b61fbe9542c19ef948fdf0b65a484f0dbfad2ba5
/SMS_Dropwizard/src/main/java/com/flipkart/dao/UserDAOImpl.java
394545a9917e2e1e84e4590d8abfe36bb7e494be
[]
no_license
Jonty0098/Jedi5_Flipkart
4b538178a73cebcd8f320fc02c63e405527a9259
0d1379d8f0fa70d382d7936fe218f35c5057c1f9
refs/heads/master
2023-04-16T09:31:18.415001
2020-11-10T06:44:14
2020-11-10T06:44:14
309,564,531
0
1
null
2021-05-01T16:24:44
2020-11-03T03:42:44
HTML
UTF-8
Java
false
false
1,484
java
/** * */ package com.flipkart.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import org.apache.log4j.Logger; import com.flipkart.bean.Student; import com.flipkart.business.AdminService; import com.flipkart.business.AdminServiceImpl; import com.flipkart.business.ProfessorServiceImpl; import com.flipkart.business.StudentServiceImpl; import com.flipkart.constants.SqlQueries; import com.flipkart.utils.DBUtil; /** * @author ShabbirMoosakhan * */ public class UserDAOImpl { private static Logger logger = Logger.getLogger(AthenticationDAOImpl.class); private Connection connection = DBUtil.getConnection(); PreparedStatement stmt =null; public void GetDetailsDAO(int Id) { StudentServiceImpl ssi = new StudentServiceImpl(); AdminService asi = new AdminServiceImpl(); ProfessorServiceImpl psi = new ProfessorServiceImpl(); try { stmt = connection.prepareStatement(SqlQueries.GetUser); stmt.setInt(1, Id); ResultSet rs1 = stmt.executeQuery(); rs1.next(); int id =rs1.getInt("id"); String role = rs1.getString("role"); switch(role) { case "P": //psi.view(id); break; case "S": //ssi.view(id); break; case "A": //asi.view(id); break; } }catch(Exception ex){ logger.error(ex.getMessage()); } finally{ //close resources DBUtil.closeStmt(stmt); } } }
[ "burhan31298@gmail.com" ]
burhan31298@gmail.com
f04efe1c9af63d188c4422374885520276d035b9
42598fee1e0db097f65f1c1fb4a045d8bff5aa54
/src/main/java/netty/omp/client/NettyClient.java
5923151236de8af3353c6217289aa30519a58894
[]
no_license
harksoo/message-stomp-websocket
2153ccaa4488008dacba093bdcc4be8e1db0c0b7
88a757389e93bd38ccfa57958b7647d8a7fada9b
refs/heads/master
2020-12-24T13:44:18.801550
2015-08-31T00:09:52
2015-08-31T00:09:52
39,748,671
0
3
null
null
null
null
UTF-8
Java
false
false
2,308
java
package netty.omp.client; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelInitializer; import io.netty.channel.EventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.timeout.IdleStateHandler; public class NettyClient { static final String HOST = System.getProperty("host", "10.10.3.152"); static final int PORT = Integer.parseInt(System.getProperty("port", "19595")); // Sleep 5 seconds before a reconnection attempt. static final int RECONNECT_DELAY = Integer.parseInt(System.getProperty("reconnectDelay", "5")); // Reconnect when the server sends nothing for 10 seconds. static final int READ_TIMEOUT = Integer.parseInt(System.getProperty("readTimeout", "10")); private static final NettyClientHandler handler = new NettyClientHandler(); public static void main(String[] args) throws Exception { configureBootstrap(new Bootstrap()).connect(); } private static Bootstrap configureBootstrap(Bootstrap b) { return configureBootstrap(b, new NioEventLoopGroup()); } static Bootstrap configureBootstrap(Bootstrap b, EventLoopGroup g) { b.group(g) .channel(NioSocketChannel.class) .remoteAddress(HOST, PORT) .handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new IdleStateHandler(READ_TIMEOUT, 0, 0), handler); } }); return b; } static void connect(Bootstrap b) { b.connect().addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.cause() != null) { handler.startTime = -1; handler.println("Failed to connect: " + future.cause()); } } }); } static boolean sendMsg(String msg){ return true; } }
[ "harksoo1974@gmail.com" ]
harksoo1974@gmail.com
263a86360f2edc516624a2e3aa7e296f693e77f6
d66648bc038a81feb74e8270cce3df3fd51f5ba6
/src/Model/ProductInvoice.java
9e1ae9f39592a9ff798c5f32fbfaf5e11f22e22c
[]
no_license
abdullahshamsahmed/java-project-Invoice_Generator-
6d10a85f806b865da093adbe972394cdd6903c3b
098ea4e1855176824714a8fd2873bb39cd1ee647
refs/heads/master
2020-05-22T07:40:29.259444
2019-05-12T15:18:54
2019-05-12T15:18:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
49
java
package Model; public class ProductInvoice { }
[ "t@gmail.com" ]
t@gmail.com
db4f0d9e6b796422e184f24bbc3d6df74628c6a8
2a1ff6b61653b96388b59a20a1da58af720e147c
/src/main/java/com/gym/dsm/fitness/services/Auth/AuthServiceImpl.java
f7b55d50a2f78837a343da1ca2ed277128b381eb
[]
no_license
FitnessCenter/GYM-Backend
0715304aaf0ed41d8034c919616d01e9cb43d3d7
bb3359e479d5cb59868c13b52886bf3b5e8062f2
refs/heads/master
2022-12-15T10:57:16.510601
2020-09-22T00:18:43
2020-09-22T00:18:43
281,690,821
0
1
null
2020-09-22T00:18:44
2020-07-22T13:51:35
Java
UTF-8
Java
false
false
1,457
java
package com.gym.dsm.fitness.services.Auth; import com.gym.dsm.fitness.entities.user.User; import com.gym.dsm.fitness.entities.user.repository.UserRepository; import com.gym.dsm.fitness.exceptions.AuthenticationFailedException; import com.gym.dsm.fitness.payloads.requests.SignInRequest; import com.gym.dsm.fitness.payloads.responses.SignInResponse; import com.gym.dsm.fitness.security.JWTProvider; import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import java.util.Optional; @Service @RequiredArgsConstructor public class AuthServiceImpl implements AuthService { private final UserRepository userRepository; private final PasswordEncoder passwordEncoder; private final JWTProvider jwtProvider; @Override public SignInResponse signIn(SignInRequest signInRequest) { userRepository.findById(signInRequest.getId()) .filter(user -> passwordEncoder.matches(signInRequest.getPassword(), user.getPassword())) .orElseThrow(AuthenticationFailedException::new); String accessToken = jwtProvider.generateAccessToken(signInRequest.getId()); String refreshToken = jwtProvider.generateRefreshToken(signInRequest.getId()); return SignInResponse.builder() .accessToken(accessToken) .refreshToken(refreshToken) .build(); } }
[ "migsking@naver.com" ]
migsking@naver.com
0163a555c24870b08ef2e2888116a6259e6a30ec
952a242c4e7f0f02c50db757ee81c51fc28b575b
/minicad/src/main/java/com/baislsl/minicad/shape/ShapeType.java
c53c2f21d798b73ec4cdd1ba0b9289534b615820
[]
no_license
838619643/JAD
3ddcf84d9d06531ba7905034b18726ee6d47a0e9
23d73213571039467fe0061eea9148b1eee1e610
refs/heads/master
2020-08-11T17:21:52.777415
2018-01-24T12:19:41
2018-01-24T12:19:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
java
package com.baislsl.minicad.shape; import com.baislsl.minicad.ui.draw.DrawBoard; import com.baislsl.minicad.ui.draw.DrawPanel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public enum ShapeType { LINE(LineShape.class), RECTANGLE(RectangleShape.class), TEXT(TextShape.class), CIRCLE(CircleShape.class), OVAL(OvalShape.class); private final static Logger log = LoggerFactory.getLogger(ShapeType.class); private Class<?> shapeClazz; ShapeType(Class<?> shapeClazz) { this.shapeClazz = shapeClazz; } public Class<?> getShapeClazz() { return shapeClazz; } public Shape newShapeInstance(DrawBoard drawBoard, int x1, int y1, int x2, int y2) { try { return (Shape) this.shapeClazz.asSubclass(shapeClazz) .getDeclaredConstructor(DrawBoard.class, int.class, int.class, int.class, int.class) .newInstance(drawBoard, x1, y1, x2, y2); } catch (Exception e) { log.error("error constructing new shape ", e); } return null; } }
[ "baislsl666@gmail.com" ]
baislsl666@gmail.com
2967675d697aedf0502fd9a02a67b5758d265f10
3147cb8386967ce76b8ea04eb8fce32a2947b72b
/src/main/java/com/company/BeanTest.java
8ddad5e625ebdfb8631e0d6ba6cac2328f5545da
[]
no_license
yszzu1/spring-source-read
d8855242dd5692f950e4b70c0fd52816ab16b8c8
4bd452035ea00df8f6736b343788a8a65c8aca80
refs/heads/master
2021-01-22T23:58:40.130197
2017-03-22T02:39:31
2017-03-22T02:39:31
85,686,007
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.company; import com.beans.BeanA; import org.springframework.context.support.FileSystemXmlApplicationContext; /** * Created by yanshuai on 2017/3/21. */ public class BeanTest { public static void main(String[] args) { FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("classpath:application.xml"); BeanA beana = (BeanA) context.getBean("beanA"); beana.printInfo(); } }
[ "yanshuai@YANSHUAI.byhz.com" ]
yanshuai@YANSHUAI.byhz.com
30af02d25070340b7cacfb85f67b9cef5651e6b4
75f85a6eab9e79fe4780e1d5a6f2df4b96db4db2
/src/main/java/com/vehicle/auto/click/task/UIFrame.java
02f5c27f4925a80403853d7d730598e5e6038c14
[]
no_license
NoobsZero/vehicle-auto-clicks
98384142a827d299ec6483454e0bcaf22dc29053
e780bebcdf86d6dccf62f0885af6ad637388d6db
refs/heads/master
2023-07-15T18:52:02.688765
2021-08-31T10:15:05
2021-08-31T10:25:59
401,658,597
0
0
null
null
null
null
UTF-8
Java
false
false
455
java
package com.vehicle.auto.click.task; import javax.swing.*; /** * @ProjectName: vehicle-auto-clicks * @Package: com.vehicle.auto.click.task * @ClassName: UIFrame * @Description: 类作用描述 * @Author: Chen * @contact: Afakerchen@em-data.com.cn * @software: IntelliJ IDEA * @CreateDate: 2021/8/31 18:05 */ public class UIFrame extends JFrame{ private SwingWorker w = null; public UIFrame(String title) { super(title); } }
[ "870628995@qq.com" ]
870628995@qq.com
8bf3cd10536340e782503d451ef9ec970d6533e6
e9175c18bfa2afc4977fc9d7c58faf0abbb48033
/api/src/main/java/io/strimzi/api/kafka/model/TopicOperatorSpec.java
018bef65b1166ab5d04b8005c36de4c2a0a30ecb
[ "Apache-2.0" ]
permissive
sasg/strimzi-kafka-operator
aa6e024e4e1a7ac44e994a1f30dd840338587769
c44cfc333f677601b358ffc1f4216df56113f9be
refs/heads/master
2020-03-25T23:02:07.000059
2018-08-09T20:38:05
2018-08-09T20:38:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,581
java
/* * Copyright 2018, Strimzi authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package io.strimzi.api.kafka.model; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.fabric8.kubernetes.api.model.Affinity; import io.strimzi.crdgenerator.annotations.Description; import io.strimzi.crdgenerator.annotations.KubeLink; import io.strimzi.crdgenerator.annotations.Minimum; import io.sundr.builder.annotations.Buildable; import java.io.Serializable; import java.util.HashMap; import java.util.Map; /** * Representation of a Strimzi-managed topic operator deployment.. */ @Buildable( editableEnabled = false, generateBuilderPackage = true, builderPackage = "io.strimzi.api.kafka.model" ) @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({"watchedNamespace", "image", "reconciliationIntervalSeconds", "zookeeperSessionTimeoutSeconds", "affinity", "resources", "topicMetadataMaxAttempts", "tlsSidecar"}) public class TopicOperatorSpec implements Serializable { private static final long serialVersionUID = 1L; public static final String DEFAULT_IMAGE = System.getenv().getOrDefault( "STRIMZI_DEFAULT_TOPIC_OPERATOR_IMAGE", "strimzi/topic-operator:latest"); public static final String DEFAULT_TLS_SIDECAR_IMAGE = System.getenv().getOrDefault("STRIMZI_DEFAULT_TLS_SIDECAR_TOPIC_OPERATOR_IMAGE", "strimzi/topic-operator-stunnel:latest"); public static final int DEFAULT_REPLICAS = 1; public static final int DEFAULT_HEALTHCHECK_DELAY = 10; public static final int DEFAULT_HEALTHCHECK_TIMEOUT = 5; public static final int DEFAULT_ZOOKEEPER_PORT = 2181; public static final int DEFAULT_BOOTSTRAP_SERVERS_PORT = 9091; public static final int DEFAULT_FULL_RECONCILIATION_INTERVAL_SECONDS = 90; public static final int DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_SECONDS = 20; public static final int DEFAULT_TOPIC_METADATA_MAX_ATTEMPTS = 6; private String watchedNamespace; private String image = DEFAULT_IMAGE; private int reconciliationIntervalSeconds = DEFAULT_FULL_RECONCILIATION_INTERVAL_SECONDS; private int zookeeperSessionTimeoutSeconds = DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_SECONDS; private int topicMetadataMaxAttempts = DEFAULT_TOPIC_METADATA_MAX_ATTEMPTS; private Resources resources; private Affinity affinity; private Logging logging; private Sidecar tlsSidecar; private Map<String, Object> additionalProperties = new HashMap<>(0); @Description("The namespace the Topic Operator should watch.") public String getWatchedNamespace() { return watchedNamespace; } public void setWatchedNamespace(String watchedNamespace) { this.watchedNamespace = watchedNamespace; } @Description("The image to use for the topic operator") public String getImage() { return image; } public void setImage(String image) { this.image = image; } @Description("Interval between periodic reconciliations.") @Minimum(0) public int getReconciliationIntervalSeconds() { return reconciliationIntervalSeconds; } public void setReconciliationIntervalSeconds(int reconciliationIntervalSeconds) { this.reconciliationIntervalSeconds = reconciliationIntervalSeconds; } @Description("Timeout for the Zookeeper session") @Minimum(0) public int getZookeeperSessionTimeoutSeconds() { return zookeeperSessionTimeoutSeconds; } public void setZookeeperSessionTimeoutSeconds(int zookeeperSessionTimeoutSeconds) { this.zookeeperSessionTimeoutSeconds = zookeeperSessionTimeoutSeconds; } @Description("The number of attempts at getting topic metadata") @Minimum(0) public int getTopicMetadataMaxAttempts() { return topicMetadataMaxAttempts; } public void setTopicMetadataMaxAttempts(int topicMetadataMaxAttempts) { this.topicMetadataMaxAttempts = topicMetadataMaxAttempts; } @Description("Resource constraints (limits and requests).") public Resources getResources() { return resources; } @Description("Resource constraints (limits and requests).") public void setResources(Resources resources) { this.resources = resources; } @Description("Pod affinity rules.") @KubeLink(group = "core", version = "v1", kind = "affinity") public Affinity getAffinity() { return affinity; } public void setAffinity(Affinity affinity) { this.affinity = affinity; } @Description("Logging configuration") @JsonInclude(value = JsonInclude.Include.NON_NULL) public Logging getLogging() { return logging; } public void setLogging(Logging logging) { this.logging = logging; } @Description("TLS sidecar configuration") @JsonInclude(JsonInclude.Include.NON_NULL) public Sidecar getTlsSidecar() { return tlsSidecar; } public void setTlsSidecar(Sidecar tlsSidecar) { this.tlsSidecar = tlsSidecar; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
[ "noreply@github.com" ]
sasg.noreply@github.com
fb2825699f0e822fc768bfdd65897eb299f96560
a5d01febfd8d45a61f815b6f5ed447e25fad4959
/Source Code/5.27.0/sources/androidx/transition/Fade.java
6edae7b7b13c0a3f37b40fc4ec6172d6b34732b5
[]
no_license
kkagill/Decompiler-IQ-Option
7fe5911f90ed2490687f5d216cb2940f07b57194
c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6
refs/heads/master
2020-09-14T20:44:49.115289
2019-11-04T06:58:55
2019-11-04T06:58:55
223,236,327
1
0
null
2019-11-21T18:17:17
2019-11-21T18:17:16
null
UTF-8
Java
false
false
3,844
java
package androidx.transition; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.core.content.res.TypedArrayUtils; import androidx.core.view.ViewCompat; public class Fade extends Visibility { public static final int IN = 1; private static final String LOG_TAG = "Fade"; public static final int OUT = 2; private static final String PROPNAME_TRANSITION_ALPHA = "android:fade:transitionAlpha"; private static class FadeAnimatorListener extends AnimatorListenerAdapter { private boolean mLayerTypeChanged = false; private final View mView; FadeAnimatorListener(View view) { this.mView = view; } public void onAnimationStart(Animator animator) { if (ViewCompat.hasOverlappingRendering(this.mView) && this.mView.getLayerType() == 0) { this.mLayerTypeChanged = true; this.mView.setLayerType(2, null); } } public void onAnimationEnd(Animator animator) { ViewUtils.setTransitionAlpha(this.mView, 1.0f); if (this.mLayerTypeChanged) { this.mView.setLayerType(0, null); } } } public Fade(int i) { setMode(i); } public Fade(Context context, AttributeSet attributeSet) { super(context, attributeSet); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, Styleable.FADE); setMode(TypedArrayUtils.getNamedInt(obtainStyledAttributes, (XmlResourceParser) attributeSet, "fadingMode", 0, getMode())); obtainStyledAttributes.recycle(); } public void captureStartValues(@NonNull TransitionValues transitionValues) { super.captureStartValues(transitionValues); transitionValues.values.put(PROPNAME_TRANSITION_ALPHA, Float.valueOf(ViewUtils.getTransitionAlpha(transitionValues.view))); } private Animator createAnimation(final View view, float f, float f2) { if (f == f2) { return null; } ViewUtils.setTransitionAlpha(view, f); ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, ViewUtils.TRANSITION_ALPHA, new float[]{f2}); ofFloat.addListener(new FadeAnimatorListener(view)); addListener(new TransitionListenerAdapter() { public void onTransitionEnd(@NonNull Transition transition) { ViewUtils.setTransitionAlpha(view, 1.0f); ViewUtils.clearNonTransitionAlpha(view); transition.removeListener(this); } }); return ofFloat; } public Animator onAppear(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) { float f = 0.0f; float startAlpha = getStartAlpha(transitionValues, 0.0f); if (startAlpha != 1.0f) { f = startAlpha; } return createAnimation(view, f, 1.0f); } public Animator onDisappear(ViewGroup viewGroup, View view, TransitionValues transitionValues, TransitionValues transitionValues2) { ViewUtils.saveNonTransitionAlpha(view); return createAnimation(view, getStartAlpha(transitionValues, 1.0f), 0.0f); } private static float getStartAlpha(TransitionValues transitionValues, float f) { if (transitionValues == null) { return f; } Float f2 = (Float) transitionValues.values.get(PROPNAME_TRANSITION_ALPHA); return f2 != null ? f2.floatValue() : f; } }
[ "yihsun1992@gmail.com" ]
yihsun1992@gmail.com
a9aa4c451724d6b7fecb024b4cfc4aa22b9fb658
98bf595e8b5f562c68fca1458781cffbf63cfc64
/reactive-elasticsearch-service/src/main/java/com/mycloud/reactive/ElasticsearchRouter.java
79be29e0c79647e643b13570b4ee1a8446afa9f1
[]
no_license
peter-liu97/my-cloud
8acfd43883f54ac28dea715d9b97168b3eb98116
ca1a6ff3c83de933865e1c511a0dd648fd8dd707
refs/heads/master
2023-02-10T10:45:22.519476
2021-01-06T07:56:04
2021-01-06T07:56:04
322,562,650
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package com.mycloud.reactive; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.ServerResponse; @Configuration public class ElasticsearchRouter { @Bean public RouterFunction<ServerResponse> productRoute(ElasticsearchHandler elasticsearchHandler){ return RouterFunctions.route() .POST(ElasticsearchRoutePath.save,elasticsearchHandler::saveProduct) .POST(ElasticsearchRoutePath.findAllByPage,elasticsearchHandler::findAllByPage) .GET(ElasticsearchRoutePath.findById,elasticsearchHandler::findById) .build(); } }
[ "liusm@yueworld.cn" ]
liusm@yueworld.cn
277b1c859f69f42605e791ada7c9160e74110b00
bc2d0b78f2a9a49c1f2342edc389823a4b1c28d7
/lenguajes/src/examen.java
ed086482e0432f02190aa58e59103559c78dc45e
[]
no_license
z0s0xp/lenguajes-josemanuel
17f1001aadaa243f4f0d68e8d69dd789a186ffd9
296fc242a7ce9ddb7472825c2d21bf2d55d842a9
refs/heads/master
2023-07-11T01:04:28.974477
2023-06-25T04:01:16
2023-06-25T04:01:16
79,173,579
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author z0s0xp */ public class examen { }
[ "z0s0xp@DESKTOP-JDBTR1L" ]
z0s0xp@DESKTOP-JDBTR1L
9e4603e989e59587b8bac758832027966ac9d07c
6a7558b992692a49f09048596e782ca32e714d35
/app/src/main/java/comm/example/rane22sau/integrated_level_1/Home.java
abda83fd83242ac20bac406c94a913248e6acea5
[]
no_license
tarun42/Bot-Controller-
d55801e8c56b4093d3d6c1e140c3f6f8300b433e
e67feff00115c4030da9c17f4b69fd5419aa0c15
refs/heads/master
2023-02-02T05:38:50.241046
2020-12-16T13:48:46
2020-12-16T13:48:46
276,018,577
0
1
null
2020-10-04T15:01:40
2020-06-30T06:38:53
HTML
UTF-8
Java
false
false
2,904
java
package comm.example.rane22sau.integrated_level_1; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Home extends MainActivity{ Button voicebt,facebt,colorbt,ocrbt,movebt,gesturebt,pathbt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); voicebt = (Button)findViewById(R.id.voice); facebt = (Button)findViewById(R.id.face); colorbt = (Button)findViewById(R.id.color); ocrbt = (Button) findViewById(R.id.ocr); gesturebt = findViewById(R.id.gesture); pathbt = findViewById(R.id.path); movebt = findViewById(R.id.move); voicebt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setContentView(R.layout.demo_ac); Intent Open_Voice = new Intent(getApplicationContext(),Voice_Control.class); //startActivity(Open_Voice); } }); facebt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_Face_Tracker = new Intent(getApplicationContext(),Face_Tracker.class); startActivity(Open_Face_Tracker); } }); colorbt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_Color = new Intent(getApplicationContext(),Color_Detector.class); startActivity(Open_Color); } }); ocrbt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_Ocr = new Intent(getApplicationContext(),OCR_activity.class); startActivity(Open_Ocr); } }); movebt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_move = new Intent(getApplicationContext(),Move_dist.class); startActivity(Open_move); } }); gesturebt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_gesture = new Intent(getApplicationContext(),Gesture.class); startActivity(Open_gesture); } }); pathbt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent Open_path = new Intent(getApplicationContext(),Main2Activity.class); startActivity(Open_path); } }); } }
[ "dastarun42@gmail.com" ]
dastarun42@gmail.com
c4f863351589da608782c5bc7d87fb12048190f4
0b5224b11b6637fc9a4479f93da796dd8eca22c0
/PS2 Manuel Cuesta/src/MainPackage/MyIntegerTest.java
ad750a643d5ab3c0b46587d047de4d1a8581cc54
[]
no_license
mecuesta/PS2
3952c68834d87efcd3ffdaa0d839a875a8e7a4ec
bdc4e3f524d33ad511c4e98581c377791a610260
refs/heads/master
2021-01-10T21:46:58.123790
2015-09-17T02:36:21
2015-09-17T02:36:21
42,119,688
0
0
null
null
null
null
UTF-8
Java
false
false
3,627
java
package MainPackage; import static org.junit.Assert.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; public class MyIntegerTest { @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 testIsEven() { MyInteger myIntEven = new MyInteger(2); MyInteger myIntOdd = new MyInteger(3); assertTrue(myIntEven.isEven() == true); assertFalse(myIntOdd.isEven() == true); } //-------------------------------------------------------------- @Test public void testIsOdd() { MyInteger myIntOdd = new MyInteger(3); MyInteger myIntEven = new MyInteger(2); assertTrue(myIntOdd.isOdd() == true); assertFalse(myIntEven.isOdd() == true); } //-------------------------------------------------------------- @Test public void testIsPrime() { MyInteger myIntPrime = new MyInteger(7); MyInteger myIntNotPrime = new MyInteger(15); assertTrue(myIntPrime.isPrime() == true); assertFalse(myIntNotPrime.isPrime() == true); } //-------------------------------------------------------------- @Test public void testIsEvenInt() { MyInteger myIntEvenInt = new MyInteger(2); MyInteger myIntOddInt = new MyInteger(3); assertTrue(myIntEvenInt.isEven() == true); assertFalse(myIntOddInt.isEven() == true); } //-------------------------------------------------------------- @Test public void testIsOddInt() { MyInteger myIntOddInt = new MyInteger(3); MyInteger myIntEvenInt = new MyInteger(2); assertTrue(myIntOddInt.isOdd() == true); assertFalse(myIntEvenInt.isOdd() == true); } //-------------------------------------------------------------- @Test public void testIsPrimeInt() { MyInteger myIntPrimeInt = new MyInteger(7); MyInteger myIntNotPrimeInt = new MyInteger(15); assertTrue(myIntPrimeInt.isPrime() == true); assertFalse(myIntNotPrimeInt.isPrime() == true); } //-------------------------------------------------------------- @Test public void testIsEven1() { MyInteger myIntEven1 = new MyInteger(2); MyInteger myIntOdd1 = new MyInteger(3); assertTrue(myIntEven1.isEven() == true); assertFalse(myIntOdd1.isEven() == true); } //-------------------------------------------------------------- @Test public void testIsOdd1() { MyInteger myIntOdd1 = new MyInteger(3); MyInteger myIntEven1 = new MyInteger(2); assertTrue(myIntOdd1.isOdd() == true); assertFalse(myIntEven1.isOdd() == true); } //-------------------------------------------------------------- @Test public void testIsPrime1() { MyInteger myIntPrime1 = new MyInteger(7); MyInteger myIntNotPrime1 = new MyInteger(15); assertTrue(myIntPrime1.isPrime() == true); assertFalse(myIntNotPrime1.isPrime() == true); } //-------------------------------------------------------------- @Test public void testEqualsInt() { MyInteger myIntEquals = new MyInteger(5); assertTrue(myIntEquals.equals(5) == true); assertFalse(myIntEquals.equals(4) == true); } //-------------------------------------------------------------- @Test public void testEqualsMyInteger() { MyInteger myIntEquals = new MyInteger(5); assertTrue(myIntEquals.equals(5) == true); assertFalse(myIntEquals.equals(4) == true); } }
[ "mecuesta@udel.edu" ]
mecuesta@udel.edu
c60cd32ade6fe429c929b6eb20d81a9d59bd12b9
f979a1df26b139019da299df0518a16ff5f741ea
/src/main/java/com/lopesweb/course/services/exceptions/DatabaseException.java
d6395cba0616404b29869b048fbcb34fb737ebde
[]
no_license
ifeslopes/course-springboot-2-java-11
4259c72a0b5379f992ee3ced00ac4714a194a5e8
6440b11ee00a177faf5f0c44c0039da31d3bd343
refs/heads/master
2023-03-06T19:05:28.717295
2021-02-21T00:37:45
2021-02-21T00:37:45
329,044,051
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.lopesweb.course.services.exceptions; public class DatabaseException extends RuntimeException{ private static final long serialVersionUID = 1L; public DatabaseException(String msg) { super(msg); } }
[ "ifes.lopes@gmail.com" ]
ifes.lopes@gmail.com
861085d71dbe9a018a67aa8a56a08dbf2d9e119e
c3c5f620c94f9dbbb885305b369bd4c2ac551496
/src/main/java/org/usfirst/frc/team3042/lib/pixy2api/Pixy2CCC.java
d16567eaf3c633a373ea9d87c5d6e28c511d85fd
[]
no_license
team3042/DeepSpace
6cab51834aee1cd46cd7e7c2d5a2ad8c5781b54b
3c1619beea1a9b8b5f912a06a390e39d1feaf6eb
refs/heads/master
2020-04-18T00:49:02.005460
2019-11-21T01:43:30
2019-11-21T01:43:30
167,092,557
2
0
null
2019-11-21T01:43:31
2019-01-23T01:04:37
Java
UTF-8
Java
false
false
7,323
java
package org.usfirst.frc.team3042.lib.pixy2api; import java.util.ArrayList; import java.util.Arrays; import java.util.concurrent.TimeUnit; /** * Java Port of Pixy2 Arduino Library * * Defines Color Connected Components tracker for Pixy2 * * https://github.com/PseudoResonance/Pixy2JavaAPI * * @author PseudoResonance * * ORIGINAL HEADER - * https://github.com/charmedlabs/pixy2/blob/master/src/host/arduino/libraries/Pixy2/Pixy2CCC.h * ============================================================================================ * begin license header * * This file is part of Pixy CMUcam5 or "Pixy" for short * * All Pixy source code is provided under the terms of the GNU General * Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html). Those * wishing to use Pixy source code, software and/or technologies under * different licensing terms should contact us at cmucam@cs.cmu.edu. * Such licensing terms are available for all portions of the Pixy * codebase presented here. * * end license header * * This file is for defining the Block struct and the Pixy template * class version 2. (TPixy2). TPixy takes a communication link as a * template parameter so that all communication modes (SPI, I2C and * UART) can share the same code. */ public class Pixy2CCC { public final static int CCC_MAX_SIGNATURE = 7; public final static byte CCC_RESPONSE_BLOCKS = 0x21; public final static byte CCC_REQUEST_BLOCKS = 0x20; // Defines for sigmap: // You can bitwise "or" these together to make a custom sigmap. // For example if you're only interested in receiving blocks // with signatures 1 and 5, you could use a sigmap of // PIXY_SIG1 | PIXY_SIG5 public final static byte CCC_SIG1 = 0x01; public final static byte CCC_SIG2 = 0x02; public final static byte CCC_SIG3 = 0x04; public final static byte CCC_SIG4 = 0x08; public final static byte CCC_SIG5 = 0x10; public final static byte CCC_SIG6 = 0x20; public final static byte CCC_SIG7 = 0x40; public final static byte CCC_COLOR_CODES = (byte) 0x80; public final static byte CCC_SIG_ALL = (byte) 0xff; // all bits or'ed together private final Pixy2 pixy; private ArrayList<Block> blocks = new ArrayList<Block>(); /** * Constructs Pixy2 Color Connected Components tracker * * @param pixy Pixy2 instance */ protected Pixy2CCC(Pixy2 pixy) { this.pixy = pixy; } /** * Gets signature blocks from Pixy2 * * @param wait Whether to wait for Pixy2 if data is not available * @param sigmap Sigmap to look for * @param maxBlocks Maximum blocks to look for * * @return Pixy2 error code */ public int getBlocks(boolean wait, int sigmap, int maxBlocks) { blocks.clear(); long start = System.currentTimeMillis(); while (true) { // fill in request data pixy.bufferPayload[0] = (byte) sigmap; pixy.bufferPayload[1] = (byte) maxBlocks; pixy.length = 2; pixy.type = CCC_REQUEST_BLOCKS; // send request pixy.sendPacket(); if (pixy.receivePacket() == 0) { if (pixy.type == CCC_RESPONSE_BLOCKS) { for (int i = 0; (i + 1) * 14 < pixy.buffer.length; i++) { Block b = new Block(((pixy.buffer[i * 8 + 1] & 0xff) << 8) | (pixy.buffer[i * 8] & 0xff), ((pixy.buffer[i * 8 + 3] & 0xff) << 8) | (pixy.buffer[i * 8 + 2] & 0xff), ((pixy.buffer[i * 8 + 5] & 0xff) << 8) | (pixy.buffer[i * 8 + 4] & 0xff), ((pixy.buffer[i * 8 + 7] & 0xff) << 8) | (pixy.buffer[i * 8 + 6] & 0xff), ((pixy.buffer[i * 8 + 9] & 0xff) << 8) | (pixy.buffer[i * 8 + 8] & 0xff), (pixy.buffer[i * 8 + 11] << 8) | pixy.buffer[i * 8 + 10], pixy.buffer[i * 8 + 12], pixy.buffer[i * 8 + 13]); blocks.add(b); } return blocks.size(); } else if (pixy.type == Pixy2.PIXY_TYPE_RESPONSE_ERROR) { // deal with busy and program changing states from Pixy (we'll wait) if (pixy.buffer[0] == Pixy2.PIXY_RESULT_BUSY) { if (!wait) return Pixy2.PIXY_RESULT_BUSY; // new data not available yet } else if (pixy.buffer[0] == Pixy2.PIXY_RESULT_PROG_CHANGING) { return pixy.buffer[0]; } } } else return Pixy2.PIXY_RESULT_ERROR; // some kind of bitstream error if (System.currentTimeMillis() - start > 500) { return Pixy2.PIXY_RESULT_ERROR; // timeout to prevent lockup } // If we're waiting for frame data, don't thrash Pixy with requests. // We can give up half a millisecond of latency (worst case) try { TimeUnit.MICROSECONDS.sleep(500); } catch (InterruptedException e) { } } } /** * Gets signature blocks from cache * * @return Pixy2 signature Blocks */ public ArrayList<Block> getBlocks() { return blocks; } public class Block { private int signature, x, y, width, height, angle, index, age = 0; /** * Constructs signature block instance * * @param signature Block signature * @param x X value * @param y Y value * @param width Block width * @param height Block height * @param angle Angle from camera * @param index Block index * @param age Block age */ private Block(int signature, int x, int y, int width, int height, int angle, int index, int age) { this.signature = signature; this.x = x; this.y = y; this.width = width; this.height = height; this.angle = angle; this.index = index; this.age = age; } /** * Prints signature block data to console */ public void print() { System.out.println(toString()); } /** * Creats a string of signature data * * @return String of signature data */ public String toString() { int i, j; int[] sig = new int[6]; int d; boolean flag; String out = ""; if (signature > CCC_MAX_SIGNATURE) { // color code! (CC) // convert signature number to an octal string for (i = 12, j = 0, flag = false; i >= 0; i -= 3) { d = (signature >> i) & 0x07; if (d > 0 && !flag) flag = true; if (flag) sig[j++] = d + '0'; } sig[j] = '\0'; out = "CC block sig: " + Arrays.toString(sig) + " (" + signature + " decimal) x: " + x + " y: " + y + " width: " + width + " height: " + height + " angle: " + angle + " index: " + index + " age: " + age; } else // regular block. Note, angle is always zero, so no need to print out = "sig: " + signature + " x: " + x + " y: " + y + " width: " + width + " height: " + height + " index: " + index + " age: " + age; return out; } /** * @return Block signature */ public int getSignature() { return signature; } /** * @return Block X value */ public int getX() { return x; } /** * @return Block Y value */ public int getY() { return y; } /** * @return Block width */ public int getWidth() { return width; } /** * @return Block height */ public int getHeight() { return height; } /** * @return Angle from camera */ public int getAngle() { return angle; } /** * @return Block index */ public int getIndex() { return index; } /** * @return Block age */ public int getAge() { return age; } } }
[ "team3042@gmail.com" ]
team3042@gmail.com
52ba8f8c1fee4ba7156511e83c2472103cafd01d
78edef017117999e4f814462f48140d140152389
/src/main/java/org/primefaces/barcelona/view/data/gmap/CirclesView.java
95be8fc945e9311ac4c8b7e7a44d861b2ba20de3
[]
no_license
max2759/salesmanagerCRM
a69d2b5771ff7beeeea94e30a349094117de8ac9
8fa61e01c810ca1e1c20e67fb16952c144e206ec
refs/heads/main
2023-08-26T09:45:11.814497
2021-10-07T13:40:04
2021-10-07T13:40:04
415,300,505
0
0
null
null
null
null
UTF-8
Java
false
false
2,204
java
/* * Copyright 2009-2014 PrimeTek. * * 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.primefaces.barcelona.view.data.gmap; import org.primefaces.event.map.OverlaySelectEvent; import org.primefaces.model.map.Circle; import org.primefaces.model.map.DefaultMapModel; import org.primefaces.model.map.LatLng; import org.primefaces.model.map.MapModel; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.inject.Named; import java.io.Serializable; @Named @RequestScoped public class CirclesView implements Serializable { private MapModel circleModel; @PostConstruct public void init() { circleModel = new DefaultMapModel(); //Shared coordinates LatLng coord1 = new LatLng(36.879466, 30.667648); LatLng coord4 = new LatLng(36.885233, 30.702323); //Circle Circle circle1 = new Circle(coord1, 500); circle1.setStrokeColor("#d93c3c"); circle1.setFillColor("#d93c3c"); circle1.setFillOpacity(0.5); Circle circle2 = new Circle(coord4, 300); circle2.setStrokeColor("#00ff00"); circle2.setFillColor("#00ff00"); circle2.setStrokeOpacity(0.7); circle2.setFillOpacity(0.7); circleModel.addOverlay(circle1); circleModel.addOverlay(circle2); } public MapModel getCircleModel() { return circleModel; } public void onCircleSelect(OverlaySelectEvent event) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Circle Selected", null)); } }
[ "younesarifi@hotmail.com" ]
younesarifi@hotmail.com
957907513fb062afb6bb19c0757c53b1f23a6ab2
687aa03dcd89ad493e69a610e52fbb37c002e440
/app/src/main/java/com/xzy/forestSystem/gogisapi/IOData/DXF/pojo/UnexpectedElement.java
30cb33a79a342e45abf663ab13de80a23649e423
[]
no_license
liner0211/STFby-Android
b1fc4412b01394f6cd2e6f8905fc8acd6507435c
f7b0f448263a4d5bac5c2dcd4dc9b9a0b1628cfc
refs/heads/master
2023-05-06T02:41:19.719147
2021-05-31T07:12:06
2021-05-31T07:12:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.xzy.forestSystem.gogisapi.IOData.DXF.pojo; public class UnexpectedElement extends Exception { public UnexpectedElement() { super("A fost intalnit un element Dxf nerecunoscut de aplicatie. \n Va rugam contactati serviciul de relatii cu clientii."); System.out.print("A fost intalnit un element Dxf nerecunoscut "); } }
[ "czhgithub.com" ]
czhgithub.com
e570fdb9eaf20f5438d025431af02c38f59a1b41
ec52c4be044ccfb863bcfa273e43eb6d62278a2e
/src/leetcode/editor/cn/P101SymmetricTree.java
baaeb68a8528809f6d1d77273b7d6438006ccf14
[]
no_license
Pantsu-It/LeetCodePractice
b0a6b32146428742ea5f780925a382982bb89ea5
27cfbe244003faf3b6f4406a0f87a9f3aac7b80e
refs/heads/master
2021-05-26T11:38:43.121310
2020-05-04T10:05:42
2020-05-04T10:05:42
254,116,234
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package leetcode.editor.cn; //给定一个二叉树,检查它是否是镜像对称的。 // // // // 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。 // // 1 // / \ // 2 2 // / \ / \ //3 4 4 3 // // // // // 但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的: // // 1 // / \ // 2 2 // \ \ // 3 3 // // // // // 进阶: // // 你可以运用递归和迭代两种方法解决这个问题吗? // Related Topics 树 深度优先搜索 广度优先搜索 import leetcode.editor.beans.tree.TreeNode; public class P101SymmetricTree { public static void main(String[] arg) { Solution solution = new P101SymmetricTree().new Solution(); } //leetcode submit region begin(Prohibit modification and deletion) /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public boolean isSymmetric(TreeNode root) { if (root == null) { return true; } return equalReverse(root.left, root.right); } public boolean equalReverse(TreeNode n1, TreeNode n2) { if (n1 == null || n2 == null) { return n1 == n2; } if (n1.val != n2.val) { return false; } return equalReverse(n1.left, n2.right) && equalReverse(n1.right, n2.left); } } //leetcode submit region end(Prohibit modification and deletion) }
[ "pangcong@facishare.com" ]
pangcong@facishare.com
d440d61e66b50ea39faf5d9bc1a3b38c69b20665
4d37505edab103fd2271623b85041033d225ebcc
/spring-context/src/main/java/org/springframework/ui/context/Theme.java
09ad3c4c283813f4bfb7be28d163e7b1a266bd48
[ "Apache-2.0" ]
permissive
huifer/spring-framework-read
1799f1f073b65fed78f06993e58879571cc4548f
73528bd85adc306a620eedd82c218094daebe0ee
refs/heads/master
2020-12-08T08:03:17.458500
2020-03-02T05:51:55
2020-03-02T05:51:55
232,931,630
6
2
Apache-2.0
2020-03-02T05:51:57
2020-01-10T00:18:15
Java
UTF-8
Java
false
false
1,518
java
/* * Copyright 2002-2012 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.ui.context; import org.springframework.context.MessageSource; /** * A Theme can resolve theme-specific messages, codes, file paths, etcetera * (e&#46;g&#46; CSS and image files in a web environment). * The exposed {@link org.springframework.context.MessageSource} supports * theme-specific parameterization and internationalization. * * @author Juergen Hoeller * @see ThemeSource * @see org.springframework.web.servlet.ThemeResolver * @since 17.06.2003 */ public interface Theme { /** * Return the name of the theme. * * @return the name of the theme (never {@code null}) */ String getName(); /** * Return the specific MessageSource that resolves messages * with respect to this theme. * * @return the theme-specific MessageSource (never {@code null}) */ MessageSource getMessageSource(); }
[ "huifer97@163.com" ]
huifer97@163.com
bb7eea6ef0d818ee1fdaf32cc097b272b8938849
ecd179fd42989b315e880368735d8d74faff74c8
/app/src/main/java/koltan/tic_tac_toe/GameActivity.java
e463385d11725b0eaa417c5902cc29c1d6a05261
[]
no_license
koltan95/Tic-Tac-Toe-App
f5ae5ad246e49416dbec0d8f222d20824b853a11
37cb51f99dac557a0f1685023eb35a34cc3aa47c
refs/heads/master
2020-03-19T23:34:16.797120
2018-06-12T03:11:57
2018-06-12T03:11:57
137,010,647
0
0
null
null
null
null
UTF-8
Java
false
false
6,864
java
package koltan.tic_tac_toe; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; import android.widget.EditText; import android.widget.Button; import android.widget.TextView; import android.widget.RadioButton; import android.content.Intent; public class GameActivity extends AppCompatActivity { int control[][]; int i, j = 0; Button b[][]; int turn = 1; int scoreOne = 0; int scoreTwo = 0; int scoreTies = 0; TextView viewTurn; TextView playerOne; TextView playerTwo; TextView ties; TextView p1Score; TextView p2Score; TextView numTies; String p1; String p2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game); Intent intent = getIntent(); Bundle extras = intent.getExtras(); p1 = extras.getString("PLAYER_ONE"); p2 = extras.getString("PLAYER_TWO"); playerOne = (TextView) findViewById(R.id.playerOne); playerTwo = (TextView) findViewById(R.id.playerTwo); ties = (TextView) findViewById(R.id.ties); viewTurn = (TextView) findViewById(R.id.viewTurn); p1Score = (TextView) findViewById(R.id.p1Score); p2Score = (TextView) findViewById(R.id.p2Score); numTies = (TextView) findViewById(R.id.numTies); playerOne.setText(p1 + ":"); playerTwo.setText(p2 + ":"); p1Score.setText(String.valueOf(scoreOne)); p2Score.setText(String.valueOf(scoreTwo)); numTies.setText(String.valueOf(scoreTies)); setBoard(); } public void setBoard(){ b = new Button[4][4]; control = new int[4][4]; b[1][3] = (Button) findViewById(R.id.tr); b[1][2] = (Button) findViewById(R.id.tc); b[1][1] = (Button) findViewById(R.id.tl); b[2][3] = (Button) findViewById(R.id.mr); b[2][2] = (Button) findViewById(R.id.mc); b[2][1] = (Button) findViewById(R.id.ml); b[3][3] = (Button) findViewById(R.id.br); b[3][2] = (Button) findViewById(R.id.bc); b[3][1] = (Button) findViewById(R.id.bl); viewTurn.setText(playerTurn()); for (i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) control[i][j] = 0; } for (i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) { b[i][j].setOnClickListener(new MyClickListener(i, j)); if (!b[i][j].isEnabled()) { b[i][j].setText(" "); b[i][j].setEnabled(true); } } } } class MyClickListener implements View.OnClickListener { int x; int y; public MyClickListener(int x, int y) { this.x = x; this.y = y; } public void onClick(View view) { if (b[x][y].isEnabled()) { b[x][y].setEnabled(false); if(turn == 1){ b[x][y].setText("O"); control[x][y] = 1; turn = 2; viewTurn.setText(playerTurn()); } else{ b[x][y].setText("X"); control[x][y]=2; turn = 1; viewTurn.setText(playerTurn()); } checkBoard(); //if(!checkBoard()){ // viewTurn.setText(playerTurn()); // } } } } public void checkBoard(){ boolean endGame = false; int tieVal = 0; if ((control[1][1] == 1 && control[2][2] == 1 && control[3][3] == 1) || (control[1][3] == 1 && control[2][2] == 1 && control[3][1] == 1) || (control[1][2] == 1 && control[2][2] == 1 && control[3][2] == 1) || (control[1][3] == 1 && control[2][3] == 1 && control[3][3] == 1) || (control[1][1] == 1 && control[1][2] == 1 && control[1][3] == 1) || (control[2][1] == 1 && control[2][2] == 1 && control[2][3] == 1) || (control[3][1] == 1 && control[3][2] == 1 && control[3][3] == 1) || (control[1][1] == 1 && control[2][1] == 1 && control[3][1] == 1)) { viewTurn.setText(p1 + " wins!!"); scoreOne++; p1Score.setText(String.valueOf(scoreOne)); endGameNow(); endGame = true; } if ((control[1][1] == 2 && control[2][2] == 2 && control[3][3] == 2) || (control[1][3] == 2 && control[2][2] == 2 && control[3][1] == 2) || (control[1][2] == 2 && control[2][2] == 2 && control[3][2] == 2) || (control[1][3] == 2 && control[2][3] == 2 && control[3][3] == 2) || (control[1][1] == 2 && control[1][2] == 2 && control[1][3] == 2) || (control[2][1] == 2 && control[2][2] == 2 && control[2][3] == 2) || (control[3][1] == 2 && control[3][2] == 2 && control[3][3] == 2) || (control[1][1] == 2 && control[2][1] == 2 && control[3][1] == 2)) { viewTurn.setText(p2 + " wins!!"); scoreTwo++; p2Score.setText(String.valueOf(scoreTwo)); endGameNow(); endGame = true; } for(i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) { if (control[i][j] == 1 || control[i][j] == 2) { tieVal++; } } } if(tieVal == 9 && !endGame){ endGameNow(); endGame = true; viewTurn.setText("Tie!!"); scoreTies++; numTies.setText(String.valueOf(scoreTies)); } } public void endGameNow(){ for (i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) { if (b[i][j].isEnabled()) { b[i][j].setText(" "); b[i][j].setEnabled(false); } } } } public String playerTurn(){ String whoTurn; if(turn == 1){ whoTurn = p1; } else{ whoTurn = p2; } return whoTurn; } public void clearScores(View view){ scoreOne = 0; scoreTwo = 0; scoreTies = 0; p1Score.setText(String.valueOf(scoreOne)); p2Score.setText(String.valueOf(scoreTwo)); numTies.setText(String.valueOf(scoreTies)); } public void newGame(View view){ setBoard(); viewTurn.setText(playerTurn()); } }
[ "koltan.weaks@students.tamuk.edu" ]
koltan.weaks@students.tamuk.edu
4a61e4628ef7001ae434f4c08f454b3cf5e1cf33
4d66ae645bcb9159a4b6d0fdb2f24e029da00847
/frame-root/frame-core/src/main/java/com/huatek/frame/core/model/DataAuthName.java
17c78971e2c36c284b175cf6321f0d833c469bf8
[]
no_license
GitWangH/JiFen
1e3722d49502e8ac7de2cfa4e97e99cf47e404df
0cec185c83c0f76a97b4d00fc8f1cfb230415a8e
refs/heads/master
2022-12-20T13:28:57.456912
2019-05-24T06:00:16
2019-05-24T06:00:16
131,266,103
0
2
null
2022-12-10T01:13:11
2018-04-27T08:07:02
JavaScript
UTF-8
Java
false
false
373
java
package com.huatek.frame.core.model; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) //@Component // 表明可被 Spring 扫描 public @interface DataAuthName { String name() default ""; }
[ "15771883191@163.com" ]
15771883191@163.com
6d0906360617ec5239d0bcf0fc5f2526f0db4318
84d655d6f85b917487060c9c13517ee7ac46fb10
/env/dev/snmp/snmp/snmpb/snmpBrowser/src/com/av/MySnmpResponseHandler.java
5b10a7e44f522accd2ed9225aff6f5a95f660916
[ "BSD-3-Clause" ]
permissive
bopopescu/saltstack
6e3b7123a9d78152823cd144c2072d48a0d47266
3dffe4e8ee63981543ec9135836300b3f6dabb71
refs/heads/master
2022-11-23T09:50:47.058381
2017-09-11T03:56:59
2017-09-11T03:56:59
282,250,079
0
0
null
2020-07-24T15:07:08
2020-07-24T15:07:07
null
UTF-8
Java
false
false
480
java
package com.av; import com.dwipal.ISnmpResponseHandler; import com.dwipal.SnmpOidValuePair; public class MySnmpResponseHandler implements ISnmpResponseHandler{ public String value = null; public boolean done = false; public void responseReceived(SnmpOidValuePair resp_values) { value = resp_values.value_str; done = true; } public void requestStats(int totalRequests, int totalResponses, long timeInMillis) { } }
[ "root@salt.hdtr.com" ]
root@salt.hdtr.com
9441edb8dc060b831cd085c133cf0a1ad2a77517
d505984b22a79d773af9550678a54026d470f7f3
/Sum.java
b517724ec00e225a2c46b8bc9d246c8b4e16f003
[]
no_license
Nad-tech/JavaPractice
3cb75d3c0b31078e6986e164cf8c17a841abce74
e1e79608ec3495b8cfb59212289320e14082d09b
refs/heads/main
2022-12-31T07:37:28.332152
2020-10-12T15:20:09
2020-10-12T15:20:09
302,287,412
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
public class Sum{ static int sum(int k){ if(k > 0) { return k + sum(k - 1); } else { return 0; } } public static void main(String[] args){ int n = sum(10); System.out.println(n); } }
[ "noreply@github.com" ]
Nad-tech.noreply@github.com
443e05ddb2108fcd466ae59327448ffaf3ba90a5
dea04aa4c94afd38796e395b3707d7e98b05b609
/Participant results/P17/Interaction-6/ArrayIntList_ES_0_Test.java
c812adb8d3eae023ba7c652d9bb827ca58de63f2
[]
no_license
PdedP/InterEvo-TR
aaa44ef0a4606061ba4263239bafdf0134bb11a1
77878f3e74ee5de510e37f211e907547674ee602
refs/heads/master
2023-04-11T11:51:37.222629
2023-01-09T17:37:02
2023-01-09T17:37:02
486,658,497
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
/* * This file was automatically generated by EvoSuite * Tue Jan 25 10:38:55 GMT 2022 */ package com.org.apache.commons.collections.primitives; import org.junit.Test; import static org.junit.Assert.*; import com.org.apache.commons.collections.primitives.ArrayIntList; 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 ArrayIntList_ES_0_Test extends ArrayIntList_ES_0_Test_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { ArrayIntList arrayIntList0 = new ArrayIntList(); arrayIntList0.add(0, 1446); arrayIntList0.add(0, 0); ArrayIntList arrayIntList1 = new ArrayIntList(); arrayIntList0.retainAll(arrayIntList1); assertEquals(0, arrayIntList0.size()); } }
[ "pedro@uca.es" ]
pedro@uca.es