blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
754fe70594090cd85a5a691f5f0e4b8031e1c22d
2a58c86d921a47538b9f6267d6c4c23a6953627f
/src/main/java/com/steps/flowsteps/ProductFlowSteps.java
df15024a394239a3d0fe7fe276640ee5b7f101c8
[]
no_license
holaszmoni/MadisonDao
4d6dd88c0a1b83f0d8bff170aaf492218184f285
5315ad6b89eec0823d467d7f13c18a9fb5a58df6
refs/heads/main
2023-07-05T19:24:23.692845
2021-08-25T14:25:55
2021-08-25T14:25:55
399,724,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,566
java
package com.steps.flowsteps; import net.thucydides.core.annotations.Step; import net.thucydides.core.annotations.Steps; import com.steps.AbstractSteps; import com.steps.HeaderSteps; import com.steps.ProductDetailsSteps; import com.steps.ProductsSteps; public class ProductFlowSteps extends AbstractSteps { private static final long serialVersionUID = 1L; @Steps private HeaderSteps headerSteps; @Steps private ProductsSteps productsSteps; @Steps private ProductDetailsSteps productDetailsSteps; @Step public void addProductToCart(String productName, int quantity) { headerSteps.searchForProduct(productName); productsSteps.openProductsDetailsPage(productName); productDetailsSteps.addProductToCart(3); } @Step public void addProductToWishlist(String productName, int quantity) { headerSteps.searchForProduct(productName); productsSteps.openProductsDetailsPage(productName); productDetailsSteps.addProductToWishList(3); } @Step public void addProductReview(String productName, String reviewSummary) { headerSteps.searchForProduct(productName); productsSteps.openProductsDetailsPage(productName); productDetailsSteps.addProductReview(reviewSummary); } @Step public void verifyProductReview(String productName, String reviewSummary) { headerSteps.searchForProduct(productName); productsSteps.openProductsDetailsPage(productName); productDetailsSteps.verifyProductReview(reviewSummary); } }
[ "vlad.marc@evozon.com" ]
vlad.marc@evozon.com
624a451a6de67357ce736b81f525f03cf8f4cdff
d384bb2d06acb185cf48d4bffa78d16d864e59ef
/studio/plugins/ui.common/src/main/java/com/andcreations/ae/studio/plugins/ui/common/validation/NonEmptyVerifier.java
53004912ef06025ae7480d8d1a3793c12edcd1aa
[ "MIT" ]
permissive
mikolajgucki/ae-engine
3c5151f23dabfd0db0827fe08fc1776957538fae
c4953feb74853b01b39b45b3bce23c10f6f74db0
refs/heads/master
2020-07-31T15:27:15.337322
2019-09-24T19:34:50
2019-09-24T19:34:50
210,651,967
1
0
null
null
null
null
UTF-8
Java
false
false
530
java
package com.andcreations.ae.studio.plugins.ui.common.validation; import javax.swing.JTextField; /** * @author Mikolaj Gucki */ public class NonEmptyVerifier extends DefaultVerifier { /** */ private JTextField textField; /** */ public NonEmptyVerifier(JTextField textField,String errorToolTip) { super(textField,errorToolTip); this.textField = textField; } /** */ public boolean verify() { return textField.getText().isEmpty() == false; } }
[ "mikolaj.gucki@gmail.com" ]
mikolaj.gucki@gmail.com
2bf4be261cdfa0746256ffa02849b0ac2380454e
5bbee6bec01050b6fb379b31f686f60a606d7230
/app/src/main/java/com/yizhen/exampleFromLittle/Translation.java
11f7cbc639593e6f58d052dd07ecf8109d966d24
[ "Apache-2.0" ]
permissive
coudy02/TestRetrofit2
5f8b55d86d9786d0e2d7de9fc911b5df10896e19
4ed814e67321f7bafb5e404cbedc8901eb603463
refs/heads/master
2020-05-17T23:53:43.530256
2019-04-30T02:40:13
2019-04-30T02:40:13
184,045,423
0
0
null
null
null
null
UTF-8
Java
false
false
630
java
package com.yizhen.exampleFromLittle; public class Translation { private int status; private content content; private static class content { private String from; private String to; private String vendor; private String out; private int errNo; } //定义 输出返回数据 的方法 public void show() { System.out.println(status); System.out.println(content.from); System.out.println(content.to); System.out.println(content.vendor); System.out.println(content.out); System.out.println(content.errNo); } }
[ "754432320@qq.com" ]
754432320@qq.com
ecb206a6f45032b6960af8ba58beddb6775f0783
9966310a034d716656cd7eb78ac5e95b6da72584
/DataStructure/src/main/java/sn/CombinationSumII.java
cbbba0a035b26f33458625c267fa7c9fc89dcc39
[]
no_license
shipengx/ParentModule
03d63ecd7e95b9d17f8bcdd30ef77d611f8fb060
bb1a90903026074fa2c92099903fe8993135b4a7
refs/heads/master
2022-12-22T13:58:08.154949
2020-02-23T00:35:55
2020-02-23T00:35:55
73,237,424
0
0
null
2022-12-15T23:30:34
2016-11-08T23:52:47
Java
UTF-8
Java
false
false
48
java
package sn; public class CombinationSumII { }
[ "sxu@Shipeng-Xu.local" ]
sxu@Shipeng-Xu.local
263c57d5779a04f1e4d7292d2252e152d3c5b26f
21ddd2e905a3644d8c2ae9089e16bb9dede0beaf
/app/src/test/java/kz/sdu/kairatawer/machinelearningproject/ExampleUnitTest.java
e1cf49ba4015ce274ca12fb72918feb0fc110ff7
[]
no_license
KairaTawer/machine-learning-project-android
89f27e409e271b0706fefdd0f00c8e9a2913fa99
35009eae625fa2485df689fd359bde9f55f4287c
refs/heads/master
2020-03-07T18:08:48.204626
2018-04-01T12:59:41
2018-04-01T12:59:41
127,629,548
0
0
null
null
null
null
UTF-8
Java
false
false
418
java
package kz.sdu.kairatawer.machinelearningproject; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "kairatawer@gmail.com" ]
kairatawer@gmail.com
5ecaadac895464b50f1c62253b4cf5eb56309d09
8f649162ae90dfeaa012e95301da952790509510
/src/main/java/com/studyvm/pcomj/parser/SkipParser.java
d33bb8912927e96f110dc8c598e5c0746b24a8c0
[ "Apache-2.0" ]
permissive
dox4/pcomj
81b0f2ef129314a25356a0af597e389d453ce25f
68378b65971bd7110dc3335df5dfefb19f037041
refs/heads/main
2022-12-28T23:27:49.869227
2020-10-17T08:42:44
2020-10-17T08:42:44
303,663,594
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.studyvm.pcomj.parser; import com.studyvm.pcomj.base.AbstractParserCombinator; import com.studyvm.pcomj.base.ParseResult; import com.studyvm.pcomj.base.Parser; import com.studyvm.pcomj.base.ParserInput; import java.util.Optional; import static com.studyvm.pcomj.utils.CommonUtil.succeed; public class SkipParser<T> extends AbstractParserCombinator<Void> { private final Parser<T> parser; public SkipParser(Parser<T> parser) { this.parser = parser; } @Override public Optional<ParseResult<Void>> parse(ParserInput s) { Optional<ParseResult<T>> r1 = parser.parse(s); if (r1.isPresent()) { return succeed(s.rest()); } return Optional.empty(); } }
[ "dox4@foxmail.com" ]
dox4@foxmail.com
7fe5a7b604c5f7d5a01fb521215580002978a528
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project90/src/main/java/org/gradle/test/performance90_3/Production90_241.java
6cefadfb2b057a35432fc3c9dd02b5f5a4a5a6c5
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
305
java
package org.gradle.test.performance90_3; public class Production90_241 extends org.gradle.test.performance16_3.Production16_241 { private final String property; public Production90_241() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
bfde3b97e839cb2b2bf53c088794241fc30efa64
90be34e839ca029598cdcfed4702464b6ebe2809
/app/src/test/java/com/example/binariksoleh/chatapplication/ExampleUnitTest.java
ebbb1ac0db443f0bf86e456a023eb646c8eb9fa0
[]
no_license
Progern/ChatApplication
803a17796f3c52686c3d7be884b5cdca8c97f9e1
dceea9e94f6dcb625abfca1b5178df32231c90e5
refs/heads/master
2021-04-12T08:35:03.324829
2017-06-20T14:55:17
2017-06-20T14:55:17
94,519,971
1
0
null
null
null
null
UTF-8
Java
false
false
418
java
package com.example.binariksoleh.chatapplication; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "progern1997@gmail.com" ]
progern1997@gmail.com
c38c4bf5cfc31b0d32dd91d855d3e1ae39f2af02
ab52bb58aab8104c26db2a6690ec1986ac37dd62
/main6/ling/com/globalsight/ling/docproc/extractor/fm/Extractor.java
2494ce37ba9de4c3e5867e31e8a6670f0f4930f7
[]
no_license
tingley/globalsight
32ae49ac08c671d9166bd0d6cdaa349d9e6b4438
47d95929f4e9939ba8bbbcb5544de357fef9aa8c
refs/heads/master
2021-01-19T07:23:33.073276
2020-10-19T19:42:22
2020-10-19T19:42:22
14,053,692
7
6
null
null
null
null
UTF-8
Java
false
false
78,068
java
/** * Copyright 2010 Welocalize, 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 com.globalsight.ling.docproc.extractor.fm; import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; import java.util.regex.Matcher; import org.apache.log4j.Logger; import com.globalsight.cxe.entity.filterconfiguration.FMFilter; import com.globalsight.ling.common.XmlEntities; import com.globalsight.ling.docproc.AbstractExtractor; import com.globalsight.ling.docproc.ExtractorException; import com.globalsight.ling.docproc.ExtractorExceptionConstants; import com.globalsight.ling.docproc.ExtractorRegistry; import com.globalsight.ling.docproc.Output; import com.oroinc.text.regex.MalformedPatternException; import com.oroinc.text.regex.MatchResult; import com.oroinc.text.regex.Pattern; import com.oroinc.text.regex.PatternCompiler; import com.oroinc.text.regex.PatternMatcher; import com.oroinc.text.regex.Perl5Compiler; import com.oroinc.text.regex.Perl5Matcher; public class Extractor extends AbstractExtractor { private static final Logger logger = Logger.getLogger(Extractor.class); private static int index = 1; private static final boolean WITH_RETURN = true; private static final boolean NO_RETURN = false; private static final String regexp1 = "[\\w\\W]*[\\s]*(\\<[\\$]?[^<^>]*\\\\>)+[\\s]*[\\w\\W]*"; private static final String regexp2 = "[A-Za-z]:[\\w\\W]*"; private static final String continusInlineTag = "</ph><ph[^>]*>"; /** * used to mark whether the previous line is string */ private boolean inString = false; /** * used to mark whether it is "Callout"(Callout string should be extracted). */ private boolean inCalloutPgfTag = false; /** * used to mark whether the current line is in font */ private boolean inFontTag = false; /** * used to mark whether the current line is in xref */ private boolean inXrefTag = false; private boolean inMarker = false; private boolean inPage = false; private boolean translatable = false; // in case of nested frames, the flag is a number. // As long as the number is bigger than 0, it means it's in a frame area. // When entering a frame, the tag plus 1. And when leaving, the tag minus 1. private int inFrame = 0; private boolean inTextRect = false; private boolean inGroup = false; private boolean inVariable = false; private boolean inConditional = false; private static Map<String, String> specialCharMap = new HashMap<String, String>(); // contains the tags that are used for inline tags which will not be added // to skeleton. private static List<String> inlineTags = new ArrayList<String>(); private StringBuffer storage = new StringBuffer(); private XmlEntities m_xmlEncoder; public Extractor() { super(); specialCharMap.put("EnDash", "\u2013"); specialCharMap.put("EmDash", "\u2014"); specialCharMap.put("NoHyphen", "\u200d"); specialCharMap.put("Cent", "\u00a2"); specialCharMap.put("Pound", "\u00a3"); specialCharMap.put("Yen", "\u00a5"); specialCharMap.put("Dagger", "\u2020"); specialCharMap.put("DoubleDagger", "\u2021"); specialCharMap.put("ThinSpace", "\u2009"); specialCharMap.put("EnSpace", "\u2002"); specialCharMap.put("EmSpace", "\u2003"); specialCharMap.put("SoftHyphen", ""); specialCharMap.put("NoHyphen", ""); specialCharMap.put("DiscHyphen", ""); specialCharMap.put("HardHyphen", "-"); inlineTags.add("&lt;$chapnum\\&gt;"); m_xmlEncoder = new XmlEntities(); } /** * extract mif files */ public void extract() throws ExtractorException { Output output = getOutput(); setMainFormat(ExtractorRegistry.FORMAT_MIF); FMFilter filter = null; if (getMainFilter() != null) { filter = (FMFilter) getMainFilter(); } if (logger.isDebugEnabled()) { logger.info("freeMemory: " + Runtime.getRuntime().freeMemory()); logger.info("maxMemory: " + Runtime.getRuntime().maxMemory()); logger.info("totalMemory: " + Runtime.getRuntime().totalMemory()); } long timeStarted = System.currentTimeMillis(); extractWithReadLine(output, filter); // extractWithAllLines(output, filter); long timeFinished = System.currentTimeMillis(); if (logger.isDebugEnabled()) { logger.info("freeMemory: " + Runtime.getRuntime().freeMemory()); logger.info("maxMemory: " + Runtime.getRuntime().maxMemory()); logger.info("totalMemory: " + Runtime.getRuntime().totalMemory()); logger.info("MIF extractor time: " + (timeFinished - timeStarted)); } } private void extractWithReadLine(Output output, FMFilter filter) { StringBuffer tmpString = new StringBuffer(""); String pageType = ""; String frame_Id = ""; // save all the translatable textrect in bodypages List<String> textRectListInBodyPage = new ArrayList<String>(); // save all the translatable textrect in frames List<String> textRectListInFrame = new ArrayList<String>(); // save all textrect in frames TextRectInFrame textRectInFrameMap = new TextRectInFrame(); // used to store whether the table should be translated Map<String, Boolean> tableMap = new HashMap<String, Boolean>(); // used to store whether the frame should be translated Map<String, Boolean> frameMap = new HashMap<String, Boolean>(); // save all the translatable textrect for "Callout". List<String> textRectIdListForCallout = new ArrayList<String>(); BufferedReader reader = new BufferedReader(readInput()); try { /* * the extractor needs 2 loops. In the 1st loop, find out * translatable tables, frames, bodypages, and textrects. In the 2nd * loop, parse the file. */ firstLoop(reader, pageType, textRectListInBodyPage, textRectListInFrame, tableMap, frameMap, textRectInFrameMap, frame_Id, textRectIdListForCallout, filter); reset(); Marker marker = new Marker(); // close first reader and open new one try { reader.close(); } catch (IOException e) { logger.error("Close MIF file with exception", e); } reader = new BufferedReader(readInput()); secondLoop(reader, output, frameMap, tableMap, textRectListInBodyPage, textRectListInFrame, tmpString, marker, textRectIdListForCallout); } catch (Exception ex) { throw new ExtractorException(ex); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { logger.error("Close MIF file with exception", e); } } } } private void firstLoop(BufferedReader reader, String pageType, List<String> textRectListInBodyPage, List<String> textRectListInFrame, Map<String, Boolean> tableMap, Map<String, Boolean> frameMap, TextRectInFrame textRectInFrameMap, String frame_Id, List<String> textRectIdListForCallout, FMFilter filter) throws NumberFormatException, IOException { String line = reader.readLine(); for (; line != null; line = reader.readLine()) { if (line.trim().startsWith(Tag.MIF_FILE_HEAD)) // <MIFFile { String mifVersion = Parser.getTagContent(line, Tag.MIF_FILE_HEAD); double version = Double.parseDouble(mifVersion); if (version < 9) { throw new ExtractorException( ExtractorExceptionConstants.MIF_VERSION_ERROR); } } else if (line.trim().startsWith(Tag.PAGETYPE_HEAD)) // <PageType { inPage = true; pageType = Parser.getTagContent(line, Tag.PAGETYPE_HEAD); } // <ID, textrects in page tag else if (inPage && line.trim().startsWith(Tag.TEXT_RECT_ID)) { if (pageType.equalsIgnoreCase("BodyPage")) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("LeftMasterPage") && filter != null && filter.isExposeLeftMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("RightMasterPage") && filter != null && filter.isExposeRightMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("OtherMasterPage") && filter != null && filter.isExposeOtherMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } } else if (line.trim().equals(Tag.PAGE_END)) // # end of Page { inPage = false; translatable = false; } else if (line.trim().startsWith(Tag.TEXTRECTID_HEAD)) // <TextRectID { String rectID = Parser.getTagContent(line, Tag.TEXTRECTID_HEAD); if (textRectListInBodyPage.contains(rectID) || textRectListInFrame.contains(rectID)) { translatable = true; } else { translatable = false; } if (inCalloutPgfTag) { translatable = true; textRectIdListForCallout.add(rectID); } } else if (line.trim().startsWith(Tag.A_TABLE_ID)) // <ATbl { String referedTableId = Parser.getTagContent(line, Tag.A_TABLE_ID); tableMap.put(referedTableId, translatable); } else if (line.trim().startsWith(Tag.A_FRAME_ID) && !line.trim().equals("<AFrames")) // <AFrame { String referedFrameId = Parser.getTagContent(line, Tag.A_FRAME_ID); frameMap.put(referedFrameId, translatable); List<String> textRectInFrame = textRectInFrameMap .getTextRectInFrame(referedFrameId); if (translatable) { textRectListInFrame.addAll(textRectInFrame); } } else if (line.trim().equals(Tag.FRAME_HEAD)) // <Frame { inFrame++; } else if (line.trim().equals(Tag.FRAME_END)) // > # end of Frame { inFrame--; } else if (line.trim().equals(Tag.TEXTRECT_HEAD)) // <TextRect { inTextRect = true; } else if (line.trim().equals(Tag.TEXTRECT_END)) // > # end of // TextRect { inTextRect = false; } else if (line.trim().equals(Tag.GROUP_HEAD)) // <Group { inGroup = true; } else if (line.trim().equals(Tag.GROUP_END)) // # end of Group { inGroup = false; } else if (inFrame > 0 && inTextRect && line.trim().startsWith(Tag.TEXT_RECT_ID)) // <ID { String textRectID = Parser .getTagContent(line, Tag.TEXT_RECT_ID); textRectInFrameMap.saveRect(frame_Id, textRectID); textRectListInFrame.add(textRectID); } else if (inFrame > 0 && !inGroup && !inTextRect && line.trim().startsWith(Tag.FRAME_ID)) // <ID { frame_Id = Parser.getTagContent(line, Tag.FRAME_ID); } else if (line.trim().equals(Tag.PGFTAG_CALLOUT)) { inCalloutPgfTag = true; } else if (line.trim().equals(Tag.PARA_END)) { // As callout pgfTag is always in "para", when para ends, set // this to false. inCalloutPgfTag = false; } } } private void secondLoop(BufferedReader reader, Output output, Map<String, Boolean> FrameMap, Map<String, Boolean> TableMap, List<String> textRectListInBodyPage, List<String> textRectListInFrame, StringBuffer tmpString, Marker marker, List<String> textRectIdListForCallout) throws IOException { Stack<String> tagLevel = new Stack<String>(); // this is a flag, saving whether or not it's translatable when entering // a footnote area. When leaving footnote, translatable flag should // remain // as what it is when entering footnote. boolean translatableOutsideNote = false; String lineWithWhiteSpace = reader.readLine(); for (; lineWithWhiteSpace != null; lineWithWhiteSpace = reader .readLine()) { String lineWithoutWhiteSpace = lineWithWhiteSpace.trim(); if (lineWithoutWhiteSpace.startsWith("<") && !lineWithoutWhiteSpace.endsWith(">")) { tagLevel.push(lineWithoutWhiteSpace.substring(1)); } else if (lineWithoutWhiteSpace.startsWith(">")) { if (lineWithoutWhiteSpace.equals(">") && !tagLevel.empty() && translatable) { String l = tagLevel.peek(); lineWithoutWhiteSpace += " # end of " + l; lineWithWhiteSpace += " # end of " + l; } tagLevel.pop(); } if (lineWithoutWhiteSpace.equals(Tag.FRAME_HEAD)) // <Frame { inFrame++; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (inFrame > 0 && !inGroup && !inTextRect && lineWithoutWhiteSpace.startsWith(Tag.FRAME_ID)) // <ID { String frameId = Parser.getTagContent(lineWithWhiteSpace, Tag.FRAME_ID); translatable = FrameMap.get(frameId); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.FRAME_END)) // > # end of // Frame { inFrame--; // Nested "Frame":inner Frames have no "ID". if (inFrame == 0) { translatable = false; } addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.GROUP_HEAD)) // <Group { inGroup = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.GROUP_END)) // # end of // Group { inGroup = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.TEXTRECT_HEAD)) // <TextRect { inTextRect = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.TEXTRECT_END)) // > # end // of // TextRect { inTextRect = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.startsWith(Tag.TABLE_ID)) // <TblID { String tableId = Parser.getTagContent(lineWithWhiteSpace, Tag.TABLE_ID); translatable = TableMap.get(tableId); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.TABLE_END)) // > # end of // Tbl { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); translatable = false; } else if (lineWithoutWhiteSpace.equals(Tag.PARA_END)) // # end of // Para { if (inString) { addTranslatableTmx(getStringPhEnd()); addSkeleton(output, Tag.PARALINE_END, WITH_RETURN); } addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); inString = false; } else if (lineWithoutWhiteSpace.startsWith(Tag.TEXTRECTID_HEAD)) // <TextRectID { String rectID = Parser.getTagContent(lineWithWhiteSpace, Tag.TEXTRECTID_HEAD); if (textRectListInBodyPage.contains(rectID) || textRectListInFrame.contains(rectID)) { translatable = true; } else { translatable = false; } if (inCalloutPgfTag && textRectIdListForCallout.contains(rectID)) { translatable = true; } if (inString) { addTranslatableTmx(getStringPhEnd()); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.TEXTRECTID, true)); addTranslatableTmx(getStringPhStart()); } else { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (translatable && lineWithoutWhiteSpace.startsWith(Tag.XREFEND_HEAD)) // <XRefEnd { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.XREF, true)); tmpString.setLength(0); inXrefTag = false; } else if (translatable && (inXrefTag || lineWithoutWhiteSpace .equals(Tag.XREF_HEAD))) // <XRef { endStringTag(output); inXrefTag = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (lineWithoutWhiteSpace.equals(Tag.PARALINE_HEAD)) // <ParaLine { if (!inString) { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (lineWithoutWhiteSpace.equals(Tag.PARALINE_END)) // # end of // ParaLine { if (!inString) { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (lineWithoutWhiteSpace.startsWith(Tag.STRING_HEAD) && translatable) // <String { if (!inString) { addTranslatableTmx(getStringPhStart()); } inString = true; // output.addTranslatable(Parser.getStringContent(line)); addTranslatable(Parser.getStringContent(lineWithWhiteSpace)); } else if (translatable && lineWithoutWhiteSpace.equals(Tag.FONT_END)) // > // # // end // of // Font { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.FONT, true)); tmpString.setLength(0); inFontTag = false; } else if (translatable && (inFontTag || lineWithoutWhiteSpace .equals(Tag.FONT_HEAD))) // <Font { endStringTag(output); inFontTag = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (translatable && lineWithoutWhiteSpace.equals(Tag.MARKER_END)) // > # end // of // Marker { addTranslatableTmx(handleMarkerTag(marker)); inMarker = false; } else if (translatable && (inMarker || lineWithoutWhiteSpace .equals(Tag.MARKER_HEAD))) // <Marker { endStringTag(output); inMarker = true; if (lineWithoutWhiteSpace.startsWith(Tag.UNIQUE_HEAD)) // <Unique { marker.setUnique(Parser.getTagContent(lineWithWhiteSpace, Tag.UNIQUE_HEAD)); } else if (lineWithoutWhiteSpace.startsWith(Tag.MTYPENAME_HEAD)) // <MTypeName { marker.setMTypeName(Parser .getStringContent(lineWithWhiteSpace)); } else if (lineWithoutWhiteSpace.startsWith(Tag.MTYPE_HEAD)) // <MType { marker.setMType(Parser.getTagContent(lineWithWhiteSpace, Tag.MTYPE_HEAD)); } else if (lineWithoutWhiteSpace.startsWith(Tag.MTEXT_HEAD)) // <MText { marker.setMText(lineWithWhiteSpace.substring( lineWithWhiteSpace.indexOf("`") + 1, lineWithWhiteSpace.indexOf("'"))); } else if (lineWithoutWhiteSpace.startsWith(Tag.MCURRPAGE_HEAD)) // <MCurrPage { marker.setMCurrPage(Parser .getStringContent(lineWithWhiteSpace)); } } else if (inString && lineWithoutWhiteSpace.startsWith(Tag.CHAR_HEAD)) // <Char { // String nextLine = lineList.get(lineNo + 1); addTranslatableTmx(handleChar(lineWithWhiteSpace)); } else if (translatable && lineWithoutWhiteSpace.equals(Tag.VARIABLE_END)) // > # // end // of // Variable { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.VARIABLE, true)); tmpString.setLength(0); inVariable = false; } else if (translatable && (inVariable || lineWithoutWhiteSpace .equals(Tag.VARIABLE_HEAD))) // <Variable { endStringTag(output); inVariable = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (lineWithoutWhiteSpace.startsWith(Tag.VARIABLE_DEF_HEAD) || lineWithoutWhiteSpace.startsWith(Tag.XREF_DEF_HEAD)) // <VariableDef // & // <XRefDef & { exposeDef(lineWithWhiteSpace, output, "text"); } else if (lineWithoutWhiteSpace.startsWith(Tag.PGF_NUMBER_STRING)) // <PgfNumString { handleNumString(lineWithWhiteSpace, output); } else if (translatable && lineWithoutWhiteSpace.equals(Tag.CONDITIONAL_END)) // > # // end of // Conditional { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.CONDITIONAL, true)); tmpString.setLength(0); inConditional = false; } else if (translatable && (inConditional || lineWithoutWhiteSpace .startsWith(Tag.CONDITIONAL_HEAD))) // <Conditional { endStringTag(output); inConditional = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (translatable && lineWithoutWhiteSpace.startsWith(Tag.UNCONDITIONAL)) // <Unconditional { endStringTag(output); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.CONDITIONAL, true)); } else if (lineWithoutWhiteSpace.equals(Tag.NOTES_HEAD)) // <Notes { translatableOutsideNote = translatable; translatable = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.NOTES_END)) // > # end of // Notes { translatable = translatableOutsideNote; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (translatable && lineWithoutWhiteSpace.startsWith(Tag.NOTES_REF) && lineWithoutWhiteSpace.endsWith(">")) // <FNote { if (inString) { addTranslatableTmx(getStringPhEnd()); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.NOTES, true)); addTranslatableTmx(getStringPhStart()); } else { addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.NOTES, true)); } } else if (lineWithoutWhiteSpace.equals(Tag.PGFTAG_CALLOUT)) { inCalloutPgfTag = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (lineWithoutWhiteSpace.equals(Tag.PARA_END)) { // As callout pgfTag is always in "para", when para ends, set // this to false. inCalloutPgfTag = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else { endStringTag(output); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } } private void extractWithAllLines(Output output, FMFilter filter) { Parser parser = new Parser(readInput()); // all the contents in mif file List<String> lineList = parser.getLineList(); extractContent(lineList, output, filter); } private void extractContent(List<String> lineList, Output output, FMFilter filter) throws ExtractorException { StringBuffer tmpString = new StringBuffer(""); String pageType = ""; String frame_Id = ""; // save all the translatable textrect in bodypages List<String> textRectListInBodyPage = new ArrayList<String>(); // save all the translatable textrect in frames List<String> textRectListInFrame = new ArrayList<String>(); // save all textrect in frames TextRectInFrame textRectInFrameMap = new TextRectInFrame(); // used to store whether the table should be translated Map<String, Boolean> tableMap = new HashMap<String, Boolean>(); // used to store whether the frame should be translated Map<String, Boolean> frameMap = new HashMap<String, Boolean>(); // save all the translatable textrect for "Callout". List<String> textRectIdListForCallout = new ArrayList<String>(); /* * the extractor needs 2 loops. In the 1st loop, find out translatable * tables, frames, bodypages, and textrects. In the 2nd loop, parse the * file. */ firstLoop(lineList, pageType, textRectListInBodyPage, textRectListInFrame, tableMap, frameMap, textRectInFrameMap, frame_Id, textRectIdListForCallout, filter); reset(); Marker marker = new Marker(); secondLoop(lineList, output, frameMap, tableMap, textRectListInBodyPage, textRectListInFrame, tmpString, marker, textRectIdListForCallout); } private void firstLoop(List<String> lineList, String pageType, List<String> textRectListInBodyPage, List<String> textRectListInFrame, Map<String, Boolean> tableMap, Map<String, Boolean> frameMap, TextRectInFrame textRectInFrameMap, String frame_Id, List<String> textRectIdListForCallout, FMFilter filter) { for (int lineNo = 0; lineNo < lineList.size(); lineNo++) { String line = lineList.get(lineNo); if (line.trim().startsWith(Tag.MIF_FILE_HEAD)) // <MIFFile { String mifVersion = Parser.getTagContent(line, Tag.MIF_FILE_HEAD); double version = Double.parseDouble(mifVersion); if (version < 9) { throw new ExtractorException( ExtractorExceptionConstants.MIF_VERSION_ERROR); } } else if (line.trim().startsWith(Tag.PAGETYPE_HEAD)) // <PageType { inPage = true; pageType = Parser.getTagContent(line, Tag.PAGETYPE_HEAD); } // <ID, textrects in page tag else if (inPage && line.trim().startsWith(Tag.TEXT_RECT_ID)) { if (pageType.equalsIgnoreCase("BodyPage")) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("LeftMasterPage") && filter != null && filter.isExposeLeftMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("RightMasterPage") && filter != null && filter.isExposeRightMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } else if (pageType.equalsIgnoreCase("OtherMasterPage") && filter != null && filter.isExposeOtherMasterPage()) { String textRectID = Parser.getTagContent(line, Tag.TEXT_RECT_ID); textRectListInBodyPage.add(textRectID); translatable = true; } } else if (line.trim().equals(Tag.PAGE_END)) // # end of Page { inPage = false; translatable = false; } else if (line.trim().startsWith(Tag.TEXTRECTID_HEAD)) // <TextRectID { String rectID = Parser.getTagContent(line, Tag.TEXTRECTID_HEAD); if (textRectListInBodyPage.contains(rectID) || textRectListInFrame.contains(rectID)) { translatable = true; } else { translatable = false; } if (inCalloutPgfTag) { translatable = true; textRectIdListForCallout.add(rectID); } } else if (line.trim().startsWith(Tag.A_TABLE_ID)) // <ATbl { String referedTableId = Parser.getTagContent(line, Tag.A_TABLE_ID); tableMap.put(referedTableId, translatable); } else if (line.trim().startsWith(Tag.A_FRAME_ID) && !line.trim().equals("<AFrames")) // <AFrame { String referedFrameId = Parser.getTagContent(line, Tag.A_FRAME_ID); frameMap.put(referedFrameId, translatable); List<String> textRectInFrame = textRectInFrameMap .getTextRectInFrame(referedFrameId); if (translatable) { textRectListInFrame.addAll(textRectInFrame); } } else if (line.trim().equals(Tag.FRAME_HEAD)) // <Frame { inFrame++; } else if (line.trim().equals(Tag.FRAME_END)) // > # end of Frame { inFrame--; } else if (line.trim().equals(Tag.TEXTRECT_HEAD)) // <TextRect { inTextRect = true; } else if (line.trim().equals(Tag.TEXTRECT_END)) // > # end of // TextRect { inTextRect = false; } else if (line.trim().equals(Tag.GROUP_HEAD)) // <Group { inGroup = true; } else if (line.trim().equals(Tag.GROUP_END)) // # end of Group { inGroup = false; } else if (inFrame > 0 && inTextRect && line.trim().startsWith(Tag.TEXT_RECT_ID)) // <ID { String textRectID = Parser .getTagContent(line, Tag.TEXT_RECT_ID); textRectInFrameMap.saveRect(frame_Id, textRectID); textRectListInFrame.add(textRectID); } else if (inFrame > 0 && !inGroup && !inTextRect && line.trim().startsWith(Tag.FRAME_ID)) // <ID { frame_Id = Parser.getTagContent(line, Tag.FRAME_ID); } else if (line.trim().equals(Tag.PGFTAG_CALLOUT)) { inCalloutPgfTag = true; } else if (line.trim().equals(Tag.PARA_END)) { // As callout pgfTag is always in "para", when para ends, set // this to false. inCalloutPgfTag = false; } } } private void secondLoop(List<String> lineList, Output output, Map<String, Boolean> FrameMap, Map<String, Boolean> TableMap, List<String> textRectListInBodyPage, List<String> textRectListInFrame, StringBuffer tmpString, Marker marker, List<String> textRectIdListForCallout) { Stack<String> tagLevel = new Stack<String>(); // this is a flag, saving whether or not it's translatable when entering // a footnote area. When leaving footnote, translatable flag should // remain // as what it is when entering footnote. boolean translatableOutsideNote = false; for (int lineNo = 0; lineNo < lineList.size(); lineNo++) { String line = lineList.get(lineNo).trim(); String lineWithWhiteSpace = lineList.get(lineNo); if (line.startsWith("<") && !line.endsWith(">") && lineNo > 0) { tagLevel.push(line.substring(1)); } else if (line.startsWith(">")) { if (line.equals(">") && !tagLevel.empty() && translatable) { String l = tagLevel.peek(); line += " # end of " + l; lineWithWhiteSpace += " # end of " + l; } tagLevel.pop(); } if (line.equals(Tag.FRAME_HEAD)) // <Frame { inFrame++; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (inFrame > 0 && !inGroup && !inTextRect && line.startsWith(Tag.FRAME_ID)) // <ID { String frameId = Parser.getTagContent(lineWithWhiteSpace, Tag.FRAME_ID); translatable = FrameMap.get(frameId); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.FRAME_END)) // > # end of Frame { inFrame--; // Nested "Frame":inner Frames have no "ID". if (inFrame == 0) { translatable = false; } addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.GROUP_HEAD)) // <Group { inGroup = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.GROUP_END)) // # end of Group { inGroup = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.TEXTRECT_HEAD)) // <TextRect { inTextRect = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.TEXTRECT_END)) // > # end of TextRect { inTextRect = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.startsWith(Tag.TABLE_ID)) // <TblID { String tableId = Parser.getTagContent(lineWithWhiteSpace, Tag.TABLE_ID); translatable = TableMap.get(tableId); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.TABLE_END)) // > # end of Tbl { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); translatable = false; } else if (line.equals(Tag.PARA_END)) // # end of Para { if (inString) { addTranslatableTmx(getStringPhEnd()); addSkeleton(output, Tag.PARALINE_END, WITH_RETURN); } addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); inString = false; } else if (line.startsWith(Tag.TEXTRECTID_HEAD)) // <TextRectID { String rectID = Parser.getTagContent(lineWithWhiteSpace, Tag.TEXTRECTID_HEAD); if (textRectListInBodyPage.contains(rectID) || textRectListInFrame.contains(rectID)) { translatable = true; } else { translatable = false; } if (inCalloutPgfTag && textRectIdListForCallout.contains(rectID)) { translatable = true; } if (inString) { addTranslatableTmx(getStringPhEnd()); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.TEXTRECTID, true)); addTranslatableTmx(getStringPhStart()); } else { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (translatable && line.startsWith(Tag.XREFEND_HEAD)) // <XRefEnd { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.XREF, true)); tmpString.setLength(0); inXrefTag = false; } else if (translatable && (inXrefTag || line.equals(Tag.XREF_HEAD))) // <XRef { endStringTag(output); inXrefTag = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (line.equals(Tag.PARALINE_HEAD)) // <ParaLine { if (!inString) { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (line.equals(Tag.PARALINE_END)) // # end of ParaLine { if (!inString) { addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } else if (line.startsWith(Tag.STRING_HEAD) && translatable) // <String { if (!inString) { addTranslatableTmx(getStringPhStart()); } inString = true; // output.addTranslatable(Parser.getStringContent(line)); addTranslatable(Parser.getStringContent(lineWithWhiteSpace)); } else if (translatable && line.equals(Tag.FONT_END)) // > # end of // Font { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.FONT, true)); tmpString.setLength(0); inFontTag = false; } else if (translatable && (inFontTag || line.equals(Tag.FONT_HEAD))) // <Font { endStringTag(output); inFontTag = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (translatable && line.equals(Tag.MARKER_END)) // > # end of // Marker { addTranslatableTmx(handleMarkerTag(marker)); inMarker = false; } else if (translatable && (inMarker || line.equals(Tag.MARKER_HEAD))) // <Marker { endStringTag(output); inMarker = true; if (line.startsWith(Tag.UNIQUE_HEAD)) // <Unique { marker.setUnique(Parser.getTagContent(lineWithWhiteSpace, Tag.UNIQUE_HEAD)); } else if (line.startsWith(Tag.MTYPENAME_HEAD)) // <MTypeName { marker.setMTypeName(Parser .getStringContent(lineWithWhiteSpace)); } else if (line.startsWith(Tag.MTYPE_HEAD)) // <MType { marker.setMType(Parser.getTagContent(lineWithWhiteSpace, Tag.MTYPE_HEAD)); } else if (line.startsWith(Tag.MTEXT_HEAD)) // <MText { marker.setMText(lineWithWhiteSpace.substring( lineWithWhiteSpace.indexOf("`") + 1, lineWithWhiteSpace.indexOf("'"))); } else if (line.startsWith(Tag.MCURRPAGE_HEAD)) // <MCurrPage { marker.setMCurrPage(Parser .getStringContent(lineWithWhiteSpace)); } } else if (inString && line.startsWith(Tag.CHAR_HEAD)) // <Char { // String nextLine = lineList.get(lineNo + 1); addTranslatableTmx(handleChar(lineWithWhiteSpace)); } else if (translatable && line.equals(Tag.VARIABLE_END)) // > # end // of // Variable { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.VARIABLE, true)); tmpString.setLength(0); inVariable = false; } else if (translatable && (inVariable || line.equals(Tag.VARIABLE_HEAD))) // <Variable { endStringTag(output); inVariable = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (line.startsWith(Tag.VARIABLE_DEF_HEAD) || line.startsWith(Tag.XREF_DEF_HEAD)) // <VariableDef & // <XRefDef & { exposeDef(lineWithWhiteSpace, output, "text"); } // else if (line.startsWith(Tag.PGF_NUMBER_STRING)) // <PgfNumString // { // handleNumString(line, output); // } else if (translatable && line.equals(Tag.CONDITIONAL_END)) // > # // end of // Conditional { tmpString.append(lineWithWhiteSpace); addTranslatableTmx(handleInlineTag(tmpString.toString(), Tag.CONDITIONAL, true)); tmpString.setLength(0); inConditional = false; } else if (translatable && (inConditional || line.startsWith(Tag.CONDITIONAL_HEAD))) // <Conditional { endStringTag(output); inConditional = true; tmpString.append(lineWithWhiteSpace).append("\n"); } else if (translatable && line.startsWith(Tag.UNCONDITIONAL)) // <Unconditional { endStringTag(output); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.CONDITIONAL, true)); } else if (line.equals(Tag.NOTES_HEAD)) // <Notes { translatableOutsideNote = translatable; translatable = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.NOTES_END)) // > # end of Notes { translatable = translatableOutsideNote; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (translatable && line.startsWith(Tag.NOTES_REF) && line.endsWith(">")) // <FNote { if (inString) { addTranslatableTmx(getStringPhEnd()); addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.NOTES, true)); addTranslatableTmx(getStringPhStart()); } else { addTranslatableTmx(handleInlineTag(lineWithWhiteSpace, Tag.NOTES, true)); } } else if (line.equals(Tag.PGFTAG_CALLOUT)) { inCalloutPgfTag = true; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else if (line.equals(Tag.PARA_END)) { // As callout pgfTag is always in "para", when para ends, set // this to false. inCalloutPgfTag = false; addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } else { endStringTag(output); addSkeleton(output, lineWithWhiteSpace, WITH_RETURN); } } } private void endStringTag(Output output) { if (inString) { addTranslatableTmx(getStringPhEnd()); inString = false; } } private String getStringPhStart() { StringBuffer stuff = new StringBuffer(); stuff.append("<ph type=\"" + Tag.STRING + "\" id=\"" + index + "\" x=\"" + index++ + "\">"); stuff.append(m_xmlEncoder.encodeStringBasic(Tag.STRING_HEAD + " `")) .append("</ph>"); return stuff.toString(); } private String getStringPhEnd() { StringBuffer stuff = new StringBuffer(); stuff.append("<ph type=\"" + Tag.STRING + "\" id=\"" + index + "\" x=\"" + index++ + "\">"); stuff.append(m_xmlEncoder.encodeStringBasic(Tag.STRING_END)) .append("\n").append("</ph>"); return stuff.toString(); } private void exposeDef(String line, Output output, String tagType) { int start = line.indexOf("`"); int end = line.indexOf("'"); if (start != -1 && end != -1) { String middle = line.substring(start + 1, end); String head = line.substring(0, start + 1); String tail = line.substring(end); addSkeleton(output, head, NO_RETURN);// add head as skeleton, with // no return /* * pattern contains 4 kinds: 1: <$marker2\\> 2: * <Emphasis\\>A15-24<Default Font\\> 3: normal string We should 4: * a:Chapter <n=3\>< \>< \>< \>< \> check whether it matches all * patterns. */ if (middle.matches(regexp2)) { addSkeleton(output, middle.substring(0, 2), NO_RETURN);// add // the // front // 2 // characters // to // skeleton middle = middle.substring(2); // remove the front 2 characters } String def = this.replaceSpecialCharactor(middle, true); if (def.length() == 0) { this.addSkeleton(output, tail, WITH_RETURN); return; } if (def.matches(regexp1)) { String syntax; String inline = def;// String contains <ph>...</ph> try { inline = replaceUnicodeCharacter(inline); while ((syntax = getSyntax(inline, regexp1)) != null) { String inlineSyntax = this.handleInlineTag(syntax, tagType, false); start = inline.lastIndexOf(syntax); inline = inline.substring(0, start) + inlineSyntax + inline.substring(start + syntax.length()); } } catch (ArrayIndexOutOfBoundsException e) { this.addSkeleton(output, middle, NO_RETURN); this.addSkeleton(output, tail, WITH_RETURN); return; } inline = revertUnicodeCharacter(inline); String meaningful = getContentsBetweenPh(inline); if (meaningful.trim().matches("\\W*")) { /* * some variable should not be exposed for translation, for * example -- <VariableDef * `<$monthnum\>/<$daynum\>/<$shortyear\>'>, it will * transfer to "[x1]/[x2]/[x3]", which has no meaning. */ this.addSkeleton(output, middle, NO_RETURN); } else { /* * if the def contains charactors */ String encodedMeaningful = encodeMeaningful(inline); addTranslatableTmx(encodedMeaningful); } } else { addTranslatable(middle); } this.addSkeleton(output, tail, WITH_RETURN);// add tail as skeleton } else { this.addSkeleton(output, line, WITH_RETURN);// add whole as skeleton } } /** * Transfer \xnn and \\t into inline tags * * @param content * @param protectDblQuotations * - boolean: if there are unicode "double quotation marks", put * them into PH tags. * @return */ private String replaceSpecialCharactor(String content, boolean protectDblQuotations) { String regexp = "\\\\x[\\w]{2}[\\s]?"; java.util.regex.Pattern PATTERN = java.util.regex.Pattern .compile(regexp); Matcher m = PATTERN.matcher(content); String result = null; List<String> transfered = new ArrayList<String>(); while (m.find()) { result = m.group(0); /* * Remember, transfered \xnn pattern string will still in the \xnn * pattern, so in order to avoid transfering again and again, we * should know whether the match has been transfered already. */ if (!transfered.contains(result)) { transfered.add(result); content = content.replace(result, handleInlineTag(result, "text", false)); } } String regexp1 = "[\\\\]{1,2}t"; PATTERN = java.util.regex.Pattern.compile(regexp1); m = PATTERN.matcher(content); if (m.find()) { result = m.group(0); content = content.replace(result, handleInlineTag(result, "text", false)); } if (protectDblQuotations) { // if there are unicode "double quotation marks", put them into PH // tags. boolean isInTag = false; StringBuilder newContent = new StringBuilder(); char[] chars = content.toCharArray(); for (int i = 0; i < chars.length; i++) { char ch = chars[i]; if (!isInTag && (ch == '\u201c' || ch == '\u201d')) { newContent.append(handleInlineTag(String.valueOf(ch), "text", false)); } else { newContent.append(ch); if (ch == '<') { isInTag = true; } else if (ch == '>') { isInTag = false; } } } return newContent.toString(); } else { return content; } } /** * Get last string which is in the regexp pattern * * @param line * @param regexp * @return */ private String getSyntax(String line, String regexp) throws ArrayIndexOutOfBoundsException { try { PatternCompiler compiler = new Perl5Compiler(); Pattern pattern = compiler.compile(regexp, Perl5Compiler.CASE_INSENSITIVE_MASK); PatternMatcher matcher = new Perl5Matcher(); if (matcher.contains(line, pattern)) { MatchResult result = matcher.getMatch(); String reg = result.group(1); return reg; } else { return null; } } catch (MalformedPatternException e) { return null; } } /** * Transfer tags into inline tags with &lt;ph&gt; * * @param string * the String content of the file * @param tagType * @param newline * whether the end contains a \n * @return */ private String handleInlineTag(String string, String tagType, boolean newline) { StringBuffer stuff = new StringBuffer(); stuff.append("<ph type=\"" + tagType + "\" id=\"" + index + "\" x=\"" + index++ + "\">"); stuff.append(m_xmlEncoder.encodeStringBasic(string)); if (newline) { stuff.append("\n"); } stuff.append("</ph>"); return stuff.toString(); } /** * Replace special charactors * * @param line * @return */ private String handleChar(String line) { String key = Parser.getTagContent(line, Tag.CHAR_HEAD); // hardreturn, Tab, HardSpace will convert to inline tags if (key.equalsIgnoreCase("HardReturn") || key.equalsIgnoreCase("Tab") || key.equalsIgnoreCase("HardSpace")) { if (!key.equalsIgnoreCase("HardReturn")) { inString = false; } StringBuffer stuff = new StringBuffer(); stuff.append(getStringPhEnd()); // end upper string line stuff.append("<ph type=\"" + Tag.CHAR + "\" id=\"" + index + "\" x=\"" + index++ + "\">"); stuff.append(m_xmlEncoder.encodeStringBasic(line)); stuff.append("\n"); if (key.equalsIgnoreCase("HardReturn")) { // append the next piece of string stuff.append(m_xmlEncoder.encodeStringBasic(Tag.PARALINE_END)) .append("\n") .append(m_xmlEncoder .encodeStringBasic(Tag.PARALINE_HEAD)) .append("\n") .append(m_xmlEncoder.encodeStringBasic(Tag.STRING_HEAD + " `")); } stuff.append("</ph>"); return stuff.toString(); } String replace = specialCharMap.get(key); if (replace != null) { return replace; } else { return " "; } } /** * Add skeletons to output with line warpping * * @param output * @param line */ private void addSkeleton(Output output, String line, boolean newLine) { // add translatable segement first handleTranslatableSegements(output); // add skeleton segment output.addSkeleton(line); if (newLine) { output.addSkeleton("\n"); } } /** * Add translatable segments to output * * @param output */ private void handleTranslatableSegements(Output output) { String trans = storage.toString(); if (trans.length() != 0) { if (trans.trim().length() == 0) { output.addSkeleton(trans); } else if (trans.contains("<ph") && trans.contains("</ph>")) { trans = getContentsBetweenPh(trans); if (trans.trim().length() == 0) { String cont = getContentsInPh(storage.toString()); output.addSkeleton(m_xmlEncoder.decodeStringBasic(cont)); } else { mergeContinuousInlineTags(output, storage.toString()); } } else { output.addTranslatableTmx(storage.toString().trim()); } } storage.setLength(0); } private void mergeContinuousInlineTags(Output output, String content) { // remove head ph String[] headAndContent = removeHeadingPh(content); if (!headAndContent[0].equals("")) { output.addSkeleton(m_xmlEncoder .decodeStringBasic(headAndContent[0])); } // remove tail ph String[] tailAndContent = removeEndingPh(headAndContent[1]); // merge continuous inline tags content = tailAndContent[1].replaceAll(continusInlineTag, ""); if (m_xmlEncoder.decodeStringBasic(content).matches("\\W*")) { content = m_xmlEncoder.decodeStringBasic(content); content = content.replace("\\", "\\\\").replace("'", "\\q") .replace("`", "\\Q").replace("&gt;", "\\>") .replace(">", "\\>"); output.addSkeleton(content); } else { // GBS-2622 problem #3. content = changeTypeForSuperscript(content); output.addTranslatableTmx(content); } if (!tailAndContent[0].equals("")) { output.addSkeleton(m_xmlEncoder .decodeStringBasic(tailAndContent[0])); } } /** * If the translatable content has "Superscript",change its default "type" * to "superscript". */ private String changeTypeForSuperscript(String p_content) { if (p_content == null || p_content.indexOf("Superscript") == -1) { return p_content; } try { StringBuilder result = new StringBuilder(); String strFirst, strMiddle, strLast; strLast = new String(p_content); int phStartIndex = -1; int phEndIndex = -1; while (strLast.indexOf("Superscript") > -1) { phStartIndex = strLast.indexOf("<ph"); phEndIndex = strLast.indexOf("</ph>"); strFirst = strLast.substring(0, phStartIndex); strMiddle = strLast.substring(phStartIndex, phEndIndex + 5); strLast = strLast.substring(phEndIndex + 5); result.append(strFirst); if (strMiddle.indexOf("Superscript") == -1) { result.append(strMiddle); } else { result.append(changeType(strMiddle)); } phStartIndex = -1; phEndIndex = -1; strFirst = ""; strMiddle = ""; changeTypeForSuperscript(strLast); } if (strLast.length() > 0) { result.append(strLast); } return result.toString(); } catch (Exception e) { logger.warn("Error when changeTypeForSuperscript() for " + p_content); return p_content; } } private String changeType(String p_str) { return p_str.replaceFirst("type=\"text\"", "type=\"superscript\""); } /** * Remove heading inline tags * * @param content * @return */ private String[] removeHeadingPh(String content) { StringBuffer head = new StringBuffer(""); while (content.trim().startsWith("<ph")) { int start = content.indexOf(">"); int end = content.indexOf("</ph>"); String firstInlineContent = content.substring(start + 1, end); if (inlineTags.contains(firstInlineContent) || firstInlineContent.contains("<sub")) { break; } head.append(firstInlineContent); content = content.substring(end + "</ph>".length()); } return new String[] { head.toString(), content }; } /** * Remove ending inline tags * * @param content * @return */ private String[] removeEndingPh(String content) { String tail = ""; while (content.trim().endsWith("</ph>")) { String tmp = content.substring(content.lastIndexOf("<ph")); if (tmp.contains("<sub")) { break; } String lastInlineContent = this.getContentsInPh(tmp); if (inlineTags.contains(lastInlineContent)) { break; } tail = lastInlineContent + tail; content = content.substring(0, content.lastIndexOf(tmp)); } return new String[] { tail, content }; } /** * The method is used to encode meaningful part of VariableDef tag * * @param content * @return */ private String encodeMeaningful(String content) { StringBuffer result = new StringBuffer(); while (content.indexOf("</ph>") != -1) { String phTag = content.substring(content.indexOf("<ph"), content.indexOf("</ph>") + "</ph>".length()); String beforePh = content.substring(0, content.indexOf("<ph")); result.append(m_xmlEncoder.encodeStringBasic(beforePh)).append( phTag); content = content.substring(content.indexOf("</ph>") + "</ph>".length()); } result.append(m_xmlEncoder.encodeStringBasic(content)); return result.toString(); } /** * Get contents between inline tags. Example: content:abc<ph * type=...>def</ph>ghi return: abcghi return: abcghi * * @param content * @return string */ private String getContentsBetweenPh(String content) { while (content.contains("</ph>")) { int start = content.indexOf("<ph"); int end = content.indexOf("</ph>"); content = content.substring(0, start) + content.substring(end + "</ph>".length()); } return content; } /** * Get contents in inline tags Example:<ph type=...>abc</ph><ph * type=...>def</ph> Return:abcdef * * @param content * @return */ private String getContentsInPh(String content) { while (content.contains("</ph>")) { int start1 = content.indexOf("<ph"); int start = content.indexOf(">", start1); int end = content.indexOf("</ph>"); content = content.substring(0, start1) + content.substring(start + 1, end) + content.substring(end + "</ph>".length()); } while (content.contains("</sub>")) { int start1 = content.indexOf("<sub"); int start = content.indexOf(">", start1); int end = content.indexOf("</sub>"); content = content.substring(0, start1) + content.substring(start + 1, end) + content.substring(end + "</sub>".length()); } return content; } private void addTranslatableTmx(String content) { storage.append(content); } private void addTranslatable(String content) { String tmp = m_xmlEncoder.encodeStringBasic(content); tmp = this.replaceSpecialCharactor(tmp, false); addTranslatableTmx(tmp); } /** * Expose PgfNumString for translation Get string value and replace special * charactors. After this, check whether the content contains meaningful * charactors. If true, add the content to translatable, else add the * content to skeleton. * <p> * Because of GBS-3209, we found "&lt;PgfNumString `string'&gt;" needs to be * changed to "&lt;Pgf &lt;PgfNumFormat `string'&gt; &gt; # end of Pgf" so * that the translation can be updated to exported mif or fm file. */ private void handleNumString(String line, Output output) { String content = Parser.getStringContent(line); int start = line.indexOf("`"); int end = line.indexOf("'"); boolean transform = false; if (start != -1 && end != -1) { String head = line.substring(0, start + 1); String tail = line.substring(end); if (content.length() > 0) { String tmp = getContentsBetweenPh(replaceSpecialCharactor( content, false)); if (tmp.trim().matches("\\W*")) { this.addSkeleton(output, head, NO_RETURN); // add content as skeleton, with no return this.addSkeleton(output, content, NO_RETURN); } else { transform = true; this.addSkeleton(output, Tag.PGF_HEAD, WITH_RETURN); this.addSkeleton(output, Tag.PGF_NUMBER_FORMAT + " `", NO_RETURN); this.addTranslatable(content); } } else { this.addSkeleton(output, head, NO_RETURN); this.addSkeleton(output, content, NO_RETURN); } addSkeleton(output, tail, WITH_RETURN); if (transform) { addSkeleton(output, Tag.PGF_END, WITH_RETURN); } } } /** * If the MTypeName of Marker is index, make MText subflow * * @param marker * @return */ private String handleMarkerTag(Marker marker) { StringBuffer stuff = new StringBuffer(); stuff.append("<ph type=\"" + Tag.MARKER + "\" id=\"" + index + "\" x=\"" + index++ + "\">"); stuff.append(m_xmlEncoder.encodeStringBasic("<Marker\n")); if (marker.getMType() != null) { stuff.append(m_xmlEncoder.encodeStringBasic("<MType " + marker.getMType() + ">\n")); } if (marker.getMTypeName() != null) { stuff.append(m_xmlEncoder.encodeStringBasic("<MTypeName `" + marker.getMTypeName() + "'>\n")); } if (marker.getMText() != null) { if (marker.getMTypeName() != null && marker.getMTypeName().equals("Index")) { stuff.append(m_xmlEncoder.encodeStringBasic("<MText `")) .append("<sub type=\"text\" locType=\"translatable\">") .append(m_xmlEncoder.encodeStringBasic(marker .getMText())).append("</sub>") .append(m_xmlEncoder.encodeStringBasic("'>\n")); } else { stuff.append(m_xmlEncoder.encodeStringBasic("<MText `" + marker.getMText() + "'>\n")); } } if (marker.getMCurrPage() != null) { stuff.append(m_xmlEncoder.encodeStringBasic("<MCurrPage `" + marker.getMCurrPage() + "'>\n")); } if (marker.getUnique() != null) { stuff.append(m_xmlEncoder.encodeStringBasic("<Unique " + marker.getUnique() + ">\n")); } stuff.append(m_xmlEncoder.encodeStringBasic("> # end of Marker")) .append("\n").append("</ph>"); return stuff.toString(); } private void reset() { inString = false; inFontTag = false; inXrefTag = false; inMarker = false; inPage = false; translatable = false; inFrame = 0; inTextRect = false; inGroup = false; inVariable = false; inConditional = false; inCalloutPgfTag = false; } private class Marker { String mTypeName; String mText; String unique; String mType; String mCurrPage; public String getMTypeName() { return mTypeName; } public void setMTypeName(String typeName) { mTypeName = typeName; } public String getMText() { return mText; } public void setMText(String text) { mText = text; } public String getUnique() { return unique; } public void setUnique(String unique) { this.unique = unique; } public String getMType() { return mType; } public void setMType(String type) { mType = type; } public String getMCurrPage() { return mCurrPage; } public void setMCurrPage(String currPage) { mCurrPage = currPage; } } private class TextRectInFrame { Map<String, List<String>> map = new HashMap<String, List<String>>(); public void saveRect(String frameId, String textRectId) { List<String> existList = map.get(frameId); if (existList == null) { existList = new ArrayList<String>(); } existList.add(textRectId); map.put(frameId, existList); } public List<String> getTextRectInFrame(String frameId) { List<String> tmp = map.get(frameId); if (tmp == null) { return new ArrayList<String>(); } return map.get(frameId); } } private String replaceUnicodeCharacter(String inline) { if (inline == null) { return null; } inline = inline.replace("\u201c", "_U201C_"); inline = inline.replace("\u201d", "_U201D_"); return inline; } private String revertUnicodeCharacter(String inline) { if (inline == null) { return null; } inline = inline.replace("_U201C_", "\u201c"); inline = inline.replace("_U201D_", "\u201d"); return inline; } public void loadRules() throws ExtractorException { // String str_rules = getInput().getRules(); // m_rules.loadRules(str_rules); // m_rules.loadRules(getDynamicRules()); } }
[ "kenny.jiang@welocalize.com" ]
kenny.jiang@welocalize.com
746408eb72811681aba84312c5212341f8726632
c38726cc66dd2155f60a2b88823612853ea3e443
/src/dao/member/SubscriptionDao.java
8f3947658143573ba4b8474708ea80868c2638b9
[]
no_license
Semi-project/Semi
29790371891721db2e5407bd40c5d180e26fe66e
8fd04b5fcd1d48c1378b97ee8abab65d82876ca2
refs/heads/master
2020-04-01T19:15:08.358826
2019-01-02T04:01:07
2019-01-02T04:01:07
152,950,015
0
0
null
2018-10-17T05:12:44
2018-10-14T07:31:22
Java
UTF-8
Java
false
false
388
java
package dao.member; import dto.member.Member; import dto.member.Subscription; public interface SubscriptionDao { //수신동의 여부 public int insertSubscription(Subscription sub); //유저아이디 수신여부 조회 public Subscription selectSubscriptionByuserId(Member member); // 수신동의 여부 수정 public Subscription updateSubscription(Subscription sub); }
[ "atig00328@naver.com" ]
atig00328@naver.com
cb1a238e60d8c01e8e070716f90fa5368e05a639
729d8cf7f88e1a46277a56845b193e6966ac5b2e
/store-ms/src/test/java/com/spring/cloud/microservices/sample/storems/StoreMsApplicationTests.java
c915f9300428b059887ffd41bfb933a9273e9df3
[ "MIT" ]
permissive
davidkmaia/spring-cloud-microservices-sample
f8ba2afab423b772d3140d3c020b55fe2cf46f0b
fb799447c53fae3c0961c8c6bfffb143f5c6da2c
refs/heads/main
2023-07-12T20:23:30.443719
2021-08-16T22:09:40
2021-08-16T22:09:40
320,074,997
0
0
null
null
null
null
UTF-8
Java
false
false
238
java
package com.spring.cloud.microservices.sample.storems; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class StoreMsApplicationTests { @Test void contextLoads() { } }
[ "davidkmaia@gmail.com" ]
davidkmaia@gmail.com
062da14ed825598f389812d996838fe45b45c76e
1508cf9d44f2bc8325f637c30012e88700c45eb2
/src/main/java/com/dheerajdac/code/leet/easy/ValidParentheses.java
46d4428cdea62999a26c347825a15ee173c2df0b
[]
no_license
dheerajdac/code
7f1959492edd72065e3d454d23576f5755bd36ea
3d2110c9659107e598b1d95940dead7768b2808b
refs/heads/master
2022-06-04T19:53:44.728960
2022-03-29T15:39:34
2022-03-29T15:39:34
237,625,296
0
0
null
2020-12-05T18:51:03
2020-02-01T14:18:58
Java
UTF-8
Java
false
false
1,310
java
package com.dheerajdac.code.leet.easy; /* valid-parentheses */ import java.util.Deque; import java.util.LinkedList; public class ValidParentheses { public boolean isValid(String s) { Deque<Character> stack = new LinkedList<>(); for (char c: s.toCharArray()) { if(c == '{' || c == '[' || c == '('){ stack.addLast(c); } else { if(c == '}') { if(stack.size() !=0 && stack.peekLast() == '{'){ stack.removeLast(); } else { stack.addLast(c); break; } } if(c == ']'){ if(stack.size() !=0 && stack.peekLast() == '['){ stack.removeLast(); } else { stack.addLast(c); break; } } if(c == ')'){ if(stack.size() !=0 && stack.peekLast() == '('){ stack.removeLast(); } else { stack.addLast(c); break; } } } } return stack.size() == 0; } }
[ "dheerajdac@gmail.com" ]
dheerajdac@gmail.com
4f2f8f4135402666669b578c55d4fdd2f75eb486
eac1f6fcee935f82c7e01a6394b09a6b770c48ee
/cocoatouch/src/main/java/org/robovm/apple/corefoundation/CFLocaleComponent.java
6815eac4c395112c02fe12cb6133ab21bfcdc09d
[ "Apache-2.0" ]
permissive
neocxi/robovm
c656aaeaa72de6c87f891a88a0f90acc2538dc01
906cdbe40a199ba6f545d1ee659dc1fc0accfae6
refs/heads/master
2021-01-18T00:07:13.766667
2015-01-23T20:14:43
2015-01-23T20:14:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,063
java
/* * Copyright (C) 2014 Trillian Mobile AB * * 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.robovm.apple.corefoundation; /*<imports>*/ import java.io.*; import java.nio.*; import java.util.*; import org.robovm.objc.*; import org.robovm.objc.annotation.*; import org.robovm.objc.block.*; import org.robovm.rt.*; import org.robovm.rt.bro.*; import org.robovm.rt.bro.annotation.*; import org.robovm.rt.bro.ptr.*; import org.robovm.apple.dispatch.*; import org.robovm.apple.foundation.*; /*</imports>*/ /*<javadoc>*/ /*</javadoc>*/ @Marshaler(CFLocaleComponent.Marshaler.class) /*<annotations>*/@Library("CoreFoundation")/*</annotations>*/ /*<visibility>*/public/*</visibility>*/ class /*<name>*/CFLocaleComponent/*</name>*/ extends /*<extends>*/Object/*</extends>*/ /*<implements>*//*</implements>*/ { public static class Marshaler { @MarshalsPointer public static CFLocaleComponent toObject(Class<CFLocaleComponent> cls, long handle, long flags) { NSString o = (NSString) NSObject.Marshaler.toObject(NSString.class, handle, flags); if (o == null) { return null; } return CFLocaleComponent.valueOf(o); } @MarshalsPointer public static long toNative(CFLocaleComponent o, long flags) { if (o == null) { return 0L; } return NSObject.Marshaler.toNative(o.value(), flags); } } public static class AsMapMarshaler { @SuppressWarnings("unchecked") @MarshalsPointer public static Map<CFLocaleComponent, NSObject> toObject(Class<? extends NSObject> cls, long handle, long flags) { NSDictionary<NSString, NSObject> o = (NSDictionary<NSString, NSObject>) NSObject.Marshaler.toObject(NSDictionary.class, handle, flags); if (o == null) { return null; } Map<CFLocaleComponent, NSObject> map = new HashMap<>(); for (Map.Entry<NSString, NSObject> e : o.entrySet()) { map.put(CFLocaleComponent.valueOf(e.getKey()), e.getValue()); } return map; } @MarshalsPointer public static long toNative(Map<CFLocaleComponent, NSObject> o, long flags) { if (o == null) { return 0L; } NSDictionary<NSString, NSObject> dict = new NSMutableDictionary<>(); for (Map.Entry<CFLocaleComponent, NSObject> e : o.entrySet()) { dict.put(e.getKey().value(), e.getValue()); } return NSObject.Marshaler.toNative(dict, flags); } } /*<ptr>*/ /*</ptr>*/ /*<bind>*/static { Bro.bind(CFLocaleComponent.class); }/*</bind>*/ /*<constants>*//*</constants>*/ public static final CFLocaleComponent Identifier = new CFLocaleComponent("IdentifierValue"); public static final CFLocaleComponent LanguageCode = new CFLocaleComponent("LanguageCodeValue"); public static final CFLocaleComponent CountryCode = new CFLocaleComponent("CountryCodeValue"); public static final CFLocaleComponent ScriptCode = new CFLocaleComponent("ScriptCodeValue"); public static final CFLocaleComponent VariantCode = new CFLocaleComponent("VariantCodeValue"); public static final CFLocaleComponent ExemplarCharacterSet = new CFLocaleComponent("ExemplarCharacterSetValue"); public static final CFLocaleComponent CalendarIdentifier = new CFLocaleComponent("CalendarIdentifierValue"); public static final CFLocaleComponent Calendar = new CFLocaleComponent("CalendarValue"); public static final CFLocaleComponent CollationIdentifier = new CFLocaleComponent("CollationIdentifierValue"); public static final CFLocaleComponent UsesMetricSystem = new CFLocaleComponent("UsesMetricSystemValue"); public static final CFLocaleComponent MeasurementSystem = new CFLocaleComponent("MeasurementSystemValue"); public static final CFLocaleComponent DecimalSeparator = new CFLocaleComponent("DecimalSeparatorValue"); public static final CFLocaleComponent GroupingSeparator = new CFLocaleComponent("GroupingSeparatorValue"); public static final CFLocaleComponent CurrencySymbol = new CFLocaleComponent("CurrencySymbolValue"); public static final CFLocaleComponent CurrencyCode = new CFLocaleComponent("CurrencyCodeValue"); /** * @since Available in iOS 4.0 and later. */ public static final CFLocaleComponent CollatorIdentifier = new CFLocaleComponent("CollatorIdentifierValue"); /** * @since Available in iOS 4.0 and later. */ public static final CFLocaleComponent QuotationBeginDelimiterKey = new CFLocaleComponent("QuotationBeginDelimiterKeyValue"); /** * @since Available in iOS 4.0 and later. */ public static final CFLocaleComponent QuotationEndDelimiterKey = new CFLocaleComponent("QuotationEndDelimiterKeyValue"); /** * @since Available in iOS 4.0 and later. */ public static final CFLocaleComponent AlternateQuotationBeginDelimiterKey = new CFLocaleComponent("AlternateQuotationBeginDelimiterKeyValue"); /** * @since Available in iOS 4.0 and later. */ public static final CFLocaleComponent AlternateQuotationEndDelimiterKey = new CFLocaleComponent("AlternateQuotationEndDelimiterKeyValue"); private static CFLocaleComponent[] values = new CFLocaleComponent[] {Identifier, LanguageCode, CountryCode, ScriptCode, VariantCode, ExemplarCharacterSet, CalendarIdentifier, Calendar, CollationIdentifier, UsesMetricSystem, MeasurementSystem, DecimalSeparator, GroupingSeparator, CurrencySymbol, CurrencyCode, CollatorIdentifier, QuotationBeginDelimiterKey, QuotationEndDelimiterKey, AlternateQuotationBeginDelimiterKey, AlternateQuotationEndDelimiterKey}; private final LazyGlobalValue<NSString> lazyGlobalValue; private CFLocaleComponent(String getterName) { lazyGlobalValue = new LazyGlobalValue<>(getClass(), getterName); } /*<constructors>*//*</constructors>*/ /*<properties>*//*</properties>*/ /*<members>*//*</members>*/ public NSString value() { return lazyGlobalValue.value(); } public static CFLocaleComponent valueOf(NSString value) { for (CFLocaleComponent v : values) { if (v.value().equals(value)) { return v; } } throw new IllegalArgumentException("No constant with value " + value + " found in " + /*<name>*/CFLocaleComponent/*</name>*/.class.getName()); } /*<methods>*/ @GlobalValue(symbol="kCFLocaleIdentifier", optional=true) public static native NSString IdentifierValue(); @GlobalValue(symbol="kCFLocaleLanguageCode", optional=true) public static native NSString LanguageCodeValue(); @GlobalValue(symbol="kCFLocaleCountryCode", optional=true) public static native NSString CountryCodeValue(); @GlobalValue(symbol="kCFLocaleScriptCode", optional=true) public static native NSString ScriptCodeValue(); @GlobalValue(symbol="kCFLocaleVariantCode", optional=true) public static native NSString VariantCodeValue(); @GlobalValue(symbol="kCFLocaleExemplarCharacterSet", optional=true) public static native NSString ExemplarCharacterSetValue(); @GlobalValue(symbol="kCFLocaleCalendarIdentifier", optional=true) public static native NSString CalendarIdentifierValue(); @GlobalValue(symbol="kCFLocaleCalendar", optional=true) public static native NSString CalendarValue(); @GlobalValue(symbol="kCFLocaleCollationIdentifier", optional=true) public static native NSString CollationIdentifierValue(); @GlobalValue(symbol="kCFLocaleUsesMetricSystem", optional=true) public static native NSString UsesMetricSystemValue(); @GlobalValue(symbol="kCFLocaleMeasurementSystem", optional=true) public static native NSString MeasurementSystemValue(); @GlobalValue(symbol="kCFLocaleDecimalSeparator", optional=true) public static native NSString DecimalSeparatorValue(); @GlobalValue(symbol="kCFLocaleGroupingSeparator", optional=true) public static native NSString GroupingSeparatorValue(); @GlobalValue(symbol="kCFLocaleCurrencySymbol", optional=true) public static native NSString CurrencySymbolValue(); @GlobalValue(symbol="kCFLocaleCurrencyCode", optional=true) public static native NSString CurrencyCodeValue(); /** * @since Available in iOS 4.0 and later. */ @GlobalValue(symbol="kCFLocaleCollatorIdentifier", optional=true) public static native NSString CollatorIdentifierValue(); /** * @since Available in iOS 4.0 and later. */ @GlobalValue(symbol="kCFLocaleQuotationBeginDelimiterKey", optional=true) public static native NSString QuotationBeginDelimiterKeyValue(); /** * @since Available in iOS 4.0 and later. */ @GlobalValue(symbol="kCFLocaleQuotationEndDelimiterKey", optional=true) public static native NSString QuotationEndDelimiterKeyValue(); /** * @since Available in iOS 4.0 and later. */ @GlobalValue(symbol="kCFLocaleAlternateQuotationBeginDelimiterKey", optional=true) public static native NSString AlternateQuotationBeginDelimiterKeyValue(); /** * @since Available in iOS 4.0 and later. */ @GlobalValue(symbol="kCFLocaleAlternateQuotationEndDelimiterKey", optional=true) public static native NSString AlternateQuotationEndDelimiterKeyValue(); /*</methods>*/ }
[ "blueriverteam@gmail.com" ]
blueriverteam@gmail.com
59f00f61c131972edd9f1907cb6392098be0c48a
02d3f808cfb137260f04178fcdbccb10d3193124
/src/main/java/com/codiibear/imagination/controller/CkeditorTry.java
ef316fc01f52cbc594f68a2ff88b8d4b39bb3428
[]
no_license
codibear/Imagination
c79d47f90384f9d5cea38036e9d8a874d5ebd0cc
4a980a5f781928f5e2f6bcc59f9cbfeec704ecea
refs/heads/master
2020-03-19T15:44:55.309485
2018-06-09T02:44:59
2018-06-09T02:44:59
133,289,106
0
0
null
null
null
null
UTF-8
Java
false
false
838
java
package com.codiibear.imagination.controller; import com.codiibear.imagination.util.ImageUploadUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by codiibear on 2018/5/2. */ @Controller @RequestMapping(value = "/ckeditory") public class CkeditorTry { public void imageUpload(HttpServletRequest request, HttpServletResponse response) { String DirectoryName = "upload/"; try { ImageUploadUtil.ckeditor(request, response, DirectoryName); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
[ "291858411@qq.com" ]
291858411@qq.com
13f6acba57ce434f03ce71198d785f55de4848c6
3cb1a86006f9201e1835cb6bab34e5567d4ae95d
/src/main/java/com/bsb/practice/security/jwt/JWTConfigurer.java
d3d2ab2899ad8d21307708d873e2815a9b34e194
[]
no_license
zliang3110/jhipsterApp
3943e1c67bb88d0c2afad9a4e64cce3b033ab252
4f0e74d4d0d54e4b1e0c31c1f2c65c10b9dd84df
refs/heads/master
2021-05-15T19:28:40.814817
2017-10-20T16:41:21
2017-10-20T16:41:21
107,702,511
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package com.bsb.practice.security.jwt; import org.springframework.security.config.annotation.SecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.web.DefaultSecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; public class JWTConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> { public static final String AUTHORIZATION_HEADER = "Authorization"; private TokenProvider tokenProvider; public JWTConfigurer(TokenProvider tokenProvider) { this.tokenProvider = tokenProvider; } @Override public void configure(HttpSecurity http) throws Exception { JWTFilter customFilter = new JWTFilter(tokenProvider); http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
6cf447a865aa7ad7494dd3e8abd5549f3713b21d
2102295c51325980d9162827e63e4f4f49be356a
/src/main/java/br/com/alura/forum/model/Usuario.java
4c6f2ea4b0005caebfc7d5f59d86c50e303b2e49
[]
no_license
williamgo0205/SpringBoot_ApiRest_Forum
b87c4b5aa4993be20f78967d744645f8f7229391
e3da78fe4947c759c705358c5c78d22f162f6c7e
refs/heads/master
2021-07-11T21:25:17.849934
2021-02-18T22:06:38
2021-02-18T22:06:38
233,022,539
1
0
null
null
null
null
UTF-8
Java
false
false
2,183
java
package br.com.alura.forum.model; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToMany; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @Entity public class Usuario implements UserDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String nome; private String email; private String senha; @ManyToMany(fetch = FetchType.EAGER) private List<Perfil> perfis = new ArrayList<>(); @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Usuario other = (Usuario) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getSenha() { return senha; } public void setSenha(String senha) { this.senha = senha; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return this.perfis; } @Override public String getPassword() { return this.senha; } @Override public String getUsername() { return this.email; } @Override public boolean isAccountNonExpired() { return true; } @Override public boolean isAccountNonLocked() { return true; } @Override public boolean isCredentialsNonExpired() { return true; } @Override public boolean isEnabled() { return true; } }
[ "william.oliveira@matera.com" ]
william.oliveira@matera.com
170ca15a55d0189b2141358e62b7eb73c26ee018
0d0cdaeea5e5cb6fbc3fa8751d152aaf88ecfad3
/src/org/apex/learn/BasicCalculater.java
1301ba1823b9df6d097a04afc2d2677d952875d1
[]
no_license
deepshikha82/projectone
6655107718ff8e672baa2a5322f7da7dfd0b5b9d
55b8f6301253bb7a6801887cd4cf821b5ccf6c13
refs/heads/master
2020-04-24T12:49:17.408713
2019-03-03T06:24:44
2019-03-03T06:24:44
171,967,495
0
0
null
null
null
null
UTF-8
Java
false
false
875
java
package org.apex.learn; import java.util.Scanner; public class BasicCalculater { public static void main(String args[]) { int first, second ,add ,subtraction,multiply; double divide; Scanner scanner = new Scanner(System.in); System.out.println("Enter Two Numbers: "); first = scanner.nextInt(); second = scanner.nextInt(); add = first + second; subtraction = first - second; multiply = first * second; divide = first / second; System.out.println("sum = " + add); System.out.println("difference = " + subtraction); System.out.println("multiplication = " + multiply); System.out.println("division = " + divide); scanner.close(); } }
[ "deepshikha@Rajas-MacBook-Pro.local" ]
deepshikha@Rajas-MacBook-Pro.local
e4518e540862a4b2a98637aa203d69e634a1b1a2
c661b962b5eabf4b122e79b410c46a0f4625c963
/src/main/java/com/dolphin2point0/damagenotifier/mixin/ClientPlayerMixin.java
67e0388e81137b5255fdbbe803d777cf3661f8a5
[ "CC0-1.0" ]
permissive
Dolphin2Point1/DamageNotifier
299e169a9abccade80821fc7ac1a4f1b68b9d0ec
fd58559602c70510f7d651bf95cdc3de2b729467
refs/heads/master
2023-06-14T21:14:20.674084
2021-07-06T21:35:08
2021-07-06T21:35:08
382,375,100
0
0
null
null
null
null
UTF-8
Java
false
false
1,274
java
package com.dolphin2point0.damagenotifier.mixin; import com.dolphin2point0.damagenotifier.mixin.accessor.MinecraftClientAccessor; import com.dolphin2point0.damagenotifier.mixin.accessor.WindowAccessor; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.util.Window; import net.minecraft.entity.damage.DamageSource; import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Environment(EnvType.CLIENT) @Mixin(ClientPlayerEntity.class) public class ClientPlayerMixin { @Inject(method = "damage", at = @At("HEAD")) public void onDamage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) { MinecraftClientAccessor clientAccess = (MinecraftClientAccessor) MinecraftClient.getInstance(); if(!clientAccess.getWindowFocused()) { Window window = clientAccess.getWindow(); GLFW.glfwRequestWindowAttention(((WindowAccessor) (Object) window).getHandle()); } } }
[ "finb7729@gmail.com" ]
finb7729@gmail.com
3d663a7fd72dc162f3da3cb522617fd04e6a9a90
98d313cf373073d65f14b4870032e16e7d5466f0
/gradle-open-labs/example/src/main/java/se/molybden/Class6474.java
f0dba7dd1e55ccffae856a3e7db6a177a7142305
[]
no_license
Molybden/gradle-in-practice
30ac1477cc248a90c50949791028bc1cb7104b28
d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3
refs/heads/master
2021-06-26T16:45:54.018388
2016-03-06T20:19:43
2016-03-06T20:19:43
24,554,562
0
0
null
null
null
null
UTF-8
Java
false
false
109
java
public class Class6474{ public void callMe(){ System.out.println("called"); } }
[ "jocce.nilsson@gmail.com" ]
jocce.nilsson@gmail.com
09ac4d5fefbabb0521f59e73eb75c0a3e740605f
0167153d620fadeba98546cec1b92461c0d9b763
/212.AddingMarkerswithTouchEventstoGoogleMap/app/src/test/java/com/iosdevlog/a212addingmarkerswithtoucheventstogooglemap/ExampleUnitTest.java
64d6eda369b9e8263c349eb9b217061bd24af8fd
[ "MIT" ]
permissive
ailyanlu1/AndroidDevLog
bffd9e12d2e7e5cf79ea376a7d7b2bb4803a5576
c8dfbed39a533cdb05600cd81861bf77505f9ae0
refs/heads/master
2020-03-19T05:51:12.703539
2017-11-23T15:14:20
2017-11-23T15:14:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.iosdevlog.a212addingmarkerswithtoucheventstogooglemap; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "iosdevlog@iosdevlog.com" ]
iosdevlog@iosdevlog.com
c59edf20c5f849dea564cf985ab37e399045a41a
14087da13c2e43d0d6c7fddfec4f589e09619c67
/ILikePodcasts-unittest/src/de/vanmar/android/ilikepodcasts/library/download/DownloadServiceTest.java
94ea49ba049c3d73f7833aa624148c6ba3ff2ba6
[]
no_license
KoljaTM/ILikePodcasts
17845d8d967734abce1ef1c882ed0f6cea5e933a
0450ebd61aab443b49f128d8e53aa59dbbb38aa9
refs/heads/master
2021-01-02T22:49:51.913646
2013-06-13T19:57:34
2013-06-13T19:57:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,626
java
package de.vanmar.android.ilikepodcasts.library.download; import static de.vanmar.android.ilikepodcasts.library.bo.ItemBuilder.anItem; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.verify; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.HashSet; import java.util.List; import java.util.concurrent.Executor; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import android.net.Uri; import com.xtremelabs.robolectric.Robolectric; import com.xtremelabs.robolectric.RobolectricTestRunner; import com.xtremelabs.robolectric.shadows.ShadowContentResolver; import com.xtremelabs.robolectric.shadows.ShadowContentResolver.NotifiedUri; import de.vanmar.android.ilikepodcasts.library.IDownloadService.Callback; import de.vanmar.android.ilikepodcasts.library.bo.Item; import de.vanmar.android.ilikepodcasts.library.download.DownloadService.DownloadServiceBinder; import de.vanmar.android.ilikepodcasts.unittest.TestUtil; @RunWith(RobolectricTestRunner.class) public class DownloadServiceTest { private DownloadService service; private DownloadServiceBinder binder; private ShadowContentResolver contentResolver; @Mock private Downloader downloader; @Mock private Executor background; @Mock private Callback callback; @Before public void prepare() { MockitoAnnotations.initMocks(this); TestUtil.mockBackgroundExecutor(background); service = new DownloadService_(); service.onCreate(); service.downloader = downloader; binder = (DownloadServiceBinder) service.onBind(null); contentResolver = Robolectric.shadowOf(service.getContentResolver()); } @Test public void shouldDownloadFileInBackgroundThread() throws IOException, SQLException { // assume final Item item = anItem().build(); final HashSet<Callback> callbacks = new HashSet<Callback>(); callbacks.add(callback); // given binder.registerCallback(callback); // when binder.startDownload(item); // then verify(downloader).download(item, new URL(item.getMediaUrl()), callbacks); verify(background).execute(any(Runnable.class)); final Uri uri = Uri .parse("content://de.vanmar.android.ilikepodcasts.EpisodeContentProvider/episodes"); final List<NotifiedUri> notifiedUris = contentResolver .getNotifiedUris(); assertThat(notifiedUris.get(0).uri, is(uri)); } }
[ "Kolja@Bluemoon" ]
Kolja@Bluemoon
0373d3bae244452a13b4b70bdf7964e0bc087d42
958b13739d7da564749737cb848200da5bd476eb
/src/main/java/com/alipay/api/response/AlipayMarketingCampaignDrawcampCreateResponse.java
0dc4a76e9451ebca03c61df75ceb022f0707a158
[ "Apache-2.0" ]
permissive
anywhere/alipay-sdk-java-all
0a181c934ca84654d6d2f25f199bf4215c167bd2
649e6ff0633ebfca93a071ff575bacad4311cdd4
refs/heads/master
2023-02-13T02:09:28.859092
2021-01-14T03:17:27
2021-01-14T03:17:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.marketing.campaign.drawcamp.create response. * * @author auto create * @since 1.0, 2020-08-20 13:50:25 */ public class AlipayMarketingCampaignDrawcampCreateResponse extends AlipayResponse { private static final long serialVersionUID = 6397734399916467353L; /** * 抽奖活动id */ @ApiField("camp_id") private String campId; public void setCampId(String campId) { this.campId = campId; } public String getCampId( ) { return this.campId; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
072fc6fa478ff449052c3f7c8e8978124619f63c
749bf691142872adbaa5746541b322b9ba038919
/Part4/Problem3/logAnalyze3.java
809f0900f8753eac8d20c958eaee1f0299d4f0c4
[]
no_license
ILing82816/ds_hadoop_proj
06af16766010daeb3dd9db284c31b550c018f059
8c99db43f1ca5108324c8c1bca65b9eb912eb793
refs/heads/master
2022-11-14T17:18:15.844425
2020-07-07T19:11:28
2020-07-07T19:11:28
277,884,294
0
0
null
null
null
null
UTF-8
Java
false
false
2,958
java
import java.io.IOException; import java.util.StringTokenizer; import java.util.*; import java.io.*; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.filecache.DistributedCache; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Mapper.Context; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.StringUtils; public class logAnalyze3{ public static class logcountmap extends Mapper<LongWritable,Text,Text,IntWritable>{ private final static IntWritable plugOne = new IntWritable(1); private Text word = new Text(); public void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException{ StringTokenizer st = new StringTokenizer(value.toString(),"\n"); while(st.hasMoreTokens()){ String [] linewords = st.nextToken().split("\""); String url = linewords[1]; word.set(url); context.write(word, plugOne); } } } public static class logcountreduce extends Reducer <Text,IntWritable,Text,IntWritable> { private IntWritable result = new IntWritable(); int max=0; Text maxword = new Text(); public void reduce(Text key,Iterable<IntWritable> values,Context context) throws IOException, InterruptedException{ int count=0; for(IntWritable value :values){ count=count+value.get(); } if(count>max){ max=count; maxword.set(key); } } protected void cleanup(Context context)throws IOException, InterruptedException{ result.set(max); context.write(maxword, result); } } public static void main(String []args) throws IOException, ReflectiveOperationException, InterruptedException{ Configuration conf=new Configuration(); Job job=Job.getInstance(conf, "logAnalyze3"); job.setJarByClass(logAnalyze3.class); job.setMapperClass(logcountmap.class); job.setReducerClass(logcountreduce.class); job.setCombinerClass(logcountreduce.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(IntWritable.class); FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); System.exit(job.waitForCompletion(true)?0:1); } }
[ "jenny1005247@gmail.com" ]
jenny1005247@gmail.com
a74ba6b3a5272bcb4387f6a412ae8a88d312a37e
20edc9eeb5fd02443e478baaddc378e99a24acac
/src/main/model/Item.java
df2a996e027749a091fe3f47bff48eae425fa358
[]
no_license
emichelle-teh/track-it
a268dc1323010b351f7e2e5b5c18200984ddf40b
63e4ed263d7784e19f8752cb510dd4f84c172802
refs/heads/master
2022-12-05T00:23:47.730891
2020-08-22T09:48:26
2020-08-22T09:48:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,574
java
package model; import exceptions.LessThanZeroE; import exceptions.StringLengthZero; import java.time.LocalDate; // Represents an item that user spends money on // It has a name and a price in dollars public class Item { public String name; public double price; // in dollars public String tag; private LocalDate dateOfExpense; // private static final LocalDate LOCAL_DATE = LocalDate.now(); // REQUIRES: itemName has a non-zero length, itemPrice is > 0 // EFFECTS: name is set to itemName; price is itemPrice in dollars public Item(String itemName, double itemPrice, String categoryType) throws LessThanZeroE, StringLengthZero { if (itemName.length() == 0) { throw new StringLengthZero(); } else { this.name = itemName; } if (itemPrice <= 0) { throw new LessThanZeroE(); } else { this.price = itemPrice; } if (categoryType.length() == 0) { throw new StringLengthZero(); } else { this.tag = categoryType; } this.dateOfExpense = LocalDate.now(); } // EFFECTS: returns a price for the item public double getPrice() { return price; } //EFFECTS: returns name of item public String getName() { return name; } //EFFECTS: returns tag of item public String getTag() { return tag; } // EFFECTS: returns the time and date the purchase was made public LocalDate getDateOfExpense() { return dateOfExpense; } }
[ "nmteh17@students.cs.ubc.ca" ]
nmteh17@students.cs.ubc.ca
3b80cb7728e8ec522dced501ecda7ec2b79c3542
2de4a3355f2801c90f2fe84436e48a56a8858d2a
/src/com/shuming/Student.java
b20cae16a730d1ce0f4aa07ab64818f61db0d9c2
[]
no_license
jsmO0/springLearing
81551d7331fd12ba88b65c63a0d6695b118dd889
659ec5bb24492037976d2e5bb8a382b28e3be1dd
refs/heads/master
2022-12-20T06:38:00.515776
2020-03-25T07:19:43
2020-03-25T07:19:43
252,068,861
0
0
null
2022-12-16T15:26:09
2020-04-01T04:08:08
Java
UTF-8
Java
false
false
356
java
package com.shuming; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Setter @Getter @ToString public class Student { private String Sname; private Integer id; public void doInit(){ System.out.println("初始化操作......"); } public void doClose(){ System.out.println("close......."); } }
[ "shuming.jiang@ericsson.com" ]
shuming.jiang@ericsson.com
d0be31fb3d3b1b0bbc12d5f2fc2e9462a8a7ff1d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_91200d06234179467d4cbc0bee9c7210be70a112/Task/5_91200d06234179467d4cbc0bee9c7210be70a112_Task_s.java
d0450ca4c64f5fc067d55d9b9300ab0a0c13994f
[]
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
4,249
java
package com.soofw.trk; import java.util.ArrayList; import java.util.Calendar; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Task implements Comparable<Task> { final static Pattern re_tag = Pattern.compile("(^|\\s)([\\@\\#\\+]([\\w\\/]+))"); final static Pattern re_at = Pattern.compile("(^|\\s)(\\@([\\w\\/]+))"); final static Pattern re_hash = Pattern.compile("(^|\\s)(\\#([\\w\\/]+))"); final static Pattern re_plus = Pattern.compile("(^|\\s)(\\+([\\w\\/]+))"); final static Pattern re_priority = Pattern.compile("(^|\\s)(\\!(\\d))"); final static Pattern re_date = Pattern.compile("((\\d{1,2})/(\\d{1,2})(/(\\d{2}))*([@ ](\\d{1,2})(:(\\d{1,2}))*(am|pm)*)*)"); String source = null; String pretty = null; String sortVal = null; int priority = 0; Calendar calendar = null; ArrayList<String> tags = new ArrayList<String>(); public Task(String source) { this.source = source.trim(); this.pretty = this.source; this.pretty = this.pretty.replaceAll(re_date.pattern(), ""); this.sortVal = this.pretty = this.pretty.replaceAll(re_priority.pattern(), ""); this.pretty = this.pretty.replaceAll(re_tag.pattern(), ""); this.pretty = this.pretty.replaceAll("\\s+", " "); this.pretty = this.pretty.trim(); // find the priority Matcher m = re_priority.matcher(this.source); if(m.find()) { this.priority = Integer.parseInt(m.group(2).substring(1)); if(this.priority == 0) { // !0 is actually -1 priority this.priority = -1; } this.tags.add(m.group(2)); } // find the date this.calendar = Task.matcherToCalendar(re_date.matcher(this.source)); this.addTags(re_date.matcher(this.source), 0); this.addTags(re_tag.matcher(this.source), 2); } @Override public String toString() { return this.pretty; } @Override public int compareTo(Task other) { if(this.priority != other.priority) { return other.priority - this.priority; } if(this.calendar != null && other.calendar == null) { return -1; } else if(this.calendar == null && other.calendar != null) { return 1; } else if(this.calendar != null && other.calendar != null) { if(!this.calendar.equals(other.calendar)) { return this.calendar.compareTo(other.calendar); } } return this.sortVal.compareTo(other.sortVal); } private void addTags(Matcher m, int group) { while(m.find()) { this.tags.add(m.group(group)); } } public String[] getTags() { String[] temp = new String[this.tags.size()]; this.tags.toArray(temp); return temp; } public boolean contains(String search) { String[] words = search.toLowerCase().split(" "); for(int i = 0; i < words.length; i++) { if(!this.source.toLowerCase().contains(words[i])) { return false; } } return true; } public boolean matches(String tag) { tag = tag.toLowerCase(); char type = tag.charAt(0); String content = tag.substring(1); String regex = null; switch(type) { case '!': regex = "(^|.*\\s)(\\!" + content + ")(\\s.*|$)"; break; case '+': case '#': case '@': regex = "(^|.+\\s)(\\" + type + "([\\w\\/]*)(" + content + "))(\\s.+|\\/.+|$)"; break; default: return this.contains(tag); } return Pattern.matches(regex, this.source.toLowerCase()); } public static Calendar matcherToCalendar(Matcher m) { if(m.find()) { Calendar temp = Calendar.getInstance(); temp.set(Calendar.MONTH, Integer.parseInt(m.group(2)) - 1); temp.set(Calendar.DATE, Integer.parseInt(m.group(3))); if(m.group(5) != null) { temp.set(Calendar.YEAR, Integer.parseInt(m.group(5)) + 2000); } if(m.group(7) != null) { temp.set(Calendar.HOUR, Integer.parseInt(m.group(7))); } else { temp.set(Calendar.HOUR, 11); } if(m.group(9) != null) { temp.set(Calendar.MINUTE, Integer.parseInt(m.group(9))); } else { temp.set(Calendar.MINUTE, 59); } if(m.group(10) != null) { temp.set(Calendar.AM_PM, m.group(10).toLowerCase().equals("pm") ? Calendar.PM : Calendar.AM); } else { temp.set(Calendar.AM_PM, Calendar.PM); } return temp; } return null; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
de754b4d0ee7af745de54f5919c4dc2025682c85
fe98dd169da9f459d1f92e46c258ec5509a139cb
/DSMessaging/src/com/cep/messaging/impls/gossip/keyspace/DataTracker.java
507baf53dd41419df708370bca24f7282b3a3207
[]
no_license
colin-clark/QuickFIXTestServer
8b013dd63b2b7445bc44f5388f89ec640f2a1140
5340f47cac685ee543be27708c05f389262fd4fa
refs/heads/master
2020-05-30T20:53:18.099033
2014-02-16T19:20:42
2014-02-16T19:20:42
16,892,281
1
1
null
2023-03-20T11:53:03
2014-02-16T19:30:15
Java
UTF-8
Java
false
false
15,520
java
package com.cep.messaging.impls.gossip.keyspace; import java.io.File; import java.io.IOError; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.cep.messaging.impls.gossip.cache.AutoSavingCache; import com.cep.messaging.impls.gossip.configuration.NodeDescriptor; import com.cep.messaging.impls.gossip.keyspace.sstable.Descriptor; import com.cep.messaging.impls.gossip.keyspace.sstable.SSTableReader; import com.cep.messaging.impls.gossip.partitioning.token.DecoratedKey; import com.cep.messaging.util.Pair; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; public class DataTracker { private static final Logger logger = LoggerFactory.getLogger(DataTracker.class); public final ColumnFamilyStore cfstore; private final AtomicReference<View> view; // On disk live and total size private final AtomicLong liveSize = new AtomicLong(); private final AtomicLong totalSize = new AtomicLong(); public DataTracker(ColumnFamilyStore cfstore) { this.cfstore = cfstore; this.view = new AtomicReference<View>(); this.init(); } public Memtable getMemtable() { return view.get().memtable; } public Set<Memtable> getMemtablesPendingFlush() { return view.get().memtablesPendingFlush; } public Set<SSTableReader> getSSTables() { return view.get().sstables; } public View getView() { return view.get(); } /** * Switch the current memtable. * This atomically adds the current memtable to the memtables pending * flush and replace it with a fresh memtable. * * @return the previous current memtable (the one added to the pending * flush) */ public Memtable switchMemtable() { // atomically change the current memtable Memtable newMemtable = new Memtable(cfstore); Memtable toFlushMemtable; View currentView, newView; do { currentView = view.get(); toFlushMemtable = currentView.memtable; newView = currentView.switchMemtable(newMemtable); } while (!view.compareAndSet(currentView, newView)); return toFlushMemtable; } /** * Renew the current memtable without putting the old one for a flush. * Used when we flush but a memtable is clean (in which case we must * change it because it was frozen). */ public void renewMemtable() { Memtable newMemtable = new Memtable(cfstore); View currentView, newView; do { currentView = view.get(); newView = currentView.renewMemtable(newMemtable); } while (!view.compareAndSet(currentView, newView)); } public void replaceFlushed(Memtable memtable, SSTableReader sstable) { View currentView, newView; do { currentView = view.get(); newView = currentView.replaceFlushed(memtable, sstable); } while (!view.compareAndSet(currentView, newView)); addNewSSTablesSize(Arrays.asList(sstable)); cfstore.updateCacheSizes(); incrementallyBackup(sstable); } public void incrementallyBackup(SSTableReader sstable) { if (NodeDescriptor.incrementalBackupsEnabled()) { File keyspaceDir = new File(sstable.getFilename()).getParentFile(); File backupsDir = new File(keyspaceDir, "backups"); try { if (!backupsDir.exists() && !backupsDir.mkdirs()) throw new IOException("Unable to create " + backupsDir); sstable.createLinks(backupsDir.getCanonicalPath()); } catch (IOException e) { throw new IOError(e); } } } /** * @return A subset of the given active sstables that have been marked compacting, * or null if the thresholds cannot be met: files that are marked compacting must * later be unmarked using unmarkCompacting. */ public Set<SSTableReader> markCompacting(Collection<SSTableReader> tomark, int min, int max) { if (max < min || max < 1) return null; if (tomark == null || tomark.isEmpty()) return null; View currentView, newView; Set<SSTableReader> subset = null; // order preserving set copy of the input Set<SSTableReader> remaining = new LinkedHashSet<SSTableReader>(tomark); do { currentView = view.get(); // find the subset that is active and not already compacting remaining.removeAll(currentView.compacting); remaining.retainAll(currentView.sstables); if (remaining.size() < min) // cannot meet the min threshold return null; // cap the newly compacting items into a subset set subset = new HashSet<SSTableReader>(); Iterator<SSTableReader> iter = remaining.iterator(); for (int added = 0; added < max && iter.hasNext(); added++) subset.add(iter.next()); newView = currentView.markCompacting(subset); } while (!view.compareAndSet(currentView, newView)); return subset; } /** * Removes files from compacting status: this is different from 'markCompacted' * because it should be run regardless of whether a compaction succeeded. */ public void unmarkCompacting(Collection<SSTableReader> unmark) { View currentView, newView; do { currentView = view.get(); newView = currentView.unmarkCompacting(unmark); } while (!view.compareAndSet(currentView, newView)); } public void markCompacted(Collection<SSTableReader> sstables) { replace(sstables, Collections.<SSTableReader>emptyList()); } public void replaceCompactedSSTables(Collection<SSTableReader> sstables, Iterable<SSTableReader> replacements) { replace(sstables, replacements); } public void addSSTables(Collection<SSTableReader> sstables) { replace(Collections.<SSTableReader>emptyList(), sstables); } public void addStreamedSSTable(SSTableReader sstable) { addSSTables(Arrays.asList(sstable)); incrementallyBackup(sstable); } public void removeAllSSTables() { replace(getSSTables(), Collections.<SSTableReader>emptyList()); } /** (Re)initializes the tracker, purging all references. */ void init() { view.set(new View(new Memtable(cfstore), Collections.<Memtable>emptySet(), Collections.<SSTableReader>emptySet(), Collections.<SSTableReader>emptySet())); } private void replace(Collection<SSTableReader> oldSSTables, Iterable<SSTableReader> replacements) { View currentView, newView; do { currentView = view.get(); newView = currentView.replace(oldSSTables, replacements); } while (!view.compareAndSet(currentView, newView)); addNewSSTablesSize(replacements); removeOldSSTablesSize(oldSSTables); cfstore.updateCacheSizes(); } private void addNewSSTablesSize(Iterable<SSTableReader> newSSTables) { for (SSTableReader sstable : newSSTables) { assert sstable.getKeySamples() != null; if (logger.isDebugEnabled()) logger.debug(String.format("adding %s to list of files tracked for %s.%s", sstable.descriptor, cfstore.table.name, cfstore.getColumnFamilyName())); long size = sstable.bytesOnDisk(); liveSize.addAndGet(size); totalSize.addAndGet(size); sstable.setTrackedBy(this); } } private void removeOldSSTablesSize(Iterable<SSTableReader> oldSSTables) { for (SSTableReader sstable : oldSSTables) { if (logger.isDebugEnabled()) logger.debug(String.format("removing %s from list of files tracked for %s.%s", sstable.descriptor, cfstore.table.name, cfstore.getColumnFamilyName())); sstable.markCompacted(); liveSize.addAndGet(-sstable.bytesOnDisk()); } } @SuppressWarnings("rawtypes") public AutoSavingCache<Pair<Descriptor,DecoratedKey>,Long> getKeyCache() { return cfstore.getKeyCache(); } public long getLiveSize() { return liveSize.get(); } public long getTotalSize() { return totalSize.get(); } public void spaceReclaimed(long size) { totalSize.addAndGet(-size); } public long estimatedKeys() { long n = 0; for (SSTableReader sstable : getSSTables()) { n += sstable.estimatedKeys(); } return n; } public long[] getEstimatedRowSizeHistogram() { long[] histogram = new long[90]; for (SSTableReader sstable : getSSTables()) { long[] rowSize = sstable.getEstimatedRowSize().getBuckets(false); for (int i = 0; i < histogram.length; i++) histogram[i] += rowSize[i]; } return histogram; } public long[] getEstimatedColumnCountHistogram() { long[] histogram = new long[90]; for (SSTableReader sstable : getSSTables()) { long[] columnSize = sstable.getEstimatedColumnCount().getBuckets(false); for (int i = 0; i < histogram.length; i++) histogram[i] += columnSize[i]; } return histogram; } public long getMinRowSize() { long min = 0; for (SSTableReader sstable : getSSTables()) { if (min == 0 || sstable.getEstimatedRowSize().min() < min) min = sstable.getEstimatedRowSize().min(); } return min; } public long getMaxRowSize() { long max = 0; for (SSTableReader sstable : getSSTables()) { if (sstable.getEstimatedRowSize().max() > max) max = sstable.getEstimatedRowSize().max(); } return max; } public long getMeanRowSize() { long sum = 0; long count = 0; for (SSTableReader sstable : getSSTables()) { sum += sstable.getEstimatedRowSize().mean(); count++; } return count > 0 ? sum / count : 0; } public int getMeanColumns() { long sum = 0; int count = 0; for (SSTableReader sstable : getSSTables()) { sum += sstable.getEstimatedColumnCount().mean(); count++; } return count > 0 ? (int) (sum / count) : 0; } public long getBloomFilterFalsePositives() { long count = 0L; for (SSTableReader sstable: getSSTables()) { count += sstable.getBloomFilterFalsePositiveCount(); } return count; } public long getRecentBloomFilterFalsePositives() { long count = 0L; for (SSTableReader sstable: getSSTables()) { count += sstable.getRecentBloomFilterFalsePositiveCount(); } return count; } public double getBloomFilterFalseRatio() { long falseCount = 0L; long trueCount = 0L; for (SSTableReader sstable: getSSTables()) { falseCount += sstable.getBloomFilterFalsePositiveCount(); trueCount += sstable.getBloomFilterTruePositiveCount(); } if (falseCount == 0L && trueCount == 0L) return 0d; return (double) falseCount / (trueCount + falseCount); } public double getRecentBloomFilterFalseRatio() { long falseCount = 0L; long trueCount = 0L; for (SSTableReader sstable: getSSTables()) { falseCount += sstable.getRecentBloomFilterFalsePositiveCount(); trueCount += sstable.getRecentBloomFilterTruePositiveCount(); } if (falseCount == 0L && trueCount == 0L) return 0d; return (double) falseCount / (trueCount + falseCount); } /** * An immutable structure holding the current memtable, the memtables pending * flush, the sstables for a column family, and the sstables that are active * in compaction (a subset of the sstables). */ static class View { public final Memtable memtable; public final Set<Memtable> memtablesPendingFlush; public final Set<SSTableReader> sstables; public final Set<SSTableReader> compacting; View(Memtable memtable, Set<Memtable> pendingFlush, Set<SSTableReader> sstables, Set<SSTableReader> compacting) { this.memtable = memtable; this.memtablesPendingFlush = pendingFlush; this.sstables = sstables; this.compacting = compacting; } public View switchMemtable(Memtable newMemtable) { Set<Memtable> newPending = ImmutableSet.<Memtable>builder().addAll(memtablesPendingFlush).add(memtable).build(); return new View(newMemtable, newPending, sstables, compacting); } public View renewMemtable(Memtable newMemtable) { return new View(newMemtable, memtablesPendingFlush, sstables, compacting); } public View replaceFlushed(Memtable flushedMemtable, SSTableReader newSSTable) { Set<Memtable> newPending = ImmutableSet.copyOf(Sets.difference(memtablesPendingFlush, Collections.singleton(flushedMemtable))); Set<SSTableReader> newSSTables = ImmutableSet.<SSTableReader>builder().addAll(sstables).add(newSSTable).build(); return new View(memtable, newPending, newSSTables, compacting); } public View replace(Collection<SSTableReader> oldSSTables, Iterable<SSTableReader> replacements) { Sets.SetView<SSTableReader> remaining = Sets.difference(sstables, ImmutableSet.copyOf(oldSSTables)); Set<SSTableReader> newSSTables = ImmutableSet.<SSTableReader>builder().addAll(remaining).addAll(replacements).build(); return new View(memtable, memtablesPendingFlush, newSSTables, compacting); } public View markCompacting(Collection<SSTableReader> tomark) { Set<SSTableReader> compactingNew = ImmutableSet.<SSTableReader>builder().addAll(compacting).addAll(tomark).build(); return new View(memtable, memtablesPendingFlush, sstables, compactingNew); } public View unmarkCompacting(Collection<SSTableReader> tounmark) { Set<SSTableReader> compactingNew = ImmutableSet.copyOf(Sets.difference(compacting, ImmutableSet.copyOf(tounmark))); return new View(memtable, memtablesPendingFlush, sstables, compactingNew); } } }
[ "colin.clark@datastax.com" ]
colin.clark@datastax.com
1fadafb1331a6d9fe758e6faee07e321ec8f1dbf
17f80f5e2e7957fe150df3dc7b8776771b7a95a9
/TerrenceTurnerU1Capstone/src/main/java/com/example/TerrenceTurnerU1Capstone/controller/TShirtController.java
3dcd17facddc156c267dbae08dd305e987ce9d3c
[]
no_license
terrenceturner/Terrence_Turner_JavaS1
81a6b56aa4232df49bbd2bc9aeff0ef68f121343
f5ed81907460fd91930074f1fa3f6625a6b373a4
refs/heads/master
2022-11-26T11:47:58.208537
2019-10-15T12:37:58
2019-10-15T12:37:58
200,704,294
0
0
null
2022-11-16T06:57:51
2019-08-05T18:00:38
Java
UTF-8
Java
false
false
2,380
java
package com.example.TerrenceTurnerU1Capstone.controller; import com.example.TerrenceTurnerU1Capstone.service.ServiceLayer; import com.example.TerrenceTurnerU1Capstone.viewmodel.TShirtViewModel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @RestController public class TShirtController { @Autowired ServiceLayer service; // Get @RequestMapping(value = "tshirt/{t_shirt_id}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public TShirtViewModel getTShirt(@PathVariable int t_shirt_id){ return service.findTShirt(t_shirt_id); } // Get T-Shirt by Color @RequestMapping(value = "tshirt/color/{color}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public List<TShirtViewModel> getTShirtByColor(@PathVariable String color){ return service.findTShirtByColor(color); } // Get T-Shirt By Size @RequestMapping(value = "tshirt/size/{size}", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public List<TShirtViewModel> getTShirtBySize(@PathVariable String size){ return service.findTShirtBySize(size); } // Get All T-Shirts @RequestMapping(value = "/tshirt", method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) public List<TShirtViewModel> getAllTShirts(){ return service.findAllTshirts(); } // Post @RequestMapping(value = "/tshirt", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) public TShirtViewModel addTShirt(@RequestBody @Valid TShirtViewModel tShirt){ return service.saveTShirt(tShirt); } //Put @RequestMapping(value = "/tshirt", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) public TShirtViewModel updateTShirt(@RequestBody @Valid TShirtViewModel tShirt, @PathVariable Integer id){ if(id!= tShirt.getT_shirt_id()){ throw new IllegalArgumentException(); } return service.updateTShirt(tShirt); } //Delete @RequestMapping(value = "/tshirt/{t_shirt_id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.OK) public void deleteTShirt(@PathVariable int id){ service.removeTShirt(id); } }
[ "tsturner24@gmail.com" ]
tsturner24@gmail.com
3661b4aa3367cc41d5284fcb09a938e843e972dd
ea6778ff4950d8803c22b04cd9adb2725bddf10f
/app/src/test/java/com/example/mytweet/ExampleUnitTest.java
3534693a4a9fc629860fd89b766123ad54b2127e
[]
no_license
Integra98/RecycleView
6b36a7888eacbd239efffc3b9436d12dda10526f
70ef7eee7f42c49258ffd5abf5fdf2fbe5ce82d9
refs/heads/master
2020-04-27T21:36:05.045058
2019-03-09T14:29:57
2019-03-09T14:29:57
174,704,403
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package com.example.mytweet; 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); } }
[ "Mi Notebook@DESKTOP-1NPB8FF" ]
Mi Notebook@DESKTOP-1NPB8FF
4b09229741041a12ee124d593355c9b5c72ce6fc
5d5561be1120bfe9311877353e1121ca3ccaa5d6
/java-study/java_20180802/src/chapter10/TryCatchFinallyRuntimeException.java
e8689f689081232afd826b1a8ac59d6231ddac03
[]
no_license
eldrk/java-programming-class
b88cc06bb62f4b9c816f81e5e9047f180a643fa5
a1d22161cf250e89468a0d5303700d9babbd5e1e
refs/heads/master
2020-04-09T11:09:33.733982
2018-12-04T04:58:33
2018-12-04T04:58:33
160,297,474
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package chapter10; public class TryCatchFinallyRuntimeException { public static void main(String[] args) { String data1 = null; String data2 = null; try { data1 = args[0]; data2 = args[1]; System.out.println(data1 + "\n" + data2); int value1 = Integer.parseInt(data1); int value2 = Integer.parseInt(data2); int result = value1 + value2; System.out.println(data1 + "+" + data2 + "=" +result); return; }catch(ArrayIndexOutOfBoundsException e) { System.out.println("실행 매개값이 수가 부족합니다."); // System.out.println("[실행 방법]"); // System.out.println("java TryCatchFinallyRuntimeExceptionExample num1 num2"); }catch(Exception e) { System.out.println("숫자로 변환할 수 없습니다."); }finally { System.out.println("다시 실행하세요"); } } }
[ "ubjaeeun@daum.net" ]
ubjaeeun@daum.net
e8afbc1a8c6afdf33626cbf9e582143a5445607d
0e29905b012aa7b7f6fc88d28ccd2ec161732904
/src/test/java/AppTests.java
c4e8f5643b389c687df48af1db094b9ca21ec817
[ "MIT" ]
permissive
dntoll/Rusty
ef7ba8f6752a5318dd9d7e30b8a0e1980408727f
60d7d8ba2ebbb54febe205d8751806ef1439a23d
refs/heads/master
2022-04-23T11:49:33.557236
2020-04-24T12:53:29
2020-04-24T12:53:29
257,528,574
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
import org.junit.Assert; import org.junit.Test; public class AppTests { @Test public void StartShouldCallStart() { } }
[ "ttoda@lnu.se" ]
ttoda@lnu.se
7d359d20119f96bc7882f785d089de2c93c5e812
a5f02400ec2b08c81cc22f7eb7896ffd4619c3b3
/src/main/java/io/jmlim/springdatajpastudy/Study.java
03ae8c0a23ea2b7d3a5f165b2dd8d95ae42270d4
[]
no_license
jmlim/springdatajpastury
494eddbcd71d1ac7762a38ed6fe2330b77cd5964
bade7eb004e3d45abe7daf5b61ab08321f5ec98c
refs/heads/master
2020-04-26T08:41:22.634405
2019-03-04T03:30:53
2019-03-04T03:30:53
173,431,220
0
0
null
null
null
null
UTF-8
Java
false
false
839
java
package io.jmlim.springdatajpastudy; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToOne; @Entity public class Study { @Id @GeneratedValue private Long id; private String name; //양방향 관계 셋팅. (Account 엔티티 참고) //양방향 관계일때는 포링키를 가진 쪽이 주인임.. @ManyToOne private Account owner; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Account getOwner() { return owner; } public void setOwner(Account owner) { this.owner = owner; } }
[ "hackerljm@gmail.com" ]
hackerljm@gmail.com
f561dc6d739f2d8c6e4dbc3e88b02e4f52960f04
1863d2c095514f3c37dc2f2c4dea9e6a9b1be963
/qiding-jiaguo-cache/src/test/java/com/qiding/jiaguo/QidingJiaguoCacheApplicationTests.java
e1a208ca9ca658b5dda697d209b21398ae813045
[]
no_license
qiding1991/qiding-jiaguo
73645adfc5c4651da04b32c5491cc7524918ad3b
8862c2895d355301f32799f47a99d75c6f6e8044
refs/heads/master
2023-01-13T00:07:38.576978
2020-11-17T01:44:42
2020-11-17T01:44:42
309,045,209
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package com.qiding.jiaguo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class QidingJiaguoCacheApplicationTests { @Test void contextLoads() { } }
[ "qiding@syswin.com" ]
qiding@syswin.com
481f01bd933ebde2be2af494790afb62c3fea964
ce83ce73309401d5764f1c4bd9b8bc1da0c115ff
/src/main/java/ph/fingra/hadoop/mapred/parts/distribution/domain/DeviceEntity.java
bd8c9179025013509b796a8ad75708d4e0cdcbe8
[ "Apache-2.0" ]
permissive
david100gom/Fingra.ph_Hadoop
cab6e2169c8a337d2ccdbdfe3d884733203466fa
0172faca35097dc84b5c4958744afa77fa7635e7
refs/heads/master
2021-01-18T07:02:18.716541
2014-12-16T06:30:08
2014-12-16T06:31:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,818
java
/** * Copyright 2014 tgrape 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 ph.fingra.hadoop.mapred.parts.distribution.domain; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import ph.fingra.hadoop.mapred.common.BaseWritable; public class DeviceEntity extends BaseWritable<DeviceEntity> { public String token = ""; public String session = ""; public String cmd = ""; public void set(String token, String session, String cmd) { this.token = token; this.session = session; this.cmd = cmd; } @Override public void readFields(DataInput in) throws IOException { this.token = in.readUTF(); this.session = in.readUTF(); this.cmd = in.readUTF(); } @Override public void write(DataOutput out) throws IOException { out.writeUTF(this.token); out.writeUTF(this.session); out.writeUTF(this.cmd); } /** * staic method for deserialize * * @param in * @return * @throws IOException */ public static DeviceEntity read(DataInput in) throws IOException { DeviceEntity l = new DeviceEntity(); l.readFields(in); return l; } }
[ "mycort@tgrape.com" ]
mycort@tgrape.com
0fd49013b5d863f4f8bef1577bbb6f2c65a3ba29
99cf4283e2dc3097442e67403cedf61da20b1f0b
/PersonalSystem/src/mybean/data/ShowByPage.java
c56ae93108fe953e51dcd01e226f1e0cc6006e9e
[]
no_license
1hongbo/rep1
90ce43f49dd1676b443c4dd01a9f907313a1bda6
b12272645a6c99aa928a5653fac2b401a49b0546
refs/heads/master
2020-05-18T12:50:17.194990
2019-05-01T14:09:58
2019-05-01T14:09:58
184,419,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,035
java
package mybean.data; import com.sun.rowset.*; public class ShowByPage{ CachedRowSetImpl rowSet=null; int pageSize=10; int pageAllCount=0; int showPage=1 ; StringBuffer presentPageResult; public void setRowSet(CachedRowSetImpl set){ rowSet=set; } public CachedRowSetImpl getRowSet(){ return rowSet; } public void setPageSize(int size){ pageSize=size; } public int getPageSize(){ return pageSize; } public int getPageAllCount(){ return pageAllCount; } public void setPageAllCount(int n){ pageAllCount=n; } public void setShowPage(int n){ showPage=n; } public int getShowPage(){ return showPage; } public void setPresentPageResult(StringBuffer p){ presentPageResult=p; } public StringBuffer getPresentPageResult(){ return presentPageResult; } }
[ "1278907448@qq.com" ]
1278907448@qq.com
0c3c5f3e1455de85c9d2a527601a8c2cdbbcb6b3
61a266287b4a492538319727e6fe0ad1fb3d890d
/platform-product/platform-product-edoc-biz/src/main/java/com/zynsun/platform/edoc/model/ArchivedManualModel.java
29f816fe58a74a0d946bbeeb91d08037befdcfc0
[]
no_license
superwy333/ashare_newArch
cfe8086ef5ee7898aba186193882bce49dbae11b
9ed5f21b96caf2eb8e28e819dfd4e3f557140d7a
refs/heads/master
2020-04-13T10:34:25.884461
2018-12-26T06:41:36
2018-12-26T06:45:38
163,144,822
0
0
null
null
null
null
UTF-8
Java
false
false
3,269
java
package com.zynsun.platform.edoc.model; import com.zynsun.openplatform.domain.PageModel; /** * Created by WZH on 2017/8/2. */ public class ArchivedManualModel extends PageModel { /** * 单证编号:<账套代码+凭证号码>确定唯一 */ private String edocNo; /** * 账套编号 */ private String vouBookcode; /** * 凭证号 */ private String vouNo; /** * 总账日期YYYYMM */ private String vouDate; /** * 日记账批名 */ private String vouBatchname; /** * 日记账名称 */ private String vouJournalname; /** * 制单人 */ private String vouMakerName; /** * 公司名称 */ private String vouCompanyname; private String vouDateStart; private String vouDateEnd; private String safeBoxCode; private String boxNo; private String recordsNo; private String vouPeriod; public String getEdocNo() { return edocNo; } public void setEdocNo(String edocNo) { this.edocNo = edocNo; } public String getVouBookcode() { return vouBookcode; } public void setVouBookcode(String vouBookcode) { this.vouBookcode = vouBookcode; } public String getVouNo() { return vouNo; } public void setVouNo(String vouNo) { this.vouNo = vouNo; } public String getVouDate() { return vouDate; } public void setVouDate(String vouDate) { this.vouDate = vouDate; } public String getVouBatchname() { return vouBatchname; } public void setVouBatchname(String vouBatchname) { this.vouBatchname = vouBatchname; } public String getVouJournalname() { return vouJournalname; } public void setVouJournalname(String vouJournalname) { this.vouJournalname = vouJournalname; } public String getVouMakerName() { return vouMakerName; } public void setVouMakerName(String vouMakerName) { this.vouMakerName = vouMakerName; } public String getVouCompanyname() { return vouCompanyname; } public void setVouCompanyname(String vouCompanyname) { this.vouCompanyname = vouCompanyname; } public String getVouDateStart() { return vouDateStart; } public void setVouDateStart(String vouDateStart) { this.vouDateStart = vouDateStart; } public String getVouDateEnd() { return vouDateEnd; } public void setVouDateEnd(String vouDateEnd) { this.vouDateEnd = vouDateEnd; } public String getBoxNo() { return boxNo; } public void setBoxNo(String boxNo) { this.boxNo = boxNo; } public String getRecordsNo() { return recordsNo; } public void setRecordsNo(String recordsNo) { this.recordsNo = recordsNo; } public String getVouPeriod() { return vouPeriod; } public void setVouPeriod(String vouPeriod) { this.vouPeriod = vouPeriod; } public String getSafeBoxCode() { return safeBoxCode; } public void setSafeBoxCode(String safeBoxCode) { this.safeBoxCode = safeBoxCode; } }
[ "121401769@qq.com" ]
121401769@qq.com
5d9eb37397eab76b8c979931ffecc46198ed4fd9
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_fa944f6f42a77922600bce3c06df6582bec5dbfa/PDFImage/23_fa944f6f42a77922600bce3c06df6582bec5dbfa_PDFImage_s.java
6ad19e79e0e884d60f5235b17d696599a6e66a25
[]
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
47,245
java
/* * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle, * Santa Clara, California 95054, U.S.A. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package com.sun.pdfview; import java.awt.Color; import java.awt.Point; import java.awt.Transparency; import java.awt.color.ColorSpace; import java.awt.color.ICC_ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.ColorConvertOp; import java.awt.image.ColorModel; import java.awt.image.ComponentColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; import java.awt.image.IndexColorModel; import java.awt.image.MultiPixelPackedSampleModel; import java.awt.image.PackedColorModel; import java.awt.image.PixelInterleavedSampleModel; import java.awt.image.Raster; import java.awt.image.RasterFormatException; import java.awt.image.SampleModel; import java.awt.image.WritableRaster; import java.io.IOException; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.imageio.IIOException; import javax.imageio.ImageIO; import javax.imageio.ImageReadParam; import javax.imageio.ImageReader; import javax.imageio.metadata.IIOMetadata; import javax.imageio.metadata.IIOMetadataFormatImpl; import org.w3c.dom.Attr; import org.w3c.dom.Node; import com.sun.pdfview.colorspace.AlternateColorSpace; import com.sun.pdfview.colorspace.IndexedColor; import com.sun.pdfview.colorspace.PDFColorSpace; import com.sun.pdfview.colorspace.YCCKColorSpace; import com.sun.pdfview.decode.PDFDecoder; import com.sun.pdfview.function.FunctionType0; /** * Encapsulates a PDF Image */ public class PDFImage { private static int[][] GREY_TO_ARGB = new int[8][]; public static void dump(PDFObject obj) throws IOException { p("dumping PDF object: " + obj); if (obj == null) { return; } HashMap dict = obj.getDictionary(); p(" dict = " + dict); for (Object key : dict.keySet()) { p("key = " + key + " value = " + dict.get(key)); } } public static void p(String string) { System.out.println(string); } /** * color key mask. Array of start/end pairs of ranges of color components to * mask out. If a component falls within any of the ranges it is clear. */ private int[] colorKeyMask = null; /** the width of this image in pixels */ private int width; /** the height of this image in pixels */ private int height; /** the colorspace to interpret the samples in */ private PDFColorSpace colorSpace; /** the number of bits per sample component */ private int bpc; /** whether this image is a mask or not */ private boolean imageMask = false; /** the SMask image, if any */ private PDFImage sMask; /** the decode array */ private float[] decode; /** the actual image data */ private final PDFObject imageObj; /** * Create an instance of a PDFImage */ protected PDFImage(PDFObject imageObj) { this.imageObj = imageObj; } /** * Read a PDFImage from an image dictionary and stream * * @param obj * the PDFObject containing the image's dictionary and stream * @param resources * the current resources * @param useAsSMask * - flag for switching colors in case image is used as sMask * internally this is needed for handling transparency in smask * images. */ public static PDFImage createImage(PDFObject obj, Map<String, PDFObject> resources, boolean useAsSMask) throws IOException { // create the image PDFImage image = new PDFImage(obj); // get the width (required) PDFObject widthObj = obj.getDictRef("Width"); if (widthObj == null) { throw new PDFParseException("Unable to read image width: " + obj); } image.setWidth(widthObj.getIntValue()); // get the height (required) PDFObject heightObj = obj.getDictRef("Height"); if (heightObj == null) { throw new PDFParseException("Unable to get image height: " + obj); } image.setHeight(heightObj.getIntValue()); // figure out if we are an image mask (optional) PDFObject imageMaskObj = obj.getDictRef("ImageMask"); if (imageMaskObj != null) { image.setImageMask(imageMaskObj.getBooleanValue()); } // read the bpc and colorspace (required except for masks) if (image.isImageMask()) { image.setBitsPerComponent(1); // create the indexed color space for the mask // [PATCHED by michal.busta@gmail.com] - default value od Decode // according to PDF spec. is [0, 1] // so the color arry should be: // [PATCHED by XOND] - switched colors in case the image is used as // SMask for another image, otherwise transparency isn't // handled correctly. Color[] colors = useAsSMask ? new Color[] { Color.WHITE, Color.BLACK } : new Color[] { Color.BLACK, Color.WHITE }; PDFObject imageMaskDecode = obj.getDictRef("Decode"); if (imageMaskDecode != null) { PDFObject[] decodeArray = imageMaskDecode.getArray(); float decode0 = decodeArray[0].getFloatValue(); if (decode0 == 1.0f) { colors = useAsSMask ? new Color[] { Color.BLACK, Color.WHITE } : new Color[] { Color.WHITE, Color.BLACK }; } /* * float[] decode = new float[decodeArray.length]; for (int i = * 0; i < decodeArray.length; i++) { decode[i] = * decodeArray[i].getFloatValue(); } image.setDecode(decode); */ } image.setColorSpace(new IndexedColor(colors)); } else { // get the bits per component (required) PDFObject bpcObj = obj.getDictRef("BitsPerComponent"); if (bpcObj == null) { throw new PDFParseException( "Unable to get bits per component: " + obj); } image.setBitsPerComponent(bpcObj.getIntValue()); // get the color space (required) PDFObject csObj = obj.getDictRef("ColorSpace"); if (csObj == null) { throw new PDFParseException("No ColorSpace for image: " + obj); } PDFColorSpace cs = PDFColorSpace.getColorSpace(csObj, resources); image.setColorSpace(cs); // read the decode array PDFObject decodeObj = obj.getDictRef("Decode"); if (decodeObj != null) { PDFObject[] decodeArray = decodeObj.getArray(); float[] decode = new float[decodeArray.length]; for (int i = 0; i < decodeArray.length; i++) { decode[i] = decodeArray[i].getFloatValue(); } image.setDecode(decode); } // read the soft mask. // If ImageMask is true, this entry must not be present. // (See implementation note 52 in Appendix H.) PDFObject sMaskObj = obj.getDictRef("SMask"); if (sMaskObj == null) { // try the explicit mask, if there is no SoftMask sMaskObj = obj.getDictRef("Mask"); } if (sMaskObj != null) { if (sMaskObj.getType() == PDFObject.STREAM) { try { PDFImage sMaskImage = PDFImage.createImage(sMaskObj, resources, true); image.setSMask(sMaskImage); } catch (IOException ex) { p("ERROR: there was a problem parsing the mask for this object"); dump(obj); ex.printStackTrace(System.out); } } else if (sMaskObj.getType() == PDFObject.ARRAY) { // retrieve the range of the ColorKeyMask // colors outside this range will not be painted. try { image.setColorKeyMask(sMaskObj); } catch (IOException ex) { p("ERROR: there was a problem parsing the color mask for this object"); dump(obj); ex.printStackTrace(System.out); } } } } return image; } /** * Get the image that this PDFImage generates. * * @return a buffered image containing the decoded image data */ public BufferedImage getImage() { try { BufferedImage bi = (BufferedImage) this.imageObj.getCache(); if (bi == null) { byte[] data = imageObj.getStream(); ByteBuffer jpegBytes = null; final boolean jpegDecode = PDFDecoder.isLastFilter(imageObj, PDFDecoder.DCT_FILTERS); if (jpegDecode) { // if we're lucky, the stream will have just the DCT // filter applied to it, and we'll have a reference to // an underlying mapped file, so we'll manage to avoid // a copy of the encoded JPEG bytes jpegBytes = imageObj.getStreamBuffer(PDFDecoder.DCT_FILTERS); } // parse the stream data into an actual image bi = parseData(data, jpegBytes); this.imageObj.setCache(bi); } return bi; } catch (IOException ioe) { System.out.println("Error reading image"); ioe.printStackTrace(); return null; } } /** * <p> * Parse the image stream into a buffered image. Note that this is * guaranteed to be called after all the other setXXX methods have been * called. * </p> * * <p> * NOTE: the color convolving is extremely slow on large images. It would be * good to see if it could be moved out into the rendering phases, where we * might be able to scale the image down first. * </p * @param data the data when already completely filtered and uncompressed * @param jpegData a byte buffer if data still requiring the DCDTecode filter * is being used */ protected BufferedImage parseData(byte[] data, ByteBuffer jpegData) throws IOException { // pick a color model, based on the number of components and // bits per component ColorModel cm = createColorModel(); BufferedImage bi = null; if (jpegData != null) { // Use imageio to decode the JPEG into // a BufferedImage. Perhaps JAI will be installed // so that decodes will be faster and better supported // TODO - strictly speaking, the application of the YUV->RGB // transformation when reading JPEGs does not adhere to the spec. // We're just going to let java read this in - as it is, the standard // jpeg reader looks for the specific Adobe marker header so that // it may apply the transform, so that's good. If that marker // isn't present, then it also applies a number of other heuristics // to determine whether the transform should be applied. // (http://java.sun.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html) // In practice, it probably almost always does the right thing here, // though note that the present or default value of the ColorTransform // dictionary entry is not being observed, so there is scope for // error. Hopefully the JAI reader does the same. // We might need to attempt this with multiple readers, so let's // remember where the jpeg data starts jpegData.mark(); JpegDecoder decoder = new JpegDecoder(jpegData, cm); IOException decodeEx = null; try { bi = decoder.decode(); } catch (IOException e) { decodeEx = e; // The native readers weren't able to process the image. // One common situation is that the image is YCCK encoded, // which isn't supported by the default jpeg readers. // We've got a work-around we can attempt, though: decoder.setYcckDecodeMode(true); try { bi = decoder.decode(); } catch (IOException e2) { // It probably wasn't the YCCK issue! // try the "old" implementation bi = parseData(data, null); return bi; } } // the decoder may have requested installation of a new color model cm = decoder.getColorModel(); // make these immediately unreachable, as the referenced // jpeg data might be quite large jpegData = null; decoder = null; if (bi == null) { // This isn't pretty, but it's what's been happening // previously, so we'll preserve it for the time // being. At least we'll offer a hint now! assert decodeEx != null; throw new IOException(decodeEx.getMessage() + ". Maybe installing JAI for expanded image format " + "support would help?", decodeEx); } } else { // create the data buffer DataBuffer db = new DataBufferByte(data, data.length); // pick a color model, based on the number of components and // bits per component cm = getColorModel(); // create a compatible raster SampleModel sm = cm .createCompatibleSampleModel(getWidth(), getHeight()); WritableRaster raster; try { raster = Raster.createWritableRaster(sm, db, new Point(0, 0)); } catch (RasterFormatException e) { int tempExpectedSize = getWidth() * getHeight() * getColorSpace().getNumComponents() * Math.max(8, getBitsPerComponent()) / 8; if (tempExpectedSize < 3) { tempExpectedSize = 3; } if (tempExpectedSize > data.length) { byte[] tempLargerData = new byte[tempExpectedSize]; System.arraycopy(data, 0, tempLargerData, 0, data.length); db = new DataBufferByte(tempLargerData, tempExpectedSize); raster = Raster.createWritableRaster(sm, db, new Point(0, 0)); } else { throw e; } } /* * Workaround for a bug on the Mac -- a class cast exception in * drawImage() due to the wrong data buffer type (?) */ bi = null; if (cm instanceof IndexColorModel) { IndexColorModel icm = (IndexColorModel) cm; // choose the image type based on the size int type = BufferedImage.TYPE_BYTE_BINARY; if (getBitsPerComponent() == 8) { type = BufferedImage.TYPE_BYTE_INDEXED; } // create the image with an explicit indexed color model. bi = new BufferedImage(getWidth(), getHeight(), type, icm); // set the data explicitly as well bi.setData(raster); } else if (cm.getPixelSize() == 1 && cm.getNumComponents() == 1) { // If the image is black and white only, convert it into BYTE_GRAY // format // This is a lot faster compared to just drawing the original image // Are pixels decoded? int[] cc = new int[] { 0, 1 }; PDFObject o = imageObj.getDictRef("Decode"); if (o != null && o.getAt(0) != null) { cc[0] = o.getAt(0).getIntValue(); cc[1] = o.getAt(1).getIntValue(); } final byte[] ncc = new byte[] { (byte) -cc[0], (byte) -cc[1] }; bi = biColorToGrayscale(raster, ncc); // Return when there is no SMask if (getSMask() == null) return bi; } else { // Raster is already in a format which is supported by Java2D, // such as RGB or Gray. bi = new BufferedImage(cm, raster, true, null); } } // hack to avoid *very* slow conversion ColorSpace cs = cm.getColorSpace(); ColorSpace rgbCS = ColorSpace.getInstance(ColorSpace.CS_sRGB); if (isGreyscale(cs) && bpc <= 8 && getDecode() == null && jpegData == null) { bi = convertGreyscaleToArgb(data, bi); } else if (!isImageMask() && cs instanceof ICC_ColorSpace && !cs.equals(rgbCS)) { ColorConvertOp op = new ColorConvertOp(cs, rgbCS, null); BufferedImage converted = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); bi = op.filter(bi, converted); } // add in the alpha data supplied by the SMask, if any PDFImage sMaskImage = getSMask(); if (sMaskImage != null) { BufferedImage si = sMaskImage.getImage(); BufferedImage outImage = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); int[] srcArray = new int[this.width]; int[] maskArray = new int[this.width]; for (int i = 0; i < this.height; i++) { bi.getRGB(0, i, this.width, 1, srcArray, 0, this.width); si.getRGB(0, i, this.width, 1, maskArray, 0, this.width); for (int j = 0; j < this.width; j++) { int ac = 0xff000000; maskArray[j] = ((maskArray[j] & 0xff) << 24) | (srcArray[j] & ~ac); } outImage.setRGB(0, i, this.width, 1, maskArray, 0, this.width); } bi = outImage; } return (bi); } private boolean isGreyscale(ColorSpace aCs) { return aCs == PDFColorSpace .getColorSpace(PDFColorSpace.COLORSPACE_GRAY).getColorSpace(); } private BufferedImage convertGreyscaleToArgb(byte[] data, BufferedImage bi) { // we use an optimised greyscale colour conversion, as with scanned // greyscale/mono documents consisting of nothing but page-size // images, using the ICC converter is perhaps 15 times slower than this // method. Using an example scanned, mainly monochrome document, on this // developer's machine pages took an average of 3s to render using the // ICC converter filter, and around 115ms using this method. We use // pre-calculated tables generated using the ICC converter to map // between // each possible greyscale value and its desired value in sRGB. // We also try to avoid going through SampleModels, WritableRasters or // BufferedImages as that takes about 3 times as long. final int[] convertedPixels = new int[getWidth() * getHeight()]; final WritableRaster r = bi.getRaster(); int i = 0; final int[] greyToArgbMap = getGreyToArgbMap(bpc); if (bpc == 1) { int calculatedLineBytes = (getWidth() + 7) / 8; int rowStartByteIndex; // avoid hitting the WritableRaster for the common 1 bpc case if (greyToArgbMap[0] == 0 && greyToArgbMap[1] == 0xFFFFFFFF) { // optimisation for common case of a direct map to full white // and black, using bit twiddling instead of consulting the // greyToArgb map for (int y = 0; y < getHeight(); ++y) { // each row is byte-aligned rowStartByteIndex = y * calculatedLineBytes; for (int x = 0; x < getWidth(); ++x) { final byte b = data[rowStartByteIndex + x / 8]; final int white = b >> (7 - (x & 7)) & 1; // if white == 0, white - 1 will be 0xFFFFFFFF, // which when xored with 0xFFFFFF will produce 0 // if white == 1, white - 1 will be 0, // which when xored with 0xFFFFFF will produce 0xFFFFFF // (ignoring the top two bytes, which are always set // high anyway) convertedPixels[i] = 0xFF000000 | ((white - 1) ^ 0xFFFFFF); ++i; } } } else { // 1 bpc case where we can't bit-twiddle and need to consult // the map for (int y = 0; y < getHeight(); ++y) { rowStartByteIndex = y * calculatedLineBytes; for (int x = 0; x < getWidth(); ++x) { final byte b = data[rowStartByteIndex + x / 8]; final int val = b >> (7 - (x & 7)) & 1; convertedPixels[i] = greyToArgbMap[val]; ++i; } } } } else { for (int y = 0; y < getHeight(); ++y) { for (int x = 0; x < getWidth(); ++x) { final int greyscale = r.getSample(x, y, 0); convertedPixels[i] = greyToArgbMap[greyscale]; ++i; } } } final ColorModel ccm = ColorModel.getRGBdefault(); return new BufferedImage(ccm, Raster.createPackedRaster( new DataBufferInt(convertedPixels, convertedPixels.length), getWidth(), getHeight(), getWidth(), ((PackedColorModel) ccm).getMasks(), null), false, null); } private static int[] getGreyToArgbMap(int numBits) { assert numBits <= 8; int[] argbVals = GREY_TO_ARGB[numBits - 1]; if (argbVals == null) { argbVals = createGreyToArgbMap(numBits); } return argbVals; } /** * Create a map from all bit-patterns of a certain depth greyscale to the * corresponding sRGB values via the ICC colorr converter. * @param numBits the number of greyscale bits * @return a 2^bits array of standard 32-bit ARGB fits for each greyscale value * at that bitdepth */ private static int[] createGreyToArgbMap(int numBits) { final ColorSpace greyCs = PDFColorSpace.getColorSpace( PDFColorSpace.COLORSPACE_GRAY).getColorSpace(); byte[] greyVals = new byte[1 << numBits]; for (int i = 0; i < greyVals.length; ++i) { greyVals[i] = (byte) (i & 0xFF); } final int[] argbVals = new int[greyVals.length]; final int mask = (1 << numBits) - 1; final WritableRaster inRaster = Raster.createPackedRaster( new DataBufferByte(greyVals, greyVals.length), greyVals.length, 1, greyVals.length, new int[] { mask }, null); final BufferedImage greyImage = new BufferedImage( new PdfComponentColorModel(greyCs, new int[] { numBits }), inRaster, false, null); final ColorModel ccm = ColorModel.getRGBdefault(); final WritableRaster outRaster = Raster.createPackedRaster( new DataBufferInt(argbVals, argbVals.length), argbVals.length, 1, argbVals.length, ((PackedColorModel) ccm).getMasks(), null); final BufferedImage srgbImage = new BufferedImage(ccm, outRaster, false, null); final ColorConvertOp op = new ColorConvertOp(greyCs, ColorSpace.getInstance(ColorSpace.CS_sRGB), null); op.filter(greyImage, srgbImage); GREY_TO_ARGB[numBits - 1] = argbVals; return argbVals; } /** * Creates a new image of type {@link TYPE_BYTE_GRAY} which represents the * given raster * * @param raster * Raster of an image with just two colors, bitwise encoded * @param ncc * Array with two entries that describe the corresponding gray * values */ private BufferedImage biColorToGrayscale(final WritableRaster raster, final byte[] ncc) { final byte[] bufferO = ((DataBufferByte) raster.getDataBuffer()) .getData(); BufferedImage converted = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_BYTE_GRAY); byte[] buffer = ((DataBufferByte) converted.getRaster().getDataBuffer()) .getData(); int i = 0; final int height = converted.getHeight(); final int width = converted.getWidth(); for (int y = 0; y < height; y++) { int base = y * width + 7; if ((y + 1) * width < buffer.length) { for (int x = 0; x < width; x += 8) { final byte bits = bufferO[i]; i++; buffer[base - 7] = ncc[((bits >>> 7) & 1)]; buffer[base - 6] = ncc[((bits >>> 6) & 1)]; buffer[base - 5] = ncc[((bits >>> 5) & 1)]; buffer[base - 4] = ncc[((bits >>> 4) & 1)]; buffer[base - 3] = ncc[((bits >>> 3) & 1)]; buffer[base - 2] = ncc[((bits >>> 2) & 1)]; buffer[base - 1] = ncc[((bits >>> 1) & 1)]; buffer[base] = ncc[(bits & 1)]; /* * for (byte j=7; j>=0; j--) { //final int c = (((bits & * (1<<j)) >>> j)); final int c = ((bits >>> j) & 1); * buffer[base - j] = ncc[c]; } */ base += 8; } } else { for (int x = 0; x < width; x += 8) { final byte bits = bufferO[i]; i++; for (byte j = 7; j >= 0; j--) { if (base - j >= buffer.length) break; buffer[base - j] = ncc[((bits >>> j) & 1)]; } base += 8; } } } return converted; } /** * Get the image's width */ public int getWidth() { return this.width; } /** * Set the image's width */ protected void setWidth(int width) { this.width = width; } /** * Get the image's height */ public int getHeight() { return this.height; } /** * Set the image's height */ protected void setHeight(int height) { this.height = height; } /** * set the color key mask. It is an array of start/end entries to indicate * ranges of color indicies that should be masked out. * * @param maskArrayObject */ private void setColorKeyMask(PDFObject maskArrayObject) throws IOException { PDFObject[] maskObjects = maskArrayObject.getArray(); this.colorKeyMask = null; int[] masks = new int[maskObjects.length]; for (int i = 0; i < masks.length; i++) { masks[i] = maskObjects[i].getIntValue(); } this.colorKeyMask = masks; } /** * Get the colorspace associated with this image, or null if there isn't one */ protected PDFColorSpace getColorSpace() { return this.colorSpace; } /** * Set the colorspace associated with this image */ protected void setColorSpace(PDFColorSpace colorSpace) { this.colorSpace = colorSpace; } /** * Get the number of bits per component sample */ protected int getBitsPerComponent() { return this.bpc; } /** * Set the number of bits per component sample */ protected void setBitsPerComponent(int bpc) { this.bpc = bpc; } /** * Return whether or not this is an image mask */ public boolean isImageMask() { return this.imageMask; } /** * Set whether or not this is an image mask */ public void setImageMask(boolean imageMask) { this.imageMask = imageMask; } /** * Return the soft mask associated with this image */ public PDFImage getSMask() { return this.sMask; } /** * Set the soft mask image */ protected void setSMask(PDFImage sMask) { this.sMask = sMask; } /** * Get the decode array */ protected float[] getDecode() { return this.decode; } /** * Set the decode array */ protected void setDecode(float[] decode) { this.decode = decode; } /** * get a Java ColorModel consistent with the current color space, number of * bits per component and decode array * * @param bpc * the number of bits per component */ private ColorModel getColorModel() { PDFColorSpace cs = getColorSpace(); if (cs instanceof IndexedColor) { IndexedColor ics = (IndexedColor) cs; byte[] components = ics.getColorComponents(); int num = ics.getCount(); // process the decode array if (this.decode != null) { byte[] normComps = new byte[components.length]; // move the components array around for (int i = 0; i < num; i++) { byte[] orig = new byte[1]; orig[0] = (byte) i; float[] res = normalize(orig, null, 0); int idx = (int) res[0]; normComps[i * 3] = components[idx * 3]; normComps[(i * 3) + 1] = components[(idx * 3) + 1]; normComps[(i * 3) + 2] = components[(idx * 3) + 2]; } components = normComps; } // make sure the size of the components array is 2 ^ numBits // since if it's not, Java will complain int correctCount = 1 << getBitsPerComponent(); if (correctCount < num) { byte[] fewerComps = new byte[correctCount * 3]; System.arraycopy(components, 0, fewerComps, 0, correctCount * 3); components = fewerComps; num = correctCount; } if (this.colorKeyMask == null || this.colorKeyMask.length == 0) { return new IndexColorModel(getBitsPerComponent(), num, components, 0, false); } else { byte[] aComps = new byte[num * 4]; int idx = 0; for (int i = 0; i < num; i++) { aComps[idx++] = components[(i * 3)]; aComps[idx++] = components[(i * 3) + 1]; aComps[idx++] = components[(i * 3) + 2]; aComps[idx++] = (byte) 0xFF; } for (int i = 0; i < this.colorKeyMask.length; i += 2) { for (int j = this.colorKeyMask[i]; j <= this.colorKeyMask[i + 1]; j++) { aComps[(j * 4) + 3] = 0; // make transparent } } return new IndexColorModel(getBitsPerComponent(), num, aComps, 0, true); } } else if (cs instanceof AlternateColorSpace) { // ColorSpace altCS = new AltColorSpace(((AlternateColorSpace) // cs).getFunktion(), cs.getColorSpace()); ColorSpace altCS = cs.getColorSpace(); int[] bits = new int[altCS.getNumComponents()]; for (int i = 0; i < bits.length; i++) { bits[i] = getBitsPerComponent(); } return new DecodeComponentColorModel(altCS, bits); } else { // CMYK color space has been converted to RGB in DCTDecode if (cs.getColorSpace().getType() == ColorSpace.TYPE_CMYK) { ColorSpace rgbCS = ColorSpace.getInstance(ColorSpace.CS_sRGB); int[] bits = new int[rgbCS.getNumComponents()]; for (int i = 0; i < bits.length; i++) { bits[i] = getBitsPerComponent(); } return new DecodeComponentColorModel(rgbCS, bits); } int[] bits = new int[cs.getNumComponents()]; for (int i = 0; i < bits.length; i++) { bits[i] = getBitsPerComponent(); } return new DecodeComponentColorModel(cs.getColorSpace(), bits); } } /** * Normalize an array of values to match the decode array */ private float[] normalize(byte[] pixels, float[] normComponents, int normOffset) { if (normComponents == null) { normComponents = new float[normOffset + pixels.length]; } float[] decodeArray = getDecode(); for (int i = 0; i < pixels.length; i++) { int val = pixels[i] & 0xff; int pow = ((int) Math.pow(2, getBitsPerComponent())) - 1; float ymin = decodeArray[i * 2]; float ymax = decodeArray[(i * 2) + 1]; normComponents[normOffset + i] = FunctionType0.interpolate(val, 0, pow, ymin, ymax); } return normComponents; } /** * A wrapper for ComponentColorSpace which normalizes based on the decode * array. */ class DecodeComponentColorModel extends ComponentColorModel { public DecodeComponentColorModel(ColorSpace cs, int[] bpc) { super(cs, bpc, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); if (bpc != null) { this.pixel_bits = bpc.length * bpc[0]; } } @Override public SampleModel createCompatibleSampleModel(int width, int height) { // workaround -- create a MultiPixelPackedSample models for // single-sample, less than 8bpp color models if (getNumComponents() == 1 && getPixelSize() < 8) { return new MultiPixelPackedSampleModel(getTransferType(), width, height, getPixelSize()); } return super.createCompatibleSampleModel(width, height); } @Override public boolean isCompatibleRaster(Raster raster) { if (getNumComponents() == 1 && getPixelSize() < 8) { SampleModel sm = raster.getSampleModel(); if (sm instanceof MultiPixelPackedSampleModel) { return (sm.getSampleSize(0) == getPixelSize()); } else { return false; } } return super.isCompatibleRaster(raster); } @Override public float[] getNormalizedComponents(Object pixel, float[] normComponents, int normOffset) { if (getDecode() == null) { return super.getNormalizedComponents(pixel, normComponents, normOffset); } return normalize((byte[]) pixel, normComponents, normOffset); } } /** * get a Java ColorModel consistent with the current color space, * number of bits per component and decode array * * @param bpc the number of bits per component */ private ColorModel createColorModel() { PDFColorSpace cs = getColorSpace(); if (cs instanceof IndexedColor) { IndexedColor ics = (IndexedColor) cs; byte[] components = ics.getColorComponents(); int num = ics.getCount(); // process the decode array if (decode != null) { byte[] normComps = new byte[components.length]; // move the components array around for (int i = 0; i < num; i++) { byte[] orig = new byte[1]; orig[0] = (byte) i; float[] res = normalize(orig, null, 0); int idx = (int) res[0]; normComps[i * 3] = components[idx * 3]; normComps[(i * 3) + 1] = components[(idx * 3) + 1]; normComps[(i * 3) + 2] = components[(idx * 3) + 2]; } components = normComps; } // make sure the size of the components array is 2 ^ numBits // since if it's not, Java will complain int correctCount = 1 << getBitsPerComponent(); if (correctCount < num) { byte[] fewerComps = new byte[correctCount * 3]; System.arraycopy(components, 0, fewerComps, 0, correctCount * 3); components = fewerComps; num = correctCount; } if (colorKeyMask == null || colorKeyMask.length == 0) { return new IndexColorModel(getBitsPerComponent(), num, components, 0, false); } else { byte[] aComps = new byte[num * 4]; int idx = 0; for (int i = 0; i < num; i++) { aComps[idx++] = components[(i * 3)]; aComps[idx++] = components[(i * 3) + 1]; aComps[idx++] = components[(i * 3) + 2]; aComps[idx++] = (byte) 0xFF; } for (int i = 0; i < colorKeyMask.length; i += 2) { for (int j = colorKeyMask[i]; j <= colorKeyMask[i + 1]; j++) { aComps[(j * 4) + 3] = 0; // make transparent } } return new IndexColorModel(getBitsPerComponent(), num, aComps, 0, true); } } else { int[] bits = new int[cs.getNumComponents()]; for (int i = 0; i < bits.length; i++) { bits[i] = getBitsPerComponent(); } return decode != null ? new DecodeComponentColorModel(cs.getColorSpace(), bits) : new PdfComponentColorModel(cs.getColorSpace(), bits); } } /** * Decodes jpeg data, possibly attempting a manual YCCK decode * if requested. Users should use {@link #getColorModel()} to * see which color model should now be used after a successful * decode. */ private class JpegDecoder { /** The jpeg bytes */ private final ByteBuffer jpegData; /** The color model employed */ private ColorModel cm; /** Whether the YCCK decode work-around should be used */ private boolean ycckDecodeMode = false; /** * Class constructor * @param jpegData the JPEG data * @param cm the color model as presented in the PDF */ private JpegDecoder(ByteBuffer jpegData, ColorModel cm) { this.jpegData = jpegData; this.cm = cm; } /** * Identify whether the decoder should operate in YCCK * decode mode, whereby the YCCK Chroma is specifically * looked for and the color model is changed to support * converting raw YCCK color values, working around * a lack of YCCK/CMYK report in the standard Java * jpeg readers. Non-YCCK images will not be decoded * while in this mode. * @param ycckDecodeMode */ public void setYcckDecodeMode(boolean ycckDecodeMode) { this.ycckDecodeMode = ycckDecodeMode; } /** * Get the color model that should be used now * @return */ public ColorModel getColorModel() { return cm; } /** * Attempt to decode the jpeg data * @return the successfully decoded image * @throws IOException if the image couldn't be decoded due * to a lack of support or some IO problem */ private BufferedImage decode() throws IOException { ImageReadParam readParam = null; if (getDecode() != null) { // we have to allocate our own buffered image so that we can // install our colour model which will do the desired decode readParam = new ImageReadParam(); SampleModel sm = cm.createCompatibleSampleModel (getWidth (), getHeight ()); final WritableRaster raster = Raster.createWritableRaster(sm, new Point(0, 0)); readParam.setDestination(new BufferedImage(cm, raster, true, null)); } Iterator<ImageReader> jpegReaderIt = ImageIO.getImageReadersByFormatName("jpeg"); IIOException lastIioEx = null; while (jpegReaderIt.hasNext()) { try { final ImageReader jpegReader = jpegReaderIt.next(); jpegReader.setInput(ImageIO.createImageInputStream( new ByteBufferInputStream(jpegData)), true, false); try { return readImage(jpegReader, readParam); } catch (Exception e) { if (e instanceof IIOException) { throw (IIOException)e; } // Any other exceptions here are probably due to internal // problems with the image reader. // A concrete example of this happening is described here: // http://java.net/jira/browse/PDF_RENDERER-132 where // JAI imageio extension throws an // IndexOutOfBoundsException on progressive JPEGs. // We'll just treat it as an IIOException for convenience // and hopefully a subsequent reader can handle it throw new IIOException("Internal reader error?", e); } } catch (IIOException e) { // its most likely complaining about an unsupported image // type; hopefully the next image reader will be able to // understand it jpegData.reset(); lastIioEx = e; } } throw lastIioEx; } private BufferedImage readImage(ImageReader jpegReader, ImageReadParam param) throws IOException { if (ycckDecodeMode) { // The standard Oracle Java JPEG readers can't deal with CMYK YCCK encoded images // without a little help from us. We'll try and pick up such instances and work around it. final IIOMetadata imageMeta = jpegReader.getImageMetadata(0); if (imageMeta != null) { final Node standardMeta = imageMeta.getAsTree(IIOMetadataFormatImpl.standardMetadataFormatName); if (standardMeta != null) { final Node chroma = getChild(standardMeta, "Chroma"); if (chroma != null) { final Node csType = getChild(chroma, "ColorSpaceType"); if (csType != null) { final Attr csTypeNameNode = (Attr)csType.getAttributes().getNamedItem("name"); if (csTypeNameNode != null && "YCCK".equals(csTypeNameNode.getValue())) { // So it's a YCCK image, and we can coax a workable image out of it // by grabbing the raw raster and installing a YCCK converting // color space wrapper around the existing (CMYK) color space; this will // do the YCCK conversion for us // first make sure we can get the unadjusted raster final Raster raster = jpegReader.readRaster(0, param); // and now use it with a YCCK converting color space. PDFImage.this.colorSpace = new PDFColorSpace(new YCCKColorSpace(colorSpace.getColorSpace())); // re-calculate the color model since the color space has changed cm = PDFImage.this.createColorModel(); return new BufferedImage( cm, Raster.createWritableRaster(raster.getSampleModel(), raster.getDataBuffer(), null), true, null); } } } } } throw new IIOException("Not a YCCK image"); } else { if (param != null && param.getDestination() != null) { // if we've already set up a destination image then we'll use it return jpegReader.read(0, param); } else { // otherwise we'll create a new buffered image with the // desired color model return new BufferedImage(cm, jpegReader.read(0, param).getRaster(), true, null); } } } /** * Get a named child node * @param aNode the node * @param aChildName the name of the child node * @return the first direct child node with that name or null * if it doesn't exist */ private Node getChild(Node aNode, String aChildName) { for (int i = 0; i < aNode.getChildNodes().getLength(); ++i) { final Node child = aNode.getChildNodes().item(i); if (child.getNodeName().equals(aChildName)) { return child; } } return null; } } /** * A wrapper for ComponentColorSpace which normalizes based on the * decode array. */ static class PdfComponentColorModel extends ComponentColorModel { int bitsPerComponent; public PdfComponentColorModel(ColorSpace cs, int[] bpc) { super(cs, bpc, false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE); pixel_bits = bpc.length * bpc[0]; this.bitsPerComponent = bpc[0]; } @Override public SampleModel createCompatibleSampleModel(int width, int height) { if (bitsPerComponent >= 8) { assert bitsPerComponent == 8 || bitsPerComponent == 16; final int numComponents = getNumComponents(); int[] bandOffsets = new int[numComponents]; for (int i=0; i < numComponents; i++) { bandOffsets[i] = i; } return new PixelInterleavedSampleModel( getTransferType(), width, height, numComponents, width * numComponents, bandOffsets); } else { switch (getPixelSize()) { case 1: case 2: case 4: // pixels don't span byte boundaries, so we can use the standard multi pixel // packing, which offers a slight performance advantage over the other sample // model, which must consider such cases. Given that sample model interactions // can dominate processing, this small distinction is worthwhile return new MultiPixelPackedSampleModel(getTransferType(), width, height, getPixelSize()); default: // pixels will cross byte boundaries assert getTransferType() == DataBuffer.TYPE_BYTE; return new PdfSubByteSampleModel(width, height, getNumComponents(), bitsPerComponent); } } } @Override public boolean isCompatibleRaster(Raster raster) { if (bitsPerComponent < 8 || getNumComponents() == 1) { SampleModel sm = raster.getSampleModel(); return sm.getSampleSize(0) == bitsPerComponent; } return super.isCompatibleRaster(raster); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
3d5dea45eda887015315e4a7b195707969c92cc3
0490f4be01545793326d07847626845e74b5dba3
/src/main/java/cafe/cryptography/curve25519/EdwardsBasepointTable.java
859c959f2510019b74b65e7da8a722e4db220bc8
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
cryptography-cafe/curve25519-elisabeth
7cb73a7efe809584ab02ecba127f57d1ebb032ef
26c014bda6cf87498b9180e8b2ec8024fdb95e80
refs/heads/main
2023-05-01T05:01:16.633844
2022-06-19T20:28:54
2022-06-19T20:28:54
168,861,270
23
5
NOASSERTION
2023-04-18T04:00:10
2019-02-02T18:04:02
Java
UTF-8
Java
false
false
1,437
java
/* * This file is part of curve25519-elisabeth. * Copyright (c) 2019 Jack Grigg * See LICENSE for licensing information. */ package cafe.cryptography.curve25519; /** * A pre-computed table of multiples of a basepoint, for accelerating fixed-base * scalar multiplication. */ public class EdwardsBasepointTable { final AffineNielsPoint.LookupTable[] tables; /** * Create a table of pre-computed multiples of basepoint. */ public EdwardsBasepointTable(final EdwardsPoint basepoint) { this.tables = new AffineNielsPoint.LookupTable[32]; EdwardsPoint Bi = basepoint; for (int i = 0; i < 32; i++) { this.tables[i] = AffineNielsPoint.buildLookupTable(Bi); // Only every second summand is precomputed (16^2 = 256) Bi = Bi.multiplyByPow2(8); } } /** * Constant-time fixed-base scalar multiplication. * * @param s the Scalar to multiply by. * @return $[s]B$ */ public EdwardsPoint multiply(final Scalar s) { int i; final byte[] e = s.toRadix16(); EdwardsPoint h = EdwardsPoint.IDENTITY; for (i = 1; i < 64; i += 2) { h = h.add(this.tables[i / 2].select(e[i])).toExtended(); } h = h.multiplyByPow2(4); for (i = 0; i < 64; i += 2) { h = h.add(this.tables[i / 2].select(e[i])).toExtended(); } return h; } }
[ "thestr4d@gmail.com" ]
thestr4d@gmail.com
952e14812a70e08c509adf4050414acbb58f7bfe
c12806c92326c6a444ff47b0458ce89bc37ff6c8
/app/src/main/java/co/uk/poyyeemobile/lastfm/interactor/TopArtistsInteractorImpl.java
5a9a3f65477de568de58586c5c95db079e0f0675
[]
no_license
Metadisk/LastFm
e3e468fc7c3afbeef981132197f140c7d93e2b3a
913628fb234d89a48fdc1e3006cab870789aba3c
refs/heads/master
2022-02-23T19:12:50.089412
2018-09-17T20:06:14
2018-09-17T20:06:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
package co.uk.poyyeemobile.lastfm.interactor; import co.uk.poyyeemobile.lastfm.model.TopArtistsResponse; import co.uk.poyyeemobile.lastfm.network.TopArtistsService; import io.reactivex.Single; import retrofit2.Retrofit; /** * Created by Firat Veral on 9/16/2018. */ public class TopArtistsInteractorImpl implements TopArtistsInteractor { Retrofit mRetrofit; public TopArtistsInteractorImpl(Retrofit retrofit) { mRetrofit = retrofit; } @Override public Single<TopArtistsResponse> getTopArtists(String userName, int limit, String apiKey) { return mRetrofit.create(TopArtistsService.class).getTopArtists(userName, limit, apiKey); } }
[ "poyyeemobile@gmail.com" ]
poyyeemobile@gmail.com
a82aa86a71cb407148839804db87052a0bf0309d
4d0b5588325da937a442ce7d4fc95b3083f55d66
/src/main/java/chatrmi/client/gui/CommunicationProvider.java
1a7323056551b1eda46f4035ca5928c40b4371b2
[]
no_license
korkmazkadir/java-rmi-chat
4739a22e068795b40683abc4799e018560e27ea5
8b95181aed0fbc995a447884cbbb4b46e15973ae
refs/heads/master
2021-03-22T04:41:35.042796
2018-02-16T22:17:55
2018-02-16T22:17:55
120,614,955
0
0
null
null
null
null
UTF-8
Java
false
false
523
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 chatrmi.client.gui; import chatrmi.common.Message; import java.util.List; /** * * @author kadir */ public interface CommunicationProvider { public void sendMessage(String receiverName, String message); public List<Message> loadMessages(String userName); public void broadcastMessage(String message); }
[ "kadir@sentiosports.com" ]
kadir@sentiosports.com
c84c3dc622fe385c46b91a7586cb965f22b3c5c2
8092fd1d5ffb3d5ea3f3fecf899a0e20202c17b2
/target-trak-system/target-trak-business/src/main/java/com/target/trak/system/business/dto/matter/MatterRequest.java
b12f9eda4702b2e134bd732b8fe44cf057413a16
[]
no_license
TonyDevNyc/target-trak-repo
f1fc9003db221c120a225bd7dc52ca11e5e11330
15c33b650bfbc6964ddfe2a37a3b6a0cb7a58eb7
refs/heads/master
2021-01-19T14:33:22.767992
2014-11-19T03:00:38
2014-11-19T03:04:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.target.trak.system.business.dto.matter; import com.target.trak.system.business.dto.TargetTrakRequest; public class MatterRequest extends TargetTrakRequest { private MatterDto matter; public MatterDto getMatter() { return matter; } public void setMatter(MatterDto matter) { this.matter = matter; } }
[ "tonydevgroupny@gmail.com" ]
tonydevgroupny@gmail.com
9178da8760e7b6c645a4fd3ab8ee3b0ea781e98a
3958549c289e83750082b65b4eb0cda66a0adae4
/app/src/main/java/com/rudanic/earthquaketracker/ui/MainActivity.java
7f9bbe7e7bf93c406dd7d9c7f0b725b6e715cc04
[]
no_license
rudani-c/EarthquakeTracker
1c0ecc051584801be42dcc31e8851dab11c3e590
78a9b9e50798bb993e0d59321424ccfa3247cac2
refs/heads/master
2021-08-26T04:42:55.229273
2017-11-21T16:42:20
2017-11-21T16:42:20
109,880,185
0
0
null
null
null
null
UTF-8
Java
false
false
13,515
java
package com.rudanic.earthquaketracker.ui; import android.Manifest; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.NavigationView; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.daimajia.androidanimations.library.Techniques; import com.daimajia.androidanimations.library.YoYo; import com.rudanic.earthquaketracker.AboutEarthquakeFragment; import com.rudanic.earthquaketracker.AboutFragment; import com.rudanic.earthquaketracker.AboutTsunamiFragment; import com.rudanic.earthquaketracker.Assets; import com.rudanic.earthquaketracker.EarthquakeFragment; import com.rudanic.earthquaketracker.FactsEarthquakeFragment; import com.rudanic.earthquaketracker.R; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { final String NAVIGATION_DRAWER_BACKGROUND_URL = "http://i.giphy.com/3o85xoKJdWyZ35P6OQ.gif"; ImageView navigationDrawerBackgroundImage; Fragment fragment; Context context = this; String mLatitude, mLongitude, mDegree; TextView latitude, longitude, twoDegree, fourDegree, eightDegree, fifteenDegree; private LocationManager locationManager; private LocationListener listener; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); fragment = new EarthquakeFragment(); // Get Location locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); listener = new LocationListener() { @Override public void onLocationChanged(Location location) { Toast.makeText(getApplicationContext(), location.getLongitude() + " " + location.getLatitude(), Toast.LENGTH_LONG).show(); } @Override public void onStatusChanged(String s, int i, Bundle bundle) { } @Override public void onProviderEnabled(String s) { } @Override public void onProviderDisabled(String s) { Intent i = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(i); } }; configure_button(); ///////////////////////////////////////////////////////////////////////////////// // What if open FAB FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { LayoutInflater layoutInflaterAndroid = LayoutInflater.from(context); View mView = layoutInflaterAndroid.inflate(R.layout.fab_dialogbox, null); AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(context); alertDialogBuilderUserInput.setView(mView); final EditText latitude = (EditText) mView.findViewById(R.id.latitude); final EditText longitude = (EditText) mView.findViewById(R.id.longitude); final RadioButton twoDegree = (RadioButton) mView.findViewById(R.id.two_degree); final RadioButton fourDegree = (RadioButton) mView.findViewById(R.id.four_degree); final RadioButton eightDegree = (RadioButton) mView.findViewById(R.id.eight_degree); final RadioButton fifteenDegree = (RadioButton) mView.findViewById(R.id.fifteen_degree); alertDialogBuilderUserInput .setCancelable(false) .setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogBox, int id) { submitFilterationDetail(view); Assets.filter = true; fragment.getFragmentManager().beginTransaction().detach(fragment).commit(); fragment.getFragmentManager().beginTransaction().attach(fragment).commit(); } private void submitFilterationDetail(View view) { if (fifteenDegree.isChecked()) { mDegree = "15"; } else if (eightDegree.isChecked()) { mDegree = "8"; } else if (fourDegree.isChecked()) { mDegree = "4"; } else if (twoDegree.isChecked()) { mDegree = "2"; } mLatitude = latitude.getText().toString(); mLongitude = longitude.getText().toString(); SharedPreferences.Editor editor = getSharedPreferences(Assets.SHARED_PREF_NAME, MODE_PRIVATE).edit(); editor.putString("latitude", mLatitude); editor.putString("longitude", mLongitude); editor.putString("radius", mDegree); editor.commit(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogBox, int id) { dialogBox.cancel(); } }); AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create(); alertDialogAndroid.show(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (navigationDrawerBackgroundImage == null) { YoYo.with(Techniques.ZoomInRight) .duration(900) .playOn(findViewById(R.id.iv_background_navigation_drawer)); navigationDrawerBackgroundImage = (ImageView) findViewById(R.id.iv_background_navigation_drawer); Glide.with(getBaseContext()).load(NAVIGATION_DRAWER_BACKGROUND_URL).into(navigationDrawerBackgroundImage); } } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); if (navigationDrawerBackgroundImage != null) { Glide.clear(navigationDrawerBackgroundImage); navigationDrawerBackgroundImage = null; } } }; drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.layout_container, fragment); fragmentTransaction.commit(); } ////////////////////////////////////////////////////////////////////////////////// private void configure_button() { // first check for permissions if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.INTERNET} , 10); } return; } // this code won't execute IF permissions are not allowed, because in the line above there is return statement. // b.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // //noinspection MissingPermission // locationManager.requestLocationUpdates("gps", 5000, 0, listener); // } // }); } //////////////////////////////////////////////////////////////////////////////// @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { Intent settingsIntent = new Intent(this, SettingsActivity.class); startActivity(settingsIntent); return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_about_earthquake) { fragment = new AboutEarthquakeFragment(); } else if (id == R.id.nav_about_tsunami) { fragment = new AboutTsunamiFragment(); } else if (id == R.id.nav_fact_earthquake) { fragment = new FactsEarthquakeFragment(); } else if (id == R.id.nav_home) { fragment = new EarthquakeFragment(); } else if (id == R.id.nav_settings) { Intent intent = new Intent(this, SettingsActivity.class); startActivity(intent); } else if (id == R.id.nav_feedback) { Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto", "dhruval.18@gmail.com", null)); intent.putExtra(Intent.EXTRA_SUBJECT, "Suggestion for \"Earthquake News\""); intent.putExtra(Intent.EXTRA_TEXT, "Hello,"); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(Intent.createChooser(intent, "Send email...")); } } else if (id == R.id.nav_rate_update) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.rudanic.earthquaketracker")); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } } else if (id == R.id.nav_share) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Check out \"Earthquake News\""); intent.putExtra(Intent.EXTRA_TEXT, "https://play.google.com/store/apps/details?id=com.rudanic.earthquaketracker"); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(Intent.createChooser(intent, "Share via")); } } else if (id == R.id.nav_about) { fragment = new AboutFragment(); } if (fragment != null) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.layout_container, fragment); fragmentTransaction.commit(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
[ "rudani.c@outlook.com" ]
rudani.c@outlook.com
d6b3be74a08a50137126742b44942ea5d399e05b
0f723a096c97557e01f244e56d1863cc671190ee
/app/src/main/java/com/example/asif/movies/WebView_Link/SignUpWebview.java
37d638163bf094240c9797262e7213721a2552da
[]
no_license
AsifAhmedShodip/MovieBOX
afccb7e2297e050d534eb172657244ddde912e0d
5ed442be82730f812c09eaab8f4140073a903919
refs/heads/master
2020-03-08T06:42:22.831932
2019-11-22T12:40:33
2019-11-22T12:40:33
127,977,966
0
0
null
null
null
null
UTF-8
Java
false
false
3,496
java
package com.example.asif.movies.WebView_Link; import android.app.ProgressDialog; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.webkit.WebViewClient; import com.example.asif.movies.R; /** * Created by asif on 07-Apr-18. */ public class SignUpWebview extends AppCompatActivity { String url , movieName ; boolean isDone = false ,isImdb = false; WebView browser; private ProgressDialog progress; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wikipedia_webview); getSupportActionBar().setDisplayHomeAsUpEnabled(true); progress=new ProgressDialog(this); progress.setMessage("Loading ..."); progress.setProgressStyle(ProgressDialog.STYLE_SPINNER); progress.setIndeterminate(true); progress.setProgress(0); progress.show(); Intent iin= getIntent(); Bundle b = iin.getExtras(); if(b!=null) { url =(String) b.get("url"); } browser = (WebView) findViewById(R.id.wikiWebView); browser.setWebViewClient(new SignUpWebview.MyBrowser()); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setJavaScriptEnabled(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.canGoBack(); browser.canGoForward(); browser.loadUrl(url); browser.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String urlNew) { SignUpWebview.this.setTitle(view.getTitle()); progress.dismiss(); } }); } private class MyBrowser extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } @Override public void onBackPressed() { if (browser.canGoBack()) { browser.goBack(); } else { super.onBackPressed(); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK) && browser.canGoBack()) { browser.goBack(); // Go to previous page return true; } // Use this as else part return super.onKeyDown(keyCode, event); } @Override public boolean onCreateOptionsMenu(Menu menu){ getMenuInflater().inflate(R.menu.open_browser, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.open: Intent i = new Intent (Intent.ACTION_VIEW); i.setData(Uri.parse(browser.getUrl())); startActivity(i); case android.R.id.home: /*if (browser.canGoBack()) { browser.goBack(); } else { super.onBackPressed(); }*/ finish(); break; } return true; } }
[ "asifahmedshodip@gmail.com" ]
asifahmedshodip@gmail.com
c91b7ef037402fb163960c5aae7ff84e539db645
70cbaeb10970c6996b80a3e908258f240cbf1b99
/WiFi万能钥匙dex1-dex2jar.jar.src/ct/ac.java
f71a90e8e859b73f899ce614bbb427aa083403d8
[]
no_license
nwpu043814/wifimaster4.2.02
eabd02f529a259ca3b5b63fe68c081974393e3dd
ef4ce18574fd7b1e4dafa59318df9d8748c87d37
refs/heads/master
2021-08-28T11:11:12.320794
2017-12-12T03:01:54
2017-12-12T03:01:54
113,553,417
2
1
null
null
null
null
UTF-8
Java
false
false
800
java
package ct; import org.apache.http.Header; import org.apache.http.HttpResponse; public final class ac { public int a = 1; public byte[] b = null; public int c = 0; public int d = 0; public HttpResponse e; public int f = 0; public final int a() { return this.a; } public final String a(String paramString) { if (this.e != null) { paramString = this.e.getFirstHeader(paramString); if (paramString == null) {} } for (paramString = paramString.getValue();; paramString = null) { return paramString; } } public final byte[] b() { return this.b; } } /* Location: /Users/hanlian/Downloads/WiFi万能钥匙dex1-dex2jar.jar!/ct/ac.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "lianh@jumei.com" ]
lianh@jumei.com
4f7a4b862f4031bea389b4472e7bb923ba2b1432
6199b81f6bf461325701e3d770e57b2802b45eea
/src/main/java/patterns/structural/composite_pattern/Composite.java
cf52de1e13921464114f6359e69307c3b21a3c4b
[]
no_license
jekafortuna/Patterns
12ca577b191f09c7e87255fb54e0518b579399f9
8c5dffe7215ae42ea96ed8f8c6571edf6a7429ff
refs/heads/master
2020-01-24T20:47:58.173692
2017-02-16T11:04:46
2017-02-16T11:04:46
73,815,452
0
0
null
null
null
null
UTF-8
Java
false
false
970
java
package patterns.structural.composite_pattern; import java.util.ArrayList; import java.util.List; /** * Created on 21. November. 16. * method should call the draw method in all its components * method draw going through the list of components and calls their method draw * * if a component becomes composite - he will print a list of storing things * * composite must move through the array of its components and call their draw method * * @author Evgeniy */ public class Composite implements Shape{ /** * for storing figures as well and possible other components */ private List<Shape> components = new ArrayList<Shape>(); public void addComponent(Shape component){ components.add(component); } public void removeComponent(Shape component){ components.remove(component); } @Override public void draw() { for (Shape component: components){ component.draw(); } } }
[ "evgeniy.fortuna@gmail.com" ]
evgeniy.fortuna@gmail.com
55a12941529e09665c6efeeab73cd36f34619e0b
513838e87f8ebf503504b1827f19213c50ee4c54
/src/com/gmail/hzz041120/jvm/pkgtest/ConstClass.java
16a843986c30854a851b3e07fa68726d94d64d98
[]
no_license
hzz041120/HZZ_ALL
a450dd070f808c8773b8fe09d46a18bea3a6fe4b
1bb88c69a2f520b77d212af213aafd334f051f38
refs/heads/master
2016-09-05T13:49:24.859331
2014-12-15T16:33:56
2014-12-15T16:33:56
3,302,662
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
package com.gmail.hzz041120.jvm.pkgtest; public class ConstClass { static { System.out.println("ConstClass init!"); } public static final String HELLO_WORLD = "hello world"; }
[ "hzz041120@gmail.com" ]
hzz041120@gmail.com
2946d745947072c55289c8f1054e132032fc8536
217e44b1dad361145b400f3c413d12e4342f7413
/javatest/src/D0_if_이론/D_if2_중첩if.java
62e4b237202d207637ba2ea926655464f905c591
[]
no_license
s02asy/study
7e5cc299edf2848aeba5a8fa7909fb06bd4b7f5d
55a1a6f9ae3a9bc83702c9679d239bbab7f4ede8
refs/heads/master
2023-08-15T14:15:31.652270
2021-09-06T08:56:55
2021-09-06T08:56:55
403,499,304
0
0
null
null
null
null
UHC
Java
false
false
1,191
java
package D0_if_이론; import java.util.Scanner; public class D_if2_중첩if { public static void main(String[] args) { /* 중첩 if === 조금전에 했던 로그인을 중첩if 로 다시 표현하기. === === 먼저 id 를 입력받고 , id 가 일치하면 그때 pw 를 입력받기. === * 1. Id를 입력받아 dbId와 일치할 경우에만 Pw를 입력할 수 있다. * 2. Id가 틀린 경우, "Id를 확인해주세요"라는 메세지를 출력한다. * 3. Pw가 틀린 경우, "Pw를 확인해주세요"라는 메세지를 출력한다. * 4. Id와 Pw와 모두 일치하는 경우, "로그인 성공"라는 메세지를 출력한다. */ Scanner scan = new Scanner(System.in); int join_id = 1234; int join_pw = 1111; System.out.print("ID 입력 : "); int log_id = scan.nextInt(); if (join_id == log_id) { System.out.print("Pw 입력 : "); int log_pw = scan.nextInt(); if (join_pw == log_pw) { System.out.println("로그인 성공!"); } if (join_pw != log_pw) { System.out.println("Pw를 확인해주세요."); } } if (join_id != log_id) { System.out.println("Id를 확인해주세요."); } } }
[ "A@DESKTOP-H0948LR" ]
A@DESKTOP-H0948LR
c9bebeb4b25f341a298b740ec82598999c8ada0c
636d9cc9140e13af1d24c6f19615b6d32fc73bdf
/app/src/main/java/com/example/gmap_v_01_2/editor/ImageProcessing.java
76abfc1f5b972bb553a79e813a0941cbd7119bda
[]
no_license
razmik-gharibyan/Gmap_v_01_2
d5ee1b829434106c3abc7196f683e0465d614b4c
86ce13483bfd0ab9e126847e64ebe3c97f541f05
refs/heads/master
2020-08-08T00:49:33.878602
2020-03-31T15:10:49
2020-03-31T15:10:49
213,647,640
0
0
null
null
null
null
UTF-8
Java
false
false
2,622
java
package com.example.gmap_v_01_2.editor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.util.Base64; import java.io.ByteArrayOutputStream; public class ImageProcessing { private FollowerProcessing followerProcessing; public ImageProcessing(FollowerProcessing followerProcessing) { this.followerProcessing = followerProcessing; } //This method takes users bitmap and remake it with prefered width and height public Bitmap getResizedBitmap(Bitmap bitmap, Long followers) { int[] PicWidthHeight = followerProcessing.picSizeViaFollower(followers); return Bitmap.createScaledBitmap(bitmap,PicWidthHeight[0],PicWidthHeight[1], false); } //This Method resizing bitmap to UserList Fragment size type public Bitmap getResizedBitmapForUserListFragment(Bitmap bitmap) { return Bitmap.createScaledBitmap(bitmap,100,100,false); } //CONVERT BITMAP TO STRING public String bitmapToString(Bitmap bitmap) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG,100,baos); byte[] b = baos.toByteArray(); String result = Base64.encodeToString(b,Base64.DEFAULT); return result; } //CONVERT STRING TO BITMAP public Bitmap stringToBitmap(String string) { try{ byte[] encodeByte = Base64.decode(string,Base64.DEFAULT); Bitmap bitmap = BitmapFactory.decodeByteArray(encodeByte,0,encodeByte.length); return bitmap; }catch(Exception e) { e.getMessage(); return null; } } //This method makes standard image to circle image as Instagram have public Bitmap getCroppedBitmap(Bitmap bitmap) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),bitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff424242; final Paint paint = new Paint(); final Rect rect = new Rect(0,0,bitmap.getWidth(),bitmap.getHeight()); paint.setAntiAlias(true); canvas.drawARGB(0,0,0,0); paint.setColor(color); canvas.drawCircle(bitmap.getWidth()/2,bitmap.getHeight()/2,bitmap.getWidth()/2,paint); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(bitmap, rect, rect, paint); return output; } }
[ "razmik.gharibyan.olymp@gmail.com" ]
razmik.gharibyan.olymp@gmail.com
29e5bb32451628fa4ab537adae02fb1237273b77
fa93c9be2923e697fb8a2066f8fb65c7718cdec7
/sources/ru/sravni/android/bankproduct/utils/filter/entity/FilterItem.java
92851828f90bf664052d6a08d77deaf038ba5d27
[]
no_license
Auch-Auch/avito_source
b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b
76fdcc5b7e036c57ecc193e790b0582481768cdc
refs/heads/master
2023-05-06T01:32:43.014668
2021-05-25T10:19:22
2021-05-25T10:19:22
370,650,685
0
0
null
null
null
null
UTF-8
Java
false
false
15,619
java
package ru.sravni.android.bankproduct.utils.filter.entity; import a2.b.a.a.a; import com.avito.android.remote.auth.AuthSource; import com.google.android.gms.analytics.ecommerce.ProductAction; import java.util.List; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\t\b\u0016\u0018\u00002\u00020\u0001:\u0001\u001cB'\u0012\u0006\u0010\u0019\u001a\u00020\u0014\u0012\u0006\u0010\r\u001a\u00020\b\u0012\u0006\u0010\u0007\u001a\u00020\u0002\u0012\u0006\u0010\u0013\u001a\u00020\u000e¢\u0006\u0004\b\u001a\u0010\u001bR\u0019\u0010\u0007\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u0003\u0010\u0004\u001a\u0004\b\u0005\u0010\u0006R\u0019\u0010\r\u001a\u00020\b8\u0006@\u0006¢\u0006\f\n\u0004\b\t\u0010\n\u001a\u0004\b\u000b\u0010\fR\u0019\u0010\u0013\u001a\u00020\u000e8\u0006@\u0006¢\u0006\f\n\u0004\b\u000f\u0010\u0010\u001a\u0004\b\u0011\u0010\u0012R\u001c\u0010\u0019\u001a\u00020\u00148\u0016@\u0016X–\u0004¢\u0006\f\n\u0004\b\u0015\u0010\u0016\u001a\u0004\b\u0017\u0010\u0018¨\u0006\u001d"}, d2 = {"Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem;", "", "", "c", "I", "getIcon", "()I", "icon", "Lru/sravni/android/bankproduct/utils/filter/entity/FilterTypeEnum;", AuthSource.BOOKING_ORDER, "Lru/sravni/android/bankproduct/utils/filter/entity/FilterTypeEnum;", "getType", "()Lru/sravni/android/bankproduct/utils/filter/entity/FilterTypeEnum;", "type", "Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;", "d", "Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;", "getFilterInfo", "()Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;", "filterInfo", "", AuthSource.SEND_ABUSE, "Ljava/lang/String;", "getTitle", "()Ljava/lang/String;", "title", "<init>", "(Ljava/lang/String;Lru/sravni/android/bankproduct/utils/filter/entity/FilterTypeEnum;ILru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;)V", "FilterInfo", "sravnichat_release"}, k = 1, mv = {1, 4, 0}) public class FilterItem { @NotNull public final String a; @NotNull public final FilterTypeEnum b; public final int c; @NotNull public final FilterInfo d; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0010\b\n\u0002\b\u0014\b†\b\u0018\u00002\u00020\u0001:\u0001'B-\u0012\u0006\u0010\r\u001a\u00020\u0002\u0012\u0006\u0010\u000e\u001a\u00020\u0002\u0012\u0006\u0010\u000f\u001a\u00020\u0006\u0012\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\n0\t¢\u0006\u0004\b%\u0010&J\u0010\u0010\u0003\u001a\u00020\u0002HÆ\u0003¢\u0006\u0004\b\u0003\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u0002HÆ\u0003¢\u0006\u0004\b\u0005\u0010\u0004J\u0010\u0010\u0007\u001a\u00020\u0006HÆ\u0003¢\u0006\u0004\b\u0007\u0010\bJ\u0016\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\n0\tHÆ\u0003¢\u0006\u0004\b\u000b\u0010\fJ>\u0010\u0011\u001a\u00020\u00002\b\b\u0002\u0010\r\u001a\u00020\u00022\b\b\u0002\u0010\u000e\u001a\u00020\u00022\b\b\u0002\u0010\u000f\u001a\u00020\u00062\u000e\b\u0002\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\n0\tHÆ\u0001¢\u0006\u0004\b\u0011\u0010\u0012J\u0010\u0010\u0013\u001a\u00020\u0002HÖ\u0001¢\u0006\u0004\b\u0013\u0010\u0004J\u0010\u0010\u0015\u001a\u00020\u0014HÖ\u0001¢\u0006\u0004\b\u0015\u0010\u0016J\u001a\u0010\u0018\u001a\u00020\u00062\b\u0010\u0017\u001a\u0004\u0018\u00010\u0001HÖ\u0003¢\u0006\u0004\b\u0018\u0010\u0019R\u0019\u0010\u000e\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u001a\u0010\u001b\u001a\u0004\b\u001c\u0010\u0004R\u001f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\n0\t8\u0006@\u0006¢\u0006\f\n\u0004\b\u001d\u0010\u001e\u001a\u0004\b\u001f\u0010\fR\u0019\u0010\r\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b \u0010\u001b\u001a\u0004\b!\u0010\u0004R\u0019\u0010\u000f\u001a\u00020\u00068\u0006@\u0006¢\u0006\f\n\u0004\b\"\u0010#\u001a\u0004\b$\u0010\b¨\u0006("}, d2 = {"Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;", "", "", "component1", "()Ljava/lang/String;", "component2", "", "component3", "()Z", "", "Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo$DetailFilter;", "component4", "()Ljava/util/List;", "name", "titleDetail", "editable", ProductAction.ACTION_DETAIL, "copy", "(Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo;", "toString", "", "hashCode", "()I", "other", "equals", "(Ljava/lang/Object;)Z", AuthSource.BOOKING_ORDER, "Ljava/lang/String;", "getTitleDetail", "d", "Ljava/util/List;", "getDetail", AuthSource.SEND_ABUSE, "getName", "c", "Z", "getEditable", "<init>", "(Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)V", "DetailFilter", "sravnichat_release"}, k = 1, mv = {1, 4, 0}) public static final class FilterInfo { @NotNull public final String a; @NotNull public final String b; public final boolean c; @NotNull public final List<DetailFilter> d; @Metadata(bv = {1, 0, 3}, d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\n\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\f\b†\b\u0018\u00002\u00020\u0001B\u001f\u0012\u0006\u0010\u0007\u001a\u00020\u0002\u0012\u0006\u0010\b\u001a\u00020\u0002\u0012\u0006\u0010\t\u001a\u00020\u0002¢\u0006\u0004\b\u001b\u0010\u001cJ\u0010\u0010\u0003\u001a\u00020\u0002HÆ\u0003¢\u0006\u0004\b\u0003\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u0002HÆ\u0003¢\u0006\u0004\b\u0005\u0010\u0004J\u0010\u0010\u0006\u001a\u00020\u0002HÆ\u0003¢\u0006\u0004\b\u0006\u0010\u0004J.\u0010\n\u001a\u00020\u00002\b\b\u0002\u0010\u0007\u001a\u00020\u00022\b\b\u0002\u0010\b\u001a\u00020\u00022\b\b\u0002\u0010\t\u001a\u00020\u0002HÆ\u0001¢\u0006\u0004\b\n\u0010\u000bJ\u0010\u0010\f\u001a\u00020\u0002HÖ\u0001¢\u0006\u0004\b\f\u0010\u0004J\u0010\u0010\u000e\u001a\u00020\rHÖ\u0001¢\u0006\u0004\b\u000e\u0010\u000fJ\u001a\u0010\u0012\u001a\u00020\u00112\b\u0010\u0010\u001a\u0004\u0018\u00010\u0001HÖ\u0003¢\u0006\u0004\b\u0012\u0010\u0013R\u0019\u0010\t\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u0014\u0010\u0015\u001a\u0004\b\u0016\u0010\u0004R\u0019\u0010\u0007\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u0017\u0010\u0015\u001a\u0004\b\u0018\u0010\u0004R\u0019\u0010\b\u001a\u00020\u00028\u0006@\u0006¢\u0006\f\n\u0004\b\u0019\u0010\u0015\u001a\u0004\b\u001a\u0010\u0004¨\u0006\u001d"}, d2 = {"Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo$DetailFilter;", "", "", "component1", "()Ljava/lang/String;", "component2", "component3", "code", "title", "value", "copy", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lru/sravni/android/bankproduct/utils/filter/entity/FilterItem$FilterInfo$DetailFilter;", "toString", "", "hashCode", "()I", "other", "", "equals", "(Ljava/lang/Object;)Z", "c", "Ljava/lang/String;", "getValue", AuthSource.SEND_ABUSE, "getCode", AuthSource.BOOKING_ORDER, "getTitle", "<init>", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "sravnichat_release"}, k = 1, mv = {1, 4, 0}) public static final class DetailFilter { @NotNull public final String a; @NotNull public final String b; @NotNull public final String c; public DetailFilter(@NotNull String str, @NotNull String str2, @NotNull String str3) { a.a1(str, "code", str2, "title", str3, "value"); this.a = str; this.b = str2; this.c = str3; } public static /* synthetic */ DetailFilter copy$default(DetailFilter detailFilter, String str, String str2, String str3, int i, Object obj) { if ((i & 1) != 0) { str = detailFilter.a; } if ((i & 2) != 0) { str2 = detailFilter.b; } if ((i & 4) != 0) { str3 = detailFilter.c; } return detailFilter.copy(str, str2, str3); } @NotNull public final String component1() { return this.a; } @NotNull public final String component2() { return this.b; } @NotNull public final String component3() { return this.c; } @NotNull public final DetailFilter copy(@NotNull String str, @NotNull String str2, @NotNull String str3) { Intrinsics.checkParameterIsNotNull(str, "code"); Intrinsics.checkParameterIsNotNull(str2, "title"); Intrinsics.checkParameterIsNotNull(str3, "value"); return new DetailFilter(str, str2, str3); } public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof DetailFilter)) { return false; } DetailFilter detailFilter = (DetailFilter) obj; return Intrinsics.areEqual(this.a, detailFilter.a) && Intrinsics.areEqual(this.b, detailFilter.b) && Intrinsics.areEqual(this.c, detailFilter.c); } @NotNull public final String getCode() { return this.a; } @NotNull public final String getTitle() { return this.b; } @NotNull public final String getValue() { return this.c; } public int hashCode() { String str = this.a; int i = 0; int hashCode = (str != null ? str.hashCode() : 0) * 31; String str2 = this.b; int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31; String str3 = this.c; if (str3 != null) { i = str3.hashCode(); } return hashCode2 + i; } @NotNull public String toString() { StringBuilder L = a.L("DetailFilter(code="); L.append(this.a); L.append(", title="); L.append(this.b); L.append(", value="); return a.t(L, this.c, ")"); } } public FilterInfo(@NotNull String str, @NotNull String str2, boolean z, @NotNull List<DetailFilter> list) { Intrinsics.checkParameterIsNotNull(str, "name"); Intrinsics.checkParameterIsNotNull(str2, "titleDetail"); Intrinsics.checkParameterIsNotNull(list, ProductAction.ACTION_DETAIL); this.a = str; this.b = str2; this.c = z; this.d = list; } /* JADX DEBUG: Multi-variable search result rejected for r0v0, resolved type: ru.sravni.android.bankproduct.utils.filter.entity.FilterItem$FilterInfo */ /* JADX WARN: Multi-variable type inference failed */ public static /* synthetic */ FilterInfo copy$default(FilterInfo filterInfo, String str, String str2, boolean z, List list, int i, Object obj) { if ((i & 1) != 0) { str = filterInfo.a; } if ((i & 2) != 0) { str2 = filterInfo.b; } if ((i & 4) != 0) { z = filterInfo.c; } if ((i & 8) != 0) { list = filterInfo.d; } return filterInfo.copy(str, str2, z, list); } @NotNull public final String component1() { return this.a; } @NotNull public final String component2() { return this.b; } public final boolean component3() { return this.c; } @NotNull public final List<DetailFilter> component4() { return this.d; } @NotNull public final FilterInfo copy(@NotNull String str, @NotNull String str2, boolean z, @NotNull List<DetailFilter> list) { Intrinsics.checkParameterIsNotNull(str, "name"); Intrinsics.checkParameterIsNotNull(str2, "titleDetail"); Intrinsics.checkParameterIsNotNull(list, ProductAction.ACTION_DETAIL); return new FilterInfo(str, str2, z, list); } public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } if (!(obj instanceof FilterInfo)) { return false; } FilterInfo filterInfo = (FilterInfo) obj; return Intrinsics.areEqual(this.a, filterInfo.a) && Intrinsics.areEqual(this.b, filterInfo.b) && this.c == filterInfo.c && Intrinsics.areEqual(this.d, filterInfo.d); } @NotNull public final List<DetailFilter> getDetail() { return this.d; } public final boolean getEditable() { return this.c; } @NotNull public final String getName() { return this.a; } @NotNull public final String getTitleDetail() { return this.b; } public int hashCode() { String str = this.a; int i = 0; int hashCode = (str != null ? str.hashCode() : 0) * 31; String str2 = this.b; int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31; boolean z = this.c; if (z) { z = true; } int i2 = z ? 1 : 0; int i3 = z ? 1 : 0; int i4 = z ? 1 : 0; int i5 = (hashCode2 + i2) * 31; List<DetailFilter> list = this.d; if (list != null) { i = list.hashCode(); } return i5 + i; } @NotNull public String toString() { StringBuilder L = a.L("FilterInfo(name="); L.append(this.a); L.append(", titleDetail="); L.append(this.b); L.append(", editable="); L.append(this.c); L.append(", detail="); return a.w(L, this.d, ")"); } } public FilterItem(@NotNull String str, @NotNull FilterTypeEnum filterTypeEnum, int i, @NotNull FilterInfo filterInfo) { Intrinsics.checkParameterIsNotNull(str, "title"); Intrinsics.checkParameterIsNotNull(filterTypeEnum, "type"); Intrinsics.checkParameterIsNotNull(filterInfo, "filterInfo"); this.a = str; this.b = filterTypeEnum; this.c = i; this.d = filterInfo; } @NotNull public final FilterInfo getFilterInfo() { return this.d; } public final int getIcon() { return this.c; } @NotNull public String getTitle() { return this.a; } @NotNull public final FilterTypeEnum getType() { return this.b; } }
[ "auchhunter@gmail.com" ]
auchhunter@gmail.com
835c426b274d9dd3228160ccf24cfc60e478fc3d
2e6bb8a986225f38f367e59db8ab50939b933911
/src/rekkura/ggp/player/ConsolePlayer.java
325ff7264f49539469d5dbd55f74c09f4737b12d
[]
no_license
ptpham/rekkura
151eb435901da438ee3051431a2f58c53bcad1d8
387b3caf2f9f76d46176540c410ef47374cd82cc
refs/heads/master
2016-09-06T04:16:11.628497
2013-12-21T19:30:42
2013-12-21T19:30:42
8,425,849
0
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package rekkura.ggp.player; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.List; import java.util.Map; import rekkura.ggp.milleu.Game; import rekkura.ggp.milleu.Player; import rekkura.logic.model.Dob; import rekkura.util.Event; import com.google.common.collect.ListMultimap; import com.google.common.eventbus.EventBus; /** * This super exciting player will allow you (a human!) * to feebly struggle against your mighty GGP overlords. * @author ptpham * */ public class ConsolePlayer extends Player.ProverBased { @Override protected void plan() { queryHumanMove(); } @Override protected void move() { queryHumanMove(); } public static class MoveEvent {} public EventBus bus; @Override protected void reflect() { printLastTurn(); System.out.println("Goals: " + machine.getGoals(getTurn().state)); } private void queryHumanMove() { setDecision(anyDecision()); Game.Turn turn = getTurn(); printLastTurn(); ListMultimap<Dob, Dob> actions = machine.getActions(turn.state); List<Dob> available = actions.get(role); for (int i = 0; i < available.size(); i++) { System.out.println(i + ") " + available.get(i)); } System.out.print("Please enter a move: "); try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int selection = Integer.parseInt(reader.readLine()); setDecision(turn.turn, available.get(selection)); } catch (Throwable e) { setDecision(anyDecision()); } Event.post(bus, new MoveEvent()); } protected Map<Dob, Dob> getLastTurnActions() { if (this.getTurn().turn == 0) return null; return this.getMemory(this.getTurn().turn - 1); } private void printLastTurn() { Map<Dob, Dob> lastTurn = getLastTurnActions(); if (lastTurn != null) { System.out.println("Moves on turn " + (getTurn().turn - 1) + ": " + lastTurn); } } }
[ "silentmagesoul@gmail.com" ]
silentmagesoul@gmail.com
baef1581fe16fd141786bc58b03604330dd49894
dd949f215d968f2ee69bf85571fd63e4f085a869
/systems/css-2011-teams/red/subarchitectures/dialogue.sa/apis/dialogue/src/java/de/dfki/lt/tr/dialogue/cplan/LoggingTracer.java
c60981c84d244de2ca03d3de8ea5bc7b69a332fe
[]
no_license
marc-hanheide/cogx
a3fd395805f1b0ad7d713a05b9256312757b37a9
cb9a9c9cdfeba02afac6a83d03b7c6bb778edb95
refs/heads/master
2022-03-16T23:36:21.951317
2013-12-10T23:49:07
2013-12-10T23:49:07
219,460,352
1
2
null
null
null
null
UTF-8
Java
false
false
1,204
java
package de.dfki.lt.tr.dialogue.cplan; import org.apache.log4j.Logger; public class LoggingTracer implements RuleTracer { private int _ruleTracing = 0; private Logger logger = Logger.getLogger("TraceLogger"); public LoggingTracer(int bitmask) { setTracing(bitmask); } @Override public void traceMatch(DagEdge current, Rule r, Bindings bindings) { if ((_ruleTracing & DISPLAY_MATCHING) != 0) { StringBuilder sb = new StringBuilder(); sb.append("\nMATCH: "); r.appendMatches(sb).append("\n ").append(current); logger.info(sb.toString()); } } @Override public void traceBeforeApplication(DagEdge current, Rule r) { // TODO Auto-generated method stub if ((_ruleTracing & DISPLAY_MODIFICATION) != 0) { logger.info("\nAPPLY " + r.appendActions(new StringBuilder()).toString() + "\nTO " + current); } } @Override public void traceAfterApplication(DagEdge current, Rule r) { // TODO Auto-generated method stub if ((_ruleTracing & DISPLAY_MODIFICATION) != 0) { logger.info("GETS " + current); } } @Override public void setTracing(int bitmask) { _ruleTracing = bitmask; } }
[ "marc@hanheide.net" ]
marc@hanheide.net
4d63b55645eca97a8bec4abaf079586866aa929f
8a8d3ef150cd369c38f239735d1509be5bac4a2f
/src/test/java/com/raj/in/repository/EmployeeRepositoryTest.java
b00261e3920087ff39ba88b3fe854c947a7b5f0a
[]
no_license
prudhvi2244/one-to-one-primary-key
01144f26ff31207bcdb2b49215767451e498d57b
abe5a390840d2a6a1c47813af0fc40ed9018fbb8
refs/heads/master
2023-06-25T16:52:39.287965
2021-07-20T17:51:12
2021-07-20T17:51:12
387,871,767
0
0
null
null
null
null
UTF-8
Java
false
false
866
java
package com.raj.in.repository; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import com.raj.in.entity.Account; import com.raj.in.entity.Employee; import lombok.extern.slf4j.Slf4j; @SpringBootTest @Slf4j public class EmployeeRepositoryTest { @Autowired private EmployeeRepository erepo; @Test public void testSaveEmployee() { Account account = new Account(); account.setBname("ICICI Bank"); Employee employee = new Employee(); employee.setEname("Rajeev"); employee.setEcity("Goa"); employee.setAccount(account); Employee savedEmployee = erepo.save(employee); System.out.println("Saved Employee :"+savedEmployee); Assertions.assertThat(savedEmployee).isNotNull(); } }
[ "raj.rajeev2244@gmail.com" ]
raj.rajeev2244@gmail.com
d9cde9f203d9dc9a2e310c028fa1f32b25ab2e0d
df20df1185b73231e6200180a7c6009d0f16790d
/app/src/main/java/com/yzw/weather/weatherreport/response/Basic.java
83e091ad3be256bf1acb9d77392b28f6f5ac3b81
[]
no_license
figodogcom/WeatherReport-new
2b3fa32deb69b79425766aceec0c236a7bed7a9f
f878d2f70f2d73c372e922cb7af1a1e9135ff97b
refs/heads/master
2021-01-12T01:07:56.450401
2017-01-08T15:02:46
2017-01-08T15:02:46
78,349,705
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
package com.yzw.weather.weatherreport.response; /** * Created by yangzhiwei on 2016/12/6. */ public class Basic { public String city; public String cnty; public String id; public String lat; public String lon; public Update update; @Override public String toString() { return "Basic{" + "city='" + city + '\'' + ", cnty='" + cnty + '\'' + ", id='" + id + '\'' + ", lat='" + lat + '\'' + ", lon='" + lon + '\'' + ", update=" + update + '}'; } }
[ "yangzhiwei@hq.ddw100.cn" ]
yangzhiwei@hq.ddw100.cn
00fa86c21cc01ab7fa7d40362a0671bedc4c5929
bc2e871fa77de22b169d0d4a3dd2be137caf2635
/src/com/fujun/zxing/view/ViewfinderResultPointCallback.java
26c53b0d1bd6ca70496d1b516ab1055dcc5fea7c
[]
no_license
puzhuo/MyBrowserForLx
63815a090100fe1105727e2e46f68bd0ebb2332f
7d1151172dc123ec512a69b6b5ad1475d7707eb2
refs/heads/master
2020-12-25T18:23:13.960340
2014-02-20T07:59:59
2014-02-20T07:59:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,084
java
/* * Copyright (C) 2009 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fujun.zxing.view; import com.google.zxing.ResultPoint; import com.google.zxing.ResultPointCallback; public final class ViewfinderResultPointCallback implements ResultPointCallback { private final ViewfinderView viewfinderView; public ViewfinderResultPointCallback(ViewfinderView viewfinderView) { this.viewfinderView = viewfinderView; } public void foundPossibleResultPoint(ResultPoint point) { viewfinderView.addPossibleResultPoint(point); } }
[ "2573940463@qq.com" ]
2573940463@qq.com
6f7e2d89cbc995a4c510f35cc320e37d6cc597ad
7bfa6595f0037ce8a47486266d0ecab6c0a6e8e6
/src/main/java/com/diy/vcp/grpc/core/HelloWorldServiceProto.java
9978af9a753d4542a627b2a631271a9ce44e2681
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-mulanpsl-1.0-en", "MulanPSL-1.0" ]
permissive
yebukong/protobuf-mvn-plugin-test
b5a0a17c037fa11c068728e7b08de3a48fb3f1f7
cd0bcce2b73d88abad3d3ef0b5302ca491005def
refs/heads/master
2023-07-19T17:15:15.621708
2019-12-11T13:09:42
2019-12-11T13:09:42
227,369,366
0
0
NOASSERTION
2022-10-04T23:55:41
2019-12-11T13:13:39
Java
UTF-8
Java
false
true
2,548
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: test.proto package com.diy.vcp.grpc.core; public final class HelloWorldServiceProto { private HelloWorldServiceProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_grpc_HelloRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_grpc_HelloRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_grpc_HelloReply_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_grpc_HelloReply_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\ntest.proto\022\004grpc\")\n\014HelloRequest\022\014\n\004na" + "me\030\001 \001(\t\022\013\n\003sex\030\002 \001(\t\"\035\n\nHelloReply\022\017\n\007m" + "essage\030\001 \001(\t2=\n\007Greeter\0222\n\010SayHello\022\022.gr" + "pc.HelloRequest\032\020.grpc.HelloReply\"\000B1\n\025c" + "om.diy.vcp.grpc.coreB\026HelloWorldServiceP" + "rotoP\001b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }); internal_static_grpc_HelloRequest_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_grpc_HelloRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_grpc_HelloRequest_descriptor, new java.lang.String[] { "Name", "Sex", }); internal_static_grpc_HelloReply_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_grpc_HelloReply_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_grpc_HelloReply_descriptor, new java.lang.String[] { "Message", }); } // @@protoc_insertion_point(outer_class_scope) }
[ "yebukong@qq.com" ]
yebukong@qq.com
d5f488fba4802d5a9ee00844736dce794beb62f6
5ec59fbe610151919d7dec5015625a1095e290d4
/app/src/main/java/readcard/lauway/com/readcard/AppContext.java
227a5bdc4f1670f42a47fb64b495aecfbdc27493
[ "Apache-2.0" ]
permissive
xujinyang/ReadNFCCard
49e3d7b5437de0754b9d20c3db50fd6d7fceae0e
8c00616d469f6746ea99e846d129deab13473d7c
refs/heads/master
2021-01-17T20:29:59.473584
2016-06-01T10:34:20
2016-06-01T10:34:20
60,167,900
1
0
null
null
null
null
UTF-8
Java
false
false
420
java
package readcard.lauway.com.readcard; import android.app.Application; import me.ele.omniknight.common.tools.AppLogger; public class AppContext extends Application { private static AppContext INSTANCE; @Override public void onCreate() { super.onCreate(); INSTANCE = this; AppLogger.debug = true; } public static AppContext getInstance() { return INSTANCE; } }
[ "1119117546@qq.com" ]
1119117546@qq.com
230f6723cb0cd95112ae5af8c7a3e7c2f5aede92
ed2d9606b3d37396f02bfdb4430b16d2ef2b193e
/OVM_ThirdGeneration/OVM_Java_PC/src/OVM_Primitives/OVM_Primitives_Java/Regular_PC_UART.java
ae375cafd0fff0feac88f36e1f0a2104a5f71e67
[]
no_license
malduailij/Oppnet-OVM
0b62dc35ab6fc79d514101629be5112230c32370
b405566ab01be49ebf17086819e1847b46fb218e
refs/heads/master
2021-01-10T07:48:52.420309
2015-12-07T18:44:57
2015-12-07T18:44:57
47,466,899
0
0
null
null
null
null
UTF-8
Java
false
false
3,893
java
package OVM_Primitives.OVM_Primitives_Java; import java.net.*; import java.io.*; public class Regular_PC_UART extends Regular_PC { public static final String reqHelp = "111"; public static final String Join = "222"; public static final String Admit = "333"; public static final String reqRelease = "444"; public static final String Release = "555"; public static final String Task = "911"; public Process NODE_listen2(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Listen_2 -comm network@localhost:60002"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } /////////////////////////////////////////////////////////////////////////////////////// public Process NODE_join(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Join -comm network@localhost:60002"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } //////////////////////////////////////////////////////////////////////////////////////////// public Process NODE_reqRelease(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Req_Release -comm network@localhost:60002"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } ///////////////////////////////////////////////////////////////////////////////////////// public Process NODE_reqHelp(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Req_Help -comm network@localhost:60001"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } ////////////////////////////////////////////////////////////////////////////////// public Process NODE_sendTask(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Send_Task -comm network@localhost:60001"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } ///////////////////////////////////////////////////////////////////////////////// public Process NODE_evaluateAdmit(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Evaluate_Admit -comm network@localhost:60001"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } //////////////////////////////////////////////////////////////////////////////// public Process NODE_listen1(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Listen_1 -comm network@localhost:60001"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } //////////////////////////////////////////////////////////////////////////////// public Process NODE_release(Process p) throws InterruptedException, IOException{ String myScript = "java -cp /opt/tinyos-2.x/apps/tests/Oppnet2 Release -comm network@localhost:60001"; String[] cmdArray = {"xterm", "-e", myScript+ " ; sleep 5"}; p = Runtime.getRuntime().exec(cmdArray); return p; } }
[ "mai.alduailij@gmail.com" ]
mai.alduailij@gmail.com
448cdfec107677643c72b11574504fdfbd8a9807
b23f4fb8323a223abb26da107b589245142fce33
/Java编程思想【第4版】习题答案/object/ATNTest.java
ef6e16bcc69c135f27b80853f7269f57ff65b611
[]
no_license
leozhiyu/thinking-in-java
d9f61ccf6657026ae223c36aeb2a5e9a62c24b20
72440f4b4a11022adfa14dd839770843f59079db
refs/heads/master
2021-09-08T02:27:34.035030
2018-03-06T00:54:58
2018-03-06T00:54:58
112,142,580
1
0
null
null
null
null
UTF-8
Java
false
false
521
java
// TIJ4 Chapter Object, Exericise 3, page 90 // object/ATNTest.java // Find the code fragments involving ATypeName and turn them into a program // that compiles and runs. public class ATNTest { public static void main(String[] args) { class ATypeName { int i; double d; boolean b; void show() { System.out.println(i); System.out.println(d); System.out.println(b); } } ATypeName a = new ATypeName(); a.i = 3; a.d = 2.71828; a.b = false; a.show(); } }
[ "18779775257@163.com" ]
18779775257@163.com
48e8da5a75517fbac9bdb76fe49b5f56f6bbaf84
8bd5801f7d2cbf1b35e6e35ff4ad827ca3026bf9
/src/test/java/movie/RowTrimTest.java
3a89b5a62e7e04af1b91c5ae66e7015f04c28204
[]
no_license
cruxcode/movietheater
fb6101fd570afb42f11252f44970cc634e43d468
d856da7a3b9d37657aa80cd2f56c83d2f82f7afe
refs/heads/master
2023-03-18T08:26:42.641983
2021-03-10T21:28:12
2021-03-10T21:28:12
346,203,048
0
0
null
null
null
null
UTF-8
Java
false
false
1,570
java
package movie; import static org.junit.Assert.*; import java.util.LinkedList; import org.junit.Test; public class RowTrimTest { @Test public void test() { LinkedList<FreeRange> list = new LinkedList<FreeRange>(); // test full overlap and small list.add(new FreeRange(4, 6)); list.add(new FreeRange(15, 18)); PsuedoMatrix.trimFreeRanges(list, 3, 8); assertEquals(list.size(), 1); assertEquals(this.equalRange(list.get(0), new FreeRange(15, 18)), true); // test full overlap and big list = new LinkedList<FreeRange>(); list.add(new FreeRange(0, 4)); list.add(new FreeRange(6, 15)); list.add(new FreeRange(18, 19)); PsuedoMatrix.trimFreeRanges(list, 10, 12); assertEquals(list.size(), 4); assertEquals(this.equalRange(list.get(0), new FreeRange(0, 4)), true); assertEquals(this.equalRange(list.get(1), new FreeRange(6, 9)), true); assertEquals(this.equalRange(list.get(2), new FreeRange(13, 15)), true); assertEquals(this.equalRange(list.get(3), new FreeRange(18, 19)), true); // test partial right overlap and left overlap together list = new LinkedList<FreeRange>(); list.add(new FreeRange(0, 4)); list.add(new FreeRange(7, 15)); PsuedoMatrix.trimFreeRanges(list, 3, 12); assertEquals(list.size(), 2); assertEquals(this.equalRange(list.get(0), new FreeRange(0, 2)), true); assertEquals(this.equalRange(list.get(1), new FreeRange(13, 15)), true); } boolean equalRange(FreeRange r1, FreeRange r2) { if(r1.getEnd() != r2.getEnd() || r1.getStart() != r2.getStart()) { return false; } return true; } }
[ "ss6146@columbia.edu" ]
ss6146@columbia.edu
71043e66e66972fc6a99264c61c682387d3340f7
83d20cee609d0d059ec3ded2ab412fa87238deec
/src/main/java/test/view/TodoListViewTest.java
7546b276197454b8c72a37a4fa1482268477cecd
[]
no_license
tirwanda/java-todolist-database
32f1d49a33804bcf2c23ef8cddb40ac405b8d6d7
1dddcf15293ff72e15f5c0aaeb7944a4b4716028
refs/heads/master
2023-05-19T20:49:51.885075
2021-06-13T14:35:16
2021-06-13T14:35:16
376,565,233
0
0
null
null
null
null
UTF-8
Java
false
false
1,832
java
package test.view; import repository.TodoListRepository; import repository.TodoListRepositoryImpl; import service.TodoListService; import service.TodoListServiceImpl; import view.TodoListView; public class TodoListViewTest { public static void main(String[] args) { testRemoveTodoList(); } public static void testShowTodoList() { // TodoListRepository todoListRepository = new TodoListRepositoryImpl(); // TodoListService todoListService = new TodoListServiceImpl(todoListRepository); // TodoListView todoListView = new TodoListView(todoListService); // // todoListService.addTodoList("Belajar Java Dasar"); // todoListService.addTodoList("Belajara Java OOP"); // todoListService.addTodoList("Belajar Java Standard Classes"); // // todoListView.showTodoList(); } public static void testAddTodoList() { // TodoListRepository todoListRepository = new TodoListRepositoryImpl(); // TodoListService todoListService = new TodoListServiceImpl(todoListRepository); // TodoListView todoListView = new TodoListView(todoListService); // // todoListView.addTodoList(); // todoListView.showTodoList(); } public static void testRemoveTodoList() { // TodoListRepository todoListRepository = new TodoListRepositoryImpl(); // TodoListService todoListService = new TodoListServiceImpl(todoListRepository); // TodoListView todoListView = new TodoListView(todoListService); // // todoListService.addTodoList("Belajar Java Dasar"); // todoListService.addTodoList("Belajara Java OOP"); // todoListService.addTodoList("Belajar Java Standard Classes"); // // todoListService.showTodoList(); // todoListView.removeTodoList(); // todoListService.showTodoList(); } }
[ "edhodwitirwanda@gmail.com" ]
edhodwitirwanda@gmail.com
80af08fe9d012287200b9a337f4c5b594369ce30
ab6141e399a4aa8b990a86c0c9e8a326b218e3f9
/src/day26_arrays04/Split.java
6d27c8f6a1dcdce4b2ff437c3fd56121b817ee5f
[]
no_license
ethemsoylemez/JavaProgramingSpring2019
73027ca16d1ea38fda492ef39aaf2eabe82cbe04
61348862e9a10f6282be76e0e457f5c48983a602
refs/heads/master
2020-05-18T15:58:34.339214
2019-07-15T02:10:54
2019-07-15T02:10:54
184,358,599
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
1,341
java
package day26_arrays04; import java.util.Arrays; public class Split { public static void main(String[] args) { String words = "java,kava,html,selenium"; String[] wordsArray = words.split(","); System.out.println("Count: " + wordsArray.length); System.out.println(Arrays.toString(wordsArray)); for (String word : wordsArray) { System.out.println(word); } String diceResult = "1 - 20 of 1,461 positions"; String[] diceArray = diceResult.split(" "); System.out.println("Position count: " + diceArray[4]); String[] diceArray2 = diceResult.split(" of "); System.out.println(diceArray2[0]); System.out.println(diceArray2[1]); String sentence = "I felt happy because I saw the others were happy and because I knew I should feel happy, but I wasn’t really happy."; String[] allWords = sentence.split(" "); String[] happySplit = sentence.split("happy"); String[] ISplit = sentence.split("I"); for (String word : allWords) { System.out.println(word); } for (String hap : happySplit) { System.out.print(hap); } System.out.println(); for (String I : ISplit) { System.out.print(I); } System.out.println(); String word = "ja*va"; // char[] charArray = word.toCharArray(); String[] charArray = word.split("a*v"); for (String ch : charArray) { System.out.println(ch); } } }
[ "ethemsoylemez@hotmail.com" ]
ethemsoylemez@hotmail.com
517bfc8678f835022b72692581d9c4488a6a6a41
38c9e1136559390cb47093393bf0e9acc05653a2
/src/org/geometerplus/android/fbreader/network/BookDownloader.java
9204bef018362838fd5334bf73d491ba7e3820a0
[]
no_license
gezhonglunta/FBReaderJ_2
7df7d0a604b68956eaea3a902af75b6889f2cc24
ceae178cb7c9c66f7e661681922d5b38096a74f0
refs/heads/master
2020-04-06T16:18:38.693924
2012-12-03T13:44:04
2012-12-03T13:44:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,593
java
/* * Copyright (C) 2009-2012 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package org.geometerplus.android.fbreader.network; import java.util.List; import android.os.Bundle; import android.app.Activity; import android.net.Uri; import android.content.Intent; import org.geometerplus.fbreader.network.urlInfo.BookUrlInfo; public class BookDownloader extends Activity { public static boolean acceptsUri(Uri uri) { final List<String> path = uri.getPathSegments(); if ((path == null) || path.isEmpty()) { return false; } final String scheme = uri.getScheme(); if ("epub".equals(scheme) || "book".equals(scheme)) { return true; } final String fileName = path.get(path.size() - 1).toLowerCase(); return fileName.endsWith(".fb2.zip") || fileName.endsWith(".fb2") || fileName.endsWith(".epub") || fileName.endsWith(".mobi") || fileName.endsWith(".prc"); } public void onCreate(Bundle icicle) { super.onCreate(icicle); Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this)); final Intent intent = getIntent(); Uri uri = intent.getData(); intent.setData(null); if (uri == null || !acceptsUri(uri)) { finish(); return; } if (!intent.hasExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY)) { intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALREADY_DOWNLOADING); } if ("epub".equals(uri.getScheme())) { uri = uri.buildUpon().scheme("http").build(); intent.putExtra(BookDownloaderService.BOOK_FORMAT_KEY, BookUrlInfo.Format.EPUB); } startService( new Intent(Intent.ACTION_DEFAULT, uri, this, BookDownloaderService.class) .putExtras(intent.getExtras()) ); finish(); } }
[ "leftright@live.com" ]
leftright@live.com
ada7a1a6e22aecbf4d841dc22cb4ed8a86fa0691
920b3d300bd6f66ee01888907d15fa0a3619ae49
/src/org/ffcc/communityVessells/app/connection/DB.java
669e27e19202e52208c00cb57f128319799a724b
[]
no_license
CommunityVessells/CommunityVessellsApp
f4ac828e0aa44f919d65c801ab9c5e91667da501
7316202a40cf00603ce5c9f65b74f8e9f6d702cb
refs/heads/master
2021-01-21T21:09:43.055364
2017-06-11T13:47:41
2017-06-11T13:47:41
92,302,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
/* * @author: FFCC - members */ package org.ffcc.communityVessells.app.connection; import java.sql.*; public class DB { private final String dbname = "ffcc"; private final String dbusername = "root"; private final String dbpassword = "@cdbcmp@)!&"; private Connection con = null; /** * Default Constructor */ public DB() { } public Connection getConnection() { return this.con; } public void open() throws SQLException { try { // dynamically load the driver's class file into memory Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception e) { throw new SQLException("MySQL Driver error: " + e.getMessage()); } try { // establish a connection with the database and creates a Connection // object (con) con = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + dbname + "?characterEncoding=utf8", dbusername, dbpassword); } catch (Exception e) { con = null; // throw SQLException if a database access error occurs throw new SQLException("Could not establish connection with the Database Server: " + e.getMessage()); } } // End of open public void close() throws SQLException { try { // if connection is open if (con != null) con.close(); // close the connection to the database to end database session } catch (Exception e) { throw new SQLException("Could not close connection with the Database Server: " + e.getMessage()); } }// end of close }
[ "dream.paths.projekt@gmail.com" ]
dream.paths.projekt@gmail.com
4c0b0767b1a62bc3c2afe0ae4e0cd17ab4a9a3b1
e986501c27fe59330f9407f828ee2f76fb146f42
/app/src/main/java/com/tramsun/shutterstock/utils/StorageManager.java
743286d499630f2dc045efeb3ba9889f19707bea
[]
no_license
fdbshh/Shutter-Gallery-Mvvm
36f4d7513eca1ccd07fdb64a69450678743d40ef
46e3fd4442c7dcc07c2021506f6e9f4d0a5d265f
refs/heads/master
2020-04-11T05:47:11.531248
2017-03-28T07:09:33
2017-03-28T07:09:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
646
java
package com.tramsun.shutterstock.utils; import android.content.Context; import android.graphics.Bitmap; import android.provider.MediaStore; import com.tramsun.shutterstock.dagger.qualifier.ApplicationContext; import javax.inject.Inject; import javax.inject.Singleton; @Singleton public class StorageManager { private Context context; @Inject public StorageManager(@ApplicationContext Context context) { this.context = context; } public String saveImage(Bitmap bitmap, String fileName, String description) { return MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, fileName, description); } }
[ "tushar.acharya@mutualmobile.com" ]
tushar.acharya@mutualmobile.com
7ce92c1efbc0c49cea737b2ee0820166a8174eca
8a465004173d02ec3199e55317c072e2cdf74139
/src/Algorithms/Mathmatics/GCD_and_LCM/GCD.java
569310426c1a80502a0c4c0529a6579c37dd376d
[]
no_license
ehabarman/Competitive-Programming-Tutorial
635b37645ab45ca6cbab8f80fe2d13549d2231a3
ad299a2d341a1398d0d07a8fffc83d79de0970b0
refs/heads/master
2020-03-28T04:15:05.095410
2019-01-27T08:03:51
2019-01-27T08:03:51
147,702,996
0
0
null
null
null
null
UTF-8
Java
false
false
6,423
java
package Algorithms.Mathmatics.GCD_and_LCM; import java.math.BigInteger; /** * @author ehab arman * @date 7-9-2018 */ public class GCD { private static final BigInteger TWO = new BigInteger("2"); public static final BigInteger RES = BigInteger.ONE; public static void main(String[] args){ } /** * calculate GCD using Euclidean algorithm * and return the result as long value */ public static long euclideanGCD(long a, long b) { return a == 0 ? b : euclideanGCD(b % a, a); } /** * * calculate GCD using Euclidean algorithm * and return the result as BigInteger * only suitable for huge numbers ( n > 10^30 ) * initial value of res is defined as static constant in class with name RES */ public static BigInteger binaryEuclideanGCD(BigInteger a, BigInteger b, BigInteger res){ int compare = a.compareTo(b); if ( compare == 0) return res.multiply(a); boolean first = a.mod(TWO).compareTo(BigInteger.ZERO)==0; boolean second = b.mod(TWO).compareTo(BigInteger.ZERO)==0; if ( first && second ) return binaryEuclideanGCD( a.divide(TWO),b.divide(TWO),res.multiply(TWO)); else if (first) return binaryEuclideanGCD(a.divide(TWO),b,res); else if (second) return binaryEuclideanGCD(a,b.divide(TWO),res); else if ( compare > 0) return binaryEuclideanGCD(a.subtract(b),b,res); else return binaryEuclideanGCD(a,b.subtract(a),res); } /** * calculate gcd of the array (arr[n]) using euclideanGCD n times * it returns result as long value */ public static long arrayGCD(long arr[]) { long result = arr[0]; for (int i = 1; i < arr.length; i++) result = euclideanGCD(arr[i], result); return result; } /** * this method is using to reduce large number in largeGCD to a small long number * can't used it out of this class */ private static long reduceB(long a, String b) { long result = 0; for (int i = 0; i < b.length(); i++) { result = (result * 10 + b.charAt(i) - '0') % a; } return result; } /** * this method return GCD(a,b) when b very large (10^12 <= b < 10^250) */ public static long largeGCD(long a, String b) { long num = reduceB(a, b); return euclideanGCD(num, a); } /** * this method is to calculate result of multiplying fractions n/d * input is the number fractions (N) * num[i]/den[i] = ith fraction * result printed on console within fucntion as n/d in it's simplest form */ public static void fractionsProductReduce(int n, long num[],long den[]){ int new_num = 1, new_den = 1; for (int i = 0; i < n; i++) { new_num *= num[i]; new_den *= den[i]; } long GCD = euclideanGCD(new_num, new_den); new_num /= GCD; new_den /= GCD; System.out.println(new_num + "/" +new_den); } /** * this method return minimum number of operations to make GCD of a given array equals one * * @param arr given array * @return return number of operations */ public static long minimumOpeationsForGCDToEqualOne(long arr[]) { long one = 0; int size = arr.length; for (int i = 0; i < size; i++) if (arr[i] == 1) one++; if (one != 0) return size - one; int minimum = Integer.MAX_VALUE; for (int i = 0; i < size; i++) { long g = arr[i]; for (int j = i + 1; j < size; j++) { g = euclideanGCD(arr[j], g); if (g == 1) { minimum = Math.min(minimum, j - i); break; } } } if (minimum == Integer.MAX_VALUE) return -1; else return size + minimum - 1; } /** * this method replace matrix elements with maxGCD of (GCD(col,row)) for each element */ public static void replaceMatrixElementsWithMaxGCD(long [][]mat, int row, int col) { long []rgcd = new long[row] ; long []cgcd = new long[col]; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { rgcd[i] = euclideanGCD(rgcd[i], mat[i][j]); cgcd[j] = euclideanGCD(cgcd[j], mat[i][j]); } } for (int i = 0; i < row; i++) for (int j = 0; j < col; j++) mat[i][j] = Math.max(rgcd[i], cgcd[j]); } /** * method return result of GCD between 2 numbers formed by repeating n x and y times * (ex:n,x,y = 12,2,3 -> GCD(1212,121212)) * @param n required number * @param x first repetitions * @param y second repetitions * @return return result as string */ public static String findGCDOfNRepeatitions(int n, long x, long y) { long g = euclideanGCD(x, y); String s =""; for (int i = 0; i < g; i++) s+=n; return s; } /** * This method counts number of pairs (A <= N, B <= N) such that gcd (A , B) is B * and return count number as result */ public static int countPairsWithGCDEqualsB(int n) { int k = n; int imin = 1; int ans = 0; while (imin <= n) { int imax = n / k; ans += k * (imax - imin + 1); imin = imax + 1; k = n / imin; } return ans; } /** * this method is given N and M * task is to find whether numbers 1 to N can be divided into two sets such that the absolute difference between the * sum of two sets is M and gcd of the sum of two sets is 1 * return true if splittable else false */ public static boolean isSplittable(int n, int m) { int totalSum = (n * (n + 1)) / 2; int sum1 = (totalSum + m) / 2; int sum2 = totalSum - sum1; if (totalSum < m) return false; if (sum1 + sum2 == totalSum && sum1 - sum2 == m) return (euclideanGCD(sum1, sum2) == 1); return false; } }
[ "ehabarman@gmail.com" ]
ehabarman@gmail.com
f9b39c0a93a4fec7f2a5d4cb2d58278ddd6b7613
ab5e9e00dfbb904b1f21da6c15bad3b99ad57c3f
/algorithm/src/main/java/chapter1/content/Stack.java
642298a18bcce3ea4971eb8887dd83a5a8216072
[]
no_license
GreenHand-zmy/misc
d4911e55f95dc97138c009fb7609e98b63240773
d6631c0947d0aa3ea422229a6cce3e7815b54fa4
refs/heads/master
2020-04-17T19:12:28.476331
2019-03-02T14:26:18
2019-03-02T14:26:18
166,858,107
0
0
null
null
null
null
UTF-8
Java
false
false
2,110
java
package chapter1.content; import java.util.Iterator; import java.util.NoSuchElementException; /** * 栈(ADT) * Created by ZMY on 2017/7/16. */ public class Stack<Item> implements Iterable<Item> { // 栈顶 private Node first; // 元素数量 private int N; // 链式结构 private class Node { Item item; Node next; } public void push(Item item) { // 向栈顶添加元素 Node oldFirst = first; first = new Node(); first.item = item; first.next = oldFirst; N++; } public Item pop() { if (isEmpty()) { throw new NoSuchElementException("stack underflow"); } // 弹出栈顶元素 Item item = first.item; first = first.next; N--; return item; } public Item peek() { // 返回最近加入的元素而不是弹出 if (isEmpty()) { throw new NoSuchElementException("stack underflow"); } return first.item; } public boolean isEmpty() { return N == 0; } public int size() { return N; } @Override public String toString() { StringBuilder s = new StringBuilder(); for (Item item : this) { s.append(item); s.append(" "); } return s.toString(); } @Override public Iterator<Item> iterator() { return new ListIterator(); } // 迭代器 private class ListIterator implements Iterator<Item> { // 保存首结点引用 private Node current = first; @Override public boolean hasNext() { return current != null; } @Override public Item next() { Item item = current.item; current = current.next; return item; } } public static void main(String[] args) { Stack<Integer> stack = new Stack<>(); stack.push(1); stack.push(2); stack.push(3); stack.push(4); System.out.println(stack); } }
[ "573093826@qq.com" ]
573093826@qq.com
c55fa373b2ed15b5b369553688196ed3d38a93b6
deb21aea8270e7cb96a0c738670fc0fa630be6e7
/app/src/main/java/com/example/samsung/ui/VideoActivity.java
6bc33c5a79f714fbf17914a4b00113d90e9fe739
[]
no_license
ali-ajam/smartglassUI
3df3954c6bf06993292bee90362b09e52cbda91f
a73c11e06f9ec9489d555f2d89532c4196366a84
refs/heads/master
2021-09-16T05:14:12.675705
2018-06-16T23:09:47
2018-06-16T23:09:47
137,615,919
1
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
package com.example.samsung.ui; import android.content.Intent; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import android.widget.VideoView; public class VideoActivity extends AppCompatActivity { public int video[]={R.raw.wildlife,R.raw.wildlife,0,R.raw.wildlife,0}; public int i; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button back = findViewById(R.id.Back); setContentView(R.layout.activity_video); Bundle extras = getIntent().getExtras(); i = extras.getInt("index"); Log.d("video","is "+i); VideoView videoView = findViewById(R.id.videoView); String uriPath = "android.resource://" + getPackageName()+ "/" + video[i]; if (video[i] == 0) {Toast.makeText(getApplicationContext(), "no video", Toast.LENGTH_SHORT).show();} else { Uri uri = Uri.parse(uriPath); videoView.setVideoURI(uri); videoView.requestFocus(); videoView.start(); } back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(VideoActivity.this,DetailsActivity.class); startActivity(intent); } }); } }
[ "aliajam992@gmail.com" ]
aliajam992@gmail.com
347802608b8e1be92417a06887659ab1584bc7a2
44d4c2f66e6894b7a8c0a80f5b0890976648b87a
/src/main/java/com/example/couse/config/TestConfig.java
e3c3cbd4c4a584786da1286e1dabd88e4e8b9631
[]
no_license
eltondornelas/course-springboot-2-java-11
c5c11390c08fb563d0a1d6f0fca7bdb1232b094c
88142777e5c11de894aa64881d854f211b9ce2a6
refs/heads/master
2020-07-27T19:14:37.162199
2019-09-18T21:37:36
2019-09-18T21:37:36
209,193,700
0
0
null
null
null
null
UTF-8
Java
false
false
3,953
java
package com.example.couse.config; import java.time.Instant; import java.util.Arrays; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import com.example.couse.entities.Category; import com.example.couse.entities.Order; import com.example.couse.entities.OrderItem; import com.example.couse.entities.Payment; import com.example.couse.entities.Product; import com.example.couse.entities.User; import com.example.couse.entities.enums.OrderStatus; import com.example.couse.repositories.CategoryRepository; import com.example.couse.repositories.OrderItemRepository; import com.example.couse.repositories.OrderRepository; import com.example.couse.repositories.ProductRepository; import com.example.couse.repositories.UserRepository; @Configuration @Profile("test") public class TestConfig implements CommandLineRunner { //fazendo o seeding //o nome do profile tem que ser igual ao que esta no application.properties @Autowired private UserRepository userRepository; //com o autowired o spring sabe da dependência e associa uma instancia ao userRepository automaticamente @Autowired private OrderRepository orderRepository; @Autowired private CategoryRepository categoryRepository; @Autowired private ProductRepository productRepository; @Autowired private OrderItemRepository orderItemRepository; @Override public void run(String... args) throws Exception { //tudo que colocar dentro desse método vai executar quando a aplicação for iniciada //seeding... Category cat1 = new Category(null, "Electronics"); Category cat2 = new Category(null, "Books"); Category cat3 = new Category(null, "Computers"); Product p1 = new Product(null, "The Lord of the Rings", "Lorem ipsum dolor sit amet, consectetur.", 90.5, ""); Product p2 = new Product(null, "Smart TV", "Nulla eu imperdiet purus. Maecenas ante.", 2190.0, ""); Product p3 = new Product(null, "Macbook Pro", "Nam eleifend maximus tortor, at mollis.", 1250.0, ""); Product p4 = new Product(null, "PC Gamer", "Donec aliquet odio ac rhoncus cursus.", 1200.0, ""); Product p5 = new Product(null, "Rails for Dummies", "Cras fringilla convallis sem vel faucibus.", 100.99, ""); categoryRepository.saveAll(Arrays.asList(cat1, cat2, cat3)); productRepository.saveAll(Arrays.asList(p1, p2, p3, p4, p5)); p1.getCategories().add(cat2); p2.getCategories().add(cat1); p2.getCategories().add(cat3); p3.getCategories().add(cat3); p4.getCategories().add(cat3); p5.getCategories().add(cat2); productRepository.saveAll(Arrays.asList(p1, p2, p3, p4, p5)); //com SQL seria diferente User u1 = new User(null, "Maria Brown", "maria@gmail.com", "988888888", "123456"); User u2 = new User(null, "Alex Green", "alex@gmail.com", "977777777", "123456"); //id nulo para deixar automático pelo banco de dados Order o1 = new Order(null, Instant.parse("2019-06-20T19:53:07Z"), OrderStatus.PAID, u1); //z é padrão UTC de GreenWich Order o2 = new Order(null, Instant.parse("2019-07-21T03:42:10Z"), OrderStatus.WAITING_PAYMENT, u2); Order o3 = new Order(null, Instant.parse("2019-07-22T15:21:22Z"), OrderStatus.WAITING_PAYMENT, u1); //no banco de dados o horário vai mostrar com -3 horas userRepository.saveAll(Arrays.asList(u1, u2)); orderRepository.saveAll(Arrays.asList(o1, o2, o3)); OrderItem oi1 = new OrderItem(o1, p1, 2, p1.getPrice()); OrderItem oi2 = new OrderItem(o1, p3, 1, p3.getPrice()); OrderItem oi3 = new OrderItem(o2, p3, 2, p3.getPrice()); OrderItem oi4 = new OrderItem(o3, p5, 2, p5.getPrice()); orderItemRepository.saveAll(Arrays.asList(oi1, oi2, oi3, oi4)); Payment pay1 = new Payment(null, Instant.parse("2019-06-20T21:53:07Z"), o1); o1.setPayment(pay1); orderRepository.save(o1); } }
[ "eltondornelas@gmail.com" ]
eltondornelas@gmail.com
6bedcad38d480433cab62675a08f42e619787dc6
a58349317043bb535e62d3f9ae08122bb4e912c8
/java/authorTool/src/org/gk/graphEditor/UndoableDeleteEdit.java
e871225ebd8b88c8fd4bce36fdb1135f60c818db
[]
no_license
reactome/Release
613fced90cd0526ac79367820f06b9c961e0b396
c775730e23281c4a8c20b45010380042f53581c7
refs/heads/master
2022-02-28T22:41:51.050769
2020-07-29T19:45:03
2020-07-29T19:45:03
19,089,212
6
8
null
2020-07-29T19:45:04
2014-04-23T23:36:09
PHP
UTF-8
Java
false
false
775
java
/* * Created on Aug 15, 2008 * */ package org.gk.graphEditor; import java.util.List; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import org.gk.render.Renderable; /** * This class is used to handle undo/redo related to deletion of objects. * @author wgm * */ public class UndoableDeleteEdit extends UndoableInsertDeleteEdit { public UndoableDeleteEdit(GraphEditorPane graphPane, List<Renderable> objects) { init(graphPane, objects); } @Override public void redo() throws CannotRedoException { super.redo(); delete(); } @Override public void undo() throws CannotUndoException { super.undo(); insert(); } }
[ "weiserj@default-ready.oicr.on.ca" ]
weiserj@default-ready.oicr.on.ca
54212de30a7a8b4a98397c6cfbb8f4fe11442eb6
a471d778f3d1dd0e5dd55fb502e802025719218b
/app/src/main/java/boots/com/fan/FifthActivity7ec1.java
b74aa7d6f4ec3614edf468438e42dff2d688bd70
[]
no_license
nithincp/KUSyllabus
41b377bd4462dfe23b8e7fe34fe9c707ad27ceb2
d1a68f7de16b7a3155714daf6c77e7f7337a71c8
refs/heads/master
2021-01-10T23:28:15.499981
2016-10-11T11:08:26
2016-10-11T11:08:26
70,584,385
0
0
null
null
null
null
UTF-8
Java
false
false
434
java
package boots.com.fan; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; /** * Created by nithinchandran on 28/9/16. */ public class FifthActivity7ec1 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setContentView(R.layout.fifth_activity7ec1); } }
[ "p.nithinc@gmail.com" ]
p.nithinc@gmail.com
2f68b36dff83fbb3cc136bdce8860c772db56413
4bb2dd97c277feaa7da5fbe08d3cdf979fef27d2
/MOCParkingApp/app/src/main/java/com/example/mocparkingapp/MapsActivity.java
ba40581c37dbce74f250d5ccc1642132fa908dda
[]
no_license
mtraino/Projects
5aec66678aea70701646fa631fa1de7e7fba09f9
acd4e52c7cf3f353cc749f2f48c83bbe8209bb46
refs/heads/master
2021-06-21T00:11:01.867485
2021-01-27T16:19:10
2021-01-27T16:19:10
168,620,227
1
0
null
null
null
null
UTF-8
Java
false
false
6,190
java
package com.example.mocparkingapp; import android.support.annotation.NonNull; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.util.List; import java.util.ArrayList; import java.util.Objects; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import android.content.Context; import android.graphics.Point; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.RelativeLayout; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, GoogleMap.OnMarkerClickListener, GoogleMap.InfoWindowAdapter{ private GoogleMap mMap; /** Called before anything */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); assert mapFragment != null; mapFragment.getMapAsync(this); } /** Called on map Ready */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Read data from CSV CSVFile csvFile = new CSVFile(getResources().openRawResource(R.raw.cords)); List<String[]> csvData = csvFile.read(); // Define aLists for pin data final Marker[] markers = new Marker[csvData.size()]; ArrayList<LatLng> cords = new ArrayList<>(); final ArrayList<String> names = new ArrayList<>(); // Add csv data to lists for(String[] d:csvData) { names.add(d[0]); cords.add(new LatLng(Double.parseDouble(d[1]), Double.parseDouble(d[2]))); } // Add pins off pin data list int n = 0; for(LatLng cord : cords){ String lot = names.get(n); markers[n] = mMap.addMarker(new MarkerOptions() .position(cord) .title(lot) .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin_icon_grey)) ); markers[n].setAnchor((float) 0.5,(float) .5); n++; } // Center Camera (Center cord needs changing!) LatLng camCenter = new LatLng(28.031472, -81.946042); mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(camCenter, 15.5f)); // Sets a listener for user tapping a marker mMap.setOnMarkerClickListener(this); // Database FirebaseDatabase database = FirebaseDatabase.getInstance(); final DatabaseReference ref = database.getReferenceFromUrl("https://mocparkingapp.firebaseio.com/"); ref.addValueEventListener(new ValueEventListener() { /** Called initially and on database change */ @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot child : dataSnapshot.getChildren()){ int index = names.indexOf((child.getKey()).replaceAll("_"," ")); Log.w(null, Integer.toString(index)); if(index == -1) continue; String value = "" + child.child("Spaces").getValue(); markers[index].setSnippet("Availability: " + value); if(Integer.parseInt(value) == 0){ markers[index].setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pin_icon_grey ));} else if(Integer.parseInt(value) < 3){ markers[index].setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pin_icon_red));} else if(Integer.parseInt(value) < 10){ markers[index].setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pin_icon_orange));} else{ markers[index].setIcon(BitmapDescriptorFactory.fromResource(R.drawable.pin_icon_green));} } } /** Called when database throws an error */ @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); // Info window hooplah] } /** Called when user clicks a marker */ @Override public boolean onMarkerClick(final Marker marker) { marker.showInfoWindow(); return false;// (from google) Return false to indicate that we have not consumed the event } /** Called 1st when info window is opened * * Changes how the info window looks */ @Override public View getInfoWindow(Marker marker) { // Use the default window layout return null; } /** Called 2nd when info window is opened * * Customizes the content of the window */ @Override public View getInfoContents(Marker marker) { View contentsView = getLayoutInflater().inflate(R.layout.custom_info_contents, null); TextView pinTitle = (contentsView.findViewById(R.id.title)); pinTitle.setText(marker.getTitle()); TextView tvSnippet = (contentsView.findViewById(R.id.snippet)); tvSnippet.setText(marker.getSnippet()); return contentsView; } }
[ "47132377+mtraino@users.noreply.github.com" ]
47132377+mtraino@users.noreply.github.com
ff88b405384da9611cfbfffc64022942d7f47802
9e8b8d5949a35c55cfac8ebe4c7b6fed043dc267
/cluster-manager/src/main/java/com/codeabovelab/dm/cluman/batch/CreateContainerTasklet.java
3022b293b277d79c1e94766b6fbb01ad567f0acd
[]
no_license
awsautomation/Docker-Orchestration-master
5fac7dc060a6021371c95e4a5e52fb4c42d605f3
0c1544f4d2f6ceb869661b2f75e9216f990025ae
refs/heads/master
2021-08-28T11:40:05.834148
2020-02-06T15:45:19
2020-02-06T15:45:19
238,753,850
1
0
null
null
null
null
UTF-8
Java
false
false
3,469
java
package com.codeabovelab.dm.cluman.batch; import com.codeabovelab.dm.cluman.model.CreateContainerArg; import com.codeabovelab.dm.cluman.cluster.docker.management.result.CreateAndStartContainerResult; import com.codeabovelab.dm.cluman.cluster.docker.management.result.ProcessEvent; import com.codeabovelab.dm.cluman.cluster.docker.management.result.ResultCode; import com.codeabovelab.dm.cluman.configs.container.DefaultParser; import com.codeabovelab.dm.cluman.job.JobComponent; import com.codeabovelab.dm.cluman.job.JobContext; import com.codeabovelab.dm.cluman.job.JobParam; import com.codeabovelab.dm.cluman.model.ContainerSource; import com.codeabovelab.dm.cluman.model.ImageName; import com.codeabovelab.dm.cluman.model.NodesGroup; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; import java.util.Map; import java.util.function.Consumer; /** * Processor which create containers */ @JobComponent @Slf4j public class CreateContainerTasklet { @Autowired private NodesGroup nodesGroup; @Autowired private JobContext context; @Autowired private RollbackData rollback; @Autowired private DefaultParser parser; @JobParam private Map<String, Object> containersConfigs; public ProcessedContainer execute(ProcessedContainer item) { ContainerSource cs = item.getSrc(); createEnrichConfiguration(cs, item.getImage()); cs.setName(item.getName()); cs.setNode(item.getNode()); cs.setCluster(item.getCluster()); Assert.notNull(cs.getCluster(), "Cluster is null in " + item); cs.setImage(item.getImage()); cs.setImageId(item.getImageId()); context.fire("Create container \"{0}\" with \"{1}\" image on \"{2}\" node", cs.getName(), cs.getImage(), cs.getNode()); CreateContainerArg arg = new CreateContainerArg() .enrichConfigs(true) // add to API .container(cs) .watcher(new MessageProxy()); CreateAndStartContainerResult res = nodesGroup.getContainers().createContainer(arg); item = item.makeCopy().id(res.getContainerId()).name(res.getName()).build(); rollback.record(item, RollbackData.Action.CREATE); ResultCode code = res.getCode(); if (code != ResultCode.OK && code != ResultCode.NOT_MODIFIED) { throw new RuntimeException("On create " + arg + ", we got: " + res.getCode() + " " + res.getMessage()); } return item; } @SuppressWarnings("unchecked") protected ContainerSource createEnrichConfiguration(ContainerSource arg, String image) { try { String registryAndImageName = ImageName.withoutTag(image); if (containersConfigs != null) { Object configs = containersConfigs.get(registryAndImageName); if (configs != null && configs instanceof Map) { Map<String, Object> configsMap = (Map<String, Object>) configs; parser.parse(configsMap, arg); } } } catch (Exception e) { log.error("error during enriching arg from config"); } return arg; } private class MessageProxy implements Consumer<ProcessEvent> { @Override public void accept(ProcessEvent processEvent) { context.fire(processEvent.getMessage()); } } }
[ "tech_fur@outlook.com" ]
tech_fur@outlook.com
e6b1a57b82c4521d447ec83351a207ec201bbe3f
f56ef2f06e92174c8dea5005fd6488d5daef6bd5
/src/main/java/edu/rice/dmodel/SupplierCustomerPartID.java
2518a0cbd0f91754789a5d9ac54b4b64e727bc34
[]
no_license
kiat/sparkTPCH
8c52a6b04490bc16e99cd3da3e76861d7aaf8416
4dce17fe7194902798fbf59b3e83af466a5d9ed7
refs/heads/master
2021-01-23T10:38:51.448135
2018-12-26T16:43:59
2018-12-26T16:43:59
93,082,223
0
0
null
null
null
null
UTF-8
Java
false
false
926
java
package edu.rice.dmodel; import java.io.Serializable; public class SupplierCustomerPartID implements Serializable { private static final long serialVersionUID = 4253185616069063274L; private String customerName; private String supplierName; private int partID; public SupplierCustomerPartID() { } public SupplierCustomerPartID(String customerName, String supplierName, int partID) { super(); this.customerName = customerName; this.supplierName = supplierName; this.partID = partID; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public String getSupplierName() { return supplierName; } public void setSupplierName(String supplierName) { this.supplierName = supplierName; } public int getPartID() { return partID; } public void setPartID(int partID) { this.partID = partID; } }
[ "kt17@39e9cc0c-7b0d-46aa-9a4e-e2e7fe7f4a60" ]
kt17@39e9cc0c-7b0d-46aa-9a4e-e2e7fe7f4a60
f794cef5b4501163c4db7b6d1005cf1f51c24de8
0ae92071e24aa95b52f0e8167175d2f7650c3299
/huayitonglib/src/main/java/com/palmap/huayitonglib/navi/astar/dto/FullMapDto.java
bc51d7bda2bbe63f9e0961ebbd4315e554456e30
[]
no_license
wuxianghua/HospitalModule
af792b70f386051d13018b4030e0a4877313f10b
92f307f20bd0c2b073c2747ecade7c5418206862
refs/heads/master
2021-09-01T10:19:23.393812
2017-12-26T12:25:28
2017-12-26T12:25:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,386
java
package com.palmap.huayitonglib.navi.astar.dto; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * Created by liupin on 2017/7/28. */ public class FullMapDto implements Serializable { private MapDto map; private RoadNetDto roadNet; private List<PlanarGraphDto> planarGraphs; private List<POIDto> pois; public MapDto getMap() { return map; } public void setMap(MapDto map) { this.map = map; } public RoadNetDto getRoadNet() { return roadNet; } public void setRoadNet(RoadNetDto roadNet) { this.roadNet = roadNet; } public List<PlanarGraphDto> getPlanarGraphs() { return planarGraphs; } public void setPlanarGraphs(List<PlanarGraphDto> planarGraphs) { this.planarGraphs = planarGraphs; } public List<POIDto> getPois() { return pois; } public void setPois(List<POIDto> pois) { this.pois = pois; } public FullMapDto addPOI(POIDto poi) { if (pois == null) { pois = new ArrayList<>(); } pois.add(poi); return this; } public FullMapDto addPlanarGraph(PlanarGraphDto planarGraph) { if (planarGraphs == null) { planarGraphs = new ArrayList<>(); } planarGraphs.add(planarGraph); return this; } }
[ "yibo.liu@palmapplus.com" ]
yibo.liu@palmapplus.com
22f24c02e866f94d341aba370cd30a164d1826a3
c53ee32324d283c5b652d0db764af1a298dd988d
/660.remove-9.113737791.ac.java
d61fb7c4dffcf89c114a1c884d7a4edb56f8e6db
[]
no_license
zhuolikevin/leetcode-java
f5f984e3db99359e2e5df621f1896dfd57030a93
712c93bade63829ca13bd88a4ef0600f3439be6d
refs/heads/master
2020-12-29T00:59:04.999430
2017-08-15T17:58:12
2017-08-15T17:58:12
94,374,971
3
0
null
null
null
null
UTF-8
Java
false
false
456
java
/* * [660] Remove 9 * * https://leetcode.com/problems/remove-9 * * Hard (43.59%) * Total Accepted: * Total Submissions: * Testcase Example: '10' * * Can you solve this problem? 🤔 */ public class Solution { public int newInteger(int n) { int res = 0; int base = 1; while (n > 0) { res += n % 9 * base; n /= 9; base *= 10; } return res; } }
[ "lizhuogo@gmail.com" ]
lizhuogo@gmail.com
1d3fcbe80524e0dc4e726d25be5395b9e5705fa4
69fa8760a001d0cec0058464a84f1045f6e63bc4
/src/main/java/ro/andramorutan/blog/model/Note.java
ce99047091392e9a51479d65576a149bdccb3693
[]
no_license
andramorutan/recipee
87e01778e9cf4dff25b778f3cf3d59932dfca9b1
76d342c9d1c94f176b8c529363e7ab763101171c
refs/heads/master
2021-05-21T04:58:09.122593
2020-04-25T15:19:22
2020-04-25T15:19:22
252,553,030
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
package ro.andramorutan.blog.model; import javax.persistence.*; @Entity @Table(name = "note") public class Note { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String description; public Note() { } public Note(String description) { this.description = description; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
[ "andra.morutan@gmail.com" ]
andra.morutan@gmail.com
0c34a0c0a3509d49e733269fc122963e279c7435
520b4414b7542fe01b51c410ada3be1cd541260d
/app/src/main/java/com/example/dell/task_3/MainActivity.java
acddc827eb71d8e1f8d17bdb4a44a9531b8f55fb
[]
no_license
wangying000/Task-3
ecab86c6eb99a13befa4ea98ec2054a1c8844ce4
717dc77e8e8af88847432ff7b4ff0db921dabb99
refs/heads/master
2020-04-18T18:14:44.636442
2016-09-04T07:40:19
2016-09-04T07:40:19
67,331,916
0
0
null
null
null
null
UTF-8
Java
false
false
2,540
java
package com.example.dell.task_3; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Editable; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import com.example.dell.task_3.R; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnone=(Button)findViewById(R.id.button); final EditText txtResult=(EditText) findViewById(R.id.editText); final EditText txt=(EditText) findViewById(R.id.editText2); btnone.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ txtResult.setText(""); } }); } public void onCheckboxClicked(View view){ boolean checked=((CheckBox) view).isChecked(); TextView textView=(TextView)findViewById(R.id.textView); switch(view.getId()){ case R.id.checkBox: if(checked){ Toast.makeText(this,"选择a",Toast.LENGTH_LONG).show(); }else{ Toast.makeText(this,"取消选择a",Toast.LENGTH_LONG).show();} break; case R.id.checkBox2: if(checked){ Toast.makeText(this,"选择b",Toast.LENGTH_LONG).show(); }else{ Toast.makeText(this,"取消选择b",Toast.LENGTH_LONG).show();} break; case R.id.checkBox3: if(checked){ Toast.makeText(this,"选择c",Toast.LENGTH_LONG).show(); }else{ Toast.makeText(this,"取消选择c",Toast.LENGTH_LONG).show();} break; } } public void onRadioButtonClicked(View view){ boolean checked=((RadioButton) view).isChecked(); TextView textView=(TextView)findViewById(R.id.textView3); switch (view.getId()){ case R.id.radioButton: if(checked) textView.setText("您的性别为男"); break; case R.id.radioButton2: if(checked) textView.setText("您的性别为女"); break; } } }
[ "1178922618@qq.com" ]
1178922618@qq.com
0a9303a77da132da63be2ebbea893521ce5790e7
17336b06c318cd4474d1f56d17fb8cceef66a5a7
/src/main/java/practice/algorithms/sorting/SelectionSort.java
5889c6556375db46032753e891fffe690ac0763c
[]
no_license
Sic4Parvis9Magna/ti_practice
982d2e19a1832bb6693d67a99cd94bbecd61fdac
fe478bc5432eb87d8cb1c4b42ab57798e5091b14
refs/heads/master
2020-03-21T13:58:31.807852
2018-08-23T22:51:06
2018-08-23T22:51:06
138,635,129
1
0
null
2018-08-23T22:51:07
2018-06-25T18:34:40
Java
UTF-8
Java
false
false
471
java
package practice.algorithms.sorting; import static practice.algorithms.sorting.SortUtil.swap; public final class SelectionSort { private SelectionSort(){} public static void sort(int[] array){ for(int i=0;i< array.length-1;i++){ int indexOfMin = i; for(int j = i+1; j < array.length; j++){ if(array[indexOfMin] > array[j]) indexOfMin = j; } swap(array,i,indexOfMin); } } }
[ "maksvyacheslavovich@gmail.com" ]
maksvyacheslavovich@gmail.com
918933994847b9e5d24a7cf60081505ee1da213b
af10e43252529568b7e83ee161165f52dc35bb0f
/services/user-server/src/main/java/com/bsd/user/server/model/vo/UserDetailVO.java
1b5eb3ae3d13ba4bd4b55e86085569b4987eaef9
[ "MIT" ]
permissive
footprintes/open-platform
e7bf80b41128b968846fa28d54d2b8a4b77c03d2
affac45dbac7aa03070eec31ca97c3ebf2dca03b
refs/heads/master
2022-04-10T17:31:03.201219
2020-04-03T04:58:28
2020-04-03T04:58:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
package com.bsd.user.server.model.vo; import lombok.Data; import java.util.Date; /** * @Author: linrongxin * @Date: 2019/8/22 17:39 */ @Data public class UserDetailVO { /** * 用户ID */ private Long userId; /** * 昵称 */ private String nickname; /** * 头像 */ private String avatar; /** * 邮箱 */ private String email; /** * 手机号 */ private String mobile; /** * 注册时间 */ private Date registerTime; /** * 0-跨境知道 1-卖家成长 3-人工录入 */ private Integer source; /** * 用户来源 */ private String sourceStr; /** * 性别 (0 保密 1男 2女) */ private Integer sex; /** * 最后登录时间 */ private Date lastLoginTime; }
[ "futustar@qq.com" ]
futustar@qq.com
84d29edef4517b9cb87f6d93984d292c10a38214
de9bc10716aa82cc4e6278000c04890ddc7e834a
/src/main/java/com/baizhi/cmfz/entity/Article.java
24dfff11e945bfa1163ed96adbb5261d170cfdd4
[]
no_license
mengTnT/cmfz
ba27fce68d70dda05ac7c37648ec3445c3d4215e
2fb8ba46a06e6e780aefe49ea33f41c5eb7bf6b7
refs/heads/master
2020-03-10T10:23:41.518985
2018-04-14T10:08:49
2018-04-14T10:13:53
129,331,894
0
0
null
null
null
null
UTF-8
Java
false
false
2,165
java
package com.baizhi.cmfz.entity; import com.fasterxml.jackson.annotation.JsonFormat; import java.util.Date; public class Article { private String articleId; private String articleName; private String articleImage; private String articleContent; private Guru guru; @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date articleDate; private int articleCount;//浏览次数 public String getArticleId() { return articleId; } public void setArticleId(String articleId) { this.articleId = articleId; } public String getArticleName() { return articleName; } public void setArticleName(String articleName) { this.articleName = articleName; } public String getArticleImage() { return articleImage; } public void setArticleImage(String articleImage) { this.articleImage = articleImage; } public String getArticleContent() { return articleContent; } public void setArticleContent(String articleContent) { this.articleContent = articleContent; } public Guru getGuru() { return guru; } public void setGuru(Guru guru) { this.guru = guru; } public Date getArticleDate() { return articleDate; } public void setArticleDate(Date articleDate) { this.articleDate = articleDate; } public int getArticleCount() { return articleCount; } public void setArticleCount(int articleCount) { this.articleCount = articleCount; } public Article(String articleId, String articleName, String articleImage, String articleContent, Guru guru, Date articleDate, int articleCount) { super(); this.articleId = articleId; this.articleName = articleName; this.articleImage = articleImage; this.articleContent = articleContent; this.guru = guru; this.articleDate = articleDate; this.articleCount = articleCount; } public Article() { super(); // TODO Auto-generated constructor stub } @Override public String toString() { return "Article [articleId=" + articleId + ", articleName=" + articleName + ", articleImage=" + articleImage + ", articleContent=" + articleContent + ", guru=" + guru + ", articleDate=" + articleDate + ", articleCount=" + articleCount + "]"; } }
[ "774161192@qq.com" ]
774161192@qq.com
2603311ecfdd07ecf2727712a8d9201e6d7d6c19
308fdb87abe189280f75af51db110e01db7cbfdd
/src/com/company/hash/ClassPresident.java
2f17c1530c3b5bc8aede80c65a474e784703d361
[]
no_license
BeomjunLee/Algorithm
87fac7e6c8fe227d3bb0bf49ac66434fac5a1a32
cc1d48a18dc79a0adbfac54e2a12f088301b86f7
refs/heads/master
2023-05-30T19:31:56.871038
2021-06-15T10:11:15
2021-06-15T10:11:15
337,609,879
1
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package com.company.hash; import java.util.*; public class ClassPresident { /** * 1. 학급 회장(해쉬) * 설명 * 학급 회장을 뽑는데 후보로 기호 A, B, C, D, E 후보가 등록을 했습니다. * 투표용지에는 반 학생들이 자기가 선택한 후보의 기호(알파벳)가 쓰여져 있으며 선생님은 그 기호를 발표하고 있습니다. * 선생님의 발표가 끝난 후 어떤 기호의 후보가 학급 회장이 되었는지 출력하는 프로그램을 작성하세요. * 반드시 한 명의 학급회장이 선출되도록 투표결과가 나왔다고 가정합니다. * * 입력 * 첫 줄에는 반 학생수 N(5<=N<=50)이 주어집니다. * 두 번째 줄에 N개의 투표용지에 쓰여져 있던 각 후보의 기호가 선생님이 발표한 순서대로 문자열로 입력됩니다. * * 출력 * 학급 회장으로 선택된 기호를 출력합니다. * * 예시 입력 1 * * 15 * BACBACCACCBDEDE * 예시 출력 1 * C */ public static char solution(int num, String vote) { char result = 0; char[] votes = vote.toCharArray(); int max = 0; Map<Character, Integer> map = new HashMap<>(); map.put('A', 0); map.put('B', 0); map.put('C', 0); map.put('D', 0); map.put('E', 0); for (int i = 0; i < num; i++) { if(map.containsKey(votes[i])) { Integer value = map.get(votes[i]); map.put(votes[i], ++value); if (value > max) { max = value; result = votes[i]; } } } return result; } public static char solution2(int num, String vote) { char result = 0; int max = 0; Map<Character, Integer> map = new HashMap<>(); for (char c : vote.toCharArray()) { map.put(c, map.getOrDefault(c, 0) + 1); } for (char key : map.keySet()) { if (map.get(key) > max) { max = map.get(key); result = key; } } return result; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); String vote = scan.next(); char result = solution(num, vote); System.out.println(result); } }
[ "qjawnswkd0717@gmail.com" ]
qjawnswkd0717@gmail.com
5baed6ee3ffc977340fe6bec6b74e9187a36f22a
54375e487705ab0baa1df0d1be7eb824c3671fee
/replit/FindSum.java
13e4e3d1b0d77d9d50e5630c439108928b5541d6
[]
no_license
maggan1968/JavaProgramming_B23
a7445cd55b4d30405d4f6c73f294dc4e106bef35
2f21c0753b40d3dd4fe591a5b99f6fd9f985c85f
refs/heads/master
2023-08-06T01:58:14.645811
2021-09-23T03:12:49
2021-09-23T03:12:49
388,500,839
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
import java.util.Scanner; public class FindSum { public static void main(String[] args) { Scanner input= new Scanner(System.in); int[] nums = {input.nextInt(),input.nextInt(),input.nextInt(),input.nextInt(),input.nextInt()}; } } /* Given an array num, calculate the sum of all numbers in the array and print out to the console. nums → [2, 1, 2, 3, 4]) → 12 nums → [2, 2, 0, 3, 5]) → 12 nums → [1, 3, 5, 7, 9]) → 25 */
[ "mkowalczyk42@gmail.com" ]
mkowalczyk42@gmail.com
0d4ca9c2395a1df118fa0411fbabe2224ae75e30
a9942145d34226e1cfb73e381dd5a9254c2df926
/UTD - Battle of the Brains (Spring) (2018-2019)/src/MixedFractions.java
85262e1f594b845d4b5d73d07527634fea90230b
[]
no_license
WissamAntoun/algorithm-competition-repo
bc39b4d319da3ececc044aed6bda2f0051f33aa8
4494821dfb667beb7bcd50f963894f1ee69c334d
refs/heads/master
2020-09-26T05:18:30.529556
2019-04-13T05:03:41
2019-04-13T05:03:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
33
java
public class MixedFractions { }
[ "arhamjsiddiqui@gmail.com" ]
arhamjsiddiqui@gmail.com
9939e174e904526f41054d505597e5576342ef2f
d2ac27d2156bd2fe71f3ac8b31c48df62b1ed824
/citytrash-TRUNK/src/main/java/es/udc/citytrash/controller/util/validadores/DocumentoNoDuplicadoImpl.java
5ac2866bbdeb4b666d6e13707d46ddb6e7e6ee91
[]
no_license
hmiacatracha/CityTrash
30b6eebb1db29cf9403d84d2a95480ea80480b85
ed604db10b1427fdd217069b617bef22ec029489
refs/heads/master
2022-01-30T06:35:20.093439
2019-06-03T22:30:49
2019-06-03T22:30:49
65,673,619
2
1
null
null
null
null
UTF-8
Java
false
false
1,153
java
package es.udc.citytrash.controller.util.validadores; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import es.udc.citytrash.controller.util.anotaciones.DocumentoNoDuplicado; import es.udc.citytrash.model.trabajadorService.TrabajadorService; import es.udc.citytrash.model.util.excepciones.InstanceNotFoundException; @Component public class DocumentoNoDuplicadoImpl implements ConstraintValidator<DocumentoNoDuplicado, String> { @Autowired TrabajadorService tservicio; final Logger logger = LoggerFactory.getLogger(DocumentoNoDuplicadoImpl.class); @Override public void initialize(DocumentoNoDuplicado documento) { } @Override public boolean isValid(String documento, ConstraintValidatorContext context) { try { tservicio.buscarTrabajadorDocumento(documento); logger.info("Dni duplicado"); return false; } catch (InstanceNotFoundException e) { logger.info("Dni no encontrado"); return true; } } }
[ "hmiacatracha@gmail.com" ]
hmiacatracha@gmail.com
3c3b40e18a27fca94120d1ca1d34a8c573402d5a
b82ac5000ef7c3515c55830229c7c545d88d219f
/part-02/src/test/java/se/netzon/jms/services/ApiServiceTests.java
f9edc5dcc12a8644f4db3d506a6c64b3859e64f6
[]
no_license
dev-sareno/java-spring-jms-artemis
81a2ae200f1b1f14556603119cd2ffec346dcb8a
dc64438fcd96b128b2ab5c463a70d5021a3784c6
refs/heads/master
2023-01-23T02:44:08.115152
2020-12-03T08:31:52
2020-12-03T08:31:52
312,161,803
0
0
null
null
null
null
UTF-8
Java
false
false
518
java
package se.netzon.jms.services; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.SpyBean; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; @SpringBootTest public class ApiServiceTests { @SpyBean ApiService apiService; @Test public void apiService_ShouldNotNull() { assertThat(apiService, is(notNullValue())); } // Service specific tests }
[ "eladio.sareno@netzontech.com" ]
eladio.sareno@netzontech.com
d8a3ae023e480a4eb029eb3ab388b1d5902f4896
e7754d5d2c54bcf1d753fcd5391c5df155e4bc86
/src/main/java/mavenproject/mavenjavaa/AppiumTest.java
e79411207ba0881b7e257c61a14fc1306ec8f55c
[]
no_license
Serenity2227/GitDemo
611eec19106b6a37aec36f79dfbc40133d7ab715
698832f16fdc4c9893b05ef42a322c4131a0f8f2
refs/heads/main
2023-05-12T14:30:46.844479
2021-06-06T14:23:00
2021-06-06T14:23:00
373,889,293
0
0
null
null
null
null
UTF-8
Java
false
false
240
java
package mavenproject.mavenjavaa; import org.testng.annotations.Test; public class AppiumTest { @Test public void nativeApp() { System.out.println("native app"); } @Test public void IOSApp() { System.out.println("IOS app"); } }
[ "serenity.serenity2227@gmail.com" ]
serenity.serenity2227@gmail.com
862281a90bbced91e7302e51d0447d643ee7c071
968238e6fe755e42dd82b4b0bb50e6b2f9079bd3
/CalculatorApp/src/Teacher.java
cabf0d5532f89e0fde41122f0ee3c5a36495d55d
[]
no_license
macrifat/JAVA-Programming
45adc073e9214461af327ff403e1ee0ad4a97bd7
226eaaf98c928d32407278b14709e6e84dd9c137
refs/heads/master
2021-05-18T19:31:51.345555
2020-12-28T16:57:40
2020-12-28T16:57:40
251,378,597
0
0
null
null
null
null
UTF-8
Java
false
false
71
java
public class Teacher { String name,gender; int mobileNumber; }
[ "you@example.com" ]
you@example.com
3b0c7c134b04b5876eb4cae2a672ecd0f696605e
3c61976bd24e27464d23943c3905d3992d0a7748
/backend/api/ulca-dataset-api/src/main/java/com/ulca/UlcaDatasetApiApplication.java
8a8dc1b729726ff8752ea32d23c5f5844e3526af
[ "MIT", "JSON", "CC-BY-4.0" ]
permissive
panyamred/ulca-1
50535fbcd4709f9becfbed8ee0e1b9ae0c01b612
aad4651ee551019363549b96b876f841583eef58
refs/heads/master
2023-08-07T08:27:20.941251
2021-09-01T08:18:28
2021-09-01T08:18:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.ulca; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @EnableScheduling public class UlcaDatasetApiApplication { public static void main(String[] args) { SpringApplication.run(UlcaDatasetApiApplication.class, args); } }
[ "saroj.kumarsingh@tarento.com" ]
saroj.kumarsingh@tarento.com
92eb38c02fcc25e461699c4cd2babc18f4317b14
e699d05061f2b2a870b68ed786adb72f54257049
/src/ResultReporting/RankedItem.java
e5abec2f94762e14d38ccaa9ac4555843e939bd1
[]
no_license
JHutter/CoDeVilles-UserRanking
72bf241e281e644b983c22f0a372538511b73a0d
8ee7e7fd8b4d52e9e266f9cb652da68ba0301a86
refs/heads/master
2021-01-20T18:40:19.212653
2017-02-17T00:24:39
2017-02-17T00:24:39
60,942,940
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
package ResultReporting; import ContainerClasses.TestItem; /** * This class models single test item at the end of a test. * CIS 234A Dougherty * Creation Date: 5/9/2016. * * @author Zack * @version 2016.5.9 */ public class RankedItem extends TestItem { private int win, loss, tie; //Begin Get functions /** * @return win The number of 'wins' an item has item */ public int getWin(){return win;} /** * @return loss The number of 'losses' an item has item */ public int getLoss(){return loss;} /** * @return tie The number of 'ties' an item has item */ public int getTie(){return tie;} //begin Set functions /** * @param newWin The new 'wins' for the item */ public void setWin (int newWin) { win = newWin; } /** * @param newLoss The new 'losses' for the item */ public void setLoss (int newLoss) { loss = newLoss; } /** * @param newTie The new 'wins' for the item */ public void setTie (int newTie) { tie = newTie; } //begin constructors /** * default constructor */ public RankedItem(){ super(); win = 0; loss = 0; tie = 0; } /** * constructor with full parameters * @param anItem The item to be ranked * @param newWin The 'wins' of the new ranked item * @param newLoss The 'losses' of the new ranked item * @param newTie The 'ties' of the new item */ public RankedItem(TestItem anItem, int newWin, int newLoss, int newTie){ super(); itemID = anItem.getItemID(); testID = anItem.getTestID(); itemText = anItem.getItemText(); win = newWin; loss = newLoss; tie = newTie; } }
[ "jinsook.lee@pcc.edu" ]
jinsook.lee@pcc.edu
76096c44c123770bf2d971afad9b68a8f37a216c
dec6bd85db1d028edbbd3bd18fe0ca628eda012e
/netbeans-projects/ExeMultiplicacaoMatrizOMP/src/MultiplicacaoMatriz/MultiplicacaoMatriz_jomp.java
3780a029b9c6731e14de7585ecddcbde069a2bf0
[]
no_license
MatheusGrenfell/java-projects
21b961697e2c0c6a79389c96b588e142c3f70634
93c7bfa2e4f73a232ffde2d38f30a27f2a816061
refs/heads/master
2022-12-29T12:55:00.014296
2020-10-16T00:54:30
2020-10-16T00:54:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,364
java
package MultiplicacaoMatriz; import jomp.runtime.OMP; public class MultiplicacaoMatriz_jomp { public static void main(String[] args) { int matriz[][] = new int[4][4]; int matrizResult[][] = new int[4][4]; matriz[0][0] = 55; matriz[0][1] = 15; matriz[0][2] = 546; matriz[0][3] = 56; matriz[1][0] = 54; matriz[1][1] = 13; matriz[1][2] = 23; matriz[1][3] = 10; matriz[2][0] = 49; matriz[2][1] = 57; matriz[2][2] = 102; matriz[2][3] = 25; matriz[3][0] = 23; matriz[3][1] = 45; matriz[3][2] = 24; matriz[3][3] = 15; System.out.println("Matriz original: "); for (int i = 0; i < matriz.length; i++) { System.out.print("["); for (int y = 0; y < matriz.length; y++) { System.out.printf("%3d ", matriz[i][y]); } System.out.println("]"); } System.out.println(); OMP.setNumThreads(4); // OMP PARALLEL BLOCK BEGINS { __omp_Class0 __omp_Object0 = new __omp_Class0(); // shared variables __omp_Object0.matrizResult = matrizResult; __omp_Object0.matriz = matriz; __omp_Object0.args = args; // firstprivate variables try { jomp.runtime.OMP.doParallel(__omp_Object0); } catch (Throwable __omp_exception) { System.err.println("OMP Warning: Illegal thread exception ignored!"); System.err.println(__omp_exception); } // reduction variables // shared variables matrizResult = __omp_Object0.matrizResult; matriz = __omp_Object0.matriz; args = __omp_Object0.args; } // OMP PARALLEL BLOCK ENDS System.out.println(); System.out.println("Matriz multiplicada por 4: "); for (int i = 0; i < matrizResult.length; i++) { System.out.print("["); for (int y = 0; y < matrizResult.length; y++) { System.out.printf("%4d ", matrizResult[i][y]); } System.out.println("]"); } } // OMP PARALLEL REGION INNER CLASS DEFINITION BEGINS private static class __omp_Class0 extends jomp.runtime.BusyTask { // shared variables int[][] matrizResult; int[][] matriz; String[] args; // firstprivate variables // variables to hold results of reduction public void go(int __omp_me) throws Throwable { // firstprivate variables + init // private variables int myid; // reduction variables, init to default // OMP USER CODE BEGINS { for (int i = 0; i < matriz.length; i++) { myid = OMP.getThreadNum(); matrizResult[myid][i] = matriz[myid][i] * 4; System.out.println("Elemento da linha: " + myid + " coluna: " + i); } } // OMP USER CODE ENDS // call reducer // output to _rd_ copy if (jomp.runtime.OMP.getThreadNum(__omp_me) == 0) { } } } // OMP PARALLEL REGION INNER CLASS DEFINITION ENDS }
[ "caiohobus@gmail.com" ]
caiohobus@gmail.com
19b58924a9d1b1a04486ae61bc0d6c4cbcc08031
1d43c3471359a12a03f3477819b7330ee8c11871
/Haspend/src/main/java/com/savva/haspend/MainActivity.java
4ef11ec918141b593f7e45286805487119c91cad
[]
no_license
Inhaste/Haspend
7a906d00edeeade05a8fcd59cd046ce11918d65e
2566ac7eb8158b997816ed2abbb2d889de0bf185
refs/heads/master
2021-01-19T19:33:19.599998
2014-02-04T16:27:28
2014-02-04T16:27:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
package com.savva.haspend; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
[ "savva.volobuev@firstlinesoftware.com" ]
savva.volobuev@firstlinesoftware.com
479aabb1d859bb7d7b323f20b2c66438b57fcfd4
da170f9fb77c1c5d4a7808e3aa994afc01a16e1a
/app/src/main/java/com/example/anil/bloggerapi/Pojo/PostList.java
180de1c2f130f2cc9d40d16a2168ddbbe8f61583
[]
no_license
anilghimire133/bloggerAPI
3497bea7474e120bcc3fed3061de95f19bcf1e95
7a405ab25677417a25058f7a15e6bb1c04043d0b
refs/heads/master
2021-04-27T15:16:13.904866
2018-02-22T10:57:26
2018-02-22T10:57:26
122,466,085
0
0
null
null
null
null
UTF-8
Java
false
false
802
java
package com.example.anil.bloggerapi.Pojo; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class PostList { @SerializedName("kind") @Expose private String kind; @SerializedName("items") @Expose private List<Item> items = null; @SerializedName("etag") @Expose private String etag; public String getKind() { return kind; } public void setKind(String kind) { this.kind = kind; } public List<Item> getItems() { return items; } public void setItems(List<Item> items) { this.items = items; } public String getEtag() { return etag; } public void setEtag(String etag) { this.etag = etag; } }
[ "anilghimire133@gmail.com" ]
anilghimire133@gmail.com
85e90a9fffe4fec381ca8235446a4cce8cf79e3a
5f3dedaa577a76c1a5d471564dd4b74df58b993e
/date_7_29/src/com/fd/question04/Demo.java
986bf68a72e36e7d12bb40e2d0b831d30c2c4a61
[]
no_license
Reoru/qf-homwork
dd962b7f0e0c0f200af154ac8aa67742dee8371e
05fde04a94b96ce18eaa349b70748f0d078a6b05
refs/heads/master
2022-12-17T23:05:06.030665
2020-09-04T03:14:48
2020-09-04T03:14:48
292,736,784
0
0
null
null
null
null
UTF-8
Java
false
false
1,756
java
package com.fd.question04; import java.io.*; /** * @author RRReoru * @version 1.0 * @date 2020/7/29 0029 下午 20:06 */ public class Demo { public static void main(String[] args) throws IOException { int count = 1; int curr = 0; String root = "D:\\temp\\t1.txt"; File file = new File(root); long length = file.length(); // 分割临界点 long temp = length / 5; System.out.println(temp); FileOutputStream fos = null; FileInputStream fis = null; try { fis = new FileInputStream(file); File tempFile = new File(root.substring(0, root.lastIndexOf(".")) + count + root.substring(root.lastIndexOf("."))); int temps; fos = new FileOutputStream(tempFile); while ((temps = fis.read()) != -1) { fos.write(temps); if (curr % temp == 0) { fos = new FileOutputStream(new File(root.substring(0, root.lastIndexOf(".")) + count + root.substring(root.lastIndexOf(".")))); count++; fos.close(); } curr++; } fos.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (fis != null) { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } System.out.println("成功"); } }
[ "2160049510@qq.com" ]
2160049510@qq.com
784d25f88f39a8d4285487244524d2e9eb5f7924
99cc192d52083c7b0c8e6ffea0fa12f2bf3a7e39
/src/main/java/org/bouche/training/sample/accounts/model/BankChargeOperation.java
ad4c39b8f7f612953ff2ac061c27f8e2ed88c70b
[ "Apache-2.0" ]
permissive
eisti-sib/accounts
500bdb60f7c6df642470f88975c8ee28fe1f2414
c97525c5fe729c9eebb239c2a4eb3d036f4ed463
refs/heads/master
2020-07-19T07:09:56.786179
2019-09-18T13:54:28
2019-09-18T13:54:28
206,398,307
0
1
null
null
null
null
UTF-8
Java
false
false
931
java
package org.bouche.training.sample.accounts.model; import java.math.BigDecimal; import java.util.Date; public class BankChargeOperation implements IOperation { private String label; private BigDecimal amount; private Date operationDate; private OperationStatusEnum status; public BankChargeOperation(BigDecimal amount, Date operationDate, String label) { super(); this.label = label; this.amount = amount; this.operationDate = operationDate; this.status = OperationStatusEnum.PENDING; } @Override public String getLabel() { return label; } @Override public OperationTypeEnum getOperationType() { return OperationTypeEnum.TRANSFER; } @Override public BigDecimal getAmount() { return amount; } @Override public Date getOperationDate() { return operationDate; } @Override public OperationStatusEnum getStatus() { return status; } }
[ "fabian.bouche@gmail.com" ]
fabian.bouche@gmail.com
48ed9e8e9137a66e6b9a51bc41003f3d5fc96570
06e23a094fde2ef62a1b635f5a9c6963be6fb1a4
/src/main/java/com/cicc/onedata/common/CommonResponse.java
6cf2ce7ee822d806277a37a878a4b8d8d2982f49
[ "Apache-2.0" ]
permissive
zhuimengrenweijian/dream-api
fcaf5af7d2cf886522158fae46bedc468f32c102
4ad5f6f6295a4165fbb4baa5b3d926c02fb3520a
refs/heads/main
2023-06-28T08:34:17.424343
2021-08-02T16:58:52
2021-08-02T16:58:52
389,100,556
0
0
null
null
null
null
UTF-8
Java
false
false
520
java
package com.cicc.onedata.common; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; @Data @JsonInclude(JsonInclude.Include.NON_NULL) public class CommonResponse implements Serializable { private String code; private Object data; private String message; public CommonResponse() { } public CommonResponse(String code, Object data, String message) { this.code = code; this.data = data; this.message = message; } }
[ "15763949962@163.com" ]
15763949962@163.com
d226d09fd940be9feffefeb51878edea68c2b17b
42a30434ea86cb7a1e19503a9f4e1c199f1d84d2
/src/main/java/com/lucifiere/coderplus/model/Model.java
9fb9c5f3854dfb122fee91c155e015ce0864ffef
[]
no_license
lucifiere/coder-plus-admin
915814da2f395e341a5d3e6d16ba2c79d8ffeb58
26546f3257e9e51757672b968756e0aa0cd70790
refs/heads/main
2023-04-03T01:28:12.794304
2021-04-12T09:54:54
2021-04-12T09:54:54
335,828,971
0
0
null
null
null
null
UTF-8
Java
false
false
3,040
java
package com.lucifiere.coderplus.model; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import com.lucifiere.coderplus.model.enums.ModelBuiltInAttr; import com.lucifiere.coderplus.model.meta.Field; import com.lucifiere.coderplus.utils.CodeStyle; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import static com.lucifiere.coderplus.model.enums.ModelBuiltInAttr.*; import static com.lucifiere.coderplus.utils.CodeStyle.ofUlCode; /** * 业务数据的表示模型 * <p> * Created By @author XD.Wang * Date:2020-24 */ public class Model { protected String keyword; protected LinkedHashMap<String, Object> attrs = Maps.newLinkedHashMap(); public Model() { } public void merge(Model model1) { attrs.putAll(model1.attrs); } public Model addAttr(String attrName, Object attrVal) { Preconditions.checkNotNull(attrName, "自定义属性的键不能为空!"); Preconditions.checkNotNull(attrVal, "自定义属性的值不能为空!"); Preconditions.checkArgument(!ModelBuiltInAttr.contain(attrName), "不能使用内建属性名称!"); attrs.put(attrName, attrVal); return this; } protected Map<String, Object> createFiledMap(Field f) { if (f != null) { Map<String, Object> fieldsAttrs = Maps.newHashMap(); fieldsAttrs.put(FIELD_CAMEL_NAME.key(), ofUlCode(f.getName()).toStyle(CodeStyle.NamedStyle.CAMEL).toString()); fieldsAttrs.put(FIELD_CAPTAl_FIRST_NAME.key(), f.getCfName()); fieldsAttrs.put(FIELD_DESC.key(), Optional.ofNullable(f.getComment()).orElse("")); fieldsAttrs.put(FIELD_J_TYPE.key(), f.getType().getJavaType()); fieldsAttrs.put(FIELD_J_STANDARD_TYPE.key(), f.getType().getStandardJavaType()); fieldsAttrs.put(FIELD_JDBC_TYPE.key(), f.getType().getJdbcType()); fieldsAttrs.put(FIELD_UNDERLINE_NAME.key(), ofUlCode(f.getName()).toString()); return fieldsAttrs; } return null; } public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public Map<String, Object> getAttrs() { return attrs; } public Model addBuiltInAttr(String attrName, Object attrVal) { attrs.put(attrName, attrVal); return this; } private static <T> T get(Map<?, ?> map, Object key, Class<T> type) { return null == map ? null : Convert.convert(type, map.get(key)); } public String getStrAttr(String attrName) { return get(attrs, attrName, String.class); } public Map<String, Object> toAttrMap() { Map<String, Object> foldAttrs = Maps.newLinkedHashMap(); foldAttrs.putAll(attrs); return foldAttrs; } public boolean isEmpty() { return StrUtil.isBlank(keyword); } }
[ "wangxiandui@meituan.com" ]
wangxiandui@meituan.com
72f8b65f485200be6466b6dad5226bb65b618c5e
0304f4f251a768d96fda467ecb6e90ca6a470cd5
/Wallet/src/com/cts/elt/io/CopyFile.java
c6386732c1b06dd5825d166ba57ed7d9e62d181c
[]
no_license
zjledming/Wallet
66b98f747cb8af95f14ef9c48838941010547902
32a7d7cd8a4c1330ed70f78b4c74ff843d2cd58b
refs/heads/master
2016-09-06T02:21:37.640571
2014-10-26T13:43:28
2014-10-26T13:43:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
package com.cts.elt.io; import java.io.*; public class CopyFile { public void copy(String src, String des) { File srcFile = new File(src); File desFile = new File(des); InputStream in = null; OutputStream out = null; try { in = new FileInputStream(srcFile); out = new FileOutputStream(desFile); byte[] b = new byte[(int) srcFile.length()]; for (int i = 0; i < b.length; i++) { b[i] = (byte) in.read(); } out.write(b); // for (int i = 0; i < b.length; i++) { // out.write(b[i]); // } System.out.println("copied [" + srcFile.getName() + "] with " + srcFile.length()); } catch (Exception e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); out = null; } } catch (Exception e) { } try { if (in != null) { in.close(); in = null; } } catch (Exception e) { } } } public static void main(String[] args) { CopyFile cp = new CopyFile(); String src = "D:" + File.separator + "UltraEdit.zip"; String des = "D:" + File.separator + "UltraEdit_Copy.zip"; long sTime = System.currentTimeMillis(); cp.copy(src, des); long eTime = System.currentTimeMillis(); System.out.println("Total spend: " + (eTime - sTime)); } }
[ "zjledming@sina.com" ]
zjledming@sina.com
c7b8fa1eb116c34c3bd64c0e1fb7b6f27d891eb0
9c9b43d34f613654a3add0ec8dbb5787c5fa147a
/app/src/main/java/com/example/samuel/blijdorp/MapsActivity.java
5754f18156502809170fc6b3c2a34debcd9544f6
[]
no_license
Samsabal/Blijdorp
7c8d03236e5ab8c31995f21dcf4ac940c11cca47
47225c9a6187a414282f218d61af9dd41b05faaa
refs/heads/master
2020-04-16T14:21:24.048458
2019-01-16T10:46:57
2019-01-16T10:46:57
165,663,773
0
0
null
null
null
null
UTF-8
Java
false
false
8,925
java
package com.example.samuel.blijdorp; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.support.v4.app.ActivityCompat; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.Polyline; import com.google.android.gms.maps.model.PolylineOptions; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; int route = getIntent().getIntExtra("ROUTE", 0); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED || ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { this.requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, 99); } if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) { mMap.setMyLocationEnabled(true); } LatLng ingang = new LatLng(51.928121, 4.444192); LatLng zeeleeuw = new LatLng(51.928617, 4.444528); LatLng ijsbeer = new LatLng(51.927691, 4.445150); LatLng vlinders = new LatLng(51.928511, 4.447350); LatLng leeuwen = new LatLng(51.928423,4.450090); LatLng olifant = new LatLng(51.928391, 4.451794); LatLng tijger = new LatLng(51.927190, 4.451310); LatLng gorilla = new LatLng(51.925592, 4.451792); LatLng r1 = new LatLng(51.928020, 4.444452); LatLng r2 = new LatLng(51.927996, 4.446437); LatLng r3 = new LatLng(51.927938, 4.451841); LatLng r4 = new LatLng(51.927389, 4.451841); LatLng r5 = new LatLng(51.926942, 4.450709); LatLng r6 = new LatLng(51.925959, 4.451020); switch (route) { case 1: mMap.addMarker(new MarkerOptions().position(ingang).title("Ingang")); mMap.addMarker(new MarkerOptions().position(zeeleeuw).title("Zeeleeuw").snippet("Voedertijd: 10:00")); mMap.addMarker(new MarkerOptions().position(ijsbeer).title("Ijsbeer").snippet("Voedertijd: 11:00")); mMap.addMarker(new MarkerOptions().position(vlinders).title("Vlinders").snippet("Voedertijd: 11:30")); mMap.addMarker(new MarkerOptions().position(leeuwen).title("Aziatische leeuw").snippet("Voedertijd: 12:00")); mMap.addMarker(new MarkerOptions().position(olifant).title("Aziatische olifant").snippet("Voedertijd: 13:00")); mMap.addMarker(new MarkerOptions().position(tijger).title("Sumatraanse tijger").snippet("Voedertijd: 14:00")); mMap.addMarker(new MarkerOptions().position(gorilla).title("Westelijke laagland gorilla").snippet("Voedertijd: 15:00")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ingang, 15f)); mMap.addPolyline( new PolylineOptions() .add(ingang) .add(r1) .add(zeeleeuw) .add(r1) .add(ijsbeer) .add(r2) .add(vlinders) .add(leeuwen) .add(olifant) .add(r3) .add(r4) .add(tijger) .add(r5) .add(r6) .add(gorilla) ); break; case 2: mMap.addMarker(new MarkerOptions().position(ingang).title("Ingang")); mMap.addMarker(new MarkerOptions().position(zeeleeuw).title("Zeeleeuw").snippet("Voedertijd: 10:00")); mMap.addMarker(new MarkerOptions().position(ijsbeer).title("Ijsbeer").snippet("Voedertijd: 11:00")); mMap.addMarker(new MarkerOptions().position(vlinders).title("Vlinders").snippet("Voedertijd: 11:30")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ingang, 15f)); mMap.addPolyline( new PolylineOptions() .add(ingang) .add(r1) .add(zeeleeuw) .add(r1) .add(ijsbeer) .add(r2) .add(vlinders) ); break; case 3: mMap.addMarker(new MarkerOptions().position(ingang).title("Ingang")); mMap.addMarker(new MarkerOptions().position(leeuwen).title("Aziatische leeuw").snippet("Voedertijd: 12:00")); mMap.addMarker(new MarkerOptions().position(olifant).title("Aziatische olifant").snippet("Voedertijd: 13:00")); mMap.addMarker(new MarkerOptions().position(tijger).title("Sumatraanse tijger").snippet("Voedertijd: 14:00")); mMap.addMarker(new MarkerOptions().position(gorilla).title("Westelijke laagland gorilla").snippet("Voedertijd: 15:00")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ingang, 15f)); mMap.addPolyline( new PolylineOptions() .add(ingang) .add(r1) .add(ijsbeer) .add(r2) .add(vlinders) .add(leeuwen) .add(olifant) .add(r3) .add(r4) .add(tijger) .add(r5) .add(r6) .add(gorilla) ); break; default: mMap.addMarker(new MarkerOptions().position(ingang).title("Ingang")); mMap.addMarker(new MarkerOptions().position(zeeleeuw).title("Zeeleeuw").snippet("Voedertijd: 10:00")); mMap.addMarker(new MarkerOptions().position(ijsbeer).title("Ijsbeer").snippet("Voedertijd: 11:00")); mMap.addMarker(new MarkerOptions().position(vlinders).title("Vlinders").snippet("Voedertijd: 11:30")); mMap.addMarker(new MarkerOptions().position(leeuwen).title("Aziatische leeuw").snippet("Voedertijd: 12:00")); mMap.addMarker(new MarkerOptions().position(olifant).title("Aziatische olifant").snippet("Voedertijd: 13:00")); mMap.addMarker(new MarkerOptions().position(tijger).title("Sumatraanse tijger").snippet("Voedertijd: 14:00")); mMap.addMarker(new MarkerOptions().position(gorilla).title("Westelijke laagland gorilla").snippet("Voedertijd: 15:00")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ingang, 15f)); } } public void startRouteActivity2 (View view) { Intent intent = new Intent(this, RouteActivity.class); startActivity(intent); } }
[ "samuel.spek@gmail.com" ]
samuel.spek@gmail.com
56dd5f2d4df96895881f3d28a49a9f7525a2e61c
419e0607d4bb1ff298faca921447ee4b35e5b894
/server/src/main/java/io/crate/exceptions/InvalidArgumentException.java
9fe277a415274c2fb0cc6fced38c0ff158c77a34
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
crate/crate
7af793e2f709b77a5addc617d6e9dbba452d4e68
8acb044a7cdbab048b045854d0466fccc2492550
refs/heads/master
2023-08-31T07:17:42.891453
2023-08-30T15:09:09
2023-08-30T17:13:14
9,342,529
3,540
639
Apache-2.0
2023-09-14T21:00:43
2013-04-10T09:17:16
Java
UTF-8
Java
false
false
1,621
java
/* * Licensed to Crate.io GmbH ("Crate") under one or more contributor * license agreements. See the NOTICE file distributed with this work for * additional information regarding copyright ownership. Crate 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. * * However, if you have executed another commercial license agreement * with Crate these terms will supersede the license and you may use the * software solely pursuant to the terms of the relevant commercial agreement. */ package io.crate.exceptions; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.io.stream.StreamInput; import java.io.IOException; public class InvalidArgumentException extends ElasticsearchException implements CrateException { public InvalidArgumentException(String message) { super(message); } public <C, R> R accept(CrateExceptionVisitor<C, R> exceptionVisitor, C context) { return exceptionVisitor.visitCrateException(this, context); } public InvalidArgumentException(StreamInput in) throws IOException { super(in); } }
[ "37929162+mergify[bot]@users.noreply.github.com" ]
37929162+mergify[bot]@users.noreply.github.com
8375e5504f4e5edd245dfa720770b8b0b158c7cb
0cb6aba83670158f646a37bfb386217217b7dd98
/src/main/java/com/mensgratiae/backend/dto/AddOrUpdateResearchOutput.java
a4bccde58d1244365336a9e29b2a32c3ce263946
[]
no_license
rockthemicro/mens-gratiae-backend
f83b2850ba842caedb7eb1765f371057d270cb89
504ed4a089ea979c20706ca83063bcdffe2dbaac
refs/heads/development
2023-04-01T21:16:28.356317
2021-01-17T21:29:06
2021-01-17T21:29:06
263,999,523
0
0
null
2021-01-17T21:29:07
2020-05-14T18:54:29
Java
UTF-8
Java
false
false
263
java
package com.mensgratiae.backend.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class AddOrUpdateResearchOutput extends BasicOutput { private long researchId; }
[ "alex_sontica@yahoo.com" ]
alex_sontica@yahoo.com