blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cbb74cb92a5d1bae01db96cb60f859015cf69198 | 9622dbee9386428b7c08aeae10c40d4228ad14ce | /src/main/java/com/allen/moments/v2/model/Comment.java | c5fb511577a8de00a35e24f607aefd09b892387f | [] | no_license | Wuxiaonai/moments_v2_backend | b9bc84c2a21fbaa762b5237da8e0b722cb04502d | 68153f76861257dbdcace0189b530e21209eef16 | refs/heads/master | 2023-05-14T13:02:52.241401 | 2021-06-08T10:23:28 | 2021-06-08T10:23:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,147 | java | package com.allen.moments.v2.model;
public class Comment {
private Integer commentId;
private Integer postid;
private String comment;
private Integer commentedby;
public Integer getCommentId() {
return commentId;
}
public void setCommentId(Integer commentId) {
this.commentId = commentId;
}
public Integer getPostid() {
return postid;
}
public void setPostid(Integer postid) {
this.postid = postid;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment == null ? null : comment.trim();
}
public Integer getCommentedby() {
return commentedby;
}
public void setCommentedby(Integer commentedby) {
this.commentedby = commentedby;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
Comment other = (Comment) that;
return (this.getCommentId() == null ? other.getCommentId() == null : this.getCommentId().equals(other.getCommentId()))
&& (this.getPostid() == null ? other.getPostid() == null : this.getPostid().equals(other.getPostid()))
&& (this.getComment() == null ? other.getComment() == null : this.getComment().equals(other.getComment()))
&& (this.getCommentedby() == null ? other.getCommentedby() == null : this.getCommentedby().equals(other.getCommentedby()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getCommentId() == null) ? 0 : getCommentId().hashCode());
result = prime * result + ((getPostid() == null) ? 0 : getPostid().hashCode());
result = prime * result + ((getComment() == null) ? 0 : getComment().hashCode());
result = prime * result + ((getCommentedby() == null) ? 0 : getCommentedby().hashCode());
return result;
}
} | [
"sunhaiming.allen@bytedance.com"
] | sunhaiming.allen@bytedance.com |
0b32e2b07e7626ba2e62ec34965b038d72fab168 | 8c16a2bd19da3aa516e5ffe76dc5cbc032815d29 | /src/test/src/co/tophe/oembed/fallback/OEmbedOohembedTest.java | cc4c095606c54360229e99a4b9e0b2161588a52e | [
"Apache-2.0"
] | permissive | levelup/Android-oEmbed | 3b8f1c7965e68c9088df1cf473dc6e30faf43438 | 56889cb68ca0ec466e224e0ca010939eee714729 | refs/heads/master | 2021-01-22T18:18:38.182382 | 2015-02-24T06:37:34 | 2015-02-24T06:37:34 | 20,097,034 | 14 | 3 | null | null | null | null | UTF-8 | Java | false | false | 569 | java | package co.tophe.oembed.fallback;
import android.test.AndroidTestCase;
public class OEmbedOohembedTest extends AndroidTestCase {
private void testOEmbedThumbnail(String url) throws Exception {
OEmbedOohembed dataSource = new OEmbedOohembed(url);
assertNotNull(dataSource);
String thumbnail = dataSource.getThumbnail();
assertNotNull(thumbnail);
}
public void testAndroidCentral() throws Exception {
testOEmbedThumbnail("http://www.androidcentral.com/ac-editors-apps-week-hacked-lux-ticket-ride-and-more");
}
} | [
"robux4@gmail.com"
] | robux4@gmail.com |
3f6cca13c1eb8f2b7c4b2ecebfc02952851e9db5 | 8c647600c5f43878e9396efa56aecb22da001c4d | /simplified-tests/src/main/java/org/nypl/simplified/tests/opds/OPDSFeedEntryParserContract.java | df149a15c5ee9d448cac9aae18201c60637473ea | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause"
] | permissive | jonathangreen/Simplified-Android-Core | e6df5f3a0a4c92a11811704bb0f07d757677c5a1 | 34a6fda48570a75372723b71acd36130570e1bcb | refs/heads/master | 2022-12-11T02:54:58.447914 | 2020-07-21T16:11:28 | 2020-07-21T16:11:28 | 292,624,474 | 0 | 0 | NOASSERTION | 2020-09-03T16:35:13 | 2020-09-03T16:35:12 | null | UTF-8 | Java | false | false | 24,263 | java | package org.nypl.simplified.tests.opds;
import com.io7m.jfunctional.Option;
import com.io7m.jfunctional.OptionType;
import com.io7m.jfunctional.Some;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.junit.Assert;
import org.junit.Test;
import org.nypl.simplified.books.book_database.api.BookFormats;
import org.nypl.simplified.opds.core.DRMLicensor;
import org.nypl.simplified.opds.core.OPDSAcquisition;
import org.nypl.simplified.opds.core.OPDSAcquisitionFeedEntry;
import org.nypl.simplified.opds.core.OPDSAcquisitionFeedEntryParser;
import org.nypl.simplified.opds.core.OPDSAcquisitionFeedEntryParserType;
import org.nypl.simplified.opds.core.OPDSAvailabilityHeld;
import org.nypl.simplified.opds.core.OPDSAvailabilityHeldReady;
import org.nypl.simplified.opds.core.OPDSAvailabilityHoldable;
import org.nypl.simplified.opds.core.OPDSAvailabilityLoanable;
import org.nypl.simplified.opds.core.OPDSAvailabilityLoaned;
import org.nypl.simplified.opds.core.OPDSAvailabilityOpenAccess;
import org.nypl.simplified.opds.core.OPDSAvailabilityType;
import org.nypl.simplified.opds.core.OPDSIndirectAcquisition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.Set;
import one.irradia.mime.api.MIMEType;
import one.irradia.mime.vanilla.MIMEParser;
/**
* Entry parser contract.
*/
public abstract class OPDSFeedEntryParserContract {
private static Logger LOG =
LoggerFactory.getLogger(OPDSFeedEntryParserContract.class);
private static InputStream getResource(
final String name)
throws Exception {
final String path = "/org/nypl/simplified/tests/opds/" + name;
final URL url = OPDSFeedEntryParserContract.class.getResource(path);
if (url == null) {
throw new FileNotFoundException(path);
}
return url.openStream();
}
@Test
public void testEntryAvailabilityLoanable()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-loanable.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OPDSAvailabilityLoanable expected = OPDSAvailabilityLoanable.get();
Assert.assertEquals(expected, availability);
Assert.assertEquals(0, e.getAcquisitions().size());
}
@Test
public void testEntryAvailabilityLoanedIndefinite()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-loaned-indefinite.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<DateTime> expected_end_date = Option.none();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityLoaned expected = OPDSAvailabilityLoaned.get(
expected_start_date, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityLoanedTimed()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-loaned-timed.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<DateTime> expected_end_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2010-01-01T00:00:00Z"));
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityLoaned expected = OPDSAvailabilityLoaned.get(
expected_start_date, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
LOG.debug("available: {}", available_content_types);
Assert.assertEquals(2, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
Assert.assertTrue(
"text/html;profile=http://librarysimplified.org/terms/profiles/streaming-media is available",
available_content_types.contains(mimeOf("text/html;profile=http://librarysimplified.org/terms/profiles/streaming-media")));
}
@Test
public void testEntryAvailabilityHoldable()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-holdable.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OPDSAvailabilityHoldable expected = OPDSAvailabilityHoldable.get();
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityHeldIndefinite()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-held-indefinite.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<Integer> queue_position = Option.none();
final OptionType<DateTime> expected_end_date = Option.none();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeld expected = OPDSAvailabilityHeld.get(
expected_start_date, queue_position, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityHeldTimed()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-held-timed.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<DateTime> expected_end_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2010-01-01T00:00:00Z"));
final OptionType<Integer> queue_position = Option.none();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeld expected = OPDSAvailabilityHeld.get(
expected_start_date, queue_position, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityHeldIndefiniteQueued()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-held-indefinite-queued.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<Integer> queue_position = Option.some(3);
final OptionType<DateTime> expected_end_date = Option.none();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeld expected = OPDSAvailabilityHeld.get(
expected_start_date, queue_position, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityHeldTimedQueued()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-held-timed-queued.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_start_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2000-01-01T00:00:00Z"));
final OptionType<DateTime> expected_end_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2010-01-01T00:00:00Z"));
final OptionType<Integer> queue_position = Option.some(3);
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeld expected = OPDSAvailabilityHeld.get(
expected_start_date, queue_position, expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityHeldReady()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-heldready.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_end_date = Option.none();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeldReady expected =
OPDSAvailabilityHeldReady.get(expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityReservedTimed()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-heldready-timed.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_end_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2010-01-01T00:00:00Z"));
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeldReady expected =
OPDSAvailabilityHeldReady.get(expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityOpenAccess()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-open-access.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityOpenAccess expected =
OPDSAvailabilityOpenAccess.get(expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertEquals(0, acquisition.getIndirectAcquisitions().size());
Assert.assertTrue(acquisition.getType().isSome());
Assert.assertEquals(
mimeOf("application/epub+zip"),
((Some<MIMEType>) acquisition.getType()).get());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryAvailabilityReservedSpecific0()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource(
"entry-availability-heldready-specific0.xml"));
final OPDSAvailabilityType availability = e.getAvailability();
final OptionType<DateTime> expected_end_date = Option.some(
ISODateTimeFormat.dateTimeParser().parseDateTime("2015-08-24T00:30:24Z"));
final OptionType<URI> expected_revoke =
Option.some(new URI("http://example.com/revoke"));
final OPDSAvailabilityHeldReady expected =
OPDSAvailabilityHeldReady.get(expected_end_date, expected_revoke);
Assert.assertEquals(expected, availability);
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
@Test
public void testEntryNoSupportedFormats()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource("entry-no-supported-format.xml"));
Assert.assertTrue("No available acquisitions", e.getAcquisitions().isEmpty());
}
@Test
public void testEntryMultipleFormats0()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource("entry-with-formats-0.xml"));
Assert.assertEquals(2, e.getAcquisitions().size());
{
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
}
{
final OPDSAcquisition acquisition = e.getAcquisitions().get(1);
Assert.assertTrue(
"application/pdf is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/pdf"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
Assert.assertEquals(1, available_content_types.size());
Assert.assertTrue(
"application/pdf is available",
available_content_types.contains(mimeOf("application/pdf")));
}
}
@Test
public void testEntryMultipleFormats1()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource("entry-with-formats-1.xml"));
Assert.assertEquals(1, e.getAcquisitions().size());
final OPDSAcquisition acquisition = e.getAcquisitions().get(0);
Assert.assertTrue(
"application/epub+zip is available",
OPDSIndirectAcquisition.Companion.findTypeInOptional(
mimeOf("application/epub+zip"),
acquisition.getIndirectAcquisitions()).isSome());
final Set<MIMEType> available_content_types = acquisition.availableFinalContentTypes();
LOG.debug("available: {}", available_content_types);
Assert.assertEquals(3, available_content_types.size());
Assert.assertTrue(
"application/epub+zip is available",
available_content_types.contains(mimeOf("application/epub+zip")));
Assert.assertTrue(
"application/pdf is available",
available_content_types.contains(mimeOf("application/pdf")));
Assert.assertTrue(
"text/html;profile=http://librarysimplified.org/terms/profiles/streaming-media is available",
available_content_types.contains(mimeOf("text/html;profile=http://librarysimplified.org/terms/profiles/streaming-media")));
}
@Test
public void testEntryWithDRM()
throws Exception {
final OPDSAcquisitionFeedEntryParserType parser = this.getParser();
final OPDSAcquisitionFeedEntry e = parser.parseEntryStream(URI.create("urn:test"),
OPDSFeedEntryParserContract.getResource("entry-with-drm.xml"));
OptionType<DRMLicensor> licensor_opt = e.getLicensor();
Assert.assertTrue(licensor_opt.isSome());
DRMLicensor licensor = ((Some<DRMLicensor>) licensor_opt).get();
Assert.assertEquals(
"NYPL",
licensor.getVendor());
Assert.assertEquals(
"NYNYPL|0000000000|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
licensor.getClientToken());
Assert.assertEquals(
Option.some("http://qa.circulation.librarysimplified.org/NYNYPL/AdobeAuth/devices"),
licensor.getDeviceManager());
}
private OPDSAcquisitionFeedEntryParserType getParser() {
return OPDSAcquisitionFeedEntryParser.newParser(BookFormats.INSTANCE.supportedBookMimeTypes());
}
private MIMEType mimeOf(String text) {
try {
return MIMEParser.Companion.parseRaisingException(text);
} catch (final Exception e) {
throw new IllegalStateException(e);
}
}
}
| [
"code@io7m.com"
] | code@io7m.com |
1e6aac9f2c0e3a580110effcb6a89a63a4c78085 | 5cb2d64a3269fa85f1ede1db405d763450fa117f | /src/org/kernelab/bifo/uniprot/UniProtItem.java | 5ccd49b42f42d3ce88cc96e618242b2beccf5465 | [] | no_license | KerneLab/Bifo | 7a4989aaab02812489be17e3224e36d96f2cbdba | 61204f9f7229b4d23c079ce4914c61b2b313efea | refs/heads/master | 2016-09-09T21:41:51.968482 | 2014-06-19T18:57:25 | 2014-06-19T18:57:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,600 | java | package org.kernelab.bifo.uniprot;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.kernelab.basis.Tools;
import org.kernelab.basis.sql.SQLKit;
import org.kernelab.bifo.fasta.FastA;
import org.kernelab.bifo.fasta.FastAItem;
import org.kernelab.bifo.go.Gene2GOItem;
import org.kernelab.bifo.go.GeneOntology;
public class UniProtItem extends FastAItem implements Comparable<UniProtItem>
{
/**
*
*/
private static final long serialVersionUID = 5858249264022771690L;
public static final char COLUMN_SPLIT_CHAR = '|';
public static final String COLUMN_SPLIT_MARK = "|";
public static final String COLUMN_SPLIT_REGEX = REGEX_ESCAPER
+ COLUMN_SPLIT_MARK;
public static final String UNIPROT_DESCRIPTION_REGEX = "^\\>sp\\|[A-Z0-9]{6}\\|[\\s\\S]+$";
public static final int ID_LENGTH = 6;
/**
* @param args
*/
public static void main(String[] args)
{
String s = "sp|Q27YE2|Z_IPPYV RING finger protein Z OS=Ippy virus (isolate Rat/Central African Republic/Dak An B 188 d/1970) GN=Z PE=3 SV=1";
Tools.debug(s.split("\\_", 2));
}
private String id;
private String species;
private String entry;
private Set<Gene2GOItem> goItems;
private Map<String, String> information;
public UniProtItem()
{
}
public UniProtItem(ResultSet rs) throws SQLException
{
id = rs.getString("id");
species = rs.getString("species");
entry = rs.getString("entry");
description = rs.getString("detail");
sequenceData = rs.getString("code");
this.summaryInformation();
}
public UniProtItem(String description)
{
this.setDescription(description);
this.summaryInformation();
}
protected UniProtItem(UniProtItem item)
{
this.id = item.id;
this.species = item.species;
this.entry = item.entry;
this.description = item.description;
this.sequenceData = item.sequenceData;
this.goItems = item.goItems;
this.summaryInformation();
}
@Override
public UniProtItem clone()
{
return new UniProtItem(this);
}
@Override
public int compareTo(UniProtItem o)
{
return this.id.compareTo(o.id);
}
@Override
public boolean equals(Object o)
{
boolean equal = false;
if (o instanceof UniProtItem) {
UniProtItem i = (UniProtItem) o;
equal = this.id.equals(i.id);
}
return equal;
}
@Override
public String getDescription()
{
StringBuilder sb = new StringBuilder(FastA.FASTA_ITEM_BEGIN_MARK);
sb.append("sp");
sb.append(COLUMN_SPLIT_CHAR);
sb.append(id);
sb.append(COLUMN_SPLIT_MARK);
sb.append(this.getEntryName());
sb.append(' ');
sb.append(description);
return sb.toString();
}
public String getDetail()
{
return description;
}
public String getEntry()
{
return entry;
}
public String getEntryName()
{
return entry + "_" + species;
}
public Set<Gene2GOItem> getGOItems()
{
if (goItems == null) {
goItems = GeneOntology.QueryUniProtGOItems(this.id);
}
return goItems;
}
public Set<Gene2GOItem> getGOItems(SQLKit kit) throws SQLException
{
if (goItems == null) {
goItems = GeneOntology.QueryUniProtGOItems(this.id, kit);
}
return goItems;
}
public String getId()
{
return id;
}
public Map<String, String> getInformation()
{
return information;
}
public String getSpecies()
{
return species;
}
@Override
public int hashCode()
{
return id.hashCode();
}
@Override
public void setDescription(String description)
{
super.setDescription(description);
FastA.FASTA_ITEM_BEGIN_MATCHER.reset(description);
if (FastA.FASTA_ITEM_BEGIN_MATCHER.matches()) {
String[] columns = this.description.split(COLUMN_SPLIT_REGEX, 3);
id = columns[1];
columns = columns[2].split("\\s", 2);
this.description = columns[1];
columns = columns[0].split("\\_", 2);
species = columns[1];
entry = columns[0];
}
}
public void setEntry(String entry)
{
this.entry = entry;
}
public void setId(String id)
{
this.id = id;
}
public void setInformation(Map<String, String> information)
{
this.information = information;
}
public void setSpecies(String species)
{
this.species = species;
}
protected void summaryInformation()
{
information = new LinkedHashMap<String, String>();
information.put("Id", id);
information.put("Species", species);
information.put("Entry", entry);
}
@Override
public String toString()
{
StringBuilder sb = new StringBuilder(this.getDescription());
sb.append('\n');
sb.append(formatSequenceData(60));
return sb.toString();
}
}
| [
"kernelforce@gmail.com"
] | kernelforce@gmail.com |
dfd422157576447fc9a42d2a65c9551842d7a250 | 24643916cd1515911b7837ce81ebd17b0890cc81 | /packages/apps/Media3D/src/com/mediatek/media3d/NavigationBarMenu.java | 88c0a57c1cc86fe684eb17334e0a597ee063d934 | [
"Apache-2.0"
] | permissive | touxiong88/92_mediatek | 3a0d61109deb2fa77f79ecb790d0d3fdd693e5fd | 5e96a7bb778fd9d9b335825584664e0c8b5ff2c7 | refs/heads/master | 2020-05-02T10:20:49.365871 | 2019-04-25T09:12:56 | 2019-04-25T09:12:56 | 177,894,636 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,949 | java | /* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein is
* confidential and proprietary to MediaTek Inc. and/or its licensors. Without
* the prior written permission of MediaTek inc. and/or its licensors, any
* reproduction, modification, use or disclosure of MediaTek Software, and
* information contained herein, in whole or in part, shall be strictly
* prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
* ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
* NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
* RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
* INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES
* TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
* RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
* OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
* SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
* RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
* ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE
* RELEASED HEREUNDER WILL BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE
* MEDIATEK SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
* CHARGE PAID BY RECEIVER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek
* Software") have been modified by MediaTek Inc. All revisions are subject to
* any receiver's applicable license agreements with MediaTek Inc.
*/
package com.mediatek.media3d;
import java.util.ArrayList;
import java.util.List;
public class NavigationBarMenu {
public List<NavigationBarMenuItem> mMenuItems;
public NavigationBarMenu() {
// Create an empty list.
mMenuItems = new ArrayList<NavigationBarMenuItem>();
}
public NavigationBarMenuItem add(int itemId) {
NavigationBarMenuItem item = new NavigationBarMenuItem(itemId);
mMenuItems.add(item);
return item;
}
public void clear() {
mMenuItems.clear();
}
public int getItemCount() {
return mMenuItems.size();
}
public NavigationBarMenuItem getItem(int index) {
return mMenuItems.get(index);
}
}
| [
"sunhouzan@163.com"
] | sunhouzan@163.com |
5cf121fffbeeb9195f7d81bf7866659a19e38e5b | 0e8f012392f391c687d2422a02d552b1055aa623 | /ZeressemosInternationalBankV.2/src/conta/MapaDasContas.java | 30dd6ab740a04ad9f7992dac44f01d49e8529b05 | [] | no_license | OsZeressemos/sistemaBancoDesenvolvimento | e5c2fad67f6e8d7d14b982a412ea6fefe717e27b | ad25ddca1fc472d51b03574d76bfebe728d51248 | refs/heads/main | 2023-04-21T09:37:32.782153 | 2021-05-13T01:13:56 | 2021-05-13T01:13:56 | 364,270,003 | 0 | 1 | null | 2021-05-23T14:46:16 | 2021-05-04T13:44:00 | Java | UTF-8 | Java | false | false | 2,317 | java | package conta;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class MapaDasContas extends Conta {
public MapaDasContas(int cpf, int numero, int agencia, double saldo, int tipo) {
this.cpf = cpf;
this.numero = numero;
this.agencia = agencia;
this.saldo = saldo;
this.tipo = tipo;
}
public static Map<Integer, Conta> lerConta() throws IOException, FileNotFoundException {
String linha;
try (BufferedReader csvReader = new BufferedReader(new FileReader("Conta.txt"))) {
linha = csvReader.readLine();
Map<Integer, Conta> mapConta = new HashMap<>();
while ((linha = csvReader.readLine()) != null) {
linha = linha.replace("\"", "");
String[] data = linha.split(";");
String titular = data[0];
int cpf = Integer.parseInt(data[1]);
int numero = Integer.parseInt(data[2]);
int agencia = Integer.parseInt(data[3]);
double saldo = Double.parseDouble(data[4]);
int tipo = Integer.parseInt(data[5]);
if (tipo == 1) {
Conta novaConta = new ContaCorrente(titular, cpf, numero, agencia, saldo, tipo);
mapConta.put(cpf, novaConta);
} else {
Conta novaConta = new ContaPoupanca(titular, cpf, numero, agencia, saldo, tipo);
mapConta.put(cpf, novaConta);
}
}
return mapConta;
}
}
@Override
public double seguroDeVida(double valor) {
return 0;
}
public static void atualizaTxt(Conta conta) {
String arquivo = "Conta.txt";
String arquivoTmp = "Conta-tmp";
BufferedWriter writer;
BufferedReader reader;
try {
writer = new BufferedWriter(new FileWriter(arquivoTmp));
reader = new BufferedReader(new FileReader(arquivo));
String linha;
while ((linha = reader.readLine()) != null) {
String[] data = linha.split(";");
if(data[1].equals(String.valueOf(conta.getCpfTitular()))) {
linha = linha.replace(data[4], String.valueOf(conta.getSaldo()));
}
writer.write(linha + "\n");
}
writer.close();
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
new File(arquivo).delete();
new File(arquivoTmp).renameTo(new File(arquivo));
}
}
| [
"marcos_barker@hotmail.com"
] | marcos_barker@hotmail.com |
21b166a8c592e810192851b0419b9d58d23bc37e | 64a5287055c1dd02af671d202c3b255a0d6192ff | /code/src/parser/modelDAO/connector.java | 3c5e5d568baff3634c2880fe84c3d994a65ade6b | [] | no_license | mpradeep1994/Personal-medical-Application | 95d0c9187c81f249a35220304e4e13e7bc47b463 | e361da81e67ba9a78408670e2d4071f1926a2d61 | refs/heads/master | 2020-06-28T07:58:47.264786 | 2017-11-18T18:40:29 | 2017-11-18T18:40:29 | 74,500,279 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,480 | 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 modelDAO;
/**
*
* @author Pradeep
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class connector {
static Connection connect= null;
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
//string contains the URL for the DB
static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/soa";
//Database credentials
static final String USER = "root";
static final String PASS = "root";
/**
* It creates the connection to the database
* @return connection
*/
public static Connection getConnection(){
try{
// sets the Driver for the Program
Class.forName("com.mysql.jdbc.Driver");
//establish connection for the database based on the Username and password
connect = DriverManager.getConnection(DB_URL, USER,PASS);
connect.createStatement();
System.out.println("connection established!!");
}
catch(SQLException e){
System.out.println("Problem while connecting: contact Administrator ");
System.out.println(e.getMessage());
}
catch (ClassNotFoundException e){
System.out.println("Problem while connecting: contact Administrator");
e.printStackTrace();
}
return connect;
}
} | [
"mpradeep1994@gmail.com"
] | mpradeep1994@gmail.com |
37dc9f37a971270adadafe1ba132c3f63d0c0967 | 0da9cff1a1ebf91fc58655b17868bbd96fc6a19c | /app/src/main/java/com/example/crud_complete_sqlite/ConsultarSpinner.java | 040bdde93e2e0bbef25045b5674d74bc17de6b88 | [] | no_license | Alvitronex/Crud_complete_SQLite | b9badf179c6592956db0800c7e1933f18be15de7 | 976fc53ecf32b6a4c6fb12f32494fefd234dcc78 | refs/heads/master | 2023-08-06T10:32:50.440223 | 2021-09-25T03:55:59 | 2021-09-25T03:55:59 | 410,157,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,416 | java | package com.example.crud_complete_sqlite;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
public class ConsultarSpinner extends AppCompatActivity {
private Spinner sp_options;
private TextView tv_cod, tv_descripcion, tv_precio;
//ArrayList<String> listaArticulos;
//ArrayList<Dto> articulosList;
ConexionSQLite conexion = new ConexionSQLite(this);
Dto datos = new Dto();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_consultar_spinner);
sp_options = (Spinner)findViewById(R.id.sp_options);
tv_cod = (TextView)findViewById(R.id.tv_cod);
tv_descripcion = (TextView)findViewById(R.id.tv_descripcion);
tv_precio = (TextView)findViewById(R.id.tv_precio);
//conexion.obtenerListaArticulos();
conexion.consultaListaArticulos();
//ArrayAdapter<CharSequence> adaptador = new ArrayAdapter(this,android.R.layout.simple_spinner_item, listaArticulos);
ArrayAdapter<CharSequence> adaptador = new ArrayAdapter(this,android.R.layout.simple_spinner_item, conexion.obtenerListaArticulos());
sp_options.setAdapter(adaptador);
sp_options.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position,
long l) {
if (position!=0){
tv_cod.setText("Código: "+conexion.consultaListaArticulos().get(position-
1).getCodigo());
tv_descripcion.setText("Descripción: "+conexion.consultaListaArticulos().get(position-1).getDescripcion());
tv_precio.setText("Precio: "+String.valueOf(conexion.consultaListaArticulos().get(position-1).getPrecio()));
}else{
tv_cod.setText("Código: ");
tv_descripcion.setText("Descripción: ");
tv_precio.setText("Precio: ");
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
} | [
"marioenriquealvarado12@gmail.com"
] | marioenriquealvarado12@gmail.com |
82c3cb90f7240c63db3048765dadfc2b23ad2693 | 905f4834d4509b48fbb279e989b3ca50de5d1594 | /src/main/java/com/lh/address/lookup/controller/AddressLookUpController.java | 0e31342a5ecf42c7d750f9db445b8f6bfb818eda | [] | no_license | bbsz/LhAddressLookUp | 8cd7f45336c7c865dd31eae15788a846b22e13de | 7d902716087a30e83024003cd435746e56bcdd75 | refs/heads/master | 2021-01-22T10:56:20.179808 | 2017-02-16T07:37:34 | 2017-02-16T07:37:34 | 82,053,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,174 | java | package com.lh.address.lookup.controller;
import com.lh.address.lookup.domain.Address;
import com.lh.address.lookup.service.OpenUkAddressSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
/**
* Created by sergej on 15.2.2017.
*/
@RestController
@RequestMapping("addressLookUp/")
public class AddressLookUpController {
private OpenUkAddressSearchService searchService;
@Autowired
public AddressLookUpController(OpenUkAddressSearchService searchService) {
this.searchService = searchService;
}
@RequestMapping(value = "streetNamesByPostCode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<String> searchStreetNamesByPostCode(@RequestParam("postCode") String postCode) {
List<Address> addresses = searchAddressesByPostCode(postCode);
return processByFunction(addresses, (address -> address.getStreet().trim()));
}
@RequestMapping(value = "streetAddressesByPostCode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<String> searchStreetAddressesByPostCode(@RequestParam("postCode") String postCode) {
List<Address> addresses = searchAddressesByPostCode(postCode);
return processByFunction(addresses, (address -> address.getStreetAddress().trim()));
}
@RequestMapping(value = "addressesByPostCode", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<Address> searchAddressesByPostCode(@RequestParam("postCode") String postCode) {
return searchService.getAddressesByPostCode(postCode);
}
private <T, R> List<R> processByFunction(List<T> addresses, Function<T, R> function) {
List<R> streetNames = new ArrayList<>();
for (T t : addresses) {
R result = function.apply(t);
if (!streetNames.contains(result)) {
streetNames.add(result);
}
}
return streetNames;
}
}
| [
"bobuskyyserhiy@gmail.com"
] | bobuskyyserhiy@gmail.com |
22c18ccba819856e0bce953f02144d9451d6fb71 | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i29390.java | 523d8bd4541d5f8f654f3f4796472b1e9ff413db | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package number_of_direct_superinterfaces;
public interface i29390 {} | [
"vincentlee.dolbydigital@yahoo.com"
] | vincentlee.dolbydigital@yahoo.com |
17cb78e0df79413b9ce9f939f918e39d34210a2b | 5ea1361955d5383b9fcad927f41bd26baf5f7008 | /AC2DM/src/ut/ee/db/DBManager.java | 6855bfcb7bf02ca647a2c84ad74b8eecb94e6d2d | [] | no_license | yunle96/ac2dm | 87d1305a0954dc61853cd18ae66e9105e273b28c | a9923ad1b3f956382dacd5d5e3bc45e4ddee16ec | refs/heads/master | 2021-01-23T23:35:08.892807 | 2013-02-16T20:33:49 | 2013-02-16T20:33:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,986 | java | package ut.ee.db;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import ut.ee.utilities.Utilities;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;
public class DBManager {
private DatabaseHelper mDbHelper;
private SQLiteDatabase mDb;
private static String DATABASE_PATH = "/Android/";
private static String DATABASE_NAME = "DBPNS";
private static int DATABASE_VERSION = 1;
private static String TABLE = "motion";
private static String CREATE_TABLE = "";
private final Context mCtx;
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE);
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE);
onCreate(db);
}
}
public void Reset() {
mDbHelper.onUpgrade(this.mDb, 1, 1);
}
public DBManager(Context ctx) {
mCtx = ctx;
mDbHelper = new DatabaseHelper(mCtx);
}
public DBManager(Context ctx, int table) {
mCtx = ctx;
CREATE_TABLE = Utilities.CREATE_RELIABILITY_TABLE;
mDbHelper = new DatabaseHelper(mCtx);
}
public DBManager open() throws SQLException {
mDb = mDbHelper.getReadableDatabase();
return this;
}
public void close() {
mDbHelper.close();
}
public void createEntryForReliability(
String serverTimeStamp, String deviceTimeStamp, String message) {
String statement = Utilities.INSERT_RELIABILITY;
statement = statement + Utilities.SINGLE_QUOTE + serverTimeStamp
+ Utilities.SINGLE_QUOTE + Utilities.COMA
+ Utilities.SINGLE_QUOTE + deviceTimeStamp
+ Utilities.SINGLE_QUOTE + Utilities.COMA
+ Utilities.SINGLE_QUOTE + message + Utilities.SINGLE_QUOTE
+ Utilities.END_STATEMENT;
mDb.execSQL(statement);
}
public void createAccelerometerEntry(String times, double tmi, double tmf) {
// //TODO
mDb.execSQL("insert into " + TABLE + "(tmi,tmf,times) VALUES (" + tmi
+ "," + tmf + ",'" + times + "');");
}
// Copy the Database from its default location
public void copyDataBase() throws IOException {
InputStream myInput = new FileInputStream(mCtx.getDatabasePath(
DATABASE_NAME).getAbsolutePath());
String outFileName = "/sdcard/MHData";
OutputStream myOutput = new FileOutputStream(outFileName);
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer))>0){
myOutput.write(buffer, 0, length);
}
myOutput.flush();
myOutput.close();
myInput.close();
File borrar = new File(mCtx.getDatabasePath(DATABASE_NAME)
.getAbsolutePath());
borrar.delete();
}
} | [
"p2tris@gmail.com"
] | p2tris@gmail.com |
ef6468e5665ec803857cd3f498acc483dae13865 | d05dcf82faf1e40e126452fa2167b1272420f6f2 | /myboot/src/main/java/com/example/exception/ErrorCode.java | dc36ffe203f6537eba17c6bd27e3ef0ad08b845f | [] | no_license | csj50/myboot | 532b951a916beaedeaec298f1e38364ee617572d | 6e4f37ad14573e335ff6f88e02432b61e43b4155 | refs/heads/master | 2023-04-07T11:19:04.645997 | 2023-03-24T07:11:43 | 2023-03-24T07:11:43 | 211,753,787 | 0 | 0 | null | 2023-01-23T05:53:13 | 2019-09-30T01:45:53 | Java | UTF-8 | Java | false | false | 114 | java | package com.example.exception;
public interface ErrorCode {
public String code();
public String msg();
}
| [
"287229112@qq.com"
] | 287229112@qq.com |
00beef4075af868cb14ff3cf931f88d44251c37a | dcf727746eafa2a960485e9e2d497265317aee03 | /src/hackerrank/MaximizingXOR.java | 62a50e750e65b67e2053de3c572829469e4e9153 | [
"Apache-2.0"
] | permissive | wlk/contests | e45c4ad53e9b5a85c6b8b8d05320ec73ab191fb2 | d4c17c5dee046fa457870577255848899e5e8b64 | refs/heads/master | 2020-05-19T09:05:23.811811 | 2016-11-23T20:42:41 | 2016-11-23T20:42:41 | 9,275,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 747 | java | package hackerrank;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class MaximizingXOR {
static int maxXor(int l, int r) {
int maxXor = 0;
for(int i = l; i <= r; ++i){
for(int j = i; j <= r; ++j){
if( (i^j) > maxXor){
maxXor = (i^j);
}
}
}
return maxXor;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int res;
int _l;
_l = Integer.parseInt(in.nextLine());
int _r;
_r = Integer.parseInt(in.nextLine());
res = maxXor(_l, _r);
System.out.println(res);
}
}
| [
"wlangiewicz@gmail.com"
] | wlangiewicz@gmail.com |
5ac49ce809753777c5efe1f36bd56982110ea697 | b6ee45b46e99d1a3d00bee92f0e922287b66adbb | /HoaxifyJavaReact/serverJava/ws/src/main/java/com/hoaxify/ws/user/abstracts/UserService.java | 908fc8264588dfb18f624760acb283695a645d26 | [] | no_license | merdemli/Hoaxify | 3aa9fe27e454fd4f11940377abadb86089c01cf3 | 876b5d0031a3e6447ea96e2d8a9f8b372ad6ed8c | refs/heads/main | 2023-07-20T00:14:03.869964 | 2021-08-25T22:50:33 | 2021-08-25T22:50:33 | 397,649,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package com.hoaxify.ws.user.abstracts;
import com.hoaxify.ws.user.concrete.User;
public interface UserService {
void add(User user);
}
| [
"57098477+merdemli@users.noreply.github.com"
] | 57098477+merdemli@users.noreply.github.com |
e0c8389a44aa137cec67b583dd3f633a810ff314 | 032eba8d11328a7e274b30dde0b259817dfe615d | /app/src/test/java/com/example/a16046562/p08_locatingaplace/ExampleUnitTest.java | fdcb3eb99bc47b98e3b09a6986406825fbf0bd94 | [] | no_license | bryantan16046562/P08LocatingAPlace | e32301625a8a88d0a63f457999b2dea4f97298d6 | b44181a4d62b53e44fc54ecd29e99a884cd8350c | refs/heads/master | 2020-03-22T16:55:02.105470 | 2018-07-10T16:02:45 | 2018-07-10T16:02:45 | 140,360,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.example.a16046562.p08_locatingaplace;
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);
}
} | [
"16046562@rp.edu.sg"
] | 16046562@rp.edu.sg |
2b7b6d37ff69116e1ba40db770d2e9a75bf5d4e5 | 704401a865430c88b557c903b53e40b3c60a553d | /app/src/main/java/com/example/android/break2/AddAwardToAuther.java | 5c9d04eecb98b9417ef2dec27161412c30f574c4 | [] | no_license | mazen930/Movie-Recommendations-App | c5ad3f0d74f8c5ffe0bd1d1ca8711a045b288d37 | da38daaae3b1ec47304a6e3f7691a635b69f218f | refs/heads/master | 2020-09-03T04:03:30.256527 | 2019-11-03T23:42:21 | 2019-11-03T23:42:21 | 219,381,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,876 | java | package com.example.android.break2;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
public class AddAwardToAuther extends AppCompatActivity {
Controller c =new Controller();
Spinner Award_spinner;
Spinner Aut_spinner;
ArrayList<String> Aut_names= new ArrayList<String>();
ArrayList<String> Aut_id= new ArrayList<String>();
ArrayList<String> Award_names= new ArrayList<String>();
ArrayList<String> Award_id= new ArrayList<String>();
Spinner Movie_spinner;
ArrayList<String> Movie_names= new ArrayList<String>();
ArrayList<String> Movie_id= new ArrayList<String>();
EditText date ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_award_to_auther);
Aut_spinner= (Spinner) findViewById(R.id.Aut_Spinner);
Award_spinner = (Spinner) findViewById(R.id.Award_Spinner3);
Movie_spinner= (Spinner) findViewById(R.id.Movie_Spinner3);
//authors spinner
try {
ResultSet r1 = c.authors_names();
Aut_names = c.SetNamesToArray(r1, Aut_id);
ArrayAdapter<String> dataAdapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Aut_names);
dataAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Aut_spinner.setAdapter(dataAdapter1);
//awards
ResultSet r2 = c.getAward(2);
Award_names = c.SetNamesToArray(r2, Award_id);
ArrayAdapter<String> dataAdapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Award_names);
dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Award_spinner.setAdapter(dataAdapter2);
}catch (SQLException e){e.printStackTrace();}
} public void AddAward(View v) throws java.sql.SQLException{
date = findViewById(R.id.WinDate3);
String Wdate = date.getText().toString();
if(Wdate.isEmpty()||Aut_names.isEmpty()||Movie_names.isEmpty()||Award_names.isEmpty())
Toast.makeText(this, "Adding failed. Please re-check your input information ", Toast.LENGTH_LONG).show();
else {
int res = c.add_award_to_author(Movie_id.get(Movie_spinner.getSelectedItemPosition()),Aut_id.get(Aut_spinner.getSelectedItemPosition()),Award_id.get(Award_spinner.getSelectedItemPosition()),Wdate);
if (res == 1) {
Toast.makeText(this, "award added successfully to an author.", Toast.LENGTH_SHORT).show();
} else if (res == 404) {
Toast.makeText(this, " Adding failed award has been already added before.", Toast.LENGTH_SHORT).show();
}else if (res == -1) {
Toast.makeText(this, " Adding failed this author didn't participate in this movie,please refresh get movie button.", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(this, " Adding failed .", Toast.LENGTH_SHORT).show();
}
}
}
public void GetAutMovies(View view)throws SQLException {
//movies spinner
ResultSet r3 = c.getMemberMovies(1,Aut_id.get(Aut_spinner.getSelectedItemPosition()));
Movie_names = c.SetNamesToArray(r3, Movie_id);
ArrayAdapter<String> dataAdapter3 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Movie_names);
dataAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Movie_spinner.setAdapter(dataAdapter3);
}
} | [
"33043493+mazen930@users.noreply.github.com"
] | 33043493+mazen930@users.noreply.github.com |
a6c53afc088f8a8e2ec488246c9032d703c471f9 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /hbase-20190101/src/main/java/com/aliyun/hbase20190101/models/DescribeInstanceTypeRequest.java | 3113a65ddc278a25e53ad017de26c741e0084c2b | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 703 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.hbase20190101.models;
import com.aliyun.tea.*;
public class DescribeInstanceTypeRequest extends TeaModel {
@NameInMap("InstanceType")
public String instanceType;
public static DescribeInstanceTypeRequest build(java.util.Map<String, ?> map) throws Exception {
DescribeInstanceTypeRequest self = new DescribeInstanceTypeRequest();
return TeaModel.build(map, self);
}
public DescribeInstanceTypeRequest setInstanceType(String instanceType) {
this.instanceType = instanceType;
return this;
}
public String getInstanceType() {
return this.instanceType;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
d1c72c33bfa82a396cafccd8f388267d22b53574 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /ahas-20180901/src/main/java/com/aliyun/ahas20180901/models/QueryPageableOrderRecordsResponseBody.java | 5319d5449ffe664fbf602d26011f90b947fae5ce | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,723 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.ahas20180901.models;
import com.aliyun.tea.*;
public class QueryPageableOrderRecordsResponseBody extends TeaModel {
@NameInMap("Code")
public String code;
@NameInMap("Data")
public String data;
@NameInMap("Message")
public String message;
@NameInMap("RequestId")
public String requestId;
@NameInMap("Success")
public Boolean success;
public static QueryPageableOrderRecordsResponseBody build(java.util.Map<String, ?> map) throws Exception {
QueryPageableOrderRecordsResponseBody self = new QueryPageableOrderRecordsResponseBody();
return TeaModel.build(map, self);
}
public QueryPageableOrderRecordsResponseBody setCode(String code) {
this.code = code;
return this;
}
public String getCode() {
return this.code;
}
public QueryPageableOrderRecordsResponseBody setData(String data) {
this.data = data;
return this;
}
public String getData() {
return this.data;
}
public QueryPageableOrderRecordsResponseBody setMessage(String message) {
this.message = message;
return this;
}
public String getMessage() {
return this.message;
}
public QueryPageableOrderRecordsResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public QueryPageableOrderRecordsResponseBody setSuccess(Boolean success) {
this.success = success;
return this;
}
public Boolean getSuccess() {
return this.success;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
60ce8eb6e6ff0000f72bbfb6d69e3c05584eecdc | 24fbbd9e6e4fd4eb7cf651bf1085baa1f269a692 | /java.jvm/src/main/java/com/jvm/serial/OutOfMemory.java | 5f9b7876a2be4511d7395e110497198ad558d551 | [] | no_license | frinder6/my.test | af6748cff3e24262bd952d30b58c4cde3e434c8f | 964d7b7043b1bc4b48bbc8188ad5544950e3ea41 | refs/heads/master | 2021-01-19T00:51:10.653148 | 2017-03-12T09:24:56 | 2017-03-12T09:24:56 | 62,484,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | package com.jvm.serial;
import com.jvm.MemoryAllocation;
/**
* Created by frinder6 on 2016/12/12.
* <p>
* serial out of memory 测试
*/
public class OutOfMemory extends MemoryAllocation {
/**
* VM Args: -verbose:gc -Xmx20M -Xms20M -Xmn10M -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:SurvivorRatio=8 -XX:+UseSerialGC -Xloggc:oom.log -XX:+HeapDumpOnOutOfMemoryError
* <p>
* 参数说明:heap大小20M,初始大小20M,年轻代大小10M(eden:survivor=8:1),使用 Serial 垃圾收集器
*/
public static void main(String[] args) throws Exception {
System.out.println("begin...");
byte[] b1 = new byte[1 * L_1MB];
byte[] b2 = new byte[1 * L_1MB];
byte[] b3 = new byte[1 * L_1MB];
byte[] b4 = new byte[1 * L_1MB];
byte[] b5 = new byte[1 * L_1MB];
byte[] b6 = new byte[1 * L_1MB];
byte[] b7 = new byte[1 * L_1MB];
byte[] b8 = new byte[1 * L_1MB];
byte[] b9 = new byte[1 * L_1MB];
byte[] b10 = new byte[1 * L_1MB];
byte[] b11 = new byte[1 * L_1MB];
byte[] b12 = new byte[1 * L_1MB];
byte[] b13 = new byte[1 * L_1MB];
byte[] b14 = new byte[1 * L_1MB];
byte[] b15 = new byte[1 * L_1MB];
byte[] b16 = new byte[1 * L_1MB];
byte[] b17 = new byte[1 * L_1MB];
byte[] b18 = new byte[1 * L_1MB];
byte[] b19 = new byte[1 * L_1MB];
byte[] b20 = new byte[1 * L_1MB];
System.out.println("end...");
}
}
| [
"frinder.liu@vipshop.com"
] | frinder.liu@vipshop.com |
fa7f084bf302558f6634a8ed8eb0f4a5a919e58f | 88f67eac43bd45c1df5f598d9152b2b3d3c5fc6c | /src/main/java/com/sirius/dao/mysql/UserIdDao.java | dbe338d431a569b6d3dc8747ef2ce3c139aad14a | [] | no_license | sirius-william/SiriusLibrary_Serve | b75bde9d06e2acb49fbb5ac476854bd96b80d90a | e862648f533a4f75d4d99eabb3b6bf0c54e4146f | refs/heads/master | 2023-07-06T18:51:03.698518 | 2021-08-10T09:29:14 | 2021-08-10T09:29:14 | 393,078,965 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.sirius.dao.mysql;
import com.sirius.domain.UserId;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
@Mapper
public interface UserIdDao {
/*查询*/
// 获取一个空闲的id
UserId selectOne();
// 获取所有指定状态的id
ArrayList<UserId> selectAllByStatus(Integer flag);
// 查询非空闲的id
ArrayList<Integer> selectAllNotFree();
// 获取id状态
Integer selectStatusById(Integer id);
// 查询最大的id值
Integer selectMaxId();
// 获取指定状态id的最大值
Integer selectMaxIdByStatus(Integer flag);
/*增加*/
// 增加对象
int insertOne(UserId newUserId);
// 增加指定状态的id
int insertById(@Param("id") Integer id, @Param("flag") Integer flag);
/*修改*/
// 修改id状态
int updateStatus(@Param("id") Integer id, @Param("flag") Integer flag);
}
| [
"gobletfire@vip.qq.com"
] | gobletfire@vip.qq.com |
94586e7dc792a887eaefaeb9cd85478827c7cd05 | 2dce0244270369d30f509c8a7b6c4ceadc71ec12 | /m29_1_MessageSystemHome/src/main/java/com/it_uatech/api/service/DBServiceAccount.java | cccd30db811ce537346368897d0a083563db9c7c | [] | no_license | ituatech/JavaMainCourse | 91825d3a43159abd97443cf13c166b420266432c | 4e5fc538aa38b9a8bad92932849b9637f6a2172f | refs/heads/master | 2022-06-29T19:15:02.995886 | 2020-05-19T17:43:23 | 2020-05-19T17:43:23 | 218,717,504 | 0 | 0 | null | 2022-06-21T02:42:37 | 2019-10-31T08:21:27 | Java | UTF-8 | Java | false | false | 269 | java | package com.it_uatech.api.service;
import com.it_uatech.api.model.AccountDataSet;
import java.util.Optional;
public interface DBServiceAccount {
void save(AccountDataSet account);
Optional<AccountDataSet> findByLogin(String login);
void shutdown();
}
| [
"53702365+ituatech@users.noreply.github.com"
] | 53702365+ituatech@users.noreply.github.com |
768ee741616544d53c0273cd8575f3b71c824f36 | d084c6361245b7624f7949ac168c3f12d906beb5 | /weixin_base/src/main/java/com/mudi/weixin/base/cipher/CmdCipher.java | b7467caa21b0558bd7cc721575fbdaccbdf77a82 | [
"Apache-2.0"
] | permissive | mudiyouyou/fake_weixin_by_netty | c24fac96a56b3d2831dbed78f1afadd5f6f5115b | c4652bde62e01a30832cc2a08d4449d7d5976585 | refs/heads/master | 2023-08-09T10:07:07.405255 | 2020-02-05T11:59:04 | 2020-02-05T11:59:04 | 157,389,596 | 0 | 0 | Apache-2.0 | 2023-07-20T02:12:28 | 2018-11-13T14:03:00 | Java | UTF-8 | Java | false | false | 1,638 | java | package com.mudi.weixin.base.cipher;
import javax.crypto.*;
import javax.crypto.spec.DESedeKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.Base64;
public class CmdCipher {
private static final String PASSWORD = "vCb01hOGGj7W7z49B/4OFsEB2hzmE22J";
public static final String KEY_ALGORITHM = "DESede";
private static SecretKey secret = null;
public CmdCipher() {
try {
DESedeKeySpec spec = new DESedeKeySpec(Base64.getDecoder().decode(PASSWORD));
SecretKeyFactory facotory = SecretKeyFactory.getInstance("DESede");
secret = facotory.generateSecret(spec);
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeySpecException e) {
e.printStackTrace();
}
}
public static byte[] encrypt(byte[] data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, secret);
return cipher.doFinal(data);
}
public static byte[] decrypt(byte[] data) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, secret);
return cipher.doFinal(data);
}
}
| [
"cobrano1@163.com"
] | cobrano1@163.com |
e5b219c08606c313280cc70b4d817b1382355973 | 4aa4bc14cf72dd2f5d302570a763bc5025a17041 | /app/src/main/java/com/parting_soul/learn/viewdraw/customview/view/LinearLayout.java | 46d12a247c6e5d257d8104cf71e91543d0c5c16e | [] | no_license | PartingSoul/AndroidLearn | 1c52e1fbc7db412b4d59b4679528f8e0df183ea7 | ae8359a51585e3ad89c919ea76327dd3cc8fe384 | refs/heads/master | 2021-07-25T01:09:39.527878 | 2020-09-25T08:12:20 | 2020-09-25T08:12:20 | 219,702,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,810 | java | package com.parting_soul.learn.viewdraw.customview.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.parting_soul.learn.R;
/**
* 自定义线性布局
*
* @author parting_soul
* @date 2019-11-05
*/
public class LinearLayout extends ViewGroup {
private Drawable mDivider;
private int mDividerWidth;
private int mDividerHeight;
private int mShowDividers = SHOW_DIVIDER_NONE;
private int mDividerPadding;
private int mOrientation;
/**
* 水平排列
*/
public static final int HORIZONTAL = 0;
/**
* 垂直排列
*/
public static final int VERTICAL = 1;
/**
* 不显示分割线
*/
public static final int SHOW_DIVIDER_NONE = 0;
/**
* 在开头显示分割线
*/
public static final int SHOW_DIVIDER_BEGINNING = 1;
/**
* 在中间显示分割线
*/
public static final int SHOW_DIVIDER_MIDDLE = 2;
/**
* 在结尾显示分割线
*/
public static final int SHOW_DIVIDER_END = 4;
public LinearLayout(Context context) {
this(context, null);
}
public LinearLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public LinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
if (attrs != null) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.LinearLayout, defStyleAttr, 0);
mShowDividers = typedArray.getInt(R.styleable.LinearLayout_c_showDividers, SHOW_DIVIDER_NONE);
mDivider = typedArray.getDrawable(R.styleable.LinearLayout_c_divider);
mDividerPadding = (int) typedArray.getDimension(R.styleable.LinearLayout_c_dividerPadding, 0);
mOrientation = typedArray.getInt(R.styleable.LinearLayout_c_orientation, HORIZONTAL);
typedArray.recycle();
mDividerWidth = mDivider != null ? mDivider.getIntrinsicWidth() : 0;
mDividerHeight = mDivider != null ? mDivider.getIntrinsicHeight() : 0;
}
setWillNotDraw(mDivider == null);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (mOrientation == VERTICAL) {
measureVertical(widthMeasureSpec, heightMeasureSpec);
}
}
/**
* 测量垂直排列布局
*
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
private void measureVertical(int widthMeasureSpec, int heightMeasureSpec) {
int totalHeight = 0;
int maxWidth = 0;
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.GONE) {
continue;
}
if (hasDividerBeforeChildAt(i)) {
//存在分割线,则加上分割线的高度
totalHeight += mDividerHeight;
}
//测量子控件
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, totalHeight);
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
totalHeight += child.getMeasuredHeight() + params.topMargin + params.bottomMargin;
maxWidth = Math.max(maxWidth, child.getMeasuredWidth() + params.leftMargin + params.rightMargin);
}
if (hasDividerBeforeChildAt(childCount)) {
//存在分割线,则加上分割线的高度
totalHeight += mDividerHeight;
}
maxWidth = resolveSize(maxWidth, widthMeasureSpec);
totalHeight = resolveSize(totalHeight, heightMeasureSpec);
setMeasuredDimension(maxWidth, totalHeight);
}
/**
* 在当前索引的View前是否存在分割线
*
* @param index
* @return
*/
private boolean hasDividerBeforeChildAt(int index) {
if (index == getChildCount()) {
return (mShowDividers & SHOW_DIVIDER_END) != 0;
}
boolean isAllViewGone = isAllViewGoneBeforeIndex(index);
if (isAllViewGone) {
return (mShowDividers & SHOW_DIVIDER_BEGINNING) != 0;
}
return (mShowDividers & SHOW_DIVIDER_MIDDLE) != 0;
}
/**
* 当前索引前的View都隐藏
*
* @param index
* @return
*/
private boolean isAllViewGoneBeforeIndex(int index) {
for (int i = index; i >= 0; i--) {
View child = getChildAt(i);
if (child.getVisibility() != View.GONE) {
return false;
}
}
return true;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mOrientation == VERTICAL) {
layoutVertical(changed, left, top, right, bottom);
}
}
/**
* 垂直排列布局
*
* @param changed
* @param left
* @param top
* @param right
* @param bottom
*/
private void layoutVertical(boolean changed, int left, int top, int right, int bottom) {
int childCount = getChildCount();
int parentLeft = getPaddingLeft();
int parentTop = getPaddingTop();
int l = 0, t = parentTop;
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.GONE) {
continue;
}
if (hasDividerBeforeChildAt(i)) {
//存在分割线,则加上分割线的高度
t += mDividerHeight;
}
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
l = parentLeft + params.leftMargin;
t += params.topMargin;
child.layout(l, t, l + child.getMeasuredWidth(), t + child.getMeasuredHeight());
t += child.getMeasuredHeight() + params.bottomMargin;
}
}
@Override
protected void onDraw(Canvas canvas) {
if (mDivider == null) {
return;
}
if (mOrientation == VERTICAL) {
drawVertical(canvas);
} else {
drawHoriztontal(canvas);
}
}
/**
* 绘制水平排列布局
*
* @param canvas
*/
private void drawHoriztontal(Canvas canvas) {
}
/**
* 绘制垂直排列布局
*
* @param canvas
*/
private void drawVertical(Canvas canvas) {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.GONE) {
continue;
}
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
if (hasDividerBeforeChildAt(i)) {
int top = child.getTop() - mDividerHeight - params.topMargin;
drawHorizontalDivider(canvas, top);
}
}
//末尾的分割线
if (hasDividerBeforeChildAt(childCount)) {
View child = getLastVisibleChild();
if (child != null) {
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
int top = child.getBottom() + params.bottomMargin;
drawHorizontalDivider(canvas, top);
}
}
}
/**
* 绘制水平分割线
*
* @param canvas
*/
private void drawHorizontalDivider(Canvas canvas, int top) {
mDivider.setBounds(getPaddingLeft() + mDividerPadding, top,
getWidth() - getPaddingRight() - mDividerPadding, top + mDividerHeight);
mDivider.draw(canvas);
}
/**
* 获取最后一个可见项
*
* @return
*/
private View getLastVisibleChild() {
int childCount = getChildCount();
for (int i = childCount - 1; i >= 0; i++) {
View child = getChildAt(i);
if (child.getVisibility() == View.VISIBLE) {
return child;
}
}
return null;
}
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new android.widget.LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
}
@Override
protected LayoutParams generateLayoutParams(LayoutParams p) {
return p;
}
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new android.widget.LinearLayout.LayoutParams(getContext(), attrs);
}
}
| [
"partingsoul@gmail.com"
] | partingsoul@gmail.com |
3d7d865475f9199eff9c2ebdca13584c7254ef78 | d943106f8bece1cd3b4c7205a6af146af8f3afe7 | /powermock/src/main/java/win/iot4yj/PowerMockApp.java | 297904c1a4f3c7937d4d03a40116a70177e5d3d6 | [
"MIT"
] | permissive | yjaal/study | 91ae5e2a141915ed928060cc0ef39170dade4bea | f8b721de46ae160e23ce25b547ae3a1654b14b26 | refs/heads/master | 2022-12-21T15:25:31.192786 | 2022-12-20T07:34:05 | 2022-12-20T07:34:05 | 186,843,346 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 54 | java | package PACKAGE_NAME;
public class PowerMockApp {
}
| [
"yjjal1314@gmail.com"
] | yjjal1314@gmail.com |
1b39486a2563dd4a564942e34b3937a1aa65caba | ebd894cc8e654ec55dfc23bae9f72654b4231399 | /src/de/tud/stg/tests/popart/extensions/cool/shape/MyShape.java | 317a395c5a9446dc8c0b9050f7c1837186e55fcd | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | dinkelaker/popart | b664599b208963469f9a0448f9497e7f57b9d70e | 46d3e6f45c2ea4343eeff5c35fdfd177661663ae | refs/heads/master | 2020-04-06T13:30:14.845024 | 2015-06-16T11:52:40 | 2015-06-16T11:52:40 | 157,502,523 | 2 | 0 | null | 2018-11-14T06:34:58 | 2018-11-14T06:34:58 | null | UTF-8 | Java | false | false | 1,675 | java | ///////////////////////////////////////////////////////////////////////////////
// Copyright 2008-2015, Technische Universitaet Darmstadt (TUD), Germany
//
// The TUD licenses this file to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
///////////////////////////////////////////////////////////////////////////////
package de.tud.stg.tests.popart.extensions.cool.shape;
import java.util.Vector;
import java.util.Random;
// Shape example from Lopez Diss.
public class MyShape {
protected double x_= 0.0, y_= 0.0;
protected double width_=0.0, height_=0.0;
private Random mRandom = new Random();
double x() { return x_; }
double y() { return y_; }
double width(){ return width_; }
double height(){ return height_; }
void adjustLocation() throws Throwable {
x_ = longCalculation();
y_ = longCalculation();
}
void adjustDimensions() throws Throwable {
width_ = longCalculation();
height_ = longCalculation();
}
private double longCalculation() throws Throwable {
double v = mRandom.nextDouble();
Thread.currentThread().sleep((int)(v*2000.0));
return v;
}
}
| [
"Tom.Dinkelaker@ericsson.com"
] | Tom.Dinkelaker@ericsson.com |
828b16cfba1b1426148e1fb5bb81cfb9edd9e4af | 86505462601eae6007bef6c9f0f4eeb9fcdd1e7b | /bin/modules/sap-subscription-billing/saprevenuecloudcustomer/src/com/sap/hybris/saprevenuecloudcustomer/service/SapRevenueCloudCustomerOutboundService.java | 1cbb37d58bed64e92e761a21baf8c206edfa27d3 | [] | no_license | jp-developer0/hybrisTrail | 82165c5b91352332a3d471b3414faee47bdb6cee | a0208ffee7fee5b7f83dd982e372276492ae83d4 | refs/heads/master | 2020-12-03T19:53:58.652431 | 2020-01-02T18:02:34 | 2020-01-02T18:02:34 | 231,430,332 | 0 | 4 | null | 2020-08-05T22:46:23 | 2020-01-02T17:39:15 | null | UTF-8 | Java | false | false | 1,544 | java | /*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package com.sap.hybris.saprevenuecloudcustomer.service;
import de.hybris.platform.core.model.user.AddressModel;
import de.hybris.platform.core.model.user.CustomerModel;
import java.io.IOException;
import java.util.Map;
import org.springframework.http.ResponseEntity;
import com.sap.hybris.saprevenuecloudcustomer.dto.Customer;
import com.sap.hybris.scpiconnector.data.ResponseData;
import rx.Observable;
/**
* Replicates customer data to Revenue Cloud via CPI
*/
public interface SapRevenueCloudCustomerOutboundService
{
/**
* Send customer data to revenue cloud via CPI.
*/
public Observable<ResponseEntity<Map>> sendCustomerData(final CustomerModel customerModel, final String baseStoreUid,
final String sessionLanguage, final AddressModel addressModel);
/**
* Triggers Customer Update iflow in Cloud Platform Integration which fetches the customer data from Revenue Cloud
* and updates in Commerce
*
* @param customerJson
* Customer Json object
*
* @throws IOException
* if unable to publish.
*
* @return {@link ResponseData}
*
*/
public ResponseData publishCustomerUpdate(Customer customerJson) throws IOException;
}
| [
"juan.gonzalez.working@gmail.com"
] | juan.gonzalez.working@gmail.com |
2e277ba01ffb6a0fc0c19a0be1901525c37b550c | 11d186c7403e450272023a4f8ef9ada8e0149890 | /Laboratorium 9/ag_odb.java | 7b75602ab9256fdd306cf4b681f127f320d0bd6b | [] | no_license | AMajkut/Rozproszona-Sztuczna-Inteligencja | 4af56bdaf2ecc47278fdf70f81d272e0ce42151d | c30b577e3b48b84988669bc795e89a8cb4f7c9f9 | refs/heads/master | 2021-04-26T22:50:27.176000 | 2018-05-30T07:51:32 | 2018-05-30T07:51:32 | 124,154,163 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,195 | java | import jade.core.Agent;
import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;
public class ag_odb extends Agent {
protected void setup() {
addBehaviour(new CyclicBehaviour(this) {
public void action() {
ACLMessage msg = myAgent.receive();
if (msg != null) {
ACLMessage reply = msg.createReply();
if (msg.getPerformative() == ACLMessage.REQUEST) {
System.out.println("Received REQUEST message from agent "+msg.getSender().getName());
System.out.println("Content : "+ msg.getContent());
reply.setPerformative(ACLMessage.INFORM);
reply.setContent("Wykonalem");
} else if(msg.getPerformative() == ACLMessage.CFP){
System.out.println("Received CFP message from agent "+msg.getSender().getName());
System.out.println("Content : "+msg.getContent());
reply.setPerformative(ACLMessage.REQUEST);
reply.setContent("Raz jeszcze");
}
else {
reply.setPerformative(ACLMessage.NOT_UNDERSTOOD);
reply.setContent("Nie znam");
}
myAgent.send(reply);
}
else {
block();
}
}
} );
}
} | [
"noreply@github.com"
] | noreply@github.com |
3282033c41285b9e97b5f40554637cd04120506a | 47b079bdd3269e95216a0fc9acd2ff62714b681b | /app/src/main/java/com/orderprio/CustomItemListView.java | 8cfda99fff08f4c656ad08149d1d4858449d501a | [] | no_license | snihore/OrderPrio | 5105d12446377e4595c20382e5c1c1fc7b778f79 | f2f692ebeb290116ca0769f60e06dde049318ecb | refs/heads/master | 2021-07-05T08:09:00.814479 | 2021-05-08T06:13:19 | 2021-05-08T06:13:19 | 239,145,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package com.orderprio;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.orderprio.data.ShopMenuData;
import java.util.List;
public class CustomItemListView extends BaseAdapter {
private Context context;
private List<ShopMenuData> list;
public CustomItemListView(Context context, List<ShopMenuData> list) {
this.context = context;
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
View view1 = LayoutInflater.from(this.context).inflate(R.layout.menu_listview_item, viewGroup, false);
TextView cuisineName = view1.findViewById(R.id.listview_item_cuisine_name);
TextView cuisinePrice = view1.findViewById(R.id.listview_item_cuisine_price);
if(list != null){
ShopMenuData shopMenuData = this.list.get(i);
if(shopMenuData != null){
cuisineName.setText(shopMenuData.getCuisineName().toUpperCase());
cuisinePrice.setText("\u20B9 "+shopMenuData.getCuisinePrice());
}
}
return view1;
}
}
| [
"souravnihore1998@gmail.com"
] | souravnihore1998@gmail.com |
45112e4d491e5f323f34060237eafccd4d576b89 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-workspacesweb/src/main/java/com/amazonaws/services/workspacesweb/model/transform/TrustStoreJsonUnmarshaller.java | 7d9a277e3e2a052f727d7d7df89cd96f4cdc3ab2 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 3,007 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.workspacesweb.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.workspacesweb.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* TrustStore JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TrustStoreJsonUnmarshaller implements Unmarshaller<TrustStore, JsonUnmarshallerContext> {
public TrustStore unmarshall(JsonUnmarshallerContext context) throws Exception {
TrustStore trustStore = new TrustStore();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("associatedPortalArns", targetDepth)) {
context.nextToken();
trustStore.setAssociatedPortalArns(new ListUnmarshaller<String>(context.getUnmarshaller(String.class))
.unmarshall(context));
}
if (context.testExpression("trustStoreArn", targetDepth)) {
context.nextToken();
trustStore.setTrustStoreArn(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return trustStore;
}
private static TrustStoreJsonUnmarshaller instance;
public static TrustStoreJsonUnmarshaller getInstance() {
if (instance == null)
instance = new TrustStoreJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
47b7490b061c4e2df91eb7b022d5c36fab16684a | a45f642f23ac1475adbc8ff51ff6942baf29dd89 | /app/src/main/java/com/example/singin/model/network/ApiClient.java | b996fc52714c46905bb5f4da9c7e6befb2e2f757 | [] | no_license | rahulghosh1990/task | 1987cb630f7397e55a26bab2ed101589ee05e3ba | 7685d54f27cfa2cd15d0a38e11587d8392511c57 | refs/heads/master | 2023-04-18T15:09:41.794861 | 2021-05-06T09:55:56 | 2021-05-06T09:55:56 | 362,692,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,093 | java | package com.example.singin.model.network;
import com.example.singin.BuildConfig;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
/*public-api/categories*/
public static final String BASE_URL="https://gorest.co.in/";
private static Retrofit retrofit = null;
private static OkHttpClient client = null;
private static Retrofit retrofitTwo = null;
private static void initClient(){
if(client == null){
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
int REQUEST_TIMEOUT = 60;
client = new OkHttpClient.Builder()
.addInterceptor(interceptor)
.connectTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.writeTimeout(REQUEST_TIMEOUT, TimeUnit.SECONDS)
.build();
}
}
public static Retrofit getClient() {
initClient();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(client)
.build();
}
return retrofit;
}
/* private static Retrofit retrofit;
public static final String BASE_URL="https://gorest.co.in/";
public static Retrofit getRetrofitInstance() {
if (retrofit == null) {
retrofit = new retrofit2.Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}*/
}
| [
"rsmith.ghosh717@gmail.com"
] | rsmith.ghosh717@gmail.com |
0747fe358857426a7f33e31c8c37a93a74f1b1c7 | 42cae89d448773565534047934e5189a990ad8bc | /2.hazi2/src/Katonas/Teszt.java | 0e8a2b21577dc61770bbbfc7c3fe943f72fff059 | [] | no_license | czevarist/CzevarIstvan_C59ZSC | 40f706e88be0c38a0cff3a2fd07e41f89deb2905 | e5cc638a306c8fb9ff7cacbea86658a4c6807cd7 | refs/heads/master | 2020-08-06T15:43:10.042659 | 2019-10-14T22:37:18 | 2019-10-14T22:37:18 | 213,061,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package Katonas;
public class Teszt {
public static Katona megkuzd(Katona k1, Katona k2) {
if (k1.getTamadoEro() > k2.getTamadoEro())
return k1;
if (k1.getTamadoEro() < k1.getTamadoEro())
return k2;
return k1;
}
public static void main(String[] args) {
Katona[] katonak = new Katona[3];
Nyilas[] nyListaja = new Nyilas[2];
Landzsas[] lListaja = new Landzsas[1];
nyListaja[0] = new Nyilas(50, 42, 62);
nyListaja[1] = new Nyilas(45, 32, 97);
katonak[0] = nyListaja[0];
katonak[1] = nyListaja[1];
lListaja[0] = new Landzsas(54, 96);
katonak[2] = lListaja[0];
System.out.println("Első küzdelem:");
System.out.println(katonak[0] + " és " + katonak[1] + " harcoltak!");
System.out.println("Nyertes:");
System.out.println(megkuzd(katonak[0], katonak[1]));
System.out.println();
System.out.println("Küzdelem, első győztese és egy harmadik között:");
System.out.println(megkuzd(katonak[0], katonak[1]) + " és " + katonak[2] + " küzdött meg!");
System.out.println("Nyertes:");
System.out.println(megkuzd(megkuzd(katonak[0], katonak[1]), katonak[2] ));
}
} | [
"noreply@github.com"
] | noreply@github.com |
d69dc9e1af6945d90869531d7da6fb816ee2c1b7 | 6c8df26fd62fa087ae21c7966162c7ffe63968c1 | /src/pckg/Tester.java | 90370edd0becd4da8e73fb9ecdd8fd78f24e2c0a | [] | no_license | ahmedmahmoud116/Predictive-Text | 95b92cf1ef87b796cc5997fea8d375529c50db8a | 68d41e2093c4abadca14ce2d5ebc96b8e0ecd59a | refs/heads/master | 2020-07-21T22:33:42.824096 | 2019-09-07T15:32:35 | 2019-09-07T15:32:35 | 206,988,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package pckg;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
public class Tester {
public Tester() {
}
public static void main(String[] args) throws IOException {
MarkovRunnerWithInterface mr = new MarkovRunnerWithInterface();
mr.runMarkov();
// mr.testHashMap();
// mr.compareMethods();
// testGetFollowsWithFile();
}
public static void testGetFollows() {
MarkovOne mo = new MarkovOne();
mo.setTraining("this is a test yes this is a test.");
ArrayList<String> list = mo.getFollows("t");
System.out.println("List size " + list.size());
System.out.println(list.toString());
}
public static void testGetFollowsWithFile() throws FileNotFoundException {
StringBuilder sb = new StringBuilder();
File f = new File("confucius.txt");
Scanner sc = new Scanner(f);
while(sc.hasNext()) {
String s = sc.nextLine();
s = s + " ";
sb.append(s);
}
sc.close();
String st = sb.toString();
MarkovOne mo = new MarkovOne();
mo.setTraining(st);
ArrayList<String> list = mo.getFollows("he");
System.out.println("List size " + list.size());
System.out.println(list.toString());
}
}
| [
"ahmed.mahmoud8116@gmail.com"
] | ahmed.mahmoud8116@gmail.com |
0561b2dfdf568670809d600fdb4260b0327f9958 | 830fec37193b164765e7ba4f4655516dd7c41cab | /daogenerator/src/main/java/com/netlight/quotes/QuotesDaoGenerator.java | e938243a3cb43f02cc789d7696cefc59829f1e1a | [] | no_license | jenmo917/TheCodePub | d04da8e8470f7aa0ffe667efb9e21c8d16aed0b3 | 1cd31fce23be1a6e5a9c075ebcdf4ae9a5b13cfd | refs/heads/master | 2020-04-09T20:39:39.767208 | 2015-09-14T16:13:34 | 2015-09-14T16:13:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | package com.netlight.quotes;
import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;
public class QuotesDaoGenerator {
private static final int VERSION_NUMBER = 1;
/**
* REMEMBER TO INCREASE VERSION NUMBER WHEN CHANGING THE DATABASE
*/
public static void main(String[] args) throws Exception {
Schema schema = new Schema(VERSION_NUMBER,
"com.netlight.quotes.app.model.db");
schema.setDefaultJavaPackageDao("com.netlight.quotes.app.model.dao");
schema.enableKeepSectionsByDefault();
generateEntities(schema);
new DaoGenerator().generateAll(schema,
"../app/src/main/java/");
}
private static void generateEntities(Schema schema) {
Entity entity = schema.addEntity("Quote");
entity.implementsInterface("Parcelable");
entity.addIdProperty();
entity.addStringProperty("quote").notNull();
entity.addStringProperty("author").notNull();
entity.addStringProperty("category").notNull();
entity.addBooleanProperty("yodafied").notNull();
}
} | [
"Jens.Moser@nrk.no"
] | Jens.Moser@nrk.no |
a8c89137a6a41363407d47e45f3ca91492481fff | 7fb70bb0a5df024fc84c65173fcf0bf5da10e101 | /app/src/main/java/com/example/asrclient/RegisterClient.java | 0a1ded1439665e730594f7dbac07d376826feed2 | [] | no_license | aldinsabb99/ASRClient | 83cb253a2d08c82da866a0713bce6757ee20154e | fdf95e971f59be80c1eefed072d1fab227365e51 | refs/heads/master | 2021-01-16T16:36:14.307333 | 2020-09-17T12:14:19 | 2020-09-17T12:14:19 | 243,183,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,950 | java | package com.example.asrclient;
import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.widget.EditText;
import android.widget.Button;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.ApplicationController;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.error.VolleyError;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
/**
* Class Activity untuk login pelanggan
* @author Gifari Ramadhan
* @version 2018.05.15
*/
public class RegisterClient extends AppCompatActivity {
/**
* Method yang digunakan saat pertama kali membuka activity
* @param savedInstanceState menyimpan state instance
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_client);
final ImageButton settingconn = (ImageButton) findViewById(R.id.connect);
final EditText surenameInput = (EditText) findViewById(R.id.signup_inputsurename);
final EditText usernameInput = (EditText) findViewById(R.id.signup_inputusername);
final EditText passInput = (EditText) findViewById(R.id.signup_inputPass);
final Button registerButton = (Button) findViewById(R.id.buttonRegister);
final ProgressBar loading = (ProgressBar) findViewById(R.id.load);
if(SharedPreferencesClient.getLoggedStatus(getApplicationContext())) {
Intent directInt = new Intent(getApplicationContext(), MainActivity.class);
RegisterClient.this.startActivity(directInt);
}
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(RegisterClient.this, RegisterClient.class);
startActivity(intent);
}
});
registerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String surename = surenameInput.getText().toString();
String username = usernameInput.getText().toString();
String password = passInput.getText().toString();
Map<String, String> params = new HashMap<>();
params.put("surename",surename);
params.put("username",username);
params.put("password", MD5encypt.encypt(password));
JSONObject jsonobj = new JSONObject(params);
Response.Listener<JSONObject> responseListener = new Response.Listener<JSONObject> () {
@Override
public void onResponse(JSONObject jsonResponse) {
try{
if(jsonResponse!=null) {
int id = jsonResponse.getInt("id_user");
String name = jsonResponse.getString("name");
loading.setVisibility(View.INVISIBLE);
AlertDialog.Builder builder = new AlertDialog.Builder(RegisterClient.this);
builder.setMessage("Register Success " + id)
.create()
.show();
Intent mainInt = new Intent(RegisterClient.this, MainActivity.class);
mainInt.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TASK);
SharedPreferencesClient.setId(getApplicationContext(),id);
SharedPreferencesClient.setName(getApplicationContext(),name);
SharedPreferencesClient.setToken(getApplicationContext(),"TESTOKEN");
SharedPreferencesClient.setLoggedIn(getApplicationContext(),true);
RegisterClient.this.startActivity(mainInt);
}
} catch (JSONException e){
AlertDialog.Builder builder = new AlertDialog.Builder(RegisterClient.this);
loading.setVisibility(View.INVISIBLE);
builder.setMessage("Register Failed.")
.create()
.show();
}
}
};
Response.ErrorListener errListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loading.setVisibility(View.INVISIBLE);
Toast.makeText(getApplicationContext(), "Unable connect to server", Toast.LENGTH_LONG).show();
}
};
//Toast.makeText(getApplicationContext(),ConnectClient.getIP() + " ",Toast.LENGTH_LONG).show();
loading.bringToFront();
loading.setVisibility(View.VISIBLE);
RegisterRequest registerRequest = new RegisterRequest(jsonobj,responseListener,errListener);
RequestQueue queue = Volley.newRequestQueue(RegisterClient.this);
queue.add(registerRequest);
queue.getCache().invalidate(ConnectClient.getIP()+"/userval",true);
}
});
settingconn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(RegisterClient.this, ConnectClient.class);
startActivity(i);
}
});
}
@Override
public void onBackPressed(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Are you sure want to Exit?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
System.exit(0);
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog quit = builder.create();
quit.show();
}
}
| [
"aldinisa.rahma@ui.ac.id"
] | aldinisa.rahma@ui.ac.id |
d3222bf33b4defe629ce0292eb7bac1ac9645708 | d89554818bcd1a930720b1297784f4f6b7ea1b82 | /liveloop/MarcoUtils/src/com/marco/automate/AutomateModel.java | ac0426e2b546bc2992e80e8ea092a12ae06bd25f | [] | no_license | Fruity-Grebbles/liveloop | 75bf09667d3df85cbd787d125cdd085174d97dce | 3fd830a79962f467afa5c38436fe8bf16045b6a5 | refs/heads/master | 2021-01-10T17:22:28.665411 | 2008-07-27T09:03:05 | 2008-07-27T09:03:05 | 50,063,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package com.marco.automate;
import java.util.List;
public interface AutomateModel {
public void setEnterState(State st);
public void setAsExitState(State st);
public State getEnterState();
public void addState(State st);
public void addTransition(Transition tr,State from,State to);
public List<Transition> getTransitions(State st);
public State getFromState(Transition t);
public State getToState(Transition t);
}
| [
"Marc.Haussaire@8b6768aa-2752-0410-b93d-719054ee405d"
] | Marc.Haussaire@8b6768aa-2752-0410-b93d-719054ee405d |
984059467588b3481ac49fe10c9325b6ede4de07 | 312ff012bae56da393eacaf8337b3529eb0d2c8a | /src/main/java/cn/edu/fudan/dsm/tslrm/data/ForexData.java | 3cf4ead54e26b3221aca9426fe09663487b41f9d | [
"Apache-2.0"
] | permissive | DSM-fudan/LR-miner | 2ae56acb615d098c8dd006b481ba21123b4cd696 | 117476a2187cfbc4850c957d7aa0189eb649d5a0 | refs/heads/master | 2023-03-06T15:54:56.412108 | 2023-02-24T10:46:16 | 2023-02-24T10:46:16 | 148,120,207 | 2 | 3 | Apache-2.0 | 2023-02-24T10:46:20 | 2018-09-10T08:01:53 | Java | UTF-8 | Java | false | false | 11,753 | java | package cn.edu.fudan.dsm.tslrm.data;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.LongRange;
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.IOException;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* Created with IntelliJ IDEA.
* User: wangyang
* Date: 13-6-5
* Time: 下午10:21
* To change this template use File | Settings | File Templates.
*/
public class ForexData {
static Logger logger = Logger.getLogger(ForexData.class);
public String baseCurrency;
public String secondCurrency;
public long[] times;
public double[][] rates;
public ForexData(String baseCurrency, String secondCurrency, long[] times, double[][] rates) {
this.baseCurrency = baseCurrency;
this.secondCurrency = secondCurrency;
this.times = times;
this.rates = rates;
}
public ForexData() {
}
@Override
public String toString() {
return "ForexData{" +
"baseCurrency='" + baseCurrency + '\'' +
", secondCurrency='" + secondCurrency + '\'' +
", length='" + times.length + '\'' +
", times=" + new Timestamp(times[0]) + "," + new Timestamp(times[times.length - 1]) +
", rates=" + rates[0][0] + "," + rates[rates.length - 1][0] +
'}';
}
public String toCsv()
{
// 2012-12-31 15:39:00,7.75010,7.75010,7.75009,7.75009,0
StringBuilder sb = new StringBuilder();
for (int i = 0; i < times.length; i++) {
long time = times[i];
sb.append(new Timestamp(time)).append(",");
for (int j = 0; j < rates[i].length; j++) {
double v = rates[i][j];
sb.append(v).append(",");
}
sb.append("0").append("\n");
}
return sb.toString();
}
public static ForexData readFromFile(String fileName) throws IOException {
//this.fileName = fileName;
File file = new File(fileName);
return readFromFile(file);
}
static DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static ForexData readFromFile(File file) throws IOException {
String name = file.getName();
logger.debug("name = " + name);
String[] split = name.split("[.]");
// logger.debug("split[0] = " + split[0]);
String[] ss = split[0].split("_");
ForexData forexData = new ForexData();
if (!isNumber(ss[0]))
{
forexData.baseCurrency = ss[0];
forexData.secondCurrency = ss[1];
}
else
{
forexData.baseCurrency = ss[1];
forexData.secondCurrency = ss[2];
}
List list = FileUtils.readLines(file);
forexData.times = new long[list.size()];
forexData.rates = new double[list.size()][4];
for (int i = 0; i < list.size(); i++) {
String s = (String) list.get(i);
String[] strings = s.split(",");
try {
forexData.times[i] = df.parse(strings[0]).getTime();
forexData.rates[i][0] = Double.parseDouble(strings[1]);
forexData.rates[i][1] = Double.parseDouble(strings[2]);
forexData.rates[i][2] = Double.parseDouble(strings[3]);
forexData.rates[i][3] = Double.parseDouble(strings[4]);
} catch (ParseException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
logger.debug("forexData.times.length = " + forexData.times.length);
return forexData;
}
private static boolean isNumber(String s) {
return StringUtils.isNumeric(s);
}
static long OneMinute = 60 * 1000;
public ForexData fillMinuteData(long startTime, long endTime) {
if (startTime < times[0])
throw new RuntimeException("the start time should large than " + new Date(times[0]));
ForexData ret = new ForexData();
ret.baseCurrency = this.baseCurrency;
ret.secondCurrency = this.secondCurrency;
int l = (int) ((endTime - startTime) / OneMinute);
ret.times = new long[l];
ret.rates = new double[l][4];
int c = 0;
startTime = startTime - (startTime % OneMinute);
for (int i = 0; i < ret.times.length; i++) {
ret.times[i] = startTime + i * OneMinute;
long time = ret.times[i];
while ((this.times[c] < time) && (c < this.times.length -1) && (this.times[c + 1] <= time)) {
c = c + 1;
}
System.arraycopy(this.rates[c], 0, ret.rates[i], 0, this.rates[c].length);
}
return ret;
}
public ForexData reduceByMinutes(int minutes) {
ForexData ret = new ForexData();
ret.baseCurrency = this.baseCurrency;
ret.secondCurrency = this.secondCurrency;
int l = (int) (this.times.length / minutes);
ret.times = new long[l];
ret.rates = new double[l][4];
int c = 0;
long startTime = times[0];
for (int i = 0; i < ret.times.length; i++) {
ret.times[i] = startTime + i * OneMinute * minutes;
// ret.rates[i][0] = this.rates[i*minutes][0];
//use average rate
double sum = 0;
//sum
for (int j = i * minutes; j < (i+1)*minutes ; j++)
{
sum = sum + this.rates[j][0];
}
ret.rates[i][0] = sum/minutes;
ret.rates[i][1] = this.rates[i*minutes][1];
ret.rates[i][2] = this.rates[i*minutes][2];
for (int j = i * minutes; j < (i+1)*minutes ; j++)
{
if (ret.rates[i][1] < this.rates[j][1]) //for max
ret.rates[i][1] = this.rates[j][1];
if (ret.rates[i][2] > this.rates[j][2]) //for min
ret.rates[i][2] = this.rates[j][2];
}
ret.rates[i][3] = this.rates[i*minutes+minutes-1][3];
}
return ret;
}
public static void main(String[] args) throws IOException {
ForexData forexData = ForexData.readFromFile("../data/AUD_CAD.csv");
System.out.println("forexData = " + forexData);
System.out.println("forexData.rates[0][0] = " + forexData.rates[0][0]);
System.out.println("forexData.rates[0][1] = " + forexData.rates[0][1]);
System.out.println("forexData.rates[0][2] = " + forexData.rates[0][2]);
System.out.println("forexData.rates[0][3] = " + forexData.rates[0][3]);
System.out.println("forexData.rates[2][0] = " + forexData.rates[2][0]);
System.out.println("forexData.rates[2][1] = " + forexData.rates[2][1]);
System.out.println("forexData.rates[2][2] = " + forexData.rates[2][2]);
System.out.println("forexData.rates[2][3] = " + forexData.rates[2][3]);
System.out.println("forexData.rates[forexData.rates.length-1][0] = " + forexData.rates[forexData.rates.length - 1][0]);
System.out.println("forexData.rates[forexData.rates.length-1][1] = " + forexData.rates[forexData.rates.length - 1][1]);
System.out.println("forexData.rates[forexData.rates.length-1][2] = " + forexData.rates[forexData.rates.length - 1][2]);
System.out.println("forexData.rates[forexData.rates.length-1][3] = " + forexData.rates[forexData.rates.length - 1][3]);
}
public ForexData z_normalize() {
ForexData ret = new ForexData();
ret.baseCurrency = this.baseCurrency;
ret.secondCurrency = this.secondCurrency;
ret.times = new long[this.times.length];
ret.rates = new double[this.times.length][4];
System.arraycopy(this.times,0,ret.times,0,this.times.length);
for (int i =0; i <4; i++)
{
DescriptiveStatistics ds = new DescriptiveStatistics();
for (int j =0; j < this.times.length; j ++)
{
ds.addValue(this.rates[j][i]);
}
// logger.debug("ds = " + ds);
// logger.debug("ds.getMean() = " + ds.getMean());
// logger.debug("ds.getStandardDeviation() = " + ds.getStandardDeviation());
for (int j =0; j < this.times.length; j ++)
{
ret.rates[j][i] = (this.rates[j][i] - ds.getMean()) / ds.getStandardDeviation();
}
}
return ret;
}
public void saveToFile(File file) throws IOException {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < times.length; i++) {
long time = times[i];
sb.append(df.format(new Date(time))).append(",");
for (int j = 0; j < rates[i].length; j++) {
double rate = rates[i][j];
sb.append(rate).append(",");
}
sb.append("0\n");
}
FileUtils.writeStringToFile(file,sb.toString());
}
public void saveToFile(String fileName) throws IOException {
saveToFile(new File(fileName));
}
public ForexData removeByTimeRanges(List<LongRange> rangeList)
{
ForexData ret = new ForexData();
ret.baseCurrency = this.baseCurrency;
ret.secondCurrency = this.secondCurrency;
List<Integer> timeList = new ArrayList<Integer>();
for (int i = 0; i < times.length; i++) {
long time = times[i];
boolean ignore = false;
for (int j = 0; j < rangeList.size(); j++) {
LongRange range = rangeList.get(j);
if (range.containsLong(time))
{
ignore = true;
break;
}
}
if (!ignore)
{
timeList.add(i);
}
}
ret.times = new long[timeList.size()];
ret.rates = new double[ret.times.length][4];
int c = 0;
for (int i = 0; i < timeList.size(); i++) {
Integer position = timeList.get(i);
ret.times[c] = this.times[position];
for (int j = 0; j < ret.rates[c].length; j++) {
ret.rates[c][j] = this.rates[position][j];
}
c++;
}
return ret;
}
public static ForexData generateUSDFrom(ForexData targetCurrencyData) {
ForexData baseCurrencyData = new ForexData();
baseCurrencyData.baseCurrency = baseCurrencyData.secondCurrency = "USD";
baseCurrencyData.times = new long[targetCurrencyData.times.length];
baseCurrencyData.rates = new double[targetCurrencyData.times.length][4];
for (int i = 0; i < targetCurrencyData.times.length; i++) {
baseCurrencyData.times[i] = targetCurrencyData.times[i];
baseCurrencyData.rates[i][0] = 1.0;
baseCurrencyData.rates[i][1] = 0.0;
baseCurrencyData.rates[i][2] = 1.0;
baseCurrencyData.rates[i][3] = 1.0;
}
return baseCurrencyData;
}
}
| [
"wujysh@gmail.com"
] | wujysh@gmail.com |
b8ed3a281989292339c504b3178956db9a6efc44 | 14631f40424763a874a4a6c8c205284b4a8e3508 | /src/main/java/pt/mleiria/machinelearning/perceptron/Perceptron.java | 7cc388191a49cf04308ab8a2b9a0bb67f09146b3 | [] | no_license | mleiria/NumericalComputingML | 5cc30d7c00d7e7d7a8d3636ad7e3f3fe155a218d | 23aed1c7c5376127fec2f38048109613d7b7bc7b | refs/heads/master | 2020-06-12T20:41:54.913104 | 2018-10-19T13:09:47 | 2018-10-19T13:09:47 | 75,752,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,555 | 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 pt.mleiria.machinelearning.perceptron;
import static java.lang.System.out;
import java.util.Arrays;
import java.util.Optional;
import java.util.Random;
import pt.mleiria.machinelearning.distributions.Gaussian;
import pt.mleiria.machinelearning.functions.Step;
import pt.mleiria.machinelearning.interfaces.OneVarFunction;
/**
*
* @author manuel.leiria
*/
public class Perceptron {
/*
Dimensao dos dados de input
*/
private final int nIn;
/*
Vector de pesos do perceptron
*/
private final double[] w;
private final OneVarFunction<Double> activationFunction;
/**
*
* @param nIn
* @param activationFunction
*/
public Perceptron(int nIn, OneVarFunction<Double> activationFunction) {
this.nIn = nIn;
this.activationFunction = activationFunction;
w = new double[nIn];
}
/**
*
* @param x
* @param t
* @param learningRate
* @return
*/
public int train(double[] x, int t, double learningRate) {
int classified = 0;
double c = 0.;
// Verifica se os dados estao classificados correctamente
for (int i = 0; i < nIn; i++) {
c += w[i] * x[i] * t;
}
/*
Aplica o metodo do gradiente descendente se os dados
nao estao bem classificados
*/
if (c > 0) {
classified = 1;
} else {
for (int i = 0; i < nIn; i++) {
w[i] += learningRate * x[i] * t;
}
}
return classified;
}
/**
*
* @param x
* @return
*/
public int predict(double[] x) {
double preActivation = 0.;
for (int i = 0; i < nIn; i++) {
preActivation += w[i] * x[i];
}
return activationFunction.value(preActivation).intValue();
}
/**
*
* @param train_N
* @param test_N
* @param train_X
* @param train_T
* @param test_X
* @param test_T
*/
public void loadData(final int train_N, final int test_N, final double[][] train_X, final int[] train_T, final double[][] test_X, final int[] test_T){
final Random rng = new Random(1234); // seed
final Gaussian g1 = new Gaussian(-2.0, 1.0, Optional.of(rng));
final Gaussian g2 = new Gaussian(2.0, 1.0, Optional.of(rng));
// data set classe 1
for (int i = 0; i < train_N / 2 - 1; i++) {
train_X[i][0] = g1.random();
train_X[i][1] = g2.random();
train_T[i] = 1;
}
for (int i = 0; i < test_N / 2 - 1; i++) {
test_X[i][0] = g1.random();
test_X[i][1] = g2.random();
test_T[i] = 1;
}
// data set classe 2
for (int i = train_N / 2; i < train_N; i++) {
train_X[i][0] = g2.random();
train_X[i][1] = g1.random();
train_T[i] = -1;
}
for (int i = test_N / 2; i < test_N; i++) {
test_X[i][0] = g2.random();
test_X[i][1] = g1.random();
test_T[i] = -1;
}
}
public static void main(String[] args) {
//
//Inicializa os dados para teste e validacao
//
final int train_N = 1000; // Numero de dados para treinar
final int test_N = 200; // Numero de dados para testar
final int nIn = 2; // Dimensao dos dados
double[][] train_X = new double[train_N][nIn]; // Dados de input para treinar
int[] train_T = new int[train_N]; // Labels de treino
double[][] test_X = new double[test_N][nIn]; // Dados de input para testar
int[] test_T = new int[test_N]; // Labels de teste
int[] predicted_T = new int[test_N]; // Labels previstas pelo modelo
final int epochs = 2000; // Numero maximo de epocas de treino
final double learningRate = 1.; // Taxa de aprendizagem
//
// Modelo SingleLayer Neural Networks
//
int epoch = 0; // epocas de treino
final Perceptron classifier = new Perceptron(nIn, new Step());
classifier.loadData(train_N, test_N, train_X, train_T, test_X, test_T);
// Treinar o modelo
while (true) {
int classified_ = 0;
for (int i = 0; i < train_N; i++) {
classified_ += classifier.train(train_X[i], train_T[i], learningRate);
}
if (classified_ == train_N) {
break; // Quando todos os dados estao classificados corretamente
}
epoch++;
if (epoch > epochs) {
break;
}
}
// Testar o modelo
for (int i = 0; i < test_N; i++) {
predicted_T[i] = classifier.predict(test_X[i]);
}
//
// Avaliar o modelo
//
int[][] confusionMatrix = new int[2][2];
double accuracy = 0.;
double precision = 0.;
double recall = 0.;
for (int i = 0; i < test_N; i++) {
if (predicted_T[i] > 0) {
if (test_T[i] > 0) {
accuracy += 1;
precision += 1;
recall += 1;
confusionMatrix[0][0] += 1;
} else {
confusionMatrix[1][0] += 1;
}
} else {
if (test_T[i] > 0) {
confusionMatrix[0][1] += 1;
} else {
accuracy += 1;
confusionMatrix[1][1] += 1;
}
}
}
accuracy /= test_N;
precision /= confusionMatrix[0][0] + confusionMatrix[1][0];
recall /= confusionMatrix[0][0] + confusionMatrix[0][1];
out.println(Arrays.toString(classifier.w));
out.println("----------------------------");
out.printf("Accuracy: %.1f %%\n", accuracy * 100);
out.printf("Precision: %.1f %%\n", precision * 100);
out.printf("Recall: %.1f %%\n", recall * 100);
}
}
| [
"manuel@manuel-Latitude-E6410"
] | manuel@manuel-Latitude-E6410 |
a1d7867cfb5744af721ba2eca95c054e31ab1301 | db8ba60d6c60894313dca383c0e170d13cb51178 | /src/main/java/cc/unmi/kinesis/KinesisProducer.java | e2f04f249abd3f060731419e57c3de9fc48263b7 | [] | no_license | yabqiu/aws-lambda-kinesis-shard | 720429da5c1efa853284a3c9a65ac064ead36971 | f1ff680fb40ef618fa5f779d95053db8cd9aa329 | refs/heads/master | 2021-01-21T11:40:00.513698 | 2017-05-19T07:59:32 | 2017-05-19T07:59:32 | 91,751,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package cc.unmi.kinesis;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.kinesis.AmazonKinesis;
import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder;
import com.amazonaws.services.kinesis.model.PutRecordResult;
import java.nio.ByteBuffer;
import java.time.LocalDateTime;
public class KinesisProducer {
public static void main(String[] args) {
String kinesisStream = "yanbin-test-stream";
AmazonKinesis kinesis = AmazonKinesisClientBuilder.standard().withCredentials(new
ProfileCredentialsProvider("saml")).build();
for (int i = 0; i < 10; i++) {
PutRecordResult result = kinesis.putRecord(kinesisStream, ByteBuffer.wrap(
(i + ", time: " + LocalDateTime.now()).getBytes()), "key");
System.out.println("ShardId: " + result.getShardId() + ", #Seq: " + result.getSequenceNumber());
}
}
}
| [
"yabqiu@gmail.com"
] | yabqiu@gmail.com |
04f9da4585355b38e5da85b98535845b37a64ca1 | 807d0b37d3245513d09e0194d21189289d7086f5 | /src/main/java/com/thread/Test.java | b53e1b1465f6219691fc970f4ee1d2349baaf9f9 | [] | no_license | aimaole/hadoopdemo | fc263727c22a9f50db112f28cf38a845b5132b95 | 7d3a1260ed75dc42aa7b937472d8240b558ce8cd | refs/heads/master | 2022-05-01T22:17:02.798491 | 2020-05-27T14:52:23 | 2020-05-27T14:52:23 | 245,190,092 | 0 | 0 | null | 2022-04-12T21:58:06 | 2020-03-05T14:50:55 | Java | UTF-8 | Java | false | false | 1,979 | java |
package com.thread;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
/**
* 有返回值的线程
*/
@SuppressWarnings("unchecked")
public class Test {
public static void main(String[] args) throws ExecutionException,
InterruptedException {
System.out.println("----程序开始运行----");
Date date1 = new Date();
int taskSize = 5;
// 创建一个线程池
ExecutorService pool = Executors.newFixedThreadPool(taskSize);
// 创建多个有返回值的任务
List<Future> list = new ArrayList<Future>();
for (int i = 0; i < taskSize; i++) {
Callable c = new MyCallable(i + " ");
// 执行任务并获取Future对象
Future f = pool.submit(c);
// System.out.println(">>>" + f.get().toString());
list.add(f);
}
// 关闭线程池
pool.shutdown();
// 获取所有并发任务的运行结果
for (Future f : list) {
// 从Future对象上获取任务的返回值,并输出到控制台
System.out.println(">>>" + f.get().toString());
}
Date date2 = new Date();
System.out.println("----程序结束运行----,程序运行时间【"
+ (date2.getTime() - date1.getTime()) + "毫秒】");
}
}
class MyCallable implements Callable<Object> {
private String taskNum;
MyCallable(String taskNum) {
this.taskNum = taskNum;
}
public Object call() throws Exception {
System.out.println(">>>" + taskNum + "任务启动");
Date dateTmp1 = new Date();
Thread.sleep(1000);
Date dateTmp2 = new Date();
long time = dateTmp2.getTime() - dateTmp1.getTime();
System.out.println(">>>" + taskNum + "任务终止");
return taskNum + "任务返回运行结果,当前任务时间【" + time + "毫秒】";
}
} | [
"337340028@qq.com"
] | 337340028@qq.com |
d3864c90b3bb6a5aede86b815a30d953d1004022 | 3df8bcaffa78ded2f847aa906016f567ce46d9c9 | /CECS 277/Assignment Four/src/Problem1/CakeFactory.java | fb8d8b86990fcc438bd28c6ecfed9b62a9e469f2 | [] | no_license | thanhhle/Coursework | 0e9457df0f5382703b7bea5f4228694f169c6375 | 904e5de3934e09b1f89ea357197aa7aa1696816b | refs/heads/master | 2020-04-15T04:12:11.420696 | 2019-01-07T05:29:47 | 2019-01-07T05:29:47 | 164,374,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package Problem1;
public class CakeFactory implements Factory{
public Cake createCake(String name)
{
Cake c;
if(name.equalsIgnoreCase("CakeA")) return c = new CakeA();
else if(name.equalsIgnoreCase("CakeB")) return c = new CakeB();
else if(name.equalsIgnoreCase("CakeC")) return c = new CakeC();
return null;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b5d7706ca9da910db3d569d8f89e6b3096dbc78c | 66bfd6ec0a093fc7e17ec5d249a3dc449defd824 | /IOPro/src/com/nstc/io/TestInputStreamReader.java | b43f312cd55ae3c169e317704f30268cd66c2da7 | [] | no_license | jokulyao/JavaBase | 36bcbc042e1e7a27f28363f86a57b2ab8dac50a9 | 322f17cce81ad20a37c5e3ffa5d5f5e255ac4333 | refs/heads/master | 2020-04-12T07:21:28.621634 | 2017-01-09T10:41:08 | 2017-01-09T10:41:08 | 42,799,865 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 553 | java | package com.nstc.io;
import java.io.*;
public class TestInputStreamReader {
public static void main(String args[]) {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
try {
String s = null;
s = br.readLine();
while (s != null) {
if (s.equalsIgnoreCase("exit"))
break;
System.out.println(s.toUpperCase());
System.out.println();
s = br.readLine();
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} // ×èÈû | [
"forlive_yxs@qq.com"
] | forlive_yxs@qq.com |
244d08cdac2333a072d3e0eb88bb767661c32b1d | 2ceda3c951855fcecfe31a62fb30fdf8087bf024 | /src/rivercrosser/Story1View.java | 2b562c910ca55f5ca01e1a4cd86b0f9dcce17ea7 | [] | no_license | AbdelRahmanKhalil/River-Crosser-Game | fe719ca094ce56315c204f2faecdd4b5bc7b588d | faace3f003084176e76e06675214a9aeaa5736b8 | refs/heads/master | 2020-05-17T14:54:45.332541 | 2019-04-30T23:37:20 | 2019-04-30T23:37:20 | 183,777,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,561 | 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 rivercrosser;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
/**
*
* @author Lenovo
*/
public class Story1View
{
private Stage Window;
private CrosserFactory Generator= new CrosserFactory();
Pane root;
private ArrayList<Crosser> Crosssers= new ArrayList<>();
private Boat boat;
public void setStage(Stage window)
{
Window=window;
}
public Story1Controller display()
{
FXMLLoader loader = new FXMLLoader(getClass().getResource("Story1.fxml"));
try {
root = loader.load();
Window.setScene(new Scene(root));
Window.show();
} catch (IOException ex) {
Logger.getLogger(Story1View.class.getName()).log(Level.SEVERE, null, ex);
}
Setup();
Story1Controller controller=loader.getController();
//System.out.println("Cont="+controller);
return controller;
}
private void addCrosser(Crosser crosser,double x,double y)
{
crosser.getAppearance().setTranslateX(x);
crosser.getAppearance().setTranslateY(y);
Crosssers.add(crosser);
root.getChildren().add(crosser.getAppearance());
}
private void Setup()
{
//addBoat();
addCrosser(Generator.createCrosser("Farmer",0),100,100);
addCrosser(Generator.createCrosser("Herbivore",0),200,100);
addCrosser(Generator.createCrosser("Carnivore",0),300,100);
addCrosser(Generator.createCrosser("Plant",0),400,100);
}
private void addBoat()
{
boat = new Boat();
boat.Appearance.setTranslateX(100);
boat.Appearance.setTranslateY(200);
root.getChildren().add(boat.Appearance);
}
public ArrayList getCrossers()
{
return this.Crosssers;
}
public Boat getBoat()
{
return this.boat;
}
public Stage getStage()
{
return this.Window;
}
public Pane getRoot()
{
return this.root;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
1794a123b4c28601675ddd81b5ff6f41b8a6fa70 | caac0edff73fffa4e0d41faf31350d4abd3776b6 | /app/src/main/java/uk/ac/southwales/beacontest/BaseApplication.java | b1073dfdaebe5e3c63c5298ae9b54564eb96b302 | [] | no_license | tyler6699/BeaconTest | 385917d7ee6bc0658df18124998e88f930a343b6 | 8cafc58ec1220e71b59f662013912fb9ccb08f97 | refs/heads/master | 2020-12-14T09:58:53.700045 | 2015-01-16T14:05:14 | 2015-01-16T14:05:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package uk.ac.southwales.beacontest;
import android.app.Application;
import org.altbeacon.beacon.Region;
import org.altbeacon.beacon.powersave.BackgroundPowerSaver;
import org.altbeacon.beacon.startup.BootstrapNotifier;
/**
* Created by nwillia2 on 16/01/2015.
*/
public class BaseApplication extends Application {
private BackgroundPowerSaver backgroundPowerSaver;
@Override
public void onCreate() {
super.onCreate();
// Simply constructing this class and holding a reference to it in your custom Application class
// enables auto battery saving of about 60%
backgroundPowerSaver = new BackgroundPowerSaver(this);
}
}
| [
"neil.williams@southwales.ac.uk"
] | neil.williams@southwales.ac.uk |
a9527701db6b936e56daec9edb827035e3254bb0 | aaebb75f46cbbfe8041068b7ea3dc1ec90a89ec4 | /app/src/main/java/com/cit/checkout/gateway/http/json/PaymentRequest.java | babf0759ac46ce864bd7d12cd903d772a5ad34bc | [] | no_license | cezbatistao/archref-checkout | d70e58f7e2b2afc2522624acb035ceed37bbbefe | 740d63d79f9ab8131b5ab9e2d8837975d3f43741 | refs/heads/master | 2023-08-20T07:16:49.328161 | 2019-05-30T12:13:01 | 2019-05-30T12:13:01 | 189,407,447 | 1 | 0 | null | 2023-07-22T07:06:43 | 2019-05-30T12:11:00 | Java | UTF-8 | Java | false | false | 1,116 | java | package com.cit.checkout.gateway.http.json;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PACKAGE)
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@ToString
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.EXISTING_PROPERTY,
property = "type",
visible = true,
defaultImpl = PaymentCardRequest.class
)
@JsonSubTypes({
@Type(value = PaymentCardRequest.class, name = "CARD"),
@Type(value = PaymentBilletRequest.class, name = "BILLET")
})
@ApiModel(discriminator = "type", subTypes = { PaymentCardRequest.class, PaymentBilletRequest.class })
public abstract class PaymentRequest {
@NotBlank
@ApiModelProperty(value = "The payment method", required = true, example = "CARD")
private String type;
}
| [
"cezbatistao@gmail.com"
] | cezbatistao@gmail.com |
a083e0f7a285eb82451b3e0fe7efd1d60a1a97d3 | d3d8126333825e76116d5b560489fb2697e28ff4 | /Data_Structure/DS01/src/BS.java | 724594baa72a16b2479b1529aa7ad6956fcff0e9 | [] | no_license | sht3898/Lecture | 45b179a7505fa52a80760a61af54b1b5c0a583e1 | 3df4134b82f0ff3952b1d50432a9adabd2701f2d | refs/heads/master | 2022-12-04T15:36:39.289042 | 2020-08-24T10:47:34 | 2020-08-24T10:47:34 | 285,512,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java |
public interface BS {
public void add(Object object);
public boolean contains(Object object);
public Object getFirst();
public Object getNext();
public boolean remove(Object object);
public int size();
}
| [
"sehyunteg@naver.com"
] | sehyunteg@naver.com |
1a853cab210ee0e5c973cee0fb63e3fbaf0669a3 | 79210c29fe8e459aff3935686335a247391f4899 | /mediapp-backend/src/main/java/com/lp7/service/IEspecialidadService.java | 945393306c5f897ef69e97b9292a7a3b6018ce7e | [] | no_license | Luispastorp/Proyecto-Gestion-Clinica | 229ea36923663d47ac52a311ca9cc55d19f1cb78 | 186e033db8f082369958cbdc09a263793e91ad1f | refs/heads/main | 2023-04-16T02:33:53.364806 | 2021-04-20T15:17:57 | 2021-04-20T15:17:57 | 350,846,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.lp7.service;
import com.lp7.model.Especialidad;
public interface IEspecialidadService extends ICRUDService<Especialidad, Integer>{
}
| [
"luis_pastor_02@hotmail.com"
] | luis_pastor_02@hotmail.com |
3db029691db6e369c04c15d6d4562b4158c4ae7f | c0fbfdbfde08ab063073988e267ae8bf39f0586f | /SmokingProject-master/app/src/main/java/com/example/kakyunglee/smokingproject/activity/dto/response/Bounds.java | 9937eecd651dcec63bedba1d1cd801955a5ef8fb | [
"MIT"
] | permissive | MobileSeoul/2017seoul-84 | 5612f19c569ebe8689c48f8fc8105182a57bb403 | d6ba163950db1b8b7ad7676364da2d9635f42d48 | refs/heads/master | 2021-09-05T15:25:23.019278 | 2018-01-29T08:23:20 | 2018-01-29T08:23:20 | 119,353,399 | 7 | 1 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package com.example.kakyunglee.smokingproject.activity.dto.response;
import java.io.Serializable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Bounds implements Serializable
{
@SerializedName("northeast")
@Expose
private Northeast northeast;
@SerializedName("southwest")
@Expose
private Southwest southwest;
private final static long serialVersionUID = 4294014816207516909L;
public Northeast getNortheast() {
return northeast;
}
public void setNortheast(Northeast northeast) {
this.northeast = northeast;
}
public Southwest getSouthwest() {
return southwest;
}
public void setSouthwest(Southwest southwest) {
this.southwest = southwest;
}
}
| [
"karelin208@naver.com"
] | karelin208@naver.com |
05efb5152b1ba791e4e783ee057fd0afbd4d3269 | a66900e16acb8ff1688dd2217ed24942af129fb2 | /vz-paas-common/vz-paas-common-base/src/main/java/com/vz/paas/base/dto/BaseQuery.java | 624e1b2a03ddcd1fe6032cfd8fa98d4e3473511d | [] | no_license | victorzhang929/vz-paas | a699aa162b3efdb53de9d857b379bddf11ac4458 | d4f12e257918e628d0071e5902567cc6b723bec6 | refs/heads/master | 2020-03-30T06:29:27.237484 | 2018-10-15T09:34:26 | 2018-10-15T09:34:26 | 150,865,225 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package com.vz.paas.base.dto;
import java.io.Serializable;
import lombok.Data;
/**
* 查询基类
* @author zhangwei
* @email zhangwei@cetiti.com
* @date 2018-09-30 14:29:42
*/
@Data
public class BaseQuery implements Serializable {
private static final long serialVersionUID = 6989429137663174881L;
private Integer pageNum = 1;
private Integer pageSize = 10;
private String orderBy;
}
| [
"zhangwei@cetiti.com"
] | zhangwei@cetiti.com |
745fa844c900af7da20ee89fc91cc5748314bfdd | ca0185dc4515f77185c607152dc44c0ca5e95644 | /src/plugin/dialogue/book/WildScapeRuleBook.java | 7a3648b2089d85403aea5d5d4e72683083337663 | [] | no_license | CapitalCoding/brascape | 3aed51271097469d92dcaafcdfe7c85027720e86 | 7d43c0fe443161b5ab3097d9d87cd45617422390 | refs/heads/master | 2021-06-12T12:46:11.762912 | 2020-09-19T07:18:17 | 2020-09-19T07:18:17 | 128,634,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,331 | java | package plugin.dialogue.book;
import org.wildscape.game.component.Component;
import org.wildscape.game.content.dialogue.DialoguePlugin;
import org.wildscape.game.content.dialogue.book.Book;
import org.wildscape.game.content.dialogue.book.BookLine;
import org.wildscape.game.content.dialogue.book.Page;
import org.wildscape.game.content.dialogue.book.PageSet;
import org.wildscape.game.node.entity.player.Player;
import org.wildscape.game.world.GameWorld;
/**
* Represents the strong hold of security book.
* @author 'Vexia
* @version 1.0
*/
public final class WildScapeRuleBook extends Book {
/**
* Represents the id of the book.
*/
public static final int ID = 496107759;
/**
* Represents the component interface.
*/
private static final Component INTERFACE = new Component(26);
/**
* Represents the array of pages for this book.
*/
private static final PageSet[] PAGES = new PageSet[] {
new PageSet(new Page(new BookLine("Rules", 102),
new BookLine("1 - Offensive Language", 74),
new BookLine("2 - Item Scamming", 75),
new BookLine("3 - Password Scamming", 76),
new BookLine("4 - Cheating/Bug Abuse", 77),
new BookLine("5 - Staff Impersonation", 78),
new BookLine("6 - Account Sharing/Trading", 79),
new BookLine("7 - Using Third Party", 80),
new BookLine("Software", 81),
new BookLine("8 - Multi Logging-in", 82),
new BookLine("9 - Encouraging Others to", 83),
new BookLine("Break Rules", 84),
new BookLine("10 - False Representation", 85),
new BookLine("11 - Website Advertising", 86)),
new Page(new BookLine("12 - Read World Item", 87),
new BookLine("Trading", 88),
new BookLine("13 - Asking For Personal", 89),
new BookLine("Details", 90),
new BookLine("14 - Misuse of Official", 91),
new BookLine("Forums", 92),
new BookLine("15 - Advert Blocking", 93))),
new PageSet(new Page(new BookLine(BLUE + "1 - Offensive Language", 102),
new BookLine("You must not use any", 74),
new BookLine("language which is offensive,", 75),
new BookLine("racist or obscene. Remember,", 76),
new BookLine("it's nice to be nice!", 77)),
new Page(new BookLine(BLUE + "2 - Item Scamming", 87),
new BookLine("You must not scam or", 89),
new BookLine("deceive other players. This", 90),
new BookLine("includes claiming that items", 91),
new BookLine("are rare when they are not,", 92),
new BookLine("team scamming or telling", 93),
new BookLine("players that you can", 94),
new BookLine("upgrade' their armour in", 95),
new BookLine("any way!", 96))),
new PageSet(new Page(new BookLine(BLUE + "3 - Password Scamming", 102),
new BookLine("Asking for - or trying to", 74),
new BookLine("obtain - another player's", 75),
new BookLine("password in any way will not", 76),
new BookLine("be tolerated, even in jest!", 77)),
new Page(new BookLine(BLUE + "4 - Cheating/Bug Abuse", 87),
new BookLine("A bug is a technical glitch", 89),
new BookLine("found in the game. You", 90),
new BookLine("must not use or attempt to", 91),
new BookLine("use any cheats or errors that", 92),
new BookLine("you find in our software.", 93),
new BookLine("Any bugs found must be", 94),
new BookLine("reported to "+GameWorld.getName(), 95),
new BookLine("immediately, by clicking the", 96),
new BookLine("'Report a bug/fault' link", 97),
new BookLine("found on the main page.", 98))),
new PageSet(new Page(new BookLine(BLUE + "5 - Staff Impersonation", 102),
new BookLine("You should not attempt to", 74),
new BookLine("impersonate "+GameWorld.getName()+" Pk staff in", 75),
new BookLine("any way.", 76)),
new Page(new BookLine(BLUE + "6 - Account Sharing/Trading", 87),
new BookLine("Each account should only be", 89),
new BookLine("used by ONE person and", 90),
new BookLine("ONE person alone.", 91),
new BookLine("Remember that trying to", 92),
new BookLine("buy, sell, borrow or give", 93),
new BookLine("away an account is against", 94),
new BookLine("the rules and will land you in", 95),
new BookLine("trouble when caught!", 96))),
new PageSet(new Page(new BookLine(BLUE + "7 - Using Third Party <br>" +
BLUE + "Software<br><br>You must not use other<br>programs to gain an "
+ "unfair<br>advantage in the game.", 102)),
new Page(new BookLine(BLUE + "8 - Multi Logging-in</col><br><br>"
+ "If you create more than one<br>"+GameWorld.getName()+" account, they<br>"
+ "must not interact. This<br>includes giving items to a<br>friend to transfer to another<br>account you own.", 87))),
new PageSet(new Page(new BookLine(BLUE + "9 - Encouraging Others to<br>" +
BLUE + "Break Rules</col><br><br>You must not encourage<br>"
+ "others to break any of the<br>"+GameWorld.getName()+" rules.", 102),
new BookLine(BLUE + "10 - False Representation</col><br><br>You must not misuse<br>"
+ GameWorld.getName()+" Customer<br>Support.Trying to get<br>"
+ "another player into trouble<br>by reporting them for no<br>"
+ "reason or framing them is an<br>abuse of the Customer<br>"
+ "Support Team's service.<br> want to help as many<br>"
+ "players as possible and so the<br>Customer Support Team's<br>"
+ "service must be used<br>appropriately and treated with", 87))),
new PageSet(new Page(new BookLine("respect at all times.", 102),
new BookLine(BLUE + "11 - Website Advertising</col><br><br>"
+ "You are not allowed to<br>actively advertise any<br>"
+ "websites, fan-sites, IRC<br>channels or product<br>"
+ "anywhere in "+GameWorld.getName()+",<br>including the "+GameWorld.getName()+"<br>"
+ "forums.", 87)), new Page()),
new PageSet(new Page(new BookLine(BLUE + "12 - Real World Item<br>" + BLUE +
"Trading<br><br></col>"+GameWorld.getName()+" items must only<br>"
+ "be exchanged for other items<br>or service within the game.<br>"
+ "Buying or selling items<br>outside of the "+GameWorld.getName()+"<br>"
+ "enviironment is not in the<br>spirit of the game and is easy<br>"
+ "for "+GameWorld.getName()+" to trace!", 102),
new BookLine(BLUE + "13 - Asking for Personal<br>" +
BLUE + "Details<br><br></col>To protect player's safety<br>"
+ "and privacy, you must not<br>ask for personal details. "
+ "This<br>includes full names, phone<br>numbers, MSN, AIM, email<br>"
+ "and home/school addresses!", 87))),
new PageSet(new Page(new BookLine(BLUE + "14 - Misuse of Official<br>" + BLUE
+ "Forums</col><br><br>Forums must be used in<br>"
+ "accordance with the Forum<br>Code of Conduct and treated<br>"
+ "with respect at all times.", 102),
new BookLine(BLUE + "15 - Advert Blocking<br><br>"
+ "Blocking the adverts in the<br>"
+ "free to play version of<br>"+GameWorld.getName()+" is against the"
+ "<br>rules.", 87))) };
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public WildScapeRuleBook(final Player player) {
super(player, GameWorld.getName()+" Rules", -1, PAGES);
}
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public WildScapeRuleBook() {
/**
* empty.
*/
}
/**
* Method used to display a set of pages.
* @param set the set.
*/
@Override
public void display(Page[] set) {
player.lock(2);
player.getInterfaceManager().open(getInterface());
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 65, index < 1 ? true : false);
boolean lastPage = index == 8;
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 67, lastPage ? true : false);
if (lastPage) {
finish();
}
for (int i : getHiddenChilds()) {
player.getPacketDispatch().sendString("", 26, i);
}
int page1 = index == 0 ? 1 : index == 1 ? 3 : index == 2 ? 5 : index == 3 ? 7 : index == 4 ? 9 : index == 5 ? 11 : index == 6 ? 13 : index == 7 ? 15 : index == 8 ? 17 : index == 9 ? 19 : 21;
player.getPacketDispatch().sendString(getName(), 26, 3);
player.getPacketDispatch().sendString("" + page1, 26, 68);
player.getPacketDispatch().sendString("" + (page1 + 1), 26, 69);
for (Page page : set) {
for (BookLine line : page.getLines()) {
player.getPacketDispatch().sendString(line.getMessage(), getInterface().getId(), line.getChild());
}
}
player.unlock();
}
/**
* Gets the interface.
* @return the interface.
*/
public Component getInterface() {
return INTERFACE;
}
@Override
public DialoguePlugin newInstance(Player player) {
return new WildScapeRuleBook(player);
}
/**
* Represents all the array of all configs to hide.
*/
private static final int[] ALL = new int[] { 102, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 };
/**
* Gets the hidden childs.
* @return the childs.
*/
private int[] getHiddenChilds() {
return ALL;
}
@Override
public int[] getIds() {
return new int[] { ID };
}
}
| [
"diogomrn@gmail.com"
] | diogomrn@gmail.com |
2d24787c8d9ee72c54e3cc0b09e34ff0eea744ef | 8b8f4ed1169d2f5107ed5a8faf87d91e94f883b6 | /gdufs-admin/src/main/java/com/gdufs/common/config/ShiroConfig.java | 7c55cbe07e60e9ea8cb9fd01d24fd2a6e28497b3 | [] | no_license | Gloria199710/gdufs-retrieve | e958df992213b35a7d50d22803bb7f32aec4519a | 794a6cb7f009ae0e37fac2490a0d3d093d3d20ea | refs/heads/master | 2020-04-07T03:02:49.095436 | 2018-11-17T15:55:37 | 2018-11-17T15:55:37 | 158,000,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,018 | java |
package com.gdufs.common.config;
import com.gdufs.modules.sys.shiro.RedisShiroSessionDAO;
import com.gdufs.modules.sys.shiro.UserRealm;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.mgt.SessionManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Shiro的配置文件
*
* @author Mark sunlightcs@gmail.com
* @since 3.0.0 2017-09-27
*/
@Configuration
public class ShiroConfig {
@Bean("sessionManager")
public SessionManager sessionManager(RedisShiroSessionDAO redisShiroSessionDAO,
@Value("${gdufs.redis.open}") boolean redisOpen,
@Value("${gdufs.shiro.redis}") boolean shiroRedis){
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
//设置session过期时间为1小时(单位:毫秒),默认为30分钟
sessionManager.setGlobalSessionTimeout(60 * 60 * 1000);
sessionManager.setSessionValidationSchedulerEnabled(true);
sessionManager.setSessionIdUrlRewritingEnabled(false);
//如果开启redis缓存且gdufs.shiro.redis=true,则shiro session存到redis里
if(redisOpen && shiroRedis){
sessionManager.setSessionDAO(redisShiroSessionDAO);
}
return sessionManager;
}
@Bean("securityManager")
public SecurityManager securityManager(UserRealm userRealm, SessionManager sessionManager) {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(userRealm);
securityManager.setSessionManager(sessionManager);
return securityManager;
}
@Bean("shiroFilter")
public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilter = new ShiroFilterFactoryBean();
shiroFilter.setSecurityManager(securityManager);
shiroFilter.setLoginUrl("/login.html");
shiroFilter.setUnauthorizedUrl("/");
Map<String, String> filterMap = new LinkedHashMap<>();
filterMap.put("/swagger/**", "anon");
filterMap.put("/v2/api-docs", "anon");
filterMap.put("/swagger-ui.html", "anon");
filterMap.put("/webjars/**", "anon");
filterMap.put("/swagger-resources/**", "anon");
filterMap.put("/statics/**", "anon");
filterMap.put("/login.html", "anon");
filterMap.put("/sys/login", "anon");
filterMap.put("/favicon.ico", "anon");
filterMap.put("/captcha.jpg", "anon");
filterMap.put("/**", "authc");
shiroFilter.setFilterChainDefinitionMap(filterMap);
return shiroFilter;
}
@Bean("lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
proxyCreator.setProxyTargetClass(true);
return proxyCreator;
}
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
advisor.setSecurityManager(securityManager);
return advisor;
}
}
| [
"877973455@qq.com"
] | 877973455@qq.com |
17d73518c442ce23d989a4401cd60056473a45b8 | 70ad2a22737558904349249b019787d57316680a | /src/UserDefinedMathOperator.java | bfd3d95224d9df0c578b667809873c2421c88c97 | [] | no_license | amidp/JavaScannerclassHw | 762c35a468a385d397f0d64a4be6aa6b444dd283 | f32f8d7f6499cbdbf90df8ba4ce5985eebeee67a | refs/heads/master | 2023-08-20T14:59:41.714658 | 2021-10-26T14:38:28 | 2021-10-26T14:38:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,336 | java | import java.util.Scanner;
public class UserDefinedMathOperator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);//scanner class called for user data input
System.out.println(" Enter first value : ");
int num1 = scanner.nextInt();
System.out.println(" Enter second value :");
int num2 = scanner.nextInt();
System.out.println(" Enter the operator(+,-,*./) ");//asking user to enter operator as per their wish
char operator = scanner.next().charAt(0);
double addition = num1+num2;
double subtraction = num1-num2;
double multiply = num1*num2;
double divide = num1/num2;
//depending on condition and input from user accordingly output should be printed
if (operator =='+'){
System.out.println(" Two number's addition is : "+ addition);
} else if (operator == '-') {
System.out.println( " Two number's subtraction is : "+subtraction);
}
else if (operator=='*'){
System.out.println( " Two number's multiplication is : "+multiply);
}
else if (operator=='/'){
System.out.println( " Two number's division is : "+ divide);
}
else {
System.out.println( " Invalid input.");
}
}
}
| [
"amidp18@gmail.com"
] | amidp18@gmail.com |
bc5d7d320dfd802e9343c7d72bd034eba0c103cb | cdd2b0705357ec81b7cbcc1e6208e6607adfd19c | /src/com/timbrell/george/exercise2/Garage/Motorbike.java | 56f7e9de5c6e9eab7a32d9a2fdffa9a0bd1b33c8 | [] | no_license | GeorgeT94/QA.Java | b97c64c9eb9613151038dd8dc813ecdd80881dca | 004cb02aa2aeab0250fcee0322a25add8dd1211d | refs/heads/master | 2020-03-17T07:10:41.555983 | 2018-05-25T08:10:37 | 2018-05-25T08:10:37 | 133,387,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.timbrell.george.exercise2.Garage;
public class Motorbike extends Vehicle{
private int CC;
public Motorbike(
int id,
String name,
int seats,
String colour,
String model,
int year,
int CC
){
super(id, name, seats, colour, model, year);
this.CC = CC;
}
public int getEngineSize() {
return this.CC / 10;
}
public int getBill(int days){
int total = (this.getEngineSize() / 2) * days;
return total;
}
}
| [
"ga.timbrell@googlemail.com"
] | ga.timbrell@googlemail.com |
b2c993a0099be57a735aeb227d0b396e45f42d04 | 7c4b5ddfd287c27c96bbad39b94017fa7e0e59ee | /lib/src/main/java/com/example/lib/Mulakat.java | 561796dadcd94c3ed79d17c32d4127cef7f95339 | [] | no_license | mayuri2198/MyApplicationOne | 6c6364c6172ac07b38e1b58bf3b98be2484d6d9e | 9a5af3cb34a005da28acb3b4d8ad48e90885bb09 | refs/heads/master | 2020-05-30T06:19:19.618690 | 2019-05-31T10:40:07 | 2019-05-31T10:40:07 | 189,577,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.example.lib;
public interface Mulakat
{
void mulakat();
void duri();
void duri(int zakas,int bakwass);
void gapbas(float taooo,float dhoop);
int kabhi(int khushi,int gam);
double shaktiman(double gangadhar,double kapala );
int varun(int dana,int dan,int doo);
double aauu(int nandu,float sabka,double bandhu);
}
| [
"gaikwadmayuri917"
] | gaikwadmayuri917 |
249e1a644797a05a099eff76dbb22acf07a59d64 | ba1bff208fd70b1e73229be80f322fdb077fc5aa | /GeometryWars/src/main/java/com/almasb/fxglgames/geowars/component/HealthComponent.java | 796f74b04ceff63e8c20a12e478d90b783ecb47f | [
"MIT"
] | permissive | Hilal-Anwar/FXGLGames | a426ee9294db91126e6a24c85abc8c417d2cb099 | 233d072953c84b2b38c701e1ea4fa1993f039371 | refs/heads/master | 2022-10-18T06:32:45.730324 | 2020-06-14T17:23:44 | 2020-06-14T17:23:44 | 272,340,560 | 1 | 0 | MIT | 2020-06-15T04:18:59 | 2020-06-15T04:18:58 | null | UTF-8 | Java | false | false | 289 | java | package com.almasb.fxglgames.geowars.component;
import com.almasb.fxgl.entity.components.IntegerComponent;
/**
* @author Almas Baimagambetov (almaslvl@gmail.com)
*/
public class HealthComponent extends IntegerComponent {
public HealthComponent(int hp) {
super(hp);
}
}
| [
"almaslvl@gmail.com"
] | almaslvl@gmail.com |
b62f787d9a50bb08c41ba01a14c79a546ff546b9 | 05b402c2d52948f89d7173f89bf7af1bf8579c5f | /com/eternaldoom/redstonepack/gui/GUISmelter.java | 67b96cc2e0f7988c1da9b0c26d4c31f7997e1a4a | [
"MIT"
] | permissive | Eternaldoom/RedstoneExpansionPack | 4bde8973e1c0d3d0ed112d198c25547d1dda8b6f | 936e09fb58b0e471ff38874f1c279b57b89e6ed2 | refs/heads/master | 2016-09-07T03:37:38.618118 | 2014-11-03T23:07:02 | 2014-11-03T23:07:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,734 | java | package com.eternaldoom.redstonepack.gui;
import com.eternaldoom.redstonepack.container.ContainerSmelter;
import com.eternaldoom.redstonepack.tileentity.TileEntitySmelter;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerFurnace;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUISmelter extends GuiContainer
{
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("redstonepack:textures/gui/smelter.png");
private final InventoryPlayer playerInv;
private IInventory tileFurnace;
public GUISmelter(InventoryPlayer p_i45501_1_, IInventory p_i45501_2_)
{
super(new ContainerSmelter(p_i45501_1_, p_i45501_2_));
this.playerInv = p_i45501_1_;
this.tileFurnace = p_i45501_2_;
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
String s = this.tileFurnace.getDisplayName().getUnformattedText();
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
int i1;
if (TileEntitySmelter.isBurning(this.tileFurnace))
{
i1 = this.getBurnTime(13);
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
}
i1 = this.isBurning(24);
this.drawTexturedModalRect(k + 112, l + 34, 176, 14, i1 + 1, 16);
}
private int isBurning(int p_175381_1_)
{
int j = this.tileFurnace.getField(2);
int k = this.tileFurnace.getField(3);
return k != 0 && j != 0 ? j * p_175381_1_ / k : 0;
}
private int getBurnTime(int p_175382_1_)
{
int j = this.tileFurnace.getField(1);
if (j == 0)
{
j = 200;
}
return this.tileFurnace.getField(0) * p_175382_1_ / j;
}
} | [
"mezack@icloud.com"
] | mezack@icloud.com |
d262c7ca63769c22e471abde968c5329afb1e408 | d50609f62118f01499bc0331ef2180784ed86b7a | /src/main/java/com/lxy/tongpeifu/Orange.java | f7b81c60aebcc2c8292a9ba733fcb91b6bf85ade | [] | no_license | lxy-git-code/FanXing | 274a0e9c1e73dd8f2bb9ff34633550ef7befbb9b | bddeebe925d84f4c7d7df6a8684e2d9fdfda03d4 | refs/heads/master | 2020-07-31T04:40:14.986411 | 2020-05-30T15:24:45 | 2020-05-30T15:24:45 | 210,487,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package com.lxy.tongpeifu;
public class Orange extends Fruit {
public Orange() {
// TODO Auto-generated constructor stub
}
}
| [
"xingy.li@sunyard.com"
] | xingy.li@sunyard.com |
f5c88441f0d01a1385dd4807e96501e7be31ecef | 043fe13d203bcbb5868515b703388975c285c251 | /src/main/java/com/jskiba/controller/HumanPlayerController.java | 1a42a29c107f1f43b647a9ce30e11ec9441d6b4e | [] | no_license | jakubskiba/tttgrid | a527080a65676826e3a19b81c21f690a92f7dd58 | 39e8dd0d8c27a3ab8482df315a24206d6fc94c9e | refs/heads/master | 2020-03-10T13:08:16.893248 | 2018-04-13T13:24:02 | 2018-04-13T13:24:02 | 129,392,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,449 | java | package com.jskiba.controller;
import com.jskiba.model.Board;
import com.jskiba.model.Player;
import com.jskiba.view.View;
public class HumanPlayerController implements PlayerController {
private Player player;
private View view;
public HumanPlayerController(Player player, View view) {
this.player = player;
this.view = view;
}
@Override
public int getCoordinatesOfMove(Board board) {
String prompt = player.getName() + " provide coordinate (letterNumber ex. a0)";
String userInput = view.getText(prompt);
int coordinate = getCoordinate(userInput, board.getSide());
while (coordinate < 0) {
userInput = view.getText(prompt);
coordinate = getCoordinate(userInput, board.getSide());
}
return coordinate;
}
private int getCoordinate(String coordinate, int rowSize) {
if(coordinate.length() >= 2) {
Character letter = coordinate.charAt(0);
String digit = coordinate.substring(1, coordinate.length());
Integer column = Character.toLowerCase(letter) - 'a';
try {
Integer row = Integer.parseInt(digit);
return row*rowSize + column;
} catch (NumberFormatException e) {
return -1;
}
}
return -1;
}
@Override
public Player getPlayer() {
return this.player;
}
}
| [
"jakubskibakrk@gmail.com"
] | jakubskibakrk@gmail.com |
a67c7b07317066c086634cb3d9eb9a17a77bb611 | eccaeb13438bcd68810d3e4653da78f4ee6493dd | /SpringTutorialjms/SpringChapter2-AOP/src/com/springtraining/springaop/svc/StatementService.java | 5bc92150132a04f80bea2ce6aba114222886a96e | [
"Apache-2.0"
] | permissive | arthina/springnew | e139a234b730e250b083c716d1248f540433745e | ce844c01bf9010fee701649621f1aa6cee1894c6 | refs/heads/master | 2021-01-18T21:37:10.678762 | 2017-04-02T22:05:13 | 2017-04-02T22:05:13 | 87,016,144 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.springtraining.springaop.svc;
public class StatementService {
private String s6;
public StatementService() {
System.out.println("StatementService() called");
}
public String getS6() {
System.out.println("getS6() called");
return s6;
}
public void setS6(String s6) {
System.out.println("setS6() called");
this.s6 = s6;
}
}
| [
"Thinaharan.Rajalingam@gmail.com"
] | Thinaharan.Rajalingam@gmail.com |
1bbdfb0436ec5e119ff4f85bfd2681c431e1085a | 20c27a0f02a30b7053999944a402acc3cb9627f9 | /test/src/main/java/com/gavin/thread/ThreadJoin.java | a2b42502f9abb1947971d43f5b2d6832ce94bcd9 | [] | no_license | gavin9508/swot-at | 4686b9d460a54ed457a9d58b3fbb8454c2aa569b | 89954476ac7f8458c069d9ed73e50a2d3ea114fa | refs/heads/master | 2023-07-14T07:22:02.726120 | 2021-08-13T09:53:20 | 2021-08-13T09:53:20 | 273,667,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,118 | java | package com.gavin.thread;
/**
* @author gavin
* @version 1.0
* @date 2020/7/31 10:08 上午
* @Description 线程的join示例
*/
public class ThreadJoin {
static class ThreadA implements Runnable {
@Override
public void run() {
try {
System.out.println("我是子线程,我先睡一秒");
Thread.sleep(1000);
System.out.println("我是子线程,我睡完了一秒");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
/**
* @description //join()让当前线程陷入“等待”状态,等join的这个线程执行完成后,再继续执行当前线程。
* @author gavin
* @date 2020/7/31 10:22 上午
* @params * @param args
* @return void
*/
public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new ThreadA());
thread.start();
thread.join();
System.out.println("如果不加join方法,我会先被打出来,加了就不同了");
}
}
| [
"102251937@qq.com"
] | 102251937@qq.com |
7de62afb9207acaccc002459e9d2117298cab2c5 | 0ed1a75bcfdaa03e390037b8d11feef7a2be3cc0 | /generated/org.openhealthtools.mdht.uml.cda.emspcr/src/org/openhealthtools/mdht/uml/cda/emspcr/operations/EmergencyMedicalDispatchObservationOperations.java | d786e02367b1439b9a25d7c2a0d51c5f04cf0daa | [] | no_license | andypardue/mdht-models | f018bb47679efb8c790cf9150b52acacdb145373 | f023ce5cd98e2f33c8632a9d370fa4f9697e7a0d | refs/heads/develop | 2021-01-17T22:19:11.790776 | 2016-09-14T19:37:39 | 2016-09-14T19:37:39 | 68,233,776 | 0 | 0 | null | 2016-09-14T18:51:10 | 2016-09-14T18:51:09 | null | UTF-8 | Java | false | false | 23,806 | java | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.openhealthtools.mdht.uml.cda.emspcr.operations;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.Constraint;
import org.eclipse.ocl.ecore.OCL;
import org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation;
import org.openhealthtools.mdht.uml.cda.emspcr.EmspcrPackage;
import org.openhealthtools.mdht.uml.cda.emspcr.EmspcrPlugin;
import org.openhealthtools.mdht.uml.cda.emspcr.util.EmspcrValidator;
import org.openhealthtools.mdht.uml.cda.operations.ClinicalStatementOperations;
/**
* <!-- begin-user-doc -->
* A static utility class that provides operations related to '<em><b>Emergency Medical Dispatch Observation</b></em>' model objects.
* <!-- end-user-doc -->
*
* <p>
* The following operations are supported:
* <ul>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationTemplateId(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Template Id</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationMoodCode(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Mood Code</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationCodeP(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code P</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationCode(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationValue(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value</em>}</li>
* <li>{@link org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservation#validateEmergencyMedicalDispatchObservationValueP(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value P</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EmergencyMedicalDispatchObservationOperations extends ClinicalStatementOperations {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EmergencyMedicalDispatchObservationOperations() {
super();
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationTemplateId(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Template Id</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationTemplateId(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.1133883.17.3.10.1.73')";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationTemplateId(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Template Id</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationTemplateId(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationTemplateId(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_TEMPLATE_ID,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationTemplateId"),
new Object[] { emergencyMedicalDispatchObservation }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationMoodCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Mood Code</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationMoodCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "isDefined('moodCode')";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationMoodCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Mood Code</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationMoodCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationMoodCode(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_MOOD_CODE,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationMoodCode"),
new Object[] { emergencyMedicalDispatchObservation }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationCodeP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code P</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationCodeP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "(self.code.oclIsUndefined() or self.code.isNullFlavorUndefined()) implies (not self.code.oclIsUndefined())";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationCodeP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code P</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationCodeP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationCodeP(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE_P,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationCodeP"),
new Object[] { emergencyMedicalDispatchObservation }));
}
if (context != null) {
// generate a pass token for my dependent constraints to short-circuit or filter results
@SuppressWarnings("unchecked")
Collection<Object> passToken = (Collection<Object>) context.get("org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservationCodeP");
if (passToken == null) {
// anticipate a reasonably healthy model
passToken = new java.util.ArrayList<Object>(3);
context.put(
"org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservationCodeP", passToken);
}
passToken.add(emergencyMedicalDispatchObservation);
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "(self.code.oclIsUndefined() or self.code.isNullFlavorUndefined()) implies (not self.code.oclIsUndefined() and self.code.oclIsKindOf(datatypes::CD) and "
+ "let value : datatypes::CD = self.code.oclAsType(datatypes::CD) in "
+ "value.code = '67488-7' and value.codeSystem = '2.16.840.1.113883.6.1')";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Code</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationCode(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationCode(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
Object passToken = (context == null)
? null
: context.get("org.openhealthtools.mdht.uml.cda.emspcr.EmergencyMedicalDispatchObservationCodeP");
if ((passToken instanceof Collection<?>) &&
((Collection<?>) passToken).contains(emergencyMedicalDispatchObservation)) {
// I have a free pass to short-circuit
return true;
}
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_CODE,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationCode"),
new Object[] { emergencyMedicalDispatchObservation }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationValue(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationValue(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "(self.value->isEmpty() or self.value->exists(element | element.isNullFlavorUndefined())) implies (self.value->size() = 1 and self.value->forAll(element | not element.oclIsUndefined() and element.oclIsKindOf(datatypes::CD) and "
+ "let value : datatypes::CD = element.oclAsType(datatypes::CD) in "
+ "value.codeSystem = '2.16.840.1.113883.6.1' and (value.code = 'LA17151-4' or value.code = 'LA17152-2' or value.code = 'LA17153-0' or value.code = 'LA32-8')))";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationValue(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationValue(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationValue(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationValue"),
new Object[] { emergencyMedicalDispatchObservation }));
}
return false;
}
return true;
}
/**
* The cached OCL expression body for the '{@link #validateEmergencyMedicalDispatchObservationValueP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value P</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationValueP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static final String VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "(self.value->isEmpty() or self.value->exists(element | element.isNullFlavorUndefined())) implies (self.value->size() = 1 and self.value->forAll(element | element.oclIsTypeOf(datatypes::CD)))";
/**
* The cached OCL invariant for the '{@link #validateEmergencyMedicalDispatchObservationValueP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate Emergency Medical Dispatch Observation Value P</em>}' invariant operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #validateEmergencyMedicalDispatchObservationValueP(EmergencyMedicalDispatchObservation, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
* @ordered
*/
protected static Constraint VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* @param emergencyMedicalDispatchObservation The receiving '<em><b>Emergency Medical Dispatch Observation</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/
public static boolean validateEmergencyMedicalDispatchObservationValueP(
EmergencyMedicalDispatchObservation emergencyMedicalDispatchObservation, DiagnosticChain diagnostics,
Map<Object, Object> context) {
if (VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(EmspcrPackage.Literals.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION);
try {
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
} catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(
VALIDATE_EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(
emergencyMedicalDispatchObservation)) {
if (diagnostics != null) {
diagnostics.add(new BasicDiagnostic(
Diagnostic.ERROR,
EmspcrValidator.DIAGNOSTIC_SOURCE,
EmspcrValidator.EMERGENCY_MEDICAL_DISPATCH_OBSERVATION__EMERGENCY_MEDICAL_DISPATCH_OBSERVATION_VALUE_P,
EmspcrPlugin.INSTANCE.getString("EmergencyMedicalDispatchObservationValueP"),
new Object[] { emergencyMedicalDispatchObservation }));
}
return false;
}
return true;
}
} // EmergencyMedicalDispatchObservationOperations
| [
"seanmuir@c661c0d1-8b1f-4263-bf69-2f84893fd559"
] | seanmuir@c661c0d1-8b1f-4263-bf69-2f84893fd559 |
5b4b042956def809ff5203a1413e5f1de8941710 | 2dc45c0c2d2da29bc3b0ced771e7869f24f44419 | /src/main/java/site/verity/demos/login/web/rest/vm/KeyAndPasswordVM.java | ad38e3be13cbce04285958f50f9b1497fe6c5484 | [] | no_license | dwking2000/loginsample | 8521aa31500a5622d2e230f7d8dab882fa0fd76b | eaab4713223c46d3160711b49d3f9c143511a95f | refs/heads/master | 2020-03-29T04:06:49.999720 | 2018-09-19T21:52:36 | 2018-09-19T21:52:36 | 149,516,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package site.verity.demos.login.web.rest.vm;
/**
* View Model object for storing the user's key and password.
*/
public class KeyAndPasswordVM {
private String key;
private String newPassword;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
b090ff6a224d92b804c262ba2b7714045917f2d6 | f6a21369d16eb2036abeb12ad7edac34eb0dca2e | /ListView/app/src/main/java/com/example/ashleycoleman/listview/PokemonAdapter.java | c8267863e23315731df6c95529738a8de4561234 | [] | no_license | KSU-Mobile-Dev-Club/android-tutorials-F2017 | 5a203389a5328e6fb056adcbdcdd8654965ed7c4 | caa5b7fe5b2e2d760b4785170e0569e336aad944 | refs/heads/master | 2021-07-10T20:17:12.704427 | 2017-10-13T01:03:31 | 2017-10-13T01:03:31 | 103,875,491 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,993 | java | package com.example.ashleycoleman.listview;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.JsonHttpResponseHandler;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import cz.msebera.android.httpclient.Header;
/**
* Created by ashleycoleman on 9/28/17.
*/
public class PokemonAdapter extends BaseAdapter {
private Context context;
private LayoutInflater layoutInflater;
private ArrayList<Pokemon> dataSource;
public PokemonAdapter(Context context, ArrayList<Pokemon> items) {
this.context = context;
this.dataSource = items;
this.layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
return dataSource.size();
}
@Override
public Object getItem(int i) {
return dataSource.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
View rowView = layoutInflater.inflate(R.layout.list_item_pokemon, viewGroup, false);
Pokemon pokemon = (Pokemon)getItem(i);
TextView title = (TextView)rowView.findViewById(R.id.titleTextView);
title.setText(pokemon.name);
ImageView imageView = (ImageView)rowView.findViewById(R.id.pokemonImageView);
Picasso.with(context)
.load(pokemon.imageUrl)
.placeholder(R.mipmap.ic_launcher)
.into(imageView);
return rowView;
}
}
| [
"ashley78@ksu.edu"
] | ashley78@ksu.edu |
c532912d404e8c6c6a0192c3aca0c3e675e79382 | 8ea5182f3a306bebd05123fb4f6f5c434613a613 | /Project6/UnweightedGraph.java | ce97e3375664fb60ec392ee39c1efaf75f496c27 | [] | no_license | faithonwings7/CMSC256 | bed40bc0d45e4f2b27ced9d7796887c993583e18 | ad0367e664ab680d87d3fde81fb437899bcb8d24 | refs/heads/main | 2023-01-20T06:14:14.114413 | 2020-11-24T19:43:46 | 2020-11-24T19:43:46 | 315,729,735 | 1 | 0 | null | 2020-11-24T19:23:00 | 2020-11-24T19:15:02 | Java | UTF-8 | Java | false | false | 8,850 | java | package cmsc256;
import java.util.*;
public class UnweightedGraph<V> implements Graph<V> {
protected List<V> vertices = new ArrayList<>(); // Store vertices
protected List<List<Edge>> neighbors = new ArrayList<>(); // Adjacency lists
/** Construct an empty graph */
public UnweightedGraph() {
}
/** Construct a graph from vertices and edges stored in arrays */
public UnweightedGraph(V[] vertices, int[][] edges) {
for (int i = 0; i < vertices.length; i++)
addVertex(vertices[i]);
createAdjacencyLists(edges, vertices.length);
}
/** Construct a graph from vertices and edges stored in List */
public UnweightedGraph(List<V> vertices, List<Edge> edges) {
for (int i = 0; i < vertices.size(); i++)
addVertex(vertices.get(i));
createAdjacencyLists(edges, vertices.size());
}
/** Construct a graph for integer vertices 0, 1, 2 and edge list */
public UnweightedGraph(List<Edge> edges, int numberOfVertices) {
for (int i = 0; i < numberOfVertices; i++)
addVertex((V)(new Integer(i))); // vertices is {0, 1, ...}
createAdjacencyLists(edges, numberOfVertices);
}
/** Construct a graph from integer vertices 0, 1, and edge array */
public UnweightedGraph(int[][] edges, int numberOfVertices) {
for (int i = 0; i < numberOfVertices; i++)
addVertex((V)(new Integer(i))); // vertices is {0, 1, ...}
createAdjacencyLists(edges, numberOfVertices);
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
int[][] edges, int numberOfVertices) {
for (int i = 0; i < edges.length; i++) {
addEdge(edges[i][0], edges[i][1]);
}
}
/** Create adjacency lists for each vertex */
private void createAdjacencyLists(
List<Edge> edges, int numberOfVertices) {
for (Edge edge: edges) {
addEdge(edge.u, edge.v);
}
}
@Override /** Return the number of vertices in the graph */
public int getSize() {
return vertices.size();
}
@Override /** Return the vertices in the graph */
public List<V> getVertices() {
return vertices;
}
@Override /** Return the object for the specified vertex */
public V getVertex(int index) {
return vertices.get(index);
}
@Override /** Return the index for the specified vertex object */
public int getIndex(V v) {
return vertices.indexOf(v);
}
@Override /** Return the neighbors of the specified vertex */
public List<Integer> getNeighbors(int index) {
List<Integer> result = new ArrayList<>();
for (Edge e: neighbors.get(index))
result.add(e.v);
return result;
}
@Override /** Return the degree for a specified vertex */
public int getDegree(int v) {
return neighbors.get(v).size();
}
@Override /** Print the edges */
public void printEdges() {
for (int u = 0; u < neighbors.size(); u++) {
System.out.print(getVertex(u) + " (" + u + "): ");
for (Edge e: neighbors.get(u)) {
System.out.print("(" + getVertex(e.u) + ", " +
getVertex(e.v) + ") ");
}
System.out.println();
}
}
@Override /** Clear the graph */
public void clear() {
vertices.clear();
neighbors.clear();
}
@Override /** Add a vertex to the graph */
public boolean addVertex(V vertex) {
if (!vertices.contains(vertex)) {
vertices.add(vertex);
neighbors.add(new ArrayList<Edge>());
return true;
}
else {
return false;
}
}
@Override /** Add an edge to the graph */
public boolean addEdge(Edge e) {
System.out.println("e.u < 0: " + (e.u < 0));
System.out.println("get Size: " + (e.u > getSize() - 1));
System.out.println("e.u: " + e.u);
System.out.println("e.v: " + e.v);
if (e.u < 0 || e.u > getSize() - 1)
throw new IllegalArgumentException("No such index - u: " + e.u);
if (e.v < 0 || e.v > getSize() - 1)
throw new IllegalArgumentException("No such index - v: " + e.v);
if (!neighbors.get(e.u).contains(e)) {
neighbors.get(e.u).add(e);
return true;
}
else {
return false;
}
}
@Override /** Add an edge to the graph */
public boolean addEdge(int u, int v) {
return addEdge(new Edge(u, v));
}
@Override /** Obtain a DFS tree starting from vertex u */
public SearchTree dfs(int v) {
List<Integer> searchOrder = new ArrayList<>();
int[] parent = new int[vertices.size()];
for (int i = 0; i < parent.length; i++)
parent[i] = -1; // Initialize parent[i] to -1
// Mark visited vertices
boolean[] isVisited = new boolean[vertices.size()];
// Recursively search
dfs(v, parent, searchOrder, isVisited);
// Return a search tree
return new SearchTree(v, parent, searchOrder);
}
/** Recursive method for DFS search */
private void dfs(int v, int[] parent, List<Integer> searchOrder,
boolean[] isVisited) {
// Store the visited vertex
searchOrder.add(v);
isVisited[v] = true; // Vertex v visited
for (Edge e : neighbors.get(v)) { // Note that e.u is v
if (!isVisited[e.v]) { // e.v is w in Listing 28.8
parent[e.v] = v; // The parent of w is v
dfs(e.v, parent, searchOrder, isVisited); // Recursive search
}
}
}
@Override /** Starting bfs search from vertex v */
public SearchTree bfs(int v) {
List<Integer> searchOrder = new ArrayList<>();
int[] parent = new int[vertices.size()];
for (int i = 0; i < parent.length; i++)
parent[i] = -1; // Initialize parent[i] to -1
java.util.LinkedList<Integer> queue =
new java.util.LinkedList<>(); // list used as a queue
boolean[] isVisited = new boolean[vertices.size()];
queue.offer(v); // Enqueue v
isVisited[v] = true; // Mark it visited
while (!queue.isEmpty()) {
int u = queue.poll(); // Dequeue to u
searchOrder.add(u); // u searched
for (Edge e: neighbors.get(u)) { // Note that e.u is u
if (!isVisited[e.v]) { // e.v is w in Listing 28.11
queue.offer(e.v); // Enqueue w
parent[e.v] = u; // The parent of w is u
isVisited[e.v] = true; // Mark w visited
}
}
}
return new SearchTree(v, parent, searchOrder);
}
/** Tree inner class inside the AbstractGraph class */
public class SearchTree {
private int root; // The root of the tree
private int[] parent; // Store the parent of each vertex
private List<Integer> searchOrder; // Store the search order
/** Construct a tree with root, parent, and searchOrder */
public SearchTree(int root, int[] parent,
List<Integer> searchOrder) {
this.root = root;
this.parent = parent;
this.searchOrder = searchOrder;
}
/** Return the root of the tree */
public int getRoot() {
return root;
}
/** Return the parent of vertex v */
public int getParent(int v) {
return parent[v];
}
/** Return an array representing search order */
public List<Integer> getSearchOrder() {
return searchOrder;
}
/** Return number of vertices found */
public int getNumberOfVerticesFound() {
return searchOrder.size();
}
/** Return the path of vertices from a vertex to the root */
public List<V> getPath(int index) {
ArrayList<V> path = new ArrayList<>();
do {
path.add(vertices.get(index));
index = parent[index];
}
while (index != -1);
return path;
}
/** Print a path from the root to vertex v */
public void printPath(int index) {
List<V> path = getPath(index);
System.out.print("A path from " + vertices.get(root) + " to " +
vertices.get(index) + ": ");
for (int i = path.size() - 1; i >= 0; i--)
System.out.print(path.get(i) + " ");
}
/** Print the whole tree */
public void printTree() {
System.out.println("Root is: " + vertices.get(root));
System.out.print("Edges: ");
for (int i = 0; i < parent.length; i++) {
if (parent[i] != -1) {
// Display an edge
System.out.print("(" + vertices.get(parent[i]) + ", " +
vertices.get(i) + ") ");
}
}
System.out.println();
}
}
@Override /** Remove vertex v and return true if successful */
public boolean remove(V v) {
throw new java.lang.UnsupportedOperationException();
}
@Override /** Remove edge (u, v) and return true if successful */
public boolean remove(int u, int v) {
throw new java.lang.UnsupportedOperationException();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6d6be7fe8495f15465fe0c91aeb76a73223e6ab3 | d7d62a2e48f9b776c98303f8041c15a9cfb031ee | /app/src/main/java/tiger/com/lp/dailydemo/designpatterns/state/day2/PowerOnStatue.java | 1a9c2937f3470439c5790cd6646606905f3c6ea6 | [] | no_license | tigerguixh/DailyDemo | 8777898487698e57f3f1dd17f5df66753aac22c1 | dcd0c79ad690cd9e2904d55c172be854f7542762 | refs/heads/master | 2023-07-25T15:35:13.879510 | 2023-07-10T07:54:37 | 2023-07-10T07:54:37 | 120,845,125 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package tiger.com.lp.dailydemo.designpatterns.state.day2;
/**
* @author : Xunhu.gui
* @Email : xunhu.gui@tadu.com
* @date : 2018/9/28
* @Description :
*/
public class PowerOnStatue implements TvStatue{
@Override
public void nextChannel() {
System.out.println("下一频道");
}
@Override
public void prevChannel() {
System.out.println("上一频道");
}
@Override
public void turnUp() {
System.out.println("调高音量");
}
@Override
public void turnDown() {
System.out.println("调低音量");
}
}
| [
"xunhu.gui@tadu.com"
] | xunhu.gui@tadu.com |
1661f17c98d4ec69e0365a9c66fff01ca32822bf | 79a6c54645fc508b514aea1cf060661ed273b5ea | /L2J_Server_Tauti_BETA/java/com/l2jserver/gameserver/model/actor/knownlist/MonsterKnownList.java | a7fd4adb9bd3986b2dbfc007a75e20e584d83b98 | [] | no_license | sandy1890/l2jkr | 571c0bcc84f1708bba96b09517374792e39d8829 | 27ea6baffa455ca427d8d51f007a1b91d953b642 | refs/heads/master | 2021-01-10T04:02:20.077563 | 2013-01-20T18:12:09 | 2013-01-20T18:12:09 | 48,476,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,806 | java | /*
* Copyright (C) 2004-2013 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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 3 of the License, or
* (at your option) any later version.
*
* L2J Server 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, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.gameserver.model.actor.knownlist;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.ai.L2CharacterAI;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
public class MonsterKnownList extends AttackableKnownList {
public MonsterKnownList(L2MonsterInstance activeChar) {
super(activeChar);
}
@Override
public boolean addKnownObject(L2Object object) {
if (!super.addKnownObject(object)) {
return false;
}
final L2CharacterAI ai = getActiveChar().getAI(); // force AI creation
// Set the L2MonsterInstance Intention to AI_INTENTION_ACTIVE if the state was AI_INTENTION_IDLE
if ((object instanceof L2PcInstance) && (ai != null) && (ai.getIntention() == CtrlIntention.AI_INTENTION_IDLE)) {
ai.setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
}
return true;
}
@Override
protected boolean removeKnownObject(L2Object object, boolean forget) {
if (!super.removeKnownObject(object, forget)) {
return false;
}
if (!(object instanceof L2Character)) {
return true;
}
if (getActiveChar().hasAI()) {
// Notify the L2MonsterInstance AI with EVT_FORGET_OBJECT
getActiveChar().getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);
}
if (getActiveChar().isVisible() && getKnownPlayers().isEmpty() && getKnownSummons().isEmpty()) {
// Clear the _aggroList of the L2MonsterInstance
getActiveChar().clearAggroList();
// Remove all L2Object from _knownObjects and _knownPlayer of the L2MonsterInstance then cancel Attak or Cast and notify AI
// removeAllKnownObjects();
}
return true;
}
@Override
public final L2MonsterInstance getActiveChar() {
return (L2MonsterInstance) super.getActiveChar();
}
}
| [
"lineage2kr@gmail.com"
] | lineage2kr@gmail.com |
42028c6af4a80b079ba57b10783373c009e2def0 | 5831801ef2f2a10d4fd982651dc005b4ab013ae5 | /R-5.10/src/ArraySum.java | df0728495de461ff33d17019d4bdeeb180cba3ec | [] | no_license | BryPo13/cs2711 | 739eb8a808795a8a90a7190074db7b436958c2ae | ac4e1c58889b7adc945e0a52908d12b934bfc372 | refs/heads/master | 2021-01-12T10:46:39.839969 | 2016-11-02T23:42:19 | 2016-11-02T23:42:19 | 72,689,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java |
public class ArraySum {
public static void main(String[] args) {
int[][] array1 = new int[][] { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 }, { 13, 14, 15, 16 }};
System.out.println(sumMatrix(array1,0,0));
}
public static int sumMatrix ( int[][] matrix , int rowNum, int colNum){
int size = matrix.length;
if (colNum == size){
return sumMatrix(matrix, rowNum + 1, 0);
}
else if (rowNum == size){
return 0;
}
else
return (matrix[rowNum][colNum] + sumMatrix(matrix, rowNum,colNum + 1));
}
}
| [
"bryan power"
] | bryan power |
d0cda8ee3c82cbf1bd82e33596e41ace4c77b4f8 | 3a181109a63727936532b2df3b70894e7e89c58c | /15-PropertiesFileWithJavaConfig/src/main/java/com/project/config/JavaConfig.java | cc3d16e241f301f46af0d3a4bb4d6099ac3dfd07 | [] | no_license | tahatopal1/Spring-and-Hibernate | 30feea57a69968619209072c800d6ee5fde090a5 | 743b01bcc2f6c56597907fc0094e86d7c7413c34 | refs/heads/main | 2023-07-12T06:04:40.209681 | 2021-08-13T19:18:27 | 2021-08-13T19:18:27 | 395,768,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.project.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import com.project.model.Member;
@Configuration
@PropertySource("classpath:member.properties")
public class JavaConfig {
@Bean
public Member memberBean() {
return new Member();
}
}
| [
"taha.topal.7@gmail.com"
] | taha.topal.7@gmail.com |
2336200b2ce0c512c1ac257708093ae85b9a7e53 | 92ee47afcf9d52affe0332e6aa04a571a34c6069 | /app/src/main/java/com/androidbelieve/islamicquiz/UpdatesFragment.java | f6b245be0d1deb1da3b3b0c58ab4d15cb5cd8bf9 | [] | no_license | shameersss1/IQ-Quiz | e766cd90520eda75bf0d75a11da9627b72e3d217 | 07b2ae64c0824e4fc654ff0d11efea7f29886a7f | refs/heads/master | 2021-09-07T15:50:20.920108 | 2018-02-25T13:22:19 | 2018-02-25T13:22:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 559 | java | package com.androidbelieve.islamicquiz;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by Ratan on 7/29/2015.
*/
public class UpdatesFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.updates_layout,null);
}
}
| [
"syedthameem1@gmail.com"
] | syedthameem1@gmail.com |
aabdd6a7d7a020883a107be63d4183c0fa005f7a | 26e566b017332b097cacd9f3f4d3c05515be0ac8 | /ExpenseReimbursementSystem/src/main/java/com/revature/dao/ReimbursementDao.java | bfcd813915f58bc40a96a46f57cbe0c4bd56cf12 | [
"MIT"
] | permissive | 1804Apr23Java/MubangJ | f996c39b99460a9298fc1a50537ac25806697248 | 7674d53d8c773321c58a85dada810fed8e0200ff | refs/heads/master | 2020-03-12T16:32:54.246599 | 2018-06-04T19:48:14 | 2018-06-04T19:48:14 | 130,718,304 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | package com.revature.dao;
import java.io.File;
import java.io.InputStream;
import java.util.List;
import com.revature.exceptions.InvalidImageException;
import com.revature.exceptions.ReimbursementDoesNotExistException;
import com.revature.tables.Reimbursement;
public interface ReimbursementDao {
boolean createReimbursement(int employeeId, int managerId, String purpose, InputStream image, int status, double amount) throws InvalidImageException;
Reimbursement getReimbursement(int reimbursementId) throws ReimbursementDoesNotExistException;
List<Reimbursement> getEmpReimbursements(int employeeId) throws ReimbursementDoesNotExistException;
List<Reimbursement> getManReimbursements() throws ReimbursementDoesNotExistException;
boolean updateImage(int reimbursementId, File image) throws ReimbursementDoesNotExistException;
boolean updateStatus(int reimbursementId, int status) throws ReimbursementDoesNotExistException;
boolean updateAmount(int reimbursementId, double amount) throws ReimbursementDoesNotExistException;
boolean deleteReimbursement(int reimbursementId) throws ReimbursementDoesNotExistException;
boolean deleteAllReimbursementsByEmpId(int employeeId) throws ReimbursementDoesNotExistException;
boolean deleteAllReimbursementsByManId(int managerId) throws ReimbursementDoesNotExistException;
}
| [
"jmubang@gmail.com"
] | jmubang@gmail.com |
90b6280b7d53473e8a7450eb7bd207babb177e85 | 501fe6b32906c2c15fd0f0a6fc8750630a9ef6be | /src/main/java/app/ExceptionHandler/exceptions/LimitException.java | 5bd3e38e09c50765111aa79fff847a142c3bf124 | [] | no_license | moonk1d/SpringBootRestBlog | 312d516deb206e0120df5ac0cceb648e5409188f | fe0d9a37179446b6f8c7548e16ce87d351eca772 | refs/heads/master | 2021-10-16T14:39:41.293868 | 2018-09-27T12:56:36 | 2018-09-27T12:56:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 554 | java | package app.ExceptionHandler.exceptions;
import app.enums.ErrorMessages;
import lombok.Data;
/**
* Created by Andrey Nazarov on 9/18/2018.
*/
@Data
public class LimitException extends CustomApiException {
private static final long serialVersionUID = 1L;
public LimitException() {
super(ErrorMessages.LIMIT.getMessage(), ErrorMessages.LIMIT.getCode());
}
public LimitException(String errorMessage, String code) {
super(errorMessage, code);
this.code = code;
this.errorMessage = errorMessage;
}
}
| [
"andreu.nazarov@nixsolutions.com"
] | andreu.nazarov@nixsolutions.com |
2d538d4272fb4903b260a905b9d6a87d912c6d59 | 86455661a2f3e305be143fb17a0dcdc0736ee4c9 | /iRobots/src/irobots/behaviour/LineBehaviour.java | 0643e07d10adfe8999282205263dc66bb7869428 | [] | no_license | masteroftime/iRobots | c5a56ab95e6f99656be47f9a4efd8fac39897957 | 802ae999d9cb80daf08c5925295930c0e56521cc | refs/heads/master | 2021-01-10T19:01:09.722492 | 2013-04-19T09:35:55 | 2013-04-19T09:35:55 | 6,124,279 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,751 | java | package irobots.behaviour;
import irobots.Global;
import irobots.comm.Robot;
import irobots.vision.ColorSensor;
import javax.microedition.lcdui.Graphics;
import lejos.robotics.navigation.DifferentialPilot;
import lejos.robotics.navigation.Navigator;
import lejos.robotics.subsumption.Behavior;
/**
* This Behavior causes the robot not to cross the line which marks
* the field boundaries if it is detected. When the line is detected
* the robot will do a 180° turn and then pass control to subsequent
* behaviors.
*/
public class LineBehaviour implements Behavior {
public static final float FIELD_WIDTH = 90;
public static final float FIELD_HEIGHT = 90;
private Navigator nav;
private ColorSensor color;
private DifferentialPilot pilot;
public LineBehaviour() {
this.nav = Global.navigator;
this.color = Global.color;
this.pilot = (DifferentialPilot)nav.getMoveController();
}
/**
* Takes control when the line is detected by the color sensor.
*/
@Override
public boolean takeControl() {
if(color.lineDetected()) {
//pilot.stop();
return true;
}
return false;
}
/**
* Turns the robot 180° and then passes control to other behaviours
*/
@Override
public void action() {
//************* DRAWING ****************
Graphics g = new Graphics();
g.fillRect(0, 0, 100, 63);
g.setColor(1);
//************* DRAWING ****************
//calculate new heading
float deg = Global.compass.getDegrees();
float heading = deg+170;
if(heading > 360) heading -= 360;
DifferentialPilot p = (DifferentialPilot)nav.getMoveController();
p.stop();
p.travel(-5);
//BeSt prototype: when following the robot outside the field do not turn but just go back a bit
if(!Global.camera.robotDetected()) {
p.rotate(170);
//when the line is still detected correct the turning withe the value from the compass
if(Global.color.lineDetected()) {
float diff = Global.compass.getDegrees()-heading;
p.rotate(diff);
}
} else {
p.travel(-5);
}
//update the position in Robot.me
Robot.me = Robot.meFromPose(nav.getPoseProvider().getPose());
//reset the robot position if its out of the fields boundaries
if(Robot.me.getX() < 0) {
Robot.me.setFixedX(0);
}
if(Robot.me.getY() < 0) {
Robot.me.setFixedY(0);
}
if(Robot.me.getX() > FIELD_WIDTH+5) {
Robot.me.setFixedX(FIELD_WIDTH);
}
if(Robot.me.getY() > FIELD_HEIGHT+5) {
Robot.me.setFixedY(FIELD_HEIGHT);
}
//update the position in the navigator
nav.getPoseProvider().setPose(Robot.me);
}
/**
* Not going out of the line boundaries has the highest priority
* and cannot be supressed so supress does nothing.
*/
@Override
public void suppress() {
return;
}
}
| [
"martinfeiler@hotmail.com"
] | martinfeiler@hotmail.com |
bd6a7afe0b2f8dbe94bb4f2895cb49e8eb8bfc39 | 498dd2daff74247c83a698135e4fe728de93585a | /clients/google-api-services-cloudasset/v1p5beta1/1.30.1/com/google/api/services/cloudasset/v1p5beta1/model/GoogleIdentityAccesscontextmanagerV1AccessPolicy.java | bb661ee81f0a536cddf52331ec17b5826a8c51aa | [
"Apache-2.0"
] | permissive | googleapis/google-api-java-client-services | 0e2d474988d9b692c2404d444c248ea57b1f453d | eb359dd2ad555431c5bc7deaeafca11af08eee43 | refs/heads/main | 2023-08-23T00:17:30.601626 | 2023-08-20T02:16:12 | 2023-08-20T02:16:12 | 147,399,159 | 545 | 390 | Apache-2.0 | 2023-09-14T02:14:14 | 2018-09-04T19:11:33 | null | UTF-8 | Java | false | false | 5,631 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.cloudasset.v1p5beta1.model;
/**
* `AccessPolicy` is a container for `AccessLevels` (which define the necessary attributes to use
* Google Cloud services) and `ServicePerimeters` (which define regions of services able to freely
* pass data within a perimeter). An access policy is globally visible within an organization, and
* the restrictions it specifies apply to all projects within an organization.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Asset API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class GoogleIdentityAccesscontextmanagerV1AccessPolicy extends com.google.api.client.json.GenericJson {
/**
* Output only. An opaque identifier for the current version of the `AccessPolicy`. This will
* always be a strongly validated etag, meaning that two Access Polices will be identical if and
* only if their etags are identical. Clients should not expect this to be in any specific format.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String etag;
/**
* Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/**
* Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently
* immutable once created. Format: `organizations/{organization_id}`
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/**
* Required. Human readable title. Does not affect behavior.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String title;
/**
* Output only. An opaque identifier for the current version of the `AccessPolicy`. This will
* always be a strongly validated etag, meaning that two Access Polices will be identical if and
* only if their etags are identical. Clients should not expect this to be in any specific format.
* @return value or {@code null} for none
*/
public java.lang.String getEtag() {
return etag;
}
/**
* Output only. An opaque identifier for the current version of the `AccessPolicy`. This will
* always be a strongly validated etag, meaning that two Access Polices will be identical if and
* only if their etags are identical. Clients should not expect this to be in any specific format.
* @param etag etag or {@code null} for none
*/
public GoogleIdentityAccesscontextmanagerV1AccessPolicy setEtag(java.lang.String etag) {
this.etag = etag;
return this;
}
/**
* Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
* @return value or {@code null} for none
*/
public java.lang.String getName() {
return name;
}
/**
* Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{policy_id}`
* @param name name or {@code null} for none
*/
public GoogleIdentityAccesscontextmanagerV1AccessPolicy setName(java.lang.String name) {
this.name = name;
return this;
}
/**
* Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently
* immutable once created. Format: `organizations/{organization_id}`
* @return value or {@code null} for none
*/
public java.lang.String getParent() {
return parent;
}
/**
* Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently
* immutable once created. Format: `organizations/{organization_id}`
* @param parent parent or {@code null} for none
*/
public GoogleIdentityAccesscontextmanagerV1AccessPolicy setParent(java.lang.String parent) {
this.parent = parent;
return this;
}
/**
* Required. Human readable title. Does not affect behavior.
* @return value or {@code null} for none
*/
public java.lang.String getTitle() {
return title;
}
/**
* Required. Human readable title. Does not affect behavior.
* @param title title or {@code null} for none
*/
public GoogleIdentityAccesscontextmanagerV1AccessPolicy setTitle(java.lang.String title) {
this.title = title;
return this;
}
@Override
public GoogleIdentityAccesscontextmanagerV1AccessPolicy set(String fieldName, Object value) {
return (GoogleIdentityAccesscontextmanagerV1AccessPolicy) super.set(fieldName, value);
}
@Override
public GoogleIdentityAccesscontextmanagerV1AccessPolicy clone() {
return (GoogleIdentityAccesscontextmanagerV1AccessPolicy) super.clone();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
17631f8f260590a87b890e1d40beeaa408a38766 | 4bed0a9e332e49812fb2cec523976d927395786f | /src/main/java/pages/DelPhone.java | d227ed99f853e47010fe9c31ffa9c034a0e6cc02 | [] | no_license | RamyaSubburaj/RamyaSubburaj | 7443b87e18693d0d7dd5b1e489d6e1b4dc1414cd | 5cedb818852abc96dada851effb3dd5a101822ee | refs/heads/master | 2020-03-19T18:17:43.117794 | 2018-06-10T12:58:20 | 2018-06-10T12:58:20 | 136,803,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,486 | java | package pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import wdMethods.ProjectMethods;
public class DelPhone extends ProjectMethods {
public DelPhone() {
PageFactory.initElements(driver,this);
}
@FindBy(how=How.XPATH,using="//span[contains(text(),'Phone')]")
private WebElement elephone;
public DelPhone phone(String data) {
type(elephone, data);
return this;
}
@FindBy(how=How.XPATH,using="//input[@name='phoneCountryCode")
private WebElement elecountrycode;
public DelPhone countrycode(String data) {
type(elecountrycode, data);
return this;
}
@FindBy(how=How.XPATH,using="//input[@name='phoneAreaCode']")
private WebElement eleareacode;
public DelPhone areacode(String data) {
type(eleareacode, data);
return this;
}
@FindBy(how=How.XPATH,using="//input[@name='phoneNumber']")
private WebElement elephonenumber;
public DelPhone phonenumber(String data) {
type(elephonenumber, data);
return this;
}
@FindBy(how=How.XPATH,using="//button[contains(text(),'Find Leads')]")
private WebElement eledelfindleads;
public DelPhone delfindleads(String data) {
type(eledelfindleads, data);
return this;
}
@FindBy(how=How.XPATH,using="(//a[@class='linktext'])[4]")
private WebElement eledelresult;
public DelView delresult(String data) {
type(eledelresult, data);
return new DelView();
}
}
| [
"ramya@localhost"
] | ramya@localhost |
d3295fa5024079baade114d90e8dd6198cfb6f32 | d6a9264a4cba0804404750aa7844592230736cea | /Grupia/app/src/main/java/g/rezza/moch/grupia/component/ChapterDialog.java | 7bd145aaeee68a2adc54046392912d5273dd011d | [] | no_license | rezza1001/AndroidApps | 509bd03198c58108d2c170db8b3c1dd068859565 | d0b4662355c2f8d09a9ece4fd25f537867ea3373 | refs/heads/master | 2020-03-17T20:02:47.492213 | 2018-07-01T01:00:36 | 2018-07-01T01:00:36 | 133,890,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,620 | java | package g.rezza.moch.grupia.component;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Window;
import android.widget.ListView;
import java.util.ArrayList;
import g.rezza.moch.grupia.R;
import g.rezza.moch.grupia.adapter.ChapterAdapter;
/**
* Created by rezza on 26/02/18.
*/
public class ChapterDialog extends Dialog {
private ListView lsvw_chapter_00;
private ArrayList<String> mHolders = new ArrayList<>();
private ChapterAdapter adapter;
public ChapterDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.component_dialog_chapter);
lsvw_chapter_00 = (ListView) findViewById(R.id.lsvw_chapter_00);
adapter = new ChapterAdapter(getContext(), mHolders);
lsvw_chapter_00.setAdapter(adapter);
adapter.setOnSelectedItemListener(new ChapterAdapter.OnSelectedItemListener() {
@Override
public void selectedItem(String holder, int position) {
if (mListener != null){
mListener.onClick(holder);
}
ChapterDialog.this.dismiss();
}
});
}
public void create(){
this.show();
mHolders.add("HCI CHAPTER JPUTSEL");
mHolders.add("HCI CHAPTER JBTANG");
mHolders.add("HCI CHAPTER JTBEK");
mHolders.add("HCI CHAPTER DEBORA");
mHolders.add("HCI CHAPTER BANDUNG");
mHolders.add("HCI CHAPTER JATENG");
mHolders.add("HCI CHAPTER BALI");
mHolders.add("HCI CHAPTER ACEH");
mHolders.add("HCI CHAPTER MAKASSAR");
mHolders.add("HCI CHAPTER KALTENG");
mHolders.add("HCI REGIONAL JATIM");
mHolders.add("HCI CHAPTER GRESIK – JATIM");
mHolders.add("HCI CHAPTER SIDOARJO – JATIM");
mHolders.add("HCI CHAPTER PLAT AG – JATIM");
mHolders.add("HCI CHAPTER PLAT S – JATIM");
mHolders.add("HCI CHAPTER SURABAYA – JATIM");
mHolders.add("HCI CHAPTER PLAT N – JATIM");
adapter.notifyDataSetChanged();
}
private OnClickListener mListener;
public void setOnClickListener(OnClickListener positifClickListener){
mListener = positifClickListener;
}
/*
* Interface Listener
*/
public interface OnClickListener{
public void onClick(String chapter);
}
}
| [
"rezza.gumilang@pulaukencana.co.id"
] | rezza.gumilang@pulaukencana.co.id |
935f4cf04b6d947dd472d01a26062111d3a04e3d | df5a4e0b9024280e8ba0d588a03e1f8dc02c95c3 | /hotel-reservation/src/main/java/com/demo/reservation/ExtrasService.java | 86ed1e5403283a77f200732d4cd773f54763d9fa | [] | no_license | nitindptl/hotel-reservation | 149707ebdc6b001398e48da3676e5fd1e0c7583a | 38608612d98739edd535dfdd2beec17f5034756f | refs/heads/main | 2023-05-14T08:18:02.364637 | 2021-06-07T07:11:41 | 2021-06-07T07:11:41 | 374,567,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,044 | java | package com.demo.reservation;
import com.demo.domain.Extra;
import com.demo.domain.MealPlan;
import com.demo.domain.Reservation;
import com.demo.domain.RoomType;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class ExtrasService {
private ExtraRepository extraRepository;
public ExtrasService(ExtraRepository extraRepository) {
this.extraRepository = extraRepository;
}
public List<Extra> getGeneralExtras(Extra.Type type) {
return extraRepository.findAllByTypeAndCategory(type, Extra.Category.General);
}
public List<Extra> getFoodExtras(Extra.Type type) {
return extraRepository.findAllByTypeAndCategory(type, Extra.Category.Food);
}
public List<Extra> getExtrasById(List<Long> ids) {
List<Extra> target = new ArrayList<>();
extraRepository.findAllById(ids).forEach(target::add);
return target;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
e70d6f08d74ec9bd65f71de021d20b2040b8ce2a | 99dba4cd8b4b9a0dea7495e196bdc894c214d87a | /ViewPagerIndicator/build/generated/source/buildConfig/androidTest/debug/com/viewpagerindicator/test/BuildConfig.java | c0bbd81fa40220ee2554607580e70b14b393cb54 | [
"Apache-2.0"
] | permissive | wada811/Android-ViewPagerIndicator | 003e0aa0190e3d53a663a327321048ed9a8f0a21 | 1f2c076b877c0fde916ed5dbc1d2bfa43cab91c6 | refs/heads/master | 2021-01-14T08:50:56.970430 | 2015-07-09T05:59:15 | 2015-07-09T05:59:15 | 38,683,358 | 6 | 1 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.viewpagerindicator.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.viewpagerindicator.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 65;
public static final String VERSION_NAME = "2.4.1";
}
| [
"at.wada811@gmail.com"
] | at.wada811@gmail.com |
c5e518a6af2f114c20cce0ed18e767c6fd2036c8 | 7e7dd71ea41dd1db720808675648d7e9666858a3 | /module-1/03_Expressions/student-exercise/java/src/main/java/com/techelevator/Exercises.java | 52245476cb0259d8d154473d30afbdccaa5299e6 | [] | no_license | averyhargrave/TEwork | cb15a21a01d31b2e83063a8a6882f23687903150 | 2f3da0a86ee6076386fbd5474385835a8da2fdfc | refs/heads/master | 2023-04-14T19:20:57.690374 | 2021-04-16T13:18:00 | 2021-04-16T13:18:00 | 358,598,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,458 | java | package com.techelevator;
public class Exercises {
/*
1. The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on
vacation. We sleep in if it is not a weekday or we're on vacation. Return true if we sleep in.
Examples of parameters passed and the expected result (NOT all possible combinations will be given as examples)
sleepIn(false, false) => true - if false, false is passed, returns true
sleepIn(true, false) => false - if true, false is passed, return false
sleepIn(false, true) => true - if false, true is passed, return true
*/
public boolean sleepIn(boolean weekday, boolean vacation) {
if (weekday == false && vacation == false) {
return true;
} if (weekday == true && vacation == false) {
return false;
} if (weekday == false && vacation == true) {
return true;
} if (weekday == true && vacation == true) {
return true;
}
return false;
}
/*
2. We have two monkeys, a and b, and the parameters aSmile and bSmile indicate if each is smiling.
We are in trouble if they are both smiling or if neither of them is smiling. Return true if we
are in trouble.
monkeyTrouble(true, true) → true
monkeyTrouble(false, false) → true
monkeyTrouble(true, false) → false
*/
public boolean monkeyTrouble(boolean aSmile, boolean bSmile) {
if (aSmile == true && bSmile == true) {
return true;
} if (aSmile == false && bSmile == false) {
return true;
}
return false;
}
/*
3. Given two int values, return their sum. Unless the two values are the same, then return double their sum.
sumDouble(1, 2) → 3
sumDouble(3, 2) → 5
sumDouble(2, 2) → 8
*/
public int sumDouble(int a, int b) {
if (a == b) {
return (a + b) * 2;
} if (a != b) {
return (a + b);
}
return 0;
}
/*
4. Given an int n, return the absolute difference between n and 21, except return double the absolute
difference if n is over 21.
diff21(19) → 2
diff21(10) → 11
diff21(21) → 0
diff21(22) → 2
diff21(-10) → 31
*/
public int diff21(int n) {
if (n <= 21) {
return (21 - n);
} else if (n > 21) {
return ((n - 21) * 2);
}
return 0;
}
/*
5. We have a loud talking parrot. The "hour" parameter is the current hour time in the range 0..23.
We are in trouble if the parrot is talking and the hour is before 7 or after 20. Return true if
we are in trouble.
parrotTrouble(true, 6) → true
parrotTrouble(true, 7) → false
parrotTrouble(false, 6) → false
*/
public boolean parrotTrouble(boolean talking, int hour) {
if (talking == true && hour < 7) {
return true;
} if (talking == true && hour > 20) {
return true;
}
return false;
}
/*
6. Given 2 ints, a and b, return true if one if them is 10 or if their sum is 10.
makes10(9, 10) → true
makes10(9, 9) → false
makes10(1, 9) → true
*/
public boolean makes10(int a, int b) {
if ((a + b) == 10) {
return true;
} if (a == 10 || b == 10) {
return true;
}
return false;
}
/*
7. Given 2 int values, return true if one is negative and one is positive. Except if the parameter
"negative" is true, then return true only if both are negative.
posNeg(1, -1, false) → true
posNeg(-1, 1, false) → true
posNeg(-4, -5, true) → true
*/
public boolean posNeg(int a, int b, boolean negative) {
if (b < 0 && a > 0 && negative == false) {
return true;
} if (a < 0 && b > 0 && negative == false) {
return true;
} if (a < 0 && b < 0 && negative == true) {
return true;
}
return false;
}
/*
8. Return true if the given non-negative number is a multiple of 3 or a multiple of 5.
(Hint: Think "mod".)
or35(3) → true
or35(10) → true
or35(8) → false
*/
public boolean or35(int n) {
if (n % 3 == 0) {
return true;
} if (n % 5 == 0) {
return true;
}
return false;
}
/*
9. Given two temperatures, return true if one is less than 0 and the other is greater than 100.
icyHot(120, -1) → true
icyHot(-1, 120) → true
icyHot(2, 120) → false
*/
public boolean icyHot(int temp1, int temp2) {
if (temp1 < 0 && temp2 > 100) {
return true;
} if (temp1 > 100 && temp2 < 0) {
return true;
} if ((temp1 > 0 || temp1 < 100) && (temp2 > 0 || temp2 < 100)) {
return false;
}
return false;
}
/*
10. Given 2 int values, return true if either of them is in the range 10..20 inclusive.
in1020(12, 99) → true
in1020(21, 12) → true
in1020(8, 99) → false
*/
public boolean in1020(int a, int b) {
if (a >= 10 && a <= 20) {
return true;
}
if (b >= 10 && b <= 20) {
return true;
}
return false;
}
/*
11. We'll say that a number is "teen" if it is in the range 13..19 inclusive. Given 3 int values,
return true if 1 or more of them are teen.
hasTeen(13, 20, 10) → true
hasTeen(20, 19, 10) → true
hasTeen(20, 10, 13) → true
*/
public boolean hasTeen(int a, int b, int c) {
if (a >= 13 && a <= 19) {
return true;
} if (b >= 13 && b <=19) {
return true;
} if (c >= 13 && c <=19) {
return true;
}
return false;
}
/*
12. We'll say that a number is "teen" if it is in the range 13..19 inclusive. Given 2 int values,
return true if one or the other is teen, but not both.
loneTeen(13, 99) → true
loneTeen(21, 19) → true
loneTeen(13, 13) → false
*/
public boolean loneTeen(int a, int b) {
if ((a >= 13 && a <= 19) ^ (b >= 13 && b <=19)) {
return true;
}
return false;
}
/*
13. Given three int values, a b c, return the largest.
intMax(1, 2, 3) → 3
intMax(1, 3, 2) → 3
intMax(3, 2, 1) → 3
*/
public int intMax(int a, int b, int c) {
if ((a >= b) && (a >= c)) {
return a;
} if ((b >= a) && (b >= c)) {
return b;
} if ((c >= a) && (c >= b)) {
return c;
}
return 0;
}
/*
14. Given 2 int values, return true if they are both in the range 30..40 inclusive, or they are both
in the range 40..50 inclusive.
in3050(30, 31) → true
in3050(30, 41) → false
in3050(40, 50) → true
*/
public boolean in3050(int a, int b) {
if ((a >= 30 && a <= 40) && (b >=30 && b <= 40)) {
return true;
} if ((a >= 40 && a <= 50) && (b >= 40 && b <= 50)) {
return true;
}
return false;
}
/*
15. Given 2 int values, return the larger value that is in the range 10..20 inclusive,
or return 0 if neither is in that range.
max1020(11, 19) → 19
max1020(19, 11) → 19
max1020(11, 9) → 11
*/
public int max1020(int a, int b) {
boolean aInRange = (a >=10 && a <=20);
boolean bInRange = (b >=10 && a <=20);
if (aInRange && !bInRange) { // if b is not in range and a is in range
return a;
} if (!aInRange && bInRange) { // if a is not in range and b is in range
return b;
}
{
if (aInRange && bInRange) { // if both are in range
if (a > b) { // if a > b
return a;
}
else { // if b > a
return b;
}
} else
return 0;
}
}
/*
16. When squirrels get together for a party, they like to have cigars. A squirrel party is successful
when the number of cigars is between 40 and 60, inclusive. Unless it is the weekend, in which case
there is no upper bound on the number of cigars. Return true if the party with the given values is
successful, or false otherwise.
cigarParty(30, false) → false
cigarParty(50, false) → true
cigarParty(70, true) → true
*/
public boolean cigarParty(int cigars, boolean isWeekend) {
if (isWeekend == false && cigars >= 40 && cigars <= 60) {
return true;
} if (isWeekend == true && cigars >= 40) {
return true;
}
return false;
}
/*
17. You and your date are trying to get a table at a restaurant. The parameter "you" is the stylishness
of your clothes, in the range 0..10, and "date" is the stylishness of your date's clothes. The result
returned will be 0 if you did not get the table, 1 if you might get the table, and 2 if you did get
the table. If you or your date is very stylish (8 or more), then the result is 2 (yes). With the
exception that if either of you has style of 2 or less, then the result is 0 (no). Otherwise the
result is 1 (maybe).
dateFashion(5, 10) → 2
dateFashion(5, 2) → 0
dateFashion(5, 5) → 1
*/
public int dateFashion(int you, int date) {
if (date <=2 || you <=2) {
return 0;
}
if (date >= 8 || you >= 8 && (you > 2 && date > 2)) {
return 2;
} if (date >= 3 && you >= 3) {
return 1;
}
return 0;
}
/*
18. The squirrels in Palo Alto spend most of the day playing. In particular, they play if the temperature
is between 60 and 90 (inclusive). Unless it is summer, then the upper limit is 100 instead of 90. Given
an int temperature and a boolean isSummer, return true if the squirrels play and false otherwise.
squirrelPlay(70, false) → true
squirrelPlay(95, false) → false
squirrelPlay(95, true) → true
*/
public boolean squirrelPlay(int temp, boolean isSummer) {
if (isSummer == true && temp >= 60 && temp <= 100) {
return true;
} if (isSummer == false && temp >= 60 && temp <= 90) {
return true;
}
return false;
}
/*
19. Dessert Island Diner believes a meal isn't a meal without dessert. All meals come with
a free dessert.
There are three categories of free desserts: "standard", "special", and "ginormous".
The meal amount determines the dessert category: <= $10 (standard), <= $15 (special),
> $15 (ginormous). Unless it is your birthday -- on that day, an additional $5 is added
when calculating the category to potentially bump you up to the next delicious category.
For instance, if the amount of the meal was $7, and it is your birthday, $5 is added to
$7 when determining the dessert category, which means you would qualify for a "special".
yourCakeAndEatItToo(4.99, false) → "standard"
yourCakeAndEatItToo(4.99, true) → "standard"
yourCakeAndEatItToo(7.00, false) → "standard"
yourCakeAndEatItToo(7.00, true) → "special"
yourCakeAndEatItToo(10.00, false) → "standard"
yourCakeAndEatItToo(10.00, true) → "special"
yourCakeAndEatItToo(11.00, false) → "special"
*/
public String yourCakeAndEatItToo(double mealAmount, boolean isBirthday) {
if (isBirthday) {
mealAmount = mealAmount + 5;
}
if (mealAmount <=10) {
return "standard";
}
if (mealAmount <= 15) {//come back
return "special";
}
if (mealAmount > 15) {
return "ginormous";
}
return "";
}
/*
20. Given 2 ints, a and b, return their sum. However, sums in the range 10..19 inclusive, are forbidden,
so in that case just return 20.
sortaSum(3, 4) → 7
sortaSum(9, 4) → 20
sortaSum(10, 11) → 21
*/
public int sortaSum(int a, int b) {
if (a + b >= 10 && a + b <=19) {
return 20;
} if ((a + b) < 10 || (a + b) > 19) {
return (a + b);
}
return 0;
}
/*
21. Given a day of the week encoded as 0=Sun, 1=Mon, 2=Tue, ...6=Sat, and a boolean indicating if we are
on vacation, return a string of the form "7:00" indicating when the alarm clock should ring. Weekdays,
the alarm should be "7:00" and on the weekend it should be "10:00". Unless we are on vacation -- then
on weekdays it should be "10:00" and weekends it should be "off".
alarmClock(1, false) → "7:00"
alarmClock(5, false) → "7:00"
alarmClock(0, false) → "10:00"
*/
public String alarmClock(int day, boolean vacation) {
if ((day > 0 && day < 6) && vacation == true) {
return "10:00";
} if ((day == 0 || day >= 6) && vacation == true) {
return "off";
} if ((day > 0 && day < 6) && vacation == false) {
return "7:00";
} if ((day == 0 || day >= 6) && vacation == false) {
return "10:00";
}
return "";
}
/*
22. Given a number n, return true if n is in the range 1..10, inclusive. Unless "outsideMode" is true,
in which case return true if the number is less or equal to 1, or greater or equal to 10.
in1To10(5, false) → true
in1To10(11, false) → false
in1To10(11, true) → true
*/
public boolean in1To10(int n, boolean outsideMode) {
if (n >= 1 && n <= 10 && outsideMode == false) {
return true;
} if (n <= 1 ^ n >= 10 && outsideMode == true) {
return true;
}
return false;
}
/*
23. We'll say a number is special if it is a multiple of 11 or if it is one more than a multiple of 11.
Return true if the given non-negative number is special.
(Hint: Think "mod".)
specialEleven(22) → true
specialEleven(23) → true
specialEleven(24) → false
*/
public boolean specialEleven(int n) {
if (n % 11 == 0 || n % 11 == 1) {
return true;
}
return false;
}
/*
24. Return true if the given non-negative number is 1 or 2 more than a multiple of 20.
(Hint: Think "mod".)
more20(20) → false
more20(21) → true
more20(22) → true
*/
public boolean more20(int n) {
if (n % 20 == 1 || n % 20 == 2) {
return true;
}
return false;
}
/*
25. Return true if the given non-negative number is a multiple of 3 or 5, but not both.
(Hint: Think "mod".)
old35(3) → true
old35(10) → true
old35(15) → false
*/
public boolean old35(int n) {
if (n % 3 == 0 ^ n % 5 == 0) {
return true;
}
return false;
}
/*
26. Return true if the given non-negative number is 1 or 2 less than a multiple of 20. So for example 38
and 39 return true, but 40 returns false.
(Hint: Think "mod".)
less20(18) → true
less20(19) → true
less20(20) → false
*/
public boolean less20(int n) {
if (n % 20 == 19 || n % 20 == 18) {
return true;
}
return false;
}
/*
27. Given a non-negative number "num", return true if num is within 2 of a multiple of 10. Note: (a % b)
is the remainder of dividing a by b, so (7 % 5) is 2.
nearTen(12) → true
nearTen(17) → false
nearTen(19) → true
*/
public boolean nearTen(int num) {
if (num % 10 == 2 || num % 10 == 1 || num % 10 == 8 || num % 10 == 9 || num % 10 == 0) {
return true;
}
return false;
}
/*
28. Given 2 ints, a and b, return their sum. However, "teen" values in the range 13..19 inclusive, are
extra lucky. So if either value is a teen, just return 19.
teenSum(3, 4) → 7
teenSum(10, 13) → 19
teenSum(13, 2) → 19
*/
public int teenSum(int a, int b) {
if ((a >= 13 && a <= 19) || (b >= 13 && b <= 19)) {
return 19;
} if ((a + b) < 13 || (a + b) > 19) {
return (a + b);
}
return 0;
}
/*
29. Your cell phone rings. Return true if you should answer it. Normally you answer, except in the morning
you only answer if it is your mom calling. In all cases, if you are asleep, you do not answer.
answerCell(false, false, false) → true
answerCell(false, false, true) → false
answerCell(true, false, false) → false
*/
public boolean answerCell(boolean isMorning, boolean isMom, boolean isAsleep) {
if (isAsleep == true) {
return false;
} if (isMorning == true && isMom == true) {
return true;
} if (isMorning == true && isMom == false) {
return false;
} if (isMorning == false && isAsleep == false) {
return true;
}
return false;
}
/*
30. We are having a party with amounts of tea and candy. Return the int outcome of the party encoded as
0=bad, 1=good, or 2=great. A party is good (1) if both tea and candy are at least 5. However, if
either tea or candy is at least double the amount of the other one, the party is great (2). However,
in all cases, if either tea or candy is less than 5, the party is always bad (0).
teaParty(6, 8) → 1
teaParty(3, 8) → 0
teaParty(20, 6) → 2
*/
public int teaParty(int tea, int candy) {
if (tea < 5 || candy < 5) {
return 0;
} if (tea >= (candy *2) || candy >= (tea * 2)) {
return 2;
} if (tea >= 5 && candy >= 5) {
return 1;
}
return 0;
}
/*
31. Given three ints, a b c, return true if it is possible to add two of the ints to get the third.
twoAsOne(1, 2, 3) → true
twoAsOne(3, 1, 2) → true
twoAsOne(3, 2, 2) → false
*/
public boolean twoAsOne(int a, int b, int c) {
if (a + b == c || a + c == b || c + b == a) {
return true;
}
return false;
}
/*
32. Given three ints, a b c, return true if b is greater than a, and c is greater than b. However, with
the exception that if "bOk" is true, b does not need to be greater than a.
inOrder(1, 2, 4, false) → true
inOrder(1, 2, 1, false) → false
inOrder(1, 1, 2, true) → true
*/
public boolean inOrder(int a, int b, int c, boolean bOk) {
if (b > a && c > b && bOk == false) {
return true;
} if (c > b && bOk == true) {
return true;
}
return false;
}
/*
33. Given three ints, a b c, return true if they are in strict increasing order, such as 2 5 11,
or 5 6 7, but not 6 5 7 or 5 5 7. However, with the exception that if "equalOk" is true, equality
is allowed, such as 5 5 7 or 5 5 5.
inOrderEqual(2, 5, 11, false) → true
inOrderEqual(5, 7, 6, false) → false
inOrderEqual(5, 5, 7, true) → true
*/
public boolean inOrderEqual(int a, int b, int c, boolean equalOk) {
if (a < b && b < c && equalOk == false) {
return true;
} if (a <= b && b <= c && equalOk == true) {
return true;
}
return false;
}
/*
34. Given 3 int values, a b c, return their sum. However, if one of the values is the same as another
of the values, it does not count towards the sum.
loneSum(1, 2, 3) → 6
loneSum(3, 2, 3) → 2
loneSum(3, 3, 3) → 0
*/
public int loneSum(int a, int b, int c) {
if (a != b && b != c && a != c) {
return (a + b + c);
} if (b == c && b != a) {
return (a);
} if (a == c && a != b) {
return (b);
} if (a == b && a != c) {
return (c);
} if (a == b && b == c) {
return 0;
}
return 0;
}
/*
35. Given 3 int values, a b c, return their sum. However, if one of the values is 13 then it does not
count towards the sum and values to its immediate right do not count. So for example, if b is 13, then both
b and c do not count.
luckySum(1, 2, 3) → 6
luckySum(1, 2, 13) → 3
luckySum(1, 13, 3) → 1
luckySum(13, 1, 3) → 3
luckySum(13, 13, 3) → 0
*/
public int luckySum(int a, int b, int c) {
if (a != 13 && b != 13 && c != 13) {
return (a + b + c);
} if (c == 13 && a != 13 && b != 13) {
return (a + b);
} if (b == 13 && a != 13) {
return a;
} if (a == 13 && b != 13) {
return c;
}
return 0;
}
}
| [
"avery.s.hargrave@gmail.com"
] | avery.s.hargrave@gmail.com |
10fef74b4bdcf9927db00a2971fc267f29b5b6e9 | 537a5b9e6cbb0a46da2e464564dc25294ec31dd8 | /BreakSattement/src/BreakExample.java | f9f38856bbf3e2c5cb901793a7fe181268808761 | [
"MIT"
] | permissive | akashgangurde/anotherJavaRepository | 8d43685a995b2cc81b4bdb520f6eac1a7f2c806b | 6bfef7e6ab39c6fb57a024ad0bcf36fade155e84 | refs/heads/main | 2023-03-14T16:27:24.194428 | 2021-03-21T09:43:20 | 2021-03-21T09:43:20 | 349,948,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java |
public class BreakExample {
public static void main(String[] args) {
for (int i = 1; i < 10; i++) {
if (i == 4) {
break;
}
System.out.println(i);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
608918a06235f345c6d2ef5474c18c2e24fa23a2 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/104/org/apache/commons/math/analysis/UnivariateRealIntegrator_resetRelativeAccuracy_114.java | 2cffaa6dbcae63a91b6f8ad681dfc274cd1f5e9b | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 390 | java |
org apach common math analysi
interfac univari real integr algorithm
version revis date
univari real integr univariaterealintegr
reset rel accuraci
provid implement
set rel accuraci setrelativeaccuraci
reset rel accuraci resetrelativeaccuraci
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
a9a9e3102eed8d32bd45e20a11030934ce92fa82 | cf7e9fcaa002d7e3a2e4396831bf122fd1ac7bbc | /cards/src/main/java/org/rnd/jmagic/cards/HellionCrucible.java | 594569c1d1c22bea3f7d0a2bc456866d7b765812 | [] | no_license | NorthFury/jmagic | 9b28d803ce6f8bf22f22eb41e2a6411bc11c8cdf | efe53d9d02716cc215456e2794a43011759322d9 | refs/heads/master | 2020-05-28T11:04:50.631220 | 2014-06-17T09:48:44 | 2014-06-17T09:48:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java | package org.rnd.jmagic.cards;
import static org.rnd.jmagic.Convenience.*;
import org.rnd.jmagic.abilities.TapFor1;
import org.rnd.jmagic.abilities.keywords.Haste;
import org.rnd.jmagic.engine.*;
import org.rnd.jmagic.engine.generators.*;
@Name("Hellion Crucible")
@Types({Type.LAND})
@Printings({@Printings.Printed(ex = Expansion.MAGIC_2013, r = Rarity.RARE)})
@ColorIdentity({Color.RED})
public final class HellionCrucible extends Card
{
public static final class HellionCrucibleAbility1 extends ActivatedAbility
{
public HellionCrucibleAbility1(GameState state)
{
super(state, "(1)(R), (T): Put a pressure counter on Hellion Crucible.");
this.setManaCost(new ManaPool("(1)(R)"));
this.costsTap = true;
this.addEffect(putCounters(1, Counter.CounterType.PRESSURE, ABILITY_SOURCE_OF_THIS, "Put a pressure counter on Hellion Crucible."));
}
}
public static final class HellionCrucibleAbility2 extends ActivatedAbility
{
public HellionCrucibleAbility2(GameState state)
{
super(state, "(1)(R), (T), Remove two pressure counters from Hellion Crucible and sacrifice it: Put a 4/4 red Hellion creature token with haste onto the battlefield.");
this.setManaCost(new ManaPool("(1)(R)"));
this.costsTap = true;
// Remove two pressure counters from Hellion Crucible and sacrifice
// it
this.addCost(removeCounters(2, Counter.CounterType.PRESSURE, ABILITY_SOURCE_OF_THIS, "Remove two pressure counters from Hellion Crucible"));
this.addCost(sacrificeSpecificPermanents(You.instance(), ABILITY_SOURCE_OF_THIS, "Sacrifice it"));
CreateTokensFactory factory = new CreateTokensFactory(1, 4, 4, "Put a 4/4 red Hellion creature token with haste onto the battlefield.");
factory.setColors(Color.RED);
factory.setSubTypes(SubType.HELLION);
factory.addAbility(Haste.class);
this.addEffect(factory.getEventFactory());
}
}
public HellionCrucible(GameState state)
{
super(state);
// (T): Add (1) to your mana pool.
this.addAbility(new TapFor1(state));
// (1)(R), (T): Put a pressure counter on Hellion Crucible.
this.addAbility(new HellionCrucibleAbility1(state));
// (1)(R), (T), Remove two pressure counters from Hellion Crucible and
// sacrifice it: Put a 4/4 red Hellion creature token with haste onto
// the battlefield. (It can attack and (T) as soon as it comes under
// your control.)
this.addAbility(new HellionCrucibleAbility2(state));
}
}
| [
"robyter@gmail"
] | robyter@gmail |
b85c944085ef4f97b3030fb01af39d66477b95fe | 0d073be9dc065603251bac7a8378370f9038e6f1 | /src/solution/RouteDAO.java | d2e0026fd6238ed48085436d5d1c0a89bb0b2083 | [] | no_license | kernil9/Advanced-Programming-Task | 820353971b537b60501f0fe3c4b82c1a02ea52c0 | 997a024c0aed13530abfaff10fddf88b21b4e002 | refs/heads/master | 2020-12-08T07:03:38.719544 | 2020-01-10T22:18:34 | 2020-01-10T22:18:34 | 232,921,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,597 | java | package solution;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import baseclasses.Aircraft;
import baseclasses.DataLoadingException;
import baseclasses.IRouteDAO;
import baseclasses.Route;
import baseclasses.Aircraft.Manufacturer;
/**
* The RouteDAO parses XML files of route information, each route specifying
* where the airline flies from, to, and on which day of the week
*/
public class RouteDAO implements IRouteDAO {
public List<Route> routesList = new ArrayList<Route>();
/**
* Finds all flights that depart on the specified day of the week
* @param dayOfWeek A three letter day of the week, e.g. "Tue"
* @return A list of all routes that depart on this day
*/
@Override
public List<Route> findRoutesByDayOfWeek(String dayOfWeek) {
List<Route> output = new ArrayList<Route>();
for(Route r : routesList)
{
if(r.getDayOfWeek().equalsIgnoreCase(dayOfWeek))
output.add(r);
}
return output;
}
/**
* Finds all of the flights that depart from a specific airport on a specific day of the week
* @param airportCode the three letter code of the airport to search for, e.g. "MAN"
* @param dayOfWeek the three letter day of the week code to searh for, e.g. "Tue"
* @return A list of all routes from that airport on that day
*/
@Override
public List<Route> findRoutesByDepartureAirportAndDay(String airportCode, String dayOfWeek) {
List<Route> output = new ArrayList<Route>();
for(Route r : routesList)
{
if(r.getDayOfWeek().equalsIgnoreCase(dayOfWeek) && r.getDepartureAirportCode().equalsIgnoreCase(airportCode))
output.add(r);
}
return output;
}
/**
* Finds all of the flights that depart from a specific airport
* @param airportCode the three letter code of the airport to search for, e.g. "MAN"
* @return A list of all of the routes departing the specified airport
*/
@Override
public List<Route> findRoutesDepartingAirport(String airportCode) {
List<Route> output = new ArrayList<Route>();
for(Route r : routesList)
{
if(r.getDepartureAirportCode().equalsIgnoreCase(airportCode))
output.add(r);
}
return output;
}
//Revisit
/**
* Finds all of the flights that depart on the specified date
* @param date the date to search for
* @return A list of all routes that dpeart on this date
*/
@Override
public List<Route> findRoutesbyDate(LocalDate date) {
List<Route> output = new ArrayList<Route>();
String day = date.getDayOfWeek().toString().substring(0, 3);
//System.out.println(day);
for(Route r : routesList)
{
if(r.getDayOfWeek().equalsIgnoreCase(day))
output.add(r);
}
return output;
}
/**
* Returns The full list of all currently loaded routes
* @return The full list of all currently loaded routes
*/
@Override
public List<Route> getAllRoutes() {
return routesList;
}
/**
* Returns The number of routes currently loaded
* @return The number of routes currently loaded
*/
@Override
public int getNumberOfRoutes() {
return routesList.size();
}
/**
* Loads the route data from the specified file, adding them to the currently loaded routes
* Multiple calls to this function, perhaps on different files, would thus be cumulative
* @param p A Path pointing to the file from which data could be loaded
* @throws DataLoadingException if anything goes wrong. The exception's "cause" indicates the underlying exception
*/
@Override
public void loadRouteData(Path p) throws DataLoadingException {
try {
File xmlFile = p.toFile();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = factory.newDocumentBuilder();
Document doc = dBuilder.parse(xmlFile);
doc.getDocumentElement().normalize();
//System.out.println("Root element :" + doc.getDocumentElement().getNodeName());
NodeList rList = doc.getElementsByTagName("Route");
for(int i = 0;i<rList.getLength();i++)
{
Route route = new Route();
Node r = rList.item(i);
if(r.getNodeType()==Node.ELEMENT_NODE) {
Element routes = (Element) r;
int flightNumber = Integer.parseInt(routes.getElementsByTagName("FlightNumber").item(0).getTextContent());
route.setFlightNumber(flightNumber);
route.setDayOfWeek(routes.getElementsByTagName("DayOfWeek").item(0).getTextContent());
LocalTime dtime = LocalTime.parse(routes.getElementsByTagName("DepartureTime").item(0).getTextContent());
route.setDepartureTime(dtime);
LocalTime atime = LocalTime.parse(routes.getElementsByTagName("ArrivalTime").item(0).getTextContent());
route.setArrivalTime(atime);
route.setArrivalAirport(routes.getElementsByTagName("ArrivalAirport").item(0).getTextContent());
route.setArrivalAirportCode(routes.getElementsByTagName("ArrivalAirportCode").item(0).getTextContent());
route.setDepartureAirport(routes.getElementsByTagName("DepartureAirport").item(0).getTextContent());
route.setDepartureAirportCode(routes.getElementsByTagName("DepartureAirportCode").item(0).getTextContent());
Duration d = Duration.parse(routes.getElementsByTagName("Duration").item(0).getTextContent());
route.setDuration(d);
routesList.add(route);
//System.out.println(route.getDuration());
}
}
}
catch (IOException ioe) {
//There was a problem reading the file
throw new DataLoadingException(ioe);
} catch (SAXException e) {
throw new DataLoadingException(e);
} catch (ParserConfigurationException e) {
throw new DataLoadingException(e);
}catch (Exception e) {
throw new DataLoadingException(e);
}
}
/**
* Unloads all of the crew currently loaded, ready to start again if needed
*/
@Override
public void reset() {
routesList.clear();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
b75ea65ada5bd33d66f64b0669f553517c5f92b5 | 6292b7e7376079766387d1287895bb42d927988b | /src/com/company/Persona/Names.java | 2511f6dbee32b2fe7002356be2e974d57728478f | [] | no_license | kamlew5/PRGP | eb37c9b477a13c06c7a582fd39b3f54873a1768b | 002fadbf502a0a7a4442a095689804544b650df9 | refs/heads/master | 2022-11-22T16:59:56.503153 | 2020-07-03T18:03:26 | 2020-07-03T18:03:26 | 276,959,936 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package com.company.Persona;
public class Names {
}
| [
"kamlew5@wp.pl"
] | kamlew5@wp.pl |
a5764f997db77485845d08ad831169d7daef7757 | e617e525ecd838633b0e4f9d9ec1256524f83805 | /src/main/java/nl/cwi/swat/formulacircuit/NaryGate.java | b60135eff38bde5de73ccde0a9a25b71575b2f4d | [] | no_license | joukestoel/pampas-solver | a36038e8fc59c93f0c37d356e1f03362e83d1afa | 7feedfae1f971754a5c3f876601dd71084922b3e | refs/heads/main | 2023-03-19T07:28:56.904468 | 2021-12-24T12:59:13 | 2021-12-24T12:59:13 | 125,525,063 | 0 | 0 | null | 2023-03-06T05:02:47 | 2018-03-16T14:11:30 | Java | UTF-8 | Java | false | false | 2,945 | java | package nl.cwi.swat.formulacircuit;
import io.usethesource.capsule.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Iterator;
public abstract class NaryGate extends Gate {
private final Term[] inputs;
protected NaryGate(@NonNull Term[] inputs, @NonNull Operator operator, long label) {
super(operator, label);
this.inputs = inputs;
}
@Override
public int size() {
return inputs.length;
}
@Override
public Term input(int pos) {
if (pos < 0 || pos >= inputs.length) {
throw new IllegalArgumentException(String.format("Boolean nary gate of size %d does not have formula at index %d", inputs.length, pos));
}
return inputs[pos];
}
@Override
public boolean contains(Operator op, long f, int k) {
if (f == label()) {
return true;
} else if (this.operator != op || f > label() || -f > label()) {
return false;
} else {
int low = 0;
int high = inputs.length - 1;
int step = 1;
while (low <= high && step <= k) {
int mid = (low + high) >>> 1;
long midVal = inputs[mid].label();
if (midVal < f) {
low = mid + 1;
} else if (midVal > f) {
high = mid - 1;
} else {
return true;
}
step++;
}
return false;
}
}
@Override
public void flatten(Operator op, Set.Transient<Term> flat, int k) {
if (k <= 0) {
throw new IllegalArgumentException("The supplied k is not positive: " + k);
}
if (this.operator == op && k >= inputs.length) {
int diff = k - inputs.length;
for(Term f: inputs) {
int oldsize = flat.size();
f.flatten(op, flat, StrictMath.max(1, diff));
diff -= (flat.size() - oldsize);
}
} else {
flat.add(this);
}
}
@NotNull
@Override
public Iterator<Term> iterator() {
return new Iterator<>() {
private int i = 0;
@Override
public boolean hasNext() {
return i < inputs.length;
}
@Override
public Term next() {
return inputs[i++];
}
};
}
@Override
public String toString() {
if (size() == 0) {
return " ";
}
StringBuilder sb = new StringBuilder("(");
Iterator<Term> it = iterator();
sb.append(it.next());
while(it.hasNext()) {
sb.append(" " + operator + " ");
sb.append(it.next());
}
sb.append(")");
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
NaryGate naryGate = (NaryGate) o;
// Probably incorrect - comparing Object[] arrays with Arrays.equals
return Arrays.equals(inputs, naryGate.inputs);
}
@Override
public int hashCode() {
return Arrays.hashCode(inputs);
}
}
| [
"j.h.stoel@gmail.com"
] | j.h.stoel@gmail.com |
6f7c5377aea95a1207ca77cfca4c7e6fb0f32ee1 | d742790a37b7e7465d349419c4ecc7d25e569856 | /component/jwt/src/main/java/com/linln/component/jwt/annotation/JwtPermissions.java | 927c6d1d91b10f3dcbc894bf6a1b41e6427765c2 | [
"MIT"
] | permissive | DemonWitch/my_web | b8171712079bb3576a691376c786b7672a05cf56 | 103f149b3ab01bd7762280bfb54129a41c960496 | refs/heads/master | 2023-02-06T17:53:17.426077 | 2020-12-28T02:51:04 | 2020-12-28T02:51:04 | 324,889,748 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.linln.component.jwt.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* jwt权限注解(需要权限)
* @author Richard
* @date 2019/4/13
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface JwtPermissions {
}
| [
"richardlv0818@gmail.com"
] | richardlv0818@gmail.com |
78dfda3329c87116f005d1ddb1c7e1526f2190b6 | 442ec17c7aa8b0a101422ad2afadc4fed1b74f80 | /src/main/java/ar/fi/uba/tecnicas/functions/MinBoolFunction.java | c663347653489adebdfa33c2b567757b40559c14 | [] | no_license | AlJuan/gobstonesInterpreter | ad33eb9ab1b39a8bde2d23cf2e8378fcc3114aac | 2a14caa5628438f94a989432ffb3c5b05ec9f87e | refs/heads/master | 2020-05-29T22:43:45.639798 | 2015-05-21T16:57:37 | 2015-05-21T16:57:37 | 36,025,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package ar.fi.uba.tecnicas.functions;
import ar.fi.uba.tecnicas.expressions.Expression;
import ar.fi.uba.tecnicas.expressions.ValueExpression;
import ar.fi.uba.tecnicas.model.Board;
import ar.fi.uba.tecnicas.model.ProgramStack;
/**
* MinBoolFunction
*
* Responsabilidad: devuelve el menor boolean en el orden, o sea FALSE
*
*/
public class MinBoolFunction extends Function {
private final static Integer ARGUMENTS_NUMBER = 0;
public MinBoolFunction() {
super();
}
@Override
protected Expression executeFunction(Board board, ProgramStack programStack) {
return new ValueExpression(Boolean.FALSE);
}
@Override
protected Integer getArgumentsNumber() {
return ARGUMENTS_NUMBER;
}
}
| [
"juan.alonso@opendevsolutions.com.ar"
] | juan.alonso@opendevsolutions.com.ar |
5ef014e1102eeafcd46fb72a6014e9cdab2e4cb6 | 7004fd6a6dc4cde4f82f9516fbde08c695a8e635 | /src/main/java/ch/pschatzmann/stocks/parameters/IValueSource.java | a134195d3f02129910c0a971bde9dc8f28495951 | [] | no_license | pschatzmann/Investor | 6da0a4536aaf734f5d415b0e101008caa27ca4ad | 5292a8f2de8f3e6f5e2d4ebd339821f471837849 | refs/heads/master | 2023-06-22T03:36:42.539839 | 2022-01-27T15:59:29 | 2022-01-27T15:59:29 | 135,746,791 | 3 | 5 | null | 2023-06-15T16:21:09 | 2018-06-01T17:40:14 | Java | UTF-8 | Java | false | false | 123 | java | package ch.pschatzmann.stocks.parameters;
public interface IValueSource {
public boolean nextValue(ParameterValue pv);
}
| [
"phil.schatzmann@gmail.com"
] | phil.schatzmann@gmail.com |
014d482e9e08a201ac2d59cf6af3173954b88550 | 0d14f64fc90f9024fecdb1d6ad5d0f7708da3326 | /src/com/caihong/core/web/util/URLHelper.java | aa1265965fc61d13da94d68c5b033c87ad33dc13 | [] | no_license | xrogzu/caihongcms | 1efd0d2c2079978d0b616a4b5e92c53f4565bb9a | 1c9f3227bc2a30ed85d406149b0c41490d427331 | refs/heads/master | 2020-04-06T04:13:56.511727 | 2017-02-24T07:01:51 | 2017-02-24T07:01:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,554 | java | package com.caihong.core.web.util;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.util.UrlPathHelper;
/**
* URI帮助类
*/
public class URLHelper {
/**
* 获得页号
*
* @param request
* @return
*/
public static int getPageNo(HttpServletRequest request) {
return getPageNo(getURI(request));
}
/**
* 获得路径信息
*
* @param request
* @return
*/
public static String[] getPaths(HttpServletRequest request) {
return getPaths(getURI(request));
}
/**
* 获得路径参数
*
* @param request
* @return
*/
public static String[] getParams(HttpServletRequest request) {
return getParams(getURI(request));
}
public static String getURI(HttpServletRequest request) {
UrlPathHelper helper = new UrlPathHelper();
String uri = helper.getOriginatingRequestUri(request);
String ctx = helper.getOriginatingContextPath(request);
if (!StringUtils.isBlank(ctx)) {
uri= uri.substring(ctx.length());
}
//跨路径伪请求
if(uri.contains("../")||uri.contains("..\\")){
return "";
}
return uri;
}
/**
* 获得翻页信息
*
* @param request
* @return
*/
public static PageInfo getPageInfo(HttpServletRequest request) {
UrlPathHelper helper = new UrlPathHelper();
String uri = helper.getOriginatingRequestUri(request);
String queryString = helper.getOriginatingQueryString(request);
return getPageInfo(uri, queryString);
}
/**
* 获得页号
*
* @param uri
* URI {@link HttpServletRequest#getRequestURI()}
* @return
*/
public static int getPageNo(String uri) {
if (uri == null) {
throw new IllegalArgumentException("URI can not be null");
}
if (!uri.startsWith("/")) {
throw new IllegalArgumentException("URI must start width '/'");
}
int pageNo = 1;
// int bi = uri.indexOf("_");
// int mi = uri.indexOf("-");
// int pi = uri.indexOf(".");
int bi = uri.lastIndexOf("_");
int mi = uri.lastIndexOf("-");
int pi = uri.lastIndexOf(".");
if (bi != -1) {
String pageNoStr;
if (mi != -1) {
pageNoStr = uri.substring(bi + 1, mi);
} else {
if (pi != -1) {
pageNoStr = uri.substring(bi + 1, pi);
} else {
pageNoStr = uri.substring(bi + 1);
}
}
try {
pageNo = Integer.valueOf(pageNoStr);
} catch (Exception e) {
}
}
return pageNo;
}
/**
* 获得路径数组
*
* @param uri
* URI {@link HttpServletRequest#getRequestURI()}
* @return
*/
public static String[] getPaths(String uri) {
if (uri == null) {
throw new IllegalArgumentException("URI can not be null");
}
if (!uri.startsWith("/")) {
throw new IllegalArgumentException("URI must start width '/'");
}
// int bi = uri.indexOf("_");
// int mi = uri.indexOf("-");
// int pi = uri.indexOf(".");
int bi = uri.lastIndexOf("_");
int mi = uri.lastIndexOf("-");
int pi = uri.lastIndexOf(".");
// 获得路径信息
String pathStr;
if (bi != -1) {
pathStr = uri.substring(0, bi);
} else if (mi != -1) {
pathStr = uri.substring(0, mi);
} else if (pi != -1) {
pathStr = uri.substring(0, pi);
} else {
pathStr = uri;
}
String[] paths = StringUtils.split(pathStr, '/');
return paths;
}
/**
* 获得路径参数
*
* @param uri
* URI {@link HttpServletRequest#getRequestURI()}
* @return
*/
public static String[] getParams(String uri) {
if (uri == null) {
throw new IllegalArgumentException("URI can not be null");
}
if (!uri.startsWith("/")) {
throw new IllegalArgumentException("URI must start width '/'");
}
// int mi = uri.indexOf("-");
// int pi = uri.indexOf(".");
int mi = uri.lastIndexOf("-");
int pi = uri.lastIndexOf(".");
String[] params;
if (mi != -1) {
String paramStr;
if (pi != -1) {
paramStr = uri.substring(mi, pi);
} else {
paramStr = uri.substring(mi);
}
params = new String[StringUtils.countMatches(paramStr, "-")];
int fromIndex = 1;
int nextIndex = 0;
int i = 0;
while ((nextIndex = paramStr.indexOf("-", fromIndex)) != -1) {
params[i++] = paramStr.substring(fromIndex, nextIndex);
fromIndex = nextIndex + 1;
}
params[i++] = paramStr.substring(fromIndex);
} else {
params = new String[0];
}
return params;
}
/**
* 获得URL信息
*
* @param uri
* URI {@link HttpServletRequest#getRequestURI()}
* @param queryString
* 查询字符串 {@link HttpServletRequest#getQueryString()}
* @return
*/
public static PageInfo getPageInfo(String uri, String queryString) {
if (uri == null) {
return null;
}
if (!uri.startsWith("/")) {
throw new IllegalArgumentException("URI must start width '/'");
}
// int bi = uri.indexOf("_");
// int mi = uri.indexOf("-");
// int pi = uri.indexOf(".");
int bi = uri.lastIndexOf("_");
int mi = uri.lastIndexOf("-");
int pi = uri.lastIndexOf(".");
int lastSpt = uri.lastIndexOf("/") + 1;
String url;
if (!StringUtils.isBlank(queryString)) {
url = uri + "?" + queryString;
} else {
url = uri;
}
// 翻页前半部
String urlFormer;
if (bi != -1) {
urlFormer = uri.substring(lastSpt, bi);
} else if (mi != -1) {
urlFormer = uri.substring(lastSpt, mi);
} else if (pi != -1) {
urlFormer = uri.substring(lastSpt, pi);
} else {
urlFormer = uri.substring(lastSpt);
}
// 翻页后半部
String urlLater;
if (mi != -1) {
urlLater = url.substring(mi);
} else if (pi != -1) {
urlLater = url.substring(pi);
} else {
urlLater = url.substring(uri.length());
}
String href = url.substring(lastSpt);
return new PageInfo(href, urlFormer, urlLater);
}
/**
* URI信息
*/
public static class PageInfo {
/**
* 页面地址
*/
private String href;
/**
* href前半部(相对于分页)
*/
private String hrefFormer;
/**
* href后半部(相对于分页)
*/
private String hrefLatter;
public PageInfo(String href, String hrefFormer, String hrefLatter) {
this.href = href;
this.hrefFormer = hrefFormer;
this.hrefLatter = hrefLatter;
}
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
public String getHrefFormer() {
return hrefFormer;
}
public void setHrefFormer(String hrefFormer) {
this.hrefFormer = hrefFormer;
}
public String getHrefLatter() {
return hrefLatter;
}
public void setHrefLatter(String hrefLatter) {
this.hrefLatter = hrefLatter;
}
}
}
| [
"qianfo_713@163.com"
] | qianfo_713@163.com |
1f4420ef84ae62fefa67a597adc427026b1eee69 | 58f7f550ad8547834b2e985f76a27745cb29eaba | /src/com/leetcode/recursion/BinaryString.java | fc0f2fe6c43b31ea05177b8f12b19b27ca4919ac | [] | no_license | neel-spartacus/algorist | 5dffcd9ab2c26ac4844dd293d2d1c658ce697252 | 3773a2a4652d1684c55f08fad6d786bb6cb9b7c2 | refs/heads/main | 2023-05-30T03:16:54.287964 | 2023-05-12T09:21:31 | 2023-05-12T09:21:31 | 340,591,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,247 | java | package com.leetcode.recursion;
//Problem : https://leetcode.com/problems/find-kth-bit-in-nth-binary-string/
public class BinaryString {
public static char findKthBit(int n, int k) {
String binaryString=helper(n);
return binaryString.toCharArray()[k-1];
}
public static String helper(int n){
if(n==1){
return "0";
}
String prev=helper(n-1);
String inverse=inverse(prev);
return prev+"1"+reverse(inverse.toCharArray());
}
private static String inverse(String prev) {
String[] arr= prev.split("");
StringBuilder inverse=new StringBuilder();
for(String s:arr){
int val=Integer.parseInt(s)^1;
inverse.append(String.valueOf(val));
}
return inverse.toString();
}
private static String reverse(char[] prevArr) {
int len = prevArr.length;
char temp;
for (int i = 0; i < len / 2; i++) {
temp = prevArr[i];
prevArr[i] = prevArr[len - 1 - i];
prevArr[len - 1 - i] = temp;
}
return String.valueOf(prevArr);
}
public static void main(String[] args) {
System.out.println(findKthBit(4,11));
}
}
| [
"neel.abstract@gmail.com"
] | neel.abstract@gmail.com |
9a3b93e5c58ec3997430f101322bbe27acad20c1 | 7f59281ae8a343f4cdcad14204fe168613480ec3 | /DistinctElementsinArray.java | 56af90becb008394c97a4fd25e4e8f3ee91d7236 | [] | no_license | joelonix/codingProbems | 9e3c202f62fbe820a0720321a57c1b13cbdb06f7 | ea642cf93c3118f5da56c54063e529cb1fb359ce | refs/heads/master | 2020-06-11T05:12:11.054575 | 2018-10-12T15:11:00 | 2018-10-12T15:11:00 | 75,999,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package cracking.coding.problems;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DistinctElementsinArray {
private static List<Integer> findDistinctNumbers(int[] arr) {
Map<Integer, Integer> frequencyMap = createElementFrequencyMap(arr);
return findNumbersWithFrequencyOne(frequencyMap);
}
private static List<Integer> findNumbersWithFrequencyOne(Map<Integer, Integer> frequencyMap)
{
List<Integer> distinctNumbers = new ArrayList<Integer>();
for(Map.Entry<Integer, Integer> entry:frequencyMap.entrySet()){
if(entry.getValue()==1){
distinctNumbers.add(entry.getKey());
}
}
return distinctNumbers;
}
private static Map<Integer, Integer> createElementFrequencyMap(int[] arr) {
Map<Integer, Integer> frequencyMap = new HashMap<Integer, Integer>();
for (int key : arr) {
if (frequencyMap.containsKey(key)) {
frequencyMap.put(key, frequencyMap.get(key) + 1);
} else {
frequencyMap.put(key, 1);
}
}
return frequencyMap;
}
private static void print(List<Integer> numberList) {
for (int number : numberList) {
System.out.println(number);
}
}
public static void main(String[] args) {
int[] arr = { 2, 4, 3, 2, 6, 9, 4, 6 };
List<Integer> distinctNumbers = findDistinctNumbers(arr);
System.out.println("Distinct elements are : ");
print(distinctNumbers);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
72e135d232c65d68a61b9a96a42ecbc4c5ed9c9f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_34ce521ced331af34cc26588444a1cb098ea87c4/NettyClientComponentDecodersTest/4_34ce521ced331af34cc26588444a1cb098ea87c4_NettyClientComponentDecodersTest_s.java | 1ca4a17d18abd3c1e85ba39d5c883061eb35ae08 | [] | 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 | 2,963 | java | package org.hbird.camel.nettyclient;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.JndiRegistry;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.jboss.netty.channel.ChannelUpstreamHandler;
import org.jboss.netty.handler.codec.frame.LengthFieldBasedFrameDecoder;
import org.junit.Test;
public class NettyClientComponentDecodersTest extends CamelTestSupport {
private ServerSocket serverSocket;
public static final int TEST_PORT = 4444;
@Override
public void doPreSetup() throws Exception {
serverSocket = new ServerSocket(TEST_PORT);
}
@Test
public void testNettyClient() throws Exception {
final Socket clientSocket = serverSocket.accept();
final byte[] rawOut = DataGenerator.createRawTestData();
clientSocket.getOutputStream().write(rawOut, 0, 9);
final MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMinimumMessageCount(1);
mock.expectedBodiesReceived(rawOut);
assertMockEndpointsSatisfied();
final Object msgBody = mock.getExchanges().get(0).getIn().getBody();
final byte[] receivedBytes = (byte[]) msgBody;
// Extra asserts - really checking!
assertEquals(rawOut.length, receivedBytes.length);
assertEquals(DataGenerator.BYTE, receivedBytes[0]);
//@formatter:off
final int oneReceived = receivedBytes[1] & DataGenerator.BYTE_INT_MASK +
(receivedBytes[2] & DataGenerator.BYTE_INT_MASK << 8) +
(receivedBytes[3] & DataGenerator.BYTE_INT_MASK << 16) +
(receivedBytes[4] & DataGenerator.BYTE_INT_MASK << 24);
assertEquals(DataGenerator.INT_ONE, oneReceived);
final int twoReceived = receivedBytes[5] & DataGenerator.BYTE_INT_MASK +
(receivedBytes[6] & DataGenerator.BYTE_INT_MASK << 8) +
(receivedBytes[7] & DataGenerator.BYTE_INT_MASK << 16) +
(receivedBytes[8] & DataGenerator.BYTE_INT_MASK << 24);
assertEquals(DataGenerator.INT_TWO, twoReceived);
//@formatter:on
}
@Override
protected JndiRegistry createRegistry() throws Exception {
final JndiRegistry reg = super.createRegistry();
final LengthFieldBasedFrameDecoder lengthDecoder = new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4);
reg.bind("lengthDecoder", lengthDecoder);
final List<ChannelUpstreamHandler> decoders = new ArrayList<ChannelUpstreamHandler>();
decoders.add(lengthDecoder);
reg.bind("decoders", decoders);
return reg;
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() {
from("nettyclient:tcp://localhost:" + TEST_PORT +"?decoders=#lengthDecoder").to("mock:result");
}
};
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
864fdb4c225c7d1c82b6f0044031567a2b281d6f | 32197545c804daccd40eea4a2e1f49cd5e845740 | /lierl_other_demo/src/test/java/lierl/other/exercise/OtherTest.java | 41830cb34a396f286e38243429d77bb92b53a124 | [] | no_license | dream7319/personal_study | 4235a159650dcbc7713a43d8be017d204ef3ecda | 19b49b00c9f682f9ef23d40e6e60b73772f8aad4 | refs/heads/master | 2020-03-18T17:25:04.225765 | 2018-07-08T11:54:41 | 2018-07-08T11:54:44 | 135,027,431 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package lierl.other.exercise;
/**
* @author lierlei@xingyoucai.com
* @create 2018-06-15 17:13
**/
public class OtherTest {
public static void main(String[] args) {
String aa = "abc";
String bb = "abc";
System.out.println(aa == bb);
Integer ab = 123;
int ac = 123;
Integer ad = 123;
System.out.println(ab == ac);
System.out.println(ab == ad);
}
}
| [
"lierlei@xingyoucai.com"
] | lierlei@xingyoucai.com |
5547e27ac6c73970a28763ec4cc473ae2150bff1 | c8c455cfe3707dde912f84178a4440c17f21311e | /src/main/java/ua/nikross/web/filter/CachingHttpHeadersFilter.java | 0d9960842a4dbf2942c4e02a108ce6b772362665 | [] | no_license | IvanDrizhiruk/nikrossShop | fb7f6d010b3576a2e15bedd6d766a2685fae7850 | a810eb1b779a1bf884d6124c0aa37dd8179497aa | refs/heads/master | 2021-01-20T20:03:19.333270 | 2016-12-15T20:02:56 | 2016-12-15T20:02:56 | 60,718,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,802 | java | package ua.nikross.web.filter;
import ua.nikross.config.JHipsterProperties;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
* This filter is used in production, to put HTTP cache headers with a long (1 month) expiration time.
*/
public class CachingHttpHeadersFilter implements Filter {
// We consider the last modified date is the start up time of the server
private final static long LAST_MODIFIED = System.currentTimeMillis();
private long CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(1461L);
private JHipsterProperties jHipsterProperties;
public CachingHttpHeadersFilter(JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
CACHE_TIME_TO_LIVE = TimeUnit.DAYS.toMillis(jHipsterProperties.getHttp().getCache().getTimeToLiveInDays());
}
@Override
public void destroy() {
// Nothing to destroy
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
HttpServletResponse httpResponse = (HttpServletResponse) response;
httpResponse.setHeader("Cache-Control", "max-age=" + CACHE_TIME_TO_LIVE + ", public");
httpResponse.setHeader("Pragma", "cache");
// Setting Expires header, for proxy caching
httpResponse.setDateHeader("Expires", CACHE_TIME_TO_LIVE + System.currentTimeMillis());
// Setting the Last-Modified header, for browser caching
httpResponse.setDateHeader("Last-Modified", LAST_MODIFIED);
chain.doFilter(request, response);
}
}
| [
"ivan.drizhiruk@gmail.com"
] | ivan.drizhiruk@gmail.com |
37922a357bbc0d14f6ec7d07cdf60687e22e48ec | fa2abfcf33cf0a298923a8da5ecfeca6689ea285 | /src/main/java/com/eliasjr/aleloserviceapi/controller/exception/ApiErrorList.java | 9a64e88e4e3f8a974907fbd1982332f1fa4559b8 | [] | no_license | EliasJnr/alelo-service-api | 5ddb500c2e109bfe1e54c82df028e7a6f5e8c235 | f8777306678a6fb87f13786263bde01d0eab67db | refs/heads/main | 2023-04-20T00:49:37.412303 | 2021-05-06T05:26:47 | 2021-05-06T05:26:47 | 364,741,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package com.eliasjr.aleloserviceapi.controller.exception;
import java.util.Date;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ApiErrorList extends ApiError {
/**
*
*/
private static final long serialVersionUID = 1L;
private List<String> errors;
public ApiErrorList(int code, String msg, Date date, List<String> errors) {
super(code, msg, date);
this.errors = errors;
}
} | [
"a49888ce3c@emailmonkey.club"
] | a49888ce3c@emailmonkey.club |
6569ed6afbbb98104492f79c3ec78638d6751796 | dc3ae212f4365bc6af98191686623e9b93053f9b | /EduMaking-Backend/src/main/java/co/unab/edu/repository/InstructorRepository.java | c12331e909da4568e5b2a4b823585d484ef14255 | [] | no_license | opbravo/Edumaking-sprint-4 | 71e8d8c5c99c230ca9806b04fd173183723c3a0a | 25132cd23c760ce8b82f51cd5ec54b165202b07c | refs/heads/main | 2023-08-30T13:49:25.226298 | 2021-10-08T14:07:35 | 2021-10-08T14:07:35 | 414,841,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package co.unab.edu.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import co.unab.edu.models.entity.Instructor;
@Repository
public interface InstructorRepository extends JpaRepository<Instructor, Integer>{
}
| [
"opbravo1@hotmail.com"
] | opbravo1@hotmail.com |
01bbee4749410c80fd76802fbf98a6dc1a35d31a | 84ede214e2ef7e413da032abbc52c50c86071a57 | /webclient/src/main/java/si/unimb/feri/osgichat/webclient/WebChatSessionProperties.java | 72c1079c7c073ca8b4d2a372ce4c5b630db771f7 | [] | no_license | mihab/osgichat | f75f9a93499fd0dcfb20f7972d8de2562ae7c36c | a869fd324c9673815c377959529382ffa8a4dd3e | refs/heads/master | 2020-05-19T15:57:28.007815 | 2012-04-18T16:27:50 | 2012-04-18T16:27:50 | 3,667,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package si.unimb.feri.osgichat.webclient;
import si.unimb.feri.osgichat.ChatSession;
/**
* Web chat session properties for storing the chatsession properties of the webclient.
*/
public class WebChatSessionProperties{
private ChatSession chatSession;
private long lastMessageTime;
/**
* Create a new instance
* @param chatSession Valid ChatSession of client
* @param lastMessageTime Last message time used for timeout
*/
public WebChatSessionProperties(ChatSession chatSession,long lastMessageTime){
this.chatSession = chatSession;
this.lastMessageTime = lastMessageTime;
}
/**
* Get ChatSession
* @return A valid ChatSession
*/
public ChatSession getChatSession() {
return chatSession;
}
/**
* Get last message time
* @return long time in millis
*/
public long getLastMessageTime() {
return lastMessageTime;
}
/**
* Set last message time
* @param lastMessageTime long time in millis
*/
public void setLastMessageTime(long lastMessageTime) {
this.lastMessageTime = lastMessageTime;
}
}
| [
"miha.blazin@gmail.com"
] | miha.blazin@gmail.com |
ca252a18bfb57756ed3b5618f3f6d2fb41c09ea4 | c1a2842260284e0836aab09f400121c26ecb8b38 | /src/java/org/cloudata/core/client/cql/element/ExpressionElement.java | 55b08ca27964d88dce434571cfe8b0498ca00297 | [
"Apache-2.0"
] | permissive | Taehui/cloudata | 7765f8b11d716e3671373543ab65bf56c0aca9e0 | a5f12d2377e2336c389a88a76d38c2cac68fa3c5 | refs/heads/master | 2020-12-25T12:47:58.085650 | 2011-03-06T23:46:42 | 2011-03-06T23:46:42 | 1,433,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cloudata.core.client.cql.element;
import org.cloudata.core.common.conf.CloudataConf;
/**
* @author jindolk
*
*/
public interface ExpressionElement {
public String getQuery(CloudataConf conf);
}
| [
"typoskwon@gmail.com"
] | typoskwon@gmail.com |
eb6107ccbdf7368af0b03c8513fe12c5122c2305 | 09a1c9aeef299b7ad9d3f0769863518e9d8dab78 | /quizApi/src/main/java/org/pg6100/quizApi/dto/SubCategoryDto.java | c9d6ef8c7b479bfdefca0e6b3b22072ec561f56f | [] | no_license | joarkosberg/PG6100-JEE-Exercise | 117ebbc8c5839f7b181a4b98feaa9a57af4b411a | bf0c84b888415a7d49192a69980f72a004597739 | refs/heads/master | 2021-01-17T15:06:08.035147 | 2017-02-18T23:24:44 | 2017-02-18T23:24:44 | 71,797,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package org.pg6100.quizApi.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel("A sub category belonging to a parent category")
public class SubCategoryDto {
@ApiModelProperty("Id of the category")
public String id;
@ApiModelProperty("Name of subcategory")
public String name;
@ApiModelProperty("Parent category")
public CategoryDto category;
@ApiModelProperty("A list sub sub categories")
public List<SubSubCategoryDto> subSubCategories;
public SubCategoryDto(){}
public SubCategoryDto(String id, String name, CategoryDto category, List<SubSubCategoryDto> subSubCategories) {
this.id = id;
this.name = name;
this.category = category;
this.subSubCategories = subSubCategories;
}
}
| [
"joar_kosberg@hotmail.com"
] | joar_kosberg@hotmail.com |
6c432ac2a84ad397ce02bf813d149e54bca6dda4 | 1f22dcbed24deac0db3e1ccb21067f03f03b87ea | /src/main/java/com/wsk/life/controllerNo/user/CriticController.java | ea468b3fc13754d82e2b3e6adb3f889aabf84555 | [] | no_license | 2667339025/Music_Book_Movie | e67f265c3b61318700c36fe19eef56e5db8386f0 | f3a73a930a02d6cd1ab636d6e8b29d1153f67543 | refs/heads/master | 2022-12-24T13:17:15.247414 | 2020-10-11T16:10:55 | 2020-10-11T16:10:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 39,181 | java | package com.wsk.life.controllerNo.user;
import com.wsk.life.bean.CriticCommentBean;
import com.wsk.life.bean.MyCollectionBean;
import com.wsk.life.bean.MyCommentBean;
import com.wsk.life.bean.UserPublish;
import com.wsk.life.domain.*;
import com.wsk.life.config.redis.IRedisUtils;
import com.wsk.life.service.admin.ReportRepository;
import com.wsk.life.bean.admin.CriticReportEntity;
import com.wsk.life.config.tool.SensitivewordFilter;
import com.wsk.life.config.tool.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.*;
/**
* Created by wsk1103 on 2017/5/1.
*/
@Controller
public class CriticController extends AsideController {
/* @Resource(name = "publishCriticService")
private PublishCriticService publishCriticService;
@Resource
private UserInformationService userInformationService;
@Resource
private CommentCriticService commentCriticService;
@Resource
private CollectionCriticService collectionCriticService;
@Resource
private GoodCriticService goodCriticService;
@Resource
private MyFriendsService myFriendsService;
*/
@Value("${absoluteImgPath}")
String absoluteImgPath;
@Value("${sonImgPath}")
String sonImgPath;
@Autowired
private ReportRepository reportRepository;
public CriticController(IRedisUtils redisUtils) {
super(redisUtils);
}
//发表影评
@RequestMapping(value = "/publishCritic", method = {RequestMethod.POST, RequestMethod.GET})
@ResponseBody
public Map publishCritic(HttpServletRequest request,
@RequestParam(value = "file_upload", required = false) MultipartFile file_upload,
@RequestParam String movie_name, @RequestParam String movie_content, @RequestParam int isPrivate) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
Map<String, String> map = new HashMap<>();
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
map.put("result", "0");
return map;
}
String path = "", save = "";
// movie_content = Tool.getInstance().txtReplace(movie_content);
movie_content = SensitivewordFilter.replaceSensitiveWord(movie_content);
movie_name = SensitivewordFilter.replaceSensitiveWord(movie_name);
if (movie_content.length() < 1 || movie_name.length() < 1) {
map.put("result", "0");
return map;
}
if (movie_content.length() > 122 || movie_name.length() > 122) {
map.put("result", "0");
return map;
}
if (Tool.getInstance().isNullOrEmpty(file_upload)) {
map.put("result", "0");
} else {
path = absoluteImgPath;
// path += "/image/userPicture/";
String fileName = Tool.getInstance().getRandom() + System.currentTimeMillis() + ".jpg";
File image = new File(path + fileName);
File isTest = new File(path);
if (!isTest.exists()) {
path = absoluteImgPath+"//data//";
image = new File(path + fileName);
boolean result = false;
try {
result = image.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
if (!result){
map.put("result", "0");
return map;
}
} else if (!image.getParentFile().exists()) {
boolean result = image.mkdir();
if (!result){
map.put("result", "0");
return map;
}
}
try {
file_upload.transferTo(image);
} catch (Exception e) {
map.put("result", "0");
e.printStackTrace();
return map;
}
StringBuilder thumbnails = new StringBuilder();
thumbnails.append(path);
thumbnails.append("//thumbnails//");
thumbnails.append(fileName);
/*path = path + fileName;
//色情图片识别
if (!Tool.getInstance().checkPornograp(path)){
map.put("result", "2");
return map;
}
if (Tool.getInstance().thumbnails(path, thumbnails.toString())) {
save = sonImgPath+"//thumbnails//" + fileName;
} else {
map.put("result", "0");
return map;
}*/
path = sonImgPath + fileName;
}
PublishCritic publishCritic = new PublishCritic();
publishCritic.setCritic(movie_content);
publishCritic.setGood(0);
publishCritic.setIsprivate(isPrivate);
publishCritic.setPicture(path);
publishCritic.setThumbnails(save);
publishCritic.setTime(new Date());
publishCritic.setTitle(movie_name);
publishCritic.setUid((Integer) request.getSession().getAttribute("uid"));
publishCritic.setAllow((short) 1);
publishCritic.setModified(new Date());
int id_result = publishCriticService.insertObject(publishCritic);
if (id_result != 1) {
map.put("result", "0");
return map;
}
map.put("result", "1");
return map;
}
@RequestMapping(value = "test")
public String test(Model model) {
try {
List<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
// list.add(3);
// list.add(4);
List<UserInformation> userInformations;
List<PublishCritic> publishCritics;
userInformations = userInformationService.getAllForeach(list);
List<Integer> ids = new ArrayList<>();
for (UserInformation userInformation : userInformations) {
ids.add(userInformation.getId());
}
Map<String, Object> map = new HashMap<>();
map.put("list", ids);
map.put("start", 1);
publishCritics = publishCriticService.getAllForeach(map);
for (PublishCritic publishCritic : publishCritics) {
System.out.println(publishCritic.getCritic());
}
model.addAttribute("users", publishCritics);
} catch (Exception e) {
e.printStackTrace();
}
return "all";
}
@RequestMapping(value = "/getCommentCounts", method = RequestMethod.POST)
@ResponseBody
public int getCommentCounts(@RequestParam int id) {
return commentCriticService.getCounts(id);
}
//获取用户的影评
@RequestMapping(value = "/getUP", method = RequestMethod.POST)
@ResponseBody
public List getUserPublish(HttpServletRequest request, @RequestParam int start) {
System.out.println("run getUP " + new Date() + " " + start);
List<UserPublish> list = new ArrayList<>();
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return list;
}
int uid = userInformation.getId();
list = getPublishCritic(uid, start);
return list;
}
//通过用户id获取用户的影评
@RequestMapping(value = "/getPublishCriticByUid", method = RequestMethod.POST)
@ResponseBody
public List getPublishCriticByUid(HttpServletRequest request, @RequestParam int uid, @RequestParam int start) {
List<PublishCritic> list;
List<UserPublish> userPublishes = new ArrayList<>();
Map<String, Integer> map = new HashMap<>();
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
map.put("isPrivate", 0);
} else {
int id = userInformation.getId();
Map<String, Integer> myFriendMap = new HashMap<>();
myFriendMap.put("uid", id);
myFriendMap.put("fid", uid);
MyFriends myFriends = myFriendsService.isFriends(myFriendMap);
if (Tool.getInstance().isNullOrEmpty(myFriends)) {
map.put("isPrivate", 0);
} else {
map.put("isPrivate", 1);
}
}
map.put("uid", uid);
map.put("start", (start - 1) * 10);
list = publishCriticService.getPublishCriticByUid(map);
UserInformation user = userInformationService.selectByPrimaryKey(uid);
for (PublishCritic p : list) {
UserPublish userPublish = new UserPublish();
userPublish.setUid(user.getId());
userPublish.setAvatar(user.getAvatar());
userPublish.setName(user.getName());
userPublish.setPid(p.getId());
userPublish.setTime(Tool.getInstance().dateToStringWithHours(p.getTime()));
userPublish.setTitle(p.getTitle());
userPublish.setCritic(p.getCritic());
userPublish.setPicture(p.getPicture());
userPublish.setThumbnails(p.getThumbnails());
userPublish.setCollectionCounts(collectionCriticService.getCounts(p.getId()));
userPublish.setCommentCounts(commentCriticService.getCounts(p.getId()));
userPublish.setGoodCounts(goodCriticService.getCounts(p.getId()));
userPublish.setGood(isGood(uid, p.getId()) ? 1 : 0);
userPublish.setCollection(isCollection(uid, p.getId()) ? 1 : 0);
userPublishes.add(userPublish);
}
return userPublishes;
}
//获取热门的10条影评
@RequestMapping(value = "/getHotCritic", method = RequestMethod.POST)
@ResponseBody
public List getHotCritic(@RequestParam int start, HttpServletRequest request) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
userInformation = new UserInformation();
userInformation.setId(0);
}
List<PublishCritic> publishCritics = publishCriticService.getHotCritic((start - 1) * 10);
List<Integer> list = new ArrayList<>();
for (PublishCritic p : publishCritics) {
list.add(p.getUid());
}
List<UserInformation> userInformations = userInformationService.getAllForeach(list);
List<UserPublish> userPublishes = new ArrayList<>();
for (PublishCritic p : publishCritics) {
UserPublish userPublish = new UserPublish();
a:
for (UserInformation u : userInformations) {
if (Objects.equals(p.getUid(), u.getId())) {
userPublish.setName(u.getName());
userPublish.setAvatar(u.getAvatar());
userPublish.setUid(u.getId());
break a;
}
}
userPublish.setCommentCounts(commentCriticService.getCounts(p.getId()));
userPublish.setGoodCounts(goodCriticService.getCounts(p.getId()));
userPublish.setThumbnails(p.getThumbnails());
userPublish.setIsPrivate(p.getIsprivate());
userPublish.setCollectionCounts(collectionCriticService.getCounts(p.getId()));
userPublish.setPicture(p.getPicture());
userPublish.setCritic(p.getCritic());
userPublish.setTitle(p.getTitle());
userPublish.setPid(p.getId());
userPublish.setFriend(isFriends(userInformation.getId(), p.getUid()) ? 1 : 0);
userPublish.setTime(Tool.getInstance().dateToStringWithHours(p.getTime()));
userPublish.setGood(isGood(userInformation.getId(), p.getId()) ? 1 : 0);
userPublish.setCollection(isCollection(userInformation.getId(), p.getId()) ? 1 : 0);
userPublishes.add(userPublish);
}
// model.addAttribute("result", userPublishes);
// model.addAttribute("userInformation", userInformation);
return userPublishes;
}
//通过影评id获取对应的评论
@RequestMapping(value = "/getCommentByPid", method = RequestMethod.POST)
@ResponseBody
public List getCommentByPid(@RequestParam int start, @RequestParam int pid) {
Map<String, Integer> map = new HashMap<>();
map.put("start", (start - 1) * 10);
map.put("pid", pid);
List<CommentCritic> commentCritics = commentCriticService.getCommentByPid(map);
List<Integer> ids = new ArrayList<>();
for (CommentCritic c : commentCritics) {
if (!ids.contains(c.getUid())) {
ids.add(c.getUid());
}
}
List<CriticCommentBean> criticCommentBeans = new ArrayList<>();
if (ids.size() == 0) {
return criticCommentBeans;
}
List<UserInformation> userInformations = userInformationService.getAllForeach(ids);
for (CommentCritic c : commentCritics) {
CriticCommentBean criticCommentBean = new CriticCommentBean();
a:
for (UserInformation u : userInformations) {
if (Objects.equals(c.getUid(), u.getId())) {
criticCommentBean.setAvatar(u.getAvatar());
criticCommentBean.setName(u.getName());
criticCommentBean.setUid(u.getId());
break a;
}
}
criticCommentBean.setCritic(c.getCritic());
criticCommentBean.setGood(c.getGood());
criticCommentBean.setId(c.getId());
criticCommentBean.setPid(c.getPid());
criticCommentBean.setTime(Tool.getInstance().dateToStringWithHours(c.getTime()));
criticCommentBeans.add(criticCommentBean);
}
return criticCommentBeans;
}
//取消关注,举报,+关注
@RequestMapping(value = "/action", method = RequestMethod.POST)
@ResponseBody
public Map<String, Integer> action(HttpServletRequest request, @RequestParam int id,
@RequestParam String action) {
Map<String, Integer> map = new HashMap<>();
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
map.put("result", 0);
return map;
}
// action = action.substring(1);
int uid = userInformation.getId();
int result = -1;
Map<String, Integer> map1;
try {
switch (action) {
case "addattention":
if (Tool.getInstance().isNullOrEmpty(id)) {
map.put("result", 2);//关注失败
return map;
}
Map<String, Integer> ids = new HashMap<>();
ids.put("uid", uid);
ids.put("fid", id);
if (Tool.getInstance().isNullOrEmpty(myFriendsService.getFriends(ids))) {
MyFriends myFriends = new MyFriends();
myFriends.setAddtime(new Date());
myFriends.setAllow((short) 1);
myFriends.setFid(id);
myFriends.setModified(new Date());
myFriends.setUid(uid);
result = myFriendsService.insertSelective(myFriends);
if (result != 1) {
map.put("result", 2);//关注失败
return map;
} else {
map.put("result", 1);//关注成功
return map;
}
} else {
MyFriends myFriends = myFriendsService.getFriends(ids);
myFriends.setAllow((short) 1);
myFriends.setModified(new Date());
result = myFriendsService.updateByPrimaryKeySelective(myFriends);
if (result == 1) {
map.put("result", 1);
return map;
} else {
map.put("result", 2);
return map;
}
}
case "unsubscribe":
ids = new HashMap<>();
ids.put("uid", uid);
ids.put("fid", id);
MyFriends myFriends = myFriendsService.getFriends(ids);
if (!Tool.getInstance().isNullOrEmpty(myFriends)) {
if (myFriends.getAllow() == 1) {
myFriends.setAllow((short) 0);
myFriends.setModified(new Date());
try {
result = myFriendsService.updateByPrimaryKey(myFriends);
} catch (Exception e) {
e.printStackTrace();
}
if (result == 1) {
map.put("result", 7);
return map;
} else {
map.put("result", 2);
return map;
}
} else {
map.put("result", 2);
return map;
}
} else {
map.put("result", 2);
return map;
}
case "report":
map.put("result", 3);
CriticReportEntity criticReportEntity = new CriticReportEntity();
criticReportEntity.setCtime(new Timestamp(System.currentTimeMillis()));
criticReportEntity.setPid(id);
criticReportEntity.setUid(uid);
reportRepository.save(criticReportEntity);
return map;
case "delcritic":
if (Tool.getInstance().isNullOrEmpty(id)) {
map.put("result", 2);
return map;
}
map1 = new HashMap<>(4);
map1.put("id", id);
map1.put("uid", uid);
PublishCritic publishCritic = publishCriticService.selectByIdAndAllow(map1);
if (Tool.getInstance().isNullOrEmpty(publishCritic)) {
map.put("result", 2);
return map;
}
publishCritic.setAllow((short) 0);
publishCritic.setModified(new Date());
result = publishCriticService.updateObject(publishCritic);
if (result == 1) {
map.put("result", 4);
return map;
} else {
map.put("result", 2);
return map;
}
case "translation":
if (Tool.getInstance().isNullOrEmpty(id)) {
map.put("result", 2);
return map;
}
publishCritic = publishCriticService.getObjectById(id);
// publishCritic.setAllow((short) 0);
publishCritic.setIsprivate(1);
publishCritic.setModified(new Date());
result = publishCriticService.updateObject(publishCritic);
if (result == 1) {
map.put("result", 5);
return map;
} else {
map.put("result", 2);
return map;
}
case "delcomment":
if (Tool.getInstance().isNullOrEmpty(id)) {
map.put("result", 2);
return map;
}
map1 = new HashMap<>();
map1.put("id", id);
map1.put("uid", uid);
CommentCritic commentCritic = commentCriticService.selectByIdAndAllow(map1);
if (Tool.getInstance().isNullOrEmpty(commentCritic)) {
map.put("result", 2);
return map;
}
commentCritic.setAllow((short) 0);
commentCritic.setModified(new Date());
result = commentCriticService.updateByPrimaryKeySelective(commentCritic);
if (result == 1) {
map.put("result", 6);
return map;
} else {
map.put("result", 2);
return map;
}
default:
map.put("result", 2);
return map;
}
} catch (Exception e) {
map.put("result", 2);
return map;
}
}
//获取更多我的评论
@RequestMapping(value = "/getMyComment", method = RequestMethod.POST)
@ResponseBody
public List getMyComment(@RequestParam int start, HttpServletRequest request) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
List<MyCommentBean> list = new ArrayList<>();
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return list;
}
Map<String, Integer> map = new HashMap<>();
map.put("uid", userInformation.getId());
map.put("start", (start - 1) * 10);
List<CommentCritic> commentCritics = commentCriticService.selectByUid(map);
MyCommentBean myCommentBean;
UserInformation user;
PublishCritic publishCritic;
for (CommentCritic c : commentCritics) {
user = userInformationService.selectByPrimaryKey(c.getUid());
publishCritic = publishCriticService.getObjectById(c.getPid());
myCommentBean = new MyCommentBean();
myCommentBean.setAvatar(userInformation.getAvatar());
myCommentBean.setCritic(publishCritic.getCritic());
myCommentBean.setComment(c.getCritic());
myCommentBean.setFid(userInformation.getId());
myCommentBean.setPid(publishCritic.getId());
myCommentBean.setCommentTime(Tool.getInstance().dateToStringWithHours(c.getTime()));
myCommentBean.setName(user.getName());
myCommentBean.setCid(c.getId());
list.add(myCommentBean);
}
return list;
}
//获得更多我的收藏
@RequestMapping(value = "/getMyCollection")
@ResponseBody
public List getMyCollection(@RequestParam int start, HttpServletRequest request) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
List<MyCollectionBean> list = new ArrayList<>();
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return list;
}
Map<String, Integer> map = new HashMap<>();
int uid = userInformation.getId();
map.put("uid", uid);
map.put("start", (start - 1) * 10);
List<CollectionCritic> collectionCritics;
try {
collectionCritics = collectionCriticService.selectByUid(map);
} catch (Exception e) {
e.printStackTrace();
return list;
}
PublishCritic publishCritic;
MyCollectionBean myCollectionBean;
UserInformation user;
for (CollectionCritic c : collectionCritics) {
myCollectionBean = new MyCollectionBean();
try {
publishCritic = publishCriticService.getObjectById(c.getPid());
user = userInformationService.selectByPrimaryKey(publishCritic.getUid());
myCollectionBean.setCollectionCounts(collectionCriticService.getCounts(c.getPid()));
myCollectionBean.setCommentCounts(commentCriticService.getCounts(c.getPid()));
myCollectionBean.setGoodCounts(goodCriticService.getCounts(c.getPid()));
} catch (Exception e) {
return list;
}
myCollectionBean.setCollection(1);
myCollectionBean.setGood(isGood(uid, user.getId()) ? 1 : 0);
myCollectionBean.setFriend(isFriends(uid, user.getId()) ? 1 : 0);
myCollectionBean.setTime(Tool.getInstance().dateToStringWithHours(publishCritic.getTime()));
myCollectionBean.setCollectionTime(Tool.getInstance().dateToStringWithHours(c.getTime()));
myCollectionBean.setAvatar(user.getAvatar());
myCollectionBean.setCritic(publishCritic.getCritic());
myCollectionBean.setIsPrivate(publishCritic.getIsprivate());
myCollectionBean.setName(user.getName());
myCollectionBean.setPicture(publishCritic.getPicture());
myCollectionBean.setPid(c.getPid());
myCollectionBean.setThumbnails(publishCritic.getThumbnails());
myCollectionBean.setTitle(publishCritic.getTitle());
myCollectionBean.setUid(publishCritic.getUid());
list.add(myCollectionBean);
}
return list;
}
//查看我更多的赞
@RequestMapping(value = "/getMyGood")
@ResponseBody
public List getMyGood(@RequestParam int start, HttpServletRequest request) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
List<MyCollectionBean> list = new ArrayList<>();
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return list;
}
Map<String, Integer> map = new HashMap<>();
int uid = userInformation.getId();
map.put("uid", uid);
map.put("start", (start - 1) * 10);
List<GoodCritic> goodCritics;
try {
goodCritics = goodCriticService.selectByUid(map);
} catch (Exception e) {
e.printStackTrace();
return list;
}
PublishCritic publishCritic;
MyCollectionBean myCollectionBean;
UserInformation user;
for (GoodCritic c : goodCritics) {
myCollectionBean = new MyCollectionBean();
try {
publishCritic = publishCriticService.getObjectById(c.getPid());
user = userInformationService.selectByPrimaryKey(publishCritic.getUid());
myCollectionBean.setCommentCounts(commentCriticService.getCounts(c.getPid()));
myCollectionBean.setGoodCounts(goodCriticService.getCounts(c.getPid()));
myCollectionBean.setCollectionCounts(collectionCriticService.getCounts(c.getPid()));
} catch (Exception e) {
return list;
}
myCollectionBean.setCollection(isCollection(uid, publishCritic.getId()) ? 1 : 0);
myCollectionBean.setGood(1);
myCollectionBean.setFriend(isFriends(uid, user.getId()) ? 1 : 0);
myCollectionBean.setTime(Tool.getInstance().dateToStringWithHours(publishCritic.getTime()));
myCollectionBean.setCollectionTime(Tool.getInstance().dateToStringWithHours(c.getTime()));
myCollectionBean.setAvatar(user.getAvatar());
myCollectionBean.setCritic(publishCritic.getCritic());
myCollectionBean.setIsPrivate(publishCritic.getIsprivate());
myCollectionBean.setName(user.getName());
myCollectionBean.setPicture(publishCritic.getPicture());
myCollectionBean.setPid(c.getPid());
myCollectionBean.setThumbnails(publishCritic.getThumbnails());
myCollectionBean.setTitle(publishCritic.getTitle());
myCollectionBean.setUid(publishCritic.getUid());
list.add(myCollectionBean);
}
return list;
}
//评论影评
@RequestMapping(value = "/commentCritic")
@ResponseBody
public Map commentCritic(HttpServletRequest request, @RequestParam String comment, @RequestParam int pid) {
Map<String, Integer> map = new HashMap<>();
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
map.put("result", 0);
return map;
}
// comment = Tool.getInstance().txtReplace(comment);
comment = SensitivewordFilter.replaceSensitiveWord(comment);
CommentCritic commentCritic = new CommentCritic();
commentCritic.setModified(new Date());
commentCritic.setCritic(comment);
commentCritic.setPid(pid);
commentCritic.setUid(userInformation.getId());
commentCritic.setTime(new Date());
int result;
try {
result = commentCriticService.insertSelective(commentCritic);
} catch (Exception e) {
result = 0;
}
if (result == 1) {
map.put("result", 1);
return map;
} else {
map.put("result", 0);
return map;
}
}
//点赞
@RequestMapping(value = "/addGood")
@ResponseBody
public int addGood(HttpServletRequest request, @RequestParam int pid) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return 0;
}
int uid = userInformation.getId();
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
GoodCritic goodCritic;
try {
goodCritic = goodCriticService.selectGoodAndAllow(map);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
if (Tool.getInstance().isNullOrEmpty(goodCritic)) {
goodCritic = new GoodCritic();
goodCritic.setAllow((short) 1);
goodCritic.setModified(new Date());
goodCritic.setPid(pid);
goodCritic.setTime(new Date());
goodCritic.setUid(uid);
int result;
try {
result = goodCriticService.insertSelective(goodCritic);
} catch (Exception e) {
return 0;
}
return result;
}
goodCritic.setModified(new Date());
goodCritic.setAllow((short) 1);
return goodCriticService.updateByPrimaryKeySelective(goodCritic);
}
//取消点赞
@RequestMapping(value = "/delGood")
@ResponseBody
public int delGood(HttpServletRequest request, @RequestParam int pid) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return 0;
}
int uid = userInformation.getId();
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
GoodCritic goodCritic;
try {
goodCritic = goodCriticService.selectGoodAndAllow(map);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
if (Tool.getInstance().isNullOrEmpty(goodCritic)) {
goodCritic = new GoodCritic();
goodCritic.setAllow((short) 0);
goodCritic.setModified(new Date());
goodCritic.setPid(pid);
goodCritic.setTime(new Date());
goodCritic.setUid(uid);
return goodCriticService.insertSelective(goodCritic);
}
goodCritic.setModified(new Date());
goodCritic.setAllow((short) 0);
return goodCriticService.updateByPrimaryKeySelective(goodCritic);
}
//收藏
@RequestMapping(value = "/addCollection")
@ResponseBody
public int addCollection(HttpServletRequest request, @RequestParam int pid) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return 0;
}
int uid, result;
uid = userInformation.getId();
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
CollectionCritic collectionCritic = collectionCriticService.selectCollectionAndAllow(map);
if (Tool.getInstance().isNullOrEmpty(collectionCritic)) {
collectionCritic = new CollectionCritic();
collectionCritic.setAllow((short) 1);
collectionCritic.setModified(new Date());
collectionCritic.setPid(pid);
collectionCritic.setUid(uid);
collectionCritic.setTime(new Date());
try {
result = collectionCriticService.insertSelective(collectionCritic);
return result;
} catch (Exception e) {
return 0;
}
}
collectionCritic.setAllow((short) 1);
collectionCritic.setModified(new Date());
try {
result = collectionCriticService.updateByPrimaryKeySelective(collectionCritic);
return result;
} catch (Exception e) {
return 0;
}
}
//取消收藏
@RequestMapping(value = "/delCollection")
@ResponseBody
public int delCollection(HttpServletRequest request, @RequestParam int pid) {
UserInformation userInformation = (UserInformation) request.getSession().getAttribute("userInformation");
if (Tool.getInstance().isNullOrEmpty(userInformation)) {
return 0;
}
int uid, result;
uid = userInformation.getId();
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
CollectionCritic collectionCritic = collectionCriticService.selectCollectionAndAllow(map);
if (Tool.getInstance().isNullOrEmpty(collectionCritic)) {
collectionCritic = new CollectionCritic();
collectionCritic.setAllow((short) 0);
collectionCritic.setModified(new Date());
collectionCritic.setPid(pid);
collectionCritic.setUid(uid);
collectionCritic.setTime(new Date());
try {
result = collectionCriticService.insertSelective(collectionCritic);
return result;
} catch (Exception e) {
return 0;
}
}
collectionCritic.setAllow((short) 0);
collectionCritic.setModified(new Date());
try {
result = collectionCriticService.updateByPrimaryKeySelective(collectionCritic);
return result;
} catch (Exception e) {
return 0;
}
}
private List<UserPublish> getPublishCritic(int uid, int start) {
List<UserPublish> list = new ArrayList<>();
// int uid = userInformation.getId();
List<MyFriends> myFriends;
List<PublishCritic> publishCritics;
List<UserInformation> userInformations;
myFriends = myFriendsService.getFid(uid);
List<Integer> ids = new ArrayList<>();
ids.add(uid);
for (MyFriends myFriend : myFriends) {
ids.add(myFriend.getFid());
}
start = (start - 1) * 10;
userInformations = userInformationService.getAllForeach(ids);
Map<String, Object> map = new HashMap<>();
map.put("list", ids);
map.put("start", start);
publishCritics = publishCriticService.getAllForeach(map);
for (PublishCritic p : publishCritics) {
UserPublish userPublish = new UserPublish();
a:
for (UserInformation u : userInformations) {
if (u.getId() == p.getUid()) {
userPublish.setAvatar(u.getAvatar());
userPublish.setName(u.getName());
userPublish.setUid(u.getId());
break a;
}
}
userPublish.setPid(p.getId());
userPublish.setTime(Tool.getInstance().dateToStringWithHours(p.getTime()));
userPublish.setTitle(p.getTitle());
userPublish.setCritic(p.getCritic());
userPublish.setPicture(p.getPicture());
userPublish.setThumbnails(p.getThumbnails());
userPublish.setCollectionCounts(collectionCriticService.getCounts(p.getId()));
userPublish.setCommentCounts(commentCriticService.getCounts(p.getId()));
userPublish.setGoodCounts(goodCriticService.getCounts(p.getId()));
userPublish.setGood(isGood(uid, p.getId()) ? 1 : 0);
userPublish.setCollection(isCollection(uid, p.getId()) ? 1 : 0);
list.add(userPublish);
}
return list;
}
//判断是否为关注,好友
public Boolean isFriends(int uid, int fid) {
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("fid", fid);
MyFriends myFriends;
try {
myFriends = myFriendsService.isFriends(map);
} catch (Exception e) {
myFriends = null;
}
if (Tool.getInstance().isNullOrEmpty(myFriends)) {
return false;
} else {
return true;
}
}
//是否点赞过
public boolean isGood(int uid, int pid) {
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
return !Tool.getInstance().isNullOrEmpty(goodCriticService.selectGood(map));
}
//是否收藏过
public boolean isCollection(int uid, int pid) {
Map<String, Integer> map = new HashMap<>();
map.put("uid", uid);
map.put("pid", pid);
return !Tool.getInstance().isNullOrEmpty(collectionCriticService.selectCollection(map));
}
}
| [
"2352938311@qq.com"
] | 2352938311@qq.com |
6b7150978c482e40039f6c4d87e00ac919e84618 | e0f183cd06533990f722326c57bf3c4e7bdca557 | /3.JavaMultithreading/src/com/javarush/task/task30/task3010/Solution.java | cb124cb14dbf51faa0d873f4ce714944d913a4d3 | [] | no_license | smb13/JavaRushTasks | 9aa507afb820ad772c632d52c25b378ab4373d78 | 913891ef12fb6ee48f6a79790f7f89012b2b9b9d | refs/heads/master | 2019-07-26T05:58:50.098586 | 2018-03-28T19:02:00 | 2018-03-28T19:02:00 | 94,015,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package com.javarush.task.task30.task3010;
/*
Минимальное допустимое основание системы счисления
*/
public class Solution {
public static void main(String[] args) {
try {
String s = args[0].toLowerCase();
//String s = "fgdi";
int result = 0;
char[] chrArr = s.toCharArray();
int max = 0;
for (char chr : chrArr) {
if (!(((int) chr >= 48 && (int) chr <= 57) || ((int) chr >= 97 && (int) chr <= 122))) {
System.out.println("incorrect");
return;
}
if ((int) chr > max) max = (int) chr;
}
if (max <= 57) {
result = 10 + max - 57;
if (max == 48) result = 2;
} else if (max <= 122) {
result = 10 + max - 96;
}
System.out.println(result);
} catch (Exception e) {
}
}
}
| [
"smb111@mail.ru"
] | smb111@mail.ru |
8d9fcafc1cd8a5f34c8198b7fdc2e36f0971aa4d | f1389fea59e6b64ac29eacdf0cc427935d58e2ee | /src/com/company/Alumno.java | 09c0303a5f69cab1d2fd425ff470857ef4d7ed49 | [] | no_license | alanspina/M-dulo-01-JAVA-POO-Entregable-Nro1 | de1782780ea1439eae1c3269274036307f94f253 | 4be206209682f0482bd29d5445da233d490a0807 | refs/heads/master | 2021-04-14T17:50:24.826479 | 2020-03-26T20:28:48 | 2020-03-26T20:28:48 | 249,251,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 990 | java | package com.company;
import java.util.Objects;
public class Alumno {
private String nombre;
private String apellido;
private Integer codigoDeAlumno;
public Alumno(String nombre, String apellido, Integer codigoDeAlumno) {
this.nombre = nombre;
this.apellido = apellido;
this.codigoDeAlumno = codigoDeAlumno;
}
//Crear un constructor para el alumno que tome por parámetro un nombre, un apellido y un código
//de alumno.
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Alumno alumno = (Alumno) o;
return Objects.equals(codigoDeAlumno, alumno.codigoDeAlumno);
}
// Un alumno es igual a otro si sus códigos de alumno son iguales
@Override
public int hashCode() {
return Objects.hash(codigoDeAlumno);
}
public Integer getCodigoDeAlumno() {
return codigoDeAlumno;
}
}
| [
"alanspina@gmail.com"
] | alanspina@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.